@av-pi-studio/ui-library 0.0.0-stage → 0.0.115

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 (69) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +137 -2
  3. package/dist/brand/config.d.ts +125 -0
  4. package/dist/brand/index.d.ts +3 -0
  5. package/dist/brand/index.js +6 -0
  6. package/dist/brand/theme-injection.d.ts +9 -0
  7. package/dist/breakpoints.d.ts +34 -0
  8. package/dist/breakpoints.js +32 -0
  9. package/dist/chunks/theme-injection-BHAAhBYz.js +103 -0
  10. package/dist/chunks/token-guard-B85Ysv3w.js +813 -0
  11. package/dist/index.d.ts +13 -0
  12. package/dist/index.js +1049 -0
  13. package/dist/kv-store.d.ts +3 -0
  14. package/dist/primitives/Announcer.d.ts +13 -0
  15. package/dist/primitives/Avatar.d.ts +15 -0
  16. package/dist/primitives/Button.d.ts +18 -0
  17. package/dist/primitives/Checkbox.d.ts +11 -0
  18. package/dist/primitives/Dialog.d.ts +58 -0
  19. package/dist/primitives/Divider.d.ts +10 -0
  20. package/dist/primitives/EmptyState.d.ts +11 -0
  21. package/dist/primitives/Icon.d.ts +20 -0
  22. package/dist/primitives/IconButton.d.ts +25 -0
  23. package/dist/primitives/Menu.d.ts +50 -0
  24. package/dist/primitives/Panel.d.ts +9 -0
  25. package/dist/primitives/Popover.d.ts +25 -0
  26. package/dist/primitives/ResizeHandle.d.ts +20 -0
  27. package/dist/primitives/ScreenTitle.d.ts +15 -0
  28. package/dist/primitives/ScrollArea.d.ts +11 -0
  29. package/dist/primitives/Select.d.ts +25 -0
  30. package/dist/primitives/Shortcut.d.ts +15 -0
  31. package/dist/primitives/Spinner.d.ts +14 -0
  32. package/dist/primitives/StatusBadge.d.ts +13 -0
  33. package/dist/primitives/StatusDot.d.ts +17 -0
  34. package/dist/primitives/Surface.d.ts +13 -0
  35. package/dist/primitives/Switch.d.ts +14 -0
  36. package/dist/primitives/TextInput.d.ts +14 -0
  37. package/dist/primitives/ToastViewport.d.ts +17 -0
  38. package/dist/primitives/helpers.d.ts +47 -0
  39. package/dist/primitives/index.d.ts +24 -0
  40. package/dist/primitives/useHover.d.ts +16 -0
  41. package/dist/reset.css +43 -0
  42. package/dist/stores/announcer-store.d.ts +37 -0
  43. package/dist/stores/toast-store.d.ts +37 -0
  44. package/dist/styles.css +1 -0
  45. package/dist/theme/ThemeBoundary.d.ts +38 -0
  46. package/dist/theme/appearance-store.d.ts +37 -0
  47. package/dist/theme/color-utils.d.ts +13 -0
  48. package/dist/theme/colors.d.ts +111 -0
  49. package/dist/theme/css-bridge.d.ts +21 -0
  50. package/dist/theme/dev-warnings.d.ts +23 -0
  51. package/dist/theme/index.d.ts +10 -0
  52. package/dist/theme/index.js +39 -0
  53. package/dist/theme/palette.d.ts +19 -0
  54. package/dist/theme/theme.d.ts +47 -0
  55. package/dist/theme/token-guard.d.ts +20 -0
  56. package/dist/theme/tokens.d.ts +105 -0
  57. package/dist/theme/variants.d.ts +12 -0
  58. package/dist/ui/avatar.d.ts +11 -0
  59. package/dist/ui/button.d.ts +34 -0
  60. package/dist/ui/combobox.d.ts +55 -0
  61. package/dist/ui/index.d.ts +10 -0
  62. package/dist/ui/index.js +406 -0
  63. package/dist/ui/option-groups.d.ts +36 -0
  64. package/dist/ui/screen-header.d.ts +23 -0
  65. package/dist/ui/shortcut.d.ts +13 -0
  66. package/dist/ui/status-badge.d.ts +15 -0
  67. package/dist/ui/status-dot.d.ts +20 -0
  68. package/dist/ui/toast.d.ts +60 -0
  69. package/package.json +68 -4
