@kbach/react 0.5.37 → 0.5.40
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-VZHNEDUW.mjs → chunk-6NHHYHNV.mjs} +36 -55
- package/dist/{chunk-36QDTNAQ.mjs → chunk-EYPBYQSB.mjs} +16 -10
- package/dist/{chunk-J2I5YSC5.mjs → chunk-IZ3W6G3V.mjs} +411 -1008
- package/dist/index.d.mts +10 -20
- package/dist/index.d.ts +10 -20
- package/dist/index.js +445 -1038
- 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 +444 -1062
- 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 +442 -1060
- 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 +301 -841
- 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);
|
|
@@ -726,773 +743,104 @@ function escapeCSSSelector(cls) {
|
|
|
726
743
|
return cls.replace(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g, "\\$&");
|
|
727
744
|
}
|
|
728
745
|
|
|
729
|
-
// src/core/
|
|
730
|
-
var
|
|
731
|
-
|
|
732
|
-
|
|
746
|
+
// src/core/registry.ts
|
|
747
|
+
var BUILTIN_MODIFIERS = {
|
|
748
|
+
// ── Mode ─────────────────────────────────────────────────────────────────
|
|
749
|
+
dark: { darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
|
|
750
|
+
"not-light": { darkScheme: "dark", jsBehavior: "mode", jsMatch: (d) => d },
|
|
751
|
+
light: { darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
|
|
752
|
+
"not-dark": { darkScheme: "light", jsBehavior: "mode", jsMatch: (d) => !d },
|
|
753
|
+
// ── Interactive — JS state + CSS pseudo ───────────────────────────────────
|
|
754
|
+
hover: { pseudo: ":hover", jsBehavior: "interactive", jsMatch: (_, s) => !!s.hover },
|
|
755
|
+
"not-hover": { pseudo: ":not(:hover)", jsBehavior: "interactive", jsMatch: (_, s) => !s.hover },
|
|
756
|
+
focus: { pseudo: ":focus", jsBehavior: "interactive", jsMatch: (_, s) => !!s.focus },
|
|
757
|
+
"not-focus": { pseudo: ":not(:focus)", jsBehavior: "interactive", jsMatch: (_, s) => !s.focus },
|
|
758
|
+
active: { pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.active || !!s.pressed },
|
|
759
|
+
"not-active": { pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.active && !s.pressed },
|
|
760
|
+
pressed: { pseudo: ":active", jsBehavior: "interactive", jsMatch: (_, s) => !!s.pressed || !!s.active },
|
|
761
|
+
"not-pressed": { pseudo: ":not(:active)", jsBehavior: "interactive", jsMatch: (_, s) => !s.pressed && !s.active },
|
|
762
|
+
disabled: { pseudo: ":disabled", jsBehavior: "interactive", jsMatch: (_, s) => !!s.disabled },
|
|
763
|
+
"not-disabled": { pseudo: ":not(:disabled)", jsBehavior: "interactive", jsMatch: (_, s) => !s.disabled },
|
|
764
|
+
checked: { pseudo: ":checked", jsBehavior: "interactive", jsMatch: (_, s) => !!s.checked },
|
|
765
|
+
"not-checked": { pseudo: ":not(:checked)", jsBehavior: "interactive", jsMatch: (_, s) => !s.checked },
|
|
766
|
+
visited: { pseudo: ":visited", jsBehavior: "interactive", jsMatch: (_, s) => !!s.visited },
|
|
767
|
+
"not-visited": { pseudo: ":not(:visited)", jsBehavior: "interactive", jsMatch: (_, s) => !s.visited },
|
|
768
|
+
placeholder: { pseudo: "::placeholder", jsBehavior: "interactive", jsMatch: (_, s) => !!s.placeholder },
|
|
769
|
+
// ── CSS-only pseudo-classes (structural) ──────────────────────────────────
|
|
770
|
+
first: { pseudo: ":first-child", jsBehavior: "css-only", forcesImportant: true },
|
|
771
|
+
last: { pseudo: ":last-child", jsBehavior: "css-only", forcesImportant: true },
|
|
772
|
+
odd: { pseudo: ":nth-child(odd)", jsBehavior: "css-only", forcesImportant: true },
|
|
773
|
+
even: { pseudo: ":nth-child(even)", jsBehavior: "css-only", forcesImportant: true },
|
|
774
|
+
only: { pseudo: ":only-child", jsBehavior: "css-only", forcesImportant: true },
|
|
775
|
+
"focus-within": { pseudo: ":focus-within", jsBehavior: "css-only", forcesImportant: true },
|
|
776
|
+
"focus-visible": { pseudo: ":focus-visible", jsBehavior: "css-only", forcesImportant: true },
|
|
777
|
+
// ── CSS-only pseudo-elements ───────────────────────────────────────────────
|
|
778
|
+
before: { pseudo: "::before", jsBehavior: "css-only" },
|
|
779
|
+
after: { pseudo: "::after", jsBehavior: "css-only" },
|
|
780
|
+
selection: { pseudo: "::selection", jsBehavior: "css-only" },
|
|
781
|
+
"first-letter": { pseudo: "::first-letter", jsBehavior: "css-only" },
|
|
782
|
+
"first-line": { pseudo: "::first-line", jsBehavior: "css-only" },
|
|
783
|
+
marker: { pseudo: "::marker", jsBehavior: "css-only" },
|
|
784
|
+
// ── Group / peer ancestor selectors (CSS-only) ─────────────────────────────
|
|
785
|
+
"group-hover": { ancestorSelector: ".group:hover ", jsBehavior: "css-only", forcesImportant: true },
|
|
786
|
+
"group-focus": { ancestorSelector: ".group:focus ", jsBehavior: "css-only", forcesImportant: true },
|
|
787
|
+
"peer-hover": { ancestorSelector: ".peer:hover ~ ", jsBehavior: "css-only", forcesImportant: true },
|
|
788
|
+
"peer-focus": { ancestorSelector: ".peer:focus ~ ", jsBehavior: "css-only", forcesImportant: true },
|
|
789
|
+
// ── Responsive — both CSS (@media min-width) and JS (breakpoints set) ──────
|
|
790
|
+
sm: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("sm") },
|
|
791
|
+
md: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("md") },
|
|
792
|
+
lg: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("lg") },
|
|
793
|
+
xl: { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("xl") },
|
|
794
|
+
"2xl": { isResponsive: true, jsBehavior: "responsive", jsMatch: (_, __, bp) => bp.has("2xl") },
|
|
795
|
+
// ── Print media (CSS-only) ─────────────────────────────────────────────────
|
|
796
|
+
print: { mediaQuery: "print", jsBehavior: "css-only", forcesImportant: true },
|
|
797
|
+
// ── Orientation / accessibility media (CSS-only) ───────────────────────────
|
|
798
|
+
landscape: { mediaQuery: "(orientation: landscape)", jsBehavior: "css-only", forcesImportant: true },
|
|
799
|
+
portrait: { mediaQuery: "(orientation: portrait)", jsBehavior: "css-only", forcesImportant: true },
|
|
800
|
+
"motion-reduce": { mediaQuery: "(prefers-reduced-motion: reduce)", jsBehavior: "css-only", forcesImportant: true },
|
|
801
|
+
"motion-safe": { mediaQuery: "(prefers-reduced-motion: no-preference)", jsBehavior: "css-only", forcesImportant: true },
|
|
802
|
+
"contrast-more": { mediaQuery: "(prefers-contrast: more)", jsBehavior: "css-only", forcesImportant: true },
|
|
803
|
+
"contrast-less": { mediaQuery: "(prefers-contrast: less)", jsBehavior: "css-only", forcesImportant: true },
|
|
804
|
+
// ── Directionality (CSS-only) ──────────────────────────────────────────────
|
|
805
|
+
rtl: { dirSelector: '[dir="rtl"] ', jsBehavior: "css-only", forcesImportant: true },
|
|
806
|
+
ltr: { dirSelector: '[dir="ltr"] ', jsBehavior: "css-only", forcesImportant: true }
|
|
807
|
+
};
|
|
808
|
+
var _pluginModifiers = {};
|
|
809
|
+
var _allNames = null;
|
|
810
|
+
var _interactiveNames = null;
|
|
811
|
+
var _modeNames = null;
|
|
812
|
+
var _responsiveNames = null;
|
|
813
|
+
function _invalidate() {
|
|
814
|
+
_allNames = null;
|
|
815
|
+
_interactiveNames = null;
|
|
816
|
+
_modeNames = null;
|
|
817
|
+
_responsiveNames = null;
|
|
818
|
+
}
|
|
819
|
+
function registerModifier(name, def) {
|
|
820
|
+
_pluginModifiers[name] = def;
|
|
821
|
+
_invalidate();
|
|
733
822
|
}
|
|
734
823
|
function clearPluginModifiers() {
|
|
735
|
-
|
|
824
|
+
for (const k of Object.keys(_pluginModifiers)) delete _pluginModifiers[k];
|
|
825
|
+
_invalidate();
|
|
736
826
|
}
|
|
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 };
|
|
827
|
+
function getModifier(name) {
|
|
828
|
+
return BUILTIN_MODIFIERS[name] ?? _pluginModifiers[name];
|
|
1445
829
|
}
|
|
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;
|
|
830
|
+
function isKnownModifier(name) {
|
|
831
|
+
return name in BUILTIN_MODIFIERS || name in _pluginModifiers;
|
|
1475
832
|
}
|
|
1476
|
-
function
|
|
1477
|
-
return
|
|
833
|
+
function _allEntries() {
|
|
834
|
+
return [...Object.entries(BUILTIN_MODIFIERS), ...Object.entries(_pluginModifiers)];
|
|
1478
835
|
}
|
|
1479
|
-
function
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
const parsed = parseClass(token);
|
|
1483
|
-
if (parsed) results.push(parsed);
|
|
836
|
+
function getResponsiveModifiers() {
|
|
837
|
+
if (!_responsiveNames) {
|
|
838
|
+
_responsiveNames = new Set(_allEntries().filter(([, d]) => d.jsBehavior === "responsive").map(([k]) => k));
|
|
1484
839
|
}
|
|
1485
|
-
return
|
|
840
|
+
return _responsiveNames;
|
|
1486
841
|
}
|
|
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;
|
|
842
|
+
function matchModifier(name, isDark, state, breakpoints) {
|
|
843
|
+
return getModifier(name)?.jsMatch?.(isDark, state, breakpoints) ?? false;
|
|
1496
844
|
}
|
|
1497
845
|
|
|
1498
846
|
// src/core/utilities.ts
|
|
@@ -1586,6 +934,7 @@ function resolveSizing(value, spacing, isArbitrary) {
|
|
|
1586
934
|
if (raw !== void 0) return raw;
|
|
1587
935
|
if (/^\d+\/\d+$/.test(value)) {
|
|
1588
936
|
const [num, den] = value.split("/").map(Number);
|
|
937
|
+
if (!den) return null;
|
|
1589
938
|
return `${(num / den * 100).toFixed(6)}%`;
|
|
1590
939
|
}
|
|
1591
940
|
return null;
|
|
@@ -3100,10 +2449,10 @@ function resolveUtility(parsed, theme) {
|
|
|
3100
2449
|
if (!parsed.value) {
|
|
3101
2450
|
if (parsed.utility in PLUGIN_STANDALONE) return PLUGIN_STANDALONE[parsed.utility] ?? null;
|
|
3102
2451
|
if (parsed.utility === "grd" || parsed.utility === "grid") {
|
|
3103
|
-
return { display: "grid" };
|
|
2452
|
+
return getEffectiveIsWeb() ? { display: "grid" } : null;
|
|
3104
2453
|
}
|
|
3105
2454
|
if (parsed.utility === "inline-grid") {
|
|
3106
|
-
return { display: "inline-grid" };
|
|
2455
|
+
return getEffectiveIsWeb() ? { display: "inline-grid" } : null;
|
|
3107
2456
|
}
|
|
3108
2457
|
if (parsed.utility in getStandalone()) return getStandalone()[parsed.utility] ?? null;
|
|
3109
2458
|
}
|
|
@@ -3116,6 +2465,8 @@ var PLUGIN_RESOLVERS = {};
|
|
|
3116
2465
|
function clearPluginUtilities() {
|
|
3117
2466
|
for (const key of Object.keys(PLUGIN_STANDALONE)) delete PLUGIN_STANDALONE[key];
|
|
3118
2467
|
for (const key of Object.keys(PLUGIN_RESOLVERS)) delete PLUGIN_RESOLVERS[key];
|
|
2468
|
+
_sortedPrefixes = null;
|
|
2469
|
+
_standaloneNames = null;
|
|
3119
2470
|
}
|
|
3120
2471
|
function getPluginStandaloneMap() {
|
|
3121
2472
|
return PLUGIN_STANDALONE;
|
|
@@ -3123,6 +2474,129 @@ function getPluginStandaloneMap() {
|
|
|
3123
2474
|
function isKnownUtility(utility) {
|
|
3124
2475
|
return utility in getStandalone() || utility in RESOLVERS || utility in PLUGIN_STANDALONE || utility in PLUGIN_RESOLVERS;
|
|
3125
2476
|
}
|
|
2477
|
+
var _sortedPrefixes = null;
|
|
2478
|
+
var _standaloneNames = null;
|
|
2479
|
+
function getBuiltinUtilityPrefixes() {
|
|
2480
|
+
if (!_sortedPrefixes) {
|
|
2481
|
+
const all = [.../* @__PURE__ */ new Set([...Object.keys(RESOLVERS), ...Object.keys(PLUGIN_RESOLVERS)])];
|
|
2482
|
+
_sortedPrefixes = all.sort((a, b) => b.length - a.length);
|
|
2483
|
+
}
|
|
2484
|
+
return _sortedPrefixes;
|
|
2485
|
+
}
|
|
2486
|
+
function getBuiltinStandaloneNames() {
|
|
2487
|
+
if (!_standaloneNames) {
|
|
2488
|
+
_standaloneNames = /* @__PURE__ */ new Set([...Object.keys(getStandalone()), ...Object.keys(PLUGIN_STANDALONE)]);
|
|
2489
|
+
}
|
|
2490
|
+
return _standaloneNames;
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
// src/core/parser.ts
|
|
2494
|
+
function parseClass(className) {
|
|
2495
|
+
const trimmed = className.trim();
|
|
2496
|
+
if (!trimmed) return null;
|
|
2497
|
+
const modifiers = [];
|
|
2498
|
+
let remaining = trimmed;
|
|
2499
|
+
while (true) {
|
|
2500
|
+
const colonIdx = findOuterColon(remaining);
|
|
2501
|
+
if (colonIdx === -1) break;
|
|
2502
|
+
const candidate = remaining.slice(0, colonIdx);
|
|
2503
|
+
if (!isKnownModifier(candidate)) break;
|
|
2504
|
+
modifiers.push(candidate);
|
|
2505
|
+
remaining = remaining.slice(colonIdx + 1);
|
|
2506
|
+
}
|
|
2507
|
+
let important = false;
|
|
2508
|
+
if (remaining.startsWith("!") && remaining.length > 1) {
|
|
2509
|
+
important = true;
|
|
2510
|
+
remaining = remaining.slice(1);
|
|
2511
|
+
}
|
|
2512
|
+
let negative = false;
|
|
2513
|
+
if (remaining.startsWith("-") && remaining.length > 1 && remaining[1] !== "-") {
|
|
2514
|
+
negative = true;
|
|
2515
|
+
remaining = remaining.slice(1);
|
|
2516
|
+
}
|
|
2517
|
+
const bracketStart = remaining.lastIndexOf("-[");
|
|
2518
|
+
if (bracketStart > 0 && remaining.endsWith("]")) {
|
|
2519
|
+
const utility = remaining.slice(0, bracketStart);
|
|
2520
|
+
const value = remaining.slice(bracketStart + 2, -1).replace(/_/g, " ");
|
|
2521
|
+
return { original: trimmed, modifiers, negative, important, utility, value, isArbitrary: true };
|
|
2522
|
+
}
|
|
2523
|
+
if (getBuiltinStandaloneNames().has(remaining)) {
|
|
2524
|
+
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
2525
|
+
}
|
|
2526
|
+
for (const prefix of getBuiltinUtilityPrefixes()) {
|
|
2527
|
+
if (remaining === prefix) {
|
|
2528
|
+
return { original: trimmed, modifiers, negative, important, utility: prefix, value: "", isArbitrary: false };
|
|
2529
|
+
}
|
|
2530
|
+
if (remaining.startsWith(prefix + "-")) {
|
|
2531
|
+
const value = remaining.slice(prefix.length + 1);
|
|
2532
|
+
return { original: trimmed, modifiers, negative, important, utility: prefix, value, isArbitrary: false };
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
const firstDash = remaining.indexOf("-");
|
|
2536
|
+
if (firstDash > 0) {
|
|
2537
|
+
return {
|
|
2538
|
+
original: trimmed,
|
|
2539
|
+
modifiers,
|
|
2540
|
+
negative,
|
|
2541
|
+
important,
|
|
2542
|
+
utility: remaining.slice(0, firstDash),
|
|
2543
|
+
value: remaining.slice(firstDash + 1),
|
|
2544
|
+
isArbitrary: false
|
|
2545
|
+
};
|
|
2546
|
+
}
|
|
2547
|
+
return { original: trimmed, modifiers, negative, important, utility: remaining, value: "", isArbitrary: false };
|
|
2548
|
+
}
|
|
2549
|
+
function splitClassTokens(classString) {
|
|
2550
|
+
const tokens = [];
|
|
2551
|
+
let current = "";
|
|
2552
|
+
let depth = 0;
|
|
2553
|
+
for (let i = 0; i < classString.length; i++) {
|
|
2554
|
+
const ch = classString[i];
|
|
2555
|
+
if (ch === "[") {
|
|
2556
|
+
depth++;
|
|
2557
|
+
current += ch;
|
|
2558
|
+
continue;
|
|
2559
|
+
}
|
|
2560
|
+
if (ch === "]") {
|
|
2561
|
+
depth--;
|
|
2562
|
+
current += ch;
|
|
2563
|
+
continue;
|
|
2564
|
+
}
|
|
2565
|
+
if (/\s/.test(ch)) {
|
|
2566
|
+
if (depth === 0) {
|
|
2567
|
+
if (current) {
|
|
2568
|
+
tokens.push(current);
|
|
2569
|
+
current = "";
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
} else {
|
|
2573
|
+
current += ch;
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
if (current) tokens.push(current);
|
|
2577
|
+
return tokens;
|
|
2578
|
+
}
|
|
2579
|
+
function normalizeClassString(classString) {
|
|
2580
|
+
return splitClassTokens(classString).join(" ");
|
|
2581
|
+
}
|
|
2582
|
+
function parseClasses(classString) {
|
|
2583
|
+
const results = [];
|
|
2584
|
+
for (const token of splitClassTokens(classString)) {
|
|
2585
|
+
const parsed = parseClass(token);
|
|
2586
|
+
if (parsed) results.push(parsed);
|
|
2587
|
+
}
|
|
2588
|
+
return results;
|
|
2589
|
+
}
|
|
2590
|
+
function findOuterColon(s) {
|
|
2591
|
+
let depth = 0;
|
|
2592
|
+
for (let i = 0; i < s.length; i++) {
|
|
2593
|
+
const ch = s[i];
|
|
2594
|
+
if (ch === "[") depth++;
|
|
2595
|
+
else if (ch === "]") depth--;
|
|
2596
|
+
else if (ch === ":" && depth === 0) return i;
|
|
2597
|
+
}
|
|
2598
|
+
return -1;
|
|
2599
|
+
}
|
|
3126
2600
|
|
|
3127
2601
|
// src/core/responsiveStore.ts
|
|
3128
2602
|
var RESPONSIVE_KEY = "__kbach_responsive__";
|
|
@@ -3167,7 +2641,30 @@ function getActiveBreakpoints(width) {
|
|
|
3167
2641
|
}
|
|
3168
2642
|
|
|
3169
2643
|
// src/core/resolver.ts
|
|
3170
|
-
var
|
|
2644
|
+
var _themeCache = /* @__PURE__ */ new WeakMap();
|
|
2645
|
+
function getThemeCache(theme) {
|
|
2646
|
+
let cache = _themeCache.get(theme);
|
|
2647
|
+
if (!cache) {
|
|
2648
|
+
cache = new LRUCache(1e4);
|
|
2649
|
+
_themeCache.set(theme, cache);
|
|
2650
|
+
}
|
|
2651
|
+
return cache;
|
|
2652
|
+
}
|
|
2653
|
+
var _sortCache = /* @__PURE__ */ new WeakMap();
|
|
2654
|
+
function getSortedEntries(resolved) {
|
|
2655
|
+
let sorted = _sortCache.get(resolved);
|
|
2656
|
+
if (!sorted) {
|
|
2657
|
+
const entries = Object.entries(resolved);
|
|
2658
|
+
entries.sort((a, b) => {
|
|
2659
|
+
const pa = a[0] === "base" ? -1 : a[0].split(":").length;
|
|
2660
|
+
const pb = b[0] === "base" ? -1 : b[0].split(":").length;
|
|
2661
|
+
return pa - pb;
|
|
2662
|
+
});
|
|
2663
|
+
sorted = entries;
|
|
2664
|
+
_sortCache.set(resolved, sorted);
|
|
2665
|
+
}
|
|
2666
|
+
return sorted;
|
|
2667
|
+
}
|
|
3171
2668
|
var FONT_KEY = "__kbach_default_font__";
|
|
3172
2669
|
function setDefaultFontFamily(font) {
|
|
3173
2670
|
globalThis[FONT_KEY] = font;
|
|
@@ -3176,7 +2673,7 @@ function getDefaultFontFamily() {
|
|
|
3176
2673
|
return globalThis[FONT_KEY];
|
|
3177
2674
|
}
|
|
3178
2675
|
var _styleEl = null;
|
|
3179
|
-
var _injectedRules =
|
|
2676
|
+
var _injectedRules = new LRUCache(5e4);
|
|
3180
2677
|
function getStyleEl() {
|
|
3181
2678
|
if (_styleEl) return _styleEl;
|
|
3182
2679
|
_styleEl = document.createElement("style");
|
|
@@ -3186,7 +2683,7 @@ function getStyleEl() {
|
|
|
3186
2683
|
}
|
|
3187
2684
|
function injectRule(rule) {
|
|
3188
2685
|
if (_injectedRules.has(rule)) return;
|
|
3189
|
-
_injectedRules.
|
|
2686
|
+
_injectedRules.set(rule, true);
|
|
3190
2687
|
try {
|
|
3191
2688
|
getStyleEl().sheet?.insertRule(rule, getStyleEl().sheet.cssRules.length);
|
|
3192
2689
|
} catch {
|
|
@@ -3210,150 +2707,20 @@ function injectGlobalStyles(theme) {
|
|
|
3210
2707
|
}
|
|
3211
2708
|
getGlobalStyleEl().textContent = rules.join("\n");
|
|
3212
2709
|
}
|
|
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
2710
|
function buildDivideDecls(styles) {
|
|
3266
2711
|
const parts = [];
|
|
3267
2712
|
if ("__divideX" in styles) {
|
|
3268
2713
|
const w = Number(styles.__divideX);
|
|
3269
|
-
parts.push(`border-left-width: ${w}px
|
|
3270
|
-
parts.push("border-right-width: 0px");
|
|
2714
|
+
parts.push(`border-left-width: ${w}px`, "border-right-width: 0px");
|
|
3271
2715
|
}
|
|
3272
2716
|
if ("__divideY" in styles) {
|
|
3273
2717
|
const w = Number(styles.__divideY);
|
|
3274
|
-
parts.push(`border-top-width: ${w}px
|
|
3275
|
-
parts.push("border-bottom-width: 0px");
|
|
2718
|
+
parts.push(`border-top-width: ${w}px`, "border-bottom-width: 0px");
|
|
3276
2719
|
}
|
|
3277
2720
|
if ("__divideColor" in styles) parts.push(`border-color: ${String(styles.__divideColor)}`);
|
|
3278
2721
|
if ("__divideStyle" in styles) parts.push(`border-style: ${String(styles.__divideStyle)}`);
|
|
3279
2722
|
return parts.join("; ");
|
|
3280
2723
|
}
|
|
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
2724
|
var RN_ONLY_PROPS = /* @__PURE__ */ new Set([
|
|
3358
2725
|
"shadowColor",
|
|
3359
2726
|
"shadowOffset",
|
|
@@ -3363,13 +2730,10 @@ var RN_ONLY_PROPS = /* @__PURE__ */ new Set([
|
|
|
3363
2730
|
"includeFontPadding",
|
|
3364
2731
|
"textAlignVertical",
|
|
3365
2732
|
"writingDirection",
|
|
3366
|
-
// Text shadow native props — web uses the textShadow CSS shorthand instead
|
|
3367
2733
|
"textShadowColor",
|
|
3368
2734
|
"textShadowOffset",
|
|
3369
2735
|
"textShadowRadius",
|
|
3370
|
-
// tintColor is native-only (Image/icon tinting)
|
|
3371
2736
|
"tintColor",
|
|
3372
|
-
// Internal markers — handled specially, never serialized as CSS props
|
|
3373
2737
|
"__divideX",
|
|
3374
2738
|
"__divideY",
|
|
3375
2739
|
"__divideColor",
|
|
@@ -3411,8 +2775,7 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3411
2775
|
const imp = forceImportant || prop === "display" && (cssVal === "grid" || cssVal === "inline-grid") || prop === "position" && (cssVal === "sticky" || cssVal === "fixed" || cssVal === "static") ? " !important" : "";
|
|
3412
2776
|
if (prop in RN_SHORTHAND_EXPAND) {
|
|
3413
2777
|
const [p1, p2] = RN_SHORTHAND_EXPAND[prop];
|
|
3414
|
-
parts.push(`${p1}: ${cssVal}${imp}`);
|
|
3415
|
-
parts.push(`${p2}: ${cssVal}${imp}`);
|
|
2778
|
+
parts.push(`${p1}: ${cssVal}${imp}`, `${p2}: ${cssVal}${imp}`);
|
|
3416
2779
|
continue;
|
|
3417
2780
|
}
|
|
3418
2781
|
parts.push(`${camelToKebab(prop)}: ${cssVal}${imp}`);
|
|
@@ -3422,14 +2785,87 @@ function styleValueToCSS(styles, forceImportant = false) {
|
|
|
3422
2785
|
function camelToKebab(str) {
|
|
3423
2786
|
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
3424
2787
|
}
|
|
2788
|
+
function buildClassCSSRules(cls, bucketKey, styles, darkMode, important, screens) {
|
|
2789
|
+
const rules = [];
|
|
2790
|
+
if ("__keyframe" in styles && typeof styles.__keyframe === "string") {
|
|
2791
|
+
rules.push(styles.__keyframe);
|
|
2792
|
+
}
|
|
2793
|
+
const isDivide = "__divideX" in styles || "__divideY" in styles || "__divideColor" in styles || "__divideStyle" in styles;
|
|
2794
|
+
const escaped = escapeCSSSelector(cls);
|
|
2795
|
+
const childSuffix = isDivide ? " > * + *" : "";
|
|
2796
|
+
if (bucketKey === "base") {
|
|
2797
|
+
const decls2 = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, important);
|
|
2798
|
+
if (!decls2) return rules;
|
|
2799
|
+
rules.push(`.${escaped}${childSuffix} { ${decls2} }`);
|
|
2800
|
+
return rules;
|
|
2801
|
+
}
|
|
2802
|
+
const mods = bucketKey.split(":");
|
|
2803
|
+
let darkScheme;
|
|
2804
|
+
let needsImportant = important;
|
|
2805
|
+
const pseudoParts = [];
|
|
2806
|
+
const ancestorParts = [];
|
|
2807
|
+
const dirParts = [];
|
|
2808
|
+
const mediaWrappers = [];
|
|
2809
|
+
let minWidth = 0;
|
|
2810
|
+
for (const mod of mods) {
|
|
2811
|
+
const def = getModifier(mod);
|
|
2812
|
+
if (!def) continue;
|
|
2813
|
+
if (def.darkScheme) darkScheme = def.darkScheme;
|
|
2814
|
+
if (def.pseudo) pseudoParts.push(def.pseudo);
|
|
2815
|
+
if (def.ancestorSelector) {
|
|
2816
|
+
ancestorParts.push(def.ancestorSelector);
|
|
2817
|
+
needsImportant = true;
|
|
2818
|
+
}
|
|
2819
|
+
if (def.dirSelector) {
|
|
2820
|
+
dirParts.push(def.dirSelector);
|
|
2821
|
+
needsImportant = true;
|
|
2822
|
+
}
|
|
2823
|
+
if (def.mediaQuery) {
|
|
2824
|
+
mediaWrappers.push(`@media ${def.mediaQuery}`);
|
|
2825
|
+
needsImportant = true;
|
|
2826
|
+
}
|
|
2827
|
+
if (def.isResponsive) {
|
|
2828
|
+
const w = screens[mod] ?? 0;
|
|
2829
|
+
if (w > minWidth) minWidth = w;
|
|
2830
|
+
}
|
|
2831
|
+
if (def.forcesImportant) needsImportant = true;
|
|
2832
|
+
}
|
|
2833
|
+
const pseudoSuffix = pseudoParts.join("");
|
|
2834
|
+
const elementSelector = `.${escaped}${pseudoSuffix}${childSuffix}`;
|
|
2835
|
+
const ancestorPrefix = ancestorParts.join("");
|
|
2836
|
+
const dirPrefix = dirParts.join("");
|
|
2837
|
+
const selector = `${dirPrefix}${ancestorPrefix}${elementSelector}`;
|
|
2838
|
+
const decls = isDivide ? buildDivideDecls(styles) : styleValueToCSS(styles, needsImportant);
|
|
2839
|
+
if (!decls) return rules;
|
|
2840
|
+
let rule;
|
|
2841
|
+
if (darkScheme === "dark") {
|
|
2842
|
+
if (darkMode === "media") rule = `@media (prefers-color-scheme: dark) { ${selector} { ${decls} } }`;
|
|
2843
|
+
else if (darkMode === "class") rule = `.dark ${selector} { ${decls} }`;
|
|
2844
|
+
else rule = `[data-theme="dark"] ${selector} { ${decls} }`;
|
|
2845
|
+
} else if (darkScheme === "light") {
|
|
2846
|
+
if (darkMode === "media") rule = `@media (prefers-color-scheme: light) { ${selector} { ${decls} } }`;
|
|
2847
|
+
else if (darkMode === "class") rule = `:not(.dark) ${selector} { ${decls} }`;
|
|
2848
|
+
else rule = `[data-theme="light"] ${selector} { ${decls} }`;
|
|
2849
|
+
} else {
|
|
2850
|
+
rule = `${selector} { ${decls} }`;
|
|
2851
|
+
}
|
|
2852
|
+
for (const mw of mediaWrappers) rule = `${mw} { ${rule} }`;
|
|
2853
|
+
if (minWidth > 0) rule = `@media (min-width: ${minWidth}px) { ${rule} }`;
|
|
2854
|
+
rules.push(rule);
|
|
2855
|
+
return rules;
|
|
2856
|
+
}
|
|
2857
|
+
function injectClassRule(cls, bucketKey, styles, darkMode, important) {
|
|
2858
|
+
const cssRules = buildClassCSSRules(cls, bucketKey, styles, darkMode, important, getGlobalScreens());
|
|
2859
|
+
for (const r of cssRules) injectRule(r);
|
|
2860
|
+
}
|
|
3425
2861
|
function resolve(classString, theme, darkMode = "attribute") {
|
|
2862
|
+
const cache = getThemeCache(theme);
|
|
3426
2863
|
const cacheKey = `${classString}::${darkMode}`;
|
|
3427
|
-
const cached =
|
|
2864
|
+
const cached = cache.get(cacheKey);
|
|
3428
2865
|
if (cached) return cached;
|
|
3429
2866
|
const result = {};
|
|
3430
|
-
const
|
|
3431
|
-
const
|
|
3432
|
-
for (const parsed of parsedClasses) {
|
|
2867
|
+
const onWeb = typeof document !== "undefined";
|
|
2868
|
+
for (const parsed of parseClasses(classString)) {
|
|
3433
2869
|
const styles = resolveUtility(parsed, theme);
|
|
3434
2870
|
if (!styles) {
|
|
3435
2871
|
if (process.env.NODE_ENV !== "production" && !parsed.isArbitrary && !isKnownUtility(parsed.utility)) {
|
|
@@ -3440,116 +2876,60 @@ function resolve(classString, theme, darkMode = "attribute") {
|
|
|
3440
2876
|
const bucketKey = parsed.modifiers.length === 0 ? "base" : parsed.modifiers.join(":");
|
|
3441
2877
|
if (!result[bucketKey]) result[bucketKey] = {};
|
|
3442
2878
|
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);
|
|
2879
|
+
if (onWeb) {
|
|
2880
|
+
injectClassRule(parsed.original, bucketKey, styles, darkMode, parsed.important);
|
|
3451
2881
|
}
|
|
3452
2882
|
}
|
|
2883
|
+
cache.set(cacheKey, result);
|
|
3453
2884
|
return result;
|
|
3454
2885
|
}
|
|
3455
2886
|
function flatten(resolved, isDark, state = {}, breakpoints = /* @__PURE__ */ new Set()) {
|
|
3456
2887
|
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) {
|
|
2888
|
+
for (const [key, styles] of getSortedEntries(resolved)) {
|
|
3464
2889
|
if (!styles) continue;
|
|
3465
2890
|
if (key === "base") {
|
|
3466
2891
|
Object.assign(result, styles);
|
|
3467
2892
|
continue;
|
|
3468
2893
|
}
|
|
3469
2894
|
const mods = key.split(":");
|
|
3470
|
-
if (
|
|
2895
|
+
if (mods.every((mod) => matchModifier(mod, isDark, state, breakpoints))) {
|
|
3471
2896
|
Object.assign(result, styles);
|
|
3472
2897
|
}
|
|
3473
2898
|
}
|
|
3474
|
-
const
|
|
3475
|
-
if (
|
|
3476
|
-
result.fontFamily =
|
|
2899
|
+
const defaultFont = getDefaultFontFamily();
|
|
2900
|
+
if (defaultFont && !("fontFamily" in result)) {
|
|
2901
|
+
result.fontFamily = defaultFont;
|
|
3477
2902
|
}
|
|
3478
2903
|
if (isWeb) {
|
|
3479
2904
|
const r = result;
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
2905
|
+
const ph = r.paddingHorizontal;
|
|
2906
|
+
if (ph !== void 0) {
|
|
2907
|
+
r.paddingLeft = ph;
|
|
2908
|
+
r.paddingRight = ph;
|
|
2909
|
+
delete r.paddingHorizontal;
|
|
2910
|
+
}
|
|
2911
|
+
const pv = r.paddingVertical;
|
|
2912
|
+
if (pv !== void 0) {
|
|
2913
|
+
r.paddingTop = pv;
|
|
2914
|
+
r.paddingBottom = pv;
|
|
2915
|
+
delete r.paddingVertical;
|
|
2916
|
+
}
|
|
2917
|
+
const mh = r.marginHorizontal;
|
|
2918
|
+
if (mh !== void 0) {
|
|
2919
|
+
r.marginLeft = mh;
|
|
2920
|
+
r.marginRight = mh;
|
|
2921
|
+
delete r.marginHorizontal;
|
|
2922
|
+
}
|
|
2923
|
+
const mv = r.marginVertical;
|
|
2924
|
+
if (mv !== void 0) {
|
|
2925
|
+
r.marginTop = mv;
|
|
2926
|
+
r.marginBottom = mv;
|
|
2927
|
+
delete r.marginVertical;
|
|
3487
2928
|
}
|
|
3488
2929
|
}
|
|
3489
2930
|
return result;
|
|
3490
2931
|
}
|
|
3491
|
-
function matchesMods(mods, isDark, state, breakpoints) {
|
|
3492
|
-
return mods.every((mod) => {
|
|
3493
|
-
switch (mod) {
|
|
3494
|
-
case "dark":
|
|
3495
|
-
return isDark;
|
|
3496
|
-
case "light":
|
|
3497
|
-
case "not-dark":
|
|
3498
|
-
return !isDark;
|
|
3499
|
-
case "not-light":
|
|
3500
|
-
return isDark;
|
|
3501
|
-
case "hover":
|
|
3502
|
-
return !!state.hover;
|
|
3503
|
-
case "not-hover":
|
|
3504
|
-
return !state.hover;
|
|
3505
|
-
case "focus":
|
|
3506
|
-
return !!state.focus;
|
|
3507
|
-
case "not-focus":
|
|
3508
|
-
return !state.focus;
|
|
3509
|
-
case "pressed":
|
|
3510
|
-
case "active":
|
|
3511
|
-
return !!state.pressed || !!state.active;
|
|
3512
|
-
case "not-pressed":
|
|
3513
|
-
case "not-active":
|
|
3514
|
-
return !state.pressed && !state.active;
|
|
3515
|
-
case "disabled":
|
|
3516
|
-
return !!state.disabled;
|
|
3517
|
-
case "not-disabled":
|
|
3518
|
-
return !state.disabled;
|
|
3519
|
-
case "checked":
|
|
3520
|
-
return !!state.checked;
|
|
3521
|
-
case "not-checked":
|
|
3522
|
-
return !state.checked;
|
|
3523
|
-
case "visited":
|
|
3524
|
-
return !!state.visited;
|
|
3525
|
-
case "not-visited":
|
|
3526
|
-
return !state.visited;
|
|
3527
|
-
case "placeholder":
|
|
3528
|
-
return !!state.placeholder;
|
|
3529
|
-
case "sm":
|
|
3530
|
-
case "md":
|
|
3531
|
-
case "lg":
|
|
3532
|
-
case "xl":
|
|
3533
|
-
case "2xl":
|
|
3534
|
-
return breakpoints.has(mod);
|
|
3535
|
-
// CSS-only modifiers — never applied as inline styles
|
|
3536
|
-
case "print":
|
|
3537
|
-
case "landscape":
|
|
3538
|
-
case "portrait":
|
|
3539
|
-
case "motion-reduce":
|
|
3540
|
-
case "motion-safe":
|
|
3541
|
-
case "contrast-more":
|
|
3542
|
-
case "contrast-less":
|
|
3543
|
-
case "rtl":
|
|
3544
|
-
case "ltr":
|
|
3545
|
-
return false;
|
|
3546
|
-
default:
|
|
3547
|
-
return false;
|
|
3548
|
-
}
|
|
3549
|
-
});
|
|
3550
|
-
}
|
|
3551
2932
|
function clearCache() {
|
|
3552
|
-
styleCache.clear();
|
|
3553
2933
|
_injectedRules.clear();
|
|
3554
2934
|
if (_styleEl) {
|
|
3555
2935
|
_styleEl.remove();
|
|
@@ -3596,14 +2976,24 @@ function resolveOneRef(ref, colors) {
|
|
|
3596
2976
|
return entry[m[2]] ?? null;
|
|
3597
2977
|
}
|
|
3598
2978
|
function resolveColorRefs(colors) {
|
|
2979
|
+
const MAX_DEPTH = 5;
|
|
2980
|
+
function resolveChain(raw) {
|
|
2981
|
+
let current = raw;
|
|
2982
|
+
for (let i = 0; i < MAX_DEPTH; i++) {
|
|
2983
|
+
const next = resolveOneRef(current, colors);
|
|
2984
|
+
if (!next || next === current) break;
|
|
2985
|
+
current = next;
|
|
2986
|
+
}
|
|
2987
|
+
return current;
|
|
2988
|
+
}
|
|
3599
2989
|
const out = {};
|
|
3600
2990
|
for (const [key, val] of Object.entries(colors)) {
|
|
3601
2991
|
if (typeof val === "string") {
|
|
3602
|
-
out[key] =
|
|
2992
|
+
out[key] = resolveChain(val);
|
|
3603
2993
|
} else {
|
|
3604
2994
|
const shades = {};
|
|
3605
2995
|
for (const [shade, hex] of Object.entries(val)) {
|
|
3606
|
-
shades[shade] =
|
|
2996
|
+
shades[shade] = resolveChain(hex);
|
|
3607
2997
|
}
|
|
3608
2998
|
out[key] = shades;
|
|
3609
2999
|
}
|
|
@@ -3651,15 +3041,26 @@ function buildConfig(userConfig) {
|
|
|
3651
3041
|
injectGlobalStyles(resolved.theme);
|
|
3652
3042
|
return resolved;
|
|
3653
3043
|
}
|
|
3044
|
+
function _selectorToModifierDef(selector) {
|
|
3045
|
+
const s = selector.trim();
|
|
3046
|
+
if (s.startsWith("@media ")) {
|
|
3047
|
+
return { mediaQuery: s.slice(7), jsBehavior: "css-only", forcesImportant: true };
|
|
3048
|
+
}
|
|
3049
|
+
if (s.startsWith("::") || s.startsWith(":")) {
|
|
3050
|
+
return { pseudo: s, jsBehavior: "css-only", forcesImportant: true };
|
|
3051
|
+
}
|
|
3052
|
+
return { ancestorSelector: s.endsWith(" ") ? s : `${s} `, jsBehavior: "css-only", forcesImportant: true };
|
|
3053
|
+
}
|
|
3654
3054
|
function makePluginAPI(theme) {
|
|
3655
3055
|
const standalone = getPluginStandaloneMap();
|
|
3656
3056
|
return {
|
|
3657
3057
|
addUtility(name, styles) {
|
|
3658
3058
|
standalone[name] = styles;
|
|
3659
3059
|
},
|
|
3660
|
-
addVariant(name,
|
|
3661
|
-
|
|
3662
|
-
|
|
3060
|
+
addVariant(name, selectorOrDef) {
|
|
3061
|
+
const def = typeof selectorOrDef === "string" ? _selectorToModifierDef(selectorOrDef) : selectorOrDef;
|
|
3062
|
+
customVariants[name] = typeof selectorOrDef === "string" ? selectorOrDef : name;
|
|
3063
|
+
registerModifier(name, def);
|
|
3663
3064
|
},
|
|
3664
3065
|
theme(path, defaultValue) {
|
|
3665
3066
|
const parts = path.replace(/\[([^\]]+)\]/g, ".$1").split(".");
|
|
@@ -3784,8 +3185,16 @@ function ThemeProvider({
|
|
|
3784
3185
|
() => isWeb && typeof window !== "undefined" ? window.innerWidth : 0
|
|
3785
3186
|
);
|
|
3786
3187
|
const effectiveWidth = windowWidthProp ?? (isWeb ? webWidth : 0);
|
|
3787
|
-
|
|
3788
|
-
|
|
3188
|
+
const numericScreens = {};
|
|
3189
|
+
for (const [k, v] of Object.entries(resolvedConfig.theme.screens ?? {})) {
|
|
3190
|
+
numericScreens[k] = typeof v === "number" ? v : parseInt(String(v), 10);
|
|
3191
|
+
}
|
|
3192
|
+
const _prevWidthRef = (0, import_react3.useRef)(-1);
|
|
3193
|
+
if (_prevWidthRef.current !== effectiveWidth) {
|
|
3194
|
+
_prevWidthRef.current = effectiveWidth;
|
|
3195
|
+
syncGlobalWidth(effectiveWidth);
|
|
3196
|
+
}
|
|
3197
|
+
syncGlobalScreens(numericScreens);
|
|
3789
3198
|
(0, import_react3.useEffect)(() => {
|
|
3790
3199
|
setGlobalWidth(effectiveWidth);
|
|
3791
3200
|
}, [effectiveWidth]);
|
|
@@ -4059,17 +3468,19 @@ function useConditionalWidth(active) {
|
|
|
4059
3468
|
);
|
|
4060
3469
|
}
|
|
4061
3470
|
|
|
4062
|
-
// src/
|
|
4063
|
-
var RESPONSIVE_MODS2 = /* @__PURE__ */ new Set(["sm", "md", "lg", "xl", "2xl"]);
|
|
3471
|
+
// src/shared-utils.ts
|
|
4064
3472
|
function hasResponsiveBuckets(resolved) {
|
|
3473
|
+
const responsiveMods = getResponsiveModifiers();
|
|
4065
3474
|
for (const key of Object.keys(resolved)) {
|
|
4066
3475
|
if (key === "base") continue;
|
|
4067
3476
|
for (const mod of key.split(":")) {
|
|
4068
|
-
if (
|
|
3477
|
+
if (responsiveMods.has(mod)) return true;
|
|
4069
3478
|
}
|
|
4070
3479
|
}
|
|
4071
3480
|
return false;
|
|
4072
3481
|
}
|
|
3482
|
+
|
|
3483
|
+
// src/styled.tsx
|
|
4073
3484
|
function styled(Component, baseClasses = "") {
|
|
4074
3485
|
const Styled = (0, import_react6.forwardRef)(
|
|
4075
3486
|
(props, ref) => {
|
|
@@ -4164,10 +3575,10 @@ var import_react7 = require("react");
|
|
|
4164
3575
|
function useStyles(classString, state = {}) {
|
|
4165
3576
|
const { isDark, config } = useTheme();
|
|
4166
3577
|
const width = useGlobalWidth();
|
|
4167
|
-
const breakpoints = getActiveBreakpoints(width);
|
|
4168
3578
|
const normalised = Array.isArray(classString) ? classString.join(" ") : classString;
|
|
4169
3579
|
return (0, import_react7.useMemo)(() => {
|
|
4170
3580
|
const resolved = resolve(normalised, config.theme, config.darkMode);
|
|
3581
|
+
const breakpoints = getActiveBreakpoints(width);
|
|
4171
3582
|
return flatten(resolved, isDark, state, breakpoints);
|
|
4172
3583
|
}, [normalised, isDark, config, width, state.hover, state.focus, state.pressed, state.active, state.disabled, state.checked, state.visited, state.placeholder]);
|
|
4173
3584
|
}
|
|
@@ -4197,11 +3608,15 @@ function useGlobalDarkMode() {
|
|
|
4197
3608
|
}
|
|
4198
3609
|
|
|
4199
3610
|
// src/useBreakpoint.ts
|
|
3611
|
+
var import_react9 = require("react");
|
|
4200
3612
|
function useBreakpoint() {
|
|
4201
3613
|
const { config } = useTheme();
|
|
4202
3614
|
const width = useGlobalWidth();
|
|
4203
3615
|
const screens = config.theme.screens;
|
|
4204
|
-
const sorted =
|
|
3616
|
+
const sorted = (0, import_react9.useMemo)(
|
|
3617
|
+
() => Object.entries(screens).filter(([, v]) => typeof v === "number").sort(([, a], [, b]) => b - a),
|
|
3618
|
+
[screens]
|
|
3619
|
+
);
|
|
4205
3620
|
for (const [name, minW] of sorted) {
|
|
4206
3621
|
if (width >= minW) return name;
|
|
4207
3622
|
}
|
|
@@ -4211,32 +3626,24 @@ function useResponsive() {
|
|
|
4211
3626
|
const { config } = useTheme();
|
|
4212
3627
|
const width = useGlobalWidth();
|
|
4213
3628
|
const screens = config.theme.screens;
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
3629
|
+
return (0, import_react9.useMemo)(() => {
|
|
3630
|
+
const result = {};
|
|
3631
|
+
for (const [name, minW] of Object.entries(screens)) {
|
|
3632
|
+
if (typeof minW === "number") result[name] = width >= minW;
|
|
3633
|
+
}
|
|
3634
|
+
return result;
|
|
3635
|
+
}, [screens, width]);
|
|
4219
3636
|
}
|
|
4220
3637
|
|
|
4221
3638
|
// src/InteractiveWrapper.tsx
|
|
4222
|
-
var
|
|
3639
|
+
var import_react10 = __toESM(require("react"));
|
|
4223
3640
|
function chain(original, extra) {
|
|
4224
3641
|
return (...args) => {
|
|
4225
3642
|
original?.(...args);
|
|
4226
3643
|
extra();
|
|
4227
3644
|
};
|
|
4228
3645
|
}
|
|
4229
|
-
var
|
|
4230
|
-
function hasResponsiveBuckets2(resolved) {
|
|
4231
|
-
for (const key of Object.keys(resolved)) {
|
|
4232
|
-
if (key === "base") continue;
|
|
4233
|
-
for (const mod of key.split(":")) {
|
|
4234
|
-
if (RESPONSIVE_MODS3.has(mod)) return true;
|
|
4235
|
-
}
|
|
4236
|
-
}
|
|
4237
|
-
return false;
|
|
4238
|
-
}
|
|
4239
|
-
var InteractiveWrapper = (0, import_react9.forwardRef)(
|
|
3646
|
+
var InteractiveWrapper = (0, import_react10.forwardRef)(
|
|
4240
3647
|
function InteractiveWrapper2({
|
|
4241
3648
|
Component,
|
|
4242
3649
|
resolvedStyle,
|
|
@@ -4254,22 +3661,22 @@ var InteractiveWrapper = (0, import_react9.forwardRef)(
|
|
|
4254
3661
|
...rest
|
|
4255
3662
|
}, ref) {
|
|
4256
3663
|
const isDark = useGlobalDarkMode();
|
|
4257
|
-
const needsWidth =
|
|
3664
|
+
const needsWidth = hasResponsiveBuckets(resolvedStyle);
|
|
4258
3665
|
const width = useConditionalWidth(needsWidth);
|
|
4259
3666
|
const breakpoints = needsWidth ? getActiveBreakpoints(width) : EMPTY_BREAKPOINTS;
|
|
4260
|
-
const [pressed, setPressed] = (0,
|
|
4261
|
-
const [hovered, setHovered] = (0,
|
|
4262
|
-
const [focused, setFocused] = (0,
|
|
4263
|
-
const handlePressIn = (0,
|
|
4264
|
-
const handlePressOut = (0,
|
|
4265
|
-
const handlePointerDown = (0,
|
|
4266
|
-
const handlePointerUp = (0,
|
|
4267
|
-
const handlePointerLeave = (0,
|
|
4268
|
-
const handleMouseEnter = (0,
|
|
4269
|
-
const handleMouseLeave = (0,
|
|
4270
|
-
const handleFocus = (0,
|
|
4271
|
-
const handleBlur = (0,
|
|
4272
|
-
const computedStyle = (0,
|
|
3667
|
+
const [pressed, setPressed] = (0, import_react10.useState)(false);
|
|
3668
|
+
const [hovered, setHovered] = (0, import_react10.useState)(false);
|
|
3669
|
+
const [focused, setFocused] = (0, import_react10.useState)(false);
|
|
3670
|
+
const handlePressIn = (0, import_react10.useCallback)(chain(onPressIn, () => setPressed(true)), [onPressIn]);
|
|
3671
|
+
const handlePressOut = (0, import_react10.useCallback)(chain(onPressOut, () => setPressed(false)), [onPressOut]);
|
|
3672
|
+
const handlePointerDown = (0, import_react10.useCallback)(chain(onPointerDown, () => setPressed(true)), [onPointerDown]);
|
|
3673
|
+
const handlePointerUp = (0, import_react10.useCallback)(chain(onPointerUp, () => setPressed(false)), [onPointerUp]);
|
|
3674
|
+
const handlePointerLeave = (0, import_react10.useCallback)(chain(onPointerLeave, () => setPressed(false)), [onPointerLeave]);
|
|
3675
|
+
const handleMouseEnter = (0, import_react10.useCallback)(chain(onMouseEnter, () => setHovered(true)), [onMouseEnter]);
|
|
3676
|
+
const handleMouseLeave = (0, import_react10.useCallback)(chain(onMouseLeave, () => setHovered(false)), [onMouseLeave]);
|
|
3677
|
+
const handleFocus = (0, import_react10.useCallback)(chain(onFocus, () => setFocused(true)), [onFocus]);
|
|
3678
|
+
const handleBlur = (0, import_react10.useCallback)(chain(onBlur, () => setFocused(false)), [onBlur]);
|
|
3679
|
+
const computedStyle = (0, import_react10.useMemo)(
|
|
4273
3680
|
() => {
|
|
4274
3681
|
const s = flatten(resolvedStyle, isDark, { pressed, hover: hovered, focus: focused }, breakpoints);
|
|
4275
3682
|
delete s.__divideX;
|
|
@@ -4320,7 +3727,7 @@ var InteractiveWrapper = (0, import_react9.forwardRef)(
|
|
|
4320
3727
|
onFocus: handleFocus,
|
|
4321
3728
|
onBlur: handleBlur
|
|
4322
3729
|
};
|
|
4323
|
-
return Array.isArray(children) ?
|
|
3730
|
+
return Array.isArray(children) ? import_react10.default.createElement(Component, componentProps, ...children) : import_react10.default.createElement(Component, componentProps, children);
|
|
4324
3731
|
}
|
|
4325
3732
|
);
|
|
4326
3733
|
InteractiveWrapper.displayName = "Kbach.InteractiveWrapper";
|