@kbach/react-native 1.0.0-beta.0 → 1.0.0-beta.10

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.
Files changed (45) hide show
  1. package/README.md +103 -54
  2. package/android/build.gradle +36 -0
  3. package/android/src/main/AndroidManifest.xml +14 -0
  4. package/android/src/main/java/com/kbachnative/KbachModule.kt +83 -0
  5. package/android/src/main/java/com/kbachnative/KbachPackage.kt +54 -0
  6. package/android/src/main/jniLibs/arm64-v8a/libkbach_core_engine.so +0 -0
  7. package/android/src/main/jniLibs/x86_64/libkbach_core_engine.so +0 -0
  8. package/dist/chunk-4N7UEVQL.mjs +14 -0
  9. package/dist/{chunk-SVMYVXY6.mjs → chunk-DLIXI5OW.mjs} +23 -14
  10. package/dist/chunk-H5Z24XX5.mjs +192 -0
  11. package/dist/{chunk-YHF3QLRL.mjs → chunk-HK6PDJJK.mjs} +61 -68
  12. package/dist/chunk-RBJXE32L.mjs +73 -0
  13. package/dist/chunk-TDWBXJH5.mjs +186 -0
  14. package/dist/chunk-XHL653X2.mjs +1211 -0
  15. package/dist/chunk-YOC3SHF5.mjs +40 -0
  16. package/dist/index.d.mts +37 -102
  17. package/dist/index.d.ts +37 -102
  18. package/dist/index.js +1411 -38
  19. package/dist/index.mjs +19 -61
  20. package/dist/index.web.d.mts +15 -0
  21. package/dist/index.web.d.ts +15 -0
  22. package/dist/index.web.js +829 -0
  23. package/dist/index.web.mjs +38 -0
  24. package/dist/jsx-dev-runtime.d.mts +3 -12
  25. package/dist/jsx-dev-runtime.d.ts +3 -12
  26. package/dist/jsx-dev-runtime.js +1314 -47
  27. package/dist/jsx-dev-runtime.mjs +9 -11
  28. package/dist/jsx-dev-runtime.web.d.mts +10 -0
  29. package/dist/jsx-dev-runtime.web.d.ts +10 -0
  30. package/dist/jsx-dev-runtime.web.js +618 -0
  31. package/dist/jsx-dev-runtime.web.mjs +17 -0
  32. package/dist/jsx-runtime.d.mts +3 -23
  33. package/dist/jsx-runtime.d.ts +3 -23
  34. package/dist/jsx-runtime.js +1305 -39
  35. package/dist/jsx-runtime.mjs +7 -3
  36. package/dist/jsx-runtime.web.d.mts +7 -0
  37. package/dist/jsx-runtime.web.d.ts +7 -0
  38. package/dist/jsx-runtime.web.js +602 -0
  39. package/dist/jsx-runtime.web.mjs +12 -0
  40. package/dist/useColors-C6jyCLuG.d.mts +239 -0
  41. package/dist/useColors-C6jyCLuG.d.ts +239 -0
  42. package/package.json +57 -5
  43. package/react-native.config.js +29 -0
  44. package/specs/NativeKbachModule.ts +31 -0
  45. package/src/babel-plugin.js +74 -2
@@ -25,12 +25,47 @@ __export(jsx_runtime_exports, {
25
25
  jsxs: () => jsxs
26
26
  });
27
27
  module.exports = __toCommonJS(jsx_runtime_exports);
28
+
29
+ // src/jsxRuntimeCore.ts
28
30
  var import_jsx_runtime = require("react/jsx-runtime");
29
31
  var import_react = require("react");
30
- var import_react_native3 = require("react-native");
32
+ var import_react_native = require("react-native");
33
+ function makeElement(isStaticChildren, type, props, key) {
34
+ return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
35
+ }
36
+ function resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, pressed) {
37
+ const resolved = resolveStyle2(classStrRaw, pressed);
38
+ if (userStyle === void 0) {
39
+ return resolved;
40
+ }
41
+ if (typeof userStyle === "function") {
42
+ return [resolved, userStyle({ pressed })];
43
+ }
44
+ return [resolved, userStyle];
45
+ }
46
+ function processElement(resolveStyle2, type, rawProps, key, isStaticChildren) {
47
+ if (type === null || typeof type === "symbol" || !rawProps) {
48
+ return makeElement(isStaticChildren, type, rawProps ?? {}, key);
49
+ }
50
+ const { className: classStrRaw, style: userStyle, ...rest } = rawProps;
51
+ if (typeof classStrRaw !== "string") {
52
+ return makeElement(isStaticChildren, type, rawProps, key);
53
+ }
54
+ const finalStyle = type === import_react_native.Pressable ? (state) => resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, state.pressed) : resolvedStyleFor(resolveStyle2, classStrRaw, userStyle, false);
55
+ return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
56
+ }
57
+ function createJsxFunctions(resolveStyle2) {
58
+ function jsx2(type, props, key) {
59
+ return processElement(resolveStyle2, type, props, key, false);
60
+ }
61
+ function jsxs2(type, props, key) {
62
+ return processElement(resolveStyle2, type, props, key, true);
63
+ }
64
+ return { jsx: jsx2, jsxs: jsxs2 };
65
+ }
31
66
 
32
67
  // src/nativeBridge.ts
33
- var import_react_native2 = require("react-native");
68
+ var import_react_native3 = require("react-native");
34
69
 
35
70
  // src/generatedPalette.ts
