@tamagui/core 1.0.1-beta.139 → 1.0.1-beta.142
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 +2 -2
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/addTheme.js +28 -22
- package/dist/cjs/addTheme.js.map +2 -2
- package/dist/cjs/conf.js +0 -0
- package/dist/cjs/conf.js.map +0 -0
- package/dist/cjs/config.js +75 -0
- package/dist/cjs/config.js.map +7 -0
- package/dist/cjs/constants/constants.js +0 -0
- package/dist/cjs/constants/constants.js.map +0 -0
- package/dist/cjs/constants/platform.js +7 -1
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/platform.native.js +62 -0
- package/dist/cjs/constants/platform.native.js.map +7 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +0 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +0 -0
- package/dist/cjs/contexts/FontLanguageContext.js +0 -0
- package/dist/cjs/contexts/FontLanguageContext.js.map +0 -0
- package/dist/cjs/contexts/TextAncestorContext.js +0 -0
- package/dist/cjs/contexts/TextAncestorContext.js.map +0 -0
- package/dist/cjs/contexts/ThemeContext.js +0 -0
- package/dist/cjs/contexts/ThemeContext.js.map +0 -0
- package/dist/cjs/createComponent.js +77 -71
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createComponent.server.js +431 -0
- package/dist/cjs/createComponent.server.js.map +7 -0
- package/dist/cjs/createFont.js +0 -0
- package/dist/cjs/createFont.js.map +0 -0
- package/dist/cjs/createShorthands.js +0 -0
- package/dist/cjs/createShorthands.js.map +0 -0
- package/dist/cjs/createTamagui.js +31 -32
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +0 -0
- package/dist/cjs/createTheme.js.map +0 -0
- package/dist/cjs/createTokens.js +0 -0
- package/dist/cjs/createTokens.js.map +0 -0
- package/dist/cjs/createVariable.js +21 -35
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariables.js +5 -2
- package/dist/cjs/createVariables.js.map +2 -2
- package/dist/cjs/helpers/RNComponents.js +11 -11
- package/dist/cjs/helpers/RNComponents.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +7 -9
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/areEqualSets.js +0 -0
- package/dist/cjs/helpers/areEqualSets.js.map +0 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.js +0 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +2 -2
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js +0 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +0 -0
- package/dist/cjs/helpers/calc.js +0 -0
- package/dist/cjs/helpers/calc.js.map +0 -0
- package/dist/cjs/helpers/createMediaStyle.js +0 -0
- package/dist/cjs/helpers/createMediaStyle.js.map +0 -0
- package/dist/cjs/helpers/createPropMapper.js +3 -3
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createShallowUpdate.js +0 -0
- package/dist/cjs/helpers/createShallowUpdate.js.map +0 -0
- package/dist/cjs/helpers/cssHash.js +0 -0
- package/dist/cjs/helpers/cssHash.js.map +0 -0
- package/dist/cjs/helpers/expandStyle.js +0 -0
- package/dist/cjs/helpers/expandStyle.js.map +0 -0
- package/dist/cjs/helpers/expandStyles.js +4 -4
- package/dist/cjs/helpers/expandStyles.js.map +2 -2
- package/dist/cjs/helpers/extendStaticConfig.js +0 -0
- package/dist/cjs/helpers/extendStaticConfig.js.map +0 -0
- package/dist/cjs/helpers/fixNativeShadow.js +0 -0
- package/dist/cjs/helpers/fixNativeShadow.js.map +0 -0
- package/dist/cjs/{Pressability.js → helpers/getAnimationDriver.js} +10 -10
- package/dist/cjs/helpers/getAnimationDriver.js.map +7 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +3 -3
- package/dist/cjs/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/cjs/helpers/getFont.js +1 -1
- package/dist/cjs/helpers/getFont.js.map +2 -2
- package/dist/cjs/helpers/getFontLanguage.js +0 -0
- package/dist/cjs/helpers/getFontLanguage.js.map +0 -0
- package/dist/cjs/helpers/getSize.js +2 -2
- package/dist/cjs/helpers/getSize.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +12 -13
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStackSize.js +0 -0
- package/dist/cjs/helpers/getStackSize.js.map +0 -0
- package/dist/cjs/helpers/getStylesAtomic.js +6 -4
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js +0 -0
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +0 -0
- package/dist/cjs/helpers/getThemeCSSRules.js +0 -0
- package/dist/cjs/helpers/getThemeCSSRules.js.map +0 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js +0 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +0 -0
- package/dist/cjs/helpers/getVariantExtras.js +2 -2
- package/dist/cjs/helpers/getVariantExtras.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +0 -0
- package/dist/cjs/helpers/insertStyleRule.js.map +0 -0
- package/dist/cjs/helpers/isObj.js +0 -0
- package/dist/cjs/helpers/isObj.js.map +0 -0
- package/dist/cjs/helpers/isTamaguiComponent.js +0 -0
- package/dist/cjs/helpers/isTamaguiComponent.js.map +0 -0
- package/dist/cjs/helpers/isTamaguiElement.js +0 -0
- package/dist/cjs/helpers/isTamaguiElement.js.map +0 -0
- package/dist/cjs/helpers/matchMedia.js +0 -0
- package/dist/cjs/helpers/matchMedia.js.map +0 -0
- package/dist/cjs/helpers/matchMedia.native.js +0 -0
- package/dist/cjs/helpers/matchMedia.native.js.map +0 -0
- package/dist/cjs/helpers/mergeProps.js +0 -0
- package/dist/cjs/helpers/mergeProps.js.map +0 -0
- package/dist/cjs/helpers/mergeTransform.js +0 -0
- package/dist/cjs/helpers/mergeTransform.js.map +0 -0
- package/dist/cjs/helpers/normalizeColor.js +2 -2
- package/dist/cjs/helpers/normalizeColor.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js +0 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/cjs/helpers/proxyThemeVariables.js +0 -0
- package/dist/cjs/helpers/proxyThemeVariables.js.map +0 -0
- package/dist/cjs/helpers/pseudoDescriptors.js +0 -0
- package/dist/cjs/helpers/pseudoDescriptors.js.map +0 -0
- package/dist/cjs/helpers/registerCSSVariable.js +0 -0
- package/dist/cjs/helpers/registerCSSVariable.js.map +2 -2
- package/dist/cjs/helpers/startTransition.js +0 -0
- package/dist/cjs/helpers/startTransition.js.map +0 -0
- package/dist/cjs/helpers/themeable.js +0 -0
- package/dist/cjs/helpers/themeable.js.map +0 -0
- package/dist/cjs/helpers/themes.js +0 -0
- package/dist/cjs/helpers/themes.js.map +0 -0
- package/dist/cjs/helpers/useAnimationDriver.js +2 -0
- package/dist/cjs/{defaultComponentState.js.map → helpers/useAnimationDriver.js.map} +0 -0
- package/dist/cjs/helpers/validate.js +0 -0
- package/dist/cjs/helpers/validate.js.map +0 -0
- package/dist/cjs/helpers/withStaticProperties.js +0 -0
- package/dist/cjs/helpers/withStaticProperties.js.map +0 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js +2 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/cjs/hooks/useAnimationDriver.js +2 -0
- package/dist/{esm/defaultComponentState.js.map → cjs/hooks/useAnimationDriver.js.map} +0 -0
- package/dist/cjs/hooks/useConstant.js +3 -0
- package/dist/cjs/hooks/useConstant.js.map +2 -2
- package/dist/cjs/hooks/useFeatures.js +10 -2
- package/dist/cjs/hooks/useFeatures.js.map +2 -2
- package/dist/cjs/hooks/useId.js +0 -0
- package/dist/cjs/hooks/useId.js.map +0 -0
- package/dist/cjs/hooks/useIsMounted.js +0 -0
- package/dist/cjs/hooks/useIsMounted.js.map +0 -0
- package/dist/cjs/hooks/useIsSSR.js +2 -2
- package/dist/cjs/hooks/useIsSSR.js.map +2 -2
- package/dist/cjs/hooks/useIsTouchDevice.js +0 -0
- package/dist/cjs/hooks/useIsTouchDevice.js.map +0 -0
- package/dist/cjs/hooks/useMedia.js +0 -0
- package/dist/cjs/hooks/useMedia.js.map +0 -0
- package/dist/cjs/hooks/usePressable.js +0 -0
- package/dist/cjs/hooks/usePressable.js.map +0 -0
- package/dist/cjs/hooks/useSafeRef.js +0 -0
- package/dist/cjs/hooks/useSafeRef.js.map +0 -0
- package/dist/cjs/{helpers/nativeGestureHandler.native.js → hooks/useServerContext.js} +8 -6
- package/dist/cjs/hooks/useServerContext.js.map +7 -0
- package/dist/cjs/{ThemeContext.js → hooks/useServerHooks.js} +13 -7
- package/dist/cjs/hooks/useServerHooks.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +72 -44
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useUnmountEffect.js +0 -0
- package/dist/cjs/hooks/useUnmountEffect.js.map +0 -0
- package/dist/cjs/index.js +8 -6
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/{Pressability.native.js → injectStyles.js} +18 -10
- package/dist/cjs/injectStyles.js.map +7 -0
- package/dist/cjs/insertFont.js +2 -2
- package/dist/cjs/insertFont.js.map +2 -2
- package/dist/cjs/static.js +0 -0
- package/dist/cjs/static.js.map +0 -0
- package/dist/cjs/styled.js +11 -1
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types-rnw.js +0 -0
- package/dist/cjs/types-rnw.js.map +0 -0
- package/dist/cjs/types.js +0 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/updateTheme.js +0 -0
- package/dist/cjs/updateTheme.js.map +0 -0
- package/dist/cjs/vendor/Pressability.js +0 -0
- package/dist/cjs/vendor/Pressability.js.map +0 -0
- package/dist/cjs/vendor/Pressability.native.js +0 -0
- package/dist/cjs/vendor/Pressability.native.js.map +0 -0
- package/dist/cjs/views/FontLanguage.js +0 -0
- package/dist/cjs/views/FontLanguage.js.map +0 -0
- package/dist/cjs/views/FontLanguage.native.js +0 -0
- package/dist/cjs/views/FontLanguage.native.js.map +0 -0
- package/dist/cjs/views/FontLanguage.types.js +0 -0
- package/dist/cjs/views/FontLanguage.types.js.map +0 -0
- package/dist/cjs/views/Slot.js +0 -0
- package/dist/cjs/views/Slot.js.map +0 -0
- package/dist/cjs/views/Stack.js +0 -0
- package/dist/cjs/views/Stack.js.map +0 -0
- package/dist/cjs/{helpers/createTamaguiProvider.js → views/TamaguiProvider.js} +41 -35
- package/dist/cjs/views/TamaguiProvider.js.map +7 -0
- package/dist/cjs/views/Text.js +0 -0
- package/dist/cjs/views/Text.js.map +0 -0
- package/dist/cjs/views/Theme.js +4 -3
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +0 -0
- package/dist/cjs/views/ThemeInverse.js.map +0 -0
- package/dist/cjs/views/ThemeProvider.js +10 -6
- package/dist/cjs/views/ThemeProvider.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +0 -0
- package/dist/cjs/views/ThemeReset.js.map +0 -0
- package/dist/esm/Tamagui.js +1 -1
- package/dist/esm/Tamagui.js.map +1 -1
- package/dist/esm/addTheme.js +27 -21
- package/dist/esm/addTheme.js.map +2 -2
- package/dist/esm/conf.js +0 -0
- package/dist/esm/conf.js.map +0 -0
- package/dist/esm/config.js +43 -0
- package/dist/esm/config.js.map +7 -0
- package/dist/esm/constants/constants.js +0 -0
- package/dist/esm/constants/constants.js.map +0 -0
- package/dist/esm/constants/platform.js +5 -1
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/constants/platform.native.js +28 -0
- package/dist/esm/constants/platform.native.js.map +7 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js +0 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +0 -0
- package/dist/esm/contexts/FontLanguageContext.js +0 -0
- package/dist/esm/contexts/FontLanguageContext.js.map +0 -0
- package/dist/esm/contexts/TextAncestorContext.js +0 -0
- package/dist/esm/contexts/TextAncestorContext.js.map +0 -0
- package/dist/esm/contexts/ThemeContext.js +0 -0
- package/dist/esm/contexts/ThemeContext.js.map +0 -0
- package/dist/esm/createComponent.js +77 -73
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.server.js +408 -0
- package/dist/esm/createComponent.server.js.map +7 -0
- package/dist/esm/createFont.js +0 -0
- package/dist/esm/createFont.js.map +0 -0
- package/dist/esm/createShorthands.js +0 -0
- package/dist/esm/createShorthands.js.map +0 -0
- package/dist/esm/createTamagui.js +30 -31
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTheme.js +0 -0
- package/dist/esm/createTheme.js.map +0 -0
- package/dist/esm/createTokens.js +0 -0
- package/dist/esm/createTokens.js.map +0 -0
- package/dist/esm/createVariable.js +19 -33
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariables.js +5 -2
- package/dist/esm/createVariables.js.map +2 -2
- package/dist/esm/helpers/RNComponents.js +11 -8
- package/dist/esm/helpers/RNComponents.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +6 -8
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/areEqualSets.js +0 -0
- package/dist/esm/helpers/areEqualSets.js.map +0 -0
- package/dist/esm/helpers/assignNativePropsToWeb.js +0 -1
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +2 -2
- package/dist/esm/helpers/assignNativePropsToWeb.native.js +0 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +0 -0
- package/dist/esm/helpers/calc.js +0 -0
- package/dist/esm/helpers/calc.js.map +0 -0
- package/dist/esm/helpers/createMediaStyle.js +0 -0
- package/dist/esm/helpers/createMediaStyle.js.map +0 -0
- package/dist/esm/helpers/createPropMapper.js +2 -2
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createShallowUpdate.js +0 -0
- package/dist/esm/helpers/createShallowUpdate.js.map +0 -0
- package/dist/esm/helpers/cssHash.js +0 -0
- package/dist/esm/helpers/cssHash.js.map +0 -0
- package/dist/esm/helpers/expandStyle.js +0 -0
- package/dist/esm/helpers/expandStyle.js.map +0 -0
- package/dist/esm/helpers/expandStyles.js +3 -3
- package/dist/esm/helpers/expandStyles.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +0 -0
- package/dist/esm/helpers/extendStaticConfig.js.map +0 -0
- package/dist/esm/helpers/fixNativeShadow.js +0 -0
- package/dist/esm/helpers/fixNativeShadow.js.map +0 -0
- package/dist/esm/helpers/getAnimationDriver.js +8 -0
- package/dist/esm/helpers/getAnimationDriver.js.map +7 -0
- package/dist/esm/helpers/getExpandedShorthands.js +2 -2
- package/dist/esm/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/esm/helpers/getFont.js +1 -1
- package/dist/esm/helpers/getFont.js.map +2 -2
- package/dist/esm/helpers/getFontLanguage.js +0 -0
- package/dist/esm/helpers/getFontLanguage.js.map +0 -0
- package/dist/esm/helpers/getSize.js +1 -1
- package/dist/esm/helpers/getSize.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +12 -13
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStackSize.js +0 -0
- package/dist/esm/helpers/getStackSize.js.map +0 -0
- package/dist/esm/helpers/getStylesAtomic.js +5 -3
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.native.js +0 -0
- package/dist/esm/helpers/getStylesAtomic.native.js.map +0 -0
- package/dist/esm/helpers/getThemeCSSRules.js +0 -0
- package/dist/esm/helpers/getThemeCSSRules.js.map +0 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js +0 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +0 -0
- package/dist/esm/helpers/getVariantExtras.js +1 -1
- package/dist/esm/helpers/getVariantExtras.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.js +0 -0
- package/dist/esm/helpers/insertStyleRule.js.map +0 -0
- package/dist/esm/helpers/isObj.js +0 -0
- package/dist/esm/helpers/isObj.js.map +0 -0
- package/dist/esm/helpers/isTamaguiComponent.js +0 -0
- package/dist/esm/helpers/isTamaguiComponent.js.map +0 -0
- package/dist/esm/helpers/isTamaguiElement.js +0 -0
- package/dist/esm/helpers/isTamaguiElement.js.map +0 -0
- package/dist/esm/helpers/matchMedia.js +0 -0
- package/dist/esm/helpers/matchMedia.js.map +0 -0
- package/dist/esm/helpers/matchMedia.native.js +0 -0
- package/dist/esm/helpers/matchMedia.native.js.map +0 -0
- package/dist/esm/helpers/mergeProps.js +0 -0
- package/dist/esm/helpers/mergeProps.js.map +0 -0
- package/dist/esm/helpers/mergeTransform.js +0 -0
- package/dist/esm/helpers/mergeTransform.js.map +0 -0
- package/dist/esm/helpers/normalizeColor.js +1 -1
- package/dist/esm/helpers/normalizeColor.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js +0 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/esm/helpers/proxyThemeVariables.js +0 -0
- package/dist/esm/helpers/proxyThemeVariables.js.map +0 -0
- package/dist/esm/helpers/pseudoDescriptors.js +0 -0
- package/dist/esm/helpers/pseudoDescriptors.js.map +0 -0
- package/dist/esm/helpers/registerCSSVariable.js +0 -0
- package/dist/esm/helpers/registerCSSVariable.js.map +2 -2
- package/dist/esm/helpers/startTransition.js +0 -0
- package/dist/esm/helpers/startTransition.js.map +0 -0
- package/dist/esm/helpers/themeable.js +0 -0
- package/dist/esm/helpers/themeable.js.map +0 -0
- package/dist/esm/helpers/themes.js +0 -0
- package/dist/esm/helpers/themes.js.map +0 -0
- package/dist/esm/helpers/useAnimationDriver.js +1 -0
- package/dist/esm/helpers/useAnimationDriver.js.map +7 -0
- package/dist/esm/helpers/validate.js +0 -0
- package/dist/esm/helpers/validate.js.map +0 -0
- package/dist/esm/helpers/withStaticProperties.js +0 -0
- package/dist/esm/helpers/withStaticProperties.js.map +0 -0
- package/dist/esm/hooks/getThemeUnwrapped.js +2 -0
- package/dist/esm/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/esm/hooks/useAnimationDriver.js +1 -0
- package/dist/esm/hooks/useAnimationDriver.js.map +7 -0
- package/dist/esm/hooks/useConstant.js +4 -1
- package/dist/esm/hooks/useConstant.js.map +2 -2
- package/dist/esm/hooks/useFeatures.js +9 -1
- package/dist/esm/hooks/useFeatures.js.map +2 -2
- package/dist/esm/hooks/useId.js +0 -0
- package/dist/esm/hooks/useId.js.map +0 -0
- package/dist/esm/hooks/useIsMounted.js +0 -0
- package/dist/esm/hooks/useIsMounted.js.map +0 -0
- package/dist/esm/hooks/useIsSSR.js +4 -4
- package/dist/esm/hooks/useIsSSR.js.map +2 -2
- package/dist/esm/hooks/useIsTouchDevice.js +0 -0
- package/dist/esm/hooks/useIsTouchDevice.js.map +0 -0
- package/dist/esm/hooks/useMedia.js +0 -0
- package/dist/esm/hooks/useMedia.js.map +0 -0
- package/dist/esm/hooks/usePressable.js +0 -0
- package/dist/esm/hooks/usePressable.js.map +0 -0
- package/dist/esm/hooks/useSafeRef.js +0 -0
- package/dist/esm/hooks/useSafeRef.js.map +0 -0
- package/dist/esm/hooks/useServerContext.js +4 -0
- package/dist/esm/hooks/useServerContext.js.map +7 -0
- package/dist/esm/hooks/useServerHooks.js +11 -0
- package/dist/esm/hooks/useServerHooks.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +73 -45
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/hooks/useUnmountEffect.js +0 -0
- package/dist/esm/hooks/useUnmountEffect.js.map +0 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/injectStyles.js +16 -0
- package/dist/esm/injectStyles.js.map +7 -0
- package/dist/esm/insertFont.js +1 -1
- package/dist/esm/insertFont.js.map +1 -1
- package/dist/esm/static.js +0 -0
- package/dist/esm/static.js.map +0 -0
- package/dist/esm/styled.js +11 -1
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/types-rnw.js +0 -0
- package/dist/esm/types-rnw.js.map +0 -0
- package/dist/esm/types.js +0 -0
- package/dist/esm/types.js.map +0 -0
- package/dist/esm/updateTheme.js +0 -0
- package/dist/esm/updateTheme.js.map +0 -0
- package/dist/esm/vendor/Pressability.js +0 -0
- package/dist/esm/vendor/Pressability.js.map +0 -0
- package/dist/esm/vendor/Pressability.native.js +0 -0
- package/dist/esm/vendor/Pressability.native.js.map +0 -0
- package/dist/esm/views/FontLanguage.js +0 -0
- package/dist/esm/views/FontLanguage.js.map +0 -0
- package/dist/esm/views/FontLanguage.native.js +0 -0
- package/dist/esm/views/FontLanguage.native.js.map +0 -0
- package/dist/esm/views/FontLanguage.types.js +0 -0
- package/dist/esm/views/FontLanguage.types.js.map +0 -0
- package/dist/esm/views/Slot.js +0 -0
- package/dist/esm/views/Slot.js.map +0 -0
- package/dist/esm/views/Stack.js +0 -0
- package/dist/esm/views/Stack.js.map +0 -0
- package/dist/esm/views/TamaguiProvider.js +46 -0
- package/dist/esm/views/TamaguiProvider.js.map +7 -0
- package/dist/esm/views/Text.js +0 -0
- package/dist/esm/views/Text.js.map +0 -0
- package/dist/esm/views/Theme.js +4 -3
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeInverse.js +0 -0
- package/dist/esm/views/ThemeInverse.js.map +0 -0
- package/dist/esm/views/ThemeProvider.js +10 -6
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/dist/esm/views/ThemeReset.js +0 -0
- package/dist/esm/views/ThemeReset.js.map +0 -0
- package/package.json +36 -14
- package/src/Tamagui.ts +44 -0
- package/src/addTheme.ts +66 -0
- package/src/config.ts +38 -0
- package/src/constants/constants.ts +15 -0
- package/src/constants/platform.native.ts +14 -0
- package/src/constants/platform.ts +24 -0
- package/src/contexts/ButtonInsideButtonContext.tsx +3 -0
- package/src/contexts/FontLanguageContext.tsx +5 -0
- package/src/contexts/TextAncestorContext.tsx +10 -0
- package/src/contexts/ThemeContext.tsx +5 -0
- package/src/createComponent.tsx +1338 -0
- package/src/createFont.ts +26 -0
- package/src/createShorthands.ts +5 -0
- package/src/createTamagui.ts +232 -0
- package/src/createTheme.ts +13 -0
- package/src/createTokens.ts +35 -0
- package/src/createVariable.ts +77 -0
- package/src/createVariables.ts +42 -0
- package/src/helpers/RNComponents.tsx +14 -0
- package/src/helpers/ThemeManager.tsx +229 -0
- package/src/helpers/areEqualSets.tsx +9 -0
- package/src/helpers/assignNativePropsToWeb.native.tsx +1 -0
- package/src/helpers/assignNativePropsToWeb.tsx +178 -0
- package/src/helpers/calc.ts +65 -0
- package/src/helpers/createMediaStyle.ts +48 -0
- package/src/helpers/createPropMapper.ts +457 -0
- package/src/helpers/createShallowUpdate.tsx +20 -0
- package/src/helpers/cssHash.ts +28 -0
- package/src/helpers/expandStyle.ts +81 -0
- package/src/helpers/expandStyles.ts +105 -0
- package/src/helpers/extendStaticConfig.ts +76 -0
- package/src/helpers/fixNativeShadow.tsx +2 -0
- package/src/helpers/getAnimationDriver.tsx +5 -0
- package/src/helpers/getExpandedShorthands.ts +15 -0
- package/src/helpers/getFont.tsx +40 -0
- package/src/helpers/getFontLanguage.ts +2 -0
- package/src/helpers/getSize.ts +22 -0
- package/src/helpers/getSplitStyles.tsx +685 -0
- package/src/helpers/getStackSize.ts +22 -0
- package/src/helpers/getStylesAtomic.native.ts +3 -0
- package/src/helpers/getStylesAtomic.ts +292 -0
- package/src/helpers/getThemeCSSRules.native.ts +3 -0
- package/src/helpers/getThemeCSSRules.ts +105 -0
- package/src/helpers/getVariantExtras.tsx +83 -0
- package/src/helpers/insertStyleRule.tsx +150 -0
- package/src/helpers/isObj.ts +1 -0
- package/src/helpers/isTamaguiComponent.tsx +15 -0
- package/src/helpers/isTamaguiElement.tsx +14 -0
- package/src/helpers/matchMedia.native.ts +6 -0
- package/src/helpers/matchMedia.ts +16 -0
- package/src/helpers/mergeProps.ts +56 -0
- package/src/helpers/mergeTransform.ts +14 -0
- package/src/helpers/normalizeColor.ts +53 -0
- package/src/helpers/normalizeValueWithProperty.ts +78 -0
- package/src/helpers/proxyThemeVariables.tsx +13 -0
- package/src/helpers/pseudoDescriptors.ts +18 -0
- package/src/helpers/registerCSSVariable.ts +11 -0
- package/src/helpers/startTransition.ts +4 -0
- package/src/helpers/themeable.tsx +45 -0
- package/src/helpers/themes.ts +69 -0
- package/src/helpers/validate.ts +80 -0
- package/src/helpers/withStaticProperties.tsx +7 -0
- package/src/hooks/getThemeUnwrapped.tsx +8 -0
- package/src/hooks/useConstant.tsx +19 -0
- package/src/hooks/useFeatures.tsx +289 -0
- package/src/hooks/useId.tsx +1 -0
- package/src/hooks/useIsMounted.ts +17 -0
- package/src/hooks/useIsSSR.tsx +20 -0
- package/src/hooks/useIsTouchDevice.tsx +21 -0
- package/src/hooks/useMedia.tsx +167 -0
- package/src/hooks/usePressable.tsx +9 -0
- package/src/hooks/useSafeRef.ts +50 -0
- package/src/hooks/useServerHooks.tsx +13 -0
- package/src/hooks/useTheme.tsx +264 -0
- package/src/hooks/useUnmountEffect.ts +5 -0
- package/src/index.ts +80 -0
- package/src/injectStyles.ts +20 -0
- package/src/insertFont.ts +69 -0
- package/src/static.ts +15 -0
- package/src/styled.tsx +149 -0
- package/src/types-rnw.tsx +162 -0
- package/src/types.tsx +1267 -0
- package/src/updateTheme.ts +23 -0
- package/src/vendor/Pressability.native.tsx +3 -0
- package/src/vendor/Pressability.tsx +2 -0
- package/src/views/FontLanguage.native.tsx +9 -0
- package/src/views/FontLanguage.tsx +18 -0
- package/src/views/FontLanguage.types.ts +13 -0
- package/src/views/Slot.tsx +152 -0
- package/src/views/Stack.tsx +24 -0
- package/src/views/TamaguiProvider.tsx +57 -0
- package/src/views/Text.tsx +79 -0
- package/src/views/Theme.tsx +72 -0
- package/src/views/ThemeInverse.tsx +33 -0
- package/src/views/ThemeProvider.tsx +62 -0
- package/src/views/ThemeReset.tsx +43 -0
- package/types/Tamagui.d.ts +0 -0
- package/types/addTheme.d.ts +0 -0
- package/types/conf.d.ts +1 -1
- package/types/config.d.ts +27 -0
- package/types/constants/constants.d.ts +0 -0
- package/types/constants/platform.d.ts +1 -0
- package/types/constants/platform.native.d.ts +13 -0
- package/types/contexts/ButtonInsideButtonContext.d.ts +0 -0
- package/types/contexts/FontLanguageContext.d.ts +0 -0
- package/types/contexts/TextAncestorContext.d.ts +0 -0
- package/types/contexts/ThemeContext.d.ts +0 -0
- package/types/createComponent.d.ts +0 -0
- package/types/createComponent.server.d.ts +36 -0
- package/types/createFont.d.ts +0 -0
- package/types/createShorthands.d.ts +0 -0
- package/types/createTamagui.d.ts +1 -1
- package/types/createTheme.d.ts +1 -1
- package/types/createTokens.d.ts +0 -0
- package/types/createVariable.d.ts +15 -12
- package/types/createVariables.d.ts +0 -0
- package/types/helpers/RNComponents.d.ts +1 -1
- package/types/helpers/ThemeManager.d.ts +2 -8
- package/types/helpers/areEqualSets.d.ts +0 -0
- package/types/helpers/assignNativePropsToWeb.d.ts +0 -0
- package/types/helpers/assignNativePropsToWeb.native.d.ts +0 -0
- package/types/helpers/calc.d.ts +0 -0
- package/types/helpers/createMediaStyle.d.ts +0 -0
- package/types/helpers/createPropMapper.d.ts +0 -0
- package/types/helpers/createShallowUpdate.d.ts +0 -0
- package/types/helpers/cssHash.d.ts +0 -0
- package/types/helpers/expandStyle.d.ts +0 -0
- package/types/helpers/expandStyles.d.ts +0 -0
- package/types/helpers/extendStaticConfig.d.ts +0 -0
- package/types/helpers/fixNativeShadow.d.ts +0 -0
- package/types/helpers/getAnimationDriver.d.ts +6 -0
- package/types/helpers/getExpandedShorthands.d.ts +0 -0
- package/types/helpers/getFont.d.ts +0 -0
- package/types/helpers/getFontLanguage.d.ts +0 -0
- package/types/helpers/getSize.d.ts +0 -0
- package/types/helpers/getSplitStyles.d.ts +0 -0
- package/types/helpers/getStackSize.d.ts +0 -0
- package/types/helpers/getStylesAtomic.d.ts +0 -0
- package/types/helpers/getStylesAtomic.native.d.ts +0 -0
- package/types/helpers/getThemeCSSRules.d.ts +0 -0
- package/types/helpers/getThemeCSSRules.native.d.ts +0 -0
- package/types/helpers/getVariantExtras.d.ts +0 -0
- package/types/helpers/insertStyleRule.d.ts +0 -0
- package/types/helpers/isObj.d.ts +0 -0
- package/types/helpers/isTamaguiComponent.d.ts +0 -0
- package/types/helpers/isTamaguiElement.d.ts +0 -0
- package/types/helpers/matchMedia.d.ts +0 -0
- package/types/helpers/matchMedia.native.d.ts +0 -0
- package/types/helpers/mergeProps.d.ts +0 -0
- package/types/helpers/mergeTransform.d.ts +0 -0
- package/types/helpers/normalizeColor.d.ts +0 -0
- package/types/helpers/normalizeValueWithProperty.d.ts +0 -0
- package/types/helpers/proxyThemeVariables.d.ts +0 -0
- package/types/helpers/pseudoDescriptors.d.ts +0 -0
- package/types/helpers/registerCSSVariable.d.ts +2 -2
- package/types/helpers/startTransition.d.ts +0 -0
- package/types/helpers/themeable.d.ts +0 -0
- package/types/helpers/themes.d.ts +0 -0
- package/types/helpers/useAnimationDriver.d.ts +1 -0
- package/types/helpers/validate.d.ts +0 -0
- package/types/helpers/withStaticProperties.d.ts +0 -0
- package/types/hooks/getThemeUnwrapped.d.ts +0 -0
- package/types/hooks/useAnimationDriver.d.ts +1 -0
- package/types/hooks/useConstant.d.ts +0 -0
- package/types/hooks/useFeatures.d.ts +0 -0
- package/types/hooks/useId.d.ts +0 -0
- package/types/hooks/useIsMounted.d.ts +0 -0
- package/types/hooks/useIsSSR.d.ts +0 -0
- package/types/hooks/useIsTouchDevice.d.ts +0 -0
- package/types/hooks/useMedia.d.ts +0 -0
- package/types/hooks/usePressable.d.ts +0 -0
- package/types/hooks/useSafeRef.d.ts +0 -0
- package/types/hooks/useServerContext.d.ts +2 -0
- package/types/hooks/useServerHooks.d.ts +4 -0
- package/types/hooks/useTheme.d.ts +5 -21
- package/types/hooks/useUnmountEffect.d.ts +0 -0
- package/types/index.d.ts +3 -1
- package/types/injectStyles.d.ts +7 -0
- package/types/insertFont.d.ts +0 -0
- package/types/static.d.ts +0 -0
- package/types/styled.d.ts +0 -0
- package/types/types-rnw.d.ts +0 -0
- package/types/types.d.ts +24 -1
- package/types/updateTheme.d.ts +0 -0
- package/types/vendor/Pressability.d.ts +0 -0
- package/types/vendor/Pressability.native.d.ts +0 -0
- package/types/views/FontLanguage.d.ts +0 -0
- package/types/views/FontLanguage.native.d.ts +0 -0
- package/types/views/FontLanguage.types.d.ts +0 -0
- package/types/views/Slot.d.ts +0 -0
- package/types/views/Stack.d.ts +0 -0
- package/types/views/TamaguiProvider.d.ts +4 -0
- package/types/views/Text.d.ts +0 -0
- package/types/views/Theme.d.ts +0 -0
- package/types/views/ThemeInverse.d.ts +0 -0
- package/types/views/ThemeProvider.d.ts +0 -1
- package/types/views/ThemeReset.d.ts +0 -0
- package/dist/cjs/Pressability.js.map +0 -7
- package/dist/cjs/Pressability.native.js.map +0 -7
- package/dist/cjs/ThemeContext.js.map +0 -7
- package/dist/cjs/ThemeManager.js +0 -211
- package/dist/cjs/ThemeManager.js.map +0 -7
- package/dist/cjs/defaultComponentState.js +0 -2
- package/dist/cjs/ensureThemeVariable.js +0 -152
- package/dist/cjs/ensureThemeVariable.js.map +0 -7
- package/dist/cjs/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/cjs/helpers/ensureThemeVariable.js +0 -152
- package/dist/cjs/helpers/ensureThemeVariable.js.map +0 -7
- package/dist/cjs/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/cjs/loadTheme.js +0 -64
- package/dist/cjs/loadTheme.js.map +0 -7
- package/dist/cjs/views/TextAncestorContext.js +0 -44
- package/dist/cjs/views/TextAncestorContext.js.map +0 -7
- package/dist/esm/Pressability.js +0 -7
- package/dist/esm/Pressability.js.map +0 -7
- package/dist/esm/Pressability.native.js +0 -7
- package/dist/esm/Pressability.native.js.map +0 -7
- package/dist/esm/ThemeContext.js +0 -6
- package/dist/esm/ThemeContext.js.map +0 -7
- package/dist/esm/ThemeManager.js +0 -185
- package/dist/esm/ThemeManager.js.map +0 -7
- package/dist/esm/defaultComponentState.js +0 -1
- package/dist/esm/ensureThemeVariable.js +0 -125
- package/dist/esm/ensureThemeVariable.js.map +0 -7
- package/dist/esm/helpers/createTamaguiProvider.js +0 -40
- package/dist/esm/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/esm/helpers/ensureThemeVariable.js +0 -125
- package/dist/esm/helpers/ensureThemeVariable.js.map +0 -7
- package/dist/esm/helpers/nativeGestureHandler.native.js +0 -2
- package/dist/esm/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/esm/loadTheme.js +0 -40
- package/dist/esm/loadTheme.js.map +0 -7
- package/dist/esm/views/TextAncestorContext.js +0 -15
- package/dist/esm/views/TextAncestorContext.js.map +0 -7
- package/types/helpers/createTamaguiProvider.d.ts +0 -4
package/src/types.tsx
ADDED
|
@@ -0,0 +1,1267 @@
|
|
|
1
|
+
// TODO split this into own package @tamagui/types to share with animations packages
|
|
2
|
+
|
|
3
|
+
import { Properties } from 'csstype'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
import {
|
|
6
|
+
GestureResponderEvent,
|
|
7
|
+
Image,
|
|
8
|
+
PressableProps,
|
|
9
|
+
TextProps as ReactTextProps,
|
|
10
|
+
Text,
|
|
11
|
+
TextInput,
|
|
12
|
+
TextStyle,
|
|
13
|
+
View,
|
|
14
|
+
ViewProps,
|
|
15
|
+
ViewStyle,
|
|
16
|
+
} from 'react-native'
|
|
17
|
+
|
|
18
|
+
import { Variable } from './createVariable'
|
|
19
|
+
import { ResolveVariableTypes } from './helpers/createPropMapper'
|
|
20
|
+
import { RNWTextProps, RNWViewProps } from './types-rnw'
|
|
21
|
+
import { FontLanguageProps } from './views/FontLanguage.types'
|
|
22
|
+
import { ThemeProviderProps } from './views/ThemeProvider'
|
|
23
|
+
|
|
24
|
+
export type SpaceDirection = 'vertical' | 'horizontal' | 'both'
|
|
25
|
+
|
|
26
|
+
export type TamaguiElement = HTMLElement | View
|
|
27
|
+
|
|
28
|
+
export type DebugProp = boolean | 'break' | 'verbose'
|
|
29
|
+
|
|
30
|
+
//
|
|
31
|
+
// base props that are accepted by createComponent (additional to react-native-web)
|
|
32
|
+
//
|
|
33
|
+
export type TamaguiComponentPropsBase = {
|
|
34
|
+
hitSlop?: PressableProps['hitSlop']
|
|
35
|
+
asChild?: boolean
|
|
36
|
+
space?: SpaceTokens | null
|
|
37
|
+
spaceDirection?: SpaceDirection
|
|
38
|
+
separator?: React.ReactNode
|
|
39
|
+
dangerouslySetInnerHTML?: { __html: string }
|
|
40
|
+
animation?: AnimationProp
|
|
41
|
+
animateOnly?: string[]
|
|
42
|
+
children?: any | any[]
|
|
43
|
+
debug?: DebugProp
|
|
44
|
+
disabled?: boolean
|
|
45
|
+
className?: string
|
|
46
|
+
themeShallow?: boolean
|
|
47
|
+
id?: string
|
|
48
|
+
tag?: string
|
|
49
|
+
theme?: ThemeName | null
|
|
50
|
+
componentName?: string
|
|
51
|
+
forceStyle?: 'hover' | 'press' | 'focus'
|
|
52
|
+
onHoverIn?: (e: MouseEvent) => any
|
|
53
|
+
onHoverOut?: (e: MouseEvent) => any
|
|
54
|
+
onPress?: (e: GestureResponderEvent) => any
|
|
55
|
+
onPressIn?: (e: GestureResponderEvent) => any
|
|
56
|
+
onPressOut?: (e: GestureResponderEvent) => any
|
|
57
|
+
// WEB ONLY
|
|
58
|
+
onMouseEnter?: (e: MouseEvent) => any
|
|
59
|
+
onMouseLeave?: (e: MouseEvent) => any
|
|
60
|
+
onMouseDown?: (e: MouseEvent) => any
|
|
61
|
+
// WEB STYLES
|
|
62
|
+
userSelect?: Properties['userSelect']
|
|
63
|
+
cursor?: Properties['cursor']
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type ReactComponentWithRef<Props, Ref> = React.ForwardRefExoticComponent<
|
|
67
|
+
Props & React.RefAttributes<Ref>
|
|
68
|
+
>
|
|
69
|
+
|
|
70
|
+
export type ConfigListener = (conf: TamaguiInternalConfig) => void
|
|
71
|
+
|
|
72
|
+
// to prevent things from going circular, hoisting some types in this file
|
|
73
|
+
// to generally order them as building up towards TamaguiConfig
|
|
74
|
+
|
|
75
|
+
export type VariableVal = number | string | Variable
|
|
76
|
+
export type VariableColorVal = string | Variable
|
|
77
|
+
|
|
78
|
+
type GenericKey = string | number | symbol
|
|
79
|
+
|
|
80
|
+
export interface CreateTokens<Val extends VariableVal = VariableVal> {
|
|
81
|
+
color: { [key: GenericKey]: Val }
|
|
82
|
+
space: { [key: GenericKey]: Val }
|
|
83
|
+
size: { [key: GenericKey]: Val }
|
|
84
|
+
radius: { [key: GenericKey]: Val }
|
|
85
|
+
zIndex: { [key: GenericKey]: Val }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type TamaguiBaseTheme = {
|
|
89
|
+
// defined for our tamagui kit , we could do this inside `tamagui`
|
|
90
|
+
// but maybe helpful to have some sort of universally shared things +
|
|
91
|
+
// + enforce if they want their own, redefine in their design sys
|
|
92
|
+
background: VariableColorVal
|
|
93
|
+
backgroundHover: VariableColorVal
|
|
94
|
+
backgroundPress: VariableColorVal
|
|
95
|
+
backgroundFocus: VariableColorVal
|
|
96
|
+
color: VariableColorVal
|
|
97
|
+
colorHover: VariableColorVal
|
|
98
|
+
colorPress: VariableColorVal
|
|
99
|
+
colorFocus: VariableColorVal
|
|
100
|
+
borderColor: VariableColorVal
|
|
101
|
+
borderColorHover: VariableColorVal
|
|
102
|
+
borderColorPress: VariableColorVal
|
|
103
|
+
borderColorFocus: VariableColorVal
|
|
104
|
+
shadowColor: VariableColorVal
|
|
105
|
+
shadowColorHover: VariableColorVal
|
|
106
|
+
shadowColorPress: VariableColorVal
|
|
107
|
+
shadowColorFocus: VariableColorVal
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
type GenericTokens = CreateTokens
|
|
111
|
+
type GenericThemes = {
|
|
112
|
+
[key: string]:
|
|
113
|
+
| Partial<TamaguiBaseTheme> & {
|
|
114
|
+
[key: string]: VariableVal
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type GenericShorthands = {}
|
|
119
|
+
|
|
120
|
+
// sm: { minWidth: 100 }
|
|
121
|
+
type GenericMedia = {
|
|
122
|
+
[key: string]: {
|
|
123
|
+
[key: string]: number | string
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export type GenericFonts = Record<string, GenericFont>
|
|
128
|
+
|
|
129
|
+
type GenericAnimations = {
|
|
130
|
+
[key: string]:
|
|
131
|
+
| string
|
|
132
|
+
| {
|
|
133
|
+
[key: string]: any
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// this is the "main" typed object, which users re-define
|
|
138
|
+
// (internal) keep all types directly on this object and reference them from elsewhere
|
|
139
|
+
//
|
|
140
|
+
// const config = createTamagui(...)
|
|
141
|
+
// type MyConfig = typeof config
|
|
142
|
+
// declare module 'tamagui' {
|
|
143
|
+
// export interface TamaguiCustomConfig extends MyConfig {}
|
|
144
|
+
// }
|
|
145
|
+
// now your whole app/kit should be typed correctly
|
|
146
|
+
//
|
|
147
|
+
export interface TamaguiCustomConfig {}
|
|
148
|
+
|
|
149
|
+
export interface TamaguiConfig
|
|
150
|
+
extends Omit<GenericTamaguiConfig, keyof TamaguiCustomConfig>,
|
|
151
|
+
TamaguiCustomConfig {}
|
|
152
|
+
|
|
153
|
+
export type CreateTamaguiConfig<
|
|
154
|
+
A extends GenericTokens,
|
|
155
|
+
B extends GenericThemes,
|
|
156
|
+
C extends GenericShorthands = GenericShorthands,
|
|
157
|
+
D extends GenericMedia = GenericMedia,
|
|
158
|
+
E extends GenericAnimations = GenericAnimations,
|
|
159
|
+
F extends GenericFonts = GenericFonts
|
|
160
|
+
> = {
|
|
161
|
+
fonts: RemoveLanguagePostfixes<F>
|
|
162
|
+
fontLanguages: GetLanguagePostfixes<F> extends never ? string[] : GetLanguagePostfixes<F>[]
|
|
163
|
+
tokens: A
|
|
164
|
+
themes: B
|
|
165
|
+
shorthands: C
|
|
166
|
+
media: D
|
|
167
|
+
animations: AnimationDriver<E>
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
type GetLanguagePostfix<Set> = Set extends string
|
|
171
|
+
? Set extends `${string}_${infer Postfix}`
|
|
172
|
+
? Postfix
|
|
173
|
+
: never
|
|
174
|
+
: never
|
|
175
|
+
|
|
176
|
+
type OmitLanguagePostfix<Set> = Set extends string
|
|
177
|
+
? Set extends `${infer Prefix}_${string}`
|
|
178
|
+
? Prefix
|
|
179
|
+
: Set
|
|
180
|
+
: never
|
|
181
|
+
|
|
182
|
+
type RemoveLanguagePostfixes<F extends GenericFonts> = {
|
|
183
|
+
[Key in OmitLanguagePostfix<keyof F>]: F[Key]
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
type GetLanguagePostfixes<F extends GenericFonts> = GetLanguagePostfix<keyof F>
|
|
187
|
+
|
|
188
|
+
// test RemoveLanguagePostfixes
|
|
189
|
+
// type x = CreateTamaguiConfig<any, any, any, any, any, {
|
|
190
|
+
// body: any,
|
|
191
|
+
// body_en: any
|
|
192
|
+
// }>['fonts']
|
|
193
|
+
|
|
194
|
+
type ConfProps<
|
|
195
|
+
A extends GenericTokens,
|
|
196
|
+
B extends GenericThemes,
|
|
197
|
+
C extends GenericShorthands = GenericShorthands,
|
|
198
|
+
D extends GenericMedia = GenericMedia,
|
|
199
|
+
E extends GenericAnimations = GenericAnimations,
|
|
200
|
+
F extends GenericFonts = GenericFonts
|
|
201
|
+
> = {
|
|
202
|
+
tokens: A
|
|
203
|
+
themes: B
|
|
204
|
+
shorthands?: C
|
|
205
|
+
media?: D
|
|
206
|
+
animations?: AnimationDriver<E>
|
|
207
|
+
fonts: F
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export type InferTamaguiConfig<Conf> = Conf extends ConfProps<
|
|
211
|
+
infer A,
|
|
212
|
+
infer B,
|
|
213
|
+
infer C,
|
|
214
|
+
infer D,
|
|
215
|
+
infer E,
|
|
216
|
+
infer F
|
|
217
|
+
>
|
|
218
|
+
? TamaguiInternalConfig<A, B, C, D, E, F>
|
|
219
|
+
: unknown
|
|
220
|
+
|
|
221
|
+
// for use in creation functions so it doesnt get overwrtitten
|
|
222
|
+
export type GenericTamaguiConfig = CreateTamaguiConfig<
|
|
223
|
+
GenericTokens,
|
|
224
|
+
GenericThemes,
|
|
225
|
+
GenericShorthands,
|
|
226
|
+
GenericMedia,
|
|
227
|
+
GenericAnimations,
|
|
228
|
+
GenericFonts
|
|
229
|
+
>
|
|
230
|
+
|
|
231
|
+
// since TamaguiConfig will be re-declared, these will all be typed globally
|
|
232
|
+
export type ThemeObject = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]
|
|
233
|
+
export type Tokens = TamaguiConfig['tokens']
|
|
234
|
+
export type Shorthands = TamaguiConfig['shorthands']
|
|
235
|
+
export type Media = TamaguiConfig['media']
|
|
236
|
+
export type Themes = TamaguiConfig['themes']
|
|
237
|
+
export type ThemeName = GetAltThemeNames<keyof Themes>
|
|
238
|
+
export type ThemeKeys = keyof ThemeObject
|
|
239
|
+
export type ThemeTokens = `$${ThemeKeys}`
|
|
240
|
+
export type AnimationKeys = Omit<GetAnimationKeys<TamaguiConfig>, number>
|
|
241
|
+
export type FontLanguages = ArrayIntersection<TamaguiConfig['fontLanguages']>
|
|
242
|
+
|
|
243
|
+
type ArrayIntersection<A extends any[]> = A[keyof A]
|
|
244
|
+
|
|
245
|
+
type GetAltThemeNames<S> = (S extends `${string}_${infer Alt}` ? GetAltThemeNames<Alt> : S) | S
|
|
246
|
+
|
|
247
|
+
export type SpacerProps = Omit<StackProps, 'flex' | 'direction' | 'size'> & {
|
|
248
|
+
size?: number | SpaceTokens | null
|
|
249
|
+
flex?: boolean | number
|
|
250
|
+
direction?: SpaceDirection
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export type CreateTamaguiProps = {
|
|
254
|
+
shorthands?: GenericTamaguiConfig['shorthands']
|
|
255
|
+
media?: GenericTamaguiConfig['media']
|
|
256
|
+
animations?: AnimationDriver<any>
|
|
257
|
+
fonts: GenericTamaguiConfig['fonts']
|
|
258
|
+
tokens: GenericTamaguiConfig['tokens']
|
|
259
|
+
themes: {
|
|
260
|
+
[key: string]: {
|
|
261
|
+
[key: string]: string | number | Variable
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
defaultTheme?: string
|
|
266
|
+
disableRootThemeClass?: boolean
|
|
267
|
+
|
|
268
|
+
defaultProps?: Record<string, any> & {
|
|
269
|
+
Stack?: StackProps
|
|
270
|
+
Text?: TextProps
|
|
271
|
+
Spacer?: SpacerProps
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// for the first render, determines which media queries are true
|
|
275
|
+
// useful for SSR
|
|
276
|
+
mediaQueryDefaultActive?: Record<MediaQueryKey, boolean>
|
|
277
|
+
|
|
278
|
+
// what's between each CSS style rule, set to "\n" to be easier to read
|
|
279
|
+
// defaults: "\n" when NODE_ENV=development, "" otherwise
|
|
280
|
+
cssStyleSeparator?: string
|
|
281
|
+
|
|
282
|
+
// (Advanced)
|
|
283
|
+
// on the web, tamagui treats `dark` and `light` themes as special and
|
|
284
|
+
// generates extra CSS to avoid having to re-render the entire page.
|
|
285
|
+
// this CSS relies on specificity hacks that multiply by your sub-themes.
|
|
286
|
+
// this sets the maxiumum number of nested dark/light themes you can do
|
|
287
|
+
// defaults to 3 for a balance, but can be higher if you nest them deeply.
|
|
288
|
+
maxDarkLightNesting?: number
|
|
289
|
+
|
|
290
|
+
// adds @media(prefers-color-scheme) media queries for dark/light
|
|
291
|
+
shouldAddPrefersColorThemes?: boolean
|
|
292
|
+
|
|
293
|
+
// only if you put the theme classname on the html element we have to generate diff
|
|
294
|
+
themeClassNameOnRoot?: boolean
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// this is the config generated via createTamagui()
|
|
298
|
+
export type TamaguiInternalConfig<
|
|
299
|
+
A extends GenericTokens = GenericTokens,
|
|
300
|
+
B extends GenericThemes = GenericThemes,
|
|
301
|
+
C extends GenericShorthands = GenericShorthands,
|
|
302
|
+
D extends GenericMedia = GenericMedia,
|
|
303
|
+
E extends GenericAnimations = GenericAnimations,
|
|
304
|
+
F extends GenericFonts = GenericFonts
|
|
305
|
+
> = Omit<CreateTamaguiProps, keyof GenericTamaguiConfig> &
|
|
306
|
+
CreateTamaguiConfig<A, B, C, D, E, F> & {
|
|
307
|
+
// TODO need to make it this but this breaks types, revisit
|
|
308
|
+
// animations: E //AnimationDriver<E>
|
|
309
|
+
// with $ prefixes for fast lookups (one time cost at startup vs every render)
|
|
310
|
+
tokensParsed: CreateTokens<Variable>
|
|
311
|
+
themeConfig: any
|
|
312
|
+
fontsParsed: GenericFonts
|
|
313
|
+
getCSS: () => string
|
|
314
|
+
parsed: boolean
|
|
315
|
+
inverseShorthands: Record<string, string>
|
|
316
|
+
|
|
317
|
+
// just passed in from CreateTamaguiProps
|
|
318
|
+
themeClassNameOnRoot?: boolean
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export type GetAnimationKeys<A extends GenericTamaguiConfig> = keyof A['animations']['animations']
|
|
322
|
+
|
|
323
|
+
// prevents const intersections from being clobbered into string, keeping the consts
|
|
324
|
+
export type UnionableString = string & {}
|
|
325
|
+
export type UnionableNumber = number & {}
|
|
326
|
+
export type PropTypes<A extends TamaguiComponent> = A extends React.FunctionComponent<infer Props>
|
|
327
|
+
? Props
|
|
328
|
+
: unknown
|
|
329
|
+
|
|
330
|
+
export type GenericFont<Key extends number | string = number | string> = {
|
|
331
|
+
size: { [key in Key]: number | Variable }
|
|
332
|
+
lineHeight: Partial<{ [key in Key]: number | Variable }>
|
|
333
|
+
letterSpacing: Partial<{ [key in Key]: number | Variable }>
|
|
334
|
+
weight: Partial<{ [key in Key]: number | string | Variable }>
|
|
335
|
+
family: string | Variable
|
|
336
|
+
style?: Partial<{ [key in Key]: TextStyle['fontStyle'] | Variable }>
|
|
337
|
+
transform?: Partial<{ [key in Key]: TextStyle['textTransform'] | Variable }>
|
|
338
|
+
color?: Partial<{ [key in Key]: string | Variable }>
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// media
|
|
342
|
+
export type MediaQueryObject = { [key: string]: string | number | string }
|
|
343
|
+
export type MediaQueryKey = keyof Media
|
|
344
|
+
export type MediaPropKeys = `$${MediaQueryKey}`
|
|
345
|
+
export type MediaQueryState = { [key in MediaPropKeys]: boolean }
|
|
346
|
+
export type MediaProps<A> = {
|
|
347
|
+
[key in MediaPropKeys]?: A
|
|
348
|
+
}
|
|
349
|
+
export type MediaQueries = {
|
|
350
|
+
[key in MediaQueryKey]: MediaQueryObject
|
|
351
|
+
}
|
|
352
|
+
export type ConfigureMediaQueryOptions = {
|
|
353
|
+
queries?: MediaQueries
|
|
354
|
+
defaultActive?: Record<MediaQueryKey, boolean>
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export type TransformStyleProps = {
|
|
358
|
+
x?: number
|
|
359
|
+
y?: number
|
|
360
|
+
perspective?: number
|
|
361
|
+
scale?: number
|
|
362
|
+
scaleX?: number
|
|
363
|
+
scaleY?: number
|
|
364
|
+
skewX?: string
|
|
365
|
+
skewY?: string
|
|
366
|
+
matrix?: number[]
|
|
367
|
+
rotate?: string
|
|
368
|
+
rotateY?: string
|
|
369
|
+
rotateX?: string
|
|
370
|
+
rotateZ?: string
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// createComponent props helpers
|
|
374
|
+
|
|
375
|
+
// animation="bouncy"
|
|
376
|
+
// animation={['bouncy', { }]}
|
|
377
|
+
// { all: 'name' }
|
|
378
|
+
|
|
379
|
+
// TODO can override for better types
|
|
380
|
+
export type AnimationConfigType = any
|
|
381
|
+
|
|
382
|
+
export type AnimationProp =
|
|
383
|
+
| AnimationKeys
|
|
384
|
+
| {
|
|
385
|
+
[key: string]:
|
|
386
|
+
| AnimationKeys
|
|
387
|
+
| {
|
|
388
|
+
type: AnimationKeys
|
|
389
|
+
[key: string]: any
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
| [
|
|
393
|
+
AnimationKeys,
|
|
394
|
+
{
|
|
395
|
+
[key: string]:
|
|
396
|
+
| AnimationKeys
|
|
397
|
+
| {
|
|
398
|
+
type?: AnimationKeys
|
|
399
|
+
[key: string]: any
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
]
|
|
403
|
+
|
|
404
|
+
type GetTokenFontKeysFor<
|
|
405
|
+
A extends
|
|
406
|
+
| 'size'
|
|
407
|
+
| 'weight'
|
|
408
|
+
| 'letterSpacing'
|
|
409
|
+
| 'family'
|
|
410
|
+
| 'lineHeight'
|
|
411
|
+
| 'transform'
|
|
412
|
+
| 'style'
|
|
413
|
+
| 'color'
|
|
414
|
+
> = keyof TamaguiConfig['fonts']['body'][A]
|
|
415
|
+
|
|
416
|
+
type GetTokenString<A> = A extends string | number ? `$${A}` : `$${string}`
|
|
417
|
+
|
|
418
|
+
// base tokens
|
|
419
|
+
export type SizeTokens = GetTokenString<keyof Tokens['size']> | number
|
|
420
|
+
export type SpaceTokens = GetTokenString<keyof Tokens['space']> | number | boolean
|
|
421
|
+
export type ColorTokens =
|
|
422
|
+
| GetTokenString<keyof Tokens['color']>
|
|
423
|
+
| GetTokenString<keyof ThemeObject>
|
|
424
|
+
| CSSColorNames
|
|
425
|
+
export type ZIndexTokens = GetTokenString<keyof Tokens['zIndex']> | number
|
|
426
|
+
export type RadiusTokens = GetTokenString<keyof Tokens['radius']> | number
|
|
427
|
+
|
|
428
|
+
// font tokens
|
|
429
|
+
export type FontTokens = GetTokenString<keyof TamaguiConfig['fonts']>
|
|
430
|
+
export type FontSizeTokens = GetTokenString<GetTokenFontKeysFor<'size'>> | number
|
|
431
|
+
export type FontLineHeightTokens = `$${GetTokenFontKeysFor<'lineHeight'>}` | number
|
|
432
|
+
export type FontWeightTokens =
|
|
433
|
+
| `$${GetTokenFontKeysFor<'weight'>}`
|
|
434
|
+
| `${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}00`
|
|
435
|
+
export type FontColorTokens = `$${GetTokenFontKeysFor<'color'>}` | number
|
|
436
|
+
export type FontLetterSpacingTokens = `$${GetTokenFontKeysFor<'letterSpacing'>}` | number
|
|
437
|
+
export type FontStyleTokens = `$${GetTokenFontKeysFor<'style'>}` | TextStyle['fontStyle']
|
|
438
|
+
export type FontTransformTokens =
|
|
439
|
+
| `$${GetTokenFontKeysFor<'transform'>}`
|
|
440
|
+
| TextStyle['textTransform']
|
|
441
|
+
|
|
442
|
+
//
|
|
443
|
+
// adds theme short values to relevant props
|
|
444
|
+
//
|
|
445
|
+
|
|
446
|
+
export type ThemeValueByCategory<K extends string | number | symbol> = K extends 'theme'
|
|
447
|
+
? ThemeTokens
|
|
448
|
+
: K extends 'size'
|
|
449
|
+
? SizeTokens
|
|
450
|
+
: K extends 'font'
|
|
451
|
+
? FontTokens
|
|
452
|
+
: K extends 'fontSize'
|
|
453
|
+
? FontSizeTokens
|
|
454
|
+
: K extends 'space'
|
|
455
|
+
? SpaceTokens
|
|
456
|
+
: K extends 'color'
|
|
457
|
+
? ColorTokens
|
|
458
|
+
: K extends 'zIndex'
|
|
459
|
+
? ZIndexTokens
|
|
460
|
+
: K extends 'lineHeight'
|
|
461
|
+
? FontLineHeightTokens
|
|
462
|
+
: K extends 'fontWeight'
|
|
463
|
+
? FontWeightTokens
|
|
464
|
+
: K extends 'letterSpacing'
|
|
465
|
+
? FontLetterSpacingTokens
|
|
466
|
+
: {}
|
|
467
|
+
|
|
468
|
+
type FontKeys = 'fontFamily'
|
|
469
|
+
type FontSizeKeys = 'fontSize'
|
|
470
|
+
type FontWeightKeys = 'fontWeight'
|
|
471
|
+
type FontLetterSpacingKeys = 'letterSpacing'
|
|
472
|
+
type LineHeightKeys = 'lineHeight'
|
|
473
|
+
type ZIndexKeys = 'zIndex'
|
|
474
|
+
|
|
475
|
+
export type ThemeValueGet<K extends string | number | symbol> = K extends 'theme'
|
|
476
|
+
? ThemeTokens
|
|
477
|
+
: K extends SizeKeys
|
|
478
|
+
? SizeTokens
|
|
479
|
+
: K extends FontKeys
|
|
480
|
+
? FontTokens
|
|
481
|
+
: K extends FontSizeKeys
|
|
482
|
+
? FontSizeTokens
|
|
483
|
+
: K extends SpaceKeys
|
|
484
|
+
? K extends 'shadowOffset'
|
|
485
|
+
? { width: SpaceTokens; height: SpaceTokens }
|
|
486
|
+
: SpaceTokens
|
|
487
|
+
: K extends ColorKeys
|
|
488
|
+
? ColorTokens
|
|
489
|
+
: K extends ZIndexKeys
|
|
490
|
+
? ZIndexTokens
|
|
491
|
+
: K extends LineHeightKeys
|
|
492
|
+
? FontLineHeightTokens
|
|
493
|
+
: K extends FontWeightKeys
|
|
494
|
+
? FontWeightTokens
|
|
495
|
+
: K extends FontLetterSpacingKeys
|
|
496
|
+
? FontLetterSpacingTokens
|
|
497
|
+
: never
|
|
498
|
+
|
|
499
|
+
export type ThemeValueFallback = UnionableString | Variable
|
|
500
|
+
|
|
501
|
+
export type WithThemeValues<T extends object> = {
|
|
502
|
+
[K in keyof T]: ThemeValueGet<K> extends never
|
|
503
|
+
? T[K]
|
|
504
|
+
: ThemeValueGet<K> | Exclude<T[K], string> | ThemeValueFallback
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// adds shorthand props
|
|
508
|
+
export type WithShorthands<StyleProps> = {
|
|
509
|
+
[Key in keyof Shorthands]?: Shorthands[Key] extends keyof StyleProps
|
|
510
|
+
? StyleProps[Shorthands[Key]] | null
|
|
511
|
+
: undefined
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// adds pseudo props
|
|
515
|
+
export type PseudoProps<A> = {
|
|
516
|
+
hoverStyle?: A | null
|
|
517
|
+
pressStyle?: A | null
|
|
518
|
+
focusStyle?: A | null
|
|
519
|
+
exitStyle?: A | null
|
|
520
|
+
enterStyle?: A | null
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export type PseudoPropKeys = keyof PseudoProps<any>
|
|
524
|
+
|
|
525
|
+
export type PseudoStyles = {
|
|
526
|
+
hoverStyle?: ViewStyle
|
|
527
|
+
pressStyle?: ViewStyle
|
|
528
|
+
focusStyle?: ViewStyle
|
|
529
|
+
enterStyle?: ViewStyle
|
|
530
|
+
exitStyle?: ViewStyle
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
//
|
|
534
|
+
// add both theme and shorthands
|
|
535
|
+
//
|
|
536
|
+
type WithThemeAndShorthands<A extends object> = WithThemeValues<A> &
|
|
537
|
+
WithShorthands<WithThemeValues<A>>
|
|
538
|
+
|
|
539
|
+
//
|
|
540
|
+
// combines all of theme, shorthands, pseudos...
|
|
541
|
+
//
|
|
542
|
+
type WithThemeShorthandsAndPseudos<A extends object> =
|
|
543
|
+
| WithThemeAndShorthands<A> & PseudoProps<WithThemeAndShorthands<A>>
|
|
544
|
+
|
|
545
|
+
//
|
|
546
|
+
// ... media queries and animations
|
|
547
|
+
//
|
|
548
|
+
type WithThemeShorthandsPseudosMediaAnimation<A extends object> = WithThemeShorthandsAndPseudos<A> &
|
|
549
|
+
MediaProps<WithThemeShorthandsAndPseudos<A>>
|
|
550
|
+
|
|
551
|
+
//
|
|
552
|
+
// Stack
|
|
553
|
+
//
|
|
554
|
+
|
|
555
|
+
type WebOnlyStyleProps = {
|
|
556
|
+
// WEB ONLY
|
|
557
|
+
cursor?: string
|
|
558
|
+
// WEB ONLY
|
|
559
|
+
contain?: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'paint' | string
|
|
560
|
+
// WEB ONLY values: inherit, inline, block, content
|
|
561
|
+
display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'
|
|
562
|
+
// WEB ONLY pointerEvents can be a style prop
|
|
563
|
+
pointerEvents?: ViewProps['pointerEvents']
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export type StackStylePropsBase = Omit<ViewStyle, 'display' | 'backfaceVisibility' | 'elevation'> &
|
|
567
|
+
TransformStyleProps &
|
|
568
|
+
WebOnlyStyleProps
|
|
569
|
+
|
|
570
|
+
export type StackPropsBaseShared = Omit<ViewProps, 'display' | 'children'> &
|
|
571
|
+
RNWViewProps &
|
|
572
|
+
TamaguiComponentPropsBase
|
|
573
|
+
|
|
574
|
+
export type StackStyleProps = WithThemeShorthandsPseudosMediaAnimation<StackStylePropsBase>
|
|
575
|
+
export type StackPropsBase = StackPropsBaseShared & WithThemeAndShorthands<StackStylePropsBase>
|
|
576
|
+
export type StackProps = StackPropsBaseShared & StackStyleProps
|
|
577
|
+
|
|
578
|
+
export type GestureReponderEvent = Exclude<View['props']['onResponderMove'], void> extends (
|
|
579
|
+
event: infer Event
|
|
580
|
+
) => void
|
|
581
|
+
? Event
|
|
582
|
+
: never
|
|
583
|
+
|
|
584
|
+
//
|
|
585
|
+
// Text props
|
|
586
|
+
//
|
|
587
|
+
|
|
588
|
+
export type TextStylePropsBase = Omit<TextStyle, 'display' | 'backfaceVisibility'> &
|
|
589
|
+
TransformStyleProps &
|
|
590
|
+
WebOnlyStyleProps & {
|
|
591
|
+
ellipse?: boolean
|
|
592
|
+
selectable?: boolean
|
|
593
|
+
textDecorationDistance?: number
|
|
594
|
+
textOverflow?: Properties['textOverflow']
|
|
595
|
+
whiteSpace?: Properties['whiteSpace']
|
|
596
|
+
wordWrap?: Properties['wordWrap']
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
export type TextPropsBaseShared = Omit<ReactTextProps, 'children'> &
|
|
600
|
+
RNWTextProps &
|
|
601
|
+
TamaguiComponentPropsBase
|
|
602
|
+
export type TextPropsBase = TextPropsBaseShared & WithThemeAndShorthands<TextStylePropsBase>
|
|
603
|
+
export type TextStyleProps = WithThemeShorthandsPseudosMediaAnimation<TextStylePropsBase>
|
|
604
|
+
export type TextProps = TextPropsBaseShared & TextStyleProps
|
|
605
|
+
|
|
606
|
+
// could actually infer from parent
|
|
607
|
+
export type ViewOrTextProps = WithThemeShorthandsPseudosMediaAnimation<
|
|
608
|
+
Omit<TextStylePropsBase, keyof StackStylePropsBase> & StackStylePropsBase
|
|
609
|
+
>
|
|
610
|
+
|
|
611
|
+
//
|
|
612
|
+
// StaticComponent
|
|
613
|
+
//
|
|
614
|
+
|
|
615
|
+
export type TamaguiComponent<
|
|
616
|
+
Props = any,
|
|
617
|
+
Ref = any,
|
|
618
|
+
BaseProps = {},
|
|
619
|
+
VariantProps = {}
|
|
620
|
+
> = ReactComponentWithRef<Props, Ref> & StaticComponentObject
|
|
621
|
+
|
|
622
|
+
type StaticComponentObject = {
|
|
623
|
+
staticConfig: StaticConfig
|
|
624
|
+
/*
|
|
625
|
+
* Only needed for more complex components
|
|
626
|
+
* If you create a styled frame component this is a HoC to extract
|
|
627
|
+
* styles from all parents.
|
|
628
|
+
*/
|
|
629
|
+
extractable: <X>(a: X, opts?: Partial<StaticConfig>) => X
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {
|
|
633
|
+
config: TamaguiInternalConfig
|
|
634
|
+
disableInjectCSS?: boolean
|
|
635
|
+
children?: React.ReactNode
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export type PropMapper = (
|
|
639
|
+
key: string,
|
|
640
|
+
value: any,
|
|
641
|
+
theme: ThemeObject,
|
|
642
|
+
props: Record<string, any>,
|
|
643
|
+
state: Partial<SplitStyleState>,
|
|
644
|
+
languageContext?: FontLanguageProps,
|
|
645
|
+
avoidDefaultProps?: boolean,
|
|
646
|
+
debug?: DebugProp
|
|
647
|
+
) => undefined | [string, any][]
|
|
648
|
+
|
|
649
|
+
export type StaticConfigParsed = StaticConfig & {
|
|
650
|
+
parsed: true
|
|
651
|
+
propMapper: PropMapper
|
|
652
|
+
variantsParsed?: {
|
|
653
|
+
[key: string]: {
|
|
654
|
+
[key: string]: any
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
export type GenericVariantDefinitions = {
|
|
660
|
+
[key: string]: {
|
|
661
|
+
[key: string]:
|
|
662
|
+
| ((a: any, b: any) => any)
|
|
663
|
+
| {
|
|
664
|
+
[key: string]: any
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
export type StaticConfig = {
|
|
670
|
+
Component?: React.FunctionComponent<any> & StaticComponentObject
|
|
671
|
+
|
|
672
|
+
variants?: GenericVariantDefinitions
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Used for applying sub theme style
|
|
676
|
+
*/
|
|
677
|
+
componentName?: string
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* (compiler) If you need to pass context or something, prevents from ever
|
|
681
|
+
* flattening. The 'jsx' option means it will never flatten. if you
|
|
682
|
+
* pass JSX as a children (if its purely string, it will still flatten).
|
|
683
|
+
*/
|
|
684
|
+
neverFlatten?: boolean | 'jsx'
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Determines ultimate output tag (Text vs View)
|
|
688
|
+
*/
|
|
689
|
+
isText?: boolean
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Attempts to attach focus styles at runtime (useful for native)
|
|
693
|
+
*/
|
|
694
|
+
isInput?: boolean
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* React native web images need special handling for className support
|
|
698
|
+
*/
|
|
699
|
+
isImage?: boolean
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Which style keys are allowed to be extracted.
|
|
703
|
+
*/
|
|
704
|
+
validStyles?: { [key: string]: boolean }
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Same as React.defaultProps, be sure to sync
|
|
708
|
+
*/
|
|
709
|
+
defaultProps: Record<string, any>
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* (compiler) If these props are encountered, bail on all optimization.
|
|
713
|
+
*/
|
|
714
|
+
deoptProps?: Set<string>
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* (compiler) If these props are encountered, leave them un-extracted.
|
|
718
|
+
*/
|
|
719
|
+
inlineProps?: Set<string>
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* (compiler) If not flattening, leave this prop as original value.
|
|
723
|
+
* Only applies to style attributes
|
|
724
|
+
*/
|
|
725
|
+
inlineWhenUnflattened?: Set<string>
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* (compiler) A bit odd, only for more advanced heirarchies.
|
|
729
|
+
* Indicates that the component will set this prop so the
|
|
730
|
+
* static extraction can ensure it sets them to ={undefined}
|
|
731
|
+
* so they get overriddent. In the future, this can be smarter.
|
|
732
|
+
*/
|
|
733
|
+
ensureOverriddenProp?: { [key: string]: boolean }
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Auto-detected, but can ovverride. Wraps children to space them on top
|
|
737
|
+
*/
|
|
738
|
+
isZStack?: boolean
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Merges into defaultProps later on, used internally yonly
|
|
742
|
+
*/
|
|
743
|
+
defaultVariants?: { [key: string]: any }
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Auto-detect, but can ovverride, passes styles properly to react-native-web
|
|
747
|
+
*/
|
|
748
|
+
isReactNativeWeb?: boolean
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Used internally to keep reference to the original rnw component
|
|
752
|
+
*/
|
|
753
|
+
reactNativeWebComponent?: any
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Memoize the component
|
|
757
|
+
*/
|
|
758
|
+
memo?: boolean
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Auto-detect, but can ovverride, passes styles properly to react-native-web
|
|
762
|
+
*/
|
|
763
|
+
isTamagui?: boolean
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Used internally to handle extractable HoC separate
|
|
767
|
+
*/
|
|
768
|
+
isExtractable?: boolean
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Used insternally to attach default props to names
|
|
772
|
+
*/
|
|
773
|
+
parentNames?: string[]
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* --------------------------------------------
|
|
778
|
+
* variants
|
|
779
|
+
* --------------------------------------------
|
|
780
|
+
*/
|
|
781
|
+
|
|
782
|
+
export type StylableComponent =
|
|
783
|
+
| TamaguiComponent
|
|
784
|
+
| React.Component
|
|
785
|
+
| React.ForwardRefExoticComponent<any>
|
|
786
|
+
| ReactComponentWithRef<any, any>
|
|
787
|
+
| (new (props: any) => any)
|
|
788
|
+
| typeof View
|
|
789
|
+
| typeof Text
|
|
790
|
+
| typeof TextInput
|
|
791
|
+
| typeof Image
|
|
792
|
+
|
|
793
|
+
export type GetStyledVariants<A extends TamaguiComponent> = A extends TamaguiComponent<
|
|
794
|
+
any,
|
|
795
|
+
any,
|
|
796
|
+
any,
|
|
797
|
+
infer Variants
|
|
798
|
+
>
|
|
799
|
+
? Variants
|
|
800
|
+
: never
|
|
801
|
+
|
|
802
|
+
export type GetBaseProps<A extends StylableComponent> = A extends TamaguiComponent<
|
|
803
|
+
any,
|
|
804
|
+
any,
|
|
805
|
+
infer BaseProps
|
|
806
|
+
>
|
|
807
|
+
? BaseProps
|
|
808
|
+
: never
|
|
809
|
+
|
|
810
|
+
export type GetProps<A extends StylableComponent> = A extends TamaguiComponent<infer Props>
|
|
811
|
+
? Props
|
|
812
|
+
: A extends React.Component<infer Props>
|
|
813
|
+
? GetGenericComponentTamaguiProps<Props>
|
|
814
|
+
: A extends new (props: infer Props) => any
|
|
815
|
+
? GetGenericComponentTamaguiProps<Props>
|
|
816
|
+
: {}
|
|
817
|
+
|
|
818
|
+
type GetGenericComponentTamaguiProps<P> = P &
|
|
819
|
+
Omit<'textAlign' extends keyof P ? TextProps : StackProps, keyof P>
|
|
820
|
+
|
|
821
|
+
export type SpreadKeys =
|
|
822
|
+
| '...fontSize'
|
|
823
|
+
| '...fontStyle'
|
|
824
|
+
| '...fontTransform'
|
|
825
|
+
| '...lineHeight'
|
|
826
|
+
| '...letterSpacing'
|
|
827
|
+
| '...size'
|
|
828
|
+
| '...space'
|
|
829
|
+
| '...color'
|
|
830
|
+
| '...zIndex'
|
|
831
|
+
| '...theme'
|
|
832
|
+
| '...radius'
|
|
833
|
+
|
|
834
|
+
export type VariantDefinitions<
|
|
835
|
+
Parent extends StylableComponent = TamaguiComponent,
|
|
836
|
+
MyProps extends Object = GetProps<Parent>,
|
|
837
|
+
Val = any
|
|
838
|
+
> = VariantDefinitionFromProps<MyProps, Val>
|
|
839
|
+
|
|
840
|
+
export type VariantDefinitionFromProps<MyProps, Val> = MyProps extends Object
|
|
841
|
+
? {
|
|
842
|
+
[propName: string]:
|
|
843
|
+
| VariantSpreadFunction<MyProps, Val>
|
|
844
|
+
| ({
|
|
845
|
+
[Key in SpreadKeys]?: Key extends '...fontSize'
|
|
846
|
+
? FontSizeVariantSpreadFunction<MyProps>
|
|
847
|
+
: Key extends '...size'
|
|
848
|
+
? SizeVariantSpreadFunction<MyProps>
|
|
849
|
+
: Key extends '...space'
|
|
850
|
+
? SpaceVariantSpreadFunction<MyProps>
|
|
851
|
+
: Key extends '...color'
|
|
852
|
+
? ColorVariantSpreadFunction<MyProps>
|
|
853
|
+
: Key extends '...lineHeight'
|
|
854
|
+
? FontLineHeightVariantSpreadFunction<MyProps>
|
|
855
|
+
: Key extends '...fontTransform'
|
|
856
|
+
? FontTransformVariantSpreadFunction<MyProps>
|
|
857
|
+
: Key extends '...fontStyle'
|
|
858
|
+
? FontStyleVariantSpreadFunction<MyProps>
|
|
859
|
+
: Key extends '...letterSpacing'
|
|
860
|
+
? FontLetterSpacingVariantSpreadFunction<MyProps>
|
|
861
|
+
: Key extends '...zIndex'
|
|
862
|
+
? ZIndexVariantSpreadFunction<MyProps>
|
|
863
|
+
: Key extends '...radius'
|
|
864
|
+
? RadiusVariantSpreadFunction<MyProps>
|
|
865
|
+
: Key extends '...theme'
|
|
866
|
+
? ThemeVariantSpreadFunction<MyProps>
|
|
867
|
+
: never
|
|
868
|
+
} & {
|
|
869
|
+
[Key in string | number | 'true' | 'false']?:
|
|
870
|
+
| MyProps
|
|
871
|
+
| VariantSpreadFunction<MyProps, Val>
|
|
872
|
+
} & {
|
|
873
|
+
[Key in VariantTypeKeys]?: Key extends ':number'
|
|
874
|
+
? VariantSpreadFunction<MyProps, number>
|
|
875
|
+
: Key extends ':boolean'
|
|
876
|
+
? VariantSpreadFunction<MyProps, boolean>
|
|
877
|
+
: Key extends ':string'
|
|
878
|
+
? VariantSpreadFunction<MyProps, string>
|
|
879
|
+
: never
|
|
880
|
+
})
|
|
881
|
+
}
|
|
882
|
+
: never
|
|
883
|
+
|
|
884
|
+
export type GenericStackVariants = VariantDefinitionFromProps<StackProps, any>
|
|
885
|
+
export type GenericTextVariants = VariantDefinitionFromProps<StackProps, any>
|
|
886
|
+
|
|
887
|
+
export type GetVariantProps<Variants> = {
|
|
888
|
+
[Key in keyof Variants]?: Variants[Key] extends VariantSpreadFunction<any, infer Val>
|
|
889
|
+
? Val
|
|
890
|
+
: GetVariantValues<keyof Variants[Key]>
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
export type VariantSpreadExtras<Props> = {
|
|
894
|
+
fonts: TamaguiConfig['fonts']
|
|
895
|
+
tokens: TamaguiConfig['tokens']
|
|
896
|
+
theme: Themes extends { [key: string]: infer B } ? B : unknown
|
|
897
|
+
props: Props
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
type PropLike = { [key: string]: any }
|
|
901
|
+
|
|
902
|
+
export type VariantSpreadFunction<Props extends PropLike, Val = any> = (
|
|
903
|
+
val: Val,
|
|
904
|
+
config: VariantSpreadExtras<Props>
|
|
905
|
+
) =>
|
|
906
|
+
| {
|
|
907
|
+
[Key in keyof Props]: Props[Key] | Variable
|
|
908
|
+
}
|
|
909
|
+
| null
|
|
910
|
+
| undefined
|
|
911
|
+
|
|
912
|
+
export type VariantTypeKeys = ':string' | ':boolean' | ':number'
|
|
913
|
+
|
|
914
|
+
export type GetVariantValues<Key> = Key extends `...${infer VariantSpread}`
|
|
915
|
+
? ThemeValueByCategory<VariantSpread>
|
|
916
|
+
: Key extends 'true' | 'false'
|
|
917
|
+
? boolean
|
|
918
|
+
: Key extends ':string'
|
|
919
|
+
? string
|
|
920
|
+
: Key extends ':boolean'
|
|
921
|
+
? boolean
|
|
922
|
+
: Key extends ':number'
|
|
923
|
+
? number
|
|
924
|
+
: Key
|
|
925
|
+
|
|
926
|
+
export type FontSizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
927
|
+
A,
|
|
928
|
+
FontSizeTokens
|
|
929
|
+
>
|
|
930
|
+
export type SizeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, SizeTokens>
|
|
931
|
+
export type SpaceVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, SpaceTokens>
|
|
932
|
+
export type ColorVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ColorTokens>
|
|
933
|
+
export type FontLineHeightVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
934
|
+
A,
|
|
935
|
+
FontLineHeightTokens
|
|
936
|
+
>
|
|
937
|
+
export type FontLetterSpacingVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
938
|
+
A,
|
|
939
|
+
FontLetterSpacingTokens
|
|
940
|
+
>
|
|
941
|
+
export type FontStyleVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
942
|
+
A,
|
|
943
|
+
FontStyleTokens
|
|
944
|
+
>
|
|
945
|
+
export type FontTransformVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<
|
|
946
|
+
A,
|
|
947
|
+
FontTransformTokens
|
|
948
|
+
>
|
|
949
|
+
export type ZIndexVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ZIndexTokens>
|
|
950
|
+
export type RadiusVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, RadiusTokens>
|
|
951
|
+
export type ThemeVariantSpreadFunction<A extends PropLike> = VariantSpreadFunction<A, ThemeTokens>
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* --------------------------------------------
|
|
955
|
+
* end variants
|
|
956
|
+
* --------------------------------------------
|
|
957
|
+
*/
|
|
958
|
+
|
|
959
|
+
type SizeKeys =
|
|
960
|
+
| 'width'
|
|
961
|
+
| 'height'
|
|
962
|
+
| 'minWidth'
|
|
963
|
+
| 'minHeight'
|
|
964
|
+
| 'maxWidth'
|
|
965
|
+
| 'maxHeight'
|
|
966
|
+
| 'shadowRadius'
|
|
967
|
+
|
|
968
|
+
type ColorKeys =
|
|
969
|
+
| 'color'
|
|
970
|
+
| 'backgroundColor'
|
|
971
|
+
| 'borderColor'
|
|
972
|
+
| 'borderBottomColor'
|
|
973
|
+
| 'borderTopColor'
|
|
974
|
+
| 'borderLeftColor'
|
|
975
|
+
| 'borderRightColor'
|
|
976
|
+
| 'shadowColor'
|
|
977
|
+
| 'textShadowColor'
|
|
978
|
+
|
|
979
|
+
type SpaceKeys =
|
|
980
|
+
| 'space'
|
|
981
|
+
| 'padding'
|
|
982
|
+
| 'paddingHorizontal'
|
|
983
|
+
| 'paddingVertical'
|
|
984
|
+
| 'paddingLeft'
|
|
985
|
+
| 'paddingTop'
|
|
986
|
+
| 'paddingBottom'
|
|
987
|
+
| 'paddingLeft'
|
|
988
|
+
| 'paddingRight'
|
|
989
|
+
| 'paddingEnd'
|
|
990
|
+
| 'paddingStart'
|
|
991
|
+
| 'margin'
|
|
992
|
+
| 'marginHorizontal'
|
|
993
|
+
| 'marginVertical'
|
|
994
|
+
| 'marginLeft'
|
|
995
|
+
| 'marginTop'
|
|
996
|
+
| 'marginBottom'
|
|
997
|
+
| 'marginLeft'
|
|
998
|
+
| 'marginRight'
|
|
999
|
+
| 'marginEnd'
|
|
1000
|
+
| 'marginStart'
|
|
1001
|
+
| 'x'
|
|
1002
|
+
| 'y'
|
|
1003
|
+
| 'scale'
|
|
1004
|
+
| 'scaleX'
|
|
1005
|
+
| 'scaleY'
|
|
1006
|
+
| 'borderTopEndRadius'
|
|
1007
|
+
| 'borderTopLeftRadius'
|
|
1008
|
+
| 'borderTopRightRadius'
|
|
1009
|
+
| 'borderTopStartRadius'
|
|
1010
|
+
| 'borderBottomEndRadius'
|
|
1011
|
+
| 'borderBottomLeftRadius'
|
|
1012
|
+
| 'borderBottomRightRadius'
|
|
1013
|
+
| 'borderBottomStartRadius'
|
|
1014
|
+
| 'borderBottomWidth'
|
|
1015
|
+
| 'borderLeftWidth'
|
|
1016
|
+
| 'borderRadius'
|
|
1017
|
+
| 'borderRightWidth'
|
|
1018
|
+
| 'borderTopEndRadius'
|
|
1019
|
+
| 'borderTopLeftRadius'
|
|
1020
|
+
| 'borderTopRightRadius'
|
|
1021
|
+
| 'borderEndWidth'
|
|
1022
|
+
| 'borderStartWidth'
|
|
1023
|
+
| 'borderTopStartRadius'
|
|
1024
|
+
| 'borderTopWidth'
|
|
1025
|
+
| 'borderWidth'
|
|
1026
|
+
| 'left'
|
|
1027
|
+
| 'top'
|
|
1028
|
+
| 'right'
|
|
1029
|
+
| 'bottom'
|
|
1030
|
+
| 'shadowOffset'
|
|
1031
|
+
|
|
1032
|
+
type CSSColorNames =
|
|
1033
|
+
| 'aliceblue'
|
|
1034
|
+
| 'antiquewhite'
|
|
1035
|
+
| 'aqua'
|
|
1036
|
+
| 'aquamarine'
|
|
1037
|
+
| 'azure'
|
|
1038
|
+
| 'beige'
|
|
1039
|
+
| 'bisque'
|
|
1040
|
+
| 'black'
|
|
1041
|
+
| 'blanchedalmond'
|
|
1042
|
+
| 'blue'
|
|
1043
|
+
| 'blueviolet'
|
|
1044
|
+
| 'brown'
|
|
1045
|
+
| 'burlywood'
|
|
1046
|
+
| 'cadetblue'
|
|
1047
|
+
| 'chartreuse'
|
|
1048
|
+
| 'chocolate'
|
|
1049
|
+
| 'coral'
|
|
1050
|
+
| 'cornflowerblue'
|
|
1051
|
+
| 'cornsilk'
|
|
1052
|
+
| 'crimson'
|
|
1053
|
+
| 'cyan'
|
|
1054
|
+
| 'darkblue'
|
|
1055
|
+
| 'darkcyan'
|
|
1056
|
+
| 'darkgoldenrod'
|
|
1057
|
+
| 'darkgray'
|
|
1058
|
+
| 'darkgreen'
|
|
1059
|
+
| 'darkkhaki'
|
|
1060
|
+
| 'darkmagenta'
|
|
1061
|
+
| 'darkolivegreen'
|
|
1062
|
+
| 'darkorange'
|
|
1063
|
+
| 'darkorchid'
|
|
1064
|
+
| 'darkred'
|
|
1065
|
+
| 'darksalmon'
|
|
1066
|
+
| 'darkseagreen'
|
|
1067
|
+
| 'darkslateblue'
|
|
1068
|
+
| 'darkslategray'
|
|
1069
|
+
| 'darkturquoise'
|
|
1070
|
+
| 'darkviolet'
|
|
1071
|
+
| 'deeppink'
|
|
1072
|
+
| 'deepskyblue'
|
|
1073
|
+
| 'dimgray'
|
|
1074
|
+
| 'dodgerblue'
|
|
1075
|
+
| 'firebrick'
|
|
1076
|
+
| 'floralwhite'
|
|
1077
|
+
| 'forestgreen'
|
|
1078
|
+
| 'fuchsia'
|
|
1079
|
+
| 'gainsboro'
|
|
1080
|
+
| 'ghostwhite'
|
|
1081
|
+
| 'gold'
|
|
1082
|
+
| 'goldenrod'
|
|
1083
|
+
| 'gray'
|
|
1084
|
+
| 'green'
|
|
1085
|
+
| 'greenyellow'
|
|
1086
|
+
| 'honeydew'
|
|
1087
|
+
| 'hotpink'
|
|
1088
|
+
| 'indianred '
|
|
1089
|
+
| 'indigo '
|
|
1090
|
+
| 'ivory'
|
|
1091
|
+
| 'khaki'
|
|
1092
|
+
| 'lavender'
|
|
1093
|
+
| 'lavenderblush'
|
|
1094
|
+
| 'lawngreen'
|
|
1095
|
+
| 'lemonchiffon'
|
|
1096
|
+
| 'lightblue'
|
|
1097
|
+
| 'lightcoral'
|
|
1098
|
+
| 'lightcyan'
|
|
1099
|
+
| 'lightgoldenrodyellow'
|
|
1100
|
+
| 'lightgrey'
|
|
1101
|
+
| 'lightgreen'
|
|
1102
|
+
| 'lightpink'
|
|
1103
|
+
| 'lightsalmon'
|
|
1104
|
+
| 'lightseagreen'
|
|
1105
|
+
| 'lightskyblue'
|
|
1106
|
+
| 'lightslategray'
|
|
1107
|
+
| 'lightsteelblue'
|
|
1108
|
+
| 'lightyellow'
|
|
1109
|
+
| 'lime'
|
|
1110
|
+
| 'limegreen'
|
|
1111
|
+
| 'linen'
|
|
1112
|
+
| 'magenta'
|
|
1113
|
+
| 'maroon'
|
|
1114
|
+
| 'mediumaquamarine'
|
|
1115
|
+
| 'mediumblue'
|
|
1116
|
+
| 'mediumorchid'
|
|
1117
|
+
| 'mediumpurple'
|
|
1118
|
+
| 'mediumseagreen'
|
|
1119
|
+
| 'mediumslateblue'
|
|
1120
|
+
| 'mediumspringgreen'
|
|
1121
|
+
| 'mediumturquoise'
|
|
1122
|
+
| 'mediumvioletred'
|
|
1123
|
+
| 'midnightblue'
|
|
1124
|
+
| 'mintcream'
|
|
1125
|
+
| 'mistyrose'
|
|
1126
|
+
| 'moccasin'
|
|
1127
|
+
| 'navajowhite'
|
|
1128
|
+
| 'navy'
|
|
1129
|
+
| 'oldlace'
|
|
1130
|
+
| 'olive'
|
|
1131
|
+
| 'olivedrab'
|
|
1132
|
+
| 'orange'
|
|
1133
|
+
| 'orangered'
|
|
1134
|
+
| 'orchid'
|
|
1135
|
+
| 'palegoldenrod'
|
|
1136
|
+
| 'palegreen'
|
|
1137
|
+
| 'paleturquoise'
|
|
1138
|
+
| 'palevioletred'
|
|
1139
|
+
| 'papayawhip'
|
|
1140
|
+
| 'peachpuff'
|
|
1141
|
+
| 'peru'
|
|
1142
|
+
| 'pink'
|
|
1143
|
+
| 'plum'
|
|
1144
|
+
| 'powderblue'
|
|
1145
|
+
| 'purple'
|
|
1146
|
+
| 'red'
|
|
1147
|
+
| 'rosybrown'
|
|
1148
|
+
| 'royalblue'
|
|
1149
|
+
| 'saddlebrown'
|
|
1150
|
+
| 'salmon'
|
|
1151
|
+
| 'sandybrown'
|
|
1152
|
+
| 'seagreen'
|
|
1153
|
+
| 'seashell'
|
|
1154
|
+
| 'sienna'
|
|
1155
|
+
| 'silver'
|
|
1156
|
+
| 'skyblue'
|
|
1157
|
+
| 'slateblue'
|
|
1158
|
+
| 'slategray'
|
|
1159
|
+
| 'snow'
|
|
1160
|
+
| 'springgreen'
|
|
1161
|
+
| 'steelblue'
|
|
1162
|
+
| 'tan'
|
|
1163
|
+
| 'teal'
|
|
1164
|
+
| 'thistle'
|
|
1165
|
+
| 'tomato'
|
|
1166
|
+
| 'turquoise'
|
|
1167
|
+
| 'violet'
|
|
1168
|
+
| 'wheat'
|
|
1169
|
+
| 'white'
|
|
1170
|
+
| 'whitesmoke'
|
|
1171
|
+
| 'yellow'
|
|
1172
|
+
| 'yellowgreen'
|
|
1173
|
+
|
|
1174
|
+
export type TamaguiComponentState = {
|
|
1175
|
+
hover: boolean
|
|
1176
|
+
press: boolean
|
|
1177
|
+
pressIn: boolean
|
|
1178
|
+
focus: boolean
|
|
1179
|
+
mounted: boolean
|
|
1180
|
+
animation?: null | {
|
|
1181
|
+
style?: any
|
|
1182
|
+
avoidClasses?: boolean
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
export type SplitStyleState = TamaguiComponentState & {
|
|
1187
|
+
noClassNames?: boolean
|
|
1188
|
+
dynamicStylesInline?: boolean
|
|
1189
|
+
resolveVariablesAs?: ResolveVariableTypes
|
|
1190
|
+
fallbackProps?: Record<string, any>
|
|
1191
|
+
keepVariantsAsProps?: boolean
|
|
1192
|
+
hasTextAncestor?: boolean
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
// Animations:
|
|
1196
|
+
|
|
1197
|
+
type AnimationConfig = {
|
|
1198
|
+
[key: string]: any
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
// includes a very limited adapter between various impls for number => style
|
|
1202
|
+
// this is useful only in limited scenarios like `Sheet`, but necessary in those cases
|
|
1203
|
+
|
|
1204
|
+
export type AnimatedNumberStrategy =
|
|
1205
|
+
// only values shared between reanimated/react-native for now
|
|
1206
|
+
| {
|
|
1207
|
+
type: 'spring'
|
|
1208
|
+
stiffness?: number
|
|
1209
|
+
damping?: number
|
|
1210
|
+
mass?: number
|
|
1211
|
+
overshootClamping?: boolean
|
|
1212
|
+
restSpeedThreshold?: number
|
|
1213
|
+
restDisplacementThreshold?: number
|
|
1214
|
+
}
|
|
1215
|
+
| { type: 'timing'; duration: number }
|
|
1216
|
+
| { type: 'direct' }
|
|
1217
|
+
|
|
1218
|
+
export type UniversalAnimatedNumber<A> = {
|
|
1219
|
+
getInstance(): A
|
|
1220
|
+
getValue(): number
|
|
1221
|
+
setValue(next: number, config?: AnimatedNumberStrategy): void
|
|
1222
|
+
stop(): void
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
export type AnimationDriver<A extends AnimationConfig = AnimationConfig> = {
|
|
1226
|
+
avoidClasses?: boolean
|
|
1227
|
+
useAnimations: UseAnimationHook
|
|
1228
|
+
useAnimatedNumber: (initial: number) => UniversalAnimatedNumber<any>
|
|
1229
|
+
useAnimatedNumberStyle: <V extends UniversalAnimatedNumber<any>>(
|
|
1230
|
+
val: V,
|
|
1231
|
+
getStyle: (current: any) => any
|
|
1232
|
+
) => void
|
|
1233
|
+
useAnimatedNumberReaction: (
|
|
1234
|
+
val: UniversalAnimatedNumber<any>,
|
|
1235
|
+
onValue: (current: number) => void
|
|
1236
|
+
) => void
|
|
1237
|
+
animations: A
|
|
1238
|
+
View?: any
|
|
1239
|
+
Text?: any
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
export type UseAnimationProps = TamaguiComponentPropsBase & Record<string, any>
|
|
1243
|
+
|
|
1244
|
+
export type UseAnimationHelpers = {
|
|
1245
|
+
staticConfig: StaticConfigParsed
|
|
1246
|
+
getStyle: (props?: {
|
|
1247
|
+
isEntering?: boolean
|
|
1248
|
+
isExiting?: boolean
|
|
1249
|
+
exitVariant?: string | null
|
|
1250
|
+
enterVariant?: string | null
|
|
1251
|
+
}) => ViewStyle
|
|
1252
|
+
state: SplitStyleState
|
|
1253
|
+
pseudos: PseudoProps<ViewStyle>
|
|
1254
|
+
// style: ViewStyle | null | undefined
|
|
1255
|
+
// isMounted: boolean
|
|
1256
|
+
// exitStyle?: ViewStyle | null
|
|
1257
|
+
onDidAnimate?: any
|
|
1258
|
+
delay?: number
|
|
1259
|
+
// mergedStyles(props?: { isExiting?: boolean }): ViewStyle
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
export type UseAnimationHook = (
|
|
1263
|
+
props: UseAnimationProps,
|
|
1264
|
+
helpers: UseAnimationHelpers
|
|
1265
|
+
) => {
|
|
1266
|
+
style?: StackStylePropsBase | StackStylePropsBase[]
|
|
1267
|
+
}
|