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