@kbach/react 0.1.6 → 0.2.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.
@@ -37,15 +37,1941 @@ module.exports = __toCommonJS(jsx_dev_runtime_exports);
37
37
 
38
38
  // src/jsx-runtime.tsx
39
39
  var import_jsx_runtime = require("react/jsx-runtime");
40
- var import_core4 = require("@kbach/core");
40
+
41
+ // src/core/theme.ts
42
+ var defaultColors = {
43
+ transparent: "transparent",
44
+ current: "currentColor",
45
+ black: "#000000",
46
+ white: "#ffffff",
47
+ slate: {
48
+ 1: "#f8f9fc",
49
+ 2: "#edf0f8",
50
+ 3: "#dde3f2",
51
+ 4: "#c5cee8",
52
+ 5: "#9badd3",
53
+ 6: "#6c87b6",
54
+ 7: "#526b98",
55
+ 8: "#3e5479",
56
+ 9: "#2d3f5e",
57
+ 10: "#1d2b42",
58
+ 11: "#0f1828"
59
+ },
60
+ gray: {
61
+ 1: "#f9f9f9",
62
+ 2: "#f3f3f3",
63
+ 3: "#e6e6e7",
64
+ 4: "#d2d2d4",
65
+ 5: "#aaaaad",
66
+ 6: "#757578",
67
+ 7: "#585860",
68
+ 8: "#434349",
69
+ 9: "#2c2c32",
70
+ 10: "#1c1c21",
71
+ 11: "#0c0c0f"
72
+ },
73
+ zinc: {
74
+ 1: "#fafafa",
75
+ 2: "#f4f4f5",
76
+ 3: "#e8e8ea",
77
+ 4: "#d3d4d7",
78
+ 5: "#a9aaae",
79
+ 6: "#74757c",
80
+ 7: "#57585f",
81
+ 8: "#42434b",
82
+ 9: "#2a2b31",
83
+ 10: "#1a1b20",
84
+ 11: "#0b0b0e"
85
+ },
86
+ neutral: {
87
+ 1: "#fafafa",
88
+ 2: "#f5f5f5",
89
+ 3: "#e9e9e9",
90
+ 4: "#d5d5d5",
91
+ 5: "#ababab",
92
+ 6: "#777777",
93
+ 7: "#5a5a5a",
94
+ 8: "#444444",
95
+ 9: "#2d2d2d",
96
+ 10: "#1d1d1d",
97
+ 11: "#0d0d0d"
98
+ },
99
+ stone: {
100
+ 1: "#fafaf8",
101
+ 2: "#f5f4f1",
102
+ 3: "#e9e6e0",
103
+ 4: "#d6d0c8",
104
+ 5: "#b3ab9c",
105
+ 6: "#7e7568",
106
+ 7: "#605850",
107
+ 8: "#4a4440",
108
+ 9: "#302c28",
109
+ 10: "#201d1a",
110
+ 11: "#100f0c"
111
+ },
112
+ red: {
113
+ 1: "#fff4f3",
114
+ 2: "#ffe8e6",
115
+ 3: "#ffd1ce",
116
+ 4: "#ffaba5",
117
+ 5: "#ff7b73",
118
+ 6: "#f44642",
119
+ 7: "#d6302c",
120
+ 8: "#be2020",
121
+ 9: "#961515",
122
+ 10: "#6e0f0f",
123
+ 11: "#3e0606"
124
+ },
125
+ orange: {
126
+ 1: "#fff8ec",
127
+ 2: "#ffedce",
128
+ 3: "#ffdda0",
129
+ 4: "#ffc06a",
130
+ 5: "#ff9c32",
131
+ 6: "#f47c0c",
132
+ 7: "#cc6205",
133
+ 8: "#a34b04",
134
+ 9: "#7d3806",
135
+ 10: "#5b2807",
136
+ 11: "#311502"
137
+ },
138
+ amber: {
139
+ 1: "#fffbea",
140
+ 2: "#fff5c7",
141
+ 3: "#ffeb85",
142
+ 4: "#ffd944",
143
+ 5: "#f8c00e",
144
+ 6: "#e4a500",
145
+ 7: "#bd8300",
146
+ 8: "#956600",
147
+ 9: "#704c00",
148
+ 10: "#513600",
149
+ 11: "#2d1e00"
150
+ },
151
+ yellow: {
152
+ 1: "#ffffe8",
153
+ 2: "#ffffc8",
154
+ 3: "#fffb82",
155
+ 4: "#fff342",
156
+ 5: "#f5da0e",
157
+ 6: "#e1bd00",
158
+ 7: "#bb9a00",
159
+ 8: "#947800",
160
+ 9: "#6f5900",
161
+ 10: "#514200",
162
+ 11: "#2d2500"
163
+ },
164
+ lime: {
165
+ 1: "#f5ffe8",
166
+ 2: "#eaffca",
167
+ 3: "#d5ff90",
168
+ 4: "#b8f658",
169
+ 5: "#97e422",
170
+ 6: "#74c90b",
171
+ 7: "#5aa407",
172
+ 8: "#457e08",
173
+ 9: "#346008",
174
+ 10: "#254408",
175
+ 11: "#132505"
176
+ },
177
+ green: {
178
+ 1: "#f0fdf5",
179
+ 2: "#dcfce9",
180
+ 3: "#b8f4d2",
181
+ 4: "#84e8b1",
182
+ 5: "#47d38d",
183
+ 6: "#1cb86d",
184
+ 7: "#129a57",
185
+ 8: "#0e7b45",
186
+ 9: "#0d6035",
187
+ 10: "#0b4f2d",
188
+ 11: "#042a18"
189
+ },
190
+ emerald: {
191
+ 1: "#ecfdf7",
192
+ 2: "#d0fcea",
193
+ 3: "#a5f4d6",
194
+ 4: "#6aeabc",
195
+ 5: "#35d49f",
196
+ 6: "#10b982",
197
+ 7: "#099768",
198
+ 8: "#087a53",
199
+ 9: "#0a5f43",
200
+ 10: "#094e37",
201
+ 11: "#032b1f"
202
+ },
203
+ teal: {
204
+ 1: "#efffff",
205
+ 2: "#ccfcf8",
206
+ 3: "#99f7f1",
207
+ 4: "#60eee6",
208
+ 5: "#2cdad3",
209
+ 6: "#13bebc",
210
+ 7: "#0d9997",
211
+ 8: "#0d7a78",
212
+ 9: "#0e6160",
213
+ 10: "#0d4f4e",
214
+ 11: "#063535"
215
+ },
216
+ cyan: {
217
+ 1: "#ecfeff",
218
+ 2: "#cffcfe",
219
+ 3: "#a3f6fc",
220
+ 4: "#67ebfa",
221
+ 5: "#23d7f5",
222
+ 6: "#07bde0",
223
+ 7: "#0898b8",
224
+ 8: "#0c7896",
225
+ 9: "#135f78",
226
+ 10: "#134e65",
227
+ 11: "#053143"
228
+ },
229
+ sky: {
230
+ 1: "#f0f8ff",
231
+ 2: "#e0f2fe",
232
+ 3: "#bde3fd",
233
+ 4: "#89cffa",
234
+ 5: "#48b4f8",
235
+ 6: "#149aeb",
236
+ 7: "#057ec8",
237
+ 8: "#0664a4",
238
+ 9: "#0a5087",
239
+ 10: "#0d4270",
240
+ 11: "#082748"
241
+ },
242
+ blue: {
243
+ 1: "#eff5ff",
244
+ 2: "#dde9fe",
245
+ 3: "#bdd2fd",
246
+ 4: "#8db1fb",
247
+ 5: "#5a89f7",
248
+ 6: "#2f64f3",
249
+ 7: "#1b4de6",
250
+ 8: "#1740cc",
251
+ 9: "#142da8",
252
+ 10: "#102080",
253
+ 11: "#0b144f"
254
+ },
255
+ indigo: {
256
+ 1: "#eff1ff",
257
+ 2: "#e2e7ff",
258
+ 3: "#c9d1ff",
259
+ 4: "#a9b4ff",
260
+ 5: "#8590fe",
261
+ 6: "#6267f3",
262
+ 7: "#4f51e7",
263
+ 8: "#4240d0",
264
+ 9: "#3434ae",
265
+ 10: "#292888",
266
+ 11: "#181854"
267
+ },
268
+ violet: {
269
+ 1: "#f5f3ff",
270
+ 2: "#ede9ff",
271
+ 3: "#ddd5fe",
272
+ 4: "#c6b8fd",
273
+ 5: "#a893fa",
274
+ 6: "#8a69f7",
275
+ 7: "#7248ec",
276
+ 8: "#6137d6",
277
+ 9: "#4f28ae",
278
+ 10: "#3f218e",
279
+ 11: "#250f58"
280
+ },
281
+ purple: {
282
+ 1: "#fbf3ff",
283
+ 2: "#f4e8ff",
284
+ 3: "#e9cfff",
285
+ 4: "#d8adfd",
286
+ 5: "#bf7cfa",
287
+ 6: "#a650f5",
288
+ 7: "#8f30e7",
289
+ 8: "#7c1fce",
290
+ 9: "#671caa",
291
+ 10: "#521885",
292
+ 11: "#300860"
293
+ },
294
+ fuchsia: {
295
+ 1: "#fef3ff",
296
+ 2: "#fbe8ff",
297
+ 3: "#f6cfff",
298
+ 4: "#efaaff",
299
+ 5: "#e672fb",
300
+ 6: "#d748ef",
301
+ 7: "#be20d3",
302
+ 8: "#a41ab5",
303
+ 9: "#86168e",
304
+ 10: "#631470",
305
+ 11: "#42024a"
306
+ },
307
+ pink: {
308
+ 1: "#fef2f8",
309
+ 2: "#fde7f3",
310
+ 3: "#fbcde7",
311
+ 4: "#f8a8d1",
312
+ 5: "#f36cb8",
313
+ 6: "#ea3f98",
314
+ 7: "#d4217c",
315
+ 8: "#be1965",
316
+ 9: "#9c1651",
317
+ 10: "#74143e",
318
+ 11: "#450827"
319
+ },
320
+ rose: {
321
+ 1: "#fff2f3",
322
+ 2: "#ffe5e8",
323
+ 3: "#ffcacd",
324
+ 4: "#ff9fa7",
325
+ 5: "#fd6b77",
326
+ 6: "#f43e52",
327
+ 7: "#e01e31",
328
+ 8: "#c0152c",
329
+ 9: "#9a1222",
330
+ 10: "#701019",
331
+ 11: "#420611"
332
+ }
333
+ };
334
+ var defaultTheme = {
335
+ colors: defaultColors,
336
+ // 1 unit = 4px
337
+ spacing: {
338
+ px: 1,
339
+ 0: 0,
340
+ "0.5": 2,
341
+ 1: 4,
342
+ "1.5": 6,
343
+ 2: 8,
344
+ "2.5": 10,
345
+ 3: 12,
346
+ "3.5": 14,
347
+ 4: 16,
348
+ 5: 20,
349
+ 6: 24,
350
+ 7: 28,
351
+ 8: 32,
352
+ 9: 36,
353
+ 10: 40,
354
+ 11: 44,
355
+ 12: 48,
356
+ 14: 56,
357
+ 16: 64,
358
+ 20: 80,
359
+ 24: 96,
360
+ 28: 112,
361
+ 32: 128,
362
+ 36: 144,
363
+ 40: 160,
364
+ 44: 176,
365
+ 48: 192,
366
+ 52: 208,
367
+ 56: 224,
368
+ 60: 240,
369
+ 64: 256,
370
+ 72: 288,
371
+ 80: 320,
372
+ 96: 384,
373
+ auto: "auto",
374
+ full: "100%",
375
+ "1/2": "50%",
376
+ "1/3": "33.333333%",
377
+ "2/3": "66.666667%",
378
+ "1/4": "25%",
379
+ "3/4": "75%",
380
+ screen: "100vh",
381
+ min: "min-content",
382
+ max: "max-content",
383
+ fit: "fit-content"
384
+ },
385
+ fontSize: {
386
+ xs: 12,
387
+ sm: 14,
388
+ base: 16,
389
+ lg: 18,
390
+ xl: 20,
391
+ "2xl": 24,
392
+ "3xl": 30,
393
+ "4xl": 36,
394
+ "5xl": 48,
395
+ "6xl": 60,
396
+ "7xl": 72,
397
+ "8xl": 96,
398
+ "9xl": 128
399
+ },
400
+ fontFamily: {
401
+ sans: "System",
402
+ mono: "Courier New",
403
+ serif: "Georgia"
404
+ },
405
+ fontWeight: {
406
+ thin: "100",
407
+ extralight: "200",
408
+ light: "300",
409
+ normal: "400",
410
+ medium: "500",
411
+ semibold: "600",
412
+ bold: "700",
413
+ extrabold: "800",
414
+ black: "900"
415
+ },
416
+ borderRadius: {
417
+ none: 0,
418
+ sm: 2,
419
+ DEFAULT: 4,
420
+ md: 6,
421
+ lg: 8,
422
+ xl: 12,
423
+ "2xl": 16,
424
+ "3xl": 24,
425
+ full: 9999
426
+ },
427
+ borderWidth: {
428
+ DEFAULT: 1,
429
+ 0: 0,
430
+ 2: 2,
431
+ 4: 4,
432
+ 8: 8
433
+ },
434
+ opacity: {
435
+ 0: 0,
436
+ 5: 0.05,
437
+ 10: 0.1,
438
+ 15: 0.15,
439
+ 20: 0.2,
440
+ 25: 0.25,
441
+ 30: 0.3,
442
+ 40: 0.4,
443
+ 50: 0.5,
444
+ 60: 0.6,
445
+ 70: 0.7,
446
+ 75: 0.75,
447
+ 80: 0.8,
448
+ 90: 0.9,
449
+ 95: 0.95,
450
+ 100: 1
451
+ },
452
+ lineHeight: {
453
+ none: 1,
454
+ tight: 1.25,
455
+ snug: 1.375,
456
+ normal: 1.5,
457
+ relaxed: 1.625,
458
+ loose: 2,
459
+ 3: 12,
460
+ 4: 16,
461
+ 5: 20,
462
+ 6: 24,
463
+ 7: 28,
464
+ 8: 32,
465
+ 9: 36,
466
+ 10: 40
467
+ },
468
+ letterSpacing: {
469
+ tighter: -0.8,
470
+ tight: -0.4,
471
+ normal: 0,
472
+ wide: 0.4,
473
+ wider: 0.8,
474
+ widest: 1.6
475
+ },
476
+ zIndex: {
477
+ auto: "auto",
478
+ 0: 0,
479
+ 10: 10,
480
+ 20: 20,
481
+ 30: 30,
482
+ 40: 40,
483
+ 50: 50
484
+ },
485
+ flex: {
486
+ 1: 1,
487
+ auto: 1,
488
+ initial: 0,
489
+ none: 0
490
+ },
491
+ shadow: {
492
+ sm: {
493
+ shadowColor: "#000",
494
+ shadowOffset: { width: 0, height: 1 },
495
+ shadowOpacity: 0.05,
496
+ shadowRadius: 2,
497
+ elevation: 1
498
+ },
499
+ DEFAULT: {
500
+ shadowColor: "#000",
501
+ shadowOffset: { width: 0, height: 2 },
502
+ shadowOpacity: 0.1,
503
+ shadowRadius: 4,
504
+ elevation: 2
505
+ },
506
+ md: {
507
+ shadowColor: "#000",
508
+ shadowOffset: { width: 0, height: 4 },
509
+ shadowOpacity: 0.1,
510
+ shadowRadius: 8,
511
+ elevation: 3
512
+ },
513
+ lg: {
514
+ shadowColor: "#000",
515
+ shadowOffset: { width: 0, height: 8 },
516
+ shadowOpacity: 0.1,
517
+ shadowRadius: 15,
518
+ elevation: 4
519
+ },
520
+ xl: {
521
+ shadowColor: "#000",
522
+ shadowOffset: { width: 0, height: 16 },
523
+ shadowOpacity: 0.1,
524
+ shadowRadius: 24,
525
+ elevation: 6
526
+ },
527
+ "2xl": {
528
+ shadowColor: "#000",
529
+ shadowOffset: { width: 0, height: 24 },
530
+ shadowOpacity: 0.25,
531
+ shadowRadius: 48,
532
+ elevation: 8
533
+ },
534
+ none: {
535
+ shadowColor: "transparent",
536
+ shadowOffset: { width: 0, height: 0 },
537
+ shadowOpacity: 0,
538
+ shadowRadius: 0,
539
+ elevation: 0
540
+ }
541
+ },
542
+ screens: {
543
+ sm: 640,
544
+ md: 768,
545
+ lg: 1024,
546
+ xl: 1280,
547
+ "2xl": 1536
548
+ }
549
+ };
550
+
551
+ // src/core/cache.ts
552
+ var LRUCache = class {
553
+ constructor(capacity = 1e4) {
554
+ this.capacity = capacity;
555
+ this.cache = /* @__PURE__ */ new Map();
556
+ }
557
+ get(key) {
558
+ if (!this.cache.has(key)) return void 0;
559
+ const value = this.cache.get(key);
560
+ this.cache.delete(key);
561
+ this.cache.set(key, value);
562
+ return value;
563
+ }
564
+ set(key, value) {
565
+ if (this.cache.has(key)) {
566
+ this.cache.delete(key);
567
+ } else if (this.cache.size >= this.capacity) {
568
+ this.cache.delete(this.cache.keys().next().value);
569
+ }
570
+ this.cache.set(key, value);
571
+ return this;
572
+ }
573
+ has(key) {
574
+ return this.cache.has(key);
575
+ }
576
+ delete(key) {
577
+ return this.cache.delete(key);
578
+ }
579
+ clear() {
580
+ this.cache.clear();
581
+ }
582
+ get size() {
583
+ return this.cache.size;
584
+ }
585
+ };
586
+
587
+ // src/core/platform.ts
588
+ var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
589
+ function toNativeValue(raw) {
590
+ if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
591
+ if (/^-?\d+(\.\d+)?rem$/.test(raw)) return parseFloat(raw) * 16;
592
+ if (/^-?\d+(\.\d+)?em$/.test(raw)) return parseFloat(raw) * 16;
593
+ if (/^-?\d+(\.\d+)?$/.test(raw)) return parseFloat(raw);
594
+ return raw;
595
+ }
596
+ function escapeCSSSelector(cls) {
597
+ return cls.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
598
+ }
599
+
600
+ // src/core/parser.ts
601
+ var MODIFIERS = /* @__PURE__ */ new Set([
602
+ // Theme
603
+ "dark",
604
+ "light",
605
+ "not-dark",
606
+ "not-light",
607
+ // Interaction
608
+ "hover",
609
+ "focus",
610
+ "active",
611
+ "visited",
612
+ "disabled",
613
+ "checked",
614
+ "pressed",
615
+ "placeholder",
616
+ "focus-within",
617
+ "focus-visible",
618
+ // Negated interaction
619
+ "not-hover",
620
+ "not-focus",
621
+ "not-active",
622
+ "not-visited",
623
+ "not-disabled",
624
+ "not-checked",
625
+ "not-pressed",
626
+ // Structural
627
+ "first",
628
+ "last",
629
+ "odd",
630
+ "even",
631
+ "only",
632
+ // Group / peer
633
+ "group-hover",
634
+ "group-focus",
635
+ "peer-hover",
636
+ "peer-focus",
637
+ // Responsive (handled separately but accepted)
638
+ "sm",
639
+ "md",
640
+ "lg",
641
+ "xl",
642
+ "2xl"
643
+ ]);
644
+ var UTILITY_PREFIXES = [
645
+ // Multi-word order matters
646
+ "flex-row-reverse",
647
+ "flex-col-reverse",
648
+ "flex-row",
649
+ "flex-col",
650
+ "flex-wrap-reverse",
651
+ "flex-wrap",
652
+ "flex-nowrap",
653
+ "flex-shrink-0",
654
+ "flex-shrink",
655
+ "flex-grow-0",
656
+ "flex-grow",
657
+ "items-start",
658
+ "items-end",
659
+ "items-center",
660
+ "items-baseline",
661
+ "items-stretch",
662
+ "justify-start",
663
+ "justify-end",
664
+ "justify-center",
665
+ "justify-between",
666
+ "justify-around",
667
+ "justify-evenly",
668
+ "content-start",
669
+ "content-end",
670
+ "content-center",
671
+ "content-between",
672
+ "content-around",
673
+ "content-evenly",
674
+ "self-start",
675
+ "self-end",
676
+ "self-center",
677
+ "self-auto",
678
+ "self-stretch",
679
+ "text-left",
680
+ "text-right",
681
+ "text-center",
682
+ "text-justify",
683
+ "font-thin",
684
+ "font-extralight",
685
+ "font-light",
686
+ "font-normal",
687
+ "font-medium",
688
+ "font-semibold",
689
+ "font-bold",
690
+ "font-extrabold",
691
+ "font-black",
692
+ "overflow-hidden",
693
+ "overflow-visible",
694
+ "overflow-scroll",
695
+ "overflow-auto",
696
+ "overflow-x-hidden",
697
+ "overflow-x-scroll",
698
+ "overflow-x-auto",
699
+ "overflow-y-hidden",
700
+ "overflow-y-scroll",
701
+ "overflow-y-auto",
702
+ "object-contain",
703
+ "object-cover",
704
+ "object-fill",
705
+ "object-none",
706
+ "object-scale-down",
707
+ "border-solid",
708
+ "border-dashed",
709
+ "border-dotted",
710
+ "border-none",
711
+ "border-t",
712
+ "border-r",
713
+ "border-b",
714
+ "border-l",
715
+ "rounded-tl",
716
+ "rounded-tr",
717
+ "rounded-bl",
718
+ "rounded-br",
719
+ "rounded-t",
720
+ "rounded-r",
721
+ "rounded-b",
722
+ "rounded-l",
723
+ "text-decoration-none",
724
+ "list-none",
725
+ "list-disc",
726
+ "list-decimal",
727
+ "cursor-auto",
728
+ "cursor-default",
729
+ "cursor-pointer",
730
+ "cursor-wait",
731
+ "cursor-text",
732
+ "cursor-move",
733
+ "cursor-not-allowed",
734
+ "select-none",
735
+ "select-text",
736
+ "select-all",
737
+ "select-auto",
738
+ "pointer-events-none",
739
+ "pointer-events-auto",
740
+ "whitespace-normal",
741
+ "whitespace-nowrap",
742
+ "whitespace-pre-wrap",
743
+ "whitespace-pre-line",
744
+ "whitespace-pre",
745
+ "break-normal",
746
+ "break-words",
747
+ "break-all",
748
+ "break-keep",
749
+ "bg-clip-border",
750
+ "bg-clip-padding",
751
+ "bg-clip-content",
752
+ "bg-clip-text",
753
+ "resize-none",
754
+ "resize-y",
755
+ "resize-x",
756
+ "box-border",
757
+ "box-content",
758
+ "gap-x",
759
+ "gap-y",
760
+ "inset-x",
761
+ "inset-y",
762
+ "divide-x",
763
+ "divide-y",
764
+ "space-x",
765
+ "space-y",
766
+ "translate-x",
767
+ "translate-y",
768
+ "scale-x",
769
+ "scale-y",
770
+ "skew-x",
771
+ "skew-y",
772
+ "origin-center",
773
+ "origin-top",
774
+ "origin-top-right",
775
+ "origin-right",
776
+ "origin-bottom-right",
777
+ "origin-bottom",
778
+ "origin-bottom-left",
779
+ "origin-left",
780
+ "origin-top-left",
781
+ "min-w",
782
+ "min-h",
783
+ "max-w",
784
+ "max-h",
785
+ "ring-offset",
786
+ "bg-opacity",
787
+ "text-opacity",
788
+ "border-opacity",
789
+ // Single-word prefixes last
790
+ "appearance-none",
791
+ "outline-none",
792
+ "outline",
793
+ "inline-flex",
794
+ "inline-block",
795
+ "inline-grid",
796
+ "italic",
797
+ "non-italic",
798
+ "underline",
799
+ "overline",
800
+ "line-through",
801
+ "no-underline",
802
+ "uppercase",
803
+ "lowercase",
804
+ "capitalize",
805
+ "normal-case",
806
+ "antialiased",
807
+ "truncate",
808
+ "sr-only",
809
+ "not-sr-only",
810
+ "relative",
811
+ "absolute",
812
+ "fixed",
813
+ "sticky",
814
+ "static",
815
+ "visible",
816
+ "invisible",
817
+ "hidden",
818
+ "contents",
819
+ "flow-root",
820
+ "block",
821
+ "inline",
822
+ "flex",
823
+ "grid",
824
+ "resize",
825
+ "appearance",
826
+ "border",
827
+ "rounded",
828
+ "shadow",
829
+ "opacity",
830
+ "leading",
831
+ "tracking",
832
+ "basis",
833
+ "grow",
834
+ "shrink",
835
+ "order",
836
+ "delay",
837
+ "duration",
838
+ "scale",
839
+ "rotate",
840
+ "aspect",
841
+ "columns",
842
+ "placeholder",
843
+ "ring",
844
+ "gap",
845
+ "inset",
846
+ "bg",
847
+ "text",
848
+ "font",
849
+ "from",
850
+ "via",
851
+ "to",
852
+ "divide",
853
+ "space",
854
+ "transition",
855
+ "px",
856
+ "py",
857
+ "pt",
858
+ "pr",
859
+ "pb",
860
+ "pl",
861
+ "p",
862
+ "mx",
863
+ "my",
864
+ "mt",
865
+ "mr",
866
+ "mb",
867
+ "ml",
868
+ "m",
869
+ "w",
870
+ "h",
871
+ "top",
872
+ "right",
873
+ "bottom",
874
+ "left",
875
+ "z",
876
+ "col",
877
+ "row",
878
+ "flex"
879
+ // also a standalone
880
+ ];
881
+ var SORTED_PREFIXES = [...new Set(UTILITY_PREFIXES)].sort((a, b) => b.length - a.length);
882
+ var STANDALONE_UTILITIES = /* @__PURE__ */ new Set([
883
+ "flex",
884
+ "block",
885
+ "inline-block",
886
+ "inline",
887
+ "grid",
888
+ "inline-flex",
889
+ "inline-grid",
890
+ "hidden",
891
+ "contents",
892
+ "flow-root",
893
+ "relative",
894
+ "absolute",
895
+ "fixed",
896
+ "sticky",
897
+ "static",
898
+ "visible",
899
+ "invisible",
900
+ "uppercase",
901
+ "lowercase",
902
+ "capitalize",
903
+ "normal-case",
904
+ "italic",
905
+ "non-italic",
906
+ "underline",
907
+ "overline",
908
+ "line-through",
909
+ "no-underline",
910
+ "truncate",
911
+ "antialiased",
912
+ "sr-only",
913
+ "not-sr-only",
914
+ "flex-row",
915
+ "flex-col",
916
+ "flex-row-reverse",
917
+ "flex-col-reverse",
918
+ "flex-wrap",
919
+ "flex-wrap-reverse",
920
+ "flex-nowrap",
921
+ "flex-shrink",
922
+ "flex-shrink-0",
923
+ "flex-grow",
924
+ "flex-grow-0",
925
+ "items-start",
926
+ "items-end",
927
+ "items-center",
928
+ "items-baseline",
929
+ "items-stretch",
930
+ "justify-start",
931
+ "justify-end",
932
+ "justify-center",
933
+ "justify-between",
934
+ "justify-around",
935
+ "justify-evenly",
936
+ "content-start",
937
+ "content-end",
938
+ "content-center",
939
+ "content-between",
940
+ "content-around",
941
+ "content-evenly",
942
+ "self-start",
943
+ "self-end",
944
+ "self-center",
945
+ "self-auto",
946
+ "self-stretch",
947
+ "text-left",
948
+ "text-right",
949
+ "text-center",
950
+ "text-justify",
951
+ "font-thin",
952
+ "font-extralight",
953
+ "font-light",
954
+ "font-normal",
955
+ "font-medium",
956
+ "font-semibold",
957
+ "font-bold",
958
+ "font-extrabold",
959
+ "font-black",
960
+ "overflow-hidden",
961
+ "overflow-visible",
962
+ "overflow-scroll",
963
+ "overflow-auto",
964
+ "overflow-x-hidden",
965
+ "overflow-x-scroll",
966
+ "overflow-x-auto",
967
+ "overflow-y-hidden",
968
+ "overflow-y-scroll",
969
+ "overflow-y-auto",
970
+ "object-contain",
971
+ "object-cover",
972
+ "object-fill",
973
+ "object-none",
974
+ "object-scale-down",
975
+ "border-solid",
976
+ "border-dashed",
977
+ "border-dotted",
978
+ "border-none",
979
+ "border-t",
980
+ "border-r",
981
+ "border-b",
982
+ "border-l",
983
+ "list-none",
984
+ "list-disc",
985
+ "list-decimal",
986
+ "cursor-auto",
987
+ "cursor-default",
988
+ "cursor-pointer",
989
+ "cursor-wait",
990
+ "cursor-text",
991
+ "cursor-move",
992
+ "cursor-not-allowed",
993
+ "select-none",
994
+ "select-text",
995
+ "select-all",
996
+ "select-auto",
997
+ "pointer-events-none",
998
+ "pointer-events-auto",
999
+ "whitespace-normal",
1000
+ "whitespace-nowrap",
1001
+ "whitespace-pre",
1002
+ "whitespace-pre-wrap",
1003
+ "whitespace-pre-line",
1004
+ "break-normal",
1005
+ "break-words",
1006
+ "break-all",
1007
+ "bg-clip-border",
1008
+ "bg-clip-padding",
1009
+ "bg-clip-content",
1010
+ "bg-clip-text",
1011
+ "box-border",
1012
+ "box-content",
1013
+ "resize",
1014
+ "resize-none",
1015
+ "resize-y",
1016
+ "resize-x",
1017
+ "appearance-none",
1018
+ "outline-none",
1019
+ "outline"
1020
+ ]);
1021
+ function parseClass(className) {
1022
+ const trimmed = className.trim();
1023
+ if (!trimmed) return null;
1024
+ const modifiers = [];
1025
+ let remaining = trimmed;
1026
+ for (let i = 0; i < 3; i++) {
1027
+ const colonIdx = findOuterColon(remaining);
1028
+ if (colonIdx === -1) break;
1029
+ const candidate = remaining.slice(0, colonIdx);
1030
+ if (MODIFIERS.has(candidate)) {
1031
+ modifiers.push(candidate);
1032
+ remaining = remaining.slice(colonIdx + 1);
1033
+ } else {
1034
+ break;
1035
+ }
1036
+ }
1037
+ let negative = false;
1038
+ if (remaining.startsWith("-") && remaining.length > 1 && remaining[1] !== "-") {
1039
+ negative = true;
1040
+ remaining = remaining.slice(1);
1041
+ }
1042
+ const bracketStart = remaining.lastIndexOf("-[");
1043
+ if (bracketStart > 0 && remaining.endsWith("]")) {
1044
+ const utility = remaining.slice(0, bracketStart);
1045
+ const value = remaining.slice(bracketStart + 2, -1);
1046
+ return { original: trimmed, modifiers, negative, utility, value, isArbitrary: true };
1047
+ }
1048
+ if (STANDALONE_UTILITIES.has(remaining)) {
1049
+ return { original: trimmed, modifiers, negative, utility: remaining, value: "", isArbitrary: false };
1050
+ }
1051
+ for (const prefix of SORTED_PREFIXES) {
1052
+ if (remaining === prefix) {
1053
+ return { original: trimmed, modifiers, negative, utility: prefix, value: "", isArbitrary: false };
1054
+ }
1055
+ if (remaining.startsWith(prefix + "-")) {
1056
+ const value = remaining.slice(prefix.length + 1);
1057
+ return { original: trimmed, modifiers, negative, utility: prefix, value, isArbitrary: false };
1058
+ }
1059
+ }
1060
+ const firstDash = remaining.indexOf("-");
1061
+ if (firstDash > 0) {
1062
+ return {
1063
+ original: trimmed,
1064
+ modifiers,
1065
+ negative,
1066
+ utility: remaining.slice(0, firstDash),
1067
+ value: remaining.slice(firstDash + 1),
1068
+ isArbitrary: false
1069
+ };
1070
+ }
1071
+ return { original: trimmed, modifiers, negative, utility: remaining, value: "", isArbitrary: false };
1072
+ }
1073
+ function parseClasses(classString) {
1074
+ const results = [];
1075
+ for (const token of classString.split(/\s+/)) {
1076
+ if (!token) continue;
1077
+ const parsed = parseClass(token);
1078
+ if (parsed) results.push(parsed);
1079
+ }
1080
+ return results;
1081
+ }
1082
+ function findOuterColon(s) {
1083
+ let depth = 0;
1084
+ for (let i = 0; i < s.length; i++) {
1085
+ const ch = s[i];
1086
+ if (ch === "[") depth++;
1087
+ else if (ch === "]") depth--;
1088
+ else if (ch === ":" && depth === 0) return i;
1089
+ }
1090
+ return -1;
1091
+ }
1092
+
1093
+ // src/core/utilities.ts
1094
+ function resolveColor(value, colors, isArbitrary) {
1095
+ if (isArbitrary) return value;
1096
+ const slashIdx = value.indexOf("/");
1097
+ const colorPart = slashIdx > 0 ? value.slice(0, slashIdx) : value;
1098
+ const opacityPart = slashIdx > 0 ? value.slice(slashIdx + 1) : null;
1099
+ let hex = null;
1100
+ if (colorPart in colors) {
1101
+ const entry = colors[colorPart];
1102
+ if (typeof entry === "string") hex = entry;
1103
+ else if (typeof entry === "object" && "6" in entry) hex = entry["6"];
1104
+ } else {
1105
+ const lastDash = colorPart.lastIndexOf("-");
1106
+ if (lastDash > 0) {
1107
+ const colorName = colorPart.slice(0, lastDash);
1108
+ const shade = colorPart.slice(lastDash + 1);
1109
+ const scale = colors[colorName];
1110
+ if (scale && typeof scale === "object" && shade in scale) {
1111
+ hex = scale[shade] ?? null;
1112
+ }
1113
+ }
1114
+ }
1115
+ if (!hex) return null;
1116
+ if (!opacityPart) return hex;
1117
+ let alpha;
1118
+ if (opacityPart.startsWith("[") && opacityPart.endsWith("]")) {
1119
+ const v = parseFloat(opacityPart.slice(1, -1));
1120
+ alpha = v > 1 ? v / 100 : v;
1121
+ } else {
1122
+ alpha = parseFloat(opacityPart) / 100;
1123
+ }
1124
+ if (isNaN(alpha)) return hex;
1125
+ return hexToRgba(hex, alpha);
1126
+ }
1127
+ function hexToRgba(hex, alpha) {
1128
+ const h = hex.replace("#", "");
1129
+ let r, g, b;
1130
+ if (h.length === 3) {
1131
+ r = parseInt(h[0] + h[0], 16);
1132
+ g = parseInt(h[1] + h[1], 16);
1133
+ b = parseInt(h[2] + h[2], 16);
1134
+ } else {
1135
+ r = parseInt(h.slice(0, 2), 16);
1136
+ g = parseInt(h.slice(2, 4), 16);
1137
+ b = parseInt(h.slice(4, 6), 16);
1138
+ }
1139
+ return `rgba(${r},${g},${b},${alpha})`;
1140
+ }
1141
+ function resolveSpacing(value, negative, spacing, isArbitrary) {
1142
+ if (isArbitrary) {
1143
+ const resolved = isWeb ? value : toNativeValue(value);
1144
+ return negative && typeof resolved === "number" ? -resolved : resolved;
1145
+ }
1146
+ const raw = spacing[value];
1147
+ if (raw === void 0) return null;
1148
+ if (typeof raw === "number") return negative ? -raw : raw;
1149
+ if (raw === "auto") return "auto";
1150
+ if (negative && typeof raw === "string" && raw.endsWith("%")) {
1151
+ return `-${raw}`;
1152
+ }
1153
+ return raw;
1154
+ }
1155
+ function resolveSizing(value, spacing, isArbitrary) {
1156
+ if (isArbitrary) return isWeb ? value : toNativeValue(value);
1157
+ const raw = spacing[value];
1158
+ if (raw !== void 0) return raw;
1159
+ if (/^\d+\/\d+$/.test(value)) {
1160
+ const [num, den] = value.split("/").map(Number);
1161
+ return `${(num / den * 100).toFixed(6)}%`;
1162
+ }
1163
+ return null;
1164
+ }
1165
+ function resolveRadius(value, radii, isArbitrary) {
1166
+ if (isArbitrary) return isWeb ? value : toNativeValue(value);
1167
+ const key = value === "" ? "DEFAULT" : value;
1168
+ return radii[key] ?? null;
1169
+ }
1170
+ function resolveFontSize(value, fontSizes, isArbitrary) {
1171
+ if (isArbitrary) return isWeb ? value : toNativeValue(value);
1172
+ return fontSizes[value] ?? null;
1173
+ }
1174
+ var STANDALONE = {
1175
+ // Display
1176
+ flex: { display: "flex" },
1177
+ block: { display: "block" },
1178
+ "inline-block": { display: "inline-block" },
1179
+ inline: { display: "inline" },
1180
+ grid: { display: "grid" },
1181
+ "inline-flex": { display: "inline-flex" },
1182
+ "inline-grid": { display: "inline-grid" },
1183
+ hidden: { display: "none" },
1184
+ contents: { display: "contents" },
1185
+ "flow-root": { display: "flow-root" },
1186
+ // Flex direction
1187
+ "flex-row": { flexDirection: "row" },
1188
+ "flex-col": { flexDirection: "column" },
1189
+ "flex-row-reverse": { flexDirection: "row-reverse" },
1190
+ "flex-col-reverse": { flexDirection: "column-reverse" },
1191
+ // Flex wrap
1192
+ "flex-wrap": { flexWrap: "wrap" },
1193
+ "flex-wrap-reverse": { flexWrap: "wrap-reverse" },
1194
+ "flex-nowrap": { flexWrap: "nowrap" },
1195
+ // Flex grow / shrink
1196
+ "flex-grow": { flexGrow: 1 },
1197
+ "flex-grow-0": { flexGrow: 0 },
1198
+ "flex-shrink": { flexShrink: 1 },
1199
+ "flex-shrink-0": { flexShrink: 0 },
1200
+ // Align items
1201
+ "items-start": { alignItems: "flex-start" },
1202
+ "items-end": { alignItems: "flex-end" },
1203
+ "items-center": { alignItems: "center" },
1204
+ "items-baseline": { alignItems: "baseline" },
1205
+ "items-stretch": { alignItems: "stretch" },
1206
+ // Justify content
1207
+ "justify-start": { justifyContent: "flex-start" },
1208
+ "justify-end": { justifyContent: "flex-end" },
1209
+ "justify-center": { justifyContent: "center" },
1210
+ "justify-between": { justifyContent: "space-between" },
1211
+ "justify-around": { justifyContent: "space-around" },
1212
+ "justify-evenly": { justifyContent: "space-evenly" },
1213
+ // Align content
1214
+ "content-start": { alignContent: "flex-start" },
1215
+ "content-end": { alignContent: "flex-end" },
1216
+ "content-center": { alignContent: "center" },
1217
+ "content-between": { alignContent: "space-between" },
1218
+ "content-around": { alignContent: "space-around" },
1219
+ "content-evenly": { alignContent: "space-evenly" },
1220
+ // Align self
1221
+ "self-auto": { alignSelf: "auto" },
1222
+ "self-start": { alignSelf: "flex-start" },
1223
+ "self-end": { alignSelf: "flex-end" },
1224
+ "self-center": { alignSelf: "center" },
1225
+ "self-stretch": { alignSelf: "stretch" },
1226
+ // Text align
1227
+ "text-left": { textAlign: "left" },
1228
+ "text-right": { textAlign: "right" },
1229
+ "text-center": { textAlign: "center" },
1230
+ "text-justify": { textAlign: "justify" },
1231
+ // Font weight shortcuts
1232
+ "font-thin": { fontWeight: "100" },
1233
+ "font-extralight": { fontWeight: "200" },
1234
+ "font-light": { fontWeight: "300" },
1235
+ "font-normal": { fontWeight: "400" },
1236
+ "font-medium": { fontWeight: "500" },
1237
+ "font-semibold": { fontWeight: "600" },
1238
+ "font-bold": { fontWeight: "700" },
1239
+ "font-extrabold": { fontWeight: "800" },
1240
+ "font-black": { fontWeight: "900" },
1241
+ // Text decoration
1242
+ underline: { textDecorationLine: "underline" },
1243
+ overline: { textDecorationLine: "overline" },
1244
+ "line-through": { textDecorationLine: "line-through" },
1245
+ "no-underline": { textDecorationLine: "none" },
1246
+ // Text transform
1247
+ uppercase: { textTransform: "uppercase" },
1248
+ lowercase: { textTransform: "lowercase" },
1249
+ capitalize: { textTransform: "capitalize" },
1250
+ "normal-case": { textTransform: "none" },
1251
+ // Font style
1252
+ italic: { fontStyle: "italic" },
1253
+ "non-italic": { fontStyle: "normal" },
1254
+ // Position
1255
+ relative: { position: "relative" },
1256
+ absolute: { position: "absolute" },
1257
+ fixed: { position: "fixed" },
1258
+ sticky: { position: "sticky" },
1259
+ static: { position: "static" },
1260
+ // Visibility
1261
+ visible: { visibility: "visible" },
1262
+ invisible: { visibility: "hidden" },
1263
+ // Overflow
1264
+ "overflow-hidden": { overflow: "hidden" },
1265
+ "overflow-visible": { overflow: "visible" },
1266
+ "overflow-scroll": { overflow: "scroll" },
1267
+ "overflow-auto": { overflow: "auto" },
1268
+ "overflow-x-hidden": { overflowX: "hidden" },
1269
+ "overflow-x-scroll": { overflowX: "scroll" },
1270
+ "overflow-x-auto": { overflowX: "auto" },
1271
+ "overflow-y-hidden": { overflowY: "hidden" },
1272
+ "overflow-y-scroll": { overflowY: "scroll" },
1273
+ "overflow-y-auto": { overflowY: "auto" },
1274
+ // Object fit
1275
+ "object-contain": { objectFit: "contain" },
1276
+ "object-cover": { objectFit: "cover" },
1277
+ "object-fill": { objectFit: "fill" },
1278
+ "object-none": { objectFit: "none" },
1279
+ "object-scale-down": { objectFit: "scale-down" },
1280
+ // Border style
1281
+ "border-solid": { borderStyle: "solid" },
1282
+ "border-dashed": { borderStyle: "dashed" },
1283
+ "border-dotted": { borderStyle: "dotted" },
1284
+ "border-none": { borderWidth: 0 },
1285
+ // Border sides (default width 1)
1286
+ "border-t": { borderTopWidth: 1 },
1287
+ "border-r": { borderRightWidth: 1 },
1288
+ "border-b": { borderBottomWidth: 1 },
1289
+ "border-l": { borderLeftWidth: 1 },
1290
+ // Cursor
1291
+ "cursor-auto": { cursor: "auto" },
1292
+ "cursor-default": { cursor: "default" },
1293
+ "cursor-pointer": { cursor: "pointer" },
1294
+ "cursor-wait": { cursor: "wait" },
1295
+ "cursor-text": { cursor: "text" },
1296
+ "cursor-move": { cursor: "move" },
1297
+ "cursor-not-allowed": { cursor: "not-allowed" },
1298
+ // Select
1299
+ "select-none": { userSelect: "none" },
1300
+ "select-text": { userSelect: "text" },
1301
+ "select-all": { userSelect: "all" },
1302
+ "select-auto": { userSelect: "auto" },
1303
+ // Pointer events
1304
+ "pointer-events-none": { pointerEvents: "none" },
1305
+ "pointer-events-auto": { pointerEvents: "auto" },
1306
+ // Whitespace
1307
+ "whitespace-normal": { whiteSpace: "normal" },
1308
+ "whitespace-nowrap": { whiteSpace: "nowrap" },
1309
+ "whitespace-pre": { whiteSpace: "pre" },
1310
+ "whitespace-pre-wrap": { whiteSpace: "pre-wrap" },
1311
+ "whitespace-pre-line": { whiteSpace: "pre-line" },
1312
+ // Word break
1313
+ "break-normal": { overflowWrap: "normal", wordBreak: "normal" },
1314
+ "break-words": { overflowWrap: "break-word" },
1315
+ "break-all": { wordBreak: "break-all" },
1316
+ // Misc
1317
+ truncate: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
1318
+ "box-border": { boxSizing: "border-box" },
1319
+ "box-content": { boxSizing: "content-box" },
1320
+ "appearance-none": { appearance: "none" },
1321
+ "outline-none": { outline: "none", outlineOffset: "0" },
1322
+ outline: { outline: "2px solid transparent", outlineOffset: "2px" },
1323
+ resize: { resize: "both" },
1324
+ "resize-none": { resize: "none" },
1325
+ "resize-y": { resize: "vertical" },
1326
+ "resize-x": { resize: "horizontal" },
1327
+ antialiased: { WebkitFontSmoothing: "antialiased", MozOsxFontSmoothing: "grayscale" },
1328
+ "sr-only": {
1329
+ position: "absolute",
1330
+ width: 1,
1331
+ height: 1,
1332
+ padding: 0,
1333
+ margin: -1,
1334
+ overflow: "hidden",
1335
+ clip: "rect(0,0,0,0)",
1336
+ whiteSpace: "nowrap",
1337
+ border: 0
1338
+ },
1339
+ "not-sr-only": {
1340
+ position: "static",
1341
+ width: "auto",
1342
+ height: "auto",
1343
+ padding: 0,
1344
+ margin: 0,
1345
+ overflow: "visible",
1346
+ clip: "auto",
1347
+ whiteSpace: "normal"
1348
+ },
1349
+ // Lists
1350
+ "list-none": { listStyleType: "none" },
1351
+ "list-disc": { listStyleType: "disc" },
1352
+ "list-decimal": { listStyleType: "decimal" },
1353
+ // Background clip
1354
+ "bg-clip-border": { backgroundClip: "border-box" },
1355
+ "bg-clip-padding": { backgroundClip: "padding-box" },
1356
+ "bg-clip-content": { backgroundClip: "content-box" },
1357
+ "bg-clip-text": { backgroundClip: "text", WebkitBackgroundClip: "text" }
1358
+ };
1359
+ var RESOLVERS = {
1360
+ // ── Background ─────────────────────────────────────────────────────────────
1361
+ bg: ({ value, isArbitrary }, { colors }) => {
1362
+ const color = resolveColor(value, colors, isArbitrary);
1363
+ return color ? { backgroundColor: color } : null;
1364
+ },
1365
+ "bg-opacity": ({ value, isArbitrary }, _) => {
1366
+ const v = isArbitrary ? parseFloat(value) / 100 : parseFloat(value) / 100;
1367
+ return isNaN(v) ? null : { "--bg-opacity": v };
1368
+ },
1369
+ // ── Text ───────────────────────────────────────────────────────────────────
1370
+ text: ({ value, isArbitrary }, { colors, fontSize }) => {
1371
+ const size = resolveFontSize(value, fontSize, false);
1372
+ if (!isArbitrary && size !== null) return { fontSize: size };
1373
+ if (isArbitrary) {
1374
+ if (/^\d/.test(value) || /^(calc|min|max|clamp)/.test(value)) {
1375
+ return { fontSize: isWeb ? value : toNativeValue(value) };
1376
+ }
1377
+ return { color: value };
1378
+ }
1379
+ const color = resolveColor(value, colors, false);
1380
+ return color ? { color } : null;
1381
+ },
1382
+ "text-opacity": ({ value }, _) => {
1383
+ const v = parseFloat(value) / 100;
1384
+ return isNaN(v) ? null : { "--text-opacity": v };
1385
+ },
1386
+ // ── Padding ────────────────────────────────────────────────────────────────
1387
+ p: ({ value, negative, isArbitrary }, { spacing }) => {
1388
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1389
+ return v !== null ? { padding: v } : null;
1390
+ },
1391
+ px: ({ value, negative, isArbitrary }, { spacing }) => {
1392
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1393
+ return v !== null ? { paddingHorizontal: v } : null;
1394
+ },
1395
+ py: ({ value, negative, isArbitrary }, { spacing }) => {
1396
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1397
+ return v !== null ? { paddingVertical: v } : null;
1398
+ },
1399
+ pt: ({ value, negative, isArbitrary }, { spacing }) => {
1400
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1401
+ return v !== null ? { paddingTop: v } : null;
1402
+ },
1403
+ pr: ({ value, negative, isArbitrary }, { spacing }) => {
1404
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1405
+ return v !== null ? { paddingRight: v } : null;
1406
+ },
1407
+ pb: ({ value, negative, isArbitrary }, { spacing }) => {
1408
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1409
+ return v !== null ? { paddingBottom: v } : null;
1410
+ },
1411
+ pl: ({ value, negative, isArbitrary }, { spacing }) => {
1412
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1413
+ return v !== null ? { paddingLeft: v } : null;
1414
+ },
1415
+ // ── Margin ─────────────────────────────────────────────────────────────────
1416
+ m: ({ value, negative, isArbitrary }, { spacing }) => {
1417
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1418
+ return v !== null ? { margin: v } : null;
1419
+ },
1420
+ mx: ({ value, negative, isArbitrary }, { spacing }) => {
1421
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1422
+ return v !== null ? { marginHorizontal: v } : null;
1423
+ },
1424
+ my: ({ value, negative, isArbitrary }, { spacing }) => {
1425
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1426
+ return v !== null ? { marginVertical: v } : null;
1427
+ },
1428
+ mt: ({ value, negative, isArbitrary }, { spacing }) => {
1429
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1430
+ return v !== null ? { marginTop: v } : null;
1431
+ },
1432
+ mr: ({ value, negative, isArbitrary }, { spacing }) => {
1433
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1434
+ return v !== null ? { marginRight: v } : null;
1435
+ },
1436
+ mb: ({ value, negative, isArbitrary }, { spacing }) => {
1437
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1438
+ return v !== null ? { marginBottom: v } : null;
1439
+ },
1440
+ ml: ({ value, negative, isArbitrary }, { spacing }) => {
1441
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1442
+ return v !== null ? { marginLeft: v } : null;
1443
+ },
1444
+ // ── Sizing ─────────────────────────────────────────────────────────────────
1445
+ w: ({ value, isArbitrary }, { spacing }) => {
1446
+ const v = resolveSizing(value, spacing, isArbitrary);
1447
+ return v !== null ? { width: v } : null;
1448
+ },
1449
+ h: ({ value, isArbitrary }, { spacing }) => {
1450
+ const v = resolveSizing(value, spacing, isArbitrary);
1451
+ return v !== null ? { height: v } : null;
1452
+ },
1453
+ "min-w": ({ value, isArbitrary }, { spacing }) => {
1454
+ const v = resolveSizing(value, spacing, isArbitrary);
1455
+ return v !== null ? { minWidth: v } : null;
1456
+ },
1457
+ "min-h": ({ value, isArbitrary }, { spacing }) => {
1458
+ const v = resolveSizing(value, spacing, isArbitrary);
1459
+ return v !== null ? { minHeight: v } : null;
1460
+ },
1461
+ "max-w": ({ value, isArbitrary }, { spacing }) => {
1462
+ const v = resolveSizing(value, spacing, isArbitrary);
1463
+ return v !== null ? { maxWidth: v } : null;
1464
+ },
1465
+ "max-h": ({ value, isArbitrary }, { spacing }) => {
1466
+ const v = resolveSizing(value, spacing, isArbitrary);
1467
+ return v !== null ? { maxHeight: v } : null;
1468
+ },
1469
+ // ── Border width ───────────────────────────────────────────────────────────
1470
+ border: ({ value, isArbitrary }, { colors, borderWidth, spacing }) => {
1471
+ if (!value) return { borderWidth: borderWidth["DEFAULT"] ?? 1 };
1472
+ const color = resolveColor(value, colors, isArbitrary);
1473
+ if (color) return { borderColor: color };
1474
+ if (isArbitrary) {
1475
+ const w2 = toNativeValue(value);
1476
+ return { borderWidth: typeof w2 === "number" ? w2 : 1 };
1477
+ }
1478
+ const w = borderWidth[value] ?? spacing[value];
1479
+ if (w !== void 0) return { borderWidth: typeof w === "number" ? w : parseFloat(String(w)) };
1480
+ return null;
1481
+ },
1482
+ "border-t": ({ value, isArbitrary }, { colors, borderWidth }) => {
1483
+ if (!value) return { borderTopWidth: 1 };
1484
+ const color = resolveColor(value, colors, isArbitrary);
1485
+ if (color) return { borderTopColor: color };
1486
+ const w = borderWidth[value] ?? (isArbitrary ? toNativeValue(value) : null);
1487
+ return w !== null ? { borderTopWidth: typeof w === "number" ? w : parseFloat(String(w)) } : null;
1488
+ },
1489
+ "border-r": ({ value, isArbitrary }, { colors, borderWidth }) => {
1490
+ if (!value) return { borderRightWidth: 1 };
1491
+ const color = resolveColor(value, colors, isArbitrary);
1492
+ if (color) return { borderRightColor: color };
1493
+ const w = borderWidth[value] ?? (isArbitrary ? toNativeValue(value) : null);
1494
+ return w !== null ? { borderRightWidth: typeof w === "number" ? w : parseFloat(String(w)) } : null;
1495
+ },
1496
+ "border-b": ({ value, isArbitrary }, { colors, borderWidth }) => {
1497
+ if (!value) return { borderBottomWidth: 1 };
1498
+ const color = resolveColor(value, colors, isArbitrary);
1499
+ if (color) return { borderBottomColor: color };
1500
+ const w = borderWidth[value] ?? (isArbitrary ? toNativeValue(value) : null);
1501
+ return w !== null ? { borderBottomWidth: typeof w === "number" ? w : parseFloat(String(w)) } : null;
1502
+ },
1503
+ "border-l": ({ value, isArbitrary }, { colors, borderWidth }) => {
1504
+ if (!value) return { borderLeftWidth: 1 };
1505
+ const color = resolveColor(value, colors, isArbitrary);
1506
+ if (color) return { borderLeftColor: color };
1507
+ const w = borderWidth[value] ?? (isArbitrary ? toNativeValue(value) : null);
1508
+ return w !== null ? { borderLeftWidth: typeof w === "number" ? w : parseFloat(String(w)) } : null;
1509
+ },
1510
+ // ── Border radius ──────────────────────────────────────────────────────────
1511
+ rounded: ({ value, isArbitrary }, { borderRadius }) => {
1512
+ const r = resolveRadius(value, borderRadius, isArbitrary);
1513
+ return r !== null ? { borderRadius: r } : null;
1514
+ },
1515
+ "rounded-t": ({ value, isArbitrary }, { borderRadius }) => {
1516
+ const r = resolveRadius(value, borderRadius, isArbitrary);
1517
+ return r !== null ? { borderTopLeftRadius: r, borderTopRightRadius: r } : null;
1518
+ },
1519
+ "rounded-r": ({ value, isArbitrary }, { borderRadius }) => {
1520
+ const r = resolveRadius(value, borderRadius, isArbitrary);
1521
+ return r !== null ? { borderTopRightRadius: r, borderBottomRightRadius: r } : null;
1522
+ },
1523
+ "rounded-b": ({ value, isArbitrary }, { borderRadius }) => {
1524
+ const r = resolveRadius(value, borderRadius, isArbitrary);
1525
+ return r !== null ? { borderBottomLeftRadius: r, borderBottomRightRadius: r } : null;
1526
+ },
1527
+ "rounded-l": ({ value, isArbitrary }, { borderRadius }) => {
1528
+ const r = resolveRadius(value, borderRadius, isArbitrary);
1529
+ return r !== null ? { borderTopLeftRadius: r, borderBottomLeftRadius: r } : null;
1530
+ },
1531
+ "rounded-tl": ({ value, isArbitrary }, { borderRadius }) => {
1532
+ const r = resolveRadius(value, borderRadius, isArbitrary);
1533
+ return r !== null ? { borderTopLeftRadius: r } : null;
1534
+ },
1535
+ "rounded-tr": ({ value, isArbitrary }, { borderRadius }) => {
1536
+ const r = resolveRadius(value, borderRadius, isArbitrary);
1537
+ return r !== null ? { borderTopRightRadius: r } : null;
1538
+ },
1539
+ "rounded-bl": ({ value, isArbitrary }, { borderRadius }) => {
1540
+ const r = resolveRadius(value, borderRadius, isArbitrary);
1541
+ return r !== null ? { borderBottomLeftRadius: r } : null;
1542
+ },
1543
+ "rounded-br": ({ value, isArbitrary }, { borderRadius }) => {
1544
+ const r = resolveRadius(value, borderRadius, isArbitrary);
1545
+ return r !== null ? { borderBottomRightRadius: r } : null;
1546
+ },
1547
+ // ── Flex ───────────────────────────────────────────────────────────────────
1548
+ flex: ({ value, isArbitrary }, { flex, spacing }) => {
1549
+ if (!value) return { display: "flex" };
1550
+ if (isArbitrary) {
1551
+ const v = parseFloat(value);
1552
+ return isNaN(v) ? null : { flex: v };
1553
+ }
1554
+ if (value in flex) return { flex: flex[value] };
1555
+ const n = parseFloat(value);
1556
+ return isNaN(n) ? null : { flex: n };
1557
+ },
1558
+ basis: ({ value, isArbitrary }, { spacing }) => {
1559
+ const v = resolveSizing(value, spacing, isArbitrary);
1560
+ return v !== null ? { flexBasis: v } : null;
1561
+ },
1562
+ grow: ({ value }, _) => {
1563
+ if (!value) return { flexGrow: 1 };
1564
+ const n = parseFloat(value);
1565
+ return { flexGrow: isNaN(n) ? 1 : n };
1566
+ },
1567
+ shrink: ({ value }, _) => {
1568
+ if (!value) return { flexShrink: 1 };
1569
+ const n = parseFloat(value);
1570
+ return { flexShrink: isNaN(n) ? 1 : n };
1571
+ },
1572
+ order: ({ value, isArbitrary }, _) => {
1573
+ if (isArbitrary) return { order: parseInt(value) };
1574
+ const n = parseInt(value);
1575
+ return isNaN(n) ? null : { order: n };
1576
+ },
1577
+ // ── Gap ────────────────────────────────────────────────────────────────────
1578
+ gap: ({ value, negative, isArbitrary }, { spacing }) => {
1579
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1580
+ return v !== null ? { gap: v } : null;
1581
+ },
1582
+ "gap-x": ({ value, negative, isArbitrary }, { spacing }) => {
1583
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1584
+ return v !== null ? { columnGap: v } : null;
1585
+ },
1586
+ "gap-y": ({ value, negative, isArbitrary }, { spacing }) => {
1587
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1588
+ return v !== null ? { rowGap: v } : null;
1589
+ },
1590
+ // ── Position ───────────────────────────────────────────────────────────────
1591
+ top: ({ value, negative, isArbitrary }, { spacing }) => {
1592
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1593
+ return v !== null ? { top: v } : null;
1594
+ },
1595
+ right: ({ value, negative, isArbitrary }, { spacing }) => {
1596
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1597
+ return v !== null ? { right: v } : null;
1598
+ },
1599
+ bottom: ({ value, negative, isArbitrary }, { spacing }) => {
1600
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1601
+ return v !== null ? { bottom: v } : null;
1602
+ },
1603
+ left: ({ value, negative, isArbitrary }, { spacing }) => {
1604
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1605
+ return v !== null ? { left: v } : null;
1606
+ },
1607
+ inset: ({ value, negative, isArbitrary }, { spacing }) => {
1608
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1609
+ return v !== null ? { top: v, right: v, bottom: v, left: v } : null;
1610
+ },
1611
+ "inset-x": ({ value, negative, isArbitrary }, { spacing }) => {
1612
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1613
+ return v !== null ? { left: v, right: v } : null;
1614
+ },
1615
+ "inset-y": ({ value, negative, isArbitrary }, { spacing }) => {
1616
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1617
+ return v !== null ? { top: v, bottom: v } : null;
1618
+ },
1619
+ // ── Z-index ────────────────────────────────────────────────────────────────
1620
+ z: ({ value, isArbitrary }, { zIndex }) => {
1621
+ if (isArbitrary) return { zIndex: parseInt(value) };
1622
+ const v = zIndex[value];
1623
+ if (v !== void 0) return { zIndex: v };
1624
+ const n = parseInt(value);
1625
+ return isNaN(n) ? null : { zIndex: n };
1626
+ },
1627
+ // ── Opacity ────────────────────────────────────────────────────────────────
1628
+ opacity: ({ value, isArbitrary }, { opacity }) => {
1629
+ if (isArbitrary) {
1630
+ const v2 = parseFloat(value);
1631
+ return isNaN(v2) ? null : { opacity: v2 > 1 ? v2 / 100 : v2 };
1632
+ }
1633
+ const v = opacity[value];
1634
+ if (v !== void 0) return { opacity: v };
1635
+ const n = parseFloat(value);
1636
+ return isNaN(n) ? null : { opacity: n > 1 ? n / 100 : n };
1637
+ },
1638
+ // ── Font ───────────────────────────────────────────────────────────────────
1639
+ font: ({ value, isArbitrary }, { fontFamily, fontWeight }) => {
1640
+ if (isArbitrary) return { fontFamily: value };
1641
+ if (value in fontFamily) {
1642
+ const ff = fontFamily[value];
1643
+ return { fontFamily: Array.isArray(ff) ? ff.join(", ") : ff };
1644
+ }
1645
+ if (value in fontWeight) return { fontWeight: String(fontWeight[value]) };
1646
+ return null;
1647
+ },
1648
+ // ── Line height ────────────────────────────────────────────────────────────
1649
+ leading: ({ value, isArbitrary }, { lineHeight }) => {
1650
+ if (isArbitrary) return { lineHeight: isWeb ? value : toNativeValue(value) };
1651
+ const v = lineHeight[value];
1652
+ return v !== void 0 ? { lineHeight: v } : null;
1653
+ },
1654
+ // ── Letter spacing ─────────────────────────────────────────────────────────
1655
+ tracking: ({ value, isArbitrary }, { letterSpacing }) => {
1656
+ if (isArbitrary) return { letterSpacing: isWeb ? value : toNativeValue(value) };
1657
+ const v = letterSpacing[value];
1658
+ return v !== void 0 ? { letterSpacing: v } : null;
1659
+ },
1660
+ // ── Shadow ─────────────────────────────────────────────────────────────────
1661
+ shadow: ({ value }, { shadow }) => {
1662
+ const key = value === "" ? "DEFAULT" : value;
1663
+ return shadow[key] ?? null;
1664
+ },
1665
+ // ── Scale ──────────────────────────────────────────────────────────────────
1666
+ scale: ({ value, isArbitrary }) => {
1667
+ const n = isArbitrary ? parseFloat(value) / 100 : parseFloat(value) / 100;
1668
+ if (isNaN(n)) return null;
1669
+ return isWeb ? { transform: `scale(${n})` } : { transform: [{ scale: n }] };
1670
+ },
1671
+ "scale-x": ({ value, isArbitrary }) => {
1672
+ const n = isArbitrary ? parseFloat(value) / 100 : parseFloat(value) / 100;
1673
+ if (isNaN(n)) return null;
1674
+ return isWeb ? { transform: `scaleX(${n})` } : { transform: [{ scaleX: n }] };
1675
+ },
1676
+ "scale-y": ({ value, isArbitrary }) => {
1677
+ const n = isArbitrary ? parseFloat(value) / 100 : parseFloat(value) / 100;
1678
+ if (isNaN(n)) return null;
1679
+ return isWeb ? { transform: `scaleY(${n})` } : { transform: [{ scaleY: n }] };
1680
+ },
1681
+ // ── Rotate ─────────────────────────────────────────────────────────────────
1682
+ rotate: ({ value, negative, isArbitrary }) => {
1683
+ const raw = isArbitrary ? value : `${value}deg`;
1684
+ const deg = parseFloat(raw);
1685
+ if (isNaN(deg)) return null;
1686
+ const finalDeg = negative ? -deg : deg;
1687
+ return isWeb ? { transform: `rotate(${finalDeg}deg)` } : { transform: [{ rotate: `${finalDeg}deg` }] };
1688
+ },
1689
+ // ── Translate ──────────────────────────────────────────────────────────────
1690
+ "translate-x": ({ value, negative, isArbitrary }, { spacing }) => {
1691
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1692
+ if (v === null) return null;
1693
+ return isWeb ? { transform: `translateX(${v})` } : { transform: [{ translateX: typeof v === "string" ? parseFloat(v) : v }] };
1694
+ },
1695
+ "translate-y": ({ value, negative, isArbitrary }, { spacing }) => {
1696
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1697
+ if (v === null) return null;
1698
+ return isWeb ? { transform: `translateY(${v})` } : { transform: [{ translateY: typeof v === "string" ? parseFloat(v) : v }] };
1699
+ },
1700
+ // ── Aspect ratio ───────────────────────────────────────────────────────────
1701
+ aspect: ({ value, isArbitrary }) => {
1702
+ if (isArbitrary) return { aspectRatio: value };
1703
+ const presets = { auto: "auto", square: 1, video: 16 / 9 };
1704
+ return value in presets ? { aspectRatio: presets[value] } : null;
1705
+ },
1706
+ // ── Transition ─────────────────────────────────────────────────────────────
1707
+ transition: ({ value }) => {
1708
+ const presets = {
1709
+ "": "color 150ms, background-color 150ms, border-color 150ms, opacity 150ms, box-shadow 150ms",
1710
+ all: "all 150ms",
1711
+ none: "none",
1712
+ colors: "color 150ms, background-color 150ms, border-color 150ms",
1713
+ opacity: "opacity 150ms",
1714
+ shadow: "box-shadow 150ms",
1715
+ transform: "transform 150ms"
1716
+ };
1717
+ const v = presets[value];
1718
+ return v !== void 0 ? { transition: v } : null;
1719
+ },
1720
+ duration: ({ value, isArbitrary }) => {
1721
+ const ms = isArbitrary ? value : `${value}ms`;
1722
+ return { transitionDuration: ms };
1723
+ },
1724
+ delay: ({ value, isArbitrary }) => {
1725
+ const ms = isArbitrary ? value : `${value}ms`;
1726
+ return { transitionDelay: ms };
1727
+ },
1728
+ // ── Space between (uses CSS gap or margin fallback) ────────────────────────
1729
+ "space-x": ({ value, negative, isArbitrary }, { spacing }) => {
1730
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1731
+ return v !== null ? { columnGap: v } : null;
1732
+ },
1733
+ "space-y": ({ value, negative, isArbitrary }, { spacing }) => {
1734
+ const v = resolveSpacing(value, negative, spacing, isArbitrary);
1735
+ return v !== null ? { rowGap: v } : null;
1736
+ }
1737
+ };
1738
+ function resolveUtility(parsed, theme) {
1739
+ const standalone = STANDALONE[parsed.utility];
1740
+ if (standalone) return standalone;
1741
+ const resolver = RESOLVERS[parsed.utility];
1742
+ if (resolver) return resolver(parsed, theme);
1743
+ return null;
1744
+ }
1745
+ function getStandaloneMap() {
1746
+ return STANDALONE;
1747
+ }
1748
+ function getResolverMap() {
1749
+ return RESOLVERS;
1750
+ }
1751
+
1752
+ // src/core/resolver.ts
1753
+ var styleCache = new LRUCache(1e4);
1754
+ var _styleEl = null;
1755
+ var _injectedRules = /* @__PURE__ */ new Set();
1756
+ function getStyleEl() {
1757
+ if (_styleEl) return _styleEl;
1758
+ _styleEl = document.createElement("style");
1759
+ _styleEl.setAttribute("data-kbach", "");
1760
+ document.head.appendChild(_styleEl);
1761
+ return _styleEl;
1762
+ }
1763
+ function injectRule(rule) {
1764
+ if (_injectedRules.has(rule)) return;
1765
+ _injectedRules.add(rule);
1766
+ getStyleEl().sheet?.insertRule(rule, getStyleEl().sheet.cssRules.length);
1767
+ }
1768
+ function injectCSS(classString, resolved, darkMode) {
1769
+ if (!isWeb) return;
1770
+ for (const [modifierKey, styles] of Object.entries(resolved)) {
1771
+ if (!styles || Object.keys(styles).length === 0) continue;
1772
+ const classes = classString.trim().split(/\s+/);
1773
+ for (const cls of classes) {
1774
+ const cssDecls = styleValueToCSS(styles);
1775
+ if (!cssDecls) continue;
1776
+ const escaped = escapeCSSSelector(cls);
1777
+ if (modifierKey === "base") {
1778
+ injectRule(`.${escaped} { ${cssDecls} }`);
1779
+ continue;
1780
+ }
1781
+ const mods = modifierKey.split(":");
1782
+ const pseudos = mods.filter((m) => !["dark", "light"].includes(m));
1783
+ const hasDark = mods.includes("dark");
1784
+ const pseudoSuffix = pseudos.map((p) => `:${p}`).join("");
1785
+ let selector = `.${escaped}${pseudoSuffix}`;
1786
+ let rule;
1787
+ if (hasDark) {
1788
+ if (darkMode === "media") {
1789
+ rule = `@media (prefers-color-scheme: dark) { ${selector} { ${cssDecls} } }`;
1790
+ } else if (darkMode === "class") {
1791
+ rule = `.dark ${selector} { ${cssDecls} }`;
1792
+ } else {
1793
+ rule = `[data-theme="dark"] ${selector} { ${cssDecls} }`;
1794
+ }
1795
+ } else {
1796
+ rule = `${selector} { ${cssDecls} }`;
1797
+ }
1798
+ injectRule(rule);
1799
+ }
1800
+ }
1801
+ }
1802
+ function styleValueToCSS(styles) {
1803
+ return Object.entries(styles).filter(([, v]) => v !== void 0 && v !== null).map(([prop, val]) => `${camelToKebab(prop)}: ${val}`).join("; ");
1804
+ }
1805
+ function camelToKebab(str) {
1806
+ return str.replace(/([A-Z])/g, "-$1").toLowerCase();
1807
+ }
1808
+ function resolve(classString, theme, darkMode = "attribute") {
1809
+ const cacheKey = `${classString}::${darkMode}`;
1810
+ const cached = styleCache.get(cacheKey);
1811
+ if (cached) return cached;
1812
+ const result = {};
1813
+ const parsedClasses = parseClasses(classString);
1814
+ for (const parsed of parsedClasses) {
1815
+ const styles = resolveUtility(parsed, theme);
1816
+ if (!styles) continue;
1817
+ const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
1818
+ if (!result[bucketKey]) result[bucketKey] = {};
1819
+ Object.assign(result[bucketKey], styles);
1820
+ }
1821
+ styleCache.set(cacheKey, result);
1822
+ if (isWeb) {
1823
+ Promise.resolve().then(() => injectCSS(classString, result, darkMode));
1824
+ }
1825
+ return result;
1826
+ }
1827
+ function flatten(resolved, isDark, state = {}) {
1828
+ const result = { ...resolved.base ?? {} };
1829
+ for (const [key, styles] of Object.entries(resolved)) {
1830
+ if (key === "base" || !styles) continue;
1831
+ const mods = key.split(":");
1832
+ if (matchesMods(mods, isDark, state)) {
1833
+ Object.assign(result, styles);
1834
+ }
1835
+ }
1836
+ return result;
1837
+ }
1838
+ function matchesMods(mods, isDark, state) {
1839
+ return mods.every((mod) => {
1840
+ switch (mod) {
1841
+ case "dark":
1842
+ return isDark;
1843
+ case "light":
1844
+ case "not-dark":
1845
+ return !isDark;
1846
+ case "not-light":
1847
+ return isDark;
1848
+ case "hover":
1849
+ return !!state.hover;
1850
+ case "not-hover":
1851
+ return !state.hover;
1852
+ case "focus":
1853
+ return !!state.focus;
1854
+ case "not-focus":
1855
+ return !state.focus;
1856
+ case "pressed":
1857
+ case "active":
1858
+ return !!state.pressed || !!state.active;
1859
+ case "not-pressed":
1860
+ case "not-active":
1861
+ return !state.pressed && !state.active;
1862
+ case "disabled":
1863
+ return !!state.disabled;
1864
+ case "not-disabled":
1865
+ return !state.disabled;
1866
+ case "checked":
1867
+ return !!state.checked;
1868
+ case "not-checked":
1869
+ return !state.checked;
1870
+ case "visited":
1871
+ return !!state.visited;
1872
+ case "not-visited":
1873
+ return !state.visited;
1874
+ case "placeholder":
1875
+ return !!state.placeholder;
1876
+ default:
1877
+ return false;
1878
+ }
1879
+ });
1880
+ }
1881
+
1882
+ // src/core/config.ts
1883
+ function deepMerge(base, override) {
1884
+ const result = { ...base };
1885
+ for (const key of Object.keys(override)) {
1886
+ const baseVal = base[key];
1887
+ const overVal = override[key];
1888
+ if (baseVal !== null && typeof baseVal === "object" && !Array.isArray(baseVal) && overVal !== null && typeof overVal === "object" && !Array.isArray(overVal)) {
1889
+ result[key] = deepMerge(
1890
+ baseVal,
1891
+ overVal
1892
+ );
1893
+ } else if (overVal !== void 0) {
1894
+ result[key] = overVal;
1895
+ }
1896
+ }
1897
+ return result;
1898
+ }
1899
+ var _resolved = null;
1900
+ function getConfig() {
1901
+ if (_resolved) return _resolved;
1902
+ _resolved = buildConfig({});
1903
+ return _resolved;
1904
+ }
1905
+ function buildConfig(userConfig) {
1906
+ let theme = { ...defaultTheme };
1907
+ if (userConfig.theme) {
1908
+ theme = deepMerge(theme, userConfig.theme);
1909
+ }
1910
+ if (userConfig.extend?.theme) {
1911
+ const ext = userConfig.extend.theme;
1912
+ for (const [key, value] of Object.entries(ext)) {
1913
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
1914
+ theme[key] = deepMerge(
1915
+ theme[key] ?? {},
1916
+ value
1917
+ );
1918
+ } else {
1919
+ theme[key] = value;
1920
+ }
1921
+ }
1922
+ }
1923
+ const resolved = {
1924
+ darkMode: userConfig.darkMode ?? "attribute",
1925
+ theme,
1926
+ plugins: userConfig.plugins ?? []
1927
+ };
1928
+ for (const plugin of resolved.plugins) {
1929
+ plugin(makePluginAPI(resolved.theme));
1930
+ }
1931
+ return resolved;
1932
+ }
1933
+ function makePluginAPI(theme) {
1934
+ const standalone = getStandaloneMap();
1935
+ const resolvers = getResolverMap();
1936
+ return {
1937
+ addUtility(name, styles) {
1938
+ standalone[name] = styles;
1939
+ },
1940
+ addVariant(name, _selector) {
1941
+ customVariants[name] = _selector;
1942
+ },
1943
+ theme(path, defaultValue) {
1944
+ const parts = path.replace(/\[([^\]]+)\]/g, ".$1").split(".");
1945
+ let current = theme;
1946
+ for (const part of parts) {
1947
+ if (current === null || typeof current !== "object") return defaultValue;
1948
+ current = current[part];
1949
+ }
1950
+ return current ?? defaultValue;
1951
+ },
1952
+ e(className) {
1953
+ return className.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
1954
+ }
1955
+ };
1956
+ }
1957
+ var customVariants = {};
1958
+
1959
+ // src/core/darkModeStore.ts
1960
+ var _isDark = false;
1961
+ var _subscribers = /* @__PURE__ */ new Set();
1962
+ function getGlobalDarkMode() {
1963
+ return _isDark;
1964
+ }
1965
+ function subscribeGlobalDarkMode(callback) {
1966
+ _subscribers.add(callback);
1967
+ return () => _subscribers.delete(callback);
1968
+ }
41
1969
 
