@kbach/react 0.6.25 → 0.6.28

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.
@@ -39,3259 +39,26 @@ module.exports = __toCommonJS(jsx_dev_runtime_exports);
39
39
  // src/jsx-runtime.tsx
40
40
  var import_jsx_runtime = require("react/jsx-runtime");
41
41
  var import_react4 = require("react");
42
-
43
- // src/core/theme.ts
44
- var defaultColors = {
45
- transparent: "transparent",
46
- current: "currentColor",
47
- black: "#000000",
48
- white: "#ffffff",
49
- slate: {
50
- 1: "#f8fafc",
51
- 2: "#f1f5f9",
52
- 3: "#e2e8f0",
53
- 4: "#cbd5e1",
54
- 5: "#94a3b8",
55
- 6: "#64748b",
56
- 7: "#475569",
57
- 8: "#334155",
58
- 9: "#1e293b",
59
- 10: "#0f172a",
60
- 11: "#020617",
61
- 12: "#01020a"
62
- },
63
- gray: {
64
- 1: "#f9fafb",
65
- 2: "#f3f4f6",
66
- 3: "#e5e7eb",
67
- 4: "#d1d5db",
68
- 5: "#9ca3af",
69
- 6: "#6b7280",
70
- 7: "#4b5563",
71
- 8: "#374151",
72
- 9: "#1f2937",
73
- 10: "#111827",
74
- 11: "#030712",
75
- 12: "#020409"
76
- },
77
- zinc: {
78
- 1: "#fafafa",
79
- 2: "#f4f4f5",
80
- 3: "#e4e4e7",
81
- 4: "#d4d4d8",
82
- 5: "#a1a1aa",
83
- 6: "#71717a",
84
- 7: "#52525b",
85
- 8: "#3f3f46",
86
- 9: "#27272a",
87
- 10: "#18181b",
88
- 11: "#09090b",
89
- 12: "#050506"
90
- },
91
- neutral: {
92
- 1: "#fafafa",
93
- 2: "#f5f5f5",
94
- 3: "#e5e5e5",
95
- 4: "#d4d4d4",
96
- 5: "#a3a3a3",
97
- 6: "#737373",
98
- 7: "#525252",
99
- 8: "#404040",
100
- 9: "#262626",
101
- 10: "#171717",
102
- 11: "#0a0a0a",
103
- 12: "#050505"
104
- },
105
- stone: {
106
- 1: "#fafaf9",
107
- 2: "#f5f5f4",
108
- 3: "#e7e5e4",
109
- 4: "#d6d3d1",
110
- 5: "#a8a29e",
111
- 6: "#78716c",
112
- 7: "#57534e",
113
- 8: "#44403c",
114
- 9: "#292524",
115
- 10: "#1c1917",
116
- 11: "#0c0a09",
117
- 12: "#070605"
118
- },
119
- red: {
120
- 1: "#fef2f2",
121
- 2: "#fee2e2",
122
- 3: "#fecaca",
123
- 4: "#fca5a5",
124
- 5: "#f87171",
125
- 6: "#ef4444",
126
- 7: "#dc2626",
127
- 8: "#b91c1c",
128
- 9: "#991b1b",
129
- 10: "#7f1d1d",
130
- 11: "#450a0a",
131
- 12: "#280606"
132
- },
133
- orange: {
134
- 1: "#fff7ed",
135
- 2: "#ffedd5",
136
- 3: "#fed7aa",
137
- 4: "#fdba74",
138
- 5: "#fb923c",
139
- 6: "#f97316",
140
- 7: "#ea580c",
141
- 8: "#c2410c",
142
- 9: "#9a3412",
143
- 10: "#7c2d12",
144
- 11: "#431407",
145
- 12: "#270c04"
146
- },
147
- amber: {
148
- 1: "#fffbeb",
149
- 2: "#fef3c7",
150
- 3: "#fde68a",
151
- 4: "#fcd34d",
152
- 5: "#fbbf24",
153
- 6: "#f59e0b",
154
- 7: "#d97706",
155
- 8: "#b45309",
156
- 9: "#92400e",
157
- 10: "#78350f",
158
- 11: "#451a03",
159
- 12: "#291002"
160
- },
161
- yellow: {
162
- 1: "#fefce8",
163
- 2: "#fef9c3",
164
- 3: "#fef08a",
165
- 4: "#fde047",
166
- 5: "#facc15",
167
- 6: "#eab308",
168
- 7: "#ca8a04",
169
- 8: "#a16207",
170
- 9: "#854d0e",
171
- 10: "#713f12",
172
- 11: "#422006",
173
- 12: "#271304"
174
- },
175
- lime: {
176
- 1: "#f7fee7",
177
- 2: "#ecfccb",
178
- 3: "#d9f99d",
179
- 4: "#bef264",
180
- 5: "#a3e635",
181
- 6: "#84cc16",
182
- 7: "#65a30d",
183
- 8: "#4d7c0f",
184
- 9: "#3f6212",
185
- 10: "#365314",
186
- 11: "#1a2e05",
187
- 12: "#0f1b03"
188
- },
189
- green: {
190
- 1: "#f0fdf4",
191
- 2: "#dcfce7",
192
- 3: "#bbf7d0",
193
- 4: "#86efac",
194
- 5: "#4ade80",
195
- 6: "#22c55e",
196
- 7: "#16a34a",
197
- 8: "#15803d",
198
- 9: "#166534",
199
- 10: "#14532d",
200
- 11: "#052e16",
201
- 12: "#031b0d"
202
- },
203
- emerald: {
204
- 1: "#ecfdf5",
205
- 2: "#d1fae5",
206
- 3: "#a7f3d0",
207
- 4: "#6ee7b7",
208
- 5: "#34d399",
209
- 6: "#10b981",
210
- 7: "#059669",
211
- 8: "#047857",
212
- 9: "#065f46",
213
- 10: "#064e3b",
214
- 11: "#022c22",
215
- 12: "#011a14"
216
- },
217
- teal: {
218
- 1: "#f0fdfa",
219
- 2: "#ccfbf1",
220
- 3: "#99f6e4",
221
- 4: "#5eead4",
222
- 5: "#2dd4bf",
223
- 6: "#14b8a6",
224
- 7: "#0d9488",
225
- 8: "#0f766e",
226
- 9: "#115e59",
227
- 10: "#134e4a",
228
- 11: "#042f2e",
229
- 12: "#021c1b"
230
- },
231
- cyan: {
232
- 1: "#ecfeff",
233
- 2: "#cffafe",
234
- 3: "#a5f3fc",
235
- 4: "#67e8f9",
236
- 5: "#22d3ee",
237
- 6: "#06b6d4",
238
- 7: "#0891b2",
239
- 8: "#0e7490",
240
- 9: "#155e75",
241
- 10: "#164e63",
242
- 11: "#083344",
243
- 12: "#041e28"
244
- },
245
- sky: {
246
- 1: "#f0f9ff",
247
- 2: "#e0f2fe",
248
- 3: "#bae6fd",
249
- 4: "#7dd3fc",
250
- 5: "#38bdf8",
251
- 6: "#0ea5e9",
252
- 7: "#0284c7",
253
- 8: "#0369a1",
254
- 9: "#075985",
255
- 10: "#0c4a6e",
256
- 11: "#082f49",
257
- 12: "#041b2b"
258
- },
259
- blue: {
260
- 1: "#eff6ff",
261
- 2: "#dbeafe",
262
- 3: "#bfdbfe",
263
- 4: "#93c5fd",
264
- 5: "#60a5fa",
265
- 6: "#3b82f6",
266
- 7: "#2563eb",
267
- 8: "#1d4ed8",
268
- 9: "#1e40af",
269
- 10: "#1e3a8a",
270
- 11: "#172554",
271
- 12: "#0d1633"
272
- },
273
- indigo: {
274
- 1: "#eef2ff",
275
- 2: "#e0e7ff",
276
- 3: "#c7d2fe",
277
- 4: "#a5b4fc",
278
- 5: "#818cf8",
279
- 6: "#6366f1",
280
- 7: "#4f46e5",
281
- 8: "#4338ca",
282
- 9: "#3730a3",
283
- 10: "#312e81",
284
- 11: "#1e1b4b",
285
- 12: "#12102d"
286
- },
287
- violet: {
288
- 1: "#f5f3ff",
289
- 2: "#ede9fe",
290
- 3: "#ddd6fe",
291
- 4: "#c4b5fd",
292
- 5: "#a78bfa",
293
- 6: "#8b5cf6",
294
- 7: "#7c3aed",
295
- 8: "#6d28d9",
296
- 9: "#5b21b6",
297
- 10: "#4c1d95",
298
- 11: "#2e1065",
299
- 12: "#1c0a3d"
300
- },
301
- purple: {
302
- 1: "#faf5ff",
303
- 2: "#f3e8ff",
304
- 3: "#e9d5ff",
305
- 4: "#d8b4fe",
306
- 5: "#c084fc",
307
- 6: "#a855f7",
308
- 7: "#9333ea",
309
- 8: "#7e22ce",
310
- 9: "#6b21a8",
311
- 10: "#581c87",
312
- 11: "#3b0764",
313
- 12: "#23043c"
314
- },
315
- fuchsia: {
316
- 1: "#fdf4ff",
317
- 2: "#fae8ff",
318
- 3: "#f5d0fe",
319
- 4: "#f0abfc",
320
- 5: "#e879f9",
321
- 6: "#d946ef",
322
- 7: "#c026d3",
323
- 8: "#a21caf",
324
- 9: "#86198f",
325
- 10: "#701a75",
326
- 11: "#4a044e",
327
- 12: "#2d022f"
328
- },
329
- pink: {
330
- 1: "#fdf2f8",
331
- 2: "#fce7f3",
332
- 3: "#fbcfe8",
333
- 4: "#f9a8d4",
334
- 5: "#f472b6",
335
- 6: "#ec4899",
336
- 7: "#db2777",
337
- 8: "#be185d",
338
- 9: "#9d174d",
339
- 10: "#831843",
340
- 11: "#500724",
341
- 12: "#300415"
342
- },
343
- rose: {
344
- 1: "#fff1f2",
345
- 2: "#ffe4e6",
346
- 3: "#fecdd3",
347
- 4: "#fda4af",
348
- 5: "#fb7185",
349
- 6: "#f43f5e",
350
- 7: "#e11d48",
351
- 8: "#be123c",
352
- 9: "#9f1239",
353
- 10: "#881337",
354
- 11: "#4c0519",
355
- 12: "#2d030e"
356
- }
357
- };
358
- var defaultTheme = {
359
- colors: defaultColors,
360
- // 1 unit = 4px
361
- spacing: {
362
- px: 1,
363
- 0: 0,
364
- "0.5": 2,
365
- 1: 4,
366
- "1.5": 6,
367
- 2: 8,
368
- "2.5": 10,
369
- 3: 12,
370
- "3.5": 14,
371
- 4: 16,
372
- 5: 20,
373
- 6: 24,
374
- 7: 28,
375
- 8: 32,
376
- 9: 36,
377
- 10: 40,
378
- 11: 44,
379
- 12: 48,
380
- 14: 56,
381
- 16: 64,
382
- 20: 80,
383
- 24: 96,
384
- 28: 112,
385
- 32: 128,
386
- 36: 144,
387
- 40: 160,
388
- 44: 176,
389
- 48: 192,
390
- 52: 208,
391
- 56: 224,
392
- 60: 240,
393
- 64: 256,
394
- 72: 288,
395
- 80: 320,
396
- 96: 384,
397
- auto: "auto",
398
- full: "100%",
399
- "1/2": "50%",
400
- "1/3": "33.333333%",
401
- "2/3": "66.666667%",
402
- "1/4": "25%",
403
- "3/4": "75%",
404
- // Dynamic viewport unit — see the comment on the 'screen' standalone utilities
405
- // in utilities.ts for why dvh beats vh on mobile. Used by h-screen (w-screen
406
- // has its own standalone entry so it never reaches this spacing lookup).
407
- screen: "100dvh",
408
- min: "min-content",
409
- max: "max-content",
410
- fit: "fit-content"
411
- },
412
- fontSize: {
413
- xs: 12,
414
- sm: 14,
415
- base: 16,
416
- lg: 18,
417
- xl: 20,
418
- "2xl": 24,
419
- "3xl": 30,
420
- "4xl": 36,
421
- "5xl": 48,
422
- "6xl": 60,
423
- "7xl": 72,
424
- "8xl": 96,
425
- "9xl": 128
426
- },
427
- fontFamily: {
428
- sans: "System",
429
- mono: "Courier New",
430
- serif: "Georgia"
431
- },
432
- fontWeight: {
433
- thin: "100",
434
- extralight: "200",
435
- light: "300",
436
- normal: "400",
437
- medium: "500",
438
- semibold: "600",
439
- bold: "700",
440
- extrabold: "800",
441
- black: "900"
442
- },
443
- borderRadius: {
444
- none: 0,
445
- sm: 2,
446
- DEFAULT: 4,
447
- md: 6,
448
- lg: 8,
449
- xl: 12,
450
- "2xl": 16,
451
- "3xl": 24,
452
- full: 9999
453
- },
454
- borderWidth: {
455
- DEFAULT: 1,
456
- 0: 0,
457
- 2: 2,
458
- 4: 4,
459
- 8: 8
460
- },
461
- opacity: {
462
- 0: 0,
463
- 5: 0.05,
464
- 10: 0.1,
465
- 15: 0.15,
466
- 20: 0.2,
467
- 25: 0.25,
468
- 30: 0.3,
469
- 40: 0.4,
470
- 50: 0.5,
471
- 60: 0.6,
472
- 70: 0.7,
473
- 75: 0.75,
474
- 80: 0.8,
475
- 90: 0.9,
476
- 95: 0.95,
477
- 100: 1
478
- },
479
- lineHeight: {
480
- none: 1,
481
- tight: 1.25,
482
- snug: 1.375,
483
- normal: 1.5,
484
- relaxed: 1.625,
485
- loose: 2,
486
- // Pixel values stored as strings; styleValueToCSS passes them through, toNativeValue strips the unit
487
- 3: "12px",
488
- 4: "16px",
489
- 5: "20px",
490
- 6: "24px",
491
- 7: "28px",
492
- 8: "32px",
493
- 9: "36px",
494
- 10: "40px"
495
- },
496
- letterSpacing: {
497
- tighter: -0.8,
498
- tight: -0.4,
499
- normal: 0,
500
- wide: 0.4,
501
- wider: 0.8,
502
- widest: 1.6
503
- },
504
- zIndex: {
505
- auto: "auto",
506
- 0: 0,
507
- 10: 10,
508
- 20: 20,
509
- 30: 30,
510
- 40: 40,
511
- 50: 50
512
- },
513
- flex: {
514
- 1: 1,
515
- auto: "auto",
516
- // CSS: flex: auto = 1 1 auto; native: mapped to 1 in resolver
517
- initial: "initial",
518
- // CSS: flex: initial = 0 1 auto; native: mapped to 1
519
- none: "none"
520
- // CSS: flex: none = 0 0 auto; native: mapped to 0
521
- },
522
- shadow: {
523
- sm: {
524
- shadowColor: "#000",
525
- shadowOffset: { width: 0, height: 1 },
526
- shadowOpacity: 0.05,
527
- shadowRadius: 2,
528
- elevation: 1
529
- },
530
- DEFAULT: {
531
- shadowColor: "#000",
532
- shadowOffset: { width: 0, height: 2 },
533
- shadowOpacity: 0.1,
534
- shadowRadius: 4,
535
- elevation: 2
536
- },
537
- md: {
538
- shadowColor: "#000",
539
- shadowOffset: { width: 0, height: 4 },
540
- shadowOpacity: 0.1,
541
- shadowRadius: 8,
542
- elevation: 3
543
- },
544
- lg: {
545
- shadowColor: "#000",
546
- shadowOffset: { width: 0, height: 8 },
547
- shadowOpacity: 0.1,
548
- shadowRadius: 15,
549
- elevation: 4
550
- },
551
- xl: {
552
- shadowColor: "#000",
553
- shadowOffset: { width: 0, height: 16 },
554
- shadowOpacity: 0.1,
555
- shadowRadius: 24,
556
- elevation: 6
557
- },
558
- "2xl": {
559
- shadowColor: "#000",
560
- shadowOffset: { width: 0, height: 24 },
561
- shadowOpacity: 0.25,
562
- shadowRadius: 48,
563
- elevation: 8
564
- },
565
- none: {
566
- shadowColor: "transparent",
567
- shadowOffset: { width: 0, height: 0 },
568
- shadowOpacity: 0,
569
- shadowRadius: 0,
570
- elevation: 0
571
- }
572
- },
573
- screens: {
574
- sm: 576,
575
- // small tablets / large phones (landscape)
576
- md: 768,
577
- // tablets (iPad and up)
578
- lg: 1024,
579
- // large tablets (iPad Pro)
580
- xl: 1280,
581
- // desktop
582
- "2xl": 1536
583
- },
584
- // Empty by default — the 4 built-in presets (spin/ping/pulse/bounce) are handled
585
- // directly in the `animate` resolver, not through this theme table. This exists so
586
- // user-defined ones (kbach.config.js theme.extend.keyframes/animation) merge in
587
- // alongside them without needing to redeclare the built-ins.
588
- keyframes: {},
589
- animation: {}
590
- };
591
-
592
- // src/core/reset.ts
593
- var RESET_STYLE_ID = "kbach-reset";
594
- var BASE_RESET = [
595
- // border-style: solid means border-N utilities show a visible border without an extra border-solid class.
596
- // border-width: 0 keeps all elements borderless by default.
597
- "*, *::before, *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: currentColor; }",
598
- "body { margin: 0; padding: 0; }",
599
- "h1, h2, h3, h4, h5, h6 { margin: 0; font-size: inherit; font-weight: inherit; }",
600
- "p { margin: 0; }",
601
- "a { color: inherit; text-decoration: none; }",
602
- "ul, ol { margin: 0; padding: 0; list-style: none; }",
603
- "img, video, svg { display: block; max-width: 100%; }",
604
- // appearance: none is deliberately NOT applied to checkbox/radio/select below —
605
- // stripping it hides their native checkmark/arrow with nothing rendered in its
606
- // place, leaving an invisible checkbox or an arrow-less <select> that looks like
607
- // plain text. Text-like inputs, textarea, and button don't have that problem
608
- // (their native chrome is just a skin around content utilities can fully
609
- // restyle), so they keep the blank-canvas treatment.
610
- "input:not([type='checkbox']):not([type='radio']), textarea { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; line-height: inherit; }",
611
- // Native checkbox/radio/range still get typography + spacing normalized, and
612
- // accent-color re-themes their native indicator to the current text color
613
- // instead of the browser/OS default blue, so they stay on-brand without
614
- // needing to be rebuilt from scratch.
615
- "input[type='checkbox'], input[type='radio'], input[type='range'] { margin: 0; font: inherit; accent-color: currentColor; }",
616
- // select keeps its native chrome (border/background/arrow are all part of the
617
- // same OS-drawn widget that appearance: none would blank out) — only typography
618
- // and spacing are normalized so it still matches surrounding text.
619
- "select { margin: 0; font: inherit; color: inherit; line-height: inherit; }",
620
- "button { appearance: none; -webkit-appearance: none; background: transparent; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; line-height: inherit; text-align: inherit; }",
621
- "button, [role='button'] { cursor: pointer; }",
622
- ":disabled { cursor: default; }",
623
- "textarea { resize: vertical; }",
624
- // Firefox renders placeholders at ~54% opacity by default; every other browser uses 1 —
625
- // normalize to 1 so placeholder color is consistent and fully controlled by the placeholder: modifier.
626
- "::placeholder { opacity: 1; }",
627
- "input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { margin: 0; }",
628
- "input[type='search']::-webkit-search-decoration, input[type='search']::-webkit-search-cancel-button { -webkit-appearance: none; }",
629
- "fieldset { padding: 0; margin: 0; }",
630
- "table { border-collapse: collapse; border-spacing: 0; }"
631
- ].join("\n");
632
-
633
- // src/core/cache.ts
634
- var LRUCache = class {
635
- constructor(capacity = 1e4, onEvict) {
636
- this.capacity = capacity;
637
- if (capacity <= 0) throw new Error("LRUCache: capacity must be a positive integer");
638
- this.cache = /* @__PURE__ */ new Map();
639
- this.onEvict = onEvict;
640
- }
641
- get(key) {
642
- if (!this.cache.has(key)) return void 0;
643
- const value = this.cache.get(key);
644
- this.cache.delete(key);
645
- this.cache.set(key, value);
646
- return value;
647
- }
648
- set(key, value) {
649
- if (this.cache.has(key)) {
650
- this.cache.delete(key);
651
- } else if (this.cache.size >= this.capacity) {
652
- const oldestKey = this.cache.keys().next().value;
653
- const oldestValue = this.cache.get(oldestKey);
654
- this.cache.delete(oldestKey);
655
- this.onEvict?.(oldestKey, oldestValue);
656
- }
657
- this.cache.set(key, value);
658
- return this;
659
- }
660
- has(key) {
661
- return this.cache.has(key);
662
- }
663
- delete(key) {
664
- return this.cache.delete(key);
665
- }
666
- clear() {
667
- this.cache.clear();
668
- }
669
- get size() {
670
- return this.cache.size;
671
- }
672
- };
673
-
674
- // src/core/platform.ts
675
- var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
676
- var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative" || typeof globalThis.__REACT_NATIVE__ !== "undefined");
677
- var _resolveTargetOverride = null;
678
- function getEffectiveIsWeb() {
679
- if (_resolveTargetOverride) return _resolveTargetOverride === "web";
680
- return isWeb || !isNative;
681
- }
682
- function toNativeValue(raw) {
683
- if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
684
- if (/^-?\d+(\.\d+)?rem$/.test(raw)) return parseFloat(raw) * 16;
685
- if (/^-?\d+(\.\d+)?em$/.test(raw)) return parseFloat(raw) * 16;
686
- if (/^-?\d+(\.\d+)?$/.test(raw)) return parseFloat(raw);
687
- return raw;
688
- }
689
- function escapeCSSSelector(cls) {
690
- return cls.replace(/[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
691
- }
692
-
693
- // src/core/devWarn.ts
694
- function kbachWarn(message) {
695
- console.warn(
696
- "%c[kbach]%c " + message,
697
- "color:#8b5cf6;font-weight:700",
698
- "color:inherit;font-weight:400"
699
- );
700
- }
701
-
702
- // src/core/registry.ts
703
- var BUILTIN_MODIFIERS = {
704
- // ── Mode ─────────────────────────────────────────────────────────────────
705
- dark: { darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
706
- "not-light": { darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
707
- light: { darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
708
- "not-dark": { darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
709
- // ── Interactive — JS state + CSS pseudo ───────────────────────────────────
710
- hover: { pseudo: ":hover", jsBehavior: "interactive", jsMatch: (_, s) => !!s.hover },
711
- "not-hover": { pseudo: ":not(:hover)", jsBehavior: "interactive", jsMatch: (_, s) => !s.hover },
712
- focus: { pseudo: ":focus", jsBehavior: "interactive", jsMatch: (_, s) => !!s.focus },
713
- "not-focus": { pseudo: ":not(:focus)", jsBehavior: "interactive", jsMatch: (_, s) => !s.focus },
714
- active: { pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.active || !!s.pressed },
715
- "not-active": { pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.active && !s.pressed },
716
- pressed: { pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.pressed || !!s.active },
717
- "not-pressed": { pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.pressed && !s.active },
718
- disabled: { pseudo: ":disabled", jsBehavior: "interactive", jsMatch: (_, s) => !!s.disabled },
719
- "not-disabled": { pseudo: ":not(:disabled)", jsBehavior: "interactive", jsMatch: (_, s) => !s.disabled },
720
- checked: { pseudo: ":checked", jsBehavior: "interactive", jsMatch: (_, s) => !!s.checked },
721
- "not-checked": { pseudo: ":not(:checked)", jsBehavior: "interactive", jsMatch: (_, s) => !s.checked },
722
- visited: { pseudo: ":visited", jsBehavior: "interactive", jsMatch: (_, s) => !!s.visited },
723
- "not-visited": { pseudo: ":not(:visited)", jsBehavior: "interactive", jsMatch: (_, s) => !s.visited },
724
- placeholder: { pseudo: "::placeholder", jsBehavior: "interactive", jsMatch: (_, s) => !!s.placeholder },
725
- // ── CSS-only pseudo-classes (structural) ──────────────────────────────────
726
- first: { pseudo: ":first-child", jsBehavior: "css-only", forcesImportant: true },
727
- last: { pseudo: ":last-child", jsBehavior: "css-only", forcesImportant: true },
728
- odd: { pseudo: ":nth-child(odd)", jsBehavior: "css-only", forcesImportant: true },
729
- even: { pseudo: ":nth-child(even)", jsBehavior: "css-only", forcesImportant: true },
730
- only: { pseudo: ":only-child", jsBehavior: "css-only", forcesImportant: true },
731
- "focus-within": { pseudo: ":focus-within", jsBehavior: "css-only", forcesImportant: true },
732
- "focus-visible": { pseudo: ":focus-visible", jsBehavior: "css-only", forcesImportant: true },
733
- // ── CSS-only pseudo-elements ───────────────────────────────────────────────
734
- before: { pseudo: "::before", jsBehavior: "css-only" },
735
- after: { pseudo: "::after", jsBehavior: "css-only" },
736
- selection: { pseudo: "::selection", jsBehavior: "css-only" },
737
- "first-letter": { pseudo: "::first-letter", jsBehavior: "css-only" },
738
- "first-line": { pseudo: "::first-line", jsBehavior: "css-only" },
739
- marker: { pseudo: "::marker", jsBehavior: "css-only" },
740
- // ── Group / peer ancestor selectors (CSS-only) ─────────────────────────────
741
- "group-hover": { ancestorSelector: ".group:hover ", jsBehavior: "css-only", forcesImportant: true },
742
- "group-focus": { ancestorSelector: ".group:focus ", jsBehavior: "css-only", forcesImportant: true },
743
- "peer-hover": { ancestorSelector: ".peer:hover ~ ", jsBehavior: "css-only", forcesImportant: true },
744
- "peer-focus": { ancestorSelector: ".peer:focus ~ ", jsBehavior: "css-only", forcesImportant: true },
745
- // ── Responsive — both CSS (@media min-width) and JS (breakpoints set) ──────
746
- sm: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("sm") },
747
- md: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("md") },
748
- lg: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("lg") },
749
- xl: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("xl") },
750
- "2xl": { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("2xl") },
751
- // ── Print media (CSS-only) ─────────────────────────────────────────────────
752
- print: { mediaQuery: "print", jsBehavior: "css-only", forcesImportant: true },
753
- // ── Orientation / accessibility media (CSS-only) ───────────────────────────
754
- landscape: { mediaQuery: "(orientation: landscape)", jsBehavior: "css-only", forcesImportant: true },
755
- portrait: { mediaQuery: "(orientation: portrait)", jsBehavior: "css-only", forcesImportant: true },
756
- "motion-reduce": { mediaQuery: "(prefers-reduced-motion: reduce)", jsBehavior: "css-only", forcesImportant: true },
757
- "motion-safe": { mediaQuery: "(prefers-reduced-motion: no-preference)", jsBehavior: "css-only", forcesImportant: true },
758
- "contrast-more": { mediaQuery: "(prefers-contrast: more)", jsBehavior: "css-only", forcesImportant: true },
759
- "contrast-less": { mediaQuery: "(prefers-contrast: less)", jsBehavior: "css-only", forcesImportant: true },
760
- // ── Directionality (CSS-only) ──────────────────────────────────────────────
761
- rtl: { dirSelector: '[dir="rtl"] ', jsBehavior: "css-only", forcesImportant: true },
762
- ltr: { dirSelector: '[dir="ltr"] ', jsBehavior: "css-only", forcesImportant: true }
763
- };
764
- var _pluginModifiers = {};
765
- var _allNames = null;
766
- var _interactiveNames = null;
767
- var _modeNames = null;
768
- var _responsiveNames = null;
769
- function _invalidate() {
770
- _allNames = null;
771
- _interactiveNames = null;
772
- _modeNames = null;
773
- _responsiveNames = null;
774
- }
775
- function registerModifier(name, def) {
776
- if (process.env.NODE_ENV !== "production" && name in BUILTIN_MODIFIERS) {
777
- kbachWarn(`"${name}" is built-in \u2014 pick another modifier name`);
778
- return;
779
- }
780
- _pluginModifiers[name] = def;
781
- _invalidate();
782
- }
783
- function clearPluginModifiers() {
784
- for (const k of Object.keys(_pluginModifiers)) delete _pluginModifiers[k];
785
- _invalidate();
786
- }
787
- var NAMED_GROUP_PEER_RE = /^(group|peer)-(hover|focus)\/(.+)$/;
788
- var _namedModifierCache = /* @__PURE__ */ new Map();
789
- function getNamedGroupPeerModifier(name) {
790
- const cached = _namedModifierCache.get(name);
791
- if (cached) return cached;
792
- const m = NAMED_GROUP_PEER_RE.exec(name);
793
- if (!m) return void 0;
794
- const [, kind, trigger, groupName] = m;
795
- const escapedName = escapeCSSSelector(groupName);
796
- const pseudo = trigger === "hover" ? ":hover" : ":focus";
797
- const combinator = kind === "group" ? " " : " ~ ";
798
- const def = {
799
- ancestorSelector: `.${kind}\\/${escapedName}${pseudo}${combinator}`,
800
- jsBehavior: "css-only",
801
- forcesImportant: true
802
- };
803
- _namedModifierCache.set(name, def);
804
- return def;
805
- }
806
- function getModifier(name) {
807
- return BUILTIN_MODIFIERS[name] ?? _pluginModifiers[name] ?? getNamedGroupPeerModifier(name);
808
- }
809
- function isKnownModifier(name) {
810
- return name in BUILTIN_MODIFIERS || name in _pluginModifiers || NAMED_GROUP_PEER_RE.test(name);
811
- }
812
- function _allEntries() {
813
- return [...Object.entries(BUILTIN_MODIFIERS), ...Object.entries(_pluginModifiers)];
814
- }
815
- function getInteractiveModifiers() {
816
- if (!_interactiveNames) {
817
- _interactiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "interactive").map(([k]) => k));
818
- }
819
- return _interactiveNames;
820
- }
821
- function getModeModifiers() {
822
- if (!_modeNames) {
823
- _modeNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "mode").map(([k]) => k));
824
- }
825
- return _modeNames;
826
- }
827
- function getResponsiveModifiers() {
828
- if (!_responsiveNames) {
829
- _responsiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "responsive").map(([k]) => k));
830
- }
831
- return _responsiveNames;
832
- }
833
- function matchModifier(name, isDark, state, breakpoints) {
834
- return getModifier(name)?.jsMatch?.(isDark, state, breakpoints) ?? false;
835
- }
836
-
837
- // src/core/utilities.ts
838
- function resolveColor(value, colors, isArbitrary) {
839
- if (isArbitrary) return value;
840
- const slashIdx = value.indexOf("/");
841
- const colorPart = slashIdx > 0 ? value.slice(0, slashIdx) : value;
842
- const opacityPart = slashIdx > 0 ? value.slice(slashIdx + 1) : null;
843
- let hex = null;
844
- if (colorPart in colors) {
845
- const entry = colors[colorPart];
846
- if (typeof entry === "string") hex = entry;
847
- else if (typeof entry === "object" && "6" in entry) hex = entry["6"];
848
- } else {
849
- const lastDash = colorPart.lastIndexOf("-");
850
- if (lastDash > 0) {
851
- const colorName = colorPart.slice(0, lastDash);
852
- const shade = colorPart.slice(lastDash + 1);
853
- const scale = colors[colorName];
854
- if (scale && typeof scale === "object" && shade in scale) {
855
- hex = scale[shade] ?? null;
856
- }
857
- }
858
- }
859
- if (!hex) return null;
860
- if (!opacityPart) {
861
- if (!getEffectiveIsWeb() && hex.startsWith("#") && hex.length === 9) {
862
- return hexToRgba(hex, Math.round(parseInt(hex.slice(7, 9), 16) / 255 * 1e3) / 1e3);
863
- }
864
- return hex;
865
- }
866
- let alpha;
867
- if (opacityPart.startsWith("[") && opacityPart.endsWith("]")) {
868
- const v = parseFloat(opacityPart.slice(1, -1));
869
- alpha = v > 1 ? v / 100 : v;
870
- } else {
871
- alpha = parseFloat(opacityPart) / 100;
872
- }
873
- if (isNaN(alpha)) return hex;
874
- if (alpha < 0) alpha = 0;
875
- else if (alpha > 1) alpha = 1;
876
- return hexToRgba(hex, alpha);
877
- }
878
- function parseHexRgb(hex) {
879
- const h = hex.replace("#", "");
880
- if (h.length === 3 || h.length === 4) {
881
- return [
882
- parseInt(h[0] + h[0], 16),
883
- parseInt(h[1] + h[1], 16),
884
- parseInt(h[2] + h[2], 16)
885
- ];
886
- }
887
- if (h.length === 6 || h.length === 8) {
888
- return [
889
- parseInt(h.slice(0, 2), 16),
890
- parseInt(h.slice(2, 4), 16),
891
- parseInt(h.slice(4, 6), 16)
892
- ];
893
- }
894
- return null;
895
- }
896
- function hexToRgba(hex, alpha) {
897
- const rgb = parseHexRgb(hex);
898
- if (!rgb) return hex;
899
- const [r, g, b] = rgb;
900
- return `rgba(${r},${g},${b},${alpha})`;
901
- }
902
- function withOpacityVar(color, varName) {
903
- if (!color.startsWith("#")) return color;
904
- const rgb = parseHexRgb(color);
905
- if (!rgb) return color;
906
- const [r, g, b] = rgb;
907
- return `rgba(${r},${g},${b},var(${varName},1))`;
908
- }
909
- function resolveSpacing(value, negative, spacing, isArbitrary) {
910
- if (isArbitrary) {
911
- const resolved = getEffectiveIsWeb() ? value : toNativeValue(value);
912
- if (negative) {
913
- if (typeof resolved === "number") return -resolved;
914
- if (typeof resolved === "string") {
915
- if (/^\d/.test(resolved)) return `-${resolved}`;
916
- if (/^(calc|var|min|max|clamp|env)\s*\(/.test(resolved)) return `calc(-1 * (${resolved}))`;
917
- }
918
- }
919
- return resolved;
920
- }
921
- const raw = spacing[value];
922
- if (raw === void 0) return null;
923
- if (typeof raw === "number") return negative ? -raw : raw;
924
- if (raw === "auto") return "auto";
925
- if (negative && typeof raw === "string" && raw.endsWith("%")) {
926
- return `-${raw}`;
927
- }
928
- return raw;
929
- }
930
- function resolveSizing(value, spacing, isArbitrary) {
931
- if (isArbitrary) return getEffectiveIsWeb() ? value : toNativeValue(value);
932
- const raw = spacing[value];
933
- if (raw !== void 0) return raw;
934
- if (/^\d+\/\d+$/.test(value)) {
935
- const [num, den] = value.split("/").map(Number);
936
- if (!den) return null;
937
- return `${(num / den * 100).toFixed(6)}%`;
938
- }
939
- return null;
940
- }
941
- function resolveRadius(value, radii, isArbitrary) {
942
- if (isArbitrary) return getEffectiveIsWeb() ? value : toNativeValue(value);
943
- const key = value === "" ? "DEFAULT" : value;
944
- return radii[key] ?? null;
945
- }
946
- function resolveFontSize(value, fontSizes, isArbitrary) {
947
- if (isArbitrary) return getEffectiveIsWeb() ? value : toNativeValue(value);
948
- return fontSizes[value] ?? null;
949
- }
950
- var FILTER_COMPOSE = "var(--kb-blur,) var(--kb-brightness,) var(--kb-contrast,) var(--kb-grayscale,) var(--kb-hue-rotate,) var(--kb-invert,) var(--kb-saturate,) var(--kb-sepia,) var(--kb-drop-shadow,)";
951
- var BACKDROP_FILTER_COMPOSE = "var(--kb-backdrop-blur,) var(--kb-backdrop-brightness,) var(--kb-backdrop-contrast,) var(--kb-backdrop-grayscale,) var(--kb-backdrop-hue-rotate,) var(--kb-backdrop-invert,) var(--kb-backdrop-opacity,) var(--kb-backdrop-saturate,) var(--kb-backdrop-sepia,)";
952
- var _standalone = null;
953
- function buildStandalone() {
954
- const web = getEffectiveIsWeb();
955
- return {
956
- // Display
957
- // React Native only supports display:'flex'|'none'. Setting 'flex' explicitly is
958
- // a no-op normally, but is needed to re-show an element that was hidden via `hidden`.
959
- // `grid`, `contents`, `flow-root` have no native equivalent and stay null there.
960
- // The inline-* family (inline, inline-block, inline-flex, inline-grid) falls back
961
- // to 'flex' on native instead — like plain `flex`, this is a no-op most of the
962
- // time, but without it these utilities couldn't re-show a `hidden` element on
963
- // native either (null → no style applied → still display:'none').
964
- flex: { display: "flex" },
965
- block: web ? { display: "block" } : null,
966
- "inline-block": { display: web ? "inline-block" : "flex" },
967
- inline: { display: web ? "inline" : "flex" },
968
- grid: web ? { display: "grid" } : null,
969
- grd: web ? { display: "grid" } : null,
970
- "inline-flex": { display: web ? "inline-flex" : "flex" },
971
- "inline-grid": { display: web ? "inline-grid" : "flex" },
972
- hidden: { display: "none" },
973
- contents: web ? { display: "contents" } : null,
974
- "flow-root": web ? { display: "flow-root" } : null,
975
- // Flex direction (both web and native)
976
- "flex-row": { flexDirection: "row" },
977
- "flex-col": { flexDirection: "column" },
978
- "flex-row-reverse": { flexDirection: "row-reverse" },
979
- "flex-col-reverse": { flexDirection: "column-reverse" },
980
- // Flex wrap (both)
981
- "flex-wrap": { flexWrap: "wrap" },
982
- "flex-wrap-reverse": { flexWrap: "wrap-reverse" },
983
- "flex-nowrap": { flexWrap: "nowrap" },
984
- // Flex grow / shrink (both)
985
- "flex-grow": { flexGrow: 1 },
986
- "flex-grow-0": { flexGrow: 0 },
987
- "flex-shrink": { flexShrink: 1 },
988
- "flex-shrink-0": { flexShrink: 0 },
989
- // Align items (both)
990
- "items-start": { alignItems: "flex-start" },
991
- "items-end": { alignItems: "flex-end" },
992
- "items-center": { alignItems: "center" },
993
- "items-baseline": { alignItems: "baseline" },
994
- "items-stretch": { alignItems: "stretch" },
995
- // Justify content (both)
996
- "justify-start": { justifyContent: "flex-start" },
997
- "justify-end": { justifyContent: "flex-end" },
998
- "justify-center": { justifyContent: "center" },
999
- "justify-between": { justifyContent: "space-between" },
1000
- "justify-around": { justifyContent: "space-around" },
1001
- "justify-evenly": { justifyContent: "space-evenly" },
1002
- // Align content (both)
1003
- "content-start": { alignContent: "flex-start" },
1004
- "content-end": { alignContent: "flex-end" },
1005
- "content-center": { alignContent: "center" },
1006
- "content-between": { alignContent: "space-between" },
1007
- "content-around": { alignContent: "space-around" },
1008
- "content-evenly": { alignContent: "space-evenly" },
1009
- "content-stretch": { alignContent: "stretch" },
1010
- // Align self (both)
1011
- "self-auto": { alignSelf: "auto" },
1012
- "self-start": { alignSelf: "flex-start" },
1013
- "self-end": { alignSelf: "flex-end" },
1014
- "self-center": { alignSelf: "center" },
1015
- "self-stretch": { alignSelf: "stretch" },
1016
- "self-baseline": { alignSelf: "baseline" },
1017
- // Text align (both)
1018
- "text-left": { textAlign: "left" },
1019
- "text-right": { textAlign: "right" },
1020
- "text-center": { textAlign: "center" },
1021
- "text-justify": { textAlign: "justify" },
1022
- // Font weight shortcuts (both)
1023
- "font-thin": { fontWeight: "100" },
1024
- "font-extralight": { fontWeight: "200" },
1025
- "font-light": { fontWeight: "300" },
1026
- "font-normal": { fontWeight: "400" },
1027
- "font-medium": { fontWeight: "500" },
1028
- "font-semibold": { fontWeight: "600" },
1029
- "font-bold": { fontWeight: "700" },
1030
- "font-extrabold": { fontWeight: "800" },
1031
- "font-black": { fontWeight: "900" },
1032
- // Text decoration (overline is web-only)
1033
- underline: { textDecorationLine: "underline" },
1034
- overline: web ? { textDecorationLine: "overline" } : null,
1035
- "line-through": { textDecorationLine: "line-through" },
1036
- "no-underline": { textDecorationLine: "none" },
1037
- // Text transform (both)
1038
- uppercase: { textTransform: "uppercase" },
1039
- lowercase: { textTransform: "lowercase" },
1040
- capitalize: { textTransform: "capitalize" },
1041
- "normal-case": { textTransform: "none" },
1042
- // Font style (both)
1043
- italic: { fontStyle: "italic" },
1044
- "non-italic": { fontStyle: "normal" },
1045
- // Position (fixed/sticky/static are web-only; RN only supports relative/absolute)
1046
- relative: { position: "relative" },
1047
- absolute: { position: "absolute" },
1048
- fixed: web ? { position: "fixed" } : null,
1049
- sticky: web ? { position: "sticky" } : null,
1050
- static: web ? { position: "static" } : null,
1051
- // Visibility (no `visibility` prop on native; use opacity instead)
1052
- visible: web ? { visibility: "visible" } : null,
1053
- invisible: web ? { visibility: "hidden" } : { opacity: 0 },
1054
- // Overflow (RN supports 'hidden' | 'visible' | 'scroll'; not 'auto')
1055
- "overflow-hidden": { overflow: "hidden" },
1056
- "overflow-visible": { overflow: "visible" },
1057
- "overflow-scroll": { overflow: "scroll" },
1058
- "overflow-auto": web ? { overflow: "auto" } : { overflow: "scroll" },
1059
- // overflowX / overflowY are web-only
1060
- "overflow-x-hidden": web ? { overflowX: "hidden" } : null,
1061
- "overflow-x-scroll": web ? { overflowX: "scroll" } : null,
1062
- "overflow-x-auto": web ? { overflowX: "auto" } : null,
1063
- "overflow-y-hidden": web ? { overflowY: "hidden" } : null,
1064
- "overflow-y-scroll": web ? { overflowY: "scroll" } : null,
1065
- "overflow-y-auto": web ? { overflowY: "auto" } : null,
1066
- // Object fit (web-only; use resizeMode prop on RN Image)
1067
- "object-contain": web ? { objectFit: "contain" } : null,
1068
- "object-cover": web ? { objectFit: "cover" } : null,
1069
- "object-fill": web ? { objectFit: "fill" } : null,
1070
- "object-none": web ? { objectFit: "none" } : null,
1071
- "object-scale-down": web ? { objectFit: "scale-down" } : null,
1072
- // Border style (both)
1073
- "border-solid": { borderStyle: "solid" },
1074
- "border-dashed": { borderStyle: "dashed" },
1075
- "border-dotted": { borderStyle: "dotted" },
1076
- "border-none": { borderWidth: 0 },
1077
- // Border sides default width (both)
1078
- "border-t": { borderTopWidth: 1 },
1079
- "border-r": { borderRightWidth: 1 },
1080
- "border-b": { borderBottomWidth: 1 },
1081
- "border-l": { borderLeftWidth: 1 },
1082
- // Cursor (web-only)
1083
- "cursor-auto": web ? { cursor: "auto" } : null,
1084
- "cursor-default": web ? { cursor: "default" } : null,
1085
- "cursor-pointer": web ? { cursor: "pointer" } : null,
1086
- "cursor-wait": web ? { cursor: "wait" } : null,
1087
- "cursor-text": web ? { cursor: "text" } : null,
1088
- "cursor-move": web ? { cursor: "move" } : null,
1089
- "cursor-not-allowed": web ? { cursor: "not-allowed" } : null,
1090
- // User select (web-only)
1091
- "select-none": web ? { userSelect: "none" } : null,
1092
- "select-text": web ? { userSelect: "text" } : null,
1093
- "select-all": web ? { userSelect: "all" } : null,
1094
- "select-auto": web ? { userSelect: "auto" } : null,
1095
- // Pointer events (both)
1096
- "pointer-events-none": { pointerEvents: "none" },
1097
- "pointer-events-auto": { pointerEvents: "auto" },
1098
- // Whitespace (web-only; RN Text uses numberOfLines prop instead)
1099
- "whitespace-normal": web ? { whiteSpace: "normal" } : null,
1100
- "whitespace-nowrap": web ? { whiteSpace: "nowrap" } : null,
1101
- "whitespace-pre": web ? { whiteSpace: "pre" } : null,
1102
- "whitespace-pre-wrap": web ? { whiteSpace: "pre-wrap" } : null,
1103
- "whitespace-pre-line": web ? { whiteSpace: "pre-line" } : null,
1104
- // Word break (web-only)
1105
- "break-normal": web ? { overflowWrap: "normal", wordBreak: "normal" } : null,
1106
- "break-words": web ? { overflowWrap: "break-word" } : null,
1107
- "break-all": web ? { wordBreak: "break-all" } : null,
1108
- // Misc web-only
1109
- truncate: web ? { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } : null,
1110
- "box-border": web ? { boxSizing: "border-box" } : null,
1111
- "box-content": web ? { boxSizing: "content-box" } : null,
1112
- "appearance-none": web ? { appearance: "none" } : null,
1113
- "outline-none": web ? { outline: "none", outlineOffset: "0" } : null,
1114
- outline: web ? { outline: "2px solid transparent", outlineOffset: "2px" } : null,
1115
- resize: web ? { resize: "both" } : null,
1116
- "resize-none": web ? { resize: "none" } : null,
1117
- "resize-y": web ? { resize: "vertical" } : null,
1118
- "resize-x": web ? { resize: "horizontal" } : null,
1119
- antialiased: web ? { WebkitFontSmoothing: "antialiased", MozOsxFontSmoothing: "grayscale" } : null,
1120
- "subpixel-antialiased": web ? { WebkitFontSmoothing: "subpixel-antialiased", MozOsxFontSmoothing: "auto" } : null,
1121
- "overflow-ellipsis": web ? { textOverflow: "ellipsis" } : null,
1122
- "sr-only": web ? {
1123
- position: "absolute",
1124
- width: 1,
1125
- height: 1,
1126
- padding: 0,
1127
- margin: -1,
1128
- overflow: "hidden",
1129
- clip: "rect(0,0,0,0)",
1130
- whiteSpace: "nowrap",
1131
- border: 0
1132
- } : null,
1133
- "not-sr-only": web ? {
1134
- position: "static",
1135
- width: "auto",
1136
- height: "auto",
1137
- padding: 0,
1138
- margin: 0,
1139
- overflow: "visible",
1140
- clip: "auto",
1141
- whiteSpace: "normal"
1142
- } : null,
1143
- // Lists (web-only)
1144
- "list-none": web ? { listStyleType: "none" } : null,
1145
- "list-disc": web ? { listStyleType: "disc" } : null,
1146
- "list-decimal": web ? { listStyleType: "decimal" } : null,
1147
- // Background clip (web-only)
1148
- "bg-clip-border": web ? { backgroundClip: "border-box" } : null,
1149
- "bg-clip-padding": web ? { backgroundClip: "padding-box" } : null,
1150
- "bg-clip-content": web ? { backgroundClip: "content-box" } : null,
1151
- "bg-clip-text": web ? { backgroundClip: "text", WebkitBackgroundClip: "text" } : null,
1152
- // Background image
1153
- "bg-none": web ? { backgroundImage: "none" } : null,
1154
- // Background size (web-only)
1155
- "bg-auto": web ? { backgroundSize: "auto" } : null,
1156
- "bg-cover": web ? { backgroundSize: "cover" } : null,
1157
- "bg-contain": web ? { backgroundSize: "contain" } : null,
1158
- // Background position (web-only)
1159
- "bg-center": web ? { backgroundPosition: "center" } : null,
1160
- "bg-top": web ? { backgroundPosition: "top" } : null,
1161
- "bg-bottom": web ? { backgroundPosition: "bottom" } : null,
1162
- "bg-left": web ? { backgroundPosition: "left" } : null,
1163
- "bg-right": web ? { backgroundPosition: "right" } : null,
1164
- "bg-left-top": web ? { backgroundPosition: "left top" } : null,
1165
- "bg-left-bottom": web ? { backgroundPosition: "left bottom" } : null,
1166
- "bg-right-top": web ? { backgroundPosition: "right top" } : null,
1167
- "bg-right-bottom": web ? { backgroundPosition: "right bottom" } : null,
1168
- // Background repeat (web-only)
1169
- "bg-repeat": web ? { backgroundRepeat: "repeat" } : null,
1170
- "bg-no-repeat": web ? { backgroundRepeat: "no-repeat" } : null,
1171
- "bg-repeat-x": web ? { backgroundRepeat: "repeat-x" } : null,
1172
- "bg-repeat-y": web ? { backgroundRepeat: "repeat-y" } : null,
1173
- "bg-repeat-round": web ? { backgroundRepeat: "round" } : null,
1174
- "bg-repeat-space": web ? { backgroundRepeat: "space" } : null,
1175
- // Background attachment (web-only)
1176
- "bg-fixed": web ? { backgroundAttachment: "fixed" } : null,
1177
- "bg-local": web ? { backgroundAttachment: "local" } : null,
1178
- "bg-scroll": web ? { backgroundAttachment: "scroll" } : null,
1179
- // Object position (web-only)
1180
- "object-center": web ? { objectPosition: "center" } : null,
1181
- "object-top": web ? { objectPosition: "top" } : null,
1182
- "object-bottom": web ? { objectPosition: "bottom" } : null,
1183
- "object-left": web ? { objectPosition: "left" } : null,
1184
- "object-right": web ? { objectPosition: "right" } : null,
1185
- "object-left-top": web ? { objectPosition: "left top" } : null,
1186
- "object-left-bottom": web ? { objectPosition: "left bottom" } : null,
1187
- "object-right-top": web ? { objectPosition: "right top" } : null,
1188
- "object-right-bottom": web ? { objectPosition: "right bottom" } : null,
1189
- // Table (web-only)
1190
- table: web ? { display: "table" } : null,
1191
- "table-auto": web ? { tableLayout: "auto" } : null,
1192
- "table-fixed": web ? { tableLayout: "fixed" } : null,
1193
- "caption-top": web ? { captionSide: "top" } : null,
1194
- "caption-bottom": web ? { captionSide: "bottom" } : null,
1195
- "border-collapse": web ? { borderCollapse: "collapse" } : null,
1196
- "border-separate": web ? { borderCollapse: "separate" } : null,
1197
- // List style position (web-only)
1198
- "list-inside": web ? { listStylePosition: "inside" } : null,
1199
- "list-outside": web ? { listStylePosition: "outside" } : null,
1200
- // Font variant numeric (web-only)
1201
- "normal-nums": web ? { fontVariantNumeric: "normal" } : null,
1202
- ordinal: web ? { fontVariantNumeric: "ordinal" } : null,
1203
- "slashed-zero": web ? { fontVariantNumeric: "slashed-zero" } : null,
1204
- "lining-nums": web ? { fontVariantNumeric: "lining-nums" } : null,
1205
- "oldstyle-nums": web ? { fontVariantNumeric: "oldstyle-nums" } : null,
1206
- "proportional-nums": web ? { fontVariantNumeric: "proportional-nums" } : null,
1207
- "tabular-nums": web ? { fontVariantNumeric: "tabular-nums" } : null,
1208
- "diagonal-fractions": web ? { fontVariantNumeric: "diagonal-fractions" } : null,
1209
- "stacked-fractions": web ? { fontVariantNumeric: "stacked-fractions" } : null,
1210
- // Isolation (web-only)
1211
- isolate: web ? { isolation: "isolate" } : null,
1212
- "isolation-auto": web ? { isolation: "auto" } : null,
1213
- // Backface visibility (both iOS and Android)
1214
- "backface-visible": { backfaceVisibility: "visible" },
1215
- "backface-hidden": { backfaceVisibility: "hidden" },
1216
- // CSS filters — standalone = default/full effect (web-only)
1217
- grayscale: web ? { "--kb-grayscale": "grayscale(100%)", filter: FILTER_COMPOSE } : null,
1218
- invert: web ? { "--kb-invert": "invert(100%)", filter: FILTER_COMPOSE } : null,
1219
- sepia: web ? { "--kb-sepia": "sepia(100%)", filter: FILTER_COMPOSE } : null,
1220
- // Divide none
1221
- "divide-none": web ? { __divideX: 0, __divideY: 0 } : null,
1222
- // Group / peer markers (no-op: no style emitted; just ensures isKnownUtility returns true)
1223
- group: web ? {} : null,
1224
- peer: web ? {} : null,
1225
- // Text-wrap (web-only)
1226
- "text-wrap": web ? { textWrap: "wrap" } : null,
1227
- "text-nowrap": web ? { textWrap: "nowrap" } : null,
1228
- "text-balance": web ? { textWrap: "balance" } : null,
1229
- "text-pretty": web ? { textWrap: "pretty" } : null,
1230
- // Screen sizing — dvw/dvh (dynamic viewport units) instead of vw/vh: on mobile
1231
- // browsers, vh/vw are pinned to the LARGEST viewport size (address bar hidden),
1232
- // so `h-screen` overflows behind the address bar when it's shown. dvh/dvw track
1233
- // the actual visible viewport as browser chrome shows/hides. Desktop behavior
1234
- // is unchanged since there's no dynamic chrome to account for.
1235
- // (vw/dvw values are web-only; vh/dvh values work cross-platform via spacing scale for h-*)
1236
- "w-screen": web ? { width: "100dvw" } : null,
1237
- "min-h-screen": { minHeight: "100dvh" },
1238
- "max-h-screen": { maxHeight: "100dvh" },
1239
- "min-w-screen": web ? { minWidth: "100dvw" } : null,
1240
- "max-w-screen": web ? { maxWidth: "100dvw" } : null,
1241
- // max-w named container sizes (mirrors Tailwind's container scale)
1242
- "max-w-none": { maxWidth: "none" },
1243
- "max-w-xs": { maxWidth: 320 },
1244
- "max-w-sm": { maxWidth: 384 },
1245
- "max-w-md": { maxWidth: 448 },
1246
- "max-w-lg": { maxWidth: 512 },
1247
- "max-w-xl": { maxWidth: 576 },
1248
- "max-w-2xl": { maxWidth: 672 },
1249
- "max-w-3xl": { maxWidth: 768 },
1250
- "max-w-4xl": { maxWidth: 896 },
1251
- "max-w-5xl": { maxWidth: 1024 },
1252
- "max-w-6xl": { maxWidth: 1152 },
1253
- "max-w-7xl": { maxWidth: 1280 },
1254
- "max-w-prose": web ? { maxWidth: "65ch" } : null,
1255
- // Extended cursors (web-only)
1256
- "cursor-grab": web ? { cursor: "grab" } : null,
1257
- "cursor-grabbing": web ? { cursor: "grabbing" } : null,
1258
- "cursor-zoom-in": web ? { cursor: "zoom-in" } : null,
1259
- "cursor-zoom-out": web ? { cursor: "zoom-out" } : null,
1260
- "cursor-crosshair": web ? { cursor: "crosshair" } : null,
1261
- "cursor-help": web ? { cursor: "help" } : null,
1262
- "cursor-none": web ? { cursor: "none" } : null,
1263
- // Overflow clip (web-only)
1264
- "overflow-clip": web ? { overflow: "clip" } : null,
1265
- "overflow-x-clip": web ? { overflowX: "clip" } : null,
1266
- "overflow-y-clip": web ? { overflowY: "clip" } : null,
1267
- // Scroll behavior (web-only)
1268
- "scroll-smooth": web ? { scrollBehavior: "smooth" } : null,
1269
- "scroll-auto": web ? { scrollBehavior: "auto" } : null,
1270
- // Float (web-only)
1271
- "float-left": web ? { float: "left" } : null,
1272
- "float-right": web ? { float: "right" } : null,
1273
- "float-start": web ? { float: "inline-start" } : null,
1274
- "float-end": web ? { float: "inline-end" } : null,
1275
- "float-none": web ? { float: "none" } : null,
1276
- // Clear (web-only)
1277
- "clear-left": web ? { clear: "left" } : null,
1278
- "clear-right": web ? { clear: "right" } : null,
1279
- "clear-both": web ? { clear: "both" } : null,
1280
- "clear-start": web ? { clear: "inline-start" } : null,
1281
- "clear-end": web ? { clear: "inline-end" } : null,
1282
- "clear-none": web ? { clear: "none" } : null,
1283
- // Vertical align (web-only)
1284
- "align-baseline": web ? { verticalAlign: "baseline" } : null,
1285
- "align-top": web ? { verticalAlign: "top" } : null,
1286
- "align-middle": web ? { verticalAlign: "middle" } : null,
1287
- "align-bottom": web ? { verticalAlign: "bottom" } : null,
1288
- "align-text-top": web ? { verticalAlign: "text-top" } : null,
1289
- "align-text-bottom": web ? { verticalAlign: "text-bottom" } : null,
1290
- "align-sub": web ? { verticalAlign: "sub" } : null,
1291
- "align-super": web ? { verticalAlign: "super" } : null,
1292
- // Touch action (web-only)
1293
- "touch-auto": web ? { touchAction: "auto" } : null,
1294
- "touch-none": web ? { touchAction: "none" } : null,
1295
- "touch-pan-x": web ? { touchAction: "pan-x" } : null,
1296
- "touch-pan-y": web ? { touchAction: "pan-y" } : null,
1297
- "touch-pan-left": web ? { touchAction: "pan-left" } : null,
1298
- "touch-pan-right": web ? { touchAction: "pan-right" } : null,
1299
- "touch-pan-up": web ? { touchAction: "pan-up" } : null,
1300
- "touch-pan-down": web ? { touchAction: "pan-down" } : null,
1301
- "touch-pinch-zoom": web ? { touchAction: "pinch-zoom" } : null,
1302
- "touch-manipulation": web ? { touchAction: "manipulation" } : null
1303
- };
1304
- }
1305
- function getStandalone() {
1306
- if (!_standalone) _standalone = buildStandalone();
1307
- return _standalone;
1308
- }
1309
- function makeSpacingResolver(prop) {
1310
- return ({ value, negative, isArbitrary }, { spacing }) => {
1311
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
1312
- return v !== null ? { [prop]: v } : null;
1313
- };
1314
- }
1315
- var PADDING_MARGIN_PROPS = {
1316
- p: "padding",
1317
- px: "paddingHorizontal",
1318
- py: "paddingVertical",
1319
- pt: "paddingTop",
1320
- pr: "paddingRight",
1321
- pb: "paddingBottom",
1322
- pl: "paddingLeft",
1323
- m: "margin",
1324
- mx: "marginHorizontal",
1325
- my: "marginVertical",
1326
- mt: "marginTop",
1327
- mr: "marginRight",
1328
- mb: "marginBottom",
1329
- ml: "marginLeft"
1330
- };
1331
- function makeBorderSideResolver(widthProp, colorProp) {
1332
- return ({ value, isArbitrary }, { colors, borderWidth }) => {
1333
- if (!value) return { [widthProp]: 1 };
1334
- if (isArbitrary) {
1335
- const w2 = toNativeValue(value);
1336
- if (typeof w2 === "number") return { [widthProp]: w2 };
1337
- return { [colorProp]: value };
1338
- }
1339
- const color = resolveColor(value, colors, false);
1340
- if (color) return { [colorProp]: color };
1341
- const w = borderWidth[value];
1342
- return w !== void 0 ? { [widthProp]: w } : null;
1343
- };
1344
- }
1345
- var BORDER_SIDE_PROPS = {
1346
- "border-t": ["borderTopWidth", "borderTopColor"],
1347
- "border-r": ["borderRightWidth", "borderRightColor"],
1348
- "border-b": ["borderBottomWidth", "borderBottomColor"],
1349
- "border-l": ["borderLeftWidth", "borderLeftColor"]
1350
- };
1351
- function keyframeDeclToCSS(decl) {
1352
- return Object.entries(decl).map(([prop, val]) => `${prop.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${val}`).join("; ");
1353
- }
1354
- function buildKeyframeCSS(name, steps) {
1355
- const body = Object.entries(steps).map(([selector, decl]) => `${selector} { ${keyframeDeclToCSS(decl)} }`).join(" ");
1356
- return `@keyframes ${name} { ${body} }`;
1357
- }
1358
- var BUILTIN_ANIMATIONS = {
1359
- none: { animation: "none" },
1360
- spin: {
1361
- animation: "kb-spin 1s linear infinite",
1362
- __keyframe: "@keyframes kb-spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }"
1363
- },
1364
- ping: {
1365
- animation: "kb-ping 1s cubic-bezier(0,0,0.2,1) infinite",
1366
- __keyframe: "@keyframes kb-ping { 75%, 100% { transform: scale(2); opacity: 0 } }"
1367
- },
1368
- pulse: {
1369
- animation: "kb-pulse 2s cubic-bezier(0.4,0,0.6,1) infinite",
1370
- __keyframe: "@keyframes kb-pulse { 0%, 100% { opacity: 1 } 50% { opacity: .5 } }"
1371
- },
1372
- bounce: {
1373
- animation: "kb-bounce 1s infinite",
1374
- __keyframe: "@keyframes kb-bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8,0,1,1) } 50% { transform: none; animation-timing-function: cubic-bezier(0,0,0.2,1) } }"
1375
- }
1376
- };
1377
- function buildAnimationValue(animation, keyframes) {
1378
- const words = animation.trim().split(/\s+/);
1379
- const name = words[0];
1380
- if (!name) return { animation };
1381
- const builtin = BUILTIN_ANIMATIONS[name];
1382
- if (builtin?.__keyframe) {
1383
- const kbName = builtin.animation.split(/\s+/, 1)[0];
1384
- return { animation: [kbName, ...words.slice(1)].join(" "), __keyframe: builtin.__keyframe };
1385
- }
1386
- const steps = keyframes?.[name];
1387
- return steps ? { animation, __keyframe: buildKeyframeCSS(name, steps) } : { animation };
1388
- }
1389
- var RESOLVERS = {
1390
- // ── Background ─────────────────────────────────────────────────────────────
1391
- bg: ({ value, isArbitrary }, { colors }) => {
1392
- const color = resolveColor(value, colors, isArbitrary);
1393
- if (!color) return null;
1394
- return { backgroundColor: getEffectiveIsWeb() ? withOpacityVar(color, "--bg-opacity") : color };
1395
- },
1396
- "bg-opacity": ({ value, isArbitrary }, _) => {
1397
- if (!getEffectiveIsWeb()) return null;
1398
- const n = parseFloat(value);
1399
- if (isNaN(n)) return null;
1400
- const v = isArbitrary ? n > 1 ? n / 100 : n : n / 100;
1401
- return { "--bg-opacity": v };
1402
- },
1403
- // ── Text ───────────────────────────────────────────────────────────────────
1404
- text: ({ value, isArbitrary }, { colors, fontSize }) => {
1405
- const size = resolveFontSize(value, fontSize, false);
1406
- if (!isArbitrary && size !== null) return { fontSize: size };
1407
- if (isArbitrary) {
1408
- if (/^\d/.test(value) || /^(calc|min|max|clamp)/.test(value)) {
1409
- return { fontSize: getEffectiveIsWeb() ? value : toNativeValue(value) };
1410
- }
1411
- return { color: getEffectiveIsWeb() ? withOpacityVar(value, "--text-opacity") : value };
1412
- }
1413
- const color = resolveColor(value, colors, false);
1414
- if (!color) return null;
1415
- return { color: getEffectiveIsWeb() ? withOpacityVar(color, "--text-opacity") : color };
1416
- },
1417
- "text-opacity": ({ value, isArbitrary }, _) => {
1418
- if (!getEffectiveIsWeb()) return null;
1419
- const n = parseFloat(value);
1420
- if (isNaN(n)) return null;
1421
- const v = isArbitrary ? n > 1 ? n / 100 : n : n / 100;
1422
- return { "--text-opacity": v };
1423
- },
1424
- // ── Padding & margin ───────────────────────────────────────────────────────
1425
- // Generated below via makeSpacingResolver() — see PADDING_MARGIN_PROPS.
1426
- // ── Sizing ─────────────────────────────────────────────────────────────────
1427
- w: ({ value, isArbitrary }, { spacing }) => {
1428
- const v = resolveSizing(value, spacing, isArbitrary);
1429
- return v !== null ? { width: v } : null;
1430
- },
1431
- h: ({ value, isArbitrary }, { spacing }) => {
1432
- const v = resolveSizing(value, spacing, isArbitrary);
1433
- return v !== null ? { height: v } : null;
1434
- },
1435
- "min-w": ({ value, isArbitrary }, { spacing }) => {
1436
- const v = resolveSizing(value, spacing, isArbitrary);
1437
- return v !== null ? { minWidth: v } : null;
1438
- },
1439
- "min-h": ({ value, isArbitrary }, { spacing }) => {
1440
- const v = resolveSizing(value, spacing, isArbitrary);
1441
- return v !== null ? { minHeight: v } : null;
1442
- },
1443
- "max-w": ({ value, isArbitrary }, { spacing }) => {
1444
- const v = resolveSizing(value, spacing, isArbitrary);
1445
- return v !== null ? { maxWidth: v } : null;
1446
- },
1447
- "max-h": ({ value, isArbitrary }, { spacing }) => {
1448
- const v = resolveSizing(value, spacing, isArbitrary);
1449
- return v !== null ? { maxHeight: v } : null;
1450
- },
1451
- // ── Border width ───────────────────────────────────────────────────────────
1452
- border: ({ value, isArbitrary }, { colors, borderWidth, spacing }) => {
1453
- if (!value) return { borderWidth: borderWidth["DEFAULT"] ?? 1 };
1454
- if (isArbitrary) {
1455
- const w2 = toNativeValue(value);
1456
- if (typeof w2 === "number") return { borderWidth: w2 };
1457
- return { borderColor: value };
1458
- }
1459
- const color = resolveColor(value, colors, false);
1460
- if (color) return { borderColor: color };
1461
- const w = borderWidth[value] ?? spacing[value];
1462
- if (w !== void 0) {
1463
- const numW = typeof w === "number" ? w : parseFloat(String(w));
1464
- if (isNaN(numW)) return null;
1465
- return { borderWidth: numW };
1466
- }
1467
- return null;
1468
- },
1469
- // border-t/-r/-b/-l generated below via makeBorderSideResolver() — see BORDER_SIDE_PROPS.
1470
- // ── Border radius ──────────────────────────────────────────────────────────
1471
- rounded: ({ value, isArbitrary }, { borderRadius }) => {
1472
- const r = resolveRadius(value, borderRadius, isArbitrary);
1473
- return r !== null ? { borderRadius: r } : null;
1474
- },
1475
- "rounded-t": ({ value, isArbitrary }, { borderRadius }) => {
1476
- const r = resolveRadius(value, borderRadius, isArbitrary);
1477
- return r !== null ? { borderTopLeftRadius: r, borderTopRightRadius: r } : null;
1478
- },
1479
- "rounded-r": ({ value, isArbitrary }, { borderRadius }) => {
1480
- const r = resolveRadius(value, borderRadius, isArbitrary);
1481
- return r !== null ? { borderTopRightRadius: r, borderBottomRightRadius: r } : null;
1482
- },
1483
- "rounded-b": ({ value, isArbitrary }, { borderRadius }) => {
1484
- const r = resolveRadius(value, borderRadius, isArbitrary);
1485
- return r !== null ? { borderBottomLeftRadius: r, borderBottomRightRadius: r } : null;
1486
- },
1487
- "rounded-l": ({ value, isArbitrary }, { borderRadius }) => {
1488
- const r = resolveRadius(value, borderRadius, isArbitrary);
1489
- return r !== null ? { borderTopLeftRadius: r, borderBottomLeftRadius: r } : null;
1490
- },
1491
- "rounded-tl": ({ value, isArbitrary }, { borderRadius }) => {
1492
- const r = resolveRadius(value, borderRadius, isArbitrary);
1493
- return r !== null ? { borderTopLeftRadius: r } : null;
1494
- },
1495
- "rounded-tr": ({ value, isArbitrary }, { borderRadius }) => {
1496
- const r = resolveRadius(value, borderRadius, isArbitrary);
1497
- return r !== null ? { borderTopRightRadius: r } : null;
1498
- },
1499
- "rounded-bl": ({ value, isArbitrary }, { borderRadius }) => {
1500
- const r = resolveRadius(value, borderRadius, isArbitrary);
1501
- return r !== null ? { borderBottomLeftRadius: r } : null;
1502
- },
1503
- "rounded-br": ({ value, isArbitrary }, { borderRadius }) => {
1504
- const r = resolveRadius(value, borderRadius, isArbitrary);
1505
- return r !== null ? { borderBottomRightRadius: r } : null;
1506
- },
1507
- // ── Grid (responsive column count: grid-1 … grid-12, or arbitrary) ───────
1508
- grid: ({ value, isArbitrary }) => {
1509
- if (!value) return null;
1510
- if (isArbitrary) return { display: "grid", gridTemplateColumns: value };
1511
- const n = parseInt(value, 10);
1512
- if (isNaN(n) || n < 1 || n > 12) return null;
1513
- return { display: "grid", gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` };
1514
- },
1515
- // ── Grid template columns/rows (Tailwind-style aliases, web-only) ──────────
1516
- "grid-cols": ({ value, isArbitrary }) => {
1517
- if (!getEffectiveIsWeb()) return null;
1518
- if (!value) return null;
1519
- if (isArbitrary) return { display: "grid", gridTemplateColumns: value };
1520
- if (value === "none") return { display: "grid", gridTemplateColumns: "none" };
1521
- const n = parseInt(value, 10);
1522
- if (isNaN(n) || n < 1 || n > 12) return null;
1523
- return { display: "grid", gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` };
1524
- },
1525
- "grid-rows": ({ value, isArbitrary }) => {
1526
- if (!getEffectiveIsWeb()) return null;
1527
- if (!value) return null;
1528
- if (isArbitrary) return { gridTemplateRows: value };
1529
- if (value === "none") return { gridTemplateRows: "none" };
1530
- const n = parseInt(value, 10);
1531
- if (isNaN(n) || n < 1) return null;
1532
- return { gridTemplateRows: `repeat(${n}, minmax(0, 1fr))` };
1533
- },
1534
- // ── Grid auto flow (web-only) ─────────────────────────────────────────────
1535
- "grid-flow": ({ value }) => {
1536
- if (!getEffectiveIsWeb()) return null;
1537
- const flows = {
1538
- row: "row",
1539
- col: "column",
1540
- dense: "dense",
1541
- "row-dense": "row dense",
1542
- "col-dense": "column dense"
1543
- };
1544
- const flow = flows[value];
1545
- return flow ? { gridAutoFlow: flow } : null;
1546
- },
1547
- // ── Grid auto sizing (web-only) ───────────────────────────────────────────
1548
- "auto-cols": ({ value, isArbitrary }) => {
1549
- if (!getEffectiveIsWeb()) return null;
1550
- if (isArbitrary) return { gridAutoColumns: value };
1551
- const presets = {
1552
- auto: "auto",
1553
- min: "min-content",
1554
- max: "max-content",
1555
- fr: "minmax(0, 1fr)"
1556
- };
1557
- const v = presets[value];
1558
- return v ? { gridAutoColumns: v } : null;
1559
- },
1560
- "auto-rows": ({ value, isArbitrary }) => {
1561
- if (!getEffectiveIsWeb()) return null;
1562
- if (isArbitrary) return { gridAutoRows: value };
1563
- const presets = {
1564
- auto: "auto",
1565
- min: "min-content",
1566
- max: "max-content",
1567
- fr: "minmax(0, 1fr)"
1568
- };
1569
- const v = presets[value];
1570
- return v ? { gridAutoRows: v } : null;
1571
- },
1572
- // ── Grid column placement (web-only) ──────────────────────────────────────
1573
- "col-span": ({ value }) => {
1574
- if (!getEffectiveIsWeb()) return null;
1575
- if (value === "full") return { gridColumn: "1 / -1" };
1576
- const n = parseInt(value, 10);
1577
- return isNaN(n) ? null : { gridColumn: `span ${n} / span ${n}` };
1578
- },
1579
- "col-start": ({ value, isArbitrary }) => {
1580
- if (!getEffectiveIsWeb()) return null;
1581
- if (value === "auto") return { gridColumnStart: "auto" };
1582
- if (isArbitrary) return { gridColumnStart: value };
1583
- const n = parseInt(value, 10);
1584
- return isNaN(n) ? null : { gridColumnStart: n };
1585
- },
1586
- "col-end": ({ value, isArbitrary }) => {
1587
- if (!getEffectiveIsWeb()) return null;
1588
- if (value === "auto") return { gridColumnEnd: "auto" };
1589
- if (isArbitrary) return { gridColumnEnd: value };
1590
- const n = parseInt(value, 10);
1591
- return isNaN(n) ? null : { gridColumnEnd: n };
1592
- },
1593
- col: ({ value, isArbitrary }) => {
1594
- if (!getEffectiveIsWeb()) return null;
1595
- if (!value || value === "auto") return { gridColumn: "auto" };
1596
- if (isArbitrary) return { gridColumn: value };
1597
- return null;
1598
- },
1599
- // ── Grid row placement (web-only) ─────────────────────────────────────────
1600
- "row-span": ({ value }) => {
1601
- if (!getEffectiveIsWeb()) return null;
1602
- if (value === "full") return { gridRow: "1 / -1" };
1603
- const n = parseInt(value, 10);
1604
- return isNaN(n) ? null : { gridRow: `span ${n} / span ${n}` };
1605
- },
1606
- "row-start": ({ value, isArbitrary }) => {
1607
- if (!getEffectiveIsWeb()) return null;
1608
- if (value === "auto") return { gridRowStart: "auto" };
1609
- if (isArbitrary) return { gridRowStart: value };
1610
- const n = parseInt(value, 10);
1611
- return isNaN(n) ? null : { gridRowStart: n };
1612
- },
1613
- "row-end": ({ value, isArbitrary }) => {
1614
- if (!getEffectiveIsWeb()) return null;
1615
- if (value === "auto") return { gridRowEnd: "auto" };
1616
- if (isArbitrary) return { gridRowEnd: value };
1617
- const n = parseInt(value, 10);
1618
- return isNaN(n) ? null : { gridRowEnd: n };
1619
- },
1620
- row: ({ value, isArbitrary }) => {
1621
- if (!getEffectiveIsWeb()) return null;
1622
- if (!value || value === "auto") return { gridRow: "auto" };
1623
- if (isArbitrary) return { gridRow: value };
1624
- return null;
1625
- },
1626
- // ── Grid alignment (web-only) ──────────────────────────────────────────────
1627
- // place-items is shorthand for align-items + justify-items on a grid container
1628
- "place-items": ({ value }) => {
1629
- if (!getEffectiveIsWeb()) return null;
1630
- const map = {
1631
- start: "start",
1632
- end: "end",
1633
- center: "center",
1634
- stretch: "stretch",
1635
- baseline: "baseline"
1636
- };
1637
- return map[value] ? { placeItems: map[value] } : null;
1638
- },
1639
- // place-content is shorthand for align-content + justify-content on a grid container
1640
- "place-content": ({ value }) => {
1641
- if (!getEffectiveIsWeb()) return null;
1642
- const map = {
1643
- start: "start",
1644
- end: "end",
1645
- center: "center",
1646
- stretch: "stretch",
1647
- between: "space-between",
1648
- around: "space-around",
1649
- evenly: "space-evenly",
1650
- baseline: "baseline"
1651
- };
1652
- return map[value] ? { placeContent: map[value] } : null;
1653
- },
1654
- // justify-items controls inline-axis alignment of grid items within their cells
1655
- "justify-items": ({ value }) => {
1656
- if (!getEffectiveIsWeb()) return null;
1657
- const map = {
1658
- start: "start",
1659
- end: "end",
1660
- center: "center",
1661
- stretch: "stretch"
1662
- };
1663
- return map[value] ? { justifyItems: map[value] } : null;
1664
- },
1665
- // place-self is shorthand for align-self + justify-self on a grid item
1666
- "place-self": ({ value }) => {
1667
- if (!getEffectiveIsWeb()) return null;
1668
- const map = {
1669
- auto: "auto",
1670
- start: "start",
1671
- end: "end",
1672
- center: "center",
1673
- stretch: "stretch"
1674
- };
1675
- return map[value] ? { placeSelf: map[value] } : null;
1676
- },
1677
- // justify-self controls inline-axis self-alignment of a grid item
1678
- "justify-self": ({ value }) => {
1679
- if (!getEffectiveIsWeb()) return null;
1680
- const map = {
1681
- auto: "auto",
1682
- start: "start",
1683
- end: "end",
1684
- center: "center",
1685
- stretch: "stretch"
1686
- };
1687
- return map[value] ? { justifySelf: map[value] } : null;
1688
- },
1689
- // ── CSS Filters (composable via CSS variables, web-only) ─────────────────
1690
- blur: ({ value, isArbitrary }) => {
1691
- if (!getEffectiveIsWeb()) return null;
1692
- const sizes = {
1693
- "": "blur(8px)",
1694
- sm: "blur(4px)",
1695
- md: "blur(12px)",
1696
- lg: "blur(16px)",
1697
- xl: "blur(24px)",
1698
- "2xl": "blur(40px)",
1699
- "3xl": "blur(64px)"
1700
- };
1701
- if (value === "none") return { "--kb-blur": "", filter: FILTER_COMPOSE };
1702
- const v = isArbitrary ? `blur(${value})` : sizes[value];
1703
- return v !== void 0 ? { "--kb-blur": v, filter: FILTER_COMPOSE } : null;
1704
- },
1705
- brightness: ({ value, isArbitrary }) => {
1706
- if (!getEffectiveIsWeb()) return null;
1707
- const v = isArbitrary ? `brightness(${value})` : `brightness(${parseFloat(value) / 100})`;
1708
- return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-brightness": v, filter: FILTER_COMPOSE };
1709
- },
1710
- contrast: ({ value, isArbitrary }) => {
1711
- if (!getEffectiveIsWeb()) return null;
1712
- const v = isArbitrary ? `contrast(${value})` : `contrast(${parseFloat(value) / 100})`;
1713
- return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-contrast": v, filter: FILTER_COMPOSE };
1714
- },
1715
- grayscale: ({ value }) => {
1716
- if (!getEffectiveIsWeb()) return null;
1717
- const v = value === "0" ? "grayscale(0)" : "grayscale(100%)";
1718
- return { "--kb-grayscale": v, filter: FILTER_COMPOSE };
1719
- },
1720
- "hue-rotate": ({ value, negative, isArbitrary }) => {
1721
- if (!getEffectiveIsWeb()) return null;
1722
- const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
1723
- if (isNaN(parseFloat(deg)) && !isArbitrary) return null;
1724
- return { "--kb-hue-rotate": `hue-rotate(${deg})`, filter: FILTER_COMPOSE };
1725
- },
1726
- invert: ({ value }) => {
1727
- if (!getEffectiveIsWeb()) return null;
1728
- const v = value === "0" ? "invert(0)" : "invert(100%)";
1729
- return { "--kb-invert": v, filter: FILTER_COMPOSE };
1730
- },
1731
- saturate: ({ value, isArbitrary }) => {
1732
- if (!getEffectiveIsWeb()) return null;
1733
- const v = isArbitrary ? `saturate(${value})` : `saturate(${parseFloat(value) / 100})`;
1734
- return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-saturate": v, filter: FILTER_COMPOSE };
1735
- },
1736
- sepia: ({ value }) => {
1737
- if (!getEffectiveIsWeb()) return null;
1738
- const v = value === "0" ? "sepia(0)" : "sepia(100%)";
1739
- return { "--kb-sepia": v, filter: FILTER_COMPOSE };
1740
- },
1741
- "drop-shadow": ({ value, isArbitrary }) => {
1742
- if (!getEffectiveIsWeb()) return null;
1743
- if (isArbitrary) return { "--kb-drop-shadow": `drop-shadow(${value.replace(/_/g, " ")})`, filter: FILTER_COMPOSE };
1744
- const presets = {
1745
- "": "drop-shadow(0 1px 2px rgb(0 0 0/0.1)) drop-shadow(0 1px 1px rgb(0 0 0/0.06))",
1746
- sm: "drop-shadow(0 1px 1px rgb(0 0 0/0.05))",
1747
- md: "drop-shadow(0 4px 3px rgb(0 0 0/0.07)) drop-shadow(0 2px 2px rgb(0 0 0/0.06))",
1748
- lg: "drop-shadow(0 10px 8px rgb(0 0 0/0.04)) drop-shadow(0 4px 3px rgb(0 0 0/0.1))",
1749
- xl: "drop-shadow(0 20px 13px rgb(0 0 0/0.03)) drop-shadow(0 8px 5px rgb(0 0 0/0.08))",
1750
- "2xl": "drop-shadow(0 25px 25px rgb(0 0 0/0.15))",
1751
- none: "drop-shadow(0 0 #0000)"
1752
- };
1753
- const v = presets[value];
1754
- return v !== void 0 ? { "--kb-drop-shadow": v, filter: FILTER_COMPOSE } : null;
1755
- },
1756
- // Arbitrary full filter string: filter-[blur(4px)_grayscale(1)]
1757
- filter: ({ value, isArbitrary }) => {
1758
- if (!getEffectiveIsWeb()) return null;
1759
- if (isArbitrary) return { filter: value.replace(/_/g, " ") };
1760
- if (value === "none") return { filter: "none" };
1761
- return null;
1762
- },
1763
- // ── Backdrop Filters (composable via CSS variables, web-only) ────────────
1764
- "backdrop-blur": ({ value, isArbitrary }) => {
1765
- if (!getEffectiveIsWeb()) return null;
1766
- const sizes = {
1767
- "": "blur(8px)",
1768
- sm: "blur(4px)",
1769
- md: "blur(12px)",
1770
- lg: "blur(16px)",
1771
- xl: "blur(24px)",
1772
- "2xl": "blur(40px)",
1773
- "3xl": "blur(64px)"
1774
- };
1775
- if (value === "none") return { "--kb-backdrop-blur": "", backdropFilter: BACKDROP_FILTER_COMPOSE };
1776
- const v = isArbitrary ? `blur(${value})` : sizes[value];
1777
- return v !== void 0 ? { "--kb-backdrop-blur": v, backdropFilter: BACKDROP_FILTER_COMPOSE } : null;
1778
- },
1779
- "backdrop-brightness": ({ value, isArbitrary }) => {
1780
- if (!getEffectiveIsWeb()) return null;
1781
- const v = isArbitrary ? `brightness(${value})` : `brightness(${parseFloat(value) / 100})`;
1782
- return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-brightness": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
1783
- },
1784
- "backdrop-contrast": ({ value, isArbitrary }) => {
1785
- if (!getEffectiveIsWeb()) return null;
1786
- const v = isArbitrary ? `contrast(${value})` : `contrast(${parseFloat(value) / 100})`;
1787
- return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-contrast": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
1788
- },
1789
- "backdrop-grayscale": ({ value }) => {
1790
- if (!getEffectiveIsWeb()) return null;
1791
- return { "--kb-backdrop-grayscale": value === "0" ? "grayscale(0)" : "grayscale(100%)", backdropFilter: BACKDROP_FILTER_COMPOSE };
1792
- },
1793
- "backdrop-hue-rotate": ({ value, negative, isArbitrary }) => {
1794
- if (!getEffectiveIsWeb()) return null;
1795
- const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
1796
- if (isNaN(parseFloat(deg)) && !isArbitrary) return null;
1797
- return { "--kb-backdrop-hue-rotate": `hue-rotate(${deg})`, backdropFilter: BACKDROP_FILTER_COMPOSE };
1798
- },
1799
- "backdrop-invert": ({ value }) => {
1800
- if (!getEffectiveIsWeb()) return null;
1801
- return { "--kb-backdrop-invert": value === "0" ? "invert(0)" : "invert(100%)", backdropFilter: BACKDROP_FILTER_COMPOSE };
1802
- },
1803
- "backdrop-opacity": ({ value, isArbitrary }) => {
1804
- if (!getEffectiveIsWeb()) return null;
1805
- const v = isArbitrary ? `opacity(${value})` : `opacity(${parseFloat(value) / 100})`;
1806
- return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-opacity": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
1807
- },
1808
- "backdrop-saturate": ({ value, isArbitrary }) => {
1809
- if (!getEffectiveIsWeb()) return null;
1810
- const v = isArbitrary ? `saturate(${value})` : `saturate(${parseFloat(value) / 100})`;
1811
- return isNaN(parseFloat(value)) && !isArbitrary ? null : { "--kb-backdrop-saturate": v, backdropFilter: BACKDROP_FILTER_COMPOSE };
1812
- },
1813
- "backdrop-sepia": ({ value }) => {
1814
- if (!getEffectiveIsWeb()) return null;
1815
- return { "--kb-backdrop-sepia": value === "0" ? "sepia(0)" : "sepia(100%)", backdropFilter: BACKDROP_FILTER_COMPOSE };
1816
- },
1817
- "backdrop-filter": ({ value, isArbitrary }) => {
1818
- if (!getEffectiveIsWeb()) return null;
1819
- if (isArbitrary) return { backdropFilter: value.replace(/_/g, " ") };
1820
- if (value === "none") return { backdropFilter: "none" };
1821
- return null;
1822
- },
1823
- // ── Background gradient (CSS variable gradient stops, web-only) ──────────
1824
- "bg-gradient-to": ({ value }) => {
1825
- if (!getEffectiveIsWeb()) return null;
1826
- const directions = {
1827
- t: "to top",
1828
- tr: "to top right",
1829
- r: "to right",
1830
- br: "to bottom right",
1831
- b: "to bottom",
1832
- bl: "to bottom left",
1833
- l: "to left",
1834
- tl: "to top left"
1835
- };
1836
- const dir = directions[value];
1837
- if (!dir) return null;
1838
- return {
1839
- backgroundImage: `linear-gradient(${dir}, var(--kb-gradient-from, transparent), var(--kb-gradient-stops, transparent))`
1840
- };
1841
- },
1842
- from: ({ value, isArbitrary }, { colors }) => {
1843
- if (!getEffectiveIsWeb()) return null;
1844
- const color = resolveColor(value, colors, isArbitrary);
1845
- if (!color) return null;
1846
- return {
1847
- "--kb-gradient-from": color,
1848
- "--kb-gradient-stops": `var(--kb-gradient-from), var(--kb-gradient-to, transparent)`
1849
- };
1850
- },
1851
- via: ({ value, isArbitrary }, { colors }) => {
1852
- if (!getEffectiveIsWeb()) return null;
1853
- const color = resolveColor(value, colors, isArbitrary);
1854
- if (!color) return null;
1855
- return {
1856
- "--kb-gradient-via": color,
1857
- "--kb-gradient-stops": `var(--kb-gradient-from), var(--kb-gradient-via), var(--kb-gradient-to, transparent)`
1858
- };
1859
- },
1860
- to: ({ value, isArbitrary }, { colors }) => {
1861
- if (!getEffectiveIsWeb()) return null;
1862
- const color = resolveColor(value, colors, isArbitrary);
1863
- if (!color) return null;
1864
- return { "--kb-gradient-to": color };
1865
- },
1866
- // ── Transform extras (web-only) ───────────────────────────────────────────
1867
- "skew-x": ({ value, negative, isArbitrary }) => {
1868
- const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
1869
- if (!isArbitrary && isNaN(parseFloat(value))) return null;
1870
- return getEffectiveIsWeb() ? { transform: `skewX(${deg})` } : { transform: [{ skewX: deg }] };
1871
- },
1872
- "skew-y": ({ value, negative, isArbitrary }) => {
1873
- const deg = isArbitrary ? value : `${(negative ? -1 : 1) * parseFloat(value)}deg`;
1874
- if (!isArbitrary && isNaN(parseFloat(value))) return null;
1875
- return getEffectiveIsWeb() ? { transform: `skewY(${deg})` } : { transform: [{ skewY: deg }] };
1876
- },
1877
- // Arbitrary full transform string: transform-[rotate(45deg)_scale(1.5)]
1878
- transform: ({ value, isArbitrary }) => {
1879
- if (!getEffectiveIsWeb()) return null;
1880
- if (isArbitrary) return { transform: value.replace(/_/g, " ") };
1881
- if (value === "none") return { transform: "none" };
1882
- return null;
1883
- },
1884
- // Transform origin
1885
- origin: ({ value, isArbitrary }) => {
1886
- if (!getEffectiveIsWeb()) return null;
1887
- if (isArbitrary) return { transformOrigin: value.replace(/_/g, " ") };
1888
- const origins = {
1889
- center: "center",
1890
- top: "top",
1891
- "top-right": "top right",
1892
- right: "right",
1893
- "bottom-right": "bottom right",
1894
- bottom: "bottom",
1895
- "bottom-left": "bottom left",
1896
- left: "left",
1897
- "top-left": "top left"
1898
- };
1899
- return origins[value] ? { transformOrigin: origins[value] } : null;
1900
- },
1901
- // ── Text decoration advanced (web-only) ───────────────────────────────────
1902
- decoration: ({ value, isArbitrary }, { colors }) => {
1903
- if (!getEffectiveIsWeb()) return null;
1904
- if (isArbitrary) {
1905
- if (/^\d/.test(value) || value.startsWith("calc(")) return { textDecorationThickness: value };
1906
- return { textDecorationColor: value };
1907
- }
1908
- const thickTokens = {
1909
- auto: "auto",
1910
- "from-font": "from-font",
1911
- "0": "0px",
1912
- "1": "1px",
1913
- "2": "2px",
1914
- "4": "4px",
1915
- "8": "8px"
1916
- };
1917
- if (value in thickTokens) return { textDecorationThickness: thickTokens[value] };
1918
- const styleTokens = {
1919
- solid: "solid",
1920
- dashed: "dashed",
1921
- dotted: "dotted",
1922
- double: "double",
1923
- wavy: "wavy"
1924
- };
1925
- if (value in styleTokens) return { textDecorationStyle: styleTokens[value] };
1926
- const color = resolveColor(value, colors, false);
1927
- return color ? { textDecorationColor: color } : null;
1928
- },
1929
- "underline-offset": ({ value, isArbitrary }) => {
1930
- if (!getEffectiveIsWeb()) return null;
1931
- if (isArbitrary) return { textUnderlineOffset: value };
1932
- const offsets = {
1933
- auto: "auto",
1934
- "0": "0px",
1935
- "1": "1px",
1936
- "2": "2px",
1937
- "4": "4px",
1938
- "8": "8px"
1939
- };
1940
- return offsets[value] ? { textUnderlineOffset: offsets[value] } : null;
1941
- },
1942
- // ── Content (web-only — for before:/after: pseudo-elements, which don't exist on native) ──
1943
- // Arbitrary value carries its own quotes from the bracket syntax (content-['*'] parses to
1944
- // the literal string 'you can see it' quotes included), so it passes straight through as a
1945
- // valid `content: '*'` CSS value with no extra wrapping needed.
1946
- content: ({ value, isArbitrary }) => {
1947
- if (!getEffectiveIsWeb()) return null;
1948
- if (isArbitrary) return { content: value };
1949
- const presets = { none: "none" };
1950
- return value in presets ? { content: presets[value] } : null;
1951
- },
1952
- // ── Arbitrary CSS property (web-only): [property:value] with no utility prefix ──
1953
- // e.g. [mask-type:luminance], [--my-var:10px]. parser.ts already isolates this case
1954
- // as utility: '' — it's ALSO how a stray, prefix-less negative bracket ("-[10px]",
1955
- // presumably a typo) parses, which is why this only fires when the arbitrary value
1956
- // itself contains a "property:value" pair; anything else (no colon) still resolves
1957
- // to null exactly as before this resolver existed, rather than guessing a property.
1958
- //
1959
- // Only the FIRST colon splits property from value — the value itself may contain
1960
- // more colons (a URL's "http://…") and must stay intact: [background:url(http://x/a.png)].
1961
- // camelToKebab() in resolver.ts is a no-op on an already-kebab-case (or "--"-prefixed
1962
- // custom property) key, so it can be used as the style object key as-written with no
1963
- // extra case conversion — it only needs to look like a plausible CSS property name.
1964
- "": ({ value, isArbitrary, negative }) => {
1965
- if (!getEffectiveIsWeb() || !isArbitrary || !value) return null;
1966
- if (negative) return null;
1967
- const colonIdx = value.indexOf(":");
1968
- if (colonIdx <= 0) return null;
1969
- const prop = value.slice(0, colonIdx).trim();
1970
- const cssValue = value.slice(colonIdx + 1).trim();
1971
- if (!cssValue || !/^(--[\w-]+|[a-zA-Z-]+)$/.test(prop)) return null;
1972
- return { [prop]: cssValue };
1973
- },
1974
- // ── Outline extended (web-only) ───────────────────────────────────────────
1975
- outline: ({ value, isArbitrary }, { colors }) => {
1976
- if (!getEffectiveIsWeb()) return null;
1977
- if (!value) return { outline: "2px solid transparent", outlineOffset: "2px" };
1978
- if (value === "none") return { outline: "none", outlineOffset: "0" };
1979
- if (isArbitrary) {
1980
- if (/^\d/.test(value) || value.startsWith("calc(")) return { outlineWidth: value };
1981
- return { outlineColor: value };
1982
- }
1983
- const widths = { "0": "0px", "1": "1px", "2": "2px", "4": "4px", "8": "8px" };
1984
- if (value in widths) return { outlineWidth: widths[value] };
1985
- const color = resolveColor(value, colors, false);
1986
- return color ? { outlineColor: color } : null;
1987
- },
1988
- "outline-offset": ({ value, isArbitrary }) => {
1989
- if (!getEffectiveIsWeb()) return null;
1990
- if (isArbitrary) return { outlineOffset: value };
1991
- const offsets = { "0": "0px", "1": "1px", "2": "2px", "4": "4px", "8": "8px" };
1992
- return offsets[value] ? { outlineOffset: offsets[value] } : null;
1993
- },
1994
- // ── Columns (web-only) ─────────────────────────────────────────────────────
1995
- columns: ({ value, isArbitrary }) => {
1996
- if (!getEffectiveIsWeb()) return null;
1997
- if (isArbitrary) return { columnCount: value };
1998
- if (value === "auto") return { columnCount: "auto" };
1999
- const n = parseInt(value, 10);
2000
- if (!isNaN(n)) return { columnCount: n };
2001
- const widths = {
2002
- "3xs": "16rem",
2003
- "2xs": "18rem",
2004
- xs: "20rem",
2005
- sm: "24rem",
2006
- md: "28rem",
2007
- lg: "32rem",
2008
- xl: "36rem",
2009
- "2xl": "42rem",
2010
- "3xl": "48rem",
2011
- "4xl": "56rem",
2012
- "5xl": "64rem",
2013
- "6xl": "72rem",
2014
- "7xl": "80rem"
2015
- };
2016
- return widths[value] ? { columnWidth: widths[value] } : null;
2017
- },
2018
- // ── Mix / background blend mode (web-only) ───────────────────────────────
2019
- "mix-blend": ({ value }) => {
2020
- if (!getEffectiveIsWeb()) return null;
2021
- const modes = [
2022
- "normal",
2023
- "multiply",
2024
- "screen",
2025
- "overlay",
2026
- "darken",
2027
- "lighten",
2028
- "color-dodge",
2029
- "color-burn",
2030
- "hard-light",
2031
- "soft-light",
2032
- "difference",
2033
- "exclusion",
2034
- "hue",
2035
- "saturation",
2036
- "color",
2037
- "luminosity",
2038
- "plus-lighter"
2039
- ];
2040
- return modes.includes(value) ? { mixBlendMode: value } : null;
2041
- },
2042
- "bg-blend": ({ value }) => {
2043
- if (!getEffectiveIsWeb()) return null;
2044
- const modes = [
2045
- "normal",
2046
- "multiply",
2047
- "screen",
2048
- "overlay",
2049
- "darken",
2050
- "lighten",
2051
- "color-dodge",
2052
- "color-burn",
2053
- "hard-light",
2054
- "soft-light",
2055
- "difference",
2056
- "exclusion",
2057
- "hue",
2058
- "saturation",
2059
- "color",
2060
- "luminosity"
2061
- ];
2062
- return modes.includes(value) ? { backgroundBlendMode: value } : null;
2063
- },
2064
- // ── Will-change (web-only) ─────────────────────────────────────────────────
2065
- "will-change": ({ value, isArbitrary }) => {
2066
- if (!getEffectiveIsWeb()) return null;
2067
- if (isArbitrary) return { willChange: value.replace(/_/g, ", ") };
2068
- const presets = {
2069
- auto: "auto",
2070
- scroll: "scroll-position",
2071
- contents: "contents",
2072
- transform: "transform"
2073
- };
2074
- return presets[value] ? { willChange: presets[value] } : null;
2075
- },
2076
- // ── Divide (child combinator CSS, web-only) ───────────────────────────────
2077
- // These return special __divide* markers that resolver.ts converts to
2078
- // .cls > * + * { border-... } CSS rules. No inline style is applied.
2079
- "divide-x": ({ value, isArbitrary }) => {
2080
- if (!getEffectiveIsWeb()) return null;
2081
- if (value === "reverse") return null;
2082
- if (!value) return { __divideX: 1 };
2083
- const n = parseFloat(value);
2084
- return isNaN(n) ? null : { __divideX: n };
2085
- },
2086
- "divide-y": ({ value, isArbitrary }) => {
2087
- if (!getEffectiveIsWeb()) return null;
2088
- if (value === "reverse") return null;
2089
- if (!value) return { __divideY: 1 };
2090
- const n = parseFloat(value);
2091
- return isNaN(n) ? null : { __divideY: n };
2092
- },
2093
- divide: ({ value, isArbitrary }, { colors }) => {
2094
- if (!getEffectiveIsWeb()) return null;
2095
- if (isArbitrary) return { __divideColor: value };
2096
- const styleTokens = {
2097
- solid: "solid",
2098
- dashed: "dashed",
2099
- dotted: "dotted",
2100
- double: "double",
2101
- none: "none"
2102
- };
2103
- if (value in styleTokens) return { __divideStyle: styleTokens[value] };
2104
- const color = resolveColor(value, colors, false);
2105
- return color ? { __divideColor: color } : null;
2106
- },
2107
- // ── Text shadow (cross-platform: iOS, Android, web) ─────────────────────
2108
- // Named presets give cross-platform shadow; arbitrary is web-only.
2109
- "text-shadow": ({ value, isArbitrary }, { colors }) => {
2110
- if (value === "none") {
2111
- return getEffectiveIsWeb() ? { textShadow: "none" } : { textShadowColor: "transparent", textShadowOffset: { width: 0, height: 0 }, textShadowRadius: 0 };
2112
- }
2113
- const webPresets = {
2114
- "": "0 2px 4px rgba(0,0,0,0.3)",
2115
- sm: "0 1px 2px rgba(0,0,0,0.3)",
2116
- md: "0 4px 6px rgba(0,0,0,0.3)",
2117
- lg: "0 8px 16px rgba(0,0,0,0.5)",
2118
- xl: "0 16px 32px rgba(0,0,0,0.5)"
2119
- };
2120
- const nativePresets = {
2121
- "": { textShadowColor: "rgba(0,0,0,0.3)", textShadowOffset: { width: 0, height: 2 }, textShadowRadius: 4 },
2122
- sm: { textShadowColor: "rgba(0,0,0,0.3)", textShadowOffset: { width: 0, height: 1 }, textShadowRadius: 2 },
2123
- md: { textShadowColor: "rgba(0,0,0,0.3)", textShadowOffset: { width: 0, height: 4 }, textShadowRadius: 6 },
2124
- lg: { textShadowColor: "rgba(0,0,0,0.5)", textShadowOffset: { width: 0, height: 8 }, textShadowRadius: 16 },
2125
- xl: { textShadowColor: "rgba(0,0,0,0.5)", textShadowOffset: { width: 0, height: 16 }, textShadowRadius: 32 }
2126
- };
2127
- if (value in webPresets) {
2128
- if (getEffectiveIsWeb()) return { textShadow: webPresets[value] };
2129
- return nativePresets[value] ?? null;
2130
- }
2131
- if (isArbitrary) {
2132
- return getEffectiveIsWeb() ? { textShadow: value.replace(/_/g, " ") } : null;
2133
- }
2134
- const color = resolveColor(value, colors, false);
2135
- if (color) {
2136
- return getEffectiveIsWeb() ? { textShadow: `0 2px 4px ${color}` } : { textShadowColor: color };
2137
- }
2138
- return null;
2139
- },
2140
- // ── Perspective transform (cross-platform: iOS, Android, web) ────────────
2141
- perspective: ({ value, isArbitrary }) => {
2142
- if (isArbitrary) {
2143
- const numPx = parseFloat(value);
2144
- if (getEffectiveIsWeb()) return { transform: `perspective(${value})` };
2145
- return isNaN(numPx) ? null : { transform: [{ perspective: numPx }] };
2146
- }
2147
- if (value === "none") return getEffectiveIsWeb() ? { transform: "none" } : null;
2148
- const n = parseFloat(value);
2149
- if (isNaN(n)) return null;
2150
- return getEffectiveIsWeb() ? { transform: `perspective(${n}px)` } : { transform: [{ perspective: n }] };
2151
- },
2152
- // ── Tint color (native-only, for Image and icon components) ──────────────
2153
- tint: ({ value, isArbitrary }, { colors }) => {
2154
- if (getEffectiveIsWeb()) return null;
2155
- const color = resolveColor(value, colors, isArbitrary);
2156
- return color ? { tintColor: color } : null;
2157
- },
2158
- // ── Size shorthand (sets width AND height in one utility) ────────────────
2159
- size: ({ value, isArbitrary }, { spacing }) => {
2160
- const v = resolveSizing(value, spacing, isArbitrary);
2161
- return v !== null ? { width: v, height: v } : null;
2162
- },
2163
- // ── Animations (CSS keyframe animations, web-only) ────────────────────────
2164
- // Each variant injects a @keyframes rule once via the __keyframe marker.
2165
- // resolver.ts detects __keyframe, injects the rule, then strips the marker
2166
- // so it never reaches element inline styles.
2167
- animate: ({ value, isArbitrary }, theme) => {
2168
- if (!getEffectiveIsWeb()) return null;
2169
- if (isArbitrary) return buildAnimationValue(value.replace(/_/g, " "), theme.keyframes);
2170
- if (value in BUILTIN_ANIMATIONS) return BUILTIN_ANIMATIONS[value];
2171
- const custom = theme.animation?.[value];
2172
- return custom ? buildAnimationValue(custom, theme.keyframes) : null;
2173
- },
2174
- // ── Line-clamp (web-only) ─────────────────────────────────────────────────
2175
- "line-clamp": ({ value }) => {
2176
- if (!getEffectiveIsWeb()) return null;
2177
- if (value === "none") return { overflow: "visible", display: "block", WebkitLineClamp: "unset" };
2178
- const n = parseInt(value, 10);
2179
- if (isNaN(n) || n < 1) return null;
2180
- return {
2181
- overflow: "hidden",
2182
- display: "-webkit-box",
2183
- WebkitBoxOrient: "vertical",
2184
- WebkitLineClamp: n
2185
- };
2186
- },
2187
- // ── Caret color (web-only) ────────────────────────────────────────────────
2188
- caret: ({ value, isArbitrary }, { colors }) => {
2189
- if (!getEffectiveIsWeb()) return null;
2190
- if (value === "auto" || value === "transparent") return { caretColor: value };
2191
- const color = resolveColor(value, colors, isArbitrary);
2192
- return color ? { caretColor: color } : null;
2193
- },
2194
- // ── Accent color (web-only) ───────────────────────────────────────────────
2195
- accent: ({ value, isArbitrary }, { colors }) => {
2196
- if (!getEffectiveIsWeb()) return null;
2197
- if (value === "auto") return { accentColor: "auto" };
2198
- const color = resolveColor(value, colors, isArbitrary);
2199
- return color ? { accentColor: color } : null;
2200
- },
2201
- // ── SVG stroke/fill (web-only) ────────────────────────────────────────────
2202
- // Native is intentionally excluded: react-native-svg's <Path>/<Circle>/etc.
2203
- // take stroke/fill as component PROPS, not style entries, so there's no
2204
- // reliable way to apply a resolved color through the `style` prop there.
2205
- // `stroke-{n}` sets strokeWidth (a plain number, unlike a color) — same
2206
- // color-first-then-numeric-fallback disambiguation `border` uses above.
2207
- stroke: ({ value, isArbitrary }, { colors }) => {
2208
- if (!getEffectiveIsWeb()) return null;
2209
- if (!value) return null;
2210
- if (value === "none") return { stroke: "none" };
2211
- if (isArbitrary) {
2212
- const w = toNativeValue(value);
2213
- return typeof w === "number" ? { strokeWidth: w } : { stroke: value };
2214
- }
2215
- const color = resolveColor(value, colors, false);
2216
- if (color) return { stroke: color };
2217
- const n = parseFloat(value);
2218
- return isNaN(n) ? null : { strokeWidth: n };
2219
- },
2220
- fill: ({ value, isArbitrary }, { colors }) => {
2221
- if (!getEffectiveIsWeb()) return null;
2222
- if (!value) return null;
2223
- if (value === "none") return { fill: "none" };
2224
- if (isArbitrary) return { fill: value };
2225
- const color = resolveColor(value, colors, false);
2226
- return color ? { fill: color } : null;
2227
- },
2228
- // ── Flex ───────────────────────────────────────────────────────────────────
2229
- flex: ({ value, isArbitrary }, { flex }) => {
2230
- if (!value) return { display: "flex" };
2231
- if (isArbitrary) {
2232
- const v = parseFloat(value);
2233
- return isNaN(v) ? null : { flex: v };
2234
- }
2235
- if (value in flex) {
2236
- const v = flex[value];
2237
- if (typeof v === "string" && !getEffectiveIsWeb()) {
2238
- if (v === "auto" || v === "initial") return { flex: 1 };
2239
- if (v === "none") return { flex: 0 };
2240
- return null;
2241
- }
2242
- return { flex: v };
2243
- }
2244
- const n = parseFloat(value);
2245
- return isNaN(n) ? null : { flex: n };
2246
- },
2247
- basis: ({ value, isArbitrary }, { spacing }) => {
2248
- const v = resolveSizing(value, spacing, isArbitrary);
2249
- return v !== null ? { flexBasis: v } : null;
2250
- },
2251
- grow: ({ value }, _) => {
2252
- if (!value) return { flexGrow: 1 };
2253
- const n = parseFloat(value);
2254
- return { flexGrow: isNaN(n) ? 1 : n };
2255
- },
2256
- shrink: ({ value }, _) => {
2257
- if (!value) return { flexShrink: 1 };
2258
- const n = parseFloat(value);
2259
- return { flexShrink: isNaN(n) ? 1 : n };
2260
- },
2261
- order: ({ value, negative }, _) => {
2262
- const n = parseInt(value, 10);
2263
- return isNaN(n) ? null : { order: negative ? -n : n };
2264
- },
2265
- // ── Gap ────────────────────────────────────────────────────────────────────
2266
- gap: ({ value, negative, isArbitrary }, { spacing }) => {
2267
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2268
- return v !== null ? { gap: v } : null;
2269
- },
2270
- "gap-x": ({ value, negative, isArbitrary }, { spacing }) => {
2271
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2272
- return v !== null ? { columnGap: v } : null;
2273
- },
2274
- "gap-y": ({ value, negative, isArbitrary }, { spacing }) => {
2275
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2276
- return v !== null ? { rowGap: v } : null;
2277
- },
2278
- // ── Position ───────────────────────────────────────────────────────────────
2279
- top: ({ value, negative, isArbitrary }, { spacing }) => {
2280
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2281
- return v !== null ? { top: v } : null;
2282
- },
2283
- right: ({ value, negative, isArbitrary }, { spacing }) => {
2284
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2285
- return v !== null ? { right: v } : null;
2286
- },
2287
- bottom: ({ value, negative, isArbitrary }, { spacing }) => {
2288
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2289
- return v !== null ? { bottom: v } : null;
2290
- },
2291
- left: ({ value, negative, isArbitrary }, { spacing }) => {
2292
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2293
- return v !== null ? { left: v } : null;
2294
- },
2295
- inset: ({ value, negative, isArbitrary }, { spacing }) => {
2296
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2297
- return v !== null ? { top: v, right: v, bottom: v, left: v } : null;
2298
- },
2299
- "inset-x": ({ value, negative, isArbitrary }, { spacing }) => {
2300
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2301
- return v !== null ? { left: v, right: v } : null;
2302
- },
2303
- "inset-y": ({ value, negative, isArbitrary }, { spacing }) => {
2304
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2305
- return v !== null ? { top: v, bottom: v } : null;
2306
- },
2307
- // ── Z-index ────────────────────────────────────────────────────────────────
2308
- z: ({ value, isArbitrary }, { zIndex }) => {
2309
- if (isArbitrary) {
2310
- const n2 = parseInt(value);
2311
- return isNaN(n2) ? null : { zIndex: n2 };
2312
- }
2313
- const v = zIndex[value];
2314
- if (v !== void 0) {
2315
- if (v === "auto") return getEffectiveIsWeb() ? { zIndex: "auto" } : null;
2316
- return { zIndex: v };
2317
- }
2318
- const n = parseInt(value);
2319
- return isNaN(n) ? null : { zIndex: n };
2320
- },
2321
- // ── Opacity ────────────────────────────────────────────────────────────────
2322
- opacity: ({ value, isArbitrary }, { opacity }) => {
2323
- if (isArbitrary) {
2324
- const v2 = parseFloat(value);
2325
- return isNaN(v2) ? null : { opacity: v2 > 1 ? v2 / 100 : v2 };
2326
- }
2327
- const v = opacity[value];
2328
- if (v !== void 0) return { opacity: v };
2329
- const n = parseFloat(value);
2330
- return isNaN(n) ? null : { opacity: n > 1 ? n / 100 : n };
2331
- },
2332
- // ── Font ───────────────────────────────────────────────────────────────────
2333
- font: ({ value, isArbitrary }, { fontFamily, fontWeight }) => {
2334
- if (isArbitrary) return { fontFamily: value };
2335
- if (value in fontFamily) {
2336
- const ff = fontFamily[value];
2337
- return { fontFamily: Array.isArray(ff) ? ff.join(", ") : ff };
2338
- }
2339
- if (value in fontWeight) return { fontWeight: String(fontWeight[value]) };
2340
- return null;
2341
- },
2342
- // ── Line height ────────────────────────────────────────────────────────────
2343
- leading: ({ value, isArbitrary }, { lineHeight }) => {
2344
- if (isArbitrary) return { lineHeight: getEffectiveIsWeb() ? value : toNativeValue(value) };
2345
- const v = lineHeight[value];
2346
- if (v === void 0) return null;
2347
- if (typeof v === "string" && !getEffectiveIsWeb()) return { lineHeight: toNativeValue(v) };
2348
- return { lineHeight: v };
2349
- },
2350
- // ── Letter spacing ─────────────────────────────────────────────────────────
2351
- tracking: ({ value, isArbitrary }, { letterSpacing }) => {
2352
- if (isArbitrary) return { letterSpacing: getEffectiveIsWeb() ? value : toNativeValue(value) };
2353
- const v = letterSpacing[value];
2354
- return v !== void 0 ? { letterSpacing: v } : null;
2355
- },
2356
- // ── Shadow ─────────────────────────────────────────────────────────────────
2357
- shadow: ({ value }, { shadow }) => {
2358
- const key = value === "" ? "DEFAULT" : value;
2359
- return shadow[key] ?? null;
2360
- },
2361
- // ── Scale ──────────────────────────────────────────────────────────────────
2362
- // Non-arbitrary: scale-150 → value='150' → 150/100 = 1.5
2363
- // Arbitrary: scale-[1.5] → value='1.5' → used as-is (already the factor)
2364
- scale: ({ value, isArbitrary }) => {
2365
- const n = isArbitrary ? parseFloat(value) : parseFloat(value) / 100;
2366
- if (isNaN(n)) return null;
2367
- return getEffectiveIsWeb() ? { transform: `scale(${n})` } : { transform: [{ scale: n }] };
2368
- },
2369
- "scale-x": ({ value, isArbitrary }) => {
2370
- const n = isArbitrary ? parseFloat(value) : parseFloat(value) / 100;
2371
- if (isNaN(n)) return null;
2372
- return getEffectiveIsWeb() ? { transform: `scaleX(${n})` } : { transform: [{ scaleX: n }] };
2373
- },
2374
- "scale-y": ({ value, isArbitrary }) => {
2375
- const n = isArbitrary ? parseFloat(value) : parseFloat(value) / 100;
2376
- if (isNaN(n)) return null;
2377
- return getEffectiveIsWeb() ? { transform: `scaleY(${n})` } : { transform: [{ scaleY: n }] };
2378
- },
2379
- // ── Rotate ─────────────────────────────────────────────────────────────────
2380
- rotate: ({ value, negative, isArbitrary }) => {
2381
- if (isArbitrary) {
2382
- const finalValue = negative ? `-${value}` : value;
2383
- return getEffectiveIsWeb() ? { transform: `rotate(${finalValue})` } : { transform: [{ rotate: finalValue }] };
2384
- }
2385
- const deg = parseFloat(value);
2386
- if (isNaN(deg)) return null;
2387
- const finalDeg = negative ? -deg : deg;
2388
- return getEffectiveIsWeb() ? { transform: `rotate(${finalDeg}deg)` } : { transform: [{ rotate: `${finalDeg}deg` }] };
2389
- },
2390
- // ── Translate ──────────────────────────────────────────────────────────────
2391
- "translate-x": ({ value, negative, isArbitrary }, { spacing }) => {
2392
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2393
- if (v === null) return null;
2394
- if (getEffectiveIsWeb()) return { transform: `translateX(${typeof v === "number" ? `${v}px` : v})` };
2395
- if (typeof v === "string") {
2396
- const n = parseFloat(v);
2397
- return isNaN(n) ? null : { transform: [{ translateX: n }] };
2398
- }
2399
- return { transform: [{ translateX: v }] };
2400
- },
2401
- "translate-y": ({ value, negative, isArbitrary }, { spacing }) => {
2402
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2403
- if (v === null) return null;
2404
- if (getEffectiveIsWeb()) return { transform: `translateY(${typeof v === "number" ? `${v}px` : v})` };
2405
- if (typeof v === "string") {
2406
- const n = parseFloat(v);
2407
- return isNaN(n) ? null : { transform: [{ translateY: n }] };
2408
- }
2409
- return { transform: [{ translateY: v }] };
2410
- },
2411
- // ── Aspect ratio ───────────────────────────────────────────────────────────
2412
- aspect: ({ value, isArbitrary }) => {
2413
- if (isArbitrary) return { aspectRatio: value };
2414
- const presets = { auto: "auto", square: 1, video: 16 / 9 };
2415
- if (!(value in presets)) return null;
2416
- const v = presets[value];
2417
- if (v === "auto") return getEffectiveIsWeb() ? { aspectRatio: "auto" } : null;
2418
- return { aspectRatio: v };
2419
- },
2420
- // ── Transition (web-only; use Animated API on native) ─────────────────────
2421
- transition: ({ value }) => {
2422
- if (!getEffectiveIsWeb()) return null;
2423
- const presets = {
2424
- "": "color 150ms, background-color 150ms, border-color 150ms, text-decoration-color 150ms, fill 150ms, stroke 150ms, opacity 150ms, box-shadow 150ms, transform 150ms, filter 150ms, backdrop-filter 150ms",
2425
- all: "all 150ms",
2426
- none: "none",
2427
- colors: "color 150ms, background-color 150ms, border-color 150ms",
2428
- opacity: "opacity 150ms",
2429
- shadow: "box-shadow 150ms",
2430
- transform: "transform 150ms"
2431
- };
2432
- const v = presets[value];
2433
- return v !== void 0 ? { transition: v } : null;
2434
- },
2435
- duration: ({ value, isArbitrary }) => {
2436
- if (!getEffectiveIsWeb()) return null;
2437
- if (!isArbitrary && isNaN(parseFloat(value))) return null;
2438
- const ms = isArbitrary ? value : `${value}ms`;
2439
- return { transitionDuration: ms };
2440
- },
2441
- delay: ({ value, isArbitrary }) => {
2442
- if (!getEffectiveIsWeb()) return null;
2443
- if (!isArbitrary && isNaN(parseFloat(value))) return null;
2444
- const ms = isArbitrary ? value : `${value}ms`;
2445
- return { transitionDelay: ms };
2446
- },
2447
- // ── Ring ───────────────────────────────────────────────────────────────────
2448
- // Web: box-shadow outline ring (doesn't affect layout).
2449
- // Native: React Native has no box-shadow, so this falls back to borderWidth/
2450
- // borderColor — the closest visual approximation (used by other RN Tailwind-
2451
- // likes for the same reason). Unlike the web ring, this DOES affect layout,
2452
- // and it shares its properties with the `border` utility — combining
2453
- // `border-*` and `ring-*` on the same native element means whichever class
2454
- // comes later wins, since both ultimately set borderWidth/borderColor.
2455
- ring: ({ value, isArbitrary }, { colors }) => {
2456
- const onWeb = getEffectiveIsWeb();
2457
- const DEFAULT_COLOR = "rgba(59, 130, 246, 0.5)";
2458
- const DEFAULT_WIDTH = 3;
2459
- const asNative = (w, color2) => w === 0 ? { borderWidth: 0 } : { borderWidth: w, borderColor: color2 };
2460
- if (!value) {
2461
- return onWeb ? { boxShadow: `0 0 0 ${DEFAULT_WIDTH}px ${DEFAULT_COLOR}` } : asNative(DEFAULT_WIDTH, DEFAULT_COLOR);
2462
- }
2463
- if (value === "inset") {
2464
- return onWeb ? { boxShadow: `inset 0 0 0 ${DEFAULT_WIDTH}px ${DEFAULT_COLOR}` } : asNative(DEFAULT_WIDTH, DEFAULT_COLOR);
2465
- }
2466
- const widthTokens = { "0": 0, "1": 1, "2": 2, "4": 4, "8": 8 };
2467
- if (!isArbitrary && value in widthTokens) {
2468
- const w = widthTokens[value];
2469
- return onWeb ? { boxShadow: w === 0 ? "none" : `0 0 0 ${w}px ${DEFAULT_COLOR}` } : asNative(w, DEFAULT_COLOR);
2470
- }
2471
- if (isArbitrary) {
2472
- const numMatch = /^(\d+(?:\.\d+)?)(px|rem|em|vw|vh)?$/.exec(value);
2473
- if (numMatch) {
2474
- const unit = numMatch[2] ?? "px";
2475
- if (onWeb) return { boxShadow: `0 0 0 ${numMatch[1]}${unit} ${DEFAULT_COLOR}` };
2476
- return unit === "px" ? asNative(parseFloat(numMatch[1]), DEFAULT_COLOR) : null;
2477
- }
2478
- return onWeb ? { boxShadow: value.replace(/_/g, " ") } : null;
2479
- }
2480
- const color = resolveColor(value, colors, false);
2481
- if (color) {
2482
- return onWeb ? { boxShadow: `0 0 0 ${DEFAULT_WIDTH}px ${color}` } : asNative(DEFAULT_WIDTH, color);
2483
- }
2484
- return null;
2485
- },
2486
- // Web-only, unlike `ring` above: this stacks a second box-shadow layer to
2487
- // create a gap between the element and the ring. There's no native
2488
- // equivalent to approximate that with (a border can't create a gap outside
2489
- // its own element without an extra wrapper view), so this stays a no-op
2490
- // on native rather than rendering a misleading half-translation.
2491
- "ring-offset": ({ value, isArbitrary }, _theme) => {
2492
- if (!getEffectiveIsWeb()) return null;
2493
- const DEFAULT_RING_COLOR = "rgba(59, 130, 246, 0.5)";
2494
- const DEFAULT_RING_WIDTH = 3;
2495
- const offsetTokens = { "0": 0, "1": 1, "2": 2, "4": 4, "8": 8 };
2496
- let offsetWidth;
2497
- if (!isArbitrary) {
2498
- offsetWidth = value in offsetTokens ? offsetTokens[value] : null;
2499
- } else {
2500
- offsetWidth = /^-?\d+(\.\d+)?$/.test(value) ? parseFloat(value) : value;
2501
- }
2502
- if (offsetWidth === null || typeof offsetWidth === "number" && isNaN(offsetWidth)) return null;
2503
- const isZero = offsetWidth === 0 || offsetWidth === "0";
2504
- const offsetCss = typeof offsetWidth === "number" ? `${offsetWidth}px` : offsetWidth;
2505
- return {
2506
- boxShadow: isZero ? `0 0 0 ${DEFAULT_RING_WIDTH}px ${DEFAULT_RING_COLOR}` : `0 0 0 ${offsetCss} #fff, 0 0 0 calc(${offsetCss} + ${DEFAULT_RING_WIDTH}px) ${DEFAULT_RING_COLOR}`
2507
- };
2508
- },
2509
- // ── Space between ─────────────────────────────────────────────────────────
2510
- // On web: emits __spaceX/__spaceY markers → resolver generates > * + * CSS rules.
2511
- // On native (RN 0.71+): uses columnGap/rowGap directly.
2512
- "space-x": ({ value, negative, isArbitrary }, { spacing }) => {
2513
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2514
- if (v === null) return null;
2515
- if (getEffectiveIsWeb()) return { __spaceX: v };
2516
- return { columnGap: v };
2517
- },
2518
- "space-y": ({ value, negative, isArbitrary }, { spacing }) => {
2519
- const v = resolveSpacing(value, negative, spacing, isArbitrary);
2520
- if (v === null) return null;
2521
- if (getEffectiveIsWeb()) return { __spaceY: v };
2522
- return { rowGap: v };
2523
- }
2524
- };
2525
- for (const [utility, prop] of Object.entries(PADDING_MARGIN_PROPS)) {
2526
- RESOLVERS[utility] = makeSpacingResolver(prop);
2527
- }
2528
- for (const [utility, [widthProp, colorProp]] of Object.entries(BORDER_SIDE_PROPS)) {
2529
- RESOLVERS[utility] = makeBorderSideResolver(widthProp, colorProp);
2530
- }
2531
- var NAMED_GROUP_PEER_MARKER_RE = /^(group|peer)\/.+$/;
2532
- function resolveUtility(parsed, theme) {
2533
- if (!parsed.value) {
2534
- if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
2535
- if (parsed.utility in getStandalone()) return getStandalone()[parsed.utility] ?? null;
2536
- if (NAMED_GROUP_PEER_MARKER_RE.test(parsed.utility)) return getEffectiveIsWeb() ? {} : null;
2537
- }
2538
- const resolver = PLUGIN_RESOLVERS[parsed.utility] ?? RESOLVERS[parsed.utility];
2539
- if (resolver) return resolver(parsed, theme);
2540
- return null;
2541
- }
2542
- var PLUGIN_STANDALONE = {};
2543
- var PLUGIN_RESOLVERS = {};
2544
- function clearPluginUtilities() {
2545
- for (const key of Object.keys(PLUGIN_STANDALONE)) delete PLUGIN_STANDALONE[key];
2546
- for (const key of Object.keys(PLUGIN_RESOLVERS)) delete PLUGIN_RESOLVERS[key];
2547
- _sortedPrefixes = null;
2548
- _standaloneNames = null;
2549
- }
2550
- function getPluginStandaloneMap() {
2551
- return PLUGIN_STANDALONE;
2552
- }
2553
- function isKnownUtility(utility) {
2554
- return utility in getStandalone() || utility in RESOLVERS || utility in PLUGIN_STANDALONE || utility in PLUGIN_RESOLVERS || NAMED_GROUP_PEER_MARKER_RE.test(utility);
2555
- }
2556
- var _sortedPrefixes = null;
2557
- var _standaloneNames = null;
2558
- function getBuiltinUtilityPrefixes() {
2559
- if (!_sortedPrefixes) {
2560
- const all = [.../* @__PURE__ */ new Set([...Object.keys(RESOLVERS), ...Object.keys(PLUGIN_RESOLVERS)])];
2561
- _sortedPrefixes = all.sort((a, b) => b.length - a.length);
2562
- }
2563
- return _sortedPrefixes;
2564
- }
2565
- function getBuiltinStandaloneNames() {
2566
- if (!_standaloneNames) {
2567
- _standaloneNames = /* @__PURE__ */ new Set([...Object.keys(getStandalone()), ...Object.keys(PLUGIN_STANDALONE)]);
2568
- }
2569
- return _standaloneNames;
2570
- }
2571
-
2572
- // src/core/parser.ts
2573
- var UNSAFE_ARBITRARY_VALUE = /[{};\\]|\/\*|\*\//;
2574
- function isSafeArbitraryValue(value) {
2575
- if (!UNSAFE_ARBITRARY_VALUE.test(value)) return true;
2576
- if (process.env.NODE_ENV !== "production") {
2577
- kbachWarn(`Unsafe arbitrary value rejected: "${value}"`);
2578
- }
2579
- return false;
2580
- }
2581
- function parseClass(className) {
2582
- const trimmed = className.trim();
2583
- if (!trimmed) return null;
2584
- const modifiers = [];
2585
- let remaining = trimmed;
2586
- while (true) {
2587
- const colonIdx = findOuterColon(remaining);
2588
- if (colonIdx === -1) break;
2589
- const candidate = remaining.slice(0, colonIdx);
2590
- if (!isKnownModifier(candidate)) break;
2591
- modifiers.push(candidate);
2592
- remaining = remaining.slice(colonIdx + 1);
2593
- }
2594
- let important = false;
2595
- if (remaining.startsWith("!") && remaining.length > 1) {
2596
- important = true;
2597
- remaining = remaining.slice(1);
2598
- }
2599
- let negative = false;
2600
- if (remaining.startsWith("-") && remaining.length > 1 && remaining[1] !== "-") {
2601
- negative = true;
2602
- remaining = remaining.slice(1);
2603
- }
2604
- let bracketDepth = 0;
2605
- let bracketStart = -1;
2606
- for (let i = remaining.length - 1; i >= 0; i--) {
2607
- if (remaining[i] === "]") bracketDepth++;
2608
- else if (remaining[i] === "[") {
2609
- bracketDepth--;
2610
- if (bracketDepth === 0) {
2611
- bracketStart = i;
2612
- break;
2613
- }
2614
- }
2615
- }
2616
- if (bracketStart > 0 && remaining[bracketStart - 1] === "-" && remaining.endsWith("]")) {
2617
- const utility = remaining.slice(0, bracketStart - 1);
2618
- const value = remaining.slice(bracketStart + 1, -1).replace(/_/g, " ");
2619
- if (!isSafeArbitraryValue(value)) return null;
2620
- return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
2621
- }
2622
- if (remaining.endsWith("]") && bracketStart === -1) {
2623
- if (process.env.NODE_ENV !== "production") {
2624
- kbachWarn(`Unbalanced brackets: "${trimmed}"`);
2625
- }
2626
- }
2627
- if (remaining.startsWith("[") && remaining.endsWith("]")) {
2628
- const value = remaining.slice(1, -1).replace(/_/g, " ");
2629
- if (!isSafeArbitraryValue(value)) return null;
2630
- return { original: trimmed, modifiers, negative, important, utility: "", value, isArbitrary: true };
2631
- }
2632
- if (getBuiltinStandaloneNames().has(remaining)) {
2633
- return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
2634
- }
2635
- for (const prefix of getBuiltinUtilityPrefixes()) {
2636
- if (remaining === prefix) {
2637
- return { original: trimmed, modifiers, negative, important, utility: prefix, value: "", isArbitrary: false };
2638
- }
2639
- if (remaining.startsWith(prefix + "-")) {
2640
- const value = remaining.slice(prefix.length + 1);
2641
- return { original: trimmed, modifiers, negative, important, utility: prefix, value, isArbitrary: false };
2642
- }
2643
- }
2644
- const firstDash = remaining.indexOf("-");
2645
- if (firstDash > 0) {
2646
- return {
2647
- original: trimmed,
2648
- modifiers,
2649
- negative,
2650
- important,
2651
- utility: remaining.slice(0, firstDash),
2652
- value: remaining.slice(firstDash + 1),
2653
- isArbitrary: false
2654
- };
2655
- }
2656
- return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
2657
- }
2658
- function splitClassTokens(classString) {
2659
- const tokens = [];
2660
- let current = "";
2661
- let depth = 0;
2662
- let parenDepth = 0;
2663
- for (let i = 0; i < classString.length; i++) {
2664
- const ch = classString[i];
2665
- if (ch === "[") {
2666
- depth++;
2667
- current += ch;
2668
- continue;
2669
- }
2670
- if (ch === "]") {
2671
- depth--;
2672
- current += ch;
2673
- continue;
2674
- }
2675
- if (ch === "(") {
2676
- parenDepth++;
2677
- current += ch;
2678
- continue;
2679
- }
2680
- if (ch === ")") {
2681
- parenDepth--;
2682
- current += ch;
2683
- continue;
2684
- }
2685
- if (/\s/.test(ch)) {
2686
- if (depth === 0 && parenDepth === 0) {
2687
- if (current) {
2688
- tokens.push(current);
2689
- current = "";
2690
- }
2691
- }
2692
- } else {
2693
- current += ch;
2694
- }
2695
- }
2696
- if (current) tokens.push(current);
2697
- return tokens;
2698
- }
2699
- function normalizeClassString(classString) {
2700
- return splitClassTokens(classString).join(" ");
2701
- }
2702
- function parseClasses(classString) {
2703
- const results = [];
2704
- for (const token of splitClassTokens(classString)) {
2705
- const parsed = parseClass(token);
2706
- if (parsed) results.push(parsed);
2707
- }
2708
- return results;
2709
- }
2710
- function findOuterColon(s) {
2711
- let depth = 0;
2712
- for (let i = 0; i < s.length; i++) {
2713
- const ch = s[i];
2714
- if (ch === "[") depth++;
2715
- else if (ch === "]") depth--;
2716
- else if (ch === ":" && depth === 0) return i;
2717
- }
2718
- return -1;
2719
- }
2720
-
2721
- // src/core/responsiveStore.ts
2722
- var RESPONSIVE_KEY = "__kbach_responsive__";
2723
- function getStore() {
2724
- const g = globalThis;
2725
- if (!g[RESPONSIVE_KEY]) {
2726
- g[RESPONSIVE_KEY] = { width: 0, notifiedWidth: 0, screens: {}, listeners: /* @__PURE__ */ new Set() };
2727
- }
2728
- return g[RESPONSIVE_KEY];
2729
- }
2730
- function getGlobalScreens() {
2731
- return getStore().screens;
2732
- }
2733
- function getGlobalWidth() {
2734
- return getStore().width;
2735
- }
2736
- function subscribeGlobalWidth(listener) {
2737
- const store = getStore();
2738
- store.listeners.add(listener);
2739
- return () => store.listeners.delete(listener);
2740
- }
2741
- function getActiveBreakpoints(width) {
2742
- const store = getStore();
2743
- const w = width ?? store.width;
2744
- const active = /* @__PURE__ */ new Set();
2745
- for (const [name, minW] of Object.entries(store.screens)) {
2746
- if (typeof minW === "number" && w >= minW) active.add(name);
2747
- }
2748
- return active;
2749
- }
2750
-
2751
- // src/core/resolver.ts
2752
- var _themeCache = /* @__PURE__ */ new WeakMap();
2753
- function getThemeCache(theme) {
2754
- let cache = _themeCache.get(theme);
2755
- if (!cache) {
2756
- cache = new LRUCache(1e4);
2757
- _themeCache.set(theme, cache);
2758
- }
2759
- return cache;
2760
- }
2761
- var _sortCache = /* @__PURE__ */ new WeakMap();
2762
- function getSortedEntries(resolved) {
2763
- let sorted = _sortCache.get(resolved);
2764
- if (!sorted) {
2765
- const entries = Object.entries(resolved);
2766
- entries.sort((a, b) => {
2767
- const pa = a[0] === "base" ? -1 : a[0].split(":").length;
2768
- const pb = b[0] === "base" ? -1 : b[0].split(":").length;
2769
- return pa - pb;
2770
- });
2771
- sorted = entries;
2772
- _sortCache.set(resolved, sorted);
2773
- }
2774
- return sorted;
2775
- }
2776
- var FONT_KEY = "__kbach_default_font__";
2777
- function setDefaultFontFamily(font) {
2778
- globalThis[FONT_KEY] = font;
2779
- }
2780
- function getDefaultFontFamily() {
2781
- return globalThis[FONT_KEY];
2782
- }
2783
- var _styleEl = null;
2784
- var _ruleIndexByKey = /* @__PURE__ */ new Map();
2785
- function evictInjectedRule(rule) {
2786
- const idx = _ruleIndexByKey.get(rule);
2787
- _ruleIndexByKey.delete(rule);
2788
- if (idx === void 0) return;
2789
- const sheet = _styleEl?.sheet;
2790
- if (!sheet) return;
2791
- try {
2792
- sheet.deleteRule(idx);
2793
- } catch {
2794
- return;
2795
- }
2796
- for (const [key, i] of _ruleIndexByKey) {
2797
- if (i > idx) _ruleIndexByKey.set(key, i - 1);
2798
- }
2799
- }
2800
- var _injectedRules = new LRUCache(5e4, evictInjectedRule);
2801
- var _CSS_DISABLED_KEY = "__kbach_runtime_css_disabled__";
2802
- function isRuntimeCSSDisabled() {
2803
- return !!globalThis[_CSS_DISABLED_KEY];
2804
- }
2805
- function getStyleEl() {
2806
- if (_styleEl) return _styleEl;
2807
- _styleEl = document.createElement("style");
2808
- _styleEl.setAttribute("data-kbach", "");
2809
- document.head.appendChild(_styleEl);
2810
- return _styleEl;
2811
- }
2812
- function injectRule(rule) {
2813
- if (isRuntimeCSSDisabled()) return;
2814
- if (_injectedRules.get(rule)) return;
2815
- try {
2816
- const sheet = getStyleEl().sheet;
2817
- if (sheet) {
2818
- const idx = sheet.cssRules.length;
2819
- sheet.insertRule(rule, idx);
2820
- _ruleIndexByKey.set(rule, idx);
2821
- _injectedRules.set(rule, true);
2822
- }
2823
- } catch {
2824
- }
2825
- }
2826
- var _globalStyleEl = null;
2827
- function getGlobalStyleEl() {
2828
- if (_globalStyleEl) return _globalStyleEl;
2829
- _globalStyleEl = document.createElement("style");
2830
- _globalStyleEl.setAttribute("data-kbach-global", "");
2831
- document.head.insertBefore(_globalStyleEl, getStyleEl());
2832
- return _globalStyleEl;
2833
- }
2834
- function injectGlobalStyles(theme) {
2835
- if (typeof document === "undefined" || isRuntimeCSSDisabled()) return;
2836
- const rules = document.getElementById(RESET_STYLE_ID) ? [] : [BASE_RESET];
2837
- const ff = theme.fontFamily;
2838
- if (ff?.sans && ff.sans !== "System") {
2839
- const family = Array.isArray(ff.sans) ? ff.sans.join(", ") : ff.sans;
2840
- rules.push(`body { font-family: ${family}; }`);
2841
- }
2842
- getGlobalStyleEl().textContent = rules.join("\n");
2843
- }
2844
- function buildDivideDecls(styles, forceImportant) {
2845
- const imp = forceImportant ? " !important" : "";
2846
- const parts = [];
2847
- if ("__divideX" in styles) {
2848
- const w = Number(styles.__divideX);
2849
- parts.push(`border-left-width: ${w}px${imp}`, `border-right-width: 0px${imp}`);
2850
- }
2851
- if ("__divideY" in styles) {
2852
- const w = Number(styles.__divideY);
2853
- parts.push(`border-top-width: ${w}px${imp}`, `border-bottom-width: 0px${imp}`);
2854
- }
2855
- if ("__divideColor" in styles) parts.push(`border-color: ${String(styles.__divideColor)}${imp}`);
2856
- if ("__divideStyle" in styles) parts.push(`border-style: ${String(styles.__divideStyle)}${imp}`);
2857
- return parts.join("; ");
2858
- }
2859
- function buildSpaceDecls(styles, forceImportant) {
2860
- const imp = forceImportant ? " !important" : "";
2861
- const parts = [];
2862
- if ("__spaceX" in styles) {
2863
- const v = styles.__spaceX;
2864
- const val = typeof v === "number" ? `${v}px` : String(v);
2865
- parts.push(`margin-left: ${val}${imp}`);
2866
- }
2867
- if ("__spaceY" in styles) {
2868
- const v = styles.__spaceY;
2869
- const val = typeof v === "number" ? `${v}px` : String(v);
2870
- parts.push(`margin-top: ${val}${imp}`);
2871
- }
2872
- return parts.join("; ");
2873
- }
2874
- var RN_ONLY_PROPS = /* @__PURE__ */ new Set([
2875
- "shadowColor",
2876
- "shadowOffset",
2877
- "shadowOpacity",
2878
- "shadowRadius",
2879
- "elevation",
2880
- "includeFontPadding",
2881
- "textAlignVertical",
2882
- "writingDirection",
2883
- "textShadowColor",
2884
- "textShadowOffset",
2885
- "textShadowRadius",
2886
- "tintColor",
2887
- "__divideX",
2888
- "__divideY",
2889
- "__divideColor",
2890
- "__divideStyle",
2891
- "__keyframe",
2892
- "__spaceX",
2893
- "__spaceY"
2894
- ]);
2895
- var CSS_UNITLESS = /* @__PURE__ */ new Set([
2896
- "opacity",
2897
- "fontWeight",
2898
- "flex",
2899
- "flexGrow",
2900
- "flexShrink",
2901
- "order",
2902
- "zIndex",
2903
- "aspectRatio",
2904
- "columnCount",
2905
- "lineHeight",
2906
- "gridColumnStart",
2907
- "gridColumnEnd",
2908
- "gridRowStart",
2909
- "gridRowEnd"
2910
- ]);
2911
- var RN_SHORTHAND_EXPAND = {
2912
- marginHorizontal: ["margin-left", "margin-right"],
2913
- marginVertical: ["margin-top", "margin-bottom"],
2914
- paddingHorizontal: ["padding-left", "padding-right"],
2915
- paddingVertical: ["padding-top", "padding-bottom"]
2916
- };
2917
- function styleValueToCSS(styles, forceImportant = false) {
2918
- const parts = [];
2919
- for (const [prop, val] of Object.entries(styles)) {
2920
- if (val === void 0 || val === null || typeof val === "object" || RN_ONLY_PROPS.has(prop)) continue;
2921
- let cssVal;
2922
- if (typeof val === "number") {
2923
- const isCustomProp = prop.startsWith("--");
2924
- cssVal = val === 0 || isCustomProp || CSS_UNITLESS.has(prop) ? String(val) : `${val}px`;
2925
- } else {
2926
- cssVal = String(val);
2927
- }
2928
- const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
2929
- if (prop in RN_SHORTHAND_EXPAND) {
2930
- const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
2931
- parts.push(`${p1}: ${cssVal}${imp}`, `${p2}: ${cssVal}${imp}`);
2932
- continue;
2933
- }
2934
- parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
2935
- }
2936
- return parts.join("; ");
2937
- }
2938
- function camelToKebab(str) {
2939
- return str.replace(/([A-Z])/g, "-$1").toLowerCase();
2940
- }
2941
- function buildClassCSSRules(cls, bucketKey, styles, darkMode, important, screens) {
2942
- const rules = [];
2943
- if ("__keyframe" in styles && typeof styles.__keyframe === "string") {
2944
- rules.push(styles.__keyframe);
2945
- }
2946
- const isDivide = "__divideX" in styles || "__divideY" in styles || "__divideColor" in styles || "__divideStyle" in styles;
2947
- const isSpace = "__spaceX" in styles || "__spaceY" in styles;
2948
- const isChildCombinator = isDivide || isSpace;
2949
- const escaped = escapeCSSSelector(cls);
2950
- const childSuffix = isChildCombinator ? " > * + *" : "";
2951
- if (bucketKey === "base") {
2952
- const decls2 = isDivide ? buildDivideDecls(styles, important) : isSpace ? buildSpaceDecls(styles, important) : styleValueToCSS(styles, important);
2953
- if (!decls2) return rules;
2954
- rules.push(`.${escaped}${childSuffix} { ${decls2} }`);
2955
- return rules;
2956
- }
2957
- const mods = bucketKey.split(":");
2958
- let darkScheme;
2959
- let needsImportant = important;
2960
- const pseudoParts = [];
2961
- const ancestorParts = [];
2962
- const dirParts = [];
2963
- const mediaWrappers = [];
2964
- let minWidth = 0;
2965
- for (const mod of mods) {
2966
- const def = getModifier(mod);
2967
- if (!def) continue;
2968
- if (def.darkScheme) darkScheme = def.darkScheme;
2969
- if (def.pseudo) pseudoParts.push(def.pseudo);
2970
- if (def.ancestorSelector) {
2971
- ancestorParts.push(def.ancestorSelector);
2972
- needsImportant = true;
2973
- }
2974
- if (def.dirSelector) {
2975
- dirParts.push(def.dirSelector);
2976
- needsImportant = true;
2977
- }
2978
- if (def.mediaQuery) {
2979
- mediaWrappers.push(`@media ${def.mediaQuery}`);
2980
- needsImportant = true;
2981
- }
2982
- if (def.isResponsive) {
2983
- const w = screens[mod] ?? 0;
2984
- if (w > minWidth) minWidth = w;
2985
- }
2986
- if (def.forcesImportant) needsImportant = true;
2987
- }
2988
- const pseudoSuffix = pseudoParts.join("");
2989
- const elementSelector = `.${escaped}${pseudoSuffix}${childSuffix}`;
2990
- const ancestorPrefix = ancestorParts.join("");
2991
- const dirPrefix = dirParts.join("");
2992
- const selector = `${dirPrefix}${ancestorPrefix}${elementSelector}`;
2993
- const decls = isDivide ? buildDivideDecls(styles, needsImportant) : isSpace ? buildSpaceDecls(styles, needsImportant) : styleValueToCSS(styles, needsImportant);
2994
- if (!decls) return rules;
2995
- let rule;
2996
- if (darkScheme === "dark") {
2997
- if (darkMode === "media") rule = `@media (prefers-color-scheme: dark) { ${selector} { ${decls} } }`;
2998
- else if (darkMode === "class") rule = `.dark ${selector} { ${decls} }`;
2999
- else rule = `[data-theme="dark"] ${selector} { ${decls} }`;
3000
- } else if (darkScheme === "light") {
3001
- if (darkMode === "media") rule = `@media (prefers-color-scheme: light) { ${selector} { ${decls} } }`;
3002
- else if (darkMode === "class") rule = `.light ${selector} { ${decls} }`;
3003
- else rule = `[data-theme="light"] ${selector} { ${decls} }`;
3004
- } else {
3005
- rule = `${selector} { ${decls} }`;
3006
- }
3007
- for (const mw of mediaWrappers) rule = `${mw} { ${rule} }`;
3008
- if (minWidth > 0) rule = `@media (min-width: ${minWidth}px) { ${rule} }`;
3009
- rules.push(rule);
3010
- return rules;
3011
- }
3012
- function injectClassRule(cls, bucketKey, styles, darkMode, important) {
3013
- const cssRules = buildClassCSSRules(cls, bucketKey, styles, darkMode, important, getGlobalScreens());
3014
- for (const r of cssRules) injectRule(r);
3015
- }
3016
- function resolve(classString, theme, darkMode = "attribute") {
3017
- const cache = getThemeCache(theme);
3018
- const cacheKey = `${classString}::${darkMode}`;
3019
- const cached = cache.get(cacheKey);
3020
- if (cached) return cached;
3021
- const result = {};
3022
- const onWeb = isWeb;
3023
- for (const parsed of parseClasses(classString)) {
3024
- const styles = resolveUtility(parsed, theme);
3025
- if (!styles) {
3026
- if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility) && !parsed.original.startsWith("__")) {
3027
- kbachWarn(`Unknown class "${parsed.original}"`);
3028
- }
3029
- continue;
3030
- }
3031
- const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
3032
- if (!result[bucketKey]) result[bucketKey] = {};
3033
- Object.assign(result[bucketKey], styles);
3034
- if (onWeb) {
3035
- injectClassRule(parsed.original, bucketKey, styles, darkMode, parsed.important);
3036
- }
3037
- }
3038
- cache.set(cacheKey, result);
3039
- return result;
3040
- }
3041
- function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new Set()) {
3042
- const result = {};
3043
- for (const [key, styles] of getSortedEntries(resolved)) {
3044
- if (!styles) continue;
3045
- if (key === "base") {
3046
- Object.assign(result, styles);
3047
- continue;
3048
- }
3049
- const mods = key.split(":");
3050
- if (mods.every((mod) => matchModifier(mod, isDark, state, breakpoints))) {
3051
- Object.assign(result, styles);
3052
- }
3053
- }
3054
- if (isNative) {
3055
- const defaultFont = getDefaultFontFamily();
3056
- if (defaultFont && !("fontFamily" in result)) {
3057
- result.fontFamily = defaultFont;
3058
- }
3059
- }
3060
- if (!isNative) {
3061
- const r = result;
3062
- const ph = r.paddingHorizontal;
3063
- if (ph !== void 0) {
3064
- r.paddingLeft = ph;
3065
- r.paddingRight = ph;
3066
- delete r.paddingHorizontal;
3067
- }
3068
- const pv = r.paddingVertical;
3069
- if (pv !== void 0) {
3070
- r.paddingTop = pv;
3071
- r.paddingBottom = pv;
3072
- delete r.paddingVertical;
3073
- }
3074
- const mh = r.marginHorizontal;
3075
- if (mh !== void 0) {
3076
- r.marginLeft = mh;
3077
- r.marginRight = mh;
3078
- delete r.marginHorizontal;
3079
- }
3080
- const mv = r.marginVertical;
3081
- if (mv !== void 0) {
3082
- r.marginTop = mv;
3083
- r.marginBottom = mv;
3084
- delete r.marginVertical;
3085
- }
3086
- }
3087
- return result;
3088
- }
3089
-
3090
- // src/core/config.ts
3091
- function deepMerge(base, override) {
3092
- const result = { ...base };
3093
- for (const key of Object.keys(override)) {
3094
- const baseVal = base[key];
3095
- const overVal = override[key];
3096
- if (baseVal !== null && typeof baseVal === "object" && !Array.isArray(baseVal) && overVal !== null && typeof overVal === "object" && !Array.isArray(overVal)) {
3097
- result[key] = deepMerge(
3098
- baseVal,
3099
- overVal
3100
- );
3101
- } else if (overVal !== void 0) {
3102
- result[key] = overVal;
3103
- }
3104
- }
3105
- return result;
3106
- }
3107
- var CONFIG_KEY = "__kbach_config_store__";
3108
- function getConfigStore() {
3109
- const g = globalThis;
3110
- if (!g[CONFIG_KEY]) {
3111
- g[CONFIG_KEY] = { resolved: null, listeners: /* @__PURE__ */ new Set(), customVariants: {} };
3112
- }
3113
- return g[CONFIG_KEY];
3114
- }
3115
- function getConfig() {
3116
- const store = getConfigStore();
3117
- if (store.resolved) return store.resolved;
3118
- store.resolved = buildConfig({});
3119
- return store.resolved;
3120
- }
3121
- function resolveOneRef(ref, colors) {
3122
- const lastDash = ref.lastIndexOf("-");
3123
- if (lastDash <= 0) return null;
3124
- const name = ref.slice(0, lastDash);
3125
- const shade = ref.slice(lastDash + 1);
3126
- if (!/^\d+$/.test(shade)) return null;
3127
- const entry = colors[name];
3128
- if (!entry || typeof entry !== "object") return null;
3129
- return entry[shade] ?? null;
3130
- }
3131
- function resolveColorRefs(colors) {
3132
- const MAX_DEPTH = 5;
3133
- function resolveChain(raw) {
3134
- let current = raw;
3135
- for (let i = 0; i < MAX_DEPTH; i++) {
3136
- const next = resolveOneRef(current, colors);
3137
- if (!next || next === current) break;
3138
- current = next;
3139
- }
3140
- return current;
3141
- }
3142
- const out = {};
3143
- for (const [key, val] of Object.entries(colors)) {
3144
- if (typeof val === "string") {
3145
- out[key] = resolveChain(val);
3146
- } else {
3147
- const shades = {};
3148
- for (const [shade, hex] of Object.entries(val)) {
3149
- shades[shade] = resolveChain(hex);
3150
- }
3151
- out[key] = shades;
3152
- }
3153
- }
3154
- return out;
3155
- }
3156
- function buildConfig(userConfig) {
3157
- let theme = { ...defaultTheme };
3158
- if (userConfig.theme) {
3159
- theme = { ...theme, ...userConfig.theme };
3160
- }
3161
- if (userConfig.extend) {
3162
- const extendConfig = userConfig.extend;
3163
- const { theme: nestedTheme, ...directKeys } = extendConfig;
3164
- const extSources = [];
3165
- if (nestedTheme) extSources.push(nestedTheme);
3166
- if (Object.keys(directKeys).length) extSources.push(directKeys);
3167
- for (const ext of extSources) {
3168
- for (const [key, value] of Object.entries(ext)) {
3169
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
3170
- if (process.env.NODE_ENV !== "production") {
3171
- kbachWarn(`extend.${key} should be an object, got ${typeof value} \u2014 skipped`);
3172
- }
3173
- continue;
3174
- }
3175
- if (value !== null && typeof value === "object" && !Array.isArray(value)) {
3176
- theme[key] = deepMerge(
3177
- theme[key] ?? {},
3178
- value
3179
- );
3180
- }
3181
- }
3182
- }
3183
- }
3184
- theme = { ...theme, colors: resolveColorRefs(theme.colors) };
3185
- const resolved = {
3186
- darkMode: userConfig.darkMode ?? "attribute",
3187
- theme,
3188
- plugins: userConfig.plugins ?? []
3189
- };
3190
- if (userConfig.plugins !== void 0) {
3191
- clearPluginUtilities();
3192
- clearPluginModifiers();
3193
- }
3194
- const _store = getConfigStore();
3195
- for (const k of Object.keys(_store.customVariants)) delete _store.customVariants[k];
3196
- const pluginAPI = makePluginAPI(resolved.theme);
3197
- for (const plugin of resolved.plugins) {
3198
- plugin(pluginAPI);
3199
- }
3200
- const rawSans = theme.fontFamily?.sans;
3201
- const sansFontValue = Array.isArray(rawSans) ? rawSans[0] : rawSans;
3202
- setDefaultFontFamily(sansFontValue && sansFontValue !== "System" ? sansFontValue : void 0);
3203
- injectGlobalStyles(resolved.theme);
3204
- return resolved;
3205
- }
3206
- function _selectorToModifierDef(selector) {
3207
- const s = selector.trim();
3208
- if (s.startsWith("@media ")) {
3209
- return { mediaQuery: s.slice(7), jsBehavior: "css-only", forcesImportant: true };
3210
- }
3211
- if (s.startsWith("::") || s.startsWith(":") && !s.includes(" ") && !s.includes("&") && !s.includes("(")) {
3212
- return { pseudo: s, jsBehavior: "css-only", forcesImportant: true };
3213
- }
3214
- return { ancestorSelector: s.endsWith(" ") ? s : `${s} `, jsBehavior: "css-only", forcesImportant: true };
3215
- }
3216
- function makePluginAPI(theme) {
3217
- const standalone = getPluginStandaloneMap();
3218
- return {
3219
- addUtility(name, styles) {
3220
- standalone[name] = styles;
3221
- },
3222
- addVariant(name, selectorOrDef) {
3223
- const def = typeof selectorOrDef === "string" ? _selectorToModifierDef(selectorOrDef) : selectorOrDef;
3224
- const selector = typeof selectorOrDef === "string" ? selectorOrDef : selectorOrDef.pseudo ?? selectorOrDef.mediaQuery ?? selectorOrDef.ancestorSelector ?? null;
3225
- if (selector !== null && selector !== name) customVariants[name] = selector;
3226
- registerModifier(name, def);
3227
- },
3228
- theme(path, defaultValue) {
3229
- const parts = path.replace(/\[([^\]]+)\]/g, ".$1").split(".");
3230
- let current = theme;
3231
- for (const part of parts) {
3232
- if (current === null || typeof current !== "object") return defaultValue;
3233
- current = current[part];
3234
- }
3235
- return current ?? defaultValue;
3236
- },
3237
- e(className) {
3238
- return className.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
3239
- }
3240
- };
3241
- }
3242
- function onConfigChange(listener) {
3243
- const store = getConfigStore();
3244
- store.listeners.add(listener);
3245
- return () => store.listeners.delete(listener);
3246
- }
3247
- var customVariants = new Proxy(
3248
- {},
3249
- {
3250
- get(_t, p) {
3251
- return typeof p === "string" ? getConfigStore().customVariants[p] : void 0;
3252
- },
3253
- set(_t, p, v) {
3254
- if (typeof p === "string") getConfigStore().customVariants[p] = v;
3255
- return true;
3256
- },
3257
- ownKeys() {
3258
- return Object.keys(getConfigStore().customVariants);
3259
- },
3260
- getOwnPropertyDescriptor(_t, p) {
3261
- if (typeof p !== "string") return void 0;
3262
- const v = getConfigStore().customVariants[p];
3263
- return v !== void 0 ? { value: v, writable: true, enumerable: true, configurable: true } : void 0;
3264
- }
3265
- }
3266
- );
3267
-
3268
- // src/core/darkModeStore.ts
3269
- var KEY = "__kbach_dark_store__";
3270
- function getStore2() {
3271
- const g = globalThis;
3272
- if (!g[KEY]) {
3273
- g[KEY] = { isDark: false, notifiedIsDark: false, subscribers: /* @__PURE__ */ new Set() };
3274
- }
3275
- return g[KEY];
3276
- }
3277
- function getGlobalDarkMode() {
3278
- return getStore2().isDark;
3279
- }
3280
- function subscribeGlobalDarkMode(callback) {
3281
- const store = getStore2();
3282
- store.subscribers.add(callback);
3283
- return () => store.subscribers.delete(callback);
3284
- }
42
+ var import_core6 = require("./core");
3285
43
 
