@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
package/dist/ads-errors.mjs
CHANGED
|
@@ -677,6 +677,13 @@ export const choiceErrors = {
|
|
|
677
677
|
message: (failure) => `Part "${failure.part}" declares \`resize\` but is rendered as <${failure.element}>.`,
|
|
678
678
|
repair: "Declare `resize` on the part rendered as `<textarea>`, or remove it."
|
|
679
679
|
},
|
|
680
|
+
"decoration-exposed": {
|
|
681
|
+
group: "accessibility-semantics",
|
|
682
|
+
rule: 'A decoration (`kind: "decoration"`) carries no meaning: its element is `aria-hidden="true"` and holds nothing a person can use. ADS writes it behind its parent\'s content and lets the pointer through.',
|
|
683
|
+
guides: [RECIPES, "ads://guides/accessibility"],
|
|
684
|
+
message: (failure) => `Decoration "${failure.part}" is not hidden from assistive technology.`,
|
|
685
|
+
repair: 'Add `aria-hidden="true"` to the decoration\'s element; content that means something is a visual or text part, not a decoration.'
|
|
686
|
+
},
|
|
680
687
|
"pointer-transparent-interactive": {
|
|
681
688
|
group: "accessibility-semantics",
|
|
682
689
|
rule: '`pointerEvents: "none"` is for decorative overlays: never on a focusable element, and only on markup hidden from assistive technology (`aria-hidden`) or free of interactive content.',
|
|
@@ -1047,10 +1054,14 @@ export const constructionErrors = {
|
|
|
1047
1054
|
case "mask-on-container":
|
|
1048
1055
|
return `Surface ${failure.surface} declares mask, but it is applied to a container that does not scroll: its content, text included, would fade where it stands.`;
|
|
1049
1056
|
case "brightness-off-visual":
|
|
1050
|
-
return `Surface ${failure.surface} declares
|
|
1057
|
+
return `Surface ${failure.surface} declares ${failure.field}, but it is not applied to a visual part: the text it covers would change colour without a contrast check.`;
|
|
1058
|
+
case "scrollbar-off-scroller":
|
|
1059
|
+
return `Surface ${failure.surface} declares ${failure.field}, but it is applied to an element that does not scroll, which has no scrollbar.`;
|
|
1060
|
+
case "scrollbar-pair":
|
|
1061
|
+
return `Surface ${failure.surface} declares a scrollbar ${failure.field === "scrollbar-thumb" ? "track without its thumb" : "thumb without its track"}: a scrollbar's colours are set together.`;
|
|
1051
1062
|
}
|
|
1052
1063
|
},
|
|
1053
|
-
repair: "On a visual part use `shapeShadow`; on a container use `boxShadow` for the shadow of its box, or `groupShadow` when one shadow for everything inside it is what you want. Put a `mask` on a visual part, or on an element whose `overflow` scrolls. Put `brightness` on a visual part (the picture itself). Give each element its own surface profile where they differ."
|
|
1064
|
+
repair: "On a visual part use `shapeShadow`; on a container use `boxShadow` for the shadow of its box, or `groupShadow` when one shadow for everything inside it is what you want. Put a `mask` on a visual part, or on an element whose `overflow` scrolls. Put scrollbar colours and width on an element whose `overflow` scrolls, with the thumb and track together. Put `brightness` on a visual part (the picture itself). Give each element its own surface profile where they differ."
|
|
1054
1065
|
},
|
|
1055
1066
|
"surface-shadow-layer": {
|
|
1056
1067
|
group: "wrong-value",
|
|
@@ -1119,6 +1130,48 @@ export const constructionErrors = {
|
|
|
1119
1130
|
message: (failure) => `${failure.element === "&" ? "The root" : `Part ${failure.element}`} takes text profile ${failure.profile} under a state, which changes ${failure.property}.`,
|
|
1120
1131
|
repair: "Derive the state's text profile from the element's own (`extends`) and change only `weight` or `letterSpacing`; a different size or family is a different element or a recipe choice, not a state."
|
|
1121
1132
|
},
|
|
1133
|
+
"text-anchor-unsupported": {
|
|
1134
|
+
group: "structure-mismatch",
|
|
1135
|
+
rule: "A text part placed on a drawing (`anchor: { artwork, x, y }`) names a sibling decoration whose artwork is the drawing: their parent is sized to the drawing (its viewBox ratio), so the drawing fills it and a point of the drawing is a share of the parent's box. One parent places labels on one drawing, and states no block size or ratio of its own.",
|
|
1136
|
+
guides: [RECIPES],
|
|
1137
|
+
message: (failure) => failure.reason === "artwork" ? `Text part ${failure.part} is anchored to a part that is not a sibling decoration with artwork.` : failure.reason === "several" ? `Text part ${failure.part} is anchored to another drawing than its siblings: one parent is sized to one drawing.` : `Text part ${failure.part} is anchored to a drawing, but its parent already states a block size or ratio.`,
|
|
1138
|
+
repair: 'Anchor labels to a `kind: "decoration"` sibling that binds the drawing, all to the same one, and leave the parent\'s height to the drawing.'
|
|
1139
|
+
},
|
|
1140
|
+
"slider-fill-unsupported": {
|
|
1141
|
+
group: "structure-mismatch",
|
|
1142
|
+
rule: 'A slider\'s fill (`pseudo.sliderFill`) is drawn on its track up to the thumb: the element draws its track (`sliderTrack`), whose size and radius the fill takes, and declares a measured share (`{ type: "share", property: "slider-fill" }`) the owner writes as the value\'s place in its range, 0 to 1. Firefox draws the fill natively; other engines paint the track up to the share.',
|
|
1143
|
+
guides: [RECIPES],
|
|
1144
|
+
message: (failure) => failure.reason === "track-missing" ? `${failure.part} declares a slider fill but no sliderTrack.` : `${failure.part} declares a slider fill but no measured share (property "slider-fill") that places it.`,
|
|
1145
|
+
repair: 'Give the slider a `sliderTrack` treatment and declare `measured: { fill: { type: "share", property: "slider-fill" } }` on it; the owner writes `(value - min) / (max - min)`, at render with `measured.props`.'
|
|
1146
|
+
},
|
|
1147
|
+
"slider-steps-unsupported": {
|
|
1148
|
+
group: "structure-mismatch",
|
|
1149
|
+
rule: 'A row of step labels (`along: "<slider part>"`) lies under a sibling slider: it is inset by half the thumb\'s width, so the thumb\'s centre at each end is a label\'s centre, and each label is centred at its own measured share (`{ type: "share", property: "slider-step" }`). The row arranges its labels itself: it declares no layout.',
|
|
1150
|
+
guides: [RECIPES],
|
|
1151
|
+
message: (failure) => failure.reason === "slider-missing" ? `Step row ${failure.part} names no sibling slider part with a sliderThumb.` : failure.reason === "thumb-size" ? `Step row ${failure.part} follows a slider whose thumb frame states no inline size.` : failure.reason === "share-missing" ? `Step row ${failure.part} declares no measured share (property "slider-step") that places its labels.` : `Step row ${failure.part} declares a layout of its own; its labels are placed along the slider.`,
|
|
1152
|
+
repair: 'Name a sibling part whose `sliderThumb` frame states `inlineSize`, declare `measured: { step: { type: "share", property: "slider-step" } }` on the row and write each label\'s share with `measured.props`; drop the row\'s layout.'
|
|
1153
|
+
},
|
|
1154
|
+
"artwork-group-unknown": {
|
|
1155
|
+
group: "structure-mismatch",
|
|
1156
|
+
rule: "A part animates the named groups its drawing declares (`groups` in the asset, `data-group` in its SVG): a wordmark's letters, a diagram's edges. The drawing is shown as inline SVG (paint slots or foreground); an image document (intrinsic paint) is drawn as an <img>, where nothing inside can be reached.",
|
|
1157
|
+
guides: [RECIPES, "ads://guides/branding"],
|
|
1158
|
+
message: (failure) => failure.groups.length === 0 ? `Part ${failure.part} animates group ${failure.group}, but its drawing declares no groups or is not inline SVG.` : `Part ${failure.part} animates group ${failure.group}, which its drawing does not declare (it declares ${failure.groups.join(", ")}).`,
|
|
1159
|
+
repair: 'Name a group the asset declares, or declare it: `groups: ["<name>"]` in the asset and `data-group="<name>"` on its element in the SVG.'
|
|
1160
|
+
},
|
|
1161
|
+
"artwork-group-draw-length": {
|
|
1162
|
+
group: "structure-mismatch",
|
|
1163
|
+
rule: 'A line drawn along its length (a sequence\'s `draw` step) is measured on a length of 1: each shape of the group states `pathLength="1"` in the SVG, so the dash covers the whole line whatever its real length.',
|
|
1164
|
+
guides: [RECIPES],
|
|
1165
|
+
message: (failure) => `Group ${failure.group} of part ${failure.part} is drawn along its length, but its shapes do not all state pathLength="1".`,
|
|
1166
|
+
repair: 'Add `pathLength="1"` to each path, line, polyline, polygon, circle, ellipse or rect of the group in the SVG.'
|
|
1167
|
+
},
|
|
1168
|
+
"between-axes-unsupported": {
|
|
1169
|
+
group: "structure-mismatch",
|
|
1170
|
+
rule: "`between: { axes }` draws rules between arranged items on the axes it names: a stack's (or a block flow's) on the block axis, a single-line row's on the inline axis, a wrapping row's or a grid's on either or both. Layers overlap and have nothing between them, and each item's `::before` draws its rules, so no item may already use it.",
|
|
1171
|
+
guides: [RECIPES],
|
|
1172
|
+
message: (failure) => failure.layout === "::before taken" ? `${failure.element} already uses ::before, which the rules between items draw in.` : `${failure.element} cannot separate its items on the named axes (${failure.layout}).`,
|
|
1173
|
+
repair: "Name the axis the arrangement separates its items on (block for a stack, inline for a row), wrap the row or use a grid for both, or move the item's own ::before treatment to another element."
|
|
1174
|
+
},
|
|
1122
1175
|
"outset-unsupported": {
|
|
1123
1176
|
group: "structure-mismatch",
|
|
1124
1177
|
rule: "`outset` draws a decorative backdrop past its parent's box (a glow behind a card): it belongs on a part of a `layered` parent that holds no parts and no text. The parent's box and the layout around it do not change.",
|
|
@@ -1291,9 +1344,9 @@ export const constructionErrors = {
|
|
|
1291
1344
|
},
|
|
1292
1345
|
"progress-contrast-insufficient": {
|
|
1293
1346
|
group: "accessibility-semantics",
|
|
1294
|
-
rule: "A progress bar's fill,
|
|
1347
|
+
rule: "A progress bar's fill, a range slider's thumb and a scrollbar's thumb have at least 3:1 contrast against their track in every theme, brand and state (WCAG 1.4.11): the progress part's own background, the slider track's surface.",
|
|
1295
1348
|
guides: [RECIPES, "ads://guides/accessibility", "ads://guides/tokens"],
|
|
1296
|
-
message: (failure) => `The ${failure.subject === "slider-thumb" ? "slider thumb" : "progress fill"} of part "${failure.part}" has contrast ${failure.ratio}:1 (minimum ${failure.minimum}:1) against its track in ${failure.context}, fill state ${failure.states[0] ?? "base"}, track state ${failure.states[1] ?? "base"}.`,
|
|
1349
|
+
message: (failure) => `The ${failure.subject === "slider-thumb" ? "slider thumb" : failure.subject === "scrollbar-thumb" ? "scrollbar thumb" : "progress fill"} of ${failure.subject === "scrollbar-thumb" ? "surface" : "part"} "${failure.part}" has contrast ${failure.ratio}:1 (minimum ${failure.minimum}:1) against its track in ${failure.context}, fill state ${failure.states[0] ?? "base"}, track state ${failure.states[1] ?? "base"}.`,
|
|
1297
1350
|
repair: "Choose a fill surface whose background token contrasts enough with the part's own background in that context, or adjust the token's value there."
|
|
1298
1351
|
},
|
|
1299
1352
|
"progress-contrast-unresolved": {
|
|
@@ -1544,6 +1597,10 @@ export const constructionErrors = {
|
|
|
1544
1597
|
return `Measured value "${failure.name}" is an image's intrinsic size, but ${element} is not a contained application image (a visual part whose visual profile declares fit: "contain").`;
|
|
1545
1598
|
case "cover-missing":
|
|
1546
1599
|
return `Measured value "${failure.name}" is a focal position (${failure.property}), but ${element} is not a cropped application image (a visual part whose visual profile declares fit: "cover").`;
|
|
1600
|
+
case "fill-missing":
|
|
1601
|
+
return `Measured value "${failure.name}" is a slider's fill share, but ${element} has no sliderFill treatment that draws it.`;
|
|
1602
|
+
case "steps-missing":
|
|
1603
|
+
return `Measured value "${failure.name}" places step labels, but ${element} is not a row of step labels (\`along: "<slider part>"\`).`;
|
|
1547
1604
|
}
|
|
1548
1605
|
},
|
|
1549
1606
|
repair: 'Measure a property of the closed list (`inset-*`, `inline-size`, `block-size` and their min/max, `translate`, a grid track that exists in every tier); declare `placement: "measured"` for an element-anchored popover; move design values to profiles.'
|
|
@@ -3549,6 +3606,13 @@ export const runtimeErrors = {
|
|
|
3549
3606
|
message: (review) => `This control has a disabled state that ${review.changes.length === 0 ? "changes nothing" : `changes only ${review.changes.join(", ")}`}: disabled, it looks the same as enabled.`,
|
|
3550
3607
|
repair: "Under `&:disabled`, select an `inactive` surface profile (or lower the opacity) so the disabled control is seen as unavailable."
|
|
3551
3608
|
},
|
|
3609
|
+
"decoration-under-text": {
|
|
3610
|
+
group: "accessibility-semantics",
|
|
3611
|
+
rule: "Text over a decoration is readable in every theme: the decoration lies under the construction's text, so its contrast depends on the artwork or pattern, which the static check cannot see through. A scenario that renders the owner lets the render audit measure it.",
|
|
3612
|
+
guides: [RECIPES, "ads://guides/accessibility"],
|
|
3613
|
+
message: (review) => `Text in this owner is drawn over decoration "${review.part}": its contrast is measured by the render audit, not proven statically.`,
|
|
3614
|
+
repair: "Cover the owner with a scenario so the render audit measures the text over the decoration in every theme; fade the decoration (a surface `mask`) where text lies."
|
|
3615
|
+
},
|
|
3552
3616
|
"counter-unreset": {
|
|
3553
3617
|
group: "conflict",
|
|
3554
3618
|
rule: "A CSS counter a construction shows (`content: { counter | counters }`) or counts (`counter: { increment }`) is reset by some recipe of the design system (`counter: { reset }`), or is the browser's own `list-item`. Without a reset the browser starts an implicit counter at each element that counts, so every item shows 1. Listed for review, since a page may reset it outside the design system.",
|
|
@@ -923,7 +923,9 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
923
923
|
childFacts.set(parent, found);
|
|
924
924
|
return found;
|
|
925
925
|
}, allFacts = await factsOf(opening);
|
|
926
|
-
let hasText = !1
|
|
926
|
+
let hasText = !1;
|
|
927
|
+
const decorations = [];
|
|
928
|
+
let visual;
|
|
927
929
|
const visuals = new Map, several = parsed.value.kind === "region", assetSources = [];
|
|
928
930
|
let drawings;
|
|
929
931
|
const hidden = attr(opening, "hidden") === void 0 ? [] : [{ kind: "root" }], guardChild = (fact, selector, within = []) => {
|
|
@@ -1004,7 +1006,7 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1004
1006
|
if (part.declaresBoundary)
|
|
1005
1007
|
await textEntryElement(match.opening, part.name, context, resolve);
|
|
1006
1008
|
const normalized = parsed.value.kind === "region" ? parsed.value.normalizeWhen.find(([selector]) => selector === `& > ${part.selector}`) : void 0;
|
|
1007
|
-
if (part.within.length === 0 && normalized?.[1].some(([property, value]) => property === "pointer-events" && value === "none"))
|
|
1009
|
+
if (part.pointerTransparent || part.within.length === 0 && normalized?.[1].some(([property, value]) => property === "pointer-events" && value === "none"))
|
|
1008
1010
|
await pointerTransparent(match.opening, part.name, context, resolve);
|
|
1009
1011
|
if (part.resizes && element !== "textarea")
|
|
1010
1012
|
return fail(authoredAt(classes.calls, `${part.path}.normalize.resize`) ?? match.opening, { kind: "resize-not-textarea", part: part.name, element });
|
|
@@ -1027,6 +1029,15 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1027
1029
|
hasText = !0;
|
|
1028
1030
|
if (parsed.value.kind === "control" && part.kind === "element")
|
|
1029
1031
|
await pointerTransparent(match.opening, part.name, context, resolve);
|
|
1032
|
+
if (part.decoration) {
|
|
1033
|
+
const hidden = attr(match.opening, "aria-hidden");
|
|
1034
|
+
if (!(hidden !== void 0 && (hidden.initializer === void 0 || [!0, "true"].includes(await resolve(expression(hidden), context)))))
|
|
1035
|
+
return fail(match.opening, { kind: "decoration-exposed", part: part.name });
|
|
1036
|
+
await pointerTransparent(match.opening, part.name, context, resolve);
|
|
1037
|
+
decorations.push({ part: part.name, at: match.opening });
|
|
1038
|
+
if (match.classes.bindings.length === 0 && !["img", "video"].includes(element))
|
|
1039
|
+
continue;
|
|
1040
|
+
}
|
|
1030
1041
|
if (part.kind !== "visual")
|
|
1031
1042
|
continue;
|
|
1032
1043
|
if (part.scheme !== null && match.classes.bindings.length > 0)
|
|
@@ -1135,6 +1146,9 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
1135
1146
|
if (shared.length > 1)
|
|
1136
1147
|
return fail(fact.opening, { kind: "markers-shared", markers: shared });
|
|
1137
1148
|
}
|
|
1149
|
+
const [decoration] = decorations;
|
|
1150
|
+
if (decoration !== void 0 && hasText)
|
|
1151
|
+
review(decoration.at, { kind: "decoration-under-text", part: decoration.part });
|
|
1138
1152
|
if (parsed.value.kind === "control" && !hasText && (visual !== void 0 || parsed.value.decor.length > 0) && !await namedByAttribute(opening, async (condition) => values.truthy(await resolve(condition, context), condition, context)))
|
|
1139
1153
|
return fail(opening, { kind: "control-name-missing", element: values.tag(opening) });
|
|
1140
1154
|
const theme = visual?.kind === "asset" ? visual.theme : void 0, rootTheme = attr(opening, "data-theme"), boundThemes = [...new Set([...theme === void 0 ? [] : [theme.name], ...[...visuals.values()].flatMap(({ fact }) => fact.kind === "asset" ? [fact.theme.name] : [])])];
|
|
@@ -30,6 +30,11 @@ export interface AssetSpec {
|
|
|
30
30
|
readonly variants?: readonly AssetVariant[];
|
|
31
31
|
/** Paint slot → `currentColor` or a paint token. */
|
|
32
32
|
readonly paints?: Readonly<Record<string, string>>;
|
|
33
|
+
/**
|
|
34
|
+
* Named groups of the drawing a recipe may animate (`data-group="<name>"` in the SVG): a wordmark's letters, a
|
|
35
|
+
* diagram's edges. Only a drawing shown as inline SVG (paint slots or a foreground drawing) exposes them.
|
|
36
|
+
*/
|
|
37
|
+
readonly groups?: readonly string[];
|
|
33
38
|
}
|
|
34
39
|
/** The macro's output: the authored declaration, serialized unchanged. */
|
|
35
40
|
export interface AssetDeclaration {
|
|
@@ -48,7 +48,7 @@ function variant(value, states, sizing) {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
export const parseAsset = (input) => rejecting(() => {
|
|
51
|
-
const spec = fields(input, ["name", "title", "description", "license", "source", "paint", "sizing", "states", "aliases", "opticalCenter", "minDrawnHeight", "variants", "paints"], "asset"), name = spec.name;
|
|
51
|
+
const spec = fields(input, ["name", "title", "description", "license", "source", "paint", "sizing", "states", "aliases", "opticalCenter", "minDrawnHeight", "variants", "paints", "groups"], "asset"), name = spec.name;
|
|
52
52
|
if (!isName(name))
|
|
53
53
|
return fail("Invalid asset name");
|
|
54
54
|
const text = (field) => {
|
|
@@ -90,6 +90,11 @@ export const parseAsset = (input) => rejecting(() => {
|
|
|
90
90
|
paints = declared;
|
|
91
91
|
} else
|
|
92
92
|
ensure(spec.paints === void 0, "Paint slots require the slots policy");
|
|
93
|
+
const groups = spec.groups;
|
|
94
|
+
if (groups !== void 0) {
|
|
95
|
+
ensure(Array.isArray(groups) && groups.length > 0 && groups.every((group) => typeof group === "string" && isName(group)) && new Set(groups).size === groups.length, "Groups are distinct names");
|
|
96
|
+
ensure(paint !== "intrinsic", "Named groups need a drawing shown as inline SVG: paint slots or foreground, not intrinsic");
|
|
97
|
+
}
|
|
93
98
|
return {
|
|
94
99
|
name,
|
|
95
100
|
title,
|
|
@@ -103,6 +108,7 @@ export const parseAsset = (input) => rejecting(() => {
|
|
|
103
108
|
...typeof minDrawnHeight === "number" ? { minDrawnHeight } : {},
|
|
104
109
|
...rootSource === void 0 ? {} : { source: rootSource },
|
|
105
110
|
...variants === void 0 ? {} : { variants },
|
|
106
|
-
...paints === void 0 ? {} : { paints }
|
|
111
|
+
...paints === void 0 ? {} : { paints },
|
|
112
|
+
...groups === void 0 ? {} : { groups }
|
|
107
113
|
};
|
|
108
114
|
}), asset = (input) => map(parseAsset(input), () => ({ __adsAsset: 1, spec: isJsonObject(input) ? structuredClone(input) : {} }));
|
package/dist/asset-model.mjs
CHANGED
|
@@ -28,6 +28,9 @@ function readAsset(input, file, { sources, assetRoot, themes, tokens }) {
|
|
|
28
28
|
check(paints.every((paint) => paint === "none" || paint === "currentColor"), "Foreground example has fixed paint");
|
|
29
29
|
if (spec.paint === "intrinsic")
|
|
30
30
|
check(!/currentColor|var\(/.test(text), "Intrinsic image must be self-contained");
|
|
31
|
+
const marked = [...text.matchAll(/\bdata-group="([^"]+)"/g)].flatMap((match) => match[1] === void 0 ? [] : [match[1]]);
|
|
32
|
+
check(new Set(marked).size === marked.length, `${variant.source}: a group is marked twice`);
|
|
33
|
+
check(JSON.stringify([...marked].sort()) === JSON.stringify([...spec.groups ?? []].sort()), `${variant.source}: the drawing's data-group marks differ from the asset's groups`);
|
|
31
34
|
if (spec.paint === "slots") {
|
|
32
35
|
check(paints.every((paint) => paint === "none" || /^var\(--asset-[\w-]+\)$/.test(paint)), "Slot artwork has undeclared paint");
|
|
33
36
|
check(JSON.stringify([...channels].sort()) === JSON.stringify([...slots.keys()].sort()), "Missing or unused asset paint slot");
|
|
@@ -2,6 +2,7 @@ import { createLoweringSession, reviewedLoweringContext } from "./lowering-sessi
|
|
|
2
2
|
import { selectAsset } from "./asset-model.mjs";
|
|
3
3
|
import { REDUCED_MOTION, paintTransitionRules, transitionSetRules } from "./lowering-transitions.mjs";
|
|
4
4
|
import { reducedMotionPolicy } from "./lowering-motion.mjs";
|
|
5
|
+
import { checkProgressContrast } from "./placeholder-contrast.mjs";
|
|
5
6
|
import { BORDER_STYLE, BORDER_STYLES, INACTIVE_STATE, SURFACE_STATE, TEXT_TRANSFORM, TEXT_TRANSFORMS, sequenceStepTokenRoles } from "./role-vocabulary.mjs";
|
|
6
7
|
import { FORCED_FIELDS, FORCED_ONLY, FORCED_PREFIX } from "./forced-colors.mjs";
|
|
7
8
|
import { controlFrameInsets } from "./lowering-region-layout.mjs";
|
|
@@ -11,7 +12,7 @@ import { inspectMotion } from "./motion-model.mjs";
|
|
|
11
12
|
import { references, selectedProfile, tokenValueContexts } from "./design-foundation.mjs";
|
|
12
13
|
import { enterRules } from "./lowering-enter.mjs";
|
|
13
14
|
import { SEQUENCE_REPEATS, sequenceRules } from "./lowering-sequence.mjs";
|
|
14
|
-
import { GROUP_SHADOW, SHAPE_SHADOW, effectDeclarations, effectMisplaced, shadowLayerFinding } from "./surface-effects.mjs";
|
|
15
|
+
import { GROUP_SHADOW, SCROLLBAR_THUMB, SCROLLBAR_TRACK, SHAPE_SHADOW, effectDeclarations, effectMisplaced, shadowLayerFinding } from "./surface-effects.mjs";
|
|
15
16
|
export const NO_REGIONS = { cells: {}, conditions: [], tilePx: null, contexts: [] }, LIGHT = { name: "light", scheme: "light" };
|
|
16
17
|
export { REFERENCE_ROOT_PX } from "./css-length.mjs";
|
|
17
18
|
const context = reviewedLoweringContext();
|
|
@@ -156,6 +157,12 @@ export function checkSurfaceEffects(foundation, profile, surfaces, place, reject
|
|
|
156
157
|
const fields = profile.of(surface, "surface"), misplaced = effectMisplaced(fields, place);
|
|
157
158
|
if (misplaced !== null)
|
|
158
159
|
return reject({ kind: "surface-effect-misplaced", surface, field: misplaced.field, reason: misplaced.reason });
|
|
160
|
+
const thumb = fields[SCROLLBAR_THUMB], track = fields[SCROLLBAR_TRACK];
|
|
161
|
+
if (thumb !== void 0 && track !== void 0) {
|
|
162
|
+
const checked = checkProgressContrast(foundation, surface, [{ condition: null, value: thumb }], [{ condition: null, value: track }]);
|
|
163
|
+
if (checked.kind === "err")
|
|
164
|
+
return reject({ ...checked.error, subject: "scrollbar-thumb" });
|
|
165
|
+
}
|
|
159
166
|
for (const field of [SHAPE_SHADOW, GROUP_SHADOW]) {
|
|
160
167
|
const value = fields[field];
|
|
161
168
|
if (value === void 0)
|
|
@@ -184,11 +191,21 @@ export function writePaintTransition(out, profile, selector, transition, motion,
|
|
|
184
191
|
export function writeRootPress(out, press, motion, profile, reject) {
|
|
185
192
|
if (press.when.length === 0)
|
|
186
193
|
return null;
|
|
187
|
-
const timing = transitionTiming(motion, profile, reject);
|
|
188
|
-
out.rule("&", { scale: "1" });
|
|
189
|
-
for (const { condition, field } of press.when) {
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
const timing = transitionTiming(motion, profile, reject), scales = press.when.some((state) => state.effect === "scale"), travels = press.when.some((state) => state.effect !== "scale");
|
|
195
|
+
out.rule("&", { ...scales ? { scale: "1" } : {}, ...travels ? { translate: "0px" } : {} });
|
|
196
|
+
for (const { condition, effect, field } of press.when) {
|
|
197
|
+
const value = profile.field(motion, "motion", field);
|
|
198
|
+
if (effect === "scale") {
|
|
199
|
+
out.rule(condition, { scale: value });
|
|
200
|
+
out.rule(condition, { scale: "1" }, REDUCED_MOTION);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
out.rule(condition, { translate: effect === "translate-block" ? `0px ${value}` : value });
|
|
204
|
+
out.rule(condition, { translate: "0px" }, REDUCED_MOTION);
|
|
205
|
+
if (effect === "translate-inline") {
|
|
206
|
+
out.rule(`${condition}:dir(rtl)`, { translate: `calc(${value} * -1)` });
|
|
207
|
+
out.rule(`${condition}:dir(rtl)`, { translate: "0px" }, REDUCED_MOTION);
|
|
208
|
+
}
|
|
192
209
|
}
|
|
193
210
|
return press.transition.length > 0 ? { properties: press.transition, timing } : null;
|
|
194
211
|
}
|
|
@@ -253,6 +270,11 @@ export function writePlays(out, profile, foundation, element, plays, selector, t
|
|
|
253
270
|
});
|
|
254
271
|
for (const step of steps)
|
|
255
272
|
for (const [field, value] of Object.entries(step.values)) {
|
|
273
|
+
if (field === "draw") {
|
|
274
|
+
if (value !== "hidden" && value !== "drawn")
|
|
275
|
+
return reject({ kind: "sequence-step-field", profile: play.sequence, at: step.at, field });
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
256
278
|
const roles = sequenceStepTokenRoles[field], role = foundation.tokens.get(/^var\(\s*(--[\w-]+)\s*\)$/.exec(value)?.[1] ?? "")?.role;
|
|
257
279
|
if (roles === void 0 || role === void 0 || !roles.includes(role))
|
|
258
280
|
return reject({ kind: "sequence-step-field", profile: play.sequence, at: step.at, field });
|
|
@@ -266,7 +288,8 @@ export function writePlays(out, profile, foundation, element, plays, selector, t
|
|
|
266
288
|
easing: field(fields, play.sequence, "easing", reject),
|
|
267
289
|
stagger: fields.stagger ?? null,
|
|
268
290
|
repeat,
|
|
269
|
-
order: play.order
|
|
291
|
+
order: play.order,
|
|
292
|
+
paused: play.paused
|
|
270
293
|
});
|
|
271
294
|
if (lowered.kind === "err")
|
|
272
295
|
return reject(lowered.error);
|
|
@@ -275,6 +298,8 @@ export function writePlays(out, profile, foundation, element, plays, selector, t
|
|
|
275
298
|
return reject({ kind: "sequence-property-conflict", part: element, profile: play.sequence, property: conflict });
|
|
276
299
|
for (const { name, frames } of lowered.value.keyframes)
|
|
277
300
|
out.keyframes(name, frames);
|
|
301
|
+
if (steps.some((step) => step.values.draw !== void 0))
|
|
302
|
+
out.rule(selector, { "stroke-dasharray": "1" });
|
|
278
303
|
for (const rule of lowered.value.rules)
|
|
279
304
|
out.rule(rule.selector, { ...rule.values }, rule.condition ?? void 0);
|
|
280
305
|
}
|
|
@@ -323,6 +348,10 @@ export function coverArtwork(asset, visual, state, theme, reject) {
|
|
|
323
348
|
const drawing = model(selectAsset(asset, theme, visual.size ?? "", state), reject);
|
|
324
349
|
return { drawing, size: null, element: "img", source: `data:image/svg+xml,${encodeURIComponent(drawing.text)}` };
|
|
325
350
|
}
|
|
351
|
+
export function decorationArtwork(asset, visual, state, theme, reject) {
|
|
352
|
+
const drawing = model(selectAsset(asset, theme, visual.size ?? "", state), reject);
|
|
353
|
+
return asset.paint === "intrinsic" ? { drawing, size: null, element: "img", source: `data:image/svg+xml,${encodeURIComponent(drawing.text)}` } : { drawing, size: null, element: "svg", source: drawing.text };
|
|
354
|
+
}
|
|
326
355
|
export const placed = (geometry) => ({ drawing: geometry.drawing, size: geometry.size, element: geometry.element, source: geometry.source }), LINE_BOX = "1lh";
|
|
327
356
|
export function controlBox(frame, envelope, field, reject) {
|
|
328
357
|
const insets = controlFrameInsets(frame);
|
|
@@ -101,18 +101,25 @@ export interface GlyphPart {
|
|
|
101
101
|
* when `transition` lists `scale`. Empty `when` and `transition` declare none.
|
|
102
102
|
*/
|
|
103
103
|
export interface RootPress {
|
|
104
|
-
readonly transition: readonly "scale"[];
|
|
104
|
+
readonly transition: readonly ("scale" | "translate")[];
|
|
105
105
|
/** The owner condition, the motion field the root's `scale` reads and its authored path; at most one. */
|
|
106
106
|
readonly when: readonly RootPressState[];
|
|
107
107
|
}
|
|
108
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* One motion state of a root: its `scale` endpoint (a press) or its travel (`translateBlock`, `translateInline`: a card
|
|
110
|
+
* that lifts on hover) under an owner condition.
|
|
111
|
+
*/
|
|
109
112
|
export interface RootPressState {
|
|
110
113
|
readonly condition: string;
|
|
111
|
-
readonly
|
|
112
|
-
|
|
114
|
+
readonly effect: "scale" | "translate-block" | "translate-inline";
|
|
115
|
+
readonly field: "scale" | "distance";
|
|
116
|
+
/** The endpoint's authored path (`recipe.when.<condition>.scale`, `….translateBlock`). */
|
|
113
117
|
readonly path: string;
|
|
114
118
|
}
|
|
115
119
|
/** The paints a surface treatment can transition, as CSS transition properties. */
|
|
120
|
+
/** Where an element's scale and rotation grow from: its centre, or one edge (inline edges mirror under right-to-left). */
|
|
121
|
+
export declare const TRANSFORM_ORIGINS: readonly ["center", "inline-start", "inline-end", "block-start", "block-end"];
|
|
122
|
+
export type TransformOrigin = (typeof TRANSFORM_ORIGINS)[number];
|
|
116
123
|
export declare const PAINT_CHANNELS: readonly ["background-color", "border-color", "color", "text-decoration-color", "box-shadow", "filter", "backdrop-filter", "opacity"];
|
|
117
124
|
export type PaintChannel = (typeof PAINT_CHANNELS)[number];
|
|
118
125
|
/** The motion profile that times a transition: the nearest recipe's motion slot, or a named motion profile. */
|
|
@@ -173,10 +180,31 @@ export interface PlaySpec {
|
|
|
173
180
|
readonly condition: string | null;
|
|
174
181
|
readonly sequence: string;
|
|
175
182
|
readonly order: number;
|
|
183
|
+
/** `paused: true`: held at its first step (a diagram armed before it scrolls into view), released by another state. */
|
|
184
|
+
readonly paused: boolean;
|
|
185
|
+
readonly path: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* A text part placed on a drawing (`anchor`): at `x`, `y` in the drawing's own coordinates (its viewBox), aligned by its
|
|
189
|
+
* `inline` and `block` edge or centre. The drawing is a sibling decoration; their parent is sized to the drawing.
|
|
190
|
+
*/
|
|
191
|
+
export interface TextAnchor {
|
|
192
|
+
readonly artwork: string;
|
|
193
|
+
readonly x: number;
|
|
194
|
+
readonly y: number;
|
|
195
|
+
readonly inline: "start" | "center" | "end";
|
|
196
|
+
readonly block: "start" | "center" | "end";
|
|
197
|
+
readonly path: string;
|
|
198
|
+
}
|
|
199
|
+
/** A named group of a part's drawing (`data-group` in the asset's SVG) and the sequences it plays. */
|
|
200
|
+
export interface ArtworkGroup {
|
|
201
|
+
readonly name: string;
|
|
202
|
+
readonly plays: readonly PlaySpec[];
|
|
176
203
|
readonly path: string;
|
|
177
204
|
}
|
|
178
205
|
/** The block edges an element can stick to while its container scrolls. */
|
|
179
|
-
|
|
206
|
+
/** The edges an element sticks to; inline edges (a table's row names in a sideways-scrolling frame) follow the writing direction. */
|
|
207
|
+
export declare const STICKY_EDGES: readonly ["block-start", "block-end", "inline-start", "inline-end"];
|
|
180
208
|
/**
|
|
181
209
|
* `sticky: { edge, clear? }`: the element stays at an edge of its scrolling container while the rest
|
|
182
210
|
* scrolls. `clear: "block-start"` holds it below a region at the top (a sticky bar), by the layer
|
|
@@ -226,7 +254,7 @@ export interface PaintTransition {
|
|
|
226
254
|
* textarea (a colour). `progressValue` is the filled part of a `<progress>` (a background): the part's own
|
|
227
255
|
* surface is its track.
|
|
228
256
|
*/
|
|
229
|
-
export declare const PSEUDO_ELEMENTS: readonly ["placeholder", "progressValue", "marker", "before", "sliderTrack", "sliderThumb"];
|
|
257
|
+
export declare const PSEUDO_ELEMENTS: readonly ["placeholder", "progressValue", "marker", "before", "sliderTrack", "sliderThumb", "sliderFill"];
|
|
230
258
|
export type PseudoElement = (typeof PSEUDO_ELEMENTS)[number];
|
|
231
259
|
/** Elements that never render generated content or a marker: a `before` treatment there would never show. */
|
|
232
260
|
export declare const REPLACED_ELEMENTS: readonly string[];
|
|
@@ -265,6 +293,12 @@ export interface GeneratedContent {
|
|
|
265
293
|
export interface BetweenRule {
|
|
266
294
|
readonly surface: string;
|
|
267
295
|
readonly frame: string;
|
|
296
|
+
/**
|
|
297
|
+
* `axes`: rules between the arranged items on these axes, wherever the arrangement puts them (between rows, between
|
|
298
|
+
* items in a row, or both, at every width), centred in the gap. Without it, a rule between consecutive children on
|
|
299
|
+
* the arrangement's own axis, drawn in the following child's edge.
|
|
300
|
+
*/
|
|
301
|
+
readonly axes: readonly ("inline" | "block")[] | null;
|
|
268
302
|
}
|
|
269
303
|
/** An element's counters (`counter-reset`, `counter-increment`): where a count starts and what it counts. */
|
|
270
304
|
export interface CounterSpec {
|
|
@@ -280,6 +314,8 @@ export interface PseudoTreatment {
|
|
|
280
314
|
readonly surface: string | null;
|
|
281
315
|
/** A range slider's track or thumb: its frame profile (size, radius, border). */
|
|
282
316
|
readonly frame?: string | null;
|
|
317
|
+
/** A slider's thumb: the motion field (a scale) it grows by while pointed at or dragged, enabled. */
|
|
318
|
+
readonly grow?: string | null;
|
|
283
319
|
readonly text: string | null;
|
|
284
320
|
readonly content: GeneratedContent | null;
|
|
285
321
|
readonly when: readonly StateTreatment[];
|
|
@@ -477,6 +513,7 @@ export type RegionFrame =
|
|
|
477
513
|
readonly ratio: string | null;
|
|
478
514
|
readonly border: FrameBorder;
|
|
479
515
|
readonly corners: readonly FrameCorner[] | null;
|
|
516
|
+
readonly safeArea: readonly SafeAreaSide[];
|
|
480
517
|
}
|
|
481
518
|
/** `frame: "container"` requires complete frame and surface contracts. */
|
|
482
519
|
| {
|
|
@@ -484,7 +521,11 @@ export type RegionFrame =
|
|
|
484
521
|
readonly container: boolean;
|
|
485
522
|
readonly border: FrameBorder;
|
|
486
523
|
readonly corners: readonly FrameCorner[] | null;
|
|
524
|
+
readonly safeArea: readonly SafeAreaSide[];
|
|
487
525
|
};
|
|
526
|
+
/** The sides whose padding also clears the device's safe area (`env(safe-area-inset-*)`): a phone's home indicator. */
|
|
527
|
+
export declare const SAFE_AREA_SIDES: readonly ["block-start", "block-end", "inline-start", "inline-end"];
|
|
528
|
+
export type SafeAreaSide = (typeof SAFE_AREA_SIDES)[number];
|
|
488
529
|
/**
|
|
489
530
|
* The corners a frame rounds, by block then inline edge (`start-end`: the block-start, inline-end
|
|
490
531
|
* corner). `corners` on a frame rounds the named ones by the frame profile's `radius` and squares the
|
|
@@ -509,16 +550,27 @@ export interface FrameCondition {
|
|
|
509
550
|
readonly condition: string;
|
|
510
551
|
readonly border: FrameBorder | null;
|
|
511
552
|
readonly corners: readonly FrameCorner[] | null;
|
|
553
|
+
/** The root's alignment while the condition holds (a banner centred on phones, start-aligned from a width). */
|
|
554
|
+
readonly alignment: ConditionAlignment;
|
|
512
555
|
readonly path: string;
|
|
513
556
|
}
|
|
557
|
+
/** An element's arrangement alignment and text alignment while a named condition holds; `null` keeps its own. */
|
|
558
|
+
export interface ConditionAlignment {
|
|
559
|
+
readonly align: string | null;
|
|
560
|
+
readonly justify: string | null;
|
|
561
|
+
readonly textAlign: TextAlign | null;
|
|
562
|
+
}
|
|
514
563
|
/** Content beyond an element's box: shown (the default), clipped, or scrolled on one axis or both. */
|
|
515
564
|
export type Overflow = {
|
|
516
565
|
readonly kind: "visible";
|
|
517
566
|
} | {
|
|
518
567
|
readonly kind: "clip";
|
|
519
|
-
}
|
|
568
|
+
}
|
|
569
|
+
/** `contain` (`overscroll: "contain"`): reaching its end does not scroll what is behind it (a dialog's results list). */
|
|
570
|
+
| {
|
|
520
571
|
readonly kind: "scroll";
|
|
521
572
|
readonly axis: "block" | "inline" | "both";
|
|
573
|
+
readonly contain: boolean;
|
|
522
574
|
};
|
|
523
575
|
export declare const OVERFLOW_VALUES: readonly ["clip", "scroll-block", "scroll-inline", "scroll-both"];
|
|
524
576
|
/** How a part takes space in its parent's stack or inline arrangement: its content's size, or the free main-axis space (and the cross axis with `both`). */
|
|
@@ -535,6 +587,13 @@ export interface PartCondition {
|
|
|
535
587
|
readonly visible: boolean | null;
|
|
536
588
|
/** The visual profile a visual part takes in the condition (its size there); `null` when it keeps its own. */
|
|
537
589
|
readonly visual: string | null;
|
|
590
|
+
/** The part's alignment in the condition. */
|
|
591
|
+
readonly alignment: ConditionAlignment;
|
|
592
|
+
/** The part's box rules and corners in the condition (a divider that moves from the top to the start side). */
|
|
593
|
+
readonly frame: {
|
|
594
|
+
readonly border: FrameBorder | null;
|
|
595
|
+
readonly corners: readonly FrameCorner[] | null;
|
|
596
|
+
} | null;
|
|
538
597
|
}
|
|
539
598
|
/**
|
|
540
599
|
* The native element a region or part declares, for the closed UA
|
|
@@ -616,7 +675,7 @@ export type PartContent = {
|
|
|
616
675
|
export type StateTreatment = readonly [condition: string, surface: string];
|
|
617
676
|
export type RegionPartContent = PartContent["kind"];
|
|
618
677
|
/** The kinds of value a measured declaration carries: a px length, a px translation (x, y) or a px grid track length. */
|
|
619
|
-
export declare const MEASURED_TYPES: readonly ["length", "transform", "scale", "size-track", "position", "intrinsic-size"];
|
|
678
|
+
export declare const MEASURED_TYPES: readonly ["length", "transform", "scale", "size-track", "position", "intrinsic-size", "share"];
|
|
620
679
|
export type MeasuredType = (typeof MEASURED_TYPES)[number];
|
|
621
680
|
/**
|
|
622
681
|
* A geometry value the owner measures or computes at runtime and writes through
|
|
@@ -673,6 +732,12 @@ export type MeasuredValue =
|
|
|
673
732
|
readonly type: "intrinsic-size";
|
|
674
733
|
readonly name: string;
|
|
675
734
|
readonly property: string;
|
|
735
|
+
}
|
|
736
|
+
/** How far along a range a value is, 0 to 1: a slider's fill up to its thumb, or one step label's place under it. */
|
|
737
|
+
| {
|
|
738
|
+
readonly type: "share";
|
|
739
|
+
readonly name: string;
|
|
740
|
+
readonly property: string;
|
|
676
741
|
};
|
|
677
742
|
/**
|
|
678
743
|
* A paint the owner selects at runtime from data (a chart series, a status):
|
|
@@ -754,6 +819,24 @@ export interface RegionPart {
|
|
|
754
819
|
* sizes for a part that is not a control (a disc behind a mark, a badge's box). `null` otherwise.
|
|
755
820
|
*/
|
|
756
821
|
readonly box: string | null;
|
|
822
|
+
/** `anchor`: a text part placed on a sibling decoration's drawing, in the drawing's coordinates. */
|
|
823
|
+
readonly anchor: TextAnchor | null;
|
|
824
|
+
/** A row of step labels under the named sibling slider part: each label centred at its measured share of the track. */
|
|
825
|
+
readonly along: string | null;
|
|
826
|
+
/** `groups`: named groups of the part's drawing and the sequences they play (a wordmark's letters, a diagram's edges). */
|
|
827
|
+
readonly groups: readonly ArtworkGroup[];
|
|
828
|
+
/** `frame: { profile, safeArea }`: the sides whose padding also clears the device's safe area. */
|
|
829
|
+
readonly safeArea: readonly SafeAreaSide[];
|
|
830
|
+
/**
|
|
831
|
+
* `kind: "decoration"`: a layer behind its parent's content (a graph behind a panel, a dot grid behind a banner, a
|
|
832
|
+
* page's backdrop), painted by its surface, its artwork or both. It fills its parent's box (`attachment: "scroll"`) or
|
|
833
|
+
* the viewport (`"fixed"`), is hidden from assistive technology and takes no pointer. Its content is `visual`: an
|
|
834
|
+
* artwork binding, or none for a surface-only layer.
|
|
835
|
+
*/
|
|
836
|
+
readonly decoration: DecorationSpec | null;
|
|
837
|
+
/** `frame: { profile, rules, corners }`: the box's one-sided rules and rounded corners, as a root frame's. */
|
|
838
|
+
readonly boxBorder: FrameBorder;
|
|
839
|
+
readonly boxCorners: readonly FrameCorner[] | null;
|
|
757
840
|
/** A declared, human-approved boundary of this text-entry control (`frame` is a control frame). */
|
|
758
841
|
readonly accessibility: AccessibilityDeclaration | null;
|
|
759
842
|
readonly when: readonly StateTreatment[];
|
|
@@ -787,6 +870,8 @@ export interface RegionPart {
|
|
|
787
870
|
* skip link's text, an icon-only control's label); `"visible"` otherwise.
|
|
788
871
|
*/
|
|
789
872
|
readonly presence: "visible" | "assistive";
|
|
873
|
+
/** `origin`: the point the part's scale and rotation grow from; `"center"` when not stated. */
|
|
874
|
+
readonly origin: TransformOrigin;
|
|
790
875
|
/** A nested recipe arranging this part's children. */
|
|
791
876
|
readonly arrangement: Arrangement | null;
|
|
792
877
|
readonly parts: readonly RegionPart[];
|
|
@@ -828,7 +913,8 @@ export interface AnchoredPopover {
|
|
|
828
913
|
};
|
|
829
914
|
/** What the panel keeps clear of at the block start: nothing, or a fixed-size region (the layer profile's `clear-block-start`). */
|
|
830
915
|
readonly clear: "none" | "block-start";
|
|
831
|
-
|
|
916
|
+
/** `"fade"`, or `"drop"`: faded and moved down its motion profile's distance from a shade smaller (a header's menu). */
|
|
917
|
+
readonly motion: "fade" | "drop" | null;
|
|
832
918
|
}
|
|
833
919
|
/**
|
|
834
920
|
* A `popover` root anchored to an element (its trigger, a pointer, a text
|
|
@@ -839,7 +925,8 @@ export interface MeasuredPopover {
|
|
|
839
925
|
readonly kind: "measured-popover";
|
|
840
926
|
readonly element: "popover";
|
|
841
927
|
readonly popover: "auto" | "manual";
|
|
842
|
-
|
|
928
|
+
/** `"fade"`, or `"drop"`: faded and moved down its motion profile's distance from a shade smaller (a header's menu). */
|
|
929
|
+
readonly motion: "fade" | "drop" | null;
|
|
843
930
|
}
|
|
844
931
|
/** The modal sheet's `::backdrop`: a surface profile, and whether the owner closes on a press there. */
|
|
845
932
|
export interface Backdrop {
|
|
@@ -907,6 +994,8 @@ export interface RegionSpec {
|
|
|
907
994
|
* root passes those spaces out to its neighbours, as CSS margins do.
|
|
908
995
|
*/
|
|
909
996
|
readonly flowEdges: "trim" | null;
|
|
997
|
+
/** `origin`: the point the root's scale and rotation grow from; `"center"` when not stated. */
|
|
998
|
+
readonly origin: TransformOrigin;
|
|
910
999
|
readonly sticky: StickySpec | null;
|
|
911
1000
|
readonly parts: readonly RegionPart[];
|
|
912
1001
|
/** Parts exposed as public rows, in row order, for a parent's `alignRows`. */
|
|
@@ -954,6 +1043,8 @@ export interface GridSpec {
|
|
|
954
1043
|
readonly layout: readonly (readonly [field: GridField, value: SpatialValue])[];
|
|
955
1044
|
readonly rowGap: SlotBinding | null;
|
|
956
1045
|
readonly frame: RegionFrame | null;
|
|
1046
|
+
/** `between: { surface, frame, axes }`: rules between the grid's cells, between columns and rows at every tier. */
|
|
1047
|
+
readonly between: BetweenRule | null;
|
|
957
1048
|
readonly cells: readonly GridCell[];
|
|
958
1049
|
readonly conditions: readonly NamedPlacement[];
|
|
959
1050
|
/** A cell that is a public component spanning its exposed rows as subgrid rows, with those rows' names. */
|
|
@@ -990,6 +1081,10 @@ export interface DeclaredPart {
|
|
|
990
1081
|
readonly playsAlways: readonly string[];
|
|
991
1082
|
/** A scroll container: it should be reachable by keyboard. */
|
|
992
1083
|
readonly scrolls: boolean;
|
|
1084
|
+
/** `normalize: { pointerEvents: "none" }` on the part itself: owner analysis checks it is decorative. */
|
|
1085
|
+
readonly pointerTransparent: boolean;
|
|
1086
|
+
/** A decoration (`kind: "decoration"`): owner analysis checks it is hidden from assistive technology and inert. */
|
|
1087
|
+
readonly decoration: boolean;
|
|
993
1088
|
/**
|
|
994
1089
|
* A text part's setting that needs a block of text (`textAlign: "end"`, `wrap: "truncate"`), where the part has no
|
|
995
1090
|
* arrangement, box or frame of its own: on an inline element it changes nothing. `null` otherwise.
|
|
@@ -1067,6 +1162,10 @@ export interface StateText {
|
|
|
1067
1162
|
export declare const ROOT_EXTENTS: readonly ["content", "container"];
|
|
1068
1163
|
export type RootExtent = (typeof ROOT_EXTENTS)[number];
|
|
1069
1164
|
/** `outset: { block?, inline? }`: how far a layered backdrop is drawn past its parent's box on each axis, from the spacing slot. */
|
|
1165
|
+
/** A decoration layer's attachment: it scrolls with its parent's box, or stays fixed to the viewport (a page backdrop). */
|
|
1166
|
+
export interface DecorationSpec {
|
|
1167
|
+
readonly attachment: "scroll" | "fixed";
|
|
1168
|
+
}
|
|
1070
1169
|
export interface OutsetSpec {
|
|
1071
1170
|
readonly block: SlotBinding | null;
|
|
1072
1171
|
readonly inline: SlotBinding | null;
|