@flipova/foundation 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/components/ui/gluestack-ui-provider/config.ts +69 -2
- package/components/ui/gluestack-ui-provider/index.tsx +57 -7
- package/components/ui/gluestack-ui-provider/index.web.tsx +38 -10
- package/components/ui/gluestack-ui-provider/script.ts +12 -5
- package/components/ui/gluestack-ui-provider/theme-context.ts +51 -0
- package/components/ui/gluestack-ui-provider/useGluestackColors.ts +17 -2
- package/design/canonical.index.txt +15 -1
- package/design/manifest.xml +2 -0
- package/design/schema.xsd +11 -0
- package/design/themes.xml +175 -2
- package/design/tools/npm.js +3 -3
- package/design/tools/sources/.generate/config.py +60 -2
- package/dist/{chunk-HF2IPXOT.mjs → chunk-B277QSR5.mjs} +101 -10
- package/dist/chunk-B277QSR5.mjs.map +1 -0
- package/dist/{chunk-TDW7UKG6.js → chunk-GD37RFBR.js} +105 -9
- package/dist/chunk-GD37RFBR.js.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +309 -289
- package/dist/index.mjs +1 -1
- package/dist/ui/index.d.mts +597 -533
- package/dist/ui/index.d.ts +597 -533
- package/dist/ui/index.js +309 -289
- package/dist/ui/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-HF2IPXOT.mjs.map +0 -1
- package/dist/chunk-TDW7UKG6.js.map +0 -1
|
@@ -3844,12 +3844,86 @@ var colors = {
|
|
|
3844
3844
|
"--error-foreground": "255 255 255",
|
|
3845
3845
|
"--info": "14 165 233",
|
|
3846
3846
|
"--info-foreground": "255 255 255"
|
|
3847
|
+
},
|
|
3848
|
+
"spring-light": {
|
|
3849
|
+
"--background": "240 253 244",
|
|
3850
|
+
"--foreground": "20 83 45",
|
|
3851
|
+
"--card": "255 255 255",
|
|
3852
|
+
"--card-foreground": "20 83 45",
|
|
3853
|
+
"--popover": "255 255 255",
|
|
3854
|
+
"--popover-foreground": "20 83 45",
|
|
3855
|
+
"--primary": "22 163 74",
|
|
3856
|
+
"--primary-foreground": "255 255 255",
|
|
3857
|
+
"--secondary": "34 197 94",
|
|
3858
|
+
"--secondary-foreground": "255 255 255",
|
|
3859
|
+
"--muted": "220 252 231",
|
|
3860
|
+
"--muted-foreground": "21 128 61",
|
|
3861
|
+
"--accent": "187 247 208",
|
|
3862
|
+
"--accent-foreground": "20 83 45",
|
|
3863
|
+
"--destructive": "220 38 38",
|
|
3864
|
+
"--destructive-foreground": "255 255 255",
|
|
3865
|
+
"--border": "187 247 208",
|
|
3866
|
+
"--input": "187 247 208",
|
|
3867
|
+
"--ring": "74 222 128",
|
|
3868
|
+
"--success": "22 163 74",
|
|
3869
|
+
"--success-foreground": "255 255 255",
|
|
3870
|
+
"--warning": "217 119 6",
|
|
3871
|
+
"--warning-foreground": "255 255 255",
|
|
3872
|
+
"--error": "220 38 38",
|
|
3873
|
+
"--error-foreground": "255 255 255",
|
|
3874
|
+
"--info": "2 132 199",
|
|
3875
|
+
"--info-foreground": "255 255 255"
|
|
3876
|
+
},
|
|
3877
|
+
"spring-dark": {
|
|
3878
|
+
"--background": "5 46 22",
|
|
3879
|
+
"--foreground": "240 253 244",
|
|
3880
|
+
"--card": "20 83 45",
|
|
3881
|
+
"--card-foreground": "240 253 244",
|
|
3882
|
+
"--popover": "20 83 45",
|
|
3883
|
+
"--popover-foreground": "240 253 244",
|
|
3884
|
+
"--primary": "74 222 128",
|
|
3885
|
+
"--primary-foreground": "5 46 22",
|
|
3886
|
+
"--secondary": "134 239 172",
|
|
3887
|
+
"--secondary-foreground": "5 46 22",
|
|
3888
|
+
"--muted": "20 83 45",
|
|
3889
|
+
"--muted-foreground": "187 247 208",
|
|
3890
|
+
"--accent": "22 101 52",
|
|
3891
|
+
"--accent-foreground": "240 253 244",
|
|
3892
|
+
"--destructive": "239 68 68",
|
|
3893
|
+
"--destructive-foreground": "255 255 255",
|
|
3894
|
+
"--border": "22 101 52",
|
|
3895
|
+
"--input": "22 101 52",
|
|
3896
|
+
"--ring": "134 239 172",
|
|
3897
|
+
"--success": "74 222 128",
|
|
3898
|
+
"--success-foreground": "5 46 22",
|
|
3899
|
+
"--warning": "251 191 36",
|
|
3900
|
+
"--warning-foreground": "5 46 22",
|
|
3901
|
+
"--error": "248 113 113",
|
|
3902
|
+
"--error-foreground": "5 46 22",
|
|
3903
|
+
"--info": "56 189 248",
|
|
3904
|
+
"--info-foreground": "5 46 22"
|
|
3847
3905
|
}
|
|
3848
3906
|
};
|
|
3849
3907
|
var config = {
|
|
3850
|
-
light: nativewind.vars(colors
|
|
3851
|
-
dark: nativewind.vars(colors
|
|
3908
|
+
light: nativewind.vars(colors["light"]),
|
|
3909
|
+
dark: nativewind.vars(colors["dark"]),
|
|
3910
|
+
"spring-light": nativewind.vars(colors["spring-light"]),
|
|
3911
|
+
"spring-dark": nativewind.vars(colors["spring-dark"])
|
|
3852
3912
|
};
|
|
3913
|
+
var variants = {
|
|
3914
|
+
default: { dark: "dark", light: "light" },
|
|
3915
|
+
spring: { dark: "spring-dark", light: "spring-light" }
|
|
3916
|
+
};
|
|
3917
|
+
var ThemeContext = React48.createContext(null);
|
|
3918
|
+
var useMountedColors = () => React48.useContext(ThemeContext);
|
|
3919
|
+
var MountedThemeContext = React48.createContext(null);
|
|
3920
|
+
var useMountedTheme = () => React48.useContext(MountedThemeContext);
|
|
3921
|
+
function resolveThemeId(variants2, variant, mode) {
|
|
3922
|
+
const mapped = variant ? variants2?.[variant]?.[mode] : void 0;
|
|
3923
|
+
return mapped ?? mode;
|
|
3924
|
+
}
|
|
3925
|
+
|
|
3926
|
+
// components/ui/gluestack-ui-provider/useGluestackColors.ts
|
|
3853
3927
|
function toCamelCase(str) {
|
|
3854
3928
|
return str.replace(/^--/, "").replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
3855
3929
|
}
|
|
@@ -3865,9 +3939,12 @@ function rgbToHex(rgbString) {
|
|
|
3865
3939
|
}
|
|
3866
3940
|
function useGluestackColors() {
|
|
3867
3941
|
const { colorScheme } = nativewind.useColorScheme();
|
|
3868
|
-
const theme =
|
|
3942
|
+
const theme = useMountedColors() ?? colors;
|
|
3943
|
+
const mounted = useMountedTheme();
|
|
3944
|
+
const palettes = theme;
|
|
3945
|
+
const palette = palettes[mounted?.themeId ?? ""] ?? palettes[colorScheme || "light"] ?? palettes[mounted?.themeIds[0] ?? ""] ?? {};
|
|
3869
3946
|
const result = {};
|
|
3870
|
-
Object.entries(
|
|
3947
|
+
Object.entries(palette).forEach(([key, value]) => {
|
|
3871
3948
|
const camelKey = toCamelCase(key);
|
|
3872
3949
|
result[camelKey] = rgbToHex(value);
|
|
3873
3950
|
});
|
|
@@ -3895,28 +3972,42 @@ function useCalendarTheme() {
|
|
|
3895
3972
|
var useGluestackColors2 = useGluestackColors;
|
|
3896
3973
|
var useCalendarTheme2 = useCalendarTheme;
|
|
3897
3974
|
function createGluestackUIProvider(theme) {
|
|
3975
|
+
const vars2 = theme.config ?? theme.colors;
|
|
3976
|
+
const variantMap = theme.variants;
|
|
3977
|
+
const themeIds = Object.keys(vars2);
|
|
3898
3978
|
return function ThemedProvider({
|
|
3899
3979
|
mode = "light",
|
|
3980
|
+
variant,
|
|
3900
3981
|
...props
|
|
3901
3982
|
}) {
|
|
3902
3983
|
const { colorScheme, setColorScheme } = nativewind.useColorScheme();
|
|
3903
3984
|
React48.useEffect(() => {
|
|
3904
3985
|
setColorScheme(mode);
|
|
3905
3986
|
}, [mode]);
|
|
3987
|
+
const resolvedMode = mode === "system" ? colorScheme ?? "light" : mode;
|
|
3988
|
+
const themeId = resolveThemeId(variantMap, variant, resolvedMode);
|
|
3989
|
+
const mountedTheme = React48__default.default.useMemo(
|
|
3990
|
+
() => ({ themeId, themeIds }),
|
|
3991
|
+
[themeId, themeIds]
|
|
3992
|
+
);
|
|
3906
3993
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3907
3994
|
reactNative.View,
|
|
3908
3995
|
{
|
|
3909
3996
|
style: [
|
|
3910
|
-
|
|
3997
|
+
vars2[themeId],
|
|
3911
3998
|
{ flex: 1, height: "100%", width: "100%" },
|
|
3912
3999
|
props.style
|
|
3913
4000
|
],
|
|
3914
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(creator$d.OverlayProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(creator$o.ToastProvider, { children: props.children }) })
|
|
4001
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: theme.colors, children: /* @__PURE__ */ jsxRuntime.jsx(MountedThemeContext.Provider, { value: mountedTheme, children: /* @__PURE__ */ jsxRuntime.jsx(creator$d.OverlayProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(creator$o.ToastProvider, { children: props.children }) }) }) })
|
|
3915
4002
|
}
|
|
3916
4003
|
);
|
|
3917
4004
|
};
|
|
3918
4005
|
}
|
|
3919
|
-
var GluestackUIProvider = createGluestackUIProvider(
|
|
4006
|
+
var GluestackUIProvider = createGluestackUIProvider({
|
|
4007
|
+
colors,
|
|
4008
|
+
config,
|
|
4009
|
+
variants
|
|
4010
|
+
});
|
|
3920
4011
|
var gridBaseStyle = nativewindUtils.isWeb ? "grid grid-cols-12" : "box-border flex-row flex-wrap justify-start";
|
|
3921
4012
|
var gridItemBaseStyle = nativewindUtils.isWeb ? "w-auto col-span-1" : "";
|
|
3922
4013
|
var gridStyle = nativewindUtils.tva({
|
|
@@ -9635,6 +9726,7 @@ exports.ModalContent = ModalContent;
|
|
|
9635
9726
|
exports.ModalFooter = ModalFooter;
|
|
9636
9727
|
exports.ModalHeader = ModalHeader;
|
|
9637
9728
|
exports.MoonIcon = MoonIcon;
|
|
9729
|
+
exports.MountedThemeContext = MountedThemeContext;
|
|
9638
9730
|
exports.PaperclipIcon = PaperclipIcon;
|
|
9639
9731
|
exports.PhoneIcon = PhoneIcon;
|
|
9640
9732
|
exports.PlayIcon = PlayIcon;
|
|
@@ -9706,6 +9798,7 @@ exports.TabsTriggerText = TabsTriggerText;
|
|
|
9706
9798
|
exports.Text = Text21;
|
|
9707
9799
|
exports.Textarea = Textarea;
|
|
9708
9800
|
exports.TextareaInput = TextareaInput;
|
|
9801
|
+
exports.ThemeContext = ThemeContext;
|
|
9709
9802
|
exports.ThreeDotsIcon = ThreeDotsIcon;
|
|
9710
9803
|
exports.Toast = Toast;
|
|
9711
9804
|
exports.ToastDescription = ToastDescription;
|
|
@@ -9727,8 +9820,11 @@ exports.UnlockIcon = UnlockIcon;
|
|
|
9727
9820
|
exports.VStack = VStack;
|
|
9728
9821
|
exports.createGluestackUIProvider = createGluestackUIProvider;
|
|
9729
9822
|
exports.createIconUI = createIconUI;
|
|
9823
|
+
exports.resolveThemeId = resolveThemeId;
|
|
9730
9824
|
exports.useCalendarTheme = useCalendarTheme2;
|
|
9731
9825
|
exports.useGluestackColors = useGluestackColors2;
|
|
9826
|
+
exports.useMountedColors = useMountedColors;
|
|
9827
|
+
exports.useMountedTheme = useMountedTheme;
|
|
9732
9828
|
exports.useToast = useToast;
|
|
9733
|
-
//# sourceMappingURL=chunk-
|
|
9734
|
-
//# sourceMappingURL=chunk-
|
|
9829
|
+
//# sourceMappingURL=chunk-GD37RFBR.js.map
|
|
9830
|
+
//# sourceMappingURL=chunk-GD37RFBR.js.map
|