@tamagui/core 1.0.1-beta.192 → 1.0.1-beta.194
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 +4 -2
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/config.js +1 -2
- package/dist/cjs/config.js.map +2 -2
- package/dist/cjs/constants/constants.js +13 -8
- package/dist/cjs/constants/constants.js.map +2 -2
- package/dist/cjs/contexts/TextAncestorContext.js +3 -16
- package/dist/cjs/contexts/TextAncestorContext.js.map +3 -3
- package/dist/cjs/createComponent.js +196 -284
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createTamagui.js +15 -16
- package/dist/cjs/createTamagui.js.map +3 -3
- package/dist/cjs/createVariable.js +1 -2
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +7 -14
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/{createShallowUpdate.js → cache.js} +20 -21
- package/dist/cjs/helpers/cache.js.map +7 -0
- package/dist/cjs/helpers/createMediaStyle.js +14 -8
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/extendStaticConfig.js +0 -1
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +214 -94
- package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
- package/dist/cjs/helpers/getStylesAtomic.js +16 -36
- package/dist/cjs/helpers/getStylesAtomic.js.map +3 -3
- package/dist/cjs/helpers/getVariantExtras.js +2 -1
- package/dist/cjs/helpers/getVariantExtras.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +14 -6
- package/dist/cjs/helpers/insertStyleRule.js.map +2 -2
- package/dist/cjs/helpers/matchMedia.js.map +2 -2
- package/dist/cjs/helpers/mergeTransform.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.js +32 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/cjs/helpers/proxyThemeVariables.js +2 -7
- package/dist/cjs/helpers/proxyThemeVariables.js.map +2 -2
- package/dist/cjs/helpers/useShallowSetState.js.map +2 -2
- package/dist/cjs/hooks/getThemeUnwrapped.js +1 -3
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/cjs/hooks/useElementLayout.js +92 -0
- package/dist/cjs/hooks/useElementLayout.js.map +7 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +2 -10
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +79 -85
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/useMedia.test.js +2 -0
- package/dist/cjs/{helpers/validate.js.map → hooks/useMedia.test.js.map} +0 -0
- package/dist/cjs/hooks/usePressablePressResponder.js +370 -0
- package/dist/cjs/hooks/usePressablePressResponder.js.map +7 -0
- package/dist/cjs/hooks/useSafeRef.js +13 -15
- package/dist/cjs/hooks/useSafeRef.js.map +2 -2
- package/dist/cjs/hooks/useTheme.js +5 -5
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/index.js +1 -17
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/static.js +0 -20
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/styled.js +4 -22
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/{hooks/useIsSSR.js → views/AbsoluteFill.js} +18 -23
- package/dist/cjs/views/AbsoluteFill.js.map +7 -0
- package/dist/cjs/views/AbsoluteFill.native.js +45 -0
- package/dist/cjs/views/AbsoluteFill.native.js.map +7 -0
- package/dist/cjs/views/FontLanguage.native.js.map +2 -2
- package/dist/cjs/views/Stack.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +3 -2
- package/dist/cjs/views/TamaguiProvider.js.map +2 -2
- package/dist/cjs/views/Text.js.map +1 -1
- package/dist/cjs/views/ThemeReset.js +10 -10
- package/dist/cjs/views/ThemeReset.js.map +2 -2
- package/dist/esm/Tamagui.js +4 -2
- package/dist/esm/Tamagui.js.map +2 -2
- package/dist/esm/config.js +1 -2
- package/dist/esm/config.js.map +2 -2
- package/dist/esm/constants/constants.js +11 -7
- package/dist/esm/constants/constants.js.map +2 -2
- package/dist/esm/contexts/TextAncestorContext.js +2 -13
- package/dist/esm/contexts/TextAncestorContext.js.map +2 -2
- package/dist/esm/createComponent.js +195 -286
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createTamagui.js +15 -16
- package/dist/esm/createTamagui.js.map +3 -3
- package/dist/esm/createVariable.js +1 -2
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +7 -14
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/cache.js +18 -0
- package/dist/esm/helpers/cache.js.map +7 -0
- package/dist/esm/helpers/createMediaStyle.js +14 -8
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +0 -1
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +223 -95
- package/dist/esm/helpers/getSplitStyles.js.map +3 -3
- package/dist/esm/helpers/getStylesAtomic.js +13 -26
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getVariantExtras.js +2 -1
- package/dist/esm/helpers/getVariantExtras.js.map +2 -2
- package/dist/esm/helpers/insertStyleRule.js +14 -6
- package/dist/esm/helpers/insertStyleRule.js.map +2 -2
- package/dist/esm/helpers/matchMedia.js.map +2 -2
- package/dist/esm/helpers/mergeTransform.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js +30 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/esm/helpers/proxyThemeVariables.js +2 -7
- package/dist/esm/helpers/proxyThemeVariables.js.map +2 -2
- package/dist/esm/helpers/useShallowSetState.js.map +2 -2
- package/dist/esm/hooks/getThemeUnwrapped.js +1 -3
- package/dist/esm/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/esm/hooks/useElementLayout.js +66 -0
- package/dist/esm/hooks/useElementLayout.js.map +7 -0
- package/dist/esm/hooks/useIsTouchDevice.js +3 -11
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +76 -84
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/useMedia.test.js +1 -0
- package/dist/esm/{helpers/validate.js.map → hooks/useMedia.test.js.map} +0 -0
- package/dist/esm/hooks/usePressablePressResponder.js +346 -0
- package/dist/esm/hooks/usePressablePressResponder.js.map +7 -0
- package/dist/esm/hooks/useSafeRef.js +13 -15
- package/dist/esm/hooks/useSafeRef.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +5 -5
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/index.js +1 -14
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/static.js +0 -14
- package/dist/esm/static.js.map +2 -2
- package/dist/esm/styled.js +4 -22
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/views/AbsoluteFill.js +17 -0
- package/dist/esm/views/AbsoluteFill.js.map +7 -0
- package/dist/esm/views/AbsoluteFill.native.js +21 -0
- package/dist/esm/views/AbsoluteFill.native.js.map +7 -0
- package/dist/esm/views/FontLanguage.native.js.map +2 -2
- package/dist/esm/views/Stack.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.js +5 -4
- package/dist/esm/views/TamaguiProvider.js.map +2 -2
- package/dist/esm/views/Text.js.map +1 -1
- package/dist/esm/views/ThemeReset.js +10 -10
- package/dist/esm/views/ThemeReset.js.map +2 -2
- package/package.json +14 -14
- package/src/Tamagui.ts +7 -3
- package/src/config.ts +2 -3
- package/src/constants/constants.ts +10 -6
- package/src/contexts/TextAncestorContext.tsx +1 -8
- package/src/createComponent.tsx +250 -412
- package/src/createTamagui.ts +16 -19
- package/src/createVariable.ts +1 -3
- package/src/helpers/ThemeManager.tsx +7 -15
- package/src/helpers/cache.ts +18 -0
- package/src/helpers/createMediaStyle.ts +16 -9
- package/src/helpers/createProxy.ts +16 -0
- package/src/helpers/extendStaticConfig.ts +0 -1
- package/src/helpers/getSplitStyles.tsx +259 -152
- package/src/helpers/getStylesAtomic.ts +14 -34
- package/src/helpers/getVariantExtras.tsx +2 -1
- package/src/helpers/insertStyleRule.tsx +16 -8
- package/src/helpers/matchMedia.ts +1 -0
- package/src/helpers/mergeTransform.ts +1 -1
- package/src/helpers/normalizeValueWithProperty.ts +30 -0
- package/src/helpers/proxyThemeVariables.tsx +3 -8
- package/src/helpers/useShallowSetState.tsx +0 -1
- package/src/hooks/getThemeUnwrapped.tsx +1 -2
- package/src/hooks/useElementLayout.tsx +90 -0
- package/src/hooks/useIsTouchDevice.tsx +3 -17
- package/src/hooks/useMedia.tsx +82 -88
- package/src/hooks/useSafeRef.ts +17 -18
- package/src/hooks/useTheme.tsx +6 -5
- package/src/index.ts +1 -11
- package/src/static.ts +0 -10
- package/src/styled.tsx +15 -33
- package/src/types.tsx +58 -55
- package/src/views/FontLanguage.native.tsx +1 -0
- package/src/views/Stack.tsx +1 -1
- package/src/views/TamaguiProvider.tsx +5 -5
- package/src/views/Text.tsx +1 -1
- package/src/views/ThemeReset.tsx +11 -11
- package/types/Tamagui.d.ts +6 -4
- package/types/constants/constants.d.ts +14 -3
- package/types/contexts/TextAncestorContext.d.ts +1 -3
- package/types/createComponent.d.ts +0 -15
- package/types/helpers/ThemeManager.d.ts +2 -3
- package/types/helpers/cache.d.ts +12 -0
- package/types/helpers/calc.d.ts +0 -16
- package/types/helpers/createMediaStyle.d.ts +1 -1
- package/types/helpers/createProxy.d.ts +2 -0
- package/types/helpers/getSplitStyles.d.ts +6 -10
- package/types/helpers/getStylesAtomic.d.ts +1 -5
- package/types/helpers/insertStyleRule.d.ts +2 -2
- package/types/helpers/mergeTransform.d.ts +1 -1
- package/types/helpers/normalizeValueWithProperty.d.ts +1 -0
- package/types/hooks/useElementLayout.d.ts +27 -0
- package/types/hooks/useMedia.d.ts +3 -1
- package/types/hooks/useMedia.test.d.ts +1 -0
- package/types/hooks/usePressablePressResponder.d.ts +84 -0
- package/types/index.d.ts +1 -11
- package/types/static.d.ts +0 -1
- package/types/types.d.ts +42 -44
- package/types/views/AbsoluteFill.d.ts +5 -0
- package/types/views/AbsoluteFill.native.d.ts +3 -0
- package/types/views/Stack.d.ts +1 -1
- package/types/views/Text.d.ts +1 -1
- 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/createShallowUpdate.js.map +0 -7
- package/dist/cjs/helpers/validate.js +0 -2
- package/dist/cjs/hooks/useDidFinishSSR.js +0 -60
- package/dist/cjs/hooks/useDidFinishSSR.js.map +0 -7
- package/dist/cjs/hooks/useIsSSR.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/createShallowUpdate.js +0 -20
- package/dist/esm/helpers/createShallowUpdate.js.map +0 -7
- package/dist/esm/helpers/validate.js +0 -1
- package/dist/esm/hooks/useDidFinishSSR.js +0 -35
- package/dist/esm/hooks/useDidFinishSSR.js.map +0 -7
- package/dist/esm/hooks/useIsSSR.js +0 -22
- package/dist/esm/hooks/useIsSSR.js.map +0 -7
- package/src/helpers/assignNativePropsToWeb.tsx +0 -178
- package/src/helpers/calc.ts +0 -68
- package/src/helpers/getFont.tsx +0 -43
- package/src/helpers/getStackSize.ts +0 -22
- package/src/helpers/startTransition.ts +0 -4
- package/src/hooks/useConstant.tsx +0 -19
- package/src/hooks/useIsMounted.ts +0 -16
- package/src/hooks/usePressable.tsx +0 -9
- package/src/hooks/useUnmountEffect.ts +0 -5
|
@@ -26,34 +26,30 @@ var createComponent_exports = {};
|
|
|
26
26
|
__export(createComponent_exports, {
|
|
27
27
|
Spacer: () => Spacer,
|
|
28
28
|
Unspaced: () => Unspaced,
|
|
29
|
-
accessibilityRoleToWebRole: () => accessibilityRoleToWebRole,
|
|
30
29
|
createComponent: () => createComponent,
|
|
31
30
|
mouseUps: () => mouseUps,
|
|
32
|
-
processIDRefList: () => processIDRefList,
|
|
33
31
|
spacedChildren: () => spacedChildren
|
|
34
32
|
});
|
|
35
33
|
module.exports = __toCommonJS(createComponent_exports);
|
|
36
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_compose_refs = require("@tamagui/compose-refs");
|
|
37
36
|
var import_constants = require("@tamagui/constants");
|
|
38
37
|
var import_helpers = require("@tamagui/helpers");
|
|
39
|
-
var
|
|
38
|
+
var import_react_native_use_responder_events = require("@tamagui/react-native-use-responder-events");
|
|
40
39
|
var import_use_force_update = require("@tamagui/use-force-update");
|
|
41
40
|
var import_react = __toESM(require("react"));
|
|
42
|
-
var import_react_native = require("react-native");
|
|
43
41
|
var import_config = require("./config");
|
|
44
42
|
var import_constants2 = require("./constants/constants");
|
|
45
43
|
var import_FontLanguageContext = require("./contexts/FontLanguageContext");
|
|
46
44
|
var import_TextAncestorContext = require("./contexts/TextAncestorContext");
|
|
47
|
-
var import_assignNativePropsToWeb = require("./helpers/assignNativePropsToWeb");
|
|
48
|
-
var import_createPropMapper = require("./helpers/createPropMapper");
|
|
49
45
|
var import_extendStaticConfig = require("./helpers/extendStaticConfig");
|
|
50
46
|
var import_getSplitStyles = require("./helpers/getSplitStyles");
|
|
51
47
|
var import_insertStyleRule = require("./helpers/insertStyleRule");
|
|
52
48
|
var import_mergeProps = require("./helpers/mergeProps");
|
|
53
49
|
var import_proxyThemeVariables = require("./helpers/proxyThemeVariables");
|
|
54
50
|
var import_useShallowSetState = require("./helpers/useShallowSetState");
|
|
51
|
+
var import_useElementLayout = require("./hooks/useElementLayout");
|
|
55
52
|
var import_useMedia = require("./hooks/useMedia");
|
|
56
|
-
var import_usePressable = require("./hooks/usePressable");
|
|
57
53
|
var import_useServerHooks = require("./hooks/useServerHooks");
|
|
58
54
|
var import_useTheme = require("./hooks/useTheme");
|
|
59
55
|
var import_Pressability = require("./vendor/Pressability");
|
|
@@ -61,6 +57,11 @@ var import_Slot = require("./views/Slot");
|
|
|
61
57
|
var import_Theme = require("./views/Theme");
|
|
62
58
|
import_react.default["keep"];
|
|
63
59
|
let defaultComponentState = null;
|
|
60
|
+
let defaultComponentStateMounted = null;
|
|
61
|
+
let tamaguiConfig;
|
|
62
|
+
let AnimatedText;
|
|
63
|
+
let AnimatedView;
|
|
64
|
+
let initialTheme;
|
|
64
65
|
const mouseUps = /* @__PURE__ */ new Set();
|
|
65
66
|
if (typeof document !== "undefined") {
|
|
66
67
|
const cancelTouches = () => {
|
|
@@ -76,8 +77,13 @@ function mergeShorthands({ defaultProps }, { shorthands }) {
|
|
|
76
77
|
defaultProps[shorthands[key] || key] = defaultProps[key];
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
let
|
|
80
|
-
let
|
|
80
|
+
let BaseText;
|
|
81
|
+
let BaseView;
|
|
82
|
+
if (process.env.TAMAGUI_TARGET === "native") {
|
|
83
|
+
const native = require("react-native");
|
|
84
|
+
BaseText = native.Text || native.default.Text;
|
|
85
|
+
BaseView = native.View || native.default.View;
|
|
86
|
+
}
|
|
81
87
|
function createComponent(configIn, ParentComponent) {
|
|
82
88
|
const staticConfig = (() => {
|
|
83
89
|
const next = (0, import_extendStaticConfig.extendStaticConfig)(configIn, ParentComponent);
|
|
@@ -88,10 +94,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
88
94
|
}
|
|
89
95
|
})();
|
|
90
96
|
const defaultComponentClassName = `is_${staticConfig.componentName}`;
|
|
91
|
-
|
|
92
|
-
let AnimatedText;
|
|
93
|
-
let AnimatedView;
|
|
94
|
-
let avoidClassesWhileAnimating = true;
|
|
97
|
+
const avoidClassesWhileAnimating = true;
|
|
95
98
|
let defaultNativeStyle;
|
|
96
99
|
let tamaguiDefaultProps;
|
|
97
100
|
let initialSplitStyles;
|
|
@@ -108,10 +111,26 @@ function createComponent(configIn, ParentComponent) {
|
|
|
108
111
|
const componentName = props.componentName || staticConfig.componentName;
|
|
109
112
|
const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
|
|
110
113
|
const forceUpdate = (0, import_use_force_update.useForceUpdate)();
|
|
111
|
-
config = config || (0, import_config.getConfig)();
|
|
112
114
|
const theme = (0, import_useTheme.useTheme)(props.theme, componentName, props, forceUpdate);
|
|
113
|
-
const
|
|
115
|
+
const hasEnterStyle = !!props.enterStyle;
|
|
116
|
+
const needsMount = Boolean((import_constants.isWeb ? import_constants.isClient : true) && (hasEnterStyle || props.animation));
|
|
117
|
+
const states = (0, import_useServerHooks.useServerState)(
|
|
118
|
+
needsMount ? defaultComponentState : defaultComponentStateMounted
|
|
119
|
+
);
|
|
114
120
|
const state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: true } : states[0];
|
|
121
|
+
const setState = states[1];
|
|
122
|
+
const setStateShallow = (0, import_useShallowSetState.useShallowSetState)(setState);
|
|
123
|
+
const shouldSetMounted = needsMount && !state.mounted;
|
|
124
|
+
const setMounted = shouldSetMounted ? () => {
|
|
125
|
+
setTimeout(
|
|
126
|
+
() => {
|
|
127
|
+
setStateShallow({
|
|
128
|
+
mounted: true
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
import_constants.isWeb ? 10 : 0
|
|
132
|
+
);
|
|
133
|
+
} : void 0;
|
|
115
134
|
const shouldAvoidClasses = !!(props.animation && avoidClassesWhileAnimating) || !staticConfig.acceptsClassName;
|
|
116
135
|
const shouldForcePseudo = !!propsIn.forceStyle;
|
|
117
136
|
const hasTextAncestor = !!(import_constants.isWeb && isText ? (0, import_react.useContext)(import_TextAncestorContext.TextAncestorContext) : false);
|
|
@@ -127,25 +146,41 @@ function createComponent(configIn, ParentComponent) {
|
|
|
127
146
|
resolveVariablesAs: "value"
|
|
128
147
|
};
|
|
129
148
|
const languageContext = import_constants.isRSC ? null : (0, import_react.useContext)(import_FontLanguageContext.FontLanguageContext);
|
|
149
|
+
const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
150
|
+
const nextIsAnimated = !!(useAnimations && props.animation);
|
|
151
|
+
const isAnimated = nextIsAnimated || state.hasAnimation;
|
|
152
|
+
if (nextIsAnimated && !state.hasAnimation) {
|
|
153
|
+
setStateShallow({ hasAnimation: true });
|
|
154
|
+
}
|
|
155
|
+
const isTaggable = !Component || typeof Component === "string";
|
|
156
|
+
const element = import_constants.isWeb ? isTaggable ? props.tag || Component : Component : Component;
|
|
157
|
+
const BaseTextComponent = BaseText || element || "span";
|
|
158
|
+
const BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div");
|
|
159
|
+
let elementType = isText ? (isAnimated ? AnimatedText : null) || BaseTextComponent : (isAnimated ? AnimatedView : null) || BaseViewComponent;
|
|
160
|
+
elementType = Component || elementType;
|
|
161
|
+
const isStringElement = typeof elementType === "string";
|
|
130
162
|
const splitStyles = (0, import_getSplitStyles.useSplitStyles)(
|
|
131
163
|
props,
|
|
132
164
|
staticConfig,
|
|
133
165
|
theme,
|
|
134
166
|
splitStyleState,
|
|
135
|
-
props.asChild ? null : initialSplitStyles
|
|
167
|
+
props.asChild ? null : initialSplitStyles,
|
|
136
168
|
languageContext || void 0,
|
|
169
|
+
elementType,
|
|
137
170
|
debugProp
|
|
138
171
|
);
|
|
139
172
|
const hostRef = (0, import_useServerHooks.useServerRef)(null);
|
|
140
|
-
const
|
|
141
|
-
|
|
173
|
+
const isReactNativeWeb = Boolean(
|
|
174
|
+
staticConfig.isReactNativeWeb || isAnimated && tamaguiConfig.animations.isReactNativeWeb
|
|
175
|
+
);
|
|
176
|
+
const isAnimatedReactNativeWeb = isAnimated && avoidClassesWhileAnimating;
|
|
142
177
|
if (process.env.NODE_ENV === "development") {
|
|
143
178
|
if (!process.env.TAMAGUI_TARGET) {
|
|
144
179
|
console.error(`No process.env.TAMAGUI_TARGET set, please set it to "native" or "web".`);
|
|
145
180
|
}
|
|
146
181
|
if (debugProp) {
|
|
147
182
|
const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
|
|
148
|
-
const type =
|
|
183
|
+
const type = isReactNativeWeb ? "rnw" : "tamagui";
|
|
149
184
|
const banner = `${name} ${propsIn["data-is"] || ""} ${type}`;
|
|
150
185
|
console.group(`%c \u{1F41B} ${banner}`, "background: yellow;");
|
|
151
186
|
console.groupCollapsed("initial props/state");
|
|
@@ -169,42 +204,11 @@ function createComponent(configIn, ParentComponent) {
|
|
|
169
204
|
classNames,
|
|
170
205
|
mediaKeys
|
|
171
206
|
} = splitStyles;
|
|
172
|
-
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
173
|
-
if (!mediaKeys.length) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
const disposers = [];
|
|
177
|
-
for (const key of mediaKeys) {
|
|
178
|
-
disposers.push(
|
|
179
|
-
(0, import_useMedia.addMediaQueryListener)(key, (next) => {
|
|
180
|
-
setState((prev) => {
|
|
181
|
-
if (prev.mediaState[key] !== next) {
|
|
182
|
-
return {
|
|
183
|
-
...prev,
|
|
184
|
-
mediaState: {
|
|
185
|
-
...prev.mediaState,
|
|
186
|
-
[key]: next
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
return prev;
|
|
191
|
-
});
|
|
192
|
-
})
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
return () => {
|
|
196
|
-
};
|
|
197
|
-
}, [mediaKeys.join(",")]);
|
|
198
|
-
const useAnimations = (_a = tamaguiConfig == null ? void 0 : tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
199
|
-
const nextIsAnimated = !!(useAnimations && props.animation);
|
|
200
|
-
const isAnimated = nextIsAnimated || state.hasAnimation;
|
|
201
|
-
if (nextIsAnimated && !state.hasAnimation) {
|
|
202
|
-
setStateShallow({ hasAnimation: true });
|
|
203
|
-
}
|
|
204
207
|
const animationFeatureStylesIn = props.animation ? { ...defaultNativeStyle, ...splitStylesStyle } : null;
|
|
205
208
|
const propsWithAnimation = props;
|
|
209
|
+
let animationStyles;
|
|
206
210
|
if (!import_constants.isRSC && isAnimated && useAnimations) {
|
|
207
|
-
const
|
|
211
|
+
const animations = useAnimations(propsWithAnimation, {
|
|
208
212
|
state,
|
|
209
213
|
pseudos,
|
|
210
214
|
onDidAnimate: props.onDidAnimate,
|
|
@@ -235,7 +239,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
235
239
|
style,
|
|
236
240
|
pseudos.hoverStyle,
|
|
237
241
|
pseudos.focusStyle,
|
|
238
|
-
pseudos.pressStyle,
|
|
239
242
|
pseudos.pressStyle
|
|
240
243
|
);
|
|
241
244
|
enterStyle && isEntering && merge(style, enterStyle);
|
|
@@ -244,21 +247,46 @@ function createComponent(configIn, ParentComponent) {
|
|
|
244
247
|
state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle);
|
|
245
248
|
exitStyle && isExiting && merge(style, exitStyle);
|
|
246
249
|
if (process.env.NODE_ENV === "development") {
|
|
247
|
-
if (debugProp) {
|
|
250
|
+
if (debugProp === "verbose") {
|
|
248
251
|
console.log("animation style", style);
|
|
249
252
|
}
|
|
250
253
|
}
|
|
251
254
|
return style;
|
|
252
255
|
}
|
|
253
256
|
});
|
|
254
|
-
if (
|
|
255
|
-
|
|
256
|
-
animation: animationState
|
|
257
|
-
});
|
|
257
|
+
if (animations) {
|
|
258
|
+
animationStyles = animations.style;
|
|
258
259
|
}
|
|
259
260
|
}
|
|
261
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
262
|
+
if (!mediaKeys.length)
|
|
263
|
+
return;
|
|
264
|
+
const disposers = [];
|
|
265
|
+
for (const key of mediaKeys) {
|
|
266
|
+
disposers.push(
|
|
267
|
+
(0, import_useMedia.addMediaQueryListener)(key, (next) => {
|
|
268
|
+
setState((prev) => {
|
|
269
|
+
if (prev.mediaState[key] !== next) {
|
|
270
|
+
return {
|
|
271
|
+
...prev,
|
|
272
|
+
mediaState: {
|
|
273
|
+
...prev.mediaState,
|
|
274
|
+
[key]: next
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
return prev;
|
|
279
|
+
});
|
|
280
|
+
})
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
return () => {
|
|
284
|
+
for (const disposer of disposers) {
|
|
285
|
+
disposer();
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}, [mediaKeys.join(",")]);
|
|
260
289
|
const {
|
|
261
|
-
tag,
|
|
262
290
|
hitSlop,
|
|
263
291
|
asChild,
|
|
264
292
|
children,
|
|
@@ -283,30 +311,9 @@ function createComponent(configIn, ParentComponent) {
|
|
|
283
311
|
defaultVariants,
|
|
284
312
|
...nonTamaguiProps
|
|
285
313
|
} = viewPropsIn;
|
|
286
|
-
const isTaggable = !Component || typeof Component === "string";
|
|
287
|
-
const element = import_constants.isWeb ? isTaggable ? tag || Component : Component : Component;
|
|
288
|
-
const BaseTextComponent = !import_constants.isWeb ? import_react_native.Text : element || "span";
|
|
289
|
-
const BaseViewComponent = !import_constants.isWeb ? import_react_native.View : element || (hasTextAncestor ? "span" : "div");
|
|
290
|
-
let elementType = isText ? (isAnimated ? AnimatedText || import_react_native.Text : null) || BaseTextComponent : (isAnimated ? AnimatedView || import_react_native.View : null) || BaseViewComponent;
|
|
291
|
-
elementType = Component || elementType;
|
|
292
|
-
const isStringElement = typeof elementType === "string";
|
|
293
314
|
const disabled = props.accessibilityState != null && props.accessibilityState.disabled === true || props.accessibilityDisabled;
|
|
294
315
|
let viewProps;
|
|
295
|
-
|
|
296
|
-
const shouldSetMounted = Boolean(
|
|
297
|
-
(import_constants.isWeb ? import_constants.isClient : true) && (hasEnterStyle || props.animation) && !state.mounted
|
|
298
|
-
);
|
|
299
|
-
const setMounted = shouldSetMounted ? () => {
|
|
300
|
-
setTimeout(
|
|
301
|
-
() => {
|
|
302
|
-
setStateShallow({
|
|
303
|
-
mounted: true
|
|
304
|
-
});
|
|
305
|
-
},
|
|
306
|
-
import_constants.isWeb ? 10 : 0
|
|
307
|
-
);
|
|
308
|
-
} : void 0;
|
|
309
|
-
if (process.env.TAMAGUI_TARGET === "web" && !staticConfig.isReactNativeWeb) {
|
|
316
|
+
if (process.env.TAMAGUI_TARGET === "web" && !isReactNativeWeb) {
|
|
310
317
|
const {
|
|
311
318
|
onMoveShouldSetResponder,
|
|
312
319
|
onMoveShouldSetResponderCapture,
|
|
@@ -324,66 +331,18 @@ function createComponent(configIn, ParentComponent) {
|
|
|
324
331
|
onSelectionChangeShouldSetResponderCapture,
|
|
325
332
|
onStartShouldSetResponder,
|
|
326
333
|
onStartShouldSetResponderCapture,
|
|
327
|
-
nativeID,
|
|
328
|
-
accessibilityActiveDescendant,
|
|
329
|
-
accessibilityAtomic,
|
|
330
|
-
accessibilityAutoComplete,
|
|
331
|
-
accessibilityBusy,
|
|
332
|
-
accessibilityChecked,
|
|
333
|
-
accessibilityColumnCount,
|
|
334
|
-
accessibilityColumnIndex,
|
|
335
|
-
accessibilityColumnSpan,
|
|
336
|
-
accessibilityControls,
|
|
337
|
-
accessibilityCurrent,
|
|
338
|
-
accessibilityDescribedBy,
|
|
339
|
-
accessibilityDetails,
|
|
340
|
-
accessibilityDisabled,
|
|
341
|
-
accessibilityErrorMessage,
|
|
342
|
-
accessibilityExpanded,
|
|
343
|
-
accessibilityFlowTo,
|
|
344
|
-
accessibilityHasPopup,
|
|
345
|
-
accessibilityHidden,
|
|
346
|
-
accessibilityInvalid,
|
|
347
|
-
accessibilityKeyShortcuts,
|
|
348
|
-
accessibilityLabel,
|
|
349
|
-
accessibilityLabelledBy,
|
|
350
|
-
accessibilityLevel,
|
|
351
|
-
accessibilityLiveRegion,
|
|
352
|
-
accessibilityModal,
|
|
353
|
-
accessibilityMultiline,
|
|
354
|
-
accessibilityMultiSelectable,
|
|
355
|
-
accessibilityOrientation,
|
|
356
|
-
accessibilityOwns,
|
|
357
|
-
accessibilityPlaceholder,
|
|
358
|
-
accessibilityPosInSet,
|
|
359
|
-
accessibilityPressed,
|
|
360
|
-
accessibilityReadOnly,
|
|
361
|
-
accessibilityRequired,
|
|
362
|
-
accessibilityRole,
|
|
363
|
-
accessibilityRoleDescription,
|
|
364
|
-
accessibilityRowCount,
|
|
365
|
-
accessibilityRowIndex,
|
|
366
|
-
accessibilityRowSpan,
|
|
367
|
-
accessibilitySelected,
|
|
368
|
-
accessibilitySetSize,
|
|
369
|
-
accessibilitySort,
|
|
370
|
-
accessibilityValueMax,
|
|
371
|
-
accessibilityValueMin,
|
|
372
|
-
accessibilityValueNow,
|
|
373
|
-
accessibilityValueText,
|
|
374
|
-
accessible,
|
|
375
|
-
accessibilityState,
|
|
376
|
-
accessibilityValue,
|
|
377
334
|
collapsable,
|
|
378
335
|
focusable,
|
|
336
|
+
accessible,
|
|
337
|
+
accessibilityDisabled,
|
|
379
338
|
onLayout,
|
|
380
339
|
...webProps
|
|
381
340
|
} = nonTamaguiProps;
|
|
382
341
|
viewProps = webProps;
|
|
383
|
-
(0, import_assignNativePropsToWeb.assignNativePropsToWeb)(elementType, viewProps, nonTamaguiProps);
|
|
384
342
|
if (!import_constants.isRSC) {
|
|
385
|
-
(
|
|
386
|
-
(0,
|
|
343
|
+
usePlatformMethods(hostRef);
|
|
344
|
+
(0, import_useElementLayout.useElementLayout)(hostRef, onLayout);
|
|
345
|
+
(0, import_react_native_use_responder_events.useResponderEvents)(hostRef, {
|
|
387
346
|
onMoveShouldSetResponder,
|
|
388
347
|
onMoveShouldSetResponderCapture,
|
|
389
348
|
onResponderEnd,
|
|
@@ -401,9 +360,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
401
360
|
onStartShouldSetResponder,
|
|
402
361
|
onStartShouldSetResponderCapture
|
|
403
362
|
});
|
|
404
|
-
const platformMethodsRef = (0, import_rnw.usePlatformMethods)(viewProps);
|
|
405
|
-
const setRef = (0, import_rnw.useMergeRefs)(hostRef, platformMethodsRef, forwardedRef, setMounted);
|
|
406
|
-
viewProps.ref = setRef;
|
|
407
363
|
}
|
|
408
364
|
if (props.href != void 0 && hrefAttrs != void 0) {
|
|
409
365
|
const { download, rel, target } = hrefAttrs;
|
|
@@ -436,10 +392,8 @@ function createComponent(configIn, ParentComponent) {
|
|
|
436
392
|
}
|
|
437
393
|
} else {
|
|
438
394
|
viewProps = nonTamaguiProps;
|
|
439
|
-
if (forwardedRef) {
|
|
440
|
-
viewProps.ref = forwardedRef;
|
|
441
|
-
}
|
|
442
395
|
}
|
|
396
|
+
viewProps.ref = (0, import_compose_refs.useComposedRefs)(hostRef, forwardedRef, setMounted);
|
|
443
397
|
if (process.env.NODE_ENV === "development" && !isText && import_constants.isWeb && !staticConfig.isHOC) {
|
|
444
398
|
import_react.Children.toArray(props.children).forEach((item) => {
|
|
445
399
|
if (typeof item === "string") {
|
|
@@ -461,7 +415,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
461
415
|
}, [unPress]);
|
|
462
416
|
}
|
|
463
417
|
let styles;
|
|
464
|
-
const animationStyles = state.animation ? state.animation.style : null;
|
|
465
418
|
if (isStringElement && shouldAvoidClasses && !shouldForcePseudo) {
|
|
466
419
|
styles = {
|
|
467
420
|
...defaultNativeStyle,
|
|
@@ -487,34 +440,23 @@ function createComponent(configIn, ParentComponent) {
|
|
|
487
440
|
Object.assign(splitStyles.style, next);
|
|
488
441
|
}
|
|
489
442
|
}
|
|
443
|
+
let fontFamily = isText ? splitStyles.fontFamily || staticConfig.defaultProps.fontFamily : null;
|
|
444
|
+
if (fontFamily && fontFamily[0] === "$") {
|
|
445
|
+
fontFamily = fontFamily.slice(1);
|
|
446
|
+
}
|
|
447
|
+
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "";
|
|
490
448
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
491
|
-
let fontFamily = isText ? splitStyles.fontFamily || staticConfig.defaultProps.fontFamily : null;
|
|
492
|
-
if (fontFamily && fontFamily[0] === "$") {
|
|
493
|
-
fontFamily = fontFamily.slice(1);
|
|
494
|
-
}
|
|
495
|
-
if (process.env.NODE_ENV === "development") {
|
|
496
|
-
if (fontFamily == null ? void 0 : fontFamily.startsWith(`var(`)) {
|
|
497
|
-
console.warn(
|
|
498
|
-
`Received variable instead of resolved name of font, this is a bug. Please report on Github.`,
|
|
499
|
-
{
|
|
500
|
-
fontFamily,
|
|
501
|
-
props,
|
|
502
|
-
splitStyles,
|
|
503
|
-
staticConfig
|
|
504
|
-
}
|
|
505
|
-
);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
449
|
const classList = [
|
|
509
450
|
componentName ? componentClassName : "",
|
|
510
|
-
|
|
451
|
+
fontFamilyClassName,
|
|
511
452
|
theme.className,
|
|
512
453
|
classNames ? Object.values(classNames).join(" ") : ""
|
|
513
454
|
];
|
|
514
455
|
const className = classList.join(" ");
|
|
515
456
|
const style = animationStyles ?? splitStyles.style;
|
|
516
|
-
|
|
517
|
-
|
|
457
|
+
if (isAnimatedReactNativeWeb) {
|
|
458
|
+
viewProps.style = style;
|
|
459
|
+
} else if (isReactNativeWeb) {
|
|
518
460
|
const rnwStyle = { $$css: true };
|
|
519
461
|
for (const name of className.split(" ")) {
|
|
520
462
|
rnwStyle[name] = name;
|
|
@@ -535,10 +477,8 @@ function createComponent(configIn, ParentComponent) {
|
|
|
535
477
|
}
|
|
536
478
|
}
|
|
537
479
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
538
|
-
const mergedRef = (0, import_rnw.useMergeRefs)(forwardedRef, hostRef, setMounted);
|
|
539
|
-
viewProps.ref = mergedRef;
|
|
540
480
|
if (splitStyles.fontFamily) {
|
|
541
|
-
const faceInfo = (_b =
|
|
481
|
+
const faceInfo = (_b = tamaguiConfig.fontsParsed[splitStyles.fontFamily]) == null ? void 0 : _b.face;
|
|
542
482
|
if (faceInfo) {
|
|
543
483
|
const [weight, style] = (() => {
|
|
544
484
|
var _a2, _b2;
|
|
@@ -566,13 +506,10 @@ function createComponent(configIn, ParentComponent) {
|
|
|
566
506
|
const attachPress = !!((pseudos == null ? void 0 : pseudos.pressStyle) || (initialPseudos == null ? void 0 : initialPseudos.pressStyle) || onPress || onPressOut || onPressIn || onClick);
|
|
567
507
|
const isHoverable = import_constants.isWeb;
|
|
568
508
|
const attachHover = isHoverable && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
569
|
-
const handlesPressEvents = !
|
|
570
|
-
const pressKey = handlesPressEvents ? "onPress" : "onClick";
|
|
571
|
-
const pressInKey = handlesPressEvents ? "onPressIn" : "onMouseDown";
|
|
572
|
-
const pressOutKey = handlesPressEvents ? "onPressOut" : "onMouseUp";
|
|
509
|
+
const handlesPressEvents = !import_constants.isWeb && !asChild;
|
|
573
510
|
const shouldAttach = !asChild && (attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || import_constants.isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props));
|
|
574
511
|
const events = shouldAttach && !import_constants.isRSC ? {
|
|
575
|
-
|
|
512
|
+
onPressOut: attachPress ? (e) => {
|
|
576
513
|
unPress();
|
|
577
514
|
onPressOut == null ? void 0 : onPressOut(e);
|
|
578
515
|
onMouseUp == null ? void 0 : onMouseUp(e);
|
|
@@ -586,7 +523,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
586
523
|
if (state.pressIn) {
|
|
587
524
|
next.press = true;
|
|
588
525
|
}
|
|
589
|
-
if (
|
|
526
|
+
if (attachHover || state.pressIn) {
|
|
590
527
|
setStateShallow(next);
|
|
591
528
|
}
|
|
592
529
|
onHoverIn == null ? void 0 : onHoverIn(e);
|
|
@@ -609,7 +546,7 @@ function createComponent(configIn, ParentComponent) {
|
|
|
609
546
|
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
610
547
|
} : void 0
|
|
611
548
|
},
|
|
612
|
-
|
|
549
|
+
onPressIn: attachPress ? (e) => {
|
|
613
550
|
setStateShallow({
|
|
614
551
|
press: true,
|
|
615
552
|
pressIn: true,
|
|
@@ -620,12 +557,12 @@ function createComponent(configIn, ParentComponent) {
|
|
|
620
557
|
if (import_constants.isWeb) {
|
|
621
558
|
mouseUps.add(unPress);
|
|
622
559
|
}
|
|
623
|
-
} :
|
|
624
|
-
|
|
560
|
+
} : void 0,
|
|
561
|
+
onPress: attachPress ? (e) => {
|
|
625
562
|
unPress();
|
|
626
563
|
onClick == null ? void 0 : onClick(e);
|
|
627
564
|
onPress == null ? void 0 : onPress(e);
|
|
628
|
-
} :
|
|
565
|
+
} : void 0,
|
|
629
566
|
...!import_constants.isWeb && {
|
|
630
567
|
cancelable: !props.rejectResponderTermination,
|
|
631
568
|
disabled: props.disabled !== null ? props.disabled : (_e = props.accessibilityState) == null ? void 0 : _e.disabled,
|
|
@@ -673,28 +610,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
673
610
|
onPressOut
|
|
674
611
|
};
|
|
675
612
|
}
|
|
676
|
-
if (!import_constants.isRSC && import_constants.isWeb) {
|
|
677
|
-
const [pressableProps] = (0, import_usePressable.usePressable)(
|
|
678
|
-
events ? {
|
|
679
|
-
disabled,
|
|
680
|
-
...hitSlop && {
|
|
681
|
-
hitSlop
|
|
682
|
-
},
|
|
683
|
-
onPressOut: events[pressOutKey],
|
|
684
|
-
onPressIn: events[pressInKey],
|
|
685
|
-
onPress: events[pressKey]
|
|
686
|
-
} : {
|
|
687
|
-
disabled: true
|
|
688
|
-
}
|
|
689
|
-
);
|
|
690
|
-
if (events) {
|
|
691
|
-
if (handlesPressEvents) {
|
|
692
|
-
Object.assign(viewProps, pressableProps);
|
|
693
|
-
} else {
|
|
694
|
-
Object.assign(viewProps, events);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
613
|
if (process.env.TAMAGUI_TARGET === "native") {
|
|
699
614
|
const attachFocus = !!(pseudos && pseudos.focusStyle || initialPseudos && initialPseudos.focusStyle);
|
|
700
615
|
if (attachFocus) {
|
|
@@ -707,9 +622,6 @@ function createComponent(configIn, ParentComponent) {
|
|
|
707
622
|
}
|
|
708
623
|
const pressability = (0, import_Pressability.usePressability)(events);
|
|
709
624
|
if (attachPress && events) {
|
|
710
|
-
const dontComposePressabilityKeys = {
|
|
711
|
-
onClick: true
|
|
712
|
-
};
|
|
713
625
|
if (hitSlop) {
|
|
714
626
|
viewProps.hitSlop = hitSlop;
|
|
715
627
|
}
|
|
@@ -722,21 +634,23 @@ function createComponent(configIn, ParentComponent) {
|
|
|
722
634
|
}
|
|
723
635
|
content = (0, import_react.createElement)(elementType, viewProps, childEls);
|
|
724
636
|
if (process.env.TAMAGUI_TARGET === "web") {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
637
|
+
if (events) {
|
|
638
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
639
|
+
style: styleDisplayContents,
|
|
640
|
+
onMouseEnter: events.onMouseEnter,
|
|
641
|
+
onMouseLeave: events.onMouseLeave,
|
|
642
|
+
onClick: events.onPress,
|
|
643
|
+
onMouseDown: events.onPressIn,
|
|
644
|
+
onMouseUp: events.onPressOut,
|
|
645
|
+
onTouchStart: events.onPressIn,
|
|
646
|
+
onTouchEnd: events.onPressOut,
|
|
647
|
+
children: content
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
if (isText && isAnimatedReactNativeWeb) {
|
|
731
651
|
content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
732
|
-
className:
|
|
733
|
-
style:
|
|
734
|
-
display: "contents"
|
|
735
|
-
},
|
|
736
|
-
...events && shouldWrapWithHover && {
|
|
737
|
-
onMouseEnter: events.onMouseEnter,
|
|
738
|
-
onMouseLeave: events.onMouseLeave
|
|
739
|
-
},
|
|
652
|
+
className: fontFamilyClassName,
|
|
653
|
+
style: styleDisplayContents,
|
|
740
654
|
children: content
|
|
741
655
|
});
|
|
742
656
|
}
|
|
@@ -762,49 +676,47 @@ function createComponent(configIn, ParentComponent) {
|
|
|
762
676
|
component.displayName = staticConfig.componentName;
|
|
763
677
|
}
|
|
764
678
|
(0, import_config.onConfiguredOnce)((conf) => {
|
|
765
|
-
if (!
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
679
|
+
if (!tamaguiConfig) {
|
|
680
|
+
tamaguiConfig = conf;
|
|
681
|
+
if (!defaultComponentState) {
|
|
682
|
+
defaultComponentState = {
|
|
683
|
+
hover: false,
|
|
684
|
+
press: false,
|
|
685
|
+
pressIn: false,
|
|
686
|
+
focus: false,
|
|
687
|
+
mounted: false,
|
|
688
|
+
mediaState: (0, import_useMedia.getInitialMediaState)()
|
|
689
|
+
};
|
|
690
|
+
defaultComponentStateMounted = {
|
|
691
|
+
...defaultComponentState,
|
|
692
|
+
mounted: true
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
if (tamaguiConfig.animations) {
|
|
696
|
+
AnimatedText = tamaguiConfig.animations.Text;
|
|
697
|
+
AnimatedView = tamaguiConfig.animations.View;
|
|
698
|
+
}
|
|
699
|
+
if (!initialTheme) {
|
|
700
|
+
const next = conf.themes[conf.defaultTheme || Object.keys(conf.themes)[0]];
|
|
701
|
+
initialTheme = (0, import_proxyThemeVariables.proxyThemeVariables)(next);
|
|
702
|
+
if (!initialTheme && process.env.NODE_ENV === "development") {
|
|
703
|
+
console.log(`Warning: Missing theme`);
|
|
704
|
+
}
|
|
790
705
|
}
|
|
791
706
|
}
|
|
792
|
-
|
|
707
|
+
mergeShorthands(staticConfig, tamaguiConfig);
|
|
793
708
|
let defaultPropsIn = staticConfig.defaultProps || {};
|
|
794
709
|
const parentNames = [...staticConfig.parentNames || [], staticConfig.componentName];
|
|
795
|
-
if (
|
|
710
|
+
if (tamaguiConfig.defaultProps && parentNames && staticConfig.componentName) {
|
|
796
711
|
defaultPropsIn = mergeConfigDefaultProps(
|
|
797
712
|
staticConfig.componentName,
|
|
798
713
|
defaultPropsIn,
|
|
799
|
-
|
|
714
|
+
tamaguiConfig.defaultProps,
|
|
800
715
|
parentNames,
|
|
801
|
-
|
|
716
|
+
tamaguiConfig
|
|
802
717
|
);
|
|
803
718
|
}
|
|
804
719
|
const debug = defaultPropsIn["debug"];
|
|
805
|
-
if (process.env.NODE_ENV === "development" && debug === "break") {
|
|
806
|
-
debugger;
|
|
807
|
-
}
|
|
808
720
|
const [parentProps, parentClassNames] = (0, import_mergeProps.mergeProps)(defaultPropsIn, {}, true);
|
|
809
721
|
initialSplitStyles = (0, import_getSplitStyles.insertSplitStyles)(
|
|
810
722
|
parentProps,
|
|
@@ -932,9 +844,6 @@ const Spacer = createComponent({
|
|
|
932
844
|
},
|
|
933
845
|
both: {}
|
|
934
846
|
}
|
|
935
|
-
},
|
|
936
|
-
defaultVariants: {
|
|
937
|
-
direction: "both"
|
|
938
847
|
}
|
|
939
848
|
});
|
|
940
849
|
function spacedChildren({
|
|
@@ -980,7 +889,7 @@ function spacedChildren({
|
|
|
980
889
|
if (hasSpace) {
|
|
981
890
|
final.push(
|
|
982
891
|
createSpacer({
|
|
983
|
-
key: `_${index}
|
|
892
|
+
key: `_${index}_00tmgui`,
|
|
984
893
|
direction,
|
|
985
894
|
space,
|
|
986
895
|
spaceFlex
|
|
@@ -993,7 +902,7 @@ function spacedChildren({
|
|
|
993
902
|
if (hasSpace) {
|
|
994
903
|
final.push(
|
|
995
904
|
createSpacer({
|
|
996
|
-
key: `_${index}
|
|
905
|
+
key: `_${index}01tmgui`,
|
|
997
906
|
direction,
|
|
998
907
|
space,
|
|
999
908
|
spaceFlex
|
|
@@ -1003,7 +912,7 @@ function spacedChildren({
|
|
|
1003
912
|
} else {
|
|
1004
913
|
final.push(
|
|
1005
914
|
createSpacer({
|
|
1006
|
-
key: `_${index}
|
|
915
|
+
key: `_${index}02tmgui`,
|
|
1007
916
|
direction,
|
|
1008
917
|
space,
|
|
1009
918
|
spaceFlex
|
|
@@ -1027,37 +936,6 @@ function isUnspaced(child) {
|
|
|
1027
936
|
var _a, _b;
|
|
1028
937
|
return ((_a = child == null ? void 0 : child["type"]) == null ? void 0 : _a["isVisuallyHidden"]) || ((_b = child == null ? void 0 : child["type"]) == null ? void 0 : _b["isUnspaced"]);
|
|
1029
938
|
}
|
|
1030
|
-
function AbsoluteFill(props) {
|
|
1031
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.View, {
|
|
1032
|
-
pointerEvents: "box-none",
|
|
1033
|
-
style: absoluteFill,
|
|
1034
|
-
children: props.children
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
const absoluteFill = {
|
|
1038
|
-
position: "absolute",
|
|
1039
|
-
top: 0,
|
|
1040
|
-
left: 0,
|
|
1041
|
-
right: 0,
|
|
1042
|
-
bottom: 0
|
|
1043
|
-
};
|
|
1044
|
-
function processIDRefList(idRefList) {
|
|
1045
|
-
return Array.isArray(idRefList) ? idRefList.join(" ") : idRefList;
|
|
1046
|
-
}
|
|
1047
|
-
const accessibilityRoleToWebRole = {
|
|
1048
|
-
adjustable: "slider",
|
|
1049
|
-
button: "button",
|
|
1050
|
-
header: "heading",
|
|
1051
|
-
image: "img",
|
|
1052
|
-
imagebutton: null,
|
|
1053
|
-
keyboardkey: null,
|
|
1054
|
-
label: null,
|
|
1055
|
-
link: "link",
|
|
1056
|
-
none: "presentation",
|
|
1057
|
-
search: "search",
|
|
1058
|
-
summary: "region",
|
|
1059
|
-
text: null
|
|
1060
|
-
};
|
|
1061
939
|
function addPseudoToStyles(styles, initialPseudos, pseudos, name, force = false) {
|
|
1062
940
|
const pseudoStyle = pseudos[name];
|
|
1063
941
|
const shouldNestObject = import_constants.isWeb && name !== "enterStyle" && name !== "exitStyle";
|
|
@@ -1158,14 +1036,48 @@ function merge(base, next) {
|
|
|
1158
1036
|
}
|
|
1159
1037
|
}
|
|
1160
1038
|
}
|
|
1039
|
+
function usePlatformMethods(hostRef) {
|
|
1040
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
1041
|
+
const node = hostRef.current;
|
|
1042
|
+
if (!node)
|
|
1043
|
+
return;
|
|
1044
|
+
node.measure = (callback) => (0, import_useElementLayout.measureLayout)(node, null, callback);
|
|
1045
|
+
node.measureLayout = (relativeToNode, success) => (0, import_useElementLayout.measureLayout)(node, relativeToNode, success);
|
|
1046
|
+
node.measureInWindow = (callback) => {
|
|
1047
|
+
if (!node)
|
|
1048
|
+
return;
|
|
1049
|
+
setTimeout(() => {
|
|
1050
|
+
const { height, left, top, width } = (0, import_useElementLayout.getRect)(node);
|
|
1051
|
+
callback(left, top, width, height);
|
|
1052
|
+
}, 0);
|
|
1053
|
+
};
|
|
1054
|
+
}, [hostRef]);
|
|
1055
|
+
}
|
|
1056
|
+
const AbsoluteFill = createComponent({
|
|
1057
|
+
componentName: "AbsoluteFill",
|
|
1058
|
+
defaultProps: {
|
|
1059
|
+
...import_constants2.stackDefaultStyles,
|
|
1060
|
+
flexDirection: "column",
|
|
1061
|
+
position: "absolute",
|
|
1062
|
+
top: 0,
|
|
1063
|
+
right: 0,
|
|
1064
|
+
bottom: 0,
|
|
1065
|
+
left: 0,
|
|
1066
|
+
pointerEvents: "box-none"
|
|
1067
|
+
}
|
|
1068
|
+
});
|
|
1069
|
+
const styleDisplayContents = {
|
|
1070
|
+
display: "contents"
|
|
1071
|
+
};
|
|
1072
|
+
const dontComposePressabilityKeys = {
|
|
1073
|
+
onClick: true
|
|
1074
|
+
};
|
|
1161
1075
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1162
1076
|
0 && (module.exports = {
|
|
1163
1077
|
Spacer,
|
|
1164
1078
|
Unspaced,
|
|
1165
|
-
accessibilityRoleToWebRole,
|
|
1166
1079
|
createComponent,
|
|
1167
1080
|
mouseUps,
|
|
1168
|
-
processIDRefList,
|
|
1169
1081
|
spacedChildren
|
|
1170
1082
|
});
|
|
1171
1083
|
//# sourceMappingURL=createComponent.js.map
|