@reqvire-org/ads 0.3.46 → 0.3.47

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 (110) 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 +45 -0
  8. package/dist/browser-audit.mjs +117 -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/drafts.mjs +3 -0
  24. package/dist/mcp/mutations.mjs +17 -1
  25. package/dist/mcp/preview-widget.bundle.js +36 -36
  26. package/dist/mcp/project-widget.bundle.js +12 -12
  27. package/dist/mcp/server.mjs +21 -9
  28. package/dist/mcp/widget.bundle.js +17 -17
  29. package/dist/palette-generated.mjs +180 -0
  30. package/dist/preview-resources.mjs +12 -3
  31. package/dist/render-color-probe.mjs +148 -0
  32. package/dist/runtime-contracts.mjs +14 -4
  33. package/dist/scenarios.mjs +1 -1
  34. package/dist/showcase/client.bundle.js +28 -28
  35. package/dist/showcase/icons.js +146 -0
  36. package/dist/showcase/index.html +2 -1
  37. package/dist/showcase/style.css +19 -2
  38. package/dist/skills/README.md +2 -1
  39. package/dist/skills/ads-break-ui/SKILL.md +6 -5
  40. package/dist/skills/ads-break-ui/references/atomic-styles.md +12 -12
  41. package/dist/skills/ads-break-ui/references/contracts.md +13 -10
  42. package/dist/skills/ads-break-ui/references/design-data.md +137 -29
  43. package/dist/skills/ads-break-ui/references/validation.md +8 -4
  44. package/dist/skills/ads-designer/SKILL.md +23 -16
  45. package/dist/skills/ads-designer/references/accessibility.md +39 -5
  46. package/dist/skills/ads-designer/references/atomic-styles.md +12 -12
  47. package/dist/skills/ads-designer/references/branding.md +37 -10
  48. package/dist/skills/ads-designer/references/cli.md +8 -2
  49. package/dist/skills/ads-designer/references/contracts.md +13 -10
  50. package/dist/skills/ads-designer/references/design-data.md +137 -29
  51. package/dist/skills/ads-designer/references/validation.md +8 -4
  52. package/dist/skills/ads-import/SKILL.md +9 -8
  53. package/dist/skills/ads-import/references/atomic-styles.md +12 -12
  54. package/dist/skills/ads-import/references/cli.md +8 -2
  55. package/dist/skills/ads-import/references/contracts.md +13 -10
  56. package/dist/skills/ads-import/references/design-data.md +137 -29
  57. package/dist/skills/ads-import/references/tokens.md +7 -3
  58. package/dist/skills/ads-import/references/validation.md +8 -4
  59. package/dist/skills/ads-motion/SKILL.md +6 -5
  60. package/dist/skills/ads-motion/references/atomic-styles.md +12 -12
  61. package/dist/skills/ads-motion/references/contracts.md +13 -10
  62. package/dist/skills/ads-motion/references/design-data.md +137 -29
  63. package/dist/skills/ads-motion/references/validation.md +8 -4
  64. package/dist/skills/ads-port/SKILL.md +6 -5
  65. package/dist/skills/ads-port/references/atomic-styles.md +12 -12
  66. package/dist/skills/ads-port/references/cli.md +8 -2
  67. package/dist/skills/ads-port/references/contracts.md +13 -10
  68. package/dist/skills/ads-port/references/design-data.md +137 -29
  69. package/dist/skills/ads-port/references/validation.md +8 -4
  70. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +11 -2
  71. package/dist/starters/react/ADS.md +43 -10
  72. package/dist/starters/react/README.md +14 -9
  73. package/dist/starters/react/design-system/assets/brand/README.md +8 -3
  74. package/dist/starters/react/design-system/assets/glyphs/README.md +4 -1
  75. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +6 -1
  76. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +3 -2
  77. package/dist/starters/react/design-system/components/Content/Icon/README.md +2 -1
  78. package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +3 -9
  79. package/dist/starters/react/design-system/components/Content/Logo/README.md +4 -2
  80. package/dist/starters/react/design-system/controllers/Palette/Palette.ts +164 -0
  81. package/dist/starters/react/design-system/index.ts +3 -0
  82. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +2 -5
  83. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +11 -2
  84. package/dist/starters/react/design-system/styles.css +1 -0
  85. package/dist/starters/react/design-system/tokens/base.css +8 -5
  86. package/dist/starters/react/design-system/tokens/colors.css +167 -175
  87. package/dist/starters/react/design-system/tokens/elevation.css +14 -21
  88. package/dist/starters/react/design-system/tokens/themes.generated.css +142 -0
  89. package/dist/starters/react/design-system/tokens/themes.generated.ts +402 -0
  90. package/dist/style-boundaries.mjs +2 -1
  91. package/dist/themes-generated.mjs +150 -0
  92. package/dist/themes-watch.mjs +42 -0
  93. package/dist/themes.mjs +214 -63
  94. package/dist/token-export.mjs +22 -11
  95. package/dist/token-policy.mjs +2 -1
  96. package/dist/token-quality.mjs +28 -25
  97. package/dist/tokens.mjs +27 -32
  98. package/dist/validation.mjs +18 -1
  99. package/dist/verification/browser.mjs +14 -3
  100. package/docs/ADS.md +41 -27
  101. package/docs/ARCHITECTURE.md +49 -22
  102. package/docs/CACHING.md +2 -3
  103. package/docs/CHANGELOG.md +97 -13
  104. package/docs/CONTRACTS.md +13 -10
  105. package/docs/GUIDE.md +89 -21
  106. package/docs/MCP.md +35 -25
  107. package/docs/benchmarks/bun-previews.md +5 -5
  108. package/docs/benchmarks/{gidi-preview-memory.md → preview-memory.md} +14 -12
  109. package/docs/benchmarks/turbo-poc.md +24 -6
  110. package/package.json +2 -1
