@tamagui/web 1.61.3 → 1.62.1
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 +10 -26
- package/dist/cjs/Tamagui.js.map +1 -1
- package/dist/cjs/Tamagui.native.js +64 -0
- package/dist/cjs/Tamagui.native.js.map +6 -0
- package/dist/cjs/config.js +25 -64
- package/dist/cjs/config.js.map +2 -2
- package/dist/cjs/config.native.js +90 -0
- package/dist/cjs/config.native.js.map +6 -0
- package/dist/cjs/constants/accessibilityDirectMap.js +41 -51
- package/dist/cjs/constants/accessibilityDirectMap.js.map +1 -1
- package/dist/cjs/constants/accessibilityDirectMap.native.js +9 -16
- package/dist/cjs/constants/accessibilityDirectMap.native.js.map +1 -1
- package/dist/cjs/constants/constants.js +16 -24
- package/dist/cjs/constants/constants.js.map +1 -1
- package/dist/cjs/constants/constants.native.js +32 -0
- package/dist/cjs/constants/constants.native.js.map +6 -0
- package/dist/cjs/constants/isDevTools.js +7 -12
- package/dist/cjs/constants/isDevTools.js.map +1 -1
- package/dist/cjs/constants/isDevTools.native.js +33 -0
- package/dist/cjs/constants/isDevTools.native.js.map +6 -0
- package/dist/cjs/contexts/ComponentContext.js +8 -14
- package/dist/cjs/contexts/ComponentContext.js.map +1 -1
- package/dist/cjs/contexts/ComponentContext.native.js +42 -0
- package/dist/cjs/contexts/ComponentContext.native.js.map +6 -0
- package/dist/cjs/createComponent.js +288 -710
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createComponent.native.js +643 -0
- package/dist/cjs/createComponent.native.js.map +6 -0
- package/dist/cjs/createFont.js +18 -29
- package/dist/cjs/createFont.js.map +1 -1
- package/dist/cjs/createFont.native.js +59 -0
- package/dist/cjs/createFont.native.js.map +6 -0
- package/dist/cjs/createShorthands.js +5 -9
- package/dist/cjs/createShorthands.js.map +1 -1
- package/dist/cjs/createShorthands.native.js +28 -0
- package/dist/cjs/createShorthands.native.js.map +6 -0
- package/dist/cjs/createTamagui.js +56 -144
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTamagui.native.js +186 -0
- package/dist/cjs/createTamagui.native.js.map +6 -0
- package/dist/cjs/createTheme.js +6 -12
- package/dist/cjs/createTheme.js.map +1 -1
- package/dist/cjs/createTheme.native.js +26 -0
- package/dist/cjs/createTheme.native.js.map +6 -0
- package/dist/cjs/createTokens.js +5 -9
- package/dist/cjs/createTokens.js.map +1 -1
- package/dist/cjs/createTokens.native.js +29 -0
- package/dist/cjs/createTokens.native.js.map +6 -0
- package/dist/cjs/createVariable.js +20 -47
- package/dist/cjs/createVariable.js.map +1 -1
- package/dist/cjs/createVariable.native.js +85 -0
- package/dist/cjs/createVariable.native.js.map +6 -0
- package/dist/cjs/createVariables.js +11 -22
- package/dist/cjs/createVariables.js.map +1 -1
- package/dist/cjs/createVariables.native.js +54 -0
- package/dist/cjs/createVariables.native.js.map +6 -0
- package/dist/cjs/helpers/ThemeManager.js +75 -169
- package/dist/cjs/helpers/ThemeManager.js.map +1 -1
- package/dist/cjs/helpers/ThemeManager.native.js +178 -0
- package/dist/cjs/helpers/ThemeManager.native.js.map +6 -0
- package/dist/cjs/helpers/ThemeManagerContext.js +5 -9
- package/dist/cjs/helpers/ThemeManagerContext.js.map +1 -1
- package/dist/cjs/helpers/ThemeManagerContext.native.js +27 -0
- package/dist/cjs/helpers/ThemeManagerContext.native.js.map +6 -0
- package/dist/cjs/helpers/createChainedWeakCache.js +14 -24
- package/dist/cjs/helpers/createChainedWeakCache.js.map +1 -1
- package/dist/cjs/helpers/createChainedWeakCache.native.js +54 -0
- package/dist/cjs/helpers/createChainedWeakCache.native.js.map +6 -0
- package/dist/cjs/helpers/createMediaStyle.js +20 -70
- package/dist/cjs/helpers/createMediaStyle.js.map +1 -1
- package/dist/cjs/helpers/createMediaStyle.native.js +72 -0
- package/dist/cjs/helpers/createMediaStyle.native.js.map +6 -0
- package/dist/cjs/helpers/createProxy.js +11 -20
- package/dist/cjs/helpers/createProxy.js.map +1 -1
- package/dist/cjs/helpers/createProxy.native.js +35 -0
- package/dist/cjs/helpers/createProxy.native.js.map +6 -0
- package/dist/cjs/helpers/createShallowSetState.js +7 -13
- package/dist/cjs/helpers/createShallowSetState.js.map +1 -1
- package/dist/cjs/helpers/createShallowSetState.native.js +36 -0
- package/dist/cjs/helpers/createShallowSetState.native.js.map +6 -0
- package/dist/cjs/helpers/createStyledContext.js +12 -26
- package/dist/cjs/helpers/createStyledContext.js.map +1 -1
- package/dist/cjs/helpers/createStyledContext.native.js +39 -0
- package/dist/cjs/helpers/createStyledContext.native.js.map +6 -0
- package/dist/cjs/helpers/defaultOffset.js +5 -9
- package/dist/cjs/helpers/defaultOffset.js.map +1 -1
- package/dist/cjs/helpers/defaultOffset.native.js +26 -0
- package/dist/cjs/helpers/defaultOffset.native.js.map +6 -0
- package/dist/cjs/helpers/expandStyle.js +20 -40
- package/dist/cjs/helpers/expandStyle.js.map +1 -1
- package/dist/cjs/helpers/expandStyle.native.js +64 -0
- package/dist/cjs/helpers/expandStyle.native.js.map +6 -0
- package/dist/cjs/helpers/expandStyles.js +13 -39
- package/dist/cjs/helpers/expandStyles.js.map +1 -1
- package/dist/cjs/helpers/expandStyles.native.js +55 -0
- package/dist/cjs/helpers/expandStyles.native.js.map +6 -0
- package/dist/cjs/helpers/getAnimationDriver.js +5 -9
- package/dist/cjs/helpers/getAnimationDriver.js.map +1 -1
- package/dist/cjs/helpers/getAnimationDriver.native.js +29 -0
- package/dist/cjs/helpers/getAnimationDriver.native.js.map +6 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +6 -11
- package/dist/cjs/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/cjs/helpers/getExpandedShorthands.native.js +35 -0
- package/dist/cjs/helpers/getExpandedShorthands.native.js.map +6 -0
- package/dist/cjs/helpers/getFontLanguage.js +5 -9
- package/dist/cjs/helpers/getFontLanguage.js.map +1 -1
- package/dist/cjs/helpers/getFontLanguage.native.js +26 -0
- package/dist/cjs/helpers/getFontLanguage.native.js.map +6 -0
- package/dist/cjs/helpers/getGroupPropParts.js +7 -17
- package/dist/cjs/helpers/getGroupPropParts.js.map +1 -1
- package/dist/cjs/helpers/getGroupPropParts.native.js +32 -0
- package/dist/cjs/helpers/getGroupPropParts.native.js.map +6 -0
- package/dist/cjs/helpers/getSplitStyles.js +364 -827
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.native.js +503 -0
- package/dist/cjs/helpers/getSplitStyles.native.js.map +6 -0
- package/dist/cjs/helpers/getStylesAtomic.js +39 -102
- package/dist/cjs/helpers/getStylesAtomic.js.map +1 -1
- package/dist/cjs/helpers/getStylesAtomic.native.js +6 -13
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js +25 -70
- package/dist/cjs/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.native.js +5 -8
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +1 -1
- package/dist/cjs/helpers/getVariantExtras.js +13 -26
- package/dist/cjs/helpers/getVariantExtras.js.map +1 -1
- package/dist/cjs/helpers/getVariantExtras.native.js +72 -0
- package/dist/cjs/helpers/getVariantExtras.native.js.map +6 -0
- package/dist/cjs/helpers/insertStyleRule.js +85 -197
- package/dist/cjs/helpers/insertStyleRule.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.native.js +223 -0
- package/dist/cjs/helpers/insertStyleRule.native.js.map +6 -0
- package/dist/cjs/helpers/isObj.js +6 -10
- package/dist/cjs/helpers/isObj.js.map +1 -1
- package/dist/cjs/helpers/isObj.native.js +26 -0
- package/dist/cjs/helpers/isObj.native.js.map +6 -0
- package/dist/cjs/helpers/isTamaguiComponent.js +7 -11
- package/dist/cjs/helpers/isTamaguiComponent.js.map +1 -1
- package/dist/cjs/helpers/isTamaguiComponent.native.js +29 -0
- package/dist/cjs/helpers/isTamaguiComponent.native.js.map +6 -0
- package/dist/cjs/helpers/isTamaguiElement.js +7 -14
- package/dist/cjs/helpers/isTamaguiElement.js.map +1 -1
- package/dist/cjs/helpers/isTamaguiElement.native.js +27 -0
- package/dist/cjs/helpers/isTamaguiElement.native.js.map +6 -0
- package/dist/cjs/helpers/matchMedia.js +8 -12
- package/dist/cjs/helpers/matchMedia.js.map +1 -1
- package/dist/cjs/helpers/matchMedia.native.js +9 -16
- package/dist/cjs/helpers/matchMedia.native.js.map +1 -1
- package/dist/cjs/helpers/mergeProps.js +10 -18
- package/dist/cjs/helpers/mergeProps.js.map +1 -1
- package/dist/cjs/helpers/mergeProps.native.js +49 -0
- package/dist/cjs/helpers/mergeProps.native.js.map +6 -0
- package/dist/cjs/helpers/mergeVariants.js +16 -30
- package/dist/cjs/helpers/mergeVariants.js.map +1 -1
- package/dist/cjs/helpers/mergeVariants.native.js +56 -0
- package/dist/cjs/helpers/mergeVariants.native.js.map +6 -0
- package/dist/cjs/helpers/normalizeColor.js +9 -27
- package/dist/cjs/helpers/normalizeColor.js.map +1 -1
- package/dist/cjs/helpers/normalizeColor.native.js +40 -0
- package/dist/cjs/helpers/normalizeColor.native.js.map +6 -0
- package/dist/cjs/helpers/normalizeShadow.js +6 -12
- package/dist/cjs/helpers/normalizeShadow.js.map +1 -1
- package/dist/cjs/helpers/normalizeShadow.native.js +8 -17
- package/dist/cjs/helpers/normalizeShadow.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeStylePropKeys.js +5 -9
- package/dist/cjs/helpers/normalizeStylePropKeys.js.map +1 -1
- package/dist/cjs/helpers/normalizeStylePropKeys.native.js +15 -18
- package/dist/cjs/helpers/normalizeStylePropKeys.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.js +22 -63
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js +60 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +6 -0
- package/dist/cjs/helpers/objectIdentityKey.js +9 -14
- package/dist/cjs/helpers/objectIdentityKey.js.map +1 -1
- package/dist/cjs/helpers/objectIdentityKey.native.js +43 -0
- package/dist/cjs/helpers/objectIdentityKey.native.js.map +6 -0
- package/dist/cjs/helpers/propMapper.js +91 -241
- package/dist/cjs/helpers/propMapper.js.map +1 -1
- package/dist/cjs/helpers/propMapper.native.js +201 -0
- package/dist/cjs/helpers/propMapper.native.js.map +6 -0
- package/dist/cjs/helpers/proxyThemeToParents.js +12 -29
- package/dist/cjs/helpers/proxyThemeToParents.js.map +1 -1
- package/dist/cjs/helpers/proxyThemeToParents.native.js +62 -0
- package/dist/cjs/helpers/proxyThemeToParents.native.js.map +6 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +6 -10
- package/dist/cjs/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/cjs/helpers/proxyThemeVariables.native.js +37 -0
- package/dist/cjs/helpers/proxyThemeVariables.native.js.map +6 -0
- package/dist/cjs/helpers/pseudoDescriptors.js +7 -13
- package/dist/cjs/helpers/pseudoDescriptors.js.map +1 -1
- package/dist/cjs/helpers/pseudoDescriptors.native.js +60 -0
- package/dist/cjs/helpers/pseudoDescriptors.native.js.map +6 -0
- package/dist/cjs/helpers/registerCSSVariable.js +6 -14
- package/dist/cjs/helpers/registerCSSVariable.js.map +1 -1
- package/dist/cjs/helpers/registerCSSVariable.native.js +33 -0
- package/dist/cjs/helpers/registerCSSVariable.native.js.map +6 -0
- package/dist/cjs/helpers/themeable.js +15 -27
- package/dist/cjs/helpers/themeable.js.map +1 -1
- package/dist/cjs/helpers/themeable.native.js +56 -0
- package/dist/cjs/helpers/themeable.native.js.map +6 -0
- package/dist/cjs/helpers/themes.js +15 -26
- package/dist/cjs/helpers/themes.js.map +1 -1
- package/dist/cjs/helpers/themes.native.js +38 -0
- package/dist/cjs/helpers/themes.native.js.map +6 -0
- package/dist/cjs/helpers/timer.js +6 -10
- package/dist/cjs/helpers/timer.js.map +1 -1
- package/dist/cjs/helpers/timer.native.js +32 -0
- package/dist/cjs/helpers/timer.native.js.map +6 -0
- package/dist/cjs/helpers/withStaticProperties.js +8 -15
- package/dist/cjs/helpers/withStaticProperties.js.map +1 -1
- package/dist/cjs/helpers/withStaticProperties.native.js +41 -0
- package/dist/cjs/helpers/withStaticProperties.native.js.map +6 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js +6 -13
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +1 -1
- package/dist/cjs/hooks/getThemeUnwrapped.native.js +28 -0
- package/dist/cjs/hooks/getThemeUnwrapped.native.js.map +6 -0
- package/dist/cjs/hooks/useAnimationDriver.js +7 -15
- package/dist/cjs/hooks/useAnimationDriver.js.map +1 -1
- package/dist/cjs/hooks/useAnimationDriver.native.js +27 -0
- package/dist/cjs/hooks/useAnimationDriver.native.js.map +6 -0
- package/dist/cjs/hooks/useId.js +5 -9
- package/dist/cjs/hooks/useId.js.map +1 -1
- package/dist/cjs/hooks/useId.native.js +26 -0
- package/dist/cjs/hooks/useId.native.js.map +6 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +7 -14
- package/dist/cjs/hooks/useIsTouchDevice.js.map +1 -1
- package/dist/cjs/hooks/useIsTouchDevice.native.js +27 -0
- package/dist/cjs/hooks/useIsTouchDevice.native.js.map +6 -0
- package/dist/cjs/hooks/useMedia.js +60 -170
- package/dist/cjs/hooks/useMedia.js.map +2 -2
- package/dist/cjs/hooks/useMedia.native.js +219 -0
- package/dist/cjs/hooks/useMedia.native.js.map +6 -0
- package/dist/cjs/hooks/useMemoDebug.js +7 -17
- package/dist/cjs/hooks/useMemoDebug.js.map +1 -1
- package/dist/cjs/hooks/useMemoDebug.native.js +31 -0
- package/dist/cjs/hooks/useMemoDebug.native.js.map +6 -0
- package/dist/cjs/hooks/useProps.js +7 -11
- package/dist/cjs/hooks/useProps.js.map +1 -1
- package/dist/cjs/hooks/useProps.native.js +32 -0
- package/dist/cjs/hooks/useProps.native.js.map +6 -0
- package/dist/cjs/hooks/useStyle.js +8 -21
- package/dist/cjs/hooks/useStyle.js.map +1 -1
- package/dist/cjs/hooks/useStyle.native.js +48 -0
- package/dist/cjs/hooks/useStyle.native.js.map +6 -0
- package/dist/cjs/hooks/useTheme.js +95 -215
- package/dist/cjs/hooks/useTheme.js.map +1 -1
- package/dist/cjs/hooks/useTheme.native.js +215 -0
- package/dist/cjs/hooks/useTheme.native.js.map +6 -0
- package/dist/cjs/hooks/useThemeName.js +14 -26
- package/dist/cjs/hooks/useThemeName.js.map +1 -1
- package/dist/cjs/hooks/useThemeName.native.js +36 -0
- package/dist/cjs/hooks/useThemeName.native.js.map +6 -0
- package/dist/cjs/index.js +7 -11
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +168 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/cjs/inject-styles.js +7 -15
- package/dist/cjs/inject-styles.js.map +1 -1
- package/dist/cjs/inject-styles.native.js +33 -0
- package/dist/cjs/inject-styles.native.js.map +6 -0
- package/dist/cjs/insertFont.js +25 -49
- package/dist/cjs/insertFont.js.map +1 -1
- package/dist/cjs/insertFont.native.js +69 -0
- package/dist/cjs/insertFont.native.js.map +6 -0
- package/dist/cjs/interfaces/CSSColorNames.js +3 -6
- package/dist/cjs/interfaces/CSSColorNames.js.map +1 -1
- package/dist/cjs/interfaces/CSSColorNames.native.js +15 -0
- package/dist/cjs/interfaces/CSSColorNames.native.js.map +6 -0
- package/dist/cjs/interfaces/GetRef.js +3 -6
- package/dist/cjs/interfaces/GetRef.js.map +1 -1
- package/dist/cjs/interfaces/GetRef.native.js +15 -0
- package/dist/cjs/interfaces/GetRef.native.js.map +6 -0
- package/dist/cjs/interfaces/Role.js +3 -6
- package/dist/cjs/interfaces/Role.js.map +1 -1
- package/dist/cjs/interfaces/Role.native.js +15 -0
- package/dist/cjs/interfaces/Role.native.js.map +6 -0
- package/dist/cjs/setupHooks.js +5 -9
- package/dist/cjs/setupHooks.js.map +1 -1
- package/dist/cjs/setupHooks.native.js +31 -0
- package/dist/cjs/setupHooks.native.js.map +6 -0
- package/dist/cjs/setupReactNative.js +11 -17
- package/dist/cjs/setupReactNative.js.map +1 -1
- package/dist/cjs/setupReactNative.native.js +44 -0
- package/dist/cjs/setupReactNative.native.js.map +6 -0
- package/dist/cjs/styled.js +25 -67
- package/dist/cjs/styled.js.map +1 -1
- package/dist/cjs/styled.native.js +75 -0
- package/dist/cjs/styled.native.js.map +6 -0
- package/dist/cjs/types.js +3 -6
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/types.native.js +15 -0
- package/dist/cjs/types.native.js.map +6 -0
- package/dist/cjs/views/AnimationDriverProvider.js +7 -14
- package/dist/cjs/views/AnimationDriverProvider.js.map +1 -1
- package/dist/cjs/views/AnimationDriverProvider.native.js +27 -0
- package/dist/cjs/views/AnimationDriverProvider.native.js.map +6 -0
- package/dist/cjs/views/FontLanguage.js +15 -21
- package/dist/cjs/views/FontLanguage.js.map +1 -1
- package/dist/cjs/views/FontLanguage.native.js +6 -11
- package/dist/cjs/views/FontLanguage.native.js.map +1 -1
- package/dist/cjs/views/FontLanguage.types.js +3 -6
- package/dist/cjs/views/FontLanguage.types.js.map +1 -1
- package/dist/cjs/views/FontLanguage.types.native.js +15 -0
- package/dist/cjs/views/FontLanguage.types.native.js.map +6 -0
- package/dist/cjs/views/Slot.js +15 -46
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/cjs/views/Slot.native.js +58 -0
- package/dist/cjs/views/Slot.native.js.map +6 -0
- package/dist/cjs/views/Stack.js +7 -13
- package/dist/cjs/views/Stack.js.map +1 -1
- package/dist/cjs/views/Stack.native.js +31 -0
- package/dist/cjs/views/Stack.native.js.map +6 -0
- package/dist/cjs/views/TamaguiProvider.js +16 -38
- package/dist/cjs/views/TamaguiProvider.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.native.js +58 -0
- package/dist/cjs/views/TamaguiProvider.native.js.map +6 -0
- package/dist/cjs/views/Text.js +28 -45
- package/dist/cjs/views/Text.js.map +1 -1
- package/dist/cjs/views/Text.native.js +53 -0
- package/dist/cjs/views/Text.native.js.map +6 -0
- package/dist/cjs/views/Theme.js +41 -89
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/Theme.native.js +99 -0
- package/dist/cjs/views/Theme.native.js.map +6 -0
- package/dist/cjs/views/ThemeDebug.js +19 -52
- package/dist/cjs/views/ThemeDebug.js.map +2 -2
- package/dist/cjs/views/ThemeDebug.native.js +5 -8
- package/dist/cjs/views/ThemeDebug.native.js.map +1 -1
- package/dist/cjs/views/ThemeProvider.js +22 -37
- package/dist/cjs/views/ThemeProvider.js.map +1 -1
- package/dist/cjs/views/ThemeProvider.native.js +43 -0
- package/dist/cjs/views/ThemeProvider.native.js.map +6 -0
- package/dist/cjs/views/View.js +7 -12
- package/dist/cjs/views/View.js.map +1 -1
- package/dist/cjs/views/View.native.js +30 -0
- package/dist/cjs/views/View.native.js.map +6 -0
- package/dist/esm/Tamagui.js +2 -9
- package/dist/esm/Tamagui.js.map +1 -1
- package/dist/esm/config.js +20 -55
- package/dist/esm/config.js.map +2 -2
- package/dist/esm/constants/accessibilityDirectMap.js +36 -42
- package/dist/esm/constants/accessibilityDirectMap.js.map +1 -1
- package/dist/esm/constants/constants.js +11 -15
- package/dist/esm/constants/constants.js.map +1 -1
- package/dist/esm/constants/isDevTools.js +2 -3
- package/dist/esm/constants/isDevTools.js.map +1 -1
- package/dist/esm/contexts/ComponentContext.js +3 -5
- package/dist/esm/contexts/ComponentContext.js.map +1 -1
- package/dist/esm/createComponent.js +281 -677
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createFont.js +13 -20
- package/dist/esm/createFont.js.map +1 -1
- package/dist/esm/createTamagui.js +50 -124
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTheme.js +1 -3
- package/dist/esm/createTheme.js.map +1 -1
- package/dist/esm/createVariable.js +14 -35
- package/dist/esm/createVariable.js.map +1 -1
- package/dist/esm/createVariables.js +5 -11
- package/dist/esm/createVariables.js.map +1 -1
- package/dist/esm/helpers/ThemeManager.js +69 -157
- package/dist/esm/helpers/ThemeManager.js.map +1 -1
- package/dist/esm/helpers/createChainedWeakCache.js +9 -15
- package/dist/esm/helpers/createChainedWeakCache.js.map +1 -1
- package/dist/esm/helpers/createMediaStyle.js +14 -58
- package/dist/esm/helpers/createMediaStyle.js.map +1 -1
- package/dist/esm/helpers/createProxy.js +6 -11
- package/dist/esm/helpers/createProxy.js.map +1 -1
- package/dist/esm/helpers/createShallowSetState.js +2 -4
- package/dist/esm/helpers/createShallowSetState.js.map +1 -1
- package/dist/esm/helpers/createStyledContext.js +7 -15
- package/dist/esm/helpers/createStyledContext.js.map +1 -1
- package/dist/esm/helpers/expandStyle.js +16 -32
- package/dist/esm/helpers/expandStyle.js.map +1 -1
- package/dist/esm/helpers/expandStyles.js +7 -25
- package/dist/esm/helpers/expandStyles.js.map +1 -1
- package/dist/esm/helpers/getExpandedShorthands.js +1 -2
- package/dist/esm/helpers/getExpandedShorthands.js.map +1 -1
- package/dist/esm/helpers/getGroupPropParts.js +2 -8
- package/dist/esm/helpers/getGroupPropParts.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +360 -810
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.js +33 -88
- package/dist/esm/helpers/getStylesAtomic.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js +19 -57
- package/dist/esm/helpers/getThemeCSSRules.js.map +1 -1
- package/dist/esm/helpers/getVariantExtras.js +7 -15
- package/dist/esm/helpers/getVariantExtras.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.js +79 -186
- package/dist/esm/helpers/insertStyleRule.js.map +1 -1
- package/dist/esm/helpers/isObj.js +1 -1
- package/dist/esm/helpers/isObj.js.map +1 -1
- package/dist/esm/helpers/isTamaguiComponent.js +2 -2
- package/dist/esm/helpers/isTamaguiComponent.js.map +1 -1
- package/dist/esm/helpers/isTamaguiElement.js +1 -3
- package/dist/esm/helpers/isTamaguiElement.js.map +1 -1
- package/dist/esm/helpers/matchMedia.js +3 -3
- package/dist/esm/helpers/matchMedia.js.map +1 -1
- package/dist/esm/helpers/mergeProps.js +5 -9
- package/dist/esm/helpers/mergeProps.js.map +1 -1
- package/dist/esm/helpers/mergeVariants.js +11 -21
- package/dist/esm/helpers/mergeVariants.js.map +1 -1
- package/dist/esm/helpers/normalizeColor.js +3 -15
- package/dist/esm/helpers/normalizeColor.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js +16 -51
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +1 -1
- package/dist/esm/helpers/objectIdentityKey.js +4 -5
- package/dist/esm/helpers/objectIdentityKey.js.map +1 -1
- package/dist/esm/helpers/propMapper.js +86 -223
- package/dist/esm/helpers/propMapper.js.map +1 -1
- package/dist/esm/helpers/proxyThemeToParents.js +6 -18
- package/dist/esm/helpers/proxyThemeToParents.js.map +1 -1
- package/dist/esm/helpers/proxyThemeVariables.js +1 -1
- package/dist/esm/helpers/proxyThemeVariables.js.map +1 -1
- package/dist/esm/helpers/pseudoDescriptors.js +2 -4
- package/dist/esm/helpers/pseudoDescriptors.js.map +1 -1
- package/dist/esm/helpers/registerCSSVariable.js +1 -5
- package/dist/esm/helpers/registerCSSVariable.js.map +1 -1
- package/dist/esm/helpers/themeable.js +8 -12
- package/dist/esm/helpers/themeable.js.map +1 -1
- package/dist/esm/helpers/themes.js +10 -17
- package/dist/esm/helpers/themes.js.map +1 -1
- package/dist/esm/helpers/timer.js +1 -1
- package/dist/esm/helpers/withStaticProperties.js +3 -6
- package/dist/esm/helpers/withStaticProperties.js.map +1 -1
- package/dist/esm/hooks/getThemeUnwrapped.js +1 -4
- package/dist/esm/hooks/getThemeUnwrapped.js.map +1 -1
- package/dist/esm/hooks/useAnimationDriver.js +1 -3
- package/dist/esm/hooks/useAnimationDriver.js.map +1 -1
- package/dist/esm/hooks/useIsTouchDevice.js +1 -3
- package/dist/esm/hooks/useIsTouchDevice.js.map +1 -1
- package/dist/esm/hooks/useMedia.js +54 -152
- package/dist/esm/hooks/useMedia.js.map +2 -2
- package/dist/esm/hooks/useMemoDebug.js +2 -8
- package/dist/esm/hooks/useMemoDebug.js.map +1 -1
- package/dist/esm/hooks/useProps.js +2 -2
- package/dist/esm/hooks/useProps.js.map +1 -1
- package/dist/esm/hooks/useStyle.js +2 -6
- package/dist/esm/hooks/useStyle.js.map +1 -1
- package/dist/esm/hooks/useTheme.js +89 -198
- package/dist/esm/hooks/useTheme.js.map +1 -1
- package/dist/esm/hooks/useThemeName.js +8 -14
- package/dist/esm/hooks/useThemeName.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/inject-styles.js +2 -6
- package/dist/esm/inject-styles.js.map +1 -1
- package/dist/esm/insertFont.js +19 -36
- package/dist/esm/insertFont.js.map +1 -1
- package/dist/esm/setupReactNative.js +6 -8
- package/dist/esm/setupReactNative.js.map +1 -1
- package/dist/esm/styled.js +19 -55
- package/dist/esm/styled.js.map +1 -1
- package/dist/esm/views/AnimationDriverProvider.js +2 -4
- package/dist/esm/views/AnimationDriverProvider.js.map +1 -1
- package/dist/esm/views/FontLanguage.js +10 -12
- package/dist/esm/views/FontLanguage.js.map +1 -1
- package/dist/esm/views/Slot.js +10 -33
- package/dist/esm/views/Slot.js.map +2 -2
- package/dist/esm/views/Stack.js +1 -1
- package/dist/esm/views/TamaguiProvider.js +9 -20
- package/dist/esm/views/TamaguiProvider.js.map +1 -1
- package/dist/esm/views/Text.js +22 -34
- package/dist/esm/views/Text.js.map +1 -1
- package/dist/esm/views/Theme.js +34 -70
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeDebug.js +14 -40
- package/dist/esm/views/ThemeDebug.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +17 -24
- package/dist/esm/views/ThemeProvider.js.map +1 -1
- package/dist/esm/views/View.js +1 -1
- package/package.json +15 -10
- package/src/createTamagui.ts +8 -7
- package/src/helpers/getStylesAtomic.ts +1 -0
- package/src/helpers/getThemeCSSRules.ts +3 -1
- package/src/index.ts +2 -0
- package/types/createTamagui.d.ts.map +1 -1
- package/types/helpers/getStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getThemeCSSRules.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/dist/esm/constants/accessibilityDirectMap.native.js +0 -63
- package/dist/esm/constants/accessibilityDirectMap.native.js.map +0 -6
- package/dist/esm/helpers/getStylesAtomic.native.js +0 -14
- package/dist/esm/helpers/getStylesAtomic.native.js.map +0 -6
- package/dist/esm/helpers/getThemeCSSRules.native.js +0 -7
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +0 -6
- package/dist/esm/helpers/matchMedia.native.js +0 -24
- package/dist/esm/helpers/matchMedia.native.js.map +0 -6
- package/dist/esm/helpers/normalizeShadow.native.js +0 -31
- package/dist/esm/helpers/normalizeShadow.native.js.map +0 -6
- package/dist/esm/helpers/normalizeStylePropKeys.native.js +0 -16
- package/dist/esm/helpers/normalizeStylePropKeys.native.js.map +0 -6
- package/dist/esm/views/FontLanguage.native.js +0 -11
- package/dist/esm/views/FontLanguage.native.js.map +0 -6
- package/dist/esm/views/ThemeDebug.native.js +0 -11
- package/dist/esm/views/ThemeDebug.native.js.map +0 -6
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
14
11
|
for (let key of __getOwnPropNames(from))
|
|
15
|
-
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
13
|
return to;
|
|
19
14
|
};
|
|
20
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -22,10 +17,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
17
|
// file that has been converted to a CommonJS file using a Babel-
|
|
23
18
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
19
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
26
21
|
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
29
23
|
var createComponent_exports = {};
|
|
30
24
|
__export(createComponent_exports, {
|
|
31
25
|
Spacer: () => Spacer,
|
|
@@ -36,75 +30,34 @@ __export(createComponent_exports, {
|
|
|
36
30
|
spacedChildren: () => spacedChildren
|
|
37
31
|
});
|
|
38
32
|
module.exports = __toCommonJS(createComponent_exports);
|
|
39
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
-
var import_compose_refs = require("@tamagui/compose-refs");
|
|
41
|
-
var import_constants = require("@tamagui/constants");
|
|
42
|
-
var import_helpers = require("@tamagui/helpers");
|
|
43
|
-
var import_use_did_finish_ssr = require("@tamagui/use-did-finish-ssr");
|
|
44
|
-
var import_react = __toESM(require("react"));
|
|
45
|
-
var import_config = require("./config");
|
|
46
|
-
var import_constants2 = require("./constants/constants");
|
|
47
|
-
var import_ComponentContext = require("./contexts/ComponentContext");
|
|
48
|
-
var import_createVariable = require("./createVariable");
|
|
49
|
-
var import_createShallowSetState = require("./helpers/createShallowSetState");
|
|
50
|
-
var import_getSplitStyles = require("./helpers/getSplitStyles");
|
|
51
|
-
var import_mergeProps = require("./helpers/mergeProps");
|
|
52
|
-
var import_proxyThemeVariables = require("./helpers/proxyThemeVariables");
|
|
53
|
-
var import_themeable = require("./helpers/themeable");
|
|
54
|
-
var import_useMedia = require("./hooks/useMedia");
|
|
55
|
-
var import_useTheme = require("./hooks/useTheme");
|
|
56
|
-
var import_setupHooks = require("./setupHooks");
|
|
57
|
-
var import_Slot = require("./views/Slot");
|
|
58
|
-
var import_Theme = require("./views/Theme");
|
|
59
|
-
var import_ThemeDebug = require("./views/ThemeDebug");
|
|
60
|
-
process.env.TAMAGUI_TARGET;
|
|
33
|
+
var import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_helpers = require("@tamagui/helpers"), import_use_did_finish_ssr = require("@tamagui/use-did-finish-ssr"), import_react = __toESM(require("react")), import_config = require("./config"), import_constants2 = require("./constants/constants"), import_ComponentContext = require("./contexts/ComponentContext"), import_createVariable = require("./createVariable"), import_createShallowSetState = require("./helpers/createShallowSetState"), import_getSplitStyles = require("./helpers/getSplitStyles"), import_mergeProps = require("./helpers/mergeProps"), import_proxyThemeVariables = require("./helpers/proxyThemeVariables"), import_themeable = require("./helpers/themeable"), import_useMedia = require("./hooks/useMedia"), import_useTheme = require("./hooks/useTheme"), import_setupHooks = require("./setupHooks"), import_Slot = require("./views/Slot"), import_Theme = require("./views/Theme"), import_ThemeDebug = require("./views/ThemeDebug"), import_jsx_runtime = require("react/jsx-runtime");
|
|
61
34
|
const defaultComponentState = {
|
|
62
|
-
hover:
|
|
63
|
-
press:
|
|
64
|
-
pressIn:
|
|
65
|
-
focus:
|
|
66
|
-
unmounted:
|
|
67
|
-
}
|
|
68
|
-
const defaultComponentStateMounted = {
|
|
35
|
+
hover: !1,
|
|
36
|
+
press: !1,
|
|
37
|
+
pressIn: !1,
|
|
38
|
+
focus: !1,
|
|
39
|
+
unmounted: !0
|
|
40
|
+
}, defaultComponentStateMounted = {
|
|
69
41
|
...defaultComponentState,
|
|
70
|
-
unmounted:
|
|
71
|
-
}
|
|
72
|
-
const defaultComponentStateShouldEnter = {
|
|
42
|
+
unmounted: !1
|
|
43
|
+
}, defaultComponentStateShouldEnter = {
|
|
73
44
|
...defaultComponentState,
|
|
74
45
|
unmounted: "should-enter"
|
|
75
46
|
};
|
|
76
|
-
let tamaguiConfig;
|
|
77
|
-
let AnimatedText;
|
|
78
|
-
let AnimatedView;
|
|
79
|
-
let initialTheme;
|
|
80
|
-
let time;
|
|
47
|
+
let tamaguiConfig, AnimatedText, AnimatedView, initialTheme, time;
|
|
81
48
|
const mouseUps = /* @__PURE__ */ new Set();
|
|
82
|
-
if (typeof document
|
|
49
|
+
if (typeof document < "u") {
|
|
83
50
|
const cancelTouches = () => {
|
|
84
|
-
mouseUps.forEach((x) => x());
|
|
85
|
-
mouseUps.clear();
|
|
51
|
+
mouseUps.forEach((x) => x()), mouseUps.clear();
|
|
86
52
|
};
|
|
87
|
-
addEventListener("mouseup", cancelTouches);
|
|
88
|
-
addEventListener("touchend", cancelTouches);
|
|
89
|
-
addEventListener("touchcancel", cancelTouches);
|
|
53
|
+
addEventListener("mouseup", cancelTouches), addEventListener("touchend", cancelTouches), addEventListener("touchcancel", cancelTouches);
|
|
90
54
|
}
|
|
91
|
-
let BaseText;
|
|
92
|
-
let BaseView;
|
|
93
|
-
let hasSetupBaseViews = false;
|
|
55
|
+
let BaseText, BaseView;
|
|
94
56
|
function createComponent(staticConfig) {
|
|
95
|
-
var _a;
|
|
96
57
|
(0, import_config.onConfiguredOnce)((conf) => {
|
|
97
|
-
if (!tamaguiConfig) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const next = conf.themes[Object.keys(conf.themes)[0]];
|
|
101
|
-
initialTheme = (0, import_proxyThemeVariables.proxyThemeVariables)(next);
|
|
102
|
-
if (process.env.NODE_ENV === "development") {
|
|
103
|
-
if (!initialTheme) {
|
|
104
|
-
console.log("Warning: Missing theme");
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
58
|
+
if (!tamaguiConfig && (tamaguiConfig = conf, !initialTheme)) {
|
|
59
|
+
const next = conf.themes[Object.keys(conf.themes)[0]];
|
|
60
|
+
initialTheme = (0, import_proxyThemeVariables.proxyThemeVariables)(next), process.env.NODE_ENV === "development" && (initialTheme || console.log("Warning: Missing theme"));
|
|
108
61
|
}
|
|
109
62
|
});
|
|
110
63
|
const {
|
|
@@ -114,40 +67,16 @@ function createComponent(staticConfig) {
|
|
|
114
67
|
isHOC,
|
|
115
68
|
validStyles: validStyles2 = {},
|
|
116
69
|
variants = {}
|
|
117
|
-
} = staticConfig;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
staticConfig,
|
|
124
|
-
defaultProps,
|
|
125
|
-
defaultPropsKeyOrder: defaultProps ? Object.keys(defaultProps) : []
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
70
|
+
} = staticConfig, defaultComponentClassName = `is_${staticConfig.componentName}`, defaultProps = staticConfig.defaultProps;
|
|
71
|
+
process.env.NODE_ENV === "development" && staticConfig.defaultProps?.debug && process.env.IS_STATIC !== "is_static" && console.log(`\u{1F41B} [${staticConfig.componentName || "Component"}]`, {
|
|
72
|
+
staticConfig,
|
|
73
|
+
defaultProps,
|
|
74
|
+
defaultPropsKeyOrder: defaultProps ? Object.keys(defaultProps) : []
|
|
75
|
+
});
|
|
129
76
|
const component = (0, import_react.forwardRef)((propsIn, forwardedRef) => {
|
|
130
|
-
|
|
131
|
-
if (process.env.TAMAGUI_TARGET === "native") {
|
|
132
|
-
if (!hasSetupBaseViews) {
|
|
133
|
-
hasSetupBaseViews = true;
|
|
134
|
-
const baseViews = (_b = (_a2 = import_setupHooks.hooks).getBaseViews) == null ? void 0 : _b.call(_a2);
|
|
135
|
-
if (baseViews) {
|
|
136
|
-
BaseText = baseViews.Text;
|
|
137
|
-
BaseView = baseViews.View;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (process.env.NODE_ENV === "test") {
|
|
142
|
-
if (propsIn["data-test-renders"]) {
|
|
143
|
-
(_c = propsIn["data-test-renders"])["current"] ?? (_c["current"] = 0);
|
|
144
|
-
propsIn["data-test-renders"]["current"] += 1;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
77
|
+
process.env.NODE_ENV === "test" && propsIn["data-test-renders"] && (propsIn["data-test-renders"].current ??= 0, propsIn["data-test-renders"].current += 1);
|
|
147
78
|
const componentContext = (0, import_react.useContext)(import_ComponentContext.ComponentContext);
|
|
148
|
-
let styledContextProps;
|
|
149
|
-
let overriddenContextProps;
|
|
150
|
-
let contextValue;
|
|
79
|
+
let styledContextProps, overriddenContextProps, contextValue;
|
|
151
80
|
const { context } = staticConfig;
|
|
152
81
|
if (context) {
|
|
153
82
|
contextValue = (0, import_react.useContext)(context);
|
|
@@ -155,79 +84,36 @@ function createComponent(staticConfig) {
|
|
|
155
84
|
for (const key in context.props) {
|
|
156
85
|
const propVal = (
|
|
157
86
|
// because its after default props but before props this annoying amount of checks
|
|
158
|
-
propsIn[key] ?? propsIn[inverseShorthands[key]] ??
|
|
87
|
+
propsIn[key] ?? propsIn[inverseShorthands[key]] ?? defaultProps?.[key] ?? defaultProps?.[inverseShorthands[key]]
|
|
159
88
|
);
|
|
160
|
-
|
|
161
|
-
if (contextValue) {
|
|
162
|
-
const isValidValue = key in validStyles2 || key in variants;
|
|
163
|
-
if (isValidValue) {
|
|
164
|
-
styledContextProps || (styledContextProps = {});
|
|
165
|
-
styledContextProps[key] = contextValue[key];
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
} else {
|
|
169
|
-
overriddenContextProps || (overriddenContextProps = {});
|
|
170
|
-
overriddenContextProps[key] = propVal;
|
|
171
|
-
}
|
|
89
|
+
propVal === void 0 ? contextValue && (key in validStyles2 || key in variants) && (styledContextProps ||= {}, styledContextProps[key] = contextValue[key]) : (overriddenContextProps ||= {}, overriddenContextProps[key] = propVal);
|
|
172
90
|
}
|
|
173
91
|
}
|
|
174
92
|
const curDefaultProps = styledContextProps ? { ...defaultProps, ...styledContextProps } : defaultProps;
|
|
175
93
|
let props;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
props = propsIn;
|
|
180
|
-
}
|
|
181
|
-
const debugProp = props["debug"];
|
|
182
|
-
const componentName = props.componentName || staticConfig.componentName;
|
|
183
|
-
if (!process.env.TAMAGUI_IS_CORE_NODE && process.env.NODE_ENV === "development" && debugProp === "profile" && !time) {
|
|
184
|
-
const timer = require("@tamagui/timer").timer();
|
|
185
|
-
time = timer.start();
|
|
186
|
-
}
|
|
187
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
188
|
-
time`start (ignore)`;
|
|
94
|
+
curDefaultProps ? props = (0, import_mergeProps.mergeProps)(curDefaultProps, propsIn) : props = propsIn;
|
|
95
|
+
const debugProp = props.debug, componentName = props.componentName || staticConfig.componentName;
|
|
96
|
+
!process.env.TAMAGUI_IS_CORE_NODE && process.env.NODE_ENV === "development" && debugProp === "profile" && !time && (time = require("@tamagui/timer").timer().start()), process.env.NODE_ENV === "development" && time && time`start (ignore)`;
|
|
189
97
|
const isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)();
|
|
190
|
-
|
|
191
|
-
time`did-finish-ssr`;
|
|
98
|
+
process.env.NODE_ENV === "development" && time && time`did-finish-ssr`;
|
|
192
99
|
const stateRef = (0, import_react.useRef)(
|
|
193
100
|
void 0
|
|
194
101
|
);
|
|
195
|
-
stateRef.current
|
|
196
|
-
|
|
197
|
-
time`stateref`;
|
|
198
|
-
const hostRef = (0, import_react.useRef)(null);
|
|
199
|
-
const animationsConfig = componentContext.animationDriver;
|
|
200
|
-
const useAnimations = animationsConfig == null ? void 0 : animationsConfig.useAnimations;
|
|
201
|
-
const hasAnimationProp = Boolean(
|
|
202
|
-
props.animation || props.style && hasAnimatedStyleValue(props.style)
|
|
203
|
-
);
|
|
204
|
-
const supportsCSSVars = animationsConfig == null ? void 0 : animationsConfig.supportsCSSVars;
|
|
205
|
-
const willBeAnimated = (() => {
|
|
102
|
+
stateRef.current ||= {}, process.env.NODE_ENV === "development" && time && time`stateref`;
|
|
103
|
+
const hostRef = (0, import_react.useRef)(null), animationsConfig = componentContext.animationDriver, useAnimations = animationsConfig?.useAnimations, hasAnimationProp = !!(props.animation || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationsConfig?.supportsCSSVars, willBeAnimated = (() => {
|
|
206
104
|
if (import_constants.isServer && !supportsCSSVars)
|
|
207
|
-
return
|
|
105
|
+
return !1;
|
|
208
106
|
const curState = stateRef.current;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
const presence = willBeAnimated && (usePresence == null ? void 0 : usePresence()) || null;
|
|
214
|
-
const hasEnterStyle = !!props.enterStyle;
|
|
215
|
-
const needsMount = Boolean((import_constants.isWeb ? import_constants.isClient : true) && willBeAnimated);
|
|
216
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
217
|
-
time`pre-use-state`;
|
|
218
|
-
const initialState = willBeAnimated ? supportsCSSVars ? defaultComponentStateShouldEnter : defaultComponentState : defaultComponentStateMounted;
|
|
219
|
-
const states = (0, import_react.useState)(initialState);
|
|
220
|
-
const state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: true } : states[0];
|
|
221
|
-
const setState = states[1];
|
|
107
|
+
return !!(!!(hasAnimationProp && !isHOC && useAnimations) || curState.hasAnimated);
|
|
108
|
+
})(), usePresence = animationsConfig?.usePresence, presence = willBeAnimated && usePresence?.() || null, hasEnterStyle = !!props.enterStyle, needsMount = !!((!import_constants.isWeb || import_constants.isClient) && willBeAnimated);
|
|
109
|
+
process.env.NODE_ENV === "development" && time && time`pre-use-state`;
|
|
110
|
+
const initialState = willBeAnimated ? supportsCSSVars ? defaultComponentStateShouldEnter : defaultComponentState : defaultComponentStateMounted, states = (0, import_react.useState)(initialState), state = propsIn.forceStyle ? { ...states[0], [propsIn.forceStyle]: !0 } : states[0], setState = states[1];
|
|
222
111
|
let setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState);
|
|
223
|
-
const groupName = props.group;
|
|
224
|
-
const groupClassName = groupName ? `t_group_${props.group}` : "";
|
|
112
|
+
const groupName = props.group, groupClassName = groupName ? `t_group_${props.group}` : "";
|
|
225
113
|
if (groupName) {
|
|
226
|
-
const groupContextState = componentContext.groups.state;
|
|
227
|
-
const og = setStateShallow;
|
|
114
|
+
const groupContextState = componentContext.groups.state, og = setStateShallow;
|
|
228
115
|
setStateShallow = (state2) => {
|
|
229
|
-
og(state2)
|
|
230
|
-
componentContext.groups.emit(groupName, {
|
|
116
|
+
og(state2), componentContext.groups.emit(groupName, {
|
|
231
117
|
pseudo: state2
|
|
232
118
|
});
|
|
233
119
|
const next = {
|
|
@@ -237,142 +123,81 @@ function createComponent(staticConfig) {
|
|
|
237
123
|
groupContextState[groupName] = next;
|
|
238
124
|
};
|
|
239
125
|
}
|
|
240
|
-
|
|
241
|
-
time`use-state`;
|
|
126
|
+
process.env.NODE_ENV === "development" && time && time`use-state`;
|
|
242
127
|
let isAnimated = willBeAnimated;
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (willBeAnimated && !stateRef.current.hasAnimated) {
|
|
251
|
-
stateRef.current.hasAnimated = true;
|
|
252
|
-
}
|
|
253
|
-
const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName;
|
|
254
|
-
const hasTextAncestor = !!(import_constants.isWeb && isText ? componentContext.inText : false);
|
|
255
|
-
const isDisabled = props.disabled ?? ((_d = props.accessibilityState) == null ? void 0 : _d.disabled);
|
|
256
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
257
|
-
time`use-context`;
|
|
258
|
-
const isTaggable = !Component || typeof Component === "string";
|
|
259
|
-
const element = import_constants.isWeb ? isTaggable ? props.tag || Component : Component : Component;
|
|
260
|
-
const BaseTextComponent = BaseText || element || "span";
|
|
261
|
-
const BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div");
|
|
262
|
-
AnimatedText = animationsConfig ? animationsConfig.Text : BaseTextComponent;
|
|
263
|
-
AnimatedView = animationsConfig ? animationsConfig.View : BaseViewComponent;
|
|
128
|
+
willBeAnimated && !supportsCSSVars && !presence && isHydrated && (import_constants.isServer || state.unmounted === !0) && (isAnimated = !1), willBeAnimated && !stateRef.current.hasAnimated && (stateRef.current.hasAnimated = !0);
|
|
129
|
+
const componentClassName = props.asChild ? "" : props.componentName ? `is_${props.componentName}` : defaultComponentClassName, hasTextAncestor = !!(import_constants.isWeb && isText && componentContext.inText), isDisabled = props.disabled ?? props.accessibilityState?.disabled;
|
|
130
|
+
process.env.NODE_ENV === "development" && time && time`use-context`;
|
|
131
|
+
const element = import_constants.isWeb && (!Component || typeof Component == "string") && props.tag || Component, BaseTextComponent = BaseText || element || "span", BaseViewComponent = BaseView || element || (hasTextAncestor ? "span" : "div");
|
|
132
|
+
AnimatedText = animationsConfig ? animationsConfig.Text : BaseTextComponent, AnimatedView = animationsConfig ? animationsConfig.View : BaseViewComponent;
|
|
264
133
|
let elementType = isText ? (isAnimated ? AnimatedText : null) || BaseTextComponent : (isAnimated ? AnimatedView : null) || BaseViewComponent;
|
|
265
134
|
if (isAnimated && presence) {
|
|
266
135
|
const presenceState = presence[2];
|
|
267
136
|
if (presenceState) {
|
|
268
|
-
const isEntering = state.unmounted;
|
|
269
|
-
|
|
270
|
-
const enterExitVariant = presenceState.enterExitVariant;
|
|
271
|
-
const enterVariant = enterExitVariant ?? presenceState.enterVariant;
|
|
272
|
-
const exitVariant = enterExitVariant ?? presenceState.exitVariant;
|
|
273
|
-
if (isEntering && enterVariant) {
|
|
274
|
-
if (process.env.NODE_ENV === "development" && debugProp === "verbose") {
|
|
275
|
-
console.warn(`Animating presence ENTER "${enterVariant}"`);
|
|
276
|
-
}
|
|
277
|
-
props[enterVariant] = true;
|
|
278
|
-
} else if (isExiting2 && exitVariant) {
|
|
279
|
-
if (process.env.NODE_ENV === "development" && debugProp === "verbose") {
|
|
280
|
-
console.warn(`Animating presence EXIT "${enterVariant}"`);
|
|
281
|
-
}
|
|
282
|
-
props[exitVariant] = enterExitVariant ? false : true;
|
|
283
|
-
}
|
|
137
|
+
const isEntering = state.unmounted, isExiting2 = !presenceState.isPresent, enterExitVariant = presenceState.enterExitVariant, enterVariant = enterExitVariant ?? presenceState.enterVariant, exitVariant = enterExitVariant ?? presenceState.exitVariant;
|
|
138
|
+
isEntering && enterVariant ? (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence ENTER "${enterVariant}"`), props[enterVariant] = !0) : isExiting2 && exitVariant && (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence EXIT "${enterVariant}"`), props[exitVariant] = !enterExitVariant);
|
|
284
139
|
}
|
|
285
140
|
}
|
|
286
|
-
const isAnimatedReactNative = isAnimated &&
|
|
287
|
-
|
|
288
|
-
const shouldAvoidClasses = Boolean(
|
|
289
|
-
!import_constants.isWeb || isAnimated || !staticConfig.acceptsClassName || propsIn.disableClassName
|
|
290
|
-
);
|
|
291
|
-
const shouldForcePseudo = !!propsIn.forceStyle;
|
|
292
|
-
const noClassNames = shouldAvoidClasses || shouldForcePseudo;
|
|
293
|
-
const disableThemeProp = props["data-disable-theme"];
|
|
294
|
-
const disableTheme = disableThemeProp && !willBeAnimated || isHOC;
|
|
295
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
296
|
-
time`theme-props`;
|
|
297
|
-
if (props.themeShallow) {
|
|
298
|
-
stateRef.current.themeShallow = true;
|
|
299
|
-
}
|
|
141
|
+
const isAnimatedReactNative = isAnimated && animationsConfig?.isReactNative, isReactNative = !!(staticConfig.isReactNative || isAnimatedReactNative), shouldAvoidClasses = !!(!import_constants.isWeb || isAnimated || !staticConfig.acceptsClassName || propsIn.disableClassName), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo, disableThemeProp = props["data-disable-theme"], disableTheme = disableThemeProp && !willBeAnimated || isHOC;
|
|
142
|
+
process.env.NODE_ENV === "development" && time && time`theme-props`, props.themeShallow && (stateRef.current.themeShallow = !0);
|
|
300
143
|
const themeStateProps = {
|
|
301
144
|
name: props.theme,
|
|
302
145
|
componentName,
|
|
303
146
|
// @ts-ignore this is internal use only
|
|
304
147
|
disable: disableTheme,
|
|
305
148
|
shallow: stateRef.current.themeShallow,
|
|
306
|
-
shouldUpdate: () =>
|
|
307
|
-
return stateRef.current.isListeningToTheme;
|
|
308
|
-
},
|
|
149
|
+
shouldUpdate: () => stateRef.current.isListeningToTheme,
|
|
309
150
|
debug: debugProp
|
|
310
|
-
};
|
|
311
|
-
const isExiting = Boolean(!state.unmounted && (presence == null ? void 0 : presence[0]) === false);
|
|
151
|
+
}, isExiting = !state.unmounted && presence?.[0] === !1;
|
|
312
152
|
if (process.env.NODE_ENV === "development") {
|
|
313
153
|
const id = (0, import_react.useId)();
|
|
314
154
|
if (debugProp && debugProp !== "profile") {
|
|
315
|
-
const name = `${componentName ||
|
|
316
|
-
const type = isAnimatedReactNative ? "(animated)" : isReactNative ? "(rnw)" : "";
|
|
317
|
-
const dataIs = propsIn["data-is"] || "";
|
|
318
|
-
const banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type} id ${id}`;
|
|
155
|
+
const name = `${componentName || Component?.displayName || Component?.name || "[Unnamed Component]"}`, type = isAnimatedReactNative ? "(animated)" : isReactNative ? "(rnw)" : "", dataIs = propsIn["data-is"] || "", banner = `${name}${dataIs ? ` ${dataIs}` : ""} ${type} id ${id}`;
|
|
319
156
|
console.group(
|
|
320
157
|
`%c ${banner} (unmounted: ${state.unmounted})${presence ? ` (presence: ${presence[0]})` : ""} ${isHydrated ? "\u{1F4A6}" : "\u{1F3DC}\uFE0F"}`,
|
|
321
158
|
"background: green; color: white;"
|
|
322
|
-
)
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
propsInOrder: Object.keys(propsIn),
|
|
341
|
-
propsOrder: Object.keys(props)
|
|
342
|
-
});
|
|
343
|
-
console.groupEnd();
|
|
344
|
-
}
|
|
159
|
+
), import_constants.isServer || (console.groupCollapsed(
|
|
160
|
+
`Info (collapsed): ${state.press || state.pressIn ? "PRESSED " : ""}${state.hover ? "HOVERED " : ""}${state.focus ? "FOCUSED" : " "}`
|
|
161
|
+
), console.log({
|
|
162
|
+
propsIn,
|
|
163
|
+
props,
|
|
164
|
+
state,
|
|
165
|
+
staticConfig,
|
|
166
|
+
elementType,
|
|
167
|
+
themeStateProps,
|
|
168
|
+
styledContext: { contextProps: styledContextProps, overriddenContextProps },
|
|
169
|
+
presence,
|
|
170
|
+
isAnimated,
|
|
171
|
+
isHOC,
|
|
172
|
+
hasAnimationProp,
|
|
173
|
+
useAnimations,
|
|
174
|
+
propsInOrder: Object.keys(propsIn),
|
|
175
|
+
propsOrder: Object.keys(props)
|
|
176
|
+
}), console.groupEnd());
|
|
345
177
|
}
|
|
346
178
|
}
|
|
347
|
-
|
|
348
|
-
time`pre-theme-media`;
|
|
179
|
+
process.env.NODE_ENV === "development" && time && time`pre-theme-media`;
|
|
349
180
|
const [themeState, theme] = (0, import_useTheme.useThemeWithState)(themeStateProps);
|
|
350
181
|
elementType = Component || elementType;
|
|
351
|
-
const isStringElement = typeof elementType
|
|
352
|
-
|
|
353
|
-
time`theme`;
|
|
182
|
+
const isStringElement = typeof elementType == "string";
|
|
183
|
+
process.env.NODE_ENV === "development" && time && time`theme`;
|
|
354
184
|
const mediaState = (0, import_useMedia.useMedia)(
|
|
355
185
|
// @ts-ignore, we just pass a stable object so we can get it later with
|
|
356
186
|
// should match to the one used in `setMediaShouldUpdate` below
|
|
357
187
|
stateRef
|
|
358
188
|
);
|
|
359
|
-
|
|
360
|
-
time`media`;
|
|
361
|
-
(0, import_createVariable.setDidGetVariableValue)(false);
|
|
189
|
+
process.env.NODE_ENV === "development" && time && time`media`, (0, import_createVariable.setDidGetVariableValue)(!1);
|
|
362
190
|
const resolveVariablesAs = (
|
|
363
191
|
// if HOC + mounted + has animation prop, resolve as value so it passes non-variable to child
|
|
364
|
-
isAnimated && !supportsCSSVars || isHOC && state.unmounted ==
|
|
365
|
-
)
|
|
366
|
-
const keepStyleSSR = willBeAnimated && (animationsConfig == null ? void 0 : animationsConfig.keepStyleSSR);
|
|
367
|
-
const styleProps = {
|
|
192
|
+
isAnimated && !supportsCSSVars || isHOC && state.unmounted == !1 && hasAnimationProp ? "value" : "auto"
|
|
193
|
+
), keepStyleSSR = willBeAnimated && animationsConfig?.keepStyleSSR, styleProps = {
|
|
368
194
|
mediaState,
|
|
369
195
|
noClassNames,
|
|
370
196
|
resolveVariablesAs,
|
|
371
197
|
isExiting,
|
|
372
198
|
isAnimated,
|
|
373
199
|
keepStyleSSR
|
|
374
|
-
}
|
|
375
|
-
const splitStyles = (0, import_getSplitStyles.useSplitStyles)(
|
|
200
|
+
}, splitStyles = (0, import_getSplitStyles.useSplitStyles)(
|
|
376
201
|
props,
|
|
377
202
|
staticConfig,
|
|
378
203
|
theme,
|
|
@@ -384,49 +209,22 @@ function createComponent(staticConfig) {
|
|
|
384
209
|
elementType,
|
|
385
210
|
debugProp
|
|
386
211
|
);
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
390
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
391
|
-
time`split-styles`;
|
|
392
|
-
stateRef.current.isListeningToTheme = splitStyles.dynamicThemeAccess;
|
|
393
|
-
const isMediaArray = splitStyles.hasMedia && Array.isArray(splitStyles.hasMedia);
|
|
394
|
-
const shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || isMediaArray || noClassNames && splitStyles.hasMedia === true;
|
|
395
|
-
const mediaListeningKeys = isMediaArray ? splitStyles.hasMedia : null;
|
|
212
|
+
props.group && props.untilMeasured === "hide" && !stateRef.current.hasMeasured && (splitStyles.style.opacity = 0), process.env.NODE_ENV === "development" && time && time`split-styles`, stateRef.current.isListeningToTheme = splitStyles.dynamicThemeAccess;
|
|
213
|
+
const isMediaArray = splitStyles.hasMedia && Array.isArray(splitStyles.hasMedia), shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || isMediaArray || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = isMediaArray ? splitStyles.hasMedia : null;
|
|
396
214
|
(0, import_useMedia.setMediaShouldUpdate)(stateRef, {
|
|
397
215
|
enabled: shouldListenForMedia,
|
|
398
216
|
keys: mediaListeningKeys
|
|
399
217
|
});
|
|
400
218
|
const isAnimatedReactNativeWeb = isAnimated && isReactNative;
|
|
401
|
-
if (process.env.NODE_ENV === "development") {
|
|
402
|
-
|
|
403
|
-
console.error(
|
|
404
|
-
`No process.env.TAMAGUI_TARGET set, please set it to "native" or "web".`
|
|
405
|
-
);
|
|
406
|
-
}
|
|
407
|
-
if (debugProp && debugProp !== "profile") {
|
|
408
|
-
console.groupCollapsed(">>>");
|
|
409
|
-
console.log("props in", propsIn, "mapped to", props, "in order", Object.keys(props));
|
|
410
|
-
console.log("splitStyles", splitStyles);
|
|
411
|
-
console.log("media", { shouldListenForMedia, isMediaArray, mediaListeningKeys });
|
|
412
|
-
console.log("className", Object.values(splitStyles.classNames));
|
|
413
|
-
if (import_constants.isClient) {
|
|
414
|
-
console.log("ref", hostRef, "(click to view)");
|
|
415
|
-
}
|
|
416
|
-
console.groupEnd();
|
|
417
|
-
if (debugProp === "break") {
|
|
418
|
-
debugger;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
219
|
+
if (process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && (console.groupCollapsed(">>>"), console.log("props in", propsIn, "mapped to", props, "in order", Object.keys(props)), console.log("splitStyles", splitStyles), console.log("media", { shouldListenForMedia, isMediaArray, mediaListeningKeys }), console.log("className", Object.values(splitStyles.classNames)), import_constants.isClient && console.log("ref", hostRef, "(click to view)"), console.groupEnd(), debugProp === "break"))
|
|
220
|
+
debugger;
|
|
422
221
|
const {
|
|
423
222
|
viewProps: viewPropsIn,
|
|
424
223
|
pseudos,
|
|
425
224
|
style: splitStylesStyle,
|
|
426
225
|
classNames,
|
|
427
226
|
space
|
|
428
|
-
} = splitStyles;
|
|
429
|
-
const propsWithAnimation = props;
|
|
227
|
+
} = splitStyles, propsWithAnimation = props;
|
|
430
228
|
let animationStyles;
|
|
431
229
|
if (willBeAnimated && useAnimations && !isHOC) {
|
|
432
230
|
const animations = useAnimations({
|
|
@@ -442,11 +240,7 @@ function createComponent(staticConfig) {
|
|
|
442
240
|
hostRef,
|
|
443
241
|
staticConfig
|
|
444
242
|
});
|
|
445
|
-
|
|
446
|
-
animationStyles = animations.style;
|
|
447
|
-
}
|
|
448
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
449
|
-
time`animations`;
|
|
243
|
+
isAnimated && animations && (animationStyles = animations.style), process.env.NODE_ENV === "development" && time && time`animations`;
|
|
450
244
|
}
|
|
451
245
|
const {
|
|
452
246
|
asChild,
|
|
@@ -474,67 +268,38 @@ function createComponent(staticConfig) {
|
|
|
474
268
|
defaultVariants,
|
|
475
269
|
...nonTamaguiProps
|
|
476
270
|
} = viewPropsIn;
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
`You set the untilMeasured prop without setting group. This doesn't work, be sure to set untilMeasured on the parent that sets group, not the children that use the $group- prop.
|
|
271
|
+
process.env.NODE_ENV === "development" && props.untilMeasured && !props.group && console.warn(
|
|
272
|
+
`You set the untilMeasured prop without setting group. This doesn't work, be sure to set untilMeasured on the parent that sets group, not the children that use the $group- prop.
|
|
480
273
|
|
|
481
274
|
If you meant to do this, you can disable this warning - either change untilMeasured and group at the same time, or do group={conditional ? 'name' : undefined}`
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
485
|
-
time`destructure`;
|
|
486
|
-
const disabled = ((_e = props.accessibilityState) == null ? void 0 : _e.disabled) || // @ts-expect-error (comes from core)
|
|
275
|
+
), process.env.NODE_ENV === "development" && time && time`destructure`;
|
|
276
|
+
const disabled = props.accessibilityState?.disabled || // @ts-expect-error (comes from core)
|
|
487
277
|
props.accessibilityDisabled;
|
|
488
278
|
let viewProps = nonTamaguiProps;
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
(e) => {
|
|
496
|
-
componentContext.groups.emit(groupName, {
|
|
497
|
-
layout: e.nativeEvent.layout
|
|
498
|
-
});
|
|
499
|
-
if (!stateRef.current.hasMeasured && props.untilMeasured === "hide") {
|
|
500
|
-
setState((prev) => ({ ...prev }));
|
|
501
|
-
}
|
|
502
|
-
stateRef.current.hasMeasured = true;
|
|
503
|
-
}
|
|
504
|
-
);
|
|
505
|
-
}
|
|
506
|
-
if (process.env.TAMAGUI_TARGET === "web" && !isReactNative && !willBeAnimated && !asChild) {
|
|
507
|
-
viewProps = (_g = (_f = import_setupHooks.hooks).usePropsTransform) == null ? void 0 : _g.call(_f, elementType, nonTamaguiProps, hostRef);
|
|
508
|
-
} else {
|
|
509
|
-
viewProps = nonTamaguiProps;
|
|
510
|
-
}
|
|
511
|
-
const composedRef = (0, import_compose_refs.useComposedRefs)(hostRef, forwardedRef);
|
|
512
|
-
viewProps.ref = composedRef;
|
|
513
|
-
if (process.env.NODE_ENV === "development") {
|
|
514
|
-
if (!isReactNative && !isText && import_constants.isWeb && !isHOC) {
|
|
515
|
-
import_react.Children.toArray(props.children).forEach((item) => {
|
|
516
|
-
if (typeof item === "string" && item !== "\n") {
|
|
517
|
-
console.error(
|
|
518
|
-
`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`
|
|
519
|
-
);
|
|
520
|
-
}
|
|
521
|
-
});
|
|
279
|
+
isHOC && _themeProp && (viewProps.theme = _themeProp), groupName && (nonTamaguiProps.onLayout = (0, import_helpers.composeEventHandlers)(
|
|
280
|
+
nonTamaguiProps.onLayout,
|
|
281
|
+
(e) => {
|
|
282
|
+
componentContext.groups.emit(groupName, {
|
|
283
|
+
layout: e.nativeEvent.layout
|
|
284
|
+
}), !stateRef.current.hasMeasured && props.untilMeasured === "hide" && setState((prev) => ({ ...prev })), stateRef.current.hasMeasured = !0;
|
|
522
285
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
286
|
+
)), !isReactNative && !willBeAnimated && !asChild ? viewProps = import_setupHooks.hooks.usePropsTransform?.(elementType, nonTamaguiProps, hostRef) : viewProps = nonTamaguiProps;
|
|
287
|
+
const composedRef = (0, import_compose_refs.useComposedRefs)(hostRef, forwardedRef);
|
|
288
|
+
viewProps.ref = composedRef, process.env.NODE_ENV === "development" && !isReactNative && !isText && import_constants.isWeb && !isHOC && import_react.Children.toArray(props.children).forEach((item) => {
|
|
289
|
+
typeof item == "string" && item !== `
|
|
290
|
+
` && console.error(
|
|
291
|
+
`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`
|
|
292
|
+
);
|
|
293
|
+
}), process.env.NODE_ENV === "development" && time && time`events-hooks`;
|
|
526
294
|
let unPress = () => setStateShallow({
|
|
527
|
-
press:
|
|
528
|
-
pressIn:
|
|
295
|
+
press: !1,
|
|
296
|
+
pressIn: !1
|
|
529
297
|
});
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
const shouldSetMounted = needsMount && state.unmounted;
|
|
534
|
-
const { pseudoGroups, mediaGroups } = splitStyles;
|
|
298
|
+
unPress = (0, import_react.useCallback)(unPress, []);
|
|
299
|
+
const shouldSetMounted = needsMount && state.unmounted, { pseudoGroups, mediaGroups } = splitStyles;
|
|
535
300
|
(0, import_react.useEffect)(() => {
|
|
536
301
|
if (shouldSetMounted) {
|
|
537
|
-
const unmounted = state.unmounted ===
|
|
302
|
+
const unmounted = state.unmounted === !0 && hasEnterStyle ? "should-enter" : !1;
|
|
538
303
|
setStateShallow({
|
|
539
304
|
unmounted
|
|
540
305
|
});
|
|
@@ -548,16 +313,11 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
548
313
|
};
|
|
549
314
|
disposeGroupsListener = componentContext.groups.subscribe(
|
|
550
315
|
(name, { layout, pseudo }) => {
|
|
551
|
-
if (pseudo &&
|
|
552
|
-
Object.assign(current.pseudo, pseudo);
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
const next = (0, import_createShallowSetState.mergeIfNotShallowEqual)(current.media, mediaState2);
|
|
557
|
-
if (next !== current.media) {
|
|
558
|
-
Object.assign(current.media, next);
|
|
559
|
-
persist();
|
|
560
|
-
}
|
|
316
|
+
if (pseudo && pseudoGroups?.has(name))
|
|
317
|
+
Object.assign(current.pseudo, pseudo), persist();
|
|
318
|
+
else if (layout && mediaGroups) {
|
|
319
|
+
const mediaState2 = getMediaState(mediaGroups, layout), next = (0, import_createShallowSetState.mergeIfNotShallowEqual)(current.media, mediaState2);
|
|
320
|
+
next !== current.media && (Object.assign(current.media, next), persist());
|
|
561
321
|
}
|
|
562
322
|
function persist() {
|
|
563
323
|
setStateShallow({
|
|
@@ -572,8 +332,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
572
332
|
);
|
|
573
333
|
}
|
|
574
334
|
return () => {
|
|
575
|
-
disposeGroupsListener
|
|
576
|
-
mouseUps.delete(unPress);
|
|
335
|
+
disposeGroupsListener?.(), mouseUps.delete(unPress);
|
|
577
336
|
};
|
|
578
337
|
}, [
|
|
579
338
|
shouldSetMounted,
|
|
@@ -581,137 +340,57 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
581
340
|
pseudoGroups ? Object.keys([...pseudoGroups]).join("") : 0,
|
|
582
341
|
mediaGroups ? Object.keys([...mediaGroups]).join("") : 0
|
|
583
342
|
]);
|
|
584
|
-
const avoidAnimationStyle = keepStyleSSR && state.unmounted ===
|
|
585
|
-
let fontFamily = isText ? splitStyles.fontFamily ||
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
}
|
|
589
|
-
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "";
|
|
590
|
-
const style = avoidAnimationStyle ? splitStyles.style : animationStyles || splitStyles.style;
|
|
343
|
+
const avoidAnimationStyle = keepStyleSSR && state.unmounted === !0;
|
|
344
|
+
let fontFamily = isText ? splitStyles.fontFamily || staticConfig.defaultProps?.fontFamily : null;
|
|
345
|
+
fontFamily && fontFamily[0] === "$" && (fontFamily = fontFamily.slice(1));
|
|
346
|
+
const fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", style = avoidAnimationStyle ? splitStyles.style : animationStyles || splitStyles.style;
|
|
591
347
|
let className;
|
|
592
|
-
if (
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
];
|
|
599
|
-
className = classList.join(" ");
|
|
600
|
-
if (isAnimatedReactNativeWeb && !avoidAnimationStyle) {
|
|
601
|
-
viewProps.style = style;
|
|
602
|
-
} else if (isReactNative) {
|
|
603
|
-
const cnStyles = { $$css: true };
|
|
604
|
-
for (const name of className.split(" ")) {
|
|
605
|
-
cnStyles[name] = name;
|
|
606
|
-
}
|
|
607
|
-
viewProps.style = [...Array.isArray(style) ? style : [style], cnStyles];
|
|
608
|
-
} else {
|
|
609
|
-
viewProps.className = className;
|
|
610
|
-
viewProps.style = style;
|
|
611
|
-
}
|
|
612
|
-
if (isReactNative) {
|
|
613
|
-
if (process.env.NODE_ENV === "development") {
|
|
614
|
-
Object.keys(viewProps).forEach((key) => {
|
|
615
|
-
if (key.startsWith("data-")) {
|
|
616
|
-
viewProps.dataSet ?? (viewProps.dataSet = {});
|
|
617
|
-
viewProps.dataSet[key.replace("data-", "")] = viewProps[key];
|
|
618
|
-
delete viewProps[key];
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
} else {
|
|
348
|
+
if (className = [
|
|
349
|
+
componentName ? componentClassName : "",
|
|
350
|
+
fontFamilyClassName,
|
|
351
|
+
classNames ? Object.values(classNames).join(" ") : "",
|
|
352
|
+
groupClassName
|
|
353
|
+
].join(" "), isAnimatedReactNativeWeb && !avoidAnimationStyle)
|
|
624
354
|
viewProps.style = style;
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
);
|
|
636
|
-
|
|
637
|
-
time`events-setup`;
|
|
355
|
+
else if (isReactNative) {
|
|
356
|
+
const cnStyles = { $$css: !0 };
|
|
357
|
+
for (const name of className.split(" "))
|
|
358
|
+
cnStyles[name] = name;
|
|
359
|
+
viewProps.style = [...Array.isArray(style) ? style : [style], cnStyles];
|
|
360
|
+
} else
|
|
361
|
+
viewProps.className = className, viewProps.style = style;
|
|
362
|
+
isReactNative && process.env.NODE_ENV === "development" && Object.keys(viewProps).forEach((key) => {
|
|
363
|
+
key.startsWith("data-") && (viewProps.dataSet ??= {}, viewProps.dataSet[key.replace("data-", "")] = viewProps[key], delete viewProps[key]);
|
|
364
|
+
});
|
|
365
|
+
const runtimePressStyle = !disabled && noClassNames && pseudos?.pressStyle, attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onLongPress || onClick), runtimeHoverStyle = !disabled && noClassNames && pseudos?.hoverStyle, isHoverable = import_constants.isWeb && !!(groupName || runtimeHoverStyle || onHoverIn || onHoverOut || onMouseEnter || onMouseLeave), handlesPressEvents = !(import_constants.isWeb || asChild), shouldAttach = !!(attachPress || isHoverable || noClassNames && "pressStyle" in props || import_constants.isWeb && noClassNames && "hoverStyle" in props);
|
|
366
|
+
process.env.NODE_ENV === "development" && time && time`events-setup`;
|
|
638
367
|
const events = shouldAttach && !isDisabled && !asChild ? {
|
|
639
368
|
onPressOut: attachPress ? (e) => {
|
|
640
|
-
unPress();
|
|
641
|
-
onPressOut == null ? void 0 : onPressOut(e);
|
|
642
|
-
onMouseUp == null ? void 0 : onMouseUp(e);
|
|
369
|
+
unPress(), onPressOut?.(e), onMouseUp?.(e);
|
|
643
370
|
} : void 0,
|
|
644
371
|
...(isHoverable || attachPress) && {
|
|
645
372
|
onMouseEnter: (e) => {
|
|
646
373
|
const next = {};
|
|
647
|
-
next.hover =
|
|
648
|
-
if (state.pressIn) {
|
|
649
|
-
next.press = true;
|
|
650
|
-
}
|
|
651
|
-
setStateShallow(next);
|
|
652
|
-
onHoverIn == null ? void 0 : onHoverIn(e);
|
|
653
|
-
onMouseEnter == null ? void 0 : onMouseEnter(e);
|
|
374
|
+
next.hover = !0, state.pressIn && (next.press = !0), setStateShallow(next), onHoverIn?.(e), onMouseEnter?.(e);
|
|
654
375
|
},
|
|
655
376
|
onMouseLeave: (e) => {
|
|
656
377
|
const next = {};
|
|
657
|
-
mouseUps.add(unPress);
|
|
658
|
-
next.hover = false;
|
|
659
|
-
if (state.pressIn) {
|
|
660
|
-
next.press = false;
|
|
661
|
-
next.pressIn = false;
|
|
662
|
-
}
|
|
663
|
-
setStateShallow(next);
|
|
664
|
-
onHoverOut == null ? void 0 : onHoverOut(e);
|
|
665
|
-
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
378
|
+
mouseUps.add(unPress), next.hover = !1, state.pressIn && (next.press = !1, next.pressIn = !1), setStateShallow(next), onHoverOut?.(e), onMouseLeave?.(e);
|
|
666
379
|
}
|
|
667
380
|
},
|
|
668
381
|
onPressIn: attachPress ? (e) => {
|
|
669
382
|
setStateShallow({
|
|
670
|
-
press:
|
|
671
|
-
pressIn:
|
|
672
|
-
});
|
|
673
|
-
onPressIn == null ? void 0 : onPressIn(e);
|
|
674
|
-
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
675
|
-
if (import_constants.isWeb) {
|
|
676
|
-
mouseUps.add(unPress);
|
|
677
|
-
}
|
|
383
|
+
press: !0,
|
|
384
|
+
pressIn: !0
|
|
385
|
+
}), onPressIn?.(e), onMouseDown?.(e), import_constants.isWeb && mouseUps.add(unPress);
|
|
678
386
|
} : void 0,
|
|
679
387
|
onPress: attachPress ? (e) => {
|
|
680
|
-
unPress();
|
|
681
|
-
|
|
682
|
-
onPress == null ? void 0 : onPress(e);
|
|
683
|
-
if (process.env.TAMAGUI_TARGET === "web") {
|
|
684
|
-
onLongPress == null ? void 0 : onLongPress(e);
|
|
685
|
-
}
|
|
686
|
-
} : void 0,
|
|
687
|
-
...process.env.TAMAGUI_TARGET === "native" && {
|
|
688
|
-
onLongPress: attachPress && onLongPress ? (e) => {
|
|
689
|
-
unPress();
|
|
690
|
-
onLongPress == null ? void 0 : onLongPress(e);
|
|
691
|
-
} : void 0
|
|
692
|
-
}
|
|
388
|
+
unPress(), import_constants.isWeb && onClick?.(e), onPress?.(e), onLongPress?.(e);
|
|
389
|
+
} : void 0
|
|
693
390
|
} : null;
|
|
694
|
-
|
|
695
|
-
Object.assign(events, {
|
|
696
|
-
cancelable: !viewProps.rejectResponderTermination,
|
|
697
|
-
disabled: isDisabled,
|
|
698
|
-
hitSlop: viewProps.hitSlop,
|
|
699
|
-
delayLongPress: viewProps.delayLongPress,
|
|
700
|
-
delayPressIn: viewProps.delayPressIn,
|
|
701
|
-
delayPressOut: viewProps.delayPressOut,
|
|
702
|
-
focusable: viewProps.focusable ?? true,
|
|
703
|
-
minPressDuration: 0
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
707
|
-
time`events`;
|
|
708
|
-
if (process.env.NODE_ENV === "development" && debugProp === "verbose") {
|
|
709
|
-
console.log(`events`, { events, isHoverable, attachPress });
|
|
710
|
-
}
|
|
711
|
-
(_j = (_i = import_setupHooks.hooks).useEvents) == null ? void 0 : _j.call(_i, viewProps, events, splitStyles, setStateShallow);
|
|
391
|
+
process.env.NODE_ENV === "development" && time && time`events`, process.env.NODE_ENV === "development" && debugProp === "verbose" && console.log("events", { events, isHoverable, attachPress }), import_setupHooks.hooks.useEvents?.(viewProps, events, splitStyles, setStateShallow);
|
|
712
392
|
const direction = props.spaceDirection || "both";
|
|
713
|
-
|
|
714
|
-
time`hooks`;
|
|
393
|
+
process.env.NODE_ENV === "development" && time && time`hooks`;
|
|
715
394
|
let content = !children || asChild ? children : spacedChildren({
|
|
716
395
|
separator,
|
|
717
396
|
children,
|
|
@@ -720,202 +399,137 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
720
399
|
isZStack,
|
|
721
400
|
debug: debugProp
|
|
722
401
|
});
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
733
|
-
time`spaced-as-child`;
|
|
734
|
-
if (
|
|
735
|
-
// in test mode disable perf unwrapping so react-testing-library finds Text properly
|
|
736
|
-
process.env.NODE_ENV !== "test" && process.env.TAMAGUI_TARGET === "native" && (elementType === BaseText || elementType === BaseView)
|
|
737
|
-
) {
|
|
738
|
-
viewProps.children = content;
|
|
739
|
-
content = elementType.render(viewProps, viewProps.ref);
|
|
740
|
-
} else {
|
|
741
|
-
content = (0, import_react.createElement)(elementType, viewProps, content);
|
|
742
|
-
}
|
|
743
|
-
if (process.env.NODE_ENV === "development" && time)
|
|
744
|
-
time`create-element`;
|
|
402
|
+
asChild && (elementType = import_Slot.Slot, Object.assign(viewProps, {
|
|
403
|
+
onPress,
|
|
404
|
+
onLongPress,
|
|
405
|
+
onPressIn,
|
|
406
|
+
onPressOut
|
|
407
|
+
})), process.env.NODE_ENV === "development" && time && time`spaced-as-child`, // in test mode disable perf unwrapping so react-testing-library finds Text properly
|
|
408
|
+
process.env.NODE_ENV, content = (0, import_react.createElement)(elementType, viewProps, content), process.env.NODE_ENV === "development" && time && time`create-element`;
|
|
745
409
|
const subGroupContext = (0, import_react.useMemo)(() => {
|
|
746
|
-
if (
|
|
747
|
-
return
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
410
|
+
if (groupName)
|
|
411
|
+
return {
|
|
412
|
+
...componentContext.groups,
|
|
413
|
+
// change reference so as we mutate it doesn't affect siblings etc
|
|
414
|
+
state: {
|
|
415
|
+
...componentContext.groups.state,
|
|
416
|
+
[groupName]: {
|
|
417
|
+
pseudo: initialState,
|
|
418
|
+
// capture just initial width and height if they exist
|
|
419
|
+
// will have top, left, width, height (not x, y)
|
|
420
|
+
layout: {
|
|
421
|
+
width: fromPx(splitStyles.style.width),
|
|
422
|
+
height: fromPx(splitStyles.style.height)
|
|
423
|
+
}
|
|
760
424
|
}
|
|
761
425
|
}
|
|
762
|
-
}
|
|
763
|
-
};
|
|
426
|
+
};
|
|
764
427
|
}, [groupName]);
|
|
765
|
-
if (groupName && subGroupContext) {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
content
|
|
779
|
-
"span",
|
|
780
|
-
{
|
|
781
|
-
className: `${isAnimatedReactNativeWeb ? className : ""} _dsp_contents`,
|
|
782
|
-
...events && {
|
|
783
|
-
onMouseEnter: events.onMouseEnter,
|
|
784
|
-
onMouseLeave: events.onMouseLeave,
|
|
785
|
-
onClick: events.onPress,
|
|
786
|
-
onMouseDown: events.onPressIn,
|
|
787
|
-
onMouseUp: events.onPressOut,
|
|
788
|
-
onTouchStart: events.onPressIn,
|
|
789
|
-
onTouchEnd: events.onPressOut
|
|
790
|
-
},
|
|
791
|
-
children: content
|
|
792
|
-
}
|
|
793
|
-
);
|
|
428
|
+
if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { groups: subGroupContext, children: content })), process.env.NODE_ENV === "development" && time && time`group-context`, content = disableThemeProp ? content : (0, import_Theme.useThemedChildren)(themeState, content, themeStateProps), process.env.NODE_ENV === "development" && time && time`themed-children`, process.env.NODE_ENV === "development" && props.debug === "visualize" && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children: content })), (events || isAnimatedReactNativeWeb) && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
429
|
+
"span",
|
|
430
|
+
{
|
|
431
|
+
className: `${isAnimatedReactNativeWeb ? className : ""} _dsp_contents`,
|
|
432
|
+
...events && {
|
|
433
|
+
onMouseEnter: events.onMouseEnter,
|
|
434
|
+
onMouseLeave: events.onMouseLeave,
|
|
435
|
+
onClick: events.onPress,
|
|
436
|
+
onMouseDown: events.onPressIn,
|
|
437
|
+
onMouseUp: events.onPressOut,
|
|
438
|
+
onTouchStart: events.onPressIn,
|
|
439
|
+
onTouchEnd: events.onPressOut
|
|
440
|
+
},
|
|
441
|
+
children: content
|
|
794
442
|
}
|
|
795
|
-
|
|
796
|
-
if (overriddenContextProps) {
|
|
443
|
+
)), overriddenContextProps) {
|
|
797
444
|
const Provider = staticConfig.context.Provider;
|
|
798
445
|
content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, { ...contextValue, ...overriddenContextProps, children: content });
|
|
799
446
|
}
|
|
800
|
-
if (process.env.NODE_ENV === "development") {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
console.
|
|
804
|
-
|
|
805
|
-
console.log("
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
shouldForcePseudo,
|
|
837
|
-
elementType,
|
|
838
|
-
initialState,
|
|
839
|
-
classNames
|
|
840
|
-
});
|
|
841
|
-
}
|
|
842
|
-
} catch {
|
|
843
|
-
}
|
|
844
|
-
console.groupEnd();
|
|
845
|
-
console.groupEnd();
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
if (process.env.NODE_ENV === "development" && time) {
|
|
849
|
-
time`rest`;
|
|
850
|
-
if (!globalThis["willPrint"]) {
|
|
851
|
-
globalThis["willPrint"] = true;
|
|
852
|
-
setTimeout(() => {
|
|
853
|
-
delete globalThis["willPrint"];
|
|
854
|
-
time.print();
|
|
855
|
-
time = null;
|
|
856
|
-
}, 50);
|
|
447
|
+
if (process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
|
|
448
|
+
console.groupCollapsed(`render <${typeof elementType == "string" ? elementType : "Component"} /> with props`);
|
|
449
|
+
try {
|
|
450
|
+
console.log("viewProps", viewProps), console.log("viewPropsOrder", Object.keys(viewProps));
|
|
451
|
+
for (const key in viewProps)
|
|
452
|
+
console.log(" - ", key, viewProps[key]);
|
|
453
|
+
console.log("children", content), typeof window < "u" && console.log({
|
|
454
|
+
viewProps,
|
|
455
|
+
state,
|
|
456
|
+
styleProps,
|
|
457
|
+
themeState,
|
|
458
|
+
isAnimated,
|
|
459
|
+
isAnimatedReactNativeWeb,
|
|
460
|
+
defaultProps,
|
|
461
|
+
splitStyles,
|
|
462
|
+
animationStyles,
|
|
463
|
+
handlesPressEvents,
|
|
464
|
+
willBeAnimated,
|
|
465
|
+
isStringElement,
|
|
466
|
+
classNamesIn: props.className?.split(" "),
|
|
467
|
+
classNamesOut: viewProps.className?.split(" "),
|
|
468
|
+
events,
|
|
469
|
+
shouldAttach,
|
|
470
|
+
pseudos,
|
|
471
|
+
content,
|
|
472
|
+
shouldAvoidClasses,
|
|
473
|
+
animation: props.animation,
|
|
474
|
+
splitStylesStyle,
|
|
475
|
+
staticConfig,
|
|
476
|
+
tamaguiConfig,
|
|
477
|
+
shouldForcePseudo,
|
|
478
|
+
elementType,
|
|
479
|
+
initialState,
|
|
480
|
+
classNames
|
|
481
|
+
});
|
|
482
|
+
} catch {
|
|
857
483
|
}
|
|
484
|
+
console.groupEnd(), console.groupEnd();
|
|
858
485
|
}
|
|
859
|
-
return
|
|
486
|
+
return process.env.NODE_ENV === "development" && time && (time`rest`, globalThis.willPrint || (globalThis.willPrint = !0, setTimeout(() => {
|
|
487
|
+
delete globalThis.willPrint, time.print(), time = null;
|
|
488
|
+
}, 50))), content;
|
|
860
489
|
});
|
|
861
|
-
|
|
862
|
-
component.displayName = staticConfig.componentName;
|
|
863
|
-
}
|
|
490
|
+
staticConfig.componentName && (component.displayName = staticConfig.componentName);
|
|
864
491
|
let res = component;
|
|
865
|
-
|
|
866
|
-
res = (0, import_react.memo)(res);
|
|
867
|
-
}
|
|
868
|
-
res.staticConfig = staticConfig;
|
|
492
|
+
(process.env.TAMAGUI_MEMO_ALL || staticConfig.memo) && (res = (0, import_react.memo)(res)), res.staticConfig = staticConfig;
|
|
869
493
|
function extendStyledConfig(extended) {
|
|
870
494
|
return {
|
|
871
495
|
...staticConfig,
|
|
872
496
|
...extended,
|
|
873
|
-
neverFlatten:
|
|
874
|
-
isHOC:
|
|
497
|
+
neverFlatten: !0,
|
|
498
|
+
isHOC: !0
|
|
875
499
|
};
|
|
876
500
|
}
|
|
877
501
|
function extractable(Component2, extended) {
|
|
878
|
-
Component2.staticConfig = extendStyledConfig(extended);
|
|
879
|
-
Component2.styleable = styleable;
|
|
880
|
-
return Component2;
|
|
502
|
+
return Component2.staticConfig = extendStyledConfig(extended), Component2.styleable = styleable, Component2;
|
|
881
503
|
}
|
|
882
504
|
function styleable(Component2, extended) {
|
|
883
|
-
|
|
884
|
-
const isForwardedRefAlready = ((_a2 = Component2.render) == null ? void 0 : _a2.length) === 2;
|
|
885
|
-
const ComponentForwardedRef = isForwardedRefAlready ? Component2 : (
|
|
505
|
+
const ComponentForwardedRef = Component2.render?.length === 2 ? Component2 : (
|
|
886
506
|
// memo because theme changes otherwise would always re-render
|
|
887
507
|
(0, import_react.memo)((0, import_react.forwardRef)(Component2))
|
|
888
|
-
);
|
|
889
|
-
|
|
890
|
-
const out = (0, import_themeable.themeable)(ComponentForwardedRef, extendedConfig);
|
|
891
|
-
out.staticConfig = extendedConfig;
|
|
892
|
-
out.styleable = styleable;
|
|
893
|
-
return out;
|
|
508
|
+
), extendedConfig = extendStyledConfig(extended), out = (0, import_themeable.themeable)(ComponentForwardedRef, extendedConfig);
|
|
509
|
+
return out.staticConfig = extendedConfig, out.styleable = styleable, out;
|
|
894
510
|
}
|
|
895
|
-
res.extractable = extractable;
|
|
896
|
-
res.styleable = styleable;
|
|
897
|
-
return res;
|
|
511
|
+
return res.extractable = extractable, res.styleable = styleable, res;
|
|
898
512
|
}
|
|
899
513
|
function Unspaced(props) {
|
|
900
514
|
return props.children;
|
|
901
515
|
}
|
|
902
|
-
Unspaced
|
|
516
|
+
Unspaced.isUnspaced = !0;
|
|
903
517
|
const Spacer = createComponent({
|
|
904
|
-
acceptsClassName:
|
|
905
|
-
memo:
|
|
518
|
+
acceptsClassName: !0,
|
|
519
|
+
memo: !0,
|
|
906
520
|
componentName: "Spacer",
|
|
907
521
|
validStyles: import_helpers.validStyles,
|
|
908
522
|
defaultProps: {
|
|
909
523
|
...import_constants2.stackDefaultStyles,
|
|
910
524
|
// avoid nesting issues
|
|
911
525
|
tag: "span",
|
|
912
|
-
size:
|
|
526
|
+
size: !0,
|
|
913
527
|
pointerEvents: "none"
|
|
914
528
|
},
|
|
915
529
|
variants: {
|
|
916
530
|
size: {
|
|
917
531
|
"...size": (size, { tokens }) => {
|
|
918
|
-
size = size ===
|
|
532
|
+
size = size === !0 ? "$true" : size;
|
|
919
533
|
const sizePx = tokens.space[size] ?? size;
|
|
920
534
|
return {
|
|
921
535
|
width: sizePx,
|
|
@@ -944,84 +558,51 @@ const Spacer = createComponent({
|
|
|
944
558
|
}
|
|
945
559
|
});
|
|
946
560
|
function spacedChildren(props) {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
const hasSpace = !!(space || spaceFlex);
|
|
950
|
-
const hasSeparator = !(separator === void 0 || separator === null);
|
|
951
|
-
if (!(hasSpace || hasSeparator || isZStack)) {
|
|
561
|
+
const { isZStack, children, space, direction, spaceFlex, separator } = props, hasSpace = !!(space || spaceFlex), hasSeparator = separator != null;
|
|
562
|
+
if (!(hasSpace || hasSeparator || isZStack))
|
|
952
563
|
return children;
|
|
953
|
-
}
|
|
954
564
|
const childrenList = import_react.Children.toArray(children);
|
|
955
|
-
|
|
956
|
-
if (len <= 1 && !isZStack && !((_b = (_a = childrenList[0]) == null ? void 0 : _a["type"]) == null ? void 0 : _b["shouldForwardSpace"])) {
|
|
565
|
+
if (childrenList.length <= 1 && !isZStack && !childrenList[0]?.type?.shouldForwardSpace)
|
|
957
566
|
return childrenList;
|
|
958
|
-
}
|
|
959
567
|
const final = [];
|
|
960
568
|
for (let [index, child] of childrenList.entries()) {
|
|
961
|
-
const isEmpty = child
|
|
962
|
-
if (!isEmpty && import_react.default.isValidElement(child) &&
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
})
|
|
969
|
-
|
|
970
|
-
if (isEmpty || !child || child["key"] && !isZStack) {
|
|
971
|
-
final.push(child);
|
|
972
|
-
} else {
|
|
973
|
-
final.push(
|
|
974
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: isZStack ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AbsoluteFill, { children: child }) : child }, index)
|
|
975
|
-
);
|
|
976
|
-
}
|
|
977
|
-
if (isUnspaced(child) && index === 0)
|
|
978
|
-
continue;
|
|
979
|
-
if (isZStack)
|
|
569
|
+
const isEmpty = child == null || Array.isArray(child) && child.length === 0;
|
|
570
|
+
if (!isEmpty && import_react.default.isValidElement(child) && child.type?.shouldForwardSpace && (child = import_react.default.cloneElement(child, {
|
|
571
|
+
space,
|
|
572
|
+
spaceFlex,
|
|
573
|
+
separator,
|
|
574
|
+
key: child.key
|
|
575
|
+
})), isEmpty || !child || child.key && !isZStack ? final.push(child) : final.push(
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: isZStack ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AbsoluteFill, { children: child }) : child }, index)
|
|
577
|
+
), isUnspaced(child) && index === 0 || isZStack)
|
|
980
578
|
continue;
|
|
981
579
|
const next = childrenList[index + 1];
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
}
|
|
1007
|
-
} else {
|
|
1008
|
-
final.push(
|
|
1009
|
-
createSpacer({
|
|
1010
|
-
key: `_${index}02tmgui`,
|
|
1011
|
-
direction,
|
|
1012
|
-
space,
|
|
1013
|
-
spaceFlex
|
|
1014
|
-
})
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
if (process.env.NODE_ENV === "development") {
|
|
1020
|
-
if (props.debug) {
|
|
1021
|
-
console.log(` Spaced children`, final, props);
|
|
1022
|
-
}
|
|
580
|
+
next && !isUnspaced(next) && (separator ? (hasSpace && final.push(
|
|
581
|
+
createSpacer({
|
|
582
|
+
key: `_${index}_00tmgui`,
|
|
583
|
+
direction,
|
|
584
|
+
space,
|
|
585
|
+
spaceFlex
|
|
586
|
+
})
|
|
587
|
+
), final.push(
|
|
588
|
+
import_react.default.isValidElement(separator) ? import_react.default.cloneElement(separator, { key: `sep_${index}` }) : separator
|
|
589
|
+
), hasSpace && final.push(
|
|
590
|
+
createSpacer({
|
|
591
|
+
key: `_${index}01tmgui`,
|
|
592
|
+
direction,
|
|
593
|
+
space,
|
|
594
|
+
spaceFlex
|
|
595
|
+
})
|
|
596
|
+
)) : final.push(
|
|
597
|
+
createSpacer({
|
|
598
|
+
key: `_${index}02tmgui`,
|
|
599
|
+
direction,
|
|
600
|
+
space,
|
|
601
|
+
spaceFlex
|
|
602
|
+
})
|
|
603
|
+
));
|
|
1023
604
|
}
|
|
1024
|
-
return final;
|
|
605
|
+
return process.env.NODE_ENV === "development" && props.debug && console.log(" Spaced children", final, props), final;
|
|
1025
606
|
}
|
|
1026
607
|
function createSpacer({ key, direction, space, spaceFlex }) {
|
|
1027
608
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -1029,18 +610,17 @@ function createSpacer({ key, direction, space, spaceFlex }) {
|
|
|
1029
610
|
{
|
|
1030
611
|
size: space,
|
|
1031
612
|
direction,
|
|
1032
|
-
...typeof spaceFlex
|
|
1033
|
-
flex: spaceFlex ===
|
|
613
|
+
...typeof spaceFlex < "u" && {
|
|
614
|
+
flex: spaceFlex === !0 ? 1 : spaceFlex === !1 ? 0 : spaceFlex
|
|
1034
615
|
}
|
|
1035
616
|
},
|
|
1036
617
|
key
|
|
1037
618
|
);
|
|
1038
619
|
}
|
|
1039
620
|
function isUnspaced(child) {
|
|
1040
|
-
const t = child
|
|
1041
|
-
return
|
|
621
|
+
const t = child?.type;
|
|
622
|
+
return t?.isVisuallyHidden || t?.isUnspaced;
|
|
1042
623
|
}
|
|
1043
|
-
const DefaultProps = /* @__PURE__ */ new Map();
|
|
1044
624
|
const AbsoluteFill = createComponent({
|
|
1045
625
|
defaultProps: {
|
|
1046
626
|
...import_constants2.stackDefaultStyles,
|
|
@@ -1056,17 +636,15 @@ const AbsoluteFill = createComponent({
|
|
|
1056
636
|
function hasAnimatedStyleValue(style) {
|
|
1057
637
|
return Object.keys(style).some((k) => {
|
|
1058
638
|
const val = style[k];
|
|
1059
|
-
return val && typeof val
|
|
639
|
+
return val && typeof val == "object" && "_animation" in val;
|
|
1060
640
|
});
|
|
1061
641
|
}
|
|
1062
642
|
function getMediaState(mediaGroups, layout) {
|
|
1063
643
|
return Object.fromEntries(
|
|
1064
|
-
[...mediaGroups].map((mediaKey) =>
|
|
1065
|
-
return [mediaKey, (0, import_useMedia.mediaKeyMatch)(mediaKey, layout)];
|
|
1066
|
-
})
|
|
644
|
+
[...mediaGroups].map((mediaKey) => [mediaKey, (0, import_useMedia.mediaKeyMatch)(mediaKey, layout)])
|
|
1067
645
|
);
|
|
1068
646
|
}
|
|
1069
|
-
const fromPx = (val) => typeof val
|
|
647
|
+
const fromPx = (val) => typeof val != "string" ? val : +val.replace("px", "");
|
|
1070
648
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1071
649
|
0 && (module.exports = {
|
|
1072
650
|
Spacer,
|