@reqvire-org/ads 0.5.12 → 0.5.14
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 +40 -3
- package/dist/analysis/content-model.mjs +156 -0
- package/dist/analysis/owner-source.mjs +23 -1
- package/dist/check.mjs +1 -0
- package/dist/construction-output.mjs +11 -2
- package/dist/construction-spec.d.mts +45 -8
- package/dist/construction-spec.mjs +22 -12
- package/dist/end-alignment.mjs +9 -4
- package/dist/lowering-layer.mjs +50 -15
- package/dist/lowering-paint.mjs +1 -1
- package/dist/lowering-region-layout.mjs +5 -0
- package/dist/lowering-sequence.mjs +4 -3
- package/dist/measured-geometry.mjs +8 -2
- package/dist/owner-analysis-check.mjs +1 -0
- package/dist/owner-errors.mjs +1 -0
- package/dist/ownership-model.mjs +5 -5
- package/dist/recipe-macro.d.mts +13 -6
- package/dist/recipe-model.mjs +2 -2
- package/dist/region-lowering.mjs +42 -17
- package/dist/showcase/client.bundle.js +46 -46
- package/dist/showcase/http-client.bundle.js +13 -13
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +3 -3
- package/dist/skills/ads-designer/references/behaviors.md +31 -0
- package/dist/skills/ads-designer/references/recipes.md +7 -5
- package/dist/skills/ads-import/references/behaviors.md +31 -0
- package/dist/skills/ads-import/references/recipes.md +7 -5
- package/dist/skills/ads-port/references/behaviors.md +31 -0
- package/dist/skills/ads-port/references/recipes.md +7 -5
- package/dist/token-shapes.mjs +42 -1
- package/docs/ADS.md +3 -2
- package/docs/CHANGELOG.md +130 -18
- package/docs/GUIDE.md +8 -0
- package/docs/LANGUAGE.md +28 -10
- package/docs/MOTION.md +5 -0
- package/docs/PROFILE-KINDS.md +8 -5
- package/docs/RULES.md +9 -4
- package/docs/TOKEN-ROLES.md +1 -1
- package/package.json +1 -1
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: 464 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) | 56 | 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) | 49 | 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. |
|
|
@@ -194,6 +194,7 @@ Rendered markup does not match what its declaration promises. Make the markup ma
|
|
|
194
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` |
|
|
195
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` |
|
|
196
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/sequence-order-unmeasured` | error | A sequence staggered by a measured index (`play: { sequence, orderBy: "<name>" }`, a title's words rising in turn) reads a measured value of the recipe of type `index` (`{ type: "index", property: "sequence-order" }`), which the owner writes on each instance at render: 0, 1, 2… | Declare `measured: { <name>: { type: "index", property: "sequence-order" } }` on the recipe and write each instance's index with `measured.props({ <name>: i })`. | `ads://guides/recipes` |
|
|
197
198
|
| `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
199
|
| `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` |
|
|
199
200
|
| `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` |
|
|
@@ -205,6 +206,7 @@ Rendered markup does not match what its declaration promises. Make the markup ma
|
|
|
205
206
|
| `source/artwork-source-undeclared` | error | Inline artwork renders its bound drawing's SVG through a single `dangerouslySetInnerHTML.__html`. | Render the bound drawing's SVG text with a single `__html` property on the visual part. | `ads://guides/branding`, `ads://guides/pictograms` |
|
|
206
207
|
| `source/cell-missing-or-repeated` | error | Each declared grid cell renders exactly once; a cell declared `required: false` may be absent, and one declared `repeat: true` (or auto-placed at every tier) renders any number of times. | Render the cell exactly once, declare it `required: false` when it may be absent, or `repeat: true` when it renders once per item of a list. | `ads://guides/layout` |
|
|
207
208
|
| `source/data-theme-mismatch` | error | An element's data-theme matches the theme its construction declares. | Set data-theme to the theme the construction declares. | `ads://guides/tokens` |
|
|
209
|
+
| `source/drawing-read-unbound` | error | A recipe's drawing (`recipe.assets.<part>.source`) is read in the markup of the owner's element that is the part, where ADS inlines the drawing's source. Elsewhere (a helper function that renders markup ADS does not match to the owner) it cannot be inlined, and the emitted owner would read an emptied recipe. | Render the element that shows the drawing in the owner's own markup (the function whose markup holds the recipe's root), or give the helper's markup its own recipe root. | `ads://guides/recipes` |
|
|
208
210
|
| `source/glyph-source-form` | error | A set-bound part renders `dangerouslySetInnerHTML={{ __html: recipe.assets.<part>.source[name] }}`; a reference-bound part renders `{{ __html: glyph.source }}` of the glyph reference it receives. | Render the bound drawing in that exact form; select nothing else with the name or the reference. | `ads://guides/pictograms` |
|
|
209
211
|
| `source/grid-container-missing` | error | A grid in container context (`context: "container"`) responds to the nearest `ads-region` size container, so an owned ancestor in the same owner starts one: a region framed `container: "region"` (a container is element-owned, never a cell's). Without one its tier rules never match and only the smallest tier applies, wherever the component is placed. | Frame an owned ancestor of the grid with `frame: { container: "region" }` (a wrapper whose width is the region the grid should follow), or use `context: "viewport"`. A container a consumer renders around the component, or one inside a public component it is passed to, does not count. | `ads://guides/recipes`, `ads://guides/layout` |
|
|
210
212
|
| `source/intrinsic-alt-missing` | error | Every image states its text alternative; decorative images state it as empty. | Set `alt` to the text alternative, or `alt=""` when the image is decorative. | `ads://guides/branding`, `ads://guides/accessibility` |
|
|
@@ -224,6 +226,7 @@ Rendered markup does not match what its declaration promises. Make the markup ma
|
|
|
224
226
|
| `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` |
|
|
225
227
|
| `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` |
|
|
226
228
|
| `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` |
|
|
229
|
+
| `source/textarea-element-missing` | error | A control frame centres a single line in its minimum height. A multi-line field declares `element: "textarea"`, so its frame keeps the stated insets around its lines instead. | Declare `element: "textarea"` on the part. | `ads://guides/recipes` |
|
|
227
230
|
| `source/visual-binding-count` | error | A visual part binds exactly one declared asset. A control and standalone artwork have one visual part; a region may have several, each with its own binding. | Bind exactly one declared asset to each visual part; in a control or standalone artwork, declare one visual part. | `ads://guides/branding`, `ads://guides/pictograms` |
|
|
228
231
|
|
|
229
232
|
## accessibility-semantics
|
|
@@ -239,6 +242,7 @@ Owned markup or motion lacks required accessible semantics: a text alternative,
|
|
|
239
242
|
| `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` |
|
|
240
243
|
| `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` |
|
|
241
244
|
| `check/a11y-motion-endless` | info | A recipe root, a part or an artwork that plays a repeating sequence whenever it is rendered is noted: motion that starts by itself, runs longer than five seconds and is shown beside other content must be pausable, stoppable or hideable (WCAG 2.2 2.2.2), and the owner has no state to stop this one by. Reduced motion stops it only for users who set that preference. | Play the sequence under an owner state the user can end, or render the part only while the work it stands for is in progress. | `ads://guides/accessibility` |
|
|
245
|
+
| `check/a11y-nesting` | error | An owner's markup follows HTML's content model: no flow content inside phrasing-only elements, no press target inside another, and list items, table rows and cells in their list, table and row. | Use an element whose content model fits (a <div> or a list item for a box of blocks), move the inner control beside the outer one, and put items in their list, rows in their table. | `ads://guides/accessibility` |
|
|
242
246
|
| `check/component-contrast` | error | Text meets WCAG 2.2 AA (4.5:1, or 3:1 where its text profile is provably large) against the backdrop it is rendered on: the nearest opaque background of the elements and owners around it, across files, with translucent backgrounds and known gradients composited, in every theme, brand and condition context. A public component is also placed by applications on the document surface foundation.ads.ts declares. | Choose a surface for the text whose colour contrasts with the surface it is rendered on, render the component on another surface, use large text where 3:1 suffices, or adjust the token in the named context. | `ads://guides/accessibility`, `ads://guides/tokens` |
|
|
243
247
|
| `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` |
|
|
244
248
|
| `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` |
|
|
@@ -275,6 +279,7 @@ Owned markup or motion lacks required accessible semantics: a text alternative,
|
|
|
275
279
|
| `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` |
|
|
276
280
|
| `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` |
|
|
277
281
|
| `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` |
|
|
282
|
+
| `source/invalid-nesting` | error | An owner's markup follows HTML's content model: an element that takes phrasing content only (a span, a paragraph, a button, a label, a heading) holds no flow content (a div, a list, a paragraph, a heading); a link or a button holds no other link, button or form control; a list item sits in a list, a table row in a table, a cell in a row. A transparent element (a link) takes its parent's model. Browsers repair such markup differently, and assistive technology reads what they repaired. | Use an element whose content model fits: a <div> (or a list item) for a box that holds blocks, a <span> inside phrasing content; move the second control out of the link or button beside it; put list items in a list and cells in a row. | `ads://guides/accessibility` |
|
|
278
283
|
| `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` |
|
|
279
284
|
| `source/layer-open-attribute` | error | A modal sheet is opened with `showModal()`, never rendered with `open`: an `open` attribute gives a non-modal dialog and a server render the client cannot make modal. | Render the dialog closed and open it with `showModal()` from an effect or handler; mirror the native state in owner state. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
280
285
|
| `source/pointer-transparent-interactive` | error | `pointerEvents: "none"` is for decorative overlays: never on a focusable element, and only on markup hidden from assistive technology (`aria-hidden`) or free of interactive content. | Remove `pointerEvents` from the interactive element, or move it to a decorative `aria-hidden` overlay. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
@@ -334,7 +339,7 @@ A value has the wrong kind, role or range for where it is used. Choose one of th
|
|
|
334
339
|
| `construction/profile-field-unsupported` | error | A profile field holds a value the construction can lower. | Use a value this construction can lower. | `ads://guides/recipes` |
|
|
335
340
|
| `construction/profile-kind` | error | A construction references a profile of the kind its field requires. | Reference a profile of the required kind. | `ads://guides/recipes` |
|
|
336
341
|
| `construction/pseudo-surface-unsupported` | error | A pseudo-element surface sets exactly one field: a placeholder's text colour (`color`), or a progress bar's fill (`background`). Other paints, borders and effects of a pseudo-element are not supported. | Treat the pseudo-element with a surface profile that sets only that field: `color` for a placeholder, `background` for a progress fill. | `ads://guides/recipes` |
|
|
337
|
-
| `construction/sequence-not-seamless` | error | A looping sequence ends where it starts: its step at 100 states the same values as its step at 0, so the loop has no jump. A sequence that should run forward then backward declares `repeat: "alternate"`; one that plays one time declares `repeat: "once"`. | Make the step at 100 state the values of the step at 0, or declare `repeat: "alternate"` or `repeat: "once"` in the profile. | `ads://guides/recipes` |
|
|
342
|
+
| `construction/sequence-not-seamless` | error | A looping sequence ends where it starts: its step at 100 states the same values as its step at 0, so the loop has no jump. A sequence that should run forward then backward declares `repeat: "alternate"`; one that starts over from its first step by design (a pulse that grows and fades out) declares `repeat: "restart"`; one that plays one time declares `repeat: "once"`. | Make the step at 100 state the values of the step at 0, or declare `repeat: "restart"` (a pulse that starts over), `repeat: "alternate"` or `repeat: "once"` in the profile. | `ads://guides/recipes` |
|
|
338
343
|
| `construction/sequence-stagger-missing` | error | A part's `order` starts it that many staggers after the first, so parts that share a sequence run in turn. The stagger is the sequence profile's `stagger` (role `duration`). | Give the sequence profile a `stagger` token, or remove `order` from the part. | `ads://guides/recipes` |
|
|
339
344
|
| `construction/sequence-step-field` | error | A step of a sequence states what the part looks like there: `opacity`, travel (`translateInline`, `translateBlock`), one scale (`scale`, or `scaleInline` or `scaleBlock` for one axis) and `rotate`, each from a token of its role. A step states at least one, and one scale. | State one of the step fields with a token of its role (opacity, motion-distance, motion-scale, motion-angle), and at most one scale per step. | `ads://guides/recipes` |
|
|
340
345
|
| `construction/sequence-steps-invalid` | error | A sequence profile has at least two steps, each at a distinct whole percentage of the run, from 0 to 100. | Give the sequence a step at 0 and a step at 100, and distinct whole percentages between them. | `ads://guides/recipes` |
|
package/docs/TOKEN-ROLES.md
CHANGED
|
@@ -113,7 +113,7 @@ construction and owner code supplies behavior: these are different contracts.
|
|
|
113
113
|
| Exact filename | Value contract | Permitted purpose / consumer | Specimen |
|
|
114
114
|
| --- | --- | --- | --- |
|
|
115
115
|
| `font-family.ads.css` | Ordered named/generic family list | Text font selection and fallback | `--font-ui` |
|
|
116
|
-
| `font-size.ads.css` | Positive length in `rem` or `em` (or an expression containing them) | Text size with user scaling preserved; a px value is `a11y-text-resize` | `--label-size-md` |
|
|
116
|
+
| `font-size.ads.css` | Positive length in `rem` or `em` (or an expression containing them), or a fluid size `clamp(<rem>, <rem> + <vw>, <rem>)` whose largest bound is at most 2.5 times its smallest | Text size with user scaling preserved; a px value, or a viewport share without such bounds, is `a11y-text-resize` | `--label-size-md`, `--hero-title: clamp(1.75rem, 9vw, 3rem)` |
|
|
117
117
|
| `line-height.ads.css` | Positive length in `rem` or `em`, or unitless multiplier | Line envelope; a multiplier uses the selected font size; a px length is `a11y-text-resize` | `--label-line-md` |
|
|
118
118
|
| `font-weight.ads.css` | Number in [1, 1000] | Text weight, subject to actual font support | `--weight-emphasis` |
|
|
119
119
|
| `font-stretch.ads.css` | Positive percentage | Text font width, subject to actual font support | `--font-width-ui` |
|