@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
package/docs/LANGUAGE.md
CHANGED
|
@@ -8,7 +8,7 @@ from `/profile`, `recipe()` and `combineRecipes()` from `/recipe`, `asset()`,
|
|
|
8
8
|
`ads check` reads the declarations and `ads emit` compiles them to plain
|
|
9
9
|
TypeScript and CSS; ADS does not run in the application. The examples come
|
|
10
10
|
from the example design system, the one ADS is tested with (in its repository,
|
|
11
|
-
under `tests/fixtures/
|
|
11
|
+
under `tests/fixtures/example-project/`); `ads init` installs no design system.
|
|
12
12
|
[RULES.md](RULES.md) lists every rule.
|
|
13
13
|
|
|
14
14
|
## The authoring invariant
|
|
@@ -185,6 +185,33 @@ part's children.
|
|
|
185
185
|
size. Its frame profile can declare `minInlineSize` (a `control-min-size`
|
|
186
186
|
token), which makes an icon-only control square without deriving its padding
|
|
187
187
|
from its height. See the [equations](LOWERING.md#control-frame-calculation).
|
|
188
|
+
- A control holds at most one text part and one visual part, and any number of
|
|
189
|
+
**decorative boxes**: parts without a `kind`, each with `frame: { profile }`
|
|
190
|
+
(its size and shape) and optionally a `surface`. A box shows the control's
|
|
191
|
+
state by its paint or position, as a switch's knob does:
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
recipe({
|
|
195
|
+
layout: "inline", profile: "switch", frame: "control", align: "center", justify: "start", surface: "switch-track",
|
|
196
|
+
when: { '&[aria-checked="true"]': { surface: "switch-track-on" } },
|
|
197
|
+
parts: {
|
|
198
|
+
knob: {
|
|
199
|
+
selector: ".switch-knob", required: true, frame: { profile: "switch-knob" }, surface: "switch-knob",
|
|
200
|
+
transition: ["translate"],
|
|
201
|
+
when: { '&[aria-checked="true"]': { translateInline: { slot: "motion", field: "distance" } } },
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
A box's `when` takes a `surface`, `translateInline` and the scales; inline
|
|
208
|
+
travel mirrors under right-to-left. Where the knob is says whether the switch
|
|
209
|
+
is on, so reduced motion keeps the position and drops only the animation. The
|
|
210
|
+
box is never a target of its own (`source/pointer-transparent-interactive`),
|
|
211
|
+
and a control that renders no text is named on its root
|
|
212
|
+
(`source/control-name-missing`). A control's effects are accepted under
|
|
213
|
+
`&[aria-checked="true"]` and `&[aria-selected="true"]` as well. ADS does not
|
|
214
|
+
prove the knob against the track: the render audit measures it.
|
|
188
215
|
- `frame: "container"` requires complete frame and surface contracts.
|
|
189
216
|
- A frame without a layout keeps native display semantics, including
|
|
190
217
|
Disclosure's summary marker.
|
|
@@ -207,19 +234,26 @@ them all.
|
|
|
207
234
|
| --- | --- | --- | --- |
|
|
208
235
|
| frame profile `paddingInline` / `paddingBlock` | frame | logical insets per axis | the profile also sets `padding` (`construction/frame-field-conflict`) |
|
|
209
236
|
| frame profile `paddingInlineStart` / `paddingInlineEnd` / `paddingBlockStart` / `paddingBlockEnd` | container frame, control frame | one side's inset, where the two sides of an axis differ (a tag padded more before its remove button). On a control frame a block side's inset is its least inset, and `minimumBlockInset` is the block axis's field | the profile also sets that side's axis or `padding`; on a control frame, a block inset beside `minimumBlockInset` (`construction/frame-field-conflict`) |
|
|
210
|
-
| `frame: { profile: "<frame profile>" }` | part (not a control, not a vector) | the profile's insets, border, radius and sizes as the part's own box (`box-sizing: border-box`) | another field beside `profile`; a frame field the profile misuses, as on a root |
|
|
237
|
+
| `frame: { profile: "<frame profile>" }` | part (not a control, not a vector) | the profile's insets, border, radius and sizes as the part's own box (`box-sizing: border-box`); on a visual part bound to artwork the profile's `inlineSize`/`blockSize` are the box (a disc behind a mark) and the drawing keeps its visual profile's size, centred in it | another field beside `profile`; a frame field the profile misuses, as on a root |
|
|
211
238
|
| `frame: { rules: ["block-end", …] }` (root), `frame: { kind: "control", rules: [...] }` (control part) | region root, control part | the profile's `border-width`, solid, on the named logical sides only, painted by the element's surface `border-color` (mirrors in RTL); on a control part an unruled side keeps the border's space as inset, so the box and its text do not move (a soft field's underline) | empty or repeated sides; no profile width (`rule-width-missing`); no surface border colour (`rule-paint-missing`); on a grid |
|
|
212
|
-
| `frame: { corners: ["end-start", "end-end"] }` | region root | the frame profile's `radius` on the named corners (block edge, then inline edge), `0` on the others, as `border-<corner>-radius`; every corner without it | a
|
|
239
|
+
| `frame: { corners: ["end-start", "end-end"] }` | region root | the frame profile's `radius` (or the corner's own, below) on the named corners (block edge, then inline edge), `0` on the others, as `border-<corner>-radius`; every corner without it | a named corner with no radius in the frame profile (`profile-field-missing`) |
|
|
240
|
+
| frame profile `startStartRadius` / `startEndRadius` / `endStartRadius` / `endEndRadius` | region root, part box | that corner's radius in place of the profile's `radius` (a chat bubble's small tail corner), all four as `border-<corner>-radius`; a corner with neither is square | a control frame (`profile-field-unsupported`) |
|
|
213
241
|
| `at: { <condition>: { frame: { rules?, corners? } } }` | region root with a `frame` | under the named condition of the root's spatial profile (`@media (width < bound)`), only the border and corner writes that differ: a divider that is the block-end edge when wide and the inline-start edge when narrow | a condition the spatial profile does not name (`construction/condition-unknown`); `rules` under the condition without `rules` on the frame; more than one condition |
|
|
214
242
|
| `accessibility: { boundary: "visible-label" \| "boundary-on-interaction", reason }` | control part (`frame: "control"`, a text-like input, textarea or select) | nothing: its border contrast error becomes the review item `boundary-identified-otherwise`; acceptance enforces human approval | another kind, a reason outside 20–300 characters (`accessibility-declaration-invalid`); another part (`accessibility-declaration-unsupported`); an approver, date or other field (`field-unsupported`) |
|
|
243
|
+
| `focus: { of: "<sibling part>" }` | region part | the nearest focus profile's outline on this part while the named part of the same parent has keyboard focus (`<parent>:has(> <control>:focus-visible) > <part>`): the drawn box of a checkbox, radio or switch whose native `<input>` is visually hidden. The owner keeps the native control focusable and in the same parent | `of` names the part itself or no part of the same parent (`spec/value-invalid`) |
|
|
244
|
+
| `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`) |
|
|
245
|
+
| `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`) |
|
|
246
|
+
| `kind: "component"` | region part | a public component placed with the part's marker (`<Heading className="ds-content-heading" …/>`), as a grid cell is: its interior is its owner's, so the part states placement only (`required`, `repeat`, `extent`, `at`, `spaceBefore`, `spaceAfter`) | any other field (`spec/field-unsupported`); a forwarded `className` that carries a recipe (`source/foreign-interior`) |
|
|
247
|
+
| `spaceBefore` / `spaceAfter: { slot: "spacing", field }` | part of a `stack`, or of a parent without an arrangement (block flow: a list item that keeps its marker) | the part's own space before it and after it, in place of the gap (`margin-block-start: calc(space - gap)` on the part, or on what follows it); where one part's space after meets the next part's space before, the larger applies; the first part starts flush | another parent layout (`space-parent-unsupported`) |
|
|
248
|
+
| `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`) |
|
|
215
249
|
| `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 |
|
|
216
250
|
| `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) |
|
|
217
251
|
| 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 |
|
|
218
252
|
| `sticky: { edge: "block-start" \| "block-end", clear?: "block-start" }` | root (not a top-layer root), part | `position: sticky` at that edge of the nearest scrolling container (`inset-block-start: 0`); with `clear`, below the region the layer profile's `clearBlockStart` names; `z-index` from the layer profile's `stickyLayer` when it has one | `clear` with the end edge; `clear` without a layer profile that states `clearBlockStart` |
|
|
219
|
-
| `extent: "fill" \| "fill-both"` | part | `flex: 1 1 0`, the main-axis minimum released; `align-self: stretch` with `fill-both` | the parent is not `stack`/`inline` (`extent-parent-unsupported`); a frame or reserved lines set that minimum |
|
|
253
|
+
| `extent: "fill" \| "fill-both"` | part | `flex: 1 1 0`, the main-axis minimum released, so the part's content is confined to it; in a `stack` whose frame states only a minimum height (`minBlockSize`, with no `blockSize`, `maxBlockSize`, ratio or `overflow`) the part keeps its content's height and the stack grows with it; `align-self: stretch` with `fill-both` | the parent is not `stack`/`inline` (`extent-parent-unsupported`); a frame or reserved lines set that minimum |
|
|
220
254
|
| `extent: "content" \| "container"` | root of an `inline` row, or of a control | `"content"` (the default): as wide as its content, never wider than its container (`display: inline-flex; max-inline-size: 100%`, or `min(100%, <cap>)` under its frame's own cap); `"container"`: the width available in any parent, a block one, a column that aligns its children, or a row beside siblings (`display: flex; inline-size: 100%`), so a filling part has the rest of the row | on a `stack`, `flow`, `layered` or top-layer root, which never hug (`spec/field-unsupported`); `"container"` with a frame that fixes the row's width (`construction/extent-conflict`); a part with `extent: "fill"` in a `"content"` row whose frame does not fix its width (`construction/extent-row-hugs`) |
|
|
221
255
|
| `layout: "layered"` | root, part recipe | one `minmax(0,1fr)` grid area; every declared child part at `1 / 1`; paint order is DOM order, no `z-index` | fewer than two parts (`layered-parts-missing`); `gap` or `wrap` |
|
|
222
|
-
| `outset: { block?, inline? }` (spacing fields) | a childless, non-text part of a `layered` parent | `margin-block` / `margin-inline: calc(-1 * <spacing>)`: the backdrop is drawn past its parent's box (a glow behind a card); the grid area and the layout around it are unchanged | any other part (`construction/outset-unsupported`) |
|
|
256
|
+
| `outset: { block?, inline? }` (spacing fields) | a childless, non-text part of a `layered` parent | `margin-block` / `margin-inline: calc(-1 * <spacing>)`: the backdrop is drawn past its parent's box (a glow behind a card); the grid area and the layout around it are unchanged. A field bound to a `box-share` token (the spacing profile's `outsetBlock` / `outsetInline`) is a share of the box on that axis and grows with it: the same margin on the inline axis, and on the block axis `block-size: calc(100% + 2 * <share>)` centred over the area (`align-self: center`) | any other part (`construction/outset-unsupported`) |
|
|
223
257
|
| `scheme: "light" \| "dark"` | a visual part rendered as a content `<img>`; its sibling declares the other scheme | `display: var(--ads-not-light, block)` (or `--ads-not-dark`): the image is displayed under its colour scheme and `display: none` under the other, by the scheme switches `foundation.css` writes wherever it sets `color-scheme` (root `data-theme`, a themed section, the OS preference); no script. An `at` condition still hides the part: it is displayed where both show it | siblings without exactly one `light` and one `dark` part (`spec/value-invalid`); a part that is not visual (`spec/field-unsupported`); a part that is not an `<img>` or has an artwork binding (`source/scheme-image-element`, `construction/scheme-unsupported`); an image without `width` or `height` (`source/scheme-image-size-missing`); the image of the scheme the first declared theme does not have without `loading="lazy"` in every choice (`source/scheme-image-not-lazy`) |
|
|
224
258
|
| control `layout: "stack"` | control | visual above label; the control box centres visual + gap + line | `justify` |
|
|
225
259
|
| `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 |
|
|
@@ -231,6 +265,8 @@ them all.
|
|
|
231
265
|
| `wrap: "anywhere" \| "never" \| "truncate" \| "balance" \| "pretty"` (`true` = anywhere), `textAlign`, `reserveLines: 1–3` | text part | `overflow-wrap`, `white-space`, one-line ellipsis truncation, `text-wrap: balance \| pretty` (without support: normal wrapping); `text-align`; `min-block-size: Nlh` | reserved lines without a text profile (`reserve-without-text`) |
|
|
232
266
|
| `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`) |
|
|
233
267
|
| control label `wrap`: absent, `true`/`"anywhere"`, `"never"` | control text part | breaks between words when one word alone would overflow (`overflow-wrap: break-word`, the default), anywhere, or never: one line, and the control does not shrink below the label's width | `"truncate"` or another value |
|
|
268
|
+
| control label `textAlign: "start" \| "center" \| "end"` | control text part | `text-align` on the label: how its lines sit once it wraps or the control is wider than it | another value |
|
|
269
|
+
| control label `extent: "fill"` | control text part of an `inline` control | the label takes the room the control's other content leaves (`flex: 1 1 0%`), so a visual after it stands at the far end: a full-width disclosure trigger with its sign at the edge | a control whose layout is not `inline` |
|
|
234
270
|
| `kind: "vector", surface, stroke: { slot: "visual", field }` | part | `stroke` from a colour-only surface, `stroke-width` from the visual profile, `fill: none`, non-scaling stroke; any number of data-driven shapes | a surface with other fields (`vector-surface-unsupported`); not an SVG shape under an owned `<svg>` |
|
|
235
271
|
| `kind: "visual", media: "inspected-svg"` | part | contains the inserted drawing within the visual profile's size; its intrinsic size is data | markup, children or `dangerouslySetInnerHTML` in the part (`source/inspected-svg-inline`); the owner parses markup (`source/inspected-svg-parsed`) |
|
|
236
272
|
|
|
@@ -295,9 +331,11 @@ written `:has(> .part:state)` with `:checked`, `:indeterminate`,
|
|
|
295
331
|
|
|
296
332
|
```ts
|
|
297
333
|
parts: {
|
|
298
|
-
input: { selector: ".ds-checkbox-input" },
|
|
334
|
+
input: { selector: ".ds-checkbox-input", drawnBy: "box" }, // the native <input type="checkbox">, laid over the box
|
|
299
335
|
box: {
|
|
300
336
|
selector: ".ds-checkbox-box", surface: "control-surface",
|
|
337
|
+
frame: { profile: "checkbox-box" }, // the box's size: also the input's
|
|
338
|
+
focus: { of: "input" }, // the focus profile's outline, drawn on the box
|
|
301
339
|
when: {
|
|
302
340
|
"&:has(> .ds-checkbox-input:checked)": { surface: "action-surface" },
|
|
303
341
|
"&:has(> .ds-checkbox-input:focus-visible)": { surface: "focused-control-surface" },
|
|
@@ -306,7 +344,11 @@ parts: {
|
|
|
306
344
|
}
|
|
307
345
|
```
|
|
308
346
|
|
|
309
|
-
A checkbox's drawn box follows its native input without script
|
|
347
|
+
A checkbox's drawn box follows its native input without script. The input is
|
|
348
|
+
declared right before its box with `drawnBy`: it takes no room in the row and
|
|
349
|
+
lies, invisible, over the box at the box's size, so a press on the box is a
|
|
350
|
+
press on the input and the label (a `<label>` root) starts one gap after the
|
|
351
|
+
box. A field's
|
|
310
352
|
control reacts to its own hover (`&:has(> .ds-field-control:hover)`), not to
|
|
311
353
|
the label's. The class must be a direct part of the recipe, and nothing else
|
|
312
354
|
goes inside `:has()`.
|
|
@@ -363,8 +405,26 @@ control: {
|
|
|
363
405
|
It lowers to `& > .ds-field-control::placeholder { color; opacity: 1 }` and
|
|
364
406
|
`&[data-user-invalid] > .ds-field-control::placeholder { color }`. The
|
|
365
407
|
pseudo-element is always last; `opacity: 1` removes Firefox's default dimming.
|
|
366
|
-
`placeholder`
|
|
367
|
-
(`source/pseudo-host-unsupported`).
|
|
408
|
+
`placeholder` belongs to an `<input>` or `<textarea>`; another element cannot
|
|
409
|
+
host it (`source/pseudo-host-unsupported`).
|
|
410
|
+
|
|
411
|
+
The other pseudo-element is a progress bar's fill, on a `<progress>` part:
|
|
412
|
+
|
|
413
|
+
```ts
|
|
414
|
+
bar: { selector: ".indicator-bar", required: true, surface: "progress-track", frame: { profile: "progress-bar" },
|
|
415
|
+
pseudo: { progressValue: { surface: "progress-fill" } } },
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
The part's own surface is the track; `progressValue` takes a surface that sets
|
|
419
|
+
only `background`, with `when` for states. ADS turns off the engine's drawing
|
|
420
|
+
(`appearance: none`) and writes the fill once per engine
|
|
421
|
+
(`::-webkit-progress-value`, `::-moz-progress-bar`), since there is no standard
|
|
422
|
+
pseudo-element and a selector an engine does not know would void a shared rule.
|
|
423
|
+
The fill inherits the part's radius. It needs 3:1 against the track in every
|
|
424
|
+
theme, brand and state (`construction/progress-contrast-insufficient`); a part
|
|
425
|
+
without a background has no track to prove it on
|
|
426
|
+
(`construction/progress-contrast-unresolved`). ADS's browser tests cover
|
|
427
|
+
Chromium only.
|
|
368
428
|
|
|
369
429
|
**Contrast**, in every theme, brand and token condition:
|
|
370
430
|
|
|
@@ -396,125 +456,149 @@ typed `when` endpoints), the [root press](MOTION.md#root-press),
|
|
|
396
456
|
[measured value](MOTION.md#animating-a-measured-value). An animation is
|
|
397
457
|
[defined in the recipe and controlled in script](MOTION.md#defined-in-the-recipe-controlled-in-script).
|
|
398
458
|
|
|
399
|
-
##
|
|
459
|
+
## Geometry by state
|
|
400
460
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
nest.
|
|
461
|
+
A state selects geometry the way it selects a surface: by naming another
|
|
462
|
+
profile. A `when` entry on a region root or a part may carry a frame profile
|
|
463
|
+
and a spacing profile, and on a part whether it is collapsed:
|
|
405
464
|
|
|
406
465
|
```ts
|
|
407
|
-
const
|
|
408
|
-
layout: "
|
|
409
|
-
profile: "
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
rule: { surface: "divider", frame: "divider-frame" },
|
|
420
|
-
pre: { surface: "code-block", text: "code" },
|
|
466
|
+
const pile = recipe({
|
|
467
|
+
layout: "inline",
|
|
468
|
+
profile: "pile",
|
|
469
|
+
overlap: { slot: "spacing", field: "overlap" }, // neighbours overlap instead of being separated
|
|
470
|
+
when: { '&[data-expanded="true"]': { spacing: "pile-open" } },
|
|
471
|
+
geometryTransition: { channels: ["gap"], motion: { slot: "motion" } },
|
|
472
|
+
parts: {
|
|
473
|
+
count: { selector: ".pile-count", required: true, collapsed: true,
|
|
474
|
+
when: { '&[data-expanded="true"]': { collapsed: false } },
|
|
475
|
+
geometryTransition: { channels: ["size"], motion: { slot: "motion" } } },
|
|
476
|
+
card: { selector: ".pile-card", required: true, frame: { profile: "tile" },
|
|
477
|
+
when: { '&[data-expanded="true"]': { frame: { profile: "tile-open" } } } },
|
|
421
478
|
},
|
|
422
|
-
})
|
|
423
|
-
|
|
424
|
-
export function Prose({ children }: { children: ReactNode }) {
|
|
425
|
-
return <div className={article}>{children}</div>;
|
|
426
|
-
}
|
|
479
|
+
});
|
|
427
480
|
```
|
|
428
481
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
482
|
+
| Field | On | Lowers to | Rejects |
|
|
483
|
+
| --- | --- | --- | --- |
|
|
484
|
+
| `when: { state: { frame: { profile } } }` | a region root with a `frame`, a part with `frame: { profile }` | the state's frame profile lowered whole, as the element's own is; one rule under the state with only what differs | an element without a frame profile of its own, which includes a text-entry control part, whose control frame is calculated and not selected (`frame-missing`); a state frame that does not state a field the base frame writes (`field-dropped`); a control or a top-layer root (`spec/field-unsupported`) |
|
|
485
|
+
| `when: { state: { spacing: "<spacing profile>" } }` | a root or a part with an arrangement | the arrangement's `gap` and `overlap` read from that profile under the state, by the same fields as at rest | n/a |
|
|
486
|
+
| `overlap: { slot: "spacing", field: "overlap" }` | an `inline` or `stack` root or part recipe | every neighbour after the first starts inside the one before it by the spacing profile's `overlap` (an `overlap` token): real layout, so the arrangement is as large as what it shows and what follows it moves with it; later neighbours paint over earlier ones; no gap is written | beside `gap`, `rowGap` or `wrap`; on another layout |
|
|
487
|
+
| `collapsed: true \| false`, on the part and in its `when` entries | a part of a `stack` or `inline` parent | collapsed: no size on the parent's main axis whatever it holds, transparent, and out of the accessibility tree and of focus (`visibility: hidden`); open: its content's size. In an overlapping arrangement a collapsed part takes none of the overlap either | a part with a frame, an arrangement, an overflow or a filling extent of its own (`collapsed-box`): put its box on what it holds; a parent that is not a stack or a row (`collapsed-parent`) |
|
|
488
|
+
| `geometryTransition: { channels, motion }` | root, part | the listed channels' properties join the element's transition set, timed by the motion profile; instant under reduced motion. Channels: `size`, `inset` (padding), `gap`, `radius`, `border-width`, and `overlap`: the element's own start margin where an overlapping arrangement places it | a listed channel that changes under no state (`channel-unused`; `overlap` is the arrangement's to change, so it is never refused) |
|
|
489
|
+
|
|
490
|
+
All of these are `construction/state-geometry-unsupported` with the reason
|
|
491
|
+
given, unless a code is named.
|
|
492
|
+
|
|
493
|
+
- **A frame a state selects is checked as the element's own is.** The checks
|
|
494
|
+
that read an element's frame run once for the frame at rest and once for
|
|
495
|
+
each frame a state selects:
|
|
496
|
+
- the text keyline and the fit of a frame in its grid cell
|
|
497
|
+
(`source/keyline-missed`, `source/frame-exceeds-region`,
|
|
498
|
+
`component-keyline` across owners) name the state's frame profile;
|
|
499
|
+
- a rounded corner a child paints over (`construction/corner-overpaint`)
|
|
500
|
+
is found under the state whose frames open it: one that rounds the root,
|
|
501
|
+
removes its inset, or squares the part;
|
|
502
|
+
- target size reads one size per target, so it is kept by construction: a
|
|
503
|
+
control, a text-entry control part and a hit area never change by state
|
|
504
|
+
(`hit-area`), neighbouring targets are proven at every gap a state
|
|
505
|
+
selects, and targets next to each other in an overlapping arrangement are
|
|
506
|
+
refused (`targets-overlap`).
|
|
507
|
+
The render audit still sees a state only where a scenario shows it.
|
|
508
|
+
- **Not for pointer users only.** A state that names `:hover` needs a state of
|
|
509
|
+
the same geometry under `:focus-visible`, `:focus-within` or an attribute
|
|
510
|
+
(`hover-only`).
|
|
511
|
+
- **Autofill does not move layout.** Geometry under `[data-autofill]` is
|
|
512
|
+
`construction/autofill-layout-shift`.
|
|
513
|
+
- **Who animates an overlap.** A declared part animates its margin with its
|
|
514
|
+
arrangement's `gap` channel. Any other neighbour (a component, a mapped
|
|
515
|
+
element with its own recipe) lists `overlap` in its own
|
|
516
|
+
`geometryTransition`: its transitions are its own, so the arrangement never
|
|
517
|
+
writes them.
|
|
518
|
+
- **A collapsed part opening to its content's size** animates where the engine
|
|
519
|
+
interpolates to a content size (`interpolate-size`); elsewhere it opens at
|
|
520
|
+
once, with the same result.
|
|
521
|
+
- **What a state cannot change:** the layout kind, a grid's tracks, a text
|
|
522
|
+
profile's size (a state text profile still changes weight and tracking
|
|
523
|
+
only). A hover state that resizes an element in flow moves what follows it:
|
|
524
|
+
that is the designer's choice, and ADS does not refuse it; it is listed for
|
|
525
|
+
review (`review/hover-geometry-shift`). A layer of a layered parent draws over
|
|
526
|
+
its neighbours and is not listed.
|
|
527
|
+
|
|
528
|
+
## Long-form content: components in a flow
|
|
436
529
|
|
|
437
|
-
|
|
438
|
-
|
|
530
|
+
Articles, documentation, legal text and anything a content system or Markdown
|
|
531
|
+
produces are assembled from the design system's own components, checked as any
|
|
532
|
+
component is. There is no styling by tag: a paragraph, a heading, a link and a
|
|
533
|
+
list are components (`Paragraph`, `Heading`, `Link`, `List`), the same ones the
|
|
534
|
+
rest of the interface uses, and a pattern places them.
|
|
535
|
+
|
|
536
|
+
Three general capabilities assemble them:
|
|
537
|
+
|
|
538
|
+
1. **A flow of parts.** A stack whose parts are placed public components
|
|
539
|
+
(`kind: "component"`, matched by the marker the placement passes in
|
|
540
|
+
`className`, as a grid cell is), each `repeat`ed and optional, in any order.
|
|
541
|
+
A part's `spaceBefore` and `spaceAfter` replace the stack's gap on that side:
|
|
542
|
+
a heading stands further from what precedes it, and where one part's space
|
|
543
|
+
after meets the next part's space before the larger applies. The first part
|
|
544
|
+
starts flush.
|
|
545
|
+
2. **A finite choice over node types.** The design system defines its content
|
|
546
|
+
tree as a TypeScript union (block nodes, inline nodes) and renders it with a
|
|
547
|
+
ternary chain over `node.type` inside the `.map` callback, so every node type
|
|
548
|
+
is a finite choice ADS checks. A renderer may place itself (a quote holds
|
|
549
|
+
blocks, strong text holds inline nodes): ADS follows each recursive placement.
|
|
550
|
+
3. **Contextual roles.** A container's surface profile `provides` the paint
|
|
551
|
+
roles its subtree reads differently ([PROFILE-KINDS](PROFILE-KINDS.md#surface)):
|
|
552
|
+
a heading's surface provides the link ink, so a link inside it takes the
|
|
553
|
+
heading's ink with no prop on the link and no rule written into it.
|
|
439
554
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
**An element is a part selected by tag.** Each entry names profiles: `text`
|
|
454
|
-
(a text profile), `surface` (a surface profile, with `when` for its states) and
|
|
455
|
-
`frame` (a frame profile: padding, borders, radius, sizes). Three extras belong
|
|
456
|
-
to one element each: `spaceBefore` on a block (it replaces the rhythm before
|
|
457
|
-
it), `indent` on `list`, and `marker` on `item` (a colour-only surface).
|
|
458
|
-
|
|
459
|
-
**What ADS guarantees.**
|
|
460
|
-
|
|
461
|
-
- **Only elements without a class are styled** (`p:not([class])`). Every
|
|
462
|
-
element an ADS owner renders has a class, so a component placed in the
|
|
463
|
-
content keeps its own design, and a paragraph inside that component is the
|
|
464
|
-
component's.
|
|
465
|
-
- **Nesting follows HTML.** A list in a list, a paragraph in a quote, a link in
|
|
466
|
-
a table cell: each is styled where it stands.
|
|
467
|
-
- **The rhythm is even.** Every block takes the rhythm (or its own
|
|
468
|
-
`spaceBefore`) before it, declared or not, and the first plain element of
|
|
469
|
-
the root and of each plain container starts flush. Browser margins, a
|
|
470
|
-
quote's and a figure's indent, a rule's inset border, a table's doubled
|
|
471
|
-
borders and media wider than its column are replaced.
|
|
472
|
-
- **A component among the blocks is spaced like them.** A component placed
|
|
473
|
-
directly in the prose root takes the rhythm before it (unless it comes
|
|
474
|
-
first); nothing else of it changes. A component inside a paragraph is inline
|
|
475
|
-
content and is left alone.
|
|
476
|
-
- **A table's structure and line breaks are content.** `thead`, `tbody`,
|
|
477
|
-
`tfoot` and `tr` come with a declared `table`, and `br` with any prose; no
|
|
478
|
-
rule is written for them.
|
|
479
|
-
- **Contrast is proven.** Each declared colour (base and state surfaces) is
|
|
480
|
-
checked on the root's background and on the background of every declared
|
|
481
|
-
element that can contain it, in every theme and brand:
|
|
482
|
-
`construction/prose-contrast-insufficient`. A code block holds code, so a
|
|
483
|
-
link's colour is not held to it.
|
|
484
|
-
- **The source of the markup does not matter.** JSX children, rendered
|
|
485
|
-
Markdown and HTML from a content system are styled alike.
|
|
486
|
-
|
|
487
|
-
**Content as an HTML string.** A content system or a Markdown renderer hands
|
|
488
|
-
the application a string. Application source cannot inject it
|
|
489
|
-
(`dangerouslySetInnerHTML` is a design prop to `ads-guard`), and it should not:
|
|
490
|
-
the injection belongs in one place. Give the same recipe a second component
|
|
491
|
-
that takes the string:
|
|
555
|
+
```ts
|
|
556
|
+
// The flow: blocks in any order and number, a heading one section gap from what precedes it.
|
|
557
|
+
const flow = recipe({
|
|
558
|
+
layout: "stack",
|
|
559
|
+
profile: "article", // a composite: { spacingProfile, frameProfile }
|
|
560
|
+
frame: {},
|
|
561
|
+
parts: {
|
|
562
|
+
heading: { selector: ".ds-content-heading", kind: "component", repeat: true, required: false, spaceBefore: { slot: "spacing", field: "sectionGap" } },
|
|
563
|
+
paragraph: { selector: ".ds-content-paragraph", kind: "component", repeat: true, required: false },
|
|
564
|
+
list: { selector: ".ds-content-list", kind: "component", repeat: true, required: false },
|
|
565
|
+
},
|
|
566
|
+
}).root;
|
|
492
567
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
568
|
+
export function Content({ blocks }: { blocks: readonly BlockNode[] }) {
|
|
569
|
+
return (
|
|
570
|
+
<div className={flow}>
|
|
571
|
+
{blocks.map((node, index) =>
|
|
572
|
+
node.type === "heading" ? <Heading key={index} className="ds-content-heading" level={node.level}><ContentText inline={node.children} /></Heading>
|
|
573
|
+
: node.type === "paragraph" ? <Paragraph key={index} className="ds-content-paragraph"><ContentText inline={node.children} /></Paragraph>
|
|
574
|
+
: <List key={index} className="ds-content-list" ordered={node.ordered}>…</List>,
|
|
575
|
+
)}
|
|
576
|
+
</div>
|
|
577
|
+
);
|
|
496
578
|
}
|
|
497
579
|
```
|
|
498
580
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
the recipe does not declare are drawn in the root's text without any report,
|
|
504
|
-
because no check reads the string. The example design system's Prose pattern exports both
|
|
505
|
-
forms.
|
|
506
|
-
|
|
507
|
-
**What a prose recipe does not have.** No `parts`, `gap`, `align` or `layer`:
|
|
508
|
-
prose flows. An element the recipe does not declare is drawn in the root's
|
|
509
|
-
text; the markup checks report it where content uses it
|
|
510
|
-
(`prose-element-undeclared`), so the gap shows up where it matters.
|
|
581
|
+
```ts
|
|
582
|
+
// The heading's surface: links inside it read the heading's ink.
|
|
583
|
+
profile({ name: "article-heading", kind: "surface", fields: { color: "--text-primary" }, provides: { "--link-ink": "--text-primary" } });
|
|
584
|
+
```
|
|
511
585
|
|
|
512
|
-
**
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
`
|
|
586
|
+
**Where content comes from.** The design system renders its own content tree;
|
|
587
|
+
a project adapts its source to it in behaviour code with the libraries it
|
|
588
|
+
declares: Markdown (an mdast tree from a Markdown parser), HTML (parsed and
|
|
589
|
+
sanitised, never injected) or a content system's rich text (Portable Text, a
|
|
590
|
+
rich-text JSON). The example design system's `Content` pattern
|
|
591
|
+
(`tests/fixtures/example-project/design-system/patterns/Content/Content`) shows
|
|
592
|
+
the whole set: the node types, the block flow (`Content`), the inline renderer
|
|
593
|
+
(`ContentText`), nested lists (`ContentList`, a list item whose nested list
|
|
594
|
+
starts one `detailsGap` below its text) and the components in
|
|
595
|
+
`components/Content/Text` and `components/Content/Blocks`.
|
|
596
|
+
|
|
597
|
+
**What ADS checks.** Every component as usual (states, contrast, targets, text);
|
|
598
|
+
the flow's spacing tokens; composed contrast of every text through every
|
|
599
|
+
placement and recursive renderer, with the provided roles of the containers it
|
|
600
|
+
sits in; a surface that provides a token it reads itself
|
|
601
|
+
(`foundation/provided-role-self`).
|
|
518
602
|
|
|
519
603
|
## Sticky elements
|
|
520
604
|
|
|
@@ -943,8 +1027,19 @@ the declared parent; independent layouts belong to child regions. Unsupported
|
|
|
943
1027
|
combinations and missing parent relationships fail.
|
|
944
1028
|
|
|
945
1029
|
**Cells.** A cell names one owned element or public component (placed through
|
|
946
|
-
its className marker)
|
|
947
|
-
|
|
1030
|
+
its className marker), rendered exactly once by default:
|
|
1031
|
+
|
|
1032
|
+
- `required: false`: the cell may be absent (a page's optional notice). Placed
|
|
1033
|
+
in auto rows, the cells after it move up when it is absent; pinned to a `row`,
|
|
1034
|
+
the row stays, empty, with its gaps (`review/optional-cell-row`).
|
|
1035
|
+
- `repeat: true`: the cell renders once per item of a list (`items.map(…)`),
|
|
1036
|
+
any number of times, at least once unless `required: false`. Its instances
|
|
1037
|
+
flow one after another: it auto-places at every tier (`start: "auto"` is
|
|
1038
|
+
implied) over its `span`, a number or `"full"` (the tier's whole row), and
|
|
1039
|
+
states no start line, `end`, `row` or `rowSpan` (`spec/value-invalid`).
|
|
1040
|
+
- Several or mapped instances may also share a cell that auto-places
|
|
1041
|
+
(`start: "auto"`) at every tier. An auto-placed cell spans a number of tracks
|
|
1042
|
+
or `"full"`; `end` needs a start line.
|
|
948
1043
|
|
|
949
1044
|
- A cell's frame with a fixed inline size, and any owned frame deeper inside it
|
|
950
1045
|
(less the insets between), fits the region the algebra bounds for the cell at
|
|
@@ -1025,6 +1120,49 @@ variants, non-empty, empty and absent. Comparing or indexing designs by its
|
|
|
1025
1120
|
content is an error, as is an unbounded choice. Spreads can pass props to
|
|
1026
1121
|
public components but not to owned elements.
|
|
1027
1122
|
|
|
1123
|
+
### Design state derived from data
|
|
1124
|
+
|
|
1125
|
+
ADS proves design, not data logic. A component that decides its design from
|
|
1126
|
+
data (how many items there are, whether a lookup found one) names that decision
|
|
1127
|
+
as design state, a `const` with an explicit finite type, and branches on it:
|
|
1128
|
+
|
|
1129
|
+
```tsx
|
|
1130
|
+
const overflow: "fits" | "overflows" = members.length > 3 ? "overflows" : "fits";
|
|
1131
|
+
const fourth: Member | undefined = members[3];
|
|
1132
|
+
const open: Space | undefined = spaces.find((space) => space.id === active);
|
|
1133
|
+
```
|
|
1134
|
+
|
|
1135
|
+
The annotation is a finite type (a literal union, a boolean) or an optional
|
|
1136
|
+
object, function or node. When the initializer reads data the analysis does not
|
|
1137
|
+
evaluate, ADS checks every value of the declared type, and given and absent for
|
|
1138
|
+
an optional value; it never evaluates the derivation, which stays the
|
|
1139
|
+
component's own logic. An initializer that does evaluate keeps its exact value.
|
|
1140
|
+
Without the annotation, or with an open type (`string`, `number`), the
|
|
1141
|
+
derivation is not a finite choice (`choice/domain-not-finite`), and neither is
|
|
1142
|
+
content selecting design (`label === "Delete"`). Name one state per decision:
|
|
1143
|
+
two declared states read from the same data are checked as independent, so every
|
|
1144
|
+
combination of them is, including ones the data cannot produce.
|
|
1145
|
+
|
|
1146
|
+
### An element chosen by the caller
|
|
1147
|
+
|
|
1148
|
+
A lowercase JSX tag is an element and a capitalised one a component. A
|
|
1149
|
+
capitalised tag that names a variable holding an element name is that element:
|
|
1150
|
+
a constant (`const Heading = "h3"`), or a prop typed as a union of heading
|
|
1151
|
+
levels, so a component can take the heading level its place in the page needs:
|
|
1152
|
+
|
|
1153
|
+
```tsx
|
|
1154
|
+
export function Questions({ title, level = "h3" }: { title: string; level?: "h2" | "h3" | "h4" }) {
|
|
1155
|
+
const Heading = level;
|
|
1156
|
+
return <section className={questions}><Heading className="ds-questions-heading">{title}</Heading></section>;
|
|
1157
|
+
}
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
Owner analysis treats every heading level alike, so the levels are checked as
|
|
1161
|
+
one heading. A union of unlike elements (`"h3" | "p"`) is not one element: the
|
|
1162
|
+
tag stays a component, and a part it was meant to be is reported missing.
|
|
1163
|
+
Prefer the element's name as the prop's values (`"h2" | "h3"`) to a number
|
|
1164
|
+
that builds it (`` `h${level}` ``), which is not an element name.
|
|
1165
|
+
|
|
1028
1166
|
### Optional callbacks, objects and slots
|
|
1029
1167
|
|
|
1030
1168
|
An optional prop (or mapped item field) whose type is an object, a function or
|
|
@@ -1088,6 +1226,13 @@ profile and owner variant, never per glyph. An owner that takes an icon takes a
|
|
|
1088
1226
|
glyph reference (`closeGlyph`), never a name string. See
|
|
1089
1227
|
[icons and glyph sets](ASSETS.md#icons-and-glyph-sets).
|
|
1090
1228
|
|
|
1229
|
+
The binding is a fragment the owner applies to the part
|
|
1230
|
+
(`recipe({ parts: { visual: { kind: "visual", asset: "mark", visual: "brand-visual" } } })`),
|
|
1231
|
+
or the part's own declaration: a region's visual part, and standalone
|
|
1232
|
+
artwork's one visual part, may state `asset`, `set`, `glyph`, `state` and
|
|
1233
|
+
`visual` themselves, and the owner then reads `recipe.parts.<name>` and
|
|
1234
|
+
`recipe.assets.<name>.source` from that recipe.
|
|
1235
|
+
|
|
1091
1236
|
Button pairs optional glyphs with text. Identity pairs an avatar with a
|
|
1092
1237
|
complete text stack, or brand artwork with baseline-aligned text. The asset's
|
|
1093
1238
|
optical center defaults to [0,0] and is shared across sizes and uses. The slot
|
package/docs/MCP.md
CHANGED
|
@@ -116,7 +116,11 @@ With no registered scenarios the showcase has nothing to open, and
|
|
|
116
116
|
The browser starts from `ads://project/explorer`: a compact snapshot of
|
|
117
117
|
navigation, preview-tool capabilities, draft references and build state. It
|
|
118
118
|
subscribes to index and build changes instead of repeated fetches of full
|
|
119
|
-
semantic catalogues.
|
|
119
|
+
semantic catalogues. The snapshot also lists what each ADS view offers the
|
|
120
|
+
sidebar (token role sheets, profile and asset folders), read from the
|
|
121
|
+
previewed revision's facts; the server announces `ads://project/explorer` when
|
|
122
|
+
an emitted revision changes them, so a sidebar opened before the first preview
|
|
123
|
+
fills in without a reload.
|
|
120
124
|
|
|
121
125
|
- The shell never imports project UI. Every scenario section comes from the
|
|
122
126
|
`ads_scenarios` registry, and the selected scenario opens in a persistent
|
package/docs/MOTION.md
CHANGED
|
@@ -147,6 +147,13 @@ effective motion profile. A `when` entry gives each channel its endpoint,
|
|
|
147
147
|
| `scale` | `scale` | `scale` | Scale 1 | Uniform visual scaling; no frame or hit-area resizing |
|
|
148
148
|
| `rotate` | `rotate` | `angle` | Zero rotation | Positive is clockwise; not reversed for RTL |
|
|
149
149
|
|
|
150
|
+
A turn under a state says something (a plus turned into a cross while its panel
|
|
151
|
+
is open), so reduced motion keeps the turned shape and only drops its animation;
|
|
152
|
+
travel and scale return to rest. A control's artwork takes its effects under
|
|
153
|
+
pointer feedback (`&:hover:not(:disabled)`, `&:active:not(:disabled)`), a busy
|
|
154
|
+
control (`&[aria-busy="true"]`) and the two toggle states a control shows by its
|
|
155
|
+
artwork (`&[aria-expanded="true"]`, `&[aria-pressed="true"]`).
|
|
156
|
+
|
|
150
157
|
The neutral values are operation identities, not authored offsets. A motion
|
|
151
158
|
distance never becomes a static alignment correction or replaces an asset's
|
|
152
159
|
optical center.
|
|
@@ -290,8 +297,9 @@ recipe({
|
|
|
290
297
|
motion profile's `distance`), `scale`, and `scaleInline` or `scaleBlock` for
|
|
291
298
|
one axis only with the other at rest (a blink closes on the block axis); the
|
|
292
299
|
three scales read the profile's `scale` and are one channel, so a state takes
|
|
293
|
-
one of them.
|
|
294
|
-
|
|
300
|
+
one of them. `rotate` turns the part in place by the profile's `angle`. A
|
|
301
|
+
control's visual part takes the same scales and `rotate`.
|
|
302
|
+
- `transition` lists the channels that animate: `translate`, `scale`, `rotate`. An effect
|
|
295
303
|
whose channel is not listed applies at once. A listed channel without an
|
|
296
304
|
effect is refused.
|
|
297
305
|
- `motion` on the part names its motion profile; without it the part takes the
|
|
@@ -339,8 +347,11 @@ recipe({
|
|
|
339
347
|
state (`when`), not an entrance (`construction/enter-surface-unsupported`).
|
|
340
348
|
- `from` may also name one movement, read from the entrance's motion profile:
|
|
341
349
|
`translate` (its `distance`, on the block axis: a positive distance starts
|
|
342
|
-
below and rises), `
|
|
343
|
-
|
|
350
|
+
below and rises), `translateInline` (its `distance`, on the inline axis: a
|
|
351
|
+
positive distance starts toward the inline end and slides to the start, so a
|
|
352
|
+
pushed screen comes in from the side; mirrored under `:dir(rtl)`), `scale`
|
|
353
|
+
(its `scale`) or `rotate` (its `angle`). `from` needs a surface, a movement
|
|
354
|
+
or both.
|
|
344
355
|
- `motion` is a motion profile name or `{ slot: "motion" }` (the nearest
|
|
345
356
|
recipe's motion slot). It needs a duration, an easing and `reduced: "static"`.
|
|
346
357
|
- A staggered entrance is each part with its own motion profile carrying a
|