@reqvire-org/ads 0.3.46 → 0.3.48

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 (122) hide show
  1. package/README.md +21 -11
  2. package/dist/a11y.mjs +4 -2
  3. package/dist/assets.mjs +20 -15
  4. package/dist/atomic-composition.mjs +3 -2
  5. package/dist/brand-assets.mjs +48 -11
  6. package/dist/brands.mjs +82 -0
  7. package/dist/browser-audit/worker.mjs +51 -0
  8. package/dist/browser-audit.mjs +147 -0
  9. package/dist/capture/worker.mjs +1 -0
  10. package/dist/capture-store.mjs +2 -0
  11. package/dist/capture.mjs +7 -4
  12. package/dist/check.mjs +38 -8
  13. package/dist/cli.mjs +45 -10
  14. package/dist/color-values.mjs +325 -0
  15. package/dist/config.mjs +16 -2
  16. package/dist/control-padding.mjs +93 -0
  17. package/dist/design-values.mjs +3 -2
  18. package/dist/finding-rules.mjs +61 -0
  19. package/dist/foundation.mjs +17 -4
  20. package/dist/icons.mjs +107 -0
  21. package/dist/init.mjs +3 -0
  22. package/dist/mcp/apps.mjs +9 -6
  23. package/dist/mcp/context.mjs +1 -1
  24. package/dist/mcp/drafts.mjs +3 -0
  25. package/dist/mcp/mutations.mjs +40 -1
  26. package/dist/mcp/preview-widget.bundle.js +36 -36
  27. package/dist/mcp/project-widget.bundle.js +12 -12
  28. package/dist/mcp/server.mjs +23 -11
  29. package/dist/mcp/widget.bundle.js +17 -17
  30. package/dist/palette-generated.mjs +180 -0
  31. package/dist/preview-resources.mjs +12 -3
  32. package/dist/render-color-probe.mjs +148 -0
  33. package/dist/runtime-contracts.mjs +14 -4
  34. package/dist/scenarios.mjs +1 -1
  35. package/dist/showcase/client.bundle.js +28 -28
  36. package/dist/showcase/icons.js +146 -0
  37. package/dist/showcase/index.html +2 -1
  38. package/dist/showcase/style.css +19 -2
  39. package/dist/skills/README.md +2 -1
  40. package/dist/skills/ads-break-ui/SKILL.md +6 -5
  41. package/dist/skills/ads-break-ui/references/atomic-styles.md +12 -12
  42. package/dist/skills/ads-break-ui/references/contracts.md +13 -10
  43. package/dist/skills/ads-break-ui/references/design-data.md +137 -29
  44. package/dist/skills/ads-break-ui/references/drafts.md +3 -1
  45. package/dist/skills/ads-break-ui/references/guarded-editing.md +3 -2
  46. package/dist/skills/ads-break-ui/references/validation.md +13 -4
  47. package/dist/skills/ads-designer/SKILL.md +23 -16
  48. package/dist/skills/ads-designer/references/accessibility.md +41 -5
  49. package/dist/skills/ads-designer/references/atomic-styles.md +12 -12
  50. package/dist/skills/ads-designer/references/branding.md +37 -10
  51. package/dist/skills/ads-designer/references/cli.md +8 -2
  52. package/dist/skills/ads-designer/references/contracts.md +13 -10
  53. package/dist/skills/ads-designer/references/design-data.md +137 -29
  54. package/dist/skills/ads-designer/references/drafts.md +3 -1
  55. package/dist/skills/ads-designer/references/guarded-editing.md +3 -2
  56. package/dist/skills/ads-designer/references/validation.md +13 -4
  57. package/dist/skills/ads-import/SKILL.md +9 -8
  58. package/dist/skills/ads-import/references/atomic-styles.md +12 -12
  59. package/dist/skills/ads-import/references/cli.md +8 -2
  60. package/dist/skills/ads-import/references/contracts.md +13 -10
  61. package/dist/skills/ads-import/references/design-data.md +137 -29
  62. package/dist/skills/ads-import/references/drafts.md +3 -1
  63. package/dist/skills/ads-import/references/guarded-editing.md +3 -2
  64. package/dist/skills/ads-import/references/tokens.md +7 -3
  65. package/dist/skills/ads-import/references/validation.md +13 -4
  66. package/dist/skills/ads-motion/SKILL.md +6 -5
  67. package/dist/skills/ads-motion/references/atomic-styles.md +12 -12
  68. package/dist/skills/ads-motion/references/contracts.md +13 -10
  69. package/dist/skills/ads-motion/references/design-data.md +137 -29
  70. package/dist/skills/ads-motion/references/drafts.md +3 -1
  71. package/dist/skills/ads-motion/references/guarded-editing.md +3 -2
  72. package/dist/skills/ads-motion/references/validation.md +13 -4
  73. package/dist/skills/ads-port/SKILL.md +6 -5
  74. package/dist/skills/ads-port/references/atomic-styles.md +12 -12
  75. package/dist/skills/ads-port/references/cli.md +8 -2
  76. package/dist/skills/ads-port/references/contracts.md +13 -10
  77. package/dist/skills/ads-port/references/design-data.md +137 -29
  78. package/dist/skills/ads-port/references/drafts.md +3 -1
  79. package/dist/skills/ads-port/references/guarded-editing.md +3 -2
  80. package/dist/skills/ads-port/references/validation.md +13 -4
  81. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +11 -2
  82. package/dist/starters/react/ADS.md +43 -10
  83. package/dist/starters/react/README.md +14 -9
  84. package/dist/starters/react/design-system/assets/brand/README.md +8 -3
  85. package/dist/starters/react/design-system/assets/glyphs/README.md +4 -1
  86. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +6 -1
  87. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +3 -2
  88. package/dist/starters/react/design-system/components/Content/Icon/README.md +2 -1
  89. package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +3 -9
  90. package/dist/starters/react/design-system/components/Content/Logo/README.md +4 -2
  91. package/dist/starters/react/design-system/controllers/Palette/Palette.ts +164 -0
  92. package/dist/starters/react/design-system/index.ts +3 -0
  93. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +2 -5
  94. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +11 -2
  95. package/dist/starters/react/design-system/styles.css +1 -0
  96. package/dist/starters/react/design-system/tokens/base.css +8 -5
  97. package/dist/starters/react/design-system/tokens/colors.css +167 -175
  98. package/dist/starters/react/design-system/tokens/elevation.css +14 -21
  99. package/dist/starters/react/design-system/tokens/themes.generated.css +142 -0
  100. package/dist/starters/react/design-system/tokens/themes.generated.ts +402 -0
  101. package/dist/style-boundaries.mjs +2 -1
  102. package/dist/themes-generated.mjs +150 -0
  103. package/dist/themes-watch.mjs +42 -0
  104. package/dist/themes.mjs +214 -63
  105. package/dist/token-export.mjs +22 -11
  106. package/dist/token-policy.mjs +2 -1
  107. package/dist/token-quality.mjs +28 -25
  108. package/dist/tokens.mjs +27 -32
  109. package/dist/validation.mjs +17 -1
  110. package/dist/verification/browser.mjs +14 -3
  111. package/dist/verification.mjs +25 -4
  112. package/docs/ADS.md +41 -27
  113. package/docs/ARCHITECTURE.md +49 -22
  114. package/docs/CACHING.md +2 -3
  115. package/docs/CHANGELOG.md +117 -13
  116. package/docs/CONTRACTS.md +13 -10
  117. package/docs/GUIDE.md +94 -22
  118. package/docs/MCP.md +50 -30
  119. package/docs/benchmarks/bun-previews.md +5 -5
  120. package/docs/benchmarks/{gidi-preview-memory.md → preview-memory.md} +14 -12
  121. package/docs/benchmarks/turbo-poc.md +24 -6
  122. package/package.json +2 -1
