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.
- package/CHANGELOG.md +37 -0
- package/README.md +10 -7
- package/components.json +44 -1
- package/dist/actual.full.css +130 -9
- 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 +25 -3
- 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/avatar.md +10 -0
- package/docs/pages/components/bleed.md +4 -0
- package/docs/pages/components/button.md +27 -7
- package/docs/pages/components/card.md +12 -7
- package/docs/pages/components/dialog.md +26 -0
- package/docs/pages/components/rating.md +29 -5
- package/docs/pages/components/steps.md +32 -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/choice-cards.md +2 -1
- package/docs/pages/forms/joined-controls.md +4 -2
- package/docs/pages/forms/overview.md +1 -0
- 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 +14 -14
- package/docs/pages/guides/progressive-enhancement.md +22 -0
- package/docs/pages/guides/upgrading.md +2 -2
- package/docs/pages/layout/choosing.md +28 -20
- package/docs/pages/layout/grid.md +8 -16
- package/docs/pages/patterns/intent-nesting.md +13 -1
- package/llms.txt +2 -1
- package/package.json +5 -3
- package/skills/actual-css/SKILL.md +5 -4
- package/skills/actual-css/references/api-and-vocabulary.md +2 -1
- package/src/css/components/app-nav.css +2 -0
- package/src/css/components/avatar.css +4 -2
- package/src/css/components/card.css +1 -1
- package/src/css/components/menu.css +2 -0
- package/src/css/components/rating.css +66 -0
- package/src/css/core/base.css +10 -1
- package/src/css/core/reset.css +5 -0
- package/src/css/core/theme.css +4 -1
- package/src/css/core/tokens.css +8 -2
- package/src/css/forms/form.css +15 -1
- package/src/css/forms/range.css +11 -1
- package/src/css/layout/measure.css +2 -0
- package/src/js/dialog.js +40 -9
- package/src/js/enhance.js +16 -3
- package/tokens.json +117 -0
|
@@ -43,6 +43,9 @@ padding and type together has become a component, whatever file it lives in.
|
|
|
43
43
|
|
|
44
44
|
## Tokens
|
|
45
45
|
|
|
46
|
+
See [Token architecture](tokens.md) for scope, inheritance, size and density,
|
|
47
|
+
color interpolation, motion, and component mapping constraints.
|
|
48
|
+
|
|
46
49
|
A value derived from an overridable token is computed on the element that uses
|
|
47
50
|
it, never as an alias on `:root`: an inherited custom property arrives already
|
|
48
51
|
computed, so an override on a theme island or a region would not reach it. The
|
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
Actual CSS splits CSS and JavaScript into two independent layers with a shared
|
|
4
4
|
opt-in mechanism. Every component uses the same grammar.
|
|
5
5
|
|
|
6
|
+
## Popover ownership
|
|
7
|
+
|
|
8
|
+
The runtime owns `popover="manual"` and native show/hide calls on managed
|
|
9
|
+
surfaces and tooltips. Native automatic dismissal would compete with Actual's
|
|
10
|
+
close policy. Canceling `beforetoggle` would leave the runtime's open state
|
|
11
|
+
out of sync with platform visibility, so applications cancel
|
|
12
|
+
`actual:surface-open` before promotion instead.
|
|
13
|
+
|
|
14
|
+
Explicit tooltips stay in place to preserve inherited context. Generated
|
|
15
|
+
tooltips are mounted outside the trigger's sibling sequence: inserting one
|
|
16
|
+
beside the trigger would change structural selectors such as
|
|
17
|
+
`.join > :last-child`. Generated tooltips therefore make no promise to inherit
|
|
18
|
+
the trigger's theme or density.
|
|
19
|
+
|
|
6
20
|
## The four-layer contract
|
|
7
21
|
|
|
8
22
|
```text
|
|
@@ -63,7 +77,8 @@ than the registration root, without crossing shadow boundaries.
|
|
|
63
77
|
- **A self-describing `data-*`** is for a leaf whose attribute is simultaneously
|
|
64
78
|
the opt-in and the configuration (`data-tooltip`, `data-mask`, `data-filter`,
|
|
65
79
|
`data-context-menu`).
|
|
66
|
-
- **Elements that are their own opt-in** need nothing (`<dialog>`
|
|
80
|
+
- **Elements that are their own opt-in** need nothing (`<dialog>` outside a
|
|
81
|
+
Web Component).
|
|
67
82
|
|
|
68
83
|
`data-enhance` is explicitly **not** a mandatory prefix for every module.
|
|
69
84
|
|
|
@@ -92,6 +107,10 @@ leaves it—even when the element remains connected elsewhere. An enhancer's
|
|
|
92
107
|
cleanup must therefore be authoritative and idempotent: it releases its state
|
|
93
108
|
when called and must not repeat the root-membership decision.
|
|
94
109
|
|
|
110
|
+
An optional `enhance()` acceptance predicate narrows lifecycle membership
|
|
111
|
+
without another observer. Discovery and the removal sweep recheck it, so moves
|
|
112
|
+
across a behavioral boundary clean up or initialize the element as needed.
|
|
113
|
+
|
|
95
114
|
Core lifecycle primitives accept a `Document`, `Element`, or `DocumentFragment`
|
|
96
115
|
root, and command targets resolve in the trigger's document or shadow root.
|
|
97
116
|
Built-in auto-registration observes the document tree. It does not discover or
|
|
@@ -128,8 +147,11 @@ framework.
|
|
|
128
147
|
token.** The markup already carries `role="status"` everywhere, so semantics
|
|
129
148
|
alone scope the document-wide lookup.
|
|
130
149
|
|
|
131
|
-
**D5 — `<dialog>`
|
|
132
|
-
|
|
150
|
+
**D5 — `<dialog>` is its own opt-in outside Web Components.** Custom-element
|
|
151
|
+
ancestors and shadow roots reserve lifecycle ownership for the component.
|
|
152
|
+
`data-enhance="dialog"` delegates it explicitly to Actual, independently of
|
|
153
|
+
presentation classes. Both discovery and dialog command resolution apply this
|
|
154
|
+
boundary; the command router leaves rejected targets' native clicks alone.
|
|
133
155
|
|
|
134
156
|
**D6 — `validation.js` accepts `[data-field-error]` as an alias for
|
|
135
157
|
`.field-error`, and keeps `.field` / `.danger` as an optional, degrading
|
|
@@ -27,6 +27,12 @@ Actual CSS is intended for new projects. Existing projects with class collisions
|
|
|
27
27
|
|
|
28
28
|
### Rules
|
|
29
29
|
|
|
30
|
+
Modifiers use separate classes because intents, treatments, and sizes are
|
|
31
|
+
shared across components. A custom `.tertiary` intent can then work on buttons,
|
|
32
|
+
badges, and alerts without a modifier for each block. Native and ARIA attributes
|
|
33
|
+
carry state without a parallel class to synchronize. Semantic children such as
|
|
34
|
+
a card's `header` and `footer` need no extra element class.
|
|
35
|
+
|
|
30
36
|
- Classes name components, not markup. Prefer the established UI term even when it matches the element (`.select`, `.table`); do not invent synonyms just to avoid repetition.
|
|
31
37
|
- When one element can host multiple components, use the component role instead of the element name (`.modal` / `.drawer` on `dialog`, `.check` / `.radio` / `.switch` on `input`).
|
|
32
38
|
- Do not merely restate the element when a more precise or canonical component name exists (`.key`, not `.kbd`; `.modal` / `.drawer`, not `.dialog`).
|
|
@@ -169,10 +169,21 @@ It is not behind a viewport query. Edge alignment is the row's geometry, the
|
|
|
169
169
|
one the compact and inline forms already have, and a breakpoint on the viewport
|
|
170
170
|
would lay out the same 600px row differently on a phone and in a desktop card.
|
|
171
171
|
|
|
172
|
+
The end labels pay for that alignment: each gets half a share, and that is
|
|
173
|
+
already all the room it can have. Two neighbouring labels meet at the midpoint
|
|
174
|
+
between their markers, and an end label already runs from the row's edge to
|
|
175
|
+
that midpoint, so widening it would let it overlap a long neighbour. Giving the
|
|
176
|
+
end labels a full share means centring them under inset markers, which gives
|
|
177
|
+
up the edge alignment. That is a design trade, not a technical limit, and it
|
|
178
|
+
stays open to re-evaluation if narrow rows need longer end names.
|
|
179
|
+
|
|
172
180
|
The marker sets the default item floor. A `minmax(0, 1fr)` grid column keeps a
|
|
173
181
|
long label from widening its step; `hyphens: auto` breaks a long word where the
|
|
174
|
-
page's `lang
|
|
175
|
-
fit when it does not.
|
|
182
|
+
browser has a dictionary for the page's `lang`, and `overflow-wrap: anywhere`
|
|
183
|
+
still lets an unbroken name fit when it does not. Automatic hyphenation is not
|
|
184
|
+
a contract: headless Chrome hyphenates `account` but breaks `Account` as
|
|
185
|
+
`Accoun`/`t`, and most labels are capitalised. An authored `­` is the
|
|
186
|
+
predictable break. `--step-gap` separates both the marker from its label and
|
|
176
187
|
one step from the next, so wrapped names cannot run together.
|
|
177
188
|
|
|
178
189
|
Authors can raise `--step-min` when wrapping costs too much height. The row
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Token architecture
|
|
2
|
+
|
|
3
|
+
User-facing hooks and theming guidance are in
|
|
4
|
+
[Tokens](../pages/foundations/tokens.md). This note records implementation
|
|
5
|
+
constraints and the reasoning behind the token system.
|
|
6
|
+
|
|
7
|
+
## Scope and inheritance
|
|
8
|
+
|
|
9
|
+
Custom properties resolve their references on the element that declares them.
|
|
10
|
+
An alias declared only on `:root` arrives in a theme island already resolved,
|
|
11
|
+
so it cannot follow the island's palette. Theme-derived aliases must be
|
|
12
|
+
redeclared on `:root, [data-theme]`.
|
|
13
|
+
|
|
14
|
+
Optional hooks such as `--state-selected-text` reset to the guaranteed-invalid
|
|
15
|
+
value at each theme boundary. Consumers then fall back to that theme's
|
|
16
|
+
`--state-selected`, rather than inheriting an outer theme's resolved color.
|
|
17
|
+
|
|
18
|
+
Instance geometry resets on each instance; palette, rhythm, and policy inherit.
|
|
19
|
+
A reset is safe only when the instance itself consumes the hook. The children
|
|
20
|
+
of `.switcher` and `.sidebar-layout` consume their layout hooks, so those hooks
|
|
21
|
+
keep inheriting: a nested instance may also need its parent's value as a child.
|
|
22
|
+
|
|
23
|
+
## Intent boundaries
|
|
24
|
+
|
|
25
|
+
Intent classes expose `--intent`, `--intent-fg`, and `--intent-soft-fg`.
|
|
26
|
+
Each consuming component resets the relays it uses in a `:where()` rule.
|
|
27
|
+
This stops ancestor intents from tinting nested components while allowing a
|
|
28
|
+
local intent class to win by specificity. Both directions are covered by
|
|
29
|
+
`tests/css-audit.test.js`, `tests/browser/intent-boundary.test.js`, and
|
|
30
|
+
`tests/browser/soft-boundary.test.js`.
|
|
31
|
+
|
|
32
|
+
## Size and density
|
|
33
|
+
|
|
34
|
+
Size changes optical scale; density changes spacing and geometry independently
|
|
35
|
+
of text and icons. Components participate only where that distinction is
|
|
36
|
+
meaningful. Controls change geometry and rhythm, content rows change rhythm,
|
|
37
|
+
and badges, avatars, and other intrinsically sized components keep their own
|
|
38
|
+
size scale. Explicit local size wins over inherited density where they overlap.
|
|
39
|
+
|
|
40
|
+
## Palette
|
|
41
|
+
|
|
42
|
+
A coherent palette treats surfaces, text, borders, intents, and shadows as related roles rather than isolated colors.
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
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.
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
|
|
52
|
+
## Soft foreground calibration
|
|
53
|
+
|
|
54
|
+
Calibrate soft text against the closest resting and hovered surfaces, not just
|
|
55
|
+
against the page. Translucent tints change with the surface underneath, and
|
|
56
|
+
hover adds intent through `--soft-hover-alpha`. The default theme's per-role
|
|
57
|
+
foregrounds hold 4.5:1 on `--surface`, `--surface-raised`, and `--surface-subtle`
|
|
58
|
+
in both schemes; `tests/browser/soft-recipe.test.js` enforces that contract.
|
|
59
|
+
Named themes reset these hooks to avoid inheriting colors calibrated for the
|
|
60
|
+
default palette. Their global mix or per-role hooks need separate measurement.
|
|
61
|
+
|
|
62
|
+
## Contextual color interpolation
|
|
63
|
+
|
|
64
|
+
**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.
|
|
65
|
+
|
|
66
|
+
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.
|
|
67
|
+
|
|
68
|
+
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.
|
|
69
|
+
|
|
70
|
+
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.
|
|
71
|
+
|
|
72
|
+
## Motion
|
|
73
|
+
|
|
74
|
+
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`.
|
|
75
|
+
|
|
76
|
+
## Internal tokens
|
|
77
|
+
|
|
78
|
+
Internal tokens are allowed when they reduce duplication or make component code clearer.
|
|
79
|
+
|
|
80
|
+
### Variant plumbing
|
|
81
|
+
|
|
82
|
+
The shared visual variants are:
|
|
83
|
+
|
|
84
|
+
- `.solid`: full background, paired foreground. This is the default for buttons.
|
|
85
|
+
- `.soft`: lightly tinted background, colored text. Good for alerts, badges, and secondary actions.
|
|
86
|
+
- `.outline`: transparent background, colored border and text.
|
|
87
|
+
- `.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.
|
|
88
|
+
|
|
89
|
+
Buttons also support two button-only variants:
|
|
90
|
+
|
|
91
|
+
- `.ghost`: transparent button with hover affordance.
|
|
92
|
+
- `.link`: button semantics with link presentation.
|
|
93
|
+
|
|
94
|
+
Do not force `.ghost` or `.link` onto components where the interaction model does not fit. Shared API should follow shared use.
|
|
95
|
+
|
|
96
|
+
Components map global tokens to local aliases once at the top of the component and consume local tokens afterwards:
|
|
97
|
+
|
|
98
|
+
```css
|
|
99
|
+
.btn {
|
|
100
|
+
--btn-bg: var(--ui-bg, var(--btn-default-bg, var(--intent, var(--neutral))));
|
|
101
|
+
--btn-fg: var(--ui-fg, var(--btn-default-fg, var(--intent-fg, var(--neutral-fg))));
|
|
102
|
+
--btn-border: var(--ui-border, var(--btn-default-border, transparent));
|
|
103
|
+
|
|
104
|
+
border: var(--border-width) solid var(--btn-border-color, var(--btn-border));
|
|
105
|
+
border-block-end-color: var(
|
|
106
|
+
--btn-border-block-end-color,
|
|
107
|
+
var(--btn-border-color, var(--btn-border))
|
|
108
|
+
);
|
|
109
|
+
border-block-end-width: var(--btn-border-block-end-width, var(--border-width));
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
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.
|
|
114
|
+
|
|
115
|
+
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.
|
|
116
|
+
|
|
117
|
+
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.
|
|
118
|
+
|
|
119
|
+
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.
|
|
120
|
+
|
|
121
|
+
Rules:
|
|
122
|
+
|
|
123
|
+
- Prefix internal component tokens with the component name (`--btn-*`, `--alert-*`, `--card-*`).
|
|
124
|
+
- Prefix shared variant plumbing with `--ui-*`.
|
|
125
|
+
- The shared relays `--ui-*`, `--intent*`, and `--density-*` are framework plumbing: they are classified once at framework level, not restated in every component file.
|
|
126
|
+
- Keep component-specific variants in component code when they do not generalize.
|
|
127
|
+
- `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.
|
|
128
|
+
- Do not require users to override internal tokens for ordinary theming.
|
|
129
|
+
- Promote an internal token to public only when there is a repeated, reasonable customization need.
|
|
130
|
+
- 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.
|
|
131
|
+
|
|
132
|
+
## Component mapping
|
|
133
|
+
|
|
134
|
+
Components map global tokens to local aliases at the top of the component, then use the local tokens afterwards. This makes the contract obvious:
|
|
135
|
+
|
|
136
|
+
```css
|
|
137
|
+
.alert {
|
|
138
|
+
--alert-bg: var(--ui-bg, var(--surface-subtle));
|
|
139
|
+
--alert-fg: var(--ui-fg, var(--intent, var(--text)));
|
|
140
|
+
--alert-border: var(--ui-border, var(--border));
|
|
141
|
+
|
|
142
|
+
border: var(--border-width) solid var(--alert-border);
|
|
143
|
+
border-radius: var(--alert-radius, var(--radius-lg));
|
|
144
|
+
background: var(--alert-bg);
|
|
145
|
+
color: var(--alert-fg);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- theme authors adjust global tokens
|
|
150
|
+
- variant code adjusts `--ui-*`
|
|
151
|
+
- component code consumes local aliases
|
|
152
|
+
|
|
153
|
+
## Non-goals
|
|
154
|
+
|
|
155
|
+
- Do not expose a separate token for every selector.
|
|
156
|
+
- Do not mirror Pico-style component-specific variables unless there is a clear need.
|
|
157
|
+
- Do not add Tailwind-like color scales as public API.
|
|
158
|
+
- Do not rely on Sass, PostCSS, or generated token files.
|
|
159
|
+
- Do not make dark mode required for old browsers. Light mode is the fallback.
|
|
@@ -78,6 +78,12 @@ is suppressed inside the avatar.
|
|
|
78
78
|
</div>
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
An image trigger has no visible text, so its `aria-label` is the whole name.
|
|
82
|
+
A trigger that shows initials uses them as its visible label: keep them in the
|
|
83
|
+
accessible name, as in `aria-label="JD, Jane Doe: profile menu"`, so a speech
|
|
84
|
+
user can say what they see (WCAG 2.5.3, *Label in Name*). A name without the
|
|
85
|
+
initials fails that check even when the initials are `aria-hidden`.
|
|
86
|
+
|
|
81
87
|
## Avatar stack
|
|
82
88
|
|
|
83
89
|
Set `.sm` or `.lg` on `.avatar-stack` to size the group; its avatars inherit
|
|
@@ -113,3 +119,7 @@ Prefer intents for avatar colors. Inside `.avatar-stack`, `--avatar-size` and
|
|
|
113
119
|
the stack set, so the whole group resizes together; set `--avatar-size` on an
|
|
114
120
|
individual avatar to opt one out. `--avatar-stack-overlap` is derived from
|
|
115
121
|
`--avatar-stack-size`, not `--avatar-size`.
|
|
122
|
+
|
|
123
|
+
Wide two-letter initials (`MW`) fill most of a `.sm` disc, so even the default
|
|
124
|
+
overlap can graze the second letter there. Set `--avatar-stack-overlap: 0` on
|
|
125
|
+
that stack, or keep initials stacks at the default size.
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
`.bleed` lets a direct child of a padded surface reach its edges. Use it for a
|
|
4
4
|
full-width image, a colored header or footer, or a notice band.
|
|
5
5
|
|
|
6
|
+
`.bleed` is relative to a padded surface. A full-width band on a page is a
|
|
7
|
+
different mechanism: keep the landmark full width and put `.center` inside it.
|
|
8
|
+
See [Center](../layout/center.md).
|
|
9
|
+
|
|
6
10
|
It works inside `.card`, `.drawer`, a modal's direct `<form>` or `.stack`, and
|
|
7
11
|
an accordion panel. The accordion panel owns the padding, so place `.bleed`
|
|
8
12
|
directly inside the panel, after the summary. A deeper descendant stays within
|
|
@@ -149,13 +149,10 @@ and collapses the shared edges.
|
|
|
149
149
|
</div>
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
only to carry meaning: [Toggle](#toggle) marks a pressed button with a solid
|
|
157
|
-
fill among outlines. For one choice among a few on a shared track, use a
|
|
158
|
-
[segmented control](segmented.md) instead.
|
|
152
|
+
Use the same variant across a group. Change a button's variant to mark a
|
|
153
|
+
meaningful state, such as a solid pressed [toggle](#toggle) among outlines.
|
|
154
|
+
For one choice among a few on a shared track, use a
|
|
155
|
+
[segmented control](segmented.md).
|
|
159
156
|
|
|
160
157
|
## Sizes
|
|
161
158
|
|
|
@@ -266,6 +263,29 @@ For exclusive groups, manage a single pressed button:
|
|
|
266
263
|
</script>
|
|
267
264
|
```
|
|
268
265
|
|
|
266
|
+
### Touch feedback
|
|
267
|
+
|
|
268
|
+
The reset sets `-webkit-tap-highlight-color: transparent` on `html`: the native
|
|
269
|
+
tap flash is a rectangle that ignores `--btn-radius`. A pressed button moves
|
|
270
|
+
down a pixel instead. A bare text link (`<a href>` with no class) has no
|
|
271
|
+
pressed state of its own, so it keeps a flash tinted from its own color. The
|
|
272
|
+
property inherits, so one declaration on a container restores the native flash
|
|
273
|
+
on its components. Tap both rows on a phone to compare:
|
|
274
|
+
|
|
275
|
+
```html demo
|
|
276
|
+
<div class="stack">
|
|
277
|
+
<div class="cluster">
|
|
278
|
+
<button class="btn primary" type="button" style="--btn-radius: var(--radius-full);">Default</button>
|
|
279
|
+
<label class="choice-card chip"><input type="checkbox" /> Chip</label>
|
|
280
|
+
<a href="#touch-feedback">Text link</a>
|
|
281
|
+
</div>
|
|
282
|
+
<div class="cluster" style="-webkit-tap-highlight-color: rgb(0 0 0 / 0.2);">
|
|
283
|
+
<button class="btn primary" type="button" style="--btn-radius: var(--radius-full);">Native flash</button>
|
|
284
|
+
<label class="choice-card chip"><input type="checkbox" /> Chip</label>
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
```
|
|
288
|
+
|
|
269
289
|
## Accessibility
|
|
270
290
|
|
|
271
291
|
- Always set `type="button"` when a button is not submitting a form.
|
|
@@ -26,13 +26,12 @@ Nested cards and `data-theme` islands establish their own link context.
|
|
|
26
26
|
## Basic usage
|
|
27
27
|
|
|
28
28
|
Use semantic elements inside the card. A direct `<header>` or `<footer>` is the
|
|
29
|
-
card's
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
primitives
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
gap.
|
|
29
|
+
card's header or footer slot. When the card has spare height, its footer stays
|
|
30
|
+
at the bottom, aligning prices and actions across equal-height cards.
|
|
31
|
+
|
|
32
|
+
Use layout primitives such as `.grid` to space cards. Within a bare card,
|
|
33
|
+
`--card-gap` spaces the direct children. Add `.stack` or `.media` to the card
|
|
34
|
+
to let that primitive control its layout and gap.
|
|
36
35
|
|
|
37
36
|
```html demo
|
|
38
37
|
<div style="max-inline-size: 32rem">
|
|
@@ -69,6 +68,12 @@ start-aligned group, `cluster form-actions` for a form's action row,
|
|
|
69
68
|
`.justify-content-end` to push actions right. The footer stays anchored to the
|
|
70
69
|
bottom either way.
|
|
71
70
|
|
|
71
|
+
Each child of the slot is one side of the row. A heading and its subtitle placed
|
|
72
|
+
as two direct children split apart, the subtitle pushed to the far side; group
|
|
73
|
+
them in an `<hgroup>` so they stay one block, title above description. Text that
|
|
74
|
+
is not a split row (a centered intro, a stacked title) belongs in a plain
|
|
75
|
+
`<div>`, not in the `<header>` slot.
|
|
76
|
+
|
|
72
77
|
```html demo
|
|
73
78
|
<div style="max-inline-size: 32rem">
|
|
74
79
|
<article class="card">
|
|
@@ -585,6 +585,32 @@ transition.
|
|
|
585
585
|
|
|
586
586
|
## Notes
|
|
587
587
|
|
|
588
|
+
### Web Components
|
|
589
|
+
|
|
590
|
+
The dialog runtime automatically enhances ordinary page dialogs. Dialogs inside
|
|
591
|
+
a custom element (including nested light DOM hosts) or a Shadow DOM keep their
|
|
592
|
+
component's native lifecycle; Actual leaves their `command` buttons untouched.
|
|
593
|
+
The `.modal` styles remain independent of this behavior.
|
|
594
|
+
|
|
595
|
+
To delegate a light DOM dialog to Actual, add `data-enhance="dialog"` before
|
|
596
|
+
inserting it, including when a custom element is only an application container:
|
|
597
|
+
|
|
598
|
+
```html
|
|
599
|
+
<my-app>
|
|
600
|
+
<dialog class="modal" id="preferences" data-enhance="dialog">
|
|
601
|
+
<form method="dialog">…</form>
|
|
602
|
+
</dialog>
|
|
603
|
+
</my-app>
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
For an existing light DOM dialog, use
|
|
607
|
+
`applyEnhancement("dialog", "dialog", scope)` from `actual-css/js/enhance`.
|
|
608
|
+
Document discovery does not enter shadow roots: a marked shadow dialog is wired
|
|
609
|
+
on its first routed command. Calling `openDialog()` from `actual-css/js/dialog`
|
|
610
|
+
also explicitly delegates to Actual, in either DOM tree; use Actual's exported
|
|
611
|
+
close helpers for subsequent programmatic actions. Shadow-root disposal remains
|
|
612
|
+
application-owned.
|
|
613
|
+
|
|
588
614
|
Prefer native dialog behavior whenever possible. The framework runtime should
|
|
589
615
|
not replace the platform modal system; it should only make dialogs declarative,
|
|
590
616
|
animation-friendly, and consistent across supported browsers.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Rating
|
|
2
2
|
|
|
3
|
-
> Integer star rating built from native radio inputs.
|
|
3
|
+
> Integer star rating built from native radio inputs, and a read-only display of a rating.
|
|
4
4
|
|
|
5
5
|
Each star is a real `input[type="radio"]`, so submission, `required`, disabled
|
|
6
6
|
state, form reset, and keyboard navigation remain native. Keep values and DOM
|
|
@@ -10,10 +10,11 @@ filled while the control remains fully functional.
|
|
|
10
10
|
|
|
11
11
|
## Class reference
|
|
12
12
|
|
|
13
|
-
| Class
|
|
14
|
-
|
|
|
15
|
-
| `.rating`
|
|
16
|
-
| `.
|
|
13
|
+
| Class | Kind | Description |
|
|
14
|
+
| --------------------- | --------- | -------------------------------- |
|
|
15
|
+
| `.rating` | Component | Radio group presented as stars. |
|
|
16
|
+
| `.rating[role="img"]` | Component | Read-only display of a value. |
|
|
17
|
+
| `.sm` / `.lg` | Size | Smaller or larger star geometry. |
|
|
17
18
|
|
|
18
19
|
```html demo
|
|
19
20
|
<fieldset class="field">
|
|
@@ -59,6 +60,27 @@ Intent classes change the active color without changing the interaction model.
|
|
|
59
60
|
</div>
|
|
60
61
|
```
|
|
61
62
|
|
|
63
|
+
## Read-only display
|
|
64
|
+
|
|
65
|
+
To show a rating rather than collect one (reviews, testimonials, average
|
|
66
|
+
score, star display), use one element with `role="img"` and the value in
|
|
67
|
+
`--rating-value`. Fractions draw a partial star. The `aria-label` carries the
|
|
68
|
+
value; without `role="img"` nothing is drawn, so a display cannot ship
|
|
69
|
+
without an accessible name. Do not present a value with disabled radios.
|
|
70
|
+
|
|
71
|
+
```html demo
|
|
72
|
+
<p>
|
|
73
|
+
<span class="rating" role="img" aria-label="4.5 out of 5 stars" style="--rating-value: 4.5"></span>
|
|
74
|
+
4.5 from 312 reviews
|
|
75
|
+
</p>
|
|
76
|
+
|
|
77
|
+
<span class="rating sm primary" role="img" aria-label="7 out of 10" style="--rating-value: 7; --rating-max: 10"></span>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Stars line up with an input `.rating` of the same size, and `.sm`, `.lg` and
|
|
81
|
+
intent classes apply as above. The fill follows the writing direction. In
|
|
82
|
+
forced-colors mode the filled share is painted in system colors.
|
|
83
|
+
|
|
62
84
|
### Hooks
|
|
63
85
|
|
|
64
86
|
- `--rating-size` — size of each star; `.sm` and `.lg` set this hook.
|
|
@@ -66,3 +88,5 @@ Intent classes change the active color without changing the interaction model.
|
|
|
66
88
|
- `--rating-color` — star color. Prefer an intent class for semantic color.
|
|
67
89
|
- `--rating-empty` — color of unselected stars; use a surface or border token.
|
|
68
90
|
- `--rating-star` — mask image used to draw a star; override it when a strict CSP disallows data URLs.
|
|
91
|
+
- `--rating-value` — display only: the value shown, fractions allowed.
|
|
92
|
+
- `--rating-max` — display only: the number of stars.
|
|
@@ -139,23 +139,39 @@ names, or when a step should be navigable:
|
|
|
139
139
|
|
|
140
140
|
```html demo
|
|
141
141
|
<ol class="steps steps-horizontal" aria-label="Checkout progress">
|
|
142
|
-
<li class="step-complete"><span class="step-label">
|
|
143
|
-
<li class="step-complete"><span class="step-label">
|
|
144
|
-
<li aria-current="step"><span class="step-label">
|
|
145
|
-
<li><span class="step-label">
|
|
142
|
+
<li class="step-complete"><span class="step-label">Cart</span></li>
|
|
143
|
+
<li class="step-complete"><span class="step-label">Details</span></li>
|
|
144
|
+
<li aria-current="step"><span class="step-label">Review</span></li>
|
|
145
|
+
<li><span class="step-label">Pay</span></li>
|
|
146
146
|
</ol>
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
**Actual CSS never hides an authored step label.** Labels stay visible at every
|
|
150
150
|
width. Stacked steps keep their markers evenly spaced, and long names wrap
|
|
151
|
-
inside their share
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
inside their share. The first and last steps align with the row's edges, labels
|
|
152
|
+
included, so the track lines up with the heading above it. Their labels get
|
|
153
|
+
half a share, so a phone-width row reads best with short names at both ends.
|
|
154
|
+
|
|
155
|
+
A word wider than its share breaks inside the word rather than overflowing the
|
|
156
|
+
row, so the geometry holds at any width. Automatic hyphenation depends on the
|
|
157
|
+
browser, the language and its dictionaries. Mark break points with `­`
|
|
158
|
+
(`Ac­count`) when a long name must wrap predictably, or raise `--step-min`
|
|
159
|
+
(below) to keep whole words and let the row scroll.
|
|
154
160
|
|
|
155
161
|
Set `--step-min` when names need a wider minimum share. If the markers or that
|
|
156
162
|
minimum do not fit, the row scrolls; use `.steps-vertical` when every name must
|
|
157
163
|
remain visible without horizontal scrolling.
|
|
158
164
|
|
|
165
|
+
```html demo
|
|
166
|
+
<ol class="steps steps-horizontal scroller" style="--step-min: 7rem" aria-label="Order progress">
|
|
167
|
+
<li class="step-complete"><span class="step-label">Account</span></li>
|
|
168
|
+
<li class="step-complete"><span class="step-label">Shipping address</span></li>
|
|
169
|
+
<li aria-current="step"><span class="step-label">Payment method</span></li>
|
|
170
|
+
<li><span class="step-label">Review order</span></li>
|
|
171
|
+
<li><span class="step-label">Confirm</span></li>
|
|
172
|
+
</ol>
|
|
173
|
+
```
|
|
174
|
+
|
|
159
175
|
In supporting browsers, a row that scrolls starts on its `aria-current="step"`
|
|
160
176
|
instead of step 1. A row
|
|
161
177
|
that raises `--step-min` can scroll, so it is worth pairing with `.scroller`,
|
|
@@ -198,17 +214,17 @@ Resize the demo below. The 3-step flow needs less room than the supported
|
|
|
198
214
|
```html demo resize
|
|
199
215
|
<div class="stack">
|
|
200
216
|
<ol class="steps steps-horizontal container-query scroller" style="--step-complete-mark: '✓'">
|
|
201
|
-
<li class="step-complete"><span class="step-label">
|
|
202
|
-
<li aria-current="step"><span class="step-label">
|
|
203
|
-
<li><span class="step-label">
|
|
217
|
+
<li class="step-complete"><span class="step-label">Account</span></li>
|
|
218
|
+
<li aria-current="step"><span class="step-label">Payment</span></li>
|
|
219
|
+
<li><span class="step-label">Confirm</span></li>
|
|
204
220
|
</ol>
|
|
205
221
|
|
|
206
222
|
<ol class="steps steps-horizontal container-query scroller" style="--step-complete-mark: '✓'">
|
|
207
|
-
<li class="step-complete"><span class="step-label">
|
|
208
|
-
<li class="step-complete"><span class="step-label">
|
|
209
|
-
<li aria-current="step"><span class="step-label">
|
|
223
|
+
<li class="step-complete"><span class="step-label">Cart</span></li>
|
|
224
|
+
<li class="step-complete"><span class="step-label">Ship</span></li>
|
|
225
|
+
<li aria-current="step"><span class="step-label">Pay</span></li>
|
|
210
226
|
<li><span class="step-label">Review</span></li>
|
|
211
|
-
<li><span class="step-label">
|
|
227
|
+
<li><span class="step-label">Done</span></li>
|
|
212
228
|
</ol>
|
|
213
229
|
</div>
|
|
214
230
|
```
|
|
@@ -334,7 +350,7 @@ label a link when the workflow genuinely allows navigation to that step:
|
|
|
334
350
|
```html demo resize
|
|
335
351
|
<ol class="steps steps-horizontal container-query scroller">
|
|
336
352
|
<li class="step-complete">
|
|
337
|
-
<a class="step-label" href="#">
|
|
353
|
+
<a class="step-label" href="#">Cart</a>
|
|
338
354
|
</li>
|
|
339
355
|
<li class="step-complete">
|
|
340
356
|
<a class="step-label" href="#">Details</a>
|
|
@@ -343,7 +359,7 @@ label a link when the workflow genuinely allows navigation to that step:
|
|
|
343
359
|
<span class="step-label">Payment</span>
|
|
344
360
|
</li>
|
|
345
361
|
<li>
|
|
346
|
-
<span class="step-label">
|
|
362
|
+
<span class="step-label">Done</span>
|
|
347
363
|
</li>
|
|
348
364
|
</ol>
|
|
349
365
|
```
|
|
@@ -19,24 +19,19 @@ Actual drives the top layer itself. On every surface and tooltip its runtime
|
|
|
19
19
|
manages, `surface.js` and `tooltip.js` own the `popover` attribute and both
|
|
20
20
|
`showPopover()` and `hidePopover()`.
|
|
21
21
|
|
|
22
|
-
On a managed element,
|
|
22
|
+
On a managed element, leave `popover` and its native show/hide methods to the
|
|
23
|
+
runtime, and let `beforetoggle` proceed. To stop a surface from opening,
|
|
24
|
+
cancel `actual:surface-open`.
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
- call `showPopover()`, `hidePopover()`, or `togglePopover()`.
|
|
26
|
-
- cancel its `beforetoggle`. Preventing an open leaves Actual's state saying open while the element is not in the top layer, and nothing repairs that — Actual owns the lifecycle rather than mediating it.
|
|
26
|
+
The runtime manages elements connected to these triggers:
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
- `data-enhance="flyout"`, pointing to the panel through `aria-controls`.
|
|
29
|
+
- `data-context-menu`, naming the menu.
|
|
30
|
+
- `data-tooltip`, pointing to the tooltip.
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
managed when a `data-tooltip` trigger points at it. A `.flyout[popover]` or
|
|
36
|
-
`.tooltip[popover]` that no such trigger reaches is never touched — Actual
|
|
37
|
-
supplies its presentation and the application owns its lifecycle. That is the
|
|
38
|
-
supported way to drive either class with `popovertarget` or a third-party
|
|
39
|
-
lifecycle. Do not do both to the same element.
|
|
32
|
+
You can drive an unconnected `.flyout[popover]` or `.tooltip[popover]` with
|
|
33
|
+
`popovertarget` or a third-party library. Actual supplies its appearance;
|
|
34
|
+
your code owns opening and dismissal. Use one owner per element.
|
|
40
35
|
|
|
41
36
|
## Modules
|
|
42
37
|
|
|
@@ -53,11 +48,9 @@ Enhancer modules self-register when imported. They do not require init calls and
|
|
|
53
48
|
are safe to import during server-side rendering: outside a browser, registration
|
|
54
49
|
is a no-op until the module is loaded again with a DOM.
|
|
55
50
|
|
|
56
|
-
Load the full bundle **or**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
behavior twice and a flyout opens then immediately closes. The second copy
|
|
60
|
-
logs a console warning when it loads.
|
|
51
|
+
Load the full bundle **or** individual source modules. Mixing them, or loading
|
|
52
|
+
two bundles, registers behaviors twice and can make a flyout close immediately
|
|
53
|
+
after opening. The runtime warns in the console when a second copy loads.
|
|
61
54
|
|
|
62
55
|
## Component pages
|
|
63
56
|
|