actual-css 0.18.0 → 0.19.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 +54 -0
- package/README.md +7 -5
- package/components.json +6 -2
- package/dist/actual.full.css +272 -57
- package/dist/actual.full.js +2 -2
- package/dist/actual.full.min.css +1 -1
- package/docs/design-notes/enhancement-contract.md +20 -11
- package/docs/design-notes/motion-cost.md +62 -0
- package/docs/design-notes/tokens.md +4 -0
- package/docs/navigation.json +3 -0
- package/docs/pages/components/aura.md +3 -0
- package/docs/pages/components/mark-sweep.md +42 -0
- package/docs/pages/components/rating.md +53 -22
- package/docs/pages/components/reveal.md +54 -0
- package/docs/pages/components/shimmer.md +3 -2
- package/docs/pages/enhancements/in-view.md +109 -0
- package/docs/pages/enhancements/overview.md +3 -2
- package/docs/pages/enhancements/scrollspy.md +5 -5
- package/docs/pages/examples/overview.md +5 -2
- package/docs/pages/forms/date-picker.md +3 -2
- package/docs/pages/forms/switch.md +25 -16
- package/docs/pages/foundations/tokens.md +37 -15
- package/docs/pages/foundations/typography.md +8 -2
- package/docs/pages/guides/introduction.md +1 -1
- package/docs/pages/guides/modular-import.md +20 -4
- package/docs/pages/guides/progressive-enhancement.md +2 -1
- package/docs/pages/guides/upgrading.md +1 -1
- package/docs/pages/patterns/code-block.md +1 -1
- package/docs/pages/patterns/empty-state.md +3 -3
- package/docs/pages/patterns/exclusive-accordion.md +3 -2
- package/docs/pages/patterns/hierarchical-nav.md +5 -4
- package/docs/pages/patterns/icon-input.md +1 -1
- package/docs/pages/patterns/icon-slot.md +4 -4
- package/docs/pages/patterns/intent-nesting.md +2 -3
- package/docs/pages/patterns/navigation-list.md +7 -4
- package/docs/pages/patterns/stat.md +3 -3
- package/docs/pages/patterns/structured-lists.md +1 -2
- package/llms.txt +2 -1
- package/package.json +3 -1
- package/reserved-classes.json +4 -0
- package/src/cli/actual-css.js +3 -1
- package/src/css/components/navbar.css +13 -5
- package/src/css/components/rating.css +23 -2
- package/src/css/components/scrollspy.css +4 -2
- package/src/css/core/base.css +16 -0
- package/src/css/core/focus.css +13 -12
- package/src/css/core/reset.css +10 -0
- package/src/css/core/theme.css +15 -0
- package/src/css/core/tokens.css +4 -10
- package/src/css/effects/aura.css +5 -0
- package/src/css/effects/index.css +2 -0
- package/src/css/effects/mark-sweep.css +64 -0
- package/src/css/effects/reveal.css +66 -0
- package/src/css/effects/shimmer.css +28 -10
- package/src/css/forms/choice.css +0 -7
- package/src/css/forms/switch.css +9 -9
- package/src/js/full.js +1 -0
- package/src/js/in-view.js +152 -0
- package/src/js/scrollspy.js +81 -2
- package/src/js/selectors.js +3 -0
- package/src/tooling/css-bundle.js +153 -6
- package/src/tooling/design-tokens.js +2 -0
- package/tokens.json +2 -0
|
@@ -2,24 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
> Toggle controls that share a native checkbox at the markup level, with a switch visual.
|
|
4
4
|
|
|
5
|
-
- The API is `class="switch"`. Use `role="switch"` for ARIA correctness.
|
|
6
|
-
- The visual state tracks the native `checked` attribute. No JavaScript is required.
|
|
7
|
-
- For strict ARIA correctness, keep `aria-checked` in sync. This is an enhancement, not the baseline.
|
|
8
|
-
|
|
9
5
|
```html demo
|
|
10
|
-
|
|
11
|
-
<input class="switch" type="checkbox" role="switch" checked />
|
|
6
|
+
<label class="choice">
|
|
7
|
+
<input class="switch" type="checkbox" role="switch" checked />
|
|
8
|
+
<span>Notifications</span>
|
|
9
|
+
</label>
|
|
12
10
|
```
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
- Apply `class="switch"` to a native checkbox and `role="switch"` for on/off semantics.
|
|
15
|
+
- Give it an accessible name through a label or `aria-label`.
|
|
16
|
+
- Use `checked` for the initial state and `.checked` to change it in JavaScript.
|
|
17
|
+
|
|
18
|
+
The browser exposes the native checked state to assistive technology; do not
|
|
19
|
+
add `aria-checked` or a change handler to synchronize it. The
|
|
20
|
+
[WAI-ARIA switch pattern](https://www.w3.org/WAI/ARIA/apg/patterns/switch/)
|
|
21
|
+
uses the native checked state for checkbox inputs.
|
|
23
22
|
|
|
24
23
|
Wrap a switch in `.choice` to pair it with a label. The switch stays
|
|
25
24
|
top-aligned with the first line of text, so labels that wrap onto two lines —
|
|
@@ -58,6 +57,13 @@ naturally or via an explicit line break — still sit cleanly.
|
|
|
58
57
|
</label>
|
|
59
58
|
```
|
|
60
59
|
|
|
60
|
+
## Notification preferences
|
|
61
|
+
|
|
62
|
+
For a notification matrix with two switch columns (email and push), see the
|
|
63
|
+
[notification preferences composition](../../demo/templates/blocks.html#notification-preferences).
|
|
64
|
+
Use native table headers for the shared rows and columns, and give each switch
|
|
65
|
+
an accessible name that includes both its topic and channel.
|
|
66
|
+
|
|
61
67
|
## Sizing and alignment
|
|
62
68
|
|
|
63
69
|
A switch is sized off the control typography, not field density. Its track
|
|
@@ -125,7 +131,10 @@ same optical line. Change the type or the control size and they stay level:
|
|
|
125
131
|
</div>
|
|
126
132
|
```
|
|
127
133
|
|
|
128
|
-
|
|
134
|
+
### Hooks
|
|
135
|
+
|
|
136
|
+
- `--switch-bg` — track fill; `--switch-border` follows it unless overridden.
|
|
137
|
+
- `--switch-border` — optional distinct edge; validation takes precedence.
|
|
129
138
|
|
|
130
139
|
- `--choice-control-size` — shared size for inline choices; the switch track is
|
|
131
140
|
this plus `0.125em`, so scaling it scales the checkbox and the switch together.
|
|
@@ -128,24 +128,45 @@ A theme with translucent surfaces overrides both with opaque values.
|
|
|
128
128
|
|
|
129
129
|
`--border` separates surfaces: cards, tables, dividers, panels. `--border-control`
|
|
130
130
|
is the resting edge that tells a control apart from the surface — fields,
|
|
131
|
-
checkboxes and radios,
|
|
131
|
+
checkboxes and radios, OTP cells, choice cards, join addons, neutral
|
|
132
132
|
outline buttons, the color and file inputs. It is derived from `--text` and
|
|
133
|
-
`--surface`; on the default palette it holds 3:1 against
|
|
134
|
-
`actual-css contrast` reports it for your
|
|
135
|
-
the ink share; raise it when a tinted
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
`--surface`; on the default palette it holds 3:1 against `--surface` and
|
|
134
|
+
2.9–3.0 against `--surface-subtle`. `actual-css contrast` reports it for your
|
|
135
|
+
theme. `--border-control-mix` sets the ink share; raise it when a tinted or
|
|
136
|
+
translucent surface pulls the edge under 3:1. The mix resolves at a theme
|
|
137
|
+
boundary: set it on `:root` or a `[data-theme]` island, because a plain container
|
|
138
|
+
inherits the colour already resolved above it. Without `color-mix()` it falls
|
|
139
|
+
back to `--border`. Set `--border-control` itself to soften or strengthen every
|
|
140
|
+
control in a subtree without touching a separator. Hover, checked, invalid and
|
|
141
|
+
disabled states keep their own colors.
|
|
142
|
+
|
|
143
|
+
```css
|
|
144
|
+
/* Every control in one theme: */
|
|
145
|
+
[data-theme="custom"] {
|
|
146
|
+
--border-control-mix: 35%;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Only the text fields of one form. --control-border is the control's own
|
|
150
|
+
alias, so it has to be set on the control, not on an ancestor. */
|
|
151
|
+
.my-form :is(.input, .textarea, .select) {
|
|
152
|
+
--control-border: var(--border);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Both reduce the contrast of the controls they touch; verify them in the context
|
|
157
|
+
they are used. The [border contrast lab](../../demo/templates/border-contrast.html)
|
|
158
|
+
renders the mix at 25, 35 and 45 % and measures both sides of the edge.
|
|
140
159
|
|
|
141
160
|
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.
|
|
142
161
|
|
|
143
|
-
Focus uses an outline:
|
|
162
|
+
Focus uses an outline in `--focus`, independently of text color, intent or selection:
|
|
144
163
|
|
|
145
|
-
- Links, summaries, nav items, and menu items use
|
|
164
|
+
- Links, summaries, nav items, and menu items use the generic outside line.
|
|
146
165
|
- Text fields use `--focus` inside their border.
|
|
147
166
|
- Buttons, close controls, choices, and switches use `--focus` outside their border.
|
|
148
167
|
|
|
168
|
+
Invalid fields keep their validation color on the focus line.
|
|
169
|
+
|
|
149
170
|
`--focus-ring-width` controls all these lines; `--focus-outline-offset` sets
|
|
150
171
|
the outside gap. Choose `--focus` with at least 3:1 contrast against both
|
|
151
172
|
`--surface` and `--surface-solid`. Forced colors use the system focus color.
|
|
@@ -154,17 +175,18 @@ the outside gap. Choose `--focus` with at least 3:1 contrast against both
|
|
|
154
175
|
:root {
|
|
155
176
|
--focus: hsl(268 30% 55%);
|
|
156
177
|
|
|
157
|
-
--focus-outline-color: currentColor;
|
|
158
178
|
--focus-outline-offset: 2px;
|
|
159
179
|
--focus-ring-width: 2px;
|
|
160
180
|
}
|
|
161
181
|
```
|
|
162
182
|
|
|
163
|
-
The line is composed on the focused element, so
|
|
164
|
-
|
|
183
|
+
The line is composed on the focused element, so local `--focus` and
|
|
184
|
+
`--focus-ring-width` overrides reach links and buttons alike. Set
|
|
185
|
+
`--focus-outline-color` to override the generic line color; it has no default
|
|
186
|
+
declaration, and an author override inherits through theme islands. Set
|
|
165
187
|
`--focus-outline` to replace the whole generic line (`4px dashed currentColor`);
|
|
166
188
|
it has no default value. Application CSS that draws the generic line itself
|
|
167
|
-
writes `var(--focus-ring-width) solid var(--focus-outline-color)`.
|
|
189
|
+
writes `var(--focus-ring-width) solid var(--focus-outline-color, var(--focus))`.
|
|
168
190
|
|
|
169
191
|
### Palette coherence
|
|
170
192
|
|
|
@@ -432,7 +454,7 @@ Motion durations keep transitions consistent and easy to disable.
|
|
|
432
454
|
--duration-fast: 100ms; /* quick feedback */
|
|
433
455
|
--duration-slow: 200ms; /* one-shot open/close */
|
|
434
456
|
--duration-spin: 0.75s; /* continuous spin (.spinner) */
|
|
435
|
-
--duration-shimmer:
|
|
457
|
+
--duration-shimmer: 2s; /* continuous shimmer (.shimmer, .skeleton, indeterminate .progress) */
|
|
436
458
|
--ease-enter: cubic-bezier(0.2, 0, 0, 1);
|
|
437
459
|
--ease-exit: cubic-bezier(0.4, 0, 1, 1);
|
|
438
460
|
}
|
|
@@ -38,7 +38,7 @@ It applies everywhere — cards, dialogs, heroes, app shells — not only in pro
|
|
|
38
38
|
|
|
39
39
|
It does not own visual hierarchy. No global `font-size` on headings, no global `font-weight` on headings, no global margins on headings, no global `text-decoration` on links. These choices would shape app UI in ways the framework cannot predict.
|
|
40
40
|
|
|
41
|
-
The mildly opinionated defaults at the baseline are few: line-height on headings (tight, so multi-line headings stay readable), `text-wrap: balance` on headings where supported, the `hr` rule, the `::selection` rule, the `code` / `kbd` / `samp` / `pre` font family, `pre` overflow containment, `small` font size, and a global link underline offset that prose and components reuse. Everything else stays neutral so components and `.prose` can take over without fighting the baseline.
|
|
41
|
+
The mildly opinionated defaults at the baseline are few: line-height on headings (tight, so multi-line headings stay readable), `text-wrap: balance` on headings where supported, the `hr` rule, the `::selection` rule, the `mark` highlight pair, the `code` / `kbd` / `samp` / `pre` font family, `pre` overflow containment, `small` font size, and a global link underline offset that prose and components reuse. Everything else stays neutral so components and `.prose` can take over without fighting the baseline.
|
|
42
42
|
|
|
43
43
|
Global links inherit color. The visual affordance of a link is the responsibility of `.prose` (for authored content) or of a component (for nav links, button-like links, tabs, breadcrumbs, etc.). Underlining every `a` globally would collide with all of those.
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ Global links inherit color. The visual affordance of a link is the responsibilit
|
|
|
46
46
|
|
|
47
47
|
`.prose` is the opt-in rich-text scope. It owns the visual hierarchy of authored content.
|
|
48
48
|
|
|
49
|
-
It owns: readable measure, vertical rhythm, heading hierarchy, link affordance, list spacing, description-list treatment, code and keyboard treatment, blockquote treatment, table treatment, image / figure / figcaption treatment,
|
|
49
|
+
It owns: readable measure, vertical rhythm, heading hierarchy, link affordance, list spacing, description-list treatment, code and keyboard treatment, blockquote treatment, table treatment, image / figure / figcaption treatment, and `text-wrap` balance / pretty for authored or generated rich-text descendants.
|
|
50
50
|
|
|
51
51
|
It does not own: page layout, app cards, alerts, forms, app tables, navigation, component variants, or any automatic styling outside the `.prose` subtree.
|
|
52
52
|
|
|
@@ -187,6 +187,12 @@ Three logical alignment utilities exist (`.text-start`, `.text-center`, `.text-e
|
|
|
187
187
|
|
|
188
188
|
`transition: all` is not used. Transitions target specific properties. This is a general rule, not just a typography rule.
|
|
189
189
|
|
|
190
|
+
## Mark
|
|
191
|
+
|
|
192
|
+
`mark` is styled at the baseline, not only inside `.prose`: a semantic highlight is a document affordance, and the UA's yellow ignores the theme. The pair is `--mark-bg` and `--mark-fg`, tuned to clear 4.5:1 in both schemes. Forced colors uses the system `Mark` / `MarkText` pair instead.
|
|
193
|
+
|
|
194
|
+
`<mark>` means the phrase is relevant in its context. A decorative highlight that only marks a phrase visually uses the [Mark Sweep](../components/mark-sweep.md) effect, which reuses the same pair.
|
|
195
|
+
|
|
190
196
|
## Small elements
|
|
191
197
|
|
|
192
198
|
`small` gets a smaller font size globally (`0.875em`) because it is a semantic element, not a utility. There is no `.small` class competing with the element.
|
|
@@ -52,7 +52,7 @@ optimizing — the bare `actual-css` entrypoint and `actual-css/full` both resol
|
|
|
52
52
|
to the complete compiled framework:
|
|
53
53
|
|
|
54
54
|
```html
|
|
55
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.
|
|
55
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/actual-css@0.19/dist/actual.full.min.css">
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
The package does not maintain separate partial bundles. Modular entrypoints map
|
|
@@ -218,7 +218,7 @@ cells, so they read as a list:
|
|
|
218
218
|
- **Components** — `actual-css/css/components`
|
|
219
219
|
buttons, surfaces, overlays, feedback, navigation, data and composed controls
|
|
220
220
|
- **Effects** — `actual-css/css/effects`
|
|
221
|
-
aura, shimmer
|
|
221
|
+
aura, mark-sweep, reveal, shimmer
|
|
222
222
|
- **Utilities** — `actual-css/css/utilities`
|
|
223
223
|
base and extra utilities
|
|
224
224
|
|
|
@@ -315,13 +315,29 @@ Use an existing CSS pipeline when these features are required.
|
|
|
315
315
|
|
|
316
316
|
One further case is refused rather than guessed: a remote import inside a layered subtree, because hoisting it before ordinary rules would move it out of its layer.
|
|
317
317
|
|
|
318
|
-
The CLI
|
|
318
|
+
The CLI rewrites relative `url()` references so they still point at the same file from the output's directory. With `--out public/build/app.css`, a stylesheet at `src/fonts/sans.css` that declares:
|
|
319
319
|
|
|
320
320
|
```css
|
|
321
|
-
|
|
321
|
+
src: url("files/sans.woff2");
|
|
322
322
|
```
|
|
323
323
|
|
|
324
|
-
|
|
324
|
+
ends up in the bundle as:
|
|
325
|
+
|
|
326
|
+
```css
|
|
327
|
+
src: url("../../src/fonts/files/sans.woff2");
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Only the reference changes: the assets are not copied, so the emitted URL still leads to the source location. The bundle and every referenced file must therefore sit in the tree your server publishes. In the example above, `src/` itself would have to be served; when only `public/` is published, keep the referenced files under `public/` too — fonts in `public/fonts/` referenced from a bundle in `public/build/` come out as `url("../fonts/…")`.
|
|
331
|
+
|
|
332
|
+
Left as written: `data:` and other URLs with a scheme, root-relative (`/fonts/sans.woff2`) and protocol-relative paths, a bare query or fragment (`url(?v=1)`, `url(#clip)`), and anything inside a comment or a string, such as a `url()` nested in a quoted data URI or a `content` value.
|
|
333
|
+
|
|
334
|
+
Refused rather than guessed:
|
|
335
|
+
|
|
336
|
+
- a relative `url()` in a stylesheet under `node_modules`, which is never served: copy those assets into your published tree and reference them there;
|
|
337
|
+
- a relative `url()` containing CSS escapes (`url(a\ b.png)`);
|
|
338
|
+
- a target on another Windows drive than the output, which no relative path can reach.
|
|
339
|
+
|
|
340
|
+
A `url()` split over several lines is not rewritten, and neither are the bare-string URLs of `image-set()`, `-webkit-image-set()` or `src()`: they break when the bundle moves.
|
|
325
341
|
|
|
326
342
|
Remote and absolute imports are preserved rather than fetched and are moved before ordinary rules so they remain valid CSS.
|
|
327
343
|
|
|
@@ -121,6 +121,7 @@ status bar, for example:
|
|
|
121
121
|
| `actual-css/js/tab` | Tab panels and arrow-key navigation (token `tabs`) |
|
|
122
122
|
| `actual-css/js/tooltip` | Tooltips on `data-tooltip` |
|
|
123
123
|
| `actual-css/js/scrollspy` | Scroll-driven nav highlighting (token `scrollspy`) |
|
|
124
|
+
| `actual-css/js/in-view` | One-shot viewport appearance state (token `in-view`) |
|
|
124
125
|
| `actual-css/js/filter` | Input value filtering on `data-filter` |
|
|
125
126
|
| `actual-css/js/mask` | Input masks on `data-mask` |
|
|
126
127
|
| `actual-css/js/password` | Password reveal toggle |
|
|
@@ -145,7 +146,7 @@ The JS is designed to run on its own, without Actual's stylesheet.
|
|
|
145
146
|
|
|
146
147
|
- **`data-enhance` tokens** register named behaviors. The runtime discovers
|
|
147
148
|
components through `data-enhance="tabs"`, `data-enhance="flyout"`, `data-enhance="range"`, `data-enhance="scrollspy"`,
|
|
148
|
-
`data-enhance="validation"`, `data-enhance="dirty"`, and
|
|
149
|
+
`data-enhance="in-view"`, `data-enhance="validation"`, `data-enhance="dirty"`, and
|
|
149
150
|
`data-enhance="ajax"` — no Actual presentation class needed.
|
|
150
151
|
Self-describing attributes (`data-mask`, `data-tooltip`,
|
|
151
152
|
`data-context-menu`) stay framework-neutral by construction.
|
|
@@ -119,7 +119,7 @@ layout.
|
|
|
119
119
|
`var(--focus-outline)` and write the generic line instead:
|
|
120
120
|
|
|
121
121
|
```css
|
|
122
|
-
outline: var(--focus-ring-width) solid var(--focus-outline-color);
|
|
122
|
+
outline: var(--focus-ring-width) solid var(--focus-outline-color, var(--focus));
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
Setting `--focus-outline` still replaces the generic line.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Code block with copy button
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Add a copy button to a code block with `.btn`, native code markup and the `enhance()` lifecycle.
|
|
4
4
|
|
|
5
5
|
```html
|
|
6
6
|
<div class="code-block">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Empty state
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
> Guide users when a list is empty or a search has no results, with a message and an optional next action.
|
|
4
|
+
|
|
5
|
+
Compose the region from layout primitives; there is no empty-state component.
|
|
6
6
|
|
|
7
7
|
**Related terms:** blank slate, zero state, no data, no results, first run,
|
|
8
8
|
placeholder content.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Exclusive accordion
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Keep one accordion panel open at a time with native `<details>` groups, without a JavaScript engine.
|
|
4
4
|
|
|
5
5
|
```html demo
|
|
6
6
|
<details name="faq" open>
|
|
@@ -13,4 +13,5 @@ Browsers that support the `name` attribute on `<details>` get native exclusive a
|
|
|
13
13
|
</details>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Browsers that support the `name` attribute on `<details>` enforce the group.
|
|
17
|
+
Omit `name` to allow several panels open at once.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Hierarchical scrollable nav
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Build a scrollable sidebar with collapsible navigation groups using native details and existing primitives.
|
|
4
4
|
|
|
5
5
|
**Related terms:** collapsible sidebar, nav group, sub-navigation, nested menu, expandable section, sidebar tree.
|
|
6
6
|
|
|
@@ -37,9 +37,10 @@ App shell with a collapsible nav tree. Uses existing primitives only — no tree
|
|
|
37
37
|
- A group is a `<details>` inside a row `<li>`, never a direct child of the
|
|
38
38
|
`<ul>`. Its `<summary class="nav-link">` takes the row, hover and focus, and
|
|
39
39
|
a chevron that follows the native `[open]` state.
|
|
40
|
-
- The group's links are a nested `.nav-list
|
|
41
|
-
|
|
42
|
-
when the icons are
|
|
40
|
+
- The group's links are a nested `.nav-list`: a rail under the centre of the
|
|
41
|
+
parent's icon, with the labels starting under the parent label. Set
|
|
42
|
+
`--nav-list-icon-size` on the nav when the icons are not 1em, and
|
|
43
|
+
`--nav-list-rail-color: transparent` for a plain indent without the line.
|
|
43
44
|
- `.overline` labels a section of the nav.
|
|
44
45
|
- `<details name="…">` makes the groups an exclusive accordion, without
|
|
45
46
|
JavaScript.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Icon slot
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
> Compose a stable icon box for notifications, activity feeds and cards, using existing layout primitives.
|
|
4
|
+
|
|
5
|
+
Use an icon slot for a leading icon, an icon disc or a status marker. There
|
|
6
|
+
is no dedicated primitive; compose the contract from existing pieces.
|
|
7
7
|
|
|
8
8
|
A contained icon zone must be a **stable box** that never shrinks, always
|
|
9
9
|
centers its glyph, and clips overflow:
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Intent nesting
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
own default intent unless you give them one:
|
|
3
|
+
Apply an intent to each component independently, so nested buttons and controls keep their own colors.
|
|
5
4
|
|
|
6
5
|
```html
|
|
7
6
|
<div class="alert danger">
|
|
@@ -12,4 +11,4 @@ own default intent unless you give them one:
|
|
|
12
11
|
```
|
|
13
12
|
|
|
14
13
|
The alert uses danger colors, Dismiss stays neutral, and Retry uses primary.
|
|
15
|
-
|
|
14
|
+
Nested components keep their default intent unless you give them one.
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
# Navigation list
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
chrome, stacks the rows and stretches each `.nav-link` across the row. For a
|
|
5
|
-
horizontal row of links, use `.cluster` on the list, which removes the list
|
|
6
|
-
chrome too.
|
|
3
|
+
Arrange navigation links in vertical lists or horizontal rows using `.nav-list` and `.cluster`.
|
|
7
4
|
|
|
8
5
|
```html demo
|
|
9
6
|
<div class="stack">
|
|
@@ -27,6 +24,12 @@ chrome too.
|
|
|
27
24
|
</div>
|
|
28
25
|
```
|
|
29
26
|
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
`.nav-list` removes native list chrome, stacks the rows and stretches each
|
|
30
|
+
`.nav-link` across the row. For a horizontal row of links, use `.cluster` on
|
|
31
|
+
the list, which removes the list chrome too.
|
|
32
|
+
|
|
30
33
|
Do not reset every list inside `nav`.
|
|
31
34
|
|
|
32
35
|
```css
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Stat
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
> Present a key figure with its label, supporting detail and optional trend for dashboards and KPI cards.
|
|
4
|
+
|
|
5
|
+
Compose it from a card, a grid and a badge; there is no stat component.
|
|
6
6
|
|
|
7
7
|
**Related terms:** KPI, metric, statistic, figure, stat card, number tile,
|
|
8
8
|
delta, trend indicator.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Structured lists
|
|
2
2
|
|
|
3
|
-
Choose list markup
|
|
4
|
-
component contract the collection needs.
|
|
3
|
+
Choose semantic list markup and compose the layout or component treatment that fits the collection.
|
|
5
4
|
|
|
6
5
|
| Need | Use |
|
|
7
6
|
| ----------------------------------------------- | ----------------------------------- |
|
package/llms.txt
CHANGED
|
@@ -31,7 +31,8 @@ show supported CSS modules and individual enhancer imports without duplicating
|
|
|
31
31
|
the full export list here.
|
|
32
32
|
|
|
33
33
|
Presentation (`class`) and behavior are separate layers. `data-enhance` takes
|
|
34
|
-
|
|
34
|
+
named tokens (`tabs`, `flyout`, `range`, `scrollspy`, `in-view`, `validation`,
|
|
35
|
+
`dirty`, `ajax`, `dialog`).
|
|
35
36
|
Leaf behaviors whose opt-in also carries configuration use their own attribute
|
|
36
37
|
(`data-tooltip`, `data-mask`, `data-filter`, `data-context-menu`), and `<dialog>`
|
|
37
38
|
needs none. See
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "actual-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "Plain CSS component framework with semantic classes, universal variants, small tokens, theme hooks, and progressive enhancements.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "bun@1.4.4",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"./js/focus": "./src/js/focus.js",
|
|
63
63
|
"./js/focus-group": "./src/js/focus-group.js",
|
|
64
64
|
"./js/input": "./src/js/input.js",
|
|
65
|
+
"./js/in-view": "./src/js/in-view.js",
|
|
65
66
|
"./js/keys": "./src/js/keys.js",
|
|
66
67
|
"./js/mask": "./src/js/mask.js",
|
|
67
68
|
"./js/menu": "./src/js/menu.js",
|
|
@@ -131,6 +132,7 @@
|
|
|
131
132
|
"report:neutral-ramp": "bun scripts/report-neutral-ramp.js",
|
|
132
133
|
"report:dead-css": "bun scripts/report-dead-css.js",
|
|
133
134
|
"report:overflow": "bun scripts/report-overflow.js",
|
|
135
|
+
"report:paint": "bun scripts/report-paint.js",
|
|
134
136
|
"check:architecture": "bun scripts/check-css-architecture.js",
|
|
135
137
|
"build:dist": "bun scripts/build-dist.js",
|
|
136
138
|
"build:js": "bun scripts/build-js.js",
|
package/reserved-classes.json
CHANGED
|
@@ -109,6 +109,7 @@
|
|
|
109
109
|
"input-icon",
|
|
110
110
|
"intent-color",
|
|
111
111
|
"is-open",
|
|
112
|
+
"is-pending",
|
|
112
113
|
"is-static",
|
|
113
114
|
"items-baseline",
|
|
114
115
|
"items-center",
|
|
@@ -139,6 +140,7 @@
|
|
|
139
140
|
"margin-inline-auto",
|
|
140
141
|
"margin-inline-end-auto",
|
|
141
142
|
"margin-inline-start-auto",
|
|
143
|
+
"mark-sweep",
|
|
142
144
|
"max-inline-size-none",
|
|
143
145
|
"mbe",
|
|
144
146
|
"mbs",
|
|
@@ -192,6 +194,8 @@
|
|
|
192
194
|
"range",
|
|
193
195
|
"rating",
|
|
194
196
|
"required-mark",
|
|
197
|
+
"reveal",
|
|
198
|
+
"reveal-group",
|
|
195
199
|
"reverse",
|
|
196
200
|
"row-gap-context",
|
|
197
201
|
"scroll-snap",
|
package/src/cli/actual-css.js
CHANGED
|
@@ -20,6 +20,8 @@ function usage() {
|
|
|
20
20
|
"bundle: flatten plain CSS @import chains from relative files and actual-css/css/*",
|
|
21
21
|
"subpaths. A layer or layer(name) import is flattened into the @layer block it",
|
|
22
22
|
"stands for. Remote imports are kept and hoisted to the top of the bundle.",
|
|
23
|
+
"Relative url() references are rewritten to resolve from the output file; the",
|
|
24
|
+
"assets are not copied, so keep them and the bundle in the served tree.",
|
|
23
25
|
"Leaves modern CSS syntax untouched; this is a bundler, not a transpiler.",
|
|
24
26
|
"",
|
|
25
27
|
"design: export a theme's tokens for Figma, Penpot and a portable DTCG profile,",
|
|
@@ -161,7 +163,7 @@ async function contrast({ themeFile, name }) {
|
|
|
161
163
|
async function bundle({ input, out, minify }) {
|
|
162
164
|
const inputPath = resolve(input);
|
|
163
165
|
const outputPath = resolve(out);
|
|
164
|
-
const css = await inlineImports(inputPath);
|
|
166
|
+
const css = await inlineImports(inputPath, { outDir: dirname(outputPath) });
|
|
165
167
|
const code = minify ? minifyCss(css) : css;
|
|
166
168
|
|
|
167
169
|
await mkdir(dirname(outputPath), { recursive: true });
|
|
@@ -10,10 +10,12 @@
|
|
|
10
10
|
* Public hooks:
|
|
11
11
|
* --nav-current-bg (fallback-only: current-link fill)
|
|
12
12
|
* --nav-current-fg (fallback-only: current-link ink)
|
|
13
|
-
* --nav-list-
|
|
13
|
+
* --nav-list-icon-size (fallback-only: leading icon width the nested rail centres on)
|
|
14
|
+
* --nav-list-rail-color (fallback-only: transparent hides the rail, alignment kept)
|
|
14
15
|
*
|
|
15
16
|
* Internal:
|
|
16
17
|
* --gap (local value for the shared gap token)
|
|
18
|
+
* --nav-list-rail-inset (half the icon on each side of the nested rail)
|
|
17
19
|
*/
|
|
18
20
|
/* Intent boundary — inherited intents do not tint this component.
|
|
19
21
|
Local intent classes still win because :where() has zero specificity.
|
|
@@ -178,12 +180,18 @@
|
|
|
178
180
|
transform: rotate(180deg);
|
|
179
181
|
}
|
|
180
182
|
|
|
181
|
-
/* A nested list
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
/* A nested list hangs from a rail under the centre of the parent's leading
|
|
184
|
+
icon, and its labels start under the parent's label. The two halves of the
|
|
185
|
+
icon split around the rail, which balances because .nav-link's gap and
|
|
186
|
+
inline padding are the same step. --nav-list-icon-size is the icon's width,
|
|
187
|
+
fallback-only: a base declaration on .nav-list would reset an override at
|
|
188
|
+
every level. */
|
|
184
189
|
.nav-list .nav-list {
|
|
185
190
|
margin-block-start: var(--gap);
|
|
186
|
-
|
|
191
|
+
--nav-list-rail-inset: calc((var(--nav-list-icon-size, 1em) - var(--border-width)) / 2);
|
|
192
|
+
margin-inline-start: calc(var(--space-20) + var(--nav-list-rail-inset));
|
|
193
|
+
padding-inline-start: var(--nav-list-rail-inset);
|
|
194
|
+
border-inline-start: var(--border-width) solid var(--nav-list-rail-color, var(--border));
|
|
187
195
|
}
|
|
188
196
|
|
|
189
197
|
/* Forced colors drops the fill and maps both inks to LinkText, so the current
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* --rating-empty
|
|
19
19
|
* --rating-star
|
|
20
20
|
* --rating-star-empty (the empty star's shape; the filled one by default)
|
|
21
|
+
* --rating-star-outline (a ready outline of the default star, for the hook above)
|
|
21
22
|
* --rating-value (display: the shown value, fractions allowed)
|
|
22
23
|
* --rating-max (display: the number of stars)
|
|
23
24
|
*
|
|
@@ -33,10 +34,18 @@
|
|
|
33
34
|
.rating {
|
|
34
35
|
--rating-size: 1.25rem;
|
|
35
36
|
--rating-gap: var(--space-10);
|
|
36
|
-
|
|
37
|
+
/* why: gold stars are the convention a reader recognizes, so the default
|
|
38
|
+
owns its color instead of borrowing --warning's meaning. A literal, not
|
|
39
|
+
light-dark(): it reads on both schemes, and an unsupported light-dark()
|
|
40
|
+
here would invalidate the fill. Accepted trade-off: 2.1:1 on a white
|
|
41
|
+
surface, under the 3:1 graphics target; the value lives in the
|
|
42
|
+
aria-label, and a theme picks its own ink on .rating. */
|
|
43
|
+
--rating-color: var(--intent, hsl(38 92% 50%));
|
|
37
44
|
--rating-empty: var(--border);
|
|
38
45
|
--rating-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 16 16'%3E%3Cpath d='M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.922-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.783.57-1.838-.196-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292Z'/%3E%3C/svg%3E");
|
|
39
|
-
/*
|
|
46
|
+
/* The default star stroked inside its own clip, so the line never grows
|
|
47
|
+
the silhouette and a filled and an empty star stay the same size. */
|
|
48
|
+
--rating-star-outline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 16 16'%3E%3CclipPath id='c'%3E%3Cpath d='M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.922-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.783.57-1.838-.196-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292Z'/%3E%3C/clipPath%3E%3Cpath d='M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 0 0 .95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 0 0-.364 1.118l1.07 3.292c.3.922-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 0 0-1.175 0l-2.8 2.034c-.783.57-1.838-.196-1.539-1.118l1.07-3.292a1 1 0 0 0-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 0 0 .951-.69l1.07-3.292Z' fill='none' stroke='black' stroke-width='2.4' clip-path='url(%23c)'/%3E%3C/svg%3E");
|
|
40
49
|
--rating-star-empty: var(--rating-star);
|
|
41
50
|
|
|
42
51
|
display: inline-flex;
|
|
@@ -44,6 +53,18 @@
|
|
|
44
53
|
color: var(--rating-color);
|
|
45
54
|
}
|
|
46
55
|
|
|
56
|
+
/* why: an empty star is a fill, not a stroke. --border is a stroke token, and
|
|
57
|
+
a theme with ink-dark borders (brutalist, cyberpunk) turned every empty star
|
|
58
|
+
solid black, louder than the filled ones. A light ink tint over the surface
|
|
59
|
+
reads as the same pale star on every theme. Guarded: inside a custom
|
|
60
|
+
property an unsupported color-mix() would invalidate the fill, not fall back
|
|
61
|
+
to --border. */
|
|
62
|
+
@supports (color: color-mix(in oklab, red, white)) {
|
|
63
|
+
.rating {
|
|
64
|
+
--rating-empty: color-mix(in oklab, var(--text) 15%, var(--surface));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
47
68
|
.rating > input[type="radio"] {
|
|
48
69
|
appearance: none;
|
|
49
70
|
flex: 0 0 auto;
|
|
@@ -18,11 +18,13 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
@supports selector(.scrollspy a:target-current) {
|
|
21
|
-
.
|
|
21
|
+
/* Native and JS activation lines can select different links. Once JS has
|
|
22
|
+
a current location, it owns the state and the native group must yield. */
|
|
23
|
+
.scrollspy:not(:has([aria-current="location"])) {
|
|
22
24
|
scroll-target-group: auto;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
.scrollspy a:target-current {
|
|
27
|
+
.scrollspy:not(:has([aria-current="location"])) a:target-current {
|
|
26
28
|
color: var(--text);
|
|
27
29
|
font-weight: var(--font-weight-medium);
|
|
28
30
|
}
|
package/src/css/core/base.css
CHANGED
|
@@ -97,6 +97,22 @@ small {
|
|
|
97
97
|
font-size: 0.875em;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/* A semantic highlight. The UA's yellow ignores the theme and clashes with a
|
|
101
|
+
dark palette, so the pair comes from the theme instead. `.mark-sweep` reuses
|
|
102
|
+
the same pair for its animated background. Forced colors keep the system
|
|
103
|
+
Mark pair, the one place the glyph/background relationship is guaranteed. */
|
|
104
|
+
mark {
|
|
105
|
+
background: var(--mark-bg);
|
|
106
|
+
color: var(--mark-fg);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@media (forced-colors: active) {
|
|
110
|
+
mark {
|
|
111
|
+
background: Mark;
|
|
112
|
+
color: MarkText;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
100
116
|
::selection {
|
|
101
117
|
background: var(--selection-bg, var(--primary));
|
|
102
118
|
color: var(--selection-fg, var(--primary-fg));
|