actual-css 0.18.0 → 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 (61) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +7 -5
  3. package/components.json +6 -2
  4. package/dist/actual.full.css +272 -57
  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 +4 -0
  10. package/docs/navigation.json +3 -0
  11. package/docs/pages/components/aura.md +3 -0
  12. package/docs/pages/components/mark-sweep.md +42 -0
  13. package/docs/pages/components/rating.md +53 -22
  14. package/docs/pages/components/reveal.md +54 -0
  15. package/docs/pages/components/shimmer.md +3 -2
  16. package/docs/pages/enhancements/in-view.md +109 -0
  17. package/docs/pages/enhancements/overview.md +3 -2
  18. package/docs/pages/enhancements/scrollspy.md +5 -5
  19. package/docs/pages/examples/overview.md +5 -2
  20. package/docs/pages/forms/date-picker.md +3 -2
  21. package/docs/pages/forms/switch.md +25 -16
  22. package/docs/pages/foundations/tokens.md +37 -15
  23. package/docs/pages/foundations/typography.md +8 -2
  24. package/docs/pages/guides/introduction.md +1 -1
  25. package/docs/pages/guides/modular-import.md +1 -1
  26. package/docs/pages/guides/progressive-enhancement.md +2 -1
  27. package/docs/pages/guides/upgrading.md +1 -1
  28. package/docs/pages/patterns/code-block.md +1 -1
  29. package/docs/pages/patterns/empty-state.md +3 -3
  30. package/docs/pages/patterns/exclusive-accordion.md +3 -2
  31. package/docs/pages/patterns/hierarchical-nav.md +5 -4
  32. package/docs/pages/patterns/icon-input.md +1 -1
  33. package/docs/pages/patterns/icon-slot.md +4 -4
  34. package/docs/pages/patterns/intent-nesting.md +2 -3
  35. package/docs/pages/patterns/navigation-list.md +7 -4
  36. package/docs/pages/patterns/stat.md +3 -3
  37. package/docs/pages/patterns/structured-lists.md +1 -2
  38. package/llms.txt +2 -1
  39. package/package.json +3 -1
  40. package/reserved-classes.json +4 -0
  41. package/src/css/components/navbar.css +13 -5
  42. package/src/css/components/rating.css +23 -2
  43. package/src/css/components/scrollspy.css +4 -2
  44. package/src/css/core/base.css +16 -0
  45. package/src/css/core/focus.css +13 -12
  46. package/src/css/core/reset.css +10 -0
  47. package/src/css/core/theme.css +15 -0
  48. package/src/css/core/tokens.css +4 -10
  49. package/src/css/effects/aura.css +5 -0
  50. package/src/css/effects/index.css +2 -0
  51. package/src/css/effects/mark-sweep.css +64 -0
  52. package/src/css/effects/reveal.css +66 -0
  53. package/src/css/effects/shimmer.css +28 -10
  54. package/src/css/forms/choice.css +0 -7
  55. package/src/css/forms/switch.css +9 -9
  56. package/src/js/full.js +1 -0
  57. package/src/js/in-view.js +152 -0
  58. package/src/js/scrollspy.js +81 -2
  59. package/src/js/selectors.js +3 -0
  60. package/src/tooling/design-tokens.js +2 -0
  61. package/tokens.json +2 -0
@@ -2,24 +2,23 @@
2
2
 
3
3
  > Toggle controls that share a native checkbox at the markup level, with a switch visual.
4
4
 
5
- - The API is `class="switch"`. Use `role="switch"` for ARIA correctness.
6
- - The visual state tracks the native `checked` attribute. No JavaScript is required.
7
- - For strict ARIA correctness, keep `aria-checked` in sync. This is an enhancement, not the baseline.
8
-
9
5
  ```html demo
10
- <!-- Default: native state, no JS required. -->
11
- <input class="switch" type="checkbox" role="switch" checked />
6
+ <label class="choice">
7
+ <input class="switch" type="checkbox" role="switch" checked />
8
+ <span>Notifications</span>
9
+ </label>
12
10
  ```
13
11
 
