@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
@@ -12,6 +12,7 @@ import { checkCandidate, checkCommand, projectChecks } from "./validation-checks
12
12
  import { acceptance } from "./evidence.mjs";
13
13
  import { inspectScenarios } from "./scenarios.mjs";
14
14
  import { inspectBuildStatus } from "./mcp/build-status.mjs";
15
+ import { routeFindings } from "./finding-rules.mjs";
15
16
 
16
17
  const hash = value => createHash("sha256").update(value).digest("hex");
17
18
  function toolInputs() {
@@ -86,7 +87,7 @@ export function createValidationController(directory, { previewWork } = {}) {
86
87
  const behaviors = inspectBehaviors(options);
87
88
  units = options.config[policy].behaviorChecks ? (scope === "all" ? behaviors.contracts.map(contract=>contract.unit) : affectedBehaviorUnits(options,changed)) : [];
88
89
  onProgress?.({stage:"selection",scope,requestedScope,units,elapsedMs:Date.now()-startedAt});
89
- const requirePreviews=policy === "validation" || units.length>0;
90
+ const requirePreviews=policy === "validation" || units.length>0 || options.config[policy].browserAudit;
90
91
  if (requirePreviews && options.config.mcp.previewManifest && options.config.mcp.previewWatch) {
91
92
  stage("preview-build");
92
93
  const { startAdsMcp } = await import("./mcp/server.mjs");
@@ -119,6 +120,22 @@ export function createValidationController(directory, { previewWork } = {}) {
119
120
  checks.push({name:"registered-behavior",passed:result.ok});
120
121
  if (!result.ok && !result.diagnostics.length) diagnostics.push({rule:"validation-behavior",message:"Registered behavior checks did not all pass. Inspect the recorded outcomes."});
121
122
  } else checks.push({name:"registered-behavior",skipped:true,reason:!options.config[policy].behaviorChecks ? `Not required by ${policy} policy.` : scope === "all" ? "No registered behavior contracts." : "No affected behavior contracts."});
123
+ if (options.config[policy].browserAudit) {
124
+ // Rendered axe-core audit per scenario, brand and theme. a11y-axe findings are errors:
125
+ // they fail this policy.
126
+ stage("browser-audit");
127
+ const { runBrowserAudit } = await import("./browser-audit.mjs");
128
+ try {
129
+ const audit = await runBrowserAudit(root, {previewHost,signal,onProgress:value=>{ progress={...value,completed:checks.length}; onProgress?.(progress); }});
130
+ const routed=routeFindings([],audit.findings);
131
+ diagnostics.push(...routed.diagnostics); advisories.push(...routed.advisories);
132
+ checks.push({name:"browser-accessibility-audit",passed:!routed.diagnostics.length,engine:audit.engine,scenarios:audit.scenarios,themes:audit.themes,...(audit.brands?{brands:audit.brands}:{}),renders:audit.runs,errors:routed.diagnostics.length,reviews:routed.advisories.length});
133
+ } catch (error) {
134
+ if (signal.aborted) throw error;
135
+ checks.push({name:"browser-accessibility-audit",passed:false});
136
+ diagnostics.push({rule:"browser-audit",message:error.message});
137
+ }
138
+ } else checks.push({name:"browser-accessibility-audit",skipped:true,reason:`Not enabled by ${policy}.browserAudit.`});
122
139
  } catch (error) { diagnostics.push(error.diagnostic ?? {rule:signal.aborted ? "validation-cancelled" : "validation-execution",message:error.message}); }
123
140
  finally { try { await previewHost?.close(); } finally { releasePreview?.();active=undefined;progress=undefined;finish(); } }
124
141
  return complete();
@@ -20,9 +20,20 @@ function auditPaintBindings({ container = document.getElementById("root"), bindi
20
20
  const resolved = view.getComputedStyle(node).getPropertyValue(name).trim();
21
21
  return !!resolved && view.CSS.supports("color", resolved);
22
22
  }
23
- const themed = /^light-dark\(\s*(var\(\s*--[\w-]+\s*\)|currentColor)\s*,\s*(var\(\s*--[\w-]+\s*\)|currentColor)\s*\)$/.exec(value);
24
- if (themed)
25
- return view.CSS.supports("color", value) && reference(themed[1], node, descriptor, seen) && reference(themed[2], node, descriptor, seen);
23
+ const themes = Array.isArray(descriptor.themes) ? descriptor.themes : [];
24
+ if (themes.length && value.startsWith("var(--ads-if-")) {
25
+ const branch = /^var\(\s*--ads-if-([a-z][a-z0-9-]*)\s*,\s*(var\(\s*--[\w-]+\s*\)|currentColor|none)\s*\)/;
26
+ let rest = value;
27
+ const branches = [];
28
+ while (rest) {
29
+ const match = branch.exec(rest);
30
+ if (!match)
31
+ return false;
32
+ branches.push(match);
33
+ rest = rest.slice(match[0].length).trimStart();
34
+ }
35
+ return branches.length === themes.length && branches.every((match, index) => match[1] === themes[index] && reference(match[2], node, descriptor, seen));
36
+ }
26
37
  const resource = /^url\(\s*(["']?)#([^\s"'()#\\\p{Cc}]+)\1\s*\)$/u.exec(value);
27
38
  if (resource && view.CSS.supports("fill", value)) {
28
39
  const candidates = [...document2.querySelectorAll("[id]")].filter((item) => item.id === resource[2]);
package/docs/ADS.md CHANGED
@@ -79,8 +79,10 @@ App presentation comes from the selected compiled scenario; reusable review layo
79
79
  production widgets inside the client or scenario.
80
80
 
81
81
  There are five sections: Brand (first, shown only when the project has scenarios in
82
- `brand/`), Tokens, Components, Patterns and Composition. Brand previews are grouped by
83
- folder like components and have no token samples. There are
82
+ `brand/`), Tokens, Components, Patterns and Composition, plus an Icons tab after Tokens
83
+ when the project has a glyph set (`assets.glyphs`), rendered natively from
84
+ `ads://project/icons`. Brand previews are grouped by folder like components and have no
85
+ token samples. There are
84
86
  no required `TokensPage`/`ComponentsPage`/`PatternsPage`/`CompositionPage` files.
85
87
  Legacy custom browsing pages remain checked when present, but new projects use
86
88
  the built-in client. Its tooling CSS is separate from the project style contract.
@@ -250,16 +252,23 @@ bindings retain their narrow runtime contracts; they are not static design scale
250
252
  ### Themes
251
253
 
252
254
  A theme is a named set of values for the same tokens. `themes` in `ds.config.json` lists
253
- them with the color scheme each uses (`light` or `dark`); the first is the default and holds
254
- its values on `:root`. Other themes override values under `[data-theme="<name>"]`, which
255
- applies to the page on `<html>` or to one section on any element; the foundation guard
256
- accepts these selectors as it does the root. Because a custom property resolves `var()`
257
- where it is declared, roles that alias ramp steps are declared on `:root, [data-theme]` so a
258
- themed section resolves them against its own values. Contrast reviews, captures, the
259
- showcase theme button and `ads tokens --format dtcg --theme` work per declared theme;
260
- `theme-undeclared`, `theme-new-token`, `theme-coverage` and `theme-empty` keep theme
261
- definitions consistent. Switching themes at runtime (user choice, `prefers-color-scheme`,
262
- remembering the choice) belongs to the application.
255
+ them with the color scheme each uses (`light` or `dark`); the first is the default. Optional
256
+ `brands` add a second axis; the first brand is the default. A token that differs per theme is
257
+ authored as one plain half per theme on `:root` (`--x-light`, `--x-dark`), halves refer only
258
+ to halves, and a brand re-sets halves on `[data-brand="<name>"]`. ADS generates
259
+ `themes.generated.css` (theme switches, display switches `--display-<theme>` and
260
+ `--display-brand-<brand>`, one resolver per themed token, and the `prefers-color-scheme`
261
+ block under `followSystemTheme`) and `themes.generated.ts` (every color token resolved per
262
+ theme and brand, `themed()`/`themedByScheme()` for runtime values). Both are generated by
263
+ `ads assets`, the showcase and the MCP server, committed, and checked for freshness
264
+ (`themes-generated`). `data-theme` and `data-brand` apply to the page on `<html>` or to a
265
+ section on any element; every element follows its nearest theme and brand. Token values
266
+ under `[data-theme]` or `prefers-color-scheme` (`theme-old-form`), theme or brand selectors
267
+ in components (`theme-selector`) and `light-dark()` (`theme-light-dark`) are errors, as are
268
+ the coverage, half-reference and brand rules. Contrast checks, captures, the browser audit,
269
+ the showcase theme and brand controls and `ads tokens --format dtcg --theme/--brand` work
270
+ per declared theme and brand. Letting the user choose a theme and remembering it belongs to
271
+ the application.
263
272
 
264
273
  Shared token previews and sample coverage live under the configured token directory.
265
274
  The project mount adapter imports its foundation for both runtime and independent
@@ -267,16 +276,21 @@ token previews. No owner stylesheet dependencies are injected into preview entri
267
276
  `ads_prepare_token_samples` reconciles real shared bindings from project-selected
268
277
  properties/probes; it does not invent missing semantics.
269
278
 
270
- `ads check` reviews token values as advisories: `token-contrast` (WCAG AA for the roles
271
- that meet on screen, in every theme, through aliases), `token-rhythm` (`--space-N` =
272
- N × 2 px) and `token-overlap-review` (equal values within one token family). The
273
- accessibility guards (`a11y-*`) read tokens and runtime component source. `ads tokens
279
+ `ads check` checks token values: `token-contrast` (WCAG AA for the roles that meet on
280
+ screen, in every theme and brand, through aliases) and `token-rhythm` (`--space-N` = N × 2
281
+ px) are errors; `token-overlap-review` (equal values within one token family) is a review
282
+ item. The accessibility guards (`a11y-*`) read tokens and runtime component source;
283
+ `ads audit` adds axe-core in the rendered scenarios (`a11y-axe`). `ads tokens
274
284
  --format dtcg` exports the tokens as W3C Design Tokens JSON. See the
275
285
  [token guide](../skills/ads-designer/references/design-data.md) and the
276
286
  [accessibility guide](../skills/ads-designer/references/accessibility.md).
277
287
 
278
- `token-overlap-review` warns about identical normalized shared definitions across
279
- their declared theme scopes. It never merges semantic roles or blocks a build merely
288
+ ADS findings are errors, which fail `ads check`, validation and acceptance, or review items,
289
+ which are listed and never block; `info` items note an analysis limit. No configuration
290
+ changes a finding's kind.
291
+
292
+ `token-overlap-review` is a review item for identical normalized shared definitions
293
+ across their declared theme scopes. It never merges semantic roles or blocks a build merely
280
294
  because values coincide. Shared Data boundary violations are errors. See the
281
295
  [portable Data guide](../skills/ads-designer/references/design-data.md).
282
296
 
@@ -350,8 +364,8 @@ Store original branding and its usage, credits, and licenses in
350
364
  `assets/brand/`, and fonts in `assets/fonts/`. Configure generated web icons,
351
365
  committed targets (`assets.targets`), glyph sets (`assets.glyphs`) and asset
352
366
  mounts as described in the [branding guide](GUIDE.md#branding); `ads check` fails
353
- on stale committed outputs and warns about undescribed, unlicensed, unpreviewed or
354
- unused artwork.
367
+ on stale committed outputs and on undescribed, unlicensed or unpreviewed artwork, and
368
+ lists unused artwork for review.
355
369
 
356
370
  Before importing, compare the selected source and its dependencies with the
357
371
  destination's framework, public APIs, shared tokens, styling ownership and
@@ -432,9 +446,9 @@ ads check → ads assets → existing prebuild → existing build
432
446
  before asset generation. Additional project linters run only through explicit scripts.
433
447
  `lint-config` is an optional adapter for projects that choose Oxlint. `ads assets`
434
448
  generates configured browser icons from `assets.iconSource` into ignored `.ds/assets/`,
435
- renders committed `assets.targets` (recorded in `assets/generated.json`) and writes the
436
- `assets.glyphs` module; `ads check` fails when a committed output or the glyph module is
437
- stale.
449
+ renders committed `assets.targets` (recorded in `assets/generated.json`), writes the
450
+ `assets.glyphs` module and writes `themes.generated.css` and `themes.generated.ts`; `ads
451
+ check` fails when a committed output, the glyph module or a generated theme file is stale.
438
452
  A failed check or generation stops the build. Keep the project's CSS lint,
439
453
  type checks, behavior tests, and framework compilation in its build/test flow.
440
454
  `ads init` preserves existing lint tools and build commands.
@@ -467,10 +481,10 @@ The checks enforce the architecture's ownership boundaries:
467
481
  | Assets | Source/public collisions and configured generated artifacts in source are rejected |
468
482
 
469
483
  Pointer capture without locally visible capture-loss cleanup produces a
470
- nonblocking advisory. Review delegated cleanup and browser behavior; neither a
471
- warning nor a handler's presence establishes lifecycle correctness.
484
+ nonblocking review item. Review delegated cleanup and browser behavior; neither a
485
+ review item nor a handler's presence establishes lifecycle correctness.
472
486
 
473
- Potential atomic CSS overlaps produce `atomic-composition-review` warnings with
487
+ Potential atomic CSS overlaps produce `atomic-composition-review` review items with
474
488
  related declarations and a guidance URI. They are nonblocking, including during
475
489
  guarded mutations: valid CSS can intentionally overlap. Read
476
490
  [atomic style composition](../skills/ads-designer/references/atomic-styles.md) for causes, matching-property fixes
@@ -478,7 +492,7 @@ and the source review's limits. Registered rendered checks can enforce a
478
492
  project's intended computed geometry; token validity alone cannot establish it.
479
493
  Bounded tracing follows local helpers and explicit `className` forwarding;
480
494
  diagnostics distinguish a reached DOM target from informational analysis limits.
481
- Neither a trace nor an absent warning establishes the intended rendered result.
495
+ Neither a trace nor an absent review item establishes the intended rendered result.
482
496
 
483
497
  Document a new ownership exception with its guard/configuration change and
484
498
  tests. Passing static checks establishes only the policies and source formats
@@ -196,7 +196,7 @@ builds keep their own bundler's splitting and caching policy.
196
196
 
197
197
  Atomic merging matches property/selector/condition keys; it does not resolve
198
198
  every shorthand/logical-property overlap. ADS reports detectable composition
199
- risks as nonblocking warnings with guidance, while registered rendered checks
199
+ risks as nonblocking review items with guidance, while registered rendered checks
200
200
  can enforce actual geometry. See the skill-local
201
201
  [atomic style composition guide](../skills/ads-designer/references/atomic-styles.md).
202
202
  Bounded source tracing follows local class helpers and explicit component
@@ -318,7 +318,8 @@ completion requirements, build integration and recovery.
318
318
  Humans and coding agents inspect the same project through MCP. The showcase is
319
319
  **a minimal shell plus an MCP client and Apps host**, shipped as development
320
320
  tooling. Its header, section tabs (Brand, shown first when the project previews its
321
- artwork, then Tokens, Components, Patterns and Composition), collapsible left menu,
321
+ artwork, then Tokens, Icons when the project has a glyph set, Components, Patterns and
322
+ Composition), collapsible left menu,
322
323
  grid overlay and theme switches and preview area stay neutral. The grid overlay draws
323
324
  the project's `--grid-*` columns over every preview through the App's host context, so
324
325
  alignment is checked on real previews without a second renderer. The client discovers entries, invokes tools, forwards App
@@ -397,8 +398,9 @@ exists.
397
398
 
398
399
  ### The foundation has a narrow styling role
399
400
 
400
- Shared token sheets define values on the document root and its themes. The
401
- import-only entry loads them in canonical order. `fonts.css` declares font faces;
401
+ Shared token sheets define values on the document root, per-theme values as halves, and
402
+ brand values on `[data-brand]`; the generated `themes.generated.css` resolves them. The
403
+ import-only entry loads them in canonical order, the generated sheet last. `fonts.css` declares font faces;
402
404
  `base.css` establishes shared native defaults and normalization. Components and
403
405
  patterns own their layout, skin, states and animations in Linaria.
404
406
 
@@ -438,8 +440,8 @@ patterns as production: application adapters supply live data and effects;
438
440
  scenario adapters supply fixture data, local state and simulated services.
439
441
  Reassembling a second screen from shared primitives still allows design drift.
440
442
 
441
- The server discovers one path-derived scenario registry. The showcase's four
442
- sections—Tokens, Components, Patterns and Composition—browse that same registry
443
+ The server discovers one path-derived scenario registry. The showcase's scenario
444
+ sections (Brand, Tokens, Components, Patterns and Composition) browse that same registry
443
445
  through MCP results. They do not initialize the entry or define
444
446
  its UI. Every preview uses `?scenario=<id>`; discovered `kind` selects its section,
445
447
  including token scenarios colocated with component/pattern owners. Existing
@@ -741,7 +743,12 @@ its master hash, settings and output hash. A glyph set (`assets.glyphs`) turns a
741
743
  icon SVGs into one typed module. Freshness is checked by comparing recorded hashes, never by
742
744
  rendering, so the result is the same on every machine; a finished image is never enlarged.
743
745
  The starter's `Icon` and `IconButton` read that module: icons take `currentColor`, pair
744
- their size with text, and an icon-only button always has a label.
746
+ their size with text, and an icon-only button always has a label. The showcase renders the
747
+ glyph set itself in its Icons tab, from the folder and the same default attributes the
748
+ module uses, so a set is reviewed without a project scenario. Other products' logos
749
+ live in `assets/logos/`, outside both the brand artwork and the glyph set: they keep their
750
+ owners' colors, render as images (or a mask silhouette for a muted use), and ADS generates
751
+ and checks nothing there.
745
752
 
746
753
  ## Build checks keep the architecture in place
747
754
 
@@ -750,20 +757,40 @@ output. These checks enforce token use, source ownership, public imports,
750
757
  showcase coverage, component state boundaries, and separation of runtime code from development
751
758
  fixtures. Component-specific usage rules extend the shared checks when needed.
752
759
 
753
- Themes are declared in `ds.config.json` and are only value sets: every theme shares the
754
- same token names, and a theme applies to the page or to one section through
755
- `[data-theme]`. The declaration is the one theme list the showcase, captures, preview
756
- host context, contrast review and token export read, so a project can add a high-contrast
757
- or brand theme without tool changes.
758
-
759
- Token, brand and accessibility reviews run in the same check as advisories: they warn
760
- with a location and a reference (WCAG criteria for accessibility) but never fail a
761
- project's build. They cover contrast between the roles that meet on screen in every theme,
762
- the 2 px spacing rhythm, duplicate values within a token family, brand artwork that is
763
- undescribed, unlicensed, unpreviewed or unused, glyphs off the shared viewBox or with fixed
764
- colors, and accessibility rules readable from tokens and source (target size, focus, text
765
- resize, reduced motion, text spacing, image alternatives, keyboard reach, icon-only
766
- controls). Stale or hand-edited committed brand outputs are errors, since they ship.
760
+ Themes and brands are declared in `ds.config.json` and are only value sets: every theme and
761
+ brand shares the same token names. A theme sets the color mode and a brand sets identity
762
+ values (an accent ramp, a font), so a white-label product needs one brand per customer
763
+ rather than one theme per customer and mode. The declaration is the one list the showcase,
764
+ captures, preview host context, contrast review, browser audit and token export read, so a
765
+ project can add a high-contrast theme or a brand without tool changes.
766
+
767
+ A token that differs per theme is authored as one plain half per theme (`--x-light`,
768
+ `--x-dark`) on `:root`, and a brand re-sets its halves on `[data-brand]`. ADS generates
769
+ `themes.generated.css` from them: each `[data-theme]` sets inherited switch properties,
770
+ and each themed token resolves from its halves through those switches on every theme and
771
+ brand anchor. Custom properties inherit and resolve where they are declared, so every
772
+ element takes the halves of its nearest brand and the switch of its nearest theme, at any
773
+ nesting depth and in any order, with plain CSS variables. The same switches give display
774
+ switches (`--display-<theme>`, `--display-brand-<brand>`) for content that belongs to one
775
+ theme or brand. Theme and brand selectors are not used, in tokens or components, because
776
+ CSS resolves them by specificity and order, not by nearest ancestor.
777
+
778
+ Because every themed value is a plain half, ADS also resolves every color token for every
779
+ theme and brand ahead of time into `themes.generated.ts`. Renderers that need colors as
780
+ values (Canvas, WebGL, SVG graphs) look them up there for the element's nearest context,
781
+ instead of asking the browser to normalize a color per drawn item.
782
+
783
+ ADS findings are errors, review items or info items. An error is a rule ADS can decide: it
784
+ fails `ads check`, validation and acceptance, and no setting turns it off. Token, theme, brand,
785
+ glyph and accessibility rules read from tokens and source are errors: contrast between the
786
+ roles that meet on screen in every theme and brand, the 2 px spacing rhythm, theme and brand
787
+ coverage, brand artwork that is undescribed, unlicensed or unpreviewed, glyphs off the
788
+ shared viewBox or with fixed colors, controls padded off their size, target size, focus,
789
+ text resize, reduced motion, text spacing, image alternatives and icon-only controls. A
790
+ review item names something source analysis cannot settle (overlapping atomic declarations,
791
+ equal token values with possibly different roles, keyboard reach, unused artwork, color reads
792
+ in a render path); it is shown with guidance and never blocks. An info item notes an analysis
793
+ limit. Stale or hand-edited generated outputs are errors, since they ship.
767
794
 
768
795
  Static checks establish the policies and source formats they cover. Behavior
769
796
  tests and browser review verify the resulting accessibility, layout, themes,
@@ -974,7 +1001,7 @@ bindings keep their existing narrow contracts. Shared token previews consume the
974
1001
  same foundation through the project mount adapter.
975
1002
 
976
1003
  Shared tokens with identical normalized theme/condition definitions receive a
977
- nonblocking `token-overlap-review` advisory. Equal values do not establish equal
1004
+ nonblocking `token-overlap-review` review item. Equal values do not establish equal
978
1005
  meaning; ownership/value-source violations remain errors. See the
979
1006
  [shared Data contract](ADS.md#shared-data-and-component-mappings).
980
1007
 
package/docs/CACHING.md CHANGED
@@ -94,6 +94,5 @@ Turbo is a normal dependency of the ADS tool package, which a project installs a
94
94
  `@reqvire-org/ads` in `devDependencies`. Hermit should pin Bun >=1.4.1 for ADS;
95
95
  it should not install a second global Turbo executable or manage a project
96
96
  `turbo.json`. Keep the project's other Rust/native/Node tools as its build requires.
97
- This ADS repository and the local shadcn example have no Hermit environment.
98
- Reqvire pins Bun 1.4.2. Neezler's native-client Hermit environment also supplies
99
- Bun 1.4.2 for the root ADS/frontend commands invoked by its Makefile.
97
+ When a Makefile or script runs ADS commands, run them inside the Hermit environment so they
98
+ use the pinned Bun.
package/docs/CHANGELOG.md CHANGED
@@ -1,34 +1,118 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.46
3
+ ## 0.3.47
4
4
 
5
5
  <!-- ads-local-tests:start -->
6
- Local verification: **650/650 passed** with `ADS_TEST_BUN=1 npm test`.
7
- Tested commit: `afec4852fe4b50a8fb543dfaa6b22fdd520179e6`; Node v24.13.0, Bun 1.4.1.
8
- Completed 2026-10-29T23:52:19.077Z (1010 seconds).
6
+ Local verification: **703/703 passed** with `ADS_TEST_BUN=1 npm test`.
7
+ Tested commit: `193a00129755b847a3b8cbdf54360828b2b5c9e3`; Node v24.13.0, Bun 1.4.1.
8
+ Completed 2026-10-30T22:07:04.485Z (1059 seconds).
9
9
 
10
10
  <!-- ads-local-test-proof
11
11
  {
12
12
  "schema": 1,
13
- "version": "0.3.46",
14
- "commit": "afec4852fe4b50a8fb543dfaa6b22fdd520179e6",
15
- "sourceSha256": "91033481a35eb5f4ea30f29653b2c160f9cb66e4ccde14ca1c37f2e664d042ad",
13
+ "version": "0.3.47",
14
+ "commit": "193a00129755b847a3b8cbdf54360828b2b5c9e3",
15
+ "sourceSha256": "3d1e3ecff8be39ae212932e0d5e8060128b923b9b1c2c8ba6cbaf466d54e51f7",
16
16
  "command": "ADS_TEST_BUN=1 npm test",
17
17
  "result": "pass",
18
- "tests": 650,
19
- "pass": 650,
18
+ "tests": 703,
19
+ "pass": 703,
20
20
  "fail": 0,
21
21
  "cancelled": 0,
22
22
  "skipped": 0,
23
23
  "node": "v24.13.0",
24
24
  "bun": "1.4.1",
25
- "completedAt": "2026-10-29T23:52:19.077Z",
26
- "durationMs": 1010063,
27
- "logSha256": "b212a0e52451a1d9389dc4687aaec08dd6d566df4f6b4ce4f8da63514ab09cae"
25
+ "completedAt": "2026-10-30T22:07:04.485Z",
26
+ "durationMs": 1059305,
27
+ "logSha256": "27baeaadeec20d80ff0aabbe9fbe3153158ef3ddfd45fe3e5dfed73f05a575db"
28
28
  }
29
29
  -->
30
30
  <!-- ads-local-tests:end -->
31
31
 
32
+ - **Findings are errors, review items or info items.** Errors fail `ads check`,
33
+ validation and acceptance; review items (`atomic-composition-review`, `token-overlap-review`,
34
+ `pointer-capture-review`, `scenario-exercise-review`, `a11y-keyboard`, `brand-unused`,
35
+ `render-color-probe`) are listed with guidance and never block; info items
36
+ (`atomic-composition-limit`) note an analysis limit. `src/finding-rules.mjs` classifies
37
+ every finding id. Every rule that was a warning and that ADS can decide is now an error:
38
+ `token-contrast`, `token-rhythm`, `a11y-target-size`, `a11y-focus`, `a11y-text-resize`,
39
+ `a11y-reduced-motion`, `a11y-text-spacing`, `a11y-image-alt`, `a11y-icon-label`,
40
+ `glyph-viewbox`, `glyph-color`, `brand-readme`, `brand-license`, `brand-preview` and the
41
+ theme and brand rules. CLI output reads `[error:…]` and `[review:…]` with a count of
42
+ each; JSON review items carry `severity: "review"`. No setting changes a finding's kind:
43
+ `enforce` is removed, and a `ds.config.json` that sets it fails to load.
44
+ - **Themes are written as per-theme halves.** A token that differs per theme has one plain
45
+ value per declared theme on `:root` (`--color-accent-9-light`, `--color-accent-9-dark`).
46
+ ADS generates `tokens/themes.generated.css` (theme switches and one resolver per themed
47
+ token), the last foundation import. `ads assets` writes it, and the showcase and MCP
48
+ server rewrite it whenever tokens or `ds.config.json` change; `ads check` fails when it
49
+ is missing or stale (`themes-generated`). `data-theme` on any element themes that
50
+ section and follows the nearest ancestor at any depth, with plain CSS variables. Values
51
+ under `[data-theme]` or `prefers-color-scheme` are an error (`theme-old-form`); a themed
52
+ token needs a half for every theme (`theme-coverage`); new errors
53
+ `theme-half-reference`, `theme-half-conflict`; `theme-undeclared` is gone. Projects
54
+ rewrite their token sheets; there is no migration.
55
+ - **Display switches.** The generated file defines `--display-<theme>` and
56
+ `--display-brand-<brand>`, `none` outside the nearest theme or brand: show a dark logo
57
+ with `display: var(--display-dark, block)`. Styling a component by a `[data-theme]` or
58
+ `[data-brand]` ancestor selector is an error (`theme-selector`), since it ignores the
59
+ nearest section. The starter's Logo and BrandPreview use the switches.
60
+ - **Renderer palette** (issue #1). ADS generates `tokens/themes.generated.ts` with the CSS:
61
+ every color token resolved for every theme and brand as `{ css, rgba }` (aliases, halves,
62
+ `color-mix()` and all CSS color syntaxes; per-channel sRGB clipping as canvas does;
63
+ unresolvable tokens listed in `unresolved`), with `contexts`, `themeSchemes`,
64
+ `themed()` and `themedByScheme()`. The starter's `controllers/Palette` gives
65
+ `paletteFor(element)`, `paletteContext(element)`, `observePalette(element, callback)` and
66
+ `resolveColor(element, value)`. In a 300-node hover benchmark, per-node color probing
67
+ took ~300 ms per 1,000 lookups with 6,000 DOM insertions; the palette takes ~0.2 ms
68
+ with none. Palette colors
69
+ match Chrome within 1/255 per channel. `render-color-probe` (review) flags color reads
70
+ from the page in per-item render paths. Existing projects get the file on the next
71
+ `ads assets` or showcase/MCP start; until then `ads check` reports it missing.
72
+ - **Runtime per-theme values** use `themed({ light, dark, … })` or `themedByScheme({ light,
73
+ dark })` from `themes.generated.ts`, which follow the nearest theme like token halves and
74
+ work with any number of themes. `light-dark()` is an error in token sheets, component CSS
75
+ and component string literals (`theme-light-dark`), and binding producers no longer accept
76
+ `light-dark()` templates; they accept these helpers over declared fields.
77
+ - **`followSystemTheme: true`** makes a page without `data-theme` follow the OS
78
+ `prefers-color-scheme`, taking the first declared theme with that scheme; an explicit
79
+ `data-theme` wins.
80
+ - **Brands.** `brands` in `ds.config.json` (the first is the default) adds a brand axis
81
+ beside the themes: a brand sets its own values, with every half of a themed token it
82
+ changes, on `[data-brand="<name>"]`. Brand and theme are independent and each follows
83
+ the nearest ancestor. The showcase has a brand selector, captures and previews take a
84
+ brand, contrast is checked for every brand in every theme, and
85
+ `ads tokens --format dtcg --brand <name>` exports one. Errors `brand-undeclared`,
86
+ `brand-theme-value`, `brand-coverage`, `brand-new-token`, `brand-empty`.
87
+ - **`ads audit`** runs axe-core (WCAG A/AA rules) in every component, pattern and
88
+ composition scenario, in every brand and theme, and reports `a11y-axe` errors with the
89
+ rule, WCAG criterion, failing elements and help link; it exits 1 on findings.
90
+ `browserAudit: true` in a validation or acceptance policy runs it there.
91
+ - **`control-padding`** (error): a control sized with `--control-height-<size>` pads its
92
+ sides with `--control-padding-<size>`, or `--control-inset` inside a track, never with a
93
+ `--space-*` step.
94
+ - **Icons tab.** The showcase renders the glyph set natively: every glyph at the size used
95
+ beside text, each glyph on its grid at every `--icon-*` size with its aliases and glyph
96
+ errors, a search by name or alias, and the logos in `assets/logos/` in color and muted.
97
+ It refreshes when glyphs, aliases, logos or icon tokens change. The starter's Icon
98
+ scenario now shows the component in use instead of cataloguing the set.
99
+ - **Other products' logos** live in `assets/logos/`, apart from brand artwork and glyphs:
100
+ they keep their owners' colors and render as images (or a mask over `currentColor` when
101
+ muted). ADS generates and checks nothing there.
102
+ - `ads check` reports `glyph-aliases` errors (invalid `aliases.json`, an alias naming a
103
+ missing glyph) with their line; `ads assets` fails with the same message.
104
+ - Fixed: a cached or warm-retained preview graph reused its scenario metadata by id, so a
105
+ graph built before discovery found a scenario's paint bindings kept serving it without
106
+ them while the compiled bytes were unchanged. Cached and retained graphs now take
107
+ `paintBindings`, `paintAudit`, title, kind and samples from the current registry, and a
108
+ cached graph whose metadata differs is rebuilt.
109
+ - The starters' token preview draws a column-count token (`--grid-columns-*`) as that many
110
+ columns.
111
+ - The starter's `base.css` locks page scrolling while a modal `<dialog>` is open
112
+ (`html:has(:modal)`) and keeps the scrollbar's space (`scrollbar-gutter: stable`).
113
+
114
+ ## 0.3.46
115
+
32
116
  - The starter has a token foundation in six groups meeting WCAG 2.2 AA:
33
117
  Color (six 12-step ramps redefined for dark, semantic roles aliasing ramp steps,
34
118
  success/warning/danger/info sets), Type (16 px body, modular ladder fluid from 3xl,
@@ -301,7 +385,7 @@ Completed 2026-10-29T23:52:19.077Z (1010 seconds).
301
385
  from build budgets, and keep configuration replacements parked until validation
302
386
  completes. Fail malformed full-build catalogs promptly and recover complete
303
387
  catalogs after repair. Keep read-only architecture reports outside the project.
304
- - In the frozen Gidi acceptance workload, peak process-tree PSS fell from
388
+ - In the frozen application acceptance workload, peak process-tree PSS fell from
305
389
  7.99 to 4.56 GiB and two complete draft/accept cycles fell from 355.7 to
306
390
  270.3 seconds, retaining all validation gates. See the
307
391
  [benchmark report](https://github.com/reqvire-org/ads/blob/v0.3.35/docs/benchmarks/gidi-preview-memory.md).
package/docs/CONTRACTS.md CHANGED
@@ -162,11 +162,14 @@ valueFrom: ["paint", "scheme.day", "scheme.night"],
162
162
  ```
163
163
 
164
164
  Register each matching `config.*.<path>` in `paintInputs`. The producer may write
165
- one declared field, or an exact `light-dark(${entry.scheme.day}, ${entry.scheme.night})`
166
- template over two declared fields. The normal key/map/root proof still applies.
167
- Raw constants, undeclared fields, extra writes and unknown transforms are rejected.
168
- The browser audit checks actual accessible color references in both branches;
169
- a local SVG URL or `none` is not a CSS color inside `light-dark()`.
165
+ one declared field, or a per-theme value built with the generated helpers from
166
+ `tokens/themes.generated.ts`: `themed({ light: entry.scheme.day, dark: entry.scheme.night })`
167
+ (keys exactly the declared themes) or `themedByScheme({ light: …, dark: … })` (each theme
168
+ takes the value for its color scheme). Every value is a declared field and the argument is
169
+ an object literal without spreads. The normal key/map/root proof still applies. Raw
170
+ constants, undeclared fields, `light-dark()`, extra writes and unknown transforms are
171
+ rejected. The browser audit checks an accessible color reference in every theme's branch;
172
+ a local SVG URL or `none` is not a color there.
170
173
 
171
174
  Families cannot overlap shared tokens, private runtime
172
175
  prefixes or other bindings. A broad family such as `--color-${key}` grants no
@@ -175,12 +178,12 @@ cannot be established. Registered paint consumers list their allowed binding IDs
175
178
  borrowing a peer's binding family or private runtime variable remains invalid. Bindings are scoped
176
179
  to their actual root; portals outside it need deliberate project integration.
177
180
 
178
- A registered binding producer may combine two accessible color references as
179
- `light-dark(var(--light-token), var(--dark-token))`. The App paint audit checks
180
- both branches and their observed effect in the active color scheme. Raw colors,
181
- undefined tokens and SVG URLs inside this color function remain invalid.
181
+ A registered binding producer gives a per-theme value with `themed()` or
182
+ `themedByScheme()`; its output is `var(--ads-if-<theme>, <reference>)` once per declared
183
+ theme, in declared order. The App paint audit checks every branch and its observed effect
184
+ in the active theme. Raw colors, undefined tokens and SVG URLs in a branch remain invalid.
182
185
  This derived binding form does not widen public paint-input types; use constrained
183
- references for each theme input and verify both color schemes in browser checks.
186
+ references for each theme input and verify every theme in browser checks.
184
187
 
185
188
  The App audit checks current mounted instances, accessible values, local SVG
186
189
  resources and computed paint-property responses. Visibility and complete rendered