@prunellejs/ui 0.1.1 → 0.7.2

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/LICENSE +21 -0
  2. package/llms.txt +19 -11
  3. package/package.json +2 -2
  4. package/src/CommandPalette.tsx +130 -75
  5. package/src/DataTable.tsx +137 -58
  6. package/src/Dialog.tsx +30 -14
  7. package/src/Menu.tsx +10 -8
  8. package/src/Select.tsx +19 -8
  9. package/src/Tabs.tsx +2 -1
  10. package/src/Toaster.tsx +79 -5
  11. package/src/behaviors.ts +104 -6
  12. package/src/fold.ts +7 -0
  13. package/src/index.ts +1 -1
  14. package/src/labels/dialog.ts +3 -0
  15. package/src/labels/fr/dialog.ts +3 -0
  16. package/src/labels/fr/palette.ts +8 -0
  17. package/src/labels/fr/select.ts +1 -0
  18. package/src/labels/fr/table.ts +13 -0
  19. package/src/labels/fr/toaster.ts +1 -0
  20. package/src/labels/palette.ts +8 -0
  21. package/src/labels/select.ts +1 -0
  22. package/src/labels/table.ts +13 -0
  23. package/src/labels/toaster.ts +1 -0
  24. package/src/plugin.ts +114 -31
  25. package/src/primitives.tsx +3 -2
  26. package/src/static.tsx +11 -6
  27. package/src/styles/bare.css +22 -312
  28. package/src/styles/base.css +61 -0
  29. package/src/styles/components/accordion.css +10 -0
  30. package/src/styles/components/badge.css +6 -0
  31. package/src/styles/components/button.css +11 -0
  32. package/src/styles/components/card.css +5 -0
  33. package/src/styles/components/checkbox.css +11 -0
  34. package/src/styles/components/command.css +25 -0
  35. package/src/styles/components/consent.css +38 -0
  36. package/src/styles/components/datatable.css +9 -0
  37. package/src/styles/components/dialog.css +16 -0
  38. package/src/styles/components/drawer.css +29 -0
  39. package/src/styles/components/field.css +8 -0
  40. package/src/styles/components/layout.css +69 -0
  41. package/src/styles/components/menu.css +21 -0
  42. package/src/styles/components/notice.css +5 -0
  43. package/src/styles/components/popover.css +8 -0
  44. package/src/styles/components/progress.css +14 -0
  45. package/src/styles/components/radio-group.css +11 -0
  46. package/src/styles/components/select.css +25 -0
  47. package/src/styles/components/switch.css +42 -0
  48. package/src/styles/components/tabs.css +4 -0
  49. package/src/styles/components/toast.css +28 -0
  50. package/src/styles/grammars/console.css +114 -256
  51. package/src/styles/grammars/editorial.css +101 -271
  52. package/src/styles/grammars/orbit.css +121 -390
  53. package/src/styles/grammars/prunelle.css +209 -357
  54. package/src/styles/grammars/soft.css +106 -240
  55. package/src/styles/grammars/workshop.css +110 -251
  56. package/src/styles/scan.ts +144 -0
  57. package/src/styles/split.ts +429 -0
  58. package/src/styles/theme.css +22 -0
  59. package/src/styles/themed/accordion.css +20 -0
  60. package/src/styles/themed/badge.css +20 -0
  61. package/src/styles/themed/button.css +24 -0
  62. package/src/styles/themed/card.css +23 -0
  63. package/src/styles/themed/checkbox.css +4 -0
  64. package/src/styles/themed/command.css +33 -0
  65. package/src/styles/themed/consent.css +33 -0
  66. package/src/styles/themed/datatable.css +28 -0
  67. package/src/styles/themed/dialog.css +13 -0
  68. package/src/styles/themed/drawer.css +13 -0
  69. package/src/styles/themed/field.css +22 -0
  70. package/src/styles/themed/menu.css +21 -0
  71. package/src/styles/themed/notice.css +17 -0
  72. package/src/styles/themed/popover.css +11 -0
  73. package/src/styles/themed/radio-group.css +12 -0
  74. package/src/styles/themed/select.css +32 -0
  75. package/src/styles/themed/switch.css +23 -0
  76. package/src/styles/themed/tabs.css +20 -0
  77. package/src/styles/themed/toast.css +18 -0
  78. package/src/table-state.ts +53 -16
  79. package/src/toast.ts +50 -8
@@ -3,9 +3,11 @@
3
3
  * The eye is the only ornament: a radio is an eye, shut until checked; a switch's knob opens its eye when on; Progress looks left and right while it waits, and its pupil widens until it fills the eye.
4
4
  * Eject via `prunelle ui-eject prunelle`. */
5
5
 
6
- @import '../bare.css';
6
+ @import '../theme.css';
7
7
 
