@reqvire-org/ads 0.3.50 → 0.3.52

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 (42) hide show
  1. package/README.md +1 -1
  2. package/dist/browser-audit/axe-run.mjs +17 -0
  3. package/dist/browser-audit/first-render.mjs +18 -0
  4. package/dist/browser-audit/layout-overflow.mjs +88 -41
  5. package/dist/browser-audit/non-text-contrast.mjs +12 -7
  6. package/dist/browser-audit/render-states.mjs +182 -0
  7. package/dist/browser-audit/worker.mjs +23 -12
  8. package/dist/browser-audit.mjs +56 -13
  9. package/dist/bun-compiler.mjs +9 -1
  10. package/dist/capture/worker.mjs +2 -5
  11. package/dist/check.mjs +5 -3
  12. package/dist/cli.mjs +11 -5
  13. package/dist/config.mjs +2 -2
  14. package/dist/finding-rules.mjs +11 -0
  15. package/dist/layout-widths.mjs +132 -79
  16. package/dist/mcp/preview-watch.mjs +2 -2
  17. package/dist/mcp/server.mjs +2 -2
  18. package/dist/preview-resources.mjs +4 -1
  19. package/dist/scenarios-compiler.mjs +2 -2
  20. package/dist/skills/ads-break-ui/SKILL.md +2 -1
  21. package/dist/skills/ads-break-ui/references/design-data.md +34 -14
  22. package/dist/skills/ads-break-ui/references/validation.md +1 -1
  23. package/dist/skills/ads-designer/SKILL.md +6 -4
  24. package/dist/skills/ads-designer/references/design-data.md +34 -14
  25. package/dist/skills/ads-designer/references/validation.md +1 -1
  26. package/dist/skills/ads-import/references/design-data.md +34 -14
  27. package/dist/skills/ads-import/references/validation.md +1 -1
  28. package/dist/skills/ads-motion/references/design-data.md +34 -14
  29. package/dist/skills/ads-motion/references/validation.md +1 -1
  30. package/dist/skills/ads-port/references/design-data.md +34 -14
  31. package/dist/skills/ads-port/references/validation.md +1 -1
  32. package/dist/starters/preact/ds.config.json +0 -1
  33. package/dist/starters/react/README.md +6 -4
  34. package/dist/starters/react/design-system/components/Content/Image/Image.tsx +7 -4
  35. package/dist/starters/react/design-system/components/Content/Image/README.md +2 -2
  36. package/dist/starters/react/design-system/tokens/spacing.css +1 -1
  37. package/dist/starters/react/ds.config.json +0 -1
  38. package/docs/ADS.md +2 -2
  39. package/docs/ARCHITECTURE.md +9 -6
  40. package/docs/CHANGELOG.md +81 -12
  41. package/docs/GUIDE.md +77 -23
  42. package/package.json +1 -1
package/docs/GUIDE.md CHANGED
@@ -499,14 +499,17 @@ There is no warning level.
499
499
  | Gate | What runs |
500
500
  |---|---|
501
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 |
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, and in a 240 px container for components and patterns |
503
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
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
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
506
 
507
507
  **Browser audit.** Both policies run it by default. Each `a11y-axe`,
508
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:
509
+ naming what to install. Each `a11y-incomplete` finding is an info item that fails nothing: axe could
510
+ not decide that rule on those elements, so check it by hand. It names the axe rule, scenario, themes,
511
+ elements, and axe's reason, such as `bgGradient` for text over a gradient. The audit needs the
512
+ project's Playwright and a browser:
510
513
 
511
514
  ```sh
512
515
  npm install -D @playwright/test # ads create and ads init declare it
@@ -585,39 +588,53 @@ set to 0 under `prefers-reduced-motion`), `a11y-text-spacing` (`--leading-normal
585
588
  **Layout.** Widths are fluid on the grid.
586
589
 
