actual-css 0.15.0 → 0.16.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 (54) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +10 -7
  3. package/components.json +44 -1
  4. package/dist/actual.full.css +130 -9
  5. package/dist/actual.full.js +1 -1
  6. package/dist/actual.full.min.css +1 -1
  7. package/docs/design-notes/architecture.md +3 -0
  8. package/docs/design-notes/enhancement-contract.md +25 -3
  9. package/docs/design-notes/naming.md +6 -0
  10. package/docs/design-notes/steps.md +13 -2
  11. package/docs/design-notes/tokens.md +159 -0
  12. package/docs/pages/components/avatar.md +10 -0
  13. package/docs/pages/components/bleed.md +4 -0
  14. package/docs/pages/components/button.md +27 -7
  15. package/docs/pages/components/card.md +12 -7
  16. package/docs/pages/components/dialog.md +26 -0
  17. package/docs/pages/components/rating.md +29 -5
  18. package/docs/pages/components/steps.md +32 -16
  19. package/docs/pages/enhancements/overview.md +13 -20
  20. package/docs/pages/enhancements/status-bar.md +7 -9
  21. package/docs/pages/enhancements/tabs.md +11 -15
  22. package/docs/pages/enhancements/tooltip.md +10 -19
  23. package/docs/pages/forms/choice-cards.md +2 -1
  24. package/docs/pages/forms/joined-controls.md +4 -2
  25. package/docs/pages/forms/overview.md +1 -0
  26. package/docs/pages/foundations/philosophy.md +26 -62
  27. package/docs/pages/foundations/theming.md +21 -36
  28. package/docs/pages/foundations/tokens.md +91 -159
  29. package/docs/pages/guides/integrating-actual-css.md +1 -1
  30. package/docs/pages/guides/introduction.md +14 -14
  31. package/docs/pages/guides/progressive-enhancement.md +22 -0
  32. package/docs/pages/guides/upgrading.md +2 -2
  33. package/docs/pages/layout/choosing.md +28 -20
  34. package/docs/pages/layout/grid.md +8 -16
  35. package/docs/pages/patterns/intent-nesting.md +13 -1
  36. package/llms.txt +2 -1
  37. package/package.json +5 -3
  38. package/skills/actual-css/SKILL.md +5 -4
  39. package/skills/actual-css/references/api-and-vocabulary.md +2 -1
  40. package/src/css/components/app-nav.css +2 -0
  41. package/src/css/components/avatar.css +4 -2
  42. package/src/css/components/card.css +1 -1
  43. package/src/css/components/menu.css +2 -0
  44. package/src/css/components/rating.css +66 -0
  45. package/src/css/core/base.css +10 -1
  46. package/src/css/core/reset.css +5 -0
  47. package/src/css/core/theme.css +4 -1
  48. package/src/css/core/tokens.css +8 -2
  49. package/src/css/forms/form.css +15 -1
  50. package/src/css/forms/range.css +11 -1
  51. package/src/css/layout/measure.css +2 -0
  52. package/src/js/dialog.js +40 -9
  53. package/src/js/enhance.js +16 -3
  54. package/tokens.json +117 -0
@@ -1,25 +1,23 @@
1
1
  # Tokens
2
2
 
3
- The public theming surface — small, semantic global tokens that make the library easy to restyle without understanding every component's internals.
4
-
5
- The surface stays small by keeping most tokens semantic, not component-specific.
6
-
7
- - Global tokens are public API.
8
- - Component-local tokens are implementation details unless documented by that component.
9
- - Components should map global tokens to local variables internally.
10
- - Themes override tokens, not selectors.
11
- - Defaults must work without modern color features or build tooling.
12
- - Modern enhancements can derive better values with `color-mix()`, `light-dark()`, or container queries.
3
+ Tokens are CSS custom properties for colors, spacing, shape, type, and motion.
4
+ Override global tokens to restyle the whole system; use documented component
5
+ hooks for local changes.
13
6
 
14
7
  ## Public surface
15
8
 
16
- Component custom properties fall into three header categories in the source: **Public hooks** (author-facing customization points), **Framework plumbing** (shared relays consumed across components — `--ui-*`, `--intent*`, `--density-*`), and **Internal** (derived, state/variant-owned, or runtime-written). Documentation focuses on discovering the right hook and on non-obvious usage; the CSS source remains canonical for exact defaults and fallback chains.
9
+ Global tokens and documented component hooks are public API. Shared relays,
10
+ derived values, and properties written by JavaScript are internal.
17
11
 
18
- As a convention, component-prefixed properties owned by the component's base rule are usually author hooks. Properties owned by states/variants, derived from other hooks, or written by JavaScript are not. This convention is indicative, not algorithmic: runtime-written, derived, and state-relay properties stay internal even when their form resembles a hook.
12
+ Component pages list the useful hooks and their relationships. CSS source
13
+ headers classify properties as **Public hooks**, **Framework plumbing**, or
14
+ **Internal** and provide exact defaults and fallback chains.
19
15
 
20
16
  ### Where a token is declared
21
17
 
22
- A hook is only defined inside the scope that declares it. Reading one outside that scope is not an error a browser reports: `var()` resolves to nothing, the whole declaration becomes invalid at computed-value time, and the property falls back to its initial value — `padding: var(--card-pad)` outside a card computes to `0`, silently.
18
+ Use global tokens in application CSS. Component hooks are available only in
19
+ their component's scope: outside a card, `padding: var(--card-pad)` can silently
20
+ compute to `0`. Supply a fallback when reading a hook outside its component.
23
21
 
