@reqvire-org/ads 0.5.1 → 0.5.2
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 +110 -25
- package/dist/analysis/composition-axes.mjs +48 -0
- package/dist/analysis/construction-memo.mjs +38 -0
- package/dist/analysis/context.mjs +19 -0
- package/dist/analysis/design-reads.mjs +177 -0
- package/dist/analysis/factored-classes.mjs +90 -0
- package/dist/analysis/helpers.mjs +5 -7
- package/dist/analysis/native-project.mjs +12 -0
- package/dist/analysis/owner-analysis-cache.mjs +86 -23
- package/dist/analysis/owner-analysis-key.mjs +42 -10
- package/dist/analysis/owner-choices.mjs +23 -4
- package/dist/analysis/owner-composition.mjs +118 -33
- package/dist/analysis/owner-reuse.mjs +8 -6
- package/dist/analysis/owner-source.mjs +253 -76
- package/dist/analysis/scenario-keys.mjs +10 -7
- package/dist/analysis/service.mjs +50 -3
- package/dist/analysis/standalone.mjs +7 -4
- package/dist/analysis/syntax.mjs +59 -1
- package/dist/analysis/worker-protocol.mjs +14 -2
- package/dist/analysis/worker.mjs +32 -10
- package/dist/architecture-report.mjs +26 -0
- package/dist/asset-view-facts.mjs +16 -2
- package/dist/boundaries.mjs +26 -10
- package/dist/bun-compiler.mjs +2 -2
- package/dist/check-service.mjs +29 -17
- package/dist/check.mjs +13 -6
- package/dist/cli.mjs +1 -1
- package/dist/composed-keyline.mjs +2 -2
- package/dist/config.mjs +2 -1
- package/dist/construction-output.mjs +3 -2
- package/dist/construction-spec.d.mts +111 -6
- package/dist/construction-spec.mjs +172 -30
- package/dist/corner-overpaint.mjs +16 -4
- package/dist/derived-states.mjs +182 -0
- package/dist/design-inputs.mjs +18 -3
- package/dist/design-system-closure.mjs +12 -7
- package/dist/emit/contract.mjs +24 -5
- package/dist/emit/emission.mjs +6 -4
- package/dist/emit/integrity.mjs +8 -2
- package/dist/emit/output-watch.mjs +120 -0
- package/dist/emit/owner-emission-cache.mjs +4 -4
- package/dist/emit/preview-emitter.mjs +4 -2
- package/dist/emit/preview-tree.mjs +1 -1
- package/dist/emit/service.mjs +8 -2
- package/dist/finding-rules.mjs +3 -0
- package/dist/form-states.mjs +8 -0
- package/dist/frame-regions.mjs +29 -9
- package/dist/hover-geometry.mjs +15 -0
- package/dist/input-digests.mjs +17 -10
- package/dist/linaria/delivery.mjs +2 -0
- package/dist/lowering-properties.mjs +5 -0
- package/dist/lowering-region-layout.mjs +7 -2
- package/dist/mcp/build-status.mjs +9 -1
- package/dist/mcp/compiler-channel.mjs +11 -4
- package/dist/mcp/mutations.mjs +1 -0
- package/dist/mcp/preview-http.bundle.js +1 -1
- package/dist/mcp/preview-watch.mjs +2 -1
- package/dist/mcp/preview-widget.bundle.js +1 -1
- package/dist/motion-model.mjs +1 -1
- package/dist/owner-analysis-check.mjs +19 -5
- package/dist/owner-errors.mjs +4 -2
- package/dist/owner-lowering.mjs +71 -12
- package/dist/owner-scenarios.mjs +4 -1
- package/dist/ownership-model.mjs +18 -4
- package/dist/placeholder-contrast.mjs +17 -1
- package/dist/platform-features.mjs +10 -1
- package/dist/profile-view-facts.mjs +1 -1
- package/dist/recipe-macro.d.mts +72 -13
- package/dist/recipe-model.mjs +9 -5
- package/dist/region-lowering.mjs +238 -40
- package/dist/render-audit/layout-shift.page.mjs +24 -0
- package/dist/render-audit/render-states.mjs +122 -1
- package/dist/render-audit/render-states.page.mjs +140 -0
- package/dist/render-audit/worker.mjs +18 -3
- package/dist/render-audit.mjs +114 -1
- package/dist/role-vocabulary.d.mts +5 -0
- package/dist/role-vocabulary.mjs +12 -1
- package/dist/scenarios-compiler.mjs +20 -6
- package/dist/showcase/assets-view.mjs +29 -13
- package/dist/showcase/client.bundle.js +32 -32
- package/dist/showcase/http-client.bundle.js +15 -15
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +4 -4
- package/dist/skills/ads-designer/references/accessibility.md +7 -0
- package/dist/skills/ads-designer/references/branding.md +13 -3
- package/dist/skills/ads-designer/references/contracts.md +5 -2
- package/dist/skills/ads-designer/references/design-data.md +1 -1
- package/dist/skills/ads-designer/references/layout.md +5 -1
- package/dist/skills/ads-designer/references/motion.md +9 -1
- package/dist/skills/ads-designer/references/recipes.md +27 -3
- package/dist/skills/ads-import/references/contracts.md +5 -2
- package/dist/skills/ads-import/references/design-data.md +1 -1
- package/dist/skills/ads-import/references/layout.md +5 -1
- package/dist/skills/ads-import/references/recipes.md +27 -3
- package/dist/skills/ads-migrate/SKILL.md +1 -0
- package/dist/skills/ads-migrate/references/0.5.1-to-0.5.2.md +185 -0
- package/dist/skills/ads-port/references/contracts.md +5 -2
- package/dist/skills/ads-port/references/design-data.md +1 -1
- package/dist/skills/ads-port/references/layout.md +5 -1
- package/dist/skills/ads-port/references/recipes.md +27 -3
- package/dist/surface-contrast.mjs +1 -0
- package/dist/surface-effects.mjs +5 -3
- package/dist/task-cache.mjs +8 -18
- package/dist/validation-checks.mjs +1 -1
- package/docs/ARCHITECTURE.md +63 -7
- package/docs/CACHING.md +152 -24
- package/docs/CHANGELOG.md +200 -23
- package/docs/GUIDE.md +45 -1
- package/docs/LANGUAGE.md +146 -8
- package/docs/MOTION.md +10 -2
- package/docs/PROFILE-KINDS.md +9 -1
- package/docs/RULES.md +22 -14
- package/docs/TOKEN-ROLES.md +7 -1
- package/package.json +1 -1
|
@@ -62,6 +62,13 @@ suffices, or adjust the token in the named context. An application's own coloure
|
|
|
62
62
|
container is outside the design system: ADS checks a public component on the document
|
|
63
63
|
surface the foundation declares.
|
|
64
64
|
|
|
65
|
+
The render audit measures every owner state a recipe declares by itself, on any
|
|
66
|
+
scenario that renders the owner: do not add scenario states only so the audit
|
|
67
|
+
sees a state whose markup is the same as at rest. Render each variant of an
|
|
68
|
+
owner somewhere (a construction no scenario renders is a
|
|
69
|
+
`render-audit-construction-unrendered` review item), and show a state in a
|
|
70
|
+
scenario when the component renders different content in it.
|
|
71
|
+
|
|
65
72
|
The render audit (`ads audit`, validation and acceptance) renders each scenario once
|
|
66
73
|
with the reader's text settings and reports only what rest does not show:
|
|
67
74
|
|
|
@@ -105,15 +105,25 @@ part (`tick: { selector, kind: "visual", required: true, asset: "tick", visual:
|
|
|
105
105
|
"glyph-md" }`) and uses the same recipe's `parts.tick` class and
|
|
106
106
|
`assets.tick.source`; a second recipe is for artwork that is a choice.
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
Standalone artwork (a recipe that is only a visual part, such as an Icon) takes
|
|
109
|
+
a colour-only `surface` on its root: the drawing's own tone, so a slot that
|
|
110
|
+
holds the icon sets no colour.
|
|
111
|
+
|
|
112
|
+
A visual part is bound to exactly one declared asset; a control and standalone
|
|
113
|
+
artwork have one visual part, and a region may have several, each bound by its
|
|
114
|
+
own name (`recipe.parts.<name>`, `recipe.assets.<name>.source`)
|
|
109
115
|
(`visual-binding-count`, `artwork-binding-missing`, `asset-unknown`). Inline artwork
|
|
110
116
|
renders its bound drawing through a single `dangerouslySetInnerHTML.__html`
|
|
111
117
|
(`artwork-source-undeclared`) and the drawing its binding selects
|
|
112
118
|
(`artwork-mismatch`). An image visual part contains exactly one `<img>` whose `src`
|
|
113
119
|
comes from the bound asset and which states its text alternative, empty when
|
|
114
120
|
decorative (`intrinsic-image-count`, `intrinsic-src-missing`,
|
|
115
|
-
`intrinsic-alt-missing`). Artwork is painted
|
|
116
|
-
|
|
121
|
+
`intrinsic-alt-missing`). Artwork is painted as its asset declares: a control may
|
|
122
|
+
hold a product's logo in its own colours (`paint: "intrinsic"`) or a drawing with
|
|
123
|
+
several paints (`paint: "slots"`), of which at least one must reach 3:1 on the
|
|
124
|
+
control's own background in every theme, brand and state
|
|
125
|
+
(`artwork-paint-contrast-insufficient`). The control still needs its label or
|
|
126
|
+
accessible name: a logo is not a name.
|
|
117
127
|
|
|
118
128
|
## Aligning artwork with text
|
|
119
129
|
|
|
@@ -67,8 +67,11 @@ An owner styles only its own elements, and only through its recipe:
|
|
|
67
67
|
presence (`item.sub && <span>`); no child component is needed for that. Application text selects markup by presence only
|
|
68
68
|
(`text-content-read`). An optional object, callback or node prop selects by whether
|
|
69
69
|
it is given, a node only through `!== undefined` (`domain-not-finite` otherwise).
|
|
70
|
-
- Artwork is painted
|
|
71
|
-
(`
|
|
70
|
+
- Artwork is painted as its asset declares, in a control as anywhere: by the
|
|
71
|
+
text colour (`foreground`), by its paint slots, or in its own colours
|
|
72
|
+
(`intrinsic`, a product's logo). In a control, slot artwork needs one paint at
|
|
73
|
+
3:1 on the control's background (`artwork-paint-contrast-insufficient`); see
|
|
74
|
+
`ads://guides/branding`.
|
|
72
75
|
|
|
73
76
|
A guarded `className` prop for placement is a public API decision of the owner;
|
|
74
77
|
it never lets a caller override the recipe's interior.
|
|
@@ -131,7 +131,7 @@ By role: `font-size` in `rem`; `line-height` unitless; `spacing`, `content-gap`,
|
|
|
131
131
|
`frame-inset` and `control-min-size` in `rem` when they hold or separate text
|
|
132
132
|
and `px` when they should not move; `visual-size` in `rem` for icons and `px`
|
|
133
133
|
for pictures; `border-width`, `focus-offset`, `blur` and `radius` in `px` (`%`
|
|
134
|
-
for a pill); `saturation` in `%` (`100%` unchanged); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
134
|
+
for a pill); `saturation` and `brightness` in `%` (`100%` unchanged); `box-share` in `%` of the box (a backdrop's outset that grows with it); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
135
135
|
bound follows the reader's text size). Authors never write
|
|
136
136
|
`lh`, container units or `fr`: ADS emits `lh`, and grids express the others.
|
|
137
137
|
The full tables are in the token-role reference (`docs/TOKEN-ROLES.md`, *Units*).
|
|
@@ -67,7 +67,11 @@ media queries and track lists, so a context cannot change them
|
|
|
67
67
|
| A region that adapts to the space it gets, not the window | `context: "container"` inside an owned ancestor framed `container: "region"` |
|
|
68
68
|
| Children stacked or in a row inside a component | `layout: "stack"` or `"inline"` |
|
|
69
69
|
| Several parts painted in one area | `layout: "layered"` |
|
|
70
|
-
| A
|
|
70
|
+
| A jump target (a section or heading with an id) under a sticky header | `anchorClear: { slot: "layer", field: "clearBlockStart" }` to land right under the header, or `{ slot: "spacing", field: "anchorGap" }` for the target's own distance (level with a sticky side column); never a document-wide scroll padding in the application |
|
|
71
|
+
| Neighbours that overlap (a pile of faces, stacked cards) | `overlap: { slot: "spacing", field: "overlap" }` on the `inline` or `stack` arrangement, from an `overlap` token; never negative margins of your own |
|
|
72
|
+
| An element that changes size, padding or spacing under a state | a `when` entry selecting another profile: `frame: { profile }` on the element, `spacing: "<profile>"` on its arrangement; `geometryTransition` to animate it. Give a `:hover` state a focus or attribute state of the same geometry |
|
|
73
|
+
| A part that appears in a row by growing from nothing (a counter, row actions) | `collapsed: true` on the part and `collapsed: false` in the state's `when` entry (or the reverse); its box goes on the element it holds |
|
|
74
|
+
| A decorative backdrop larger than its box (a glow) | a first part of a `layered` parent with `outset: { block, inline }` (spacing fields; a `box-share` token in the profile's `outsetBlock`/`outsetInline` makes it a share of the box) and a gradient surface |
|
|
71
75
|
| A panel that covers the content | a top-layer root (`layer`), or a cell stacked by the profile's `overlayLayer` |
|
|
72
76
|
|
|
73
77
|
Typical defaults, not rules: headers and toolbars are fluid in width; side panels
|
|
@@ -71,6 +71,11 @@ behind a modal (about 700 ms), and easing roles for standard moves, entering and
|
|
|
71
71
|
exiting, each in an everyday and a strong form. Owners consume the profile through
|
|
72
72
|
their recipe's motion slot: parts declare channels in `transition`, `when` supplies
|
|
73
73
|
typed endpoints such as `scale: { slot: "motion", field: "scale" }`, and
|
|
74
|
+
`geometryTransition: { channels, motion }` animates geometry a state selects
|
|
75
|
+
(`size`, `inset`, `gap`, `radius`, `border-width`, and `overlap` for an element's
|
|
76
|
+
own position in a pile): see the layout reference. It is instant under reduced
|
|
77
|
+
motion.
|
|
78
|
+
|
|
74
79
|
`paintTransition` interpolates named paint channels between a base surface and its
|
|
75
80
|
state surfaces.
|
|
76
81
|
|
|
@@ -87,7 +92,10 @@ Define motion in the recipe, control it in script. A component never calls
|
|
|
87
92
|
what the recipe declared, and uses `element.getAnimations()` (`finished`,
|
|
88
93
|
`cancel()`, `pause()`, `currentTime`) or the animation events to wait for,
|
|
89
94
|
cancel or seek it. A fade between states is the `opacity` channel of
|
|
90
|
-
`paintTransition`; a one-axis scale is `scaleInline` or `scaleBlock
|
|
95
|
+
`paintTransition`; a one-axis scale is `scaleInline` or `scaleBlock`; a turn in
|
|
96
|
+
place under a state (a plus that becomes a cross while its panel is open) is
|
|
97
|
+
`rotate`, from the motion profile's `angle`, kept under reduced motion without
|
|
98
|
+
its animation.
|
|
91
99
|
|
|
92
100
|
A fixed series of steps (a blink, dots pulsing in turn, a shake) is a
|
|
93
101
|
`sequence` profile (`steps: [{ at: 0, opacity: "--dim" }, { at: 50, … }, { at:
|
|
@@ -157,6 +157,11 @@ a recipe never creates a state machine.
|
|
|
157
157
|
`pre`, `table`, `cell`, `media`, …). Content is then plain markup inside it
|
|
158
158
|
(`<Prose><h2>…</h2><p>…</p></Prose>`); never a component per paragraph, and
|
|
159
159
|
never descendant CSS of your own. Declare every element the content uses.
|
|
160
|
+
A block's `spaceBefore` and `spaceAfter` replace the rhythm around it (a
|
|
161
|
+
heading closer to its text); `list` takes `markers` (a shape per depth of
|
|
162
|
+
nesting) and `item` takes `marker` (a colour) and `markerText` (a weight);
|
|
163
|
+
`component` gives every component placed among the blocks its space before
|
|
164
|
+
and after.
|
|
160
165
|
Only classless elements are styled, so do not put classes on content. For
|
|
161
166
|
content that arrives as an HTML string, add a second component on the same
|
|
162
167
|
recipe that injects it (`ProseHtml({ html })`); the application passes the
|
|
@@ -167,7 +172,23 @@ a recipe never creates a state machine.
|
|
|
167
172
|
from the entrance's motion profile, then settles. See the motion reference.
|
|
168
173
|
- A part that needs a box of its own without being a control (a disc behind a
|
|
169
174
|
mark, a badge) takes `frame: { profile: "<frame profile>" }`; do not make a
|
|
170
|
-
separate owner only to give an element padding, a border or a size.
|
|
175
|
+
separate owner only to give an element padding, a border or a size. The
|
|
176
|
+
drawn box of a checkbox, radio or switch whose native `<input>` is hidden
|
|
177
|
+
takes `focus: { of: "<the input's part>" }`: the focus profile's outline is
|
|
178
|
+
drawn on the box while the input has keyboard focus. A visual part may sit
|
|
179
|
+
inside such a part: the owner reads it by its name (`recipe.parts.<name>`,
|
|
180
|
+
`recipe.assets.<name>.source`), which one nested part of the recipe has. On a
|
|
181
|
+
visual part the frame's size is the box and the drawing keeps its visual
|
|
182
|
+
profile's size, centred in it.
|
|
183
|
+
- A switch, a radio's dot or a slider's thumb is a decorative box of its control:
|
|
184
|
+
a part without a `kind`, with `frame: { profile }` and a `surface`, that takes
|
|
185
|
+
another surface or `translateInline` under the control's state
|
|
186
|
+
(`&[aria-checked="true"]`). Keep it empty and `aria-hidden`; name the control
|
|
187
|
+
on its root. Do not rebuild the control as a region to get a second element.
|
|
188
|
+
- A native `<progress>` is styled as a part: its own surface is the track and
|
|
189
|
+
`pseudo: { progressValue: { surface } }` (a background-only surface) the
|
|
190
|
+
fill, proven at 3:1 against the track. Do not draw a measured fill beside a
|
|
191
|
+
hidden native element.
|
|
171
192
|
- A border whose sides differ is stated in the profiles, not the recipe: the
|
|
172
193
|
frame's `borderWidth` plus a side's own (`borderInlineStartWidth`), the
|
|
173
194
|
surface's `borderColor` plus a side's own (`borderInlineStartColor`). Sides
|
|
@@ -177,7 +198,10 @@ a recipe never creates a state machine.
|
|
|
177
198
|
with a class.
|
|
178
199
|
- Surface effects are surface-profile fields, composed in a fixed order:
|
|
179
200
|
`blur` → `filter: blur()`; `backdropBlur` and `backdropSaturate` (role
|
|
180
|
-
`saturation`, a percentage) → `backdrop-filter: blur() saturate()
|
|
201
|
+
`saturation`, a percentage) → `backdrop-filter: blur() saturate()`;
|
|
202
|
+
`brightness` (role `brightness`, a percentage, on a visual part only) →
|
|
203
|
+
`filter: brightness()`: a picture with no dark version takes a token that
|
|
204
|
+
is `100%` in the light theme and lower in the dark one. For
|
|
181
205
|
shadows choose by meaning: `boxShadow` for a box (card, panel, control);
|
|
182
206
|
`shapeShadow` on a visual part whose drawing is not its box (transparent
|
|
183
207
|
image, artwork); `groupShadow` on a container when everything inside should
|
|
@@ -324,7 +348,7 @@ text part breaks one way, set by one `wrap` field:
|
|
|
324
348
|
keeps it reachable, which analysis cannot see).
|
|
325
349
|
- `textEdge` trims a text part's box to the edges it names (`["cap",
|
|
326
350
|
"alphabetic"]`); `textAlign` sets
|
|
327
|
-
its alignment. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
351
|
+
its alignment, on a control's label too. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
328
352
|
spacing in a browser without them.
|
|
329
353
|
|
|
330
354
|
<a id="assets"></a>
|
|
@@ -67,8 +67,11 @@ An owner styles only its own elements, and only through its recipe:
|
|
|
67
67
|
presence (`item.sub && <span>`); no child component is needed for that. Application text selects markup by presence only
|
|
68
68
|
(`text-content-read`). An optional object, callback or node prop selects by whether
|
|
69
69
|
it is given, a node only through `!== undefined` (`domain-not-finite` otherwise).
|
|
70
|
-
- Artwork is painted
|
|
71
|
-
(`
|
|
70
|
+
- Artwork is painted as its asset declares, in a control as anywhere: by the
|
|
71
|
+
text colour (`foreground`), by its paint slots, or in its own colours
|
|
72
|
+
(`intrinsic`, a product's logo). In a control, slot artwork needs one paint at
|
|
73
|
+
3:1 on the control's background (`artwork-paint-contrast-insufficient`); see
|
|
74
|
+
`ads://guides/branding`.
|
|
72
75
|
|
|
73
76
|
A guarded `className` prop for placement is a public API decision of the owner;
|
|
74
77
|
it never lets a caller override the recipe's interior.
|
|
@@ -131,7 +131,7 @@ By role: `font-size` in `rem`; `line-height` unitless; `spacing`, `content-gap`,
|
|
|
131
131
|
`frame-inset` and `control-min-size` in `rem` when they hold or separate text
|
|
132
132
|
and `px` when they should not move; `visual-size` in `rem` for icons and `px`
|
|
133
133
|
for pictures; `border-width`, `focus-offset`, `blur` and `radius` in `px` (`%`
|
|
134
|
-
for a pill); `saturation` in `%` (`100%` unchanged); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
134
|
+
for a pill); `saturation` and `brightness` in `%` (`100%` unchanged); `box-share` in `%` of the box (a backdrop's outset that grows with it); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
135
135
|
bound follows the reader's text size). Authors never write
|
|
136
136
|
`lh`, container units or `fr`: ADS emits `lh`, and grids express the others.
|
|
137
137
|
The full tables are in the token-role reference (`docs/TOKEN-ROLES.md`, *Units*).
|
|
@@ -67,7 +67,11 @@ media queries and track lists, so a context cannot change them
|
|
|
67
67
|
| A region that adapts to the space it gets, not the window | `context: "container"` inside an owned ancestor framed `container: "region"` |
|
|
68
68
|
| Children stacked or in a row inside a component | `layout: "stack"` or `"inline"` |
|
|
69
69
|
| Several parts painted in one area | `layout: "layered"` |
|
|
70
|
-
| A
|
|
70
|
+
| A jump target (a section or heading with an id) under a sticky header | `anchorClear: { slot: "layer", field: "clearBlockStart" }` to land right under the header, or `{ slot: "spacing", field: "anchorGap" }` for the target's own distance (level with a sticky side column); never a document-wide scroll padding in the application |
|
|
71
|
+
| Neighbours that overlap (a pile of faces, stacked cards) | `overlap: { slot: "spacing", field: "overlap" }` on the `inline` or `stack` arrangement, from an `overlap` token; never negative margins of your own |
|
|
72
|
+
| An element that changes size, padding or spacing under a state | a `when` entry selecting another profile: `frame: { profile }` on the element, `spacing: "<profile>"` on its arrangement; `geometryTransition` to animate it. Give a `:hover` state a focus or attribute state of the same geometry |
|
|
73
|
+
| A part that appears in a row by growing from nothing (a counter, row actions) | `collapsed: true` on the part and `collapsed: false` in the state's `when` entry (or the reverse); its box goes on the element it holds |
|
|
74
|
+
| A decorative backdrop larger than its box (a glow) | a first part of a `layered` parent with `outset: { block, inline }` (spacing fields; a `box-share` token in the profile's `outsetBlock`/`outsetInline` makes it a share of the box) and a gradient surface |
|
|
71
75
|
| A panel that covers the content | a top-layer root (`layer`), or a cell stacked by the profile's `overlayLayer` |
|
|
72
76
|
|
|
73
77
|
Typical defaults, not rules: headers and toolbars are fluid in width; side panels
|
|
@@ -157,6 +157,11 @@ a recipe never creates a state machine.
|
|
|
157
157
|
`pre`, `table`, `cell`, `media`, …). Content is then plain markup inside it
|
|
158
158
|
(`<Prose><h2>…</h2><p>…</p></Prose>`); never a component per paragraph, and
|
|
159
159
|
never descendant CSS of your own. Declare every element the content uses.
|
|
160
|
+
A block's `spaceBefore` and `spaceAfter` replace the rhythm around it (a
|
|
161
|
+
heading closer to its text); `list` takes `markers` (a shape per depth of
|
|
162
|
+
nesting) and `item` takes `marker` (a colour) and `markerText` (a weight);
|
|
163
|
+
`component` gives every component placed among the blocks its space before
|
|
164
|
+
and after.
|
|
160
165
|
Only classless elements are styled, so do not put classes on content. For
|
|
161
166
|
content that arrives as an HTML string, add a second component on the same
|
|
162
167
|
recipe that injects it (`ProseHtml({ html })`); the application passes the
|
|
@@ -167,7 +172,23 @@ a recipe never creates a state machine.
|
|
|
167
172
|
from the entrance's motion profile, then settles. See the motion reference.
|
|
168
173
|
- A part that needs a box of its own without being a control (a disc behind a
|
|
169
174
|
mark, a badge) takes `frame: { profile: "<frame profile>" }`; do not make a
|
|
170
|
-
separate owner only to give an element padding, a border or a size.
|
|
175
|
+
separate owner only to give an element padding, a border or a size. The
|
|
176
|
+
drawn box of a checkbox, radio or switch whose native `<input>` is hidden
|
|
177
|
+
takes `focus: { of: "<the input's part>" }`: the focus profile's outline is
|
|
178
|
+
drawn on the box while the input has keyboard focus. A visual part may sit
|
|
179
|
+
inside such a part: the owner reads it by its name (`recipe.parts.<name>`,
|
|
180
|
+
`recipe.assets.<name>.source`), which one nested part of the recipe has. On a
|
|
181
|
+
visual part the frame's size is the box and the drawing keeps its visual
|
|
182
|
+
profile's size, centred in it.
|
|
183
|
+
- A switch, a radio's dot or a slider's thumb is a decorative box of its control:
|
|
184
|
+
a part without a `kind`, with `frame: { profile }` and a `surface`, that takes
|
|
185
|
+
another surface or `translateInline` under the control's state
|
|
186
|
+
(`&[aria-checked="true"]`). Keep it empty and `aria-hidden`; name the control
|
|
187
|
+
on its root. Do not rebuild the control as a region to get a second element.
|
|
188
|
+
- A native `<progress>` is styled as a part: its own surface is the track and
|
|
189
|
+
`pseudo: { progressValue: { surface } }` (a background-only surface) the
|
|
190
|
+
fill, proven at 3:1 against the track. Do not draw a measured fill beside a
|
|
191
|
+
hidden native element.
|
|
171
192
|
- A border whose sides differ is stated in the profiles, not the recipe: the
|
|
172
193
|
frame's `borderWidth` plus a side's own (`borderInlineStartWidth`), the
|
|
173
194
|
surface's `borderColor` plus a side's own (`borderInlineStartColor`). Sides
|
|
@@ -177,7 +198,10 @@ a recipe never creates a state machine.
|
|
|
177
198
|
with a class.
|
|
178
199
|
- Surface effects are surface-profile fields, composed in a fixed order:
|
|
179
200
|
`blur` → `filter: blur()`; `backdropBlur` and `backdropSaturate` (role
|
|
180
|
-
`saturation`, a percentage) → `backdrop-filter: blur() saturate()
|
|
201
|
+
`saturation`, a percentage) → `backdrop-filter: blur() saturate()`;
|
|
202
|
+
`brightness` (role `brightness`, a percentage, on a visual part only) →
|
|
203
|
+
`filter: brightness()`: a picture with no dark version takes a token that
|
|
204
|
+
is `100%` in the light theme and lower in the dark one. For
|
|
181
205
|
shadows choose by meaning: `boxShadow` for a box (card, panel, control);
|
|
182
206
|
`shapeShadow` on a visual part whose drawing is not its box (transparent
|
|
183
207
|
image, artwork); `groupShadow` on a container when everything inside should
|
|
@@ -324,7 +348,7 @@ text part breaks one way, set by one `wrap` field:
|
|
|
324
348
|
keeps it reachable, which analysis cannot see).
|
|
325
349
|
- `textEdge` trims a text part's box to the edges it names (`["cap",
|
|
326
350
|
"alphabetic"]`); `textAlign` sets
|
|
327
|
-
its alignment. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
351
|
+
its alignment, on a control's label too. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
328
352
|
spacing in a browser without them.
|
|
329
353
|
|
|
330
354
|
<a id="assets"></a>
|
|
@@ -72,3 +72,4 @@ Load only the guide(s) for the requested transition.
|
|
|
72
72
|
| 0.4.7 | 0.5.0, part 2 | [The design model: role tokens, profiles, recipes, assets, the design package and emitted output](references/0.4.7-to-0.5.0.md) |
|
|
73
73
|
| 0.4.7 | 0.5.0, grids | [Grids and layout: spatial profiles, grid recipes, named conditions, subgrid rows](references/0.4.7-to-0.5.0-grid.md) (supersedes section 10 of the 0.4.1 → 0.4.2 guide; the rest of the 0.5.0 migration is the guide above) |
|
|
74
74
|
| 0.5.0 | 0.5.1 | [The text keyline check, surface effects, entrances and font fallback metrics](references/0.5.0-to-0.5.1.md) |
|
|
75
|
+
| 0.5.1 | 0.5.2 | [Two emitted-CSS fixes, checks that now accept what they refused, a TypeScript configuration error that is now reported, the render audit measuring owner states by itself (and which audit-only scenario states can go), and new state, geometry, surface, outset, focus, control and prose language](references/0.5.1-to-0.5.2.md) |
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# ADS 0.5.1 → 0.5.2
|
|
2
|
+
|
|
3
|
+
No source change is required. Two fixes change emitted CSS for constructions
|
|
4
|
+
that were wrong before; the render audit now measures every owner state by
|
|
5
|
+
itself, which can report what was never measured before; the rest is new
|
|
6
|
+
language a project adopts when it needs it.
|
|
7
|
+
|
|
8
|
+
## Emitted CSS that changes
|
|
9
|
+
|
|
10
|
+
- **A filling part in a minimum-height stack.** A part with `extent: "fill"`
|
|
11
|
+
in a `stack` whose frame states `minBlockSize` and nothing else about its
|
|
12
|
+
height (no `blockSize`, `maxBlockSize`, ratio or `overflow`) loses
|
|
13
|
+
`min-block-size: 0`. It now grows with its content and the stack grows
|
|
14
|
+
around it; before, tall content ran past the part and under the next one.
|
|
15
|
+
A page shell with a header, a filling main area and a footer is the usual
|
|
16
|
+
case. If a design relied on the old result (the main area never taller than
|
|
17
|
+
the free space), say how its content is confined: give the stack a fixed
|
|
18
|
+
`blockSize`, or `overflow` on the stack or the part.
|
|
19
|
+
- **A visual part with `frame: { profile }`.** The frame profile's
|
|
20
|
+
`inlineSize` and `blockSize` are now the part's box, with the drawing centred
|
|
21
|
+
at its visual profile's size. Before, the drawing's size replaced them. A
|
|
22
|
+
part that was written with a frame size and looked right only because the
|
|
23
|
+
size was ignored now takes that size: remove the size from the frame
|
|
24
|
+
profile if the drawing's own size is what you want.
|
|
25
|
+
|
|
26
|
+
Run `ads emit` and review the rendered owners that use either construction.
|
|
27
|
+
|
|
28
|
+
## Checks that now accept what they refused
|
|
29
|
+
|
|
30
|
+
- **An optional glyph tested for being given** (`icon !== undefined && …`,
|
|
31
|
+
`icon && …`, `icon ? a : b`, `!icon`) is accepted, as the language reference
|
|
32
|
+
always said. A glyph set or a name union written only to get past
|
|
33
|
+
`source/glyph-reference-read` can go back to `icon?: Glyph`.
|
|
34
|
+
- **A recipe's part-level setters type under TypeScript 5.**
|
|
35
|
+
`measured.props({ focus: [x, y] })` and `({ intrinsic: [width, height] })`
|
|
36
|
+
on a part were typed as a number there. A cast or a `@ts-expect-error` added
|
|
37
|
+
for it can be removed.
|
|
38
|
+
- **Any artwork in a control.** `construction/paint-unsupported` is retired:
|
|
39
|
+
a control's visual part draws slot artwork (one paint must reach 3:1 on the
|
|
40
|
+
control's own background, `construction/artwork-paint-contrast-insufficient`)
|
|
41
|
+
and intrinsic artwork (a product's logo). A region built only to hold such a
|
|
42
|
+
drawing can be a control again.
|
|
43
|
+
- **Several visual parts in one region.** `construction/parts-visual-repeated`
|
|
44
|
+
is retired. A small owner made only to hold a second drawing can be folded
|
|
45
|
+
back. A control and standalone artwork still have one visual part.
|
|
46
|
+
- **A row with optional slots.** An owner that reached `choice/branch-limit`
|
|
47
|
+
because of optional slots (`lead !== undefined && …`, an indent spacer) is
|
|
48
|
+
analysed within the limit: a slot's presence no longer multiplies the row's
|
|
49
|
+
class analysis. Props merged or moved only to get under the limit can be
|
|
50
|
+
split again.
|
|
51
|
+
- **A large variant matrix.** An owner refused with `choice/construction-limit`
|
|
52
|
+
(256) is checked in full up to 4096 constructions, and its emitted module
|
|
53
|
+
stays small: independent props are emitted as one lookup each. Variant
|
|
54
|
+
owners split only to stay under the old limit can be joined again.
|
|
55
|
+
- **A control without text.** A control's text part is optional when it has
|
|
56
|
+
artwork or a decorative box; it is then named on its root
|
|
57
|
+
(`source/control-name-missing` otherwise).
|
|
58
|
+
|
|
59
|
+
Scripts or dashboards that match error codes should drop the two retired codes.
|
|
60
|
+
|
|
61
|
+
## Messages that say more
|
|
62
|
+
|
|
63
|
+
- `choice/branch-limit` names the limit and every value the selection branched
|
|
64
|
+
on, with how many values each takes: merge or move the props it lists.
|
|
65
|
+
- `surface-contrast` names the `state: "inactive"` declaration in its repair:
|
|
66
|
+
a surface only a disabled state uses (a disabled field's grey fill) declares
|
|
67
|
+
it and has no contrast minimum. A fill removed to satisfy the check can be
|
|
68
|
+
restored that way.
|
|
69
|
+
- `construction/corner-overpaint` names the owner state whose frames open the
|
|
70
|
+
corner, when it is a state's.
|
|
71
|
+
|
|
72
|
+
## Checks that now report what was silently ignored
|
|
73
|
+
|
|
74
|
+
- `check/typescript-config-invalid` (error): the project's `tsconfig.json`, or a
|
|
75
|
+
configuration it extends, does not parse, has an option TypeScript rejects,
|
|
76
|
+
extends a file that does not exist, or has a circular `extends` chain or one
|
|
77
|
+
longer than 64 levels. ADS used to fall back to other compiler
|
|
78
|
+
options without saying so. Fix the configuration the finding names; `tsc
|
|
79
|
+
--showConfig` shows the same problem.
|
|
80
|
+
- A large variant matrix no longer reports `component-contrast-unresolved` for
|
|
81
|
+
its texts: their cross-owner contrast is now proven, and a real failure is a
|
|
82
|
+
`component-contrast` error. Treat a new one as a contrast to fix.
|
|
83
|
+
|
|
84
|
+
## The render audit measures owner states by itself
|
|
85
|
+
|
|
86
|
+
Every state a recipe declares (each `when` entry of a root or a part) is now
|
|
87
|
+
switched on and measured on each scenario that renders the owner, with no
|
|
88
|
+
scenario state written for it. Run `ads audit` (or `ads validate`) after
|
|
89
|
+
upgrading:
|
|
90
|
+
|
|
91
|
+
- **New findings are possible** on owners whose states were never shown by a
|
|
92
|
+
scenario: an overflow, a contrast or a non-text contrast failure that only
|
|
93
|
+
appears in that state. They are real: fix them as you would any audit
|
|
94
|
+
finding. Each names the state (`state &[data-user-invalid] of
|
|
95
|
+
components/Forms/TextField/TextField.tsx`).
|
|
96
|
+
- **A new review item**, `render-audit-construction-unrendered`, lists per
|
|
97
|
+
owner the variants with states that no scenario renders. Render them in a
|
|
98
|
+
scenario; nothing is blocked meanwhile.
|
|
99
|
+
- **States the audit cannot set** (another pseudo-class, a sibling
|
|
100
|
+
combinator) are `render-audit-skipped` info items, never silently passed.
|
|
101
|
+
- **The widths a condition flips at** are rendered too (one pixel each side of
|
|
102
|
+
every named condition and breakpoint), so overflow just before a layout
|
|
103
|
+
changes now shows.
|
|
104
|
+
- **Runtime paint values and glyph set members** are drawn in turn and
|
|
105
|
+
measured, so a series colour or a status glyph that fails only where it is
|
|
106
|
+
used now shows.
|
|
107
|
+
- **`render-audit-state-forced`** (review): the audit forced an attribute state
|
|
108
|
+
of an owner whose markup also changes with that prop. Add a scenario that
|
|
109
|
+
renders the owner in that state; the item clears.
|
|
110
|
+
- **`render-audit-state-derivable`** (info): a scenario state that the audit
|
|
111
|
+
derives anyway. It marks the candidates for removal below.
|
|
112
|
+
- **`review/hover-geometry-shift`**: an in-flow element that changes geometry
|
|
113
|
+
under `:hover`. Keep it when the movement is wanted.
|
|
114
|
+
|
|
115
|
+
### Scenario states you can remove
|
|
116
|
+
|
|
117
|
+
A scenario state, or a whole specimen, that exists only so the audit measures
|
|
118
|
+
a state is now redundant when all of these hold:
|
|
119
|
+
|
|
120
|
+
1. the owner is rendered by some other scenario or specimen anyway;
|
|
121
|
+
2. the state is one the recipe declares (an attribute such as
|
|
122
|
+
`[data-expanded="true"]`, `[aria-checked="true"]`, `[data-user-invalid]`,
|
|
123
|
+
or `:checked` / `:disabled` / `:indeterminate` on the element or a direct
|
|
124
|
+
part), not a `:hover` or focus state, which the interaction pass covers;
|
|
125
|
+
3. the component renders the same markup in that state, only styled
|
|
126
|
+
differently. A state in which the component mounts more (a counter shown
|
|
127
|
+
while open, an error message) stays: forcing the attribute shows the CSS,
|
|
128
|
+
not what the script renders;
|
|
129
|
+
4. nobody needs to see it in the showcase. A specimen is also documentation:
|
|
130
|
+
keep the ones people look at.
|
|
131
|
+
|
|
132
|
+
The audit names them: each `render-audit-state-derivable` info item is a
|
|
133
|
+
scenario state that meets 1 to 3. Remove only those (and only if 4 holds), then
|
|
134
|
+
run the audit: the state must still appear in its findings or in the `Covered:`
|
|
135
|
+
count. ADS never deletes or rewrites a scenario itself.
|
|
136
|
+
|
|
137
|
+
### Browser tests you can remove
|
|
138
|
+
|
|
139
|
+
The same applies to a project's own registered browser specs that only measure
|
|
140
|
+
what ADS now proves itself. ADS has no finding that names them, so review them
|
|
141
|
+
by hand. A spec is redundant when it asserts nothing but one of these, for a
|
|
142
|
+
state the recipe declares:
|
|
143
|
+
|
|
144
|
+
- **checked statically by `ads check`, in every state a frame takes:** the
|
|
145
|
+
target size, text containment, the text keyline, the fit in a grid cell,
|
|
146
|
+
corner overpaint, the hit area staying the same and the gap to neighbouring
|
|
147
|
+
targets;
|
|
148
|
+
- **measured by the render audit in each declared state:** overflow, text
|
|
149
|
+
contrast and non-text contrast, at the widths each condition flips at.
|
|
150
|
+
|
|
151
|
+
Keep a spec that drives script: it opens, types, chooses, focuses, announces
|
|
152
|
+
or mounts something, because neither the audit nor the check runs the
|
|
153
|
+
component's behaviour. Keep one that measures something these do not, such as
|
|
154
|
+
an exact position or an animation's end state. Remove a spec together with its
|
|
155
|
+
registration, then run `ads validate` (the full run): nothing else may lose its
|
|
156
|
+
evidence.
|
|
157
|
+
|
|
158
|
+
## New language
|
|
159
|
+
|
|
160
|
+
Each is optional; nothing existing changes meaning.
|
|
161
|
+
|
|
162
|
+
| Need | Write |
|
|
163
|
+
| --- | --- |
|
|
164
|
+
| A glyph that turns while its control is open or pressed | `rotate: { slot: "motion", field: "angle" }` in the visual part's `when`, `"rotate"` in its `transition`, and `angle` in the motion profile |
|
|
165
|
+
| A picture dimmed in the dark theme | a `brightness.ads.css` token (`100%` light, lower dark), a surface profile with `brightness`, on the visual part |
|
|
166
|
+
| A backdrop that extends by a share of its box | a `box-share.ads.css` token, the spacing profile's `outsetBlock` / `outsetInline`, bound by the part's `outset` |
|
|
167
|
+
| The focus ring on a drawn checkbox box | `focus: { of: "<the input's part>" }` on the box part |
|
|
168
|
+
| A section or heading that lands clear of a sticky header when jumped to | `anchorClear` on the root, part or prose block, from the layer profile's `clearBlockStart` or the spacing profile's `anchorGap` |
|
|
169
|
+
| A pile that spreads on hover, items that appear in a row, a card that grows while open | `overlap`, `collapsed`, and `frame` / `spacing` in `when`, with `geometryTransition`; remove translate tricks and script-set sizes made for it |
|
|
170
|
+
| An Icon that needs its own quiet colour | `surface: "<colour-only surface>"` on the artwork recipe's root; remove the colour from slots that hold it |
|
|
171
|
+
| A switch built as a region with a target-size frame | a control with a decorative box for the knob (a part without a `kind`, `frame: { profile }`), moved by `translateInline` under `&[aria-checked="true"]` |
|
|
172
|
+
| Two or more drawings in one owner (a lead mark and an end mark) | declare each as its own visual part of the region and bind each by name; the small owners made only to hold a second drawing can be folded back |
|
|
173
|
+
| A glyph inside a boxed part of the same recipe | declare the visual part inside that part and read it by name (`recipe.parts.<name>`, `recipe.assets.<name>.source`) |
|
|
174
|
+
| A product logo or a two-paint drawing inside a button | bind the `intrinsic` or `slots` asset to the control's visual part; a region made only to hold it can go back to being a control |
|
|
175
|
+
| A native progress bar in the design's colours | `pseudo: { progressValue: { surface } }` on the `<progress>` part; its own surface is the track |
|
|
176
|
+
| Space around components placed among prose blocks | `elements.component: { spaceBefore, spaceAfter }` |
|
|
177
|
+
| A heading closer to its text than paragraphs are to each other | `spaceAfter` on the heading's prose element |
|
|
178
|
+
| Bold list markers; a marker shape per depth | `markerText` on `item`; `markers` on `list` |
|
|
179
|
+
| A button label centred when it wraps | `textAlign: "center"` on the control's text part |
|
|
180
|
+
| A target that must stay the same size in every state | nothing: a state frame with another hit area is refused (`hit-area`), and targets in an overlapping arrangement are refused (`targets-overlap`) |
|
|
181
|
+
|
|
182
|
+
A replaced hand-made workaround should be removed in the same change: a
|
|
183
|
+
checkbox that swapped the box's surface on focus instead of showing the focus
|
|
184
|
+
indicator, a glow with fixed outsets per size, a second owner made only to
|
|
185
|
+
turn an icon.
|
|
@@ -67,8 +67,11 @@ An owner styles only its own elements, and only through its recipe:
|
|
|
67
67
|
presence (`item.sub && <span>`); no child component is needed for that. Application text selects markup by presence only
|
|
68
68
|
(`text-content-read`). An optional object, callback or node prop selects by whether
|
|
69
69
|
it is given, a node only through `!== undefined` (`domain-not-finite` otherwise).
|
|
70
|
-
- Artwork is painted
|
|
71
|
-
(`
|
|
70
|
+
- Artwork is painted as its asset declares, in a control as anywhere: by the
|
|
71
|
+
text colour (`foreground`), by its paint slots, or in its own colours
|
|
72
|
+
(`intrinsic`, a product's logo). In a control, slot artwork needs one paint at
|
|
73
|
+
3:1 on the control's background (`artwork-paint-contrast-insufficient`); see
|
|
74
|
+
`ads://guides/branding`.
|
|
72
75
|
|
|
73
76
|
A guarded `className` prop for placement is a public API decision of the owner;
|
|
74
77
|
it never lets a caller override the recipe's interior.
|
|
@@ -131,7 +131,7 @@ By role: `font-size` in `rem`; `line-height` unitless; `spacing`, `content-gap`,
|
|
|
131
131
|
`frame-inset` and `control-min-size` in `rem` when they hold or separate text
|
|
132
132
|
and `px` when they should not move; `visual-size` in `rem` for icons and `px`
|
|
133
133
|
for pictures; `border-width`, `focus-offset`, `blur` and `radius` in `px` (`%`
|
|
134
|
-
for a pill); `saturation` in `%` (`100%` unchanged); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
134
|
+
for a pill); `saturation` and `brightness` in `%` (`100%` unchanged); `box-share` in `%` of the box (a backdrop's outset that grows with it); breakpoints and condition bounds in `rem` (`66rem`, not `1056px`: a query
|
|
135
135
|
bound follows the reader's text size). Authors never write
|
|
136
136
|
`lh`, container units or `fr`: ADS emits `lh`, and grids express the others.
|
|
137
137
|
The full tables are in the token-role reference (`docs/TOKEN-ROLES.md`, *Units*).
|
|
@@ -67,7 +67,11 @@ media queries and track lists, so a context cannot change them
|
|
|
67
67
|
| A region that adapts to the space it gets, not the window | `context: "container"` inside an owned ancestor framed `container: "region"` |
|
|
68
68
|
| Children stacked or in a row inside a component | `layout: "stack"` or `"inline"` |
|
|
69
69
|
| Several parts painted in one area | `layout: "layered"` |
|
|
70
|
-
| A
|
|
70
|
+
| A jump target (a section or heading with an id) under a sticky header | `anchorClear: { slot: "layer", field: "clearBlockStart" }` to land right under the header, or `{ slot: "spacing", field: "anchorGap" }` for the target's own distance (level with a sticky side column); never a document-wide scroll padding in the application |
|
|
71
|
+
| Neighbours that overlap (a pile of faces, stacked cards) | `overlap: { slot: "spacing", field: "overlap" }` on the `inline` or `stack` arrangement, from an `overlap` token; never negative margins of your own |
|
|
72
|
+
| An element that changes size, padding or spacing under a state | a `when` entry selecting another profile: `frame: { profile }` on the element, `spacing: "<profile>"` on its arrangement; `geometryTransition` to animate it. Give a `:hover` state a focus or attribute state of the same geometry |
|
|
73
|
+
| A part that appears in a row by growing from nothing (a counter, row actions) | `collapsed: true` on the part and `collapsed: false` in the state's `when` entry (or the reverse); its box goes on the element it holds |
|
|
74
|
+
| A decorative backdrop larger than its box (a glow) | a first part of a `layered` parent with `outset: { block, inline }` (spacing fields; a `box-share` token in the profile's `outsetBlock`/`outsetInline` makes it a share of the box) and a gradient surface |
|
|
71
75
|
| A panel that covers the content | a top-layer root (`layer`), or a cell stacked by the profile's `overlayLayer` |
|
|
72
76
|
|
|
73
77
|
Typical defaults, not rules: headers and toolbars are fluid in width; side panels
|
|
@@ -157,6 +157,11 @@ a recipe never creates a state machine.
|
|
|
157
157
|
`pre`, `table`, `cell`, `media`, …). Content is then plain markup inside it
|
|
158
158
|
(`<Prose><h2>…</h2><p>…</p></Prose>`); never a component per paragraph, and
|
|
159
159
|
never descendant CSS of your own. Declare every element the content uses.
|
|
160
|
+
A block's `spaceBefore` and `spaceAfter` replace the rhythm around it (a
|
|
161
|
+
heading closer to its text); `list` takes `markers` (a shape per depth of
|
|
162
|
+
nesting) and `item` takes `marker` (a colour) and `markerText` (a weight);
|
|
163
|
+
`component` gives every component placed among the blocks its space before
|
|
164
|
+
and after.
|
|
160
165
|
Only classless elements are styled, so do not put classes on content. For
|
|
161
166
|
content that arrives as an HTML string, add a second component on the same
|
|
162
167
|
recipe that injects it (`ProseHtml({ html })`); the application passes the
|
|
@@ -167,7 +172,23 @@ a recipe never creates a state machine.
|
|
|
167
172
|
from the entrance's motion profile, then settles. See the motion reference.
|
|
168
173
|
- A part that needs a box of its own without being a control (a disc behind a
|
|
169
174
|
mark, a badge) takes `frame: { profile: "<frame profile>" }`; do not make a
|
|
170
|
-
separate owner only to give an element padding, a border or a size.
|
|
175
|
+
separate owner only to give an element padding, a border or a size. The
|
|
176
|
+
drawn box of a checkbox, radio or switch whose native `<input>` is hidden
|
|
177
|
+
takes `focus: { of: "<the input's part>" }`: the focus profile's outline is
|
|
178
|
+
drawn on the box while the input has keyboard focus. A visual part may sit
|
|
179
|
+
inside such a part: the owner reads it by its name (`recipe.parts.<name>`,
|
|
180
|
+
`recipe.assets.<name>.source`), which one nested part of the recipe has. On a
|
|
181
|
+
visual part the frame's size is the box and the drawing keeps its visual
|
|
182
|
+
profile's size, centred in it.
|
|
183
|
+
- A switch, a radio's dot or a slider's thumb is a decorative box of its control:
|
|
184
|
+
a part without a `kind`, with `frame: { profile }` and a `surface`, that takes
|
|
185
|
+
another surface or `translateInline` under the control's state
|
|
186
|
+
(`&[aria-checked="true"]`). Keep it empty and `aria-hidden`; name the control
|
|
187
|
+
on its root. Do not rebuild the control as a region to get a second element.
|
|
188
|
+
- A native `<progress>` is styled as a part: its own surface is the track and
|
|
189
|
+
`pseudo: { progressValue: { surface } }` (a background-only surface) the
|
|
190
|
+
fill, proven at 3:1 against the track. Do not draw a measured fill beside a
|
|
191
|
+
hidden native element.
|
|
171
192
|
- A border whose sides differ is stated in the profiles, not the recipe: the
|
|
172
193
|
frame's `borderWidth` plus a side's own (`borderInlineStartWidth`), the
|
|
173
194
|
surface's `borderColor` plus a side's own (`borderInlineStartColor`). Sides
|
|
@@ -177,7 +198,10 @@ a recipe never creates a state machine.
|
|
|
177
198
|
with a class.
|
|
178
199
|
- Surface effects are surface-profile fields, composed in a fixed order:
|
|
179
200
|
`blur` → `filter: blur()`; `backdropBlur` and `backdropSaturate` (role
|
|
180
|
-
`saturation`, a percentage) → `backdrop-filter: blur() saturate()
|
|
201
|
+
`saturation`, a percentage) → `backdrop-filter: blur() saturate()`;
|
|
202
|
+
`brightness` (role `brightness`, a percentage, on a visual part only) →
|
|
203
|
+
`filter: brightness()`: a picture with no dark version takes a token that
|
|
204
|
+
is `100%` in the light theme and lower in the dark one. For
|
|
181
205
|
shadows choose by meaning: `boxShadow` for a box (card, panel, control);
|
|
182
206
|
`shapeShadow` on a visual part whose drawing is not its box (transparent
|
|
183
207
|
image, artwork); `groupShadow` on a container when everything inside should
|
|
@@ -324,7 +348,7 @@ text part breaks one way, set by one `wrap` field:
|
|
|
324
348
|
keeps it reachable, which analysis cannot see).
|
|
325
349
|
- `textEdge` trims a text part's box to the edges it names (`["cap",
|
|
326
350
|
"alphabetic"]`); `textAlign` sets
|
|
327
|
-
its alignment. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
351
|
+
its alignment, on a control's label too. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
328
352
|
spacing in a browser without them.
|
|
329
353
|
|
|
330
354
|
<a id="assets"></a>
|
|
@@ -188,6 +188,7 @@ export function surfacedElements(foundation, spec) {
|
|
|
188
188
|
return [{ element: "&", surface: spec.surface, when: spec.when, text, visual: !1 }, ...regionElements(foundation, spec.parts, slots, text)];
|
|
189
189
|
}
|
|
190
190
|
case "artwork":
|
|
191
|
+
return spec.surface === null ? [] : [{ element: "&", surface: spec.surface, when: [], text: null, visual: !0 }];
|
|
191
192
|
case "grid":
|
|
192
193
|
return [];
|
|
193
194
|
}
|
package/dist/surface-effects.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { resolveTokenValue } from "./token-resolution.mjs";
|
|
2
|
-
export const SHAPE_SHADOW = "shape-shadow", GROUP_SHADOW = "group-shadow";
|
|
3
|
-
const FILTER_FIELDS = ["blur", SHAPE_SHADOW, GROUP_SHADOW], BACKDROP_FIELDS = ["backdrop-blur", "backdrop-saturate"];
|
|
2
|
+
export const SHAPE_SHADOW = "shape-shadow", GROUP_SHADOW = "group-shadow", BRIGHTNESS = "brightness";
|
|
3
|
+
const FILTER_FIELDS = [BRIGHTNESS, "blur", SHAPE_SHADOW, GROUP_SHADOW], BACKDROP_FIELDS = ["backdrop-blur", "backdrop-saturate"];
|
|
4
4
|
export const MASK = "mask", EFFECT_FIELDS = [...FILTER_FIELDS, ...BACKDROP_FIELDS], EFFECT_PROPERTY_FIELDS = { filter: FILTER_FIELDS, "backdrop-filter": BACKDROP_FIELDS };
|
|
5
5
|
export function filterValue(fields) {
|
|
6
|
-
const shadow = fields[SHAPE_SHADOW] ?? fields[GROUP_SHADOW], parts = [...fields.blur === void 0 ? [] : [`blur(${fields.blur})`], ...shadow === void 0 ? [] : [`drop-shadow(${shadow})`]];
|
|
6
|
+
const shadow = fields[SHAPE_SHADOW] ?? fields[GROUP_SHADOW], parts = [...fields[BRIGHTNESS] === void 0 ? [] : [`brightness(${fields[BRIGHTNESS]})`], ...fields.blur === void 0 ? [] : [`blur(${fields.blur})`], ...shadow === void 0 ? [] : [`drop-shadow(${shadow})`]];
|
|
7
7
|
return parts.length === 0 ? null : parts.join(" ");
|
|
8
8
|
}
|
|
9
9
|
export function backdropFilterValue(fields) {
|
|
@@ -42,6 +42,8 @@ export function effectMisplaced(fields, place) {
|
|
|
42
42
|
return { reason: "both", field: GROUP_SHADOW };
|
|
43
43
|
if (fields[MASK] !== void 0 && place === "container")
|
|
44
44
|
return { reason: "mask-on-container", field: MASK };
|
|
45
|
+
if (fields[BRIGHTNESS] !== void 0 && place !== "visual")
|
|
46
|
+
return { reason: "brightness-off-visual", field: BRIGHTNESS };
|
|
45
47
|
if (shape && place !== "visual")
|
|
46
48
|
return { reason: "shape-on-container", field: SHAPE_SHADOW };
|
|
47
49
|
if (group && place === "visual")
|