@@ -74,7 +74,7 @@ Review that intent and do not disguise a new design decision as arithmetic.
74
74
 
75
75
  ## Review overlap without deleting legitimate roles
76
76
 
77
- `token-overlap-review` is a nonblocking warning for shared tokens with identical
77
+ `token-overlap-review` is a nonblocking review item for shared tokens with identical
78
78
  normalized definitions across their declared theme/condition scopes. It identifies
79
79
  the tokens and source. Inspect their consumers and roles. If one decision is being
80
80
  copied, reuse one shared token or make its relationship explicit with an alias.
@@ -82,7 +82,7 @@ Equal values alone do not prove equal purpose: body text and strong text, spacin
82
82
  and control sizes, or two motion roles may intentionally differ later. A light-only
83
83
  match does not justify merging tokens whose dark/reduced-motion values differ.
84
84
 
85
- For our existing workspaces, convert independent component constants explicitly:
85
+ For existing workspaces, convert independent component constants explicitly:
86
86
  select an existing shared role when it means the same thing; centralize genuinely
87
87
  missing decisions; remove private sheets/imports and contract fields; update token
88
88
  sample coverage in the shared directory. Preserve themes, units, public APIs and
@@ -90,24 +90,25 @@ 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
92
 
93
- ## Accessibility and rhythm reviews
93
+ ## Accessibility and rhythm checks
94
94
 
95
- `ads check` reviews token values, in every theme (each `:root[data-theme=…]` scope,
96
- resolving `var()` aliases there):
95
+ `ads check` checks token values in every theme and brand. Each finding below is an error:
97
96
 
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.
97
+ - `token-contrast`: the roles that meet on screen fall below WCAG 2.2 AA: `--text-strong`,
98
+ `--text-body`, `--text-muted`, `--text-link` and `--accent-text` on `--bg-canvas`,
99
+ `--bg-surface` and `--bg-hover`; `--accent-fg` on `--accent` and `--accent-hover`; each
100
+ status's `-fg` on its solid and `-text` on its `-bg` (4.5:1); `--border-focus` and
101
+ `--border-strong` on the canvas and surface (3:1). Fix it by choosing a different ramp
102
+ step for the role, in the theme the message names, never with a one-off color.
103
+ - `token-rhythm`: a numbered spacing step leaves the scale `--space-N` = N × 2 px.
104
+ - `control-padding`: pad a control with the token for its size. A block sized with
105
+ `--control-height-<size>` pads its sides with `--control-padding-<size>`; the small gap
106
+ inside a track (segmented control, switch) uses `--control-inset` (add it to the spacing
107
+ tokens if the project has none). Anything that is not a control does not use
108
+ `--control-height-*`.
108
109
 
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.
110
+ `token-overlap-review` (review) compares values only within a token family (`--radius-*`
111
+ with `--radius-*`): a radius equal to a spacing step is two scales meeting, not a duplicate.
111
112
 
