@tamagui/web 1.113.1 → 1.113.2
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/esm/Tamagui.native.js +50 -41
- package/dist/esm/Tamagui.native.js.map +6 -1
- package/dist/esm/_withStableStyle.native.js +9 -11
- package/dist/esm/_withStableStyle.native.js.map +6 -1
- package/dist/esm/config.native.js +74 -75
- package/dist/esm/config.native.js.map +6 -1
- package/dist/esm/constants/accessibilityDirectMap.native.js +8 -6
- package/dist/esm/constants/accessibilityDirectMap.native.js.map +6 -1
- package/dist/esm/constants/constants.native.js +19 -17
- package/dist/esm/constants/constants.native.js.map +6 -1
- package/dist/esm/constants/isDevTools.native.js +10 -6
- package/dist/esm/constants/isDevTools.native.js.map +6 -1
- package/dist/esm/constants/webToNativeProps.native.js +162 -84
- package/dist/esm/constants/webToNativeProps.native.js.map +6 -1
- package/dist/esm/contexts/ComponentContext.native.js +5 -3
- package/dist/esm/contexts/ComponentContext.native.js.map +6 -1
- package/dist/esm/createComponent.native.js +300 -405
- package/dist/esm/createComponent.native.js.map +6 -1
- package/dist/esm/createFont.native.js +41 -24
- package/dist/esm/createFont.native.js.map +6 -1
- package/dist/esm/createShorthands.native.js +4 -2
- package/dist/esm/createShorthands.native.js.map +6 -1
- package/dist/esm/createTamagui.native.js +158 -177
- package/dist/esm/createTamagui.native.js.map +6 -1
- package/dist/esm/createTheme.native.js +5 -3
- package/dist/esm/createTheme.native.js.map +6 -1
- package/dist/esm/createTokens.native.js +5 -3
- package/dist/esm/createTokens.native.js.map +6 -1
- package/dist/esm/createVariable.native.js +35 -29
- package/dist/esm/createVariable.native.js.map +6 -1
- package/dist/esm/createVariables.native.js +29 -34
- package/dist/esm/createVariables.native.js.map +6 -1
- package/dist/esm/defaultComponentState.native.js +20 -18
- package/dist/esm/defaultComponentState.native.js.map +6 -1
- package/dist/esm/helpers/ThemeManager.native.js +101 -95
- package/dist/esm/helpers/ThemeManager.native.js.map +6 -1
- package/dist/esm/helpers/ThemeManagerContext.native.js +5 -3
- package/dist/esm/helpers/ThemeManagerContext.native.js.map +6 -1
- package/dist/esm/helpers/createMediaStyle.native.js +49 -64
- package/dist/esm/helpers/createMediaStyle.native.js.map +6 -1
- package/dist/esm/helpers/createShallowSetState.native.js +17 -9
- package/dist/esm/helpers/createShallowSetState.native.js.map +6 -1
- package/dist/esm/helpers/createStyledContext.native.js +25 -31
- package/dist/esm/helpers/createStyledContext.native.js.map +6 -1
- package/dist/esm/helpers/defaultOffset.native.js +4 -2
- package/dist/esm/helpers/defaultOffset.native.js.map +6 -1
- package/dist/esm/helpers/expandStyle.native.js +84 -39
- package/dist/esm/helpers/expandStyle.native.js.map +6 -1
- package/dist/esm/helpers/expandStyles.native.js +17 -15
- package/dist/esm/helpers/expandStyles.native.js.map +6 -1
- package/dist/esm/helpers/getExpandedShorthands.native.js +7 -4
- package/dist/esm/helpers/getExpandedShorthands.native.js.map +6 -1
- package/dist/esm/helpers/getFontLanguage.native.js +5 -3
- package/dist/esm/helpers/getFontLanguage.native.js.map +6 -1
- package/dist/esm/helpers/getGroupPropParts.native.js +6 -7
- package/dist/esm/helpers/getGroupPropParts.native.js.map +6 -1
- package/dist/esm/helpers/getSplitStyles.native.js +398 -436
- package/dist/esm/helpers/getSplitStyles.native.js.map +6 -1
- package/dist/esm/helpers/getStylesAtomic.native.js +8 -7
- package/dist/esm/helpers/getStylesAtomic.native.js.map +6 -1
- package/dist/esm/helpers/getThemeCSSRules.native.js +3 -1
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +6 -1
- package/dist/esm/helpers/getVariantExtras.native.js +34 -33
- package/dist/esm/helpers/getVariantExtras.native.js.map +6 -1
- package/dist/esm/helpers/insertStyleRule.native.js +111 -123
- package/dist/esm/helpers/insertStyleRule.native.js.map +6 -1
- package/dist/esm/helpers/isActivePlatform.native.js +5 -4
- package/dist/esm/helpers/isActivePlatform.native.js.map +6 -1
- package/dist/esm/helpers/isObj.native.js +5 -3
- package/dist/esm/helpers/isObj.native.js.map +6 -1
- package/dist/esm/helpers/isTamaguiComponent.native.js +4 -2
- package/dist/esm/helpers/isTamaguiComponent.native.js.map +6 -1
- package/dist/esm/helpers/isTamaguiElement.native.js +7 -5
- package/dist/esm/helpers/isTamaguiElement.native.js.map +6 -1
- package/dist/esm/helpers/log.native.js +7 -4
- package/dist/esm/helpers/log.native.js.map +6 -1
- package/dist/esm/helpers/matchMedia.native.js +14 -9
- package/dist/esm/helpers/matchMedia.native.js.map +6 -1
- package/dist/esm/helpers/mergeProps.native.js +13 -9
- package/dist/esm/helpers/mergeProps.native.js.map +6 -1
- package/dist/esm/helpers/mergeVariants.native.js +7 -7
- package/dist/esm/helpers/mergeVariants.native.js.map +6 -1
- package/dist/esm/helpers/normalizeColor.native.js +24 -20
- package/dist/esm/helpers/normalizeColor.native.js.map +6 -1
- package/dist/esm/helpers/normalizeShadow.native.js +7 -15
- package/dist/esm/helpers/normalizeShadow.native.js.map +6 -1
- package/dist/esm/helpers/normalizeStyle.native.js +12 -13
- package/dist/esm/helpers/normalizeStyle.native.js.map +6 -1
- package/dist/esm/helpers/normalizeStylePropKeys.native.js +3 -1
- package/dist/esm/helpers/normalizeStylePropKeys.native.js.map +6 -1
- package/dist/esm/helpers/normalizeValueWithProperty.native.js +12 -9
- package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +6 -1
- package/dist/esm/helpers/objectIdentityKey.native.js +11 -6
- package/dist/esm/helpers/objectIdentityKey.native.js.map +6 -1
- package/dist/esm/helpers/propMapper.native.js +206 -227
- package/dist/esm/helpers/propMapper.native.js.map +6 -1
- package/dist/esm/helpers/proxyThemeToParents.native.js +27 -39
- package/dist/esm/helpers/proxyThemeToParents.native.js.map +6 -1
- package/dist/esm/helpers/proxyThemeVariables.native.js +5 -3
- package/dist/esm/helpers/proxyThemeVariables.native.js.map +6 -1
- package/dist/esm/helpers/pseudoDescriptors.native.js +46 -44
- package/dist/esm/helpers/pseudoDescriptors.native.js.map +6 -1
- package/dist/esm/helpers/registerCSSVariable.native.js +13 -11
- package/dist/esm/helpers/registerCSSVariable.native.js.map +6 -1
- package/dist/esm/helpers/setElementProps.native.js +6 -3
- package/dist/esm/helpers/setElementProps.native.js.map +6 -1
- package/dist/esm/helpers/skipProps.native.js +5 -3
- package/dist/esm/helpers/skipProps.native.js.map +6 -1
- package/dist/esm/helpers/sortString.native.js +5 -3
- package/dist/esm/helpers/sortString.native.js.map +6 -1
- package/dist/esm/helpers/subscribeToContextGroup.native.js +18 -27
- package/dist/esm/helpers/subscribeToContextGroup.native.js.map +6 -1
- package/dist/esm/helpers/themeable.native.js +24 -31
- package/dist/esm/helpers/themeable.native.js.map +6 -1
- package/dist/esm/helpers/themes.native.js +5 -3
- package/dist/esm/helpers/themes.native.js.map +6 -1
- package/dist/esm/helpers/timer.native.js +5 -3
- package/dist/esm/helpers/timer.native.js.map +6 -1
- package/dist/esm/helpers/transformsToString.native.js +13 -11
- package/dist/esm/helpers/transformsToString.native.js.map +6 -1
- package/dist/esm/helpers/webPropsToSkip.native.js +3 -1
- package/dist/esm/helpers/webPropsToSkip.native.js.map +6 -1
- package/dist/esm/hooks/useComponentState.native.js +32 -66
- package/dist/esm/hooks/useComponentState.native.js.map +6 -1
- package/dist/esm/hooks/useConfiguration.native.js +8 -14
- package/dist/esm/hooks/useConfiguration.native.js.map +6 -1
- package/dist/esm/hooks/useDidHydrateOnce.native.js +15 -14
- package/dist/esm/hooks/useDidHydrateOnce.native.js.map +6 -1
- package/dist/esm/hooks/useDisableSSR.native.js +5 -3
- package/dist/esm/hooks/useDisableSSR.native.js.map +6 -1
- package/dist/esm/hooks/useIsTouchDevice.native.js +5 -3
- package/dist/esm/hooks/useIsTouchDevice.native.js.map +6 -1
- package/dist/esm/hooks/useMedia.native.js +104 -106
- package/dist/esm/hooks/useMedia.native.js.map +6 -1
- package/dist/esm/hooks/useProps.native.js +42 -41
- package/dist/esm/hooks/useProps.native.js.map +6 -1
- package/dist/esm/hooks/useTheme.native.js +231 -253
- package/dist/esm/hooks/useTheme.native.js.map +6 -1
- package/dist/esm/hooks/useThemeName.native.js +16 -12
- package/dist/esm/hooks/useThemeName.native.js.map +6 -1
- package/dist/esm/index.native.js +78 -61
- package/dist/esm/index.native.js.map +6 -1
- package/dist/esm/inject-styles.native.js +12 -15
- package/dist/esm/inject-styles.native.js.map +6 -1
- package/dist/esm/insertFont.native.js +32 -24
- package/dist/esm/insertFont.native.js.map +6 -1
- package/dist/esm/interfaces/CSSColorNames.native.js +1 -2
- package/dist/esm/interfaces/CSSColorNames.native.js.map +6 -1
- package/dist/esm/interfaces/GetRef.native.js +1 -2
- package/dist/esm/interfaces/GetRef.native.js.map +6 -1
- package/dist/esm/interfaces/KeyTypes.native.js +1 -2
- package/dist/esm/interfaces/KeyTypes.native.js.map +6 -1
- package/dist/esm/interfaces/RNExclusiveTypes.native.js +1 -2
- package/dist/esm/interfaces/RNExclusiveTypes.native.js.map +6 -1
- package/dist/esm/interfaces/Role.native.js +1 -2
- package/dist/esm/interfaces/Role.native.js.map +6 -1
- package/dist/esm/interfaces/TamaguiComponentEvents.native.js +1 -2
- package/dist/esm/interfaces/TamaguiComponentEvents.native.js.map +6 -1
- package/dist/esm/interfaces/TamaguiComponentPropsBaseBase.native.js +1 -2
- package/dist/esm/interfaces/TamaguiComponentPropsBaseBase.native.js.map +6 -1
- package/dist/esm/interfaces/TamaguiComponentState.native.js +1 -2
- package/dist/esm/interfaces/TamaguiComponentState.native.js.map +6 -1
- package/dist/esm/interfaces/WebOnlyPressEvents.native.js +1 -2
- package/dist/esm/interfaces/WebOnlyPressEvents.native.js.map +6 -1
- package/dist/esm/setupHooks.native.js +5 -2
- package/dist/esm/setupHooks.native.js.map +6 -1
- package/dist/esm/setupReactNative.native.js +13 -5
- package/dist/esm/setupReactNative.native.js.map +6 -1
- package/dist/esm/styled.native.js +50 -66
- package/dist/esm/styled.native.js.map +6 -1
- package/dist/esm/type-utils.native.js +1 -2
- package/dist/esm/type-utils.native.js.map +6 -1
- package/dist/esm/types.native.js +3 -3
- package/dist/esm/types.native.js.map +6 -1
- package/dist/esm/views/Configuration.native.js +7 -5
- package/dist/esm/views/Configuration.native.js.map +6 -1
- package/dist/esm/views/FontLanguage.native.js +11 -11
- package/dist/esm/views/FontLanguage.native.js.map +6 -1
- package/dist/esm/views/FontLanguage.types.native.js +1 -2
- package/dist/esm/views/FontLanguage.types.native.js.map +6 -1
- package/dist/esm/views/Slot.native.js +31 -33
- package/dist/esm/views/Slot.native.js.map +6 -1
- package/dist/esm/views/Stack.native.js +6 -4
- package/dist/esm/views/Stack.native.js.map +6 -1
- package/dist/esm/views/TamaguiProvider.native.js +39 -40
- package/dist/esm/views/TamaguiProvider.native.js.map +6 -1
- package/dist/esm/views/Text.native.js +30 -27
- package/dist/esm/views/Text.native.js.map +6 -1
- package/dist/esm/views/Theme.native.js +54 -76
- package/dist/esm/views/Theme.native.js.map +6 -1
- package/dist/esm/views/ThemeDebug.native.js +4 -6
- package/dist/esm/views/ThemeDebug.native.js.map +6 -1
- package/dist/esm/views/ThemeProvider.native.js +16 -12
- package/dist/esm/views/ThemeProvider.native.js.map +6 -1
- package/dist/esm/views/View.native.js +6 -4
- package/dist/esm/views/View.native.js.map +6 -1
- package/package.json +11 -11
|
@@ -3,34 +3,30 @@ import { composeRefs } from "@tamagui/compose-refs";
|
|
|
3
3
|
import { isClient, isServer, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
4
4
|
import { composeEventHandlers, validStyles } from "@tamagui/helpers";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { devConfig, getConfig, onConfiguredOnce } from "./config
|
|
7
|
-
import { stackDefaultStyles } from "./constants/constants
|
|
8
|
-
import { isDevTools } from "./constants/isDevTools
|
|
9
|
-
import { ComponentContext } from "./contexts/ComponentContext
|
|
10
|
-
import { didGetVariableValue, setDidGetVariableValue } from "./createVariable
|
|
11
|
-
import { defaultComponentStateMounted } from "./defaultComponentState
|
|
12
|
-
import { useSplitStyles } from "./helpers/getSplitStyles
|
|
13
|
-
import { log } from "./helpers/log
|
|
14
|
-
import { mergeProps } from "./helpers/mergeProps
|
|
15
|
-
import { setElementProps } from "./helpers/setElementProps
|
|
16
|
-
import { subscribeToContextGroup } from "./helpers/subscribeToContextGroup
|
|
17
|
-
import { themeable } from "./helpers/themeable
|
|
18
|
-
import { useComponentState } from "./hooks/useComponentState
|
|
19
|
-
import { setMediaShouldUpdate, useMedia } from "./hooks/useMedia
|
|
20
|
-
import { useThemeWithState } from "./hooks/useTheme
|
|
21
|
-
import { hooks } from "./setupHooks
|
|
22
|
-
import { Slot } from "./views/Slot
|
|
23
|
-
import { getThemedChildren } from "./views/Theme
|
|
24
|
-
import { ThemeDebug } from "./views/ThemeDebug
|
|
25
|
-
var tamaguiConfig,
|
|
26
|
-
time,
|
|
27
|
-
debugKeyListeners,
|
|
28
|
-
startVisualizer,
|
|
29
|
-
componentSetStates = /* @__PURE__ */new Set();
|
|
6
|
+
import { devConfig, getConfig, onConfiguredOnce } from "./config";
|
|
7
|
+
import { stackDefaultStyles } from "./constants/constants";
|
|
8
|
+
import { isDevTools } from "./constants/isDevTools";
|
|
9
|
+
import { ComponentContext } from "./contexts/ComponentContext";
|
|
10
|
+
import { didGetVariableValue, setDidGetVariableValue } from "./createVariable";
|
|
11
|
+
import { defaultComponentStateMounted } from "./defaultComponentState";
|
|
12
|
+
import { useSplitStyles } from "./helpers/getSplitStyles";
|
|
13
|
+
import { log } from "./helpers/log";
|
|
14
|
+
import { mergeProps } from "./helpers/mergeProps";
|
|
15
|
+
import { setElementProps } from "./helpers/setElementProps";
|
|
16
|
+
import { subscribeToContextGroup } from "./helpers/subscribeToContextGroup";
|
|
17
|
+
import { themeable } from "./helpers/themeable";
|
|
18
|
+
import { useComponentState } from "./hooks/useComponentState";
|
|
19
|
+
import { setMediaShouldUpdate, useMedia } from "./hooks/useMedia";
|
|
20
|
+
import { useThemeWithState } from "./hooks/useTheme";
|
|
21
|
+
import { hooks } from "./setupHooks";
|
|
22
|
+
import { Slot } from "./views/Slot";
|
|
23
|
+
import { getThemedChildren } from "./views/Theme";
|
|
24
|
+
import { ThemeDebug } from "./views/ThemeDebug";
|
|
25
|
+
var tamaguiConfig, time, debugKeyListeners, startVisualizer, componentSetStates = /* @__PURE__ */ new Set();
|
|
30
26
|
if (typeof document < "u") {
|
|
31
|
-
var cancelTouches = function
|
|
32
|
-
componentSetStates.forEach(function
|
|
33
|
-
return setState(function
|
|
27
|
+
var cancelTouches = function() {
|
|
28
|
+
componentSetStates.forEach(function(setState) {
|
|
29
|
+
return setState(function(prev) {
|
|
34
30
|
return prev.press || prev.pressIn ? {
|
|
35
31
|
...prev,
|
|
36
32
|
press: !1,
|
|
@@ -39,88 +35,62 @@ if (typeof document < "u") {
|
|
|
39
35
|
});
|
|
40
36
|
}), componentSetStates.clear();
|
|
41
37
|
};
|
|
42
|
-
addEventListener("mouseup", cancelTouches), addEventListener("touchend", cancelTouches), addEventListener("touchcancel", cancelTouches), process.env.NODE_ENV === "development" && (startVisualizer = function
|
|
38
|
+
addEventListener("mouseup", cancelTouches), addEventListener("touchend", cancelTouches), addEventListener("touchcancel", cancelTouches), process.env.NODE_ENV === "development" && (startVisualizer = function() {
|
|
43
39
|
var devVisualizerConfig = devConfig === null || devConfig === void 0 ? void 0 : devConfig.visualizer;
|
|
44
40
|
if (devVisualizerConfig) {
|
|
45
|
-
debugKeyListeners = /* @__PURE__ */new Set();
|
|
46
|
-
var tm,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
document.addEventListener("blur", function () {
|
|
41
|
+
debugKeyListeners = /* @__PURE__ */ new Set();
|
|
42
|
+
var tm, isShowing = !1, options = {
|
|
43
|
+
key: "Alt",
|
|
44
|
+
delay: 800,
|
|
45
|
+
...typeof devVisualizerConfig == "object" ? devVisualizerConfig : {}
|
|
46
|
+
};
|
|
47
|
+
document.addEventListener("blur", function() {
|
|
54
48
|
clearTimeout(tm);
|
|
55
|
-
}), document.addEventListener("keydown", function
|
|
56
|
-
var {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} = param;
|
|
60
|
-
defaultPrevented || (clearTimeout(tm), key === options.key && (tm = setTimeout(function () {
|
|
61
|
-
isShowing = !0, debugKeyListeners?.forEach(function (l) {
|
|
49
|
+
}), document.addEventListener("keydown", function(param) {
|
|
50
|
+
var { key, defaultPrevented } = param;
|
|
51
|
+
defaultPrevented || (clearTimeout(tm), key === options.key && (tm = setTimeout(function() {
|
|
52
|
+
isShowing = !0, debugKeyListeners?.forEach(function(l) {
|
|
62
53
|
return l(!0);
|
|
63
54
|
});
|
|
64
55
|
}, options.delay)));
|
|
65
|
-
}), document.addEventListener("keyup", function
|
|
66
|
-
var {
|
|
67
|
-
|
|
68
|
-
defaultPrevented
|
|
69
|
-
} = param;
|
|
70
|
-
defaultPrevented || key === options.key && (clearTimeout(tm), isShowing && debugKeyListeners?.forEach(function (l) {
|
|
56
|
+
}), document.addEventListener("keyup", function(param) {
|
|
57
|
+
var { key, defaultPrevented } = param;
|
|
58
|
+
defaultPrevented || key === options.key && (clearTimeout(tm), isShowing && debugKeyListeners?.forEach(function(l) {
|
|
71
59
|
return l(!1);
|
|
72
60
|
}));
|
|
73
61
|
});
|
|
74
62
|
}
|
|
75
63
|
});
|
|
76
64
|
}
|
|
77
|
-
var BaseText,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
value: !1
|
|
82
|
-
};
|
|
83
|
-
isWeb && globalThis.document && (document.addEventListener("keydown", function () {
|
|
65
|
+
var BaseText, BaseView, hasSetupBaseViews = !1, lastInteractionWasKeyboard = {
|
|
66
|
+
value: !1
|
|
67
|
+
};
|
|
68
|
+
isWeb && globalThis.document && (document.addEventListener("keydown", function() {
|
|
84
69
|
lastInteractionWasKeyboard.value = !0;
|
|
85
|
-
}), document.addEventListener("mousedown", function
|
|
70
|
+
}), document.addEventListener("mousedown", function() {
|
|
86
71
|
lastInteractionWasKeyboard.value = !1;
|
|
87
|
-
}), document.addEventListener("mousemove", function
|
|
72
|
+
}), document.addEventListener("mousemove", function() {
|
|
88
73
|
lastInteractionWasKeyboard.value = !1;
|
|
89
74
|
}));
|
|
90
75
|
function createComponent(staticConfig) {
|
|
91
|
-
var _staticConfig_defaultProps,
|
|
92
|
-
|
|
93
|
-
componentName
|
|
94
|
-
} = staticConfig,
|
|
95
|
-
config = null,
|
|
96
|
-
defaultProps = staticConfig.defaultProps;
|
|
97
|
-
onConfiguredOnce(function (conf) {
|
|
76
|
+
var _staticConfig_defaultProps, { componentName } = staticConfig, config = null, defaultProps = staticConfig.defaultProps;
|
|
77
|
+
onConfiguredOnce(function(conf) {
|
|
98
78
|
if (config = conf, componentName) {
|
|
99
|
-
var _conf_defaultProps,
|
|
100
|
-
defaultForComponent = (_conf_defaultProps = conf.defaultProps) === null || _conf_defaultProps === void 0 ? void 0 : _conf_defaultProps[componentName];
|
|
79
|
+
var _conf_defaultProps, defaultForComponent = (_conf_defaultProps = conf.defaultProps) === null || _conf_defaultProps === void 0 ? void 0 : _conf_defaultProps[componentName];
|
|
101
80
|
defaultForComponent && (defaultProps = {
|
|
102
81
|
...defaultForComponent,
|
|
103
82
|
...defaultProps
|
|
104
83
|
});
|
|
105
84
|
}
|
|
106
85
|
});
|
|
107
|
-
var {
|
|
108
|
-
|
|
109
|
-
isText,
|
|
110
|
-
isZStack,
|
|
111
|
-
isHOC
|
|
112
|
-
} = staticConfig;
|
|
113
|
-
process.env.NODE_ENV === "development" && !((_staticConfig_defaultProps = staticConfig.defaultProps) === null || _staticConfig_defaultProps === void 0) && _staticConfig_defaultProps.debug && process.env.IS_STATIC !== "is_static" && log(`\u{1F41B} [${componentName || "Component"}]`, {
|
|
86
|
+
var { Component, isText, isZStack, isHOC } = staticConfig;
|
|
87
|
+
process.env.NODE_ENV === "development" && (!((_staticConfig_defaultProps = staticConfig.defaultProps) === null || _staticConfig_defaultProps === void 0) && _staticConfig_defaultProps.debug) && process.env.IS_STATIC !== "is_static" && log(`\u{1F41B} [${componentName || "Component"}]`, {
|
|
114
88
|
staticConfig,
|
|
115
89
|
defaultProps,
|
|
116
90
|
defaultPropsKeyOrder: defaultProps ? Object.keys(defaultProps) : []
|
|
117
91
|
});
|
|
118
|
-
var component = /* @__PURE__ */React.forwardRef(function
|
|
119
|
-
var _themeState_state,
|
|
120
|
-
_hooks_usePropsTransform,
|
|
121
|
-
_hooks_useEvents,
|
|
122
|
-
_config_animations,
|
|
123
|
-
internalID = process.env.NODE_ENV === "development" ? React.useId() : "";
|
|
92
|
+
var component = /* @__PURE__ */ React.forwardRef(function(propsIn, forwardedRef) {
|
|
93
|
+
var _themeState_state, _hooks_usePropsTransform, _hooks_useEvents, _config_animations, internalID = process.env.NODE_ENV === "development" ? React.useId() : "";
|
|
124
94
|
if (process.env.NODE_ENV === "development" && startVisualizer && (startVisualizer(), startVisualizer = void 0), !hasSetupBaseViews) {
|
|
125
95
|
var _hooks_getBaseViews;
|
|
126
96
|
hasSetupBaseViews = !0;
|
|
@@ -131,95 +101,53 @@ function createComponent(staticConfig) {
|
|
|
131
101
|
var _propsIn_datatestrenders, _current, _;
|
|
132
102
|
(_ = (_propsIn_datatestrenders = propsIn["data-test-renders"])[_current = "current"]) !== null && _ !== void 0 || (_propsIn_datatestrenders[_current] = 0), propsIn["data-test-renders"].current += 1;
|
|
133
103
|
}
|
|
134
|
-
var componentContext = React.useContext(ComponentContext),
|
|
135
|
-
styledContextProps,
|
|
136
|
-
overriddenContextProps,
|
|
137
|
-
contextValue,
|
|
138
|
-
{
|
|
139
|
-
context,
|
|
140
|
-
isReactNative
|
|
141
|
-
} = staticConfig;
|
|
104
|
+
var componentContext = React.useContext(ComponentContext), styledContextProps, overriddenContextProps, contextValue, { context, isReactNative } = staticConfig;
|
|
142
105
|
if (context) {
|
|
143
106
|
contextValue = React.useContext(context);
|
|
144
|
-
var {
|
|
145
|
-
inverseShorthands
|
|
146
|
-
} = getConfig();
|
|
107
|
+
var { inverseShorthands } = getConfig();
|
|
147
108
|
for (var key in context.props) {
|
|
148
|
-
var _propsIn_key,
|
|
149
|
-
_ref,
|
|
150
|
-
_ref1,
|
|
151
|
-
propVal = (_ref1 = (_ref = (_propsIn_key = propsIn[key]) !== null && _propsIn_key !== void 0 ? _propsIn_key : propsIn[inverseShorthands[key]]) !== null && _ref !== void 0 ? _ref : defaultProps?.[key]) !== null && _ref1 !== void 0 ? _ref1 : defaultProps?.[inverseShorthands[key]];
|
|
109
|
+
var _propsIn_key, _ref, _ref1, propVal = (_ref1 = (_ref = (_propsIn_key = propsIn[key]) !== null && _propsIn_key !== void 0 ? _propsIn_key : propsIn[inverseShorthands[key]]) !== null && _ref !== void 0 ? _ref : defaultProps?.[key]) !== null && _ref1 !== void 0 ? _ref1 : defaultProps?.[inverseShorthands[key]];
|
|
152
110
|
if (propVal === void 0) {
|
|
153
111
|
var val = contextValue?.[key];
|
|
154
112
|
val !== void 0 && (styledContextProps || (styledContextProps = {}), styledContextProps[key] = val);
|
|
155
|
-
} else
|
|
113
|
+
} else
|
|
114
|
+
overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = propVal;
|
|
156
115
|
}
|
|
157
116
|
}
|
|
158
117
|
var curDefaultProps = styledContextProps ? {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
props = propsIn;
|
|
118
|
+
...defaultProps,
|
|
119
|
+
...styledContextProps
|
|
120
|
+
} : defaultProps, props = propsIn;
|
|
163
121
|
curDefaultProps && (props = mergeProps(curDefaultProps, propsIn));
|
|
164
|
-
var debugProp = props.debug,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
node = curStateRef.host;
|
|
171
|
-
if (node) if (show) {
|
|
122
|
+
var debugProp = props.debug, componentName2 = props.componentName || staticConfig.componentName;
|
|
123
|
+
if (process.env.NODE_ENV === "development" && isClient && React.useEffect(function() {
|
|
124
|
+
var overlay = null, debugVisualizerHandler = function() {
|
|
125
|
+
var show = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, node = curStateRef.host;
|
|
126
|
+
if (node)
|
|
127
|
+
if (show) {
|
|
172
128
|
overlay = document.createElement("span"), overlay.style.inset = "0px", overlay.style.zIndex = "1000000", overlay.style.position = "absolute", overlay.style.borderColor = "red", overlay.style.borderWidth = "1px", overlay.style.borderStyle = "dotted";
|
|
173
|
-
var dataAt = node.getAttribute("data-at") || "",
|
|
174
|
-
dataIn = node.getAttribute("data-in") || "",
|
|
175
|
-
tooltip = document.createElement("span");
|
|
129
|
+
var dataAt = node.getAttribute("data-at") || "", dataIn = node.getAttribute("data-in") || "", tooltip = document.createElement("span");
|
|
176
130
|
tooltip.style.position = "absolute", tooltip.style.top = "0px", tooltip.style.left = "0px", tooltip.style.padding = "3px", tooltip.style.background = "rgba(0,0,0,0.75)", tooltip.style.color = "rgba(255,255,255,1)", tooltip.style.fontSize = "12px", tooltip.style.lineHeight = "12px", tooltip.style.fontFamily = "monospace", tooltip.style.webkitFontSmoothing = "none", tooltip.innerText = `${componentName2 || ""} ${dataAt} ${dataIn}`.trim(), overlay.appendChild(tooltip), node.appendChild(overlay);
|
|
177
|
-
} else
|
|
178
|
-
|
|
179
|
-
|
|
131
|
+
} else
|
|
132
|
+
overlay && node.removeChild(overlay);
|
|
133
|
+
};
|
|
134
|
+
return debugKeyListeners || (debugKeyListeners = /* @__PURE__ */ new Set()), debugKeyListeners.add(debugVisualizerHandler), function() {
|
|
180
135
|
debugKeyListeners?.delete(debugVisualizerHandler);
|
|
181
136
|
};
|
|
182
|
-
}, [
|
|
137
|
+
}, [
|
|
138
|
+
componentName2
|
|
139
|
+
]), !process.env.TAMAGUI_IS_CORE_NODE && process.env.NODE_ENV === "development" && debugProp === "profile" && !time) {
|
|
183
140
|
var timer = require("@tamagui/timer").timer();
|
|
184
141
|
time = timer.start();
|
|
185
142
|
}
|
|
186
143
|
process.env.NODE_ENV === "development" && time && time`start (ignore)`, process.env.NODE_ENV === "development" && time && time`did-finish-ssr`, process.env.NODE_ENV === "development" && time && time`stateref`;
|
|
187
|
-
var animationDriver = componentContext.animationDriver,
|
|
188
|
-
useAnimations = animationDriver?.useAnimations,
|
|
189
|
-
{
|
|
190
|
-
curStateRef,
|
|
191
|
-
disabled,
|
|
192
|
-
groupName,
|
|
193
|
-
hasAnimationProp,
|
|
194
|
-
hasEnterStyle,
|
|
195
|
-
isAnimated,
|
|
196
|
-
isExiting,
|
|
197
|
-
isHydrated,
|
|
198
|
-
presence,
|
|
199
|
-
presenceState,
|
|
200
|
-
setState,
|
|
201
|
-
setStateShallow,
|
|
202
|
-
shouldAvoidClasses,
|
|
203
|
-
state,
|
|
204
|
-
stateRef,
|
|
205
|
-
supportsCSSVars,
|
|
206
|
-
willBeAnimated,
|
|
207
|
-
willBeAnimatedClient
|
|
208
|
-
} = useComponentState(props, componentContext, staticConfig, config),
|
|
209
|
-
shouldForcePseudo = !!propsIn.forceStyle,
|
|
210
|
-
noClassNames = shouldAvoidClasses || shouldForcePseudo;
|
|
144
|
+
var animationDriver = componentContext.animationDriver, useAnimations = animationDriver?.useAnimations, { curStateRef, disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, setStateShallow, shouldAvoidClasses, state, stateRef, supportsCSSVars, willBeAnimated, willBeAnimatedClient } = useComponentState(props, componentContext, staticConfig, config), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo;
|
|
211
145
|
process.env.NODE_ENV === "development" && time && time`use-state`;
|
|
212
146
|
var hasTextAncestor = !!(isWeb && isText && componentContext.inText);
|
|
213
147
|
process.env.NODE_ENV === "development" && time && time`use-context`;
|
|
214
|
-
var isTaggable = !Component || typeof Component == "string",
|
|
215
|
-
tagProp = props.tag,
|
|
216
|
-
element = isWeb && isTaggable && tagProp || Component,
|
|
217
|
-
BaseTextComponent = BaseText || element || "span",
|
|
218
|
-
BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div"),
|
|
219
|
-
elementType = isText ? BaseTextComponent : BaseViewComponent;
|
|
148
|
+
var isTaggable = !Component || typeof Component == "string", tagProp = props.tag, element = isWeb && isTaggable && tagProp || Component, BaseTextComponent = BaseText || element || "span", BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div"), elementType = isText ? BaseTextComponent : BaseViewComponent;
|
|
220
149
|
animationDriver && isAnimated && (elementType = animationDriver[isText ? "Text" : "View"] || elementType);
|
|
221
|
-
var disableThemeProp = !1,
|
|
222
|
-
disableTheme = disableThemeProp || isHOC;
|
|
150
|
+
var disableThemeProp = !1, disableTheme = disableThemeProp || isHOC;
|
|
223
151
|
process.env.NODE_ENV === "development" && time && time`theme-props`, props.themeShallow && (curStateRef.themeShallow = !0);
|
|
224
152
|
var themeStateProps = {
|
|
225
153
|
componentName: componentName2,
|
|
@@ -227,23 +155,21 @@ function createComponent(staticConfig) {
|
|
|
227
155
|
shallow: curStateRef.themeShallow,
|
|
228
156
|
debug: debugProp
|
|
229
157
|
};
|
|
230
|
-
if ("themeInverse" in props && (themeStateProps.inverse = props.themeInverse), "theme" in props && (themeStateProps.name = props.theme), typeof curStateRef.isListeningToTheme == "boolean" && (themeStateProps.shouldUpdate = function
|
|
158
|
+
if ("themeInverse" in props && (themeStateProps.inverse = props.themeInverse), "theme" in props && (themeStateProps.name = props.theme), typeof curStateRef.isListeningToTheme == "boolean" && (themeStateProps.shouldUpdate = function() {
|
|
231
159
|
return stateRef.current.isListeningToTheme;
|
|
232
160
|
}), themeStateProps.deopt = willBeAnimated, process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
|
|
233
|
-
var name = `${componentName2 || Component?.displayName || Component?.name || "[Unnamed Component]"}`,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
});else {
|
|
161
|
+
var name = `${componentName2 || Component?.displayName || Component?.name || "[Unnamed Component]"}`, type = (hasEnterStyle ? "(hasEnter)" : " ") + (isAnimated ? "(animated)" : " ") + (isReactNative ? "(rnw)" : " ") + (shouldAvoidClasses ? "(shouldAvoidClasses)" : " ") + (state.press || state.pressIn ? "(PRESSED)" : " ") + (state.hover ? "(HOVERED)" : " ") + (state.focus ? "(FOCUSED)" : " ") + (presenceState?.isPresent === !1 ? "(EXIT)" : ""), dataIs = propsIn["data-is"] || "", banner = `${internalID} ${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
|
|
162
|
+
if (console.info(`%c ${banner} (hydrated: ${isHydrated}) (unmounted: ${state.unmounted})`, "background: green; color: white;"), isServer)
|
|
163
|
+
log({
|
|
164
|
+
noClassNames,
|
|
165
|
+
isAnimated,
|
|
166
|
+
shouldAvoidClasses,
|
|
167
|
+
isWeb,
|
|
168
|
+
supportsCSSVars
|
|
169
|
+
});
|
|
170
|
+
else {
|
|
244
171
|
console.groupEnd();
|
|
245
|
-
var ch = propsIn.children,
|
|
246
|
-
childLog = typeof ch == "string" ? ch.length > 4 ? ch.slice(0, 4) + "..." : ch : "";
|
|
172
|
+
var ch = propsIn.children, childLog = typeof ch == "string" ? ch.length > 4 ? ch.slice(0, 4) + "..." : ch : "";
|
|
247
173
|
childLog.length && (childLog = `(children: ${childLog})`), console.groupCollapsed(`${childLog} Props:`), log("props in:", propsIn), log("final props:", props), log({
|
|
248
174
|
state,
|
|
249
175
|
staticConfig,
|
|
@@ -268,126 +194,108 @@ function createComponent(staticConfig) {
|
|
|
268
194
|
process.env.NODE_ENV === "development" && time && time`theme`;
|
|
269
195
|
var mediaState = useMedia(stateRef, componentContext, debugProp);
|
|
270
196
|
setDidGetVariableValue(!1), process.env.NODE_ENV === "development" && time && time`media`;
|
|
271
|
-
var resolveValues =
|
|
197
|
+
var resolveValues = (
|
|
272
198
|
// if HOC + mounted + has animation prop, resolve as value so it passes non-variable to child
|
|
273
|
-
isAnimated && !supportsCSSVars || isHOC && state.unmounted == !1 && hasAnimationProp ? "value" : "auto"
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
splitStyles = useSplitStyles(props, staticConfig, theme, (themeState == null || (_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", state, styleProps, null, componentContext, elementType, debugProp);
|
|
199
|
+
isAnimated && !supportsCSSVars || isHOC && state.unmounted == !1 && hasAnimationProp ? "value" : "auto"
|
|
200
|
+
), styleProps = {
|
|
201
|
+
mediaState,
|
|
202
|
+
noClassNames,
|
|
203
|
+
resolveValues,
|
|
204
|
+
isExiting,
|
|
205
|
+
isAnimated,
|
|
206
|
+
willBeAnimated,
|
|
207
|
+
styledContextProps
|
|
208
|
+
}, splitStyles = useSplitStyles(props, staticConfig, theme, (themeState == null || (_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", state, styleProps, null, componentContext, elementType, debugProp);
|
|
284
209
|
if (props.group && props.untilMeasured === "hide" && !curStateRef.hasMeasured) {
|
|
285
210
|
var _splitStyles;
|
|
286
211
|
(_splitStyles = splitStyles).style || (_splitStyles.style = {}), splitStyles.style.opacity = 0;
|
|
287
212
|
}
|
|
288
213
|
process.env.NODE_ENV === "development" && time && time`split-styles`, curStateRef.isListeningToTheme = splitStyles.dynamicThemeAccess;
|
|
289
|
-
var hasRuntimeMediaKeys = splitStyles.hasMedia && splitStyles.hasMedia !== !0,
|
|
290
|
-
shouldListenForMedia = didGetVariableValue() || hasRuntimeMediaKeys || noClassNames && splitStyles.hasMedia === !0,
|
|
291
|
-
mediaListeningKeys = hasRuntimeMediaKeys ? splitStyles.hasMedia : null;
|
|
214
|
+
var hasRuntimeMediaKeys = splitStyles.hasMedia && splitStyles.hasMedia !== !0, shouldListenForMedia = didGetVariableValue() || hasRuntimeMediaKeys || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = hasRuntimeMediaKeys ? splitStyles.hasMedia : null;
|
|
292
215
|
process.env.NODE_ENV === "development" && debugProp === "verbose" && console.info("useMedia() createComponent", shouldListenForMedia, mediaListeningKeys), setMediaShouldUpdate(stateRef, {
|
|
293
216
|
enabled: shouldListenForMedia,
|
|
294
217
|
keys: mediaListeningKeys
|
|
295
218
|
});
|
|
296
|
-
var {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
separator,
|
|
322
|
-
// ignore from here on out
|
|
323
|
-
forceStyle: _forceStyle,
|
|
324
|
-
// @ts-ignore for next/link compat etc
|
|
325
|
-
onClick,
|
|
326
|
-
theme: _themeProp,
|
|
327
|
-
...nonTamaguiProps
|
|
328
|
-
} = viewPropsIn,
|
|
329
|
-
viewProps = nonTamaguiProps;
|
|
219
|
+
var { viewProps: viewPropsIn, pseudos, style: splitStylesStyle, classNames, space } = splitStyles, propsWithAnimation = props, {
|
|
220
|
+
asChild,
|
|
221
|
+
children,
|
|
222
|
+
themeShallow,
|
|
223
|
+
spaceDirection: _spaceDirection,
|
|
224
|
+
onPress,
|
|
225
|
+
onLongPress,
|
|
226
|
+
onPressIn,
|
|
227
|
+
onPressOut,
|
|
228
|
+
onHoverIn,
|
|
229
|
+
onHoverOut,
|
|
230
|
+
onMouseUp,
|
|
231
|
+
onMouseDown,
|
|
232
|
+
onMouseEnter,
|
|
233
|
+
onMouseLeave,
|
|
234
|
+
onFocus,
|
|
235
|
+
onBlur,
|
|
236
|
+
separator,
|
|
237
|
+
// ignore from here on out
|
|
238
|
+
forceStyle: _forceStyle,
|
|
239
|
+
// @ts-ignore for next/link compat etc
|
|
240
|
+
onClick,
|
|
241
|
+
theme: _themeProp,
|
|
242
|
+
...nonTamaguiProps
|
|
243
|
+
} = viewPropsIn, viewProps = nonTamaguiProps;
|
|
330
244
|
!isTaggable && props.forceStyle && (viewProps.forceStyle = props.forceStyle), isHOC && _themeProp && (viewProps.theme = _themeProp), elementType.acceptTagProp && (viewProps.tag = tagProp);
|
|
331
|
-
var animationStyles,
|
|
332
|
-
shouldUseAnimation =
|
|
245
|
+
var animationStyles, shouldUseAnimation = (
|
|
333
246
|
// if it supports css vars we run it on server too to get matching initial style
|
|
334
|
-
(supportsCSSVars ? willBeAnimatedClient : willBeAnimated) && useAnimations && !isHOC
|
|
247
|
+
(supportsCSSVars ? willBeAnimatedClient : willBeAnimated) && useAnimations && !isHOC
|
|
248
|
+
);
|
|
335
249
|
if (shouldUseAnimation) {
|
|
336
|
-
var _themeState_state1,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
});
|
|
250
|
+
var _themeState_state1, animations = useAnimations({
|
|
251
|
+
props: propsWithAnimation,
|
|
252
|
+
// if hydrating, send empty style
|
|
253
|
+
style: splitStylesStyle || {},
|
|
254
|
+
presence,
|
|
255
|
+
componentState: state,
|
|
256
|
+
styleProps,
|
|
257
|
+
theme: (_themeState_state1 = themeState.state) === null || _themeState_state1 === void 0 ? void 0 : _themeState_state1.theme,
|
|
258
|
+
pseudos: pseudos || null,
|
|
259
|
+
staticConfig,
|
|
260
|
+
stateRef
|
|
261
|
+
});
|
|
349
262
|
(isAnimated || supportsCSSVars) && animations && (animationStyles = animations.style, viewProps.style = animationStyles, animations.className && (viewProps.className = `${state.unmounted === "should-enter" ? "t_unmounted " : ""}${viewProps.className || ""} ${animations.className}`)), process.env.NODE_ENV === "development" && time && time`animations`;
|
|
350
263
|
}
|
|
351
264
|
process.env.NODE_ENV === "development" && props.untilMeasured && !props.group && console.warn(`You set the untilMeasured prop without setting group. This doesn't work, be sure to set untilMeasured on the parent that sets group, not the children that use the $group- prop.
|
|
352
265
|
|
|
353
|
-
If you meant to do this, you can disable this warning - either change untilMeasured and group at the same time, or do group={conditional ? 'name' : undefined}`), process.env.NODE_ENV === "development" && time && time`destructure`, groupName && (nonTamaguiProps.onLayout = composeEventHandlers(nonTamaguiProps.onLayout, function
|
|
266
|
+
If you meant to do this, you can disable this warning - either change untilMeasured and group at the same time, or do group={conditional ? 'name' : undefined}`), process.env.NODE_ENV === "development" && time && time`destructure`, groupName && (nonTamaguiProps.onLayout = composeEventHandlers(nonTamaguiProps.onLayout, function(e) {
|
|
354
267
|
stateRef.current.group.emit(groupName, {
|
|
355
268
|
layout: e.nativeEvent.layout
|
|
356
|
-
}), !stateRef.current.hasMeasured && props.untilMeasured === "hide" && setState(function
|
|
269
|
+
}), !stateRef.current.hasMeasured && props.untilMeasured === "hide" && setState(function(prev) {
|
|
357
270
|
return {
|
|
358
271
|
...prev
|
|
359
272
|
};
|
|
360
273
|
}), stateRef.current.hasMeasured = !0;
|
|
361
|
-
})), viewProps = ((_hooks_usePropsTransform = hooks.usePropsTransform) === null || _hooks_usePropsTransform === void 0 ? void 0 : _hooks_usePropsTransform.call(hooks, elementType, nonTamaguiProps, stateRef, curStateRef.willHydrate)) || nonTamaguiProps, curStateRef.composedRef || (curStateRef.composedRef = composeRefs(function
|
|
274
|
+
})), viewProps = ((_hooks_usePropsTransform = hooks.usePropsTransform) === null || _hooks_usePropsTransform === void 0 ? void 0 : _hooks_usePropsTransform.call(hooks, elementType, nonTamaguiProps, stateRef, curStateRef.willHydrate)) || nonTamaguiProps, curStateRef.composedRef || (curStateRef.composedRef = composeRefs(function(x) {
|
|
362
275
|
return stateRef.current.host = x;
|
|
363
|
-
}, forwardedRef, setElementProps)), viewProps.ref = curStateRef.composedRef, process.env.NODE_ENV === "development" && !isReactNative && !isText && isWeb && !isHOC && React.Children.toArray(props.children).forEach(function
|
|
276
|
+
}, forwardedRef, setElementProps)), viewProps.ref = curStateRef.composedRef, process.env.NODE_ENV === "development" && !isReactNative && !isText && isWeb && !isHOC && React.Children.toArray(props.children).forEach(function(item) {
|
|
364
277
|
typeof item == "string" && item !== `
|
|
365
278
|
` && console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
366
279
|
}), process.env.NODE_ENV === "development" && time && time`events-hooks`;
|
|
367
|
-
var {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
pressIn: !1
|
|
375
|
-
});
|
|
376
|
-
};
|
|
377
|
-
process.env.NODE_ENV === "development" && isWeb && useIsomorphicLayoutEffect(function () {
|
|
280
|
+
var { pseudoGroups, mediaGroups } = splitStyles, unPress = function() {
|
|
281
|
+
return setStateShallow({
|
|
282
|
+
press: !1,
|
|
283
|
+
pressIn: !1
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
process.env.NODE_ENV === "development" && isWeb && useIsomorphicLayoutEffect(function() {
|
|
378
287
|
if (debugProp === "verbose") {
|
|
379
|
-
let cssStyleDeclarationToObject2 = function
|
|
288
|
+
let cssStyleDeclarationToObject2 = function(style) {
|
|
380
289
|
for (var styleObject = {}, i = 0; i < style.length; i++) {
|
|
381
290
|
var prop = style[i];
|
|
382
291
|
styleObject[prop] = style.getPropertyValue(prop);
|
|
383
292
|
}
|
|
384
293
|
return styleObject;
|
|
385
294
|
};
|
|
386
|
-
var cssStyleDeclarationToObject = cssStyleDeclarationToObject2,
|
|
387
|
-
computed = cssStyleDeclarationToObject2(getComputedStyle(stateRef.current.host));
|
|
295
|
+
var cssStyleDeclarationToObject = cssStyleDeclarationToObject2, computed = cssStyleDeclarationToObject2(getComputedStyle(stateRef.current.host));
|
|
388
296
|
console.groupCollapsed(`Rendered > (opacity: ${computed.opacity})`), console.warn(stateRef.current.host), console.warn(computed), console.groupEnd();
|
|
389
297
|
}
|
|
390
|
-
}), React.useEffect(function
|
|
298
|
+
}), React.useEffect(function() {
|
|
391
299
|
if (!disabled) {
|
|
392
300
|
if (state.unmounted === !0 && hasEnterStyle) {
|
|
393
301
|
setStateShallow({
|
|
@@ -397,7 +305,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
397
305
|
}
|
|
398
306
|
var tm;
|
|
399
307
|
if (state.unmounted) {
|
|
400
|
-
animationDriver?.supportsCSSVars ? tm = setTimeout(function
|
|
308
|
+
animationDriver?.supportsCSSVars ? tm = setTimeout(function() {
|
|
401
309
|
setStateShallow({
|
|
402
310
|
unmounted: !1
|
|
403
311
|
});
|
|
@@ -414,21 +322,21 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
414
322
|
mediaGroups,
|
|
415
323
|
pseudoGroups
|
|
416
324
|
});
|
|
417
|
-
return function
|
|
325
|
+
return function() {
|
|
418
326
|
clearTimeout(tm), dispose?.(), componentSetStates.delete(setState);
|
|
419
327
|
};
|
|
420
328
|
}
|
|
421
|
-
}, [
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
329
|
+
}, [
|
|
330
|
+
state.unmounted,
|
|
331
|
+
disabled,
|
|
332
|
+
pseudoGroups ? Object.keys([
|
|
333
|
+
...pseudoGroups
|
|
334
|
+
]).join("") : 0,
|
|
335
|
+
mediaGroups ? Object.keys([
|
|
336
|
+
...mediaGroups
|
|
337
|
+
]).join("") : 0
|
|
338
|
+
]);
|
|
339
|
+
var runtimePressStyle = !disabled && noClassNames && pseudos?.pressStyle, runtimeFocusStyle = !disabled && noClassNames && pseudos?.focusStyle, runtimeFocusVisibleStyle = !disabled && noClassNames && pseudos?.focusVisibleStyle, attachFocus = !!(runtimePressStyle || runtimeFocusStyle || runtimeFocusVisibleStyle || onFocus || onBlur), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || pseudos?.focusVisibleStyle), runtimeHoverStyle = !disabled && noClassNames && pseudos?.hoverStyle, needsHoverState = !!(groupName || runtimeHoverStyle || onHoverIn || onHoverOut), attachHover = isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), shouldAttach = !disabled && !props.asChild && !!(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle), needsPressState = !!(groupName || runtimePressStyle);
|
|
432
340
|
process.env.NODE_ENV === "development" && time && time`events-setup`, process.env.NODE_ENV === "development" && debugProp === "verbose" && log("\u{1FAA9} events()", {
|
|
433
341
|
runtimeFocusStyle,
|
|
434
342
|
runtimePressStyle,
|
|
@@ -441,36 +349,36 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
441
349
|
needsHoverState
|
|
442
350
|
});
|
|
443
351
|
var events = shouldAttach ? {
|
|
444
|
-
onPressOut: attachPress ? function
|
|
352
|
+
onPressOut: attachPress ? function(e) {
|
|
445
353
|
unPress(), onPressOut?.(e), onMouseUp?.(e);
|
|
446
354
|
} : void 0,
|
|
447
|
-
...(
|
|
448
|
-
onMouseEnter: function
|
|
355
|
+
...(attachHover || attachPress) && {
|
|
356
|
+
onMouseEnter: function(e) {
|
|
449
357
|
var next = {};
|
|
450
358
|
needsHoverState && (next.hover = !0), needsPressState && state.pressIn && (next.press = !0), setStateShallow(next), onHoverIn?.(e), onMouseEnter?.(e);
|
|
451
359
|
},
|
|
452
|
-
onMouseLeave: function
|
|
360
|
+
onMouseLeave: function(e) {
|
|
453
361
|
var next = {};
|
|
454
362
|
needsHoverState && (next.hover = !1), needsPressState && state.pressIn && (next.press = !1, next.pressIn = !1), setStateShallow(next), onHoverOut?.(e), onMouseLeave?.(e);
|
|
455
363
|
}
|
|
456
|
-
}
|
|
457
|
-
onPressIn: attachPress ? function
|
|
364
|
+
},
|
|
365
|
+
onPressIn: attachPress ? function(e) {
|
|
458
366
|
(runtimePressStyle || groupName) && setStateShallow({
|
|
459
367
|
press: !0,
|
|
460
368
|
pressIn: !0
|
|
461
369
|
}), onPressIn?.(e), onMouseDown?.(e), isWeb && componentSetStates.add(setState);
|
|
462
370
|
} : void 0,
|
|
463
|
-
onPress: attachPress ? function
|
|
371
|
+
onPress: attachPress ? function(e) {
|
|
464
372
|
unPress(), isWeb && onClick?.(e), onPress?.(e);
|
|
465
373
|
} : void 0,
|
|
466
|
-
...
|
|
467
|
-
onLongPress: function
|
|
374
|
+
...attachPress && onLongPress && {
|
|
375
|
+
onLongPress: function(e) {
|
|
468
376
|
unPress(), onLongPress?.(e);
|
|
469
377
|
}
|
|
470
|
-
}
|
|
471
|
-
...
|
|
472
|
-
onFocus: function
|
|
473
|
-
pseudos?.focusVisibleStyle ? setTimeout(function
|
|
378
|
+
},
|
|
379
|
+
...attachFocus && {
|
|
380
|
+
onFocus: function(e) {
|
|
381
|
+
pseudos?.focusVisibleStyle ? setTimeout(function() {
|
|
474
382
|
setStateShallow({
|
|
475
383
|
focus: !0,
|
|
476
384
|
focusVisible: !!lastInteractionWasKeyboard.value
|
|
@@ -480,13 +388,13 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
480
388
|
focusVisible: !1
|
|
481
389
|
}), onFocus?.(e);
|
|
482
390
|
},
|
|
483
|
-
onBlur: function
|
|
391
|
+
onBlur: function(e) {
|
|
484
392
|
setStateShallow({
|
|
485
393
|
focus: !1,
|
|
486
394
|
focusVisible: !1
|
|
487
395
|
}), onBlur?.(e);
|
|
488
396
|
}
|
|
489
|
-
}
|
|
397
|
+
}
|
|
490
398
|
} : null;
|
|
491
399
|
if (events && !asChild) {
|
|
492
400
|
var _viewProps_focusable;
|
|
@@ -516,21 +424,25 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
516
424
|
isZStack,
|
|
517
425
|
debug: debugProp
|
|
518
426
|
});
|
|
519
|
-
if (asChild)
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
427
|
+
if (asChild)
|
|
428
|
+
if (elementType = Slot, 0)
|
|
429
|
+
var webStyleEvents, passEvents;
|
|
430
|
+
else
|
|
431
|
+
Object.assign(viewProps, {
|
|
432
|
+
onPress,
|
|
433
|
+
onLongPress
|
|
434
|
+
});
|
|
523
435
|
process.env.NODE_ENV === "development" && time && time`spaced-as-child`;
|
|
524
436
|
var useChildrenResult;
|
|
525
|
-
hooks.useChildren && (useChildrenResult = hooks.useChildren(elementType, content, viewProps, events, staticConfig)), useChildrenResult ? content = useChildrenResult : content = /* @__PURE__ */React.createElement(elementType, viewProps, content);
|
|
437
|
+
hooks.useChildren && (useChildrenResult = hooks.useChildren(elementType, content, viewProps, events, staticConfig)), useChildrenResult ? content = useChildrenResult : content = /* @__PURE__ */ React.createElement(elementType, viewProps, content);
|
|
526
438
|
var ResetPresence = config == null || (_config_animations = config.animations) === null || _config_animations === void 0 ? void 0 : _config_animations.ResetPresence;
|
|
527
|
-
ResetPresence && willBeAnimated && (hasEnterStyle || presenceState) && content && typeof content != "string" && (content = /* @__PURE__ */_jsx(ResetPresence, {
|
|
439
|
+
ResetPresence && willBeAnimated && (hasEnterStyle || presenceState) && content && typeof content != "string" && (content = /* @__PURE__ */ _jsx(ResetPresence, {
|
|
528
440
|
children: content
|
|
529
441
|
})), process.env.NODE_ENV === "development" && time && time`create-element`;
|
|
530
|
-
var groupState = curStateRef.group,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
442
|
+
var groupState = curStateRef.group, subGroupContext = React.useMemo(function() {
|
|
443
|
+
var _splitStyles_style, _splitStyles_style1;
|
|
444
|
+
if (!(!groupState || !groupName))
|
|
445
|
+
return groupState.listeners.clear(), {
|
|
534
446
|
...componentContext.groups,
|
|
535
447
|
// change reference so as we mutate it doesn't affect siblings etc
|
|
536
448
|
state: {
|
|
@@ -548,36 +460,39 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
548
460
|
emit: groupState.emit,
|
|
549
461
|
subscribe: groupState.subscribe
|
|
550
462
|
};
|
|
551
|
-
|
|
552
|
-
|
|
463
|
+
}, [
|
|
464
|
+
groupName
|
|
465
|
+
]);
|
|
466
|
+
if (groupName && subGroupContext && (content = /* @__PURE__ */ _jsx(ComponentContext.Provider, {
|
|
553
467
|
...componentContext,
|
|
554
468
|
groups: subGroupContext,
|
|
555
469
|
children: content
|
|
556
|
-
})), process.env.NODE_ENV === "development" && time && time`group-context`, content = disableTheme ? content : getThemedChildren(themeState, content, themeStateProps, !1, stateRef), process.env.NODE_ENV === "development" && time && time`themed-children`, process.env.NODE_ENV === "development" && props.debug === "visualize" && (content = /* @__PURE__ */_jsx(ThemeDebug, {
|
|
470
|
+
})), process.env.NODE_ENV === "development" && time && time`group-context`, content = disableTheme ? content : getThemedChildren(themeState, content, themeStateProps, !1, stateRef), process.env.NODE_ENV === "development" && time && time`themed-children`, process.env.NODE_ENV === "development" && props.debug === "visualize" && (content = /* @__PURE__ */ _jsx(ThemeDebug, {
|
|
557
471
|
themeState,
|
|
558
472
|
themeProps: props,
|
|
559
473
|
children: content
|
|
560
474
|
})), staticConfig.context) {
|
|
561
475
|
var contextProps = staticConfig.context.props;
|
|
562
|
-
for (var key1 in contextProps)
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
476
|
+
for (var key1 in contextProps)
|
|
477
|
+
if (viewProps.style && key1 in viewProps.style || key1 in viewProps) {
|
|
478
|
+
var _viewProps_style;
|
|
479
|
+
overriddenContextProps || (overriddenContextProps = {});
|
|
480
|
+
var _viewProps_style_key;
|
|
481
|
+
overriddenContextProps[key1] = (_viewProps_style_key = (_viewProps_style = viewProps.style) === null || _viewProps_style === void 0 ? void 0 : _viewProps_style[key1]) !== null && _viewProps_style_key !== void 0 ? _viewProps_style_key : viewProps[key1];
|
|
482
|
+
}
|
|
568
483
|
}
|
|
569
484
|
if (overriddenContextProps) {
|
|
570
485
|
var Provider = staticConfig.context.Provider;
|
|
571
|
-
content = /* @__PURE__ */_jsx(Provider, {
|
|
486
|
+
content = /* @__PURE__ */ _jsx(Provider, {
|
|
572
487
|
...contextValue,
|
|
573
488
|
...overriddenContextProps,
|
|
574
489
|
children: content
|
|
575
490
|
});
|
|
576
491
|
}
|
|
577
|
-
if (process.env.TAMAGUI_REACT_19 && !1)
|
|
492
|
+
if (process.env.TAMAGUI_REACT_19 && !1)
|
|
493
|
+
var rulesToInsert, keys;
|
|
578
494
|
if (process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
|
|
579
|
-
var element1 = typeof elementType == "string" ? elementType : "Component",
|
|
580
|
-
title = `render <${element1} /> (${internalID}) with props`;
|
|
495
|
+
var element1 = typeof elementType == "string" ? elementType : "Component", title = `render <${element1} /> (${internalID}) with props`;
|
|
581
496
|
if (isWeb) {
|
|
582
497
|
console.groupCollapsed(title);
|
|
583
498
|
try {
|
|
@@ -610,22 +525,25 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
610
525
|
viewProps,
|
|
611
526
|
willBeAnimated
|
|
612
527
|
});
|
|
613
|
-
} catch {
|
|
528
|
+
} catch {
|
|
529
|
+
} finally {
|
|
614
530
|
console.groupEnd();
|
|
615
531
|
}
|
|
616
532
|
} else {
|
|
617
533
|
log(title), log("state: ", state), isDevTools && log("viewProps", viewProps), log("final styles:");
|
|
618
|
-
for (var key2 in splitStylesStyle)
|
|
534
|
+
for (var key2 in splitStylesStyle)
|
|
535
|
+
log(key2, splitStylesStyle[key2]);
|
|
619
536
|
}
|
|
620
|
-
if (debugProp === "break")
|
|
537
|
+
if (debugProp === "break")
|
|
538
|
+
debugger;
|
|
621
539
|
}
|
|
622
|
-
return process.env.NODE_ENV === "development" && time && (time`rest`, globalThis.willPrint || (globalThis.willPrint = !0, setTimeout(function
|
|
540
|
+
return process.env.NODE_ENV === "development" && time && (time`rest`, globalThis.willPrint || (globalThis.willPrint = !0, setTimeout(function() {
|
|
623
541
|
delete globalThis.willPrint, time.print(), time = null;
|
|
624
542
|
}, 50))), content;
|
|
625
543
|
});
|
|
626
544
|
staticConfig.componentName && (component.displayName = staticConfig.componentName);
|
|
627
545
|
var res = component;
|
|
628
|
-
(process.env.TAMAGUI_FORCE_MEMO || staticConfig.memo) && (res = /* @__PURE__ */React.memo(res)), res.staticConfig = staticConfig;
|
|
546
|
+
(process.env.TAMAGUI_FORCE_MEMO || staticConfig.memo) && (res = /* @__PURE__ */ React.memo(res)), res.staticConfig = staticConfig;
|
|
629
547
|
function extendStyledConfig(extended) {
|
|
630
548
|
return {
|
|
631
549
|
...staticConfig,
|
|
@@ -639,11 +557,8 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
639
557
|
return Component2.staticConfig = extendStyledConfig(extended), Component2.styleable = styleable, Component2;
|
|
640
558
|
}
|
|
641
559
|
function styleable(Component2, options) {
|
|
642
|
-
var _Component_render,
|
|
643
|
-
|
|
644
|
-
out = isForwardedRefAlready ? Component2 : /* @__PURE__ */React.forwardRef(Component2),
|
|
645
|
-
extendedConfig = extendStyledConfig(options?.staticConfig);
|
|
646
|
-
return out = options?.disableTheme ? out : themeable(out, extendedConfig), process.env.TAMAGUI_MEMOIZE_STYLEABLE && (out = /* @__PURE__ */React.memo(out)), out.staticConfig = extendedConfig, out.styleable = styleable, out;
|
|
560
|
+
var _Component_render, isForwardedRefAlready = ((_Component_render = Component2.render) === null || _Component_render === void 0 ? void 0 : _Component_render.length) === 2, out = isForwardedRefAlready ? Component2 : /* @__PURE__ */ React.forwardRef(Component2), extendedConfig = extendStyledConfig(options?.staticConfig);
|
|
561
|
+
return out = options?.disableTheme ? out : themeable(out, extendedConfig), process.env.TAMAGUI_MEMOIZE_STYLEABLE && (out = /* @__PURE__ */ React.memo(out)), out.staticConfig = extendedConfig, out.styleable = styleable, out;
|
|
647
562
|
}
|
|
648
563
|
return res.extractable = extractable, res.styleable = styleable, res;
|
|
649
564
|
}
|
|
@@ -651,89 +566,68 @@ function Unspaced(props) {
|
|
|
651
566
|
return props.children;
|
|
652
567
|
}
|
|
653
568
|
Unspaced.isUnspaced = !0;
|
|
654
|
-
var getSpacerSize = function
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
569
|
+
var getSpacerSize = function(size, param) {
|
|
570
|
+
var { tokens } = param;
|
|
571
|
+
size = size === !0 ? "$true" : size;
|
|
572
|
+
var _tokens_space_size, sizePx = (_tokens_space_size = tokens.space[size]) !== null && _tokens_space_size !== void 0 ? _tokens_space_size : size;
|
|
573
|
+
return {
|
|
574
|
+
width: sizePx,
|
|
575
|
+
height: sizePx,
|
|
576
|
+
minWidth: sizePx,
|
|
577
|
+
minHeight: sizePx
|
|
578
|
+
};
|
|
579
|
+
}, Spacer = createComponent({
|
|
580
|
+
acceptsClassName: !0,
|
|
581
|
+
memo: !0,
|
|
582
|
+
componentName: "Spacer",
|
|
583
|
+
validStyles,
|
|
584
|
+
defaultProps: {
|
|
585
|
+
...stackDefaultStyles,
|
|
586
|
+
// avoid nesting issues
|
|
587
|
+
tag: "span",
|
|
588
|
+
size: !0,
|
|
589
|
+
pointerEvents: "none"
|
|
667
590
|
},
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
tag: "span",
|
|
677
|
-
size: !0,
|
|
678
|
-
pointerEvents: "none"
|
|
591
|
+
variants: {
|
|
592
|
+
size: {
|
|
593
|
+
"...": getSpacerSize
|
|
594
|
+
},
|
|
595
|
+
flex: {
|
|
596
|
+
true: {
|
|
597
|
+
flexGrow: 1
|
|
598
|
+
}
|
|
679
599
|
},
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
600
|
+
direction: {
|
|
601
|
+
horizontal: {
|
|
602
|
+
height: 0,
|
|
603
|
+
minHeight: 0
|
|
683
604
|
},
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
}
|
|
605
|
+
vertical: {
|
|
606
|
+
width: 0,
|
|
607
|
+
minWidth: 0
|
|
688
608
|
},
|
|
689
|
-
|
|
690
|
-
horizontal: {
|
|
691
|
-
height: 0,
|
|
692
|
-
minHeight: 0
|
|
693
|
-
},
|
|
694
|
-
vertical: {
|
|
695
|
-
width: 0,
|
|
696
|
-
minWidth: 0
|
|
697
|
-
},
|
|
698
|
-
both: {}
|
|
699
|
-
}
|
|
609
|
+
both: {}
|
|
700
610
|
}
|
|
701
|
-
}
|
|
611
|
+
}
|
|
612
|
+
});
|
|
702
613
|
function spacedChildren(props) {
|
|
703
|
-
var _childrenList__type,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
spaceFlex,
|
|
711
|
-
separator,
|
|
712
|
-
ensureKeys
|
|
713
|
-
} = props,
|
|
714
|
-
hasSpace = !!(space || spaceFlex),
|
|
715
|
-
hasSeparator = separator != null,
|
|
716
|
-
areChildrenArray = Array.isArray(children);
|
|
717
|
-
if (!ensureKeys && !(hasSpace || hasSeparator || isZStack)) return children;
|
|
718
|
-
var childrenList = areChildrenArray ? children : React.Children.toArray(children),
|
|
719
|
-
len = childrenList.length;
|
|
720
|
-
if (len <= 1 && !isZStack && !(!((_childrenList_ = childrenList[0]) === null || _childrenList_ === void 0 || (_childrenList__type = _childrenList_.type) === null || _childrenList__type === void 0) && _childrenList__type.shouldForwardSpace)) return children;
|
|
721
|
-
var final = [],
|
|
722
|
-
_iteratorNormalCompletion = !0,
|
|
723
|
-
_didIteratorError = !1,
|
|
724
|
-
_iteratorError = void 0;
|
|
614
|
+
var _childrenList__type, _childrenList_, { isZStack, children, space, direction, spaceFlex, separator, ensureKeys } = props, hasSpace = !!(space || spaceFlex), hasSeparator = separator != null, areChildrenArray = Array.isArray(children);
|
|
615
|
+
if (!ensureKeys && !(hasSpace || hasSeparator || isZStack))
|
|
616
|
+
return children;
|
|
617
|
+
var childrenList = areChildrenArray ? children : React.Children.toArray(children), len = childrenList.length;
|
|
618
|
+
if (len <= 1 && !isZStack && !(!((_childrenList_ = childrenList[0]) === null || _childrenList_ === void 0 || (_childrenList__type = _childrenList_.type) === null || _childrenList__type === void 0) && _childrenList__type.shouldForwardSpace))
|
|
619
|
+
return children;
|
|
620
|
+
var final = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
725
621
|
try {
|
|
726
622
|
for (var _iterator = childrenList.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
727
|
-
var [index, child] = _step.value,
|
|
728
|
-
|
|
729
|
-
isEmpty = child == null || Array.isArray(child) && child.length === 0;
|
|
730
|
-
if (!isEmpty && /* @__PURE__ */React.isValidElement(child) && !((_child_type = child.type) === null || _child_type === void 0) && _child_type.shouldForwardSpace && (child = /* @__PURE__ */React.cloneElement(child, {
|
|
623
|
+
var [index, child] = _step.value, _child_type, isEmpty = child == null || Array.isArray(child) && child.length === 0;
|
|
624
|
+
if (!isEmpty && /* @__PURE__ */ React.isValidElement(child) && (!((_child_type = child.type) === null || _child_type === void 0) && _child_type.shouldForwardSpace) && (child = /* @__PURE__ */ React.cloneElement(child, {
|
|
731
625
|
space,
|
|
732
626
|
spaceFlex,
|
|
733
627
|
separator,
|
|
734
628
|
key: child.key
|
|
735
|
-
})), isEmpty || !child || child.key && !isZStack ? final.push(child) : final.push(/* @__PURE__ */_jsx(React.Fragment, {
|
|
736
|
-
children: isZStack ? /* @__PURE__ */_jsx(AbsoluteFill, {
|
|
629
|
+
})), isEmpty || !child || child.key && !isZStack ? final.push(child) : final.push(/* @__PURE__ */ _jsx(React.Fragment, {
|
|
630
|
+
children: isZStack ? /* @__PURE__ */ _jsx(AbsoluteFill, {
|
|
737
631
|
children: child
|
|
738
632
|
}) : child
|
|
739
633
|
}, `${index}0t`)), !(isUnspaced(child) && index === 0) && !isZStack) {
|
|
@@ -743,7 +637,7 @@ function spacedChildren(props) {
|
|
|
743
637
|
direction,
|
|
744
638
|
space,
|
|
745
639
|
spaceFlex
|
|
746
|
-
})), final.push(/* @__PURE__ */_jsx(React.Fragment, {
|
|
640
|
+
})), final.push(/* @__PURE__ */ _jsx(React.Fragment, {
|
|
747
641
|
children: separator
|
|
748
642
|
}, `${index}03t`)), hasSpace && final.push(createSpacer({
|
|
749
643
|
key: `_${index}01t`,
|
|
@@ -764,24 +658,20 @@ function spacedChildren(props) {
|
|
|
764
658
|
try {
|
|
765
659
|
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
766
660
|
} finally {
|
|
767
|
-
if (_didIteratorError)
|
|
661
|
+
if (_didIteratorError)
|
|
662
|
+
throw _iteratorError;
|
|
768
663
|
}
|
|
769
664
|
}
|
|
770
665
|
return process.env.NODE_ENV === "development" && props.debug && log(" Spaced children", final, props), final;
|
|
771
666
|
}
|
|
772
667
|
function createSpacer(param) {
|
|
773
|
-
var {
|
|
774
|
-
|
|
775
|
-
direction,
|
|
776
|
-
space,
|
|
777
|
-
spaceFlex
|
|
778
|
-
} = param;
|
|
779
|
-
return /* @__PURE__ */_jsx(Spacer, {
|
|
668
|
+
var { key, direction, space, spaceFlex } = param;
|
|
669
|
+
return /* @__PURE__ */ _jsx(Spacer, {
|
|
780
670
|
size: space,
|
|
781
671
|
direction,
|
|
782
|
-
...
|
|
672
|
+
...typeof spaceFlex < "u" && {
|
|
783
673
|
flex: spaceFlex === !0 ? 1 : spaceFlex === !1 ? 0 : spaceFlex
|
|
784
|
-
}
|
|
674
|
+
}
|
|
785
675
|
}, key);
|
|
786
676
|
}
|
|
787
677
|
function isUnspaced(child) {
|
|
@@ -789,19 +679,24 @@ function isUnspaced(child) {
|
|
|
789
679
|
return t?.isVisuallyHidden || t?.isUnspaced;
|
|
790
680
|
}
|
|
791
681
|
var AbsoluteFill = createComponent({
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
682
|
+
defaultProps: {
|
|
683
|
+
...stackDefaultStyles,
|
|
684
|
+
flexDirection: "column",
|
|
685
|
+
position: "absolute",
|
|
686
|
+
top: 0,
|
|
687
|
+
right: 0,
|
|
688
|
+
bottom: 0,
|
|
689
|
+
left: 0,
|
|
690
|
+
pointerEvents: "box-none"
|
|
691
|
+
}
|
|
692
|
+
}), fromPx = function(val) {
|
|
693
|
+
return typeof val != "string" ? val : +val.replace("px", "");
|
|
694
|
+
};
|
|
695
|
+
export {
|
|
696
|
+
Spacer,
|
|
697
|
+
Unspaced,
|
|
698
|
+
componentSetStates,
|
|
699
|
+
createComponent,
|
|
700
|
+
spacedChildren
|
|
701
|
+
};
|
|
702
|
+
//# sourceMappingURL=createComponent.js.map
|