24
22
  | Scope | Declared on | Examples |
25
23
  | --------- | --------------------------- | -------------------------------------- |
@@ -27,7 +25,8 @@ A hook is only defined inside the scope that declares it. Reading one outside th
27
25
  | Component | the component's base rule | `--card-pad`, `--drawer-size` |
28
26
  | Relay | a variant, state, or script | `--ui-bg`, `--intent`, `--surface-pad` |
29
27
 
30
- Global tokens are the ones to reach for in application CSS. Write a relay only to override what a variant sets on one element (Button · Variants); read one only where its owner documents it (`--bleed-pad`). When you do want a component token outside its component — matching a bare block to the card rhythm, say — give `var()` the default explicitly, so the declaration survives where the hook is absent:
28
+ Use relays only where documented, such as Button variants or `--bleed-pad`.
29
+ To match a bare panel to a card's padding:
31
30
 
32
31
  ```css
33
32
  .panel {
@@ -48,14 +47,12 @@ hands down. Instance geometry stops at every new instance; policy inherits.
48
47
  | Role policy | `--form-actions-justify`, `--frame-ratio` | yes |
49
48
  | Instance geometry | `--cluster-justify`, `--grid-columns` | no |
50
49
 
51
- Set instance geometry on the element itself (a class or inline style), and
52
- select nested instances to change them (`.toolbar > .cluster`). Set a policy
53
- once on the region or on `:root` that owns it. A new hook follows the same
54
- test: "how this element lays out" stops at the element, "what this context
55
- hands down" inherits. The stop needs the instance to read its own hook:
56
- `.switcher` and `.sidebar-layout` hooks are read by their children, and a
57
- nested instance that is itself such a child still needs its parent's value,
58
- so those keep inheriting.
50
+ Set instance geometry on the element itself, with a class or inline style.
51
+ Select nested instances explicitly to change them (`.toolbar > .cluster`).
52
+ Set inherited policies on a region or `:root`.
53
+
54
+ The layout hooks of `.switcher` and `.sidebar-layout` inherit because their
55
+ children consume them; check their component pages when nesting layouts.
59
56
 
60
57
  ### Color
61
58
 
@@ -117,7 +114,15 @@ their own colors.
117
114
 
118
115
  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.
119
116
 
120
- Focus styling is outline-first. A global focus baseline draws a `--focus-ring-width` line in `--focus-outline-color`, offset by `--focus-outline-offset`: older browsers show it on `:focus`, while modern browsers limit it to `:focus-visible`. The baseline is a `currentColor` line, so text-like elements (links, `summary`, nav and menu items) follow whatever surface the application painted. Boxed components draw a solid `--focus-ring-width` line in `--focus`: inside the border box on text fields (`.input`, `.textarea`, `.select`), outside at `--focus-outline-offset` on actions (`.btn`, `.close`, choices, switches). The color never follows an intent or a local surface, so `--focus` must hold 3:1 against both `--surface` and `--surface-solid` — the page, fields and a solid band all rely on it. Both lines are `--focus-ring-width` wide. Under `forced-colors: active`, outlines map to the system focus color.
117
+ Focus uses an outline:
118
+
119
+ - Links, summaries, nav items, and menu items use `--focus-outline-color`.
120
+ - Text fields use `--focus` inside their border.
121
+ - Buttons, close controls, choices, and switches use `--focus` outside their border.
122
+
123
+ `--focus-ring-width` controls all these lines; `--focus-outline-offset` sets
124
+ the outside gap. Choose `--focus` with at least 3:1 contrast against both
125
+ `--surface` and `--surface-solid`. Forced colors use the system focus color.
121
126
 
122
127
  ```css