112
113
  ## Exchange format
113
114
 
@@ -143,18 +144,125 @@ Name roles by element and purpose, the same in every theme; only their values ch
143
144
 
144
145
  ## Themes
145
146
 
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.
147
+ Declare themes in `ds.config.json` (`themes: [{ name, scheme }]`, the first is the default;
148
+ `scheme` sets `color-scheme` for native controls and scrollbars).
149
+
150
+ Write a token that differs per theme as one half per theme, named with the theme as suffix,
151
+ on `:root`:
152
+
153
+ ```css
154
+ :root {
155
+ --color-accent-9-light: oklch(55% .2 280);
156
+ --color-accent-9-dark: oklch(70% .16 280);
157
+ --bg-canvas-light: var(--slate-1-light);
158
+ --bg-canvas-dark: var(--slate-2-dark);
159
+ --accent: var(--color-accent-9);
160
+ }
161
+ ```
162
+
163
+ - A half is a plain value or refers to halves: `--text-muted-dark: var(--slate-11-dark)`,
164
+ never `var(--slate-11)` (`theme-half-reference`).
165
+ - Give every themed token a half for every declared theme (`theme-coverage`). Tokens that do
166
+ not change per theme stay single values; a role that aliases a ramp step
167
+ (`--accent: var(--color-accent-9)`) needs no halves.
168
+ - Never set token values under `[data-theme]` or `prefers-color-scheme` (`theme-old-form`),
169
+ and never set a token both as one value and as halves (`theme-half-conflict`).
170
+ - ADS writes `tokens/themes.generated.css` from the halves and the declared themes and
171
+ brands: `ads assets` writes it, and the showcase and MCP server rewrite it whenever tokens
172
+ or `ds.config.json` change. Commit it, never edit it; it is the last foundation import.
173
+ After editing tokens without a running showcase, run `ads assets` (`themes-generated`
174
+ fails when it is stale).
175
+ - `data-theme="<name>"` on `<html>` themes the page; on any element it themes that section
176
+ and everything inside it, down to the next `data-theme`. A themed section paints its own
177
+ canvas and text (`base.css`).
178
+ - Add a theme for a real need: high contrast, a dimmed reading mode. Add a half for it to
179
+ every themed token. Check a theme in the showcase (the theme button steps through declared
180
+ themes) and capture it by name.
181
+ - Show content that belongs to one theme (a dark logo variant) with the generated display
182
+ switch: `display: var(--display-dark, block)`. It is `none` outside the nearest dark
183
+ theme. Never style by theme or brand with a selector (`[data-theme="dark"] &`,
184
+ `:root[data-brand] &`): it ignores the nearest section (`theme-selector`). Give per-theme
185
+ values as token halves instead.
186
+ - A per-theme value that comes from data at runtime (a chart series color, a highlighter
187
+ color) uses the generated helpers, never `light-dark()` (`theme-light-dark`):
188
+ `style={{ "--series": themed({ light: a, dark: b }) }}` with every declared theme as a key,
189
+ or `themedByScheme({ light: a, dark: b })` when the data has only light and dark (each
190
+ theme takes the value for its scheme). Values are complete colors.
191
+ - To follow the OS setting, set `"followSystemTheme": true` in `ds.config.json`: a page
192
+ without `data-theme` takes the first declared theme whose scheme matches
193
+ `prefers-color-scheme`. An explicit `data-theme` always wins. Letting the user choose and
194
+ remembering it is application code: it sets `data-theme`.
195
+
196
+ ## Brands
197
+
198
+ A brand is a second axis beside the theme: the theme sets the color mode, the brand sets
199
+ identity (an accent ramp, a font). Use brands for white label (one product, each customer's
200
+ accent, font and logo, each in light and dark), a product family, or a co-branded partner
201
+ section; without them every combination becomes a theme (`acme-light`, `acme-dark`, …).
202
+
203
+ Declare brands in `ds.config.json` (`brands: [{ name }]`, the first is the default; leave
204
+ `brands` out for one brand). The default brand's values are the ones on `:root`. Another
205
+ brand re-sets existing tokens on its own selector only, with every half of a themed token it
206
+ changes:
207
+
208
+ ```css
209
+ [data-brand="acme"] {
210
+ --color-accent-9-light: oklch(55% .2 25);
211
+ --color-accent-9-dark: oklch(70% .16 25);
212
+ --font-sans: Georgia, serif;
213
+ }
214
+ ```
215
+
216
+ - `data-brand="<name>"` on `<html>` brands the page; on any element that section. Brand and
217
+ theme are independent: each element takes its nearest brand and its nearest theme, at any
218
+ nesting depth, including the default brand inside another brand's section.
219
+ - Errors: a brand that gives a themed token one value (`brand-theme-value`) or only some of
220
+ its halves or ramp steps (`brand-coverage`), a token only a brand defines
221
+ (`brand-new-token`), a declared brand without values (`brand-empty`), a `data-brand` name
222
+ the config does not declare (`brand-undeclared`). `token-contrast` runs for every brand
223
+ in every theme.
224
+ - A brand's logo is brand artwork (`ads://guides/branding`). Render every brand's logo and
225
+ show each with `display: var(--display-brand-<brand>, block)`, so a section shows its
226
+ nearest brand's logo.
227
+ - The showcase shows a brand selector next to the theme button; captures take `brand`;
228
+ `ads tokens --format dtcg --brand <name>` exports a brand (with `--theme`, one brand in
229
+ one theme).
230
+
231
+ ## Colors in Canvas, WebGL and SVG renderers
232
+
233
+ A renderer that needs colors as values (a graph, a chart, a canvas) reads them from the
234
+ generated palette, never from the page per item. `tokens/themes.generated.ts` holds every
235
+ color token resolved for every context (`<theme>`, and `<brand>/<theme>` for other brands)
236
+ as `{ css, rgba }`: `css` is `#rrggbb`, or `rgba(…)` when translucent; `rgba` is sRGB
237
+ 0–255 with alpha 0–1. Aliases, halves and `color-mix()` are resolved; out-of-gamut colors
238
+ are clipped per channel, as a canvas does. ADS writes it with `themes.generated.css`.
239
+
240
+ ```ts
241
+ import { paletteFor, observePalette } from "@ds";
242
+
243
+ let colors = paletteFor(container); // once per render pass
244
+ const fill = colors["--accent"].rgba; // inside the per-node loop
245
+ const stop = observePalette(container, next => { colors = next; redraw(); });
246
+ ```
247
+
248
+ - `paletteFor(element)` returns the palette of the element's nearest theme and brand (and
249
+ the OS setting under `followSystemTheme`). Call it once per render or context change; look
250
+ colors up inside loops.
251
+ - `observePalette(element, callback)` calls back once when the element's theme or brand
252
+ changes; redraw from it instead of rebuilding the renderer. It returns the unsubscribe.
253
+ - `paletteContext(element)` returns the context key (`<theme>` or `<brand>/<theme>`) for
254
+ `palette[key]` or for caching per context.
255
+ - `resolveColor(element, value)` resolves a color that is not a palette token (currentColor,
256
+ a value from data) once, without inserting elements, and caches it.
257
+ - A token whose value cannot be resolved ahead of time (currentColor, relative color syntax,
258
+ system colors) is not in the palette in any context; `unresolved` lists it. Use
259
+ `resolveColor` for those.
260
+ - The palette reflects token sheets, not inline token overrides at runtime or `@media`
261
+ variants.
262
+
263
+ `render-color-probe` (review) flags a computed-style color read or `getImageData` inside a
264
+ per-item path (an array callback, a loop body, `nodeReducer`/`edgeReducer`, d3 `.attr`/
265
+ `.style` callbacks). Move the read out with `paletteFor`.
158
266
 