@@ -0,0 +1,813 @@
1
+ import { c as F, B as N, r as D, i as B } from "./theme-injection-BHAAhBYz.js";
2
+ const C = {
3
+ 0: 0,
4
+ 1: 1,
5
+ 2: 2,
6
+ 3: 3,
7
+ 4: 4,
8
+ 5: 5,
9
+ 6: 6,
10
+ 7: 7,
11
+ 8: 8,
12
+ 10: 10,
13
+ 11: 11,
14
+ 12: 12,
15
+ 14: 14,
16
+ 16: 16,
17
+ 20: 20,
18
+ 24: 24,
19
+ 26: 26,
20
+ 30: 30,
21
+ 32: 32,
22
+ 48: 48,
23
+ 64: 64,
24
+ 80: 80,
25
+ 96: 96,
26
+ 128: 128
27
+ }, h = {
28
+ "4xs": 10,
29
+ // micro badges (queued, command-kind)
30
+ "3xs": 11,
31
+ // micro meta (author label, git status badge)
32
+ "2xs": 12,
33
+ // secondary meta (versions, counts, line numbers, hunk headers)
34
+ xs: 13,
35
+ // dense UI text — the most common rung
36
+ code: 13,
37
+ // code/diff surfaces; tracks its own base, not the prose one
38
+ sm: 14,
39
+ // primary UI text, row titles, tab labels
40
+ md: 15,
41
+ // prose and form controls
42
+ base: 17,
43
+ // document base — inputs, screen titles, composer (FONT_SIZE_BASE anchor)
44
+ lg: 19,
45
+ xl: 21,
46
+ "2xl": 23,
47
+ "3xl": 28,
48
+ "4xl": 36
49
+ }, R = {
50
+ normal: "400",
51
+ medium: "500",
52
+ semibold: "600",
53
+ bold: "700"
54
+ }, j = {
55
+ none: 0,
56
+ sm: 2,
57
+ base: 4,
58
+ md: 6,
59
+ lg: 8,
60
+ xl: 12,
61
+ "2xl": 16,
62
+ full: 9999
63
+ }, L = {
64
+ 0: 0,
65
+ 1: 1,
66
+ 2: 2
67
+ }, I = {
68
+ 0: 0,
69
+ 50: 0.5,
70
+ 100: 1
71
+ }, W = {
72
+ xs: 12,
73
+ sm: 14,
74
+ md: 16,
75
+ lg: 20
76
+ }, U = { diff: 22 }, E = 'system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif', T = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace', ke = '"MesloLGS NF", "MesloLGS Nerd Font Mono", "Cascadia Mono NF", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace';
77
+ function K(e) {
78
+ const r = e === "dark" ? "rgba(0,0,0,0.55)" : "rgba(24,24,27,0.12)";
79
+ return {
80
+ sm: { color: r, offsetX: 0, offsetY: 1, radius: 2, elevation: 1 },
81
+ md: { color: r, offsetX: 0, offsetY: 3, radius: 8, elevation: 4 },
82
+ lg: { color: r, offsetX: 0, offsetY: 10, radius: 24, elevation: 12 }
83
+ };
84
+ }
85
+ const i = (e, r, t, o, n, c, d, u, b, p, S) => ({
86
+ 50: e,
87
+ 100: r,
88
+ 200: t,
89
+ 300: o,
90
+ 400: n,
91
+ 500: c,
92
+ 600: d,
93
+ 700: u,
94
+ 800: b,
95
+ 900: p,
96
+ 950: S
97
+ }), a = {
98
+ zinc: i(
99
+ "#fafafa",
100
+ "#f4f4f5",
101
+ "#e4e4e7",
102
+ "#d4d4d8",
103
+ "#a1a1aa",
104
+ "#71717a",
105
+ "#52525b",
106
+ "#3f3f46",
107
+ "#27272a",
108
+ "#18181b",
109
+ "#09090b"
110
+ ),
111
+ gray: i(
112
+ "#f9fafb",
113
+ "#f3f4f6",
114
+ "#e5e7eb",
115
+ "#d1d5db",
116
+ "#9ca3af",
117
+ "#6b7280",
118
+ "#4b5563",
119
+ "#374151",
120
+ "#1f2937",
121
+ "#111827",
122
+ "#030712"
123
+ ),
124
+ slate: i(
125
+ "#f8fafc",
126
+ "#f1f5f9",
127
+ "#e2e8f0",
128
+ "#cbd5e1",
129
+ "#94a3b8",
130
+ "#64748b",
131
+ "#475569",
132
+ "#334155",
133
+ "#1e293b",
134
+ "#0f172a",
135
+ "#020617"
136
+ ),
137
+ blue: i(
138
+ "#eff6ff",
139
+ "#dbeafe",
140
+ "#bfdbfe",
141
+ "#93c5fd",
142
+ "#60a5fa",
143
+ "#3b82f6",
144
+ "#2563eb",
145
+ "#1d4ed8",
146
+ "#1e40af",
147
+ "#1e3a8a",
148
+ "#172554"
149
+ ),
150
+ green: i(
151
+ "#f0fdf4",
152
+ "#dcfce7",
153
+ "#bbf7d0",
154
+ "#86efac",
155
+ "#4ade80",
156
+ "#22c55e",
157
+ "#16a34a",
158
+ "#15803d",
159
+ "#166534",
160
+ "#14532d",
161
+ "#052e16"
162
+ ),
163
+ red: i(
164
+ "#fef2f2",
165
+ "#fee2e2",
166
+ "#fecaca",
167
+ "#fca5a5",
168
+ "#f87171",
169
+ "#ef4444",
170
+ "#dc2626",
171
+ "#b91c1c",
172
+ "#991b1b",
173
+ "#7f1d1d",
174
+ "#450a0a"
175
+ ),
176
+ teal: i(
177
+ "#f0fdfa",
178
+ "#ccfbf1",
179
+ "#99f6e4",
180
+ "#5eead4",
181
+ "#2dd4bf",
182
+ "#14b8a6",
183
+ "#0d9488",
184
+ "#0f766e",
185
+ "#115e59",
186
+ "#134e4a",
187
+ "#042f2e"
188
+ ),
189
+ amber: i(
190
+ "#fffbeb",
191
+ "#fef3c7",
192
+ "#fde68a",
193
+ "#fcd34d",
194
+ "#fbbf24",
195
+ "#f59e0b",
196
+ "#d97706",
197
+ "#b45309",
198
+ "#92400e",
199
+ "#78350f",
200
+ "#451a03"
201
+ ),
202
+ yellow: i(
203
+ "#fefce8",
204
+ "#fef9c3",
205
+ "#fef08a",
206
+ "#fde047",
207
+ "#facc15",
208
+ "#eab308",
209
+ "#ca8a04",
210
+ "#a16207",
211
+ "#854d0e",
212
+ "#713f12",
213
+ "#422006"
214
+ ),
215
+ purple: i(
216
+ "#faf5ff",
217
+ "#f3e8ff",
218
+ "#e9d5ff",
219
+ "#d8b4fe",
220
+ "#c084fc",
221
+ "#a855f7",
222
+ "#9333ea",
223
+ "#7e22ce",
224
+ "#6b21a8",
225
+ "#581c87",
226
+ "#3b0764"
227
+ ),
228
+ orange: i(
229
+ "#fff7ed",
230
+ "#ffedd5",
231
+ "#fed7aa",
232
+ "#fdba74",
233
+ "#fb923c",
234
+ "#f97316",
235
+ "#ea580c",
236
+ "#c2410c",
237
+ "#9a3412",
238
+ "#7c2d12",
239
+ "#431407"
240
+ ),
241
+ white: "#ffffff",
242
+ black: "#000000"
243
+ }, G = {
244
+ statusSuccess: "#16a34a",
245
+ // green-600
246
+ statusDanger: "#dc2626",
247
+ // red-600
248
+ statusWarning: "#f59e0b",
249
+ // amber-500
250
+ statusMerged: "#9333ea",
251
+ // purple-600
252
+ statusInfo: "#3b82f6"
253
+ // blue-500
254
+ }, P = {
255
+ statusSuccess: "#15803d",
256
+ // green-700
257
+ statusDanger: "#b91c1c",
258
+ // red-700
259
+ statusWarning: "#d97706",
260
+ // amber-600
261
+ statusMerged: "#7c3aed",
262
+ // purple-600
263
+ statusInfo: "#2563eb"
264
+ // blue-600
265
+ };
266
+ function V() {
267
+ return {
268
+ keyword: a.purple[300],
269
+ string: a.green[300],
270
+ number: a.orange[300],
271
+ boolean: a.orange[300],
272
+ comment: a.zinc[500],
273
+ function: a.blue[300],
274
+ variable: a.zinc[200],
275
+ type: a.teal[300],
276
+ class: a.amber[300],
277
+ constant: a.orange[300],
278
+ operator: a.zinc[400],
279
+ punctuation: a.zinc[400],
280
+ tag: a.red[300],
281
+ attribute: a.amber[300],
282
+ property: a.blue[200],
283
+ regexp: a.teal[300],
284
+ escape: a.orange[200],
285
+ heading: a.blue[300],
286
+ link: a.blue[400],
287
+ deleted: a.red[400],
288
+ inserted: a.green[400]
289
+ };
290
+ }
291
+ function Y() {
292
+ return {
293
+ keyword: a.purple[700],
294
+ string: a.green[700],
295
+ number: a.orange[700],
296
+ boolean: a.orange[700],
297
+ comment: a.zinc[500],
298
+ function: a.blue[700],
299
+ variable: a.zinc[800],
300
+ type: a.teal[700],
301
+ class: a.amber[700],
302
+ constant: a.orange[700],
303
+ operator: a.zinc[600],
304
+ punctuation: a.zinc[600],
305
+ tag: a.red[700],
306
+ attribute: a.amber[700],
307
+ property: a.blue[700],
308
+ regexp: a.teal[700],
309
+ escape: a.orange[700],
310
+ heading: a.blue[700],
311
+ link: a.blue[600],
312
+ deleted: a.red[700],
313
+ inserted: a.green[700]
314
+ };
315
+ }
316
+ function x(e, r, t) {
317
+ return {
318
+ background: e,
319
+ foreground: r,
320
+ cursor: t,
321
+ cursorAccent: e,
322
+ selectionBackground: "rgba(255,255,255,0.18)",
323
+ black: a.zinc[900],
324
+ red: a.red[500],
325
+ green: a.green[500],
326
+ yellow: a.amber[500],
327
+ blue: a.blue[500],
328
+ magenta: a.purple[500],
329
+ cyan: a.teal[500],
330
+ white: a.zinc[300],
331
+ brightBlack: a.zinc[600],
332
+ brightRed: a.red[400],
333
+ brightGreen: a.green[400],
334
+ brightYellow: a.amber[400],
335
+ brightBlue: a.blue[400],
336
+ brightMagenta: a.purple[400],
337
+ brightCyan: a.teal[400],
338
+ brightWhite: a.zinc[50]
339
+ };
340
+ }
341
+ function m(e) {
342
+ const r = a.zinc[50], t = F(e.accent);
343
+ return {
344
+ surface0: e.surface0,
345
+ surface1: e.surface1,
346
+ surface2: e.surface2,
347
+ surface3: e.surface3,
348
+ surface4: e.surface4,
349
+ surfaceDiffEmpty: e.surfaceDiffEmpty,
350
+ surfaceSidebar: e.surfaceSidebar,
351
+ surfaceSidebarHover: e.surfaceSidebarHover,
352
+ // Paseo dark: the workspace surface is surface1 (not the app background surface0).
353
+ surfaceWorkspace: e.surface1,
354
+ foreground: r,
355
+ foregroundMuted: e.mutedForeground,
356
+ accent: e.accent,
357
+ accentBright: e.accentBright,
358
+ accentForeground: t,
359
+ destructive: e.destructive,
360
+ destructiveForeground: a.white,
361
+ // Paseo: success uses the theme accent in dark.
362
+ success: e.accent,
363
+ successForeground: a.white,
364
+ border: e.border,
365
+ borderAccent: e.borderAccent,
366
+ ...G,
367
+ diffAddition: a.green[400],
368
+ // #4ade80
369
+ diffDeletion: a.red[500],
370
+ // #ef4444
371
+ scrollbarHandle: e.scrollbarHandle,
372
+ // Legacy aliases → nearest semantic token
373
+ background: e.surface0,
374
+ popover: e.surface2,
375
+ popoverForeground: r,
376
+ primary: e.accent,
377
+ secondary: e.surface2,
378
+ muted: e.surface2,
379
+ mutedForeground: e.mutedForeground,
380
+ input: e.surface2,
381
+ ring: e.accent,
382
+ palette: a,
383
+ syntax: V(),
384
+ terminal: x(e.surface0, r, e.accent)
385
+ };
386
+ }
387
+ function Z() {
388
+ const e = "#1a1a1e", r = "#253e6f";
389
+ return {
390
+ surface0: "#ffffff",
391
+ surface1: "#fafafa",
392
+ surface2: "#f4f4f5",
393
+ surface3: "#e4e4e7",
394
+ surface4: "#d4d4d8",
395
+ surfaceDiffEmpty: "#f6f6f6",
396
+ surfaceSidebar: "#f4f4f5",
397
+ surfaceSidebarHover: "#e9e9ec",
398
+ surfaceWorkspace: "#ffffff",
399
+ foreground: e,
400
+ foregroundMuted: "#71717a",
401
+ accent: r,
402
+ accentBright: "#2f4f8e",
403
+ accentForeground: F(r),
404
+ destructive: "#b04138",
405
+ destructiveForeground: "#ffffff",
406
+ success: r,
407
+ successForeground: "#ffffff",
408
+ border: "#e4e4e7",
409
+ borderAccent: "#ececf1",
410
+ ...P,
411
+ diffAddition: "#15803d",
412
+ // green-700
413
+ diffDeletion: "#b91c1c",
414
+ // red-700
415
+ scrollbarHandle: "#3f3f46",
416
+ // zinc-700
417
+ background: "#ffffff",
418
+ popover: "#ffffff",
419
+ popoverForeground: e,
420
+ primary: r,
421
+ secondary: "#f4f4f5",
422
+ muted: "#f4f4f5",
423
+ mutedForeground: "#71717a",
424
+ input: "#f4f4f5",
425
+ ring: r,
426
+ palette: a,
427
+ syntax: Y(),
428
+ terminal: {
429
+ ...x("#ffffff", e, r),
430
+ selectionBackground: "rgba(0,0,0,0.15)",
431
+ white: "#ffffff",
432
+ brightWhite: "#fafafa"
433
+ }
434
+ };
435
+ }
436
+ const X = {
437
+ light: "#ffffff",
438
+ dark: "#3b62b0",
439
+ zinc: "#808080",
440
+ midnight: "#4A6BA8",
441
+ claude: "#D97757",
442
+ ghostty: "#8caaee"
443
+ }, A = [
444
+ "light",
445
+ "dark",
446
+ "zinc",
447
+ "midnight",
448
+ "claude",
449
+ "ghostty"
450
+ ];
451
+ function q(e) {
452
+ if (e === "light") return Z();
453
+ switch (e) {
454
+ // Paseo — subtle teal-green tint (default). Exact values from Paseo `paseoDarkColors`.
455
+ case "dark":
456
+ return m({
457
+ surface0: "#181B1A",
458
+ surface1: "#1E2120",
459
+ surface2: "#272A29",
460
+ surface3: "#434645",
461
+ surface4: "#595B5B",
462
+ surfaceDiffEmpty: "#252827",
463
+ surfaceSidebar: "#141716",
464
+ surfaceSidebarHover: "#1c1f1e",
465
+ mutedForeground: "#A1A5A4",
466
+ scrollbarHandle: "#717574",
467
+ border: "#252B2A",
468
+ borderAccent: "#2f3135",
469
+ accent: "#2e5cb8",
470
+ accentBright: "#a2b4d7",
471
+ destructive: "#c64f43"
472
+ });
473
+ // Zinc — neutral gray, no tint. Exact values from Paseo `zincDarkColors`.
474
+ case "zinc":
475
+ return m({
476
+ surface0: "#18181b",
477
+ surface1: "#1f1f22",
478
+ surface2: "#27272a",
479
+ surface3: "#3f3f46",
480
+ surface4: "#52525b",
481
+ surfaceDiffEmpty: "#242427",
482
+ surfaceSidebar: "#131316",
483
+ surfaceSidebarHover: "#1b1b1e",
484
+ mutedForeground: "#a1a1aa",
485
+ scrollbarHandle: "#71717a",
486
+ border: "#27272a",
487
+ borderAccent: "#303036",
488
+ accent: "#e4e4e7",
489
+ accentBright: "#fafafa",
490
+ destructive: "#c44a4a"
491
+ });
492
+ // Midnight — subtle blue tint. Exact values from Paseo `midnightDarkColors`.
493
+ case "midnight":
494
+ return m({
495
+ surface0: "#161820",
496
+ surface1: "#1c1e27",
497
+ surface2: "#252731",
498
+ surface3: "#3c3e4c",
499
+ surface4: "#535564",
500
+ surfaceDiffEmpty: "#222430",
501
+ surfaceSidebar: "#121420",
502
+ surfaceSidebarHover: "#1a1c28",
503
+ mutedForeground: "#9a9db0",
504
+ scrollbarHandle: "#6b6e82",
505
+ border: "#242636",
506
+ borderAccent: "#2e3040",
507
+ accent: "#3b6fcf",
508
+ accentBright: "#7eaaeb",
509
+ destructive: "#c44a52"
510
+ });
511
+ // Claude — warm neutral with subtle orange undertone. From Paseo `claudeDarkColors`.
512
+ case "claude":
513
+ return m({
514
+ surface0: "#1f1f1e",
515
+ surface1: "#262523",
516
+ surface2: "#2f2d2b",
517
+ surface3: "#4a4745",
518
+ surface4: "#605d5b",
519
+ surfaceDiffEmpty: "#2a2826",
520
+ surfaceSidebar: "#1a1918",
521
+ surfaceSidebarHover: "#222120",
522
+ mutedForeground: "#ada9a5",
523
+ scrollbarHandle: "#78746f",
524
+ border: "#2c2a27",
525
+ borderAccent: "#36332f",
526
+ accent: "#d97757",
527
+ accentBright: "#e89a7f",
528
+ destructive: "#cf513e"
529
+ });
530
+ // Ghostty — blue-tinted dark. Exact values from Paseo `ghosttyDarkColors`.
531
+ case "ghostty":
532
+ return m({
533
+ surface0: "#282c34",
534
+ surface1: "#2f333d",
535
+ surface2: "#383c48",
536
+ surface3: "#4a4f5e",
537
+ surface4: "#5b6175",
538
+ surfaceDiffEmpty: "#323643",
539
+ surfaceSidebar: "#21252d",
540
+ surfaceSidebarHover: "#292d36",
541
+ mutedForeground: "#c8ccd8",
542
+ scrollbarHandle: "#a0a4b2",
543
+ border: "#353a47",
544
+ borderAccent: "#3f4454",
545
+ accent: "#89b4fa",
546
+ accentBright: "#b4d0fc",
547
+ destructive: "#c44a55"
548
+ });
549
+ }
550
+ }
551
+ const z = {};
552
+ for (const e of A) {
553
+ const r = e === "light" ? "light" : "dark";
554
+ z[e] = {
555
+ name: e,
556
+ colorScheme: r,
557
+ colors: q(e),
558
+ swatch: X[e]
559
+ };
560
+ }
561
+ const J = z;
562
+ function w(e) {
563
+ const r = J[e];
564
+ return {
565
+ name: e,
566
+ colorScheme: r.colorScheme,
567
+ colors: r.colors,
568
+ spacing: C,
569
+ fontSize: { ...h },
570
+ fontFamily: {
571
+ ui: E,
572
+ mono: T
573
+ },
574
+ lineHeight: { ...U },
575
+ iconSize: W,
576
+ fontWeight: R,
577
+ borderRadius: j,
578
+ borderWidth: L,
579
+ opacity: I,
580
+ shadow: K(r.colorScheme),
581
+ swatch: r.swatch
582
+ };
583
+ }
584
+ const Q = h.base, ee = 10, re = 24;
585
+ function ae(e, r) {
586
+ const t = r.themeName ?? e.name, o = w(t), n = r.uiFont && r.uiFont.trim() !== "" ? r.uiFont : E, c = r.monoFont && r.monoFont.trim() !== "" ? r.monoFont : T, d = { ...o.fontSize };
587
+ if (r.fontSize != null) {
588
+ const b = Math.max(ee, Math.min(re, r.fontSize)) / Q;
589
+ for (const p of Object.keys(h))
590
+ d[p] = Math.round(h[p] * b);
591
+ }
592
+ return {
593
+ ...o,
594
+ fontSize: d,
595
+ fontFamily: { ui: n, mono: c }
596
+ };
597
+ }
598
+ function _(e) {
599
+ return w(e);
600
+ }
601
+ const oe = "dark", te = 16;
602
+ function ne(e) {
603
+ const r = e / te;
604
+ return `${Number(r.toFixed(4))}rem`;
605
+ }
606
+ function M(e) {
607
+ const r = {};
608
+ ce(e.colors, r);
609
+ for (const [t, o] of Object.entries(e.spacing))
610
+ r[`--pi-spacing-${t}`] = `${o}px`;
611
+ for (const [t, o] of Object.entries(e.fontSize))
612
+ r[`--pi-font-size-${t}`] = ne(o);
613
+ r["--pi-font-ui"] = e.fontFamily.ui, r["--pi-font-mono"] = e.fontFamily.mono, r["--pi-line-height-diff"] = `${e.lineHeight.diff}px`;
614
+ for (const [t, o] of Object.entries(e.iconSize))
615
+ r[`--pi-icon-size-${t}`] = `${o}px`;
616
+ for (const [t, o] of Object.entries(e.fontWeight))
617
+ r[`--pi-font-weight-${t}`] = String(o);
618
+ for (const [t, o] of Object.entries(e.borderRadius))
619
+ r[`--pi-radius-${t}`] = o === 9999 ? "9999px" : `${o}px`;
620
+ for (const [t, o] of Object.entries(e.borderWidth))
621
+ r[`--pi-border-width-${t}`] = `${o}px`;
622
+ for (const [t, o] of Object.entries(e.opacity))
623
+ r[`--pi-opacity-${t}`] = String(o);
624
+ for (const [t, o] of Object.entries(e.shadow))
625
+ if (typeof o == "string")
626
+ r[`--pi-shadow-${t}`] = o;
627
+ else if (o && typeof o == "object") {
628
+ const n = o;
629
+ r[`--pi-shadow-${t}`] = `${n.offsetX}px ${n.offsetY}px ${n.radius}px ${n.color}`;
630
+ }
631
+ return r["--pi-color-scheme"] = e.colorScheme, r;
632
+ }
633
+ function ce(e, r) {
634
+ const { palette: t, syntax: o, terminal: n, ...c } = e;
635
+ for (const [d, u] of Object.entries(c))
636
+ typeof u == "string" && (r[`--pi-color-${d}`] = u);
637
+ o && se(o, r), n && (r["--pi-terminal-bg"] = n.background, r["--pi-terminal-fg"] = n.foreground);
638
+ }
639
+ function se(e, r) {
640
+ for (const [t, o] of Object.entries(e))
641
+ typeof o == "string" && (r[`--syntax-${fe(t)}`] = o);
642
+ }
643
+ function fe(e) {
644
+ return e.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`);
645
+ }
646
+ function ie(e) {
647
+ if (typeof document > "u") return;
648
+ const r = document.documentElement.style;
649
+ for (const [o, n] of Object.entries(e))
650
+ r.setProperty(o, n);
651
+ const t = e["--pi-color-scheme"];
652
+ t && document.documentElement.style.setProperty("color-scheme", t);
653
+ }
654
+ function de(e) {
655
+ const r = M(e);
656
+ ie(r);
657
+ }
658
+ const ue = "pi-studio-appearance";
659
+ function le(e) {
660
+ if (e === void 0) return;
661
+ const r = N.safeParse(e);
662
+ if (r.success) return r.data;
663
+ const t = r.error.issues.map((o) => `${o.path.join(".") || "(root)"}: ${o.message}`);
664
+ console.warn(
665
+ `[ui-library] Ignoring invalid brandConfig, using the unbranded theme. ${t.join("; ")}`
666
+ );
667
+ }
668
+ function be(e) {
669
+ return e === "system" ? typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : e;
670
+ }
671
+ function Ae(e, r, t = {}) {
672
+ const o = t.storageKey ?? ue, n = le(r);
673
+ let c = S(), d = null;
674
+ const u = /* @__PURE__ */ new Set();
675
+ function b(s, l) {
676
+ const g = be(s), k = _(g);
677
+ let f = ae(k, { ...l, themeName: g });
678
+ if (n?.colors) {
679
+ const H = D(n.colors);
680
+ f = B(f, H);
681
+ }
682
+ return f;
683
+ }
684
+ function p() {
685
+ const s = JSON.stringify({ mode: c.mode, settings: c.settings });
686
+ e.set(o, s);
687
+ }
688
+ function S() {
689
+ const s = e.get(o);
690
+ let l = oe, g = {};
691
+ if (s)
692
+ try {
693
+ const f = JSON.parse(s);
694
+ f.mode && (A.includes(f.mode) || f.mode === "system") && (l = f.mode), f.settings && typeof f.settings == "object" && (g = f.settings);
695
+ } catch {
696
+ }
697
+ const k = b(l, g);
698
+ return { mode: l, settings: g, resolvedTheme: k };
699
+ }
700
+ function v() {
701
+ c = { ...c, resolvedTheme: b(c.mode, c.settings) }, p();
702
+ for (const s of u) s();
703
+ }
704
+ const y = {
705
+ getState() {
706
+ return c;
707
+ },
708
+ setMode(s) {
709
+ c = { ...c, mode: s }, v(), y.apply();
710
+ },
711
+ updateSettings(s) {
712
+ c = { ...c, settings: { ...c.settings, ...s } }, v(), y.apply();
713
+ },
714
+ apply() {
715
+ de(c.resolvedTheme);
716
+ },
717
+ listen() {
718
+ if (typeof window > "u") return () => {
719
+ };
720
+ const s = window.matchMedia("(prefers-color-scheme: dark)"), l = () => {
721
+ c.mode === "system" && (v(), y.apply());
722
+ };
723
+ return s.addEventListener("change", l), d = () => s.removeEventListener("change", l), d;
724
+ },
725
+ subscribe(s) {
726
+ return u.add(s), () => u.delete(s);
727
+ }
728
+ };
729
+ return y;
730
+ }
731
+ const pe = /var\(\s*(--(?:pi|syntax)-[a-zA-Z0-9_.-]+)(\$\{)?/g, ge = /font-size:\s*([^;]+);/g, me = /var\(\s*--pi-font-size-([\w-]+)/g, he = /^--(?:pi|syntax)-[a-zA-Z0-9_-]+$/;
732
+ function ye() {
733
+ const e = /* @__PURE__ */ new Set();
734
+ for (const r of A)
735
+ for (const t of Object.keys(M(_(r)))) e.add(t);
736
+ return e;
737
+ }
738
+ function Se(e) {
739
+ return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\n]*/g, "");
740
+ }
741
+ function $(e) {
742
+ return [...Se(e).matchAll(pe)].filter((r) => r[2] === void 0).map((r) => r[1]);
743
+ }
744
+ function O(e) {
745
+ return e.path.endsWith(".css") ? [...e.text.matchAll(ge)].map((r) => r[1].trim()) : [];
746
+ }
747
+ function Fe(e) {
748
+ let r = 0, t = 0;
749
+ for (const o of e)
750
+ r += $(o.text).length, t += O(o).length;
751
+ return { varRefs: r, fontSizeDeclarations: t };
752
+ }
753
+ function Ee(e) {
754
+ const r = ye(), t = [];
755
+ for (const o of r)
756
+ he.test(o) || t.push({
757
+ kind: "illegal-key",
758
+ path: "(theme)",
759
+ message: `emitted key ${o} is not a legal CSS custom-property name`
760
+ });
761
+ for (const o of e) {
762
+ for (const n of $(o.text))
763
+ r.has(n) || t.push({
764
+ kind: "dangling-var",
765
+ path: o.path,
766
+ message: `var(${n}) does not match any token the theme emits`
767
+ });
768
+ for (const n of O(o)) {
769
+ /\d\s*(px|rem)/.test(n) && t.push({
770
+ kind: "literal-font-size",
771
+ path: o.path,
772
+ message: `font-size: ${n} is hardcoded; use a --pi-font-size-<rung> token`
773
+ });
774
+ for (const c of n.matchAll(me))
775
+ c[1] in h || t.push({
776
+ kind: "unknown-font-rung",
777
+ path: o.path,
778
+ message: `--pi-font-size-${c[1]} is not a rung of baseFontSize`
779
+ });
780
+ }
781
+ }
782
+ return t;
783
+ }
784
+ export {
785
+ ue as D,
786
+ ke as T,
787
+ T as a,
788
+ oe as b,
789
+ E as c,
790
+ A as d,
791
+ X as e,
792
+ J as f,
793
+ ae as g,
794
+ de as h,
795
+ ie as i,
796
+ h as j,
797
+ U as k,
798
+ j as l,
799
+ L as m,
800
+ m as n,
801
+ Z as o,
802
+ K as p,
803
+ Fe as q,
804
+ Ae as r,
805
+ Ee as s,
806
+ M as t,
807
+ R as u,
808
+ _ as v,
809
+ W as w,
810
+ I as x,
811
+ a as y,
812
+ C as z
813
+ };