3286
44
  // src/InteractiveWrapper.tsx
3287
45
  var import_react2 = __toESM(require("react"));
46
+ var import_core4 = require("./core");
47
+
48
+ // src/useGlobalDarkMode.ts
49
+ var import_core = require("./core");
3288
50
 
3289
51
  // src/useSyncExternalStoreShim.ts
3290
52
  var import_react = __toESM(require("react"));
3291
- var useSyncExternalStore = import_react.default.useSyncExternalStore ?? function useSyncExternalStoreFallback(subscribe, getSnapshot, _getServerSnapshot) {
53
+ var useSyncExternalStore = import_react.default.useSyncExternalStore ?? function useSyncExternalStoreFallback(subscribe, getSnapshot, getServerSnapshot) {
54
+ const isServer = typeof window === "undefined";
3292
55
  const [, forceUpdate] = import_react.default.useReducer((n) => n + 1, 0);
3293
- import_react.default.useEffect(() => subscribe(forceUpdate), [subscribe]);
3294
- return getSnapshot();
56
+ const value = isServer && getServerSnapshot ? getServerSnapshot() : getSnapshot();
57
+ import_react.default.useEffect(() => {
58
+ if (getSnapshot() !== value) forceUpdate();
59
+ return subscribe(forceUpdate);
60
+ }, [subscribe]);
61
+ return value;
3295
62
  };
3296
63
 
3297
64
  // src/useGlobalDarkMode.ts
@@ -3300,13 +67,14 @@ var NOOP_SUB = (_) => () => {
3300
67
  var FALSE_SNAP = () => false;
3301
68
  function useConditionalGlobalDarkMode(active) {
3302
69
  return useSyncExternalStore(
3303
- active ? subscribeGlobalDarkMode : NOOP_SUB,
3304
- active ? getGlobalDarkMode : FALSE_SNAP,
70
+ active ? import_core.subscribeGlobalDarkMode : NOOP_SUB,
71
+ active ? import_core.getGlobalDarkMode : FALSE_SNAP,
3305
72
  FALSE_SNAP
3306
73
  );
3307
74
  }
3308
75
 
3309
76
  // src/useGlobalWidth.ts
77
+ var import_core2 = require("./core");
3310
78
  var NOOP_SUB2 = (_) => () => {
3311
79
  };
3312
80
  var ZERO_SNAP = () => 0;
@@ -3341,15 +109,16 @@ function getWebWidth() {
3341
109
  }
3342
110
  function useConditionalWidth(active) {
3343
111
  return useSyncExternalStore(
3344
- active ? isWeb ? subscribeWebWidth : subscribeGlobalWidth : NOOP_SUB2,
3345
- active ? isWeb ? getWebWidth : getGlobalWidth : ZERO_SNAP,
112
+ active ? import_core2.isWeb ? subscribeWebWidth : import_core2.subscribeGlobalWidth : NOOP_SUB2,
113
+ active ? import_core2.isWeb ? getWebWidth : import_core2.getGlobalWidth : ZERO_SNAP,
3346
114
  ZERO_SNAP
3347
115
  );
3348
116
  }
3349
117
 
3350
118
  // src/shared-utils.ts
119
+ var import_core3 = require("./core");
3351
120
  function hasResponsiveBuckets(resolved) {
3352
- const responsiveMods = getResponsiveModifiers();
121
+ const responsiveMods = (0, import_core3.getResponsiveModifiers)();
3353
122
  for (const key of Object.keys(resolved)) {
3354
123
  if (key === "base") continue;
3355
124
  for (const mod of key.split(":")) {
@@ -3414,11 +183,11 @@ var InteractiveWrapper = (0, import_react2.forwardRef)(
3414
183
  onBlur,
3415
184
  ...rest
3416
185
  }, ref) {
3417
- const isWebPlatform = getEffectiveIsWeb();
186
+ const isWebPlatform = (0, import_core4.getEffectiveIsWeb)();
3418
187
  const isDark = useConditionalGlobalDarkMode(!isWebPlatform);
3419
188
  const needsWidth = hasResponsiveBuckets(resolvedStyle);
3420
189
  const width = useConditionalWidth(needsWidth && !isWebPlatform);
3421
- const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
190
+ const breakpoints = needsWidth ? (0, import_core4.getActiveBreakpoints)(width) : EMPTY_BREAKPOINTS;
3422
191
  const [pressed, setPressed] = (0, import_react2.useState)(false);
3423
192
  const [hovered, setHovered] = (0, import_react2.useState)(false);
3424
193
  const [focused, setFocused] = (0, import_react2.useState)(false);
@@ -3453,15 +222,16 @@ var InteractiveWrapper = (0, import_react2.forwardRef)(
3453
222
  if (!isWebPlatform) setFocused(false);
3454
223
  }), [onBlur, isWebPlatform]);
3455
224
  const { children, disabled, checked, ...restForComponent } = rest;
225
+ const isNonStringComponent = typeof Component !== "string";
3456
226
  const computedStyle = (0, import_react2.useMemo)(
3457
227
  () => {
3458
228
  if (isWebPlatform) return {};
3459
- const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused, disabled: !!disabled, checked: !!checked }, breakpoints);
229
+ const s = (0, import_core4.flatten)(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused, disabled: !!disabled, checked: !!checked }, breakpoints);
3460
230
  stripInternalMarkers(s);
3461
- if (typeof Component !== "string") stripWebOnlyProps(s);
231
+ if (isNonStringComponent) stripWebOnlyProps(s);
3462
232
  return s;
3463
233
  },
3464
- [resolvedStyle, isDark, pressed, hovered, focused, width, disabled, checked]
234
+ [resolvedStyle, isDark, pressed, hovered, focused, width, disabled, checked, isNonStringComponent]
3465
235
  );
