actual-css 0.19.3 → 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 +13 -0
- package/README.md +2 -2
- package/dist/actual.full.css +8 -4
- package/dist/actual.full.js +2 -2
- package/dist/actual.full.min.css +1 -1
- package/dist/types/surface-focus.d.ts +2 -0
- package/docs/pages/components/dialog.md +3 -0
- package/docs/pages/components/list.md +1 -1
- package/docs/pages/components/timeline.md +4 -2
- package/docs/pages/enhancements/flyout.md +26 -8
- package/docs/pages/forms/joined-controls.md +1 -1
- package/docs/pages/forms/switch.md +4 -2
- package/docs/pages/foundations/theming.md +3 -0
- 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/components/menu.css +2 -2
- package/src/css/forms/switch.css +6 -2
- package/src/js/dialog.js +30 -11
- package/src/js/surface-focus.js +14 -0
- package/src/js/surface.js +8 -3
- package/src/tooling/theme-contrast.js +6 -2
- package/docs/design-notes/accessibility-decisions.md +0 -65
- 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
|
@@ -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"
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Cascade layer strategy
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
Actual CSS is designed for new projects where its bare class names don't
|
|
6
|
-
conflict. For existing projects that need coexistence, `actual.layer.css`
|
|
7
|
-
wraps the core entrypoint in a single `@layer actual` so its specificity
|
|
8
|
-
is lower than unlayered author styles. `actual.layer.css` is layered core —
|
|
9
|
-
it does not include the functional families. Use it as the base and import
|
|
10
|
-
the families you need from `actual-css/css/*` outside the layer.
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
`actual.layer.css` wraps only the core entrypoint in the layer. The family
|
|
15
|
-
manifests (components, forms, layout, …) are imported separately, outside the
|
|
16
|
-
layer by default:
|
|
17
|
-
|
|
18
|
-
```css
|
|
19
|
-
/* Before — classes may override existing project styles */
|
|
20
|
-
@import "actual-css";
|
|
21
|
-
|
|
22
|
-
/* After — core rules are scoped to the `actual` layer */
|
|
23
|
-
@import "actual-css/css/layer";
|
|
24
|
-
@import "actual-css/css/layout";
|
|
25
|
-
@import "actual-css/css/forms";
|
|
26
|
-
@import "actual-css/css/components";
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Author styles outside any layer will win over layer styles with equal
|
|
30
|
-
specificity.
|
|
31
|
-
|
|
32
|
-
For an existing project, the collisions that matter are component classes
|
|
33
|
-
(`.card`, `.btn`, `.grid`, `.input`, `.navbar`), not the core tokens. If the
|
|
34
|
-
whole framework must sit below the project's own styles, layer the full bundle
|
|
35
|
-
in the project entrypoint:
|
|
36
|
-
|
|
37
|
-
```css
|
|
38
|
-
@layer actual;
|
|
39
|
-
@import "actual-css/full" layer(actual);
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
There is no separate `full`-layer bundle; the two declarations above are the
|
|
43
|
-
official recipe.
|
|
44
|
-
|
|
45
|
-
## Layer structure
|
|
46
|
-
|
|
47
|
-
A single `actual` layer. The internal import order is a contract: later imports
|
|
48
|
-
can override earlier ones within the layer. Sublayers (`actual.reset`,
|
|
49
|
-
`actual.components`, etc.) are reserved for future use if the single layer
|
|
50
|
-
causes real-world override issues.
|
|
51
|
-
|
|
52
|
-
## Import order contract
|
|
53
|
-
|
|
54
|
-
Within `actual.css` (the minimal core) the order is:
|
|
55
|
-
|
|
56
|
-
1. Reset
|
|
57
|
-
2. Tokens
|
|
58
|
-
3. Theme
|
|
59
|
-
4. Base (document defaults)
|
|
60
|
-
5. Intents
|
|
61
|
-
6. Variants
|
|
62
|
-
7. Focus
|
|
63
|
-
8. Print
|
|
64
|
-
|
|
65
|
-
This order is stable. If a future version introduces sublayers, the relative
|
|
66
|
-
order will be preserved.
|
|
67
|
-
|
|
68
|
-
## Limitations
|
|
69
|
-
|
|
70
|
-
- `actual.layer.css` cannot protect against conflicts with other layered
|
|
71
|
-
frameworks that also use `@layer actual`. If both projects use the same
|
|
72
|
-
layer name, the later `@layer` declaration wins.
|
|
73
|
-
- The layer applies only when importing from `actual.layer.css`. Direct
|
|
74
|
-
imports of individual files bypass the layer.
|