587
590
  `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
+ `min-width`, `inline-size`, `min-inline-size`, `flex-basis`, the basis of `flex`, and
592
+ `grid-template-columns` tracks. Component variables declared in the same template and `var()`
593
+ fallbacks are read through. Each value is read at the smallest and largest container it can have,
594
+ so what counts is whether it can shrink.
591
595
 
592
596
  | Value | Result |
593
597
  |---|---|
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 |
598
+ | 96 px or less, in any unit, raw, through a token or by arithmetic: `64px`, `12ch`, `var(--control-height-lg)` | Pass: a small part may use a plain size |
599
+ | Fixed above 96 px, in any unit: `280px`, `32.5ch`, `20rem`, `var(--space-80)`, `calc(var(--space-32) * 10)` | Error. `ch`, `em`, `ex`, `lh` and `rem` are fixed lengths, estimated at the same rule's `font-size`, or 16 px |
600
+ | Unable to shrink below 96 px: `max(100%, 280px)`, `clamp(200px, 50%, 400px)`, `calc(100% + 200px)`, a `minmax(200px, 1fr)` track | Error |
601
+ | Able to shrink: `min(100%, 280px)`, `calc(100% - 200px)`, `50cqi`, a `minmax(0, 280px)` track, `width: 280px` with `max-width: 100%` in the same rule | Pass |
602
+ | A flex item that grows and shrinks: `flex: 1 1 280px` | Pass |
603
+ | A track repeated with `auto-fill` or `auto-fit`: `repeat(auto-fit, minmax(200px, 1fr))` | Pass: it wraps |
604
+ | `%`, `fr`, viewport and container units, `auto`, `min-content`, `max-content`, `fit-content` | Pass |
605
+ | `max-width`, `max-inline-size`, in any unit: `max-width: 1400px` | Not read: a maximum cannot force overflow |
606
+ | A token named by `layout.widthTokens`, used plainly, or a `clamp()` whose three values all are, such as a resizable pane: `clamp(var(--pane-min), var(--ux-pane, var(--pane)), var(--pane-max))` | Pass, and each is listed for review when it is fixed. A runtime variable there needs a declared fallback |
607
+ | A variable with no definition ADS can read: `var(--set-at-runtime)` | Pass: `layout-overflow` renders it |
608
+
609
+ No token name is exempt: `var(--side-pane-width)` is 280 px whatever it is called.
610
+
611
+ The fix depends on the part:
612
+
613
+ - A small part stays at 96 px or less, as a plain size.
614
+ - A panel, column or anything else that can give way: `width: min(100%, 280px)`,
615
+ `flex: 1 1 280px` or a `minmax(0, 280px)` track.
616
+ - A part that truly stays that wide: a token listed in `layout.widthTokens`, used plainly.
601
617
 
602
618
  `layout` in `ds.config.json` has two fields:
603
619
 
604
620
  ```json
605
621
  { "layout": {
606
- "widthTokens": ["--grid-span-*", "--container-*"],
622
+ "widthTokens": ["--side-pane-width", "--ux-panel-*"],
607
623
  "fixedWidthUnits": ["components/Overlays/*", "design-system/patterns/Menu/**"]
608
624
  } }
609
625
  ```
610
626
 
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`.
627
+ - `widthTokens`: token names or globs of widths that stay fixed.
614
628
  - `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
629
+ across them) whose widths are not checked. List overlays here: dialogs, menus, popovers and
616
630
  tooltips. There is no per-declaration exception.
617
631
 
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`).
632
+ `layout-declared-width` is a review item for each fixed `widthTokens` token, with how many widths
633
+ use it, and for each `fixedWidthUnits` file that sets a fixed width. `layout-width-noop` is a
634
+ review item for a `min()` or `clamp()` that never exceeds 96 px, such as `min(100%, 64px)`. It does
635
+ not protect against overflow and a plain size is clearer, but in a flex or grid parent the percentage
636
+ can affect wrapping, so compare the scenario after changing it. An entry that matches no token, unit or file is a `layout-config` error, and an
637
+ entry cannot name every token or unit.
621
638
 
622
639
  `layout-overflow` (browser audit) resizes each rendered scenario, in every theme and brand, to
623
640
  390, 768 and 1280 px. Each finding names the scenario, widths, themes, brands and elements:
@@ -626,8 +643,39 @@ width: a `--grid-span-N` token in a container query, `%` or `fr`, or a `ch` meas
626
643
  - An element reaches past the viewport's edge; the outermost such element is named.
