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
@@ -0,0 +1 @@
1
+ export declare function readDataFlag(element: any, name: any, defaultValue?: boolean): boolean;
@@ -0,0 +1,6 @@
1
+ export declare const loaderState: {
2
+ enhancements: Map<any, any>;
3
+ scriptLoads: Map<any, any>;
4
+ styleLoads: Map<any, any>;
5
+ importModule: (url: any) => Promise<any>;
6
+ };
@@ -23,5 +23,3 @@ export declare function loadResponse(response: any): Promise<{
23
23
  failed: never[];
24
24
  skipped: never[];
25
25
  }>;
26
- export declare function __setModuleImporter(fn: any): void;
27
- export declare function __reset(): void;
@@ -1,2 +1 @@
1
1
  export declare function parseConfig(source: any): any;
2
- export default parseConfig;
@@ -0,0 +1,2 @@
1
+ export declare function showPopover(element: any): boolean;
2
+ export declare function hidePopover(element: any): void;
@@ -2,4 +2,3 @@ export declare function status(message: any, options?: {}): void;
2
2
  export declare namespace status {
3
3
  var clear: () => void;
4
4
  }
5
- export default status;
@@ -63,6 +63,10 @@ export type TooltipState = {
63
63
  * Pointer is over the tooltip.
64
64
  */
65
65
  overTip: boolean;
66
+ /**
67
+ * A touch tap pinned the tip open.
68
+ */
69
+ tapped: boolean;
66
70
  };
67
71
  /** True while the tip is promoted. The runtime's state, not :popover-open. */
68
72
  export declare function isTooltipVisible(tip: any): boolean;
@@ -6,7 +6,12 @@ export declare class FormValidator {
6
6
  alnum(v: any): boolean;
7
7
  "starts-with"(v: any, _el: any, ...prefixes: any[]): boolean;
8
8
  "ends-with"(v: any, _el: any, ...suffixes: any[]): boolean;
9
- date(v: any): boolean;
9
+ /**
10
+ * @param {string} v
11
+ * @param {Element | null} [_el]
12
+ * @param {string} [format]
13
+ */
14
+ date(v: string, _el?: Element | null, format?: string): boolean;
10
15
  "tel-prefix"(value: any, _el: any, ...prefixes: any[]): boolean;
11
16
  };
12
17
  static registerRule(name: any, callback: any): void;
@@ -14,4 +19,3 @@ export declare class FormValidator {
14
19
  static clearFieldError(el: any): void;
15
20
  static setErrors(form: any, errors: any): void;
16
21
  }
17
- export default FormValidator;
@@ -36,7 +36,74 @@ permits. The component contains no JavaScript and does not manage routing.
36
36
  The icon slot accepts SVGs, images, and decorative elements such as icon-font
37
37
  `i` elements marked with `aria-hidden="true"`.
38
38
 
