@tamagui/core 1.0.0-alpha.7 → 1.0.0-beta.0
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 +69 -0
- package/dist/cjs/Tamagui.js.map +7 -0
- package/dist/cjs/ThemeContext.js +29 -0
- package/dist/cjs/ThemeContext.js.map +7 -0
- package/dist/cjs/ThemeManager.js +211 -0
- package/dist/cjs/ThemeManager.js.map +7 -0
- package/dist/cjs/conf.js +64 -0
- package/dist/cjs/conf.js.map +7 -0
- package/dist/cjs/constants/constants.js +56 -0
- package/dist/cjs/constants/constants.js.map +7 -0
- package/dist/cjs/constants/platform.js +58 -0
- package/dist/cjs/constants/platform.js.map +7 -0
- package/dist/cjs/constants/pseudos.js +41 -0
- package/dist/cjs/constants/pseudos.js.map +7 -0
- package/dist/cjs/constants/rnw.js +46 -0
- package/dist/cjs/constants/rnw.js.map +7 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +29 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +7 -0
- package/dist/cjs/createComponent.js +677 -0
- package/dist/cjs/createComponent.js.map +7 -0
- package/dist/cjs/createFont.js +50 -0
- package/dist/cjs/createFont.js.map +7 -0
- package/dist/cjs/createShorthands.js +32 -0
- package/dist/cjs/createShorthands.js.map +7 -0
- package/dist/cjs/createTamagui.js +240 -0
- package/dist/cjs/createTamagui.js.map +7 -0
- package/dist/cjs/createTheme.js +29 -0
- package/dist/cjs/createTheme.js.map +7 -0
- package/dist/cjs/createTokens.js +52 -0
- package/dist/cjs/createTokens.js.map +7 -0
- package/dist/cjs/createVariable.js +77 -0
- package/dist/cjs/createVariable.js.map +7 -0
- package/dist/cjs/defaultComponentState.js +1 -0
- package/dist/{helpers/pseudos.js.map → cjs/defaultComponentState.js.map} +0 -0
- package/dist/cjs/helpers/RNComponents.js +38 -0
- package/dist/cjs/helpers/RNComponents.js.map +7 -0
- package/dist/cjs/helpers/addStylesUsingClassname.js +87 -0
- package/dist/cjs/helpers/addStylesUsingClassname.js.map +7 -0
- package/dist/cjs/helpers/areEqualSets.js +38 -0
- package/dist/cjs/helpers/areEqualSets.js.map +7 -0
- package/dist/cjs/helpers/createMediaStyle.js +54 -0
- package/dist/cjs/helpers/createMediaStyle.js.map +7 -0
- package/dist/cjs/helpers/createPropMapper.js +228 -0
- package/dist/cjs/helpers/createPropMapper.js.map +7 -0
- package/dist/cjs/helpers/createShallowUpdate.js +55 -0
- package/dist/cjs/helpers/createShallowUpdate.js.map +7 -0
- package/dist/cjs/helpers/createTamaguiProvider.js +93 -0
- package/dist/cjs/helpers/createTamaguiProvider.js.map +7 -0
- package/dist/cjs/helpers/extendStaticConfig.js +82 -0
- package/dist/cjs/helpers/extendStaticConfig.js.map +7 -0
- package/dist/cjs/helpers/fixNativeShadow.js +30 -0
- package/dist/cjs/helpers/fixNativeShadow.js.map +7 -0
- package/dist/cjs/helpers/fixNativeShadow.native.js +56 -0
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +7 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +41 -0
- package/dist/cjs/helpers/getExpandedShorthands.js.map +7 -0
- package/dist/cjs/helpers/getSize.js +35 -0
- package/dist/cjs/helpers/getSize.js.map +7 -0
- package/dist/cjs/helpers/getSplitStyles.js +307 -0
- package/dist/cjs/helpers/getSplitStyles.js.map +7 -0
- package/dist/cjs/helpers/getStylesAtomic.js +177 -0
- package/dist/cjs/helpers/getStylesAtomic.js.map +7 -0
- package/dist/cjs/helpers/getStylesAtomic.native.js +32 -0
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +7 -0
- package/dist/cjs/helpers/getThemeParentClassName.js +33 -0
- package/dist/cjs/helpers/getThemeParentClassName.js.map +7 -0
- package/dist/cjs/helpers/insertStyleRule.js +122 -0
- package/dist/cjs/helpers/insertStyleRule.js.map +7 -0
- package/dist/cjs/helpers/isObj.js +29 -0
- package/dist/cjs/helpers/isObj.js.map +7 -0
- package/dist/cjs/helpers/isTamaguiElement.js +33 -0
- package/dist/cjs/helpers/isTamaguiElement.js.map +7 -0
- package/dist/cjs/helpers/matchMedia.js +40 -0
- package/dist/cjs/helpers/matchMedia.js.map +7 -0
- package/dist/cjs/helpers/matchMedia.native.js +34 -0
- package/dist/cjs/helpers/matchMedia.native.js.map +7 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +40 -0
- package/dist/cjs/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/cjs/helpers/themeable.js +83 -0
- package/dist/cjs/helpers/themeable.js.map +7 -0
- package/dist/cjs/helpers/validate.js +123 -0
- package/dist/cjs/helpers/validate.js.map +7 -0
- package/dist/cjs/helpers/withStaticProperties.js +32 -0
- package/dist/cjs/helpers/withStaticProperties.js.map +7 -0
- package/dist/cjs/helpers/wrapThemeManagerContext.js +39 -0
- package/dist/cjs/helpers/wrapThemeManagerContext.js.map +7 -0
- package/dist/cjs/hooks/useConstant.js +37 -0
- package/dist/cjs/hooks/useConstant.js.map +7 -0
- package/dist/cjs/hooks/useFeatures.js +228 -0
- package/dist/cjs/hooks/useFeatures.js.map +7 -0
- package/dist/cjs/hooks/useIsMounted.js +41 -0
- package/dist/cjs/hooks/useIsMounted.js.map +7 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +39 -0
- package/dist/cjs/hooks/useIsTouchDevice.js.map +7 -0
- package/dist/cjs/hooks/useMedia.js +199 -0
- package/dist/cjs/hooks/useMedia.js.map +7 -0
- package/dist/cjs/hooks/usePressable.js +50 -0
- package/dist/cjs/hooks/usePressable.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +219 -0
- package/dist/cjs/hooks/useTheme.js.map +7 -0
- package/dist/cjs/hooks/useUnmountEffect.js +33 -0
- package/dist/cjs/hooks/useUnmountEffect.js.map +7 -0
- package/dist/cjs/index.js +83 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/static/postProcessStyles.js +40 -0
- package/dist/cjs/static/postProcessStyles.js.map +7 -0
- package/dist/cjs/static.js +33 -0
- package/dist/cjs/static.js.map +7 -0
- package/dist/cjs/styled.js +94 -0
- package/dist/cjs/styled.js.map +7 -0
- package/dist/cjs/tamagui-base.css +11 -0
- package/dist/cjs/tamagui-base.css.map +7 -0
- package/dist/cjs/types-rnw.js +16 -0
- package/dist/cjs/types-rnw.js.map +7 -0
- package/dist/cjs/types.js +16 -0
- package/dist/cjs/types.js.map +7 -0
- package/dist/cjs/views/Animated.js +132 -0
- package/dist/cjs/views/Animated.js.map +7 -0
- package/dist/cjs/views/Stack.js +52 -0
- package/dist/cjs/views/Stack.js.map +7 -0
- package/dist/cjs/views/Text.js +95 -0
- package/dist/cjs/views/Text.js.map +7 -0
- package/dist/cjs/views/TextAncestorContext.js +45 -0
- package/dist/cjs/views/TextAncestorContext.js.map +7 -0
- package/dist/cjs/views/Theme.js +60 -0
- package/dist/cjs/views/Theme.js.map +7 -0
- package/dist/cjs/views/ThemeContext.js +29 -0
- package/dist/cjs/views/ThemeContext.js.map +7 -0
- package/dist/cjs/views/ThemeInverse.js +52 -0
- package/dist/cjs/views/ThemeInverse.js.map +7 -0
- package/dist/cjs/views/ThemeManagerContext.js +85 -0
- package/dist/cjs/views/ThemeManagerContext.js.map +7 -0
- package/dist/cjs/views/ThemeProvider.js +67 -0
- package/dist/cjs/views/ThemeProvider.js.map +7 -0
- package/dist/cjs/views/ThemeReset.js +63 -0
- package/dist/cjs/views/ThemeReset.js.map +7 -0
- package/dist/esm/Tamagui.js +42 -0
- package/dist/esm/Tamagui.js.map +7 -0
- package/dist/{views → esm}/ThemeContext.js +0 -0
- package/dist/esm/ThemeContext.js.map +7 -0
- package/dist/esm/ThemeManager.js +187 -0
- package/dist/esm/ThemeManager.js.map +7 -0
- package/dist/esm/conf.js +36 -0
- package/dist/esm/conf.js.map +7 -0
- package/dist/{constants → esm/constants}/constants.js +4 -0
- package/dist/esm/constants/constants.js.map +7 -0
- package/dist/{constants → esm/constants}/platform.js +8 -1
- package/dist/esm/constants/platform.js.map +7 -0
- package/dist/{constants → esm/constants}/pseudos.js +0 -0
- package/dist/{constants → esm/constants}/pseudos.js.map +2 -2
- package/dist/{constants → esm/constants}/rnw.js +2 -0
- package/dist/esm/constants/rnw.js.map +7 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js +6 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +7 -0
- package/dist/esm/createComponent.js +606 -0
- package/dist/esm/createComponent.js.map +7 -0
- package/dist/{createFont.js → esm/createFont.js} +0 -0
- package/dist/{createFont.js.map → esm/createFont.js.map} +2 -2
- package/dist/{createShorthands.js → esm/createShorthands.js} +0 -0
- package/dist/{createShorthands.js.map → esm/createShorthands.js.map} +2 -2
- package/dist/esm/createTamagui.js +202 -0
- package/dist/esm/createTamagui.js.map +7 -0
- package/dist/esm/createTheme.js +7 -0
- package/dist/esm/createTheme.js.map +7 -0
- package/dist/{createTokens.js → esm/createTokens.js} +2 -6
- package/dist/esm/createTokens.js.map +7 -0
- package/dist/esm/createVariable.js +49 -0
- package/dist/esm/createVariable.js.map +7 -0
- package/dist/esm/defaultComponentState.js +1 -0
- package/dist/{types.js.map → esm/defaultComponentState.js.map} +0 -0
- package/dist/esm/helpers/RNComponents.js +12 -0
- package/dist/esm/helpers/RNComponents.js.map +7 -0
- package/dist/{helpers → esm/helpers}/addStylesUsingClassname.js +20 -13
- package/dist/esm/helpers/addStylesUsingClassname.js.map +7 -0
- package/dist/esm/helpers/areEqualSets.js +16 -0
- package/dist/esm/helpers/areEqualSets.js.map +7 -0
- package/dist/{helpers → esm/helpers}/createMediaStyle.js +3 -6
- package/dist/esm/helpers/createMediaStyle.js.map +7 -0
- package/dist/esm/helpers/createPropMapper.js +206 -0
- package/dist/esm/helpers/createPropMapper.js.map +7 -0
- package/dist/esm/helpers/createShallowUpdate.js +19 -0
- package/dist/esm/helpers/createShallowUpdate.js.map +7 -0
- package/dist/esm/helpers/createTamaguiProvider.js +40 -0
- package/dist/esm/helpers/createTamaguiProvider.js.map +7 -0
- package/dist/{helpers → esm/helpers}/extendStaticConfig.js +17 -14
- package/dist/esm/helpers/extendStaticConfig.js.map +7 -0
- package/dist/{helpers → esm/helpers}/fixNativeShadow.js +0 -0
- package/dist/{helpers → esm/helpers}/fixNativeShadow.js.map +2 -2
- package/dist/esm/helpers/fixNativeShadow.native.js +34 -0
- package/dist/esm/helpers/fixNativeShadow.native.js.map +7 -0
- package/dist/esm/helpers/getExpandedShorthands.js +19 -0
- package/dist/esm/helpers/getExpandedShorthands.js.map +7 -0
- package/dist/esm/helpers/getSize.js +13 -0
- package/dist/esm/helpers/getSize.js.map +7 -0
- package/dist/esm/helpers/getSplitStyles.js +278 -0
- package/dist/esm/helpers/getSplitStyles.js.map +7 -0
- package/dist/esm/helpers/getStylesAtomic.js +131 -0
- package/dist/esm/helpers/getStylesAtomic.js.map +7 -0
- package/dist/{helpers → esm/helpers}/getStylesAtomic.native.js +0 -0
- package/dist/{helpers → esm/helpers}/getStylesAtomic.native.js.map +2 -2
- package/dist/esm/helpers/getThemeParentClassName.js +11 -0
- package/dist/esm/helpers/getThemeParentClassName.js.map +7 -0
- package/dist/esm/helpers/insertStyleRule.js +94 -0
- package/dist/esm/helpers/insertStyleRule.js.map +7 -0
- package/dist/{helpers → esm/helpers}/isObj.js +0 -0
- package/dist/{helpers → esm/helpers}/isObj.js.map +2 -2
- package/dist/{helpers → esm/helpers}/isTamaguiElement.js +2 -1
- package/dist/{helpers → esm/helpers}/isTamaguiElement.js.map +2 -2
- package/dist/{helpers → esm/helpers}/matchMedia.js +3 -0
- package/dist/esm/helpers/matchMedia.js.map +7 -0
- package/dist/{helpers → esm/helpers}/matchMedia.native.js +1 -0
- package/dist/esm/helpers/matchMedia.native.js.map +7 -0
- package/dist/esm/helpers/proxyThemeVariables.js +18 -0
- package/dist/esm/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/{helpers → esm/helpers}/themeable.js +12 -10
- package/dist/esm/helpers/themeable.js.map +7 -0
- package/dist/esm/helpers/validate.js +76 -0
- package/dist/esm/helpers/validate.js.map +7 -0
- package/dist/esm/helpers/withStaticProperties.js +10 -0
- package/dist/esm/helpers/withStaticProperties.js.map +7 -0
- package/dist/esm/helpers/wrapThemeManagerContext.js +14 -0
- package/dist/esm/helpers/wrapThemeManagerContext.js.map +7 -0
- package/dist/{hooks → esm/hooks}/useConstant.js +0 -0
- package/dist/{hooks → esm/hooks}/useConstant.js.map +2 -2
- package/dist/esm/hooks/useFeatures.js +173 -0
- package/dist/esm/hooks/useFeatures.js.map +7 -0
- package/dist/esm/hooks/useIsMounted.js +19 -0
- package/dist/esm/hooks/useIsMounted.js.map +7 -0
- package/dist/esm/hooks/useIsTouchDevice.js +17 -0
- package/dist/esm/hooks/useIsTouchDevice.js.map +7 -0
- package/dist/{hooks → esm/hooks}/useMedia.js +31 -42
- package/dist/esm/hooks/useMedia.js.map +7 -0
- package/dist/{hooks → esm/hooks}/usePressable.js +2 -1
- package/dist/{hooks → esm/hooks}/usePressable.js.map +2 -2
- package/dist/esm/hooks/useTheme.js +178 -0
- package/dist/esm/hooks/useTheme.js.map +7 -0
- package/dist/esm/hooks/useUnmountEffect.js +11 -0
- package/dist/esm/hooks/useUnmountEffect.js.map +7 -0
- package/dist/{index.js → esm/index.js} +25 -5
- package/dist/esm/index.js.map +7 -0
- package/dist/{static → esm/static}/postProcessStyles.js +0 -0
- package/dist/{static → esm/static}/postProcessStyles.js.map +2 -2
- package/dist/{static.js → esm/static.js} +4 -2
- package/dist/esm/static.js.map +7 -0
- package/dist/esm/styled.js +45 -0
- package/dist/esm/styled.js.map +7 -0
- package/dist/esm/tamagui-base.css +11 -0
- package/dist/esm/tamagui-base.css.map +7 -0
- package/dist/esm/types-rnw.js +1 -0
- package/dist/esm/types-rnw.js.map +7 -0
- package/dist/{types.js → esm/types.js} +0 -0
- package/dist/esm/types.js.map +7 -0
- package/dist/{views → esm/views}/Animated.js +0 -0
- package/dist/{views → esm/views}/Animated.js.map +2 -2
- package/dist/{views → esm/views}/Stack.js +1 -0
- package/dist/esm/views/Stack.js.map +7 -0
- package/dist/{views → esm/views}/Text.js +6 -4
- package/dist/esm/views/Text.js.map +7 -0
- package/dist/esm/views/TextAncestorContext.js +18 -0
- package/dist/esm/views/TextAncestorContext.js.map +7 -0
- package/dist/esm/views/Theme.js +35 -0
- package/dist/esm/views/Theme.js.map +7 -0
- package/dist/esm/views/ThemeContext.js +6 -0
- package/dist/{views → esm/views}/ThemeContext.js.map +2 -2
- package/dist/{views → esm/views}/ThemeInverse.js +1 -1
- package/dist/{views → esm/views}/ThemeInverse.js.map +3 -3
- package/dist/{views → esm/views}/ThemeManagerContext.js +8 -7
- package/dist/esm/views/ThemeManagerContext.js.map +7 -0
- package/dist/esm/views/ThemeProvider.js +42 -0
- package/dist/esm/views/ThemeProvider.js.map +7 -0
- package/dist/esm/views/ThemeReset.js +38 -0
- package/dist/esm/views/ThemeReset.js.map +7 -0
- package/dist/jsx/Tamagui.js +41 -0
- package/dist/jsx/ThemeContext.js +5 -0
- package/dist/jsx/ThemeManager.js +186 -0
- package/dist/jsx/conf.js +35 -0
- package/dist/jsx/constants/constants.js +17 -0
- package/dist/jsx/constants/platform.js +25 -0
- package/dist/jsx/constants/pseudos.js +17 -0
- package/dist/jsx/constants/rnw.js +23 -0
- package/dist/jsx/contexts/ButtonInsideButtonContext.js +5 -0
- package/dist/jsx/createComponent.js +592 -0
- package/dist/jsx/createFont.js +27 -0
- package/dist/jsx/createShorthands.js +9 -0
- package/dist/jsx/createTamagui.js +201 -0
- package/dist/jsx/createTheme.js +6 -0
- package/dist/jsx/createTokens.js +28 -0
- package/dist/jsx/createVariable.js +48 -0
- package/dist/jsx/defaultComponentState.js +0 -0
- package/dist/jsx/helpers/RNComponents.js +11 -0
- package/dist/jsx/helpers/addStylesUsingClassname.js +63 -0
- package/dist/jsx/helpers/areEqualSets.js +15 -0
- package/dist/jsx/helpers/createMediaStyle.js +30 -0
- package/dist/jsx/helpers/createPropMapper.js +205 -0
- package/dist/jsx/helpers/createShallowUpdate.js +18 -0
- package/dist/jsx/helpers/createTamaguiProvider.js +34 -0
- package/dist/jsx/helpers/extendStaticConfig.js +61 -0
- package/dist/jsx/helpers/fixNativeShadow.js +7 -0
- package/dist/jsx/helpers/fixNativeShadow.native.js +33 -0
- package/dist/jsx/helpers/getExpandedShorthands.js +18 -0
- package/dist/jsx/helpers/getSize.js +12 -0
- package/dist/jsx/helpers/getSplitStyles.js +277 -0
- package/dist/jsx/helpers/getStylesAtomic.js +130 -0
- package/dist/jsx/helpers/getStylesAtomic.native.js +9 -0
- package/dist/jsx/helpers/getThemeParentClassName.js +10 -0
- package/dist/jsx/helpers/insertStyleRule.js +93 -0
- package/dist/jsx/helpers/isObj.js +6 -0
- package/dist/jsx/helpers/isTamaguiElement.js +10 -0
- package/dist/jsx/helpers/matchMedia.js +17 -0
- package/dist/jsx/helpers/matchMedia.native.js +8 -0
- package/dist/jsx/helpers/proxyThemeVariables.js +17 -0
- package/dist/jsx/helpers/themeable.js +24 -0
- package/dist/jsx/helpers/validate.js +75 -0
- package/dist/jsx/helpers/withStaticProperties.js +9 -0
- package/dist/jsx/helpers/wrapThemeManagerContext.js +10 -0
- package/dist/jsx/hooks/useConstant.js +14 -0
- package/dist/jsx/hooks/useFeatures.js +167 -0
- package/dist/jsx/hooks/useIsMounted.js +18 -0
- package/dist/jsx/hooks/useIsTouchDevice.js +16 -0
- package/dist/jsx/hooks/useMedia.js +159 -0
- package/dist/jsx/hooks/usePressable.js +13 -0
- package/dist/jsx/hooks/useTheme.js +177 -0
- package/dist/jsx/hooks/useUnmountEffect.js +10 -0
- package/dist/jsx/index.js +51 -0
- package/dist/jsx/static/postProcessStyles.js +17 -0
- package/dist/jsx/static.js +16 -0
- package/dist/jsx/styled.js +44 -0
- package/dist/jsx/tamagui-base.css +10 -0
- package/dist/jsx/types-rnw.js +0 -0
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/views/Animated.js +74 -0
- package/dist/jsx/views/Stack.js +12 -0
- package/dist/jsx/views/Text.js +61 -0
- package/dist/jsx/views/TextAncestorContext.js +15 -0
- package/dist/jsx/views/Theme.js +31 -0
- package/dist/jsx/views/ThemeContext.js +5 -0
- package/dist/jsx/views/ThemeInverse.js +22 -0
- package/dist/jsx/views/ThemeManagerContext.js +61 -0
- package/dist/jsx/views/ThemeProvider.js +35 -0
- package/dist/jsx/views/ThemeReset.js +34 -0
- package/package.json +22 -19
- package/types/Tamagui.d.ts +30 -0
- package/types/Tamagui.d.ts.map +1 -0
- package/types/ThemeContext.d.ts +7 -0
- package/types/ThemeContext.d.ts.map +1 -0
- package/types/ThemeManager.d.ts +49 -0
- package/types/ThemeManager.d.ts.map +1 -0
- package/types/conf.d.ts +27 -0
- package/types/conf.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/constants/constants.d.ts +2 -0
- package/types/constants/constants.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/constants/platform.d.ts +3 -0
- package/types/constants/platform.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/constants/rnw.d.ts +0 -0
- package/types/constants/rnw.d.ts.map +1 -0
- package/types/contexts/ButtonInsideButtonContext.d.ts +3 -0
- package/types/contexts/ButtonInsideButtonContext.d.ts.map +1 -0
- package/types/createComponent.d.ts +19 -0
- package/types/createComponent.d.ts.map +1 -0
- package/types/createFont.d.ts +3 -0
- package/types/createFont.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createShorthands.d.ts +0 -0
- package/types/createShorthands.d.ts.map +1 -0
- package/types/createTamagui.d.ts +18 -0
- package/types/createTamagui.d.ts.map +1 -0
- package/types/createTheme.d.ts +7 -0
- package/types/createTheme.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/createTokens.d.ts +0 -16
- package/types/createTokens.d.ts.map +1 -0
- package/types/createVariable.d.ts +20 -0
- package/types/createVariable.d.ts.map +1 -0
- package/types/defaultComponentState.d.ts +1 -0
- package/types/defaultComponentState.d.ts.map +1 -0
- package/types/helpers/RNComponents.d.ts +2 -0
- package/types/helpers/RNComponents.d.ts.map +1 -0
- package/types/helpers/addStylesUsingClassname.d.ts +3 -0
- package/types/helpers/addStylesUsingClassname.d.ts.map +1 -0
- package/types/helpers/areEqualSets.d.ts +2 -0
- package/types/helpers/areEqualSets.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/createMediaStyle.d.ts +1 -1
- package/types/helpers/createMediaStyle.d.ts.map +1 -0
- package/types/helpers/createPropMapper.d.ts +4 -0
- package/types/helpers/createPropMapper.d.ts.map +1 -0
- package/types/helpers/createShallowUpdate.d.ts +4 -0
- package/types/helpers/createShallowUpdate.d.ts.map +1 -0
- package/types/helpers/createTamaguiProvider.d.ts +7 -0
- package/types/helpers/createTamaguiProvider.d.ts.map +1 -0
- package/types/helpers/extendStaticConfig.d.ts +4 -0
- package/types/helpers/extendStaticConfig.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/fixNativeShadow.d.ts +0 -0
- package/types/helpers/fixNativeShadow.d.ts.map +1 -0
- package/types/helpers/fixNativeShadow.native.d.ts +2 -0
- package/types/helpers/fixNativeShadow.native.d.ts.map +1 -0
- package/types/helpers/getExpandedShorthands.d.ts +3 -0
- package/types/helpers/getExpandedShorthands.d.ts.map +1 -0
- package/types/helpers/getSize.d.ts +3 -0
- package/types/helpers/getSize.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +19 -0
- package/types/helpers/getSplitStyles.d.ts.map +1 -0
- package/types/helpers/getStylesAtomic.d.ts +27 -0
- package/types/helpers/getStylesAtomic.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/getStylesAtomic.native.d.ts +0 -0
- package/types/helpers/getStylesAtomic.native.d.ts.map +1 -0
- package/types/helpers/insertStyleRule.d.ts +8 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -0
- package/types/helpers/isObj.d.ts +2 -0
- package/types/helpers/isObj.d.ts.map +1 -0
- package/types/helpers/isTamaguiElement.d.ts +3 -0
- package/types/helpers/isTamaguiElement.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/matchMedia.d.ts +0 -0
- package/types/helpers/matchMedia.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/helpers/matchMedia.native.d.ts +0 -0
- package/types/helpers/matchMedia.native.d.ts.map +1 -0
- package/types/helpers/proxyThemeVariables.d.ts +2 -0
- package/types/helpers/proxyThemeVariables.d.ts.map +1 -0
- package/types/helpers/themeable.d.ts +12 -0
- package/types/helpers/themeable.d.ts.map +1 -0
- package/types/helpers/validate.d.ts +4 -0
- package/types/helpers/validate.d.ts.map +1 -0
- package/types/helpers/withStaticProperties.d.ts +2 -0
- package/types/helpers/withStaticProperties.d.ts.map +1 -0
- package/types/helpers/wrapThemeManagerContext.d.ts +3 -0
- package/types/helpers/wrapThemeManagerContext.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useConstant.d.ts +0 -0
- package/types/hooks/useConstant.d.ts.map +1 -0
- package/types/hooks/useFeatures.d.ts +18 -0
- package/types/hooks/useFeatures.d.ts.map +1 -0
- package/types/hooks/useIsMounted.d.ts +3 -0
- package/types/hooks/useIsMounted.d.ts.map +1 -0
- package/types/hooks/useIsTouchDevice.d.ts +2 -0
- package/types/hooks/useIsTouchDevice.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/useMedia.d.ts +2 -6
- package/types/hooks/useMedia.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/hooks/usePressable.d.ts +0 -0
- package/types/hooks/usePressable.d.ts.map +1 -0
- package/types/hooks/useTheme.d.ts +36 -0
- package/types/hooks/useTheme.d.ts.map +1 -0
- package/types/hooks/useUnmountEffect.d.ts +2 -0
- package/types/hooks/useUnmountEffect.d.ts.map +1 -0
- package/types/index.d.ts +42 -0
- package/types/index.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/static.d.ts +7 -2
- package/types/static.d.ts.map +1 -0
- package/types/styled.d.ts +16 -0
- package/types/styled.d.ts.map +1 -0
- package/types/types-rnw.d.ts +74 -0
- package/types/types-rnw.d.ts.map +1 -0
- package/types/types.d.ts +406 -0
- package/types/types.d.ts.map +1 -0
- package/types/views/Stack.d.ts +4 -0
- package/types/views/Stack.d.ts.map +1 -0
- package/types/views/Text.d.ts +4 -0
- package/types/views/Text.d.ts.map +1 -0
- package/types/views/TextAncestorContext.d.ts +5 -0
- package/types/views/TextAncestorContext.d.ts.map +1 -0
- package/types/views/Theme.d.ts +12 -0
- package/types/views/Theme.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/ThemeInverse.d.ts +0 -0
- package/types/views/ThemeInverse.d.ts.map +1 -0
- package/{dist/packages/core/src → types}/views/ThemeProvider.d.ts +1 -1
- package/types/views/ThemeProvider.d.ts.map +1 -0
- package/types/views/ThemeReset.d.ts +4 -0
- package/types/views/ThemeReset.d.ts.map +1 -0
- package/LICENSE +0 -21
- package/dist/constants/constants.js.map +0 -7
- package/dist/constants/platform.js.map +0 -7
- package/dist/constants/rnw.js.map +0 -7
- package/dist/constants/styleConstants.js +0 -46
- package/dist/constants/styleConstants.js.map +0 -7
- package/dist/createComponent.js +0 -459
- package/dist/createComponent.js.map +0 -7
- package/dist/createTamagui.js +0 -166
- package/dist/createTamagui.js.map +0 -7
- package/dist/createTheme.js +0 -20
- package/dist/createTheme.js.map +0 -7
- package/dist/createTokens.js.map +0 -7
- package/dist/createVariable.js +0 -25
- package/dist/createVariable.js.map +0 -7
- package/dist/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/helpers/createMediaStyle.js.map +0 -7
- package/dist/helpers/createPropMapper.js +0 -153
- package/dist/helpers/createPropMapper.js.map +0 -7
- package/dist/helpers/createTamaguiProvider.js +0 -25
- package/dist/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/helpers/extendStaticConfig.js.map +0 -7
- package/dist/helpers/fixNativeShadow.native.js +0 -30
- package/dist/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/helpers/getSplitStyles.js +0 -148
- package/dist/helpers/getSplitStyles.js.map +0 -7
- package/dist/helpers/getStylesAtomic.js +0 -83
- package/dist/helpers/getStylesAtomic.js.map +0 -7
- package/dist/helpers/insertStyleRule.js +0 -24
- package/dist/helpers/insertStyleRule.js.map +0 -7
- package/dist/helpers/isComponent.js +0 -10
- package/dist/helpers/isComponent.js.map +0 -7
- package/dist/helpers/isTamaguiComponent.js +0 -10
- package/dist/helpers/isTamaguiComponent.js.map +0 -7
- package/dist/helpers/matchMedia.js.map +0 -7
- package/dist/helpers/matchMedia.native.js.map +0 -7
- package/dist/helpers/pseudos.js +0 -1
- package/dist/helpers/themeable.js.map +0 -7
- package/dist/helpers/validate.js +0 -60
- package/dist/helpers/validate.js.map +0 -7
- package/dist/helpers/validateConfig.js +0 -46
- package/dist/helpers/validateConfig.js.map +0 -7
- package/dist/helpers/validateTokens.js +0 -29
- package/dist/helpers/validateTokens.js.map +0 -7
- package/dist/hooks/useFeatures.js +0 -75
- package/dist/hooks/useFeatures.js.map +0 -7
- package/dist/hooks/useForceUpdate.js +0 -28
- package/dist/hooks/useForceUpdate.js.map +0 -7
- package/dist/hooks/useMedia.js.map +0 -7
- package/dist/hooks/useTheme.js +0 -93
- package/dist/hooks/useTheme.js.map +0 -7
- package/dist/index.cjs +0 -2211
- package/dist/index.cjs.map +0 -7
- package/dist/index.js.map +0 -7
- package/dist/packages/core/src/constants/constants.d.ts.map +0 -1
- package/dist/packages/core/src/constants/platform.d.ts.map +0 -1
- package/dist/packages/core/src/constants/pseudos.d.ts +0 -15
- package/dist/packages/core/src/constants/pseudos.d.ts.map +0 -1
- package/dist/packages/core/src/constants/rnw.d.ts.map +0 -1
- package/dist/packages/core/src/createComponent.d.ts +0 -16
- package/dist/packages/core/src/createComponent.d.ts.map +0 -1
- package/dist/packages/core/src/createShorthands.d.ts.map +0 -1
- package/dist/packages/core/src/createTamagui.d.ts +0 -37
- package/dist/packages/core/src/createTamagui.d.ts.map +0 -1
- package/dist/packages/core/src/createTheme.d.ts +0 -5
- package/dist/packages/core/src/createTheme.d.ts.map +0 -1
- package/dist/packages/core/src/createTokens.d.ts.map +0 -1
- package/dist/packages/core/src/createVariable.d.ts +0 -14
- package/dist/packages/core/src/createVariable.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts +0 -2
- package/dist/packages/core/src/helpers/addStylesUsingClassname.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/createMediaStyle.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts +0 -5
- package/dist/packages/core/src/helpers/createTamaguiProvider.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts +0 -5
- package/dist/packages/core/src/helpers/extendStaticConfig.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/fixNativeShadow.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts +0 -2
- package/dist/packages/core/src/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts +0 -15
- package/dist/packages/core/src/helpers/getSplitStyles.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts +0 -3
- package/dist/packages/core/src/helpers/getStylesAtomic.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/getStylesAtomic.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts +0 -2
- package/dist/packages/core/src/helpers/insertStyleRule.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/matchMedia.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/matchMedia.native.d.ts.map +0 -1
- package/dist/packages/core/src/helpers/themeable.d.ts +0 -10
- package/dist/packages/core/src/helpers/themeable.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useConstant.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useFeatures.d.ts +0 -5
- package/dist/packages/core/src/hooks/useFeatures.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts +0 -2
- package/dist/packages/core/src/hooks/useForceUpdate.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useMedia.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/usePressable.d.ts.map +0 -1
- package/dist/packages/core/src/hooks/useTheme.d.ts +0 -18
- package/dist/packages/core/src/hooks/useTheme.d.ts.map +0 -1
- package/dist/packages/core/src/index.d.ts +0 -27
- package/dist/packages/core/src/index.d.ts.map +0 -1
- package/dist/packages/core/src/static/postProcessStyles.d.ts +0 -7
- package/dist/packages/core/src/static/postProcessStyles.d.ts.map +0 -1
- package/dist/packages/core/src/static.d.ts.map +0 -1
- package/dist/packages/core/src/styled.d.ts +0 -16
- package/dist/packages/core/src/styled.d.ts.map +0 -1
- package/dist/packages/core/src/types.d.ts +0 -305
- package/dist/packages/core/src/types.d.ts.map +0 -1
- package/dist/packages/core/src/views/Animated.d.ts +0 -15
- package/dist/packages/core/src/views/Animated.d.ts.map +0 -1
- package/dist/packages/core/src/views/Stack.d.ts +0 -3
- package/dist/packages/core/src/views/Stack.d.ts.map +0 -1
- package/dist/packages/core/src/views/Text.d.ts +0 -3
- package/dist/packages/core/src/views/Text.d.ts.map +0 -1
- package/dist/packages/core/src/views/TextAncestorContext.d.ts +0 -3
- package/dist/packages/core/src/views/TextAncestorContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/Theme.d.ts +0 -8
- package/dist/packages/core/src/views/Theme.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeContext.d.ts +0 -18
- package/dist/packages/core/src/views/ThemeContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeInverse.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts +0 -15
- package/dist/packages/core/src/views/ThemeManagerContext.d.ts.map +0 -1
- package/dist/packages/core/src/views/ThemeProvider.d.ts.map +0 -1
- package/dist/packages/helpers/src/AllRules.d.ts +0 -3
- package/dist/packages/helpers/src/AllRules.d.ts.map +0 -1
- package/dist/packages/helpers/src/concatClassName.d.ts +0 -2
- package/dist/packages/helpers/src/concatClassName.d.ts.map +0 -1
- package/dist/packages/helpers/src/index.d.ts +0 -5
- package/dist/packages/helpers/src/index.d.ts.map +0 -1
- package/dist/packages/helpers/src/types.d.ts +0 -8
- package/dist/packages/helpers/src/types.d.ts.map +0 -1
- package/dist/packages/helpers/src/validStyleProps.d.ts +0 -475
- package/dist/packages/helpers/src/validStyleProps.d.ts.map +0 -1
- package/dist/static.js.map +0 -7
- package/dist/styled.js +0 -21
- package/dist/styled.js.map +0 -7
- package/dist/views/SafeAreaProvider.js +0 -30
- package/dist/views/SafeAreaProvider.js.map +0 -7
- package/dist/views/Stack.js.map +0 -7
- package/dist/views/Text.js.map +0 -7
- package/dist/views/TextAncestorContext.js +0 -18
- package/dist/views/TextAncestorContext.js.map +0 -7
- package/dist/views/Theme.js +0 -65
- package/dist/views/Theme.js.map +0 -7
- package/dist/views/ThemeManagerContext.js.map +0 -7
- package/dist/views/ThemeProvider.js +0 -45
- package/dist/views/ThemeProvider.js.map +0 -7
- package/src/constants/constants.ts +0 -12
- package/src/constants/platform.ts +0 -15
- package/src/constants/pseudos.ts +0 -14
- package/src/constants/rnw.tsx +0 -20
- package/src/createComponent.tsx +0 -608
- package/src/createFont.ts +0 -31
- package/src/createShorthands.ts +0 -5
- package/src/createTamagui.ts +0 -215
- package/src/createTheme.ts +0 -19
- package/src/createTokens.ts +0 -88
- package/src/createVariable.ts +0 -26
- package/src/helpers/addStylesUsingClassname.tsx +0 -60
- package/src/helpers/createMediaStyle.ts +0 -46
- package/src/helpers/createPropMapper.ts +0 -184
- package/src/helpers/createTamaguiProvider.tsx +0 -22
- package/src/helpers/extendStaticConfig.ts +0 -68
- package/src/helpers/fixNativeShadow.native.tsx +0 -27
- package/src/helpers/fixNativeShadow.tsx +0 -2
- package/src/helpers/getSplitStyles.tsx +0 -197
- package/src/helpers/getStylesAtomic.native.ts +0 -3
- package/src/helpers/getStylesAtomic.ts +0 -103
- package/src/helpers/insertStyleRule.tsx +0 -18
- package/src/helpers/isObj.ts +0 -1
- package/src/helpers/isTamaguiElement.tsx +0 -5
- package/src/helpers/matchMedia.native.ts +0 -3
- package/src/helpers/matchMedia.ts +0 -9
- package/src/helpers/themeable.tsx +0 -42
- package/src/helpers/validate.ts +0 -59
- package/src/hooks/useConstant.tsx +0 -10
- package/src/hooks/useFeatures.tsx +0 -78
- package/src/hooks/useMedia.tsx +0 -194
- package/src/hooks/usePressable.tsx +0 -9
- package/src/hooks/useTheme.tsx +0 -107
- package/src/index.ts +0 -32
- package/src/static/postProcessStyles.tsx +0 -20
- package/src/static.ts +0 -22
- package/src/styled.ts +0 -82
- package/src/types.tsx +0 -562
- package/src/views/Animated.tsx +0 -121
- package/src/views/Stack.tsx +0 -21
- package/src/views/Text.tsx +0 -66
- package/src/views/TextAncestorContext.tsx +0 -12
- package/src/views/Theme.tsx +0 -90
- package/src/views/ThemeContext.tsx +0 -5
- package/src/views/ThemeInverse.tsx +0 -22
- package/src/views/ThemeManagerContext.tsx +0 -60
- package/src/views/ThemeProvider.tsx +0 -52
- package/types.d.ts +0 -556
package/src/types.tsx
DELETED
|
@@ -1,562 +0,0 @@
|
|
|
1
|
-
import React, { RefObject } from 'react'
|
|
2
|
-
import { TextProps as ReactTextProps, TextStyle } from 'react-native'
|
|
3
|
-
import { GestureResponderEvent, View, ViewProps, ViewStyle } from 'react-native'
|
|
4
|
-
|
|
5
|
-
import { Variable } from './createVariable'
|
|
6
|
-
import { ThemeProviderProps } from './views/ThemeProvider'
|
|
7
|
-
|
|
8
|
-
// to prevent things from going circular, hoisting some types in this file
|
|
9
|
-
// to generally order them as building up towards TamaguiConfig
|
|
10
|
-
|
|
11
|
-
export interface CreateTokens<Val extends number | string | Variable = number | string | Variable> {
|
|
12
|
-
font: { [key: string]: GenericFont }
|
|
13
|
-
color: { [key: string]: Val }
|
|
14
|
-
space: { [key: string]: Val }
|
|
15
|
-
size: { [key: string]: Val }
|
|
16
|
-
radius: { [key: string]: Val }
|
|
17
|
-
zIndex: { [key: string]: Val }
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
type GenericTokens = CreateTokens
|
|
21
|
-
type GenericThemes = {
|
|
22
|
-
[key: string]: {
|
|
23
|
-
// defined for our tamagui kit , we could do this inside `tamagui`
|
|
24
|
-
// but maybe helpful to have some sort of universally shared things +
|
|
25
|
-
// + enforce if they want their own, redefine in their design sys
|
|
26
|
-
bg: string | Variable
|
|
27
|
-
bg2: string | Variable
|
|
28
|
-
bg3: string | Variable
|
|
29
|
-
bg4: string | Variable
|
|
30
|
-
color: string | Variable
|
|
31
|
-
color2: string | Variable
|
|
32
|
-
color3: string | Variable
|
|
33
|
-
color4: string | Variable
|
|
34
|
-
borderColor: string | Variable
|
|
35
|
-
borderColor2: string | Variable
|
|
36
|
-
shadowColor: string | Variable
|
|
37
|
-
shadowColor2: string | Variable
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
type GenericShorthands = {}
|
|
41
|
-
type GenericMedia<K extends string = string> = {
|
|
42
|
-
// name => media shorthand name (camelCase) => value
|
|
43
|
-
[key in K]: {
|
|
44
|
-
[key: string]: number | string
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// this is the "main" typed object, which users re-define
|
|
49
|
-
// (internal) keep all types directly on this object and reference them from elsewhere
|
|
50
|
-
//
|
|
51
|
-
// const config = createTamagui(...)
|
|
52
|
-
// type MyConfig = typeof config
|
|
53
|
-
// declare module 'tamagui' {
|
|
54
|
-
// export interface TamaguiCustomConfig extends MyConfig {}
|
|
55
|
-
// }
|
|
56
|
-
// now your whole app/kit should be typed correctly
|
|
57
|
-
//
|
|
58
|
-
export interface TamaguiCustomConfig {}
|
|
59
|
-
|
|
60
|
-
export interface TamaguiConfig
|
|
61
|
-
extends Omit<GenericTamaguiConfig, keyof TamaguiCustomConfig>,
|
|
62
|
-
TamaguiCustomConfig {}
|
|
63
|
-
|
|
64
|
-
export type CreateTamaguiConfig<
|
|
65
|
-
A extends GenericTokens,
|
|
66
|
-
B extends GenericThemes,
|
|
67
|
-
C extends GenericShorthands,
|
|
68
|
-
D extends GenericMedia
|
|
69
|
-
> = Partial<Pick<ThemeProviderProps, 'defaultTheme' | 'disableRootThemeClass'>> & {
|
|
70
|
-
tokens: A
|
|
71
|
-
themes: B
|
|
72
|
-
shorthands: C
|
|
73
|
-
media: D
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// for use in creation functions so it doesnt get overwrtitten
|
|
77
|
-
export type GenericTamaguiConfig = CreateTamaguiConfig<
|
|
78
|
-
GenericTokens,
|
|
79
|
-
GenericThemes,
|
|
80
|
-
GenericShorthands,
|
|
81
|
-
GenericMedia
|
|
82
|
-
>
|
|
83
|
-
|
|
84
|
-
// since TamaguiConfig will be re-declared, these will all be typed globally
|
|
85
|
-
export type ThemeObject = TamaguiConfig['themes'][keyof TamaguiConfig['themes']]
|
|
86
|
-
export type Tokens = TamaguiConfig['tokens']
|
|
87
|
-
export type Shorthands = TamaguiConfig['shorthands']
|
|
88
|
-
export type Media = TamaguiConfig['media']
|
|
89
|
-
export type Themes = TamaguiConfig['themes']
|
|
90
|
-
// themes
|
|
91
|
-
export type ThemeName = keyof Themes extends `${infer Prefix}-light`
|
|
92
|
-
? Prefix | keyof Themes
|
|
93
|
-
: keyof Themes
|
|
94
|
-
export type ThemeKeys = keyof ThemeObject
|
|
95
|
-
export type ThemeKeyVariables = `$${ThemeKeys}`
|
|
96
|
-
// export type Spaces = TamaguiConfig['tokens']['spaces'][keyof TamaguiConfig['tokens']['spaces']]
|
|
97
|
-
// export type FontSizes = TamaguiConfig['tokens']['fontSizes'][keyof TamaguiConfig['tokens']['fontSizes']]
|
|
98
|
-
// export type Colors = TamaguiConfig['tokens']['colors'][keyof TamaguiConfig['tokens']['colors']]
|
|
99
|
-
|
|
100
|
-
// this is the config generated via createTamagui()
|
|
101
|
-
export type TamaguiInternalConfig<
|
|
102
|
-
A extends GenericTokens = GenericTokens,
|
|
103
|
-
B extends GenericThemes = GenericThemes,
|
|
104
|
-
C extends GenericShorthands = GenericShorthands,
|
|
105
|
-
D extends GenericMedia = GenericMedia
|
|
106
|
-
> = CreateTamaguiConfig<A, B, C, D> & {
|
|
107
|
-
Provider: (props: TamaguiProviderProps) => any
|
|
108
|
-
// with $ prefixes for fast lookups (one time cost at startup vs every render)
|
|
109
|
-
themeParsed: { [key: string]: Variable }
|
|
110
|
-
tokensParsed: CreateTokens<Variable>
|
|
111
|
-
themeConfig: any
|
|
112
|
-
getCSS: () => string
|
|
113
|
-
parsed: boolean
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// prevents const intersections from being clobbered into string, keeping the consts
|
|
117
|
-
export type UnionableString = string & {}
|
|
118
|
-
export type UnionableNumber = number & {}
|
|
119
|
-
export type PropTypes<A extends StaticComponent> = A extends React.FunctionComponent<infer Props>
|
|
120
|
-
? Props
|
|
121
|
-
: unknown
|
|
122
|
-
|
|
123
|
-
export type GenericFont = {
|
|
124
|
-
size: { [key: string | number]: number | Variable }
|
|
125
|
-
lineHeight: { [key: string | number]: number | Variable }
|
|
126
|
-
letterSpacing: { [key: string | number]: number | Variable }
|
|
127
|
-
weight: { [key: string | number]: string | Variable }
|
|
128
|
-
family: string | Variable
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// media
|
|
132
|
-
export type MediaKeys = keyof Media
|
|
133
|
-
export type MediaQueryObject = { [key: string]: string | number | string }
|
|
134
|
-
export type MediaQueryState = {
|
|
135
|
-
[key in string]: boolean
|
|
136
|
-
}
|
|
137
|
-
export type MediaQueryKey = keyof Media
|
|
138
|
-
export type MediaProps<A> = {
|
|
139
|
-
[key in `$${MediaQueryKey}`]?: A
|
|
140
|
-
}
|
|
141
|
-
export type MediaQueries = {
|
|
142
|
-
[key in MediaQueryKey]: MediaQueryObject
|
|
143
|
-
}
|
|
144
|
-
export type ConfigureMediaQueryOptions = {
|
|
145
|
-
queries?: MediaQueries
|
|
146
|
-
defaultActive?: MediaQueryKey[]
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export type TransformStyleProps = {
|
|
150
|
-
x?: number
|
|
151
|
-
y?: number
|
|
152
|
-
perspective?: number
|
|
153
|
-
scale?: number
|
|
154
|
-
scaleX?: number
|
|
155
|
-
scaleY?: number
|
|
156
|
-
skewX?: string
|
|
157
|
-
skewY?: string
|
|
158
|
-
matrix?: number[]
|
|
159
|
-
rotate?: string
|
|
160
|
-
rotateY?: string
|
|
161
|
-
rotateX?: string
|
|
162
|
-
rotateZ?: string
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// createComponent props helpers
|
|
166
|
-
|
|
167
|
-
//
|
|
168
|
-
// base props that are accepted by createComponent (additional to react-native-web)
|
|
169
|
-
//
|
|
170
|
-
type ComponentPropsBase = {
|
|
171
|
-
className?: string
|
|
172
|
-
tag?: string
|
|
173
|
-
animated?: boolean
|
|
174
|
-
onHoverIn?: (e: MouseEvent) => any
|
|
175
|
-
onHoverOut?: (e: MouseEvent) => any
|
|
176
|
-
onPress?: (e: GestureResponderEvent) => any
|
|
177
|
-
onPressIn?: (e: GestureResponderEvent) => any
|
|
178
|
-
onPressOut?: (e: GestureResponderEvent) => any
|
|
179
|
-
// WEB ONLY
|
|
180
|
-
onMouseEnter?: (e: GestureResponderEvent) => any
|
|
181
|
-
// WEB ONLY
|
|
182
|
-
onMouseLeave?: (e: GestureResponderEvent) => any
|
|
183
|
-
space?: Tokens['space'][keyof Tokens['space']] | boolean | string | number
|
|
184
|
-
pointerEvents?: string
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
type GetTokenFontKeysFor<A extends 'size' | 'weight' | 'letterSpacing' | 'family' | 'lineHeight'> =
|
|
188
|
-
keyof Tokens['font'][keyof Tokens['font']][A]
|
|
189
|
-
|
|
190
|
-
export type SpaceTokens = `$${keyof Tokens['space']}`
|
|
191
|
-
|
|
192
|
-
//
|
|
193
|
-
// adds in theme short values to relevant props
|
|
194
|
-
//
|
|
195
|
-
type ThemeValue<A> = Omit<A, string> | UnionableString | Variable
|
|
196
|
-
export type WithThemeValues<T extends object> = {
|
|
197
|
-
[K in keyof T]:
|
|
198
|
-
| ThemeValue<T[K]>
|
|
199
|
-
| (K extends ColorableKeys
|
|
200
|
-
? ThemeKeyVariables
|
|
201
|
-
: K extends SizeKeys
|
|
202
|
-
? `$${keyof Tokens['size']}`
|
|
203
|
-
: K extends FontKeys
|
|
204
|
-
? `$${keyof Tokens['font']}`
|
|
205
|
-
: K extends FontSizeKeys
|
|
206
|
-
? `$${GetTokenFontKeysFor<'size'>}`
|
|
207
|
-
: K extends SpaceKeys
|
|
208
|
-
? `$${keyof Tokens['space']}`
|
|
209
|
-
: K extends ColorKeys
|
|
210
|
-
? `$${keyof Tokens['color']}`
|
|
211
|
-
: K extends ZIndexKeys
|
|
212
|
-
? `$${keyof Tokens['zIndex']}`
|
|
213
|
-
: K extends LineHeightKeys
|
|
214
|
-
? `$${GetTokenFontKeysFor<'lineHeight'>}`
|
|
215
|
-
: K extends FontWeightKeys
|
|
216
|
-
? `$${GetTokenFontKeysFor<'weight'>}`
|
|
217
|
-
: K extends FontLetterSpacingKeys
|
|
218
|
-
? `$${GetTokenFontKeysFor<'letterSpacing'>}`
|
|
219
|
-
: {})
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
//
|
|
223
|
-
// adds in shorthand props
|
|
224
|
-
//
|
|
225
|
-
type WithShorthands<StyleProps> = {
|
|
226
|
-
[Key in keyof Shorthands]?: Shorthands[Key] extends keyof StyleProps
|
|
227
|
-
? StyleProps[Shorthands[Key]] | null
|
|
228
|
-
: {}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
//
|
|
232
|
-
// add both theme and shorthands
|
|
233
|
-
//
|
|
234
|
-
type WithThemeAndShorthands<A extends object> = WithThemeValues<A> &
|
|
235
|
-
WithShorthands<WithThemeValues<A>>
|
|
236
|
-
|
|
237
|
-
//
|
|
238
|
-
// adds theme and shorthands + pseudo styles with both
|
|
239
|
-
//
|
|
240
|
-
type WithThemeShorthandsAndPseudos<A extends object> = WithThemeAndShorthands<A> & {
|
|
241
|
-
hoverStyle?: WithThemeAndShorthands<A> | null
|
|
242
|
-
pressStyle?: WithThemeAndShorthands<A> | null
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
//
|
|
246
|
-
// adds theme, shorthands, psuedos, then all the previous to media queries
|
|
247
|
-
//
|
|
248
|
-
type WithThemeShorthandsPseudosAndMedia<A extends object> = WithThemeShorthandsAndPseudos<A> &
|
|
249
|
-
MediaProps<WithThemeShorthandsAndPseudos<A>>
|
|
250
|
-
|
|
251
|
-
//
|
|
252
|
-
// Stack
|
|
253
|
-
//
|
|
254
|
-
|
|
255
|
-
type WebOnlyStyleProps = {
|
|
256
|
-
// WEB ONLY
|
|
257
|
-
cursor?: string
|
|
258
|
-
// WEB ONLY
|
|
259
|
-
contain?: 'none' | 'strict' | 'content' | 'size' | 'layout' | 'paint' | string
|
|
260
|
-
// WEB ONLY values: inherit, inline, block, content
|
|
261
|
-
display?: 'inherit' | 'none' | 'inline' | 'block' | 'contents' | 'flex' | 'inline-flex'
|
|
262
|
-
// WEB ONLY pointerEvents can be a style prop
|
|
263
|
-
pointerEvents?: ViewProps['pointerEvents']
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
type StackStyleProps = WithThemeShorthandsPseudosAndMedia<
|
|
267
|
-
Omit<ViewStyle, 'display' | 'backfaceVisibility' | 'elevation'> &
|
|
268
|
-
TransformStyleProps &
|
|
269
|
-
WebOnlyStyleProps
|
|
270
|
-
>
|
|
271
|
-
|
|
272
|
-
export type StackProps = Omit<RNWInternalProps, 'children'> &
|
|
273
|
-
Omit<ViewProps, 'display' | 'children'> &
|
|
274
|
-
StackStyleProps &
|
|
275
|
-
ComponentPropsBase & {
|
|
276
|
-
ref?: RefObject<View | HTMLElement> | ((node: View | HTMLElement) => any)
|
|
277
|
-
children?: any | any[]
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
//
|
|
281
|
-
// Text props
|
|
282
|
-
//
|
|
283
|
-
|
|
284
|
-
// type EnhancedTextStyleProps = WithThemeValues<
|
|
285
|
-
// Omit<TextStyle, 'display' | 'backfaceVisibility'> & TransformStyleProps
|
|
286
|
-
// >
|
|
287
|
-
// export type TextStylePropsBase = EnhancedTextStyleProps
|
|
288
|
-
// export type TextStyleProps<S = TextStylePropsBase> = S & {
|
|
289
|
-
// hoverStyle?: S | null
|
|
290
|
-
// pressStyle?: S | null
|
|
291
|
-
// }
|
|
292
|
-
|
|
293
|
-
type TextStyleProps = WithThemeShorthandsPseudosAndMedia<
|
|
294
|
-
Omit<TextStyle, 'display' | 'backfaceVisibility'> & TransformStyleProps & WebOnlyStyleProps
|
|
295
|
-
>
|
|
296
|
-
|
|
297
|
-
export type TextProps = Omit<ReactTextProps, 'style'> &
|
|
298
|
-
TextStyleProps &
|
|
299
|
-
ComponentPropsBase & {
|
|
300
|
-
ellipse?: boolean
|
|
301
|
-
selectable?: boolean
|
|
302
|
-
textDecorationDistance?: number
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
//
|
|
306
|
-
// StaticComponent
|
|
307
|
-
//
|
|
308
|
-
|
|
309
|
-
export type StaticComponent<
|
|
310
|
-
Props = any,
|
|
311
|
-
VariantProps = any,
|
|
312
|
-
StaticConfParsed = StaticConfigParsed,
|
|
313
|
-
ParentVariantProps = any
|
|
314
|
-
> = React.FunctionComponent<Props> & {
|
|
315
|
-
staticConfig: StaticConfParsed
|
|
316
|
-
variantProps?: VariantProps
|
|
317
|
-
|
|
318
|
-
/*
|
|
319
|
-
* Only needed for more complex components
|
|
320
|
-
* If you create a styled frame component this is a HoC to extract
|
|
321
|
-
* styles from all parents.
|
|
322
|
-
*/
|
|
323
|
-
extractable: <X>(a: X) => X
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
export type TamaguiProviderProps = Partial<Omit<ThemeProviderProps, 'children'>> & {
|
|
327
|
-
initialWindowMetrics?: any
|
|
328
|
-
fallback?: any
|
|
329
|
-
children?: any
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
export type RNWInternalProps = {
|
|
333
|
-
accessibilityState?: {
|
|
334
|
-
busy?: boolean
|
|
335
|
-
checked?: boolean | 'mixed'
|
|
336
|
-
disabled?: boolean
|
|
337
|
-
expanded?: boolean
|
|
338
|
-
grabbed?: boolean
|
|
339
|
-
hidden?: boolean
|
|
340
|
-
invalid?: boolean
|
|
341
|
-
modal?: boolean
|
|
342
|
-
pressed?: boolean
|
|
343
|
-
readonly?: boolean
|
|
344
|
-
required?: boolean
|
|
345
|
-
selected?: boolean
|
|
346
|
-
}
|
|
347
|
-
accessibilityValue?: {
|
|
348
|
-
max?: number
|
|
349
|
-
min?: number
|
|
350
|
-
now?: number
|
|
351
|
-
text?: string
|
|
352
|
-
}
|
|
353
|
-
children?: any
|
|
354
|
-
focusable?: boolean
|
|
355
|
-
nativeID?: string
|
|
356
|
-
onBlur?: (e: any) => void
|
|
357
|
-
onClick?: (e: any) => void
|
|
358
|
-
onClickCapture?: (e: any) => void
|
|
359
|
-
onContextMenu?: (e: any) => void
|
|
360
|
-
onFocus?: (e: any) => void
|
|
361
|
-
onKeyDown?: (e: any) => void
|
|
362
|
-
onKeyUp?: (e: any) => void
|
|
363
|
-
onMoveShouldSetResponder?: (e: any) => boolean
|
|
364
|
-
onMoveShouldSetResponderCapture?: (e: any) => boolean
|
|
365
|
-
onResponderEnd?: (e: any) => void
|
|
366
|
-
onResponderGrant?: (e: any) => void
|
|
367
|
-
onResponderMove?: (e: any) => void
|
|
368
|
-
onResponderReject?: (e: any) => void
|
|
369
|
-
onResponderRelease?: (e: any) => void
|
|
370
|
-
onResponderStart?: (e: any) => void
|
|
371
|
-
onResponderTerminate?: (e: any) => void
|
|
372
|
-
onResponderTerminationRequest?: (e: any) => boolean
|
|
373
|
-
onScrollShouldSetResponder?: (e: any) => boolean
|
|
374
|
-
onScrollShouldSetResponderCapture?: (e: any) => boolean
|
|
375
|
-
onSelectionChangeShouldSetResponder?: (e: any) => boolean
|
|
376
|
-
onSelectionChangeShouldSetResponderCapture?: (e: any) => boolean
|
|
377
|
-
onStartShouldSetResponder?: (e: any) => boolean
|
|
378
|
-
onStartShouldSetResponderCapture?: (e: any) => boolean
|
|
379
|
-
pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto'
|
|
380
|
-
testID?: string
|
|
381
|
-
// unstable
|
|
382
|
-
dataSet?: Object
|
|
383
|
-
onMouseDown?: (e: any) => void
|
|
384
|
-
onMouseEnter?: (e: any) => void
|
|
385
|
-
onMouseLeave?: (e: any) => void
|
|
386
|
-
onMouseMove?: (e: any) => void
|
|
387
|
-
onMouseOver?: (e: any) => void
|
|
388
|
-
onMouseOut?: (e: any) => void
|
|
389
|
-
onMouseUp?: (e: any) => void
|
|
390
|
-
onScroll?: (e: any) => void
|
|
391
|
-
onTouchCancel?: (e: any) => void
|
|
392
|
-
onTouchCancelCapture?: (e: any) => void
|
|
393
|
-
onTouchEnd?: (e: any) => void
|
|
394
|
-
onTouchEndCapture?: (e: any) => void
|
|
395
|
-
onTouchMove?: (e: any) => void
|
|
396
|
-
onTouchMoveCapture?: (e: any) => void
|
|
397
|
-
onTouchStart?: (e: any) => void
|
|
398
|
-
onTouchStartCapture?: (e: any) => void
|
|
399
|
-
onWheel?: (e: any) => void
|
|
400
|
-
href?: string
|
|
401
|
-
hrefAttrs?: { download?: boolean; rel?: string; target?: string }
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
export type StaticConfigParsed = StaticConfig & {
|
|
405
|
-
parsed: true
|
|
406
|
-
propMapper: (
|
|
407
|
-
key: string,
|
|
408
|
-
value: any,
|
|
409
|
-
theme: ThemeObject,
|
|
410
|
-
props: any
|
|
411
|
-
) => undefined | boolean | { [key: string]: any }
|
|
412
|
-
variantsParsed?: {
|
|
413
|
-
[key: string]: {
|
|
414
|
-
[key: string]: any
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
export type StaticConfig = {
|
|
420
|
-
Component?: StaticComponent
|
|
421
|
-
|
|
422
|
-
variants?: {
|
|
423
|
-
[key: string]: {
|
|
424
|
-
[key: string]:
|
|
425
|
-
| ((a: any, b: any) => any)
|
|
426
|
-
| {
|
|
427
|
-
[key: string]: any
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/*
|
|
433
|
-
* If you need to pass context or something, prevents from ever
|
|
434
|
-
* flattening. The 'jsx' option means it will never flatten. if you
|
|
435
|
-
* pass JSX as a children (if its purely string, it will still flatten).
|
|
436
|
-
*/
|
|
437
|
-
neverFlatten?: boolean | 'jsx'
|
|
438
|
-
|
|
439
|
-
/*
|
|
440
|
-
* Determines ultimate output tag (Text vs View)
|
|
441
|
-
*/
|
|
442
|
-
isText?: boolean
|
|
443
|
-
|
|
444
|
-
/*
|
|
445
|
-
* Which style keys are allowed to be extracted.
|
|
446
|
-
*/
|
|
447
|
-
validStyles?: { [key: string]: boolean }
|
|
448
|
-
|
|
449
|
-
/*
|
|
450
|
-
* Allows for defining extra valid props to be extracted beyond
|
|
451
|
-
* the default ones.
|
|
452
|
-
*/
|
|
453
|
-
validPropsExtra?: { [key: string]: any }
|
|
454
|
-
|
|
455
|
-
/*
|
|
456
|
-
* Same as React.defaultProps, be sure to sync
|
|
457
|
-
*/
|
|
458
|
-
defaultProps?: any
|
|
459
|
-
|
|
460
|
-
/*
|
|
461
|
-
* If this prop is encountered, bail on all optimization.
|
|
462
|
-
*/
|
|
463
|
-
deoptProps?: Set<string>
|
|
464
|
-
|
|
465
|
-
/*
|
|
466
|
-
* A bit odd, only for more advanced heirarchies.
|
|
467
|
-
* Indicates that the component will set this prop so the
|
|
468
|
-
* static extraction can ensure it sets them to ={undefined}
|
|
469
|
-
* so they get overriddent. In the future, this can be smarter.
|
|
470
|
-
*/
|
|
471
|
-
ensureOverriddenProp?: { [key: string]: boolean }
|
|
472
|
-
|
|
473
|
-
/*
|
|
474
|
-
* We need to wrap children
|
|
475
|
-
*/
|
|
476
|
-
isZStack?: boolean
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
type ColorableKeys =
|
|
480
|
-
| 'color'
|
|
481
|
-
| 'backgroundColor'
|
|
482
|
-
| 'borderColor'
|
|
483
|
-
| 'borderTopColor'
|
|
484
|
-
| 'borderBottomColor'
|
|
485
|
-
| 'borderLeftColor'
|
|
486
|
-
| 'borderRightColor'
|
|
487
|
-
| 'shadowColor'
|
|
488
|
-
|
|
489
|
-
type SizeKeys = 'width' | 'height' | 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight'
|
|
490
|
-
|
|
491
|
-
type FontKeys = 'fontFamily'
|
|
492
|
-
|
|
493
|
-
type FontSizeKeys = 'fontSize'
|
|
494
|
-
|
|
495
|
-
type FontWeightKeys = 'fontWeight'
|
|
496
|
-
|
|
497
|
-
type FontLetterSpacingKeys = 'letterSpacing'
|
|
498
|
-
|
|
499
|
-
type LineHeightKeys = 'lineHeight'
|
|
500
|
-
|
|
501
|
-
type ZIndexKeys = 'zIndex'
|
|
502
|
-
|
|
503
|
-
type ColorKeys =
|
|
504
|
-
| 'color'
|
|
505
|
-
| 'backgroundColor'
|
|
506
|
-
| 'borderColor'
|
|
507
|
-
| 'borderBottomColor'
|
|
508
|
-
| 'borderTopColor'
|
|
509
|
-
| 'borderLeftColor'
|
|
510
|
-
| 'borderRightColor'
|
|
511
|
-
|
|
512
|
-
type SpaceKeys =
|
|
513
|
-
| 'padding'
|
|
514
|
-
| 'paddingHorizontal'
|
|
515
|
-
| 'paddingVertical'
|
|
516
|
-
| 'paddingLeft'
|
|
517
|
-
| 'paddingTop'
|
|
518
|
-
| 'paddingBottom'
|
|
519
|
-
| 'paddingLeft'
|
|
520
|
-
| 'paddingRight'
|
|
521
|
-
| 'paddingEnd'
|
|
522
|
-
| 'paddingStart'
|
|
523
|
-
| 'margin'
|
|
524
|
-
| 'marginHorizontal'
|
|
525
|
-
| 'marginVertical'
|
|
526
|
-
| 'marginLeft'
|
|
527
|
-
| 'marginTop'
|
|
528
|
-
| 'marginBottom'
|
|
529
|
-
| 'marginLeft'
|
|
530
|
-
| 'marginRight'
|
|
531
|
-
| 'marginEnd'
|
|
532
|
-
| 'marginStart'
|
|
533
|
-
| 'x'
|
|
534
|
-
| 'y'
|
|
535
|
-
| 'scale'
|
|
536
|
-
| 'scaleX'
|
|
537
|
-
| 'scaleY'
|
|
538
|
-
| 'borderTopEndRadius'
|
|
539
|
-
| 'borderTopLeftRadius'
|
|
540
|
-
| 'borderTopRightRadius'
|
|
541
|
-
| 'borderTopStartRadius'
|
|
542
|
-
| 'borderBottomEndRadius'
|
|
543
|
-
| 'borderBottomLeftRadius'
|
|
544
|
-
| 'borderBottomRightRadius'
|
|
545
|
-
| 'borderBottomStartRadius'
|
|
546
|
-
| 'borderBottomWidth'
|
|
547
|
-
| 'borderLeftWidth'
|
|
548
|
-
| 'borderRadius'
|
|
549
|
-
| 'borderRightWidth'
|
|
550
|
-
| 'borderTopEndRadius'
|
|
551
|
-
| 'borderTopLeftRadius'
|
|
552
|
-
| 'borderTopRightRadius'
|
|
553
|
-
| 'borderEndWidth'
|
|
554
|
-
| 'borderStartWidth'
|
|
555
|
-
| 'borderTopStartRadius'
|
|
556
|
-
| 'borderTopWidth'
|
|
557
|
-
| 'borderWidth'
|
|
558
|
-
| 'left'
|
|
559
|
-
| 'top'
|
|
560
|
-
| 'right'
|
|
561
|
-
| 'bottom'
|
|
562
|
-
| 'shadowOffset'
|
package/src/views/Animated.tsx
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
Animated,
|
|
4
|
-
PerpectiveTransform,
|
|
5
|
-
RotateTransform,
|
|
6
|
-
RotateXTransform,
|
|
7
|
-
RotateYTransform,
|
|
8
|
-
RotateZTransform,
|
|
9
|
-
ScaleTransform,
|
|
10
|
-
ScaleXTransform,
|
|
11
|
-
ScaleYTransform,
|
|
12
|
-
SkewXTransform,
|
|
13
|
-
SkewYTransform,
|
|
14
|
-
TranslateXTransform,
|
|
15
|
-
TranslateYTransform,
|
|
16
|
-
} from 'react-native'
|
|
17
|
-
|
|
18
|
-
import { useIsomorphicLayoutEffect } from '../constants/platform'
|
|
19
|
-
import { useConstant } from '../hooks/useConstant'
|
|
20
|
-
import { StackProps } from '../types'
|
|
21
|
-
import { Stack } from './Stack'
|
|
22
|
-
|
|
23
|
-
const defaultAnimation = {
|
|
24
|
-
from: {
|
|
25
|
-
opacity: 0,
|
|
26
|
-
translateY: 12,
|
|
27
|
-
},
|
|
28
|
-
to: {
|
|
29
|
-
opacity: 1,
|
|
30
|
-
translateY: 0,
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
type AnimatableProps = Partial<
|
|
35
|
-
Pick<StackProps, 'backgroundColor' | 'borderColor' | 'opacity'> &
|
|
36
|
-
PerpectiveTransform &
|
|
37
|
-
RotateTransform &
|
|
38
|
-
RotateXTransform &
|
|
39
|
-
RotateYTransform &
|
|
40
|
-
RotateZTransform &
|
|
41
|
-
ScaleTransform &
|
|
42
|
-
ScaleXTransform &
|
|
43
|
-
ScaleYTransform &
|
|
44
|
-
TranslateXTransform &
|
|
45
|
-
TranslateYTransform &
|
|
46
|
-
SkewXTransform &
|
|
47
|
-
SkewYTransform
|
|
48
|
-
>
|
|
49
|
-
|
|
50
|
-
const styleKeys = {
|
|
51
|
-
opacity: true,
|
|
52
|
-
backgroundColor: true,
|
|
53
|
-
borderColor: true,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type AnimatedStackProps = StackProps & {
|
|
57
|
-
animateState?: 'in' | 'out'
|
|
58
|
-
velocity?: number
|
|
59
|
-
animation?: {
|
|
60
|
-
from: AnimatableProps
|
|
61
|
-
to: AnimatableProps
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export const AnimatedStack = ({
|
|
66
|
-
animateState = 'in',
|
|
67
|
-
animation = defaultAnimation,
|
|
68
|
-
velocity = 6,
|
|
69
|
-
children,
|
|
70
|
-
animated,
|
|
71
|
-
...props
|
|
72
|
-
}: AnimatedStackProps) => {
|
|
73
|
-
const driver = useConstant(() => {
|
|
74
|
-
return new Animated.Value(0)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
const animatedProps = useMemo(() => {
|
|
78
|
-
if (!animated) {
|
|
79
|
-
return null
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const styleProps = {}
|
|
83
|
-
const transform: any = []
|
|
84
|
-
|
|
85
|
-
for (const key in animation.from) {
|
|
86
|
-
const fromVal = animation.from[key]
|
|
87
|
-
const toVal = animation.to[key]
|
|
88
|
-
const interpolatedVal = driver.interpolate({
|
|
89
|
-
inputRange: [0, 1],
|
|
90
|
-
outputRange: [fromVal, toVal],
|
|
91
|
-
})
|
|
92
|
-
if (styleKeys[key]) {
|
|
93
|
-
styleProps[key] = interpolatedVal
|
|
94
|
-
} else {
|
|
95
|
-
transform.push({
|
|
96
|
-
[key]: interpolatedVal,
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return { transform, ...styleProps }
|
|
101
|
-
}, [animated, animateState])
|
|
102
|
-
|
|
103
|
-
useIsomorphicLayoutEffect(() => {
|
|
104
|
-
if (!animated) {
|
|
105
|
-
return
|
|
106
|
-
}
|
|
107
|
-
Animated.spring(driver, {
|
|
108
|
-
useNativeDriver: true,
|
|
109
|
-
velocity,
|
|
110
|
-
toValue: animateState === 'in' ? 1 : 0,
|
|
111
|
-
}).start()
|
|
112
|
-
}, [animated, animateState])
|
|
113
|
-
|
|
114
|
-
const childrenMemo = useMemo(() => children, [children])
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<Stack animated={animated} {...props} {...animatedProps}>
|
|
118
|
-
{childrenMemo}
|
|
119
|
-
</Stack>
|
|
120
|
-
)
|
|
121
|
-
}
|
package/src/views/Stack.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { stackDefaultStyles } from '../constants/constants'
|
|
2
|
-
import { createComponent } from '../createComponent'
|
|
3
|
-
import { StackProps } from '../types'
|
|
4
|
-
|
|
5
|
-
export const Stack = createComponent<StackProps>({
|
|
6
|
-
defaultProps: {
|
|
7
|
-
...stackDefaultStyles,
|
|
8
|
-
flexDirection: 'column',
|
|
9
|
-
},
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
// test types
|
|
13
|
-
// export const YStack = styled(Stack, {
|
|
14
|
-
// flexDirection: 'column',
|
|
15
|
-
// })
|
|
16
|
-
// // test types
|
|
17
|
-
// const x00 = <Stack missing={0} /> // should err
|
|
18
|
-
// const x0 = <YStack missing={0} /> // should err
|
|
19
|
-
// const x1 = (props: StackProps) => <YStack {...props} />
|
|
20
|
-
// type ys = typeof YStack
|
|
21
|
-
// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown
|