@reqvire-org/ads 0.5.1 → 0.5.3
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 +143 -51
- package/dist/analysis/composition-axes.mjs +48 -0
- package/dist/analysis/construction-memo.mjs +38 -0
- package/dist/analysis/context.mjs +19 -0
- package/dist/analysis/design-reads.mjs +177 -0
- package/dist/analysis/design-usage.mjs +4 -20
- package/dist/analysis/factored-classes.mjs +90 -0
- package/dist/analysis/helpers.mjs +5 -7
- package/dist/analysis/mock-check.mjs +4 -5
- package/dist/analysis/native-project.mjs +12 -0
- package/dist/analysis/owner-accessibility.mjs +4 -4
- package/dist/analysis/owner-analysis-cache.mjs +86 -23
- package/dist/analysis/owner-analysis-key.mjs +42 -10
- package/dist/analysis/owner-choices.mjs +56 -7
- package/dist/analysis/owner-composition.mjs +179 -45
- package/dist/analysis/owner-reuse.mjs +8 -6
- package/dist/analysis/owner-source.mjs +304 -110
- package/dist/analysis/scenario-keys.mjs +10 -7
- package/dist/analysis/service.mjs +50 -3
- package/dist/analysis/standalone.mjs +7 -4
- package/dist/analysis/syntax.mjs +59 -1
- package/dist/analysis/worker-protocol.mjs +14 -2
- package/dist/analysis/worker.mjs +32 -10
- package/dist/architecture-report.mjs +26 -0
- package/dist/asset-view-facts.mjs +16 -2
- package/dist/boundaries.mjs +26 -10
- package/dist/bun-compiler.mjs +2 -2
- package/dist/check-service.mjs +29 -17
- package/dist/check.mjs +13 -6
- package/dist/cli.mjs +1 -1
- package/dist/composed-contrast.mjs +143 -62
- package/dist/composed-keyline.mjs +2 -2
- package/dist/config.mjs +2 -1
- package/dist/construction-output.mjs +9 -3
- package/dist/construction-spec.d.mts +145 -31
- package/dist/construction-spec.mjs +204 -74
- package/dist/corner-overpaint.mjs +20 -7
- package/dist/derived-states.mjs +182 -0
- package/dist/design-foundation.mjs +16 -0
- package/dist/design-inputs.mjs +18 -3
- package/dist/design-system-closure.mjs +12 -7
- package/dist/design-usage.mjs +2 -8
- package/dist/emit/contract.mjs +24 -5
- package/dist/emit/emission.mjs +6 -9
- package/dist/emit/integrity.mjs +8 -2
- package/dist/emit/output-watch.mjs +120 -0
- package/dist/emit/owner-emission-cache.mjs +4 -4
- package/dist/emit/preview-emitter.mjs +4 -2
- package/dist/emit/preview-tree.mjs +1 -1
- package/dist/emit/service.mjs +8 -2
- package/dist/finding-rules.mjs +3 -0
- package/dist/form-states.mjs +8 -0
- package/dist/frame-regions.mjs +29 -9
- package/dist/grid-lowering.mjs +3 -1
- package/dist/hover-geometry.mjs +15 -0
- package/dist/input-digests.mjs +17 -10
- package/dist/linaria/delivery.mjs +2 -0
- package/dist/lowering-enter.mjs +6 -6
- package/dist/lowering-properties.mjs +5 -0
- package/dist/lowering-region-layout.mjs +7 -2
- package/dist/lowering-session.mjs +10 -0
- package/dist/mcp/build-status.mjs +9 -1
- package/dist/mcp/compiler-channel.mjs +11 -4
- package/dist/mcp/mutations.mjs +1 -0
- package/dist/mcp/preview-http.bundle.js +1 -1
- package/dist/mcp/preview-watch.mjs +2 -1
- package/dist/mcp/preview-widget.bundle.js +1 -1
- package/dist/mcp/server-observation.mjs +6 -4
- package/dist/mcp/server-project.mjs +4 -1
- package/dist/motion-model.mjs +1 -1
- package/dist/owner-analysis-check.mjs +23 -6
- package/dist/owner-errors.mjs +6 -3
- package/dist/owner-lowering.mjs +78 -13
- package/dist/owner-scenarios.mjs +6 -23
- package/dist/ownership-model.mjs +24 -8
- package/dist/paint-contrast.mjs +6 -0
- package/dist/placeholder-contrast.mjs +17 -1
- package/dist/platform-features.mjs +10 -1
- package/dist/profile-macro.d.mts +7 -0
- package/dist/profile-view-facts.mjs +1 -1
- package/dist/recipe-macro.d.mts +103 -40
- package/dist/recipe-model.mjs +18 -13
- package/dist/region-lowering.mjs +266 -123
- package/dist/render-audit/layout-shift.page.mjs +24 -0
- package/dist/render-audit/render-states.mjs +122 -1
- package/dist/render-audit/render-states.page.mjs +140 -0
- package/dist/render-audit/worker.mjs +18 -3
- package/dist/render-audit.mjs +114 -1
- package/dist/role-vocabulary.d.mts +9 -0
- package/dist/role-vocabulary.mjs +16 -1
- package/dist/runtime-paint-contrast.mjs +5 -2
- package/dist/scenarios-compiler.mjs +20 -6
- package/dist/showcase/assets-view.mjs +29 -13
- package/dist/showcase/client.bundle.js +50 -50
- package/dist/showcase/http-client.bundle.js +15 -15
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +5 -5
- package/dist/skills/ads-designer/references/accessibility.md +10 -4
- package/dist/skills/ads-designer/references/branding.md +13 -3
- package/dist/skills/ads-designer/references/contracts.md +5 -2
- package/dist/skills/ads-designer/references/design-data.md +13 -7
- package/dist/skills/ads-designer/references/layout.md +12 -4
- package/dist/skills/ads-designer/references/motion.md +11 -2
- package/dist/skills/ads-designer/references/recipes.md +49 -15
- package/dist/skills/ads-import/references/contracts.md +5 -2
- package/dist/skills/ads-import/references/design-data.md +13 -7
- package/dist/skills/ads-import/references/layout.md +12 -4
- package/dist/skills/ads-import/references/recipes.md +49 -15
- package/dist/skills/ads-migrate/SKILL.md +2 -0
- package/dist/skills/ads-migrate/references/0.5.1-to-0.5.2.md +185 -0
- package/dist/skills/ads-migrate/references/0.5.2-to-0.5.3.md +71 -0
- package/dist/skills/ads-port/references/contracts.md +5 -2
- package/dist/skills/ads-port/references/design-data.md +13 -7
- package/dist/skills/ads-port/references/layout.md +12 -4
- package/dist/skills/ads-port/references/recipes.md +49 -15
- package/dist/spatial-model.mjs +2 -2
- package/dist/surface-contrast.mjs +7 -2
- package/dist/surface-effects.mjs +5 -3
- package/dist/target-size.mjs +21 -3
- package/dist/task-cache.mjs +8 -18
- package/dist/validation-checks.mjs +1 -1
- package/docs/ADS.md +9 -3
- package/docs/ARCHITECTURE.md +96 -30
- package/docs/CACHING.md +152 -24
- package/docs/CHANGELOG.md +307 -23
- package/docs/GUIDE.md +109 -20
- package/docs/LANGUAGE.md +262 -117
- package/docs/MCP.md +5 -1
- package/docs/MOTION.md +15 -4
- package/docs/PROFILE-KINDS.md +54 -4
- package/docs/RULES.md +34 -25
- package/docs/TOKEN-ROLES.md +7 -1
- package/package.json +1 -1
- package/dist/analysis/prose-owners.mjs +0 -57
- package/dist/prose-model.d.mts +0 -81
- package/dist/prose-model.mjs +0 -101
|
@@ -32,9 +32,9 @@ The `a11y-*` rules check tokens, profiles and constructions (WCAG 2.2 AA):
|
|
|
32
32
|
|
|
33
33
|
| Rule | What it requires | WCAG |
|
|
34
34
|
|---|---|---|
|
|
35
|
-
| `a11y-target-size` | Every control and `frame: "control"` part is at least 24 × 24px, computed from its lowered box in every theme, brand and condition, a frame's `min-target-inline-size`/`min-target-block-size` hit area included; neighbouring hit areas never overlap | 2.5.8 |
|
|
35
|
+
| `a11y-target-size` | Every control and `frame: "control"` part is at least 24 × 24px, computed from its lowered box in every theme, brand and condition, a frame's `min-target-inline-size`/`min-target-block-size` hit area included; a smaller part of a stack or inline arrangement passes by the spacing exception when 24px circles centred on it and its neighbouring targets keep clear; neighbouring hit areas never overlap | 2.5.8 |
|
|
36
36
|
| `a11y-focus` | Every focus profile's width is at least 2px; the default indicator `foundation({ focus })` has 3:1 on the document surface | 2.4.7, 1.4.11 |
|
|
37
|
-
| `surface-contrast` | A surface profile setting `color` and `background` reaches 4.5:1 in every context, or 3:1 where every use of it is large text or artwork (a visual part, a text-less control), and has no minimum where every use is an `aria-hidden` visual part; a surface for disabled controls declares `state: "inactive"` (no minimum) and is selected only under `:disabled` or `[aria-disabled="true"]` (`construction/inactive-surface-active`) | 1.4.3 |
|
|
37
|
+
| `surface-contrast` | A surface profile setting `color` and `background` reaches 4.5:1 in every context, or 3:1 where every use of it is large text or artwork (a visual part, a text-less control), and has no minimum where every use is an `aria-hidden` visual part, or where its `color` is fully transparent (a glyph shown only on hover: it draws nothing at rest, and the states that show it keep their minimum); a surface for disabled controls declares `state: "inactive"` (no minimum) and is selected only under `:disabled` or `[aria-disabled="true"]` (`construction/inactive-surface-active`) | 1.4.3 |
|
|
38
38
|
| `a11y-text-resize` | `font-size` and length `line-height` tokens in `rem` or `em` | 1.4.4 |
|
|
39
39
|
| `a11y-icon-label` | Every control choice without a text part has `aria-label`, `aria-labelledby` or `title` | 4.1.2 |
|
|
40
40
|
| `owner-analysis` (`pressed-state-mismatch`) | A choice pairing `aria-pressed` with artwork that declares a `selected` state draws `selected` exactly when pressed; a value analysis cannot pair is `review/pressed-state-unresolved` | 4.1.2 |
|
|
@@ -45,8 +45,7 @@ The `a11y-*` rules check tokens, profiles and constructions (WCAG 2.2 AA):
|
|
|
45
45
|
|
|
46
46
|
Values ADS cannot evaluate are review items (`a11y-target-size-unresolved`,
|
|
47
47
|
`a11y-focus-unresolved`, `component-contrast-unresolved`: a wrapper ADS does not
|
|
48
|
-
analyze, a same-file component that does not render its children,
|
|
49
|
-
plain module's markup, a link or control without its own surface, an out-of-flow element
|
|
48
|
+
analyze, a same-file component that does not render its children, a link or control without its own surface, an out-of-flow element
|
|
50
49
|
without a background, opacity, an unknown image). A helper component in an owner's file is
|
|
51
50
|
followed only when it passes `children` through; for any other, give the text it renders
|
|
52
51
|
an opaque surface of its own, or make the helper a children wrapper or an owner. A native
|
|
@@ -62,6 +61,13 @@ suffices, or adjust the token in the named context. An application's own coloure
|
|
|
62
61
|
container is outside the design system: ADS checks a public component on the document
|
|
63
62
|
surface the foundation declares.
|
|
64
63
|
|
|
64
|
+
The render audit measures every owner state a recipe declares by itself, on any
|
|
65
|
+
scenario that renders the owner: do not add scenario states only so the audit
|
|
66
|
+
sees a state whose markup is the same as at rest. Render each variant of an
|
|
67
|
+
owner somewhere (a construction no scenario renders is a
|
|
68
|
+
`render-audit-construction-unrendered` review item), and show a state in a
|
|
69
|
+
scenario when the component renders different content in it.
|
|
70
|
+
|
|
65
71
|
The render audit (`ads audit`, validation and acceptance) renders each scenario once
|
|
66
72
|
with the reader's text settings and reports only what rest does not show:
|
|
67
73
|
|
|
@@ -105,15 +105,25 @@ part (`tick: { selector, kind: "visual", required: true, asset: "tick", visual:
|
|
|
105
105
|
"glyph-md" }`) and uses the same recipe's `parts.tick` class and
|
|
106
106
|
`assets.tick.source`; a second recipe is for artwork that is a choice.
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
Standalone artwork (a recipe that is only a visual part, such as an Icon) takes
|
|
109
|
+
a colour-only `surface` on its root: the drawing's own tone, so a slot that
|
|
110
|
+
holds the icon sets no colour.
|
|
111
|
+
|
|
112
|
+
A visual part is bound to exactly one declared asset; a control and standalone
|
|
113
|
+
artwork have one visual part, and a region may have several, each bound by its
|
|
114
|
+
own name (`recipe.parts.<name>`, `recipe.assets.<name>.source`)
|
|
109
115
|
(`visual-binding-count`, `artwork-binding-missing`, `asset-unknown`). Inline artwork
|
|
110
116
|
renders its bound drawing through a single `dangerouslySetInnerHTML.__html`
|
|
111
117
|
(`artwork-source-undeclared`) and the drawing its binding selects
|
|
112
118
|
(`artwork-mismatch`). An image visual part contains exactly one `<img>` whose `src`
|
|
113
119
|
comes from the bound asset and which states its text alternative, empty when
|
|
114
120
|
decorative (`intrinsic-image-count`, `intrinsic-src-missing`,
|
|
115
|
-
`intrinsic-alt-missing`). Artwork is painted
|
|
116
|
-
|
|
121
|
+
`intrinsic-alt-missing`). Artwork is painted as its asset declares: a control may
|
|
122
|
+
hold a product's logo in its own colours (`paint: "intrinsic"`) or a drawing with
|
|
123
|
+
several paints (`paint: "slots"`), of which at least one must reach 3:1 on the
|
|
124
|
+
control's own background in every theme, brand and state
|
|
125
|
+
(`artwork-paint-contrast-insufficient`). The control still needs its label or
|
|
126
|
+
accessible name: a logo is not a name.
|
|
117
127
|
|
|
118
128
|
## Aligning artwork with text
|
|
119
129
|
|
|
@@ -67,8 +67,11 @@ An owner styles only its own elements, and only through its recipe:
|
|
|
67
67
|
presence (`item.sub && <span>`); no child component is needed for that. Application text selects markup by presence only
|
|
68
68
|
(`text-content-read`). An optional object, callback or node prop selects by whether
|
|
69
69
|
it is given, a node only through `!== undefined` (`domain-not-finite` otherwise).
|
|
70
|
-
- Artwork is painted
|
|
71
|
-
(`
|
|
70
|
+
- Artwork is painted as its asset declares, in a control as anywhere: by the
|
|
71
|
+
text colour (`foreground`), by its paint slots, or in its own colours
|
|
72
|
+
(`intrinsic`, a product's logo). In a control, slot artwork needs one paint at
|
|
73
|
+
3:1 on the control's background (`artwork-paint-contrast-insufficient`); see
|
|
74
|
+
`ads://guides/branding`.
|
|
72
75
|
|
|
73
76
|
A guarded `className` prop for placement is a public API decision of the owner;
|
|
74
77
|
it never lets a caller override the recipe's interior.
|
|
@@ -131,7 +131,7 @@ By role: `font-size` in `rem`; `line-height` unitless; `spacing`, `content-gap`,
|
|
|
131
131
|
`frame-inset` and `control-min-size` in `rem` when they hold or separate text
|
|
132
132
|
and `px` when they should not move; `visual-size` in `rem` for icons and `px`
|
|
133
133
|
for pictures; `border-width`, `focus-offset`, `blur` and `radius` in `px` (`%`
|
|
134
|
-
for a pill); `saturation` in `%` (`100%` unchanged); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
134
|
+
for a pill); `saturation` and `brightness` in `%` (`100%` unchanged); `box-share` in `%` of the box (a backdrop's outset that grows with it); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
135
135
|
bound follows the reader's text size). Authors never write
|
|
136
136
|
`lh`, container units or `fr`: ADS emits `lh`, and grids express the others.
|
|
137
137
|
The full tables are in the token-role reference (`docs/TOKEN-ROLES.md`, *Units*).
|
|
@@ -240,6 +240,14 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
|
|
|
240
240
|
|
|
241
241
|
## Colours that depend on their surroundings
|
|
242
242
|
|
|
243
|
+
- **The container decides** (links and icons in a tinted banner, a heading's
|
|
244
|
+
links, a selected row's cells, icons and checkbox, actions on a dark card):
|
|
245
|
+
the container's surface profile provides the roles its children read,
|
|
246
|
+
`provides: { "--link-ink": "--on-warning", "--icon-ink": "--on-warning" }`;
|
|
247
|
+
on a selected row, the state's surface provides them while the state holds.
|
|
248
|
+
The children keep one design and need no prop. Key and value are paint
|
|
249
|
+
tokens; never provide a token the surface itself reads. Composed contrast
|
|
250
|
+
proves the children's text with the provided values on the container.
|
|
243
251
|
- **Inverted regions** (a dark footer or card on a light page): declare
|
|
244
252
|
`sections: true` in `foundation()` and put `data-theme="dark"` on the region.
|
|
245
253
|
Keep writing contexts on `:root` only; emission applies them to sections. The nearest `data-theme` and the nearest
|
|
@@ -249,15 +257,13 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
|
|
|
249
257
|
section's values. Contrast is already proven in every context, so a section
|
|
250
258
|
needs no extra check. A section switches whole themes/brands only; a recipe's
|
|
251
259
|
own token declaration on the section element wins.
|
|
252
|
-
- **On-image
|
|
253
|
-
the child a closed choice the caller sets, such as `tone?: "default" |
|
|
260
|
+
- **On-image controls** (a button over a photo, a background the design system
|
|
261
|
+
cannot know): give the child a closed choice the caller sets, such as `tone?: "default" |
|
|
254
262
|
"on-dark"` mapping to a precompiled recipe with its own surface profile
|
|
255
263
|
(Spectrum's `staticColor`). Use static paints (one `:root` value) for it, so
|
|
256
264
|
the pair is proven and does not change with the page's theme.
|
|
257
|
-
-
|
|
258
|
-
|
|
259
|
-
threaded through each child, or the surface-context construct that is planned.
|
|
260
|
-
Do not invent a theme per state. Details and limits: the ADS tool guide,
|
|
265
|
+
- Do not invent a theme per state, or a `tone` prop for a container the design
|
|
266
|
+
system owns. Details and limits: the ADS tool guide,
|
|
261
267
|
*Colours that depend on their surroundings*.
|
|
262
268
|
|
|
263
269
|
## Colors in Canvas, WebGL and SVG renderers
|
|
@@ -67,7 +67,11 @@ media queries and track lists, so a context cannot change them
|
|
|
67
67
|
| A region that adapts to the space it gets, not the window | `context: "container"` inside an owned ancestor framed `container: "region"` |
|
|
68
68
|
| Children stacked or in a row inside a component | `layout: "stack"` or `"inline"` |
|
|
69
69
|
| Several parts painted in one area | `layout: "layered"` |
|
|
70
|
-
| A
|
|
70
|
+
| A jump target (a section or heading with an id) under a sticky header | `anchorClear: { slot: "layer", field: "clearBlockStart" }` to land right under the header, or `{ slot: "spacing", field: "anchorGap" }` for the target's own distance (level with a sticky side column); never a document-wide scroll padding in the application |
|
|
71
|
+
| Neighbours that overlap (a pile of faces, stacked cards) | `overlap: { slot: "spacing", field: "overlap" }` on the `inline` or `stack` arrangement, from an `overlap` token; never negative margins of your own |
|
|
72
|
+
| An element that changes size, padding or spacing under a state | a `when` entry selecting another profile: `frame: { profile }` on the element, `spacing: "<profile>"` on its arrangement; `geometryTransition` to animate it. Give a `:hover` state a focus or attribute state of the same geometry |
|
|
73
|
+
| A part that appears in a row by growing from nothing (a counter, row actions) | `collapsed: true` on the part and `collapsed: false` in the state's `when` entry (or the reverse); its box goes on the element it holds |
|
|
74
|
+
| A decorative backdrop larger than its box (a glow) | a first part of a `layered` parent with `outset: { block, inline }` (spacing fields; a `box-share` token in the profile's `outsetBlock`/`outsetInline` makes it a share of the box) and a gradient surface |
|
|
71
75
|
| A panel that covers the content | a top-layer root (`layer`), or a cell stacked by the profile's `overlayLayer` |
|
|
72
76
|
|
|
73
77
|
Typical defaults, not rules: headers and toolbars are fluid in width; side panels
|
|
@@ -166,9 +170,13 @@ until that owner is fixed.
|
|
|
166
170
|
so a visible tier keeps the element's own display); `visible: true` shows it
|
|
167
171
|
again from a later tier. Hiding a part while a named condition holds is the
|
|
168
172
|
part's own `at: { "<condition>": { visible } }`, below.
|
|
169
|
-
- Each declared cell renders exactly once (`cell-missing-or-repeated`)
|
|
170
|
-
one owned element or public component
|
|
171
|
-
|
|
173
|
+
- Each declared cell renders exactly once (`cell-missing-or-repeated`) unless it
|
|
174
|
+
says otherwise. A cell names one owned element or public component.
|
|
175
|
+
`required: false` lets it be absent (keep it in auto rows, or its pinned row
|
|
176
|
+
stays empty: `review/optional-cell-row`). `repeat: true` renders it once per
|
|
177
|
+
list item: its instances flow (`start: "auto"` implied) over a numeric span or
|
|
178
|
+
`"full"`, with no start line, `end` or `row`. Several instances may also share
|
|
179
|
+
a cell that auto-places (`start: "auto"`) at every tier.
|
|
172
180
|
- An element has at most one placement (`placement-repeated`), applied in the
|
|
173
181
|
returned JSX (`placement-statement`), and a placed element carries its own recipe
|
|
174
182
|
styling (`placement-without-root`). One element carries one part or cell marker.
|
|
@@ -71,6 +71,11 @@ behind a modal (about 700 ms), and easing roles for standard moves, entering and
|
|
|
71
71
|
exiting, each in an everyday and a strong form. Owners consume the profile through
|
|
72
72
|
their recipe's motion slot: parts declare channels in `transition`, `when` supplies
|
|
73
73
|
typed endpoints such as `scale: { slot: "motion", field: "scale" }`, and
|
|
74
|
+
`geometryTransition: { channels, motion }` animates geometry a state selects
|
|
75
|
+
(`size`, `inset`, `gap`, `radius`, `border-width`, and `overlap` for an element's
|
|
76
|
+
own position in a pile): see the layout reference. It is instant under reduced
|
|
77
|
+
motion.
|
|
78
|
+
|
|
74
79
|
`paintTransition` interpolates named paint channels between a base surface and its
|
|
75
80
|
state surfaces.
|
|
76
81
|
|
|
@@ -87,7 +92,10 @@ Define motion in the recipe, control it in script. A component never calls
|
|
|
87
92
|
what the recipe declared, and uses `element.getAnimations()` (`finished`,
|
|
88
93
|
`cancel()`, `pause()`, `currentTime`) or the animation events to wait for,
|
|
89
94
|
cancel or seek it. A fade between states is the `opacity` channel of
|
|
90
|
-
`paintTransition`; a one-axis scale is `scaleInline` or `scaleBlock
|
|
95
|
+
`paintTransition`; a one-axis scale is `scaleInline` or `scaleBlock`; a turn in
|
|
96
|
+
place under a state (a plus that becomes a cross while its panel is open) is
|
|
97
|
+
`rotate`, from the motion profile's `angle`, kept under reduced motion without
|
|
98
|
+
its animation.
|
|
91
99
|
|
|
92
100
|
A fixed series of steps (a blink, dots pulsing in turn, a shake) is a
|
|
93
101
|
`sequence` profile (`steps: [{ at: 0, opacity: "--dim" }, { at: 50, … }, { at:
|
|
@@ -102,7 +110,8 @@ can stop it. A size the owner measures animates with `motion` on its
|
|
|
102
110
|
An entrance on first render is `enter` on a recipe root or a region part:
|
|
103
111
|
`enter: { from: { surface: "entering", translate: { slot: "motion", field: "distance" } }, motion: "enter-motion" }`.
|
|
104
112
|
`from.surface` is a surface profile with only `opacity` and/or `blur`; at most
|
|
105
|
-
one movement (`translate` on the block axis, `
|
|
113
|
+
one movement (`translate` on the block axis, `translateInline` on the inline
|
|
114
|
+
axis and mirrored right to left, `scale` or `rotate`) is read from
|
|
106
115
|
the entrance's motion profile, which needs a duration, an easing and
|
|
107
116
|
`reduced: "static"`. Stagger parts with motion profiles that differ in `delay`.
|
|
108
117
|
ADS emits `@starting-style` and a transition, no script; reduced motion shows
|
|
@@ -150,24 +150,55 @@ a recipe never creates a state machine.
|
|
|
150
150
|
surface and its state surfaces, timed by a motion profile with a `static`
|
|
151
151
|
reduced-motion policy. A channel that does not change, an effect that changes
|
|
152
152
|
without its channel, or a gradient on the element, is rejected.
|
|
153
|
-
- Long-form content (articles, docs, legal text, Markdown or CMS output) is
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
`
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
- Long-form content (articles, docs, legal text, Markdown or CMS output) is
|
|
154
|
+
built from the design system's own components: `Heading`, `Paragraph`,
|
|
155
|
+
`Link`, `List`, `Quote`, `CodeBlock`, `Table` and the inline ones, each a
|
|
156
|
+
normal owner. A pattern places them: a `stack` whose parts are placed
|
|
157
|
+
components (`kind: "component"`, `repeat: true`, `required: false`), in any
|
|
158
|
+
order, with a part's `spaceBefore` / `spaceAfter` for the space around it (a
|
|
159
|
+
heading one `sectionGap` from what precedes it). The content arrives as a
|
|
160
|
+
typed tree (a union of node types) that the pattern renders with a ternary
|
|
161
|
+
chain over `node.type` in its `.map` callback; an inline renderer may render
|
|
162
|
+
itself for nested inline nodes. The project adapts Markdown, HTML (parsed and
|
|
163
|
+
sanitised) or CMS rich text to that tree; never style plain markup by tag and
|
|
164
|
+
never inject an HTML string. A colour that follows the container (a link in a
|
|
165
|
+
heading) is the container surface's `provides`, not a prop on the link. A list
|
|
166
|
+
item keeps its marker: give it no arrangement, and space a nested list with a
|
|
167
|
+
part's `spaceBefore` in its block flow.
|
|
168
|
+
- A colour that depends on where an element sits (links and icons in a tinted
|
|
169
|
+
banner, the cells of a selected row, actions on a dark card) is a contextual
|
|
170
|
+
role: the container's surface profile `provides: { "--link-ink": "--on-warning" }`.
|
|
171
|
+
The children read their own roles and need no prop; composed contrast proves
|
|
172
|
+
their text there. Do not add a `tone` prop for a container's colour; keep
|
|
173
|
+
`tone` for a background the design system cannot know (a photo).
|
|
174
|
+
- `enter: { from: { surface, translate | translateInline | scale | rotate }, motion }` on a root
|
|
165
175
|
or a region part is an entrance on first render: the element starts from a
|
|
166
176
|
surface that states only `opacity` and `blur`, and at most one movement read
|
|
167
177
|
from the entrance's motion profile, then settles. See the motion reference.
|
|
168
178
|
- A part that needs a box of its own without being a control (a disc behind a
|
|
169
179
|
mark, a badge) takes `frame: { profile: "<frame profile>" }`; do not make a
|
|
170
|
-
separate owner only to give an element padding, a border or a size.
|
|
180
|
+
separate owner only to give an element padding, a border or a size. The
|
|
181
|
+
drawn box of a checkbox, radio or switch whose native `<input>` is hidden
|
|
182
|
+
takes `focus: { of: "<the input's part>" }`: the focus profile's outline is
|
|
183
|
+
drawn on the box while the input has keyboard focus. The input's part,
|
|
184
|
+
declared right before the box, takes `drawnBy: "<the box's part>"`: it takes
|
|
185
|
+
no room and lies, invisible, over the box at the box's frame size, so pointer
|
|
186
|
+
and keyboard still reach the real input. A part rendered once per list item
|
|
187
|
+
(`tabs.map(…)`) is declared `repeat: true`: every instance takes the part's
|
|
188
|
+
construction, and `extent: "fill"` shares the row among them. A visual part may sit
|
|
189
|
+
inside such a part: the owner reads it by its name (`recipe.parts.<name>`,
|
|
190
|
+
`recipe.assets.<name>.source`), which one nested part of the recipe has. On a
|
|
191
|
+
visual part the frame's size is the box and the drawing keeps its visual
|
|
192
|
+
profile's size, centred in it.
|
|
193
|
+
- A switch, a radio's dot or a slider's thumb is a decorative box of its control:
|
|
194
|
+
a part without a `kind`, with `frame: { profile }` and a `surface`, that takes
|
|
195
|
+
another surface or `translateInline` under the control's state
|
|
196
|
+
(`&[aria-checked="true"]`). Keep it empty and `aria-hidden`; name the control
|
|
197
|
+
on its root. Do not rebuild the control as a region to get a second element.
|
|
198
|
+
- A native `<progress>` is styled as a part: its own surface is the track and
|
|
199
|
+
`pseudo: { progressValue: { surface } }` (a background-only surface) the
|
|
200
|
+
fill, proven at 3:1 against the track. Do not draw a measured fill beside a
|
|
201
|
+
hidden native element.
|
|
171
202
|
- A border whose sides differ is stated in the profiles, not the recipe: the
|
|
172
203
|
frame's `borderWidth` plus a side's own (`borderInlineStartWidth`), the
|
|
173
204
|
surface's `borderColor` plus a side's own (`borderInlineStartColor`). Sides
|
|
@@ -177,7 +208,10 @@ a recipe never creates a state machine.
|
|
|
177
208
|
with a class.
|
|
178
209
|
- Surface effects are surface-profile fields, composed in a fixed order:
|
|
179
210
|
`blur` → `filter: blur()`; `backdropBlur` and `backdropSaturate` (role
|
|
180
|
-
`saturation`, a percentage) → `backdrop-filter: blur() saturate()
|
|
211
|
+
`saturation`, a percentage) → `backdrop-filter: blur() saturate()`;
|
|
212
|
+
`brightness` (role `brightness`, a percentage, on a visual part only) →
|
|
213
|
+
`filter: brightness()`: a picture with no dark version takes a token that
|
|
214
|
+
is `100%` in the light theme and lower in the dark one. For
|
|
181
215
|
shadows choose by meaning: `boxShadow` for a box (card, panel, control);
|
|
182
216
|
`shapeShadow` on a visual part whose drawing is not its box (transparent
|
|
183
217
|
image, artwork); `groupShadow` on a container when everything inside should
|
|
@@ -324,7 +358,7 @@ text part breaks one way, set by one `wrap` field:
|
|
|
324
358
|
keeps it reachable, which analysis cannot see).
|
|
325
359
|
- `textEdge` trims a text part's box to the edges it names (`["cap",
|
|
326
360
|
"alphabetic"]`); `textAlign` sets
|
|
327
|
-
its alignment. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
361
|
+
its alignment, on a control's label too. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
328
362
|
spacing in a browser without them.
|
|
329
363
|
|
|
330
364
|
<a id="assets"></a>
|
|
@@ -67,8 +67,11 @@ An owner styles only its own elements, and only through its recipe:
|
|
|
67
67
|
presence (`item.sub && <span>`); no child component is needed for that. Application text selects markup by presence only
|
|
68
68
|
(`text-content-read`). An optional object, callback or node prop selects by whether
|
|
69
69
|
it is given, a node only through `!== undefined` (`domain-not-finite` otherwise).
|
|
70
|
-
- Artwork is painted
|
|
71
|
-
(`
|
|
70
|
+
- Artwork is painted as its asset declares, in a control as anywhere: by the
|
|
71
|
+
text colour (`foreground`), by its paint slots, or in its own colours
|
|
72
|
+
(`intrinsic`, a product's logo). In a control, slot artwork needs one paint at
|
|
73
|
+
3:1 on the control's background (`artwork-paint-contrast-insufficient`); see
|
|
74
|
+
`ads://guides/branding`.
|
|
72
75
|
|
|
73
76
|
A guarded `className` prop for placement is a public API decision of the owner;
|
|
74
77
|
it never lets a caller override the recipe's interior.
|
|
@@ -131,7 +131,7 @@ By role: `font-size` in `rem`; `line-height` unitless; `spacing`, `content-gap`,
|
|
|
131
131
|
`frame-inset` and `control-min-size` in `rem` when they hold or separate text
|
|
132
132
|
and `px` when they should not move; `visual-size` in `rem` for icons and `px`
|
|
133
133
|
for pictures; `border-width`, `focus-offset`, `blur` and `radius` in `px` (`%`
|
|
134
|
-
for a pill); `saturation` in `%` (`100%` unchanged); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
134
|
+
for a pill); `saturation` and `brightness` in `%` (`100%` unchanged); `box-share` in `%` of the box (a backdrop's outset that grows with it); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
135
135
|
bound follows the reader's text size). Authors never write
|
|
136
136
|
`lh`, container units or `fr`: ADS emits `lh`, and grids express the others.
|
|
137
137
|
The full tables are in the token-role reference (`docs/TOKEN-ROLES.md`, *Units*).
|
|
@@ -240,6 +240,14 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
|
|
|
240
240
|
|
|
241
241
|
## Colours that depend on their surroundings
|
|
242
242
|
|
|
243
|
+
- **The container decides** (links and icons in a tinted banner, a heading's
|
|
244
|
+
links, a selected row's cells, icons and checkbox, actions on a dark card):
|
|
245
|
+
the container's surface profile provides the roles its children read,
|
|
246
|
+
`provides: { "--link-ink": "--on-warning", "--icon-ink": "--on-warning" }`;
|
|
247
|
+
on a selected row, the state's surface provides them while the state holds.
|
|
248
|
+
The children keep one design and need no prop. Key and value are paint
|
|
249
|
+
tokens; never provide a token the surface itself reads. Composed contrast
|
|
250
|
+
proves the children's text with the provided values on the container.
|
|
243
251
|
- **Inverted regions** (a dark footer or card on a light page): declare
|
|
244
252
|
`sections: true` in `foundation()` and put `data-theme="dark"` on the region.
|
|
245
253
|
Keep writing contexts on `:root` only; emission applies them to sections. The nearest `data-theme` and the nearest
|
|
@@ -249,15 +257,13 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
|
|
|
249
257
|
section's values. Contrast is already proven in every context, so a section
|
|
250
258
|
needs no extra check. A section switches whole themes/brands only; a recipe's
|
|
251
259
|
own token declaration on the section element wins.
|
|
252
|
-
- **On-image
|
|
253
|
-
the child a closed choice the caller sets, such as `tone?: "default" |
|
|
260
|
+
- **On-image controls** (a button over a photo, a background the design system
|
|
261
|
+
cannot know): give the child a closed choice the caller sets, such as `tone?: "default" |
|
|
254
262
|
"on-dark"` mapping to a precompiled recipe with its own surface profile
|
|
255
263
|
(Spectrum's `staticColor`). Use static paints (one `:root` value) for it, so
|
|
256
264
|
the pair is proven and does not change with the page's theme.
|
|
257
|
-
-
|
|
258
|
-
|
|
259
|
-
threaded through each child, or the surface-context construct that is planned.
|
|
260
|
-
Do not invent a theme per state. Details and limits: the ADS tool guide,
|
|
265
|
+
- Do not invent a theme per state, or a `tone` prop for a container the design
|
|
266
|
+
system owns. Details and limits: the ADS tool guide,
|
|
261
267
|
*Colours that depend on their surroundings*.
|
|
262
268
|
|
|
263
269
|
## Colors in Canvas, WebGL and SVG renderers
|
|
@@ -67,7 +67,11 @@ media queries and track lists, so a context cannot change them
|
|
|
67
67
|
| A region that adapts to the space it gets, not the window | `context: "container"` inside an owned ancestor framed `container: "region"` |
|
|
68
68
|
| Children stacked or in a row inside a component | `layout: "stack"` or `"inline"` |
|
|
69
69
|
| Several parts painted in one area | `layout: "layered"` |
|
|
70
|
-
| A
|
|
70
|
+
| A jump target (a section or heading with an id) under a sticky header | `anchorClear: { slot: "layer", field: "clearBlockStart" }` to land right under the header, or `{ slot: "spacing", field: "anchorGap" }` for the target's own distance (level with a sticky side column); never a document-wide scroll padding in the application |
|
|
71
|
+
| Neighbours that overlap (a pile of faces, stacked cards) | `overlap: { slot: "spacing", field: "overlap" }` on the `inline` or `stack` arrangement, from an `overlap` token; never negative margins of your own |
|
|
72
|
+
| An element that changes size, padding or spacing under a state | a `when` entry selecting another profile: `frame: { profile }` on the element, `spacing: "<profile>"` on its arrangement; `geometryTransition` to animate it. Give a `:hover` state a focus or attribute state of the same geometry |
|
|
73
|
+
| A part that appears in a row by growing from nothing (a counter, row actions) | `collapsed: true` on the part and `collapsed: false` in the state's `when` entry (or the reverse); its box goes on the element it holds |
|
|
74
|
+
| A decorative backdrop larger than its box (a glow) | a first part of a `layered` parent with `outset: { block, inline }` (spacing fields; a `box-share` token in the profile's `outsetBlock`/`outsetInline` makes it a share of the box) and a gradient surface |
|
|
71
75
|
| A panel that covers the content | a top-layer root (`layer`), or a cell stacked by the profile's `overlayLayer` |
|
|
72
76
|
|
|
73
77
|
Typical defaults, not rules: headers and toolbars are fluid in width; side panels
|
|
@@ -166,9 +170,13 @@ until that owner is fixed.
|
|
|
166
170
|
so a visible tier keeps the element's own display); `visible: true` shows it
|
|
167
171
|
again from a later tier. Hiding a part while a named condition holds is the
|
|
168
172
|
part's own `at: { "<condition>": { visible } }`, below.
|
|
169
|
-
- Each declared cell renders exactly once (`cell-missing-or-repeated`)
|
|
170
|
-
one owned element or public component
|
|
171
|
-
|
|
173
|
+
- Each declared cell renders exactly once (`cell-missing-or-repeated`) unless it
|
|
174
|
+
says otherwise. A cell names one owned element or public component.
|
|
175
|
+
`required: false` lets it be absent (keep it in auto rows, or its pinned row
|
|
176
|
+
stays empty: `review/optional-cell-row`). `repeat: true` renders it once per
|
|
177
|
+
list item: its instances flow (`start: "auto"` implied) over a numeric span or
|
|
178
|
+
`"full"`, with no start line, `end` or `row`. Several instances may also share
|
|
179
|
+
a cell that auto-places (`start: "auto"`) at every tier.
|
|
172
180
|
- An element has at most one placement (`placement-repeated`), applied in the
|
|
173
181
|
returned JSX (`placement-statement`), and a placed element carries its own recipe
|
|
174
182
|
styling (`placement-without-root`). One element carries one part or cell marker.
|
|
@@ -150,24 +150,55 @@ a recipe never creates a state machine.
|
|
|
150
150
|
surface and its state surfaces, timed by a motion profile with a `static`
|
|
151
151
|
reduced-motion policy. A channel that does not change, an effect that changes
|
|
152
152
|
without its channel, or a gradient on the element, is rejected.
|
|
153
|
-
- Long-form content (articles, docs, legal text, Markdown or CMS output) is
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
`
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
- Long-form content (articles, docs, legal text, Markdown or CMS output) is
|
|
154
|
+
built from the design system's own components: `Heading`, `Paragraph`,
|
|
155
|
+
`Link`, `List`, `Quote`, `CodeBlock`, `Table` and the inline ones, each a
|
|
156
|
+
normal owner. A pattern places them: a `stack` whose parts are placed
|
|
157
|
+
components (`kind: "component"`, `repeat: true`, `required: false`), in any
|
|
158
|
+
order, with a part's `spaceBefore` / `spaceAfter` for the space around it (a
|
|
159
|
+
heading one `sectionGap` from what precedes it). The content arrives as a
|
|
160
|
+
typed tree (a union of node types) that the pattern renders with a ternary
|
|
161
|
+
chain over `node.type` in its `.map` callback; an inline renderer may render
|
|
162
|
+
itself for nested inline nodes. The project adapts Markdown, HTML (parsed and
|
|
163
|
+
sanitised) or CMS rich text to that tree; never style plain markup by tag and
|
|
164
|
+
never inject an HTML string. A colour that follows the container (a link in a
|
|
165
|
+
heading) is the container surface's `provides`, not a prop on the link. A list
|
|
166
|
+
item keeps its marker: give it no arrangement, and space a nested list with a
|
|
167
|
+
part's `spaceBefore` in its block flow.
|
|
168
|
+
- A colour that depends on where an element sits (links and icons in a tinted
|
|
169
|
+
banner, the cells of a selected row, actions on a dark card) is a contextual
|
|
170
|
+
role: the container's surface profile `provides: { "--link-ink": "--on-warning" }`.
|
|
171
|
+
The children read their own roles and need no prop; composed contrast proves
|
|
172
|
+
their text there. Do not add a `tone` prop for a container's colour; keep
|
|
173
|
+
`tone` for a background the design system cannot know (a photo).
|
|
174
|
+
- `enter: { from: { surface, translate | translateInline | scale | rotate }, motion }` on a root
|
|
165
175
|
or a region part is an entrance on first render: the element starts from a
|
|
166
176
|
surface that states only `opacity` and `blur`, and at most one movement read
|
|
167
177
|
from the entrance's motion profile, then settles. See the motion reference.
|
|
168
178
|
- A part that needs a box of its own without being a control (a disc behind a
|
|
169
179
|
mark, a badge) takes `frame: { profile: "<frame profile>" }`; do not make a
|
|
170
|
-
separate owner only to give an element padding, a border or a size.
|
|
180
|
+
separate owner only to give an element padding, a border or a size. The
|
|
181
|
+
drawn box of a checkbox, radio or switch whose native `<input>` is hidden
|
|
182
|
+
takes `focus: { of: "<the input's part>" }`: the focus profile's outline is
|
|
183
|
+
drawn on the box while the input has keyboard focus. The input's part,
|
|
184
|
+
declared right before the box, takes `drawnBy: "<the box's part>"`: it takes
|
|
185
|
+
no room and lies, invisible, over the box at the box's frame size, so pointer
|
|
186
|
+
and keyboard still reach the real input. A part rendered once per list item
|
|
187
|
+
(`tabs.map(…)`) is declared `repeat: true`: every instance takes the part's
|
|
188
|
+
construction, and `extent: "fill"` shares the row among them. A visual part may sit
|
|
189
|
+
inside such a part: the owner reads it by its name (`recipe.parts.<name>`,
|
|
190
|
+
`recipe.assets.<name>.source`), which one nested part of the recipe has. On a
|
|
191
|
+
visual part the frame's size is the box and the drawing keeps its visual
|
|
192
|
+
profile's size, centred in it.
|
|
193
|
+
- A switch, a radio's dot or a slider's thumb is a decorative box of its control:
|
|
194
|
+
a part without a `kind`, with `frame: { profile }` and a `surface`, that takes
|
|
195
|
+
another surface or `translateInline` under the control's state
|
|
196
|
+
(`&[aria-checked="true"]`). Keep it empty and `aria-hidden`; name the control
|
|
197
|
+
on its root. Do not rebuild the control as a region to get a second element.
|
|
198
|
+
- A native `<progress>` is styled as a part: its own surface is the track and
|
|
199
|
+
`pseudo: { progressValue: { surface } }` (a background-only surface) the
|
|
200
|
+
fill, proven at 3:1 against the track. Do not draw a measured fill beside a
|
|
201
|
+
hidden native element.
|
|
171
202
|
- A border whose sides differ is stated in the profiles, not the recipe: the
|
|
172
203
|
frame's `borderWidth` plus a side's own (`borderInlineStartWidth`), the
|
|
173
204
|
surface's `borderColor` plus a side's own (`borderInlineStartColor`). Sides
|
|
@@ -177,7 +208,10 @@ a recipe never creates a state machine.
|
|
|
177
208
|
with a class.
|
|
178
209
|
- Surface effects are surface-profile fields, composed in a fixed order:
|
|
179
210
|
`blur` → `filter: blur()`; `backdropBlur` and `backdropSaturate` (role
|
|
180
|
-
`saturation`, a percentage) → `backdrop-filter: blur() saturate()
|
|
211
|
+
`saturation`, a percentage) → `backdrop-filter: blur() saturate()`;
|
|
212
|
+
`brightness` (role `brightness`, a percentage, on a visual part only) →
|
|
213
|
+
`filter: brightness()`: a picture with no dark version takes a token that
|
|
214
|
+
is `100%` in the light theme and lower in the dark one. For
|
|
181
215
|
shadows choose by meaning: `boxShadow` for a box (card, panel, control);
|
|
182
216
|
`shapeShadow` on a visual part whose drawing is not its box (transparent
|
|
183
217
|
image, artwork); `groupShadow` on a container when everything inside should
|
|
@@ -324,7 +358,7 @@ text part breaks one way, set by one `wrap` field:
|
|
|
324
358
|
keeps it reachable, which analysis cannot see).
|
|
325
359
|
- `textEdge` trims a text part's box to the edges it names (`["cap",
|
|
326
360
|
"alphabetic"]`); `textAlign` sets
|
|
327
|
-
its alignment. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
361
|
+
its alignment, on a control's label too. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
328
362
|
spacing in a browser without them.
|
|
329
363
|
|
|
330
364
|
<a id="assets"></a>
|
|
@@ -72,3 +72,5 @@ Load only the guide(s) for the requested transition.
|
|
|
72
72
|
| 0.4.7 | 0.5.0, part 2 | [The design model: role tokens, profiles, recipes, assets, the design package and emitted output](references/0.4.7-to-0.5.0.md) |
|
|
73
73
|
| 0.4.7 | 0.5.0, grids | [Grids and layout: spatial profiles, grid recipes, named conditions, subgrid rows](references/0.4.7-to-0.5.0-grid.md) (supersedes section 10 of the 0.4.1 → 0.4.2 guide; the rest of the 0.5.0 migration is the guide above) |
|
|
74
74
|
| 0.5.0 | 0.5.1 | [The text keyline check, surface effects, entrances and font fallback metrics](references/0.5.0-to-0.5.1.md) |
|
|
75
|
+
| 0.5.1 | 0.5.2 | [Two emitted-CSS fixes, checks that now accept what they refused, a TypeScript configuration error that is now reported, the render audit measuring owner states by itself (and which audit-only scenario states can go), and new state, geometry, surface, outset, focus, control and prose language](references/0.5.1-to-0.5.2.md) |
|
|
76
|
+
| 0.5.2 | 0.5.3 | [Prose becomes content components, contextual roles (`provides`), fixed-size frames keep their size, workarounds that can go (design state, heading levels, drawn inputs, repeated parts and cells, optional cells, corner radii, inline entrances, the target spacing exception, hidden glyphs), and composed contrast through plain modules](references/0.5.2-to-0.5.3.md) |
|