actual-css 0.19.5 → 0.20.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 +59 -0
- package/README.md +4 -4
- package/components.json +6 -3
- package/dist/actual.full.css +249 -54
- package/dist/actual.full.js +2 -2
- package/dist/actual.full.min.css +1 -1
- package/dist/types/menu.d.ts +2 -5
- package/docs/pages/components/accordion.md +11 -6
- package/docs/pages/components/alert.md +64 -62
- package/docs/pages/components/avatar.md +12 -12
- package/docs/pages/components/badge.md +15 -15
- package/docs/pages/components/breadcrumb.md +10 -8
- package/docs/pages/components/button.md +56 -7
- package/docs/pages/components/card.md +21 -21
- package/docs/pages/components/dialog.md +97 -69
- package/docs/pages/components/drawer.md +33 -33
- package/docs/pages/components/indicator.md +12 -12
- package/docs/pages/components/navbar.md +41 -9
- package/docs/pages/components/pagination.md +7 -7
- package/docs/pages/components/progress.md +18 -13
- package/docs/pages/components/rating.md +19 -19
- package/docs/pages/components/reveal.md +2 -0
- package/docs/pages/components/segmented.md +35 -31
- package/docs/pages/components/skeleton.md +10 -8
- package/docs/pages/components/spinner.md +21 -15
- package/docs/pages/components/table.md +26 -28
- package/docs/pages/enhancements/flyout.md +94 -43
- package/docs/pages/enhancements/in-view.md +3 -1
- package/docs/pages/enhancements/scrollspy.md +51 -18
- package/docs/pages/enhancements/tabs.md +43 -37
- package/docs/pages/enhancements/tooltip.md +4 -2
- package/docs/pages/forms/ajax.md +66 -0
- package/docs/pages/forms/choice-cards.md +8 -8
- package/docs/pages/forms/color-swatches.md +12 -12
- package/docs/pages/forms/form-actions.md +23 -0
- package/docs/pages/forms/joined-controls.md +7 -7
- package/docs/pages/forms/labels.md +11 -11
- package/docs/pages/forms/overview.md +35 -29
- package/docs/pages/forms/states-and-sizes.md +9 -9
- package/docs/pages/forms/switch.md +35 -4
- package/docs/pages/forms/validation.md +16 -16
- package/docs/pages/foundations/theming.md +32 -2
- package/docs/pages/foundations/tokens.md +7 -5
- package/docs/pages/guides/coding-agents.md +18 -0
- package/docs/pages/guides/introduction.md +1 -1
- package/package.json +2 -1
- package/reserved-classes.json +1 -0
- package/skills/actual-css/SKILL.md +7 -0
- package/src/cli/actual-css.js +1 -1
- package/src/css/components/badge.css +10 -6
- package/src/css/components/button.css +20 -7
- package/src/css/components/join.css +14 -4
- package/src/css/components/navbar.css +83 -1
- package/src/css/components/pagination.css +3 -1
- package/src/css/components/segmented.css +27 -7
- package/src/css/core/theme.css +11 -9
- package/src/css/core/tokens.css +7 -1
- package/src/css/core/variants.css +2 -0
- package/src/css/effects/reveal.css +15 -6
- package/src/css/forms/control.css +11 -1
- package/src/css/forms/form.css +14 -4
- package/src/css/forms/switch.css +32 -7
- package/src/js/ajax.js +18 -1
- package/src/js/context-menu.js +1 -3
- package/src/js/flyout.js +14 -5
- package/src/js/in-view.js +41 -30
- package/src/js/menu.js +9 -21
- package/src/js/surface.js +38 -0
- package/src/tooling/design-tokens.js +1 -0
- package/src/tooling/theme-contrast.js +22 -11
- package/tokens.json +1 -0
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.btn {
|
|
51
|
-
--btn-font-size: var(--control-font-size);
|
|
52
51
|
--btn-min-size: var(--control-size);
|
|
53
52
|
--btn-pad-x: var(--control-pad-x, 1em);
|
|
54
53
|
--btn-bg: var(--ui-bg, var(--btn-default-bg, var(--intent, var(--neutral))));
|
|
@@ -92,9 +91,16 @@
|
|
|
92
91
|
use 0 0 #0000 to remove elevation, since none invalidates that list. */
|
|
93
92
|
box-shadow: var(--btn-shadow, 0 0 #0000);
|
|
94
93
|
font: inherit;
|
|
95
|
-
|
|
94
|
+
/* why: inherited, not declared here: tokens.css and the .sm/.lg boundaries
|
|
95
|
+
select it, so an author can also set it on a container. */
|
|
96
|
+
font-size: var(--btn-font-size, var(--control-font-size));
|
|
97
|
+
/* why: medium at one step below the field text. Medium at the field text
|
|
98
|
+
size read dense, worst with system-ui on Windows (500 renders close to
|
|
99
|
+
semibold); regular read lighter than the medium field labels. */
|
|
96
100
|
font-weight: var(--font-weight-medium);
|
|
97
|
-
|
|
101
|
+
/* why: 1.25, not 1: a wrapped label's lines touched at 1. A single line
|
|
102
|
+
keeps its height, since padding-block is derived from 1lh above. */
|
|
103
|
+
line-height: 1.25;
|
|
98
104
|
text-decoration: none;
|
|
99
105
|
cursor: pointer;
|
|
100
106
|
transition:
|
|
@@ -112,6 +118,9 @@
|
|
|
112
118
|
inline-size: var(--btn-min-size);
|
|
113
119
|
block-size: var(--btn-min-size);
|
|
114
120
|
padding: 0;
|
|
121
|
+
/* why: an icon font glyph is 1em; it keeps the field text size, not the
|
|
122
|
+
smaller label step, so the icon fills the square as before. */
|
|
123
|
+
font-size: var(--control-font-size);
|
|
115
124
|
}
|
|
116
125
|
|
|
117
126
|
/* .solid/.soft/.outline are shared via variants.css. The baseline --btn-*
|
|
@@ -122,11 +131,12 @@
|
|
|
122
131
|
--ui-border: transparent;
|
|
123
132
|
}
|
|
124
133
|
|
|
125
|
-
/* A neutral outline is a quiet action
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
/* A neutral outline is a quiet action: its label identifies it, so its edge
|
|
135
|
+
is the surface border, not the 3:1 control edge a field needs (WCAG 1.4.11
|
|
136
|
+
asks for no boundary when visible text identifies the control). An explicit
|
|
137
|
+
intent still wins through --intent. */
|
|
128
138
|
.btn.outline {
|
|
129
|
-
--ui-border: var(--intent, var(--border
|
|
139
|
+
--ui-border: var(--intent, var(--border));
|
|
130
140
|
}
|
|
131
141
|
|
|
132
142
|
/* A surface button is neutral chrome, so it hovers at the .outline rate: an
|
|
@@ -217,6 +227,9 @@
|
|
|
217
227
|
min-block-size: auto;
|
|
218
228
|
padding-inline: 0;
|
|
219
229
|
inline-size: fit-content;
|
|
230
|
+
/* why: a link reads as text, so it takes the size of the sentence around it
|
|
231
|
+
rather than the button label step. */
|
|
232
|
+
font-size: inherit;
|
|
220
233
|
max-inline-size: 100%;
|
|
221
234
|
/* No border at all: a link reads through its underline, and the inherited
|
|
222
235
|
.btn border made transparent would turn into a visible box in forced
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.join-addon {
|
|
43
|
-
--control-border: var(--border-control);
|
|
43
|
+
--control-border: var(--control-default-border, var(--border-control));
|
|
44
44
|
--control-bg: var(--surface-subtle);
|
|
45
45
|
--control-fg: var(--text-muted);
|
|
46
46
|
|
|
@@ -151,6 +151,16 @@
|
|
|
151
151
|
|
|
152
152
|
/* Text controls paint their own inset focus outline (control.css), so a
|
|
153
153
|
.join never moves the ring to the group: button-only groups and wrapped
|
|
154
|
-
inputs alike keep per-control focus, with no :has() group treatment.
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
inputs alike keep per-control focus, with no :has() group treatment. */
|
|
155
|
+
|
|
156
|
+
/* Beside a field, a neutral outline action is a segment of that field and
|
|
157
|
+
takes its edge; alone or among buttons it keeps its quieter --border edge.
|
|
158
|
+
Without :has() the rule drops and the button keeps --border: a lighter
|
|
159
|
+
segment, still bounded. */
|
|
160
|
+
.join:has(> :is(.input, .textarea, .select), > * > :is(.input, .textarea, .select)) > .btn.outline {
|
|
161
|
+
--ui-border: var(--intent, var(--control-default-border, var(--border-control)));
|
|
162
|
+
--btn-border-block-end-color: var(
|
|
163
|
+
--intent,
|
|
164
|
+
var(--control-border-block-end-color, var(--btn-border))
|
|
165
|
+
);
|
|
166
|
+
}
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* .navbar is a horizontal bar; .navbar-brand is the brand link; the inline
|
|
7
7
|
* links are a .cluster using .nav-link items. .nav-list is the vertical nav
|
|
8
|
-
* list shared with .drawer, fed by the shared --gap token.
|
|
8
|
+
* list shared with .drawer, fed by the shared --gap token. .nav-list.rail is
|
|
9
|
+
* the table-of-contents form: one rail, the current link a band on it, and a
|
|
10
|
+
* focus outline that lands on the same band.
|
|
9
11
|
*
|
|
10
12
|
* Public hooks:
|
|
11
13
|
* --nav-current-bg (fallback-only: current-link fill)
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
* Internal:
|
|
17
19
|
* --gap (local value for the shared gap token)
|
|
18
20
|
* --nav-list-rail-inset (half the icon on each side of the nested rail)
|
|
21
|
+
* --nav-list-rail-width (.rail band width, tied to --focus-ring-width)
|
|
19
22
|
*/
|
|
20
23
|
/* Intent boundary — inherited intents do not tint this component.
|
|
21
24
|
Local intent classes still win because :where() has zero specificity.
|
|
@@ -194,6 +197,70 @@
|
|
|
194
197
|
border-inline-start: var(--border-width) solid var(--nav-list-rail-color, var(--border));
|
|
195
198
|
}
|
|
196
199
|
|
|
200
|
+
/* Rail: one band, three independent states. The rail, the current band and
|
|
201
|
+
the focus line share one width, and every row link reaches under the rail,
|
|
202
|
+
so the inset focus outline lands its leading edge on the band: focus on the
|
|
203
|
+
current link continues its band into a frame, focus elsewhere draws its
|
|
204
|
+
own segment, and the current band stays while focus moves. The width
|
|
205
|
+
follows --focus-ring-width, prefers-contrast step included, which is what
|
|
206
|
+
keeps the joint exact. Current is ink plus band, no fill, and the weight
|
|
207
|
+
stays constant like every .nav-link. */
|
|
208
|
+
.nav-list.rail {
|
|
209
|
+
--gap: 0;
|
|
210
|
+
--nav-list-rail-width: var(--focus-ring-width);
|
|
211
|
+
border-inline-start: var(--nav-list-rail-width) solid var(--nav-list-rail-color, var(--border));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* A nested list joins the outer rail instead of hanging its own: its links
|
|
215
|
+
reach the same band and indent one step further. Deeper levels share that
|
|
216
|
+
indent. */
|
|
217
|
+
.nav-list.rail .nav-list {
|
|
218
|
+
--gap: 0;
|
|
219
|
+
margin-inline-start: 0;
|
|
220
|
+
padding-inline-start: 0;
|
|
221
|
+
border-inline-start: 0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.nav-list.rail .nav-link {
|
|
225
|
+
margin-inline-start: calc(-1 * var(--nav-list-rail-width));
|
|
226
|
+
inline-size: calc(100% + var(--nav-list-rail-width));
|
|
227
|
+
padding-inline-start: calc(var(--space-30) + var(--nav-list-rail-width));
|
|
228
|
+
border-radius: 0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.nav-list.rail .nav-list .nav-link {
|
|
232
|
+
padding-inline-start: calc(var(--space-30) * 2 + var(--nav-list-rail-width));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.nav-list.rail
|
|
236
|
+
.nav-link:is([aria-current="page"], [aria-current="location"], [aria-current="true"]) {
|
|
237
|
+
background: var(--nav-current-bg, transparent);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* The band marks aria-current, and :target-current while native scrollspy
|
|
241
|
+
(scrollspy.css) leads, before the script sets aria-current. :is() is a
|
|
242
|
+
forgiving list: an engine without :has() or :target-current drops that
|
|
243
|
+
branch, not the rule. The link stays the subject, so the band is its slot. */
|
|
244
|
+
.nav-list.rail
|
|
245
|
+
.nav-link:is(
|
|
246
|
+
[aria-current="page"],
|
|
247
|
+
[aria-current="location"],
|
|
248
|
+
[aria-current="true"],
|
|
249
|
+
.nav-list.rail:not(:has([aria-current="location"])) :target-current
|
|
250
|
+
)::before {
|
|
251
|
+
content: "";
|
|
252
|
+
position: absolute;
|
|
253
|
+
inset-block: 0;
|
|
254
|
+
inset-inline-start: 0;
|
|
255
|
+
border-inline-start: var(--nav-list-rail-width) solid var(--focus);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* Inset, so the leading edge covers the band instead of standing beside it,
|
|
259
|
+
and a scrollport (a sticky TOC) never clips the ring. */
|
|
260
|
+
.nav-list.rail .nav-link:focus-visible {
|
|
261
|
+
outline-offset: calc(var(--focus-ring-width) * -1);
|
|
262
|
+
}
|
|
263
|
+
|
|
197
264
|
/* Forced colors drops the fill and maps both inks to LinkText, so the current
|
|
198
265
|
link would be indistinguishable: it gets a shape instead. A vertical row
|
|
199
266
|
takes an inline-start trait, centered in the link's inline padding with
|
|
@@ -223,4 +290,19 @@
|
|
|
223
290
|
border-inline-start: 2px solid currentColor;
|
|
224
291
|
border-radius: var(--radius-full);
|
|
225
292
|
}
|
|
293
|
+
|
|
294
|
+
/* On a rail the trait is the band itself (its position outranks the trait
|
|
295
|
+
above). Forced colors paint the rail and the band in the same CanvasText,
|
|
296
|
+
so the band differs by shape, not by a repainted color: it grows inward
|
|
297
|
+
past the rail, into the link's inline padding. */
|
|
298
|
+
.nav-list.rail
|
|
299
|
+
.nav-link:is(
|
|
300
|
+
[aria-current="page"],
|
|
301
|
+
[aria-current="location"],
|
|
302
|
+
[aria-current="true"],
|
|
303
|
+
.nav-list.rail:not(:has([aria-current="location"])) :target-current
|
|
304
|
+
)::before {
|
|
305
|
+
border-inline-start-width: calc(var(--nav-list-rail-width) * 2.5);
|
|
306
|
+
border-radius: 0;
|
|
307
|
+
}
|
|
226
308
|
}
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
margin: 0;
|
|
26
26
|
padding: 0;
|
|
27
27
|
list-style: none;
|
|
28
|
-
|
|
28
|
+
/* why: the truncation ellipsis is text, not a .btn; it takes the button
|
|
29
|
+
label size so it reads at the page numbers' size. */
|
|
30
|
+
font-size: var(--btn-font-size);
|
|
29
31
|
|
|
30
32
|
/* Arrows, page numbers, and truncation ellipses share one geometric
|
|
31
33
|
system: equal digit widths keep the row from re-flowing as numbers grow
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
* --segmented-radius
|
|
29
29
|
* --segmented-fg
|
|
30
30
|
* --segmented-selected-bg
|
|
31
|
-
* --segmented-selected-border
|
|
31
|
+
* --segmented-selected-border (fallback-only: no edge by default; a theme sets
|
|
32
|
+
* it once on its root, e.g. a flat theme whose selected pill has no shadow)
|
|
32
33
|
*
|
|
33
34
|
* Internal:
|
|
34
35
|
* --segment-min-size
|
|
@@ -39,9 +40,6 @@
|
|
|
39
40
|
--segmented-radius: var(--radius);
|
|
40
41
|
--segmented-fg: var(--text-muted);
|
|
41
42
|
--segmented-selected-bg: var(--surface-raised);
|
|
42
|
-
/* The edge is what separates the selected segment where --surface-raised
|
|
43
|
-
is darker than --surface-subtle (the default dark palette). */
|
|
44
|
-
--segmented-selected-border: var(--border);
|
|
45
43
|
|
|
46
44
|
display: inline-grid;
|
|
47
45
|
grid-auto-flow: column;
|
|
@@ -59,6 +57,21 @@
|
|
|
59
57
|
vertical-align: middle;
|
|
60
58
|
}
|
|
61
59
|
|
|
60
|
+
/* A dark scheme puts --surface-raised below --surface-subtle, so the selected
|
|
61
|
+
pill read as a recess in the rail. There it rises above the rail instead,
|
|
62
|
+
like the switch knob; a light scheme keeps the raised surface.
|
|
63
|
+
light-dark() follows the track's own color-scheme (theme islands included);
|
|
64
|
+
without it a dark pill stays --surface-raised, a degraded selection carried
|
|
65
|
+
by the --text ink against --text-muted. */
|
|
66
|
+
@supports (color: light-dark(red, blue)) {
|
|
67
|
+
.segmented {
|
|
68
|
+
--segmented-selected-bg: light-dark(
|
|
69
|
+
var(--surface-raised),
|
|
70
|
+
color-mix(in oklab, var(--text) 14%, var(--surface-subtle))
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
62
75
|
.segment {
|
|
63
76
|
position: relative;
|
|
64
77
|
display: flex;
|
|
@@ -136,12 +149,19 @@
|
|
|
136
149
|
}
|
|
137
150
|
|
|
138
151
|
/* Separate rules from the :has() forms below: an engine without :has() would
|
|
139
|
-
discard a shared selector list, ARIA states included.
|
|
152
|
+
discard a shared selector list, ARIA states included.
|
|
153
|
+
The selected pill is set apart by its fill, its shadow and the full --text
|
|
154
|
+
ink against --text-muted; no edge by default. --segmented-selected-border
|
|
155
|
+
is read, never declared here, so a theme (a flat one without --shadow) can
|
|
156
|
+
restore the edge once on its root.
|
|
157
|
+
Trap: the ring and --shadow share one box-shadow list, and `none` is not a
|
|
158
|
+
list item. A theme that sets --shadow: none drops the whole declaration,
|
|
159
|
+
ring included; flatten shadows with --shadow-color: transparent instead. */
|
|
140
160
|
.segment:is([aria-selected="true"], [aria-current="page"], [aria-current="true"]) {
|
|
141
161
|
background: var(--segmented-selected-bg);
|
|
142
162
|
color: var(--text);
|
|
143
163
|
box-shadow:
|
|
144
|
-
0 0 0 var(--border-width) var(--segmented-selected-border),
|
|
164
|
+
0 0 0 var(--border-width) var(--segmented-selected-border, transparent),
|
|
145
165
|
var(--shadow);
|
|
146
166
|
}
|
|
147
167
|
|
|
@@ -149,7 +169,7 @@
|
|
|
149
169
|
background: var(--segmented-selected-bg);
|
|
150
170
|
color: var(--text);
|
|
151
171
|
box-shadow:
|
|
152
|
-
0 0 0 var(--border-width) var(--segmented-selected-border),
|
|
172
|
+
0 0 0 var(--border-width) var(--segmented-selected-border, transparent),
|
|
153
173
|
var(--shadow);
|
|
154
174
|
}
|
|
155
175
|
|
package/src/css/core/theme.css
CHANGED
|
@@ -159,10 +159,12 @@
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
/* Soft foreground hooks — the soft ink is the intent rebated toward the
|
|
163
|
-
text
|
|
164
|
-
the
|
|
165
|
-
|
|
162
|
+
/* Soft foreground hooks — the soft ink is the raw intent, rebated toward the
|
|
163
|
+
local text only by what keeps 4.5:1 against the hovered fill on
|
|
164
|
+
--surface-subtle, the tightest pair (the resting fill carries the extra
|
|
165
|
+
margin; variants.css soft recipe). A wider mix greys the ink and the softs
|
|
166
|
+
read dull, so each role is tuned to its own threshold. Deliberately scoped
|
|
167
|
+
to the default theme: a custom property bakes its var() references where it is
|
|
166
168
|
declared, so these resolve against root/light/dark tokens on every boundary.
|
|
167
169
|
Presets and custom islands keep their --soft-fg-mix / raw-intent ink unless
|
|
168
170
|
they declare hooks themselves.
|
|
@@ -178,11 +180,11 @@
|
|
|
178
180
|
:where(:root),
|
|
179
181
|
[data-theme="light"],
|
|
180
182
|
[data-theme="dark"] {
|
|
181
|
-
--secondary-soft-fg:
|
|
182
|
-
--success-soft-fg: color-mix(in oklab, var(--text)
|
|
183
|
-
--warning-soft-fg: color-mix(in oklab, var(--text)
|
|
184
|
-
--danger-soft-fg: color-mix(in oklab, var(--text)
|
|
185
|
-
--neutral-soft-fg: color-mix(in oklab, var(--text)
|
|
183
|
+
--secondary-soft-fg: var(--secondary);
|
|
184
|
+
--success-soft-fg: color-mix(in oklab, var(--text) 4%, var(--success));
|
|
185
|
+
--warning-soft-fg: color-mix(in oklab, var(--text) 12%, var(--warning));
|
|
186
|
+
--danger-soft-fg: color-mix(in oklab, var(--text) 3%, var(--danger));
|
|
187
|
+
--neutral-soft-fg: color-mix(in oklab, var(--text) 8%, var(--neutral));
|
|
186
188
|
}
|
|
187
189
|
|
|
188
190
|
:where([data-theme]:not([data-theme="light"]):not([data-theme="dark"])) {
|
package/src/css/core/tokens.css
CHANGED
|
@@ -151,6 +151,12 @@
|
|
|
151
151
|
--control-step-md: 1;
|
|
152
152
|
--control-step-lg: 0;
|
|
153
153
|
--control-font-size: var(--font-size-md);
|
|
154
|
+
/* A button label sits one step of the type scale below the field text
|
|
155
|
+
(13/14/16px against 14/16/18px). Selected wherever --control-font-size
|
|
156
|
+
is, so a button inside .join.sm or .field.sm follows the size it sits in;
|
|
157
|
+
density (.compact/.spacious) leaves it alone like the field text. Not a
|
|
158
|
+
ratio: 0.875 put a .sm label at 12.25px. */
|
|
159
|
+
--btn-font-size: var(--font-size-sm);
|
|
154
160
|
--choice-control-size: 1.125em;
|
|
155
161
|
--disabled-opacity: 0.65;
|
|
156
162
|
}
|
|
@@ -194,7 +200,7 @@
|
|
|
194
200
|
is a fallback-only hook whose absence lets each recipe keep its own rim
|
|
195
201
|
(a tinted rim on .soft, none on the tint), and a theme that sets it gives
|
|
196
202
|
both a rim of that weight. */
|
|
197
|
-
--soft-bg-mix:
|
|
203
|
+
--soft-bg-mix: 92%;
|
|
198
204
|
--soft-hover-alpha: 6%;
|
|
199
205
|
/* Soft foreground: the share of raw intent in soft text. 100% keeps the
|
|
200
206
|
pure intent color; lower values rebate it toward --text, which vivid or
|
|
@@ -126,6 +126,7 @@
|
|
|
126
126
|
).sm {
|
|
127
127
|
--control-size: var(--control-size-sm);
|
|
128
128
|
--control-font-size: var(--font-size-sm);
|
|
129
|
+
--btn-font-size: var(--font-size-xs);
|
|
129
130
|
--control-pad-x: var(--control-pad-x-sm);
|
|
130
131
|
--control-step-sm: 1;
|
|
131
132
|
--control-step-md: 0;
|
|
@@ -155,6 +156,7 @@
|
|
|
155
156
|
).lg {
|
|
156
157
|
--control-size: var(--control-size-lg);
|
|
157
158
|
--control-font-size: var(--font-size-lg);
|
|
159
|
+
--btn-font-size: var(--font-size-md);
|
|
158
160
|
--control-pad-x: var(--control-pad-x-lg);
|
|
159
161
|
--control-step-sm: 0;
|
|
160
162
|
--control-step-md: 0;
|
|
@@ -17,21 +17,24 @@
|
|
|
17
17
|
* lost its hover motion). The `animation` shorthand still replaces another
|
|
18
18
|
* animation on the same element, which is the remaining composition limit.
|
|
19
19
|
*
|
|
20
|
-
* Fill mode `backwards` holds the first keyframe through a
|
|
21
|
-
*
|
|
22
|
-
* element
|
|
23
|
-
*
|
|
20
|
+
* Fill mode `backwards` holds the first keyframe through a delay and leaves no
|
|
21
|
+
* animated value in the cascade once the entrance ends. Focus inside an
|
|
22
|
+
* element with in-view.js finishes its entrance there, because a :focus-within
|
|
23
|
+
* override lapses on blur: the entrance resumes from its timeline. `.reveal`
|
|
24
|
+
* alone has no such guard while its first-render entrance runs.
|
|
24
25
|
*
|
|
25
26
|
* Public hooks:
|
|
26
27
|
* --reveal-duration
|
|
27
28
|
* --reveal-distance
|
|
28
29
|
* --reveal-stagger
|
|
30
|
+
* --reveal-delay
|
|
29
31
|
*/
|
|
30
32
|
.reveal,
|
|
31
33
|
.reveal-group {
|
|
32
34
|
--reveal-duration: 450ms;
|
|
33
35
|
--reveal-distance: 1rem;
|
|
34
36
|
--reveal-stagger: 60ms;
|
|
37
|
+
--reveal-delay: 0ms;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
@media screen and (prefers-reduced-motion: no-preference) {
|
|
@@ -40,14 +43,20 @@
|
|
|
40
43
|
/* The gentler ease-out keeps the fade gradual; surface entrance timing
|
|
41
44
|
makes most of the content visible too early. */
|
|
42
45
|
animation: actual-reveal var(--reveal-duration) ease-out backwards;
|
|
46
|
+
/* Also the group's delay when sibling-index() is unsupported. */
|
|
47
|
+
animation-delay: var(--reveal-delay);
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
/* The cap keeps a long list from becoming an endless cascade: the ninth and
|
|
46
51
|
later items share the eighth step's delay. An engine without
|
|
47
52
|
sibling-index() drops this declaration alone and reveals the group
|
|
48
|
-
together, which is the intended degradation. */
|
|
53
|
+
together after the base delay, which is the intended degradation. */
|
|
49
54
|
.reveal-group > * {
|
|
50
|
-
animation-delay: calc(
|
|
55
|
+
animation-delay: calc(
|
|
56
|
+
var(--reveal-delay) +
|
|
57
|
+
min(sibling-index() - 1, 8) *
|
|
58
|
+
var(--reveal-stagger)
|
|
59
|
+
);
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
.reveal.is-pending,
|
|
@@ -17,10 +17,18 @@
|
|
|
17
17
|
* --btn-border-block-end-* (button.css), for themes that give text controls an
|
|
18
18
|
* underline-style lower edge instead of a uniform border.
|
|
19
19
|
*
|
|
20
|
+
* --control-default-border is the inherited resting edge, the twin of
|
|
21
|
+
* --control-default-bg: a theme sets both on its root, where --control-border
|
|
22
|
+
* itself is owned by the state rules below. Paired with the lower-edge hook it
|
|
23
|
+
* moves the 3:1 identification to the bottom alone (quiet sides, or none).
|
|
24
|
+
* readonly and disabled reset the lower edge, so an inherited accent or 3:1
|
|
25
|
+
* underline never marks a field the user cannot edit.
|
|
26
|
+
*
|
|
20
27
|
* Public hooks:
|
|
21
28
|
* --control-border
|
|
22
29
|
* --control-bg
|
|
23
30
|
* --control-default-bg
|
|
31
|
+
* --control-default-border
|
|
24
32
|
* --control-fg
|
|
25
33
|
* --control-cursor
|
|
26
34
|
* --control-shadow
|
|
@@ -32,7 +40,7 @@
|
|
|
32
40
|
.input,
|
|
33
41
|
.textarea,
|
|
34
42
|
.select {
|
|
35
|
-
--control-border: var(--border-control);
|
|
43
|
+
--control-border: var(--control-default-border, var(--border-control));
|
|
36
44
|
--control-bg: var(--control-default-bg, var(--surface));
|
|
37
45
|
--control-fg: var(--text);
|
|
38
46
|
--control-cursor: auto;
|
|
@@ -103,6 +111,7 @@
|
|
|
103
111
|
.textarea[readonly] {
|
|
104
112
|
--control-bg: var(--surface-subtle);
|
|
105
113
|
--control-border: var(--border);
|
|
114
|
+
--control-border-block-end-color: initial;
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
.input:disabled,
|
|
@@ -111,6 +120,7 @@
|
|
|
111
120
|
--control-bg: var(--surface-subtle);
|
|
112
121
|
--control-fg: var(--state-disabled);
|
|
113
122
|
--control-border: var(--border);
|
|
123
|
+
--control-border-block-end-color: initial;
|
|
114
124
|
--control-cursor: not-allowed;
|
|
115
125
|
}
|
|
116
126
|
|
package/src/css/forms/form.css
CHANGED
|
@@ -37,13 +37,22 @@
|
|
|
37
37
|
border-radius: var(--radius);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
/* A label names one control a step below the value it names: at the value's
|
|
41
|
+
own size the hierarchy rested on weight alone, and a stack of medium
|
|
42
|
+
labels read louder than the fields. Medium and the full ink keep it a
|
|
43
|
+
clear read. A fraction of --control-font-size, not a fixed step, so it
|
|
44
|
+
follows .sm/.lg on the .field whatever element holds the label. The legend
|
|
45
|
+
titles a group, one level up, and is set small inside the frame, so it
|
|
46
|
+
keeps the heavier weight. */
|
|
47
|
+
.field-label {
|
|
42
48
|
color: var(--text);
|
|
43
|
-
font-
|
|
49
|
+
font-size: calc(var(--control-font-size) * 0.875);
|
|
50
|
+
font-weight: var(--font-weight-medium);
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
.field-group > legend {
|
|
54
|
+
color: var(--text);
|
|
55
|
+
font-weight: var(--font-weight-semibold);
|
|
47
56
|
padding-block: 0;
|
|
48
57
|
padding-inline: var(--fieldset-legend-padding-inline, var(--space-10));
|
|
49
58
|
font-size: var(--font-size-xs);
|
|
@@ -59,10 +68,11 @@
|
|
|
59
68
|
border-radius: 0;
|
|
60
69
|
}
|
|
61
70
|
|
|
71
|
+
/* Same formula as .field-label: the flush legend is that label. */
|
|
62
72
|
.field-group.flush > legend {
|
|
63
73
|
margin-block-end: var(--space-10);
|
|
64
74
|
padding-inline: 0;
|
|
65
|
-
font-size: var(--control-font-size);
|
|
75
|
+
font-size: calc(var(--control-font-size) * 0.875);
|
|
66
76
|
}
|
|
67
77
|
|
|
68
78
|
.field-help {
|
package/src/css/forms/switch.css
CHANGED
|
@@ -29,11 +29,17 @@
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
.switch {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
/* At rest the track itself is the 3:1 control edge (WCAG 1.4.11): a filled
|
|
33
|
+
--border-control pill. The track carries the state (neutral off, intent
|
|
34
|
+
on) and the knob stays one light part that only moves. Two alternatives
|
|
35
|
+
were measured and set aside: a --border-control ring over a --border
|
|
36
|
+
fill read as a circled control beside flat fields and buttons, and a
|
|
37
|
+
dark knob on a quiet track (the knob as the cue) turned the knob dark
|
|
38
|
+
when off and light when on, as if from two systems. The border takes the
|
|
39
|
+
fill, so every state stays one uniform shape; a disabled track keeps a
|
|
40
|
+
quiet --border edge, as a disabled check does. */
|
|
41
|
+
--switch-bg: var(--border-control);
|
|
42
|
+
--switch-border: var(--switch-bg);
|
|
37
43
|
--switch-knob: var(--surface-raised);
|
|
38
44
|
--switch-block-size: calc(var(--choice-control-size) + 0.125em);
|
|
39
45
|
--switch-width: calc(var(--switch-block-size) * 1.8);
|
|
@@ -75,6 +81,21 @@
|
|
|
75
81
|
cursor: pointer;
|
|
76
82
|
}
|
|
77
83
|
|
|
84
|
+
/* The knob keeps one color through the toggle: light in a light scheme (white
|
|
85
|
+
on the dark checked track), dark in a dark one, where the checked track turns
|
|
86
|
+
light and its --intent-fg knob dark. A light resting knob there flipped color
|
|
87
|
+
on every toggle. The dark resting knob is --surface-opaque, not
|
|
88
|
+
--surface-raised: --border-control is calibrated to 3:1 against that opaque
|
|
89
|
+
surface, so the knob holds the same 3:1 against the track in any theme that
|
|
90
|
+
keeps the contract (3.6:1 on the default palette; --surface-raised gave
|
|
91
|
+
1.47:1). light-dark() follows the switch's own color-scheme, so a theme
|
|
92
|
+
island resolves its branch. Without it the knob stays --surface-raised. */
|
|
93
|
+
@supports (color: light-dark(red, blue)) {
|
|
94
|
+
.switch {
|
|
95
|
+
--switch-knob: light-dark(var(--surface-raised), var(--surface-opaque));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
78
99
|
/* No elevation on the knob: --shadow is a surface elevation (card, modal,
|
|
79
100
|
drawer, fab), and at this size its 12px blur reads as a smudge that spills
|
|
80
101
|
past the rail while carrying no state. The range thumb — the same kind of
|
|
@@ -104,7 +125,7 @@
|
|
|
104
125
|
than substituting an unsupported mix into both background and border. */
|
|
105
126
|
@supports (color: color-mix(in oklab, black, white)) {
|
|
106
127
|
.switch:not(:checked):hover:not(:disabled) {
|
|
107
|
-
--switch-bg: color-mix(in oklab, var(--text)
|
|
128
|
+
--switch-bg: color-mix(in oklab, var(--text) 15%, var(--border-control));
|
|
108
129
|
}
|
|
109
130
|
}
|
|
110
131
|
|
|
@@ -139,9 +160,13 @@
|
|
|
139
160
|
outline-offset: var(--focus-outline-offset);
|
|
140
161
|
}
|
|
141
162
|
|
|
163
|
+
/* why: without an edge a disabled track is --surface-subtle on --surface,
|
|
164
|
+
about 1.05:1, so the switch all but disappeared next to a disabled check
|
|
165
|
+
that keeps its --border frame. Disabled controls are exempt from 3:1; the
|
|
166
|
+
quiet edge only keeps the shape, the same way across choice controls. */
|
|
142
167
|
.switch:disabled {
|
|
143
168
|
--switch-bg: var(--surface-subtle);
|
|
144
|
-
--switch-border: var(--
|
|
169
|
+
--switch-border: var(--border);
|
|
145
170
|
--switch-knob: var(--state-disabled);
|
|
146
171
|
opacity: 1;
|
|
147
172
|
cursor: not-allowed;
|
package/src/js/ajax.js
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* followed by navigation like a native submission.
|
|
13
13
|
*
|
|
14
14
|
* Display, kept apart: with data-ajax-target, an HTML response (2xx or 422)
|
|
15
|
-
* replaces the target's content
|
|
15
|
+
* replaces the target's content, and focus lost with the old content lands in
|
|
16
|
+
* the new one. Everything else only reaches the events.
|
|
16
17
|
* The module never decides that a response means "saved".
|
|
17
18
|
*/
|
|
18
19
|
|
|
@@ -69,6 +70,20 @@ function targetElement(root, selector) {
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
// The update removed the focused element (a re-rendered form, a confirmation
|
|
74
|
+
// in its place): without a new place, focus falls back to the body and a
|
|
75
|
+
// keyboard user starts over from the top. The answer says where to land: the
|
|
76
|
+
// first invalid field, or an element the server marked with autofocus, which
|
|
77
|
+
// the browser ignores in inserted HTML. A target with a tabindex catches the
|
|
78
|
+
// rest; otherwise focus stays where the browser left it.
|
|
79
|
+
function refocus(target) {
|
|
80
|
+
// Two queries, not one list: an invalid field wins over an autofocus that
|
|
81
|
+
// comes before it in the answer.
|
|
82
|
+
const next = target.querySelector('[aria-invalid="true"]') ?? target.querySelector("[autofocus]");
|
|
83
|
+
if (next) next.focus();
|
|
84
|
+
else if (target.hasAttribute("tabindex")) target.focus();
|
|
85
|
+
}
|
|
86
|
+
|
|
72
87
|
function display(form, root, response) {
|
|
73
88
|
const selector = form.dataset.ajaxTarget;
|
|
74
89
|
if (!selector || !(response.ok || response.status === 422)) return null;
|
|
@@ -81,7 +96,9 @@ function display(form, root, response) {
|
|
|
81
96
|
.clone()
|
|
82
97
|
.text()
|
|
83
98
|
.then((html) => {
|
|
99
|
+
const focused = target.contains(root.activeElement);
|
|
84
100
|
target.innerHTML = html;
|
|
101
|
+
if (focused) refocus(target);
|
|
85
102
|
});
|
|
86
103
|
}
|
|
87
104
|
|
package/src/js/context-menu.js
CHANGED
|
@@ -181,9 +181,7 @@ function resolveContextMenu(target, state) {
|
|
|
181
181
|
|
|
182
182
|
state.release = retainSurface(menu);
|
|
183
183
|
state.menu = menu;
|
|
184
|
-
state.releaseMenu = connectMenu(menu
|
|
185
|
-
close: (menu) => closeSurface(menu),
|
|
186
|
-
});
|
|
184
|
+
state.releaseMenu = connectMenu(menu);
|
|
187
185
|
return menu;
|
|
188
186
|
}
|
|
189
187
|
|
package/src/js/flyout.js
CHANGED
|
@@ -6,6 +6,10 @@ import { connectMenu, focusFirstMenuItem, focusLastMenuItem } from "./menu.js";
|
|
|
6
6
|
import { closeSurface, isSurfaceOpen, openSurface, retainSurface } from "./surface.js";
|
|
7
7
|
|
|
8
8
|
const triggerMap = new WeakMap();
|
|
9
|
+
// Which trigger opened each panel. Only that one sends Tab into the panel: a
|
|
10
|
+
// second trigger after the panel would otherwise send focus back in forever
|
|
11
|
+
// (link, second trigger, link…), since the panel's last stop leads to it.
|
|
12
|
+
const openers = new WeakMap();
|
|
9
13
|
|
|
10
14
|
function readFlyoutOptions(panel) {
|
|
11
15
|
const opts = { autoClose: "true" };
|
|
@@ -37,11 +41,13 @@ function isAriaMenu(panel) {
|
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
function openFlyout(panel, trigger) {
|
|
40
|
-
|
|
44
|
+
const opened = openSurface(panel, {
|
|
41
45
|
trigger,
|
|
42
46
|
source: trigger,
|
|
43
47
|
...readFlyoutOptions(panel),
|
|
44
48
|
});
|
|
49
|
+
if (opened) openers.set(panel, trigger);
|
|
50
|
+
return opened;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
function openAndFocusPanel(flyout, trigger) {
|
|
@@ -87,7 +93,12 @@ function onTriggerKeydown(e) {
|
|
|
87
93
|
else openAndFocusPanel(panel, trigger);
|
|
88
94
|
break;
|
|
89
95
|
case "Tab":
|
|
90
|
-
if (
|
|
96
|
+
if (
|
|
97
|
+
isSurfaceOpen(panel) &&
|
|
98
|
+
openers.get(panel) === trigger &&
|
|
99
|
+
!e.shiftKey &&
|
|
100
|
+
focusFirstDescendant(panel)
|
|
101
|
+
) {
|
|
91
102
|
e.preventDefault();
|
|
92
103
|
}
|
|
93
104
|
break;
|
|
@@ -160,9 +171,7 @@ function resolvePanel(trigger, state) {
|
|
|
160
171
|
state.panel = panel;
|
|
161
172
|
|
|
162
173
|
if (isMenuFlyout(panel)) {
|
|
163
|
-
state.releaseMenu = connectMenu(panel
|
|
164
|
-
close: (menu) => closeSurface(menu),
|
|
165
|
-
});
|
|
174
|
+
state.releaseMenu = connectMenu(panel);
|
|
166
175
|
}
|
|
167
176
|
if (!trigger.hasAttribute("aria-haspopup") && isAriaMenu(panel)) {
|
|
168
177
|
trigger.setAttribute("aria-haspopup", "menu");
|