123
128
  :root {
@@ -137,15 +142,13 @@ writes `var(--focus-ring-width) solid var(--focus-outline-color)`.
137
142
 
138
143
  ### Palette coherence
139
144
 
140
- A coherent palette treats surfaces, text, borders, intents, and shadows as related roles rather than isolated colors.
141
-
142
- Coherence does not mean that every token must be chromatic. Pure or near-pure whites and blacks remain legitimate where their role calls for them; what matters is that the surrounding neutral ramp and derived treatments belong to the same visual family.
145
+ Choose surfaces, text, borders, intents, and shadows as one palette. Neutrals
146
+ may share an ambient hue; success, warning, and danger should remain
147
+ recognizable. These relationships are set in the theme values, not derived
148
+ from `--primary` at runtime.
143
149
 
144
- Neutral roles may lean toward the palette's ambient hue — by default the primary's — while lightness and chroma stay curated per role. Chroma runs strongest through the ramp's mid-lightness rungs, often around `--border` and `--text-muted` depending on the color scheme, and tapers toward both ends. A palette whose accent is deliberately warmer or cooler than its paper picks an ambient hue of its own.
145
-
146
- Semantic intents are curated colors, not mechanical derivatives of `--primary`. Danger, warning, and success stay recognizable for their function, but they are chosen as members of the theme palette rather than copied independently from a generic scale. Neither intents nor neutrals are derived from `--primary` at runtime: the relationship is a design decision recorded in the theme's own values.
147
-
148
- Color should reinforce structure and meaning, not carry them alone. Information hierarchy and semantic states should remain understandable when hue is removed or unavailable. Desaturating a composition is a useful review heuristic, not a conformance test.
150
+ Keep structure and state understandable without color. A grayscale review can
151
+ help reveal where labels, shapes, or other cues are missing.
149
152
 
150
153
  ### Default theme philosophy
151
154
 
@@ -188,7 +191,9 @@ A rule that re-derives a soft color reads it with the recipe's own fallback:
188
191
  mix. Both recipes are rendering-only — the baseline path below `color-mix()`
189
192
  keeps `var(--surface-subtle)` and `var(--border)`.
190
193
 
191
- `--soft-fg-mix` is the share of raw intent in soft *text*. At its `100%` default soft ink is the intent color itself, which is what a palette of dark, muted intents wants. A vivid or light palette cannot afford that: a soft badge then paints intent-tinted ink on an intent-tinted surface, and the two converge. Lowering the mix rebates the ink toward `--text`, which is the right direction in both schemes because `--text` is dark on a light theme and light on a dark one. Around `45%` a fully saturated palette recovers AA while the ink still reads as its intent.
194
+ `--soft-fg-mix` controls the share of intent color in soft text. Lower it to
195
+ move the text toward `--text` when a vivid or light intent lacks contrast.
196
+ Measure the result with `actual-css contrast`.
192
197
 
193
198
  Soft ink can also be corrected per role. The intent classes relay a per-role
194
199
  hook, and the soft recipe reads it before falling back to the global mix:
@@ -200,25 +205,18 @@ hook, and the soft recipe reads it before falling back to the global mix:
200
205
  intent class to its own `--*-soft-fg`.
201
206
  - `--soft-fg-mix` — the **global fallback derivation**, unchanged.
202
207
 
203
- **Soft foregrounds are calibrated against the darkest or closest interactive
204
- surface they are expected to appear on.** The tint is translucent, so the same
205
- pair reads differently on each surface — usually closest on `--surface-subtle`.
206
- For interactive soft treatments the fill moves toward the intent on hover
207
- (`--soft-hover-alpha`), so the binding pair is the *hovered* tint over
208
- `--surface-subtle` and the resting fill simply carries more margin; the default
209
- palette ships its own `--primary`/`--secondary`/… `-soft-fg` hooks to keep
210
- every pair ≥ 4.5:1 on `--surface`, `--surface-raised` and `--surface-subtle` in
211
- both color schemes, enforced by `tests/browser/soft-recipe.test.js`. The hard line stops at the default theme:
212
- presets and custom `[data-theme]` islands keep the `--soft-fg-mix` derivation
213
- unless they declare the hooks themselves (the framework resets them outside
214
- the default boundary). A theme that overrides the soft palette is responsible
215
- for preserving sufficient text contrast; `bunx --bun actual-css contrast --theme FILE`
216
- measures its resting and hovered pairs, composited on each of those surfaces.
217
-
218
- A theme whose primary should read more muted than its statuses sets only
219
- `--primary-soft-fg`, and every soft `.primary` foreground follows it. Without a
220
- `--*-soft-fg` the recipe resolves byte-identically to the old `--soft-fg-mix`
221
- derivation. A custom intent class provides the relay directly:
208
+ The default theme's soft text meets 4.5:1 contrast on `--surface`,
209
+ `--surface-raised`, and `--surface-subtle`, at rest and on hover in both schemes.
210
+ Custom themes must check their own pairs:
211
+
212
+ ```sh
213
+ bunx --bun actual-css contrast --theme src/theme.css
214
+ ```
215
+
216
+ Named themes fall back to `--soft-fg-mix` unless they declare per-role hooks.
217
+
218
+ Set `--primary-soft-fg` to change soft primary text without changing other
219
+ intents. A custom intent class provides its soft foreground directly:
222
220
 
223
221
  ```css
224
222
  .tertiary {
@@ -228,14 +226,6 @@ derivation. A custom intent class provides the relay directly:
228
226
  }
229
227
  ```
230
228
 
231
- **When an intent is tinted against a theme-controlled surface or border, the mix interpolates in `oklab`.** That covers the soft recipe, the checked `.choice-card` tint, and the `.overline.pill` border.
232
-
233
- Not because rectangular interpolation is more faithful to the intent hue — across the shipped presets it is a few degrees *less* faithful. A browser treats hue as powerless below a small chroma epsilon, so for the low-chroma surfaces and borders the presets actually use, a polar mix snaps cleanly onto the intent and wins.
234
-
235
- The reason is continuity. A theme owns `--surface` and `--border`, and may put them anywhere from achromatic to vivid. Under polar interpolation that range contains a cliff: below the epsilon the mix tracks the intent, above it the surface hue starts winning, and crossing it moves the result into a different color family — 116 degrees, a soft `.secondary` landing in the greens. Cartesian interpolation responds smoothly across the whole range a public token allows. A recipe that is only correct while an adopter's surface stays under an unstated, implementation-defined threshold is not a contract, so the framework trades a small continuous error for a predictable one. The present cost is imperceptible: the largest difference the rule introduces in any preset is 3/255 on one channel.
236
-
237
- Mixing against `black`, `white`, `transparent`, or `currentColor` is exempt and stays in `oklch`: those have no hue to interpolate, so both spaces give byte-identical results. Polar interpolation also stays legitimate where hue rotation is the point, such as sweeping a gradient through hues. `bun run check:color-space` enforces the rule for contextual tints and takes an `intentional-oklch` comment as an escape hatch.
238
-
239
229
  ### Shape
240
230
 
241
231
  Shape is intentionally small. Components can derive local radii from these.
@@ -268,7 +258,8 @@ Spacing should be useful without becoming a design-token encyclopedia.
268
258
  }
