@reqvire-org/ads 0.5.9 → 0.5.11
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 +68 -4
- package/dist/analysis/owner-source.mjs +16 -2
- package/dist/asset-declaration.d.mts +5 -0
- package/dist/asset-declaration.mjs +8 -2
- package/dist/asset-model.mjs +3 -0
- package/dist/construction-output.mjs +36 -7
- package/dist/construction-spec.d.mts +109 -10
- package/dist/construction-spec.mjs +173 -45
- package/dist/end-alignment.mjs +17 -2
- package/dist/form-states.mjs +2 -2
- package/dist/grid-lowering.mjs +24 -1
- package/dist/lowering-layer.mjs +11 -10
- package/dist/lowering-overlaps.mjs +5 -3
- package/dist/lowering-properties.mjs +13 -1
- package/dist/lowering-region-layout.mjs +4 -4
- package/dist/lowering-sequence.mjs +6 -2
- package/dist/measured-geometry.mjs +15 -3
- package/dist/owner-analysis-check.mjs +3 -0
- package/dist/owner-errors.mjs +6 -0
- package/dist/ownership-model.mjs +34 -9
- package/dist/platform-features.mjs +12 -0
- package/dist/press-scale.mjs +3 -1
- package/dist/profile-macro.d.mts +5 -0
- package/dist/profile-view-facts.mjs +1 -1
- package/dist/recipe-macro.d.mts +53 -6
- package/dist/recipe-model.mjs +8 -5
- package/dist/region-lowering.mjs +398 -30
- package/dist/role-vocabulary.d.mts +12 -1
- package/dist/role-vocabulary.mjs +21 -3
- package/dist/skills/ads-designer/references/motion.md +4 -1
- package/dist/skills/ads-designer/references/recipes.md +36 -3
- package/dist/skills/ads-import/references/recipes.md +36 -3
- package/dist/skills/ads-port/references/recipes.md +36 -3
- package/dist/spatial-model.mjs +11 -2
- package/dist/surface-effects.mjs +25 -6
- package/dist/token-dtcg.mjs +2 -1
- package/docs/ARCHITECTURE.md +8 -0
- package/docs/ASSETS.md +7 -1
- package/docs/CHANGELOG.md +143 -18
- package/docs/GUIDE.md +9 -0
- package/docs/LANGUAGE.md +137 -17
- package/docs/MOTION.md +45 -0
- package/docs/PROFILE-KINDS.md +32 -5
- package/docs/RULES.md +13 -5
- package/docs/TOKEN-ROLES.md +9 -2
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ export type ValueBound = {
|
|
|
17
17
|
/** The CSS numeric types a quantity shape admits. A unitless zero is also a length. */
|
|
18
18
|
export type QuantityType = "length" | "percentage" | "number" | "time" | "angle";
|
|
19
19
|
/** CSS properties whose value grammar a non-numeric shape borrows (validated by css-tree). */
|
|
20
|
-
export type GrammarProperty = "box-shadow" | "font-family" | "font-feature-settings" | "font-variation-settings" | "transition-timing-function";
|
|
20
|
+
export type GrammarProperty = "box-shadow" | "font-family" | "font-feature-settings" | "font-variation-settings" | "transition-timing-function" | "scrollbar-width";
|
|
21
21
|
/** What one shape admits. `unregistrable` says why no registered CSS type describes it. */
|
|
22
22
|
export type ShapeGrammar =
|
|
23
23
|
/**
|
|
@@ -73,6 +73,7 @@ export declare const tokenShapeGrammars: {
|
|
|
73
73
|
readonly "opentype-features-or-normal": ShapeGrammar;
|
|
74
74
|
readonly "opentype-axes-or-normal": ShapeGrammar;
|
|
75
75
|
readonly "timing-function": ShapeGrammar;
|
|
76
|
+
readonly "scrollbar-width-keyword": ShapeGrammar;
|
|
76
77
|
};
|
|
77
78
|
/** A token role's value shape. */
|
|
78
79
|
export type TokenShape = keyof typeof tokenShapeGrammars;
|
|
@@ -144,11 +145,14 @@ declare const tokenRolesByKind: {
|
|
|
144
145
|
"text-decoration-color": string[];
|
|
145
146
|
"box-shadow": string[];
|
|
146
147
|
"background-image": string[];
|
|
148
|
+
"background-tile": string[];
|
|
147
149
|
opacity: string[];
|
|
148
150
|
blur: string[];
|
|
149
151
|
"backdrop-blur": string[];
|
|
150
152
|
"backdrop-saturate": string[];
|
|
151
153
|
brightness: string[];
|
|
154
|
+
grayscale: string[];
|
|
155
|
+
invert: string[];
|
|
152
156
|
mask: string[];
|
|
153
157
|
"border-inline-start-color": string[];
|
|
154
158
|
"border-inline-end-color": string[];
|
|
@@ -156,6 +160,9 @@ declare const tokenRolesByKind: {
|
|
|
156
160
|
"border-block-end-color": string[];
|
|
157
161
|
"shape-shadow": string[];
|
|
158
162
|
"group-shadow": string[];
|
|
163
|
+
"scrollbar-thumb": string[];
|
|
164
|
+
"scrollbar-track": string[];
|
|
165
|
+
"scrollbar-width": string[];
|
|
159
166
|
};
|
|
160
167
|
spacing: {
|
|
161
168
|
"content-gap": string[];
|
|
@@ -197,6 +204,10 @@ declare const tokenRolesByKind: {
|
|
|
197
204
|
"clear-block-start": string[];
|
|
198
205
|
"edge-gap": string[];
|
|
199
206
|
"viewport-margin": string[];
|
|
207
|
+
"anchor-gap": string[];
|
|
208
|
+
"anchor-overlap": string[];
|
|
209
|
+
"anchor-outdent": string[];
|
|
210
|
+
"anchor-indent": string[];
|
|
200
211
|
"sticky-layer": string[];
|
|
201
212
|
};
|
|
202
213
|
spatial: {
|
package/dist/role-vocabulary.mjs
CHANGED
|
@@ -23,7 +23,8 @@ export const tokenShapeGrammars = {
|
|
|
23
23
|
"font-family-list": property("font-family", "no registered CSS type describes font-family lists"),
|
|
24
24
|
"opentype-features-or-normal": property("font-feature-settings", "no registered CSS type describes OpenType feature settings"),
|
|
25
25
|
"opentype-axes-or-normal": property("font-variation-settings", "no registered CSS type describes OpenType axis settings"),
|
|
26
|
-
"timing-function": property("transition-timing-function", "no registered CSS type describes timing functions")
|
|
26
|
+
"timing-function": property("transition-timing-function", "no registered CSS type describes timing functions"),
|
|
27
|
+
"scrollbar-width-keyword": property("scrollbar-width", "no registered CSS type describes scrollbar widths")
|
|
27
28
|
}, tokenRoleShapes = Object.freeze({
|
|
28
29
|
spacing: "nonnegative-length",
|
|
29
30
|
"content-gap": "nonnegative-length",
|
|
@@ -46,6 +47,9 @@ export const tokenShapeGrammars = {
|
|
|
46
47
|
blur: "nonnegative-length",
|
|
47
48
|
saturation: "nonnegative-percentage",
|
|
48
49
|
brightness: "nonnegative-percentage",
|
|
50
|
+
grayscale: "nonnegative-percentage",
|
|
51
|
+
invert: "nonnegative-percentage",
|
|
52
|
+
"scrollbar-width": "scrollbar-width-keyword",
|
|
49
53
|
"box-share": "nonnegative-percentage",
|
|
50
54
|
overlap: "nonnegative-length",
|
|
51
55
|
"font-family": "font-family-list",
|
|
@@ -86,6 +90,9 @@ export const tokenRoleGuides = Object.freeze({
|
|
|
86
90
|
blur: { purpose: "A blur radius: a filter, a backdrop, a shadow's blur.", write: "px" },
|
|
87
91
|
saturation: { purpose: "How vivid colours are, as a filter: of what is behind a surface.", write: "a percentage: 100% leaves colours as they are, 0% is greyscale" },
|
|
88
92
|
brightness: { purpose: "How bright a drawing is shown, as a filter: a picture with no dark version, dimmed in the dark theme.", write: "a percentage: 100% leaves it as it is, below 100% dims it, 0% is black" },
|
|
93
|
+
grayscale: { purpose: "How grey a drawing is shown, as a filter: colour artwork made quiet, or prepared for inverting on a dark page.", write: "a percentage: 0% leaves its colours, 100% is fully grey" },
|
|
94
|
+
invert: { purpose: "How far a drawing's tones are inverted, as a filter: dark marks made for a light page shown light on a dark one.", write: "a percentage: 0% leaves it as it is, 100% inverts it fully" },
|
|
95
|
+
"scrollbar-width": { purpose: "How wide a scrolling element's scrollbar is drawn: the platform's, a thin one, or none.", write: "auto, thin or none" },
|
|
89
96
|
"box-share": { purpose: "A share of an element's own box: how far a backdrop is drawn past it on an axis, growing with the box.", write: "a percentage of the box's size on that axis" },
|
|
90
97
|
overlap: { purpose: "How far neighbours of an arrangement overlap, in place of a gap between them.", write: "px or rem" },
|
|
91
98
|
"font-family": { purpose: "The text font and its fallbacks.", write: null },
|
|
@@ -167,18 +174,24 @@ const tokenRolesByKind = {
|
|
|
167
174
|
"text-decoration-color": ["paint"],
|
|
168
175
|
"box-shadow": ["shadow"],
|
|
169
176
|
"background-image": ["gradient"],
|
|
177
|
+
"background-tile": ["spacing", "frame-size"],
|
|
170
178
|
opacity: ["opacity"],
|
|
171
179
|
blur: ["blur"],
|
|
172
180
|
"backdrop-blur": ["blur"],
|
|
173
181
|
"backdrop-saturate": ["saturation"],
|
|
174
182
|
brightness: ["brightness"],
|
|
183
|
+
grayscale: ["grayscale"],
|
|
184
|
+
invert: ["invert"],
|
|
175
185
|
mask: ["gradient"],
|
|
176
186
|
"border-inline-start-color": ["paint"],
|
|
177
187
|
"border-inline-end-color": ["paint"],
|
|
178
188
|
"border-block-start-color": ["paint"],
|
|
179
189
|
"border-block-end-color": ["paint"],
|
|
180
190
|
"shape-shadow": ["shadow"],
|
|
181
|
-
"group-shadow": ["shadow"]
|
|
191
|
+
"group-shadow": ["shadow"],
|
|
192
|
+
"scrollbar-thumb": ["paint"],
|
|
193
|
+
"scrollbar-track": ["paint"],
|
|
194
|
+
"scrollbar-width": ["scrollbar-width"]
|
|
182
195
|
},
|
|
183
196
|
spacing: {
|
|
184
197
|
"content-gap": ["content-gap", "spacing"],
|
|
@@ -209,6 +222,10 @@ const tokenRolesByKind = {
|
|
|
209
222
|
"clear-block-start": ["layout-size"],
|
|
210
223
|
"edge-gap": ["spacing"],
|
|
211
224
|
"viewport-margin": ["spacing"],
|
|
225
|
+
"anchor-gap": ["spacing"],
|
|
226
|
+
"anchor-overlap": ["overlap"],
|
|
227
|
+
"anchor-outdent": ["spacing"],
|
|
228
|
+
"anchor-indent": ["spacing"],
|
|
212
229
|
"sticky-layer": ["layer"]
|
|
213
230
|
},
|
|
214
231
|
spatial: {
|
|
@@ -268,7 +285,8 @@ export const sequenceStepTokenRoles = {
|
|
|
268
285
|
scale: ["motion-scale"],
|
|
269
286
|
"scale-inline": ["motion-scale"],
|
|
270
287
|
"scale-block": ["motion-scale"],
|
|
271
|
-
rotate: ["motion-angle"]
|
|
288
|
+
rotate: ["motion-angle"],
|
|
289
|
+
draw: []
|
|
272
290
|
};
|
|
273
291
|
export function spatialClauseFieldNames(clause) {
|
|
274
292
|
const roles = Object.hasOwn(spatialClauseTokenRoles, clause) ? spatialClauseTokenRoles[clause] : void 0;
|
|
@@ -92,7 +92,10 @@ Define motion in the recipe, control it in script. A component never calls
|
|
|
92
92
|
what the recipe declared, and uses `element.getAnimations()` (`finished`,
|
|
93
93
|
`cancel()`, `pause()`, `currentTime`) or the animation events to wait for,
|
|
94
94
|
cancel or seek it. A fade between states is the `opacity` channel of
|
|
95
|
-
`paintTransition`; a one-axis scale is `scaleInline` or `scaleBlock
|
|
95
|
+
`paintTransition`; a one-axis scale is `scaleInline` or `scaleBlock`, growing from the element's `origin` (its
|
|
96
|
+
centre, or an edge: an underline that stretches from its start is `origin: "inline-start"`); a drawing's named
|
|
97
|
+
groups (a wordmark's letters, a diagram's edges) play sequences through the part's `groups`, a line draws itself with
|
|
98
|
+
a `draw` step, and `play: { paused: true }` holds a sequence until the owner's state plays it; a turn in
|
|
96
99
|
place under a state (a plus that becomes a cross while its panel is open) is
|
|
97
100
|
`rotate`, from the motion profile's `angle`, kept under reduced motion without
|
|
98
101
|
its animation.
|
|
@@ -238,7 +238,9 @@ a recipe never creates a state machine.
|
|
|
238
238
|
cast one shadow. `mask` (a `gradient` token whose alpha fades the element)
|
|
239
239
|
goes on a visual part or on an element that scrolls, never on a container of
|
|
240
240
|
standing text. The two shadows need a one-layer shadow token (no spread,
|
|
241
|
-
inset, `none` or second layer) in every theme.
|
|
241
|
+
inset, `none` or second layer) in every theme. A scrolling element's scrollbar
|
|
242
|
+
takes `scrollbarThumb` and `scrollbarTrack` (together, the thumb at 3:1) and
|
|
243
|
+
`scrollbarWidth` from its surface; never style scrollbars in owner CSS.
|
|
242
244
|
- Pressing: a glyph part, or a region or control root, declares
|
|
243
245
|
`transition: ["scale"]` and one `when` entry with
|
|
244
246
|
`scale: { slot: "motion", field: "scale" }`. The element rests at `scale: 1`
|
|
@@ -285,13 +287,37 @@ fragment or a native frame-only element.
|
|
|
285
287
|
- **Distribution and gaps.** `justify: "space-between"` (or `"space-around"`, `"space-evenly"`) puts a row's or
|
|
286
288
|
stack's free space between its items: a logo at the start of a header and its actions at the end. On a wrapping
|
|
287
289
|
`inline` row, `gap` spaces the items and `rowGap` the lines.
|
|
290
|
+
- **Fields for common layouts.** Prefer these to workarounds:
|
|
291
|
+
- a phone bar above the home indicator: `safeArea: ["block-end"]` on the frame;
|
|
292
|
+
- a menu trigger whose pointer area reaches its panel: `minTargetBlockSize` on the part's frame profile;
|
|
293
|
+
- a table's row names fixed while it scrolls sideways: `sticky: { edge: "inline-start" }`;
|
|
294
|
+
- centred on phones, start-aligned wider: `at: { "<condition>": { align, justify, textAlign } }`;
|
|
295
|
+
- a part's divider and corners that move per width: `frame: { profile, rules, corners }` with `at: { frame }`;
|
|
296
|
+
- a scroller that keeps its scroll: `overscroll: "contain"`;
|
|
297
|
+
- a decorative layer over interactive content: `normalize: { pointerEvents: "none" }` on the part;
|
|
298
|
+
- a link card without an underline: `normalize: { textDecoration: "none" }`; a card that lifts as a whole:
|
|
299
|
+
`translateBlock` in the root's `when` with `transition: ["translate"]`;
|
|
300
|
+
- a dot grid: a surface's `backgroundTile`; a grey logo shown light in the dark theme: `grayscale` and `invert`
|
|
301
|
+
with `brightness` on the image's surface;
|
|
302
|
+
- an illustration that animates (a diagram, a wordmark): an asset with named `groups`, shown in a decoration, its
|
|
303
|
+
groups played by the part's `groups`, and its labels as text parts with `anchor: { artwork, x, y }`. Never draw it
|
|
304
|
+
as markup in the owner.
|
|
305
|
+
- **Rules between items.** Hairlines between rows, between items in a row or between a grid's cells are
|
|
306
|
+
`between: { surface, frame, axes }` on the arrangement: ADS places them at every width, centred in the gap, partial
|
|
307
|
+
rows included. Never hand-write `:nth-child` borders per breakpoint.
|
|
308
|
+
- **Decorations.** Artwork or a pattern that means nothing (a graph behind a panel, a dot grid, a glow, a page
|
|
309
|
+
backdrop) is a `kind: "decoration"` part: ADS lays it behind its parent's content, fills the parent's box (or the
|
|
310
|
+
viewport with `attachment: "fixed"`), crops its artwork in any paint mode, and keeps it `aria-hidden` and inert.
|
|
311
|
+
Never draw a backdrop as application markup or a `layered` arrangement of your own.
|
|
288
312
|
- **Loose flow.** Write loose content in block flow (no `layout`) with `spaceBefore`/`spaceAfter` on its blocks: each
|
|
289
313
|
is the block's own margin and the browser collapses them, so an item that ends in a paragraph is followed at the
|
|
290
314
|
larger of the list's and the paragraph's space, also when the item's content is another component. `carry: true`
|
|
291
315
|
does the same within one stack-based list and item, but not through a nested component.
|
|
292
316
|
A placed component part spaces the same way. Inside its own padding or border a block flow starts and ends flush
|
|
293
317
|
(a callout's last paragraph adds no space); a frameless root that must start flush, such as a page opening with a
|
|
294
|
-
heading, declares `flow: { edges: "trim" }`.
|
|
318
|
+
heading, declares `flow: { edges: "trim" }`. So does a flow that is a component's root inside another component's
|
|
319
|
+
padding (Content inside a Callout): the padding is not the flow's own. An `inline` row in block flow that states its own
|
|
320
|
+
space is a block, so its space collapses with the paragraph's above it; a row without space stays inline.
|
|
295
321
|
- **Filling parts.** `extent: "fill"` in a stack starts at the part's content and grows into free space, so a
|
|
296
322
|
scrolling body never collapses in a stack sized by its content.
|
|
297
323
|
- **End alignment.** Blocks a stack holds end on one line (`source/end-misaligned`): a painted block by its outer
|
|
@@ -328,6 +354,10 @@ A region recipe's root can live in the browser's top layer through a closed
|
|
|
328
354
|
- **Modal cards.** A dialog with `edge: "center"` or `"block-start"` is a card in the viewport, kept the layer
|
|
329
355
|
profile's `viewportMargin` from its edges, fading in with `motion: "fade"`. The backdrop surface may set
|
|
330
356
|
`backdropBlur`. A zoom view grows an image from its place with a measured `translate` and a measured `scale`.
|
|
357
|
+
- **A header's menu.** A `popover: "manual"` measured popover the owner opens on hover and focus (closing after a
|
|
358
|
+
short grace), placed from the trigger's measured corner with the layer profile's `anchorOverlap`/`anchorGap` and
|
|
359
|
+
`anchorOutdent`/`anchorIndent`, and `motion: "drop"`: it fades, comes down its motion profile's `distance` and grows
|
|
360
|
+
from its `scale`. Never add the offsets in the script.
|
|
331
361
|
|
|
332
362
|
<a id="measured"></a>
|
|
333
363
|
## Measured values and runtime paints
|
|
@@ -410,7 +440,10 @@ text part breaks one way, set by one `wrap` field:
|
|
|
410
440
|
- **Native controls.** A `<button>`, `<input>`, `<textarea>` or `<select>` that a construction draws loses the
|
|
411
441
|
browser's font, centred text, border, fill and margin wherever the construction states none.
|
|
412
442
|
- **Range sliders.** `pseudo: { sliderTrack, sliderThumb }` on an `<input type="range">` part, each a surface and a
|
|
413
|
-
frame profile; the thumb needs 3:1 against the track.
|
|
443
|
+
frame profile; the thumb's background or ring needs 3:1 against the track. A fill up to the handle is `sliderFill`
|
|
444
|
+
with a measured `share` (`slider-fill`) the owner writes at render; the thumb grows with `grow` and shows the focus
|
|
445
|
+
indicator. Step labels are a row `along` the slider, each label at its measured `slider-step` share. Never paint the
|
|
446
|
+
fill or place the labels in the owner.
|
|
414
447
|
|
|
415
448
|
<a id="assets"></a>
|
|
416
449
|
## Assets in recipes
|
|
@@ -238,7 +238,9 @@ a recipe never creates a state machine.
|
|
|
238
238
|
cast one shadow. `mask` (a `gradient` token whose alpha fades the element)
|
|
239
239
|
goes on a visual part or on an element that scrolls, never on a container of
|
|
240
240
|
standing text. The two shadows need a one-layer shadow token (no spread,
|
|
241
|
-
inset, `none` or second layer) in every theme.
|
|
241
|
+
inset, `none` or second layer) in every theme. A scrolling element's scrollbar
|
|
242
|
+
takes `scrollbarThumb` and `scrollbarTrack` (together, the thumb at 3:1) and
|
|
243
|
+
`scrollbarWidth` from its surface; never style scrollbars in owner CSS.
|
|
242
244
|
- Pressing: a glyph part, or a region or control root, declares
|
|
243
245
|
`transition: ["scale"]` and one `when` entry with
|
|
244
246
|
`scale: { slot: "motion", field: "scale" }`. The element rests at `scale: 1`
|
|
@@ -285,13 +287,37 @@ fragment or a native frame-only element.
|
|
|
285
287
|
- **Distribution and gaps.** `justify: "space-between"` (or `"space-around"`, `"space-evenly"`) puts a row's or
|
|
286
288
|
stack's free space between its items: a logo at the start of a header and its actions at the end. On a wrapping
|
|
287
289
|
`inline` row, `gap` spaces the items and `rowGap` the lines.
|
|
290
|
+
- **Fields for common layouts.** Prefer these to workarounds:
|
|
291
|
+
- a phone bar above the home indicator: `safeArea: ["block-end"]` on the frame;
|
|
292
|
+
- a menu trigger whose pointer area reaches its panel: `minTargetBlockSize` on the part's frame profile;
|
|
293
|
+
- a table's row names fixed while it scrolls sideways: `sticky: { edge: "inline-start" }`;
|
|
294
|
+
- centred on phones, start-aligned wider: `at: { "<condition>": { align, justify, textAlign } }`;
|
|
295
|
+
- a part's divider and corners that move per width: `frame: { profile, rules, corners }` with `at: { frame }`;
|
|
296
|
+
- a scroller that keeps its scroll: `overscroll: "contain"`;
|
|
297
|
+
- a decorative layer over interactive content: `normalize: { pointerEvents: "none" }` on the part;
|
|
298
|
+
- a link card without an underline: `normalize: { textDecoration: "none" }`; a card that lifts as a whole:
|
|
299
|
+
`translateBlock` in the root's `when` with `transition: ["translate"]`;
|
|
300
|
+
- a dot grid: a surface's `backgroundTile`; a grey logo shown light in the dark theme: `grayscale` and `invert`
|
|
301
|
+
with `brightness` on the image's surface;
|
|
302
|
+
- an illustration that animates (a diagram, a wordmark): an asset with named `groups`, shown in a decoration, its
|
|
303
|
+
groups played by the part's `groups`, and its labels as text parts with `anchor: { artwork, x, y }`. Never draw it
|
|
304
|
+
as markup in the owner.
|
|
305
|
+
- **Rules between items.** Hairlines between rows, between items in a row or between a grid's cells are
|
|
306
|
+
`between: { surface, frame, axes }` on the arrangement: ADS places them at every width, centred in the gap, partial
|
|
307
|
+
rows included. Never hand-write `:nth-child` borders per breakpoint.
|
|
308
|
+
- **Decorations.** Artwork or a pattern that means nothing (a graph behind a panel, a dot grid, a glow, a page
|
|
309
|
+
backdrop) is a `kind: "decoration"` part: ADS lays it behind its parent's content, fills the parent's box (or the
|
|
310
|
+
viewport with `attachment: "fixed"`), crops its artwork in any paint mode, and keeps it `aria-hidden` and inert.
|
|
311
|
+
Never draw a backdrop as application markup or a `layered` arrangement of your own.
|
|
288
312
|
- **Loose flow.** Write loose content in block flow (no `layout`) with `spaceBefore`/`spaceAfter` on its blocks: each
|
|
289
313
|
is the block's own margin and the browser collapses them, so an item that ends in a paragraph is followed at the
|
|
290
314
|
larger of the list's and the paragraph's space, also when the item's content is another component. `carry: true`
|
|
291
315
|
does the same within one stack-based list and item, but not through a nested component.
|
|
292
316
|
A placed component part spaces the same way. Inside its own padding or border a block flow starts and ends flush
|
|
293
317
|
(a callout's last paragraph adds no space); a frameless root that must start flush, such as a page opening with a
|
|
294
|
-
heading, declares `flow: { edges: "trim" }`.
|
|
318
|
+
heading, declares `flow: { edges: "trim" }`. So does a flow that is a component's root inside another component's
|
|
319
|
+
padding (Content inside a Callout): the padding is not the flow's own. An `inline` row in block flow that states its own
|
|
320
|
+
space is a block, so its space collapses with the paragraph's above it; a row without space stays inline.
|
|
295
321
|
- **Filling parts.** `extent: "fill"` in a stack starts at the part's content and grows into free space, so a
|
|
296
322
|
scrolling body never collapses in a stack sized by its content.
|
|
297
323
|
- **End alignment.** Blocks a stack holds end on one line (`source/end-misaligned`): a painted block by its outer
|
|
@@ -328,6 +354,10 @@ A region recipe's root can live in the browser's top layer through a closed
|
|
|
328
354
|
- **Modal cards.** A dialog with `edge: "center"` or `"block-start"` is a card in the viewport, kept the layer
|
|
329
355
|
profile's `viewportMargin` from its edges, fading in with `motion: "fade"`. The backdrop surface may set
|
|
330
356
|
`backdropBlur`. A zoom view grows an image from its place with a measured `translate` and a measured `scale`.
|
|
357
|
+
- **A header's menu.** A `popover: "manual"` measured popover the owner opens on hover and focus (closing after a
|
|
358
|
+
short grace), placed from the trigger's measured corner with the layer profile's `anchorOverlap`/`anchorGap` and
|
|
359
|
+
`anchorOutdent`/`anchorIndent`, and `motion: "drop"`: it fades, comes down its motion profile's `distance` and grows
|
|
360
|
+
from its `scale`. Never add the offsets in the script.
|
|
331
361
|
|
|
332
362
|
<a id="measured"></a>
|
|
333
363
|
## Measured values and runtime paints
|
|
@@ -410,7 +440,10 @@ text part breaks one way, set by one `wrap` field:
|
|
|
410
440
|
- **Native controls.** A `<button>`, `<input>`, `<textarea>` or `<select>` that a construction draws loses the
|
|
411
441
|
browser's font, centred text, border, fill and margin wherever the construction states none.
|
|
412
442
|
- **Range sliders.** `pseudo: { sliderTrack, sliderThumb }` on an `<input type="range">` part, each a surface and a
|
|
413
|
-
frame profile; the thumb needs 3:1 against the track.
|
|
443
|
+
frame profile; the thumb's background or ring needs 3:1 against the track. A fill up to the handle is `sliderFill`
|
|
444
|
+
with a measured `share` (`slider-fill`) the owner writes at render; the thumb grows with `grow` and shows the focus
|
|
445
|
+
indicator. Step labels are a row `along` the slider, each label at its measured `slider-step` share. Never paint the
|
|
446
|
+
fill or place the labels in the owner.
|
|
414
447
|
|
|
415
448
|
<a id="assets"></a>
|
|
416
449
|
## Assets in recipes
|
|
@@ -238,7 +238,9 @@ a recipe never creates a state machine.
|
|
|
238
238
|
cast one shadow. `mask` (a `gradient` token whose alpha fades the element)
|
|
239
239
|
goes on a visual part or on an element that scrolls, never on a container of
|
|
240
240
|
standing text. The two shadows need a one-layer shadow token (no spread,
|
|
241
|
-
inset, `none` or second layer) in every theme.
|
|
241
|
+
inset, `none` or second layer) in every theme. A scrolling element's scrollbar
|
|
242
|
+
takes `scrollbarThumb` and `scrollbarTrack` (together, the thumb at 3:1) and
|
|
243
|
+
`scrollbarWidth` from its surface; never style scrollbars in owner CSS.
|
|
242
244
|
- Pressing: a glyph part, or a region or control root, declares
|
|
243
245
|
`transition: ["scale"]` and one `when` entry with
|
|
244
246
|
`scale: { slot: "motion", field: "scale" }`. The element rests at `scale: 1`
|
|
@@ -285,13 +287,37 @@ fragment or a native frame-only element.
|
|
|
285
287
|
- **Distribution and gaps.** `justify: "space-between"` (or `"space-around"`, `"space-evenly"`) puts a row's or
|
|
286
288
|
stack's free space between its items: a logo at the start of a header and its actions at the end. On a wrapping
|
|
287
289
|
`inline` row, `gap` spaces the items and `rowGap` the lines.
|
|
290
|
+
- **Fields for common layouts.** Prefer these to workarounds:
|
|
291
|
+
- a phone bar above the home indicator: `safeArea: ["block-end"]` on the frame;
|
|
292
|
+
- a menu trigger whose pointer area reaches its panel: `minTargetBlockSize` on the part's frame profile;
|
|
293
|
+
- a table's row names fixed while it scrolls sideways: `sticky: { edge: "inline-start" }`;
|
|
294
|
+
- centred on phones, start-aligned wider: `at: { "<condition>": { align, justify, textAlign } }`;
|
|
295
|
+
- a part's divider and corners that move per width: `frame: { profile, rules, corners }` with `at: { frame }`;
|
|
296
|
+
- a scroller that keeps its scroll: `overscroll: "contain"`;
|
|
297
|
+
- a decorative layer over interactive content: `normalize: { pointerEvents: "none" }` on the part;
|
|
298
|
+
- a link card without an underline: `normalize: { textDecoration: "none" }`; a card that lifts as a whole:
|
|
299
|
+
`translateBlock` in the root's `when` with `transition: ["translate"]`;
|
|
300
|
+
- a dot grid: a surface's `backgroundTile`; a grey logo shown light in the dark theme: `grayscale` and `invert`
|
|
301
|
+
with `brightness` on the image's surface;
|
|
302
|
+
- an illustration that animates (a diagram, a wordmark): an asset with named `groups`, shown in a decoration, its
|
|
303
|
+
groups played by the part's `groups`, and its labels as text parts with `anchor: { artwork, x, y }`. Never draw it
|
|
304
|
+
as markup in the owner.
|
|
305
|
+
- **Rules between items.** Hairlines between rows, between items in a row or between a grid's cells are
|
|
306
|
+
`between: { surface, frame, axes }` on the arrangement: ADS places them at every width, centred in the gap, partial
|
|
307
|
+
rows included. Never hand-write `:nth-child` borders per breakpoint.
|
|
308
|
+
- **Decorations.** Artwork or a pattern that means nothing (a graph behind a panel, a dot grid, a glow, a page
|
|
309
|
+
backdrop) is a `kind: "decoration"` part: ADS lays it behind its parent's content, fills the parent's box (or the
|
|
310
|
+
viewport with `attachment: "fixed"`), crops its artwork in any paint mode, and keeps it `aria-hidden` and inert.
|
|
311
|
+
Never draw a backdrop as application markup or a `layered` arrangement of your own.
|
|
288
312
|
- **Loose flow.** Write loose content in block flow (no `layout`) with `spaceBefore`/`spaceAfter` on its blocks: each
|
|
289
313
|
is the block's own margin and the browser collapses them, so an item that ends in a paragraph is followed at the
|
|
290
314
|
larger of the list's and the paragraph's space, also when the item's content is another component. `carry: true`
|
|
291
315
|
does the same within one stack-based list and item, but not through a nested component.
|
|
292
316
|
A placed component part spaces the same way. Inside its own padding or border a block flow starts and ends flush
|
|
293
317
|
(a callout's last paragraph adds no space); a frameless root that must start flush, such as a page opening with a
|
|
294
|
-
heading, declares `flow: { edges: "trim" }`.
|
|
318
|
+
heading, declares `flow: { edges: "trim" }`. So does a flow that is a component's root inside another component's
|
|
319
|
+
padding (Content inside a Callout): the padding is not the flow's own. An `inline` row in block flow that states its own
|
|
320
|
+
space is a block, so its space collapses with the paragraph's above it; a row without space stays inline.
|
|
295
321
|
- **Filling parts.** `extent: "fill"` in a stack starts at the part's content and grows into free space, so a
|
|
296
322
|
scrolling body never collapses in a stack sized by its content.
|
|
297
323
|
- **End alignment.** Blocks a stack holds end on one line (`source/end-misaligned`): a painted block by its outer
|
|
@@ -328,6 +354,10 @@ A region recipe's root can live in the browser's top layer through a closed
|
|
|
328
354
|
- **Modal cards.** A dialog with `edge: "center"` or `"block-start"` is a card in the viewport, kept the layer
|
|
329
355
|
profile's `viewportMargin` from its edges, fading in with `motion: "fade"`. The backdrop surface may set
|
|
330
356
|
`backdropBlur`. A zoom view grows an image from its place with a measured `translate` and a measured `scale`.
|
|
357
|
+
- **A header's menu.** A `popover: "manual"` measured popover the owner opens on hover and focus (closing after a
|
|
358
|
+
short grace), placed from the trigger's measured corner with the layer profile's `anchorOverlap`/`anchorGap` and
|
|
359
|
+
`anchorOutdent`/`anchorIndent`, and `motion: "drop"`: it fades, comes down its motion profile's `distance` and grows
|
|
360
|
+
from its `scale`. Never add the offsets in the script.
|
|
331
361
|
|
|
332
362
|
<a id="measured"></a>
|
|
333
363
|
## Measured values and runtime paints
|
|
@@ -410,7 +440,10 @@ text part breaks one way, set by one `wrap` field:
|
|
|
410
440
|
- **Native controls.** A `<button>`, `<input>`, `<textarea>` or `<select>` that a construction draws loses the
|
|
411
441
|
browser's font, centred text, border, fill and margin wherever the construction states none.
|
|
412
442
|
- **Range sliders.** `pseudo: { sliderTrack, sliderThumb }` on an `<input type="range">` part, each a surface and a
|
|
413
|
-
frame profile; the thumb needs 3:1 against the track.
|
|
443
|
+
frame profile; the thumb's background or ring needs 3:1 against the track. A fill up to the handle is `sliderFill`
|
|
444
|
+
with a measured `share` (`slider-fill`) the owner writes at render; the thumb grows with `grow` and shows the focus
|
|
445
|
+
indicator. Step labels are a row `along` the slider, each label at its measured `slider-step` share. Never paint the
|
|
446
|
+
fill or place the labels in the owner.
|
|
414
447
|
|
|
415
448
|
<a id="assets"></a>
|
|
416
449
|
## Assets in recipes
|
package/dist/spatial-model.mjs
CHANGED
|
@@ -79,7 +79,7 @@ export function spatialModel(input, values) {
|
|
|
79
79
|
fail(`${mode} is a gap gutter or an edge gutter, not both.`);
|
|
80
80
|
const gap = token(edges.gap), gapPx = length(gap);
|
|
81
81
|
for (const point of breakpoints)
|
|
82
|
-
if (point.fromPx - point.marginPx * 2 <= gapPx
|
|
82
|
+
if (point.fromPx - point.marginPx * 2 <= gapPx)
|
|
83
83
|
fail(`${mode} gaps leave no track width at ${point.name}.`);
|
|
84
84
|
gutters[mode] = { start: "0", end: "0", gap };
|
|
85
85
|
continue;
|
|
@@ -233,7 +233,16 @@ function expand(css, model) {
|
|
|
233
233
|
const gutter = props.gutter ?? "wide", declaredGutter = gutter === "none" ? null : system.gutters[gutter];
|
|
234
234
|
if (gutter !== "none" && !declaredGutter)
|
|
235
235
|
fail(`Unknown gutter ${gutter}.`);
|
|
236
|
-
const trackGap = declaredGutter?.gap ?? null, edges = trackGap === null ? declaredGutter : null
|
|
236
|
+
const trackGap = declaredGutter?.gap ?? null, edges = trackGap === null ? declaredGutter : null;
|
|
237
|
+
if (trackGap !== null) {
|
|
238
|
+
const gapPx = system.length(trackGap), local = props.columns === void 0 ? null : Number(props.columns);
|
|
239
|
+
for (const point of system.breakpoints) {
|
|
240
|
+
const count = local ?? point.count;
|
|
241
|
+
if (point.fromPx - point.marginPx * 2 <= gapPx * (count - 1))
|
|
242
|
+
fail(`${gutter} gaps leave no track width at ${point.name} for ${count} columns.`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const spacing = (value) => {
|
|
237
246
|
if (value !== "0")
|
|
238
247
|
system.length(value);
|
|
239
248
|
return cssToken(value);
|
package/dist/surface-effects.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { resolveTokenValue } from "./token-resolution.mjs";
|
|
2
|
-
export const SHAPE_SHADOW = "shape-shadow", GROUP_SHADOW = "group-shadow", BRIGHTNESS = "brightness";
|
|
3
|
-
const
|
|
4
|
-
export const MASK = "mask",
|
|
2
|
+
export const SHAPE_SHADOW = "shape-shadow", GROUP_SHADOW = "group-shadow", BRIGHTNESS = "brightness", GRAYSCALE = "grayscale", INVERT = "invert";
|
|
3
|
+
const TONE_FIELDS = [GRAYSCALE, INVERT, BRIGHTNESS], FILTER_FIELDS = [...TONE_FIELDS, "blur", SHAPE_SHADOW, GROUP_SHADOW], BACKDROP_FIELDS = ["backdrop-blur", "backdrop-saturate"];
|
|
4
|
+
export const MASK = "mask", SCROLLBAR_THUMB = "scrollbar-thumb", SCROLLBAR_TRACK = "scrollbar-track", SCROLLBAR_WIDTH = "scrollbar-width";
|
|
5
|
+
const SCROLLBAR_FIELDS = [SCROLLBAR_THUMB, SCROLLBAR_TRACK, SCROLLBAR_WIDTH];
|
|
6
|
+
export const BACKGROUND_TILE = "background-tile", EFFECT_FIELDS = [...FILTER_FIELDS, ...BACKDROP_FIELDS], EFFECT_PROPERTY_FIELDS = { filter: FILTER_FIELDS, "backdrop-filter": BACKDROP_FIELDS };
|
|
5
7
|
export function filterValue(fields) {
|
|
6
|
-
const shadow = fields[SHAPE_SHADOW] ?? fields[GROUP_SHADOW], parts = [...fields[
|
|
8
|
+
const shadow = fields[SHAPE_SHADOW] ?? fields[GROUP_SHADOW], parts = [...TONE_FIELDS.flatMap((field) => fields[field] === void 0 ? [] : [`${field}(${fields[field]})`]), ...fields.blur === void 0 ? [] : [`blur(${fields.blur})`], ...shadow === void 0 ? [] : [`drop-shadow(${shadow})`]];
|
|
7
9
|
return parts.length === 0 ? null : parts.join(" ");
|
|
8
10
|
}
|
|
9
11
|
export function backdropFilterValue(fields) {
|
|
@@ -17,6 +19,17 @@ export function effectDeclarations(values) {
|
|
|
17
19
|
const declarations = [];
|
|
18
20
|
let composed = !1;
|
|
19
21
|
for (const [property, value] of Object.entries(values)) {
|
|
22
|
+
if (property === BACKGROUND_TILE) {
|
|
23
|
+
declarations.push(["background-size", `${value} ${value}`], ["background-repeat", "repeat"]);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (property === SCROLLBAR_THUMB || property === SCROLLBAR_TRACK) {
|
|
27
|
+
if (property === SCROLLBAR_THUMB || values[SCROLLBAR_THUMB] === void 0) {
|
|
28
|
+
if (values[SCROLLBAR_THUMB] !== void 0 && values[SCROLLBAR_TRACK] !== void 0)
|
|
29
|
+
declarations.push(["scrollbar-color", `${values[SCROLLBAR_THUMB]} ${values[SCROLLBAR_TRACK]}`]);
|
|
30
|
+
}
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
20
33
|
if (property === MASK) {
|
|
21
34
|
declarations.push(["-webkit-mask-image", value], ["mask-image", value]);
|
|
22
35
|
continue;
|
|
@@ -42,8 +55,14 @@ export function effectMisplaced(fields, place) {
|
|
|
42
55
|
return { reason: "both", field: GROUP_SHADOW };
|
|
43
56
|
if (fields[MASK] !== void 0 && place === "container")
|
|
44
57
|
return { reason: "mask-on-container", field: MASK };
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
const scrollbar = SCROLLBAR_FIELDS.find((field) => fields[field] !== void 0);
|
|
59
|
+
if (scrollbar !== void 0 && place !== "scroller")
|
|
60
|
+
return { reason: "scrollbar-off-scroller", field: scrollbar };
|
|
61
|
+
if (fields[SCROLLBAR_THUMB] === void 0 !== (fields[SCROLLBAR_TRACK] === void 0))
|
|
62
|
+
return { reason: "scrollbar-pair", field: fields[SCROLLBAR_THUMB] === void 0 ? SCROLLBAR_THUMB : SCROLLBAR_TRACK };
|
|
63
|
+
const tone = TONE_FIELDS.find((field) => fields[field] !== void 0);
|
|
64
|
+
if (tone !== void 0 && place !== "visual")
|
|
65
|
+
return { reason: "brightness-off-visual", field: tone };
|
|
47
66
|
if (shape && place !== "visual")
|
|
48
67
|
return { reason: "shape-on-container", field: SHAPE_SHADOW };
|
|
49
68
|
if (group && place === "visual")
|
package/dist/token-dtcg.mjs
CHANGED
|
@@ -23,7 +23,8 @@ export const DTCG_EXTENSION = "org.reqvire.ads", DTCG_TYPES = {
|
|
|
23
23
|
"font-family-list": "fontFamily",
|
|
24
24
|
"opentype-features-or-normal": null,
|
|
25
25
|
"opentype-axes-or-normal": null,
|
|
26
|
-
"timing-function": "cubicBezier"
|
|
26
|
+
"timing-function": "cubicBezier",
|
|
27
|
+
"scrollbar-width-keyword": null
|
|
27
28
|
};
|
|
28
29
|
export function modeName({ theme, brand, condition }) {
|
|
29
30
|
return [[brand, theme].filter((part) => part !== null).join("/"), condition].filter((part) => part !== null && part !== "").join(" ") || "default";
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -614,6 +614,14 @@ The emitted example design system and fixtures are held to the inventory in both
|
|
|
614
614
|
The registry states facts, never browser versions. ADS has no declared browser
|
|
615
615
|
targets: the application checks the recorded features against its own targets.
|
|
616
616
|
|
|
617
|
+
A lowering may also wait for a platform feature. Rules between arranged items
|
|
618
|
+
(`between: { axes }`) are drawn by each item's `::before` and the host's clip
|
|
619
|
+
(`src/region-lowering.mts` `betweenItemRules`), which every engine renders the
|
|
620
|
+
same. CSS gap decorations (`row-rule`, `column-rule` on grid and flex) draw the
|
|
621
|
+
same rules natively; they shipped in Chromium 149 (June 2026) and are not yet in
|
|
622
|
+
WebKit or Gecko. Once they are Baseline, the lowering switches to them, the clip
|
|
623
|
+
and the `::before` are no longer needed, and recipes do not change.
|
|
624
|
+
|
|
617
625
|
### Why compile at build time
|
|
618
626
|
|
|
619
627
|
The choice serves performance as well as ownership:
|
package/docs/ASSETS.md
CHANGED
|
@@ -134,7 +134,13 @@ assets/
|
|
|
134
134
|
override the asset's center. The recipe reserves the corrected extent and
|
|
135
135
|
applies the opposite translation; owners cannot add pixel nudges. Where
|
|
136
136
|
intrinsic artwork is cropped (`fit: "cover"`), the same point is the crop's
|
|
137
|
-
focal point.
|
|
137
|
+
focal point. A [decoration](LANGUAGE.md#decorations) crops artwork of any
|
|
138
|
+
paint mode, a themed (paint-slot) drawing included, around the same point.
|
|
139
|
+
- `groups: ["<name>", …]` names groups of the drawing a recipe may animate
|
|
140
|
+
(a wordmark's letters, a diagram's edges, [MOTION.md](MOTION.md#groups-inside-a-drawing)).
|
|
141
|
+
Every drawing of the asset marks exactly those groups, each once, with
|
|
142
|
+
`data-group="<name>"` on the group's element. Only a drawing shown as inline
|
|
143
|
+
SVG has them: paint slots or foreground, not intrinsic.
|
|
138
144
|
- `minDrawnHeight: 48` is an optional positive CSS-pixel legibility limit for
|
|
139
145
|
the fitted SVG viewport, excluding contain letterboxing. It is asset metadata,
|
|
140
146
|
not a sizing token, and each drawing keeps its own geometry: Journey's 144×96
|