uniskin 0.0.1 → 0.3.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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +122 -1
  3. package/dist/cli/bin.d.ts +3 -0
  4. package/dist/cli/bin.d.ts.map +1 -0
  5. package/dist/cli/bin.js +9 -0
  6. package/dist/cli/bin.js.map +1 -0
  7. package/dist/cli/css.d.ts +25 -0
  8. package/dist/cli/css.d.ts.map +1 -0
  9. package/dist/cli/css.js +68 -0
  10. package/dist/cli/css.js.map +1 -0
  11. package/dist/cli/init.d.ts +20 -0
  12. package/dist/cli/init.d.ts.map +1 -0
  13. package/dist/cli/init.js +92 -0
  14. package/dist/cli/init.js.map +1 -0
  15. package/dist/cli/main.d.ts +5 -0
  16. package/dist/cli/main.d.ts.map +1 -0
  17. package/dist/cli/main.js +85 -0
  18. package/dist/cli/main.js.map +1 -0
  19. package/dist/cli/new-adapter.d.ts +11 -0
  20. package/dist/cli/new-adapter.d.ts.map +1 -0
  21. package/dist/cli/new-adapter.js +66 -0
  22. package/dist/cli/new-adapter.js.map +1 -0
  23. package/dist/cli/project.d.ts +30 -0
  24. package/dist/cli/project.d.ts.map +1 -0
  25. package/dist/cli/project.js +158 -0
  26. package/dist/cli/project.js.map +1 -0
  27. package/dist/default-theme.d.ts +948 -0
  28. package/dist/default-theme.d.ts.map +1 -0
  29. package/dist/default-theme.js +944 -0
  30. package/dist/default-theme.js.map +1 -0
  31. package/dist/emit.d.ts +23 -0
  32. package/dist/emit.d.ts.map +1 -0
  33. package/dist/emit.js +105 -0
  34. package/dist/emit.js.map +1 -0
  35. package/dist/index.d.ts +48 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +67 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/merge.d.ts +49 -0
  40. package/dist/merge.d.ts.map +1 -0
  41. package/dist/merge.js +188 -0
  42. package/dist/merge.js.map +1 -0
  43. package/dist/types.d.ts +94 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/types.js +44 -0
  46. package/dist/types.js.map +1 -0
  47. package/package.json +56 -4
