@reqvire-org/ads 0.3.45 → 0.3.46

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.
Files changed (98) hide show
  1. package/README.md +3 -1
  2. package/dist/a11y.mjs +100 -0
  3. package/dist/assets.mjs +25 -1
  4. package/dist/capture/worker.mjs +1 -1
  5. package/dist/capture-store.mjs +2 -1
  6. package/dist/capture.mjs +5 -2
  7. package/dist/check.mjs +2 -1
  8. package/dist/cli.mjs +12 -0
  9. package/dist/config.mjs +3 -0
  10. package/dist/contracts/tokens.json +1 -1
  11. package/dist/design-values.mjs +8 -2
  12. package/dist/foundation.mjs +3 -0
  13. package/dist/mcp/apps.mjs +1 -1
  14. package/dist/mcp/preview-widget.bundle.js +19 -13
  15. package/dist/mcp/project-widget.bundle.js +25 -25
  16. package/dist/mcp/server.mjs +3 -1
  17. package/dist/mcp/widget.bundle.js +15 -15
  18. package/dist/preview-resources.mjs +1 -1
  19. package/dist/showcase/client.bundle.js +25 -25
  20. package/dist/showcase/index.html +1 -1
  21. package/dist/skills/ads-break-ui/references/captures.md +3 -2
  22. package/dist/skills/ads-break-ui/references/design-data.md +89 -0
  23. package/dist/skills/ads-designer/SKILL.md +13 -3
  24. package/dist/skills/ads-designer/references/accessibility.md +43 -0
  25. package/dist/skills/ads-designer/references/branding.md +28 -0
  26. package/dist/skills/ads-designer/references/captures.md +3 -2
  27. package/dist/skills/ads-designer/references/design-data.md +89 -0
  28. package/dist/skills/ads-import/references/captures.md +3 -2
  29. package/dist/skills/ads-import/references/design-data.md +89 -0
  30. package/dist/skills/ads-motion/references/build.md +33 -0
  31. package/dist/skills/ads-motion/references/captures.md +3 -2
  32. package/dist/skills/ads-motion/references/design-data.md +89 -0
  33. package/dist/skills/ads-motion/references/motion-review.md +2 -2
  34. package/dist/skills/ads-port/references/captures.md +3 -2
  35. package/dist/skills/ads-port/references/design-data.md +89 -0
  36. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +76 -0
  37. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +10 -1
  38. package/dist/starters/preact/ds.config.json +13 -1
  39. package/dist/starters/react/README.md +54 -7
  40. package/dist/starters/react/design-system/assets/glyphs/README.md +12 -0
  41. package/dist/starters/react/design-system/assets/glyphs/aliases.json +1 -0
  42. package/dist/starters/react/design-system/assets/glyphs/check.svg +1 -0
  43. package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +1 -0
  44. package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +1 -0
  45. package/dist/starters/react/design-system/assets/glyphs/close.svg +1 -0
  46. package/dist/starters/react/design-system/assets/glyphs/external-link.svg +1 -0
  47. package/dist/starters/react/design-system/assets/glyphs/info.svg +1 -0
  48. package/dist/starters/react/design-system/assets/glyphs/menu.svg +1 -0
  49. package/dist/starters/react/design-system/assets/glyphs/plus.svg +1 -0
  50. package/dist/starters/react/design-system/assets/glyphs/search.svg +1 -0
  51. package/dist/starters/react/design-system/assets/glyphs/warning.svg +1 -0
  52. package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +11 -4
  53. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +9 -0
  54. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +16 -0
  55. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +44 -0
  56. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +14 -0
  57. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +1 -0
  58. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +15 -0
  59. package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +42 -0
  60. package/dist/starters/react/design-system/components/Content/Icon/README.md +16 -0
  61. package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +17 -0
  62. package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +9 -5
  63. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +12 -0
  64. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +17 -0
  65. package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +75 -0
  66. package/dist/starters/react/design-system/components/Layout/Grid/README.md +21 -0
  67. package/dist/starters/react/design-system/index.ts +3 -0
  68. package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +18 -0
  69. package/dist/starters/react/design-system/review/index.ts +1 -0
  70. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +10 -1
  71. package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +114 -8
  72. package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +23 -0
  73. package/dist/starters/react/design-system/tokens/{SpaceTypeMotion.ads.scenario.tsx → Layout.ads.scenario.tsx} +1 -1
  74. package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +18 -0
  75. package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +4 -0
  76. package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +30 -0
  77. package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +4 -0
  78. package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +37 -0
  79. package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +4 -0
  80. package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +29 -0
  81. package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +4 -0
  82. package/dist/starters/react/design-system/tokens/base.css +6 -3
  83. package/dist/starters/react/design-system/tokens/colors.css +220 -26
  84. package/dist/starters/react/design-system/tokens/elevation.css +51 -6
  85. package/dist/starters/react/design-system/tokens/spacing.css +67 -3
  86. package/dist/starters/react/design-system/tokens/typography.css +25 -7
  87. package/dist/starters/react/ds.config.json +13 -1
  88. package/dist/themes.mjs +106 -0
  89. package/dist/token-export.mjs +58 -0
  90. package/dist/token-quality.mjs +109 -0
  91. package/dist/tokens.mjs +9 -2
  92. package/docs/ADS.md +34 -5
  93. package/docs/ARCHITECTURE.md +49 -4
  94. package/docs/CHANGELOG.md +64 -12
  95. package/docs/GUIDE.md +31 -3
  96. package/docs/MCP.md +13 -4
  97. package/package.json +1 -1
  98. package/dist/starters/react/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