269
259
  ```
270
260
 
271
- Official steps are named in tens so the scale stays extensible. **Actual CSS will never define a `--space-*` token that is not a multiple of 10.** The intermediate names (`--space-15`, `--space-45`, …) are reserved for application-level interpolation: defining them is not writing into the framework namespace, it is using the half of the scale the framework has permanently given up.
261
+ Framework spacing names use multiples of 10. Intermediate names such as
262
+ `--space-15` and `--space-45` are reserved for application-defined steps.
272
263
 
273
264
  Use `em` for spacing that should scale with the component text size, such as button gaps and inline padding. Use `rem` for global rhythm, layouts, and fixed density.
274
265
 
@@ -421,7 +412,9 @@ Motion durations keep transitions consistent and easy to disable.
421
412
  }
422
413
  ```
423
414
 
424
- Ordinary interaction/state transitions have **no easing token**: they use the CSS default `ease` directly, and the dialog shake feedback plus the `actual-dialog` View Transition keep that default deliberately. The presence pair exists only for one-shot open/close where open and closed states own separate easing values (`.status-bar`/`.is-open`, `dialog.modal[open]`, `dialog.drawer[open]`): `--ease-enter` decelerates the appearance, `--ease-exit` accelerates the departure. The pair follows Material's standard rhythm; the emphasized-decelerate entrance is deliberately not offered because it only pays off at 250–400ms durations, beyond this vocabulary. Backdrops keep `ease` — a scrim only fades, it does not travel — but track their surface's duration. Toggles that share one transition list at `--duration-fast` (flyout, tooltip) also stay on `ease`: at 100ms the curve barely resolves and entry/exit cannot split on a single rule. These absences are deliberate, not gaps; a theme with a different motion character overrides `--ease-enter` / `--ease-exit`.
415
+ Use `--ease-enter` and `--ease-exit` to change how dialogs, drawers, and the
416
+ status bar appear and leave. Ordinary state transitions, flyouts, tooltips,
417
+ and backdrops use CSS `ease`.
425
418
 
426
419
  `reset.css` clamps raw animation and transition durations to `0.01ms`, resets their delays, and restores `html` scroll behavior under `prefers-reduced-motion: reduce`. Decorative loops effectively complete immediately without blanket-disabling animation support.
427
420
 
@@ -463,9 +456,13 @@ Under `forced-colors: active`, `--backdrop-fill` maps to `Canvas`.
463
456
 
464
457
  Two systems order overlays, and only one of them uses numbers.
465
458
 
466
- **The platform top layer** holds native `<dialog>` (modal, drawer) and every element currently showing as a popover — which, since the runtime drives flyouts, context menus and tooltips with `popover="manual"`, is all of Actual's anchored overlays. Top-layer ordering does not use `z-index`. Such an element always paints above the document, and its order among the others is its top-layer promotion order — the most recently promoted on top. A `z-index` declaration on it still computes; it just does not decide where it lands.
459
+ **The platform top layer** holds modal dialogs, drawers, and open popovers,
460
+ including runtime-managed flyouts, context menus, and tooltips. They appear
461
+ above the document, ordered by when they entered the top layer. `z-index`
462
+ does not change that order.
467
463
 
468
- **The document layer** is everything else, and the scale below is what orders it. Nothing in it can reach the other system: `z-index: 999999` on a document-layer element still paints under any open dialog or popover.
464
+ **The document layer** uses the scale below. Even a very high `z-index` stays
465
+ below the top layer.
469
466
 
470
467
  | Token | Value | Used by |
471
468
  | ------------ | ----- | ------------------------------- |
@@ -476,81 +473,38 @@ Two systems order overlays, and only one of them uses numbers.
476
473
  `.flyout` keeps the `--z-menu` declaration for a panel the runtime does not
477
474
  manage — one the platform has not promoted still stacks by number.
478
475
 
479
- `status-bar` is at the top of the document layer: above sticky bars and the FAB,
480
- and below any open dialog, menu or tooltip. That is the boundary between the
481
- two systems rather than a gap in the scale. Status messages are transient,
482
- non-critical feedback and their real contract is the live-region announcement
483
- — which is why `status.js` moves the singleton into an open modal dialog's
484
- subtree, since a modal inerts the rest of the document and promotion would not
485
- undo that.
476
+ The status bar sits above sticky bars and the FAB, and below the top layer.
477
+ For messages from a modal dialog, the runtime temporarily moves it inside the
478
+ dialog so the message remains visible and announced.
486
479
 
487
- Stacking-context traps: these apply to overlays painted in the page, not to promoted ones. An element that is a DOM descendant of a container with `transform`, `filter`, `contain`, `isolation`, or `will-change` is confined to that ancestor's stacking context, and its z-index token only orders it against siblings within that context. Promotion escapes all of it — but do not move the markup to chase the effect: a panel or tooltip used from inside a modal dialog must be authored *inside* that dialog, because the top layer does not lift an element out of a modal's inertness.
480
+ Document overlays can be confined by ancestor stacking contexts, such as those
481
+ created by `transform` or `isolation`. Top-layer overlays escape these contexts.
482
+ A panel or tooltip used in a modal dialog still needs to be authored inside
483
+ that dialog; promotion does not remove modal inertness.
488
484
 
489
485
  Scrollbar gutter: modal open/close can shift page layout when the classic scrollbar disappears. When a measured scrollbar is present, `modal.css` applies `scrollbar-gutter: stable` to the viewport so the page doesn't jump.
490
486
 
491
487
  ## Internal tokens
492
488
 
