actual-css 0.17.1 → 0.19.0
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 +87 -0
- package/README.md +10 -6
- package/components.json +26 -6
- package/dist/actual.full.css +484 -76
- 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 +6 -1
- package/docs/navigation.json +4 -0
- package/docs/pages/components/alert.md +8 -6
- package/docs/pages/components/aura.md +3 -0
- package/docs/pages/components/button.md +26 -24
- package/docs/pages/components/list.md +117 -29
- 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/components/timeline.md +130 -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 +7 -2
- package/docs/pages/forms/date-picker.md +3 -2
- package/docs/pages/forms/switch.md +25 -16
- package/docs/pages/foundations/theming.md +6 -4
- package/docs/pages/foundations/tokens.md +39 -16
- package/docs/pages/foundations/typography.md +13 -2
- package/docs/pages/guides/coding-agents.md +163 -0
- package/docs/pages/guides/introduction.md +1 -1
- package/docs/pages/guides/modular-import.md +1 -1
- package/docs/pages/guides/progressive-enhancement.md +2 -1
- package/docs/pages/guides/upgrading.md +2 -2
- package/docs/pages/layout/scroll-snap.md +26 -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 +3 -2
- package/package.json +3 -1
- package/reserved-classes.json +6 -0
- package/skills/actual-css/PROJECT.md.example +13 -2
- package/skills/actual-css/README.md +5 -0
- package/skills/actual-css/SKILL.md +13 -2
- package/src/css/components/alert.css +40 -3
- package/src/css/components/button.css +20 -2
- package/src/css/components/join.css +3 -10
- package/src/css/components/list.css +32 -0
- 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/components/timeline.css +113 -10
- 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 +8 -11
- 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/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/design-components.js +2 -2
- package/src/tooling/design-tokens.js +2 -0
- package/tokens.json +2 -0
|
@@ -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.
|
|
@@ -38,7 +38,7 @@ the version beside the rail, see the
|
|
|
38
38
|
</ol>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
The dot
|
|
41
|
+
The dot centres on the first line box of the event, whether it opens with the
|
|
42
42
|
`<time>` or with text. Block children drop their margins; wrap the content in
|
|
43
43
|
a [`.stack`](../layout/stack.md) when an event needs more spacing.
|
|
44
44
|
|
|
@@ -69,7 +69,13 @@ The color is decoration: write the state in the text too.
|
|
|
69
69
|
|
|
70
70
|
An [`.avatar`](avatar.md) or an `aria-hidden` icon written first in the `<li>`
|
|
71
71
|
replaces the dot. One such event widens the rail for the whole list, so dots
|
|
72
|
-
and slots stay aligned. An icon sits in a disc
|
|
72
|
+
and slots stay aligned. An icon sits in a disc; the event's intent tints it
|
|
73
|
+
like a soft badge.
|
|
74
|
+
|
|
75
|
+
Dots, discs and avatars share the same alignment with the first line box.
|
|
76
|
+
For an off-centre icon, wrap the glyph in an `aria-hidden` slot and apply a
|
|
77
|
+
local `translate` to the inner glyph. Keep the disc in place:
|
|
78
|
+
`--timeline-marker-nudge` moves the whole marker and its rail geometry.
|
|
73
79
|
|
|
74
80
|
```html demo
|
|
75
81
|
<ol class="timeline">
|
|
@@ -90,6 +96,125 @@ and slots stay aligned. An icon sits in a disc colored by the event's intent.
|
|
|
90
96
|
</ol>
|
|
91
97
|
```
|
|
92
98
|
|
|
99
|
+
## Dates at the end
|
|
100
|
+
|
|
101
|
+
`.timeline-dates-end` moves each `<time>` to the end of the event's first
|
|
102
|
+
line, so the titles lead and the dates line up in a column on the right.
|
|
103
|
+
Write the `<time>` first in the event, as usual.
|
|
104
|
+
|
|
105
|
+
It suits a narrow container: a sidebar, a card, a side panel. In a wide
|
|
106
|
+
column the dates drift away from their titles; cap the list's width or keep
|
|
107
|
+
the default dateline.
|
|
108
|
+
|
|
109
|
+
```html demo
|
|
110
|
+
<section class="card" style="--card-max-inline-size: 28rem">
|
|
111
|
+
<ol class="timeline timeline-dates-end">
|
|
112
|
+
<li class="success">
|
|
113
|
+
<i class="ti ti-check" aria-hidden="true"></i>
|
|
114
|
+
<time datetime="2026-11-11T09:40">09:40</time>
|
|
115
|
+
<strong>Results available</strong>
|
|
116
|
+
<p class="muted">Reviewed by the attending physician.</p>
|
|
117
|
+
</li>
|
|
118
|
+
<li class="primary">
|
|
119
|
+
<i class="ti ti-flask" aria-hidden="true"></i>
|
|
120
|
+
<time datetime="2026-11-11T08:15">08:15</time>
|
|
121
|
+
<strong>Sample sent to the lab</strong>
|
|
122
|
+
</li>
|
|
123
|
+
<li>
|
|
124
|
+
<i class="ti ti-message" aria-hidden="true"></i>
|
|
125
|
+
<time datetime="2026-11-10">Yesterday</time>
|
|
126
|
+
<strong>Patient asked a question</strong>
|
|
127
|
+
<p class="muted">Should I fast before the blood test?</p>
|
|
128
|
+
</li>
|
|
129
|
+
<li>
|
|
130
|
+
<i class="ti ti-calendar-plus" aria-hidden="true"></i>
|
|
131
|
+
<time datetime="2026-11-03">Nov 3</time>
|
|
132
|
+
<strong>Appointment booked</strong>
|
|
133
|
+
</li>
|
|
134
|
+
</ol>
|
|
135
|
+
</section>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### In progress
|
|
139
|
+
|
|
140
|
+
For an event still running (an import, a sync, an upload), put a
|
|
141
|
+
[`.spinner`](spinner.md) inside the icon slot. The disc stays still and the
|
|
142
|
+
spinner takes the event's intent. A bare `.spinner` as the slot would lose its
|
|
143
|
+
own border to the disc's. Say the state in the text, since the slot is hidden
|
|
144
|
+
from assistive technology.
|
|
145
|
+
|
|
146
|
+
```html demo
|
|
147
|
+
<section class="card" style="--card-max-inline-size: 28rem">
|
|
148
|
+
<ol class="timeline timeline-dates-end">
|
|
149
|
+
<li class="warning">
|
|
150
|
+
<span aria-hidden="true"><span class="spinner"></span></span>
|
|
151
|
+
<time datetime="2026-11-11T10:00">Just now</time>
|
|
152
|
+
<strong>Importing</strong> <code>batch-118</code>
|
|
153
|
+
<p class="muted">Patient records from the March export</p>
|
|
154
|
+
</li>
|
|
155
|
+
<li class="success">
|
|
156
|
+
<i class="ti ti-check" aria-hidden="true"></i>
|
|
157
|
+
<time datetime="2026-11-11T09:40">20 min ago</time>
|
|
158
|
+
<strong>Imported</strong> <code>batch-117</code>
|
|
159
|
+
<p class="muted">Invoices for the second quarter</p>
|
|
160
|
+
</li>
|
|
161
|
+
<li class="danger">
|
|
162
|
+
<i class="ti ti-x" aria-hidden="true"></i>
|
|
163
|
+
<time datetime="2026-11-11T08:00">2 h ago</time>
|
|
164
|
+
<strong>Failed</strong> <code>batch-116</code>
|
|
165
|
+
<p class="muted">Lab results, 3 files · <a href="#">Open the error report</a></p>
|
|
166
|
+
</li>
|
|
167
|
+
</ol>
|
|
168
|
+
</section>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Activity feed
|
|
172
|
+
|
|
173
|
+
Avatars as markers, the actor and verb as one sentence, and richer content
|
|
174
|
+
below: a [`.chat-bubble`](chat.md) for a comment, a [`.badge`](badge.md) for
|
|
175
|
+
a status, a [`.btn`](button.md) for a file. A [`.stack`](../layout/stack.md)
|
|
176
|
+
spaces the sentence from what follows; the `<time>` stays a direct child of
|
|
177
|
+
the `<li>`.
|
|
178
|
+
|
|
179
|
+
```html demo
|
|
180
|
+
<section class="card" style="--card-max-inline-size: 28rem">
|
|
181
|
+
<ol class="timeline timeline-dates-end">
|
|
182
|
+
<li>
|
|
183
|
+
<span class="avatar primary"><abbr>NK</abbr></span>
|
|
184
|
+
<time datetime="2026-11-11T09:55">5 min ago</time>
|
|
185
|
+
<div class="stack">
|
|
186
|
+
<p><a href="#">Noah Keller</a> <span class="muted">commented</span></p>
|
|
187
|
+
<p class="chat-bubble">Could we move the follow-up to Thursday morning?</p>
|
|
188
|
+
</div>
|
|
189
|
+
</li>
|
|
190
|
+
<li>
|
|
191
|
+
<span class="avatar"><abbr>IR</abbr></span>
|
|
192
|
+
<time datetime="2026-11-11T09:20">40 min ago</time>
|
|
193
|
+
<a href="#">Inès Roy</a> <span class="muted">set the status to</span>
|
|
194
|
+
<span class="badge soft primary">Confirmed</span>
|
|
195
|
+
</li>
|
|
196
|
+
<li>
|
|
197
|
+
<span class="avatar"><abbr>TB</abbr></span>
|
|
198
|
+
<time datetime="2026-11-11T08:00">2 h ago</time>
|
|
199
|
+
<div class="stack">
|
|
200
|
+
<p><a href="#">Tom Becker</a> <span class="muted">attached a file</span></p>
|
|
201
|
+
<p>
|
|
202
|
+
<a class="btn surface sm" href="#">
|
|
203
|
+
<i class="ti ti-file" aria-hidden="true"></i>
|
|
204
|
+
intake-form.pdf <span class="muted">180 KB</span>
|
|
205
|
+
</a>
|
|
206
|
+
</p>
|
|
207
|
+
</div>
|
|
208
|
+
</li>
|
|
209
|
+
<li>
|
|
210
|
+
<span class="avatar"><abbr>CL</abbr></span>
|
|
211
|
+
<time datetime="2026-11-09">Monday</time>
|
|
212
|
+
<a href="#">Chloé Laurent</a> <span class="muted">opened the case</span>
|
|
213
|
+
</li>
|
|
214
|
+
</ol>
|
|
215
|
+
</section>
|
|
216
|
+
```
|
|
217
|
+
|
|
93
218
|
## Density
|
|
94
219
|
|
|
95
220
|
The gap between events follows the density context: `.compact` and
|
|
@@ -108,6 +233,9 @@ The gap between events follows the density context: `.compact` and
|
|
|
108
233
|
- `--timeline-dot-size` — dot diameter.
|
|
109
234
|
- `--timeline-slot-size` — avatar and icon diameter; the rail takes this width
|
|
110
235
|
as soon as one event has a slot.
|
|
236
|
+
- `--timeline-glyph-size` — icon and spinner size in a slot; half the slot.
|
|
111
237
|
- `--timeline-gap` — space between events; follows `--density-space`.
|
|
112
238
|
- `--timeline-inline-gap` — space between the rail and the content.
|
|
113
239
|
- `--timeline-line-size` — rail line thickness.
|
|
240
|
+
- `--timeline-marker-nudge` — correction to the whole marker's centring on the
|
|
241
|
+
first line box; an `em` resolves against the event's text size.
|
|
@@ -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.
|
|
@@ -49,19 +49,24 @@ One mechanism at a time, with its contract and its pitfalls.
|
|
|
49
49
|
- [Grid density](../../demo/templates/grid.html) - the grid contracts on resizable stages, with the pitfalls called out
|
|
50
50
|
- [Column layout](../../demo/templates/column-layout.html) - the twelve-column canvas: spans, starts, and the narrow-container recomposition the framework leaves to the application
|
|
51
51
|
- [Density](../../demo/templates/density.html) - compact control density
|
|
52
|
+
- [Alert icon alignment](../../demo/templates/alerts.html) - the leading icon against the first line box: icon sources, icon sets, text fonts, text sizes, line heights, icon sizes, message shapes, variants and the neo-brutalist tile, with optional box guides
|
|
52
53
|
|
|
53
54
|
### System benches
|
|
54
55
|
|
|
55
|
-
Contracts you cannot read off a static screenshot: state, motion, focus,
|
|
56
|
-
extension points.
|
|
56
|
+
Contracts you cannot read off a static screenshot: state, motion, focus, contrast,
|
|
57
|
+
and extension points.
|
|
57
58
|
|
|
58
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
|
|
59
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
|
|
60
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
|
|
61
65
|
- [Adaptive filter surface](../../demo/templates/adaptive-surface.html) - app-level flyout/drawer composition with one synchronized filter state
|
|
62
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
|
|
63
67
|
- [Popover transport probe](../../demo/templates/popover-transport.html) - self-scoring bench for the native popover transport go/no-go
|
|
64
68
|
- [Card rail](../../demo/templates/card-rail.html) - one list as a 3-column grid in a wide container and a scroll-snap rail with a peek and CSS scroll markers in a narrow one
|
|
69
|
+
- [Carousel](../../demo/templates/carousel.html) - a hero carousel from one scroll-snap list: full-width slides, native scroll buttons for previous and next, and scroll markers as dots, with a swipe fallback
|
|
65
70
|
- [Playful FAQ](../../demo/templates/playful-faq.html) - the separated accordion with an application palette, a pill plus/close marker and an animated open/close through `::details-content`, no JavaScript
|
|
66
71
|
- [Tooltips](../../demo/templates/tooltips.html) - generated text is a snapshot at show time: what updates, what stays, and the explicit-tip way for dynamic content
|
|
67
72
|
|
|
@@ -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
|
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
> Toggle controls that share a native checkbox at the markup level, with a switch visual.
|
|
4
4
|
|
|
5
|
-
- The API is `class="switch"`. Use `role="switch"` for ARIA correctness.
|
|
6
|
-
- The visual state tracks the native `checked` attribute. No JavaScript is required.
|
|
7
|
-
- For strict ARIA correctness, keep `aria-checked` in sync. This is an enhancement, not the baseline.
|
|
8
|
-
|
|
9
5
|
```html demo
|
|
10
|
-
|
|
11
|
-
<input class="switch" type="checkbox" role="switch" checked />
|
|
6
|
+
<label class="choice">
|
|
7
|
+
<input class="switch" type="checkbox" role="switch" checked />
|
|
8
|
+
<span>Notifications</span>
|
|
9
|
+
</label>
|
|
12
10
|
```
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
- Apply `class="switch"` to a native checkbox and `role="switch"` for on/off semantics.
|
|
15
|
+
- Give it an accessible name through a label or `aria-label`.
|
|
16
|
+
- Use `checked` for the initial state and `.checked` to change it in JavaScript.
|
|
17
|
+
|
|
18
|
+
The browser exposes the native checked state to assistive technology; do not
|
|
19
|
+
add `aria-checked` or a change handler to synchronize it. The
|
|
20
|
+
[WAI-ARIA switch pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/)
|
|
21
|
+
uses the native checked state for checkbox inputs.
|
|
23
22
|
|
|
24
23
|
Wrap a switch in `.choice` to pair it with a label. The switch stays
|
|
25
24
|
top-aligned with the first line of text, so labels that wrap onto two lines —
|
|
@@ -58,6 +57,13 @@ naturally or via an explicit line break — still sit cleanly.
|
|
|
58
57
|
</label>
|
|
59
58
|
```
|
|
60
59
|
|
|
60
|
+
## Notification preferences
|
|
61
|
+
|
|
62
|
+
For a notification matrix with two switch columns (email and push), see the
|
|
63
|
+
[notification preferences composition](../../demo/templates/blocks.html#notification-preferences).
|
|
64
|
+
Use native table headers for the shared rows and columns, and give each switch
|
|
65
|
+
an accessible name that includes both its topic and channel.
|
|
66
|
+
|
|
61
67
|
## Sizing and alignment
|
|
62
68
|
|
|
63
69
|
A switch is sized off the control typography, not field density. Its track
|
|
@@ -125,7 +131,10 @@ same optical line. Change the type or the control size and they stay level:
|
|
|
125
131
|
</div>
|
|
126
132
|
```
|
|
127
133
|
|
|
128
|
-
|
|
134
|
+
### Hooks
|
|
135
|
+
|
|
136
|
+
- `--switch-bg` — track fill; `--switch-border` follows it unless overridden.
|
|
137
|
+
- `--switch-border` — optional distinct edge; validation takes precedence.
|
|
129
138
|
|
|
130
139
|
- `--choice-control-size` — shared size for inline choices; the switch track is
|
|
131
140
|
this plus `0.125em`, so scaling it scales the checkbox and the switch together.
|