@@ -145,11 +145,11 @@ helpers do not grant custom scenario CSS.
145
145
 
146
146
  For atomic base/variant styling, helper/wrapper class composition, extracted
147
147
  custom-property arithmetic, typed `@property` registrations, or an
148
- `atomic-composition-review` / `atomic-composition-limit` advisory, read
148
+ `atomic-composition-review` / `atomic-composition-limit` finding, read
149
149
  [atomic style composition](references/atomic-styles.md). The same guide is served
150
150
  as `ads://guides/atomic-styles`. It explains shorthand/logical conflicts and
151
151
  matching-property fixes, plus the build resolver for preserving opaque custom
152
- properties through extraction. Review warnings in the real `cx` composition and verify
152
+ properties through extraction. Check review items in the real `cx` composition and verify
153
153
  computed styles across affected sizes/states; retain intentional product behavior.
154
154
 
155
155
  For positioning, menu/listbox keyboard handling, focus trapping and virtual lists,
@@ -210,7 +210,8 @@ Never copy starter files by hand or port React files to Preact.
210
210
  The created project's `README.md` and `ADS.md` explain it. It has semantic token
211
211
  foundation in six groups (Color ramps and AA-checked roles, Type, Space & sizing, Shape &
212
212
  elevation, Motion, Layout) with light and dark themes declared in `ds.config.json`
213
- (`[data-theme]` themes the page or one section; see `ads://guides/tokens`), React or Preact
213
+ (`[data-theme]` themes the page or one section; optional `brands` add a brand axis beside
214
+ the themes; see `ads://guides/tokens`), React or Preact
214
215
  TypeScript/Linaria configuration, general lint, a public barrel, project-owned
215
216
  review renderers (token tiles, brand preview, demo and screen frames), placeholder
216
217
  brand artwork with an app icon, a `Grid` (`GridItem`) on the grid tokens, an icon set with
@@ -269,11 +270,11 @@ architectural reuse does not require moving application services into the ADS.
269
270
  ADS-owned frame patterns use `--ux-*`. Do not introduce configurable or
270
271
  product-prefixed token vocabularies.
271
272
  - Shared token names, meanings, types, and alias relationships form the contract;
272
- project values and theme overrides can differ. Item imports retain existing
273
+ project values and per-theme halves can differ. Item imports retain existing
273
274
  values and add missing definitions. Explicit token-values imports adopt source
