@reqvire-org/ads 0.3.49 → 0.3.51
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.
- package/README.md +36 -6
- package/dist/active-clock.mjs +34 -0
- package/dist/assets.mjs +20 -2
- package/dist/boundaries.mjs +2 -0
- package/dist/browser-audit/first-render.mjs +18 -0
- package/dist/browser-audit/layout-overflow.mjs +98 -0
- package/dist/browser-audit/layout-shift.mjs +32 -0
- package/dist/browser-audit/non-text-contrast.mjs +87 -0
- package/dist/browser-audit/worker.mjs +52 -15
- package/dist/browser-audit.mjs +239 -22
- package/dist/capture/worker.mjs +2 -5
- package/dist/check.mjs +16 -1
- package/dist/cli.mjs +9 -5
- package/dist/component-contrast.mjs +138 -0
- package/dist/config.mjs +12 -6
- package/dist/finding-rules.mjs +16 -1
- package/dist/fonts-generated.mjs +85 -0
- package/dist/image-attributes.mjs +110 -0
- package/dist/init.mjs +2 -0
- package/dist/layout-widths.mjs +228 -0
- package/dist/mcp/context.mjs +1 -1
- package/dist/mcp/mutations.mjs +7 -5
- package/dist/mcp/preview-watch.mjs +9 -8
- package/dist/mcp/server.mjs +6 -4
- package/dist/preview-files.mjs +3 -0
- package/dist/project-boundary.mjs +23 -0
- package/dist/project-documents.mjs +2 -1
- package/dist/scenarios-compiler.mjs +23 -3
- package/dist/showcase/client.bundle.js +11 -11
- package/dist/showcase/icons.js +5 -5
- package/dist/showcase/style.css +1 -1
- package/dist/skills/ads-break-ui/SKILL.md +9 -0
- package/dist/skills/ads-break-ui/references/atomic-styles.md +2 -0
- package/dist/skills/ads-break-ui/references/design-data.md +52 -0
- package/dist/skills/ads-break-ui/references/drafts.md +1 -1
- package/dist/skills/ads-break-ui/references/guarded-editing.md +1 -1
- package/dist/skills/ads-break-ui/references/validation.md +9 -5
- package/dist/skills/ads-designer/SKILL.md +26 -4
- package/dist/skills/ads-designer/references/accessibility.md +30 -13
- package/dist/skills/ads-designer/references/atomic-styles.md +2 -0
- package/dist/skills/ads-designer/references/branding.md +10 -5
- package/dist/skills/ads-designer/references/cli.md +2 -1
- package/dist/skills/ads-designer/references/design-data.md +52 -0
- package/dist/skills/ads-designer/references/drafts.md +1 -1
- package/dist/skills/ads-designer/references/guarded-editing.md +1 -1
- package/dist/skills/ads-designer/references/mobile.md +3 -0
- package/dist/skills/ads-designer/references/performance.md +89 -0
- package/dist/skills/ads-designer/references/validation.md +9 -5
- package/dist/skills/ads-import/references/atomic-styles.md +2 -0
- package/dist/skills/ads-import/references/cli.md +2 -1
- package/dist/skills/ads-import/references/design-data.md +52 -0
- package/dist/skills/ads-import/references/drafts.md +1 -1
- package/dist/skills/ads-import/references/guarded-editing.md +1 -1
- package/dist/skills/ads-import/references/validation.md +9 -5
- package/dist/skills/ads-motion/references/atomic-styles.md +2 -0
- package/dist/skills/ads-motion/references/design-data.md +52 -0
- package/dist/skills/ads-motion/references/drafts.md +1 -1
- package/dist/skills/ads-motion/references/guarded-editing.md +1 -1
- package/dist/skills/ads-motion/references/validation.md +9 -5
- package/dist/skills/ads-port/references/atomic-styles.md +2 -0
- package/dist/skills/ads-port/references/cli.md +2 -1
- package/dist/skills/ads-port/references/design-data.md +52 -0
- package/dist/skills/ads-port/references/drafts.md +1 -1
- package/dist/skills/ads-port/references/guarded-editing.md +1 -1
- package/dist/skills/ads-port/references/validation.md +9 -5
- package/dist/starters/preact/package.json +1 -0
- package/dist/starters/react/ADS.md +1 -1
- package/dist/starters/react/README.md +16 -2
- package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +1 -1
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.fixture.ts +2 -0
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.scenario.tsx +13 -0
- package/dist/starters/react/design-system/components/Content/Image/Image.tsx +51 -0
- package/dist/starters/react/design-system/components/Content/Image/README.md +20 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +2 -2
- package/dist/starters/react/design-system/index.ts +1 -0
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +16 -0
- package/dist/starters/react/design-system/tokens/spacing.css +18 -0
- package/dist/starters/react/package-lock.json +47 -0
- package/dist/starters/react/package.json +2 -1
- package/dist/test-boundaries.mjs +30 -1
- package/dist/themes-generated.mjs +15 -4
- package/dist/token-quality.mjs +27 -17
- package/dist/units.mjs +2 -1
- package/dist/validation-checks.mjs +5 -4
- package/dist/validation.mjs +1 -1
- package/dist/verification/browser.mjs +28 -2
- package/dist/verification.mjs +5 -4
- package/docs/ADS.md +4 -1
- package/docs/ARCHITECTURE.md +16 -3
- package/docs/CHANGELOG.md +127 -12
- package/docs/GUIDE.md +238 -14
- package/docs/MCP.md +14 -10
- package/package.json +1 -1
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.
|
|
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.
|
|
448
|
-
for
|
|
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,217 @@ 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, and in a 240 px container for components and patterns |
|
|
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. 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:
|
|
513
|
+
|
|
514
|
+
```sh
|
|
515
|
+
npm install -D @playwright/test # ads create and ads init declare it
|
|
516
|
+
npx playwright install chromium # Bun: bunx playwright install chromium
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
`mcp.capture` selects `browser` (`chromium`, `firefox`, `webkit`), an installed Chrome
|
|
520
|
+
`channel` such as `"chrome"`, and `timeoutMs`. To turn the audit off for a policy, set
|
|
521
|
+
`browserAudit` to `false` in `ds.config.json`:
|
|
522
|
+
|
|
523
|
+
```json
|
|
524
|
+
{
|
|
525
|
+
"acceptance": { "checks": [], "behaviorChecks": false, "browserAudit": false },
|
|
526
|
+
"validation": { "checks": [], "behaviorChecks": true, "browserAudit": false }
|
|
527
|
+
}
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
Declare `"sideEffects": ["**/*.css"]` in `package.json`, as the starters do, so a
|
|
531
|
+
component change audits only the scenarios that import it.
|
|
532
|
+
|
|
533
|
+
A render that fails because the preview dropped or was slow is retried on its own, up to 3
|
|
534
|
+
attempts, with a new browser and preview; the others keep their results, and findings never
|
|
535
|
+
cause a retry. The JSON result and the check list retried passes under `retries`, and `ads
|
|
536
|
+
audit` prints them. A scenario that still fails is a `browser-audit` error naming it and the
|
|
537
|
+
last cause, beside any findings. A project that fails validation stops the audit.
|
|
538
|
+
|
|
539
|
+
**Non-text contrast.** axe-core does not check WCAG 1.4.11, so the audit adds
|
|
540
|
+
`a11y-non-text-contrast` for every visible, enabled `button`, `input`, `select`, `textarea`,
|
|
541
|
+
`a[href]` and `switch`, `checkbox`, `radio`, `slider` and `tab` role in the rendered state:
|
|
542
|
+
|
|
543
|
+
- A control whose background has less than 3:1 against the background around it and that
|
|
544
|
+
has a visible border needs that border at 3:1 against the surrounding background. Use
|
|
545
|
+
`--border-strong` (or a stronger step) for a field or control outline; `--border-default`
|
|
546
|
+
is for dividers and card edges. A button, link or tab with text or an icon is exempt: that
|
|
547
|
+
content identifies it.
|
|
548
|
+
- An icon-only control (an `svg`, no text) needs the icon's stroke or fill at 3:1 against
|
|
549
|
+
the control's background. Paint icons with a text or `-fg` token.
|
|
550
|
+
|
|
551
|
+
Disabled and `aria-disabled="true"` controls, controls whose background has 3:1 against
|
|
552
|
+
their surroundings, browser-drawn native checkboxes, radios and ranges, and controls over a
|
|
553
|
+
background image are exempt. Each finding names the scenario, themes and brands, element
|
|
554
|
+
selectors and the lowest ratio. Hover and focus states are not rendered by the audit.
|
|
555
|
+
|
|
556
|
+
**Contrast.** `token-contrast` checks the role pairs that meet on screen in every theme and
|
|
557
|
+
brand: text, link, accent and status text on their backgrounds need 4.5:1; focus indicators
|
|
558
|
+
and control borders on canvas and surface need 3:1. It resolves every CSS color syntax,
|
|
559
|
+
including `oklch()` and `color-mix()`, and composites translucent colors over their
|
|
560
|
+
background and the canvas. A pair color it cannot resolve statically (`currentColor`,
|
|
561
|
+
relative color syntax) is a `token-contrast-unresolved` info item. Fix a failing pair by
|
|
562
|
+
choosing another ramp step.
|
|
563
|
+
|
|
564
|
+
`component-contrast` checks the pairs components and patterns make themselves. Where one
|
|
565
|
+
Linaria style block (the template's top level, a nested block such as `&:hover` or
|
|
566
|
+
`&[aria-selected="true"]`, or an at-rule) declares both `color: var(--a)` and
|
|
567
|
+
`background` or `background-color: var(--b)`, the pair needs 4.5:1 in every theme and brand,
|
|
568
|
+
resolved and composited as `token-contrast` resolves it. Local custom properties set in the
|
|
569
|
+
block or an enclosing block resolve one level; an undeclared one reads its `var()` fallback.
|
|
570
|
+
Fix it with the role contract: `--x-text` on
|
|
571
|
+
`--x-bg`, `--x-fg` on `--x` (not `--success` as text on `--success-bg`). Disabled states
|
|
572
|
+
(`:disabled`, `[disabled]`, `[aria-disabled="true"]`, `[data-disabled]`) are exempt;
|
|
573
|
+
`currentColor`, `inherit`, `transparent`, fully transparent backgrounds, one token on both
|
|
574
|
+
sides and native `<progress>`, `<meter>` and range parts are skipped. A side that names no
|
|
575
|
+
declared color token is a `component-contrast-unresolved` info item; so is text matching the
|
|
576
|
+
canvas (under 1.25:1) over a translucent background, which sits on another backdrop.
|
|
577
|
+
Pairs `token-contrast` checks are not repeated. A `color-contrast` audit finding that
|
|
578
|
+
neither static check reports comes from colors the block does not pair itself, such as text
|
|
579
|
+
inheriting its color onto a nested background.
|
|
580
|
+
|
|
581
|
+
**Static accessibility.** Errors: `a11y-target-size` (`--control-height-*` at least 24 px),
|
|
582
|
+
`a11y-focus` (`--focus-w` at least 2 px and a `:focus-visible` indicator in `base.css`),
|
|
583
|
+
`a11y-text-resize` (font sizes in `rem`), `a11y-reduced-motion` (every non-zero `--dur-*`
|
|
584
|
+
set to 0 under `prefers-reduced-motion`), `a11y-text-spacing` (`--leading-normal` at least
|
|
585
|
+
1.5, `--content-max` under 80 characters), `a11y-image-alt` and `a11y-icon-label`.
|
|
586
|
+
`a11y-keyboard` is a review item.
|
|
587
|
+
|
|
588
|
+
**Layout.** Widths are fluid on the grid.
|
|
589
|
+
|
|
590
|
+
`layout-fixed-width` (`ads check`) reads component, pattern and composition styles: `width`,
|
|
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.
|
|
595
|
+
|
|
596
|
+
| Value | Result |
|
|
597
|
+
|---|---|
|
|
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 a 16 px font |
|
|
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 | Pass, and listed for review when it is fixed |
|
|
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.
|
|
617
|
+
|
|
618
|
+
`layout` in `ds.config.json` has two fields:
|
|
619
|
+
|
|
620
|
+
```json
|
|
621
|
+
{ "layout": {
|
|
622
|
+
"widthTokens": ["--side-pane-width", "--ux-panel-*"],
|
|
623
|
+
"fixedWidthUnits": ["components/Overlays/*", "design-system/patterns/Menu/**"]
|
|
624
|
+
} }
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
- `widthTokens`: token names or globs of widths that stay fixed.
|
|
628
|
+
- `fixedWidthUnits`: unit ids or project-relative file globs (`*` within a path segment, `**`
|
|
629
|
+
across them) whose widths are not checked. List overlays here: dialogs, menus, popovers and
|
|
630
|
+
tooltips. There is no per-declaration exception.
|
|
631
|
+
|
|
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)`: write
|
|
635
|
+
the plain size. An entry that matches no token, unit or file is a `layout-config` error, and an
|
|
636
|
+
entry cannot name every token or unit.
|
|
637
|
+
|
|
638
|
+
`layout-overflow` (browser audit) resizes each rendered scenario, in every theme and brand, to
|
|
639
|
+
390, 768 and 1280 px. Each finding names the scenario, widths, themes, brands and elements:
|
|
640
|
+
|
|
641
|
+
- The document scrolls horizontally.
|
|
642
|
+
- An element reaches past the viewport's edge; the outermost such element is named.
|
|
643
|
+
- An element with `overflow-x: hidden` or `clip` cuts off content more than 4 px wider.
|
|
644
|
+
|
|
645
|
+
Exempt: `overflow-x: auto` or `scroll` scrollers and their content, `text-overflow: ellipsis`,
|
|
646
|
+
carousels (`aria-roledescription="carousel"`), native text fields, fixed-position layers and visually hidden content.
|
|
647
|
+
|
|
648
|
+
Each measurement waits for layout to stop moving, so a component that refits after a resize is
|
|
649
|
+
measured after it refits.
|
|
650
|
+
|
|
651
|
+
It also renders each component and pattern scenario with its container narrowed to 240 px, inside
|
|
652
|
+
the 1280 px viewport, once per brand, to show what would not fit a side pane. These are
|
|
653
|
+
`layout-overflow-narrow` review items: fix the part if it can sit in a pane, or change a scenario's
|
|
654
|
+
demo frame to a maximum.
|
|
655
|
+
|
|
656
|
+
- An element past the container's edge, or cut off inside it, is reported when it or something in it
|
|
657
|
+
has a set width, `min-width` or unshrinking `flex-basis` above 96 px. A row or table held open only
|
|
658
|
+
by its content, or by parts of 96 px or less, is not reported.
|
|
659
|
+
- Not rendered this way: compositions, scenarios with a `main` landmark, which are pages, and owners
|
|
660
|
+
in `layout.fixedWidthUnits`, which float above the layout.
|
|
661
|
+
|
|
662
|
+
**Web performance.** MCP serves this as `ads://guides/performance`.
|
|
663
|
+
|
|
664
|
+
| Rule | Gate | Fails |
|
|
665
|
+
|---|---|---|
|
|
666
|
+
| `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 |
|
|
667
|
+
| `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 |
|
|
668
|
+
| `layout-shift` | `ads audit` | A scenario with Cumulative Layout Shift above 0.1 on first render, where the browser reports it (Chromium) |
|
|
669
|
+
| `themes-generated` | `ads check` | A stale `tokens/fonts.preload.generated.ts` |
|
|
670
|
+
|
|
671
|
+
The starters' `Image` lazily loads and reserves space; `priority` marks the view's main visible
|
|
672
|
+
image. When body or heading text uses a font from `tokens/fonts.css`, `ads assets` writes
|
|
673
|
+
`tokens/fonts.preload.generated.ts`: call its `preloadFonts()` in the app entry before the first
|
|
674
|
+
render. It imports the files through the bundler, so the preload and the stylesheet share one URL.
|
|
675
|
+
ADS does not cover page metadata, `noindex`, sitemaps or hosting; run Lighthouse on a production
|
|
676
|
+
build with real URLs.
|
|
677
|
+
|
|
678
|
+
**Themes and brands.** Themed tokens are per-theme halves (`--x-light`, `--x-dark`) on
|
|
679
|
+
`:root`; brands set their own halves on `[data-brand]`. `ads assets` generates
|
|
680
|
+
`themes.generated.css` and `.ts`. Missing or conflicting halves, empty themes or brands,
|
|
681
|
+
stale generated files, `light-dark()` and `[data-theme]`/`[data-brand]` ancestor selectors
|
|
682
|
+
in components are errors; see [Tokens, grid, icons and accessibility](#tokens-grid-icons-and-accessibility).
|
|
683
|
+
|
|
684
|
+
**Tokens.** Ownership, naming, the 2 px spacing rhythm (`token-rhythm`), missing names and
|
|
685
|
+
scenario references are errors; equal values in different roles are a
|
|
686
|
+
`token-overlap-review` item.
|
|
687
|
+
|
|
688
|
+
**Architecture.** Data, UX and Skin ownership, project structure, unit and paint contracts,
|
|
689
|
+
and binding and variable ownership are errors; Linaria atomic composition risks are
|
|
690
|
+
`atomic-composition-review` items. See [Generic architecture guards](#generic-architecture-guards).
|
|
691
|
+
|
|
692
|
+
**Behavior.** A registered guarantee needs current passing execution evidence. `ads verify`
|
|
693
|
+
runs the registered checks against current source (`--unit` and `--check` select); the
|
|
694
|
+
validation policy runs all of them, the acceptance policy the affected ones when
|
|
695
|
+
`acceptance.behaviorChecks` is `true`.
|
|
696
|
+
|
|
483
697
|
## Showcase
|
|
484
698
|
|
|
485
699
|
ADS ships a minimal browser shell, MCP client and Apps host. `ads mcp` serves the
|
|
@@ -724,8 +938,11 @@ nothing. Commit outputs and the manifest together.
|
|
|
724
938
|
becomes `glyphAliases`. `ads assets` writes it and `ads check` fails when it is stale.
|
|
725
939
|
Other products' logos are not brand artwork or glyphs: keep them, in their own
|
|
726
940
|
colors and under their owners' trademark and usage terms, in `assets/logos/` and
|
|
727
|
-
show them as images
|
|
728
|
-
|
|
941
|
+
show them as images; ADS generates and checks nothing there. Never mute, tint or recolor
|
|
942
|
+
another product's logo. Use a one-color version only where its owner's published rules allow
|
|
943
|
+
it and in the colors they name; a CSS mask over a color token then keeps the shape and
|
|
944
|
+
follows the theme. A quieter version needs the owner's rule or written permission. Record each
|
|
945
|
+
file's source and rule in `assets/logos/README.md`.
|
|
729
946
|
|
|
730
947
|
### Tokens, grid, icons and accessibility
|
|
731
948
|
|
|
@@ -748,16 +965,17 @@ can judge: `atomic-composition-review`, `token-overlap-review`, `pointer-capture
|
|
|
748
965
|
changes a finding's kind. The showcase's grid button overlays the project's grid on every
|
|
749
966
|
preview, and its **Icons** tab shows the glyph set: every glyph at the size used beside
|
|
750
967
|
text, each one on its grid at every `--icon-*` size with its aliases and glyph errors, and
|
|
751
|
-
|
|
968
|
+
each file in `assets/logos/` as it is, on a white and a black tile.
|
|
752
969
|
|
|
753
970
|
`ads audit` adds a rendered check: axe-core (WCAG A/AA rules) in every component, pattern
|
|
754
971
|
and composition scenario, once per declared brand and theme (`--scenario`, `--theme` and
|
|
755
972
|
`--brand` narrow it). Each violation is an `a11y-axe` error naming the axe rule, WCAG
|
|
756
973
|
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
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
writing source, and an `a11y-axe` error rejects
|
|
974
|
+
needs the project's Playwright and browser, as captures do. The validation and acceptance
|
|
975
|
+
policies run it too unless their `browserAudit` is `false`; MCP draft acceptance and
|
|
976
|
+
guarded patches audit the candidate's affected scenarios before
|
|
977
|
+
writing source, and an `a11y-axe`, `a11y-non-text-contrast` or `layout-overflow` error rejects
|
|
978
|
+
the change.
|
|
761
979
|
`ads tokens --format dtcg` exports the tokens as W3C Design Tokens JSON for design tools
|
|
762
980
|
(`--theme <name>` and `--brand <name>` select one context).
|
|
763
981
|
|
|
@@ -973,7 +1191,9 @@ inspection errors fail the check. These guards read files and never delete them.
|
|
|
973
1191
|
|
|
974
1192
|
## Configuration and component rules
|
|
975
1193
|
|
|
976
|
-
`ds.config.json` uses schema version 1.
|
|
1194
|
+
`ds.config.json` uses schema version 1. A subfolder with its own `ds.config.json` is a separate
|
|
1195
|
+
project: check, validation, audits, previews and watches stop there and run in it on their own.
|
|
1196
|
+
Paths stay within the receiving project:
|
|
977
1197
|
|
|
978
1198
|
```json
|
|
979
1199
|
{
|
|
@@ -987,10 +1207,14 @@ inspection errors fail the check. These guards read files and never delete them.
|
|
|
987
1207
|
"tokenDir": "tokens",
|
|
988
1208
|
"themes": [{ "name": "light", "scheme": "light" }, { "name": "dark", "scheme": "dark" }],
|
|
989
1209
|
"inlineStyleFiles": [],
|
|
1210
|
+
"layout": { "widthTokens": [], "fixedWidthUnits": [] },
|
|
990
1211
|
"oxlint": { "plugins": [], "rules": {} }
|
|
991
1212
|
}
|
|
992
1213
|
```
|
|
993
1214
|
|
|
1215
|
+
`layout` declares allowed width tokens and owners with fixed widths; see
|
|
1216
|
+
[Checks and guards](#checks-and-guards).
|
|
1217
|
+
|
|
994
1218
|
These source-layout defaults apply when the file is absent; the example omits
|
|
995
1219
|
the required init-time framework choice. Run `ads init --framework react` (or
|
|
996
1220
|
`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.
|
|
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
|
|
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,
|
|
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,
|
|
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
|
|
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:
|
|
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`
|
|
1432
|
-
|
|
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
|