actual-css 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +8 -4
- package/components.json +19 -4
- package/dist/actual.full.css +393 -69
- package/dist/actual.full.js +2 -1
- package/dist/actual.full.min.css +1 -1
- package/docs/design-notes/app-ui.md +37 -3
- package/docs/design-notes/enhancement-contract.md +3 -1
- package/docs/navigation.json +14 -1
- package/docs/pages/components/alert.md +45 -17
- package/docs/pages/components/button.md +3 -0
- package/docs/pages/components/dialog.md +36 -0
- package/docs/pages/components/drawer.md +52 -8
- package/docs/pages/components/navbar.md +26 -2
- package/docs/pages/components/rating.md +111 -12
- package/docs/pages/components/segmented.md +36 -1
- package/docs/pages/components/spinner.md +2 -0
- package/docs/pages/components/table.md +77 -0
- package/docs/pages/components/timeline.md +3 -1
- package/docs/pages/enhancements/flyout.md +83 -14
- package/docs/pages/enhancements/tabs.md +5 -0
- package/docs/pages/examples/overview.md +5 -1
- package/docs/pages/forms/ajax.md +101 -0
- package/docs/pages/forms/color-swatches.md +31 -2
- package/docs/pages/forms/joined-controls.md +8 -3
- package/docs/pages/forms/overview.md +1 -1
- package/docs/pages/forms/unsaved-changes.md +198 -0
- package/docs/pages/foundations/philosophy.md +2 -1
- package/docs/pages/foundations/theming.md +2 -1
- package/docs/pages/foundations/tokens.md +1 -1
- package/docs/pages/guides/introduction.md +1 -1
- package/docs/pages/guides/progressive-enhancement.md +30 -49
- package/docs/pages/guides/upgrading.md +15 -2
- package/docs/pages/layout/choosing.md +5 -0
- package/docs/pages/layout/column-layout.md +22 -8
- package/docs/pages/layout/sidebar-shell.md +68 -0
- package/docs/pages/patterns/empty-state.md +74 -0
- package/docs/pages/patterns/hierarchical-nav.md +40 -19
- package/docs/pages/patterns/navigation-list.md +3 -60
- package/docs/pages/patterns/stat.md +61 -0
- package/docs/pages/utilities/accessibility.md +32 -10
- package/package.json +4 -1
- package/reserved-classes.json +2 -0
- package/src/css/components/busy.css +25 -0
- package/src/css/components/button.css +3 -0
- package/src/css/components/drawer.css +37 -3
- package/src/css/components/flyout.css +37 -0
- package/src/css/components/modal.css +3 -0
- package/src/css/components/navbar.css +99 -38
- package/src/css/components/rating.css +50 -5
- package/src/css/components/segmented.css +25 -2
- package/src/css/forms/color-swatch.css +38 -19
- package/src/css/forms/custom-select.css +5 -0
- package/src/css/layout/index.css +2 -0
- package/src/css/layout/sidebar-shell.css +67 -0
- package/src/js/ajax.js +148 -0
- package/src/js/dialog.js +59 -2
- package/src/js/dirty.js +140 -0
- package/src/js/dismiss.js +25 -0
- package/src/js/events.js +17 -0
- package/src/js/focus.js +12 -0
- package/src/js/form-submission.js +34 -0
- package/src/js/full.js +2 -0
- package/src/js/tab.js +16 -2
- package/src/js/validation.js +12 -4
- package/src/tooling/theme-contrast.js +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "actual-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
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",
|
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"./js/tab": "./src/js/tab.js",
|
|
73
73
|
"./js/tooltip": "./src/js/tooltip.js",
|
|
74
74
|
"./js/validation": "./src/js/validation.js",
|
|
75
|
+
"./js/dirty": "./src/js/dirty.js",
|
|
76
|
+
"./js/ajax": "./src/js/ajax.js",
|
|
75
77
|
"./js/status": "./src/js/status.js",
|
|
76
78
|
"./js/surface": "./src/js/surface.js",
|
|
77
79
|
"./reserved-classes.json": "./reserved-classes.json",
|
|
@@ -150,6 +152,7 @@
|
|
|
150
152
|
"shot:states": "bun scripts/shot-states.js",
|
|
151
153
|
"probe": "bun scripts/probe.js",
|
|
152
154
|
"serve": "bun scripts/serve.js",
|
|
155
|
+
"play:ajax": "bun --watch scripts/playground/ajax.js",
|
|
153
156
|
"check:sync": "bun scripts/check-sync.js",
|
|
154
157
|
"release": "bun scripts/release.js",
|
|
155
158
|
"release:notes": "bun scripts/release-notes.js",
|
package/reserved-classes.json
CHANGED
|
@@ -207,6 +207,7 @@
|
|
|
207
207
|
"shadow-popout-context",
|
|
208
208
|
"shimmer",
|
|
209
209
|
"sidebar-layout",
|
|
210
|
+
"sidebar-shell",
|
|
210
211
|
"skeleton",
|
|
211
212
|
"sm",
|
|
212
213
|
"soft",
|
|
@@ -259,6 +260,7 @@
|
|
|
259
260
|
"touch-target",
|
|
260
261
|
"truncate",
|
|
261
262
|
"user-select-none",
|
|
263
|
+
"vertical",
|
|
262
264
|
"visibility-hidden",
|
|
263
265
|
"warning",
|
|
264
266
|
"was-validated"
|
|
@@ -7,8 +7,13 @@
|
|
|
7
7
|
* shows that spinner as a centered overlay over a faded surface. Buttons keep
|
|
8
8
|
* their spinners inline (e.g. .btn[aria-busy] > .spinner stays inline-flex).
|
|
9
9
|
*
|
|
10
|
+
* The overlay fades in after --busy-delay, so a fast request leaves the
|
|
11
|
+
* content untouched instead of flashing it. Reduced motion drops the delay
|
|
12
|
+
* with every other animation (reset.css): the overlay then shows at once.
|
|
13
|
+
*
|
|
10
14
|
* Public hooks:
|
|
11
15
|
* --busy-overlay-bg
|
|
16
|
+
* --busy-delay
|
|
12
17
|
*
|
|
13
18
|
* Internal:
|
|
14
19
|
* --spinner-size (overlay copy of the shared spinner hook)
|
|
@@ -43,6 +48,26 @@
|
|
|
43
48
|
margin: auto;
|
|
44
49
|
display: block;
|
|
45
50
|
}
|
|
51
|
+
|
|
52
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
53
|
+
[aria-busy="true"]:not(.btn):has(> .spinner:last-child)::before {
|
|
54
|
+
animation: actual-busy-reveal var(--duration-slow) var(--busy-delay, 300ms) ease both;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Restates the spin: one animation list replaces spinner.css's. */
|
|
58
|
+
[aria-busy="true"]:not(.btn) > .spinner:last-child {
|
|
59
|
+
animation:
|
|
60
|
+
actual-busy-reveal var(--duration-slow) var(--busy-delay, 300ms) ease both,
|
|
61
|
+
actual-spin var(--duration-spin) linear infinite;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* `both` holds the from-frame through the delay. */
|
|
67
|
+
@keyframes actual-busy-reveal {
|
|
68
|
+
from {
|
|
69
|
+
opacity: 0;
|
|
70
|
+
}
|
|
46
71
|
}
|
|
47
72
|
|
|
48
73
|
@supports (selector([aria-busy="true"]:has(> .spinner:last-child))) and
|
|
@@ -106,6 +106,9 @@
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
.btn.icon-only {
|
|
109
|
+
/* why: beside a full-width control (.join, a flex row) it would share the
|
|
110
|
+
shrink and stop being square. */
|
|
111
|
+
flex: none;
|
|
109
112
|
inline-size: var(--btn-min-size);
|
|
110
113
|
block-size: var(--btn-min-size);
|
|
111
114
|
padding: 0;
|
|
@@ -13,14 +13,17 @@
|
|
|
13
13
|
* navigation content inside uses .nav-link and .accordion, which carry their
|
|
14
14
|
* own link/summary styling.
|
|
15
15
|
*
|
|
16
|
+
* Sides: start (default), end, and bottom (a bottom sheet) via data-side.
|
|
17
|
+
*
|
|
16
18
|
* Public hooks:
|
|
17
|
-
* --drawer-size
|
|
19
|
+
* --drawer-size (width on start/end, maximum height on bottom)
|
|
18
20
|
* --drawer-pad
|
|
19
21
|
*
|
|
20
22
|
* The corner close control is .close (components/close.css).
|
|
21
23
|
*
|
|
22
24
|
* Internal:
|
|
23
25
|
* --drawer-closed-translate (side/RTL positioning state)
|
|
26
|
+
* --drawer-closed-transform (closed position; bottom changes its axis)
|
|
24
27
|
* --drawer-focus-bleed
|
|
25
28
|
* --drawer-close-reserve (header room for a corner close; zero without a close)
|
|
26
29
|
* --drawer-motion-duration (shared by panel and ::backdrop so exit duration
|
|
@@ -33,6 +36,9 @@
|
|
|
33
36
|
/* The inset a direct .bleed child cancels (components/bleed.css). */
|
|
34
37
|
--surface-pad: var(--drawer-pad);
|
|
35
38
|
--drawer-closed-translate: -100%;
|
|
39
|
+
/* The closed position as one transform, so a side can change axis without
|
|
40
|
+
a rule that would tie with [open] on specificity. */
|
|
41
|
+
--drawer-closed-transform: translateX(var(--drawer-closed-translate));
|
|
36
42
|
/* Header room for a corner close. Unconditional baseline: without :has()
|
|
37
43
|
(Degraded tier) a header keeps too much room rather than a title running
|
|
38
44
|
under the close. Zeroed when the drawer has no close. */
|
|
@@ -71,7 +77,7 @@
|
|
|
71
77
|
color: var(--text);
|
|
72
78
|
box-shadow: var(--shadow);
|
|
73
79
|
opacity: 0;
|
|
74
|
-
transform:
|
|
80
|
+
transform: var(--drawer-closed-transform);
|
|
75
81
|
/* Unsupported discrete behavior drops alone, preserving opacity/transform. */
|
|
76
82
|
transition-property: opacity, transform, overlay, display;
|
|
77
83
|
transition-duration: var(--drawer-motion-duration);
|
|
@@ -125,10 +131,32 @@
|
|
|
125
131
|
opacity: 1;
|
|
126
132
|
}
|
|
127
133
|
|
|
134
|
+
/* Bottom sheet: the same drawer on the block-end edge, sized by its content
|
|
135
|
+
up to --drawer-size, which reads as a height here. :where() keeps the size
|
|
136
|
+
at the base rule's weight, so an application class still overrides it. */
|
|
137
|
+
:where(dialog).drawer:where([data-side="bottom"]) {
|
|
138
|
+
--drawer-size: 32rem;
|
|
139
|
+
--drawer-closed-transform: translateY(100%);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
:where(dialog).drawer[data-side="bottom"] {
|
|
143
|
+
inset-block: auto 0;
|
|
144
|
+
inset-inline: 0;
|
|
145
|
+
inline-size: 100%;
|
|
146
|
+
block-size: auto;
|
|
147
|
+
max-block-size: min(calc(var(--viewport-block) * 0.85), var(--drawer-size));
|
|
148
|
+
/* The home indicator sits over the panel's last line otherwise. */
|
|
149
|
+
padding-block-end: calc(var(--drawer-pad) + env(safe-area-inset-bottom, 0px));
|
|
150
|
+
border-inline-end: 0;
|
|
151
|
+
border-block-start: var(--border-width) solid var(--border);
|
|
152
|
+
border-start-start-radius: var(--radius-lg);
|
|
153
|
+
border-start-end-radius: var(--radius-lg);
|
|
154
|
+
}
|
|
155
|
+
|
|
128
156
|
@starting-style {
|
|
129
157
|
:where(dialog).drawer[open] {
|
|
130
158
|
opacity: 0;
|
|
131
|
-
transform:
|
|
159
|
+
transform: var(--drawer-closed-transform);
|
|
132
160
|
}
|
|
133
161
|
|
|
134
162
|
:where(dialog).drawer[open]::backdrop {
|
|
@@ -156,6 +184,12 @@
|
|
|
156
184
|
under the header or footer. */
|
|
157
185
|
margin: calc(var(--drawer-focus-bleed) * -1);
|
|
158
186
|
padding: var(--drawer-focus-bleed);
|
|
187
|
+
/* The scrollport reaches the panel's inline-end edge and takes the panel
|
|
188
|
+
padding back inside: the scrollbar sits on the edge and the content keeps
|
|
189
|
+
--drawer-pad on both sides. Inside the content box, the scrollbar sat a
|
|
190
|
+
focus bleed from the text with the panel padding wasted beyond it. */
|
|
191
|
+
margin-inline-end: calc(var(--drawer-pad) * -1);
|
|
192
|
+
padding-inline-end: var(--drawer-pad);
|
|
159
193
|
overflow: auto;
|
|
160
194
|
overscroll-behavior: contain;
|
|
161
195
|
}
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* Runtime marker (managed by surface.js): .is-open marks an open flyout.
|
|
12
12
|
* --surface-anchor-width is set by surface.js while an open flyout is positioned.
|
|
13
13
|
*
|
|
14
|
+
* Modifier: .scrollable keeps a header and footer in view while the one body
|
|
15
|
+
* region between them scrolls.
|
|
16
|
+
*
|
|
14
17
|
* Public hooks:
|
|
15
18
|
* --flyout-inline-size
|
|
16
19
|
* --flyout-max-inline-size
|
|
@@ -18,6 +21,7 @@
|
|
|
18
21
|
*
|
|
19
22
|
* Internal:
|
|
20
23
|
* --menu-item-size (derived from --control-size for menu rows)
|
|
24
|
+
* --flyout-focus-bleed (focus reserve of the .scrollable body)
|
|
21
25
|
* --available-height (measured by the positioner)
|
|
22
26
|
* --surface-anchor-width (measured by surface.js)
|
|
23
27
|
*/
|
|
@@ -168,6 +172,39 @@
|
|
|
168
172
|
margin: 0;
|
|
169
173
|
}
|
|
170
174
|
|
|
175
|
+
/* .scrollable: the .modal.scrollable contract on a panel with a header, one
|
|
176
|
+
body and a footer — the header and footer keep their size and the body
|
|
177
|
+
absorbs the overflow, so an Apply row stays in view however long the list
|
|
178
|
+
or however little room the positioner leaves. Opt-in, because a menu or a
|
|
179
|
+
multi-section nav panel has no single body to scroll. :where() keeps the
|
|
180
|
+
display at .flyout's weight, so [hidden] and the closed popover still win
|
|
181
|
+
whatever the source order. */
|
|
182
|
+
.flyout:where(.scrollable) {
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
overflow: hidden;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.flyout.scrollable > :is(header, footer) {
|
|
189
|
+
flex: none;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.flyout.scrollable > :not(:is(header, footer)) {
|
|
193
|
+
/* Declared here, not as a :root alias: an inherited alias arrives already
|
|
194
|
+
computed, so a --focus-ring-width override on the panel would not reach
|
|
195
|
+
it. */
|
|
196
|
+
--flyout-focus-bleed: calc(var(--focus-outline-offset) + var(--focus-ring-width));
|
|
197
|
+
|
|
198
|
+
flex: 1 1 auto;
|
|
199
|
+
min-block-size: 0;
|
|
200
|
+
/* Keep focus paint inside the clip without moving the content: the reserve
|
|
201
|
+
reaches into the panel gap and padding, both --space-10 by default. */
|
|
202
|
+
margin: calc(var(--flyout-focus-bleed) * -1);
|
|
203
|
+
padding: var(--flyout-focus-bleed);
|
|
204
|
+
overflow: auto;
|
|
205
|
+
overscroll-behavior: contain;
|
|
206
|
+
}
|
|
207
|
+
|
|
171
208
|
/* Vertical dividers — .menu-separator (menu.css) is the canonical way to
|
|
172
209
|
separate menu items. Flyout panels that are not menus use auto grid gap
|
|
173
210
|
declared on .flyout itself. */
|
|
@@ -55,6 +55,9 @@
|
|
|
55
55
|
/* Keep the surface anchored to the viewport in the top layer. This also
|
|
56
56
|
provides the containing block for the absolutely positioned close button. */
|
|
57
57
|
position: fixed;
|
|
58
|
+
/* Restates the UA centering: a modal authored inside .stack or .cluster
|
|
59
|
+
would otherwise take their child margin reset and pin to the top. */
|
|
60
|
+
margin: auto;
|
|
58
61
|
|
|
59
62
|
/* The root is :where(dialog).modal (0-1-0), so a single author class can
|
|
60
63
|
outrank these defaults — no fallback-only indirection needed here. */
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* list shared with .drawer, fed by the shared --gap token.
|
|
9
9
|
*
|
|
10
10
|
* Public hooks:
|
|
11
|
-
* --
|
|
11
|
+
* --nav-current-bg (fallback-only: current-link fill)
|
|
12
|
+
* --nav-current-fg (fallback-only: current-link ink)
|
|
13
|
+
* --nav-list-indent (fallback-only: nested .nav-list inset)
|
|
12
14
|
*
|
|
13
15
|
* Internal:
|
|
14
16
|
* --gap (local value for the shared gap token)
|
|
@@ -59,6 +61,8 @@
|
|
|
59
61
|
.nav-link {
|
|
60
62
|
display: inline-flex;
|
|
61
63
|
align-items: center;
|
|
64
|
+
/* Icon + label rows; a text-only link has one flex item and shows no gap. */
|
|
65
|
+
gap: var(--space-20);
|
|
62
66
|
min-block-size: var(--control-size-sm);
|
|
63
67
|
padding-block: 0;
|
|
64
68
|
padding-inline: var(--space-20);
|
|
@@ -72,43 +76,45 @@
|
|
|
72
76
|
cursor: pointer;
|
|
73
77
|
}
|
|
74
78
|
|
|
75
|
-
/* nav-link serves
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
/* nav-link serves three contracts: plain page navigation (aria-current="page"),
|
|
80
|
+
scrollspy, which toggles aria-current="location" on the active link, and
|
|
81
|
+
section navigation (aria-current="true"): a link whose section holds the
|
|
82
|
+
current page without being it, as on .tab. Those three values are the
|
|
83
|
+
contract; any other, "false" included, is inert.
|
|
84
|
+
Selection never changes text metrics: the shared medium weight is kept.
|
|
85
|
+
|
|
86
|
+
The current link is neutral: full --text ink over a stronger tint of it,
|
|
87
|
+
against --text-muted at rest. That is a luminance step on both ink and
|
|
88
|
+
fill, so the state does not rest on hue. A brand-accent ink was measured
|
|
89
|
+
and dropped: on light presets the accent is already at 4.5:1 on the page,
|
|
90
|
+
so any fill strong enough to carry the state pushed it under. */
|
|
80
91
|
.nav-link:hover {
|
|
81
92
|
background: var(--surface-subtle);
|
|
82
93
|
color: var(--text);
|
|
83
94
|
}
|
|
84
95
|
|
|
85
96
|
/* Current last, equal specificity to :hover (0,2,0): a hovered current link
|
|
86
|
-
keeps
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
color: var(--state-selected-text, var(--state-selected));
|
|
97
|
+
keeps its current fill. */
|
|
98
|
+
.nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
|
|
99
|
+
background: var(--nav-current-bg, var(--surface-subtle));
|
|
100
|
+
color: var(--nav-current-fg, var(--text));
|
|
91
101
|
}
|
|
92
102
|
|
|
93
|
-
/*
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
legible on it. */
|
|
103
|
+
/* Fills are a tint of the link's own ink, the .btn.ghost hover recipe, so they
|
|
104
|
+
read on light and dark bars alike, including a bar with its own
|
|
105
|
+
--ui-bg/--ui-fg. Not --ui-hover-bg: that is the bar's own hover and can
|
|
106
|
+
equal its fill. Current is a step above hover (18% vs 10%), so the current
|
|
107
|
+
link stays apart while another is hovered. The baseline above keeps a
|
|
108
|
+
light chip where color-mix is missing. */
|
|
100
109
|
@supports (color: color-mix(in oklch, red, white)) {
|
|
101
|
-
.nav-link:is(:hover, [aria-current="page"], [aria-current="location"]) {
|
|
102
|
-
background: color-mix(in oklch, currentColor 10%, transparent);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
110
|
.nav-link:hover {
|
|
111
|
+
background: color-mix(in oklch, currentColor 10%, transparent);
|
|
106
112
|
color: var(--ui-fg, var(--text));
|
|
107
113
|
}
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
color: var(--
|
|
115
|
+
.nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
|
|
116
|
+
background: var(--nav-current-bg, color-mix(in oklch, currentColor 18%, transparent));
|
|
117
|
+
color: var(--nav-current-fg, var(--ui-fg, var(--text)));
|
|
112
118
|
}
|
|
113
119
|
}
|
|
114
120
|
|
|
@@ -132,23 +138,78 @@
|
|
|
132
138
|
margin: 0;
|
|
133
139
|
}
|
|
134
140
|
|
|
141
|
+
/* The positioning context lives on every row link, so becoming current never
|
|
142
|
+
moves an app-positioned decoration (or the forced-colors trait below) to a
|
|
143
|
+
new containing block. */
|
|
135
144
|
.nav-list .nav-link {
|
|
136
145
|
position: relative;
|
|
137
146
|
inline-size: 100%;
|
|
138
147
|
}
|
|
139
148
|
|
|
140
|
-
/*
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
/* Collapsible group: <details> in a row, <summary class="nav-link"> as its
|
|
150
|
+
label, a nested .nav-list as its links. The summary takes the link's row,
|
|
151
|
+
hover and focus; display: inline-flex already drops the list-item marker,
|
|
152
|
+
the WebKit pseudo is Safari's own. */
|
|
153
|
+
.nav-list summary.nav-link {
|
|
154
|
+
list-style: none;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.nav-list summary.nav-link::-webkit-details-marker {
|
|
158
|
+
display: none;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* The open state is the native [open], so the chevron needs no script. */
|
|
162
|
+
.nav-list summary.nav-link::after {
|
|
148
163
|
content: "";
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
flex: 0 0 auto;
|
|
165
|
+
margin-inline-start: auto;
|
|
166
|
+
inline-size: 1rem;
|
|
167
|
+
block-size: 1rem;
|
|
168
|
+
background-color: currentColor;
|
|
169
|
+
-webkit-mask: var(--icon-chevron) center / contain no-repeat;
|
|
170
|
+
mask: var(--icon-chevron) center / contain no-repeat;
|
|
171
|
+
transition: transform var(--duration);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.nav-list details[open] > summary.nav-link::after {
|
|
175
|
+
transform: rotate(180deg);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* A nested list is indented so its labels start under the parent's label,
|
|
179
|
+
past a 1em leading icon and the link gap. Fallback-only: a base
|
|
180
|
+
declaration on .nav-list would reset an override at every level. */
|
|
181
|
+
.nav-list .nav-list {
|
|
182
|
+
margin-block-start: var(--gap);
|
|
183
|
+
padding-inline-start: var(--nav-list-indent, calc(1em + var(--space-20)));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* Forced colors drops the fill and maps both inks to LinkText, so the current
|
|
187
|
+
link would be indistinguishable: it gets a shape instead. A vertical row
|
|
188
|
+
takes an inline-start trait, centered in the link's inline padding with
|
|
189
|
+
rounded ends; a horizontal link an underline. */
|
|
190
|
+
@media (forced-colors: active) {
|
|
191
|
+
.nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
|
|
192
|
+
text-decoration: underline;
|
|
193
|
+
text-underline-offset: 0.25em;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.nav-list .nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
|
|
197
|
+
text-decoration: none;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* The chevron is a mask over a fill that forced colors would remap to
|
|
201
|
+
Canvas, as in accordion.css. */
|
|
202
|
+
.nav-list summary.nav-link::after {
|
|
203
|
+
background-color: CanvasText;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.nav-list
|
|
207
|
+
.nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"])::before {
|
|
208
|
+
content: "";
|
|
209
|
+
position: absolute;
|
|
210
|
+
inset-block: var(--space-20);
|
|
211
|
+
inset-inline-start: calc((var(--space-20) - 2px) / 2);
|
|
212
|
+
border-inline-start: 2px solid currentColor;
|
|
213
|
+
border-radius: var(--radius-full);
|
|
214
|
+
}
|
|
154
215
|
}
|
|
@@ -17,10 +17,12 @@
|
|
|
17
17
|
* --rating-color
|
|
18
18
|
* --rating-empty
|
|
19
19
|
* --rating-star
|
|
20
|
+
* --rating-star-empty (the empty star's shape; the filled one by default)
|
|
20
21
|
* --rating-value (display: the shown value, fractions allowed)
|
|
21
22
|
* --rating-max (display: the number of stars)
|
|
22
23
|
*
|
|
23
24
|
* Internal:
|
|
25
|
+
* --rating-shape
|
|
24
26
|
* --rating-fill
|
|
25
27
|
* --rating-direction
|
|
26
28
|
*/
|
|
@@ -30,10 +32,12 @@
|
|
|
30
32
|
|
|
31
33
|
.rating {
|
|
32
34
|
--rating-size: 1.25rem;
|
|
33
|
-
--rating-gap:
|
|
35
|
+
--rating-gap: var(--space-10);
|
|
34
36
|
--rating-color: var(--intent, var(--warning));
|
|
35
37
|
--rating-empty: var(--border);
|
|
36
38
|
--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
|
+
/* An outline here turns the empty stars into a shape cue (see the docs). */
|
|
40
|
+
--rating-star-empty: var(--rating-star);
|
|
37
41
|
|
|
38
42
|
display: inline-flex;
|
|
39
43
|
gap: 0;
|
|
@@ -44,19 +48,29 @@
|
|
|
44
48
|
appearance: none;
|
|
45
49
|
flex: 0 0 auto;
|
|
46
50
|
inline-size: calc(var(--rating-size) + var(--rating-gap));
|
|
47
|
-
|
|
51
|
+
/* Taller than the star: the hit area grows, the drawing does not. */
|
|
52
|
+
block-size: calc(var(--rating-size) + var(--space-20));
|
|
48
53
|
margin: 0;
|
|
49
54
|
border: 0;
|
|
50
55
|
background: var(--rating-empty);
|
|
51
56
|
/* Contiguous radio boxes own hit-testing; the centered mask preserves the
|
|
52
|
-
star's proportions while leaving a purely visual gap between values.
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
star's proportions while leaving a purely visual gap between values.
|
|
58
|
+
A rule that fills a star sets --rating-shape, never mask-image: a state
|
|
59
|
+
selector outranks the forced-colors mask: none below, and its mask-image
|
|
60
|
+
would clip the native radio there. */
|
|
61
|
+
-webkit-mask:
|
|
62
|
+
var(--rating-shape, var(--rating-star-empty)) center / var(--rating-size) var(--rating-size)
|
|
63
|
+
no-repeat;
|
|
64
|
+
mask:
|
|
65
|
+
var(--rating-shape, var(--rating-star-empty)) center / var(--rating-size) var(--rating-size)
|
|
66
|
+
no-repeat;
|
|
55
67
|
cursor: pointer;
|
|
56
68
|
transition: background-color var(--duration);
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
.rating > input[type="radio"]:checked {
|
|
72
|
+
--rating-shape: var(--rating-star);
|
|
73
|
+
|
|
60
74
|
background: var(--rating-color);
|
|
61
75
|
}
|
|
62
76
|
|
|
@@ -68,6 +82,8 @@
|
|
|
68
82
|
.rating > input[type="radio"]:focus-visible {
|
|
69
83
|
outline: var(--focus-ring-width) solid var(--focus);
|
|
70
84
|
outline-offset: var(--focus-outline-offset);
|
|
85
|
+
--rating-shape: var(--rating-star);
|
|
86
|
+
|
|
71
87
|
background: var(--rating-color);
|
|
72
88
|
}
|
|
73
89
|
|
|
@@ -75,18 +91,24 @@
|
|
|
75
91
|
star. The enhancement only adds cumulative checked and hover previews. */
|
|
76
92
|
@supports selector(:has(*)) {
|
|
77
93
|
.rating > input[type="radio"]:has(~ input[type="radio"]:checked) {
|
|
94
|
+
--rating-shape: var(--rating-star);
|
|
95
|
+
|
|
78
96
|
background: var(--rating-color);
|
|
79
97
|
}
|
|
80
98
|
|
|
81
99
|
@media (hover: hover) {
|
|
82
100
|
.rating > input[type="radio"]:not(:disabled):hover,
|
|
83
101
|
.rating > input[type="radio"]:has(~ input[type="radio"]:not(:disabled):hover) {
|
|
102
|
+
--rating-shape: var(--rating-star);
|
|
103
|
+
|
|
84
104
|
background: var(--rating-color);
|
|
85
105
|
}
|
|
86
106
|
|
|
87
107
|
/* A hovered value previews exactly that value: later stars are emptied,
|
|
88
108
|
including a previously checked star beyond the pointer. */
|
|
89
109
|
.rating > input[type="radio"]:not(:disabled):hover ~ input[type="radio"] {
|
|
110
|
+
--rating-shape: var(--rating-star-empty);
|
|
111
|
+
|
|
90
112
|
background: var(--rating-empty);
|
|
91
113
|
}
|
|
92
114
|
}
|
|
@@ -117,6 +139,29 @@
|
|
|
117
139
|
repeat-x;
|
|
118
140
|
}
|
|
119
141
|
|
|
142
|
+
/* The filled share in the filled shape, the rest in the empty one:
|
|
143
|
+
(filled star ∩ value band) ∪ empty star. With the default empty shape it
|
|
144
|
+
draws exactly the single layer above. Guarded on purpose: the declaration
|
|
145
|
+
holds var(), so an engine without composite keywords would not drop it at
|
|
146
|
+
parse time but invalidate it at computed time, leaving no mask at all — a
|
|
147
|
+
solid bar. Without it (Chromium before 120), a custom empty shape shows as
|
|
148
|
+
filled-shape empty stars. */
|
|
149
|
+
@supports (mask-composite: intersect) {
|
|
150
|
+
.rating[role="img"] {
|
|
151
|
+
mask:
|
|
152
|
+
var(--rating-star) left center / calc(var(--rating-size) + var(--rating-gap))
|
|
153
|
+
var(--rating-size) repeat-x intersect,
|
|
154
|
+
linear-gradient(
|
|
155
|
+
var(--rating-direction),
|
|
156
|
+
#000 var(--rating-fill),
|
|
157
|
+
transparent var(--rating-fill)
|
|
158
|
+
)
|
|
159
|
+
add,
|
|
160
|
+
var(--rating-star-empty) left center / calc(var(--rating-size) + var(--rating-gap))
|
|
161
|
+
var(--rating-size) repeat-x;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
120
165
|
/* The fill starts at the inline start; only the direction changes, so the
|
|
121
166
|
forced-colors gradient below follows it too. Safari before 16.4 has no
|
|
122
167
|
:dir(); the attribute path is its fallback, as in avatar.css. Each selector
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* fill and focus ring, and the native radio stays visible to carry both.
|
|
14
14
|
*
|
|
15
15
|
* One row of equal shares (grid-auto-columns: 1fr), at least --control-size
|
|
16
|
-
* tall so it lines up with .btn and .input.
|
|
16
|
+
* tall so it lines up with .btn and .input; .vertical stacks the segments in
|
|
17
|
+
* one column instead. Labels wrap instead of truncating;
|
|
17
18
|
* a word longer than its share breaks, so the control never overflows its
|
|
18
19
|
* container. A strip too long for one row is .tabs, which scrolls.
|
|
19
20
|
*
|
|
@@ -28,6 +29,9 @@
|
|
|
28
29
|
* --segmented-fg
|
|
29
30
|
* --segmented-selected-bg
|
|
30
31
|
* --segmented-selected-border
|
|
32
|
+
*
|
|
33
|
+
* Internal:
|
|
34
|
+
* --segment-min-size
|
|
31
35
|
*/
|
|
32
36
|
.segmented {
|
|
33
37
|
--segmented-bg: var(--surface-subtle);
|
|
@@ -65,8 +69,14 @@
|
|
|
65
69
|
own min-block-size: a <fieldset> lays its content in an anonymous box
|
|
66
70
|
sized to the content, so a minimum on the track left the segments short.
|
|
67
71
|
A minimum, not a height: a wrapped label grows the whole row. */
|
|
68
|
-
min-
|
|
72
|
+
--segment-min-size: calc(var(--control-size) - 2 * (var(--segmented-pad) + var(--border-width)));
|
|
73
|
+
|
|
74
|
+
min-block-size: var(--segment-min-size);
|
|
75
|
+
/* why: the block padding gives a wrapped label room, but must never push
|
|
76
|
+
one line past the minimum: .compact keeps the 16px font in a 32px control,
|
|
77
|
+
where a fixed 2px made the track 33px against .btn's 32px. */
|
|
69
78
|
padding: calc(var(--space-10) / 2) var(--space-30);
|
|
79
|
+
padding-block: clamp(0px, (var(--segment-min-size) - 1lh) / 2, var(--space-10) / 2);
|
|
70
80
|
border: 0;
|
|
71
81
|
border-radius: calc(var(--segmented-radius) - var(--segmented-pad));
|
|
72
82
|
background: transparent;
|
|
@@ -87,6 +97,19 @@
|
|
|
87
97
|
box-shadow var(--duration);
|
|
88
98
|
}
|
|
89
99
|
|
|
100
|
+
/* Vertical: one segment per row, labels at the inline start. .vertical for
|
|
101
|
+
radios and links, where aria-orientation is not a valid attribute; a
|
|
102
|
+
vertical tablist already carries aria-orientation (what the tabs runtime
|
|
103
|
+
reads for Up/Down), so the layout follows it and cannot disagree. */
|
|
104
|
+
.segmented:is(.vertical, :where([aria-orientation="vertical"])) {
|
|
105
|
+
grid-auto-flow: row;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.segmented:is(.vertical, :where([aria-orientation="vertical"])) > .segment {
|
|
109
|
+
justify-content: flex-start;
|
|
110
|
+
text-align: start;
|
|
111
|
+
}
|
|
112
|
+
|
|
90
113
|
.segment > input {
|
|
91
114
|
margin: 0;
|
|
92
115
|
}
|