274
- values and theme variants.
275
- - Scaffold defaults are dense 13px UI text, a 4px grid, warm surfaces, slate
276
- text, rose accents, restrained elevation, and system fonts. Treat these as
275
+ values and their per-theme halves.
276
+ - Scaffold defaults are 16 px body text, the 2 px spacing rhythm, slate surfaces
277
+ and text, a rose accent, restrained elevation, and system fonts. Treat these as
277
278
  initial project values; honor requested branding and preserve existing themes.
278
279
  - Reuse existing public components, patterns, and shared icons when compatible.
279
280
  Add missing primitives in their owning layer; inspect exports rather than
@@ -297,7 +298,8 @@ in the existing token files using fixed ADS names, and original artwork plus its
297
298
  usage, backgrounds, credits, and licenses in `assets/brand/`. Keep fonts in
298
299
  `assets/fonts/`, with optional `tokens/fonts.css` imported first. Follow the
299
300
  canonical foundation import order: fonts (if present), colors, typography,
300
- spacing, elevation, base. Artwork can have fixed SVG colors; UI styles must
301
+ spacing, elevation, base, then the generated `themes.generated.css`. Artwork can
302
+ have fixed SVG colors; UI styles must
301
303
  still use tokens and must not override primitive state.
302
304
 
303
305
  For standard web icons, set `assets.iconSource` to an SVG under `assets/brand/`,
@@ -316,15 +318,19 @@ and license each artwork in `assets/brand/README.md`, pair dark-theme variants a
316
318
  `<name>.dark.svg`, show them through a component, and preview them in the Brand
317
319
  section (`brand/<Group>/<Name>` scenarios). Finished PNG/JPEG/WebP images and
318
320
  delivered `.ico`/`.icns` files are artwork too; ADS never enlarges a finished
319
- image. Read
320
- [branding.md](references/branding.md) (`ads://guides/branding`) before changing
321
+ image. Other products' logos are not brand artwork or glyphs: keep them, in their own
322
+ colors and under their owners' trademark and usage terms, in `assets/logos/` and
323
+ show them as images (a CSS mask over `currentColor` for a muted use); ADS generates
324
+ and checks nothing there.
325
+ Read [branding.md](references/branding.md) (`ads://guides/branding`) before changing
321
326
  brand artwork, icon outputs or glyphs.
322
327
 
323
328
  ## Accessibility
324
329
 
325
- Target WCAG 2.2 AA. `ads check` warns about contrast in every theme, target size, focus,
326
- text resize, reduced motion, text spacing, image alternatives and keyboard reach (`a11y-*`
327
- and `token-contrast`). Read [accessibility.md](references/accessibility.md)
330
+ Target WCAG 2.2 AA. `ads check` fails on contrast in every theme and brand, target size,
331
+ focus, text resize, reduced motion, text spacing, image alternatives and icon-only controls
332
+ (`a11y-*` and `token-contrast`), and lists keyboard reach for review (`a11y-keyboard`);
333
+ `ads audit` adds axe-core in the browser. Read [accessibility.md](references/accessibility.md)
328
334
  (`ads://guides/accessibility`) for the rules and the practice no tool can check.
329
335
 
330
336
  ## Design craft and mobile behavior
@@ -473,9 +479,10 @@ foundation CSS rather than assigning shared token values in JavaScript. Keep
473
479
  full-app integration harnesses and workflow coverage in application test support.
474
480
 
475
481
  Foundation CSS is checked, not an escape hatch. Value sheets define shared tokens
476
- on the document root/themes; `fonts.css` holds font-face metadata. `base.css` has
477
- three closed roles: root/body typography, canvas and theme defaults; limited native
478
- normalization; and global focus indicators/reduced-motion rules. Every selector
482
+ on the document root (per-theme halves) or a brand's `[data-brand]`; `fonts.css`
483
+ holds font-face metadata. `base.css` has three closed roles: root/body typography,
484
+ canvas and theme defaults; limited native normalization; and global focus
485
+ indicators/reduced-motion rules. Every selector
479
486
  branch, property and value must fit its role. Token-backed control skins, layout,
480
487
  interactive state rules and owner hooks are rejected even through `:where()`.