36
71
  var PALETTE = {
@@ -312,39 +347,110 @@ var PALETTE = {
312
347
  // src/theme.ts
313
348
  var defaultTheme = {
314
349
  colors: PALETTE,
350
+ // Real Tailwind's default spacing scale in full — every step is exactly
351
+ // `n * 4px`, including the fractional `.5` steps (`1.5` -> 6px, `2.5` ->
352
+ // 10px, `3.5` -> 14px) and the "px" literal (a bare 1px). Only the
353
+ // "usual stops", though — `jsEngine/shared.ts`'s `spacingPx` (and the
354
+ // native Rust dispatcher's own `spacing_px`) falls back to Tailwind v4's
355
+ // live `n * 4px` formula for any bare numeric step not listed here
356
+ // (`p-0.25`, `w-13`, ...), so this table names the common values and
357
+ // gives a theme override something to target, not the full resolvable
358
+ // set. Mirrors @kbach/react's theme.ts exactly.
315
359
  spacing: {
316
- // "0" is always a hardcoded zero in real Tailwind's own scale too,
317
- // regardless of the base spacing unit — needed for `p-0`/`m-0`/etc.
318
- // Mirrors the identical fix in @kbach/react's theme.ts.
319
360
  "0": 0,
361
+ "px": 1,
362
+ "0.5": 2,
320
363
  "1": 4,
364
+ "1.5": 6,
321
365
  "2": 8,
366
+ "2.5": 10,
367
+ "3": 12,
368
+ "3.5": 14,
322
369
  "4": 16,
370
+ "5": 20,
323
371
  "6": 24,
324
- "8": 32
372
+ "7": 28,
373
+ "8": 32,
374
+ "9": 36,
375
+ "10": 40,
376
+ "11": 44,
377
+ "12": 48,
378
+ "14": 56,
379
+ "16": 64,
380
+ "20": 80,
381
+ "24": 96,
382
+ "28": 112,
383
+ "32": 128,
384
+ "36": 144,
385
+ "40": 160,
386
+ "44": 176,
387
+ "48": 192,
388
+ "52": 208,
389
+ "56": 224,
390
+ "60": 240,
391
+ "64": 256,
392
+ "72": 288,
393
+ "80": 320,
394
+ "96": 384
395
+ },
396
+ screens: {
397
+ sm: 640,
398
+ md: 768,
399
+ lg: 1024,
400
+ xl: 1280,
401
+ "2xl": 1536
325
402
  },
326
- screens: {},
327
- darkMode: "attribute"
403
+ // Byte-for-byte the same three stacks
404
+ // packages/core-engine/src/resolvers/typography.rs's `font_family_value`
405
+ // falls back to. On native these three still effectively no-op (see
406
+ // `first_font_name`'s own doc comment for why a generic CSS keyword
407
+ // isn't a real loadable font) — only a caller-configured custom name
408
+ // changes native rendering; Expo Web uses the full stack as-is.
409
+ fontFamily: {
410
+ sans: 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
411
+ serif: 'ui-serif, Georgia, Cambria, "Times New Roman", Times, serif',
412
+ mono: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
413
+ },
414
+ darkMode: "attribute",
415
+ // Empty by default, matching real Tailwind's own defaults.
416
+ container: {}
328
417
  };
418
+ var activeTheme = defaultTheme;
329
419
  var activeThemeJson = JSON.stringify(defaultTheme);
420
+ function getTheme() {
421
+ return activeTheme;
422
+ }
330
423
  function getThemeJson() {
331
424
  return activeThemeJson;
332
425
  }
333
426
 
334
427
  // src/darkModeStore.ts
335
- var import_react_native = require("react-native");
428
+ var import_react_native2 = require("react-native");
336
429
  var listeners = /* @__PURE__ */ new Set();
337
430
  function systemPrefersDark() {
338
- return import_react_native.Appearance.getColorScheme() === "dark";
431
+ return import_react_native2.Appearance.getColorScheme() === "dark";
339
432
  }
340
433
  function resolveIsDark(m) {
341
434
  return m === "system" ? systemPrefersDark() : m === "dark";
342
435
  }
436
+ function applyToDom(dark) {
437
+ if (typeof document === "undefined") return;
438
+ const root = document.documentElement;
439
+ const strategy = getTheme().darkMode;
440
+ if (strategy === "class") {
441
+ root.classList.toggle("dark", dark);
442
+ root.classList.toggle("light", !dark);
443
+ } else if (strategy === "attribute") {
444
+ root.setAttribute("data-theme", dark ? "dark" : "light");
445
+ }
446
+ }
343
447
  var mode = "system";
344
448
  var isDark = resolveIsDark(mode);
345
- var subscription = import_react_native.Appearance.addChangeListener(({ colorScheme }) => {
449
+ applyToDom(isDark);
450
+ var subscription = import_react_native2.Appearance.addChangeListener(({ colorScheme }) => {
346
451
  if (mode !== "system") return;
347
452
  isDark = colorScheme === "dark";
453
+ applyToDom(isDark);
348
454
  notify();
349
455
  });
350
456
  function notify() {
@@ -354,45 +460,1205 @@ function getGlobalDarkMode() {
354
460
  return isDark;
355
461
  }
356
462
 
357
- // src/nativeBridge.ts
358
- function resolveStyle(classString, pressed = false) {
359
- const KbachModule = import_react_native2.TurboModuleRegistry.getEnforcing("KbachModule");
360
- const colorScheme = getGlobalDarkMode() ? "dark" : "light";
361
- const json = KbachModule.resolveStyle(classString, getThemeJson(), colorScheme, pressed);
362
- return JSON.parse(json);
463
+ // src/jsEngine/parser.ts
464
+ var VALUE_PREFIXES = [
465
+ "bg-opacity-",
466
+ "text-opacity-",
467
+ "bg-blend-",
468
+ "text-shadow-",
469
+ "bg-",
470
+ "text-",
471
+ "border-x-",
472
+ "border-y-",
473
+ "border-t-",
474
+ "border-r-",
475
+ "border-b-",
476
+ "border-l-",
477
+ "border-",
478
+ "caret-",
479
+ "accent-",
480
+ "fill-",
481
+ "stroke-width-",
482
+ "stroke-",
483
+ "resize-",
484
+ "touch-",
485
+ "will-change-",
486
+ "scroll-mx-",
487
+ "scroll-my-",
488
+ "scroll-mt-",
489
+ "scroll-mr-",
490
+ "scroll-mb-",
491
+ "scroll-ml-",
492
+ "scroll-m-",
493
+ "scroll-px-",
494
+ "scroll-py-",
495
+ "scroll-pt-",
496
+ "scroll-pr-",
497
+ "scroll-pb-",
498
+ "scroll-pl-",
499
+ "scroll-p-",
500
+ "px-",
501
+ "py-",
502
+ "pt-",
503
+ "pr-",
504
+ "pb-",
505
+ "pl-",
506
+ "p-",
507
+ "mx-",
508
+ "my-",
509
+ "mt-",
510
+ "mr-",
511
+ "mb-",
512
+ "ml-",
513
+ "m-",
514
+ "gap-x-",
515
+ "gap-y-",
516
+ "gap-",
517
+ "min-w-",
518
+ "max-w-",
519
+ "w-",
520
+ "min-h-",
521
+ "max-h-",
522
+ "h-",
523
+ "size-",
524
+ "basis-",
525
+ "rounded-tl-",
526
+ "rounded-tr-",
527
+ "rounded-br-",
528
+ "rounded-bl-",
529
+ "rounded-t-",
530
+ "rounded-r-",
531
+ "rounded-b-",
532
+ "rounded-l-",
533
+ "rounded-",
534
+ "ring-offset-",
535
+ "ring-",
536
+ "outline-offset-",
537
+ "outline-",
538
+ "shadow-",
539
+ "opacity-",
540
+ "duration-",
541
+ "delay-",
542
+ "ease-",
543
+ "cursor-",
544
+ "mix-blend-",
545
+ "animate-",
546
+ "leading-",
547
+ "tracking-",
548
+ "font-",
549
+ "z-",
550
+ "inset-",
551
+ "top-",
552
+ "right-",
553
+ "bottom-",
554
+ "left-",
555
+ "divide-color-",
556
+ "space-x-",
557
+ "space-y-",
558
+ "flex-",
559
+ "grow-",
560
+ "shrink-",
561
+ "order-",
562
+ "grid-cols-",
563
+ "grid-rows-",
564
+ "grid-flow-",
565
+ "auto-cols-",
566
+ "auto-rows-",
567
+ "col-span-",
568
+ "col-start-",
569
+ "col-end-",
570
+ "col-",
571
+ "row-span-",
572
+ "row-start-",
573
+ "row-end-",
574
+ "row-",
575
+ "place-items-",
576
+ "place-content-",
577
+ "place-self-",
578
+ "justify-items-",
579
+ "justify-self-",
580
+ "scale-x-",
581
+ "scale-y-",
582
+ "scale-",
583
+ "rotate-",
584
+ "translate-x-",
585
+ "translate-y-",
586
+ "skew-x-",
587
+ "skew-y-",
588
+ "origin-",
589
+ "blur-",
590
+ "brightness-",
591
+ "contrast-",
592
+ "grayscale-",
593
+ "hue-rotate-",
594
+ "invert-",
595
+ "saturate-",
596
+ "sepia-",
597
+ "drop-shadow-",
598
+ "filter-",
599
+ "backdrop-blur-",
600
+ "backdrop-brightness-",
601
+ "backdrop-contrast-",
602
+ "backdrop-grayscale-",
603
+ "backdrop-hue-rotate-",
604
+ "backdrop-invert-",
605
+ "backdrop-opacity-",
606
+ "backdrop-saturate-",
607
+ "backdrop-sepia-",
608
+ "backdrop-filter-",
609
+ "decoration-",
610
+ "underline-offset-",
611
+ "indent-",
612
+ "from-",
613
+ "via-",
614
+ "to-"
615
+ ];
616
+ var ARBITRARY_PROPERTY_SENTINEL = "[arbitrary-property]";
617
+ function isSafeArbitraryValue(value) {
618
+ return !value.includes("{") && !value.includes("}") && !value.includes(";");
619
+ }
620
+ function splitRespectingBrackets(token) {
621
+ const parts = [];
622
+ let depth = 0;
623
+ let start = 0;
624
+ for (let i = 0; i < token.length; i++) {
625
+ const ch = token[i];
626
+ if (ch === "[") depth += 1;
627
+ else if (ch === "]") depth -= 1;
628
+ else if (ch === ":" && depth <= 0) {
629
+ parts.push(token.slice(start, i));
630
+ start = i + 1;
631
+ }
632
+ }
633
+ parts.push(token.slice(start));
634
+ return parts;
635
+ }
636
+ function parseClass(token) {
637
+ const parts = splitRespectingBrackets(token);
638
+ let base = parts.pop() ?? token;
639
+ const modifiers = parts;
640
+ const important = base.startsWith("!");
641
+ if (important) {
642
+ base = base.slice(1);
643
+ }
644
+ const negative = base.startsWith("-");
645
+ if (negative) {
646
+ base = base.slice(1);
647
+ }
648
+ if (base.length >= 2 && base.startsWith("[") && base.endsWith("]")) {
649
+ const raw = base.slice(1, -1);
650
+ const colonIdx = raw.indexOf(":");
651
+ if (colonIdx !== -1) {
652
+ const property = raw.slice(0, colonIdx);
653
+ const rawValue = raw.slice(colonIdx + 1);
654
+ if (property !== "" && rawValue !== "" && isSafeArbitraryValue(raw)) {
655
+ const value = rawValue.replace(/_/g, " ");
656
+ return {
657
+ modifiers,
658
+ utility: ARBITRARY_PROPERTY_SENTINEL,
659
+ value: `${property}:${value}`,
660
+ isArbitrary: true,
661
+ important,
662
+ negative,
663
+ original: token
664
+ };
665
+ }
666
+ }
667
+ }
668
+ for (const prefix of VALUE_PREFIXES) {
669
+ if (!base.startsWith(prefix)) continue;
670
+ const value = base.slice(prefix.length);
671
+ if (value === "") continue;
672
+ if (value.length >= 2 && value.startsWith("[") && value.endsWith("]")) {
673
+ const raw = value.slice(1, -1);
674
+ if (!isSafeArbitraryValue(raw)) {
675
+ continue;
676
+ }
677
+ const spaced = raw.replace(/_/g, " ");
678
+ return {
679
+ modifiers,
680
+ utility: prefix.slice(0, -1),
681
+ value: spaced,
682
+ isArbitrary: true,
683
+ important,
684
+ negative,
685
+ original: token
686
+ };
687
+ }
688
+ return {
689
+ modifiers,
690
+ utility: prefix.slice(0, -1),
691
+ value,
692
+ isArbitrary: false,
693
+ important,
694
+ negative,
695
+ original: token
696
+ };
697
+ }
698
+ return {
699
+ modifiers,
700
+ utility: base,
701
+ value: null,
702
+ isArbitrary: false,
703
+ important,
704
+ negative,
705
+ original: token
706
+ };
363
707
  }
364
708
 
365
- // src/jsx-runtime.tsx
366
- function makeElement(isStaticChildren, type, props, key) {
367
- return (isStaticChildren ? import_jsx_runtime.jsxs : import_jsx_runtime.jsx)(type, props, key);
709
+ // src/jsEngine/shared.ts
710
+ function decl(property, value) {
711
+ return { property, value };
368
712
  }
369
- function resolvedStyleFor(classStrRaw, userStyle, pressed) {
370
- const resolved = resolveStyle(classStrRaw, pressed);
371
- if (userStyle === void 0) {
372
- return resolved;
713
+ function spacingPx(theme, value) {
714
+ const fromTable = theme.spacing[value];
715
+ if (fromTable !== void 0) return fromTable;
716
+ const n = Number(value);
717
+ return Number.isFinite(n) && value.trim() !== "" ? n * 4 : void 0;
718
+ }
719
+ function resolveLength(theme, parsed) {
720
+ if (parsed.negative) return null;
721
+ const value = parsed.value;
722
+ if (value === null) return null;
723
+ if (parsed.isArbitrary) return value;
724
+ if (value === "full") return "100%";
725
+ if (value === "auto") return "auto";
726
+ const px = spacingPx(theme, value);
727
+ return px === void 0 ? null : `${px}px`;
728
+ }
729
+ function resolveNegatableLength(theme, parsed) {
730
+ if (!parsed.negative) return resolveLength(theme, parsed);
731
+ if (parsed.isArbitrary) return null;
732
+ const value = parsed.value;
733
+ if (value === null) return null;
734
+ const px = spacingPx(theme, value);
735
+ if (px === void 0) return null;
736
+ if (px === 0) return "0px";
737
+ return `-${px}px`;
738
+ }
739
+
740
+ // src/jsEngine/resolvers/layout.ts
741
+ function negateRaw(value, negative) {
742
+ return negative ? `-${value}` : value;
743
+ }
744
+ function resolve(parsed, theme) {
745
+ switch (parsed.utility) {
746
+ case "flex":
747
+ return parsed.value === null ? [decl("display", "flex")] : null;
748
+ case "grid":
749
+ return [decl("display", "grid")];
750
+ case "block":
751
+ return [decl("display", "block")];
752
+ case "inline-block":
753
+ return [decl("display", "inline-block")];
754
+ case "inline":
755
+ return [decl("display", "inline")];
756
+ case "inline-flex":
757
+ return [decl("display", "inline-flex")];
758
+ case "inline-grid":
759
+ return [decl("display", "inline-grid")];
760
+ case "contents":
761
+ return [decl("display", "contents")];
762
+ case "flow-root":
763
+ return [decl("display", "flow-root")];
764
+ case "hidden":
765
+ return [decl("display", "none")];
766
+ case "@container":
767
+ return [decl("container-type", "inline-size")];
768
+ case "items-center":
769
+ return [decl("align-items", "center")];
770
+ case "items-start":
771
+ return [decl("align-items", "flex-start")];
772
+ case "items-end":
773
+ return [decl("align-items", "flex-end")];
774
+ case "items-baseline":
775
+ return [decl("align-items", "baseline")];
776
+ case "items-stretch":
777
+ return [decl("align-items", "stretch")];
778
+ case "justify-center":
779
+ return [decl("justify-content", "center")];
780
+ case "justify-start":
781
+ return [decl("justify-content", "flex-start")];
782
+ case "justify-end":
783
+ return [decl("justify-content", "flex-end")];
784
+ case "justify-between":
785
+ return [decl("justify-content", "space-between")];
786
+ case "justify-around":
787
+ return [decl("justify-content", "space-around")];
788
+ case "justify-evenly":
789
+ return [decl("justify-content", "space-evenly")];
790
+ case "content-start":
791
+ return [decl("align-content", "flex-start")];
792
+ case "content-end":
793
+ return [decl("align-content", "flex-end")];
794
+ case "content-center":
795
+ return [decl("align-content", "center")];
796
+ case "content-between":
797
+ return [decl("align-content", "space-between")];
798
+ case "content-around":
799
+ return [decl("align-content", "space-around")];
800
+ case "content-evenly":
801
+ return [decl("align-content", "space-evenly")];
802
+ case "content-stretch":
803
+ return [decl("align-content", "stretch")];
804
+ case "self-auto":
805
+ return [decl("align-self", "auto")];
806
+ case "self-center":
807
+ return [decl("align-self", "center")];
808
+ case "self-start":
809
+ return [decl("align-self", "flex-start")];
810
+ case "self-end":
811
+ return [decl("align-self", "flex-end")];
812
+ case "self-stretch":
813
+ return [decl("align-self", "stretch")];
814
+ case "self-baseline":
815
+ return [decl("align-self", "baseline")];
816
+ case "overflow-hidden":
817
+ return [decl("overflow", "hidden")];
818
+ case "overflow-auto":
819
+ return [decl("overflow", "auto")];
820
+ case "overflow-scroll":
821
+ return [decl("overflow", "scroll")];
822
+ case "overflow-visible":
823
+ return [decl("overflow", "visible")];
824
+ case "static":
825
+ return [decl("position", "static")];
826
+ case "relative":
827
+ return [decl("position", "relative")];
828
+ case "absolute":
829
+ return [decl("position", "absolute")];
830
+ case "fixed":
831
+ return [decl("position", "fixed")];
832
+ case "sticky":
833
+ return [decl("position", "sticky")];
834
+ case "z":
835
+ return parsed.value === null ? null : [decl("z-index", negateRaw(parsed.value, parsed.negative))];
836
+ case "order":
837
+ return parsed.value === null ? null : [decl("order", negateRaw(parsed.value, parsed.negative))];
838
+ case "grow":
839
+ return [decl("flex-grow", parsed.value ?? "1")];
840
+ case "shrink":
841
+ return [decl("flex-shrink", parsed.value ?? "1")];
842
+ // top/right/bottom/left/inset support real Tailwind's negative-value
843
+ // convention ("-top-4") — see resolveNegatableLength's own doc comment.
844
+ case "top": {
845
+ const v = resolveNegatableLength(theme, parsed);
846
+ return v === null ? null : [decl("top", v)];
847
+ }
848
+ case "right": {
849
+ const v = resolveNegatableLength(theme, parsed);
850
+ return v === null ? null : [decl("right", v)];
851
+ }
852
+ case "bottom": {
853
+ const v = resolveNegatableLength(theme, parsed);
854
+ return v === null ? null : [decl("bottom", v)];
855
+ }
856
+ case "left": {
857
+ const v = resolveNegatableLength(theme, parsed);
858
+ return v === null ? null : [decl("left", v)];
859
+ }
860
+ case "inset": {
861
+ const v = resolveNegatableLength(theme, parsed);
862
+ return v === null ? null : [decl("inset", v)];
863
+ }
864
+ case "aspect-square":
865
+ return [decl("aspect-ratio", "1 / 1")];
866
+ case "aspect-video":
867
+ return [decl("aspect-ratio", "16 / 9")];
868
+ default:
869
+ return null;
373
870
  }
374
- if (typeof userStyle === "function") {
375
- return [resolved, userStyle({ pressed })];
871
+ }
872
+ function resolveFlex(parsed, web) {
873
+ if (parsed.utility !== "flex") return null;
874
+ const value = parsed.value;
875
+ if (value === null) return null;
876
+ if (parsed.isArbitrary) return [decl("flex", value)];
877
+ switch (value) {
878
+ case "row":
879
+ return [decl("flex-direction", "row")];
880
+ case "col":
881
+ return [decl("flex-direction", "column")];
882
+ case "row-reverse":
883
+ return [decl("flex-direction", "row-reverse")];
884
+ case "col-reverse":
885
+ return [decl("flex-direction", "column-reverse")];
886
+ case "wrap":
887
+ return [decl("flex-wrap", "wrap")];
888
+ case "wrap-reverse":
889
+ return [decl("flex-wrap", "wrap-reverse")];
890
+ case "nowrap":
891
+ return [decl("flex-wrap", "nowrap")];
892
+ case "1":
893
+ return [decl("flex", "1")];
894
+ case "auto":
895
+ return [decl("flex", web ? "auto" : "1")];
896
+ case "initial":
897
+ return [decl("flex", web ? "initial" : "1")];
898
+ case "none":
899
+ return [decl("flex", web ? "none" : "0")];
900
+ case "grow":
901
+ return [decl("flex-grow", "1")];
902
+ case "grow-0":
903
+ return [decl("flex-grow", "0")];
904
+ case "shrink":
905
+ return [decl("flex-shrink", "1")];
906
+ case "shrink-0":
907
+ return [decl("flex-shrink", "0")];
908
+ default:
909
+ return null;
376
910
  }
377
- return [resolved, userStyle];
378
911
  }
379
- function processElement(type, rawProps, key, isStaticChildren) {
380
- if (type === null || typeof type === "symbol" || !rawProps) {
381
- return makeElement(isStaticChildren, type, rawProps ?? {}, key);
912
+
913
+ // src/jsEngine/resolvers/spacing.ts
914
+ function namedSize(key) {
915
+ switch (key) {
916
+ case "sm":
917
+ return "24rem";
918
+ case "md":
919
+ return "28rem";
920
+ case "lg":
921
+ return "32rem";
922
+ case "xl":
923
+ return "36rem";
924
+ case "2xl":
925
+ return "42rem";
926
+ case "3xl":
927
+ return "48rem";
928
+ case "4xl":
929
+ return "56rem";
930
+ case "5xl":
931
+ return "64rem";
932
+ case "6xl":
933
+ return "72rem";
934
+ case "7xl":
935
+ return "80rem";
936
+ case "8xl":
937
+ return "88rem";
938
+ case "9xl":
939
+ return "96rem";
940
+ default:
941
+ return null;
382
942
  }
383
- const { className: classStrRaw, style: userStyle, ...rest } = rawProps;
384
- if (typeof classStrRaw !== "string") {
385
- return makeElement(isStaticChildren, type, rawProps, key);
943
+ }
944
+ function fractionPercent(value) {
945
+ const slashIdx = value.indexOf("/");
946
+ if (slashIdx === -1) return null;
947
+ const numStr = value.slice(0, slashIdx);
948
+ const denStr = value.slice(slashIdx + 1);
949
+ const num = Number(numStr);
950
+ const den = Number(denStr);
951
+ if (!Number.isFinite(num) || !Number.isFinite(den) || numStr.trim() === "" || denStr.trim() === "") return null;
952
+ if (den === 0) return null;
953
+ const pct = num / den * 100;
954
+ const formatted = pct.toFixed(6);
955
+ const trimmed = formatted.replace(/0+$/, "").replace(/\.$/, "");
956
+ return `${trimmed}%`;
957
+ }
958
+ function cssSizeKeyword(key) {
959
+ switch (key) {
960
+ case "min":
961
+ return "min-content";
962
+ case "max":
963
+ return "max-content";
964
+ case "fit":
965
+ return "fit-content";
966
+ default:
967
+ return null;
386
968
  }
387
- const finalStyle = type === import_react_native3.Pressable ? (state) => resolvedStyleFor(classStrRaw, userStyle, state.pressed) : resolvedStyleFor(classStrRaw, userStyle, false);
388
- return makeElement(isStaticChildren, type, { ...rest, style: finalStyle }, key);
389
969
  }
390
- function jsx(type, props, key) {
391
- return processElement(type, props, key, false);
970
+ function resolveSize(theme, parsed) {
971
+ if (!parsed.isArbitrary && parsed.value !== null) {
972
+ const named = namedSize(parsed.value);
973
+ if (named !== null) return named;
974
+ const kw = cssSizeKeyword(parsed.value);
975
+ if (kw !== null) return kw;
976
+ const fraction = fractionPercent(parsed.value);
977
+ if (fraction !== null) return fraction;
978
+ }
979
+ return resolveLength(theme, parsed);
980
+ }
981
+ function resolve2(parsed, theme) {
982
+ const length = () => resolveLength(theme, parsed);
983
+ const size = () => resolveSize(theme, parsed);
984
+ const negatableLength = () => resolveNegatableLength(theme, parsed);
985
+ switch (parsed.utility) {
986
+ case "p": {
987
+ const v = length();
988
+ return v === null ? null : [decl("padding", v)];
989
+ }
990
+ case "px": {
991
+ const v = length();
992
+ return v === null ? null : [decl("padding-left", v), decl("padding-right", v)];
993
+ }
994
+ case "py": {
995
+ const v = length();
996
+ return v === null ? null : [decl("padding-top", v), decl("padding-bottom", v)];
997
+ }
998
+ case "pt": {
999
+ const v = length();
1000
+ return v === null ? null : [decl("padding-top", v)];
1001
+ }
1002
+ case "pr": {
1003
+ const v = length();
1004
+ return v === null ? null : [decl("padding-right", v)];
1005
+ }
1006
+ case "pb": {
1007
+ const v = length();
1008
+ return v === null ? null : [decl("padding-bottom", v)];
1009
+ }
1010
+ case "pl": {
1011
+ const v = length();
1012
+ return v === null ? null : [decl("padding-left", v)];
1013
+ }
1014
+ case "m": {
1015
+ const v = negatableLength();
1016
+ return v === null ? null : [decl("margin", v)];
1017
+ }
1018
+ case "mx": {
1019
+ const v = negatableLength();
1020
+ return v === null ? null : [decl("margin-left", v), decl("margin-right", v)];
1021
+ }
1022
+ case "my": {
1023
+ const v = negatableLength();
1024
+ return v === null ? null : [decl("margin-top", v), decl("margin-bottom", v)];
1025
+ }
1026
+ case "mt": {
1027
+ const v = negatableLength();
1028
+ return v === null ? null : [decl("margin-top", v)];
1029
+ }
1030
+ case "mr": {
1031
+ const v = negatableLength();
1032
+ return v === null ? null : [decl("margin-right", v)];
1033
+ }
1034
+ case "mb": {
1035
+ const v = negatableLength();
1036
+ return v === null ? null : [decl("margin-bottom", v)];
1037
+ }
1038
+ case "ml": {
1039
+ const v = negatableLength();
1040
+ return v === null ? null : [decl("margin-left", v)];
1041
+ }
1042
+ case "gap": {
1043
+ const v = length();
1044
+ return v === null ? null : [decl("gap", v)];
1045
+ }
1046
+ case "gap-x": {
1047
+ const v = length();
1048
+ return v === null ? null : [decl("column-gap", v)];
1049
+ }
1050
+ case "gap-y": {
1051
+ const v = length();
1052
+ return v === null ? null : [decl("row-gap", v)];
1053
+ }
1054
+ case "w": {
1055
+ const v = size();
1056
+ return v === null ? null : [decl("width", v)];
1057
+ }
1058
+ case "h": {
1059
+ const v = size();
1060
+ return v === null ? null : [decl("height", v)];
1061
+ }
1062
+ case "min-w": {
1063
+ const v = size();
1064
+ return v === null ? null : [decl("min-width", v)];
1065
+ }
1066
+ case "max-w": {
1067
+ const v = size();
1068
+ return v === null ? null : [decl("max-width", v)];
1069
+ }
1070
+ case "min-h": {
1071
+ const v = size();
1072
+ return v === null ? null : [decl("min-height", v)];
1073
+ }
1074
+ case "max-h": {
1075
+ const v = size();
1076
+ return v === null ? null : [decl("max-height", v)];
1077
+ }
1078
+ case "size": {
1079
+ const v = size();
1080
+ return v === null ? null : [decl("width", v), decl("height", v)];
1081
+ }
1082
+ case "basis": {
1083
+ const v = size();
1084
+ return v === null ? null : [decl("flex-basis", v)];
1085
+ }
1086
+ default:
1087
+ return null;
1088
+ }
1089
+ }
1090
+
1091
+ // src/jsEngine/resolvers/color.ts
1092
+ function lookupHex(theme, key) {
1093
+ const entry = theme.colors[key];
1094
+ return typeof entry === "string" ? entry : null;
1095
+ }
1096
+
1097
+ // src/jsEngine/resolvers/border.ts
1098
+ function radiusSize(key) {
1099
+ switch (key) {
1100
+ case "none":
1101
+ return "0px";
1102
+ case "sm":
1103
+ return "0.125rem";
1104
+ case "md":
1105
+ return "0.375rem";
1106
+ case "lg":
1107
+ return "0.5rem";
1108
+ case "xl":
1109
+ return "0.75rem";
1110
+ case "2xl":
1111
+ return "1rem";
1112
+ case "3xl":
1113
+ return "1.5rem";
1114
+ case "full":
1115
+ return "9999px";
1116
+ default:
1117
+ return null;
1118
+ }
1119
+ }
1120
+ function borderSideProperty(side) {
1121
+ switch (side) {
1122
+ case "t":
1123
+ return "border-top";
1124
+ case "r":
1125
+ return "border-right";
1126
+ case "b":
1127
+ return "border-bottom";
1128
+ case "l":
1129
+ return "border-left";
1130
+ default:
1131
+ return null;
1132
+ }
1133
+ }
1134
+ function borderValue(theme, parsed) {
1135
+ const value = parsed.value;
1136
+ if (value === null) return null;
1137
+ if (!parsed.isArbitrary) {
1138
+ const side = borderSideProperty(value);
1139
+ if (side !== null) {
1140
+ return [decl(`${side}-width`, "1px"), decl(`${side}-style`, "solid")];
1141
+ }
1142
+ if (value === "collapse") return [decl("border-collapse", "collapse")];
1143
+ if (value === "separate") return [decl("border-collapse", "separate")];
1144
+ }
1145
+ if (parsed.isArbitrary) {
1146
+ return [decl("border-width", value)];
1147
+ }
1148
+ if (Number.isFinite(Number(value)) && value.trim() !== "") {
1149
+ const v = resolveLength(theme, parsed);
1150
+ return v === null ? null : [decl("border-width", v)];
1151
+ }
1152
+ if (value === "solid" || value === "dashed" || value === "dotted" || value === "double" || value === "hidden" || value === "none") {
1153
+ return [decl("border-style", value)];
1154
+ }
1155
+ const hex = lookupHex(theme, value);
1156
+ return hex === null ? null : [decl("border-color", hex)];
1157
+ }
1158
+ function borderSideValue(theme, parsed, sideProperty) {
1159
+ const value = parsed.value;
1160
+ if (value === null) return null;
1161
+ if (parsed.isArbitrary) return [decl(`${sideProperty}-width`, value)];
1162
+ if (Number.isFinite(Number(value)) && value.trim() !== "") {
1163
+ const v = resolveLength(theme, parsed);
1164
+ return v === null ? null : [decl(`${sideProperty}-width`, v)];
1165
+ }
1166
+ if (value === "solid" || value === "dashed" || value === "dotted" || value === "double" || value === "hidden" || value === "none") {
1167
+ return [decl(`${sideProperty}-style`, value)];
1168
+ }
1169
+ const hex = lookupHex(theme, value);
1170
+ return hex === null ? null : [decl(`${sideProperty}-color`, hex)];
1171
+ }
1172
+ function borderAxisValue(theme, parsed, sideA, sideB) {
1173
+ const value = parsed.value;
1174
+ if (value === null) return null;
1175
+ if (parsed.isArbitrary) return [decl(`${sideA}-width`, value), decl(`${sideB}-width`, value)];
1176
+ if (Number.isFinite(Number(value)) && value.trim() !== "") {
1177
+ const v = resolveLength(theme, parsed);
1178
+ return v === null ? null : [decl(`${sideA}-width`, v), decl(`${sideB}-width`, v)];
1179
+ }
1180
+ if (value === "solid" || value === "dashed" || value === "dotted" || value === "double" || value === "hidden" || value === "none") {
1181
+ return [decl(`${sideA}-style`, value), decl(`${sideB}-style`, value)];
1182
+ }
1183
+ const hex = lookupHex(theme, value);
1184
+ return hex === null ? null : [decl(`${sideA}-color`, hex), decl(`${sideB}-color`, hex)];
1185
+ }
1186
+ function radiusProperties(side) {
1187
+ switch (side) {
1188
+ case "t":
1189
+ return ["border-top-left-radius", "border-top-right-radius"];
1190
+ case "r":
1191
+ return ["border-top-right-radius", "border-bottom-right-radius"];
1192
+ case "b":
1193
+ return ["border-bottom-right-radius", "border-bottom-left-radius"];
1194
+ case "l":
1195
+ return ["border-top-left-radius", "border-bottom-left-radius"];
1196
+ case "tl":
1197
+ return ["border-top-left-radius"];
1198
+ case "tr":
1199
+ return ["border-top-right-radius"];
1200
+ case "br":
1201
+ return ["border-bottom-right-radius"];
1202
+ case "bl":
1203
+ return ["border-bottom-left-radius"];
1204
+ default:
1205
+ return null;
1206
+ }
1207
+ }
1208
+ function resolveRadiusValue(theme, parsed) {
1209
+ if (!parsed.isArbitrary && parsed.value !== null) {
1210
+ const size = radiusSize(parsed.value);
1211
+ if (size !== null) return size;
1212
+ }
1213
+ return resolveLength(theme, parsed);
392
1214
  }
393
- function jsxs(type, props, key) {
394
- return processElement(type, props, key, true);
1215
+ function resolveRadiusSide(theme, parsed, side) {
1216
+ const properties = radiusProperties(side);
1217
+ if (properties === null) return null;
1218
+ const value = resolveRadiusValue(theme, parsed);
1219
+ if (value === null) return null;
1220
+ return properties.map((p) => decl(p, value));
395
1221
  }
1222
+ var OUTLINE_STYLES = ["solid", "dashed", "dotted", "double"];
1223
+ function outlineWidthValue(key) {
1224
+ switch (key) {
1225
+ case "0":
1226
+ return "0px";
1227
+ case "1":
1228
+ return "1px";
1229
+ case "2":
1230
+ return "2px";
1231
+ case "4":
1232
+ return "4px";
1233
+ case "8":
1234
+ return "8px";
1235
+ default:
1236
+ return null;
1237
+ }
1238
+ }
1239
+ function outlineValue(theme, parsed) {
1240
+ const value = parsed.value;
1241
+ if (value === null) return null;
1242
+ if (parsed.isArbitrary) return [decl("outline-width", value)];
1243
+ const w = outlineWidthValue(value);
1244
+ if (w !== null) return [decl("outline-width", w)];
1245
+ if (OUTLINE_STYLES.includes(value)) return [decl("outline-style", value)];
1246
+ const hex = lookupHex(theme, value);
1247
+ return hex === null ? null : [decl("outline-color", hex)];
1248
+ }
1249
+ function outlineOffsetValue(parsed) {
1250
+ const value = parsed.value;
1251
+ if (value === null) return null;
1252
+ if (parsed.isArbitrary) return [decl("outline-offset", value)];
1253
+ const w = outlineWidthValue(value);
1254
+ return w === null ? null : [decl("outline-offset", w)];
1255
+ }
1256
+ var RING_BOX_SHADOW = "var(--kb-ring-inset,) 0 0 0 var(--kb-ring-offset-width, 0px) var(--kb-ring-offset-color, #fff), var(--kb-ring-inset,) 0 0 0 calc(var(--kb-ring-width, 0px) + var(--kb-ring-offset-width, 0px)) var(--kb-ring-color, rgba(59,130,246,0.5))";
1257
+ function ringWidth(key) {
1258
+ switch (key) {
1259
+ case "0":
1260
+ return "0px";
1261
+ case "1":
1262
+ return "1px";
1263
+ case "2":
1264
+ return "2px";
1265
+ case "4":
1266
+ return "4px";
1267
+ case "8":
1268
+ return "8px";
1269
+ default:
1270
+ return null;
1271
+ }
1272
+ }
1273
+ function ringValue(theme, parsed) {
1274
+ const value = parsed.value;
1275
+ if (value === null) return null;
1276
+ if (value === "inset") {
1277
+ return [decl("--kb-ring-inset", "inset"), decl("box-shadow", RING_BOX_SHADOW)];
1278
+ }
1279
+ if (!parsed.isArbitrary) {
1280
+ const w = ringWidth(value);
1281
+ if (w !== null) return [decl("--kb-ring-width", w), decl("box-shadow", RING_BOX_SHADOW)];
1282
+ }
1283
+ const color = parsed.isArbitrary ? value : lookupHex(theme, value);
1284
+ if (color === null) return null;
1285
+ return [decl("--kb-ring-color", color), decl("box-shadow", RING_BOX_SHADOW)];
1286
+ }
1287
+ function ringOffsetValue(theme, parsed) {
1288
+ const value = parsed.value;
1289
+ if (value === null) return null;
1290
+ if (!parsed.isArbitrary) {
1291
+ const w = ringWidth(value);
1292
+ if (w !== null) return [decl("--kb-ring-offset-width", w), decl("box-shadow", RING_BOX_SHADOW)];
1293
+ }
1294
+ const color = parsed.isArbitrary ? value : lookupHex(theme, value);
1295
+ if (color === null) return null;
1296
+ return [decl("--kb-ring-offset-color", color), decl("box-shadow", RING_BOX_SHADOW)];
1297
+ }
1298
+ var RADIUS_SIDES = /* @__PURE__ */ new Set(["t", "r", "b", "l", "tl", "tr", "br", "bl"]);
1299
+ function resolve3(parsed, theme) {
1300
+ switch (parsed.utility) {
1301
+ case "border":
1302
+ if (parsed.value === null) return [decl("border-width", "1px"), decl("border-style", "solid")];
1303
+ return borderValue(theme, parsed);
1304
+ case "border-t":
1305
+ return borderSideValue(theme, parsed, "border-top");
1306
+ case "border-r":
1307
+ return borderSideValue(theme, parsed, "border-right");
1308
+ case "border-b":
1309
+ return borderSideValue(theme, parsed, "border-bottom");
1310
+ case "border-l":
1311
+ return borderSideValue(theme, parsed, "border-left");
1312
+ case "border-x":
1313
+ return borderAxisValue(theme, parsed, "border-left", "border-right");
1314
+ case "border-y":
1315
+ return borderAxisValue(theme, parsed, "border-top", "border-bottom");
1316
+ case "rounded": {
1317
+ if (parsed.value === null) return [decl("border-radius", "0.25rem")];
1318
+ const value = parsed.value;
1319
+ if (!parsed.isArbitrary) {
1320
+ const size = radiusSize(value);
1321
+ if (size !== null) return [decl("border-radius", size)];
1322
+ }
1323
+ const v = resolveLength(theme, parsed);
1324
+ return v === null ? null : [decl("border-radius", v)];
1325
+ }
1326
+ case "ring":
1327
+ if (parsed.value === null) return [decl("--kb-ring-width", "3px"), decl("box-shadow", RING_BOX_SHADOW)];
1328
+ return ringValue(theme, parsed);
1329
+ case "ring-offset":
1330
+ return ringOffsetValue(theme, parsed);
1331
+ case "outline":
1332
+ if (parsed.value === null) return [decl("outline-style", "solid")];
1333
+ if (parsed.value === "none") return [decl("outline", "none")];
1334
+ return outlineValue(theme, parsed);
1335
+ case "outline-offset":
1336
+ return outlineOffsetValue(parsed);
1337
+ default:
1338
+ if (parsed.utility.startsWith("rounded-") && RADIUS_SIDES.has(parsed.utility.slice("rounded-".length))) {
1339
+ return resolveRadiusSide(theme, parsed, parsed.utility.slice("rounded-".length));
1340
+ }
1341
+ return null;
1342
+ }
1343
+ }
1344
+
1345
+ // src/jsEngine/resolvers/typography.ts
1346
+ function textSize(key) {
1347
+ switch (key) {
1348
+ case "xs":
1349
+ return "0.75rem";
1350
+ case "sm":
1351
+ return "0.875rem";
1352
+ case "base":
1353
+ return "1rem";
1354
+ case "lg":
1355
+ return "1.125rem";
1356
+ case "xl":
1357
+ return "1.25rem";
1358
+ case "2xl":
1359
+ return "1.5rem";
1360
+ case "3xl":
1361
+ return "1.875rem";
1362
+ case "4xl":
1363
+ return "2.25rem";
1364
+ default:
1365
+ return null;
1366
+ }
1367
+ }
1368
+ function lineHeightSize(key) {
1369
+ switch (key) {
1370
+ case "3":
1371
+ return "0.75rem";
1372
+ case "4":
1373
+ return "1rem";
1374
+ case "5":
1375
+ return "1.25rem";
1376
+ case "6":
1377
+ return "1.5rem";
1378
+ case "7":
1379
+ return "1.75rem";
1380
+ case "8":
1381
+ return "2rem";
1382
+ case "9":
1383
+ return "2.25rem";
1384
+ case "10":
1385
+ return "2.5rem";
1386
+ default:
1387
+ return null;
1388
+ }
1389
+ }
1390
+ function textAlign(key) {
1391
+ switch (key) {
1392
+ case "left":
1393
+ return "left";
1394
+ case "center":
1395
+ return "center";
1396
+ case "right":
1397
+ return "right";
1398
+ case "justify":
1399
+ return "justify";
1400
+ default:
1401
+ return null;
1402
+ }
1403
+ }
1404
+ function fontWeight(key) {
1405
+ switch (key) {
1406
+ case "thin":
1407
+ return "100";
1408
+ case "normal":
1409
+ return "400";
1410
+ case "medium":
1411
+ return "500";
1412
+ case "semibold":
1413
+ return "600";
1414
+ case "bold":
1415
+ return "700";
1416
+ case "extrabold":
1417
+ return "800";
1418
+ default:
1419
+ return null;
1420
+ }
1421
+ }
1422
+
1423
+ // src/jsEngine/resolvers/effects.ts
1424
+ function nativeShadowValue(key) {
1425
+ switch (key) {
1426
+ case "sm":
1427
+ return { offsetY: 1, radius: 2, opacity: 0.05, elevation: 1 };
1428
+ case "DEFAULT":
1429
+ return { offsetY: 1, radius: 3, opacity: 0.1, elevation: 2 };
1430
+ case "md":
1431
+ return { offsetY: 4, radius: 6, opacity: 0.1, elevation: 4 };
1432
+ case "lg":
1433
+ return { offsetY: 10, radius: 15, opacity: 0.1, elevation: 8 };
1434
+ case "xl":
1435
+ return { offsetY: 20, radius: 25, opacity: 0.1, elevation: 12 };
1436
+ case "2xl":
1437
+ return { offsetY: 25, radius: 50, opacity: 0.25, elevation: 16 };
1438
+ case "none":
1439
+ return { offsetY: 0, radius: 0, opacity: 0, elevation: 0 };
1440
+ default:
1441
+ return null;
1442
+ }
1443
+ }
1444
+ function nativeShadowDeclarations(parsed) {
1445
+ if (parsed.utility !== "shadow" || parsed.isArbitrary) return null;
1446
+ const key = parsed.value ?? "DEFAULT";
1447
+ const s = nativeShadowValue(key);
1448
+ if (s === null) return null;
1449
+ return [
1450
+ decl("shadow-color", "#000000"),
1451
+ decl("shadow-offset-x", "0"),
1452
+ decl("shadow-offset-y", String(s.offsetY)),
1453
+ decl("shadow-opacity", String(s.opacity)),
1454
+ decl("shadow-radius", String(s.radius)),
1455
+ decl("elevation", String(s.elevation))
1456
+ ];
1457
+ }
1458
+
1459
+ // src/jsEngine/resolveUtilityNative.ts
1460
+ function resolveTypographyNative(parsed) {
1461
+ switch (parsed.utility) {
1462
+ case "font": {
1463
+ if (parsed.value === null) return null;
1464
+ const w = fontWeight(parsed.value);
1465
+ return w === null ? null : [decl("font-weight", w)];
1466
+ }
1467
+ case "uppercase":
1468
+ return [decl("text-transform", "uppercase")];
1469
+ case "lowercase":
1470
+ return [decl("text-transform", "lowercase")];
1471
+ case "capitalize":
1472
+ return [decl("text-transform", "capitalize")];
1473
+ case "underline":
1474
+ return [decl("text-decoration-line", "underline")];
1475
+ case "line-through":
1476
+ return [decl("text-decoration-line", "line-through")];
1477
+ case "no-underline":
1478
+ return [decl("text-decoration-line", "none")];
1479
+ case "italic":
1480
+ return [decl("font-style", "italic")];
1481
+ case "not-italic":
1482
+ return [decl("font-style", "normal")];
1483
+ default:
1484
+ return null;
1485
+ }
1486
+ }
1487
+ function resolveLeadingTrackingNative(parsed) {
1488
+ const value = parsed.value;
1489
+ if (value === null) return null;
1490
+ if (parsed.utility === "leading") {
1491
+ if (parsed.isArbitrary) return [decl("line-height", value)];
1492
+ const v = lineHeightSize(value);
1493
+ return v === null ? null : [decl("line-height", v)];
1494
+ }
1495
+ if (parsed.utility === "tracking" && parsed.isArbitrary) {
1496
+ return [decl("letter-spacing", value)];
1497
+ }
1498
+ return null;
1499
+ }
1500
+ function nativeHexColor(parsed, theme) {
1501
+ const value = parsed.value;
1502
+ if (value === null) return null;
1503
+ return parsed.isArbitrary ? value : lookupHex(theme, value);
1504
+ }
1505
+ function resolveTextNative(parsed, theme) {
1506
+ if (!parsed.isArbitrary && parsed.value !== null) {
1507
+ const size = textSize(parsed.value);
1508
+ if (size !== null) return [decl("font-size", size)];
1509
+ const align = textAlign(parsed.value);
1510
+ if (align !== null) return [decl("text-align", align)];
1511
+ }
1512
+ const hex = nativeHexColor(parsed, theme);
1513
+ return hex === null ? null : [decl("color", hex)];
1514
+ }
1515
+ function resolveColorNative(parsed, theme) {
1516
+ switch (parsed.utility) {
1517
+ case "bg": {
1518
+ const hex = nativeHexColor(parsed, theme);
1519
+ return hex === null ? null : [decl("background-color", hex)];
1520
+ }
1521
+ case "text":
1522
+ return resolveTextNative(parsed, theme);
1523
+ default:
1524
+ return null;
1525
+ }
1526
+ }
1527
+ function resolveUtilityNative(parsed, theme) {
1528
+ return resolveFlex(parsed, false) ?? resolve(parsed, theme) ?? resolve2(parsed, theme) ?? resolve3(parsed, theme) ?? resolveColorNative(parsed, theme) ?? resolveLeadingTrackingNative(parsed) ?? resolveTypographyNative(parsed) ?? nativeShadowDeclarations(parsed);
1529
+ }
1530
+
1531
+ // src/jsEngine/resolveStyle.ts
1532
+ var RESPONSIVE_BREAKPOINTS = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
1533
+ function nativeModifierState(modifier, theme, colorScheme, pressed, width) {
1534
+ if (modifier === "dark") return colorScheme === "dark";
1535
+ if (modifier === "active") return pressed;
1536
+ if (RESPONSIVE_BREAKPOINTS.has(modifier)) {
1537
+ const minWidth = theme.screens[modifier];
1538
+ if (minWidth === void 0) return null;
1539
+ return width >= minWidth;
1540
+ }
1541
+ return null;
1542
+ }
1543
+ function kebabToCamel(s) {
1544
+ return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
1545
+ }
1546
+ var NUMERIC_LENGTH_PROPS = /* @__PURE__ */ new Set([
1547
+ "padding",
1548
+ "padding-top",
1549
+ "padding-right",
1550
+ "padding-bottom",
1551
+ "padding-left",
1552
+ "margin",
1553
+ "margin-top",
1554
+ "margin-right",
1555
+ "margin-bottom",
1556
+ "margin-left",
1557
+ "gap",
1558
+ "column-gap",
1559
+ "row-gap",
1560
+ "width",
1561
+ "height",
1562
+ "min-width",
1563
+ "max-width",
1564
+ "min-height",
1565
+ "max-height",
1566
+ "top",
1567
+ "right",
1568
+ "bottom",
1569
+ "left",
1570
+ "inset",
1571
+ "border-radius",
1572
+ "border-width",
1573
+ "font-size",
1574
+ "z-index",
1575
+ "line-height",
1576
+ "letter-spacing",
1577
+ "flex",
1578
+ "flex-grow",
1579
+ "flex-shrink",
1580
+ "order",
1581
+ "flex-basis",
1582
+ "shadow-opacity",
1583
+ "shadow-radius",
1584
+ "elevation",
1585
+ // Per-side border width + per-corner radius — see resolvers/border.ts's
1586
+ // new borderSideValue/borderAxisValue/resolveRadiusSide additions; RN's
1587
+ // style system wants plain numbers for these exactly like the generic
1588
+ // "border-width"/"border-radius" forms above.
1589
+ "border-top-width",
1590
+ "border-right-width",
1591
+ "border-bottom-width",
1592
+ "border-left-width",
1593
+ "border-top-left-radius",
1594
+ "border-top-right-radius",
1595
+ "border-bottom-right-radius",
1596
+ "border-bottom-left-radius",
1597
+ "outline-width",
1598
+ "outline-offset"
1599
+ ]);
1600
+ function rnStyleValue(property, value) {
1601
+ if (NUMERIC_LENGTH_PROPS.has(property)) {
1602
+ let px = null;
1603
+ if (value.endsWith("px")) {
1604
+ const n = Number(value.slice(0, -2));
1605
+ px = Number.isFinite(n) ? n : null;
1606
+ } else if (value.endsWith("rem")) {
1607
+ const n = Number(value.slice(0, -3));
1608
+ px = Number.isFinite(n) ? n * 16 : null;
1609
+ } else {
1610
+ const n = Number(value);
1611
+ px = value.trim() !== "" && Number.isFinite(n) ? n : null;
1612
+ }
1613
+ if (px !== null) return px;
1614
+ }
1615
+ return value;
1616
+ }
1617
+ function resolveStyleJs(classString, theme, colorScheme, pressed, width) {
1618
+ const style = {};
1619
+ let shadowOffset = null;
1620
+ for (const token of classString.split(/\s+/).filter(Boolean)) {
1621
+ const parsed = parseClass(token);
1622
+ const allModifiersHold = parsed.modifiers.every(
1623
+ (m) => nativeModifierState(m, theme, colorScheme, pressed, width) === true
1624
+ );
1625
+ if (!allModifiersHold) continue;
1626
+ const decls = resolveUtilityNative(parsed, theme);
1627
+ if (decls === null) continue;
1628
+ for (const d of decls) {
1629
+ if (d.property.startsWith("__")) {
1630
+ continue;
1631
+ }
1632
+ if (d.property === "shadow-offset-x" || d.property === "shadow-offset-y") {
1633
+ const n = Number(d.value);
1634
+ if (!Number.isFinite(n)) continue;
1635
+ if (shadowOffset === null) shadowOffset = {};
1636
+ shadowOffset[d.property === "shadow-offset-x" ? "width" : "height"] = n;
1637
+ continue;
1638
+ }
1639
+ style[kebabToCamel(d.property)] = rnStyleValue(d.property, d.value);
1640
+ }
1641
+ }
1642
+ if (shadowOffset !== null) {
1643
+ style.shadowOffset = { width: shadowOffset.width ?? 0, height: shadowOffset.height ?? 0 };
1644
+ }
1645
+ return style;
1646
+ }
1647
+
1648
+ // src/nativeBridge.ts
1649
+ function resolveStyle(classString, pressed = false) {
1650
+ const colorScheme = getGlobalDarkMode() ? "dark" : "light";
1651
+ const width = import_react_native3.Dimensions.get("window").width;
1652
+ const KbachModule = import_react_native3.TurboModuleRegistry.get("KbachModule");
1653
+ if (!KbachModule) {
1654
+ return resolveStyleJs(classString, getTheme(), colorScheme, pressed, width);
1655
+ }
1656
+ const json = KbachModule.resolveStyle(classString, getThemeJson(), colorScheme, pressed, width);
1657
+ return JSON.parse(json);
1658
+ }
1659
+
1660
+ // src/jsx-runtime.tsx
1661
+ var { jsx, jsxs } = createJsxFunctions(resolveStyle);
396
1662
  // Annotate the CommonJS export names for ESM import in node:
397
1663
  0 && (module.exports = {
398
1664
  Fragment,