@reqvire-org/ads 0.3.48 → 0.3.50

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 (94) hide show
  1. package/README.md +36 -6
  2. package/dist/active-clock.mjs +34 -0
  3. package/dist/assets.mjs +20 -2
  4. package/dist/boundaries.mjs +2 -0
  5. package/dist/browser-audit/layout-overflow.mjs +57 -0
  6. package/dist/browser-audit/layout-shift.mjs +32 -0
  7. package/dist/browser-audit/non-text-contrast.mjs +87 -0
  8. package/dist/browser-audit/worker.mjs +36 -7
  9. package/dist/browser-audit.mjs +198 -22
  10. package/dist/check.mjs +14 -1
  11. package/dist/cli.mjs +7 -4
  12. package/dist/component-contrast.mjs +138 -0
  13. package/dist/config.mjs +12 -6
  14. package/dist/finding-rules.mjs +13 -1
  15. package/dist/fonts-generated.mjs +85 -0
  16. package/dist/image-attributes.mjs +110 -0
  17. package/dist/init.mjs +2 -0
  18. package/dist/layout-widths.mjs +184 -0
  19. package/dist/mcp/context.mjs +1 -1
  20. package/dist/mcp/mutations.mjs +7 -5
  21. package/dist/mcp/preview-watch.mjs +9 -8
  22. package/dist/mcp/server.mjs +6 -4
  23. package/dist/palette-generated.mjs +6 -3
  24. package/dist/preview-files.mjs +3 -0
  25. package/dist/project-boundary.mjs +23 -0
  26. package/dist/project-documents.mjs +2 -1
  27. package/dist/scenarios-compiler.mjs +23 -3
  28. package/dist/showcase/client.bundle.js +11 -11
  29. package/dist/showcase/icons.js +5 -5
  30. package/dist/showcase/style.css +1 -1
  31. package/dist/skills/ads-break-ui/SKILL.md +8 -0
  32. package/dist/skills/ads-break-ui/references/atomic-styles.md +2 -0
  33. package/dist/skills/ads-break-ui/references/design-data.md +47 -1
  34. package/dist/skills/ads-break-ui/references/drafts.md +1 -1
  35. package/dist/skills/ads-break-ui/references/guarded-editing.md +1 -1
  36. package/dist/skills/ads-break-ui/references/validation.md +9 -5
  37. package/dist/skills/ads-designer/SKILL.md +24 -4
  38. package/dist/skills/ads-designer/references/accessibility.md +31 -14
  39. package/dist/skills/ads-designer/references/atomic-styles.md +2 -0
  40. package/dist/skills/ads-designer/references/branding.md +10 -5
  41. package/dist/skills/ads-designer/references/cli.md +2 -1
  42. package/dist/skills/ads-designer/references/design-data.md +47 -1
  43. package/dist/skills/ads-designer/references/drafts.md +1 -1
  44. package/dist/skills/ads-designer/references/guarded-editing.md +1 -1
  45. package/dist/skills/ads-designer/references/mobile.md +3 -0
  46. package/dist/skills/ads-designer/references/performance.md +89 -0
  47. package/dist/skills/ads-designer/references/validation.md +9 -5
  48. package/dist/skills/ads-import/references/atomic-styles.md +2 -0
  49. package/dist/skills/ads-import/references/cli.md +2 -1
  50. package/dist/skills/ads-import/references/design-data.md +47 -1
  51. package/dist/skills/ads-import/references/drafts.md +1 -1
  52. package/dist/skills/ads-import/references/guarded-editing.md +1 -1
  53. package/dist/skills/ads-import/references/validation.md +9 -5
  54. package/dist/skills/ads-motion/references/atomic-styles.md +2 -0
  55. package/dist/skills/ads-motion/references/design-data.md +47 -1
  56. package/dist/skills/ads-motion/references/drafts.md +1 -1
  57. package/dist/skills/ads-motion/references/guarded-editing.md +1 -1
  58. package/dist/skills/ads-motion/references/validation.md +9 -5
  59. package/dist/skills/ads-port/references/atomic-styles.md +2 -0
  60. package/dist/skills/ads-port/references/cli.md +2 -1
  61. package/dist/skills/ads-port/references/design-data.md +47 -1
  62. package/dist/skills/ads-port/references/drafts.md +1 -1
  63. package/dist/skills/ads-port/references/guarded-editing.md +1 -1
  64. package/dist/skills/ads-port/references/validation.md +9 -5
  65. package/dist/starters/preact/ds.config.json +1 -0
  66. package/dist/starters/preact/package.json +1 -0
  67. package/dist/starters/react/ADS.md +1 -1
  68. package/dist/starters/react/README.md +14 -2
  69. package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +1 -1
  70. package/dist/starters/react/design-system/components/Content/Image/Image.ads.fixture.ts +2 -0
  71. package/dist/starters/react/design-system/components/Content/Image/Image.ads.scenario.tsx +13 -0
  72. package/dist/starters/react/design-system/components/Content/Image/Image.tsx +48 -0
  73. package/dist/starters/react/design-system/components/Content/Image/README.md +20 -0
  74. package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +2 -2
  75. package/dist/starters/react/design-system/index.ts +1 -0
  76. package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +16 -0
  77. package/dist/starters/react/design-system/tokens/spacing.css +18 -0
  78. package/dist/starters/react/ds.config.json +1 -0
  79. package/dist/starters/react/package-lock.json +47 -0
  80. package/dist/starters/react/package.json +2 -1
  81. package/dist/test-boundaries.mjs +30 -1
  82. package/dist/themes-generated.mjs +15 -4
  83. package/dist/token-quality.mjs +61 -24
  84. package/dist/units.mjs +2 -1
  85. package/dist/validation-checks.mjs +5 -4
  86. package/dist/validation.mjs +1 -1
  87. package/dist/verification/browser.mjs +28 -2
  88. package/dist/verification.mjs +5 -4
  89. package/docs/ADS.md +4 -1
  90. package/docs/ARCHITECTURE.md +13 -3
  91. package/docs/CHANGELOG.md +111 -12
  92. package/docs/GUIDE.md +208 -14
  93. package/docs/MCP.md +14 -10
  94. package/package.json +1 -1