481
488
  Do not copy an unchecked upstream preflight or turn a component repair into a reset.
@@ -3,25 +3,58 @@
3
3
  Target WCAG 2.2 AA. ADS checks what it can from
4
4
  tokens and source; the rest is design and testing practice.
5
5
 
6
- ## What `ads check` reviews
6
+ ## What `ads check` checks
7
7
 
8
- All are warnings with the WCAG criterion in the message.
8
+ `a11y-keyboard` is a review item (it cannot see every key handler); the others are errors.
9
+ Each message names its WCAG criterion.
9
10
 
10
11
  | Rule | What it reviews | WCAG |
11
12
  |---|---|---|
12
- | `token-contrast` | Text, link, accent and status text on their backgrounds (4.5:1); focus and control borders on canvas and surface (3:1); in every theme | 1.4.3, 1.4.11 |
13
+ | `token-contrast` | Text, link, accent and status text on their backgrounds (4.5:1); focus and control borders on canvas and surface (3:1); in every theme and brand | 1.4.3, 1.4.11 |
13
14
  | `a11y-target-size` | `--control-height-*` of at least 24 px (44 px where touch is common) | 2.5.8 |
14
15
  | `a11y-focus` | `--focus-w` of at least 2 px, and a `:focus-visible` indicator in `base.css` | 2.4.7, 2.4.13 |
15
16
  | `a11y-text-resize` | Font-size tokens in `rem`, so text follows the reader's browser font size | 1.4.4 |
16
17
  | `a11y-reduced-motion` | Every non-zero `--dur-*` set to 0 under `prefers-reduced-motion`; infinite animations in components stopped there | 2.3.3, 2.2.2 |
17
18
  | `a11y-text-spacing` | `--leading-normal` of at least 1.5; `--content-max` under 80 characters | 1.4.8, 1.4.12 |
18
19
  | `a11y-image-alt` | `<img>` in components with `alt` (`alt=""` when decorative) | 1.1.1 |
20
+ | `a11y-icon-label` | A `<button>` or `<a>` in components whose only content is an icon has an accessible name (`aria-label`, or `IconButton` with its `label`) | 4.1.2 |
19
21
  | `a11y-keyboard` | No `onClick` on `div`, `span` and other non-interactive elements without `role`, `tabIndex` and a key handler; prefer `<button>` | 2.1.1 |
20
22
 
21
- Fix a warning in its owner: choose a different ramp step or size token, add the missing
23
+ Fix a finding in its owner: choose a different ramp step or size token, add the missing
22
24
  attribute, or move the interaction to a native control. Do not silence it with a one-off
23
25
  value.
24
26
 
27
+ ## Browser audit (axe-core)
28
+
29
+ Run `ads audit` after changing a component, pattern or composition scenario. It renders
30
+ each one in every declared brand and theme and runs axe-core's WCAG A/AA rules on the
31
+ scenario content.
32
+
33
+ ```sh
34
+ ads audit # every UI scenario, brand and theme
35
+ ads audit --scenario components/Button --theme dark --brand acme --json
36
+ ```
37
+
38
+ Each finding is an `a11y-axe` error on the scenario file, naming the axe rule, the WCAG
39
+ criterion, the themes and brands it fails in, the failing elements and the rule's help link:
40
+
41
+ ```text
42
+ design-system/components/Broken.scenario.tsx:1:1 [error:a11y-axe] axe button-name (critical), WCAG 4.1.2 in components/Broken [light, dark]: Buttons must have discernible text. 1 element: button. https://dequeuniversity.com/rules/axe/4.14/button-name?application=axeAPI
43
+ ```
44
+
45
+ - Fix the finding in the component that renders the failing element, not in the scenario.
46
+ - A `color-contrast` finding that `token-contrast` also reports is a token pair: change the
47
+ ramp step. One only the audit reports comes from a component pairing tokens itself: use
48
+ a role pair that `token-contrast` checks.
49
+ - Token and brand scenarios are skipped; name one with `--scenario` to audit it.
50
+ - To run the audit in `ads validate`/`ads_validate`, set `browserAudit: true` in that
51
+ policy (`validation` or `acceptance`); its findings then fail that policy, as they fail
52
+ `ads audit`. Draft and patch acceptance never run it.
53
+ - It needs the project's Playwright and browser, as captures do (`mcp.capture`).
54
+
55
+ A clean audit is not a pass: automated rules find only part of the WCAG failures. Keep the
56
+ manual checks below.
57
+
25
58
  ## What only design and testing establish
