actual-css 0.19.4 → 0.19.5
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 +8 -0
- package/README.md +2 -2
- package/dist/actual.full.css +6 -2
- package/dist/actual.full.min.css +1 -1
- package/docs/pages/forms/joined-controls.md +1 -1
- package/docs/pages/forms/switch.md +4 -2
- package/docs/pages/foundations/tokens.md +13 -13
- package/llms.txt +3 -3
- package/package.json +4 -5
- package/src/cli/actual-css.js +3 -3
- package/src/css/forms/switch.css +6 -2
- package/src/tooling/theme-contrast.js +6 -2
- package/docs/design-notes/accessibility-decisions.md +0 -63
- package/docs/design-notes/app-ui.md +0 -67
- package/docs/design-notes/architecture.md +0 -70
- package/docs/design-notes/browser-support.md +0 -239
- package/docs/design-notes/cascade-layer.md +0 -74
- package/docs/design-notes/column-layout.md +0 -260
- package/docs/design-notes/css-anchor.md +0 -87
- package/docs/design-notes/enhancement-contract.md +0 -193
- package/docs/design-notes/forced-colors.md +0 -123
- package/docs/design-notes/grid.md +0 -785
- package/docs/design-notes/motion-cost.md +0 -62
- package/docs/design-notes/naming.md +0 -71
- package/docs/design-notes/platform-alignment.md +0 -602
- package/docs/design-notes/popover-manual-poc.md +0 -328
- package/docs/design-notes/references.md +0 -336
- package/docs/design-notes/rich-text.md +0 -61
- package/docs/design-notes/spacing-units.md +0 -286
- package/docs/design-notes/steps.md +0 -776
- package/docs/design-notes/surface-reparenting.md +0 -130
- package/docs/design-notes/tokens.md +0 -166
- package/docs/design-notes/tooltip-coordinate-space.md +0 -130
- package/docs/design-notes/widget-primitives.md +0 -144
- package/docs/navigation.json +0 -176
|
@@ -57,7 +57,7 @@ any labelled set of related objects. Suppress it on the element:
|
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Unlike the menu rule in
|
|
60
|
-
[flyout](../enhancements/flyout.
|
|
60
|
+
[flyout](../enhancements/flyout.md#linting-rolemenu), do not switch this one
|
|
61
61
|
off globally: it correctly catches `<div role="navigation">`,
|
|
62
62
|
`<div role="button">` and `<div role="separator">`. And drop `role="group"`
|
|
63
63
|
rather than suppressing it when the wrapper has no label to give — an unnamed
|
|
@@ -133,8 +133,10 @@ same optical line. Change the type or the control size and they stay level:
|
|
|
133
133
|
|
|
134
134
|
### Hooks
|
|
135
135
|
|
|
136
|
-
- `--switch-bg` — track fill
|
|
137
|
-
- `--switch-border` —
|
|
136
|
+
- `--switch-bg` — track fill.
|
|
137
|
+
- `--switch-border` — track edge. At rest it is `--border-control`, the 3:1 edge
|
|
138
|
+
that identifies the unchecked switch on its surface; checked and disabled
|
|
139
|
+
tracks follow `--switch-bg`. Validation takes precedence.
|
|
138
140
|
|
|
139
141
|
- `--choice-control-size` — shared size for inline choices; the switch track is
|
|
140
142
|
this plus `0.125em`, so scaling it scales the checkbox and the switch together.
|
|
@@ -126,19 +126,19 @@ Surfaces are painted material and may be translucent. Two roles must stay opaque
|
|
|
126
126
|
|
|
127
127
|
A theme with translucent surfaces overrides both with opaque values.
|
|
128
128
|
|
|
129
|
-
`--border` separates surfaces: cards, tables, dividers, panels.
|
|
130
|
-
is the resting edge that tells a control apart from the
|
|
131
|
-
checkboxes and radios, OTP cells, choice
|
|
132
|
-
outline buttons, the color and file inputs. It is
|
|
133
|
-
`--surface`; on the default palette it holds 3:1
|
|
134
|
-
2.9–3.0 against `--surface-subtle`. `actual-css
|
|
135
|
-
theme. `--border-control-mix` sets the ink share;
|
|
136
|
-
translucent surface pulls the edge under 3:1. The mix
|
|
137
|
-
boundary: set it on `:root` or a `[data-theme]` island,
|
|
138
|
-
inherits the colour already resolved above it. Without
|
|
139
|
-
back to `--border`. Set `--border-control` itself to
|
|
140
|
-
control in a subtree without touching a separator.
|
|
141
|
-
disabled states keep their own colors.
|
|
129
|
+
`--border` separates surfaces: cards, tables, dividers, panels.
|
|
130
|
+
`--border-control` is the resting edge that tells a control apart from the
|
|
131
|
+
surface — fields, checkboxes and radios, unchecked switches, OTP cells, choice
|
|
132
|
+
cards, join addons, neutral outline buttons, the color and file inputs. It is
|
|
133
|
+
derived from `--text` and `--surface`; on the default palette it holds 3:1
|
|
134
|
+
against `--surface` and 2.9–3.0 against `--surface-subtle`. `actual-css
|
|
135
|
+
contrast` reports it for your theme. `--border-control-mix` sets the ink share;
|
|
136
|
+
raise it when a tinted or translucent surface pulls the edge under 3:1. The mix
|
|
137
|
+
resolves at a theme boundary: set it on `:root` or a `[data-theme]` island,
|
|
138
|
+
because a plain container inherits the colour already resolved above it. Without
|
|
139
|
+
`color-mix()` it falls back to `--border`. Set `--border-control` itself to
|
|
140
|
+
soften or strengthen every control in a subtree without touching a separator.
|
|
141
|
+
Hover, checked, invalid and disabled states keep their own colors.
|
|
142
142
|
|
|
143
143
|
```css
|
|
144
144
|
/* Every control in one theme: */
|
package/llms.txt
CHANGED
|
@@ -36,12 +36,12 @@ named tokens (`tabs`, `flyout`, `range`, `scrollspy`, `in-view`, `validation`,
|
|
|
36
36
|
Leaf behaviors whose opt-in also carries configuration use their own attribute
|
|
37
37
|
(`data-tooltip`, `data-mask`, `data-filter`, `data-context-menu`), and `<dialog>`
|
|
38
38
|
needs none. See
|
|
39
|
-
[when a token, when a data-*](docs/design-notes/enhancement-contract.md).
|
|
39
|
+
[when a token, when a data-*](https://github.com/lekoala/actual-css/blob/master/docs/design-notes/enhancement-contract.md).
|
|
40
40
|
|
|
41
41
|
Behaviour primitives are independently importable for building custom widgets,
|
|
42
42
|
including `enhance`, `surface`, `floating`, `focus-group`, `keys`, `input`,
|
|
43
43
|
`command`, `menu`, `focus`, `escape`, and `events`. See
|
|
44
|
-
[widget primitives](docs/design-notes/widget-primitives.md).
|
|
44
|
+
[widget primitives](https://github.com/lekoala/actual-css/blob/master/docs/design-notes/widget-primitives.md).
|
|
45
45
|
|
|
46
46
|
## What the vocabulary does not have
|
|
47
47
|
|
|
@@ -55,7 +55,7 @@ including `enhance`, `surface`, `floating`, `focus-group`, `keys`, `input`,
|
|
|
55
55
|
- Modifiers such as `.ghost`, `.link`, `.flush`, `.raised` only mean something
|
|
56
56
|
on their component; alone they are inert.
|
|
57
57
|
|
|
58
|
-
See [naming](docs/design-notes/naming.md) and
|
|
58
|
+
See [naming](https://github.com/lekoala/actual-css/blob/master/docs/design-notes/naming.md) and
|
|
59
59
|
[utilities non-goals](docs/pages/utilities/overview.md#non-goals).
|
|
60
60
|
|
|
61
61
|
## Choosing a page shell
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "actual-css",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.5",
|
|
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",
|
|
@@ -105,12 +105,11 @@
|
|
|
105
105
|
"reserved-classes.json",
|
|
106
106
|
"components.json",
|
|
107
107
|
"tokens.json",
|
|
108
|
-
"docs",
|
|
108
|
+
"docs/pages",
|
|
109
|
+
"docs/brand",
|
|
109
110
|
"skills",
|
|
110
111
|
"CHANGELOG.md",
|
|
111
|
-
"llms.txt"
|
|
112
|
-
"LICENSE",
|
|
113
|
-
"README.md"
|
|
112
|
+
"llms.txt"
|
|
114
113
|
],
|
|
115
114
|
"engines": {
|
|
116
115
|
"bun": ">=1.4.0",
|
package/src/cli/actual-css.js
CHANGED
|
@@ -30,9 +30,9 @@ function usage() {
|
|
|
30
30
|
"",
|
|
31
31
|
"contrast: measure the pairs a theme tunes by hand in headless Chrome, in every",
|
|
32
32
|
"scheme it declares: soft ink on its resting and hovered fill, the resting edge",
|
|
33
|
-
"of a field, checkbox and
|
|
34
|
-
"the invalid-field focus line, and the inverse text. Exits 1
|
|
35
|
-
"its threshold. Needs Bun (bunx --bun actual-css contrast ...).",
|
|
33
|
+
"of a field, checkbox, radio and unchecked switch, the focus line on --surface",
|
|
34
|
+
"and --surface-solid, the invalid-field focus line, and the inverse text. Exits 1",
|
|
35
|
+
"when a pair misses its threshold. Needs Bun (bunx --bun actual-css contrast ...).",
|
|
36
36
|
].join("\n");
|
|
37
37
|
}
|
|
38
38
|
|
package/src/css/forms/switch.css
CHANGED
|
@@ -30,8 +30,10 @@
|
|
|
30
30
|
|
|
31
31
|
.switch {
|
|
32
32
|
--switch-bg: var(--border);
|
|
33
|
-
/*
|
|
34
|
-
|
|
33
|
+
/* The quiet --border track does not stand out from the surface: at rest the
|
|
34
|
+
control edge is what identifies the switch (WCAG 1.4.11, 3:1). Checked and
|
|
35
|
+
disabled tracks drop it for a uniform fill. */
|
|
36
|
+
--switch-border: var(--border-control);
|
|
35
37
|
--switch-knob: var(--surface-raised);
|
|
36
38
|
--switch-block-size: calc(var(--choice-control-size) + 0.125em);
|
|
37
39
|
--switch-width: calc(var(--switch-block-size) * 1.8);
|
|
@@ -108,6 +110,7 @@
|
|
|
108
110
|
|
|
109
111
|
.switch:checked {
|
|
110
112
|
--switch-bg: var(--intent, var(--state-selected));
|
|
113
|
+
--switch-border: var(--switch-bg);
|
|
111
114
|
--switch-knob: var(--intent-fg, var(--state-selected-fg));
|
|
112
115
|
}
|
|
113
116
|
|
|
@@ -138,6 +141,7 @@
|
|
|
138
141
|
|
|
139
142
|
.switch:disabled {
|
|
140
143
|
--switch-bg: var(--surface-subtle);
|
|
144
|
+
--switch-border: var(--switch-bg);
|
|
141
145
|
--switch-knob: var(--state-disabled);
|
|
142
146
|
opacity: 1;
|
|
143
147
|
cursor: not-allowed;
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* (`bun run report:theme-contrast`).
|
|
6
6
|
*
|
|
7
7
|
* Measured per island (one per color scheme the theme declares):
|
|
8
|
-
* - the resting edge of a field, checkbox and
|
|
8
|
+
* - the resting edge of a field, checkbox, radio and unchecked switch against
|
|
9
|
+
* --surface (3:1)
|
|
9
10
|
* - soft ink against the resting and the hovered soft fill (4.5:1), on each
|
|
10
11
|
* surface a soft element sits on
|
|
11
12
|
* - the solid pairs, -fg on the intent fill (4.5:1); a fill painted by a
|
|
@@ -73,11 +74,14 @@ function islandMarkup(id, scheme) {
|
|
|
73
74
|
|
|
74
75
|
/* Controls whose resting edge is all that identifies them (WCAG 1.4.11): the
|
|
75
76
|
edge against the surface around them needs 3:1. The field is read on its
|
|
76
|
-
block-end side, the one an underline-only theme (material) keeps.
|
|
77
|
+
block-end side, the one an underline-only theme (material) keeps. An
|
|
78
|
+
unchecked switch is one of them: its track fill is a quiet --border, so the
|
|
79
|
+
edge is what tells it apart from the surface. */
|
|
77
80
|
export const CONTROLS = [
|
|
78
81
|
["field", '<input class="input">'],
|
|
79
82
|
["checkbox", '<input class="check" type="checkbox">'],
|
|
80
83
|
["radio", '<input class="radio" type="radio">'],
|
|
84
|
+
["switch", '<input class="switch" type="checkbox" role="switch">'],
|
|
81
85
|
];
|
|
82
86
|
|
|
83
87
|
const ratio = (fg, bg) => (fg[3] < 255 || bg[3] < 255 ? null : contrast(fg, bg));
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Accessibility decisions
|
|
2
|
-
|
|
3
|
-
## Guarantees
|
|
4
|
-
|
|
5
|
-
Actual CSS makes the accessible path the default where CSS and small runtime enhancers can help.
|
|
6
|
-
|
|
7
|
-
- Visible `:focus-visible` styles on interactive components.
|
|
8
|
-
- Native elements first: `button`, `a`, `details`, `dialog`, form controls.
|
|
9
|
-
- Reduced motion support through shared duration tokens and the reset.
|
|
10
|
-
- Forced-colors support on controls and visual state indicators.
|
|
11
|
-
- DOM tests for enhancer lifecycle, focus, attributes, and keyboard behavior.
|
|
12
|
-
|
|
13
|
-
## Linters that reject ARIA patterns
|
|
14
|
-
|
|
15
|
-
Measured on Biome 2.5.6, in HTML and JSX alike.
|
|
16
|
-
|
|
17
|
-
`a11y/noNoninteractiveElementToInteractiveRole` reports `<menu role="menu">`,
|
|
18
|
-
and its fix removes the role, which dismantles the composite. It is a port of
|
|
19
|
-
`jsx-a11y/no-noninteractive-element-to-interactive-role` that dropped the source
|
|
20
|
-
rule's default allowlist, so every ARIA composite built on a list is reported —
|
|
21
|
-
`menu`, `listbox`, `tablist`, `menubar`, `tree`, `grid` — even though the source
|
|
22
|
-
documents `<ul role="menu">` as valid. Switch the rule off; a per-element
|
|
23
|
-
suppression would sit above every menu in the markup.
|
|
24
|
-
|
|
25
|
-
`a11y/useSemanticElements` reports `role="group"` on `.join` and
|
|
26
|
-
`.avatar-stack`, suggesting `<fieldset>`. `<fieldset>` groups form controls
|
|
27
|
-
under a `<legend>`; ARIA's `group` is any labelled set of related objects. This
|
|
28
|
-
rule stays on — it correctly catches `<div role="navigation">`,
|
|
29
|
-
`<div role="button">`, `<div role="separator">` — so suppress it on the wrapper
|
|
30
|
-
instead. A wrapper with no label to give should drop the role rather than
|
|
31
|
-
suppress the rule.
|
|
32
|
-
|
|
33
|
-
Two decisions these findings settled:
|
|
34
|
-
|
|
35
|
-
- `.join` keeps `role="group"` rather than `role="toolbar"`, which the rule does
|
|
36
|
-
not report. Toolbar owes arrow-key navigation with a roving tabindex, and
|
|
37
|
-
claiming the role without the behaviour is worse than the false positive.
|
|
38
|
-
- `.menu-separator` is an empty `<li>` because list containers require list
|
|
39
|
-
rows. An ARIA menu exposes that divider with `role="separator"`. A native
|
|
40
|
-
list hides the decorative row with `aria-hidden="true"` so it contributes no
|
|
41
|
-
empty list item. Scope any Biome `a11y/useSemanticElements` suppression to
|
|
42
|
-
the ARIA divider, since its suggested `<hr>` would break the content model.
|
|
43
|
-
|
|
44
|
-
## Author Responsibilities
|
|
45
|
-
|
|
46
|
-
- Name icon-only buttons.
|
|
47
|
-
- Use the ARIA attributes shown in examples.
|
|
48
|
-
- Keep form errors inline and connected with `aria-describedby`.
|
|
49
|
-
- Do not put critical information only in a transient notification.
|
|
50
|
-
|
|
51
|
-
## Interactive states
|
|
52
|
-
|
|
53
|
-
- Interactive controls must be identifiable at rest, either by their own styling or by clear surrounding context.
|
|
54
|
-
- Interactive states are: rest, hover, active / pressed, focus-visible, disabled, selected / current / expanded (when applicable).
|
|
55
|
-
- Do not rely on hover alone to reveal interactivity.
|
|
56
|
-
- Do not use color alone to communicate state.
|
|
57
|
-
- Use structure, border, background, iconography, and spacing consistently.
|
|
58
|
-
- Select controls stay quieter than text inputs: hover uses a subtle surface change, while focus-visible and open states use a soft ring in normal color modes.
|
|
59
|
-
- Forced-colors keeps strong outlines for select focus/open states, high-contrast option hover/focus states, and a selected checkmark that inherits the option text color unless the option is highlighted.
|
|
60
|
-
- Global Escape handlers only prevent default when Actual has a visible managed surface to close.
|
|
61
|
-
- Prefer explicit `data-filter` values in examples and docs. Empty `data-filter`
|
|
62
|
-
does not infer behavior from `inputmode`: keyboard hints and destructive value
|
|
63
|
-
filtering remain separate contracts.
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Application UI boundaries
|
|
2
|
-
|
|
3
|
-
Actual CSS provides application chrome and content composition without owning
|
|
4
|
-
the application lifecycle.
|
|
5
|
-
|
|
6
|
-
```text
|
|
7
|
-
app-shell full-height single-column document flow
|
|
8
|
-
sidebar-shell persistent side region + main, each scrolling, on a wide viewport
|
|
9
|
-
topbar persistent top application chrome
|
|
10
|
-
app-layout specialized topbar + internal scroll + adaptive navigation recipe
|
|
11
|
-
app-nav primary application destinations
|
|
12
|
-
list repeated application rows with leading/content/trailing regions
|
|
13
|
-
status-bar passive transient feedback
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
`app-layout` is selected by that complete behavior, never by product category.
|
|
17
|
-
Public sites and applications with ordinary document scrolling stay on
|
|
18
|
-
semantic landmarks and may use `app-shell`; a site header uses `navbar`.
|
|
19
|
-
|
|
20
|
-
Routing, navigation history, application state, SPA page lifecycle, service
|
|
21
|
-
workers, manifests, offline policy, and install prompts belong to the
|
|
22
|
-
application. Actual does not prescribe Material breakpoints or device classes;
|
|
23
|
-
the application layout changes when its available viewport can accommodate
|
|
24
|
-
labelled side navigation.
|
|
25
|
-
|
|
26
|
-
## Sidebar shell
|
|
27
|
-
|
|
28
|
-
An admin or dashboard keeps a sidebar beside its content on a wide screen and
|
|
29
|
-
hands it to a drawer on a phone. None of the existing shapes is that:
|
|
30
|
-
`.app-shell` is one column, `.sidebar-layout` a wrapping pair inside a page,
|
|
31
|
-
and `.app-layout` moves navigation to a bottom bar.
|
|
32
|
-
|
|
33
|
-
Contract:
|
|
34
|
-
|
|
35
|
-
- Two direct children: an `aside` (the side region, any content) and one
|
|
36
|
-
other element (the main region). The drawer is a separate `dialog.drawer`
|
|
37
|
-
outside the shell; the two are never one element transformed.
|
|
38
|
-
- At `64rem` and up, a viewport-height grid, side then main. Each region
|
|
39
|
-
scrolls on its own, so the sidebar never scrolls away with the content.
|
|
40
|
-
- Below `64rem`, the side region is hidden and the document scrolls. A phone
|
|
41
|
-
keeps its native behaviors: the collapsing URL bar, tap-to-top, and a
|
|
42
|
-
virtual keyboard that resizes the document rather than a fixed box.
|
|
43
|
-
- The breakpoint is a literal: a custom property cannot sit in a media
|
|
44
|
-
condition. A project that needs another one copies the two rules.
|
|
45
|
-
- Hidden with `(width < 64rem)`, not shown above it: the side region keeps
|
|
46
|
-
the author's own `display` (an `aside.stack`). Where range syntax is
|
|
47
|
-
unsupported the rule drops and the sidebar stacks above the content, still
|
|
48
|
-
reachable.
|
|
49
|
-
- CSS only. Closing an open drawer when the viewport widens belongs to the
|
|
50
|
-
page (`matchMedia` change → `dialog.close()`), a documented recipe rather
|
|
51
|
-
than a watcher in the primitive.
|
|
52
|
-
- Print is one flow, side then main, nothing clipped. The narrow rule is
|
|
53
|
-
`screen` only: print never hides framework content, so leaving the sidebar
|
|
54
|
-
off paper is the application's print stylesheet.
|
|
55
|
-
|
|
56
|
-
Rejected: a bottom navigation (that is `.app-layout`), a collapsible icon rail
|
|
57
|
-
(an application state), and a breakpoint hook (impossible in a media query).
|
|
58
|
-
|
|
59
|
-
Compact UI vocabulary remains semantic rather than shape-driven:
|
|
60
|
-
|
|
61
|
-
- use `.btn.sm` for compact actions and `aria-pressed` filters;
|
|
62
|
-
- use `.badge` for passive counts, statuses, and categories;
|
|
63
|
-
- use `.badge` with a `.close` button when a displayed tag can be removed;
|
|
64
|
-
- use `.status-bar` for passive feedback, not an actionable toast.
|
|
65
|
-
|
|
66
|
-
There is no generic chip or snackbar component. Those names conflate different
|
|
67
|
-
HTML semantics that the existing components already keep explicit.
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# Architecture
|
|
2
|
-
|
|
3
|
-
How to decide what belongs in Actual, and where. The rules an application
|
|
4
|
-
author follows are in [Philosophy](../pages/foundations/philosophy.md) and
|
|
5
|
-
[Building with Actual CSS](../pages/guides/integrating-actual-css.md); naming is
|
|
6
|
-
in [Naming conventions](naming.md), behavior in
|
|
7
|
-
[Enhancement contract](enhancement-contract.md).
|
|
8
|
-
|
|
9
|
-
The test for where a rule goes: if it changes how someone writes their
|
|
10
|
-
application CSS, it belongs in the guide; if it only decides how Actual is
|
|
11
|
-
built, it belongs here.
|
|
12
|
-
|
|
13
|
-
## Ownership
|
|
14
|
-
|
|
15
|
-
- **A component owns its intrinsic anatomy, not page composition.** Padding,
|
|
16
|
-
surface, slots and states are the component's; outer margins and sibling
|
|
17
|
-
spacing are not.
|
|
18
|
-
- **A layout primitive on a component replaces its default layout without
|
|
19
|
-
specificity tricks.** The component's own box layout sits in `:where()`
|
|
20
|
-
(`.card`, its header and footer slots). `components/` loads after `layout/`,
|
|
21
|
-
so a plain class declaration would win on source order and flatten
|
|
22
|
-
`class="card media"` into a column.
|
|
23
|
-
- **Structural anatomy never lends a class's weight to a bare element.**
|
|
24
|
-
`:where(dialog).modal > :where(form, .stack)`, not `> :is(form, .stack)`,
|
|
25
|
-
which would give `<form>` the specificity of `.stack`.
|
|
26
|
-
|
|
27
|
-
## Utilities
|
|
28
|
-
|
|
29
|
-
A utility makes one reusable adjustment. A class that sets a surface, a border,
|
|
30
|
-
padding and type together has become a component, whatever file it lives in.
|
|
31
|
-
|
|
32
|
-
## Abstraction
|
|
33
|
-
|
|
34
|
-
- **Duplication beats an abstraction that couples unrelated components.** Every
|
|
35
|
-
file under `components/` is a public export (`actual-css/css/components/*`).
|
|
36
|
-
A shared file imported only by the index would break a single-component
|
|
37
|
-
import, so `.modal` and `.drawer` each keep the declarations they share.
|
|
38
|
-
- **No generic primitive because two examples look alike.** A primitive names a
|
|
39
|
-
relationship that recurs across unrelated applications. When the existing
|
|
40
|
-
answer was hard to find, improve the docs instead.
|
|
41
|
-
- **Bytes do not justify specificity.** A selector is not merged or raised to
|
|
42
|
-
save a few compressed bytes when it changes who can override it.
|
|
43
|
-
|
|
44
|
-
## Tokens
|
|
45
|
-
|
|
46
|
-
See [Token architecture](tokens.md) for scope, inheritance, size and density,
|
|
47
|
-
color interpolation, motion, and component mapping constraints.
|
|
48
|
-
|
|
49
|
-
A value derived from an overridable token is computed on the element that uses
|
|
50
|
-
it, never as an alias on `:root`: an inherited custom property arrives already
|
|
51
|
-
computed, so an override on a theme island or a region would not reach it. The
|
|
52
|
-
generic focus line (`focus.css`) and the dialog and drawer focus reserves
|
|
53
|
-
follow this rule.
|
|
54
|
-
|
|
55
|
-
## Decoration
|
|
56
|
-
|
|
57
|
-
A decorative cue must not dictate geometry, focus or scroll behavior. Scrolling
|
|
58
|
-
strips have no shared edge fade: its mask set their scroll-padding and focus
|
|
59
|
-
reserve, and repeated what a clipped item and the scrollbar already show. The
|
|
60
|
-
strips reserve only their focus line. `.tabs` is the exception: it hides its
|
|
61
|
-
scrollbar, so its fade is the cue, and the fade spans the strip's existing
|
|
62
|
-
scroll-padding instead of setting it.
|
|
63
|
-
|
|
64
|
-
Starting a strip on its current item is a progressive enhancement, not a
|
|
65
|
-
contract: `scroll-initial-target` on the item, no runtime. One declaration
|
|
66
|
-
replaces a module, its opt-in token and its wait for parsing. Engines without
|
|
67
|
-
the property start at the first item, which the fade or the scrollbar already
|
|
68
|
-
says is not all; do not reintroduce a script fallback for them. `.pagination` does not scroll at all: it wraps, because a
|
|
69
|
-
click on a page navigates instead of moving the strip, so a scrolling row hid
|
|
70
|
-
pages the mouse could not reach.
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
# Browser support strategy
|
|
2
|
-
|
|
3
|
-
## Actual tiers
|
|
4
|
-
|
|
5
|
-
The compatibility contract is expressed in browser versions, not ECMAScript
|
|
6
|
-
edition labels. Each tier is defined by what it guarantees.
|
|
7
|
-
|
|
8
|
-
| Actual tier | Firefox | Safari | Chromium | Contract |
|
|
9
|
-
| ----------- | -------: | ------: | -------: | ---------------------------------------------- |
|
|
10
|
-
| Degraded | 78+ | 14+ | 88+ | Semantic HTML + core CSS; JS unsupported |
|
|
11
|
-
| **Minimal** | **125+** | **17+** | **116+** | Full supported Actual experience, including JS |
|
|
12
|
-
| Recommended | 129+ | 17.5+ | 123+ | Target experience |
|
|
13
|
-
|
|
14
|
-
- **Degraded** keeps useful HTML and CSS on older browsers. JavaScript is
|
|
15
|
-
explicitly outside the supported contract there.
|
|
16
|
-
- **Minimal** is the JavaScript baseline: the complete Actual experience,
|
|
17
|
-
including the runtime, is supported from this tier up. The runtime assumes
|
|
18
|
-
modern platform primitives available across the whole tier and ships no
|
|
19
|
-
legacy compatibility layer or polyfill.
|
|
20
|
-
|
|
21
|
-
Only the JavaScript floor is expressed by Minimal. CSS degradation is owed to
|
|
22
|
-
Degraded, so a capability being available across Minimal does not make it CSS
|
|
23
|
-
baseline — `check:compat` audits stylesheets against the Degraded floor.
|
|
24
|
-
|
|
25
|
-
Degraded browsers may still run some JavaScript successfully, but that
|
|
26
|
-
behavior is not tested, documented as supported, or preserved when the
|
|
27
|
-
runtime evolves.
|
|
28
|
-
|
|
29
|
-
### Native Popover and the tiers
|
|
30
|
-
|
|
31
|
-
Minimal sits exactly where the manual Popover transport lands: Chromium 116,
|
|
32
|
-
Firefox 125, Safari 17. That is what the floor buys, and the whole of what the
|
|
33
|
-
runtime requires:
|
|
34
|
-
|
|
35
|
-
```text
|
|
36
|
-
popover="manual"
|
|
37
|
-
showPopover()
|
|
38
|
-
hidePopover()
|
|
39
|
-
top-layer promotion + closed-state display: none
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
`popovertarget`, `popover="auto"` and `:popover-open` arrive on the same
|
|
43
|
-
engines and are guaranteed too, but the runtime uses none of them — it keeps
|
|
44
|
-
`aria-controls` and drives the lifecycle itself. Newer parts of the API
|
|
45
|
-
(`popover="hint"`, interest invokers) are covered by no tier.
|
|
46
|
-
|
|
47
|
-
| Actual tier | Manual Popover transport | Lifecycle owner |
|
|
48
|
-
| ----------- | ------------------------ | -------------------------------------------- |
|
|
49
|
-
| Degraded | no | HTML/CSS fallback only |
|
|
50
|
-
| Minimal | yes | `surface.js`, `tooltip.js` |
|
|
51
|
-
| Recommended | yes | native Popover, or `surface.js`/`tooltip.js` |
|
|
52
|
-
|
|
53
|
-
Actual's presentation classes compose with either lifecycle. Both runtimes use
|
|
54
|
-
the transport and never the native lifecycle: `popover="auto"` cannot express
|
|
55
|
-
`data-flyout-auto-close`, and it would put the browser's light dismiss in
|
|
56
|
-
competition with the tooltip's own hover and focus policy. See
|
|
57
|
-
[platform-alignment](platform-alignment.md).
|
|
58
|
-
|
|
59
|
-
## JavaScript philosophy
|
|
60
|
-
|
|
61
|
-
> The Degraded tier exists primarily to preserve useful HTML and CSS on older
|
|
62
|
-
> browsers. It does not constrain the JavaScript runtime.
|
|
63
|
-
|
|
64
|
-
> Minimal is the JavaScript baseline.
|
|
65
|
-
|
|
66
|
-
Modern JavaScript supported by all Minimal browsers may be used directly.
|
|
67
|
-
Actual does not transpile, polyfill, or wrap platform APIs solely to extend
|
|
68
|
-
JavaScript support below Minimal.
|
|
69
|
-
|
|
70
|
-
### Abortable listeners
|
|
71
|
-
|
|
72
|
-
Abortable event listeners predate the Minimal floor by a wide margin: Firefox
|
|
73
|
-
86, Chrome 88, and WebKit (early 2021). ([Bugzilla][1], [Chrome][2],
|
|
74
|
-
[WebKit][3])
|
|
75
|
-
|
|
76
|
-
> `addEventListener({ signal })` is a baseline runtime primitive.
|
|
77
|
-
|
|
78
|
-
Do not introduce compatibility wrappers (`listen`, `on`,
|
|
79
|
-
`addAbortableListener`, `supportsSignal`) solely to reproduce a capability
|
|
80
|
-
that is already native throughout Minimal.
|
|
81
|
-
|
|
82
|
-
### Native `<dialog>`
|
|
83
|
-
|
|
84
|
-
Native `<dialog>` predates the floor on every engine: Safari 15.4, Firefox 98,
|
|
85
|
-
and Chromium earlier still. ([WebKit][4])
|
|
86
|
-
|
|
87
|
-
> Native dialog is assumed by the runtime; no dialog polyfill is shipped.
|
|
88
|
-
|
|
89
|
-
### The manual Popover transport
|
|
90
|
-
|
|
91
|
-
The floor is set by this capability. `surface.js` and `tooltip.js` both promote
|
|
92
|
-
their element with `popover="manual"` instead of moving it in the DOM, which is
|
|
93
|
-
what keeps a surface — and an explicit tooltip — inside every scope that reaches
|
|
94
|
-
it by inheritance. See [surface-reparenting](surface-reparenting.md).
|
|
95
|
-
|
|
96
|
-
> The manual Popover transport is assumed by the runtime; there is no
|
|
97
|
-
> reparenting fallback.
|
|
98
|
-
|
|
99
|
-
A capability branch was rejected rather than overlooked: the fallback path is
|
|
100
|
-
the defect, so keeping it would leave the bug in place for exactly the browsers
|
|
101
|
-
the branch would have served.
|
|
102
|
-
|
|
103
|
-
### Future-direction invariants
|
|
104
|
-
|
|
105
|
-
1. **Minimal drives JavaScript compatibility; Degraded does not.**
|
|
106
|
-
2. **Prefer native platform APIs over compatibility abstractions when they are
|
|
107
|
-
available throughout Minimal.**
|
|
108
|
-
3. **Browser versions are the compatibility contract, not ECMAScript edition
|
|
109
|
-
labels.**
|
|
110
|
-
4. **Raise Minimal only when doing so buys a concrete simplification, removal
|
|
111
|
-
of a fallback, or materially better implementation.**
|
|
112
|
-
|
|
113
|
-
> Do not preserve an older JavaScript idiom solely because it happens to run
|
|
114
|
-
> in the Degraded tier. If the clearer native alternative is supported
|
|
115
|
-
> throughout Minimal, prefer it.
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## Philosophy
|
|
120
|
-
|
|
121
|
-
Works everywhere, works best on modern browsers. Wide browser support (even older browsers, not IE 11).
|
|
122
|
-
|
|
123
|
-
- No consumer build step is required (just CSS).
|
|
124
|
-
- No post-processing — use only necessary browser-specific prefixes and engine hooks.
|
|
125
|
-
- CSS nesting is not used — code must be findable in the inspector. Rules are organized as if nesting were used, grouped together without nesting syntax. Exception: see [CSS nesting inside @supports](#css-nesting-inside-supports).
|
|
126
|
-
|
|
127
|
-
## Platform feature baseline
|
|
128
|
-
|
|
129
|
-
The tiers above are Actual's own contract. The table below tracks the Web
|
|
130
|
-
Platform Baseline of the individual CSS features the framework uses; it is a
|
|
131
|
-
different notion from an Actual tier.
|
|
132
|
-
|
|
133
|
-
| Feature area | Baseline | Progressive enhancement |
|
|
134
|
-
| ------------------------------------- | ------------- | ------------------------------------ |
|
|
135
|
-
| Layout (flex, grid, position) | Baseline 2023 | — |
|
|
136
|
-
| CSS custom properties | Baseline 2023 | — |
|
|
137
|
-
| `:has()` | Baseline 2023 | — |
|
|
138
|
-
| `<dialog>` element | Baseline 2023 | — |
|
|
139
|
-
| `color-mix()` | Baseline 2023 | Fallback flat color |
|
|
140
|
-
| `light-dark()` | 2024+ | Manual theme override |
|
|
141
|
-
| `:user-invalid` | 2024+ | `[aria-invalid]` attribute |
|
|
142
|
-
| `transition-behavior: allow-discrete` | 2024+ | Native dialog open/close |
|
|
143
|
-
| `appearance: base-select` | 2024+ | Native `<select>` |
|
|
144
|
-
| `@starting-style` | 2024+ | Instant appearance |
|
|
145
|
-
| View Transition API | 2024+ | Dialog open/close transition |
|
|
146
|
-
| Popover transport (`manual`) | Baseline 2025 | none — runtime requirement |
|
|
147
|
-
| CSS Anchor Positioning | Future | JS positioning (`@lekoala/floating`) |
|
|
148
|
-
|
|
149
|
-
Core layout and visual tokens work on all Baseline 2023 browsers. Features marked
|
|
150
|
-
2024+ are gated with `@supports` or degrade gracefully through fallback values.
|
|
151
|
-
|
|
152
|
-
## Dark mode
|
|
153
|
-
|
|
154
|
-
Dark mode is for modern browsers only (light mode is the fallback otherwise).
|
|
155
|
-
Use `color-scheme: light dark` plus `light-dark()` for theme tokens so the
|
|
156
|
-
default theme follows the OS without `data-theme`. Explicit themes pin
|
|
157
|
-
`color-scheme` to light or dark.
|
|
158
|
-
|
|
159
|
-
## Progressive enhancement
|
|
160
|
-
|
|
161
|
-
Modern features are gated with `@supports`; unsupported browsers keep the core layout and controls.
|
|
162
|
-
|
|
163
|
-
- `color-mix(in oklch, ...)` — enhanced variant surfaces and hover states
|
|
164
|
-
- `appearance: base-select` — enhanced select picker on fine-pointer devices
|
|
165
|
-
- `backdrop-filter` — enhanced sticky form actions
|
|
166
|
-
- `transition-behavior: allow-discrete` — smooth dialog open/close
|
|
167
|
-
- `:has()` — button groups, alert icons, disabled choice labels
|
|
168
|
-
|
|
169
|
-
### @supports usage
|
|
170
|
-
|
|
171
|
-
Use positive `@supports` by default. Use `@supports not` only for a genuine fallback branch that cannot safely coexist with the enhanced rules. Do not gate a single progressive declaration whose unsupported value is simply ignored by the browser, such as `text-wrap: balance`.
|
|
172
|
-
|
|
173
|
-
When a baseline declaration is already a valid fallback, prefer the normal cascade to an `@supports` wrapper. For example, older browsers keep the opaque surface here, while newer ones replace it with the translucent value:
|
|
174
|
-
|
|
175
|
-
```css
|
|
176
|
-
background: var(--surface);
|
|
177
|
-
background: color-mix(in oklch, var(--surface) 88%, transparent);
|
|
178
|
-
backdrop-filter: blur(1rem);
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
`@supports` is the simplest machine-readable boundary for a structural
|
|
182
|
-
enhancement, not a preferred shape in itself. Where an unsupported selector
|
|
183
|
-
already drops the enhancement cleanly and the baseline stays functional, a
|
|
184
|
-
documented why-comment (the one the guard audit recognises) or a `PROGRESSIVE`
|
|
185
|
-
ledger entry is just as valid. A wrapper that is behaviorally redundant is a
|
|
186
|
-
simplification candidate: improve `check:compat` — for example, let one
|
|
187
|
-
justification cover a contiguous group of rules — rather than let the wrapper
|
|
188
|
-
become a framework convention.
|
|
189
|
-
|
|
190
|
-
### CSS nesting inside @supports
|
|
191
|
-
|
|
192
|
-
The no-nesting rule protects browsers that predate CSS nesting (Chrome 112, Firefox 117, Safari 16.5). A block already gated behind a later feature can't be reached by any browser that lacks nesting, so the inspector-friendliness argument no longer applies — nest freely inside it. `appearance: base-select` (Chrome 133+) is the current example: everything inside that `@supports` block in `custom-select.css` uses `&`-nesting instead of repeating the `.select:not(...)` selector.
|
|
193
|
-
|
|
194
|
-
Check the gating feature's baseline against nesting's before relying on this: if a future gate ships on a browser older than nesting's baseline, flatten that block back out.
|
|
195
|
-
|
|
196
|
-
### Vendor prefixes and engine hooks
|
|
197
|
-
|
|
198
|
-
Keep a browser-specific prefix only when it reaches a still-relevant engine behavior that the standard property does not cover, or when it targets a browser-only native part. Examples include `-webkit-mask-*` where needed and pseudo-elements such as `::-webkit-scrollbar` or `::-webkit-progress-value`.
|
|
199
|
-
|
|
200
|
-
Do not retain a prefixed duplicate merely to preserve an optional visual enhancement on older browsers. If the unprefixed declaration or an earlier fallback keeps the component functional and legible, prefer the smaller rule set.
|
|
201
|
-
|
|
202
|
-
### color-mix fallbacks
|
|
203
|
-
|
|
204
|
-
Every `color-mix()` declaration needs a flat fallback outside `@supports` (older browsers drop the whole property, not just the function).
|
|
205
|
-
|
|
206
|
-
### Hover rules
|
|
207
|
-
|
|
208
|
-
Use `:hover` directly for standard interactive feedback (links, buttons, table rows,
|
|
209
|
-
form controls, menu items, tabs, badges). The browser already knows when `:hover` can
|
|
210
|
-
apply; guarding it behind `@media (hover: hover)` needlessly suppresses hover on hybrid
|
|
211
|
-
devices whose primary pointer is touch but that also have a mouse or trackpad.
|
|
212
|
-
|
|
213
|
-
Reserve `@media (hover: hover)` only when hover:
|
|
214
|
-
|
|
215
|
-
- reveals controls or content,
|
|
216
|
-
- triggers heavy animation,
|
|
217
|
-
- changes layout,
|
|
218
|
-
- or is part of an interaction specifically designed for a mouse.
|
|
219
|
-
|
|
220
|
-
`:active` feedback stays unguarded.
|
|
221
|
-
|
|
222
|
-
### forced-colors
|
|
223
|
-
|
|
224
|
-
The default theme maps public color, focus, and shadow tokens to system colors
|
|
225
|
-
inside `forced-colors: active`. Components should rely on those tokens first.
|
|
226
|
-
Use local forced-color rules only for shapes or states the token layer cannot
|
|
227
|
-
infer, such as custom checkbox/switch geometry, native progress/meter parts,
|
|
228
|
-
disabled affordances, tooltip arrows, or selected states otherwise expressed
|
|
229
|
-
only through background color.
|
|
230
|
-
|
|
231
|
-
### :has()
|
|
232
|
-
|
|
233
|
-
- Grouping works with `role="group"` and `:has()`: it is a progressive enhancement; UI should still be functional without it.
|
|
234
|
-
- Keep `:has()` out of selector lists that also contain legacy-safe selectors. Put the `:has()` branch in `@supports selector(...)` if necessary.
|
|
235
|
-
|
|
236
|
-
[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1679204 "1679204 - Consider to add signal to addEventListener"
|
|
237
|
-
[2]: https://developer.chrome.com/blog/new-in-chrome-88 "New in Chrome 88 | Blog"
|
|
238
|
-
[3]: https://trac.webkit.org/timeline "WebKit timeline, January 2021"
|
|
239
|
-
[4]: https://webkit.org/blog/12209/introducing-the-dialog-element/ "Introducing the Dialog Element"
|