@reqvire-org/ads 0.5.1 → 0.5.3
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 +143 -51
- 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/design-usage.mjs +4 -20
- package/dist/analysis/factored-classes.mjs +90 -0
- package/dist/analysis/helpers.mjs +5 -7
- package/dist/analysis/mock-check.mjs +4 -5
- package/dist/analysis/native-project.mjs +12 -0
- package/dist/analysis/owner-accessibility.mjs +4 -4
- package/dist/analysis/owner-analysis-cache.mjs +86 -23
- package/dist/analysis/owner-analysis-key.mjs +42 -10
- package/dist/analysis/owner-choices.mjs +56 -7
- package/dist/analysis/owner-composition.mjs +179 -45
- package/dist/analysis/owner-reuse.mjs +8 -6
- package/dist/analysis/owner-source.mjs +304 -110
- 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-contrast.mjs +143 -62
- package/dist/composed-keyline.mjs +2 -2
- package/dist/config.mjs +2 -1
- package/dist/construction-output.mjs +9 -3
- package/dist/construction-spec.d.mts +145 -31
- package/dist/construction-spec.mjs +204 -74
- package/dist/corner-overpaint.mjs +20 -7
- package/dist/derived-states.mjs +182 -0
- package/dist/design-foundation.mjs +16 -0
- package/dist/design-inputs.mjs +18 -3
- package/dist/design-system-closure.mjs +12 -7
- package/dist/design-usage.mjs +2 -8
- package/dist/emit/contract.mjs +24 -5
- package/dist/emit/emission.mjs +6 -9
- 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/grid-lowering.mjs +3 -1
- package/dist/hover-geometry.mjs +15 -0
- package/dist/input-digests.mjs +17 -10
- package/dist/linaria/delivery.mjs +2 -0
- package/dist/lowering-enter.mjs +6 -6
- package/dist/lowering-properties.mjs +5 -0
- package/dist/lowering-region-layout.mjs +7 -2
- package/dist/lowering-session.mjs +10 -0
- 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/mcp/server-observation.mjs +6 -4
- package/dist/mcp/server-project.mjs +4 -1
- package/dist/motion-model.mjs +1 -1
- package/dist/owner-analysis-check.mjs +23 -6
- package/dist/owner-errors.mjs +6 -3
- package/dist/owner-lowering.mjs +78 -13
- package/dist/owner-scenarios.mjs +6 -23
- package/dist/ownership-model.mjs +24 -8
- package/dist/paint-contrast.mjs +6 -0
- package/dist/placeholder-contrast.mjs +17 -1
- package/dist/platform-features.mjs +10 -1
- package/dist/profile-macro.d.mts +7 -0
- package/dist/profile-view-facts.mjs +1 -1
- package/dist/recipe-macro.d.mts +103 -40
- package/dist/recipe-model.mjs +18 -13
- package/dist/region-lowering.mjs +266 -123
- 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 +9 -0
- package/dist/role-vocabulary.mjs +16 -1
- package/dist/runtime-paint-contrast.mjs +5 -2
- package/dist/scenarios-compiler.mjs +20 -6
- package/dist/showcase/assets-view.mjs +29 -13
- package/dist/showcase/client.bundle.js +50 -50
- package/dist/showcase/http-client.bundle.js +15 -15
- package/dist/showcase/ui/ui.css +1 -1
- package/dist/showcase/ui/ui.js +5 -5
- package/dist/skills/ads-designer/references/accessibility.md +10 -4
- 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 +13 -7
- package/dist/skills/ads-designer/references/layout.md +12 -4
- package/dist/skills/ads-designer/references/motion.md +11 -2
- package/dist/skills/ads-designer/references/recipes.md +49 -15
- package/dist/skills/ads-import/references/contracts.md +5 -2
- package/dist/skills/ads-import/references/design-data.md +13 -7
- package/dist/skills/ads-import/references/layout.md +12 -4
- package/dist/skills/ads-import/references/recipes.md +49 -15
- package/dist/skills/ads-migrate/SKILL.md +2 -0
- package/dist/skills/ads-migrate/references/0.5.1-to-0.5.2.md +185 -0
- package/dist/skills/ads-migrate/references/0.5.2-to-0.5.3.md +71 -0
- package/dist/skills/ads-port/references/contracts.md +5 -2
- package/dist/skills/ads-port/references/design-data.md +13 -7
- package/dist/skills/ads-port/references/layout.md +12 -4
- package/dist/skills/ads-port/references/recipes.md +49 -15
- package/dist/spatial-model.mjs +2 -2
- package/dist/surface-contrast.mjs +7 -2
- package/dist/surface-effects.mjs +5 -3
- package/dist/target-size.mjs +21 -3
- package/dist/task-cache.mjs +8 -18
- package/dist/validation-checks.mjs +1 -1
- package/docs/ADS.md +9 -3
- package/docs/ARCHITECTURE.md +96 -30
- package/docs/CACHING.md +152 -24
- package/docs/CHANGELOG.md +307 -23
- package/docs/GUIDE.md +109 -20
- package/docs/LANGUAGE.md +262 -117
- package/docs/MCP.md +5 -1
- package/docs/MOTION.md +15 -4
- package/docs/PROFILE-KINDS.md +54 -4
- package/docs/RULES.md +34 -25
- package/docs/TOKEN-ROLES.md +7 -1
- package/package.json +1 -1
- package/dist/analysis/prose-owners.mjs +0 -57
- package/dist/prose-model.d.mts +0 -81
- package/dist/prose-model.mjs +0 -101
|
@@ -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.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# ADS 0.5.2 → 0.5.3
|
|
2
|
+
|
|
3
|
+
One required change: Prose (`layout: "prose"`) is retired, so a design system
|
|
4
|
+
that has a prose recipe converts it to content components (below). Otherwise no
|
|
5
|
+
source change is required. One fix changes emitted CSS for frames that
|
|
6
|
+
state a size. Several checks now accept what they refused, so workarounds can
|
|
7
|
+
go. The rest is new language a project adopts when it needs it. Owner analysis
|
|
8
|
+
moves to schema `ads-owner-analysis/12`, so the first check after the upgrade
|
|
9
|
+
analyses every owner again.
|
|
10
|
+
|
|
11
|
+
## Prose becomes content components
|
|
12
|
+
|
|
13
|
+
A recipe with `layout: "prose"` now fails as an unknown layout. Long-form
|
|
14
|
+
content is the design system's own components placed by a content pattern; the
|
|
15
|
+
example design system's `patterns/Content/Content` is a complete reference.
|
|
16
|
+
|
|
17
|
+
| Prose | Now |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `elements.paragraph`, `heading2`/`heading3`, `link`, `strong`, `emphasis`, `code` | `Paragraph`, `Heading` (`level`), `Link`, `Strong`, `Emphasis`, `InlineCode`: components, each with the text and surface profiles the element named |
|
|
20
|
+
| `list`, `item` (`indent`, `marker`) | `List` (`ordered`; its frame's `paddingInlineStart` is the indent) and `ListItem` (no arrangement, so the marker stays); a nested list is a part with `spaceBefore` |
|
|
21
|
+
| `quote`, `pre`, `rule`, `table`, `headerCell`, `cell` | `Quote`, `CodeBlock` (focusable, scrolls), `Divider`, `Table`, `TableRow`, `TableCell` (`header`) |
|
|
22
|
+
| `rhythm`, `spaceBefore`, `spaceAfter` on a block | the content pattern's `stack` gap, and `spaceBefore` / `spaceAfter` on its component parts (`kind: "component"`, `repeat: true`, `required: false`) |
|
|
23
|
+
| `elements.component` | another component part of the flow, or a component placed beside the content |
|
|
24
|
+
| A link coloured inside a heading | the heading's surface `provides: { "--link-ink": "<heading ink>" }` |
|
|
25
|
+
| Plain markup as children (`<Prose><h2>…</h2></Prose>`) | a content tree (a union of node types) the pattern renders; adapt Markdown (mdast), HTML (parsed and sanitised) or CMS rich text to it in behaviour code |
|
|
26
|
+
| `ProseHtml({ html })`, `dangerouslySetInnerHTML` | parse the HTML into the tree; nothing injects a string |
|
|
27
|
+
|
|
28
|
+
Application code that wrote plain markup inside a prose owner now passes the
|
|
29
|
+
tree, or renders the content components; `ads-guard` reports plain markup as
|
|
30
|
+
`design-usage/local-markup`.
|
|
31
|
+
|
|
32
|
+
## Emitted CSS that changes
|
|
33
|
+
|
|
34
|
+
- **A frame that states a size.** A frame profile with `inlineSize` or
|
|
35
|
+
`blockSize` now also writes that size as the minimum on its axis
|
|
36
|
+
(`min-inline-size`, `min-block-size`), unless the frame states its own
|
|
37
|
+
minimum or a maximum there. A fixed box in a row no longer shrinks beside
|
|
38
|
+
long wrapping text. If a design relied on the box shrinking, give the frame
|
|
39
|
+
a `minInlineSize` (or `minBlockSize`) of its own, or a maximum.
|
|
40
|
+
|
|
41
|
+
Run `ads emit` and review the rendered owners whose frames state a size.
|
|
42
|
+
|
|
43
|
+
## Checks that now accept what they refused
|
|
44
|
+
|
|
45
|
+
| Before | Now |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| A count, an element or a lookup that selects markup (`members.length > 3`, `members[3]`, `find(…)`) was "not from a finite set"; an inner owner took the result as a prop | Declare it as design state: `const overflow: "fits" \| "overflows" = …`, `const fourth: Member \| undefined = members[3]`. The inner owner can go |
|
|
48
|
+
| A field of an object prop choosing a look (`marks[channel.color]`) | `const color: Color = channel.color`, then `marks[color]` |
|
|
49
|
+
| A heading level from a prop was read as an unknown component | `const Heading = level` with `level?: "h2" \| "h3" \| "h4"` (or a constant `const Heading = "h3"`) is that heading |
|
|
50
|
+
| A drawn checkbox's input took its native size and the row's gap; it was hidden by hand or nested | `drawnBy: "<box part>"` on the input's part, `focus: { of: "<input part>" }` on the box |
|
|
51
|
+
| A full-width trigger could not put its sign at the end | `extent: "fill"` on the control's text part |
|
|
52
|
+
| `tabs.map(…)` could not be a part (`part-missing-or-repeated`); tabs became separate parts | `repeat: true` on the part |
|
|
53
|
+
| An optional element could not be a grid cell; it moved inside another cell | `required: false` on the cell (keep it in auto rows; a pinned `row` is listed for review) |
|
|
54
|
+
| A mapped cell needed `{ span: <column count>, start: "auto" }` per tier | `repeat: true` with `span: "full"` (or a number); `span: "full"` is also accepted with `start: "auto"` |
|
|
55
|
+
| A chat bubble's tail corner was squared or the radius was one value | `startStartRadius` … `endEndRadius` on the frame profile |
|
|
56
|
+
| An entrance could only rise; a pushed screen faded in instead | `enter: { from: { translateInline: { slot: "motion", field: "distance" } }, … }` |
|
|
57
|
+
| Window controls under 24 px were refused although WCAG 2.5.8's spacing exception held; they were enlarged to 24 px | Parts of one stack or inline arrangement pass when 24 px circles centred on them keep clear of each other at every gap. A control placed by another owner has no known neighbours and keeps the minimum |
|
|
58
|
+
| A glyph transparent at rest, shown on hover, was checked at 1:1; the fill was dropped | A fully transparent text or glyph colour has no minimum where it is transparent; its visible states keep theirs |
|
|
59
|
+
| A container whose links or icons need other colours (a tinted banner, a selected row) needed a `tone` prop on every child | `provides` on the container's surface (base or state): the children read their own roles |
|
|
60
|
+
| A plain module that places components ended composed contrast with `component-contrast-unresolved` | Its placements are followed as an owner's are; the review items go, and real failures are reported |
|
|
61
|
+
| A placement that leaves a prop out was paired with every value of that prop | It selects the prop's default or absence |
|
|
62
|
+
|
|
63
|
+
Revert the workarounds where the original design was wanted, run `ads check`,
|
|
64
|
+
and review the rendered owners.
|
|
65
|
+
|
|
66
|
+
## Checks that can newly fail
|
|
67
|
+
|
|
68
|
+
- **Composed contrast through plain modules and left-out props.** Pairs that
|
|
69
|
+
were unresolved review items are now proven, so a pair that really is below
|
|
70
|
+
the minimum is now an error. Fix the colours, or pass the prop that selects
|
|
71
|
+
the intended look.
|
|
@@ -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*).
|
|
@@ -240,6 +240,14 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
|
|
|
240
240
|
|
|
241
241
|
## Colours that depend on their surroundings
|
|
242
242
|
|
|
243
|
+
- **The container decides** (links and icons in a tinted banner, a heading's
|
|
244
|
+
links, a selected row's cells, icons and checkbox, actions on a dark card):
|
|
245
|
+
the container's surface profile provides the roles its children read,
|
|
246
|
+
`provides: { "--link-ink": "--on-warning", "--icon-ink": "--on-warning" }`;
|
|
247
|
+
on a selected row, the state's surface provides them while the state holds.
|
|
248
|
+
The children keep one design and need no prop. Key and value are paint
|
|
249
|
+
tokens; never provide a token the surface itself reads. Composed contrast
|
|
250
|
+
proves the children's text with the provided values on the container.
|
|
243
251
|
- **Inverted regions** (a dark footer or card on a light page): declare
|
|
244
252
|
`sections: true` in `foundation()` and put `data-theme="dark"` on the region.
|
|
245
253
|
Keep writing contexts on `:root` only; emission applies them to sections. The nearest `data-theme` and the nearest
|
|
@@ -249,15 +257,13 @@ imports it first. Each owner sheet carries its tokens' root rules and, with
|
|
|
249
257
|
section's values. Contrast is already proven in every context, so a section
|
|
250
258
|
needs no extra check. A section switches whole themes/brands only; a recipe's
|
|
251
259
|
own token declaration on the section element wins.
|
|
252
|
-
- **On-image
|
|
253
|
-
the child a closed choice the caller sets, such as `tone?: "default" |
|
|
260
|
+
- **On-image controls** (a button over a photo, a background the design system
|
|
261
|
+
cannot know): give the child a closed choice the caller sets, such as `tone?: "default" |
|
|
254
262
|
"on-dark"` mapping to a precompiled recipe with its own surface profile
|
|
255
263
|
(Spectrum's `staticColor`). Use static paints (one `:root` value) for it, so
|
|
256
264
|
the pair is proven and does not change with the page's theme.
|
|
257
|
-
-
|
|
258
|
-
|
|
259
|
-
threaded through each child, or the surface-context construct that is planned.
|
|
260
|
-
Do not invent a theme per state. Details and limits: the ADS tool guide,
|
|
265
|
+
- Do not invent a theme per state, or a `tone` prop for a container the design
|
|
266
|
+
system owns. Details and limits: the ADS tool guide,
|
|
261
267
|
*Colours that depend on their surroundings*.
|
|
262
268
|
|
|
263
269
|
## Colors in Canvas, WebGL and SVG renderers
|
|
@@ -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
|
|
@@ -166,9 +170,13 @@ until that owner is fixed.
|
|
|
166
170
|
so a visible tier keeps the element's own display); `visible: true` shows it
|
|
167
171
|
again from a later tier. Hiding a part while a named condition holds is the
|
|
168
172
|
part's own `at: { "<condition>": { visible } }`, below.
|
|
169
|
-
- Each declared cell renders exactly once (`cell-missing-or-repeated`)
|
|
170
|
-
one owned element or public component
|
|
171
|
-
|
|
173
|
+
- Each declared cell renders exactly once (`cell-missing-or-repeated`) unless it
|
|
174
|
+
says otherwise. A cell names one owned element or public component.
|
|
175
|
+
`required: false` lets it be absent (keep it in auto rows, or its pinned row
|
|
176
|
+
stays empty: `review/optional-cell-row`). `repeat: true` renders it once per
|
|
177
|
+
list item: its instances flow (`start: "auto"` implied) over a numeric span or
|
|
178
|
+
`"full"`, with no start line, `end` or `row`. Several instances may also share
|
|
179
|
+
a cell that auto-places (`start: "auto"`) at every tier.
|
|
172
180
|
- An element has at most one placement (`placement-repeated`), applied in the
|
|
173
181
|
returned JSX (`placement-statement`), and a placed element carries its own recipe
|
|
174
182
|
styling (`placement-without-root`). One element carries one part or cell marker.
|
|
@@ -150,24 +150,55 @@ a recipe never creates a state machine.
|
|
|
150
150
|
surface and its state surfaces, timed by a motion profile with a `static`
|
|
151
151
|
reduced-motion policy. A channel that does not change, an effect that changes
|
|
152
152
|
without its channel, or a gradient on the element, is rejected.
|
|
153
|
-
- Long-form content (articles, docs, legal text, Markdown or CMS output) is
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
`
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
- Long-form content (articles, docs, legal text, Markdown or CMS output) is
|
|
154
|
+
built from the design system's own components: `Heading`, `Paragraph`,
|
|
155
|
+
`Link`, `List`, `Quote`, `CodeBlock`, `Table` and the inline ones, each a
|
|
156
|
+
normal owner. A pattern places them: a `stack` whose parts are placed
|
|
157
|
+
components (`kind: "component"`, `repeat: true`, `required: false`), in any
|
|
158
|
+
order, with a part's `spaceBefore` / `spaceAfter` for the space around it (a
|
|
159
|
+
heading one `sectionGap` from what precedes it). The content arrives as a
|
|
160
|
+
typed tree (a union of node types) that the pattern renders with a ternary
|
|
161
|
+
chain over `node.type` in its `.map` callback; an inline renderer may render
|
|
162
|
+
itself for nested inline nodes. The project adapts Markdown, HTML (parsed and
|
|
163
|
+
sanitised) or CMS rich text to that tree; never style plain markup by tag and
|
|
164
|
+
never inject an HTML string. A colour that follows the container (a link in a
|
|
165
|
+
heading) is the container surface's `provides`, not a prop on the link. A list
|
|
166
|
+
item keeps its marker: give it no arrangement, and space a nested list with a
|
|
167
|
+
part's `spaceBefore` in its block flow.
|
|
168
|
+
- A colour that depends on where an element sits (links and icons in a tinted
|
|
169
|
+
banner, the cells of a selected row, actions on a dark card) is a contextual
|
|
170
|
+
role: the container's surface profile `provides: { "--link-ink": "--on-warning" }`.
|
|
171
|
+
The children read their own roles and need no prop; composed contrast proves
|
|
172
|
+
their text there. Do not add a `tone` prop for a container's colour; keep
|
|
173
|
+
`tone` for a background the design system cannot know (a photo).
|
|
174
|
+
- `enter: { from: { surface, translate | translateInline | scale | rotate }, motion }` on a root
|
|
165
175
|
or a region part is an entrance on first render: the element starts from a
|
|
166
176
|
surface that states only `opacity` and `blur`, and at most one movement read
|
|
167
177
|
from the entrance's motion profile, then settles. See the motion reference.
|
|
168
178
|
- A part that needs a box of its own without being a control (a disc behind a
|
|
169
179
|
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.
|
|
180
|
+
separate owner only to give an element padding, a border or a size. The
|
|
181
|
+
drawn box of a checkbox, radio or switch whose native `<input>` is hidden
|
|
182
|
+
takes `focus: { of: "<the input's part>" }`: the focus profile's outline is
|
|
183
|
+
drawn on the box while the input has keyboard focus. The input's part,
|
|
184
|
+
declared right before the box, takes `drawnBy: "<the box's part>"`: it takes
|
|
185
|
+
no room and lies, invisible, over the box at the box's frame size, so pointer
|
|
186
|
+
and keyboard still reach the real input. A part rendered once per list item
|
|
187
|
+
(`tabs.map(…)`) is declared `repeat: true`: every instance takes the part's
|
|
188
|
+
construction, and `extent: "fill"` shares the row among them. A visual part may sit
|
|
189
|
+
inside such a part: the owner reads it by its name (`recipe.parts.<name>`,
|
|
190
|
+
`recipe.assets.<name>.source`), which one nested part of the recipe has. On a
|
|
191
|
+
visual part the frame's size is the box and the drawing keeps its visual
|
|
192
|
+
profile's size, centred in it.
|
|
193
|
+
- A switch, a radio's dot or a slider's thumb is a decorative box of its control:
|
|
194
|
+
a part without a `kind`, with `frame: { profile }` and a `surface`, that takes
|
|
195
|
+
another surface or `translateInline` under the control's state
|
|
196
|
+
(`&[aria-checked="true"]`). Keep it empty and `aria-hidden`; name the control
|
|
197
|
+
on its root. Do not rebuild the control as a region to get a second element.
|
|
198
|
+
- A native `<progress>` is styled as a part: its own surface is the track and
|
|
199
|
+
`pseudo: { progressValue: { surface } }` (a background-only surface) the
|
|
200
|
+
fill, proven at 3:1 against the track. Do not draw a measured fill beside a
|
|
201
|
+
hidden native element.
|
|
171
202
|
- A border whose sides differ is stated in the profiles, not the recipe: the
|
|
172
203
|
frame's `borderWidth` plus a side's own (`borderInlineStartWidth`), the
|
|
173
204
|
surface's `borderColor` plus a side's own (`borderInlineStartColor`). Sides
|
|
@@ -177,7 +208,10 @@ a recipe never creates a state machine.
|
|
|
177
208
|
with a class.
|
|
178
209
|
- Surface effects are surface-profile fields, composed in a fixed order:
|
|
179
210
|
`blur` → `filter: blur()`; `backdropBlur` and `backdropSaturate` (role
|
|
180
|
-
`saturation`, a percentage) → `backdrop-filter: blur() saturate()
|
|
211
|
+
`saturation`, a percentage) → `backdrop-filter: blur() saturate()`;
|
|
212
|
+
`brightness` (role `brightness`, a percentage, on a visual part only) →
|
|
213
|
+
`filter: brightness()`: a picture with no dark version takes a token that
|
|
214
|
+
is `100%` in the light theme and lower in the dark one. For
|
|
181
215
|
shadows choose by meaning: `boxShadow` for a box (card, panel, control);
|
|
182
216
|
`shapeShadow` on a visual part whose drawing is not its box (transparent
|
|
183
217
|
image, artwork); `groupShadow` on a container when everything inside should
|
|
@@ -324,7 +358,7 @@ text part breaks one way, set by one `wrap` field:
|
|
|
324
358
|
keeps it reachable, which analysis cannot see).
|
|
325
359
|
- `textEdge` trims a text part's box to the edges it names (`["cap",
|
|
326
360
|
"alphabetic"]`); `textAlign` sets
|
|
327
|
-
its alignment. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
361
|
+
its alignment, on a control's label too. Balanced, pretty and trimmed text degrade to plain wrapping and
|
|
328
362
|
spacing in a browser without them.
|
|
329
363
|
|
|
330
364
|
<a id="assets"></a>
|
package/dist/spatial-model.mjs
CHANGED
|
@@ -268,8 +268,8 @@ function expand(css, model) {
|
|
|
268
268
|
delete next.span;
|
|
269
269
|
state = next;
|
|
270
270
|
const count = inherited?.[index] ?? Number(props.columns ?? point.count), auto = state.start === "auto", start = auto ? 1 : integer(state.start);
|
|
271
|
-
if (auto &&
|
|
272
|
-
fail(`${cell.params} auto placement
|
|
271
|
+
if (auto && state.end !== void 0)
|
|
272
|
+
fail(`${cell.params} auto placement takes a span; end needs a start line.`);
|
|
273
273
|
const span = state.end !== void 0 ? integer(state.end) - start : state.span === "full" ? count - start + 1 : integer(state.span);
|
|
274
274
|
if (!Number.isInteger(start) || !Number.isInteger(span) || span < 1 || start + span - 1 > count)
|
|
275
275
|
fail(`${cell.params} placement ${state.start}/${state.end !== void 0 ? `end ${state.end}` : String(state.span)} exceeds ${count} columns at ${point.name}.`);
|
|
@@ -2,7 +2,7 @@ import { INACTIVE_STATE, SURFACE_STATE } from "./role-vocabulary.mjs";
|
|
|
2
2
|
import { selectedProfile, tokenValueContexts } from "./design-foundation.mjs";
|
|
3
3
|
import { lengthPx } from "./css-length.mjs";
|
|
4
4
|
import { resolveTokenValue } from "./token-resolution.mjs";
|
|
5
|
-
import { BOLD_WEIGHT, inactiveCondition, LARGE_BOLD_TEXT_PX, LARGE_TEXT_MINIMUM, LARGE_TEXT_PX, NON_TEXT_MINIMUM, paintContrast, reachablePairs, TEXT_MINIMUM } from "./paint-contrast.mjs";
|
|
5
|
+
import { BOLD_WEIGHT, inactiveCondition, LARGE_BOLD_TEXT_PX, LARGE_TEXT_MINIMUM, LARGE_TEXT_PX, NON_TEXT_MINIMUM, paintContrast, reachablePairs, TEXT_MINIMUM, unshown } from "./paint-contrast.mjs";
|
|
6
6
|
import { err, ok } from "./result.mjs";
|
|
7
7
|
const PAINT_FIELDS = ["color", "background", "background-image", "opacity"], paintsOf = (fields) => ({
|
|
8
8
|
foreground: fields.color ?? null,
|
|
@@ -31,6 +31,8 @@ export function surfaceContrastFindings(foundation) {
|
|
|
31
31
|
const [profile = "", ...shared] = profiles, composed = foundation.model.compose(profile), file = composed.kind === "ok" ? composed.value.file ?? null : null, failing = [], unprovable = [], placed = [];
|
|
32
32
|
let first = null, reason = null;
|
|
33
33
|
for (const context of contexts) {
|
|
34
|
+
if (unshown(paints.foreground, context))
|
|
35
|
+
continue;
|
|
34
36
|
const outcome = paintContrast(context, paints, TEXT_MINIMUM);
|
|
35
37
|
switch (outcome.kind) {
|
|
36
38
|
case "sufficient":
|
|
@@ -127,7 +129,7 @@ export function sufficientForUses(foundation, paints, uses) {
|
|
|
127
129
|
return !1;
|
|
128
130
|
return tokenValueContexts(foundation).every((context) => {
|
|
129
131
|
const minimum = Math.max(...uses.map((use) => useMinimum(use, context)));
|
|
130
|
-
return minimum === 0 || paintContrast(context, paints, minimum).kind !== "insufficient";
|
|
132
|
+
return minimum === 0 || unshown(paints.foreground, context) || paintContrast(context, paints, minimum).kind !== "insufficient";
|
|
131
133
|
});
|
|
132
134
|
}
|
|
133
135
|
function textProfile(foundation, reference) {
|
|
@@ -188,6 +190,7 @@ export function surfacedElements(foundation, spec) {
|
|
|
188
190
|
return [{ element: "&", surface: spec.surface, when: spec.when, text, visual: !1 }, ...regionElements(foundation, spec.parts, slots, text)];
|
|
189
191
|
}
|
|
190
192
|
case "artwork":
|
|
193
|
+
return spec.surface === null ? [] : [{ element: "&", surface: spec.surface, when: [], text: null, visual: !0 }];
|
|
191
194
|
case "grid":
|
|
192
195
|
return [];
|
|
193
196
|
}
|
|
@@ -233,6 +236,8 @@ export function stateContrast(foundation, spec, content = () => "text") {
|
|
|
233
236
|
let noted = !1;
|
|
234
237
|
contexts ??= tokenValueContexts(foundation);
|
|
235
238
|
for (const context of contexts) {
|
|
239
|
+
if (unshown(paints.foreground, context))
|
|
240
|
+
continue;
|
|
236
241
|
const outcome = paintContrast(context, paints, painted === "graphic" ? NON_TEXT_MINIMUM : textMinimum(text, context));
|
|
237
242
|
switch (outcome.kind) {
|
|
238
243
|
case "sufficient":
|
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")
|
package/dist/target-size.mjs
CHANGED
|
@@ -94,7 +94,7 @@ export function targetSizeFindings(foundation, targets) {
|
|
|
94
94
|
const key = JSON.stringify(targets), cached = byFacts.get(key);
|
|
95
95
|
if (cached !== void 0)
|
|
96
96
|
return cached;
|
|
97
|
-
const contexts = tokenValueContexts(foundation), findings = [...targets.elements.flatMap((element) => elementFindings(element, contexts)), ...targets.neighbours.flatMap((pair) => overlapFindings(pair, contexts))];
|
|
97
|
+
const contexts = tokenValueContexts(foundation), findings = [...targets.elements.flatMap((element) => elementFindings(element, contexts, targets.neighbours.filter((pair) => pair.first.element === element.element || pair.second.element === element.element))), ...targets.neighbours.flatMap((pair) => overlapFindings(pair, contexts))];
|
|
98
98
|
byFacts.set(key, findings);
|
|
99
99
|
return findings;
|
|
100
100
|
}
|
|
@@ -115,7 +115,22 @@ function contentWidth(content) {
|
|
|
115
115
|
return "the width of the native element's own content";
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
const undersized = (box) => box.block < TARGET_MIN_PX || box.inline.px < TARGET_MIN_PX;
|
|
119
|
+
function spaced(geometry, pairs, context) {
|
|
120
|
+
if (pairs.length === 0)
|
|
121
|
+
return !1;
|
|
122
|
+
const radius = TARGET_MIN_PX / 2;
|
|
123
|
+
return pairs.every((pair) => {
|
|
124
|
+
const own = measure(geometry, context), other = measure(pair.first.element === geometry.element ? pair.second : pair.first, context), gap = lengthPx(pair.gap, context);
|
|
125
|
+
if (own.kind !== "measured" || other.kind !== "measured" || gap.kind !== "px")
|
|
126
|
+
return !1;
|
|
127
|
+
const along = (box) => pair.axis === "inline" ? box.inline.px : box.block, half = along(own.size.target) / 2, otherHalf = along(other.size.target) / 2;
|
|
128
|
+
if (half + gap.px < radius)
|
|
129
|
+
return !1;
|
|
130
|
+
return !undersized(other.size.target) || half + gap.px + otherHalf >= TARGET_MIN_PX;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function elementFindings(geometry, contexts, pairs) {
|
|
119
134
|
const failing = new Tally, unproven = new Tally;
|
|
120
135
|
for (const context of contexts) {
|
|
121
136
|
const read = measure(geometry, context);
|
|
@@ -125,7 +140,10 @@ function elementFindings(geometry, contexts) {
|
|
|
125
140
|
break;
|
|
126
141
|
case "measured": {
|
|
127
142
|
const { block, inline } = read.size.target;
|
|
128
|
-
if (
|
|
143
|
+
if (undersized(read.size.target) && spaced(geometry, pairs, context)) {
|
|
144
|
+
if (geometry.measured.length > 0)
|
|
145
|
+
unproven.add(context.label, `its ${geometry.measured.map((bound) => `${bound.property} is measured at runtime ("${bound.name}", ${bound.fallback} before it is set)`).join(" and ")}`);
|
|
146
|
+
} else if (block < TARGET_MIN_PX || inline.exact && inline.px < TARGET_MIN_PX)
|
|
129
147
|
failing.add(context.label, { blockPx: block, inlinePx: inline.px, inlineExact: inline.exact });
|
|
130
148
|
else if (inline.px < TARGET_MIN_PX)
|
|
131
149
|
unproven.add(context.label, `its inline extent is ${px(inline.px)} plus ${contentWidth(geometry.content)}`);
|