@@ -89,3 +89,92 @@ sample coverage in the shared directory. Preserve themes, units, public APIs and
89
89
  behavior unless changing the visual policy was explicitly intended. Review a Git
90
90
  diff and run core, project and browser checks. There is no compatibility mode that
91
91
  keeps independent component token definitions valid.
92
+
93
+ ## Accessibility and rhythm reviews
94
+
95
+ `ads check` reviews token values, in every theme (each `:root[data-theme=…]` scope,
96
+ resolving `var()` aliases there):
97
+
98
+ - `token-contrast` warns when the roles that meet on screen fall below WCAG 2.2 AA:
99
+ `--text-strong`, `--text-body`, `--text-muted`, `--text-link` and `--accent-text` on
100
+ `--bg-canvas`, `--bg-surface` and `--bg-hover`; `--accent-fg` on `--accent` and
101
+ `--accent-hover`; each status's `-fg` on its solid and `-text` on its `-bg` (4.5:1);
102
+ `--border-focus` and `--border-strong` on the canvas and surface (3:1). Pairs whose
103
+ tokens a project does not define are not reviewed; colors outside hex, rgb() and hsl()
104
+ are skipped.
105
+ - `token-rhythm` warns when a numbered spacing step leaves the scale `--space-N` = N × 2 px.
106
+ - `token-overlap-review` compares values only within a token family (`--radius-*` with
107
+ `--radius-*`): a radius equal to a spacing step is two scales meeting, not a duplicate.
108
+
109
+ Fix a contrast warning by choosing a different ramp step for the role, in the theme the
110
+ message names, rather than adding a one-off color.
111
+
112
+ ## Exchange format
113
+
114
+ `ads tokens --format dtcg` prints the tokens as W3C Design Tokens (Community Group draft)
115
+ JSON: groups by family, typed `$value`s, `{group.token}` references for `var()` aliases.
116
+ Values the format cannot express (fluid `clamp()` sizes, layered shadows) keep their CSS in
117
+ `$extensions["org.reqvire.ads"].css`; other themes' values are in
118
+ `$extensions["org.reqvire.ads"].scopes`.
119
+
120
+ ## Grid
121
+
122
+ The `--grid-*` tokens describe a column grid: `--grid-columns-sm/md/lg` (the starter's 4, 8
123
+ and 16), `--grid-gutter`, `--grid-gutter-narrow`, `--grid-gutter-condensed` and
124
+ `--grid-margin-sm/md/lg`, aliasing spacing steps. The starter's `Grid` switches columns by
125
+ container width (768 and 1024 px) with container queries, since CSS variables cannot be
126
+ breakpoints. The showcase's grid overlay draws these tokens over every preview at the same
127
+ widths; a project without them shows no overlay. Align text to a cell's edge, not its gutter.
128
+
129
+ ## Color roles and states
130
+
131
+ Name roles by element and purpose, the same in every theme; only their values change. Point roles at ramp steps rather than raw colors, so a theme is a ramp swap:
132
+
133
+ - Layers: `--bg-canvas` → `--bg-surface` → `--bg-raised` (menus, popovers), with `--bg-field`
134
+ for inputs. In dark themes each layer up is one step lighter; in light themes surfaces stay
135
+ near white.
136
+ - States move along the ramp: hover one step, pressed or active two, selected a subtle accent
137
+ step (`--bg-selected`). Solid fills hover one step darker (`--accent-hover`).
138
+ - Disabled is always neutral (`--bg-disabled`, `--text-disabled`, `--border-disabled`) with no
139
+ hover or focus response; WCAG exempts it from contrast, so `token-contrast` skips it.
140
+ - `--bg-overlay` is the translucent scrim behind modals; `--bg-skeleton` fills loading
141
+ placeholders.
142
+ - Never signal state or status by color alone: pair it with text, an icon or a shape.
143
+
144
+ ## Themes
145
+
146
+ Declare themes in `ds.config.json` (`themes: [{ name, scheme }]`, the first is the default).
147
+ A theme changes values, never names: give the default theme's values on `:root`, override
148
+ them under `[data-theme="<name>"]`, and keep roles aliasing ramp steps on
149
+ `:root, [data-theme]` so they re-resolve wherever a theme applies. Override a whole ramp in a
150
+ theme, not a few steps.
151
+
152
+ - `data-theme` on `<html>` themes the page; on any element it themes one section (a dark
153
+ hero in a light page). A themed section paints its own canvas and text (`base.css`).
154
+ - `scheme` sets `color-scheme`, so native controls and scrollbars match the theme.
155
+ - Add a theme for a real need: high contrast, a dimmed reading mode, a brand. Check it in the
156
+ showcase (the theme button steps through declared themes) and capture it by name.
157
+ - Runtime switching (user choice, `prefers-color-scheme`, remembering it) is application code.
158
+
159
+ ## Spacing
160
+
161
+ `--space-N` is N × 2 px, from 2 to 160 px; the same values hold at every screen size, and a
162
+ layout steps down one or two sizes at narrow widths instead of scaling. Use the scale for
163
+ padding inside components and for gaps between them; a value off the scale needs a reason.
164
+
165
+ - Distance says how related things are: closer means more related. Group with space before
166
+ reaching for dividers, borders or cards.
167
+ - More space around an element gives it more importance. Sections can be dense, but leave the
168
+ page as a whole room to breathe.
169
+ - Parents own the space between their children (`gap`, stack tokens); a component carries no
170
+ outer margin, so it fits wherever it is placed.
171
+ - Horizontal layout follows the column grid; percentages are fine for splitting a region and
172
+ for minimum and maximum widths.
173
+
174
+ ## Motion tokens
175
+
176
+ Six durations (`--dur-instant` 70 ms, `--dur-fast` 110, `--dur-moderate` 150, `--dur-normal`
177
+ 240, `--dur-slow` 400, `--dur-slower` 700) and three curve pairs (standard, enter and exit, each everyday and
178
+ `-strong`). Every duration is 0 under `prefers-reduced-motion`. Pick by purpose, not by
179
+ number: the ads-motion skill's build guide maps each token to its use and gives the easing
180
+ rules.
@@ -0,0 +1,76 @@
1
+ import { useLayoutEffect, useRef } from "preact/hooks";
2
+ import type { ComponentChildren } from "preact";
3
+ import { css, cx } from "@linaria/atomic";
4
+
5
+ export interface GridProps {
6
+ /** `wide` 32 px gutters (default), `narrow` 16 px, `condensed` 1 px for tightly related content. */
7
+ gutter?: "wide" | "narrow" | "condensed";
8
+ children?: ComponentChildren;
9
+ }
10
+ export interface GridItemProps {
11
+ /** Columns to span at each container size (of 4, 8 and 16). A size left out spans the full row. */
12
+ span?: { sm?: number; md?: number; lg?: number };
13
+ children?: ComponentChildren;
14
+ }
15
+
16
+ // The grid follows its container, not the window: it sits in any pane at the right columns.
17
+ const container = css`
18
+ container-type: inline-size;
19
+ width: 100%;
20
+ `;
21
+ const grid = css`
22
+ display: grid;
23
+ grid-template-columns: repeat(var(--grid-columns-sm), minmax(0, 1fr));
24
+ padding-inline: var(--grid-margin-sm);
25
+ @container (min-width: 768px) {
26
+ grid-template-columns: repeat(var(--grid-columns-md), minmax(0, 1fr));
27
+ padding-inline: var(--grid-margin-md);
28
+ }
29
+ @container (min-width: 1024px) {
30
+ grid-template-columns: repeat(var(--grid-columns-lg), minmax(0, 1fr));
31
+ }
32
+ @container (min-width: 1280px) {
33
+ padding-inline: var(--grid-margin-lg);
34
+ }
35
+ `;
36
+ const gutters = {
37
+ wide: css`gap: var(--grid-gutter);`,
38
+ narrow: css`gap: var(--grid-gutter-narrow);`,
39
+ condensed: css`gap: var(--grid-gutter-condensed);`,
40
+ };
41
+ const item = css`
42
+ min-width: 0;
43
+ grid-column: span var(--ds-grid-span-sm, var(--grid-columns-sm));
44
+ @container (min-width: 768px) {
45
+ grid-column: span var(--ds-grid-span-md, var(--grid-columns-md));
46
+ }
47
+ @container (min-width: 1024px) {
48
+ grid-column: span var(--ds-grid-span-lg, var(--grid-columns-lg));
49
+ }
50
+ `;
51
+
52
+ /** A column grid: 4, 8 or 16 columns by its container's width, with spacing-scale gutters. */
53
+ export function Grid({ gutter = "wide", children }: GridProps) {
54
+ return (
55
+ <div className={cx("ds-grid", container)}>
56
+ <div className={cx(grid, gutters[gutter])}>{children}</div>
57
+ </div>
58
+ );
59
+ }
60
+
61
+ /** One cell of a `Grid`, spanning some of its columns at each size. */
62
+ export function GridItem({ span, children }: GridItemProps) {
63
+ const ref = useRef<HTMLDivElement>(null);
64
+ useLayoutEffect(() => {
65
+ const element = ref.current;
66
+ if (!element) return;
67
+ // Each size names its own variable: ADS allows only declared, literal style writes.
68
+ if (span?.sm) element.style.setProperty("--ds-grid-span-sm", String(span.sm));
69
+ else element.style.removeProperty("--ds-grid-span-sm");
70
+ if (span?.md) element.style.setProperty("--ds-grid-span-md", String(span.md));
71
+ else element.style.removeProperty("--ds-grid-span-md");
72
+ if (span?.lg) element.style.setProperty("--ds-grid-span-lg", String(span.lg));
73
+ else element.style.removeProperty("--ds-grid-span-lg");
74
+ }, [span?.sm, span?.md, span?.lg]);
75
+ return <div ref={ref} className={cx("ds-grid__item", item)}>{children}</div>;
76
+ }
@@ -47,6 +47,7 @@ const sampleStyle = css`
47
47
  &[data-ads-property="color"] { color: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
48
48
  &[data-ads-property="width"] {
49
49
  width: var(--ux-token-preview-value);
50
+ max-width: 100%;
50
51
  min-height: var(--space-8);
51
52
  background: var(--accent);
52
53
  }
@@ -59,6 +60,14 @@ const sampleStyle = css`
59
60
  &[data-ads-property="font-size"] { font-size: var(--ux-token-preview-value); }
