@kbach/react 0.5.38 → 0.5.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +173 -98
- package/dist/{chunk-EJFQKJPT.mjs → chunk-AAPA3CRV.mjs} +40 -59
- package/dist/{chunk-W7UBSRE5.mjs → chunk-GOQNOKFN.mjs} +19 -12
- package/dist/{chunk-NWVL4BES.mjs → chunk-VCNP57PR.mjs} +408 -1019
- package/dist/index.d.mts +10 -20
- package/dist/index.d.ts +10 -20
- package/dist/index.js +443 -1051
- package/dist/index.mjs +40 -22
- package/dist/jsx-dev-runtime.d.mts +6 -4
- package/dist/jsx-dev-runtime.d.ts +6 -4
- package/dist/jsx-dev-runtime.js +445 -1078
- package/dist/jsx-dev-runtime.mjs +10 -5
- package/dist/jsx-runtime.d.mts +2 -3
- package/dist/jsx-runtime.d.ts +2 -3
- package/dist/jsx-runtime.js +443 -1076
- package/dist/jsx-runtime.mjs +5 -3
- package/dist/types-D-24rbXu.d.mts +126 -0
- package/dist/types-D-24rbXu.d.ts +126 -0
- package/dist/vite-plugin.d.mts +1 -1
- package/dist/vite-plugin.d.ts +1 -1
- package/dist/vite-plugin.js +303 -842
- package/dist/vite-plugin.mjs +76 -25
- package/package.json +4 -2
- package/types.d.ts +1 -0
- package/dist/types-CV5vXnSH.d.mts +0 -70
- package/dist/types-CV5vXnSH.d.ts +0 -70
package/dist/index.js
CHANGED
|
@@ -83,7 +83,20 @@ function applyOpacity(color, opacity) {
|
|
|
83
83
|
const a = Math.max(0, Math.min(1, opacity / 100));
|
|
84
84
|
if (color.startsWith("#")) {
|
|
85
85
|
const h = color.slice(1);
|
|
86
|
-
|
|
86
|
+
let rs, gs, bs;
|
|
87
|
+
if (h.length === 3 || h.length === 4) {
|
|
88
|
+
rs = h[0] + h[0];
|
|
89
|
+
gs = h[1] + h[1];
|
|
90
|
+
bs = h[2] + h[2];
|
|
91
|
+
} else if (h.length === 8) {
|
|
92
|
+
rs = h.slice(0, 2);
|
|
93
|
+
gs = h.slice(2, 4);
|
|
94
|
+
bs = h.slice(4, 6);
|
|
95
|
+
} else {
|
|
96
|
+
rs = h.slice(0, 2);
|
|
97
|
+
gs = h.slice(2, 4);
|
|
98
|
+
bs = h.slice(4, 6);
|
|
99
|
+
}
|
|
87
100
|
return `rgba(${parseInt(rs, 16)},${parseInt(gs, 16)},${parseInt(bs, 16)},${a})`;
|
|
88
101
|
}
|
|
89
102
|
if (color.startsWith("rgb(")) return color.replace("rgb(", "rgba(").replace(")", `,${a})`);
|
|
@@ -696,7 +709,11 @@ var LRUCache = class {
|
|
|
696
709
|
return this;
|
|
697
710
|
}
|
|
698
711
|
has(key) {
|
|
699
|
-
|
|
712
|
+
if (!this.cache.has(key)) return false;
|
|
713
|
+
const value = this.cache.get(key);
|
|
714
|
+
this.cache.delete(key);
|
|
715
|
+
this.cache.set(key, value);
|
|
716
|
+
return true;
|
|
700
717
|
}
|
|
701
718
|
delete(key) {
|
|
702
719
|
return this.cache.delete(key);
|
|
@@ -711,9 +728,10 @@ var LRUCache = class {
|
|
|
711
728
|
|
|
712
729
|
// src/core/platform.ts
|
|
713
730
|
var isWeb = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
731
|
+
var isNative = !isWeb && (typeof globalThis.HermesInternal !== "undefined" || typeof globalThis.__fbBatchedBridge !== "undefined" || typeof navigator !== "undefined" && navigator.product === "ReactNative");
|
|
714
732
|
var _cssGenMode = false;
|
|
715
733
|
function getEffectiveIsWeb() {
|
|
716
|
-
return isWeb || _cssGenMode;
|
|
734
|
+
return isWeb || _cssGenMode || !isNative;
|
|
717
735
|
}
|
|
718
736
|
function toNativeValue(raw) {
|
|
719
737
|
if (/^-?\d+(\.\d+)?px$/.test(raw)) return parseFloat(raw);
|
|
@@ -726,773 +744,104 @@ function escapeCSSSelector(cls) {
|
|
|
726
744
|
return cls.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
|
|
727
745
|
}
|
|
728
746
|
|
|
729
|
-
// src/core/
|
|
730
|
-
var
|
|
731
|
-
|
|
732
|
-
|
|
747
|
+
// src/core/registry.ts
|
|
748
|
+
var BUILTIN_MODIFIERS = {
|
|
749
|
+
// ── Mode ─────────────────────────────────────────────────────────────────
|
|
750
|
+
dark: { darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
|
|
751
|
+
"not-light": { darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
|
|
752
|
+
light: { darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
|
|
753
|
+
"not-dark": { darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
|
|
754
|
+
// ── Interactive — JS state + CSS pseudo ───────────────────────────────────
|
|
755
|
+
hover: { pseudo: ":hover", jsBehavior: "interactive", jsMatch: (_, s) => !!s.hover },
|
|
756
|
+
"not-hover": { pseudo: ":not(:hover)", jsBehavior: "interactive", jsMatch: (_, s) => !s.hover },
|
|
757
|
+
focus: { pseudo: ":focus", jsBehavior: "interactive", jsMatch: (_, s) => !!s.focus },
|
|
758
|
+
"not-focus": { pseudo: ":not(:focus)", jsBehavior: "interactive", jsMatch: (_, s) => !s.focus },
|
|
759
|
+
active: { pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.active || !!s.pressed },
|
|
760
|
+
"not-active": { pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.active && !s.pressed },
|
|
761
|
+
pressed: { pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.pressed || !!s.active },
|
|
762
|
+
"not-pressed": { pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.pressed && !s.active },
|
|
763
|
+
disabled: { pseudo: ":disabled", jsBehavior: "interactive", jsMatch: (_, s) => !!s.disabled },
|
|
764
|
+
"not-disabled": { pseudo: ":not(:disabled)", jsBehavior: "interactive", jsMatch: (_, s) => !s.disabled },
|
|
765
|
+
checked: { pseudo: ":checked", jsBehavior: "interactive", jsMatch: (_, s) => !!s.checked },
|
|
766
|
+
"not-checked": { pseudo: ":not(:checked)", jsBehavior: "interactive", jsMatch: (_, s) => !s.checked },
|
|
767
|
+
visited: { pseudo: ":visited", jsBehavior: "interactive", jsMatch: (_, s) => !!s.visited },
|
|
768
|
+
"not-visited": { pseudo: ":not(:visited)", jsBehavior: "interactive", jsMatch: (_, s) => !s.visited },
|
|
769
|
+
placeholder: { pseudo: "::placeholder", jsBehavior: "interactive", jsMatch: (_, s) => !!s.placeholder },
|
|
770
|
+
// ── CSS-only pseudo-classes (structural) ──────────────────────────────────
|
|
771
|
+
first: { pseudo: ":first-child", jsBehavior: "css-only", forcesImportant: true },
|
|
772
|
+
last: { pseudo: ":last-child", jsBehavior: "css-only", forcesImportant: true },
|
|
773
|
+
odd: { pseudo: ":nth-child(odd)", jsBehavior: "css-only", forcesImportant: true },
|
|
774
|
+
even: { pseudo: ":nth-child(even)", jsBehavior: "css-only", forcesImportant: true },
|
|
775
|
+
only: { pseudo: ":only-child", jsBehavior: "css-only", forcesImportant: true },
|
|
776
|
+
"focus-within": { pseudo: ":focus-within", jsBehavior: "css-only", forcesImportant: true },
|
|
777
|
+
"focus-visible": { pseudo: ":focus-visible", jsBehavior: "css-only", forcesImportant: true },
|
|
778
|
+
// ── CSS-only pseudo-elements ───────────────────────────────────────────────
|
|
779
|
+
before: { pseudo: "::before", jsBehavior: "css-only" },
|
|
780
|
+
after: { pseudo: "::after", jsBehavior: "css-only" },
|
|
781
|
+
selection: { pseudo: "::selection", jsBehavior: "css-only" },
|
|
782
|
+
"first-letter": { pseudo: "::first-letter", jsBehavior: "css-only" },
|
|
783
|
+
"first-line": { pseudo: "::first-line", jsBehavior: "css-only" },
|
|
784
|
+
marker: { pseudo: "::marker", jsBehavior: "css-only" },
|
|
785
|
+
// ── Group / peer ancestor selectors (CSS-only) ─────────────────────────────
|
|
786
|
+
"group-hover": { ancestorSelector: ".group:hover ", jsBehavior: "css-only", forcesImportant: true },
|
|
787
|
+
"group-focus": { ancestorSelector: ".group:focus ", jsBehavior: "css-only", forcesImportant: true },
|
|
788
|
+
"peer-hover": { ancestorSelector: ".peer:hover ~ ", jsBehavior: "css-only", forcesImportant: true },
|
|
789
|
+
"peer-focus": { ancestorSelector: ".peer:focus ~ ", jsBehavior: "css-only", forcesImportant: true },
|
|
790
|
+
// ── Responsive — both CSS (@media min-width) and JS (breakpoints set) ──────
|
|
791
|
+
sm: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("sm") },
|
|
792
|
+
md: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("md") },
|
|
793
|
+
lg: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("lg") },
|
|
794
|
+
xl: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("xl") },
|
|
795
|
+
"2xl": { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("2xl") },
|
|
796
|
+
// ── Print media (CSS-only) ─────────────────────────────────────────────────
|
|
797
|
+
print: { mediaQuery: "print", jsBehavior: "css-only", forcesImportant: true },
|
|
798
|
+
// ── Orientation / accessibility media (CSS-only) ───────────────────────────
|
|
799
|
+
landscape: { mediaQuery: "(orientation: landscape)", jsBehavior: "css-only", forcesImportant: true },
|
|
800
|
+
portrait: { mediaQuery: "(orientation: portrait)", jsBehavior: "css-only", forcesImportant: true },
|
|
801
|
+
"motion-reduce": { mediaQuery: "(prefers-reduced-motion: reduce)", jsBehavior: "css-only", forcesImportant: true },
|
|
802
|
+
"motion-safe": { mediaQuery: "(prefers-reduced-motion: no-preference)", jsBehavior: "css-only", forcesImportant: true },
|
|
803
|
+
"contrast-more": { mediaQuery: "(prefers-contrast: more)", jsBehavior: "css-only", forcesImportant: true },
|
|
804
|
+
"contrast-less": { mediaQuery: "(prefers-contrast: less)", jsBehavior: "css-only", forcesImportant: true },
|
|
805
|
+
// ── Directionality (CSS-only) ──────────────────────────────────────────────
|
|
806
|
+
rtl: { dirSelector: '[dir="rtl"] ', jsBehavior: "css-only", forcesImportant: true },
|
|
807
|
+
ltr: { dirSelector: '[dir="ltr"] ', jsBehavior: "css-only", forcesImportant: true }
|
|
808
|
+
};
|
|
809
|
+
var _pluginModifiers = {};
|
|
810
|
+
var _allNames = null;
|
|
811
|
+
var _interactiveNames = null;
|
|
812
|
+
var _modeNames = null;
|
|
813
|
+
var _responsiveNames = null;
|
|
814
|
+
function _invalidate() {
|
|
815
|
+
_allNames = null;
|
|
816
|
+
_interactiveNames = null;
|
|
817
|
+
_modeNames = null;
|
|
818
|
+
_responsiveNames = null;
|
|
819
|
+
}
|
|
820
|
+
function registerModifier(name, def) {
|
|
821
|
+
_pluginModifiers[name] = def;
|
|
822
|
+
_invalidate();
|
|
733
823
|
}
|
|
734
824
|
function clearPluginModifiers() {
|
|
735
|
-
|
|
825
|
+
for (const k of Object.keys(_pluginModifiers)) delete _pluginModifiers[k];
|
|
826
|
+
_invalidate();
|
|
736
827
|
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
"dark",
|
|
740
|
-
"light",
|
|
741
|
-
"not-dark",
|
|
742
|
-
"not-light",
|
|
743
|
-
// Interaction
|
|
744
|
-
"hover",
|
|
745
|
-
"focus",
|
|
746
|
-
"active",
|
|
747
|
-
"visited",
|
|
748
|
-
"disabled",
|
|
749
|
-
"checked",
|
|
750
|
-
"pressed",
|
|
751
|
-
"placeholder",
|
|
752
|
-
"focus-within",
|
|
753
|
-
"focus-visible",
|
|
754
|
-
// Negated interaction
|
|
755
|
-
"not-hover",
|
|
756
|
-
"not-focus",
|
|
757
|
-
"not-active",
|
|
758
|
-
"not-visited",
|
|
759
|
-
"not-disabled",
|
|
760
|
-
"not-checked",
|
|
761
|
-
"not-pressed",
|
|
762
|
-
// Structural
|
|
763
|
-
"first",
|
|
764
|
-
"last",
|
|
765
|
-
"odd",
|
|
766
|
-
"even",
|
|
767
|
-
"only",
|
|
768
|
-
// Group / peer
|
|
769
|
-
"group-hover",
|
|
770
|
-
"group-focus",
|
|
771
|
-
"peer-hover",
|
|
772
|
-
"peer-focus",
|
|
773
|
-
// Responsive (handled separately but accepted)
|
|
774
|
-
"sm",
|
|
775
|
-
"md",
|
|
776
|
-
"lg",
|
|
777
|
-
"xl",
|
|
778
|
-
"2xl",
|
|
779
|
-
// Pseudo-elements (CSS-injection only; matchesMods returns false for these)
|
|
780
|
-
"before",
|
|
781
|
-
"after",
|
|
782
|
-
"selection",
|
|
783
|
-
"first-letter",
|
|
784
|
-
"first-line",
|
|
785
|
-
"marker",
|
|
786
|
-
// Print media modifier
|
|
787
|
-
"print",
|
|
788
|
-
// Orientation media modifiers (CSS-injection only)
|
|
789
|
-
"landscape",
|
|
790
|
-
"portrait",
|
|
791
|
-
// Accessibility media modifiers (CSS-injection only)
|
|
792
|
-
"motion-reduce",
|
|
793
|
-
"motion-safe",
|
|
794
|
-
"contrast-more",
|
|
795
|
-
"contrast-less",
|
|
796
|
-
// Directionality modifiers (CSS-injection only)
|
|
797
|
-
"rtl",
|
|
798
|
-
"ltr"
|
|
799
|
-
]);
|
|
800
|
-
var UTILITY_PREFIXES = [
|
|
801
|
-
// Multi-word flex
|
|
802
|
-
"flex-row-reverse",
|
|
803
|
-
"flex-col-reverse",
|
|
804
|
-
"flex-row",
|
|
805
|
-
"flex-col",
|
|
806
|
-
"flex-wrap-reverse",
|
|
807
|
-
"flex-wrap",
|
|
808
|
-
"flex-nowrap",
|
|
809
|
-
"flex-shrink-0",
|
|
810
|
-
"flex-shrink",
|
|
811
|
-
"flex-grow-0",
|
|
812
|
-
"flex-grow",
|
|
813
|
-
"items-start",
|
|
814
|
-
"items-end",
|
|
815
|
-
"items-center",
|
|
816
|
-
"items-baseline",
|
|
817
|
-
"items-stretch",
|
|
818
|
-
"justify-start",
|
|
819
|
-
"justify-end",
|
|
820
|
-
"justify-center",
|
|
821
|
-
"justify-between",
|
|
822
|
-
"justify-around",
|
|
823
|
-
"justify-evenly",
|
|
824
|
-
"content-start",
|
|
825
|
-
"content-end",
|
|
826
|
-
"content-center",
|
|
827
|
-
"content-between",
|
|
828
|
-
"content-around",
|
|
829
|
-
"content-evenly",
|
|
830
|
-
"self-start",
|
|
831
|
-
"self-end",
|
|
832
|
-
"self-center",
|
|
833
|
-
"self-auto",
|
|
834
|
-
"self-stretch",
|
|
835
|
-
"text-left",
|
|
836
|
-
"text-right",
|
|
837
|
-
"text-center",
|
|
838
|
-
"text-justify",
|
|
839
|
-
"font-thin",
|
|
840
|
-
"font-extralight",
|
|
841
|
-
"font-light",
|
|
842
|
-
"font-normal",
|
|
843
|
-
"font-medium",
|
|
844
|
-
"font-semibold",
|
|
845
|
-
"font-bold",
|
|
846
|
-
"font-extrabold",
|
|
847
|
-
"font-black",
|
|
848
|
-
"overflow-hidden",
|
|
849
|
-
"overflow-visible",
|
|
850
|
-
"overflow-scroll",
|
|
851
|
-
"overflow-auto",
|
|
852
|
-
"overflow-x-hidden",
|
|
853
|
-
"overflow-x-scroll",
|
|
854
|
-
"overflow-x-auto",
|
|
855
|
-
"overflow-y-hidden",
|
|
856
|
-
"overflow-y-scroll",
|
|
857
|
-
"overflow-y-auto",
|
|
858
|
-
"object-contain",
|
|
859
|
-
"object-cover",
|
|
860
|
-
"object-fill",
|
|
861
|
-
"object-none",
|
|
862
|
-
"object-scale-down",
|
|
863
|
-
"border-solid",
|
|
864
|
-
"border-dashed",
|
|
865
|
-
"border-dotted",
|
|
866
|
-
"border-none",
|
|
867
|
-
"border-t",
|
|
868
|
-
"border-r",
|
|
869
|
-
"border-b",
|
|
870
|
-
"border-l",
|
|
871
|
-
"rounded-tl",
|
|
872
|
-
"rounded-tr",
|
|
873
|
-
"rounded-bl",
|
|
874
|
-
"rounded-br",
|
|
875
|
-
"rounded-t",
|
|
876
|
-
"rounded-r",
|
|
877
|
-
"rounded-b",
|
|
878
|
-
"rounded-l",
|
|
879
|
-
"list-none",
|
|
880
|
-
"list-disc",
|
|
881
|
-
"list-decimal",
|
|
882
|
-
"cursor-auto",
|
|
883
|
-
"cursor-default",
|
|
884
|
-
"cursor-pointer",
|
|
885
|
-
"cursor-wait",
|
|
886
|
-
"cursor-text",
|
|
887
|
-
"cursor-move",
|
|
888
|
-
"cursor-not-allowed",
|
|
889
|
-
"select-none",
|
|
890
|
-
"select-text",
|
|
891
|
-
"select-all",
|
|
892
|
-
"select-auto",
|
|
893
|
-
"pointer-events-none",
|
|
894
|
-
"pointer-events-auto",
|
|
895
|
-
"whitespace-normal",
|
|
896
|
-
"whitespace-nowrap",
|
|
897
|
-
"whitespace-pre-wrap",
|
|
898
|
-
"whitespace-pre-line",
|
|
899
|
-
"whitespace-pre",
|
|
900
|
-
"break-normal",
|
|
901
|
-
"break-words",
|
|
902
|
-
"break-all",
|
|
903
|
-
"break-keep",
|
|
904
|
-
"bg-clip-border",
|
|
905
|
-
"bg-clip-padding",
|
|
906
|
-
"bg-clip-content",
|
|
907
|
-
"bg-clip-text",
|
|
908
|
-
"bg-gradient-to",
|
|
909
|
-
"resize-none",
|
|
910
|
-
"resize-y",
|
|
911
|
-
"resize-x",
|
|
912
|
-
"box-border",
|
|
913
|
-
"box-content",
|
|
914
|
-
"gap-x",
|
|
915
|
-
"gap-y",
|
|
916
|
-
"inset-x",
|
|
917
|
-
"inset-y",
|
|
918
|
-
"divide-x",
|
|
919
|
-
"divide-y",
|
|
920
|
-
"space-x",
|
|
921
|
-
"space-y",
|
|
922
|
-
"translate-x",
|
|
923
|
-
"translate-y",
|
|
924
|
-
"scale-x",
|
|
925
|
-
"scale-y",
|
|
926
|
-
"skew-x",
|
|
927
|
-
"skew-y",
|
|
928
|
-
// Transform origin (single prefix, value carries direction)
|
|
929
|
-
"origin",
|
|
930
|
-
"min-w",
|
|
931
|
-
"min-h",
|
|
932
|
-
"max-w",
|
|
933
|
-
"max-h",
|
|
934
|
-
"ring-offset",
|
|
935
|
-
"bg-opacity",
|
|
936
|
-
"text-opacity",
|
|
937
|
-
"border-opacity",
|
|
938
|
-
// Grid placement
|
|
939
|
-
"col-span",
|
|
940
|
-
"col-start",
|
|
941
|
-
"col-end",
|
|
942
|
-
"row-span",
|
|
943
|
-
"row-start",
|
|
944
|
-
"row-end",
|
|
945
|
-
"grid-cols",
|
|
946
|
-
"grid-rows",
|
|
947
|
-
"grid-flow",
|
|
948
|
-
"auto-cols",
|
|
949
|
-
"auto-rows",
|
|
950
|
-
// Grid alignment
|
|
951
|
-
"place-items",
|
|
952
|
-
"place-content",
|
|
953
|
-
"place-self",
|
|
954
|
-
"justify-items",
|
|
955
|
-
"justify-self",
|
|
956
|
-
// Backdrop filters (longer than 'backdrop' alone)
|
|
957
|
-
"backdrop-blur",
|
|
958
|
-
"backdrop-brightness",
|
|
959
|
-
"backdrop-contrast",
|
|
960
|
-
"backdrop-grayscale",
|
|
961
|
-
"backdrop-hue-rotate",
|
|
962
|
-
"backdrop-invert",
|
|
963
|
-
"backdrop-opacity",
|
|
964
|
-
"backdrop-saturate",
|
|
965
|
-
"backdrop-sepia",
|
|
966
|
-
"backdrop-filter",
|
|
967
|
-
// Filters
|
|
968
|
-
"drop-shadow",
|
|
969
|
-
"hue-rotate",
|
|
970
|
-
"text-shadow",
|
|
971
|
-
"underline-offset",
|
|
972
|
-
"outline-offset",
|
|
973
|
-
"will-change",
|
|
974
|
-
"mix-blend",
|
|
975
|
-
"bg-blend",
|
|
976
|
-
"decoration",
|
|
977
|
-
"perspective",
|
|
978
|
-
"tint",
|
|
979
|
-
"animate",
|
|
980
|
-
// Single-word prefixes last
|
|
981
|
-
"appearance-none",
|
|
982
|
-
"outline-none",
|
|
983
|
-
"outline",
|
|
984
|
-
"inline-flex",
|
|
985
|
-
"inline-block",
|
|
986
|
-
"inline-grid",
|
|
987
|
-
"italic",
|
|
988
|
-
"non-italic",
|
|
989
|
-
"underline",
|
|
990
|
-
"overline",
|
|
991
|
-
"line-through",
|
|
992
|
-
"no-underline",
|
|
993
|
-
"uppercase",
|
|
994
|
-
"lowercase",
|
|
995
|
-
"capitalize",
|
|
996
|
-
"normal-case",
|
|
997
|
-
"antialiased",
|
|
998
|
-
"subpixel-antialiased",
|
|
999
|
-
"overflow-ellipsis",
|
|
1000
|
-
"truncate",
|
|
1001
|
-
"sr-only",
|
|
1002
|
-
"not-sr-only",
|
|
1003
|
-
"relative",
|
|
1004
|
-
"absolute",
|
|
1005
|
-
"fixed",
|
|
1006
|
-
"sticky",
|
|
1007
|
-
"static",
|
|
1008
|
-
"visible",
|
|
1009
|
-
"invisible",
|
|
1010
|
-
"hidden",
|
|
1011
|
-
"contents",
|
|
1012
|
-
"flow-root",
|
|
1013
|
-
"block",
|
|
1014
|
-
"inline",
|
|
1015
|
-
"flex",
|
|
1016
|
-
"grid",
|
|
1017
|
-
"resize",
|
|
1018
|
-
"appearance",
|
|
1019
|
-
"border",
|
|
1020
|
-
"rounded",
|
|
1021
|
-
"shadow",
|
|
1022
|
-
"size",
|
|
1023
|
-
"opacity",
|
|
1024
|
-
"leading",
|
|
1025
|
-
"tracking",
|
|
1026
|
-
"line-clamp",
|
|
1027
|
-
"basis",
|
|
1028
|
-
"grow",
|
|
1029
|
-
"shrink",
|
|
1030
|
-
"order",
|
|
1031
|
-
"delay",
|
|
1032
|
-
"duration",
|
|
1033
|
-
"scale",
|
|
1034
|
-
"rotate",
|
|
1035
|
-
"aspect",
|
|
1036
|
-
"columns",
|
|
1037
|
-
"ring",
|
|
1038
|
-
"gap",
|
|
1039
|
-
"inset",
|
|
1040
|
-
"filter",
|
|
1041
|
-
"transform",
|
|
1042
|
-
"blur",
|
|
1043
|
-
"brightness",
|
|
1044
|
-
"contrast",
|
|
1045
|
-
"grayscale",
|
|
1046
|
-
"invert",
|
|
1047
|
-
"saturate",
|
|
1048
|
-
"sepia",
|
|
1049
|
-
"bg",
|
|
1050
|
-
"text",
|
|
1051
|
-
"font",
|
|
1052
|
-
"caret",
|
|
1053
|
-
"accent",
|
|
1054
|
-
"from",
|
|
1055
|
-
"via",
|
|
1056
|
-
"to",
|
|
1057
|
-
"divide",
|
|
1058
|
-
"space",
|
|
1059
|
-
"transition",
|
|
1060
|
-
"px",
|
|
1061
|
-
"py",
|
|
1062
|
-
"pt",
|
|
1063
|
-
"pr",
|
|
1064
|
-
"pb",
|
|
1065
|
-
"pl",
|
|
1066
|
-
"p",
|
|
1067
|
-
"mx",
|
|
1068
|
-
"my",
|
|
1069
|
-
"mt",
|
|
1070
|
-
"mr",
|
|
1071
|
-
"mb",
|
|
1072
|
-
"ml",
|
|
1073
|
-
"m",
|
|
1074
|
-
"w",
|
|
1075
|
-
"h",
|
|
1076
|
-
"top",
|
|
1077
|
-
"right",
|
|
1078
|
-
"bottom",
|
|
1079
|
-
"left",
|
|
1080
|
-
"z",
|
|
1081
|
-
"col",
|
|
1082
|
-
"row"
|
|
1083
|
-
];
|
|
1084
|
-
var SORTED_PREFIXES = [...new Set(UTILITY_PREFIXES)].sort((a, b) => b.length - a.length);
|
|
1085
|
-
var STANDALONE_UTILITIES = /* @__PURE__ */ new Set([
|
|
1086
|
-
// Display
|
|
1087
|
-
"flex",
|
|
1088
|
-
"block",
|
|
1089
|
-
"inline-block",
|
|
1090
|
-
"inline",
|
|
1091
|
-
"grid",
|
|
1092
|
-
"inline-flex",
|
|
1093
|
-
"inline-grid",
|
|
1094
|
-
"grd",
|
|
1095
|
-
"hidden",
|
|
1096
|
-
"contents",
|
|
1097
|
-
"flow-root",
|
|
1098
|
-
// Position
|
|
1099
|
-
"relative",
|
|
1100
|
-
"absolute",
|
|
1101
|
-
"fixed",
|
|
1102
|
-
"sticky",
|
|
1103
|
-
"static",
|
|
1104
|
-
// Visibility
|
|
1105
|
-
"visible",
|
|
1106
|
-
"invisible",
|
|
1107
|
-
// Typography
|
|
1108
|
-
"uppercase",
|
|
1109
|
-
"lowercase",
|
|
1110
|
-
"capitalize",
|
|
1111
|
-
"normal-case",
|
|
1112
|
-
"italic",
|
|
1113
|
-
"non-italic",
|
|
1114
|
-
"underline",
|
|
1115
|
-
"overline",
|
|
1116
|
-
"line-through",
|
|
1117
|
-
"no-underline",
|
|
1118
|
-
"truncate",
|
|
1119
|
-
"antialiased",
|
|
1120
|
-
"sr-only",
|
|
1121
|
-
"not-sr-only",
|
|
1122
|
-
// Font variant numeric
|
|
1123
|
-
"normal-nums",
|
|
1124
|
-
"ordinal",
|
|
1125
|
-
"slashed-zero",
|
|
1126
|
-
"lining-nums",
|
|
1127
|
-
"oldstyle-nums",
|
|
1128
|
-
"proportional-nums",
|
|
1129
|
-
"tabular-nums",
|
|
1130
|
-
"diagonal-fractions",
|
|
1131
|
-
"stacked-fractions",
|
|
1132
|
-
// Flexbox
|
|
1133
|
-
"flex-row",
|
|
1134
|
-
"flex-col",
|
|
1135
|
-
"flex-row-reverse",
|
|
1136
|
-
"flex-col-reverse",
|
|
1137
|
-
"flex-wrap",
|
|
1138
|
-
"flex-wrap-reverse",
|
|
1139
|
-
"flex-nowrap",
|
|
1140
|
-
"flex-shrink",
|
|
1141
|
-
"flex-shrink-0",
|
|
1142
|
-
"flex-grow",
|
|
1143
|
-
"flex-grow-0",
|
|
1144
|
-
"items-start",
|
|
1145
|
-
"items-end",
|
|
1146
|
-
"items-center",
|
|
1147
|
-
"items-baseline",
|
|
1148
|
-
"items-stretch",
|
|
1149
|
-
"justify-start",
|
|
1150
|
-
"justify-end",
|
|
1151
|
-
"justify-center",
|
|
1152
|
-
"justify-between",
|
|
1153
|
-
"justify-around",
|
|
1154
|
-
"justify-evenly",
|
|
1155
|
-
"content-start",
|
|
1156
|
-
"content-end",
|
|
1157
|
-
"content-center",
|
|
1158
|
-
"content-between",
|
|
1159
|
-
"content-around",
|
|
1160
|
-
"content-evenly",
|
|
1161
|
-
"content-stretch",
|
|
1162
|
-
"self-start",
|
|
1163
|
-
"self-end",
|
|
1164
|
-
"self-center",
|
|
1165
|
-
"self-auto",
|
|
1166
|
-
"self-stretch",
|
|
1167
|
-
"self-baseline",
|
|
1168
|
-
// Text align
|
|
1169
|
-
"text-left",
|
|
1170
|
-
"text-right",
|
|
1171
|
-
"text-center",
|
|
1172
|
-
"text-justify",
|
|
1173
|
-
// Font weight shortcuts
|
|
1174
|
-
"font-thin",
|
|
1175
|
-
"font-extralight",
|
|
1176
|
-
"font-light",
|
|
1177
|
-
"font-normal",
|
|
1178
|
-
"font-medium",
|
|
1179
|
-
"font-semibold",
|
|
1180
|
-
"font-bold",
|
|
1181
|
-
"font-extrabold",
|
|
1182
|
-
"font-black",
|
|
1183
|
-
// Overflow
|
|
1184
|
-
"overflow-hidden",
|
|
1185
|
-
"overflow-visible",
|
|
1186
|
-
"overflow-scroll",
|
|
1187
|
-
"overflow-auto",
|
|
1188
|
-
"overflow-x-hidden",
|
|
1189
|
-
"overflow-x-scroll",
|
|
1190
|
-
"overflow-x-auto",
|
|
1191
|
-
"overflow-y-hidden",
|
|
1192
|
-
"overflow-y-scroll",
|
|
1193
|
-
"overflow-y-auto",
|
|
1194
|
-
// Object fit
|
|
1195
|
-
"object-contain",
|
|
1196
|
-
"object-cover",
|
|
1197
|
-
"object-fill",
|
|
1198
|
-
"object-none",
|
|
1199
|
-
"object-scale-down",
|
|
1200
|
-
// Object position
|
|
1201
|
-
"object-center",
|
|
1202
|
-
"object-top",
|
|
1203
|
-
"object-bottom",
|
|
1204
|
-
"object-left",
|
|
1205
|
-
"object-right",
|
|
1206
|
-
"object-left-top",
|
|
1207
|
-
"object-left-bottom",
|
|
1208
|
-
"object-right-top",
|
|
1209
|
-
"object-right-bottom",
|
|
1210
|
-
// Border
|
|
1211
|
-
"border-solid",
|
|
1212
|
-
"border-dashed",
|
|
1213
|
-
"border-dotted",
|
|
1214
|
-
"border-none",
|
|
1215
|
-
"border-t",
|
|
1216
|
-
"border-r",
|
|
1217
|
-
"border-b",
|
|
1218
|
-
"border-l",
|
|
1219
|
-
"border-collapse",
|
|
1220
|
-
"border-separate",
|
|
1221
|
-
// Lists
|
|
1222
|
-
"list-none",
|
|
1223
|
-
"list-disc",
|
|
1224
|
-
"list-decimal",
|
|
1225
|
-
"list-inside",
|
|
1226
|
-
"list-outside",
|
|
1227
|
-
// Cursor / select
|
|
1228
|
-
"cursor-auto",
|
|
1229
|
-
"cursor-default",
|
|
1230
|
-
"cursor-pointer",
|
|
1231
|
-
"cursor-wait",
|
|
1232
|
-
"cursor-text",
|
|
1233
|
-
"cursor-move",
|
|
1234
|
-
"cursor-not-allowed",
|
|
1235
|
-
"select-none",
|
|
1236
|
-
"select-text",
|
|
1237
|
-
"select-all",
|
|
1238
|
-
"select-auto",
|
|
1239
|
-
"pointer-events-none",
|
|
1240
|
-
"pointer-events-auto",
|
|
1241
|
-
// Whitespace / word break
|
|
1242
|
-
"whitespace-normal",
|
|
1243
|
-
"whitespace-nowrap",
|
|
1244
|
-
"whitespace-pre",
|
|
1245
|
-
"whitespace-pre-wrap",
|
|
1246
|
-
"whitespace-pre-line",
|
|
1247
|
-
"break-normal",
|
|
1248
|
-
"break-words",
|
|
1249
|
-
"break-all",
|
|
1250
|
-
// Background clip
|
|
1251
|
-
"bg-clip-border",
|
|
1252
|
-
"bg-clip-padding",
|
|
1253
|
-
"bg-clip-content",
|
|
1254
|
-
"bg-clip-text",
|
|
1255
|
-
// Background size
|
|
1256
|
-
"bg-auto",
|
|
1257
|
-
"bg-cover",
|
|
1258
|
-
"bg-contain",
|
|
1259
|
-
// Background position
|
|
1260
|
-
"bg-center",
|
|
1261
|
-
"bg-top",
|
|
1262
|
-
"bg-bottom",
|
|
1263
|
-
"bg-left",
|
|
1264
|
-
"bg-right",
|
|
1265
|
-
"bg-left-top",
|
|
1266
|
-
"bg-left-bottom",
|
|
1267
|
-
"bg-right-top",
|
|
1268
|
-
"bg-right-bottom",
|
|
1269
|
-
// Background repeat
|
|
1270
|
-
"bg-repeat",
|
|
1271
|
-
"bg-no-repeat",
|
|
1272
|
-
"bg-repeat-x",
|
|
1273
|
-
"bg-repeat-y",
|
|
1274
|
-
"bg-repeat-round",
|
|
1275
|
-
"bg-repeat-space",
|
|
1276
|
-
// Background attachment
|
|
1277
|
-
"bg-fixed",
|
|
1278
|
-
"bg-local",
|
|
1279
|
-
"bg-scroll",
|
|
1280
|
-
// Background image
|
|
1281
|
-
"bg-none",
|
|
1282
|
-
// Box sizing
|
|
1283
|
-
"box-border",
|
|
1284
|
-
"box-content",
|
|
1285
|
-
// Resize
|
|
1286
|
-
"resize",
|
|
1287
|
-
"resize-none",
|
|
1288
|
-
"resize-y",
|
|
1289
|
-
"resize-x",
|
|
1290
|
-
// Outline
|
|
1291
|
-
"appearance-none",
|
|
1292
|
-
"outline-none",
|
|
1293
|
-
"outline",
|
|
1294
|
-
// Table
|
|
1295
|
-
"table",
|
|
1296
|
-
"table-auto",
|
|
1297
|
-
"table-fixed",
|
|
1298
|
-
"caption-top",
|
|
1299
|
-
"caption-bottom",
|
|
1300
|
-
// CSS filters (standalone = default/full effect)
|
|
1301
|
-
"grayscale",
|
|
1302
|
-
"invert",
|
|
1303
|
-
"sepia",
|
|
1304
|
-
// Isolation
|
|
1305
|
-
"isolate",
|
|
1306
|
-
"isolation-auto",
|
|
1307
|
-
// Backface visibility (both platforms)
|
|
1308
|
-
"backface-visible",
|
|
1309
|
-
"backface-hidden",
|
|
1310
|
-
// Divide none
|
|
1311
|
-
"divide-none",
|
|
1312
|
-
// Group / peer markers (no-op style; needed so isKnownUtility recognises them)
|
|
1313
|
-
"group",
|
|
1314
|
-
"peer",
|
|
1315
|
-
// Text-wrap (web-only)
|
|
1316
|
-
"text-wrap",
|
|
1317
|
-
"text-nowrap",
|
|
1318
|
-
"text-balance",
|
|
1319
|
-
"text-pretty",
|
|
1320
|
-
// Screen sizing
|
|
1321
|
-
"w-screen",
|
|
1322
|
-
"min-h-screen",
|
|
1323
|
-
"max-h-screen",
|
|
1324
|
-
"min-w-screen",
|
|
1325
|
-
"max-w-screen",
|
|
1326
|
-
// max-w named container sizes (Tailwind compat)
|
|
1327
|
-
"max-w-none",
|
|
1328
|
-
"max-w-xs",
|
|
1329
|
-
"max-w-sm",
|
|
1330
|
-
"max-w-md",
|
|
1331
|
-
"max-w-lg",
|
|
1332
|
-
"max-w-xl",
|
|
1333
|
-
"max-w-2xl",
|
|
1334
|
-
"max-w-3xl",
|
|
1335
|
-
"max-w-4xl",
|
|
1336
|
-
"max-w-5xl",
|
|
1337
|
-
"max-w-6xl",
|
|
1338
|
-
"max-w-7xl",
|
|
1339
|
-
"max-w-prose",
|
|
1340
|
-
// Extended cursors (web-only)
|
|
1341
|
-
"cursor-grab",
|
|
1342
|
-
"cursor-grabbing",
|
|
1343
|
-
"cursor-zoom-in",
|
|
1344
|
-
"cursor-zoom-out",
|
|
1345
|
-
"cursor-crosshair",
|
|
1346
|
-
"cursor-help",
|
|
1347
|
-
"cursor-none",
|
|
1348
|
-
// Overflow clip (web-only)
|
|
1349
|
-
"overflow-clip",
|
|
1350
|
-
"overflow-x-clip",
|
|
1351
|
-
"overflow-y-clip",
|
|
1352
|
-
// Scroll behavior (web-only)
|
|
1353
|
-
"scroll-smooth",
|
|
1354
|
-
"scroll-auto",
|
|
1355
|
-
// Float & clear (web-only)
|
|
1356
|
-
"float-left",
|
|
1357
|
-
"float-right",
|
|
1358
|
-
"float-start",
|
|
1359
|
-
"float-end",
|
|
1360
|
-
"float-none",
|
|
1361
|
-
"clear-left",
|
|
1362
|
-
"clear-right",
|
|
1363
|
-
"clear-both",
|
|
1364
|
-
"clear-start",
|
|
1365
|
-
"clear-end",
|
|
1366
|
-
"clear-none",
|
|
1367
|
-
// Vertical align (web-only)
|
|
1368
|
-
"align-baseline",
|
|
1369
|
-
"align-top",
|
|
1370
|
-
"align-middle",
|
|
1371
|
-
"align-bottom",
|
|
1372
|
-
"align-text-top",
|
|
1373
|
-
"align-text-bottom",
|
|
1374
|
-
"align-sub",
|
|
1375
|
-
"align-super",
|
|
1376
|
-
// Touch action (web-only)
|
|
1377
|
-
"touch-auto",
|
|
1378
|
-
"touch-none",
|
|
1379
|
-
"touch-pan-x",
|
|
1380
|
-
"touch-pan-y",
|
|
1381
|
-
"touch-pan-left",
|
|
1382
|
-
"touch-pan-right",
|
|
1383
|
-
"touch-pan-up",
|
|
1384
|
-
"touch-pan-down",
|
|
1385
|
-
"touch-pinch-zoom",
|
|
1386
|
-
"touch-manipulation"
|
|
1387
|
-
]);
|
|
1388
|
-
function parseClass(className) {
|
|
1389
|
-
const trimmed = className.trim();
|
|
1390
|
-
if (!trimmed) return null;
|
|
1391
|
-
const modifiers = [];
|
|
1392
|
-
let remaining = trimmed;
|
|
1393
|
-
for (let i = 0; i < 3; i++) {
|
|
1394
|
-
const colonIdx = findOuterColon(remaining);
|
|
1395
|
-
if (colonIdx === -1) break;
|
|
1396
|
-
const candidate = remaining.slice(0, colonIdx);
|
|
1397
|
-
if (MODIFIERS.has(candidate) || PLUGIN_MODIFIERS.has(candidate)) {
|
|
1398
|
-
modifiers.push(candidate);
|
|
1399
|
-
remaining = remaining.slice(colonIdx + 1);
|
|
1400
|
-
} else {
|
|
1401
|
-
break;
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
let important = false;
|
|
1405
|
-
if (remaining.startsWith("!") && remaining.length > 1) {
|
|
1406
|
-
important = true;
|
|
1407
|
-
remaining = remaining.slice(1);
|
|
1408
|
-
}
|
|
1409
|
-
let negative = false;
|
|
1410
|
-
if (remaining.startsWith("-") && remaining.length > 1 && remaining[1] !== "-") {
|
|
1411
|
-
negative = true;
|
|
1412
|
-
remaining = remaining.slice(1);
|
|
1413
|
-
}
|
|
1414
|
-
const bracketStart = remaining.lastIndexOf("-[");
|
|
1415
|
-
if (bracketStart > 0 && remaining.endsWith("]")) {
|
|
1416
|
-
const utility = remaining.slice(0, bracketStart);
|
|
1417
|
-
const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
|
|
1418
|
-
return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
|
|
1419
|
-
}
|
|
1420
|
-
if (STANDALONE_UTILITIES.has(remaining)) {
|
|
1421
|
-
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
1422
|
-
}
|
|
1423
|
-
for (const prefix of SORTED_PREFIXES) {
|
|
1424
|
-
if (remaining === prefix) {
|
|
1425
|
-
return { original: trimmed, modifiers, negative, important, utility: prefix, value: "", isArbitrary: false };
|
|
1426
|
-
}
|
|
1427
|
-
if (remaining.startsWith(prefix + "-")) {
|
|
1428
|
-
const value = remaining.slice(prefix.length + 1);
|
|
1429
|
-
return { original: trimmed, modifiers, negative, important, utility: prefix, value, isArbitrary: false };
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
const firstDash = remaining.indexOf("-");
|
|
1433
|
-
if (firstDash > 0) {
|
|
1434
|
-
return {
|
|
1435
|
-
original: trimmed,
|
|
1436
|
-
modifiers,
|
|
1437
|
-
negative,
|
|
1438
|
-
important,
|
|
1439
|
-
utility: remaining.slice(0, firstDash),
|
|
1440
|
-
value: remaining.slice(firstDash + 1),
|
|
1441
|
-
isArbitrary: false
|
|
1442
|
-
};
|
|
1443
|
-
}
|
|
1444
|
-
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
828
|
+
function getModifier(name) {
|
|
829
|
+
return BUILTIN_MODIFIERS[name] ?? _pluginModifiers[name];
|
|
1445
830
|
}
|
|
1446
|
-
function
|
|
1447
|
-
|
|
1448
|
-
let current = "";
|
|
1449
|
-
let depth = 0;
|
|
1450
|
-
for (let i = 0; i < classString.length; i++) {
|
|
1451
|
-
const ch = classString[i];
|
|
1452
|
-
if (ch === "[") {
|
|
1453
|
-
depth++;
|
|
1454
|
-
current += ch;
|
|
1455
|
-
continue;
|
|
1456
|
-
}
|
|
1457
|
-
if (ch === "]") {
|
|
1458
|
-
depth--;
|
|
1459
|
-
current += ch;
|
|
1460
|
-
continue;
|
|
1461
|
-
}
|
|
1462
|
-
if (/\s/.test(ch)) {
|
|
1463
|
-
if (depth === 0) {
|
|
1464
|
-
if (current) {
|
|
1465
|
-
tokens.push(current);
|
|
1466
|
-
current = "";
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
} else {
|
|
1470
|
-
current += ch;
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
if (current) tokens.push(current);
|
|
1474
|
-
return tokens;
|
|
831
|
+
function isKnownModifier(name) {
|
|
832
|
+
return name in BUILTIN_MODIFIERS || name in _pluginModifiers;
|
|
1475
833
|
}
|
|
1476
|
-
function
|
|
1477
|
-
return
|
|
834
|
+
function _allEntries() {
|
|
835
|
+
return [...Object.entries(BUILTIN_MODIFIERS), ...Object.entries(_pluginModifiers)];
|
|
1478
836
|
}
|
|
1479
|
-
function
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
const parsed = parseClass(token);
|
|
1483
|
-
if (parsed) results.push(parsed);
|
|
837
|
+
function getResponsiveModifiers() {
|
|
838
|
+
if (!_responsiveNames) {
|
|
839
|
+
_responsiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "responsive").map(([k]) => k));
|
|
1484
840
|
}
|
|
1485
|
-
return
|
|
841
|
+
return _responsiveNames;
|
|
1486
842
|
}
|
|
1487
|
-
function
|
|
1488
|
-
|
|
1489
|
-
for (let i = 0; i < s.length; i++) {
|
|
1490
|
-
const ch = s[i];
|
|
1491
|
-
if (ch === "[") depth++;
|
|
1492
|
-
else if (ch === "]") depth--;
|
|
1493
|
-
else if (ch === ":" && depth === 0) return i;
|
|
1494
|
-
}
|
|
1495
|
-
return -1;
|
|
843
|
+
function matchModifier(name, isDark, state, breakpoints) {
|
|
844
|
+
return getModifier(name)?.jsMatch?.(isDark, state, breakpoints) ?? false;
|
|
1496
845
|
}
|
|
1497
846
|
|
|
1498
847
|
// src/core/utilities.ts
|
|
@@ -1586,6 +935,7 @@ function resolveSizing(value, spacing, isArbitrary) {
|
|
|
1586
935
|
if (raw !== void 0) return raw;
|
|
1587
936
|
if (/^\d+\/\d+$/.test(value)) {
|
|
1588
937
|
const [num, den] = value.split("/").map(Number);
|
|
938
|
+
if (!den) return null;
|
|
1589
939
|
return `${(num / den * 100).toFixed(6)}%`;
|
|
1590
940
|
}
|
|
1591
941
|
return null;
|
|
@@ -3100,10 +2450,10 @@ function resolveUtility(parsed, theme) {
|
|
|
3100
2450
|
if (!parsed.value) {
|
|
3101
2451
|
if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
|
|
3102
2452
|
if (parsed.utility === "grd" || parsed.utility === "grid") {
|
|
3103
|
-
return { display: "grid" };
|
|
2453
|
+
return getEffectiveIsWeb() ? { display: "grid" } : null;
|
|
3104
2454
|
}
|
|
3105
2455
|
if (parsed.utility === "inline-grid") {
|
|
3106
|
-
return { display: "inline-grid" };
|
|
2456
|
+
return getEffectiveIsWeb() ? { display: "inline-grid" } : null;
|
|
3107
2457
|
}
|
|
3108
2458
|
if (parsed.utility in getStandalone()) return getStandalone()[parsed.utility] ?? null;
|
|
3109
2459
|
}
|
|
@@ -3116,6 +2466,8 @@ var PLUGIN_RESOLVERS = {};
|
|
|
3116
2466
|
function clearPluginUtilities() {
|
|
3117
2467
|
for (const key of Object.keys(PLUGIN_STANDALONE)) delete PLUGIN_STANDALONE[key];
|
|
3118
2468
|
for (const key of Object.keys(PLUGIN_RESOLVERS)) delete PLUGIN_RESOLVERS[key];
|
|
2469
|
+
_sortedPrefixes = null;
|
|
2470
|
+
_standaloneNames = null;
|
|
3119
2471
|
}
|
|
3120
2472
|
function getPluginStandaloneMap() {
|
|
3121
2473
|
return PLUGIN_STANDALONE;
|
|
@@ -3123,6 +2475,129 @@ function getPluginStandaloneMap() {
|
|
|
3123
2475
|
function isKnownUtility(utility) {
|
|
3124
2476
|
return utility in getStandalone() || utility in RESOLVERS || utility in PLUGIN_STANDALONE || utility in PLUGIN_RESOLVERS;
|
|
3125
2477
|
}
|
|
2478
|
+
var _sortedPrefixes = null;
|
|
2479
|
+
var _standaloneNames = null;
|
|
2480
|
+
function getBuiltinUtilityPrefixes() {
|
|
2481
|
+
if (!_sortedPrefixes) {
|
|
2482
|
+
const all = [.../* @__PURE__ */ new Set([...Object.keys(RESOLVERS), ...Object.keys(PLUGIN_RESOLVERS)])];
|
|
2483
|
+
_sortedPrefixes = all.sort((a, b) => b.length - a.length);
|
|
2484
|
+
}
|
|
2485
|
+
return _sortedPrefixes;
|
|
2486
|
+
}
|
|
2487
|
+
function getBuiltinStandaloneNames() {
|
|
2488
|
+
if (!_standaloneNames) {
|
|
2489
|
+
_standaloneNames = /* @__PURE__ */ new Set([...Object.keys(getStandalone()), ...Object.keys(PLUGIN_STANDALONE)]);
|
|
2490
|
+
}
|
|
2491
|
+
return _standaloneNames;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
// src/core/parser.ts
|
|
2495
|
+
function parseClass(className) {
|
|
2496
|
+
const trimmed = className.trim();
|
|
2497
|
+
if (!trimmed) return null;
|
|
2498
|
+
const modifiers = [];
|
|
2499
|
+
let remaining = trimmed;
|
|
2500
|
+
while (true) {
|
|
2501
|
+
const colonIdx = findOuterColon(remaining);
|
|
2502
|
+
if (colonIdx === -1) break;
|
|
2503
|
+
const candidate = remaining.slice(0, colonIdx);
|
|
2504
|
+
if (!isKnownModifier(candidate)) break;
|
|
2505
|
+
modifiers.push(candidate);
|
|
2506
|
+
remaining = remaining.slice(colonIdx + 1);
|
|
2507
|
+
}
|
|
2508
|
+
let important = false;
|
|
2509
|
+
if (remaining.startsWith("!") && remaining.length > 1) {
|
|
2510
|
+
important = true;
|
|
2511
|
+
remaining = remaining.slice(1);
|
|
2512
|
+
}
|
|
2513
|
+
let negative = false;
|
|
2514
|
+
if (remaining.startsWith("-") && remaining.length > 1 && remaining[1] !== "-") {
|
|
2515
|
+
negative = true;
|
|
2516
|
+
remaining = remaining.slice(1);
|
|
2517
|
+
}
|
|
2518
|
+
const bracketStart = remaining.lastIndexOf("-[");
|
|
2519
|
+
if (bracketStart > 0 && remaining.endsWith("]")) {
|
|
2520
|
+
const utility = remaining.slice(0, bracketStart);
|
|
2521
|
+
const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
|
|
2522
|
+
return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
|
|
2523
|
+
}
|
|
2524
|
+
if (getBuiltinStandaloneNames().has(remaining)) {
|
|
2525
|
+
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
2526
|
+
}
|
|
2527
|
+
for (const prefix of getBuiltinUtilityPrefixes()) {
|
|
2528
|
+
if (remaining === prefix) {
|
|
2529
|
+
return { original: trimmed, modifiers, negative, important, utility: prefix, value: "", isArbitrary: false };
|
|
2530
|
+
}
|
|
2531
|
+
if (remaining.startsWith(prefix + "-")) {
|
|
2532
|
+
const value = remaining.slice(prefix.length + 1);
|
|
2533
|
+
return { original: trimmed, modifiers, negative, important, utility: prefix, value, isArbitrary: false };
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
const firstDash = remaining.indexOf("-");
|
|
2537
|
+
if (firstDash > 0) {
|
|
2538
|
+
return {
|
|
2539
|
+
original: trimmed,
|
|
2540
|
+
modifiers,
|
|
2541
|
+
negative,
|
|
2542
|
+
important,
|
|
2543
|
+
utility: remaining.slice(0, firstDash),
|
|
2544
|
+
value: remaining.slice(firstDash + 1),
|
|
2545
|
+
isArbitrary: false
|
|
2546
|
+
};
|
|
2547
|
+
}
|
|
2548
|
+
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
2549
|
+
}
|
|
2550
|
+
function splitClassTokens(classString) {
|
|
2551
|
+
const tokens = [];
|
|
2552
|
+
let current = "";
|
|
2553
|
+
let depth = 0;
|
|
2554
|
+
for (let i = 0; i < classString.length; i++) {
|
|
2555
|
+
const ch = classString[i];
|
|
2556
|
+
if (ch === "[") {
|
|
2557
|
+
depth++;
|
|
2558
|
+
current += ch;
|
|
2559
|
+
continue;
|
|
2560
|
+
}
|
|
2561
|
+
if (ch === "]") {
|
|
2562
|
+
depth--;
|
|
2563
|
+
current += ch;
|
|
2564
|
+
continue;
|
|
2565
|
+
}
|
|
2566
|
+
if (/\s/.test(ch)) {
|
|
2567
|
+
if (depth === 0) {
|
|
2568
|
+
if (current) {
|
|
2569
|
+
tokens.push(current);
|
|
2570
|
+
current = "";
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
} else {
|
|
2574
|
+
current += ch;
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
if (current) tokens.push(current);
|
|
2578
|
+
return tokens;
|
|
2579
|
+
}
|
|
2580
|
+
function normalizeClassString(classString) {
|
|
2581
|
+
return splitClassTokens(classString).join(" ");
|
|
2582
|
+
}
|
|
2583
|
+
function parseClasses(classString) {
|
|
2584
|
+
const results = [];
|
|
2585
|
+
for (const token of splitClassTokens(classString)) {
|
|
2586
|
+
const parsed = parseClass(token);
|
|
2587
|
+
if (parsed) results.push(parsed);
|
|
2588
|
+
}
|
|
2589
|
+
return results;
|
|
2590
|
+
}
|
|
2591
|
+
function findOuterColon(s) {
|
|
2592
|
+
let depth = 0;
|
|
2593
|
+
for (let i = 0; i < s.length; i++) {
|
|
2594
|
+
const ch = s[i];
|
|
2595
|
+
if (ch === "[") depth++;
|
|
2596
|
+
else if (ch === "]") depth--;
|
|
2597
|
+
else if (ch === ":" && depth === 0) return i;
|
|
2598
|
+
}
|
|
2599
|
+
return -1;
|
|
2600
|
+
}
|
|
3126
2601
|
|
|
3127
2602
|
// src/core/responsiveStore.ts
|
|
3128
2603
|
var RESPONSIVE_KEY = "__kbach_responsive__";
|
|
@@ -3167,7 +2642,30 @@ function getActiveBreakpoints(width) {
|
|
|
3167
2642
|
}
|
|
3168
2643
|
|
|
3169
2644
|
// src/core/resolver.ts
|
|
3170
|
-
var
|
|
2645
|
+
var _themeCache = /* @__PURE__ */ new WeakMap();
|
|
2646
|
+
function getThemeCache(theme) {
|
|
2647
|
+
let cache = _themeCache.get(theme);
|
|
2648
|
+
if (!cache) {
|
|
2649
|
+
cache = new LRUCache(1e4);
|
|
2650
|
+
_themeCache.set(theme, cache);
|
|
2651
|
+
}
|
|
2652
|
+
return cache;
|
|
2653
|
+
}
|
|
2654
|
+
var _sortCache = /* @__PURE__ */ new WeakMap();
|
|
2655
|
+
function getSortedEntries(resolved) {
|
|
2656
|
+
let sorted = _sortCache.get(resolved);
|
|
2657
|
+
if (!sorted) {
|
|
2658
|
+
const entries = Object.entries(resolved);
|
|
2659
|
+
entries.sort((a, b) => {
|
|
2660
|
+
const pa = a[0] === "base" ? -1 : a[0].split(":").length;
|
|
2661
|
+
const pb = b[0] === "base" ? -1 : b[0].split(":").length;
|
|
2662
|
+
return pa - pb;
|
|
2663
|
+
});
|
|
2664
|
+
sorted = entries;
|
|
2665
|
+
_sortCache.set(resolved, sorted);
|
|
2666
|
+
}
|
|
2667
|
+
return sorted;
|
|
2668
|
+
}
|
|
3171
2669
|
var FONT_KEY = "__kbach_default_font__";
|
|
3172
2670
|
function setDefaultFontFamily(font) {
|
|
3173
2671
|
globalThis[FONT_KEY] = font;
|
|
@@ -3176,7 +2674,7 @@ function getDefaultFontFamily() {
|
|
|
3176
2674
|
return globalThis[FONT_KEY];
|
|
3177
2675
|
}
|
|
3178
2676
|
var _styleEl = null;
|
|
3179
|
-
var _injectedRules =
|
|
2677
|
+
var _injectedRules = new LRUCache(5e4);
|
|
3180
2678
|
function getStyleEl() {
|
|
3181
2679
|
if (_styleEl) return _styleEl;
|
|
3182
2680
|
_styleEl = document.createElement("style");
|
|
@@ -3186,7 +2684,7 @@ function getStyleEl() {
|
|
|
3186
2684
|
}
|
|
3187
2685
|
function injectRule(rule) {
|
|
3188
2686
|
if (_injectedRules.has(rule)) return;
|
|
3189
|
-
_injectedRules.
|
|
2687
|
+
_injectedRules.set(rule, true);
|
|
3190
2688
|
try {
|
|
3191
2689
|
getStyleEl().sheet?.insertRule(rule, getStyleEl().sheet.cssRules.length);
|
|
3192
2690
|
} catch {
|
|
@@ -3210,150 +2708,20 @@ function injectGlobalStyles(theme) {
|
|
|
3210
2708
|
}
|
|
3211
2709
|
getGlobalStyleEl().textContent = rules.join("\n");
|
|
3212
2710
|
}
|
|
3213
|
-
var MODIFIER_TO_PSEUDO = {
|
|
3214
|
-
hover: ":hover",
|
|
3215
|
-
focus: ":focus",
|
|
3216
|
-
"focus-within": ":focus-within",
|
|
3217
|
-
"focus-visible": ":focus-visible",
|
|
3218
|
-
active: ":active",
|
|
3219
|
-
pressed: ":active",
|
|
3220
|
-
disabled: ":disabled",
|
|
3221
|
-
checked: ":checked",
|
|
3222
|
-
visited: ":visited",
|
|
3223
|
-
placeholder: "::placeholder",
|
|
3224
|
-
first: ":first-child",
|
|
3225
|
-
last: ":last-child",
|
|
3226
|
-
odd: ":nth-child(odd)",
|
|
3227
|
-
even: ":nth-child(even)",
|
|
3228
|
-
only: ":only-child",
|
|
3229
|
-
"not-hover": ":not(:hover)",
|
|
3230
|
-
"not-focus": ":not(:focus)",
|
|
3231
|
-
"not-active": ":not(:active)",
|
|
3232
|
-
"not-pressed": ":not(:active)",
|
|
3233
|
-
"not-disabled": ":not(:disabled)",
|
|
3234
|
-
"not-checked": ":not(:checked)",
|
|
3235
|
-
"not-visited": ":not(:visited)",
|
|
3236
|
-
// Pseudo-elements (CSS-injection only; never applied as inline styles)
|
|
3237
|
-
before: "::before",
|
|
3238
|
-
after: "::after",
|
|
3239
|
-
selection: "::selection",
|
|
3240
|
-
"first-letter": "::first-letter",
|
|
3241
|
-
"first-line": "::first-line",
|
|
3242
|
-
marker: "::marker"
|
|
3243
|
-
};
|
|
3244
|
-
var GROUP_PEER_PREFIX = {
|
|
3245
|
-
"group-hover": ".group:hover",
|
|
3246
|
-
"group-focus": ".group:focus",
|
|
3247
|
-
"peer-hover": ".peer:hover ~",
|
|
3248
|
-
"peer-focus": ".peer:focus ~"
|
|
3249
|
-
};
|
|
3250
|
-
var MODE_MODS = /* @__PURE__ */ new Set(["dark", "light", "not-dark", "not-light"]);
|
|
3251
|
-
var RESPONSIVE_MODS = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
|
|
3252
|
-
var PRINT_MODS = /* @__PURE__ */ new Set(["print"]);
|
|
3253
|
-
var MEDIA_MODS = {
|
|
3254
|
-
landscape: "(orientation: landscape)",
|
|
3255
|
-
portrait: "(orientation: portrait)",
|
|
3256
|
-
"motion-reduce": "(prefers-reduced-motion: reduce)",
|
|
3257
|
-
"motion-safe": "(prefers-reduced-motion: no-preference)",
|
|
3258
|
-
"contrast-more": "(prefers-contrast: more)",
|
|
3259
|
-
"contrast-less": "(prefers-contrast: less)"
|
|
3260
|
-
};
|
|
3261
|
-
var DIR_MODS = {
|
|
3262
|
-
rtl: '[dir="rtl"]',
|
|
3263
|
-
ltr: '[dir="ltr"]'
|
|
3264
|
-
};
|
|
3265
2711
|
function buildDivideDecls(styles) {
|
|
3266
2712
|
const parts = [];
|
|
3267
2713
|
if ("__divideX" in styles) {
|
|
3268
2714
|
const w = Number(styles.__divideX);
|
|
3269
|
-
parts.push(`border-left-width: ${w}px
|
|
3270
|
-
parts.push("border-right-width: 0px");
|
|
2715
|
+
parts.push(`border-left-width: ${w}px`, "border-right-width: 0px");
|
|
3271
2716
|
}
|
|
3272
2717
|
if ("__divideY" in styles) {
|
|
3273
2718
|
const w = Number(styles.__divideY);
|
|
3274
|
-
parts.push(`border-top-width: ${w}px
|
|
3275
|
-
parts.push("border-bottom-width: 0px");
|
|
2719
|
+
parts.push(`border-top-width: ${w}px`, "border-bottom-width: 0px");
|
|
3276
2720
|
}
|
|
3277
2721
|
if ("__divideColor" in styles) parts.push(`border-color: ${String(styles.__divideColor)}`);
|
|
3278
2722
|
if ("__divideStyle" in styles) parts.push(`border-style: ${String(styles.__divideStyle)}`);
|
|
3279
2723
|
return parts.join("; ");
|
|
3280
2724
|
}
|
|
3281
|
-
function buildClassCSSRules(cls, bucketKey, styles, darkMode, important, screens) {
|
|
3282
|
-
const rules = [];
|
|
3283
|
-
if ("__keyframe" in styles && typeof styles.__keyframe === "string") {
|
|
3284
|
-
rules.push(styles.__keyframe);
|
|
3285
|
-
}
|
|
3286
|
-
const isDivide = "__divideX" in styles || "__divideY" in styles || "__divideColor" in styles || "__divideStyle" in styles;
|
|
3287
|
-
const escaped = escapeCSSSelector(cls);
|
|
3288
|
-
const childSuffix = isDivide ? " > * + *" : "";
|
|
3289
|
-
if (bucketKey === "base") {
|
|
3290
|
-
const baseCssDecls = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, important);
|
|
3291
|
-
if (!baseCssDecls) return rules;
|
|
3292
|
-
rules.push(`.${escaped}${childSuffix} { ${baseCssDecls} }`);
|
|
3293
|
-
return rules;
|
|
3294
|
-
}
|
|
3295
|
-
const mods = bucketKey.split(":");
|
|
3296
|
-
const responsiveMods = mods.filter((m) => RESPONSIVE_MODS.has(m));
|
|
3297
|
-
const nonResponsiveMods = mods.filter((m) => !RESPONSIVE_MODS.has(m));
|
|
3298
|
-
const hasDark = nonResponsiveMods.includes("dark") || nonResponsiveMods.includes("not-light");
|
|
3299
|
-
const hasLight = nonResponsiveMods.includes("light") || nonResponsiveMods.includes("not-dark");
|
|
3300
|
-
const hasPrint = nonResponsiveMods.includes("print");
|
|
3301
|
-
const mediaMods = nonResponsiveMods.filter((m) => m in MEDIA_MODS);
|
|
3302
|
-
const dirMods = nonResponsiveMods.filter((m) => m in DIR_MODS);
|
|
3303
|
-
const ancestorMods = nonResponsiveMods.filter((m) => m in GROUP_PEER_PREFIX);
|
|
3304
|
-
const pseudoMods = nonResponsiveMods.filter(
|
|
3305
|
-
(m) => !MODE_MODS.has(m) && !(m in GROUP_PEER_PREFIX) && !PRINT_MODS.has(m) && !(m in MEDIA_MODS) && !(m in DIR_MODS)
|
|
3306
|
-
);
|
|
3307
|
-
const pseudoSuffix = pseudoMods.map((p) => MODIFIER_TO_PSEUDO[p] ?? `:${p}`).join("");
|
|
3308
|
-
const elementSelector = `.${escaped}${pseudoSuffix}${childSuffix}`;
|
|
3309
|
-
const ancestorPrefix = ancestorMods.length ? ancestorMods.map((m) => GROUP_PEER_PREFIX[m]).join(" ") + " " : "";
|
|
3310
|
-
const dirPrefix = dirMods.length ? dirMods.map((m) => DIR_MODS[m]).join(" ") + " " : "";
|
|
3311
|
-
const selector = `${dirPrefix}${ancestorPrefix}${elementSelector}`;
|
|
3312
|
-
const CSS_ONLY_PSEUDOS = /* @__PURE__ */ new Set([
|
|
3313
|
-
"first",
|
|
3314
|
-
"last",
|
|
3315
|
-
"odd",
|
|
3316
|
-
"even",
|
|
3317
|
-
"only",
|
|
3318
|
-
"focus-within",
|
|
3319
|
-
"focus-visible"
|
|
3320
|
-
]);
|
|
3321
|
-
const needsImportant = important || hasPrint || mediaMods.length > 0 || dirMods.length > 0 || ancestorMods.length > 0 || pseudoMods.some((m) => CSS_ONLY_PSEUDOS.has(m));
|
|
3322
|
-
const cssDecls = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, needsImportant);
|
|
3323
|
-
if (!cssDecls) return rules;
|
|
3324
|
-
let rule;
|
|
3325
|
-
if (hasDark) {
|
|
3326
|
-
if (darkMode === "media") {
|
|
3327
|
-
rule = `@media (prefers-color-scheme: dark) { ${selector} { ${cssDecls} } }`;
|
|
3328
|
-
} else if (darkMode === "class") {
|
|
3329
|
-
rule = `.dark ${selector} { ${cssDecls} }`;
|
|
3330
|
-
} else {
|
|
3331
|
-
rule = `[data-theme="dark"] ${selector} { ${cssDecls} }`;
|
|
3332
|
-
}
|
|
3333
|
-
} else if (hasLight) {
|
|
3334
|
-
if (darkMode === "media") {
|
|
3335
|
-
rule = `@media (prefers-color-scheme: light) { ${selector} { ${cssDecls} } }`;
|
|
3336
|
-
} else if (darkMode === "class") {
|
|
3337
|
-
rule = `:not(.dark) ${selector} { ${cssDecls} }`;
|
|
3338
|
-
} else {
|
|
3339
|
-
rule = `[data-theme="light"] ${selector} { ${cssDecls} }`;
|
|
3340
|
-
}
|
|
3341
|
-
} else {
|
|
3342
|
-
rule = `${selector} { ${cssDecls} }`;
|
|
3343
|
-
}
|
|
3344
|
-
if (hasPrint) rule = `@media print { ${rule} }`;
|
|
3345
|
-
for (const m of mediaMods) rule = `@media ${MEDIA_MODS[m]} { ${rule} }`;
|
|
3346
|
-
if (responsiveMods.length > 0) {
|
|
3347
|
-
const minWidth = Math.max(...responsiveMods.map((m) => screens[m] ?? 0));
|
|
3348
|
-
if (minWidth > 0) rule = `@media (min-width: ${minWidth}px) { ${rule} }`;
|
|
3349
|
-
}
|
|
3350
|
-
rules.push(rule);
|
|
3351
|
-
return rules;
|
|
3352
|
-
}
|
|
3353
|
-
function injectClassRule(cls, bucketKey, styles, darkMode, important = false) {
|
|
3354
|
-
const cssRules = buildClassCSSRules(cls, bucketKey, styles, darkMode, important, getGlobalScreens());
|
|
3355
|
-
for (const r of cssRules) injectRule(r);
|
|
3356
|
-
}
|
|
3357
2725
|
var RN_ONLY_PROPS = /* @__PURE__ */ new Set([
|
|
3358
2726
|
"shadowColor",
|
|
3359
2727
|
"shadowOffset",
|
|
@@ -3363,13 +2731,10 @@ var RN_ONLY_PROPS = /* @__PURE__ */ new Set([
|
|
|
3363
2731
|
"includeFontPadding",
|
|
3364
2732
|
"textAlignVertical",
|
|
3365
2733
|
"writingDirection",
|
|
3366
|
-
// Text shadow native props — web uses the textShadow CSS shorthand instead
|
|
3367
2734
|
"textShadowColor",
|
|
3368
2735
|
"textShadowOffset",
|
|
3369
2736
|
"textShadowRadius",
|
|
3370
|
-
// tintColor is native-only (Image/icon tinting)
|
|
3371
2737
|
"tintColor",
|
|
3372
|
-
// Internal markers — handled specially, never serialized as CSS props
|
|
3373
2738
|
"__divideX",
|
|
3374
2739
|
"__divideY",
|
|
3375
2740
|
"__divideColor",
|
|
@@ -3411,8 +2776,7 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3411
2776
|
const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
|
|
3412
2777
|
if (prop in RN_SHORTHAND_EXPAND) {
|
|
3413
2778
|
const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
|
|
3414
|
-
parts.push(`${p1}: ${cssVal}${imp}`);
|
|
3415
|
-
parts.push(`${p2}: ${cssVal}${imp}`);
|
|
2779
|
+
parts.push(`${p1}: ${cssVal}${imp}`, `${p2}: ${cssVal}${imp}`);
|
|
3416
2780
|
continue;
|
|
3417
2781
|
}
|
|
3418
2782
|
parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
|
|
@@ -3422,14 +2786,87 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3422
2786
|
function camelToKebab(str) {
|
|
3423
2787
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
3424
2788
|
}
|
|
2789
|
+
function buildClassCSSRules(cls, bucketKey, styles, darkMode, important, screens) {
|
|
2790
|
+
const rules = [];
|
|
2791
|
+
if ("__keyframe" in styles && typeof styles.__keyframe === "string") {
|
|
2792
|
+
rules.push(styles.__keyframe);
|
|
2793
|
+
}
|
|
2794
|
+
const isDivide = "__divideX" in styles || "__divideY" in styles || "__divideColor" in styles || "__divideStyle" in styles;
|
|
2795
|
+
const escaped = escapeCSSSelector(cls);
|
|
2796
|
+
const childSuffix = isDivide ? " > * + *" : "";
|
|
2797
|
+
if (bucketKey === "base") {
|
|
2798
|
+
const decls2 = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, important);
|
|
2799
|
+
if (!decls2) return rules;
|
|
2800
|
+
rules.push(`.${escaped}${childSuffix} { ${decls2} }`);
|
|
2801
|
+
return rules;
|
|
2802
|
+
}
|
|
2803
|
+
const mods = bucketKey.split(":");
|
|
2804
|
+
let darkScheme;
|
|
2805
|
+
let needsImportant = important;
|
|
2806
|
+
const pseudoParts = [];
|
|
2807
|
+
const ancestorParts = [];
|
|
2808
|
+
const dirParts = [];
|
|
2809
|
+
const mediaWrappers = [];
|
|
2810
|
+
let minWidth = 0;
|
|
2811
|
+
for (const mod of mods) {
|
|
2812
|
+
const def = getModifier(mod);
|
|
2813
|
+
if (!def) continue;
|
|
2814
|
+
if (def.darkScheme) darkScheme = def.darkScheme;
|
|
2815
|
+
if (def.pseudo) pseudoParts.push(def.pseudo);
|
|
2816
|
+
if (def.ancestorSelector) {
|
|
2817
|
+
ancestorParts.push(def.ancestorSelector);
|
|
2818
|
+
needsImportant = true;
|
|
2819
|
+
}
|
|
2820
|
+
if (def.dirSelector) {
|
|
2821
|
+
dirParts.push(def.dirSelector);
|
|
2822
|
+
needsImportant = true;
|
|
2823
|
+
}
|
|
2824
|
+
if (def.mediaQuery) {
|
|
2825
|
+
mediaWrappers.push(`@media ${def.mediaQuery}`);
|
|
2826
|
+
needsImportant = true;
|
|
2827
|
+
}
|
|
2828
|
+
if (def.isResponsive) {
|
|
2829
|
+
const w = screens[mod] ?? 0;
|
|
2830
|
+
if (w > minWidth) minWidth = w;
|
|
2831
|
+
}
|
|
2832
|
+
if (def.forcesImportant) needsImportant = true;
|
|
2833
|
+
}
|
|
2834
|
+
const pseudoSuffix = pseudoParts.join("");
|
|
2835
|
+
const elementSelector = `.${escaped}${pseudoSuffix}${childSuffix}`;
|
|
2836
|
+
const ancestorPrefix = ancestorParts.join("");
|
|
2837
|
+
const dirPrefix = dirParts.join("");
|
|
2838
|
+
const selector = `${dirPrefix}${ancestorPrefix}${elementSelector}`;
|
|
2839
|
+
const decls = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, needsImportant);
|
|
2840
|
+
if (!decls) return rules;
|
|
2841
|
+
let rule;
|
|
2842
|
+
if (darkScheme === "dark") {
|
|
2843
|
+
if (darkMode === "media") rule = `@media (prefers-color-scheme: dark) { ${selector} { ${decls} } }`;
|
|
2844
|
+
else if (darkMode === "class") rule = `.dark ${selector} { ${decls} }`;
|
|
2845
|
+
else rule = `[data-theme="dark"] ${selector} { ${decls} }`;
|
|
2846
|
+
} else if (darkScheme === "light") {
|
|
2847
|
+
if (darkMode === "media") rule = `@media (prefers-color-scheme: light) { ${selector} { ${decls} } }`;
|
|
2848
|
+
else if (darkMode === "class") rule = `:not(.dark) ${selector} { ${decls} }`;
|
|
2849
|
+
else rule = `[data-theme="light"] ${selector} { ${decls} }`;
|
|
2850
|
+
} else {
|
|
2851
|
+
rule = `${selector} { ${decls} }`;
|
|
2852
|
+
}
|
|
2853
|
+
for (const mw of mediaWrappers) rule = `${mw} { ${rule} }`;
|
|
2854
|
+
if (minWidth > 0) rule = `@media (min-width: ${minWidth}px) { ${rule} }`;
|
|
2855
|
+
rules.push(rule);
|
|
2856
|
+
return rules;
|
|
2857
|
+
}
|
|
2858
|
+
function injectClassRule(cls, bucketKey, styles, darkMode, important) {
|
|
2859
|
+
const cssRules = buildClassCSSRules(cls, bucketKey, styles, darkMode, important, getGlobalScreens());
|
|
2860
|
+
for (const r of cssRules) injectRule(r);
|
|
2861
|
+
}
|
|
3425
2862
|
function resolve(classString, theme, darkMode = "attribute") {
|
|
2863
|
+
const cache = getThemeCache(theme);
|
|
3426
2864
|
const cacheKey = `${classString}::${darkMode}`;
|
|
3427
|
-
const cached =
|
|
2865
|
+
const cached = cache.get(cacheKey);
|
|
3428
2866
|
if (cached) return cached;
|
|
3429
2867
|
const result = {};
|
|
3430
|
-
const
|
|
3431
|
-
const
|
|
3432
|
-
for (const parsed of parsedClasses) {
|
|
2868
|
+
const onWeb = typeof document !== "undefined";
|
|
2869
|
+
for (const parsed of parseClasses(classString)) {
|
|
3433
2870
|
const styles = resolveUtility(parsed, theme);
|
|
3434
2871
|
if (!styles) {
|
|
3435
2872
|
if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility)) {
|
|
@@ -3440,132 +2877,60 @@ function resolve(classString, theme, darkMode = "attribute") {
|
|
|
3440
2877
|
const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
|
|
3441
2878
|
if (!result[bucketKey]) result[bucketKey] = {};
|
|
3442
2879
|
Object.assign(result[bucketKey], styles);
|
|
3443
|
-
if (
|
|
3444
|
-
|
|
3445
|
-
}
|
|
3446
|
-
}
|
|
3447
|
-
styleCache.set(cacheKey, result);
|
|
3448
|
-
if (typeof document !== "undefined") {
|
|
3449
|
-
for (const { cls, bucketKey, styles, important } of injectQueue) {
|
|
3450
|
-
injectClassRule(cls, bucketKey, styles, darkMode, important);
|
|
2880
|
+
if (onWeb) {
|
|
2881
|
+
injectClassRule(parsed.original, bucketKey, styles, darkMode, parsed.important);
|
|
3451
2882
|
}
|
|
3452
2883
|
}
|
|
2884
|
+
cache.set(cacheKey, result);
|
|
3453
2885
|
return result;
|
|
3454
2886
|
}
|
|
3455
2887
|
function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new Set()) {
|
|
3456
2888
|
const result = {};
|
|
3457
|
-
const
|
|
3458
|
-
entries.sort((a, b) => {
|
|
3459
|
-
const pa = a[0] === "base" ? -1 : a[0].split(":").length;
|
|
3460
|
-
const pb = b[0] === "base" ? -1 : b[0].split(":").length;
|
|
3461
|
-
return pa - pb;
|
|
3462
|
-
});
|
|
3463
|
-
for (const [key, styles] of entries) {
|
|
2889
|
+
for (const [key, styles] of getSortedEntries(resolved)) {
|
|
3464
2890
|
if (!styles) continue;
|
|
3465
2891
|
if (key === "base") {
|
|
3466
2892
|
Object.assign(result, styles);
|
|
3467
2893
|
continue;
|
|
3468
2894
|
}
|
|
3469
2895
|
const mods = key.split(":");
|
|
3470
|
-
if (
|
|
2896
|
+
if (mods.every((mod) => matchModifier(mod, isDark, state, breakpoints))) {
|
|
3471
2897
|
Object.assign(result, styles);
|
|
3472
2898
|
}
|
|
3473
2899
|
}
|
|
3474
|
-
const
|
|
3475
|
-
if (
|
|
3476
|
-
result.fontFamily =
|
|
2900
|
+
const defaultFont = getDefaultFontFamily();
|
|
2901
|
+
if (defaultFont && !("fontFamily" in result)) {
|
|
2902
|
+
result.fontFamily = defaultFont;
|
|
3477
2903
|
}
|
|
3478
|
-
if (
|
|
2904
|
+
if (!isNative) {
|
|
3479
2905
|
const r = result;
|
|
3480
|
-
const
|
|
3481
|
-
if (
|
|
3482
|
-
r.paddingLeft =
|
|
3483
|
-
r.paddingRight =
|
|
2906
|
+
const ph = r.paddingHorizontal;
|
|
2907
|
+
if (ph !== void 0) {
|
|
2908
|
+
r.paddingLeft = ph;
|
|
2909
|
+
r.paddingRight = ph;
|
|
3484
2910
|
delete r.paddingHorizontal;
|
|
3485
2911
|
}
|
|
3486
|
-
const
|
|
3487
|
-
if (
|
|
3488
|
-
r.paddingTop =
|
|
3489
|
-
r.paddingBottom =
|
|
2912
|
+
const pv = r.paddingVertical;
|
|
2913
|
+
if (pv !== void 0) {
|
|
2914
|
+
r.paddingTop = pv;
|
|
2915
|
+
r.paddingBottom = pv;
|
|
3490
2916
|
delete r.paddingVertical;
|
|
3491
2917
|
}
|
|
3492
|
-
const
|
|
3493
|
-
if (
|
|
3494
|
-
r.marginLeft =
|
|
3495
|
-
r.marginRight =
|
|
2918
|
+
const mh = r.marginHorizontal;
|
|
2919
|
+
if (mh !== void 0) {
|
|
2920
|
+
r.marginLeft = mh;
|
|
2921
|
+
r.marginRight = mh;
|
|
3496
2922
|
delete r.marginHorizontal;
|
|
3497
2923
|
}
|
|
3498
|
-
const
|
|
3499
|
-
if (
|
|
3500
|
-
r.marginTop =
|
|
3501
|
-
r.marginBottom =
|
|
2924
|
+
const mv = r.marginVertical;
|
|
2925
|
+
if (mv !== void 0) {
|
|
2926
|
+
r.marginTop = mv;
|
|
2927
|
+
r.marginBottom = mv;
|
|
3502
2928
|
delete r.marginVertical;
|
|
3503
2929
|
}
|
|
3504
2930
|
}
|
|
3505
2931
|
return result;
|
|
3506
2932
|
}
|
|
3507
|
-
function matchesMods(mods, isDark, state, breakpoints) {
|
|
3508
|
-
return mods.every((mod) => {
|
|
3509
|
-
switch (mod) {
|
|
3510
|
-
case "dark":
|
|
3511
|
-
return isDark;
|
|
3512
|
-
case "light":
|
|
3513
|
-
case "not-dark":
|
|
3514
|
-
return !isDark;
|
|
3515
|
-
case "not-light":
|
|
3516
|
-
return isDark;
|
|
3517
|
-
case "hover":
|
|
3518
|
-
return !!state.hover;
|
|
3519
|
-
case "not-hover":
|
|
3520
|
-
return !state.hover;
|
|
3521
|
-
case "focus":
|
|
3522
|
-
return !!state.focus;
|
|
3523
|
-
case "not-focus":
|
|
3524
|
-
return !state.focus;
|
|
3525
|
-
case "pressed":
|
|
3526
|
-
case "active":
|
|
3527
|
-
return !!state.pressed || !!state.active;
|
|
3528
|
-
case "not-pressed":
|
|
3529
|
-
case "not-active":
|
|
3530
|
-
return !state.pressed && !state.active;
|
|
3531
|
-
case "disabled":
|
|
3532
|
-
return !!state.disabled;
|
|
3533
|
-
case "not-disabled":
|
|
3534
|
-
return !state.disabled;
|
|
3535
|
-
case "checked":
|
|
3536
|
-
return !!state.checked;
|
|
3537
|
-
case "not-checked":
|
|
3538
|
-
return !state.checked;
|
|
3539
|
-
case "visited":
|
|
3540
|
-
return !!state.visited;
|
|
3541
|
-
case "not-visited":
|
|
3542
|
-
return !state.visited;
|
|
3543
|
-
case "placeholder":
|
|
3544
|
-
return !!state.placeholder;
|
|
3545
|
-
case "sm":
|
|
3546
|
-
case "md":
|
|
3547
|
-
case "lg":
|
|
3548
|
-
case "xl":
|
|
3549
|
-
case "2xl":
|
|
3550
|
-
return breakpoints.has(mod);
|
|
3551
|
-
// CSS-only modifiers — never applied as inline styles
|
|
3552
|
-
case "print":
|
|
3553
|
-
case "landscape":
|
|
3554
|
-
case "portrait":
|
|
3555
|
-
case "motion-reduce":
|
|
3556
|
-
case "motion-safe":
|
|
3557
|
-
case "contrast-more":
|
|
3558
|
-
case "contrast-less":
|
|
3559
|
-
case "rtl":
|
|
3560
|
-
case "ltr":
|
|
3561
|
-
return false;
|
|
3562
|
-
default:
|
|
3563
|
-
return false;
|
|
3564
|
-
}
|
|
3565
|
-
});
|
|
3566
|
-
}
|
|
3567
2933
|
function clearCache() {
|
|
3568
|
-
styleCache.clear();
|
|
3569
2934
|
_injectedRules.clear();
|
|
3570
2935
|
if (_styleEl) {
|
|
3571
2936
|
_styleEl.remove();
|
|
@@ -3612,14 +2977,24 @@ function resolveOneRef(ref, colors) {
|
|
|
3612
2977
|
return entry[m[2]] ?? null;
|
|
3613
2978
|
}
|
|
3614
2979
|
function resolveColorRefs(colors) {
|
|
2980
|
+
const MAX_DEPTH = 5;
|
|
2981
|
+
function resolveChain(raw) {
|
|
2982
|
+
let current = raw;
|
|
2983
|
+
for (let i = 0; i < MAX_DEPTH; i++) {
|
|
2984
|
+
const next = resolveOneRef(current, colors);
|
|
2985
|
+
if (!next || next === current) break;
|
|
2986
|
+
current = next;
|
|
2987
|
+
}
|
|
2988
|
+
return current;
|
|
2989
|
+
}
|
|
3615
2990
|
const out = {};
|
|
3616
2991
|
for (const [key, val] of Object.entries(colors)) {
|
|
3617
2992
|
if (typeof val === "string") {
|
|
3618
|
-
out[key] =
|
|
2993
|
+
out[key] = resolveChain(val);
|
|
3619
2994
|
} else {
|
|
3620
2995
|
const shades = {};
|
|
3621
2996
|
for (const [shade, hex] of Object.entries(val)) {
|
|
3622
|
-
shades[shade] =
|
|
2997
|
+
shades[shade] = resolveChain(hex);
|
|
3623
2998
|
}
|
|
3624
2999
|
out[key] = shades;
|
|
3625
3000
|
}
|
|
@@ -3667,15 +3042,26 @@ function buildConfig(userConfig) {
|
|
|
3667
3042
|
injectGlobalStyles(resolved.theme);
|
|
3668
3043
|
return resolved;
|
|
3669
3044
|
}
|
|
3045
|
+
function _selectorToModifierDef(selector) {
|
|
3046
|
+
const s = selector.trim();
|
|
3047
|
+
if (s.startsWith("@media ")) {
|
|
3048
|
+
return { mediaQuery: s.slice(7), jsBehavior: "css-only", forcesImportant: true };
|
|
3049
|
+
}
|
|
3050
|
+
if (s.startsWith("::") || s.startsWith(":")) {
|
|
3051
|
+
return { pseudo: s, jsBehavior: "css-only", forcesImportant: true };
|
|
3052
|
+
}
|
|
3053
|
+
return { ancestorSelector: s.endsWith(" ") ? s : `${s} `, jsBehavior: "css-only", forcesImportant: true };
|
|
3054
|
+
}
|
|
3670
3055
|
function makePluginAPI(theme) {
|
|
3671
3056
|
const standalone = getPluginStandaloneMap();
|
|
3672
3057
|
return {
|
|
3673
3058
|
addUtility(name, styles) {
|
|
3674
3059
|
standalone[name] = styles;
|
|
3675
3060
|
},
|
|
3676
|
-
addVariant(name,
|
|
3677
|
-
|
|
3678
|
-
|
|
3061
|
+
addVariant(name, selectorOrDef) {
|
|
3062
|
+
const def = typeof selectorOrDef === "string" ? _selectorToModifierDef(selectorOrDef) : selectorOrDef;
|
|
3063
|
+
customVariants[name] = typeof selectorOrDef === "string" ? selectorOrDef : name;
|
|
3064
|
+
registerModifier(name, def);
|
|
3679
3065
|
},
|
|
3680
3066
|
theme(path, defaultValue) {
|
|
3681
3067
|
const parts = path.replace(/\[([^\]]+)\]/g, ".$1").split(".");
|
|
@@ -3800,8 +3186,16 @@ function ThemeProvider({
|
|
|
3800
3186
|
() => isWeb && typeof window !== "undefined" ? window.innerWidth : 0
|
|
3801
3187
|
);
|
|
3802
3188
|
const effectiveWidth = windowWidthProp ?? (isWeb ? webWidth : 0);
|
|
3803
|
-
|
|
3804
|
-
|
|
3189
|
+
const numericScreens = {};
|
|
3190
|
+
for (const [k, v] of Object.entries(resolvedConfig.theme.screens ?? {})) {
|
|
3191
|
+
numericScreens[k] = typeof v === "number" ? v : parseInt(String(v), 10);
|
|
3192
|
+
}
|
|
3193
|
+
const _prevWidthRef = (0, import_react3.useRef)(-1);
|
|
3194
|
+
if (_prevWidthRef.current !== effectiveWidth) {
|
|
3195
|
+
_prevWidthRef.current = effectiveWidth;
|
|
3196
|
+
syncGlobalWidth(effectiveWidth);
|
|
3197
|
+
}
|
|
3198
|
+
syncGlobalScreens(numericScreens);
|
|
3805
3199
|
(0, import_react3.useEffect)(() => {
|
|
3806
3200
|
setGlobalWidth(effectiveWidth);
|
|
3807
3201
|
}, [effectiveWidth]);
|
|
@@ -4075,17 +3469,19 @@ function useConditionalWidth(active) {
|
|
|
4075
3469
|
);
|
|
4076
3470
|
}
|
|
4077
3471
|
|
|
4078
|
-
// src/
|
|
4079
|
-
var RESPONSIVE_MODS2 = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
|
|
3472
|
+
// src/shared-utils.ts
|
|
4080
3473
|
function hasResponsiveBuckets(resolved) {
|
|
3474
|
+
const responsiveMods = getResponsiveModifiers();
|
|
4081
3475
|
for (const key of Object.keys(resolved)) {
|
|
4082
3476
|
if (key === "base") continue;
|
|
4083
3477
|
for (const mod of key.split(":")) {
|
|
4084
|
-
if (
|
|
3478
|
+
if (responsiveMods.has(mod)) return true;
|
|
4085
3479
|
}
|
|
4086
3480
|
}
|
|
4087
3481
|
return false;
|
|
4088
3482
|
}
|
|
3483
|
+
|
|
3484
|
+
// src/styled.tsx
|
|
4089
3485
|
function styled(Component, baseClasses = "") {
|
|
4090
3486
|
const Styled = (0, import_react6.forwardRef)(
|
|
4091
3487
|
(props, ref) => {
|
|
@@ -4180,10 +3576,10 @@ var import_react7 = require("react");
|
|
|
4180
3576
|
function useStyles(classString, state = {}) {
|
|
4181
3577
|
const { isDark, config } = useTheme();
|
|
4182
3578
|
const width = useGlobalWidth();
|
|
4183
|
-
const breakpoints = getActiveBreakpoints(width);
|
|
4184
3579
|
const normalised = Array.isArray(classString) ? classString.join(" ") : classString;
|
|
4185
3580
|
return (0, import_react7.useMemo)(() => {
|
|
4186
3581
|
const resolved = resolve(normalised, config.theme, config.darkMode);
|
|
3582
|
+
const breakpoints = getActiveBreakpoints(width);
|
|
4187
3583
|
return flatten(resolved, isDark, state, breakpoints);
|
|
4188
3584
|
}, [normalised, isDark, config, width, state.hover, state.focus, state.pressed, state.active, state.disabled, state.checked, state.visited, state.placeholder]);
|
|
4189
3585
|
}
|
|
@@ -4213,11 +3609,15 @@ function useGlobalDarkMode() {
|
|
|
4213
3609
|
}
|
|
4214
3610
|
|
|
4215
3611
|
// src/useBreakpoint.ts
|
|
3612
|
+
var import_react9 = require("react");
|
|
4216
3613
|
function useBreakpoint() {
|
|
4217
3614
|
const { config } = useTheme();
|
|
4218
3615
|
const width = useGlobalWidth();
|
|
4219
3616
|
const screens = config.theme.screens;
|
|
4220
|
-
const sorted =
|
|
3617
|
+
const sorted = (0, import_react9.useMemo)(
|
|
3618
|
+
() => Object.entries(screens).filter(([, v]) => typeof v === "number").sort(([, a], [, b]) => b - a),
|
|
3619
|
+
[screens]
|
|
3620
|
+
);
|
|
4221
3621
|
for (const [name, minW] of sorted) {
|
|
4222
3622
|
if (width >= minW) return name;
|
|
4223
3623
|
}
|
|
@@ -4227,32 +3627,24 @@ function useResponsive() {
|
|
|
4227
3627
|
const { config } = useTheme();
|
|
4228
3628
|
const width = useGlobalWidth();
|
|
4229
3629
|
const screens = config.theme.screens;
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
3630
|
+
return (0, import_react9.useMemo)(() => {
|
|
3631
|
+
const result = {};
|
|
3632
|
+
for (const [name, minW] of Object.entries(screens)) {
|
|
3633
|
+
if (typeof minW === "number") result[name] = width >= minW;
|
|
3634
|
+
}
|
|
3635
|
+
return result;
|
|
3636
|
+
}, [screens, width]);
|
|
4235
3637
|
}
|
|
4236
3638
|
|
|
4237
3639
|
// src/InteractiveWrapper.tsx
|
|
4238
|
-
var
|
|
3640
|
+
var import_react10 = __toESM(require("react"));
|
|
4239
3641
|
function chain(original, extra) {
|
|
4240
3642
|
return (...args) => {
|
|
4241
3643
|
original?.(...args);
|
|
4242
3644
|
extra();
|
|
4243
3645
|
};
|
|
4244
3646
|
}
|
|
4245
|
-
var
|
|
4246
|
-
function hasResponsiveBuckets2(resolved) {
|
|
4247
|
-
for (const key of Object.keys(resolved)) {
|
|
4248
|
-
if (key === "base") continue;
|
|
4249
|
-
for (const mod of key.split(":")) {
|
|
4250
|
-
if (RESPONSIVE_MODS3.has(mod)) return true;
|
|
4251
|
-
}
|
|
4252
|
-
}
|
|
4253
|
-
return false;
|
|
4254
|
-
}
|
|
4255
|
-
var InteractiveWrapper = (0, import_react9.forwardRef)(
|
|
3647
|
+
var InteractiveWrapper = (0, import_react10.forwardRef)(
|
|
4256
3648
|
function InteractiveWrapper2({
|
|
4257
3649
|
Component,
|
|
4258
3650
|
resolvedStyle,
|
|
@@ -4270,22 +3662,22 @@ var InteractiveWrapper = (0, import_react9.forwardRef)(
|
|
|
4270
3662
|
...rest
|
|
4271
3663
|
}, ref) {
|
|
4272
3664
|
const isDark = useGlobalDarkMode();
|
|
4273
|
-
const needsWidth =
|
|
3665
|
+
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
4274
3666
|
const width = useConditionalWidth(needsWidth);
|
|
4275
3667
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
4276
|
-
const [pressed, setPressed] = (0,
|
|
4277
|
-
const [hovered, setHovered] = (0,
|
|
4278
|
-
const [focused, setFocused] = (0,
|
|
4279
|
-
const handlePressIn = (0,
|
|
4280
|
-
const handlePressOut = (0,
|
|
4281
|
-
const handlePointerDown = (0,
|
|
4282
|
-
const handlePointerUp = (0,
|
|
4283
|
-
const handlePointerLeave = (0,
|
|
4284
|
-
const handleMouseEnter = (0,
|
|
4285
|
-
const handleMouseLeave = (0,
|
|
4286
|
-
const handleFocus = (0,
|
|
4287
|
-
const handleBlur = (0,
|
|
4288
|
-
const computedStyle = (0,
|
|
3668
|
+
const [pressed, setPressed] = (0, import_react10.useState)(false);
|
|
3669
|
+
const [hovered, setHovered] = (0, import_react10.useState)(false);
|
|
3670
|
+
const [focused, setFocused] = (0, import_react10.useState)(false);
|
|
3671
|
+
const handlePressIn = (0, import_react10.useCallback)(chain(onPressIn, () => setPressed(true)), [onPressIn]);
|
|
3672
|
+
const handlePressOut = (0, import_react10.useCallback)(chain(onPressOut, () => setPressed(false)), [onPressOut]);
|
|
3673
|
+
const handlePointerDown = (0, import_react10.useCallback)(chain(onPointerDown, () => setPressed(true)), [onPointerDown]);
|
|
3674
|
+
const handlePointerUp = (0, import_react10.useCallback)(chain(onPointerUp, () => setPressed(false)), [onPointerUp]);
|
|
3675
|
+
const handlePointerLeave = (0, import_react10.useCallback)(chain(onPointerLeave, () => setPressed(false)), [onPointerLeave]);
|
|
3676
|
+
const handleMouseEnter = (0, import_react10.useCallback)(chain(onMouseEnter, () => setHovered(true)), [onMouseEnter]);
|
|
3677
|
+
const handleMouseLeave = (0, import_react10.useCallback)(chain(onMouseLeave, () => setHovered(false)), [onMouseLeave]);
|
|
3678
|
+
const handleFocus = (0, import_react10.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
|
|
3679
|
+
const handleBlur = (0, import_react10.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
|
|
3680
|
+
const computedStyle = (0, import_react10.useMemo)(
|
|
4289
3681
|
() => {
|
|
4290
3682
|
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
|
|
4291
3683
|
delete s.__divideX;
|
|
@@ -4327,16 +3719,16 @@ var InteractiveWrapper = (0, import_react9.forwardRef)(
|
|
|
4327
3719
|
ref,
|
|
4328
3720
|
...restWithoutChildren,
|
|
4329
3721
|
style: finalStyle,
|
|
4330
|
-
|
|
3722
|
+
...!isNative && className ? { className } : {},
|
|
4331
3723
|
// onPressIn / onPressOut are React Native-only.
|
|
4332
3724
|
// On web, onPointerDown/Up drive the pressed state instead (covers mouse + touch).
|
|
4333
|
-
|
|
3725
|
+
...!isNative ? { onPointerDown: handlePointerDown, onPointerUp: handlePointerUp, onPointerLeave: handlePointerLeave } : { onPressIn: handlePressIn, onPressOut: handlePressOut },
|
|
4334
3726
|
onMouseEnter: handleMouseEnter,
|
|
4335
3727
|
onMouseLeave: handleMouseLeave,
|
|
4336
3728
|
onFocus: handleFocus,
|
|
4337
3729
|
onBlur: handleBlur
|
|
4338
3730
|
};
|
|
4339
|
-
return Array.isArray(children) ?
|
|
3731
|
+
return Array.isArray(children) ? import_react10.default.createElement(Component, componentProps, ...children) : import_react10.default.createElement(Component, componentProps, children);
|
|
4340
3732
|
}
|
|
4341
3733
|
);
|
|
4342
3734
|
InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
|