@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
|
@@ -133,10 +133,13 @@ profile's `borderStyle`, never a recipe field.
|
|
|
133
133
|
A `when` entry selects a `surface`, and may select a `text` profile that
|
|
134
134
|
differs from the element's own in weight and tracking only (the chosen option
|
|
135
135
|
is heavier).
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
`&` is always the owner's root, in a part's `when` too. A state of one of the
|
|
137
|
+
recipe's own parts is written `:has(> .part:state)` with `:checked`,
|
|
138
|
+
`:indeterminate`, `:focus-visible`, `:hover` or `:disabled`: a checkbox's box
|
|
139
|
+
under its native input's `:checked`, a field control's own hover. A nested part
|
|
140
|
+
is named by its path from the root: `&:has(> .box > .control:focus-visible)`.
|
|
141
|
+
Never mirror those states into attributes by script, and never split a box
|
|
142
|
+
into its own recipe only to reach its child's state.
|
|
140
143
|
Lowering appends the part's path to the condition, so a pseudo-element, a
|
|
141
144
|
combinator or class, a type, a nested `&`, another attribute operator or a
|
|
142
145
|
functional pseudo-class (`:has`, `:is`, `:dir`) would select a different
|
|
@@ -464,6 +467,38 @@ are declared under `assets/`: see `ads://guides/branding` and
|
|
|
464
467
|
visual profile caps its width (logo strips) instead of its height.
|
|
465
468
|
- **A drawing picked by state.** `const glyph = open ? closeGlyph : arrowGlyph`, drawn with `glyph.source`, is fine.
|
|
466
469
|
|
|
470
|
+
<a id="matching"></a>
|
|
471
|
+
## Matching a reference without nudges
|
|
472
|
+
|
|
473
|
+
A reference implementation (an upstream library, an earlier version of the site)
|
|
474
|
+
often places things by layout mechanics rather than by design: a glyph that sits
|
|
475
|
+
0.8 px low because `vertical-align: middle` aligns it to the parent font's
|
|
476
|
+
x-height on a 24 px line, a gap that comes from half-leading, a negative margin
|
|
477
|
+
that cancels a border. Port the **intent**, not the mechanics. A number that only
|
|
478
|
+
reproduces a measurement (`1.594px`, `-1px`, `translate: 0 0.8px`) is a nudge:
|
|
479
|
+
it has no design meaning, it is wrong at the next font, size or theme, and ADS
|
|
480
|
+
rejects owner nudges. Find the construct that states the intent:
|
|
481
|
+
|
|
482
|
+
| What the measurement shows | Construct that states it |
|
|
483
|
+
| --- | --- |
|
|
484
|
+
| A glyph or logo looks off-centre in its box (a magnifier's handle, a play triangle, a mark heavier on one side) | The asset's `opticalCenter`, once for every size and use ([branding.md](branding.md)) |
|
|
485
|
+
| A glyph looks too heavy or thin at one size | Optical drawings per size token (`sizing: "optical"`), not a scale |
|
|
486
|
+
| An icon or control sits a fraction of a pixel off the reference because the reference aligned it on a text line (`vertical-align`, baseline, x-height) | Keep ADS's box alignment (`align: "center"`) and record the difference. If the design means "on the text's centre", report it as a missing concept |
|
|
487
|
+
| Space above or below text differs by its half-leading | The text profile's line height and the spacing tokens; `flow: { edges: "trim" }` for a flow's outer edges |
|
|
488
|
+
| Neighbours overlap (a pile of avatars, cards over each other) | The spacing profile's `overlap` |
|
|
489
|
+
| A backdrop or glow extends past its parent | `outset` on a layer of a `layered` parent |
|
|
490
|
+
| A panel sits a fixed distance from its trigger | The layer profile's `anchorGap`/`anchorOverlap` and `anchorOutdent`/`anchorIndent` |
|
|
491
|
+
| Labels sit at points of a drawing | A text part's `anchor: { artwork, x, y }` |
|
|
492
|
+
| Step labels sit under a slider's handle positions | A row `along` the slider with measured `slider-step` shares |
|
|
493
|
+
| A scale grows from an edge, not the centre | `origin` |
|
|
494
|
+
| A position or size is known only at runtime | Measured values (`measured.props`/`set`), never an inline style |
|
|
495
|
+
| A difference of under a pixel from font rasterization, rounding or a fallback font | Nothing: wait for fonts, compare again and record it |
|
|
496
|
+
|
|
497
|
+
When no construct states the intent, keep ADS's geometry, record the difference
|
|
498
|
+
from the reference with its cause, and report the missing concept as an ADS
|
|
499
|
+
request. Do not reproduce the reference with an inset, margin, translation or
|
|
500
|
+
custom property chosen to match it.
|
|
501
|
+
|
|
467
502
|
<a id="rejected"></a>
|
|
468
503
|
## What is rejected, and why
|
|
469
504
|
|
|
@@ -133,10 +133,13 @@ profile's `borderStyle`, never a recipe field.
|
|
|
133
133
|
A `when` entry selects a `surface`, and may select a `text` profile that
|
|
134
134
|
differs from the element's own in weight and tracking only (the chosen option
|
|
135
135
|
is heavier).
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
`&` is always the owner's root, in a part's `when` too. A state of one of the
|
|
137
|
+
recipe's own parts is written `:has(> .part:state)` with `:checked`,
|
|
138
|
+
`:indeterminate`, `:focus-visible`, `:hover` or `:disabled`: a checkbox's box
|
|
139
|
+
under its native input's `:checked`, a field control's own hover. A nested part
|
|
140
|
+
is named by its path from the root: `&:has(> .box > .control:focus-visible)`.
|
|
141
|
+
Never mirror those states into attributes by script, and never split a box
|
|
142
|
+
into its own recipe only to reach its child's state.
|
|
140
143
|
Lowering appends the part's path to the condition, so a pseudo-element, a
|
|
141
144
|
combinator or class, a type, a nested `&`, another attribute operator or a
|
|
142
145
|
functional pseudo-class (`:has`, `:is`, `:dir`) would select a different
|
|
@@ -464,6 +467,38 @@ are declared under `assets/`: see `ads://guides/branding` and
|
|
|
464
467
|
visual profile caps its width (logo strips) instead of its height.
|
|
465
468
|
- **A drawing picked by state.** `const glyph = open ? closeGlyph : arrowGlyph`, drawn with `glyph.source`, is fine.
|
|
466
469
|
|
|
470
|
+
<a id="matching"></a>
|
|
471
|
+
## Matching a reference without nudges
|
|
472
|
+
|
|
473
|
+
A reference implementation (an upstream library, an earlier version of the site)
|
|
474
|
+
often places things by layout mechanics rather than by design: a glyph that sits
|
|
475
|
+
0.8 px low because `vertical-align: middle` aligns it to the parent font's
|
|
476
|
+
x-height on a 24 px line, a gap that comes from half-leading, a negative margin
|
|
477
|
+
that cancels a border. Port the **intent**, not the mechanics. A number that only
|
|
478
|
+
reproduces a measurement (`1.594px`, `-1px`, `translate: 0 0.8px`) is a nudge:
|
|
479
|
+
it has no design meaning, it is wrong at the next font, size or theme, and ADS
|
|
480
|
+
rejects owner nudges. Find the construct that states the intent:
|
|
481
|
+
|
|
482
|
+
| What the measurement shows | Construct that states it |
|
|
483
|
+
| --- | --- |
|
|
484
|
+
| A glyph or logo looks off-centre in its box (a magnifier's handle, a play triangle, a mark heavier on one side) | The asset's `opticalCenter`, once for every size and use ([branding.md](branding.md)) |
|
|
485
|
+
| A glyph looks too heavy or thin at one size | Optical drawings per size token (`sizing: "optical"`), not a scale |
|
|
486
|
+
| An icon or control sits a fraction of a pixel off the reference because the reference aligned it on a text line (`vertical-align`, baseline, x-height) | Keep ADS's box alignment (`align: "center"`) and record the difference. If the design means "on the text's centre", report it as a missing concept |
|
|
487
|
+
| Space above or below text differs by its half-leading | The text profile's line height and the spacing tokens; `flow: { edges: "trim" }` for a flow's outer edges |
|
|
488
|
+
| Neighbours overlap (a pile of avatars, cards over each other) | The spacing profile's `overlap` |
|
|
489
|
+
| A backdrop or glow extends past its parent | `outset` on a layer of a `layered` parent |
|
|
490
|
+
| A panel sits a fixed distance from its trigger | The layer profile's `anchorGap`/`anchorOverlap` and `anchorOutdent`/`anchorIndent` |
|
|
491
|
+
| Labels sit at points of a drawing | A text part's `anchor: { artwork, x, y }` |
|
|
492
|
+
| Step labels sit under a slider's handle positions | A row `along` the slider with measured `slider-step` shares |
|
|
493
|
+
| A scale grows from an edge, not the centre | `origin` |
|
|
494
|
+
| A position or size is known only at runtime | Measured values (`measured.props`/`set`), never an inline style |
|
|
495
|
+
| A difference of under a pixel from font rasterization, rounding or a fallback font | Nothing: wait for fonts, compare again and record it |
|
|
496
|
+
|
|
497
|
+
When no construct states the intent, keep ADS's geometry, record the difference
|
|
498
|
+
from the reference with its cause, and report the missing concept as an ADS
|
|
499
|
+
request. Do not reproduce the reference with an inset, margin, translation or
|
|
500
|
+
custom property chosen to match it.
|
|
501
|
+
|
|
467
502
|
<a id="rejected"></a>
|
|
468
503
|
## What is rejected, and why
|
|
469
504
|
|
|
@@ -157,6 +157,11 @@ inspect screenshots. Verify project token mappings and consistency with existing
|
|
|
157
157
|
controls as well as required upstream behavior. Intentional project styling is
|
|
158
158
|
not a failed parity check; retain the unmodified reference and record the
|
|
159
159
|
difference. A screenshot alone does not establish behavior or motion parity.
|
|
160
|
+
When a measured difference comes from the reference's layout mechanics (a
|
|
161
|
+
glyph aligned on a text line, half-leading, a cancelling margin), port the
|
|
162
|
+
intent with the construct [recipes.md](references/recipes.md#matching) names
|
|
163
|
+
for it (`opticalCenter`, `overlap`, `outset`, anchor offsets) and never with a
|
|
164
|
+
pixel value chosen to match the measurement.
|
|
160
165
|
|
|
161
166
|
Keep browser automation in isolated pages/contexts. Rebuild static playgrounds
|
|
162
167
|
after source changes. Test the public consumer path as well as component internals;
|
|
@@ -133,10 +133,13 @@ profile's `borderStyle`, never a recipe field.
|
|
|
133
133
|
A `when` entry selects a `surface`, and may select a `text` profile that
|
|
134
134
|
differs from the element's own in weight and tracking only (the chosen option
|
|
135
135
|
is heavier).
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
`&` is always the owner's root, in a part's `when` too. A state of one of the
|
|
137
|
+
recipe's own parts is written `:has(> .part:state)` with `:checked`,
|
|
138
|
+
`:indeterminate`, `:focus-visible`, `:hover` or `:disabled`: a checkbox's box
|
|
139
|
+
under its native input's `:checked`, a field control's own hover. A nested part
|
|
140
|
+
is named by its path from the root: `&:has(> .box > .control:focus-visible)`.
|
|
141
|
+
Never mirror those states into attributes by script, and never split a box
|
|
142
|
+
into its own recipe only to reach its child's state.
|
|
140
143
|
Lowering appends the part's path to the condition, so a pseudo-element, a
|
|
141
144
|
combinator or class, a type, a nested `&`, another attribute operator or a
|
|
142
145
|
functional pseudo-class (`:has`, `:is`, `:dir`) would select a different
|
|
@@ -464,6 +467,38 @@ are declared under `assets/`: see `ads://guides/branding` and
|
|
|
464
467
|
visual profile caps its width (logo strips) instead of its height.
|
|
465
468
|
- **A drawing picked by state.** `const glyph = open ? closeGlyph : arrowGlyph`, drawn with `glyph.source`, is fine.
|
|
466
469
|
|
|
470
|
+
<a id="matching"></a>
|
|
471
|
+
## Matching a reference without nudges
|
|
472
|
+
|
|
473
|
+
A reference implementation (an upstream library, an earlier version of the site)
|
|
474
|
+
often places things by layout mechanics rather than by design: a glyph that sits
|
|
475
|
+
0.8 px low because `vertical-align: middle` aligns it to the parent font's
|
|
476
|
+
x-height on a 24 px line, a gap that comes from half-leading, a negative margin
|
|
477
|
+
that cancels a border. Port the **intent**, not the mechanics. A number that only
|
|
478
|
+
reproduces a measurement (`1.594px`, `-1px`, `translate: 0 0.8px`) is a nudge:
|
|
479
|
+
it has no design meaning, it is wrong at the next font, size or theme, and ADS
|
|
480
|
+
rejects owner nudges. Find the construct that states the intent:
|
|
481
|
+
|
|
482
|
+
| What the measurement shows | Construct that states it |
|
|
483
|
+
| --- | --- |
|
|
484
|
+
| A glyph or logo looks off-centre in its box (a magnifier's handle, a play triangle, a mark heavier on one side) | The asset's `opticalCenter`, once for every size and use ([branding.md](branding.md)) |
|
|
485
|
+
| A glyph looks too heavy or thin at one size | Optical drawings per size token (`sizing: "optical"`), not a scale |
|
|
486
|
+
| An icon or control sits a fraction of a pixel off the reference because the reference aligned it on a text line (`vertical-align`, baseline, x-height) | Keep ADS's box alignment (`align: "center"`) and record the difference. If the design means "on the text's centre", report it as a missing concept |
|
|
487
|
+
| Space above or below text differs by its half-leading | The text profile's line height and the spacing tokens; `flow: { edges: "trim" }` for a flow's outer edges |
|
|
488
|
+
| Neighbours overlap (a pile of avatars, cards over each other) | The spacing profile's `overlap` |
|
|
489
|
+
| A backdrop or glow extends past its parent | `outset` on a layer of a `layered` parent |
|
|
490
|
+
| A panel sits a fixed distance from its trigger | The layer profile's `anchorGap`/`anchorOverlap` and `anchorOutdent`/`anchorIndent` |
|
|
491
|
+
| Labels sit at points of a drawing | A text part's `anchor: { artwork, x, y }` |
|
|
492
|
+
| Step labels sit under a slider's handle positions | A row `along` the slider with measured `slider-step` shares |
|
|
493
|
+
| A scale grows from an edge, not the centre | `origin` |
|
|
494
|
+
| A position or size is known only at runtime | Measured values (`measured.props`/`set`), never an inline style |
|
|
495
|
+
| A difference of under a pixel from font rasterization, rounding or a fallback font | Nothing: wait for fonts, compare again and record it |
|
|
496
|
+
|
|
497
|
+
When no construct states the intent, keep ADS's geometry, record the difference
|
|
498
|
+
from the reference with its cause, and report the missing concept as an ADS
|
|
499
|
+
request. Do not reproduce the reference with an inset, margin, translation or
|
|
500
|
+
custom property chosen to match it.
|
|
501
|
+
|
|
467
502
|
<a id="rejected"></a>
|
|
468
503
|
## What is rejected, and why
|
|
469
504
|
|
|
@@ -94,7 +94,11 @@ measure exit-state and removal timestamps. Timing assertions should allow normal
|
|
|
94
94
|
browser scheduling tolerance.
|
|
95
95
|
|
|
96
96
|
Inspect screenshots of settled states and intermediate/problem states. Pixel
|
|
97
|
-
equality is not expected when the native skin intentionally differs. A
|
|
97
|
+
equality is not expected when the native skin intentionally differs. A
|
|
98
|
+
difference that the reference's layout mechanics produce (an inline glyph's
|
|
99
|
+
`vertical-align`, half-leading, font metrics) is explained, not copied: see
|
|
100
|
+
[recipes.md](recipes.md#matching) for the construct that states the intent, or
|
|
101
|
+
record the difference and its cause. A computed
|
|
98
102
|
duration of 400 ms does not prove a 400 ms visible exit if the DOM disappears at
|
|
99
103
|
200 ms. Reduced motion can set animation names to `none` while a reset still
|
|
100
104
|
reports a tiny nonzero duration; assert effective motion behavior.
|
|
@@ -10,7 +10,7 @@ export type StateToken = {
|
|
|
10
10
|
readonly name: StatePseudoClass;
|
|
11
11
|
readonly negated: boolean;
|
|
12
12
|
}
|
|
13
|
-
/** A
|
|
13
|
+
/** A part (by its class path from the root) is in a state: `:has(> .part:state)`, `:has(> .box > .part:state)`. */
|
|
14
14
|
| {
|
|
15
15
|
readonly kind: "part";
|
|
16
16
|
readonly part: string;
|
|
@@ -57,12 +57,12 @@ export type ConditionProblem =
|
|
|
57
57
|
readonly kind: "state-repeated";
|
|
58
58
|
readonly state: string;
|
|
59
59
|
}
|
|
60
|
-
/** `:has(…)` in another shape than a
|
|
60
|
+
/** `:has(…)` in another shape than a part's class path and one part state. */
|
|
61
61
|
| {
|
|
62
62
|
readonly kind: "part-state-unsupported";
|
|
63
63
|
readonly text: string;
|
|
64
64
|
}
|
|
65
|
-
/** `:has(> .class:state)` whose class is no
|
|
65
|
+
/** `:has(> .class:state)` whose class path is no declared part's path from the root. */
|
|
66
66
|
| {
|
|
67
67
|
readonly kind: "part-unknown";
|
|
68
68
|
readonly part: string;
|
|
@@ -16,7 +16,7 @@ function simple(source, at) {
|
|
|
16
16
|
if (rest.startsWith("::"))
|
|
17
17
|
return err({ kind: "pseudo-element", name: IDENTIFIER.exec(rest.slice(2))?.[0] ?? rest.slice(2) });
|
|
18
18
|
if (rest.startsWith(":has(")) {
|
|
19
|
-
const match = /^:has\(> (\.-?[a-z_][\w-]*):([a-z-]+)\)/i.exec(rest), state = match?.[2]?.toLowerCase();
|
|
19
|
+
const match = /^:has\(> (\.-?[a-z_][\w-]*(?: > \.-?[a-z_][\w-]*)*):([a-z-]+)\)/i.exec(rest), state = match?.[2]?.toLowerCase();
|
|
20
20
|
if (match?.[1] === void 0 || state === void 0 || !PART_STATES.includes(state))
|
|
21
21
|
return err({ kind: "part-state-unsupported", text: rest.slice(0, rest.indexOf(")") + 1 || rest.length) });
|
|
22
22
|
return ok({ token: { kind: "part", part: match[1], state }, end: at + match[0].length });
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,53 +1,69 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.5.
|
|
3
|
+
## 0.5.12
|
|
4
4
|
|
|
5
5
|
<!-- ads-local-tests:start -->
|
|
6
6
|
Hot patch: the unit and integration groups; the browser group was not run.
|
|
7
|
-
Local verification: **
|
|
8
|
-
Tested commit: `
|
|
9
|
-
Completed 2026-11-
|
|
7
|
+
Local verification: **1893/1893 passed** with `bun run test:hotpatch`.
|
|
8
|
+
Tested commit: `0ab4f9dcec3214d9352aaf70a30f5ea5269e05e4`; Bun 1.4.4.
|
|
9
|
+
Completed 2026-11-25T22:02:01.497Z (1314 seconds).
|
|
10
10
|
|
|
11
11
|
<!-- ads-local-test-proof
|
|
12
12
|
{
|
|
13
13
|
"schema": 3,
|
|
14
|
-
"version": "0.5.
|
|
15
|
-
"commit": "
|
|
16
|
-
"sourceSha256": "
|
|
14
|
+
"version": "0.5.12",
|
|
15
|
+
"commit": "0ab4f9dcec3214d9352aaf70a30f5ea5269e05e4",
|
|
16
|
+
"sourceSha256": "366f1915be514a6a816ada1a0d4846d63222aef8be3feebff96c0dc5a84c2c5e",
|
|
17
17
|
"command": "bun run test:hotpatch",
|
|
18
18
|
"scope": "hotpatch",
|
|
19
19
|
"result": "pass",
|
|
20
|
-
"tests":
|
|
21
|
-
"pass":
|
|
20
|
+
"tests": 1893,
|
|
21
|
+
"pass": 1893,
|
|
22
22
|
"fail": 0,
|
|
23
23
|
"skipped": 0,
|
|
24
24
|
"groups": [
|
|
25
25
|
{
|
|
26
26
|
"name": "unit",
|
|
27
|
-
"tests":
|
|
28
|
-
"pass":
|
|
27
|
+
"tests": 847,
|
|
28
|
+
"pass": 847,
|
|
29
29
|
"fail": 0,
|
|
30
30
|
"skipped": 0,
|
|
31
|
-
"reportSha256": "
|
|
31
|
+
"reportSha256": "731ee6c987324ee1e034149bb8d767e5bd17ea733ef90c145befd873bed584cd"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "integration",
|
|
35
|
-
"tests":
|
|
36
|
-
"pass":
|
|
35
|
+
"tests": 1046,
|
|
36
|
+
"pass": 1046,
|
|
37
37
|
"fail": 0,
|
|
38
38
|
"skipped": 0,
|
|
39
|
-
"reportSha256": "
|
|
39
|
+
"reportSha256": "8874bdc00aa9f00f2baf6b5c1ab841aa33e40ac5150d799476e2037b7b787384"
|
|
40
40
|
}
|
|
41
41
|
],
|
|
42
42
|
"testOverrides": {},
|
|
43
43
|
"bun": "1.4.4",
|
|
44
|
-
"completedAt": "2026-11-
|
|
45
|
-
"durationMs":
|
|
46
|
-
"logSha256": "
|
|
44
|
+
"completedAt": "2026-11-25T22:02:01.497Z",
|
|
45
|
+
"durationMs": 1313954,
|
|
46
|
+
"logSha256": "811ba9d2b9bbb17a8117fd7a5f555e106cf304e6420968659f2d3dabf3830869"
|
|
47
47
|
}
|
|
48
48
|
-->
|
|
49
49
|
<!-- ads-local-tests:end -->
|
|
50
50
|
|
|
51
|
+
- *Fixed: a row in block flow could not span its column* (#47). `extent: "fill"`
|
|
52
|
+
on a part with its own `recipe` in block flow makes it a block as wide as its
|
|
53
|
+
container; a heading row's `space-between` puts its switch at the column's end.
|
|
54
|
+
- *Fixed: a control frame left a native field its inset border* (#48). A
|
|
55
|
+
`frame: "control"` writes the frame's border style (solid unless it states
|
|
56
|
+
one) beside its widths, so an `<input>` no longer shows the browser's bevelled
|
|
57
|
+
edge. `element: "text-input"` takes every one-line text entry: `text`,
|
|
58
|
+
`email`, `tel`, `url`, `password`, `number` or no type.
|
|
59
|
+
- *A nested part's own state* (#49). A `when` condition names any declared part
|
|
60
|
+
by its path from the root, `&:has(> .box > .control:focus-visible)`, checked
|
|
61
|
+
step by step, so a text field's input inside its box reacts to its own focus
|
|
62
|
+
and hover. `&` stays the owner's root in every `when`; existing conditions
|
|
63
|
+
keep their meaning.
|
|
64
|
+
|
|
65
|
+
## 0.5.11
|
|
66
|
+
|
|
51
67
|
- *A scrolling element's scrollbar colours and width.* A surface's
|
|
52
68
|
`scrollbarThumb` and `scrollbarTrack` (paints, set together) are written as
|
|
53
69
|
`scrollbar-color`, and `scrollbarWidth`, a token of the new
|
package/docs/LANGUAGE.md
CHANGED
|
@@ -270,7 +270,7 @@ them all.
|
|
|
270
270
|
| `align` / `justify` on an element that scrolls | root, part | `safe center` / `safe end` on the axis the element itself scrolls: content stays aligned while it fits and starts at the scroll origin when it overflows, so its start is never unreachable | n/a (automatic) |
|
|
271
271
|
| a rounded frame (`radius`) with visible overflow | region root | n/a | a first or last part of a stack, or a layer, that paints a background over a corner with no inset there (`construction/corner-overpaint`): clip the root, inset it, or round the part |
|
|
272
272
|
| `sticky: { edge: "block-start" \| "block-end", clear?: "block-start" }` | root (not a top-layer root), part | `position: sticky` at that edge of the nearest scrolling container (`inset-block-start: 0`); with `clear`, below the region the layer profile's `clearBlockStart` names; `z-index` from the layer profile's `stickyLayer` when it has one | `clear` with the end edge; `clear` without a layer profile that states `clearBlockStart` |
|
|
273
|
-
| `extent: "fill" \| "fill-both"` | part | `flex: 1 1 0`, the main-axis minimum released, so the part's content is confined to it; in a `stack` whose frame states only a minimum height (`minBlockSize`, with no `blockSize`, `maxBlockSize`, ratio or `overflow`) the part keeps its content's height and the stack grows with it; `align-self: stretch` with `fill-both` | the parent is not `stack`/`inline` (`extent-parent-unsupported`); a frame or reserved lines set that minimum |
|
|
273
|
+
| `extent: "fill" \| "fill-both"` | part | `flex: 1 1 0`, the main-axis minimum released, so the part's content is confined to it; in a `stack` whose frame states only a minimum height (`minBlockSize`, with no `blockSize`, `maxBlockSize`, ratio or `overflow`) the part keeps its content's height and the stack grows with it; `align-self: stretch` with `fill-both`. In block flow (a parent without an arrangement), `fill` on a part with its own `recipe` makes it a block as wide as its container: a heading row whose switch sits at the column's end (a row is `display: flex` there, without `fit-content`) | the parent is not `stack`/`inline` (`extent-parent-unsupported`); a frame or reserved lines set that minimum |
|
|
274
274
|
| `extent: "content" \| "container"` | root of an `inline` row, or of a control | `"content"` (the default): as wide as its content, never wider than its container (`display: inline-flex; max-inline-size: 100%`, or `min(100%, <cap>)` under its frame's own cap); `"container"`: the width available in any parent, a block one, a column that aligns its children, or a row beside siblings (`display: flex; inline-size: 100%`), so a filling part has the rest of the row | on a `stack`, `flow`, `layered` or top-layer root, which never hug (`spec/field-unsupported`); `"container"` with a frame that fixes the row's width (`construction/extent-conflict`); a part with `extent: "fill"` in a `"content"` row whose frame does not fix its width (`construction/extent-row-hugs`) |
|
|
275
275
|
| `layout: "layered"` | root, part recipe | one `minmax(0,1fr)` grid area; every declared child part at `1 / 1`; paint order is DOM order, no `z-index` | fewer than two parts (`layered-parts-missing`); `gap` or `wrap` |
|
|
276
276
|
| `outset: { block?, inline? }` (spacing fields) | a childless, non-text part of a `layered` parent | `margin-block` / `margin-inline: calc(-1 * <spacing>)`: the backdrop is drawn past its parent's box (a glow behind a card); the grid area and the layout around it are unchanged. A field bound to a `box-share` token (the spacing profile's `outsetBlock` / `outsetInline`) is a share of the box on that axis and grows with it: the same margin on the inline axis, and on the block axis `block-size: calc(100% + 2 * <share>)` centred over the area (`align-self: center`) | any other part (`construction/outset-unsupported`) |
|
|
@@ -281,7 +281,7 @@ them all.
|
|
|
281
281
|
| `frame: { profile, rules?, corners? }`; `at: { "<condition>": { frame: { rules?, corners? } } }` | part with its own box | the box's one-sided rules and rounded corners as a root frame's, and under the condition only what the condition changes: a tinted side with a hairline on top and rounded bottom corners while stacked, on its start side and end corners beside | a frame change on a part without its own box; condition `rules` on a box without `rules` (`spec/value-invalid`) |
|
|
282
282
|
| `at: { "<condition>": { align?, justify?, textAlign? } }` | region root, part | the element's arrangement alignment (`align-items`, `justify-content`) and `text-align` inside the condition's range, its own outside it: a banner centred on phones and start-aligned from a width; a root's alignment needs no `frame` | unknown condition (`condition-unknown`); an entry that changes nothing (`spec/value-invalid`) |
|
|
283
283
|
| `recipe.conditionQuery["<condition>"]` | owner code | the literal media range the CSS writes (`(width < 47.5rem)`), for `matchMedia` | the recipe's spatial profile lacks it (`choice/recipe-access-unsupported`) |
|
|
284
|
-
| `element: "iframe" \| "select" \| "search-input" \| "text-input" \| "table" \| "header-cell" \| "cell" \| "list" \| "summary" \| "document"`, `marker: "none"` | root, part (`document`: a pattern's root only) | the element's closed UA normalization (no iframe border, list markers or summary marker; collapsed table; start-aligned, middle cells) | another tag (`source/part-element-mismatch`); a summary outside `<details>` (`source/summary-outside-details`) |
|
|
284
|
+
| `element: "iframe" \| "select" \| "search-input" \| "text-input" \| "table" \| "header-cell" \| "cell" \| "list" \| "summary" \| "document"`, `marker: "none"` | root, part (`document`: a pattern's root only) | the element's closed UA normalization (`text-input`: an `<input>` of type `text`, `email`, `tel`, `url`, `password` or `number`, or without a type; `search-input`: `type="search"`) (no iframe border, list markers or summary marker; collapsed table; start-aligned, middle cells) | another tag (`source/part-element-mismatch`); a summary outside `<details>` (`source/summary-outside-details`) |
|
|
285
285
|
| `align: "start" \| "center" \| "end"` on a cell (`element: "cell" \| "header-cell"`); `extent: "container"` on a table root | cell; table root | `vertical-align: top \| middle \| bottom` (rows whose cells wrap to different line counts start together at the top); `inline-size: 100%` (a table as wide as its container instead of its content) | `align` on any other part (`field-unsupported`); a table frame that fixes its width as well (`extent-conflict`) |
|
|
286
286
|
| `normalize: { textDecoration: "none", pointerEvents: "none", borderStyle: "none" }` | root, `normalize.when`; `textDecoration` and `pointerEvents` also on a part (a link card's link, a decorative layer at any depth) | `text-decoration-line`, `pointer-events`, `border-style` | pointer transparency on focusable or interactive, non-`aria-hidden` markup (`source/pointer-transparent-interactive`) |
|
|
287
287
|
| `normalize: { cursor, touchAction, userSelect }`, `snap` | root, part, `normalize.when`; scrolling arrangement | see [interaction properties](#interaction-properties) | a value outside its set (`spec/value-invalid`); snap without scrolling (`snap-without-scroll`) |
|
|
@@ -353,9 +353,15 @@ element's own text profile; an underline change does not. An underline colour
|
|
|
353
353
|
that also fades is a paint: `textDecorationColor` on the surfaces, with the
|
|
354
354
|
`text-decoration-color` channel of `paintTransition`.
|
|
355
355
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
356
|
+
`&` is always the owner's root, in a part's `when` too: a glyph that shrinks
|
|
357
|
+
under `&:active` shrinks while the button is pressed. A state of one of the
|
|
358
|
+
recipe's own parts is also a state of the root, written `:has(> .part:state)`
|
|
359
|
+
with `:checked`, `:indeterminate`, `:focus-visible`, `:hover` or `:disabled`.
|
|
360
|
+
A nested part is named by its path from the root, each step a declared part at
|
|
361
|
+
its depth: a text field's input inside its box is
|
|
362
|
+
`&:has(> .field-box > .field-control:focus-visible)`, and the rule it writes
|
|
363
|
+
selects exactly that path (`construction/condition-unsupported` names a path no
|
|
364
|
+
declared part has):
|
|
359
365
|
|
|
360
366
|
```ts
|
|
361
367
|
parts: {
|
|
@@ -815,7 +821,11 @@ recipe({
|
|
|
815
821
|
to an owned child with its own frame. Every modal sheet also emits the
|
|
816
822
|
document scroll lock `html:has(:modal) { overflow: hidden }` once in its
|
|
817
823
|
owner's sheet. It keeps no room for the hidden scrollbar: a sheet at the
|
|
818
|
-
inline end would stop short of the viewport's edge
|
|
824
|
+
inline end would stop short of the viewport's edge, and keeping it only while
|
|
825
|
+
a modal is open shifts a page that had no scrollbar. A design system whose
|
|
826
|
+
page must not move behind a modal keeps the room at all times with the
|
|
827
|
+
foundation's `scrollbarGutter: "stable"`; where scrollbars overlay the page it
|
|
828
|
+
reserves nothing.
|
|
819
829
|
- **Modal card** (`element: "dialog"`; `edge: "center" | "block-start"`): the
|
|
820
830
|
same `<dialog>`, a card centred in the viewport, or centred inline below the
|
|
821
831
|
top. A centred card keeps the layer profile's `viewport-margin` from every
|
package/docs/RULES.md
CHANGED
|
@@ -370,7 +370,7 @@ A value has the wrong kind, role or range for where it is used. Choose one of th
|
|
|
370
370
|
| `source/glyph-set-key` | error | A set binding's drawing is looked up by a key typed as a finite union of the set's names (`typeof set.names[number]`). | Type the key as `typeof set.names[number]` (import the set's declaration with `import type`), or add the names to the set. | `ads://guides/pictograms` |
|
|
371
371
|
| `source/keyline-missed` | error | In a grid, text starts on one keyline: the start inset of the spatial profile's `wide` gutter, which a grid takes when it names no gutter. A grid on another gutter mode (`narrow`, `condensed`) starts its cells nearer the column line, so a padded frame in such a cell (a card) puts its content back on the keyline: that gutter's start inset and the frame's inline padding add up to the wide gutter's start, within the profile's fine unit, in every theme and brand. Borders are not counted: a border is the frame's edge, its width may change with the theme, and no inset token may be derived from a border width, so text sits a border's width past the keyline. The rule applies to the cell's own container frame, or to the first padded container frame inside it. A control's inset is its own (a button, a tile), a frame without inline padding is flush by choice, and `gutter: "none"` grids (structural layouts such as an application shell) have no text keyline. A public component placed in such a cell is checked across owners (`component-keyline`). | Give the frame an inline padding that, with the gutter's start, comes within the fine unit of the wide gutter's start (a frame profile whose `paddingInline` token is the wide gutter's start), or place the frame in a wide-gutter grid, or remove its inline padding so its content is flush. | `ads://guides/recipes`, `ads://guides/layout` |
|
|
372
372
|
| `spec/accessibility-declaration-invalid` | error | A text-entry control's `accessibility` declaration names how it is identified other than by a 3:1 boundary (WCAG 1.4.11) with a closed `boundary` kind, `"visible-label"` or `"boundary-on-interaction"`, and a concrete `reason` of 20–300 characters. Placeholder text, a soft fill below 3:1 and a free-form design choice are not identification. | First make the control pass (a 3:1 fill, or one 3:1 border side such as a soft field's underline). Only with the user's explicit approval, declare a supported boundary kind and a concrete reason. | `ads://guides/recipes`, `ads://guides/accessibility` |
|
|
373
|
-
| `spec/condition-unsupported` | error | 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
|
|
373
|
+
| `spec/condition-unsupported` | error | 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. | 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. | `ads://guides/recipes` |
|
|
374
374
|
| `spec/field-unsupported` | error | A spec uses only the fields its construction kind defines; unknown fields are rejected, never ignored. | Remove the field or move it to the construction kind that supports it. | `ads://guides/recipes` |
|
|
375
375
|
| `spec/value-invalid` | error | Each spec field has a defined value form. | Change the value to the expected form. | `ads://guides/recipes` |
|
|
376
376
|
|
|
@@ -491,7 +491,7 @@ The construct is valid design that ADS does not support yet. Use a supported alt
|
|
|
491
491
|
| `construction/condition-visual-unsupported` | error | A part's condition (`at`) may select another visual profile, so the drawing is another size in that range. The part is a visual part that draws registered artwork or contained application media, and both sizes select the same drawing: a condition is a media query and cannot swap the file. | Put `at.<condition>.visual` on a `kind: "visual"` part that draws registered artwork or contained media, and choose sizes within one drawing's range (or declare one drawing for both sizes). | `ads://guides/recipes`, `ads://guides/layout` |
|
|
492
492
|
| `construction/cover-asset-unsupported` | error | Only application images and intrinsic artwork crop (`fit: "cover"`), around the image's own focal point (an asset's `opticalCenter`). A glyph or paint-slot asset (a logo) is never cropped. | Bind it to a visual profile with `fit: "contain"`. | `ads://guides/recipes` |
|
|
493
493
|
| `construction/enter-surface-unsupported` | error | An entrance's starting surface (`enter.from.surface`) states only `opacity` and `blur`, and at least one of them: each has an obvious resting value, opaque and sharp. A starting background, colour, border or shadow would be a second design for the element, which belongs to a state (`when`), not an entrance. | Give the entrance its own surface profile with `opacity`, `blur` or both, and nothing else. | `ads://guides/recipes` |
|
|
494
|
-
| `construction/extent-parent-unsupported` | error | 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. | Arrange the parent as a stack or inline, or remove `extent` (use grid rows `fill` for a grid cell). | `ads://guides/recipes`, `ads://guides/layout` |
|
|
494
|
+
| `construction/extent-parent-unsupported` | error | 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. | 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). | `ads://guides/recipes`, `ads://guides/layout` |
|
|
495
495
|
| `construction/measured-property-unsupported` | error | A measured value sets one geometry property of its type's closed list: a `length` a logical inset or box size (inline/block size and their min/max) on a region root or top-level part, a `transform` `translate`, a `size-track` one track of a grid's own `grid-template-columns`/`-rows`. An `intrinsic-size` sets `inline-size` on a contained application image (`fit: "contain"`). A `position` sets `object-position` on a cropped application image (a visual part whose visual profile declares `fit: "cover"`). Padding, margin, gap, typography, borders, radius and paint are design values; a top-layer root is positioned by measured values only with `placement: "measured"`. | Measure a property of the closed list (`inset-*`, `inline-size`, `block-size` and their min/max, `translate`, a grid track that exists in every tier); declare `placement: "measured"` for an element-anchored popover; move design values to profiles. | `ads://guides/recipes`, `ads://guides/layout` |
|
|
496
496
|
| `construction/paint-property-unsupported` | error | A runtime paint sets one property of the closed paint list (`fill`, `stroke`, `color`, `background-color`, `border-color`), once per element: backgrounds as images, gradients, outlines and shadows are design values. | Paint `fill`, `stroke`, `color`, `background-color` or `border-color`, one paint per property and element; keep other paint values in surface profiles. | `ads://guides/recipes`, `ads://guides/tokens` |
|
|
497
497
|
| `construction/paint-transition-effect-unsupported` | error | What changes between a transitioned element's surfaces interpolates. A gradient image never does, so such an element has none. A surface effect does through its own channel: `filter` for `blur`, `shapeShadow` and `groupShadow`, `backdrop-filter` for `backdropBlur` and `backdropSaturate`. An effect that changes between the surfaces without its channel listed would snap while the paints transition. | Add `filter` or `backdrop-filter` to the transition's `channels` for an effect that changes, use surfaces without a gradient image on a transitioned element, or remove its paint transition. | `ads://guides/recipes` |
|