159
267
  ## Spacing
160
268
 
@@ -152,7 +152,9 @@ current rendered revision and complete acceptance before finishing the change.
152
152
  After rendered review, call `ads_accept({id,revision})` once. It checks that exact
153
153
  revision, runs mandatory ADS guards plus `acceptance.checks` and, when
154
154
  `acceptance.behaviorChecks` is enabled, affected registered behavior checks against an isolated candidate, and applies passing changes at
155
- their normal paths. Changes during checking or baseline conflicts prevent
155
+ their normal paths. When `acceptance.browserAudit` is enabled it also runs the axe-core
156
+ audit on the candidate's affected UI scenarios; an `a11y-axe` error rejects the draft.
157
+ Fix it in the component and accept the new revision. Changes during checking or baseline conflicts prevent
156
158
  application. Successful acceptance removes the proposal and records an event.
157
159
  There is no separate Apply or Iterate action. A failed attempt retains the draft;
158
160
  inspect its returned resultId with `ads_results` and fix the reported boundary.
@@ -23,8 +23,9 @@ ads_apply_patch({"unit":"components/Example","patchFile":"<returned patchFile>",
23
23
  The dry run validates the candidate in an isolated project copy using mandatory
24
24
  ADS guards, `acceptance.checks` and, when `acceptance.behaviorChecks` is enabled,
25
25
  affected registered behavior checks. Registration alone does not require a test
26
- at acceptance. See [validation policies](validation.md). Configured browser checks use that candidate's
27
- managed preview, not the live showcase. Read the summary, then page failing
26
+ at acceptance. With `acceptance.browserAudit`, axe-core also audits the candidate's
27
+ affected UI scenarios; `a11y-axe` errors reject the patch. See [validation policies](validation.md).
28
+ Configured browser checks use that candidate's managed preview, not the live showcase. Read the summary, then page failing
28
29
  `outcomes`, `diagnostics` or pipeline `checks` through `ads_results` with its
29
30
  `resultId`. Inspect one exact outcome with `ads_investigate({unit,check,runId})`;
30
31
  fix the draft and diff again. See [evidence.md](evidence.md) for page/range limits.
@@ -41,6 +41,15 @@ implicitly requiring them at acceptance.
41
41
  all registered behavior checks. Use before a release, after ownership/test/config
42
42
  migrations and for an explicit complete audit. Changed scope narrows registered
43
43
  owners while project scripts and core gates retain full scope.
44
+ - `browserAudit: true` in either policy adds the axe-core audit of every rendered
45
+ UI scenario in every brand and theme (`browser-accessibility-audit`). Its `a11y-axe`
46
+ findings are errors that fail the policy. With `acceptance.browserAudit`, draft
47
+ acceptance and guarded patches/transactions audit the candidate's affected UI
48
+ scenarios (all after configuration, foundation, token or asset changes) and reject
49
+ the change on any `a11y-axe` error or a `browser-audit` failure to run. Declare
50
+ `"sideEffects": ["**/*.css"]` in the project's `package.json`, as the starters do, so a
51
+ component change audits only the scenarios that import it. See
52
+ ads://guides/accessibility.
44
53
  - Draft create, edit and show are preview-only; they trigger neither policy.
45
54
  `ads_verify` explicitly runs selected checks independently of either policy.
46
55
  - Builds, hooks and CI trigger a policy only when their scripts invoke it. Use
@@ -49,11 +58,11 @@ implicitly requiring them at acceptance.
49
58
  disable tests or weaken configuration to make a failing change pass.
50
59
 
51
60
  Defaults: both script lists are empty, acceptance `behaviorChecks:false`,
52
- validation `behaviorChecks:true`. No lint/test/build script names are inferred.
61
+ validation `behaviorChecks:true`, both `browserAudit:false`. No lint/test/build script names are inferred.
53
62
  Every listed script must exist; commands are trusted project configuration, not
54
- MCP arguments. Move the removed `mcp.mutationChecks` field to `acceptance.checks`
55
- and explicitly choose behavior gating. Existing `mcp.mutationCheckTimeoutMs`
56
- still bounds each project script; behavior profiles have separate budgets.
63
+ MCP arguments. `mcp.mutationChecks` is a configuration error: list those scripts in
64
+ `acceptance.checks` and set `acceptance.behaviorChecks`. `mcp.mutationCheckTimeoutMs`
65
+ bounds each project script; behavior profiles have separate budgets.
57
66
 
58
67
  Report the chosen policy, scope and revision. Skipped tests are not passed tests;
59
68
  acceptance evidence is not complete-validation evidence. The two policies keep
@@ -60,7 +60,16 @@ const sampleStyle = css`
60
60
  &[data-ads-property="font-size"] { font-size: var(--ux-token-preview-value); }
61
61
  &[data-ads-property="font-weight"] { font-weight: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 2); line-height: 1; }
62
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); }
63
+ /* Column counts draw that many columns: stripes with a gap, filling the tile. */
64
+ &[data-ads-property="column-count"] {
65
+ column-count: var(--ux-token-preview-value);
66
+ height: calc(var(--space-8) * 3);
67
+ background: repeating-linear-gradient(
68
+ to right,
69
+ var(--accent) 0 calc((100% + var(--space-2)) / var(--ux-token-preview-value) - var(--space-2)),
70
+ transparent 0 calc((100% + var(--space-2)) / var(--ux-token-preview-value))
71
+ );
72
+ }
64
73
  &[data-ads-property="letter-spacing"] { letter-spacing: var(--ux-token-preview-value); font-size: calc(var(--text-base) * 1.5); }
65
74
  &[data-ads-property="height"] {
66
75
  height: var(--ux-token-preview-value);
@@ -109,7 +118,7 @@ function TokenTile({ sample, text }: { sample: TokenSample; text: string }) {
109
118
  return (
110
119
  <article className={cx("ux-token-preview__item", tile)}>
111
120
  <span ref={ref} className={cx("ux-token-preview__sample", sampleStyle)} data-ads-token={sample.token} data-ads-property={sample.property}>
112
- {["background-color", "width", "height", "border-radius", "box-shadow", "animation-duration", "animation-timing-function"].includes(sample.property) ? "" : text}
121
+ {["background-color", "width", "height", "border-radius", "box-shadow", "column-count", "animation-duration", "animation-timing-function"].includes(sample.property) ? "" : text}
113
122
  </span>
114
123
  <code className={cx("ux-token-preview__name", label)}>{sample.token}</code>
115
124
  <small className={label}>{value}</small>
@@ -24,8 +24,9 @@ The starter declares React in `ds.config.json`. Keep that choice, JSX, runtime
24
24
  dependencies and the preview mount adapter consistent. Init records a choice for
25
25
  an unconfigured project; it does not convert copied React source to Preact.
26
26
 
27
- The starter has one example of each layer (Button, Logo, TextField, SearchBar,
28
- SearchPage) and placeholder brand artwork. Rename, restyle or replace them; add only what the product needs.
27
+ The starter has examples of each layer (Button, IconButton, Icon, Logo, TextField and
28
+ Grid; the SearchBar pattern; the SearchPage composition), a shared `controllers/Palette`
29
+ and placeholder brand artwork. Rename, restyle or replace them; add only what the product needs.
29
30
  Keep the ADS in root `design-system/`, beside application `src/`.
30
31
  Keep public exports in `design-system/index.ts`; consumers use its `@ds` alias.
31
32
  `styles.css` is the foundation CSS entry and contains token imports only.
@@ -34,7 +35,7 @@ Keep public exports in `design-system/index.ts`; consumers use its `@ds` alias.
34
35
 
35
36
  Use semantic CSS tokens for visual values. Raw values belong in the token files.
36
37
  Projects sharing this ADS use the same token names, meanings, and value types;
37
- their concrete values and theme overrides can differ. Reuse existing local values
38
+ their concrete values and per-theme halves can differ. Reuse existing local values
38
39
  when importing components/patterns. Existing font, text, spacing and other roles
39
40
  take precedence over divergent upstream constants. Add genuinely missing shared
40
41
  decisions, and import source token values only when adopting that theme is requested.
@@ -48,7 +49,8 @@ variables. Every shared token needs a real sample in a shared token scenario.
48
49
 
49
50
  Foundation roles are enforced by `foundation-role`, `foundation-selector` and
50
51
  `foundation-import`, alongside the regular token checks. Shared definitions
51
- belong on the document root or explicit root themes; ordinary declarations belong
52
+ belong on the document root (per-theme values as halves, such as `--x-light` and
53
+ `--x-dark`) or a brand's `[data-brand]`; ordinary declarations belong
52
54
  in `base.css`, and font-face descriptors in optional `fonts.css`. The entry imports
53
55
  canonical sheets; those sheets cannot import another styling layer. Component
54
56
  classes, IDs, data/ARIA hooks, contextual selectors, keyframes and scoped UI rules
@@ -59,7 +61,9 @@ font-face metadata keeps its separate asset role.
59
61
  `base.css` has three closed roles:
60
62
 
61
63
  - Document defaults: root/body typography, canvas colors and theme behavior,
62
- global text selection and document scrollbars.
64
+ global text selection and document scrollbars (the starter keeps the scrollbar's space
65
+ with `scrollbar-gutter: stable` and locks page scrolling while a modal `<dialog>` is
66
+ open with `html:has(:modal)`).
63
67
  - Native resets: permitted normalization properties and values, such as zero
64
68
  spacing, inherited control typography, list resets and responsive replaced media.
65
69
  - Global accessibility: universal `:focus-visible` outline rules, and reduced-motion
@@ -88,8 +92,29 @@ geometry exceptions if a component needs them.
88
92
 
89
93
  Use semantic HTML and test relevant keyboard/focus behavior. Motion should
90
94
  consume duration/easing tokens and respect reduced motion. Brand changes belong
91
- in tokens or documented component hooks. The starter uses system fonts and has
92
- no icon component; add a shared icon primitive when it is needed.
95
+ in tokens or documented component hooks. The starter uses system fonts; icons go
96
+ through `Icon` (its glyph set in `assets/glyphs/`) and icon-only actions through
97
+ `IconButton`.
98
+
99
+ Themes: a token that differs per theme has one half per declared theme on `:root`
100
+ (`--color-accent-9-light`, `--color-accent-9-dark`); a half refers to halves
101
+ (`var(--slate-11-dark)`), never to a token that follows the theme. Never set token values
102
+ under `[data-theme]` or `prefers-color-scheme`. ADS writes `tokens/themes.generated.css`
103
+ and `tokens/themes.generated.ts` (`ads assets`, the showcase or the MCP server); commit
104
+ them and do not edit them. Set `data-theme="<name>"` on `<html>` or
105
+ on a section, or set `"followSystemTheme": true` to follow the OS. Show theme-specific
106
+ content with `display: var(--display-dark, block)`; never style by a `[data-theme]` or
107
+ `[data-brand]` selector. A Canvas, WebGL or SVG renderer takes its colors from
108
+ `paletteFor(element)` (`controllers/Palette`, generated `tokens/themes.generated.ts`) once
109
+ per render and redraws from `observePalette`. A per-theme value from data at runtime
110
+ uses `themed()` or `themedByScheme()` from `tokens/themes.generated.ts`, never
111
+ `light-dark()`.
112
+
113
+ The starter has one brand. For several (white label, a product family, a partner
114
+ section), declare `brands` in `ds.config.json`; the first is the default. A brand sets
115
+ only its own values on `[data-brand="<name>"]`, with every half of a themed token it
116
+ changes. `ads check` fails on old theme selectors, missing halves and `brand-*` errors; the
117
+ token guide (`ads://guides/tokens`) has the details.
93
118
 
94
119
  ## Showcase
95
120
 
@@ -109,7 +134,9 @@ runtime, CSS and fonts, through MCP resources. App presentation comes from the
109
134
  selected compiled scenario; reusable review layouts live in development-only `review/` through its separate public entry. Do not recreate
110
135
  production widgets inside the client or scenario.
111
136
 
112
- There are four sections: Tokens, Components, Patterns and Composition. There are
137
+ There are five sections: Brand (first, shown only when the project has scenarios in
138
+ `brand/`), Tokens, Components, Patterns and Composition, plus an Icons tab after Tokens
139
+ for the glyph set. There are
113
140
  no required `TokensPage`/`ComponentsPage`/`PatternsPage`/`CompositionPage` files.
114
141
  Legacy custom browsing pages remain checked when present, but new projects use
115
142
  the built-in client. Its tooling CSS is separate from the project style contract.
@@ -214,10 +241,16 @@ preview builds; review meaningful states in both themes and sizes.
214
241
  ## Branding
215
242
 
216
243
  Keep original artwork, variants, usage, credits, and licenses in
217
- `design-system/assets/brand/`. This starter has only guidance there, no artwork.
244
+ `design-system/assets/brand/`. This starter has placeholder artwork there (`logo.svg`,
245
+ `logo.dark.svg`, `app-icon.svg`) with its README; replace it with the product's own.
246
+ Other products' logos are not brand artwork or glyphs: keep them, in their own
247
+ colors and under their owners' trademark and usage terms, in `assets/logos/` and
248
+ show them as images (a CSS mask over `currentColor` for a muted use); ADS generates
249
+ and checks nothing there.
218
250
  Font assets belong in `assets/fonts/`; add optional `tokens/fonts.css` first in
219
251
  the import-only foundation entry. The fixed import order is fonts (when
220
- present), colors, typography, spacing, elevation, base.
252
+ present), colors, typography, spacing, elevation, base, then the generated
253
+ `themes.generated.css`.
221
254
 
222
255
  Select an SVG with `assets.iconSource` in `ds.config.json`, relative to the ADS
223
256
  folder. Initialized builds run checks and Oxlint, then `ads assets`, then existing
@@ -9,7 +9,9 @@ components in four groups (`components/Actions/Button`, `components/Actions/Icon
9
9
  `components/Content/Icon/glyphs.ts`, one pattern
10
10
  (`patterns/Search/SearchBar`) and one composition (`composition/Search/SearchPage`),
11
11
  plus placeholder brand artwork in `assets/brand/` (a logo with its dark-theme
12
- variant, and the app icon that `assets.iconSource` names). Rename, restyle or
12
+ variant, and the app icon that `assets.iconSource` names), and a shared
13
+ `controllers/Palette` that gives Canvas, WebGL and SVG renderers their colors. Rename,
14
+ restyle or
13
15
  replace them as the product's own; it has no fonts. The minimal showcase shell and MCP client
14
16
  come from ADS tooling.
15
17
 
@@ -34,7 +36,7 @@ npm run dev:showcase
34
36
  For unreleased tooling, create from the real local package:
35
37
 
36
38
  ```sh
37
- ads_tool_package="/absolute/path/to/reqvire-org-ads-0.3.45.tgz"
39
+ ads_tool_package="/absolute/path/to/reqvire-org-ads-0.3.47.tgz"
38
40
  npx --yes --package "$ads_tool_package" ads create my-design-system --framework react --tool-package "$ads_tool_package"
39
41
  ```
40
42
 
@@ -68,8 +70,8 @@ The foundation meets WCAG 2.2 AA:
68
70
 
69
71
  - **Color** (`colors.css`): six 12-step ramps (`--slate-*`, `--color-accent-*`,
70
72
  `--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
+ rest/hover/pressed, 6–8 borders, 9–10 solid fills, 11–12 text. Each step has a light and a
74
+ dark half (`--slate-9-light`, `--slate-9-dark`). Semantic roles (`--bg-*`, `--text-*`, `--border-*`,
73
75
  `--accent*`, `--success|warning|danger|info*`) alias ramp steps; text pairs reach 4.5:1
74
76
  and focus and strong borders 3:1 in both themes. Layers go canvas → surface → raised,
75
77
  each a step lighter in dark; inputs use `--bg-field`; `--bg-overlay` is the modal scrim and
@@ -87,10 +89,13 @@ The foundation meets WCAG 2.2 AA:
87
89
  - **Shape & elevation**: radius `--radius-xs`…`--radius-2xl` and `--radius-full`, border
88
90
  and focus widths, layered shadows `--shadow-xs`…`--shadow-xl` (stronger in dark), and
89
91
  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.
92
+ - **Themes**: light (default) and dark, declared in `ds.config.json`. Every themed token is
93
+ written as halves on `:root`; ADS generates `tokens/themes.generated.css` (switches and
94
+ resolvers) and `tokens/themes.generated.ts` (the renderer palette and `themed()`), so
95
+ `data-theme` themes the page on `<html>` or one section on any element, following the
96
+ nearest one. `--display-light`/`--display-dark` show theme-specific content. Runtime
97
+ per-theme values use `themed()` or `themedByScheme()` from `themes.generated.ts`; a
98
+ renderer reads its colors with `paletteFor(element)` from `controllers/Palette`.
94
99
  - **Motion** (`elevation.css`): durations 70/110/150/240/400/700 ms, easing for moving between
95
100
  places (standard), entering and leaving, each with a `-strong` variant for rare important
96
101
  moments; all durations are 0 under reduced motion.
@@ -104,7 +109,7 @@ The foundation meets WCAG 2.2 AA:
104
109
  so it fits any pane. The showcase's grid button draws the project's grid over every
105
110
  preview to check alignment.
106
111
 
107
- `ads check` warns when a text or control pair falls below WCAG AA in any theme
112
+ `ads check` fails when a text or control pair falls below WCAG AA in any theme or brand
108
113
  (`token-contrast`) and when a spacing step leaves the 2 px rhythm (`token-rhythm`).
109
114
  `ads tokens --format dtcg` exports the tokens as W3C Design Tokens JSON for design tools.
110
115
 
@@ -1,8 +1,9 @@
1
1
  # Project branding
2
2
 
3
3
  The starter's placeholder artwork. Replace each file with the product's own and keep this
4
- table current: `ads check` warns about artwork that is undescribed, unlicensed, unused or
5
- missing from the Brand previews (`brand/Identity/Logo`, `brand/Icons/AppIcon`).
4
+ table current: `ads check` fails on artwork that is undescribed, unlicensed or missing from
5
+ the Brand previews (`brand/Identity/Logo`, `brand/Icons/AppIcon`), and lists unused
6
+ artwork for review.
6
7
 
7
8
  | File | Use | Backgrounds |
8
9
  |---|---|---|
@@ -21,8 +22,12 @@ patterns and development review helpers own `--ux-*`; the showcase owns
21
22
  `--showcase-*`. Do not introduce a brand-prefixed token vocabulary or override
22
23
  component state variables.
23
24
 
25
+ This folder holds the product's own artwork only. Other products' logos belong in
26
+ `assets/logos/`, shown as images under their owners' trademark and usage terms.
27
+
24
28
  Name a dark-theme variant `<name>.dark.svg`; the component showing the artwork renders
25
- both and the theme picks one. Fixed colors belong inside the artwork only.
29
+ both and shows each with its display switch (`display: var(--display-dark, block)`), so a
30
+ section shows the variant of its nearest theme. Fixed colors belong inside the artwork only.
26
31
 
27
32
  Put licensed font files in `assets/fonts/` and their declarations in
28
33
  `tokens/fonts.css`. Keep that optional import first in `styles.css`.
@@ -7,6 +7,9 @@ takes the color of the text beside it. `ads assets` turns them into
7
7
  gives extra names to existing glyphs.
8
8
 
9
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`).
10
+ file: `ads check` fails on both (`glyph-viewbox`, `glyph-color`). Review the set in the
11
+ showcase's Icons tab. Another product's logo
12
+ that keeps its own colors is not a glyph: it belongs in `assets/logos/`, shown as an image,
13
+ under its owner's trademark and usage terms.
11
14
 
12
15
  License: drawn for the ADS starter, free to use, change or remove (MIT, like ADS).
@@ -1 +1,6 @@
1
- export const fixture = { title: "Icons", sizes: ["sm", "md", "lg", "xl"] } as const;
1
+ export const fixture = {
2
+ title: "Icon",
3
+ sizes: ["sm", "md", "lg", "xl"],
4
+ // Decorative icons beside their text; the showcase's Icons tab lists the whole glyph set.
5
+ examples: [{ name: "search", text: "Search" }, { name: "info", text: "Details" }, { name: "warning", text: "Needs attention" }],
6
+ } as const;
@@ -1,4 +1,4 @@
1
- import { Icon, iconNames } from "@ds";
1
+ import { Icon } from "@ds";
2
2
  import { DemoFrame } from "@ds/review";
3
3
  import { fixture } from "./Icon.ads.fixture";
4
4
  export const scenario = { title: fixture.title, covers: ["Icon"] };
@@ -7,7 +7,8 @@ export default function Scenario() {
7
7
  <>
8
8
  {fixture.sizes.map(size => (
9
9
  <DemoFrame key={size}>
10
- {iconNames.map(name => <Icon key={name} name={name} size={size} label={name} />)}
10
+ {fixture.examples.map(example => <span key={example.name}><Icon name={example.name} size={size} /> {example.text}</span>)}
11
+ <Icon name="add" size={size} label="Add" />
11
12
  </DemoFrame>
12
13
  ))}
13
14
  </>
@@ -7,7 +7,8 @@ beside it. Sizes pair with text: `sm` (16 px) beside sm/base text, `md` (20 px)
7
7
 
8
8
  Without `label` the icon is decorative and hidden from assistive technology; pass `label`
9
9
  when the icon alone carries meaning. Icons have no states of their own: interactive icons
10
- live in an `IconButton`, whose background changes.
10
+ live in an `IconButton`, whose background changes. Review the whole glyph set in the
11
+ showcase's Icons tab; the Icon scenario shows the component in use.
11
12
 
12
13
  | Prop | Type | Default |
13
14
  |---|---|---|
@@ -17,18 +17,12 @@ const sizes = {
17
17
  large: css`height: calc(var(--space-16) * 2);`,
18
18
  };
19
19
  const image = css`
20
- display: block;
21
20
  height: 100%;
22
21
  width: auto;
23
22
  `;
24
- // Both variants are in the page; the theme shows one, so switching needs no script.
25
- const light = css`
26
- :root[data-theme="dark"] & { display: none; }
27
- `;
28
- const dark = css`
29
- display: none;
30
- :root[data-theme="dark"] & { display: block; }
31
- `;
23
+ // Both variants are in the page; the nearest theme shows one, so switching needs no script.
24
+ const light = css`display: var(--display-light, block);`;
25
+ const dark = css`display: var(--display-dark, block);`;
32
26
 
33
27
  /** The product logo, in its light- or dark-theme artwork. */
34
28
  export function Logo({ label, size = "small" }: LogoProps) {
@@ -1,8 +1,10 @@
1
1
  # Logo
2
2
 
3
3
  The product logo from `assets/brand/`: `logo.svg` in the light theme and `logo.dark.svg`
4
- in the dark theme. Both images are in the page and the theme shows one, so switching
5
- themes needs no script. `label` is the accessible name.
4
+ in the dark theme. Both images are in the page and each shows only under its display
5
+ switch (`display: var(--display-light, block)`, `display: var(--display-dark, block)`), so
6
+ the logo follows the nearest `data-theme` and switching themes needs no script. `label` is
7
+ the accessible name.
6
8
 
7
9
  | Prop | Type | Default |
8
10
  |---|---|---|