actual-css 0.17.0 → 0.17.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/actual.full.css +82 -22
  3. package/dist/actual.full.min.css +1 -1
  4. package/docs/navigation.json +3 -2
  5. package/docs/pages/components/accordion.md +8 -0
  6. package/docs/pages/components/alert.md +7 -5
  7. package/docs/pages/components/app-navigation.md +2 -2
  8. package/docs/pages/components/aura.md +2 -2
  9. package/docs/pages/components/badge.md +4 -3
  10. package/docs/pages/components/card.md +1 -1
  11. package/docs/pages/components/chat.md +2 -2
  12. package/docs/pages/components/fab.md +2 -1
  13. package/docs/pages/components/list.md +1 -1
  14. package/docs/pages/components/meter.md +1 -1
  15. package/docs/pages/components/navbar.md +1 -1
  16. package/docs/pages/components/overview.md +17 -0
  17. package/docs/pages/components/shimmer.md +2 -2
  18. package/docs/pages/enhancements/overview.md +2 -2
  19. package/docs/pages/enhancements/status-bar.md +1 -1
  20. package/docs/pages/forms/ajax.md +1 -1
  21. package/docs/pages/forms/choice-cards.md +1 -1
  22. package/docs/pages/forms/detached-actions.md +1 -1
  23. package/docs/pages/forms/floating-field.md +5 -3
  24. package/docs/pages/forms/form-actions.md +1 -1
  25. package/docs/pages/forms/input-policy.md +1 -1
  26. package/docs/pages/forms/joined-controls.md +1 -1
  27. package/docs/pages/forms/otp.md +2 -2
  28. package/docs/pages/forms/password.md +1 -1
  29. package/docs/pages/forms/states-and-sizes.md +1 -1
  30. package/docs/pages/forms/sticky-actions.md +1 -1
  31. package/docs/pages/forms/unsaved-changes.md +1 -1
  32. package/docs/pages/foundations/theming.md +2 -2
  33. package/docs/pages/foundations/tokens.md +29 -4
  34. package/docs/pages/foundations/typography.md +1 -1
  35. package/docs/pages/guides/progressive-enhancement.md +1 -1
  36. package/docs/pages/layout/app-layout.md +1 -1
  37. package/docs/pages/layout/app-shell.md +1 -1
  38. package/docs/pages/layout/column-layout.md +1 -1
  39. package/docs/pages/layout/media.md +1 -1
  40. package/docs/pages/layout/overview.md +1 -1
  41. package/docs/pages/layout/scroll-snap.md +1 -1
  42. package/docs/pages/layout/scroll-target.md +1 -1
  43. package/docs/pages/layout/sidebar-layout.md +1 -1
  44. package/docs/pages/layout/sidebar-shell.md +1 -1
  45. package/docs/pages/patterns/code-block.md +1 -1
  46. package/docs/pages/patterns/exclusive-accordion.md +1 -1
  47. package/docs/pages/patterns/hierarchical-nav.md +1 -1
  48. package/docs/pages/patterns/icon-input.md +1 -1
  49. package/docs/pages/patterns/intent-nesting.md +1 -1
  50. package/docs/pages/patterns/navigation-list.md +2 -2
  51. package/docs/pages/patterns/overview.md +1 -1
  52. package/docs/pages/patterns/structured-lists.md +1 -1
  53. package/docs/pages/utilities/flex.md +1 -1
  54. package/docs/pages/utilities/links.md +1 -1
  55. package/docs/pages/utilities/list.md +1 -1
  56. package/docs/pages/utilities/shape.md +1 -1
  57. package/docs/pages/utilities/sizing-wrapping.md +1 -1
  58. package/docs/pages/utilities/spacing.md +1 -1
  59. package/docs/pages/utilities/text.md +1 -1
  60. package/package.json +1 -1
  61. package/src/cli/actual-css.js +4 -4
  62. package/src/css/components/accordion.css +10 -6
  63. package/src/css/components/alert.css +4 -0
  64. package/src/css/components/join.css +14 -0
  65. package/src/css/components/navbar.css +9 -6
  66. package/src/css/core/theme.css +20 -1
  67. package/src/css/core/tokens.css +4 -1
  68. package/src/css/forms/custom-select.css +10 -5
  69. package/src/css/forms/input-icon.css +5 -3
  70. package/src/css/typography/prose.css +6 -0
  71. package/src/tooling/design-tokens.js +1 -0
  72. package/src/tooling/theme-contrast.js +41 -2
  73. package/tokens.json +1 -0
