@reqvire-org/ads 0.5.15 → 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 +2 -0
- package/dist/construction-spec.d.mts +10 -1
- package/dist/construction-spec.mjs +28 -1
- 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 +8 -3
- 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 +61 -0
- package/docs/LANGUAGE.md +9 -1
- package/docs/PROFILE-KINDS.md +6 -0
- package/package.json +1 -1
package/dist/ads-errors.mjs
CHANGED
|
@@ -1083,6 +1083,8 @@ export const constructionErrors = {
|
|
|
1083
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.`;
|
|
1084
1084
|
case "brightness-off-visual":
|
|
1085
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.`;
|
|
1086
1088
|
case "scrollbar-off-scroller":
|
|
1087
1089
|
return `Surface ${failure.surface} declares ${failure.field}, but it is applied to an element that does not scroll, which has no scrollbar.`;
|
|
1088
1090
|
case "scrollbar-pair":
|
|
@@ -949,7 +949,14 @@ export interface AnchoredPopover {
|
|
|
949
949
|
/** What the panel keeps clear of at the block start: nothing, or a fixed-size region (the layer profile's `clear-block-start`). */
|
|
950
950
|
readonly clear: "none" | "block-start";
|
|
951
951
|
/** `"fade"`, or `"drop"`: faded and moved down its motion profile's distance from a shade smaller (a header's menu). */
|
|
952
|
-
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;
|
|
953
960
|
}
|
|
954
961
|
/**
|
|
955
962
|
* A `popover` root anchored to an element (its trigger, a pointer, a text
|
|
@@ -1014,6 +1021,8 @@ export interface RegionSpec {
|
|
|
1014
1021
|
readonly frameAt: FrameCondition | null;
|
|
1015
1022
|
/** Where a jump to the root lands; never on a top-layer root, which is not in the page's flow. */
|
|
1016
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;
|
|
1017
1026
|
/** The geometry the root takes under owner states; never on a top-layer root. */
|
|
1018
1027
|
readonly geometryWhen: readonly StateGeometry[];
|
|
1019
1028
|
readonly geometryTransition: GeometryTransition | null;
|
|
@@ -1299,6 +1299,14 @@ function regionPart(name, value, read, path, nested) {
|
|
|
1299
1299
|
paints: runtimePaints(part.paints, `${path}.paints`, read)
|
|
1300
1300
|
};
|
|
1301
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
|
+
}
|
|
1302
1310
|
function anchorClear(value, path, read) {
|
|
1303
1311
|
if (value === void 0)
|
|
1304
1312
|
return null;
|
|
@@ -1444,6 +1452,7 @@ function region(authored, read) {
|
|
|
1444
1452
|
"snap",
|
|
1445
1453
|
"extent",
|
|
1446
1454
|
"anchorClear",
|
|
1455
|
+
"startInside",
|
|
1447
1456
|
"overlap",
|
|
1448
1457
|
"geometryTransition",
|
|
1449
1458
|
"focus",
|
|
@@ -1486,6 +1495,7 @@ function region(authored, read) {
|
|
|
1486
1495
|
press: rootStates.press,
|
|
1487
1496
|
paintTransition: paintTransition(spec.paintTransition, "recipe.paintTransition", read),
|
|
1488
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),
|
|
1489
1499
|
anchorClear: layer !== null && spec.anchorClear !== void 0 ? read.reject({ kind: "field-unsupported", construction: "region", path: "recipe.anchorClear" }) : anchorClear(spec.anchorClear, "recipe.anchorClear", read),
|
|
1490
1500
|
textWhen: rootStates.texts,
|
|
1491
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),
|
|
@@ -1527,12 +1537,29 @@ function layerSpec(value, read) {
|
|
|
1527
1537
|
};
|
|
1528
1538
|
}
|
|
1529
1539
|
case "popover": {
|
|
1530
|
-
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"]);
|
|
1531
1541
|
if (layer.placement !== void 0) {
|
|
1532
1542
|
read.literal(layer.placement, `${path}.placement`, ["measured"]);
|
|
1533
1543
|
read.only(layer, path, ["element", "popover", "placement", "motion"]);
|
|
1534
1544
|
return { kind: "measured-popover", element, popover, motion };
|
|
1535
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
|
+
}
|
|
1536
1563
|
read.only(layer, path, ["element", "popover", "corner", "clear", "motion"]);
|
|
1537
1564
|
const corner = read.object(layer.corner, `${path}.corner`);
|
|
1538
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
|
@@ -289,6 +289,11 @@ function stickyValues(sticky, { profile, slots }) {
|
|
|
289
289
|
...layer["sticky-layer"] === void 0 ? {} : { "z-index": layer["sticky-layer"] }
|
|
290
290
|
};
|
|
291
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
|
+
}
|
|
292
297
|
function anchorClearValues(binding, { profile, slots }) {
|
|
293
298
|
if (binding === null)
|
|
294
299
|
return {};
|
|
@@ -1249,8 +1254,8 @@ function layerInput(layer, spec, root, slots, profile, foundation, reject) {
|
|
|
1249
1254
|
return reject({ kind: "layer-clearance-unbounded", token: token ?? value, value: fixed });
|
|
1250
1255
|
clear = value;
|
|
1251
1256
|
}
|
|
1252
|
-
const placement = { edgeGap: profile.field(fields, "layer", "edge-gap"), viewportMargin: profile.field(fields, "layer", "viewport-margin"), clear };
|
|
1253
|
-
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 };
|
|
1254
1259
|
}
|
|
1255
1260
|
}
|
|
1256
1261
|
}
|
|
@@ -1412,7 +1417,7 @@ export function lowerRegion(spec, foundation, input) {
|
|
|
1412
1417
|
for (const rule of layered.value.documents)
|
|
1413
1418
|
out.document(rule);
|
|
1414
1419
|
} else {
|
|
1415
|
-
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);
|
|
1416
1421
|
if (spec.parts.some((part) => part.decoration !== null))
|
|
1417
1422
|
Object.assign(values, decorationHost(values));
|
|
1418
1423
|
Object.assign(values, stageValues(spec.parts, values, context));
|
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,66 @@
|
|
|
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
|
+
|
|
3
64
|
## 0.5.15
|
|
4
65
|
|
|
5
66
|
<!-- ads-local-tests:start -->
|
package/docs/LANGUAGE.md
CHANGED
|
@@ -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`
|