@reqvire-org/ads 0.5.14 → 0.5.16
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 +9 -0
- package/dist/analysis/owner-source.mjs +3 -0
- package/dist/construction-spec.d.mts +12 -1
- package/dist/construction-spec.mjs +32 -3
- package/dist/lowering-layer.mjs +39 -1
- package/dist/lowering-properties.mjs +3 -0
- package/dist/ownership-model.mjs +1 -0
- package/dist/platform-features.mjs +1 -0
- package/dist/profile-macro.d.mts +3 -1
- package/dist/recipe-macro.d.mts +19 -0
- package/dist/region-lowering.mjs +23 -7
- package/dist/render-audit/layout-overflow.page.mjs +26 -1
- package/dist/render-audit.mjs +5 -1
- package/dist/role-vocabulary.d.mts +1 -0
- package/dist/role-vocabulary.mjs +3 -2
- package/dist/spatial-reading.mjs +27 -10
- package/dist/surface-effects.mjs +7 -1
- package/docs/CHANGELOG.md +126 -0
- package/docs/GUIDE.md +8 -1
- package/docs/LANGUAGE.md +10 -2
- package/docs/PROFILE-KINDS.md +6 -0
- package/docs/RULES.md +3 -2
- package/package.json +1 -1
package/dist/ads-errors.mjs
CHANGED
|
@@ -873,6 +873,13 @@ export const choiceErrors = {
|
|
|
873
873
|
message: (failure) => `The ${failure.scheme} image of part "${failure.part}" is not always loading="lazy"; the default theme is ${failure.defaultScheme}, so this file would be downloaded while hidden.`,
|
|
874
874
|
repair: 'Write `loading="lazy"` on that image as a literal and apply any priority (eager loading, `fetchPriority`) to the default scheme\'s image only.'
|
|
875
875
|
},
|
|
876
|
+
"root-margin-unreset": {
|
|
877
|
+
group: "structure-mismatch",
|
|
878
|
+
rule: "A recipe root rendered as an element the browser gives a margin (`figure`, `p`, a list, a heading, `blockquote`, `pre`, `fieldset`) states its margin: its parts are reset by their construction, but a root keeps the browser's (a figure's 40 px sides make it 80 px narrower than its column).",
|
|
879
|
+
guides: [RECIPES],
|
|
880
|
+
message: (failure) => `This recipe root is a <${failure.element}>, which keeps the browser's margin: nothing states its own.`,
|
|
881
|
+
repair: "Add `normalize: { margin: 0 }` to the recipe (its parent's space still applies), or render the root as a <div>."
|
|
882
|
+
},
|
|
876
883
|
"invalid-nesting": {
|
|
877
884
|
group: "accessibility-semantics",
|
|
878
885
|
rule: "An owner's markup follows HTML's content model: an element that takes phrasing content only (a span, a paragraph, a button, a label, a heading) holds no flow content (a div, a list, a paragraph, a heading); a link or a button holds no other link, button or form control; a list item sits in a list, a table row in a table, a cell in a row. A transparent element (a link) takes its parent's model. Browsers repair such markup differently, and assistive technology reads what they repaired.",
|
|
@@ -1076,6 +1083,8 @@ export const constructionErrors = {
|
|
|
1076
1083
|
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.`;
|
|
1077
1084
|
case "brightness-off-visual":
|
|
1078
1085
|
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.`;
|
|
1086
|
+
case "text-fill-conflict":
|
|
1087
|
+
return `Surface ${failure.surface} declares textFill with a backgroundImage, or without a color: gradient text is its background image, and its color is the fallback its contrast is proven on.`;
|
|
1079
1088
|
case "scrollbar-off-scroller":
|
|
1080
1089
|
return `Surface ${failure.surface} declares ${failure.field}, but it is applied to an element that does not scroll, which has no scrollbar.`;
|
|
1081
1090
|
case "scrollbar-pair":
|
|
@@ -942,6 +942,9 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
942
942
|
if (rootless !== void 0)
|
|
943
943
|
return fail(opening, { kind: "pseudo-host-unsupported", part: "&", pseudo: rootless.pseudo, element: rootTag });
|
|
944
944
|
await nativeElement(opening, region.element, "&", null, context, resolve);
|
|
945
|
+
const UA_MARGIN_TAGS = ["figure", "p", "ul", "ol", "dl", "dd", "blockquote", "h1", "h2", "h3", "h4", "h5", "h6", "pre", "menu", "fieldset"], statesMargin = region.normalize.some(([property]) => property.startsWith("margin")) || region.element?.kind === "list" || region.layer !== null;
|
|
946
|
+
if (UA_MARGIN_TAGS.includes(rootTag) && !statesMargin)
|
|
947
|
+
return fail(opening, { kind: "root-margin-unreset", element: rootTag });
|
|
945
948
|
if (region.normalize.some(([property, value]) => property === "pointer-events" && value === "none"))
|
|
946
949
|
await pointerTransparent(opening, "&", context, resolve);
|
|
947
950
|
if (region.overflow.kind === "scroll")
|
|
@@ -866,6 +866,8 @@ export interface RegionPart {
|
|
|
866
866
|
/** `frame: { profile, rules, corners }`: the box's one-sided rules and rounded corners, as a root frame's. */
|
|
867
867
|
readonly boxBorder: FrameBorder;
|
|
868
868
|
readonly boxCorners: readonly FrameCorner[] | null;
|
|
869
|
+
/** `frame: { profile, ratio }`: the box's ratio, one its spatial profile permits. */
|
|
870
|
+
readonly boxRatio?: string | null;
|
|
869
871
|
/** A declared, human-approved boundary of this text-entry control (`frame` is a control frame). */
|
|
870
872
|
readonly accessibility: AccessibilityDeclaration | null;
|
|
871
873
|
readonly when: readonly StateTreatment[];
|
|
@@ -947,7 +949,14 @@ export interface AnchoredPopover {
|
|
|
947
949
|
/** What the panel keeps clear of at the block start: nothing, or a fixed-size region (the layer profile's `clear-block-start`). */
|
|
948
950
|
readonly clear: "none" | "block-start";
|
|
949
951
|
/** `"fade"`, or `"drop"`: faded and moved down its motion profile's distance from a shade smaller (a header's menu). */
|
|
950
|
-
readonly motion: "fade" | "drop" | null;
|
|
952
|
+
readonly motion: "fade" | "drop" | "slide" | null;
|
|
953
|
+
/**
|
|
954
|
+
* A drawer: attached to this inline edge, the full block extent below what it keeps clear (a docs sidebar under a sticky
|
|
955
|
+
* bar), non-modal, sliding its own extent in (`motion: "slide"`); `corner` does not apply. Absent: a corner panel.
|
|
956
|
+
*/
|
|
957
|
+
readonly edge?: "start" | "end";
|
|
958
|
+
/** A drawer's veil: a surface's background over the page below what it keeps clear. */
|
|
959
|
+
readonly backdrop?: string | null;
|
|
951
960
|
}
|
|
952
961
|
/**
|
|
953
962
|
* A `popover` root anchored to an element (its trigger, a pointer, a text
|
|
@@ -1012,6 +1021,8 @@ export interface RegionSpec {
|
|
|
1012
1021
|
readonly frameAt: FrameCondition | null;
|
|
1013
1022
|
/** Where a jump to the root lands; never on a top-layer root, which is not in the page's flow. */
|
|
1014
1023
|
readonly anchorClear: SlotBinding | null;
|
|
1024
|
+
/** The root starts this far inside the neighbour before it (`startInside`); `null`: where its parent puts it. */
|
|
1025
|
+
readonly startInside?: SlotBinding | null;
|
|
1015
1026
|
/** The geometry the root takes under owner states; never on a top-layer root. */
|
|
1016
1027
|
readonly geometryWhen: readonly StateGeometry[];
|
|
1017
1028
|
readonly geometryTransition: GeometryTransition | null;
|
|
@@ -1226,9 +1226,10 @@ function regionPart(name, value, read, path, nested) {
|
|
|
1226
1226
|
if (bound.length > 0 && (content.kind !== "visual" || visualBinding(part) === null))
|
|
1227
1227
|
read.reject({ kind: "field-unsupported", construction: "region", path: `${path}.${bound[0] ?? ""}` });
|
|
1228
1228
|
const declaredFrame = part.frame;
|
|
1229
|
-
let boxed = null, safeArea = [], boxBorder = { kind: "profile" }, boxCorners = null;
|
|
1229
|
+
let boxed = null, safeArea = [], boxBorder = { kind: "profile" }, boxCorners = null, boxRatio = null;
|
|
1230
1230
|
if (isRecord(declaredFrame) && declaredFrame.profile !== void 0) {
|
|
1231
|
-
read.only(declaredFrame, `${path}.frame`, ["profile", "safeArea", "rules", "corners"]);
|
|
1231
|
+
read.only(declaredFrame, `${path}.frame`, ["profile", "safeArea", "rules", "corners", "ratio"]);
|
|
1232
|
+
boxRatio = read.optionalString(declaredFrame.ratio, `${path}.frame.ratio`);
|
|
1232
1233
|
boxed = read.string(declaredFrame.profile, `${path}.frame.profile`);
|
|
1233
1234
|
safeArea = safeAreaSides(declaredFrame.safeArea, `${path}.frame.safeArea`, read);
|
|
1234
1235
|
boxBorder = frameBorder(declaredFrame.rules, `${path}.frame.rules`, read);
|
|
@@ -1267,6 +1268,7 @@ function regionPart(name, value, read, path, nested) {
|
|
|
1267
1268
|
safeArea,
|
|
1268
1269
|
boxBorder,
|
|
1269
1270
|
boxCorners,
|
|
1271
|
+
boxRatio,
|
|
1270
1272
|
accessibility: accessibilityDeclaration(part.accessibility, part.frame !== void 0 && boxed === null, `${path}.accessibility`, read),
|
|
1271
1273
|
when: states.treatments,
|
|
1272
1274
|
textWhen: states.texts,
|
|
@@ -1297,6 +1299,14 @@ function regionPart(name, value, read, path, nested) {
|
|
|
1297
1299
|
paints: runtimePaints(part.paints, `${path}.paints`, read)
|
|
1298
1300
|
};
|
|
1299
1301
|
}
|
|
1302
|
+
function startInside(value, path, read) {
|
|
1303
|
+
if (value === void 0)
|
|
1304
|
+
return null;
|
|
1305
|
+
const binding = read.object(value, path);
|
|
1306
|
+
read.only(binding, path, ["slot", "field"]);
|
|
1307
|
+
const slot = read.literal(binding.slot, `${path}.slot`, ["layer", "spacing"]);
|
|
1308
|
+
return { slot, field: read.literal(binding.field, `${path}.field`, [slot === "layer" ? "clearBlockStart" : "overlap"]) };
|
|
1309
|
+
}
|
|
1300
1310
|
function anchorClear(value, path, read) {
|
|
1301
1311
|
if (value === void 0)
|
|
1302
1312
|
return null;
|
|
@@ -1442,6 +1452,7 @@ function region(authored, read) {
|
|
|
1442
1452
|
"snap",
|
|
1443
1453
|
"extent",
|
|
1444
1454
|
"anchorClear",
|
|
1455
|
+
"startInside",
|
|
1445
1456
|
"overlap",
|
|
1446
1457
|
"geometryTransition",
|
|
1447
1458
|
"focus",
|
|
@@ -1484,6 +1495,7 @@ function region(authored, read) {
|
|
|
1484
1495
|
press: rootStates.press,
|
|
1485
1496
|
paintTransition: paintTransition(spec.paintTransition, "recipe.paintTransition", read),
|
|
1486
1497
|
enter: layer !== null && spec.enter !== void 0 ? read.reject({ kind: "field-unsupported", construction: "region", path: "recipe.enter" }) : enterSpec(spec.enter, "recipe.enter", read),
|
|
1498
|
+
startInside: startInside(spec.startInside, "recipe.startInside", read),
|
|
1487
1499
|
anchorClear: layer !== null && spec.anchorClear !== void 0 ? read.reject({ kind: "field-unsupported", construction: "region", path: "recipe.anchorClear" }) : anchorClear(spec.anchorClear, "recipe.anchorClear", read),
|
|
1488
1500
|
textWhen: rootStates.texts,
|
|
1489
1501
|
geometryWhen: layer !== null && geometryStates(spec.when, "recipe.when", read, !1).length > 0 ? read.reject({ kind: "field-unsupported", construction: "region", path: geometryStates(spec.when, "recipe.when", read, !1)[0]?.path ?? "recipe.when" }) : geometryStates(spec.when, "recipe.when", read, !1),
|
|
@@ -1525,12 +1537,29 @@ function layerSpec(value, read) {
|
|
|
1525
1537
|
};
|
|
1526
1538
|
}
|
|
1527
1539
|
case "popover": {
|
|
1528
|
-
const popover = layer.popover === void 0 ? "auto" : read.literal(layer.popover, `${path}.popover`, ["auto", "manual"]), motion = layer.motion === void 0 ? null : read.literal(layer.motion, `${path}.motion`, ["fade", "drop"]);
|
|
1540
|
+
const popover = layer.popover === void 0 ? "auto" : read.literal(layer.popover, `${path}.popover`, ["auto", "manual"]), motion = layer.motion === void 0 || layer.edge !== void 0 ? null : read.literal(layer.motion, `${path}.motion`, ["fade", "drop"]);
|
|
1529
1541
|
if (layer.placement !== void 0) {
|
|
1530
1542
|
read.literal(layer.placement, `${path}.placement`, ["measured"]);
|
|
1531
1543
|
read.only(layer, path, ["element", "popover", "placement", "motion"]);
|
|
1532
1544
|
return { kind: "measured-popover", element, popover, motion };
|
|
1533
1545
|
}
|
|
1546
|
+
if (layer.edge !== void 0) {
|
|
1547
|
+
read.only(layer, path, ["element", "popover", "edge", "clear", "motion", "backdrop"]);
|
|
1548
|
+
const backdrop = layer.backdrop === void 0 ? null : read.object(layer.backdrop, `${path}.backdrop`);
|
|
1549
|
+
if (backdrop !== null)
|
|
1550
|
+
read.only(backdrop, `${path}.backdrop`, ["surface"]);
|
|
1551
|
+
const edge = read.literal(layer.edge, `${path}.edge`, EDGES);
|
|
1552
|
+
return {
|
|
1553
|
+
kind: "anchored-popover",
|
|
1554
|
+
element,
|
|
1555
|
+
popover,
|
|
1556
|
+
corner: { block: "start", inline: edge },
|
|
1557
|
+
clear: layer.clear === void 0 ? "none" : read.literal(layer.clear, `${path}.clear`, ["none", "block-start"]),
|
|
1558
|
+
motion: layer.motion === void 0 ? null : read.literal(layer.motion, `${path}.motion`, ["slide", "fade"]),
|
|
1559
|
+
edge,
|
|
1560
|
+
backdrop: backdrop === null ? null : read.string(backdrop.surface, `${path}.backdrop.surface`)
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1534
1563
|
read.only(layer, path, ["element", "popover", "corner", "clear", "motion"]);
|
|
1535
1564
|
const corner = read.object(layer.corner, `${path}.corner`);
|
|
1536
1565
|
read.only(corner, `${path}.corner`, ["block", "inline"]);
|
package/dist/lowering-layer.mjs
CHANGED
|
@@ -154,6 +154,44 @@ function measuredPopoverRules(popover, margin, own, motion, drop) {
|
|
|
154
154
|
};
|
|
155
155
|
return fade("measured-popover", placement, motion, popover.motion !== null, drop);
|
|
156
156
|
}
|
|
157
|
+
function drawerRules(popover, layout, motion, veil) {
|
|
158
|
+
const start = popover.edge === "start", top = layout.clear ?? "0px", placement = {
|
|
159
|
+
position: "fixed",
|
|
160
|
+
"inset-block-start": top,
|
|
161
|
+
"inset-block-end": "0",
|
|
162
|
+
"inset-inline-start": start ? "0" : "auto",
|
|
163
|
+
"inset-inline-end": start ? "auto" : "0",
|
|
164
|
+
"margin-block-start": "0",
|
|
165
|
+
"margin-block-end": "0",
|
|
166
|
+
"margin-inline-start": "0",
|
|
167
|
+
"margin-inline-end": "0",
|
|
168
|
+
"block-size": "auto",
|
|
169
|
+
"max-block-size": "none",
|
|
170
|
+
"max-inline-size": "100%"
|
|
171
|
+
}, veilRules = veil === null ? [] : [{ selector: "&::backdrop", values: { background: veil.fields.background ?? "transparent", "inset-block-start": top }, condition: null }];
|
|
172
|
+
if (motion === null || popover.motion === null)
|
|
173
|
+
return { root: placement, rules: veilRules };
|
|
174
|
+
if (popover.motion === "fade")
|
|
175
|
+
return { root: { ...placement, ...transition("opacity", motion) }, rules: [...veilRules, ...fade("anchored-popover", {}, motion, !0).rules] };
|
|
176
|
+
const away = start ? "-100% 0" : "100% 0", mirrored = start ? "100% 0" : "-100% 0";
|
|
177
|
+
return {
|
|
178
|
+
root: { ...placement, ...transition("translate", motion) },
|
|
179
|
+
rules: [
|
|
180
|
+
...veilRules,
|
|
181
|
+
{ selector: CLOSED["anchored-popover"], values: { translate: away }, condition: null },
|
|
182
|
+
{ selector: `${CLOSED["anchored-popover"]}:dir(rtl)`, values: { translate: mirrored }, condition: null },
|
|
183
|
+
{ selector: OPEN["anchored-popover"], values: { translate: away }, condition: STARTING },
|
|
184
|
+
{ selector: `${OPEN["anchored-popover"]}:dir(rtl)`, values: { translate: mirrored }, condition: STARTING },
|
|
185
|
+
...veil === null ? [] : [
|
|
186
|
+
{ selector: "&::backdrop", values: transition("opacity", motion), condition: null },
|
|
187
|
+
{ selector: `${CLOSED["anchored-popover"]}::backdrop`, values: { opacity: "0" }, condition: null },
|
|
188
|
+
{ selector: `${OPEN["anchored-popover"]}::backdrop`, values: { opacity: "0" }, condition: STARTING },
|
|
189
|
+
{ selector: "&::backdrop", values: REDUCED, condition: REDUCED_MOTION }
|
|
190
|
+
],
|
|
191
|
+
{ selector: "&", values: REDUCED, condition: REDUCED_MOTION }
|
|
192
|
+
]
|
|
193
|
+
};
|
|
194
|
+
}
|
|
157
195
|
function popoverRules(popover, layout, own, motion, drop) {
|
|
158
196
|
const { edgeGap: gap, viewportMargin: margin, clear } = layout, placement = {
|
|
159
197
|
position: "fixed",
|
|
@@ -172,7 +210,7 @@ function variantRules(input, own) {
|
|
|
172
210
|
case "modal-sheet":
|
|
173
211
|
return sheetRules(input.sheet, input.backdrop, own, input.motion, input.margin, input.drop ?? null);
|
|
174
212
|
case "anchored-popover":
|
|
175
|
-
return ok(popoverRules(input.popover, input.placement, own, input.motion, input.drop ?? null));
|
|
213
|
+
return ok(input.popover.edge !== void 0 ? drawerRules(input.popover, input.placement, input.motion, input.veil ?? null) : popoverRules(input.popover, input.placement, own, input.motion, input.drop ?? null));
|
|
176
214
|
case "measured-popover":
|
|
177
215
|
return ok(measuredPopoverRules(input.popover, input.viewportMargin, own, input.motion, input.drop ?? null));
|
|
178
216
|
}
|
package/dist/ownership-model.mjs
CHANGED
|
@@ -26,6 +26,7 @@ const identifier = /^[a-z][\w-]*$/, profile = /^[a-z][\w-]*(?:\([a-z][\w-]*:\s*[
|
|
|
26
26
|
gap: spacing,
|
|
27
27
|
"row-gap": spacing,
|
|
28
28
|
overlap: overlapSpacing,
|
|
29
|
+
"start-inside": (value) => value === "profile(layer-profile.clear-block-start)" || value === "profile(spacing-profile.overlap)",
|
|
29
30
|
"anchor-clear": anchorClear,
|
|
30
31
|
columns: positive,
|
|
31
32
|
"content-from": (value) => /^[a-z][\w-]*$/.test(value),
|
|
@@ -70,6 +70,7 @@ export const PLATFORM_FEATURES = [
|
|
|
70
70
|
css: ["overlay", "transition-property: overlay"],
|
|
71
71
|
degrades: "The top-layer exit animation is cut: where overlay cannot be transitioned, the element leaves the top layer at once and closes instantly."
|
|
72
72
|
},
|
|
73
|
+
{ id: "background-clip-text", css: ["background-clip", "-webkit-background-clip", "-webkit-text-fill-color"], degrades: "Gradient text shows in its solid colour." },
|
|
73
74
|
{ id: "scrollbar-color", css: ["scrollbar-color", "scrollbar-width"], degrades: "A scrolling element keeps the browser's own scrollbar colours and width." },
|
|
74
75
|
{ id: "scrollbar-gutter", css: ["scrollbar-gutter"], degrades: "The page behind an open modal card shifts sideways by the scrollbar's width when the scroll lock hides it." },
|
|
75
76
|
{ id: "popover", css: [":popover-open"], degrades: "Required by popovers and menus: without the Popover API the overlay never enters the top layer, is not hidden while closed and is not light-dismissed." },
|
package/dist/profile-macro.d.mts
CHANGED
|
@@ -39,7 +39,9 @@ export interface ProfileSpec {
|
|
|
39
39
|
readonly maxWidth?: Token;
|
|
40
40
|
readonly minWidth?: Token;
|
|
41
41
|
readonly below?: Token;
|
|
42
|
-
readonly above?: Token;
|
|
42
|
+
readonly above?: Token; /** Also holds without hover (touch screens). */
|
|
43
|
+
readonly hover?: "none" | "hover"; /** Also holds with a coarse pointer. */
|
|
44
|
+
readonly pointer?: "coarse" | "fine";
|
|
43
45
|
}>>;
|
|
44
46
|
/**
|
|
45
47
|
* A `surface` profile's contextual roles: paint tokens it re-binds for the subtree of every element that takes
|
package/dist/recipe-macro.d.mts
CHANGED
|
@@ -210,6 +210,17 @@ export type LayerDeclaration = {
|
|
|
210
210
|
};
|
|
211
211
|
readonly clear?: "none" | "block-start";
|
|
212
212
|
readonly motion?: "fade" | "drop";
|
|
213
|
+
} | {
|
|
214
|
+
/** A drawer: non-modal, attached to an inline edge, the full height below what it keeps clear (a sticky bar stays usable). */
|
|
215
|
+
readonly element: "popover";
|
|
216
|
+
readonly popover?: "auto" | "manual";
|
|
217
|
+
readonly edge: "start" | "end";
|
|
218
|
+
readonly clear?: "none" | "block-start";
|
|
219
|
+
readonly motion?: "slide" | "fade";
|
|
220
|
+
/** Its veil over the page below what it keeps clear. */
|
|
221
|
+
readonly backdrop?: {
|
|
222
|
+
readonly surface: string;
|
|
223
|
+
};
|
|
213
224
|
} | {
|
|
214
225
|
readonly element: "popover";
|
|
215
226
|
readonly popover?: "auto" | "manual";
|
|
@@ -459,6 +470,14 @@ export interface RecipeSpec {
|
|
|
459
470
|
readonly collapsed?: boolean;
|
|
460
471
|
/** Where a jump to this element lands (a section or a block with an id). */
|
|
461
472
|
readonly anchorClear?: AnchorClear;
|
|
473
|
+
/** The root starts this far inside the neighbour before it: `{ slot: "spacing", field: "overlap" }` or `{ slot: "layer", field: "clearBlockStart" }` (a hero under a sticky header). */
|
|
474
|
+
readonly startInside?: {
|
|
475
|
+
readonly slot: "spacing";
|
|
476
|
+
readonly field: "overlap";
|
|
477
|
+
} | {
|
|
478
|
+
readonly slot: "layer";
|
|
479
|
+
readonly field: "clearBlockStart";
|
|
480
|
+
};
|
|
462
481
|
readonly accessibility?: {
|
|
463
482
|
readonly boundary: "visible-label" | "boundary-on-interaction";
|
|
464
483
|
readonly reason: string;
|
package/dist/region-lowering.mjs
CHANGED
|
@@ -217,7 +217,7 @@ function permittedRatio(ratio, slots, profile, reject) {
|
|
|
217
217
|
const ratios = profile.field(Object.fromEntries(profile.select(spatial).fields), spatial, "ratios").split(",").map((item) => item.trim().replace(/\s*\/\s*/, " / ")), normal = ratio.trim().replace(/\s*[/:]\s*/, " / ");
|
|
218
218
|
return ratios.includes(normal) ? normal : reject({ kind: "profile-field-unsupported", profile: spatial, field: "ratio", value: ratio });
|
|
219
219
|
}
|
|
220
|
-
function regionFrameValues(frame, slots, surface, profile, reject) {
|
|
220
|
+
function regionFrameValues(frame, slots, surface, profile, reject, clips = !1) {
|
|
221
221
|
const values = {}, frameReference = slots["frame-profile"];
|
|
222
222
|
let fields = {};
|
|
223
223
|
if (frame.kind === "container") {
|
|
@@ -229,6 +229,8 @@ function regionFrameValues(frame, slots, surface, profile, reject) {
|
|
|
229
229
|
fields = profile.of(frameReference, "frame");
|
|
230
230
|
if (frame.ratio !== null)
|
|
231
231
|
values["aspect-ratio"] = permittedRatio(frame.ratio, slots, profile, reject);
|
|
232
|
+
if (frame.ratio !== null && clips && fields["min-block-size"] === void 0)
|
|
233
|
+
values["min-block-size"] = "0";
|
|
232
234
|
}
|
|
233
235
|
Object.assign(values, frameValues(fields, profile, reject, frame.border));
|
|
234
236
|
if (frame.border.kind === "rules") {
|
|
@@ -287,6 +289,11 @@ function stickyValues(sticky, { profile, slots }) {
|
|
|
287
289
|
...layer["sticky-layer"] === void 0 ? {} : { "z-index": layer["sticky-layer"] }
|
|
288
290
|
};
|
|
289
291
|
}
|
|
292
|
+
function startInsideValues(binding, own, { profile, slots }) {
|
|
293
|
+
if (binding === null)
|
|
294
|
+
return {};
|
|
295
|
+
return { "margin-block-start": `calc(-1 * ${binding.slot === "layer" ? profile.field(profile.of(slots["layer-profile"], "layer", "startInside"), "layer", "clear-block-start") : profile.field(profile.of(slots["spacing-profile"], "spacing", "startInside"), "spacing", "overlap")})`, ...own.position === void 0 ? { position: "relative" } : {} };
|
|
296
|
+
}
|
|
290
297
|
function anchorClearValues(binding, { profile, slots }) {
|
|
291
298
|
if (binding === null)
|
|
292
299
|
return {};
|
|
@@ -592,6 +599,15 @@ function pseudoFill(treatment, surface, profile, reject) {
|
|
|
592
599
|
return reject({ kind: "pseudo-surface-unsupported", pseudo: treatment.pseudo, surface, field: other });
|
|
593
600
|
return fields.background ?? reject({ kind: "pseudo-surface-unsupported", pseudo: treatment.pseudo, surface, field: null });
|
|
594
601
|
}
|
|
602
|
+
function yields(part) {
|
|
603
|
+
if (part.content.kind === "text" || part.extent.kind !== "content" || part.overflow.kind !== "visible")
|
|
604
|
+
return !0;
|
|
605
|
+
if (part.arrangement?.wrap === !0)
|
|
606
|
+
return !0;
|
|
607
|
+
if (part.parts.length === 0)
|
|
608
|
+
return !1;
|
|
609
|
+
return part.parts.some(yields);
|
|
610
|
+
}
|
|
595
611
|
const covers = (visual) => visual.fit === "cover", COVER_FILL = { display: "block", "inline-size": "100%", "block-size": "100%", "min-block-size": "0", "object-fit": "cover" };
|
|
596
612
|
function normalizeElement(spec, name, path, values, provided, context) {
|
|
597
613
|
if (spec.element === null)
|
|
@@ -959,7 +975,7 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
959
975
|
], moved = part.effects === null ? [] : [...new Set(part.effects.when.flatMap(([, names]) => names.map((name) => PART_EFFECTS[name].channel)))], entering = writeEnter(out, profile, path, part.enter, partSurface, stateSurfaces(path, part.when, profile), slots, [...transitioned(part.paintTransition, partGroups), ...moved], reject);
|
|
960
976
|
transitionRules(path, part.paintTransition, part.surface === null ? null : { name: part.surface, fields: partSurface }, part.when, context, entering === null ? partGroups : [...partGroups, entering.group]);
|
|
961
977
|
writePlays(out, profile, context.foundation, part.name, part.plays, path, [...transitioned(part.paintTransition, entering === null ? [] : [entering.group]), ...moved], reject, { scope: context.input.scope, values: context.measured ?? [] });
|
|
962
|
-
const values = part.arrangement === null ? {} : { "box-sizing": "border-box", "min-inline-size": "0", ...arrangementValues(part.arrangement, slots, profile, part.overflow) };
|
|
978
|
+
const values = part.arrangement === null ? {} : { "box-sizing": "border-box", ...yields(part) ? { "min-inline-size": "0" } : {}, ...arrangementValues(part.arrangement, slots, profile, part.overflow) };
|
|
963
979
|
if (parentLayout === "native" && part.arrangement?.layout === "inline" && (Object.keys(flowSpace(part, context)).length > 0 || part.extent.kind === "fill")) {
|
|
964
980
|
values.display = "flex";
|
|
965
981
|
if (part.extent.kind !== "fill")
|
|
@@ -987,7 +1003,7 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
987
1003
|
if (part.surface !== null)
|
|
988
1004
|
Object.assign(values, settled(partSurface, entering?.blurred ?? !1));
|
|
989
1005
|
Object.assign(values, stickyValues(part.sticky, context), anchorClearValues(part.anchorClear, context));
|
|
990
|
-
const [partCondition] = part.at, boxChange = partCondition?.frame ?? null, boxFrame = (border, corners) => part.box === null ? {} : regionFrameValues({ kind: "fields", container: !1, ratio: null, border, corners, safeArea: [] }, { ...slots, "frame-profile": part.box }, part.surface, profile, reject).values, restCorners = boxChange?.corners === null || boxChange === null ? part.boxCorners : part.boxCorners ?? FRAME_CORNERS, boxFields = boxFrame(part.boxBorder, restCorners);
|
|
1006
|
+
const [partCondition] = part.at, boxChange = partCondition?.frame ?? null, boxFrame = (border, corners) => part.box === null ? {} : regionFrameValues({ kind: "fields", container: !1, ratio: part.boxRatio ?? null, border, corners, safeArea: [] }, { ...slots, "frame-profile": part.box }, part.surface, profile, reject, part.overflow.kind !== "visible").values, restCorners = boxChange?.corners === null || boxChange === null ? part.boxCorners : part.boxCorners ?? FRAME_CORNERS, boxFields = boxFrame(part.boxBorder, restCorners);
|
|
991
1007
|
if (part.box !== null && boxChange !== null && partCondition !== void 0) {
|
|
992
1008
|
const spatial = slots["spatial-profile"], bound = spatial === void 0 ? null : conditionBound(context.foundation, spatial, partCondition.condition, profile, reject);
|
|
993
1009
|
if (bound === null)
|
|
@@ -1238,8 +1254,8 @@ function layerInput(layer, spec, root, slots, profile, foundation, reject) {
|
|
|
1238
1254
|
return reject({ kind: "layer-clearance-unbounded", token: token ?? value, value: fixed });
|
|
1239
1255
|
clear = value;
|
|
1240
1256
|
}
|
|
1241
|
-
const placement = { edgeGap: profile.field(fields, "layer", "edge-gap"), viewportMargin: profile.field(fields, "layer", "viewport-margin"), clear };
|
|
1242
|
-
return { kind: "anchored-popover", popover: layer, placement, root, motion, drop: drop() };
|
|
1257
|
+
const drawer = layer.edge !== void 0, placement = { edgeGap: drawer ? "0px" : profile.field(fields, "layer", "edge-gap"), viewportMargin: drawer ? "0px" : profile.field(fields, "layer", "viewport-margin"), clear }, veil = layer.backdrop === void 0 || layer.backdrop === null ? null : { name: layer.backdrop, fields: profile.of(layer.backdrop, "surface") };
|
|
1258
|
+
return { kind: "anchored-popover", popover: layer, placement, root, motion, drop: drop(), veil };
|
|
1243
1259
|
}
|
|
1244
1260
|
}
|
|
1245
1261
|
}
|
|
@@ -1328,7 +1344,7 @@ export function lowerRegion(spec, foundation, input) {
|
|
|
1328
1344
|
checked(checkLayers("&", spec.parts.length), reject);
|
|
1329
1345
|
if (slots["surface-profile"] !== void 0)
|
|
1330
1346
|
Object.assign(values, profile.of(slots["surface-profile"], "surface"));
|
|
1331
|
-
const framed = spec.frame === null || spec.frameAt === null || spec.frameAt.corners === null ? spec.frame : { ...spec.frame, corners: spec.frame.corners ?? FRAME_CORNERS }, rootFrame = framed === null ? null : regionFrameValues(framed, slots, surface, profile, reject);
|
|
1347
|
+
const framed = spec.frame === null || spec.frameAt === null || spec.frameAt.corners === null ? spec.frame : { ...spec.frame, corners: spec.frame.corners ?? FRAME_CORNERS }, rootFrame = framed === null ? null : regionFrameValues(framed, slots, surface, profile, reject, spec.overflow.kind !== "visible");
|
|
1332
1348
|
if (rootFrame !== null)
|
|
1333
1349
|
Object.assign(values, rootFrame.values);
|
|
1334
1350
|
if (spec.frameAt !== null) {
|
|
@@ -1401,7 +1417,7 @@ export function lowerRegion(spec, foundation, input) {
|
|
|
1401
1417
|
for (const rule of layered.value.documents)
|
|
1402
1418
|
out.document(rule);
|
|
1403
1419
|
} else {
|
|
1404
|
-
Object.assign(values, stickyValues(spec.sticky, context), anchorClearValues(spec.anchorClear, context), checked(measuredWrites(input.scope, spec.measured, "&", values, frameSupplied, null, { fill: spec.pseudo.some((item) => item.pseudo === "sliderFill"), steps: !1 }), reject), rootPaints);
|
|
1420
|
+
Object.assign(values, stickyValues(spec.sticky, context), anchorClearValues(spec.anchorClear, context), startInsideValues(spec.startInside ?? null, values, context), checked(measuredWrites(input.scope, spec.measured, "&", values, frameSupplied, null, { fill: spec.pseudo.some((item) => item.pseudo === "sliderFill"), steps: !1 }), reject), rootPaints);
|
|
1405
1421
|
if (spec.parts.some((part) => part.decoration !== null))
|
|
1406
1422
|
Object.assign(values, decorationHost(values));
|
|
1407
1423
|
Object.assign(values, stageValues(spec.parts, values, context));
|
|
@@ -44,7 +44,7 @@ export async function layoutOverflow({ nodeLimit, width: expected, container, sm
|
|
|
44
44
|
}
|
|
45
45
|
return found;
|
|
46
46
|
function measure() {
|
|
47
|
-
const width = document.documentElement.clientWidth, issues = [], counts = { document: 0, viewport: 0, container: 0, clipped: 0, "broken-word": 0, "collapsed-scroller": 0, "block-clipped": 0, spilled: 0, overlap: 0, "focus-clipped": 0 }, pane = container ? scope.getBoundingClientRect() : { left: 0, right: width }, edge = container ? "container" : "viewport", selector = (element) => {
|
|
47
|
+
const width = document.documentElement.clientWidth, issues = [], counts = { document: 0, viewport: 0, container: 0, clipped: 0, "broken-word": 0, "collapsed-scroller": 0, escaped: 0, "block-clipped": 0, spilled: 0, overlap: 0, "focus-clipped": 0 }, pane = container ? scope.getBoundingClientRect() : { left: 0, right: width }, edge = container ? "container" : "viewport", selector = (element) => {
|
|
48
48
|
const parts = [];
|
|
49
49
|
for (let node = element;node !== scope; ) {
|
|
50
50
|
const parent = node.parentElement;
|
|
@@ -214,9 +214,34 @@ export async function layoutOverflow({ nodeLimit, width: expected, container, sm
|
|
|
214
214
|
report("clipped", element, { overflow: Math.round(cut.reach), cut: cut.cut });
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
+
measureEscapes();
|
|
217
218
|
if (fit)
|
|
218
219
|
measureFit();
|
|
219
220
|
return { issues, counts };
|
|
221
|
+
function measureEscapes() {
|
|
222
|
+
const paints = (style) => ["Left", "Right"].some((side) => Number.parseFloat(style.getPropertyValue(`border-${side.toLowerCase()}-width`)) > 0 && style.getPropertyValue(`border-${side.toLowerCase()}-style`) !== "none") || style.backgroundColor !== "transparent" && !/rgba\([^)]*,\s*0\)$/.test(style.backgroundColor) || style.backgroundImage !== "none", control = (element) => /^(?:button|select|textarea|input)$/.test(element.localName) || element.localName === "a" && element.hasAttribute("href") || element.hasAttribute("tabindex"), text = (element) => [...element.childNodes].some((node) => node.nodeType === Node.TEXT_NODE && (node.textContent ?? "").trim() !== "");
|
|
223
|
+
for (const { element, box } of measured) {
|
|
224
|
+
if (!control(element) && !text(element))
|
|
225
|
+
continue;
|
|
226
|
+
if (element.closest("[inert], [aria-hidden='true']"))
|
|
227
|
+
continue;
|
|
228
|
+
let reach = 0;
|
|
229
|
+
for (let node = element.parentElement;node && node !== scope; node = node.parentElement) {
|
|
230
|
+
const style = getComputedStyle(node);
|
|
231
|
+
if (/^(?:absolute|fixed)$/.test(getComputedStyle(element).position) || /^(?:absolute|fixed)$/.test(style.position))
|
|
232
|
+
break;
|
|
233
|
+
if (style.overflowX !== "visible")
|
|
234
|
+
break;
|
|
235
|
+
if (!paints(style))
|
|
236
|
+
continue;
|
|
237
|
+
const edge = node.getBoundingClientRect();
|
|
238
|
+
reach = Math.max(box.right - edge.right, edge.left - box.left);
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
if (reach > 2)
|
|
242
|
+
report("escaped", element, { overflow: Math.round(reach) });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
220
245
|
function measureFit() {
|
|
221
246
|
const native = (element) => /^(?:input|textarea|select)$/.test(element.localName), intended = (element, style) => native(element) || style.textOverflow === "ellipsis" || style.getPropertyValue("-webkit-line-clamp") !== "none" || style.clip !== "auto" || style.clipPath !== "none" || !!element.closest('[aria-roledescription="carousel"], [role="application"]'), held = (element) => {
|
|
222
247
|
if (!element.computedStyleMap)
|
package/dist/render-audit.mjs
CHANGED
|
@@ -263,6 +263,10 @@ const skipReasons = {
|
|
|
263
263
|
what: "text, a control, or a box's painted edge (a card's border and corners) is cut off by overflow hidden or clip (cropped images, artwork and decorative layers do not count)",
|
|
264
264
|
fix: "Make the content fit, truncate it with text-overflow: ellipsis, or use overflow-x: auto if it should scroll."
|
|
265
265
|
},
|
|
266
|
+
escaped: {
|
|
267
|
+
what: "a control or text reaches past the edge of the painted box around it (a card's border or fill), which does not clip it",
|
|
268
|
+
fix: `Let the box hold it: keep a row of controls from shrinking below its buttons (give the text beside it the room to give way, extent: "fill" or truncation), or let the row wrap; do not let content spill over a card's edge.`
|
|
269
|
+
},
|
|
266
270
|
"collapsed-scroller": {
|
|
267
271
|
what: "a scroll area that holds content is collapsed to nothing: everything in it is out of sight",
|
|
268
272
|
fix: 'Give the scroll area a size: let it fill a parent that has a height (extent: "fill" in a stack given a height), or a minimum block size; check its parents for a height of 0.'
|
|
@@ -321,7 +325,7 @@ export function layoutOverflowFindings(runs, scenarios) {
|
|
|
321
325
|
const { scenario, tag: rule, kind, widths, themes, brands, nodes, nodeCount } = group, container = rule === NARROW_RULE, sorted = [...widths].sort((a, b) => a - b);
|
|
322
326
|
return {
|
|
323
327
|
rule,
|
|
324
|
-
severity: findingSeverity(rule),
|
|
328
|
+
severity: kind === "escaped" ? "review" : findingSeverity(rule),
|
|
325
329
|
file: files.get(scenario) ?? scenario,
|
|
326
330
|
line: 1,
|
|
327
331
|
column: 1,
|
package/dist/role-vocabulary.mjs
CHANGED
|
@@ -191,7 +191,8 @@ const tokenRolesByKind = {
|
|
|
191
191
|
"group-shadow": ["shadow"],
|
|
192
192
|
"scrollbar-thumb": ["paint"],
|
|
193
193
|
"scrollbar-track": ["paint"],
|
|
194
|
-
"scrollbar-width": ["scrollbar-width"]
|
|
194
|
+
"scrollbar-width": ["scrollbar-width"],
|
|
195
|
+
"text-fill": ["gradient"]
|
|
195
196
|
},
|
|
196
197
|
spacing: {
|
|
197
198
|
"content-gap": ["content-gap", "spacing"],
|
|
@@ -290,5 +291,5 @@ export const sequenceStepTokenRoles = {
|
|
|
290
291
|
};
|
|
291
292
|
export function spatialClauseFieldNames(clause) {
|
|
292
293
|
const roles = Object.hasOwn(spatialClauseTokenRoles, clause) ? spatialClauseTokenRoles[clause] : void 0;
|
|
293
|
-
return roles === void 0 ? null : Object.keys(roles);
|
|
294
|
+
return roles === void 0 ? null : [...Object.keys(roles), ...clause === "ads-condition" ? ["hover", "pointer"] : []];
|
|
294
295
|
}
|
package/dist/spatial-reading.mjs
CHANGED
|
@@ -4,7 +4,9 @@ import { tokenCss, tokenValueContexts } from "./design-foundation.mjs";
|
|
|
4
4
|
import { model } from "./construction-output.mjs";
|
|
5
5
|
import { foldTokenOperations } from "./token-operations.mjs";
|
|
6
6
|
import { readQuantity } from "./css-quantity.mjs";
|
|
7
|
-
export const ZERO = "--ads-proof-zero"
|
|
7
|
+
export const ZERO = "--ads-proof-zero";
|
|
8
|
+
const CAPABILITY = "\x00";
|
|
9
|
+
export const geometryToken = (tokens, reject) => (value) => {
|
|
8
10
|
const name = /^var\((--[\w-]+)\)$/.exec(value)?.[1];
|
|
9
11
|
if (name === void 0)
|
|
10
12
|
return reject({ kind: "spatial-token-expected", value });
|
|
@@ -12,7 +14,7 @@ export const ZERO = "--ads-proof-zero", geometryToken = (tokens, reject) => (val
|
|
|
12
14
|
return name;
|
|
13
15
|
};
|
|
14
16
|
export function readSpatial(spatial, reference, token, profile, reject) {
|
|
15
|
-
const f = Object.fromEntries(spatial.fields), field = (name) => profile.field(f, reference, name), breakpoints = [], gutters = {}, conditions = new Map, definition = {
|
|
17
|
+
const f = Object.fromEntries(spatial.fields), field = (name) => profile.field(f, reference, name), breakpoints = [], gutters = {}, conditions = new Map, capabilities = new Map, definition = {
|
|
16
18
|
schemaVersion: 1,
|
|
17
19
|
miniUnit: token(field("mini-unit")),
|
|
18
20
|
fineUnit: token(field("fine-unit")),
|
|
@@ -30,14 +32,20 @@ export function readSpatial(spatial, reference, token, profile, reject) {
|
|
|
30
32
|
} else if (kind === "ads-gutter")
|
|
31
33
|
gutters[name] = Object.fromEntries(entries.map(([item, value]) => [item, token(value)]));
|
|
32
34
|
else if (kind === "ads-condition") {
|
|
33
|
-
const below = values.get("below");
|
|
34
|
-
if (below === void 0
|
|
35
|
+
const below = values.get("below"), hover = values.get("hover"), pointer = values.get("pointer");
|
|
36
|
+
if (!entries.every(([item]) => item === "below" || item === "hover" || item === "pointer") || below === void 0 && hover === void 0 && pointer === void 0)
|
|
35
37
|
return reject({ kind: "spatial-clause-unsupported", clause: key });
|
|
36
|
-
|
|
38
|
+
if (hover !== void 0 && hover !== "none" && hover !== "hover" || pointer !== void 0 && pointer !== "coarse" && pointer !== "fine")
|
|
39
|
+
return reject({ kind: "spatial-clause-unsupported", clause: key });
|
|
40
|
+
const capability = [...hover === void 0 ? [] : [`(hover: ${hover})`], ...pointer === void 0 ? [] : [`(pointer: ${pointer})`]].join(", ");
|
|
41
|
+
if (below !== void 0)
|
|
42
|
+
conditions.set(name, token(below));
|
|
43
|
+
if (capability !== "")
|
|
44
|
+
capabilities.set(name, capability);
|
|
37
45
|
} else
|
|
38
46
|
reject({ kind: "spatial-clause-unsupported", clause: key });
|
|
39
47
|
}
|
|
40
|
-
return { definition, conditions };
|
|
48
|
+
return { definition, conditions, capabilities };
|
|
41
49
|
}
|
|
42
50
|
export function geometryOf(foundation, tokens, reject) {
|
|
43
51
|
const css = tokenCss(foundation, tokens);
|
|
@@ -109,15 +117,24 @@ export function conditionBound(foundation, reference, condition, profile, reject
|
|
|
109
117
|
const spatial = profile.select(reference);
|
|
110
118
|
if (spatial.kind !== "spatial")
|
|
111
119
|
return reject({ kind: "profile-kind", reference, expected: "spatial", actual: spatial.kind });
|
|
112
|
-
const { conditions } = readSpatial(spatial, reference, geometryToken(new Set, reject), profile, reject), token = conditions.get(condition);
|
|
113
|
-
if (token === void 0)
|
|
120
|
+
const { conditions, capabilities } = readSpatial(spatial, reference, geometryToken(new Set, reject), profile, reject), token = conditions.get(condition), capability = capabilities.get(condition);
|
|
121
|
+
if (token === void 0 && capability === void 0)
|
|
114
122
|
return null;
|
|
123
|
+
const suffix = capability === void 0 ? "" : `${CAPABILITY}${capability}`;
|
|
124
|
+
if (token === void 0)
|
|
125
|
+
return suffix;
|
|
115
126
|
const bound = geometryOf(foundation, new Set([token]), reject).get(token);
|
|
116
127
|
if (bound !== void 0 && PX_LENGTH.test(bound))
|
|
117
128
|
return reject({ kind: "spatial-bound-unit", token, value: bound });
|
|
118
|
-
return bound !== void 0 && PLAIN_LENGTH.test(bound) ? bound : reject({ kind: "spatial-token-expected", value: token });
|
|
129
|
+
return bound !== void 0 && PLAIN_LENGTH.test(bound) ? `${bound}${suffix}` : reject({ kind: "spatial-token-expected", value: token });
|
|
130
|
+
}
|
|
131
|
+
export function conditionQueries(bound) {
|
|
132
|
+
const [width = "", capability] = bound.split(CAPABILITY);
|
|
133
|
+
if (capability === void 0)
|
|
134
|
+
return { inside: `(width < ${width})`, outside: `(width >= ${width})` };
|
|
135
|
+
const terms = capability.split(", "), inside = [...width === "" ? [] : [`(width < ${width})`], ...terms].join(", "), outside = [...width === "" ? [] : [`(width >= ${width})`], ...terms.map((term) => `(not ${term})`)].join(" and ");
|
|
136
|
+
return { inside, outside };
|
|
119
137
|
}
|
|
120
|
-
export const conditionQueries = (bound) => ({ inside: `(width < ${bound})`, outside: `(width >= ${bound})` });
|
|
121
138
|
export function tierBelowQuery(foundation, reference, tier, profile, reject) {
|
|
122
139
|
const spatial = profile.select(reference);
|
|
123
140
|
if (spatial.kind !== "spatial")
|
package/dist/surface-effects.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveTokenValue } from "./token-resolution.mjs";
|
|
2
2
|
export const SHAPE_SHADOW = "shape-shadow", GROUP_SHADOW = "group-shadow", BRIGHTNESS = "brightness", GRAYSCALE = "grayscale", INVERT = "invert";
|
|
3
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";
|
|
4
|
+
export const MASK = "mask", TEXT_FILL = "text-fill", SCROLLBAR_THUMB = "scrollbar-thumb", SCROLLBAR_TRACK = "scrollbar-track", SCROLLBAR_WIDTH = "scrollbar-width";
|
|
5
5
|
const SCROLLBAR_FIELDS = [SCROLLBAR_THUMB, SCROLLBAR_TRACK, SCROLLBAR_WIDTH];
|
|
6
6
|
export const BACKGROUND_TILE = "background-tile", EFFECT_FIELDS = [...FILTER_FIELDS, ...BACKDROP_FIELDS], EFFECT_PROPERTY_FIELDS = { filter: FILTER_FIELDS, "backdrop-filter": BACKDROP_FIELDS };
|
|
7
7
|
export function filterValue(fields) {
|
|
@@ -30,6 +30,10 @@ export function effectDeclarations(values) {
|
|
|
30
30
|
}
|
|
31
31
|
continue;
|
|
32
32
|
}
|
|
33
|
+
if (property === TEXT_FILL) {
|
|
34
|
+
declarations.push(["background-image", value], ["-webkit-background-clip", "text"], ["background-clip", "text"], ["-webkit-text-fill-color", "transparent"]);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
33
37
|
if (property === MASK) {
|
|
34
38
|
declarations.push(["-webkit-mask-image", value], ["mask-image", value]);
|
|
35
39
|
continue;
|
|
@@ -55,6 +59,8 @@ export function effectMisplaced(fields, place) {
|
|
|
55
59
|
return { reason: "both", field: GROUP_SHADOW };
|
|
56
60
|
if (fields[MASK] !== void 0 && place === "container")
|
|
57
61
|
return { reason: "mask-on-container", field: MASK };
|
|
62
|
+
if (fields[TEXT_FILL] !== void 0 && (fields["background-image"] !== void 0 || fields.color === void 0))
|
|
63
|
+
return { reason: "text-fill-conflict", field: TEXT_FILL };
|
|
58
64
|
const scrollbar = SCROLLBAR_FIELDS.find((field) => fields[field] !== void 0);
|
|
59
65
|
if (scrollbar !== void 0 && place !== "scroller")
|
|
60
66
|
return { reason: "scrollbar-off-scroller", field: scrollbar };
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,131 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.16
|
|
4
|
+
|
|
5
|
+
<!-- ads-local-tests:start -->
|
|
6
|
+
Hot patch: the unit and integration groups; the browser group was not run.
|
|
7
|
+
Quick hot patch (urgent, on the owner's instruction): the unit group and 12 integration files related to the fixes (layout-additions.test.mjs, modal-card.test.mjs, measured-geometry.test.ts, block-flow-space.test.mjs, decoration.test.mjs, tone-filters.test.mjs, scrollbar-surface.test.mjs, ratio-parts.test.mjs, lowering-parity.test.ts, starter-check.test.ts, design-system-rejections.test.ts, layers.test.mjs), not the whole integration group.
|
|
8
|
+
Local verification: **962/962 passed** (unit 851, integration 111).
|
|
9
|
+
Tested commit: `3222e712b72d2472160239e5dccd60e4a309992c`; Bun 1.4.4.
|
|
10
|
+
Completed 2026-11-26T11:37:43.050Z (186 seconds).
|
|
11
|
+
|
|
12
|
+
<!-- ads-local-test-proof
|
|
13
|
+
{
|
|
14
|
+
"schema": 3,
|
|
15
|
+
"version": "0.5.16",
|
|
16
|
+
"commit": "3222e712b72d2472160239e5dccd60e4a309992c",
|
|
17
|
+
"sourceSha256": "620894f8361b196586eb70a05da289767565c56e8fca9491fde86447dd176e78",
|
|
18
|
+
"command": "bun run test:hotpatch",
|
|
19
|
+
"scope": "hotpatch",
|
|
20
|
+
"result": "pass",
|
|
21
|
+
"tests": 962,
|
|
22
|
+
"pass": 962,
|
|
23
|
+
"fail": 0,
|
|
24
|
+
"skipped": 0,
|
|
25
|
+
"groups": [
|
|
26
|
+
{
|
|
27
|
+
"name": "unit",
|
|
28
|
+
"tests": 851,
|
|
29
|
+
"pass": 851,
|
|
30
|
+
"fail": 0,
|
|
31
|
+
"skipped": 0,
|
|
32
|
+
"reportSha256": "20fb98454a85aefa2771e75e454afa14efa21dba03859bcfeb0d5d6ede3cc511"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "integration",
|
|
36
|
+
"tests": 111,
|
|
37
|
+
"pass": 111,
|
|
38
|
+
"fail": 0,
|
|
39
|
+
"skipped": 0,
|
|
40
|
+
"reportSha256": "05c168b9b2b72a7a761a613c9cd9f8f6543662a4b3102dc2812f6902b050d23d"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"testOverrides": {},
|
|
44
|
+
"bun": "1.4.4",
|
|
45
|
+
"completedAt": "2026-11-26T11:37:43.050Z",
|
|
46
|
+
"durationMs": 186073,
|
|
47
|
+
"logSha256": "bd051a93e0111802a7a905356a7db1f33b4e48a0b60126a8bb93ff8bb3207c6a"
|
|
48
|
+
}
|
|
49
|
+
-->
|
|
50
|
+
<!-- ads-local-tests:end -->
|
|
51
|
+
|
|
52
|
+
- *Starting inside the band before* (#67, #70): a root's `startInside` (a spacing
|
|
53
|
+
`overlap`, or the layer profile's `clearBlockStart`) pulls it that far into
|
|
54
|
+
its previous neighbour and paints it over it: a status board over its title
|
|
55
|
+
band, a hero under a sticky header.
|
|
56
|
+
- *Gradient text* (#70): a surface's `textFill` paints text with a gradient over
|
|
57
|
+
its `color`, which it needs as the fallback and for contrast.
|
|
58
|
+
- *A drawer below a sticky bar* (#71): a popover layer with `edge: "start" |
|
|
59
|
+
"end"`, `clear`, `motion: "slide"` and an optional `backdrop`: non-modal, the
|
|
60
|
+
full height below the cleared bar, its veil below the bar too.
|
|
61
|
+
- *Conditions on the input* (#71): a spatial profile's named condition may test
|
|
62
|
+
`hover: "none"` or `pointer: "coarse"`, alone or with `below` (either holds).
|
|
63
|
+
|
|
64
|
+
## 0.5.15
|
|
65
|
+
|
|
66
|
+
<!-- ads-local-tests:start -->
|
|
67
|
+
Hot patch: the unit and integration groups; the browser group was not run.
|
|
68
|
+
Quick hot patch (urgent, on the owner's instruction): the unit group and 11 integration files related to the fixes (ratio-parts.test.mjs, end-alignment.test.mjs, block-flow-space.test.mjs, starter-check.test.ts, design-system-rejections.test.ts, lowering-parity.test.ts, measured-geometry.test.ts, modal-card.test.mjs, invalid-nesting.test.mjs, local-alias-emission.test.mjs, owner-emission.test.ts), not the whole integration group.
|
|
69
|
+
Local verification: **963/963 passed** (unit 851, integration 112).
|
|
70
|
+
Tested commit: `54c9ff208ea8dfe18fb0442ede8d23aa57213a06`; Bun 1.4.4.
|
|
71
|
+
Completed 2026-11-26T11:27:50.737Z (268 seconds).
|
|
72
|
+
|
|
73
|
+
<!-- ads-local-test-proof
|
|
74
|
+
{
|
|
75
|
+
"schema": 3,
|
|
76
|
+
"version": "0.5.15",
|
|
77
|
+
"commit": "54c9ff208ea8dfe18fb0442ede8d23aa57213a06",
|
|
78
|
+
"sourceSha256": "aa763ec745a61124d65d80deac969f309dea614e98fd9174f954ff462bbde254",
|
|
79
|
+
"command": "bun run test:hotpatch",
|
|
80
|
+
"scope": "hotpatch",
|
|
81
|
+
"result": "pass",
|
|
82
|
+
"tests": 963,
|
|
83
|
+
"pass": 963,
|
|
84
|
+
"fail": 0,
|
|
85
|
+
"skipped": 0,
|
|
86
|
+
"groups": [
|
|
87
|
+
{
|
|
88
|
+
"name": "unit",
|
|
89
|
+
"tests": 851,
|
|
90
|
+
"pass": 851,
|
|
91
|
+
"fail": 0,
|
|
92
|
+
"skipped": 0,
|
|
93
|
+
"reportSha256": "60d9a70350e6799ee8b902524b32e3c8d20e104c8ded1cbabba8c60c4d918ae2"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "integration",
|
|
97
|
+
"tests": 112,
|
|
98
|
+
"pass": 112,
|
|
99
|
+
"fail": 0,
|
|
100
|
+
"skipped": 0,
|
|
101
|
+
"reportSha256": "c0ccbf18492cb9c47992b2341a638480ffdd8f69356d5f8f9c28be16eded3559"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"testOverrides": {},
|
|
105
|
+
"bun": "1.4.4",
|
|
106
|
+
"completedAt": "2026-11-26T11:27:50.737Z",
|
|
107
|
+
"durationMs": 267877,
|
|
108
|
+
"logSha256": "e56e29cada96e54bf3ccc533a607b8effa8994f615c120d730a97d6cec26fde3"
|
|
109
|
+
}
|
|
110
|
+
-->
|
|
111
|
+
<!-- ads-local-tests:end -->
|
|
112
|
+
|
|
113
|
+
- *Fixed: a row of buttons spilled out of its card* (neezler's attachment): a
|
|
114
|
+
part with its own arrangement shrinks to nothing only when something in it
|
|
115
|
+
gives way (text, a filling or growing part, a wrapping row, a clip or scroll);
|
|
116
|
+
a row of buttons keeps its natural minimum, so a long name beside it
|
|
117
|
+
truncates instead.
|
|
118
|
+
- *Render audit: content escaping its box*: a `layout-overflow` finding of kind
|
|
119
|
+
`escaped` for a control or text reaching past the edge of the painted box
|
|
120
|
+
around it; a review for now.
|
|
121
|
+
- *A part's ratio* (#74): `frame: { profile, ratio }` on a part, so a card's
|
|
122
|
+
picture folds into the card.
|
|
123
|
+
- *Fixed: a cropping ratio box grew with a taller image* (#72): a ratio box that
|
|
124
|
+
clips or scrolls keeps its ratio (`min-block-size: 0`).
|
|
125
|
+
- *A root's browser margin* (#73): `source/root-margin-unreset` for a recipe
|
|
126
|
+
root rendered as a `figure`, `p`, list, heading, `blockquote`, `pre` or
|
|
127
|
+
`fieldset` that states no margin of its own.
|
|
128
|
+
|
|
3
129
|
## 0.5.14
|
|
4
130
|
|
|
5
131
|
<!-- ads-local-tests:start -->
|
package/docs/GUIDE.md
CHANGED
|
@@ -631,7 +631,10 @@ capture shows the page as the showcase does.
|
|
|
631
631
|
|
|
632
632
|
- Each `a11y-axe`, `a11y-non-text-contrast`, `a11y-text-scale`,
|
|
633
633
|
`a11y-text-spacing-override`, `a11y-reflow`, `layout-overflow`, `layout-shift`
|
|
634
|
-
and `img-shape` finding is an error that fails the gate
|
|
634
|
+
and `img-shape` finding is an error that fails the gate, except a
|
|
635
|
+
`layout-overflow` finding of kind `escaped` (a control or text reaching past
|
|
636
|
+
the edge of the painted box around it, such as a button spilling over a
|
|
637
|
+
card's border), which is a review while designs are read with it.
|
|
635
638
|
- Each `a11y-incomplete` finding is an info item that fails nothing: axe could
|
|
636
639
|
not decide that rule on those elements, so check it by hand.
|
|
637
640
|
- An audit that cannot run fails the gate with a `render-audit-unavailable`
|
|
@@ -1281,6 +1284,10 @@ an owner-analysis finding with its fine-grained code, reported under its
|
|
|
1281
1284
|
- `a11y-image-alt` (error, at the image): every `<img>` that an owner renders
|
|
1282
1285
|
has `alt`: artwork (`source/intrinsic-alt-missing`), content media and any
|
|
1283
1286
|
other image (`source/image-alt-missing`). `alt=""` marks a decorative one.
|
|
1287
|
+
- `root-margin-unreset` (error, at the root): a recipe root rendered as an
|
|
1288
|
+
element the browser gives a margin (`figure`, `p`, a list, a heading,
|
|
1289
|
+
`blockquote`, `pre`, `fieldset`) states its own (`normalize: { margin: 0 }`);
|
|
1290
|
+
parts are reset by their construction, a root is not.
|
|
1284
1291
|
- `a11y-nesting` (error, at the element): an owner's markup follows HTML's
|
|
1285
1292
|
content model (`source/invalid-nesting`): no flow content (a `div`, a list, a
|
|
1286
1293
|
paragraph, a heading) inside an element that takes phrasing content only (a
|
package/docs/LANGUAGE.md
CHANGED
|
@@ -234,7 +234,7 @@ them all.
|
|
|
234
234
|
| --- | --- | --- | --- |
|
|
235
235
|
| frame profile `paddingInline` / `paddingBlock` | frame | logical insets per axis | the profile also sets `padding` (`construction/frame-field-conflict`) |
|
|
236
236
|
| frame profile `paddingInlineStart` / `paddingInlineEnd` / `paddingBlockStart` / `paddingBlockEnd` | container frame, control frame | one side's inset, where the two sides of an axis differ (a tag padded more before its remove button). On a control frame a block side's inset is its least inset, and `minimumBlockInset` is the block axis's field | the profile also sets that side's axis or `padding`; on a control frame, a block inset beside `minimumBlockInset` (`construction/frame-field-conflict`) |
|
|
237
|
-
| `frame: { profile: "<frame profile>" }` | part (not a control, not a vector) | the profile's insets, border, radius and sizes as the part's own box (`box-sizing: border-box`); on a visual part bound to artwork the profile's `inlineSize`/`blockSize` are the box (a disc behind a mark) and the drawing keeps its visual profile's size, centred in it | another field beside `profile`; a frame field the profile misuses, as on a root |
|
|
237
|
+
| `frame: { profile: "<frame profile>", ratio? }` | part (not a control, not a vector) | the profile's insets, border, radius and sizes as the part's own box (with `ratio`, a ratio its spatial profile permits, as a root frame's; a ratio box that clips or scrolls keeps its ratio whatever it holds) (`box-sizing: border-box`); on a visual part bound to artwork the profile's `inlineSize`/`blockSize` are the box (a disc behind a mark) and the drawing keeps its visual profile's size, centred in it | another field beside `profile`; a frame field the profile misuses, as on a root |
|
|
238
238
|
| `frame: { rules: ["block-end", …] }` (root), `frame: { kind: "control", rules: [...] }` (control part) | region root, control part | the profile's `border-width`, solid, on the named logical sides only, painted by the element's surface `border-color` (mirrors in RTL); on a control part an unruled side keeps the border's space as inset, so the box and its text do not move (a soft field's underline) | empty or repeated sides; no profile width (`rule-width-missing`); no surface border colour (`rule-paint-missing`); on a grid |
|
|
239
239
|
| `frame: { corners: ["end-start", "end-end"] }` | region root | the frame profile's `radius` (or the corner's own, below) on the named corners (block edge, then inline edge), `0` on the others, as `border-<corner>-radius`; every corner without it | a named corner with no radius in the frame profile (`profile-field-missing`) |
|
|
240
240
|
| frame profile `startStartRadius` / `startEndRadius` / `endStartRadius` / `endEndRadius` | region root, part box | that corner's radius in place of the profile's `radius` (a chat bubble's small tail corner), all four as `border-<corner>-radius`; a corner with neither is square | a control frame (`profile-field-unsupported`) |
|
|
@@ -264,6 +264,7 @@ them all.
|
|
|
264
264
|
| `content: { counter \| counters: "<name>", style?, separator?, prefix?, suffix? }` | a `marker` or `before` treatment | `content: counter(name, style)` or `counters(name, "sep", style)` (1.1.2) between quoted literals; `style` is a number system (`decimal`, `decimal-leading-zero`, `lower-alpha`, `upper-alpha`, `lower-roman`, `upper-roman`) | a literal longer than four characters or with letters, `separator` with `counter`, a CSS keyword as a name (`spec/value-invalid`) |
|
|
265
265
|
| `counter: { reset?, increment? }` | root, part | `counter-reset` where a count starts, `counter-increment` on what it counts; names are shared across components (a `List` resets, a `ListItem` increments); `list-item` is the browser's own list counter | a CSS keyword as a name (`spec/value-invalid`) |
|
|
266
266
|
| `markers: [<style per depth>]` | a list root | `list-style-type` on the list and on the same list nested at each depth (`& li &`), outermost first; deeper lists keep the last: bullets (`disc`, `circle`, `square`, `none`) or a number system | more than three, or an unknown style (`spec/value-invalid`) |
|
|
267
|
+
| `startInside: { slot: "spacing", field: "overlap" }` or `{ slot: "layer", field: "clearBlockStart" }` | root | the root starts that far inside the neighbour before it (a status board pulled over the foot of its title band; a hero under a sticky header, by the bar's height): `margin-block-start: calc(-1 * value)`, positioned so it paints over what it overlaps. A parent that states this part's own space still decides it | anything but those two fields |
|
|
267
268
|
| `anchorClear: { slot: "layer", field: "clearBlockStart" }` or `{ slot: "spacing", field: "anchorGap" }` | root (not a top-layer root), part | `scroll-margin-block-start`: where a jump to the element (a fragment link, `scrollIntoView`) lands below the top of its scroll container. The layer profile's `clearBlockStart` puts it right under the region sticky elements clear; the spacing profile's `anchorGap` is the element's own distance, for a target that lines up with something beside it (a heading level with a sticky side column). Layout is unchanged. ADS does not check that the distance clears what is stuck on the page the owner ends up in | another slot or field (`spec/value-invalid`); on a top-layer root (`spec/field-unsupported`) |
|
|
268
269
|
| `overflow: "clip" \| "scroll-block" \| "scroll-inline" \| "scroll-both"` | root, part | `overflow` (physical x/y pair of the horizontal writing mode) and a released axis minimum. With `overscroll: "contain"` beside a scrolling value, `overscroll-behavior: contain`: reaching its end does not scroll the dialog or page behind it | on a top-layer root (`profile-provider-conflict`); with truncation |
|
|
269
270
|
| `justify: "space-between" \| "space-around" \| "space-evenly"` | inline or stack root, part | `justify-content`: the free space between the items (a logo at the start, actions at the end); a wrapping row distributes each line | `field-unsupported` on a layered element (its layers share one area) |
|
|
@@ -851,6 +852,13 @@ recipe({
|
|
|
851
852
|
A zoom view that grows an image from its place sets a measured `translate`
|
|
852
853
|
and a measured `scale` (`{ type: "scale", property: "scale" }`, unitless
|
|
853
854
|
factors per axis) on the image and animates them with their `motion`.
|
|
855
|
+
- **Drawer** (`element: "popover"`; `edge: "start" | "end"`; `clear?`,
|
|
856
|
+
`motion?: "slide" | "fade"`, `backdrop?: { surface }`): a non-modal panel
|
|
857
|
+
attached to an inline edge, the full height below what it keeps clear (the
|
|
858
|
+
layer profile's `clearBlockStart`: a docs sidebar under a sticky bar, which
|
|
859
|
+
stays usable), sliding its own extent in, mirrored under right-to-left. Its
|
|
860
|
+
veil (the popover's backdrop) also starts below the cleared bar. `corner`
|
|
861
|
+
does not apply.
|
|
854
862
|
- **Anchored popover** (`element: "popover"`; `popover: "auto" | "manual"`): a
|
|
855
863
|
non-modal panel pinned to a viewport `corner` by logical insets, with light
|
|
856
864
|
dismiss and Escape from `popover="auto"`. A `layer` profile (`edge-gap`,
|
|
@@ -1224,7 +1232,7 @@ audited width.
|
|
|
1224
1232
|
|
|
1225
1233
|
[Spatial profiles](PROFILE-KINDS.md#spatial) own units, scales, ratios, max
|
|
1226
1234
|
width, track counts, breakpoints, gutter pairs, fixed sides and named
|
|
1227
|
-
conditions. Owner `at` selects those names. A relative condition such as `below: "--form-wrap-width"` keeps
|
|
1235
|
+
conditions. Owner `at` selects those names. A condition may also hold on the input: `hover: "none"` (no hover, a touch screen) or `pointer: "coarse"`, alone or beside `below`, where it means either ("below 905 px or without hover"); outside it is neither. A relative condition such as `below: "--form-wrap-width"` keeps
|
|
1228
1236
|
its 30em meaning; no root size is assumed.
|
|
1229
1237
|
|
|
1230
1238
|
Every declared spatial profile reads through the grid algebra, selected or not
|
package/docs/PROFILE-KINDS.md
CHANGED
|
@@ -101,6 +101,12 @@ The example design system's detailed text specimen is `profiles/Typography/detai
|
|
|
101
101
|
|
|
102
102
|
## Surface
|
|
103
103
|
|
|
104
|
+
A surface's `textFill` (`gradient`) paints its text with the gradient
|
|
105
|
+
(`background-clip: text`, the text's fill transparent) over its `color`, which
|
|
106
|
+
it needs: the fallback in forced colours and older browsers, and what text
|
|
107
|
+
contrast is proven on (`construction/surface-effect-misplaced` without it, or
|
|
108
|
+
beside a `backgroundImage`).
|
|
109
|
+
|
|
104
110
|
Fields: `background`, `color`, `borderColor` and `textDecorationColor` (an
|
|
105
111
|
underline's paint, which a state and a paint transition change like any paint)
|
|
106
112
|
(`paint`), `boxShadow`
|
package/docs/RULES.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- Generated by scripts/sync-rule-reference.mjs from src/ads-errors.mts and src/finding-rules.mts. Do not edit: run `bun run sync:rule-reference`. -->
|
|
4
4
|
|
|
5
|
-
Every rule ADS reports, under its rule group:
|
|
5
|
+
Every rule ADS reports, under its rule group: 465 rules in 18 groups. A finding names its rule as a code,
|
|
6
6
|
`<domain>/<kind>`; the `check/<rule>` codes are the rules `ads check`, `ads validate`, the render audit and acceptance
|
|
7
7
|
report by their plain name (`check/a11y-reflow` is the finding `a11y-reflow`).
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ Fix findings in group order: earlier groups are often the cause of later ones. T
|
|
|
19
19
|
| 2 | [unresolved-reference](#unresolved-reference) | 39 | violated | The source names something that does not exist in this revision. | Correct the name from the existing candidates. Declare a new one only when it is genuinely new design. |
|
|
20
20
|
| 3 | [boundary](#boundary) | 30 | violated | Code reaches across an ownership or production/development boundary. | Move the code to its owner or pass the value through public props. Do not add an exception or widen the boundary. |
|
|
21
21
|
| 4 | [design-bypass](#design-bypass) | 20 | violated | Styling or design values are supplied outside the design language. | Take the value from a profile, token or recipe instead of writing it in place. |
|
|
22
|
-
| 5 | [structure-mismatch](#structure-mismatch) |
|
|
22
|
+
| 5 | [structure-mismatch](#structure-mismatch) | 57 | violated | Rendered markup does not match what its declaration promises. | Make the markup match the declaration: each declared part, cell and binding exactly once, in the declared order. Change the declaration only if it is wrong. |
|
|
23
23
|
| 6 | [accessibility-semantics](#accessibility-semantics) | 49 | violated | Owned markup or motion lacks required accessible semantics: a text alternative, an accessible name, keyboard access or reduced motion. | Add the missing semantics in the owning component (alt, aria-label, a native control, a reduced-motion value); do not suppress the check. |
|
|
24
24
|
| 7 | [project-files](#project-files) | 6 | violated | A required project file or declaration is missing, empty, undocumented or unused. | Add or complete the file the rule names (README, license, theme or brand values), or remove what nothing uses. |
|
|
25
25
|
| 8 | [wrong-value](#wrong-value) | 74 | violated | A value has the wrong kind, role or range for where it is used. | Choose one of the allowed values the error lists. |
|
|
@@ -222,6 +222,7 @@ Rendered markup does not match what its declaration promises. Make the markup ma
|
|
|
222
222
|
| `source/placement-without-root` | error | A placement positions a styled root; an element with a placement also carries its own recipe styling. | Add the element's recipe output beside its placement, or move the placement to the styled root. | `ads://guides/layout` |
|
|
223
223
|
| `source/pseudo-host-unsupported` | error | A part treats only pseudo-elements its element has: `::placeholder` belongs to `<input>` and `<textarea>`. | Move the pseudo treatment to the part that renders the input or textarea, or render that element for this part. | `ads://guides/recipes` |
|
|
224
224
|
| `source/resize-not-textarea` | error | `normalize.resize` states how the user may resize a multi-line text field: it belongs on a part rendered as `<textarea>`. No other element has a resize handle in this language; a region's size comes from its recipe. | Declare `resize` on the part rendered as `<textarea>`, or remove it. | `ads://guides/recipes` |
|
|
225
|
+
| `source/root-margin-unreset` | error | A recipe root rendered as an element the browser gives a margin (`figure`, `p`, a list, a heading, `blockquote`, `pre`, `fieldset`) states its margin: its parts are reset by their construction, but a root keeps the browser's (a figure's 40 px sides make it 80 px narrower than its column). | Add `normalize: { margin: 0 }` to the recipe (its parent's space still applies), or render the root as a <div>. | `ads://guides/recipes` |
|
|
225
226
|
| `source/scheme-image-element` | error | A part that declares `scheme` is one drawing of a light and dark pair: a content `<img>` without an artwork binding, or declared artwork bound for a theme of that scheme (a logo black on light, white on dark). | Render a content pair as plain `<img>` elements whose `src` the application supplies; bind declared artwork for a theme of the part's scheme (`recipe({ theme: "dark", … })` on the dark part); or remove `scheme`. | `ads://guides/recipes`, `ads://guides/branding` |
|
|
226
227
|
| `source/scheme-image-not-lazy` | error | In a light and dark image pair, the image of the scheme the default theme (the first declared) does not have is `loading="lazy"` in every choice: a hidden lazy image is not downloaded, an eager one is. Only the default scheme's image may load eagerly. | Write `loading="lazy"` on that image as a literal and apply any priority (eager loading, `fetchPriority`) to the default scheme's image only. | `ads://guides/recipes` |
|
|
227
228
|
| `source/scheme-image-size-missing` | error | Both images of a light and dark pair state `width` and `height`: each file's own pixel size, so the box is reserved before either loads and the page does not move when the theme changes. | Set `width` and `height` on both images from each file's own pixel size. | `ads://guides/recipes` |
|