14
- ```html demo
15
- <!-- Enhancement: keep aria-checked in sync. -->
16
- <input class="switch"
17
- type="checkbox"
18
- role="switch"
19
- aria-checked="true"
20
- checked
21
- onchange="this.setAttribute('aria-checked', this.checked)" />
22
- ```
12
+ ## Usage
13
+
14
+ - Apply `class="switch"` to a native checkbox and `role="switch"` for on/off semantics.
15
+ - Give it an accessible name through a label or `aria-label`.
16
+ - Use `checked` for the initial state and `.checked` to change it in JavaScript.
17
+
18
+ The browser exposes the native checked state to assistive technology; do not
19
+ add `aria-checked` or a change handler to synchronize it. The
20
+ [WAI-ARIA switch pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/)
21
+ uses the native checked state for checkbox inputs.
23
22
 
24
23
  Wrap a switch in `.choice` to pair it with a label. The switch stays
25
24
  top-aligned with the first line of text, so labels that wrap onto two lines —
@@ -58,6 +57,13 @@ naturally or via an explicit line break — still sit cleanly.
58
57
  </label>
59
58
  ```
60
59
 
60
+ ## Notification preferences
61
+
62
+ For a notification matrix with two switch columns (email and push), see the
63
+ [notification preferences composition](../../demo/templates/blocks.html#notification-preferences).
64
+ Use native table headers for the shared rows and columns, and give each switch
65
+ an accessible name that includes both its topic and channel.
66
+
61
67
  ## Sizing and alignment
62
68
 
63
69
  A switch is sized off the control typography, not field density. Its track
@@ -125,7 +131,10 @@ same optical line. Change the type or the control size and they stay level:
125
131
  </div>
126
132
  ```
127
133
 
128
- ## CSS hooks
134
+ ### Hooks
135
+
136
+ - `--switch-bg` — track fill; `--switch-border` follows it unless overridden.
137
+ - `--switch-border` — optional distinct edge; validation takes precedence.
129
138
 
130
139
  - `--choice-control-size` — shared size for inline choices; the switch track is
131
140
  this plus `0.125em`, so scaling it scales the checkbox and the switch together.
@@ -128,24 +128,45 @@ A theme with translucent surfaces overrides both with opaque values.
128
128
 
129
129
  `--border` separates surfaces: cards, tables, dividers, panels. `--border-control`
130
130
  is the resting edge that tells a control apart from the surface — fields,
131
- checkboxes and radios, switches, OTP cells, choice cards, join addons, neutral
131
+ checkboxes and radios, OTP cells, choice cards, join addons, neutral
132
132
  outline buttons, the color and file inputs. It is derived from `--text` and
133
- `--surface`; on the default palette it holds 3:1 against the surface, and
134
- `actual-css contrast` reports it for your theme. `--border-control-mix` sets
135
- the ink share; raise it when a tinted surface pulls the edge under 3:1. Without
136
- `color-mix()` it falls back to `--border`. Set `--border-control` itself to
137
- soften or strengthen controls (input border, field outline, form control
138
- contrast) without touching any separator. Hover, checked, invalid and disabled
139
- states keep their own colors.
133
+ `--surface`; on the default palette it holds 3:1 against `--surface` and
134
+ 2.9–3.0 against `--surface-subtle`. `actual-css contrast` reports it for your
135
+ theme. `--border-control-mix` sets the ink share; raise it when a tinted or
136
+ translucent surface pulls the edge under 3:1. The mix resolves at a theme
137
+ boundary: set it on `:root` or a `[data-theme]` island, because a plain container
138
+ inherits the colour already resolved above it. Without `color-mix()` it falls
139
+ back to `--border`. Set `--border-control` itself to soften or strengthen every
140
+ control in a subtree without touching a separator. Hover, checked, invalid and
141
+ disabled states keep their own colors.
142
+
143
+ ```css
144
+ /* Every control in one theme: */
145
+ [data-theme="custom"] {
146
+ --border-control-mix: 35%;
147
+ }
148
+
149
+ /* Only the text fields of one form. --control-border is the control's own
150
+ alias, so it has to be set on the control, not on an ancestor. */
151
+ .my-form :is(.input, .textarea, .select) {
152
+ --control-border: var(--border);
153
+ }
154
+ ```
155
+
156
+ Both reduce the contrast of the controls they touch; verify them in the context
157
+ they are used. The [border contrast lab](../../demo/templates/border-contrast.html)
158
+ renders the mix at 25, 35 and 45 % and measures both sides of the edge.
140
159
 