39
+ ## Usage
40
+
41
+ - A tile is a direct-child `a` or `button`. Use a button for an action that is
42
+ not a destination, such as a "More" button that opens a
43
+ [drawer](drawer.md) holding the secondary destinations.
44
+ - `aria-current="page"` goes on a link only. When the current page lives in
45
+ the "More" drawer, mark the link in the drawer, not the button: the button
46
+ opens a group of destinations and keeps `aria-expanded`.
47
+ - A disabled destination is a `button` with `disabled`.
48
+
49
+ ## Header and footer
50
+
51
+ Inside `.app-layout`, side navigation can carry a brand and a primary action
52
+ above the destinations and an account block below them. Put them in one
53
+ direct-child `header` and one direct-child `footer`. The header's first child,
54
+ usually the brand, shares the topbar's band; anything after it stacks below.
55
+ The footer sits at the block end and follows the last link when the
56
+ destinations outgrow the viewport. An account menu there is a
57
+ [flyout](../enhancements/flyout.md) opening upward
58
+ (`data-flyout-placement="top-start"`); the
59
+ [Tasks template](../../demo/templates/tasks.html) has one.
60
+
61
+ ```html
62
+ <nav class="app-nav" aria-label="Primary">
63
+ <header>
64
+ <a class="navbar-brand" href="/">Fieldwork</a>
65
+ <a class="btn primary" href="/new">New task</a>
66
+ </header>
67
+ <a href="/today" aria-current="page">…</a>
68
+ <a href="/tasks">…</a>
69
+ <footer>
70
+ <button class="btn ghost" type="button">Account</button>
71
+ </footer>
72
+ </nav>
73
+ ```
74
+
75
+ Both are optional. Without a `header`, the brand belongs in the topbar, which
76
+ then spans the navigation; see
77
+ [App layout](../layout/app-layout.md#where-the-brand-lives).
78
+
79
+ At most one of each per `.app-nav`. The bottom bar hides both: it has room for
80
+ destinations only, so give their content a second home on a phone — identity in
81
+ the topbar, the primary action in a [FAB](fab.md), the account behind a button
82
+ tile that opens a bottom-sheet [drawer](drawer.md) with the same items. The
83
+ [Tasks template](../../demo/templates/tasks.html) shows that account tile; it
84
+ hides the tile from the side breakpoint, where the footer takes over. Use an
85
+ SVG or icon-font glyph in the tile: the icon slot sizes its font to
86
+ `--app-nav-icon-size`, which an avatar's initials do not survive.
87
+
88
+ ## Rail
89
+
90
+ Set `data-nav="rail"` on `.app-layout` to show the side navigation as a narrow
91
+ rail. Each tile keeps its label as a small caption under the icon, as in the
92
+ bottom bar, so the rail needs no tooltip. Two-word labels wrap onto a second
93
+ line; keep labels to one or two short words. The bottom bar ignores the
94
+ attribute.
95
+
96
+ The application owns the preference: the toggle, its label, and persisting the
97
+ choice. What the header and footer show on the rail, such as a compact brand
98
+ mark, is application CSS keyed to the same attribute. See
99
+ [App layout](../layout/app-layout.md#rail).
100
+
39
101
  ## Hooks
40
102
 
41
103
  - `--app-nav-size` controls the minimum bottom-bar size.
42
104
  - `--app-nav-gap` controls spacing between destinations.
105
+ - `--app-nav-current-bg` and `--app-nav-current-fg` repaint the current state,
106
+ for example a soft tint instead of the selected fill. The bottom bar and the
107
+ rail paint a pill around the icon and keep the label in the bar's ink;
108
+ labelled side navigation fills the whole row. The fill is the only current
109
+ cue, so keep it distinct from the navigation surface.
@@ -369,3 +369,6 @@ on its components. Tap both rows on a phone to compare:
369
369
  Change it in `:hover`/`:active` rules for a lift and press.
370
370
  Supply shadow-list items; use `0 0 #0000` for no elevation. `none` cannot
371
371
  compose with the inset hover overlay and invalidates the whole shadow list.
372
+ - Solid buttons paint the [`--finish`](../foundations/tokens.md#finish) token
373
+ over their fill, and the hover darkens both. `.outline`, `.ghost`, `.link`,
374
+ `.soft` and `.surface` stay flat.
@@ -534,6 +534,9 @@ Available options:
534
534
  `closedby="none"`. Use `closedby="none"` for critical dialogs that must be
535
535
  closed by an explicit action.
536
536
 
537
+ Set a `data-dialog-*` toggle to `false` to disable it, in any letter case.
538
+ An empty attribute enables the option.
539
+
537
540
  ### Open on load
538
541
 
539
542
  Add `data-dialog-open` to show a dialog without a trigger, for example a
@@ -183,12 +183,25 @@ non-zero `--list-item-pad-inline`: without that gutter, the current indicator
183
183
  touches the leading region and the trailing touches the row edge. `.grouped`
184
184
  sets that gutter already.
185
185
 
186
+ ### Completion beside a navigable row
187
+
188
+ A task row both opens its record and completes it: two controls that must not
189
+ nest. Keep the link as the row and overlay a `label` holding the checkbox on
190
+ the link's leading gutter, positioned against the `li`. The link keeps the
191
+ whole row's hover, current, focus and forced-colors states, so the selection
192
+ and the completion stay independent. The
193
+ [Tasks template](../../demo/templates/tasks.html) has the recipe (checkbox,
194
+ done task, todo item, check off).
195
+
186
196
  ## Hooks
187
197
 
188
198
  - `--list-item-min-size` controls the row's minimum touch height.
189
199
  - `--list-item-pad-block` and `--list-item-pad-inline` control row padding.
190
200
  `.grouped` raises the inline padding to a standalone surface's gutter; set
191
201
  the hook on the list to choose another.
202
+ - `--list-current-inset-block` controls the inset at both ends of the current
203
+ row's indicator. It follows `--list-item-pad-block` by default. Set it to
204
+ `0` for a full-height indicator that follows the corners of a grouped row.
192
205
  - `--list-item-gap` controls spacing between the regions a row actually has.
193
206
  - `--list-divider` controls the inter-row dividers, and the leading divider on
194
207
  a bare list. `.grouped` replaces that leading divider with its shell border.
@@ -73,6 +73,7 @@ marker to that background rather than to the neutral intent.
73
73
  - `--meter-track` — track color; raise it when the meter sits on a
74
74
  `--surface-subtle` card, where the default track would disappear.
75
75
  - `--bar-height` — bar thickness, shared with `.progress`.
76
+ - `--bar-radius` — corner of the track and the value, shared with `.progress`; `0` squares the bar.
76
77
  - `--meter-value` — relative weight of a direct child in a segmented meter.
77
78
 
78
79
  `.sm` / `.lg` are intentionally not supported: a bar keeps its inline size and only changes
@@ -32,6 +32,7 @@
32
32
  - `--progress-track` — unfilled track color.
33
33
  - `--progress-value` — filled bar color. Prefer an intent class over setting this directly.
34
34
  - `--bar-height` — bar thickness, shared with `.meter`.
35
+ - `--bar-radius` — corner of the track and the value, shared with `.meter`; `0` squares the bar.
35
36
 
36
37
  `.sm` / `.lg` are intentionally not supported: a bar keeps its inline size and only changes
37
38
  thickness, and a design asks for a 4px or a 12px bar, not for a "small" one. Set the hook
@@ -110,12 +110,15 @@ which both stacks it and gives the tabs runtime Up and Down.
110
110
  - `--segmented-pad` — inset between the track and its segments, also the gap
111
111
  between segments; the segment radius is the track radius minus it.
112
112
  - `--segmented-radius` — track corner radius.
113
- - `--segmented-fg` — label ink of the unselected segments; the selected one
114
- takes `--text`.
113
+ - `--segmented-fg` — label ink of the unselected segments.
115
114
  - `--segmented-selected-bg` — fill of the selected segment: `--surface-raised`
116
115
  in a light scheme, lifted above the track in a dark one. Its shadow follows
117
- `--shadow`; a flat theme sets `--shadow-color: transparent`, not
118
- `--shadow: none`, which would also drop the edge below.
116
+ `--shadow-control`, or `--shadow` when that is unset; a flat theme sets
117
+ `--shadow-color: transparent`, not a shadow to `none`, which would also drop
118
+ the edge below. The track takes `--shadow-inset`.
119
+ - `--segmented-selected-fg` — label and inset focus ring color for a custom
120
+ selected fill. Set it on the track or inherit it from a theme. Pair it with
121
+ the fill: 4.5:1 for the label, which also gives the ring its 3:1.
119
122
  - `--segmented-selected-border` — hairline around the selected segment, none
120
123
  by default. Set it once on a theme root, for example a flat light theme,
121
124
  where fill and ink alone barely set the selected segment apart from the
@@ -214,7 +214,10 @@ on one record at a time, use a [list with row actions](list.md).
214
214
 
215
215
  ## CSS hooks
216
216
 
217
- - `--table-cell-pad` — cell padding; `.compact` re-declares it tighter.
217
+ - `--table-cell-pad` — cell padding, a single length; `.compact` re-declares
218
+ it tighter.
219
+ - `--table-radius` — the corner radius of `.table-wrap`. The first and last
220
+ columns and the caption pad at least this much, so text clears the curve.
218
221
  - `--table-min` — minimum table width before `.table-wrap` scrolls horizontally.
219
222
  - `--table-header-bg`, `--table-header-fg` — header band fill and ink. Set
220
223
  them on a theme root rather than on `.table`: a data grid bridge reads the
@@ -170,6 +170,38 @@ from assistive technology.
170
170
  </section>
171
171
  ```
172
172
 
173
+ ## Dates at the start
174
+
175
+ `.timeline-dates-start` sets every `<time>` in a column before the rail, as a
176
+ log or an audit trail reads: the eye runs down the times, then across to the
177
+ events. The column is as wide as the longest dateline, so every rail lines up
178
+ whatever the dates say, and the list keeps that alignment in a wide column.
179
+
180
+ Write the `<time>` first, after an optional icon or avatar, and make every
181
+ other piece of the event an element: bare text beside the time would become
182
+ its own grid item. Wrap a sentence that mixes text and links in one `<span>`
183
+ or `<p>`. Without subgrid support the dateline stays above the title.
184
+
185
+ ```html demo
186
+ <ol class="timeline timeline-dates-start">
187
+ <li>
188
+ <time datetime="2026-11-22T21:04">21:04</time>
189
+ <strong>Mara Voss</strong>
190
+ <p class="muted">Posted the job: a ledger out of the archive annex.</p>
191
+ </li>
192
+ <li class="primary">
193
+ <time datetime="2026-11-22T21:32">21:32</time>
194
+ <strong>Ghostwrite</strong>
195
+ <p class="muted">Rewrote the badge log for the service lift.</p>
196
+ </li>
197
+ <li class="warning">
198
+ <time datetime="2026-11-21">Yesterday</time>
199
+ <strong>Relay</strong>
200
+ <p class="muted">Trace detected on node 3F. <a href="#">Link rerouted</a>.</p>
201
+ </li>
202
+ </ol>
203
+ ```
204
+
173
205
  ## Activity feed
174
206
 
175
207
  Avatars as markers, the actor and verb as one sentence, and richer content
@@ -192,6 +192,10 @@ script, closes it and stays where it landed; Escape is the key that returns
192
192
  focus to the trigger. `false` keeps the flyout open there too, so a persistent
193
193
  panel must not cover the controls around it.
194
194
 
195
+ A click on a text field, a select or a textarea, or on its label, never closes
196
+ the flyout either: it starts an edit, so an action menu can hold a field, such
197
+ as a theme select in an account menu. A checkbox or radio click is a pick.
198
+
195
199
  Arrow keys and Space in a radio group never close the flyout: they move
196
200
  through the options, and a pointer pick closes it. Opening from the keyboard
197
201
  focuses a group at its checked radio. The [palette picker](../forms/color-swatches.md#palette-in-a-flyout)
@@ -218,7 +222,8 @@ relies on both.
218
222
  | `.menu` | Component | Action-list primitive. |
219
223
  | `.menu-item` | Component | One action row; joins roving focus. |
220
224
  | `.menu-item-icon` | Slot | Fixed leading column for an icon. |
221
- | `.menu-item-text` | Slot | Flexible label column; truncates. |
225
+ | `.menu-item-text` | Slot | Flexible label column for plain or rich text. |
226
+ | `.menu-item-desc` | Slot | Wrapping secondary line inside the label. |
222
227
  | `.menu-item-end` | Slot | Trailing shortcut, badge or status. |
223
228
  | `.menu-label` | Variant | Muted, non-interactive group heading. |
224
229
  | `.menu-separator` | Variant | Divider row between groups. |
@@ -307,13 +312,17 @@ records which patterns Biome rejects, and which of its findings were right.
307
312
  Wrap rich item content in the three optional slots when a menu needs aligned
308
313
  icons or trailing metadata. Keep decorative icons hidden from assistive
309
314
  technology. Plain text directly inside `.menu-item` remains valid for simple
310
- actions.
315
+ actions. Put a description inside `.menu-item-text` with `.menu-item-desc`. The
316
+ label and description can wrap together, with the icon aligned to the start
317
+ of the row.
311
318
 
312
319
  ```html
313
320
  <li>
314
321
  <button class="menu-item" type="button" role="menuitem">
315
322
  <span class="menu-item-icon" aria-hidden="true">…</span>
316
- <span class="menu-item-text">Duplicate</span>
323
+ <span class="menu-item-text">
324
+ Duplicate <span class="menu-item-desc">Create a copy in this workspace</span>
325
+ </span>
317
326
  <span class="menu-item-end"><kbd>⌘D</kbd></span>
318
327
  </button>
319
328
  </li>
@@ -14,6 +14,8 @@ by promoting it to the top layer with `popover="manual"`.
14
14
  tooltip. Use a [flyout](flyout.md#contextual-help) for contextual help with
15
15
  links or buttons.
16
16
  - Show on hover and keyboard focus. Hide on Escape, blur, pointer leave, or a pointer press on the trigger.
17
+ - On touch, a tap opens the tooltip and still activates the trigger. A second tap, a tap elsewhere, Escape, or a dialog or popover opening closes it.
18
+ - Add `data-tooltip-no-tap` when the tooltip only repeats the trigger's accessible name, such as an icon button's `aria-label`: the tap then just runs the action.
17
19
  - A trigger scrolled out of view takes its tooltip down and brings it back when it returns; only a dismissal ends the tooltip.
18
20
  - Escape dismisses the tooltip without moving the pointer or focus (WCAG 2.1 SC 1.4.13).
19
21
  - After Escape or a pointer press dismisses a hover or focus tooltip, move the pointer away and back or return with keyboard focus to show it again.
@@ -21,6 +23,7 @@ by promoting it to the top layer with `popover="manual"`.
21
23
  - JavaScript can generate tooltip elements from `data-tooltip`.
22
24
  - Add `data-tooltip-click` to make a supplemental description open on click.
23
25
  - Add `data-tooltip-visible` to show it immediately and keep it visible while its trigger is in view.
26
+ - Set `data-tooltip-click`, `data-tooltip-visible` or `data-tooltip-no-tap` to `false` to disable the option, in any letter case.
24
27
  - Use `data-tooltip-placement` to set the preferred placement (default `top`).
25
28
  - The arrow inherits the tooltip background — custom gradients carry through automatically.
26
29
  - Avoid relying on the native `title` attribute as the primary implementation.
@@ -90,7 +93,9 @@ floating content contains controls.
90
93
  The `data-tooltip="…"` shorthand is intentionally plain text. For trusted HTML,
91
94
  use an explicit tooltip referenced by `aria-describedby`. Keep its content
92
95
  non-interactive and concise; long content wraps up to the tooltip's
93
- viewport-aware maximum width.
96
+ viewport-aware maximum width. A hover card (preview card, profile peek) is the
97
+ same explicit tooltip with a richer body; once it holds links or buttons, it is
98
+ a flyout.
94
99
 
95
100
  ```html demo
96
101
  <button class="btn" type="button"
@@ -29,15 +29,19 @@ Whole pages, composed the way a real product would.
29
29
  - [Order management](../../demo/templates/order-management.html) - one state at three levels (a badge in a selectable list, a message in context, a notification with its own action) composed on the `admin-neutral` business-interface theme
30
30
  - [App](../../demo/templates/app.html) - application shell with sidebar
31
31
  - [Workspaces](../../demo/templates/workspaces.html) - sectioned sidebar, master/detail list with native current state, and workspace cards
32
+ - [Tasks](../../demo/templates/tasks.html) - inset workspace with one divided surface, a `.measure` editor, and a single-pane task flow on mobile. Edits apply immediately and reset on reload.
33
+ - [TodoMVC](../../demo/templates/todomvc.html) - a buildless task list with hash routing, local persistence, and presentation derived from HTML state. See the [implementation notes](#todomvc).
32
34
  - [Marketing](../../demo/templates/marketing.html) - landing page with typography and fluid type
33
35
  - [Blog](../../demo/templates/blog.html) - article page with prose
34
36
  - [Changelog](../../demo/templates/changelog.html) - release notes on a `.timeline`: version and date beside the rail on wide containers, and a light on the rail that runs from the first release to the last as the page scrolls
35
37
  - [Settings modal](../../demo/templates/settings-modal.html) - two-pane preferences dialog opening on load with `data-dialog-open`, with the local CSS it needs audited rule by rule
36
- - [Modal patterns](../../demo/templates/modal-patterns.html) - eight application modals, each the modal surface plus the smallest application CSS it needs
38
+ - [Modal patterns](../../demo/templates/modal-patterns.html) - nine application modals, including a confirmation with detached actions
37
39
  - [Workspace settings](../../demo/templates/settings-pricing.html) - plans with visible native choices, preferences and segmented tabs
38
40
  - [iOS-style settings](../../demo/templates/settings-ios.html) - iOS-like controls and grouped settings from unchanged framework markup, a local theme, and its findings listed rule by rule
41
+ - [Surface form](../../demo/templates/surface-form.html) - workshop booking with flat, outlined, inset-shadow and lower-edge fields on a blue surface, with visible keyboard focus and validation
39
42
  - [Card compositions](../../demo/templates/card-compositions.html) - editorial, team, sign-in and horizontal cards composed from existing primitives
40
43
  - [Neo-brutalist](../../demo/templates/neo-brutalist.html) - a risograph print studio on the `neo-brutalist` theme (order alerts, plus-marker FAQ, ruled testimonial grid, docked cookie banner) with the page loading its own fonts
44
+ - [Cyberdeck](../../demo/templates/cyberdeck.html) - a relay station console on the `cyberdeck` theme (bevelled frames, segmented gauges, diamond markers, printed switch states, link-card reticle) with page-level micro-print
41
45
  - [Register form](../../demo/templates/register-form.html) - registration page with choice cards, masks, the password toggle, `tel-prefix` validation, an OTP verification dialog, and status feedback
42
46
 
43
47
  ### Layout references
@@ -78,6 +82,31 @@ and extension points.
78
82
  - [File upload](../../demo/templates/file-upload.html) - the native file input, Dropzone rendering its file rows as Actual components, and FilePond on Actual tokens
79
83
  - [Diagrams](../../demo/templates/diagrams.html) - Mermaid timelines, Gantt charts and flowcharts drawn by Pele through a small web component, on Actual tokens
80
84
 
85
+ ## TodoMVC
86
+
87
+ [Open the demo](../../demo/templates/todomvc.html) ·
88
+ [View source](https://github.com/lekoala/actual-css/blob/master/demo/templates/todomvc.html) ·
89
+ [Read the functional spec](https://github.com/tastejs/todomvc/blob/master/app-spec.md)
90
+
91
+ Serve the checkout with `bun scripts/serve.js` and open
92
+ `/demo/templates/todomvc.html` on localhost. The page loads Actual's CSS
93
+ modules directly from `src/css` and runs its own inline JavaScript. Tasks start
94
+ empty and are saved to the browser's local storage.
95
+
96
+ - CSS reads checkbox state to style completed titles and show Clear completed.
97
+ It reads list contents to show the controls and queries the card's width to
98
+ lay out the toolbar. Actual's theme follows the system scheme.
99
+ - JavaScript owns the task records, hash filtering, active count, and focus.
100
+ Filtered rows retain their task checkboxes and use `hidden`. This lets Clear
101
+ completed reflect the entire list while the active filter is in use.
102
+ - The demo uses Actual's own markup and styles. It adds a visible-on-focus Edit
103
+ button alongside double-click editing, so keyboard and touch users can edit
104
+ tasks. Delete and Edit stay visible on touch screens.
105
+
106
+ The [browser acceptance tests](https://github.com/lekoala/actual-css/blob/master/tests/browser/todomvc.test.js)
107
+ exercise the behaviors from the spec. Run them with
108
+ `bun test tests/browser/todomvc.test.js`.
109
+
81
110
  ## Sites
82
111
 
83
112
  Full sites demo living in `demo/sites`.
@@ -72,9 +72,10 @@ contrast contracts apply to the combobox for free:
72
72
  .actual-combobox {
73
73
  --cb-bg: var(--control-default-bg, var(--surface));
74
74
  --cb-color: var(--text);
75
- --cb-border-color: var(--form-invalid-border, var(--border));
75
+ --cb-border-color: var(--form-invalid-border, var(--control-default-border, var(--border-control)));
76
76
  --cb-border-radius: var(--radius);
77
77
  --cb-focus-color: var(--focus);
78
+ --cb-focus-width: var(--focus-ring-width);
78
79
  --cb-muted-color: var(--text-muted);
79
80
  --cb-error-color: var(--danger);
80
81
  --cb-control-height: var(--control-size);
@@ -110,18 +111,21 @@ contrast contracts apply to the combobox for free:
110
111
  The control reads the field geometry a theme gives `.input`: `--border-width`
111
112
  and the `--control-shadow` elevation, which focus keeps. Hover follows `.input`
112
113
  too (`--control-hover-border`), since the control is typed into, in place of
113
- the library's own border mix. While the search input
114
- is focused, the control takes the same inset outline as `.input` in place of
115
- the library's accent border and outer halo; a focused chip
116
- or remove × keeps the library's own inner ring. Being inset, the outline needs
117
- no adaptation inside `.join`: `combo-box` owns the radius at zero specificity,
118
- so the join gives it the group corners and the visible control inherits them. The invalid rule sets `--form-invalid-border`,
119
- the hook `.field.danger` and `aria-invalid` already use, so border and outline
120
- turn danger together.
114
+ the library's own border mix. While the search input is focused, the control
115
+ takes the same inset outline as `.input` in place of the library's accent
116
+ border; `--cb-focus-width` mirrors `--focus-ring-width`, so a focused chip or
117
+ remove × keeps the library's own inner ring at the field's width. Being inset,
118
+ the outline needs no adaptation inside `.join`: `combo-box` owns the radius at
119
+ zero specificity, so the join gives it the group corners and the visible
120
+ control inherits them. The invalid rule sets `--form-invalid-border`, the hook
121
+ `.field.danger` and `aria-invalid` already use, so border and outline turn
122
+ danger together.
121
123
 
122
124
  ### Limits
123
125
 
124
- The bridge shares the inherited resting field fill through `--control-default-bg`.
126
+ The bridge shares the inherited resting field fill and edge through
127
+ `--control-default-bg` and `--control-default-border`, falling back to
128
+ `--surface` and `--border-control` like `.input`.
125
129
  It follows tokens, not native-control selectors: local `--control-bg` overrides
126
130
  and theme-specific invalid or disabled fills need matching widget state rules.
127
131
 
@@ -43,3 +43,10 @@ The mixed shape `<label for="x">…<input id="x"></label>` is allowed by the spe
43
43
 
44
44
  `.field-label` works on a `<span>`, on a detached `<label for>`, or on a
45
45
  `<legend>`. `.required-mark` goes inside a label.
46
+
47
+ ### Hooks
48
+
49
+ - `--field-label-scale`: label size as a fraction of `--control-font-size`,
50
+ so it follows `.sm`/`.lg`. `1` sets labels at the field text size. Applies
51
+ to `.field-label` and the `.field-group.flush` legend; set it on `:root`, a
52
+ form, or a single field.
@@ -177,18 +177,21 @@ background shared by `.input`, `.textarea`, `.select` and external widget bridge
177
177
  Use `--control-bg` for a local field override; state rules still own readonly,
178
178
  disabled and validation fills.
179
179
 
180
- Set `--control-default-border` the same way for an inherited resting field
181
- edge, and `--control-border-block-end-color` / `-width` for a different lower
182
- edge. Together they keep the 3:1 cue on the lower edge alone; readonly and
183
- disabled fields drop that lower edge. Recipes: Foundations · Theming (lighter
184
- field borders).
185
-
186
- Set `--control-hover-border` to tune the hover border of `.input` and `.textarea`.
187
- Set `--control-hover-bg` to keep a `.select` background steady on hover, or give
188
- it a stronger fill.
180
+ Fields rest on the quiet `--border` edge, and on the 3:1 `--border-control`
181
+ edge under increased contrast. Set `--control-default-border: var(--border-control)`
182
+ for strong identification everywhere, and `--control-border-block-end-color` /
183
+ `-width` for a different lower edge; readonly and disabled fields drop that
184
+ lower edge. Recipes: Foundations · Theming (field borders).
185
+
186
+ `.input`, `.textarea` and `.select` share one hover: the border darkens and the
187
+ fill stays. Set `--control-hover-border` to tune that border, and
188
+ `--control-hover-bg` to add a hover fill — the cue a field needs when its hover
189
+ border is cleared.
189
190
  Set `--control-shadow` to give `.input`, `.textarea` and `.select` a resting
190
191
  elevation (unset by default). It inherits, so a theme can set it once on its
191
- root; keyboard focus and an open custom select keep it.
192
+ root; keyboard focus and an open custom select keep it. Unset, it falls back
193
+ to `--shadow-inset`, the recess fields share with the switch, range, progress
194
+ and segmented rails ([Elevation](../foundations/tokens.md#elevation)).
192
195
 
193
196
  ## Notes
194
197
 
@@ -127,7 +127,9 @@ deletion once `::slider-fill` is interoperable — see
127
127
 
128
128
  ## CSS hooks
129
129
 
130
- - `--range-thumb-size` — thumb diameter.
130
+ - `--range-thumb-size` — thumb height, which is also the control's height.
131
+ - `--range-thumb-inline-size` — thumb width; follows `--range-thumb-size` (a round thumb) unless set.
132
+ - `--range-thumb-radius` — thumb corner; `0` with a narrower width makes a block thumb. The focus ring follows both.
131
133
  - `--range-track-height` — track thickness.
132
134
  - `--range-thumb-bg` — thumb color. Defaults to the local intent, then `--primary`.
133
135
  - `--range-track-bg` — track color.
@@ -168,7 +168,7 @@ Custom rules live in `data-validation-rules` as a comma-separated list; each rul
168
168
  - `alnum` — Value is empty or letters and digits only.
169
169
  - `starts-with <token>…` — Value must begin with one of the literal tokens (`starts-with INV- CR-`). The value is trimmed before comparison; the match is case-sensitive.
170
170
  - `ends-with <token>…` — Value must end with one of the literal tokens (`ends-with .pdf .csv`). Trimmed, case-sensitive.
171
- - `date` — Value is a valid date in `yyyy-mm-dd`, `dd/mm/yyyy`, `mm/dd/yyyy`, `dd.mm.yyyy`, `mm.dd.yyyy`, `dd-mm-yyyy`, or `mm-dd-yyyy` shape; rejects non-existent dates like `2026-02-29`. ISO remains the recommended wire format because servers can parse it without guessing.
171
+ - `date [format]` — Validates a calendar date. Pass the format shown to the user, for example `date dd/mm/yyyy`, to enforce the order, separator and digit count. Supported formats are `yyyy-mm-dd`, `dd/mm/yyyy`, `mm/dd/yyyy`, `dd.mm.yyyy`, `mm.dd.yyyy`, `dd-mm-yyyy` and `mm-dd-yyyy`. With no format, the rule accepts any of these shapes, including one-digit days and months in year-last dates.
172
172
  - `tel-prefix <prefix>…` — A local number (its digits, with the usual separators `space ( ) . / -` ignored) passes; an explicit international number is normalized (`00` to `+`) and must match one of the literal prefixes (`tel-prefix +32`, `tel-prefix +32 +33 +352`). A value that is not dialing digits fails. With no prefix, only local input passes. The entered value is never modified.
173
173
 
174
174
  `starts-with` and `ends-with` options are literal tokens: no quoting, no escaping, and a token cannot contain whitespace. Without a token they fail rather than passing silently. `tel-prefix` without a prefix is instead a deliberate local-only policy.
@@ -214,7 +214,7 @@ The `date` rule pairs naturally with `data-mask` — the mask structures input,
214
214
  <span class="field-label">Date (ISO)</span>
215
215
  <input class="input" name="date-iso"
216
216
  data-mask="9999-99-99"
217
- data-validation-rules="date"
217
+ data-validation-rules="date yyyy-mm-dd"
218
218
  inputmode="numeric"
219
219
  autocomplete="off"
220
220
  placeholder="yyyy-mm-dd"
@@ -232,7 +232,7 @@ The `date` rule pairs naturally with `data-mask` — the mask structures input,
232
232
  <span class="field-label">Date (European)</span>
233
233
  <input class="input" name="date-eu"
234
234
  data-mask="99/99/9999"
235
- data-validation-rules="date"
235
+ data-validation-rules="date dd/mm/yyyy"
236
236
  inputmode="numeric"
237
237
  autocomplete="off"
238
238
  placeholder="dd/mm/yyyy"
@@ -58,6 +58,32 @@ type together is a component: give it a name in application CSS.
58
58
  `--card-pad`, `--cluster-justify`) are the API. Other custom properties are
59
59
  internal and may change.
60
60
 
61
+ ### Derive presentation from the state your HTML already exposes
62
+
63
+ | Layer | Responsibility |
64
+ | ----------- | --------------------------- |
65
+ | Application | Owns the data |
66
+ | JavaScript | Manages behavior |
67
+ | HTML | Exposes state and structure |
68
+ | CSS | Derives presentation |
69
+
70
+ Before adding a class, data attribute or listener for a visual change, look
71
+ for the state on the element or a related control. In the
72
+ [Tasks workspace](../../demo/templates/tasks.html), JavaScript updates the
73
+ task in the model, moves it between groups and sets the checkbox's `checked`
74
+ property. The row gets its completed appearance from that checkbox.
75
+
76
+ ```css
77
+ .task-row:has(.task-check .check:checked) .list-item-title {
78
+ color: var(--text-muted);
79
+ text-decoration: line-through;
80
+ }
81
+ ```
82
+
83
+ The same approach applies to a list's [empty state](../patterns/empty-state.md#no-results).
84
+ For a change that depends on available space, let [intrinsic layouts or
85
+ container queries](../layout/choosing.md) adapt the same markup in each context.
86
+
61
87
  ## Before adding CSS
62
88
 
63
89
  Go down the layers and stop at the first that answers the need: