actual-css 0.15.0 → 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 +6 -0
- package/dist/actual.full.css +17 -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/pages/components/button.md +27 -7
- package/docs/pages/components/card.md +6 -7
- package/docs/pages/components/steps.md +30 -16
- package/docs/pages/enhancements/overview.md +13 -20
- package/docs/pages/enhancements/status-bar.md +7 -9
- package/docs/pages/enhancements/tabs.md +11 -15
- package/docs/pages/enhancements/tooltip.md +10 -19
- package/docs/pages/forms/joined-controls.md +4 -2
- package/docs/pages/foundations/philosophy.md +26 -62
- package/docs/pages/foundations/theming.md +21 -36
- package/docs/pages/foundations/tokens.md +91 -159
- package/docs/pages/guides/integrating-actual-css.md +1 -1
- package/docs/pages/guides/introduction.md +13 -13
- 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 +1 -1
- package/src/css/components/app-nav.css +2 -0
- package/src/css/core/base.css +10 -1
- package/src/css/core/reset.css +5 -0
|
@@ -33,9 +33,9 @@ the next card, belongs to the layout around it:
|
|
|
33
33
|
A rule such as `.card + .card { margin-block-start: 2rem }` moves page layout
|
|
34
34
|
into the component; put a composition around the cards instead.
|
|
35
35
|
|
|
36
|
-
**A
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
**A layout primitive replaces the component's default layout.** For example,
|
|
37
|
+
`<article class="card media">` keeps the card's appearance and uses `.media`
|
|
38
|
+
for its layout.
|
|
39
39
|
|
|
40
40
|
**State uses the most semantic attribute; classes choose presentation.**
|
|
41
41
|
|
|
@@ -81,19 +81,6 @@ A component takes optional intent, variant and size classes:
|
|
|
81
81
|
A modifier is a separate class that combines with others (`.btn.primary.soft`,
|
|
82
82
|
not `.btn--primary`), and a part gets a prefixed class (`.alert-icon`,
|
|
83
83
|
`.list-item-title`) only when its element does not already say what it is.
|
|
84
|
-
There is no `__` or `--` in Actual's names, because:
|
|
85
|
-
|
|
86
|
-
- **Modifiers are shared axes.** `.primary`, `.soft` and `.sm` mean the same
|
|
87
|
-
thing on every component that supports them, so one class serves `.btn`,
|
|
88
|
-
`.badge` and `.alert`. BEM names a modifier per block, which multiplies the
|
|
89
|
-
vocabulary and keeps a custom intent such as `.tertiary` from working
|
|
90
|
-
everywhere at once.
|
|
91
|
-
- **State is not a modifier.** `disabled`, `aria-current` and `open` already
|
|
92
|
-
name the state; a `--disabled` or `--active` class would duplicate them and
|
|
93
|
-
drift out of sync.
|
|
94
|
-
- **Elements come from HTML.** A card's `header` and `footer`, an avatar's
|
|
95
|
-
`<img>` need no `__element` class; a prefixed class is kept for the parts
|
|
96
|
-
HTML cannot name.
|
|
97
84
|
|
|
98
85
|
Application CSS can use any convention, BEM included, alongside Actual's
|
|
99
86
|
classes: `<article class="card pricing-plan pricing-plan--featured">`.
|
|
@@ -110,12 +97,11 @@ for a minimal Steps implementation.
|
|
|
110
97
|
|
|
111
98
|
## Intents
|
|
112
99
|
|
|
113
|
-
`.primary`, `.secondary`, `.success`, `.warning`, `.danger`
|
|
100
|
+
`.primary`, `.secondary`, `.success`, `.warning`, and `.danger` choose a color
|
|
101
|
+
role. The component and variant decide how to display it.
|
|
114
102
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
should consume the current intent as its foreground color. It works with an
|
|
118
|
-
intent on the same element or inherited from an ancestor.
|
|
103
|
+
For plain text or an icon, add `.intent-color` to use the intent as its text
|
|
104
|
+
color. The intent can be on that element or an ancestor.
|
|
119
105
|
|
|
120
106
|
```html demo
|
|
121
107
|
<button class="btn primary">Primary</button>
|
|
@@ -127,9 +113,7 @@ intent on the same element or inherited from an ancestor.
|
|
|
127
113
|
</span>
|
|
128
114
|
```
|
|
129
115
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
Components fall back to their own default intent when no intent class is set. Buttons, badges, and alerts use the neutral palette (`--neutral` / `--neutral-fg`) by default.
|
|
116
|
+
Without an intent class, components use their own default palette.
|
|
133
117
|
|
|
134
118
|
Custom intents need no framework support — define `--intent` and `--intent-fg`
|
|
135
119
|
(and `--intent-soft-fg` when the custom role needs its own soft foreground) on a
|
|
@@ -150,7 +134,8 @@ class:
|
|
|
150
134
|
|
|
151
135
|
## Variants
|
|
152
136
|
|
|
153
|
-
`.solid`, `.soft`, `.outline`, `.surface`
|
|
137
|
+
`.solid`, `.soft`, `.outline`, and `.surface` choose the visual treatment:
|
|
138
|
+
filled, tinted, outlined, or on the page surface.
|
|
154
139
|
|
|
155
140
|
`.btn` defaults to `.solid`; `.badge` and `.alert` default to `.soft`.
|
|
156
141
|
|
|
@@ -168,37 +153,20 @@ class:
|
|
|
168
153
|
|
|
169
154
|
## Size and density
|
|
170
155
|
|
|
171
|
-
`.sm` and `.lg`
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
how tightly UI sits — spacing and component geometry — while font size and
|
|
186
|
-
icon size stay unchanged. `.tight` and `.loose` change the rhythm (`--gap`)
|
|
187
|
-
alone. Participation is opt-in, and a component only joins
|
|
188
|
-
where density has an effect independent from its optical size: if the result is
|
|
189
|
-
merely that the component looks smaller or larger, that is size, not density.
|
|
190
|
-
|
|
191
|
-
Density participation takes three levels:
|
|
192
|
-
|
|
193
|
-
- **Geometry + rhythm** — controls and their wrappers (`.field`, `.join`,
|
|
194
|
-
`.flyout`, …). Height, padding, and gap respond; typography is untouched.
|
|
195
|
-
- **Rhythm only** — content rows and shells such as `.list`. Spacing tightens
|
|
196
|
-
(`--list-item-gap: var(--gap)`), but the structural size stays stable.
|
|
197
|
-
- **No density effect** — components whose geometry is intrinsic to their
|
|
198
|
-
content (`.badge`, `.avatar`, `.spinner`, `.rating`, `.key`, prose, inline
|
|
199
|
-
`.choice`/`.switch`). Their optical size belongs to `sm`/`lg` or local hooks.
|
|
200
|
-
|
|
201
|
-
As inherited contexts, one class tightens or loosens the whole subtree:
|
|
156
|
+
- **Size:** `.sm` and `.lg` change a component's text and geometry. Each
|
|
157
|
+
component has its own scale; the same size name does not mean the same
|
|
158
|
+
dimensions everywhere.
|
|
159
|
+
- **Density:** `.compact` and `.spacious` change spacing and control geometry
|
|
160
|
+
throughout a region, keeping text and icons at the same size.
|
|
161
|
+
- **Rhythm:** `.tight` and `.loose` change only the inherited gap.
|
|
162
|
+
|
|
163
|
+
Apply size to a supported component or control wrapper. For example,
|
|
164
|
+
`.field sm`, `.input-icon sm`, `.join sm`, and `.flyout sm` size the controls
|
|
165
|
+
inside them. `.sm` on a plain element has no effect.
|
|
166
|
+
|
|
167
|
+
Density affects controls and layout spacing. Badges, avatars, spinners,
|
|
168
|
+
ratings, keys, prose, and inline choices keep their own size. One density
|
|
169
|
+
class applies to the whole subtree:
|
|
202
170
|
|
|
203
171
|
```html demo
|
|
204
172
|
<div class="compact stack">
|
|
@@ -229,12 +197,8 @@ affect the same dimension:
|
|
|
229
197
|
</div>
|
|
230
198
|
```
|
|
231
199
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
Components consume the dimensions that make sense for them and opt out of the
|
|
235
|
-
rest. The absolute `--space-*` scale is not rebound by density scopes.
|
|
236
|
-
Components with bespoke geometry (`.badge`, `.avatar`,
|
|
237
|
-
`.spinner`, `.rating`) own their local `.sm`/`.lg` mappings.
|
|
200
|
+
Density leaves the absolute `--space-*` scale unchanged. See
|
|
201
|
+
[Control tokens](tokens.md#controls) to customize the shared scale.
|
|
238
202
|
|
|
239
203
|
`.compact` also remains a meaningful local modifier for `.card` and `.table`.
|
|
240
204
|
On those components it tightens their own padding and establishes the compact
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Theming
|
|
2
2
|
|
|
3
|
-
Find
|
|
4
|
-
|
|
5
|
-
This is a problem-oriented index. It maps common intents to the public hooks and primitives that express them, then points to the canonical section. It is not a catalogue of every variable — the CSS source remains canonical for exact defaults and fallback chains. See the tokens page, Public surface section, for the public/internal rule.
|
|
3
|
+
Find a common customization below, then follow the reference for examples and
|
|
4
|
+
hook details. See [Tokens](tokens.md) for global settings and the theme contract.
|
|
6
5
|
|
|
7
6
|
## I want to…
|
|
8
7
|
|
|
@@ -93,17 +92,16 @@ Keep the outline visible against the surrounding surface when changing colors.
|
|
|
93
92
|
|
|
94
93
|
### Keep bare native controls on-theme / accent-color
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
Bare checkboxes, radios, ranges, and `<progress>` follow the theme through
|
|
96
|
+
`accent-color: var(--primary)`. Styled controls such as `.check`, `.radio`,
|
|
97
|
+
and `.range` use their own appearance.
|
|
97
98
|
|
|
98
99
|
→ Forms · Overview · Foundations · Tokens (theme contract)
|
|
99
100
|
|
|
100
101
|
### Store a theme name without applying it
|
|
101
102
|
|
|
102
|
-
`data-theme`
|
|
103
|
-
|
|
104
|
-
or a form control's `value`, when the element should only hold a theme name.
|
|
105
|
-
Apply `data-theme` deliberately when that element and its subtree should paint
|
|
106
|
-
with the selected palette — a theme swatch is a useful example.
|
|
103
|
+
`data-theme` applies a theme to the element and its subtree. To store a theme
|
|
104
|
+
name without applying it, use `data-theme-value` or a form control's `value`.
|
|
107
105
|
|
|
108
106
|
### Loading / busy overlay on a container
|
|
109
107
|
|
|
@@ -174,13 +172,10 @@ well as color.
|
|
|
174
172
|
|
|
175
173
|
### Dark mode toggle / theme switcher / remember the user's choice
|
|
176
174
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
choice
|
|
181
|
-
follows the OS. Apply a stored choice from an inline script in `<head>` so the
|
|
182
|
-
first paint does not flash the OS scheme. The demo's theme picker is an
|
|
183
|
-
inspection tool, not a component to copy.
|
|
175
|
+
The default theme follows the OS. Set `data-theme="light"` or `"dark"` on
|
|
176
|
+
`<html>` to force a scheme; remove the attribute to follow the OS again.
|
|
177
|
+
Build the switcher and store the preference in application code. Apply a saved
|
|
178
|
+
choice from an inline script in `<head>` to avoid a flash of the wrong scheme.
|
|
184
179
|
|
|
185
180
|
### Force light or dark on a theme that has both / theme and color scheme
|
|
186
181
|
|
|
@@ -235,12 +230,10 @@ step per role rather than importing the scale.
|
|
|
235
230
|
|
|
236
231
|
### Use a custom font / webfont / typeface with a theme
|
|
237
232
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
metrics of every island it touches. A display face for headings has no token:
|
|
243
|
-
name it on the headings in application CSS.
|
|
233
|
+
Load fonts in the application stylesheet with `@font-face` or a font service.
|
|
234
|
+
Set `--font-sans` and `--font-mono` on `:root` so the type stays consistent
|
|
235
|
+
across theme changes and islands. Set a separate heading face directly in
|
|
236
|
+
application CSS:
|
|
244
237
|
|
|
245
238
|
```css
|
|
246
239
|
:root {
|
|
@@ -261,17 +254,9 @@ reference material to copy into your own `[data-theme]` island — they are demo
|
|
|
261
254
|
assets, not package entrypoints. Each sets the intent/surface/text tokens and
|
|
262
255
|
lets the core derive everything else.
|
|
263
256
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
boundaries, so use a separate page to show another theme. Its `.join` groups
|
|
271
|
-
fit their contents so the shadow follows the controls.
|
|
272
|
-
The `material` example restyles
|
|
273
|
-
fields as filled underlines with pill buttons — tokens plus three small rules,
|
|
274
|
-
and `.join` still needs no adaptation. The `glass` example paints translucent
|
|
275
|
-
surfaces over its own backdrop: it sets `--surface-opaque` and
|
|
276
|
-
`--surface-solid-fg` to opaque values, raises `--soft-bg-mix` so soft fills stay
|
|
277
|
-
light over glass, and adds the blur and an opaque busy veil as small rules.
|
|
257
|
+
- `gradient`: outer focus halos on fields.
|
|
258
|
+
- `neo-brutalist`: hard shadows, pastel fills, and plus-shaped accordion
|
|
259
|
+
markers. Use it as a page skin: its rules cross nested theme boundaries.
|
|
260
|
+
- `material`: filled underline fields and pill buttons.
|
|
261
|
+
- `glass`: translucent surfaces over a backdrop. Keep `--surface-opaque` and
|
|
262
|
+
`--surface-solid-fg` opaque, and check soft fills against the actual backdrop.
|
|
@@ -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.
|