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