493
- Internal tokens are allowed when they reduce duplication or make component code clearer.
494
-
495
- ### Variant plumbing
496
-
497
- The shared visual variants are:
498
-
499
- - `.solid`: full background, paired foreground. This is the default for buttons.
500
- - `.soft`: lightly tinted background, colored text. Good for alerts, badges, and secondary actions.
501
- - `.outline`: transparent background, colored border and text.
502
- - `.surface`: the page surface with the theme border, and the intent only in the text. The neutral chrome neither `.soft` (the intent-tinted treatment) nor `.outline` (no fill) can give.
503
-
504
- Buttons also support two button-only variants:
505
-
506
- - `.ghost`: transparent button with hover affordance.
507
- - `.link`: button semantics with link presentation.
508
-
509
- Do not force `.ghost` or `.link` onto components where the interaction model does not fit. Shared API should follow shared use.
510
-
511
- Components map global tokens to local aliases once at the top of the component and consume local tokens afterwards:
512
-
513
- ```css
514
- .btn {
515
- --btn-bg: var(--ui-bg, var(--btn-default-bg, var(--intent, var(--neutral))));
516
- --btn-fg: var(--ui-fg, var(--btn-default-fg, var(--intent-fg, var(--neutral-fg))));
517
- --btn-border: var(--ui-border, var(--btn-default-border, transparent));
518
-
519
- border: var(--border-width) solid var(--btn-border-color, var(--btn-border));
520
- border-block-end-color: var(
521
- --btn-border-block-end-color,
522
- var(--btn-border-color, var(--btn-border))
523
- );
524
- border-block-end-width: var(--btn-border-block-end-width, var(--border-width));
525
- }
526
- ```
527
-
528
- The `--btn-*` fallbacks are intentionally inherited extension points for themes that change button grammar — such as turning the default solid button into a surface button with an intent-colored lower edge (the `edge` theme does exactly this). Keep them local until the same need appears across multiple components.
529
-
530
- Text controls (`.input`/`.textarea`/`.select`) expose the same lower-edge extension point: `--control-border-block-end-color` and `--control-border-block-end-width` are unset by default and fall back to the regular border, so a theme can give inputs an underline-style lower edge the same way, without fighting the hover/focus/disabled state rules that still own `--control-border` itself.
531
-
532
- Alerts expose the same idea on the leading edge instead of the lower one: `--alert-border-inline-start-color` and `--alert-border-inline-start-width` are unset by default and fall back to the regular `--ui-border`, so a theme can turn an alert into a callout with a colored flag on the inline-start side, matching the classic notice pattern, without a per-variant override.
533
-
534
- A theme is not limited to the tokens above; it can restate any component-local token or rule under a state selector to change the interaction recipe itself, not just the palette. The `gradient` theme does this for field focus: it restores a `--focus` border plus an outer translucent halo in place of the core inset outline.
535
-
536
- Rules:
537
-
538
- - Prefix internal component tokens with the component name (`--btn-*`, `--alert-*`, `--card-*`).
539
- - Prefix shared variant plumbing with `--ui-*`.
540
- - The shared relays `--ui-*`, `--intent*`, and `--density-*` are framework plumbing: they are classified once at framework level, not restated in every component file.
541
- - Keep component-specific variants in component code when they do not generalize.
542
- - `flush` is a shared modifier: it removes the component's outer chrome so the component sits directly inside an existing surface (`.accordion.flush`). Reuse the term one component at a time when the same integration need appears elsewhere; `separated` stays component-local until a second real consumer exists.
543
- - Do not require users to override internal tokens for ordinary theming.
544
- - Promote an internal token to public only when there is a repeated, reasonable customization need.
545
- - A custom property used only in a fallback position (`var(--x, default)`) and never declared is an unset extension point and must carry a classification — public, framework plumbing, or internal. `check:css-api` fails on any unclassified fallback-only property; it does not force an artificial declaration to satisfy the audit.
489
+ The framework uses `--ui-*` and `--intent*` to connect variants and components.
490
+ Use the documented component hooks for ordinary customization.
546
491
 
547
492
  ## Theme contract
548
493
 
549
494
  Themes override tokens, not selectors. The themes in `src/css/themes/` are repository-only demo examples, not included in the default stylesheet or the npm package; they exist to show valid ways to use this contract, such as `ocean`, `square`, `cyberpunk`, and `brutalist`.
550
495
 
551
- A minimal recolor theme overrides the intent pairs, surfaces, text colors, border, focus, hover overlay, and shadow color. Pick `--focus` as a mid-tone that holds 3:1 against both `--surface` and `--surface-solid` in every scheme the theme declares; a pastel dark-scheme primary usually fails on the light solid surface. `bunx --bun actual-css contrast --theme FILE` measures both pairs, and exits 1 when a pair misses. The file may declare a `[data-theme]` island or set the tokens on `:root`; the tool reads each scheme through `color-scheme`, so write dark values with `light-dark()` — a `prefers-color-scheme` media block is not measured.
496
+ A recolor theme sets intent pairs, surfaces, text, border, focus, hover overlay,
497
+ and shadow color. Check it with `bunx --bun actual-css contrast --theme FILE`;
498
+ the command exits 1 when a measured pair fails. In particular, `--focus` needs
499
+ 3:1 contrast against both `--surface` and `--surface-solid` in every scheme.
500
+
501
+ The file can use `[data-theme]` or `:root`. The checker reads schemes through
502
+ `color-scheme`: express dark values with `light-dark()`. It does not measure
503
+ `prefers-color-scheme` media blocks.
552
504
 
