@reqvire-org/ads 0.5.4 → 0.5.5
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/dist/ads-errors.mjs +105 -8
- package/dist/analysis/client-directive.mjs +26 -0
- package/dist/analysis/externals.mjs +47 -0
- package/dist/analysis/module-graph.mjs +6 -0
- package/dist/analysis/owner-analysis-key.mjs +1 -1
- package/dist/analysis/owner-choices.mjs +12 -2
- package/dist/analysis/owner-composition.mjs +19 -4
- package/dist/analysis/owner-source.mjs +112 -15
- package/dist/border-paint.mjs +34 -0
- package/dist/check.mjs +2 -0
- package/dist/composed-contrast.mjs +10 -7
- package/dist/construction-output.mjs +52 -27
- package/dist/construction-spec.d.mts +40 -10
- package/dist/construction-spec.mjs +41 -17
- package/dist/corner-overpaint.mjs +3 -1
- package/dist/design-foundation.mjs +14 -0
- package/dist/emit/owner-emission-cache.mjs +1 -1
- package/dist/end-alignment.mjs +69 -0
- package/dist/external-macro.d.mts +20 -0
- package/dist/external-macro.mjs +12 -0
- package/dist/finding-rules.mjs +3 -0
- package/dist/forced-colors.mjs +81 -0
- package/dist/frame-regions.mjs +2 -2
- package/dist/guard/externals.mjs +64 -0
- package/dist/guard/run.mjs +9 -5
- package/dist/inventories.mjs +1 -1
- package/dist/lowering-layer.mjs +38 -4
- package/dist/lowering-overlaps.mjs +7 -0
- package/dist/lowering-properties.mjs +1 -0
- package/dist/lowering-region-layout.mjs +22 -3
- package/dist/lowering-session.mjs +1 -1
- package/dist/mcp/preview-http.bundle.js +2 -2
- package/dist/mcp/preview-widget.bundle.js +12 -12
- package/dist/measured-geometry.mjs +8 -2
- package/dist/owner-analysis-check.mjs +190 -11
- package/dist/owner-errors.mjs +3 -0
- package/dist/owner-lowering.mjs +3 -2
- package/dist/ownership-model.mjs +6 -3
- package/dist/platform-features.mjs +1 -0
- package/dist/preview-bun.mjs +15 -2
- package/dist/profile-macro.d.mts +18 -0
- package/dist/recipe-macro.d.mts +49 -6
- package/dist/recipe-model.mjs +13 -5
- package/dist/region-lowering.mjs +115 -22
- package/dist/render-audit/axe-run.page.mjs +40 -1
- package/dist/render-audit/forced-states.page.mjs +37 -0
- package/dist/render-audit/layout-overflow.page.mjs +52 -2
- package/dist/render-audit/non-text-contrast.page.mjs +14 -10
- package/dist/render-audit/worker.mjs +38 -0
- package/dist/render-audit.mjs +42 -5
- package/dist/role-vocabulary.d.mts +2 -2
- package/dist/role-vocabulary.mjs +3 -3
- package/dist/scenario-kit.d.mts +2 -2
- package/dist/showcase/assets-view.mjs +12 -47
- package/dist/showcase/client.bundle.js +54 -54
- package/dist/showcase/http-client.bundle.js +18 -18
- package/dist/showcase/token-sample.mjs +2 -2
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +13 -13
- package/dist/skills/ads-designer/references/accessibility.md +21 -1
- package/dist/skills/ads-designer/references/branding.md +4 -0
- package/dist/skills/ads-designer/references/design-data.md +6 -0
- package/dist/skills/ads-designer/references/layers.md +5 -0
- package/dist/skills/ads-designer/references/layout.md +8 -1
- package/dist/skills/ads-designer/references/recipes.md +36 -0
- package/dist/skills/ads-designer/references/runtimes.md +4 -0
- package/dist/skills/ads-designer/references/scenarios.md +2 -0
- package/dist/skills/ads-import/references/design-data.md +6 -0
- package/dist/skills/ads-import/references/layers.md +5 -0
- package/dist/skills/ads-import/references/layout.md +8 -1
- package/dist/skills/ads-import/references/recipes.md +36 -0
- package/dist/skills/ads-import/references/runtimes.md +4 -0
- package/dist/skills/ads-import/references/scenarios.md +2 -0
- package/dist/skills/ads-migrate/SKILL.md +1 -0
- package/dist/skills/ads-migrate/references/0.5.4-to-0.5.5.md +61 -0
- package/dist/skills/ads-port/references/design-data.md +6 -0
- package/dist/skills/ads-port/references/layers.md +5 -0
- package/dist/skills/ads-port/references/layout.md +8 -1
- package/dist/skills/ads-port/references/recipes.md +36 -0
- package/dist/skills/ads-port/references/runtimes.md +4 -0
- package/dist/skills/ads-port/references/scenarios.md +2 -0
- package/dist/spatial-model.mjs +37 -10
- package/dist/system-colors.d.mts +9 -0
- package/dist/system-colors.mjs +1 -0
- package/dist/target-size.mjs +14 -1
- package/dist/tsconfig.declarations.json +1 -0
- package/docs/ADS.md +23 -1
- package/docs/ASSETS.md +21 -0
- package/docs/CACHING.md +1 -1
- package/docs/CHANGELOG.md +167 -21
- package/docs/GUIDE.md +31 -20
- package/docs/LANGUAGE.md +118 -6
- package/docs/PROFILE-KINDS.md +50 -4
- package/docs/RULES.md +21 -8
- package/package.json +5 -1
package/docs/LANGUAGE.md
CHANGED
|
@@ -246,6 +246,8 @@ them all.
|
|
|
246
246
|
| `kind: "component"` | region part | a public component placed with the part's marker (`<Heading className="ds-content-heading" …/>`), as a grid cell is: its interior is its owner's, so the part states placement only (`required`, `repeat`, `extent`, `at`, `spaceBefore`, `spaceAfter`) | any other field (`spec/field-unsupported`); a forwarded `className` that carries a recipe (`source/foreign-interior`) |
|
|
247
247
|
| `spaceBefore` / `spaceAfter: { slot: "spacing", field }` | part of a `stack`, or of a parent without an arrangement (block flow: a list item that keeps its marker) | the part's own space before it and after it, in place of the gap (`margin-block-start: calc(space - gap)` on the part, or on what follows it); where one part's space after meets the next part's space before, the larger applies; the first part starts flush | another parent layout (`space-parent-unsupported`) |
|
|
248
248
|
| `spacing: "<spacing profile>"` | part of a `stack` or block flow | the part's space before and after it from that profile's `spaceBefore` and `spaceAfter` fields, where a flow needs more distances than one spacing profile holds (a heading 44 px above and 14 px below, 24 px after a quote); the same "larger of the two" rule | a profile that states neither field (`profile-field-missing`) |
|
|
249
|
+
| (a `stack` of blocks) | root, part recipe | the blocks a stack holds end on one line: a painted block by its outer edge, an unpainted one where its content ends (frame end padding, a grid's gutter end); one off by more than 1px and at most 64px fails (`source/end-misaligned`); text is not compared | n/a |
|
|
250
|
+
| `carry: true` | `stack` root | loose flow (a list whose items hold paragraphs, code, figures): the stack gives its gap to its children (`--ads-flow-gap`), and its last part's own space after carries out of it between items (`margin-block-end: max(0px, space - gap)`), so on a list and its item the next item starts at the larger of the list's gap and the item's last block's space after; after the last item the list's own space after applies | a root that is not a stack (`space-parent-unsupported`) |
|
|
249
251
|
| a part rendered as `p`, `h1`–`h6`, `ul`, `ol`, `dl`, `dd`, `blockquote`, `figure`, `pre`, `hr`, `menu` | region part | `margin: 0`: the arrangement owns the space around a part, so the browser's margin is reset; a part that states its own margin (`normalize: { margin: 0 }`, now allowed on parts too) keeps it | n/a |
|
|
250
252
|
| `between: { surface, frame }` | root, part | a rule between consecutive children: the frame profile's `borderWidth` and `borderStyle`, painted by the surface's `borderColor`, on `& > * + *` (`border-block-start`, or `border-inline-start` in a row): a hairline between table rows or settings rows, none after the last | a frame without `borderWidth` or a surface without `borderColor` (`profile-field-missing`) |
|
|
251
253
|
| `presence: "assistive"` | part | hidden on screen and still read by assistive technology (a table caption, a skip link's text): a one-pixel clipped box out of the flow | n/a |
|
|
@@ -256,6 +258,7 @@ them all.
|
|
|
256
258
|
| `markers: [<style per depth>]` | a list root | `list-style-type` on the list and on the same list nested at each depth (`& li &`), outermost first; deeper lists keep the last: bullets (`disc`, `circle`, `square`, `none`) or a number system | more than three, or an unknown style (`spec/value-invalid`) |
|
|
257
259
|
| `anchorClear: { slot: "layer", field: "clearBlockStart" }` or `{ slot: "spacing", field: "anchorGap" }` | root (not a top-layer root), part | `scroll-margin-block-start`: where a jump to the element (a fragment link, `scrollIntoView`) lands below the top of its scroll container. The layer profile's `clearBlockStart` puts it right under the region sticky elements clear; the spacing profile's `anchorGap` is the element's own distance, for a target that lines up with something beside it (a heading level with a sticky side column). Layout is unchanged. ADS does not check that the distance clears what is stuck on the page the owner ends up in | another slot or field (`spec/value-invalid`); on a top-layer root (`spec/field-unsupported`) |
|
|
258
260
|
| `overflow: "clip" \| "scroll-block" \| "scroll-inline" \| "scroll-both"` | root, part | `overflow` (physical x/y pair of the horizontal writing mode) and a released axis minimum | on a top-layer root (`profile-provider-conflict`); with truncation |
|
|
261
|
+
| `justify: "space-between" \| "space-around" \| "space-evenly"` | inline or stack root, part | `justify-content`: the free space between the items (a logo at the start, actions at the end); a wrapping row distributes each line | `field-unsupported` on a layered element (its layers share one area) |
|
|
259
262
|
| `align` / `justify` on an element that scrolls | root, part | `safe center` / `safe end` on the axis the element itself scrolls: content stays aligned while it fits and starts at the scroll origin when it overflows, so its start is never unreachable | n/a (automatic) |
|
|
260
263
|
| a rounded frame (`radius`) with visible overflow | region root | n/a | a first or last part of a stack, or a layer, that paints a background over a corner with no inset there (`construction/corner-overpaint`): clip the root, inset it, or round the part |
|
|
261
264
|
| `sticky: { edge: "block-start" \| "block-end", clear?: "block-start" }` | root (not a top-layer root), part | `position: sticky` at that edge of the nearest scrolling container (`inset-block-start: 0`); with `clear`, below the region the layer profile's `clearBlockStart` names; `z-index` from the layer profile's `stickyLayer` when it has one | `clear` with the end edge; `clear` without a layer profile that states `clearBlockStart` |
|
|
@@ -268,10 +271,11 @@ them all.
|
|
|
268
271
|
| `at: { "<condition>": { visible } }` | part | `display: none` inside the condition's range, the part's own display inside its complement | unknown condition (`condition-unknown`); a required part hidden (`condition-hides-required`); more than one condition |
|
|
269
272
|
| `at: { "<condition>": { visual: "<visual profile>" } }` | visual part (`kind: "visual"`) | the part's geometry at that profile's size, inside the condition's range; may stand beside `visible` | a part that is not a visual, cropped or inspected media, or a size that selects another drawing of the asset (`construction/condition-visual-unsupported`) |
|
|
270
273
|
| `recipe.conditionQuery["<condition>"]` | owner code | the literal media range the CSS writes (`(width < 47.5rem)`), for `matchMedia` | the recipe's spatial profile lacks it (`choice/recipe-access-unsupported`) |
|
|
271
|
-
| `element: "iframe" \| "select" \| "search-input" \| "text-input" \| "table" \| "header-cell" \| "cell" \| "list" \| "summary"`, `marker: "none"` | root, part | the element's closed UA normalization (no iframe border, list markers or summary marker; collapsed table; start-aligned, middle cells) | another tag (`source/part-element-mismatch`); a summary outside `<details>` (`source/summary-outside-details`) |
|
|
274
|
+
| `element: "iframe" \| "select" \| "search-input" \| "text-input" \| "table" \| "header-cell" \| "cell" \| "list" \| "summary" \| "document"`, `marker: "none"` | root, part (`document`: a pattern's root only) | the element's closed UA normalization (no iframe border, list markers or summary marker; collapsed table; start-aligned, middle cells) | another tag (`source/part-element-mismatch`); a summary outside `<details>` (`source/summary-outside-details`) |
|
|
275
|
+
| `align: "start" \| "center" \| "end"` on a cell (`element: "cell" \| "header-cell"`); `extent: "container"` on a table root | cell; table root | `vertical-align: top \| middle \| bottom` (rows whose cells wrap to different line counts start together at the top); `inline-size: 100%` (a table as wide as its container instead of its content) | `align` on any other part (`field-unsupported`); a table frame that fixes its width as well (`extent-conflict`) |
|
|
272
276
|
| `normalize: { textDecoration: "none", pointerEvents: "none", borderStyle: "none" }` | root, `normalize.when` | `text-decoration-line`, `pointer-events`, `border-style` | pointer transparency on focusable or interactive, non-`aria-hidden` markup (`source/pointer-transparent-interactive`) |
|
|
273
277
|
| `normalize: { cursor, touchAction, userSelect }`, `snap` | root, part, `normalize.when`; scrolling arrangement | see [interaction properties](#interaction-properties) | a value outside its set (`spec/value-invalid`); snap without scrolling (`snap-without-scroll`) |
|
|
274
|
-
| `wrap: "anywhere" \| "never" \| "truncate" \| "balance" \| "pretty"` (`true` = anywhere), `textAlign`, `reserveLines: 1–3` | text part | `overflow-wrap`, `white-space`, one-line ellipsis truncation, `text-wrap: balance \| pretty` (without support: normal wrapping); `text-align`; `min-block-size: Nlh` | reserved lines without a text profile (`reserve-without-text`) |
|
|
278
|
+
| `wrap: "anywhere" \| "never" \| "truncate" \| "balance" \| "pretty" \| "preserve"` (`true` = anywhere), `textAlign`, `reserveLines: 1–3` | text part | `overflow-wrap`, `white-space`, one-line ellipsis truncation, `text-wrap: balance \| pretty` (without support: normal wrapping); `"preserve"`: `white-space: pre-wrap` with `overflow-wrap: anywhere`, so code keeps its spaces and line breaks and a long line continues on the next visual line (all of it visible at the column's width; `overflow: "scroll-inline"` on its block keeps lines whole instead); `text-align`; `min-block-size: Nlh` | reserved lines without a text profile (`reserve-without-text`) |
|
|
275
279
|
| `wrap: "truncate", lines: 2 \| 3` | text part | a clamp: at most N lines, the last ending in "…" (`line-clamp` beside `display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp`, `overflow: hidden`) | `lines: 1` or another value (one line is plain `truncate`); `reserveLines` above `lines` (`spec/value-invalid` at `reserveLines`, naming both); `lines` with another `wrap`; on a declared `element`; an arrangement's display (`extent-conflict`); on, or inside, a control or form label (`source/clamp-on-control`) |
|
|
276
280
|
| control label `wrap`: absent, `true`/`"anywhere"`, `"never"` | control text part | breaks between words when one word alone would overflow (`overflow-wrap: break-word`, the default), anywhere, or never: one line, and the control does not shrink below the label's width | `"truncate"` or another value |
|
|
277
281
|
| control label `textAlign: "start" \| "center" \| "end"` | control text part | `text-align` on the label: how its lines sit once it wraps or the control is wider than it | another value |
|
|
@@ -440,6 +444,23 @@ without a background has no track to prove it on
|
|
|
440
444
|
(`construction/progress-contrast-unresolved`). ADS's browser tests cover
|
|
441
445
|
Chromium only.
|
|
442
446
|
|
|
447
|
+
A range slider (`<input type="range">`) draws its track and thumb the same way:
|
|
448
|
+
|
|
449
|
+
```ts
|
|
450
|
+
range: { selector: ".price-range", required: true,
|
|
451
|
+
pseudo: { sliderTrack: { surface: "slider-track", frame: "slider-track-frame" }, sliderThumb: { surface: "slider-thumb", frame: "slider-thumb-frame" } } },
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
Each takes a surface (`background`, `borderColor`) and a frame profile
|
|
455
|
+
(`inlineSize`, `blockSize`, `radius`, `borderWidth`), with `when` surfaces for
|
|
456
|
+
states. ADS turns off the engine's drawing and writes each once per engine
|
|
457
|
+
(`::-webkit-slider-runnable-track`, `::-moz-range-track`,
|
|
458
|
+
`::-webkit-slider-thumb`, `::-moz-range-thumb`), and centres the WebKit thumb on
|
|
459
|
+
the track by half their difference in height. Tick labels under the slider are a
|
|
460
|
+
row with `justify: "space-between"`, one label per step. The thumb's
|
|
461
|
+
background needs 3:1 against the track's in every theme, brand and state, as a
|
|
462
|
+
progress fill against its track (`construction/progress-contrast-insufficient`).
|
|
463
|
+
|
|
443
464
|
**Contrast**, in every theme, brand and token condition:
|
|
444
465
|
|
|
445
466
|
- The placeholder colour needs 4.5:1 against the part's own background colour,
|
|
@@ -496,6 +517,7 @@ const pile = recipe({
|
|
|
496
517
|
| Field | On | Lowers to | Rejects |
|
|
497
518
|
| --- | --- | --- | --- |
|
|
498
519
|
| `when: { state: { frame: { profile } } }` | a region root with a `frame`, a part with `frame: { profile }` | the state's frame profile lowered whole, as the element's own is; one rule under the state with only what differs | an element without a frame profile of its own, which includes a text-entry control part, whose control frame is calculated and not selected (`frame-missing`); a state frame that does not state a field the base frame writes (`field-dropped`); a control or a top-layer root (`spec/field-unsupported`) |
|
|
520
|
+
| `gap` and `rowGap` (spacing slot fields) on a wrapping `inline` row | root, part recipe | `column-gap` between its items and `row-gap` between its lines (a name line whose meta wraps closer than its items sit apart); `rowGap` alone is the gap, as on a stack | n/a |
|
|
499
521
|
| `when: { state: { spacing: "<spacing profile>" } }` | a root or a part with an arrangement | the arrangement's `gap` and `overlap` read from that profile under the state, by the same fields as at rest | n/a |
|
|
500
522
|
| `overlap: { slot: "spacing", field: "overlap" }` | an `inline` or `stack` root or part recipe | every neighbour after the first starts inside the one before it by the spacing profile's `overlap` (an `overlap` token): real layout, so the arrangement is as large as what it shows and what follows it moves with it; later neighbours paint over earlier ones; no gap is written | beside `gap`, `rowGap` or `wrap`; on another layout |
|
|
501
523
|
| `collapsed: true \| false`, on the part and in its `when` entries | a part of a `stack` or `inline` parent | collapsed: no size on the parent's main axis whatever it holds, transparent, and out of the accessibility tree and of focus (`visibility: hidden`); open: its content's size. In an overlapping arrangement a collapsed part takes none of the overlap either | a part with a frame, an arrangement, an overflow or a filling extent of its own (`collapsed-box`): put its box on what it holds; a parent that is not a stack or a row (`collapsed-parent`) |
|
|
@@ -678,13 +700,24 @@ recipe({
|
|
|
678
700
|
- **Modal sheet** (`element: "dialog"`; `edge: "start" | "end"`): a `<dialog>`
|
|
679
701
|
the owner opens with `showModal()`. Containment, page inertness, Escape and
|
|
680
702
|
focus return are native. It covers the full block extent from its logical
|
|
681
|
-
`edge` (mirrored in RTL). The backdrop surface paints `::backdrop
|
|
682
|
-
|
|
703
|
+
`edge` (mirrored in RTL). The backdrop surface paints `::backdrop`: its
|
|
704
|
+
`background`, and its `backdropBlur`, which blurs the page behind
|
|
705
|
+
(`construction/backdrop-surface-unsupported` for anything else). With `dismiss: "press"`
|
|
683
706
|
(not `"none"`) the owner closes on a press outside the sheet's box, so the
|
|
684
707
|
root carries no padding (`construction/layer-root-padding`); padding belongs
|
|
685
708
|
to an owned child with its own frame. Every modal sheet also emits the
|
|
686
709
|
document scroll lock `html:has(:modal) { overflow: hidden }` once in its
|
|
687
|
-
owner's sheet.
|
|
710
|
+
owner's sheet. It keeps no room for the hidden scrollbar: a sheet at the
|
|
711
|
+
inline end would stop short of the viewport's edge.
|
|
712
|
+
- **Modal card** (`element: "dialog"`; `edge: "center" | "block-start"`): the
|
|
713
|
+
same `<dialog>`, a card centred in the viewport, or centred inline at the
|
|
714
|
+
layer profile's `viewport-margin` below the top. It keeps that margin from
|
|
715
|
+
every viewport edge (`max-inline-size`, `max-block-size: calc(100dvh - 2 ×
|
|
716
|
+
margin)`) with its frame's size within it, and `motion: "fade"` fades it and
|
|
717
|
+
its backdrop in. A close control in its corner is a layer of a layered part.
|
|
718
|
+
A zoom view that grows an image from its place sets a measured `translate`
|
|
719
|
+
and a measured `scale` (`{ type: "scale", property: "scale" }`, unitless
|
|
720
|
+
factors per axis) on the image and animates them with their `motion`.
|
|
688
721
|
- **Anchored popover** (`element: "popover"`; `popover: "auto" | "manual"`): a
|
|
689
722
|
non-modal panel pinned to a viewport `corner` by logical insets, with light
|
|
690
723
|
dismiss and Escape from `popover="auto"`. A `layer` profile (`edge-gap`,
|
|
@@ -1019,6 +1052,21 @@ number per column; every column weighs 1 without `weights`. A cell still
|
|
|
1019
1052
|
stacks at a narrow tier by spanning both columns (`span: "full"` with
|
|
1020
1053
|
`at: { md: { span: 1 } }`).
|
|
1021
1054
|
|
|
1055
|
+
Columns as wide as their content: `columns: 6, contentFrom: "lg"` on a fluid
|
|
1056
|
+
grid sizes its columns by what they hold from the `lg` tier up, with the free
|
|
1057
|
+
space between them (a footer's link columns). The outer columns meet the
|
|
1058
|
+
region's edges, and the cells of one column line up on every row. Below `lg` the
|
|
1059
|
+
columns share the width as usual: name a tier from which the columns fit side by
|
|
1060
|
+
side, and place the cells for the tiers below it (`span: 3` at `sm`, for
|
|
1061
|
+
instance). ADS emits `repeat(6, minmax(min-content, auto))` with
|
|
1062
|
+
`justify-content: space-between`. A column is never narrower than what it holds,
|
|
1063
|
+
so a cell's frame fits its column by construction and the frame-fit check does
|
|
1064
|
+
not measure it. The keyline and end-alignment checks still apply, because the
|
|
1065
|
+
outer edges are the region's. `contentFrom` names a tier above the lowest, needs
|
|
1066
|
+
a fluid grid and does not combine with `weights`. Whether the content of a given
|
|
1067
|
+
screen fits from that tier is the render audit's: it measures overflow at every
|
|
1068
|
+
audited width.
|
|
1069
|
+
|
|
1022
1070
|
[Spatial profiles](PROFILE-KINDS.md#spatial) own units, scales, ratios, max
|
|
1023
1071
|
width, track counts, breakpoints, gutter pairs, fixed sides and named
|
|
1024
1072
|
conditions. Owner `at` selects those names. A relative condition such as `below: "--form-wrap-width"` keeps
|
|
@@ -1090,7 +1138,9 @@ The region's frame declares the shape (`frame: { ratio: "16 / 9" }`, a ratio
|
|
|
1090
1138
|
the spatial profile permits, or a frame profile's `blockSize`) and its
|
|
1091
1139
|
top-level visual part fills it (`object-fit: cover`). Without that box it is
|
|
1092
1140
|
`construction/cover-box-missing`. Nothing overflows, and the render audit's
|
|
1093
|
-
image-shape check accepts the crop.
|
|
1141
|
+
image-shape check accepts the crop. Application media is an `<img>` or a
|
|
1142
|
+
`<video>` without an artwork binding: a video's poster and frames fill (or fit)
|
|
1143
|
+
the box as an image does.
|
|
1094
1144
|
|
|
1095
1145
|
The focal point belongs to the image, in an asset's optical-centre
|
|
1096
1146
|
coordinates, never to the profile or the recipe:
|
|
@@ -1325,3 +1375,65 @@ strings through ordinary lookups or conditionals. Recipe composition, conflict
|
|
|
1325
1375
|
resolution and static class combinations belong to compilation; there is no
|
|
1326
1376
|
runtime class-merging helper. Draft and preview data never enter production
|
|
1327
1377
|
output. See [the guide](GUIDE.md#emitting-the-design-system).
|
|
1378
|
+
|
|
1379
|
+
## The document pattern
|
|
1380
|
+
|
|
1381
|
+
A pattern may render the page's document: `recipe({ element: "document" })` on
|
|
1382
|
+
its root, which renders `<html>` with `<body>` inside. Metadata is not design:
|
|
1383
|
+
the pattern never owns `<head>` content. Its `head` and `end` slots take what the
|
|
1384
|
+
framework needs, and `<title>`, `<meta>`, non-stylesheet `<link>` and `<script>`
|
|
1385
|
+
are allowed in application code anywhere.
|
|
1386
|
+
|
|
1387
|
+
```tsx
|
|
1388
|
+
const document = recipe({ element: "document" }).root;
|
|
1389
|
+
export function Document({ language, head, end, children }: DocumentProps) {
|
|
1390
|
+
return <html lang={language} className={document}>
|
|
1391
|
+
{head !== undefined && <head>{head}</head>}
|
|
1392
|
+
<body>{children}{end}</body>
|
|
1393
|
+
</html>;
|
|
1394
|
+
}
|
|
1395
|
+
```
|
|
1396
|
+
|
|
1397
|
+
| Framework | Root |
|
|
1398
|
+
| --- | --- |
|
|
1399
|
+
| Next.js App Router | `app/layout.tsx` returns `<Document language="en">{children}</Document>`; Next fills the head from `metadata` |
|
|
1400
|
+
| React Router (framework mode), Remix | `root.tsx` returns `<Document language="en" head={<><Meta /><Links /></>} end={<><ScrollRestoration /><Scripts /></>}><Outlet /></Document>` |
|
|
1401
|
+
| Vite single-page app | none: the document is a static `index.html` |
|
|
1402
|
+
|
|
1403
|
+
Checks: `<html>` has `lang` (`source/document-lang-missing`, WCAG 3.1.1), its
|
|
1404
|
+
`<body>` is inside it (`source/part-element-mismatch`), and a design system has
|
|
1405
|
+
one document pattern (`source/document-duplicate`). The foundation's document
|
|
1406
|
+
profile still styles the document (`foundation.css`); the recipe adds to it. A
|
|
1407
|
+
preview draws the pattern's `<html>`, `<head>` and `<body>` as boxes inside its
|
|
1408
|
+
own page (the recipe's classes unchanged); the emitted output keeps the real
|
|
1409
|
+
elements.
|
|
1410
|
+
|
|
1411
|
+
## External components
|
|
1412
|
+
|
|
1413
|
+
A component another library supplies (a framework's link) is declared in the design system's own language, in
|
|
1414
|
+
`externals/*.ads.ts`, and an owner uses it as one of its elements:
|
|
1415
|
+
|
|
1416
|
+
```ts
|
|
1417
|
+
// design-system/externals/link.ads.ts
|
|
1418
|
+
import { external } from "@reqvire-org/ads/external" with { type: "macro" };
|
|
1419
|
+
export const Link = external<{ href: string; prefetch?: boolean }>({ from: "next/link", renders: "a" });
|
|
1420
|
+
```
|
|
1421
|
+
|
|
1422
|
+
```tsx
|
|
1423
|
+
import { Link } from "../../externals/link.ads";
|
|
1424
|
+
export function NavigationItem({ href, label }: { href: string; label: string }) {
|
|
1425
|
+
return <Link href={href} prefetch className={item}>{label}</Link>;
|
|
1426
|
+
}
|
|
1427
|
+
```
|
|
1428
|
+
|
|
1429
|
+
| Where | What `Link` is |
|
|
1430
|
+
| --- | --- |
|
|
1431
|
+
| `ads check` | the `<a>` it renders, for every rule; owners are type-checked against the declared props |
|
|
1432
|
+
| The emitted design system | the library's own component: the declaration is emitted as `export { default as Link } from "next/link"`, and `next` is a requirement in `ads-dependencies.json` |
|
|
1433
|
+
| Previews, the render audit | a stand-in `<a>` with the owner's class, children and text-valued props: the library never runs inside ADS |
|
|
1434
|
+
| `ads-guard`, in the application | the real component, rendered once with the application's React: it must render one `<a>` with the given class and no `style` of its own |
|
|
1435
|
+
|
|
1436
|
+
`name: "Html"` takes a named export (`next/document`'s `Html`); `client: true` says the library component needs the
|
|
1437
|
+
client, so every owner that renders it is emitted with `"use client"`. A component that brings its own design (an
|
|
1438
|
+
image component that styles and rewrites its element) fails the guard: use its data function with an `<img>` owner.
|
|
1439
|
+
|
package/docs/PROFILE-KINDS.md
CHANGED
|
@@ -148,6 +148,43 @@ profile({ name: "banner-warning", kind: "surface", fields: { background: "--warn
|
|
|
148
148
|
- A surface that provides a token its own fields read would repaint itself:
|
|
149
149
|
`foundation/provided-role-self`.
|
|
150
150
|
|
|
151
|
+
### Forced colours: `forcedColors`
|
|
152
|
+
|
|
153
|
+
Windows contrast themes put the browser in forced colours
|
|
154
|
+
(`@media (forced-colors: active)`): text, backgrounds and borders take the
|
|
155
|
+
user's system colours, backgrounds become `Canvas`, shadows and background
|
|
156
|
+
images are removed, borders stay. A surface whose meaning would disappear
|
|
157
|
+
declares the system colours that keep it:
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
profile({ name: "row-selected", kind: "surface", fields: { background: "--selected-fill", color: "--on-selected" }, forcedColors: { background: "Highlight", color: "HighlightText" } });
|
|
161
|
+
profile({ name: "control-disabled", kind: "surface", fields: { color: "--text-disabled" }, forcedColors: { color: "GrayText", border: "GrayText" } });
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
- Fields: `background`, `color`, `border`. Values: `Canvas`, `CanvasText`,
|
|
165
|
+
`Highlight`, `HighlightText`, `ButtonFace`, `ButtonText`, `LinkText`,
|
|
166
|
+
`GrayText`, `AccentColor`, `AccentColorText` (`foundation/forced-color-invalid`
|
|
167
|
+
otherwise).
|
|
168
|
+
- Lowering writes them under the media query wherever the surface applies, its
|
|
169
|
+
states included, with `forced-color-adjust: none` on that rule only. A surface
|
|
170
|
+
that declares nothing keeps the browser's own mapping.
|
|
171
|
+
- A frame profile's `borderStyle: "forced-only"` draws its border transparent in
|
|
172
|
+
normal mode; forced colours recolour it, so a control whose shape is a fill
|
|
173
|
+
keeps an edge there.
|
|
174
|
+
- `a11y-forced-colors`: a control (a control construction, a `frame: "control"`
|
|
175
|
+
part) whose frame draws no border in some context fails
|
|
176
|
+
(`construction/forced-boundary-missing`). `a11y-forced-colors-review`: a
|
|
177
|
+
selected, pressed, checked or current state whose surface differs from the
|
|
178
|
+
base only by fill, without `forcedColors`, is listed
|
|
179
|
+
(`review/forced-state-fill-only`).
|
|
180
|
+
- A high-contrast theme is a design context of its own; it is not forced
|
|
181
|
+
colours, and neither covers the other.
|
|
182
|
+
- The render audit renders each scenario in forced colours as well (and with a
|
|
183
|
+
coarse pointer): a meant state that looks like its sibling without it fails
|
|
184
|
+
there (`a11y-forced-colors-render`). A browser cannot switch into forced
|
|
185
|
+
colours from a page, so the showcase has no live toggle; use the audit, or
|
|
186
|
+
DevTools' rendering emulation.
|
|
187
|
+
|
|
151
188
|
Pick the pattern by where the difference comes from: a whole theme or brand
|
|
152
189
|
for a section of the page (`data-theme`/`data-brand` sections), a look the
|
|
153
190
|
caller chooses (a `tone` prop), a colour that follows the container
|
|
@@ -312,8 +349,13 @@ measurements ADS imposes.
|
|
|
312
349
|
## Visual
|
|
313
350
|
|
|
314
351
|
Fields: `size` (`visual-size`), `strokeWidth` (`border-width`, the stroke of
|
|
315
|
-
owned vector parts) and the policies `fit`, `preserveRatio
|
|
316
|
-
(`"contain"`, `true`, `"optical"`).
|
|
352
|
+
owned vector parts) and the policies `fit`, `preserveRatio`, `anchor` and
|
|
353
|
+
`sizeAxis` (`"contain"`, `true`, `"optical"`, `"block"` or `"inline"`).
|
|
354
|
+
|
|
355
|
+
`sizeAxis` applies to application images (an `<img>` visual part): `size` caps
|
|
356
|
+
the image's height by default, and its width with `sizeAxis: "inline"`
|
|
357
|
+
(`inline-size: min(100%, size)`), so a strip of logos shares one width whatever
|
|
358
|
+
each file's ratio. The other axis follows the image.
|
|
317
359
|
|
|
318
360
|
The profile sizes a glyph, avatar, logo, image or pictogram. The
|
|
319
361
|
[asset contract](ASSETS.md) owns the drawing, its paint policy, its variants and
|
|
@@ -470,7 +512,7 @@ Owns the shared structural grid definition, declared beside the other profiles.
|
|
|
470
512
|
| `overlayLayer` | `layer` |
|
|
471
513
|
| `ratios` | Policy: the permitted ratios |
|
|
472
514
|
| `breakpoints.<name>`: `from`, `fixedStart`, `fixedEnd`; `columns`; `margin` | `layout-size`; `track-count`; `spacing` |
|
|
473
|
-
| `gutters.<name>`: `start`, `end` | `spacing` or `grid-gutter` |
|
|
515
|
+
| `gutters.<name>`: `start`, `end` (an edge gutter), or `gap` (a gap gutter) | `spacing` or `grid-gutter`; `gap` also `content-gap` |
|
|
474
516
|
| `conditions.<name>`: `below` | `layout-size` |
|
|
475
517
|
|
|
476
518
|
Clause names are local to the profile. Breakpoints and condition bounds are
|
|
@@ -478,7 +520,11 @@ authored in `rem` ([Units](TOKEN-ROLES.md#units)).
|
|
|
478
520
|
|
|
479
521
|
- The example design system's `page-grid` (`profiles/Layout/grid.ads.ts`) has an 8px mini
|
|
480
522
|
unit, a 2px fine unit, 4/8/16 track tiers and wide, narrow and condensed
|
|
481
|
-
gutters. The special `none` gutter is structural zero.
|
|
523
|
+
gutters. The special `none` gutter is structural zero. A gap gutter
|
|
524
|
+
(`cards: { gap: "--card-gap" }`) separates the tracks by `column-gap` instead
|
|
525
|
+
of insetting each cell: the outer cells are flush with the region's edges and
|
|
526
|
+
the tracks divide the width left after the gaps (card grids with 16 px gaps).
|
|
527
|
+
A grid on inherited tracks keeps its parent's gap.
|
|
482
528
|
- `profiles/Layout/regions.ads.ts` adds fixed-side and tile dimensions,
|
|
483
529
|
tier-specific fixed-side refinements and a named condition with a relative
|
|
484
530
|
`below` threshold. Grid lowering reads them from the selected profile
|
package/docs/RULES.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- Generated by scripts/sync-rule-reference.mjs from src/ads-errors.mts and src/finding-rules.mts. Do not edit: run `bun run sync:rule-reference`. -->
|
|
4
4
|
|
|
5
|
-
Every rule ADS reports, under its rule group:
|
|
5
|
+
Every rule ADS reports, under its rule group: 447 rules in 18 groups. A finding names its rule as a code,
|
|
6
6
|
`<domain>/<kind>`; the `check/<rule>` codes are the rules `ads check`, `ads validate`, the render audit and acceptance
|
|
7
7
|
report by their plain name (`check/a11y-reflow` is the finding `a11y-reflow`).
|
|
8
8
|
|
|
@@ -20,10 +20,10 @@ Fix findings in group order: earlier groups are often the cause of later ones. T
|
|
|
20
20
|
| 3 | [boundary](#boundary) | 30 | violated | Code reaches across an ownership or production/development boundary. | Move the code to its owner or pass the value through public props. Do not add an exception or widen the boundary. |
|
|
21
21
|
| 4 | [design-bypass](#design-bypass) | 20 | violated | Styling or design values are supplied outside the design language. | Take the value from a profile, token or recipe instead of writing it in place. |
|
|
22
22
|
| 5 | [structure-mismatch](#structure-mismatch) | 47 | violated | Rendered markup does not match what its declaration promises. | Make the markup match the declaration: each declared part, cell and binding exactly once, in the declared order. Change the declaration only if it is wrong. |
|
|
23
|
-
| 6 | [accessibility-semantics](#accessibility-semantics) |
|
|
23
|
+
| 6 | [accessibility-semantics](#accessibility-semantics) | 43 | violated | Owned markup or motion lacks required accessible semantics: a text alternative, an accessible name, keyboard access or reduced motion. | Add the missing semantics in the owning component (alt, aria-label, a native control, a reduced-motion value); do not suppress the check. |
|
|
24
24
|
| 7 | [project-files](#project-files) | 6 | violated | A required project file or declaration is missing, empty, undocumented or unused. | Add or complete the file the rule names (README, license, theme or brand values), or remove what nothing uses. |
|
|
25
|
-
| 8 | [wrong-value](#wrong-value) |
|
|
26
|
-
| 9 | [conflict](#conflict) |
|
|
25
|
+
| 8 | [wrong-value](#wrong-value) | 74 | violated | A value has the wrong kind, role or range for where it is used. | Choose one of the allowed values the error lists. |
|
|
26
|
+
| 9 | [conflict](#conflict) | 45 | violated | Two definitions claim the same thing, or a definition depends on itself. | Keep exactly one source of truth and remove or derive the other. |
|
|
27
27
|
| 10 | [unanalyzable](#unanalyzable) | 45 | unprovable | ADS cannot prove the rule holds; the design itself may be fine. | Rewrite into a form ADS can follow (literal unions, const records, typed props, JSX) without changing rendered behavior. |
|
|
28
28
|
| 11 | [unsupported](#unsupported) | 17 | unprovable | The construct is valid design that ADS does not support yet. | Use a supported alternative. If none fits, report the gap rather than working around the checks. |
|
|
29
29
|
| 12 | [rendered-check](#rendered-check) | 13 | violated | The rendered result breaks an accessibility, layout, contrast or performance requirement. | Inspect the failing scenario in its audit result or capture, then fix the owning style or markup; do not change the scenario to hide it. |
|
|
@@ -214,7 +214,7 @@ Rendered markup does not match what its declaration promises. Make the markup ma
|
|
|
214
214
|
| `source/placement-without-root` | error | A placement positions a styled root; an element with a placement also carries its own recipe styling. | Add the element's recipe output beside its placement, or move the placement to the styled root. | `ads://guides/layout` |
|
|
215
215
|
| `source/pseudo-host-unsupported` | error | A part treats only pseudo-elements its element has: `::placeholder` belongs to `<input>` and `<textarea>`. | Move the pseudo treatment to the part that renders the input or textarea, or render that element for this part. | `ads://guides/recipes` |
|
|
216
216
|
| `source/resize-not-textarea` | error | `normalize.resize` states how the user may resize a multi-line text field: it belongs on a part rendered as `<textarea>`. No other element has a resize handle in this language; a region's size comes from its recipe. | Declare `resize` on the part rendered as `<textarea>`, or remove it. | `ads://guides/recipes` |
|
|
217
|
-
| `source/scheme-image-element` | error | A part that declares `scheme` is one
|
|
217
|
+
| `source/scheme-image-element` | error | A part that declares `scheme` is one drawing of a light and dark pair: a content `<img>` without an artwork binding, or declared artwork bound for a theme of that scheme (a logo black on light, white on dark). | Render a content pair as plain `<img>` elements whose `src` the application supplies; bind declared artwork for a theme of the part's scheme (`recipe({ theme: "dark", … })` on the dark part); or remove `scheme`. | `ads://guides/recipes`, `ads://guides/branding` |
|
|
218
218
|
| `source/scheme-image-not-lazy` | error | In a light and dark image pair, the image of the scheme the default theme (the first declared) does not have is `loading="lazy"` in every choice: a hidden lazy image is not downloaded, an eager one is. Only the default scheme's image may load eagerly. | Write `loading="lazy"` on that image as a literal and apply any priority (eager loading, `fetchPriority`) to the default scheme's image only. | `ads://guides/recipes` |
|
|
219
219
|
| `source/scheme-image-size-missing` | error | Both images of a light and dark pair state `width` and `height`: each file's own pixel size, so the box is reserved before either loads and the page does not move when the theme changes. | Set `width` and `height` on both images from each file's own pixel size. | `ads://guides/recipes` |
|
|
220
220
|
| `source/summary-outside-details` | error | A declared summary is the first child of a `<details>` element: elsewhere it has no disclosure semantics. | Render the summary inside the owner's `<details>`, or declare another element. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
@@ -226,6 +226,9 @@ Owned markup or motion lacks required accessible semantics: a text alternative,
|
|
|
226
226
|
|
|
227
227
|
| Rule | Severity | What it requires | Repair | Guides |
|
|
228
228
|
| --- | --- | --- | --- | --- |
|
|
229
|
+
| `check/a11y-forced-colors` | error | A control keeps a visible edge in forced colours (Windows contrast themes), where backgrounds become Canvas and shadows are removed but borders stay: every control construction and frame: "control" part draws a border in every context, or a frame border drawn only there (`borderStyle: "forced-only"`, transparent otherwise). A surface's `forcedColors` names CSS system colours. | Give the control's frame profile a borderWidth (transparent in normal mode with `borderStyle: "forced-only"`), and use a system colour in `forcedColors`. | `ads://guides/accessibility` |
|
|
230
|
+
| `check/a11y-forced-colors-render` | error | Each scenario is also rendered in forced colours (Chromium's emulation of Windows contrast themes) and with a coarse pointer (a touch context, whose `pointer: coarse` selects touch-density tokens); axe runs in both, and its findings name the environment. In forced colours an element in a meant state (aria-selected, aria-pressed, aria-checked, aria-current) must not render exactly like a sibling without it: text, background, border, outline and what it draws inside are compared. | Declare `forcedColors` on the state's surface (a selection: `{ background: "Highlight", color: "HighlightText" }`), or show the state by a border, a mark or text as well. | `ads://guides/accessibility` |
|
|
231
|
+
| `check/a11y-forced-colors-review` | review | A selected, pressed, checked or current state stays visible in forced colours: a state surface that differs from the base only by fill (background, background image, shadow) shows nothing there unless it declares `forcedColors`. Pointer and focus feedback, open disclosures and autofill are not listed. | Declare `forcedColors` on the state's surface (a selection: `{ background: "Highlight", color: "HighlightText" }`), or show the state by more than fill (a border, a mark, text). | `ads://guides/accessibility` |
|
|
229
232
|
| `check/a11y-icon-label` | error | A control whose only content is artwork has an accessible name through aria-label, aria-labelledby or title (WCAG 2.2 4.1.2), exact over the owner's reachable choices: in every choice where a control construction renders no text part, its root has a non-empty one of them. | Add aria-label naming the action to the control's root in the choices that render only artwork. | `ads://guides/accessibility` |
|
|
230
233
|
| `check/a11y-image-alt` | error | Every <img> an owner renders has an alt attribute: meaningful text, or alt="" when decorative (WCAG 2.2 1.1.1). | Add alt text to the <img>, or alt="" if it is purely decorative. | `ads://guides/accessibility` |
|
|
231
234
|
| `check/a11y-keyboard` | review | An onClick on a non-interactive element (div, span, li, img and similar) without role and tabIndex cannot be reached or used from the keyboard (WCAG 2.2 2.1.1), unless a delegated or wrapping control handles it. Composite-widget items and backdrops whose handler reads currentTarget are exempt. | Use a <button> for the action, or add role, tabIndex and a key handler to the element. | `ads://guides/accessibility` |
|
|
@@ -234,11 +237,12 @@ Owned markup or motion lacks required accessible semantics: a text alternative,
|
|
|
234
237
|
| `check/surface-contrast` | error | A surface profile that sets both color and background meets WCAG 2.2 AA for text, 4.5:1, in every context (theme, brand, brand under theme and condition); its background-image gradient stops count as backgrounds. The minimum follows what the colour paints where the profile is used: a pair below 4.5:1 is accepted when every use of the profile in the design system is artwork (a visual part, or a control that renders no text: 3:1, WCAG 1.4.11), large text (at least 24px, or 18.66px at weight 700: 3:1) or artwork hidden from assistive technology (decoration: no minimum). A fully transparent colour draws nothing and has no minimum in the contexts where it is transparent (a glyph a control shows only on hover); the states that show it keep theirs. A profile nothing uses, one a slot supplies, the document surface, and one the recipe also names for a pseudo-element, a backdrop or an entrance keep 4.5:1. | Adjust the colour or background token's value in the named context (or point the profile at a pair that contrasts), keeping the pair at 4.5:1 or more; a colour meant for artwork at 3:1 belongs to a surface profile that only visual parts or text-less controls select. A surface that paints a disabled element declares `state: "inactive"` among its fields: it has no minimum (WCAG 1.4.3 exempts inactive components) and may then be selected only under `:disabled` or `[aria-disabled="true"]`. | `ads://guides/accessibility`, `ads://guides/tokens` |
|
|
235
238
|
| `construction/accessibility-declaration-unmet` | error | An `accessibility` declaration is verified where ADS can: `"boundary-on-interaction"` needs a hover treatment of the control part whose border, drawn at the frame's width, reaches 3:1 against the surroundings in every context (the focus outline is held to 3:1 as always); `"visible-label"` needs a programmatically associated, rendered label (checked by the render audit). | Make the declared identification real (a hover border at 3:1, a visible associated label), or remove the declaration and give the control a 3:1 boundary or fill. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
236
239
|
| `construction/artwork-paint-contrast-insufficient` | error | A control's artwork with paint slots stays recognizable on the control: in every theme, brand and state, at least one of its paints reaches 3:1 against the control's own background (WCAG 1.4.11). A drawing with its own colours (`paint: "intrinsic"`, a product's logo) is not checked. | Give the drawing one paint that reaches 3:1 on that background in that context (an outline or a darker fill), or adjust the token's value there. | `ads://guides/pictograms`, `ads://guides/accessibility`, `ads://guides/tokens` |
|
|
240
|
+
| `construction/forced-boundary-missing` | error | A control keeps a visible edge in forced colours, where backgrounds become Canvas and shadows are removed but borders stay: its frame draws a border in every context. | Give the frame profile a borderWidth; `borderStyle: "forced-only"` keeps it transparent in normal mode and draws it in forced colours. | `ads://guides/accessibility` |
|
|
237
241
|
| `construction/inactive-surface-active` | error | A surface profile declaring `state: "inactive"` paints a disabled control: it has no contrast minimum (WCAG 2.2 1.4.3 exempts inactive components), so a construction selects it only under an inactive owner state (`:disabled`, `[aria-disabled="true"]`), never at rest or under another state. | Select it under `&:disabled` or `&[aria-disabled="true"]`, or use a surface without `state: "inactive"` (which is held to the contrast minimum). | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
238
242
|
| `construction/non-text-contrast-insufficient` | error | A control part inside a known surface keeps its boundary and focus visible (WCAG 2.2 1.4.11): where its own background does not reach 3:1 against the enclosing background, its border colour (base and each owner state) does; its focus outline colour reaches 3:1 against what it sits on (the enclosing background outside the box, its own inside), in every theme, brand and condition. | Choose a border or focus colour token that reaches 3:1 against the surrounding background in that context, or give the control a background that does. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
|
|
239
243
|
| `construction/paint-contrast-insufficient` | error | Every declared value of a runtime paint keeps its contrast against the background the construction knows, in every theme, brand and owner state: a `color` paint 4.5:1 (3:1 for provably large text, WCAG 2.2 1.4.3); a `fill`, `stroke` or `border-color` paint, and a `background-color` paint against its enclosing background, 3:1 (1.4.11); text on a painted background its text minimum. The set is finite, so one failing value fails whichever value data selects. | Adjust that token's value in the failing context, remove it from the paint's values, or place the element on a background it contrasts with. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
|
|
240
244
|
| `construction/placeholder-contrast-insufficient` | error | Placeholder text has at least 4.5:1 contrast against its part's background in every theme, brand and state (WCAG 1.4.3). | Choose a placeholder surface whose colour token contrasts enough with the part's background in that context, or adjust the token's value there. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
|
|
241
|
-
| `construction/progress-contrast-insufficient` | error | A progress bar's fill has at least 3:1 contrast against its track
|
|
245
|
+
| `construction/progress-contrast-insufficient` | error | A progress bar's fill, and a range slider's thumb, has at least 3:1 contrast against its track in every theme, brand and state (WCAG 1.4.11): the progress part's own background, the slider track's surface. | Choose a fill surface whose background token contrasts enough with the part's own background in that context, or adjust the token's value there. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
|
|
242
246
|
| `construction/state-contrast-insufficient` | error | An element's owner states keep it readable (text 4.5:1 or 3:1 when large; a visual part's or a text-less control's artwork 3:1; artwork hidden from assistive technology has no minimum, nor has a fully transparent colour, which draws nothing): where a state's colour meets a background from another surface profile (a colour-only state over the base fill, a state fill under the base colour), the pair has at least 4.5:1 contrast in every theme, brand and condition, or 3:1 where the element's text profile makes its text large there (at least 24px, or 18.66px at weight 700); a state that holds only while the element is inactive (:disabled, [aria-disabled="true"]) has no minimum (WCAG 2.2 1.4.3). Two states that cannot hold on one root together (two values of one attribute, a state and its :not(), :disabled and :enabled) are not paired. | Treat the state with a surface that sets both its colour and background, or choose colour and background tokens that contrast in that context. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
|
|
243
247
|
| `construction/target-area-overlap` | error | The enlarged hit areas of neighbouring targets in a stack or inline arrangement do not overlap across their gap in any context: a press there would reach two targets (WCAG 2.2 2.5.8). | Widen the arrangement's gap to at least the hit areas' reach beyond the two boxes, or reduce the min-target sizes. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
244
248
|
| `construction/target-size-below-minimum` | error | Every control construction and `frame: "control"` part is a pointer target of at least 24 × 24 CSS px in every theme, brand and condition (WCAG 2.2 2.5.8), computed from its lowered box: min block = max(min-block-size, content + 2 (inset + border)), inline = 2 (padding-inline + border) + content; an enlarged hit area (min-target-inline-size, min-target-block-size) counts. Relative lengths are evaluated at the 16px reference root. The spacing exception holds for a smaller part of a stack or inline arrangement: a 24px circle centred on it reaches neither a neighbouring target's box nor, for a smaller neighbour, that neighbour's circle, at every gap the arrangement takes; a root or a part with no neighbouring target keeps the minimum. | Raise the frame profile's min-block-size, padding-inline or the visual size in that context, give the frame a min-target-inline-size / min-target-block-size hit area of at least 24px, or (for a part between targets) widen the arrangement's gap until 24px circles centred on the targets keep clear of each other. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
|
|
@@ -246,6 +250,7 @@ Owned markup or motion lacks required accessible semantics: a text alternative,
|
|
|
246
250
|
| `review/autocomplete-missing` | review | A text control whose name, id or type says what it collects states its autofill token (`autoComplete`, WCAG 1.3.5), so autofill and password managers fill it correctly; `autoComplete="off"` states that it must not be filled. ADS suggests the token from the literal attribute values, a heuristic. | Set `autoComplete` to the field's HTML autofill token (the message suggests one), or `"off"` when it must not be filled; on a public component, pass it through its `autoComplete` prop. Ignore this note when the suggestion is wrong. | `ads://guides/forms`, `ads://guides/accessibility` |
|
|
247
251
|
| `review/boundary-identified-otherwise` | review | A text-entry control whose boundary is below 3:1 (WCAG 1.4.11) passes only with a human-approved `accessibility` declaration saying how it is identified otherwise; every such control is listed on every run, never silently. | Keep it only if a person approved it and the design still matches the reason. Otherwise make the control pass (a 3:1 fill, or one 3:1 border side such as a soft field's underline) and remove the declaration. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/forms` |
|
|
248
252
|
| `review/click-without-keyboard` | review | An `onClick` on a non-interactive element (div, span, li, img and similar) without a role and `tabIndex` cannot be reached or used from the keyboard (WCAG 2.2 2.1.1), unless a delegated or wrapping control handles it. Items of composite widgets (option, menuitem, tab, row, gridcell, …) and backdrops whose handler reads `currentTarget` are exempt. | Use a <button> for the action, or give the element a role, tabIndex and a key handler; when a wrapping control already handles it, leave it. | `ads://guides/accessibility` |
|
|
253
|
+
| `review/forced-state-fill-only` | review | A state the page means stays visible in forced colours, where backgrounds become Canvas and shadows are removed: a state surface that differs from the base only by fill declares `forcedColors`. | Declare `forcedColors` on that surface (a selection: `{ background: "Highlight", color: "HighlightText" }`), or show the state by a border, a mark or text as well. | `ads://guides/accessibility` |
|
|
249
254
|
| `review/marker-none-unlabelled` | review | A summary without its disclosure marker shows its open state another way: artwork that changes with the owner's open state. | Render a chevron (a visual part or a public Icon) chosen by the controlled open state, or keep the native marker. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
250
255
|
| `review/motion-endless` | review | Motion that starts by itself, runs longer than five seconds and is shown beside other content can be paused, stopped or hidden by the user (WCAG 2.2 2.2.2). A repeating sequence a part plays whenever it is rendered has no owner state to stop it by; reduced motion stops it only for users who set that preference. A note, not a review: a short indicator shown only while something is working ends with that work. | If it can run for more than five seconds beside other content, play it under an owner state (`when: { '&[data-working="true"]': { play } }`) and give the user a way to stop it; an indicator that is rendered only while work is in progress needs nothing. | `ads://guides/accessibility`, `ads://guides/recipes` |
|
|
251
256
|
| `review/non-text-contrast-unresolved` | review | A control part's border and focus contrast against its surroundings is proven from tokens; a translucent background, an unresolved colour or an offset ADS cannot evaluate is reviewed, never passed. | Check the rendered boundary and focus indicator by hand (ads audit), or use opaque colour tokens for the control and its surroundings. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
@@ -257,6 +262,7 @@ Owned markup or motion lacks required accessible semantics: a text alternative,
|
|
|
257
262
|
| `review/user-select-text` | review | `userSelect: "none"` belongs on handles and grips, which show no text: on an element that shows text (a text part or treatment, or text parts inside it) users cannot select or copy that text. | Move `userSelect: "none"` to the handle or grip part that starts the drag, or remove it; ignore this note when the text is a label of the handle itself. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
258
263
|
| `source/clamp-on-control` | error | A clamp (`lines`) cuts text off for sighted readers: never on a control or a form label (a button, label, legend, summary, select, option or text field) or on text inside one, whose text says what the control does. | Let the control's text wrap (remove `lines` and `wrap: "truncate"`), shorten the text, or clamp a description outside the control. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
259
264
|
| `source/control-name-missing` | error | A control without a text part in some reachable choice is named on its root by a non-empty `aria-label`, `aria-labelledby` or `title` in that choice (WCAG 2.2 4.1.2). Application text counts as a name, as it counts as content in a text part. | Set `aria-label` (or `aria-labelledby`) on the control's root to its name in every choice that renders only artwork, for example from the label prop the visible text would show. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
265
|
+
| `source/document-lang-missing` | error | The document pattern (`element: "document"`) renders `<html>` with its language (`lang`, WCAG 3.1.1), from a required prop. | Give the pattern a required `language` prop and render `<html lang={language}>`. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
260
266
|
| `source/form-state-colour-only` | error | A field's error state (`[data-user-invalid]`, `[data-invalid]`, `[aria-invalid="true"]`) and its autofill state (`[data-autofill]`) are not shown by colour alone (WCAG 1.4.1): some element's treatment under the state adds a cue that is not a hue: an edge or ring (`boxShadow`), a pattern (`backgroundImage`) or a border that appears (`borderStyle: "solid"`). | Give the state's surface a ring or edge (`boxShadow` with an inset ring token, such as `--shadow-invalid`) on the control, or another non-hue cue; colour changes may stay beside it. | `ads://guides/forms`, `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
261
267
|
| `source/image-alt-missing` | error | Every `<img>` an owner renders states its text alternative (WCAG 2.2 1.1.1): content media and any other image, as artwork images do; decorative images state it as empty. | Set `alt` to the text alternative (for content media, a prop the caller fills), or `alt=""` when the image is decorative. | `ads://guides/accessibility` |
|
|
262
268
|
| `source/layer-name-missing` | error | A dialog, and a popover with `role="dialog"`, has an accessible name from `aria-label` or `aria-labelledby`. | Label the layer root with `aria-labelledby` (its visible title's id) or `aria-label`. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
@@ -332,6 +338,8 @@ A value has the wrong kind, role or range for where it is used. Choose one of th
|
|
|
332
338
|
| `contexts/list-invalid` | error | foundation() declares 1–8 themes, each { name, scheme } with a unique lowercase name and scheme "light" or "dark", and optionally up to 8 brands, each { name } with a unique lowercase name; followSystemTheme and sections are `true` or omitted. | Correct the field the message names. Declare themes ({ name, scheme: "light" \| "dark" }) and brands ({ name }) in foundation.ads.ts's foundation({ ... }); the first of each is the default (the :root values). | `ads://guides/tokens`, `ads://guides/branding` |
|
|
333
339
|
| `foundation/declaration-rejected` | error | Foundation declarations stay within the design language; the model's message names the rule. | Correct the declaration as the message describes. | `ads://guides/tokens`, `ads://guides/recipes` |
|
|
334
340
|
| `foundation/document-profile-kind` | error | foundation.ads.ts's text names a text profile, its surface a surface profile and its focus a focus profile: they style the document and its default focus indicator. | Name a profile of the field's kind in foundation({ text, surface, focus }), or declare one with profile({ kind }). | `ads://guides/tokens`, `ads://guides/recipes` |
|
|
341
|
+
| `foundation/document-text-incomplete` | error | The document's text profile (`foundation({ text })`) is the fallback of every text: foundation.css writes it on <body>. It states the font family, size and line height, so no text shows the browser's own default. | Give the document's text profile fontFamily, fontSize and lineHeight from your type tokens. | `ads://guides/tokens`, `ads://guides/recipes` |
|
|
342
|
+
| `foundation/forced-color-invalid` | error | A surface profile's `forcedColors` (background, color, border) names CSS system colours, which the user's contrast theme sets: Canvas, CanvasText, Highlight, HighlightText, ButtonFace, ButtonText, LinkText, GrayText, AccentColor, AccentColorText. | Use a system colour: Highlight and HighlightText for a selection, GrayText for a disabled control, ButtonText for a control's edge, LinkText for a link. | `ads://guides/recipes` |
|
|
335
343
|
| `foundation/profile-rejected` | error | Profiles stay within the design language; the model's message names the rule. | Correct the profile as the message describes. | `ads://guides/recipes` |
|
|
336
344
|
| `foundation/token-role` | error | A profile field references only tokens whose role its kind admits. | Reference a token of an admitted role, or register the token under the right role. | `ads://guides/tokens`, `ads://guides/recipes` |
|
|
337
345
|
| `lowering/motion` | error | Motion is lowered from the motion profile fields the construction binds. | Check the motion profile fields the construction binds; report it if they are valid. | `ads://guides/performance`, `ads://guides/recipes` |
|
|
@@ -374,7 +382,7 @@ Two definitions claim the same thing, or a definition depends on itself. Keep ex
|
|
|
374
382
|
| `check/token-role-duplicate` | error | A token has one role, the file name of its sheet: every declaration of it, its :root default and each theme or brand override, is in that one role sheet. | Move the declaration to the sheet that first declares the token (its role), or rename one of the two tokens if they are different decisions. | `ads://guides/tokens` |
|
|
375
383
|
| `choice/cyclic` | error | A design value is defined from constants, profiles or recipes, never from itself. | Break the cycle: define the value from constants, a profile or a recipe, not from another value that refers back to it. | `ads://guides/recipes` |
|
|
376
384
|
| `construction/condition-hides-required` | error | A required part renders in every choice and every viewport; only an optional part may be hidden under a condition. | Declare the part `required: false`, or keep it visible under the condition. | `ads://guides/recipes` |
|
|
377
|
-
| `construction/corner-overpaint` | error | A rounded frame's corners stay rounded. A region root whose frame profile declares a `radius`, with visible overflow and no inset on a corner's edges, does not clip what it holds: a part that reaches that corner (the first or last part of a stack, a layer of a layered root) and paints a background of its own draws a square corner over the curve. ADS does not clip for the author, because clipping also cuts focus outlines, shadows and menus. | Choose one: clip the root (`overflow: "clip"`), inset it (padding in its frame profile), or round the part (a `frame: { profile }` whose frame profile has the matching radius). Name the rounded corners with `frame: { corners }` when only some are rounded. | `ads://guides/recipes` |
|
|
385
|
+
| `construction/corner-overpaint` | error | A rounded frame's corners stay rounded. A region root whose frame profile declares a `radius`, with visible overflow and no inset on a corner's edges, does not clip what it holds: a part that reaches that corner (the first or last part of a stack, a layer of a layered root) and paints a background of its own, or draws a border of its own, puts a square corner over the curve. ADS does not clip for the author, because clipping also cuts focus outlines, shadows and menus. | Choose one: clip the root (`overflow: "clip"`), inset it (padding in its frame profile), or round the part (a `frame: { profile }` whose frame profile has the matching radius). Name the rounded corners with `frame: { corners }` when only some are rounded. | `ads://guides/recipes` |
|
|
378
386
|
| `construction/element-normalization-conflict` | error | A declared native element's normalization (an iframe's border, a list's markers) is not also set by its frame, surface or text. | Remove that field from the element's frame or surface (an iframe takes no border; frame its wrapper instead). | `ads://guides/recipes` |
|
|
379
387
|
| `construction/enter-property-conflict` | error | A property has one timing on an element. A property an entrance animates (`opacity`, `filter` for a starting blur, or its `translate`, `scale` or `rotate`) is not also transitioned by the element's `paintTransition` channels or its press. | Enter through another property, or put the entrance on a wrapping part and keep the transition on this element. | `ads://guides/recipes` |
|
|
380
388
|
| `construction/extent-conflict` | error | Each property of an element has one provider: fill, scrolling, truncation, reserved lines and a frame never write the same property differently. | Keep one of the two constructs on this element, or move one to a wrapping part (a scrolling container around truncated text, say). | `ads://guides/recipes`, `ads://guides/layout` |
|
|
@@ -395,8 +403,13 @@ Two definitions claim the same thing, or a definition depends on itself. Keep ex
|
|
|
395
403
|
| `registration/duplicate` | error | A token is registered once. | Keep one registration. | `ads://guides/tokens` |
|
|
396
404
|
| `registration/not-beside-token` | error | A token is registered in the file that defines it, so the definition and its registration change together. | Move the registration into the file that defines the token. | `ads://guides/tokens` |
|
|
397
405
|
| `rejection/redundant-design-declaration` | error | A declaration states only what its default or input does not already provide. | Remove the declaration. | `ads://guides/recipes` |
|
|
406
|
+
| `review/border-paint-missing` | review | A frame that draws a border (`borderWidth`) has a paint for it: a surface of the element, at rest or under a state, sets `borderColor` (or a side's colour). Without one CSS paints the border in the text colour, almost always a forgotten paint. Listed for review: the text colour may be meant. | Give the element's surface a borderColor (a rule or edge paint), or remove the frame's borderWidth if no border is meant. | `ads://guides/recipes` |
|
|
407
|
+
| `review/client-directive-unneeded` | review | ADS derives `"use client"` for each emitted owner: it writes it where the owner calls a hook or gives an element an event handler, and leaves it out of a purely presentational owner, which stays usable in a React Server Component. A directive the author wrote where nothing needs the client is listed for review. | Remove the directive: ADS writes it whenever the owner needs the client. | `ads://guides/recipes` |
|
|
408
|
+
| `review/counter-unreset` | review | A CSS counter a construction shows (`content: { counter \| counters }`) or counts (`counter: { increment }`) is reset by some recipe of the design system (`counter: { reset }`), or is the browser's own `list-item`. Without a reset the browser starts an implicit counter at each element that counts, so every item shows 1. Listed for review, since a page may reset it outside the design system. | Reset it on the element that contains the counted ones (`counter: { reset: "<name>" }` on the list or the flow), or count with `list-item`. | `ads://guides/recipes` |
|
|
398
409
|
| `review/hover-geometry-shift` | review | Geometry an element in flow takes under `:hover` (another frame or spacing profile, a part that opens) moves what follows it whenever the pointer passes over it. ADS accepts it as the designer's choice and lists it for review; a layer of a layered parent draws over its neighbours instead and is not listed. | Keep it when the movement is wanted (a pile that spreads and pushes what follows). Otherwise draw the change over its neighbours: a layer of a layered parent, an outset backdrop, or a translate or scale effect, which move nothing else. | `ads://guides/recipes`, `ads://guides/layout` |
|
|
399
410
|
| `review/optional-cell-row` | review | A grid cell that may be absent (`required: false`) and is pinned to a row (`row`) leaves that row empty whenever it is absent: the row's track and the gaps around it stay. ADS accepts it as the designer's choice and lists it for review. | Keep it when the empty row is wanted. Otherwise place the cell in auto rows (omit `row`), so the cells after it move up when it is absent. | `ads://guides/recipes` |
|
|
411
|
+
| `source/document-duplicate` | error | A design system has at most one document pattern (`element: "document"`): it is the page's `<html>`. | Keep one document pattern and give the other owner a root of its own. | `ads://guides/recipes` |
|
|
412
|
+
| `source/end-misaligned` | error | Blocks stacked in one column end their content on one line: a block's content ends where its frame's inline end padding (and, for a grid, its gutter's end inset) puts it, and a block that ends a few pixels to a gutter away from its siblings is not on their grid or gutter (a header whose actions end past the sections below). Text ends ragged and is not compared; a block further than 64px off is taken as deliberately narrower. | Put the block on the same tracks and gutter as its siblings, or give its frame the inline end padding that ends its content on their line. | `ads://guides/recipes`, `ads://guides/layout` |
|
|
400
413
|
| `source/glyph-grid-mixed` | error | Every asset a reference binding can receive shares one grid (viewBox, optical center and minimum drawn height), so one construction draws them all. | Draw the glyphs on one viewBox with one optical center, or accept them through separate props or owners. | `ads://guides/pictograms` |
|
|
401
414
|
| `source/layer-modal-context` | error | A modal sheet's `modalQuery` is a viewport media query, so the owner's layout swaps at viewport tiers too: no grid of the same owner responds to a container. | Use `context: "viewport"` for the owner's grids, or keep the sheet modal at every size (no `modalBelow`). | `ads://guides/recipes`, `ads://guides/layout` |
|
|
402
415
|
| `source/local-name-collision` | error | Names of the form compiledClassN are reserved for ADS's emitted output. | Rename the local identifier. | `ads://guides/recipes` |
|
|
@@ -424,7 +437,7 @@ ADS cannot prove the rule holds; the design itself may be fine. Rewrite into a f
|
|
|
424
437
|
| `choice/binding-written` | error | Values that select design are immutable after declaration, so one declaration describes every use. | Declare it with const and derive new values into new bindings instead of reassigning. | `ads://guides/recipes` |
|
|
425
438
|
| `choice/branch-limit` | error | Choice analysis is bounded; a selection must stay small enough to be checked completely. | Every listed value multiplies the combinations checked. Make fewer of them select styling or markup together: replace conditional chains with one lookup over a const record keyed by the selecting value, merge props that always change together, or move a part with its own props into its own owner. | `ads://guides/recipes` |
|
|
426
439
|
| `choice/construction-limit` | error | An owner lowers a bounded number of distinct constructions. | Collapse equivalent combinations, or move independent variation into separate parts so constructions do not multiply. | `ads://guides/recipes`, `ads://guides/performance` |
|
|
427
|
-
| `choice/domain-not-finite` | error | Design is selected from a finite set of choices ADS can enumerate, so every rendered combination can be checked. | Type the selecting prop or variable as a literal union (or a const record key) so every choice can be enumerated. A decision made from data (a count, an element, a lookup) is named as design state: `const overflow: "fits" \| "overflows" = members.length > 3 ? …`,
|
|
440
|
+
| `choice/domain-not-finite` | error | Design is selected from a finite set of choices ADS can enumerate, so every rendered combination can be checked. | Type the selecting prop or variable as a literal union (or a const record key) so every choice can be enumerated. A decision made from data (a count, an element, a lookup) is named as design state: `const overflow: "fits" \| "overflows" = members.length > 3 ? …`, `const fourth: Member \| undefined = members[3]`, or a look an object's field chooses, `const color: Color = channel.color`. An optional object, callback or node prop selects by whether it is given: test a node (or any type that admits text, a number or a boolean) with `!== undefined`, never by truthiness. | `ads://guides/recipes`, `ads://guides/atomic-styles` |
|
|
428
441
|
| `choice/evidence-not-local` | error | Design evidence comes from the owner's source or the design system's own modules. | Bring the value into the owner's source as a const or prop, or import it from the design system's own modules. | `ads://guides/recipes`, `ads://guides/layers` |
|
|
429
442
|
| `choice/key-not-literal` | error | Design records are indexed by literal or finite union-typed keys. | Index design records with a literal union-typed value (for example a variant prop), not an arbitrary string. | `ads://guides/recipes` |
|
|
430
443
|
| `choice/property-unresolved` | error | Design values resolve to literals or const references inside the design system. | Make the property a literal or a const reference ADS can follow within the design system. | `ads://guides/recipes` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reqvire-org/ads",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
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": {
|
|
@@ -130,6 +130,10 @@
|
|
|
130
130
|
"types": "./dist/font-macro.d.mts",
|
|
131
131
|
"default": "./dist/font-macro.mjs"
|
|
132
132
|
},
|
|
133
|
+
"./external": {
|
|
134
|
+
"types": "./dist/external-macro.d.mts",
|
|
135
|
+
"default": "./dist/external-macro.mjs"
|
|
136
|
+
},
|
|
133
137
|
"./foundation": {
|
|
134
138
|
"types": "./dist/foundation-macro.d.mts",
|
|
135
139
|
"default": "./dist/foundation-macro.mjs"
|