Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 50fe5ec2e9 | |||
| ebfd15796f | |||
| 5e93a89b3a | |||
| db683819c9 | |||
| 514eac93eb | |||
| 6206c687ad | |||
| 443cbbc23c | |||
| d87d22cf0e | |||
| 69107b7b84 | |||
| 1944cb8f5a |
@@ -0,0 +1,46 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
verify:
|
||||
name: Test and package
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.65.1-noble
|
||||
env:
|
||||
CI: true
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Check release metadata and public API contract
|
||||
run: npm run check:release
|
||||
|
||||
- name: Run structure, browser, and accessibility tests
|
||||
run: npm run test:all
|
||||
|
||||
- name: Build distribution files
|
||||
run: npm run build
|
||||
|
||||
- name: Check bundle size
|
||||
run: npm run size
|
||||
|
||||
- name: Test the packed package as a consumer
|
||||
run: npm run test:package
|
||||
|
||||
- name: Verify generated contracts are committed
|
||||
run: git diff --exit-code -- utilities.css public-api.json
|
||||
|
||||
- name: Verify package contents
|
||||
run: npm pack --dry-run
|
||||
@@ -0,0 +1,49 @@
|
||||
name: Release and RC
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Verify and publish
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.65.1-noble
|
||||
|
||||
steps:
|
||||
- name: Check out tagged source
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure Node and npm registry
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
cache: "npm"
|
||||
|
||||
- name: Install locked dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Verify tag and select npm channel
|
||||
id: release
|
||||
shell: bash
|
||||
run: |
|
||||
channel="$(node scripts/check-release-tag.mjs "${{ gitea.ref_name }}")"
|
||||
echo "channel=${channel}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Run the complete release contract
|
||||
run: npm run test:release
|
||||
|
||||
- name: Verify generated contracts are committed
|
||||
run: git diff --exit-code -- utilities.css public-api.json package-lock.json
|
||||
|
||||
- name: Publish package
|
||||
run: npm publish --tag "${{ steps.release.outputs.channel }}" --access public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
||||
@@ -0,0 +1,7 @@
|
||||
node_modules/
|
||||
playwright-report/
|
||||
test-results/
|
||||
.idea/
|
||||
dist/
|
||||
*.tgz
|
||||
|
||||
@@ -1,5 +1,39 @@
|
||||
# Changelog
|
||||
|
||||
## 1.0.0-rc.1
|
||||
|
||||
- Added a generated utility layer for layout, spacing, typography, colors, borders, shadows, responsive breakpoints, and interaction states.
|
||||
- Added standalone package exports for tokens, components, utilities, and base styles.
|
||||
- Added navbar, breadcrumbs, tabs, accordion, pagination, table, and spinner primitives.
|
||||
- Added semantic link, code, disabled, font-size, and breakpoint tokens.
|
||||
- Expanded the example page and validation checks for the public API.
|
||||
- Added a generated public API manifest, breaking-change detection, release metadata validation, and isolated tarball consumer tests.
|
||||
- Added forced-colors support with system-color mappings, non-color state cues, catalog guidance, and component-level Playwright regressions.
|
||||
- Made the built, import-free stylesheet the default package export while retaining modular source exports.
|
||||
- Added Chromium, Firefox, and WebKit release coverage plus a real PostCSS tarball-consumer build.
|
||||
- Added tag-verified npm release automation with `next` for release candidates and `latest` for stable releases.
|
||||
- Added browser, SemVer, deprecation, migration, and release-candidate support contracts.
|
||||
- Extended public API breaking-change detection to cover keyframe names.
|
||||
|
||||
## 0.4.0
|
||||
|
||||
- Added semantic success, danger, warning, backdrop, popover, and toast tokens.
|
||||
- Added dropdown, popover, tooltip, alert, toast, drawer, and fullscreen modal primitives.
|
||||
- Added success, link, block, large, and loading button/control states.
|
||||
- Added responsive cluster, dense grid, visibility, and overflow layout utilities.
|
||||
- Expanded the example page and documentation with framework-independent interaction patterns.
|
||||
|
||||
## 0.3.0
|
||||
|
||||
- Published the Frost foundation used by the Penguin-chat and Portfolio3 migrations.
|
||||
- Promoted the 0.2.0 theme, control, modal, and accessibility APIs as the current stable package surface.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
- Added semantic `--frost-color-selection` and `--frost-color-overlay` tokens for project-defined themes.
|
||||
- Added compact and icon button variants: `frost-button--sm` and `frost-button--icon`.
|
||||
- Added CSS-only modal primitives: `frost-backdrop`, `frost-modal`, and modal content/header/body/footer helpers.
|
||||
|
||||
## 0.1.0
|
||||
|
||||
- Added the semantic Frost token system.
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# Migrating from Frost 0.4 to 1.0
|
||||
|
||||
Frost 1.0 keeps the existing component and token names and adds a formal public API contract. The main packaging change is the default entrypoint.
|
||||
|
||||
## Default import
|
||||
|
||||
`@fretuks/frost` now resolves to the built, import-free `dist/frost.css` bundle. Existing imports normally continue to work:
|
||||
|
||||
```css
|
||||
@import "@fretuks/frost";
|
||||
```
|
||||
|
||||
If a build intentionally depended on the modular source entrypoint, use:
|
||||
|
||||
```css
|
||||
@import "@fretuks/frost/frost.css";
|
||||
```
|
||||
|
||||
The explicit `core`, `utility-layer`, `component-layer`, `tokens`, `components`, `utilities`, and `forced-colors` exports remain available. Bundled aliases are available as `@fretuks/frost/bundle` and `@fretuks/frost/bundle.min`. Import-free layer bundles are exported under `@fretuks/frost/dist/utility-layer.css` and `@fretuks/frost/dist/component-layer.css`, with matching `.min.css` variants.
|
||||
|
||||
## New behavior to verify
|
||||
|
||||
- Check custom themes in `forced-colors: active` and `prefers-contrast: more`.
|
||||
- Confirm interactive code still synchronizes `hidden`, `aria-expanded`, tab selection, and dialog focus; Frost supplies styles rather than behavior.
|
||||
- Review newly strengthened disabled, validation, current-page, and focus states.
|
||||
- If application CSS targets internal selectors instead of documented `frost-*` classes and properties, move those overrides to the public semantic tokens.
|
||||
|
||||
## Release-candidate installation
|
||||
|
||||
Install the candidate without changing the stable npm tag:
|
||||
|
||||
```bash
|
||||
npm install @fretuks/frost@next
|
||||
```
|
||||
|
||||
Run the application in Chromium, Firefox, and Safari/WebKit before promoting the exact candidate commit to `1.0.0`.
|
||||
@@ -1,22 +1,37 @@
|
||||
# Frost CSS Framework
|
||||
# Frost
|
||||
|
||||
Frost is a small, semantic CSS foundation for personal websites and web applications. It provides tokens, accessible base styles, layout primitives, controls, and a few common components without trying to replace Bootstrap or Tailwind.
|
||||
Frost ist eine kleine CSS-Basis für persönliche Websites und Web-Apps. Sie bringt Tokens, zugängliche Grundstyles, Utility-Klassen, Layout-Helfer, Controls und fertige Komponenten mit. Du kannst Frost also entweder eher wie Tailwind mit einzelnen Utilities oder eher wie Bootstrap mit Komponenten verwenden.
|
||||
|
||||
## Installation
|
||||
Die aktuelle 1.0-Vorabversion wird über den npm-Tag `next` veröffentlicht. Installiere sie mit `npm install @fretuks/frost@next`. Hinweise für bestehende 0.4-Projekte stehen in [MIGRATION.md](MIGRATION.md); Browser-, SemVer- und Deprecation-Verträge in [SUPPORT.md](SUPPORT.md).
|
||||
|
||||
For a static site:
|
||||
## Komponentenkatalog
|
||||
|
||||
Der interaktive [Komponentenkatalog](examples/index.html) zeigt die öffentliche Komponenten-API mit echten Live-Beispielen, kopierbarem HTML und konkreten Accessibility-Hinweisen. Suche und Theme-Wechsel funktionieren direkt im Browser; Dropdowns, Tabs, Accordions und Modals demonstrieren das erwartete Tastatur- und Fokusverhalten.
|
||||
|
||||
Die visuellen Regressionstests erzeugen für jede Komponentengruppe eigene Referenzbilder in heller, dunkler und erzwungener Systemfarb-Darstellung sowie für Desktop- und Mobile-Viewports. Dadurch lässt sich eine Änderung einer konkreten Gruppe zuordnen, ohne eine vollständige Galerieseite vergleichen zu müssen.
|
||||
|
||||
## Einbinden
|
||||
|
||||
Frost hat bewusst getrennte Schichten:
|
||||
|
||||
- `@fretuks/frost/core`: Tokens, Reset und Accessibility-Grundlagen
|
||||
- `@fretuks/frost/utility-layer`: Core plus Layout- und Utility-first-Klassen
|
||||
- `@fretuks/frost/component-layer`: Core plus Controls und fertige Komponenten
|
||||
- `@fretuks/frost`: gebündelte, import-freie Ausgabe mit allen Schichten
|
||||
|
||||
Für eine statische Website:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="frost/frost.css">
|
||||
```
|
||||
|
||||
For a CSS-aware build:
|
||||
Mit einem CSS-Build-Tool:
|
||||
|
||||
```css
|
||||
@import "./frost/frost.css";
|
||||
```
|
||||
|
||||
For npm-based projects:
|
||||
In einem npm-Projekt:
|
||||
|
||||
```bash
|
||||
npm install @fretuks/frost
|
||||
@@ -26,28 +41,89 @@ npm install @fretuks/frost
|
||||
@import "@fretuks/frost";
|
||||
```
|
||||
|
||||
## Basic usage
|
||||
Der Standardimport zeigt auf `dist/frost.css`. Für die minifizierte Ausgabe gibt es `@fretuks/frost/bundle.min`; die modulare Quell-Entrypoint bleibt unter `@fretuks/frost/frost.css` verfügbar.
|
||||
|
||||
Für die Utility-Schicht:
|
||||
|
||||
```css
|
||||
@import "@fretuks/frost/utility-layer";
|
||||
```
|
||||
|
||||
Für die Komponenten-Schicht:
|
||||
|
||||
```css
|
||||
@import "@fretuks/frost/component-layer";
|
||||
```
|
||||
|
||||
## Grundlegende Nutzung
|
||||
|
||||
```html
|
||||
<main class="frost-container frost-stack">
|
||||
<section class="frost-card frost-card--elevated">
|
||||
<h1>Welcome to Frost</h1>
|
||||
<p class="frost-text-muted">A compact foundation for reusable interfaces.</p>
|
||||
<a class="frost-button frost-button--primary" href="/start">Get started</a>
|
||||
<h1>Willkommen bei Frost</h1>
|
||||
<p class="frost-text-muted">Eine kleine Basis für wiederverwendbare Interfaces.</p>
|
||||
<a class="frost-button frost-button--primary" href="/start">Los geht's</a>
|
||||
</section>
|
||||
</main>
|
||||
```
|
||||
|
||||
## Utilities
|
||||
|
||||
Die Utility-Klassen folgen einem einfachen Muster und lassen sich kombinieren:
|
||||
|
||||
```html
|
||||
<section class="frost-grid frost-gap-6 frost-md:grid-cols-2">
|
||||
<article class="frost-bg-surface frost-border frost-rounded frost-p-6 frost-shadow-sm">
|
||||
<h2 class="frost-text-xl frost-font-bold">Eine Karte</h2>
|
||||
<p class="frost-mt-2 frost-text-muted">Abstände, Farben und Layout direkt im Markup.</p>
|
||||
</article>
|
||||
</section>
|
||||
```
|
||||
|
||||
Ein paar häufige Utilities:
|
||||
|
||||
- Layout: `frost-flex`, `frost-grid`, `frost-flex-wrap`, `frost-items-center`, `frost-justify-between`
|
||||
- Abstände: `frost-gap-4`, `frost-p-6`, `frost-px-4`, `frost-mt-4`, `frost-mx-auto`
|
||||
- Typografie: `frost-text-sm`, `frost-text-xl`, `frost-font-semibold`, `frost-text-muted`
|
||||
- Farben: `frost-bg-surface`, `frost-bg-soft`, `frost-text-accent`, `frost-text-danger`
|
||||
- Oberfläche: `frost-border`, `frost-rounded`, `frost-shadow`, `frost-overflow-hidden`
|
||||
|
||||
Responsive Varianten verwenden die Breakpoints `md` ab `48rem` und `lg` ab `64rem`:
|
||||
|
||||
```html
|
||||
<div class="frost-grid frost-grid-cols-1 frost-md:grid-cols-2 frost-lg:grid-cols-3">
|
||||
...
|
||||
</div>
|
||||
```
|
||||
|
||||
Für einfache Zustände gibt es ebenfalls Varianten:
|
||||
|
||||
```html
|
||||
<a class="frost-text-accent frost-hover:text-accent frost-focus:ring" href="/profil">
|
||||
Zum Profil
|
||||
</a>
|
||||
```
|
||||
|
||||
Die Utility-Datei wird aus `scripts/generate-utilities.mjs` erzeugt. Wenn sich die gemeinsame Utility-API ändert:
|
||||
|
||||
```bash
|
||||
npm run generate:utilities
|
||||
```
|
||||
|
||||
Utilities verwenden immer den Präfix `frost-`. Responsive Varianten folgen dem Muster `frost-md:*` und `frost-lg:*`; Zustände verwenden `frost-hover:*`, `frost-focus:*` und `frost-active:*`. Die Utility-Schicht enthält keine fertigen Komponenten und kann unabhängig von der Komponenten-Schicht eingesetzt werden.
|
||||
|
||||
Zusätzliche Utilities sind unter anderem `frost-relative`, `frost-absolute`, `frost-grid-cols-3`, `frost-col-span-2`, `frost-space-y-4`, `frost-opacity-50`, `frost-z-10` und `frost-truncate`.
|
||||
|
||||
## Layout
|
||||
|
||||
```html
|
||||
<div class="frost-grid" style="--frost-grid-min: 14rem">
|
||||
<article class="frost-card">One</article>
|
||||
<article class="frost-card">Two</article>
|
||||
<article class="frost-card">Eins</article>
|
||||
<article class="frost-card">Zwei</article>
|
||||
</div>
|
||||
```
|
||||
|
||||
`frost-stack`, `frost-row`, and `frost-grid` expose local custom properties for gap customization:
|
||||
`frost-stack`, `frost-row` und `frost-grid` haben lokale Custom Properties für den Abstand:
|
||||
|
||||
```html
|
||||
<div class="frost-stack" style="--frost-stack-gap: var(--frost-space-8)">
|
||||
@@ -55,33 +131,46 @@ npm install @fretuks/frost
|
||||
</div>
|
||||
```
|
||||
|
||||
## Forms
|
||||
Für kleinere, wiederkehrende Aktionen gibt es kompakte Buttons und Icon-Buttons:
|
||||
|
||||
```html
|
||||
<button class="frost-button frost-button--secondary frost-button--sm">Bearbeiten</button>
|
||||
<button class="frost-button frost-button--ghost frost-button--icon" aria-label="Schließen">×</button>
|
||||
```
|
||||
|
||||
## Formulare
|
||||
|
||||
```html
|
||||
<label class="frost-field">
|
||||
<span class="frost-label">Email</span>
|
||||
<span class="frost-label">E-Mail</span>
|
||||
<input class="frost-input" type="email" autocomplete="email">
|
||||
<span class="frost-help">We will only use this for account notifications.</span>
|
||||
<span class="frost-help">Wird nur für Benachrichtigungen zum Account verwendet.</span>
|
||||
</label>
|
||||
```
|
||||
|
||||
## Themes
|
||||
|
||||
Without an explicit theme, Frost follows `prefers-color-scheme`. Explicit themes override that behavior:
|
||||
Ohne explizites Theme richtet sich Frost nach `prefers-color-scheme`. Ein explizites Theme überschreibt dieses Verhalten:
|
||||
|
||||
```html
|
||||
<html data-theme="dark">
|
||||
```
|
||||
|
||||
or:
|
||||
oder:
|
||||
|
||||
```html
|
||||
<html data-theme="light">
|
||||
```
|
||||
|
||||
Frost does not require JavaScript; a theme switcher can be added later by Iceberg or ordinary vanilla JavaScript.
|
||||
Frost braucht kein JavaScript. Ein Theme-Schalter kann später mit Iceberg oder ganz normalem Vanilla-JavaScript ergänzt werden.
|
||||
|
||||
Projects with additional themes should override Frost's semantic roles rather than reaching into component selectors:
|
||||
Bei `forced-colors: active` hat das Betriebssystem Vorrang vor hellen, dunklen und benutzerdefinierten Themes. Frost bildet Flächen und Text auf `Canvas`/`CanvasText`, Controls auf `ButtonFace`/`ButtonText`, Links auf `LinkText`, Auswahl und Fokus auf `Highlight`/`HighlightText` sowie deaktivierte Inhalte auf `GrayText` ab. Fehler, Warnungen, Erfolg, Auswahl und aktive Zustände unterscheiden sich zusätzlich über Rahmenstil, Rahmenbreite oder Unterstreichung und sind damit nicht ausschließlich farbabhängig.
|
||||
|
||||
Bei `prefers-contrast: more` ohne Forced Colors verstärkt Frost Control- und Flächenrahmen, Fokus, Auswahl und Validierungszustände und hebt gedämpften Text auf die normale Textfarbe an. Benutzerdefinierte Theme-Farben bleiben in diesem Modus erhalten.
|
||||
|
||||
Eigene Erweiterungen sollten die automatische Anpassung bevorzugen. `forced-color-adjust: none` ist nur sinnvoll, wenn die Komponente anschließend vollständig mit Systemfarben definiert wird. Der [Komponentenkatalog](examples/index.html) zeigt die Palette und die erwarteten Zustände live.
|
||||
|
||||
Wenn ein Projekt weitere Themes braucht, sollten die semantischen Rollen von Frost überschrieben werden – nicht die Component-Selektoren:
|
||||
|
||||
```css
|
||||
body.theme-blue {
|
||||
@@ -93,9 +182,75 @@ body.theme-blue {
|
||||
}
|
||||
```
|
||||
|
||||
## Customization
|
||||
Für Theme-spezifische Auswahl- und Overlay-Farben gibt es `--frost-color-selection` und `--frost-color-overlay`. Die Modal-Styles kümmern sich nur um die Darstellung. Öffnen, Schließen, Fokusmanagement und ARIA-Verhalten bleiben Aufgabe der Anwendung.
|
||||
|
||||
Override semantic tokens in the project layer:
|
||||
Die Tokens von Frost sind semantisch und können bewusst überschrieben werden. Ein Anwendungstheme lässt sich auf einem Wrapper oder dem Dokument-Root setzen; die Component-Selektoren müssen dafür nicht neu definiert werden:
|
||||
|
||||
```css
|
||||
[data-theme="ocean"] {
|
||||
--frost-color-bg: #071a2b;
|
||||
--frost-color-surface: #0d2a40;
|
||||
--frost-color-text: #e8f5ff;
|
||||
--frost-color-accent: #55b9ff;
|
||||
--frost-color-accent-hover: #8bd1ff;
|
||||
--frost-color-border: #24516b;
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<div class="frost-backdrop" hidden></div>
|
||||
<section class="frost-modal" role="dialog" aria-modal="true" aria-labelledby="dialog-title" hidden>
|
||||
<div class="frost-modal__content">
|
||||
<header class="frost-modal__header"><h2 id="dialog-title">Bestätigen</h2></header>
|
||||
<div class="frost-modal__body">Fortfahren?</div>
|
||||
<footer class="frost-modal__footer"><button class="frost-button frost-button--primary">OK</button></footer>
|
||||
</div>
|
||||
</section>
|
||||
```
|
||||
|
||||
## Menüs, Popovers und Feedback
|
||||
|
||||
Frost liefert die visuellen Bausteine. Die Anwendung kümmert sich um Zustand, Positionierung und Tastaturverhalten. Am besten native Buttons, `aria-expanded`, `aria-controls` und `hidden` verwenden – dann funktioniert dasselbe Markup mit Vanilla-JavaScript oder einem Framework:
|
||||
|
||||
```html
|
||||
<div class="frost-dropdown">
|
||||
<button class="frost-button frost-button--secondary" aria-expanded="false" aria-controls="account-menu">Account</button>
|
||||
<div id="account-menu" class="frost-dropdown__menu" hidden>
|
||||
<a class="frost-dropdown__item" href="/profile">Profil</a>
|
||||
<button class="frost-dropdown__item" type="button">Abmelden</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="frost-alert frost-alert--warning" role="alert">
|
||||
<strong class="frost-alert__title">Daten prüfen</strong>
|
||||
<span class="frost-alert__body">Ein paar Felder brauchen noch Aufmerksamkeit.</span>
|
||||
</div>
|
||||
|
||||
<div class="frost-toast-region" aria-live="polite" aria-atomic="true">
|
||||
<div class="frost-toast frost-toast--success" role="status">
|
||||
<span>Erfolgreich gespeichert.</span>
|
||||
<button class="frost-button frost-button--icon" aria-label="Schließen">×</button>
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
Tooltips verwenden `data-frost-tooltip` und sollten ein zugängliches Label ergänzen, niemals ersetzen:
|
||||
|
||||
```html
|
||||
<button class="frost-button frost-button--icon frost-tooltip" data-frost-tooltip="Link kopieren" aria-label="Link kopieren">⧉</button>
|
||||
```
|
||||
|
||||
Das Verhalten von Modal, Drawer, Dropdown und Popover ist bewusst vom CSS getrennt. Eine Behavior-Schicht sollte `hidden` umschalten, `aria-expanded` synchron halten, den Fokus in Dialoge setzen, nach dem Schließen zum Trigger zurückbringen und – wo sinnvoll – mit Escape schließen. Für Modals `role="dialog" aria-modal="true"` und eine beschriftende Überschrift verwenden.
|
||||
|
||||
Weitere CSS-only Bausteine sind `frost-navbar`, `frost-breadcrumbs`, `frost-tabs`, `frost-accordion`, `frost-pagination`, `frost-table` und `frost-spinner`. Sie liefern Markup-Struktur und Zustände; Interaktionen wie Tabs umschalten oder Accordion öffnen bleiben bei der Anwendung.
|
||||
|
||||
## Responsive Helfer
|
||||
|
||||
`frost-cluster` ist eine umbrechende Flex-Reihe für Aktionen. `frost-hide-mobile`, `frost-show-mobile`, `frost-hide-desktop` und `frost-responsive` decken ein paar typische Responsive-Fälle ab. Layout-Komponenten haben lokale Properties wie `--frost-grid-min` und `--frost-cluster-gap`, sodass sie ohne neue Framework-Klassen angepasst werden können.
|
||||
|
||||
## Anpassen
|
||||
|
||||
Semantische Tokens können auf Projektebene überschrieben werden:
|
||||
|
||||
```css
|
||||
:root {
|
||||
@@ -105,19 +260,66 @@ Override semantic tokens in the project layer:
|
||||
}
|
||||
```
|
||||
|
||||
The public API uses the `frost-` class prefix and `--frost-*` custom-property prefix to reduce collisions with project CSS and third-party libraries.
|
||||
Die öffentliche API verwendet den Präfix `frost-` für Klassen und `--frost-*` für Custom Properties. So gibt es weniger Konflikte mit dem eigenen CSS und Libraries von Drittanbietern.
|
||||
|
||||
## Package maintenance
|
||||
## Paket pflegen
|
||||
|
||||
The package intentionally ships only the CSS modules, documentation, license, and small dependency-free validation scripts. Example pages remain in the repository but are excluded from the npm tarball.
|
||||
Das Paket enthält absichtlich nur die CSS-Module, die Doku, die Lizenz und ein paar kleine, dependency-freie Validierungsskripte. Beispielseiten bleiben im Repository, landen aber nicht im npm-Tarball.
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
npm run size
|
||||
npm run check:release
|
||||
npm run test:package
|
||||
npm pack --dry-run
|
||||
```
|
||||
|
||||
## Philosophy
|
||||
`prepack` erzeugt vor jedem Tarball die Utilities und `public-api.json` neu, baut alle Dateien unter `dist/` und prüft anschließend Version, Changelog und API-Vertrag. `npm run test:package` installiert den gebauten Tarball in ein isoliertes temporäres Consumer-Projekt und löst jeden Eintrag aus `package.json#exports` auf.
|
||||
|
||||
Frost is intentionally smaller than Bootstrap and Tailwind. It establishes predictable foundations while leaving branding, page composition, JavaScript behavior, and specialized components to the project using it.
|
||||
`public-api.json` ist die versionierte Baseline für alle öffentlichen `frost-*`-Klassen, `--frost-*`-Properties, Keyframes, CSS-Layer und Paket-Exports. Neue APIs werden mit `npm run generate:api` aufgenommen. Entfernte Klassen, Properties, Keyframes, Layer oder Exportpfade werden als Breaking Change abgelehnt. Für einen bewusst brechenden Release muss die Baseline explizit aktualisiert werden:
|
||||
|
||||
```bash
|
||||
npm run generate:api -- --allow-breaking
|
||||
```
|
||||
|
||||
Nach einer Generierung sollten `utilities.css` und `public-api.json` gemeinsam mit der verursachenden Änderung committed werden. CI prüft, dass beide Dateien nach dem Packaging unverändert bleiben.
|
||||
|
||||
Browser- und Accessibility-Regressionstests laufen mit Playwright und axe-core gegen die Beispielseite. Beim ersten Mal muss Chromium installiert werden:
|
||||
|
||||
```bash
|
||||
npx playwright install chromium firefox webkit
|
||||
npm run test:browser
|
||||
```
|
||||
|
||||
Die Suite prüft Chromium, Firefox und WebKit sowie Desktop- und Mobile-Ansichten, helle und dunkle Themes, Forced Colors, Tastaturinteraktionen und WCAG-A/AA-Regeln. Die Forced-Colors-Fälle kontrollieren zusätzlich Systemfarb-Mappings sowie sichtbare Fokus-, Fehler-, Auswahl- und Disabled-Zustände. Pixelbaselines bleiben bewusst Chromium-spezifisch; die anderen Engines laufen durch semantische, interaktive und Accessibility-Prüfungen. Absichtliche visuelle Änderungen aktualisieren die gespeicherten Referenzbilder mit:
|
||||
|
||||
```bash
|
||||
npm run test:browser:update
|
||||
```
|
||||
|
||||
`npm run test:all` verbindet die schnellen Strukturprüfungen mit den Browser-Tests und ist der empfohlene CI-Einstiegspunkt.
|
||||
|
||||
## Release Candidate und Veröffentlichung
|
||||
|
||||
Ein Release wird ausschließlich von einem Tag veröffentlicht, der exakt zur Version in `package.json`, `package-lock.json` und `CHANGELOG.md` passt. `scripts/check-release-tag.mjs` lehnt abweichende Tags ab. Vorabversionen wie `v1.0.0-rc.1` landen automatisch unter `next`; stabile Versionen wie `v1.0.0` unter `latest`.
|
||||
|
||||
```bash
|
||||
npm run check:tag -- v1.0.0-rc.1
|
||||
npm run test:release
|
||||
git tag v1.0.0-rc.1
|
||||
git push origin v1.0.0-rc.1
|
||||
```
|
||||
|
||||
Die Gitea-Release-Action benötigt ein Repository-Secret `NPM_TOKEN` mit Publish-Rechten für `@fretuks/frost`. npm Trusted Publishing unterstützt die selbst gehostete Gitea-Instanz nicht; der Token sollte deshalb granular auf dieses Paket begrenzt und regelmäßig rotiert werden. Nach erfolgreicher RC-Prüfung wird dieselbe Commit-Basis auf `1.0.0` umgestellt, erneut vollständig getestet und als `v1.0.0` getaggt.
|
||||
|
||||
Neben dem vollständigen Paket können einzelne Schichten importiert werden:
|
||||
|
||||
```css
|
||||
@import "@fretuks/frost/utilities";
|
||||
@import "@fretuks/frost/components";
|
||||
@import "@fretuks/frost/tokens";
|
||||
```
|
||||
|
||||
## Warum das Ganze?
|
||||
|
||||
Frost soll eine überschaubare, verlässliche Grundlage sein. Branding, konkrete Seitengestaltung, JavaScript-Verhalten und speziellere Komponenten bleiben dort, wo sie hingehören: im jeweiligen Projekt.
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Frost support contract
|
||||
|
||||
## Browser baseline
|
||||
|
||||
Frost 1.x supports evergreen browser engines from this minimum baseline:
|
||||
|
||||
- Chromium 111, including Microsoft Edge 111
|
||||
- Firefox 113
|
||||
- Safari 16.4 and the corresponding WebKit generation
|
||||
|
||||
The baseline is aligned with the modern CSS used by Frost, including cascade layers and `color-mix()`. Chromium, Firefox, and WebKit run semantic, interaction, axe, and rendering smoke tests. Forced-colors and increased-contrast assertions run when the engine exposes the relevant emulation and are feature-detected otherwise. Pixel snapshots remain Chromium-only so rendering-engine differences do not produce noisy baselines.
|
||||
|
||||
Support means the public styles render and documented component states remain usable. It does not promise pixel-identical output between engines or operating systems.
|
||||
|
||||
## Versioning and deprecation
|
||||
|
||||
Frost follows Semantic Versioning after 1.0:
|
||||
|
||||
- Patch releases fix bugs without intentionally changing the public contract.
|
||||
- Minor releases may add classes, custom properties, keyframes, layers, and export paths.
|
||||
- Major releases may remove or change public API after migration guidance has been published.
|
||||
|
||||
Public classes, `--frost-*` custom properties, named keyframes, cascade layers, and package exports are recorded in `public-api.json`. A removal or export retarget is rejected unless the manifest is deliberately regenerated with `--allow-breaking`.
|
||||
|
||||
Deprecations remain available for at least one minor release and are called out in the changelog before removal. Accessibility regressions are treated as bugs, not breaking changes.
|
||||
|
||||
## Security and support requests
|
||||
|
||||
Use the repository issue tracker for browser bugs, accessibility problems, and packaging defects. Do not include credentials, private npm tokens, or sensitive application data in reports.
|
||||
|
||||
The project ships CSS and build-time validation scripts; it does not execute JavaScript in consumer applications.
|
||||
@@ -25,7 +25,8 @@
|
||||
:where(button:disabled, input:disabled, select:disabled, textarea:disabled) { cursor: not-allowed; }
|
||||
:where(img, picture, video, canvas, svg) { display: block; max-width: 100%; }
|
||||
:where(img, video) { height: auto; }
|
||||
:where(a) { color: var(--frost-color-accent); }
|
||||
:where(a) { color: var(--frost-color-link); }
|
||||
:where(a:hover) { color: var(--frost-color-link-hover); }
|
||||
:where(button) { color: inherit; }
|
||||
:where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) { margin-block: 0; }
|
||||
:where(h1, h2, h3, h4, h5, h6) {
|
||||
@@ -36,8 +37,10 @@
|
||||
:where(h1) { font-size: clamp(2rem, 5vw, 3.5rem); }
|
||||
:where(h2) { font-size: var(--frost-font-size-xl); }
|
||||
:where(code, kbd, pre) { font-family: var(--frost-font-mono); }
|
||||
:where(code, kbd) { padding: 0.1em 0.3em; border-radius: var(--frost-radius-sm); background: var(--frost-color-code-bg); color: var(--frost-color-code-text); }
|
||||
:where(pre) { overflow: auto; padding: var(--frost-space-4); border: 1px solid var(--frost-color-border); border-radius: var(--frost-radius-md); background: var(--frost-color-code-bg); color: var(--frost-color-code-text); }
|
||||
:where(table) { border-collapse: collapse; border-spacing: 0; }
|
||||
:where(th, td) { text-align: start; }
|
||||
:where(::selection) { background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
|
||||
:where(::selection) { background: var(--frost-color-selection); color: var(--frost-color-on-accent); }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
@layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.controls, frost.components, frost.forced-colors;
|
||||
|
||||
@import url("./core.css");
|
||||
@import url("./layout.css") layer(frost.layout);
|
||||
@import url("./controls.css") layer(frost.controls);
|
||||
@import url("./components.css") layer(frost.components);
|
||||
@@ -37,16 +37,114 @@
|
||||
.frost-notice--warning { border-color: var(--frost-color-warning); }
|
||||
.frost-notice--danger { border-color: var(--frost-color-danger); }
|
||||
|
||||
.frost-alert { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: var(--frost-space-3); padding: var(--frost-space-4); border: 1px solid var(--frost-color-border); border-radius: var(--frost-radius-md); background: var(--frost-color-surface); color: var(--frost-color-text); }
|
||||
.frost-alert--info { border-color: var(--frost-color-info); }
|
||||
.frost-alert--success { border-color: var(--frost-color-success); }
|
||||
.frost-alert--warning { border-color: var(--frost-color-warning); }
|
||||
.frost-alert--danger { border-color: var(--frost-color-danger); }
|
||||
.frost-alert__title { font-weight: 700; }
|
||||
.frost-alert__body { color: var(--frost-color-text-muted); }
|
||||
|
||||
.frost-toast-region { position: fixed; inset: var(--frost-space-4) var(--frost-space-4) auto auto; z-index: var(--frost-z-toast); display: grid; width: min(26rem, calc(100vw - 2rem)); gap: var(--frost-space-3); }
|
||||
.frost-toast { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--frost-space-3); padding: var(--frost-space-4); border: 1px solid var(--frost-color-border-strong); border-radius: var(--frost-radius-md); background: var(--frost-color-surface); color: var(--frost-color-text); box-shadow: var(--frost-shadow-lg); }
|
||||
.frost-toast--success { border-inline-start: 0.3rem solid var(--frost-color-success); }
|
||||
.frost-toast--warning { border-inline-start: 0.3rem solid var(--frost-color-warning); }
|
||||
.frost-toast--danger { border-inline-start: 0.3rem solid var(--frost-color-danger); }
|
||||
|
||||
.frost-dropdown, .frost-popover { position: relative; display: inline-block; }
|
||||
.frost-dropdown__menu, .frost-popover__content { position: absolute; top: calc(100% + var(--frost-space-2)); left: 0; z-index: var(--frost-z-popover); min-width: 12rem; padding: var(--frost-space-2); border: 1px solid var(--frost-color-border-strong); border-radius: var(--frost-radius-md); background: var(--frost-color-surface); color: var(--frost-color-text); box-shadow: var(--frost-shadow-md); }
|
||||
.frost-dropdown__menu[hidden], .frost-popover__content[hidden] { display: none; }
|
||||
.frost-dropdown__menu--end, .frost-popover__content--end { right: 0; left: auto; }
|
||||
.frost-dropdown__item { display: block; width: 100%; padding: var(--frost-space-2) var(--frost-space-3); border: 0; border-radius: var(--frost-radius-sm); background: transparent; color: inherit; text-align: start; text-decoration: none; }
|
||||
.frost-dropdown__item:hover, .frost-dropdown__item:focus-visible { background: var(--frost-color-surface-hover); }
|
||||
|
||||
.frost-tooltip { position: relative; }
|
||||
.frost-tooltip::after { position: absolute; bottom: calc(100% + var(--frost-space-2)); left: 50%; z-index: var(--frost-z-popover); width: max-content; max-width: 16rem; padding: var(--frost-space-2) var(--frost-space-3); border-radius: var(--frost-radius-sm); background: var(--frost-color-text); color: var(--frost-color-bg); content: attr(data-frost-tooltip); font-size: var(--frost-font-size-sm); line-height: 1.3; opacity: 0; pointer-events: none; transform: translate(-50%, 0.25rem); transition: opacity var(--frost-duration-fast) var(--frost-ease-out), transform var(--frost-duration-fast) var(--frost-ease-out); }
|
||||
.frost-tooltip:hover::after, .frost-tooltip:focus-visible::after, .frost-tooltip:focus-within::after { opacity: 1; transform: translate(-50%, 0); }
|
||||
|
||||
.frost-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: var(--frost-color-overlay);
|
||||
z-index: var(--frost-z-overlay);
|
||||
}
|
||||
|
||||
.frost-modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: var(--frost-space-4);
|
||||
z-index: var(--frost-z-modal);
|
||||
}
|
||||
|
||||
dialog.frost-modal { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; background: transparent; }
|
||||
dialog.frost-modal:not([open]) { display: none; }
|
||||
dialog.frost-modal::backdrop { background: var(--frost-color-backdrop); }
|
||||
dialog.frost-modal[open] { display: grid; }
|
||||
|
||||
.frost-modal__content {
|
||||
width: min(100%, 32rem);
|
||||
max-height: min(90vh, 42rem);
|
||||
overflow: auto;
|
||||
padding: var(--frost-space-6);
|
||||
border: 1px solid var(--frost-color-border-strong);
|
||||
border-radius: var(--frost-radius-lg);
|
||||
background: var(--frost-color-surface);
|
||||
color: var(--frost-color-text);
|
||||
box-shadow: var(--frost-shadow-lg);
|
||||
}
|
||||
|
||||
.frost-modal__header,
|
||||
.frost-modal__footer { display: flex; align-items: center; gap: var(--frost-space-3); }
|
||||
.frost-modal__header { justify-content: space-between; margin-block-end: var(--frost-space-4); }
|
||||
.frost-modal__body { display: grid; gap: var(--frost-space-4); }
|
||||
.frost-modal__footer { justify-content: flex-end; margin-block-start: var(--frost-space-4); }
|
||||
.frost-modal--fullscreen .frost-modal__content { width: 100%; max-height: 100%; min-height: 100%; border-radius: 0; }
|
||||
.frost-modal--drawer { place-items: stretch end; padding: 0; }
|
||||
.frost-modal--drawer .frost-modal__content { width: min(100%, 28rem); max-height: none; height: 100%; border-radius: var(--frost-radius-lg) 0 0 var(--frost-radius-lg); }
|
||||
|
||||
.frost-navbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--frost-space-4); padding-block: var(--frost-space-4); }
|
||||
.frost-navbar__brand { color: var(--frost-color-text); font-weight: 700; text-decoration: none; }
|
||||
.frost-navbar__links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--frost-space-2); }
|
||||
.frost-navbar__link { padding: var(--frost-space-2) var(--frost-space-3); border-radius: var(--frost-radius-sm); color: var(--frost-color-text-muted); text-decoration: none; }
|
||||
.frost-navbar__link:hover, .frost-navbar__link[aria-current="page"] { background: var(--frost-color-surface-soft); color: var(--frost-color-text); }
|
||||
|
||||
.frost-breadcrumbs { display: flex; flex-wrap: wrap; gap: var(--frost-space-2); color: var(--frost-color-text-muted); font-size: var(--frost-font-size-sm); }
|
||||
.frost-breadcrumbs__item:not(:last-child)::after { margin-inline-start: var(--frost-space-2); color: var(--frost-color-border-strong); content: "/"; }
|
||||
.frost-breadcrumbs__item[aria-current="page"] { color: var(--frost-color-text); }
|
||||
|
||||
.frost-tabs { display: flex; flex-wrap: wrap; gap: var(--frost-space-1); border-block-end: 1px solid var(--frost-color-border); }
|
||||
.frost-tabs__tab { padding: var(--frost-space-2) var(--frost-space-3); border: 0; border-block-end: 2px solid transparent; background: transparent; color: var(--frost-color-text-muted); cursor: pointer; }
|
||||
.frost-tabs__tab:hover, .frost-tabs__tab[aria-selected="true"] { border-block-end-color: var(--frost-color-accent); color: var(--frost-color-text); }
|
||||
.frost-tabs__panel { padding-block: var(--frost-space-4); }
|
||||
|
||||
.frost-accordion { border-block-start: 1px solid var(--frost-color-border); }
|
||||
.frost-accordion__item { border-block-end: 1px solid var(--frost-color-border); }
|
||||
.frost-accordion__trigger { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: var(--frost-space-4); padding: var(--frost-space-4) 0; border: 0; background: transparent; color: var(--frost-color-text); text-align: start; font-weight: 650; }
|
||||
.frost-accordion__panel { padding-block: 0 var(--frost-space-4); }
|
||||
.frost-accordion__panel[hidden] { display: none; }
|
||||
|
||||
.frost-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: var(--frost-space-1); }
|
||||
.frost-pagination__item { display: inline-flex; min-width: 2.5rem; min-height: 2.5rem; align-items: center; justify-content: center; padding: var(--frost-space-2); border: 1px solid var(--frost-color-border); border-radius: var(--frost-radius-sm); background: var(--frost-color-surface); color: var(--frost-color-text); text-decoration: none; }
|
||||
.frost-pagination__item:hover, .frost-pagination__item[aria-current="page"] { border-color: var(--frost-color-accent); background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
|
||||
|
||||
.frost-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
|
||||
.frost-table { width: 100%; min-width: 32rem; border: 1px solid var(--frost-color-border); }
|
||||
.frost-table th, .frost-table td { padding: var(--frost-space-3) var(--frost-space-4); border-block-end: 1px solid var(--frost-color-border); }
|
||||
.frost-table th { background: var(--frost-color-surface-soft); font-weight: 700; }
|
||||
.frost-table tbody tr:hover { background: var(--frost-color-surface-soft); }
|
||||
|
||||
.frost-spinner { display: inline-block; width: 1.25rem; height: 1.25rem; border: 0.18rem solid var(--frost-color-border); border-block-start-color: var(--frost-color-accent); border-radius: 50%; animation: frost-spin 700ms linear infinite; }
|
||||
.frost-spinner--sm { width: 1rem; height: 1rem; }
|
||||
.frost-spinner--lg { width: 2rem; height: 2rem; }
|
||||
@keyframes frost-spin { to { transform: rotate(360deg); } }
|
||||
|
||||
[data-theme="dark"] .frost-tooltip::after { background: var(--frost-color-surface-soft); color: var(--frost-color-text); }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.frost-card--interactive:hover,
|
||||
.frost-card--interactive:focus-within { transform: none; }
|
||||
.frost-spinner { animation-duration: 0.01ms; animation-iteration-count: 1; }
|
||||
}
|
||||
}
|
||||
|
||||
@layer frost.utilities {
|
||||
.frost-text-muted { color: var(--frost-color-text-muted); }
|
||||
.frost-text-center { text-align: center; }
|
||||
.frost-width-full { width: 100%; }
|
||||
.frost-overflow-auto { overflow: auto; }
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,21 @@
|
||||
:where(.frost-button--primary) { border-color: var(--frost-color-accent); background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
|
||||
:where(.frost-button--secondary) { border-color: var(--frost-color-border-strong); background: var(--frost-color-surface); color: var(--frost-color-text); }
|
||||
:where(.frost-button--ghost) { border-color: transparent; color: var(--frost-color-accent); }
|
||||
:where(.frost-button--danger) { border-color: var(--frost-color-danger); background: var(--frost-color-danger); color: #fff; }
|
||||
:where(.frost-button--danger) { border-color: var(--frost-color-danger); background: var(--frost-color-danger); color: var(--frost-color-on-danger); }
|
||||
:where(.frost-button--success) { border-color: var(--frost-color-success); background: var(--frost-color-success); color: var(--frost-color-on-success); }
|
||||
:where(.frost-button--link) { min-height: auto; padding: 0; border-color: transparent; color: var(--frost-color-accent); text-decoration: underline; text-underline-offset: 0.15em; }
|
||||
:where(.frost-button--block) { width: 100%; }
|
||||
:where(.frost-button--lg) { min-height: 3rem; padding: var(--frost-space-3) var(--frost-space-5); font-size: var(--frost-font-size-lg); }
|
||||
:where(.frost-button--primary:hover:not(:disabled):not([aria-disabled="true"])) { background: var(--frost-color-accent-hover); border-color: var(--frost-color-accent-hover); }
|
||||
:where(.frost-button--secondary:hover:not(:disabled):not([aria-disabled="true"])) { background: var(--frost-color-surface-hover); }
|
||||
:where(.frost-button--ghost:hover:not(:disabled):not([aria-disabled="true"])) { background: var(--frost-color-surface-soft); }
|
||||
:where(.frost-button--danger:hover:not(:disabled):not([aria-disabled="true"])) { filter: brightness(0.92); }
|
||||
:where(.frost-button--success:hover:not(:disabled):not([aria-disabled="true"])) { filter: brightness(0.92); }
|
||||
:where(.frost-button--link:hover:not(:disabled):not([aria-disabled="true"])) { background: var(--frost-color-surface-soft); }
|
||||
:where(.frost-button:active:not(:disabled):not([aria-disabled="true"])) { transform: translateY(1px); }
|
||||
:where(.frost-button:disabled, .frost-button[aria-disabled="true"]) { opacity: 0.55; cursor: not-allowed; }
|
||||
:where(.frost-button--sm) { min-height: 2rem; padding: var(--frost-space-1) var(--frost-space-2); font-size: var(--frost-font-size-sm); }
|
||||
:where(.frost-button--icon) { width: 2.5rem; min-width: 2.5rem; padding: var(--frost-space-2); }
|
||||
|
||||
:where(.frost-input, .frost-select, .frost-textarea) {
|
||||
display: block;
|
||||
@@ -45,11 +53,21 @@
|
||||
:where(.frost-input:focus, .frost-select:focus, .frost-textarea:focus) { border-color: var(--frost-focus-color); box-shadow: 0 0 0 var(--frost-focus-width) rgb(37 99 235 / 0.22); box-shadow: 0 0 0 var(--frost-focus-width) color-mix(in srgb, var(--frost-focus-color) 22%, transparent); }
|
||||
:where(.frost-input:disabled, .frost-select:disabled, .frost-textarea:disabled) { background: var(--frost-color-surface-soft); opacity: 0.65; }
|
||||
:where(.frost-input[aria-invalid="true"], .frost-select[aria-invalid="true"], .frost-textarea[aria-invalid="true"]) { border-color: var(--frost-color-danger); }
|
||||
:where(.frost-input[aria-invalid="true"]:focus, .frost-select[aria-invalid="true"]:focus, .frost-textarea[aria-invalid="true"]:focus) { box-shadow: 0 0 0 var(--frost-focus-width) color-mix(in srgb, var(--frost-color-danger) 22%, transparent); }
|
||||
:where(.frost-input[aria-busy="true"], .frost-select[aria-busy="true"], .frost-textarea[aria-busy="true"]) { background-image: linear-gradient(90deg, transparent, var(--frost-color-surface-soft), transparent); background-size: 200% 100%; animation: frost-control-loading 1.2s linear infinite; }
|
||||
:where(.frost-input--success, .frost-select--success, .frost-textarea--success, .frost-input[aria-invalid="false"], .frost-select[aria-invalid="false"], .frost-textarea[aria-invalid="false"]) { border-color: var(--frost-color-success); }
|
||||
:where(.frost-input--warning, .frost-select--warning, .frost-textarea--warning) { border-color: var(--frost-color-warning); }
|
||||
:where(.frost-input--readonly, .frost-input[readonly]) { background: var(--frost-color-surface-soft); }
|
||||
:where(.frost-field--disabled) { opacity: 0.65; }
|
||||
|
||||
.frost-field { display: grid; gap: var(--frost-space-2); }
|
||||
.frost-label { color: var(--frost-color-text); font-weight: 650; }
|
||||
.frost-help, .frost-error { font-size: var(--frost-font-size-sm); }
|
||||
.frost-help { color: var(--frost-color-text-muted); }
|
||||
.frost-error { color: var(--frost-color-danger); }
|
||||
.frost-success { color: var(--frost-color-success); }
|
||||
.frost-warning { color: var(--frost-color-warning); }
|
||||
|
||||
@keyframes frost-control-loading { to { background-position: -200% 0; } }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
@layer frost.tokens, frost.base, frost.accessibility, frost.forced-colors;
|
||||
|
||||
@import url("./tokens.css") layer(frost.tokens);
|
||||
@import url("./base.css") layer(frost.base);
|
||||
@import url("./accessibility.css") layer(frost.accessibility);
|
||||
@import url("./forced-colors.css");
|
||||
@@ -0,0 +1,372 @@
|
||||
@layer catalog {
|
||||
:root { scroll-padding-block-start: var(--frost-space-4); }
|
||||
|
||||
body.catalog-page {
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
background: var(--frost-color-bg);
|
||||
}
|
||||
|
||||
.catalog-shell {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr);
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.catalog-sidebar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
align-self: start;
|
||||
height: 100vh;
|
||||
padding: var(--frost-space-6);
|
||||
overflow-y: auto;
|
||||
border-inline-end: 1px solid var(--frost-color-border);
|
||||
background: var(--frost-color-surface);
|
||||
}
|
||||
|
||||
.catalog-brand {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--frost-space-2);
|
||||
color: var(--frost-color-text);
|
||||
font-size: var(--frost-font-size-lg);
|
||||
font-weight: 800;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.catalog-brand__mark {
|
||||
display: grid;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
place-items: center;
|
||||
border-radius: var(--frost-radius-md);
|
||||
background: var(--frost-color-accent);
|
||||
color: var(--frost-color-on-accent);
|
||||
font-size: var(--frost-font-size-sm);
|
||||
}
|
||||
|
||||
.catalog-sidebar__intro {
|
||||
margin-block: var(--frost-space-3) var(--frost-space-6);
|
||||
color: var(--frost-color-text-muted);
|
||||
font-size: var(--frost-font-size-sm);
|
||||
}
|
||||
|
||||
.catalog-search { margin-block-end: var(--frost-space-6); }
|
||||
.catalog-search .frost-label { font-size: var(--frost-font-size-sm); }
|
||||
|
||||
.catalog-nav {
|
||||
display: grid;
|
||||
gap: var(--frost-space-1);
|
||||
}
|
||||
|
||||
.catalog-nav__label {
|
||||
margin-block-end: var(--frost-space-2);
|
||||
color: var(--frost-color-text-muted);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.catalog-nav__link {
|
||||
padding: var(--frost-space-2) var(--frost-space-3);
|
||||
border-radius: var(--frost-radius-sm);
|
||||
color: var(--frost-color-text-muted);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.catalog-nav__link:hover,
|
||||
.catalog-nav__link:focus-visible {
|
||||
background: var(--frost-color-surface-soft);
|
||||
color: var(--frost-color-text);
|
||||
}
|
||||
|
||||
.catalog-main {
|
||||
width: min(100%, 82rem);
|
||||
padding: var(--frost-space-8) clamp(var(--frost-space-4), 4vw, var(--frost-space-10));
|
||||
}
|
||||
|
||||
.catalog-hero {
|
||||
position: relative;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: var(--frost-space-6);
|
||||
align-items: start;
|
||||
margin-block-end: var(--frost-space-8);
|
||||
padding: clamp(var(--frost-space-6), 4vw, var(--frost-space-10));
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--frost-color-border);
|
||||
border-radius: var(--frost-radius-xl);
|
||||
background:
|
||||
radial-gradient(circle at 88% 20%, color-mix(in srgb, var(--frost-color-accent) 24%, transparent), transparent 28%),
|
||||
var(--frost-color-surface);
|
||||
}
|
||||
|
||||
.catalog-eyebrow {
|
||||
margin: 0 0 var(--frost-space-2);
|
||||
color: var(--frost-color-accent);
|
||||
font-size: var(--frost-font-size-sm);
|
||||
font-weight: 750;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.catalog-hero h1 {
|
||||
max-width: 14ch;
|
||||
margin: 0;
|
||||
font-size: var(--frost-font-size-2xl);
|
||||
}
|
||||
|
||||
.catalog-hero__copy {
|
||||
max-width: 62ch;
|
||||
margin-block: var(--frost-space-4);
|
||||
color: var(--frost-color-text-muted);
|
||||
font-size: var(--frost-font-size-lg);
|
||||
}
|
||||
|
||||
.catalog-hero__meta { align-items: center; }
|
||||
|
||||
.catalog-contrast-guide {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.2fr) minmax(14rem, 0.8fr);
|
||||
gap: var(--frost-space-5) var(--frost-space-8);
|
||||
margin-block: var(--frost-space-8) 0;
|
||||
border-color: color-mix(in srgb, var(--frost-color-accent) 42%, var(--frost-color-border));
|
||||
}
|
||||
|
||||
.catalog-contrast-guide h2 { margin: 0 0 var(--frost-space-3); font-size: var(--frost-font-size-xl); }
|
||||
.catalog-contrast-guide p:not(.catalog-eyebrow) { margin: 0; color: var(--frost-color-text-muted); }
|
||||
.catalog-contrast-guide ul { grid-column: 1 / -1; display: grid; gap: var(--frost-space-2); margin: 0; padding-inline-start: var(--frost-space-5); color: var(--frost-color-text-muted); }
|
||||
|
||||
.catalog-system-colors {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--frost-space-2);
|
||||
align-self: start;
|
||||
}
|
||||
|
||||
.catalog-system-color {
|
||||
display: grid;
|
||||
min-height: 3.5rem;
|
||||
place-items: center;
|
||||
padding: var(--frost-space-2);
|
||||
border: 1px solid var(--frost-color-border-strong);
|
||||
border-radius: var(--frost-radius-sm);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 750;
|
||||
}
|
||||
|
||||
.catalog-system-color--canvas { background: var(--frost-color-surface); color: var(--frost-color-text); }
|
||||
.catalog-system-color--text { background: var(--frost-color-text); color: var(--frost-color-bg); }
|
||||
.catalog-system-color--button { background: var(--frost-color-surface-soft); color: var(--frost-color-text); }
|
||||
.catalog-system-color--highlight { background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
|
||||
|
||||
.catalog-empty {
|
||||
padding: var(--frost-space-8);
|
||||
border: 1px dashed var(--frost-color-border-strong);
|
||||
border-radius: var(--frost-radius-lg);
|
||||
color: var(--frost-color-text-muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.catalog-list {
|
||||
display: grid;
|
||||
gap: var(--frost-space-8);
|
||||
}
|
||||
|
||||
.catalog-component {
|
||||
padding: 0;
|
||||
overflow: visible;
|
||||
scroll-margin-block-start: var(--frost-space-4);
|
||||
}
|
||||
|
||||
.catalog-component[hidden] { display: none; }
|
||||
|
||||
.catalog-component__header {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: var(--frost-space-4);
|
||||
padding: var(--frost-space-6);
|
||||
border-block-end: 1px solid var(--frost-color-border);
|
||||
}
|
||||
|
||||
.catalog-component__header h2 { margin: 0 0 var(--frost-space-2); }
|
||||
.catalog-component__header p { margin: 0; color: var(--frost-color-text-muted); }
|
||||
.catalog-component__header > .frost-badge { align-self: start; }
|
||||
|
||||
.catalog-live {
|
||||
padding: clamp(var(--frost-space-4), 3vw, var(--frost-space-8));
|
||||
background: var(--frost-color-surface-soft);
|
||||
}
|
||||
|
||||
.catalog-live--overlay { min-height: 11rem; }
|
||||
|
||||
.catalog-live__label {
|
||||
display: block;
|
||||
margin-block-end: var(--frost-space-4);
|
||||
color: var(--frost-color-text-muted);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.catalog-details {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.25fr) minmax(16rem, 0.75fr);
|
||||
gap: var(--frost-space-6);
|
||||
padding: var(--frost-space-6);
|
||||
}
|
||||
|
||||
.catalog-code {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--frost-color-border);
|
||||
border-radius: var(--frost-radius-md);
|
||||
background: #101820;
|
||||
}
|
||||
|
||||
.catalog-code__toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--frost-space-3);
|
||||
min-height: 3rem;
|
||||
padding: var(--frost-space-2) var(--frost-space-3);
|
||||
border-block-end: 1px solid #31414d;
|
||||
color: #c9d5dd;
|
||||
font-size: var(--frost-font-size-sm);
|
||||
}
|
||||
|
||||
.catalog-copy {
|
||||
min-height: 2rem;
|
||||
padding: var(--frost-space-1) var(--frost-space-3);
|
||||
border: 1px solid #526675;
|
||||
border-radius: var(--frost-radius-sm);
|
||||
background: #1b2933;
|
||||
color: #f2f7f9;
|
||||
font: inherit;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.catalog-copy:hover { background: #273a47; }
|
||||
|
||||
.catalog-code pre {
|
||||
max-height: 18rem;
|
||||
margin: 0;
|
||||
padding: var(--frost-space-4);
|
||||
overflow: auto;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
color: #e8f1f5;
|
||||
font-size: var(--frost-font-size-sm);
|
||||
line-height: 1.55;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.catalog-code code { color: inherit; background: transparent; }
|
||||
|
||||
.catalog-a11y {
|
||||
padding: var(--frost-space-5);
|
||||
border: 1px solid color-mix(in srgb, var(--frost-color-success) 40%, var(--frost-color-border));
|
||||
border-radius: var(--frost-radius-md);
|
||||
background: color-mix(in srgb, var(--frost-color-success) 8%, var(--frost-color-surface));
|
||||
}
|
||||
|
||||
.catalog-a11y h3 {
|
||||
margin: 0 0 var(--frost-space-3);
|
||||
color: var(--frost-color-text);
|
||||
font-size: var(--frost-font-size-base);
|
||||
}
|
||||
|
||||
.catalog-a11y ul {
|
||||
display: grid;
|
||||
gap: var(--frost-space-2);
|
||||
margin: 0;
|
||||
padding-inline-start: var(--frost-space-5);
|
||||
color: var(--frost-color-text-muted);
|
||||
font-size: var(--frost-font-size-sm);
|
||||
}
|
||||
|
||||
.catalog-demo-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--frost-space-4);
|
||||
}
|
||||
|
||||
.catalog-demo-card { min-height: 8rem; }
|
||||
.catalog-demo-form { max-width: 34rem; }
|
||||
.catalog-footer { padding-block: var(--frost-space-10) var(--frost-space-4); color: var(--frost-color-text-muted); font-size: var(--frost-font-size-sm); }
|
||||
|
||||
@media (max-width: 64rem) {
|
||||
.catalog-shell { grid-template-columns: 1fr; }
|
||||
.catalog-sidebar {
|
||||
position: static;
|
||||
z-index: 20;
|
||||
height: auto;
|
||||
padding: var(--frost-space-4);
|
||||
overflow: visible;
|
||||
border-inline-end: 0;
|
||||
border-block-end: 1px solid var(--frost-color-border);
|
||||
}
|
||||
.catalog-sidebar__intro { display: none; }
|
||||
.catalog-search { margin-block: var(--frost-space-4); }
|
||||
.catalog-nav { display: flex; overflow-x: auto; padding-block-end: var(--frost-space-1); }
|
||||
.catalog-nav__label { display: none; }
|
||||
.catalog-nav__link { flex: 0 0 auto; }
|
||||
.catalog-main { padding-block-start: var(--frost-space-6); }
|
||||
}
|
||||
|
||||
@media (max-width: 48rem) {
|
||||
.catalog-hero,
|
||||
.catalog-contrast-guide,
|
||||
.catalog-component__header,
|
||||
.catalog-details { grid-template-columns: 1fr; }
|
||||
.catalog-hero__actions { justify-self: start; }
|
||||
.catalog-details { padding: var(--frost-space-4); }
|
||||
.catalog-demo-grid { grid-template-columns: 1fr; }
|
||||
.catalog-component__header { padding: var(--frost-space-5); }
|
||||
}
|
||||
|
||||
@media (forced-colors: active) {
|
||||
.catalog-sidebar,
|
||||
.catalog-hero,
|
||||
.catalog-contrast-guide,
|
||||
.catalog-component,
|
||||
.catalog-component__header,
|
||||
.catalog-code,
|
||||
.catalog-code__toolbar,
|
||||
.catalog-a11y {
|
||||
border-color: CanvasText;
|
||||
background: Canvas;
|
||||
color: CanvasText;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.catalog-hero { background-image: none; }
|
||||
.catalog-brand__mark { border: 1px solid Highlight; background: Highlight; color: HighlightText; forced-color-adjust: none; }
|
||||
.catalog-eyebrow,
|
||||
.catalog-hero__copy,
|
||||
.catalog-sidebar__intro,
|
||||
.catalog-nav__label,
|
||||
.catalog-component__header p,
|
||||
.catalog-live__label,
|
||||
.catalog-a11y ul,
|
||||
.catalog-contrast-guide p:not(.catalog-eyebrow),
|
||||
.catalog-contrast-guide ul { color: CanvasText; }
|
||||
.catalog-nav__link { color: LinkText; }
|
||||
.catalog-nav__link:hover,
|
||||
.catalog-nav__link:focus-visible { background: Highlight; color: HighlightText; forced-color-adjust: none; }
|
||||
.catalog-live { background: Canvas; }
|
||||
.catalog-copy { border-color: ButtonText; background: ButtonFace; color: ButtonText; forced-color-adjust: none; }
|
||||
.catalog-copy:hover { background: Highlight; color: HighlightText; }
|
||||
.catalog-code pre { background: Canvas; color: CanvasText; forced-color-adjust: none; }
|
||||
.catalog-system-color { border-color: CanvasText; forced-color-adjust: none; }
|
||||
.catalog-system-color--canvas { background: Canvas; color: CanvasText; }
|
||||
.catalog-system-color--text { background: CanvasText; color: Canvas; }
|
||||
.catalog-system-color--button { background: ButtonFace; color: ButtonText; }
|
||||
.catalog-system-color--highlight { background: Highlight; color: HighlightText; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
const root = document.documentElement;
|
||||
const themeToggle = document.querySelector("#theme-toggle");
|
||||
const search = document.querySelector("#component-search");
|
||||
const emptyState = document.querySelector("#catalog-empty");
|
||||
const visibleCount = document.querySelector("#visible-count");
|
||||
const components = [...document.querySelectorAll("[data-component]")];
|
||||
|
||||
const formatMarkup = (source) => {
|
||||
const voidElements = new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
||||
const lines = source.trim().replace(/>\s*</g, ">\n<").split("\n").map((line) => line.trim()).filter(Boolean);
|
||||
let depth = 0;
|
||||
return lines.map((line) => {
|
||||
if (line.startsWith("</")) depth = Math.max(0, depth - 1);
|
||||
const formatted = `${" ".repeat(depth)}${line}`;
|
||||
const openingTag = line.match(/^<([a-z][\w-]*)\b[^>]*>$/i);
|
||||
if (openingTag && !voidElements.has(openingTag[1].toLowerCase()) && !line.endsWith("/>")) depth += 1;
|
||||
return formatted;
|
||||
}).join("\n");
|
||||
};
|
||||
|
||||
for (const component of components) {
|
||||
const source = component.querySelector("[data-snippet-source]");
|
||||
const code = component.querySelector("[data-snippet-code]");
|
||||
if (source && code) code.textContent = formatMarkup(source.innerHTML);
|
||||
}
|
||||
|
||||
const setThemeState = () => {
|
||||
const dark = root.dataset.theme === "dark";
|
||||
themeToggle.setAttribute("aria-pressed", String(dark));
|
||||
};
|
||||
|
||||
themeToggle.addEventListener("click", () => {
|
||||
root.dataset.theme = root.dataset.theme === "dark" ? "light" : "dark";
|
||||
setThemeState();
|
||||
});
|
||||
setThemeState();
|
||||
|
||||
const copyText = async (text) => {
|
||||
if (navigator.clipboard?.writeText) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
return;
|
||||
} catch {
|
||||
// Fall back for browsers or embedded previews that deny clipboard permission.
|
||||
}
|
||||
}
|
||||
const field = document.createElement("textarea");
|
||||
field.value = text;
|
||||
field.setAttribute("readonly", "");
|
||||
field.style.position = "fixed";
|
||||
field.style.opacity = "0";
|
||||
document.body.append(field);
|
||||
field.select();
|
||||
document.execCommand("copy");
|
||||
field.remove();
|
||||
};
|
||||
|
||||
document.querySelectorAll("[data-copy-html]").forEach((button) => {
|
||||
button.addEventListener("click", async () => {
|
||||
const component = button.closest("[data-component]");
|
||||
const code = component.querySelector("[data-snippet-code]").textContent;
|
||||
const original = button.textContent;
|
||||
try {
|
||||
await copyText(code);
|
||||
button.textContent = "Kopiert";
|
||||
document.querySelector("#copy-status").textContent = `${component.querySelector("h2").textContent}: HTML kopiert.`;
|
||||
} catch {
|
||||
button.textContent = "Nicht kopiert";
|
||||
document.querySelector("#copy-status").textContent = "Kopieren war nicht möglich. Markiere den Code manuell.";
|
||||
}
|
||||
window.setTimeout(() => { button.textContent = original; }, 1600);
|
||||
});
|
||||
});
|
||||
|
||||
const filterComponents = () => {
|
||||
const query = search.value.trim().toLocaleLowerCase("de-CH");
|
||||
let count = 0;
|
||||
for (const component of components) {
|
||||
const matches = !query || component.dataset.search.toLocaleLowerCase("de-CH").includes(query);
|
||||
component.hidden = !matches;
|
||||
const navLink = document.querySelector(`[href="#${component.id}"]`);
|
||||
if (navLink) navLink.hidden = !matches;
|
||||
if (matches) count += 1;
|
||||
}
|
||||
visibleCount.textContent = `${count} von ${components.length} Gruppen`;
|
||||
emptyState.hidden = count !== 0;
|
||||
};
|
||||
search.addEventListener("input", filterComponents);
|
||||
filterComponents();
|
||||
|
||||
const menuTrigger = document.querySelector("#menu-trigger");
|
||||
const menu = document.querySelector("#example-menu");
|
||||
const setMenuOpen = (open) => {
|
||||
menuTrigger.setAttribute("aria-expanded", String(open));
|
||||
menu.hidden = !open;
|
||||
};
|
||||
menuTrigger.addEventListener("click", () => setMenuOpen(menu.hidden));
|
||||
document.addEventListener("click", (event) => {
|
||||
if (!menu.hidden && !event.target.closest(".frost-dropdown")) setMenuOpen(false);
|
||||
});
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key === "Escape" && !menu.hidden) {
|
||||
setMenuOpen(false);
|
||||
menuTrigger.focus();
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll('[role="tablist"]').forEach((tablist) => {
|
||||
const tabs = [...tablist.querySelectorAll('[role="tab"]')];
|
||||
const activateTab = (tab) => {
|
||||
tabs.forEach((item) => {
|
||||
const selected = item === tab;
|
||||
item.setAttribute("aria-selected", String(selected));
|
||||
item.tabIndex = selected ? 0 : -1;
|
||||
document.getElementById(item.getAttribute("aria-controls")).hidden = !selected;
|
||||
});
|
||||
};
|
||||
tabs.forEach((tab, index) => {
|
||||
tab.addEventListener("click", () => activateTab(tab));
|
||||
tab.addEventListener("keydown", (event) => {
|
||||
const destinations = { ArrowLeft: index - 1, ArrowRight: index + 1, Home: 0, End: tabs.length - 1 };
|
||||
if (!(event.key in destinations)) return;
|
||||
event.preventDefault();
|
||||
const nextTab = tabs[(destinations[event.key] + tabs.length) % tabs.length];
|
||||
activateTab(nextTab);
|
||||
nextTab.focus();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll(".frost-accordion__trigger").forEach((trigger) => {
|
||||
trigger.addEventListener("click", () => {
|
||||
const panel = document.getElementById(trigger.getAttribute("aria-controls"));
|
||||
const open = trigger.getAttribute("aria-expanded") === "true";
|
||||
trigger.setAttribute("aria-expanded", String(!open));
|
||||
panel.hidden = open;
|
||||
});
|
||||
});
|
||||
|
||||
const dialog = document.querySelector("#example-dialog");
|
||||
const dialogTrigger = document.querySelector("#modal-trigger");
|
||||
dialogTrigger.addEventListener("click", () => dialog.showModal());
|
||||
dialog.querySelectorAll("[data-dialog-close]").forEach((button) => {
|
||||
button.addEventListener("click", () => dialog.close(button.value));
|
||||
});
|
||||
dialog.addEventListener("close", () => dialogTrigger.focus());
|
||||
|
||||
document.querySelector("#toast-close").addEventListener("click", (event) => {
|
||||
event.currentTarget.closest(".frost-toast").hidden = true;
|
||||
});
|
||||
@@ -1,78 +1,115 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Frost v0.1 example</title>
|
||||
<meta name="description" content="Interaktiver Komponentenkatalog für das Frost CSS Framework.">
|
||||
<title>Frost – Komponentenkatalog</title>
|
||||
<link rel="stylesheet" href="../frost.css">
|
||||
<style>
|
||||
body { padding-block: var(--frost-space-8); }
|
||||
.example-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--frost-space-4); margin-block-end: var(--frost-space-8); }
|
||||
.example-header h1 { margin-block-end: var(--frost-space-2); }
|
||||
.example-section { margin-block-start: var(--frost-space-8); }
|
||||
.example-section > h2 { margin-block-end: var(--frost-space-4); }
|
||||
.example-sidebar { padding: var(--frost-space-4); background: var(--frost-color-surface-soft); border-inline-end: 1px solid var(--frost-color-border); }
|
||||
.example-sidebar a { display: block; padding: var(--frost-space-2); }
|
||||
.swatch { min-height: 4rem; padding: var(--frost-space-3); border-radius: var(--frost-radius-md); background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
|
||||
</style>
|
||||
<link rel="stylesheet" href="./catalog.css">
|
||||
<script src="./catalog.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<a class="frost-skip-link" href="#main">Skip to content</a>
|
||||
<main id="main" class="frost-container">
|
||||
<header class="example-header">
|
||||
<div>
|
||||
<p class="frost-text-muted">Frost CSS framework</p>
|
||||
<h1>Small foundations for cold starts.</h1>
|
||||
</div>
|
||||
<button class="frost-button frost-button--secondary" id="theme-toggle" type="button">Toggle theme</button>
|
||||
<body class="catalog-page">
|
||||
<a class="frost-skip-link" href="#main">Zum Inhalt springen</a>
|
||||
<div class="catalog-shell">
|
||||
<aside class="catalog-sidebar" aria-label="Katalognavigation">
|
||||
<a class="catalog-brand" href="#main"><span class="catalog-brand__mark" aria-hidden="true">F</span><span>Frost</span></a>
|
||||
<p class="catalog-sidebar__intro">Live-Beispiele, kopierbares Markup und Hinweise für zugängliche Implementierungen.</p>
|
||||
<label class="frost-field catalog-search" for="component-search"><span class="frost-label">Komponenten suchen</span><input class="frost-input" id="component-search" type="search" placeholder="z. B. Modal oder Badge" autocomplete="off"></label>
|
||||
<nav class="catalog-nav" aria-label="Komponentengruppen">
|
||||
<span class="catalog-nav__label">Komponenten</span>
|
||||
<a class="catalog-nav__link" href="#buttons">Buttons</a><a class="catalog-nav__link" href="#forms">Formulare</a><a class="catalog-nav__link" href="#surfaces">Flächen & Badges</a><a class="catalog-nav__link" href="#feedback">Feedback</a><a class="catalog-nav__link" href="#menus">Menüs & Tooltips</a><a class="catalog-nav__link" href="#navigation">Navigation</a><a class="catalog-nav__link" href="#disclosure">Tabs & Accordion</a><a class="catalog-nav__link" href="#data">Daten & Status</a><a class="catalog-nav__link" href="#modal">Modal</a>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
<main class="catalog-main" id="main">
|
||||
<header class="catalog-hero">
|
||||
<div><p class="catalog-eyebrow">Frost CSS Framework</p><h1>Komponenten, die sich erklären.</h1><p class="catalog-hero__copy">Jedes Beispiel läuft mit echtem Frost-Markup. Kopiere den HTML-Ausschnitt, prüfe die Zustände und beachte den Accessibility-Vertrag.</p><div class="frost-cluster catalog-hero__meta"><span class="frost-badge frost-badge--info" id="visible-count">9 von 9 Gruppen</span><span class="frost-text-muted">Version 1.0.0-rc.1</span></div></div>
|
||||
<div class="catalog-hero__actions"><button class="frost-button frost-button--secondary" id="theme-toggle" type="button" aria-pressed="false">Theme wechseln</button></div>
|
||||
</header>
|
||||
<p class="catalog-empty" id="catalog-empty" role="status" hidden>Keine Komponente passt zu deiner Suche.</p>
|
||||
<p class="frost-visually-hidden" id="copy-status" aria-live="polite"></p>
|
||||
|
||||
<section class="frost-notice frost-notice--info" aria-label="Framework note">
|
||||
Frost is CSS-only. This page uses a tiny script only to demonstrate explicit theme switching.
|
||||
<div class="catalog-list">
|
||||
<section class="catalog-component frost-card" id="buttons" data-component="buttons" data-search="buttons button primär sekundär ghost gefahr disabled loading link block icon">
|
||||
<header class="catalog-component__header"><div><h2>Buttons</h2><p>Aktionen mit klarer Hierarchie, Größen und Zuständen.</p></div><span class="frost-badge">Controls</span></header>
|
||||
<div class="catalog-live"><span class="catalog-live__label">Live-Beispiel</span><div class="frost-row" data-snippet-source>
|
||||
<button class="frost-button frost-button--primary" type="button">Primär</button><button class="frost-button frost-button--secondary" type="button">Sekundär</button><button class="frost-button frost-button--ghost" type="button">Ghost</button><button class="frost-button frost-button--danger" type="button">Gefahr</button><button class="frost-button frost-button--secondary" type="button" disabled>Deaktiviert</button><button class="frost-button frost-button--primary frost-button--sm" type="button">Kompakt</button><button class="frost-button frost-button--secondary frost-button--icon" type="button" aria-label="Einstellungen">⚙</button>
|
||||
</div></div>
|
||||
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Verwende echte <code>button</code>-Elemente für Aktionen und Links nur für Navigation.</li><li>Icon-Buttons brauchen einen zugänglichen Namen über <code>aria-label</code>.</li><li>Nutze <code>disabled</code> für nicht verfügbare Aktionen; entferne nie den sichtbaren Fokus.</li></ul></aside></div>
|
||||
</section>
|
||||
|
||||
<section class="example-section frost-stack">
|
||||
<h2>Tokens and surfaces</h2>
|
||||
<div class="frost-grid" style="--frost-grid-min: 12rem">
|
||||
<div class="swatch">Accent</div>
|
||||
<div class="frost-card frost-card--flat">Flat card</div>
|
||||
<div class="frost-card frost-card--elevated">Elevated card</div>
|
||||
</div>
|
||||
<section class="catalog-component frost-card" id="forms" data-component="forms" data-search="formular form input select textarea label help fehler validation invalid">
|
||||
<header class="catalog-component__header"><div><h2>Formulare</h2><p>Beschriftete Controls mit Hilfe-, Fehler- und Validierungszuständen.</p></div><span class="frost-badge">Controls</span></header>
|
||||
<div class="catalog-live"><span class="catalog-live__label">Live-Beispiel</span><form class="frost-stack catalog-demo-form" data-snippet-source>
|
||||
<label class="frost-field"><span class="frost-label">Name</span><input class="frost-input" type="text" autocomplete="name" placeholder="Ada Lovelace"><span class="frost-help">So erscheint dein Name im Profil.</span></label><label class="frost-field"><span class="frost-label">Projekttyp</span><select class="frost-select"><option>Website</option><option>Web-App</option><option>Dokumentation</option></select></label><label class="frost-field"><span class="frost-label">E-Mail</span><input class="frost-input" type="email" value="ada@" aria-invalid="true" aria-describedby="email-error"><span class="frost-error" id="email-error">Gib eine vollständige E-Mail-Adresse ein.</span></label><label class="frost-field"><span class="frost-label">Notiz</span><textarea class="frost-textarea" placeholder="Optionale Details"></textarea></label>
|
||||
</form></div>
|
||||
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Jedes Control braucht ein sichtbares <code>label</code>.</li><li>Verknüpfe Hilfe und Fehler mit <code>aria-describedby</code>; setze bei Fehlern zusätzlich <code>aria-invalid="true"</code>.</li><li>Placeholder ersetzen keine Beschriftung.</li></ul></aside></div>
|
||||
</section>
|
||||
|
||||
<section class="example-section frost-stack">
|
||||
<h2>Buttons and badges</h2>
|
||||
<div class="frost-row">
|
||||
<button class="frost-button frost-button--primary">Primary</button>
|
||||
<button class="frost-button frost-button--secondary">Secondary</button>
|
||||
<button class="frost-button frost-button--ghost">Ghost</button>
|
||||
<button class="frost-button frost-button--danger">Danger</button>
|
||||
<button class="frost-button frost-button--secondary" disabled>Disabled</button>
|
||||
<span class="frost-badge frost-badge--success">Success</span>
|
||||
<span class="frost-badge frost-badge--warning">Warning</span>
|
||||
</div>
|
||||
<section class="catalog-component frost-card" id="surfaces" data-component="surfaces" data-search="card karten surface fläche badge elevated interactive status">
|
||||
<header class="catalog-component__header"><div><h2>Flächen & Badges</h2><p>Visuelle Gruppierung und kompakte semantische Statusangaben.</p></div><span class="frost-badge">Components</span></header>
|
||||
<div class="catalog-live"><span class="catalog-live__label">Live-Beispiel</span><div class="frost-grid frost-gap-4 frost-md:grid-cols-2" style="--frost-grid-min: 14rem" data-snippet-source>
|
||||
<article class="frost-card frost-card--flat catalog-demo-card"><h3>Flache Karte</h3><p class="frost-text-muted">Für ruhige Inhaltsgruppen.</p><span class="frost-badge frost-badge--info">Entwurf</span></article><article class="frost-card frost-card--elevated frost-card--interactive frost-hover:shadow catalog-demo-card" tabindex="0"><h3>Interaktive Karte</h3><p class="frost-text-muted">Reagiert auf Hover und Fokus.</p><div class="frost-row"><span class="frost-badge frost-badge--success">Bereit</span><span class="frost-badge frost-badge--warning">Prüfen</span></div></article>
|
||||
</div></div>
|
||||
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Eine Karte ist zunächst nur eine visuelle Gruppe; wähle <code>article</code> oder <code>section</code> nur bei passender Semantik.</li><li>Interaktive Karten brauchen ein echtes interaktives Kind oder vollständige Tastaturunterstützung.</li><li>Vermittle Status nie ausschließlich über Farbe.</li></ul></aside></div>
|
||||
</section>
|
||||
|
||||
<section class="example-section frost-grid" style="--frost-grid-min: 18rem">
|
||||
<div class="frost-card">
|
||||
<h2>Form controls</h2>
|
||||
<form class="frost-stack" style="--frost-stack-gap: var(--frost-space-4)">
|
||||
<label class="frost-field"><span class="frost-label">Name</span><input class="frost-input" type="text" placeholder="Ada Lovelace"></label>
|
||||
<label class="frost-field"><span class="frost-label">Type</span><select class="frost-select"><option>Website</option><option>Application</option></select></label>
|
||||
<label class="frost-field"><span class="frost-label">Message</span><textarea class="frost-textarea" placeholder="Write something..."></textarea></label>
|
||||
<button class="frost-button frost-button--primary" type="submit">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
<div id="controls" class="frost-sidebar-layout">
|
||||
<aside class="frost-sidebar example-sidebar"><strong>Sidebar</strong><a href="#main">Overview</a><a href="#controls">Controls</a></aside>
|
||||
<div class="frost-main frost-card frost-card--flat"><h2>Sidebar layout</h2><p class="frost-text-muted">The layout becomes a normal single column below 48rem.</p></div>
|
||||
</div>
|
||||
<section class="catalog-component frost-card" id="feedback" data-component="feedback" data-search="feedback alert notice toast spinner laden erfolg warnung fehler status">
|
||||
<header class="catalog-component__header"><div><h2>Feedback</h2><p>Hinweise, Warnungen, Toasts und Ladeindikatoren.</p></div><span class="frost-badge">Components</span></header>
|
||||
<div class="catalog-live"><span class="catalog-live__label">Live-Beispiel</span><div class="frost-stack" data-snippet-source>
|
||||
<div class="frost-notice frost-notice--info">Neue Einstellungen sind nach dem Speichern aktiv.</div><div class="frost-alert frost-alert--warning" role="alert"><strong class="frost-alert__title">Prüfen</strong><span class="frost-alert__body">Zwei Felder brauchen noch Aufmerksamkeit.</span></div><div class="frost-toast frost-toast--success" role="status"><span>Änderungen gespeichert.</span><button class="frost-button frost-button--icon" id="toast-close" type="button" aria-label="Benachrichtigung schließen">×</button></div><div class="frost-row"><span class="frost-spinner" aria-hidden="true"></span><span>Inhalte werden geladen …</span></div>
|
||||
</div></div>
|
||||
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Nutze <code>role="alert"</code> nur für dringende, dynamische Meldungen und <code>role="status"</code> für höfliche Updates.</li><li>Der Spinner ist dekorativ; ein Text beschreibt den Ladezustand.</li><li>Toasts dürfen wichtige Informationen nicht ausschließlich zeitlich begrenzt anzeigen.</li></ul></aside></div>
|
||||
</section>
|
||||
|
||||
<section class="catalog-component frost-card" id="menus" data-component="menus" data-search="dropdown menu popover tooltip aria expanded controls">
|
||||
<header class="catalog-component__header"><div><h2>Menüs & Tooltips</h2><p>Kontextuelle Aktionen und kurze ergänzende Hinweise.</p></div><span class="frost-badge">Components</span></header>
|
||||
<div class="catalog-live catalog-live--overlay"><span class="catalog-live__label">Live-Beispiel</span><div class="frost-row" data-snippet-source>
|
||||
<div class="frost-dropdown"><button class="frost-button frost-button--secondary" id="menu-trigger" type="button" aria-expanded="false" aria-controls="example-menu">Menü öffnen</button><div class="frost-dropdown__menu" id="example-menu" hidden><a class="frost-dropdown__item" href="#buttons">Buttons</a><a class="frost-dropdown__item" href="#forms">Formulare</a><button class="frost-dropdown__item" type="button">Aktion ausführen</button></div></div><button class="frost-button frost-button--primary frost-tooltip" type="button" data-frost-tooltip="Kurzer Zusatzhinweis">Hover oder Fokus</button>
|
||||
</div></div>
|
||||
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Synchronisiere <code>aria-expanded</code> und <code>hidden</code> mit dem sichtbaren Zustand.</li><li>Escape schließt das Menü und bringt den Fokus zum Trigger zurück.</li><li>Tooltips ergänzen einen zugänglichen Namen, ersetzen ihn aber nie.</li></ul></aside></div>
|
||||
</section>
|
||||
|
||||
<section class="catalog-component frost-card" id="navigation" data-component="navigation" data-search="navigation navbar breadcrumbs pagination seiten pfad links">
|
||||
<header class="catalog-component__header"><div><h2>Navigation</h2><p>Globale Navigation, Pfadkontext und Seitenauswahl.</p></div><span class="frost-badge">Components</span></header>
|
||||
<div class="catalog-live"><span class="catalog-live__label">Live-Beispiel</span><div class="frost-stack" data-snippet-source>
|
||||
<nav class="frost-navbar frost-border frost-rounded frost-p-4" aria-label="Hauptnavigation"><a class="frost-navbar__brand" href="#main">Frost</a><div class="frost-navbar__links"><a class="frost-navbar__link" href="#buttons" aria-current="page">Komponenten</a><a class="frost-navbar__link" href="#data">Tokens</a></div></nav><nav class="frost-breadcrumbs" aria-label="Breadcrumb"><a class="frost-breadcrumbs__item" href="#main">Start</a><a class="frost-breadcrumbs__item" href="#navigation">Dokumentation</a><span class="frost-breadcrumbs__item" aria-current="page">Navigation</span></nav><nav class="frost-pagination" aria-label="Seitennavigation"><a class="frost-pagination__item" href="#navigation" aria-label="Vorherige Seite">‹</a><a class="frost-pagination__item" href="#navigation">1</a><a class="frost-pagination__item" href="#navigation" aria-current="page">2</a><a class="frost-pagination__item" href="#navigation">3</a><a class="frost-pagination__item" href="#navigation" aria-label="Nächste Seite">›</a></nav>
|
||||
</div></div>
|
||||
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Gib mehreren Navigationen unterscheidbare Namen über <code>aria-label</code>.</li><li>Markiere die aktuelle Position mit <code>aria-current</code>.</li><li>Beschrifte symbolische Vor-/Zurück-Links für Screenreader.</li></ul></aside></div>
|
||||
</section>
|
||||
|
||||
<section class="catalog-component frost-card" id="disclosure" data-component="disclosure" data-search="tabs tablist tabpanel accordion disclosure expanded selected tastatur">
|
||||
<header class="catalog-component__header"><div><h2>Tabs & Accordion</h2><p>Inhalte auf engem Raum strukturiert ein- und ausblenden.</p></div><span class="frost-badge">Components</span></header>
|
||||
<div class="catalog-live"><span class="catalog-live__label">Live-Beispiel</span><div class="frost-stack" data-snippet-source>
|
||||
<div><div class="frost-tabs" role="tablist" aria-label="Projektansicht"><button class="frost-tabs__tab" role="tab" aria-selected="true" aria-controls="tab-panel-one" id="tab-one" tabindex="0">Übersicht</button><button class="frost-tabs__tab" role="tab" aria-selected="false" aria-controls="tab-panel-two" id="tab-two" tabindex="-1">Details</button></div><div class="frost-tabs__panel" role="tabpanel" id="tab-panel-one" aria-labelledby="tab-one">Die wichtigsten Projektdaten auf einen Blick.</div><div class="frost-tabs__panel" role="tabpanel" id="tab-panel-two" aria-labelledby="tab-two" hidden>Technische Details und Metadaten.</div></div><div class="frost-accordion"><div class="frost-accordion__item"><button class="frost-accordion__trigger" type="button" aria-expanded="false" aria-controls="accordion-panel">Was macht Frost?</button><div class="frost-accordion__panel" id="accordion-panel" hidden>Frost verbindet semantische Tokens, kleine Utilities und CSS-Komponenten.</div></div></div>
|
||||
</div></div>
|
||||
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Tabs verwenden <code>tablist</code>, <code>tab</code> und <code>tabpanel</code> mit eindeutigen Beziehungen.</li><li>Pfeiltasten, Home und End bewegen den Fokus innerhalb der Tab-Liste.</li><li>Accordion-Trigger sind Buttons und spiegeln ihren Zustand über <code>aria-expanded</code>.</li></ul></aside></div>
|
||||
</section>
|
||||
|
||||
<section class="catalog-component frost-card" id="data" data-component="data" data-search="daten table tabelle responsive spinner status loading">
|
||||
<header class="catalog-component__header"><div><h2>Daten & Status</h2><p>Responsive Tabellen und klar beschriftete Ladezustände.</p></div><span class="frost-badge">Components</span></header>
|
||||
<div class="catalog-live"><span class="catalog-live__label">Live-Beispiel</span><div class="frost-stack" data-snippet-source>
|
||||
<div class="frost-table-wrap" role="region" aria-label="Komponentenstatus" tabindex="0"><table class="frost-table"><thead><tr><th scope="col">Komponente</th><th scope="col">Status</th><th scope="col">Version</th></tr></thead><tbody><tr><td>Button</td><td><span class="frost-badge frost-badge--success">Stabil</span></td><td>0.5</td></tr><tr><td>Modal</td><td><span class="frost-badge frost-badge--info">Neu</span></td><td>0.5</td></tr></tbody></table></div><div class="frost-row" role="status"><span class="frost-spinner frost-spinner--sm" aria-hidden="true"></span><span>Status wird aktualisiert …</span></div>
|
||||
</div></div>
|
||||
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Nutze <code>th</code> und <code>scope</code>, damit Tabellenbeziehungen erhalten bleiben.</li><li>Horizontale Scrollbereiche müssen per Tastatur erreichbar und benannt sein.</li><li>Ein benannter Status ergänzt den dekorativen Spinner.</li></ul></aside></div>
|
||||
</section>
|
||||
|
||||
<section class="catalog-component frost-card" id="modal" data-component="modal" data-search="modal dialog drawer overlay backdrop focus escape">
|
||||
<header class="catalog-component__header"><div><h2>Modal</h2><p>Fokussierte Entscheidungen über dem aktuellen Seitenkontext.</p></div><span class="frost-badge">Components</span></header>
|
||||
<div class="catalog-live"><span class="catalog-live__label">Live-Beispiel</span><div data-snippet-source>
|
||||
<button class="frost-button frost-button--primary" id="modal-trigger" type="button">Modal öffnen</button><dialog class="frost-modal" id="example-dialog" aria-labelledby="dialog-title"><div class="frost-modal__content"><header class="frost-modal__header"><h2 id="dialog-title">Änderung bestätigen</h2><button class="frost-button frost-button--icon" type="button" value="cancel" data-dialog-close aria-label="Modal schließen">×</button></header><div class="frost-modal__body"><p>Die neue Konfiguration wird sofort für alle Nutzerinnen und Nutzer aktiv.</p></div><footer class="frost-modal__footer"><button class="frost-button frost-button--secondary" type="button" value="cancel" data-dialog-close>Abbrechen</button><button class="frost-button frost-button--primary" type="button" value="confirm" data-dialog-close>Bestätigen</button></footer></div></dialog>
|
||||
</div></div>
|
||||
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Bevorzuge das native <code>dialog</code>-Element und öffne es mit <code>showModal()</code>.</li><li>Verbinde den Dialog über <code>aria-labelledby</code> mit einer sichtbaren Überschrift.</li><li>Nach dem Schließen kehrt der Fokus zum auslösenden Button zurück.</li></ul></aside></div>
|
||||
</section>
|
||||
</div>
|
||||
<aside class="catalog-contrast-guide frost-card" aria-labelledby="contrast-guide-title">
|
||||
<div><p class="catalog-eyebrow">Forced Colors</p><h2 id="contrast-guide-title">Hoher Kontrast gehört zum Komponentenvertrag.</h2><p>Frost ordnet Flächen, Text, Controls, Links, Auswahl und deaktivierte Zustände den Systemfarben zu. Windows Contrast Themes und andere Forced-Colors-Umgebungen bleiben dadurch vollständig unter Kontrolle der Nutzenden.</p></div>
|
||||
<div class="catalog-system-colors" aria-label="Verwendete Systemfarben"><span class="catalog-system-color catalog-system-color--canvas">Canvas</span><span class="catalog-system-color catalog-system-color--text">CanvasText</span><span class="catalog-system-color catalog-system-color--button">ButtonFace</span><span class="catalog-system-color catalog-system-color--highlight">Highlight</span></div>
|
||||
<ul><li>Status nie nur über Farbe vermitteln; Frost ergänzt Unterschiede durch Rahmenstile und sichtbare Beschriftungen.</li><li>Eigene Komponenten sollten <code>forced-color-adjust: none</code> nur zusammen mit Systemfarben einsetzen.</li><li>Fokus, Auswahl, Fehler und deaktivierte Controls mit <code>forced-colors</code> und <code>prefers-contrast: more</code> prüfen.</li></ul>
|
||||
</aside>
|
||||
<footer class="catalog-footer">Frost bleibt CSS-only. Das Katalog-Script demonstriert ausschließlich Theme-, Copy- und zugängliches Interaktionsverhalten.</footer>
|
||||
</main>
|
||||
<script>
|
||||
document.querySelector('#theme-toggle').addEventListener('click', () => {
|
||||
document.documentElement.dataset.theme = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
@layer frost.forced-colors {
|
||||
@media (prefers-contrast: more) {
|
||||
:where(.frost-button, .frost-input, .frost-select, .frost-textarea, .frost-card, .frost-surface, .frost-notice, .frost-alert, .frost-toast, .frost-dropdown__menu, .frost-popover__content, .frost-modal__content, .frost-pagination__item) {
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
:where(.frost-button--danger, .frost-badge--danger, .frost-notice--danger, .frost-alert--danger, .frost-toast--danger, .frost-input[aria-invalid="true"], .frost-select[aria-invalid="true"], .frost-textarea[aria-invalid="true"]) {
|
||||
border-style: dashed;
|
||||
}
|
||||
|
||||
:where(.frost-badge--warning, .frost-notice--warning, .frost-alert--warning, .frost-toast--warning, .frost-input--warning, .frost-select--warning, .frost-textarea--warning) {
|
||||
border-width: 3px;
|
||||
border-style: double;
|
||||
}
|
||||
|
||||
:where(.frost-button:disabled, .frost-button[aria-disabled="true"], .frost-input:disabled, .frost-select:disabled, .frost-textarea:disabled, .frost-field--disabled) {
|
||||
border-style: dotted;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
:where(.frost-help, .frost-text-muted, .frost-alert__body, .frost-navbar__link, .frost-breadcrumbs, .frost-tabs__tab) {
|
||||
color: var(--frost-color-text);
|
||||
}
|
||||
|
||||
:where(.frost-tabs__tab[aria-selected="true"]) { border-block-end-width: 3px; }
|
||||
:where(.frost-pagination__item[aria-current="page"], .frost-navbar__link[aria-current="page"]) { outline: 2px solid currentColor; outline-offset: 2px; }
|
||||
:where(:focus-visible) { outline-width: max(3px, var(--frost-focus-width)); outline-offset: max(3px, var(--frost-focus-offset)); }
|
||||
}
|
||||
|
||||
@media (forced-colors: active) {
|
||||
:where(html) { forced-color-adjust: auto; }
|
||||
:where(body) { background: Canvas; color: CanvasText; }
|
||||
:where(a) { color: LinkText; }
|
||||
|
||||
:where(.frost-button) {
|
||||
border-color: ButtonText;
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
box-shadow: none;
|
||||
filter: none;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
:where(.frost-button--primary, .frost-button--success) {
|
||||
border-color: Highlight;
|
||||
background: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
:where(.frost-button--danger) {
|
||||
border-color: Highlight;
|
||||
border-style: dashed;
|
||||
border-width: 2px;
|
||||
background: Canvas;
|
||||
color: CanvasText;
|
||||
}
|
||||
|
||||
:where(.frost-button--ghost, .frost-button--link) {
|
||||
border-color: ButtonText;
|
||||
background: Canvas;
|
||||
color: LinkText;
|
||||
}
|
||||
|
||||
:where(.frost-button:hover:not(:disabled):not([aria-disabled="true"])) {
|
||||
border-color: Highlight;
|
||||
background: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
:where(.frost-button:active:not(:disabled):not([aria-disabled="true"])) {
|
||||
border-style: double;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
:where(.frost-button:disabled, .frost-button[aria-disabled="true"]) {
|
||||
border-color: GrayText;
|
||||
background: ButtonFace;
|
||||
color: GrayText;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
:where(.frost-input, .frost-select, .frost-textarea) {
|
||||
border-color: ButtonText;
|
||||
background: Canvas;
|
||||
background-image: none;
|
||||
color: CanvasText;
|
||||
box-shadow: none;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
:where(.frost-input::placeholder, .frost-textarea::placeholder) { color: GrayText; }
|
||||
:where(.frost-input:disabled, .frost-select:disabled, .frost-textarea:disabled, .frost-input--readonly, .frost-input[readonly]) {
|
||||
border-color: GrayText;
|
||||
background: ButtonFace;
|
||||
color: GrayText;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
:where(.frost-input[aria-invalid="true"], .frost-select[aria-invalid="true"], .frost-textarea[aria-invalid="true"]) {
|
||||
border: 2px dashed Highlight;
|
||||
}
|
||||
|
||||
:where(.frost-input--success, .frost-select--success, .frost-textarea--success, .frost-input[aria-invalid="false"], .frost-select[aria-invalid="false"], .frost-textarea[aria-invalid="false"]) {
|
||||
border: 3px double CanvasText;
|
||||
}
|
||||
|
||||
:where(.frost-input--warning, .frost-select--warning, .frost-textarea--warning) {
|
||||
border: 3px double Highlight;
|
||||
}
|
||||
|
||||
:where(.frost-field--disabled) { opacity: 1; }
|
||||
:where(.frost-help) { color: GrayText; }
|
||||
:where(.frost-error, .frost-warning) { color: Highlight; }
|
||||
:where(.frost-success) { color: CanvasText; text-decoration: underline double; }
|
||||
|
||||
:where(.frost-card, .frost-surface, .frost-notice, .frost-alert, .frost-toast, .frost-dropdown__menu, .frost-popover__content, .frost-modal__content) {
|
||||
border-color: CanvasText;
|
||||
background: Canvas;
|
||||
color: CanvasText;
|
||||
box-shadow: none;
|
||||
forced-color-adjust: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
:where(.frost-card--interactive:hover, .frost-card--interactive:focus-within) {
|
||||
border: 2px solid Highlight;
|
||||
box-shadow: none;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
:where(.frost-badge) {
|
||||
border-color: CanvasText;
|
||||
background: Canvas;
|
||||
color: CanvasText;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
:where(.frost-badge--danger, .frost-notice--danger, .frost-alert--danger, .frost-toast--danger) { border-width: 2px; border-style: dashed; }
|
||||
:where(.frost-badge--warning, .frost-notice--warning, .frost-alert--warning, .frost-toast--warning) { border-width: 3px; border-style: double; }
|
||||
:where(.frost-badge--success, .frost-notice--success, .frost-alert--success, .frost-toast--success) { border-width: 2px; }
|
||||
:where(.frost-alert__body) { color: CanvasText; }
|
||||
|
||||
:where(.frost-dropdown__item) { color: ButtonText; forced-color-adjust: none; }
|
||||
:where(.frost-dropdown__item:hover, .frost-dropdown__item:focus-visible) { background: Highlight; color: HighlightText; }
|
||||
|
||||
:where(.frost-tooltip::after) {
|
||||
border: 1px solid Canvas;
|
||||
background: CanvasText;
|
||||
color: Canvas;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
:where(.frost-backdrop, dialog.frost-modal::backdrop) {
|
||||
background: CanvasText;
|
||||
opacity: 0.72;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
:where(.frost-navbar__link, .frost-breadcrumbs, .frost-breadcrumbs__item[aria-current="page"]) { color: CanvasText; }
|
||||
:where(.frost-navbar__link[aria-current="page"]) { outline: 2px solid Highlight; background: Canvas; }
|
||||
:where(.frost-tabs) { border-color: CanvasText; }
|
||||
:where(.frost-tabs__tab) { color: ButtonText; forced-color-adjust: none; }
|
||||
:where(.frost-tabs__tab:hover, .frost-tabs__tab[aria-selected="true"]) {
|
||||
border-block-end: 3px solid Highlight;
|
||||
background: Canvas;
|
||||
color: CanvasText;
|
||||
}
|
||||
|
||||
:where(.frost-accordion, .frost-accordion__item) { border-color: CanvasText; }
|
||||
:where(.frost-accordion__trigger) { color: ButtonText; forced-color-adjust: none; }
|
||||
|
||||
:where(.frost-pagination__item) {
|
||||
border-color: ButtonText;
|
||||
background: ButtonFace;
|
||||
color: LinkText;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
:where(.frost-pagination__item:hover, .frost-pagination__item[aria-current="page"]) {
|
||||
border: 2px solid Highlight;
|
||||
background: Highlight;
|
||||
color: HighlightText;
|
||||
}
|
||||
|
||||
:where(.frost-table, .frost-table th, .frost-table td) { border-color: CanvasText; }
|
||||
:where(.frost-table th, .frost-table tbody tr:hover) { background: Canvas; color: CanvasText; }
|
||||
:where(.frost-table-wrap:focus-visible) { outline-color: Highlight; }
|
||||
|
||||
:where(.frost-spinner) {
|
||||
border-color: GrayText;
|
||||
border-block-start-color: Highlight;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
:where(.frost-skip-link) {
|
||||
border-color: ButtonText;
|
||||
background: ButtonFace;
|
||||
color: ButtonText;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
:where(:focus-visible) {
|
||||
outline: max(3px, var(--frost-focus-width)) solid Highlight;
|
||||
outline-offset: max(3px, var(--frost-focus-offset));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
@layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.controls, frost.components, frost.utilities;
|
||||
@layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.controls, frost.components, frost.utilities, frost.forced-colors;
|
||||
|
||||
@import url("./tokens.css") layer(frost.tokens);
|
||||
@import url("./base.css") layer(frost.base);
|
||||
@import url("./accessibility.css") layer(frost.accessibility);
|
||||
@import url("./core.css");
|
||||
@import url("./layout.css") layer(frost.layout);
|
||||
@import url("./controls.css") layer(frost.controls);
|
||||
@import url("./components.css") layer(frost.components);
|
||||
@import url("./utilities.css") layer(frost.utilities);
|
||||
|
||||
|
||||
@@ -50,9 +50,19 @@
|
||||
|
||||
.frost-main { min-width: 0; }
|
||||
|
||||
.frost-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--frost-cluster-gap, var(--frost-space-3)); }
|
||||
.frost-grid--dense { --frost-grid-gap: var(--frost-space-3); }
|
||||
.frost-hide-mobile { display: initial; }
|
||||
.frost-show-mobile { display: none; }
|
||||
.frost-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
|
||||
|
||||
@media (max-width: 48rem) {
|
||||
.frost-sidebar-layout { grid-template-columns: 1fr; }
|
||||
.frost-sidebar { position: static; min-height: auto; }
|
||||
}
|
||||
.frost-hide-mobile { display: none; }
|
||||
.frost-show-mobile { display: initial; }
|
||||
}
|
||||
|
||||
@media (min-width: 48.01rem) { .frost-hide-desktop { display: none; } }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
{
|
||||
"name": "@fretuks/frost",
|
||||
"version": "1.0.0-rc.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@fretuks/frost",
|
||||
"version": "1.0.0-rc.1",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@axe-core/playwright": "^4.14.0",
|
||||
"@playwright/test": "^1.65.1",
|
||||
"postcss": "^8.5.33",
|
||||
"postcss-import": "^17.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@axe-core/playwright": {
|
||||
"version": "4.14.0",
|
||||
"resolved": "https://registry.npmjs.org/@axe-core/playwright/-/playwright-4.14.0.tgz",
|
||||
"integrity": "sha512-SGUhG5PIHd2eMdpgBF2PyQLOhX+qyDR2PT4cmoS4Qk2ak+jX/rrSvst9l0PGv5WTHolKpUMvVmoHpr4cZgf1RQ==",
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"axe-core": "~4.14.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.12.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"playwright-core": ">= 1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@playwright/test": {
|
||||
"version": "1.65.1",
|
||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.65.1.tgz",
|
||||
"integrity": "sha512-y+NCIRm2LvY4slUVWvGh1nujJ8RF/hEisIsq2mtUPgdQC4L701bq5hZGMhrpeXjACvwvO9tj5dJqhvM6TP9lbw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright": "1.65.1"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/axe-core": {
|
||||
"version": "4.14.1",
|
||||
"resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.14.1.tgz",
|
||||
"integrity": "sha512-FHfa+lmNjQZfJz1q8wKqIDwC6DExcHt/pkjNQb09a3NPjCKg2rhu5qb2S4r76ASyFNNtuFooJpZe37OgudVGtQ==",
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.18.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.18.0.tgz",
|
||||
"integrity": "sha512-qyax9fgaKOEC4qK8WZn7Q4IcoZC9RC1O1fFxRcRTq/oMMkWT/uXpqpXa12kzWR409zAt1drYN9N9BO26UmBCmw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"hasown": "^2.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.20",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
|
||||
"integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/path-parse": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/playwright": {
|
||||
"version": "1.65.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz",
|
||||
"integrity": "sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright-core": "1.65.1"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright-core": {
|
||||
"version": "1.65.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.1.tgz",
|
||||
"integrity": "sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"playwright-core": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.33",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.33.tgz",
|
||||
"integrity": "sha512-RVHEU9/Pp1Fnjr/MpAJsZoADukCKhfIi15OunEYiGktIkYLkPVvC1sioWolGDS7XByMTx9m/IGbro0Js13zhnQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.20",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss-import": {
|
||||
"version": "17.0.1",
|
||||
"resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-17.0.1.tgz",
|
||||
"integrity": "sha512-lthLZRa+sMc/xo+lG7TMUvOviwP9ngR0VULnvfXTyOE3JIc0mFrbjcubI6Jx52X+B3IKt9yfp6wwVWE768JezA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"postcss-value-parser": "^4.0.0",
|
||||
"read-cache": "^1.0.0",
|
||||
"resolve": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss-value-parser": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
||||
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/read-cache": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.2.tgz",
|
||||
"integrity": "sha512-/peqiBB/n07gQGLsWaHho3WfvUyRscw0gYTsEFMhrIe/nWLkYaf5SbKYjGYqtRV3aPwykJgF2VEMo1ac4bnsGA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.14",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.14.tgz",
|
||||
"integrity": "sha512-1ZjYvR9sbkiwC5+9QHetqW5HmA2pHRMaoupD01t2HlYnV/vydC2zPwLixhsMieSWVZt0JJRg5LVIk0Ow1D/TrA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"is-core-module": "^2.18.0",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"resolve": "bin/resolve"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.4.tgz",
|
||||
"integrity": "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-preserve-symlinks-flag": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,52 @@
|
||||
{
|
||||
"name": "@fretuks/frost",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0-rc.1",
|
||||
"description": "A compact, semantic CSS foundation for websites and web applications.",
|
||||
"style": "./frost.css",
|
||||
"style": "./dist/frost.css",
|
||||
"exports": {
|
||||
".": "./frost.css",
|
||||
".": "./dist/frost.css",
|
||||
"./bundle": "./dist/frost.css",
|
||||
"./bundle.css": "./dist/frost.css",
|
||||
"./bundle.min": "./dist/frost.min.css",
|
||||
"./bundle.min.css": "./dist/frost.min.css",
|
||||
"./dist/frost.css": "./dist/frost.css",
|
||||
"./dist/frost.min.css": "./dist/frost.min.css",
|
||||
"./dist/utility-layer.css": "./dist/utility-layer.css",
|
||||
"./dist/utility-layer.min.css": "./dist/utility-layer.min.css",
|
||||
"./dist/component-layer.css": "./dist/component-layer.css",
|
||||
"./dist/component-layer.min.css": "./dist/component-layer.min.css",
|
||||
"./frost.css": "./frost.css",
|
||||
"./core.css": "./core.css",
|
||||
"./utility-layer.css": "./utility-layer.css",
|
||||
"./component-layer.css": "./component-layer.css",
|
||||
"./tokens.css": "./tokens.css",
|
||||
"./base.css": "./base.css",
|
||||
"./accessibility.css": "./accessibility.css",
|
||||
"./forced-colors.css": "./forced-colors.css",
|
||||
"./layout.css": "./layout.css",
|
||||
"./controls.css": "./controls.css",
|
||||
"./components.css": "./components.css",
|
||||
"./utilities.css": "./utilities.css",
|
||||
"./base": "./base.css",
|
||||
"./core": "./core.css",
|
||||
"./utility-layer": "./utility-layer.css",
|
||||
"./component-layer": "./component-layer.css",
|
||||
"./components": "./components.css",
|
||||
"./utilities": "./utilities.css",
|
||||
"./tokens": "./tokens.css",
|
||||
"./forced-colors": "./forced-colors.css",
|
||||
"./public-api.json": "./public-api.json",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"files": [
|
||||
"*.css",
|
||||
"dist/*.css",
|
||||
"README.md",
|
||||
"CHANGELOG.md",
|
||||
"MIGRATION.md",
|
||||
"SUPPORT.md",
|
||||
"LICENSE",
|
||||
"public-api.json",
|
||||
"scripts/*.mjs"
|
||||
],
|
||||
"keywords": [
|
||||
@@ -35,10 +63,41 @@
|
||||
"url": "https://git.bachmannj.ch/Fretux/Frost.git"
|
||||
},
|
||||
"homepage": "https://git.bachmannj.ch/Fretux/Frost",
|
||||
"bugs": {
|
||||
"url": "https://git.bachmannj.ch/Fretux/Frost/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"browserslist": [
|
||||
"Chrome >= 111",
|
||||
"Edge >= 111",
|
||||
"Firefox >= 113",
|
||||
"Safari >= 16.4"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "node scripts/check.mjs",
|
||||
"size": "node scripts/size.mjs",
|
||||
"test": "node scripts/check.mjs"
|
||||
"build": "node scripts/build.mjs",
|
||||
"check:api": "node scripts/public-api.mjs --check",
|
||||
"check:release": "node scripts/check-release.mjs && npm run check:api",
|
||||
"check:tag": "node scripts/check-release-tag.mjs",
|
||||
"generate:api": "node scripts/public-api.mjs --write",
|
||||
"test": "node scripts/check.mjs && node scripts/check-example.mjs",
|
||||
"test:all": "npm test && npm run test:browser",
|
||||
"test:browser": "playwright test",
|
||||
"test:browser:update": "playwright test --update-snapshots",
|
||||
"test:example": "node scripts/check-example.mjs",
|
||||
"test:package": "npm run prepack && node scripts/test-package.mjs",
|
||||
"test:release": "npm run test:all && npm run size && npm run test:package && npm pack --dry-run",
|
||||
"generate:utilities": "node scripts/generate-utilities.mjs",
|
||||
"prepack": "npm run generate:utilities && npm run generate:api && npm run build && npm run check:release"
|
||||
},
|
||||
"sideEffects": true
|
||||
"sideEffects": true,
|
||||
"devDependencies": {
|
||||
"@axe-core/playwright": "^4.14.0",
|
||||
"@playwright/test": "^1.65.1",
|
||||
"postcss": "^8.5.33",
|
||||
"postcss-import": "^17.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
|
||||
export default defineConfig({
|
||||
testDir: "./tests/browser",
|
||||
fullyParallel: true,
|
||||
forbidOnly: Boolean(process.env.CI),
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: process.env.CI ? "line" : [["list"], ["html", { open: "never" }]],
|
||||
expect: {
|
||||
timeout: 5_000,
|
||||
toHaveScreenshot: {
|
||||
animations: "disabled",
|
||||
caret: "hide",
|
||||
maxDiffPixelRatio: 0.01,
|
||||
},
|
||||
},
|
||||
use: {
|
||||
baseURL: "http://127.0.0.1:4173",
|
||||
locale: "de-CH",
|
||||
trace: "retain-on-failure",
|
||||
screenshot: "only-on-failure",
|
||||
video: "retain-on-failure",
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: "desktop-chromium",
|
||||
use: {
|
||||
...devices["Desktop Chrome"],
|
||||
colorScheme: "light",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "mobile-chromium",
|
||||
use: {
|
||||
...devices["Desktop Chrome"],
|
||||
viewport: { width: 390, height: 844 },
|
||||
colorScheme: "light",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "desktop-firefox",
|
||||
use: {
|
||||
...devices["Desktop Firefox"],
|
||||
colorScheme: "light",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "desktop-webkit",
|
||||
use: {
|
||||
...devices["Desktop Safari"],
|
||||
colorScheme: "light",
|
||||
},
|
||||
},
|
||||
],
|
||||
webServer: {
|
||||
command: "node tests/browser/serve-example.mjs",
|
||||
url: "http://127.0.0.1:4173/examples/index.html",
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 15_000,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,614 @@
|
||||
{
|
||||
"schemaVersion": 2,
|
||||
"packageVersion": "1.0.0-rc.1",
|
||||
"classes": [
|
||||
"frost-absolute",
|
||||
"frost-accordion",
|
||||
"frost-accordion__item",
|
||||
"frost-accordion__panel",
|
||||
"frost-accordion__trigger",
|
||||
"frost-active:translate-y-1",
|
||||
"frost-alert",
|
||||
"frost-alert--danger",
|
||||
"frost-alert--info",
|
||||
"frost-alert--success",
|
||||
"frost-alert--warning",
|
||||
"frost-alert__body",
|
||||
"frost-alert__title",
|
||||
"frost-backdrop",
|
||||
"frost-badge",
|
||||
"frost-badge--danger",
|
||||
"frost-badge--info",
|
||||
"frost-badge--success",
|
||||
"frost-badge--warning",
|
||||
"frost-bg",
|
||||
"frost-bg-accent",
|
||||
"frost-bg-danger",
|
||||
"frost-bg-soft",
|
||||
"frost-bg-success",
|
||||
"frost-bg-surface",
|
||||
"frost-bg-warning",
|
||||
"frost-block",
|
||||
"frost-border",
|
||||
"frost-border-0",
|
||||
"frost-border-strong",
|
||||
"frost-breadcrumbs",
|
||||
"frost-breadcrumbs__item",
|
||||
"frost-button",
|
||||
"frost-button--block",
|
||||
"frost-button--danger",
|
||||
"frost-button--ghost",
|
||||
"frost-button--icon",
|
||||
"frost-button--lg",
|
||||
"frost-button--link",
|
||||
"frost-button--primary",
|
||||
"frost-button--secondary",
|
||||
"frost-button--sm",
|
||||
"frost-button--success",
|
||||
"frost-card",
|
||||
"frost-card--elevated",
|
||||
"frost-card--flat",
|
||||
"frost-card--interactive",
|
||||
"frost-center",
|
||||
"frost-cluster",
|
||||
"frost-col-span-1",
|
||||
"frost-col-span-12",
|
||||
"frost-col-span-2",
|
||||
"frost-col-span-3",
|
||||
"frost-col-span-4",
|
||||
"frost-col-span-5",
|
||||
"frost-col-span-6",
|
||||
"frost-container",
|
||||
"frost-content-center",
|
||||
"frost-dark:bg-surface",
|
||||
"frost-disabled:opacity",
|
||||
"frost-dropdown",
|
||||
"frost-dropdown__item",
|
||||
"frost-dropdown__menu",
|
||||
"frost-dropdown__menu--end",
|
||||
"frost-error",
|
||||
"frost-field",
|
||||
"frost-field--disabled",
|
||||
"frost-fixed",
|
||||
"frost-flex",
|
||||
"frost-flex-1",
|
||||
"frost-flex-auto",
|
||||
"frost-flex-col",
|
||||
"frost-flex-none",
|
||||
"frost-flex-nowrap",
|
||||
"frost-flex-row",
|
||||
"frost-flex-wrap",
|
||||
"frost-focus-ring",
|
||||
"frost-focus:border-accent",
|
||||
"frost-focus:ring",
|
||||
"frost-font-bold",
|
||||
"frost-font-medium",
|
||||
"frost-font-mono",
|
||||
"frost-font-normal",
|
||||
"frost-font-semibold",
|
||||
"frost-gap-0",
|
||||
"frost-gap-1",
|
||||
"frost-gap-10",
|
||||
"frost-gap-12",
|
||||
"frost-gap-16",
|
||||
"frost-gap-2",
|
||||
"frost-gap-3",
|
||||
"frost-gap-4",
|
||||
"frost-gap-5",
|
||||
"frost-gap-6",
|
||||
"frost-gap-8",
|
||||
"frost-grid",
|
||||
"frost-grid--dense",
|
||||
"frost-grid-cols-1",
|
||||
"frost-grid-cols-12",
|
||||
"frost-grid-cols-2",
|
||||
"frost-grid-cols-3",
|
||||
"frost-grid-cols-4",
|
||||
"frost-grid-cols-5",
|
||||
"frost-grid-cols-6",
|
||||
"frost-grow",
|
||||
"frost-grow-0",
|
||||
"frost-h-full",
|
||||
"frost-h-screen",
|
||||
"frost-help",
|
||||
"frost-hidden",
|
||||
"frost-hide-desktop",
|
||||
"frost-hide-mobile",
|
||||
"frost-hover:bg-hover",
|
||||
"frost-hover:bg-soft",
|
||||
"frost-hover:shadow",
|
||||
"frost-hover:text-accent",
|
||||
"frost-inline",
|
||||
"frost-inline-block",
|
||||
"frost-inline-flex",
|
||||
"frost-input",
|
||||
"frost-input--readonly",
|
||||
"frost-input--success",
|
||||
"frost-input--warning",
|
||||
"frost-invisible",
|
||||
"frost-italic",
|
||||
"frost-items-center",
|
||||
"frost-items-end",
|
||||
"frost-items-start",
|
||||
"frost-items-stretch",
|
||||
"frost-justify-around",
|
||||
"frost-justify-between",
|
||||
"frost-justify-center",
|
||||
"frost-justify-end",
|
||||
"frost-justify-evenly",
|
||||
"frost-justify-start",
|
||||
"frost-label",
|
||||
"frost-leading-body",
|
||||
"frost-leading-heading",
|
||||
"frost-leading-none",
|
||||
"frost-lg:block",
|
||||
"frost-lg:flex",
|
||||
"frost-lg:flex-col",
|
||||
"frost-lg:flex-row",
|
||||
"frost-lg:gap-12",
|
||||
"frost-lg:gap-2",
|
||||
"frost-lg:gap-4",
|
||||
"frost-lg:gap-6",
|
||||
"frost-lg:gap-8",
|
||||
"frost-lg:grid",
|
||||
"frost-lg:grid-cols-1",
|
||||
"frost-lg:grid-cols-12",
|
||||
"frost-lg:grid-cols-2",
|
||||
"frost-lg:grid-cols-3",
|
||||
"frost-lg:grid-cols-4",
|
||||
"frost-lg:grid-cols-6",
|
||||
"frost-lg:hidden",
|
||||
"frost-lg:items-center",
|
||||
"frost-lg:justify-between",
|
||||
"frost-lg:p-12",
|
||||
"frost-lg:p-2",
|
||||
"frost-lg:p-4",
|
||||
"frost-lg:p-6",
|
||||
"frost-lg:p-8",
|
||||
"frost-lg:text-center",
|
||||
"frost-lg:text-left",
|
||||
"frost-lowercase",
|
||||
"frost-m-0",
|
||||
"frost-m-1",
|
||||
"frost-m-10",
|
||||
"frost-m-12",
|
||||
"frost-m-16",
|
||||
"frost-m-2",
|
||||
"frost-m-3",
|
||||
"frost-m-4",
|
||||
"frost-m-5",
|
||||
"frost-m-6",
|
||||
"frost-m-8",
|
||||
"frost-main",
|
||||
"frost-max-w-lg",
|
||||
"frost-max-w-md",
|
||||
"frost-max-w-none",
|
||||
"frost-max-w-sm",
|
||||
"frost-max-w-xl",
|
||||
"frost-mb-0",
|
||||
"frost-mb-1",
|
||||
"frost-mb-10",
|
||||
"frost-mb-12",
|
||||
"frost-mb-16",
|
||||
"frost-mb-2",
|
||||
"frost-mb-3",
|
||||
"frost-mb-4",
|
||||
"frost-mb-5",
|
||||
"frost-mb-6",
|
||||
"frost-mb-8",
|
||||
"frost-md:block",
|
||||
"frost-md:flex",
|
||||
"frost-md:flex-col",
|
||||
"frost-md:flex-row",
|
||||
"frost-md:gap-12",
|
||||
"frost-md:gap-2",
|
||||
"frost-md:gap-4",
|
||||
"frost-md:gap-6",
|
||||
"frost-md:gap-8",
|
||||
"frost-md:grid",
|
||||
"frost-md:grid-cols-1",
|
||||
"frost-md:grid-cols-12",
|
||||
"frost-md:grid-cols-2",
|
||||
"frost-md:grid-cols-3",
|
||||
"frost-md:grid-cols-4",
|
||||
"frost-md:grid-cols-6",
|
||||
"frost-md:hidden",
|
||||
"frost-md:items-center",
|
||||
"frost-md:justify-between",
|
||||
"frost-md:p-12",
|
||||
"frost-md:p-2",
|
||||
"frost-md:p-4",
|
||||
"frost-md:p-6",
|
||||
"frost-md:p-8",
|
||||
"frost-md:text-center",
|
||||
"frost-md:text-left",
|
||||
"frost-min-h-screen",
|
||||
"frost-min-w-0",
|
||||
"frost-ml-0",
|
||||
"frost-ml-1",
|
||||
"frost-ml-10",
|
||||
"frost-ml-12",
|
||||
"frost-ml-16",
|
||||
"frost-ml-2",
|
||||
"frost-ml-3",
|
||||
"frost-ml-4",
|
||||
"frost-ml-5",
|
||||
"frost-ml-6",
|
||||
"frost-ml-8",
|
||||
"frost-modal",
|
||||
"frost-modal--drawer",
|
||||
"frost-modal--fullscreen",
|
||||
"frost-modal__body",
|
||||
"frost-modal__content",
|
||||
"frost-modal__footer",
|
||||
"frost-modal__header",
|
||||
"frost-motion-safe:transition",
|
||||
"frost-mr-0",
|
||||
"frost-mr-1",
|
||||
"frost-mr-10",
|
||||
"frost-mr-12",
|
||||
"frost-mr-16",
|
||||
"frost-mr-2",
|
||||
"frost-mr-3",
|
||||
"frost-mr-4",
|
||||
"frost-mr-5",
|
||||
"frost-mr-6",
|
||||
"frost-mr-8",
|
||||
"frost-mt-0",
|
||||
"frost-mt-1",
|
||||
"frost-mt-10",
|
||||
"frost-mt-12",
|
||||
"frost-mt-16",
|
||||
"frost-mt-2",
|
||||
"frost-mt-3",
|
||||
"frost-mt-4",
|
||||
"frost-mt-5",
|
||||
"frost-mt-6",
|
||||
"frost-mt-8",
|
||||
"frost-mx-0",
|
||||
"frost-mx-1",
|
||||
"frost-mx-10",
|
||||
"frost-mx-12",
|
||||
"frost-mx-16",
|
||||
"frost-mx-2",
|
||||
"frost-mx-3",
|
||||
"frost-mx-4",
|
||||
"frost-mx-5",
|
||||
"frost-mx-6",
|
||||
"frost-mx-8",
|
||||
"frost-mx-auto",
|
||||
"frost-my-0",
|
||||
"frost-my-1",
|
||||
"frost-my-10",
|
||||
"frost-my-12",
|
||||
"frost-my-16",
|
||||
"frost-my-2",
|
||||
"frost-my-3",
|
||||
"frost-my-4",
|
||||
"frost-my-5",
|
||||
"frost-my-6",
|
||||
"frost-my-8",
|
||||
"frost-my-auto",
|
||||
"frost-navbar",
|
||||
"frost-navbar__brand",
|
||||
"frost-navbar__link",
|
||||
"frost-navbar__links",
|
||||
"frost-notice",
|
||||
"frost-notice--danger",
|
||||
"frost-notice--info",
|
||||
"frost-notice--success",
|
||||
"frost-notice--warning",
|
||||
"frost-opacity-0",
|
||||
"frost-opacity-100",
|
||||
"frost-opacity-50",
|
||||
"frost-opacity-75",
|
||||
"frost-overflow-auto",
|
||||
"frost-overflow-hidden",
|
||||
"frost-overflow-x-auto",
|
||||
"frost-p-0",
|
||||
"frost-p-1",
|
||||
"frost-p-10",
|
||||
"frost-p-12",
|
||||
"frost-p-16",
|
||||
"frost-p-2",
|
||||
"frost-p-3",
|
||||
"frost-p-4",
|
||||
"frost-p-5",
|
||||
"frost-p-6",
|
||||
"frost-p-8",
|
||||
"frost-pagination",
|
||||
"frost-pagination__item",
|
||||
"frost-pb-0",
|
||||
"frost-pb-1",
|
||||
"frost-pb-10",
|
||||
"frost-pb-12",
|
||||
"frost-pb-16",
|
||||
"frost-pb-2",
|
||||
"frost-pb-3",
|
||||
"frost-pb-4",
|
||||
"frost-pb-5",
|
||||
"frost-pb-6",
|
||||
"frost-pb-8",
|
||||
"frost-pl-0",
|
||||
"frost-pl-1",
|
||||
"frost-pl-10",
|
||||
"frost-pl-12",
|
||||
"frost-pl-16",
|
||||
"frost-pl-2",
|
||||
"frost-pl-3",
|
||||
"frost-pl-4",
|
||||
"frost-pl-5",
|
||||
"frost-pl-6",
|
||||
"frost-pl-8",
|
||||
"frost-place-items-center",
|
||||
"frost-pointer-events-none",
|
||||
"frost-popover",
|
||||
"frost-popover__content",
|
||||
"frost-popover__content--end",
|
||||
"frost-pr-0",
|
||||
"frost-pr-1",
|
||||
"frost-pr-10",
|
||||
"frost-pr-12",
|
||||
"frost-pr-16",
|
||||
"frost-pr-2",
|
||||
"frost-pr-3",
|
||||
"frost-pr-4",
|
||||
"frost-pr-5",
|
||||
"frost-pr-6",
|
||||
"frost-pr-8",
|
||||
"frost-pt-0",
|
||||
"frost-pt-1",
|
||||
"frost-pt-10",
|
||||
"frost-pt-12",
|
||||
"frost-pt-16",
|
||||
"frost-pt-2",
|
||||
"frost-pt-3",
|
||||
"frost-pt-4",
|
||||
"frost-pt-5",
|
||||
"frost-pt-6",
|
||||
"frost-pt-8",
|
||||
"frost-px-0",
|
||||
"frost-px-1",
|
||||
"frost-px-10",
|
||||
"frost-px-12",
|
||||
"frost-px-16",
|
||||
"frost-px-2",
|
||||
"frost-px-3",
|
||||
"frost-px-4",
|
||||
"frost-px-5",
|
||||
"frost-px-6",
|
||||
"frost-px-8",
|
||||
"frost-py-0",
|
||||
"frost-py-1",
|
||||
"frost-py-10",
|
||||
"frost-py-12",
|
||||
"frost-py-16",
|
||||
"frost-py-2",
|
||||
"frost-py-3",
|
||||
"frost-py-4",
|
||||
"frost-py-5",
|
||||
"frost-py-6",
|
||||
"frost-py-8",
|
||||
"frost-relative",
|
||||
"frost-responsive",
|
||||
"frost-rounded",
|
||||
"frost-rounded-full",
|
||||
"frost-rounded-lg",
|
||||
"frost-rounded-pill",
|
||||
"frost-rounded-sm",
|
||||
"frost-rounded-xl",
|
||||
"frost-row",
|
||||
"frost-select",
|
||||
"frost-select--success",
|
||||
"frost-select--warning",
|
||||
"frost-self-center",
|
||||
"frost-self-end",
|
||||
"frost-self-start",
|
||||
"frost-shadow",
|
||||
"frost-shadow-lg",
|
||||
"frost-shadow-none",
|
||||
"frost-shadow-sm",
|
||||
"frost-show-mobile",
|
||||
"frost-shrink",
|
||||
"frost-shrink-0",
|
||||
"frost-sidebar",
|
||||
"frost-sidebar-layout",
|
||||
"frost-skip-link",
|
||||
"frost-space-y-0",
|
||||
"frost-space-y-1",
|
||||
"frost-space-y-10",
|
||||
"frost-space-y-12",
|
||||
"frost-space-y-16",
|
||||
"frost-space-y-2",
|
||||
"frost-space-y-3",
|
||||
"frost-space-y-4",
|
||||
"frost-space-y-5",
|
||||
"frost-space-y-6",
|
||||
"frost-space-y-8",
|
||||
"frost-spinner",
|
||||
"frost-spinner--lg",
|
||||
"frost-spinner--sm",
|
||||
"frost-stack",
|
||||
"frost-sticky",
|
||||
"frost-success",
|
||||
"frost-surface",
|
||||
"frost-table",
|
||||
"frost-table-wrap",
|
||||
"frost-tabs",
|
||||
"frost-tabs__panel",
|
||||
"frost-tabs__tab",
|
||||
"frost-text",
|
||||
"frost-text-2xl",
|
||||
"frost-text-accent",
|
||||
"frost-text-base",
|
||||
"frost-text-center",
|
||||
"frost-text-danger",
|
||||
"frost-text-end",
|
||||
"frost-text-left",
|
||||
"frost-text-lg",
|
||||
"frost-text-link",
|
||||
"frost-text-muted",
|
||||
"frost-text-right",
|
||||
"frost-text-sm",
|
||||
"frost-text-start",
|
||||
"frost-text-success",
|
||||
"frost-text-warning",
|
||||
"frost-text-xl",
|
||||
"frost-text-xs",
|
||||
"frost-textarea",
|
||||
"frost-textarea--success",
|
||||
"frost-textarea--warning",
|
||||
"frost-toast",
|
||||
"frost-toast--danger",
|
||||
"frost-toast--success",
|
||||
"frost-toast--warning",
|
||||
"frost-toast-region",
|
||||
"frost-tooltip",
|
||||
"frost-transition",
|
||||
"frost-truncate",
|
||||
"frost-uppercase",
|
||||
"frost-visible",
|
||||
"frost-visually-hidden",
|
||||
"frost-w-full",
|
||||
"frost-w-screen",
|
||||
"frost-warning",
|
||||
"frost-z-0",
|
||||
"frost-z-1",
|
||||
"frost-z-10",
|
||||
"frost-z-100",
|
||||
"frost-z-20",
|
||||
"frost-z-25",
|
||||
"frost-z-50",
|
||||
"frost-z-75"
|
||||
],
|
||||
"customProperties": [
|
||||
"--frost-breakpoint-lg",
|
||||
"--frost-breakpoint-md",
|
||||
"--frost-cluster-gap",
|
||||
"--frost-color-accent",
|
||||
"--frost-color-accent-hover",
|
||||
"--frost-color-backdrop",
|
||||
"--frost-color-bg",
|
||||
"--frost-color-border",
|
||||
"--frost-color-border-strong",
|
||||
"--frost-color-code-bg",
|
||||
"--frost-color-code-text",
|
||||
"--frost-color-danger",
|
||||
"--frost-color-disabled",
|
||||
"--frost-color-info",
|
||||
"--frost-color-link",
|
||||
"--frost-color-link-hover",
|
||||
"--frost-color-on-accent",
|
||||
"--frost-color-on-danger",
|
||||
"--frost-color-on-success",
|
||||
"--frost-color-on-warning",
|
||||
"--frost-color-overlay",
|
||||
"--frost-color-selection",
|
||||
"--frost-color-success",
|
||||
"--frost-color-surface",
|
||||
"--frost-color-surface-hover",
|
||||
"--frost-color-surface-soft",
|
||||
"--frost-color-text",
|
||||
"--frost-color-text-muted",
|
||||
"--frost-color-warning",
|
||||
"--frost-container-gutter",
|
||||
"--frost-container-max",
|
||||
"--frost-duration-base",
|
||||
"--frost-duration-fast",
|
||||
"--frost-duration-slow",
|
||||
"--frost-ease-out",
|
||||
"--frost-ease-standard",
|
||||
"--frost-focus-color",
|
||||
"--frost-focus-offset",
|
||||
"--frost-focus-width",
|
||||
"--frost-font-body",
|
||||
"--frost-font-display",
|
||||
"--frost-font-heading",
|
||||
"--frost-font-mono",
|
||||
"--frost-font-size-2xl",
|
||||
"--frost-font-size-base",
|
||||
"--frost-font-size-lg",
|
||||
"--frost-font-size-sm",
|
||||
"--frost-font-size-xl",
|
||||
"--frost-grid-gap",
|
||||
"--frost-grid-min",
|
||||
"--frost-line-height-body",
|
||||
"--frost-line-height-heading",
|
||||
"--frost-radius-lg",
|
||||
"--frost-radius-md",
|
||||
"--frost-radius-pill",
|
||||
"--frost-radius-sm",
|
||||
"--frost-radius-xl",
|
||||
"--frost-row-gap",
|
||||
"--frost-shadow-lg",
|
||||
"--frost-shadow-md",
|
||||
"--frost-shadow-sm",
|
||||
"--frost-sidebar-width",
|
||||
"--frost-space-0",
|
||||
"--frost-space-1",
|
||||
"--frost-space-10",
|
||||
"--frost-space-12",
|
||||
"--frost-space-16",
|
||||
"--frost-space-2",
|
||||
"--frost-space-3",
|
||||
"--frost-space-4",
|
||||
"--frost-space-5",
|
||||
"--frost-space-6",
|
||||
"--frost-space-8",
|
||||
"--frost-space-y",
|
||||
"--frost-stack-gap",
|
||||
"--frost-z-modal",
|
||||
"--frost-z-overlay",
|
||||
"--frost-z-popover",
|
||||
"--frost-z-toast"
|
||||
],
|
||||
"keyframes": [
|
||||
"frost-control-loading",
|
||||
"frost-spin"
|
||||
],
|
||||
"layers": [
|
||||
"frost.tokens",
|
||||
"frost.base",
|
||||
"frost.accessibility",
|
||||
"frost.layout",
|
||||
"frost.controls",
|
||||
"frost.components",
|
||||
"frost.utilities",
|
||||
"frost.forced-colors"
|
||||
],
|
||||
"exports": {
|
||||
".": "./dist/frost.css",
|
||||
"./accessibility.css": "./accessibility.css",
|
||||
"./base": "./base.css",
|
||||
"./base.css": "./base.css",
|
||||
"./bundle": "./dist/frost.css",
|
||||
"./bundle.css": "./dist/frost.css",
|
||||
"./bundle.min": "./dist/frost.min.css",
|
||||
"./bundle.min.css": "./dist/frost.min.css",
|
||||
"./component-layer": "./component-layer.css",
|
||||
"./component-layer.css": "./component-layer.css",
|
||||
"./components": "./components.css",
|
||||
"./components.css": "./components.css",
|
||||
"./controls.css": "./controls.css",
|
||||
"./core": "./core.css",
|
||||
"./core.css": "./core.css",
|
||||
"./dist/component-layer.css": "./dist/component-layer.css",
|
||||
"./dist/component-layer.min.css": "./dist/component-layer.min.css",
|
||||
"./dist/frost.css": "./dist/frost.css",
|
||||
"./dist/frost.min.css": "./dist/frost.min.css",
|
||||
"./dist/utility-layer.css": "./dist/utility-layer.css",
|
||||
"./dist/utility-layer.min.css": "./dist/utility-layer.min.css",
|
||||
"./forced-colors": "./forced-colors.css",
|
||||
"./forced-colors.css": "./forced-colors.css",
|
||||
"./frost.css": "./frost.css",
|
||||
"./layout.css": "./layout.css",
|
||||
"./package.json": "./package.json",
|
||||
"./public-api.json": "./public-api.json",
|
||||
"./tokens": "./tokens.css",
|
||||
"./tokens.css": "./tokens.css",
|
||||
"./utilities": "./utilities.css",
|
||||
"./utilities.css": "./utilities.css",
|
||||
"./utility-layer": "./utility-layer.css",
|
||||
"./utility-layer.css": "./utility-layer.css"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const output = resolve(root, "dist");
|
||||
const layers = {
|
||||
"frost.css": ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css", "utilities.css", "forced-colors.css"],
|
||||
"utility-layer.css": ["tokens.css", "base.css", "accessibility.css", "layout.css", "utilities.css", "forced-colors.css"],
|
||||
"component-layer.css": ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css", "forced-colors.css"],
|
||||
};
|
||||
|
||||
const minify = (source) => source
|
||||
.replace(/\/\*[^!*][\s\S]*?\*\//g, "")
|
||||
.replace(/\s+/g, " ")
|
||||
.replace(/\s*([{}:;,>])\s*/g, "$1")
|
||||
.trim();
|
||||
|
||||
await mkdir(output, { recursive: true });
|
||||
for (const [name, files] of Object.entries(layers)) {
|
||||
const source = (await Promise.all(files.map((file) => readFile(resolve(root, file), "utf8")))).join("\n");
|
||||
await writeFile(resolve(output, name), `${source}\n`);
|
||||
await writeFile(resolve(output, name.replace(".css", ".min.css")), `${minify(source)}\n`);
|
||||
}
|
||||
console.log(`Built ${Object.keys(layers).length} CSS entry points in dist/.`);
|
||||
@@ -0,0 +1,31 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const html = await readFile(resolve(root, "examples/index.html"), "utf8");
|
||||
const required = [
|
||||
"frost-md:grid-cols-2",
|
||||
"frost-hover:shadow",
|
||||
"frost-navbar",
|
||||
"frost-breadcrumbs",
|
||||
"frost-tabs",
|
||||
"frost-accordion",
|
||||
"frost-table",
|
||||
"frost-spinner",
|
||||
"id=\"theme-toggle\"",
|
||||
"id=\"menu-trigger\"",
|
||||
"id=\"component-search\"",
|
||||
"data-component=\"buttons\"",
|
||||
"data-component=\"modal\"",
|
||||
"data-copy-html",
|
||||
"catalog-a11y",
|
||||
];
|
||||
const errors = required.filter((value) => !html.includes(value)).map((value) => `examples/index.html: missing demo marker ${value}`);
|
||||
if (!html.includes("aria-selected") || !html.includes("aria-expanded")) errors.push("examples/index.html: interactive ARIA state markers are missing");
|
||||
if (errors.length) {
|
||||
console.error(errors.join("\n"));
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(`Checked ${required.length} catalog, component, and interaction markers in examples/index.html.`);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const packageJson = JSON.parse(await readFile(resolve(root, "package.json"), "utf8"));
|
||||
const suppliedTag = process.argv[2] ?? process.env.GITEA_REF_NAME ?? process.env.GITHUB_REF_NAME;
|
||||
const expectedTag = `v${packageJson.version}`;
|
||||
|
||||
if (!suppliedTag) {
|
||||
console.error("Release tag is required as an argument or through GITEA_REF_NAME/GITHUB_REF_NAME.");
|
||||
process.exitCode = 1;
|
||||
} else if (suppliedTag !== expectedTag) {
|
||||
console.error(`Release tag ${suppliedTag} does not match package version ${packageJson.version}; expected ${expectedTag}.`);
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
const channel = packageJson.version.includes("-") ? "next" : "latest";
|
||||
console.log(channel);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const packageJson = JSON.parse(await readFile(resolve(root, "package.json"), "utf8"));
|
||||
const packageLock = JSON.parse(await readFile(resolve(root, "package-lock.json"), "utf8"));
|
||||
const changelog = await readFile(resolve(root, "CHANGELOG.md"), "utf8");
|
||||
const errors = [];
|
||||
const semverPattern = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
||||
|
||||
if (!semverPattern.test(packageJson.version)) errors.push(`package.json: invalid semantic version ${packageJson.version}`);
|
||||
if (packageLock.name !== packageJson.name) errors.push(`package-lock.json: package name ${packageLock.name} does not match ${packageJson.name}`);
|
||||
if (packageLock.version !== packageJson.version) errors.push(`package-lock.json: version ${packageLock.version} does not match ${packageJson.version}`);
|
||||
if (packageLock.packages?.[""]?.name !== packageJson.name) errors.push("package-lock.json: root package name is stale");
|
||||
if (packageLock.packages?.[""]?.version !== packageJson.version) errors.push("package-lock.json: root package version is stale");
|
||||
if (packageJson.publishConfig?.access !== "public") errors.push("package.json: publishConfig.access must be public");
|
||||
for (const requiredFile of ["README.md", "CHANGELOG.md", "MIGRATION.md", "SUPPORT.md", "public-api.json"]) {
|
||||
if (!packageJson.files?.includes(requiredFile)) errors.push(`package.json: files must include ${requiredFile}`);
|
||||
}
|
||||
for (const browser of ["Chrome >= 111", "Edge >= 111", "Firefox >= 113", "Safari >= 16.4"]) {
|
||||
if (!packageJson.browserslist?.includes(browser)) errors.push(`package.json: browserslist is missing ${browser}`);
|
||||
}
|
||||
|
||||
const releases = [...changelog.matchAll(/^##\s+\[?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)\]?\s*$/gm)].map((match) => ({ version: match[1], index: match.index }));
|
||||
if (!releases.length) errors.push("CHANGELOG.md: no release headings found");
|
||||
else if (releases[0].version !== packageJson.version) errors.push(`CHANGELOG.md: latest release ${releases[0].version} does not match package version ${packageJson.version}`);
|
||||
|
||||
const seenVersions = new Set();
|
||||
const compareVersions = (left, right) => {
|
||||
const leftParts = left.split("-")[0].split(".").map(Number);
|
||||
const rightParts = right.split("-")[0].split(".").map(Number);
|
||||
for (let index = 0; index < 3; index += 1) {
|
||||
if (leftParts[index] !== rightParts[index]) return leftParts[index] - rightParts[index];
|
||||
}
|
||||
return left.includes("-") === right.includes("-") ? left.localeCompare(right) : left.includes("-") ? -1 : 1;
|
||||
};
|
||||
for (let index = 0; index < releases.length; index += 1) {
|
||||
const release = releases[index];
|
||||
if (seenVersions.has(release.version)) errors.push(`CHANGELOG.md: duplicate release ${release.version}`);
|
||||
seenVersions.add(release.version);
|
||||
const sectionEnd = releases[index + 1]?.index ?? changelog.length;
|
||||
const section = changelog.slice(release.index, sectionEnd);
|
||||
if (!/^\s*-\s+\S/m.test(section)) errors.push(`CHANGELOG.md: release ${release.version} has no change entries`);
|
||||
const nextRelease = releases[index + 1];
|
||||
if (nextRelease && compareVersions(release.version, nextRelease.version) <= 0) errors.push(`CHANGELOG.md: ${release.version} must appear after a newer version, not before ${nextRelease.version}`);
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
console.error(errors.join("\n"));
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(`Release metadata is consistent for ${packageJson.name}@${packageJson.version}; ${releases.length} changelog releases checked.`);
|
||||
}
|
||||
@@ -5,12 +5,17 @@ import { fileURLToPath } from "node:url";
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const cssFiles = [
|
||||
"frost.css",
|
||||
"core.css",
|
||||
"utility-layer.css",
|
||||
"component-layer.css",
|
||||
"tokens.css",
|
||||
"base.css",
|
||||
"accessibility.css",
|
||||
"forced-colors.css",
|
||||
"layout.css",
|
||||
"controls.css",
|
||||
"components.css",
|
||||
"utilities.css",
|
||||
];
|
||||
|
||||
const errors = [];
|
||||
@@ -30,6 +35,48 @@ for (const match of entry.matchAll(/@import\s+url\("([^"]+)"\)/g)) {
|
||||
catch { errors.push(`frost.css: missing import ${match[1]}`); }
|
||||
}
|
||||
|
||||
const layerSources = {
|
||||
"core.css": ["tokens.css", "base.css", "accessibility.css", "forced-colors.css"],
|
||||
"utility-layer.css": ["core.css", "layout.css", "utilities.css"],
|
||||
"component-layer.css": ["core.css", "layout.css", "controls.css", "components.css"],
|
||||
};
|
||||
for (const [file, requiredImports] of Object.entries(layerSources)) {
|
||||
const source = await readFile(resolve(root, file), "utf8");
|
||||
for (const requiredImport of requiredImports) {
|
||||
if (!source.includes(`./${requiredImport}`)) errors.push(`${file}: missing layer import ${requiredImport}`);
|
||||
}
|
||||
}
|
||||
const utilityLayerSource = await readFile(resolve(root, "utility-layer.css"), "utf8");
|
||||
const componentLayerSource = await readFile(resolve(root, "component-layer.css"), "utf8");
|
||||
if (utilityLayerSource.includes("./controls.css") || utilityLayerSource.includes("./components.css")) errors.push("utility-layer.css: component layer leaked into utility entry point");
|
||||
if (componentLayerSource.includes("./utilities.css")) errors.push("component-layer.css: utility layer leaked into component entry point");
|
||||
|
||||
const utilitySource = await readFile(resolve(root, "utilities.css"), "utf8");
|
||||
for (const utility of ["frost-flex", "frost-grid", "frost-gap-4", "frost-p-4", "frost-md\\:grid-cols-2", "frost-hover\\:bg-soft"]) {
|
||||
if (!utilitySource.includes(`.${utility}`)) errors.push(`utilities.css: missing public utility ${utility}`);
|
||||
}
|
||||
|
||||
const componentsSource = await readFile(resolve(root, "components.css"), "utf8");
|
||||
for (const component of ["frost-navbar", "frost-breadcrumbs", "frost-tabs", "frost-accordion", "frost-pagination", "frost-table", "frost-spinner"]) {
|
||||
if (!componentsSource.includes(`.${component}`)) errors.push(`components.css: missing public component ${component}`);
|
||||
}
|
||||
|
||||
const packageJson = JSON.parse(await readFile(resolve(root, "package.json"), "utf8"));
|
||||
for (const exportPath of ["./utilities", "./components", "./tokens"]) {
|
||||
if (!packageJson.exports[exportPath]) errors.push(`package.json: missing export ${exportPath}`);
|
||||
}
|
||||
for (const exportPath of ["./core", "./utility-layer", "./component-layer"]) {
|
||||
if (!packageJson.exports[exportPath]) errors.push(`package.json: missing layer export ${exportPath}`);
|
||||
}
|
||||
for (const exportPath of ["./forced-colors", "./forced-colors.css"]) {
|
||||
if (!packageJson.exports[exportPath]) errors.push(`package.json: missing forced-colors export ${exportPath}`);
|
||||
}
|
||||
if (packageJson.style !== "./dist/frost.css") errors.push("package.json: style must point to the built dist/frost.css bundle");
|
||||
if (packageJson.exports["."] !== "./dist/frost.css") errors.push("package.json: default export must point to the built dist/frost.css bundle");
|
||||
for (const exportPath of ["./bundle", "./bundle.css", "./bundle.min", "./bundle.min.css", "./dist/frost.css", "./dist/frost.min.css", "./dist/utility-layer.css", "./dist/utility-layer.min.css", "./dist/component-layer.css", "./dist/component-layer.min.css"]) {
|
||||
if (!packageJson.exports[exportPath]) errors.push(`package.json: missing bundled export ${exportPath}`);
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
console.error(errors.join("\n"));
|
||||
process.exitCode = 1;
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import { writeFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const spaces = ["0", "1", "2", "3", "4", "5", "6", "8", "10", "12", "16"];
|
||||
const breakpoints = { md: "48rem", lg: "64rem" };
|
||||
const lines = ["@layer frost.utilities {", " /* Generated by scripts/generate-utilities.mjs. Edit the generator, not this file. */"];
|
||||
const add = (name, declaration) => lines.push(` .frost-${name} { ${declaration}; }`);
|
||||
const addVariant = (variant, name, declaration, pseudo = "") => lines.push(` .frost-${variant}\\:${name}${pseudo} { ${declaration}; }`);
|
||||
|
||||
const declarations = [
|
||||
["block", "display: block"], ["inline-block", "display: inline-block"], ["inline", "display: inline"], ["flex", "display: flex"], ["inline-flex", "display: inline-flex"], ["grid", "display: grid"], ["hidden", "display: none !important"], ["visible", "visibility: visible"], ["invisible", "visibility: hidden"],
|
||||
["relative", "position: relative"], ["absolute", "position: absolute"], ["fixed", "position: fixed"], ["sticky", "position: sticky"], ["flex-wrap", "flex-wrap: wrap"], ["flex-nowrap", "flex-wrap: nowrap"], ["flex-row", "flex-direction: row"], ["flex-col", "flex-direction: column"], ["flex-1", "flex: 1 1 0%"], ["flex-auto", "flex: 1 1 auto"], ["flex-none", "flex: none"], ["grow", "flex-grow: 1"], ["grow-0", "flex-grow: 0"], ["shrink", "flex-shrink: 1"], ["shrink-0", "flex-shrink: 0"], ["min-w-0", "min-width: 0"], ["w-full", "width: 100%"], ["h-full", "height: 100%"], ["w-screen", "width: 100vw"], ["h-screen", "height: 100vh"], ["min-h-screen", "min-height: 100vh"],
|
||||
["items-start", "align-items: flex-start"], ["items-center", "align-items: center"], ["items-end", "align-items: flex-end"], ["items-stretch", "align-items: stretch"], ["justify-start", "justify-content: flex-start"], ["justify-center", "justify-content: center"], ["justify-end", "justify-content: flex-end"], ["justify-between", "justify-content: space-between"], ["justify-around", "justify-content: space-around"], ["justify-evenly", "justify-content: space-evenly"], ["content-center", "align-content: center"], ["self-start", "align-self: flex-start"], ["self-center", "align-self: center"], ["self-end", "align-self: flex-end"], ["place-items-center", "place-items: center"], ["text-left", "text-align: left"], ["text-center", "text-align: center"], ["text-right", "text-align: right"], ["text-start", "text-align: start"], ["text-end", "text-align: end"], ["truncate", "overflow: hidden; text-overflow: ellipsis; white-space: nowrap"], ["overflow-hidden", "overflow: hidden"], ["overflow-auto", "overflow: auto"], ["overflow-x-auto", "overflow-x: auto"],
|
||||
["border", "border: 1px solid var(--frost-color-border)"], ["border-strong", "border: 1px solid var(--frost-color-border-strong)"], ["border-0", "border: 0"], ["rounded-sm", "border-radius: var(--frost-radius-sm)"], ["rounded", "border-radius: var(--frost-radius-md)"], ["rounded-lg", "border-radius: var(--frost-radius-lg)"], ["rounded-xl", "border-radius: var(--frost-radius-xl)"], ["rounded-pill", "border-radius: var(--frost-radius-pill)"], ["rounded-full", "border-radius: 9999px"], ["shadow-sm", "box-shadow: var(--frost-shadow-sm)"], ["shadow", "box-shadow: var(--frost-shadow-md)"], ["shadow-lg", "box-shadow: var(--frost-shadow-lg)"], ["shadow-none", "box-shadow: none"],
|
||||
["font-normal", "font-weight: 400"], ["font-medium", "font-weight: 500"], ["font-semibold", "font-weight: 650"], ["font-bold", "font-weight: 700"], ["font-mono", "font-family: var(--frost-font-mono)"], ["leading-body", "line-height: var(--frost-line-height-body)"], ["leading-heading", "line-height: var(--frost-line-height-heading)"], ["leading-none", "line-height: 1"], ["uppercase", "text-transform: uppercase"], ["lowercase", "text-transform: lowercase"], ["italic", "font-style: italic"],
|
||||
["text", "color: var(--frost-color-text)"], ["text-muted", "color: var(--frost-color-text-muted)"], ["text-accent", "color: var(--frost-color-accent)"], ["text-success", "color: var(--frost-color-success)"], ["text-warning", "color: var(--frost-color-warning)"], ["text-danger", "color: var(--frost-color-danger)"], ["text-link", "color: var(--frost-color-link)"], ["bg", "background-color: var(--frost-color-bg)"], ["bg-surface", "background-color: var(--frost-color-surface)"], ["bg-soft", "background-color: var(--frost-color-surface-soft)"], ["bg-accent", "background-color: var(--frost-color-accent); color: var(--frost-color-on-accent)"], ["bg-success", "background-color: var(--frost-color-success); color: var(--frost-color-on-success)"], ["bg-warning", "background-color: var(--frost-color-warning); color: var(--frost-color-on-warning)"], ["bg-danger", "background-color: var(--frost-color-danger); color: var(--frost-color-on-danger)"],
|
||||
["max-w-sm", "max-width: 24rem"], ["max-w-md", "max-width: 32rem"], ["max-w-lg", "max-width: 48rem"], ["max-w-xl", "max-width: 64rem"], ["max-w-none", "max-width: none"], ["opacity-0", "opacity: 0"], ["opacity-50", "opacity: 0.5"], ["opacity-75", "opacity: 0.75"], ["opacity-100", "opacity: 1"], ["pointer-events-none", "pointer-events: none"],
|
||||
];
|
||||
for (const [name, declaration] of declarations) add(name, declaration);
|
||||
|
||||
for (const space of spaces) {
|
||||
const token = `var(--frost-space-${space})`;
|
||||
for (const [prefix, property] of [["gap", "gap"], ["p", "padding"], ["px", "padding-inline"], ["py", "padding-block"], ["pt", "padding-block-start"], ["pr", "padding-inline-end"], ["pb", "padding-block-end"], ["pl", "padding-inline-start"], ["m", "margin"], ["mx", "margin-inline"], ["my", "margin-block"], ["mt", "margin-block-start"], ["mr", "margin-inline-end"], ["mb", "margin-block-end"], ["ml", "margin-inline-start"]]) add(`${prefix}-${space}`, `${property}: ${token}`);
|
||||
}
|
||||
add("mx-auto", "margin-inline: auto"); add("my-auto", "margin-block: auto");
|
||||
add("space-y-0", "--frost-space-y: 0");
|
||||
for (const space of spaces.filter((value) => value !== "0")) add(`space-y-${space}`, `--frost-space-y: var(--frost-space-${space})`);
|
||||
lines.push(" .frost-space-y-0 > :not([hidden]) ~ :not([hidden]) { margin-block-start: 0; }");
|
||||
for (const space of spaces.filter((value) => value !== "0")) lines.push(` .frost-space-y-${space} > :not([hidden]) ~ :not([hidden]) { margin-block-start: var(--frost-space-${space}); }`);
|
||||
add("grid-cols-1", "grid-template-columns: repeat(1, minmax(0, 1fr))");
|
||||
for (const count of [2, 3, 4, 5, 6, 12]) add(`grid-cols-${count}`, `grid-template-columns: repeat(${count}, minmax(0, 1fr))`);
|
||||
for (const count of [1, 2, 3, 4, 5, 6, 12]) add(`col-span-${count}`, `grid-column: span ${count} / span ${count}`);
|
||||
for (const value of [0, 1, 10, 20, 25, 50, 75, 100]) add(`z-${value}`, `z-index: ${value}`);
|
||||
for (const [name, value] of [["xs", "0.75rem"], ["sm", "var(--frost-font-size-sm)"], ["base", "var(--frost-font-size-base)"], ["lg", "var(--frost-font-size-lg)"], ["xl", "var(--frost-font-size-xl)"], ["2xl", "var(--frost-font-size-2xl)"]]) add(`text-${name}`, `font-size: ${value}`);
|
||||
add("transition", "transition: background-color var(--frost-duration-base) var(--frost-ease-standard), border-color var(--frost-duration-base) var(--frost-ease-standard), color var(--frost-duration-base) var(--frost-ease-standard), box-shadow var(--frost-duration-base) var(--frost-ease-standard), transform var(--frost-duration-fast) var(--frost-ease-out)");
|
||||
add("focus-ring", "outline: var(--frost-focus-width) solid var(--frost-focus-color); outline-offset: var(--frost-focus-offset)");
|
||||
|
||||
for (const [variant, pseudo, name, declaration] of [["hover", ":hover", "bg-soft", "background-color: var(--frost-color-surface-soft)"], ["hover", ":hover", "bg-hover", "background-color: var(--frost-color-surface-hover)"], ["hover", ":hover", "text-accent", "color: var(--frost-color-accent-hover)"], ["hover", ":hover", "shadow", "box-shadow: var(--frost-shadow-md)"], ["focus", ":focus-visible", "ring", "outline: var(--frost-focus-width) solid var(--frost-focus-color); outline-offset: var(--frost-focus-offset)"], ["focus", ":focus", "border-accent", "border-color: var(--frost-focus-color)"], ["active", ":active", "translate-y-1", "transform: translateY(1px)"]]) addVariant(variant, name, declaration, pseudo);
|
||||
lines.push(" .frost-disabled\\:opacity:disabled, .frost-disabled\\:opacity[aria-disabled=\"true\"] { opacity: 0.55; }");
|
||||
|
||||
for (const [variant, minWidth] of Object.entries(breakpoints)) {
|
||||
lines.push(` @media (min-width: ${minWidth}) {`);
|
||||
for (const [name, declaration] of declarations.filter(([name]) => ["block", "flex", "grid", "hidden", "flex-row", "flex-col", "items-center", "justify-between", "text-left", "text-center"].includes(name))) addVariant(variant, name, declaration);
|
||||
for (const count of [1, 2, 3, 4, 6, 12]) addVariant(variant, `grid-cols-${count}`, `grid-template-columns: repeat(${count}, minmax(0, 1fr))`);
|
||||
for (const space of ["2", "4", "6", "8", "12"]) { addVariant(variant, `p-${space}`, `padding: var(--frost-space-${space})`); addVariant(variant, `gap-${space}`, `gap: var(--frost-space-${space})`); }
|
||||
lines.push(" }");
|
||||
}
|
||||
lines.push(" @media (prefers-reduced-motion: reduce) { .frost-motion-safe\\:transition { transition: none; } }");
|
||||
lines.push(" @media (prefers-color-scheme: dark) { :root:not([data-theme=\"light\"]) .frost-dark\\:bg-surface { background-color: var(--frost-color-surface); } }");
|
||||
lines.push(" :root[data-theme=\"dark\"] .frost-dark\\:bg-surface { background-color: var(--frost-color-surface); }");
|
||||
lines.push("}");
|
||||
await writeFile(resolve(root, "utilities.css"), `${lines.join("\n")}\n`);
|
||||
console.log(`Generated utilities.css with ${declarations.length} base utilities and ${spaces.length} spacing steps.`);
|
||||
@@ -0,0 +1,101 @@
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const manifestPath = resolve(root, "public-api.json");
|
||||
const cssFiles = ["tokens.css", "base.css", "accessibility.css", "forced-colors.css", "layout.css", "controls.css", "components.css", "utilities.css"];
|
||||
const sortLexically = (values) => [...values].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
||||
|
||||
const packageJson = JSON.parse(await readFile(resolve(root, "package.json"), "utf8"));
|
||||
const sources = await Promise.all(cssFiles.map((file) => readFile(resolve(root, file), "utf8")));
|
||||
const combinedCss = sources.join("\n");
|
||||
|
||||
const classes = new Set();
|
||||
for (const match of combinedCss.matchAll(/\.(frost-[A-Za-z0-9_-]+(?:\\:[A-Za-z0-9_-]+)*)/g)) {
|
||||
classes.add(match[1].replaceAll("\\:", ":"));
|
||||
}
|
||||
|
||||
const customProperties = new Set(combinedCss.match(/--frost-[a-z0-9-]+/g) ?? []);
|
||||
const keyframes = new Set([...combinedCss.matchAll(/@keyframes\s+([A-Za-z0-9_-]+)/g)].map((match) => match[1]));
|
||||
const entryCss = await readFile(resolve(root, "frost.css"), "utf8");
|
||||
const layerDeclaration = entryCss.match(/@layer\s+([^;]+);/);
|
||||
const layers = layerDeclaration ? layerDeclaration[1].split(",").map((layer) => layer.trim()) : [];
|
||||
const packageExports = Object.fromEntries(sortLexically(Object.keys(packageJson.exports)).map((key) => [key, packageJson.exports[key]]));
|
||||
|
||||
const currentManifest = {
|
||||
schemaVersion: 2,
|
||||
packageVersion: packageJson.version,
|
||||
classes: sortLexically(classes),
|
||||
customProperties: sortLexically(customProperties),
|
||||
keyframes: sortLexically(keyframes),
|
||||
layers,
|
||||
exports: packageExports,
|
||||
};
|
||||
|
||||
const serialize = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
||||
const readExistingManifest = async () => {
|
||||
try {
|
||||
return JSON.parse(await readFile(manifestPath, "utf8"));
|
||||
} catch (error) {
|
||||
if (error.code === "ENOENT") return null;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const findBreakingChanges = (baseline, current) => {
|
||||
if (!baseline) return [];
|
||||
const changes = [];
|
||||
for (const className of baseline.classes ?? []) {
|
||||
if (!current.classes.includes(className)) changes.push(`removed class .${className}`);
|
||||
}
|
||||
for (const property of baseline.customProperties ?? []) {
|
||||
if (!current.customProperties.includes(property)) changes.push(`removed custom property ${property}`);
|
||||
}
|
||||
for (const keyframe of baseline.keyframes ?? []) {
|
||||
if (!current.keyframes.includes(keyframe)) changes.push(`removed keyframes ${keyframe}`);
|
||||
}
|
||||
for (const [key, target] of Object.entries(baseline.exports ?? {})) {
|
||||
if (!(key in current.exports)) changes.push(`removed package export ${key}`);
|
||||
else if (current.exports[key] !== target) changes.push(`changed package export ${key}: ${target} -> ${current.exports[key]}`);
|
||||
}
|
||||
for (const layer of baseline.layers ?? []) {
|
||||
if (!current.layers.includes(layer)) changes.push(`removed CSS layer ${layer}`);
|
||||
}
|
||||
return changes;
|
||||
};
|
||||
|
||||
const command = process.argv.includes("--write") ? "write" : process.argv.includes("--check") ? "check" : null;
|
||||
if (!command) {
|
||||
console.error("Usage: node scripts/public-api.mjs --write [--allow-breaking] | --check");
|
||||
process.exitCode = 2;
|
||||
} else {
|
||||
const existingManifest = await readExistingManifest();
|
||||
const breakingChanges = findBreakingChanges(existingManifest, currentManifest);
|
||||
|
||||
if (command === "write") {
|
||||
if (breakingChanges.length && !process.argv.includes("--allow-breaking")) {
|
||||
console.error(["Breaking public API changes detected:", ...breakingChanges.map((change) => `- ${change}`), "Run with --allow-breaking only for an intentional breaking release."].join("\n"));
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
const next = serialize(currentManifest);
|
||||
const previous = existingManifest ? serialize(existingManifest) : null;
|
||||
if (next !== previous) await writeFile(manifestPath, next);
|
||||
console.log(`Public API manifest contains ${currentManifest.classes.length} classes, ${currentManifest.customProperties.length} custom properties, ${currentManifest.keyframes.length} keyframes, and ${Object.keys(currentManifest.exports).length} exports.`);
|
||||
}
|
||||
} else if (!existingManifest) {
|
||||
console.error("public-api.json is missing. Run npm run generate:api.");
|
||||
process.exitCode = 1;
|
||||
} else if (serialize(existingManifest) !== serialize(currentManifest)) {
|
||||
const additions = [
|
||||
...currentManifest.classes.filter((value) => !existingManifest.classes.includes(value)).map((value) => `added class .${value}`),
|
||||
...currentManifest.customProperties.filter((value) => !existingManifest.customProperties.includes(value)).map((value) => `added custom property ${value}`),
|
||||
...currentManifest.keyframes.filter((value) => !(existingManifest.keyframes ?? []).includes(value)).map((value) => `added keyframes ${value}`),
|
||||
...Object.keys(currentManifest.exports).filter((value) => !(value in existingManifest.exports)).map((value) => `added package export ${value}`),
|
||||
];
|
||||
console.error(["public-api.json does not match the current CSS/package surface.", ...breakingChanges.map((change) => `BREAKING: ${change}`), ...additions.map((change) => `NEW: ${change}`), "Run npm run generate:api and commit the result."].join("\n"));
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(`Public API contract is current: ${currentManifest.classes.length} classes, ${currentManifest.customProperties.length} custom properties, ${currentManifest.keyframes.length} keyframes, ${Object.keys(currentManifest.exports).length} exports.`);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const files = ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css"];
|
||||
const files = ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css", "utilities.css", "forced-colors.css"];
|
||||
const source = (await Promise.all(files.map((file) => readFile(resolve(root, file), "utf8")))).join("\n");
|
||||
const rawBytes = Buffer.byteLength(source);
|
||||
const gzipBytes = gzipSync(source).byteLength;
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import { mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { basename, join, resolve, sep } from "node:path";
|
||||
import { createRequire } from "node:module";
|
||||
import { promisify } from "node:util";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import postcss from "postcss";
|
||||
import postcssImport from "postcss-import";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const root = fileURLToPath(new URL("..", import.meta.url));
|
||||
const packageJson = JSON.parse(await readFile(resolve(root, "package.json"), "utf8"));
|
||||
const temporaryRoot = await mkdtemp(join(tmpdir(), "frost-consumer-"));
|
||||
const npmCli = process.env.npm_execpath;
|
||||
|
||||
const runNpm = async (arguments_, options = {}) => {
|
||||
if (npmCli) return execFileAsync(process.execPath, [npmCli, ...arguments_], { maxBuffer: 10 * 1024 * 1024, ...options });
|
||||
const command = process.platform === "win32" ? "npm.cmd" : "npm";
|
||||
return execFileAsync(command, arguments_, { maxBuffer: 10 * 1024 * 1024, ...options });
|
||||
};
|
||||
|
||||
try {
|
||||
const { stdout } = await runNpm(["pack", "--json", "--ignore-scripts", "--pack-destination", temporaryRoot], { cwd: root });
|
||||
const packResult = JSON.parse(stdout)[0];
|
||||
const tarball = join(temporaryRoot, packResult.filename);
|
||||
const packedPaths = new Set(packResult.files.map((file) => file.path.replaceAll("\\", "/")));
|
||||
|
||||
for (const target of Object.values(packageJson.exports)) {
|
||||
const path = target.replace(/^\.\//, "");
|
||||
if (!packedPaths.has(path)) throw new Error(`Tarball is missing export target ${target}`);
|
||||
}
|
||||
for (const required of ["public-api.json", "SUPPORT.md", "MIGRATION.md", "dist/frost.css", "dist/frost.min.css", "dist/utility-layer.css", "dist/component-layer.css"]) {
|
||||
if (!packedPaths.has(required)) throw new Error(`Tarball is missing required file ${required}`);
|
||||
}
|
||||
const forbidden = [...packedPaths].filter((path) => /^(?:examples|tests|\.gitea|node_modules)\//.test(path));
|
||||
if (forbidden.length) throw new Error(`Tarball contains repository-only files: ${forbidden.join(", ")}`);
|
||||
|
||||
await writeFile(join(temporaryRoot, "package.json"), `${JSON.stringify({ private: true, name: "frost-consumer-fixture", version: "1.0.0" }, null, 2)}\n`);
|
||||
await runNpm(["install", "--ignore-scripts", "--no-audit", "--no-fund", "--no-package-lock", tarball], { cwd: temporaryRoot });
|
||||
|
||||
const installedRoot = join(temporaryRoot, "node_modules", ...packageJson.name.split("/"));
|
||||
const installedPackage = JSON.parse(await readFile(join(installedRoot, "package.json"), "utf8"));
|
||||
if (installedPackage.version !== packageJson.version) throw new Error(`Installed version ${installedPackage.version} does not match ${packageJson.version}`);
|
||||
|
||||
const requireFromFixture = createRequire(join(temporaryRoot, "consumer.cjs"));
|
||||
for (const [exportPath, target] of Object.entries(packageJson.exports)) {
|
||||
const specifier = exportPath === "." ? packageJson.name : `${packageJson.name}${exportPath.slice(1)}`;
|
||||
const resolved = requireFromFixture.resolve(specifier);
|
||||
const expected = resolve(installedRoot, target);
|
||||
if (resolve(resolved) !== expected) throw new Error(`${specifier} resolved to ${resolved}, expected ${expected}`);
|
||||
const metadata = await stat(resolved);
|
||||
if (!metadata.isFile() || metadata.size === 0) throw new Error(`${specifier} resolved to an empty or non-file target`);
|
||||
}
|
||||
|
||||
const consumerCss = join(temporaryRoot, "consumer.css");
|
||||
await writeFile(consumerCss, `@import "${packageJson.name}";\n.consumer-smoke { color: var(--frost-color-text); }\n`);
|
||||
const bundledConsumer = await postcss([
|
||||
postcssImport({
|
||||
resolve: (specifier) => requireFromFixture.resolve(specifier),
|
||||
}),
|
||||
]).process(await readFile(consumerCss, "utf8"), { from: consumerCss });
|
||||
if (/@import\b/.test(bundledConsumer.css)) throw new Error("Bundled default export left unresolved CSS imports in the consumer build");
|
||||
for (const marker of [".frost-button", "@layer frost.forced-colors", "@media (forced-colors: active)", ".consumer-smoke"]) {
|
||||
if (!bundledConsumer.css.includes(marker)) throw new Error(`Bundled consumer output is missing ${marker}`);
|
||||
}
|
||||
|
||||
const tarballMetadata = await stat(tarball);
|
||||
console.log(`Installed ${basename(tarball)} (${tarballMetadata.size} bytes), resolved all ${Object.keys(packageJson.exports).length} exports, and bundled the default CSS from an isolated consumer.`);
|
||||
} finally {
|
||||
if (!resolve(temporaryRoot).startsWith(resolve(tmpdir()) + sep)) throw new Error("Refusing to remove a temporary directory outside the system temp root");
|
||||
await rm(temporaryRoot, { recursive: true, force: true });
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
import AxeBuilder from "@axe-core/playwright";
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
const openExample = async (page) => {
|
||||
await page.goto("/examples/index.html");
|
||||
await page.addStyleTag({ content: "html { scroll-behavior: auto !important; }" });
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
};
|
||||
|
||||
const formatViolations = (violations) => violations.map(({ help, helpUrl, id, impact, nodes }) => ({
|
||||
help,
|
||||
helpUrl,
|
||||
id,
|
||||
impact,
|
||||
targets: nodes.map((node) => node.target),
|
||||
}));
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await openExample(page);
|
||||
});
|
||||
|
||||
const visualCases = [
|
||||
{ id: "contrast-guide", name: "forced-colors guidance", target: ".catalog-contrast-guide" },
|
||||
{ id: "buttons", name: "buttons" },
|
||||
{ id: "forms", name: "form controls" },
|
||||
{ id: "surfaces", name: "surfaces and badges" },
|
||||
{ id: "feedback", name: "feedback" },
|
||||
{ id: "menus", name: "menus and tooltips", prepare: async (page) => {
|
||||
if (await page.locator("#example-menu").isHidden()) await page.locator("#menu-trigger").click();
|
||||
} },
|
||||
{ id: "navigation", name: "navigation" },
|
||||
{ id: "disclosure", name: "tabs and accordion" },
|
||||
{ id: "data", name: "data and status" },
|
||||
{ id: "modal", name: "modal", target: "#example-dialog .frost-modal__content", prepare: async (page) => {
|
||||
if (!await page.locator("#example-dialog").evaluate((dialog) => dialog.open)) await page.locator("#modal-trigger").click();
|
||||
} },
|
||||
];
|
||||
|
||||
for (const visualCase of visualCases) {
|
||||
test(`${visualCase.name} matches its component baselines`, async ({ page, browserName }) => {
|
||||
test.skip(browserName !== "chromium", "Pixel baselines are intentionally pinned to Chromium; other engines run behavioral and accessibility coverage.");
|
||||
await page.addStyleTag({ content: ".frost-skip-link { display: none !important; }" });
|
||||
for (const theme of ["light", "dark"]) {
|
||||
await page.locator("html").evaluate((element, selectedTheme) => {
|
||||
element.dataset.theme = selectedTheme;
|
||||
}, theme);
|
||||
await visualCase.prepare?.(page);
|
||||
const target = page.locator(visualCase.target ?? `#${visualCase.id}`);
|
||||
await expect(target).toHaveScreenshot(`component-${visualCase.id}-${theme}.png`);
|
||||
}
|
||||
});
|
||||
|
||||
test(`${visualCase.name} matches its forced-colors baseline`, async ({ page, browserName }) => {
|
||||
test.skip(browserName !== "chromium", "Forced-colors pixel baselines are intentionally pinned to Chromium.");
|
||||
await page.emulateMedia({ colorScheme: "light", forcedColors: "active" });
|
||||
await page.addStyleTag({ content: ".frost-skip-link { display: none !important; }" });
|
||||
await visualCase.prepare?.(page);
|
||||
const target = page.locator(visualCase.target ?? `#${visualCase.id}`);
|
||||
await expect(target).toHaveScreenshot(`component-${visualCase.id}-forced-colors.png`);
|
||||
});
|
||||
}
|
||||
|
||||
for (const theme of ["light", "dark"]) {
|
||||
test(`has no detectable WCAG A or AA violations in the ${theme} theme`, async ({ page }) => {
|
||||
await page.locator("html").evaluate((element, selectedTheme) => {
|
||||
element.dataset.theme = selectedTheme;
|
||||
}, theme);
|
||||
|
||||
const { violations } = await new AxeBuilder({ page })
|
||||
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"])
|
||||
.analyze();
|
||||
|
||||
expect(formatViolations(violations), "Axe accessibility violations").toEqual([]);
|
||||
});
|
||||
}
|
||||
|
||||
test("dropdown exposes state and closes with Escape", async ({ page }) => {
|
||||
const trigger = page.getByRole("button", { name: "Menü öffnen" });
|
||||
const menu = page.locator("#example-menu");
|
||||
|
||||
await trigger.click();
|
||||
await expect(trigger).toHaveAttribute("aria-expanded", "true");
|
||||
await expect(menu).toBeVisible();
|
||||
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(trigger).toHaveAttribute("aria-expanded", "false");
|
||||
await expect(menu).toBeHidden();
|
||||
await expect(trigger).toBeFocused();
|
||||
});
|
||||
|
||||
test("tabs support click and arrow-key navigation", async ({ page }) => {
|
||||
const overview = page.getByRole("tab", { name: "Übersicht" });
|
||||
const details = page.getByRole("tab", { name: "Details" });
|
||||
|
||||
await details.click();
|
||||
await expect(details).toHaveAttribute("aria-selected", "true");
|
||||
await expect(page.locator("#tab-panel-two")).toBeVisible();
|
||||
await expect(page.locator("#tab-panel-one")).toBeHidden();
|
||||
|
||||
await page.keyboard.press("ArrowLeft");
|
||||
await expect(overview).toBeFocused();
|
||||
await expect(overview).toHaveAttribute("aria-selected", "true");
|
||||
await expect(page.locator("#tab-panel-one")).toBeVisible();
|
||||
});
|
||||
|
||||
test("accordion keeps its control and panel state synchronized", async ({ page }) => {
|
||||
const trigger = page.getByRole("button", { name: "Was macht Frost?" });
|
||||
const panel = page.locator("#accordion-panel");
|
||||
|
||||
await trigger.click();
|
||||
await expect(trigger).toHaveAttribute("aria-expanded", "true");
|
||||
await expect(panel).toBeVisible();
|
||||
|
||||
await trigger.click();
|
||||
await expect(trigger).toHaveAttribute("aria-expanded", "false");
|
||||
await expect(panel).toBeHidden();
|
||||
});
|
||||
|
||||
test("catalog search filters components and navigation", async ({ page }) => {
|
||||
const search = page.locator("#component-search");
|
||||
|
||||
await search.fill("modal");
|
||||
await expect(page.locator("#modal")).toBeVisible();
|
||||
await expect(page.locator("#buttons")).toBeHidden();
|
||||
await expect(page.locator("#visible-count")).toHaveText("1 von 9 Gruppen");
|
||||
|
||||
await search.fill("unbekannt");
|
||||
await expect(page.locator("#catalog-empty")).toBeVisible();
|
||||
});
|
||||
|
||||
test("copy buttons expose the live HTML snippet", async ({ page }) => {
|
||||
const component = page.locator("#buttons");
|
||||
const code = component.locator("[data-snippet-code]");
|
||||
const copy = component.locator("[data-copy-html]");
|
||||
|
||||
await expect(code).toContainText("frost-button--primary");
|
||||
await copy.click();
|
||||
await expect(copy).toHaveText("Kopiert");
|
||||
await expect(page.locator("#copy-status")).toContainText("Buttons: HTML kopiert");
|
||||
});
|
||||
|
||||
test("modal restores focus to its trigger after closing", async ({ page }) => {
|
||||
const trigger = page.locator("#modal-trigger");
|
||||
const dialog = page.locator("#example-dialog");
|
||||
|
||||
await trigger.click();
|
||||
await expect(dialog).toBeVisible();
|
||||
await dialog.getByRole("button", { name: "Modal schließen" }).click();
|
||||
await expect(dialog).toBeHidden();
|
||||
await expect(trigger).toBeFocused();
|
||||
});
|
||||
|
||||
test("forced colors preserves system mappings and non-color state cues", async ({ page }) => {
|
||||
await page.emulateMedia({ colorScheme: "light", forcedColors: "active" });
|
||||
const supportsForcedColors = await page.evaluate(() => matchMedia("(forced-colors: active)").matches && CSS.supports("forced-color-adjust: none"));
|
||||
test.skip(!supportsForcedColors, "This browser engine does not expose forced-color-adjust with forced-colors emulation.");
|
||||
|
||||
const primary = page.locator("#buttons .frost-button--primary").first();
|
||||
const disabled = page.locator("#buttons .frost-button:disabled");
|
||||
const invalid = page.locator("#forms [aria-invalid='true']");
|
||||
const selectedTab = page.locator("#disclosure [role='tab'][aria-selected='true']");
|
||||
|
||||
await primary.focus();
|
||||
await expect(primary).toBeFocused();
|
||||
|
||||
const states = await page.evaluate(() => {
|
||||
const style = (selector) => getComputedStyle(document.querySelector(selector));
|
||||
const primaryStyle = style("#buttons .frost-button--primary");
|
||||
const disabledStyle = style("#buttons .frost-button:disabled");
|
||||
const invalidStyle = style("#forms [aria-invalid='true']");
|
||||
const selectedStyle = style("#disclosure [role='tab'][aria-selected='true']");
|
||||
const interactiveCardStyle = style("#surfaces .frost-card--interactive");
|
||||
return {
|
||||
primary: {
|
||||
forcedColorAdjust: primaryStyle.forcedColorAdjust,
|
||||
outlineStyle: primaryStyle.outlineStyle,
|
||||
outlineWidth: Number.parseFloat(primaryStyle.outlineWidth),
|
||||
},
|
||||
disabled: { opacity: disabledStyle.opacity },
|
||||
invalid: { borderStyle: invalidStyle.borderStyle, borderWidth: Number.parseFloat(invalidStyle.borderWidth) },
|
||||
selected: { borderStyle: selectedStyle.borderBottomStyle, borderWidth: Number.parseFloat(selectedStyle.borderBottomWidth) },
|
||||
card: { boxShadow: interactiveCardStyle.boxShadow },
|
||||
};
|
||||
});
|
||||
|
||||
expect(states.primary.forcedColorAdjust).toBe("none");
|
||||
expect(states.primary.outlineStyle).toBe("solid");
|
||||
expect(states.primary.outlineWidth).toBeGreaterThanOrEqual(3);
|
||||
expect(states.disabled.opacity).toBe("1");
|
||||
expect(states.invalid.borderStyle).toBe("dashed");
|
||||
expect(states.invalid.borderWidth).toBeGreaterThanOrEqual(2);
|
||||
expect(states.selected.borderStyle).toBe("solid");
|
||||
expect(states.selected.borderWidth).toBeGreaterThanOrEqual(3);
|
||||
expect(states.card.boxShadow).toBe("none");
|
||||
|
||||
await expect(disabled).toBeDisabled();
|
||||
await expect(invalid).toHaveAttribute("aria-invalid", "true");
|
||||
await expect(selectedTab).toHaveAttribute("aria-selected", "true");
|
||||
});
|
||||
|
||||
test("increased contrast strengthens component boundaries and states", async ({ page }) => {
|
||||
await page.emulateMedia({ colorScheme: "light", contrast: "more", forcedColors: "none" });
|
||||
const supportsIncreasedContrast = await page.evaluate(() => matchMedia("(prefers-contrast: more)").matches
|
||||
&& Number.parseFloat(getComputedStyle(document.querySelector("#buttons .frost-button--primary")).borderWidth) >= 2);
|
||||
test.skip(!supportsIncreasedContrast, "This browser engine does not expose prefers-contrast emulation.");
|
||||
|
||||
const states = await page.evaluate(() => {
|
||||
const style = (selector) => getComputedStyle(document.querySelector(selector));
|
||||
const buttonStyle = style("#buttons .frost-button--primary");
|
||||
const disabledStyle = style("#buttons .frost-button:disabled");
|
||||
const invalidStyle = style("#forms [aria-invalid='true']");
|
||||
const cardStyle = style("#surfaces .frost-card");
|
||||
const selectedStyle = style("#disclosure [role='tab'][aria-selected='true']");
|
||||
return {
|
||||
buttonBorderWidth: Number.parseFloat(buttonStyle.borderWidth),
|
||||
disabled: { borderStyle: disabledStyle.borderStyle, opacity: disabledStyle.opacity },
|
||||
invalidBorderStyle: invalidStyle.borderStyle,
|
||||
cardBorderWidth: Number.parseFloat(cardStyle.borderWidth),
|
||||
selectedBorderWidth: Number.parseFloat(selectedStyle.borderBottomWidth),
|
||||
};
|
||||
});
|
||||
|
||||
expect(states.buttonBorderWidth).toBeGreaterThanOrEqual(2);
|
||||
expect(states.disabled).toEqual({ borderStyle: "dotted", opacity: "1" });
|
||||
expect(states.invalidBorderStyle).toBe("dashed");
|
||||
expect(states.cardBorderWidth).toBeGreaterThanOrEqual(2);
|
||||
expect(states.selectedBorderWidth).toBeGreaterThanOrEqual(3);
|
||||
});
|
||||
|
||||
test("renders the framework smoke fixture", async ({ page, browserName }) => {
|
||||
const rendering = await page.evaluate(() => {
|
||||
const button = getComputedStyle(document.querySelector("#buttons .frost-button--primary"));
|
||||
const card = getComputedStyle(document.querySelector("#surfaces .frost-card"));
|
||||
const dialog = getComputedStyle(document.querySelector("#example-dialog"));
|
||||
return {
|
||||
buttonDisplay: button.display,
|
||||
buttonMinHeight: Number.parseFloat(button.minHeight),
|
||||
cardDisplay: card.display,
|
||||
cardBorderStyle: card.borderStyle,
|
||||
closedDialogDisplay: dialog.display,
|
||||
};
|
||||
});
|
||||
|
||||
expect(rendering, `${browserName} framework rendering`).toEqual({
|
||||
buttonDisplay: "flex",
|
||||
buttonMinHeight: 40,
|
||||
cardDisplay: "block",
|
||||
cardBorderStyle: "solid",
|
||||
closedDialogDisplay: "none",
|
||||
});
|
||||
});
|
||||
|
||||
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 80 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 47 KiB |