@filipgutica/design-system 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,20 +4,23 @@ Filip's design language for any framework: the spec, the tokens, the component c
4
4
 
5
5
  - **Agents** get `language/` at `~/design-language` through filip-stack host config.
6
6
  - **Vue apps** use [`@filipgutica/ui`](https://github.com/filipgutica/ui), which implements this design language.
7
- - **Pages:** the catalogue and example pages are at <https://filipgutica.github.io/design-system/components.html>.
7
+ - **Site:** <https://filipgutica.github.io/design-system/> has the Overview, Foundations, and Components pages, with `index.json` and `llms.txt` for agents.
8
8
 
9
9
  ## Contents
10
10
 
11
11
  | Path | What it holds |
12
12
  | --- | --- |
13
- | `language/` | The payload: `DESIGN.md`, `components.md`, `decisions.md`, `visualizations.md`, `tokens.css`, the catalogue (`components.html`), example pages, visualization helpers, and the Graphite Indigo editor theme |
14
- | `tokens/graphite-indigo.json` | The Graphite Indigo token values: the only place a value lives |
13
+ | `language/` | The payload: `DESIGN.md`, `components.md`, `decisions.md`, `visualizations.md`, `tokens.css`, the catalogue (`components.html`), `implementations.json` (each component's Vue and React version), example pages, visualization helpers, and the Graphite Indigo editor theme |
14
+ | `tokens/graphite-indigo.json` | The Graphite Indigo token values, the only place a value lives, and each token's role |
15
15
  | `scripts/build-tokens.mjs` | The token generator: writes `language/tokens.css` and `dist/` |
16
+ | `scripts/build-site.mjs` | The site build: writes `site/` for GitHub Pages from `components.html`, the tokens, and `package.json` |
16
17
  | `dist/` | Generated token files for the class flavour, theme overrides, JSON, and JavaScript |
17
18
  | `fonts/` | IBM Plex latin `woff2` files, `fonts.css`, and their OFL licences |
18
- | `tests/` | Guard tests for the payload and the tokens, the React smoke test, and the catalogue's behaviour tests |
19
+ | `tests/` | Guard tests for the payload, the tokens, and the site build, the React smoke test, and behaviour tests for the catalogue and the built site |
19
20
 
20
- To change a value, edit the JSON and run `pnpm tokens:build`. `pnpm tokens:check` fails when a generated file is stale.
21
+ To change a value, edit the JSON and run `pnpm tokens:build`. `pnpm tokens:check` fails when a generated file is stale or a token has no role.
22
+
23
+ `pnpm site:build` writes the site to `site/`. It reads the version from the latest `v*` tag, so it needs the tags in the checkout.
21
24
 
22
25
  ## Install
23
26
 
@@ -323,6 +323,15 @@
323
323
  .navlist a[aria-current="page"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
324
324
  .navlist a[aria-current="location"] { color: var(--color-text); font-weight: var(--weight-medium); }
325
325
  .navlist a[aria-current="location"]::before { content: ""; position: absolute; inset-inline-start: var(--space-1); width: 3px; height: 14px; border-radius: var(--radius-pill); background: var(--color-accent); }
326
+ /* Optical centring: a line box keeps room for descenders, so a label in a flex row sits about 1px above
327
+ centre. Where text-box is supported, a text-only row becomes a block that trims its line to the cap
328
+ height and centres it, and the pip centres itself. Block padding gives a wrapped label room above its
329
+ first cap and below its last descenders; a single line still centres in the min-height. Rows with an
330
+ icon or a count keep flex layout, and browsers without text-box keep today's rendering. */
331
+ @supports (text-box: trim-both cap alphabetic) {
332
+ .navlist a:not(:has(> *)) { display: block; align-content: center; padding-block: var(--space-2); text-box: trim-both cap alphabetic; }
333
+ .navlist a:not(:has(> *))[aria-current="location"]::before { inset-block: 0; margin-block: auto; }
334
+ }
326
335
  /* Inset: the rail and the drawer scroll. */
327
336
  .navlist a:is(:focus-visible, .is-focus) { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
328
337
  /* Phone trigger: a secondary button with a three-line menu glyph, because it opens a side drawer. */
@@ -381,6 +390,11 @@
381
390
  .crumbs a { display: inline-flex; align-items: center; min-height: var(--control-sm); border-radius: var(--radius-inline); color: var(--color-muted); text-decoration: none; }
382
391
  .crumbs a:is(:hover, .is-hover) { color: var(--color-text); text-decoration: underline; text-underline-offset: 0.2em; }
383
392
  .crumbs [aria-current="page"] { color: var(--color-text); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
393
+ /* Crumbs share the header row with the strip, so they centre on the cap height too. */
394
+ @supports (text-box: trim-both cap alphabetic) {
395
+ .crumbs a:not(:has(> *)) { display: block; align-content: center; padding-block: var(--space-2); text-box: trim-both cap alphabetic; }
396
+ .crumbs [aria-current="page"], .crumbs li + li::before { text-box: trim-both cap alphabetic; }
397
+ }
384
398
  /* Phones show only the parent, as a back link; .is-back pins that for the specimen. */
385
399
  .crumbs.is-back li:not(:nth-last-child(2)) { display: none; }
386
400
  .crumbs.is-back li::before { content: none; }
@@ -1674,22 +1688,28 @@
1674
1688
 
1675
1689
  // Find filters the rail only, never the page, so deep links and the page order stay stable. Every word
1676
1690
  // must appear in a row's terms. The count is announced after a pause.
1691
+ // A page that also filters its own content, such as a table of tokens, sets window.findScope before
1692
+ // the reader types: { filter(words) → { count, one, many }, keeps(link) → boolean }. Find then calls
1693
+ // filter on each change, keeps the rail links keeps() names, and announces the page's count and noun.
1677
1694
  let announce;
1678
1695
  const filter = () => {
1679
1696
  const query = find.value.trim().toLowerCase();
1680
1697
  const words = query.split(/\s+/).filter(Boolean);
1698
+ const scope = window.findScope;
1699
+ const result = scope?.filter(words);
1681
1700
  let shown = 0;
1682
1701
  links.forEach((a) => {
1683
- const match = words.every((w) => a.dataset.terms.includes(w));
1702
+ const match = scope ? scope.keeps(a) : words.every((w) => a.dataset.terms.includes(w));
1684
1703
  a.hidden = !match;
1685
1704
  if (match) shown += 1;
1686
1705
  });
1687
1706
  railGroups.forEach((g) => { g.hidden = !g.querySelector('a:not([hidden])'); });
1688
1707
  empty.hidden = shown > 0;
1689
1708
  empty.querySelector('q').textContent = find.value.trim();
1709
+ const { count, one, many } = result ?? { count: shown, one: 'match', many: 'matches' };
1690
1710
  clearTimeout(announce);
1691
1711
  announce = setTimeout(() => {
1692
- findCount.textContent = query ? (shown ? `${shown} ${shown === 1 ? 'match' : 'matches'}` : 'No matches') : '';
1712
+ findCount.textContent = query ? (count ? `${count} ${count === 1 ? one : many}` : `No ${many}`) : '';
1693
1713
  }, 500);
1694
1714
  };
1695
1715
  // Goes to a row's destination and focuses it. In the drawer the click closes it, and the drawer moves focus.
@@ -240,7 +240,7 @@ Layer: Core. ui: `UiDrawer`.
240
240
 
241
241
  Layer: Core. The mono font on rail rows is identity. ui: the rows in `UiSiteNav` and the project menu.
242
242
 
243
- - **Anatomy.** A `<nav>` with a name, holding links in rows: at least `--row` tall (`--control-lg` at tablet width), `0 --space-3` padding, `--radius-inline` corners, `--text-sm`, and `--color-muted`. A row may hold a leading 16px icon and a trailing muted count. Groups have a `--text-xs` semibold muted label and 2px gaps between rows.
243
+ - **Anatomy.** A `<nav>` with a name, holding links in rows: at least `--row` tall (`--control-lg` at tablet width), `0 --space-3` padding, `--radius-inline` corners, `--text-sm`, and `--color-muted`. A row may hold a leading 16px icon and a trailing muted count. A text-only row centres its label on the cap height: where `text-box` is supported, it is a block with `align-content: center`, `--space-2` block padding, and `text-box: trim-both cap alphabetic`, and the location pip centres itself. The padding keeps a wrapped label's first and last lines clear of the fill's edges and the focus ring. Rows with an icon or a count, and browsers without `text-box`, centre the line box, which leaves a label without descenders about 1px above centre. Groups have a `--text-xs` semibold muted label and 2px gaps between rows.
244
244
  - **Groups.** Name groups by purpose, with 2 to 8 rows each. Collapse groups only in a list of more than about 40 rows. A collapsible group's label is a `<button aria-expanded>` in the label type, with `--radius-inline` corners and a chevron that turns −90° when the group is closed. Never collapse the group that holds the current row.
245
245
  - **States.** Hover: `--color-row-hover` fill and `--color-text`. Current page (`aria-current="page"`): `--color-nav-current` fill, `--shadow-nav-current`, `--color-nav-current-text`, and medium weight; hover keeps that fill. `--color-nav-current` is an accent tint: `--color-accent` at 14% over `--color-surface-raised` in light, and `--color-accent` at 20% over transparent in dark. `--color-nav-current-text` is the first of `--color-accent`, `--color-text`, black, and white that reaches 4.5:1 over the tinted fill, both on the page and on a surface (composite a translucent fill over each first). Selected tabs and selected list rows use the same fill and rule. Current location in the page (`aria-current="location"`): `--color-text` in medium weight, with a 3×14 `--color-accent` pip at the leading edge, inset 4px, and no fill, in strips and contents lists. In a [section rail](#section-rail) the current section takes the current-page look instead and keeps `aria-current="location"`. A link carries one marker, and page outranks location; the [`aria-current` rules](DESIGN.md#navigation) say which applies, and the [tracking rule](DESIGN.md#navigation) says which section is current. Focus-visible: the focus ring, inset because the rail and the drawer scroll.
246
246
  - **Phone triggers.** Two triggers open a navigation drawer, and each has its place. The site shell uses the header's icon-only Menu button: at tablet width its [section rail](#section-rail) moves into that drawer. A page-level contents drawer, such as a docs page's "On this page", keeps a labelled trigger: a secondary button at `--control-lg` with a three-line menu glyph (14×10, 1.5px lines) before the label. A page with the site shell's Menu does not add a second, labelled trigger. Without JavaScript the list opens in place, so the trigger is a `<details>` summary with the secondary button classes and a chevron after the label. Only the chevron is local.
@@ -269,7 +269,7 @@ Layer: Core. ui: none yet.
269
269
  - **Use.** Filter a long navigation list, such as a section rail, by name or purpose. It filters the list only, never the page, so deep links and the page order stay stable.
270
270
  - **Anatomy.** An `<input type="search">` in the [field](#text-input-and-textarea) recipe, with a leading 16px search icon in `--color-muted` (32px start padding) and a trailing [keyboard key](#keyboard-key) hint showing `/` (36px end padding). A visually hidden `role="status"` element, named in the field's `aria-describedby`, holds the match count.
271
271
  - **States.** Rest, focus-visible (field focus), and a query. The key hint hides while the field has focus or a value, when shortcuts are off, and under `(hover: none)`. With no matches, the list shows "No component matches <q>…</q>." in `--text-sm` `--color-muted`, and a text-button Clear.
272
- - **Matching.** Every word of the query must appear in a row's terms: its name, group, purpose, and aliases, held in `data-terms`. Rows that do not match hide, and so do groups with no visible rows. The count is announced after a 500ms pause ("3 matches", "No matches").
272
+ - **Matching.** Every word of the query must appear in a row's terms: its name, group, purpose, and aliases, held in `data-terms`. Rows that do not match hide, and so do groups with no visible rows. The count is announced after a 500ms pause ("3 matches", "No matches"). A page whose Find also filters its own content, such as a token table, decides which rows stay and announces its own count and noun ("3 tokens", "No tokens").
273
273
  - **Keyboard and screen reader.** `/` focuses the field and selects its text, under the [single-key shortcut](DESIGN.md#navigation) rules; the field carries `aria-keyshortcuts="/"` while shortcuts are on. Escape clears a value; the next Escape leaves the field, or closes the drawer. Enter goes to the first match and focuses the destination. ArrowDown moves focus to the first match.
274
274
  - **No JavaScript.** The field is `hidden` until the script runs.
275
275
 
@@ -278,7 +278,7 @@ Layer: Core. ui: none yet.
278
278
  Layer: Core. ui: none yet.
279
279
 
280
280
  - **Use.** Only at depth 3 or more, or for a page outside its site's shell. Do not repeat the page `h1` as the only crumb.
281
- - **Anatomy.** `<nav aria-label="Breadcrumb">` holding an `<ol>` in `--text-sm`. Separators are a `--color-muted` `/` drawn with `content: "/" / ""`, so they are not read. Ancestors are `--color-muted` links with no underline, at least `--control-sm` tall (`--control-lg` at tablet width), with `--radius-inline` corners. The current page is plain text with `aria-current="page"`, in `--color-text` and medium weight. On folio sites the trail is mono (identity).
281
+ - **Anatomy.** `<nav aria-label="Breadcrumb">` holding an `<ol>` in `--text-sm`. Separators are a `--color-muted` `/` drawn with `content: "/" / ""`, so they are not read. The crumbs, separators included, centre on the cap height like navigation rows, so they line up with the header strip. Ancestors are `--color-muted` links with no underline, at least `--control-sm` tall (`--control-lg` at tablet width), with `--radius-inline` corners. The current page is plain text with `aria-current="page"`, in `--color-text` and medium weight. On folio sites the trail is mono (identity).
282
282
  - **States.** Hover: `--color-text` and an underline. Focus-visible: the focus ring.
283
283
  - **Phone.** At `max-width: 640px` only the parent shows, as a back link: "‹ Parent".
284
284
  - **Forced colors.** No change: links and text take the system colours.
@@ -21,6 +21,7 @@ Each entry records a choice this language made, the options it rejected, and why
21
21
  | Segmented label | Core | The selected label reads at 4.5:1 on its thumb, and an icon at 3:1 (`--color-segmented-current-text`): `--color-accent`, or the first of `--color-text`, black, and white that reads. | Accent at 3:1 for labels too, which let some hues' text fall below 4.5:1. |
22
22
  | Phone drawer trigger | Core | A page-level contents drawer opens from a soft secondary button with a three-line menu glyph and a label. The no-JavaScript fallback keeps a chevron, because it opens in place. The site shell opens its drawer from the header's icon-only Menu button instead (see Phone header). | A down chevron promised a dropdown, but the trigger opens a side drawer. |
23
23
  | Navigation row corners | Core | Navigation rows, header and strip rows, list-selection rows, collapsible group labels, and tabs take 6px corners (`--radius-inline`). The owner chose the more rectangular rows from the Gate M mockup (2026-11-09). | 10px (`--radius-field`), the previous corners, shared with fields. |
24
+ | Optical label centring | Core | A text-only navigation row and the breadcrumb centre their label on the cap height with `text-box: trim-both cap alphabetic`, inside `@supports`; a row becomes a block with `align-content: center` for it, and `--space-2` block padding keeps a wrapped label clear of its fill's edges. Browsers without `text-box` keep the flex centring of the line box. Buttons, tabs, and segmented options already centre their ink within 0.5px, so they are unchanged; Chromium does not trim a button's label in any case. | Centring the line box alone: it keeps descender room, so a label without descenders, such as "Overview", sat 1.25px above centre in the 44px header row (15.75px above the ink, 18.25px below). `text-box` on the flex row itself: Chromium trims only block containers, and the label's anonymous flex item does not inherit the trim. A fixed nudge in em: it depends on the font's metrics, which an identity can change. |
24
25
  | Rail current section | Core | In a section rail the current section takes the current-page look: `--color-nav-current` fill, `--shadow-nav-current`, and `--color-nav-current-text`, with no pip. It keeps `aria-current="location"`. Strips and contents lists keep the pip. In forced colors it takes the current page's 2px `Highlight` leading border. The owner chose it at Gate M, so the rail's place reads like the live site's current page. | The pip in the rail too, as in strips and contents lists: the owner preferred the rail to match the site's current-page look. |
25
26
  | Tab glide | Core | The selected tab's fill is a `::before` layer that glides between tabs like the segmented thumb: `glide-left` and `glide-right`, 260ms leading and 300ms trailing, with CSS `ease`. No glide on first render or under reduced motion, and no layer in forced colors. The owner chose it at Gate M. | The fill jumping from tab to tab, unlike the segmented control beside it. |
26
27
  | Segmented touch size | Core | At tablet width an unsized segmented control sets `--item` to `--control-lg`. | Growing only the buttons' `min-height`: `--item` stayed at `--control-md`, so icon-only options were 36×44 ovals (found at Gate M). |
@@ -19,6 +19,7 @@
19
19
  .navlist a[aria-current="page"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
20
20
  .navlist a[aria-current="location"] { color: var(--color-text); font-weight: var(--weight-medium); }
21
21
  .navlist a[aria-current="location"]::before { content: ""; position: absolute; inset-inline-start: var(--space-1); width: 3px; height: 14px; border-radius: var(--radius-pill); background: var(--color-accent); }
22
+ @supports (text-box: trim-both cap alphabetic) { .navlist a:not(:has(> *)) { display: block; align-content: center; padding-block: var(--space-2); text-box: trim-both cap alphabetic; } .navlist a:not(:has(> *))[aria-current="location"]::before { inset-block: 0; margin-block: auto; } }
22
23
  /* The sidebar is a section rail: components.html#section-rail, unchanged. Its current section takes the current-page look, with no pip. */
23
24
  :is(.rail, .rail-specimen) a[aria-current="location"] { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); }
24
25
  :is(.rail, .rail-specimen) a[aria-current="location"]::before { content: none; }
@@ -0,0 +1,85 @@
1
+ {
2
+ "vue": {
3
+ "button": {
4
+ "component": "UiButton",
5
+ "url": "https://filipgutica.github.io/ui/#/components/button"
6
+ },
7
+ "checkbox-and-radio": {
8
+ "component": "UiCheckbox",
9
+ "url": "https://filipgutica.github.io/ui/#/components/checkbox"
10
+ },
11
+ "radio-card-group": {
12
+ "component": "UiRadioCardGroup",
13
+ "url": "https://filipgutica.github.io/ui/#/components/radio-card-group"
14
+ },
15
+ "switch": {
16
+ "component": "UiSwitch",
17
+ "url": "https://filipgutica.github.io/ui/#/components/switch"
18
+ },
19
+ "toggle-button": {
20
+ "component": "UiToggleButton",
21
+ "url": "https://filipgutica.github.io/ui/#/components/toggle-button"
22
+ },
23
+ "segmented-control": {
24
+ "component": "UiSegmentedControl",
25
+ "url": "https://filipgutica.github.io/ui/#/components/segmented-control"
26
+ },
27
+ "text-input-and-textarea": {
28
+ "component": "UiInput",
29
+ "url": "https://filipgutica.github.io/ui/#/components/input"
30
+ },
31
+ "select": {
32
+ "component": "UiSelect",
33
+ "url": "https://filipgutica.github.io/ui/#/components/select"
34
+ },
35
+ "field-wrapper": {
36
+ "component": "UiField",
37
+ "url": "https://filipgutica.github.io/ui/#/components/field"
38
+ },
39
+ "slider": {
40
+ "component": "UiSlider",
41
+ "url": "https://filipgutica.github.io/ui/#/components/slider"
42
+ },
43
+ "progress": {
44
+ "component": "UiProgress",
45
+ "url": "https://filipgutica.github.io/ui/#/components/progress"
46
+ },
47
+ "score": {
48
+ "component": "UiScore",
49
+ "url": "https://filipgutica.github.io/ui/#/components/score"
50
+ },
51
+ "tabs": {
52
+ "component": "UiTabs",
53
+ "url": "https://filipgutica.github.io/ui/#/components/tabs"
54
+ },
55
+ "badge": {
56
+ "component": "UiBadge",
57
+ "url": "https://filipgutica.github.io/ui/#/components/badge"
58
+ },
59
+ "alert": {
60
+ "component": "UiAlert",
61
+ "url": "https://filipgutica.github.io/ui/#/components/alert"
62
+ },
63
+ "surface-and-card": {
64
+ "component": "UiCard",
65
+ "url": "https://filipgutica.github.io/ui/#/components/card"
66
+ },
67
+ "figure": {
68
+ "component": "UiFigure",
69
+ "url": "https://filipgutica.github.io/ui/#/components/figure"
70
+ },
71
+ "dialog": {
72
+ "component": "UiDialog",
73
+ "url": "https://filipgutica.github.io/ui/#/components/dialog"
74
+ },
75
+ "drawer": {
76
+ "component": "UiDrawer",
77
+ "url": "https://filipgutica.github.io/ui/#/components/drawer"
78
+ },
79
+ "code-block": {
80
+ "component": "UiCodeBlock",
81
+ "url": "https://filipgutica.github.io/ui/#/components/code-block"
82
+ }
83
+ },
84
+ "react": {}
85
+ }
@@ -25,6 +25,10 @@
25
25
  .navlist a[aria-current="page"], .nav-current-sample { background: var(--color-nav-current); box-shadow: var(--shadow-nav-current); color: var(--color-nav-current-text); font-weight: var(--weight-medium); }
26
26
  .navlist a[aria-current="location"], .pip-sample { color: var(--color-text); font-weight: var(--weight-medium); }
27
27
  .navlist a[aria-current="location"]::before, .pip-sample::before { content: ""; position: absolute; inset-inline-start: var(--space-1); width: 3px; height: 14px; border-radius: var(--radius-pill); background: var(--color-accent); }
28
+ @supports (text-box: trim-both cap alphabetic) {
29
+ .navlist a:not(:has(> *)) { display: block; align-content: center; padding-block: var(--space-2); text-box: trim-both cap alphabetic; }
30
+ .navlist a:not(:has(> *))[aria-current="location"]::before { inset-block: 0; margin-block: auto; }
31
+ }
28
32
  /* Inset: the rail and the drawer scroll. */
29
33
  .navlist a:is(:focus-visible, .is-focus) { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
30
34
  /* Fills and shadows drop. The current page takes a system border; the in-page location keeps
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@filipgutica/design-system",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Filip's design language, tokens, and component catalogue for any framework",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -35,7 +35,9 @@
35
35
  "test": "node --test tests/*.test.mjs",
36
36
  "test:react": "tsc -p tests/react-smoke && playwright test -c tests/react-smoke",
37
37
  "test:catalogue": "tsc -p tests/catalogue && playwright test -c tests/catalogue",
38
- "verify": "pnpm tokens:check && pnpm test && pnpm test:react && pnpm test:catalogue && pnpm pack --dry-run && publint"
38
+ "site:build": "node scripts/build-site.mjs",
39
+ "test:site": "pnpm site:build && tsc -p tests/site && playwright test -c tests/site",
40
+ "verify": "pnpm tokens:check && pnpm test && pnpm test:react && pnpm test:catalogue && pnpm test:site && pnpm pack --dry-run && publint"
39
41
  },
40
42
  "engines": {
41
43
  "node": ">=22.12"