@sobagu/cli 0.0.0-stage → 0.1.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.
package/dist/cli.js ADDED
@@ -0,0 +1,3328 @@
1
+ import { existsSync, globSync, readFileSync, statSync, writeFileSync } from "node:fs";
2
+ import { join, relative, resolve } from "node:path";
3
+ import { parseArgs } from "node:util";
4
+ import { parse } from "@babel/parser";
5
+ // ../core/dist/index.js
6
+ var space = {
7
+ none: "0",
8
+ "2xs": "2px",
9
+ xs: "4px",
10
+ sm: "8px",
11
+ md: "16px",
12
+ lg: "24px",
13
+ xl: "32px",
14
+ "2xl": "48px",
15
+ "3xl": "64px",
16
+ "4xl": "96px"
17
+ };
18
+ var sizes = {
19
+ ...space,
20
+ none: "none",
21
+ full: "100%",
22
+ half: "50%",
23
+ auto: "auto",
24
+ fit: "fit-content",
25
+ min: "min-content",
26
+ max: "max-content",
27
+ prose: "65ch",
28
+ narrow: "640px",
29
+ content: "960px",
30
+ wide: "1200px",
31
+ screen: "100vw"
32
+ };
33
+ var sizesY = {
34
+ ...sizes,
35
+ screen: "100dvh"
36
+ };
37
+ var radii = {
38
+ none: "0",
39
+ xs: "2px",
40
+ sm: "4px",
41
+ md: "8px",
42
+ lg: "12px",
43
+ xl: "16px",
44
+ "2xl": "24px",
45
+ full: "9999px"
46
+ };
47
+ var fontSizes = {
48
+ xs: "0.75rem",
49
+ sm: "0.875rem",
50
+ md: "1rem",
51
+ lg: "1.2rem",
52
+ xl: "1.44rem",
53
+ "2xl": "1.728rem",
54
+ "3xl": "2.074rem",
55
+ "4xl": "2.488rem",
56
+ "5xl": "2.986rem"
57
+ };
58
+ var fontWeights = {
59
+ light: "300",
60
+ normal: "400",
61
+ medium: "500",
62
+ semibold: "600",
63
+ bold: "700",
64
+ black: "900"
65
+ };
66
+ var lineHeights = {
67
+ none: "1",
68
+ tight: "1.2",
69
+ snug: "1.35",
70
+ normal: "1.55",
71
+ relaxed: "1.75"
72
+ };
73
+ var letterSpacings = {
74
+ tight: "-0.02em",
75
+ normal: "0",
76
+ wide: "0.04em",
77
+ wider: "0.08em"
78
+ };
79
+ var fonts = {
80
+ sans: "system-ui, -apple-system, \"Segoe UI\", Roboto, \"Noto Sans\", \"Noto Sans Kannada\", sans-serif",
81
+ serif: "ui-serif, Georgia, \"Noto Serif\", serif",
82
+ mono: "ui-monospace, \"Cascadia Code\", Menlo, Consolas, monospace"
83
+ };
84
+ var shadows = {
85
+ none: "none",
86
+ sm: "0 1px 2px rgb(15 20 30 / 0.08)",
87
+ md: "0 2px 6px rgb(15 20 30 / 0.10), 0 1px 2px rgb(15 20 30 / 0.06)",
88
+ lg: "0 8px 20px rgb(15 20 30 / 0.12), 0 2px 6px rgb(15 20 30 / 0.06)",
89
+ xl: "0 16px 40px rgb(15 20 30 / 0.16), 0 4px 12px rgb(15 20 30 / 0.08)"
90
+ };
91
+ var zIndices = {
92
+ base: "0",
93
+ raised: "10",
94
+ dropdown: "1000",
95
+ sticky: "1100",
96
+ overlay: "1300",
97
+ modal: "1400",
98
+ toast: "1700",
99
+ tooltip: "1800"
100
+ };
101
+ var transitions = {
102
+ none: "none",
103
+ fast: "all 120ms ease-out",
104
+ normal: "all 200ms ease-out",
105
+ slow: "all 320ms ease-out"
106
+ };
107
+ /** Built-in animations (keyframes are defined in the reset layer). */
108
+ var animations = {
109
+ none: "none",
110
+ spin: "sb-spin 1s linear infinite",
111
+ ping: "sb-ping 1s cubic-bezier(0,0,.2,1) infinite",
112
+ pulse: "sb-pulse 2s ease-in-out infinite",
113
+ bounce: "sb-bounce 1s infinite",
114
+ fadeIn: "sb-fade-in 200ms ease-out both",
115
+ slideUp: "sb-slide-up 240ms ease-out both",
116
+ scaleIn: "sb-scale-in 180ms ease-out both"
117
+ };
118
+ var keyframesCss = [
119
+ "@keyframes sb-spin{to{transform:rotate(360deg)}}",
120
+ "@keyframes sb-ping{75%,100%{transform:scale(1.8);opacity:0}}",
121
+ "@keyframes sb-pulse{50%{opacity:.5}}",
122
+ "@keyframes sb-bounce{0%,100%{transform:translateY(-20%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}",
123
+ "@keyframes sb-fade-in{from{opacity:0}}",
124
+ "@keyframes sb-slide-up{from{opacity:0;transform:translateY(8px)}}",
125
+ "@keyframes sb-scale-in{from{opacity:0;transform:scale(.96)}}"
126
+ ].join("\n");
127
+ var textShadows = {
128
+ none: "none",
129
+ sm: "0 1px 1px rgb(0 0 0 / 0.12)",
130
+ md: "0 1px 3px rgb(0 0 0 / 0.18)",
131
+ lg: "0 2px 8px rgb(0 0 0 / 0.24)"
132
+ };
133
+ var breakpoints = {
134
+ sm: 600,
135
+ md: 840,
136
+ lg: 1024,
137
+ xl: 1440
138
+ };
139
+ /** Container-query sizes (width of the nearest `container` parent). */
140
+ var containerSizes = {
141
+ xs: 320,
142
+ sm: 480,
143
+ md: 640,
144
+ lg: 840,
145
+ xl: 1024
146
+ };
147
+ var steps = [
148
+ 50,
149
+ 100,
150
+ 200,
151
+ 300,
152
+ 400,
153
+ 500,
154
+ 600,
155
+ 700,
156
+ 800,
157
+ 900,
158
+ 950
159
+ ];
160
+ var hues = {
161
+ gray: [255, .018],
162
+ red: [25, .2],
163
+ orange: [50, .17],
164
+ amber: [80, .16],
165
+ green: [150, .16],
166
+ teal: [185, .12],
167
+ blue: [255, .18],
168
+ indigo: [275, .18],
169
+ violet: [300, .2],
170
+ pink: [350, .19]
171
+ };
172
+ var lightness = [
173
+ .975,
174
+ .945,
175
+ .885,
176
+ .8,
177
+ .705,
178
+ .615,
179
+ .53,
180
+ .45,
181
+ .375,
182
+ .3,
183
+ .215
184
+ ];
185
+ var chromaCurve = [
186
+ .12,
187
+ .25,
188
+ .5,
189
+ .75,
190
+ .92,
191
+ 1,
192
+ .97,
193
+ .88,
194
+ .74,
195
+ .58,
196
+ .42
197
+ ];
198
+ function paletteColor(name, step) {
199
+ const [h, c] = hues[name];
200
+ const i = steps.indexOf(step);
201
+ return `oklch(${lightness[i] ?? .5} ${+(c * (chromaCurve[i] ?? 1)).toFixed(4)} ${h})`;
202
+ }
203
+ var semanticColors = {
204
+ canvas: ["gray.50", "gray.950"],
205
+ surface: ["white", "gray.900"],
206
+ surfaceAlt: ["gray.100", "gray.800"],
207
+ text: ["gray.900", "gray.50"],
208
+ muted: ["gray.600", "gray.400"],
209
+ subtle: ["gray.200", "gray.800"],
210
+ border: ["gray.200", "gray.700"],
211
+ /** For borders that must be visible to everyone: inputs, checkboxes (WCAG 1.4.11, 3:1). */
212
+ borderStrong: ["gray.500", "gray.500"],
213
+ primary: ["blue.600", "blue.400"],
214
+ primaryHover: ["blue.700", "blue.300"],
215
+ onPrimary: ["white", "gray.950"],
216
+ accent: ["violet.600", "violet.400"],
217
+ danger: ["red.600", "red.400"],
218
+ success: ["green.600", "green.400"],
219
+ warning: ["amber.600", "amber.400"]
220
+ };
221
+ var tokens = {
222
+ space,
223
+ sizes,
224
+ sizesY,
225
+ radii,
226
+ fontSizes,
227
+ fontWeights,
228
+ lineHeights,
229
+ letterSpacings,
230
+ fonts,
231
+ shadows,
232
+ zIndices,
233
+ transitions,
234
+ breakpoints
235
+ };
236
+ var sel = (template, rank, element = false) => ({
237
+ kind: "selector",
238
+ template,
239
+ rank,
240
+ element
241
+ });
242
+ var media$1 = (q, rank) => ({
243
+ kind: "at",
244
+ prelude: `@media ${q}`,
245
+ group: "media",
246
+ rank
247
+ });
248
+ var cq = (w, rank) => ({
249
+ kind: "at",
250
+ prelude: `@container (min-width: ${w}px)`,
251
+ group: "container",
252
+ rank
253
+ });
254
+ var at = (prelude, rank) => ({
255
+ kind: "at",
256
+ prelude,
257
+ group: "other",
258
+ rank
259
+ });
260
+ var min = (w) => `(min-width: ${w}px)`;
261
+ /**
262
+ * Conditions: use them as object props, e.g. hover={{ bg: 'primaryHover' }} or md={{ cols: 2 }}.
263
+ * Names that are also HTML attributes start with "_" (_disabled, _checked, _placeholder, _required, _readOnly)
264
+ * so <Box as="button" disabled _disabled={{ opacity: 0.5 }}> can use both.
265
+ */
266
+ var conditions = {
267
+ first: sel("&:first-child", 1),
268
+ last: sel("&:last-child", 2),
269
+ only: sel("&:only-child", 3),
270
+ odd: sel("&:nth-child(odd)", 4),
271
+ even: sel("&:nth-child(even)", 5),
272
+ firstOfType: sel("&:first-of-type", 6),
273
+ lastOfType: sel("&:last-of-type", 7),
274
+ empty: sel("&:empty", 8),
275
+ visited: sel("&:visited", 9),
276
+ target: sel("&:target", 10),
277
+ open: sel("&:is([open], :popover-open)", 11),
278
+ _checked: sel("&:checked", 12),
279
+ indeterminate: sel("&:indeterminate", 13),
280
+ _required: sel("&:required", 14),
281
+ optional: sel("&:optional", 15),
282
+ _readOnly: sel("&:read-only", 16),
283
+ valid: sel("&:user-valid", 17),
284
+ invalid: sel("&:user-invalid", 18),
285
+ autofill: sel("&:autofill", 19),
286
+ placeholderShown: sel("&:placeholder-shown", 20),
287
+ focusWithin: sel("&:focus-within", 21),
288
+ hover: sel("&:hover", 22),
289
+ focus: sel("&:focus", 23),
290
+ focusVisible: sel("&:focus-visible", 24),
291
+ active: sel("&:active", 25),
292
+ _disabled: sel("&:disabled", 26),
293
+ ariaExpanded: sel("&[aria-expanded=\"true\"]", 27),
294
+ ariaSelected: sel("&[aria-selected=\"true\"]", 28),
295
+ ariaChecked: sel("&[aria-checked=\"true\"]", 29),
296
+ ariaPressed: sel("&[aria-pressed=\"true\"]", 30),
297
+ ariaCurrent: sel("&[aria-current]:not([aria-current=\"false\"])", 31),
298
+ ariaInvalid: sel("&[aria-invalid=\"true\"]", 32),
299
+ ariaDisabled: sel("&[aria-disabled=\"true\"]", 33),
300
+ dataOpen: sel("&[data-state=\"open\"]", 34),
301
+ dataClosed: sel("&[data-state=\"closed\"]", 35),
302
+ groupHover: sel(".sb-group:hover &", 36),
303
+ groupFocusWithin: sel(".sb-group:focus-within &", 37),
304
+ groupActive: sel(".sb-group:active &", 38),
305
+ groupOpen: sel(".sb-group:is([open], [data-state=\"open\"], [aria-expanded=\"true\"]) &", 39),
306
+ peerHover: sel(".sb-peer:hover ~ &", 40),
307
+ peerFocus: sel(".sb-peer:focus ~ &", 41),
308
+ peerChecked: sel(".sb-peer:checked ~ &", 42),
309
+ peerInvalid: sel(".sb-peer:user-invalid ~ &", 43),
310
+ peerDisabled: sel(".sb-peer:disabled ~ &", 44),
311
+ rtl: sel("&:dir(rtl)", 45),
312
+ ltr: sel("&:dir(ltr)", 46),
313
+ before: sel("&::before", 50, true),
314
+ after: sel("&::after", 51, true),
315
+ _placeholder: sel("&::placeholder", 52, true),
316
+ selection: sel("&::selection", 53, true),
317
+ marker: sel("&::marker", 54, true),
318
+ file: sel("&::file-selector-button", 55, true),
319
+ backdrop: sel("&::backdrop", 56, true),
320
+ firstLine: sel("&::first-line", 57, true),
321
+ firstLetter: sel("&::first-letter", 58, true),
322
+ mobile: media$1(`(max-width: ${breakpoints.sm - .02}px)`, 1),
323
+ sm: media$1(min(breakpoints.sm), 2),
324
+ tablet: media$1(min(breakpoints.sm), 2),
325
+ md: media$1(min(breakpoints.md), 3),
326
+ lg: media$1(min(breakpoints.lg), 4),
327
+ desktop: media$1(min(breakpoints.lg), 4),
328
+ xl: media$1(min(breakpoints.xl), 5),
329
+ motionSafe: media$1("(prefers-reduced-motion: no-preference)", 6),
330
+ reduceMotion: media$1("(prefers-reduced-motion: reduce)", 6),
331
+ contrastMore: media$1("(prefers-contrast: more)", 6),
332
+ forcedColors: media$1("(forced-colors: active)", 6),
333
+ touch: media$1("(pointer: coarse)", 6),
334
+ mouse: media$1("(pointer: fine)", 6),
335
+ portrait: media$1("(orientation: portrait)", 6),
336
+ landscape: media$1("(orientation: landscape)", 6),
337
+ print: media$1("print", 7),
338
+ cqXs: cq(containerSizes.xs, 1),
339
+ cqSm: cq(containerSizes.sm, 2),
340
+ cqMd: cq(containerSizes.md, 3),
341
+ cqLg: cq(containerSizes.lg, 4),
342
+ cqXl: cq(containerSizes.xl, 5),
343
+ starting: at("@starting-style", 1),
344
+ dark: { kind: "dark" }
345
+ };
346
+ /** Marker props that add a plain class: <Box group> → "sb-group", <Box as="input" peer> → "sb-peer". */
347
+ var markers = ["group", "peer"];
348
+ var PREFIX = "--sb";
349
+ var paletteVar = (name, step) => `${PREFIX}-${name}-${step}`;
350
+ var colorVar = (name) => `${PREFIX}-c-${name}`;
351
+ function refToCss(ref) {
352
+ if (ref === "white" || ref === "black") return ref;
353
+ const [name, step] = ref.split(".");
354
+ return `var(${paletteVar(name, step)})`;
355
+ }
356
+ function semanticBlock(mode) {
357
+ return Object.entries(semanticColors).map(([name, pair]) => `${colorVar(name)}:${refToCss(pair[mode])}`).join(";");
358
+ }
359
+ /**
360
+ * Cascade layers, lowest to highest priority. Your own un-layered CSS always beats Sobagu,
361
+ * so overriding never needs !important.
362
+ */
363
+ var LAYERS = "@layer sobagu.theme, sobagu.reset, sobagu.utilities;";
364
+ var inLayer = (layer, css) => `@layer sobagu.${layer}{${css}}`;
365
+ var themeMemo;
366
+ /**
367
+ * CSS variables for the palette, the fonts and the semantic colours.
368
+ * Semantic colours use light-dark(), so a single declaration covers both modes, and the browser picks
369
+ * the value from color-scheme: the OS setting by default, or forced with data-theme="light|dark".
370
+ */
371
+ function themeCss() {
372
+ const key = JSON.stringify([
373
+ hues,
374
+ fonts,
375
+ semanticColors
376
+ ]);
377
+ if (themeMemo?.key !== key) themeMemo = {
378
+ key,
379
+ css: buildThemeCss()
380
+ };
381
+ return themeMemo.css;
382
+ }
383
+ function buildThemeCss() {
384
+ const palette = [];
385
+ for (const name of Object.keys(hues)) for (const step of steps) palette.push(`${paletteVar(name, step)}:${paletteColor(name, step)}`);
386
+ const fontVars = Object.entries(fonts).map(([k, v]) => `${PREFIX}-font-${k}:${v}`);
387
+ const semantic = Object.entries(semanticColors).map(([name, [l, d]]) => `${colorVar(name)}:light-dark(${refToCss(l)}, ${refToCss(d)})`);
388
+ return inLayer("theme", [
389
+ `:root{${[
390
+ ...palette,
391
+ ...fontVars,
392
+ ...semantic
393
+ ].join(";")};color-scheme:light dark}`,
394
+ `[data-theme="dark"]{${semanticBlock(1)};color-scheme:dark}`,
395
+ `[data-theme="light"]{${semanticBlock(0)};color-scheme:light}`
396
+ ].join("\n"));
397
+ }
398
+ /** Sobagu base reset. Written from scratch, following MDN guidance. */
399
+ function resetCss() {
400
+ return [
401
+ "*,*::before,*::after{box-sizing:border-box}",
402
+ "*{margin:0}",
403
+ "html{-webkit-text-size-adjust:100%;text-size-adjust:100%}",
404
+ `body{min-height:100dvh;line-height:1.55;font-family:var(${PREFIX}-font-sans);color:var(${colorVar("text")});background:var(${colorVar("canvas")});-webkit-font-smoothing:antialiased}`,
405
+ "img,picture,video,canvas,svg{display:block;max-width:100%}",
406
+ "input,button,textarea,select{font:inherit;color:inherit}",
407
+ "p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}",
408
+ `:where(:focus-visible){outline:2px solid var(${colorVar("primary")});outline-offset:2px}`,
409
+ "@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}",
410
+ `:where(${INDIC.map((l) => `:lang(${l})`).join(",")}){line-height:1.8}`,
411
+ `:where(:lang(kn)){font-family:"Noto Sans Kannada",var(${PREFIX}-font-sans)}`,
412
+ `:where(:lang(hi),:lang(mr)){font-family:"Noto Sans Devanagari",var(${PREFIX}-font-sans)}`,
413
+ `:where(:lang(ta)){font-family:"Noto Sans Tamil",var(${PREFIX}-font-sans)}`,
414
+ `:where(:lang(te)){font-family:"Noto Sans Telugu",var(${PREFIX}-font-sans)}`,
415
+ `:where(:lang(ml)){font-family:"Noto Sans Malayalam",var(${PREFIX}-font-sans)}`,
416
+ `:where(:lang(bn)){font-family:"Noto Sans Bengali",var(${PREFIX}-font-sans)}`,
417
+ `:where(:lang(gu)){font-family:"Noto Sans Gujarati",var(${PREFIX}-font-sans)}`,
418
+ `:where(:lang(pa)){font-family:"Noto Sans Gurmukhi",var(${PREFIX}-font-sans)}`,
419
+ `:where(:lang(ar),:lang(ur)){font-family:"Noto Naskh Arabic","Noto Nastaliq Urdu",var(${PREFIX}-font-sans);line-height:1.9}`,
420
+ keyframesCss
421
+ ].join("\n");
422
+ }
423
+ /** Indian-language codes that get Indic typography defaults. */
424
+ var INDIC = [
425
+ "kn",
426
+ "hi",
427
+ "mr",
428
+ "ta",
429
+ "te",
430
+ "ml",
431
+ "bn",
432
+ "gu",
433
+ "pa",
434
+ "or",
435
+ "as",
436
+ "sa"
437
+ ];
438
+ /** 1 unit = 4px, so p={4} → 16px. */
439
+ var unit = (n) => n === 0 ? "0" : `${n * 4}px`;
440
+ var px = (n) => n === 0 ? "0" : `${n}px`;
441
+ var spaceP = (...properties) => ({
442
+ properties,
443
+ scale: space,
444
+ number: unit
445
+ });
446
+ var sizeP = (...properties) => ({
447
+ properties,
448
+ scale: sizes,
449
+ number: unit
450
+ });
451
+ var sizeYP = (...properties) => ({
452
+ properties,
453
+ scale: sizesY,
454
+ number: unit
455
+ });
456
+ var colorP = (...properties) => ({
457
+ properties,
458
+ scale: "color"
459
+ });
460
+ var rawP = (...properties) => ({ properties });
461
+ /** Resolve a colour token ('primary', 'blue.500', 'blue-500') or pass a raw CSS colour through. */
462
+ function resolveColor(v) {
463
+ const a = /^([a-zA-Z][\w.-]*|#[\da-fA-F]{3,8})\/(\d{1,3})$/.exec(v);
464
+ if (a) return `color-mix(in oklch, ${resolveColor(a[1])} ${Math.min(+a[2], 100)}%, transparent)`;
465
+ if (v in semanticColors) return `var(${colorVar(v)})`;
466
+ const m = /^([a-z]+)[.-](\d{2,3})$/.exec(v);
467
+ if (m && m[1] in hues) return `var(${paletteVar(m[1], m[2])})`;
468
+ return v;
469
+ }
470
+ var borderP = (property) => ({
471
+ properties: [property],
472
+ number: (n) => `${px(n)} solid var(${colorVar("border")})`,
473
+ transform: (v) => {
474
+ if (v === "none" || v === "0") return v;
475
+ const c = resolveColor(v);
476
+ return c !== v ? `1px solid ${c}` : v;
477
+ }
478
+ });
479
+ var alias = (m) => (v) => m[v] ?? v;
480
+ var FILTERS = [
481
+ "blur",
482
+ "brightness",
483
+ "contrast",
484
+ "grayscale",
485
+ "hueRotate",
486
+ "invert",
487
+ "saturate",
488
+ "sepia",
489
+ "dropShadow"
490
+ ];
491
+ var BACKDROPS = [
492
+ "blur",
493
+ "brightness",
494
+ "contrast",
495
+ "grayscale",
496
+ "hueRotate",
497
+ "saturate",
498
+ "invert",
499
+ "sepia",
500
+ "opacity"
501
+ ];
502
+ var fvar = (n) => `--sb-f-${n}`;
503
+ var bvar = (n) => `--sb-bf-${n}`;
504
+ var FILTER_ALL = FILTERS.map((n) => `var(${fvar(n)},)`).join(" ");
505
+ var BACKDROP_ALL = BACKDROPS.map((n) => `var(${bvar(n)},)`).join(" ");
506
+ var filterP = (name, fn, number) => ({
507
+ properties: ["filter"],
508
+ number,
509
+ decl: (v) => `${fvar(name)}:${v === "none" ? "none" : `${fn}(${v})`};filter:${FILTER_ALL}`
510
+ });
511
+ var backdropP = (name, fn, number) => ({
512
+ properties: ["backdrop-filter"],
513
+ number,
514
+ decl: (v) => {
515
+ const val = `${fn}(${v})`;
516
+ return `${bvar(name)}:${val};-webkit-backdrop-filter:${BACKDROP_ALL};backdrop-filter:${BACKDROP_ALL}`;
517
+ }
518
+ });
519
+ /** @property rules that stop the filter variables from inheriting (added to the reset). */
520
+ var FILTER_PROPERTIES = [...FILTERS.map(fvar), ...BACKDROPS.map(bvar)].map((v) => `@property ${v}{syntax:'*';inherits:false}`).join("\n");
521
+ var pxN = (n) => `${n}px`;
522
+ var degN = (n) => `${n}deg`;
523
+ var lines = (n) => `repeat(${n}, minmax(0, 1fr))`;
524
+ var span = (n) => `span ${n} / span ${n}`;
525
+ var propConfig = {
526
+ p: spaceP("padding"),
527
+ px: spaceP("padding-inline"),
528
+ py: spaceP("padding-block"),
529
+ pt: spaceP("padding-top"),
530
+ pr: spaceP("padding-right"),
531
+ pb: spaceP("padding-bottom"),
532
+ pl: spaceP("padding-left"),
533
+ m: spaceP("margin"),
534
+ mx: spaceP("margin-inline"),
535
+ my: spaceP("margin-block"),
536
+ mt: spaceP("margin-top"),
537
+ mr: spaceP("margin-right"),
538
+ mb: spaceP("margin-bottom"),
539
+ ml: spaceP("margin-left"),
540
+ gap: spaceP("gap"),
541
+ gapX: spaceP("column-gap"),
542
+ gapY: spaceP("row-gap"),
543
+ w: sizeP("width"),
544
+ minW: sizeP("min-width"),
545
+ maxW: sizeP("max-width"),
546
+ h: sizeYP("height"),
547
+ minH: sizeYP("min-height"),
548
+ inlineSize: sizeP("inline-size"),
549
+ minInlineSize: sizeP("min-inline-size"),
550
+ maxInlineSize: sizeP("max-inline-size"),
551
+ blockSize: sizeYP("block-size"),
552
+ minBlockSize: sizeYP("min-block-size"),
553
+ maxBlockSize: sizeYP("max-block-size"),
554
+ maxH: sizeYP("max-height"),
555
+ aspect: {
556
+ properties: ["aspect-ratio"],
557
+ transform: alias({
558
+ square: "1 / 1",
559
+ video: "16 / 9"
560
+ })
561
+ },
562
+ display: rawP("display"),
563
+ position: rawP("position"),
564
+ top: spaceP("top"),
565
+ right: spaceP("right"),
566
+ bottom: spaceP("bottom"),
567
+ left: spaceP("left"),
568
+ inset: spaceP("inset"),
569
+ z: {
570
+ properties: ["z-index"],
571
+ scale: zIndices
572
+ },
573
+ overflow: rawP("overflow"),
574
+ overflowX: rawP("overflow-x"),
575
+ overflowY: rawP("overflow-y"),
576
+ objectFit: rawP("object-fit"),
577
+ objectPosition: rawP("object-position"),
578
+ breakBefore: rawP("break-before"),
579
+ breakAfter: rawP("break-after"),
580
+ breakInside: rawP("break-inside"),
581
+ boxDecoration: rawP("box-decoration-break", "-webkit-box-decoration-break"),
582
+ contentVisibility: rawP("content-visibility"),
583
+ visibility: rawP("visibility"),
584
+ clip: rawP("clip"),
585
+ flexDir: {
586
+ properties: ["flex-direction"],
587
+ transform: alias({
588
+ col: "column",
589
+ colReverse: "column-reverse",
590
+ rowReverse: "row-reverse"
591
+ })
592
+ },
593
+ wrap: rawP("flex-wrap"),
594
+ align: rawP("align-items"),
595
+ justify: {
596
+ properties: ["justify-content"],
597
+ transform: alias({
598
+ between: "space-between",
599
+ around: "space-around",
600
+ evenly: "space-evenly"
601
+ })
602
+ },
603
+ self: rawP("align-self"),
604
+ grow: rawP("flex-grow"),
605
+ shrink: rawP("flex-shrink"),
606
+ basis: sizeP("flex-basis"),
607
+ order: rawP("order"),
608
+ cols: {
609
+ properties: ["grid-template-columns"],
610
+ number: lines
611
+ },
612
+ rows: {
613
+ properties: ["grid-template-rows"],
614
+ number: lines
615
+ },
616
+ span: {
617
+ properties: ["grid-column"],
618
+ number: span,
619
+ transform: (v) => v === "full" ? "1 / -1" : v
620
+ },
621
+ spanRows: {
622
+ properties: ["grid-row"],
623
+ number: span,
624
+ transform: (v) => v === "full" ? "1 / -1" : v
625
+ },
626
+ placeItems: rawP("place-items"),
627
+ bg: colorP("background"),
628
+ color: colorP("color"),
629
+ borderColor: colorP("border-color"),
630
+ border: borderP("border"),
631
+ borderTop: borderP("border-top"),
632
+ borderRight: borderP("border-right"),
633
+ borderBottom: borderP("border-bottom"),
634
+ borderLeft: borderP("border-left"),
635
+ borderWidth: {
636
+ properties: ["border-width"],
637
+ number: px
638
+ },
639
+ radius: {
640
+ properties: ["border-radius"],
641
+ scale: radii,
642
+ number: px
643
+ },
644
+ radiusTop: {
645
+ properties: ["border-top-left-radius", "border-top-right-radius"],
646
+ scale: radii,
647
+ number: px
648
+ },
649
+ radiusBottom: {
650
+ properties: ["border-bottom-left-radius", "border-bottom-right-radius"],
651
+ scale: radii,
652
+ number: px
653
+ },
654
+ radiusStart: {
655
+ properties: ["border-start-start-radius", "border-end-start-radius"],
656
+ scale: radii,
657
+ number: px
658
+ },
659
+ radiusEnd: {
660
+ properties: ["border-start-end-radius", "border-end-end-radius"],
661
+ scale: radii,
662
+ number: px
663
+ },
664
+ shadow: {
665
+ properties: ["box-shadow"],
666
+ scale: shadows
667
+ },
668
+ opacity: rawP("opacity"),
669
+ text: {
670
+ properties: ["font-size"],
671
+ scale: fontSizes,
672
+ number: px
673
+ },
674
+ weight: {
675
+ properties: ["font-weight"],
676
+ scale: fontWeights
677
+ },
678
+ font: {
679
+ properties: ["font-family"],
680
+ scale: fonts
681
+ },
682
+ leading: {
683
+ properties: ["line-height"],
684
+ scale: lineHeights
685
+ },
686
+ tracking: {
687
+ properties: ["letter-spacing"],
688
+ scale: letterSpacings
689
+ },
690
+ textAlign: rawP("text-align"),
691
+ textTransform: rawP("text-transform"),
692
+ textOverflow: rawP("text-overflow"),
693
+ decoration: rawP("text-decoration"),
694
+ whiteSpace: rawP("white-space"),
695
+ wordBreak: rawP("word-break"),
696
+ cursor: rawP("cursor"),
697
+ pointerEvents: rawP("pointer-events"),
698
+ userSelect: rawP("user-select"),
699
+ transition: {
700
+ properties: ["transition"],
701
+ scale: transitions
702
+ },
703
+ transform: rawP("transform"),
704
+ transformStyle: {
705
+ properties: ["transform-style"],
706
+ transform: alias({
707
+ "3d": "preserve-3d",
708
+ flat: "flat"
709
+ })
710
+ },
711
+ perspectiveOrigin: rawP("perspective-origin"),
712
+ translate: rawP("translate"),
713
+ skew: {
714
+ properties: ["transform"],
715
+ number: (n) => `skew(${n}deg)`,
716
+ transform: (v) => `skew(${v})`
717
+ },
718
+ skewX: {
719
+ properties: ["transform"],
720
+ number: (n) => `skewX(${n}deg)`,
721
+ transform: (v) => `skewX(${v})`
722
+ },
723
+ skewY: {
724
+ properties: ["transform"],
725
+ number: (n) => `skewY(${n}deg)`,
726
+ transform: (v) => `skewY(${v})`
727
+ },
728
+ zoom: rawP("zoom"),
729
+ rotate: rawP("rotate"),
730
+ scale: rawP("scale"),
731
+ transformOrigin: rawP("transform-origin"),
732
+ perspective: rawP("perspective"),
733
+ backface: rawP("backface-visibility"),
734
+ transitionProperty: rawP("transition-property"),
735
+ transitionBehavior: rawP("transition-behavior"),
736
+ duration: {
737
+ properties: ["transition-duration"],
738
+ number: (n) => `${n}ms`
739
+ },
740
+ ease: {
741
+ properties: ["transition-timing-function"],
742
+ transform: alias({
743
+ in: "cubic-bezier(.4,0,1,1)",
744
+ out: "cubic-bezier(0,0,.2,1)",
745
+ inOut: "cubic-bezier(.4,0,.2,1)"
746
+ })
747
+ },
748
+ delay: {
749
+ properties: ["transition-delay"],
750
+ number: (n) => `${n}ms`
751
+ },
752
+ animate: {
753
+ properties: ["animation"],
754
+ scale: animations
755
+ },
756
+ willChange: rawP("will-change"),
757
+ ps: spaceP("padding-inline-start"),
758
+ pe: spaceP("padding-inline-end"),
759
+ ms: spaceP("margin-inline-start"),
760
+ me: spaceP("margin-inline-end"),
761
+ start: spaceP("inset-inline-start"),
762
+ end: spaceP("inset-inline-end"),
763
+ insetX: spaceP("inset-inline"),
764
+ insetY: spaceP("inset-block"),
765
+ borderStart: borderP("border-inline-start"),
766
+ borderEnd: borderP("border-inline-end"),
767
+ container: {
768
+ properties: ["container-type"],
769
+ transform: alias({ true: "inline-size" })
770
+ },
771
+ containerName: rawP("container-name"),
772
+ boxSizing: rawP("box-sizing"),
773
+ float: rawP("float"),
774
+ clear: rawP("clear"),
775
+ isolation: rawP("isolation"),
776
+ overscroll: rawP("overscroll-behavior"),
777
+ columns: rawP("columns"),
778
+ autoFlow: {
779
+ properties: ["grid-auto-flow"],
780
+ transform: alias({
781
+ col: "column",
782
+ colDense: "column dense",
783
+ rowDense: "row dense"
784
+ })
785
+ },
786
+ autoCols: rawP("grid-auto-columns"),
787
+ autoRows: rawP("grid-auto-rows"),
788
+ areas: rawP("grid-template-areas"),
789
+ area: rawP("grid-area"),
790
+ colStart: rawP("grid-column-start"),
791
+ colEnd: rawP("grid-column-end"),
792
+ rowStart: rawP("grid-row-start"),
793
+ rowEnd: rawP("grid-row-end"),
794
+ alignContent: {
795
+ properties: ["align-content"],
796
+ transform: alias({
797
+ between: "space-between",
798
+ around: "space-around",
799
+ evenly: "space-evenly"
800
+ })
801
+ },
802
+ justifyItems: rawP("justify-items"),
803
+ justifySelf: rawP("justify-self"),
804
+ placeContent: rawP("place-content"),
805
+ placeSelf: rawP("place-self"),
806
+ flex: rawP("flex"),
807
+ bgImage: rawP("background-image"),
808
+ bgGradient: {
809
+ properties: ["background-image"],
810
+ transform: (v) => /^(repeating-)?(linear|radial|conic)-gradient\(/.test(v) ? v : `linear-gradient(${v})`
811
+ },
812
+ bgSize: rawP("background-size"),
813
+ bgPosition: rawP("background-position"),
814
+ bgRepeat: rawP("background-repeat"),
815
+ bgClip: {
816
+ properties: ["background-clip", "-webkit-background-clip"],
817
+ transform: alias({ text: "text" })
818
+ },
819
+ bgAttachment: rawP("background-attachment"),
820
+ bgOrigin: rawP("background-origin"),
821
+ blend: rawP("mix-blend-mode"),
822
+ bgBlend: rawP("background-blend-mode"),
823
+ filter: rawP("filter"),
824
+ blur: filterP("blur", "blur", pxN),
825
+ brightness: filterP("brightness", "brightness"),
826
+ contrast: filterP("contrast", "contrast"),
827
+ grayscale: filterP("grayscale", "grayscale"),
828
+ hueRotate: filterP("hueRotate", "hue-rotate", degN),
829
+ invert: filterP("invert", "invert"),
830
+ saturate: filterP("saturate", "saturate"),
831
+ sepia: filterP("sepia", "sepia"),
832
+ dropShadow: filterP("dropShadow", "drop-shadow"),
833
+ backdropFilter: rawP("backdrop-filter", "-webkit-backdrop-filter"),
834
+ backdropBlur: backdropP("blur", "blur", pxN),
835
+ backdropBrightness: backdropP("brightness", "brightness"),
836
+ backdropContrast: backdropP("contrast", "contrast"),
837
+ backdropGrayscale: backdropP("grayscale", "grayscale"),
838
+ backdropSaturate: backdropP("saturate", "saturate"),
839
+ backdropInvert: backdropP("invert", "invert"),
840
+ backdropSepia: backdropP("sepia", "sepia"),
841
+ backdropOpacity: backdropP("opacity", "opacity"),
842
+ backdropHueRotate: backdropP("hueRotate", "hue-rotate", degN),
843
+ mask: rawP("mask", "-webkit-mask"),
844
+ maskImage: rawP("mask-image", "-webkit-mask-image"),
845
+ maskClip: rawP("mask-clip", "-webkit-mask-clip"),
846
+ maskComposite: rawP("mask-composite", "-webkit-mask-composite"),
847
+ maskMode: rawP("mask-mode"),
848
+ maskOrigin: rawP("mask-origin", "-webkit-mask-origin"),
849
+ maskPosition: rawP("mask-position", "-webkit-mask-position"),
850
+ maskRepeat: rawP("mask-repeat", "-webkit-mask-repeat"),
851
+ maskSize: rawP("mask-size", "-webkit-mask-size"),
852
+ maskType: rawP("mask-type"),
853
+ textShadow: {
854
+ properties: ["text-shadow"],
855
+ scale: textShadows
856
+ },
857
+ outline: borderP("outline"),
858
+ outlineColor: colorP("outline-color"),
859
+ outlineOffset: {
860
+ properties: ["outline-offset"],
861
+ number: px
862
+ },
863
+ ring: {
864
+ properties: ["outline"],
865
+ number: (n) => `${px(n)} solid var(${colorVar("primary")})`,
866
+ transform: (v) => {
867
+ const c = resolveColor(v);
868
+ return c !== v ? `2px solid ${c}` : v;
869
+ }
870
+ },
871
+ ringOffset: {
872
+ properties: ["outline-offset"],
873
+ number: px
874
+ },
875
+ borderStyle: rawP("border-style"),
876
+ divide: {
877
+ properties: ["border-color"],
878
+ scale: "color"
879
+ },
880
+ fontStyle: rawP("font-style"),
881
+ numeric: {
882
+ properties: ["font-variant-numeric"],
883
+ transform: alias({
884
+ tabular: "tabular-nums",
885
+ oldstyle: "oldstyle-nums",
886
+ slashed: "slashed-zero"
887
+ })
888
+ },
889
+ fontFeatures: rawP("font-feature-settings"),
890
+ textWrap: rawP("text-wrap"),
891
+ hyphens: rawP("hyphens"),
892
+ indent: spaceP("text-indent"),
893
+ underlineOffset: {
894
+ properties: ["text-underline-offset"],
895
+ number: px
896
+ },
897
+ decorationColor: colorP("text-decoration-color"),
898
+ decorationThickness: {
899
+ properties: ["text-decoration-thickness"],
900
+ number: px
901
+ },
902
+ verticalAlign: rawP("vertical-align"),
903
+ listStyle: rawP("list-style"),
904
+ listStyleType: rawP("list-style-type"),
905
+ listStyleImage: rawP("list-style-image"),
906
+ tabSize: rawP("tab-size"),
907
+ listStylePosition: rawP("list-style-position"),
908
+ fontStretch: rawP("font-stretch"),
909
+ smoothing: {
910
+ properties: ["-webkit-font-smoothing"],
911
+ decl: (v) => v === "antialiased" ? "-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale" : "-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto"
912
+ },
913
+ decorationStyle: rawP("text-decoration-style"),
914
+ overflowWrap: rawP("overflow-wrap"),
915
+ forcedColorAdjust: rawP("forced-color-adjust"),
916
+ outlineStyle: rawP("outline-style"),
917
+ outlineWidth: {
918
+ properties: ["outline-width"],
919
+ number: px
920
+ },
921
+ lineClamp: {
922
+ properties: ["-webkit-line-clamp"],
923
+ decl: (v) => `display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:${v};line-clamp:${v};overflow:hidden`
924
+ },
925
+ content: rawP("content"),
926
+ accent: colorP("accent-color"),
927
+ caret: colorP("caret-color"),
928
+ colorScheme: rawP("color-scheme"),
929
+ appearance: rawP("appearance"),
930
+ resize: rawP("resize"),
931
+ touchAction: rawP("touch-action"),
932
+ scrollBehavior: rawP("scroll-behavior"),
933
+ scrollMargin: spaceP("scroll-margin"),
934
+ scrollPadding: spaceP("scroll-padding"),
935
+ snapType: rawP("scroll-snap-type"),
936
+ snapAlign: rawP("scroll-snap-align"),
937
+ snapStop: rawP("scroll-snap-stop"),
938
+ scrollbarColor: rawP("scrollbar-color"),
939
+ scrollbarWidth: rawP("scrollbar-width"),
940
+ scrollbarGutter: rawP("scrollbar-gutter"),
941
+ fieldSizing: rawP("field-sizing"),
942
+ tableLayout: rawP("table-layout"),
943
+ borderCollapse: rawP("border-collapse"),
944
+ borderSpacing: spaceP("border-spacing"),
945
+ captionSide: rawP("caption-side"),
946
+ fill: colorP("fill"),
947
+ stroke: colorP("stroke"),
948
+ strokeWidth: rawP("stroke-width")
949
+ };
950
+ (() => {
951
+ return (globalThis.process?.env)?.NODE_ENV !== "production";
952
+ })();
953
+ /**
954
+ * Boolean shortcuts for the layouts people write every day.
955
+ * <Box center> · <Box card> · <Stack row> · <Text muted>
956
+ * Explicit props always win over a shortcut: <Box card p="sm"> keeps the card but with small padding.
957
+ */
958
+ var shortcuts = {
959
+ center: {
960
+ display: "flex",
961
+ align: "center",
962
+ justify: "center"
963
+ },
964
+ row: {
965
+ display: "flex",
966
+ flexDir: "row"
967
+ },
968
+ col: {
969
+ display: "flex",
970
+ flexDir: "col"
971
+ },
972
+ card: {
973
+ bg: "surface",
974
+ p: "lg",
975
+ radius: "lg",
976
+ shadow: "sm",
977
+ border: "border"
978
+ },
979
+ muted: { color: "muted" },
980
+ full: {
981
+ w: "full",
982
+ h: "full"
983
+ },
984
+ truncate: {
985
+ overflow: "hidden",
986
+ textOverflow: "ellipsis",
987
+ whiteSpace: "nowrap"
988
+ },
989
+ srOnly: {
990
+ position: "absolute",
991
+ w: "1px",
992
+ h: "1px",
993
+ p: 0,
994
+ m: "-1px",
995
+ overflow: "hidden",
996
+ clip: "rect(0, 0, 0, 0)",
997
+ whiteSpace: "nowrap",
998
+ borderWidth: 0
999
+ },
1000
+ /** Readable long-form content (Markdown, CMS, blog posts): <Box as="article" prose>. */
1001
+ prose: {
1002
+ color: "text",
1003
+ leading: "relaxed",
1004
+ maxW: "prose",
1005
+ "& :where(h1)": {
1006
+ text: "3xl",
1007
+ weight: "bold",
1008
+ leading: "tight",
1009
+ mt: "xl",
1010
+ mb: "md"
1011
+ },
1012
+ "& :where(h2)": {
1013
+ text: "2xl",
1014
+ weight: "bold",
1015
+ leading: "snug",
1016
+ mt: "xl",
1017
+ mb: "sm"
1018
+ },
1019
+ "& :where(h3)": {
1020
+ text: "xl",
1021
+ weight: "semibold",
1022
+ leading: "snug",
1023
+ mt: "lg",
1024
+ mb: "xs"
1025
+ },
1026
+ "& :where(h4, h5, h6)": {
1027
+ weight: "semibold",
1028
+ mt: "md",
1029
+ mb: "xs"
1030
+ },
1031
+ "& :where(p, ul, ol, blockquote, pre, table, figure)": { my: "md" },
1032
+ "& :where(a)": {
1033
+ color: "primary",
1034
+ decoration: "underline",
1035
+ underlineOffset: 2
1036
+ },
1037
+ "& :where(strong)": { weight: "semibold" },
1038
+ "& :where(ul, ol)": { ps: "lg" },
1039
+ "& :where(li)": { my: "2xs" },
1040
+ "& :where(li::marker)": { color: "muted" },
1041
+ "& :where(code)": {
1042
+ font: "mono",
1043
+ text: "0.9em",
1044
+ bg: "surfaceAlt",
1045
+ px: "2xs",
1046
+ radius: "sm"
1047
+ },
1048
+ "& :where(pre)": {
1049
+ font: "mono",
1050
+ text: "sm",
1051
+ bg: "surfaceAlt",
1052
+ p: "md",
1053
+ radius: "md",
1054
+ overflowX: "auto",
1055
+ leading: "normal"
1056
+ },
1057
+ "& :where(pre code)": {
1058
+ bg: "transparent",
1059
+ p: 0
1060
+ },
1061
+ "& :where(blockquote)": {
1062
+ borderStart: "primary",
1063
+ ps: "md",
1064
+ color: "muted",
1065
+ fontStyle: "italic"
1066
+ },
1067
+ "& :where(img, video)": { radius: "md" },
1068
+ "& :where(figcaption)": {
1069
+ text: "sm",
1070
+ color: "muted",
1071
+ mt: "xs"
1072
+ },
1073
+ "& :where(hr)": {
1074
+ border: "none",
1075
+ borderTop: "border",
1076
+ my: "xl"
1077
+ },
1078
+ "& :where(table)": {
1079
+ w: "full",
1080
+ borderCollapse: "collapse",
1081
+ text: "sm"
1082
+ },
1083
+ "& :where(th, td)": {
1084
+ p: "sm",
1085
+ borderBottom: "border",
1086
+ textAlign: "start"
1087
+ },
1088
+ "& :where(th)": { weight: "semibold" },
1089
+ "& > :where(:first-child)": { mt: 0 }
1090
+ },
1091
+ /** Consistent text inputs, selects and textareas: <Box as="input" input>. */
1092
+ input: {
1093
+ appearance: "none",
1094
+ w: "full",
1095
+ px: "sm",
1096
+ py: "xs",
1097
+ bg: "surface",
1098
+ color: "text",
1099
+ border: "borderStrong",
1100
+ radius: "md",
1101
+ leading: "normal",
1102
+ transition: "fast",
1103
+ _placeholder: { color: "muted" },
1104
+ hover: { borderColor: "muted" },
1105
+ focusVisible: {
1106
+ ring: "primary",
1107
+ ringOffset: 1,
1108
+ borderColor: "primary"
1109
+ },
1110
+ _disabled: {
1111
+ opacity: .6,
1112
+ cursor: "not-allowed"
1113
+ },
1114
+ invalid: { borderColor: "danger" },
1115
+ ariaInvalid: { borderColor: "danger" }
1116
+ }
1117
+ };
1118
+ ({ ...propConfig }), { ...conditions }, { ...shortcuts };
1119
+ inLayer("utilities", `.sb-static{--sb-static:1}`);
1120
+ /**
1121
+ * Stores the generated CSS in ordered buckets so that the cascade is predictable:
1122
+ * base < states < dark < breakpoints (small → large). In the browser, each bucket gets its own
1123
+ * <style data-sobagu="N"> element, kept in bucket order. Outside a browser (SSR, tests), use getCssText().
1124
+ */
1125
+ var Sheet = class {
1126
+ buckets = /* @__PURE__ */ new Map();
1127
+ seen = /* @__PURE__ */ new Set();
1128
+ els = /* @__PURE__ */ new Map();
1129
+ globalsDone = false;
1130
+ /** getCssText() result, kept until the next rule is added or the sheet is reset. */
1131
+ text;
1132
+ has(key) {
1133
+ this.ensureGlobals();
1134
+ return this.seen.has(key);
1135
+ }
1136
+ insert(bucket, key, rules) {
1137
+ if (this.seen.has(key)) return;
1138
+ this.seen.add(key);
1139
+ this.ensureGlobals();
1140
+ this.add(bucket, rules);
1141
+ }
1142
+ /** Add a global block (e.g. @keyframes) once, before the utilities. */
1143
+ global(key, css) {
1144
+ this.insert(-.8, key, [css]);
1145
+ }
1146
+ getCssText() {
1147
+ this.ensureGlobals();
1148
+ return this.text ??= [...this.buckets.entries()].sort((a, b) => a[0] - b[0]).map(([, rules]) => rules.join("\n")).join("\n");
1149
+ }
1150
+ /** Test helper: forget everything and remove injected <style> elements. */
1151
+ reset() {
1152
+ for (const el of this.els.values()) el.remove();
1153
+ this.buckets.clear();
1154
+ this.seen.clear();
1155
+ this.els.clear();
1156
+ this.globalsDone = false;
1157
+ this.text = void 0;
1158
+ }
1159
+ ensureGlobals() {
1160
+ if (this.globalsDone) return;
1161
+ this.globalsDone = true;
1162
+ if (this.adoptStatic()) return;
1163
+ this.add(-1, [
1164
+ LAYERS,
1165
+ FILTER_PROPERTIES,
1166
+ themeCss(),
1167
+ inLayer("reset", resetCss())
1168
+ ]);
1169
+ }
1170
+ /**
1171
+ * Look for a pre-built Sobagu stylesheet (it contains the `.sb-static` marker). If there is one, remember
1172
+ * its class names so they are never injected again. Returns true when one was found.
1173
+ */
1174
+ adoptStatic() {
1175
+ if (typeof document === "undefined") return false;
1176
+ let found = false;
1177
+ const collect = (text) => {
1178
+ if (!text.includes(".sb-static")) return;
1179
+ found = true;
1180
+ for (const m of text.matchAll(/\.(sb-[A-Za-z0-9_-]+)/g)) this.seen.add(m[1]);
1181
+ };
1182
+ for (const el of Array.from(document.querySelectorAll("style"))) if (!el.hasAttribute("data-sobagu")) collect(el.textContent ?? "");
1183
+ for (const s of Array.from(document.styleSheets ?? [])) {
1184
+ if (s.ownerNode instanceof HTMLStyleElement) continue;
1185
+ try {
1186
+ collect(Array.from(s.cssRules).map((r) => r.cssText).join("\n"));
1187
+ } catch {}
1188
+ }
1189
+ return found;
1190
+ }
1191
+ add(bucket, rules) {
1192
+ let list = this.buckets.get(bucket);
1193
+ if (!list) this.buckets.set(bucket, list = []);
1194
+ list.push(...rules);
1195
+ this.text = void 0;
1196
+ if (typeof document === "undefined") return;
1197
+ const el = this.element(bucket);
1198
+ for (const rule of rules) el.appendChild(document.createTextNode(rule + "\n"));
1199
+ }
1200
+ element(bucket) {
1201
+ const found = this.els.get(bucket);
1202
+ if (found) return found;
1203
+ const el = document.createElement("style");
1204
+ el.setAttribute("data-sobagu", String(bucket));
1205
+ let next;
1206
+ let nextBucket = Infinity;
1207
+ for (const [b, e] of this.els) if (b > bucket && b < nextBucket) [next, nextBucket] = [e, b];
1208
+ if (next) next.before(el);
1209
+ else document.head.appendChild(el);
1210
+ this.els.set(bucket, el);
1211
+ return el;
1212
+ }
1213
+ };
1214
+ new Sheet();
1215
+ var clamp01 = (x) => Math.min(1, Math.max(0, x));
1216
+ var toLinear = (c) => c <= .04045 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4;
1217
+ var toGamma = (c) => c <= .0031308 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - .055;
1218
+ /** '#7c3aed' or '#7c3' → [r, g, b] in 0..1 */
1219
+ function parseHex(hex) {
1220
+ let h = hex.trim().replace(/^#/, "");
1221
+ if (h.length === 3) h = [...h].map((x) => x + x).join("");
1222
+ if (!/^[0-9a-f]{6}$/i.test(h)) throw new Error(`Invalid hex colour: ${hex}`);
1223
+ return [
1224
+ 0,
1225
+ 2,
1226
+ 4
1227
+ ].map((i) => parseInt(h.slice(i, i + 2), 16) / 255);
1228
+ }
1229
+ function rgbToOklch([r, g, b]) {
1230
+ const [lr, lg, lb] = [
1231
+ toLinear(r),
1232
+ toLinear(g),
1233
+ toLinear(b)
1234
+ ];
1235
+ const l = Math.cbrt(.4122214708 * lr + .5363325363 * lg + .0514459929 * lb);
1236
+ const m = Math.cbrt(.2119034982 * lr + .6806995451 * lg + .1073969566 * lb);
1237
+ const s = Math.cbrt(.0883024619 * lr + .2817188376 * lg + .6299787005 * lb);
1238
+ const L = .2104542553 * l + .793617785 * m - .0040720468 * s;
1239
+ const A = 1.9779984951 * l - 2.428592205 * m + .4505937099 * s;
1240
+ const B = .0259040371 * l + .7827717662 * m - .808675766 * s;
1241
+ return {
1242
+ l: L,
1243
+ c: Math.sqrt(A * A + B * B),
1244
+ h: (Math.atan2(B, A) * 180 / Math.PI + 360) % 360
1245
+ };
1246
+ }
1247
+ function oklchToRgb({ l, c, h }) {
1248
+ const hr = h * Math.PI / 180;
1249
+ const A = c * Math.cos(hr);
1250
+ const B = c * Math.sin(hr);
1251
+ const l_ = (l + .3963377774 * A + .2158037573 * B) ** 3;
1252
+ const m_ = (l - .1055613458 * A - .0638541728 * B) ** 3;
1253
+ const s_ = (l - .0894841775 * A - 1.291485548 * B) ** 3;
1254
+ const r = 4.0767416621 * l_ - 3.3077115913 * m_ + .2309699292 * s_;
1255
+ const g = -1.2684380046 * l_ + 2.6097574011 * m_ - .3413193965 * s_;
1256
+ const b = -.0041960863 * l_ - .7034186147 * m_ + 1.707614701 * s_;
1257
+ return [
1258
+ clamp01(toGamma(r)),
1259
+ clamp01(toGamma(g)),
1260
+ clamp01(toGamma(b))
1261
+ ];
1262
+ }
1263
+ /** WCAG 2 relative luminance of an sRGB colour (0..1 channels). */
1264
+ function luminance([r, g, b]) {
1265
+ return .2126 * toLinear(r) + .7152 * toLinear(g) + .0722 * toLinear(b);
1266
+ }
1267
+ /** WCAG 2 contrast ratio between two colours (1..21). Accepts hex strings or OKLCH objects. */
1268
+ function contrastRatio(a, b) {
1269
+ const rgb = (x) => typeof x === "string" ? parseHex(x) : oklchToRgb(x);
1270
+ const [la, lb] = [luminance(rgb(a)), luminance(rgb(b))];
1271
+ const [hi, lo] = la > lb ? [la, lb] : [lb, la];
1272
+ return (hi + .05) / (lo + .05);
1273
+ }
1274
+ var oklchCss = ({ l, c, h }) => `oklch(${+l.toFixed(4)} ${+c.toFixed(4)} ${+h.toFixed(2)})`;
1275
+ /** Corner scale factors: radius tokens (xs…2xl) are multiplied by these. */
1276
+ var radiusFactors = {
1277
+ sharp: .25,
1278
+ soft: 1,
1279
+ round: 2
1280
+ };
1281
+ /** Spacing scale factors: space tokens (2xs…4xl) are multiplied by these. */
1282
+ var densityFactors = {
1283
+ compact: .75,
1284
+ comfortable: 1,
1285
+ spacious: 1.25
1286
+ };
1287
+ /** Neutral tints as [hue, chroma] for the grey ramp behind canvas, surfaces, borders and text ('tinted' takes the brand hue). */
1288
+ var neutralTints = {
1289
+ plain: [0, 0],
1290
+ cool: [250, .04],
1291
+ warm: [65, .04],
1292
+ tinted: [-1, .05]
1293
+ };
1294
+ var toOklch = (v) => typeof v === "number" ? {
1295
+ l: .6,
1296
+ c: .18,
1297
+ h: (v % 360 + 360) % 360
1298
+ } : rgbToOklch(parseHex(v));
1299
+ function scale$1(base) {
1300
+ const c = Math.min(Math.max(base.c, .04), .3);
1301
+ const out = {};
1302
+ steps.forEach((step, i) => out[step] = {
1303
+ l: lightness[i],
1304
+ c: c * chromaCurve[i],
1305
+ h: base.h
1306
+ });
1307
+ return out;
1308
+ }
1309
+ var WHITE = {
1310
+ l: 1,
1311
+ c: 0,
1312
+ h: 0
1313
+ };
1314
+ var INK = {
1315
+ l: .2,
1316
+ c: .01,
1317
+ h: 255
1318
+ };
1319
+ var bestOn = (bg) => contrastRatio(WHITE, bg) >= contrastRatio(INK, bg) ? WHITE : INK;
1320
+ /**
1321
+ * Generate a full theme from one brand colour: an 11-step palette, primary / primaryHover / onPrimary
1322
+ * (and accent) for light and dark mode, with readable text colours chosen by WCAG contrast.
1323
+ */
1324
+ function createTheme(options) {
1325
+ const name = options.name ?? "default";
1326
+ const selector = options.name ? `[data-sb-theme="${options.name}"]` : ":root";
1327
+ const brand = scale$1(toOklch(options.brand));
1328
+ const palette = Object.fromEntries(steps.map((s) => [s, oklchCss(brand[s])]));
1329
+ const lightPrimary = brand[600];
1330
+ const darkPrimary = brand[400];
1331
+ const onLight = bestOn(lightPrimary);
1332
+ const onDark = bestOn(darkPrimary);
1333
+ const v = (s) => `var(--sb-brand-${name}-${s})`;
1334
+ const decls = [
1335
+ ...steps.map((s) => `--sb-brand-${name}-${s}:${palette[s]}`),
1336
+ `${colorVar("primary")}:light-dark(${v(600)}, ${v(400)})`,
1337
+ `${colorVar("primaryHover")}:light-dark(${v(700)}, ${v(300)})`,
1338
+ `${colorVar("onPrimary")}:light-dark(${oklchCss(onLight)}, ${oklchCss(onDark)})`
1339
+ ];
1340
+ const style = [];
1341
+ const factor = (o, table, scaleVar, k, tokens) => {
1342
+ if (o === void 0) return;
1343
+ const f = typeof o === "number" ? o : table[o];
1344
+ style.push(`--sb-${scaleVar}:${f}`);
1345
+ for (const [t, px] of Object.entries(tokens)) if (/^\d{1,3}px$/.test(px)) style.push(`--sb-${k}-${t}:${Math.round(parseFloat(px) * f)}px`);
1346
+ };
1347
+ factor(options.radius, radiusFactors, "radius-scale", "radius", radii);
1348
+ factor(options.density, densityFactors, "density", "space", space);
1349
+ const nt = options.neutral;
1350
+ let neutrals;
1351
+ const nRefs = [];
1352
+ if (nt) {
1353
+ const [h, c] = neutralTints[nt];
1354
+ neutrals = Object.fromEntries(steps.map((s, i) => [s, oklchCss({
1355
+ l: lightness[i],
1356
+ c: c * chromaCurve[i],
1357
+ h: h < 0 ? brand[600].h : h
1358
+ })]));
1359
+ steps.forEach((s) => style.push(`--sb-neutral-${name}-${s}:${neutrals[s]}`));
1360
+ const ref = (x) => x.startsWith("gray.") ? `var(--sb-neutral-${name}-${x.slice(5)})` : x;
1361
+ for (const [k, [l, d]] of Object.entries(semanticColors)) if (k !== "onPrimary" && (l + d).includes("gray")) {
1362
+ nRefs.push([
1363
+ k,
1364
+ ref(l),
1365
+ ref(d)
1366
+ ]);
1367
+ style.push(`${colorVar(k)}:light-dark(${ref(l)}, ${ref(d)})`);
1368
+ }
1369
+ }
1370
+ if (options.accent !== void 0) {
1371
+ const acc = scale$1(toOklch(options.accent));
1372
+ decls.push(`${colorVar("accent")}:light-dark(${oklchCss(acc[600])}, ${oklchCss(acc[400])})`);
1373
+ }
1374
+ const contrast = {
1375
+ primaryOnSurface: +contrastRatio(lightPrimary, WHITE).toFixed(2),
1376
+ onPrimaryLight: +contrastRatio(onLight, lightPrimary).toFixed(2),
1377
+ onPrimaryDark: +contrastRatio(onDark, darkPrimary).toFixed(2)
1378
+ };
1379
+ const warnings = [];
1380
+ if (contrast.primaryOnSurface < 4.5) warnings.push(`primary text on a white surface is ${contrast.primaryOnSurface}:1 (AA needs 4.5:1)`);
1381
+ if (contrast.onPrimaryLight < 4.5) warnings.push(`text on primary (light mode) is ${contrast.onPrimaryLight}:1 (AA needs 4.5:1)`);
1382
+ if (contrast.onPrimaryDark < 4.5) warnings.push(`text on primary (dark mode) is ${contrast.onPrimaryDark}:1 (AA needs 4.5:1)`);
1383
+ const accent = options.accent !== void 0 ? scale$1(toOklch(options.accent)) : void 0;
1384
+ const forced = (mode) => {
1385
+ const d = mode === "dark";
1386
+ const list = [
1387
+ `${colorVar("primary")}:${v(d ? 400 : 600)}`,
1388
+ `${colorVar("primaryHover")}:${v(d ? 300 : 700)}`,
1389
+ `${colorVar("onPrimary")}:${oklchCss(d ? onDark : onLight)}`
1390
+ ];
1391
+ if (accent) list.push(`${colorVar("accent")}:${oklchCss(accent[d ? 400 : 600])}`);
1392
+ for (const [k, l, dk] of nRefs) list.push(`${colorVar(k)}:${d ? dk : l}`);
1393
+ const m = `[data-theme="${mode}"]`;
1394
+ return `${options.name ? `${selector}${m}, ${m} ${selector}, ${selector} ${m}` : m}{${list.join(";")}}`;
1395
+ };
1396
+ return {
1397
+ name,
1398
+ selector,
1399
+ css: `@layer sobagu.theme{${selector}{${[...decls, ...style].join(";")}}\n${forced("light")}\n${forced("dark")}}`,
1400
+ palette,
1401
+ ...neutrals ? { neutrals } : {},
1402
+ contrast,
1403
+ warnings
1404
+ };
1405
+ }
1406
+ function refToOklch(ref) {
1407
+ if (ref === "white") return {
1408
+ l: 1,
1409
+ c: 0,
1410
+ h: 0
1411
+ };
1412
+ if (ref === "black") return {
1413
+ l: 0,
1414
+ c: 0,
1415
+ h: 0
1416
+ };
1417
+ const [name, stepStr] = ref.split(".");
1418
+ const step = Number(stepStr);
1419
+ const i = steps.indexOf(step);
1420
+ const [h, c] = hues[name];
1421
+ return {
1422
+ l: lightness[i],
1423
+ c: c * chromaCurve[i],
1424
+ h
1425
+ };
1426
+ }
1427
+ var mode = (name, m) => refToOklch(semanticColors[name][m]);
1428
+ /** The pairs Sobagu's own components rely on. */
1429
+ var PAIRS = [
1430
+ [
1431
+ "text",
1432
+ "canvas",
1433
+ 4.5
1434
+ ],
1435
+ [
1436
+ "text",
1437
+ "surface",
1438
+ 4.5
1439
+ ],
1440
+ [
1441
+ "text",
1442
+ "surfaceAlt",
1443
+ 4.5
1444
+ ],
1445
+ [
1446
+ "muted",
1447
+ "canvas",
1448
+ 4.5
1449
+ ],
1450
+ [
1451
+ "muted",
1452
+ "surface",
1453
+ 4.5
1454
+ ],
1455
+ [
1456
+ "primary",
1457
+ "surface",
1458
+ 4.5
1459
+ ],
1460
+ [
1461
+ "onPrimary",
1462
+ "primary",
1463
+ 4.5
1464
+ ],
1465
+ [
1466
+ "onPrimary",
1467
+ "primaryHover",
1468
+ 4.5
1469
+ ],
1470
+ [
1471
+ "danger",
1472
+ "surface",
1473
+ 4.5
1474
+ ],
1475
+ [
1476
+ "success",
1477
+ "surface",
1478
+ 4.5
1479
+ ],
1480
+ [
1481
+ "warning",
1482
+ "surface",
1483
+ 3
1484
+ ],
1485
+ [
1486
+ "accent",
1487
+ "surface",
1488
+ 4.5
1489
+ ],
1490
+ [
1491
+ "borderStrong",
1492
+ "surface",
1493
+ 3
1494
+ ]
1495
+ ];
1496
+ /**
1497
+ * Check the built-in semantic colours against WCAG 2.2 contrast levels, in light and dark mode.
1498
+ * auditContrast().filter(c => !c.pass)
1499
+ */
1500
+ function auditContrast() {
1501
+ return PAIRS.map(([fg, bg, required]) => {
1502
+ const light = +contrastRatio(mode(fg, 0), mode(bg, 0)).toFixed(2);
1503
+ const dark = +contrastRatio(mode(fg, 1), mode(bg, 1)).toFixed(2);
1504
+ return {
1505
+ pair: `${fg} on ${bg}`,
1506
+ fg,
1507
+ bg,
1508
+ required,
1509
+ light,
1510
+ dark,
1511
+ pass: light >= required && dark >= required
1512
+ };
1513
+ });
1514
+ }
1515
+ var oklch = (name, i) => {
1516
+ const [h, c] = hues[name];
1517
+ return {
1518
+ colorSpace: "oklch",
1519
+ components: [
1520
+ lightness[i],
1521
+ +(c * chromaCurve[i]).toFixed(4),
1522
+ h
1523
+ ]
1524
+ };
1525
+ };
1526
+ var dimension = (v) => {
1527
+ const m = /^(-?[\d.]+)(px|rem|em)$/.exec(v);
1528
+ return m ? {
1529
+ value: Number(m[1]),
1530
+ unit: m[2]
1531
+ } : v === "0" ? {
1532
+ value: 0,
1533
+ unit: "px"
1534
+ } : v;
1535
+ };
1536
+ var group = (type, values, map = (v) => v) => Object.fromEntries(Object.entries(values).map(([k, v]) => [k, {
1537
+ $type: type,
1538
+ $value: map(String(v))
1539
+ }]));
1540
+ function toDesignTokens() {
1541
+ const palette = {};
1542
+ for (const name of Object.keys(hues)) palette[name] = Object.fromEntries(steps.map((s, i) => [String(s), {
1543
+ $type: "color",
1544
+ $value: oklch(name, i)
1545
+ }]));
1546
+ const ref = (r) => r === "white" || r === "black" ? r : `{color.palette.${r}}`;
1547
+ const semantic = (mode) => Object.fromEntries(Object.entries(semanticColors).map(([k, pair]) => [k, {
1548
+ $type: "color",
1549
+ $value: ref(pair[mode])
1550
+ }]));
1551
+ return {
1552
+ color: {
1553
+ palette,
1554
+ light: semantic(0),
1555
+ dark: semantic(1)
1556
+ },
1557
+ space: group("dimension", tokens.space, dimension),
1558
+ radius: group("dimension", tokens.radii, dimension),
1559
+ fontSize: group("dimension", tokens.fontSizes, dimension),
1560
+ fontWeight: group("fontWeight", tokens.fontWeights, Number),
1561
+ lineHeight: group("number", tokens.lineHeights, Number),
1562
+ letterSpacing: group("dimension", tokens.letterSpacings, dimension),
1563
+ fontFamily: group("fontFamily", tokens.fonts, (v) => v.split(",").map((f) => f.trim().replace(/^"|"$/g, ""))),
1564
+ shadow: group("shadow", tokens.shadows),
1565
+ breakpoint: group("dimension", tokens.breakpoints, (v) => ({
1566
+ value: Number(v),
1567
+ unit: "px"
1568
+ }))
1569
+ };
1570
+ }
1571
+ // src/classes.ts
1572
+ var BREAKPOINT_NOTE = "breakpoint widths differ: Sobagu sm/md/lg/xl = 600/840/1024/1440px (check the layout at each size)";
1573
+ /** Variant prefix → Sobagu condition name. */
1574
+ var VARIANTS = {
1575
+ hover: "hover",
1576
+ focus: "focus",
1577
+ "focus-visible": "focusVisible",
1578
+ "focus-within": "focusWithin",
1579
+ active: "active",
1580
+ disabled: "_disabled",
1581
+ visited: "visited",
1582
+ checked: "_checked",
1583
+ required: "_required",
1584
+ "read-only": "_readOnly",
1585
+ indeterminate: "indeterminate",
1586
+ "placeholder-shown": "placeholderShown",
1587
+ open: "open",
1588
+ first: "first",
1589
+ last: "last",
1590
+ only: "only",
1591
+ odd: "odd",
1592
+ even: "even",
1593
+ "first-of-type": "firstOfType",
1594
+ "last-of-type": "lastOfType",
1595
+ empty: "empty",
1596
+ target: "target",
1597
+ before: "before",
1598
+ after: "after",
1599
+ placeholder: "_placeholder",
1600
+ selection: "selection",
1601
+ marker: "marker",
1602
+ file: "file",
1603
+ backdrop: "backdrop",
1604
+ "first-line": "firstLine",
1605
+ "first-letter": "firstLetter",
1606
+ "group-hover": "groupHover",
1607
+ "group-focus-within": "groupFocusWithin",
1608
+ "group-active": "groupActive",
1609
+ "group-open": "groupOpen",
1610
+ "peer-hover": "peerHover",
1611
+ "peer-focus": "peerFocus",
1612
+ "peer-checked": "peerChecked",
1613
+ "peer-disabled": "peerDisabled",
1614
+ "aria-expanded": "ariaExpanded",
1615
+ "aria-selected": "ariaSelected",
1616
+ "aria-checked": "ariaChecked",
1617
+ "aria-pressed": "ariaPressed",
1618
+ "aria-disabled": "ariaDisabled",
1619
+ rtl: "rtl",
1620
+ ltr: "ltr",
1621
+ dark: "dark",
1622
+ sm: "sm",
1623
+ md: "md",
1624
+ lg: "lg",
1625
+ xl: "xl",
1626
+ "motion-safe": "motionSafe",
1627
+ "motion-reduce": "reduceMotion",
1628
+ "contrast-more": "contrastMore",
1629
+ "forced-colors": "forcedColors",
1630
+ portrait: "portrait",
1631
+ landscape: "landscape",
1632
+ print: "print"
1633
+ };
1634
+ var VARIANT_NOTES = {
1635
+ sm: BREAKPOINT_NOTE,
1636
+ md: BREAKPOINT_NOTE,
1637
+ lg: BREAKPOINT_NOTE,
1638
+ xl: BREAKPOINT_NOTE,
1639
+ "group-hover": "needs the `group` prop on a parent (a migrated `group` class becomes that prop)",
1640
+ "group-focus-within": "needs the `group` prop on a parent",
1641
+ "group-active": "needs the `group` prop on a parent",
1642
+ "group-open": "needs the `group` prop on a parent",
1643
+ "peer-hover": "needs the `peer` prop on an earlier sibling",
1644
+ "peer-focus": "needs the `peer` prop on an earlier sibling",
1645
+ "peer-checked": "needs the `peer` prop on an earlier sibling",
1646
+ "peer-disabled": "needs the `peer` prop on an earlier sibling"
1647
+ };
1648
+ var NUM = /^\d+(?:\.\d+)?$/;
1649
+ var FRACTION = /^(\d+)\/(\d+)$/;
1650
+ /** "[13px]" → "13px", underscores become spaces. */
1651
+ function arbitrary(v) {
1652
+ if (!v.startsWith("[") || !v.endsWith("]") || v.length < 3) return null;
1653
+ return v.slice(1, -1).replace(/_/g, " ");
1654
+ }
1655
+ function percent(a, b) {
1656
+ return `${+(a / b * 100).toFixed(6)}%`;
1657
+ }
1658
+ /** Spacing value: numbers are 4px units in both systems, so they map 1:1. */
1659
+ function spaceValue(v, neg, extra = {}) {
1660
+ if (NUM.test(v)) return neg ? -Number(v) : Number(v);
1661
+ if (v === "px") return neg ? "-1px" : "1px";
1662
+ if (v in extra) return neg ? null : extra[v];
1663
+ const a = arbitrary(v);
1664
+ if (a !== null) return neg ? null : a;
1665
+ return null;
1666
+ }
1667
+ function insetValue(v, neg) {
1668
+ const f = FRACTION.exec(v);
1669
+ if (f) return `${neg ? "-" : ""}${percent(Number(f[1]), Number(f[2]))}`;
1670
+ if (v === "full") return neg ? "-100%" : "100%";
1671
+ return spaceValue(v, neg, { auto: "auto" });
1672
+ }
1673
+ function sizeValue(v, axis) {
1674
+ if (NUM.test(v)) return { value: Number(v) };
1675
+ if (v === "px") return { value: "1px" };
1676
+ const f = FRACTION.exec(v);
1677
+ if (f) {
1678
+ const a = Number(f[1]);
1679
+ const b = Number(f[2]);
1680
+ if (b === 0) return null;
1681
+ return { value: a * 2 === b ? "half" : percent(a, b) };
1682
+ }
1683
+ switch (v) {
1684
+ case "full":
1685
+ case "auto":
1686
+ case "fit":
1687
+ case "min":
1688
+ case "max": return { value: v };
1689
+ case "screen": return axis === "y" ? {
1690
+ value: "screen",
1691
+ approx: "Sobagu \"screen\" height is 100dvh (dynamic viewport), not 100vh"
1692
+ } : { value: "screen" };
1693
+ case "dvh":
1694
+ case "svh":
1695
+ case "lvh": return { value: `100${v}` };
1696
+ case "dvw":
1697
+ case "svw":
1698
+ case "lvw": return { value: `100${v}` };
1699
+ }
1700
+ const a = arbitrary(v);
1701
+ return a === null ? null : { value: a };
1702
+ }
1703
+ /** Colour names that exist in Sobagu's palette, plus the nearest Sobagu hue for other common names. */
1704
+ var PALETTE = /* @__PURE__ */ new Set([
1705
+ "gray",
1706
+ "red",
1707
+ "orange",
1708
+ "amber",
1709
+ "green",
1710
+ "teal",
1711
+ "blue",
1712
+ "indigo",
1713
+ "violet",
1714
+ "pink"
1715
+ ]);
1716
+ var HUE_ALIAS = {
1717
+ slate: "gray",
1718
+ zinc: "gray",
1719
+ neutral: "gray",
1720
+ stone: "gray",
1721
+ sky: "teal",
1722
+ cyan: "teal",
1723
+ purple: "violet",
1724
+ fuchsia: "violet",
1725
+ rose: "pink",
1726
+ emerald: "green",
1727
+ lime: "green",
1728
+ yellow: "amber"
1729
+ };
1730
+ var STEPS = new Set(steps.map(String));
1731
+ var PLAIN_COLORS = {
1732
+ white: "white",
1733
+ black: "black",
1734
+ transparent: "transparent",
1735
+ current: "currentColor",
1736
+ inherit: "inherit"
1737
+ };
1738
+ function colorValue(v) {
1739
+ if (v in PLAIN_COLORS) return { value: PLAIN_COLORS[v] };
1740
+ const a = arbitrary(v);
1741
+ if (a !== null) return /^(#|rgb|hsl|oklch|oklab|lab|lch|color|var\()/.test(a) ? { value: a } : null;
1742
+ const m = /^([a-z]+)-(\d{2,3})$/.exec(v);
1743
+ if (!m || !STEPS.has(m[2])) return null;
1744
+ const hue = m[1];
1745
+ if (PALETTE.has(hue)) return { value: `${hue}.${m[2]}` };
1746
+ const alias = HUE_ALIAS[hue];
1747
+ if (alias) return {
1748
+ value: `${alias}.${m[2]}`,
1749
+ approx: `"${hue}" is not in the Sobagu palette; using the nearest hue "${alias}"`
1750
+ };
1751
+ return null;
1752
+ }
1753
+ var d = (prop, value) => [[prop, value]];
1754
+ var FIXED = {};
1755
+ var fixed = FIXED;
1756
+ var add = (names, prop, map = (n) => n, prefix = "") => {
1757
+ for (const n of names) fixed[prefix + n] = d(prop, map(n));
1758
+ };
1759
+ add([
1760
+ "block",
1761
+ "inline-block",
1762
+ "inline",
1763
+ "flex",
1764
+ "inline-flex",
1765
+ "grid",
1766
+ "inline-grid",
1767
+ "contents",
1768
+ "table",
1769
+ "table-row",
1770
+ "table-cell",
1771
+ "flow-root",
1772
+ "list-item"
1773
+ ], "display");
1774
+ fixed.hidden = d("display", "none");
1775
+ add([
1776
+ "static",
1777
+ "relative",
1778
+ "absolute",
1779
+ "fixed",
1780
+ "sticky"
1781
+ ], "position");
1782
+ fixed["flex-row"] = d("flexDir", "row");
1783
+ fixed["flex-col"] = d("flexDir", "col");
1784
+ fixed["flex-row-reverse"] = d("flexDir", "rowReverse");
1785
+ fixed["flex-col-reverse"] = d("flexDir", "colReverse");
1786
+ add([
1787
+ "wrap",
1788
+ "nowrap",
1789
+ "wrap-reverse"
1790
+ ], "wrap", (n) => n, "flex-");
1791
+ fixed["flex-1"] = d("flex", "1 1 0%");
1792
+ fixed["flex-auto"] = d("flex", "1 1 auto");
1793
+ fixed["flex-initial"] = d("flex", "0 1 auto");
1794
+ fixed["flex-none"] = d("flex", "none");
1795
+ fixed.grow = d("grow", 1);
1796
+ fixed["grow-0"] = d("grow", 0);
1797
+ fixed.shrink = d("shrink", 1);
1798
+ fixed["shrink-0"] = d("shrink", 0);
1799
+ var flexPos = (n) => n === "start" || n === "end" ? `flex-${n}` : n;
1800
+ add([
1801
+ "start",
1802
+ "end",
1803
+ "center",
1804
+ "baseline",
1805
+ "stretch"
1806
+ ], "align", flexPos, "items-");
1807
+ add([
1808
+ "start",
1809
+ "end",
1810
+ "center",
1811
+ "between",
1812
+ "around",
1813
+ "evenly",
1814
+ "stretch",
1815
+ "normal"
1816
+ ], "justify", flexPos, "justify-");
1817
+ add([
1818
+ "auto",
1819
+ "start",
1820
+ "end",
1821
+ "center",
1822
+ "stretch",
1823
+ "baseline"
1824
+ ], "self", flexPos, "self-");
1825
+ add([
1826
+ "start",
1827
+ "end",
1828
+ "center",
1829
+ "between",
1830
+ "around",
1831
+ "evenly",
1832
+ "stretch",
1833
+ "normal"
1834
+ ], "alignContent", flexPos, "content-");
1835
+ add([
1836
+ "start",
1837
+ "end",
1838
+ "center",
1839
+ "stretch",
1840
+ "baseline"
1841
+ ], "placeItems", (n) => n, "place-items-");
1842
+ add([
1843
+ "start",
1844
+ "end",
1845
+ "center",
1846
+ "between",
1847
+ "around",
1848
+ "evenly",
1849
+ "stretch"
1850
+ ], "placeContent", (n) => [
1851
+ "between",
1852
+ "around",
1853
+ "evenly"
1854
+ ].includes(n) ? `space-${n}` : n, "place-content-");
1855
+ add([
1856
+ "auto",
1857
+ "start",
1858
+ "end",
1859
+ "center",
1860
+ "stretch"
1861
+ ], "placeSelf", (n) => n, "place-self-");
1862
+ add([
1863
+ "start",
1864
+ "end",
1865
+ "center",
1866
+ "stretch"
1867
+ ], "justifyItems", (n) => n, "justify-items-");
1868
+ add([
1869
+ "auto",
1870
+ "start",
1871
+ "end",
1872
+ "center",
1873
+ "stretch"
1874
+ ], "justifySelf", (n) => n, "justify-self-");
1875
+ fixed["grid-flow-row"] = d("autoFlow", "row");
1876
+ fixed["grid-flow-col"] = d("autoFlow", "col");
1877
+ fixed["grid-flow-dense"] = d("autoFlow", "dense");
1878
+ fixed["grid-flow-row-dense"] = d("autoFlow", "rowDense");
1879
+ fixed["grid-flow-col-dense"] = d("autoFlow", "colDense");
1880
+ fixed["col-span-full"] = d("span", "full");
1881
+ fixed["row-span-full"] = d("spanRows", "full");
1882
+ fixed["grid-cols-none"] = d("cols", "none");
1883
+ fixed["grid-rows-none"] = d("rows", "none");
1884
+ add([
1885
+ "left",
1886
+ "center",
1887
+ "right",
1888
+ "justify",
1889
+ "start",
1890
+ "end"
1891
+ ], "textAlign", (n) => n, "text-");
1892
+ add([
1893
+ "uppercase",
1894
+ "lowercase",
1895
+ "capitalize"
1896
+ ], "textTransform");
1897
+ fixed["normal-case"] = d("textTransform", "none");
1898
+ fixed.italic = d("fontStyle", "italic");
1899
+ fixed["not-italic"] = d("fontStyle", "normal");
1900
+ add([
1901
+ "underline",
1902
+ "overline",
1903
+ "line-through"
1904
+ ], "decoration");
1905
+ fixed["no-underline"] = d("decoration", "none");
1906
+ add([
1907
+ "normal",
1908
+ "nowrap",
1909
+ "pre",
1910
+ "pre-line",
1911
+ "pre-wrap",
1912
+ "break-spaces"
1913
+ ], "whiteSpace", (n) => n, "whitespace-");
1914
+ fixed["break-all"] = d("wordBreak", "break-all");
1915
+ fixed["break-keep"] = d("wordBreak", "keep-all");
1916
+ fixed["tabular-nums"] = d("numeric", "tabular");
1917
+ fixed["oldstyle-nums"] = d("numeric", "oldstyle");
1918
+ fixed["slashed-zero"] = d("numeric", "slashed");
1919
+ add([
1920
+ "sans",
1921
+ "serif",
1922
+ "mono"
1923
+ ], "font", (n) => n, "font-");
1924
+ add([
1925
+ "light",
1926
+ "normal",
1927
+ "medium",
1928
+ "semibold",
1929
+ "bold",
1930
+ "black"
1931
+ ], "weight", (n) => n, "font-");
1932
+ add([
1933
+ "none",
1934
+ "tight",
1935
+ "snug",
1936
+ "normal",
1937
+ "relaxed"
1938
+ ], "leading", (n) => n, "leading-");
1939
+ add([
1940
+ "tight",
1941
+ "normal",
1942
+ "wide",
1943
+ "wider"
1944
+ ], "tracking", (n) => n, "tracking-");
1945
+ add([
1946
+ "none",
1947
+ "disc",
1948
+ "decimal"
1949
+ ], "listStyle", (n) => n, "list-");
1950
+ add([
1951
+ "balance",
1952
+ "pretty",
1953
+ "nowrap",
1954
+ "wrap"
1955
+ ], "textWrap", (n) => n, "text-");
1956
+ fixed.truncate = d("truncate", true);
1957
+ for (const o of [
1958
+ "auto",
1959
+ "hidden",
1960
+ "clip",
1961
+ "visible",
1962
+ "scroll"
1963
+ ]) {
1964
+ fixed[`overflow-${o}`] = d("overflow", o);
1965
+ fixed[`overflow-x-${o}`] = d("overflowX", o);
1966
+ fixed[`overflow-y-${o}`] = d("overflowY", o);
1967
+ }
1968
+ fixed.visible = d("visibility", "visible");
1969
+ fixed.invisible = d("visibility", "hidden");
1970
+ fixed.collapse = d("visibility", "collapse");
1971
+ add([
1972
+ "contain",
1973
+ "cover",
1974
+ "fill",
1975
+ "none",
1976
+ "scale-down"
1977
+ ], "objectFit", (n) => n, "object-");
1978
+ fixed["aspect-square"] = d("aspect", "square");
1979
+ fixed["aspect-video"] = d("aspect", "video");
1980
+ fixed["aspect-auto"] = d("aspect", "auto");
1981
+ fixed.isolate = d("isolation", "isolate");
1982
+ fixed["isolation-auto"] = d("isolation", "auto");
1983
+ fixed["box-border"] = d("boxSizing", "border-box");
1984
+ fixed["box-content"] = d("boxSizing", "content-box");
1985
+ add([
1986
+ "left",
1987
+ "right",
1988
+ "none",
1989
+ "start",
1990
+ "end"
1991
+ ], "float", (n) => n === "start" || n === "end" ? `inline-${n}` : n, "float-");
1992
+ add([
1993
+ "left",
1994
+ "right",
1995
+ "both",
1996
+ "none"
1997
+ ], "clear", (n) => n, "clear-");
1998
+ fixed["sr-only"] = d("srOnly", true);
1999
+ fixed.group = d("group", true);
2000
+ fixed.peer = d("peer", true);
2001
+ fixed["pointer-events-none"] = d("pointerEvents", "none");
2002
+ fixed["pointer-events-auto"] = d("pointerEvents", "auto");
2003
+ add([
2004
+ "none",
2005
+ "text",
2006
+ "all",
2007
+ "auto"
2008
+ ], "userSelect", (n) => n, "select-");
2009
+ fixed.resize = d("resize", "both");
2010
+ fixed["resize-none"] = d("resize", "none");
2011
+ fixed["resize-x"] = d("resize", "horizontal");
2012
+ fixed["resize-y"] = d("resize", "vertical");
2013
+ fixed["appearance-none"] = d("appearance", "none");
2014
+ fixed["transition-none"] = d("transition", "none");
2015
+ fixed["ease-linear"] = d("ease", "linear");
2016
+ fixed["ease-in"] = d("ease", "in");
2017
+ fixed["ease-out"] = d("ease", "out");
2018
+ fixed["ease-in-out"] = d("ease", "inOut");
2019
+ add([
2020
+ "spin",
2021
+ "ping",
2022
+ "pulse",
2023
+ "bounce",
2024
+ "none"
2025
+ ], "animate", (n) => n, "animate-");
2026
+ fixed["shadow-none"] = d("shadow", "none");
2027
+ fixed["rounded-none"] = d("radius", "none");
2028
+ add([
2029
+ "solid",
2030
+ "dashed",
2031
+ "dotted",
2032
+ "double",
2033
+ "none",
2034
+ "hidden"
2035
+ ], "borderStyle", (n) => n, "border-");
2036
+ add([
2037
+ "cover",
2038
+ "contain",
2039
+ "auto"
2040
+ ], "bgSize", (n) => n, "bg-");
2041
+ add([
2042
+ "center",
2043
+ "top",
2044
+ "bottom",
2045
+ "left",
2046
+ "right"
2047
+ ], "bgPosition", (n) => n, "bg-");
2048
+ fixed["bg-no-repeat"] = d("bgRepeat", "no-repeat");
2049
+ fixed["bg-repeat"] = d("bgRepeat", "repeat");
2050
+ fixed["bg-fixed"] = d("bgAttachment", "fixed");
2051
+ fixed["outline-none"] = d("outline", "none");
2052
+ /** Classes that map, but not exactly. */
2053
+ var APPROX_FIXED = {
2054
+ "font-thin": {
2055
+ decls: d("weight", "light"),
2056
+ note: "Sobagu has no thinner weight than \"light\" (300)"
2057
+ },
2058
+ "font-extralight": {
2059
+ decls: d("weight", "light"),
2060
+ note: "Sobagu has no thinner weight than \"light\" (300)"
2061
+ },
2062
+ "font-extrabold": {
2063
+ decls: d("weight", "black"),
2064
+ note: "Sobagu has no 800 weight; using \"black\" (900)"
2065
+ },
2066
+ "leading-loose": {
2067
+ decls: d("leading", "relaxed"),
2068
+ note: "Sobagu's loosest line height is \"relaxed\" (1.75)"
2069
+ },
2070
+ "tracking-tighter": {
2071
+ decls: d("tracking", "tight"),
2072
+ note: "Sobagu's tightest letter spacing is \"tight\""
2073
+ },
2074
+ "tracking-widest": {
2075
+ decls: d("tracking", "wider"),
2076
+ note: "Sobagu's widest letter spacing is \"wider\""
2077
+ },
2078
+ transition: {
2079
+ decls: d("transition", "normal"),
2080
+ note: "Sobagu \"normal\" transition is all properties, 200ms ease-out"
2081
+ },
2082
+ "transition-all": {
2083
+ decls: d("transition", "normal"),
2084
+ note: "Sobagu \"normal\" transition is all properties, 200ms ease-out"
2085
+ },
2086
+ shadow: {
2087
+ decls: d("shadow", "sm"),
2088
+ note: "plain `shadow` maps to Sobagu \"sm\""
2089
+ },
2090
+ "shadow-2xl": {
2091
+ decls: d("shadow", "xl"),
2092
+ note: "Sobagu's largest shadow is \"xl\""
2093
+ },
2094
+ rounded: {
2095
+ decls: d("radius", "sm"),
2096
+ note: "plain `rounded` maps to Sobagu \"sm\" (4px)"
2097
+ },
2098
+ "rounded-3xl": {
2099
+ decls: d("radius", "2xl"),
2100
+ note: "Sobagu's largest radius below \"full\" is \"2xl\" (24px)"
2101
+ }
2102
+ };
2103
+ var FONT_SIZE = {
2104
+ xs: { value: "xs" },
2105
+ sm: { value: "sm" },
2106
+ base: { value: "md" },
2107
+ lg: {
2108
+ value: "lg",
2109
+ approx: "closest Sobagu size is \"lg\" (1.2rem)"
2110
+ },
2111
+ xl: {
2112
+ value: "lg",
2113
+ approx: "closest Sobagu size is \"lg\" (1.2rem)"
2114
+ },
2115
+ "2xl": {
2116
+ value: "xl",
2117
+ approx: "closest Sobagu size is \"xl\" (1.44rem)"
2118
+ },
2119
+ "3xl": {
2120
+ value: "2xl",
2121
+ approx: "closest Sobagu size is \"2xl\" (1.728rem)"
2122
+ },
2123
+ "4xl": {
2124
+ value: "3xl",
2125
+ approx: "closest Sobagu size is \"3xl\" (2.074rem)"
2126
+ },
2127
+ "5xl": { value: "5xl" },
2128
+ "6xl": {
2129
+ value: "5xl",
2130
+ approx: "Sobagu's largest size is \"5xl\" (2.986rem)"
2131
+ }
2132
+ };
2133
+ var MAX_W = {
2134
+ none: { value: "none" },
2135
+ full: { value: "full" },
2136
+ prose: { value: "prose" },
2137
+ fit: { value: "fit" },
2138
+ min: { value: "min" },
2139
+ max: { value: "max" },
2140
+ screen: { value: "screen" },
2141
+ lg: {
2142
+ value: "narrow",
2143
+ approx: "mapped to Sobagu \"narrow\" (640px)"
2144
+ },
2145
+ xl: {
2146
+ value: "narrow",
2147
+ approx: "mapped to Sobagu \"narrow\" (640px)"
2148
+ },
2149
+ "2xl": {
2150
+ value: "narrow",
2151
+ approx: "mapped to Sobagu \"narrow\" (640px)"
2152
+ },
2153
+ "3xl": {
2154
+ value: "narrow",
2155
+ approx: "mapped to Sobagu \"narrow\" (640px)"
2156
+ },
2157
+ "4xl": {
2158
+ value: "content",
2159
+ approx: "mapped to Sobagu \"content\" (960px)"
2160
+ },
2161
+ "5xl": {
2162
+ value: "content",
2163
+ approx: "mapped to Sobagu \"content\" (960px)"
2164
+ },
2165
+ "6xl": {
2166
+ value: "wide",
2167
+ approx: "mapped to Sobagu \"wide\" (1200px)"
2168
+ },
2169
+ "7xl": {
2170
+ value: "wide",
2171
+ approx: "mapped to Sobagu \"wide\" (1200px)"
2172
+ }
2173
+ };
2174
+ var RADIUS = /* @__PURE__ */ new Set([
2175
+ "sm",
2176
+ "md",
2177
+ "lg",
2178
+ "xl",
2179
+ "2xl",
2180
+ "full"
2181
+ ]);
2182
+ var SHADOW = /* @__PURE__ */ new Set([
2183
+ "sm",
2184
+ "md",
2185
+ "lg",
2186
+ "xl"
2187
+ ]);
2188
+ var SPACE_PROPS = {
2189
+ p: "p",
2190
+ px: "px",
2191
+ py: "py",
2192
+ pt: "pt",
2193
+ pr: "pr",
2194
+ pb: "pb",
2195
+ pl: "pl",
2196
+ ps: "ps",
2197
+ pe: "pe",
2198
+ m: "m",
2199
+ mx: "mx",
2200
+ my: "my",
2201
+ mt: "mt",
2202
+ mr: "mr",
2203
+ mb: "mb",
2204
+ ml: "ml",
2205
+ ms: "ms",
2206
+ me: "me",
2207
+ gap: "gap",
2208
+ "gap-x": "gapX",
2209
+ "gap-y": "gapY",
2210
+ indent: "indent",
2211
+ "scroll-m": "scrollMargin",
2212
+ "scroll-p": "scrollPadding"
2213
+ };
2214
+ var INSET_PROPS = {
2215
+ inset: "inset",
2216
+ "inset-x": "insetX",
2217
+ "inset-y": "insetY",
2218
+ top: "top",
2219
+ right: "right",
2220
+ bottom: "bottom",
2221
+ left: "left",
2222
+ start: "start",
2223
+ end: "end"
2224
+ };
2225
+ var SIZE_PROPS = {
2226
+ w: ["w", "x"],
2227
+ "min-w": ["minW", "x"],
2228
+ h: ["h", "y"],
2229
+ "min-h": ["minH", "y"],
2230
+ "max-h": ["maxH", "y"],
2231
+ basis: ["basis", "x"]
2232
+ };
2233
+ var BORDER_SIDES = {
2234
+ "": "border",
2235
+ t: "borderTop",
2236
+ r: "borderRight",
2237
+ b: "borderBottom",
2238
+ l: "borderLeft",
2239
+ s: "borderStart",
2240
+ e: "borderEnd"
2241
+ };
2242
+ var COLOR_PREFIX = {
2243
+ bg: "bg",
2244
+ text: "color",
2245
+ fill: "fill",
2246
+ stroke: "stroke",
2247
+ accent: "accent",
2248
+ caret: "caret",
2249
+ decoration: "decorationColor"
2250
+ };
2251
+ /** Map one utility (variants already removed) to declarations, or null when unknown. */
2252
+ function utility(name) {
2253
+ const fx = FIXED[name];
2254
+ if (fx) return { decls: fx };
2255
+ const ap = APPROX_FIXED[name];
2256
+ if (ap) return {
2257
+ decls: ap.decls,
2258
+ approx: ap.note
2259
+ };
2260
+ const neg = name.startsWith("-");
2261
+ const n = neg ? name.slice(1) : name;
2262
+ let m = /^(p[xytrblse]?|m[xytrblse]?|gap(?:-[xy])?|indent|scroll-[mp])-(.+)$/.exec(n);
2263
+ if (m && SPACE_PROPS[m[1]]) {
2264
+ const isMargin = m[1].startsWith("m") || m[1].startsWith("scroll-m");
2265
+ if (neg && !isMargin && m[1] !== "indent") return null;
2266
+ const v = spaceValue(m[2], neg, isMargin ? { auto: "auto" } : {});
2267
+ return v === null ? null : { decls: d(SPACE_PROPS[m[1]], v) };
2268
+ }
2269
+ m = /^(inset(?:-[xy])?|top|right|bottom|left|start|end)-(.+)$/.exec(n);
2270
+ if (m && INSET_PROPS[m[1]]) {
2271
+ const v = insetValue(m[2], neg);
2272
+ return v === null ? null : { decls: d(INSET_PROPS[m[1]], v) };
2273
+ }
2274
+ if (neg) {
2275
+ m = /^z-(\d+)$/.exec(n);
2276
+ if (m) return { decls: d("z", -Number(m[1])) };
2277
+ m = /^order-(\d+)$/.exec(n);
2278
+ if (m) return { decls: d("order", -Number(m[1])) };
2279
+ return null;
2280
+ }
2281
+ m = /^(w|min-w|h|min-h|max-h|basis)-(.+)$/.exec(name);
2282
+ if (m && SIZE_PROPS[m[1]]) {
2283
+ const [prop, axis] = SIZE_PROPS[m[1]];
2284
+ const v = sizeValue(m[2], axis);
2285
+ return v ? {
2286
+ decls: d(prop, v.value),
2287
+ ...v.approx ? { approx: v.approx } : {}
2288
+ } : null;
2289
+ }
2290
+ m = /^size-(.+)$/.exec(name);
2291
+ if (m) {
2292
+ const v = sizeValue(m[1], "x");
2293
+ return v && v.value !== "screen" ? { decls: [["w", v.value], ["h", v.value]] } : null;
2294
+ }
2295
+ m = /^max-w-(.+)$/.exec(name);
2296
+ if (m) {
2297
+ const named = MAX_W[m[1]];
2298
+ if (named) return {
2299
+ decls: d("maxW", named.value),
2300
+ ...named.approx ? { approx: named.approx } : {}
2301
+ };
2302
+ if (/^screen-/.test(m[1])) return null;
2303
+ const v = sizeValue(m[1], "x");
2304
+ return v ? { decls: d("maxW", v.value) } : null;
2305
+ }
2306
+ m = /^grid-(cols|rows)-(\d+)$/.exec(name);
2307
+ if (m) return { decls: d(m[1], Number(m[2])) };
2308
+ m = /^grid-(cols|rows)-(\[.+\])$/.exec(name);
2309
+ if (m) return { decls: d(m[1], arbitrary(m[2])) };
2310
+ m = /^(col|row)-span-(\d+)$/.exec(name);
2311
+ if (m) return { decls: d(m[1] === "col" ? "span" : "spanRows", Number(m[2])) };
2312
+ m = /^(col|row)-(start|end)-(\d+|auto)$/.exec(name);
2313
+ if (m) return { decls: d(`${m[1]}${m[2] === "start" ? "Start" : "End"}`, m[3] === "auto" ? "auto" : m[3]) };
2314
+ m = /^order-(\d+|none)$/.exec(name);
2315
+ if (m) return { decls: d("order", m[1] === "none" ? 0 : Number(m[1])) };
2316
+ m = /^(grow|shrink)-(\d+)$/.exec(name);
2317
+ if (m) return { decls: d(m[1], Number(m[2])) };
2318
+ m = /^text-(xs|sm|base|lg|xl|[2-6]xl)$/.exec(name);
2319
+ if (m) {
2320
+ const fs = FONT_SIZE[m[1]];
2321
+ return {
2322
+ decls: d("text", fs.value),
2323
+ ...fs.approx ? { approx: fs.approx } : {}
2324
+ };
2325
+ }
2326
+ m = /^line-clamp-(\d+)$/.exec(name);
2327
+ if (m) return { decls: d("lineClamp", Number(m[1])) };
2328
+ m = /^text-(\[.+\])$/.exec(name);
2329
+ if (m) {
2330
+ const a = arbitrary(m[1]);
2331
+ if (/^\d*\.?\d+(px|rem|em|%|vw|vh|ch)$/.test(a) || a.startsWith("clamp(")) return { decls: d("text", a) };
2332
+ const c = colorValue(m[1]);
2333
+ return c ? { decls: d("color", c.value) } : null;
2334
+ }
2335
+ m = /^(bg|text|fill|stroke|accent|caret|decoration)-(.+)$/.exec(name);
2336
+ if (m) {
2337
+ const c = colorValue(m[2]);
2338
+ if (!c) return null;
2339
+ return {
2340
+ decls: d(COLOR_PREFIX[m[1]], c.value),
2341
+ ...c.approx ? { approx: c.approx } : {}
2342
+ };
2343
+ }
2344
+ m = /^rounded-(.+)$/.exec(name);
2345
+ if (m) {
2346
+ if (RADIUS.has(m[1])) return { decls: d("radius", m[1]) };
2347
+ const a = arbitrary(m[1]);
2348
+ return a === null ? null : { decls: d("radius", a) };
2349
+ }
2350
+ m = /^shadow-(.+)$/.exec(name);
2351
+ if (m && SHADOW.has(m[1])) return { decls: d("shadow", m[1]) };
2352
+ m = /^border(?:-([trblse]))?(?:-(\d+))?$/.exec(name);
2353
+ if (m) {
2354
+ const prop = BORDER_SIDES[m[1] ?? ""];
2355
+ const width = m[2] === void 0 ? 1 : Number(m[2]);
2356
+ if (width === 0) return prop === "border" ? { decls: d("borderWidth", 0) } : null;
2357
+ return { decls: d(prop, width) };
2358
+ }
2359
+ m = /^border-(.+)$/.exec(name);
2360
+ if (m) {
2361
+ const c = colorValue(m[1]);
2362
+ return c ? {
2363
+ decls: [],
2364
+ pending: {
2365
+ kind: "border",
2366
+ value: c.value
2367
+ },
2368
+ ...c.approx ? { approx: c.approx } : {}
2369
+ } : null;
2370
+ }
2371
+ m = /^outline(?:-(\d+))?$/.exec(name);
2372
+ if (m) return {
2373
+ decls: d("outline", m[1] === void 0 ? 1 : Number(m[1])),
2374
+ approx: "Sobagu outline numbers set width, solid style and the \"border\" colour"
2375
+ };
2376
+ m = /^outline-offset-(\d+)$/.exec(name);
2377
+ if (m) return { decls: d("outlineOffset", Number(m[1])) };
2378
+ m = /^ring(?:-(\d+))?$/.exec(name);
2379
+ if (m) {
2380
+ const w = m[1] === void 0 ? 3 : Number(m[1]);
2381
+ return {
2382
+ decls: d("ring", w === 0 ? "none" : w),
2383
+ approx: "Sobagu `ring` is a solid outline (primary colour unless a ring colour is given), not a box-shadow"
2384
+ };
2385
+ }
2386
+ m = /^ring-offset-(\d+)$/.exec(name);
2387
+ if (m) return { decls: d("ringOffset", Number(m[1])) };
2388
+ m = /^(outline|ring)-(.+)$/.exec(name);
2389
+ if (m) {
2390
+ const c = colorValue(m[2]);
2391
+ const kind = m[1];
2392
+ return c ? {
2393
+ decls: [],
2394
+ pending: {
2395
+ kind,
2396
+ value: c.value
2397
+ },
2398
+ ...c.approx ? { approx: c.approx } : {}
2399
+ } : null;
2400
+ }
2401
+ m = /^opacity-(\d+)$/.exec(name);
2402
+ if (m && Number(m[1]) <= 100) return { decls: d("opacity", Number(m[1]) / 100) };
2403
+ m = /^z-(\d+|auto)$/.exec(name);
2404
+ if (m) return { decls: d("z", m[1] === "auto" ? "auto" : Number(m[1])) };
2405
+ m = /^cursor-([a-z-]+)$/.exec(name);
2406
+ if (m) return { decls: d("cursor", m[1]) };
2407
+ m = /^(duration|delay)-(\d+)$/.exec(name);
2408
+ if (m) return { decls: d(m[1], Number(m[2])) };
2409
+ return null;
2410
+ }
2411
+ /** Split "md:hover:p-4" into ["md", "hover", "p-4"], ignoring ":" inside [brackets]. */
2412
+ function splitVariants(cls) {
2413
+ const parts = [];
2414
+ let depth = 0;
2415
+ let cur = "";
2416
+ for (const ch of cls) {
2417
+ if (ch === "[") depth++;
2418
+ else if (ch === "]") depth--;
2419
+ if (ch === ":" && depth === 0) {
2420
+ parts.push(cur);
2421
+ cur = "";
2422
+ } else cur += ch;
2423
+ }
2424
+ parts.push(cur);
2425
+ return parts;
2426
+ }
2427
+ function nodeFor(root, path) {
2428
+ let node = root;
2429
+ for (const key of path) {
2430
+ const next = node[key];
2431
+ if (typeof next === "object") node = next;
2432
+ else {
2433
+ const created = {};
2434
+ node[key] = created;
2435
+ node = created;
2436
+ }
2437
+ }
2438
+ return node;
2439
+ }
2440
+ /**
2441
+ * Convert a class string. Unknown classes are kept (never dropped) and listed in `notes`.
2442
+ * convertClasses('flex p-4 md:p-6 hover:bg-gray-100') →
2443
+ * { style: { display: 'flex', p: 4, md: { p: 6 }, hover: { bg: 'gray.100' } }, kept: [], notes: [...] }
2444
+ */
2445
+ function convertClasses(input) {
2446
+ const style = {};
2447
+ const kept = [];
2448
+ const notes = [];
2449
+ const origin = /* @__PURE__ */ new Map();
2450
+ const pending = [];
2451
+ const noted = /* @__PURE__ */ new Set();
2452
+ const note = (cls, kind, message) => {
2453
+ const key = `${kind}|${cls}|${message}`;
2454
+ if (noted.has(key)) return;
2455
+ noted.add(key);
2456
+ notes.push({
2457
+ cls,
2458
+ kind,
2459
+ message
2460
+ });
2461
+ };
2462
+ const keep = (cls, kind, message) => {
2463
+ kept.push(cls);
2464
+ note(cls, kind, message);
2465
+ };
2466
+ for (const cls of input.split(/\s+/).filter(Boolean)) {
2467
+ const parts = splitVariants(cls);
2468
+ const base = parts.pop();
2469
+ if (base.startsWith("!") || base.endsWith("!")) {
2470
+ keep(cls, "unknown", "important (!) modifier is not supported");
2471
+ continue;
2472
+ }
2473
+ if (/\/\d+$/.test(base) && !/^-?(w|h|min-w|min-h|max-w|max-h|basis|size|inset(?:-[xy])?|top|right|bottom|left|start|end)-\d+\/\d+$/.test(base)) {
2474
+ keep(cls, "unknown", "colour opacity modifiers (/NN) are not supported");
2475
+ continue;
2476
+ }
2477
+ const path = [];
2478
+ let bad = null;
2479
+ for (const v of parts) {
2480
+ const cond = VARIANTS[v];
2481
+ if (!cond) {
2482
+ bad = v;
2483
+ break;
2484
+ }
2485
+ path.push(cond);
2486
+ }
2487
+ if (bad !== null) {
2488
+ keep(cls, "unknown", `unknown variant "${bad}:"`);
2489
+ continue;
2490
+ }
2491
+ const hit = utility(base);
2492
+ if (!hit) {
2493
+ keep(cls, "unknown", "no Sobagu mapping");
2494
+ continue;
2495
+ }
2496
+ const node = nodeFor(style, path);
2497
+ let seen = origin.get(node);
2498
+ if (!seen) origin.set(node, seen = /* @__PURE__ */ new Map());
2499
+ const clash = hit.decls.find(([p]) => seen.has(p));
2500
+ if (clash || hit.pending && pending.some((x) => x.node === node && x.kind === hit.pending.kind)) {
2501
+ keep(cls, "conflict", `sets the same prop as "${clash ? seen.get(clash[0]) : pending.find((x) => x.node === node && x.kind === hit.pending.kind).cls}" in the same condition; kept as a class`);
2502
+ continue;
2503
+ }
2504
+ for (const [p, v] of hit.decls) {
2505
+ node[p] = v;
2506
+ seen.set(p, cls);
2507
+ }
2508
+ if (hit.pending) pending.push({
2509
+ cls,
2510
+ ...hit.pending,
2511
+ node
2512
+ });
2513
+ if (hit.approx) note(cls, "approx", hit.approx);
2514
+ for (const v of parts) if (VARIANT_NOTES[v]) note(`${v}:`, v.startsWith("group") || v.startsWith("peer") ? "info" : "approx", VARIANT_NOTES[v]);
2515
+ }
2516
+ for (const p of pending) mergeColor(p, origin.get(p.node), keep, note);
2517
+ splitStyledBorders(style);
2518
+ pruneEmpty(style);
2519
+ return {
2520
+ style,
2521
+ kept,
2522
+ notes
2523
+ };
2524
+ }
2525
+ var WIDTH_KEYS = [
2526
+ "border",
2527
+ "borderTop",
2528
+ "borderRight",
2529
+ "borderBottom",
2530
+ "borderLeft",
2531
+ "borderStart",
2532
+ "borderEnd"
2533
+ ];
2534
+ /** Merge a border / outline / ring colour with the width class in the same condition. */
2535
+ function mergeColor(p, seen, keep, note) {
2536
+ const node = p.node;
2537
+ if (p.kind === "border") {
2538
+ const widths = WIDTH_KEYS.filter((k) => k in node);
2539
+ if (widths.length === 0) {
2540
+ node.borderColor = p.value;
2541
+ return;
2542
+ }
2543
+ if (widths.length > 1) {
2544
+ keep(p.cls, "conflict", "colour for several border sides with widths; set borderColor by hand");
2545
+ return;
2546
+ }
2547
+ const key = widths[0];
2548
+ const w = node[key];
2549
+ if (w === 1 && !("borderStyle" in node)) {
2550
+ node[key] = p.value;
2551
+ return;
2552
+ }
2553
+ if (key === "border" && typeof w === "number") {
2554
+ replaceInOrder(node, "border", {
2555
+ borderWidth: w,
2556
+ borderStyle: node.borderStyle ?? "solid",
2557
+ borderColor: p.value
2558
+ });
2559
+ return;
2560
+ }
2561
+ keep(p.cls, "conflict", `colour together with ${seen.get(key)}; set the border by hand`);
2562
+ return;
2563
+ }
2564
+ const key = p.kind;
2565
+ if (!(key in node)) {
2566
+ node.outlineColor = p.value;
2567
+ if (p.kind === "ring") note(p.cls, "approx", "ring colour without a ring width here: mapped to outlineColor");
2568
+ return;
2569
+ }
2570
+ const w = node[key];
2571
+ const solidWidth = p.kind === "ring" ? 2 : 1;
2572
+ if (w === solidWidth) {
2573
+ node[key] = p.value;
2574
+ return;
2575
+ }
2576
+ keep(p.cls, "conflict", `colour with ${seen.get(key)}: Sobagu's ${key} colour form is ${solidWidth}px; set it by hand`);
2577
+ }
2578
+ /** Replace one key with several, keeping its position in the object. */
2579
+ function replaceInOrder(node, key, add) {
2580
+ const entries = Object.entries(node);
2581
+ for (const k of Object.keys(node)) delete node[k];
2582
+ for (const [k, v] of entries) if (k === key) Object.assign(node, add);
2583
+ else if (!(k in add)) node[k] = v;
2584
+ }
2585
+ /** `border-2 border-dashed`: the width shorthand would fight borderStyle, so use longhands instead. */
2586
+ function splitStyledBorders(node) {
2587
+ if (typeof node.border === "number" && typeof node.borderStyle === "string") replaceInOrder(node, "border", {
2588
+ borderWidth: node.border,
2589
+ borderStyle: node.borderStyle,
2590
+ borderColor: "border"
2591
+ });
2592
+ for (const v of Object.values(node)) if (typeof v === "object") splitStyledBorders(v);
2593
+ }
2594
+ function pruneEmpty(node) {
2595
+ for (const [k, v] of Object.entries(node)) if (typeof v === "object") {
2596
+ pruneEmpty(v);
2597
+ if (Object.keys(v).length === 0) delete node[k];
2598
+ }
2599
+ }
2600
+ // src/print.ts
2601
+ var IDENT = /^[A-Za-z_$][\w$]*$/;
2602
+ function literal(v) {
2603
+ if (typeof v === "object") return objectLiteral(v);
2604
+ return typeof v === "string" ? JSON.stringify(v) : String(v);
2605
+ }
2606
+ /** { p: 6, hover: { bg: "gray.100" } } */
2607
+ function objectLiteral(tree) {
2608
+ const parts = Object.entries(tree).map(([k, v]) => `${IDENT.test(k) ? k : JSON.stringify(k)}: ${literal(v)}`);
2609
+ return parts.length ? `{ ${parts.join(", ")} }` : "{}";
2610
+ }
2611
+ /** One JSX attribute: p={4}, radius="lg", truncate, md={{ p: 6 }}. */
2612
+ function jsxAttr(key, v) {
2613
+ if (v === true) return key;
2614
+ if (typeof v === "string") return /["{}<>]/.test(v) ? `${key}={${JSON.stringify(v)}}` : `${key}="${v}"`;
2615
+ if (typeof v === "object") return `${key}={${objectLiteral(v)}}`;
2616
+ return `${key}={${String(v)}}`;
2617
+ }
2618
+ /** All props of a style tree as JSX attributes, in insertion order. */
2619
+ function jsxAttrs(tree) {
2620
+ return Object.entries(tree).map(([k, v]) => jsxAttr(k, v));
2621
+ }
2622
+ // src/migrate.ts
2623
+ var SOURCE = "@sobagu/react";
2624
+ var SOBAGU_COMPONENTS = [
2625
+ "Box",
2626
+ "Stack",
2627
+ "Grid",
2628
+ "Text"
2629
+ ];
2630
+ var isNode = (v) => typeof v === "object" && v !== null && typeof v.type === "string";
2631
+ function walk(node, visit) {
2632
+ visit(node);
2633
+ for (const key of Object.keys(node)) {
2634
+ if (key === "loc" || key === "extra" || key === "leadingComments" || key === "trailingComments" || key === "innerComments") continue;
2635
+ const v = node[key];
2636
+ if (Array.isArray(v)) for (const c of v) isNode(c) && walk(c, visit);
2637
+ else if (isNode(v)) walk(v, visit);
2638
+ }
2639
+ }
2640
+ /** Attribute names that <Box> would treat as style props (so converting would change behaviour). */
2641
+ function clashesWithStyleProp(name, value) {
2642
+ if (name in propConfig) return true;
2643
+ const boolLike = value === null || value.type === "JSXExpressionContainer" && value.expression.type === "BooleanLiteral";
2644
+ if ((name in shortcuts || markers.includes(name)) && boolLike) return true;
2645
+ if (name in conditions && value?.type === "JSXExpressionContainer" && value.expression.type === "ObjectExpression") return true;
2646
+ return false;
2647
+ }
2648
+ /** The class string of a static className value, or null for dynamic values. */
2649
+ function staticClasses(value) {
2650
+ if (!value) return null;
2651
+ if (value.type === "StringLiteral") return value.value;
2652
+ if (value.type !== "JSXExpressionContainer") return null;
2653
+ const e = value.expression;
2654
+ if (e.type === "StringLiteral") return e.value;
2655
+ if (e.type === "TemplateLiteral" && e.expressions.length === 0) {
2656
+ const q = e.quasis[0];
2657
+ return q ? q.value.cooked ?? null : null;
2658
+ }
2659
+ return null;
2660
+ }
2661
+ function applyEdits(src, edits, offset = 0) {
2662
+ let out = src;
2663
+ for (const e of [...edits].sort((a, b) => b.start - a.start)) out = out.slice(0, e.start - offset) + e.text + out.slice(e.end - offset);
2664
+ return out;
2665
+ }
2666
+ function migrateSource(src, opts = {}) {
2667
+ const filename = opts.filename ?? "file.tsx";
2668
+ const ts = /\.[cm]?tsx?$/.test(filename);
2669
+ let ast;
2670
+ try {
2671
+ ast = parse(src, {
2672
+ sourceType: "module",
2673
+ plugins: ts ? ["typescript", "jsx"] : ["jsx"]
2674
+ });
2675
+ } catch (err) {
2676
+ return {
2677
+ code: src,
2678
+ changed: false,
2679
+ changes: [],
2680
+ skipped: [],
2681
+ error: `parse error: ${err.message}`
2682
+ };
2683
+ }
2684
+ const program = ast.program;
2685
+ const imports = program.body.filter((n) => n.type === "ImportDeclaration");
2686
+ let boxName = null;
2687
+ let target;
2688
+ const sobaguLocals = /* @__PURE__ */ new Set();
2689
+ for (const imp of imports) {
2690
+ if (imp.source.value !== SOURCE || imp.importKind === "type") continue;
2691
+ for (const s of imp.specifiers) {
2692
+ if (s.type !== "ImportSpecifier" || s.importKind === "type") continue;
2693
+ const imported = s.imported.name ?? s.imported.value;
2694
+ const local = s.local.name;
2695
+ if (imported === "Box") boxName = local;
2696
+ if (SOBAGU_COMPONENTS.includes(imported)) sobaguLocals.add(local);
2697
+ }
2698
+ if (imp.specifiers.some((s) => s.type === "ImportSpecifier")) target ??= imp;
2699
+ }
2700
+ const usedNames = /* @__PURE__ */ new Set();
2701
+ walk(ast, (n) => {
2702
+ if (n.type === "Identifier" || n.type === "JSXIdentifier") usedNames.add(n.name);
2703
+ });
2704
+ let alias = null;
2705
+ if (!boxName) {
2706
+ alias = !usedNames.has("Box") ? "Box" : !usedNames.has("SobaguBox") ? "SobaguBox" : null;
2707
+ if (!alias) return {
2708
+ code: src,
2709
+ changed: false,
2710
+ changes: [],
2711
+ skipped: [],
2712
+ error: "both \"Box\" and \"SobaguBox\" are already used in this file"
2713
+ };
2714
+ }
2715
+ const box = boxName ?? alias;
2716
+ const edits = [];
2717
+ const changes = [];
2718
+ const skipped = [];
2719
+ let usesBox = false;
2720
+ walk(ast, (n) => {
2721
+ if (n.type !== "JSXElement") return;
2722
+ const open = n.openingElement;
2723
+ const attrs = open.attributes;
2724
+ const classAttrs = attrs.filter((a) => a.type === "JSXAttribute" && a.name.name === "className");
2725
+ if (classAttrs.length === 0) return;
2726
+ const line = open.loc.start.line;
2727
+ const attr = classAttrs[0];
2728
+ const classes = staticClasses(attr.value);
2729
+ const nameNode = open.name;
2730
+ const tag = nameNode.type === "JSXIdentifier" ? nameNode.name : null;
2731
+ if (classes === null) return void skipped.push({
2732
+ line,
2733
+ reason: "dynamic className (only static strings are converted)"
2734
+ });
2735
+ if (classAttrs.length > 1) return void skipped.push({
2736
+ line,
2737
+ reason: "more than one className attribute",
2738
+ classes
2739
+ });
2740
+ const isSobagu = !!tag && sobaguLocals.has(tag);
2741
+ if (!tag || !/^[a-z]/.test(tag) && !isSobagu) {
2742
+ const shown = tag ?? src.slice(nameNode.start, nameNode.end);
2743
+ skipped.push({
2744
+ line,
2745
+ reason: `<${shown}> is a component, not an HTML element`,
2746
+ classes
2747
+ });
2748
+ return;
2749
+ }
2750
+ const result = convertClasses(classes);
2751
+ if (isSobagu) {
2752
+ const taken = attrs.find((a) => a.type === "JSXAttribute" && a.name.name in result.style);
2753
+ if (taken) {
2754
+ const name = taken.name.name;
2755
+ skipped.push({
2756
+ line,
2757
+ reason: `<${tag}> already has a "${name}" prop that the classes would set`,
2758
+ classes
2759
+ });
2760
+ return;
2761
+ }
2762
+ }
2763
+ const clash = isSobagu ? void 0 : attrs.find((a) => a !== attr && a.type === "JSXAttribute" && a.name.type === "JSXIdentifier" && clashesWithStyleProp(a.name.name, a.value));
2764
+ if (clash) {
2765
+ const name = clash.name.name;
2766
+ skipped.push({
2767
+ line,
2768
+ reason: `<${tag}> has a "${name}" attribute, which <Box> would read as a style prop`,
2769
+ classes
2770
+ });
2771
+ return;
2772
+ }
2773
+ if (Object.keys(result.style).length === 0) {
2774
+ if (result.kept.length) skipped.push({
2775
+ line,
2776
+ reason: "no class could be converted",
2777
+ classes
2778
+ });
2779
+ return;
2780
+ }
2781
+ const notes = [...result.notes];
2782
+ if (attrs.some((a) => a.type === "JSXSpreadAttribute")) notes.push({
2783
+ cls: "{...spread}",
2784
+ kind: "info",
2785
+ message: "spread props: any key named like a Sobagu prop will now be read as styling"
2786
+ });
2787
+ const elementEdits = [];
2788
+ if (!isSobagu) {
2789
+ const asAttr = tag === "div" ? "" : ` as="${tag}"`;
2790
+ elementEdits.push({
2791
+ start: nameNode.start,
2792
+ end: nameNode.end,
2793
+ text: box + asAttr
2794
+ });
2795
+ usesBox = true;
2796
+ }
2797
+ const props = jsxAttrs(result.style);
2798
+ if (result.kept.length) {
2799
+ const q = attr.value.type === "StringLiteral" && src[attr.value.start] === "'" ? "'" : "\"";
2800
+ props.push(`className=${q}${result.kept.join(" ")}${q}`);
2801
+ }
2802
+ elementEdits.push({
2803
+ start: attr.start,
2804
+ end: attr.end,
2805
+ text: props.join(" ")
2806
+ });
2807
+ const close = n.closingElement;
2808
+ if (close && !isSobagu) {
2809
+ const cn = close.name;
2810
+ edits.push({
2811
+ start: cn.start,
2812
+ end: cn.end,
2813
+ text: box
2814
+ });
2815
+ }
2816
+ edits.push(...elementEdits);
2817
+ const before = src.slice(open.start, open.end);
2818
+ changes.push({
2819
+ line,
2820
+ before,
2821
+ after: applyEdits(before, elementEdits, open.start),
2822
+ kept: result.kept,
2823
+ notes
2824
+ });
2825
+ });
2826
+ if (edits.length === 0) return {
2827
+ code: src,
2828
+ changed: false,
2829
+ changes,
2830
+ skipped
2831
+ };
2832
+ if (!boxName && usesBox) edits.push(importEdit(src, program, imports, target, alias));
2833
+ const code = applyEdits(src, edits);
2834
+ return {
2835
+ code,
2836
+ changed: code !== src,
2837
+ changes,
2838
+ skipped
2839
+ };
2840
+ }
2841
+ /** Add Box to an existing @sobagu/react import, or add a new import line after the last import. */
2842
+ function importEdit(src, program, imports, target, alias) {
2843
+ const spec = alias === "Box" ? "Box" : `Box as ${alias}`;
2844
+ if (target) {
2845
+ const named = target.specifiers.filter((s) => s.type === "ImportSpecifier");
2846
+ const last = named[named.length - 1];
2847
+ return {
2848
+ start: last.end,
2849
+ end: last.end,
2850
+ text: `, ${spec}`
2851
+ };
2852
+ }
2853
+ const eol = src.includes("\r\n") ? "\r\n" : "\n";
2854
+ const first = imports[0];
2855
+ const quote = first && src[first.source.start] === "\"" ? "\"" : "'";
2856
+ const line = `import { ${spec} } from ${quote}${SOURCE}${quote}${(first ? src.slice(first.start, first.end).trimEnd().endsWith(";") : false) ? ";" : ""}`;
2857
+ const lastImport = imports[imports.length - 1];
2858
+ if (lastImport) return {
2859
+ start: lastImport.end,
2860
+ end: lastImport.end,
2861
+ text: eol + line
2862
+ };
2863
+ const directives = program.directives;
2864
+ const lastDirective = directives[directives.length - 1];
2865
+ if (lastDirective) return {
2866
+ start: lastDirective.end,
2867
+ end: lastDirective.end,
2868
+ text: eol + line
2869
+ };
2870
+ const interpreter = program.interpreter;
2871
+ if (interpreter) return {
2872
+ start: interpreter.end,
2873
+ end: interpreter.end,
2874
+ text: eol + line
2875
+ };
2876
+ return {
2877
+ start: 0,
2878
+ end: 0,
2879
+ text: line + eol + eol
2880
+ };
2881
+ }
2882
+ // src/tokens.ts
2883
+ var scale = (o) => Object.entries(o).map(([k, v]) => [k, String(v)]);
2884
+ var KINDS = {
2885
+ space: {
2886
+ title: "Space (p, m, gap, inset…; numbers are 4px units)",
2887
+ head: ["token", "value"],
2888
+ rows: () => scale(tokens.space)
2889
+ },
2890
+ sizes: {
2891
+ title: "Sizes (w, minW, maxW, basis; h uses 100dvh for \"screen\")",
2892
+ head: ["token", "value"],
2893
+ rows: () => scale(tokens.sizes)
2894
+ },
2895
+ radii: {
2896
+ title: "Radii (radius)",
2897
+ head: ["token", "value"],
2898
+ rows: () => scale(tokens.radii)
2899
+ },
2900
+ fontSizes: {
2901
+ title: "Font sizes (text)",
2902
+ head: ["token", "value"],
2903
+ rows: () => scale(tokens.fontSizes)
2904
+ },
2905
+ fontWeights: {
2906
+ title: "Font weights (weight)",
2907
+ head: ["token", "value"],
2908
+ rows: () => scale(tokens.fontWeights)
2909
+ },
2910
+ lineHeights: {
2911
+ title: "Line heights (leading)",
2912
+ head: ["token", "value"],
2913
+ rows: () => scale(tokens.lineHeights)
2914
+ },
2915
+ letterSpacings: {
2916
+ title: "Letter spacing (tracking)",
2917
+ head: ["token", "value"],
2918
+ rows: () => scale(tokens.letterSpacings)
2919
+ },
2920
+ fonts: {
2921
+ title: "Fonts (font)",
2922
+ head: ["token", "value"],
2923
+ rows: () => scale(tokens.fonts)
2924
+ },
2925
+ shadows: {
2926
+ title: "Shadows (shadow)",
2927
+ head: ["token", "value"],
2928
+ rows: () => scale(tokens.shadows)
2929
+ },
2930
+ zIndices: {
2931
+ title: "Z-index (z)",
2932
+ head: ["token", "value"],
2933
+ rows: () => scale(tokens.zIndices)
2934
+ },
2935
+ transitions: {
2936
+ title: "Transitions (transition)",
2937
+ head: ["token", "value"],
2938
+ rows: () => scale(tokens.transitions)
2939
+ },
2940
+ animations: {
2941
+ title: "Animations (animate)",
2942
+ head: ["token", "value"],
2943
+ rows: () => scale(animations)
2944
+ },
2945
+ breakpoints: {
2946
+ title: "Breakpoints (sm, md, lg, xl: min-width)",
2947
+ head: ["token", "px"],
2948
+ rows: () => scale(breakpoints)
2949
+ },
2950
+ containers: {
2951
+ title: "Container sizes (cqXs…cqXl: min-width)",
2952
+ head: ["token", "px"],
2953
+ rows: () => scale(containerSizes)
2954
+ },
2955
+ colors: {
2956
+ title: "Semantic colours (bg, color, border…)",
2957
+ head: [
2958
+ "token",
2959
+ "light",
2960
+ "dark"
2961
+ ],
2962
+ rows: () => Object.entries(semanticColors).map(([k, [light, dark]]) => [
2963
+ k,
2964
+ light,
2965
+ dark
2966
+ ])
2967
+ },
2968
+ palette: {
2969
+ title: "Palette (e.g. \"blue.500\")",
2970
+ head: ["colour", ...steps.map(String)],
2971
+ rows: () => Object.keys(hues).map((h) => [h, ...steps.map((s) => paletteColor(h, s).replace(/^oklch\((.*)\)$/, "$1"))])
2972
+ }
2973
+ };
2974
+ var tokenKinds = Object.keys(KINDS);
2975
+ function table(head, rows) {
2976
+ const widths = head.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? "").length)));
2977
+ const line = (cells) => cells.map((c, i) => c.padEnd(widths[i])).join(" ").trimEnd();
2978
+ return [
2979
+ line(head),
2980
+ widths.map((w) => "─".repeat(w)).join(" "),
2981
+ ...rows.map(line)
2982
+ ].join("\n");
2983
+ }
2984
+ /** One token kind as a plain-text table. */
2985
+ function tokenTable(kind) {
2986
+ const k = KINDS[kind];
2987
+ if (!k) throw new Error(`Unknown token kind "${kind}"`);
2988
+ const note = kind === "palette" ? "\n(values are oklch(L C H))" : "";
2989
+ return `${k.title}${note}\n${table(k.head, k.rows())}`;
2990
+ }
2991
+ // src/init.ts
2992
+ var DETECT = [
2993
+ ["angular", "@angular/core"],
2994
+ ["svelte", "svelte"],
2995
+ ["solid", "solid-js"],
2996
+ ["vue", "vue"],
2997
+ ["react", "react"]
2998
+ ];
2999
+ var LABEL = {
3000
+ react: "React",
3001
+ vue: "Vue",
3002
+ svelte: "Svelte",
3003
+ solid: "Solid",
3004
+ angular: "Angular",
3005
+ none: "no framework"
3006
+ };
3007
+ /** Detect the framework from package.json dependencies (Angular/Svelte/Solid win over a React or Vue dep). */
3008
+ function detectFramework(pkg) {
3009
+ if (!pkg) return "none";
3010
+ const deps = {
3011
+ ...pkg.dependencies,
3012
+ ...pkg.devDependencies,
3013
+ ...pkg.peerDependencies
3014
+ };
3015
+ for (const [fw, name] of DETECT) if (name in deps) return fw;
3016
+ return "none";
3017
+ }
3018
+ function installer(lockfiles) {
3019
+ if (lockfiles.includes("pnpm-lock.yaml")) return "pnpm add";
3020
+ if (lockfiles.includes("yarn.lock")) return "yarn add";
3021
+ if (lockfiles.includes("bun.lockb") || lockfiles.includes("bun.lock")) return "bun add";
3022
+ return "npm i";
3023
+ }
3024
+ var CONFIG = `// Sobagu config: your own props, conditions and shortcuts.
3025
+ // Import this file once at app start (for example in main.tsx), before the first render.
3026
+ import { definePlugin, use } from '@sobagu/core'
3027
+
3028
+ const app = definePlugin({
3029
+ name: 'app',
3030
+ shortcuts: {
3031
+ // pill: { radius: 'full', px: 'md' },
3032
+ },
3033
+ conditions: {
3034
+ // hocus: { kind: 'selector', template: '&:is(:hover, :focus-visible)', rank: 25 },
3035
+ },
3036
+ })
3037
+
3038
+ use(app)
3039
+
3040
+ export default app
3041
+ `;
3042
+ function initPlan(pkg, lockfiles = []) {
3043
+ const framework = detectFramework(pkg);
3044
+ const add = installer(lockfiles);
3045
+ const adapter = framework === "react" ? "@sobagu/react" : framework === "vue" ? "@sobagu/vue" : null;
3046
+ const command = `${add} @sobagu/core${adapter ? ` ${adapter}` : ""}`;
3047
+ const lines = [
3048
+ pkg ? `Detected: ${LABEL[framework]}` : "No package.json found here.",
3049
+ "",
3050
+ "Install:",
3051
+ ` ${command}`
3052
+ ];
3053
+ if (framework === "react") lines.push("", "Then: import { Box } from '@sobagu/react'");
3054
+ else if (framework === "vue") lines.push("", "Then: app.use(Sobagu) with import { Sobagu } from '@sobagu/vue'");
3055
+ else lines.push("", `No ${framework === "none" ? "" : LABEL[framework] + " "}adapter yet: use css() from '@sobagu/core' on any element.`);
3056
+ return {
3057
+ framework,
3058
+ command,
3059
+ lines,
3060
+ config: CONFIG
3061
+ };
3062
+ }
3063
+ // src/audit.ts
3064
+ /** sobagu audit [--brand <hex|hue>]: WCAG contrast of the semantic colours (and a brand theme). */
3065
+ function auditCmd(args, io) {
3066
+ const { values } = parseArgs({
3067
+ args,
3068
+ options: { brand: { type: "string" } },
3069
+ allowPositionals: false
3070
+ });
3071
+ const checks = auditContrast();
3072
+ const w = Math.max(...checks.map((c) => c.pair.length));
3073
+ io.out(`${"pair".padEnd(w)} need light dark result`);
3074
+ for (const c of checks) io.out(`${c.pair.padEnd(w)} ${String(c.required).padEnd(5)} ${c.light.toFixed(2).padStart(5)} ${c.dark.toFixed(2).padStart(5)} ${c.pass ? "pass" : "FAIL"}`);
3075
+ let failed = checks.filter((c) => !c.pass).length;
3076
+ if (values.brand) {
3077
+ const theme = createTheme({ brand: /^\d+(\.\d+)?$/.test(values.brand) ? Number(values.brand) : values.brand });
3078
+ io.out("");
3079
+ io.out(`brand ${values.brand}: primary on white ${theme.contrast.primaryOnSurface}:1, text on primary ${theme.contrast.onPrimaryLight}:1 (light) / ${theme.contrast.onPrimaryDark}:1 (dark)`);
3080
+ for (const warning of theme.warnings) io.out(` ! ${warning}`);
3081
+ failed += theme.warnings.length;
3082
+ }
3083
+ io.out("");
3084
+ io.out(failed ? `${failed} problem(s) below WCAG AA` : "All colours pass WCAG AA");
3085
+ return failed ? 1 : 0;
3086
+ }
3087
+ // src/cli.ts
3088
+ var defaultIO = {
3089
+ out: (l) => process.stdout.write(l + "\n"),
3090
+ err: (l) => process.stderr.write(l + "\n"),
3091
+ cwd: process.cwd()
3092
+ };
3093
+ var HELP = `sobagu — the Sobagu command line
3094
+
3095
+ Usage:
3096
+ sobagu migrate <file|glob…> [--write] [--report] utility classes in className → <Box> props
3097
+ sobagu init [--write] install command for your framework (+ config stub)
3098
+ sobagu tokens [kind] [--json [--out <file>]] print design tokens (table, or W3C/DTCG JSON for design tools)
3099
+ sobagu audit [--brand <hex>] WCAG contrast check of the colours (exit 1 on failure)
3100
+ sobagu --help | --version
3101
+
3102
+ migrate is a dry run unless --write is given. --report lists unknown classes, approximations and
3103
+ skipped elements for all files.`;
3104
+ async function main(argv, io = defaultIO) {
3105
+ const [cmd, ...rest] = argv;
3106
+ try {
3107
+ switch (cmd) {
3108
+ case "migrate": return migrateCmd(rest, io);
3109
+ case "init": return initCmd(rest, io);
3110
+ case "tokens": return tokensCmd(rest, io);
3111
+ case "audit": return auditCmd(rest, io);
3112
+ case "--version":
3113
+ case "-v":
3114
+ io.out(readVersion());
3115
+ return 0;
3116
+ case void 0:
3117
+ case "--help":
3118
+ case "-h":
3119
+ case "help":
3120
+ io.out(HELP);
3121
+ return 0;
3122
+ default:
3123
+ io.err(`Unknown command "${cmd}".\n\n${HELP}`);
3124
+ return 1;
3125
+ }
3126
+ } catch (e) {
3127
+ io.err(`sobagu: ${e.message}`);
3128
+ return 1;
3129
+ }
3130
+ }
3131
+ function readVersion() {
3132
+ return JSON.parse(readFileSync(new URL("data:application/json;base64,ewogICJuYW1lIjogIkBzb2JhZ3UvY2xpIiwKICAidmVyc2lvbiI6ICIwLjEuMCIsCiAgImRlc2NyaXB0aW9uIjogIlNvYmFndSBDU1MgY29tbWFuZCBsaW5lOiBtaWdyYXRlIHV0aWxpdHkgY2xhc3NlcyB0byBzdHlsZSBwcm9wcywgaW5pdCwgdG9rZW5zIiwKICAia2V5d29yZHMiOiBbCiAgICAiY2xpIiwKICAgICJjb2RlbW9kIiwKICAgICJtaWdyYXRlIiwKICAgICJkZXNpZ24tdG9rZW5zIiwKICAgICJjc3MiLAogICAgInN0eWxpbmciCiAgXSwKICAibGljZW5zZSI6ICJNSVQiLAogICJhdXRob3IiOiAiU29iYWd1IGNvbnRyaWJ1dG9ycyIsCiAgImhvbWVwYWdlIjogImh0dHBzOi8vc29iYWd1Y3NzLmNvbSIsCiAgInR5cGUiOiAibW9kdWxlIiwKICAiZXhwb3J0cyI6IHsKICAgICIuL3BhY2thZ2UuanNvbiI6ICIuL3BhY2thZ2UuanNvbiIKICB9LAogICJiaW4iOiB7CiAgICAic29iYWd1IjogIi4vYmluL3NvYmFndS5qcyIKICB9LAogICJmaWxlcyI6IFsKICAgICJiaW4iLAogICAgImRpc3QiLAogICAgIkxJQ0VOU0UiLAogICAgIlJFQURNRS5tZCIKICBdLAogICJlbmdpbmVzIjogewogICAgIm5vZGUiOiAiXjIyLjE4LjAgfHwgPj0yNC4xMS4wIgogIH0sCiAgInNjcmlwdHMiOiB7CiAgICAiYnVpbGQiOiAidml0ZSBidWlsZCIsCiAgICAicHJlcGFjayI6ICJub2RlIC4uLy4uL3NjcmlwdHMvcGFjay1tYW5pZmVzdC5tanMgc3RyaXAiLAogICAgInBvc3RwYWNrIjogIm5vZGUgLi4vLi4vc2NyaXB0cy9wYWNrLW1hbmlmZXN0Lm1qcyByZXN0b3JlIgogIH0sCiAgImRlcGVuZGVuY2llcyI6IHsKICAgICJAYmFiZWwvcGFyc2VyIjogIl44LjEuMiIsCiAgICAiQHNvYmFndS9jb3JlIjogIjAuMS4wIgogIH0sCiAgInB1Ymxpc2hDb25maWciOiB7CiAgICAiYWNjZXNzIjogInB1YmxpYyIsCiAgICAicHJvdmVuYW5jZSI6IHRydWUKICB9LAogICJzb2JhZ3VPd25CdWlsZCI6IHRydWUKfQo=", "" + import.meta.url), "utf8")).version;
3133
+ }
3134
+ var EXT = /\.(jsx|tsx|js|mjs|cjs|mts|cts)$/;
3135
+ /** Expand the arguments: existing files as-is, directories → their JSX/TSX files, anything else as a glob. */
3136
+ function expandFiles(patterns, cwd) {
3137
+ const out = /* @__PURE__ */ new Set();
3138
+ const ignore = (p) => /(^|[\\/])(node_modules|dist|\.git)([\\/]|$)/.test(p);
3139
+ for (const p of patterns) {
3140
+ const abs = resolve(cwd, p);
3141
+ if (existsSync(abs) && statSync(abs).isFile()) {
3142
+ out.add(abs);
3143
+ continue;
3144
+ }
3145
+ const pattern = existsSync(abs) && statSync(abs).isDirectory() ? `${p.replace(/[\\/]+$/, "")}/**/*.{jsx,tsx,js}` : p;
3146
+ for (const f of globSync(pattern.replace(/\\/g, "/"), { cwd })) {
3147
+ const full = resolve(cwd, f);
3148
+ if (!ignore(relative(cwd, full)) && EXT.test(full) && statSync(full).isFile()) out.add(full);
3149
+ }
3150
+ }
3151
+ return [...out].sort();
3152
+ }
3153
+ function migrateCmd(args, io) {
3154
+ const { values, positionals } = parseArgs({
3155
+ args,
3156
+ allowPositionals: true,
3157
+ options: {
3158
+ write: {
3159
+ type: "boolean",
3160
+ default: false
3161
+ },
3162
+ report: {
3163
+ type: "boolean",
3164
+ default: false
3165
+ },
3166
+ help: {
3167
+ type: "boolean",
3168
+ short: "h"
3169
+ }
3170
+ }
3171
+ });
3172
+ if (values.help || positionals.length === 0) {
3173
+ io.out("Usage: sobagu migrate <file|glob…> [--write] [--report]");
3174
+ return positionals.length === 0 && !values.help ? 1 : 0;
3175
+ }
3176
+ const files = expandFiles(positionals, io.cwd);
3177
+ if (files.length === 0) {
3178
+ io.err(`No files matched: ${positionals.join(" ")}`);
3179
+ return 1;
3180
+ }
3181
+ let failed = 0;
3182
+ let converted = 0;
3183
+ let changedFiles = 0;
3184
+ const all = [];
3185
+ for (const file of files) {
3186
+ const rel = relative(io.cwd, file).replace(/\\/g, "/");
3187
+ const result = migrateSource(readFileSync(file, "utf8"), { filename: file });
3188
+ all.push({
3189
+ file: rel,
3190
+ result
3191
+ });
3192
+ if (result.error) {
3193
+ failed++;
3194
+ io.err(`${rel}: skipped — ${result.error}`);
3195
+ continue;
3196
+ }
3197
+ if (!result.changes.length && !result.skipped.length) continue;
3198
+ converted += result.changes.length;
3199
+ if (result.changed) changedFiles++;
3200
+ io.out(`\n${rel} (${result.changes.length} element${result.changes.length === 1 ? "" : "s"}${values.write ? "" : ", dry run"})`);
3201
+ const rows = [...result.changes.map((c) => ({
3202
+ line: c.line,
3203
+ text: [
3204
+ `${String(c.line).padStart(5)} - ${oneLine(c.before)}`,
3205
+ `${" ".repeat(5)} + ${oneLine(c.after)}`,
3206
+ ...c.kept.length ? [`${" ".repeat(7)}kept in className: ${c.kept.join(" ")}`] : []
3207
+ ]
3208
+ })), ...result.skipped.map((s) => ({
3209
+ line: s.line,
3210
+ text: [`${String(s.line).padStart(5)} ! skipped: ${s.reason}`]
3211
+ }))];
3212
+ for (const r of rows.sort((a, b) => a.line - b.line)) for (const t of r.text) io.out(t);
3213
+ if (values.write && result.changed) writeFileSync(file, result.code);
3214
+ }
3215
+ const kept = all.reduce((n, { result }) => n + result.changes.reduce((k, c) => k + c.kept.length, 0), 0);
3216
+ const approx = all.reduce((n, { result }) => n + result.changes.reduce((k, c) => k + c.notes.filter((x) => x.kind === "approx").length, 0), 0);
3217
+ io.out(`\n${files.length} file${files.length === 1 ? "" : "s"} scanned, ${converted} element${converted === 1 ? "" : "s"} converted in ${changedFiles} file${changedFiles === 1 ? "" : "s"}, ${kept} class${kept === 1 ? "" : "es"} kept, ${approx} approximation${approx === 1 ? "" : "s"}.`);
3218
+ if (values.report) printReport(all, io);
3219
+ else if (kept || approx) io.out("Run with --report for the list of kept classes and approximations.");
3220
+ if (!values.write && changedFiles) io.out("Dry run: nothing was written. Re-run with --write to save the changes.");
3221
+ return failed ? 1 : 0;
3222
+ }
3223
+ var oneLine = (s) => s.replace(/\s*\r?\n\s*/g, " ").replace(/ (\/?>)$/, "$1");
3224
+ function printReport(all, io) {
3225
+ const groups = {
3226
+ unknown: /* @__PURE__ */ new Map(),
3227
+ conflict: /* @__PURE__ */ new Map(),
3228
+ approx: /* @__PURE__ */ new Map(),
3229
+ info: /* @__PURE__ */ new Map()
3230
+ };
3231
+ for (const { file, result } of all) for (const c of result.changes) for (const n of c.notes) {
3232
+ const key = `${n.cls}|${n.message}`;
3233
+ const g = groups[n.kind].get(key) ?? {
3234
+ message: n.message,
3235
+ where: []
3236
+ };
3237
+ g.where.push(`${file}:${c.line}`);
3238
+ groups[n.kind].set(key, g);
3239
+ }
3240
+ const titles = {
3241
+ unknown: "Kept (no Sobagu mapping)",
3242
+ conflict: "Kept (conflicting)",
3243
+ approx: "Approximations (check visually)",
3244
+ info: "Notes"
3245
+ };
3246
+ io.out("\nReport");
3247
+ for (const kind of [
3248
+ "unknown",
3249
+ "conflict",
3250
+ "approx",
3251
+ "info"
3252
+ ]) {
3253
+ const g = groups[kind];
3254
+ if (!g.size) continue;
3255
+ io.out(`\n ${titles[kind]}:`);
3256
+ for (const [key, v] of g) {
3257
+ const cls = key.slice(0, key.indexOf("|"));
3258
+ io.out(` ${cls.padEnd(24)} ${v.message} (${v.where.length}×: ${v.where.slice(0, 3).join(", ")}${v.where.length > 3 ? ", …" : ""})`);
3259
+ }
3260
+ }
3261
+ const skipped = all.flatMap(({ file, result }) => [...result.error ? [`${file}: ${result.error}`] : [], ...result.skipped.map((s) => `${file}:${s.line} ${s.reason}${s.classes ? ` — "${s.classes}"` : ""}`)]);
3262
+ if (skipped.length) {
3263
+ io.out("\n Skipped elements (left unchanged):");
3264
+ for (const s of skipped) io.out(` ${s}`);
3265
+ }
3266
+ }
3267
+ function initCmd(args, io) {
3268
+ const { values } = parseArgs({
3269
+ args,
3270
+ options: {
3271
+ write: {
3272
+ type: "boolean",
3273
+ default: false
3274
+ },
3275
+ cwd: { type: "string" }
3276
+ }
3277
+ });
3278
+ const cwd = values.cwd ? resolve(io.cwd, values.cwd) : io.cwd;
3279
+ const pkgPath = join(cwd, "package.json");
3280
+ const plan = initPlan(existsSync(pkgPath) ? JSON.parse(readFileSync(pkgPath, "utf8")) : null, [
3281
+ "pnpm-lock.yaml",
3282
+ "yarn.lock",
3283
+ "bun.lockb",
3284
+ "bun.lock"
3285
+ ].filter((f) => existsSync(join(cwd, f))));
3286
+ for (const line of plan.lines) io.out(line);
3287
+ const configPath = join(cwd, "sobagu.config.ts");
3288
+ if (!values.write) {
3289
+ io.out(`\nNothing written. Run "sobagu init --write" to create sobagu.config.ts.`);
3290
+ return 0;
3291
+ }
3292
+ if (existsSync(configPath)) {
3293
+ io.out("\nsobagu.config.ts already exists; left unchanged.");
3294
+ return 0;
3295
+ }
3296
+ writeFileSync(configPath, plan.config);
3297
+ io.out("\nCreated sobagu.config.ts");
3298
+ return 0;
3299
+ }
3300
+ function tokensCmd(args, io) {
3301
+ const { positionals, values } = parseArgs({
3302
+ args,
3303
+ allowPositionals: true,
3304
+ options: {
3305
+ json: { type: "boolean" },
3306
+ out: { type: "string" }
3307
+ }
3308
+ });
3309
+ if (values.json) {
3310
+ const json = JSON.stringify(toDesignTokens(), null, 2);
3311
+ if (values.out) {
3312
+ writeFileSync(resolve(io.cwd, values.out), json + "\n");
3313
+ io.out(`wrote ${values.out} (W3C design tokens; import it with a design-token plugin)`);
3314
+ } else io.out(json);
3315
+ return 0;
3316
+ }
3317
+ const kind = positionals[0];
3318
+ if (kind && !tokenKinds.includes(kind)) {
3319
+ io.err(`Unknown token kind "${kind}". Kinds: ${tokenKinds.join(", ")}`);
3320
+ return 1;
3321
+ }
3322
+ const kinds = kind ? [kind] : tokenKinds;
3323
+ io.out(kinds.map((k) => tokenTable(k)).join("\n\n"));
3324
+ return 0;
3325
+ }
3326
+ export { expandFiles, main };
3327
+
3328
+ //# sourceMappingURL=cli.js.map