@@ -27,10 +27,10 @@ function usage() {
27
27
  "Penpot plugin that builds them. Needs Bun (bunx --bun actual-css design ...).",
28
28
  "",
29
29
  "contrast: measure the pairs a theme tunes by hand in headless Chrome, in every",
30
- "scheme it declares: soft ink on its resting and hovered fill, the focus line on",
31
- "--surface and --surface-solid, the invalid-field focus line, and the inverse",
32
- "text. Exits 1 when a pair misses its threshold. Needs Bun (bunx --bun actual-css",
33
- "contrast ...).",
30
+ "scheme it declares: soft ink on its resting and hovered fill, the resting edge",
31
+ "of a field, checkbox and radio, the focus line on --surface and --surface-solid,",
32
+ "the invalid-field focus line, and the inverse text. Exits 1 when a pair misses",
33
+ "its threshold. Needs Bun (bunx --bun actual-css contrast ...).",
34
34
  ].join("\n");
35
35
  }
36
36
 
@@ -104,12 +104,6 @@
104
104
  margin-block-start: 0;
105
105
  }
106
106
 
107
- .accordion details > summary + ul,
108
- .accordion details > summary + ol {
109
- margin: 0;
110
- padding-inline-start: 2rem;
111
- }
112
-
113
107
  /* Flush — the shell is dropped and only the shared item separators remain.
114
108
  Zero inline padding puts the group edge to edge inside the surface that
115
109
  already frames it, so no override is repeated per embedding. */
@@ -130,6 +124,16 @@
130
124
  --surface-pad: 0px;
131
125
  }
132
126
 
127
+ /* A list panel keeps its marker gutter in every treatment. The .flush
128
+ selector is required, not redundant: .flush zeroes the panel's inline
129
+ padding at higher specificity, which would push the bullets out of the
130
+ panel. */
131
+ .accordion details > summary + :is(ul, ol),
132
+ .accordion.flush details > summary + :is(ul, ol) {
133
+ margin: 0;
134
+ padding-inline-start: 2rem;
135
+ }
136
+
133
137
  /* Separated — each item owns a full card. The item's own border beats the
134
138
  shared details + details separator on specificity alone, so nothing needs
135
139
  undoing for the second item onwards. */
@@ -231,6 +231,10 @@
231
231
  border: 0;
232
232
  border-inline-start: var(--alert-border-inline-start-width, 4px) solid
233
233
  var(--alert-border-inline-start-color, var(--intent, var(--neutral)));
234
+ /* why: a thick flag under the large radius curves into a crescent. The
235
+ leading corners take the small radius so the flag stays a straight bar. */
236
+ border-start-start-radius: var(--radius-sm);
237
+ border-end-start-radius: var(--radius-sm);
234
238
  }
235
239
 
236
240
  /* Admonition — structured static box with a tinted title bar and a body
@@ -98,6 +98,20 @@
98
98
  margin-inline-start: calc(var(--border-width) * -1);
99
99
  }
100
100
 
101
+ /* Seam between adjacent filled buttons (default, .solid, .soft): their border
102
+ is transparent, so "Left Middle Right" read as one button. A quarter of the
103
+ ink turns that edge into a hairline; the mix keeps a soft rim set by
104
+ --soft-border-mix. Variants that already draw an edge, or have no fill, keep
105
+ their border untouched. Chained :not(): a list inside :not() is above
106
+ the Firefox 78 floor. */
107
+ .join > .btn + .btn:not(.outline):not(.surface):not(.ghost):not(.link) {
108
+ border-inline-start-color: color-mix(
109
+ in oklab,
110
+ var(--btn-border-color, var(--btn-border)),
111
+ var(--btn-fg) 25%
112
+ );
113
+ }
114
+
101
115
  .join > :is(:hover, :focus, :focus-within) {
102
116
  z-index: 1;
103
117
  }
@@ -100,20 +100,23 @@
100
100
  color: var(--nav-current-fg, var(--text));
101
101
  }
102
102
 
