@tamagui/core 1.0.0-beta.202 → 1.0.0-beta.203
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/dist/cjs/Tamagui.js +18 -1
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/ThemeContext.js +4 -0
- package/dist/cjs/ThemeManager.js +30 -14
- package/dist/cjs/ThemeManager.js.map +2 -2
- package/dist/cjs/conf.js +10 -1
- package/dist/cjs/conf.js.map +2 -2
- package/dist/cjs/constants/constants.js +6 -0
- package/dist/cjs/constants/platform.js +15 -0
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/rnw.js +4 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +4 -0
- package/dist/cjs/createComponent.js +117 -112
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createFont.js +4 -0
- package/dist/cjs/createShorthands.js +4 -0
- package/dist/cjs/createTamagui.js +55 -27
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +4 -0
- package/dist/cjs/createTokens.js +7 -6
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createVariable.js +18 -2
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/defaultComponentState.js +0 -30
- package/dist/cjs/defaultComponentState.js.map +3 -3
- package/dist/cjs/helpers/RNComponents.js +4 -0
- package/dist/cjs/helpers/RNComponents.js.map +0 -0
- package/dist/cjs/helpers/addStylesUsingClassname.js +8 -0
- package/dist/cjs/helpers/addStylesUsingClassname.js.map +2 -2
- package/dist/cjs/helpers/areEqualSets.js +4 -0
- package/dist/cjs/helpers/createMediaStyle.js +5 -0
- package/dist/cjs/helpers/createPropMapper.js +63 -61
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createShallowUpdate.js +4 -0
- package/dist/cjs/helpers/createShallowUpdate.js.map +0 -0
- package/dist/cjs/helpers/createTamaguiProvider.js +4 -0
- package/dist/cjs/helpers/extendStaticConfig.js +9 -6
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/fixNativeShadow.js +4 -0
- package/dist/cjs/helpers/fixNativeShadow.native.js +6 -2
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +2 -2
- package/dist/cjs/helpers/getExpandedShorthands.js +4 -0
- package/dist/cjs/{constants/pseudos.js → helpers/getSize.js} +17 -19
- package/dist/cjs/helpers/getSize.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +114 -59
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +20 -2
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js +4 -0
- package/dist/cjs/helpers/insertStyleRule.js +46 -26
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/isObj.js +4 -0
- package/dist/cjs/helpers/isTamaguiElement.js +4 -0
- package/dist/cjs/helpers/matchMedia.js +4 -0
- package/dist/cjs/helpers/matchMedia.native.js +4 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +40 -0
- package/dist/cjs/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/cjs/helpers/themeable.js +7 -2
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/helpers/validate.js +53 -11
- package/dist/cjs/helpers/validate.js.map +2 -2
- package/dist/cjs/helpers/withStaticProperties.js +4 -0
- package/dist/cjs/helpers/wrapThemeManagerContext.js +4 -0
- package/dist/cjs/hooks/useConstant.js +4 -0
- package/dist/cjs/hooks/useFeatures.js +101 -13
- package/dist/cjs/hooks/useFeatures.js.map +2 -2
- package/dist/cjs/hooks/useIsMounted.js +4 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +4 -0
- package/dist/cjs/hooks/useMedia.js +31 -12
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/usePressable.js +4 -0
- package/dist/cjs/hooks/useTheme.js +36 -23
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useUnmountEffect.js +4 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/static.js +3 -0
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/styled.js +7 -4
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/views/Stack.js +5 -0
- package/dist/cjs/views/Stack.js.map +2 -2
- package/dist/cjs/views/Text.js +5 -0
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/TextAncestorContext.js +6 -0
- package/dist/cjs/views/Theme.js +11 -4
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +5 -0
- package/dist/cjs/views/ThemeProvider.js +6 -1
- package/dist/cjs/views/ThemeProvider.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +4 -0
- package/dist/esm/Tamagui.js +10 -2
- package/dist/esm/Tamagui.js.map +2 -2
- package/dist/esm/ThemeManager.js +21 -11
- package/dist/esm/ThemeManager.js.map +2 -2
- package/dist/esm/conf.js +0 -1
- package/dist/esm/conf.js.map +2 -2
- package/dist/esm/constants/platform.js +2 -0
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/createComponent.js +107 -115
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +51 -27
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTokens.js +2 -6
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createVariable.js +8 -2
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/defaultComponentState.js +0 -11
- package/dist/esm/defaultComponentState.js.map +3 -3
- package/dist/esm/helpers/RNComponents.js +0 -0
- package/dist/esm/helpers/RNComponents.js.map +0 -0
- package/dist/esm/helpers/addStylesUsingClassname.js +4 -1
- package/dist/esm/helpers/addStylesUsingClassname.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +59 -61
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createShallowUpdate.js +0 -0
- package/dist/esm/helpers/createShallowUpdate.js.map +0 -0
- package/dist/esm/helpers/extendStaticConfig.js +9 -6
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/fixNativeShadow.native.js +2 -2
- package/dist/esm/helpers/fixNativeShadow.native.js.map +2 -2
- package/dist/esm/helpers/getSize.js +13 -0
- package/dist/esm/helpers/getSize.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +110 -61
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +15 -2
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +36 -26
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/proxyThemeVariables.js +18 -0
- package/dist/esm/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/esm/helpers/themeable.js +3 -2
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/helpers/validate.js +24 -11
- package/dist/esm/helpers/validate.js.map +2 -2
- package/dist/esm/hooks/useFeatures.js +96 -18
- package/dist/esm/hooks/useFeatures.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +20 -12
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +28 -23
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/static.js +3 -0
- package/dist/esm/static.js.map +2 -2
- package/dist/esm/styled.js +3 -4
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/Stack.js +1 -0
- package/dist/esm/views/Stack.js.map +2 -2
- package/dist/esm/views/Text.js +1 -0
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/esm/views/Theme.js +7 -4
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +2 -1
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/dist/jsx/Tamagui.js +10 -2
- package/dist/jsx/ThemeManager.js +21 -11
- package/dist/jsx/conf.js +0 -1
- package/dist/jsx/constants/platform.js +2 -0
- package/dist/jsx/createComponent.js +105 -114
- package/dist/jsx/createTamagui.js +51 -27
- package/dist/jsx/createTokens.js +2 -6
- package/dist/jsx/createVariable.js +8 -2
- package/dist/jsx/defaultComponentState.js +0 -11
- package/dist/jsx/helpers/RNComponents.js +0 -0
- package/dist/jsx/helpers/addStylesUsingClassname.js +4 -1
- package/dist/jsx/helpers/createPropMapper.js +59 -61
- package/dist/jsx/helpers/createShallowUpdate.js +0 -0
- package/dist/jsx/helpers/extendStaticConfig.js +9 -6
- package/dist/jsx/helpers/fixNativeShadow.native.js +2 -2
- package/dist/jsx/helpers/getSize.js +12 -0
- package/dist/jsx/helpers/getSplitStyles.js +110 -61
- package/dist/jsx/helpers/getStylesAtomic.js +15 -2
- package/dist/jsx/helpers/insertStyleRule.js +36 -26
- package/dist/jsx/helpers/proxyThemeVariables.js +17 -0
- package/dist/jsx/helpers/themeable.js +3 -3
- package/dist/jsx/helpers/validate.js +24 -11
- package/dist/jsx/hooks/useFeatures.js +96 -18
- package/dist/jsx/hooks/useMedia.js +20 -12
- package/dist/jsx/hooks/useTheme.js +28 -23
- package/dist/jsx/index.js +4 -0
- package/dist/jsx/static.js +3 -0
- package/dist/jsx/styled.js +3 -4
- package/dist/jsx/views/Stack.js +1 -0
- package/dist/jsx/views/Text.js +1 -0
- package/dist/jsx/views/Theme.js +7 -4
- package/dist/jsx/views/ThemeProvider.js +2 -2
- package/package.json +6 -6
- package/types/Tamagui.d.ts +18 -1
- package/types/Tamagui.d.ts.map +1 -1
- package/types/ThemeManager.d.ts +3 -3
- package/types/ThemeManager.d.ts.map +1 -1
- package/types/conf.d.ts +2 -0
- package/types/conf.d.ts.map +1 -1
- package/types/constants/platform.d.ts +1 -0
- package/types/constants/platform.d.ts.map +1 -1
- package/types/createComponent.d.ts +3 -4
- package/types/createComponent.d.ts.map +1 -1
- package/types/createFont.d.ts +1 -1
- package/types/createFont.d.ts.map +1 -1
- package/types/createTamagui.d.ts +2 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/createTokens.d.ts +0 -26
- package/types/createTokens.d.ts.map +1 -1
- package/types/createVariable.d.ts +1 -0
- package/types/createVariable.d.ts.map +1 -1
- package/types/helpers/addStylesUsingClassname.d.ts.map +1 -1
- package/types/helpers/createMediaStyle.d.ts.map +1 -1
- package/types/helpers/createPropMapper.d.ts +1 -1
- package/types/helpers/createPropMapper.d.ts.map +1 -1
- package/types/helpers/extendStaticConfig.d.ts +2 -2
- package/types/helpers/extendStaticConfig.d.ts.map +1 -1
- package/types/helpers/getSize.d.ts +3 -0
- package/types/helpers/getSize.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +4 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts +2 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/proxyThemeVariables.d.ts +2 -0
- package/types/helpers/proxyThemeVariables.d.ts.map +1 -0
- package/types/helpers/themeable.d.ts +3 -1
- package/types/helpers/themeable.d.ts.map +1 -1
- package/types/helpers/validate.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts +3 -3
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useTheme.d.ts +1 -1
- package/types/hooks/useTheme.d.ts.map +1 -1
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/static.d.ts +3 -0
- package/types/static.d.ts.map +1 -1
- package/types/styled.d.ts +12 -3
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +73 -45
- package/types/types.d.ts.map +1 -1
- package/types/views/Theme.d.ts +1 -0
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeProvider.d.ts +1 -0
- package/types/views/ThemeProvider.d.ts.map +1 -1
- package/dist/cjs/constants/pseudos.js.map +0 -7
- package/dist/cjs/createShallowUpdate.js +0 -1
- package/dist/cjs/createShallowUpdate.js.map +0 -7
- package/dist/cjs/devtools.js +0 -32
- package/dist/cjs/devtools.js.map +0 -7
- package/dist/cjs/spacedChildren.js +0 -86
- package/dist/cjs/spacedChildren.js.map +0 -7
- package/dist/cjs/tamagui-base.css +0 -8
- package/dist/cjs/tamagui-base.css.map +0 -7
- package/dist/esm/constants/pseudos.js +0 -18
- package/dist/esm/constants/pseudos.js.map +0 -7
- package/dist/esm/createShallowUpdate.js +0 -1
- package/dist/esm/createShallowUpdate.js.map +0 -7
- package/dist/esm/devtools.js +0 -14
- package/dist/esm/devtools.js.map +0 -7
- package/dist/esm/spacedChildren.js +0 -52
- package/dist/esm/spacedChildren.js.map +0 -7
- package/dist/esm/tamagui-base.css +0 -8
- package/dist/esm/tamagui-base.css.map +0 -7
- package/dist/jsx/constants/pseudos.js +0 -17
- package/dist/jsx/createShallowUpdate.js +0 -0
- package/dist/jsx/devtools.js +0 -13
- package/dist/jsx/spacedChildren.js +0 -44
- package/dist/jsx/tamagui-base.css +0 -7
- package/types/spacedChildren.d.ts +0 -9
- package/types/spacedChildren.d.ts.map +0 -1
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { stylePropsView } from "@tamagui/helpers";
|
|
4
4
|
import { useForceUpdate } from "@tamagui/use-force-update";
|
|
5
|
-
import {
|
|
5
|
+
import React, {
|
|
6
6
|
Children,
|
|
7
7
|
Fragment,
|
|
8
8
|
createElement,
|
|
@@ -10,26 +10,34 @@ import {
|
|
|
10
10
|
memo,
|
|
11
11
|
useCallback,
|
|
12
12
|
useContext,
|
|
13
|
-
useEffect,
|
|
14
13
|
useRef,
|
|
15
14
|
useState
|
|
16
15
|
} from "react";
|
|
17
16
|
import { StyleSheet, Text, View } from "react-native";
|
|
18
17
|
import { onConfiguredOnce } from "./conf";
|
|
19
18
|
import { stackDefaultStyles } from "./constants/constants";
|
|
20
|
-
import { isAndroid, isTouchDevice, isWeb } from "./constants/platform";
|
|
19
|
+
import { isAndroid, isTouchDevice, isWeb, useIsomorphicLayoutEffect } from "./constants/platform";
|
|
21
20
|
import { rnw } from "./constants/rnw";
|
|
22
21
|
import { isVariable } from "./createVariable";
|
|
23
|
-
import {
|
|
22
|
+
import { createShallowUpdate } from "./helpers/createShallowUpdate";
|
|
24
23
|
import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
} from "./helpers/
|
|
24
|
+
import { getSplitStyles } from "./helpers/getSplitStyles";
|
|
25
|
+
import { getAllSelectors } from "./helpers/insertStyleRule";
|
|
26
|
+
import { proxyThemeVariables } from "./helpers/proxyThemeVariables";
|
|
28
27
|
import { wrapThemeManagerContext } from "./helpers/wrapThemeManagerContext";
|
|
29
28
|
import { useFeatures } from "./hooks/useFeatures";
|
|
30
29
|
import { usePressable } from "./hooks/usePressable";
|
|
31
30
|
import { getThemeManagerIfChanged, useTheme } from "./hooks/useTheme";
|
|
32
31
|
import { TextAncestorContext } from "./views/TextAncestorContext";
|
|
32
|
+
React["keep"];
|
|
33
|
+
const defaultComponentState = {
|
|
34
|
+
hover: false,
|
|
35
|
+
press: false,
|
|
36
|
+
pressIn: false,
|
|
37
|
+
focus: false,
|
|
38
|
+
mounted: false,
|
|
39
|
+
animation: null
|
|
40
|
+
};
|
|
33
41
|
const mouseUps = /* @__PURE__ */ new Set();
|
|
34
42
|
if (typeof document !== "undefined") {
|
|
35
43
|
document.addEventListener("mouseup", () => {
|
|
@@ -37,77 +45,73 @@ if (typeof document !== "undefined") {
|
|
|
37
45
|
mouseUps.clear();
|
|
38
46
|
});
|
|
39
47
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
for (const key in next) {
|
|
44
|
-
if (prev[key] !== next[key]) {
|
|
45
|
-
return { ...prev, ...next };
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return prev;
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
__name(createShallowUpdate, "createShallowUpdate");
|
|
53
|
-
function createComponent(configIn) {
|
|
54
|
-
let staticConfig;
|
|
55
|
-
if ("parsed" in configIn) {
|
|
56
|
-
staticConfig = configIn;
|
|
57
|
-
} else {
|
|
58
|
-
staticConfig = parseStaticConfig(configIn);
|
|
48
|
+
function mergeShorthands({ defaultProps }, { shorthands }) {
|
|
49
|
+
for (const key in defaultProps) {
|
|
50
|
+
defaultProps[shorthands[key] || key] = defaultProps[key];
|
|
59
51
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
}
|
|
53
|
+
__name(mergeShorthands, "mergeShorthands");
|
|
54
|
+
let initialTheme;
|
|
55
|
+
function createComponent(configIn, ParentComponent) {
|
|
56
|
+
const staticConfig = (() => {
|
|
57
|
+
const config = extendStaticConfig(configIn, ParentComponent);
|
|
58
|
+
if ("parsed" in config) {
|
|
59
|
+
return config;
|
|
60
|
+
} else {
|
|
61
|
+
return parseStaticConfig(config);
|
|
62
|
+
}
|
|
63
|
+
})();
|
|
64
|
+
const componentClassName = `is_${staticConfig.componentName}`;
|
|
63
65
|
let tamaguiConfig;
|
|
64
66
|
let AnimatedText;
|
|
65
67
|
let AnimatedView;
|
|
66
68
|
let avoidClasses = true;
|
|
67
|
-
let defaultPseudos = {};
|
|
68
69
|
let defaultNativeStyle;
|
|
69
|
-
let defaultNativeStyleSheet
|
|
70
|
-
let
|
|
71
|
-
let initialTheme;
|
|
72
|
-
let splitStyleResult = null;
|
|
70
|
+
let defaultNativeStyleSheet;
|
|
71
|
+
let initialSplitStyles;
|
|
73
72
|
function addPseudoToStyles(styles, name, pseudos) {
|
|
74
73
|
const pseudoStyle = pseudos[name];
|
|
74
|
+
const shouldNestObject = isWeb && name !== "enterStyle" && name !== "exitStyle";
|
|
75
75
|
if (pseudoStyle) {
|
|
76
|
-
styles.push(
|
|
76
|
+
styles.push(shouldNestObject ? { [name]: pseudoStyle } : pseudoStyle);
|
|
77
77
|
}
|
|
78
|
-
const defaultPseudoStyle =
|
|
78
|
+
const defaultPseudoStyle = initialSplitStyles.pseudos[name];
|
|
79
79
|
if (defaultPseudoStyle) {
|
|
80
|
-
styles.push(
|
|
80
|
+
styles.push(shouldNestObject ? { [name]: defaultPseudoStyle } : defaultPseudoStyle);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
__name(addPseudoToStyles, "addPseudoToStyles");
|
|
84
84
|
const component = forwardRef((props, forwardedRef) => {
|
|
85
85
|
var _a, _b, _c, _d;
|
|
86
|
+
const { Component, componentName, isText, isZStack } = staticConfig;
|
|
86
87
|
if (process.env.NODE_ENV === "development") {
|
|
87
88
|
if (props["debug"]) {
|
|
88
|
-
console.warn(componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]", "
|
|
89
|
+
console.warn(staticConfig.componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]", "debug on");
|
|
90
|
+
console.log("props in:", props);
|
|
89
91
|
if (props["debug"] === "break")
|
|
90
92
|
debugger;
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
const forceUpdate = useForceUpdate();
|
|
94
|
-
const theme = useTheme(props.theme, componentName, props, forceUpdate);
|
|
96
|
+
const theme = useTheme(props.theme, staticConfig.componentName, props, forceUpdate);
|
|
95
97
|
const [state, set_] = useState(defaultComponentState);
|
|
96
98
|
const setStateShallow = createShallowUpdate(set_);
|
|
97
|
-
const shouldAvoidClasses = !!(
|
|
98
|
-
const
|
|
99
|
-
const { viewProps: viewPropsIn, pseudos, medias, style, classNames } =
|
|
99
|
+
const shouldAvoidClasses = !!(props.animation && avoidClasses);
|
|
100
|
+
const splitStyles = getSplitStyles(props, staticConfig, theme, shouldAvoidClasses ? { ...state, noClassNames: true, resolveVariablesAs: "value" } : state, shouldAvoidClasses ? null : initialSplitStyles.classNames);
|
|
101
|
+
const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
|
|
100
102
|
const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
101
103
|
const isAnimated = !!(useAnimations && props.animation);
|
|
102
104
|
const hasEnterStyle = !!props.enterStyle;
|
|
103
|
-
const styleWithPseudos = props.animation ? merge({ ...defaultNativeStyle, ...style }, state.hover && pseudos.hoverStyle, state.press && pseudos.pressStyle, state.focus && pseudos.focusStyle, hasEnterStyle && !state.mounted && pseudos.enterStyle, ...Object.values(medias)) : null;
|
|
104
105
|
const features = useFeatures(props, {
|
|
105
106
|
forceUpdate,
|
|
106
107
|
setStateShallow,
|
|
107
108
|
useAnimations,
|
|
108
109
|
state,
|
|
109
|
-
style:
|
|
110
|
-
pseudos
|
|
110
|
+
style: props.animation ? { ...defaultNativeStyle, ...style } : null,
|
|
111
|
+
pseudos,
|
|
112
|
+
staticConfig,
|
|
113
|
+
theme,
|
|
114
|
+
onDidAnimate: props.onDidAnimate
|
|
111
115
|
});
|
|
112
116
|
const {
|
|
113
117
|
tag,
|
|
@@ -146,6 +150,7 @@ function createComponent(configIn) {
|
|
|
146
150
|
accessibilityRole,
|
|
147
151
|
collapsable,
|
|
148
152
|
focusable,
|
|
153
|
+
onClick,
|
|
149
154
|
theme: _themeProp,
|
|
150
155
|
defaultVariants,
|
|
151
156
|
onLayout,
|
|
@@ -167,8 +172,8 @@ function createComponent(configIn) {
|
|
|
167
172
|
isMounted: true
|
|
168
173
|
};
|
|
169
174
|
}
|
|
170
|
-
|
|
171
|
-
if (hasEnterStyle) {
|
|
175
|
+
useIsomorphicLayoutEffect(() => {
|
|
176
|
+
if (typeof window !== "undefined" && (hasEnterStyle || props.animation)) {
|
|
172
177
|
setStateShallow({
|
|
173
178
|
mounted: true
|
|
174
179
|
});
|
|
@@ -178,7 +183,7 @@ function createComponent(configIn) {
|
|
|
178
183
|
mouseUps.delete(unPress);
|
|
179
184
|
internal.current.isMounted = false;
|
|
180
185
|
};
|
|
181
|
-
}, []);
|
|
186
|
+
}, [hasEnterStyle, props.animation]);
|
|
182
187
|
if (nativeID) {
|
|
183
188
|
viewProps.id = nativeID;
|
|
184
189
|
}
|
|
@@ -236,6 +241,7 @@ function createComponent(configIn) {
|
|
|
236
241
|
medias
|
|
237
242
|
];
|
|
238
243
|
if (!animationStyles) {
|
|
244
|
+
!state.mounted && addPseudoToStyles(styles, "enterStyle", pseudos);
|
|
239
245
|
state.hover && addPseudoToStyles(styles, "hoverStyle", pseudos);
|
|
240
246
|
state.focus && addPseudoToStyles(styles, "focusStyle", pseudos);
|
|
241
247
|
state.press && addPseudoToStyles(styles, "pressStyle", pseudos);
|
|
@@ -254,7 +260,7 @@ function createComponent(configIn) {
|
|
|
254
260
|
const className = classList.join(" ");
|
|
255
261
|
if (process.env.NODE_ENV === "development") {
|
|
256
262
|
if (props["debug"]) {
|
|
257
|
-
console.log(" \xBB className", { isStringElement, pseudos, state,
|
|
263
|
+
console.log(" \xBB className", { isStringElement, pseudos, state, classNames, propsClassName: props.className, style, classList, className: className.trim().split(" "), themeClassName: theme.className, values: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) });
|
|
258
264
|
}
|
|
259
265
|
}
|
|
260
266
|
viewProps.className = className;
|
|
@@ -295,7 +301,8 @@ function createComponent(configIn) {
|
|
|
295
301
|
viewProps.ref = forwardedRef;
|
|
296
302
|
}
|
|
297
303
|
}
|
|
298
|
-
const
|
|
304
|
+
const initialPseudos = initialSplitStyles.pseudos;
|
|
305
|
+
const attachPress = !!(pseudos && pseudos.pressStyle || initialPseudos && initialPseudos.pressStyle || onPress || onPressOut || onPressIn || onClick);
|
|
299
306
|
const isHoverable = isWeb && !isTouchDevice;
|
|
300
307
|
const attachHover = isHoverable && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
301
308
|
const pressEventKey = isStringElement ? "onClick" : "onPress";
|
|
@@ -308,7 +315,6 @@ function createComponent(configIn) {
|
|
|
308
315
|
pressIn: false
|
|
309
316
|
});
|
|
310
317
|
}, []);
|
|
311
|
-
console.log("attachHover, attachHover", attachHover, pseudos && pseudos.hoverStyle);
|
|
312
318
|
const events = shouldAttach ? {
|
|
313
319
|
...!isWeb && {
|
|
314
320
|
onPressOut: (e) => {
|
|
@@ -360,6 +366,7 @@ function createComponent(configIn) {
|
|
|
360
366
|
onPress == null ? void 0 : onPress(e);
|
|
361
367
|
unPress();
|
|
362
368
|
onPressOut == null ? void 0 : onPressOut(e);
|
|
369
|
+
onClick == null ? void 0 : onClick(e);
|
|
363
370
|
} : null
|
|
364
371
|
} : null;
|
|
365
372
|
let childEls = !children ? children : wrapThemeManagerContext(spacedChildren({
|
|
@@ -403,16 +410,15 @@ function createComponent(configIn) {
|
|
|
403
410
|
}
|
|
404
411
|
}
|
|
405
412
|
content = createElement(ViewComponent, viewProps, childEls);
|
|
406
|
-
console.log("should", attachHover);
|
|
407
413
|
if (isWeb && events && attachHover) {
|
|
408
|
-
content = <span style={{
|
|
414
|
+
content = <span className="tui_Hoverable" style={{
|
|
409
415
|
display: "contents"
|
|
410
416
|
}} onMouseEnter={events.onMouseEnter} onMouseLeave={events.onMouseLeave}>{content}</span>;
|
|
411
417
|
}
|
|
412
418
|
if (process.env.NODE_ENV === "development") {
|
|
413
419
|
if (props["debug"]) {
|
|
414
420
|
viewProps["debug"] = true;
|
|
415
|
-
console.log(" \xBB ", { propsIn: { ...props }, propsOut: { ...viewProps }, animationStyles, isStringElement, classNamesIn: (_c = props.className) == null ? void 0 : _c.split(" "), classNamesOut: (_d = viewProps.className) == null ? void 0 : _d.split(" "), pressProps, events, shouldAttach, ViewComponent, viewProps,
|
|
421
|
+
console.log(" \xBB ", { propsIn: { ...props }, propsOut: { ...viewProps }, state, splitStyles, animationStyles, isStringElement, classNamesIn: (_c = props.className) == null ? void 0 : _c.split(" "), classNamesOut: (_d = viewProps.className) == null ? void 0 : _d.split(" "), pressProps, events, shouldAttach, ViewComponent, viewProps, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses, animation: props.animation, style, defaultNativeStyle, initialSplitStyles, ...typeof window !== "undefined" ? { theme, themeState: theme.__state, themeClassName: theme.className, staticConfig, tamaguiConfig } : null });
|
|
416
422
|
}
|
|
417
423
|
}
|
|
418
424
|
if (features.length) {
|
|
@@ -423,23 +429,28 @@ function createComponent(configIn) {
|
|
|
423
429
|
}
|
|
424
430
|
return content;
|
|
425
431
|
});
|
|
432
|
+
component.displayName = staticConfig.componentName;
|
|
426
433
|
onConfiguredOnce((conf) => {
|
|
427
434
|
var _a, _b, _c, _d;
|
|
428
|
-
|
|
435
|
+
if (process.env.IS_STATIC === "is_static") {
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
429
438
|
tamaguiConfig = conf;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
439
|
+
mergeShorthands(staticConfig, tamaguiConfig);
|
|
440
|
+
avoidClasses = !!((_a = tamaguiConfig.animations) == null ? void 0 : _a.avoidClasses);
|
|
441
|
+
AnimatedText = (_b = tamaguiConfig.animations) == null ? void 0 : _b.Text;
|
|
442
|
+
AnimatedView = (_c = tamaguiConfig == null ? void 0 : tamaguiConfig.animations) == null ? void 0 : _c.View;
|
|
443
|
+
initialTheme = initialTheme || proxyThemeVariables(conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]]);
|
|
444
|
+
initialSplitStyles = getSplitStyles(staticConfig.defaultProps, staticConfig, initialTheme, {
|
|
435
445
|
mounted: true,
|
|
436
|
-
|
|
446
|
+
hover: false,
|
|
447
|
+
press: false,
|
|
448
|
+
pressIn: false,
|
|
449
|
+
focus: false,
|
|
450
|
+
resolveVariablesAs: "both",
|
|
451
|
+
keepVariantsAsProps: true
|
|
437
452
|
});
|
|
438
|
-
const {
|
|
439
|
-
if (isWeb) {
|
|
440
|
-
defaultsClassName = classNames;
|
|
441
|
-
}
|
|
442
|
-
defaultPseudos = pseudos;
|
|
453
|
+
const { style, viewProps } = initialSplitStyles;
|
|
443
454
|
defaultNativeStyle = {};
|
|
444
455
|
for (const key in style) {
|
|
445
456
|
const v = style[key];
|
|
@@ -448,13 +459,17 @@ function createComponent(configIn) {
|
|
|
448
459
|
defaultNativeStyleSheet = StyleSheet.create({
|
|
449
460
|
base: defaultNativeStyle
|
|
450
461
|
});
|
|
451
|
-
component.displayName = staticConfig.componentName;
|
|
452
462
|
component.defaultProps = {
|
|
453
463
|
...viewProps,
|
|
454
464
|
...component.defaultProps
|
|
455
465
|
};
|
|
456
|
-
if (process.env.NODE_ENV === "development" &&
|
|
457
|
-
|
|
466
|
+
if (process.env.NODE_ENV === "development" && ((_d = staticConfig.defaultProps) == null ? void 0 : _d.debug)) {
|
|
467
|
+
if (process.env.IS_STATIC !== "is_static") {
|
|
468
|
+
console.log(`\u{1F41B} [${staticConfig.componentName || "Component"}]`, {
|
|
469
|
+
staticConfig,
|
|
470
|
+
initialSplitStyles
|
|
471
|
+
});
|
|
472
|
+
}
|
|
458
473
|
}
|
|
459
474
|
});
|
|
460
475
|
let res = component;
|
|
@@ -462,25 +477,30 @@ function createComponent(configIn) {
|
|
|
462
477
|
res = memo(res);
|
|
463
478
|
}
|
|
464
479
|
res["staticConfig"] = {
|
|
465
|
-
validStyles:
|
|
480
|
+
validStyles: staticConfig.validStyles || stylePropsView,
|
|
466
481
|
...staticConfig
|
|
467
482
|
};
|
|
468
|
-
|
|
469
|
-
|
|
483
|
+
if (process.env.NODE_ENV === "development") {
|
|
484
|
+
res["whyDidYouRender"] = true;
|
|
485
|
+
}
|
|
486
|
+
res["extractable"] = (Component, conf) => {
|
|
487
|
+
Component["staticConfig"] = extendStaticConfig({
|
|
488
|
+
Component,
|
|
470
489
|
...conf,
|
|
471
490
|
neverFlatten: true,
|
|
472
491
|
defaultProps: {
|
|
473
|
-
...
|
|
492
|
+
...Component.defaultProps,
|
|
474
493
|
...conf == null ? void 0 : conf.defaultProps
|
|
475
494
|
}
|
|
476
|
-
});
|
|
477
|
-
return
|
|
495
|
+
}, res);
|
|
496
|
+
return Component;
|
|
478
497
|
};
|
|
479
498
|
return res;
|
|
480
499
|
}
|
|
481
500
|
__name(createComponent, "createComponent");
|
|
482
501
|
const Spacer = createComponent({
|
|
483
502
|
memo: true,
|
|
503
|
+
componentName: "Spacer",
|
|
484
504
|
defaultProps: {
|
|
485
505
|
...stackDefaultStyles,
|
|
486
506
|
size: true
|
|
@@ -553,45 +573,16 @@ function spacedChildren({
|
|
|
553
573
|
return next;
|
|
554
574
|
}
|
|
555
575
|
__name(spacedChildren, "spacedChildren");
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
const val = cur[key];
|
|
567
|
-
if (key !== "transform") {
|
|
568
|
-
if (!(key in res)) {
|
|
569
|
-
res[key] = val;
|
|
570
|
-
}
|
|
571
|
-
continue;
|
|
572
|
-
}
|
|
573
|
-
if (!res.transform) {
|
|
574
|
-
res.transform = val;
|
|
575
|
-
continue;
|
|
576
|
-
}
|
|
577
|
-
for (const t of val) {
|
|
578
|
-
const tkey = Object.keys(t)[0];
|
|
579
|
-
if (res.transform.find((existing) => tkey in existing)) {
|
|
580
|
-
continue;
|
|
581
|
-
}
|
|
582
|
-
res.transform.push(t);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
return res;
|
|
587
|
-
}, "merge");
|
|
588
|
-
const AbsoluteFill = /* @__PURE__ */ __name((props) => isWeb ? <div style={{
|
|
589
|
-
position: "absolute",
|
|
590
|
-
top: 0,
|
|
591
|
-
left: 0,
|
|
592
|
-
right: 0,
|
|
593
|
-
bottom: 0
|
|
594
|
-
}}>{props.children}</div> : <View style={StyleSheet.absoluteFill}>{props.child}</View>, "AbsoluteFill");
|
|
576
|
+
function AbsoluteFill(props) {
|
|
577
|
+
return isWeb ? <div style={{
|
|
578
|
+
position: "absolute",
|
|
579
|
+
top: 0,
|
|
580
|
+
left: 0,
|
|
581
|
+
right: 0,
|
|
582
|
+
bottom: 0
|
|
583
|
+
}}>{props.children}</div> : <View style={StyleSheet.absoluteFill}>{props.child}</View>;
|
|
584
|
+
}
|
|
585
|
+
__name(AbsoluteFill, "AbsoluteFill");
|
|
595
586
|
export {
|
|
596
587
|
AbsoluteFill,
|
|
597
588
|
Spacer,
|
|
@@ -12,6 +12,14 @@ function createTamagui(config) {
|
|
|
12
12
|
if (createdConfigs.has(config)) {
|
|
13
13
|
return config;
|
|
14
14
|
}
|
|
15
|
+
if (process.env.NODE_ENV === "development") {
|
|
16
|
+
if (!config.tokens) {
|
|
17
|
+
throw new Error(`No tokens provided to Tamagui config`);
|
|
18
|
+
}
|
|
19
|
+
if (!config.themes) {
|
|
20
|
+
throw new Error(`No themes provided to Tamagui config`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
15
23
|
if (getHasConfigured()) {
|
|
16
24
|
console.warn("Called createTamagui twice! Should never do so");
|
|
17
25
|
}
|
|
@@ -67,13 +75,16 @@ function createTamagui(config) {
|
|
|
67
75
|
}
|
|
68
76
|
if (isWeb) {
|
|
69
77
|
const isDarkOrLightBase = themeName === "dark" || themeName === "light";
|
|
70
|
-
const isDark = themeName.
|
|
78
|
+
const isDark = themeName.startsWith("dark");
|
|
71
79
|
const selector = `${CNP}${themeName}`;
|
|
72
|
-
const addDarkLightSels = hasDarkLight && !isDarkOrLightBase;
|
|
73
80
|
const selectors = [selector];
|
|
74
|
-
if (
|
|
81
|
+
if (hasDarkLight) {
|
|
75
82
|
const childSelector = `${CNP}${themeName.replace("dark_", "").replace("light_", "")}`;
|
|
76
|
-
const
|
|
83
|
+
const order = isDark ? ["dark", "light"] : ["light", "dark"];
|
|
84
|
+
if (isDarkOrLightBase) {
|
|
85
|
+
order.reverse();
|
|
86
|
+
}
|
|
87
|
+
const [stronger, weaker] = order;
|
|
77
88
|
const max = (_b = config.maxDarkLightNesting) != null ? _b : 3;
|
|
78
89
|
new Array(max * 2).fill(void 0).forEach((_, pi) => {
|
|
79
90
|
if (pi % 2 === 1)
|
|
@@ -84,25 +95,55 @@ function createTamagui(config) {
|
|
|
84
95
|
selectors.push(`${(parents.length > 1 ? parents.slice(1) : parents).join(" ")} ${childSelector}`);
|
|
85
96
|
});
|
|
86
97
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
cssRules.push(`${selectors.map((x) => `:root${x}`).join(", ")} {${vars}}`);
|
|
99
|
+
if (config.shouldAddPrefersColorThemes) {
|
|
100
|
+
if (isDarkOrLightBase) {
|
|
101
|
+
cssRules.push(`@media(prefers-color-scheme: ${isDark ? "dark" : "light"}) {
|
|
102
|
+
body { background:${theme.background}; color: ${theme.color} }
|
|
103
|
+
:root {${vars} }
|
|
104
|
+
}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
91
107
|
}
|
|
92
108
|
}
|
|
93
109
|
varsByValue.clear();
|
|
94
110
|
Object.freeze(cssRules);
|
|
111
|
+
const css = cssRules.join("\n");
|
|
95
112
|
return {
|
|
96
113
|
cssRules,
|
|
97
|
-
css
|
|
114
|
+
css
|
|
98
115
|
};
|
|
99
116
|
})();
|
|
100
117
|
const tokensParsed = parseTokens(config.tokens);
|
|
118
|
+
const fontsParsed = (() => {
|
|
119
|
+
if (!config.fonts) {
|
|
120
|
+
throw new Error(`No fonts defined!`);
|
|
121
|
+
}
|
|
122
|
+
const res = {};
|
|
123
|
+
for (const familyName in config.fonts) {
|
|
124
|
+
const family = config.fonts[familyName];
|
|
125
|
+
const parsed = {};
|
|
126
|
+
for (const attrKey in family) {
|
|
127
|
+
const attr = family[attrKey];
|
|
128
|
+
if (attrKey === "family") {
|
|
129
|
+
parsed[attrKey] = attr;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
parsed[attrKey] = Object.keys(attr).reduce((acc, cur) => {
|
|
133
|
+
acc[`$${cur}`] = attr[cur];
|
|
134
|
+
return acc;
|
|
135
|
+
}, {});
|
|
136
|
+
}
|
|
137
|
+
res[`$${familyName}`] = parsed;
|
|
138
|
+
}
|
|
139
|
+
return res;
|
|
140
|
+
})();
|
|
101
141
|
const getCSS = /* @__PURE__ */ __name(() => {
|
|
102
142
|
return `${themeConfig.css}
|
|
103
143
|
${getInsertedRules().join("\n")}`;
|
|
104
144
|
}, "getCSS");
|
|
105
145
|
const next = {
|
|
146
|
+
fonts: {},
|
|
106
147
|
animations: {},
|
|
107
148
|
shorthands: {},
|
|
108
149
|
media: {},
|
|
@@ -112,6 +153,7 @@ ${getInsertedRules().join("\n")}`;
|
|
|
112
153
|
defaultTheme: "light",
|
|
113
154
|
...config
|
|
114
155
|
}),
|
|
156
|
+
fontsParsed,
|
|
115
157
|
themeConfig,
|
|
116
158
|
tokensParsed,
|
|
117
159
|
parsed: true,
|
|
@@ -130,24 +172,6 @@ const parseTokens = /* @__PURE__ */ __name((tokens) => {
|
|
|
130
172
|
const res = {};
|
|
131
173
|
for (const key in tokens) {
|
|
132
174
|
res[key] = {};
|
|
133
|
-
if (key === "font") {
|
|
134
|
-
for (const family in tokens.font) {
|
|
135
|
-
const obj = {};
|
|
136
|
-
res.font[`$${family}`] = obj;
|
|
137
|
-
for (const attrKey in tokens.font[family]) {
|
|
138
|
-
const attr = tokens.font[family][attrKey];
|
|
139
|
-
if (attrKey === "family") {
|
|
140
|
-
obj[attrKey] = attr;
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
obj[attrKey] = Object.keys(attr).reduce((acc, cur) => {
|
|
144
|
-
acc[`$${cur}`] = attr[cur];
|
|
145
|
-
return acc;
|
|
146
|
-
}, {});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
175
|
for (const skey in tokens[key]) {
|
|
152
176
|
res[key][`$${skey}`] = tokens[key][skey];
|
|
153
177
|
}
|
package/dist/jsx/createTokens.js
CHANGED
|
@@ -6,17 +6,13 @@ function createTokens(tokens) {
|
|
|
6
6
|
if (process.env.NODE_ENV === "development") {
|
|
7
7
|
validateTokens(tokens);
|
|
8
8
|
}
|
|
9
|
-
return setupTokens(tokens);
|
|
10
|
-
}
|
|
11
|
-
__name(createTokens, "createTokens");
|
|
12
|
-
function setupTokens(tokens) {
|
|
13
9
|
return mapTokensToVariables(tokens);
|
|
14
10
|
}
|
|
15
|
-
__name(
|
|
11
|
+
__name(createTokens, "createTokens");
|
|
16
12
|
const mapTokensToVariables = /* @__PURE__ */ __name((tokens, parentPath = "") => {
|
|
17
13
|
const res = {};
|
|
18
14
|
for (const key in tokens) {
|
|
19
|
-
|
|
15
|
+
let val = tokens[key];
|
|
20
16
|
const name = parentPath ? `${parentPath}-${key}` : key;
|
|
21
17
|
if (val && typeof val === "object") {
|
|
22
18
|
res[key] = mapTokensToVariables(tokens[key], name);
|
|
@@ -22,12 +22,17 @@ function isVariable(v) {
|
|
|
22
22
|
}
|
|
23
23
|
__name(isVariable, "isVariable");
|
|
24
24
|
function getVariableValue(v) {
|
|
25
|
-
if (isVariable(v))
|
|
25
|
+
if (isVariable(v))
|
|
26
26
|
return v.val;
|
|
27
|
-
}
|
|
28
27
|
return v;
|
|
29
28
|
}
|
|
30
29
|
__name(getVariableValue, "getVariableValue");
|
|
30
|
+
function getVariableName(v) {
|
|
31
|
+
if (isVariable(v))
|
|
32
|
+
return v.name;
|
|
33
|
+
return v;
|
|
34
|
+
}
|
|
35
|
+
__name(getVariableName, "getVariableName");
|
|
31
36
|
const createCSSVariable = /* @__PURE__ */ __name((val, includeVar = true) => {
|
|
32
37
|
const name = val.replace(/[^a-z0-9\_\-]+/i, "_");
|
|
33
38
|
return includeVar ? `var(--${name})` : name;
|
|
@@ -37,6 +42,7 @@ export {
|
|
|
37
42
|
Variable,
|
|
38
43
|
createCSSVariable,
|
|
39
44
|
createVariable,
|
|
45
|
+
getVariableName,
|
|
40
46
|
getVariableValue,
|
|
41
47
|
isVariable
|
|
42
48
|
};
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { useInsertionEffect } from "react";
|
|
4
4
|
import { getStylesAtomic } from "./getStylesAtomic";
|
|
5
|
-
import { insertStyleRule } from "./insertStyleRule";
|
|
5
|
+
import { insertStyleRule, updateInsertedCache } from "./insertStyleRule";
|
|
6
6
|
let added = /* @__PURE__ */ new Set();
|
|
7
7
|
function useStylesAsClassname(styles, disable = false, debug = false) {
|
|
8
8
|
if (!useInsertionEffect) {
|
|
@@ -14,6 +14,9 @@ function useStylesAsClassname(styles, disable = false, debug = false) {
|
|
|
14
14
|
insertions.push({ identifier, rule });
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
+
for (const { identifier, rule } of insertions) {
|
|
18
|
+
updateInsertedCache(identifier, rule);
|
|
19
|
+
}
|
|
17
20
|
useInsertionEffect(() => {
|
|
18
21
|
for (const { identifier, rule } of insertions) {
|
|
19
22
|
insertStyleRule(identifier, rule);
|