141
160
  Use `*-fg` pairs only for solid backgrounds where the component controls both foreground and background. Do not require a foreground token for every surface token.
142
161
 
143
- Focus uses an outline:
162
+ Focus uses an outline in `--focus`, independently of text color, intent or selection:
144
163
 
145
- - Links, summaries, nav items, and menu items use `--focus-outline-color`.
164
+ - Links, summaries, nav items, and menu items use the generic outside line.
146
165
  - Text fields use `--focus` inside their border.
147
166
  - Buttons, close controls, choices, and switches use `--focus` outside their border.
148
167
 
168
+ Invalid fields keep their validation color on the focus line.
169
+
149
170
  `--focus-ring-width` controls all these lines; `--focus-outline-offset` sets
150
171
  the outside gap. Choose `--focus` with at least 3:1 contrast against both
151
172
  `--surface` and `--surface-solid`. Forced colors use the system focus color.
@@ -154,17 +175,18 @@ the outside gap. Choose `--focus` with at least 3:1 contrast against both
154
175
  :root {
155
176
  --focus: hsl(268 30% 55%);
156
177
 
157
- --focus-outline-color: currentColor;
158
178
  --focus-outline-offset: 2px;
159
179
  --focus-ring-width: 2px;
160
180
  }
161
181
  ```
162
182
 
163
- The line is composed on the focused element, so a theme island or a region
164
- that sets `--focus-ring-width` widens links and buttons alike. Set
183
+ The line is composed on the focused element, so local `--focus` and
184
+ `--focus-ring-width` overrides reach links and buttons alike. Set
185
+ `--focus-outline-color` to override the generic line color; it has no default
186
+ declaration, and an author override inherits through theme islands. Set
165
187
  `--focus-outline` to replace the whole generic line (`4px dashed currentColor`);
166
188
  it has no default value. Application CSS that draws the generic line itself
167
- writes `var(--focus-ring-width) solid var(--focus-outline-color)`.
189
+ writes `var(--focus-ring-width) solid var(--focus-outline-color, var(--focus))`.
168
190
 
169
191
  ### Palette coherence
170
192
 
@@ -432,7 +454,7 @@ Motion durations keep transitions consistent and easy to disable.
432
454
  --duration-fast: 100ms; /* quick feedback */
433
455
  --duration-slow: 200ms; /* one-shot open/close */
434
456
  --duration-spin: 0.75s; /* continuous spin (.spinner) */
435
- --duration-shimmer: 1.2s; /* continuous shimmer (.skeleton, indeterminate .progress) */
457
+ --duration-shimmer: 2s; /* continuous shimmer (.shimmer, .skeleton, indeterminate .progress) */
436
458
  --ease-enter: cubic-bezier(0.2, 0, 0, 1);
437
459
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
438
460
  }
@@ -38,7 +38,7 @@ It applies everywhere — cards, dialogs, heroes, app shells — not only in pro
38
38
 
39
39
  It does not own visual hierarchy. No global `font-size` on headings, no global `font-weight` on headings, no global margins on headings, no global `text-decoration` on links. These choices would shape app UI in ways the framework cannot predict.
40
40
 
41
- The mildly opinionated defaults at the baseline are few: line-height on headings (tight, so multi-line headings stay readable), `text-wrap: balance` on headings where supported, the `hr` rule, the `::selection` rule, the `code` / `kbd` / `samp` / `pre` font family, `pre` overflow containment, `small` font size, and a global link underline offset that prose and components reuse. Everything else stays neutral so components and `.prose` can take over without fighting the baseline.
41
+ The mildly opinionated defaults at the baseline are few: line-height on headings (tight, so multi-line headings stay readable), `text-wrap: balance` on headings where supported, the `hr` rule, the `::selection` rule, the `mark` highlight pair, the `code` / `kbd` / `samp` / `pre` font family, `pre` overflow containment, `small` font size, and a global link underline offset that prose and components reuse. Everything else stays neutral so components and `.prose` can take over without fighting the baseline.
42
42
 
43
43
  Global links inherit color. The visual affordance of a link is the responsibility of `.prose` (for authored content) or of a component (for nav links, button-like links, tabs, breadcrumbs, etc.). Underlining every `a` globally would collide with all of those.
44
44
 
@@ -46,7 +46,7 @@ Global links inherit color. The visual affordance of a link is the responsibilit
46
46
 
47
47
  `.prose` is the opt-in rich-text scope. It owns the visual hierarchy of authored content.
48
48
 
49
- It owns: readable measure, vertical rhythm, heading hierarchy, link affordance, list spacing, description-list treatment, code and keyboard treatment, blockquote treatment, table treatment, image / figure / figcaption treatment, mark, and `text-wrap` balance / pretty for authored or generated rich-text descendants.
49
+ It owns: readable measure, vertical rhythm, heading hierarchy, link affordance, list spacing, description-list treatment, code and keyboard treatment, blockquote treatment, table treatment, image / figure / figcaption treatment, and `text-wrap` balance / pretty for authored or generated rich-text descendants.
50
50
 
51
51
  It does not own: page layout, app cards, alerts, forms, app tables, navigation, component variants, or any automatic styling outside the `.prose` subtree.
52
52
 
@@ -187,6 +187,12 @@ Three logical alignment utilities exist (`.text-start`, `.text-center`, `.text-e
187
187
 