103
- /* Fills are a tint of the link's own ink, the .btn.ghost hover recipe, so they
103
+ /* Fills are a tint of the link's own ink, like the .btn.ghost hover, so they
104
104
  read on light and dark bars alike, including a bar with its own
105
105
  --ui-bg/--ui-fg. Not --ui-hover-bg: that is the bar's own hover and can
106
- equal its fill. Current is a step above hover (18% vs 10%), so the current
107
- link stays apart while another is hovered. The baseline above keeps a
108
- light chip where color-mix is missing. */
106
+ equal its fill. Current is a step above hover (8% vs 5%), so the current
107
+ link stays apart while another is hovered. Both stay paler than the ghost
108
+ button: a nav row is wide, and at 18% a full-width current row read as a
109
+ pressed button. The fill only seconds the ink step, so it needs no 3:1 of
110
+ its own. The baseline above keeps a light chip where color-mix is
111
+ missing. */
109
112
  @supports (color: color-mix(in oklch, red, white)) {
110
113
  .nav-link:hover {
111
- background: color-mix(in oklch, currentColor 10%, transparent);
114
+ background: color-mix(in oklch, currentColor 5%, transparent);
112
115
  color: var(--ui-fg, var(--text));
113
116
  }
114
117
 
115
118
  .nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
116
- background: var(--nav-current-bg, color-mix(in oklch, currentColor 18%, transparent));
119
+ background: var(--nav-current-bg, color-mix(in oklch, currentColor 8%, transparent));
117
120
  color: var(--nav-current-fg, var(--ui-fg, var(--text)));
118
121
  }
119
122
  }
@@ -118,13 +118,32 @@
118
118
  --surface-opaque: var(--surface);
119
119
  --surface-solid-fg: var(--surface);
120
120
  /* The edge that tells a control apart from the surface, where --border only
121
- separates surfaces: fields, choices, switch, OTP cells, choice cards. */
121
+ separates surfaces: fields, choices, switch, OTP cells, choice cards.
122
+ Derived from the ink: the default palette clears 3:1 against the surface
123
+ in both schemes (WCAG 1.4.11: an unchecked radio is identified by its edge
124
+ alone), where --border sat at ~1.3:1. The mix is not a guarantee for every
125
+ palette: a low-contrast ink lands under 3:1, which the contrast report
126
+ (control edge) shows. Mixed into the opaque surface so a translucent theme
127
+ still draws a solid edge. The plain fallback matters: without color-mix
128
+ the var() is invalid at computed time and takes the whole border
129
+ shorthand with it, erasing every field and choice outline. */
122
130
  --border-control: var(--border);
123
131
  /* Inherited resting field fill, shared with external control bridges.
124
132
  Component state rules still own readonly, disabled and invalid fills. */
125
133
  --control-default-bg: var(--surface);
126
134
  }
127
135
 
136
+ @supports (color: color-mix(in oklab, red, white)) {
137
+ :root,
138
+ [data-theme] {
139
+ --border-control: color-mix(
140
+ in oklab,
141
+ var(--text) var(--border-control-mix),
142
+ var(--surface-opaque)
143
+ );
144
+ }
145
+ }
146
+
128
147
  /* Soft foreground hooks — the soft ink is the intent rebated toward the local
129
148
  text so it keeps 4.5:1 against the soft hover fill (the resting fill carries
130
149
  the extra margin; variants.css soft recipe). Deliberately scoped to the
@@ -28,7 +28,7 @@
28
28
  --font-width: 100%;
29
29
  --line-height: 1.5;
30
30
  --line-height-tight: 1.25;
31
- --line-height-relaxed: 1.75;
31
+ --line-height-relaxed: 1.6;
32
32
  --font-weight-normal: 400;
33
33
  --font-weight-medium: 500;
34
34
  --font-weight-semibold: 600;
@@ -206,6 +206,9 @@
206
206
  the hovered soft fill instead (theme.css); this mix is the fallback a
207
207
  theme without hooks falls back to. */
208
208
  --soft-fg-mix: 100%;
209
+ /* Control edge: the share of ink in --border-control (theme.css). Raise it
210
+ when a tinted or translucent surface pulls the edge under 3:1. */
211
+ --border-control-mix: 45%;
209
212
 
