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.
Files changed (76) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +10 -6
  3. package/components.json +26 -6
  4. package/dist/actual.full.css +484 -76
  5. package/dist/actual.full.js +2 -2
  6. package/dist/actual.full.min.css +1 -1
  7. package/docs/design-notes/enhancement-contract.md +20 -11
  8. package/docs/design-notes/motion-cost.md +62 -0
  9. package/docs/design-notes/tokens.md +6 -1
  10. package/docs/navigation.json +4 -0
  11. package/docs/pages/components/alert.md +8 -6
  12. package/docs/pages/components/aura.md +3 -0
  13. package/docs/pages/components/button.md +26 -24
  14. package/docs/pages/components/list.md +117 -29
  15. package/docs/pages/components/mark-sweep.md +42 -0
  16. package/docs/pages/components/rating.md +53 -22
  17. package/docs/pages/components/reveal.md +54 -0
  18. package/docs/pages/components/shimmer.md +3 -2
  19. package/docs/pages/components/timeline.md +130 -2
  20. package/docs/pages/enhancements/in-view.md +109 -0
  21. package/docs/pages/enhancements/overview.md +3 -2
  22. package/docs/pages/enhancements/scrollspy.md +5 -5
  23. package/docs/pages/examples/overview.md +7 -2
  24. package/docs/pages/forms/date-picker.md +3 -2
  25. package/docs/pages/forms/switch.md +25 -16
  26. package/docs/pages/foundations/theming.md +6 -4
  27. package/docs/pages/foundations/tokens.md +39 -16
  28. package/docs/pages/foundations/typography.md +13 -2
  29. package/docs/pages/guides/coding-agents.md +163 -0
  30. package/docs/pages/guides/introduction.md +1 -1
  31. package/docs/pages/guides/modular-import.md +1 -1
  32. package/docs/pages/guides/progressive-enhancement.md +2 -1
  33. package/docs/pages/guides/upgrading.md +2 -2
  34. package/docs/pages/layout/scroll-snap.md +26 -1
  35. package/docs/pages/patterns/code-block.md +1 -1
  36. package/docs/pages/patterns/empty-state.md +3 -3
  37. package/docs/pages/patterns/exclusive-accordion.md +3 -2
  38. package/docs/pages/patterns/hierarchical-nav.md +5 -4
  39. package/docs/pages/patterns/icon-input.md +1 -1
  40. package/docs/pages/patterns/icon-slot.md +4 -4
  41. package/docs/pages/patterns/intent-nesting.md +2 -3
  42. package/docs/pages/patterns/navigation-list.md +7 -4
  43. package/docs/pages/patterns/stat.md +3 -3
  44. package/docs/pages/patterns/structured-lists.md +1 -2
  45. package/llms.txt +3 -2
  46. package/package.json +3 -1
  47. package/reserved-classes.json +6 -0
  48. package/skills/actual-css/PROJECT.md.example +13 -2
  49. package/skills/actual-css/README.md +5 -0
  50. package/skills/actual-css/SKILL.md +13 -2
  51. package/src/css/components/alert.css +40 -3
  52. package/src/css/components/button.css +20 -2
  53. package/src/css/components/join.css +3 -10
  54. package/src/css/components/list.css +32 -0
  55. package/src/css/components/navbar.css +13 -5
  56. package/src/css/components/rating.css +23 -2
  57. package/src/css/components/scrollspy.css +4 -2
  58. package/src/css/components/timeline.css +113 -10
  59. package/src/css/core/base.css +16 -0
  60. package/src/css/core/focus.css +13 -12
  61. package/src/css/core/reset.css +10 -0
  62. package/src/css/core/theme.css +15 -0
  63. package/src/css/core/tokens.css +8 -11
  64. package/src/css/effects/aura.css +5 -0
  65. package/src/css/effects/index.css +2 -0
  66. package/src/css/effects/mark-sweep.css +64 -0
  67. package/src/css/effects/reveal.css +66 -0
  68. package/src/css/effects/shimmer.css +28 -10
  69. package/src/css/forms/switch.css +9 -9
  70. package/src/js/full.js +1 -0
  71. package/src/js/in-view.js +152 -0
  72. package/src/js/scrollspy.js +81 -2
  73. package/src/js/selectors.js +3 -0
  74. package/src/tooling/design-components.js +2 -2
  75. package/src/tooling/design-tokens.js +2 -0
  76. package/tokens.json +2 -0
@@ -97,6 +97,7 @@
97
97
  "grid-3",
98
98
  "grid-4",
99
99
  "grid-6",
100
+ "grouped",
100
101
  "grow",
