@reqvire-org/ads 0.5.9 → 0.5.10
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 +61 -1
- package/dist/analysis/owner-source.mjs +16 -2
- package/dist/asset-declaration.d.mts +5 -0
- package/dist/asset-declaration.mjs +8 -2
- package/dist/asset-model.mjs +3 -0
- package/dist/construction-output.mjs +28 -6
- package/dist/construction-spec.d.mts +109 -10
- package/dist/construction-spec.mjs +173 -45
- package/dist/end-alignment.mjs +17 -2
- package/dist/form-states.mjs +2 -2
- package/dist/grid-lowering.mjs +24 -1
- package/dist/lowering-layer.mjs +11 -10
- package/dist/lowering-overlaps.mjs +5 -3
- package/dist/lowering-properties.mjs +11 -1
- package/dist/lowering-region-layout.mjs +4 -4
- package/dist/lowering-sequence.mjs +6 -2
- package/dist/measured-geometry.mjs +15 -3
- package/dist/owner-analysis-check.mjs +3 -0
- package/dist/owner-errors.mjs +6 -0
- package/dist/ownership-model.mjs +34 -9
- package/dist/platform-features.mjs +11 -0
- package/dist/press-scale.mjs +3 -1
- package/dist/profile-macro.d.mts +5 -0
- package/dist/profile-view-facts.mjs +1 -1
- package/dist/recipe-macro.d.mts +53 -6
- package/dist/recipe-model.mjs +8 -5
- package/dist/region-lowering.mjs +398 -30
- package/dist/role-vocabulary.d.mts +7 -0
- package/dist/role-vocabulary.mjs +13 -1
- package/dist/skills/ads-designer/references/motion.md +4 -1
- package/dist/skills/ads-designer/references/recipes.md +33 -2
- package/dist/skills/ads-import/references/recipes.md +33 -2
- package/dist/skills/ads-port/references/recipes.md +33 -2
- package/dist/spatial-model.mjs +11 -2
- package/dist/surface-effects.mjs +11 -6
- package/docs/ARCHITECTURE.md +8 -0
- package/docs/ASSETS.md +7 -1
- package/docs/CHANGELOG.md +133 -18
- package/docs/GUIDE.md +9 -0
- package/docs/LANGUAGE.md +137 -17
- package/docs/MOTION.md +45 -0
- package/docs/PROFILE-KINDS.md +15 -4
- package/docs/RULES.md +11 -3
- package/docs/TOKEN-ROLES.md +8 -2
- package/package.json +1 -1
package/docs/LANGUAGE.md
CHANGED
|
@@ -246,13 +246,18 @@ them all.
|
|
|
246
246
|
| `drawnBy: "<sibling part>"` | region part holding a native control | the native control (a checkbox's `<input>`) is drawn by the named part: `position: absolute`, the drawing part's frame `inlineSize` and `blockSize`, no margin, `opacity: 0`, laid over that part, so it takes no room in the row and pointer and keyboard still reach the real control. Its states still reach the drawing part (`:has(> .input:checked)`) | the named part is not declared right after it, does not show its focus (`focus: { of }`) (`spec/value-invalid`), or its frame states no `inlineSize` or `blockSize` (`profile-field-missing`) |
|
|
247
247
|
| `repeat: true` | region part (not a vector) | nothing of its own: the part's element renders once per item of a list (`tabs.map(…)`), any number of times (at least once when `required`), each instance taking the part's construction (`extent: "fill"` shares the row among them); a repeated `frame: "control"` part neighbours its own next instance, so their hit areas and spacing are checked across the gap | with `drawnBy` or `focus`, or named by another part's (`spec/value-invalid`); without it, a mapped part (`part-missing-or-repeated`) |
|
|
248
248
|
| `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`) |
|
|
249
|
-
| `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 a stack, in place of the gap (`margin-block-start: calc(space - gap)` on the part, or on what follows it), the larger where two meet, the first part flush. In block flow, the part's own `margin-block-start` and `margin-block-end`, which the browser collapses: the larger where two meet, and a last block's space passes out through containers without padding or border (a list item, a component's root) to what follows them, so loose list items whose content is another component keep their space. A placed component (`kind: "component"`) takes its space the same way. Inside its own block padding or border, a block flow starts and ends flush (`> :first-child` loses its space before, `> :last-child` its space after): there the space could not pass out and would only add to the padding | another parent layout (`space-parent-unsupported`) |
|
|
249
|
+
| `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 a stack, in place of the gap (`margin-block-start: calc(space - gap)` on the part, or on what follows it), the larger where two meet, the first part flush. In block flow, the part's own `margin-block-start` and `margin-block-end`, which the browser collapses: the larger where two meet, and a last block's space passes out through containers without padding or border (a list item, a component's root) to what follows them, so loose list items whose content is another component keep their space. A placed component (`kind: "component"`) takes its space the same way. A part laid out as an `inline` row that states its own space (`spaceBefore`, `spaceAfter`, `spacing`) is a block in block flow (`display: flex; inline-size: fit-content`, or its full width with `extent: "fill"`), so its space collapses with the blocks around it; a row without space of its own stays inline-level (`inline-flex`) and keeps its line beside inline text. Inside its own block padding or border, a block flow starts and ends flush (`> :first-child` loses its space before, `> :last-child` its space after): there the space could not pass out and would only add to the padding | another parent layout (`space-parent-unsupported`) |
|
|
250
250
|
| `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`) |
|
|
251
251
|
| (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 |
|
|
252
|
-
| `flow: { edges: "trim" }` | block-flow root (no `layout`) | its first child's space before and its last child's space after become nothing, as a stack starts and ends flush: a page that opens with a heading starts at its top. Without it, a frameless block-flow root passes those spaces out, as CSS margins do (the loose list's item content) | `recipe.flow` on a root with a `layout` (`spec/value-invalid`) |
|
|
252
|
+
| `flow: { edges: "trim" }` | block-flow root (no `layout`) | its first child's space before and its last child's space after become nothing, as a stack starts and ends flush: a page that opens with a heading starts at its top. Without it, a frameless block-flow root passes those spaces out, as CSS margins do (the loose list's item content). The automatic flush applies only to padding or a border on the flow's own element: a flow that is a component's root placed inside another component's padding (Content inside a Callout) is frameless, so it declares this to end flush | `recipe.flow` on a root with a `layout` (`spec/value-invalid`) |
|
|
253
|
+
| `frame: { …, safeArea: ["block-end", …] }` (a root's frame; a part's `frame: { profile, safeArea }`) | root, part | each named side's padding plus `env(safe-area-inset-<side>, 0px)`: a phone's bottom bar above the home indicator; an inline side is written for left-to-right and mirrored under `:dir(rtl)` | a side outside `block-start`, `block-end`, `inline-start`, `inline-end` (`spec/value-invalid`) |
|
|
254
|
+
| `groups: { "<name>": { play?, when?: { "<owner state>": { play } } } }` | visual or decoration part | sequences played by named groups of the part's drawing (`<part> > svg [data-group]`), each around its own box; `play.paused` holds one at its first step under a state ([MOTION.md](MOTION.md#groups-inside-a-drawing)) | a group the drawing does not declare, or a drawing not shown as inline SVG (`artwork-group-unknown`); a drawn group without `pathLength="1"` (`artwork-group-draw-length`) |
|
|
255
|
+
| `anchor: { artwork, x, y, inline?, block? }` | text part | the text placed on a sibling decoration's drawing at `x`, `y` in the drawing's coordinates (its viewBox), aligned by its start, centre or end on each axis (`position: absolute`, a share of the parent's box): real, checked text over a diagram. The parent is sized to the drawing (`aspect-ratio` of its viewBox), so the drawing fills it exactly | an artwork that is not a sibling decoration with a drawing, labels on two drawings in one parent, or a parent that states its own block size or ratio (`text-anchor-unsupported`) |
|
|
256
|
+
| `origin: "center" \| "inline-start" \| "inline-end" \| "block-start" \| "block-end"` | root, part | where its scales and `rotate` grow from, in states, entrances and sequences alike (`transform-origin`; an inline edge also writes its mirror under `:dir(rtl)`); `"center"`, the default, writes nothing | another value (`spec/value-invalid`) |
|
|
253
257
|
| `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`) |
|
|
254
258
|
| 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 |
|
|
255
259
|
| `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`) |
|
|
260
|
+
| `between: { surface, frame, axes: ["inline", "block"] }` | root, part, fluid grid | rules between the arranged items on the named axes, wherever the arrangement puts them: a stack's (or block flow's) on the block axis, a single-line row's on the inline axis, a wrapping row's or a grid's on either or both, at every width (a logo band's hairlines at 2, 3 and 6 columns, a partial last row included). Each item draws, in its `::before`, the rules on its start sides, centred in the gap (just before the item where the gap is narrower than the rule); a stack's or row's only after an earlier item, a wrapping row's and a grid's always, the host clipping the outermost (`overflow: clip`). Decorations are not items. A focus outline an edge clips is reported by the render audit (`focus-clipped`) | an axis the arrangement does not separate on, a layered parent, or an item whose `::before` is taken (`construction/between-axes-unsupported`); a grid's `between` without `axes` (`spec/value-invalid`) |
|
|
256
261
|
| `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 |
|
|
257
262
|
| `pseudo: { marker: { surface?, text?, content?, when? } }` | root or part rendered as `li` or `summary` | `::marker`: a colour-only surface (and its states), a text profile of weight and numerals (`fontWeight`, `fontFeatureSettings`), generated content; its contrast is proven where the item is placed (3:1 for a bullet, the text minimum for a number) | another host (`pseudo-host-unsupported`); a surface or text profile that states more (`pseudo-surface-unsupported`) |
|
|
258
263
|
| `pseudo: { before: { content, surface?, text?, when? } }` | root or part that is not a replaced element | `::before` with generated content (a section number), in its colour and weight; proven as text | an `img`, `input`, `select`, `textarea`, `video`, `iframe`, `br`, `hr` or `svg` host (`pseudo-host-unsupported`) |
|
|
@@ -260,7 +265,7 @@ them all.
|
|
|
260
265
|
| `counter: { reset?, increment? }` | root, part | `counter-reset` where a count starts, `counter-increment` on what it counts; names are shared across components (a `List` resets, a `ListItem` increments); `list-item` is the browser's own list counter | a CSS keyword as a name (`spec/value-invalid`) |
|
|
261
266
|
| `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`) |
|
|
262
267
|
| `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`) |
|
|
263
|
-
| `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 |
|
|
268
|
+
| `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. With `overscroll: "contain"` beside a scrolling value, `overscroll-behavior: contain`: reaching its end does not scroll the dialog or page behind it | on a top-layer root (`profile-provider-conflict`); with truncation |
|
|
264
269
|
| `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) |
|
|
265
270
|
| `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) |
|
|
266
271
|
| 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 |
|
|
@@ -273,10 +278,12 @@ them all.
|
|
|
273
278
|
| control `layout: "stack"` | control | visual above label; the control box centres visual + gap + line | `justify` |
|
|
274
279
|
| `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 |
|
|
275
280
|
| `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`) |
|
|
281
|
+
| `frame: { profile, rules?, corners? }`; `at: { "<condition>": { frame: { rules?, corners? } } }` | part with its own box | the box's one-sided rules and rounded corners as a root frame's, and under the condition only what the condition changes: a tinted side with a hairline on top and rounded bottom corners while stacked, on its start side and end corners beside | a frame change on a part without its own box; condition `rules` on a box without `rules` (`spec/value-invalid`) |
|
|
282
|
+
| `at: { "<condition>": { align?, justify?, textAlign? } }` | region root, part | the element's arrangement alignment (`align-items`, `justify-content`) and `text-align` inside the condition's range, its own outside it: a banner centred on phones and start-aligned from a width; a root's alignment needs no `frame` | unknown condition (`condition-unknown`); an entry that changes nothing (`spec/value-invalid`) |
|
|
276
283
|
| `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`) |
|
|
277
284
|
| `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`) |
|
|
278
285
|
| `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`) |
|
|
279
|
-
| `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`) |
|
|
286
|
+
| `normalize: { textDecoration: "none", pointerEvents: "none", borderStyle: "none" }` | root, `normalize.when`; `textDecoration` and `pointerEvents` also on a part (a link card's link, a decorative layer at any depth) | `text-decoration-line`, `pointer-events`, `border-style` | pointer transparency on focusable or interactive, non-`aria-hidden` markup (`source/pointer-transparent-interactive`) |
|
|
280
287
|
| `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`) |
|
|
281
288
|
| `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`) |
|
|
282
289
|
| `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`) |
|
|
@@ -454,15 +461,55 @@ range: { selector: ".price-range", required: true,
|
|
|
454
461
|
pseudo: { sliderTrack: { surface: "slider-track", frame: "slider-track-frame" }, sliderThumb: { surface: "slider-thumb", frame: "slider-thumb-frame" } } },
|
|
455
462
|
```
|
|
456
463
|
|
|
457
|
-
|
|
458
|
-
(`
|
|
459
|
-
|
|
460
|
-
|
|
464
|
+
<a id="range-sliders"></a>
|
|
465
|
+
Each takes a surface (`background`, `borderColor`, `boxShadow`) and a frame
|
|
466
|
+
profile (`inlineSize`, `blockSize`, `radius`, `borderWidth`), with `when`
|
|
467
|
+
surfaces for states. ADS turns off the engine's drawing and writes each once per
|
|
468
|
+
engine (`::-webkit-slider-runnable-track`, `::-moz-range-track`,
|
|
461
469
|
`::-webkit-slider-thumb`, `::-moz-range-thumb`), and centres the WebKit thumb on
|
|
462
|
-
the track by half their difference in height.
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
470
|
+
the track by half their difference in height. The thumb's boundary needs 3:1
|
|
471
|
+
against the track in every theme, brand and state, as a progress fill against
|
|
472
|
+
its track (`construction/progress-contrast-insufficient`): its background, or
|
|
473
|
+
the ring its frame's border draws (a white handle with a coloured ring).
|
|
474
|
+
Disabled states are exempt.
|
|
475
|
+
|
|
476
|
+
A pricing calculator's slider fills up to its handle, grows the handle under
|
|
477
|
+
the pointer and writes its steps under it:
|
|
478
|
+
|
|
479
|
+
```ts
|
|
480
|
+
input: { selector: ".price-range", required: true,
|
|
481
|
+
measured: { fill: { type: "share", property: "slider-fill" } },
|
|
482
|
+
pseudo: {
|
|
483
|
+
sliderTrack: { surface: "slider-track", frame: "slider-track-frame" },
|
|
484
|
+
sliderFill: { surface: "slider-fill", when: { "&:has(> .price-range:disabled)": { surface: "slider-track" } } },
|
|
485
|
+
sliderThumb: { surface: "slider-thumb", frame: "slider-thumb-frame", grow: { slot: "motion", field: "scale" } },
|
|
486
|
+
} },
|
|
487
|
+
steps: { selector: ".price-steps", required: true, along: "input",
|
|
488
|
+
measured: { step: { type: "share", property: "slider-step" } },
|
|
489
|
+
parts: { step: { selector: ".price-step", required: true, repeat: true, kind: "text" } } },
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
- **The fill** (`sliderFill`, a surface with `when` states) is drawn on the
|
|
493
|
+
track up to the thumb. Firefox draws it itself (`::-moz-range-progress`, at
|
|
494
|
+
the track's size and radius); WebKit and Blink paint the track in the fill's
|
|
495
|
+
colour up to the measured share, from the side the slider starts on
|
|
496
|
+
(mirrored under right-to-left). The owner writes the share at render,
|
|
497
|
+
`measured.props({ fill: (value - min) / (max - min) })`, so the first paint
|
|
498
|
+
is right. The fill needs 3:1 against the track, as a progress bar. A fill
|
|
499
|
+
needs the track and a share (`construction/slider-fill-unsupported`); a
|
|
500
|
+
`slider-fill` share needs a fill (`construction/measured-property-unsupported`).
|
|
501
|
+
- **The thumb** takes its surface's `boxShadow`; `grow` scales it by a motion
|
|
502
|
+
field while it is pointed at or dragged and enabled, over the motion profile's
|
|
503
|
+
timing, at once under reduced motion. With a focus profile in the recipe's
|
|
504
|
+
focus slot, the focus indicator is drawn on the thumb, where the value is, in
|
|
505
|
+
place of one around the whole control.
|
|
506
|
+
- **Step labels** are a row `along` a sibling slider part, with no layout of its
|
|
507
|
+
own: it is inset by half the thumb frame's `inlineSize`, so each end's thumb
|
|
508
|
+
centre is a label's centre, and each label is centred at its own
|
|
509
|
+
`slider-step` share (`measured.props({ step: … })` on the label), whether or
|
|
510
|
+
not the steps are evenly spaced. A row that names no sibling with a sized
|
|
511
|
+
thumb, declares no share or has a layout is
|
|
512
|
+
`construction/slider-steps-unsupported`.
|
|
466
513
|
|
|
467
514
|
**Contrast**, in every theme, brand and token condition:
|
|
468
515
|
|
|
@@ -673,7 +720,64 @@ const page = recipe({
|
|
|
673
720
|
- The layer profile's `stickyLayer` (role `layer`) stacks the element above
|
|
674
721
|
positioned content that scrolls under it. Without it the element keeps its
|
|
675
722
|
place in document order.
|
|
676
|
-
-
|
|
723
|
+
- Inline edges stick too: `edge: "inline-start"` keeps a table's row names in
|
|
724
|
+
place while its frame scrolls sideways (`overflow: "scroll-inline"` on an
|
|
725
|
+
ancestor). They follow the writing direction (`inset-inline-start`). A
|
|
726
|
+
sticky column covers the content scrolling under it only when it paints a
|
|
727
|
+
background: give it, or its row, a surface. `clear` is for the block-start
|
|
728
|
+
edge only. A top-layer root takes no `sticky`.
|
|
729
|
+
|
|
730
|
+
## Decorations
|
|
731
|
+
|
|
732
|
+
A decoration is artwork or a pattern that means nothing: a graph behind a
|
|
733
|
+
panel, a dot grid behind a banner, a glow behind a hero, a page's backdrop. It
|
|
734
|
+
is a part of `kind: "decoration"`, on a region root or any part, and lies behind
|
|
735
|
+
that element's content.
|
|
736
|
+
|
|
737
|
+
```ts
|
|
738
|
+
const panel = recipe({ layout: "stack", parts: {
|
|
739
|
+
graph: { selector: ".ux-panel-graph", required: true, kind: "decoration", surface: "graph-fade" },
|
|
740
|
+
title: { selector: ".ux-panel-title", required: true, kind: "text" },
|
|
741
|
+
} }).root;
|
|
742
|
+
const graph = recipe({ parts: { visual: { kind: "visual", asset: "panel-graph" } } });
|
|
743
|
+
// <section className={panel}>
|
|
744
|
+
// <span className={`ux-panel-graph ${graph.parts.visual}`} aria-hidden="true"
|
|
745
|
+
// dangerouslySetInnerHTML={{ __html: graph.assets.visual.source }} />
|
|
746
|
+
// <h2 className="ux-panel-title">…</h2>
|
|
747
|
+
// </section>
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
- **Behind the content.** The decoration fills its parent's box
|
|
751
|
+
(`position: absolute; inset: 0; z-index: -1`), and the parent becomes its
|
|
752
|
+
containing block and its own stacking context (`position: relative`, unless
|
|
753
|
+
it is already positioned, and `isolation: isolate`), so the decoration never
|
|
754
|
+
slips behind the page or over another owner. The parent's content stays in
|
|
755
|
+
its flow; nothing is restructured into layers. Several decorations stack in
|
|
756
|
+
declaration order.
|
|
757
|
+
- **Painted by its surface, its artwork or both.** A surface paints a
|
|
758
|
+
gradient (`backgroundImage`), a pattern (`backgroundTile`), a fade (`mask`),
|
|
759
|
+
blur or opacity. Artwork is bound as a visual part's is, in any paint mode: a
|
|
760
|
+
themed (paint-slot) drawing stays inline SVG, so its theme's paints reach it.
|
|
761
|
+
- **Cropped against its own box.** The decoration is a size container, and its
|
|
762
|
+
drawing covers it (`fit: "cover"`, the default without a visual profile) or
|
|
763
|
+
is contained in it (`fit: "contain"`) by container query units, around the
|
|
764
|
+
drawing's optical centre. No ratio box is needed: the parent's box is its
|
|
765
|
+
shape, whatever its width and height.
|
|
766
|
+
- **Past the edge.** `outset` (spacing fields) lets a glow spill past the
|
|
767
|
+
parent's box; a parent that clips (`overflow: "clip"`, a card's corners) clips
|
|
768
|
+
it.
|
|
769
|
+
- **Attached.** `attachment: "scroll"` (the default) moves with the parent;
|
|
770
|
+
`attachment: "fixed"` keeps a page's backdrop in place while the page scrolls.
|
|
771
|
+
- **Responsive and animated.** `at` shows, hides or resizes it under a named
|
|
772
|
+
condition; `play` and `when` animate it, and reduced motion stops the motion.
|
|
773
|
+
- **Meaningless by construction.** Its element is `aria-hidden="true"` and
|
|
774
|
+
holds nothing a person can use (`source/decoration-exposed`); ADS writes
|
|
775
|
+
`pointer-events: none`, so it never takes a click or focus.
|
|
776
|
+
- **Text over it is measured.** Text in the same owner is drawn over the
|
|
777
|
+
decoration, whose pixels the static contrast check cannot see: the review
|
|
778
|
+
note `review/decoration-under-text` asks for a scenario, and the render audit
|
|
779
|
+
measures the text in every theme. Fade the decoration under text with a
|
|
780
|
+
surface `mask`.
|
|
677
781
|
|
|
678
782
|
## Top-layer roots
|
|
679
783
|
|
|
@@ -740,7 +844,12 @@ recipe({
|
|
|
740
844
|
while open. Its root declares at least one measured inset or `translate`
|
|
741
845
|
(`construction/measured-placement-missing`); `corner` and `clear` do not
|
|
742
846
|
apply. CSS anchor positioning is not used: it cannot follow a pointer or a
|
|
743
|
-
selection.
|
|
847
|
+
selection. The panel's distance from the anchor is design, not the script's:
|
|
848
|
+
the layer profile's `anchorGap`/`anchorOverlap` and
|
|
849
|
+
`anchorOutdent`/`anchorIndent` move it from the measured position
|
|
850
|
+
([PROFILE-KINDS.md](PROFILE-KINDS.md#layer)). A menu under a sticky header
|
|
851
|
+
stays under its trigger while the page scrolls; under a trigger that scrolls,
|
|
852
|
+
the owner measures again while it is open.
|
|
744
853
|
|
|
745
854
|
The compiler normalizes the UA box (inset, margin, padding, border, size
|
|
746
855
|
limits) and writes the arrangement's `display` only under the native open state
|
|
@@ -752,7 +861,11 @@ transition cannot share the root's transition set
|
|
|
752
861
|
(`construction/profile-provider-conflict`).
|
|
753
862
|
|
|
754
863
|
Motion uses the recipe's motion slot with the `static` reduced policy: a sheet
|
|
755
|
-
slides its own extent from its edge (`"slide"`), a popover fades (`"fade"`)
|
|
864
|
+
slides its own extent from its edge (`"slide"`), a popover fades (`"fade"`)
|
|
865
|
+
or drops (`"drop"`: it fades while coming down the motion profile's `distance`
|
|
866
|
+
from its `scale`, growing from its top edge, and goes back up as it closes: a
|
|
867
|
+
site header's menu). Reduced motion leaves a drop with neither travel nor
|
|
868
|
+
animation.
|
|
756
869
|
Opening starts from `@starting-style` in every browser. Closing keeps
|
|
757
870
|
`display` and `overlay` through `transition-behavior: allow-discrete`: a
|
|
758
871
|
browser that can transition `overlay` animates the exit, any other closes at
|
|
@@ -824,6 +937,10 @@ Each `type` (setter value; place) has a closed property list:
|
|
|
824
937
|
width and height from its centre, right and down positive, within ±0.5):
|
|
825
938
|
`object-position` of a cropped application image, a top-level visual part
|
|
826
939
|
whose visual profile declares `fit: "cover"`.
|
|
940
|
+
- `share` (a number from 0 to 1, how far along its range a value is):
|
|
941
|
+
`slider-fill`, the fill of a range slider with a `sliderFill` treatment, or
|
|
942
|
+
`slider-step`, the place of each step label in a row `along` a slider
|
|
943
|
+
([range sliders](#range-sliders)). Written with `measured.props` at render.
|
|
827
944
|
|
|
828
945
|
Rules:
|
|
829
946
|
|
|
@@ -916,8 +1033,11 @@ The fields occur in a root's or a part's `normalize` and in its `when`:
|
|
|
916
1033
|
|
|
917
1034
|
Rules:
|
|
918
1035
|
|
|
919
|
-
- A part's `normalize` takes
|
|
920
|
-
|
|
1036
|
+
- A part's `normalize` takes these three fields, `resize` (a `<textarea>`),
|
|
1037
|
+
`margin`, `textDecoration` (a link part whose underline is not its look) and
|
|
1038
|
+
`pointerEvents: "none"` (a decorative layer over interactive content, at any
|
|
1039
|
+
depth: it must be `aria-hidden` or free of interactive content, and never
|
|
1040
|
+
focusable). A root's (region or control) also takes the native operations in
|
|
921
1041
|
[the authoring invariant](#the-authoring-invariant). A vector part takes none.
|
|
922
1042
|
- A part `when` key is an owner state in the closed
|
|
923
1043
|
[`when` grammar](#state-focus-and-motion). The rule is written under the
|
package/docs/MOTION.md
CHANGED
|
@@ -206,6 +206,11 @@ const card = recipe({
|
|
|
206
206
|
root rests at `scale: 1` and keeps it under reduced motion.
|
|
207
207
|
- A `transition` channel needs its endpoint, an entry a `surface` or a `scale`,
|
|
208
208
|
and the motion profile the `static` policy.
|
|
209
|
+
- A root may also travel under a state: `translateBlock` or `translateInline`
|
|
210
|
+
from its motion slot's `distance` (a link card that lifts as a whole on
|
|
211
|
+
hover), with `translate` in its `transition`. It rests at no travel, keeps
|
|
212
|
+
none under reduced motion, and inline travel is mirrored under right-to-left,
|
|
213
|
+
as a part's travel is.
|
|
209
214
|
- A [top-layer root](LANGUAGE.md#top-layer-roots) takes no press
|
|
210
215
|
(`spec/field-unsupported`).
|
|
211
216
|
- A `frame: "container"` root that presses below 0.98 in some token context, or
|
|
@@ -309,6 +314,13 @@ recipe({
|
|
|
309
314
|
three scales read the profile's `scale` and are one channel, so a state takes
|
|
310
315
|
one of them. `rotate` turns the part in place by the profile's `angle`. A
|
|
311
316
|
control's visual part takes the same scales and `rotate`.
|
|
317
|
+
- `origin` on a root or part sets where its scales and `rotate` grow from, in a
|
|
318
|
+
state, an entrance or a sequence alike: `"center"` (the default),
|
|
319
|
+
`"inline-start"`, `"inline-end"`, `"block-start"` or `"block-end"`. An
|
|
320
|
+
underline that stretches in from its start is `origin: "inline-start"` with a
|
|
321
|
+
`scaleInline` from 0. Inline edges are mirrored under right-to-left
|
|
322
|
+
(`transform-origin` has no logical keywords, so ADS writes the `:dir(rtl)`
|
|
323
|
+
rule).
|
|
312
324
|
- `transition` lists the channels that animate: `translate`, `scale`, `rotate`. An effect
|
|
313
325
|
whose channel is not listed applies at once. A listed channel without an
|
|
314
326
|
effect is refused.
|
|
@@ -456,6 +468,39 @@ recipe({
|
|
|
456
468
|
it. An indicator rendered only while work is in progress needs nothing more.
|
|
457
469
|
- The older continuous rotation (`repeat: "continuous"` with `rotate` on a
|
|
458
470
|
standalone artwork part) is unchanged.
|
|
471
|
+
- **Held, then played.** `play: { sequence, paused: true }` under one owner
|
|
472
|
+
state holds the element at its first step (`animation-play-state: paused`),
|
|
473
|
+
and the same sequence under another state plays it: a diagram armed before it
|
|
474
|
+
scrolls into view, played when it does. The owner switches the state.
|
|
475
|
+
|
|
476
|
+
### Groups inside a drawing
|
|
477
|
+
|
|
478
|
+
A drawing's named groups play sequences of their own: a wordmark's letters
|
|
479
|
+
dropping in turn, a diagram's dots appearing and its edges drawing themselves.
|
|
480
|
+
The asset declares its groups (`groups: ["n", "e", "z"]`) and its SVG marks each
|
|
481
|
+
(`data-group="n"`, see [ASSETS.md](ASSETS.md)); a visual or decoration part
|
|
482
|
+
plays them:
|
|
483
|
+
|
|
484
|
+
```ts
|
|
485
|
+
mark: { selector: ".ux-word", kind: "decoration", groups: {
|
|
486
|
+
z: { play: { sequence: "letter-drop" } }, // the last letter first
|
|
487
|
+
e: { play: { sequence: "letter-drop", order: 1 } },
|
|
488
|
+
n: { play: { sequence: "letter-drop", order: 2 } },
|
|
489
|
+
} },
|
|
490
|
+
edges: { when: { '&[data-play="armed"]': { play: { sequence: "edge-draw", paused: true } },
|
|
491
|
+
'&[data-play="true"]': { play: { sequence: "edge-draw", order: 3 } } } },
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
- A group is `<part> > svg [data-group="<name>"]`: only a drawing shown as
|
|
495
|
+
inline SVG (paint slots or foreground) exposes its groups; an image document
|
|
496
|
+
(intrinsic paint) cannot be reached inside.
|
|
497
|
+
- Each group moves and scales around its own box (`transform-box: fill-box`,
|
|
498
|
+
`transform-origin: center`).
|
|
499
|
+
- A `draw` step reveals a line along its length: the group's shapes state
|
|
500
|
+
`pathLength="1"` in the SVG (`construction/artwork-group-draw-length`), and
|
|
501
|
+
ADS draws them as one dash of that length. At rest, and under reduced motion,
|
|
502
|
+
the line is drawn: the finished picture.
|
|
503
|
+
- A group the drawing does not declare is `construction/artwork-group-unknown`.
|
|
459
504
|
|
|
460
505
|
## Animating a measured value
|
|
461
506
|
|
package/docs/PROFILE-KINDS.md
CHANGED
|
@@ -104,7 +104,9 @@ The example design system's detailed text specimen is `profiles/Typography/detai
|
|
|
104
104
|
Fields: `background`, `color`, `borderColor` and `textDecorationColor` (an
|
|
105
105
|
underline's paint, which a state and a paint transition change like any paint)
|
|
106
106
|
(`paint`), `boxShadow`
|
|
107
|
-
(`shadow`), `backgroundImage` (`gradient`), `
|
|
107
|
+
(`shadow`), `backgroundImage` (`gradient`), `backgroundTile` (`spacing` or
|
|
108
|
+
`frame-size`: the image repeated at that square size over the box, a dot grid),
|
|
109
|
+
`opacity` (`opacity`), the effects
|
|
108
110
|
`blur` and `backdropBlur` (`blur`), `backdropSaturate` (`saturation`),
|
|
109
111
|
`shapeShadow` and `groupShadow` (`shadow`), `mask` (`gradient`), a paint per
|
|
110
112
|
border side, and the policy field `state`.
|
|
@@ -238,6 +240,7 @@ effect fields into them in a fixed order, whatever order the profile states:
|
|
|
238
240
|
| `backdropBlur` | `blur` | Blurs what is behind the element | `backdrop-filter: blur()` |
|
|
239
241
|
| `backdropSaturate` | `saturation` | Makes what is behind the element more or less vivid | `backdrop-filter: saturate()` |
|
|
240
242
|
| `brightness` | `brightness` | Dims or brightens a drawing: a picture with no dark version, dimmed in the dark theme (the token is `100%` in light and lower in dark). A visual part's only: text under it could not be proven readable (`construction/surface-effect-misplaced`) | `filter: brightness()`, first in the list |
|
|
243
|
+
| `grayscale`, `invert` | `grayscale`, `invert` | Tone a drawing: a grey logo made for a light page shown as light marks on a dark one (`0%` in light, `100%` in dark, with `brightness` above `100%`). A visual part's only, like `brightness`. The three compose in one order, `grayscale`, `invert`, `brightness`, whatever the surface lists | `filter: grayscale() invert() brightness()` |
|
|
241
244
|
|
|
242
245
|
The element is blurred before its shadow is cast (`filter: blur() drop-shadow()`),
|
|
243
246
|
and the backdrop is blurred before it is saturated
|
|
@@ -455,8 +458,10 @@ profile({
|
|
|
455
458
|
- A step states what the part looks like there: `opacity` (`opacity`),
|
|
456
459
|
`translateInline` and `translateBlock` (`motion-distance`), one scale
|
|
457
460
|
(`scale`, or `scaleInline` / `scaleBlock` for one axis; `motion-scale`) and
|
|
458
|
-
`rotate` (`motion-angle`)
|
|
459
|
-
|
|
461
|
+
`rotate` (`motion-angle`), and `draw: "hidden" | "drawn"` (a keyword, not a
|
|
462
|
+
token: a line revealed along its length, for shapes that state
|
|
463
|
+
`pathLength="1"`). A property a step leaves out is interpolated between the
|
|
464
|
+
steps that state it.
|
|
460
465
|
- The steps run from `0` to `100`, at distinct whole percentages
|
|
461
466
|
(`construction/sequence-steps-invalid`).
|
|
462
467
|
- `repeat` is `"loop"` (the default), `"alternate"` or `"once"`. A loop ends
|
|
@@ -551,7 +556,13 @@ Places a top-layer root, such as an anchored popover, against the viewport
|
|
|
551
556
|
([top-layer roots](LANGUAGE.md#top-layer-roots)). Fields: `edgeGap` (`spacing`)
|
|
552
557
|
from the block edge, `viewportMargin` (`spacing`) from the inline edge, and
|
|
553
558
|
`clearBlockStart` (`layout-size`) for a fixed region it keeps clear of, such as
|
|
554
|
-
a toolbar band. The clearance must resolve to a fixed length. A
|
|
559
|
+
a toolbar band. The clearance must resolve to a fixed length. A measured
|
|
560
|
+
popover also takes its distance from what the owner anchors it to: `anchorGap`
|
|
561
|
+
(`spacing`) past the anchor's edge or `anchorOverlap` (`overlap`) into it on
|
|
562
|
+
the block axis, and `anchorOutdent` (`spacing`) before the anchor's start or
|
|
563
|
+
`anchorIndent` (`spacing`) after it on the inline axis; each pair is one or the
|
|
564
|
+
other (`construction/profile-provider-conflict`). ADS adds them to the measured
|
|
565
|
+
position, so the owner's script reports only where the trigger is. A composite's
|
|
555
566
|
`layer-profile` slot selects the profile. A modal sheet is full height and
|
|
556
567
|
attached to its edge, so it needs no layer profile.
|
|
557
568
|
|
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: 459 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
|
|
|
@@ -19,8 +19,8 @@ Fix findings in group order: earlier groups are often the cause of later ones. T
|
|
|
19
19
|
| 2 | [unresolved-reference](#unresolved-reference) | 39 | violated | The source names something that does not exist in this revision. | Correct the name from the existing candidates. Declare a new one only when it is genuinely new design. |
|
|
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
|
-
| 5 | [structure-mismatch](#structure-mismatch) |
|
|
23
|
-
| 6 | [accessibility-semantics](#accessibility-semantics) |
|
|
22
|
+
| 5 | [structure-mismatch](#structure-mismatch) | 53 | 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) | 47 | 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
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
26
|
| 9 | [conflict](#conflict) | 47 | 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. |
|
|
@@ -183,6 +183,9 @@ Rendered markup does not match what its declaration promises. Make the markup ma
|
|
|
183
183
|
| `check/token-sheet-property` | error | Token sheets declare tokens only: custom properties (--name). A declaration of an ordinary CSS property (`:root { color: red }`) is no token, belongs to no role and styles outside every recipe; ADS does not read it as a token. | Remove the declaration. Style an element through its recipe, and the document through foundation({ text, surface }); a value meant to be shared is a token (--name) of its role. | `ads://guides/tokens` |
|
|
184
184
|
| `choice/no-reachable-choice` | error | Every styled selection renders in at least one reachable state. | Check the conditions guarding the element; remove dead branches or the unreachable styling. | `ads://guides/recipes` |
|
|
185
185
|
| `construction/artwork-binding-missing` | error | An artwork construction binds its visual part to a declared asset. | Bind the visual part to a declared asset and name its visual profile in the binding: recipe({ parts: { visual: { kind: "visual", asset: "<asset>", visual: "<visual profile>" } } }). | `ads://guides/branding`, `ads://guides/pictograms` |
|
|
186
|
+
| `construction/artwork-group-draw-length` | error | A line drawn along its length (a sequence's `draw` step) is measured on a length of 1: each shape of the group states `pathLength="1"` in the SVG, so the dash covers the whole line whatever its real length. | Add `pathLength="1"` to each path, line, polyline, polygon, circle, ellipse or rect of the group in the SVG. | `ads://guides/recipes` |
|
|
187
|
+
| `construction/artwork-group-unknown` | error | A part animates the named groups its drawing declares (`groups` in the asset, `data-group` in its SVG): a wordmark's letters, a diagram's edges. The drawing is shown as inline SVG (paint slots or foreground); an image document (intrinsic paint) is drawn as an <img>, where nothing inside can be reached. | Name a group the asset declares, or declare it: `groups: ["<name>"]` in the asset and `data-group="<name>"` on its element in the SVG. | `ads://guides/recipes`, `ads://guides/branding` |
|
|
188
|
+
| `construction/between-axes-unsupported` | error | `between: { axes }` draws rules between arranged items on the axes it names: a stack's (or a block flow's) on the block axis, a single-line row's on the inline axis, a wrapping row's or a grid's on either or both. Layers overlap and have nothing between them, and each item's `::before` draws its rules, so no item may already use it. | Name the axis the arrangement separates its items on (block for a stack, inline for a row), wrap the row or use a grid for both, or move the item's own ::before treatment to another element. | `ads://guides/recipes` |
|
|
186
189
|
| `construction/content-missing` | error | A control renders text or artwork in every reachable choice, so it is never empty. | Give every choice a text part or an artwork part. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
187
190
|
| `construction/cover-box-missing` | error | A cropped image (a visual part whose visual profile declares `fit: "cover"`) fills a box of its own: it is a top-level part of a region whose frame declares a `ratio` or whose frame profile fixes its `blockSize`. The frame has the shape; the image is cropped inside it. | Declare `frame: { ratio: "16 / 9" }` (a ratio the spatial profile permits) on the recipe whose top-level visual part crops, or use a visual profile with `fit: "contain"`. | `ads://guides/recipes`, `ads://guides/layout` |
|
|
188
191
|
| `construction/extent-row-hugs` | error | An inline row is as wide as its content unless its recipe declares `extent: "container"`; a part can fill only a row that takes its container's width. | Declare `extent: "container"` on the row's recipe so it takes its container's width, or remove the part's `extent`. | `ads://guides/recipes`, `ads://guides/layout` |
|
|
@@ -191,7 +194,10 @@ Rendered markup does not match what its declaration promises. Make the markup ma
|
|
|
191
194
|
| `construction/outset-unsupported` | error | `outset` draws a decorative backdrop past its parent's box (a glow behind a card): it belongs on a part of a `layered` parent that holds no parts and no text. The parent's box and the layout around it do not change. | Make the parent `layout: "layered"` (root or a part's `recipe`) with the backdrop as its first part, and keep content in the other layers. | `ads://guides/recipes` |
|
|
192
195
|
| `construction/reserve-without-text` | error | `reserveLines` reserves lines of the part's own text profile, so the part has one. | Make the part a text part (with a text slot or `text` profile), or remove `reserveLines`. | `ads://guides/recipes` |
|
|
193
196
|
| `construction/scheme-unsupported` | error | `scheme` marks one file of a content image's light and dark pair: it belongs on a visual part rendered as an `<img>` without an artwork binding. Declared artwork selects its drawing by theme through its own variants. | Render the part as an `<img>` whose `src` the application supplies, or remove `scheme` and give the declared asset a variant for the other theme. | `ads://guides/recipes`, `ads://guides/branding` |
|
|
197
|
+
| `construction/slider-fill-unsupported` | error | A slider's fill (`pseudo.sliderFill`) is drawn on its track up to the thumb: the element draws its track (`sliderTrack`), whose size and radius the fill takes, and declares a measured share (`{ type: "share", property: "slider-fill" }`) the owner writes as the value's place in its range, 0 to 1. Firefox draws the fill natively; other engines paint the track up to the share. | Give the slider a `sliderTrack` treatment and declare `measured: { fill: { type: "share", property: "slider-fill" } }` on it; the owner writes `(value - min) / (max - min)`, at render with `measured.props`. | `ads://guides/recipes` |
|
|
198
|
+
| `construction/slider-steps-unsupported` | error | A row of step labels (`along: "<slider part>"`) lies under a sibling slider: it is inset by half the thumb's width, so the thumb's centre at each end is a label's centre, and each label is centred at its own measured share (`{ type: "share", property: "slider-step" }`). The row arranges its labels itself: it declares no layout. | Name a sibling part whose `sliderThumb` frame states `inlineSize`, declare `measured: { step: { type: "share", property: "slider-step" } }` on the row and write each label's share with `measured.props`; drop the row's layout. | `ads://guides/recipes` |
|
|
194
199
|
| `construction/snap-without-scroll` | error | Scroll snap is declared by the arrangement of the element that scrolls on the snap axis (`overflow: "scroll-inline"` for inline, `"scroll-block"` for block, `"scroll-both"` for both); its children, which it places, snap. Elsewhere it has no effect. | Make the element scroll on the snap axis with `overflow` (`scroll-inline`, `scroll-block` or `scroll-both`), or move `snap` to the arrangement of the element that scrolls. | `ads://guides/recipes`, `ads://guides/layout` |
|
|
200
|
+
| `construction/text-anchor-unsupported` | error | A text part placed on a drawing (`anchor: { artwork, x, y }`) names a sibling decoration whose artwork is the drawing: their parent is sized to the drawing (its viewBox ratio), so the drawing fills it and a point of the drawing is a share of the parent's box. One parent places labels on one drawing, and states no block size or ratio of its own. | Anchor labels to a `kind: "decoration"` sibling that binds the drawing, all to the same one, and leave the parent's height to the drawing. | `ads://guides/recipes` |
|
|
195
201
|
| `review/measured-unused` | review | A measured value the recipe declares is written by the owner (`recipe.measured.set`): an unused declaration is a stale permission. | Set it with `recipe.measured.set(element, { … })` where the owner measures it, or remove the declaration. | `ads://guides/recipes` |
|
|
196
202
|
| `review/paint-unused` | review | A runtime paint the recipe declares is written by the owner (`recipe.paints.set`): an unused declaration is a stale permission. | Set it with `recipe.paints.set(element, { … })` where the owner reads its data, or remove the declaration. | `ads://guides/recipes` |
|
|
197
203
|
| `source/align-rows-mismatch` | error | A grid aligns only the rows a public component exposes, in the order it exposes them. | Align only the rows the component exposes, in its order, or expose the rows from the component. | `ads://guides/layout` |
|
|
@@ -250,6 +256,7 @@ Owned markup or motion lacks required accessible semantics: a text alternative,
|
|
|
250
256
|
| `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` |
|
|
251
257
|
| `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` |
|
|
252
258
|
| `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` |
|
|
259
|
+
| `review/decoration-under-text` | review | Text over a decoration is readable in every theme: the decoration lies under the construction's text, so its contrast depends on the artwork or pattern, which the static check cannot see through. A scenario that renders the owner lets the render audit measure it. | Cover the owner with a scenario so the render audit measures the text over the decoration in every theme; fade the decoration (a surface `mask`) where text lies. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
253
260
|
| `review/disabled-unshown` | review | A control that can be disabled looks disabled: an owner that declares a disabled state (`&:disabled` or `&[aria-disabled="true"]` in a `when`) paints it differently, through its surface (an `inactive` surface profile), its opacity or its artwork. A cursor or pointer change alone shows only under a pointer, after the person reached for the control. WCAG 2.2 exempts inactive controls from contrast minimums, not from being told apart. | Under `&:disabled`, select an `inactive` surface profile (or lower the opacity) so the disabled control is seen as unavailable. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
254
261
|
| `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` |
|
|
255
262
|
| `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` |
|
|
@@ -263,6 +270,7 @@ Owned markup or motion lacks required accessible semantics: a text alternative,
|
|
|
263
270
|
| `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` |
|
|
264
271
|
| `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` |
|
|
265
272
|
| `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` |
|
|
273
|
+
| `source/decoration-exposed` | error | A decoration (`kind: "decoration"`) carries no meaning: its element is `aria-hidden="true"` and holds nothing a person can use. ADS writes it behind its parent's content and lets the pointer through. | Add `aria-hidden="true"` to the decoration's element; content that means something is a visual or text part, not a decoration. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
266
274
|
| `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` |
|
|
267
275
|
| `source/focus-unshown` | error | Focus stays visible (WCAG 2.2 2.4.7). A field that shows no outline of its own (`focus: { shownBy: "container" }`) is shown by a container in the same component whose root names it: `focus: { within: ".field" }` draws the focus profile's outline around the whole field while it has keyboard focus. | Give the box around the field `focus: { within: "<the field's class>" }`, or remove `shownBy` so the field draws its own outline. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
268
276
|
| `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` |
|
package/docs/TOKEN-ROLES.md
CHANGED
|
@@ -27,7 +27,7 @@ construction and owner code supplies behavior: these are different contracts.
|
|
|
27
27
|
- Primitive and semantic describe a token's purpose, not role kinds. A folder
|
|
28
28
|
name does not prove primitive status. The example design system uses
|
|
29
29
|
`Foundation/spacing.ads.css` for primitive scale steps and functional groups
|
|
30
|
-
(`Surfaces/` for paints, gradients, shadows, opacity, blur, saturation and
|
|
30
|
+
(`Surfaces/` for paints, gradients, shadows, opacity, blur, saturation, brightness, grayscale and invert) for semantic
|
|
31
31
|
decisions.
|
|
32
32
|
- A primitive must not depend on a semantic consumer. Semantic tokens compose
|
|
33
33
|
primitives and other semantic tokens through the
|
|
@@ -71,7 +71,10 @@ construction and owner code supplies behavior: these are different contracts.
|
|
|
71
71
|
`min-target-inline-size` / `min-target-block-size` lower to. `ads check`
|
|
72
72
|
computes every control's target from its lowered box and hit region
|
|
73
73
|
(24 × 24px) and rejects overlapping neighbouring hit regions
|
|
74
|
-
(`a11y-target-size`; [the guide](GUIDE.md) has the details).
|
|
74
|
+
(`a11y-target-size`; [the guide](GUIDE.md) has the details). A region
|
|
75
|
+
part's own box (`frame: { profile }`) takes the same fields: its hit region
|
|
76
|
+
reaches past its box without moving layout (a menu trigger whose pointer
|
|
77
|
+
area spans the gap to the panel below it).
|
|
75
78
|
|
|
76
79
|
## Paint and effects: 5 roles
|
|
77
80
|
|
|
@@ -84,6 +87,8 @@ construction and owner code supplies behavior: these are different contracts.
|
|
|
84
87
|
| `blur.ads.css` | Nonnegative length | Surface filter/backdrop blur radius | `--surface-backdrop-blur` |
|
|
85
88
|
| `saturation.ads.css` | Nonnegative percentage; `100%` leaves colours unchanged, `0%` is greyscale | A surface's `backdropSaturate`: how vivid what is behind it appears | `--surface-backdrop-saturation` |
|
|
86
89
|
| `brightness.ads.css` | Nonnegative percentage; `100%` leaves the drawing unchanged, lower dims it, `0%` is black | A surface's `brightness` on a visual part: a picture with no dark version, dimmed in the dark theme | `--image-brightness` |
|
|
90
|
+
| `grayscale.ads.css` | Nonnegative percentage; `0%` leaves the drawing's colours, `100%` is fully grey | A surface's `grayscale` on a visual part: colour artwork made quiet, or a logo prepared for inverting on a dark page | `--logo-grey` |
|
|
91
|
+
| `invert.ads.css` | Nonnegative percentage; `0%` leaves the drawing, `100%` inverts its tones | A surface's `invert` on a visual part: dark marks made for a light page shown light on a dark one | `--logo-invert` |
|
|
87
92
|
| `overlap.ads.css` | Nonnegative length | A spacing profile's `overlap`: how far the neighbours of an `inline` or `stack` arrangement overlap, in place of a gap | `--facepile-overlap` |
|
|
88
93
|
| `box-share.ads.css` | Nonnegative percentage of an element's own box on one axis | A spacing profile's `outsetBlock` / `outsetInline`: how far a layered backdrop is drawn past its box, growing with it | `--glow-outset-block` |
|
|
89
94
|
|
|
@@ -190,6 +195,7 @@ zoom and 320 px reflow).
|
|
|
190
195
|
| `border-width`, `focus-offset`, `blur` | `px` | A hairline should stay a hairline |
|
|
191
196
|
| `saturation` | `%` (`100%` unchanged, `0%` greyscale, above `100%` more vivid) | It scales colour, not length |
|
|
192
197
|
| `brightness` | `%` (`100%` unchanged, below dims) | It scales light, not length |
|
|
198
|
+
| `grayscale`, `invert` | `%` (`0%` unchanged, `100%` fully grey or inverted) | They scale tone, not length |
|
|
193
199
|
| `overlap` | `px` or `rem` | It is a share of a neighbour, sized like the neighbour |
|
|
194
200
|
| `box-share` | `%` of the box on that axis | It grows with the box it is a share of |
|
|
195
201
|
| `radius` | `px`, or `%` for a pill or circle | A corner belongs to the box, not to its text |
|