package/docs/CHANGELOG.md CHANGED
@@ -1,34 +1,133 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.48
3
+ ## 0.3.50
4
4
 
5
5
  <!-- ads-local-tests:start -->
6
- Local verification: **708/708 passed** with `ADS_TEST_BUN=1 npm test`.
7
- Tested commit: `93a657387e39ce23fd85dd3ce54000b4e456dd8d`; Node v24.13.0, Bun 1.4.1.
8
- Completed 2026-10-31T12:27:52.387Z (1286 seconds).
6
+ Local verification: **749/749 passed** with `ADS_TEST_BUN=1 npm test`.
7
+ Tested commit: `1c5feb7757a66ac1554f9b5a30a2281c1a722912`; Node v24.13.0, Bun 1.4.1.
8
+ Completed 2026-11-01T14:41:43.097Z (10116 seconds).
9
9
 
10
10
  <!-- ads-local-test-proof
11
11
  {
12
12
  "schema": 1,
13
- "version": "0.3.48",
14
- "commit": "93a657387e39ce23fd85dd3ce54000b4e456dd8d",
15
- "sourceSha256": "08f2191456ab4f4d47ae8e9fcb7327125091f736b6c5230ae6c8dbe24ca0b838",
13
+ "version": "0.3.50",
14
+ "commit": "1c5feb7757a66ac1554f9b5a30a2281c1a722912",
15
+ "sourceSha256": "66fffd1f9221e62bdf6239b4c197287a0591222d59f801293c4087a72ba566b0",
16
16
  "command": "ADS_TEST_BUN=1 npm test",
17
17
  "result": "pass",
18
- "tests": 708,
19
- "pass": 708,
18
+ "tests": 749,
19
+ "pass": 749,
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-31T12:27:52.387Z",
26
- "durationMs": 1286115,
27
- "logSha256": "71f4f100114ac074c9445cb2ee0421783304484061b5d82289134a1b8582aa9e"
25
+ "completedAt": "2026-11-01T14:41:43.097Z",
26
+ "durationMs": 10116397,
27
+ "logSha256": "946ed64845491a398ddef1f17189fc9024b8959fbc67071d4e3c5e6c8da4adb0"
28
28
  }
29
29
  -->
30
30
  <!-- ads-local-tests:end -->
31
31
 