101
102
  "had-scrollbar",
102
103
  "has-modal-open",
@@ -108,6 +109,7 @@
108
109
  "input-icon",
109
110
  "intent-color",
110
111
  "is-open",
112
+ "is-pending",
111
113
  "is-static",
112
114
  "items-baseline",
113
115
  "items-center",
@@ -138,6 +140,7 @@
138
140
  "margin-inline-auto",
139
141
  "margin-inline-end-auto",
140
142
  "margin-inline-start-auto",
143
+ "mark-sweep",
141
144
  "max-inline-size-none",
142
145
  "mbe",
143
146
  "mbs",
@@ -191,6 +194,8 @@
191
194
  "range",
192
195
  "rating",
193
196
  "required-mark",
197
+ "reveal",
198
+ "reveal-group",
194
199
  "reverse",
195
200
  "row-gap-context",
196
201
  "scroll-snap",
@@ -255,6 +260,7 @@
255
260
  "textarea",
256
261
  "tight",
257
262
  "timeline",
263
+ "timeline-dates-end",
258
264
  "tooltip",
259
265
  "topbar",
260
266
  "touch-target",
@@ -4,6 +4,8 @@ Copy this file to `PROJECT.md` beside `SKILL.md` and keep only decisions that ar
4
4
 
5
5
  This file narrows **how the application uses Actual CSS**. It does not redefine Actual CSS API.
6
6
 
7
+ Visual direction (mood, color roles, depth, named rules) lives in `DESIGN.md` at the project root, and the shipped values live in the theme stylesheet. Keep only implementation facts here.
8
+
7
9
  ## Imports
8
10
 
9
11
  CSS loaded by this project:
@@ -20,15 +22,24 @@ JavaScript enhancers loaded by this project:
20
22
 
21
23
  ## Theme
22
24
 
23
- Theme root / selector:
25
+ Theme stylesheet and root / selector:
24
26
 
25
27
  ```text
26
28
  TODO
27
29
  ```
28
30
 
29
- Application-owned brand tokens or theme conventions:
31
+ Application-owned tokens derived from the theme:
32
+
33
+ ```text
34
+ - TODO
35
+ ```
36
+
37
+ ## Design mapping
38
+
39
+ Roles named in `DESIGN.md`, expressed with Actual classes and hooks:
30
40
 
31
41
  ```text
42
+ - Primary action → .btn.primary
32
43
  - TODO
33
44
  ```
34
45
 
@@ -39,8 +39,13 @@ SKILL.md + references
39
39
 
40
40
  PROJECT.md
41
41
  -> how this application chooses to use it
