@weasel-js/theme 0.7.2 → 1.0.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.
@@ -0,0 +1,786 @@
1
+ // src/generated/themes.ts
2
+ var THEMES = {
3
+ "weasel": {
4
+ name: "weasel",
5
+ defaultMode: "dark",
6
+ modes: {
7
+ "dark": {
8
+ "--wzl-gray-50": "#f5f5f6",
9
+ "--wzl-gray-100": "#e6e7e9",
10
+ "--wzl-gray-200": "#c9cbcf",
11
+ "--wzl-gray-300": "#9ea1a8",
12
+ "--wzl-gray-400": "#6f737b",
13
+ "--wzl-gray-500": "#4d5058",
14
+ "--wzl-gray-600": "#383b42",
15
+ "--wzl-gray-700": "#25272c",
16
+ "--wzl-gray-800": "#181a1e",
17
+ "--wzl-gray-900": "#0e0f12",
18
+ "--wzl-accent-soft": "#1d1454",
19
+ "--wzl-accent-base": "#2e1f7a",
20
+ "--wzl-accent-strong": "#5841b8",
21
+ "--wzl-danger-base": "#d94a3f",
22
+ "--wzl-warning-base": "#d99a3f",
23
+ "--wzl-success-base": "#2ec27e",
24
+ "--wzl-fg-on-accent": "#f5f5f6",
25
+ "--wzl-fg": "#e6e7e9",
26
+ "--wzl-line-subtle": "rgba(230, 231, 233, 0.1)",
27
+ "--wzl-line": "rgba(230, 231, 233, 0.2)",
28
+ "--wzl-line-strong": "rgba(230, 231, 233, 0.4)",
29
+ "--wzl-curve-color": "#5841b8",
30
+ "--wzl-accent": "#2e1f7a",
31
+ "--wzl-accent-hover": "#5841b8",
32
+ "--wzl-danger": "#d94a3f",
33
+ "--wzl-warning": "#d99a3f",
34
+ "--wzl-success": "#2ec27e",
35
+ "--wzl-focus-ring": "#5841b8",
36
+ "--wzl-glass-tint": "#2e1f7a",
37
+ "--wzl-surface-hover": "rgba(230, 231, 233, 0.1)",
38
+ "--wzl-surface-pressed": "rgba(230, 231, 233, 0.18)",
39
+ "--wzl-swatch-green": "#2fdd18",
40
+ "--wzl-swatch-pink": "#ff5885",
41
+ "--wzl-swatch-cyan": "#00dfff",
42
+ "--wzl-swatch-gold": "#dcb700",
43
+ "--wzl-swatch-amber": "#ff8c00",
44
+ "--wzl-swatch-violet": "#a497ff",
45
+ "--wzl-swatch-mint": "#00e7af",
46
+ "--wzl-swatch-sky": "#00b8ff",
47
+ "--wzl-swatch-orange": "#ff6b00",
48
+ "--wzl-swatch-magenta": "#ff6eff",
49
+ "--wzl-radius-sm": "3px",
50
+ "--wzl-radius-md": "5px",
51
+ "--wzl-border-w": "1px",
52
+ "--wzl-line-width": "2px",
53
+ "--wzl-curve-width": "3px",
54
+ "--wzl-tb-height": "28px",
55
+ "--wzl-radius-lg": "14px",
56
+ "--wzl-control-h": "28px",
57
+ "--wzl-glass-blur": "3px",
58
+ "--wzl-font-size": "13px",
59
+ "--wzl-font-size-sm": "11px",
60
+ "--wzl-space-xs": "4px",
61
+ "--wzl-space-sm": "8px",
62
+ "--wzl-space-md": "12px",
63
+ "--wzl-space-lg": "16px",
64
+ "--wzl-z-toolbar": "10",
65
+ "--wzl-z-overlay": "20",
66
+ "--wzl-z-modal": "30",
67
+ "--wzl-backdrop": "none",
68
+ "--wzl-motion-fast": "120ms",
69
+ "--wzl-motion-medium": "240ms",
70
+ "--wzl-ease-in-cubic": "cubic-bezier(0.32, 0, 0.67, 0)",
71
+ "--wzl-ease-out-cubic": "cubic-bezier(0.33, 1, 0.68, 1)",
72
+ "--wzl-ease-in-out-cubic": "cubic-bezier(0.65, 0, 0.35, 1)",
73
+ "--wzl-ease-out-back": "cubic-bezier(0.34, 1.56, 0.64, 1)",
74
+ "--wzl-font-ui": "Oswald, 'Helvetica Neue Condensed', 'Arial Narrow', system-ui, sans-serif",
75
+ "--wzl-font-display": "Oswald, 'Helvetica Neue Condensed', 'Arial Narrow', system-ui, sans-serif",
76
+ "--wzl-font-body": "Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",
77
+ "--wzl-font-mono": "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
78
+ "--wzl-font-weight-light": "200",
79
+ "--wzl-font-weight-normal": "300",
80
+ "--wzl-font-weight-medium": "350",
81
+ "--wzl-font-weight-bold": "400",
82
+ "--wzl-surface": "#181a1e",
83
+ "--wzl-surface-raised": "#25272c",
84
+ "--wzl-surface-sunken": "#0e0f12",
85
+ "--wzl-fg-muted": "#9ea1a8",
86
+ "--wzl-fg-subtle": "#6f737b",
87
+ "--wzl-border": "#25272c",
88
+ "--wzl-border-strong": "#383b42",
89
+ "--wzl-accent-fg": "#5841b8",
90
+ "--wzl-fg-inverse": "#0e0f12"
91
+ },
92
+ "light": {
93
+ "--wzl-gray-50": "#f5f5f6",
94
+ "--wzl-gray-100": "#e6e7e9",
95
+ "--wzl-gray-200": "#c9cbcf",
96
+ "--wzl-gray-300": "#9ea1a8",
97
+ "--wzl-gray-400": "#6f737b",
98
+ "--wzl-gray-500": "#4d5058",
99
+ "--wzl-gray-600": "#383b42",
100
+ "--wzl-gray-700": "#25272c",
101
+ "--wzl-gray-800": "#181a1e",
102
+ "--wzl-gray-900": "#0e0f12",
103
+ "--wzl-accent-soft": "#1d1454",
104
+ "--wzl-accent-base": "#2e1f7a",
105
+ "--wzl-accent-strong": "#5841b8",
106
+ "--wzl-danger-base": "#d94a3f",
107
+ "--wzl-warning-base": "#d99a3f",
108
+ "--wzl-success-base": "#2ec27e",
109
+ "--wzl-fg-on-accent": "#f5f5f6",
110
+ "--wzl-fg": "#0e0f12",
111
+ "--wzl-line-subtle": "rgba(14, 15, 18, 0.1)",
112
+ "--wzl-line": "rgba(14, 15, 18, 0.2)",
113
+ "--wzl-line-strong": "rgba(14, 15, 18, 0.4)",
114
+ "--wzl-curve-color": "#5841b8",
115
+ "--wzl-accent": "#2e1f7a",
116
+ "--wzl-accent-hover": "#5841b8",
117
+ "--wzl-danger": "#d94a3f",
118
+ "--wzl-warning": "#d99a3f",
119
+ "--wzl-success": "#2ec27e",
120
+ "--wzl-focus-ring": "#5841b8",
121
+ "--wzl-glass-tint": "#2e1f7a",
122
+ "--wzl-surface-hover": "rgba(14, 15, 18, 0.1)",
123
+ "--wzl-surface-pressed": "rgba(14, 15, 18, 0.18)",
124
+ "--wzl-swatch-green": "#2fdd18",
125
+ "--wzl-swatch-pink": "#ff5885",
126
+ "--wzl-swatch-cyan": "#00dfff",
127
+ "--wzl-swatch-gold": "#dcb700",
128
+ "--wzl-swatch-amber": "#ff8c00",
129
+ "--wzl-swatch-violet": "#a497ff",
130
+ "--wzl-swatch-mint": "#00e7af",
131
+ "--wzl-swatch-sky": "#00b8ff",
132
+ "--wzl-swatch-orange": "#ff6b00",
133
+ "--wzl-swatch-magenta": "#ff6eff",
134
+ "--wzl-radius-sm": "3px",
135
+ "--wzl-radius-md": "5px",
136
+ "--wzl-border-w": "1px",
137
+ "--wzl-line-width": "2px",
138
+ "--wzl-curve-width": "3px",
139
+ "--wzl-tb-height": "28px",
140
+ "--wzl-radius-lg": "14px",
141
+ "--wzl-control-h": "28px",
142
+ "--wzl-glass-blur": "3px",
143
+ "--wzl-font-size": "13px",
144
+ "--wzl-font-size-sm": "11px",
145
+ "--wzl-space-xs": "4px",
146
+ "--wzl-space-sm": "8px",
147
+ "--wzl-space-md": "12px",
148
+ "--wzl-space-lg": "16px",
149
+ "--wzl-z-toolbar": "10",
150
+ "--wzl-z-overlay": "20",
151
+ "--wzl-z-modal": "30",
152
+ "--wzl-backdrop": "none",
153
+ "--wzl-motion-fast": "120ms",
154
+ "--wzl-motion-medium": "240ms",
155
+ "--wzl-ease-in-cubic": "cubic-bezier(0.32, 0, 0.67, 0)",
156
+ "--wzl-ease-out-cubic": "cubic-bezier(0.33, 1, 0.68, 1)",
157
+ "--wzl-ease-in-out-cubic": "cubic-bezier(0.65, 0, 0.35, 1)",
158
+ "--wzl-ease-out-back": "cubic-bezier(0.34, 1.56, 0.64, 1)",
159
+ "--wzl-font-ui": "Oswald, 'Helvetica Neue Condensed', 'Arial Narrow', system-ui, sans-serif",
160
+ "--wzl-font-display": "Oswald, 'Helvetica Neue Condensed', 'Arial Narrow', system-ui, sans-serif",
161
+ "--wzl-font-body": "Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",
162
+ "--wzl-font-mono": "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
163
+ "--wzl-font-weight-light": "200",
164
+ "--wzl-font-weight-normal": "300",
165
+ "--wzl-font-weight-medium": "350",
166
+ "--wzl-font-weight-bold": "400",
167
+ "--wzl-surface": "#f5f5f6",
168
+ "--wzl-surface-raised": "#e6e7e9",
169
+ "--wzl-surface-sunken": "#c9cbcf",
170
+ "--wzl-fg-muted": "#383b42",
171
+ "--wzl-fg-subtle": "#4d5058",
172
+ "--wzl-border": "#c9cbcf",
173
+ "--wzl-border-strong": "#9ea1a8",
174
+ "--wzl-accent-fg": "#2e1f7a",
175
+ "--wzl-fg-inverse": "#f5f5f6"
176
+ }
177
+ }
178
+ }
179
+ };
180
+ var THEME_SOURCES = {
181
+ "weasel": {
182
+ "primitives": {
183
+ "gray-50": {
184
+ "type": "color",
185
+ "value": "#f5f5f6"
186
+ },
187
+ "gray-100": {
188
+ "type": "color",
189
+ "value": "#e6e7e9"
190
+ },
191
+ "gray-200": {
192
+ "type": "color",
193
+ "value": "#c9cbcf"
194
+ },
195
+ "gray-300": {
196
+ "type": "color",
197
+ "value": "#9ea1a8"
198
+ },
199
+ "gray-400": {
200
+ "type": "color",
201
+ "value": "#6f737b"
202
+ },
203
+ "gray-500": {
204
+ "type": "color",
205
+ "value": "#4d5058"
206
+ },
207
+ "gray-600": {
208
+ "type": "color",
209
+ "value": "#383b42"
210
+ },
211
+ "gray-700": {
212
+ "type": "color",
213
+ "value": "#25272c"
214
+ },
215
+ "gray-800": {
216
+ "type": "color",
217
+ "value": "#181a1e"
218
+ },
219
+ "gray-900": {
220
+ "type": "color",
221
+ "value": "#0e0f12"
222
+ },
223
+ "accent-soft": {
224
+ "type": "color",
225
+ "value": "#1d1454"
226
+ },
227
+ "accent-base": {
228
+ "type": "color",
229
+ "value": "#2e1f7a",
230
+ "description": "Midnight blue-violet. Deep and saturated; anchors primary actions on light and dark surfaces alike."
231
+ },
232
+ "accent-strong": {
233
+ "type": "color",
234
+ "value": "#5841b8"
235
+ },
236
+ "danger-base": {
237
+ "type": "color",
238
+ "value": "#d94a3f"
239
+ },
240
+ "warning-base": {
241
+ "type": "color",
242
+ "value": "#d99a3f"
243
+ },
244
+ "success-base": {
245
+ "type": "color",
246
+ "value": "#2ec27e"
247
+ },
248
+ "fg-on-accent": {
249
+ "type": "color",
250
+ "value": "{color.gray-50}"
251
+ },
252
+ "line-subtle": {
253
+ "type": "color",
254
+ "value": "{color.fg}",
255
+ "alpha": 0.1,
256
+ "description": "Barely-there separators (table rows)."
257
+ },
258
+ "line": {
259
+ "type": "color",
260
+ "value": "{color.fg}",
261
+ "alpha": 0.2,
262
+ "description": "Primary gridlines on sunken surfaces."
263
+ },
264
+ "line-strong": {
265
+ "type": "color",
266
+ "value": "{color.fg}",
267
+ "alpha": 0.4,
268
+ "description": "Axes and emphasized dividers."
269
+ },
270
+ "curve-color": {
271
+ "type": "color",
272
+ "value": "{color.accent-strong}",
273
+ "description": "Drawn data curves. Routes through the bright accent because accent-base is too dim on sunken surfaces."
274
+ },
275
+ "accent": {
276
+ "type": "color",
277
+ "value": "{color.accent-base}"
278
+ },
279
+ "accent-hover": {
280
+ "type": "color",
281
+ "value": "{color.accent-strong}"
282
+ },
283
+ "danger": {
284
+ "type": "color",
285
+ "value": "{color.danger-base}"
286
+ },
287
+ "warning": {
288
+ "type": "color",
289
+ "value": "{color.warning-base}"
290
+ },
291
+ "success": {
292
+ "type": "color",
293
+ "value": "{color.success-base}"
294
+ },
295
+ "focus-ring": {
296
+ "type": "color",
297
+ "value": "{color.accent-strong}"
298
+ },
299
+ "glass-tint": {
300
+ "type": "color",
301
+ "value": "{color.accent}",
302
+ "description": "Frosted-glass tint. Components compose it as color-mix(in srgb, var(--wzl-glass-tint) 78%, transparent) with backdrop-filter: blur(3px)."
303
+ },
304
+ "surface-hover": {
305
+ "type": "color",
306
+ "value": "{color.fg}",
307
+ "alpha": 0.1,
308
+ "description": "Hover wash over a raised surface. Same formula as line-subtle, different job \u2014 do not collapse them."
309
+ },
310
+ "surface-pressed": {
311
+ "type": "color",
312
+ "value": "{color.fg}",
313
+ "alpha": 0.18,
314
+ "description": "Pressed wash over a raised surface."
315
+ },
316
+ "swatch-green": {
317
+ "type": "color",
318
+ "value": "#2fdd18",
319
+ "description": "First of ten categorical spot colors for plotting, status and data viz. Ordered \u2014 take them in sequence. Mode-invariant on purpose: a series keeps its color when the mode flips."
320
+ },
321
+ "swatch-pink": {
322
+ "type": "color",
323
+ "value": "#ff5885"
324
+ },
325
+ "swatch-cyan": {
326
+ "type": "color",
327
+ "value": "#00dfff"
328
+ },
329
+ "swatch-gold": {
330
+ "type": "color",
331
+ "value": "#dcb700"
332
+ },
333
+ "swatch-amber": {
334
+ "type": "color",
335
+ "value": "#ff8c00"
336
+ },
337
+ "swatch-violet": {
338
+ "type": "color",
339
+ "value": "#a497ff"
340
+ },
341
+ "swatch-mint": {
342
+ "type": "color",
343
+ "value": "#00e7af"
344
+ },
345
+ "swatch-sky": {
346
+ "type": "color",
347
+ "value": "#00b8ff"
348
+ },
349
+ "swatch-orange": {
350
+ "type": "color",
351
+ "value": "#ff6b00"
352
+ },
353
+ "swatch-magenta": {
354
+ "type": "color",
355
+ "value": "#ff6eff"
356
+ },
357
+ "radius-sm": {
358
+ "type": "dimension",
359
+ "value": "3px"
360
+ },
361
+ "radius-md": {
362
+ "type": "dimension",
363
+ "value": "5px"
364
+ },
365
+ "border-w": {
366
+ "type": "dimension",
367
+ "value": "1px"
368
+ },
369
+ "line-width": {
370
+ "type": "dimension",
371
+ "value": "2px",
372
+ "description": "Structural lines \u2014 gridlines, dividers, axes."
373
+ },
374
+ "curve-width": {
375
+ "type": "dimension",
376
+ "value": "3px",
377
+ "description": "Drawn data curves. Heavier than structural lines so data reads as primary content."
378
+ },
379
+ "tb-height": {
380
+ "type": "dimension",
381
+ "value": "28px",
382
+ "description": "Height of a horizontal toolbar strip (ActionsBar, OptionsBar, ToggleBar, ToolOptionsBar)."
383
+ },
384
+ "radius-lg": {
385
+ "type": "dimension",
386
+ "value": "14px"
387
+ },
388
+ "control-h": {
389
+ "type": "dimension",
390
+ "value": "28px",
391
+ "description": "Height of an interactive control \u2014 button, input, select. Distinct from tb-height, which sizes the strip a row of them sits in."
392
+ },
393
+ "glass-blur": {
394
+ "type": "dimension",
395
+ "value": "3px",
396
+ "description": "Backdrop blur radius for frosted surfaces. Pairs with glass-tint."
397
+ },
398
+ "font-size": {
399
+ "type": "dimension",
400
+ "value": "13px"
401
+ },
402
+ "font-size-sm": {
403
+ "type": "dimension",
404
+ "value": "11px"
405
+ },
406
+ "space-xs": {
407
+ "type": "dimension",
408
+ "value": "4px"
409
+ },
410
+ "space-sm": {
411
+ "type": "dimension",
412
+ "value": "8px"
413
+ },
414
+ "space-md": {
415
+ "type": "dimension",
416
+ "value": "12px"
417
+ },
418
+ "space-lg": {
419
+ "type": "dimension",
420
+ "value": "16px"
421
+ },
422
+ "z-toolbar": {
423
+ "type": "number",
424
+ "value": 10
425
+ },
426
+ "z-overlay": {
427
+ "type": "number",
428
+ "value": 20
429
+ },
430
+ "z-modal": {
431
+ "type": "number",
432
+ "value": 30
433
+ },
434
+ "backdrop": {
435
+ "type": "gradient",
436
+ "value": "none",
437
+ "description": "Layered backdrop fill for a page or lab root. `none` here; a theme with a signature background sets it."
438
+ },
439
+ "motion-fast": {
440
+ "type": "duration",
441
+ "value": "120ms",
442
+ "description": "Micro-interactions \u2014 hover, focus, pressed."
443
+ },
444
+ "motion-medium": {
445
+ "type": "duration",
446
+ "value": "240ms",
447
+ "description": "Entrances and exits \u2014 toasts, popovers, panels."
448
+ },
449
+ "ease-in-cubic": {
450
+ "type": "cubicBezier",
451
+ "value": [
452
+ 0.32,
453
+ 0,
454
+ 0.67,
455
+ 0
456
+ ]
457
+ },
458
+ "ease-out-cubic": {
459
+ "type": "cubicBezier",
460
+ "value": [
461
+ 0.33,
462
+ 1,
463
+ 0.68,
464
+ 1
465
+ ]
466
+ },
467
+ "ease-in-out-cubic": {
468
+ "type": "cubicBezier",
469
+ "value": [
470
+ 0.65,
471
+ 0,
472
+ 0.35,
473
+ 1
474
+ ]
475
+ },
476
+ "ease-out-back": {
477
+ "type": "cubicBezier",
478
+ "value": [
479
+ 0.34,
480
+ 1.56,
481
+ 0.64,
482
+ 1
483
+ ]
484
+ },
485
+ "font-ui": {
486
+ "type": "fontFamily",
487
+ "value": [
488
+ "Oswald",
489
+ "Helvetica Neue Condensed",
490
+ "Arial Narrow",
491
+ "system-ui",
492
+ "sans-serif"
493
+ ],
494
+ "description": "Condensed UI/display face. The heavier cuts get blocky at any size, so the weight tokens stay in the 200-400 range."
495
+ },
496
+ "font-display": {
497
+ "type": "fontFamily",
498
+ "value": [
499
+ "Oswald",
500
+ "Helvetica Neue Condensed",
501
+ "Arial Narrow",
502
+ "system-ui",
503
+ "sans-serif"
504
+ ]
505
+ },
506
+ "font-body": {
507
+ "type": "fontFamily",
508
+ "value": [
509
+ "Inter",
510
+ "system-ui",
511
+ "-apple-system",
512
+ "Segoe UI",
513
+ "sans-serif"
514
+ ]
515
+ },
516
+ "font-mono": {
517
+ "type": "fontFamily",
518
+ "value": [
519
+ "ui-monospace",
520
+ "SFMono-Regular",
521
+ "Menlo",
522
+ "Consolas",
523
+ "monospace"
524
+ ]
525
+ },
526
+ "font-weight-light": {
527
+ "type": "fontWeight",
528
+ "value": 200
529
+ },
530
+ "font-weight-normal": {
531
+ "type": "fontWeight",
532
+ "value": 300
533
+ },
534
+ "font-weight-medium": {
535
+ "type": "fontWeight",
536
+ "value": 350
537
+ },
538
+ "font-weight-bold": {
539
+ "type": "fontWeight",
540
+ "value": 400
541
+ }
542
+ },
543
+ "modes": {
544
+ "dark": {
545
+ "surface": {
546
+ "type": "color",
547
+ "value": "{color.gray-800}"
548
+ },
549
+ "surface-raised": {
550
+ "type": "color",
551
+ "value": "{color.gray-700}"
552
+ },
553
+ "surface-sunken": {
554
+ "type": "color",
555
+ "value": "{color.gray-900}"
556
+ },
557
+ "fg": {
558
+ "type": "color",
559
+ "value": "{color.gray-100}"
560
+ },
561
+ "fg-muted": {
562
+ "type": "color",
563
+ "value": "{color.gray-300}"
564
+ },
565
+ "fg-subtle": {
566
+ "type": "color",
567
+ "value": "{color.gray-400}"
568
+ },
569
+ "border": {
570
+ "type": "color",
571
+ "value": "{color.gray-700}"
572
+ },
573
+ "border-strong": {
574
+ "type": "color",
575
+ "value": "{color.gray-600}"
576
+ },
577
+ "accent-fg": {
578
+ "type": "color",
579
+ "value": "{color.accent-strong}",
580
+ "description": "Accent for foreground use \u2014 text, icons, selected labels drawn on a surface. accent is a fill; the midnight base is too dim to read as text on dark surfaces."
581
+ },
582
+ "fg-inverse": {
583
+ "type": "color",
584
+ "value": "{color.gray-900}",
585
+ "description": "Text drawn on a filled foreground-colored element (e.g. a slider thumb). Flips with the mode, so it is a semantic, not an alias to a primitive."
586
+ }
587
+ },
588
+ "light": {
589
+ "surface": {
590
+ "type": "color",
591
+ "value": "{color.gray-50}"
592
+ },
593
+ "surface-raised": {
594
+ "type": "color",
595
+ "value": "{color.gray-100}"
596
+ },
597
+ "surface-sunken": {
598
+ "type": "color",
599
+ "value": "{color.gray-200}"
600
+ },
601
+ "fg": {
602
+ "type": "color",
603
+ "value": "{color.gray-900}"
604
+ },
605
+ "fg-muted": {
606
+ "type": "color",
607
+ "value": "{color.gray-600}"
608
+ },
609
+ "fg-subtle": {
610
+ "type": "color",
611
+ "value": "{color.gray-500}"
612
+ },
613
+ "border": {
614
+ "type": "color",
615
+ "value": "{color.gray-200}"
616
+ },
617
+ "border-strong": {
618
+ "type": "color",
619
+ "value": "{color.gray-300}"
620
+ },
621
+ "accent-fg": {
622
+ "type": "color",
623
+ "value": "{color.accent-base}",
624
+ "description": "Flips to the deep base in light mode, where it is the legible one."
625
+ },
626
+ "fg-inverse": {
627
+ "type": "color",
628
+ "value": "{color.gray-50}",
629
+ "description": "Flips with the mode \u2014 see the dark layer."
630
+ }
631
+ }
632
+ }
633
+ }
634
+ };
635
+
636
+ // src/theme.ts
637
+ function normalize(input) {
638
+ const out = {};
639
+ for (const [name, v] of Object.entries(input)) {
640
+ out[name] = typeof v === "object" ? v : { type: "unknown", value: v, alpha: void 0, description: void 0 };
641
+ }
642
+ return out;
643
+ }
644
+ var weaselTheme = {
645
+ name: "weasel",
646
+ extends: null,
647
+ defaultMode: "dark",
648
+ tokens: THEME_SOURCES.weasel.primitives,
649
+ modes: THEME_SOURCES.weasel.modes
650
+ };
651
+ function defineTheme(input) {
652
+ const base = input.extends === void 0 ? weaselTheme : input.extends;
653
+ const modes = {};
654
+ for (const [mode, tokens] of Object.entries(input.modes)) modes[mode] = normalize(tokens);
655
+ return {
656
+ name: input.name,
657
+ extends: base,
658
+ defaultMode: input.defaultMode ?? base?.defaultMode ?? "dark",
659
+ tokens: normalize(input.tokens ?? {}),
660
+ modes
661
+ };
662
+ }
663
+
664
+ // src/dtcg/color.ts
665
+ function hexToRgba(hex, alpha) {
666
+ const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
667
+ if (!m) throw new Error(`Expected a hex color, got "${hex}"`);
668
+ const body = m[1];
669
+ const full = body.length === 3 ? body.replace(/./g, (c) => c + c) : body;
670
+ const r = Number.parseInt(full.slice(0, 2), 16);
671
+ const g = Number.parseInt(full.slice(2, 4), 16);
672
+ const b = Number.parseInt(full.slice(4, 6), 16);
673
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
674
+ }
675
+
676
+ // src/dtcg/resolve.ts
677
+ var REF = /^\{([^}]+)\}$/;
678
+ function refTarget(value) {
679
+ if (typeof value !== "string") return null;
680
+ const m = REF.exec(value.trim());
681
+ if (!m) return null;
682
+ const path = m[1];
683
+ const dot = path.indexOf(".");
684
+ return dot === -1 ? path : path.slice(dot + 1);
685
+ }
686
+ function fontStack(value) {
687
+ return value.map((f) => typeof f === "string" && /\s/.test(f) ? `'${f}'` : String(f)).join(", ");
688
+ }
689
+ function serialize(type, value) {
690
+ if (Array.isArray(value)) {
691
+ if (type === "cubicBezier") return `cubic-bezier(${value.join(", ")})`;
692
+ if (type === "fontFamily") return fontStack(value);
693
+ return value.join(", ");
694
+ }
695
+ return String(value);
696
+ }
697
+ function resolveTokens(tokens) {
698
+ const out = {};
699
+ const inProgress = /* @__PURE__ */ new Set();
700
+ const resolveOne = (name) => {
701
+ const cached = out[name];
702
+ if (cached !== void 0) return cached;
703
+ const token = tokens[name];
704
+ if (!token) throw new Error(`Unknown token "${name}"`);
705
+ if (inProgress.has(name)) {
706
+ throw new Error(`Reference cycle at token "${name}" (${[...inProgress].join(" \u2192 ")})`);
707
+ }
708
+ inProgress.add(name);
709
+ const target = refTarget(token.value);
710
+ let value;
711
+ if (target === null) {
712
+ value = serialize(token.type, token.value);
713
+ } else if (!tokens[target]) {
714
+ throw new Error(`Token "${name}" references "${target}", which is not defined`);
715
+ } else {
716
+ value = resolveOne(target);
717
+ }
718
+ if (token.alpha !== void 0) value = hexToRgba(value, token.alpha);
719
+ inProgress.delete(name);
720
+ out[name] = value;
721
+ return value;
722
+ };
723
+ for (const name of Object.keys(tokens)) resolveOne(name);
724
+ return out;
725
+ }
726
+
727
+ // src/resolveTheme.ts
728
+ function chain(theme) {
729
+ const out = [];
730
+ for (let t = theme; t; t = t.extends) out.unshift(t);
731
+ return out;
732
+ }
733
+ function resolveTheme(theme, mode) {
734
+ const themes = chain(theme);
735
+ const effectiveMode = themes.some((t) => mode in t.modes) ? mode : theme.defaultMode;
736
+ let merged = {};
737
+ for (const t of themes) {
738
+ merged = { ...merged, ...t.tokens, ...t.modes[effectiveMode] ?? {} };
739
+ }
740
+ const resolved = resolveTokens(merged);
741
+ const out = {};
742
+ for (const [name, value] of Object.entries(resolved)) out[`--wzl-${name}`] = value;
743
+ return out;
744
+ }
745
+
746
+ // src/applyTheme.ts
747
+ var STYLE_ID = "wzl-themes";
748
+ var emitted = /* @__PURE__ */ new Set();
749
+ var sheet = null;
750
+ var styleEl = null;
751
+ function canAdopt() {
752
+ return typeof CSSStyleSheet !== "undefined" && "replaceSync" in CSSStyleSheet.prototype && Array.isArray(document.adoptedStyleSheets);
753
+ }
754
+ function appendRule(css) {
755
+ if (canAdopt()) {
756
+ if (!sheet) {
757
+ sheet = new CSSStyleSheet();
758
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
759
+ }
760
+ sheet.insertRule(css, sheet.cssRules.length);
761
+ return;
762
+ }
763
+ if (!styleEl) {
764
+ styleEl = document.createElement("style");
765
+ styleEl.id = STYLE_ID;
766
+ document.head.appendChild(styleEl);
767
+ }
768
+ styleEl.textContent += `${css}
769
+ `;
770
+ }
771
+ function applyTheme(el, theme, mode) {
772
+ if (typeof document === "undefined") return;
773
+ const key = `${theme.name}::${mode}`;
774
+ if (!emitted.has(key)) {
775
+ const resolved = resolveTheme(theme, mode);
776
+ const body = Object.entries(resolved).map(([name, value]) => `${name}: ${value};`).join(" ");
777
+ appendRule(`[data-wzl-theme='${theme.name}'][data-wzl-mode='${mode}'] { ${body} }`);
778
+ emitted.add(key);
779
+ }
780
+ el.setAttribute("data-wzl-theme", theme.name);
781
+ el.setAttribute("data-wzl-mode", mode);
782
+ }
783
+
784
+ export { THEMES, THEME_SOURCES, applyTheme, defineTheme, resolveTheme, weaselTheme };
785
+ //# sourceMappingURL=chunk-RATE4LL3.js.map
786
+ //# sourceMappingURL=chunk-RATE4LL3.js.map