188
188
  `transition: all` is not used. Transitions target specific properties. This is a general rule, not just a typography rule.
189
189
 
190
+ ## Mark
191
+
192
+ `mark` is styled at the baseline, not only inside `.prose`: a semantic highlight is a document affordance, and the UA's yellow ignores the theme. The pair is `--mark-bg` and `--mark-fg`, tuned to clear 4.5:1 in both schemes. Forced colors uses the system `Mark` / `MarkText` pair instead.
193
+
194
+ `<mark>` means the phrase is relevant in its context. A decorative highlight that only marks a phrase visually uses the [Mark Sweep](../components/mark-sweep.md) effect, which reuses the same pair.
195
+
190
196
  ## Small elements
191
197
 
192
198
  `small` gets a smaller font size globally (`0.875em`) because it is a semantic element, not a utility. There is no `.small` class competing with the element.
@@ -52,7 +52,7 @@ optimizing — the bare `actual-css` entrypoint and `actual-css/full` both resol
52
52
  to the complete compiled framework:
53
53
 
54
54
  ```html
55
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.18/dist/actual.full.min.css">
55
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.19/dist/actual.full.min.css">
56
56
  ```
57
57
 
58
58
  The package does not maintain separate partial bundles. Modular entrypoints map
@@ -218,7 +218,7 @@ cells, so they read as a list:
218
218
  - **Components** — `actual-css/css/components`
219
219
  buttons, surfaces, overlays, feedback, navigation, data and composed controls
220
220
  - **Effects** — `actual-css/css/effects`
221
- aura, shimmer
221
+ aura, mark-sweep, reveal, shimmer
222
222
  - **Utilities** — `actual-css/css/utilities`
223
223
  base and extra utilities
224
224
 
@@ -121,6 +121,7 @@ status bar, for example:
121
121
  | `actual-css/js/tab` | Tab panels and arrow-key navigation (token `tabs`) |
122
122
  | `actual-css/js/tooltip` | Tooltips on `data-tooltip` |
123
123
  | `actual-css/js/scrollspy` | Scroll-driven nav highlighting (token `scrollspy`) |
124
+ | `actual-css/js/in-view` | One-shot viewport appearance state (token `in-view`) |
124
125
  | `actual-css/js/filter` | Input value filtering on `data-filter` |
125
126
  | `actual-css/js/mask` | Input masks on `data-mask` |
126
127
  | `actual-css/js/password` | Password reveal toggle |
@@ -145,7 +146,7 @@ The JS is designed to run on its own, without Actual's stylesheet.
145
146
 
146
147
  - **`data-enhance` tokens** register named behaviors. The runtime discovers
147
148
  components through `data-enhance="tabs"`, `data-enhance="flyout"`, `data-enhance="range"`, `data-enhance="scrollspy"`,
148
- `data-enhance="validation"`, `data-enhance="dirty"`, and
149
+ `data-enhance="in-view"`, `data-enhance="validation"`, `data-enhance="dirty"`, and
149
150
  `data-enhance="ajax"` — no Actual presentation class needed.
150
151
  Self-describing attributes (`data-mask`, `data-tooltip`,
151
152
  `data-context-menu`) stay framework-neutral by construction.
