actual-css 0.18.0 → 0.19.1
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/CHANGELOG.md +54 -0
- package/README.md +7 -5
- package/components.json +6 -2
- package/dist/actual.full.css +272 -57
- package/dist/actual.full.js +2 -2
- package/dist/actual.full.min.css +1 -1
- package/docs/design-notes/enhancement-contract.md +20 -11
- package/docs/design-notes/motion-cost.md +62 -0
- package/docs/design-notes/tokens.md +4 -0
- package/docs/navigation.json +3 -0
- package/docs/pages/components/aura.md +3 -0
- package/docs/pages/components/mark-sweep.md +42 -0
- package/docs/pages/components/rating.md +53 -22
- package/docs/pages/components/reveal.md +54 -0
- package/docs/pages/components/shimmer.md +3 -2
- package/docs/pages/enhancements/in-view.md +109 -0
- package/docs/pages/enhancements/overview.md +3 -2
- package/docs/pages/enhancements/scrollspy.md +5 -5
- package/docs/pages/examples/overview.md +5 -2
- package/docs/pages/forms/date-picker.md +3 -2
- package/docs/pages/forms/switch.md +25 -16
- package/docs/pages/foundations/tokens.md +37 -15
- package/docs/pages/foundations/typography.md +8 -2
- package/docs/pages/guides/introduction.md +1 -1
- package/docs/pages/guides/modular-import.md +20 -4
- package/docs/pages/guides/progressive-enhancement.md +2 -1
- package/docs/pages/guides/upgrading.md +1 -1
- package/docs/pages/patterns/code-block.md +1 -1
- package/docs/pages/patterns/empty-state.md +3 -3
- package/docs/pages/patterns/exclusive-accordion.md +3 -2
- package/docs/pages/patterns/hierarchical-nav.md +5 -4
- package/docs/pages/patterns/icon-input.md +1 -1
- package/docs/pages/patterns/icon-slot.md +4 -4
- package/docs/pages/patterns/intent-nesting.md +2 -3
- package/docs/pages/patterns/navigation-list.md +7 -4
- package/docs/pages/patterns/stat.md +3 -3
- package/docs/pages/patterns/structured-lists.md +1 -2
- package/llms.txt +2 -1
- package/package.json +3 -1
- package/reserved-classes.json +4 -0
- package/src/cli/actual-css.js +3 -1
- package/src/css/components/navbar.css +13 -5
- package/src/css/components/rating.css +23 -2
- package/src/css/components/scrollspy.css +4 -2
- package/src/css/core/base.css +16 -0
- package/src/css/core/focus.css +13 -12
- package/src/css/core/reset.css +10 -0
- package/src/css/core/theme.css +15 -0
- package/src/css/core/tokens.css +4 -10
- package/src/css/effects/aura.css +5 -0
- package/src/css/effects/index.css +2 -0
- package/src/css/effects/mark-sweep.css +64 -0
- package/src/css/effects/reveal.css +66 -0
- package/src/css/effects/shimmer.css +28 -10
- package/src/css/forms/choice.css +0 -7
- package/src/css/forms/switch.css +9 -9
- package/src/js/full.js +1 -0
- package/src/js/in-view.js +152 -0
- package/src/js/scrollspy.js +81 -2
- package/src/js/selectors.js +3 -0
- package/src/tooling/css-bundle.js +153 -6
- package/src/tooling/design-tokens.js +2 -0
- package/tokens.json +2 -0
|
@@ -171,14 +171,23 @@ of the contract itself.
|
|
|
171
171
|
|
|
172
172
|
## Token vocabulary
|
|
173
173
|
|
|
174
|
-
| Token | Behavior | Existing class
|
|
175
|
-
| ------------ | ------------------------------------------------ |
|
|
176
|
-
| `tabs` | Tab panel switching, arrow-key navigation | `.tabs`
|
|
177
|
-
| `flyout` | Trigger → panel positioning, open/close | `.flyout`
|
|
178
|
-
| `range` | Fill share and named-value synchronization | `.range`
|
|
179
|
-
| `scrollspy` | Scroll-driven nav highlighting | `.scrollspy`
|
|
180
|
-
| `
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
183
|
-
|
|
184
|
-
|
|
174
|
+
| Token | Behavior | Existing class |
|
|
175
|
+
| ------------ | ------------------------------------------------ | ------------------------ |
|
|
176
|
+
| `tabs` | Tab panel switching, arrow-key navigation | `.tabs` |
|
|
177
|
+
| `flyout` | Trigger → panel positioning, open/close | `.flyout` |
|
|
178
|
+
| `range` | Fill share and named-value synchronization | `.range` |
|
|
179
|
+
| `scrollspy` | Scroll-driven nav highlighting | `.scrollspy` |
|
|
180
|
+
| `in-view` | One-shot viewport appearance state | `.reveal`, `.mark-sweep` |
|
|
181
|
+
| `validation` | Form validation, focus management, server errors | `.needs-validation` |
|
|
182
|
+
| `dirty` | Unsaved-changes state on a form | — |
|
|
183
|
+
| `ajax` | Form submission through `fetch` | — |
|
|
184
|
+
|
|
185
|
+
Eight tokens. Everything else stays self-describing.
|
|
186
|
+
|
|
187
|
+
`in-view` is a presentation trigger, not an animation system: it writes
|
|
188
|
+
`is-pending` while an element waits outside the viewport and removes it on the
|
|
189
|
+
first intersection. The effect's CSS owns what that state looks like, and the
|
|
190
|
+
element is never hidden before the observer's first callback reports it off
|
|
191
|
+
screen. Its one concession to motion is focus: a release by `focusin` finishes
|
|
192
|
+
the animations that removing the state started, found by difference, because
|
|
193
|
+
a CSS `:focus-within` override lapses on blur and replays the entrance.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Motion cost
|
|
2
|
+
|
|
3
|
+
What an animation costs per frame depends on the property it animates, not on
|
|
4
|
+
how complex the effect looks. `transform` and `opacity` run on the compositor:
|
|
5
|
+
the layer is rastered once and moved. Anything else — a registered custom
|
|
6
|
+
property, `box-shadow`, `background-position` — runs style and paint on the
|
|
7
|
+
main thread every frame, off screen included.
|
|
8
|
+
|
|
9
|
+
## Measuring
|
|
10
|
+
|
|
11
|
+
`bun run report:paint` loads each page it is given and reports renderer CPU,
|
|
12
|
+
main-thread task time and frame pacing over a fixed window. Give it one page
|
|
13
|
+
per variant; a fixture reads its variant from the query string. Confirm a
|
|
14
|
+
finding in a real browser with DevTools → Rendering → Paint flashing: a
|
|
15
|
+
repainted element flashes green on every frame.
|
|
16
|
+
|
|
17
|
+
## Aura
|
|
18
|
+
|
|
19
|
+
`.aura` animates `--aura-angle`, a registered property that feeds the frame's
|
|
20
|
+
`conic-gradient`. The usual border-beam technique, built with a JavaScript
|
|
21
|
+
component that adds a beam element, draws the same light by rotating a static
|
|
22
|
+
conic square with `transform`, cut to a ring by a mask.
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
bun run report:paint \
|
|
26
|
+
"scripts/fixtures/aura-paint.html?variant=frozen&n=20" \
|
|
27
|
+
"scripts/fixtures/aura-paint.html?variant=current&n=20" \
|
|
28
|
+
"scripts/fixtures/aura-paint.html?variant=glow&n=20" \
|
|
29
|
+
"scripts/fixtures/aura-paint.html?variant=layout&n=20" \
|
|
30
|
+
"scripts/fixtures/aura-paint.html?variant=static&n=20" \
|
|
31
|
+
"scripts/fixtures/aura-paint.html?variant=nohalo&n=20" \
|
|
32
|
+
"scripts/fixtures/aura-paint.html?variant=rotate&n=20"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Measured on 2026-11-12, headless Chrome, renderer CPU in ms per second:
|
|
36
|
+
|
|
37
|
+
| Auras on screen | Frozen | `.aura` | `.aura-glow` | Rotated beam |
|
|
38
|
+
| ------------------ | ------ | --------- | ------------ | ------------ |
|
|
39
|
+
| 1 | 14 | 150–210 | 118 | 35–45 |
|
|
40
|
+
| 4 | 17 | 290–590 | 537 | 35–90 |
|
|
41
|
+
| 20 | 20–40 | 1150–1700 | 815 | 90–100 |
|
|
42
|
+
| 5 (+15 off screen) | 20 | ~500 | 360 | ~90 |
|
|
43
|
+
|
|
44
|
+
Paint flashing in Chrome agreed: every `.aura` flashes, the beam never does.
|
|
45
|
+
No variant dropped below 60 fps.
|
|
46
|
+
|
|
47
|
+
- The cost is the `--aura-angle` animation itself. `contain: layout`, a static
|
|
48
|
+
near halo on its own layer, and no near halo at all all stayed within noise
|
|
49
|
+
of the current aura.
|
|
50
|
+
- Off-screen auras keep paying main-thread style on every frame.
|
|
51
|
+
- `.aura-glow` costs less but still repaints: its far halo breathes through
|
|
52
|
+
`box-shadow`.
|
|
53
|
+
|
|
54
|
+
Aura keeps its implementation. The compositor version needs an element to
|
|
55
|
+
rotate inside a ring-shaped clip, and `.aura` has none to give: both pseudos
|
|
56
|
+
are taken (near halo, occlusion), a mask on `.aura` would clip the child, and
|
|
57
|
+
`overflow: clip` would cut the halo and the child's focus ring. Adding a beam
|
|
58
|
+
element would break the one-child contract for an effect meant for one or two
|
|
59
|
+
objects per view, which is what the Aura page now asks.
|
|
60
|
+
|
|
61
|
+
Reopen this if a design needs many simultaneous auras: the answer is then an
|
|
62
|
+
explicit beam element, not containment.
|
|
@@ -75,6 +75,10 @@ Mixing against `black`, `white`, `transparent`, or `currentColor` is exempt and
|
|
|
75
75
|
|
|
76
76
|
Ordinary interaction/state transitions have **no easing token**: they use the CSS default `ease` directly, and the dialog shake feedback plus the `actual-dialog` View Transition keep that default deliberately. The presence pair exists only for one-shot open/close where open and closed states own separate easing values (`.status-bar`/`.is-open`, `dialog.modal[open]`, `dialog.drawer[open]`): `--ease-enter` decelerates the appearance, `--ease-exit` accelerates the departure. The pair follows Material's standard rhythm; the emphasized-decelerate entrance is deliberately not offered because it only pays off at 250–400ms durations, beyond this vocabulary. Backdrops keep `ease` — a scrim only fades, it does not travel — but track their surface's duration. Toggles that share one transition list at `--duration-fast` (flyout, tooltip) also stay on `ease`: at 100ms the curve barely resolves and entry/exit cannot split on a single rule. These absences are deliberate, not gaps; a theme with a different motion character overrides `--ease-enter` / `--ease-exit`.
|
|
77
77
|
|
|
78
|
+
Reveal and Mark sweep use native `ease-out`: the surface entrance curve
|
|
79
|
+
completes too much of a fade or highlight sweep near the start. Their gentler
|
|
80
|
+
deceleration is local to those effects, rather than another shared easing token.
|
|
81
|
+
|
|
78
82
|
## Internal tokens
|
|
79
83
|
|
|
80
84
|
Internal tokens are allowed when they reduce duplication or make component code clearer.
|
package/docs/navigation.json
CHANGED
|
@@ -76,11 +76,13 @@
|
|
|
76
76
|
"indicator",
|
|
77
77
|
"key",
|
|
78
78
|
"list",
|
|
79
|
+
"mark-sweep",
|
|
79
80
|
"meter",
|
|
80
81
|
"navbar",
|
|
81
82
|
"pagination",
|
|
82
83
|
"progress",
|
|
83
84
|
"rating",
|
|
85
|
+
"reveal",
|
|
84
86
|
"segmented",
|
|
85
87
|
"shimmer",
|
|
86
88
|
"skeleton",
|
|
@@ -161,6 +163,7 @@
|
|
|
161
163
|
"tooltip",
|
|
162
164
|
"tabs",
|
|
163
165
|
"scrollspy",
|
|
166
|
+
"in-view",
|
|
164
167
|
"status-bar"
|
|
165
168
|
]
|
|
166
169
|
},
|
|
@@ -109,6 +109,9 @@ the accent, or one breath of the glow.
|
|
|
109
109
|
</div>
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
Both animations repaint the aura on every frame, even off screen. Reserve aura
|
|
113
|
+
for the one or two objects a view emphasizes, not for every card in a grid.
|
|
114
|
+
|
|
112
115
|
Keep exactly one direct child and set `--aura-radius` when its shape differs
|
|
113
116
|
from the common button, card, alert, and badge shapes detected as a visual
|
|
114
117
|
enhancement.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Mark sweep
|
|
2
|
+
|
|
3
|
+
Mark Sweep wipes a highlight in behind a phrase the first time it enters the viewport, using the same colors as `<mark>`.
|
|
4
|
+
|
|
5
|
+
> **Module** — import `actual-css/css/effects/mark-sweep` and `actual-css/js/in-view`, or the `actual-css/css/effects` and `actual-css/js/full` bundles.
|
|
6
|
+
|
|
7
|
+
```html demo
|
|
8
|
+
<p>Ship the <mark class="mark-sweep" data-enhance="in-view">small parts</mark> that carry the interface.</p>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Related terms:** highlighter, marker, text highlight, annotation, highlight on scroll.
|
|
12
|
+
|
|
13
|
+
`<mark>` means the phrase is relevant in its context. Keep it for that meaning; use `.mark-sweep` when the highlight is decoration and the text is an ordinary span.
|
|
14
|
+
|
|
15
|
+
At rest the phrase carries the full highlight, so no JavaScript, reduced motion, and print all show the same readable text. `data-enhance="in-view"` adds `is-pending` while the phrase waits off screen; the sweep then grows the background from the reading direction's start edge. The transition is declared on the base state, so it is defined when the class is removed.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Try the [Appearance effects catalogue](../../demo/templates/appearance.html#mark)
|
|
20
|
+
to replay highlights in theme colors and both reading directions.
|
|
21
|
+
|
|
22
|
+
- Load the runtime with `actual-css/js/full`, or register only `actual-css/js/in-view`.
|
|
23
|
+
- Put the token and class on the phrase itself, not on the surrounding paragraph: the observer measures the highlighted box.
|
|
24
|
+
- The sweep is one-shot. Use it for a few phrases per page; a paragraph where every other word sweeps reads as an effect demo, not as writing.
|
|
25
|
+
- The base `<mark>` pair comes from the theme. An intent class on the same element gives the sweep a soft tint with theme text: `.primary`, `.secondary`, `.success`, `.warning`, `.danger`, or `.neutral`. The tint uses `--soft-bg-mix`; without `color-mix()`, the theme highlight pair remains.
|
|
26
|
+
- Forced colors replaces the sweep with the system `Mark` / `MarkText` pair, so the phrase stays distinct on both `<mark>` and `<span>`.
|
|
27
|
+
|
|
28
|
+
See [In view](../enhancements/in-view.md) for trigger margins, pending state,
|
|
29
|
+
and immediate appearance on keyboard focus.
|
|
30
|
+
|
|
31
|
+
```html demo
|
|
32
|
+
<p>
|
|
33
|
+
A <mark class="mark-sweep warning" data-enhance="in-view">deadline</mark> is a fact;
|
|
34
|
+
an <mark class="mark-sweep primary" data-enhance="in-view">idea worth keeping</mark>
|
|
35
|
+
is a decision.
|
|
36
|
+
</p>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Hooks
|
|
40
|
+
|
|
41
|
+
- `--mark-sweep-duration` — time for the highlight to cross the phrase.
|
|
42
|
+
- `--mark-bg`, `--mark-fg` — the highlight pair, shared with base `<mark>`; set them on a theme or on an element for a local color. Keep the text legible against both the highlight and the uncovered surface during the sweep.
|
|
@@ -19,7 +19,7 @@ filled while the control remains fully functional.
|
|
|
19
19
|
## Anatomy
|
|
20
20
|
|
|
21
21
|
```text
|
|
22
|
-
fieldset.field
|
|
22
|
+
fieldset.field-group.flush + .field with help or error text
|
|
23
23
|
├── legend.field-label names the group
|
|
24
24
|
└── .rating
|
|
25
25
|
└── input[type="radio"] ×1..N, ascending values, aria-label each
|
|
@@ -30,7 +30,7 @@ fieldset.field
|
|
|
30
30
|
## Rate this item
|
|
31
31
|
|
|
32
32
|
```html demo
|
|
33
|
-
<fieldset class="field">
|
|
33
|
+
<fieldset class="field-group flush">
|
|
34
34
|
<legend class="field-label">Rate this item</legend>
|
|
35
35
|
<div class="rating">
|
|
36
36
|
<input type="radio" name="item" value="1" aria-label="1 star" />
|
|
@@ -43,7 +43,9 @@ fieldset.field
|
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Use a visible `<legend>` to name the group and an `aria-label` on every radio
|
|
46
|
-
to name its value.
|
|
46
|
+
to name its value. `.field-group.flush` drops the native fieldset frame. Add
|
|
47
|
+
`.field` when the group holds help or error text: it spaces them and shows the
|
|
48
|
+
validation error. In forced-colors mode the stars deliberately return to
|
|
47
49
|
native platform radios so checked and focus states remain unambiguous.
|
|
48
50
|
|
|
49
51
|
## Required rating
|
|
@@ -54,7 +56,7 @@ never on page load, and picking a star clears it.
|
|
|
54
56
|
|
|
55
57
|
```html demo
|
|
56
58
|
<form class="stack needs-validation" data-enhance="validation" novalidate>
|
|
57
|
-
<fieldset class="field">
|
|
59
|
+
<fieldset class="field field-group flush">
|
|
58
60
|
<legend class="field-label">Rate your stay</legend>
|
|
59
61
|
<div class="rating">
|
|
60
62
|
<input type="radio" name="stay" value="1" aria-label="1 star" required aria-describedby="stay-error" />
|
|
@@ -77,7 +79,7 @@ Intent classes change the active color without changing the interaction model.
|
|
|
77
79
|
|
|
78
80
|
```html demo
|
|
79
81
|
<div class="cluster">
|
|
80
|
-
<fieldset class="field">
|
|
82
|
+
<fieldset class="field-group flush">
|
|
81
83
|
<legend class="field-label">Small rating</legend>
|
|
82
84
|
<div class="rating primary sm">
|
|
83
85
|
<input type="radio" name="small-rating" value="1" aria-label="1 star" />
|
|
@@ -86,7 +88,7 @@ Intent classes change the active color without changing the interaction model.
|
|
|
86
88
|
</div>
|
|
87
89
|
</fieldset>
|
|
88
90
|
|
|
89
|
-
<fieldset class="field">
|
|
91
|
+
<fieldset class="field-group flush">
|
|
90
92
|
<legend class="field-label">Large rating</legend>
|
|
91
93
|
<div class="rating danger lg">
|
|
92
94
|
<input type="radio" name="large-rating" value="1" aria-label="1 star" />
|
|
@@ -127,7 +129,7 @@ help text, a review summary, a review line, a row beside a field and a button.
|
|
|
127
129
|
|
|
128
130
|
```html demo
|
|
129
131
|
<div class="stack">
|
|
130
|
-
<fieldset class="field">
|
|
132
|
+
<fieldset class="field field-group flush">
|
|
131
133
|
<legend class="field-label">Rate this release</legend>
|
|
132
134
|
<div class="rating">
|
|
133
135
|
<input type="radio" name="release" value="1" aria-label="1 star" />
|
|
@@ -157,35 +159,64 @@ help text, a review summary, a review line, a row beside a field and a button.
|
|
|
157
159
|
</div>
|
|
158
160
|
```
|
|
159
161
|
|
|
160
|
-
##
|
|
162
|
+
## Color and shape
|
|
161
163
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
shape, not only by color; give it an ink that reads as a line, such as
|
|
165
|
-
`--text-subtle`. The same hooks draw any other symbol, a heart here, in the
|
|
166
|
-
page ink.
|
|
164
|
+
Stars are gold by default. A neutral ink, outlined empty stars, a brand color,
|
|
165
|
+
or another symbol are each one hook away.
|
|
167
166
|
|
|
168
167
|
```html demo
|
|
169
168
|
<div class="stack">
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
<p class="cluster">
|
|
170
|
+
<span class="rating" role="img" aria-label="3.5 out of 5" style="--rating-value: 3.5"></span>
|
|
171
|
+
<span class="muted">Default</span>
|
|
172
|
+
</p>
|
|
173
|
+
<p class="cluster">
|
|
174
|
+
<span class="rating" role="img" aria-label="3.5 out of 5"
|
|
175
|
+
style="--rating-value: 3.5; --rating-color: var(--text)"></span>
|
|
176
|
+
<span class="muted">Neutral ink</span>
|
|
177
|
+
</p>
|
|
178
|
+
<p class="cluster">
|
|
179
|
+
<span class="rating" role="img" aria-label="3.5 out of 5"
|
|
180
|
+
style="--rating-value: 3.5; --rating-star-empty: var(--rating-star-outline); --rating-empty: var(--text-subtle)"></span>
|
|
181
|
+
<span class="muted">Outlined empty stars</span>
|
|
182
|
+
</p>
|
|
183
|
+
<p class="cluster">
|
|
184
|
+
<span class="rating" role="img" aria-label="4 out of 5"
|
|
185
|
+
style="--rating-value: 4; --rating-color: var(--danger); --rating-star: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22%3E%3Cpath d=%22M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.6 4.5c2.1 0 3.6 1.2 4.4 2.6.8-1.4 2.3-2.6 4.4-2.6 3.6 0 5.7 3.9 4.2 7.3C19.5 16.4 12 21 12 21z%22/%3E%3C/svg%3E')"></span>
|
|
186
|
+
<span class="muted">Another symbol</span>
|
|
187
|
+
</p>
|
|
174
188
|
</div>
|
|
175
189
|
```
|
|
176
190
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
191
|
+
The outline makes empty and filled stars differ by shape, not only by color;
|
|
192
|
+
give it an ink that reads as a line, such as `--text-subtle`. It outlines the
|
|
193
|
+
default star only: a custom `--rating-star` brings its own empty shape.
|
|
194
|
+
|
|
195
|
+
A theme sets the same hooks in a rule on `.rating`. The component declares its
|
|
196
|
+
defaults there, so a value set on `[data-theme]` or another ancestor is
|
|
197
|
+
overridden. Keep `var(--intent, …)` first so intent classes still apply. The
|
|
198
|
+
cyberpunk, neon and material demo themes each restyle the stars this way.
|
|
199
|
+
|
|
200
|
+
```css
|
|
201
|
+
[data-theme="mine"] .rating {
|
|
202
|
+
--rating-color: var(--intent, var(--text));
|
|
203
|
+
--rating-star-empty: var(--rating-star-outline);
|
|
204
|
+
--rating-empty: var(--text-subtle);
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
The default gold is below 3:1 on a white surface. Where that matters, set a
|
|
209
|
+
darker `--rating-color`. A browser without `mask-composite` (Chromium before
|
|
210
|
+
120) draws custom empty stars of a read-only display in the filled shape.
|
|
181
211
|
|
|
182
212
|
### Hooks
|
|
183
213
|
|
|
184
214
|
- `--rating-size` — size of each star; `.sm` and `.lg` set this hook.
|
|
185
215
|
- `--rating-gap` — visual space between stars without creating inactive hover zones.
|
|
186
216
|
- `--rating-color` — star color. Prefer an intent class for semantic color.
|
|
187
|
-
- `--rating-empty` — color of unselected stars;
|
|
217
|
+
- `--rating-empty` — color of unselected stars; `--text-subtle` suits an outline.
|
|
188
218
|
- `--rating-star` — mask image used to draw a star; override it when a strict CSP disallows data URLs.
|
|
189
219
|
- `--rating-star-empty` — mask image of an empty star; follows `--rating-star` unless set.
|
|
220
|
+
- `--rating-star-outline` — the default star as an outline, ready for `--rating-star-empty`.
|
|
190
221
|
- `--rating-value` — display only: the value shown, fractions allowed.
|
|
191
222
|
- `--rating-max` — display only: the number of stars.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Reveal
|
|
2
|
+
|
|
3
|
+
Reveal fades a block into place on its first render, or the first time it scrolls into view with the in-view runtime.
|
|
4
|
+
|
|
5
|
+
> **Module** — import `actual-css/css/effects/reveal`, plus `actual-css/js/in-view` for the scroll trigger, or the `actual-css/css/effects` and `actual-css/js/full` bundles.
|
|
6
|
+
|
|
7
|
+
```html demo
|
|
8
|
+
<section class="card stack reveal" data-enhance="in-view">
|
|
9
|
+
<h2>Built for actual interfaces</h2>
|
|
10
|
+
<p class="muted">This block fades in once, the first time it scrolls into view.</p>
|
|
11
|
+
</section>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Related terms:** scroll reveal, fade in on scroll, entrance animation, animate on load, hero intro, lazy appearance, on-scroll animation.
|
|
15
|
+
|
|
16
|
+
`.reveal` alone plays its entrance once, when the element is first rendered, with no JavaScript. That suits a hero or an introduction. `data-enhance="in-view"` adds the scroll trigger: an element the observer reports off screen is held hidden with `is-pending` and plays the same entrance when it first enters. An element already visible when the runtime starts keeps its first-render entrance and is never hidden.
|
|
17
|
+
|
|
18
|
+
Without the runtime, everything plays on load and ends visible. Under reduced motion or in print nothing moves and nothing is hidden.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Try the [Appearance effects catalogue](../../demo/templates/appearance.html#reveal)
|
|
23
|
+
to compare entrances, adjust the viewing speed, and replay staggered groups.
|
|
24
|
+
|
|
25
|
+
- Use `.reveal` alone for content in the first screen; add `data-enhance="in-view"` for content below the fold.
|
|
26
|
+
- Load the runtime with `actual-css/js/full`, or register only `actual-css/js/in-view`.
|
|
27
|
+
- Do not combine `.reveal` with another animated class on the same element, such as `.shimmer` or `.spinner`: one `animation` replaces the other. Nest one inside the other instead. Transitions are unaffected, so `.reveal` can sit on a `.btn` or a card.
|
|
28
|
+
- The entrance replays whenever the element is rendered again after `display: none`, for example inside a tab panel or a `[hidden]` toggle. Keep Reveal outside content that toggles if the replay is unwanted.
|
|
29
|
+
- Put the effect on the content box rather than a section with generous leading padding: the observer triggers when the box enters, including its padding.
|
|
30
|
+
|
|
31
|
+
See [In view](../enhancements/in-view.md) for trigger margins, pending state,
|
|
32
|
+
and immediate appearance on keyboard focus.
|
|
33
|
+
|
|
34
|
+
## Staggered groups
|
|
35
|
+
|
|
36
|
+
Put `.reveal-group` on the container instead of `.reveal`. The direct children appear one after another. The delay comes from `sibling-index()`, capped at eight steps so a long list settles instead of cascading forever.
|
|
37
|
+
|
|
38
|
+
```html demo
|
|
39
|
+
<ul class="cluster reveal-group" data-enhance="in-view">
|
|
40
|
+
<li class="card">First</li>
|
|
41
|
+
<li class="card">Second</li>
|
|
42
|
+
<li class="card">Third</li>
|
|
43
|
+
</ul>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
An engine without `sibling-index()` drops the delay declaration and reveals the whole group at once. That is the intended degradation, not a fallback to author.
|
|
47
|
+
|
|
48
|
+
The group itself is the observed element; its children carry the motion and need no token of their own.
|
|
49
|
+
|
|
50
|
+
### Hooks
|
|
51
|
+
|
|
52
|
+
- `--reveal-duration` — entrance duration for one element or one group child.
|
|
53
|
+
- `--reveal-distance` — vertical offset the content travels while appearing.
|
|
54
|
+
- `--reveal-stagger` — delay between two consecutive children of `.reveal-group`; it also scales the cap, which stays at eight steps.
|
|
@@ -25,8 +25,9 @@ looks busy. Assistive technology may hold back changes inside a busy region
|
|
|
25
25
|
until it is released.
|
|
26
26
|
|
|
27
27
|
The label rests on `--shimmer-color` and the band passes in
|
|
28
|
-
`--shimmer-highlight`; one pass
|
|
29
|
-
with `.skeleton` and indeterminate
|
|
28
|
+
`--shimmer-highlight`; one pass and the rest after it take
|
|
29
|
+
`--duration-shimmer`, the pace shared with `.skeleton` and indeterminate
|
|
30
|
+
`.progress`. The band crosses in the reading direction. With reduced motion, or in a
|
|
30
31
|
browser without `background-clip: text`, the label is plain
|
|
31
32
|
`--shimmer-color` text. Recolor a label through these hooks: its own `color`
|
|
32
33
|
shows only where the sweep does not run.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# In view
|
|
2
|
+
|
|
3
|
+
In view triggers an appearance effect once when content enters the viewport, for scroll reveals and highlights.
|
|
4
|
+
|
|
5
|
+
> **Module** — import `actual-css/js/in-view`, or the `actual-css/js/full` bundle, plus the CSS for the chosen effect.
|
|
6
|
+
|
|
7
|
+
```html demo
|
|
8
|
+
<section class="card stack reveal" data-enhance="in-view">
|
|
9
|
+
<h2>Make an entrance</h2>
|
|
10
|
+
<p>Scroll to this card to reveal it once.</p>
|
|
11
|
+
</section>
|
|
12
|
+
<p>Keep the <mark class="mark-sweep" data-enhance="in-view">important phrase</mark> in view.</p>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Explore the [Appearance effects catalogue](../../demo/templates/appearance.html)
|
|
18
|
+
for live examples, replay controls, and site-defined transition recipes.
|
|
19
|
+
|
|
20
|
+
- Put `data-enhance="in-view"` on the element whose box should trigger the effect.
|
|
21
|
+
- Pair it with [Reveal](../components/reveal.md) for a block or staggered group, or [Mark sweep](../components/mark-sweep.md) for a highlighted phrase.
|
|
22
|
+
- Load the matching effect CSS: `actual-css/css/effects/reveal`, `actual-css/css/effects/mark-sweep`, or the `actual-css/css/effects` bundle.
|
|
23
|
+
- Leave `is-pending` to the runtime; do not add it to the markup.
|
|
24
|
+
|
|
25
|
+
The runtime adds `is-pending` only when its first observation reports the
|
|
26
|
+
element outside the viewport. It removes the class on first entry and stops
|
|
27
|
+
observing that element. Scrolling away and back does not replay the trigger.
|
|
28
|
+
CSS owns the appearance of the pending state and the entrance effect.
|
|
29
|
+
|
|
30
|
+
Content already visible when the runtime starts is never made pending.
|
|
31
|
+
Reveal keeps its CSS first-render entrance; Mark sweep keeps its full highlight.
|
|
32
|
+
For a staggered reveal, put `.reveal-group` and the token on the container;
|
|
33
|
+
the children need no token of their own.
|
|
34
|
+
|
|
35
|
+
## Custom effects
|
|
36
|
+
|
|
37
|
+
Use `in-view` with a site-defined class to create a custom scroll animation.
|
|
38
|
+
No built-in effect CSS is required: the runtime only manages `is-pending`.
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<section class="site-arrival" data-enhance="in-view">
|
|
42
|
+
<h2>Your own entrance</h2>
|
|
43
|
+
</section>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Keep the base state visible. Declare transitions on that state and the starting
|
|
47
|
+
appearance on `.is-pending`, inside the motion media query:
|
|
48
|
+
|
|
49
|
+
```css
|
|
50
|
+
@media screen and (prefers-reduced-motion: no-preference) {
|
|
51
|
+
.site-arrival {
|
|
52
|
+
transition: opacity 600ms ease-out, translate 600ms ease-out;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.site-arrival.is-pending {
|
|
56
|
+
opacity: 0;
|
|
57
|
+
translate: 0 1rem;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The site owns the duration, easing, delay, and visual effect. Content already
|
|
63
|
+
in view stays in its base state; this transition runs only after a pending
|
|
64
|
+
element is released.
|
|
65
|
+
|
|
66
|
+
Use opacity and motion for the pending appearance; keep content in the
|
|
67
|
+
accessibility tree and tab order. Avoid `display: none` and `visibility: hidden`.
|
|
68
|
+
When focus enters pending content, the runtime finishes the finite animations
|
|
69
|
+
and transitions started by its release, including custom effects.
|
|
70
|
+
|
|
71
|
+
## Application-controlled replay
|
|
72
|
+
|
|
73
|
+
After the first release, the runtime no longer observes the element. The
|
|
74
|
+
application can replay its effect independently, without re-registering
|
|
75
|
+
`in-view` or changing `data-enhance`.
|
|
76
|
+
|
|
77
|
+
For a CSS animation, add `is-pending`, call `element.getAnimations()` to flush
|
|
78
|
+
the starting state, then remove `is-pending`. The pending rule must remove the
|
|
79
|
+
animation, as Reveal's does. For a transition, also disable transitions during
|
|
80
|
+
the reset so the effect starts from its initial appearance immediately; restore
|
|
81
|
+
them when releasing the state. Keep focused content visible during replay.
|
|
82
|
+
|
|
83
|
+
## Trigger margin
|
|
84
|
+
|
|
85
|
+
Set `data-in-view-margin` to adjust when pending content enters. The value uses
|
|
86
|
+
`IntersectionObserver.rootMargin` syntax: one to four lengths in `px` or `%`.
|
|
87
|
+
A negative bottom margin delays the trigger until the box has moved farther
|
|
88
|
+
into the viewport; a positive one starts it before the box reaches the bottom.
|
|
89
|
+
The margin affects the entrance trigger, while initially visible content stays
|
|
90
|
+
visible.
|
|
91
|
+
|
|
92
|
+
```html
|
|
93
|
+
<section class="reveal" data-enhance="in-view" data-in-view-margin="0px 0px -64px 0px">
|
|
94
|
+
<h2>A later entrance</h2>
|
|
95
|
+
</section>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The observed box includes its padding. Put the effect on the content box when
|
|
99
|
+
a surrounding section has generous leading padding.
|
|
100
|
+
|
|
101
|
+
## Accessibility and fallback
|
|
102
|
+
|
|
103
|
+
Pending content remains in the accessibility tree and tab order. When focus
|
|
104
|
+
enters it, the runtime releases it immediately and finishes the entrance so
|
|
105
|
+
the focused control is visible without waiting for motion.
|
|
106
|
+
|
|
107
|
+
Without JavaScript or `IntersectionObserver`, nothing becomes pending:
|
|
108
|
+
Reveal plays on first render and Mark sweep shows its full highlight.
|
|
109
|
+
Both effects remain visible without motion under reduced motion and in print.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Progressive enhancements
|
|
2
2
|
|
|
3
|
-
> The optional JavaScript runtime
|
|
3
|
+
> The optional JavaScript runtime adds interaction and viewport appearance triggers to semantic markup and CSS components.
|
|
4
4
|
|
|
5
5
|
UI components need JavaScript or modern platform behavior to be complete. They
|
|
6
6
|
follow the same principles as every component: semantic markup first, small
|
|
@@ -56,5 +56,6 @@ after opening. The runtime warns in the console when a second copy loads.
|
|
|
56
56
|
|
|
57
57
|
Each interactive component has its own page documenting the exact markup its
|
|
58
58
|
enhancement expects: Dialog, Drawer, Flyout, Tooltip, Tabs, Scrollspy, and
|
|
59
|
-
Status bar.
|
|
59
|
+
Status bar. [In view](in-view.md) documents the shared viewport trigger for
|
|
60
|
+
Reveal and Mark sweep. The full runtime is loaded on the docs pages, so the examples
|
|
60
61
|
work with the documented markup alone.
|
|
@@ -19,7 +19,7 @@ or style `[aria-current="location"]` yourself.
|
|
|
19
19
|
- `.scrollspy` marks the region for JS detection. It does not add visual styles.
|
|
20
20
|
- `.nav-list` and `.nav-link` provide the visible list and active link styling.
|
|
21
21
|
- The JS enhancer toggles `aria-current="location"` on the active link. Without JavaScript, the links remain regular anchor links.
|
|
22
|
-
-
|
|
22
|
+
- The active section is the last heading past the activation line. Over the final viewport of scroll travel, the line advances to the bottom so short trailing sections become active in order. Above the first section, no link is active.
|
|
23
23
|
- `data-scrollspy-root="#container"` measures a scroll container instead of the viewport.
|
|
24
24
|
- `data-scrollspy-offset` moves the activation line: a bare number or `px` value is pixels, a `%` value is a share of the root's visible height. Invalid values fall back to `20%`, and negatives clamp to `0`.
|
|
25
25
|
- The same markup also works with the CSS-native scroll markers path (see below).
|
|
@@ -56,16 +56,16 @@ without JavaScript.
|
|
|
56
56
|
|
|
57
57
|
```css
|
|
58
58
|
@supports selector(:target-current) {
|
|
59
|
-
.scrollspy {
|
|
59
|
+
.scrollspy:not(:has([aria-current="location"])) {
|
|
60
60
|
scroll-target-group: auto;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.scrollspy a:target-current {
|
|
63
|
+
.scrollspy:not(:has([aria-current="location"])) a:target-current {
|
|
64
64
|
color: var(--primary);
|
|
65
65
|
font-weight: var(--font-weight-medium);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
The native group yields while JavaScript marks a current location, so only one
|
|
71
|
+
link is active. The same markup serves both paths.
|
|
@@ -53,12 +53,15 @@ One mechanism at a time, with its contract and its pitfalls.
|
|
|
53
53
|
|
|
54
54
|
### System benches
|
|
55
55
|
|
|
56
|
-
Contracts you cannot read off a static screenshot: state, motion, focus,
|
|
57
|
-
extension points.
|
|
56
|
+
Contracts you cannot read off a static screenshot: state, motion, focus, contrast,
|
|
57
|
+
and extension points.
|
|
58
58
|
|
|
59
59
|
- [Contrast contexts](../../demo/templates/contrast-contexts.html) - the page, `data-theme` islands, a card island, a named theme and an application-painted band side by side, with every intent variant, a full form (combobox and date picker included) and focus line measured live, plus joined fields that need no focus adaptation
|
|
60
60
|
- [Presence motion](../../demo/templates/motion.html) - status bar, tooltip, flyout, modal and drawer replayed side by side, with easing swaps and a reduced-motion simulation
|
|
61
|
+
- [Appearance effects](../../demo/templates/appearance.html) - scroll reveals, staggered groups, highlight sweeps, and site-defined transitions with replay, slow motion, and source recipes
|
|
61
62
|
- [Keyboard controls](../../demo/templates/keyboard-controls.html) - hands-on keyboard support matrix and focus test bench
|
|
63
|
+
- [Focus bench](../../demo/templates/focus-bench.html) - library focus on links, cards, button variants and validation alternatives, with surface and theme-island switches and a live data-grid inspector
|
|
64
|
+
- [Border contrast lab](../../demo/templates/border-contrast.html) - `--border-control` at 25, 35 and 45 % of ink in both schemes and on two surfaces, with the edge measured live against the control fill and the panel, the theme-boundary trap, and how to soften the result
|
|
62
65
|
- [Adaptive filter surface](../../demo/templates/adaptive-surface.html) - app-level flyout/drawer composition with one synchronized filter state
|
|
63
66
|
- [Select intents](../../demo/templates/select-intents.html) - extending the enhancer with a project's own `data-enhance` behavior, injected markup included, with no framework change
|
|
64
67
|
- [Popover transport probe](../../demo/templates/popover-transport.html) - self-scoring bench for the native popover transport go/no-go
|
|
@@ -71,14 +71,15 @@ date-calendar {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.dp-picker-panel[popover] {
|
|
74
|
+
border-width: var(--border-width);
|
|
74
75
|
box-shadow: var(--shadow-popout);
|
|
75
76
|
}
|
|
76
77
|
```
|
|
77
78
|
|
|
78
79
|
The picker draws focus as an inset line, like the core, so `--dp-focus` and
|
|
79
80
|
`--dp-focus-width` are the whole focus mapping; the field itself is a plain
|
|
80
|
-
`.input` and keeps the core outline. The panel has no shadow
|
|
81
|
-
`--shadow-popout` directly. It opens as a popover, in the top layer,
|
|
81
|
+
`.input` and keeps the core outline. The panel has no shadow or border-width
|
|
82
|
+
token, so it takes `--shadow-popout` and `--border-width` directly. It opens as a popover, in the top layer,
|
|
82
83
|
so inside a modal, even in a scrolling body, it is neither clipped nor stacked
|
|
83
84
|
under the dialog. The calendar popup is its own
|
|
84
85
|
element, so the `--dp-*` map is declared on `date-picker`/`date-calendar` rather
|