42
+
43
+ DESIGN.md (project root, optional)
44
+ -> what this application should look like, and why
42
45
  ```
43
46
 
47
+ `DESIGN.md` follows the [DESIGN.md format](https://github.com/google-labs-code/design.md) and is usually maintained with a design skill such as Impeccable. Actual CSS does not ship one: it has no house style to impose. See the [Coding agents and DESIGN.md](https://lekoala.github.io/actual-css/site/guides/coding-agents.html) guide.
48
+
44
49
  ## Why the skill does not bundle the catalog
45
50
 
46
51
  `components.json`, `reserved-classes.json`, package exports, CSS source, and JS source are intentionally read from the installed Actual CSS version. Copying those files into the skill would create a second, quickly stale API snapshot.
@@ -36,6 +36,16 @@ node <skill>/scripts/inspect-actual-css.mjs --enhancements
36
36
 
37
37
  If `PROJECT.md` exists beside this file, read it after resolving the Actual CSS API. It contains application-specific choices, not framework API.
38
38
 
39
+ ## Design direction
40
+
41
+ If `DESIGN.md` (and `PRODUCT.md`) exists at the project root, read it after `PROJECT.md`. It says what the interface should look like; this skill says how to write it in Actual CSS.
42
+
43
+ - Express its roles through the class mapping in `PROJECT.md` and the decision order below. Never invent a class, variant, or hook to match its wording.
44
+ - `DESIGN.md` records the approved direction; the theme stylesheet defines the values actually shipped. When they disagree, neither wins by default: report the drift and ask whether the design changed on purpose or the code drifted, then update the stale document or fix the theme. Never silently copy a value either way.
45
+ - A product-specific requirement no token, hook, or component expresses is focused application CSS, derived from theme tokens. Report a missing hook only when the need is generic and recurring. Never override a component's internal state or behavior.
46
+
47
+ When a design skill (Impeccable or similar) is active, it owns direction, critique, and `DESIGN.md`; this skill still owns vocabulary and the completion check. Fix its findings through the decision order, confirm computed sizes and colors on the rendered page rather than from a source scan, and never copy its preview snippets (`.impeccable/design.json`) into application code.
48
+
39
49
  ## Decision order
40
50
 
41
51
  Before writing application CSS, ask in this order:
@@ -204,9 +214,10 @@ Useful project-specific additions include:
204
214
  - server-side component/template wrappers already available;
205
215
  - application class naming rules;
206
216
  - stricter browser-support requirements;
207
- - product-specific composition conventions.
217
+ - product-specific composition conventions;
218
+ - the mapping from `DESIGN.md` roles to Actual classes.
208
219
 
209
- Start from `PROJECT.md.example`.
220
+ Start from `PROJECT.md.example`. Visual direction belongs in `DESIGN.md`, not here.
210
221
 
211
222
  Project rules may narrow how Actual CSS is used, but must not invent or redefine Actual CSS public API.
212
223
 
@@ -14,8 +14,10 @@
14
14
  * --alert-pad-block
15
15
  * --alert-pad-inline
16
16
  * --alert-font-size
17
+ * --alert-line-height
17
18
  * --alert-radius
18
19
  * --alert-icon-size
20
+ * --alert-icon-nudge
19
21
  * --alert-border-inline-start-color
20
22
  * --alert-border-inline-start-width
21
23
  *
@@ -42,6 +44,7 @@
42
44
  --alert-pad-block: var(--space-30);
43
45
  --alert-pad-inline: var(--space-40);
44
46
  --alert-font-size: var(--font-size-md);
47
+ --alert-line-height: var(--line-height);
45
48
  --alert-icon-size: 1.25rem;
46
49
  --alert-default-bg: var(--surface-subtle);
47
50
  --alert-default-fg: var(--intent, var(--text));
@@ -59,6 +62,11 @@
59
62
  border-inline-start-width: var(--alert-border-inline-start-width, var(--border-width));
60
63
  border-radius: var(--alert-radius, var(--radius-lg));
61
64
  font-size: var(--alert-font-size);
65
+ /* why: the icon offset below is derived from this line box. Inheriting the
66
+ leading would leave the formula blind to a container that changed it, so
67
+ the alert owns its line height the way it owns its font size; an author
68
+ changing the rhythm sets the hook, not `line-height` directly. */
69
+ line-height: var(--alert-line-height);
62
70
  }
63
71
 
64
72
  /* Density steps the block padding only: the inline padding is the text
@@ -80,7 +88,7 @@
80
88
  siblings instead of a wrapper carrying an inline --gap. What made that pair
81
89
  read as detached is the UA paragraph margin: trimming only the outer edges
82
90
  left it in place between them. Content keeps its own internal rhythm — a
83
- nested list keeps its bullets and padding, a .prose child keeps its flow.
91
+ list keeps its bullets, a .prose child keeps its flow.
84
92
  The slots are excluded because they are anatomy, not content: an
85
93
  admonition's title bar has to stay flush against its body. The list follows
86
94
  the anatomy, so it grows with it. */
@@ -94,6 +102,13 @@
94
102
  margin-block-start: var(--space-10);
95
103
  }
96
104
 
105
+ /* why: the UA indent (40px) set a list's bullets in a column of their own,
106
+ detached from the title above it. The bullets start on the text column's
107
+ edge instead, the way an error summary reads. */
108
+ .alert > :where(ul, ol) {
109
+ padding-inline-start: 1.25em;
110
+ }
111
+
97
112
  /* Alerts are soft by default. The recipe writes local defaults rather than
98
113
  --ui-* so an explicit shared treatment always wins without exclusions. The
99
114
  fill is the translucent soft tint (see badge.css), with no rim unless a
@@ -186,13 +201,25 @@
186
201
  icon sat in the title row alone — any icon taller than one line inflated
187
202
  that row and pushed the body down. Spanning the title and body rows lets
188
203
  its height spread over both; only an icon taller than both together still
189
- splits its excess between them. */
204
+ splits its excess between them. Spanning is also why the icon cannot ride
205
+ the text baseline (align-self: baseline): a baseline group over both
206
+ rows would let a tall icon set the row's baseline, inflating row 1 and
207
+ pushing the title down — the regression alert-anatomy.test.js guards. */
190
208
  .alert:has(> .alert-icon) > .alert-icon {
191
209
  grid-column: 1;
192
210
  grid-row: 1 / span 2;
193
211
  display: inline-grid;
194
212
  place-items: center;
195
- margin-block-start: 0.125em;
213
+ /* The line box's centre is not the cap-height centre: cap/ex cannot derive
214
+ an optical correction from it. Keep glyph corrections explicit.
215
+ --alert-font-size must stay in rem or px because em resolves against
216
+ the icon's own size here. The nudge also accommodates a theme tile whose
217
+ padding and border grow the icon box (neo-brutalist). */
218
+ margin-block-start: calc(
219
+ (var(--alert-line-height) * var(--alert-font-size) - var(--alert-icon-size)) /
220
+ 2 +
221
+ var(--alert-icon-nudge, 0px)
222
+ );
196
223
  }
197
224
 
198
225
  .alert:has(> .alert-icon) > :not(.alert-icon, .close) {
@@ -210,6 +237,11 @@
210
237
  .alert:has(> .close) > .close {
211
238
  grid-column: -2 / -1;
212
239
  grid-row: 1;
240
+ /* why: the button is taller than the line, so top-aligned it sat 2px below
241
+ the title centre, opposite an icon centred on it, and grew row 1, pushing
242
+ the body down. Equal negative margins centre it on the first line box and
243
+ let it overflow into the padding instead; the hit area is unchanged. */
244
+ margin-block: calc((var(--alert-line-height) * var(--alert-font-size) - var(--close-size)) / 2);
213
245
  }
214
246
  /* Links */
215
247
  .alert :where(a:not(.btn)) {
@@ -261,6 +293,11 @@
261
293
  border-start-end-radius: calc(var(--alert-radius, var(--radius-lg)) - var(--border-width));
262
294
  }
263
295
 
296
+ /* Translate preserves the title bar's flex geometry when nudging a glyph. */
297
+ .alert.admonition > .alert-title > .alert-icon {
298
+ translate: 0 var(--alert-icon-nudge, 0px);
299
+ }
300
+
264
301
  /* Close inside an admonition title bar rides the inline end. */
265
302
  .alert.admonition > .alert-title > .close {
266
303
  margin-inline-start: auto;
@@ -122,8 +122,26 @@
122
122
  --ui-border: transparent;
123
123
  }
124
124
 
125
- /* Solid keeps the overlay darkening on hover; soft/outline/ghost/link stay
126
- flat. The soft hover is its own fill change (--soft-hover-alpha) — a second
125
+ /* A neutral outline is a quiet action, so its edge is the control edge that
126
+ identifies a field, not the full text ink. An explicit intent still wins
127
+ through --intent, and --border-control stays the theme's override point. */
128
+ .btn.outline {
129
+ --ui-border: var(--intent, var(--border-control));
130
+ }
131
+
132
+ /* A surface button is neutral chrome, so it hovers at the .outline rate: an
133
+ opaque mix keeps its fill (--ui-bg, so an author override follows), and ink
134
+ rather than a black wash stays visible on a dark page. Without color-mix()
135
+ the solid overlay is the fallback. */
136
+ @supports (color: color-mix(in oklab, red, white)) {
137
+ .btn.surface {
138
+ --ui-hover-bg: color-mix(in oklab, var(--ui-bg) 90%, var(--intent, var(--text)));
139
+ --btn-hover-overlay: transparent;
140
+ }
141
+ }
142
+
143
+ /* Solid keeps the overlay darkening on hover. The recipes below keep their
144
+ fill: the soft hover is its own fill change (--soft-hover-alpha) — a second
127
145
  overlay on top would double the fill step and drag its ink below the resting
128
146
  contrast on every intent. Routed through a variable instead of a
129
147
  :not(.outline, .ghost, .link) exclusion so the hover rule below only has to
@@ -151,13 +151,6 @@
151
151
 
152
152
  /* Text controls paint their own inset focus outline (control.css), so a
153
153
  .join never moves the ring to the group: button-only groups and wrapped
154
- inputs alike keep per-control focus, with no :has() group treatment. */
155
-
156
- /* A default outline action belongs to the composite field border. An explicit
157
- intent still provides its own outline color — --intent is guaranteed-invalid
158
- for a neutral button (the :where(.btn) boundary), so the fallback applies.
159
- The second :has() covers a control nested one wrapper level deep. */
160
- .join:has(> :is(.input, .textarea, .select)) > .btn.outline,
161
- .join:has(> * > :is(.input, .textarea, .select)) > .btn.outline {
162
- --btn-border-color: var(--intent, var(--border-control));
163
- }
154
+ inputs alike keep per-control focus, with no :has() group treatment.
155
+ A neutral outline action draws the same --border-control edge as the field
156
+ by its own base rule, so the group needs no special case. */
@@ -11,6 +11,7 @@
11
11
  * --list-item-pad-inline
12
12
  * --list-item-gap
13
13
  * --list-divider
14
+ * --list-radius
14
15
  */
15
16
  .list {
16
17
  --list-item-min-size: var(--control-size-lg);
@@ -32,6 +33,37 @@
32
33
  margin: 0;
33
34
  }
34
35
 
36
+ /*
37
+ * Grouped — the list owns a raised surface for rows that stand alone: a
38
+ * settings group, a member list, an active-sessions panel. A bare list (the
39
+ * default) leaves the surface to its container, so the shell is opt-in.
40
+ *
41
+ * The shell replaces the leading divider with its own border. It is not a
42
+ * scroll container: a row flyout must be able to escape it. The first and last
43
+ * rows carry the matching corner radius directly instead, which keeps a hover
44
+ * or current fill inside the shell without clipping the panel.
45
+ */
46
+ .list.grouped {
47
+ --list-item-pad-inline: var(--space-40);
48
+ --list-radius: var(--radius-lg);
49
+
50
+ border: var(--border-width) solid var(--border);
51
+ border-radius: var(--list-radius);
52
+ background: var(--surface-raised);
53
+ }
54
+
55
+ /* A row's fill sits inside the shell's border box, so its inner radius is the
56
+ shell radius minus that border — and never negative on a square theme. */
57
+ .list.grouped > :where(li:first-child > .list-item, .list-item:first-child) {
58
+ border-start-start-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
59
+ border-start-end-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
60
+ }
61
+
62
+ .list.grouped > :where(li:last-child > .list-item, .list-item:last-child) {
63
+ border-end-start-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
64
+ border-end-end-radius: max(0px, calc(var(--list-radius) - var(--border-width)));
65
+ }
66
+
35
67
  /*
36
68
  * Flex, not a three-track grid: the leading and trailing regions are optional,
37
69
  * and a fixed `auto minmax(0, 1fr) auto` template gives an absent region a
@@ -10,10 +10,12 @@
10
10
  * Public hooks:
11
11
  * --nav-current-bg (fallback-only: current-link fill)
12
12
  * --nav-current-fg (fallback-only: current-link ink)
13
- * --nav-list-indent (fallback-only: nested .nav-list inset)
13
+ * --nav-list-icon-size (fallback-only: leading icon width the nested rail centres on)
14
+ * --nav-list-rail-color (fallback-only: transparent hides the rail, alignment kept)
14
15
  *
15
16
  * Internal:
16
17
  * --gap (local value for the shared gap token)
18
+ * --nav-list-rail-inset (half the icon on each side of the nested rail)
17
19
  */
18
20
  /* Intent boundary — inherited intents do not tint this component.
19
21
  Local intent classes still win because :where() has zero specificity.
@@ -178,12 +180,18 @@
178
180
  transform: rotate(180deg);
179
181
  }
180
182
 
181
- /* A nested list is indented so its labels start under the parent's label,
182
- past a 1em leading icon and the link gap. Fallback-only: a base
183
- declaration on .nav-list would reset an override at every level. */
183
+ /* A nested list hangs from a rail under the centre of the parent's leading
184
+ icon, and its labels start under the parent's label. The two halves of the
185
+ icon split around the rail, which balances because .nav-link's gap and
186
+ inline padding are the same step. --nav-list-icon-size is the icon's width,
187
+ fallback-only: a base declaration on .nav-list would reset an override at
188
+ every level. */
184
189
  .nav-list .nav-list {
185
190
  margin-block-start: var(--gap);
186
- padding-inline-start: var(--nav-list-indent, calc(1em + var(--space-20)));
191
+ --nav-list-rail-inset: calc((var(--nav-list-icon-size, 1em) - var(--border-width)) / 2);
192
+ margin-inline-start: calc(var(--space-20) + var(--nav-list-rail-inset));
193
+ padding-inline-start: var(--nav-list-rail-inset);
194
+ border-inline-start: var(--border-width) solid var(--nav-list-rail-color, var(--border));
187
195
  }
188
196
 
189
197
  /* Forced colors drops the fill and maps both inks to LinkText, so the current
@@ -18,6 +18,7 @@
18
18
  * --rating-empty
19
19
  * --rating-star
20
20
  * --rating-star-empty (the empty star's shape; the filled one by default)
21
+ * --rating-star-outline (a ready outline of the default star, for the hook above)
21
22
  * --rating-value (display: the shown value, fractions allowed)
22
23
  * --rating-max (display: the number of stars)
23
24
  *
@@ -33,10 +34,18 @@
33
34
  .rating {
34
35
  --rating-size: 1.25rem;
35
36
  --rating-gap: var(--space-10);
36
- --rating-color: var(--intent, var(--warning));
37
+ /* why: gold stars are the convention a reader recognizes, so the default
38
+ owns its color instead of borrowing --warning's meaning. A literal, not
39
+ light-dark(): it reads on both schemes, and an unsupported light-dark()
40
+ here would invalidate the fill. Accepted trade-off: 2.1:1 on a white
41
+ surface, under the 3:1 graphics target; the value lives in the
42
+ aria-label, and a theme picks its own ink on .rating. */
43
+ --rating-color: var(--intent, hsl(38 92% 50%));
37
44
  --rating-empty: var(--border);
38
45
  --rating-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 16 16'%3E%3Cpath d='M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.922-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.783.57-1.838-.196-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292Z'/%3E%3C/svg%3E");
39
- /* An outline here turns the empty stars into a shape cue (see the docs). */
46
+ /* The default star stroked inside its own clip, so the line never grows
47
+ the silhouette and a filled and an empty star stay the same size. */
48
+ --rating-star-outline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 16 16'%3E%3CclipPath id='c'%3E%3Cpath d='M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.922-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.783.57-1.838-.196-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292Z'/%3E%3C/clipPath%3E%3Cpath d='M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.922-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.783.57-1.838-.196-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292Z' fill='none' stroke='black' stroke-width='2.4' clip-path='url(%23c)'/%3E%3C/svg%3E");
40
49
  --rating-star-empty: var(--rating-star);
41
50
 
42
51
  display: inline-flex;
@@ -44,6 +53,18 @@
44
53
  color: var(--rating-color);
45
54
  }
46
55
 
56
+ /* why: an empty star is a fill, not a stroke. --border is a stroke token, and
57
+ a theme with ink-dark borders (brutalist, cyberpunk) turned every empty star
58
+ solid black, louder than the filled ones. A light ink tint over the surface
59
+ reads as the same pale star on every theme. Guarded: inside a custom
60
+ property an unsupported color-mix() would invalidate the fill, not fall back
61
+ to --border. */
62
+ @supports (color: color-mix(in oklab, red, white)) {
63
+ .rating {
64
+ --rating-empty: color-mix(in oklab, var(--text) 15%, var(--surface));
65
+ }
66
+ }
67
+
47
68
  .rating > input[type="radio"] {
48
69
  appearance: none;
49
70
  flex: 0 0 auto;
@@ -18,11 +18,13 @@
18
18
  */
19
19
 
20
20
  @supports selector(.scrollspy a:target-current) {
21
- .scrollspy {
21
+ /* Native and JS activation lines can select different links. Once JS has
22
+ a current location, it owns the state and the native group must yield. */
23
+ .scrollspy:not(:has([aria-current="location"])) {
22
24
  scroll-target-group: auto;
23
25
  }
24
26
 
25
- .scrollspy a:target-current {
27
+ .scrollspy:not(:has([aria-current="location"])) a:target-current {
26
28
  color: var(--text);
27
29
  font-weight: var(--font-weight-medium);
28
30
  }
@@ -16,18 +16,29 @@
16
16
  * place. A direct <time> child is the event's dateline. The content stays in
17
17
  * block flow, so a sentence mixing text and links is never split into items.
18
18
  *
19
+ * .timeline-dates-end moves every dateline to the inline end of the event's
20
+ * first line, beside the title instead of above it.
21
+ *
19
22
  * Progress through a process is .steps, not a timeline.
20
23
  *
21
24
  * Public hooks:
22
25
  * --timeline-dot-size
23
26
  * --timeline-slot-size
27
+ * --timeline-glyph-size
24
28
  * --timeline-gap
25
29
  * --timeline-inline-gap
26
30
  * --timeline-line-size
31
+ * --timeline-marker-nudge
27
32
  *
28
33
  * Internal:
29
34
  * --timeline-rail-size
30
35
  * --timeline-line-box
36
+ * --timeline-marker-shift
37
+ * --timeline-marker-inset
38
+ * --timeline-marker-center
39
+ * --timeline-slot-bg
40
+ * --timeline-slot-border
41
+ * --timeline-slot-fg
31
42
  */
32
43
 
33
44
  /* Registered so the event's line box computes to a length on the <li> and
@@ -43,9 +54,18 @@
43
54
  initial-value: 0px;
44
55
  }
45
56
 
57
+ /* An author nudge in em must resolve against the event's text before it
58
+ inherits into a slot with a different glyph size. */
59
+ @property --timeline-marker-shift {
60
+ syntax: "<length>";
61
+ inherits: true;
62
+ initial-value: 0px;
63
+ }
64
+
46
65
  .timeline {
47
66
  --timeline-dot-size: 0.625rem;
48
- --timeline-slot-size: 1.75rem;
67
+ --timeline-slot-size: 2rem;
68
+ --timeline-glyph-size: calc(var(--timeline-slot-size) / 2);
49
69
  --timeline-gap: var(--density-space);
50
70
  --timeline-inline-gap: var(--space-30);
51
71
  --timeline-line-size: var(--border-width);
@@ -73,11 +93,38 @@
73
93
 
74
94
  /* The line box is a length, not the unitless ratio: a smaller <time> opening
75
95
  the event keeps the same first line as text would, so the marker centred on
76
- it lines up whichever element comes first. */
96
+ it lines up whichever element comes first.
97
+
98
+ A slot taller than the line box would overflow the event above and below:
99
+ the first marker would poke out of the list (clipped by a card with
100
+ overflow), and the gap between two discs would shrink below the gap. The
101
+ inset pushes the first line down until the marker, nudge included, starts
102
+ at the top, and the minimum size ends the event at the marker's bottom, so
103
+ the event box always holds its marker. Every marker position derives from
104
+ the one centre.
105
+
106
+ Points, discs and avatars share the first line box's centre. The nudge
107
+ moves that shared geometry; correct an off-centre glyph inside its disc
108
+ instead, so the marker and rail stay aligned. */
77
109
  .timeline > li {
78
110
  --timeline-line-box: calc(var(--line-height) * 1em);
111
+ --timeline-marker-shift: var(--timeline-marker-nudge, 0px);
112
+ --timeline-marker-inset: max(
113
+ 0px,
114
+ (var(--timeline-rail-size) - var(--timeline-line-box)) /
115
+ 2 -
116
+ var(--timeline-marker-shift)
117
+ );
118
+ --timeline-marker-center: calc(
119
+ var(--timeline-marker-inset) +
120
+ var(--timeline-line-box) /
121
+ 2 +
122
+ var(--timeline-marker-shift)
123
+ );
79
124
 
80
125
  position: relative;
126
+ min-block-size: calc(var(--timeline-marker-center) + var(--timeline-rail-size) / 2);
127
+ padding-block-start: var(--timeline-marker-inset);
81
128
  padding-inline-start: calc(var(--timeline-rail-size) + var(--timeline-inline-gap));
82
129
  line-height: var(--timeline-line-box);
83
130
  }
@@ -92,12 +139,43 @@
92
139
  display: block;
93
140
  color: var(--text-muted);
94
141
  font-size: var(--font-size-sm);
142
+ /* Equal-width digits keep times aligned down the list. */
143
+ font-variant-numeric: tabular-nums;
144
+ }
145
+
146
+ /* A float, not a grid: a grid would turn each run of bare text between links
147
+ into its own item and split the sentence. The dateline comes first in the
148
+ source, so it floats on the first line and shares its line box; the text
149
+ wraps beside it, and the next lines take the full width. flow-root keeps a
150
+ float taller than a one-line event inside the <li>, where the rail segment
151
+ measures from. */
152
+ .timeline-dates-end > li {
153
+ display: flow-root;
154
+ }
155
+
156
+ .timeline-dates-end > li > time {
157
+ float: inline-end;
158
+ /* The strut below grows the dateline's line past the line box; held to
159
+ one line box, the float never narrows the event's second line. */
160
+ block-size: var(--timeline-line-box);
161
+ margin-inline-start: var(--timeline-inline-gap);
162
+ }
163
+
164
+ /* A float lays out its own line, so the smaller dateline centres in the line
165
+ box while the title beside it sits on the event's baseline: a pixel or two
166
+ apart, by font, and the eye compares baselines on a shared row. An empty
167
+ strut at the event's font size gives the dateline's line that same
168
+ baseline. The size comes from the registered line box, since 1em here is
169
+ the dateline's own. */
170
+ .timeline-dates-end > li > time::before {
171
+ content: "";
172
+ font-size: calc(var(--timeline-line-box) / var(--line-height));
95
173
  }
96
174
 
97
175
  .timeline > li::before {
98
176
  content: "";
99
177
  position: absolute;
100
- inset-block-start: calc((var(--timeline-line-box) - var(--timeline-dot-size)) / 2);
178
+ inset-block-start: calc(var(--timeline-marker-center) - var(--timeline-dot-size) / 2);
101
179
  inset-inline-start: calc((var(--timeline-rail-size) - var(--timeline-dot-size)) / 2);
102
180
  inline-size: var(--timeline-dot-size);
103
181
  block-size: var(--timeline-dot-size);
@@ -119,7 +197,7 @@
119
197
  .timeline > li:not(:last-child)::after {
120
198
  content: "";
121
199
  position: absolute;
122
- inset-block-start: calc((var(--timeline-line-box) + var(--timeline-rail-size)) / 2);
200
+ inset-block-start: calc(var(--timeline-marker-center) + var(--timeline-rail-size) / 2);
123
201
  inset-inline-start: calc((var(--timeline-rail-size) - var(--timeline-line-size)) / 2);
124
202
  block-size: calc(100% + var(--timeline-gap) - var(--timeline-rail-size));
125
203
  border-inline-start: var(--timeline-line-size) solid var(--border);
@@ -129,25 +207,50 @@
129
207
  --avatar-size: var(--timeline-rail-size);
130
208
 
131
209
  position: absolute;
132
- inset-block-start: calc((var(--timeline-line-box) - var(--timeline-rail-size)) / 2);
210
+ inset-block-start: calc(var(--timeline-marker-center) - var(--timeline-rail-size) / 2);
133
211
  inset-inline-start: 0;
134
212
  }
135
213
 
136
214
  /* An icon slot gets a disc of the avatar's size, so both slot kinds read as one
137
- rail. The event's intent colors the glyph. */
215
+ rail. The event's intent colors the glyph, sized from the slot so a larger
216
+ disc never looks empty. */
138
217
  .timeline > li > [aria-hidden="true"]:first-child:not(.avatar) {
139
218
  display: grid;
140
219
  place-items: center;
141
220
  inline-size: var(--timeline-rail-size);
142
221
  block-size: var(--timeline-rail-size);
143
- border: var(--border-width) solid var(--border);
222
+ border: var(--border-width) solid var(--timeline-slot-border, var(--border));
144
223
  border-radius: var(--radius-full);
145
- background: var(--surface-opaque);
146
- color: var(--intent, var(--text-muted));
147
- font-size: var(--font-size-sm);
224
+ background: var(--timeline-slot-bg, var(--surface-opaque));
225
+ color: var(--timeline-slot-fg, var(--intent, var(--text-muted)));
226
+ font-size: var(--timeline-glyph-size);
148
227
  line-height: 1;
149
228
  }
150
229
 
230
+ /* An event with an intent tints its disc like a soft badge: a translucent
231
+ fill, a rim, and the soft ink. Each mix names var(--intent) bare, so an
232
+ event without one leaves them guaranteed-invalid and the disc falls back to
233
+ the neutral surface above. Guarded because an unsupported color-mix() in a
234
+ custom property is not dropped: it would void the fallback with it. */
235
+ @supports (color: color-mix(in oklch, red, white)) {
236
+ .timeline > li > [aria-hidden="true"]:first-child:not(.avatar) {
237
+ --timeline-slot-bg: color-mix(
238
+ in oklab,
239
+ var(--intent) calc(100% - var(--soft-bg-mix)),
240
+ transparent
241
+ );
242
+ --timeline-slot-border: color-mix(
243
+ in oklab,
244
+ var(--intent) calc(100% - var(--soft-border-mix, 70%)),
245
+ transparent
246
+ );
247
+ --timeline-slot-fg: var(
248
+ --intent-soft-fg,
249
+ color-mix(in oklab, var(--text), var(--intent) var(--soft-fg-mix))
250
+ );
251
+ }
252
+ }
253
+
151
254
  .timeline > li > [aria-hidden="true"]:first-child:not(.avatar) > svg {
152
255
  inline-size: 1em;
153
256
  block-size: 1em;
@@ -97,6 +97,22 @@ small {
97
97
  font-size: 0.875em;
98
98
  }
99
99
 
100
+ /* A semantic highlight. The UA's yellow ignores the theme and clashes with a
101
+ dark palette, so the pair comes from the theme instead. `.mark-sweep` reuses
102
+ the same pair for its animated background. Forced colors keep the system
103
+ Mark pair, the one place the glyph/background relationship is guaranteed. */
104
+ mark {
105
+ background: var(--mark-bg);
106
+ color: var(--mark-fg);
107
+ }
108
+
109
+ @media (forced-colors: active) {
110
+ mark {
111
+ background: Mark;
112
+ color: MarkText;
113
+ }
114
+ }
115
+
100
116
  ::selection {
101
117
  background: var(--selection-bg, var(--primary));
102
118
  color: var(--selection-fg, var(--primary-fg));