8
+ /* @part: progress */
8
9
  @property --ui-progress { syntax: '<number>'; inherits: true; initial-value: 0; }
10
+ /* @part: radio-group, switch */
9
11
  @property --ui-lid-ink { syntax: '<color>'; inherits: true; initial-value: transparent; }
10
12
 
11
13
  @layer kui {
@@ -38,50 +40,34 @@
38
40
  --ui-motion: 180ms;
39
41
  }
40
42
 
41
- html {
42
- background-color: var(--ui-paper);
43
- }
44
-
45
- body {
46
- background-color: var(--ui-paper);
47
- color: var(--ui-ink);
48
- font-family: var(--ui-font-body);
49
- }
43
+ html { background-color: var(--ui-paper); }
44
+ body { background-color: var(--ui-paper); color: var(--ui-ink); font-family: var(--ui-font-body); }
50
45
 
51
46
  [data-ui="button"] {
52
- display: inline-flex;
53
- align-items: center;
54
- justify-content: center;
55
- gap: 0.45rem;
56
- min-block-size: 34px;
57
- padding: 0 14px;
58
- font: 500 0.8125rem/1 var(--ui-font-body);
47
+ --ui-btn-gap: 0.45rem;
48
+ --ui-btn-h: 34px;
49
+ --ui-btn-pad: 0 14px;
50
+ --ui-btn-f: 500 0.8125rem/1 var(--ui-font-body);
51
+ --ui-btn-bd: 0;
52
+ --ui-btn-sm-h: 28px;
53
+ --ui-btn-sm-pad: 0 10px;
54
+ --ui-btn-sm-fs: 0.75rem;
55
+ --ui-btn-lg-h: 42px;
56
+ --ui-btn-lg-pad: 0 20px;
57
+ --ui-btn-lg-fs: 0.9375rem;
58
+ min-inline-size: var(--ui-touch-min, auto);
59
59
  white-space: nowrap;
60
- border: 0;
61
- border-radius: var(--ui-radius);
62
- background: var(--ui-surface);
63
60
  box-shadow: inset 0 0 0 1px var(--ui-line-strong);
64
- color: var(--ui-ink);
65
- text-decoration: none;
66
- cursor: pointer;
67
- transition: box-shadow var(--ui-motion), background-color var(--ui-motion), color var(--ui-motion);
68
-
69
61
  &:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--ui-ink); }
70
- &:disabled { opacity: 0.45; cursor: not-allowed; }
71
- &[data-variant="outline"] { background: transparent; }
72
62
  &[data-variant="ghost"] {
73
- background: transparent;
74
- box-shadow: none;
75
63
  padding-inline: 2px;
76
64
  text-decoration: underline 1px var(--ui-accent);
77
65
  text-underline-offset: 5px;
78
66
  &:hover:not(:disabled) { box-shadow: none; text-decoration-thickness: 2px; }
79
67
  }
80
68
  &[data-tone="accent"] {
81
- background: var(--ui-accent-fill);
82
69
  box-shadow: none;
83
70
  color: var(--ui-on-primary);
84
- text-decoration: none;
85
71
  &:hover:not(:disabled) { box-shadow: none; background: color-mix(in srgb, var(--ui-accent-fill) 86%, var(--ui-paper)); }
86
72
  }
87
73
  &[data-tone="danger"] {
@@ -90,104 +76,56 @@
90
76
  color: var(--ui-danger);
91
77
  &:hover:not(:disabled) { background: var(--ui-danger); box-shadow: none; color: var(--ui-on-accent); }
92
78
  }
93
- &[data-size="sm"] { min-block-size: 28px; padding: 0 10px; font-size: 0.75rem; }
94
- &[data-size="lg"] { min-block-size: 42px; padding: 0 20px; font-size: 0.9375rem; }
95
- &[data-variant="ghost"][data-size] { padding-inline: 2px; }
96
79
  }
97
80
 
98
81
  [data-ui="card"] {
99
- border: 1px solid var(--ui-line);
100
- border-radius: var(--ui-radius);
101
- background: var(--ui-surface);
102
- color: var(--ui-ink);
103
- padding: 1.1rem 1.25rem;
104
-
105
- & [data-part="header"] {
106
- font: 500 0.9375rem/1.3 var(--ui-font-display);
107
- padding-block-end: 6px;
108
- margin-block-end: 14px;
109
- border-bottom: 1px solid var(--ui-ink);
110
- }
111
- & [data-part="footer"] {
112
- margin-block-start: 14px;
113
- padding-block-start: 10px;
114
- border-top: 1px solid var(--ui-line);
115
- color: var(--ui-muted);
116
- font-size: 0.75rem;
117
- }
82
+ --ui-card-pad: 1.1rem 1.25rem;
83
+ --ui-card-hf: 500 0.9375rem/1.3 var(--ui-font-display);
84
+ --ui-card-hpb: 6px;
85
+ --ui-card-hmb: 14px;
86
+ --ui-card-hbd: 1px solid var(--ui-ink);
87
+ --ui-card-fmt: 14px;
88
+ --ui-card-fpt: 10px;
89
+ --ui-card-fbd: 1px solid var(--ui-line);
90
+ & [data-part="footer"] { font-size: 0.75rem; }
118
91
  }
