@reqvire-org/ads 0.5.11 → 0.5.12
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 +5 -5
- package/dist/analysis/owner-source.mjs +3 -3
- package/dist/construction-output.mjs +5 -0
- package/dist/construction-spec.mjs +1 -1
- package/dist/lowering-region-layout.mjs +3 -1
- package/dist/region-lowering.mjs +5 -3
- package/dist/render-audit/render-states.page.mjs +1 -1
- package/dist/showcase/client.bundle.js +2 -2
- package/dist/showcase/http-client.bundle.js +2 -2
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +2 -2
- package/dist/skills/ads-designer/references/recipes.md +39 -4
- package/dist/skills/ads-import/references/recipes.md +39 -4
- package/dist/skills/ads-port/SKILL.md +5 -0
- package/dist/skills/ads-port/references/recipes.md +39 -4
- package/dist/skills/ads-port/references/testing.md +5 -1
- package/dist/state-conditions.d.mts +3 -3
- package/dist/state-conditions.mjs +1 -1
- package/docs/CHANGELOG.md +34 -18
- package/docs/LANGUAGE.md +16 -6
- package/docs/RULES.md +2 -2
- package/package.json +1 -1
package/dist/ads-errors.mjs
CHANGED
|
@@ -975,7 +975,7 @@ export const choiceErrors = {
|
|
|
975
975
|
},
|
|
976
976
|
"condition-unsupported": {
|
|
977
977
|
group: "wrong-value",
|
|
978
|
-
rule: "A `when` condition selects a state of the owner's root: `&` followed by interaction or form pseudo-classes (:hover, :active, :focus, :focus-visible, :focus-within, :disabled, :enabled, :checked, :indeterminate), `[aria-*]`, `[data-*]` or `[open]` attributes with an optional quoted value, each optionally inside :not(). A state of one of the recipe's own
|
|
978
|
+
rule: "A `when` condition selects a state of the owner's root: `&` followed by interaction or form pseudo-classes (:hover, :active, :focus, :focus-visible, :focus-within, :disabled, :enabled, :checked, :indeterminate), `[aria-*]`, `[data-*]` or `[open]` attributes with an optional quoted value, each optionally inside :not(). `&` is always the owner's root, also in a part's `when`. A state of one of the recipe's own parts is written `:has(> .part:state)`, a nested part by its path from the root (`:has(> .box > .control:focus-visible)`), with :checked, :indeterminate, :focus-visible, :hover or :disabled (a checkbox's native input, a text field's own focus). Pseudo-elements, combinators, classes and other selectors are not states.",
|
|
979
979
|
guides: [RECIPES],
|
|
980
980
|
message: (failure) => `${failure.construction} spec: condition ${failure.condition} at ${failure.path} ${conditionProblem(failure.problem)}.`,
|
|
981
981
|
repair: "Write the condition as owner states only. Style a pseudo-element with the part's `pseudo` treatment (for example `pseudo: { placeholder: { surface } }`), and a child through its own part."
|
|
@@ -1012,9 +1012,9 @@ function conditionProblem(problem) {
|
|
|
1012
1012
|
case "state-repeated":
|
|
1013
1013
|
return `repeats ${problem.state}`;
|
|
1014
1014
|
case "part-state-unsupported":
|
|
1015
|
-
return `has ${problem.text}; a part's state is written \`:has(> .part:state)\` with one of :checked, :indeterminate, :focus-visible, :hover or :disabled`;
|
|
1015
|
+
return `has ${problem.text}; a part's state is written \`:has(> .part:state)\` (a nested part by its path, \`:has(> .box > .part:state)\`) with one of :checked, :indeterminate, :focus-visible, :hover or :disabled`;
|
|
1016
1016
|
case "part-unknown":
|
|
1017
|
-
return `reads a state of ${problem.part}, which is not a
|
|
1017
|
+
return `reads a state of ${problem.part}, which is not the path of a part of this recipe from its root (a nested part is named through its parents, \`.box > .part\`)`;
|
|
1018
1018
|
}
|
|
1019
1019
|
}
|
|
1020
1020
|
export const constructionErrors = {
|
|
@@ -1501,10 +1501,10 @@ export const constructionErrors = {
|
|
|
1501
1501
|
},
|
|
1502
1502
|
"extent-parent-unsupported": {
|
|
1503
1503
|
group: "unsupported",
|
|
1504
|
-
rule: "A part fills its parent's main axis only in a `stack` or `inline` arrangement; a layered part already fills its area, and grids place cells.",
|
|
1504
|
+
rule: "A part fills its parent's main axis only in a `stack` or `inline` arrangement, or, in block flow, the width of its container when it arranges its children (a row becomes a block); a layered part already fills its area, and grids place cells.",
|
|
1505
1505
|
guides: [RECIPES, "ads://guides/layout"],
|
|
1506
1506
|
message: (failure) => `Part "${failure.part}" declares extent fill, but its parent's layout is ${failure.layout}.`,
|
|
1507
|
-
repair: "Arrange the parent as a stack or inline, or remove `extent` (use grid rows `fill` for a grid cell)."
|
|
1507
|
+
repair: "Arrange the parent as a stack or inline, give the part in block flow a `recipe` of its own, or remove `extent` (use grid rows `fill` for a grid cell)."
|
|
1508
1508
|
},
|
|
1509
1509
|
"extent-row-hugs": {
|
|
1510
1510
|
group: "structure-mismatch",
|
|
@@ -646,9 +646,9 @@ async function analyzeOwner(root, emitted, name, program, options, rowsOf, fail)
|
|
|
646
646
|
return fail(opening, { kind: "part-element-mismatch", part: partName, expected: tags.map((expected) => `<${expected}>`), actual: `<${tag}>` });
|
|
647
647
|
switch (element.kind) {
|
|
648
648
|
case "input": {
|
|
649
|
-
const type = attr(opening, "type"), value = type === void 0 ? void 0 : await resolve(expression(type), context);
|
|
650
|
-
if (value !==
|
|
651
|
-
return fail(type ?? opening, { kind: "part-element-mismatch", part: partName, expected:
|
|
649
|
+
const type = attr(opening, "type"), value = type === void 0 ? element.type === "text" ? "text" : void 0 : await resolve(expression(type), context), accepted = element.type === "search" ? ["search"] : [...TEXT_ENTRY_TYPES].filter((entry) => entry !== "search");
|
|
650
|
+
if (typeof value !== "string" || !accepted.includes(value))
|
|
651
|
+
return fail(type ?? opening, { kind: "part-element-mismatch", part: partName, expected: accepted.map((entry) => `<input type="${entry}">`), actual: `<input type=${JSON.stringify(value ?? null)}>` });
|
|
652
652
|
return;
|
|
653
653
|
}
|
|
654
654
|
case "summary": {
|
|
@@ -363,6 +363,7 @@ export function controlBox(frame, envelope, field, reject) {
|
|
|
363
363
|
insets: { blockStart, blockEnd, inlineStart, inlineEnd },
|
|
364
364
|
padding: { blockStart: blockPadding(blockStart), blockEnd: blockPadding(blockEnd), inlineStart, inlineEnd },
|
|
365
365
|
border: b,
|
|
366
|
+
borderStyle: frame[BORDER_STYLE] ?? "solid",
|
|
366
367
|
radius: field(frame, "frame", "radius")
|
|
367
368
|
};
|
|
368
369
|
}
|
|
@@ -403,5 +404,9 @@ export const controlBoxValues = (box) => ({
|
|
|
403
404
|
"padding-block-start": box.padding.blockStart,
|
|
404
405
|
"padding-block-end": box.padding.blockEnd,
|
|
405
406
|
...border(box.border),
|
|
407
|
+
"border-top-style": box.borderStyle,
|
|
408
|
+
"border-right-style": box.borderStyle,
|
|
409
|
+
"border-bottom-style": box.borderStyle,
|
|
410
|
+
"border-left-style": box.borderStyle,
|
|
406
411
|
"border-radius": box.radius
|
|
407
412
|
});
|
|
@@ -89,7 +89,7 @@ export function parseConstruction(spec) {
|
|
|
89
89
|
case "grid":
|
|
90
90
|
return grid(spec, read);
|
|
91
91
|
}
|
|
92
|
-
})(), direct = new Set(declaredParts(parsed).
|
|
92
|
+
})(), direct = new Set(declaredParts(parsed).map((part) => [...part.within, part.selector].join(" > ")));
|
|
93
93
|
for (const use of partStates)
|
|
94
94
|
if (!direct.has(use.part))
|
|
95
95
|
return reject({ kind: "condition-unsupported", construction, path: use.path, condition: use.condition, problem: { kind: "part-unknown", part: use.part } });
|
|
@@ -148,11 +148,13 @@ export function textLayoutValues(layout, part, hasText) {
|
|
|
148
148
|
export function growsWithContent(values) {
|
|
149
149
|
return values["min-block-size"] !== void 0 && values["min-block-size"] !== "0" && values["block-size"] === void 0 && values["max-block-size"] === void 0 && values["aspect-ratio"] === void 0 && values.overflow === void 0;
|
|
150
150
|
}
|
|
151
|
-
export function extentValues(extent, parent, part, parentGrows = !1, parentWraps = !1) {
|
|
151
|
+
export function extentValues(extent, parent, part, parentGrows = !1, parentWraps = !1, arranged = !1) {
|
|
152
152
|
switch (extent.kind) {
|
|
153
153
|
case "content":
|
|
154
154
|
return ok({});
|
|
155
155
|
case "fill": {
|
|
156
|
+
if (parent === "native" && arranged && extent.axis !== "both")
|
|
157
|
+
return ok({});
|
|
156
158
|
if (parent !== "stack" && parent !== "inline")
|
|
157
159
|
return err({ kind: "extent-parent-unsupported", part, layout: parent });
|
|
158
160
|
const main = parent === "stack" ? "block" : "inline", values = { "flex-grow": "1", "flex-shrink": "1", "flex-basis": parent === "stack" ? "auto" : "0" };
|
package/dist/region-lowering.mjs
CHANGED
|
@@ -947,7 +947,7 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
947
947
|
transitionRules(path, part.paintTransition, part.surface === null ? null : { name: part.surface, fields: partSurface }, part.when, context, entering === null ? partGroups : [...partGroups, entering.group]);
|
|
948
948
|
writePlays(out, profile, context.foundation, part.name, part.plays, path, [...transitioned(part.paintTransition, entering === null ? [] : [entering.group]), ...moved], reject);
|
|
949
949
|
const values = part.arrangement === null ? {} : { "box-sizing": "border-box", "min-inline-size": "0", ...arrangementValues(part.arrangement, slots, profile, part.overflow) };
|
|
950
|
-
if (parentLayout === "native" && part.arrangement?.layout === "inline" && Object.keys(flowSpace(part, context)).length > 0) {
|
|
950
|
+
if (parentLayout === "native" && part.arrangement?.layout === "inline" && (Object.keys(flowSpace(part, context)).length > 0 || part.extent.kind === "fill")) {
|
|
951
951
|
values.display = "flex";
|
|
952
952
|
if (part.extent.kind !== "fill")
|
|
953
953
|
values["inline-size"] = "fit-content";
|
|
@@ -984,8 +984,10 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
984
984
|
frameFields = controlBoxValues(box);
|
|
985
985
|
if (part.frame.border.kind === "rules") {
|
|
986
986
|
const paint = part.surface === null ? void 0 : profile.of(part.surface, "surface")["border-color"], rules = checked(frameRules(part.frame.border, frame["border-width"], { surface: part.surface, color: paint }, slots["frame-profile"] ?? null, frame[BORDER_STYLE]), reject);
|
|
987
|
-
for (const side of ["top", "right", "bottom", "left"])
|
|
987
|
+
for (const side of ["top", "right", "bottom", "left"]) {
|
|
988
988
|
delete frameFields[`border-${side}-width`];
|
|
989
|
+
delete frameFields[`border-${side}-style`];
|
|
990
|
+
}
|
|
989
991
|
Object.assign(frameFields, rules);
|
|
990
992
|
for (const side of ["block-start", "block-end", "inline-start", "inline-end"])
|
|
991
993
|
if (!part.frame.border.sides.includes(side))
|
|
@@ -1017,7 +1019,7 @@ function lowerPart(part, parent, parentLayout, context, parentGrows, overlapping
|
|
|
1017
1019
|
const partSnap = part.arrangement?.snap ?? null, snapped = partSnap === null ? null : checked(snapValues(partSnap, part.overflow, part.name), reject);
|
|
1018
1020
|
if (snapped !== null)
|
|
1019
1021
|
add(snapped.container, "snap");
|
|
1020
|
-
add(checked(extentValues(part.extent, parentLayout, part.name, parentGrows, parentWraps && keepsWords(part) && values["min-inline-size"] === void 0), reject), "extent");
|
|
1022
|
+
add(checked(extentValues(part.extent, parentLayout, part.name, parentGrows, parentWraps && keepsWords(part) && values["min-inline-size"] === void 0, part.arrangement !== null && part.arrangement.layout !== "native"), reject), "extent");
|
|
1021
1023
|
if (parentLayout === "layered" && part.decoration === null)
|
|
1022
1024
|
add(LAYER, "layer");
|
|
1023
1025
|
if (part.parts.some((child) => child.decoration !== null))
|
|
@@ -263,7 +263,7 @@ export function applyDerived({ target, condition }) {
|
|
|
263
263
|
return { applied: !1, reason: `${part} on <${element.localName}>` };
|
|
264
264
|
continue;
|
|
265
265
|
}
|
|
266
|
-
const has = /^:has\(>\s*(\.[\w-]+)(?::(checked|indeterminate|disabled))?\)$/.exec(part);
|
|
266
|
+
const has = /^:has\(>\s*(\.[\w-]+(?:\s*>\s*\.[\w-]+)*)(?::(checked|indeterminate|disabled))?\)$/.exec(part);
|
|
267
267
|
if (has !== null) {
|
|
268
268
|
const selector = `:scope > ${has[1] ?? ""}`, child = element.querySelector(selector);
|
|
269
269
|
if (child === null)
|