@@ -119,7 +119,7 @@ layout.
119
119
  `var(--focus-outline)` and write the generic line instead:
120
120
 
121
121
  ```css
122
- outline: var(--focus-ring-width) solid var(--focus-outline-color);
122
+ outline: var(--focus-ring-width) solid var(--focus-outline-color, var(--focus));
123
123
  ```
124
124
 
125
125
  Setting `--focus-outline` still replaces the generic line.
@@ -1,6 +1,6 @@
1
1
  # Code block with copy button
2
2
 
3
- A self-contained copy-button recipe composed from `.btn`, a `pre > code` block, and the `enhance()` lifecycle.
3
+ Add a copy button to a code block with `.btn`, native code markup and the `enhance()` lifecycle.
4
4
 
5
5
  ```html
6
6
  <div class="code-block">
@@ -1,8 +1,8 @@
1
1
  # Empty state
2
2
 
3
- > A region with nothing to show yet: a first-run list, a cleared inbox, a
4
- > search with no results. Composed from layout primitives; there is no
5
- > empty-state component.
3
+ > Guide users when a list is empty or a search has no results, with a message and an optional next action.
4
+
5
+ Compose the region from layout primitives; there is no empty-state component.
6
6
 
7
7
  **Related terms:** blank slate, zero state, no data, no results, first run,
8
8
  placeholder content.
@@ -1,6 +1,6 @@
1
1
  # Exclusive accordion
2
2
 
3
- Browsers that support the `name` attribute on `<details>` get native exclusive accordions — no JS engine needed. Omit `name` to allow several open at once.
3
+ Keep one accordion panel open at a time with native `<details>` groups, without a JavaScript engine.
4
4
 
5
5
  ```html demo
6
6
  <details name="faq" open>
@@ -13,4 +13,5 @@ Browsers that support the `name` attribute on `<details>` get native exclusive a
13
13
  </details>
14
14
  ```
15
15
 
16
- Not shipping an accordion JS engine is a design decision, not a gap.
16
+ Browsers that support the `name` attribute on `<details>` enforce the group.
17
+ Omit `name` to allow several panels open at once.
@@ -1,6 +1,6 @@
1
1
  # Hierarchical scrollable nav
2
2
 
3
- App shell with a collapsible nav tree. Uses existing primitives only — no treeview component.
3
+ Build a scrollable sidebar with collapsible navigation groups using native details and existing primitives.
4
4
 
5
5
  **Related terms:** collapsible sidebar, nav group, sub-navigation, nested menu, expandable section, sidebar tree.
6
6
 
@@ -37,9 +37,10 @@ App shell with a collapsible nav tree. Uses existing primitives only — no tree
37
37
  - A group is a `<details>` inside a row `<li>`, never a direct child of the
38
38
  `<ul>`. Its `<summary class="nav-link">` takes the row, hover and focus, and
39
39
  a chevron that follows the native `[open]` state.
40
- - The group's links are a nested `.nav-list`, indented so its labels start
41
- under the parent label past a 1em icon. Set `--nav-list-indent` on the nav
42
- when the icons are larger.
40
+ - The group's links are a nested `.nav-list`: a rail under the centre of the
41
+ parent's icon, with the labels starting under the parent label. Set
42
+ `--nav-list-icon-size` on the nav when the icons are not 1em, and
43
+ `--nav-list-rail-color: transparent` for a plain indent without the line.
43
44
  - `.overline` labels a section of the nav.
44
45
  - `<details name="…">` makes the groups an exclusive accordion, without
45
46
  JavaScript.
@@ -1,6 +1,6 @@
1
1
  # Icon input
2
2
 
3
- Use `.input-icon` for a search or filter input with a leading icon.
3
+ Add a leading icon to a search or filter input with `.input-icon`, keeping the text clear of the icon.
4
4
 
5
5
  ```html demo
6
6
  <label class="input-icon">
@@ -1,9 +1,9 @@
1
1
  # Icon slot
2
2
 
3
- > Contained icon zones — a leading icon, an icon disc, a status marker — appear
4
- > across product UI: notifications, activity feeds, list actions, cards. There
5
- > is no dedicated primitive; the same small contract is composed from existing
6
- > pieces.
3
+ > Compose a stable icon box for notifications, activity feeds and cards, using existing layout primitives.
4
+
5
+ Use an icon slot for a leading icon, an icon disc or a status marker. There
6
+ is no dedicated primitive; compose the contract from existing pieces.
7
7
 