210
213
  /* Shared icon assets. Override these URLs when a strict CSP disallows data:. */
211
214
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238a8594' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
@@ -17,14 +17,19 @@
17
17
  pointer: fine
18
18
  ) {
19
19
  @supports (appearance: base-select) {
20
+ /* why: base-select brings a UA padding-block (0.25em) that the native
21
+ select lacks; with a 24px line it pushed a .compact select to 34px
22
+ against --control-size 32px. min-block-size and align-items already
23
+ center the value. Zero specificity: the reset only has to beat the UA
24
+ sheet, and at (0,3,0) it erased the headroom .floating-field reserves,
25
+ so the floated label sat on the value. */
26
+ :where(.select:not([multiple], .native, [size]:not([size="1"]))) {
27
+ padding-block: 0;
28
+ }
29
+
20
30
  .select:not([multiple], .native, [size]:not([size="1"])) {
21
31
  appearance: base-select;
22
32
  align-items: center;
23
- /* why: base-select brings a UA padding-block (0.25em) that the native
24
- select lacks; with a 24px line it pushed a .compact select to 34px
25
- against --control-size 32px. min-block-size and align-items already
26
- center the value. */
27
- padding-block: 0;
28
33
 
29
34
  &::picker(select) {
30
35
  appearance: base-select;
@@ -49,14 +49,16 @@
49
49
  block-size: 1em;
50
50
  }
51
51
 
52
- /* Leading: input gets start padding to clear the icon */
52
+ /* Leading: input gets start padding to clear the icon. The text sits half a
53
+ pad from the icon: a full pad, the same as the icon's inset from the edge,
54
+ read as two separate items rather than an icon labelling its field. */
53
55
  .input-icon > :first-child:where(:not(.input)) ~ .input {
54
- padding-inline-start: calc(var(--control-pad-x) * 2 + var(--input-icon-size));
56
+ padding-inline-start: calc(var(--control-pad-x) * 1.5 + var(--input-icon-size));
55
57
  }
56
58
 
57
59
  /* Trailing: the input has a following sibling → end padding. Not tied to the
58
60
  input being first child, so a leading icon does not disable the trailing
59
61
  icon's reserved space. */
60
62
  .input-icon > .input:where(:not(:last-child)) {
61
- padding-inline-end: calc(var(--control-pad-x) * 2 + var(--input-icon-size));
63
+ padding-inline-end: calc(var(--control-pad-x) * 1.5 + var(--input-icon-size));
62
64
  }
@@ -163,6 +163,9 @@
163
163
 
164
164
  /* Overflow containment is global on `pre` (base.css); only the box is prose's. */
165
165
  .prose :where(pre) {
166
+ /* why: code is scanned line by line, not read as running text; the prose
167
+ reading leading spread a block to ~1.7 lines per line of code. */
168
+ line-height: var(--line-height);
166
169
  padding: 1em;
167
170
  border: var(--border-width) solid var(--border);
168
171
  border-radius: var(--radius);
@@ -192,6 +195,9 @@
192
195
  }
193
196
 
194
197
  .prose :where(table) {
198
+ /* why: tables are scanned cell by cell, like code; the reading leading made
199
+ every wrapped cell tall and loose. */
200
+ line-height: var(--line-height);
195
201
  inline-size: 100%;
196
202
  border-collapse: collapse;
197
203
  }
@@ -128,6 +128,7 @@ export const NOT_EXPORTED = {
128
128
  "soft-border-mix",
129
129
  "soft-hover-alpha",
130
130
  "soft-fg-mix",
131
+ "border-control-mix",
131
132
  "focus-outline-color",
132
133
  ],
133
134
  "soft recipe, exported with the components": [
@@ -5,6 +5,7 @@
5
5
  * (`bun run report:theme-contrast`).
6
6
  *
7
7
  * Measured per island (one per color scheme the theme declares):
8
+ * - the resting edge of a field, checkbox and radio against --surface (3:1)
8
9
  * - soft ink against the resting and the hovered soft fill (4.5:1), on each
9
10
  * surface a soft element sits on
10
11
  * - the solid pairs, -fg on the intent fill (4.5:1); a fill painted by a
@@ -64,9 +65,21 @@ function islandMarkup(id, scheme) {
64
65
  <span data-pair="focus-solid" style="color: var(--focus); background: var(--surface-solid)"></span>
65
66
  <span data-pair="inverse" style="color: var(--surface-solid-fg); background: var(--surface-solid)"></span>
66
67
  <input class="input" aria-invalid="true" data-pair="invalid-field" aria-label="t">
68
+ <div data-controls style="background: var(--surface)">
69
+ ${CONTROLS.map(([kind, markup]) => markup.replace("<input", `<input data-control="${kind}" aria-label="t"`)).join("")}
70
+ </div>
67
71
  </div>`;
68
72
  }
69
73
 
74
+ /* Controls whose resting edge is all that identifies them (WCAG 1.4.11): the
75
+ edge against the surface around them needs 3:1. The field is read on its
76
+ block-end side, the one an underline-only theme (material) keeps. */
77
+ export const CONTROLS = [
78
+ ["field", '<input class="input">'],
79
+ ["checkbox", '<input class="check" type="checkbox">'],
80
+ ["radio", '<input class="radio" type="radio">'],
81
+ ];
82
+
70
83
  const ratio = (fg, bg) => (fg[3] < 255 || bg[3] < 255 ? null : contrast(fg, bg));
71
84
 
72
85
  /*
@@ -186,12 +199,20 @@ export async function measureContrast({ css, themes, label = "default" }) {
186
199
  selected,
187
200
  };
188
201
  }
189
- return { pairs, soft, solid };
202
+ const box = island.querySelector("[data-controls]");
203
+ const controls = { backdrop: rgba(cs(box).backgroundColor), edges: {} };
204
+ for (const el of box.querySelectorAll("[data-control]")) {
205
+ const s = cs(el);
206
+ controls.edges[el.dataset.control] = rgba(
207
+ el.dataset.control === "field" ? s.borderBlockEndColor : s.borderTopColor,
208
+ );
209
+ }
210
+ return { pairs, soft, solid, controls };
190
211
  });
191
212
  })()`);
192
213
 
193
214
  return islands.map(({ theme, scheme }, i) => {
194
- const { pairs, soft, solid } = colors[i];
215
+ const { pairs, soft, solid, controls } = colors[i];
195
216
  const pair = (key) => ratio(pairs[key].fg, pairs[key].bg);
196
217
  // Fill over the surface, then ink over the fill: the colors the page shows.
197
218
  const shown = (fg, fill, backdrop) => {
@@ -232,6 +253,15 @@ export async function measureContrast({ css, themes, label = "default" }) {
232
253
  hover: shown(fills[intent].fg, fills[intent].hover, backdrop),
233
254
  }));
234
255
  }),
256
+ // A translucent edge is composited over the surface; a translucent
257
+ // surface has no defined backdrop and reads n/a.
258
+ controls: CONTROLS.map(([kind]) => ({
259
+ kind,
260
+ value:
261
+ controls.backdrop[3] < 255
262
+ ? null
263
+ : ratio(composite(controls.edges[kind], controls.backdrop), controls.backdrop),
264
+ })),
235
265
  focusSurface: pair("focus-surface"),
236
266
  focusSolid: pair("focus-solid"),
237
267
  invalidFocus: pair("invalid-field"),
@@ -328,6 +358,15 @@ export function formatContrast(rows) {
328
358
  );
329
359
  }
330
360
 
361
+ lines.push("", "Control edge at rest (--border-control vs --surface), needs 3:1.", "");
362
+ lines.push(`${"theme".padEnd(width)} scheme control ratio`);
363
+ for (const row of rows) {
364
+ for (const { kind, value } of row.controls ?? []) {
365
+ const c = cell(value, 3);
366
+ lines.push(`${head(row)} ${kind.padEnd(9)} ${c.text.padStart(8)}${flag([c], 3)}`);
367
+ }
368
+ }
369
+
331
370
  // Documented exception (focus.css): an invalid field focuses in
332
371
  // --form-invalid-border. The line is inset, so it reads against the
333
372
  // field's own background, not the surface around it.
package/tokens.json CHANGED
@@ -6,6 +6,7 @@
6
6
  "--bar-height",
7
7
  "--border",
8
8
  "--border-control",
9
+ "--border-control-mix",
9
10
  "--border-width",
10
11
  "--choice-control-size",
11
12
  "--control-default-bg",