3466
236
  const skipComputedInline = isWebPlatform;
3467
237
  const finalStyle = skipComputedInline ? styleProp ?? void 0 : styleProp ? Array.isArray(styleProp) ? Object.assign({}, computedStyle, ...styleProp) : { ...computedStyle, ...styleProp } : computedStyle;
@@ -3471,7 +241,7 @@ var InteractiveWrapper = (0, import_react2.forwardRef)(
3471
241
  ...disabled !== void 0 ? { disabled } : {},
3472
242
  ...checked !== void 0 ? { checked } : {},
3473
243
  style: finalStyle,
3474
- ...!isNative && className ? { className } : {},
244
+ ...!import_core4.isNative && className ? { className } : {},
3475
245
  // On web, onPointerDown/Up drive the wrapper's own pressed state (covers mouse + touch) —
3476
246
  // onPressIn/onPressOut are RN-only prop names and are never forwarded here, even when
3477
247
  // Component isn't a literal HTML tag string. A non-string Component on web is just as
@@ -3485,7 +255,7 @@ var InteractiveWrapper = (0, import_react2.forwardRef)(
3485
255
  // in jsx-runtime.tsx swaps it for a plain host tag — so keeping them pre-hydration would
3486
256
  // only have traded one prop-mismatch warning for another.) Genuinely native code paths
3487
257
  // still get them via the isNative branch below.
3488
- ...!isNative ? {
258
+ ...!import_core4.isNative ? {
3489
259
  onPointerDown: handlePointerDown,
3490
260
  onPointerUp: handlePointerUp,
3491
261
  onPointerLeave: handlePointerLeave,
@@ -3503,18 +273,19 @@ InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
3503
273
 
3504
274
  // src/DarkWrapper.tsx
3505
275
  var import_react3 = __toESM(require("react"));
276
+ var import_core5 = require("./core");
3506
277
  var DarkWrapper = import_react3.default.forwardRef(
3507
278
  function DarkWrapper2({ Component, resolvedStyle, style: styleProp, children, ...rest }, ref) {
3508
- const isWebPlatform = getEffectiveIsWeb();
279
+ const isWebPlatform = (0, import_core5.getEffectiveIsWeb)();
3509
280
  const isDark = useConditionalGlobalDarkMode(!isWebPlatform);
3510
281
  const needsWidth = hasResponsiveBuckets(resolvedStyle);
3511
282
  const width = useConditionalWidth(needsWidth && !isWebPlatform);
3512
- const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
3513
- const screens = getGlobalScreens();
283
+ const breakpoints = needsWidth ? (0, import_core5.getActiveBreakpoints)(width) : EMPTY_BREAKPOINTS;
284
+ const screens = (0, import_core5.getGlobalScreens)();
3514
285
  const isNonStringComponent = typeof Component !== "string";
3515
286
  const computedStyle = (0, import_react3.useMemo)(() => {
3516
287
  if (isWebPlatform) return {};
3517
- const s = flatten(resolvedStyle, isDark, {}, breakpoints);
288
+ const s = (0, import_core5.flatten)(resolvedStyle, isDark, {}, breakpoints);
3518
289
  stripInternalMarkers(s);
3519
290
  if (isNonStringComponent) stripWebOnlyProps(s);
3520
291
  return s;
@@ -3808,11 +579,11 @@ function _invalidateDefaultFontCache() {
3808
579
  const _KEY = "__kbach_font_cache_unsub__";
3809
580
  const g = globalThis;
3810
581
  if (g[_KEY]) g[_KEY]();
3811
- g[_KEY] = onConfigChange(_invalidateDefaultFontCache);
582
+ g[_KEY] = (0, import_core6.onConfigChange)(_invalidateDefaultFontCache);
3812
583
  }
3813
584
  function getCachedDefaultFont() {
3814
585
  if (_lastFontVersion !== _defaultFontVersion) {
3815
- _cachedDefaultFont = getDefaultFontFamily();
586
+ _cachedDefaultFont = (0, import_core6.getDefaultFontFamily)();
3816
587
  _lastFontVersion = _defaultFontVersion;
3817
588
  }
3818
589
  return _cachedDefaultFont;
@@ -3821,9 +592,9 @@ var _bucketModsCache = /* @__PURE__ */ new WeakMap();
3821
592
  function bucketMods(resolved) {
3822
593
  const cached = _bucketModsCache.get(resolved);
3823
594
  if (cached) return cached;
3824
- const interactiveMods = getInteractiveModifiers();
3825
- const modeMods = getModeModifiers();
3826
- const responsiveMods = getResponsiveModifiers();
595
+ const interactiveMods = (0, import_core6.getInteractiveModifiers)();
596
+ const modeMods = (0, import_core6.getModeModifiers)();
597
+ const responsiveMods = (0, import_core6.getResponsiveModifiers)();
3827
598
  let interactive = false;
3828
599
  let modeOrResponsive = false;
3829
600
  for (const key of Object.keys(resolved)) {
@@ -3856,18 +627,22 @@ function makeElement(isStaticChildren, type, props, key) {
3856
627
  }
3857
628
  function processElement(type, rawProps, key, isStaticChildren) {
3858
629
  if (type === null || typeof type === "symbol") return makeElement(isStaticChildren, type, rawProps ?? {}, key);
3859
- const webTag = getEffectiveIsWeb() ? getWebTag(type, rawProps ?? void 0) : null;
630
+ const webTag = (0, import_core6.getEffectiveIsWeb)() ? getWebTag(type, rawProps ?? void 0) : null;
3860
631
  const effectiveType = webTag ?? type;
3861
632
  const originalName = webTag ? type?.displayName ?? type?.name : void 0;
3862
633
  if (!rawProps) return (0, import_jsx_runtime.jsx)(effectiveType, null, key);
3863
634
  const workingProps = webTag && originalName ? transformToWebProps(originalName, webTag, rawProps) : rawProps;
3864
635
  const { className, kb: kbProp, __kbachStyles, __kbachClasses } = workingProps;
3865
- const classStr = className ?? kbProp ?? __kbachClasses;
3866
- if (!isNative && isRuntimeCSSDisabled() && classStr && !__kbachStyles) {
636
+ const classStrRaw = className ?? kbProp ?? __kbachClasses;
637
+ if (classStrRaw !== void 0 && typeof classStrRaw !== "string") {
638
+ return makeElement(isStaticChildren, effectiveType, workingProps, key);
639
+ }
640
+ const classStr = classStrRaw;
641
+ if (!import_core6.isNative && (0, import_core6.isRuntimeCSSDisabled)() && classStr && !__kbachStyles) {
3867
642
  const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
3868
643
  return makeElement(isStaticChildren, effectiveType, {
3869
644
  ...passProps2,
3870
- className: normalizeClassString(classStr),
645
+ className: (0, import_core6.normalizeClassString)(classStr),
3871
646
  ...userStyle2 !== void 0 ? { style: userStyle2 } : {}
3872
647
  }, key);
3873
648
  }
@@ -3880,22 +655,22 @@ function processElement(type, rawProps, key, isStaticChildren) {
3880
655
  }, key);
3881
656
  }
3882
657
  if (!classStr && !__kbachStyles) {
3883
- if (getEffectiveIsWeb()) return makeElement(isStaticChildren, effectiveType, omitConsumed(workingProps), key);
658
+ if ((0, import_core6.getEffectiveIsWeb)()) return makeElement(isStaticChildren, effectiveType, omitConsumed(workingProps), key);
3884
659
  const defaultFont = getCachedDefaultFont();
3885
660
  if (!defaultFont) return makeElement(isStaticChildren, effectiveType, workingProps, key);
3886
661
  const { style: userStyle2, ...passProps2 } = omitConsumed(workingProps);
3887
662
  const finalStyle2 = userStyle2 ? Array.isArray(userStyle2) ? { fontFamily: defaultFont, ...Object.assign({}, ...userStyle2) } : { fontFamily: defaultFont, ...userStyle2 } : { fontFamily: defaultFont };
3888
663
  return makeElement(isStaticChildren, effectiveType, { ...passProps2, style: finalStyle2 }, key);
3889
664
  }
3890
- const config = getConfig();
3891
- const resolved = !isWeb && __kbachStyles != null ? __kbachStyles : classStr ? resolve(classStr, config.theme, config.darkMode) : {};
665
+ const config = (0, import_core6.getConfig)();
666
+ const resolved = !import_core6.isWeb && __kbachStyles != null ? __kbachStyles : classStr ? (0, import_core6.resolve)(classStr, config.theme, config.darkMode) : {};
3892
667
  const { style: userStyle, ...passProps } = omitConsumed(workingProps);
3893
668
  const { interactive, modeOrResponsive } = bucketMods(resolved);
3894
669
  if (interactive) {
3895
670
  return (0, import_jsx_runtime.jsx)(InteractiveWrapper, {
3896
671
  Component: effectiveType,
3897
672
  resolvedStyle: resolved,
3898
- ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
673
+ ...!import_core6.isNative && classStr ? { className: (0, import_core6.normalizeClassString)(classStr) } : {},
3899
674
  style: userStyle,
3900
675
  ...passProps
3901
676
  }, key);
@@ -3904,15 +679,15 @@ function processElement(type, rawProps, key, isStaticChildren) {
3904
679
  return (0, import_jsx_runtime.jsx)(DarkWrapper, {
3905
680
  Component: effectiveType,
3906
681
  resolvedStyle: resolved,
3907
- ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {},
682
+ ...!import_core6.isNative && classStr ? { className: (0, import_core6.normalizeClassString)(classStr) } : {},
3908
683
  style: userStyle,
3909
684
  ...passProps
3910
685
  }, key);
3911
686
  }
3912
- const skipComputedInline = getEffectiveIsWeb();
687
+ const skipComputedInline = (0, import_core6.getEffectiveIsWeb)();
3913
688
  let finalStyle;
3914
689
  if (!skipComputedInline) {
3915
- const computedStyle = flatten(resolved, false);
690
+ const computedStyle = (0, import_core6.flatten)(resolved, false);
3916
691
  stripInternalMarkers(computedStyle);
3917
692
  if (typeof effectiveType !== "string") stripWebOnlyProps(computedStyle);
3918
693
  finalStyle = mergeStyle(computedStyle, userStyle);
@@ -3922,7 +697,7 @@ function processElement(type, rawProps, key, isStaticChildren) {
3922
697
  return makeElement(isStaticChildren, effectiveType, {
3923
698
  ...passProps,
3924
699
  ...finalStyle !== void 0 ? { style: finalStyle } : {},
3925
- ...!isNative && classStr ? { className: normalizeClassString(classStr) } : {}
700
+ ...!import_core6.isNative && classStr ? { className: (0, import_core6.normalizeClassString)(classStr) } : {}
3926
701
  }, key);
3927
702
  }
3928
703
  function jsx(type, props, key) {