@tamagui/core 1.0.1-beta.19 → 1.0.1-beta.190
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 +14 -12
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/addTheme.js +80 -0
- package/dist/cjs/addTheme.js.map +7 -0
- package/dist/cjs/{conf.js → config.js} +33 -19
- package/dist/cjs/config.js.map +7 -0
- package/dist/cjs/constants/constants.js +11 -23
- package/dist/cjs/constants/constants.js.map +2 -2
- package/dist/cjs/{helpers/nativeGestureHandler.js → constants/isDevTools.js} +8 -8
- package/dist/cjs/constants/isDevTools.js.map +7 -0
- package/dist/cjs/constants/platform.js +32 -16
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/platform.native.js +62 -0
- package/dist/cjs/constants/platform.native.js.map +7 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +1 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/cjs/contexts/FontLanguageContext.js +30 -0
- package/dist/cjs/contexts/FontLanguageContext.js.map +7 -0
- package/dist/cjs/{views → contexts}/TextAncestorContext.js +11 -13
- package/dist/cjs/contexts/TextAncestorContext.js.map +7 -0
- package/dist/cjs/{ThemeContext.js → contexts/ThemeContext.js} +1 -0
- package/dist/cjs/contexts/ThemeContext.js.map +7 -0
- package/dist/cjs/createComponent.js +925 -484
- package/dist/cjs/createComponent.js.map +3 -3
- package/dist/cjs/createFont.js +5 -8
- package/dist/cjs/createFont.js.map +2 -2
- package/dist/cjs/createShorthands.js +1 -2
- package/dist/cjs/createShorthands.js.map +1 -1
- package/dist/cjs/createTamagui.js +129 -177
- package/dist/cjs/createTamagui.js.map +3 -3
- package/dist/cjs/createTheme.js +4 -2
- package/dist/cjs/createTheme.js.map +2 -2
- package/dist/cjs/createTokens.js +5 -25
- package/dist/cjs/createTokens.js.map +2 -2
- package/dist/cjs/createVariable.js +52 -28
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariables.js +52 -0
- package/dist/cjs/createVariables.js.map +7 -0
- package/dist/cjs/helpers/RNComponents.js +12 -11
- package/dist/cjs/helpers/RNComponents.js.map +2 -2
- package/dist/cjs/{ThemeManager.js → helpers/ThemeManager.js} +54 -52
- package/dist/cjs/helpers/ThemeManager.js.map +7 -0
- package/dist/cjs/helpers/areEqualSets.js +3 -3
- package/dist/cjs/helpers/areEqualSets.js.map +1 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.js +188 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +7 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js +30 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +7 -0
- package/dist/cjs/helpers/calc.js +71 -0
- package/dist/cjs/helpers/calc.js.map +7 -0
- package/dist/cjs/helpers/createMediaStyle.js +17 -9
- package/dist/cjs/helpers/createMediaStyle.js.map +2 -2
- package/dist/cjs/helpers/createPropMapper.js +268 -120
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createShallowUpdate.js +14 -25
- package/dist/cjs/helpers/createShallowUpdate.js.map +2 -2
- package/dist/cjs/helpers/expandStyle.js +90 -0
- package/dist/cjs/helpers/expandStyle.js.map +7 -0
- package/dist/cjs/helpers/expandStyles.js +115 -0
- package/dist/cjs/helpers/expandStyles.js.map +7 -0
- package/dist/cjs/helpers/extendStaticConfig.js +49 -37
- package/dist/cjs/helpers/extendStaticConfig.js.map +2 -2
- package/dist/cjs/helpers/fixNativeShadow.js +3 -3
- package/dist/cjs/helpers/fixNativeShadow.js.map +1 -1
- package/dist/cjs/helpers/getAnimationDriver.js +32 -0
- package/dist/cjs/helpers/getAnimationDriver.js.map +7 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +4 -5
- package/dist/cjs/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/cjs/helpers/{getTextSize.js → getFont.js} +22 -12
- package/dist/cjs/helpers/getFont.js.map +7 -0
- package/dist/cjs/helpers/getFontLanguage.js +29 -0
- package/dist/cjs/helpers/getFontLanguage.js.map +7 -0
- package/dist/cjs/helpers/getSize.js +19 -10
- package/dist/cjs/helpers/getSize.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +381 -208
- package/dist/cjs/helpers/getSplitStyles.js.map +3 -3
- package/dist/cjs/helpers/getStackSize.js +46 -0
- package/dist/cjs/helpers/getStackSize.js.map +7 -0
- package/dist/cjs/helpers/getStylesAtomic.js +199 -133
- package/dist/cjs/helpers/getStylesAtomic.js.map +3 -3
- package/dist/cjs/helpers/getStylesAtomic.native.js +1 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/cjs/helpers/getThemeCSSRules.js +103 -0
- package/dist/cjs/helpers/getThemeCSSRules.js.map +7 -0
- package/dist/cjs/{nativeGestureHandler.native.js → helpers/getThemeCSSRules.native.js} +18 -5
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +7 -0
- package/dist/cjs/helpers/getVariantExtras.js +88 -0
- package/dist/cjs/helpers/getVariantExtras.js.map +7 -0
- package/dist/cjs/helpers/insertStyleRule.js +87 -52
- package/dist/cjs/helpers/insertStyleRule.js.map +3 -3
- package/dist/cjs/helpers/isObj.js +2 -2
- package/dist/cjs/helpers/isObj.js.map +1 -1
- package/dist/cjs/helpers/isTamaguiComponent.js +37 -0
- package/dist/cjs/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/cjs/helpers/isTamaguiElement.js +5 -5
- package/dist/cjs/helpers/isTamaguiElement.js.map +2 -2
- package/dist/cjs/helpers/matchMedia.js +7 -6
- package/dist/cjs/helpers/matchMedia.js.map +2 -2
- package/dist/cjs/helpers/matchMedia.native.js +6 -3
- package/dist/cjs/helpers/matchMedia.native.js.map +2 -2
- package/dist/cjs/helpers/mergeProps.js +54 -0
- package/dist/cjs/helpers/mergeProps.js.map +7 -0
- package/dist/cjs/helpers/mergeTransform.js +42 -0
- package/dist/cjs/helpers/mergeTransform.js.map +7 -0
- package/dist/cjs/helpers/normalizeColor.js +80 -0
- package/dist/cjs/helpers/normalizeColor.js.map +7 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js +93 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +7 -4
- package/dist/cjs/helpers/proxyThemeVariables.js.map +2 -2
- package/dist/cjs/helpers/pseudoDescriptors.js +42 -0
- package/dist/cjs/helpers/pseudoDescriptors.js.map +7 -0
- package/dist/cjs/helpers/registerCSSVariable.js +40 -0
- package/dist/cjs/helpers/registerCSSVariable.js.map +7 -0
- package/dist/cjs/helpers/{wrapThemeManagerContext.js → startTransition.js} +12 -15
- package/dist/cjs/helpers/startTransition.js.map +7 -0
- package/dist/cjs/helpers/themeable.js +17 -40
- package/dist/cjs/helpers/themeable.js.map +3 -3
- package/dist/cjs/helpers/themes.js +79 -0
- package/dist/cjs/helpers/themes.js.map +7 -0
- package/dist/cjs/helpers/useShallowSetState.js +44 -0
- package/dist/cjs/helpers/useShallowSetState.js.map +7 -0
- package/dist/cjs/helpers/validate.js +1 -122
- package/dist/cjs/helpers/validate.js.map +3 -3
- package/dist/cjs/helpers/withStaticProperties.js +3 -3
- package/dist/cjs/helpers/withStaticProperties.js.map +1 -1
- package/dist/cjs/hooks/getThemeUnwrapped.js +39 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +7 -0
- package/dist/cjs/hooks/useConstant.js +4 -2
- package/dist/cjs/hooks/useConstant.js.map +2 -2
- package/dist/cjs/hooks/useDidFinishSSR.js +60 -0
- package/dist/cjs/hooks/useDidFinishSSR.js.map +7 -0
- package/dist/cjs/hooks/useId.js +3 -33
- package/dist/cjs/hooks/useId.js.map +2 -2
- package/dist/cjs/hooks/useIsMounted.js +3 -4
- package/dist/cjs/hooks/useIsMounted.js.map +2 -2
- package/dist/cjs/hooks/useIsSSR.js +46 -0
- package/dist/cjs/hooks/useIsSSR.js.map +7 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +11 -9
- package/dist/cjs/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/cjs/hooks/useMedia.js +162 -113
- package/dist/cjs/hooks/useMedia.js.map +3 -3
- package/dist/cjs/hooks/usePressable.js +4 -18
- package/dist/cjs/hooks/usePressable.js.map +1 -1
- package/dist/cjs/hooks/useSafeRef.js +60 -0
- package/dist/cjs/hooks/useSafeRef.js.map +7 -0
- package/dist/cjs/hooks/useServerHooks.js +36 -0
- package/dist/cjs/hooks/useServerHooks.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +166 -132
- package/dist/cjs/hooks/useTheme.js.map +3 -3
- package/dist/cjs/hooks/useUnmountEffect.js +1 -2
- package/dist/cjs/hooks/useUnmountEffect.js.map +1 -1
- package/dist/cjs/index.js +59 -21
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/injectStyles.js +40 -0
- package/dist/cjs/injectStyles.js.map +7 -0
- package/dist/cjs/insertFont.js +93 -0
- package/dist/cjs/insertFont.js.map +7 -0
- package/dist/cjs/static.js +22 -15
- package/dist/cjs/static.js.map +2 -2
- package/dist/cjs/styled.js +47 -44
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types-rnw.js +1 -0
- package/dist/cjs/types-rnw.js.map +2 -2
- package/dist/cjs/types.js +1 -0
- package/dist/cjs/types.js.map +2 -2
- package/dist/cjs/updateTheme.js +47 -0
- package/dist/cjs/updateTheme.js.map +7 -0
- package/dist/cjs/vendor/Pressability.js +32 -0
- package/dist/cjs/vendor/Pressability.js.map +7 -0
- package/dist/cjs/vendor/Pressability.native.js +32 -0
- package/dist/cjs/vendor/Pressability.native.js.map +7 -0
- package/dist/cjs/views/FontLanguage.js +38 -0
- package/dist/cjs/views/FontLanguage.js.map +7 -0
- package/dist/cjs/views/FontLanguage.native.js +38 -0
- package/dist/cjs/views/FontLanguage.native.js.map +7 -0
- package/dist/cjs/{helpers/nativeGestureHandler.native.js → views/FontLanguage.types.js} +4 -5
- package/dist/cjs/views/FontLanguage.types.js.map +7 -0
- package/dist/cjs/views/Slot.js +63 -65
- package/dist/cjs/views/Slot.js.map +2 -2
- package/dist/cjs/views/Stack.js +4 -19
- package/dist/cjs/views/Stack.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.js +82 -0
- package/dist/cjs/views/TamaguiProvider.js.map +7 -0
- package/dist/cjs/views/Text.js +28 -29
- package/dist/cjs/views/Text.js.map +2 -2
- package/dist/cjs/views/Theme.js +43 -21
- package/dist/cjs/views/Theme.js.map +3 -3
- package/dist/cjs/views/ThemeInverse.js +25 -25
- package/dist/cjs/views/ThemeInverse.js.map +2 -2
- package/dist/cjs/views/ThemeProvider.js +35 -23
- package/dist/cjs/views/ThemeProvider.js.map +3 -3
- package/dist/cjs/views/ThemeReset.js +18 -12
- package/dist/cjs/views/ThemeReset.js.map +3 -3
- package/dist/esm/Tamagui.js +8 -11
- package/dist/esm/Tamagui.js.map +2 -2
- package/dist/esm/addTheme.js +56 -0
- package/dist/esm/addTheme.js.map +7 -0
- package/dist/esm/config.js +45 -0
- package/dist/esm/config.js.map +7 -0
- package/dist/esm/constants/constants.js +2 -2
- package/dist/esm/constants/constants.js.map +2 -2
- package/dist/esm/constants/isDevTools.js +5 -0
- package/dist/esm/constants/isDevTools.js.map +7 -0
- package/dist/esm/constants/platform.js +25 -12
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/constants/platform.native.js +28 -0
- package/dist/esm/constants/platform.native.js.map +7 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js +0 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +1 -1
- package/dist/esm/contexts/FontLanguageContext.js +6 -0
- package/dist/esm/contexts/FontLanguageContext.js.map +7 -0
- package/dist/esm/contexts/TextAncestorContext.js +17 -0
- package/dist/esm/contexts/TextAncestorContext.js.map +7 -0
- package/dist/esm/{ThemeContext.js → contexts/ThemeContext.js} +0 -0
- package/dist/esm/contexts/ThemeContext.js.map +7 -0
- package/dist/esm/createComponent.js +891 -389
- package/dist/esm/createComponent.js.map +3 -3
- package/dist/esm/createFont.js +4 -9
- package/dist/esm/createFont.js.map +2 -2
- package/dist/esm/createShorthands.js +0 -3
- package/dist/esm/createShorthands.js.map +1 -1
- package/dist/esm/createTamagui.js +128 -158
- package/dist/esm/createTamagui.js.map +3 -3
- package/dist/esm/createTheme.js +3 -3
- package/dist/esm/createTheme.js.map +2 -2
- package/dist/esm/createTokens.js +3 -24
- package/dist/esm/createTokens.js.map +2 -2
- package/dist/esm/createVariable.js +47 -26
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariables.js +28 -0
- package/dist/esm/createVariables.js.map +7 -0
- package/dist/esm/helpers/RNComponents.js +11 -8
- package/dist/esm/helpers/RNComponents.js.map +2 -2
- package/dist/esm/{ThemeManager.js → helpers/ThemeManager.js} +53 -53
- package/dist/esm/helpers/ThemeManager.js.map +7 -0
- package/dist/esm/helpers/areEqualSets.js +2 -4
- package/dist/esm/helpers/areEqualSets.js.map +1 -1
- package/dist/esm/helpers/assignNativePropsToWeb.js +164 -0
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +7 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js +6 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +7 -0
- package/dist/esm/helpers/calc.js +47 -0
- package/dist/esm/helpers/calc.js.map +7 -0
- package/dist/esm/helpers/createMediaStyle.js +16 -10
- package/dist/esm/helpers/createMediaStyle.js.map +2 -2
- package/dist/esm/helpers/createPropMapper.js +263 -121
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createShallowUpdate.js +13 -12
- package/dist/esm/helpers/createShallowUpdate.js.map +2 -2
- package/dist/esm/helpers/expandStyle.js +66 -0
- package/dist/esm/helpers/expandStyle.js.map +7 -0
- package/dist/esm/helpers/expandStyles.js +89 -0
- package/dist/esm/helpers/expandStyles.js.map +7 -0
- package/dist/esm/helpers/extendStaticConfig.js +35 -28
- package/dist/esm/helpers/extendStaticConfig.js.map +2 -2
- package/dist/esm/helpers/fixNativeShadow.js +2 -4
- package/dist/esm/helpers/fixNativeShadow.js.map +1 -1
- package/dist/esm/helpers/getAnimationDriver.js +8 -0
- package/dist/esm/helpers/getAnimationDriver.js.map +7 -0
- package/dist/esm/helpers/getExpandedShorthands.js +2 -5
- package/dist/esm/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/esm/helpers/{getTextSize.js → getFont.js} +17 -9
- package/dist/esm/helpers/getFont.js.map +7 -0
- package/dist/esm/helpers/getFontLanguage.js +5 -0
- package/dist/esm/helpers/getFontLanguage.js.map +7 -0
- package/dist/esm/helpers/getSize.js +16 -10
- package/dist/esm/helpers/getSize.js.map +2 -2
- package/dist/esm/helpers/getSplitStyles.js +364 -188
- package/dist/esm/helpers/getSplitStyles.js.map +3 -3
- package/dist/esm/helpers/getStackSize.js +22 -0
- package/dist/esm/helpers/getStackSize.js.map +7 -0
- package/dist/esm/helpers/getStylesAtomic.js +187 -108
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.native.js +0 -3
- package/dist/esm/helpers/getStylesAtomic.native.js.map +1 -1
- package/dist/esm/helpers/getThemeCSSRules.js +79 -0
- package/dist/esm/helpers/getThemeCSSRules.js.map +7 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js +7 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +7 -0
- package/dist/esm/helpers/getVariantExtras.js +63 -0
- package/dist/esm/helpers/getVariantExtras.js.map +7 -0
- package/dist/esm/helpers/insertStyleRule.js +82 -50
- package/dist/esm/helpers/insertStyleRule.js.map +3 -3
- package/dist/esm/helpers/isObj.js +1 -3
- package/dist/esm/helpers/isObj.js.map +1 -1
- package/dist/esm/helpers/isTamaguiComponent.js +13 -0
- package/dist/esm/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/esm/helpers/isTamaguiElement.js +4 -6
- package/dist/esm/helpers/isTamaguiElement.js.map +2 -2
- package/dist/esm/helpers/matchMedia.js +6 -7
- package/dist/esm/helpers/matchMedia.js.map +2 -2
- package/dist/esm/helpers/matchMedia.native.js +1 -3
- package/dist/esm/helpers/matchMedia.native.js.map +1 -1
- package/dist/esm/helpers/mergeProps.js +30 -0
- package/dist/esm/helpers/mergeProps.js.map +7 -0
- package/dist/esm/helpers/mergeTransform.js +17 -0
- package/dist/esm/helpers/mergeTransform.js.map +7 -0
- package/dist/esm/helpers/normalizeColor.js +49 -0
- package/dist/esm/helpers/normalizeColor.js.map +7 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js +69 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/esm/helpers/proxyThemeVariables.js +6 -5
- package/dist/esm/helpers/proxyThemeVariables.js.map +2 -2
- package/dist/esm/helpers/pseudoDescriptors.js +18 -0
- package/dist/esm/helpers/pseudoDescriptors.js.map +7 -0
- package/dist/esm/helpers/registerCSSVariable.js +14 -0
- package/dist/esm/helpers/registerCSSVariable.js.map +7 -0
- package/dist/esm/helpers/startTransition.js +6 -0
- package/dist/esm/helpers/startTransition.js.map +7 -0
- package/dist/esm/helpers/themeable.js +11 -9
- package/dist/esm/helpers/themeable.js.map +2 -2
- package/dist/esm/helpers/themes.js +54 -0
- package/dist/esm/helpers/themes.js.map +7 -0
- package/dist/esm/helpers/useShallowSetState.js +20 -0
- package/dist/esm/helpers/useShallowSetState.js.map +7 -0
- package/dist/esm/helpers/validate.js +0 -75
- package/dist/esm/helpers/validate.js.map +3 -3
- package/dist/esm/helpers/withStaticProperties.js +2 -4
- package/dist/esm/helpers/withStaticProperties.js.map +1 -1
- package/dist/esm/hooks/getThemeUnwrapped.js +14 -0
- package/dist/esm/hooks/getThemeUnwrapped.js.map +7 -0
- package/dist/esm/hooks/useConstant.js +4 -4
- package/dist/esm/hooks/useConstant.js.map +2 -2
- package/dist/esm/hooks/useDidFinishSSR.js +35 -0
- package/dist/esm/hooks/useDidFinishSSR.js.map +7 -0
- package/dist/esm/hooks/useId.js +1 -31
- package/dist/esm/hooks/useId.js.map +2 -2
- package/dist/esm/hooks/useIsMounted.js +1 -4
- package/dist/esm/hooks/useIsMounted.js.map +2 -2
- package/dist/esm/hooks/useIsSSR.js +22 -0
- package/dist/esm/hooks/useIsSSR.js.map +7 -0
- package/dist/esm/hooks/useIsTouchDevice.js +10 -10
- package/dist/esm/hooks/useIsTouchDevice.js.map +2 -2
- package/dist/esm/hooks/useMedia.js +157 -103
- package/dist/esm/hooks/useMedia.js.map +3 -3
- package/dist/esm/hooks/usePressable.js +2 -4
- package/dist/esm/hooks/usePressable.js.map +1 -1
- package/dist/esm/hooks/useSafeRef.js +36 -0
- package/dist/esm/hooks/useSafeRef.js.map +7 -0
- package/dist/esm/hooks/useServerHooks.js +11 -0
- package/dist/esm/hooks/useServerHooks.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +159 -109
- package/dist/esm/hooks/useTheme.js.map +3 -3
- package/dist/esm/hooks/useUnmountEffect.js +0 -3
- package/dist/esm/hooks/useUnmountEffect.js.map +1 -1
- package/dist/esm/index.js +51 -13
- 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 +67 -0
- package/dist/esm/insertFont.js.map +7 -0
- package/dist/esm/static.js +15 -15
- package/dist/esm/static.js.map +2 -2
- package/dist/esm/styled.js +40 -12
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/types-rnw.js +0 -0
- package/dist/esm/types-rnw.js.map +0 -0
- package/dist/esm/types.js +0 -0
- package/dist/esm/types.js.map +0 -0
- package/dist/esm/updateTheme.js +23 -0
- package/dist/esm/updateTheme.js.map +7 -0
- package/dist/esm/vendor/Pressability.js +7 -0
- package/dist/esm/vendor/Pressability.js.map +7 -0
- package/dist/esm/vendor/Pressability.native.js +7 -0
- package/dist/esm/vendor/Pressability.native.js.map +7 -0
- package/dist/esm/views/FontLanguage.js +14 -0
- package/dist/esm/views/FontLanguage.js.map +7 -0
- package/dist/esm/views/FontLanguage.native.js +14 -0
- package/dist/esm/views/FontLanguage.native.js.map +7 -0
- package/dist/esm/views/FontLanguage.types.js +1 -0
- package/dist/{cjs/defaultComponentState.js.map → esm/views/FontLanguage.types.js.map} +0 -0
- package/dist/esm/views/Slot.js +50 -32
- package/dist/esm/views/Slot.js.map +2 -2
- package/dist/esm/views/Stack.js +0 -0
- package/dist/esm/views/Stack.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.js +52 -0
- package/dist/esm/views/TamaguiProvider.js.map +7 -0
- package/dist/esm/views/Text.js +13 -5
- package/dist/esm/views/Text.js.map +2 -2
- package/dist/esm/views/Theme.js +35 -19
- package/dist/esm/views/Theme.js.map +3 -3
- package/dist/esm/views/ThemeInverse.js +22 -20
- package/dist/esm/views/ThemeInverse.js.map +2 -2
- package/dist/esm/views/ThemeProvider.js +28 -21
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/dist/esm/views/ThemeReset.js +13 -12
- package/dist/esm/views/ThemeReset.js.map +2 -2
- package/package.json +48 -16
- package/reset.css +25 -4
- package/src/Tamagui.ts +44 -0
- package/src/addTheme.ts +67 -0
- package/src/config.ts +45 -0
- package/src/constants/constants.ts +15 -0
- package/src/constants/isDevTools.ts +6 -0
- package/src/constants/platform.native.ts +14 -0
- package/src/constants/platform.ts +41 -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 +1599 -0
- package/src/createFont.ts +29 -0
- package/src/createShorthands.ts +5 -0
- package/src/createTamagui.ts +229 -0
- package/src/createTheme.ts +13 -0
- package/src/createTokens.ts +35 -0
- package/src/createVariable.ts +85 -0
- package/src/createVariables.ts +42 -0
- package/src/helpers/RNComponents.tsx +14 -0
- package/src/helpers/ThemeManager.tsx +235 -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 +68 -0
- package/src/helpers/createMediaStyle.ts +48 -0
- package/src/helpers/createPropMapper.ts +523 -0
- package/src/helpers/expandStyle.ts +81 -0
- package/src/helpers/expandStyles.ts +106 -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 +43 -0
- package/src/helpers/getFontLanguage.ts +2 -0
- package/src/helpers/getSize.ts +22 -0
- package/src/helpers/getSplitStyles.tsx +738 -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 +84 -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 +12 -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 +16 -0
- package/src/helpers/normalizeColor.ts +53 -0
- package/src/helpers/normalizeValueWithProperty.ts +80 -0
- package/src/helpers/proxyThemeVariables.tsx +18 -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/useShallowSetState.tsx +20 -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/useId.tsx +1 -0
- package/src/hooks/useIsMounted.ts +16 -0
- package/src/hooks/useIsTouchDevice.tsx +20 -0
- package/src/hooks/useMedia.tsx +266 -0
- package/src/hooks/usePressable.tsx +9 -0
- package/src/hooks/useSafeRef.ts +49 -0
- package/src/hooks/useServerHooks.tsx +12 -0
- package/src/hooks/useTheme.tsx +299 -0
- package/src/hooks/useUnmountEffect.ts +5 -0
- package/src/index.ts +83 -0
- package/src/injectStyles.ts +20 -0
- package/src/insertFont.ts +70 -0
- package/src/static.ts +15 -0
- package/src/styled.tsx +198 -0
- package/src/types-rnw.tsx +162 -0
- package/src/types.tsx +1307 -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 +151 -0
- package/src/views/Stack.tsx +24 -0
- package/src/views/TamaguiProvider.tsx +56 -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 +63 -0
- package/src/views/ThemeReset.tsx +43 -0
- package/types/Tamagui.d.ts +6 -8
- package/types/addTheme.d.ts +11 -0
- package/types/conf.d.ts +4 -5
- package/types/config.d.ts +47 -0
- package/types/constants/constants.d.ts +1 -1
- package/types/constants/isDevTools.d.ts +2 -0
- package/types/constants/platform.d.ts +7 -6
- package/types/constants/platform.native.d.ts +13 -0
- package/types/contexts/FontLanguageContext.d.ts +5 -0
- package/types/{views → contexts}/TextAncestorContext.d.ts +0 -0
- package/types/{ThemeContext.d.ts → contexts/ThemeContext.d.ts} +1 -1
- package/types/createComponent.d.ts +32 -15
- package/types/createComponent.server.d.ts +36 -0
- package/types/createTamagui.d.ts +2 -17
- package/types/createTheme.d.ts +1 -1
- package/types/createTokens.d.ts +5 -6
- package/types/createVariable.d.ts +24 -12
- package/types/createVariables.d.ts +10 -0
- package/types/helpers/RNComponents.d.ts +1 -1
- package/types/helpers/ThemeManager.d.ts +46 -0
- package/types/helpers/assignNativePropsToWeb.d.ts +2 -0
- package/types/helpers/assignNativePropsToWeb.native.d.ts +2 -0
- package/types/helpers/calc.d.ts +17 -0
- package/types/helpers/createMediaStyle.d.ts +2 -4
- package/types/helpers/createPropMapper.d.ts +6 -3
- package/types/helpers/createShallowUpdate.d.ts +1 -2
- package/types/helpers/cssHash.d.ts +2 -0
- package/types/helpers/expandStyle.d.ts +6 -0
- package/types/helpers/expandStyles.d.ts +26 -0
- package/types/helpers/getAnimationDriver.d.ts +6 -0
- package/types/helpers/getFont.d.ts +3 -0
- package/types/helpers/getFontLanguage.d.ts +2 -0
- package/types/helpers/getSize.d.ts +3 -2
- package/types/helpers/getSplitStyles.d.ts +16 -9
- package/types/helpers/getStackSize.d.ts +8 -0
- package/types/helpers/getStylesAtomic.d.ts +17 -22
- package/types/helpers/getThemeCSSRules.d.ts +8 -0
- package/types/helpers/getThemeCSSRules.native.d.ts +2 -0
- package/types/helpers/getVariantExtras.d.ts +5 -0
- package/types/helpers/insertStyleRule.d.ts +7 -3
- package/types/helpers/isTamaguiComponent.d.ts +5 -0
- package/types/helpers/isTamaguiElement.d.ts +5 -1
- package/types/helpers/matchMedia.d.ts +1 -1
- package/types/helpers/mergeProps.d.ts +17 -0
- package/types/helpers/mergeTransform.d.ts +7 -0
- package/types/helpers/normalizeColor.d.ts +3 -0
- package/types/helpers/normalizeValueWithProperty.d.ts +6 -0
- package/types/helpers/pseudoDescriptors.d.ts +16 -0
- package/types/helpers/registerCSSVariable.d.ts +5 -0
- package/types/helpers/startTransition.d.ts +3 -0
- package/types/helpers/themes.d.ts +4 -0
- package/types/helpers/useAnimationDriver.d.ts +1 -0
- package/types/helpers/useShallowSetState.d.ts +3 -0
- package/types/helpers/validate.d.ts +0 -3
- package/types/hooks/getThemeUnwrapped.d.ts +3 -0
- package/types/hooks/useAnimationDriver.d.ts +1 -0
- package/types/hooks/useDidFinishSSR.d.ts +3 -0
- package/types/hooks/useFeatures.d.ts +10 -5
- package/types/hooks/useId.d.ts +1 -8
- package/types/hooks/useIsSSR.d.ts +4 -0
- package/types/hooks/useMedia.d.ts +20 -6
- package/types/hooks/useSafeRef.d.ts +4 -0
- package/types/hooks/useServerContext.d.ts +2 -0
- package/types/hooks/useServerHooks.d.ts +4 -0
- package/types/hooks/useTheme.d.ts +21 -31
- package/types/index.d.ts +29 -9
- package/types/injectStyles.d.ts +7 -0
- package/types/insertFont.d.ts +9 -0
- package/types/static.d.ts +2 -15
- package/types/styled.d.ts +7 -3
- package/types/types.d.ts +277 -77
- package/types/updateTheme.d.ts +9 -0
- package/types/vendor/Pressability.d.ts +3 -0
- package/types/vendor/Pressability.native.d.ts +3 -0
- package/types/views/FontLanguage.d.ts +4 -0
- package/types/views/FontLanguage.native.d.ts +4 -0
- package/types/views/FontLanguage.types.d.ts +11 -0
- package/types/views/Slot.d.ts +1 -0
- package/types/views/TamaguiProvider.d.ts +4 -0
- package/types/views/Theme.d.ts +3 -9
- package/types/views/ThemeInverse.d.ts +4 -8
- package/types/views/ThemeProvider.d.ts +2 -1
- package/dist/cjs/ThemeContext.js.map +0 -7
- package/dist/cjs/ThemeManager.js.map +0 -7
- package/dist/cjs/conf.js.map +0 -7
- package/dist/cjs/constants/rnw.js +0 -46
- package/dist/cjs/constants/rnw.js.map +0 -7
- package/dist/cjs/defaultComponentState.js +0 -1
- package/dist/cjs/helpers/addStylesUsingClassname.js +0 -87
- package/dist/cjs/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/cjs/helpers/createTamaguiProvider.js +0 -93
- package/dist/cjs/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/cjs/helpers/fixNativeShadow.native.js +0 -53
- package/dist/cjs/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/cjs/helpers/getButtonSize.js +0 -45
- package/dist/cjs/helpers/getButtonSize.js.map +0 -7
- package/dist/cjs/helpers/getTextSize.js.map +0 -7
- package/dist/cjs/helpers/nativeGestureHandler.js.map +0 -7
- package/dist/cjs/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/cjs/helpers/wrapThemeManagerContext.js.map +0 -7
- package/dist/cjs/hooks/useFeatures.js +0 -228
- package/dist/cjs/hooks/useFeatures.js.map +0 -7
- package/dist/cjs/hooks/usePrevious.js +0 -1
- package/dist/cjs/hooks/usePrevious.js.map +0 -7
- package/dist/cjs/nativeGestureHandler.native.js.map +0 -7
- package/dist/cjs/views/TextAncestorContext.js.map +0 -7
- package/dist/esm/ThemeContext.js.map +0 -7
- package/dist/esm/ThemeManager.js.map +0 -7
- package/dist/esm/conf.js +0 -36
- package/dist/esm/conf.js.map +0 -7
- package/dist/esm/constants/rnw.js +0 -24
- package/dist/esm/constants/rnw.js.map +0 -7
- package/dist/esm/defaultComponentState.js +0 -1
- package/dist/esm/defaultComponentState.js.map +0 -7
- package/dist/esm/helpers/addStylesUsingClassname.js +0 -64
- package/dist/esm/helpers/addStylesUsingClassname.js.map +0 -7
- package/dist/esm/helpers/createTamaguiProvider.js +0 -40
- package/dist/esm/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/esm/helpers/fixNativeShadow.native.js +0 -32
- package/dist/esm/helpers/fixNativeShadow.native.js.map +0 -7
- package/dist/esm/helpers/getButtonSize.js +0 -24
- package/dist/esm/helpers/getButtonSize.js.map +0 -7
- package/dist/esm/helpers/getTextSize.js.map +0 -7
- package/dist/esm/helpers/nativeGestureHandler.js +0 -7
- package/dist/esm/helpers/nativeGestureHandler.js.map +0 -7
- package/dist/esm/helpers/nativeGestureHandler.native.js +0 -2
- package/dist/esm/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/esm/helpers/wrapThemeManagerContext.js +0 -14
- package/dist/esm/helpers/wrapThemeManagerContext.js.map +0 -7
- package/dist/esm/hooks/useFeatures.js +0 -173
- package/dist/esm/hooks/useFeatures.js.map +0 -7
- package/dist/esm/hooks/usePrevious.js +0 -1
- package/dist/esm/hooks/usePrevious.js.map +0 -7
- package/dist/esm/nativeGestureHandler.native.js +0 -2
- package/dist/esm/nativeGestureHandler.native.js.map +0 -7
- package/dist/esm/views/TextAncestorContext.js +0 -18
- package/dist/esm/views/TextAncestorContext.js.map +0 -7
- package/dist/jsx/Tamagui.js +0 -41
- package/dist/jsx/ThemeContext.js +0 -5
- package/dist/jsx/ThemeManager.js +0 -186
- package/dist/jsx/conf.js +0 -35
- package/dist/jsx/constants/constants.js +0 -17
- package/dist/jsx/constants/platform.js +0 -25
- package/dist/jsx/constants/rnw.js +0 -23
- package/dist/jsx/contexts/ButtonInsideButtonContext.js +0 -5
- package/dist/jsx/createComponent.js +0 -636
- package/dist/jsx/createFont.js +0 -27
- package/dist/jsx/createShorthands.js +0 -9
- package/dist/jsx/createTamagui.js +0 -201
- package/dist/jsx/createTheme.js +0 -6
- package/dist/jsx/createTokens.js +0 -28
- package/dist/jsx/createVariable.js +0 -48
- package/dist/jsx/defaultComponentState.js +0 -0
- package/dist/jsx/helpers/RNComponents.js +0 -11
- package/dist/jsx/helpers/addStylesUsingClassname.js +0 -63
- package/dist/jsx/helpers/areEqualSets.js +0 -15
- package/dist/jsx/helpers/createMediaStyle.js +0 -30
- package/dist/jsx/helpers/createPropMapper.js +0 -237
- package/dist/jsx/helpers/createShallowUpdate.js +0 -18
- package/dist/jsx/helpers/createTamaguiProvider.js +0 -34
- package/dist/jsx/helpers/extendStaticConfig.js +0 -61
- package/dist/jsx/helpers/fixNativeShadow.js +0 -7
- package/dist/jsx/helpers/fixNativeShadow.native.js +0 -31
- package/dist/jsx/helpers/getButtonSize.js +0 -23
- package/dist/jsx/helpers/getExpandedShorthands.js +0 -18
- package/dist/jsx/helpers/getSize.js +0 -12
- package/dist/jsx/helpers/getSplitStyles.js +0 -322
- package/dist/jsx/helpers/getStylesAtomic.js +0 -130
- package/dist/jsx/helpers/getStylesAtomic.native.js +0 -9
- package/dist/jsx/helpers/getTextSize.js +0 -33
- package/dist/jsx/helpers/insertStyleRule.js +0 -94
- package/dist/jsx/helpers/isObj.js +0 -6
- package/dist/jsx/helpers/isTamaguiElement.js +0 -10
- package/dist/jsx/helpers/matchMedia.js +0 -17
- package/dist/jsx/helpers/matchMedia.native.js +0 -8
- package/dist/jsx/helpers/nativeGestureHandler.js +0 -6
- package/dist/jsx/helpers/nativeGestureHandler.native.js +0 -1
- package/dist/jsx/helpers/proxyThemeVariables.js +0 -17
- package/dist/jsx/helpers/themeable.js +0 -24
- package/dist/jsx/helpers/validate.js +0 -75
- package/dist/jsx/helpers/withStaticProperties.js +0 -9
- package/dist/jsx/helpers/wrapThemeManagerContext.js +0 -10
- package/dist/jsx/hooks/useConstant.js +0 -14
- package/dist/jsx/hooks/useFeatures.js +0 -167
- package/dist/jsx/hooks/useId.js +0 -34
- package/dist/jsx/hooks/useIsMounted.js +0 -18
- package/dist/jsx/hooks/useIsTouchDevice.js +0 -16
- package/dist/jsx/hooks/useMedia.js +0 -158
- package/dist/jsx/hooks/usePressable.js +0 -13
- package/dist/jsx/hooks/usePrevious.js +0 -0
- package/dist/jsx/hooks/useTheme.js +0 -177
- package/dist/jsx/hooks/useUnmountEffect.js +0 -10
- package/dist/jsx/index.js +0 -54
- package/dist/jsx/nativeGestureHandler.native.js +0 -1
- package/dist/jsx/static.js +0 -16
- package/dist/jsx/styled.js +0 -47
- package/dist/jsx/types-rnw.js +0 -0
- package/dist/jsx/types.js +0 -0
- package/dist/jsx/views/Slot.js +0 -75
- package/dist/jsx/views/Stack.js +0 -12
- package/dist/jsx/views/Text.js +0 -56
- package/dist/jsx/views/TextAncestorContext.js +0 -15
- package/dist/jsx/views/Theme.js +0 -31
- package/dist/jsx/views/ThemeInverse.js +0 -27
- package/dist/jsx/views/ThemeProvider.js +0 -35
- package/dist/jsx/views/ThemeReset.js +0 -34
- package/types/Tamagui.d.ts.map +0 -1
- package/types/ThemeContext.d.ts.map +0 -1
- package/types/ThemeManager.d.ts +0 -49
- package/types/ThemeManager.d.ts.map +0 -1
- package/types/conf.d.ts.map +0 -1
- package/types/constants/constants.d.ts.map +0 -1
- package/types/constants/platform.d.ts.map +0 -1
- package/types/constants/rnw.d.ts +0 -2
- package/types/constants/rnw.d.ts.map +0 -1
- package/types/contexts/ButtonInsideButtonContext.d.ts.map +0 -1
- package/types/createComponent.d.ts.map +0 -1
- package/types/createFont.d.ts.map +0 -1
- package/types/createShorthands.d.ts.map +0 -1
- package/types/createTamagui.d.ts.map +0 -1
- package/types/createTheme.d.ts.map +0 -1
- package/types/createTokens.d.ts.map +0 -1
- package/types/createVariable.d.ts.map +0 -1
- package/types/defaultComponentState.d.ts +0 -1
- package/types/defaultComponentState.d.ts.map +0 -1
- package/types/helpers/RNComponents.d.ts.map +0 -1
- package/types/helpers/addStylesUsingClassname.d.ts +0 -3
- package/types/helpers/addStylesUsingClassname.d.ts.map +0 -1
- package/types/helpers/areEqualSets.d.ts.map +0 -1
- package/types/helpers/createMediaStyle.d.ts.map +0 -1
- package/types/helpers/createPropMapper.d.ts.map +0 -1
- package/types/helpers/createShallowUpdate.d.ts.map +0 -1
- package/types/helpers/createTamaguiProvider.d.ts +0 -7
- package/types/helpers/createTamaguiProvider.d.ts.map +0 -1
- package/types/helpers/extendStaticConfig.d.ts.map +0 -1
- package/types/helpers/fixNativeShadow.d.ts.map +0 -1
- package/types/helpers/fixNativeShadow.native.d.ts +0 -3
- package/types/helpers/fixNativeShadow.native.d.ts.map +0 -1
- package/types/helpers/getButtonSize.d.ts +0 -8
- package/types/helpers/getButtonSize.d.ts.map +0 -1
- package/types/helpers/getExpandedShorthands.d.ts.map +0 -1
- package/types/helpers/getSize.d.ts.map +0 -1
- package/types/helpers/getSplitStyles.d.ts.map +0 -1
- package/types/helpers/getStylesAtomic.d.ts.map +0 -1
- package/types/helpers/getStylesAtomic.native.d.ts.map +0 -1
- package/types/helpers/getTextSize.d.ts +0 -3
- package/types/helpers/getTextSize.d.ts.map +0 -1
- package/types/helpers/insertStyleRule.d.ts.map +0 -1
- package/types/helpers/isObj.d.ts.map +0 -1
- package/types/helpers/isTamaguiElement.d.ts.map +0 -1
- package/types/helpers/matchMedia.d.ts.map +0 -1
- package/types/helpers/matchMedia.native.d.ts.map +0 -1
- package/types/helpers/nativeGestureHandler.d.ts +0 -2
- package/types/helpers/nativeGestureHandler.d.ts.map +0 -1
- package/types/helpers/nativeGestureHandler.native.d.ts +0 -2
- package/types/helpers/nativeGestureHandler.native.d.ts.map +0 -1
- package/types/helpers/proxyThemeVariables.d.ts.map +0 -1
- package/types/helpers/themeable.d.ts.map +0 -1
- package/types/helpers/validate.d.ts.map +0 -1
- package/types/helpers/withStaticProperties.d.ts.map +0 -1
- package/types/helpers/wrapThemeManagerContext.d.ts +0 -3
- package/types/helpers/wrapThemeManagerContext.d.ts.map +0 -1
- package/types/hooks/useConstant.d.ts.map +0 -1
- package/types/hooks/useFeatures.d.ts.map +0 -1
- package/types/hooks/useId.d.ts.map +0 -1
- package/types/hooks/useIsMounted.d.ts.map +0 -1
- package/types/hooks/useIsTouchDevice.d.ts.map +0 -1
- package/types/hooks/useMedia.d.ts.map +0 -1
- package/types/hooks/usePressable.d.ts.map +0 -1
- package/types/hooks/usePrevious.d.ts +0 -1
- package/types/hooks/usePrevious.d.ts.map +0 -1
- package/types/hooks/useTheme.d.ts.map +0 -1
- package/types/hooks/useUnmountEffect.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/nativeGestureHandler.native.d.ts +0 -2
- package/types/nativeGestureHandler.native.d.ts.map +0 -1
- package/types/static.d.ts.map +0 -1
- package/types/styled.d.ts.map +0 -1
- package/types/types-rnw.d.ts.map +0 -1
- package/types/types.d.ts.map +0 -1
- package/types/views/Slot.d.ts.map +0 -1
- package/types/views/Stack.d.ts.map +0 -1
- package/types/views/Text.d.ts.map +0 -1
- package/types/views/TextAncestorContext.d.ts.map +0 -1
- package/types/views/Theme.d.ts.map +0 -1
- package/types/views/ThemeInverse.d.ts.map +0 -1
- package/types/views/ThemeProvider.d.ts.map +0 -1
- package/types/views/ThemeReset.d.ts.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/mergeTransform.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ViewStyle } from 'react-native'\n\nexport const mergeTransform = (obj: ViewStyle, key: string, val: any, backwards = false) => {\n obj.transform ||= []\n obj.transform[backwards ? 'unshift' : 'push']({ [mapTransformKeys[key] || key]: val } as any)\n}\n\nconst mapTransformKeys = {\n x: 'translateX',\n y: 'translateY',\n}\n\nexport const invertMapTransformKeys = {\n translateX: 'x',\n translateY: 'y',\n}\n"],
|
|
5
|
+
"mappings": "AAEO,MAAM,iBAAiB,CAAC,KAAgB,KAAa,KAAU,YAAY,UAAU;AAC1F,MAAI,cAAc,CAAC;AACnB,MAAI,UAAU,YAAY,YAAY,QAAQ,EAAE,CAAC,iBAAiB,QAAQ,MAAM,IAAI,CAAQ;AAC9F;AAEA,MAAM,mBAAmB;AAAA,EACvB,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,yBAAyB;AAAA,EACpC,YAAY;AAAA,EACZ,YAAY;AACd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import normalizeCSSColor from "@tamagui/normalize-css-color-lite";
|
|
2
|
+
const normalizeColor = (color, opacity) => {
|
|
3
|
+
if (color == null || color == void 0) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
if (color[0] === "$" || process.env.TAMAGUI_TARGET === "web" && typeof color === "string" && (webColors[color] || color[0] === "_" || color.startsWith("var("))) {
|
|
7
|
+
return color;
|
|
8
|
+
} else {
|
|
9
|
+
const rgba = colorToRGBA(color);
|
|
10
|
+
if (rgba != null) {
|
|
11
|
+
const [r, g, b, a] = rgba;
|
|
12
|
+
const alpha = (opacity ?? a).toFixed(2);
|
|
13
|
+
return `rgba(${r},${g},${b},${alpha})`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return color;
|
|
17
|
+
};
|
|
18
|
+
const webColors = {
|
|
19
|
+
currentColor: true,
|
|
20
|
+
currentcolor: true,
|
|
21
|
+
transparent: true,
|
|
22
|
+
inherit: true
|
|
23
|
+
};
|
|
24
|
+
function colorToRGBA(color) {
|
|
25
|
+
const colorInt = processColor(color);
|
|
26
|
+
if (colorInt != null) {
|
|
27
|
+
const r = colorInt >> 16 & 255;
|
|
28
|
+
const g = colorInt >> 8 & 255;
|
|
29
|
+
const b = colorInt & 255;
|
|
30
|
+
const a = (colorInt >> 24 & 255) / 255;
|
|
31
|
+
return [r, g, b, a];
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const processColor = (color) => {
|
|
36
|
+
if (color === void 0 || color === null) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const intColor = normalizeCSSColor(color);
|
|
40
|
+
if (intColor === void 0 || intColor === null) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return (+intColor << 24 | +intColor >>> 8) >>> 0;
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
colorToRGBA,
|
|
47
|
+
normalizeColor
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=normalizeColor.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/normalizeColor.ts"],
|
|
4
|
+
"sourcesContent": ["import normalizeCSSColor from '@tamagui/normalize-css-color-lite'\n\nexport const normalizeColor = (color?: number | string | null, opacity?: number) => {\n if (color == null || color == undefined) {\n return\n }\n if (\n color[0] === '$' ||\n (process.env.TAMAGUI_TARGET === 'web' &&\n typeof color === 'string' &&\n (webColors[color] || color[0] === '_' || color.startsWith('var(')))\n ) {\n return color\n } else {\n const rgba = colorToRGBA(color)\n if (rgba != null) {\n const [r, g, b, a] = rgba\n const alpha = (opacity ?? a).toFixed(2)\n return `rgba(${r},${g},${b},${alpha})`\n }\n }\n return color\n}\n\nconst webColors = {\n currentColor: true,\n currentcolor: true,\n transparent: true,\n inherit: true,\n}\n\nexport function colorToRGBA(color: string | number) {\n const colorInt = processColor(color)\n if (colorInt != null) {\n const r = (colorInt >> 16) & 255\n const g = (colorInt >> 8) & 255\n const b = colorInt & 255\n const a = ((colorInt >> 24) & 255) / 255\n return [r, g, b, a] as const\n }\n return null\n}\n\nconst processColor = (color?: number | string) => {\n if (color === undefined || color === null) {\n return null\n }\n const intColor = normalizeCSSColor(color)\n if (intColor === undefined || intColor === null) {\n return null\n }\n return ((+intColor << 24) | (+intColor >>> 8)) >>> 0\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,uBAAuB;AAEvB,MAAM,iBAAiB,CAAC,OAAgC,YAAqB;AAClF,MAAI,SAAS,QAAQ,SAAS,QAAW;AACvC;AAAA,EACF;AACA,MACE,MAAM,OAAO,OACZ,QAAQ,IAAI,mBAAmB,SAC9B,OAAO,UAAU,aAChB,UAAU,UAAU,MAAM,OAAO,OAAO,MAAM,WAAW,MAAM,IAClE;AACA,WAAO;AAAA,EACT,OAAO;AACL,UAAM,OAAO,YAAY,KAAK;AAC9B,QAAI,QAAQ,MAAM;AAChB,YAAM,CAAC,GAAG,GAAG,GAAG,CAAC,IAAI;AACrB,YAAM,SAAS,WAAW,GAAG,QAAQ,CAAC;AACtC,aAAO,QAAQ,KAAK,KAAK,KAAK;AAAA,IAChC;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,YAAY;AAAA,EAChB,cAAc;AAAA,EACd,cAAc;AAAA,EACd,aAAa;AAAA,EACb,SAAS;AACX;AAEO,SAAS,YAAY,OAAwB;AAClD,QAAM,WAAW,aAAa,KAAK;AACnC,MAAI,YAAY,MAAM;AACpB,UAAM,IAAK,YAAY,KAAM;AAC7B,UAAM,IAAK,YAAY,IAAK;AAC5B,UAAM,IAAI,WAAW;AACrB,UAAM,KAAM,YAAY,KAAM,OAAO;AACrC,WAAO,CAAC,GAAG,GAAG,GAAG,CAAC;AAAA,EACpB;AACA,SAAO;AACT;AAEA,MAAM,eAAe,CAAC,UAA4B;AAChD,MAAI,UAAU,UAAa,UAAU,MAAM;AACzC,WAAO;AAAA,EACT;AACA,QAAM,WAAW,kBAAkB,KAAK;AACxC,MAAI,aAAa,UAAa,aAAa,MAAM;AAC/C,WAAO;AAAA,EACT;AACA,UAAS,CAAC,YAAY,KAAO,CAAC,aAAa,OAAQ;AACrD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { normalizeColor } from "./normalizeColor";
|
|
2
|
+
const cache = {};
|
|
3
|
+
function normalizeValueWithProperty(value, property) {
|
|
4
|
+
const cached = cache[value];
|
|
5
|
+
if (cached) {
|
|
6
|
+
return cached;
|
|
7
|
+
}
|
|
8
|
+
let res = value;
|
|
9
|
+
if (process.env.TAMAGUI_TARGET === "web" && typeof value === "number" && (property === void 0 || !unitlessNumbers[property])) {
|
|
10
|
+
res = `${value}px`;
|
|
11
|
+
} else if (property && colorProps[property]) {
|
|
12
|
+
res = normalizeColor(value);
|
|
13
|
+
cache[value] = res;
|
|
14
|
+
}
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
17
|
+
const colorProps = {
|
|
18
|
+
backgroundColor: true,
|
|
19
|
+
borderColor: true,
|
|
20
|
+
borderTopColor: true,
|
|
21
|
+
borderRightColor: true,
|
|
22
|
+
borderBottomColor: true,
|
|
23
|
+
borderLeftColor: true,
|
|
24
|
+
color: true,
|
|
25
|
+
shadowColor: true,
|
|
26
|
+
textDecorationColor: true,
|
|
27
|
+
textShadowColor: true
|
|
28
|
+
};
|
|
29
|
+
const unitlessNumbers = {
|
|
30
|
+
WebkitLineClamp: true,
|
|
31
|
+
animationIterationCount: true,
|
|
32
|
+
aspectRatio: true,
|
|
33
|
+
borderImageOutset: true,
|
|
34
|
+
borderImageSlice: true,
|
|
35
|
+
borderImageWidth: true,
|
|
36
|
+
columnCount: true,
|
|
37
|
+
flex: true,
|
|
38
|
+
flexGrow: true,
|
|
39
|
+
flexOrder: true,
|
|
40
|
+
flexPositive: true,
|
|
41
|
+
flexShrink: true,
|
|
42
|
+
flexNegative: true,
|
|
43
|
+
fontWeight: true,
|
|
44
|
+
gridRow: true,
|
|
45
|
+
gridRowEnd: true,
|
|
46
|
+
gridRowGap: true,
|
|
47
|
+
gridRowStart: true,
|
|
48
|
+
gridColumn: true,
|
|
49
|
+
gridColumnEnd: true,
|
|
50
|
+
gridColumnGap: true,
|
|
51
|
+
gridColumnStart: true,
|
|
52
|
+
lineClamp: true,
|
|
53
|
+
opacity: true,
|
|
54
|
+
order: true,
|
|
55
|
+
orphans: true,
|
|
56
|
+
tabSize: true,
|
|
57
|
+
widows: true,
|
|
58
|
+
zIndex: true,
|
|
59
|
+
zoom: true,
|
|
60
|
+
scale: true,
|
|
61
|
+
scaleX: true,
|
|
62
|
+
scaleY: true,
|
|
63
|
+
scaleZ: true,
|
|
64
|
+
shadowOpacity: true
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
normalizeValueWithProperty
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=normalizeValueWithProperty.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/normalizeValueWithProperty.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Some parts adapted from react-native-web\n * Copyright (c) Nicolas Gallagher licensed under the MIT license.\n */\n\nimport { normalizeColor } from './normalizeColor'\n\nconst cache = {}\n\nexport function normalizeValueWithProperty(value: any, property?: string): any {\n const cached = cache[value]\n if (cached) {\n return cached\n }\n let res = value\n if (\n process.env.TAMAGUI_TARGET === 'web' &&\n typeof value === 'number' &&\n (property === undefined || !unitlessNumbers[property])\n ) {\n res = `${value}px`\n } else if (property && colorProps[property]) {\n res = normalizeColor(value)\n cache[value] = res\n }\n return res\n}\n\n// TODO react-native-web-lite\n\nconst colorProps = {\n backgroundColor: true,\n borderColor: true,\n borderTopColor: true,\n borderRightColor: true,\n borderBottomColor: true,\n borderLeftColor: true,\n color: true,\n shadowColor: true,\n textDecorationColor: true,\n textShadowColor: true,\n}\n\nconst unitlessNumbers = {\n WebkitLineClamp: true,\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zIndex: true,\n zoom: true,\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n shadowOpacity: true,\n}\n"],
|
|
5
|
+
"mappings": "AAKA,SAAS,sBAAsB;AAE/B,MAAM,QAAQ,CAAC;AAER,SAAS,2BAA2B,OAAY,UAAwB;AAC7E,QAAM,SAAS,MAAM;AACrB,MAAI,QAAQ;AACV,WAAO;AAAA,EACT;AACA,MAAI,MAAM;AACV,MACE,QAAQ,IAAI,mBAAmB,SAC/B,OAAO,UAAU,aAChB,aAAa,UAAa,CAAC,gBAAgB,YAC5C;AACA,UAAM,GAAG;AAAA,EACX,WAAW,YAAY,WAAW,WAAW;AAC3C,UAAM,eAAe,KAAK;AAC1B,UAAM,SAAS;AAAA,EACjB;AACA,SAAO;AACT;AAIA,MAAM,aAAa;AAAA,EACjB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,OAAO;AAAA,EACP,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,iBAAiB;AACnB;AAEA,MAAM,kBAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,yBAAyB;AAAA,EACzB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,eAAe;AACjB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
function proxyThemeVariables(obj) {
|
|
4
|
-
|
|
2
|
+
if (process.env.NODE_ENV === "development" && !obj) {
|
|
3
|
+
console.trace(`empty value for proxyThemeVariables`, obj);
|
|
4
|
+
return obj;
|
|
5
|
+
}
|
|
6
|
+
return new Proxy(obj || {}, {
|
|
5
7
|
has(target, key) {
|
|
6
8
|
return Reflect.has(target, removeStarting$(key));
|
|
7
9
|
},
|
|
@@ -10,8 +12,7 @@ function proxyThemeVariables(obj) {
|
|
|
10
12
|
}
|
|
11
13
|
});
|
|
12
14
|
}
|
|
13
|
-
|
|
14
|
-
const removeStarting$ = /* @__PURE__ */ __name((str) => typeof str === "string" && str[0] === "$" ? str.slice(1) : str, "removeStarting$");
|
|
15
|
+
const removeStarting$ = (str) => typeof str === "string" && str[0] === "$" ? str.slice(1) : str;
|
|
15
16
|
export {
|
|
16
17
|
proxyThemeVariables
|
|
17
18
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/proxyThemeVariables.tsx"],
|
|
4
|
-
"sourcesContent": ["export function proxyThemeVariables<A extends Object>(obj: A): A {\n return new Proxy<A>(obj, {\n has(target, key) {\n return Reflect.has(target, removeStarting$(key))\n },\n get(target, key) {\n return Reflect.get(target, removeStarting$(key))\n },\n })\n}\n\nconst removeStarting$ = (str: string | symbol) =>\n typeof str === 'string' && str[0] === '$' ? str.slice(1) : str\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export function proxyThemeVariables<A extends Object>(obj: A): A {\n if (process.env.NODE_ENV === 'development' && !obj) {\n // eslint-disable-next-line no-console\n console.trace(`empty value for proxyThemeVariables`, obj)\n return obj\n }\n return new Proxy<A>(obj || {}, {\n has(target, key) {\n return Reflect.has(target, removeStarting$(key))\n },\n get(target, key) {\n return Reflect.get(target, removeStarting$(key))\n },\n })\n}\n\nconst removeStarting$ = (str: string | symbol) =>\n typeof str === 'string' && str[0] === '$' ? str.slice(1) : str\n"],
|
|
5
|
+
"mappings": "AAAO,SAAS,oBAAsC,KAAW;AAC/D,MAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,KAAK;AAElD,YAAQ,MAAM,uCAAuC,GAAG;AACxD,WAAO;AAAA,EACT;AACA,SAAO,IAAI,MAAS,OAAO,CAAC,GAAG;AAAA,IAC7B,IAAI,QAAQ,KAAK;AACf,aAAO,QAAQ,IAAI,QAAQ,gBAAgB,GAAG,CAAC;AAAA,IACjD;AAAA,IACA,IAAI,QAAQ,KAAK;AACf,aAAO,QAAQ,IAAI,QAAQ,gBAAgB,GAAG,CAAC;AAAA,IACjD;AAAA,EACF,CAAC;AACH;AAEA,MAAM,kBAAkB,CAAC,QACvB,OAAO,QAAQ,YAAY,IAAI,OAAO,MAAM,IAAI,MAAM,CAAC,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const pseudoDescriptors = {
|
|
2
|
+
hoverStyle: {
|
|
3
|
+
name: "hover",
|
|
4
|
+
priority: 1
|
|
5
|
+
},
|
|
6
|
+
pressStyle: {
|
|
7
|
+
name: "active",
|
|
8
|
+
priority: 2
|
|
9
|
+
},
|
|
10
|
+
focusStyle: {
|
|
11
|
+
name: "focus",
|
|
12
|
+
priority: 3
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
pseudoDescriptors
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=pseudoDescriptors.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/pseudoDescriptors.ts"],
|
|
4
|
+
"sourcesContent": ["// *0 order matches to *1\n\nexport const pseudoDescriptors = {\n hoverStyle: {\n name: 'hover',\n priority: 1,\n },\n pressStyle: {\n name: 'active',\n priority: 2,\n },\n focusStyle: {\n name: 'focus',\n priority: 3,\n },\n} as const\n\nexport type PseudoDescriptor = typeof pseudoDescriptors[keyof typeof pseudoDescriptors]\n"],
|
|
5
|
+
"mappings": "AAEO,MAAM,oBAAoB;AAAA,EAC/B,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createCSSVariable } from "../createVariable";
|
|
2
|
+
const registerCSSVariable = (v) => {
|
|
3
|
+
tokensValueToVariable.set(v.val, v);
|
|
4
|
+
};
|
|
5
|
+
const variableToCSS = (v) => {
|
|
6
|
+
return `--${createCSSVariable(v.name, false)}:${typeof v.val === "number" ? `${v.val}px` : v.val}`;
|
|
7
|
+
};
|
|
8
|
+
const tokensValueToVariable = /* @__PURE__ */ new Map();
|
|
9
|
+
export {
|
|
10
|
+
registerCSSVariable,
|
|
11
|
+
tokensValueToVariable,
|
|
12
|
+
variableToCSS
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=registerCSSVariable.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/registerCSSVariable.ts"],
|
|
4
|
+
"sourcesContent": ["import { Variable, createCSSVariable } from '../createVariable'\n\nexport const registerCSSVariable = (v: Variable) => {\n tokensValueToVariable.set(v.val, v)\n}\n\nexport const variableToCSS = (v: Variable) => {\n return `--${createCSSVariable(v.name, false)}:${typeof v.val === 'number' ? `${v.val}px` : v.val}`\n}\n\nexport const tokensValueToVariable = new Map<any, any>()\n"],
|
|
5
|
+
"mappings": "AAAA,SAAmB,yBAAyB;AAErC,MAAM,sBAAsB,CAAC,MAAgB;AAClD,wBAAsB,IAAI,EAAE,KAAK,CAAC;AACpC;AAEO,MAAM,gBAAgB,CAAC,MAAgB;AAC5C,SAAO,KAAK,kBAAkB,EAAE,MAAM,KAAK,KAAK,OAAO,EAAE,QAAQ,WAAW,GAAG,EAAE,UAAU,EAAE;AAC/F;AAEO,MAAM,wBAAwB,oBAAI,IAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/startTransition.ts"],
|
|
4
|
+
"sourcesContent": ["import React from 'react'\n\n// backwards compat\nexport const startTransition = React.startTransition || ((cb) => cb())\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAGX,MAAM,kBAAkB,MAAM,oBAAoB,CAAC,OAAO,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
2
|
import React, { forwardRef } from "react";
|
|
4
3
|
import { Theme } from "../views/Theme";
|
|
5
4
|
import { ThemeInverse } from "../views/ThemeInverse";
|
|
6
5
|
function themeable(component, opts) {
|
|
7
|
-
const withThemeComponent = forwardRef(
|
|
6
|
+
const withThemeComponent = forwardRef(function WithTheme(props, ref) {
|
|
7
|
+
const { themeInverse, theme, ...rest } = props;
|
|
8
8
|
const element = React.createElement(component, { ...rest, ref });
|
|
9
9
|
if (themeInverse) {
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ jsx(ThemeInverse, {
|
|
11
|
+
children: element
|
|
12
|
+
});
|
|
11
13
|
}
|
|
12
14
|
if (theme || opts) {
|
|
13
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ jsx(Theme, {
|
|
14
16
|
componentName: opts == null ? void 0 : opts.componentName,
|
|
15
|
-
name: theme || null
|
|
16
|
-
|
|
17
|
+
name: theme || null,
|
|
18
|
+
children: element
|
|
19
|
+
});
|
|
17
20
|
}
|
|
18
21
|
return element;
|
|
19
|
-
}
|
|
22
|
+
});
|
|
20
23
|
const withTheme = withThemeComponent;
|
|
21
24
|
withTheme.displayName = `Themed(${(component == null ? void 0 : component.displayName) || (component == null ? void 0 : component.name) || "Anonymous"})`;
|
|
22
25
|
return withTheme;
|
|
23
26
|
}
|
|
24
|
-
__name(themeable, "themeable");
|
|
25
27
|
export {
|
|
26
28
|
themeable
|
|
27
29
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/themeable.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { forwardRef } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\nimport { ThemeInverse } from '../views/ThemeInverse'\n\nexport type ThemeableProps = {\n theme?: ThemeName | string | null\n themeInverse?: boolean\n}\n\nexport function themeable<Component extends (props: any) => any>(\n component: Component,\n opts?: { componentName?: string }\n) {\n const withThemeComponent = forwardRef(function WithTheme(\n { themeInverse, theme, ...rest }
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import React, { forwardRef } from 'react'\n\nimport { ThemeName } from '../types'\nimport { Theme } from '../views/Theme'\nimport { ThemeInverse } from '../views/ThemeInverse'\n\nexport type ThemeableProps = {\n theme?: ThemeName | string | null\n themeInverse?: boolean\n}\n\nexport function themeable<Component extends (props: any) => any>(\n component: Component,\n opts?: { componentName?: string }\n) {\n const withThemeComponent = forwardRef(function WithTheme(props: any, ref) {\n const { themeInverse, theme, ...rest } = props\n const element = React.createElement(component, { ...rest, ref } as any)\n if (themeInverse) {\n return <ThemeInverse>{element}</ThemeInverse>\n }\n if (theme || opts) {\n return (\n <Theme componentName={opts?.componentName} name={(theme as any) || null}>\n {element}\n </Theme>\n )\n }\n return element\n })\n\n const withTheme: any = withThemeComponent\n withTheme.displayName = `Themed(${\n (component as any)?.displayName || (component as any)?.name || 'Anonymous'\n })`\n\n return withTheme as Component extends (props: infer P) => infer R\n ? (\n props: Omit<P, 'theme' | 'themeInverse'> & {\n theme?: ThemeName | null\n themeInverse?: boolean\n }\n ) => R\n : unknown\n}\n"],
|
|
5
|
+
"mappings": "AAmBa;AAnBb,OAAO,SAAS,kBAAkB;AAGlC,SAAS,aAAa;AACtB,SAAS,oBAAoB;AAOtB,SAAS,UACd,WACA,MACA;AACA,QAAM,qBAAqB,WAAW,SAAS,UAAU,OAAY,KAAK;AACxE,UAAM,EAAE,cAAc,UAAU,KAAK,IAAI;AACzC,UAAM,UAAU,MAAM,cAAc,WAAW,EAAE,GAAG,MAAM,IAAI,CAAQ;AACtE,QAAI,cAAc;AAChB,aAAO,oBAAC;AAAA,QAAc;AAAA,OAAQ;AAAA,IAChC;AACA,QAAI,SAAS,MAAM;AACjB,aACE,oBAAC;AAAA,QAAM,eAAe,6BAAM;AAAA,QAAe,MAAO,SAAiB;AAAA,QAChE;AAAA,OACH;AAAA,IAEJ;AACA,WAAO;AAAA,EACT,CAAC;AAED,QAAM,YAAiB;AACvB,YAAU,cAAc,WACrB,uCAAmB,iBAAgB,uCAAmB,SAAQ;AAGjE,SAAO;AAQT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createVariable, isVariable } from "../createVariable";
|
|
2
|
+
import { GetThemeUnwrapped } from "../hooks/getThemeUnwrapped";
|
|
3
|
+
function ensureThemeVariable(theme, key) {
|
|
4
|
+
const val = theme[key];
|
|
5
|
+
const themeKey = key;
|
|
6
|
+
if (!isVariable(val)) {
|
|
7
|
+
theme[key] = createVariable({
|
|
8
|
+
key: themeKey,
|
|
9
|
+
name: themeKey,
|
|
10
|
+
val
|
|
11
|
+
});
|
|
12
|
+
} else {
|
|
13
|
+
if (val.name !== themeKey) {
|
|
14
|
+
theme[key] = createVariable({
|
|
15
|
+
key: val.name,
|
|
16
|
+
name: themeKey,
|
|
17
|
+
val: val.val
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function proxyThemeToParents(themeName, theme, themes) {
|
|
23
|
+
const cur = [];
|
|
24
|
+
const parents = themeName.split("_").slice(0, -1).map((part) => {
|
|
25
|
+
cur.push(part);
|
|
26
|
+
return cur.join("_");
|
|
27
|
+
});
|
|
28
|
+
const hasParents = parents.length;
|
|
29
|
+
return new Proxy(theme, {
|
|
30
|
+
get(target, key) {
|
|
31
|
+
if (key === GetThemeUnwrapped) {
|
|
32
|
+
return theme;
|
|
33
|
+
}
|
|
34
|
+
if (!hasParents || Reflect.has(target, key)) {
|
|
35
|
+
return Reflect.get(target, key);
|
|
36
|
+
}
|
|
37
|
+
for (let i = parents.length - 1; i >= 0; i--) {
|
|
38
|
+
const parent = themes[parents[i]];
|
|
39
|
+
if (!parent) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (Reflect.has(parent, key)) {
|
|
43
|
+
return Reflect.get(parent, key);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return Reflect.get(target, key);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
ensureThemeVariable,
|
|
52
|
+
proxyThemeToParents
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=themes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/themes.ts"],
|
|
4
|
+
"sourcesContent": ["import { createVariable, isVariable } from '../createVariable'\nimport { GetThemeUnwrapped } from '../hooks/getThemeUnwrapped'\nimport { CreateTamaguiProps } from '../types'\n\n// mutates, freeze after\n// shared by createTamagui so extracted here\nexport function ensureThemeVariable(theme: any, key: string) {\n const val = theme[key]\n const themeKey = key\n if (!isVariable(val)) {\n theme[key] = createVariable({\n key: themeKey,\n name: themeKey,\n val,\n })\n } else {\n if (val.name !== themeKey) {\n // rename to theme name\n theme[key] = createVariable({\n key: val.name,\n name: themeKey,\n val: val.val,\n })\n }\n }\n}\n\nexport function proxyThemeToParents(\n themeName: string,\n theme: any,\n themes: CreateTamaguiProps['themes']\n) {\n // we could test if this is better as just a straight object spread or fancier proxy\n const cur: string[] = []\n // if theme is dark_blue_alt1_Button\n // this will be the parent names in order: ['dark', 'dark_blue', 'dark_blue_alt1\"]\n const parents = themeName\n .split('_')\n .slice(0, -1)\n .map((part) => {\n cur.push(part)\n return cur.join('_')\n })\n\n const hasParents = parents.length\n\n // proxy fallback values to parent theme values\n return new Proxy(theme, {\n get(target, key) {\n if (key === GetThemeUnwrapped) {\n return theme\n }\n if (!hasParents || Reflect.has(target, key)) {\n return Reflect.get(target, key)\n }\n // check parents\n for (let i = parents.length - 1; i >= 0; i--) {\n const parent = themes[parents[i]]\n if (!parent) {\n continue\n }\n if (Reflect.has(parent, key)) {\n return Reflect.get(parent, key)\n }\n }\n return Reflect.get(target, key)\n },\n })\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB,kBAAkB;AAC3C,SAAS,yBAAyB;AAK3B,SAAS,oBAAoB,OAAY,KAAa;AAC3D,QAAM,MAAM,MAAM;AAClB,QAAM,WAAW;AACjB,MAAI,CAAC,WAAW,GAAG,GAAG;AACpB,UAAM,OAAO,eAAe;AAAA,MAC1B,KAAK;AAAA,MACL,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,EACH,OAAO;AACL,QAAI,IAAI,SAAS,UAAU;AAEzB,YAAM,OAAO,eAAe;AAAA,QAC1B,KAAK,IAAI;AAAA,QACT,MAAM;AAAA,QACN,KAAK,IAAI;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,SAAS,oBACd,WACA,OACA,QACA;AAEA,QAAM,MAAgB,CAAC;AAGvB,QAAM,UAAU,UACb,MAAM,GAAG,EACT,MAAM,GAAG,EAAE,EACX,IAAI,CAAC,SAAS;AACb,QAAI,KAAK,IAAI;AACb,WAAO,IAAI,KAAK,GAAG;AAAA,EACrB,CAAC;AAEH,QAAM,aAAa,QAAQ;AAG3B,SAAO,IAAI,MAAM,OAAO;AAAA,IACtB,IAAI,QAAQ,KAAK;AACf,UAAI,QAAQ,mBAAmB;AAC7B,eAAO;AAAA,MACT;AACA,UAAI,CAAC,cAAc,QAAQ,IAAI,QAAQ,GAAG,GAAG;AAC3C,eAAO,QAAQ,IAAI,QAAQ,GAAG;AAAA,MAChC;AAEA,eAAS,IAAI,QAAQ,SAAS,GAAG,KAAK,GAAG,KAAK;AAC5C,cAAM,SAAS,OAAO,QAAQ;AAC9B,YAAI,CAAC,QAAQ;AACX;AAAA,QACF;AACA,YAAI,QAAQ,IAAI,QAAQ,GAAG,GAAG;AAC5B,iBAAO,QAAQ,IAAI,QAAQ,GAAG;AAAA,QAChC;AAAA,MACF;AACA,aAAO,QAAQ,IAAI,QAAQ,GAAG;AAAA,IAChC;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
function useShallowSetState(setter) {
|
|
3
|
+
return useCallback(
|
|
4
|
+
(next) => {
|
|
5
|
+
setter((prev) => {
|
|
6
|
+
for (const key in next) {
|
|
7
|
+
if (prev[key] !== next[key]) {
|
|
8
|
+
return { ...prev, ...next };
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return prev;
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
[setter]
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
useShallowSetState
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useShallowSetState.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/helpers/useShallowSetState.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useCallback } from 'react'\n\nexport function useShallowSetState<State extends Object>(\n setter: React.Dispatch<React.SetStateAction<State>>\n) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useCallback(\n (next: Partial<State>) => {\n setter((prev) => {\n for (const key in next) {\n if (prev[key] !== next[key]) {\n return { ...prev, ...next }\n }\n }\n return prev\n })\n },\n [setter]\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAgB,mBAAmB;AAE5B,SAAS,mBACd,QACA;AAEA,SAAO;AAAA,IACL,CAAC,SAAyB;AACxB,aAAO,CAAC,SAAS;AACf,mBAAW,OAAO,MAAM;AACtB,cAAI,KAAK,SAAS,KAAK,MAAM;AAC3B,mBAAO,EAAE,GAAG,MAAM,GAAG,KAAK;AAAA,UAC5B;AAAA,QACF;AACA,eAAO;AAAA,MACT,CAAC;AAAA,IACH;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,76 +1 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const { default: ow } = require("@tamagui/ow/dev-only");
|
|
4
|
-
let Config;
|
|
5
|
-
let Tokens;
|
|
6
|
-
let FontRequired;
|
|
7
|
-
let FontOptional;
|
|
8
|
-
const validateConfig = /* @__PURE__ */ __name((conf) => {
|
|
9
|
-
if (!conf) {
|
|
10
|
-
console.warn("no conf?");
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
ow(conf, Config);
|
|
15
|
-
} catch (err) {
|
|
16
|
-
console.warn("Given config:\n", JSON.stringify(conf, null, 2), err);
|
|
17
|
-
}
|
|
18
|
-
}, "validateConfig");
|
|
19
|
-
const validateTokens = /* @__PURE__ */ __name((tokens) => {
|
|
20
|
-
try {
|
|
21
|
-
ow(tokens, Tokens);
|
|
22
|
-
} catch (err) {
|
|
23
|
-
console.warn("Given tokens:\n", JSON.stringify(tokens, null, 2), err);
|
|
24
|
-
}
|
|
25
|
-
}, "validateTokens");
|
|
26
|
-
const validateFont = /* @__PURE__ */ __name((font) => {
|
|
27
|
-
try {
|
|
28
|
-
const { style, transform, color, ...required } = font;
|
|
29
|
-
ow(required, FontRequired);
|
|
30
|
-
ow({ style, transform, color }, FontOptional);
|
|
31
|
-
} catch (err) {
|
|
32
|
-
console.warn("Given font:\n", JSON.stringify(font, null, 2), err);
|
|
33
|
-
}
|
|
34
|
-
}, "validateFont");
|
|
35
|
-
if (process.env.NODE_ENV === "development") {
|
|
36
|
-
const fontReq = {
|
|
37
|
-
family: ow.string,
|
|
38
|
-
size: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
39
|
-
lineHeight: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
40
|
-
weight: ow.object.nonEmpty.valuesOfType(ow.string),
|
|
41
|
-
letterSpacing: ow.object.nonEmpty.valuesOfType(ow.number)
|
|
42
|
-
};
|
|
43
|
-
const fontOpt = {
|
|
44
|
-
style: ow.optional.object.valuesOfType(ow.string),
|
|
45
|
-
transform: ow.optional.object.valuesOfType(ow.string),
|
|
46
|
-
color: ow.optional.object.valuesOfType(ow.string)
|
|
47
|
-
};
|
|
48
|
-
Config = ow.object.exactShape({
|
|
49
|
-
defaultTheme: ow.optional.string,
|
|
50
|
-
disableRootThemeClass: ow.optional.boolean,
|
|
51
|
-
shorthands: ow.optional.object.valuesOfType(ow.string),
|
|
52
|
-
themes: ow.object.valuesOfType(ow.object),
|
|
53
|
-
tokens: ow.object.valuesOfType(ow.object),
|
|
54
|
-
media: ow.object.valuesOfType(ow.object),
|
|
55
|
-
animations: ow.object.valuesOfType(ow.object),
|
|
56
|
-
fonts: ow.object.valuesOfType(ow.object.partialShape({
|
|
57
|
-
...fontReq,
|
|
58
|
-
...fontOpt
|
|
59
|
-
}))
|
|
60
|
-
});
|
|
61
|
-
FontRequired = ow.object.exactShape(fontReq);
|
|
62
|
-
FontOptional = ow.object.partialShape(fontOpt);
|
|
63
|
-
Tokens = ow.object.exactShape({
|
|
64
|
-
size: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
65
|
-
space: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
66
|
-
zIndex: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
67
|
-
radius: ow.object.nonEmpty.valuesOfType(ow.number),
|
|
68
|
-
color: ow.object.nonEmpty.valuesOfType(ow.string)
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
export {
|
|
72
|
-
validateConfig,
|
|
73
|
-
validateFont,
|
|
74
|
-
validateTokens
|
|
75
|
-
};
|
|
76
1
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const withStaticProperties = /* @__PURE__ */ __name(function(component, staticProps) {
|
|
1
|
+
const withStaticProperties = function(component, staticProps) {
|
|
4
2
|
Object.assign(component, staticProps);
|
|
5
3
|
return component;
|
|
6
|
-
}
|
|
4
|
+
};
|
|
7
5
|
export {
|
|
8
6
|
withStaticProperties
|
|
9
7
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/withStaticProperties.tsx"],
|
|
4
4
|
"sourcesContent": ["export const withStaticProperties = function <A extends Function, B>(\n component: A,\n staticProps: B\n): A & B {\n Object.assign(component, staticProps)\n return component as any\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "AAAO,MAAM,uBAAuB,SAClC,WACA,aACO;AACP,SAAO,OAAO,WAAW,WAAW;AACpC,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const getThemeUnwrapped = (theme) => {
|
|
2
|
+
if (!theme)
|
|
3
|
+
return null;
|
|
4
|
+
const first = theme[GetThemeUnwrapped];
|
|
5
|
+
if (first)
|
|
6
|
+
return first[GetThemeUnwrapped] || first;
|
|
7
|
+
return theme;
|
|
8
|
+
};
|
|
9
|
+
const GetThemeUnwrapped = Symbol();
|
|
10
|
+
export {
|
|
11
|
+
GetThemeUnwrapped,
|
|
12
|
+
getThemeUnwrapped
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=getThemeUnwrapped.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/getThemeUnwrapped.tsx"],
|
|
4
|
+
"sourcesContent": ["export const getThemeUnwrapped = (theme: any) => {\n if (!theme) return null\n const first = theme[GetThemeUnwrapped]\n if (first) return first[GetThemeUnwrapped] || first\n return theme\n}\n\nexport const GetThemeUnwrapped = Symbol()\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,oBAAoB,CAAC,UAAe;AAC/C,MAAI,CAAC;AAAO,WAAO;AACnB,QAAM,QAAQ,MAAM;AACpB,MAAI;AAAO,WAAO,MAAM,sBAAsB;AAC9C,SAAO;AACT;AAEO,MAAM,oBAAoB,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
import { useRef } from "react";
|
|
1
|
+
import { useMemo, useRef } from "react";
|
|
4
2
|
function useConstant(fn) {
|
|
3
|
+
if (typeof document === "undefined") {
|
|
4
|
+
return useMemo(() => fn(), []);
|
|
5
|
+
}
|
|
5
6
|
const ref = useRef();
|
|
6
7
|
if (!ref.current) {
|
|
7
8
|
ref.current = { v: fn() };
|
|
8
9
|
}
|
|
9
10
|
return ref.current.v;
|
|
10
11
|
}
|
|
11
|
-
__name(useConstant, "useConstant");
|
|
12
12
|
export {
|
|
13
13
|
useConstant
|
|
14
14
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useConstant.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useRef } from 'react'\n\ntype ResultBox<T> = { v: T }\nexport function useConstant<T>(fn: () => T): T {\n const ref = useRef<ResultBox<T>>()\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n return ref.current.v\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { useMemo, useRef } from 'react'\n\ntype ResultBox<T> = { v: T }\n\nexport function useConstant<T>(fn: () => T): T {\n // RSC compat\n if (typeof document === 'undefined') {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => fn(), [])\n }\n\n const ref = useRef<ResultBox<T>>()\n\n if (!ref.current) {\n ref.current = { v: fn() }\n }\n\n return ref.current.v\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS,cAAc;AAIzB,SAAS,YAAe,IAAgB;AAE7C,MAAI,OAAO,aAAa,aAAa;AAEnC,WAAO,QAAQ,MAAM,GAAG,GAAG,CAAC,CAAC;AAAA,EAC/B;AAEA,QAAM,MAAM,OAAqB;AAEjC,MAAI,CAAC,IAAI,SAAS;AAChB,QAAI,UAAU,EAAE,GAAG,GAAG,EAAE;AAAA,EAC1B;AAEA,SAAO,IAAI,QAAQ;AACrB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isRSC, isServer } from "@tamagui/constants";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
let finished = false;
|
|
4
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
5
|
+
function useSetupHasSSRRendered() {
|
|
6
|
+
if (isServer || isRSC) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
finished = true;
|
|
11
|
+
listeners.forEach((cb) => cb());
|
|
12
|
+
listeners.clear();
|
|
13
|
+
}, []);
|
|
14
|
+
}
|
|
15
|
+
function useDidFinishSSR() {
|
|
16
|
+
if (isServer || isRSC) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const [did, setDid] = useState(finished);
|
|
20
|
+
if (!finished) {
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const done = () => setDid(true);
|
|
23
|
+
listeners.add(done);
|
|
24
|
+
return () => {
|
|
25
|
+
listeners.delete(done);
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
}
|
|
29
|
+
return did;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
useDidFinishSSR,
|
|
33
|
+
useSetupHasSSRRendered
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=useDidFinishSSR.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useDidFinishSSR.tsx"],
|
|
4
|
+
"sourcesContent": ["import { isRSC, isServer } from '@tamagui/constants'\nimport { useEffect, useState } from 'react'\n\nlet finished = false\nconst listeners = new Set<Function>()\n\nexport function useSetupHasSSRRendered() {\n if (isServer || isRSC) {\n return\n }\n\n useEffect(() => {\n finished = true\n listeners.forEach((cb) => cb())\n listeners.clear()\n }, [])\n}\n\nexport function useDidFinishSSR() {\n if (isServer || isRSC) {\n return false\n }\n\n const [did, setDid] = useState(finished)\n\n // conditional hook because it never changes if already true\n if (!finished) {\n useEffect(() => {\n const done = () => setDid(true)\n listeners.add(done)\n return () => {\n listeners.delete(done)\n }\n }, [])\n }\n\n return did\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,OAAO,gBAAgB;AAChC,SAAS,WAAW,gBAAgB;AAEpC,IAAI,WAAW;AACf,MAAM,YAAY,oBAAI,IAAc;AAE7B,SAAS,yBAAyB;AACvC,MAAI,YAAY,OAAO;AACrB;AAAA,EACF;AAEA,YAAU,MAAM;AACd,eAAW;AACX,cAAU,QAAQ,CAAC,OAAO,GAAG,CAAC;AAC9B,cAAU,MAAM;AAAA,EAClB,GAAG,CAAC,CAAC;AACP;AAEO,SAAS,kBAAkB;AAChC,MAAI,YAAY,OAAO;AACrB,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,QAAQ;AAGvC,MAAI,CAAC,UAAU;AACb,cAAU,MAAM;AACd,YAAM,OAAO,MAAM,OAAO,IAAI;AAC9B,gBAAU,IAAI,IAAI;AAClB,aAAO,MAAM;AACX,kBAAU,OAAO,IAAI;AAAA,MACvB;AAAA,IACF,GAAG,CAAC,CAAC;AAAA,EACP;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|