@@ -0,0 +1,944 @@
1
+ import { INTENTS, defineAdapter } from "./types.js";
2
+ /** [soft tint %, soft text darkening %] per intent. */
3
+ const INTENT_MIX = {
4
+ primary: [14, 80],
5
+ secondary: [14, 80],
6
+ success: [16, 55],
7
+ warning: [22, 45],
8
+ danger: [12, 70],
9
+ };
10
+ /** Share of the intent colour kept when it is used as text (rest = surface text).
11
+ * Only warning is too light to read on a light surface at full strength. */
12
+ const INTENT_TEXT_MIX = { warning: 55 };
13
+ /** The five per-element variables an intent sets (see composition model). */
14
+ function intentVars(intent) {
15
+ const [soft, fg] = INTENT_MIX[intent];
16
+ return {
17
+ "--ui-c": `var(--ui-${intent})`,
18
+ /* adapters can pin the text colour with --ui-<intent>-text */
19
+ "--ui-c-text": `var(--ui-${intent}-text, ${INTENT_TEXT_MIX[intent]
20
+ ? `color-mix(in oklab, var(--ui-${intent}) ${INTENT_TEXT_MIX[intent]}%, var(--ui-surface-fg))`
21
+ : `var(--ui-${intent})`})`,
22
+ "--ui-on-c": `var(--ui-${intent}-fg)`,
23
+ /* mixed with the surface (not white/black) so soft looks stay legible in dark themes */
24
+ /* adapters can pin exact soft colors with --ui-<intent>-soft / -soft-fg */
25
+ "--ui-c-soft": `var(--ui-${intent}-soft, color-mix(in oklab, var(--ui-${intent}) ${soft}%, var(--ui-surface)))`,
26
+ "--ui-c-soft-fg": `var(--ui-${intent}-soft-fg, color-mix(in oklab, var(--ui-${intent}) ${fg}%, var(--ui-surface-fg)))`,
27
+ };
28
+ }
29
+ /** Build a full intent map, optionally adding extra declarations per intent. */
30
+ function intentMap(extra) {
31
+ const out = {};
32
+ for (const i of INTENTS)
33
+ out[i] = { ...intentVars(i), ...extra?.(i) };
34
+ return out;
35
+ }
36
+ const intents = intentMap();
37
+ /** Variables for the neutral (no intent) look. */
38
+ const neutralVars = {
39
+ "--ui-c": "var(--ui-neutral)",
40
+ "--ui-c-text": "var(--ui-surface-fg)",
41
+ "--ui-on-c": "var(--ui-neutral-fg)",
42
+ "--ui-c-soft": "var(--ui-neutral-soft)",
43
+ "--ui-c-soft-fg": "var(--ui-neutral-soft-fg)",
44
+ };
45
+ const transition = (props) => props.map((p) => `${p} 0.15s ease`).join(", ");
46
+ const focusRing = {
47
+ outline: "2px solid var(--ui-ring)",
48
+ "outline-offset": "2px",
49
+ };
50
+ /* ---- text fields (input / textarea / select) ---- */
51
+ const fieldBase = {
52
+ /* focus/accent color; intents re-point it, --ui-field-c also tints the border */
53
+ "--ui-c": "var(--ui-ring)",
54
+ "--ui-c-text": "var(--ui-ring)",
55
+ display: "block",
56
+ width: "100%",
57
+ "box-sizing": "border-box",
58
+ margin: "0",
59
+ "font-family": "var(--ui-font-sans)",
60
+ "font-size": "var(--ui-text-md)",
61
+ "line-height": "1.25",
62
+ padding: "0.5rem 0.75rem",
63
+ color: "var(--ui-surface-fg)",
64
+ "background-color": "var(--ui-surface)",
65
+ border: "1px solid var(--ui-field-c, var(--ui-border))",
66
+ "border-radius": "var(--ui-radius)",
67
+ transition: transition(["background-color", "border-color", "box-shadow"]),
68
+ "&::placeholder": {
69
+ color: "color-mix(in oklab, var(--ui-surface-fg) 45%, transparent)",
70
+ },
71
+ "&:hover": {
72
+ "border-color": "var(--ui-field-c, color-mix(in oklab, var(--ui-border) 65%, var(--ui-surface-fg)))",
73
+ },
74
+ "&:focus-visible": {
75
+ outline: "2px solid var(--ui-ring)",
76
+ "outline-offset": "1px",
77
+ "border-color": "var(--ui-c)",
78
+ "box-shadow": "none",
79
+ },
80
+ "@media (prefers-reduced-motion: reduce)": { transition: "none" },
81
+ /* aria-invalid renders like ui-danger without the class. The extra :not()
82
+ lifts specificity so it also wins over intent, style and hover rules;
83
+ the danger text colour doubles as the boundary colour (>= 3:1 in every skin). */
84
+ '&[aria-invalid="true"]:not([aria-invalid="false"])': {
85
+ "--ui-field-c": "var(--ui-danger-text, var(--ui-danger))",
86
+ "border-color": "var(--ui-danger-text, var(--ui-danger))",
87
+ "&:hover": { "border-color": "var(--ui-danger-text, var(--ui-danger))" },
88
+ },
89
+ };
90
+ const fieldIntents = intentMap(() => ({ "--ui-field-c": "var(--ui-c-text)" }));
91
+ const fieldStyles = {
92
+ outline: {
93
+ "border-color": "var(--ui-c)",
94
+ "&:hover": { "border-color": "var(--ui-c)" },
95
+ },
96
+ ghost: {
97
+ "background-color": "transparent",
98
+ "border-color": "transparent",
99
+ "&:hover": { "background-color": "var(--ui-surface-muted)", "border-color": "transparent" },
100
+ "&:focus-visible": {
101
+ "background-color": "var(--ui-surface)",
102
+ "border-color": "var(--ui-c)",
103
+ },
104
+ },
105
+ soft: {
106
+ "background-color": "var(--ui-surface-muted)",
107
+ "border-color": "transparent",
108
+ "&:hover": { "border-color": "var(--ui-c)" },
109
+ "&:focus-visible": {
110
+ "background-color": "var(--ui-surface)",
111
+ "border-color": "var(--ui-c)",
112
+ },
113
+ },
114
+ };
115
+ const fieldSizes = {
116
+ sm: { "font-size": "var(--ui-text-sm)", padding: "0.375rem 0.625rem" },
117
+ lg: { "font-size": "var(--ui-text-lg)", padding: "0.75rem 1rem" },
118
+ };
119
+ const fieldStates = {
120
+ disabled: {
121
+ opacity: "0.5",
122
+ cursor: "not-allowed",
123
+ "background-color": "var(--ui-surface-muted)",
124
+ },
125
+ loading: { cursor: "progress", animation: "ui-pulse 1.2s ease-in-out infinite" },
126
+ active: {
127
+ "border-color": "var(--ui-c)",
128
+ "box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 25%, transparent)",
129
+ },
130
+ };
131
+ const chevron = "linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)";
132
+ /* ---- shared status states (badge / alert) ---- */
133
+ const statusStates = {
134
+ disabled: { opacity: "0.5", cursor: "not-allowed" },
135
+ loading: { animation: "ui-pulse 1.2s ease-in-out infinite" },
136
+ active: { "box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 30%, transparent)" },
137
+ };
138
+ /**
139
+ * Built-in default skin. Every Uniskin class has a complete style here;
140
+ * adapters deep-merge over this object, so anything they omit falls back
141
+ * to these rules.
142
+ *
143
+ * Composition model: every intent sets five per-element variables
144
+ * (`--ui-c`, `--ui-on-c`, `--ui-c-hover`, `--ui-c-soft`,
145
+ * `--ui-c-soft-fg`) and every style maps those variables onto real
146
+ * properties. That is why intents and styles combine freely
147
+ * (`ui-danger ui-outline`) without 5×4 hand-written rules.
148
+ */
149
+ export const defaultAdapter = defineAdapter({
150
+ name: "default",
151
+ tokens: {
152
+ "--ui-font-sans": 'ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif',
153
+ /* neutral (no intent) */
154
+ "--ui-neutral": "oklch(0.28 0.02 265)",
155
+ "--ui-neutral-fg": "oklch(0.98 0 0)",
156
+ "--ui-neutral-soft": "oklch(0.94 0.01 265)",
157
+ "--ui-neutral-soft-fg": "oklch(0.32 0.02 265)",
158
+ /* intents — *-hover and *-soft derive from the base color, so an
159
+ adapter that only remaps --ui-<intent> still gets matching states */
160
+ "--ui-primary": "oklch(0.55 0.21 267)",
161
+ "--ui-primary-fg": "oklch(0.98 0 0)",
162
+ "--ui-secondary": "oklch(0.55 0.05 285)",
163
+ "--ui-secondary-fg": "oklch(0.98 0 0)",
164
+ "--ui-success": "oklch(0.5 0.14 163)",
165
+ "--ui-success-fg": "oklch(0.98 0 0)",
166
+ "--ui-warning": "oklch(0.78 0.15 85)",
167
+ "--ui-warning-fg": "oklch(0.28 0.04 90)",
168
+ "--ui-danger": "oklch(0.56 0.2 27)",
169
+ "--ui-danger-fg": "oklch(0.98 0 0)",
170
+ /* surfaces */
171
+ "--ui-surface": "oklch(1 0 0)",
172
+ "--ui-surface-fg": "oklch(0.24 0.02 265)",
173
+ "--ui-surface-muted": "oklch(0.96 0.005 265)",
174
+ "--ui-border": "oklch(0.89 0.008 265)",
175
+ "--ui-ring": "oklch(0.62 0.18 262)",
176
+ /* shape & type */
177
+ "--ui-radius": "0.5rem",
178
+ "--ui-text-sm": "0.8125rem",
179
+ "--ui-text-md": "0.9375rem",
180
+ "--ui-text-lg": "1.0625rem",
181
+ },
182
+ darkTokens: {
183
+ "--ui-neutral": "oklch(0.92 0.01 265)",
184
+ "--ui-neutral-fg": "oklch(0.2 0.02 265)",
185
+ "--ui-neutral-soft": "oklch(0.3 0.015 265)",
186
+ "--ui-neutral-soft-fg": "oklch(0.92 0.01 265)",
187
+ "--ui-primary": "oklch(0.68 0.17 267)",
188
+ "--ui-primary-fg": "oklch(0.15 0.02 265)",
189
+ "--ui-secondary": "oklch(0.7 0.07 285)",
190
+ "--ui-secondary-fg": "oklch(0.15 0.02 285)",
191
+ "--ui-success": "oklch(0.72 0.15 163)",
192
+ "--ui-success-fg": "oklch(0.15 0.03 163)",
193
+ "--ui-warning": "oklch(0.82 0.15 85)",
194
+ "--ui-warning-fg": "oklch(0.2 0.04 90)",
195
+ "--ui-danger": "oklch(0.68 0.19 27)",
196
+ "--ui-danger-fg": "oklch(0.15 0.03 27)",
197
+ "--ui-surface": "oklch(0.21 0.015 265)",
198
+ "--ui-surface-fg": "oklch(0.95 0.005 265)",
199
+ "--ui-surface-muted": "oklch(0.26 0.015 265)",
200
+ "--ui-border": "oklch(0.34 0.015 265)",
201
+ "--ui-ring": "oklch(0.7 0.15 262)",
202
+ },
203
+ components: {
204
+ button: {
205
+ base: {
206
+ /* default = neutral intent; intents below override these vars */
207
+ "--ui-c": "var(--ui-neutral)",
208
+ "--ui-c-text": "var(--ui-surface-fg)",
209
+ "--ui-on-c": "var(--ui-neutral-fg)",
210
+ "--ui-c-hover": "color-mix(in oklab, var(--ui-c) 85%, black)",
211
+ "--ui-c-soft": "var(--ui-neutral-soft)",
212
+ "--ui-c-soft-fg": "var(--ui-neutral-soft-fg)",
213
+ display: "inline-flex",
214
+ "align-items": "center",
215
+ "justify-content": "center",
216
+ gap: "0.5rem",
217
+ "font-family": "var(--ui-font-sans)",
218
+ "font-weight": "500",
219
+ "font-size": "var(--ui-text-md)",
220
+ "line-height": "1.25",
221
+ padding: "0.5rem 1rem",
222
+ "border-radius": "var(--ui-radius)",
223
+ border: "1px solid transparent",
224
+ "background-color": "var(--ui-c)",
225
+ color: "var(--ui-on-c)",
226
+ "border-color": "var(--ui-c)",
227
+ cursor: "pointer",
228
+ "user-select": "none",
229
+ "text-decoration": "none",
230
+ transition: "background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease",
231
+ "&:hover": {
232
+ "background-color": "var(--ui-c-hover)",
233
+ "border-color": "var(--ui-c-hover)",
234
+ },
235
+ "&:focus-visible": {
236
+ outline: "2px solid var(--ui-ring)",
237
+ "outline-offset": "2px",
238
+ },
239
+ },
240
+ intents,
241
+ styles: {
242
+ outline: {
243
+ "background-color": "transparent",
244
+ color: "var(--ui-c-text)",
245
+ "border-color": "var(--ui-c)",
246
+ "&:hover": {
247
+ "background-color": "var(--ui-c)",
248
+ "border-color": "var(--ui-c)",
249
+ color: "var(--ui-on-c)",
250
+ },
251
+ },
252
+ ghost: {
253
+ "background-color": "transparent",
254
+ "border-color": "transparent",
255
+ color: "var(--ui-c-text)",
256
+ "&:hover": {
257
+ "background-color": "var(--ui-c-soft)",
258
+ "border-color": "transparent",
259
+ color: "var(--ui-c-soft-fg)",
260
+ },
261
+ },
262
+ soft: {
263
+ "background-color": "var(--ui-c-soft)",
264
+ "border-color": "transparent",
265
+ color: "var(--ui-c-soft-fg)",
266
+ "&:hover": {
267
+ "background-color": "var(--ui-c)",
268
+ "border-color": "var(--ui-c)",
269
+ color: "var(--ui-on-c)",
270
+ },
271
+ },
272
+ },
273
+ sizes: {
274
+ sm: {
275
+ "font-size": "var(--ui-text-sm)",
276
+ padding: "0.375rem 0.75rem",
277
+ },
278
+ lg: {
279
+ "font-size": "var(--ui-text-lg)",
280
+ padding: "0.75rem 1.5rem",
281
+ },
282
+ },
283
+ states: {
284
+ disabled: {
285
+ opacity: "0.5",
286
+ cursor: "not-allowed",
287
+ "pointer-events": "none",
288
+ },
289
+ loading: {
290
+ cursor: "progress",
291
+ "pointer-events": "none",
292
+ "&::after": {
293
+ content: '""',
294
+ width: "1em",
295
+ height: "1em",
296
+ "flex-shrink": "0",
297
+ "border-radius": "9999px",
298
+ border: "2px solid currentColor",
299
+ "border-top-color": "transparent",
300
+ animation: "ui-spin 0.6s linear infinite",
301
+ },
302
+ },
303
+ active: {
304
+ "box-shadow": "inset 0 2px 4px rgb(0 0 0 / 0.2)",
305
+ },
306
+ },
307
+ },
308
+ input: {
309
+ base: { ...fieldBase },
310
+ intents: fieldIntents,
311
+ styles: fieldStyles,
312
+ sizes: fieldSizes,
313
+ states: fieldStates,
314
+ },
315
+ textarea: {
316
+ base: { ...fieldBase, "line-height": "1.5", "min-height": "5rem", resize: "vertical" },
317
+ intents: fieldIntents,
318
+ styles: fieldStyles,
319
+ sizes: fieldSizes,
320
+ states: fieldStates,
321
+ },
322
+ select: {
323
+ base: {
324
+ ...fieldBase,
325
+ appearance: "none",
326
+ cursor: "pointer",
327
+ "padding-right": "2.25rem",
328
+ "background-image": chevron,
329
+ "background-position": "calc(100% - 1.1rem) 55%, calc(100% - 0.75rem) 55%",
330
+ "background-size": "0.35rem 0.35rem, 0.35rem 0.35rem",
331
+ "background-repeat": "no-repeat",
332
+ /* listbox-style selects have no dropdown arrow */
333
+ '&[multiple], &[size]:not([size="1"])': {
334
+ "background-image": "none",
335
+ "padding-right": "0.75rem",
336
+ height: "auto",
337
+ cursor: "auto",
338
+ },
339
+ },
340
+ intents: fieldIntents,
341
+ styles: fieldStyles,
342
+ sizes: {
343
+ sm: { ...fieldSizes.sm, "padding-right": "2rem" },
344
+ lg: { ...fieldSizes.lg, "padding-right": "2.5rem" },
345
+ },
346
+ states: fieldStates,
347
+ },
348
+ checkbox: {
349
+ base: {
350
+ ...neutralVars,
351
+ appearance: "none",
352
+ display: "inline-grid",
353
+ "place-content": "center",
354
+ "flex-shrink": "0",
355
+ "box-sizing": "border-box",
356
+ width: "var(--ui-check-size, 1.125rem)",
357
+ height: "var(--ui-check-size, 1.125rem)",
358
+ margin: "0",
359
+ "vertical-align": "middle",
360
+ cursor: "pointer",
361
+ "background-color": "var(--ui-surface)",
362
+ border: "1px solid color-mix(in oklab, var(--ui-border) 55%, var(--ui-surface-fg))",
363
+ "border-radius": "calc(var(--ui-radius) * 0.5)",
364
+ transition: transition(["background-color", "border-color", "box-shadow"]),
365
+ "&::after": {
366
+ content: '""',
367
+ width: "0.3125em",
368
+ height: "0.5625em",
369
+ "box-sizing": "border-box",
370
+ border: "solid var(--ui-check-mark, var(--ui-on-c))",
371
+ "border-width": "0 2px 2px 0",
372
+ transform: "translateY(-8%) rotate(45deg) scale(0)",
373
+ transition: "transform 0.12s ease",
374
+ "font-size": "var(--ui-check-size, 1.125rem)",
375
+ },
376
+ "&:hover": { "border-color": "var(--ui-c)" },
377
+ '&:checked, &:indeterminate, &[aria-checked="true"], &[aria-checked="mixed"]': {
378
+ "background-color": "var(--ui-c)",
379
+ "border-color": "var(--ui-c-text)",
380
+ },
381
+ '&:checked::after, &[aria-checked="true"]::after': {
382
+ transform: "translateY(-8%) rotate(45deg) scale(1)",
383
+ },
384
+ '&:indeterminate::after, &[aria-checked="mixed"]::after': {
385
+ width: "0.55em",
386
+ height: "2px",
387
+ "border-width": "0",
388
+ "background-color": "var(--ui-check-mark, var(--ui-on-c))",
389
+ transform: "scale(1)",
390
+ },
391
+ "&:focus-visible": focusRing,
392
+ },
393
+ intents,
394
+ styles: {
395
+ outline: {
396
+ "--ui-check-mark": "var(--ui-c-text)",
397
+ "border-color": "var(--ui-c-text)",
398
+ '&:checked, &:indeterminate, &[aria-checked="true"], &[aria-checked="mixed"]': { "background-color": "transparent" },
399
+ },
400
+ ghost: {
401
+ "--ui-check-mark": "var(--ui-c-soft-fg)",
402
+ "background-color": "var(--ui-surface-muted)",
403
+ "border-color": "transparent",
404
+ '&:checked, &:indeterminate, &[aria-checked="true"], &[aria-checked="mixed"]': {
405
+ "background-color": "var(--ui-c-soft)",
406
+ "border-color": "transparent",
407
+ },
408
+ },
409
+ soft: {
410
+ "--ui-check-mark": "var(--ui-c-soft-fg)",
411
+ '&:checked, &:indeterminate, &[aria-checked="true"], &[aria-checked="mixed"]': {
412
+ "background-color": "var(--ui-c-soft)",
413
+ "border-color": "var(--ui-c-text)",
414
+ },
415
+ },
416
+ },
417
+ sizes: {
418
+ sm: { "--ui-check-size": "0.9375rem" },
419
+ lg: { "--ui-check-size": "1.5rem" },
420
+ },
421
+ states: {
422
+ disabled: { opacity: "0.5", cursor: "not-allowed" },
423
+ loading: { cursor: "progress", animation: "ui-pulse 1.2s ease-in-out infinite" },
424
+ active: { "box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 30%, transparent)" },
425
+ },
426
+ },
427
+ radio: {
428
+ base: {
429
+ ...neutralVars,
430
+ appearance: "none",
431
+ display: "inline-grid",
432
+ "place-content": "center",
433
+ "flex-shrink": "0",
434
+ "box-sizing": "border-box",
435
+ width: "var(--ui-radio-size, 1.125rem)",
436
+ height: "var(--ui-radio-size, 1.125rem)",
437
+ margin: "0",
438
+ "vertical-align": "middle",
439
+ cursor: "pointer",
440
+ "background-color": "var(--ui-surface)",
441
+ border: "1px solid color-mix(in oklab, var(--ui-border) 55%, var(--ui-surface-fg))",
442
+ "border-radius": "50%",
443
+ transition: transition(["background-color", "border-color", "box-shadow"]),
444
+ "&::after": {
445
+ content: '""',
446
+ width: "var(--ui-radio-dot-size, 0.5em)",
447
+ height: "var(--ui-radio-dot-size, 0.5em)",
448
+ "border-radius": "50%",
449
+ "background-color": "var(--ui-radio-dot, var(--ui-on-c))",
450
+ transform: "scale(0)",
451
+ transition: "transform 0.12s ease",
452
+ "font-size": "var(--ui-radio-size, 1.125rem)",
453
+ "@media (prefers-reduced-motion: reduce)": { transition: "none" },
454
+ },
455
+ "&:hover": { "border-color": "var(--ui-c)" },
456
+ '&:checked, &[aria-checked="true"]': {
457
+ "background-color": "var(--ui-c)",
458
+ "border-color": "var(--ui-c-text)",
459
+ },
460
+ '&:checked::after, &[aria-checked="true"]::after': { transform: "scale(1)" },
461
+ "&:focus-visible": focusRing,
462
+ "@media (prefers-reduced-motion: reduce)": { transition: "none" },
463
+ },
464
+ intents,
465
+ styles: {
466
+ outline: {
467
+ "--ui-radio-dot": "var(--ui-c-text)",
468
+ "border-color": "var(--ui-c-text)",
469
+ '&:checked, &[aria-checked="true"]': { "background-color": "transparent" },
470
+ },
471
+ ghost: {
472
+ "--ui-radio-dot": "var(--ui-c-soft-fg)",
473
+ "background-color": "var(--ui-surface-muted)",
474
+ "border-color": "transparent",
475
+ '&:checked, &[aria-checked="true"]': {
476
+ "background-color": "var(--ui-c-soft)",
477
+ "border-color": "transparent",
478
+ },
479
+ },
480
+ soft: {
481
+ "--ui-radio-dot": "var(--ui-c-soft-fg)",
482
+ '&:checked, &[aria-checked="true"]': {
483
+ "background-color": "var(--ui-c-soft)",
484
+ "border-color": "var(--ui-c-text)",
485
+ },
486
+ },
487
+ },
488
+ sizes: {
489
+ sm: { "--ui-radio-size": "0.9375rem" },
490
+ lg: { "--ui-radio-size": "1.5rem" },
491
+ },
492
+ states: {
493
+ disabled: { opacity: "0.5", cursor: "not-allowed" },
494
+ loading: { cursor: "progress", animation: "ui-pulse 1.2s ease-in-out infinite" },
495
+ active: { "box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 30%, transparent)" },
496
+ },
497
+ },
498
+ switch: {
499
+ base: {
500
+ ...neutralVars,
501
+ appearance: "none",
502
+ display: "inline-grid",
503
+ "align-items": "center",
504
+ "flex-shrink": "0",
505
+ "box-sizing": "border-box",
506
+ width: "calc(var(--ui-switch-size, 1.25rem) * 1.75)",
507
+ height: "var(--ui-switch-size, 1.25rem)",
508
+ margin: "0",
509
+ padding: "0",
510
+ "vertical-align": "middle",
511
+ cursor: "pointer",
512
+ /* off track: a mid grey mixed from the page text, >= 3:1 on the surface */
513
+ "background-color": "var(--ui-switch-track, color-mix(in oklab, var(--ui-surface-fg) 55%, var(--ui-surface)))",
514
+ border: "1px solid var(--ui-switch-track, color-mix(in oklab, var(--ui-surface-fg) 55%, var(--ui-surface)))",
515
+ "border-radius": "9999px",
516
+ transition: transition(["background-color", "border-color", "box-shadow"]),
517
+ "&::after": {
518
+ content: '""',
519
+ "box-sizing": "border-box",
520
+ width: "calc(var(--ui-switch-size, 1.25rem) - 2px - 2 * var(--ui-switch-pad, 2px))",
521
+ height: "calc(var(--ui-switch-size, 1.25rem) - 2px - 2 * var(--ui-switch-pad, 2px))",
522
+ "border-radius": "9999px",
523
+ "background-color": "var(--ui-switch-thumb, var(--ui-surface))",
524
+ "margin-inline-start": "var(--ui-switch-pad, 2px)",
525
+ transition: "margin-inline-start 0.15s ease, background-color 0.15s ease",
526
+ "@media (prefers-reduced-motion: reduce)": { transition: "none" },
527
+ },
528
+ '&:checked, &[aria-checked="true"]': {
529
+ "background-color": "var(--ui-c)",
530
+ "border-color": "var(--ui-c)",
531
+ },
532
+ '&:checked::after, &[aria-checked="true"]::after': {
533
+ "background-color": "var(--ui-switch-thumb, var(--ui-on-c))",
534
+ "margin-inline-start": "calc(var(--ui-switch-size, 1.25rem) * 0.75 + var(--ui-switch-pad, 2px))",
535
+ },
536
+ "&:focus-visible": focusRing,
537
+ "@media (prefers-reduced-motion: reduce)": { transition: "none" },
538
+ /* Windows high contrast: system colours, so the thumb and the on/off
539
+ state stay visible without relying on background colours. */
540
+ "@media (forced-colors: active)": {
541
+ "forced-color-adjust": "none",
542
+ "background-color": "Canvas !important",
543
+ "border-color": "ButtonText !important",
544
+ "&::after": { "background-color": "ButtonText !important" },
545
+ '&:checked, &[aria-checked="true"]': {
546
+ "background-color": "Highlight !important",
547
+ "border-color": "Highlight !important",
548
+ },
549
+ '&:checked::after, &[aria-checked="true"]::after': {
550
+ "background-color": "HighlightText !important",
551
+ },
552
+ '&:disabled, &[aria-disabled="true"]': {
553
+ "border-color": "GrayText !important",
554
+ "&::after": { "background-color": "GrayText !important" },
555
+ },
556
+ "&:focus-visible": { outline: "2px solid Highlight !important" },
557
+ },
558
+ },
559
+ intents,
560
+ styles: {
561
+ outline: {
562
+ "background-color": "transparent",
563
+ "border-color": "var(--ui-c)",
564
+ "--ui-switch-thumb": "var(--ui-c)",
565
+ },
566
+ ghost: {
567
+ "background-color": "var(--ui-surface-muted)",
568
+ "--ui-switch-thumb": "var(--ui-surface-fg)",
569
+ '&:checked, &[aria-checked="true"]': {
570
+ "background-color": "var(--ui-c-soft)",
571
+ "--ui-switch-thumb": "var(--ui-c-soft-fg)",
572
+ },
573
+ },
574
+ soft: {
575
+ "background-color": "var(--ui-c-soft)",
576
+ "--ui-switch-thumb": "var(--ui-c-soft-fg)",
577
+ '&:checked, &[aria-checked="true"]': {
578
+ "background-color": "var(--ui-c-soft)",
579
+ "border-color": "var(--ui-c)",
580
+ },
581
+ },
582
+ },
583
+ sizes: {
584
+ sm: { "--ui-switch-size": "1rem" },
585
+ lg: { "--ui-switch-size": "1.5rem" },
586
+ },
587
+ states: {
588
+ disabled: { opacity: "0.5", cursor: "not-allowed" },
589
+ loading: {
590
+ cursor: "progress",
591
+ "&::after": { animation: "ui-pulse 1.2s ease-in-out infinite" },
592
+ },
593
+ active: { "box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 30%, transparent)" },
594
+ },
595
+ },
596
+ /* ui-field: label + control + hint/error stack. Hooks: --ui-field-gap,
597
+ --ui-field-label / -hint / -error (text colours). Logical properties only. */
598
+ field: {
599
+ base: {
600
+ display: "flex",
601
+ "flex-direction": "column",
602
+ "align-items": "stretch",
603
+ gap: "var(--ui-field-gap, 0.375rem)",
604
+ "min-inline-size": "0",
605
+ "font-family": "var(--ui-font-sans)",
606
+ },
607
+ },
608
+ "field-label": {
609
+ base: {
610
+ display: "block",
611
+ "font-size": "var(--ui-text-sm)",
612
+ "font-weight": "500",
613
+ "line-height": "1.25",
614
+ color: "var(--ui-field-label, var(--ui-surface-fg))",
615
+ },
616
+ },
617
+ "field-hint": {
618
+ base: {
619
+ margin: "0",
620
+ "font-size": "var(--ui-text-sm)",
621
+ "line-height": "1.4",
622
+ color: "var(--ui-field-hint, color-mix(in oklab, var(--ui-surface-fg) 72%, var(--ui-surface)))",
623
+ "&:empty": { display: "none" },
624
+ },
625
+ },
626
+ "field-error": {
627
+ base: {
628
+ margin: "0",
629
+ "font-size": "var(--ui-text-sm)",
630
+ "font-weight": "500",
631
+ "line-height": "1.4",
632
+ color: "var(--ui-field-error, var(--ui-danger-text, var(--ui-danger)))",
633
+ "&:empty": { display: "none" },
634
+ },
635
+ },
636
+ card: {
637
+ base: {
638
+ ...neutralVars,
639
+ display: "flex",
640
+ "flex-direction": "column",
641
+ "box-sizing": "border-box",
642
+ "font-family": "var(--ui-font-sans)",
643
+ "font-size": "var(--ui-text-md)",
644
+ color: "var(--ui-surface-fg)",
645
+ "background-color": "var(--ui-surface)",
646
+ border: "1px solid var(--ui-card-border, var(--ui-border))",
647
+ "border-radius": "calc(var(--ui-radius) * 1.5)",
648
+ "box-shadow": "0 1px 3px rgb(0 0 0 / 0.08), 0 1px 2px rgb(0 0 0 / 0.04)",
649
+ overflow: "hidden",
650
+ transition: transition(["box-shadow", "border-color", "background-color"]),
651
+ },
652
+ intents: intentMap((i) => ({
653
+ "--ui-card-border": `color-mix(in oklab, var(--ui-${i}) 45%, var(--ui-border))`,
654
+ })),
655
+ styles: {
656
+ outline: { "box-shadow": "none", "border-color": "var(--ui-c)" },
657
+ ghost: {
658
+ "box-shadow": "none",
659
+ "background-color": "transparent",
660
+ "border-color": "transparent",
661
+ },
662
+ soft: {
663
+ "box-shadow": "none",
664
+ "background-color": "var(--ui-c-soft)",
665
+ color: "var(--ui-c-soft-fg)",
666
+ "border-color": "transparent",
667
+ },
668
+ },
669
+ sizes: {
670
+ sm: { "--ui-card-pad": "0.75rem", "font-size": "var(--ui-text-sm)" },
671
+ lg: { "--ui-card-pad": "1.75rem", "font-size": "var(--ui-text-lg)" },
672
+ },
673
+ states: {
674
+ disabled: { opacity: "0.5", "pointer-events": "none" },
675
+ loading: { "pointer-events": "none", animation: "ui-pulse 1.2s ease-in-out infinite" },
676
+ active: {
677
+ "border-color": "var(--ui-c)",
678
+ "box-shadow": "0 0 0 3px color-mix(in oklab, var(--ui-c) 25%, transparent)",
679
+ },
680
+ },
681
+ },
682
+ "card-header": {
683
+ base: {
684
+ padding: "calc(var(--ui-card-pad, 1.25rem) * 0.8) var(--ui-card-pad, 1.25rem)",
685
+ "font-weight": "600",
686
+ "border-bottom": "1px solid var(--ui-border)",
687
+ },
688
+ },
689
+ "card-body": {
690
+ base: { flex: "1 1 auto", padding: "var(--ui-card-pad, 1.25rem)" },
691
+ },
692
+ "card-footer": {
693
+ base: {
694
+ display: "flex",
695
+ "align-items": "center",
696
+ "justify-content": "flex-end",
697
+ gap: "0.5rem",
698
+ padding: "calc(var(--ui-card-pad, 1.25rem) * 0.8) var(--ui-card-pad, 1.25rem)",
699
+ "border-top": "1px solid var(--ui-border)",
700
+ "background-color": "var(--ui-surface-muted)",
701
+ },
702
+ },
703
+ badge: {
704
+ base: {
705
+ ...neutralVars,
706
+ display: "inline-flex",
707
+ "align-items": "center",
708
+ gap: "0.25rem",
709
+ "box-sizing": "border-box",
710
+ "font-family": "var(--ui-font-sans)",
711
+ "font-size": "0.75rem",
712
+ "font-weight": "600",
713
+ "line-height": "1",
714
+ padding: "0.3125rem 0.625rem",
715
+ "border-radius": "9999px",
716
+ border: "1px solid var(--ui-c)",
717
+ "background-color": "var(--ui-c)",
718
+ color: "var(--ui-on-c)",
719
+ "white-space": "nowrap",
720
+ },
721
+ intents,
722
+ styles: {
723
+ outline: { "background-color": "transparent", color: "var(--ui-c-text)" },
724
+ ghost: {
725
+ "background-color": "transparent",
726
+ "border-color": "transparent",
727
+ color: "var(--ui-c-text)",
728
+ },
729
+ soft: {
730
+ "background-color": "var(--ui-c-soft)",
731
+ "border-color": "transparent",
732
+ color: "var(--ui-c-soft-fg)",
733
+ },
734
+ },
735
+ sizes: {
736
+ sm: { "font-size": "0.6875rem", padding: "0.1875rem 0.5rem" },
737
+ lg: { "font-size": "0.875rem", padding: "0.4375rem 0.875rem" },
738
+ },
739
+ states: statusStates,
740
+ },
741
+ alert: {
742
+ base: {
743
+ ...neutralVars,
744
+ display: "flex",
745
+ "align-items": "flex-start",
746
+ gap: "0.75rem",
747
+ "box-sizing": "border-box",
748
+ "font-family": "var(--ui-font-sans)",
749
+ "font-size": "var(--ui-text-md)",
750
+ "line-height": "1.4",
751
+ padding: "0.875rem 1rem",
752
+ "border-radius": "var(--ui-radius)",
753
+ border: "1px solid var(--ui-c)",
754
+ "background-color": "var(--ui-c)",
755
+ color: "var(--ui-on-c)",
756
+ },
757
+ intents,
758
+ styles: {
759
+ outline: { "background-color": "var(--ui-surface)", color: "var(--ui-surface-fg)" },
760
+ ghost: {
761
+ "background-color": "transparent",
762
+ "border-color": "transparent",
763
+ color: "var(--ui-c-text)",
764
+ },
765
+ soft: {
766
+ "background-color": "var(--ui-c-soft)",
767
+ "border-color": "color-mix(in oklab, var(--ui-c) 28%, transparent)",
768
+ color: "var(--ui-c-soft-fg)",
769
+ },
770
+ },
771
+ sizes: {
772
+ sm: { "font-size": "var(--ui-text-sm)", padding: "0.5rem 0.75rem" },
773
+ lg: { "font-size": "var(--ui-text-lg)", padding: "1.125rem 1.375rem" },
774
+ },
775
+ states: statusStates,
776
+ },
777
+ modal: {
778
+ base: {
779
+ /* works as a <div>, a <dialog> (open / showModal) or a :target */
780
+ position: "fixed",
781
+ inset: "0",
782
+ "z-index": "1000",
783
+ display: "flex",
784
+ "align-items": "center",
785
+ "justify-content": "center",
786
+ "box-sizing": "border-box",
787
+ width: "100%",
788
+ height: "100%",
789
+ "max-width": "none",
790
+ "max-height": "none",
791
+ margin: "0",
792
+ padding: "1rem",
793
+ border: "0",
794
+ "background-color": "rgb(0 0 0 / 0.5)",
795
+ visibility: "hidden",
796
+ opacity: "0",
797
+ "pointer-events": "none",
798
+ transition: "opacity 0.2s ease, visibility 0s linear 0.2s",
799
+ "&[open], &:target": {
800
+ visibility: "visible",
801
+ opacity: "1",
802
+ "pointer-events": "auto",
803
+ "transition-delay": "0s",
804
+ },
805
+ "&::backdrop": { background: "transparent" },
806
+ "@media (prefers-reduced-motion: reduce)": { transition: "none" },
807
+ },
808
+ styles: {
809
+ ghost: { "background-color": "transparent" },
810
+ soft: {
811
+ "background-color": "rgb(255 255 255 / 0.6)",
812
+ "backdrop-filter": "blur(6px)",
813
+ },
814
+ },
815
+ sizes: {
816
+ sm: { "--ui-modal-w": "24rem" },
817
+ lg: { "--ui-modal-w": "48rem" },
818
+ },
819
+ states: {
820
+ active: {
821
+ visibility: "visible",
822
+ opacity: "1",
823
+ "pointer-events": "auto",
824
+ "transition-delay": "0s",
825
+ },
826
+ },
827
+ },
828
+ "modal-box": {
829
+ base: {
830
+ ...neutralVars,
831
+ "box-sizing": "border-box",
832
+ width: "min(var(--ui-modal-w, 32rem), 100%)",
833
+ "max-height": "100%",
834
+ overflow: "auto",
835
+ padding: "1.5rem",
836
+ "font-family": "var(--ui-font-sans)",
837
+ "font-size": "var(--ui-text-md)",
838
+ color: "var(--ui-surface-fg)",
839
+ "background-color": "var(--ui-surface)",
840
+ "border-radius": "calc(var(--ui-radius) * 1.5)",
841
+ "border-top": "3px solid transparent",
842
+ "box-shadow": "0 20px 40px -8px rgb(0 0 0 / 0.3), 0 4px 10px rgb(0 0 0 / 0.1)",
843
+ },
844
+ intents: intentMap((i) => ({ "border-top-color": `var(--ui-${i})` })),
845
+ sizes: {
846
+ sm: { padding: "1rem", "font-size": "var(--ui-text-sm)" },
847
+ lg: { padding: "2rem", "font-size": "var(--ui-text-lg)" },
848
+ },
849
+ },
850
+ tabs: {
851
+ base: {
852
+ ...neutralVars,
853
+ display: "flex",
854
+ "flex-wrap": "wrap",
855
+ gap: "0.25rem",
856
+ "font-family": "var(--ui-font-sans)",
857
+ "border-bottom": "1px solid var(--ui-border)",
858
+ },
859
+ intents,
860
+ styles: {
861
+ /* boxed active tab */
862
+ outline: {
863
+ "--ui-tab-active-line": "transparent",
864
+ "--ui-tab-active-shadow": "inset 0 0 0 1px var(--ui-c)",
865
+ "--ui-tab-radius": "var(--ui-radius)",
866
+ "border-bottom-color": "transparent",
867
+ },
868
+ /* bare text, color only */
869
+ ghost: {
870
+ "--ui-tab-active-line": "transparent",
871
+ "--ui-tab-hover-bg": "var(--ui-surface-muted)",
872
+ "--ui-tab-radius": "var(--ui-radius)",
873
+ "border-bottom-color": "transparent",
874
+ },
875
+ /* pill with tinted background */
876
+ soft: {
877
+ "--ui-tab-active-line": "transparent",
878
+ "--ui-tab-active-bg": "var(--ui-c-soft)",
879
+ "--ui-tab-active-fg": "var(--ui-c-soft-fg)",
880
+ "--ui-tab-hover-bg": "var(--ui-surface-muted)",
881
+ "--ui-tab-radius": "var(--ui-radius)",
882
+ "border-bottom-color": "transparent",
883
+ },
884
+ },
885
+ sizes: {
886
+ sm: { "--ui-tab-fs": "var(--ui-text-sm)", "--ui-tab-px": "0.75rem", "--ui-tab-py": "0.375rem" },
887
+ lg: { "--ui-tab-fs": "var(--ui-text-lg)", "--ui-tab-px": "1.25rem", "--ui-tab-py": "0.75rem" },
888
+ },
889
+ },
890
+ tab: {
891
+ base: {
892
+ appearance: "none",
893
+ margin: "0 0 -1px",
894
+ padding: "var(--ui-tab-py, 0.5rem) var(--ui-tab-px, 1rem)",
895
+ "font-family": "inherit",
896
+ "font-size": "var(--ui-tab-fs, var(--ui-text-md))",
897
+ "font-weight": "500",
898
+ "line-height": "1.25",
899
+ color: "color-mix(in oklab, var(--ui-surface-fg) 62%, transparent)",
900
+ "background-color": "transparent",
901
+ border: "0",
902
+ "border-bottom": "2px solid transparent",
903
+ "border-radius": "var(--ui-tab-radius, 0)",
904
+ cursor: "pointer",
905
+ "white-space": "nowrap",
906
+ transition: transition(["color", "background-color", "border-color", "box-shadow"]),
907
+ "&:hover": {
908
+ color: "var(--ui-surface-fg)",
909
+ "background-color": "var(--ui-tab-hover-bg, transparent)",
910
+ },
911
+ "&:focus-visible": { ...focusRing, "outline-offset": "-2px" },
912
+ },
913
+ intents,
914
+ sizes: {
915
+ sm: { "font-size": "var(--ui-text-sm)", padding: "0.375rem 0.75rem" },
916
+ lg: { "font-size": "var(--ui-text-lg)", padding: "0.75rem 1.25rem" },
917
+ },
918
+ states: {
919
+ disabled: { opacity: "0.45", cursor: "not-allowed", "pointer-events": "none" },
920
+ loading: { cursor: "progress", animation: "ui-pulse 1.2s ease-in-out infinite" },
921
+ active: {
922
+ color: "var(--ui-tab-active-fg, var(--ui-c-text, var(--ui-surface-fg)))",
923
+ "background-color": "var(--ui-tab-active-bg, transparent)",
924
+ "border-bottom-color": "var(--ui-tab-active-line, var(--ui-c, var(--ui-surface-fg)))",
925
+ "box-shadow": "var(--ui-tab-active-shadow, none)",
926
+ "&:hover": {
927
+ color: "var(--ui-tab-active-fg, var(--ui-c-text, var(--ui-surface-fg)))",
928
+ "background-color": "var(--ui-tab-active-bg, transparent)",
929
+ },
930
+ },
931
+ },
932
+ },
933
+ },
934
+ });
935
+ /**
936
+ * Base-layer keyframes that can't live inside a component rule.
937
+ * Emitted as `@keyframes <prefix>-<name>`; `animation:` values in this
938
+ * theme reference them as `ui-<name>` and are re-prefixed in buildRules.
939
+ */
940
+ export const defaultKeyframes = {
941
+ spin: { to: { transform: "rotate(360deg)" } },
942
+ pulse: { "50%": { opacity: "0.55" } },
943
+ };
944
+ //# sourceMappingURL=default-theme.js.map