42
1970
  // src/InteractiveWrapper.tsx
43
1971
  var import_react2 = __toESM(require("react"));
44
- var import_core2 = require("@kbach/core");
45
1972
 
46
1973
  // src/useGlobalDarkMode.ts
47
1974
  var import_react = __toESM(require("react"));
48
- var import_core = require("@kbach/core");
49
1975
  var useSyncExternalStore = import_react.default.useSyncExternalStore ?? function useSyncExternalStoreFallback(subscribe, getSnapshot, _getServerSnapshot) {
50
1976
  const [, forceUpdate] = import_react.default.useReducer((n) => n + 1, 0);
51
1977
  import_react.default.useEffect(() => subscribe(forceUpdate), [subscribe]);
@@ -53,8 +1979,8 @@ var useSyncExternalStore = import_react.default.useSyncExternalStore ?? function
53
1979
  };
54
1980
  function useGlobalDarkMode() {
55
1981
  return useSyncExternalStore(
56
- import_core.subscribeGlobalDarkMode,
57
- import_core.getGlobalDarkMode,
1982
+ subscribeGlobalDarkMode,
1983
+ getGlobalDarkMode,
58
1984
  () => false
59
1985
  // SSR: default light
60
1986
  );
@@ -92,7 +2018,7 @@ var InteractiveWrapper = (0, import_react2.forwardRef)(
92
2018
  const handleFocus = (0, import_react2.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
93
2019
  const handleBlur = (0, import_react2.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
94
2020
  const computedStyle = (0, import_react2.useMemo)(
95
- () => (0, import_core2.flatten)(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }),
2021
+ () => flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }),
96
2022
  [resolvedStyle, isDark, pressed, hovered, focused]
97
2023
  );
98
2024
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
@@ -101,7 +2027,7 @@ var InteractiveWrapper = (0, import_react2.forwardRef)(
101
2027
  ref,
102
2028
  ...restWithoutChildren,
103
2029
  style: finalStyle,
104
- ...import_core2.isWeb && className ? { className } : {},
2030
+ ...isWeb && className ? { className } : {},
105
2031
  onPressIn: handlePressIn,
106
2032
  onPressOut: handlePressOut,
107
2033
  onMouseEnter: handleMouseEnter,
@@ -116,11 +2042,10 @@ InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
116
2042
 
117
2043
  // src/DarkWrapper.tsx
118
2044
  var import_react3 = __toESM(require("react"));
119
- var import_core3 = require("@kbach/core");
120
2045
  var DarkWrapper = import_react3.default.forwardRef(
121
2046
  function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
122
2047
  const isDark = useGlobalDarkMode();
123
- const computedStyle = (0, import_core3.flatten)(resolvedStyle, isDark);
2048
+ const computedStyle = flatten(resolvedStyle, isDark);
124
2049
  const finalStyle = styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
125
2050
  const props = { ref, ...rest, style: finalStyle };
126
2051
  return Array.isArray(children) ? import_react3.default.createElement(Component, props, ...children) : import_react3.default.createElement(Component, props, children);
@@ -138,7 +2063,7 @@ function hasInteractiveBuckets(resolved) {
138
2063
  return true;
139
2064
  });
140
2065
  }
141
- var CONSUMED_PROPS = /* @__PURE__ */ new Set(["className", "tw", "__kbachStyles", "__kbachClasses"]);
2066
+ var CONSUMED_PROPS = /* @__PURE__ */ new Set(["className", "kb", "__kbachStyles", "__kbachClasses"]);
142
2067
  function omitConsumed(props) {
143
2068
  const out = {};
144
2069
  for (const key of Object.keys(props)) {
@@ -156,19 +2081,19 @@ function makeElement(isStaticChildren, type, props, key) {
156
2081
  }
157
2082
  function processElement(type, rawProps, key, isStaticChildren) {
158
2083
  if (!rawProps) return (0, import_jsx_runtime.jsx)(type, null, key);
159
- const { className, tw: twProp, __kbachStyles, __kbachClasses } = rawProps;
160
- const classStr = className ?? twProp ?? __kbachClasses;
2084
+ const { className, kb: kbProp, __kbachStyles, __kbachClasses } = rawProps;
2085
+ const classStr = className ?? kbProp ?? __kbachClasses;
161
2086
  if (!classStr && !__kbachStyles) {
162
2087
  return makeElement(isStaticChildren, type, rawProps, key);
163
2088
  }
164
- const config = (0, import_core4.getConfig)();
165
- const resolved = __kbachStyles ?? (classStr ? (0, import_core4.resolve)(classStr, config.theme, config.darkMode) : {});
2089
+ const config = getConfig();
2090
+ const resolved = __kbachStyles ?? (classStr ? resolve(classStr, config.theme, config.darkMode) : {});
166
2091
  const { style: userStyle, ...passProps } = omitConsumed(rawProps);
167
2092
  if (hasInteractiveBuckets(resolved)) {
168
2093
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
169
2094
  Component: type,
170
2095
  resolvedStyle: resolved,
171
- ...import_core4.isWeb && classStr ? { className: classStr } : {},
2096
+ ...isWeb && classStr ? { className: classStr } : {},
172
2097
  style: userStyle,
173
2098
  ...passProps
174
2099
  }, key);
@@ -180,17 +2105,17 @@ function processElement(type, rawProps, key, isStaticChildren) {
180
2105
  return (0, import_jsx_runtime.jsx)(DarkWrapper, {
181
2106
  Component: type,
182
2107
  resolvedStyle: resolved,
183
- ...import_core4.isWeb && classStr ? { className: classStr } : {},
2108
+ ...isWeb && classStr ? { className: classStr } : {},
184
2109
  style: userStyle,
185
2110
  ...passProps
186
2111
  }, key);
187
2112
  }
188
- const computedStyle = (0, import_core4.flatten)(resolved, false);
2113
+ const computedStyle = flatten(resolved, false);
189
2114
  const finalStyle = mergeStyle(computedStyle, userStyle);
190
2115
  return makeElement(isStaticChildren, type, {
191
2116
  ...passProps,
192
2117
  style: finalStyle,
193
- ...import_core4.isWeb && classStr ? { className: classStr } : {}
2118
+ ...isWeb && classStr ? { className: classStr } : {}
194
2119
  }, key);
195
2120
  }
196
2121
  function jsx(type, props, key) {