@bigpixelrocket/uiok 0.1.4 → 0.2.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 (146) hide show
  1. package/CHANGELOG.md +88 -1
  2. package/README.md +1 -1
  3. package/dist/activity/ActivityBar.d.ts +21 -8
  4. package/dist/activity/ActivityBar.js +15 -5
  5. package/dist/activity/activity.css +53 -6
  6. package/dist/button/Button.d.ts +10 -6
  7. package/dist/button/Button.js +6 -1
  8. package/dist/button/button.css +201 -33
  9. package/dist/charts/Line.logic.d.ts +6 -0
  10. package/dist/charts/Line.logic.js +9 -0
  11. package/dist/charts/LineChart.js +11 -4
  12. package/dist/charts/Pie.logic.d.ts +89 -1
  13. package/dist/charts/Pie.logic.js +272 -2
  14. package/dist/charts/PieChart.d.ts +2 -1
  15. package/dist/charts/PieChart.js +12 -5
  16. package/dist/charts/PieFill.d.ts +15 -0
  17. package/dist/charts/PieFill.js +33 -0
  18. package/dist/charts/ResultChart.d.ts +2 -2
  19. package/dist/charts/ResultChart.js +173 -47
  20. package/dist/charts/ResultChart.logic.d.ts +60 -4
  21. package/dist/charts/ResultChart.logic.js +105 -6
  22. package/dist/charts/Scatter.logic.d.ts +18 -4
  23. package/dist/charts/Scatter.logic.js +98 -22
  24. package/dist/charts/ScatterChart.js +19 -5
  25. package/dist/charts/charts.css +233 -116
  26. package/dist/charts/seriesColour.d.ts +2 -0
  27. package/dist/charts/seriesColour.js +1 -1
  28. package/dist/datetime/DateTimePicker.d.ts +12 -2
  29. package/dist/datetime/DateTimePicker.js +61 -16
  30. package/dist/datetime/DateTimePicker.logic.d.ts +29 -0
  31. package/dist/datetime/DateTimePicker.logic.js +25 -0
  32. package/dist/datetime/datetime.css +89 -49
  33. package/dist/dialog/ConfirmDialog.d.ts +69 -20
  34. package/dist/dialog/ConfirmDialog.js +39 -12
  35. package/dist/dialog/DialogLayer.d.ts +25 -0
  36. package/dist/dialog/DialogLayer.js +24 -0
  37. package/dist/dialog/DialogLegend.d.ts +2 -1
  38. package/dist/dialog/DialogLegend.js +10 -5
  39. package/dist/dialog/DialogLegend.logic.d.ts +15 -3
  40. package/dist/dialog/DialogLegend.logic.js +8 -4
  41. package/dist/dialog/DialogLists.d.ts +157 -0
  42. package/dist/dialog/DialogLists.js +137 -0
  43. package/dist/dialog/ModalDialog.d.ts +20 -15
  44. package/dist/dialog/ModalDialog.js +22 -7
  45. package/dist/dialog/dialog.css +570 -127
  46. package/dist/dialog/index.d.ts +7 -1
  47. package/dist/dialog/index.js +7 -1
  48. package/dist/field/Check.d.ts +15 -0
  49. package/dist/field/Check.js +23 -0
  50. package/dist/field/field.css +812 -0
  51. package/dist/field/index.d.ts +10 -0
  52. package/dist/field/index.js +10 -0
  53. package/dist/field/labelHelp.d.ts +33 -0
  54. package/dist/field/labelHelp.js +22 -0
  55. package/dist/filter/FilterIcon.js +2 -1
  56. package/dist/filter/filter.css +72 -20
  57. package/dist/grid/DataGrid.d.ts +8 -1
  58. package/dist/grid/DataGrid.js +115 -40
  59. package/dist/grid/DataGrid.logic.d.ts +15 -3
  60. package/dist/grid/DataGrid.logic.js +18 -5
  61. package/dist/grid/grid.css +481 -56
  62. package/dist/icon/Spinner.d.ts +16 -0
  63. package/dist/icon/Spinner.js +13 -0
  64. package/dist/icon/index.d.ts +5 -0
  65. package/dist/icon/index.js +5 -0
  66. package/dist/icon/sizes.d.ts +19 -0
  67. package/dist/icon/sizes.js +19 -0
  68. package/dist/index.d.ts +2 -0
  69. package/dist/index.js +2 -0
  70. package/dist/keychord/KeyChord.d.ts +12 -1
  71. package/dist/keychord/KeyChord.js +2 -2
  72. package/dist/keychord/index.d.ts +1 -1
  73. package/dist/keychord/keychord.css +87 -9
  74. package/dist/labels/dialog.d.ts +12 -1
  75. package/dist/labels/dialog.js +3 -1
  76. package/dist/labels/selectAll.d.ts +4 -4
  77. package/dist/labels/selectAll.js +1 -1
  78. package/dist/legend/KeyLegendStrip.js +1 -1
  79. package/dist/legend/legend.css +82 -57
  80. package/dist/listing/Listing.d.ts +17 -10
  81. package/dist/listing/Listing.js +33 -26
  82. package/dist/listing/listing.css +1665 -237
  83. package/dist/menu/menu.css +227 -67
  84. package/dist/menu/useBellBeat.js +2 -2
  85. package/dist/namecut/NameCut.d.ts +3 -1
  86. package/dist/namecut/NameCut.js +152 -5
  87. package/dist/namecut/NameCut.logic.d.ts +5 -3
  88. package/dist/namecut/NameCut.logic.js +20 -5
  89. package/dist/namecut/namecut.css +27 -7
  90. package/dist/pager/Pager.d.ts +12 -4
  91. package/dist/pager/Pager.js +21 -7
  92. package/dist/pager/pager.css +41 -30
  93. package/dist/palette/Palette.js +2 -1
  94. package/dist/palette/palette.css +121 -60
  95. package/dist/pane/PaneActions.d.ts +56 -14
  96. package/dist/pane/PaneActions.js +64 -16
  97. package/dist/pane/PaneFrame.d.ts +37 -5
  98. package/dist/pane/PaneFrame.js +246 -11
  99. package/dist/pane/index.d.ts +4 -2
  100. package/dist/pane/index.js +4 -2
  101. package/dist/pane/toolWords.d.ts +14 -0
  102. package/dist/pane/toolWords.js +26 -0
  103. package/dist/pane/useToolbarFit.d.ts +25 -0
  104. package/dist/pane/useToolbarFit.js +95 -0
  105. package/dist/run/RunHeader.d.ts +5 -3
  106. package/dist/run/RunHeader.js +11 -8
  107. package/dist/run/run.css +64 -79
  108. package/dist/segmented/SegmentedChoice.d.ts +18 -2
  109. package/dist/segmented/SegmentedChoice.js +18 -7
  110. package/dist/segmented/segmented.css +62 -22
  111. package/dist/selectall/SelectAllBar.d.ts +4 -3
  112. package/dist/selectall/SelectAllBar.js +4 -3
  113. package/dist/selectall/selectall.css +17 -12
  114. package/dist/shell/shell.css +1073 -0
  115. package/dist/styles.css +620 -22
  116. package/dist/surface/surface.css +154 -0
  117. package/dist/tabs/PageTabs.d.ts +10 -5
  118. package/dist/tabs/PageTabs.js +126 -37
  119. package/dist/tabs/tabs.css +131 -51
  120. package/dist/terminal/Terminal.js +3 -1
  121. package/dist/terminal/Terminal.logic.d.ts +5 -4
  122. package/dist/terminal/Terminal.logic.js +9 -4
  123. package/dist/terminal/TerminalMenu.d.ts +4 -1
  124. package/dist/terminal/TerminalMenu.js +12 -5
  125. package/dist/terminal/ghostty/contrast.logic.d.ts +45 -0
  126. package/dist/terminal/ghostty/contrast.logic.js +130 -0
  127. package/dist/terminal/ghostty/core.d.ts +6 -0
  128. package/dist/terminal/ghostty/renderer.d.ts +9 -2
  129. package/dist/terminal/ghostty/renderer.js +91 -14
  130. package/dist/terminal/ghostty/surface.d.ts +8 -0
  131. package/dist/terminal/ghostty/surface.js +27 -1
  132. package/dist/terminal/terminal.css +87 -61
  133. package/dist/text/text.css +16 -7
  134. package/dist/themes/catalog.js +4 -3
  135. package/dist/themes/themes.generated.css +1307 -264
  136. package/dist/themes/tokens.d.ts +69 -14
  137. package/dist/themes/tokens.js +920 -97
  138. package/dist/tokens.css +239 -0
  139. package/dist/tooltip/Tooltip.d.ts +6 -0
  140. package/dist/tooltip/Tooltip.js +48 -6
  141. package/dist/tooltip/Tooltip.logic.d.ts +89 -12
  142. package/dist/tooltip/Tooltip.logic.js +142 -20
  143. package/dist/tooltip/index.d.ts +1 -1
  144. package/dist/tooltip/index.js +1 -1
  145. package/dist/tooltip/tooltip.css +39 -9
  146. package/package.json +3 -3