553
- When overriding an intent color, review its paired `--*-fg` and `--*-soft-fg`. A theme that declares no hook falls back to the `--soft-fg-mix` derivation: one global percentage applied to every role, so it carries no contrast guarantee for a palette it was not tuned against. `actual-css contrast` prints the resting and hovered soft pair for every intent in every scheme the theme declares, which is how a theme finds the roles that need a hook or a lower `--soft-fg-mix`.
505
+ When changing an intent, check its `--*-fg` and `--*-soft-fg` too. The contrast
506
+ report includes resting and hovered soft pairs for each intent and scheme.
507
+ Adjust failing roles with a per-role hook or a lower `--soft-fg-mix`.
554
508
 
555
509
  The default palette's hooks apply to `:root` and to the `light`/`dark` boundaries only. Any other `data-theme` value resets them to the derivation, whether the attribute sits on `<html>` or on a nested island.
556
510
 
@@ -607,7 +561,9 @@ A minimal recolor theme (illustrative, not a shipped theme):
607
561
  }
608
562
  ```
609
563
 
610
- Several tokens are theme-derived aliases that reference other tokens — `--state-selected`/`--state-selected-fg`/`--state-disabled`, `--indicator-ring`, `--shadow`/`--shadow-popout`, `--heading`, `--selection-bg`/`--selection-fg`, and `--surface-opaque`/`--surface-solid-fg`. They are declared on `:root, [data-theme]` so they recompute on every theme boundary: a custom property resolves its `var()` references at computed-value time on the element that declares it, so an alias declared only on `:root` would be inherited as an already-resolved value and would not follow a `[data-theme]` island's overridden tokens. A theme that wants a distinct alias (e.g. a `--selection-bg` of its own) overrides it explicitly afterwards, which wins by cascade order.
564
+ Derived tokens, including shadows, headings, selection colors, and state
565
+ colors, recompute at each theme boundary. To customize one, declare it in your
566
+ theme after Actual CSS.
611
567
 
612
568
  Selected state has three roles:
613
569
 
@@ -615,7 +571,9 @@ Selected state has three roles:
615
571
  - `--state-selected-fg` — ink on that fill.
616
572
  - `--state-selected-text` — selected ink on a regular surface: the current nav link, the selected tab, the current step's number and ring.
617
573
 
618
- `--state-selected-text` has no default: the core resets it to the guaranteed-invalid value on every theme boundary, and each consumer reads `var(--state-selected-text, var(--state-selected))`. The reset is what lets a nested theme island reach its own `--state-selected`: a theme that resolves the hook to another token bakes the reference where it is declared, so an island that sets nothing would otherwise inherit the resolved value and never fall back. Set it when one color cannot be both a fill under its `-fg` and text on the page — typically a dark scheme, where a fill dark enough for white ink is too dark to read as text. Pulling the accent toward `--text` keeps its hue in both schemes:
574
+ `--state-selected-text` falls back to `--state-selected` within each theme.
575
+ Set it separately when the selected fill lacks contrast as text, especially
576
+ in a dark scheme. Mixing the accent toward `--text` can help:
619
577
 
620
578
  ```css