119
92
 
120
93
  /* A badge is a word in its tone after a dot, as in a book's margin. */
121
94
  [data-ui="badge"] {
122
- display: inline-flex;
123
- align-items: center;
95
+ --ui-badge-f: 400 0.8125rem/1.3 var(--ui-font-body);
96
+ --ui-badge-pad: 0;
124
97
  gap: 6px;
125
- font: 400 0.8125rem/1.3 var(--ui-font-body);
126
98
  white-space: nowrap;
127
- color: var(--ui-tone, var(--ui-muted));
128
- &::before {
129
- content: '';
130
- inline-size: 6px;
131
- block-size: 6px;
132
- border-radius: 50%;
133
- background: currentColor;
134
- flex: none;
135
- }
99
+ &::before { content: ''; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; flex: none; }
136
100
  }
137
- :is([data-ui="badge"], [data-ui="notice"], [data-ui="toast"])[data-tone="accent"] { --ui-tone: var(--ui-accent); }
138
- :is([data-ui="badge"], [data-ui="notice"])[data-tone="success"] { --ui-tone: var(--ui-success); }
139
- :is([data-ui="badge"], [data-ui="notice"])[data-tone="warning"] { --ui-tone: var(--ui-warning); }
140
- :is([data-ui="badge"], [data-ui="notice"])[data-tone="danger"] { --ui-tone: var(--ui-danger); }
141
101
 
142
102
  /* A notice is a rule in its tone above the text, its bold words in the tone too. */
143
103
  [data-ui="notice"] {
144
- padding: 10px 0 2px;
145
- border-top: 2px solid var(--ui-tone, var(--ui-accent));
146
- color: var(--ui-ink);
104
+ --ui-notice-bw: 2px 0 0 0;
105
+ --ui-notice-bg: transparent;
106
+ --ui-notice-pad: 10px 0 2px;
147
107
  font: 400 0.875rem/1.55 var(--ui-font-body);
148
- & :is(b, strong) { color: var(--ui-tone, var(--ui-accent)); font-weight: 600; }
108
+ border-top-color: var(--ui-tone);
109
+ & :is(b, strong) { color: var(--ui-tone); font-weight: 600; }
149
110
  }
150
111
 
151
112
  [data-ui="field"] {
152
- display: flex;
153
- flex-direction: column;
154
- gap: 4px;
155
- & [data-part="label"] { font: 500 0.8125rem/1.3 var(--ui-font-body); color: var(--ui-ink); }
156
- & :is(input:not([type="checkbox"], [type="radio"]), textarea, select) {
157
- min-block-size: 34px;
158
- padding: 0.4rem 10px;
159
- font: 400 0.875rem/1.4 var(--ui-font-body);
160
- color: var(--ui-ink);
161
- background: var(--ui-surface);
162
- border: 1px solid var(--ui-line-strong);
163
- border-radius: var(--ui-radius);
164
- transition: border-color var(--ui-motion), box-shadow var(--ui-motion);
165
- }
166
- & :is(input, textarea, select):focus {
167
- outline: none;
168
- border-color: var(--ui-accent);
169
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 22%, transparent);
170
- }
171
- & [aria-invalid="true"] { border-color: var(--ui-danger); }
172
- & [data-part="hint"] { margin: 0; font-size: 0.75rem; color: var(--ui-muted); }
173
- & [data-part="error"] { margin: 0; font-size: 0.75rem; color: var(--ui-danger); }
113
+ --ui-fld-gap: 4px;
114
+ --ui-fld-lf: 500 0.8125rem/1.3 var(--ui-font-body);
115
+ --ui-in-h: 34px;
116
+ --ui-in-pad: 0.4rem 10px;
117
+ --ui-in-f: 400 0.875rem/1.4 var(--ui-font-body);
118
+ --ui-in-fs: 0.875rem;
119
+ --ui-fld-ms: 0.75rem;
120
+ & :is(input:not([type="checkbox"], [type="radio"]), textarea, select):focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 22%, transparent); }
174
121
  }
175
122
 