@@ -0,0 +1,812 @@
1
+ /* ---- Form controls (docs/components/field.md) ----
2
+
3
+ One look for everything a user types in or toggles, drawn on the native
4
+ elements by class so a form keeps its own markup, keyboard, and screen
5
+ reader behaviour:
6
+
7
+ - .field on an input, select, or textarea: a well in the window ground,
8
+ outlined in --control-border, its contents in the code face (what a
9
+ user types is a value). The height follows the place, in every app:
10
+ 28px (.field) in a dialog or a single prompt, 24px (.field-sm) in a
11
+ page form or a toolbar, 20px (.field-xs) inside a row or a path bar.
12
+ - .check on a checkbox or radio: a 14px box (a disc for a radio), filled
13
+ with the accent when on, with the tick, the dash (indeterminate), or
14
+ the dot drawn in --on-accent. A checkbox or radio with no class at all
15
+ takes the same look; one with a class of its own is the host's.
16
+ - .field-box on a container: the field's frame round a leading glyph and
17
+ a bare input (a filter box), with the field's heights, hover, and
18
+ focus edge.
19
+ - .switch on a checkbox with role="switch": a pill track and its knob.
20
+ - .range on an input of type range: a thin trough, its filled part, a knob.
21
+ - .field-label, .field-note, .field-problem: the words around a field,
22
+ in the interface face; .field-group stacks them, .field-choice puts a
23
+ check or switch beside its words, .field-grid lays label and value
24
+ rows on one label column.
25
+
26
+ Every state reads tokens: hover lifts the outline to --text, a step in
27
+ light and dark themes alike; focus draws the 2px accent edge without
28
+ growing (border plus a 1px ring on the edge), round a slider's knob
29
+ rather than its box; aria-invalid="true" outlines in --danger,
30
+ data-tone="warning" in --warning, and data-tone="accent" (a value
31
+ changed from its default) in --accent; a press sinks the control
32
+ and, on a switch, stretches its knob. Disabled fades once, never twice:
33
+ a field or switch by the base rule, a label with its control as one; an
34
+ empty check box on its own is not faded but drawn flat in its outline,
35
+ so a column of disabled boxes still reads. A check or switch that is on
36
+ takes the accent, the one "on" colour of every toggle; a check may take
37
+ data-tone="danger" or "warning" for a choice in that tone, and an
38
+ invalid check (aria-invalid="true") takes the danger tone. The drawn
39
+ marks are borders and gradients, not images, so no content policy
40
+ blocks them. */
41
+
42
+ /* -- Text field, textarea, select, and the field box -- */
43
+
44
+ .field,
45
+ .field-box {
46
+ box-sizing: border-box;
47
+ min-width: 0;
48
+ height: var(--control-height);
49
+ margin: 0;
50
+ padding: 0 var(--space-4);
51
+ border: var(--line) solid var(--control-border);
52
+ border-radius: var(--radius-md);
53
+ /* A well: the field sits a touch below the surface, the opposite of a
54
+ button's lit edge. */
55
+ box-shadow: inset 0 1px 0 var(--well-shade);
56
+ background: var(--ground);
57
+ color: var(--text);
58
+ font: var(--font-weight-regular) var(--font-size-small) / 1 var(--font-mono);
59
+ font-variant-numeric: tabular-nums;
60
+ vertical-align: middle;
61
+ transition:
62
+ border-color var(--duration-fast),
63
+ outline-color var(--duration-fast);
64
+ }
65
+
66
+ /* A field box: the frame holds a leading glyph (an icon of --icon-sm, in
67
+ --text-dim) and a bare input that fills the rest; the frame draws hover
68
+ and focus for it. Before the height classes, so .field-sm and .field-xs
69
+ size it as they size a field. */
70
+ .field-box {
71
+ display: inline-flex;
72
+ align-items: center;
73
+ gap: var(--space-2);
74
+ color: var(--text-dim);
75
+ cursor: text;
76
+ }
77
+
78
+ .field-box > svg {
79
+ flex: none;
80
+ }
81
+
82
+ .field-box > input {
83
+ flex: 1 1 auto;
84
+ box-sizing: border-box;
85
+ min-width: 0;
86
+ height: 100%;
87
+ margin: 0;
88
+ padding: 0;
89
+ border: 0;
90
+ outline: none;
91
+ background: transparent;
92
+ color: var(--text);
93
+ font: inherit;
94
+ }
95
+
96
+ .field-sm {
97
+ height: var(--control-height-sm);
98
+ }
99
+
100
+ /* Inline: inside a 24 to 26 px row or bar, so corners follow the smaller
101
+ height and the inset tightens to the inline icon-to-label step. */
102
+ .field-xs {
103
+ height: var(--control-height-xs);
104
+ padding: 0 var(--space-3);
105
+ border-radius: var(--radius-sm);
106
+ }
107
+
108
+ .field:hover:not(
109
+ :disabled,
110
+ :focus-visible,
111
+ [aria-invalid='true'],
112
+ [data-tone],
113
+ :read-only:not(select)
114
+ ),
115
+ .field-box:hover:not(:has(:disabled), :focus-within, [aria-invalid='true']) {
116
+ border-color: var(--text);
117
+ }
118
+
119
+ /* The field's focus edge, over the base ring: 2px of accent on the field's
120
+ own edge, so focusing it moves nothing beside it. */
121
+ .field:focus-visible,
122
+ .field-box:has(> input:focus-visible) {
123
+ border-color: var(--accent);
124
+ outline: var(--line) solid var(--accent);
125
+ outline-offset: var(--focus-offset-flush);
126
+ }
127
+
128
+ .field[aria-invalid='true'],
129
+ .field-box[aria-invalid='true'] {
130
+ border-color: var(--danger);
131
+ }
132
+
133
+ .field[aria-invalid='true']:focus-visible {
134
+ outline-color: var(--danger);
135
+ }
136
+
137
+ /* A toned field is told from a plain one by more than the hue of its 1px
138
+ outline, which some light themes leave a shade from the plain outline:
139
+ a 2px bar in the tone inside the field's leading edge goes with it. The
140
+ well's top shade stays. Logical, so a right-to-left field bars its
141
+ right. */
142
+
143
+ /* A value that works but needs a second look (overridden, out of date):
144
+ the outline in the warning tone, and the bar. Invalid wins over it. */
145
+ .field[data-tone='warning']:not([aria-invalid='true']) {
146
+ border-color: var(--warning);
147
+ box-shadow:
148
+ inset var(--field-tone-bar) 0 0 0 var(--warning),
149
+ inset 0 1px 0 var(--well-shade);
150
+ }
151
+
152
+ .field[data-tone='warning']:not([aria-invalid='true']):focus-visible {
153
+ outline-color: var(--warning);
154
+ }
155
+
156
+ /* A value changed from its default (an override): a 1px outline in the
157
+ accent, floored at 3:1 on every ground a field sits on, so the marked
158
+ field is never fainter than a plain one; it stays apart from the focus
159
+ edge by weight (focus is the border plus a 1px ring). */
160
+ .field[data-tone='accent']:not([aria-invalid='true']) {
161
+ border-color: var(--accent);
162
+ box-shadow:
163
+ inset var(--field-tone-bar) 0 0 0 var(--accent),
164
+ inset 0 1px 0 var(--well-shade);
165
+ }
166
+
167
+ .field[data-tone] {
168
+ --field-tone-bar: var(--line-strong);
169
+ }
170
+
171
+ /* Right to left the bar stands on the right, the leading edge. The rule
172
+ reads the dir attribute, as the listing's do: bundlers' CSS minifiers
173
+ rewrite the direction pseudo-class into a list of languages. */
174
+ .field[data-tone]:where([dir='rtl'] *, [dir='rtl']) {
175
+ --field-tone-bar: calc(-1 * var(--line-strong));
176
+ }
177
+
178
+ /* Read-only: the value is there to copy, not to change; the well loses its
179
+ depth and sits on the surface it is drawn on, and its outline drops to
180
+ the divider grade (a value, not a control), which hover does not lift. */
181
+ .field:read-only:not(select, :disabled) {
182
+ border-color: var(--border-strong);
183
+ box-shadow: none;
184
+ background: transparent;
185
+ }
186
+
187
+ textarea.field {
188
+ height: auto;
189
+ min-height: calc(var(--control-height) * 2);
190
+ padding: var(--space-2) var(--space-4);
191
+ line-height: var(--line-height-prose);
192
+ /* A text view has no corner grip: its pane or dialog sizes it. */
193
+ resize: none;
194
+ }
195
+
196
+ /* A list box (multiple, or a size) is as tall as the rows it shows, not one
197
+ field. At the class's own weight, so a host's height still wins. */
198
+ .field:where(select:is([multiple], [size]:not([size='1']))) {
199
+ height: auto;
200
+ padding-block: var(--space-1);
201
+ }
202
+
203
+ /* A number field carries a stepper at its end, as a desktop number field
204
+ does: a cap of its own, divided from the value by a --control-border
205
+ hairline the field's full height, with an up arrow centred in its top
206
+ half and a down arrow in its bottom half (in --text-dim), so the end
207
+ reads as two buttons and not as a pop-up's chevron pair. The platform's
208
+ spin buttons fill the cap and stay the hit area (the top half steps up,
209
+ the bottom half down) but draw nothing, since their platform drawing is
210
+ the one part the theme cannot reach. The keyboard's arrows step as
211
+ before. Each arrow is two 4px squares, each half filled by a diagonal
212
+ gradient, as the pop-up's chevrons are. */
213
+ input.field[type='number'] {
214
+ /* A 16px cap; its 8px arrows sit 4px in from each side. */
215
+ --field-stepper-width: var(--space-8);
216
+ --field-chevron-end: var(--space-2);
217
+
218
+ padding-inline-end: 0;
219
+ background-image:
220
+ linear-gradient(135deg, transparent 50%, var(--text-dim) 50%),
221
+ linear-gradient(-135deg, transparent 50%, var(--text-dim) 50%),
222
+ linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
223
+ linear-gradient(-45deg, transparent 50%, var(--text-dim) 50%),
224
+ linear-gradient(var(--control-border), var(--control-border));
225
+ background-position:
226
+ right calc(var(--field-chevron-end) + 4px) top 25%,
227
+ right var(--field-chevron-end) top 25%,
228
+ right calc(var(--field-chevron-end) + 4px) top 75%,
229
+ right var(--field-chevron-end) top 75%,
230
+ right var(--field-stepper-width) top 0;
231
+ background-repeat: no-repeat;
232
+ background-size:
233
+ 4px 4px,
234
+ 4px 4px,
235
+ 4px 4px,
236
+ 4px 4px,
237
+ var(--line) 100%;
238
+ }
239
+
240
+ input.field[type='number']::-webkit-inner-spin-button {
241
+ width: var(--field-stepper-width);
242
+ height: 100%;
243
+ margin: 0 0 0 var(--space-3);
244
+ opacity: 0;
245
+ }
246
+
247
+ input.field[type='number']::-webkit-outer-spin-button {
248
+ margin: 0;
249
+ appearance: none;
250
+ }
251
+
252
+ /* A pop-up menu: the platform's arrow is replaced by the up and down
253
+ chevron pair a desktop pop-up button shows, two 8 by 4 triangles in
254
+ --text-dim with 2px between them, at the end of the field, with no
255
+ divider (a number field's stepper has one, above). Each triangle is two
256
+ 4px squares, each half filled by a diagonal gradient. A list box
257
+ (multiple, or a size) shows its rows, so it takes no chevrons. */
258
+ select.field:not([multiple], [size]) {
259
+ --field-chevron-end: var(--space-4);
260
+
261
+ padding-inline-end: calc(var(--field-chevron-end) + var(--space-6));
262
+ appearance: none;
263
+ background-image:
264
+ linear-gradient(135deg, transparent 50%, var(--text-dim) 50%),
265
+ linear-gradient(-135deg, transparent 50%, var(--text-dim) 50%),
266
+ linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
267
+ linear-gradient(-45deg, transparent 50%, var(--text-dim) 50%);
268
+ background-position:
269
+ right calc(var(--field-chevron-end) + 4px) bottom calc(50% + 3px),
270
+ right var(--field-chevron-end) bottom calc(50% + 3px),
271
+ right calc(var(--field-chevron-end) + 4px) top calc(50% + 3px),
272
+ right var(--field-chevron-end) top calc(50% + 3px);
273
+ background-repeat: no-repeat;
274
+ background-size: 4px 4px;
275
+ cursor: default;
276
+ }
277
+
278
+ select.field-xs:not([multiple], [size]) {
279
+ --field-chevron-end: var(--space-3);
280
+ }
281
+
282
+ /* The menu's own rows are drawn by the platform; give them the theme's
283
+ ground and text where the platform lets a page. */
284
+ select.field option {
285
+ background: var(--surface);
286
+ color: var(--text);
287
+ }
288
+
289
+ /* -- Checkbox and radio -- */
290
+
291
+ /* The on fill and the mark drawn on it: the accent, or a tone's. A mixed
292
+ state belongs to a checkbox only: a radio of a group with nothing chosen
293
+ also matches :indeterminate, and must stay empty. */
294
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))) {
295
+ --check-on: var(--accent);
296
+ --check-on-pressed: var(--accent-pressed);
297
+ --check-mark: var(--on-accent);
298
+
299
+ /* 14px: the box sits on a 13px label's x-height the way an icon of
300
+ --icon-md does. */
301
+ display: inline-grid;
302
+ flex: none;
303
+ place-content: center;
304
+ box-sizing: border-box;
305
+ width: var(--icon-md);
306
+ height: var(--icon-md);
307
+ margin: 0;
308
+ /* A row on a tinted ground (hovered, cursor, marked) sets --check-edge
309
+ to --control-border-strong on itself; the box inherits it. */
310
+ border: var(--line) solid var(--check-edge, var(--control-border));
311
+ border-radius: var(--radius-xs);
312
+ box-shadow: inset 0 1px 0 var(--well-shade);
313
+ background: var(--ground);
314
+ vertical-align: middle;
315
+ cursor: default;
316
+ appearance: none;
317
+ transition:
318
+ background-color var(--duration-fast),
319
+ border-color var(--duration-fast),
320
+ box-shadow var(--duration-fast);
321
+ }
322
+
323
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class])))[type='radio'] {
324
+ border-radius: var(--radius-pill);
325
+ }
326
+
327
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):hover:not(:disabled) {
328
+ border-color: var(--text);
329
+ }
330
+
331
+ /* A press on an empty box sinks it; a filled box keeps its fill (below). */
332
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):active:not(
333
+ :disabled,
334
+ :checked,
335
+ [type='checkbox']:indeterminate
336
+ ) {
337
+ background-color: var(--pressed-wash);
338
+ }
339
+
340
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):is(
341
+ :checked,
342
+ [type='checkbox']:indeterminate
343
+ ) {
344
+ border-color: var(--check-on);
345
+ box-shadow: none;
346
+ background: var(--check-on);
347
+ }
348
+
349
+ /* On, the fill takes the lit edge a filled button takes on hover; held,
350
+ it takes the tone's pressed fill, a step of at least 1.12:1 from the
351
+ rest fill that the token rules derive as a button's press is (darker in
352
+ light themes, lighter on near-black grounds). On a 14px box an inset
353
+ shadow would cover most of the face and cancel a lighter step, so the
354
+ fill alone says "held". The edge keeps the rest fill, which holds 3:1
355
+ on every ground where a held fill may not. */
356
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):is(
357
+ :checked,
358
+ [type='checkbox']:indeterminate
359
+ ):hover:not(:disabled) {
360
+ border-color: var(--check-on);
361
+ box-shadow: var(--hover-lit);
362
+ }
363
+
364
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):is(
365
+ :checked,
366
+ [type='checkbox']:indeterminate
367
+ ):active:not(:disabled) {
368
+ box-shadow: none;
369
+ background-color: var(--check-on-pressed);
370
+ }
371
+
372
+ /* Tones: a choice whose effect is destructive (danger) or needs a second
373
+ look (warning) outlines in the tone when off and fills in it when on. An
374
+ invalid choice takes the danger tone whether it is off or on, so a box
375
+ that is on still says it is wrong; invalid wins over a warning tone. */
376
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class])))[data-tone='warning'] {
377
+ --check-on: var(--warning);
378
+ --check-on-pressed: var(--warning-pressed);
379
+ --check-mark: var(--on-warning);
380
+ }
381
+
382
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):is(
383
+ [data-tone='danger'],
384
+ [aria-invalid='true']
385
+ ) {
386
+ --check-on: var(--danger);
387
+ --check-on-pressed: var(--danger-pressed);
388
+ --check-mark: var(--on-danger);
389
+ }
390
+
391
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):is(
392
+ [data-tone],
393
+ [aria-invalid='true']
394
+ ):not(:checked, [type='checkbox']:indeterminate) {
395
+ border-color: var(--check-on);
396
+ }
397
+
398
+ /* In a window that is not in front a box that is on greys, as the
399
+ platform's does: the fill in the neutral edge tone a quiet row's marks
400
+ take (--control-border-strong), the mark cut out in the ground; a row
401
+ that draws itself quiet cuts it in its own fill. A switch that is on
402
+ greys the same way. A toned or invalid box keeps its tone, since it
403
+ reports a state rather than a selection. */
404
+ :where(:root[data-window-inactive])
405
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):not(
406
+ [data-tone],
407
+ [aria-invalid='true']
408
+ ) {
409
+ --check-on: var(--control-border-strong);
410
+ --check-on-pressed: var(--control-border-strong);
411
+ --check-mark: var(--ground);
412
+ }
413
+
414
+ /* Disabled, one fade and never two. The base rule leaves a check box out:
415
+ an empty box on its own keeps its full --control-border outline (3:1)
416
+ and flattens its well to the track, so a column of boxes that cannot be
417
+ ticked still reads as boxes, flat ones; a box that is on fades its fill
418
+ and mark once. In a disabled label the label fades with the box in it,
419
+ so the box there fades no further and an empty one outlines in --text,
420
+ which the fade brings down to about the outline's usual strength. */
421
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):disabled {
422
+ cursor: default;
423
+ }
424
+
425
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):disabled:not(
426
+ :checked,
427
+ [type='checkbox']:indeterminate
428
+ ) {
429
+ border-color: var(--control-border);
430
+ box-shadow: none;
431
+ background: var(--control-track);
432
+ }
433
+
434
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):disabled:is(
435
+ :checked,
436
+ [type='checkbox']:indeterminate
437
+ ):not(:where(label:is([data-disabled], :has(> :is(input, select, textarea):disabled))) *) {
438
+ opacity: var(--disabled-opacity);
439
+ }
440
+
441
+ :where(label:is([data-disabled], :has(> :is(input, select, textarea):disabled)))
442
+ :is(.check, :where(input:is([type='checkbox'], [type='radio']):not([class]))):disabled:not(
443
+ :checked,
444
+ [type='checkbox']:indeterminate
445
+ ) {
446
+ border-color: var(--text);
447
+ }
448
+
449
+ /* The tick: two sides of a 4 by 8 box, turned, so its strokes are 2px
450
+ lines like the rest of the interface's marks. */
451
+ :is(
452
+ .check,
453
+ :where(input:is([type='checkbox'], [type='radio']):not([class]))
454
+ )[type='checkbox']:checked::before {
455
+ box-sizing: border-box;
456
+ width: 5px;
457
+ height: 9px;
458
+ margin-top: calc(-1 * var(--space-1));
459
+ border: solid var(--check-mark);
460
+ border-width: 0 var(--line-strong) var(--line-strong) 0;
461
+ transform: rotate(45deg);
462
+ content: '';
463
+ }
464
+
465
+ /* Some but not all: the dash wins over the tick, as the platform draws it. */
466
+ :is(
467
+ .check,
468
+ :where(input:is([type='checkbox'], [type='radio']):not([class]))
469
+ )[type='checkbox']:indeterminate::before {
470
+ width: 8px;
471
+ height: var(--line-strong);
472
+ margin-top: 0;
473
+ border: 0;
474
+ background: var(--check-mark);
475
+ transform: none;
476
+ content: '';
477
+ }
478
+
479
+ :is(
480
+ .check,
481
+ :where(input:is([type='checkbox'], [type='radio']):not([class]))
482
+ )[type='radio']:checked::before {
483
+ width: 6px;
484
+ height: 6px;
485
+ border-radius: var(--radius-pill);
486
+ background: var(--check-mark);
487
+ content: '';
488
+ }
489
+
490
+ /* -- Switch -- */
491
+
492
+ /* A checkbox drawn as a track with a knob, for one case only: a running
493
+ thing turned on or off at once (a service, a sharing). A setting a form
494
+ writes is a check box (.check). The input itself, so it keeps the
495
+ checkbox's keyboard and screen reader behaviour and fades as a whole
496
+ under the disabled rule. The track is as tall as a check box
497
+ (--icon-md), so a switch and a check share a line. Off: the knob at the
498
+ start on the control outline's track; on: at the end on the accent, the
499
+ same "on" colour a checked box takes. The knob moves at once; only the
500
+ colours change at the feedback step. */
501
+ .switch {
502
+ position: relative;
503
+ flex: none;
504
+ box-sizing: border-box;
505
+ width: 24px;
506
+ height: var(--icon-md);
507
+ margin: 0;
508
+ border: 0;
509
+ border-radius: var(--radius-pill);
510
+ /* On a tinted row the off track takes the row's stronger edge, as a
511
+ check box's outline does (--check-edge). */
512
+ background: var(--check-edge, var(--control-border));
513
+ vertical-align: middle;
514
+ cursor: default;
515
+ appearance: none;
516
+ transition:
517
+ background-color var(--duration-fast),
518
+ box-shadow var(--duration-fast);
519
+ }
520
+
521
+ .switch::before {
522
+ position: absolute;
523
+ top: var(--space-1);
524
+ left: var(--space-1);
525
+ width: 10px;
526
+ height: 10px;
527
+ border-radius: var(--radius-pill);
528
+ box-shadow: var(--shadow-raised);
529
+ background: var(--surface);
530
+ transition: background-color var(--duration-fast);
531
+ content: '';
532
+ }
533
+
534
+ .switch:checked {
535
+ background: var(--accent);
536
+ }
537
+
538
+ .switch:checked::before {
539
+ background: var(--on-accent);
540
+ transform: translateX(10px);
541
+ }
542
+
543
+ /* In a window that is not in front an on switch goes quiet, as a checked box
544
+ does. After the on rules above, which weigh the same. */
545
+ :where(:root[data-window-inactive]) .switch:checked {
546
+ background: var(--control-border-strong);
547
+ }
548
+
549
+ :where(:root[data-window-inactive]) .switch:checked::before {
550
+ background: var(--ground);
551
+ }
552
+
553
+ .switch:hover:not(:disabled) {
554
+ box-shadow: var(--hover-lit);
555
+ }
556
+
557
+ /* A press sinks the track inside the shared hairline, so a held switch
558
+ reads apart from a hovered one; the knob stays where it is. */
559
+ .switch:active:not(:disabled) {
560
+ box-shadow: var(--press-frost);
561
+ }
562
+
563
+ /* -- Range -- */
564
+
565
+ /* A slider (seek, volume): a 4px trough on --control-track inside a
566
+ --control-border hairline (the trough every track in the library uses),
567
+ the part up to the value in the accent, and a 12px knob on the surface. The
568
+ platform fills no part of the track by itself, so the host sets
569
+ --range-fill to the value's share (style="--range-fill: 40%"); without
570
+ it the whole trough is plain. */
571
+ .range {
572
+ --range-fill: 0%;
573
+
574
+ flex: none;
575
+ height: var(--control-height-sm);
576
+ margin: 0;
577
+ background: transparent;
578
+ vertical-align: middle;
579
+ cursor: default;
580
+ appearance: none;
581
+ }
582
+
583
+ .range::-webkit-slider-runnable-track {
584
+ height: 4px;
585
+ border-radius: var(--radius-pill);
586
+ box-shadow: inset 0 0 0 var(--line) var(--control-border);
587
+ background:
588
+ linear-gradient(var(--accent), var(--accent)) 0 0 / var(--range-fill) 100% no-repeat,
589
+ var(--control-track);
590
+ }
591
+
592
+ .range::-webkit-slider-thumb {
593
+ box-sizing: border-box;
594
+ width: 12px;
595
+ height: 12px;
596
+ margin-top: calc(-1 * var(--space-2));
597
+ border: var(--line) solid var(--control-border);
598
+ border-radius: var(--radius-pill);
599
+ box-shadow: var(--shadow-raised);
600
+ background: var(--surface);
601
+ appearance: none;
602
+ transition:
603
+ border-color var(--duration-fast),
604
+ background-color var(--duration-fast),
605
+ box-shadow var(--duration-fast);
606
+ }
607
+
608
+ /* Hover lifts the knob's outline a step; a press takes it to full text. */
609
+ .range:hover:not(:disabled)::-webkit-slider-thumb {
610
+ border-color: var(--text-dim);
611
+ }
612
+
613
+ /* Held, the knob sinks on the pressed wash inside the shared hairline. */
614
+ .range:active:not(:disabled)::-webkit-slider-thumb {
615
+ border-color: var(--text);
616
+ box-shadow: var(--shadow-pressed);
617
+ background: linear-gradient(var(--pressed-wash), var(--pressed-wash)), var(--surface);
618
+ }
619
+
620
+ /* The focus ring rings the knob, as a desktop slider's does, not the
621
+ input's square box. */
622
+ .range:focus-visible {
623
+ outline: none;
624
+ }
625
+
626
+ .range:focus-visible::-webkit-slider-thumb {
627
+ outline: var(--focus-ring-width) solid var(--accent);
628
+ outline-offset: var(--focus-offset);
629
+ }
630
+
631
+ /* -- The words around a field -- */
632
+
633
+ /* What the field is for: the interface face, dim, on the compact line. */
634
+ .field-label {
635
+ display: block;
636
+ margin: 0;
637
+ color: var(--text-dim);
638
+ font: var(--font-weight-regular) var(--font-size-small) / var(--line-height-compact)
639
+ var(--font-ui);
640
+ overflow-wrap: anywhere;
641
+ }
642
+
643
+ /* A label that holds help (labelHelp's data-label-help) shows a cue: the
644
+ dashed underline every word that holds a tooltip wears, in a faint tone,
645
+ so a label with help reads apart from one without. The help opens above
646
+ the label, never over the control it explains. */
647
+ [data-label-help] {
648
+ text-decoration: underline dashed var(--text-faint);
649
+ text-decoration-thickness: var(--line);
650
+ text-underline-offset: var(--space-1);
651
+ }
652
+
653
+ /* A line under a control that says what the current choice does ("Worn
654
+ while the system is light."), so it changes with the choice. Help that
655
+ explains the control itself is its label's tooltip (labelHelp), not a
656
+ sentence under the field. */
657
+ .field-note {
658
+ margin: 0;
659
+ color: var(--text-dim);
660
+ font: var(--font-weight-regular) var(--font-size-small) / var(--line-height-compact)
661
+ var(--font-ui);
662
+ overflow-wrap: anywhere;
663
+ }
664
+
665
+ /* What is wrong with the value, as a status line under its field: the
666
+ danger glyph (surface.css) hung before the first line, the words in
667
+ --text, so it reads as the application's message, not a red web form
668
+ error. Pair it with aria-invalid="true" on the field and
669
+ aria-describedby naming it. */
670
+ .field-problem {
671
+ position: relative;
672
+ margin: 0;
673
+ padding-inline-start: calc(var(--icon-md) + var(--space-3));
674
+ color: var(--text);
675
+ font: var(--font-weight-regular) var(--font-size-small) / var(--line-height-compact)
676
+ var(--font-ui);
677
+ overflow-wrap: anywhere;
678
+ }
679
+
680
+ /* A problem's words are a message a user copies into a report. */
681
+ .field-problem {
682
+ -webkit-user-select: text;
683
+ user-select: text;
684
+ }
685
+
686
+ .field-problem:not(:has(> svg:first-child))::before {
687
+ position: absolute;
688
+ inset-block-start: calc((var(--line-height-compact) - var(--icon-md)) / 2);
689
+ inset-inline-start: 0;
690
+ }
691
+
692
+ /* A group of choices under its legend, on a fieldset: the legend, then
693
+ the choices and any note, 4px apart. A field with its label is a row of
694
+ the label column (.field-grid), never a label stacked over a field. */
695
+ .field-group {
696
+ display: grid;
697
+ gap: var(--space-2);
698
+ min-width: 0;
699
+ margin: 0;
700
+ padding: 0;
701
+ border: 0;
702
+ }
703
+
704
+ .field-group > legend {
705
+ float: left;
706
+ width: 100%;
707
+ margin: 0 0 var(--space-2);
708
+ padding: 0;
709
+ color: var(--text-dim);
710
+ font: var(--font-weight-regular) var(--font-size-small) / var(--line-height-compact)
711
+ var(--font-ui);
712
+ }
713
+
714
+ /* A check, radio, or switch with its words beside it; the whole label is
715
+ the target. The words wrap rather than run out of the column. */
716
+ .field-choice {
717
+ display: inline-flex;
718
+ align-items: center;
719
+ /* In running text the choice centres on the line rather than hanging
720
+ from its box's baseline, which moves as a tick, dash, or dot is drawn. */
721
+ vertical-align: middle;
722
+ gap: var(--space-3);
723
+ min-width: 0;
724
+ min-height: var(--control-height-sm);
725
+ color: var(--text);
726
+ font: var(--font-weight-regular) var(--font-size-small) / var(--line-height-compact)
727
+ var(--font-ui);
728
+ cursor: default;
729
+ }
730
+
731
+ /* Rows of a form or a settings page on one label column: the label, then
732
+ its value (a field, choices, a note). As a desktop form sizes it, the
733
+ column is as wide as the longest label and the rest goes to the
734
+ controls, capped at 40% of the form so one long label cannot starve
735
+ the fields; a label past the cap wraps on the compact line. Each
736
+ label's first line is centred on a 24px control. A host sets
737
+ --field-label-width for a column of its own (a fixed width every page
738
+ of a Settings window shares). */
739
+ .field-grid {
740
+ display: grid;
741
+ grid-template-columns: var(--field-label-width, fit-content(40%)) minmax(0, 1fr);
742
+ align-items: start;
743
+ gap: var(--space-4) var(--space-6);
744
+ margin: 0;
745
+ }
746
+
747
+ .field-grid > .field-label {
748
+ padding-block: var(--space-2);
749
+ }
750
+
751
+ /* A label centres its first line on the control beside it wherever the
752
+ label column stands (a dialog, a settings page, a page form). The grid
753
+ pads a label for a 24px control; beside a 28px field (.field), or a 20px
754
+ one (.field-xs), the padding follows the height of the field that leads
755
+ the row: the label's next sibling, or the first child of its
756
+ .field-value. Rows of 24px controls, checks, and notes keep the grid's
757
+ own padding. */
758
+ .field-grid
759
+ > .field-label:has(
760
+ + :is(.field, .field-box):not(.field-sm, .field-xs),
761
+ + .field-value > :is(.field, .field-box):first-child:not(.field-sm, .field-xs)
762
+ ) {
763
+ padding-block: calc((var(--control-height) - var(--line-height-compact)) / 2);
764
+ }
765
+
766
+ .field-grid > .field-label:has(+ .field-xs, + .field-value > .field-xs:first-child) {
767
+ padding-block: calc((var(--control-height-xs) - var(--line-height-compact)) / 2);
768
+ }
769
+
770
+ /* A value of several lines: options, then the note under them. */
771
+ .field-value {
772
+ display: grid;
773
+ gap: var(--space-2);
774
+ min-width: 0;
775
+ }
776
+
777
+ /* A pop-up button is as wide as its longest item, as a desktop pop-up is,
778
+ not stretched across the value column; it starts at the column's edge
779
+ and is cut by the column only when its items are wider. A text field
780
+ keeps the column's width, as a desktop form's does. */
781
+ .field-value > select.field:not([multiple], [size]) {
782
+ justify-self: start;
783
+ width: auto;
784
+ max-width: 100%;
785
+ }
786
+
787
+ /* A field for a short value (a port, a count, a code) is a few characters
788
+ wide, as a desktop form sizes a field to what it holds, wherever it
789
+ stands: in a label column, a dialog's form grid, or a line of options.
790
+ Room for eight characters of the field's own code face. */
791
+ .field.field-short {
792
+ flex: none;
793
+ justify-self: start;
794
+ width: calc(8ch + 2 * var(--space-4) + 2 * var(--line));
795
+ max-width: 100%;
796
+ }
797
+
798
+ /* One line of a value: a choice, a field, a status, with anything trailing
799
+ (a key chord) pushed to the line's end. */
800
+ .field-option {
801
+ display: flex;
802
+ flex-wrap: wrap;
803
+ align-items: center;
804
+ gap: var(--space-3) var(--space-5);
805
+ min-width: 0;
806
+ min-height: var(--control-height-sm);
807
+ }
808
+
809
+ /* A note that is the whole value starts on the label's line. */
810
+ .field-grid > .field-note {
811
+ padding-block-start: var(--space-2);
812
+ }