26
59
 
27
60
  - **Color is never the only signal.** Pair status color with text or an icon; underline links
@@ -40,4 +73,5 @@ value.
40
73
 
41
74
  Test by using each new view with the keyboard only, with a screen reader (VoiceOver, NVDA or
42
75
  Orca), at 200% zoom, and in both themes. Browser checks run against real previews (`ads
43
- verify`) can assert focus order and accessible names for important flows.
76
+ verify`) can assert focus order and accessible names for important flows; `ads audit`
77
+ covers the rule-checkable rest of every scenario.
@@ -1,7 +1,7 @@
1
1
  # Atomic style composition
2
2
 
3
3
  Use this guide when creating or migrating component/pattern styles, changing
4
- base/size/state combinations, or reviewing `atomic-composition-review` warnings.
4
+ base/size/state combinations, or reviewing `atomic-composition-review` items.
5
5
  It is also available as `ads://guides/atomic-styles` through ADS MCP.
6
6
 
7
7
  ## Why valid tokens can still render incorrectly
@@ -203,7 +203,7 @@ entire className; `<button {...props} className={cx(base, className)} />` compos
203
203
  it explicitly. Keep the product's intended forwarding behavior when fixing an
204
204
  overlap. Do not change the public API simply to make tracing easier.
205
205
 
206
- Warnings include a bounded `composition` path through traced helpers and
206
+ Review items include a bounded `composition` path through traced helpers and
207
207
  components. A `target` identifies a statically reached DOM element. This
208
208
  establishes source composition, not that a scenario mounted it or that its
209
209
  computed result is wrong. `writingModeDependent: true` identifies overlaps that
@@ -213,9 +213,9 @@ expand them safely. Token formulas, inheritance and runtime values still need
213
213
  review. A margin shorthand and `margin-inline: auto` may agree horizontally but
214
214
  disagree in vertical text, so horizontal equality alone is insufficient.
215
215
 
216
- ## Respond to a warning
216
+ ## Respond to a review item
217
217
 
218
- 1. Follow the warning's related file/line locations and inspect the actual `cx`
218
+ 1. Follow the review item's related file/line locations and inspect the actual `cx`
219
219
  composition. Variant lookups may contribute several possible combinations.
220
220
  2. In a current built preview, inspect computed properties and the winning CSS
221
221
  rules. Establish whether extraction order, specificity, writing mode or an
@@ -231,7 +231,7 @@ Increasing specificity, adding `!important`, copying styles into scenarios or
231
231
  moving component styling into `base.css` can hide the symptom while retaining
232
232
  the conflict. Prefer resolving the composition itself. If an overlap is
233
233
  intentional, document why its precedence is stable and verify the resulting
234
- behavior rather than changing product capabilities to silence a warning.
234
+ behavior rather than changing product capabilities to silence a review item.
235
235
 
236
236
  Use existing behavior contracts and `ads_verify` for important geometry. Register
237
237
  a check beside its owner, link its real scenario and use the project's browser
@@ -249,16 +249,16 @@ states, themes and supported writing modes. Wait for observable readiness; an
249
249
  event-stream connection can prevent `networkidle` from settling. A generic
250
250
  overlap scan cannot decide which dimensions the product intended. A failed
251
251
  registered geometry assertion is blocking through the existing verification
252
- contract; an overlap warning remains a review signal.
252
+ contract; an overlap review item remains a review signal.
253
253
 
254
254
  ## What ADS checks
255
255
 
256
- `atomic-composition-review` is a nonblocking warning, returned under `advisories`
257
- with `severity: "warning"`. CLI checks still exit successfully when there are no
258
- errors; MCP checks and mutations preserve the warning and its guidance URI.
256
+ `atomic-composition-review` is a nonblocking review item, returned under `advisories`
257
+ with `severity: "review"`. CLI checks still exit successfully when there are no
258
+ errors; MCP checks and mutations preserve the review item and its guidance URI.
259
259
 