621
579
  [data-theme="my-theme"] {
@@ -630,39 +588,13 @@ Selected state has three roles:
630
588
 
631
589
  Without `data-theme`, the default theme advertises `color-scheme: light dark` and follows the user's OS preference in browsers that support `light-dark()`. Dark themes should set `color-scheme: dark`. Light themes should set `color-scheme: light`. Browsers without `light-dark()` receive the light fallback.
632
590
 
633
- Because the native select chevron is an SVG background image and cannot inherit `currentColor`, the select hands the arrow back to the browser under `prefers-contrast: more` (same treatment as `forced-colors: active`) instead of shipping a recolored chevron per theme — one native fallback covers every theme without a high-contrast icon variant to maintain.
591
+ Selects use the browser's native arrow under `prefers-contrast: more` and
592
+ `forced-colors: active`.
634
593
 
635
- Under `prefers-contrast: more`, the user's contrast preference wins over a theme's palette by contract: the core collapses `--text-muted`/`--text-subtle` to `--text` and thickens borders and focus so no theme can defeat a legibility requirement. This is a deliberate decision, not a specificity quirk — the repeated `[data-theme][data-theme]` attribute only outranks a preset theme stylesheet loaded after the core.
594
+ Under `prefers-contrast: more`, muted and subtle text use `--text`, and borders
595
+ and focus lines thicken. Keep these accessibility adjustments when customizing
596
+ a theme.
636
597
 
637
598
  Under `prefers-reduced-transparency: reduce`, `.topbar` and `.form-actions.sticky` paint `--surface` without a backdrop blur. A theme with translucent `--surface-*` redeclares them opaque inside the same media query; the glass demo theme shows the recipe.
638
599
 
639
600
  Under `forced-colors: active`, the browser automatically remaps `color`, `background`, and `border` properties to system colors. The core only adjusts what the remapping cannot express on its own — `--state-disabled` becomes `GrayText` and `--disabled-opacity` becomes `1` — declared on `:root` and `[data-theme]` so every theme boundary follows. Keep local forced-color rules only for custom control geometry, native bar parts, or selected/checked states that would otherwise be communicated only by background color.
640
-
641
- ## Component mapping
642
-
643
- Components map global tokens to local aliases at the top of the component, then use the local tokens afterwards. This makes the contract obvious:
644
-
645
- ```css
646
- .alert {
647
- --alert-bg: var(--ui-bg, var(--surface-subtle));
648
- --alert-fg: var(--ui-fg, var(--intent, var(--text)));
649
- --alert-border: var(--ui-border, var(--border));
650
-
651
- border: var(--border-width) solid var(--alert-border);
652
- border-radius: var(--alert-radius, var(--radius-lg));
653
- background: var(--alert-bg);
654
- color: var(--alert-fg);
655
- }
656
- ```
657
-
658
- - theme authors adjust global tokens
659
- - variant code adjusts `--ui-*`
660
- - component code consumes local aliases
661
-
662
- ## Non-goals
663
-
664
- - Do not expose a separate token for every selector.
665
- - Do not mirror Pico-style component-specific variables unless there is a clear need.
666
- - Do not add Tailwind-like color scales as public API.
667
- - Do not rely on Sass, PostCSS, or generated token files.
668
- - Do not make dark mode required for old browsers. Light mode is the fallback.
@@ -108,7 +108,7 @@ Prefer:
108
108
  `<div class="cluster product-actions">`. The hook is read by `.cluster`, so the
109
109
  CSS stays a local adjustment, not a reimplementation.
110
110
 
111
- over reimplementing their layout:
111
+ Avoid reimplementing a primitive's layout:
112
112
 
113
113
  ```css
114
114
  /* Avoid when an Actual primitive already owns this behavior */
@@ -19,11 +19,10 @@ cascade layers, import order, or a project-owned build-time prefix transform.
19
19
  - Markup stays understandable without JavaScript, and modern features are gated
20
20
  with `@supports` so older browsers keep the core layout and controls.
21
21
 
22
- The distinction is structural, not stylistic: presentation lives in classes,
23
- JavaScript behavior opts in through `data-enhance` tokens, semantics come from
24
- ARIA and native HTML, and per-widget configuration uses self-describing
25
- `data-*` attributes. [Philosophy](../foundations/philosophy.md) lays out the
26
- layers and the order to follow before adding CSS.
22
+ Use classes for presentation, HTML and ARIA for meaning and state,
23
+ `data-enhance` to enable behavior, and feature-specific `data-*` attributes to
24
+ configure it. See [Philosophy](../foundations/philosophy.md) for the main
25
+ principles and how to compose components.
27
26
 
28
27
  ## Install
29
28
 
@@ -53,7 +52,7 @@ optimizing — the bare `actual-css` entrypoint and `actual-css/full` both resol
53
52
  to the complete compiled framework:
54
53
 
55
54
  ```html
56
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.15/dist/actual.full.min.css">
55
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.16/dist/actual.full.min.css">
57
56
  ```
58
57
 
59
58
  The package does not maintain separate partial bundles. Modular entrypoints map
@@ -67,14 +66,15 @@ Actual CSS uses a small unprefixed class grammar:
67
66
  .component [intent] [variant] [size] [modifier]
68
67
  ```
69
68
 
70
- Intents are `.primary`, `.secondary`, `.success`, `.warning`, and `.danger`, and
71
- work across components. Variants such as `.solid`, `.soft`, `.outline`, and `.surface` are
72
- shared by buttons, badges, alerts, and cards; a subtree that needs another
73
- palette is a `data-theme` island, not a class. `.ghost` and `.link` are
74
- button-only. Size variants `.sm` and `.lg` scale typography and
75
- participating component geometry consistently. Density contexts `.compact` and
76
- `.spacious` change geometry and spacing without changing font size, font width
77
- or icons. Undocumented `is-*` classes are runtime internals.
69
+ - **Intent:** `.primary`, `.secondary`, `.success`, `.warning`, or `.danger`.
70
+ - **Variant:** `.solid`, `.soft`, `.outline`, or `.surface`. Buttons also
71
+ support `.ghost` and `.link`.
72
+ - **Size:** `.sm` or `.lg` changes text and geometry on supported components.
73
+ - **Density:** `.compact` or `.spacious` changes spacing and geometry across a
74
+ region, keeping text and icons at the same size.
75
+
76
+ Use `data-theme` to give a region a different palette. Undocumented `is-*`
77
+ classes belong to the runtime.
78
78
 
79
79
  ```html
80
80
  <button class="btn">Click me</button>
@@ -63,6 +63,19 @@ handle, and cleanup happens per element when an element leaves the DOM.
63
63
 
64
64
  ## The full runtime
65
65
 
66
+ Pick one way to load the runtime per page:
67
+
68
+ | Context | Load |
69
+ | ------------------------ | -------------------------------------------------------- |
70
+ | Bundler, every behavior | `import "actual-css/js/full"` |
71
+ | Bundler, a few behaviors | `import "actual-css/js/tab"`, one line per enhancer |
72
+ | No build step | `dist/actual.full.js` in one `<script>`, e.g. from a CDN |
73
+
74
+ The bundle and the modules register the same behaviors, so loading both
75
+ registers them twice; the runtime warns when a second copy loads.
76
+ `dist/actual.full.js` is not a package export: in a bundler, import
77
+ `actual-css/js/full` instead.
78
+
66
79
  Import `actual-css/js/full` to enable the full runtime:
67
80
 
68
81
  ```js
@@ -360,6 +373,10 @@ command. Names must be a native keyword or start with `--`; anything else
360
373
  throws. `commandSelector(commands)` builds the matching button selector. The returned handle has an idempotent `disconnect()` method for
361
374
  applications that unload the module owning the command.
362
375
 
376
+ Dialog command resolution respects [Web Component ownership](../components/dialog.md#web-components):
377
+ dialogs inside custom elements or shadow roots require `data-enhance="dialog"`
378
+ or a direct dialog API call to delegate their commands to Actual.
379
+
363
380
  ### Dismiss command
364
381
 
365
382
  The runtime includes a generic `--dismiss` command for hiding any resolved
@@ -387,6 +404,11 @@ state or perform another action after the target is hidden.
387
404
  Use `enhance()` for project-specific behavior. It accepts a selector map where
388
405
  each function receives the matched element and may return a cleanup function.
389
406
 
407
+ For eligibility that selectors cannot express, pass `{ accept(element) }` as
408
+ the third argument, after the root. Rejected elements are skipped; moving an
409
+ active element into a rejected subtree runs its cleanup. Moving it back starts
410
+ it again. Attribute changes still require `refresh()`.
411
+
390
412
  ```js
391
413
  import enhance from "actual-css/js/enhance";
392
414
 
@@ -25,8 +25,8 @@ No class or hook is removed: markup and application CSS keep working.
25
25
  package, so this only affects a copy of it: keep the copy, or drop it since
26
26
  the core focus line and fields now match it.
27
27
  - The combobox, date picker and data grid recipes target
28
- `@lekoala/combobox` 0.7.1, `@lekoala/date-picker` 0.5.1 and
29
- `data-grid-component` 3.7.0. Compare a copied bridge with the current one in
28
+ `@lekoala/combobox` 0.8.0, `@lekoala/date-picker` 0.6.0 and
29
+ `data-grid-component` 3.8.0. Compare a copied bridge with the current one in
30
30
  [Combobox](../forms/combobox.md) and [Date picker](../forms/date-picker.md).
31
31
 
32
32
  ## 0.13 to 0.14
@@ -5,20 +5,28 @@ number of children visible in one mockup.
5
5
 
6
6
  ## Page and application shells
7
7
 
8
- | Situation | Recipe |
9
- | -------------------------------------- | ------------------------------------------- |
10
- | A normally scrolling page | Semantic landmarks, optionally `.app-shell` |
11
- | Topbar + scrolling main + adaptive nav | `.app-layout` |
8
+ | Situation | Recipe |
9
+ | ----------------------------------------------- | ------------------------------------------- |
10
+ | A normally scrolling page | Semantic landmarks, optionally `.app-shell` |
11
+ | Full-width bands over a centered content column | `.center` inside each landmark |
12
+ | Topbar + scrolling main + adaptive nav | `.app-layout` |
12
13
 
13
- The first covers public, marketing and editorial pages; add `.navbar` for site
14
- navigation. The second is `.app-layout` with its exact direct-child contract,
15
- where the primary navigation moves from bottom to side.
14
+ For public, marketing, and editorial pages, use semantic landmarks and add
15
+ `.navbar` for site navigation.
16
16
 
17
- Do not choose `.app-layout` from the word "app" or from the presence of a
18
- header. Its viewport-sized grid, hidden shell overflow, internal main scroll,
19
- and adaptive `.app-nav` are one indivisible behavior. If any of those is not
20
- wanted, compose the ordinary page from semantic landmarks and the primitives
21
- below.
17
+ When a band must paint edge to edge, keep the landmark a plain page-level box
18
+ and put `.center` inside it: the content column keeps its measure while the
19
+ background reaches the viewport edge. A page wrapped in one `.center` cannot
20
+ paint such a band, and a `.center` inside `.stack` sizes to its content measure
21
+ rather than the row (see
22
+ [stack](stack.md#dont-wrap-full-width-regions-with-stack)).
23
+ [Marketing](../../demo/templates/marketing.html) and
24
+ [Blog](../../demo/templates/blog.html) compose bands this way.
25
+
26
+ Use `.app-layout` for a viewport-sized shell where the main region scrolls
27
+ independently and navigation moves from bottom to side. Follow its
28
+ [required structure](app-layout.md). For other arrangements, compose the
29
+ primitives below.
22
30
 
23
31
  ## Content relationships
24
32
 
@@ -39,20 +47,20 @@ all peers should move together rather than form a partial row, use `.switcher`.
39
47
 
40
48
  For a main region plus an aside, use `.sidebar-layout`.
41
49
 
42
- Use `.column-layout` when the placement of each region is itself part of the
43
- design — a 10-column article starting on column 2, regions in separate sibling
44
- sections that must share the same column lines, an editorial composition whose
45
- starts and spans are deliberately aligned across the page. It is the one layout
46
- primitive with no automatic responsive behavior: the canvas stays twelve
47
- columns and the application owns narrow-container recomposition. Choose it
48
- because placement is the design, not because a mockup happens to contain
49
- columns.
50
+ Use `.column-layout` for deliberate placement on a shared 12-column canvas:
51
+ an inset article, aligned sections, or an editorial composition. It keeps
52
+ twelve columns at every width; add application CSS to rearrange it in narrow
53
+ containers.
50
54
 
51
55
  Use `--grid-columns` for exact track templates that do not match a built-in
52
56
  layout contract: arbitrary structural counts such as seven calendar days,
53
57
  asymmetric fractional tracks, or mixed intrinsic/flexible tracks. Once set, the
54
58
  application owns narrow-container behavior.
55
59
 
60
+ `.measure` caps a single block at a readable width without centering it, for
61
+ content inside a wider region. When the reading column is the page column, use
62
+ `.center` instead. See [Measure](../utilities/list.md#measure).
63
+
56
64
  `.container-query` is a low-level opt-in for a component that changes its own
57
65
  representation according to allocated space. It does not enable responsive
58
66
  behavior for layout primitives and never changes their meaning.