@tamagui/core 1.0.1-beta.21 → 1.0.1-beta.210
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 +16 -12
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/addTheme.js +80 -0
- package/dist/cjs/addTheme.js.map +7 -0
- package/dist/cjs/{conf.js → config.js} +34 -21
- package/dist/cjs/config.js.map +7 -0
- package/dist/cjs/constants/constants.js +17 -24
- package/dist/cjs/constants/constants.js.map +2 -2
- package/dist/cjs/{helpers/nativeGestureHandler.js → constants/isDevTools.js} +8 -8
- package/dist/cjs/constants/isDevTools.js.map +7 -0
- package/dist/cjs/constants/platform.js +32 -16
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/platform.native.js +62 -0
- package/dist/cjs/constants/platform.native.js.map +7 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +1 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/cjs/contexts/FontLanguageContext.js +30 -0
- package/dist/cjs/contexts/FontLanguageContext.js.map +7 -0
- package/dist/cjs/contexts/TextAncestorContext.js +30 -0
- package/dist/cjs/contexts/TextAncestorContext.js.map +7 -0
- package/dist/cjs/{ThemeContext.js → contexts/ThemeContext.js} +1 -0
- package/dist/cjs/contexts/ThemeContext.js.map +7 -0
- package/dist/cjs/createComponent.js +878 -509
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/createFont.js +5 -8
- package/dist/cjs/createFont.js.map +2 -2
- package/dist/cjs/createShorthands.js +1 -2
- package/dist/cjs/createShorthands.js.map +2 -2
- package/dist/cjs/createTamagui.js +134 -184
- package/dist/cjs/createTamagui.js.map +3 -3
- package/dist/cjs/createTheme.js +4 -2
- package/dist/cjs/createTheme.js.map +2 -2
- package/dist/cjs/createTokens.js +5 -25
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createVariable.js +51 -28
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariables.js +52 -0
- package/dist/cjs/createVariables.js.map +7 -0
- package/dist/cjs/helpers/RNComponents.js +12 -11
- package/dist/cjs/helpers/RNComponents.js.map +2 -2
- package/dist/cjs/{ThemeManager.js → helpers/ThemeManager.js} +55 -60
- package/dist/cjs/helpers/ThemeManager.js.map +7 -0
- package/dist/cjs/helpers/areEqualSets.js +3 -3
- package/dist/cjs/helpers/areEqualSets.js.map +1 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.js +188 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +7 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js +30 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +7 -0
- package/dist/cjs/helpers/cache.js +43 -0
- package/dist/cjs/helpers/cache.js.map +7 -0
- package/dist/cjs/helpers/calc.js +71 -0
- package/dist/cjs/helpers/calc.js.map +7 -0
- package/dist/cjs/helpers/createMediaStyle.js +26 -12
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +272 -122
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createProxy.js +43 -0
- package/dist/cjs/helpers/createProxy.js.map +7 -0
- package/dist/cjs/helpers/expandStyle.js +90 -0
- package/dist/cjs/helpers/expandStyle.js.map +7 -0
- package/dist/cjs/helpers/expandStyles.js +115 -0
- package/dist/cjs/helpers/expandStyles.js.map +7 -0
- package/dist/cjs/helpers/extendStaticConfig.js +48 -37
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/fixNativeShadow.js +3 -3
- package/dist/cjs/helpers/fixNativeShadow.js.map +1 -1
- package/dist/cjs/helpers/getAnimationDriver.js +32 -0
- package/dist/cjs/helpers/getAnimationDriver.js.map +7 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +4 -5
- package/dist/cjs/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/cjs/helpers/{getTextSize.js → getFont.js} +22 -12
- package/dist/cjs/helpers/getFont.js.map +7 -0
- package/dist/cjs/helpers/getFontLanguage.js +29 -0
- package/dist/cjs/helpers/getFontLanguage.js.map +7 -0
- package/dist/cjs/helpers/getSize.js +19 -10
- package/dist/cjs/helpers/getSize.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +557 -213
- package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
- package/dist/cjs/helpers/getStackSize.js +19 -38
- package/dist/cjs/helpers/getStackSize.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.js +177 -131
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js +1 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js +103 -0
- package/dist/cjs/helpers/getThemeCSSRules.js.map +7 -0
- package/dist/cjs/{nativeGestureHandler.native.js → helpers/getThemeCSSRules.native.js} +18 -5
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +7 -0
- package/dist/cjs/helpers/getVariantExtras.js +89 -0
- package/dist/cjs/helpers/getVariantExtras.js.map +7 -0
- package/dist/cjs/helpers/insertStyleRule.js +94 -51
- package/dist/cjs/helpers/insertStyleRule.js.map +3 -3
- package/dist/cjs/helpers/isObj.js +2 -2
- package/dist/cjs/helpers/isObj.js.map +1 -1
- package/dist/cjs/helpers/isTamaguiComponent.js +37 -0
- package/dist/cjs/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/cjs/helpers/isTamaguiElement.js +5 -5
- package/dist/cjs/helpers/isTamaguiElement.js.map +2 -2
- package/dist/cjs/helpers/matchMedia.js +7 -6
- package/dist/cjs/helpers/matchMedia.js.map +2 -2
- package/dist/cjs/helpers/matchMedia.native.js +6 -3
- package/dist/cjs/helpers/matchMedia.native.js.map +2 -2
- package/dist/cjs/helpers/mergeProps.js +54 -0
- package/dist/cjs/helpers/mergeProps.js.map +7 -0
- package/dist/cjs/helpers/mergeTransform.js +42 -0
- package/dist/cjs/helpers/mergeTransform.js.map +7 -0
- package/dist/cjs/helpers/normalizeColor.js +80 -0
- package/dist/cjs/helpers/normalizeColor.js.map +7 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js +123 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +4 -4
- package/dist/cjs/helpers/proxyThemeVariables.js.map +2 -2
- package/dist/cjs/helpers/pseudoDescriptors.js +42 -0
- package/dist/cjs/helpers/pseudoDescriptors.js.map +7 -0
- package/dist/cjs/helpers/registerCSSVariable.js +40 -0
- package/dist/cjs/helpers/registerCSSVariable.js.map +7 -0
- package/dist/cjs/helpers/{wrapThemeManagerContext.js → startTransition.js} +12 -15
- package/dist/cjs/helpers/startTransition.js.map +7 -0
- package/dist/cjs/helpers/themeable.js +17 -40
- package/dist/cjs/helpers/themeable.js.map +3 -3
- package/dist/cjs/helpers/themes.js +79 -0
- package/dist/cjs/helpers/themes.js.map +7 -0
- package/dist/cjs/helpers/useShallowSetState.js +44 -0
- package/dist/cjs/helpers/useShallowSetState.js.map +7 -0
- package/dist/cjs/helpers/validate.js +1 -122
- package/dist/cjs/helpers/validate.js.map +3 -3
- package/dist/cjs/helpers/withStaticProperties.js +3 -3
- package/dist/cjs/helpers/withStaticProperties.js.map +1 -1
- package/dist/cjs/hooks/getThemeUnwrapped.js +37 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +7 -0
- package/dist/cjs/hooks/useConstant.js +4 -2
- package/dist/cjs/hooks/useConstant.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/useId.js +3 -33
- package/dist/cjs/hooks/useId.js.map +2 -2
- package/dist/cjs/hooks/useIsMounted.js +3 -4
- package/dist/cjs/hooks/useIsMounted.js.map +2 -2
- package/dist/cjs/hooks/useIsTouchDevice.js +6 -12
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +166 -123
- package/dist/cjs/hooks/useMedia.js.map +3 -3
- package/dist/cjs/hooks/usePressable.js +4 -18
- package/dist/cjs/hooks/usePressable.js.map +1 -1
- package/dist/cjs/hooks/useSafeRef.js +58 -0
- package/dist/cjs/hooks/useSafeRef.js.map +7 -0
- package/dist/cjs/hooks/useServerHooks.js +36 -0
- package/dist/cjs/hooks/useServerHooks.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +168 -134
- package/dist/cjs/hooks/useTheme.js.map +3 -3
- package/dist/cjs/hooks/useUnmountEffect.js +1 -2
- package/dist/cjs/hooks/useUnmountEffect.js.map +1 -1
- package/dist/cjs/index.js +49 -26
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/inject-styles.js +40 -0
- package/dist/cjs/inject-styles.js.map +7 -0
- package/dist/cjs/injectStyles.js +40 -0
- package/dist/cjs/injectStyles.js.map +7 -0
- package/dist/cjs/insertFont.js +93 -0
- package/dist/cjs/insertFont.js.map +7 -0
- package/dist/cjs/react-native.js +22 -0
- package/dist/cjs/react-native.js.map +7 -0
- package/dist/cjs/setupReactNative.js +37 -0
- package/dist/cjs/setupReactNative.js.map +7 -0
- package/dist/cjs/static.js +2 -15
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/styled.js +57 -51
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types-rnw.js +1 -0
- package/dist/cjs/types-rnw.js.map +2 -2
- package/dist/cjs/types.js +1 -0
- package/dist/cjs/types.js.map +2 -2
- package/dist/cjs/updateTheme.js +47 -0
- package/dist/cjs/updateTheme.js.map +7 -0
- package/dist/cjs/vendor/Pressability.js +32 -0
- package/dist/cjs/vendor/Pressability.js.map +7 -0
- package/dist/cjs/vendor/Pressability.native.js +32 -0
- package/dist/cjs/vendor/Pressability.native.js.map +7 -0
- package/dist/cjs/views/FontLanguage.js +38 -0
- package/dist/cjs/views/FontLanguage.js.map +7 -0
- package/dist/cjs/views/FontLanguage.native.js +38 -0
- package/dist/cjs/views/FontLanguage.native.js.map +7 -0
- package/dist/cjs/{helpers/nativeGestureHandler.native.js → views/FontLanguage.types.js} +4 -5
- package/dist/cjs/views/FontLanguage.types.js.map +7 -0
- package/dist/cjs/views/Slot.js +64 -72
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/cjs/views/Stack.js +4 -19
- package/dist/cjs/views/Stack.js.map +2 -2
- package/dist/cjs/views/TamaguiProvider.js +86 -0
- package/dist/cjs/views/TamaguiProvider.js.map +7 -0
- package/dist/cjs/views/Text.js +32 -29
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/Theme.js +43 -21
- package/dist/cjs/views/Theme.js.map +3 -3
- package/dist/cjs/views/ThemeInverse.js +25 -25
- package/dist/cjs/views/ThemeInverse.js.map +2 -2
- package/dist/cjs/views/ThemeProvider.js +35 -23
- package/dist/cjs/views/ThemeProvider.js.map +3 -3
- package/dist/cjs/views/ThemeReset.js +26 -20
- package/dist/cjs/views/ThemeReset.js.map +3 -3
- package/dist/esm/Tamagui.js +11 -12
- package/dist/esm/Tamagui.js.map +2 -2
- package/dist/esm/addTheme.js +56 -0
- package/dist/esm/addTheme.js.map +7 -0
- package/dist/esm/config.js +44 -0
- package/dist/esm/config.js.map +7 -0
- package/dist/esm/constants/constants.js +12 -8
- package/dist/esm/constants/constants.js.map +2 -2
- package/dist/esm/constants/isDevTools.js +5 -0
- package/dist/esm/constants/isDevTools.js.map +7 -0
- package/dist/esm/constants/platform.js +25 -12
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/constants/platform.native.js +28 -0
- package/dist/esm/constants/platform.native.js.map +7 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js +0 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/esm/contexts/FontLanguageContext.js +6 -0
- package/dist/esm/contexts/FontLanguageContext.js.map +7 -0
- package/dist/esm/contexts/TextAncestorContext.js +6 -0
- package/dist/esm/contexts/TextAncestorContext.js.map +7 -0
- package/dist/esm/{ThemeContext.js → contexts/ThemeContext.js} +0 -0
- package/dist/esm/contexts/ThemeContext.js.map +7 -0
- package/dist/esm/createComponent.js +843 -416
- package/dist/esm/createComponent.js.map +3 -3
- package/dist/esm/createFont.js +4 -9
- package/dist/esm/createFont.js.map +2 -2
- package/dist/esm/createShorthands.js +0 -3
- package/dist/esm/createShorthands.js.map +2 -2
- package/dist/esm/createTamagui.js +133 -165
- package/dist/esm/createTamagui.js.map +3 -3
- package/dist/esm/createTheme.js +3 -3
- package/dist/esm/createTheme.js.map +2 -2
- package/dist/esm/createTokens.js +3 -24
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createVariable.js +46 -26
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariables.js +28 -0
- package/dist/esm/createVariables.js.map +7 -0
- package/dist/esm/helpers/RNComponents.js +11 -8
- package/dist/esm/helpers/RNComponents.js.map +2 -2
- package/dist/esm/{ThemeManager.js → helpers/ThemeManager.js} +54 -61
- package/dist/esm/helpers/ThemeManager.js.map +7 -0
- package/dist/esm/helpers/areEqualSets.js +2 -4
- package/dist/esm/helpers/areEqualSets.js.map +1 -1
- package/dist/esm/helpers/assignNativePropsToWeb.js +164 -0
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +7 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js +6 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +7 -0
- package/dist/esm/helpers/cache.js +18 -0
- package/dist/esm/helpers/cache.js.map +7 -0
- package/dist/esm/helpers/calc.js +47 -0
- package/dist/esm/helpers/calc.js.map +7 -0
- package/dist/esm/helpers/createMediaStyle.js +25 -13
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +267 -123
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createProxy.js +19 -0
- package/dist/esm/helpers/createProxy.js.map +7 -0
- package/dist/esm/helpers/expandStyle.js +66 -0
- package/dist/esm/helpers/expandStyle.js.map +7 -0
- package/dist/esm/helpers/expandStyles.js +89 -0
- package/dist/esm/helpers/expandStyles.js.map +7 -0
- package/dist/esm/helpers/extendStaticConfig.js +34 -28
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/fixNativeShadow.js +2 -4
- package/dist/esm/helpers/fixNativeShadow.js.map +1 -1
- package/dist/esm/helpers/getAnimationDriver.js +8 -0
- package/dist/esm/helpers/getAnimationDriver.js.map +7 -0
- package/dist/esm/helpers/getExpandedShorthands.js +2 -5
- package/dist/esm/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/esm/helpers/{getTextSize.js → getFont.js} +17 -9
- package/dist/esm/helpers/getFont.js.map +7 -0
- package/dist/esm/helpers/getFontLanguage.js +5 -0
- package/dist/esm/helpers/getFontLanguage.js.map +7 -0
- package/dist/esm/helpers/getSize.js +16 -10
- package/dist/esm/helpers/getSize.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +552 -197
- package/dist/esm/helpers/getSplitStyles.js.map +3 -3
- package/dist/esm/helpers/getStackSize.js +17 -37
- package/dist/esm/helpers/getStackSize.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +174 -108
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.native.js +0 -3
- package/dist/esm/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js +79 -0
- package/dist/esm/helpers/getThemeCSSRules.js.map +7 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js +7 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +7 -0
- package/dist/esm/helpers/getVariantExtras.js +64 -0
- package/dist/esm/helpers/getVariantExtras.js.map +7 -0
- package/dist/esm/helpers/insertStyleRule.js +89 -49
- package/dist/esm/helpers/insertStyleRule.js.map +3 -3
- package/dist/esm/helpers/isObj.js +1 -3
- package/dist/esm/helpers/isObj.js.map +1 -1
- package/dist/esm/helpers/isTamaguiComponent.js +13 -0
- package/dist/esm/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/esm/helpers/isTamaguiElement.js +4 -6
- package/dist/esm/helpers/isTamaguiElement.js.map +2 -2
- package/dist/esm/helpers/matchMedia.js +6 -7
- package/dist/esm/helpers/matchMedia.js.map +2 -2
- package/dist/esm/helpers/matchMedia.native.js +1 -3
- package/dist/esm/helpers/matchMedia.native.js.map +1 -1
- package/dist/esm/helpers/mergeProps.js +30 -0
- package/dist/esm/helpers/mergeProps.js.map +7 -0
- package/dist/esm/helpers/mergeTransform.js +17 -0
- package/dist/esm/helpers/mergeTransform.js.map +7 -0
- package/dist/esm/helpers/normalizeColor.js +49 -0
- package/dist/esm/helpers/normalizeColor.js.map +7 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js +98 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/esm/helpers/proxyThemeVariables.js +3 -5
- package/dist/esm/helpers/proxyThemeVariables.js.map +2 -2
- package/dist/esm/helpers/pseudoDescriptors.js +18 -0
- package/dist/esm/helpers/pseudoDescriptors.js.map +7 -0
- package/dist/esm/helpers/registerCSSVariable.js +14 -0
- package/dist/esm/helpers/registerCSSVariable.js.map +7 -0
- package/dist/esm/helpers/startTransition.js +6 -0
- package/dist/esm/helpers/startTransition.js.map +7 -0
- package/dist/esm/helpers/themeable.js +11 -9
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/helpers/themes.js +54 -0
- package/dist/esm/helpers/themes.js.map +7 -0
- package/dist/esm/helpers/useShallowSetState.js +20 -0
- package/dist/esm/helpers/useShallowSetState.js.map +7 -0
- package/dist/esm/helpers/validate.js +0 -75
- package/dist/esm/helpers/validate.js.map +3 -3
- package/dist/esm/helpers/withStaticProperties.js +2 -4
- package/dist/esm/helpers/withStaticProperties.js.map +1 -1
- package/dist/esm/hooks/getThemeUnwrapped.js +12 -0
- package/dist/esm/hooks/getThemeUnwrapped.js.map +7 -0
- package/dist/esm/hooks/useConstant.js +4 -4
- package/dist/esm/hooks/useConstant.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/useId.js +1 -31
- package/dist/esm/hooks/useId.js.map +2 -2
- package/dist/esm/hooks/useIsMounted.js +1 -4
- package/dist/esm/hooks/useIsMounted.js.map +2 -2
- package/dist/esm/hooks/useIsTouchDevice.js +5 -13
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +159 -113
- package/dist/esm/hooks/useMedia.js.map +3 -3
- package/dist/esm/hooks/usePressable.js +2 -4
- package/dist/esm/hooks/usePressable.js.map +1 -1
- package/dist/esm/hooks/useSafeRef.js +34 -0
- package/dist/esm/hooks/useSafeRef.js.map +7 -0
- package/dist/esm/hooks/useServerHooks.js +11 -0
- package/dist/esm/hooks/useServerHooks.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +161 -111
- package/dist/esm/hooks/useTheme.js.map +3 -3
- package/dist/esm/hooks/useUnmountEffect.js +0 -3
- package/dist/esm/hooks/useUnmountEffect.js.map +1 -1
- package/dist/esm/index.js +44 -18
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/inject-styles.js +16 -0
- package/dist/esm/inject-styles.js.map +7 -0
- package/dist/esm/injectStyles.js +16 -0
- package/dist/esm/injectStyles.js.map +7 -0
- package/dist/esm/insertFont.js +67 -0
- package/dist/esm/insertFont.js.map +7 -0
- package/dist/esm/react-native.js +3 -0
- package/dist/esm/react-native.js.map +7 -0
- package/dist/esm/setupReactNative.js +12 -0
- package/dist/esm/setupReactNative.js.map +7 -0
- package/dist/esm/static.js +1 -15
- package/dist/esm/static.js.map +2 -2
- package/dist/esm/styled.js +50 -19
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/types-rnw.js +0 -0
- package/dist/esm/types-rnw.js.map +0 -0
- package/dist/esm/types.js +0 -0
- package/dist/esm/types.js.map +0 -0
- package/dist/esm/updateTheme.js +23 -0
- package/dist/esm/updateTheme.js.map +7 -0
- package/dist/esm/vendor/Pressability.js +7 -0
- package/dist/esm/vendor/Pressability.js.map +7 -0
- package/dist/esm/vendor/Pressability.native.js +7 -0
- package/dist/esm/vendor/Pressability.native.js.map +7 -0
- package/dist/esm/views/FontLanguage.js +14 -0
- package/dist/esm/views/FontLanguage.js.map +7 -0
- package/dist/esm/views/FontLanguage.native.js +14 -0
- package/dist/esm/views/FontLanguage.native.js.map +7 -0
- package/dist/esm/views/FontLanguage.types.js +1 -0
- package/dist/{cjs/defaultComponentState.js.map → esm/views/FontLanguage.types.js.map} +0 -0
- package/dist/esm/views/Slot.js +55 -37
- package/dist/esm/views/Slot.js.map +2 -2
- package/dist/esm/views/Stack.js +0 -0
- package/dist/esm/views/Stack.js.map +2 -2
- package/dist/esm/views/TamaguiProvider.js +56 -0
- package/dist/esm/views/TamaguiProvider.js.map +7 -0
- package/dist/esm/views/Text.js +17 -5
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/esm/views/Theme.js +35 -19
- package/dist/esm/views/Theme.js.map +3 -3
- package/dist/esm/views/ThemeInverse.js +22 -20
- package/dist/esm/views/ThemeInverse.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +28 -21
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/dist/esm/views/ThemeReset.js +21 -20
- package/dist/esm/views/ThemeReset.js.map +2 -2
- package/package.json +52 -16
- package/reset.css +25 -4
- package/src/Tamagui.ts +48 -0
- package/src/addTheme.ts +68 -0
- package/src/config.ts +44 -0
- package/src/constants/constants.ts +19 -0
- package/src/constants/isDevTools.ts +6 -0
- package/src/contexts/ButtonInsideButtonContext.tsx +3 -0
- package/src/contexts/FontLanguageContext.tsx +5 -0
- package/src/contexts/TextAncestorContext.tsx +3 -0
- package/src/contexts/ThemeContext.tsx +5 -0
- package/src/createComponent.tsx +1460 -0
- package/src/createFont.ts +29 -0
- package/src/createShorthands.ts +7 -0
- package/src/createTamagui.ts +225 -0
- package/src/createTheme.ts +13 -0
- package/src/createTokens.ts +35 -0
- package/src/createVariable.ts +83 -0
- package/src/createVariables.ts +42 -0
- package/src/helpers/RNComponents.tsx +14 -0
- package/src/helpers/ThemeManager.tsx +227 -0
- package/src/helpers/areEqualSets.tsx +9 -0
- package/src/helpers/cache.ts +18 -0
- package/src/helpers/createMediaStyle.ts +55 -0
- package/src/helpers/createPropMapper.ts +526 -0
- package/src/helpers/createProxy.ts +16 -0
- package/src/helpers/expandStyle.ts +81 -0
- package/src/helpers/expandStyles.ts +106 -0
- package/src/helpers/extendStaticConfig.ts +75 -0
- package/src/helpers/fixNativeShadow.tsx +2 -0
- package/src/helpers/getAnimationDriver.tsx +5 -0
- package/src/helpers/getExpandedShorthands.ts +15 -0
- package/src/helpers/getFontLanguage.ts +2 -0
- package/src/helpers/getSize.ts +22 -0
- package/src/helpers/getSplitStyles.tsx +901 -0
- package/src/helpers/getStylesAtomic.native.ts +3 -0
- package/src/helpers/getStylesAtomic.ts +272 -0
- package/src/helpers/getThemeCSSRules.native.ts +3 -0
- package/src/helpers/getThemeCSSRules.ts +105 -0
- package/src/helpers/getVariantExtras.tsx +85 -0
- package/src/helpers/insertStyleRule.tsx +163 -0
- package/src/helpers/isObj.ts +1 -0
- package/src/helpers/isTamaguiComponent.tsx +15 -0
- package/src/helpers/isTamaguiElement.tsx +12 -0
- package/src/helpers/matchMedia.native.ts +6 -0
- package/src/helpers/matchMedia.ts +17 -0
- package/src/helpers/mergeProps.ts +56 -0
- package/src/helpers/mergeTransform.ts +16 -0
- package/src/helpers/normalizeColor.ts +53 -0
- package/src/helpers/normalizeValueWithProperty.ts +110 -0
- package/src/helpers/proxyThemeVariables.tsx +15 -0
- package/src/helpers/pseudoDescriptors.ts +18 -0
- package/src/helpers/registerCSSVariable.ts +11 -0
- package/src/helpers/themeable.tsx +40 -0
- package/src/helpers/themes.ts +69 -0
- package/src/helpers/useShallowSetState.tsx +19 -0
- package/src/helpers/withStaticProperties.tsx +7 -0
- package/src/hooks/getThemeUnwrapped.tsx +7 -0
- package/src/hooks/useElementLayout.tsx +90 -0
- package/src/hooks/useId.tsx +1 -0
- package/src/hooks/useIsTouchDevice.tsx +6 -0
- package/src/hooks/useMedia.tsx +265 -0
- package/src/hooks/useSafeRef.ts +48 -0
- package/src/hooks/useServerHooks.tsx +12 -0
- package/src/hooks/useTheme.tsx +300 -0
- package/src/index.ts +74 -0
- package/src/inject-styles.ts +20 -0
- package/src/insertFont.ts +70 -0
- package/src/setupReactNative.ts +9 -0
- package/src/static.ts +5 -0
- package/src/styled.tsx +204 -0
- package/src/types-rnw.tsx +162 -0
- package/src/types.tsx +1327 -0
- package/src/updateTheme.ts +23 -0
- package/src/vendor/Pressability.native.tsx +3 -0
- package/src/vendor/Pressability.tsx +2 -0
- package/src/views/FontLanguage.native.tsx +10 -0
- package/src/views/FontLanguage.tsx +18 -0
- package/src/views/FontLanguage.types.ts +13 -0
- package/src/views/Slot.tsx +147 -0
- package/src/views/Stack.tsx +24 -0
- package/src/views/TamaguiProvider.tsx +60 -0
- package/src/views/Text.tsx +86 -0
- package/src/views/Theme.tsx +72 -0
- package/src/views/ThemeInverse.tsx +33 -0
- package/src/views/ThemeProvider.tsx +63 -0
- package/src/views/ThemeReset.tsx +43 -0
- package/types/Tamagui.d.ts +11 -11
- package/types/addTheme.d.ts +11 -0
- package/types/config.d.ts +47 -0
- package/types/constants/constants.d.ts +15 -4
- package/types/constants/isDevTools.d.ts +2 -0
- package/types/constants/platform.d.ts +7 -6
- package/types/constants/platform.native.d.ts +13 -0
- package/types/contexts/FontLanguageContext.d.ts +5 -0
- package/types/contexts/TextAncestorContext.d.ts +3 -0
- package/types/{ThemeContext.d.ts → contexts/ThemeContext.d.ts} +1 -1
- package/types/createComponent.d.ts +16 -14
- package/types/createShorthands.d.ts +2 -1
- package/types/createTamagui.d.ts +2 -17
- package/types/createTheme.d.ts +1 -1
- package/types/createTokens.d.ts +5 -6
- package/types/createVariable.d.ts +24 -12
- package/types/createVariables.d.ts +10 -0
- package/types/helpers/RNComponents.d.ts +1 -1
- package/types/helpers/ThemeManager.d.ts +45 -0
- package/types/helpers/assignNativePropsToWeb.d.ts +2 -0
- package/types/helpers/assignNativePropsToWeb.native.d.ts +2 -0
- package/types/helpers/cache.d.ts +12 -0
- package/types/helpers/calc.d.ts +1 -0
- package/types/helpers/createMediaStyle.d.ts +2 -4
- package/types/helpers/createPropMapper.d.ts +6 -3
- package/types/helpers/createProxy.d.ts +2 -0
- package/types/helpers/expandStyle.d.ts +6 -0
- package/types/helpers/expandStyles.d.ts +26 -0
- package/types/helpers/getAnimationDriver.d.ts +6 -0
- package/types/helpers/getFont.d.ts +3 -0
- package/types/helpers/getFontLanguage.d.ts +2 -0
- package/types/helpers/getSize.d.ts +3 -2
- package/types/helpers/getSplitStyles.d.ts +15 -12
- package/types/helpers/getStackSize.d.ts +6 -30
- package/types/helpers/getStylesAtomic.d.ts +14 -23
- package/types/helpers/getThemeCSSRules.d.ts +8 -0
- package/types/helpers/getThemeCSSRules.native.d.ts +2 -0
- package/types/helpers/getVariantExtras.d.ts +5 -0
- package/types/helpers/insertStyleRule.d.ts +8 -4
- package/types/helpers/isTamaguiComponent.d.ts +5 -0
- package/types/helpers/isTamaguiElement.d.ts +5 -1
- package/types/helpers/matchMedia.d.ts +1 -1
- package/types/helpers/mergeProps.d.ts +17 -0
- package/types/helpers/mergeTransform.d.ts +7 -0
- package/types/helpers/normalizeColor.d.ts +3 -0
- package/types/helpers/normalizeValueWithProperty.d.ts +7 -0
- package/types/helpers/pseudoDescriptors.d.ts +16 -0
- package/types/helpers/registerCSSVariable.d.ts +5 -0
- package/types/helpers/startTransition.d.ts +3 -0
- package/types/helpers/themeable.d.ts +4 -7
- package/types/helpers/themes.d.ts +4 -0
- package/types/helpers/useShallowSetState.d.ts +3 -0
- package/types/helpers/validate.d.ts +0 -3
- package/types/hooks/getThemeUnwrapped.d.ts +3 -0
- package/types/hooks/useElementLayout.d.ts +27 -0
- package/types/hooks/useId.d.ts +1 -8
- package/types/hooks/useMedia.d.ts +22 -6
- package/types/hooks/useMedia.test.d.ts +1 -0
- package/types/hooks/usePressablePressResponder.d.ts +84 -0
- package/types/hooks/useSafeRef.d.ts +4 -0
- package/types/hooks/useServerHooks.d.ts +4 -0
- package/types/hooks/useTheme.d.ts +22 -32
- package/types/index.d.ts +25 -14
- package/types/inject-styles.d.ts +7 -0
- package/types/injectStyles.d.ts +7 -0
- package/types/insertFont.d.ts +9 -0
- package/types/react-native.d.ts +8 -0
- package/types/setupReactNative.d.ts +3 -0
- package/types/static.d.ts +1 -15
- package/types/styled.d.ts +7 -3
- package/types/types.d.ts +314 -108
- package/types/updateTheme.d.ts +9 -0
- package/types/vendor/Pressability.d.ts +3 -0
- package/types/vendor/Pressability.native.d.ts +3 -0
- package/types/views/AbsoluteFill.d.ts +5 -0
- package/types/views/AbsoluteFill.native.d.ts +3 -0
- package/types/views/FontLanguage.d.ts +4 -0
- package/types/views/FontLanguage.native.d.ts +4 -0
- package/types/views/FontLanguage.types.d.ts +11 -0
- package/types/views/Slot.d.ts +5 -4
- package/types/views/Stack.d.ts +1 -1
- package/types/views/TamaguiProvider.d.ts +4 -0
- package/types/views/Text.d.ts +1 -1
- package/types/views/Theme.d.ts +3 -9
- package/types/views/ThemeInverse.d.ts +4 -8
- package/types/views/ThemeProvider.d.ts +2 -1
- package/dist/cjs/ThemeContext.js.map +0 -7
- package/dist/cjs/ThemeManager.js.map +0 -7
- package/dist/cjs/conf.js.map +0 -7
- package/dist/cjs/constants/rnw.js +0 -46
- package/dist/cjs/constants/rnw.js.map +0 -7
- package/dist/cjs/defaultComponentState.js +0 -1
- package/dist/cjs/helpers/addStylesUsingClassname.js +0 -87
- package/dist/cjs/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/cjs/helpers/createShallowUpdate.js +0 -55
- package/dist/cjs/helpers/createShallowUpdate.js.map +0 -7
- package/dist/cjs/helpers/createTamaguiProvider.js +0 -93
- package/dist/cjs/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/cjs/helpers/fixNativeShadow.native.js +0 -53
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/cjs/helpers/getButtonSize.js +0 -45
- package/dist/cjs/helpers/getButtonSize.js.map +0 -7
- package/dist/cjs/helpers/getTextSize.js.map +0 -7
- package/dist/cjs/helpers/nativeGestureHandler.js.map +0 -7
- package/dist/cjs/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/cjs/helpers/wrapThemeManagerContext.js.map +0 -7
- package/dist/cjs/hooks/useFeatures.js +0 -228
- package/dist/cjs/hooks/useFeatures.js.map +0 -7
- package/dist/cjs/hooks/usePrevious.js +0 -1
- package/dist/cjs/hooks/usePrevious.js.map +0 -7
- package/dist/cjs/nativeGestureHandler.native.js.map +0 -7
- package/dist/cjs/views/TextAncestorContext.js +0 -45
- package/dist/cjs/views/TextAncestorContext.js.map +0 -7
- package/dist/esm/ThemeContext.js.map +0 -7
- package/dist/esm/ThemeManager.js.map +0 -7
- package/dist/esm/conf.js +0 -36
- package/dist/esm/conf.js.map +0 -7
- package/dist/esm/constants/rnw.js +0 -24
- package/dist/esm/constants/rnw.js.map +0 -7
- package/dist/esm/defaultComponentState.js +0 -1
- package/dist/esm/defaultComponentState.js.map +0 -7
- package/dist/esm/helpers/addStylesUsingClassname.js +0 -64
- package/dist/esm/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/esm/helpers/createShallowUpdate.js +0 -19
- package/dist/esm/helpers/createShallowUpdate.js.map +0 -7
- package/dist/esm/helpers/createTamaguiProvider.js +0 -40
- package/dist/esm/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/esm/helpers/fixNativeShadow.native.js +0 -32
- package/dist/esm/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/esm/helpers/getButtonSize.js +0 -24
- package/dist/esm/helpers/getButtonSize.js.map +0 -7
- package/dist/esm/helpers/getTextSize.js.map +0 -7
- package/dist/esm/helpers/nativeGestureHandler.js +0 -7
- package/dist/esm/helpers/nativeGestureHandler.js.map +0 -7
- package/dist/esm/helpers/nativeGestureHandler.native.js +0 -2
- package/dist/esm/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/esm/helpers/wrapThemeManagerContext.js +0 -14
- package/dist/esm/helpers/wrapThemeManagerContext.js.map +0 -7
- package/dist/esm/hooks/useFeatures.js +0 -173
- package/dist/esm/hooks/useFeatures.js.map +0 -7
- package/dist/esm/hooks/usePrevious.js +0 -1
- package/dist/esm/hooks/usePrevious.js.map +0 -7
- package/dist/esm/nativeGestureHandler.native.js +0 -2
- package/dist/esm/nativeGestureHandler.native.js.map +0 -7
- package/dist/esm/views/TextAncestorContext.js +0 -18
- package/dist/esm/views/TextAncestorContext.js.map +0 -7
- package/dist/jsx/Tamagui.js +0 -41
- package/dist/jsx/ThemeContext.js +0 -5
- package/dist/jsx/ThemeManager.js +0 -186
- package/dist/jsx/conf.js +0 -35
- package/dist/jsx/constants/constants.js +0 -17
- package/dist/jsx/constants/platform.js +0 -25
- package/dist/jsx/constants/rnw.js +0 -23
- package/dist/jsx/contexts/ButtonInsideButtonContext.js +0 -5
- package/dist/jsx/createComponent.js +0 -636
- package/dist/jsx/createFont.js +0 -27
- package/dist/jsx/createShorthands.js +0 -9
- package/dist/jsx/createTamagui.js +0 -201
- package/dist/jsx/createTheme.js +0 -6
- package/dist/jsx/createTokens.js +0 -28
- package/dist/jsx/createVariable.js +0 -48
- package/dist/jsx/defaultComponentState.js +0 -0
- package/dist/jsx/helpers/RNComponents.js +0 -11
- package/dist/jsx/helpers/addStylesUsingClassname.js +0 -63
- package/dist/jsx/helpers/areEqualSets.js +0 -15
- package/dist/jsx/helpers/createMediaStyle.js +0 -30
- package/dist/jsx/helpers/createPropMapper.js +0 -237
- package/dist/jsx/helpers/createShallowUpdate.js +0 -18
- package/dist/jsx/helpers/createTamaguiProvider.js +0 -34
- package/dist/jsx/helpers/extendStaticConfig.js +0 -61
- package/dist/jsx/helpers/fixNativeShadow.js +0 -7
- package/dist/jsx/helpers/fixNativeShadow.native.js +0 -31
- package/dist/jsx/helpers/getButtonSize.js +0 -23
- package/dist/jsx/helpers/getExpandedShorthands.js +0 -18
- package/dist/jsx/helpers/getSize.js +0 -12
- package/dist/jsx/helpers/getSplitStyles.js +0 -322
- package/dist/jsx/helpers/getStackSize.js +0 -41
- package/dist/jsx/helpers/getStylesAtomic.js +0 -130
- package/dist/jsx/helpers/getStylesAtomic.native.js +0 -9
- package/dist/jsx/helpers/getTextSize.js +0 -33
- package/dist/jsx/helpers/insertStyleRule.js +0 -94
- package/dist/jsx/helpers/isObj.js +0 -6
- package/dist/jsx/helpers/isTamaguiElement.js +0 -10
- package/dist/jsx/helpers/matchMedia.js +0 -17
- package/dist/jsx/helpers/matchMedia.native.js +0 -8
- package/dist/jsx/helpers/nativeGestureHandler.js +0 -6
- package/dist/jsx/helpers/nativeGestureHandler.native.js +0 -1
- package/dist/jsx/helpers/proxyThemeVariables.js +0 -17
- package/dist/jsx/helpers/themeable.js +0 -24
- package/dist/jsx/helpers/validate.js +0 -75
- package/dist/jsx/helpers/withStaticProperties.js +0 -9
- package/dist/jsx/helpers/wrapThemeManagerContext.js +0 -10
- package/dist/jsx/hooks/useConstant.js +0 -14
- package/dist/jsx/hooks/useFeatures.js +0 -167
- package/dist/jsx/hooks/useId.js +0 -34
- package/dist/jsx/hooks/useIsMounted.js +0 -18
- package/dist/jsx/hooks/useIsTouchDevice.js +0 -16
- package/dist/jsx/hooks/useMedia.js +0 -158
- package/dist/jsx/hooks/usePressable.js +0 -13
- package/dist/jsx/hooks/usePrevious.js +0 -0
- package/dist/jsx/hooks/useTheme.js +0 -177
- package/dist/jsx/hooks/useUnmountEffect.js +0 -10
- package/dist/jsx/index.js +0 -54
- package/dist/jsx/nativeGestureHandler.native.js +0 -1
- package/dist/jsx/static.js +0 -16
- package/dist/jsx/styled.js +0 -47
- package/dist/jsx/types-rnw.js +0 -0
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/views/Slot.js +0 -75
- package/dist/jsx/views/Stack.js +0 -12
- package/dist/jsx/views/Text.js +0 -56
- package/dist/jsx/views/TextAncestorContext.js +0 -15
- package/dist/jsx/views/Theme.js +0 -31
- package/dist/jsx/views/ThemeInverse.js +0 -27
- package/dist/jsx/views/ThemeProvider.js +0 -35
- package/dist/jsx/views/ThemeReset.js +0 -34
- package/types/Tamagui.d.ts.map +0 -1
- package/types/ThemeContext.d.ts.map +0 -1
- package/types/ThemeManager.d.ts +0 -49
- package/types/ThemeManager.d.ts.map +0 -1
- package/types/conf.d.ts +0 -27
- package/types/conf.d.ts.map +0 -1
- package/types/constants/constants.d.ts.map +0 -1
- package/types/constants/platform.d.ts.map +0 -1
- package/types/constants/rnw.d.ts +0 -2
- package/types/constants/rnw.d.ts.map +0 -1
- package/types/contexts/ButtonInsideButtonContext.d.ts.map +0 -1
- package/types/createComponent.d.ts.map +0 -1
- package/types/createFont.d.ts.map +0 -1
- package/types/createShorthands.d.ts.map +0 -1
- package/types/createTamagui.d.ts.map +0 -1
- package/types/createTheme.d.ts.map +0 -1
- package/types/createTokens.d.ts.map +0 -1
- package/types/createVariable.d.ts.map +0 -1
- package/types/defaultComponentState.d.ts +0 -1
- package/types/defaultComponentState.d.ts.map +0 -1
- package/types/helpers/RNComponents.d.ts.map +0 -1
- package/types/helpers/addStylesUsingClassname.d.ts +0 -3
- package/types/helpers/addStylesUsingClassname.d.ts.map +0 -1
- package/types/helpers/areEqualSets.d.ts.map +0 -1
- package/types/helpers/createMediaStyle.d.ts.map +0 -1
- package/types/helpers/createPropMapper.d.ts.map +0 -1
- package/types/helpers/createShallowUpdate.d.ts +0 -4
- package/types/helpers/createShallowUpdate.d.ts.map +0 -1
- package/types/helpers/createTamaguiProvider.d.ts +0 -7
- package/types/helpers/createTamaguiProvider.d.ts.map +0 -1
- package/types/helpers/extendStaticConfig.d.ts.map +0 -1
- package/types/helpers/fixNativeShadow.d.ts.map +0 -1
- package/types/helpers/fixNativeShadow.native.d.ts +0 -3
- package/types/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/types/helpers/getButtonSize.d.ts +0 -8
- package/types/helpers/getButtonSize.d.ts.map +0 -1
- package/types/helpers/getExpandedShorthands.d.ts.map +0 -1
- package/types/helpers/getSize.d.ts.map +0 -1
- package/types/helpers/getSplitStyles.d.ts.map +0 -1
- package/types/helpers/getStackSize.d.ts.map +0 -1
- package/types/helpers/getStylesAtomic.d.ts.map +0 -1
- package/types/helpers/getStylesAtomic.native.d.ts.map +0 -1
- package/types/helpers/getTextSize.d.ts +0 -3
- package/types/helpers/getTextSize.d.ts.map +0 -1
- package/types/helpers/insertStyleRule.d.ts.map +0 -1
- package/types/helpers/isObj.d.ts.map +0 -1
- package/types/helpers/isTamaguiElement.d.ts.map +0 -1
- package/types/helpers/matchMedia.d.ts.map +0 -1
- package/types/helpers/matchMedia.native.d.ts.map +0 -1
- package/types/helpers/nativeGestureHandler.d.ts +0 -2
- package/types/helpers/nativeGestureHandler.d.ts.map +0 -1
- package/types/helpers/nativeGestureHandler.native.d.ts +0 -2
- package/types/helpers/nativeGestureHandler.native.d.ts.map +0 -1
- package/types/helpers/proxyThemeVariables.d.ts.map +0 -1
- package/types/helpers/themeable.d.ts.map +0 -1
- package/types/helpers/validate.d.ts.map +0 -1
- package/types/helpers/withStaticProperties.d.ts.map +0 -1
- package/types/helpers/wrapThemeManagerContext.d.ts +0 -3
- package/types/helpers/wrapThemeManagerContext.d.ts.map +0 -1
- package/types/hooks/useConstant.d.ts.map +0 -1
- package/types/hooks/useFeatures.d.ts +0 -18
- package/types/hooks/useFeatures.d.ts.map +0 -1
- package/types/hooks/useId.d.ts.map +0 -1
- package/types/hooks/useIsMounted.d.ts.map +0 -1
- package/types/hooks/useIsTouchDevice.d.ts.map +0 -1
- package/types/hooks/useMedia.d.ts.map +0 -1
- package/types/hooks/usePressable.d.ts.map +0 -1
- package/types/hooks/usePrevious.d.ts +0 -1
- package/types/hooks/usePrevious.d.ts.map +0 -1
- package/types/hooks/useTheme.d.ts.map +0 -1
- package/types/hooks/useUnmountEffect.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/nativeGestureHandler.native.d.ts +0 -2
- package/types/nativeGestureHandler.native.d.ts.map +0 -1
- package/types/static.d.ts.map +0 -1
- package/types/styled.d.ts.map +0 -1
- package/types/types-rnw.d.ts.map +0 -1
- package/types/types.d.ts.map +0 -1
- package/types/views/Slot.d.ts.map +0 -1
- package/types/views/Stack.d.ts.map +0 -1
- package/types/views/Text.d.ts.map +0 -1
- package/types/views/TextAncestorContext.d.ts +0 -5
- package/types/views/TextAncestorContext.d.ts.map +0 -1
- package/types/views/Theme.d.ts.map +0 -1
- package/types/views/ThemeInverse.d.ts.map +0 -1
- package/types/views/ThemeProvider.d.ts.map +0 -1
- package/types/views/ThemeReset.d.ts.map +0 -1
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
+
import { isClient, isRSC, isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
4
|
+
import {
|
|
5
|
+
composeEventHandlers,
|
|
6
|
+
stylePropsView,
|
|
7
|
+
validPseudoKeys,
|
|
8
|
+
validStyles
|
|
9
|
+
} from "@tamagui/helpers";
|
|
10
|
+
import { useResponderEvents } from "@tamagui/react-native-use-responder-events";
|
|
4
11
|
import { useForceUpdate } from "@tamagui/use-force-update";
|
|
5
12
|
import React, {
|
|
6
13
|
Children,
|
|
@@ -10,210 +17,292 @@ import React, {
|
|
|
10
17
|
memo,
|
|
11
18
|
useCallback,
|
|
12
19
|
useContext,
|
|
13
|
-
|
|
14
|
-
useState
|
|
20
|
+
useEffect
|
|
15
21
|
} from "react";
|
|
16
|
-
import {
|
|
17
|
-
import { onConfiguredOnce } from "./conf";
|
|
22
|
+
import { onConfiguredOnce } from "./config";
|
|
18
23
|
import { stackDefaultStyles } from "./constants/constants";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { createShallowUpdate } from "./helpers/createShallowUpdate";
|
|
24
|
+
import { FontLanguageContext } from "./contexts/FontLanguageContext";
|
|
25
|
+
import { TextAncestorContext } from "./contexts/TextAncestorContext";
|
|
22
26
|
import { extendStaticConfig, parseStaticConfig } from "./helpers/extendStaticConfig";
|
|
23
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
getSubStyle,
|
|
29
|
+
insertSplitStyles,
|
|
30
|
+
useSplitStyles
|
|
31
|
+
} from "./helpers/getSplitStyles";
|
|
24
32
|
import { getAllSelectors } from "./helpers/insertStyleRule";
|
|
25
|
-
import {
|
|
33
|
+
import { mergeProps } from "./helpers/mergeProps";
|
|
26
34
|
import { proxyThemeVariables } from "./helpers/proxyThemeVariables";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
35
|
+
import { useShallowSetState } from "./helpers/useShallowSetState";
|
|
36
|
+
import { getRect, measureLayout, useElementLayout } from "./hooks/useElementLayout";
|
|
37
|
+
import { addMediaQueryListener, getInitialMediaState } from "./hooks/useMedia";
|
|
38
|
+
import { useServerRef, useServerState } from "./hooks/useServerHooks";
|
|
39
|
+
import { getThemeManager, useTheme } from "./hooks/useTheme";
|
|
40
|
+
import { usePressability } from "./vendor/Pressability";
|
|
41
|
+
import { Slot, mergeEvent } from "./views/Slot";
|
|
42
|
+
import { wrapThemeManagerContext } from "./views/Theme";
|
|
34
43
|
React["keep"];
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
44
|
+
process.env.TAMAGUI_TARGET;
|
|
45
|
+
let defaultComponentState = null;
|
|
46
|
+
let defaultComponentStateMounted = null;
|
|
47
|
+
let tamaguiConfig;
|
|
48
|
+
let AnimatedText;
|
|
49
|
+
let AnimatedView;
|
|
50
|
+
let initialTheme;
|
|
43
51
|
const mouseUps = /* @__PURE__ */ new Set();
|
|
44
52
|
if (typeof document !== "undefined") {
|
|
45
|
-
|
|
46
|
-
mouseUps.forEach((x) => x());
|
|
47
|
-
mouseUps.clear();
|
|
48
|
-
});
|
|
49
|
-
document.addEventListener("touchend", () => {
|
|
50
|
-
mouseUps.forEach((x) => x());
|
|
51
|
-
mouseUps.clear();
|
|
52
|
-
});
|
|
53
|
-
document.addEventListener("touchcancel", () => {
|
|
53
|
+
const cancelTouches = () => {
|
|
54
54
|
mouseUps.forEach((x) => x());
|
|
55
55
|
mouseUps.clear();
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
|
+
document.addEventListener("mouseup", cancelTouches);
|
|
58
|
+
document.addEventListener("touchend", cancelTouches);
|
|
59
|
+
document.addEventListener("touchcancel", cancelTouches);
|
|
57
60
|
}
|
|
58
61
|
function mergeShorthands({ defaultProps }, { shorthands }) {
|
|
59
|
-
for (const key
|
|
62
|
+
for (const key of Object.keys(defaultProps)) {
|
|
60
63
|
defaultProps[shorthands[key] || key] = defaultProps[key];
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
let
|
|
66
|
+
let BaseText;
|
|
67
|
+
let BaseView;
|
|
68
|
+
if (process.env.TAMAGUI_TARGET === "native") {
|
|
69
|
+
const native = require("react-native");
|
|
70
|
+
BaseText = native.Text || native.default.Text;
|
|
71
|
+
BaseView = native.View || native.default.View;
|
|
72
|
+
}
|
|
65
73
|
function createComponent(configIn, ParentComponent) {
|
|
66
74
|
const staticConfig = (() => {
|
|
67
|
-
const
|
|
68
|
-
if ("parsed" in
|
|
69
|
-
return
|
|
75
|
+
const next = extendStaticConfig(configIn, ParentComponent);
|
|
76
|
+
if ("parsed" in next) {
|
|
77
|
+
return next;
|
|
70
78
|
} else {
|
|
71
|
-
return parseStaticConfig(
|
|
79
|
+
return parseStaticConfig(next);
|
|
72
80
|
}
|
|
73
81
|
})();
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
let AnimatedText;
|
|
77
|
-
let AnimatedView;
|
|
78
|
-
let avoidClasses = true;
|
|
82
|
+
const defaultComponentClassName = `is_${staticConfig.componentName}`;
|
|
83
|
+
const avoidClassesWhileAnimating = true;
|
|
79
84
|
let defaultNativeStyle;
|
|
80
|
-
let defaultNativeStyleSheet;
|
|
81
85
|
let tamaguiDefaultProps;
|
|
86
|
+
let defaultTag;
|
|
82
87
|
let initialSplitStyles;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
const component = forwardRef((propsIn, forwardedRef) => {
|
|
89
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
90
|
+
let props;
|
|
91
|
+
if (tamaguiDefaultProps && !propsIn.asChild) {
|
|
92
|
+
props = mergeProps(tamaguiDefaultProps, propsIn)[0];
|
|
93
|
+
} else {
|
|
94
|
+
props = propsIn;
|
|
89
95
|
}
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
const debugProp = props["debug"];
|
|
97
|
+
const { Component, isText, isZStack } = staticConfig;
|
|
98
|
+
const componentName = props.componentName || staticConfig.componentName;
|
|
99
|
+
const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
|
|
100
|
+
const forceUpdate = useForceUpdate();
|
|
101
|
+
const theme = useTheme(props.theme, componentName, props, forceUpdate);
|
|
102
|
+
const hasEnterStyle = !!props.enterStyle;
|
|
103
|
+
const needsMount = Boolean((isWeb ? isClient : true) && (hasEnterStyle || props.animation));
|
|
104
|
+
const states = useServerState(
|
|
105
|
+
needsMount ? defaultComponentState : defaultComponentStateMounted
|
|
106
|
+
);
|
|
107
|
+
const state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: true } : states[0];
|
|
108
|
+
const setState = states[1];
|
|
109
|
+
const setStateShallow = useShallowSetState(setState);
|
|
110
|
+
const shouldSetMounted = needsMount && !state.mounted;
|
|
111
|
+
const setMounted = shouldSetMounted ? () => {
|
|
112
|
+
setTimeout(
|
|
113
|
+
() => {
|
|
114
|
+
setStateShallow({
|
|
115
|
+
mounted: true
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
isWeb ? 10 : 0
|
|
119
|
+
);
|
|
120
|
+
} : void 0;
|
|
121
|
+
const shouldAvoidClasses = !!(props.animation && avoidClassesWhileAnimating) || !staticConfig.acceptsClassName;
|
|
122
|
+
const shouldForcePseudo = !!propsIn.forceStyle;
|
|
123
|
+
const hasTextAncestor = !!(isWeb && isText ? useContext(TextAncestorContext) : false);
|
|
124
|
+
const splitStyleState = !shouldAvoidClasses && !shouldForcePseudo ? {
|
|
125
|
+
...state,
|
|
126
|
+
hasTextAncestor,
|
|
127
|
+
dynamicStylesInline: true
|
|
128
|
+
} : {
|
|
129
|
+
...state,
|
|
130
|
+
noClassNames: true,
|
|
131
|
+
dynamicStylesInline: true,
|
|
132
|
+
hasTextAncestor,
|
|
133
|
+
resolveVariablesAs: "value"
|
|
134
|
+
};
|
|
135
|
+
const languageContext = isRSC ? null : useContext(FontLanguageContext);
|
|
136
|
+
const isDisabled = props.disabled ?? ((_a = props.accessibilityState) == null ? void 0 : _a.disabled);
|
|
137
|
+
const useAnimations = (_b = tamaguiConfig.animations) == null ? void 0 : _b.useAnimations;
|
|
138
|
+
const nextIsAnimated = !!(useAnimations && props.animation);
|
|
139
|
+
const isAnimated = nextIsAnimated || state.hasAnimation;
|
|
140
|
+
if (nextIsAnimated && !state.hasAnimation) {
|
|
141
|
+
setStateShallow({ hasAnimation: true });
|
|
92
142
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
143
|
+
const isTaggable = !Component || typeof Component === "string";
|
|
144
|
+
const element = isWeb ? isTaggable ? props.tag || defaultTag || Component : Component : Component;
|
|
145
|
+
const BaseTextComponent = BaseText || element || "span";
|
|
146
|
+
const BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div");
|
|
147
|
+
let elementType = isText ? (isAnimated ? AnimatedText : null) || BaseTextComponent : (isAnimated ? AnimatedView : null) || BaseViewComponent;
|
|
148
|
+
elementType = Component || elementType;
|
|
149
|
+
const isStringElement = typeof elementType === "string";
|
|
150
|
+
const splitStyles = useSplitStyles(
|
|
151
|
+
props,
|
|
152
|
+
staticConfig,
|
|
153
|
+
theme,
|
|
154
|
+
splitStyleState,
|
|
155
|
+
props.asChild ? null : initialSplitStyles,
|
|
156
|
+
languageContext || void 0,
|
|
157
|
+
elementType,
|
|
158
|
+
debugProp
|
|
159
|
+
);
|
|
160
|
+
const hostRef = useServerRef(null);
|
|
161
|
+
const isReactNative = Boolean(
|
|
162
|
+
staticConfig.isReactNative || isAnimated && tamaguiConfig.animations.isReactNative
|
|
163
|
+
);
|
|
164
|
+
const isAnimatedReactNativeWeb = isAnimated && avoidClassesWhileAnimating;
|
|
99
165
|
if (process.env.NODE_ENV === "development") {
|
|
100
|
-
if (
|
|
101
|
-
console.
|
|
102
|
-
|
|
103
|
-
|
|
166
|
+
if (!process.env.TAMAGUI_TARGET) {
|
|
167
|
+
console.error(`No process.env.TAMAGUI_TARGET set, please set it to "native" or "web".`);
|
|
168
|
+
}
|
|
169
|
+
if (debugProp) {
|
|
170
|
+
const name = `${componentName || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`;
|
|
171
|
+
const type = isReactNative ? "rnw" : "tamagui";
|
|
172
|
+
const banner = `${name} ${propsIn["data-is"] || ""} ${type}`;
|
|
173
|
+
console.group(`%c \u{1F41B} ${banner}`, "background: yellow;");
|
|
174
|
+
console.groupCollapsed("initial props/state");
|
|
175
|
+
console.log("propsIn", propsIn, "turned into", props, "order", Object.keys(props));
|
|
176
|
+
console.log("splitStyles", splitStyles);
|
|
177
|
+
console.log("className", Object.values(splitStyles.classNames));
|
|
178
|
+
if (typeof window !== "undefined") {
|
|
179
|
+
console.log("ref", hostRef, "(click to view)");
|
|
180
|
+
}
|
|
181
|
+
console.groupEnd();
|
|
182
|
+
if (debugProp === "break") {
|
|
104
183
|
debugger;
|
|
184
|
+
}
|
|
105
185
|
}
|
|
106
186
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
const [state, set_] = useState(defaultComponentState);
|
|
110
|
-
const setStateShallow = createShallowUpdate(set_);
|
|
111
|
-
const shouldAvoidClasses = !!(props.animation && avoidClasses);
|
|
112
|
-
const splitStyles = useSplitStyles(props, staticConfig, theme, shouldAvoidClasses ? { ...state, noClassNames: true, resolveVariablesAs: "value" } : state, shouldAvoidClasses || props.asChild ? null : initialSplitStyles.classNames);
|
|
113
|
-
const { viewProps: viewPropsIn, pseudos, medias, style, classNames } = splitStyles;
|
|
114
|
-
const useAnimations = (_a = tamaguiConfig.animations) == null ? void 0 : _a.useAnimations;
|
|
115
|
-
const isAnimated = !!(useAnimations && props.animation);
|
|
116
|
-
const hasEnterStyle = !!props.enterStyle;
|
|
117
|
-
const features = useFeatures(props, {
|
|
118
|
-
forceUpdate,
|
|
119
|
-
setStateShallow,
|
|
120
|
-
useAnimations,
|
|
121
|
-
state,
|
|
122
|
-
style: props.animation ? { ...defaultNativeStyle, ...style } : null,
|
|
187
|
+
const {
|
|
188
|
+
viewProps: viewPropsIn,
|
|
123
189
|
pseudos,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
190
|
+
medias,
|
|
191
|
+
style: splitStylesStyle,
|
|
192
|
+
classNames,
|
|
193
|
+
mediaKeys
|
|
194
|
+
} = splitStyles;
|
|
195
|
+
const animationFeatureStylesIn = props.animation ? { ...defaultNativeStyle, ...splitStylesStyle } : null;
|
|
196
|
+
const propsWithAnimation = props;
|
|
197
|
+
let animationStyles;
|
|
198
|
+
if (!isRSC && isAnimated && useAnimations) {
|
|
199
|
+
const animations = useAnimations(propsWithAnimation, {
|
|
200
|
+
state,
|
|
201
|
+
pseudos,
|
|
202
|
+
onDidAnimate: props.onDidAnimate,
|
|
203
|
+
hostRef,
|
|
204
|
+
staticConfig,
|
|
205
|
+
getStyle({ isExiting, isEntering, exitVariant, enterVariant } = {}) {
|
|
206
|
+
var _a2, _b2, _c2, _d2;
|
|
207
|
+
const style = animationFeatureStylesIn;
|
|
208
|
+
const enterStyle = isEntering ? enterVariant && ((_a2 = staticConfig.variants) == null ? void 0 : _a2[enterVariant]["true"]) ? getSubStyle(
|
|
209
|
+
"",
|
|
210
|
+
(_b2 = staticConfig.variants) == null ? void 0 : _b2[enterVariant]["true"],
|
|
211
|
+
staticConfig,
|
|
212
|
+
theme,
|
|
213
|
+
props,
|
|
214
|
+
state,
|
|
215
|
+
tamaguiConfig
|
|
216
|
+
) || pseudos.enterStyle : pseudos.enterStyle : null;
|
|
217
|
+
const exitStyle = isExiting ? exitVariant && ((_c2 = staticConfig.variants) == null ? void 0 : _c2[exitVariant]["true"]) ? getSubStyle(
|
|
218
|
+
"",
|
|
219
|
+
(_d2 = staticConfig.variants) == null ? void 0 : _d2[exitVariant]["true"],
|
|
220
|
+
staticConfig,
|
|
221
|
+
theme,
|
|
222
|
+
props,
|
|
223
|
+
state,
|
|
224
|
+
tamaguiConfig
|
|
225
|
+
) || pseudos.exitStyle : pseudos.exitStyle : null;
|
|
226
|
+
ensureBaseHasDefaults(
|
|
227
|
+
style,
|
|
228
|
+
pseudos.hoverStyle,
|
|
229
|
+
pseudos.focusStyle,
|
|
230
|
+
pseudos.pressStyle
|
|
231
|
+
);
|
|
232
|
+
enterStyle && isEntering && merge(style, enterStyle);
|
|
233
|
+
state.hover && pseudos.hoverStyle && merge(style, pseudos.hoverStyle);
|
|
234
|
+
state.focus && pseudos.focusStyle && merge(style, pseudos.focusStyle);
|
|
235
|
+
state.press && pseudos.pressStyle && merge(style, pseudos.pressStyle);
|
|
236
|
+
exitStyle && isExiting && merge(style, exitStyle);
|
|
237
|
+
if (process.env.NODE_ENV === "development") {
|
|
238
|
+
if (debugProp === "verbose") {
|
|
239
|
+
console.log("animation style", style);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return style;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
if (animations) {
|
|
246
|
+
animationStyles = animations.style;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
useIsomorphicLayoutEffect(() => {
|
|
250
|
+
if (!mediaKeys.length)
|
|
251
|
+
return;
|
|
252
|
+
const disposers = [];
|
|
253
|
+
for (const key of mediaKeys) {
|
|
254
|
+
disposers.push(
|
|
255
|
+
addMediaQueryListener(key, (next) => {
|
|
256
|
+
setState((prev) => {
|
|
257
|
+
if (prev.mediaState[key] !== next) {
|
|
258
|
+
return {
|
|
259
|
+
...prev,
|
|
260
|
+
mediaState: getMediaStateObject({
|
|
261
|
+
...prev.mediaState,
|
|
262
|
+
[key]: next
|
|
263
|
+
})
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
return prev;
|
|
267
|
+
});
|
|
268
|
+
})
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
return () => {
|
|
272
|
+
for (const disposer of disposers) {
|
|
273
|
+
disposer();
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}, [mediaKeys.join(",")]);
|
|
128
277
|
const {
|
|
129
|
-
tag,
|
|
130
278
|
hitSlop,
|
|
131
279
|
asChild,
|
|
132
280
|
children,
|
|
133
|
-
pointerEvents,
|
|
134
281
|
onPress,
|
|
135
282
|
onPressIn,
|
|
136
283
|
onPressOut,
|
|
137
284
|
onHoverIn,
|
|
138
285
|
onHoverOut,
|
|
139
|
-
|
|
140
|
-
|
|
286
|
+
themeShallow,
|
|
287
|
+
space: spaceProp,
|
|
288
|
+
spaceDirection: _spaceDirection,
|
|
289
|
+
disabled: disabledProp,
|
|
290
|
+
onMouseUp,
|
|
291
|
+
onMouseDown,
|
|
141
292
|
onMouseEnter,
|
|
142
293
|
onMouseLeave,
|
|
143
294
|
hrefAttrs,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
onResponderEnd,
|
|
147
|
-
onResponderGrant,
|
|
148
|
-
onResponderMove,
|
|
149
|
-
onResponderReject,
|
|
150
|
-
onResponderRelease,
|
|
151
|
-
onResponderStart,
|
|
152
|
-
onResponderTerminate,
|
|
153
|
-
onResponderTerminationRequest,
|
|
154
|
-
onScrollShouldSetResponder,
|
|
155
|
-
onScrollShouldSetResponderCapture,
|
|
156
|
-
onSelectionChangeShouldSetResponder,
|
|
157
|
-
onSelectionChangeShouldSetResponderCapture,
|
|
158
|
-
onStartShouldSetResponder,
|
|
159
|
-
onStartShouldSetResponderCapture,
|
|
160
|
-
onMouseDown,
|
|
161
|
-
nativeID,
|
|
162
|
-
accessible,
|
|
163
|
-
accessibilityRole,
|
|
164
|
-
collapsable,
|
|
165
|
-
focusable,
|
|
295
|
+
separator,
|
|
296
|
+
forceStyle: _forceStyle,
|
|
166
297
|
onClick,
|
|
167
298
|
theme: _themeProp,
|
|
168
299
|
defaultVariants,
|
|
169
|
-
|
|
170
|
-
...viewPropsRest
|
|
300
|
+
...nonTamaguiProps
|
|
171
301
|
} = viewPropsIn;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
const hasTextAncestor = isWeb ? useContext(TextAncestorContext) : false;
|
|
181
|
-
const hostRef = useRef(null);
|
|
182
|
-
const internal = useRef();
|
|
183
|
-
if (!internal.current) {
|
|
184
|
-
internal.current = {
|
|
185
|
-
isMounted: true
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
useIsomorphicLayoutEffect(() => {
|
|
189
|
-
if (typeof window !== "undefined" && (hasEnterStyle || props.animation)) {
|
|
190
|
-
setStateShallow({
|
|
191
|
-
mounted: true
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
internal.current.isMounted = true;
|
|
195
|
-
return () => {
|
|
196
|
-
mouseUps.delete(unPress);
|
|
197
|
-
internal.current.isMounted = false;
|
|
198
|
-
};
|
|
199
|
-
}, [hasEnterStyle, props.animation]);
|
|
200
|
-
if (nativeID) {
|
|
201
|
-
viewProps.id = nativeID;
|
|
202
|
-
}
|
|
203
|
-
if (isAndroid) {
|
|
204
|
-
if (collapsable)
|
|
205
|
-
viewProps.collapsable = collapsable;
|
|
206
|
-
if (focusable)
|
|
207
|
-
viewProps.focusable = focusable;
|
|
208
|
-
}
|
|
209
|
-
if (!isWeb) {
|
|
210
|
-
if (accessible)
|
|
211
|
-
viewProps.accessible = accessible;
|
|
212
|
-
if (accessibilityRole)
|
|
213
|
-
viewProps.accessibilityRole = accessibilityRole;
|
|
214
|
-
}
|
|
215
|
-
if (isWeb && !asChild) {
|
|
216
|
-
rnw.useResponderEvents(hostRef, {
|
|
302
|
+
const disabled = props.accessibilityState != null && props.accessibilityState.disabled === true || props.accessibilityDisabled;
|
|
303
|
+
let viewProps;
|
|
304
|
+
if (process.env.TAMAGUI_TARGET === "web" && !isReactNative) {
|
|
305
|
+
const {
|
|
217
306
|
onMoveShouldSetResponder,
|
|
218
307
|
onMoveShouldSetResponderCapture,
|
|
219
308
|
onResponderEnd,
|
|
@@ -229,131 +318,209 @@ function createComponent(configIn, ParentComponent) {
|
|
|
229
318
|
onSelectionChangeShouldSetResponder,
|
|
230
319
|
onSelectionChangeShouldSetResponderCapture,
|
|
231
320
|
onStartShouldSetResponder,
|
|
232
|
-
onStartShouldSetResponderCapture
|
|
321
|
+
onStartShouldSetResponderCapture,
|
|
322
|
+
collapsable,
|
|
323
|
+
focusable,
|
|
324
|
+
accessible,
|
|
325
|
+
accessibilityDisabled,
|
|
326
|
+
onLayout,
|
|
327
|
+
...webProps
|
|
328
|
+
} = nonTamaguiProps;
|
|
329
|
+
viewProps = webProps;
|
|
330
|
+
if (!isRSC) {
|
|
331
|
+
usePlatformMethods(hostRef);
|
|
332
|
+
useElementLayout(hostRef, onLayout);
|
|
333
|
+
useResponderEvents(hostRef, {
|
|
334
|
+
onMoveShouldSetResponder,
|
|
335
|
+
onMoveShouldSetResponderCapture,
|
|
336
|
+
onResponderEnd,
|
|
337
|
+
onResponderGrant,
|
|
338
|
+
onResponderMove,
|
|
339
|
+
onResponderReject,
|
|
340
|
+
onResponderRelease,
|
|
341
|
+
onResponderStart,
|
|
342
|
+
onResponderTerminate,
|
|
343
|
+
onResponderTerminationRequest,
|
|
344
|
+
onScrollShouldSetResponder,
|
|
345
|
+
onScrollShouldSetResponderCapture,
|
|
346
|
+
onSelectionChangeShouldSetResponder,
|
|
347
|
+
onSelectionChangeShouldSetResponderCapture,
|
|
348
|
+
onStartShouldSetResponder,
|
|
349
|
+
onStartShouldSetResponderCapture
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
if (props.href != void 0 && hrefAttrs != void 0) {
|
|
353
|
+
const { download, rel, target } = hrefAttrs;
|
|
354
|
+
if (download != null) {
|
|
355
|
+
viewProps.download = download;
|
|
356
|
+
}
|
|
357
|
+
if (rel != null) {
|
|
358
|
+
viewProps.rel = rel;
|
|
359
|
+
}
|
|
360
|
+
if (typeof target === "string") {
|
|
361
|
+
viewProps.target = target.charAt(0) !== "_" ? "_" + target : target;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
const _focusable = focusable != void 0 ? focusable : accessible;
|
|
365
|
+
const role = viewProps.role;
|
|
366
|
+
if (_focusable === false) {
|
|
367
|
+
viewProps.tabIndex = "-1";
|
|
368
|
+
}
|
|
369
|
+
if (elementType === "a" || elementType === "button" || elementType === "input" || elementType === "select" || elementType === "textarea") {
|
|
370
|
+
if (_focusable === false || accessibilityDisabled === true) {
|
|
371
|
+
viewProps.tabIndex = "-1";
|
|
372
|
+
}
|
|
373
|
+
} else if (role === "button" || role === "checkbox" || role === "link" || role === "radio" || role === "textbox" || role === "switch") {
|
|
374
|
+
if (_focusable !== false) {
|
|
375
|
+
viewProps.tabIndex = "0";
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (_focusable === true) {
|
|
379
|
+
viewProps.tabIndex = "0";
|
|
380
|
+
}
|
|
381
|
+
} else {
|
|
382
|
+
viewProps = nonTamaguiProps;
|
|
383
|
+
}
|
|
384
|
+
viewProps.ref = useComposedRefs(hostRef, forwardedRef, setMounted);
|
|
385
|
+
if (process.env.NODE_ENV === "development" && !isText && isWeb && !staticConfig.isHOC) {
|
|
386
|
+
Children.toArray(props.children).forEach((item) => {
|
|
387
|
+
if (typeof item === "string") {
|
|
388
|
+
console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
389
|
+
}
|
|
233
390
|
});
|
|
234
391
|
}
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
392
|
+
const unPress = useCallback(() => {
|
|
393
|
+
setStateShallow({
|
|
394
|
+
press: false,
|
|
395
|
+
pressIn: false
|
|
396
|
+
});
|
|
397
|
+
}, [setStateShallow]);
|
|
398
|
+
if (!isRSC) {
|
|
399
|
+
useEffect(() => {
|
|
400
|
+
return () => {
|
|
401
|
+
mouseUps.delete(unPress);
|
|
402
|
+
};
|
|
403
|
+
}, [unPress]);
|
|
404
|
+
}
|
|
241
405
|
let styles;
|
|
242
|
-
|
|
243
|
-
const animationStyles = state.animation ? state.animation.style : null;
|
|
244
|
-
if (isStringElement && shouldAvoidClasses) {
|
|
406
|
+
if (isStringElement && shouldAvoidClasses && !shouldForcePseudo) {
|
|
245
407
|
styles = {
|
|
246
408
|
...defaultNativeStyle,
|
|
247
|
-
...animationStyles,
|
|
409
|
+
...animationStyles ?? splitStylesStyle,
|
|
248
410
|
...medias
|
|
249
411
|
};
|
|
250
412
|
} else {
|
|
251
|
-
styles = [
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
state.hover && addPseudoToStyles(styles, "hoverStyle", pseudos);
|
|
259
|
-
state.focus && addPseudoToStyles(styles, "focusStyle", pseudos);
|
|
260
|
-
state.press && addPseudoToStyles(styles, "pressStyle", pseudos);
|
|
413
|
+
styles = [isWeb ? null : defaultNativeStyle, animationStyles ?? splitStylesStyle, medias];
|
|
414
|
+
if (!animationStyles && initialSplitStyles) {
|
|
415
|
+
const initPseudos = initialSplitStyles.pseudos;
|
|
416
|
+
!state.mounted && addPseudoToStyles(styles, initPseudos, pseudos, "enterStyle");
|
|
417
|
+
state.hover && addPseudoToStyles(styles, initPseudos, pseudos, "hoverStyle", shouldForcePseudo);
|
|
418
|
+
state.focus && addPseudoToStyles(styles, initPseudos, pseudos, "focusStyle", shouldForcePseudo);
|
|
419
|
+
state.press && addPseudoToStyles(styles, initPseudos, pseudos, "pressStyle", shouldForcePseudo);
|
|
261
420
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const classList = [
|
|
268
|
-
componentName ? componentClassName : "",
|
|
269
|
-
fontFamily ? `font_${fontFamily}` : "",
|
|
270
|
-
theme.className,
|
|
271
|
-
classNames ? Object.values(classNames).join(" ") : ""
|
|
272
|
-
];
|
|
273
|
-
const className = classList.join(" ");
|
|
274
|
-
if (process.env.NODE_ENV === "development") {
|
|
275
|
-
if (props["debug"]) {
|
|
276
|
-
console.log(" \xBB className", { isStringElement, pseudos, state, classNames, propsClassName: props.className, style, classList, className: className.trim().split(" "), themeClassName: theme.className, values: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) });
|
|
421
|
+
if (shouldForcePseudo) {
|
|
422
|
+
const next = {};
|
|
423
|
+
for (const style of styles) {
|
|
424
|
+
if (style) {
|
|
425
|
+
Object.assign(next, style);
|
|
277
426
|
}
|
|
278
427
|
}
|
|
279
|
-
|
|
280
|
-
viewProps.style = animationStyles;
|
|
281
|
-
} else {
|
|
282
|
-
viewProps.style = styles;
|
|
428
|
+
Object.assign(splitStyles.style, next);
|
|
283
429
|
}
|
|
284
|
-
} else {
|
|
285
|
-
viewProps.style = styles;
|
|
286
430
|
}
|
|
287
|
-
|
|
288
|
-
|
|
431
|
+
let fontFamily = isText ? splitStyles.fontFamily || staticConfig.defaultProps.fontFamily : null;
|
|
432
|
+
if (fontFamily && fontFamily[0] === "$") {
|
|
433
|
+
fontFamily = fontFamily.slice(1);
|
|
289
434
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
435
|
+
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "";
|
|
436
|
+
const classList = [
|
|
437
|
+
componentName ? componentClassName : "",
|
|
438
|
+
fontFamilyClassName,
|
|
439
|
+
theme.className,
|
|
440
|
+
classNames ? Object.values(classNames).join(" ") : ""
|
|
441
|
+
];
|
|
442
|
+
const className = classList.join(" ");
|
|
443
|
+
if (process.env.TAMAGUI_TARGET === "web") {
|
|
444
|
+
const style = animationStyles ?? splitStyles.style;
|
|
445
|
+
if (isAnimatedReactNativeWeb) {
|
|
446
|
+
viewProps.style = style;
|
|
447
|
+
} else if (isReactNative) {
|
|
448
|
+
const rnwStyle = { $$css: true };
|
|
449
|
+
for (const name of className.split(" ")) {
|
|
450
|
+
rnwStyle[name] = name;
|
|
298
451
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if (typeof target === "string") {
|
|
309
|
-
viewProps.target = target.charAt(0) !== "_" ? "_" + target : target;
|
|
452
|
+
viewProps.style = [rnwStyle, ...Array.isArray(style) ? style : [style]];
|
|
453
|
+
if (process.env.NODE_ENV === "development") {
|
|
454
|
+
Object.keys(viewProps).forEach((key) => {
|
|
455
|
+
if (key.startsWith("data-")) {
|
|
456
|
+
viewProps.dataSet ??= {};
|
|
457
|
+
viewProps.dataSet[key.replace("data-", "")] = viewProps[key];
|
|
458
|
+
delete viewProps[key];
|
|
459
|
+
}
|
|
460
|
+
});
|
|
310
461
|
}
|
|
462
|
+
} else {
|
|
463
|
+
viewProps.className = className;
|
|
464
|
+
viewProps.style = style;
|
|
311
465
|
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
|
|
466
|
+
}
|
|
467
|
+
if (process.env.TAMAGUI_TARGET === "native") {
|
|
468
|
+
if (splitStyles.fontFamily) {
|
|
469
|
+
const faceInfo = (_c = tamaguiConfig.fontsParsed[splitStyles.fontFamily]) == null ? void 0 : _c.face;
|
|
470
|
+
if (faceInfo) {
|
|
471
|
+
const [weight, style] = (() => {
|
|
472
|
+
var _a2, _b2;
|
|
473
|
+
let weight2;
|
|
474
|
+
let style2;
|
|
475
|
+
for (let i = styles.length; i >= 0; i--) {
|
|
476
|
+
weight2 ??= (_a2 = styles[i]) == null ? void 0 : _a2.fontWeight;
|
|
477
|
+
style2 ??= (_b2 = styles[i]) == null ? void 0 : _b2.fontStyle;
|
|
478
|
+
}
|
|
479
|
+
return [weight2 || "400", style2 || "normal"];
|
|
480
|
+
})();
|
|
481
|
+
const overrideFace = (_e = (_d = faceInfo[weight]) == null ? void 0 : _d[style]) == null ? void 0 : _e.val;
|
|
482
|
+
if (overrideFace) {
|
|
483
|
+
for (const style2 of styles) {
|
|
484
|
+
if (style2 == null ? void 0 : style2.fontFamily) {
|
|
485
|
+
style2.fontFamily = overrideFace;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
315
490
|
}
|
|
491
|
+
viewProps.style = styles;
|
|
316
492
|
}
|
|
317
|
-
const initialPseudos = initialSplitStyles.pseudos;
|
|
318
|
-
const attachPress = !!(pseudos
|
|
319
|
-
const
|
|
320
|
-
const isHoverable = isWeb && !isTouch;
|
|
493
|
+
const initialPseudos = initialSplitStyles == null ? void 0 : initialSplitStyles.pseudos;
|
|
494
|
+
const attachPress = !!((pseudos == null ? void 0 : pseudos.pressStyle) || (initialPseudos == null ? void 0 : initialPseudos.pressStyle) || onPress || onPressOut || onPressIn || onClick);
|
|
495
|
+
const isHoverable = isWeb;
|
|
321
496
|
const attachHover = isHoverable && !!(pseudos && pseudos.hoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave);
|
|
322
|
-
const handlesPressEvents = !
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
if (!internal.current.isMounted)
|
|
329
|
-
return;
|
|
330
|
-
setStateShallow({
|
|
331
|
-
press: false,
|
|
332
|
-
pressIn: false
|
|
333
|
-
});
|
|
334
|
-
}, []);
|
|
335
|
-
const events = shouldAttach ? {
|
|
336
|
-
[pressOutKey]: attachPress ? (e) => {
|
|
497
|
+
const handlesPressEvents = !isWeb && !asChild;
|
|
498
|
+
const shouldAttach = asChild ? false : Boolean(
|
|
499
|
+
attachPress || attachHover || "pressStyle" in props || "onPress" in props || "onPressIn" in props || "onPressOut" in props || isWeb && ("hoverStyle" in props || "onHoverIn" in props || "onHoverOut" in props || "onMouseEnter" in props || "onMouseLeave" in props)
|
|
500
|
+
);
|
|
501
|
+
const events = shouldAttach && !isRSC && !isDisabled ? {
|
|
502
|
+
onPressOut: attachPress ? (e) => {
|
|
337
503
|
unPress();
|
|
338
504
|
onPressOut == null ? void 0 : onPressOut(e);
|
|
505
|
+
onMouseUp == null ? void 0 : onMouseUp(e);
|
|
339
506
|
} : void 0,
|
|
340
507
|
...isHoverable && {
|
|
341
508
|
onMouseEnter: attachHover ? (e) => {
|
|
342
|
-
|
|
509
|
+
const next = {};
|
|
343
510
|
if (attachHover) {
|
|
344
511
|
next.hover = true;
|
|
345
512
|
}
|
|
346
513
|
if (state.pressIn) {
|
|
347
514
|
next.press = true;
|
|
348
515
|
}
|
|
349
|
-
if (
|
|
516
|
+
if (attachHover || state.pressIn) {
|
|
350
517
|
setStateShallow(next);
|
|
351
518
|
}
|
|
352
519
|
onHoverIn == null ? void 0 : onHoverIn(e);
|
|
353
520
|
onMouseEnter == null ? void 0 : onMouseEnter(e);
|
|
354
521
|
} : void 0,
|
|
355
522
|
onMouseLeave: attachHover ? (e) => {
|
|
356
|
-
|
|
523
|
+
const next = {};
|
|
357
524
|
mouseUps.add(unPress);
|
|
358
525
|
if (attachHover) {
|
|
359
526
|
next.hover = false;
|
|
@@ -369,154 +536,239 @@ function createComponent(configIn, ParentComponent) {
|
|
|
369
536
|
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
370
537
|
} : void 0
|
|
371
538
|
},
|
|
372
|
-
|
|
539
|
+
onPressIn: attachPress ? (e) => {
|
|
373
540
|
setStateShallow({
|
|
374
541
|
press: true,
|
|
375
|
-
pressIn: true
|
|
542
|
+
pressIn: true,
|
|
543
|
+
hover: false
|
|
376
544
|
});
|
|
377
545
|
onPressIn == null ? void 0 : onPressIn(e);
|
|
378
546
|
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
379
547
|
if (isWeb) {
|
|
380
548
|
mouseUps.add(unPress);
|
|
381
549
|
}
|
|
382
|
-
} :
|
|
383
|
-
|
|
550
|
+
} : void 0,
|
|
551
|
+
onPress: attachPress ? (e) => {
|
|
384
552
|
unPress();
|
|
385
553
|
onClick == null ? void 0 : onClick(e);
|
|
386
554
|
onPress == null ? void 0 : onPress(e);
|
|
387
|
-
} :
|
|
555
|
+
} : void 0,
|
|
556
|
+
...!isWeb && {
|
|
557
|
+
cancelable: !props.rejectResponderTermination,
|
|
558
|
+
disabled: isDisabled,
|
|
559
|
+
hitSlop: props.hitSlop,
|
|
560
|
+
delayLongPress: props.delayLongPress,
|
|
561
|
+
delayPressIn: props.delayPressIn,
|
|
562
|
+
delayPressOut: props.delayPressOut,
|
|
563
|
+
focusable: viewProps.focusable ?? true,
|
|
564
|
+
minPressDuration: 0
|
|
565
|
+
}
|
|
388
566
|
} : null;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}), getThemeManagerIfChanged(theme));
|
|
395
|
-
let content;
|
|
396
|
-
if (isWeb) {
|
|
397
|
-
if (staticConfig.isReactNativeWeb) {
|
|
398
|
-
viewProps.dataSet = {
|
|
399
|
-
...viewProps.dataSet,
|
|
400
|
-
className: viewProps.className
|
|
401
|
-
};
|
|
402
|
-
} else {
|
|
403
|
-
const rnProps = rnw.createDOMProps(viewProps);
|
|
404
|
-
const className = rnProps.className && rnProps.className !== viewProps.className ? `${rnProps.className} ${viewProps.className}` : viewProps.className;
|
|
405
|
-
Object.assign(viewProps, rnProps);
|
|
406
|
-
if (className) {
|
|
407
|
-
viewProps.className = className;
|
|
567
|
+
let space = spaceProp;
|
|
568
|
+
if (state.mediaState && mediaKeys.length) {
|
|
569
|
+
for (const key in state.mediaState) {
|
|
570
|
+
if (state.mediaState[key] && props[key] && props[key].space !== void 0) {
|
|
571
|
+
space = props[key].space;
|
|
408
572
|
}
|
|
409
573
|
}
|
|
410
574
|
}
|
|
575
|
+
const themeManager = getThemeManager(theme);
|
|
576
|
+
const shouldSetChildrenThemeToParent = Boolean(
|
|
577
|
+
themeShallow && themeManager && themeManager.didChangeTheme
|
|
578
|
+
);
|
|
579
|
+
const shouldProvideThemeManager = shouldSetChildrenThemeToParent || themeManager && themeManager.didChangeTheme;
|
|
580
|
+
const childEls = !children || asChild ? children : wrapThemeManagerContext(
|
|
581
|
+
spacedChildren({
|
|
582
|
+
separator,
|
|
583
|
+
children,
|
|
584
|
+
space,
|
|
585
|
+
direction: props.spaceDirection || "both",
|
|
586
|
+
isZStack
|
|
587
|
+
}),
|
|
588
|
+
shouldProvideThemeManager ? themeManager : void 0,
|
|
589
|
+
shouldSetChildrenThemeToParent
|
|
590
|
+
);
|
|
591
|
+
let content;
|
|
411
592
|
if (asChild) {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
...hitSlop && {
|
|
420
|
-
hitSlop
|
|
421
|
-
},
|
|
422
|
-
onPressOut: events[pressOutKey],
|
|
423
|
-
onPressIn: events[pressInKey],
|
|
424
|
-
onPress: events[pressKey]
|
|
425
|
-
} : {
|
|
426
|
-
disabled: true
|
|
427
|
-
});
|
|
428
|
-
if (events) {
|
|
429
|
-
if (handlesPressEvents) {
|
|
430
|
-
Object.assign(viewProps, pressableProps);
|
|
431
|
-
} else {
|
|
432
|
-
Object.assign(viewProps, events);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
593
|
+
elementType = Slot;
|
|
594
|
+
viewProps = {
|
|
595
|
+
...viewProps,
|
|
596
|
+
onPress,
|
|
597
|
+
onPressIn,
|
|
598
|
+
onPressOut
|
|
599
|
+
};
|
|
435
600
|
}
|
|
436
|
-
|
|
437
|
-
|
|
601
|
+
if (process.env.TAMAGUI_TARGET === "native") {
|
|
602
|
+
const attachFocus = !!(pseudos && pseudos.focusStyle || initialPseudos && initialPseudos.focusStyle);
|
|
603
|
+
if (attachFocus) {
|
|
604
|
+
viewProps.onFocus = mergeEvent(viewProps.onFocus, () => {
|
|
605
|
+
setStateShallow({ focus: true });
|
|
606
|
+
});
|
|
607
|
+
viewProps.onBlur = mergeEvent(viewProps.onBlur, () => {
|
|
608
|
+
setStateShallow({ focus: false });
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
const pressability = usePressability(events);
|
|
438
612
|
if (attachPress && events) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
}
|
|
448
|
-
}, content));
|
|
613
|
+
if (hitSlop) {
|
|
614
|
+
viewProps.hitSlop = hitSlop;
|
|
615
|
+
}
|
|
616
|
+
for (const key in pressability) {
|
|
617
|
+
const og = props[key];
|
|
618
|
+
const val = pressability[key];
|
|
619
|
+
viewProps[key] = og && !dontComposePressabilityKeys[key] ? composeEventHandlers(og, val) : val;
|
|
620
|
+
}
|
|
449
621
|
}
|
|
450
622
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
623
|
+
content = createElement(elementType, viewProps, childEls);
|
|
624
|
+
if (process.env.TAMAGUI_TARGET === "web") {
|
|
625
|
+
if (events || isAnimatedReactNativeWeb) {
|
|
626
|
+
content = /* @__PURE__ */ jsx("span", {
|
|
627
|
+
style: styleDisplayContents,
|
|
628
|
+
className: isAnimatedReactNativeWeb ? className : void 0,
|
|
629
|
+
...events && {
|
|
630
|
+
onMouseEnter: events.onMouseEnter,
|
|
631
|
+
onMouseLeave: events.onMouseLeave,
|
|
632
|
+
onClick: events.onPress,
|
|
633
|
+
onMouseDown: events.onPressIn,
|
|
634
|
+
onMouseUp: events.onPressOut,
|
|
635
|
+
onTouchStart: events.onPressIn,
|
|
636
|
+
onTouchEnd: events.onPressOut
|
|
637
|
+
},
|
|
638
|
+
children: content
|
|
639
|
+
});
|
|
464
640
|
}
|
|
465
641
|
}
|
|
466
|
-
if (
|
|
467
|
-
|
|
642
|
+
if (process.env.NODE_ENV === "development" && process.env.DEBUG !== "tamagui") {
|
|
643
|
+
if (debugProp) {
|
|
644
|
+
const element2 = typeof elementType === "string" ? elementType : "Component";
|
|
645
|
+
console.groupCollapsed(`render <${element2} /> with props`, viewProps);
|
|
646
|
+
for (const key in viewProps) {
|
|
647
|
+
console.log(key, viewProps[key]);
|
|
648
|
+
}
|
|
649
|
+
console.log("children", content);
|
|
650
|
+
console.groupEnd();
|
|
651
|
+
if (typeof window !== "undefined") {
|
|
652
|
+
console.log({ state, shouldProvideThemeManager, isAnimated, isAnimatedReactNativeWeb, tamaguiDefaultProps, viewProps, splitStyles, animationStyles, handlesPressEvents, isStringElement, classNamesIn: (_f = props.className) == null ? void 0 : _f.split(" "), classNamesOut: (_g = viewProps.className) == null ? void 0 : _g.split(" "), events, shouldAttach, styles, pseudos, content, childEls, shouldAvoidClasses, avoidClasses: avoidClassesWhileAnimating, animation: props.animation, style: splitStylesStyle, defaultNativeStyle, initialSplitStyles, ...typeof window !== "undefined" ? { theme, themeClassName: theme.className, staticConfig, tamaguiConfig, events, shouldAvoidClasses, shouldForcePseudo, classNames: Object.fromEntries(Object.entries(classNames).map(([k, v]) => [v, getAllSelectors()[v]])) } : null });
|
|
653
|
+
}
|
|
654
|
+
console.groupEnd();
|
|
655
|
+
}
|
|
468
656
|
}
|
|
469
657
|
return content;
|
|
470
658
|
});
|
|
471
|
-
|
|
659
|
+
if (staticConfig.componentName) {
|
|
660
|
+
component.displayName = staticConfig.componentName;
|
|
661
|
+
}
|
|
472
662
|
onConfiguredOnce((conf) => {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
663
|
+
if (!tamaguiConfig) {
|
|
664
|
+
tamaguiConfig = conf;
|
|
665
|
+
if (!defaultComponentState) {
|
|
666
|
+
defaultComponentState = {
|
|
667
|
+
hover: false,
|
|
668
|
+
press: false,
|
|
669
|
+
pressIn: false,
|
|
670
|
+
focus: false,
|
|
671
|
+
mounted: false,
|
|
672
|
+
mediaState: getMediaStateObject(getInitialMediaState())
|
|
673
|
+
};
|
|
674
|
+
defaultComponentStateMounted = {
|
|
675
|
+
...defaultComponentState,
|
|
676
|
+
mounted: true
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
if (tamaguiConfig.animations) {
|
|
680
|
+
AnimatedText = tamaguiConfig.animations.Text;
|
|
681
|
+
AnimatedView = tamaguiConfig.animations.View;
|
|
682
|
+
}
|
|
683
|
+
if (!initialTheme) {
|
|
684
|
+
const next = conf.themes[Object.keys(conf.themes)[0]];
|
|
685
|
+
initialTheme = proxyThemeVariables(next);
|
|
686
|
+
if (process.env.NODE_ENV === "development") {
|
|
687
|
+
if (!initialTheme) {
|
|
688
|
+
console.log(`Warning: Missing theme`);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
476
692
|
}
|
|
477
|
-
tamaguiConfig = conf;
|
|
478
693
|
mergeShorthands(staticConfig, tamaguiConfig);
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
694
|
+
let defaultPropsIn = staticConfig.defaultProps || {};
|
|
695
|
+
const parentNames = [...staticConfig.parentNames || [], staticConfig.componentName];
|
|
696
|
+
if (tamaguiConfig.defaultProps && parentNames && staticConfig.componentName) {
|
|
697
|
+
defaultPropsIn = mergeConfigDefaultProps(
|
|
698
|
+
staticConfig.componentName,
|
|
699
|
+
defaultPropsIn,
|
|
700
|
+
tamaguiConfig.defaultProps,
|
|
701
|
+
parentNames,
|
|
702
|
+
tamaguiConfig
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
const debug = defaultPropsIn["debug"];
|
|
706
|
+
const [ourProps, ourClassNames] = mergeProps(defaultPropsIn, {}, true);
|
|
707
|
+
if (ourProps.tag) {
|
|
708
|
+
defaultTag = ourProps.tag;
|
|
709
|
+
}
|
|
710
|
+
const noClassNames = !staticConfig.acceptsClassName;
|
|
711
|
+
initialSplitStyles = insertSplitStyles(
|
|
712
|
+
ourProps,
|
|
713
|
+
staticConfig,
|
|
714
|
+
initialTheme,
|
|
715
|
+
{
|
|
716
|
+
mounted: true,
|
|
717
|
+
hover: false,
|
|
718
|
+
press: false,
|
|
719
|
+
pressIn: false,
|
|
720
|
+
focus: false,
|
|
721
|
+
resolveVariablesAs: "both",
|
|
722
|
+
noClassNames,
|
|
723
|
+
keepVariantsAsProps: true
|
|
724
|
+
},
|
|
725
|
+
void 0,
|
|
726
|
+
void 0,
|
|
727
|
+
debug
|
|
728
|
+
);
|
|
729
|
+
const [defaults2, defaultsClassnames] = mergeProps(
|
|
730
|
+
component.defaultProps,
|
|
731
|
+
initialSplitStyles.viewProps,
|
|
732
|
+
true
|
|
733
|
+
);
|
|
734
|
+
initialSplitStyles.classNames = {
|
|
735
|
+
...defaultsClassnames,
|
|
736
|
+
...initialSplitStyles.classNames,
|
|
737
|
+
...ourClassNames
|
|
495
738
|
};
|
|
496
739
|
defaultNativeStyle = {};
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
740
|
+
const validStyles2 = staticConfig.validStyles || stylePropsView;
|
|
741
|
+
if (!isWeb) {
|
|
742
|
+
for (const key in staticConfig.defaultProps) {
|
|
743
|
+
const val = staticConfig.defaultProps[key];
|
|
744
|
+
if (validPseudoKeys[key])
|
|
745
|
+
continue;
|
|
746
|
+
if (typeof val === "string" && val[0] === "$" || !validStyles2[key]) {
|
|
747
|
+
defaults2[key] = val;
|
|
748
|
+
} else {
|
|
749
|
+
defaultNativeStyle[key] = val;
|
|
750
|
+
}
|
|
504
751
|
}
|
|
505
752
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
});
|
|
509
|
-
if (Object.keys(defaults).length) {
|
|
510
|
-
tamaguiDefaultProps = defaults;
|
|
753
|
+
if (Object.keys(defaults2).length) {
|
|
754
|
+
tamaguiDefaultProps = defaults2;
|
|
511
755
|
}
|
|
512
|
-
if (process.env.NODE_ENV === "development" &&
|
|
756
|
+
if (process.env.NODE_ENV === "development" && debug) {
|
|
513
757
|
if (process.env.IS_STATIC !== "is_static") {
|
|
514
758
|
console.log(`\u{1F41B} [${staticConfig.componentName || "Component"}]`, {
|
|
515
759
|
staticConfig,
|
|
516
760
|
initialSplitStyles,
|
|
517
761
|
tamaguiDefaultProps,
|
|
518
762
|
defaultNativeStyle,
|
|
519
|
-
defaults
|
|
763
|
+
defaults: defaults2,
|
|
764
|
+
defaultPropsIn,
|
|
765
|
+
defaultPropsKeyOrder: Object.keys(staticConfig.defaultProps),
|
|
766
|
+
defaultPropsInKeyOrder: Object.keys(defaultPropsIn).map((k) => [k, defaultPropsIn[k]]),
|
|
767
|
+
ourProps,
|
|
768
|
+
ourClassNames,
|
|
769
|
+
defaultsClassnames,
|
|
770
|
+
defaultTag,
|
|
771
|
+
noClassNames
|
|
520
772
|
});
|
|
521
773
|
}
|
|
522
774
|
}
|
|
@@ -525,41 +777,46 @@ function createComponent(configIn, ParentComponent) {
|
|
|
525
777
|
if (configIn.memo) {
|
|
526
778
|
res = memo(res);
|
|
527
779
|
}
|
|
528
|
-
res
|
|
780
|
+
res.staticConfig = {
|
|
529
781
|
validStyles: staticConfig.validStyles || stylePropsView,
|
|
530
782
|
...staticConfig
|
|
531
783
|
};
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
|
|
784
|
+
res.extractable = (Component, conf) => {
|
|
785
|
+
Component.staticConfig = extendStaticConfig(
|
|
786
|
+
{
|
|
787
|
+
Component,
|
|
788
|
+
...conf,
|
|
789
|
+
neverFlatten: true,
|
|
790
|
+
isHOC: true,
|
|
791
|
+
defaultProps: {
|
|
792
|
+
...Component.defaultProps,
|
|
793
|
+
...conf == null ? void 0 : conf.defaultProps
|
|
794
|
+
}
|
|
795
|
+
},
|
|
796
|
+
res
|
|
797
|
+
);
|
|
545
798
|
return Component;
|
|
546
799
|
};
|
|
547
800
|
return res;
|
|
548
801
|
}
|
|
549
|
-
|
|
802
|
+
const Unspaced = (props) => {
|
|
803
|
+
return props.children;
|
|
804
|
+
};
|
|
805
|
+
Unspaced["isUnspaced"] = true;
|
|
550
806
|
const Spacer = createComponent({
|
|
551
807
|
memo: true,
|
|
552
808
|
componentName: "Spacer",
|
|
809
|
+
validStyles,
|
|
553
810
|
defaultProps: {
|
|
554
811
|
...stackDefaultStyles,
|
|
812
|
+
tag: "span",
|
|
555
813
|
size: true
|
|
556
814
|
},
|
|
557
815
|
variants: {
|
|
558
816
|
size: {
|
|
559
817
|
"...size": (size, { tokens }) => {
|
|
560
|
-
var _a;
|
|
561
818
|
size = size == true ? "$true" : size;
|
|
562
|
-
const sizePx =
|
|
819
|
+
const sizePx = tokens.space[size] ?? size;
|
|
563
820
|
return {
|
|
564
821
|
width: sizePx,
|
|
565
822
|
height: sizePx,
|
|
@@ -570,7 +827,7 @@ const Spacer = createComponent({
|
|
|
570
827
|
},
|
|
571
828
|
flex: {
|
|
572
829
|
true: {
|
|
573
|
-
|
|
830
|
+
flexGrow: 1
|
|
574
831
|
}
|
|
575
832
|
},
|
|
576
833
|
direction: {
|
|
@@ -581,11 +838,9 @@ const Spacer = createComponent({
|
|
|
581
838
|
vertical: {
|
|
582
839
|
width: 0,
|
|
583
840
|
minWidth: 0
|
|
584
|
-
}
|
|
841
|
+
},
|
|
842
|
+
both: {}
|
|
585
843
|
}
|
|
586
|
-
},
|
|
587
|
-
defaultVariants: {
|
|
588
|
-
direction: "horizontal"
|
|
589
844
|
}
|
|
590
845
|
});
|
|
591
846
|
function spacedChildren({
|
|
@@ -593,61 +848,233 @@ function spacedChildren({
|
|
|
593
848
|
children,
|
|
594
849
|
space,
|
|
595
850
|
direction,
|
|
596
|
-
spaceFlex
|
|
851
|
+
spaceFlex,
|
|
852
|
+
separator
|
|
597
853
|
}) {
|
|
598
|
-
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
854
|
+
const hasSpace = !!(space || spaceFlex);
|
|
855
|
+
const hasSeparator = !(separator === void 0 || separator === null);
|
|
856
|
+
if (!hasSpace && !hasSeparator && !isZStack) {
|
|
857
|
+
return children;
|
|
858
|
+
}
|
|
859
|
+
const childrenList = Children.toArray(children);
|
|
860
|
+
if (childrenList.length <= 1 && !isZStack) {
|
|
602
861
|
return childrenList;
|
|
603
862
|
}
|
|
604
863
|
const final = [];
|
|
605
864
|
for (const [index, child] of childrenList.entries()) {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
}
|
|
609
|
-
if (!child || child["key"] && !isZStack) {
|
|
865
|
+
const isEmpty = child === null || child === void 0 || Array.isArray(child) && child.length === 0;
|
|
866
|
+
if (isEmpty || !child || child["key"] && !isZStack) {
|
|
610
867
|
final.push(child);
|
|
611
868
|
} else {
|
|
612
|
-
final.push(
|
|
613
|
-
|
|
614
|
-
|
|
869
|
+
final.push(
|
|
870
|
+
/* @__PURE__ */ jsx(Fragment, {
|
|
871
|
+
children: isZStack ? /* @__PURE__ */ jsx(AbsoluteFill, {
|
|
872
|
+
children: child
|
|
873
|
+
}) : child
|
|
874
|
+
}, index)
|
|
875
|
+
);
|
|
615
876
|
}
|
|
616
|
-
if ((
|
|
877
|
+
if (isUnspaced(child) && index === 0) {
|
|
878
|
+
continue;
|
|
879
|
+
}
|
|
880
|
+
if (isZStack) {
|
|
617
881
|
continue;
|
|
618
882
|
}
|
|
619
883
|
const next = childrenList[index + 1];
|
|
620
|
-
if (next &&
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
884
|
+
if (next && !isUnspaced(next)) {
|
|
885
|
+
if (separator) {
|
|
886
|
+
if (hasSpace) {
|
|
887
|
+
final.push(
|
|
888
|
+
createSpacer({
|
|
889
|
+
key: `_${index}_00tmgui`,
|
|
890
|
+
direction,
|
|
891
|
+
space,
|
|
892
|
+
spaceFlex
|
|
893
|
+
})
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
final.push(
|
|
897
|
+
React.isValidElement(separator) ? React.cloneElement(separator, { key: `sep_${index}` }) : separator
|
|
898
|
+
);
|
|
899
|
+
if (hasSpace) {
|
|
900
|
+
final.push(
|
|
901
|
+
createSpacer({
|
|
902
|
+
key: `_${index}01tmgui`,
|
|
903
|
+
direction,
|
|
904
|
+
space,
|
|
905
|
+
spaceFlex
|
|
906
|
+
})
|
|
907
|
+
);
|
|
627
908
|
}
|
|
628
|
-
}
|
|
909
|
+
} else {
|
|
910
|
+
final.push(
|
|
911
|
+
createSpacer({
|
|
912
|
+
key: `_${index}02tmgui`,
|
|
913
|
+
direction,
|
|
914
|
+
space,
|
|
915
|
+
spaceFlex
|
|
916
|
+
})
|
|
917
|
+
);
|
|
918
|
+
}
|
|
629
919
|
}
|
|
630
920
|
}
|
|
631
921
|
return final;
|
|
632
922
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
923
|
+
function createSpacer({ key, direction, space, spaceFlex }) {
|
|
924
|
+
return /* @__PURE__ */ jsx(Spacer, {
|
|
925
|
+
size: space,
|
|
926
|
+
direction,
|
|
927
|
+
...typeof spaceFlex !== "undefined" && {
|
|
928
|
+
flex: spaceFlex === true ? 1 : spaceFlex === false ? 0 : spaceFlex
|
|
929
|
+
}
|
|
930
|
+
}, key);
|
|
931
|
+
}
|
|
932
|
+
function isUnspaced(child) {
|
|
933
|
+
var _a, _b;
|
|
934
|
+
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"]);
|
|
935
|
+
}
|
|
936
|
+
function addPseudoToStyles(styles, initialPseudos, pseudos, name, force = false) {
|
|
937
|
+
const pseudoStyle = pseudos[name];
|
|
938
|
+
const shouldNestObject = isWeb && name !== "enterStyle" && name !== "exitStyle";
|
|
939
|
+
const defaultPseudoStyle = initialPseudos[name];
|
|
940
|
+
const style = defaultPseudoStyle ? { ...defaultPseudoStyle, ...pseudoStyle } : pseudoStyle;
|
|
941
|
+
if (style) {
|
|
942
|
+
styles.push(shouldNestObject && !force ? { [name]: style } : style);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
const DefaultProps = /* @__PURE__ */ new Map();
|
|
946
|
+
function mergeConfigDefaultProps(name, props, configDefaults, parentNames, conf) {
|
|
947
|
+
const len = parentNames.length;
|
|
948
|
+
let prev;
|
|
949
|
+
for (let i = 0; i < len; i++) {
|
|
950
|
+
const n = parentNames[i];
|
|
951
|
+
if (!n)
|
|
952
|
+
continue;
|
|
953
|
+
if (DefaultProps.has(n)) {
|
|
954
|
+
prev = DefaultProps.get(n);
|
|
955
|
+
continue;
|
|
956
|
+
}
|
|
957
|
+
const props2 = configDefaults[n];
|
|
958
|
+
if (!props2) {
|
|
959
|
+
if (prev) {
|
|
960
|
+
DefaultProps.set(n, prev);
|
|
961
|
+
}
|
|
962
|
+
continue;
|
|
963
|
+
}
|
|
964
|
+
prev = mergeProps(prev || {}, props2, false, conf.inverseShorthands)[0];
|
|
965
|
+
DefaultProps.set(n, prev);
|
|
966
|
+
}
|
|
967
|
+
const ourDefaultsMerged = DefaultProps.get(name);
|
|
968
|
+
if (ourDefaultsMerged) {
|
|
969
|
+
return mergeProps(props, ourDefaultsMerged, false, conf.inverseShorthands)[0];
|
|
970
|
+
}
|
|
971
|
+
return props;
|
|
972
|
+
}
|
|
973
|
+
const defaults = {
|
|
974
|
+
left: 0,
|
|
975
|
+
right: 0,
|
|
976
|
+
top: 0,
|
|
977
|
+
bottom: 0,
|
|
978
|
+
opacity: 1,
|
|
979
|
+
translateX: 0,
|
|
980
|
+
translateY: 0,
|
|
981
|
+
skew: 0,
|
|
982
|
+
skewX: 0,
|
|
983
|
+
skewY: 0,
|
|
984
|
+
scale: 1,
|
|
985
|
+
rotate: "0deg",
|
|
986
|
+
rotateY: "0deg",
|
|
987
|
+
rotateX: "0deg"
|
|
988
|
+
};
|
|
989
|
+
function ensureBaseHasDefaults(base, ...pseudos) {
|
|
990
|
+
for (const pseudo of pseudos) {
|
|
991
|
+
if (!pseudo)
|
|
992
|
+
continue;
|
|
993
|
+
for (const key in pseudo) {
|
|
994
|
+
const val = pseudo[key];
|
|
995
|
+
if (key === "transform") {
|
|
996
|
+
if (typeof val === "string") {
|
|
997
|
+
continue;
|
|
998
|
+
}
|
|
999
|
+
for (const t of val) {
|
|
1000
|
+
const tkey = Object.keys(t)[0];
|
|
1001
|
+
const defaultVal = defaults[tkey];
|
|
1002
|
+
const tDefaultVal = { [tkey]: defaultVal };
|
|
1003
|
+
if (!base.transform) {
|
|
1004
|
+
base.transform = [tDefaultVal];
|
|
1005
|
+
} else {
|
|
1006
|
+
if (!base.transform.find((x) => x[tkey])) {
|
|
1007
|
+
base.transform.push(tDefaultVal);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
} else {
|
|
1012
|
+
if (!(key in base)) {
|
|
1013
|
+
base[key] = defaults[key];
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
function merge(base, next) {
|
|
1020
|
+
if (!next.transform || !base.transform) {
|
|
1021
|
+
Object.assign(base, next);
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
const { transform, ...rest } = next;
|
|
1025
|
+
Object.assign(base, rest);
|
|
1026
|
+
for (const t of transform) {
|
|
1027
|
+
const key = Object.keys(t)[0];
|
|
1028
|
+
const existing = base.transform.find((x) => key in x);
|
|
1029
|
+
if (existing) {
|
|
1030
|
+
existing[key] = t[key];
|
|
1031
|
+
} else {
|
|
1032
|
+
base.transform.push(t);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
function usePlatformMethods(hostRef) {
|
|
1037
|
+
useIsomorphicLayoutEffect(() => {
|
|
1038
|
+
const node = hostRef.current;
|
|
1039
|
+
if (!node)
|
|
1040
|
+
return;
|
|
1041
|
+
node.measure = (callback) => measureLayout(node, null, callback);
|
|
1042
|
+
node.measureLayout = (relativeToNode, success) => measureLayout(node, relativeToNode, success);
|
|
1043
|
+
node.measureInWindow = (callback) => {
|
|
1044
|
+
if (!node)
|
|
1045
|
+
return;
|
|
1046
|
+
setTimeout(() => {
|
|
1047
|
+
const { height, left, top, width } = getRect(node);
|
|
1048
|
+
callback(left, top, width, height);
|
|
1049
|
+
}, 0);
|
|
1050
|
+
};
|
|
1051
|
+
}, [hostRef]);
|
|
1052
|
+
}
|
|
1053
|
+
const AbsoluteFill = createComponent({
|
|
1054
|
+
componentName: "AbsoluteFill",
|
|
1055
|
+
defaultProps: {
|
|
1056
|
+
...stackDefaultStyles,
|
|
1057
|
+
flexDirection: "column",
|
|
1058
|
+
position: "absolute",
|
|
1059
|
+
top: 0,
|
|
1060
|
+
right: 0,
|
|
1061
|
+
bottom: 0,
|
|
1062
|
+
left: 0,
|
|
1063
|
+
pointerEvents: "box-none"
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
const styleDisplayContents = {
|
|
1067
|
+
display: "contents"
|
|
1068
|
+
};
|
|
1069
|
+
const dontComposePressabilityKeys = {
|
|
1070
|
+
onClick: true
|
|
1071
|
+
};
|
|
1072
|
+
function getMediaStateObject(obj) {
|
|
1073
|
+
return Object.fromEntries(Object.entries(obj).flatMap(([k, v]) => v ? [[`$${k}`, v]] : []));
|
|
646
1074
|
}
|
|
647
|
-
__name(AbsoluteFill, "AbsoluteFill");
|
|
648
1075
|
export {
|
|
649
|
-
AbsoluteFill,
|
|
650
1076
|
Spacer,
|
|
1077
|
+
Unspaced,
|
|
651
1078
|
createComponent,
|
|
652
1079
|
mouseUps,
|
|
653
1080
|
spacedChildren
|