@tamagui/core 1.0.1-beta.220 → 1.0.1-beta.222
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/addTheme.js +7 -10
- package/dist/cjs/addTheme.js.map +3 -3
- package/dist/cjs/config.js +8 -4
- package/dist/cjs/config.js.map +2 -2
- package/dist/cjs/{hooks/useUnmountEffect.js → contexts/ButtonNestingContext.js} +7 -9
- package/dist/cjs/contexts/ButtonNestingContext.js.map +7 -0
- package/dist/cjs/createComponent.js +63 -67
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/createTamagui.js +13 -12
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createTokens.test.js +27 -0
- package/dist/cjs/createTokens.test.js.map +7 -0
- package/dist/cjs/createVariable.js +4 -9
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariable.test.js +7 -0
- package/dist/cjs/createVariable.test.js.map +7 -0
- package/dist/cjs/createVariables.js +6 -7
- package/dist/cjs/createVariables.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +161 -147
- package/dist/cjs/helpers/ThemeManager.js.map +3 -3
- package/dist/cjs/helpers/ThemeManager.test.js +421 -34
- package/dist/cjs/helpers/ThemeManager.test.js.map +2 -2
- package/dist/cjs/helpers/{getTokens.js → ThemeManagerContext.js} +8 -8
- package/dist/cjs/helpers/ThemeManagerContext.js.map +7 -0
- package/dist/cjs/helpers/createPropMapper.js +4 -4
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/extendStaticConfig.js +2 -4
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/{assignNativePropsToWeb.native.js → getBoundingClientRect.js} +15 -8
- package/dist/cjs/helpers/getBoundingClientRect.js.map +7 -0
- package/dist/cjs/{hooks/useConstant.js → helpers/getRect.js} +14 -17
- package/dist/cjs/helpers/getRect.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +82 -85
- package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
- package/dist/cjs/helpers/getThemeCSSRules.js +6 -2
- package/dist/cjs/helpers/getThemeCSSRules.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +1 -1
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/mergeTransform.js +11 -8
- package/dist/cjs/helpers/mergeTransform.js.map +2 -2
- package/dist/cjs/helpers/pseudoDescriptors.js +1 -0
- package/dist/cjs/helpers/pseudoDescriptors.js.map +2 -2
- package/dist/cjs/helpers/themeable.js +9 -9
- package/dist/cjs/helpers/themeable.js.map +2 -2
- package/dist/cjs/hooks/useElementLayout.js +4 -12
- package/dist/cjs/hooks/useElementLayout.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +2 -1
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +114 -156
- package/dist/cjs/hooks/useTheme.js.map +3 -3
- package/dist/cjs/hooks/useThemeName.js +52 -0
- package/dist/cjs/hooks/useThemeName.js.map +7 -0
- package/dist/cjs/index.js +2 -5
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/setupReactNative.js +20 -7
- package/dist/cjs/setupReactNative.js.map +2 -2
- package/dist/cjs/styled.js +2 -19
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/updateTheme.js +9 -9
- package/dist/cjs/updateTheme.js.map +2 -2
- package/dist/cjs/views/TamaguiProvider.js +3 -3
- package/dist/cjs/views/TamaguiProvider.js.map +2 -2
- package/dist/cjs/views/Theme.js +39 -28
- package/dist/cjs/views/Theme.js.map +3 -3
- package/dist/cjs/views/ThemeProvider.js +8 -33
- package/dist/cjs/views/ThemeProvider.js.map +3 -3
- package/dist/esm/addTheme.js +7 -10
- package/dist/esm/addTheme.js.map +3 -3
- package/dist/esm/config.js +8 -3
- package/dist/esm/config.js.map +2 -2
- package/dist/esm/contexts/ButtonNestingContext.js +6 -0
- package/dist/esm/contexts/ButtonNestingContext.js.map +7 -0
- package/dist/esm/createComponent.js +65 -70
- package/dist/esm/createComponent.js.map +3 -3
- package/dist/esm/createTamagui.js +13 -12
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createTokens.test.js +26 -0
- package/dist/esm/createTokens.test.js.map +7 -0
- package/dist/esm/createVariable.js +4 -9
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariable.test.js +6 -0
- package/dist/esm/createVariable.test.js.map +7 -0
- package/dist/esm/createVariables.js +6 -7
- package/dist/esm/createVariables.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +140 -144
- package/dist/esm/helpers/ThemeManager.js.map +3 -3
- package/dist/esm/helpers/ThemeManager.test.js +421 -34
- package/dist/esm/helpers/ThemeManager.test.js.map +2 -2
- package/dist/esm/helpers/ThemeManagerContext.js +6 -0
- package/dist/esm/helpers/ThemeManagerContext.js.map +7 -0
- package/dist/esm/helpers/createPropMapper.js +4 -4
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +2 -4
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/getBoundingClientRect.js +13 -0
- package/dist/esm/helpers/getBoundingClientRect.js.map +7 -0
- package/dist/esm/helpers/getRect.js +12 -0
- package/dist/esm/helpers/getRect.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +90 -87
- package/dist/esm/helpers/getSplitStyles.js.map +3 -3
- package/dist/esm/helpers/getThemeCSSRules.js +6 -2
- package/dist/esm/helpers/getThemeCSSRules.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +1 -1
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/mergeTransform.js +8 -6
- package/dist/esm/helpers/mergeTransform.js.map +2 -2
- package/dist/esm/helpers/pseudoDescriptors.js +1 -0
- package/dist/esm/helpers/pseudoDescriptors.js.map +2 -2
- package/dist/esm/helpers/themeable.js +9 -9
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/hooks/useElementLayout.js +2 -9
- package/dist/esm/hooks/useElementLayout.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +3 -2
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +114 -159
- package/dist/esm/hooks/useTheme.js.map +3 -3
- package/dist/esm/hooks/useThemeName.js +28 -0
- package/dist/esm/hooks/useThemeName.js.map +7 -0
- package/dist/esm/index.js +3 -5
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/setupReactNative.js +18 -6
- package/dist/esm/setupReactNative.js.map +2 -2
- package/dist/esm/styled.js +3 -20
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/updateTheme.js +9 -9
- package/dist/esm/updateTheme.js.map +2 -2
- package/dist/esm/views/TamaguiProvider.js +4 -4
- package/dist/esm/views/TamaguiProvider.js.map +2 -2
- package/dist/esm/views/Theme.js +40 -29
- package/dist/esm/views/Theme.js.map +3 -3
- package/dist/esm/views/ThemeProvider.js +8 -27
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/package.json +12 -12
- package/src/__snapshots__/createTokens.test.ts.snap +877 -0
- package/src/addTheme.ts +9 -12
- package/src/config.ts +10 -2
- package/src/contexts/ButtonNestingContext.tsx +3 -0
- package/src/createComponent.tsx +117 -108
- package/src/createTamagui.ts +16 -14
- package/src/createTokens.test.ts +29 -0
- package/src/createTokens.ts +1 -1
- package/src/createVariable.test.ts +7 -0
- package/src/createVariable.ts +4 -10
- package/src/createVariables.ts +7 -7
- package/src/helpers/ThemeManager.test.tsx +480 -0
- package/src/helpers/ThemeManager.tsx +171 -166
- package/src/helpers/ThemeManagerContext.tsx +5 -0
- package/src/helpers/createPropMapper.ts +4 -4
- package/src/helpers/extendStaticConfig.ts +4 -4
- package/src/helpers/getBoundingClientRect.tsx +7 -0
- package/src/helpers/getRect.tsx +8 -0
- package/src/helpers/getSplitStyles.tsx +98 -93
- package/src/helpers/getThemeCSSRules.ts +9 -2
- package/src/helpers/insertStyleRule.tsx +2 -2
- package/src/helpers/mergeTransform.ts +13 -6
- package/src/helpers/pseudoDescriptors.ts +1 -0
- package/src/helpers/themeable.tsx +17 -9
- package/src/hooks/useElementLayout.tsx +3 -8
- package/src/hooks/useMedia.tsx +3 -3
- package/src/hooks/useTheme.tsx +138 -211
- package/src/hooks/useThemeName.tsx +27 -0
- package/src/index.ts +3 -4
- package/src/setupReactNative.ts +16 -5
- package/src/styled.tsx +4 -23
- package/src/types.tsx +53 -26
- package/src/updateTheme.ts +12 -9
- package/src/views/TamaguiProvider.tsx +5 -5
- package/src/views/Theme.tsx +48 -39
- package/src/views/ThemeProvider.tsx +11 -33
- package/types/Tamagui.d.ts +1 -1
- package/types/addTheme.d.ts +23 -2
- package/types/config.d.ts +0 -1
- package/types/contexts/ButtonNestingContext.d.ts +3 -0
- package/types/createTokens.test.d.ts +2 -0
- package/types/createVariable.d.ts +2 -2
- package/types/createVariable.test.d.ts +2 -0
- package/types/helpers/ThemeManager.d.ts +20 -30
- package/types/helpers/ThemeManager.test.d.ts +2 -0
- package/types/helpers/ThemeManagerContext.d.ts +4 -0
- package/types/helpers/getBoundingClientRect.d.ts +2 -0
- package/types/helpers/getRect.d.ts +9 -0
- package/types/helpers/insertStyleRule.d.ts +1 -1
- package/types/helpers/mergeTransform.d.ts +5 -3
- package/types/helpers/themeable.d.ts +3 -0
- package/types/hooks/useElementLayout.d.ts +0 -8
- package/types/hooks/useTheme.d.ts +10 -20
- package/types/hooks/useThemeName.d.ts +5 -0
- package/types/index.d.ts +3 -4
- package/types/setupReactNative.d.ts +4 -2
- package/types/types.d.ts +46 -20
- package/types/updateTheme.d.ts +23 -2
- package/types/views/Theme.d.ts +3 -4
- package/dist/cjs/constants/platform.js +0 -74
- package/dist/cjs/constants/platform.js.map +0 -7
- package/dist/cjs/constants/platform.native.js +0 -62
- package/dist/cjs/constants/platform.native.js.map +0 -7
- package/dist/cjs/helpers/assignNativePropsToWeb.js +0 -188
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +0 -7
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +0 -7
- package/dist/cjs/helpers/calc.js +0 -71
- package/dist/cjs/helpers/calc.js.map +0 -7
- package/dist/cjs/helpers/getFont.js +0 -66
- package/dist/cjs/helpers/getFont.js.map +0 -7
- package/dist/cjs/helpers/getStackSize.js +0 -46
- package/dist/cjs/helpers/getStackSize.js.map +0 -7
- package/dist/cjs/helpers/getTokens.js.map +0 -7
- package/dist/cjs/helpers/startTransition.js +0 -36
- package/dist/cjs/helpers/startTransition.js.map +0 -7
- package/dist/cjs/helpers/validate.js +0 -2
- package/dist/cjs/helpers/validate.js.map +0 -7
- package/dist/cjs/hooks/useConstant.js.map +0 -7
- package/dist/cjs/hooks/useIsMounted.js +0 -40
- package/dist/cjs/hooks/useIsMounted.js.map +0 -7
- package/dist/cjs/hooks/usePressable.js +0 -36
- package/dist/cjs/hooks/usePressable.js.map +0 -7
- package/dist/cjs/hooks/useUnmountEffect.js.map +0 -7
- package/dist/cjs/injectStyles.js +0 -40
- package/dist/cjs/injectStyles.js.map +0 -7
- package/dist/cjs/react-native.js +0 -22
- package/dist/cjs/react-native.js.map +0 -7
- package/dist/esm/constants/platform.js +0 -39
- package/dist/esm/constants/platform.js.map +0 -7
- package/dist/esm/constants/platform.native.js +0 -28
- package/dist/esm/constants/platform.native.js.map +0 -7
- package/dist/esm/helpers/assignNativePropsToWeb.js +0 -164
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +0 -7
- package/dist/esm/helpers/assignNativePropsToWeb.native.js +0 -6
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +0 -7
- package/dist/esm/helpers/calc.js +0 -47
- package/dist/esm/helpers/calc.js.map +0 -7
- package/dist/esm/helpers/getFont.js +0 -42
- package/dist/esm/helpers/getFont.js.map +0 -7
- package/dist/esm/helpers/getStackSize.js +0 -22
- package/dist/esm/helpers/getStackSize.js.map +0 -7
- package/dist/esm/helpers/getTokens.js +0 -6
- package/dist/esm/helpers/getTokens.js.map +0 -7
- package/dist/esm/helpers/startTransition.js +0 -6
- package/dist/esm/helpers/startTransition.js.map +0 -7
- package/dist/esm/helpers/validate.js +0 -1
- package/dist/esm/helpers/validate.js.map +0 -7
- package/dist/esm/hooks/useConstant.js +0 -15
- package/dist/esm/hooks/useConstant.js.map +0 -7
- package/dist/esm/hooks/useIsMounted.js +0 -16
- package/dist/esm/hooks/useIsMounted.js.map +0 -7
- package/dist/esm/hooks/usePressable.js +0 -12
- package/dist/esm/hooks/usePressable.js.map +0 -7
- package/dist/esm/hooks/useUnmountEffect.js +0 -8
- package/dist/esm/hooks/useUnmountEffect.js.map +0 -7
- package/dist/esm/injectStyles.js +0 -16
- package/dist/esm/injectStyles.js.map +0 -7
- package/dist/esm/react-native.js +0 -3
- package/dist/esm/react-native.js.map +0 -7
- package/src/contexts/ButtonInsideButtonContext.tsx +0 -3
- package/src/contexts/ThemeContext.tsx +0 -5
- package/src/helpers/areEqualSets.tsx +0 -9
- package/src/views/ThemeInverse.tsx +0 -43
- package/src/views/ThemeReset.tsx +0 -43
- package/types/constants/platform.d.ts +0 -13
- package/types/constants/platform.native.d.ts +0 -13
- package/types/contexts/ButtonInsideButtonContext.d.ts +0 -3
- package/types/contexts/ThemeContext.d.ts +0 -7
- package/types/helpers/areEqualSets.d.ts +0 -2
- package/types/helpers/assignNativePropsToWeb.d.ts +0 -2
- package/types/helpers/assignNativePropsToWeb.native.d.ts +0 -2
- package/types/helpers/calc.d.ts +0 -1
- package/types/helpers/getFont.d.ts +0 -3
- package/types/helpers/getStackSize.d.ts +0 -8
- package/types/helpers/getTokens.d.ts +0 -2
- package/types/helpers/startTransition.d.ts +0 -3
- package/types/helpers/validate.d.ts +0 -1
- package/types/hooks/useConstant.d.ts +0 -2
- package/types/hooks/useIsMounted.d.ts +0 -3
- package/types/hooks/useMedia.test.d.ts +0 -1
- package/types/hooks/usePressable.d.ts +0 -3
- package/types/hooks/usePressablePressResponder.d.ts +0 -84
- package/types/hooks/useUnmountEffect.d.ts +0 -2
- package/types/injectStyles.d.ts +0 -7
- package/types/react-native.d.ts +0 -8
- package/types/views/AbsoluteFill.d.ts +0 -5
- package/types/views/AbsoluteFill.native.d.ts +0 -3
- package/types/views/ThemeInverse.d.ts +0 -9
- package/types/views/ThemeReset.d.ts +0 -4
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,10 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
19
|
var ThemeProvider_exports = {};
|
|
26
20
|
__export(ThemeProvider_exports, {
|
|
@@ -29,23 +23,14 @@ __export(ThemeProvider_exports, {
|
|
|
29
23
|
module.exports = __toCommonJS(ThemeProvider_exports);
|
|
30
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
25
|
var import_constants = require("@tamagui/constants");
|
|
32
|
-
var import_react =
|
|
33
|
-
var import_config = require("../config");
|
|
26
|
+
var import_react = require("react");
|
|
34
27
|
var import_constants2 = require("../constants/constants");
|
|
35
|
-
var import_ThemeContext = require("../contexts/ThemeContext");
|
|
36
28
|
var import_Theme = require("./Theme");
|
|
37
|
-
import_react.default["createElement"];
|
|
38
29
|
const ThemeProvider = (props) => {
|
|
39
|
-
if (process.env.NODE_ENV === "development") {
|
|
40
|
-
if (!(0, import_config.getHasConfigured)()) {
|
|
41
|
-
throw new Error(`Missing configureThemes() call, add to your root file`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
30
|
if (import_constants.isClient) {
|
|
45
31
|
(0, import_react.useLayoutEffect)(() => {
|
|
46
|
-
if (props.disableRootThemeClass)
|
|
32
|
+
if (props.disableRootThemeClass)
|
|
47
33
|
return;
|
|
48
|
-
}
|
|
49
34
|
const cn = `${import_constants2.THEME_CLASSNAME_PREFIX}${props.defaultTheme}`;
|
|
50
35
|
const target = props.themeClassNameOnRoot ? document.documentElement : document.body;
|
|
51
36
|
target.classList.add(cn);
|
|
@@ -54,22 +39,12 @@ const ThemeProvider = (props) => {
|
|
|
54
39
|
};
|
|
55
40
|
}, [props.defaultTheme, props.disableRootThemeClass, props.themeClassNameOnRoot]);
|
|
56
41
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
}, [props.defaultTheme]);
|
|
65
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeContext.ThemeContext.Provider, {
|
|
66
|
-
value: themeContext,
|
|
67
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.Theme, {
|
|
68
|
-
className: props.className,
|
|
69
|
-
name: props.defaultTheme,
|
|
70
|
-
disableThemeClass: props.disableRootThemeClass,
|
|
71
|
-
children: props.children
|
|
72
|
-
})
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Theme.Theme, {
|
|
43
|
+
className: props.className,
|
|
44
|
+
name: props.defaultTheme,
|
|
45
|
+
disableThemeClass: props.disableRootThemeClass,
|
|
46
|
+
_isRoot: true,
|
|
47
|
+
children: props.children
|
|
73
48
|
});
|
|
74
49
|
};
|
|
75
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/views/ThemeProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isClient } from '@tamagui/constants'\nimport
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["import_constants"
|
|
4
|
+
"sourcesContent": ["import { isClient } from '@tamagui/constants'\nimport { useLayoutEffect } from 'react'\n\nimport { THEME_CLASSNAME_PREFIX } from '../constants/constants'\nimport { Theme } from './Theme'\n\nexport type ThemeProviderProps = {\n className?: string\n defaultTheme: string\n disableRootThemeClass?: boolean\n themeClassNameOnRoot?: boolean\n children?: any\n reset?: boolean\n}\n\nexport const ThemeProvider = (props: ThemeProviderProps) => {\n // ensure theme is attached to root body node as well to work with modals by default\n if (isClient) {\n useLayoutEffect(() => {\n if (props.disableRootThemeClass) return\n const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`\n const target = props.themeClassNameOnRoot ? document.documentElement : document.body\n target.classList.add(cn)\n return () => {\n target.classList.remove(cn)\n }\n }, [props.defaultTheme, props.disableRootThemeClass, props.themeClassNameOnRoot])\n }\n\n return (\n <Theme\n className={props.className}\n name={props.defaultTheme}\n disableThemeClass={props.disableRootThemeClass}\n // @ts-expect-error\n _isRoot\n >\n {props.children}\n </Theme>\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BI;AA9BJ,uBAAyB;AACzB,mBAAgC;AAEhC,IAAAA,oBAAuC;AACvC,mBAAsB;AAWf,MAAM,gBAAgB,CAAC,UAA8B;AAE1D,MAAI,2BAAU;AACZ,sCAAgB,MAAM;AACpB,UAAI,MAAM;AAAuB;AACjC,YAAM,KAAK,GAAG,2CAAyB,MAAM;AAC7C,YAAM,SAAS,MAAM,uBAAuB,SAAS,kBAAkB,SAAS;AAChF,aAAO,UAAU,IAAI,EAAE;AACvB,aAAO,MAAM;AACX,eAAO,UAAU,OAAO,EAAE;AAAA,MAC5B;AAAA,IACF,GAAG,CAAC,MAAM,cAAc,MAAM,uBAAuB,MAAM,oBAAoB,CAAC;AAAA,EAClF;AAEA,SACE,4CAAC;AAAA,IACC,WAAW,MAAM;AAAA,IACjB,MAAM,MAAM;AAAA,IACZ,mBAAmB,MAAM;AAAA,IAEzB,SAAO;AAAA,IAEN,gBAAM;AAAA,GACT;AAEJ;",
|
|
6
|
+
"names": ["import_constants"]
|
|
7
7
|
}
|
package/dist/esm/addTheme.js
CHANGED
|
@@ -2,22 +2,19 @@ import { isWeb } from "@tamagui/constants";
|
|
|
2
2
|
import { getConfig, updateConfig } from "./config";
|
|
3
3
|
import { getThemeCSSRules } from "./helpers/getThemeCSSRules";
|
|
4
4
|
import { ensureThemeVariable, proxyThemeToParents } from "./helpers/themes";
|
|
5
|
-
function addTheme({
|
|
6
|
-
name: themeName,
|
|
7
|
-
theme: themeIn,
|
|
8
|
-
insertCSS,
|
|
9
|
-
update
|
|
10
|
-
}) {
|
|
5
|
+
function addTheme(props) {
|
|
11
6
|
var _a;
|
|
12
7
|
const config = getConfig();
|
|
13
8
|
if (process.env.NODE_ENV === "development") {
|
|
14
9
|
if (!config) {
|
|
15
|
-
throw new Error(`
|
|
10
|
+
throw new Error(`No config`);
|
|
16
11
|
}
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const theme2 = config.themes[props.name];
|
|
13
|
+
if (!props.update && theme2) {
|
|
14
|
+
return { theme: theme2 };
|
|
19
15
|
}
|
|
20
16
|
}
|
|
17
|
+
const { name: themeName, theme: themeIn, insertCSS } = props;
|
|
21
18
|
const theme = { ...themeIn };
|
|
22
19
|
for (const key in theme) {
|
|
23
20
|
ensureThemeVariable(theme, key);
|
|
@@ -33,7 +30,7 @@ function addTheme({
|
|
|
33
30
|
names: [themeName],
|
|
34
31
|
theme
|
|
35
32
|
});
|
|
36
|
-
const id = `
|
|
33
|
+
const id = `t_theme_style_${themeName}`;
|
|
37
34
|
const existing = document.querySelector(`#${id}`);
|
|
38
35
|
const style = document.createElement("style");
|
|
39
36
|
style.id = id;
|
package/dist/esm/addTheme.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/addTheme.ts"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nimport { getConfig, updateConfig } from './config'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { ThemeDefinition, ThemeParsed } from './types'\n\nexport function addTheme(
|
|
5
|
-
"mappings": "AAAA,SAAS,aAAa;AAEtB,SAAS,WAAW,oBAAoB;AACxC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB,2BAA2B;AAGlD,SAAS,SAAS
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { isWeb } from '@tamagui/constants'\n\nimport { getConfig, updateConfig } from './config'\nimport { getThemeCSSRules } from './helpers/getThemeCSSRules'\nimport { ensureThemeVariable, proxyThemeToParents } from './helpers/themes'\nimport { ThemeDefinition, ThemeParsed } from './types'\n\nexport function addTheme(props: {\n name: string\n theme: Partial<Record<keyof ThemeDefinition, any>>\n insertCSS?: boolean\n update?: boolean\n}) {\n const config = getConfig()\n\n if (process.env.NODE_ENV === 'development') {\n if (!config) {\n throw new Error(`No config`)\n }\n const theme = config.themes[props.name]\n if (!props.update && theme) {\n return { theme }\n }\n }\n\n const { name: themeName, theme: themeIn, insertCSS } = props\n const theme = { ...themeIn } as ThemeParsed\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n let cssRules: string[] = []\n\n if (isWeb) {\n if (insertCSS) {\n cssRules = getThemeCSSRules({\n // @ts-ignore this works but should be fixed types\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const id = `t_theme_style_${themeName}`\n const existing = document.querySelector(`#${id}`)\n const style = document.createElement('style')\n style.id = id\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n if (existing) {\n existing.parentElement?.removeChild(existing)\n }\n }\n }\n\n updateConfig('themes', { ...config.themes, [themeName]: themeProxied })\n\n // trigger updates in components\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa;AAEtB,SAAS,WAAW,oBAAoB;AACxC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB,2BAA2B;AAGlD,SAAS,SAAS,OAKtB;AAZH;AAaE,QAAM,SAAS,UAAU;AAEzB,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,WAAW;AAAA,IAC7B;AACA,UAAMA,SAAQ,OAAO,OAAO,MAAM;AAClC,QAAI,CAAC,MAAM,UAAUA,QAAO;AAC1B,aAAO,EAAE,OAAAA,OAAM;AAAA,IACjB;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,WAAW,OAAO,SAAS,UAAU,IAAI;AACvD,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,wBAAoB,OAAO,GAAG;AAAA,EAChC;AAEA,QAAM,eAAe,oBAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,aAAa;AAE3B,MAAI,WAAqB,CAAC;AAE1B,MAAI,OAAO;AACT,QAAI,WAAW;AACb,iBAAW,iBAAiB;AAAA,QAE1B;AAAA,QACA;AAAA,QACA,OAAO,CAAC,SAAS;AAAA,QACjB;AAAA,MACF,CAAC;AACD,YAAM,KAAK,iBAAiB;AAC5B,YAAM,WAAW,SAAS,cAAc,IAAI,IAAI;AAChD,YAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,YAAM,KAAK;AACX,YAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,eAAS,KAAK,YAAY,KAAK;AAC/B,UAAI,UAAU;AACZ,uBAAS,kBAAT,mBAAwB,YAAY;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,eAAa,UAAU,EAAE,GAAG,OAAO,QAAQ,CAAC,YAAY,aAAa,CAAC;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["theme"]
|
|
7
7
|
}
|
package/dist/esm/config.js
CHANGED
|
@@ -13,8 +13,14 @@ const setConfigFont = (name, font, fontParsed) => {
|
|
|
13
13
|
Object.assign(conf.fonts, { [name]: font });
|
|
14
14
|
Object.assign(conf.fontsParsed, { [`$${name}`]: fontParsed });
|
|
15
15
|
};
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const getConfig = () => {
|
|
17
|
+
if (!conf) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
process.env.NODE_ENV === "development" ? `Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering.` : `Err0`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return conf;
|
|
23
|
+
};
|
|
18
24
|
const getTokens = (prefixed) => prefixed ? conf.tokensParsed : conf.tokens;
|
|
19
25
|
const useTokens = getTokens;
|
|
20
26
|
const getThemes = () => conf.themes;
|
|
@@ -32,7 +38,6 @@ const updateConfig = (key, value) => {
|
|
|
32
38
|
export {
|
|
33
39
|
configListeners,
|
|
34
40
|
getConfig,
|
|
35
|
-
getHasConfigured,
|
|
36
41
|
getThemes,
|
|
37
42
|
getTokens,
|
|
38
43
|
onConfiguredOnce,
|
package/dist/esm/config.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/config.ts"],
|
|
4
|
-
"sourcesContent": ["import { ConfigListener, TamaguiInternalConfig, ThemeParsed, Tokens } from './types'\n\nlet conf: TamaguiInternalConfig | null\n\nexport const setConfig = (next: TamaguiInternalConfig) => {\n conf = next\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(next))\n }\n}\n\nexport const setConfigFont = (name: string, font: any, fontParsed: any) => {\n if (process.env.NODE_ENV === 'development') {\n if (!conf) throw new Error(`Haven't called createTamagui yet`)\n }\n Object.assign(conf!.fonts, { [name]: font })\n Object.assign(conf!.fontsParsed, { [`$${name}`]: fontParsed })\n}\n\nexport const
|
|
5
|
-
"mappings": "AAEA,IAAI;AAEG,MAAM,YAAY,CAAC,SAAgC;AACxD,SAAO;AACP,MAAI,gBAAgB,MAAM;AACxB,oBAAgB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;AAAA,EAC1C;AACF;AAEO,MAAM,gBAAgB,CAAC,MAAc,MAAW,eAAoB;AACzE,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC;AAAM,YAAM,IAAI,MAAM,kCAAkC;AAAA,EAC/D;AACA,SAAO,OAAO,KAAM,OAAO,EAAE,CAAC,OAAO,KAAK,CAAC;AAC3C,SAAO,OAAO,KAAM,aAAa,EAAE,CAAC,IAAI,SAAS,WAAW,CAAC;AAC/D;AAEO,MAAM,
|
|
4
|
+
"sourcesContent": ["import { ConfigListener, TamaguiInternalConfig, ThemeParsed, Tokens } from './types'\n\nlet conf: TamaguiInternalConfig | null\n\nexport const setConfig = (next: TamaguiInternalConfig) => {\n conf = next\n if (configListeners.size) {\n configListeners.forEach((cb) => cb(next))\n }\n}\n\nexport const setConfigFont = (name: string, font: any, fontParsed: any) => {\n if (process.env.NODE_ENV === 'development') {\n if (!conf) throw new Error(`Haven't called createTamagui yet`)\n }\n Object.assign(conf!.fonts, { [name]: font })\n Object.assign(conf!.fontsParsed, { [`$${name}`]: fontParsed })\n}\n\nexport const getConfig = () => {\n if (!conf) {\n throw new Error(\n process.env.NODE_ENV === 'development'\n ? `Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering.`\n : `Err0`\n )\n }\n return conf\n}\nexport const getTokens = (prefixed?: boolean): Tokens =>\n prefixed ? conf!.tokensParsed : conf!.tokens\n\n/**\n * Note: this is the same as `getTokens`\n */\nexport const useTokens = getTokens\n\nexport const getThemes = () => conf!.themes\n\nexport const configListeners = new Set<ConfigListener>()\n\nexport const onConfiguredOnce = (cb: ConfigListener) => {\n if (conf) {\n cb(conf)\n } else {\n configListeners.add(cb)\n }\n}\n\nexport const updateConfig = (key: string, value: any) => {\n Object.assign(key, value)\n}\n"],
|
|
5
|
+
"mappings": "AAEA,IAAI;AAEG,MAAM,YAAY,CAAC,SAAgC;AACxD,SAAO;AACP,MAAI,gBAAgB,MAAM;AACxB,oBAAgB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;AAAA,EAC1C;AACF;AAEO,MAAM,gBAAgB,CAAC,MAAc,MAAW,eAAoB;AACzE,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,CAAC;AAAM,YAAM,IAAI,MAAM,kCAAkC;AAAA,EAC/D;AACA,SAAO,OAAO,KAAM,OAAO,EAAE,CAAC,OAAO,KAAK,CAAC;AAC3C,SAAO,OAAO,KAAM,aAAa,EAAE,CAAC,IAAI,SAAS,WAAW,CAAC;AAC/D;AAEO,MAAM,YAAY,MAAM;AAC7B,MAAI,CAAC,MAAM;AACT,UAAM,IAAI;AAAA,MACR,QAAQ,IAAI,aAAa,gBACrB,wIACA;AAAA,IACN;AAAA,EACF;AACA,SAAO;AACT;AACO,MAAM,YAAY,CAAC,aACxB,WAAW,KAAM,eAAe,KAAM;AAKjC,MAAM,YAAY;AAElB,MAAM,YAAY,MAAM,KAAM;AAE9B,MAAM,kBAAkB,oBAAI,IAAoB;AAEhD,MAAM,mBAAmB,CAAC,OAAuB;AACtD,MAAI,MAAM;AACR,OAAG,IAAI;AAAA,EACT,OAAO;AACL,oBAAgB,IAAI,EAAE;AAAA,EACxB;AACF;AAEO,MAAM,eAAe,CAAC,KAAa,UAAe;AACvD,SAAO,OAAO,KAAK,KAAK;AAC1B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/contexts/ButtonNestingContext.tsx"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react'\n\nexport const ButtonNestingContext = createContext(false)\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAEvB,MAAM,uBAAuB,cAAc,KAAK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,13 +3,11 @@ import { useComposedRefs } from "@tamagui/compose-refs";
|
|
|
3
3
|
import { isClient, isRSC, isServer, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
4
4
|
import {
|
|
5
5
|
composeEventHandlers,
|
|
6
|
-
stylePropsTransform,
|
|
7
6
|
stylePropsView,
|
|
8
7
|
validPseudoKeys,
|
|
9
8
|
validStyles
|
|
10
9
|
} from "@tamagui/helpers";
|
|
11
10
|
import { useResponderEvents } from "@tamagui/react-native-use-responder-events";
|
|
12
|
-
import { useForceUpdate } from "@tamagui/use-force-update";
|
|
13
11
|
import React, {
|
|
14
12
|
Children,
|
|
15
13
|
Fragment,
|
|
@@ -26,20 +24,19 @@ import { stackDefaultStyles } from "./constants/constants";
|
|
|
26
24
|
import { FontLanguageContext } from "./contexts/FontLanguageContext";
|
|
27
25
|
import { TextAncestorContext } from "./contexts/TextAncestorContext";
|
|
28
26
|
import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
|
|
29
|
-
import {
|
|
27
|
+
import { getRect } from "./helpers/getRect";
|
|
28
|
+
import { useSplitStyles } from "./helpers/getSplitStyles";
|
|
30
29
|
import { getAllSelectors } from "./helpers/insertStyleRule";
|
|
31
30
|
import { mergeProps } from "./helpers/mergeProps";
|
|
32
|
-
import { mergeTransform } from "./helpers/mergeTransform";
|
|
33
31
|
import { proxyThemeVariables } from "./helpers/proxyThemeVariables";
|
|
34
32
|
import { useShallowSetState } from "./helpers/useShallowSetState";
|
|
35
|
-
import {
|
|
33
|
+
import { measureLayout, useElementLayout } from "./hooks/useElementLayout";
|
|
36
34
|
import { addMediaQueryListener, getInitialMediaState } from "./hooks/useMedia";
|
|
37
35
|
import { useServerRef, useServerState } from "./hooks/useServerHooks";
|
|
38
|
-
import { getThemeManager, useTheme } from "./hooks/useTheme";
|
|
36
|
+
import { getThemeIsNewTheme, getThemeManager, useTheme } from "./hooks/useTheme";
|
|
39
37
|
import { usePressability } from "./vendor/Pressability";
|
|
40
38
|
import { Slot, mergeEvent } from "./views/Slot";
|
|
41
39
|
import { wrapThemeManagerContext } from "./views/Theme";
|
|
42
|
-
React["keep"];
|
|
43
40
|
process.env.TAMAGUI_TARGET;
|
|
44
41
|
let defaultComponentState = null;
|
|
45
42
|
let defaultComponentStateMounted = null;
|
|
@@ -79,7 +76,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
79
76
|
}
|
|
80
77
|
})();
|
|
81
78
|
const defaultComponentClassName = `is_${staticConfig.componentName}`;
|
|
82
|
-
const avoidClassesWhileAnimating = true;
|
|
83
79
|
let defaultNativeStyle;
|
|
84
80
|
let tamaguiDefaultProps;
|
|
85
81
|
let defaultTag;
|
|
@@ -95,6 +91,9 @@ function createComponent(configIn, ParentComponent) {
|
|
|
95
91
|
const { Component, isText, isZStack } = staticConfig;
|
|
96
92
|
const componentName = props.componentName || staticConfig.componentName;
|
|
97
93
|
const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
|
|
94
|
+
const animationsConfig = tamaguiConfig.animations;
|
|
95
|
+
const useAnimations = animationsConfig == null ? void 0 : animationsConfig.useAnimations;
|
|
96
|
+
const avoidClassesWhileAnimating = animationsConfig.isReactNative;
|
|
98
97
|
const hasEnterStyle = !!props.enterStyle;
|
|
99
98
|
const needsMount = Boolean((isWeb ? isClient : true) && (hasEnterStyle || props.animation));
|
|
100
99
|
const states = useServerState(
|
|
@@ -103,15 +102,28 @@ function createComponent(configIn, ParentComponent) {
|
|
|
103
102
|
const state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: true } : states[0];
|
|
104
103
|
const setState = states[1];
|
|
105
104
|
const setStateShallow = useShallowSetState(setState, debugProp, componentName);
|
|
106
|
-
const
|
|
107
|
-
|
|
105
|
+
const stateRef = useRef(
|
|
106
|
+
void 0
|
|
107
|
+
);
|
|
108
|
+
stateRef.current ??= {};
|
|
108
109
|
const isAnimated = (() => {
|
|
109
110
|
const next = !!(useAnimations && props.animation);
|
|
110
|
-
if (next && !
|
|
111
|
-
|
|
111
|
+
if (next && !stateRef.current.hasAnimated) {
|
|
112
|
+
stateRef.current.hasAnimated = true;
|
|
112
113
|
}
|
|
113
|
-
return next ||
|
|
114
|
+
return next || stateRef.current.hasAnimated;
|
|
114
115
|
})();
|
|
116
|
+
const usePresence = (_a = tamaguiConfig.animations) == null ? void 0 : _a.usePresence;
|
|
117
|
+
const presence = !isRSC && isAnimated ? usePresence() : null;
|
|
118
|
+
if (isAnimated && presence) {
|
|
119
|
+
const presenceState = presence[2];
|
|
120
|
+
if (presenceState) {
|
|
121
|
+
if (presenceState.enterVariant)
|
|
122
|
+
props[presenceState.enterVariant] = true;
|
|
123
|
+
if (presenceState.exitVariant)
|
|
124
|
+
props[presenceState.exitVariant] = true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
115
127
|
const isReactNative = Boolean(
|
|
116
128
|
staticConfig.isReactNative || isAnimated && tamaguiConfig.animations.isReactNative
|
|
117
129
|
);
|
|
@@ -124,18 +136,22 @@ function createComponent(configIn, ParentComponent) {
|
|
|
124
136
|
console.group(`%c ${banner}`, "background: yellow;");
|
|
125
137
|
if (!isServer) {
|
|
126
138
|
console.log(`state`, state);
|
|
127
|
-
console.groupCollapsed("props");
|
|
128
|
-
console.log(props);
|
|
129
|
-
console.log("order", Object.keys(props));
|
|
130
|
-
console.groupEnd();
|
|
131
139
|
}
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
142
|
const shouldAvoidClasses = !isWeb || !!(props.animation && avoidClassesWhileAnimating) || !staticConfig.acceptsClassName;
|
|
135
143
|
const shouldForcePseudo = !!propsIn.forceStyle;
|
|
136
144
|
const noClassNames = shouldAvoidClasses || shouldForcePseudo;
|
|
137
|
-
const
|
|
138
|
-
|
|
145
|
+
const theme = useTheme({
|
|
146
|
+
name: props.theme,
|
|
147
|
+
componentName,
|
|
148
|
+
reset: props.reset,
|
|
149
|
+
inverse: props.themeInverse,
|
|
150
|
+
disable: props["data-themeable"],
|
|
151
|
+
debug: props.debug
|
|
152
|
+
});
|
|
153
|
+
const themeManager = getThemeManager(theme);
|
|
154
|
+
const themeIsNew = getThemeIsNewTheme(theme);
|
|
139
155
|
const shouldSetMounted = needsMount && state.unmounted;
|
|
140
156
|
const setMounted = shouldSetMounted ? () => {
|
|
141
157
|
setTimeout(
|
|
@@ -157,6 +173,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
157
173
|
let elementType = isText ? (isAnimated ? AnimatedText : null) || BaseTextComponent : (isAnimated ? AnimatedView : null) || BaseViewComponent;
|
|
158
174
|
elementType = Component || elementType;
|
|
159
175
|
const isStringElement = typeof elementType === "string";
|
|
176
|
+
const isExiting = (presence == null ? void 0 : presence[0]) === false;
|
|
160
177
|
const splitStyles = useSplitStyles(
|
|
161
178
|
props,
|
|
162
179
|
staticConfig,
|
|
@@ -166,7 +183,8 @@ function createComponent(configIn, ParentComponent) {
|
|
|
166
183
|
noClassNames,
|
|
167
184
|
dynamicStylesInline: noClassNames,
|
|
168
185
|
hasTextAncestor,
|
|
169
|
-
resolveVariablesAs: "value"
|
|
186
|
+
resolveVariablesAs: "value",
|
|
187
|
+
isExiting
|
|
170
188
|
},
|
|
171
189
|
null,
|
|
172
190
|
languageContext || void 0,
|
|
@@ -204,41 +222,15 @@ function createComponent(configIn, ParentComponent) {
|
|
|
204
222
|
const propsWithAnimation = props;
|
|
205
223
|
let animationStyles;
|
|
206
224
|
if (!isRSC && isAnimated && useAnimations) {
|
|
207
|
-
const animations = useAnimations(
|
|
225
|
+
const animations = useAnimations({
|
|
226
|
+
props: propsWithAnimation,
|
|
227
|
+
style: splitStylesStyle,
|
|
228
|
+
presence,
|
|
208
229
|
state,
|
|
209
230
|
pseudos,
|
|
210
231
|
onDidAnimate: props.onDidAnimate,
|
|
211
232
|
hostRef,
|
|
212
|
-
staticConfig
|
|
213
|
-
getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {
|
|
214
|
-
var _a2, _b2, _c2, _d2;
|
|
215
|
-
const animationStyle = { ...defaultNativeStyle, ...splitStylesStyle };
|
|
216
|
-
const enterStyle = isEntering ? enterVariant && ((_a2 = staticConfig.variants) == null ? void 0 : _a2[enterVariant]["true"]) ? getSubStyle(
|
|
217
|
-
"",
|
|
218
|
-
(_b2 = staticConfig.variants) == null ? void 0 : _b2[enterVariant]["true"],
|
|
219
|
-
staticConfig,
|
|
220
|
-
theme,
|
|
221
|
-
props,
|
|
222
|
-
state,
|
|
223
|
-
tamaguiConfig
|
|
224
|
-
) : null : null;
|
|
225
|
-
const exitStyle = isExiting ? exitVariant && ((_c2 = staticConfig.variants) == null ? void 0 : _c2[exitVariant]["true"]) ? getSubStyle(
|
|
226
|
-
"",
|
|
227
|
-
(_d2 = staticConfig.variants) == null ? void 0 : _d2[exitVariant]["true"],
|
|
228
|
-
staticConfig,
|
|
229
|
-
theme,
|
|
230
|
-
props,
|
|
231
|
-
state,
|
|
232
|
-
tamaguiConfig
|
|
233
|
-
) : pseudos.exitStyle : null;
|
|
234
|
-
if (isEntering && enterStyle) {
|
|
235
|
-
merge(animationStyle, enterStyle);
|
|
236
|
-
}
|
|
237
|
-
if (isExiting && exitStyle) {
|
|
238
|
-
merge(animationStyle, exitStyle);
|
|
239
|
-
}
|
|
240
|
-
return animationStyle;
|
|
241
|
-
}
|
|
233
|
+
staticConfig
|
|
242
234
|
});
|
|
243
235
|
if (animations) {
|
|
244
236
|
animationStyles = animations.style;
|
|
@@ -423,7 +415,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
423
415
|
const classList = [
|
|
424
416
|
componentName ? componentClassName : "",
|
|
425
417
|
fontFamilyClassName,
|
|
426
|
-
theme.className,
|
|
418
|
+
themeIsNew ? theme.className : "",
|
|
427
419
|
classNames ? Object.values(classNames).join(" ") : ""
|
|
428
420
|
];
|
|
429
421
|
const className = classList.join(" ");
|
|
@@ -556,16 +548,19 @@ function createComponent(configIn, ParentComponent) {
|
|
|
556
548
|
let space = spaceProp;
|
|
557
549
|
if (state.mediaState && mediaKeys.length) {
|
|
558
550
|
for (const key in state.mediaState) {
|
|
559
|
-
if (state.mediaState
|
|
551
|
+
if (key in state.mediaState && key in props && props[key].space !== void 0) {
|
|
560
552
|
space = props[key].space;
|
|
561
553
|
}
|
|
562
554
|
}
|
|
563
555
|
}
|
|
564
|
-
const
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
556
|
+
const themeShouldReset = Boolean(themeShallow && themeManager && themeIsNew);
|
|
557
|
+
const shouldProvideThemeManager = themeShouldReset || themeManager && themeIsNew;
|
|
558
|
+
if (shouldProvideThemeManager) {
|
|
559
|
+
stateRef.current.hasProvidedThemeManager = true;
|
|
560
|
+
}
|
|
561
|
+
if (themeShouldReset) {
|
|
562
|
+
stateRef.current.themeShouldReset = true;
|
|
563
|
+
}
|
|
569
564
|
const childEls = !children || asChild ? children : wrapThemeManagerContext(
|
|
570
565
|
spacedChildren({
|
|
571
566
|
separator,
|
|
@@ -574,8 +569,8 @@ function createComponent(configIn, ParentComponent) {
|
|
|
574
569
|
direction: props.spaceDirection || "both",
|
|
575
570
|
isZStack
|
|
576
571
|
}),
|
|
577
|
-
|
|
578
|
-
|
|
572
|
+
stateRef.current.hasProvidedThemeManager ? themeManager : void 0,
|
|
573
|
+
stateRef.current.themeShouldReset
|
|
579
574
|
);
|
|
580
575
|
let content;
|
|
581
576
|
if (asChild) {
|
|
@@ -905,16 +900,6 @@ function mergeConfigDefaultProps(name, props, configDefaults, parentNames, conf)
|
|
|
905
900
|
}
|
|
906
901
|
return props;
|
|
907
902
|
}
|
|
908
|
-
function merge(base, next) {
|
|
909
|
-
for (const key in next) {
|
|
910
|
-
const val = next[key];
|
|
911
|
-
if (key in stylePropsTransform) {
|
|
912
|
-
mergeTransform(base, key, val, true);
|
|
913
|
-
} else {
|
|
914
|
-
base[key] = val;
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
903
|
function usePlatformMethods(hostRef) {
|
|
919
904
|
useIsomorphicLayoutEffect(() => {
|
|
920
905
|
const node = hostRef.current;
|
|
@@ -951,6 +936,16 @@ const dontComposePressabilityKeys = {
|
|
|
951
936
|
function getMediaStateObject(obj) {
|
|
952
937
|
return Object.fromEntries(Object.entries(obj).flatMap(([k, v]) => v ? [[`$${k}`, v]] : []));
|
|
953
938
|
}
|
|
939
|
+
const baseDefaults = {
|
|
940
|
+
opacity: 1
|
|
941
|
+
};
|
|
942
|
+
const transformDefaults = {
|
|
943
|
+
opacity: 1,
|
|
944
|
+
scale: 1,
|
|
945
|
+
rotate: "0deg",
|
|
946
|
+
rotateY: "0deg",
|
|
947
|
+
rotateX: "0deg"
|
|
948
|
+
};
|
|
954
949
|
export {
|
|
955
950
|
Spacer,
|
|
956
951
|
Unspaced,
|