actual-css 0.14.1 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +4 -4
- package/components.json +51 -6
- package/dist/actual.full.css +380 -32
- package/dist/actual.full.js +1 -1
- package/dist/actual.full.min.css +1 -1
- package/docs/design-notes/architecture.md +3 -0
- package/docs/design-notes/enhancement-contract.md +14 -0
- package/docs/design-notes/naming.md +6 -0
- package/docs/design-notes/steps.md +13 -2
- package/docs/design-notes/tokens.md +159 -0
- package/docs/navigation.json +4 -1
- package/docs/pages/components/accordion.md +15 -18
- package/docs/pages/components/avatar.md +1 -0
- package/docs/pages/components/badge.md +41 -5
- package/docs/pages/components/button.md +32 -7
- package/docs/pages/components/card.md +40 -7
- package/docs/pages/components/diagrams.md +96 -0
- package/docs/pages/components/steps.md +31 -17
- package/docs/pages/components/table.md +4 -0
- package/docs/pages/components/timeline.md +111 -0
- package/docs/pages/enhancements/overview.md +13 -20
- package/docs/pages/enhancements/status-bar.md +7 -9
- package/docs/pages/enhancements/tabs.md +59 -21
- package/docs/pages/enhancements/tooltip.md +10 -19
- package/docs/pages/examples/overview.md +3 -0
- package/docs/pages/forms/choice-cards.md +3 -0
- package/docs/pages/forms/combobox.md +34 -19
- package/docs/pages/forms/controls.md +2 -0
- package/docs/pages/forms/date-picker.md +34 -13
- package/docs/pages/forms/file-upload.md +120 -0
- package/docs/pages/forms/joined-controls.md +4 -2
- package/docs/pages/forms/overview.md +8 -0
- package/docs/pages/foundations/philosophy.md +32 -62
- package/docs/pages/foundations/theming.md +63 -26
- package/docs/pages/foundations/tokens.md +91 -159
- package/docs/pages/foundations/typography.md +3 -0
- package/docs/pages/guides/integrating-actual-css.md +1 -1
- package/docs/pages/guides/introduction.md +14 -14
- package/docs/pages/guides/modular-import.md +124 -0
- package/docs/pages/guides/upgrading.md +63 -0
- package/docs/pages/layout/choosing.md +10 -16
- package/docs/pages/layout/grid.md +8 -16
- package/docs/pages/patterns/intent-nesting.md +13 -1
- package/package.json +2 -2
- package/reserved-classes.json +3 -0
- package/src/css/components/accordion.css +7 -3
- package/src/css/components/alert.css +9 -1
- package/src/css/components/app-nav.css +2 -0
- package/src/css/components/badge.css +38 -11
- package/src/css/components/button.css +10 -2
- package/src/css/components/card.css +9 -0
- package/src/css/components/index.css +1 -0
- package/src/css/components/skeleton.css +11 -0
- package/src/css/components/tab.css +77 -0
- package/src/css/components/table.css +7 -1
- package/src/css/components/timeline.css +160 -0
- package/src/css/core/base.css +13 -2
- package/src/css/core/reset.css +5 -0
- package/src/css/core/theme.css +6 -1
- package/src/css/core/tokens.css +3 -3
- package/src/css/forms/choice-card.css +5 -2
- package/src/css/forms/control.css +12 -3
- package/src/css/forms/custom-select.css +1 -1
- package/src/css/typography/prose.css +4 -2
- package/src/tooling/design-tokens.js +2 -0
- package/src/tooling/theme-contrast.js +1 -1
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
# Tokens
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
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`
|
|
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
|
-
|
|
204
|
-
surface
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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**
|
|
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
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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`
|
|
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
|
-
|
|
591
|
+
Selects use the browser's native arrow under `prefers-contrast: more` and
|
|
592
|
+
`forced-colors: active`.
|
|
634
593
|
|
|
635
|
-
Under `prefers-contrast: more`,
|
|
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.
|
|
@@ -97,6 +97,9 @@ The `.prose` fallback to `--primary` breaks down for a theme whose primary is a
|
|
|
97
97
|
|
|
98
98
|
It is a color token only. There are still no `--link-decoration-thickness`, `--link-decoration-thickness-hover`, or `--link-underline-offset` tokens; no global rule consumes them. Prose and components set their own underline metrics inline.
|
|
99
99
|
|
|
100
|
+
On `.card.solid`, links follow the surrounding text color in every state;
|
|
101
|
+
the theme's `--link` ink remains for page surfaces. See [Card](../components/card.md).
|
|
102
|
+
|
|
100
103
|
## Type scale
|
|
101
104
|
|
|
102
105
|
There is no exposed type scale.
|
|
@@ -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
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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.
|
|
55
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.15/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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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>
|
|
@@ -74,6 +74,130 @@ shared: keep `components/close` with modal, drawer, alert, or a removable
|
|
|
74
74
|
badge; `components/bleed` with a `.bleed` child of card, drawer, or accordion;
|
|
75
75
|
`components/spinner` with `components/busy`.
|
|
76
76
|
|
|
77
|
+
## Replace a component, keep the conventions
|
|
78
|
+
|
|
79
|
+
Actual CSS components are reference implementations, not mandatory dependencies.
|
|
80
|
+
Omit a component's stylesheet and write a smaller implementation when your
|
|
81
|
+
application needs fewer features. Keep its semantic markup, state conventions,
|
|
82
|
+
and shared theme tokens where they fit.
|
|
83
|
+
|
|
84
|
+
Choose the level of customization that matches the need:
|
|
85
|
+
|
|
86
|
+
- Change a color, size, or spacing through the component's public hooks.
|
|
87
|
+
- Give the component a different appearance with an application CSS variant.
|
|
88
|
+
- Replace a component that does more than you need by omitting its module and
|
|
89
|
+
writing your own implementation.
|
|
90
|
+
|
|
91
|
+
### Example: a simpler Steps component
|
|
92
|
+
|
|
93
|
+
The built-in Steps component supports horizontal and vertical layouts,
|
|
94
|
+
connectors, optional labels, responsive representations, scrolling, and focus
|
|
95
|
+
for navigable labels. A static, horizontal progress indicator can use the same
|
|
96
|
+
HTML with a smaller stylesheet.
|
|
97
|
+
|
|
98
|
+
Import only the framework modules the application uses, followed by the
|
|
99
|
+
replacement:
|
|
100
|
+
|
|
101
|
+
```css
|
|
102
|
+
/* app.css */
|
|
103
|
+
@import "actual-css/css";
|
|
104
|
+
@import "actual-css/css/components/button";
|
|
105
|
+
@import "actual-css/css/components/card";
|
|
106
|
+
@import "./steps.css";
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Omit `actual-css/css/components/steps` and any entrypoint that includes it:
|
|
110
|
+
`actual-css`, `actual-css/full`, `actual-css/css/full`, or
|
|
111
|
+
`actual-css/css/components`. Loading the original and overriding it retains
|
|
112
|
+
its weight and may introduce cascade conflicts.
|
|
113
|
+
|
|
114
|
+
Keep the ordered list, `.step-complete` for completed steps, and
|
|
115
|
+
`aria-current="step"` for the current step:
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<ol class="steps steps-horizontal" aria-label="Booking progress">
|
|
119
|
+
<li class="step-complete">
|
|
120
|
+
<span class="step-label">Details</span>
|
|
121
|
+
</li>
|
|
122
|
+
<li aria-current="step">
|
|
123
|
+
<span class="step-label">Payment</span>
|
|
124
|
+
</li>
|
|
125
|
+
<li>
|
|
126
|
+
<span class="step-label">Confirmation</span>
|
|
127
|
+
</li>
|
|
128
|
+
</ol>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The application owns this replacement stylesheet:
|
|
132
|
+
|
|
133
|
+
```css
|
|
134
|
+
/* steps.css — static horizontal progress only */
|
|
135
|
+
.steps-horizontal {
|
|
136
|
+
--step-size: 2rem;
|
|
137
|
+
counter-reset: app-step;
|
|
138
|
+
display: flex;
|
|
139
|
+
gap: var(--space-30);
|
|
140
|
+
margin: 0;
|
|
141
|
+
padding: 0;
|
|
142
|
+
list-style: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.steps-horizontal > li {
|
|
146
|
+
counter-increment: app-step;
|
|
147
|
+
flex: 1 1 0;
|
|
148
|
+
min-inline-size: 0;
|
|
149
|
+
display: grid;
|
|
150
|
+
justify-items: center;
|
|
151
|
+
align-content: start;
|
|
152
|
+
gap: var(--space-20);
|
|
153
|
+
text-align: center;
|
|
154
|
+
color: var(--text-muted);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.steps-horizontal > li::before {
|
|
158
|
+
content: counter(app-step);
|
|
159
|
+
display: grid;
|
|
160
|
+
place-items: center;
|
|
161
|
+
box-sizing: border-box;
|
|
162
|
+
inline-size: var(--step-size);
|
|
163
|
+
block-size: var(--step-size);
|
|
164
|
+
border: 2px solid var(--border);
|
|
165
|
+
border-radius: var(--radius-full);
|
|
166
|
+
background: var(--surface-opaque);
|
|
167
|
+
color: var(--text-muted);
|
|
168
|
+
font-weight: var(--font-weight-semibold);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.steps-horizontal > .step-complete::before {
|
|
172
|
+
background: var(--state-selected);
|
|
173
|
+
border-color: var(--state-selected);
|
|
174
|
+
color: var(--state-selected-fg);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.steps-horizontal > [aria-current="step"] {
|
|
178
|
+
color: var(--text);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.steps-horizontal > [aria-current="step"]::before {
|
|
182
|
+
border-color: var(--state-selected-text, var(--state-selected));
|
|
183
|
+
color: var(--state-selected-text, var(--state-selected));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.steps-horizontal .step-label {
|
|
187
|
+
color: inherit;
|
|
188
|
+
font-size: var(--font-size-sm);
|
|
189
|
+
overflow-wrap: anywhere;
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The shared tokens supply theme colors, typography, and spacing without copying
|
|
194
|
+
the palette. This recipe is for static labels: use the built-in
|
|
195
|
+
[Steps](../components/steps.md) for navigable labels, connectors, vertical
|
|
196
|
+
orientation, or responsive representations.
|
|
197
|
+
|
|
198
|
+
If a replacement needs different markup or semantics, give it an
|
|
199
|
+
application-specific component name.
|
|
200
|
+
|
|
77
201
|
## Family manifests
|
|
78
202
|
|
|
79
203
|
Each family is one import. The contents are enumerations rather than table
|