8
8
  A contained icon zone must be a **stable box** that never shrinks, always
9
9
  centers its glyph, and clips overflow:
@@ -1,7 +1,6 @@
1
1
  # Intent nesting
2
2
 
3
- An intent applies to the component carrying it. Nested components keep their
4
- own default intent unless you give them one:
3
+ Apply an intent to each component independently, so nested buttons and controls keep their own colors.
5
4
 
6
5
  ```html
7
6
  <div class="alert danger">
@@ -12,4 +11,4 @@ own default intent unless you give them one:
12
11
  ```
13
12
 
14
13
  The alert uses danger colors, Dismiss stays neutral, and Retry uses primary.
15
- Set an intent on each component that needs it.
14
+ Nested components keep their default intent unless you give them one.
@@ -1,9 +1,6 @@
1
1
  # Navigation list
2
2
 
3
- Use `.nav-list` for a vertical list of navigation links: it removes native list
4
- chrome, stacks the rows and stretches each `.nav-link` across the row. For a
5
- horizontal row of links, use `.cluster` on the list, which removes the list
6
- chrome too.
3
+ Arrange navigation links in vertical lists or horizontal rows using `.nav-list` and `.cluster`.
7
4
 
8
5
  ```html demo
9
6
  <div class="stack">
@@ -27,6 +24,12 @@ chrome too.
27
24
  </div>
28
25
  ```
29
26
 
27
+ ## Usage
28
+
29
+ `.nav-list` removes native list chrome, stacks the rows and stretches each
30
+ `.nav-link` across the row. For a horizontal row of links, use `.cluster` on
31
+ the list, which removes the list chrome too.
32
+
30
33
  Do not reset every list inside `nav`.
31
34
 