627
644
  - An element with `overflow-x: hidden` or `clip` cuts off content more than 4 px wider.
628
645
 
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.
646
+ Exempt: `overflow-x: auto` or `scroll` scrollers and their content, except the outermost one as tall as the window, which is the page or a preview frame; `text-overflow: ellipsis`,
647
+ carousels (`aria-roledescription="carousel"`), pannable widgets (`role="application"`), native text fields, fixed-position layers and visually hidden content.
648
+
649
+ Each measurement waits for layout to stop moving, so a component that refits after a resize is
650
+ measured after it refits.
651
+
652
+ The audit also renders what a scenario shows after someone acts on it, in every theme and brand.
653
+ Findings name the state in the selector, such as `open overlay "Edit": button` or `hover: button`.
654
+
655
+ - **Overlays.** It clicks each distinct control with `aria-haspopup`, up to 3 per render, once per
656
+ theme and brand across the audit. What opens
657
+ (`dialog`, `alertdialog`, `menu`, `listbox` roles, an open `<dialog>` or popover) gets axe, non-text
658
+ contrast, and must fit the 390 px viewport. Give a trigger `aria-haspopup`, or render the overlay
659
+ open in its scenario. Tooltips are not opened.
660
+ - **Hover and focus.** Up to 6 controls per render, in document order, each distinct control once per
661
+ theme and brand on the same surface. Under hover it runs axe
662
+ `color-contrast` and the non-text check. A `:focus-visible` outline needs 3:1 against what is around
663
+ it. A focus ring drawn with `box-shadow` is not read, and an outline beside one is left alone.
664
+ - **Busy.** A control with `aria-busy="true"` is checked even when disabled, and its icon even when it
665
+ has text. Render the busy state in the scenario: the audit does not press buttons to reach it.
666
+
667
+ It also renders each component and pattern scenario with its container narrowed to 240 px, inside
668
+ the 1280 px viewport, once per brand, to show what would not fit a side pane. These are
669
+ `layout-overflow-narrow` review items: fix the part if it can sit in a pane, or change a scenario's
670
+ demo frame to a maximum.
671
+
672
+ - An element past the container's edge, or cut off inside it, is reported when it or something in it
673
+ has a set width, `min-width` or unshrinking `flex-basis` above 96 px. A row or table held open only
674
+ by its content, or by parts of 96 px or less, is not reported.
675
+ - Not rendered this way: compositions, scenarios with a `main` landmark, which are pages, and owners
676
+ in `layout.fixedWidthUnits`, which float above the layout.
677
+ - A finding that clears at the 390 px viewport, still in the 240 px container, is left out: it folds
678
+ on a viewport media query, such as a full-width site header.
631
679
 
632
680
  **Web performance.** MCP serves this as `ads://guides/performance`.
633
681
 
@@ -937,7 +985,13 @@ preview, and its **Icons** tab shows the glyph set: every glyph at the size used
937
985
  text, each one on its grid at every `--icon-*` size with its aliases and glyph errors, and
938
986
  each file in `assets/logos/` as it is, on a white and a black tile.
939
987
 
940
- `ads audit` adds a rendered check: axe-core (WCAG A/AA rules) in every component, pattern
988
+ `ads audit` runs `ads check` first. A policy error such as `layout-fixed-width` or `img-attributes`
989
+ does not stop it: it renders every scenario and reports those errors with its own, and exits 1. Only
990
+ an error that stops rendering blocks it (`source-syntax`, `css-syntax`, `project-structure`,
991
+ `styles-entry`, `scenario-contract`); a broken import fails the scenarios that reach it. `ads check`,
992
+ `ads compile` and `ads validate` stop on every error, as before.
993
+
994
+ It adds a rendered check: axe-core (WCAG A/AA rules) in every component, pattern
941
995
  and composition scenario, once per declared brand and theme (`--scenario`, `--theme` and
942
996
  `--brand` narrow it). Each violation is an `a11y-axe` error naming the axe rule, WCAG
943
997
  criterion, themes and brands, failing elements and help link, and `ads audit` exits 1. It
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.3.50",
3
+ "version": "0.3.52",
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": {