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
|
@@ -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
|
|
@@ -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.
|
package/docs/navigation.json
CHANGED
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"dialog",
|
|
61
61
|
"drawer",
|
|
62
62
|
"data-list",
|
|
63
|
+
"diagrams",
|
|
63
64
|
"fab",
|
|
64
65
|
"indicator",
|
|
65
66
|
"key",
|
|
@@ -74,7 +75,8 @@
|
|
|
74
75
|
"skeleton",
|
|
75
76
|
"spinner",
|
|
76
77
|
"steps",
|
|
77
|
-
"table"
|
|
78
|
+
"table",
|
|
79
|
+
"timeline"
|
|
78
80
|
]
|
|
79
81
|
},
|
|
80
82
|
{
|
|
@@ -85,6 +87,7 @@
|
|
|
85
87
|
"controls",
|
|
86
88
|
"combobox",
|
|
87
89
|
"date-picker",
|
|
90
|
+
"file-upload",
|
|
88
91
|
"rich-text",
|
|
89
92
|
"labels",
|
|
90
93
|
"floating-field",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- Use the `name` attribute for exclusive accordions.
|
|
7
7
|
- Supports any valid body element (`div`, `p`, `ul`, ...).
|
|
8
8
|
- Three container treatments: the default common shell, `.flush` (bare separators, for embedding inside an existing surface), and `.separated` (independent items).
|
|
9
|
-
- The
|
|
9
|
+
- The end marker is a chevron that turns when open; its glyph, turn, color, and size are hooks.
|
|
10
10
|
|
|
11
11
|
```html demo
|
|
12
12
|
<div class="accordion">
|
|
@@ -89,26 +89,21 @@ The accordion owns its disclosure marker; the trigger content belongs to the mar
|
|
|
89
89
|
</div>
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
##
|
|
92
|
+
## Plus / close marker
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
Swap the glyph and the turn: a plus turned 45° reads as a close cross (plus
|
|
95
|
+
minus, expand collapse, + / ×).
|
|
95
96
|
|
|
96
|
-
```html
|
|
97
|
-
<div class="accordion accordion-
|
|
97
|
+
```html demo
|
|
98
|
+
<div class="accordion" style="--accordion-marker-icon: var(--icon-plus); --accordion-marker-open-rotate: 45deg">
|
|
98
99
|
<details open>
|
|
99
|
-
<summary>
|
|
100
|
-
|
|
101
|
-
<span>Custom marker at the start</span>
|
|
102
|
-
</summary>
|
|
103
|
-
<p>This demo swaps the default end marker for a local plus/minus icon.</p>
|
|
100
|
+
<summary>Open: the plus has turned into a cross</summary>
|
|
101
|
+
<p>The turn animates with the open state.</p>
|
|
104
102
|
</details>
|
|
105
103
|
|
|
106
104
|
<details>
|
|
107
|
-
<summary>
|
|
108
|
-
|
|
109
|
-
<span>Another item</span>
|
|
110
|
-
</summary>
|
|
111
|
-
<p>The icon belongs to the example, not the base accordion API.</p>
|
|
105
|
+
<summary>Closed: a plus</summary>
|
|
106
|
+
<p>Any mask-ready icon token works as the glyph.</p>
|
|
112
107
|
</details>
|
|
113
108
|
</div>
|
|
114
109
|
```
|
|
@@ -119,6 +114,8 @@ The end marker is a shared token-based chevron; swapping it for a local icon is
|
|
|
119
114
|
- `--accordion-pad` — inset of the summary row and the panel. The panel relays it as `--surface-pad`, so a direct `.bleed` child of the panel reaches the item's sides and bottom corners (never the summary); `.flush` drops the inline half and the relay with it.
|
|
120
115
|
- `--accordion-marker-color` — color of the end marker; it reinforces to the summary text color on hover. In forced-colors mode the marker is pinned to `CanvasText` on the property itself, so an application override of the hook cannot leave a `Canvas`-remapped fill.
|
|
121
116
|
- `--accordion-marker-size` — edge length of the end marker.
|
|
117
|
+
- `--accordion-marker-icon` — the marker glyph, any mask image (`--icon-chevron`, `--icon-plus`, …).
|
|
118
|
+
- `--accordion-marker-open-rotate` — the marker's turn when open.
|
|
122
119
|
|
|
123
120
|
### Replacing the marker
|
|
124
121
|
|
|
@@ -153,8 +150,8 @@ recipe repeats it on its own property:
|
|
|
153
150
|
inline-size: var(--accordion-marker-size);
|
|
154
151
|
block-size: var(--accordion-marker-size);
|
|
155
152
|
background-color: var(--accordion-marker-color);
|
|
156
|
-
-webkit-mask: var(--icon
|
|
157
|
-
mask: var(--icon
|
|
153
|
+
-webkit-mask: var(--accordion-marker-icon) center / contain no-repeat;
|
|
154
|
+
mask: var(--accordion-marker-icon) center / contain no-repeat;
|
|
158
155
|
}
|
|
159
156
|
|
|
160
157
|
.accordion.custom-marker summary:hover .marker {
|
|
@@ -162,7 +159,7 @@ recipe repeats it on its own property:
|
|
|
162
159
|
}
|
|
163
160
|
|
|
164
161
|
.accordion.custom-marker details[open] .marker {
|
|
165
|
-
transform: rotate(
|
|
162
|
+
transform: rotate(var(--accordion-marker-open-rotate));
|
|
166
163
|
}
|
|
167
164
|
|
|
168
165
|
@media (forced-colors: active) {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
- Can be an inert element, link, or button when the link/button has a real destination or action.
|
|
7
7
|
- Stack avatars with `.avatar-stack` for overlapping group displays.
|
|
8
8
|
- A status dot attaches as an empty `.badge` child; the badge carries an `aria-label` so the dot conveys its meaning to assistive tech.
|
|
9
|
+
- For a person chip (mention, assignee), put the avatar first in a `.badge`; see [Badge](badge.md#with-an-avatar).
|
|
9
10
|
- Does not support shape modifiers as public API. Shape is theme-level.
|
|
10
11
|
- Sizes can be adjusted with CSS variables and optional `.sm` or `.lg`.
|
|
11
12
|
- Background is an exposed css variable (and can use `data-tone`).
|
|
@@ -23,7 +23,7 @@ direct child of `.stack` (where flex children otherwise stretch), and a flex
|
|
|
23
23
|
parent never compresses it (`flex: none`). Use `inline-size: 100%` — or the
|
|
24
24
|
optional `.inline-size-full` utility — when a full-width badge is intentional.
|
|
25
25
|
|
|
26
|
-
**Related terms:** chip, tag, pill, removable tag.
|
|
26
|
+
**Related terms:** chip, tag, pill, removable tag, user chip, mention, assignee.
|
|
27
27
|
|
|
28
28
|
## Class reference
|
|
29
29
|
|
|
@@ -32,6 +32,7 @@ optional `.inline-size-full` utility — when a full-width badge is intentional.
|
|
|
32
32
|
| `.badge` | Component | Compact label; soft by default. |
|
|
33
33
|
| `.badge:empty` | Composition | Truly-empty badge renders as a solid dot. |
|
|
34
34
|
| `.dot` | Composition | Status dot inside a badge. |
|
|
35
|
+
| `.avatar` | Composition | Leading avatar sized to the badge. |
|
|
35
36
|
| Shared intents | Intent | `.primary`, `.secondary`, `.success`, … |
|
|
36
37
|
| Shared variants | Variant | `.solid`, `.outline`, `.surface`. |
|
|
37
38
|
| `.sm` / `.lg` | Size | Smaller or larger optical scale. |
|
|
@@ -133,7 +134,7 @@ badge.
|
|
|
133
134
|
## With an icon
|
|
134
135
|
|
|
135
136
|
Decorative SVG, image, or `[aria-hidden="true"]` children follow
|
|
136
|
-
`--badge-icon-size`.
|
|
137
|
+
`--badge-icon-size`. An `.avatar` keeps its own sizing (see below).
|
|
137
138
|
|
|
138
139
|
```html demo
|
|
139
140
|
<span class="badge success">
|
|
@@ -150,6 +151,36 @@ Decorative SVG, image, or `[aria-hidden="true"]` children follow
|
|
|
150
151
|
</span>
|
|
151
152
|
```
|
|
152
153
|
|
|
154
|
+
## With an avatar
|
|
155
|
+
|
|
156
|
+
Put an [`.avatar`](avatar.md) first in the badge for a person chip: mention,
|
|
157
|
+
assignee, contributor, author. The avatar follows the badge size, so the pill
|
|
158
|
+
keeps its height and `.sm` / `.lg` scale both together. Wrap the chips in a
|
|
159
|
+
[`.cluster`](../layout/cluster.md) to let them wrap.
|
|
160
|
+
|
|
161
|
+
```html demo
|
|
162
|
+
<div class="cluster tight">
|
|
163
|
+
<a href="#" class="badge lg">
|
|
164
|
+
<span class="avatar">
|
|
165
|
+
<img src="https://mockmind-api.uifaces.co/content/human/219.jpg" alt="" />
|
|
166
|
+
</span>
|
|
167
|
+
@jane-doe
|
|
168
|
+
</a>
|
|
169
|
+
<a href="#" class="badge lg">
|
|
170
|
+
<span class="avatar success"><abbr>RM</abbr></span>
|
|
171
|
+
@rin-moreau
|
|
172
|
+
</a>
|
|
173
|
+
<span class="badge primary">
|
|
174
|
+
<span class="avatar"><abbr>AM</abbr></span>
|
|
175
|
+
Ada Morgan
|
|
176
|
+
<button class="close" type="button" aria-label="Remove Ada Morgan"></button>
|
|
177
|
+
</span>
|
|
178
|
+
</div>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Keep `alt=""` when the handle or name sits next to the image. Initials fit
|
|
182
|
+
the default and `.lg` sizes; use an image on `.sm`.
|
|
183
|
+
|
|
153
184
|
## Loading status
|
|
154
185
|
|
|
155
186
|
A decorative spinner follows the badge color and optical size.
|
|
@@ -185,17 +216,22 @@ an interactive target driving its checkbox/radio, and a nested button would mix
|
|
|
185
216
|
two interactive targets. A removable tag next to a selectable chip is a sibling
|
|
186
217
|
(a widget tag or a `.badge` + `.close`), never a child of the label.
|
|
187
218
|
|
|
188
|
-
|
|
189
|
-
|
|
219
|
+
Put the close last. It mirrors a leading avatar: a disc inside the pill at the
|
|
220
|
+
same inset, so a fill or the hover wash never leaves the pill. On small badges
|
|
221
|
+
the disc is small; an invisible hit area keeps the pointer target at 24px.
|
|
190
222
|
|
|
191
223
|
```html demo
|
|
192
|
-
<span class="badge primary soft">
|
|
224
|
+
<span class="badge primary soft sm">
|
|
193
225
|
Design
|
|
194
226
|
<button class="close" type="button" aria-label="Remove Design"></button>
|
|
195
227
|
</span>
|
|
196
228
|
<span class="badge primary soft">
|
|
229
|
+
Design
|
|
197
230
|
<button class="close" type="button" aria-label="Remove Design"></button>
|
|
231
|
+
</span>
|
|
232
|
+
<span class="badge primary soft lg">
|
|
198
233
|
Design
|
|
234
|
+
<button class="close" type="button" aria-label="Remove Design"></button>
|
|
199
235
|
</span>
|
|
200
236
|
```
|
|
201
237
|
|
|
@@ -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.
|
|
@@ -280,3 +300,8 @@ For exclusive groups, manage a single pressed button:
|
|
|
280
300
|
|
|
281
301
|
- `--btn-radius` — corner radius.
|
|
282
302
|
- `--btn-gap` — space between an icon and the label text (default `0.375em`).
|
|
303
|
+
- `--btn-shadow` — resting elevation (unset by default). It inherits, so a
|
|
304
|
+
theme can set it once on its root; the solid hover overlay composes with it.
|
|
305
|
+
Change it in `:hover`/`:active` rules for a lift and press.
|
|
306
|
+
Supply shadow-list items; use `0 0 #0000` for no elevation. `none` cannot
|
|
307
|
+
compose with the inset hover overlay and invalidates the whole shadow list.
|
|
@@ -16,16 +16,22 @@ Flexible content container with optional header, body, and footer regions.
|
|
|
16
16
|
`--surface-raised` and leaves the intent to the text. For a dark card on a
|
|
17
17
|
light page (or the reverse), put `data-theme="dark"` on the card.
|
|
18
18
|
|
|
19
|
+
Shared `.soft` with an intent class gives the card a tone: an opaque surface
|
|
20
|
+
tinted by the intent, with the soft ink. See [Tones](#tones).
|
|
21
|
+
|
|
22
|
+
On `.card.solid`, bare and `.prose` links follow the surrounding text color,
|
|
23
|
+
including hover and keyboard focus, instead of the theme's `--link` ink.
|
|
24
|
+
Nested cards and `data-theme` islands establish their own link context.
|
|
25
|
+
|
|
19
26
|
## Basic usage
|
|
20
27
|
|
|
21
28
|
Use semantic elements inside the card. A direct `<header>` or `<footer>` is the
|
|
22
|
-
card's
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
primitives
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
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.
|
|
29
35
|
|
|
30
36
|
```html demo
|
|
31
37
|
<div style="max-inline-size: 32rem">
|
|
@@ -126,6 +132,33 @@ all footers in the row line up regardless of body length.
|
|
|
126
132
|
</section>
|
|
127
133
|
```
|
|
128
134
|
|
|
135
|
+
## Tones
|
|
136
|
+
|
|
137
|
+
A toned, tinted, or colored card (accent card, highlight card) is `.soft` plus
|
|
138
|
+
an intent class. The tint is opaque, so it holds over an image, and the ink
|
|
139
|
+
follows the soft recipe, so muted text and links stay readable on it.
|
|
140
|
+
|
|
141
|
+
```html demo
|
|
142
|
+
<section class="grid">
|
|
143
|
+
<article class="card soft primary">
|
|
144
|
+
<h3>Primary</h3>
|
|
145
|
+
<p class="muted">A highlighted plan or feature.</p>
|
|
146
|
+
</article>
|
|
147
|
+
<article class="card soft success">
|
|
148
|
+
<h3>Success</h3>
|
|
149
|
+
<p class="muted">A completed step.</p>
|
|
150
|
+
</article>
|
|
151
|
+
<article class="card soft warning">
|
|
152
|
+
<h3>Warning</h3>
|
|
153
|
+
<p class="muted">Something to check.</p>
|
|
154
|
+
</article>
|
|
155
|
+
</section>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
For a fully colored card, use a `data-theme` island rather than `.solid`: the
|
|
159
|
+
island recomputes muted text, links, and fields for the new surface, where
|
|
160
|
+
`.solid` only repaints the fill and the main ink.
|
|
161
|
+
|
|
129
162
|
## Surfaces
|
|
130
163
|
|
|
131
164
|
A card is a surface-owning component: inside a painted band it keeps its own
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Diagrams
|
|
2
|
+
|
|
3
|
+
> The framework draws no diagrams. Render Mermaid text with an external engine such as Pele and theme it with Actual tokens.
|
|
4
|
+
|
|
5
|
+
A diagram is a drawing to look at: a chronology, a schedule, a process. For
|
|
6
|
+
content a reader scans, follows links from or acts on, stay in HTML.
|
|
7
|
+
|
|
8
|
+
- Events with links or actions in them: [Timeline](timeline.md).
|
|
9
|
+
- Progress through the steps of a flow: [Steps](steps.md).
|
|
10
|
+
- A timeline chart, Gantt chart, flowchart or any other Mermaid diagram: an
|
|
11
|
+
external engine on the token bridge below.
|
|
12
|
+
|
|
13
|
+
**Related terms:** chart, Mermaid, Gantt, flowchart, sequence diagram, mind
|
|
14
|
+
map, roadmap, timeline chart, org chart, diagram library.
|
|
15
|
+
|
|
16
|
+
## Pele on Actual tokens
|
|
17
|
+
|
|
18
|
+
[Pele](https://pele.run/) renders Mermaid text to SVG with no runtime
|
|
19
|
+
dependency, and reads its colors, fonts and radius from `--pele-*` custom
|
|
20
|
+
properties on the SVG or any ancestor. The
|
|
21
|
+
[diagrams template](../../demo/templates/diagrams.html) wraps it in a small
|
|
22
|
+
`<pele-diagram>` web component:
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<pele-diagram>
|
|
26
|
+
<script type="text/plain">
|
|
27
|
+
flowchart LR
|
|
28
|
+
A[Request] --> B{Slot free?}
|
|
29
|
+
B -- Yes --> C[Confirm]
|
|
30
|
+
</script>
|
|
31
|
+
</pele-diagram>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The component, in
|
|
35
|
+
[`demo/scripts/pele-diagram.js`](../../demo/scripts/pele-diagram.js), is an
|
|
36
|
+
example to copy, not Actual CSS API. It loads `pele/lazy` from a CDN, which
|
|
37
|
+
fetches each diagram type on first use, and mounts the source found in its
|
|
38
|
+
`text/plain` script. Zoom is off; the boolean `zoom` attribute turns on
|
|
39
|
+
Pele's automatic zoom controls for one diagram.
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
pele-diagram {
|
|
43
|
+
--pele-bg: var(--surface-opaque);
|
|
44
|
+
--pele-fg: var(--text);
|
|
45
|
+
--pele-muted: var(--text-muted);
|
|
46
|
+
--pele-line: var(--text-muted);
|
|
47
|
+
--pele-surface: var(--surface-subtle);
|
|
48
|
+
--pele-surface-alt: var(--surface-raised);
|
|
49
|
+
--pele-border: var(--border);
|
|
50
|
+
--pele-accent: var(--primary);
|
|
51
|
+
--pele-critical: var(--danger);
|
|
52
|
+
--pele-error: var(--danger);
|
|
53
|
+
--pele-font: var(--font-sans);
|
|
54
|
+
--pele-font-mono: var(--font-mono);
|
|
55
|
+
--pele-radius: var(--radius);
|
|
56
|
+
|
|
57
|
+
display: block;
|
|
58
|
+
min-inline-size: 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@supports (color: oklch(from red l c h)) {
|
|
62
|
+
pele-diagram {
|
|
63
|
+
--diagram-series: var(
|
|
64
|
+
--primary-soft-fg,
|
|
65
|
+
color-mix(in oklab, var(--text), var(--primary) var(--soft-fg-mix))
|
|
66
|
+
);
|
|
67
|
+
--pele-series-1: var(--diagram-series);
|
|
68
|
+
--pele-series-2: oklch(from var(--diagram-series) l c calc(h + 135));
|
|
69
|
+
--pele-series-3: oklch(from var(--diagram-series) l c calc(h + 270));
|
|
70
|
+
--pele-series-4: oklch(from var(--diagram-series) l c calc(h + 45));
|
|
71
|
+
--pele-series-5: oklch(from var(--diagram-series) l c calc(h + 180));
|
|
72
|
+
--pele-series-6: oklch(from var(--diagram-series) l c calc(h + 315));
|
|
73
|
+
--pele-series-7: oklch(from var(--diagram-series) l c calc(h + 90));
|
|
74
|
+
--pele-series-8: oklch(from var(--diagram-series) l c calc(h + 225));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Colors resolve at paint time, so a theme or light/dark switch restyles a
|
|
80
|
+
mounted diagram without a re-render; a font change needs the mounted
|
|
81
|
+
diagram's `refresh()`.
|
|
82
|
+
|
|
83
|
+
- `--pele-bg` is opaque because Pele also writes series labels and edge-label
|
|
84
|
+
plates in it.
|
|
85
|
+
- Series colors (timeline sections, pie slices, kanban lanes) are categories,
|
|
86
|
+
so they turn one hue rather than borrow intents, which would read as
|
|
87
|
+
status. The base is the soft primary ink, readable against the surface, and
|
|
88
|
+
Pele writes the series labels in `--pele-bg`.
|
|
89
|
+
- The `@supports` guard is required: a custom property accepts any value, so
|
|
90
|
+
an engine without relative colors would receive an invalid fill. Without
|
|
91
|
+
it, Pele keeps its own series palette.
|
|
92
|
+
|
|
93
|
+
The bridge stays in docs and the demo, like the
|
|
94
|
+
[combobox](../forms/combobox.md) and [date picker](../forms/date-picker.md)
|
|
95
|
+
ones: Actual CSS does not depend on Pele. The template pins the version the
|
|
96
|
+
bridge was checked against.
|