260
260
  An unchanged advisory baseline is not evidence that the affected styles are
261
- correct. Triage warnings that reach an edited owner or its shared helpers against
261
+ correct. Triage review items that reach an edited owner or its shared helpers against
262
262
  the actual DOM classes and computed styles in a compiled scenario. Interaction
263
263
  checks may pass without measuring padding, alignment or sizing. When an intended
264
264
  layout is known, add a focused rendered assertion for that contract; when keeping
@@ -285,7 +285,7 @@ unresolved DOM targets and traversal limits produce bounded
285
285
  `atomic-composition-limit` informational advisories where known atomic styles
286
286
  reach an unresolved composition. Ordinary externally supplied className values
287
287
  remain open inputs, not guaranteed safe styles. Depth, work and alternative
288
- limits keep source inspection bounded; an unreported path or an empty warning
288
+ limits keep source inspection bounded; an unreported path or an empty review
289
289
  list does not establish visual correctness. Actual failed registered
290
290
  browser/behavior checks remain blocking; potentially intentional source overlaps
291
- remain warnings.
291
+ remain review items.
@@ -7,8 +7,9 @@ that it stays complete; the project chooses the look.
7
7
 
8
8
  Change values in the existing token files, never names: `--accent`,
9
9
  `--font-sans`, `--radius-md` and the other shared roles keep their meaning across
10
- projects. `--brand-*` and other foreign prefixes fail checks. Theme variants
11
- redefine the same names under `:root[data-theme="dark"]`. Components read shared
10
+ projects. `--brand-*` and other foreign prefixes fail checks. A value that differs per
11
+ theme is written as halves (`--color-accent-9-light`, `--color-accent-9-dark`), and a
12
+ second brand re-sets halves on `[data-brand]` (`ads://guides/tokens`). Components read shared
12
13
  roles, so a brand change is a token change.
13
14
 
14
15
  ## Artwork
@@ -17,13 +18,16 @@ Keep every original SVG in `assets/brand/`. Fixed colors are allowed inside the
17
18
  artwork; component styles still use tokens.
18
19
 
19
20
  - **Document it.** `assets/brand/README.md` names each file, what it is for, the
20
- backgrounds it suits, its credits and its license. `ads check` warns about an
21
+ backgrounds it suits, its credits and its license. `ads check` fails on an
21
22
  undescribed file (`brand-readme`) and a README without a license
22
23
  (`brand-license`).
23
24
  - **Pair light and dark variants by name.** `logo.svg` is the default (light
24
25
  theme); `logo.dark.svg` is the same artwork for dark backgrounds. The component
25
- that shows it renders both and hides one with a `:root[data-theme="dark"] &`
26
- selector, so the theme switch needs no script.
26
+ that shows it renders both and shows each in its own theme with the generated display
27
+ switches: `display: var(--display-light, block)` on the light one and
28
+ `display: var(--display-dark, block)` on the dark one. They follow the nearest
29
+ `data-theme`, so a dark section shows the dark logo; a brand's own logo uses
30
+ `--display-brand-<brand>` the same way.
27
31
  - **Show it in a component.** A logo appears in the UI through a project
