actual-css 0.16.0 → 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.
Files changed (79) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +8 -4
  3. package/components.json +21 -5
  4. package/dist/actual.full.css +410 -75
  5. package/dist/actual.full.js +2 -1
  6. package/dist/actual.full.min.css +1 -1
  7. package/docs/design-notes/app-ui.md +37 -3
  8. package/docs/design-notes/enhancement-contract.md +3 -1
  9. package/docs/design-notes/tokens.md +2 -0
  10. package/docs/navigation.json +14 -1
  11. package/docs/pages/components/accordion.md +5 -0
  12. package/docs/pages/components/alert.md +45 -17
  13. package/docs/pages/components/button.md +3 -0
  14. package/docs/pages/components/chat.md +20 -0
  15. package/docs/pages/components/dialog.md +36 -0
  16. package/docs/pages/components/drawer.md +52 -8
  17. package/docs/pages/components/navbar.md +26 -2
  18. package/docs/pages/components/rating.md +111 -12
  19. package/docs/pages/components/segmented.md +36 -1
  20. package/docs/pages/components/spinner.md +2 -0
  21. package/docs/pages/components/table.md +77 -0
  22. package/docs/pages/components/timeline.md +3 -1
  23. package/docs/pages/enhancements/flyout.md +83 -14
  24. package/docs/pages/enhancements/status-bar.md +1 -0
  25. package/docs/pages/enhancements/tabs.md +5 -0
  26. package/docs/pages/examples/overview.md +7 -1
  27. package/docs/pages/forms/ajax.md +101 -0
  28. package/docs/pages/forms/color-swatches.md +31 -2
  29. package/docs/pages/forms/date-picker.md +6 -0
  30. package/docs/pages/forms/joined-controls.md +8 -3
  31. package/docs/pages/forms/overview.md +2 -2
  32. package/docs/pages/forms/sticky-actions.md +2 -0
  33. package/docs/pages/forms/unsaved-changes.md +198 -0
  34. package/docs/pages/foundations/philosophy.md +2 -1
  35. package/docs/pages/foundations/theming.md +21 -4
  36. package/docs/pages/foundations/tokens.md +1 -1
  37. package/docs/pages/guides/introduction.md +1 -1
  38. package/docs/pages/guides/progressive-enhancement.md +30 -49
  39. package/docs/pages/guides/upgrading.md +16 -3
  40. package/docs/pages/layout/choosing.md +5 -0
  41. package/docs/pages/layout/column-layout.md +22 -8
  42. package/docs/pages/layout/scroll-snap.md +69 -2
  43. package/docs/pages/layout/sidebar-shell.md +68 -0
  44. package/docs/pages/patterns/empty-state.md +74 -0
  45. package/docs/pages/patterns/hierarchical-nav.md +40 -19
  46. package/docs/pages/patterns/navigation-list.md +3 -60
  47. package/docs/pages/patterns/stat.md +61 -0
  48. package/docs/pages/utilities/accessibility.md +32 -10
  49. package/package.json +4 -1
  50. package/reserved-classes.json +2 -0
  51. package/src/css/components/busy.css +25 -0
  52. package/src/css/components/button.css +3 -0
  53. package/src/css/components/chat.css +5 -1
  54. package/src/css/components/drawer.css +37 -3
  55. package/src/css/components/flyout.css +37 -0
  56. package/src/css/components/modal.css +3 -0
  57. package/src/css/components/navbar.css +99 -38
  58. package/src/css/components/rating.css +50 -5
  59. package/src/css/components/segmented.css +25 -2
  60. package/src/css/components/status-bar.css +4 -2
  61. package/src/css/forms/choice-card.css +5 -2
  62. package/src/css/forms/color-swatch.css +38 -19
  63. package/src/css/forms/custom-select.css +5 -0
  64. package/src/css/forms/form.css +3 -1
  65. package/src/css/layout/index.css +2 -0
  66. package/src/css/layout/sidebar-shell.css +67 -0
  67. package/src/js/ajax.js +148 -0
  68. package/src/js/dialog.js +59 -2
  69. package/src/js/dirty.js +140 -0
  70. package/src/js/dismiss.js +25 -0
  71. package/src/js/events.js +17 -0
  72. package/src/js/focus.js +12 -0
  73. package/src/js/form-submission.js +34 -0
  74. package/src/js/full.js +2 -0
  75. package/src/js/selectors.js +10 -2
  76. package/src/js/status.js +71 -10
  77. package/src/js/tab.js +16 -2
  78. package/src/js/validation.js +12 -4
  79. package/src/tooling/theme-contrast.js +3 -2
@@ -8,7 +8,9 @@
8
8
  * list shared with .drawer, fed by the shared --gap token.
9
9
  *
10
10
  * Public hooks:
11
- * --state-selected-text (fallback-only: current-link ink, see tokens.css)
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 two contracts: plain page navigation (aria-current="page")
76
- and scrollspy, which toggles aria-current="location" on the active link.
77
- Those two values are the contract; any other, "false" included, is inert.
78
- Selection never changes text metrics: the shared medium weight is kept and
79
- the current link is carried by the selected accent. */
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 the selected accent instead of dropping to --text. The surface fill is
87
- shared with the hover rule above. */
88
- .nav-link:is([aria-current="page"], [aria-current="location"]) {
89
- background: var(--surface-subtle);
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
- /* On a bar with its own --ui-bg/--ui-fg the fill is a tint of the link's own
94
- ink, the .btn.ghost hover recipe, so it reads on light and dark bars alike
95
- instead of snapping back to --surface-subtle. Not --ui-hover-bg: that is the
96
- bar's own hover and can equal its fill. The ink follows --ui-fg too — the
97
- selected accent has no contrast pair with an arbitrary bar. The baseline
98
- above keeps the light chip where color-mix is missing, with ink that is
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
- /* After :hover so a hovered current link keeps the selected accent. */
110
- .nav-link:is([aria-current="page"], [aria-current="location"]) {
111
- color: var(--ui-fg, var(--state-selected-text, var(--state-selected)));
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
- /* Vertical current indicator: inset inline-start trait in currentColor, so it
141
- follows the forced palette without a forced-colors block and never touches
142
- the row separators. Navbar horizontal links keep color + surface only. The
143
- positioning context lives on every row link, so becoming current never moves
144
- an app-positioned decoration to a new containing block.
145
- The trait sits centered in the link's inline padding with rounded ends: flush
146
- on the edge, a square line read as pasted onto the rounded fill. */
147
- .nav-list .nav-link:is([aria-current="page"], [aria-current="location"])::before {
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
- position: absolute;
150
- inset-block: var(--space-20);
151
- inset-inline-start: calc((var(--space-20) - 2px) / 2);
152
- border-inline-start: 2px solid currentColor;
153
- border-radius: var(--radius-full);
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: 0.1rem;
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
- block-size: var(--rating-size);
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
- -webkit-mask: var(--rating-star) center / var(--rating-size) var(--rating-size) no-repeat;
54
- mask: var(--rating-star) center / var(--rating-size) var(--rating-size) no-repeat;
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. Labels wrap instead of truncating;
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-block-size: calc(var(--control-size) - 2 * (var(--segmented-pad) + var(--border-width)));
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
  }
@@ -22,7 +22,8 @@
22
22
  * Internal:
23
23
  * --status-bg
24
24
  * --status-fg
25
- * --status-viewport-offset (written by status.js while the bar is open)
25
+ * --status-viewport-offset (written by status.js while the bar is open: the
26
+ * keyboard band plus any docked .form-actions.sticky bar)
26
27
  */
27
28
 
28
29
  /* Intent boundary — inherited intents do not tint this component.
@@ -38,7 +39,8 @@
38
39
 
39
40
  position: fixed;
40
41
  /* Fixed positioning tracks the layout viewport, which the mobile software
41
- keyboard covers. status.js writes the occluded band into the offset. */
42
+ keyboard covers, and a docked .form-actions.sticky bar shares its bottom
43
+ edge. status.js writes both occluded bands into the offset. */
42
44
  inset-block-end: calc(var(--space-40) + var(--status-viewport-offset, 0px));
43
45
  inset-inline: var(--space-40);
44
46
  z-index: var(--z-status);
@@ -104,8 +104,11 @@
104
104
  cursor: not-allowed;
105
105
  }
106
106
 
107
- .choice-card:hover:not(:has(:disabled)) {
108
- --choice-card-border: var(--text-subtle);
107
+ /* Touch can retain :hover after a tap; hover must never mask selection. */
108
+ @media (hover: hover) {
109
+ .choice-card:hover:not(:has(:disabled, :checked)) {
110
+ --choice-card-border: var(--text-subtle);
111
+ }
109
112
  }
110
113
 
111
114
  /* Checked border — shared by radio and checkbox */
@@ -16,11 +16,11 @@
16
16
  * rows sit one gap apart like columns. Edge, selection ring and focus ring all
17
17
  * belong to the visible swatch.
18
18
  *
19
- * The color is arbitrary, so nothing drawn on it may assume a contrast: the
20
- * selected mark is a double ring (--text outside, --surface-opaque inside) that
21
- * reads on any fill, and a hairline edge keeps a near-white color apart from
22
- * the page. ::before opts out of forced colors to keep the color, so it takes
23
- * system colors itself there.
19
+ * The color is arbitrary, so nothing is drawn on it: the selected mark is a
20
+ * --text ring outside the swatch (::after), past a transparent gap, so it reads
21
+ * on any color and any background and leaves the color whole. A hairline edge
22
+ * keeps a near-white color apart from the page. Both pseudo-elements opt out of
23
+ * forced colors to keep the color, so they take system colors themselves there.
24
24
  *
25
25
  * Without :has() the native radio stays visible in the swatch and carries the
26
26
  * state; the ring needs :has() to mirror it.
@@ -28,16 +28,18 @@
28
28
  * Public hooks:
29
29
  * --color-swatch-value (fallback-only: the color, set per swatch)
30
30
  * --color-swatch-size
31
- * --color-swatch-radius
31
+ * --color-swatch-radius (fallback-only: set it on the palette or a swatch)
32
32
  */
33
33
  .color-swatch {
34
34
  /* The .switch track height (switch.css); a browser test holds them equal. */
35
35
  --color-swatch-size: calc(var(--choice-control-size) + 0.125em);
36
- --color-swatch-radius: var(--radius-full);
37
36
  /* Internal: what the hit area adds to the swatch, half on each side. One gap
38
37
  at most, so two neighbours never claim the same point — a wider reach let
39
38
  the next swatch take a click on this one's center. */
40
39
  --color-swatch-reach: clamp(0px, var(--control-size) - var(--color-swatch-size), var(--gap));
40
+ /* Internal: how far the selection ring (gap + stroke) reaches past the
41
+ swatch. The focus ring moves out by as much on a checked swatch. */
42
+ --color-swatch-ring: 4px;
41
43
 
42
44
  position: relative;
43
45
  display: inline-grid;
@@ -69,13 +71,29 @@
69
71
  block-size: var(--color-swatch-size);
70
72
  box-sizing: border-box;
71
73
  border: var(--border-width) solid var(--border-control);
72
- border-radius: var(--color-swatch-radius);
74
+ border-radius: var(--color-swatch-radius, var(--radius-full));
73
75
  background: var(--color-swatch-value, transparent) padding-box;
74
76
  /* The color is the content, as on .color (native.css). */
75
77
  forced-color-adjust: none;
76
- transition:
77
- border-color var(--duration),
78
- box-shadow var(--duration);
78
+ transition: border-color var(--duration);
79
+ }
80
+
81
+ /* Selection ring, drawn on every swatch and colored when checked. Its negative
82
+ margin lays it out at the swatch size: a ring wider than the grid track
83
+ would widen it and push the swatch off-center in a tight palette. */
84
+ .color-swatch::after {
85
+ content: "";
86
+ grid-area: 1 / 1;
87
+ inline-size: calc(var(--color-swatch-size) + 2 * var(--color-swatch-ring));
88
+ block-size: calc(var(--color-swatch-size) + 2 * var(--color-swatch-ring));
89
+ margin: calc(-1 * var(--color-swatch-ring));
90
+ box-sizing: border-box;
91
+ border: calc(var(--color-swatch-ring) / 2) solid transparent;
92
+ border-radius: calc(var(--color-swatch-radius, var(--radius-full)) + var(--color-swatch-ring));
93
+ pointer-events: none;
94
+ /* The gap stays transparent; forced colors would paint it. */
95
+ forced-color-adjust: none;
96
+ transition: border-color var(--duration);
79
97
  }
80
98
 
81
99
  /* Shares the swatch's cell and paints after ::before, so a native radio left
@@ -107,10 +125,8 @@
107
125
  border-color: var(--text-subtle);
108
126
  }
109
127
 
110
- .color-swatch:has(> input:checked)::before {
111
- box-shadow:
112
- inset 0 0 0 2px var(--text),
113
- inset 0 0 0 4px var(--surface-opaque);
128
+ .color-swatch:has(> input:checked)::after {
129
+ border-color: var(--text);
114
130
  }
115
131
 
116
132
  /* The ring goes around the visible swatch, not the larger hit area. */
@@ -128,6 +144,11 @@
128
144
  outline-offset: var(--focus-outline-offset);
129
145
  }
130
146
 
147
+ /* Outside the selection ring, so the two never share a stroke. */
148
+ .color-swatch:has(> input:checked:focus-visible)::before {
149
+ outline-offset: calc(var(--focus-outline-offset) + var(--color-swatch-ring));
150
+ }
151
+
131
152
  .color-swatch:disabled {
132
153
  opacity: var(--disabled-opacity);
133
154
  cursor: not-allowed;
@@ -147,10 +168,8 @@
147
168
  border-color: CanvasText;
148
169
  }
149
170
 
150
- .color-swatch:has(> input:checked)::before {
151
- box-shadow:
152
- inset 0 0 0 2px CanvasText,
153
- inset 0 0 0 4px Canvas;
171
+ .color-swatch:has(> input:checked)::after {
172
+ border-color: CanvasText;
154
173
  }
155
174
 
156
175
  .color-swatch:disabled::before {
@@ -20,6 +20,11 @@
20
20
  .select:not([multiple], .native, [size]:not([size="1"])) {
21
21
  appearance: base-select;
22
22
  align-items: center;
23
+ /* why: base-select brings a UA padding-block (0.25em) that the native
24
+ select lacks; with a 24px line it pushed a .compact select to 34px
25
+ against --control-size 32px. min-block-size and align-items already
26
+ center the value. */
27
+ padding-block: 0;
23
28
 
24
29
  &::picker(select) {
25
30
  appearance: base-select;
@@ -51,7 +51,8 @@
51
51
 
52
52
  /* Flush — the frame removed, for a group that already sits in a card or a
53
53
  form section. With no border to notch, the legend is a plain label above
54
- the options: no gutter, and the .field label-to-control gap below it. */
54
+ the options: no gutter, the .field label-to-control gap below it, and the
55
+ .field label size — the small size only suits a legend set in a frame. */
55
56
  .field-group.flush {
56
57
  padding: 0;
57
58
  border: 0;
@@ -61,6 +62,7 @@
61
62
  .field-group.flush > legend {
62
63
  margin-block-end: var(--space-10);
63
64
  padding-inline: 0;
65
+ font-size: var(--control-font-size);
64
66
  }
65
67
 
66
68
  .field-help {
@@ -8,6 +8,7 @@
8
8
  * .center centered content column
9
9
  * .frame fixed-ratio media frame
10
10
  * .app-shell full-height application shell
11
+ * .sidebar-shell persistent side region + main, each scrolling; drawer below 64rem
11
12
  * .app-layout topbar + scrolling main + bottom/side app navigation
12
13
  * .media fixed media + flexible content
13
14
  * .switcher peer regions: all horizontal or all stacked
@@ -31,6 +32,7 @@
31
32
  @import "./center.css";
32
33
  @import "./frame.css";
33
34
  @import "./app-shell.css";
35
+ @import "./sidebar-shell.css";
34
36
  @import "./app-layout.css";
35
37
  @import "./media.css";
36
38
  @import "./switcher.css";
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Sidebar shell — a persistent side region beside the main one on a wide
3
+ * viewport, each scrolling on its own; below 64rem the side region hides and
4
+ * the document scrolls. The page mirrors the navigation into a dialog.drawer.
5
+ *
6
+ * Docs: docs/pages/layout/sidebar-shell.md
7
+ * Design note: docs/design-notes/app-ui.md#sidebar-shell
8
+ *
9
+ * Structure: two direct children, an `aside` (side) and one other element
10
+ * (main). The breakpoint is a literal; a custom property cannot sit in a
11
+ * media condition.
12
+ *
13
+ * Public hooks:
14
+ * --sidebar-shell-size
15
+ */
16
+ .sidebar-shell {
17
+ --sidebar-shell-size: 16rem;
18
+ }
19
+
20
+ /* Hidden below, never shown above: the aside keeps the author's display (an
21
+ aside.stack). Where range syntax is unsupported the rule drops and the
22
+ sidebar stacks above the content, still reachable. Screen only: a printed
23
+ page is narrower than 64rem, and print never hides framework content. */
24
+ @media screen and (width < 64rem) {
25
+ .sidebar-shell > aside {
26
+ display: none;
27
+ }
28
+ }
29
+
30
+ @media (width >= 64rem) {
31
+ .sidebar-shell {
32
+ display: grid;
33
+ grid-template-columns: var(--sidebar-shell-size) minmax(0, 1fr);
34
+ block-size: var(--viewport-block);
35
+ }
36
+
37
+ /* Each region is its own scroller, so the sidebar stays put. min-block-size
38
+ lets the grid row hold them to the viewport instead of their content. */
39
+ .sidebar-shell > * {
40
+ min-block-size: 0;
41
+ overflow: auto;
42
+ overscroll-behavior: contain;
43
+ }
44
+
45
+ .sidebar-shell > aside {
46
+ grid-column: 1;
47
+ grid-row: 1;
48
+ }
49
+
50
+ .sidebar-shell > :not(aside) {
51
+ grid-column: 2;
52
+ grid-row: 1;
53
+ }
54
+ }
55
+
56
+ /* Paper is one flow, side then main, nothing clipped by a scroller. Leaving
57
+ the sidebar off the page is the application's print stylesheet. */
58
+ @media print {
59
+ .sidebar-shell {
60
+ display: block;
61
+ block-size: auto;
62
+ }
63
+
64
+ .sidebar-shell > * {
65
+ overflow: visible;
66
+ }
67
+ }