@reqvire-org/ads 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ads-errors.mjs +105 -8
- package/dist/analysis/client-directive.mjs +26 -0
- package/dist/analysis/externals.mjs +47 -0
- package/dist/analysis/module-graph.mjs +6 -0
- package/dist/analysis/owner-analysis-key.mjs +1 -1
- package/dist/analysis/owner-choices.mjs +14 -2
- package/dist/analysis/owner-composition.mjs +32 -4
- package/dist/analysis/owner-source.mjs +121 -17
- package/dist/border-paint.mjs +34 -0
- package/dist/check.mjs +2 -0
- package/dist/composed-contrast.mjs +34 -12
- package/dist/construction-output.mjs +58 -31
- package/dist/construction-spec.d.mts +111 -15
- package/dist/construction-spec.mjs +129 -20
- package/dist/corner-overpaint.mjs +3 -1
- package/dist/design-foundation.mjs +18 -4
- package/dist/emit/owner-emission-cache.mjs +1 -1
- package/dist/end-alignment.mjs +69 -0
- package/dist/external-macro.d.mts +20 -0
- package/dist/external-macro.mjs +12 -0
- package/dist/finding-rules.mjs +3 -0
- package/dist/forced-colors.mjs +81 -0
- package/dist/frame-regions.mjs +2 -2
- package/dist/guard/externals.mjs +64 -0
- package/dist/guard/run.mjs +9 -5
- package/dist/inventories.mjs +1 -1
- package/dist/lowering-layer.mjs +38 -4
- package/dist/lowering-overlaps.mjs +13 -1
- package/dist/lowering-properties.mjs +4 -0
- package/dist/lowering-region-layout.mjs +22 -3
- package/dist/lowering-session.mjs +1 -1
- package/dist/lowering-transitions.mjs +1 -0
- package/dist/mcp/preview-http.bundle.js +2 -2
- package/dist/mcp/preview-widget.bundle.js +12 -12
- package/dist/measured-geometry.mjs +8 -2
- package/dist/owner-analysis-check.mjs +190 -11
- package/dist/owner-errors.mjs +3 -0
- package/dist/owner-lowering.mjs +3 -2
- package/dist/ownership-model.mjs +14 -5
- package/dist/platform-features.mjs +7 -0
- package/dist/preview-bun.mjs +15 -2
- package/dist/profile-macro.d.mts +18 -0
- package/dist/recipe-macro.d.mts +107 -9
- package/dist/recipe-model.mjs +22 -8
- package/dist/region-lowering.mjs +204 -49
- package/dist/render-audit/axe-run.page.mjs +40 -1
- package/dist/render-audit/forced-states.page.mjs +37 -0
- package/dist/render-audit/layout-overflow.page.mjs +52 -2
- package/dist/render-audit/non-text-contrast.page.mjs +14 -10
- package/dist/render-audit/worker.mjs +38 -0
- package/dist/render-audit.mjs +42 -5
- package/dist/role-vocabulary.d.mts +5 -2
- package/dist/role-vocabulary.mjs +6 -3
- package/dist/scenario-kit.d.mts +2 -2
- package/dist/showcase/assets-view.mjs +12 -47
- package/dist/showcase/client.bundle.js +50 -50
- package/dist/showcase/http-client.bundle.js +18 -18
- package/dist/showcase/token-sample.mjs +2 -2
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +13 -13
- package/dist/skills/ads-designer/references/accessibility.md +21 -1
- package/dist/skills/ads-designer/references/branding.md +4 -0
- package/dist/skills/ads-designer/references/design-data.md +6 -0
- package/dist/skills/ads-designer/references/layers.md +5 -0
- package/dist/skills/ads-designer/references/layout.md +8 -1
- package/dist/skills/ads-designer/references/recipes.md +52 -2
- package/dist/skills/ads-designer/references/runtimes.md +4 -0
- package/dist/skills/ads-designer/references/scenarios.md +2 -0
- package/dist/skills/ads-import/references/design-data.md +6 -0
- package/dist/skills/ads-import/references/layers.md +5 -0
- package/dist/skills/ads-import/references/layout.md +8 -1
- package/dist/skills/ads-import/references/recipes.md +52 -2
- package/dist/skills/ads-import/references/runtimes.md +4 -0
- package/dist/skills/ads-import/references/scenarios.md +2 -0
- package/dist/skills/ads-migrate/SKILL.md +2 -0
- package/dist/skills/ads-migrate/references/0.5.3-to-0.5.4.md +42 -0
- package/dist/skills/ads-migrate/references/0.5.4-to-0.5.5.md +61 -0
- package/dist/skills/ads-port/references/design-data.md +6 -0
- package/dist/skills/ads-port/references/layers.md +5 -0
- package/dist/skills/ads-port/references/layout.md +8 -1
- package/dist/skills/ads-port/references/recipes.md +52 -2
- package/dist/skills/ads-port/references/runtimes.md +4 -0
- package/dist/skills/ads-port/references/scenarios.md +2 -0
- package/dist/spatial-model.mjs +37 -10
- package/dist/system-colors.d.mts +9 -0
- package/dist/system-colors.mjs +1 -0
- package/dist/target-size.mjs +14 -1
- package/dist/tsconfig.declarations.json +1 -0
- package/docs/ADS.md +23 -1
- package/docs/ASSETS.md +21 -0
- package/docs/CACHING.md +1 -1
- package/docs/CHANGELOG.md +220 -21
- package/docs/GUIDE.md +31 -20
- package/docs/LANGUAGE.md +146 -11
- package/docs/MOTION.md +11 -1
- package/docs/PROFILE-KINDS.md +60 -9
- package/docs/RULES.md +21 -8
- package/package.json +5 -1
|
@@ -145,7 +145,7 @@ code: an attribute it sets (`data-dragging`, `aria-busy`) or a native state;
|
|
|
145
145
|
a recipe never creates a state machine.
|
|
146
146
|
|
|
147
147
|
- `paintTransition` interpolates `background-color`, `border-color`, `color`,
|
|
148
|
-
`box-shadow`, `filter` (the surface's `blur`, `shapeShadow`, `groupShadow`)
|
|
148
|
+
`text-decoration-color` (a link's underline, the surface's `textDecorationColor`), `box-shadow`, `filter` (the surface's `blur`, `shapeShadow`, `groupShadow`)
|
|
149
149
|
or `backdrop-filter` (`backdropBlur`, `backdropSaturate`) between the base
|
|
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
|
|
@@ -164,7 +164,24 @@ a recipe never creates a state machine.
|
|
|
164
164
|
never inject an HTML string. A colour that follows the container (a link in a
|
|
165
165
|
heading) is the container surface's `provides`, not a prop on the link. A list
|
|
166
166
|
item keeps its marker: give it no arrangement, and space a nested list with a
|
|
167
|
-
part's `spaceBefore` in its block flow.
|
|
167
|
+
part's `spaceBefore` in its block flow. A flow that needs many distances gives
|
|
168
|
+
each part its own spacing profile (`spacing: "h2-spacing"` with
|
|
169
|
+
`spaceBefore`/`spaceAfter`). A paragraph or heading part has its browser margin
|
|
170
|
+
reset automatically.
|
|
171
|
+
- Markers: `pseudo: { marker: { surface, text } }` on the list item (a colour-only
|
|
172
|
+
surface, a text profile of weight and numerals) and `markers: [...]` on the
|
|
173
|
+
list (number system per depth). Numbering that the browser's list counter
|
|
174
|
+
cannot give (1.1.2 clauses, numbered headings) is a CSS counter: `counter: {
|
|
175
|
+
reset }` on the container, `counter: { increment }` on each item, and
|
|
176
|
+
`content: { counters | counter, separator, suffix }` on its `marker` or
|
|
177
|
+
`before`. Check marks are a visual part in the item, not a marker.
|
|
178
|
+
- A code block either keeps each line whole and scrolls (`overflow: "scroll-inline"`, focusable) or keeps the text's
|
|
179
|
+
spaces and line breaks and wraps long lines so all of it is visible (`wrap: "preserve"` on its code text). Choose
|
|
180
|
+
by what matters more: lines that read exactly as written, or nothing hidden.
|
|
181
|
+
- A rule between children (table rows, settings rows) is `between: { surface,
|
|
182
|
+
frame }` on their parent, never borders on each child with a last-child
|
|
183
|
+
exception. Text only assistive technology reads (a table caption) is a part
|
|
184
|
+
with `presence: "assistive"`.
|
|
168
185
|
- A colour that depends on where an element sits (links and icons in a tinted
|
|
169
186
|
banner, the cells of a selected row, actions on a dark card) is a contextual
|
|
170
187
|
role: the container's surface profile `provides: { "--link-ink": "--on-warning" }`.
|
|
@@ -262,6 +279,21 @@ fragment or a native frame-only element.
|
|
|
262
279
|
`mandatory` or `proximity`), aligning the children it places. Snap without
|
|
263
280
|
scrolling, or a child's own snap, is rejected.
|
|
264
281
|
|
|
282
|
+
- **Distribution and gaps.** `justify: "space-between"` (or `"space-around"`, `"space-evenly"`) puts a row's or
|
|
283
|
+
stack's free space between its items: a logo at the start of a header and its actions at the end. On a wrapping
|
|
284
|
+
`inline` row, `gap` spaces the items and `rowGap` the lines.
|
|
285
|
+
- **Loose flow.** `carry: true` on a list and on its item: an item that ends in a paragraph, code block or figure is
|
|
286
|
+
followed at the larger of the list's gap and that block's space after; after the last item the list's own space
|
|
287
|
+
after applies.
|
|
288
|
+
- **Filling parts.** `extent: "fill"` in a stack starts at the part's content and grows into free space, so a
|
|
289
|
+
scrolling body never collapses in a stack sized by its content.
|
|
290
|
+
- **End alignment.** Blocks a stack holds end on one line (`source/end-misaligned`): a painted block by its outer
|
|
291
|
+
edge, an unpainted one where its content ends. Put a header on the same grid and gutter as the sections below it.
|
|
292
|
+
- **Tables.** `align: "start"` on a cell (`vertical-align: top` for rows whose cells wrap to different heights);
|
|
293
|
+
`extent: "container"` on a table root makes it as wide as its container.
|
|
294
|
+
- **The document.** One pattern may render the page's `<html>`: `recipe({ element: "document" })`, with `lang`
|
|
295
|
+
from a required prop, `<body>` inside, and the framework's `head` and `end` slots.
|
|
296
|
+
|
|
265
297
|
<a id="layers"></a>
|
|
266
298
|
## Layers
|
|
267
299
|
|
|
@@ -286,6 +318,10 @@ A region recipe's root can live in the browser's top layer through a closed
|
|
|
286
318
|
no authored `open` on a sheet, an accessible name, and no layer root as a grid
|
|
287
319
|
cell. Focus, Escape and dismissal are behaviour guarantees for browser tests.
|
|
288
320
|
|
|
321
|
+
- **Modal cards.** A dialog with `edge: "center"` or `"block-start"` is a card in the viewport, kept the layer
|
|
322
|
+
profile's `viewportMargin` from its edges, fading in with `motion: "fade"`. The backdrop surface may set
|
|
323
|
+
`backdropBlur`. A zoom view grows an image from its place with a measured `translate` and a measured `scale`.
|
|
324
|
+
|
|
289
325
|
<a id="measured"></a>
|
|
290
326
|
## Measured values and runtime paints
|
|
291
327
|
|
|
@@ -361,6 +397,14 @@ text part breaks one way, set by one `wrap` field:
|
|
|
361
397
|
its alignment, on a control's label too. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
362
398
|
spacing in a browser without them.
|
|
363
399
|
|
|
400
|
+
- **Code that wraps.** `wrap: "preserve"` keeps spaces and line breaks and wraps long lines, so the whole block is
|
|
401
|
+
visible; `overflow: "scroll-inline"` keeps lines whole instead.
|
|
402
|
+
- **Truncation.** One-line `wrap: "truncate"` clips only sideways, so descenders stay whole with a trimmed line box.
|
|
403
|
+
- **Native controls.** A `<button>`, `<input>`, `<textarea>` or `<select>` that a construction draws loses the
|
|
404
|
+
browser's font, centred text, border, fill and margin wherever the construction states none.
|
|
405
|
+
- **Range sliders.** `pseudo: { sliderTrack, sliderThumb }` on an `<input type="range">` part, each a surface and a
|
|
406
|
+
frame profile; the thumb needs 3:1 against the track. Tick labels are a `space-between` row.
|
|
407
|
+
|
|
364
408
|
<a id="assets"></a>
|
|
365
409
|
## Assets in recipes
|
|
366
410
|
|
|
@@ -374,6 +418,12 @@ glyph reference, never a name string. Brand artwork and multicolour drawings
|
|
|
374
418
|
are declared under `assets/`: see `ads://guides/branding` and
|
|
375
419
|
`ads://guides/pictograms`.
|
|
376
420
|
|
|
421
|
+
- **A logo per colour scheme.** Two visual parts, `scheme: "light"` and `scheme: "dark"`, each bound for a theme of
|
|
422
|
+
that scheme, follow the page's scheme with no `theme` prop.
|
|
423
|
+
- **Content media.** An `<img>` or a `<video>` without a binding is application media; `sizeAxis: "inline"` on its
|
|
424
|
+
visual profile caps its width (logo strips) instead of its height.
|
|
425
|
+
- **A drawing picked by state.** `const glyph = open ? closeGlyph : arrowGlyph`, drawn with `glyph.source`, is fine.
|
|
426
|
+
|
|
377
427
|
<a id="rejected"></a>
|
|
378
428
|
## What is rejected, and why
|
|
379
429
|
|
|
@@ -43,6 +43,10 @@ ADS's `lint:ds` script runs `ads check .` and `emit:ds` runs `ads emit`. ADS gat
|
|
|
43
43
|
do not require Oxlint. Projects can run their chosen linter through their own
|
|
44
44
|
explicitly configured check scripts. Init preserves application scripts.
|
|
45
45
|
|
|
46
|
+
**`"use client"`** is ADS's to write: an emitted owner that calls a hook or handles an event starts with it, a
|
|
47
|
+
presentational one does not and renders in a React Server Component. Don't write it by hand; one written where
|
|
48
|
+
nothing needs it is a review item.
|
|
49
|
+
|
|
46
50
|
## MCP connection
|
|
47
51
|
|
|
48
52
|
Choose [direct code editing or MCP-only editing](workflows.md) independently of
|
|
@@ -112,6 +112,8 @@ import { Container, EventLog, Placeholder, useEvents, type Scenario } from "@req
|
|
|
112
112
|
Token, icon and brand preview pages are not scenarios: the generated Tokens,
|
|
113
113
|
Profiles and Artwork views show them.
|
|
114
114
|
|
|
115
|
+
`Container inline: "phone"` is 390px, the phone-viewport tool's width: use it, not the 360px column, for a phone.
|
|
116
|
+
|
|
115
117
|
## Files and identities
|
|
116
118
|
|
|
117
119
|
A scenario's id is the design-system-relative path without `.ads.scenario.*`; a canonical
|
package/dist/spatial-model.mjs
CHANGED
|
@@ -73,7 +73,18 @@ export function spatialModel(input, values) {
|
|
|
73
73
|
for (const [mode, declared] of Object.entries(declaredGutters)) {
|
|
74
74
|
if (!name.test(mode))
|
|
75
75
|
fail(`Invalid gutter mode ${mode}.`);
|
|
76
|
-
const edges = closed(declared, ["start", "end"], "Gutter")
|
|
76
|
+
const edges = closed(declared, ["start", "end", "gap"], "Gutter");
|
|
77
|
+
if (edges.gap !== void 0) {
|
|
78
|
+
if (edges.start !== void 0 || edges.end !== void 0)
|
|
79
|
+
fail(`${mode} is a gap gutter or an edge gutter, not both.`);
|
|
80
|
+
const gap = token(edges.gap), gapPx = length(gap);
|
|
81
|
+
for (const point of breakpoints)
|
|
82
|
+
if (point.fromPx - point.marginPx * 2 <= gapPx * (point.count - 1))
|
|
83
|
+
fail(`${mode} gaps leave no track width at ${point.name}.`);
|
|
84
|
+
gutters[mode] = { start: "0", end: "0", gap };
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const start = token(edges.start), startPx = length(start), end = token(edges.end), inset = startPx + length(end);
|
|
77
88
|
for (const point of breakpoints)
|
|
78
89
|
if ((point.fromPx - point.marginPx * 2) / point.count < inset)
|
|
79
90
|
fail(`${mode} cell insets exceed a track at ${point.name}.`);
|
|
@@ -97,7 +108,7 @@ export function spatialModel(input, values) {
|
|
|
97
108
|
return px;
|
|
98
109
|
} };
|
|
99
110
|
}
|
|
100
|
-
const regionKeys = ["columns", "weights", "gutter", "row-gap", "margin", "bound", "tile", "ratio", "fixed-start", "fixed-end", "context", "rows", "align", "overlay-layer"], trackKeys = ["fixed-start", "fixed-end"], placementKeys = ["start", "span", "end", "overlay", "row", "row-span", "visible"], cellKeys = [...placementKeys, "padding", "ratio", "container"];
|
|
111
|
+
const regionKeys = ["columns", "weights", "gutter", "row-gap", "margin", "bound", "tile", "ratio", "fixed-start", "fixed-end", "context", "rows", "align", "overlay-layer", "content-from"], trackKeys = ["fixed-start", "fixed-end"], placementKeys = ["start", "span", "end", "overlay", "row", "row-span", "visible"], cellKeys = [...placementKeys, "padding", "ratio", "container"];
|
|
101
112
|
function declarations(node, allowed) {
|
|
102
113
|
const result = {}, isAllowed = (prop) => allowed.includes(prop);
|
|
103
114
|
for (const child of node.nodes ?? [])
|
|
@@ -114,8 +125,8 @@ function declarations(node, allowed) {
|
|
|
114
125
|
const isAtRule = (node) => node.type === "atrule", cssToken = (value) => value === "0" ? "0" : `var(${value})`, append = (node, property, value) => {
|
|
115
126
|
node.append(postcss.decl({ prop: property, value: String(value) }));
|
|
116
127
|
}, selector = (value) => /^\.[a-zA-Z_][\w-]*$|^\[data-[\w-]+=["'][\w-]+["']\]$/.test(value), regionContainer = "ads-region", overlaySides = ["none", "start", "end"], layoutModes = ["fluid", "hybrid", "fixed", "flow", "inherited"], isLayoutMode = (value) => layoutModes.includes(value);
|
|
117
|
-
function regionTracks(model, props, point, mode, tracks, fixedTracks) {
|
|
118
|
-
const count = Number(props.columns ?? point.count), margin = model.length(props.margin ?? point.margin), cap = props.bound === "full" ? 1 / 0 : model.length(!props.bound || props.bound === "system" ? model.maxWidth : props.bound, !0), width = Math.min(point.fromPx, cap) - 2 * margin;
|
|
128
|
+
function regionTracks(model, props, point, mode, tracks, fixedTracks, gap = 0) {
|
|
129
|
+
const count = Number(props.columns ?? point.count), margin = model.length(props.margin ?? point.margin), cap = props.bound === "full" ? 1 / 0 : model.length(!props.bound || props.bound === "system" ? model.maxWidth : props.bound, !0), width = Math.min(point.fromPx, cap) - 2 * margin - gap * (count - 1);
|
|
119
130
|
if (width <= 0)
|
|
120
131
|
fail(`Region bounds and margins leave no content width at ${point.name}.`);
|
|
121
132
|
if (mode !== "hybrid") {
|
|
@@ -210,10 +221,19 @@ function expand(css, model) {
|
|
|
210
221
|
fail("Inherited tracks keep their parent's span and bounds.");
|
|
211
222
|
if (props.weights !== void 0 && mode !== "fluid")
|
|
212
223
|
fail("Track weights belong to a fluid region with local columns.");
|
|
213
|
-
const
|
|
214
|
-
if (
|
|
224
|
+
const contentFrom = props["content-from"] === void 0 ? null : system.breakpoints.findIndex((point) => point.name === props["content-from"]);
|
|
225
|
+
if (contentFrom !== null && mode !== "fluid")
|
|
226
|
+
fail("contentFrom belongs to a fluid region.");
|
|
227
|
+
if (contentFrom === -1)
|
|
228
|
+
fail(`contentFrom names no breakpoint tier: ${String(props["content-from"])}.`);
|
|
229
|
+
if (contentFrom === 0)
|
|
230
|
+
fail("contentFrom needs a tier below it: there the columns share the width, for when their content does not fit side by side.");
|
|
231
|
+
if (contentFrom !== null && props.weights !== void 0)
|
|
232
|
+
fail("contentFrom and weights are two ways to size columns: choose one.");
|
|
233
|
+
const gutter = props.gutter ?? "wide", declaredGutter = gutter === "none" ? null : system.gutters[gutter];
|
|
234
|
+
if (gutter !== "none" && !declaredGutter)
|
|
215
235
|
fail(`Unknown gutter ${gutter}.`);
|
|
216
|
-
const spacing = (value) => {
|
|
236
|
+
const trackGap = declaredGutter?.gap ?? null, edges = trackGap === null ? declaredGutter : null, spacing = (value) => {
|
|
217
237
|
if (value !== "0")
|
|
218
238
|
system.length(value);
|
|
219
239
|
return cssToken(value);
|
|
@@ -296,7 +316,7 @@ function expand(css, model) {
|
|
|
296
316
|
append(output, "flex-direction", "column");
|
|
297
317
|
append(output, "row-gap", rowGap);
|
|
298
318
|
if (mode !== "flow")
|
|
299
|
-
append(output, "column-gap", mode === "fixed" ? rowGap : "0");
|
|
319
|
+
append(output, "column-gap", mode === "fixed" ? rowGap : mode === "inherited" ? "normal" : trackGap === null ? "0" : spacing(trackGap));
|
|
300
320
|
if (props.ratio)
|
|
301
321
|
append(output, "aspect-ratio", props.ratio.replace(":", " / "));
|
|
302
322
|
if (rows)
|
|
@@ -324,12 +344,16 @@ function expand(css, model) {
|
|
|
324
344
|
} else {
|
|
325
345
|
const count = Number(props.columns ?? point.count), margin = spacing(props.margin ?? point.margin), variant = trackVariants.get(point.name) ?? {};
|
|
326
346
|
tracks = { start: variant["fixed-start"] ?? tracks.start, end: variant["fixed-end"] ?? tracks.end };
|
|
327
|
-
const widths = regionTracks(system, props, point, mode, tracks, fixedTracks), insets = edges ? system.length(edges.start) + system.length(edges.end) : 0;
|
|
347
|
+
const gapPx = trackGap === null ? 0 : system.length(trackGap), widths = regionTracks(system, props, point, mode, tracks, fixedTracks, gapPx), insets = edges ? system.length(edges.start) + system.length(edges.end) : 0, contentSized = contentFrom !== null && index >= contentFrom;
|
|
328
348
|
for (const item of cellModels) {
|
|
329
349
|
const placement = item.placements[index];
|
|
330
350
|
if (!placement)
|
|
331
351
|
continue;
|
|
332
|
-
|
|
352
|
+
if (contentSized) {
|
|
353
|
+
region(item.cell.params, point, placement.visible ? { kind: "content" } : { kind: "hidden" });
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
const total = (from) => widths.slice(from, from + placement.span).reduce((sum, value) => sum + value, 0) + gapPx * (placement.span - 1), spanWidth = placement.overlay !== "none" ? widths.reduce((sum, value) => sum + value, 0) + gapPx * (widths.length - 1) : placement.auto ? Math.min(...Array.from({ length: count - placement.span + 1 }, (_, from) => total(from))) : total(placement.start - 1);
|
|
333
357
|
region(item.cell.params, point, !placement.visible ? { kind: "hidden" } : { kind: "px", px: item.nested.length ? spanWidth : spanWidth - insets });
|
|
334
358
|
if (!edges || item.nested.length || placement.overlay !== "none")
|
|
335
359
|
continue;
|
|
@@ -339,6 +363,9 @@ function expand(css, model) {
|
|
|
339
363
|
if (mode === "hybrid") {
|
|
340
364
|
const fluidCount = count - fixedTracks.length;
|
|
341
365
|
append(rule, "grid-template-columns", [tracks.start === void 0 ? "" : spacing(tracks.start), `repeat(${fluidCount}, minmax(0, 1fr))`, tracks.end === void 0 ? "" : spacing(tracks.end)].filter(Boolean).join(" "));
|
|
366
|
+
} else if (contentSized) {
|
|
367
|
+
append(rule, "grid-template-columns", `repeat(${count}, minmax(min-content, auto))`);
|
|
368
|
+
append(rule, "justify-content", "space-between");
|
|
342
369
|
} else if (props.weights !== void 0)
|
|
343
370
|
append(rule, "grid-template-columns", trackWeights(props, count).map((weight) => `minmax(0, ${weight}fr)`).join(" "));
|
|
344
371
|
else
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The CSS system colours a surface may declare for forced colours. */
|
|
2
|
+
export declare const SYSTEM_COLORS: readonly ["Canvas", "CanvasText", "Highlight", "HighlightText", "ButtonFace", "ButtonText", "LinkText", "GrayText", "AccentColor", "AccentColorText"];
|
|
3
|
+
export type SystemColor = (typeof SYSTEM_COLORS)[number];
|
|
4
|
+
/** The macro's `forcedColors` keys, as profile fields. */
|
|
5
|
+
export declare const FORCED_KEYS: {
|
|
6
|
+
readonly background: "forced-colors-background";
|
|
7
|
+
readonly color: "forced-colors-color";
|
|
8
|
+
readonly border: "forced-colors-border";
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SYSTEM_COLORS = ["Canvas", "CanvasText", "Highlight", "HighlightText", "ButtonFace", "ButtonText", "LinkText", "GrayText", "AccentColor", "AccentColorText"], FORCED_KEYS = { background: "forced-colors-background", color: "forced-colors-color", border: "forced-colors-border" };
|
package/dist/target-size.mjs
CHANGED
|
@@ -117,11 +117,14 @@ function contentWidth(content) {
|
|
|
117
117
|
}
|
|
118
118
|
const undersized = (box) => box.block < TARGET_MIN_PX || box.inline.px < TARGET_MIN_PX;
|
|
119
119
|
function spaced(geometry, pairs, context) {
|
|
120
|
+
return spacedFrom(geometry, pairs.map((pair) => ({ axis: pair.axis, gap: pair.gap, other: pair.first.element === geometry.element ? pair.second : pair.first })), context);
|
|
121
|
+
}
|
|
122
|
+
function spacedFrom(geometry, pairs, context) {
|
|
120
123
|
if (pairs.length === 0)
|
|
121
124
|
return !1;
|
|
122
125
|
const radius = TARGET_MIN_PX / 2;
|
|
123
126
|
return pairs.every((pair) => {
|
|
124
|
-
const own = measure(geometry, context), other = measure(pair.
|
|
127
|
+
const own = measure(geometry, context), other = measure(pair.other, context), gap = lengthPx(pair.gap, context);
|
|
125
128
|
if (own.kind !== "measured" || other.kind !== "measured" || gap.kind !== "px")
|
|
126
129
|
return !1;
|
|
127
130
|
const along = (box) => pair.axis === "inline" ? box.inline.px : box.block, half = along(own.size.target) / 2, otherHalf = along(other.size.target) / 2;
|
|
@@ -160,6 +163,16 @@ function elementFindings(geometry, contexts, pairs) {
|
|
|
160
163
|
findings.push({ kind: "target-size-unresolved", element: geometry.element, contexts: unproven.contexts, reason: unproven.first });
|
|
161
164
|
return findings;
|
|
162
165
|
}
|
|
166
|
+
export function placedSpaced(foundation, geometry, neighbours) {
|
|
167
|
+
if (neighbours.length === 0)
|
|
168
|
+
return !1;
|
|
169
|
+
return tokenValueContexts(foundation).every((context) => {
|
|
170
|
+
const read = measure(geometry, context);
|
|
171
|
+
if (read.kind !== "measured")
|
|
172
|
+
return !1;
|
|
173
|
+
return !undersized(read.size.target) || spacedFrom(geometry, neighbours, context);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
163
176
|
function reach(size, axis) {
|
|
164
177
|
const own = axis === "inline" ? size.own.inline : { px: size.own.block, exact: !0 }, hit = axis === "inline" ? size.hit.inline : size.hit.block;
|
|
165
178
|
return { px: Math.max(0, (hit - own.px) / 2), exact: own.exact };
|
package/docs/ADS.md
CHANGED
|
@@ -290,6 +290,18 @@ See [LANGUAGE.md](LANGUAGE.md#spatial-construction-and-public-alignment).
|
|
|
290
290
|
placed in such a cell is held to the same by its root frame, across owners
|
|
291
291
|
(`component-keyline`; a root ADS cannot read is `component-keyline-unresolved`).
|
|
292
292
|
Controls, frames without inline padding and `gutter: "none"` grids are exempt.
|
|
293
|
+
- Blocks a stack holds end on one line: a block that paints a box by its outer
|
|
294
|
+
edge, one that does not where its content ends (its frame's inline end
|
|
295
|
+
padding, a grid's gutter end); a block more than 1px and at most 64px off its
|
|
296
|
+
siblings fails at the stack (`source/end-misaligned`). Text is not compared.
|
|
297
|
+
- A part with a background or a border of its own does not reach a rounded
|
|
298
|
+
corner of an unclipped, uninset root (`construction/corner-overpaint`). A
|
|
299
|
+
frame that draws a border has a border paint on its element's surface
|
|
300
|
+
(`review/border-paint-missing`).
|
|
301
|
+
- The document's text profile states its font family, size and line height
|
|
302
|
+
(`foundation/document-text-incomplete`). A `<button>`, `<input>`,
|
|
303
|
+
`<textarea>` or `<select>` a construction draws resets the browser's font,
|
|
304
|
+
alignment, border, fill and margin where the construction states none.
|
|
293
305
|
- Every declared spatial profile, selected or not, reads through the grid
|
|
294
306
|
algebra in the base context and in every theme, brand and condition context
|
|
295
307
|
that changes a token it reads (`spatial-profile-invalid`). Every grid
|
|
@@ -318,7 +330,17 @@ Accessibility follows WCAG 2.2 AA.
|
|
|
318
330
|
document surface (`a11y-focus`).
|
|
319
331
|
- Every control and control-frame part is a 24 × 24px target computed from its
|
|
320
332
|
lowered box, an owned `min-target-*` hit area included, without overlapping
|
|
321
|
-
neighbouring hit areas (`a11y-target-size`).
|
|
333
|
+
neighbouring hit areas (`a11y-target-size`); a smaller one passes 2.5.8's
|
|
334
|
+
spacing exception in its arrangement, or as a private control placed only
|
|
335
|
+
between spaced neighbours.
|
|
336
|
+
- In forced colours (Windows contrast themes) every control keeps an edge: its
|
|
337
|
+
frame draws a border, or `borderStyle: "forced-only"`; a surface's
|
|
338
|
+
`forcedColors` names CSS system colours (`a11y-forced-colors`). A selected,
|
|
339
|
+
pressed, checked or current state shown only by fill is reviewed
|
|
340
|
+
(`a11y-forced-colors-review`).
|
|
341
|
+
- Text and icons are proven against the surfaces they sit on through every
|
|
342
|
+
placement and provided role (`component-contrast`); text and artwork hidden
|
|
343
|
+
with `aria-hidden` is decoration and has no minimum.
|
|
322
344
|
- Icon-only control choices are named (`a11y-icon-label`), and every `<img>` has
|
|
323
345
|
`alt` (`a11y-image-alt`).
|
|
324
346
|
- A toggle's `aria-pressed` agrees with the `selected` state its artwork draws
|
package/docs/ASSETS.md
CHANGED
|
@@ -378,6 +378,27 @@ declared asset by group and every glyph set with its members, each drawn from
|
|
|
378
378
|
its authored SVG in the preview's theme
|
|
379
379
|
([guide](GUIDE.md#showcase)). `ads check` and `ads_catalog` report them too.
|
|
380
380
|
|
|
381
|
+
## Declared artwork that follows the page's scheme
|
|
382
|
+
|
|
383
|
+
A logo with a drawing per colour scheme (black on light, white on dark) can
|
|
384
|
+
follow the page's scheme with no `theme` prop: the owner renders both drawings
|
|
385
|
+
in two visual parts, `scheme: "light"` and `scheme: "dark"`, each bound for a
|
|
386
|
+
theme of that scheme, and the scheme switch `foundation.css` writes displays
|
|
387
|
+
one, as for a content image pair below. A binding of the other scheme is
|
|
388
|
+
`source/scheme-image-element`. An exact theme's drawing (a high-contrast one) is
|
|
389
|
+
chosen by a `theme` the owner passes, as before.
|
|
390
|
+
|
|
391
|
+
```tsx
|
|
392
|
+
const anatomy = recipe({ layout: "inline", parts: {
|
|
393
|
+
light: { selector: ".logo-light", required: true, kind: "visual", scheme: "light" },
|
|
394
|
+
dark: { selector: ".logo-dark", required: true, kind: "visual", scheme: "dark" },
|
|
395
|
+
} }).root;
|
|
396
|
+
const light = recipe({ theme: "light", parts: { visual: { kind: "visual", asset: "openai", visual: "product-logo" } } });
|
|
397
|
+
const dark = recipe({ theme: "dark", parts: { visual: { kind: "visual", asset: "openai", visual: "product-logo" } } });
|
|
398
|
+
// <span className={anatomy}><span className={`logo-light ${light.parts.visual}`}><img src={light.assets.visual.source} alt="OpenAI" /></span>
|
|
399
|
+
// <span className={`logo-dark ${dark.parts.visual}`}><img src={dark.assets.visual.source} alt="OpenAI" /></span></span>
|
|
400
|
+
```
|
|
401
|
+
|
|
381
402
|
## A content image with a light and a dark file
|
|
382
403
|
|
|
383
404
|
Declared artwork selects its drawing by theme at compile time, from its
|
package/docs/CACHING.md
CHANGED
|
@@ -173,7 +173,7 @@ the profile declarations already in its key. The composed contrast join over
|
|
|
173
173
|
every owner's facts belongs to the revision's memoized check, not to an owner's
|
|
174
174
|
entry: a token edit reuses every owner analysis and reruns only the join (stage
|
|
175
175
|
`composed-contrast`), and an owner edit changes that owner's facts alone. The
|
|
176
|
-
outcome schema is `ads-owner-analysis/
|
|
176
|
+
outcome schema is `ads-owner-analysis/14` (it carries each owner's closed props for the showcase's live controls, the assets it draws with the size of each, which value of each prop a placement that leaves the prop out selects, each element's marker and generated-content colours, and which elements are visual parts); it includes the composition facts and
|
|
177
177
|
the profile/choice inventory `design`.
|
|
178
178
|
|
|
179
179
|
- Settled outcomes (facts or a deterministic analysis failure) are reused;
|