28
32
  component (the starter's `components/Content/Logo`) that imports the SVG with
29
33
  `?url`. Artwork that nothing uses is reported (`brand-unused`).
@@ -119,14 +123,37 @@ Each file becomes `glyphs[name]` with `attributes` added where its `<svg>` does
119
123
  set them. `aliases.json` in the folder maps extra names to existing glyphs
120
124
  (`glyphAliases`); a file named like an alias is skipped. `ads assets` writes the
121
125
  module; `ads check` fails (`brand-output-stale`) when it is out of date. The icon
122
- component and its catalogue scenario read `glyphs` and `glyphAliases`.
126
+ component reads `glyphs` and `glyphAliases`. Review the set in the showcase's **Icons**
127
+ tab: every glyph at the size used beside text, so an outlier in weight or size stands out,
128
+ and each glyph on its grid at every icon size with its aliases and errors. Check a new or
129
+ redrawn glyph there before committing it.
123
130
 
124
131
  Keep every glyph on one `viewBox` (the starter uses 24 × 24) and draw in `currentColor`:
125
- `ads check` warns about a different or missing viewBox (`glyph-viewbox`) and fixed fill or
126
- stroke colors (`glyph-color`). Other products' logos keep their own colors: keep them as
127
- brand artwork in `assets/brand/` and show them as images, not glyphs. The starter's `Icon` sizes glyphs with `--icon-sm/md/lg/xl`
132
+ `ads check` fails on a different or missing viewBox (`glyph-viewbox`) and fixed fill or
133
+ stroke colors (`glyph-color`). Other products' logos keep their own colors: keep them in
134
+ `assets/logos/` (see [Other products' logos](#other-products-logos)), not in the glyph set. The starter's `Icon` sizes glyphs with `--icon-sm/md/lg/xl`
128
135
  (16/20/24/32 px; 16 beside body text), centers them beside text and hides decorative ones
129
136
  from assistive technology; `label` names a meaningful one. Icons have no states of their
130
137
  own: interactive icons go in `IconButton`, whose required `label` is its accessible name
131
138
  and tooltip and whose background carries hover, pressed and disabled. `a11y-icon-label`
132
- warns about icon-only buttons and links without a name.
139
+ fails on icon-only buttons and links without a name.
140
+
141
+ ## Other products' logos
142
+
143
+ Logos of other products (a chat service, a model provider, a sign-in provider) are
144
+ not the project's brand and not UI icons. Keep them in `assets/logos/`, each in the
145
+ colors its owner publishes, with a `README.md` that names each file, its source and
146
+ the usage terms it is used under. Their owners' trademark and usage guidelines
147
+ apply: use the official artwork, keep its colors and proportions, and do not change
148
+ it to match the project's look.
149
+
150
+ Show them as images: import the file with `?url` and render an `<img>` with an
151
+ `alt` that names the product, or `alt=""` beside text that already names it. Where
152
+ the logo must follow the text color (a muted or monochrome use), use the file as a
153
+ CSS mask over `currentColor`, so its shape stays and the color follows the theme.
154
+
155
+ ADS generates nothing from `assets/logos/` and does not treat its files as brand
156
+ artwork or glyphs: the brand checks (`brand-readme`, `brand-preview`,
157
+ `brand-unused`), `assets.iconSource` and `assets.targets` cover only
158
+ `assets/brand/`, and the glyph checks cover only `assets.glyphs.source`. Keep the
159
+ project's own colored artwork, including its pictograms, in `assets/brand/`.
@@ -90,14 +90,20 @@ For an initialized project, from its root:
90
90
  npx @reqvire-org/ads check
91
91
  npx @reqvire-org/ads tokens --json
92
92
  npx @reqvire-org/ads assets
93
+ npx @reqvire-org/ads audit
93
94
  ```
94
95
 
95
96
  Use the selected real distribution; for a local tarball, invoke
96
97
  `npx --yes --package "$ads_tool_package" ads check` instead. Other inspection
97
98
  commands accept a directory; init deliberately does not.
98
99
 
99
- Normal builds run native `ads check`, then generate configured standard brand
100
- icons in `.ds/assets/`. Set `assets.iconSource` to an SVG inside the ADS's
100
+ Normal builds run native `ads check`, then `ads assets`: configured standard brand
101
+ icons in `.ds/assets/`, committed `assets.targets`, the `assets.glyphs` module and the
102
+ generated `tokens/themes.generated.css` and `tokens/themes.generated.ts`. Run `ads
103
+ assets` after editing tokens or `ds.config.json` themes and brands without a running
104
+ showcase or MCP server (`themes-generated` fails while they are stale). `ads audit`
105
+ runs axe-core in every rendered UI scenario (`a11y-axe` errors; see
106
+ ads://guides/accessibility). Set `assets.iconSource` to an SVG inside the ADS's
101
107
  `assets/brand/`, relative to the ADS folder; no source means generation is a no-op.
102
108
  Integrate that directory through the app's existing asset mount. Fixed token
103
109
  names and prefixes are required; project values and artwork remain project-owned.
@@ -154,11 +154,14 @@ valueFrom: ["paint", "scheme.day", "scheme.night"],
154
154
  ```
155
155
 
156
156
  Register each matching `config.*.<path>` in `paintInputs`. The producer may write
157
- one declared field, or an exact `light-dark(${entry.scheme.day}, ${entry.scheme.night})`
158
- template over two declared fields. The normal key/map/root proof still applies.
159
- Raw constants, undeclared fields, extra writes and unknown transforms are rejected.
160
- The browser audit checks actual accessible color references in both branches;
161
- a local SVG URL or `none` is not a CSS color inside `light-dark()`.
157
+ one declared field, or a per-theme value built with the generated helpers from
158
+ `tokens/themes.generated.ts`: `themed({ light: entry.scheme.day, dark: entry.scheme.night })`
159
+ (keys exactly the declared themes) or `themedByScheme({ light: …, dark: … })` (each theme
160
+ takes the value for its color scheme). Every value is a declared field and the argument is
161
+ an object literal without spreads. The normal key/map/root proof still applies. Raw
162
+ constants, undeclared fields, `light-dark()`, extra writes and unknown transforms are
163
+ rejected. The browser audit checks an accessible color reference in every theme's branch;
164
+ a local SVG URL or `none` is not a color there.
162
165
 
163
166
  Families cannot overlap shared tokens, private runtime
164
167
  prefixes or other bindings. A broad family such as `--color-${key}` grants no
@@ -167,12 +170,12 @@ cannot be established. Registered paint consumers list their allowed binding IDs
167
170
  borrowing a peer's binding family or private runtime variable remains invalid. Bindings are scoped
168
171
  to their actual root; portals outside it need deliberate project integration.
169
172
 
170
- A registered binding producer may combine two accessible color references as
171
- `light-dark(var(--light-token), var(--dark-token))`. The App paint audit checks
172
- both branches and their observed effect in the active color scheme. Raw colors,
173
- undefined tokens and SVG URLs inside this color function remain invalid.
173
+ A registered binding producer gives a per-theme value with `themed()` or
174
+ `themedByScheme()`; its output is `var(--ads-if-<theme>, <reference>)` once per declared
175
+ theme, in declared order. The App paint audit checks every branch and its observed effect
176
+ in the active theme. Raw colors, undefined tokens and SVG URLs in a branch remain invalid.
174
177
  This derived binding form does not widen public paint-input types; use constrained
175
- references for each theme input and verify both color schemes in browser checks.
178
+ references for each theme input and verify every theme in browser checks.
176
179
 
177
180
  The App audit checks current mounted instances, accessible values, local SVG
178
181
  resources and computed paint-property responses. Visibility and complete rendered
@@ -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
 
@@ -41,6 +41,10 @@ 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; draft and patch acceptance do not run it. See
47
+ ads://guides/accessibility.
44
48
  - Draft create, edit and show are preview-only; they trigger neither policy.
45
49
  `ads_verify` explicitly runs selected checks independently of either policy.
46
50
  - Builds, hooks and CI trigger a policy only when their scripts invoke it. Use
@@ -49,11 +53,11 @@ implicitly requiring them at acceptance.
49
53
  disable tests or weaken configuration to make a failing change pass.
50
54
 
51
55
  Defaults: both script lists are empty, acceptance `behaviorChecks:false`,
52
- validation `behaviorChecks:true`. No lint/test/build script names are inferred.
56
+ validation `behaviorChecks:true`, both `browserAudit:false`. No lint/test/build script names are inferred.
53
57
  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.
58
+ MCP arguments. `mcp.mutationChecks` is a configuration error: list those scripts in
59
+ `acceptance.checks` and set `acceptance.behaviorChecks`. `mcp.mutationCheckTimeoutMs`
60
+ bounds each project script; behavior profiles have separate budgets.
57
61
 
58
62
  Report the chosen policy, scope and revision. Skipped tests are not passed tests;
59
63
  acceptance evidence is not complete-validation evidence. The two policies keep