32
+ - **Images reserve space and choose how they load.** New `img-attributes` error for a raw `<img>`
33
+ without `loading`, or without dimensions, in components, patterns and compositions. A spread or
34
+ a class from elsewhere is an `img-attributes-unresolved` info item. A `srcset` with width
35
+ descriptors and no `sizes` is an error too, on `<img>` and the project's `Image`. Starters gain
36
+ an `Image` component, lazy by default, with `priority` for the view's main visible image and
37
+ optional `srcset` and `sizes`.
38
+ - **Image budgets.** New `asset-image-budget` error for images in `assets/`: SVG 100 KB, WebP and
39
+ AVIF 300 KB, JPEG 400 KB, PNG and GIF 500 KB. `assets.imageBudgetKb` sets one limit for all.
40
+ - **Layout shift in the audit.** New `layout-shift` error above 0.1 Cumulative Layout Shift on a
41
+ scenario's first render, with `worstLayoutShift` in the result.
42
+ - **Font preloads.** When body or heading text uses a font from `tokens/fonts.css`, `ads assets`
43
+ writes `tokens/fonts.preload.generated.ts` with those files; call `preloadFonts()` in the app
44
+ entry. Run `ads assets` after upgrading: `ads check` fails while it is missing or stale.
45
+ - **Performance guide.** `ads://guides/performance` covers image formats, responsive images, the
46
+ priority rule and image preloads, font loading, CSS delivery, layout shift, and what stays with
47
+ the application and Lighthouse. ADS generates no images and no image preloads.
48
+ - **The browser accessibility audit is on by default.** `acceptance.browserAudit` and
49
+ `validation.browserAudit` default to `true`: `ads validate` (both policies), `ads_validate`,
50
+ `ads_accept`, `ads_apply_patch` and `ads_apply_transaction` run the axe-core audit, and
51
+ any `a11y-axe` error fails them. Set `"browserAudit": false` in a policy to turn its audit
52
+ off. Projects that relied on the old default now see `a11y-axe` errors; fix each in the
53
+ component that renders the failing element.
54
+ - **A missing browser fails with what to install.** Without project Playwright the
55
+ `browser-audit` error says to run `npm install -D @playwright/test` and
56
+ `npx playwright install chromium` (Bun: `bun add -d @playwright/test` and
57
+ `bunx playwright install chromium`); without Playwright's browser it says to run
58
+ `npx playwright install chromium` or to select an installed Chrome with
59
+ `mcp.capture.channel "chrome"`.
60
+ - **New projects declare Playwright.** Both starters list `@playwright/test` in
61
+ `devDependencies`, and `ads init` adds it when the project has neither `@playwright/test`
62
+ nor `playwright`. After `npm install`, run `npx playwright install chromium` once;
63
+ `ads create` prints that step in its next commands.
64
+ - **Components' own color pairs are checked.** New `component-contrast` error: where a
65
+ component or pattern style block (including a nested state such as `&:hover` or
66
+ `&[aria-selected="true"]`) sets both `color` and `background` to tokens, the pair needs
67
+ 4.5:1 in every theme and brand, such as `--success` as text on `--success-bg`. Disabled
68
+ states are exempt; a side that names no color token is a `component-contrast-unresolved`
69
+ info item. Fix with `--x-text` on `--x-bg` or `--x-fg` on `--x`.
70
+ - **The audit checks non-text contrast (WCAG 1.4.11).** New `a11y-non-text-contrast` error,
71
+ which axe does not cover: a field or other control without its own text or icon, whose
72
+ border is its only boundary, needs that border at 3:1 against the background around it, and an icon-only control needs its icon at 3:1
73
+ against its background. Disabled controls are exempt. Outline fields and controls with
74
+ `--border-strong`.
75
+ - **Widths are fluid on the grid.** New `layout-fixed-width` error: in component, pattern and
76
+ composition styles, a width, `flex-basis` or grid track fixed above 48 px, by arithmetic on
77
+ spacing tokens or not, fails `ads check`. New `layout.widthTokens` names allowed width
78
+ tokens, which must be fluid (a fixed `--container-*` or `--content-max` token is a cap, valid
79
+ only as a maximum), and `layout.fixedWidthUnits` names owners with fixed widths, such as overlays.
80
+ Projects with fixed widths now see errors; use a `--grid-span-N` token in a container query,
81
+ `%` or `fr`, or a `ch` measure.
82
+ - **The audit finds horizontal overflow.** New `layout-overflow` error: every UI scenario is
83
+ resized to 390, 768 and 1280 px, and page overflow, elements past the viewport and clipped
84
+ content fail it. Scrollers and `text-overflow: ellipsis` are exempt.
85
+ - **Starters have grid-span tokens.** `--grid-span-1` to `--grid-span-16` are fluid widths of N
86
+ of 16 columns, and both starters declare `layout.widthTokens`.
87
+ - **Other products' logos are shown as they are.** The showcase's Icons tab shows each file in
88
+ `assets/logos/` unchanged, on a white and a black tile, with no muted version. The guides now say:
89
+ never mute, tint or recolor another product's logo; use a one-color version only where its
90
+ owner's published rules allow it and in the colors they name; a quieter version needs the
91
+ owner's rule or written permission; record each file's source and rule in
92
+ `assets/logos/README.md`.
93
+ - **Nested projects stay separate.** A subfolder with its own `ds.config.json` is its own
94
+ project: check, validation, audits, previews, watches and token and scenario discovery stop
95
+ there.
96
+ - **Fewer false findings on files that do not run.** A declaration file (`.d.ts`, `.d.mts`) no
97
+ longer fails `showcase-import`, and `@ads:` text marks a test only in a test call's title or
98
+ tag, not in data, comments or a generated fixture's source. Indirect tags still count.
99
+ - **One flaky preview no longer ends an audit.** A render that fails because the preview dropped
100
+ or was slow is retried on its own, up to 3 attempts, and the rest keep their results. Retried
101
+ passes are listed under `retries`. A scenario that still fails is a `browser-audit` error
102
+ naming it and the last cause, beside any findings, in `ads audit`, `ads validate` and MCP
103
+ acceptance.
104
+ - **Time limits ignore sleep.** Build, command, behavior-check and readiness budgets count time
105
+ the machine is awake, so a laptop suspended during a build no longer fails it.
106
+ - The [guide](GUIDE.md#checks-and-guards) has a **Checks and guards** section: finding
107
+ kinds, gates, the browser audit and how to turn it off, contrast pairs and thresholds,
108
+ themes and brands, tokens, architecture and behavior.
109
+
110
+ ## 0.3.49
111
+
112
+ - **`token-contrast` checks every CSS color syntax.** It used to read only hex, `rgb()` and
113
+ `hsl()` and skipped every other value without a word, so projects whose ramps are `oklch()`
114
+ got no static contrast checking. It now resolves each pair the way the generated palette
115
+ (`themes.generated.ts`) does, through one shared resolver: per-theme halves, aliases and
116
+ `var()` fallbacks, `light-dark()` by the theme's scheme, named colors, `rgb()`/`hsl()`/`hwb()`,
117
+ `lab()`/`lch()`/`oklab()`/`oklch()`, `color()` spaces and `color-mix()`, clipped to sRGB as a
118
+ canvas draws it, in every theme of every brand. Projects with such ramps can see new
119
+ `token-contrast` errors; fix each by choosing another ramp step for the role in the theme the
120
+ message names.
121
+ - **Alpha is composited as the page paints it.** A translucent background is composited over
122
+ `--bg-canvas` (the canvas itself over white), then a translucent foreground over that
123
+ background, and the ratio is taken between the opaque results.
124
+ - **Unresolvable pair colors are reported.** A pair color ADS cannot resolve statically
125
+ (`currentColor`, relative color syntax, a system color, a value that is not a color) is a
126
+ `token-contrast-unresolved` info item naming the token, its value, the themes and brands,
127
+ and the pairs that go unchecked, instead of being skipped.
128
+
129
+ ## 0.3.48
130
+
32
131
  - **MCP acceptance runs the browser accessibility audit.** When the acceptance policy sets
33
132
  `browserAudit: true`, `ads_accept`, `ads_apply_patch` and `ads_apply_transaction` run the
34
133
  axe-core audit on the candidate before writing any source, in every declared brand and
package/docs/GUIDE.md CHANGED
@@ -58,7 +58,8 @@ optionally a named `captureTargets` element, theme and viewport. To compare a
58
58
  proposed change before applying it, add `screenshot:true` and an explicit
59
59
  `captures:[{scenario:"<discovered ID>"}]` selection to the patch/transaction dry run.
60
60
  Normal patches and dry runs create no screenshots. Capture uses project-installed
61
- Playwright and its browser; ADS installs neither.
61
+ Playwright and its browser; ADS installs neither (`ads create` and `ads init` declare
62
+ `@playwright/test`; run `npx playwright install chromium` once).
62
63
 
63
64
  Read `ads://project/captures` and the returned PNG image URIs through MCP
64
65
  `resources/read`. Each target keeps only current and candidate: a successful
@@ -189,12 +190,13 @@ Node/npm or Bun pipeline. Run inside the project containing `package.json`:
189
190
  ```sh
190
191
  npx @reqvire-org/ads init --framework react
191
192
  npm install
193
+ npx playwright install chromium # browser for the accessibility audit
192
194
  npm run build
193
195
  ```
194
196
 
195
197
  For a Bun-managed project, use
196
- `bunx @reqvire-org/ads init --framework react`, followed by `bun install`
197
- and `bun --bun run build`. Node is unnecessary. No archive or directory argument is needed for a published
198
+ `bunx @reqvire-org/ads init --framework react`, followed by `bun install`,
199
+ `bunx playwright install chromium` and `bun --bun run build`. Node is unnecessary. No archive or directory argument is needed for a published
198
200
  release. `init` requires an existing project; it does not create an application.
199
201
  For starting from zero, `ads create <folder> --framework react|preact` copies the
200
202
  TypeScript/Linaria starter shipped in the same ADS version into a new or empty
@@ -439,13 +441,14 @@ dependencies. Project scripts default to 60 seconds each; use the explicit
439
441
  Behavior profiles have a separate whole-run budget.
440
442
  Set `acceptance.behaviorChecks` to require affected registered tests at acceptance.
441
443
  Set `validation.checks` and `validation.behaviorChecks` independently for audits.
442
- Both script lists default to empty; no names are inferred. Direct source edits
444
+ Both script lists default to empty; no names are inferred. Both policies run the
445
+ browser audit; `"browserAudit": false` in a policy turns its audit off. Direct source edits
443
446
  can run `ads validate --policy acceptance`; ordinary `ads validate` selects the
444
447
  validation policy. See [policy guidance](../skills/ads-designer/references/validation.md).
445
448
  When the acceptance policy requires affected registered behavior checks (or
446
449
  a capture was requested), ADS builds and shares production previews with browser
447
- verification. `acceptance.browserAudit` renders the candidate's affected UI scenarios
448
- for the axe-core audit on that host, or compiles only those scenarios when nothing
450
+ verification. The acceptance policy's browser audit renders the candidate's affected UI
451
+ scenarios for axe-core on that host, or compiles only those scenarios when nothing
449
452
  else needs previews. Core-only acceptance does not build the whole graph. Remove `build:mcp-previews`
450
453
  from `acceptance.checks`; keep that script in the ordinary project build.
451
454
  See the [editing contract](MCP.md#guarded-editing) for unit ownership,
@@ -480,6 +483,187 @@ component tests, and browser comparisons. Register component-specific guards as
480
483
  explicit project scripts; include them in builds and `acceptance.checks` when
481
484
  required. `ads check` does not invoke project linter plugins.
482
485
 
486
+ ### Checks and guards
487
+
488
+ Every finding has one of three kinds, and no setting changes a finding's kind:
489
+
490
+ - **Error**: fails `ads check`, `ads audit`, `ads validate` and MCP acceptance.
491
+ - **Review**: shown, never blocks; it names something only a person can judge.
492
+ - **Info**: notes an analysis limit, such as a color `token-contrast` cannot resolve
493
+ statically.
494
+
495
+ There is no warning level.
496
+
497
+ **Gates.**
498
+
499
+ | Gate | What runs |
500
+ |---|---|
501
+ | `ads check` | Static token, theme, brand, accessibility, ownership, import and coverage rules; no browser |
502
+ | `ads audit` | axe-core (WCAG A/AA rules), ADS's non-text contrast check, `layout-shift` and `layout-overflow` at 390, 768 and 1280 px in every component, pattern and composition scenario, once per brand and theme |
503
+ | `ads validate` | The validation policy: `ads check` rules, `validation.checks` scripts, current previews, registered behavior checks (`validation.behaviorChecks`, default `true`) and the browser audit |
504
+ | `ads validate --policy acceptance` | The acceptance policy against current source, applying nothing: `ads check` rules, `acceptance.checks` scripts, affected behavior checks when `acceptance.behaviorChecks` is `true` (default `false`) and the browser audit |
505
+ | MCP acceptance | `ads_accept`, `ads_apply_patch` and `ads_apply_transaction` run the acceptance policy on an isolated candidate and write no source unless it passes; the audit covers the candidate's affected UI scenarios (all of them after configuration, foundation, token or asset changes) |
506
+
507
+ **Browser audit.** Both policies run it by default. Each `a11y-axe`,
508
+ `a11y-non-text-contrast`, `layout-overflow` and `layout-shift` finding is an error that fails the policy, and an audit that cannot run fails it with a `browser-audit` error
509
+ naming what to install. The audit needs the project's Playwright and a browser:
510
+
511
+ ```sh
512
+ npm install -D @playwright/test # ads create and ads init declare it
513
+ npx playwright install chromium # Bun: bunx playwright install chromium
514
+ ```
515
+
516
+ `mcp.capture` selects `browser` (`chromium`, `firefox`, `webkit`), an installed Chrome
517
+ `channel` such as `"chrome"`, and `timeoutMs`. To turn the audit off for a policy, set
518
+ `browserAudit` to `false` in `ds.config.json`:
519
+
520
+ ```json
521
+ {
522
+ "acceptance": { "checks": [], "behaviorChecks": false, "browserAudit": false },
523
+ "validation": { "checks": [], "behaviorChecks": true, "browserAudit": false }
524
+ }
525
+ ```
526
+
527
+ Declare `"sideEffects": ["**/*.css"]` in `package.json`, as the starters do, so a
528
+ component change audits only the scenarios that import it.
529
+
530
+ A render that fails because the preview dropped or was slow is retried on its own, up to 3
531
+ attempts, with a new browser and preview; the others keep their results, and findings never
532
+ cause a retry. The JSON result and the check list retried passes under `retries`, and `ads
533
+ audit` prints them. A scenario that still fails is a `browser-audit` error naming it and the
534
+ last cause, beside any findings. A project that fails validation stops the audit.
535
+
536
+ **Non-text contrast.** axe-core does not check WCAG 1.4.11, so the audit adds
537
+ `a11y-non-text-contrast` for every visible, enabled `button`, `input`, `select`, `textarea`,
538
+ `a[href]` and `switch`, `checkbox`, `radio`, `slider` and `tab` role in the rendered state:
539
+
540
+ - A control whose background has less than 3:1 against the background around it and that
541
+ has a visible border needs that border at 3:1 against the surrounding background. Use
542
+ `--border-strong` (or a stronger step) for a field or control outline; `--border-default`
543
+ is for dividers and card edges. A button, link or tab with text or an icon is exempt: that
544
+ content identifies it.
545
+ - An icon-only control (an `svg`, no text) needs the icon's stroke or fill at 3:1 against
546
+ the control's background. Paint icons with a text or `-fg` token.
547
+
548
+ Disabled and `aria-disabled="true"` controls, controls whose background has 3:1 against
549
+ their surroundings, browser-drawn native checkboxes, radios and ranges, and controls over a
550
+ background image are exempt. Each finding names the scenario, themes and brands, element
551
+ selectors and the lowest ratio. Hover and focus states are not rendered by the audit.
552
+
553
+ **Contrast.** `token-contrast` checks the role pairs that meet on screen in every theme and
554
+ brand: text, link, accent and status text on their backgrounds need 4.5:1; focus indicators
555
+ and control borders on canvas and surface need 3:1. It resolves every CSS color syntax,
556
+ including `oklch()` and `color-mix()`, and composites translucent colors over their
557
+ background and the canvas. A pair color it cannot resolve statically (`currentColor`,
558
+ relative color syntax) is a `token-contrast-unresolved` info item. Fix a failing pair by
559
+ choosing another ramp step.
560
+
561
+ `component-contrast` checks the pairs components and patterns make themselves. Where one
562
+ Linaria style block (the template's top level, a nested block such as `&:hover` or
563
+ `&[aria-selected="true"]`, or an at-rule) declares both `color: var(--a)` and
564
+ `background` or `background-color: var(--b)`, the pair needs 4.5:1 in every theme and brand,
565
+ resolved and composited as `token-contrast` resolves it. Local custom properties set in the
566
+ block or an enclosing block resolve one level; an undeclared one reads its `var()` fallback.
567
+ Fix it with the role contract: `--x-text` on
568
+ `--x-bg`, `--x-fg` on `--x` (not `--success` as text on `--success-bg`). Disabled states
569
+ (`:disabled`, `[disabled]`, `[aria-disabled="true"]`, `[data-disabled]`) are exempt;
570
+ `currentColor`, `inherit`, `transparent`, fully transparent backgrounds, one token on both
571
+ sides and native `<progress>`, `<meter>` and range parts are skipped. A side that names no
572
+ declared color token is a `component-contrast-unresolved` info item; so is text matching the
573
+ canvas (under 1.25:1) over a translucent background, which sits on another backdrop.
574
+ Pairs `token-contrast` checks are not repeated. A `color-contrast` audit finding that
575
+ neither static check reports comes from colors the block does not pair itself, such as text
576
+ inheriting its color onto a nested background.
577
+
578
+ **Static accessibility.** Errors: `a11y-target-size` (`--control-height-*` at least 24 px),
579
+ `a11y-focus` (`--focus-w` at least 2 px and a `:focus-visible` indicator in `base.css`),
580
+ `a11y-text-resize` (font sizes in `rem`), `a11y-reduced-motion` (every non-zero `--dur-*`
581
+ set to 0 under `prefers-reduced-motion`), `a11y-text-spacing` (`--leading-normal` at least
582
+ 1.5, `--content-max` under 80 characters), `a11y-image-alt` and `a11y-icon-label`.
583
+ `a11y-keyboard` is a review item.
584
+
585
+ **Layout.** Widths are fluid on the grid.
586
+
587
+ `layout-fixed-width` (`ads check`) reads component, pattern and composition styles: `width`,
588
+ `min-width`, `max-width`, `inline-size`, `min-inline-size`, `max-inline-size`, `flex-basis`,
589
+ the basis of `flex`, and `grid-template-columns` tracks. Component variables declared in the
590
+ same template and `var()` fallbacks are read through.
591
+
592
+ | Value | Result |
593
+ |---|---|
594
+ | A fixed length above 48 px, raw, through a token or by arithmetic: `var(--space-32)` (64 px), `calc(var(--space-32) * 10)` | Error; 48 px is the top of the control-height and icon range |
595
+ | A flex item that grows and shrinks: `flex: 1 1 var(--space-80)` | Pass |
596
+ | `%`, `fr`, `ch`, `em`, `ex`, `lh`, viewport and container units, `auto`, `min-content`, `max-content`, `fit-content` | Pass |
597
+ | `min()`, `max()`, `clamp()` or `calc()` with a fluid part: `min(100%, var(--space-80))` | Pass |
598
+ | A `minmax()` track with a fluid maximum: `minmax(var(--space-80), 1fr)` | Pass |
599
+ | `--icon-*`, `--control-*`, `--avatar-*`, `--border-*`, `--focus-*`, `--ring-*`, `--radius-*`, `--side-pane-*`, `--toast-*`, `--navigation-rail-width`, `--app-header-height`, `--row-height-compact`, `--compact-column-min` | Pass: these size parts, not layouts |
600
+ | A token named by `layout.widthTokens` | Pass |
601
+
602
+ `layout` in `ds.config.json` has two fields:
603
+
604
+ ```json
605
+ { "layout": {
606
+ "widthTokens": ["--grid-span-*", "--container-*"],
607
+ "fixedWidthUnits": ["components/Overlays/*", "design-system/patterns/Menu/**"]
608
+ } }
609
+ ```
610
+
611
+ - `widthTokens`: token names or globs. Each must be defined with `%` or container units; a
612
+ fixed definition is an error at the token. A fixed `--container-*` or `--content-max` token
613
+ is the exception, a cap valid only as `max-width` or `max-inline-size`.
614
+ - `fixedWidthUnits`: unit ids or project-relative file globs (`*` within a path segment, `**`
615
+ across them) that may use fixed widths. List overlays here: dialogs, menus, popovers and
616
+ tooltips. There is no per-declaration exception.
617
+
618
+ An entry that matches no token, unit or file is a `layout-config` error. The fix for a fixed
619
+ width: a `--grid-span-N` token in a container query, `%` or `fr`, or a `ch` measure for text
620
+ (`max-inline-size: 65ch`).
621
+
622
+ `layout-overflow` (browser audit) resizes each rendered scenario, in every theme and brand, to
623
+ 390, 768 and 1280 px. Each finding names the scenario, widths, themes, brands and elements:
624
+
625
+ - The document scrolls horizontally.
626
+ - An element reaches past the viewport's edge; the outermost such element is named.
627
+ - An element with `overflow-x: hidden` or `clip` cuts off content more than 4 px wider.
628
+
629
+ Exempt: `overflow-x: auto` or `scroll` scrollers and their content, `text-overflow: ellipsis`,
630
+ carousels (`aria-roledescription="carousel"`), native text fields, fixed-position layers and visually hidden content.
631
+
632
+ **Web performance.** MCP serves this as `ads://guides/performance`.
633
+
634
+ | Rule | Gate | Fails |
635
+ |---|---|---|
636
+ | `img-attributes` | `ads check` | A raw `<img>` in components, patterns or compositions without `loading`, or without `width` and `height`, a visible `aspect-ratio`, a width and height in its style, or out-of-flow positioning. A `srcset` with width descriptors and no `sizes`, on `<img>` or the project's `Image`. A spread or a class from elsewhere is an `img-attributes-unresolved` info item |
637
+ | `asset-image-budget` | `ads check` | An image in `assets/` over its limit: SVG 100 KB, WebP and AVIF 300 KB, JPEG 400 KB, PNG and GIF 500 KB. `assets.imageBudgetKb` is one limit for every format |
638
+ | `layout-shift` | `ads audit` | A scenario with Cumulative Layout Shift above 0.1 on first render, where the browser reports it (Chromium) |
639
+ | `themes-generated` | `ads check` | A stale `tokens/fonts.preload.generated.ts` |
640
+
641
+ The starters' `Image` lazily loads and reserves space; `priority` marks the view's main visible
642
+ image. When body or heading text uses a font from `tokens/fonts.css`, `ads assets` writes
643
+ `tokens/fonts.preload.generated.ts`: call its `preloadFonts()` in the app entry before the first
644
+ render. It imports the files through the bundler, so the preload and the stylesheet share one URL.
645
+ ADS does not cover page metadata, `noindex`, sitemaps or hosting; run Lighthouse on a production
646
+ build with real URLs.
647
+
648
+ **Themes and brands.** Themed tokens are per-theme halves (`--x-light`, `--x-dark`) on
649
+ `:root`; brands set their own halves on `[data-brand]`. `ads assets` generates
650
+ `themes.generated.css` and `.ts`. Missing or conflicting halves, empty themes or brands,
651
+ stale generated files, `light-dark()` and `[data-theme]`/`[data-brand]` ancestor selectors
652
+ in components are errors; see [Tokens, grid, icons and accessibility](#tokens-grid-icons-and-accessibility).
653
+
654
+ **Tokens.** Ownership, naming, the 2 px spacing rhythm (`token-rhythm`), missing names and
655
+ scenario references are errors; equal values in different roles are a
656
+ `token-overlap-review` item.
657
+
658
+ **Architecture.** Data, UX and Skin ownership, project structure, unit and paint contracts,
659
+ and binding and variable ownership are errors; Linaria atomic composition risks are
660
+ `atomic-composition-review` items. See [Generic architecture guards](#generic-architecture-guards).
661
+
662
+ **Behavior.** A registered guarantee needs current passing execution evidence. `ads verify`
663
+ runs the registered checks against current source (`--unit` and `--check` select); the
664
+ validation policy runs all of them, the acceptance policy the affected ones when
665
+ `acceptance.behaviorChecks` is `true`.
666
+
483
667
  ## Showcase
484
668
 
485
669
  ADS ships a minimal browser shell, MCP client and Apps host. `ads mcp` serves the
@@ -724,8 +908,11 @@ nothing. Commit outputs and the manifest together.
724
908
  becomes `glyphAliases`. `ads assets` writes it and `ads check` fails when it is stale.
725
909
  Other products' logos are not brand artwork or glyphs: keep them, in their own
726
910
  colors and under their owners' trademark and usage terms, in `assets/logos/` and
727
- show them as images (a CSS mask over `currentColor` for a muted use); ADS generates
728
- and checks nothing there.
911
+ show them as images; ADS generates and checks nothing there. Never mute, tint or recolor
912
+ another product's logo. Use a one-color version only where its owner's published rules allow
913
+ it and in the colors they name; a CSS mask over a color token then keeps the shape and
914
+ follows the theme. A quieter version needs the owner's rule or written permission. Record each
915
+ file's source and rule in `assets/logos/README.md`.
729
916
 
730
917
  ### Tokens, grid, icons and accessibility
731
918
 
@@ -748,16 +935,17 @@ can judge: `atomic-composition-review`, `token-overlap-review`, `pointer-capture
748
935
  changes a finding's kind. The showcase's grid button overlays the project's grid on every
749
936
  preview, and its **Icons** tab shows the glyph set: every glyph at the size used beside
750
937
  text, each one on its grid at every `--icon-*` size with its aliases and glyph errors, and
751
- the logos in `assets/logos/` in color and muted.
938
+ each file in `assets/logos/` as it is, on a white and a black tile.
752
939
 
753
940
  `ads audit` adds a rendered check: axe-core (WCAG A/AA rules) in every component, pattern
754
941
  and composition scenario, once per declared brand and theme (`--scenario`, `--theme` and
755
942
  `--brand` narrow it). Each violation is an `a11y-axe` error naming the axe rule, WCAG
756
943
  criterion, themes and brands, failing elements and help link, and `ads audit` exits 1. It
757
- needs the project's Playwright and browser, as captures do; `browserAudit: true` in a
758
- validation or acceptance policy runs it there too. With `acceptance.browserAudit`, MCP
759
- draft acceptance and guarded patches audit the candidate's affected scenarios before
760
- writing source, and an `a11y-axe` error rejects the change.
944
+ needs the project's Playwright and browser, as captures do. The validation and acceptance
945
+ policies run it too unless their `browserAudit` is `false`; MCP draft acceptance and
946
+ guarded patches audit the candidate's affected scenarios before
947
+ writing source, and an `a11y-axe`, `a11y-non-text-contrast` or `layout-overflow` error rejects
948
+ the change.
761
949
  `ads tokens --format dtcg` exports the tokens as W3C Design Tokens JSON for design tools
762
950
  (`--theme <name>` and `--brand <name>` select one context).
763
951
 
@@ -973,7 +1161,9 @@ inspection errors fail the check. These guards read files and never delete them.
973
1161
 
974
1162
  ## Configuration and component rules
975
1163
 
976
- `ds.config.json` uses schema version 1. Paths stay within the receiving project:
1164
+ `ds.config.json` uses schema version 1. A subfolder with its own `ds.config.json` is a separate
1165
+ project: check, validation, audits, previews and watches stop there and run in it on their own.
1166
+ Paths stay within the receiving project:
977
1167
 
978
1168
  ```json
979
1169
  {
@@ -987,10 +1177,14 @@ inspection errors fail the check. These guards read files and never delete them.
987
1177
  "tokenDir": "tokens",
988
1178
  "themes": [{ "name": "light", "scheme": "light" }, { "name": "dark", "scheme": "dark" }],
989
1179
  "inlineStyleFiles": [],
1180
+ "layout": { "widthTokens": [], "fixedWidthUnits": [] },
990
1181
  "oxlint": { "plugins": [], "rules": {} }
991
1182
  }
992
1183
  ```
993
1184
 
1185
+ `layout` declares allowed width tokens and owners with fixed widths; see
1186
+ [Checks and guards](#checks-and-guards).
1187
+
994
1188
  These source-layout defaults apply when the file is absent; the example omits
995
1189
  the required init-time framework choice. Run `ads init --framework react` (or
996
1190
  `preact`) to save it. To use another layout, write this configuration before init. Configure TypeScript and the app bundler to resolve
package/docs/MCP.md CHANGED
@@ -96,9 +96,10 @@ is explicitly `previewOnly`, not behavioral or acceptance evidence.
96
96
 
97
97
  `ads_accept({id,revision})` validates and applies the exact reviewed revision in
98
98
  one operation. Architecture, configured project commands and affected
99
- behavior checks remain mandatory. When `acceptance.browserAudit` is true, axe-core
99
+ behavior checks remain mandatory. Unless `acceptance.browserAudit` is false, axe-core
100
100
  also renders the candidate's affected UI scenarios in every declared brand and
101
- theme; any `a11y-axe` error rejects acceptance. Edits during checking and baseline conflicts
101
+ theme, with the non-text contrast and overflow checks; any `a11y-axe`,
102
+ `a11y-non-text-contrast` or `layout-overflow` error rejects acceptance. Edits during checking and baseline conflicts
102
103
  prevent application; failures retain the draft and return execution evidence.
103
104
  Successful acceptance removes draft source, records an event and resolves draft
104
105
  dependencies in remaining proposals. Accept dependencies first and review their
@@ -571,7 +572,7 @@ contracts do not register token namespaces or independent value sheets. Read
571
572
  `ads://guides/tokens` for state mappings, color roles, the grid, contrast/rhythm/overlap
572
573
  reviews and the token export; `ads://guides/branding` for brand artwork, web icons,
573
574
  committed targets and glyph sets; `ads://guides/accessibility` for the WCAG 2.2 AA
574
- guards (`token-contrast`, `a11y-*`) and the practice no tool can check.
575
+ guards (`token-contrast`, `component-contrast`, `a11y-*`) and the practice no tool can check.
575
576
 
576
577
  The `tokens` manifest also returns `companionFiles` with the configured foundation
577
578
  entry path. When creating or deleting a canonical token foundation file, include
@@ -676,7 +677,7 @@ freshness and owner paths and returns a `patchFile`; it changes no live source.
676
677
  Pass that `patchFile` to `ads_apply_patch` with `dryRun:true` to validate before
677
678
  applying. This runs the normal candidate gates, including affected registered
678
679
  behavior checks against an isolated candidate and its configured browser preview
679
- and, when `acceptance.browserAudit` is true, the candidate accessibility audit.
680
+ and, unless `acceptance.browserAudit` is false, the candidate accessibility audit.
680
681
  It writes no live source and does not persist passing evidence for live inputs.
681
682
  Read the summary, then use its `resultId` with `ads_results` for failing
682
683
  `outcomes`, `diagnostics` or named pipeline `checks`; update the draft, diff again
@@ -710,7 +711,7 @@ It accepts 2–64 distinct owners, at most 256 distinct files and 16 MiB of comb
710
711
  Git diff text. Each patch obeys its own ownership/companion rules. Patches apply
711
712
  in order inside one candidate; shared-entry hunks in a later patch must match
712
713
  the earlier candidate's content. Core checks, configured project commands,
713
- all affected behavior checks and, when `acceptance.browserAudit` is true, the
714
+ all affected behavior checks and, unless `acceptance.browserAudit` is false, the
714
715
  accessibility audit run against the final candidate. No intermediate
715
716
  candidate is published. Dry runs, failures, conflicts and cancellation write no
716
717
  source; a publication failure rolls back prior writes. This coordinates owned
@@ -1423,13 +1424,16 @@ scenario's failure. A retained earlier view is not current-source evidence.
1423
1424
  it checks the acceptance policy against current source without applying anything.
1424
1425
  Validation and acceptance keep separate baselines; acceptance cannot establish
1425
1426
  full validation. Each policy chooses `checks`, `behaviorChecks` and `browserAudit` (the
1426
- axe-core audit of every UI scenario in every brand and theme; its `a11y-axe` findings are
1427
- errors); skipped tests are reported as skipped, without a passing label. Draft preview/edit triggers
1427
+ axe-core audit of every UI scenario in every brand and theme, on by default and turned off
1428
+ with `false`; its `a11y-axe`, `a11y-non-text-contrast` and `layout-overflow` findings are errors); skipped tests are reported as skipped, without a passing label. Draft preview/edit triggers
1428
1429
  neither policy. Draft acceptance, `ads_apply_patch` and `ads_apply_transaction` run
1429
- the acceptance policy on their candidate: with `acceptance.browserAudit` they audit
1430
+ the acceptance policy on their candidate: unless `acceptance.browserAudit` is false they audit
1430
1431
  the candidate's affected UI scenarios (all of them after configuration, foundation,
1431
- token or asset changes) before writing source. Any `a11y-axe` error, or an audit that
1432
- cannot run (`browser-audit`), rejects the change; findings are in `diagnostics` and the
1432
+ token or asset changes) before writing source. Any `a11y-axe`, `a11y-non-text-contrast` or
1433
+ `layout-overflow` error, a scenario that fails all 3 attempts (`browser-audit`, naming it and the
1434
+ last cause, with retried passes listed under `retries`), or an audit that
1435
+ cannot run (`browser-audit`: no project Playwright or browser; the message names what to
1436
+ install), rejects the change; findings are in `diagnostics` and the
1433
1437
  `browser-accessibility-audit` check lists the audited scenarios, themes, brands and
1434
1438
  timing. Explicit `ads_verify` remains independent of gating choices. The MCP tool
1435
1439
  runs trusted configured project commands with cancellation and bounded output; it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.3.48",
3
+ "version": "0.3.50",
4
4
  "type": "module",
5
5
  "description": "A design system your agent can see and shape. Your components. Your look. Your code.",
6
6
  "repository": {