actual-css 0.20.1 → 0.21.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 (88) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +6 -6
  3. package/components.json +29 -7
  4. package/dist/actual.full.css +542 -135
  5. package/dist/actual.full.js +2 -2
  6. package/dist/actual.full.min.css +1 -1
  7. package/dist/types/data-flag.d.ts +1 -0
  8. package/dist/types/enhancement-loader-state.d.ts +6 -0
  9. package/dist/types/enhancement-loader.d.ts +0 -2
  10. package/dist/types/parse-config.d.ts +0 -1
  11. package/dist/types/popover-transport.d.ts +2 -0
  12. package/dist/types/status.d.ts +0 -1
  13. package/dist/types/tooltip.d.ts +4 -0
  14. package/dist/types/validation.d.ts +6 -2
  15. package/docs/pages/components/app-navigation.md +67 -0
  16. package/docs/pages/components/button.md +3 -0
  17. package/docs/pages/components/dialog.md +3 -0
  18. package/docs/pages/components/list.md +13 -0
  19. package/docs/pages/components/meter.md +1 -0
  20. package/docs/pages/components/progress.md +1 -0
  21. package/docs/pages/components/segmented.md +7 -4
  22. package/docs/pages/components/table.md +4 -1
  23. package/docs/pages/components/timeline.md +32 -0
  24. package/docs/pages/enhancements/flyout.md +12 -3
  25. package/docs/pages/enhancements/tooltip.md +6 -1
  26. package/docs/pages/examples/overview.md +30 -1
  27. package/docs/pages/forms/combobox.md +14 -10
  28. package/docs/pages/forms/labels.md +7 -0
  29. package/docs/pages/forms/overview.md +13 -10
  30. package/docs/pages/forms/range.md +3 -1
  31. package/docs/pages/forms/validation.md +3 -3
  32. package/docs/pages/foundations/philosophy.md +26 -0
  33. package/docs/pages/foundations/theming.md +80 -7
  34. package/docs/pages/foundations/tokens.md +39 -2
  35. package/docs/pages/guides/coding-agents.md +11 -0
  36. package/docs/pages/guides/introduction.md +1 -1
  37. package/docs/pages/guides/progressive-enhancement.md +109 -19
  38. package/docs/pages/guides/tailwind.md +12 -6
  39. package/docs/pages/guides/upgrading.md +52 -0
  40. package/docs/pages/layout/app-layout.md +50 -1
  41. package/docs/pages/patterns/empty-state.md +48 -10
  42. package/forms.json +325 -0
  43. package/llms.txt +2 -1
  44. package/package.json +3 -1
  45. package/reserved-classes.json +2 -0
  46. package/skills/actual-css/SKILL.md +1 -1
  47. package/skills/actual-css/references/api-and-vocabulary.md +2 -1
  48. package/src/cli/actual-css.js +8 -2
  49. package/src/css/components/app-nav.css +75 -18
  50. package/src/css/components/avatar.css +1 -0
  51. package/src/css/components/badge.css +7 -1
  52. package/src/css/components/button.css +20 -3
  53. package/src/css/components/flyout.css +8 -2
  54. package/src/css/components/list.css +28 -13
  55. package/src/css/components/menu.css +18 -0
  56. package/src/css/components/meter.css +11 -6
  57. package/src/css/components/progress.css +14 -6
  58. package/src/css/components/rating.css +2 -0
  59. package/src/css/components/segmented.css +22 -12
  60. package/src/css/components/table.css +21 -2
  61. package/src/css/components/timeline.css +50 -1
  62. package/src/css/core/theme.css +11 -1
  63. package/src/css/core/tokens.css +20 -2
  64. package/src/css/forms/choice-card.css +6 -4
  65. package/src/css/forms/choice.css +28 -16
  66. package/src/css/forms/control.css +23 -16
  67. package/src/css/forms/custom-select.css +3 -1
  68. package/src/css/forms/form.css +8 -5
  69. package/src/css/forms/otp.css +7 -1
  70. package/src/css/forms/range.css +31 -11
  71. package/src/css/forms/select.css +13 -4
  72. package/src/css/forms/switch.css +11 -5
  73. package/src/css/layout/app-layout.css +104 -5
  74. package/src/js/data-flag.js +4 -0
  75. package/src/js/dialog.js +24 -8
  76. package/src/js/enhancement-loader-state.js +7 -0
  77. package/src/js/enhancement-loader.js +4 -21
  78. package/src/js/keys.js +5 -7
  79. package/src/js/parse-config.js +0 -2
  80. package/src/js/popover-transport.js +18 -0
  81. package/src/js/status.js +0 -2
  82. package/src/js/surface.js +35 -41
  83. package/src/js/tooltip.js +70 -36
  84. package/src/js/validation.js +24 -10
  85. package/src/tooling/css-bundle.js +5 -0
  86. package/src/tooling/design-tokens.js +9 -2
  87. package/src/tooling/theme-contrast.js +45 -17
  88. package/tokens.json +5 -0
