actual-css 0.17.1 → 0.18.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.
@@ -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;
@@ -23,7 +23,10 @@
23
23
  */
24
24
 
25
25
  /* Typography */
26
- --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
26
+ /* The platform's own faces, never a download: a framework cannot assume a
27
+ locally installed family, and naming one renders the same page differently
28
+ on two machines of the same OS. The docs site loads a webfont instead. */
29
+ --font-sans: system-ui, sans-serif;
27
30
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
28
31
  --font-width: 100%;
29
32
  --line-height: 1.5;
@@ -226,6 +226,13 @@
226
226
  --choice-border: var(--text-subtle);
227
227
  }
228
228
 
229
+ /* A bare checkbox or radio (a table row selector, an application's native
230
+ control) is boxed by its own skin, not text-like: it takes the themed ring
231
+ instead of the core currentColor fallback, which paints the text ink. */
232
+ :where(input[type="checkbox"], input[type="radio"]) {
233
+ --focus-outline-color: var(--focus);
234
+ }
235
+
229
236
  .check:focus-visible,
230
237
  .radio:focus-visible {
231
238
  outline: var(--focus-ring-width) solid var(--focus);
@@ -124,8 +124,8 @@ function measureSpecimens({ css, islands, specimens, width }) {
124
124
  if (attribute) island.dataset.theme = attribute;
125
125
  if (scheme) island.style.colorScheme = scheme;
126
126
  // What body gives the page: an island does not reset `color`, and the
127
- // currentColor variants (outline, ghost, link) would otherwise inherit
128
- // the ink of body's scheme instead of this island's.
127
+ // currentColor inks (outline, ghost, link) would otherwise inherit the
128
+ // ink of body's scheme instead of this island's.
129
129
  island.style.color = "var(--text)";
130
130
  island.innerHTML = specimens
131
131
  .map((html) => `<div style="inline-size: ${width}">${html}</div>`)