32
35
  ```css
@@ -1,8 +1,8 @@
1
1
  # Stat
2
2
 
3
- > One figure with its label, a detail line and an optional trend: KPI tiles,
4
- > dashboard summaries, metric cards. Composed from a card, a grid and a badge;
5
- > there is no stat component.
3
+ > Present a key figure with its label, supporting detail and optional trend for dashboards and KPI cards.
4
+
5
+ Compose it from a card, a grid and a badge; there is no stat component.
6
6
 
7
7
  **Related terms:** KPI, metric, statistic, figure, stat card, number tile,
8
8
  delta, trend indicator.
@@ -1,7 +1,6 @@
1
1
  # Structured lists
2
2
 
3
- Choose list markup from the content semantics, then add only the layout or
4
- component contract the collection needs.
3
+ Choose semantic list markup and compose the layout or component treatment that fits the collection.
5
4
 
6
5
  | Need | Use |
7
6
  | ----------------------------------------------- | ----------------------------------- |
package/llms.txt CHANGED
@@ -31,7 +31,8 @@ show supported CSS modules and individual enhancer imports without duplicating
31
31
  the full export list here.
32
32
 
33
33
  Presentation (`class`) and behavior are separate layers. `data-enhance` takes
34
- five built-in tokens — `tabs`, `flyout`, `range`, `scrollspy`, `validation`.
34
+ named tokens (`tabs`, `flyout`, `range`, `scrollspy`, `in-view`, `validation`,
35
+ `dirty`, `ajax`, `dialog`).
35
36
  Leaf behaviors whose opt-in also carries configuration use their own attribute
36
37
  (`data-tooltip`, `data-mask`, `data-filter`, `data-context-menu`), and `<dialog>`
37
38
  needs none. See
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "actual-css",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Plain CSS component framework with semantic classes, universal variants, small tokens, theme hooks, and progressive enhancements.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.4.4",
@@ -62,6 +62,7 @@
62
62
  "./js/focus": "./src/js/focus.js",
63
63
  "./js/focus-group": "./src/js/focus-group.js",
64
64
  "./js/input": "./src/js/input.js",
65
+ "./js/in-view": "./src/js/in-view.js",
65
66
  "./js/keys": "./src/js/keys.js",
66
67
  "./js/mask": "./src/js/mask.js",
67
68
  "./js/menu": "./src/js/menu.js",
@@ -131,6 +132,7 @@
131
132
  "report:neutral-ramp": "bun scripts/report-neutral-ramp.js",
132
133
  "report:dead-css": "bun scripts/report-dead-css.js",
133
134
  "report:overflow": "bun scripts/report-overflow.js",
135
+ "report:paint": "bun scripts/report-paint.js",
134
136
  "check:architecture": "bun scripts/check-css-architecture.js",
135
137
  "build:dist": "bun scripts/build-dist.js",
136
138
  "build:js": "bun scripts/build-js.js",
@@ -109,6 +109,7 @@
109
109
  "input-icon",
110
110
  "intent-color",
111
111
  "is-open",
112
+ "is-pending",
112
113
  "is-static",
113
114
  "items-baseline",
114
115
  "items-center",
@@ -139,6 +140,7 @@
139
140
  "margin-inline-auto",
140
141
  "margin-inline-end-auto",
141
142
  "margin-inline-start-auto",
143
+ "mark-sweep",
142
144
  "max-inline-size-none",
143
145
  "mbe",
144
146
  "mbs",
@@ -192,6 +194,8 @@
192
194
  "range",
193
195
  "rating",
194
196
  "required-mark",
197
+ "reveal",
198
+ "reveal-group",
195
199
  "reverse",
196
200
  "row-gap-context",
197
201
  "scroll-snap",
@@ -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
  }
@@ -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));
@@ -6,17 +6,11 @@
6
6
  for its keyboard focus indicator; forced colors keep outlines and drop
7
7
  shadows.
8
8
 
9
- Two contracts share the job, both --focus-ring-width wide. Text-like
10
- elements, whose ink is the thing being focused (links, summary, .nav-link,
11
- .menu-item, breadcrumb links, .navbar-brand), declare no outline and take
12
- the generic fallback below: a currentColor line that follows whatever the
13
- application painted. Boxed components, with a fill or border of their own,
14
- draw the themed ring instead — a solid line in --focus: inset on fields
15
- (inside their border box), offset by --focus-outline-offset on discrete
16
- actions. The color never derives from an intent or a local
17
- surface — the theme guarantees --focus at 3:1 against both --surface and
18
- --surface-solid, so one token reads on the page, on a solid band and on
19
- any nested surface.
9
+ All default indicators use --focus, independently of intent, selection or
10
+ text color. Components adapt the geometry: inset on fields (inside their
11
+ border box), offset by --focus-outline-offset on discrete actions. Themes
12
+ target 3:1 against --surface and --surface-solid; other painted backgrounds
13
+ still need their own contrast check.
20
14
 
21
15
  A .segment is an action but takes the inset ring: its track's padding is
22
16
  narrower than an offset ring, which would cover the neighbouring segment.
@@ -28,9 +22,16 @@
28
22
 
29
23
  Public hooks:
30
24
  --focus-outline (fallback-only: replaces the whole generic line)
25
+ --focus-outline-color (fallback-only: overrides the generic line color)
31
26
  */
32
27
  :focus {
33
- outline: var(--focus-outline, var(--focus-ring-width) solid var(--focus-outline-color));
28
+ /* Resolve the default on the target: a root alias would freeze --focus
29
+ before a theme island or a plain region could override it. Keeping the
30
+ color hook unset also lets an inherited author override cross islands. */
31
+ outline: var(
32
+ --focus-outline,
33
+ var(--focus-ring-width) solid var(--focus-outline-color, var(--focus))
34
+ );
34
35
  outline-offset: var(--focus-outline-offset);
35
36
  }
36
37
 
@@ -29,6 +29,16 @@ select {
29
29
  display: none !important;
30
30
  }
31
31
 
32
+ /* The UA hides a closed dialog from its own origin, so any author display
33
+ wins over it, even at zero specificity: `<dialog class="card">` stayed on
34
+ screen after its method="dialog" form closed it. Not !important, unlike
35
+ [hidden]: an important declaration outranks transitions, and the modal's
36
+ exit fade transitions display. A dialog that needs another closed display
37
+ says so with a more specific selector. */
38
+ dialog:not([open]) {
39
+ display: none;
40
+ }
41
+
32
42
  :where(img, svg, video) {
33
43
  max-inline-size: 100%;
34
44
  block-size: auto;