@@ -9,8 +9,8 @@
9
9
  * field, checkbox and radio, the track edge or knob of an unchecked switch
10
10
  * - soft ink against the resting and the hovered soft fill (4.5:1), on each
11
11
  * surface a soft element sits on
12
- * - the solid pairs, -fg on the intent fill (4.5:1); a fill painted by a
13
- * background-image reads n/a
12
+ * - the solid pairs, -fg on the intent fill (4.5:1), under the --finish
13
+ * veil; a fill a theme paints with its own background-image reads n/a
14
14
  * - selected ink on those surfaces: the current nav link at rest and on
15
15
  * hover, the selected tab and the current step number (4.5:1), and the
16
16
  * current step's ring (3:1)
@@ -61,7 +61,7 @@ function islandMarkup(id, scheme) {
61
61
  ).join("");
62
62
  return `<div${style} id="${id}">
63
63
  ${softPairs}
64
- ${INTENTS.map((i) => `<button class="btn solid ${i}" data-solid="${i}" type="button">t</button>`).join("")}
64
+ ${INTENTS.map((i) => `<button class="btn solid ${i}" data-solid="${i}" type="button" style="--finish: initial">t</button>`).join("")}
65
65
  <span data-pair="focus-surface" style="color: var(--focus); background: var(--surface)"></span>
66
66
  <span data-pair="focus-solid" style="color: var(--focus); background: var(--surface-solid)"></span>
67
67
  <span data-pair="inverse" style="color: var(--surface-solid-fg); background: var(--surface-solid)"></span>
@@ -74,7 +74,10 @@ function islandMarkup(id, scheme) {
74
74
 
75
75
  /* Controls whose resting edge is all that identifies them (WCAG 1.4.11): the
76
76
  edge against the surface around them needs 3:1. The field is read on its
77
- block-end side, the one an underline-only theme (material) keeps. An
77
+ block-end side, the one an underline-only theme (material) keeps, or on its
78
+ fill, whichever is stronger; under 3:1 it is a warning, not a miss: the
79
+ core's quiet field edge is a known trade-off (theme.css), and a field is
80
+ also identified by its label and place. An
78
81
  unchecked switch is read on its track edge or its knob, whichever is
79
82
  stronger: the core track is the --border-control edge, and a theme may move
80
83
  the cue to a dark knob on a quiet track (docs/pages/forms/switch.md). */
@@ -148,14 +151,23 @@ export async function measureContrast({ css, themes, label = "default" }) {
148
151
  const cs = (el, pseudo = null) => getComputedStyle(el, pseudo);
149
152
  const pairs = {};
150
153
  for (const el of island.querySelectorAll("[data-pair]")) {
151
- // The invalid field's block-end border carries --form-invalid-border,
152
- // the hook its focus outline reads, even on an underline-only theme
153
- // (material) whose other sides are clear.
154
- const fg = el.dataset.pair === "invalid-field" ? cs(el).borderBlockEndColor : cs(el).color;
154
+ // The invalid field is measured focused (a focused text field always
155
+ // matches :focus-visible): its line is the outline in
156
+ // --form-invalid-border, against the focused fill. A theme that clears
157
+ // the outline for an inset line (material, minimal) keeps the hook on
158
+ // the block-end border; a theme that drops the invalid frame (plush)
159
+ // keeps it on the outline.
160
+ let fg = cs(el).color;
161
+ if (el.dataset.pair === "invalid-field") {
162
+ el.focus();
163
+ const outline = cs(el).outlineStyle === "none" ? null : rgba(cs(el).outlineColor);
164
+ fg = outline && outline[3] > 0 ? cs(el).outlineColor : cs(el).borderBlockEndColor;
165
+ }
155
166
  pairs[el.dataset.pair] = { fg: rgba(fg), bg: rgba(cs(el).backgroundColor) };
156
167
  }
157
- // A solid fill painted by a background-image (a gradient theme) has no
158
- // single color to measure: it is reported, not sampled.
168
+ // The --finish veil is cleared on these buttons (islandMarkup), so
169
+ // the pair is the intent fill. A fill a theme still paints with its own
170
+ // background-image has no single color: it is reported, not sampled.
159
171
  const solid = {};
160
172
  for (const el of island.querySelectorAll("[data-solid]")) {
161
173
  solid[el.dataset.solid] =
@@ -207,11 +219,11 @@ export async function measureContrast({ css, themes, label = "default" }) {
207
219
  const box = island.querySelector("[data-controls]");
208
220
  const controls = { backdrop: rgba(cs(box).backgroundColor), edges: {} };
209
221
  // The cues that can identify each control; the best one counts. A field
210
- // shows its lower edge, a switch its track edge or its knob (the core
211
- // pill, or a theme's dark knob on a quiet track), any other control its
212
- // edge.
222
+ // shows its lower edge or its fill, a switch its track edge or its knob
223
+ // (the core pill, or a theme's dark knob on a quiet track), any other
224
+ // control its edge.
213
225
  const cues = {
214
- field: (s) => [s.borderBlockEndColor],
226
+ field: (s) => [s.borderBlockEndColor, s.backgroundColor],
215
227
  switch: (s, el) => [cs(el, "::before").backgroundColor, s.borderTopColor],
216
228
  };
217
229
  for (const el of box.querySelectorAll("[data-control]")) {
@@ -297,9 +309,11 @@ export async function measureThemeFile({ themeFile, name }) {
297
309
  return measureContrast({ css, themes: [theme], label: themeFile ? ":root" : "default" });
298
310
  }
299
311
 
300
- /* Text tables for `rows`, and the number of pairs under their threshold. */
312
+ /* Text tables for `rows`, the number of pairs under their threshold, and the
313
+ number of warnings: fields with no 3:1 cue, a trade-off the core makes. */
301
314
  export function formatContrast(rows) {
302
315
  let misses = 0;
316
+ let warnings = 0;
303
317
  const cell = (value, min) => {
304
318
  if (value === null) return { text: "n/a", miss: false };
305
319
  const miss = value < min;
@@ -373,10 +387,24 @@ export function formatContrast(rows) {
373
387
  );
374
388
  }
375
389
 
376
- lines.push("", "Control cue at rest (edge, or a switch's knob, vs --surface), needs 3:1.", "");
390
+ lines.push(
391
+ "",
392
+ "Control cue at rest (edge, a field's fill, or a switch's knob, vs --surface), needs 3:1.",
393
+ "A field under 3:1 is a warning: it reads by its label and place, which a WCAG 2 AA",
394
+ "audit does not count. Set --control-default-border: var(--border-control) for strong",
395
+ "identification, or give fields a fill or an edge that reaches 3:1.",
396
+ "",
397
+ );
377
398
  lines.push(`${"theme".padEnd(width)} scheme control ratio`);
378
399
  for (const row of rows) {
379
400
  for (const { kind, value } of row.controls ?? []) {
401
+ if (kind === "field" && value !== null && value < 3) {
402
+ warnings += 1;
403
+ lines.push(
404
+ `${head(row)} ${kind.padEnd(9)} ${`${value.toFixed(2)}:1`.padStart(8)} <-- warning: under 3`,
405
+ );
406
+ continue;
407
+ }
380
408
  const c = cell(value, 3);
381
409
  lines.push(`${head(row)} ${kind.padEnd(9)} ${c.text.padStart(8)}${flag([c], 3)}`);
382
410
  }
@@ -397,5 +425,5 @@ export function formatContrast(rows) {
397
425
  4.5,
398
426
  );
399
427
 
400
- return { text: lines.join("\n"), misses };
428
+ return { text: lines.join("\n"), misses, warnings };
401
429
  }
package/tokens.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "--backdrop-fill",
5
5
  "--backdrop-opacity",
6
6
  "--bar-height",
7
+ "--bar-radius",
7
8
  "--border",
8
9
  "--border-control",
9
10
  "--border-control-mix",
@@ -11,6 +12,7 @@
11
12
  "--btn-font-size",
12
13
  "--choice-control-size",
13
14
  "--control-default-bg",
15
+ "--control-default-border",
14
16
  "--control-font-size",
15
17
  "--control-pad-x",
16
18
  "--control-pad-x-lg",
@@ -33,6 +35,7 @@
33
35
  "--duration-spin",
34
36
  "--ease-enter",
35
37
  "--ease-exit",
38
+ "--finish",
36
39
  "--focus",
37
40
  "--focus-outline",
38
41
  "--focus-outline-color",
@@ -81,6 +84,8 @@
81
84
  "--selection-fg",
82
85
  "--shadow",
83
86
  "--shadow-color",
87
+ "--shadow-control",
88
+ "--shadow-inset",
84
89
  "--shadow-popout",
85
90
  "--soft-bg-mix",
86
91
  "--soft-border-mix",