60
61
  &[data-ads-property="font-weight"] { font-weight: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
61
62
  &[data-ads-property="line-height"] { line-height: var(--ux-token-preview-value); }
63
+ &[data-ads-property="column-count"] { column-count: var(--ux-token-preview-value); column-gap: var(--space-2); column-rule: var(--border-w) solid var(--border-strong); }
64
+ &[data-ads-property="letter-spacing"] { letter-spacing: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 1.5); }
65
+ &[data-ads-property="height"] {
66
+ height: var(--ux-token-preview-value);
67
+ width: calc(var(--space-16) * 2);
68
+ border-radius: var(--radius-md);
69
+ background: var(--accent);
70
+ }
62
71
  &[data-ads-property="box-shadow"] {
63
72
  border-radius: var(--radius-md);
64
73
  background: var(--bg-surface);
@@ -100,7 +109,7 @@ function TokenTile({ sample, text }: { sample: TokenSample; text: string }) {
100
109
  return (
101
110
  <article className={cx("ux-token-preview__item", tile)}>
102
111
  <span ref={ref} className={cx("ux-token-preview__sample", sampleStyle)} data-ads-token={sample.token} data-ads-property={sample.property}>
103
- {["background-color", "width", "border-radius", "box-shadow", "animation-duration", "animation-timing-function"].includes(sample.property) ? "" : text}
112
+ {["background-color", "width", "height", "border-radius", "box-shadow", "animation-duration", "animation-timing-function"].includes(sample.property) ? "" : text}
104
113
  </span>
105
114
  <code className={cx("ux-token-preview__name", label)}>{sample.token}</code>
106
115
  <small className={label}>{value}</small>
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "framework": "preact",
3
+ "themes": [{ "name": "light", "scheme": "light" }, { "name": "dark", "scheme": "dark" }],
3
4
  "behaviorLibraries": [],
4
5
  "acceptance": { "checks": [], "behaviorChecks": false },
5
6
  "validation": { "checks": [], "behaviorChecks": true, "inputs": [] },
@@ -8,6 +9,10 @@
8
9
  },
9
10
  "boundaries": {
10
11
  "styleWrites": [
12
+ {
13
+ "file": "design-system/components/Layout/Grid/Grid.tsx",
14
+ "properties": ["--ds-grid-span-sm", "--ds-grid-span-md", "--ds-grid-span-lg"]
15
+ },
11
16
  {
12
17
  "file": "design-system/review/token-preview/TokenPreview.tsx",
13
18
  "properties": [
@@ -16,5 +21,12 @@
16
21
  }
17
22
  ]
18
23
  },
19
- "assets": { "iconSource": "assets/brand/app-icon.svg" }
24
+ "assets": {
25
+ "iconSource": "assets/brand/app-icon.svg",
26
+ "glyphs": {
27
+ "source": "assets/glyphs",
28
+ "output": "components/Content/Icon/glyphs.ts",
29
+ "attributes": { "fill": "none", "stroke": "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }
30
+ }
31
+ }
20
32
  }
@@ -2,10 +2,11 @@
2
2
 
3
3
  This private React or Preact TypeScript workspace contains semantic CSS tokens, a project-owned
4
4
  token review renderer, a public barrel, Linaria extraction and a preview compiler
5
- adapter, plus one example of each layer to build on: two token groups (Color; Space, type &
6
- motion), Brand previews in two groups (`brand/Identity/Logo`, `brand/Icons/AppIcon`),
7
- components in three groups (`components/Actions/Button`,
8
- `components/Content/Logo`, `components/Forms/TextField`), one pattern
5
+ adapter, plus one example of each layer to build on: a token foundation in six groups (Color, Type, Space & sizing, Shape & elevation, Motion, Layout), Brand previews in two groups (`brand/Identity/Logo`, `brand/Icons/AppIcon`),
6
+ components in four groups (`components/Actions/Button`, `components/Actions/IconButton`,
7
+ `components/Content/Icon`, `components/Content/Logo`, `components/Forms/TextField`,
8
+ `components/Layout/Grid`), a 24 px icon set in `assets/glyphs/` generated into
9
+ `components/Content/Icon/glyphs.ts`, one pattern
9
10
  (`patterns/Search/SearchBar`) and one composition (`composition/Search/SearchPage`),
10
11
  plus placeholder brand artwork in `assets/brand/` (a logo with its dark-theme
11
12
  variant, and the app icon that `assets.iconSource` names). Rename, restyle or
@@ -61,9 +62,55 @@ Its MCP client discovers entries, invokes preview tools and follows notification
61
62
  There are no required TokensPage/ComponentsPage/PatternsPage/CompositionPage
62
63
  files, and no separate project browser app to implement or rebuild.
63
64
 
64
- The `tokens/Color.ads.scenario.tsx` and `tokens/SpaceTypeMotion.ads.scenario.tsx`
65
- groups and their colocated fixtures visually demonstrate all starter token values,
66
- one tile per token with its current value. The fixture owns `{ token, property, probe }` bindings;
65
+ ## Tokens
66
+
67
+ The foundation meets WCAG 2.2 AA:
68
+
69
+ - **Color** (`colors.css`): six 12-step ramps (`--slate-*`, `--color-accent-*`,
70
+ `--color-green|amber|red|blue-*`); each step has one job: 1–2 backgrounds, 3–5 component
71
+ rest/hover/pressed, 6–8 borders, 9–10 solid fills, 11–12 text. The dark theme redefines
72
+ the ramps under the same names. Semantic roles (`--bg-*`, `--text-*`, `--border-*`,
73
+ `--accent*`, `--success|warning|danger|info*`) alias ramp steps; text pairs reach 4.5:1
74
+ and focus and strong borders 3:1 in both themes. Layers go canvas → surface → raised,
75
+ each a step lighter in dark; inputs use `--bg-field`; `--bg-overlay` is the modal scrim and
76
+ `--bg-skeleton` the loading fill. Disabled roles (`--bg-|--text-|--border-disabled`) are
77
+ neutral for every variant and exempt from contrast. States move along a ramp: hover one
78
+ step, pressed two, selected the accent's step 3.
79
+ - **Type** (`typography.css`): a 16 px body on a modular ladder `--text-xs`…`--text-5xl`,
80
+ fluid from `3xl`; line height tightens as size grows (`--leading-*`), letter spacing turns
81
+ negative for display (`--tracking-*`); weights 400–700.
82
+ - **Space & sizing** (`spacing.css`): one rhythm, `--space-N` = N × 2 px from 0 to 160 px.
83
+ Use 0–8 px inside components, 12–24 px between related elements, 32–80 px between
84
+ sections and 96–160 px around hero and page sections; values do not change by screen
85
+ size, step down at narrow widths. Stack and prose-flow gaps, control heights 32/40/48 px
86
+ with padding, icons 16/20/24/32 px.
87
+ - **Shape & elevation**: radius `--radius-xs`…`--radius-2xl` and `--radius-full`, border
88
+ and focus widths, layered shadows `--shadow-xs`…`--shadow-xl` (stronger in dark), and
89
+ fixed stacking layers `--z-*`.
90
+ - **Themes**: light (default) and dark, declared in `ds.config.json`. Light ramps sit on
91
+ `:root, [data-theme="light"]`, roles on `:root, [data-theme]` and dark ramps on
92
+ `[data-theme="dark"]`, so `data-theme` themes the page on `<html>` or one section on any
93
+ element.
94
+ - **Motion** (`elevation.css`): durations 70/110/150/240/400/700 ms, easing for moving between
95
+ places (standard), entering and leaving, each with a `-strong` variant for rare important
96
+ moments; all durations are 0 under reduced motion.
97
+ - **Layout**: a column grid (`--grid-columns-sm/md/lg` = 4/8/16 columns from 0,
98
+ 768 and 1024 px of container width; gutters 32/16/1 px for wide, narrow and condensed;
99
+ margins 0/16/24 px), `--content-max` (72ch), container widths `--container-*`, header,
100
+ side pane and rail. Breakpoints cannot be CSS variables: use 640, 768, 1024 and 1280 px
101
+ in media queries, or container queries as `components/Layout/Grid` does.
102
+
103
+ `components/Layout/Grid` (`Grid`, `GridItem`) lays content on that grid by container width,
104
+ so it fits any pane. The showcase's grid button draws the project's grid over every
105
+ preview to check alignment.
106
+
107
+ `ads check` warns when a text or control pair falls below WCAG AA in any theme
108
+ (`token-contrast`) and when a spacing step leaves the 2 px rhythm (`token-rhythm`).
109
+ `ads tokens --format dtcg` exports the tokens as W3C Design Tokens JSON for design tools.
110
+
111
+ The six token scenarios (`tokens/Color`, `Type`, `Space`, `Shape`, `Motion`, `Layout`)
112
+ and their colocated fixtures visually demonstrate every token value, one tile per token
113
+ with its current value. The fixture owns `{ token, property, probe }` bindings;
67
114
  the development-only `TokenPreview` renderer, exported through `@ds/review`, owns their presentation and applies the real CSS
68
115
  variables. Add/remove samples alongside token definitions. `ads check` rejects
69
116
  missing coverage and invented names; the App verifies the declared CSS bindings
@@ -0,0 +1,12 @@
1
+ # Glyphs
2
+
3
+ The UI icon set: one 24 × 24 stroke drawing per file, colored by `currentColor` so an icon
4
+ takes the color of the text beside it. `ads assets` turns them into
5
+ `components/Content/Icon/glyphs.ts` (`assets.glyphs` in `ds.config.json`), adding
6
+ `fill="none"`, a 2 px stroke and round caps where a file does not set them. `aliases.json`
7
+ gives extra names to existing glyphs.
8
+
9
+ Keep every glyph on the same 24 × 24 `viewBox` and never set a fill or stroke color in the
10
+ file: `ads check` warns about both (`glyph-viewbox`, `glyph-color`).
11
+
12
+ License: drawn for the ADS starter, free to use, change or remove (MIT, like ADS).
@@ -0,0 +1 @@
1
+ { "x": "close", "add": "plus" }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m6 9 6 6 6-6"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18 6 6 18M6 6l12 12"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 16v-5M12 8h.01"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6h16M4 12h16M4 18h16"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 5v14M5 12h14"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m20 20-4.35-4.35"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 3 2 20h20L12 3Z"/><path d="M12 10v4M12 17h.01"/></svg>
@@ -13,17 +13,24 @@ const base = css`
13
13
  display: inline-flex;
14
14
  align-items: center;
15
15
  justify-content: center;
16
- padding-block: var(--space-4);
17
- padding-inline: var(--space-8);
16
+ min-height: var(--control-height-md);
17
+ padding-inline: var(--control-padding-md);
18
18
  border-width: var(--border-w);
19
19
  border-style: solid;
20
20
  border-color: transparent;
21
21
  border-radius: var(--radius-md);
22
22
  font-size: var(--text-base);
23
23
  font-weight: var(--weight-semibold);
24
- line-height: var(--leading-normal);
24
+ line-height: var(--leading-tight);
25
25
  cursor: pointer;
26
- &:disabled { cursor: default; opacity: 0.5; }
26
+ transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
27
+ /* Disabled is neutral, whatever the variant (exempt from contrast, WCAG 1.4.3). */
28
+ &:disabled {
29
+ cursor: default;
30
+ background: var(--bg-disabled);
31
+ border-color: var(--border-disabled);
32
+ color: var(--text-disabled);
33
+ }
27
34
  `;
28
35
  const variants = {
29
36
  primary: css`
@@ -0,0 +1,9 @@
1
+ export const fixture = {
2
+ title: "Icon button",
3
+ actions: [
4
+ { icon: "search", label: "Search" },
5
+ { icon: "plus", label: "Add item" },
6
+ { icon: "menu", label: "Open menu" },
7
+ { icon: "close", label: "Close" },
8
+ ],
9
+ } as const;
@@ -0,0 +1,16 @@
1
+ import { IconButton } from "@ds";
2
+ import { DemoFrame } from "@ds/review";
3
+ import { fixture } from "./IconButton.ads.fixture";
4
+ export const scenario = { title: fixture.title, covers: ["IconButton"] };
5
+ export default function Scenario() {
6
+ return (
7
+ <>
8
+ {(["sm", "md", "lg"] as const).map(size => (
9
+ <DemoFrame key={size}>
10
+ {fixture.actions.map(action => <IconButton key={action.icon} icon={action.icon} label={action.label} size={size} />)}
11
+ <IconButton icon="check" label="Unavailable" size={size} disabled />
12
+ </DemoFrame>
13
+ ))}
14
+ </>
15
+ );
16
+ }
@@ -0,0 +1,44 @@
1
+ import { css, cx } from "@linaria/atomic";
2
+ import { Icon, type IconName } from "../../Content/Icon/Icon";
3
+
4
+ export interface IconButtonProps {
5
+ icon: IconName;
6
+ /** Required: the button's accessible name, also shown as its tooltip. */
7
+ label: string;
8
+ size?: "sm" | "md" | "lg";
9
+ disabled?: boolean;
10
+ onClick?: () => void;
11
+ }
12
+
13
+ // A square control-height target around a smaller glyph; only the background has states.
14
+ const base = css`
15
+ display: inline-flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ padding: 0;
19
+ border-width: var(--border-w);
20
+ border-style: solid;
21
+ border-color: transparent;
22
+ border-radius: var(--radius-md);
23
+ background: transparent;
24
+ color: var(--text-body);
25
+ cursor: pointer;
26
+ transition: background-color var(--dur-fast) var(--ease-standard);
27
+ &:hover:not(:disabled) { background: var(--bg-hover); }
28
+ &:active:not(:disabled) { background: var(--bg-active); }
29
+ &:disabled { cursor: default; color: var(--text-disabled); }
30
+ `;
31
+ const sizes = {
32
+ sm: css`width: var(--control-height-sm); height: var(--control-height-sm);`,
33
+ md: css`width: var(--control-height-md); height: var(--control-height-md);`,
34
+ lg: css`width: var(--control-height-lg); height: var(--control-height-lg);`,
35
+ };
36
+
37
+ /** An action shown as an icon, named for assistive technology and in its tooltip. */
38
+ export function IconButton({ icon, label, size = "md", disabled, onClick }: IconButtonProps) {
39
+ return (
40
+ <button type="button" className={cx("ds-icon-button", base, sizes[size])} aria-label={label} title={label} disabled={disabled} onClick={onClick}>
41
+ <Icon name={icon} size={size === "lg" ? "md" : "sm"} />
42
+ </button>
43
+ );
44
+ }
@@ -0,0 +1,14 @@
1
+ # IconButton
2
+
3
+ An action shown as an icon. `label` is required: it is the button's accessible name and its
4
+ tooltip, so an icon-only control is never anonymous (WCAG 4.1.2). The glyph is centered in a
5
+ square target of the control height (32/40/48 px). Only the background has states (hover,
6
+ pressed, disabled); the icon keeps the text color.
7
+
8
+ | Prop | Type | Default |
9
+ |---|---|---|
10
+ | `icon` | `IconName` | — |
11
+ | `label` | `string` | — |
12
+ | `size` | `"sm" \| "md" \| "lg"` | `"md"` |
13
+ | `disabled` | `boolean` | `false` |
14
+ | `onClick` | `() => void` | — |
@@ -0,0 +1 @@
1
+ export const fixture = { title: "Icons", sizes: ["sm", "md", "lg", "xl"] } as const;
@@ -0,0 +1,15 @@
1
+ import { Icon, iconNames } from "@ds";
2
+ import { DemoFrame } from "@ds/review";
3
+ import { fixture } from "./Icon.ads.fixture";
4
+ export const scenario = { title: fixture.title, covers: ["Icon"] };
5
+ export default function Scenario() {
6
+ return (
7
+ <>
8
+ {fixture.sizes.map(size => (
9
+ <DemoFrame key={size}>
10
+ {iconNames.map(name => <Icon key={name} name={name} size={size} label={name} />)}
11
+ </DemoFrame>
12
+ ))}
13
+ </>
14
+ );
15
+ }
@@ -0,0 +1,42 @@
1
+ import { css, cx } from "@linaria/atomic";
2
+ import { glyphAliases, glyphs } from "./glyphs";
3
+
4
+ export type IconName = keyof typeof glyphs | keyof typeof glyphAliases;
5
+ export interface IconProps {
6
+ name: IconName;
7
+ /** 16 px beside sm/base text (default), 20 px beside lg, 24 and 32 px on their own. */
8
+ size?: "sm" | "md" | "lg" | "xl";
9
+ /** Announced name for an icon that carries meaning on its own; without it the icon is decorative. */
10
+ label?: string;
11
+ }
12
+ /** Every canonical glyph, for catalogues; aliases name the same drawings. */
13
+ export const iconNames = Object.keys(glyphs).sort() as IconName[];
14
+
15
+ // Centered beside text, never on the baseline; colored by the text it sits in.
16
+ const base = css`
17
+ display: inline-flex;
18
+ flex: none;
19
+ align-items: center;
20
+ justify-content: center;
21
+ vertical-align: middle;
22
+ color: inherit;
23
+ & > svg { display: block; width: 100%; height: 100%; }
24
+ `;
25
+ const sizes = {
26
+ sm: css`width: var(--icon-sm); height: var(--icon-sm);`,
27
+ md: css`width: var(--icon-md); height: var(--icon-md);`,
28
+ lg: css`width: var(--icon-lg); height: var(--icon-lg);`,
29
+ xl: css`width: var(--icon-xl); height: var(--icon-xl);`,
30
+ };
31
+
32
+ /** A glyph from the project's icon set. */
33
+ export function Icon({ name, size = "sm", label }: IconProps) {
34
+ const canonical = (name in glyphAliases ? glyphAliases[name as keyof typeof glyphAliases] : name) as keyof typeof glyphs;
35
+ return (
36
+ <span
37
+ className={cx("ds-icon", base, sizes[size])}
38
+ {...(label ? { role: "img", "aria-label": label } : { "aria-hidden": true })}
39
+ dangerouslySetInnerHTML={{ __html: glyphs[canonical] }}
40
+ />
41
+ );
42
+ }
@@ -0,0 +1,16 @@
1
+ # Icon
2
+
3
+ A glyph from the project's icon set (`assets/glyphs/`, generated into `glyphs.ts` by
4
+ `ads assets`). It takes the color of the surrounding text (`currentColor`) and sits centered
5
+ beside it. Sizes pair with text: `sm` (16 px) beside sm/base text, `md` (20 px) beside lg,
6
+ `lg` and `xl` (24 and 32 px) on their own; keep one size per context.
7
+
8
+ Without `label` the icon is decorative and hidden from assistive technology; pass `label`
9
+ when the icon alone carries meaning. Icons have no states of their own: interactive icons
10
+ live in an `IconButton`, whose background changes.
11
+
12
+ | Prop | Type | Default |
13
+ |---|---|---|
14
+ | `name` | `IconName` (a glyph or alias) | — |
15
+ | `size` | `"sm" \| "md" \| "lg" \| "xl"` | `"sm"` |
16
+ | `label` | `string` | decorative |
@@ -0,0 +1,17 @@
1
+ // Generated by `ads assets` from assets/glyphs/. Edit the SVGs, not this file.
2
+ export const glyphs = {
3
+ "check": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M20 6 9 17l-5-5\"/></svg>",
4
+ "chevron-down": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m6 9 6 6 6-6\"/></svg>",
5
+ "chevron-right": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"m9 6 6 6-6 6\"/></svg>",
6
+ "close": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M18 6 6 18M6 6l12 12\"/></svg>",
7
+ "external-link": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5\"/></svg>",
8
+ "info": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 16v-5M12 8h.01\"/></svg>",
9
+ "menu": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 6h16M4 12h16M4 18h16\"/></svg>",
10
+ "plus": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12 5v14M5 12h14\"/></svg>",
11
+ "search": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"m20 20-4.35-4.35\"/></svg>",
12
+ "warning": "<svg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M12 3 2 20h20L12 3Z\"/><path d=\"M12 10v4M12 17h.01\"/></svg>"
13
+ } as const;
14
+ export const glyphAliases = {
15
+ "x": "close",
16
+ "add": "plus"
17
+ } as const;
@@ -25,16 +25,20 @@ const labelStyle = css`
25
25
  color: var(--text-body);
26
26
  `;
27
27
  const input = css`
28
- padding-block: var(--space-4);
29
- padding-inline: var(--space-4);
30
- border: var(--border-w) solid var(--border-default);
28
+ min-height: var(--control-height-md);
29
+ padding-inline: var(--control-padding-md);
30
+ border: var(--border-w) solid var(--border-strong);
31
31
  border-radius: var(--radius-md);
32
- background: var(--bg-surface);
32
+ background: var(--bg-field);
33
33
  color: var(--text-body);
34
34
  font-size: var(--text-base);
35
35
  line-height: var(--leading-normal);
36
36
  &::placeholder { color: var(--text-muted); }
37
- &:disabled { opacity: 0.5; }
37
+ &:disabled {
38
+ background: var(--bg-disabled);
39
+ border-color: var(--border-disabled);
40
+ color: var(--text-disabled);
41
+ }
38
42
  `;
39
43
 
40
44
  /** A labelled single-line text input. */
@@ -0,0 +1,12 @@
1
+ export const fixture = {
2
+ title: "Grid",
3
+ columns: Array.from({ length: 16 }, (_, index) => `${index + 1}`),
4
+ layout: [
5
+ { label: "Main", span: { sm: 4, md: 5, lg: 11 } },
6
+ { label: "Aside", span: { sm: 4, md: 3, lg: 5 } },
7
+ { label: "Card", span: { sm: 2, md: 4, lg: 4 } },
8
+ { label: "Card", span: { sm: 2, md: 4, lg: 4 } },
9
+ { label: "Card", span: { sm: 2, md: 4, lg: 4 } },
10
+ { label: "Card", span: { sm: 2, md: 4, lg: 4 } },
11
+ ],
12
+ } as const;