176
- [data-ui="accordion"] details {
177
- border-bottom: 1px solid var(--ui-line);
178
- }
179
- [data-ui="accordion"] summary[data-part="trigger"] {
180
- list-style: none;
181
- cursor: pointer;
182
- display: flex;
183
- align-items: center;
184
- justify-content: space-between;
185
- gap: 12px;
186
- padding: 11px 0;
187
- font: 500 1rem/1.3 var(--ui-font-display);
188
- color: var(--ui-ink);
189
- &::-webkit-details-marker { display: none; }
190
- &::after {
123
+ [data-ui="accordion"] {
124
+ --ui-acc-bb: 1px solid var(--ui-line);
125
+ --ui-acc-tpad: 11px 0;
126
+ --ui-acc-tf: 500 1rem/1.3 var(--ui-font-display);
127
+ --ui-acc-cpad: 0 0 12px;
128
+ & summary[data-part="trigger"]::after {
191
129
  content: '';
192
130
  inline-size: 7px;
193
131
  block-size: 7px;
@@ -197,122 +135,57 @@
197
135
  transform: translateY(-2px) rotate(45deg);
198
136
  transition: transform var(--ui-motion);
199
137
  }
200
- }
201
- [data-ui="accordion"] details[open] summary[data-part="trigger"]::after {
202
- transform: translateY(2px) rotate(-135deg);
203
- }
204
- [data-ui="accordion"] [data-part="content"] {
205
- padding-block-end: 12px;
206
- color: var(--ui-muted);
207
- font-size: 0.875rem;
208
- line-height: 1.55;
138
+ & details[open] summary[data-part="trigger"]::after { transform: translateY(2px) rotate(-135deg); }
139
+ & [data-part="content"] { font-size: 0.875rem; line-height: 1.55; }
209
140
  }
210
141
 
211
- [data-ui="tabs"] [data-part="list"] {
212
- display: flex;
213
- gap: 22px;
214
- border-bottom: 1px solid var(--ui-line-strong);
215
- }
216
- [data-ui="tabs"] [data-part="trigger"] {
217
- background: transparent;
218
- border: 0;
219
- padding: 8px 0;
220
- margin-block-end: -1px;
221
- font: 400 0.8125rem/1.3 var(--ui-font-body);
222
- color: var(--ui-muted);
223
- cursor: pointer;
224
- transition: color var(--ui-motion), box-shadow var(--ui-motion);
225
- &:hover { color: var(--ui-ink); }
226
- &[data-state="active"] {
227
- color: var(--ui-ink);
228
- box-shadow: inset 0 -2px 0 var(--ui-accent);
229
- }
230
- }
231
- [data-ui="tabs"] [data-part="panel"] {
232
- padding-block-start: 14px;
142
+ [data-ui="tabs"] {
143
+ --ui-tab-gap: 22px;
144
+ --ui-tab-lbb: 1px solid var(--ui-line-strong);
145
+ --ui-tab-pad: 8px 0;
146
+ --ui-tab-f: 400 0.8125rem/1.3 var(--ui-font-body);
147
+ --ui-tab-ppad: 14px 0 0;
148
+ & [data-part="trigger"] { margin-block-end: -1px; }
233
149
  }
234
150
 
235
151
  dialog[data-ui="dialog"],
236
152
  dialog[data-ui="drawer"],
237
153
  dialog[data-ui="command"] {
238
- border: 1px solid var(--ui-ink);
239
- border-radius: var(--ui-radius);
240
- background: var(--ui-paper);
241
- color: var(--ui-ink);
242
- font-family: var(--ui-font-body);
243
- padding: 0;
244
- & [data-part="title"] {
245
- margin: 0 0 8px;
246
- font: 500 1.375rem/1.2 var(--ui-font-display);
247
- }
248
- & [data-part="description"] { color: var(--ui-muted); font-size: 0.875rem; }
249
- }
250
- dialog[data-ui="dialog"] {
251
- & > [data-part="panel"] { padding: 20px 22px; }
252
- }
253
- dialog[data-ui="drawer"] {
254
- border-radius: 0;
255
- border-block: 0;
256
- & > [data-part="panel"] { padding: 20px 22px; }
154
+ --ui-dlg-bd: 1px solid var(--ui-ink);
155
+ --ui-dlg-bg: var(--ui-paper);
156
+ --ui-dlg-pad: 20px 22px;
157
+ --ui-dlg-tf: 500 1.375rem/1.2 var(--ui-font-display);
257
158
  }
159
+ dialog[data-ui="drawer"] { border-block: 0; }
258
160
 
259
- [data-ui="popover"][popover],
260
- [data-ui="menu"] [data-part="content"],
261
- [data-ui="select"] [data-part="listbox"] {
262
- background: var(--ui-paper);
263
- color: var(--ui-ink);
264
- border: 1px solid var(--ui-line-strong);
265
- border-radius: var(--ui-radius);
266
- padding: 4px;
267
- min-inline-size: 11.5rem;
161
+ [data-ui="popover"],
162
+ [data-ui="menu"],
163
+ [data-ui="select"] {
164
+ --ui-pop-bg: var(--ui-paper);
165
+ --ui-pop-bd: 1px solid var(--ui-line-strong);
166
+ --ui-pop-pad: 4px;
167
+ --ui-pop-w: 11.5rem;
168
+ --ui-it-pad: 0 10px;
169
+ --ui-it-f: 400 0.8125rem/1.35 var(--ui-font-body);
170
+ --ui-it-hbg: var(--ui-surface-strong);
268
171
  }
269
-
270
172
  [data-ui="menu"] [data-part="item"],
271
- [data-ui="select"] [data-part="option"] {
272
- display: flex;
273
- align-items: center;
274
- justify-content: space-between;
275
- width: 100%;
276
- min-block-size: 32px;
277
- text-align: start;
278
- background: transparent;
279
- border: 0;
280
- border-radius: var(--ui-radius);
281
- padding: 0 10px;
282
- font: 400 0.8125rem/1.35 var(--ui-font-body);
283
- color: var(--ui-ink);
284
- cursor: pointer;
285
- &:hover, &[data-highlighted="true"] { background: var(--ui-surface-strong); }
286
- &[data-selected="true"] { color: var(--ui-accent); }
287
- }
173
+ [data-ui="select"] [data-part="option"] { min-block-size: 32px; }
288
174
 
289
- [data-ui="select"] [data-part="trigger"] {
290
- display: inline-flex;
291
- align-items: center;
292
- justify-content: space-between;
293
- gap: 0.75rem;
294
- min-inline-size: 11.5rem;
295
- min-block-size: 34px;
296
- background: var(--ui-surface);
297
- color: var(--ui-ink);
298
- border: 1px solid var(--ui-line-strong);
299
- border-radius: var(--ui-radius);
300
- padding: 0 10px;
301
- font: 400 0.8125rem/1.3 var(--ui-font-body);
302
- cursor: pointer;
303
- &:hover { border-color: var(--ui-ink); }
175
+ [data-ui="select"] {
176
+ --ui-sel-h: 34px;
177
+ --ui-sel-pad: 0 10px;
178
+ --ui-sel-f: 400 0.8125rem/1.3 var(--ui-font-body);
179
+ & [data-part="trigger"]:hover { border-color: var(--ui-ink); }
304
180
  }
305
181
 
306
- /* A toast is the page inverted: ink ground, paper text, its tone a dot in the other theme's colour. */
182
+ /* A toast is the page inverted: ink ground, paper text, its tone a rule in the other theme's colour. */
307
183
  [data-ui="toast"] {
308
- display: flex;
309
- align-items: start;
310
- justify-content: space-between;
311
- gap: 10px;
312
- padding: 10px 14px;
313
- border-radius: var(--ui-radius);
314
- background: var(--ui-ink);
315
- color: var(--ui-paper);
184
+ --ui-toast-gap: 10px;
185
+ --ui-tst-bw: 0;
186
+ --ui-tst-bg: var(--ui-ink);
187
+ --ui-tst-fg: var(--ui-paper);
188
+ --ui-tst-pad: 10px 14px;
316
189
  font: 400 0.8125rem/1.45 var(--ui-font-body);
317
190
  &[data-tone] { box-shadow: inset 3px 0 0 var(--ui-tone); }
318
191
  &[data-tone="accent"] { --ui-tone: light-dark(#e5c068, #7a3667); }
@@ -322,29 +195,40 @@
322
195
  }
323
196
 
324
197
  [data-ui="checkbox"] {
325
- gap: 10px;
326
- font-size: 0.875rem;
198
+ --ui-check-gap: 10px;
199
+ --ui-chk-fs: 0.875rem;
200
+ & input[type="checkbox"] {
201
+ appearance: none;
202
+ display: inline-grid;
203
+ place-items: center;
204
+ flex: none;
205
+ inline-size: 16px;
206
+ block-size: 16px;
207
+ margin: 0;
208
+ border-radius: var(--ui-radius);
209
+ background: var(--ui-surface);
210
+ box-shadow: inset 0 0 0 1.5px var(--ui-line-strong);
211
+ cursor: pointer;
212
+ &:checked { background: var(--ui-accent); box-shadow: none; }
213
+ &:checked::after {
214
+ content: '';
215
+ inline-size: 4px;
216
+ block-size: 8px;
217
+ border: solid var(--ui-on-accent);
218
+ border-width: 0 2px 2px 0;
219
+ transform: translateY(-1px) rotate(45deg);
220
+ }
221
+ }
327
222
  }
328
- [data-ui="checkbox"] input[type="checkbox"] {
329
- appearance: none;
330
- display: inline-grid;
331
- place-items: center;
332
- flex: none;
333
- inline-size: 16px;
334
- block-size: 16px;
335
- margin: 0;
336
- border-radius: var(--ui-radius);
337
- background: var(--ui-surface);
338
- box-shadow: inset 0 0 0 1.5px var(--ui-line-strong);
339
- cursor: pointer;
340
- &:checked { background: var(--ui-accent); box-shadow: none; }
341
- &:checked::after {
342
- content: '';
343
- inline-size: 4px;
344
- block-size: 8px;
345
- border: solid var(--ui-on-accent);
346
- border-width: 0 2px 2px 0;
347
- transform: translateY(-1px) rotate(45deg);
223
+ /* @part: checkbox */
224
+ @media (forced-colors: active) {
225
+ :root [data-ui="checkbox"] input[type="checkbox"] {
226
+ border: 1.5px solid ButtonText;
227
+ background: Canvas;
228
+ &:checked { border-color: Highlight; background: Highlight; }
229
+ &:checked::after { border-color: HighlightText; }
230
+ &:disabled { border-color: GrayText; }
231
+ &:disabled:checked { border-color: GrayText; background: GrayText; }
348
232
  }
349
233
  }
350
234
 
@@ -391,31 +275,44 @@
391
275
  &::after { opacity: 1; }
392
276
  }
393
277
 
394
- [data-ui="radio-group"] [data-part="legend"] {
395
- font: 500 0.8125rem/1.3 var(--ui-font-body);
396
- color: var(--ui-ink);
397
- margin-block-end: 6px;
398
- }
399
- [data-ui="radio-group"] [data-part="option"] {
400
- gap: 10px;
401
- font-size: 0.875rem;
278
+ [data-ui="radio-group"] {
279
+ --ui-radio-gap: 10px;
280
+ --ui-chk-fs: 0.875rem;
281
+ --ui-rg-lf: 500 0.8125rem/1.3 var(--ui-font-body);
282
+ --ui-rg-lfg: var(--ui-ink);
283
+ --ui-rg-lmb: 6px;
284
+ --ui-rg-hs: 0.75rem;
285
+ & input[type="radio"] {
286
+ --ui-eye: 24px;
287
+ --ui-lid-w: 2px;
288
+ appearance: none;
289
+ margin: 0;
290
+ border-radius: 4px;
291
+ cursor: pointer;
292
+ &:disabled { cursor: not-allowed; }
293
+ }
402
294
  }
403
- [data-ui="radio-group"] [data-part="hint"] { font-size: 0.75rem; color: var(--ui-muted); }
404
- [data-ui="radio-group"] input[type="radio"] {
405
- --ui-eye: 24px;
406
- --ui-lid-w: 2px;
407
- appearance: none;
408
- margin: 0;
409
- border-radius: 4px;
410
- cursor: pointer;
411
- &:disabled { cursor: not-allowed; }
295
+ /* @part: radio-group */
296
+ @media (forced-colors: active) {
297
+ :root [data-ui="radio-group"] input[type="radio"] {
298
+ border: 1.5px solid ButtonText;
299
+ border-radius: 50%;
300
+ background: Canvas;
301
+ &::before { display: none; }
302
+ &::after { inline-size: 50%; block-size: 50%; background: HighlightText; }
303
+ &:checked { border-color: Highlight; background: Highlight; }
304
+ &:checked::after { opacity: 1; transform: none; }
305
+ &:disabled { border-color: GrayText; }
306
+ &:disabled:checked { border-color: GrayText; background: GrayText; }
307
+ }
412
308
  }
413
309
 
414
- /* Switch: the input is the track, the track part its knob, an eye on white whatever the theme, rimmed so a gold almond still reads. */
310
+ /* Switch: the input is the visible track (and carries base.css's focus-visible ring), the track part its sliding eye knob. */
415
311
  [data-ui="switch"] {
312
+ --ui-switch-gap: 10px;
313
+ --ui-chk-fs: 0.875rem;
314
+ --ui-switch-track-focus-w: 0px;
416
315
  position: relative;
417
- gap: 10px;
418
- font-size: 0.875rem;
419
316
  }
420
317
  [data-ui="switch"] input[type="checkbox"] {
421
318
  appearance: none;
@@ -460,12 +357,38 @@
460
357
  inset-inline-start: 18px;
461
358
  &::after { inset-inline-start: auto; transform: scaleY(var(--ui-lid)); }
462
359
  }
463
- [data-ui="switch"]:has(input:focus-visible) [data-part="track"],
464
- [data-ui="switch"] input:focus-visible + [data-part="track"] {
465
- outline: none;
360
+ /* @part: switch */
361
+ @media (forced-colors: active) {
362
+ :root [data-ui="switch"] input[type="checkbox"] {
363
+ border: 1.5px solid ButtonText;
364
+ background: Canvas;
365
+ &:checked { border-color: Highlight; background: Highlight; }
366
+ &:disabled { border-color: GrayText; }
367
+ &:disabled:checked { border-color: GrayText; background: GrayText; }
368
+ }
369
+ :root [data-ui="switch"] [data-part="track"] {
370
+ border: 1.5px solid ButtonText;
371
+ background: Canvas;
372
+ &::before { display: none; }
373
+ &::after { inline-size: 6px; block-size: 6px; border-radius: 50%; opacity: 1; transform: none; background: ButtonText; }
374
+ }
375
+ :root [data-ui="switch"] input:checked + [data-part="track"] {
376
+ border-color: HighlightText;
377
+ background: Highlight;
378
+ &::after { background: HighlightText; }
379
+ }
380
+ :root [data-ui="switch"] input:disabled + [data-part="track"] {
381
+ border-color: GrayText;
382
+ &::after { background: GrayText; }
383
+ }
384
+ :root [data-ui="switch"] input:disabled:checked + [data-part="track"] {
385
+ border-color: Canvas;
386
+ background: GrayText;
387
+ &::after { background: Canvas; }
388
+ }
466
389
  }
467
390
 
468
- /* Progress: the native bar stays for assistive tech and the eye shows it. Without a value the pupil opens to an oval, looks left, then right, narrows back and the eye blinks; with one the pupil widens until it fills the eye, a ring of iris keeping the full eye visible. */
391
+ /* Progress: the native bar stays for assistive tech and the eye shows it. */
469
392
  [data-ui="progress"] {
470
393
  --ui-eye: 22px;
471
394
  position: relative;
@@ -503,9 +426,7 @@
503
426
  transform: rotate(-45deg) scale(calc(1 + var(--ui-progress) * 10), calc(1 + var(--ui-progress) * 0.8));
504
427
  }
505
428
  }
506
- [data-ui="progress"][data-value] [data-part="eye"] {
507
- box-shadow: 0 0 0 calc(var(--ui-eye) * 0.05) var(--ui-iris);
508
- }
429
+ [data-ui="progress"][data-value] [data-part="eye"] { box-shadow: 0 0 0 calc(var(--ui-eye) * 0.05) var(--ui-iris); }
509
430
  [data-ui="progress"]:not([data-value]) [data-part="eye"] {
510
431
  animation: ui-eye-blink 3.2s ease-in-out infinite;
511
432
  &::after { animation: ui-eye-look 3.2s ease-in-out infinite; }
@@ -532,10 +453,12 @@
532
453
  [data-ui="progress"][data-value="95"] { --ui-progress: 0.95; }
533
454
  [data-ui="progress"][data-value="100"] { --ui-progress: 1; }
534
455
 
456
+ /* @part: progress */
535
457
  @keyframes ui-eye-blink {
536
458
  0%, 83%, 93%, 100% { transform: scaleY(1) rotate(45deg); }
537
459
  88% { transform: scaleY(0.08) rotate(45deg); }
538
460
  }
461
+ /* @part: progress */
539
462
  @keyframes ui-eye-look {
540
463
  0%, 100% { transform: rotate(-45deg) translateX(0) scale(1, 1); }
541
464
  10%, 74% { transform: rotate(-45deg) translateX(0) scale(1.9, 1); }
@@ -545,108 +468,37 @@
545
468
  }
546
469
 
547
470
  dialog[data-ui="command"] {
548
- & [data-part="input"] {
549
- width: 100%;
550
- border: 0;
551
- border-bottom: 1px solid var(--ui-line-strong);
552
- background: var(--ui-paper);
553
- color: var(--ui-ink);
554
- padding: 12px 14px;
555
- font: 400 0.9375rem/1.35 var(--ui-font-body);
556
- &:focus-visible {
557
- outline: 2px solid var(--ui-accent);
558
- outline-offset: -2px;
559
- border-bottom-color: var(--ui-accent);
560
- }
561
- }
562
- & [data-part="list"] { padding: 4px; }
563
- & [data-part="item"] {
564
- display: flex;
565
- justify-content: space-between;
566
- align-items: center;
567
- width: 100%;
568
- min-block-size: 32px;
569
- border: 0;
570
- border-radius: var(--ui-radius);
571
- background: transparent;
572
- color: var(--ui-ink);
573
- padding: 0 10px;
574
- font: 400 0.8125rem/1.35 var(--ui-font-body);
575
- cursor: pointer;
576
- &[data-highlighted="true"] { background: var(--ui-surface-strong); }
577
- }
578
- & [data-part="kbd"] {
579
- font: 400 0.75rem/1 var(--ui-font-mono);
580
- color: var(--ui-muted);
581
- background: var(--ui-surface-strong);
582
- border-radius: var(--ui-radius);
583
- padding: 3px 5px;
584
- }
585
- & [data-part="empty"] { padding: 12px 14px; margin: 0; color: var(--ui-muted); font-size: 0.8125rem; }
471
+ --ui-cmd-ibb: 1px solid var(--ui-line-strong);
472
+ --ui-cmd-ibg: var(--ui-paper);
473
+ --ui-cmd-ipad: 12px 14px;
474
+ --ui-cmd-if: 400 0.9375rem/1.35 var(--ui-font-body);
475
+ --ui-cmd-ifs: 0.9375rem;
476
+ --ui-cmd-lpad: 4px;
477
+ --ui-cmd-mpad: 0 10px;
478
+ --ui-cmd-mf: 400 0.8125rem/1.35 var(--ui-font-body);
479
+ --ui-cmd-hbg: var(--ui-surface-strong);
480
+ & [data-part="item"] { min-block-size: 32px; }
481
+ & [data-part="kbd"] { background: var(--ui-surface-strong); border: 0; font-family: var(--ui-font-mono); }
586
482
  }
587
483
 
588
- /* Tables are ruled like a book's: a heavy rule above and below, a thin one under the head, none between rows. */
589
484
  table[data-ui="table"],
590
- [data-ui="datatable"] table {
591
- border-block: 2px solid var(--ui-ink);
592
- font-size: 0.8125rem;
485
+ [data-ui="datatable"] {
486
+ --ui-table-gap: 10px;
487
+ --ui-tbl-fs: 0.8125rem;
488
+ --ui-srch-h: 34px;
489
+ --ui-srch-pad: 0 10px;
490
+ --ui-srch-f: 400 0.8125rem/1.35 var(--ui-font-body);
491
+ --ui-srch-fs: 0.8125rem;
492
+ --ui-th-bb: 1px solid var(--ui-ink);
493
+ --ui-th-pad: 7px 12px 7px 0;
494
+ --ui-td-bb: 0;
495
+ --ui-td-pad: 7px 12px 7px 0;
496
+ --ui-tbl-sel: color-mix(in srgb, var(--ui-accent) 12%, transparent);
593
497
  font-variant-numeric: tabular-nums;
498
+ & [data-part="search"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 22%, transparent); }
499
+ & table { border-block: 2px solid var(--ui-ink); }
594
500
  & > caption { font: 500 0.9375rem/1.3 var(--ui-font-display); }
595
- & th {
596
- padding: 7px 12px 7px 0;
597
- border-bottom: 1px solid var(--ui-ink);
598
- font-weight: 400;
599
- font-size: 0.75rem;
600
- color: var(--ui-muted);
601
- text-align: start;
602
- }
603
- & td { padding: 7px 12px 7px 0; }
501
+ & th { font-weight: 400; color: var(--ui-muted); }
604
502
  & :is(th, td):last-child { padding-inline-end: 0; }
605
503
  }
606
- [data-ui="datatable"] {
607
- display: flex;
608
- flex-direction: column;
609
- gap: 10px;
610
- & [data-part="search"] {
611
- min-block-size: 34px;
612
- border: 1px solid var(--ui-line-strong);
613
- border-radius: var(--ui-radius);
614
- background: var(--ui-surface);
615
- color: var(--ui-ink);
616
- padding: 0 10px;
617
- font: 400 0.8125rem/1.35 var(--ui-font-body);
618
- &:focus { outline: none; border-color: var(--ui-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 22%, transparent); }
619
- }
620
- & [data-part="meta"] { font-size: 0.75rem; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
621
- & tr[data-selected="true"] { background: color-mix(in srgb, var(--ui-accent) 12%, transparent); }
622
- & [data-part="sort"] {
623
- background: transparent;
624
- border: 0;
625
- padding: 0;
626
- font: inherit;
627
- color: inherit;
628
- cursor: pointer;
629
- &[data-active="true"] { color: var(--ui-accent); }
630
- }
631
- }
632
-
633
- /* bare.css keeps 44px targets and 16px fields on phones; the sizes above would undercut it */
634
- @media (max-width: 600px) {
635
- [data-ui="button"],
636
- [data-ui="button"][data-size] {
637
- min-inline-size: 44px;
638
- }
639
- [data-ui="button"],
640
- [data-ui="button"][data-size],
641
- [data-ui="field"] :is(input:not([type="checkbox"], [type="radio"]), select),
642
- [data-ui="select"] [data-part="trigger"],
643
- [data-ui="datatable"] [data-part="search"] {
644
- min-block-size: 44px;
645
- }
646
- [data-ui="field"] :is(input:not([type="checkbox"], [type="radio"]), select, textarea),
647
- [data-ui="datatable"] [data-part="search"],
648
- dialog[data-ui="command"] [data-part="input"] {
649
- font-size: max(1rem, 16px);
650
- }
651
- }
652
504
  }