@tamagui/core 1.0.1-beta.140 → 1.0.1-beta.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Tamagui.js +2 -2
- package/dist/cjs/Tamagui.js.map +2 -2
- package/dist/cjs/addTheme.js +28 -22
- package/dist/cjs/addTheme.js.map +2 -2
- package/dist/cjs/conf.js +0 -0
- package/dist/cjs/conf.js.map +0 -0
- package/dist/cjs/config.js +75 -0
- package/dist/cjs/config.js.map +7 -0
- package/dist/cjs/constants/constants.js +0 -0
- package/dist/cjs/constants/constants.js.map +0 -0
- package/dist/cjs/constants/platform.js +7 -1
- package/dist/cjs/constants/platform.js.map +2 -2
- package/dist/cjs/constants/platform.native.js +62 -0
- package/dist/cjs/constants/platform.native.js.map +7 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js +0 -0
- package/dist/cjs/contexts/ButtonInsideButtonContext.js.map +0 -0
- package/dist/cjs/contexts/FontLanguageContext.js +0 -0
- package/dist/cjs/contexts/FontLanguageContext.js.map +0 -0
- package/dist/cjs/contexts/TextAncestorContext.js +0 -0
- package/dist/cjs/contexts/TextAncestorContext.js.map +0 -0
- package/dist/cjs/contexts/ThemeContext.js +0 -0
- package/dist/cjs/contexts/ThemeContext.js.map +0 -0
- package/dist/cjs/createComponent.js +77 -71
- package/dist/cjs/createComponent.js.map +2 -2
- package/dist/cjs/createComponent.server.js +431 -0
- package/dist/cjs/createComponent.server.js.map +7 -0
- package/dist/cjs/createFont.js +0 -0
- package/dist/cjs/createFont.js.map +0 -0
- package/dist/cjs/createShorthands.js +0 -0
- package/dist/cjs/createShorthands.js.map +0 -0
- package/dist/cjs/createTamagui.js +31 -32
- package/dist/cjs/createTamagui.js.map +2 -2
- package/dist/cjs/createTheme.js +0 -0
- package/dist/cjs/createTheme.js.map +0 -0
- package/dist/cjs/createTokens.js +0 -0
- package/dist/cjs/createTokens.js.map +0 -0
- package/dist/cjs/createVariable.js +21 -35
- package/dist/cjs/createVariable.js.map +2 -2
- package/dist/cjs/createVariables.js +5 -2
- package/dist/cjs/createVariables.js.map +2 -2
- package/dist/cjs/helpers/RNComponents.js +11 -11
- package/dist/cjs/helpers/RNComponents.js.map +2 -2
- package/dist/cjs/helpers/ThemeManager.js +7 -9
- package/dist/cjs/helpers/ThemeManager.js.map +2 -2
- package/dist/cjs/helpers/areEqualSets.js +0 -0
- package/dist/cjs/helpers/areEqualSets.js.map +0 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.js +0 -1
- package/dist/cjs/helpers/assignNativePropsToWeb.js.map +2 -2
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js +0 -0
- package/dist/cjs/helpers/assignNativePropsToWeb.native.js.map +0 -0
- package/dist/cjs/helpers/calc.js +0 -0
- package/dist/cjs/helpers/calc.js.map +0 -0
- package/dist/cjs/helpers/createMediaStyle.js +0 -0
- package/dist/cjs/helpers/createMediaStyle.js.map +0 -0
- package/dist/cjs/helpers/createPropMapper.js +3 -3
- package/dist/cjs/helpers/createPropMapper.js.map +2 -2
- package/dist/cjs/helpers/createShallowUpdate.js +0 -0
- package/dist/cjs/helpers/createShallowUpdate.js.map +0 -0
- package/dist/cjs/helpers/cssHash.js +0 -0
- package/dist/cjs/helpers/cssHash.js.map +0 -0
- package/dist/cjs/helpers/expandStyle.js +0 -0
- package/dist/cjs/helpers/expandStyle.js.map +0 -0
- package/dist/cjs/helpers/expandStyles.js +4 -4
- package/dist/cjs/helpers/expandStyles.js.map +2 -2
- package/dist/cjs/helpers/extendStaticConfig.js +0 -0
- package/dist/cjs/helpers/extendStaticConfig.js.map +0 -0
- package/dist/cjs/helpers/fixNativeShadow.js +0 -0
- package/dist/cjs/helpers/fixNativeShadow.js.map +0 -0
- package/dist/cjs/{Pressability.js → helpers/getAnimationDriver.js} +10 -10
- package/dist/cjs/helpers/getAnimationDriver.js.map +7 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +3 -3
- package/dist/cjs/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/cjs/helpers/getFont.js +1 -1
- package/dist/cjs/helpers/getFont.js.map +2 -2
- package/dist/cjs/helpers/getFontLanguage.js +0 -0
- package/dist/cjs/helpers/getFontLanguage.js.map +0 -0
- package/dist/cjs/helpers/getSize.js +2 -2
- package/dist/cjs/helpers/getSize.js.map +2 -2
- package/dist/cjs/helpers/getSplitStyles.js +12 -13
- package/dist/cjs/helpers/getSplitStyles.js.map +2 -2
- package/dist/cjs/helpers/getStackSize.js +0 -0
- package/dist/cjs/helpers/getStackSize.js.map +0 -0
- package/dist/cjs/helpers/getStylesAtomic.js +6 -4
- package/dist/cjs/helpers/getStylesAtomic.js.map +2 -2
- package/dist/cjs/helpers/getStylesAtomic.native.js +0 -0
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +0 -0
- package/dist/cjs/helpers/getThemeCSSRules.js +0 -0
- package/dist/cjs/helpers/getThemeCSSRules.js.map +0 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js +0 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +0 -0
- package/dist/cjs/helpers/getVariantExtras.js +2 -2
- package/dist/cjs/helpers/getVariantExtras.js.map +2 -2
- package/dist/cjs/helpers/insertStyleRule.js +0 -0
- package/dist/cjs/helpers/insertStyleRule.js.map +0 -0
- package/dist/cjs/helpers/isObj.js +0 -0
- package/dist/cjs/helpers/isObj.js.map +0 -0
- package/dist/cjs/helpers/isTamaguiComponent.js +0 -0
- package/dist/cjs/helpers/isTamaguiComponent.js.map +0 -0
- package/dist/cjs/helpers/isTamaguiElement.js +0 -0
- package/dist/cjs/helpers/isTamaguiElement.js.map +0 -0
- package/dist/cjs/helpers/matchMedia.js +0 -0
- package/dist/cjs/helpers/matchMedia.js.map +0 -0
- package/dist/cjs/helpers/matchMedia.native.js +0 -0
- package/dist/cjs/helpers/matchMedia.native.js.map +0 -0
- package/dist/cjs/helpers/mergeProps.js +0 -0
- package/dist/cjs/helpers/mergeProps.js.map +0 -0
- package/dist/cjs/helpers/mergeTransform.js +0 -0
- package/dist/cjs/helpers/mergeTransform.js.map +0 -0
- package/dist/cjs/helpers/normalizeColor.js +2 -2
- package/dist/cjs/helpers/normalizeColor.js.map +2 -2
- package/dist/cjs/helpers/normalizeValueWithProperty.js +0 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/cjs/helpers/proxyThemeVariables.js +0 -0
- package/dist/cjs/helpers/proxyThemeVariables.js.map +0 -0
- package/dist/cjs/helpers/pseudoDescriptors.js +0 -0
- package/dist/cjs/helpers/pseudoDescriptors.js.map +0 -0
- package/dist/cjs/helpers/registerCSSVariable.js +0 -0
- package/dist/cjs/helpers/registerCSSVariable.js.map +2 -2
- package/dist/cjs/helpers/startTransition.js +0 -0
- package/dist/cjs/helpers/startTransition.js.map +0 -0
- package/dist/cjs/helpers/themeable.js +0 -0
- package/dist/cjs/helpers/themeable.js.map +0 -0
- package/dist/cjs/helpers/themes.js +0 -0
- package/dist/cjs/helpers/themes.js.map +0 -0
- package/dist/cjs/helpers/useAnimationDriver.js +2 -0
- package/dist/cjs/{defaultComponentState.js.map → helpers/useAnimationDriver.js.map} +0 -0
- package/dist/cjs/helpers/validate.js +0 -0
- package/dist/cjs/helpers/validate.js.map +0 -0
- package/dist/cjs/helpers/withStaticProperties.js +0 -0
- package/dist/cjs/helpers/withStaticProperties.js.map +0 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js +2 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/cjs/hooks/useAnimationDriver.js +2 -0
- package/dist/{esm/defaultComponentState.js.map → cjs/hooks/useAnimationDriver.js.map} +0 -0
- package/dist/cjs/hooks/useConstant.js +3 -0
- package/dist/cjs/hooks/useConstant.js.map +2 -2
- package/dist/cjs/hooks/useFeatures.js +10 -2
- package/dist/cjs/hooks/useFeatures.js.map +2 -2
- package/dist/cjs/hooks/useId.js +0 -0
- package/dist/cjs/hooks/useId.js.map +0 -0
- package/dist/cjs/hooks/useIsMounted.js +0 -0
- package/dist/cjs/hooks/useIsMounted.js.map +0 -0
- package/dist/cjs/hooks/useIsSSR.js +2 -2
- package/dist/cjs/hooks/useIsSSR.js.map +2 -2
- package/dist/cjs/hooks/useIsTouchDevice.js +0 -0
- package/dist/cjs/hooks/useIsTouchDevice.js.map +0 -0
- package/dist/cjs/hooks/useMedia.js +0 -0
- package/dist/cjs/hooks/useMedia.js.map +0 -0
- package/dist/cjs/hooks/usePressable.js +0 -0
- package/dist/cjs/hooks/usePressable.js.map +0 -0
- package/dist/cjs/hooks/useSafeRef.js +0 -0
- package/dist/cjs/hooks/useSafeRef.js.map +0 -0
- package/dist/cjs/{helpers/nativeGestureHandler.native.js → hooks/useServerContext.js} +8 -6
- package/dist/cjs/hooks/useServerContext.js.map +7 -0
- package/dist/cjs/{ThemeContext.js → hooks/useServerHooks.js} +13 -7
- package/dist/cjs/hooks/useServerHooks.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +72 -44
- package/dist/cjs/hooks/useTheme.js.map +2 -2
- package/dist/cjs/hooks/useUnmountEffect.js +0 -0
- package/dist/cjs/hooks/useUnmountEffect.js.map +0 -0
- package/dist/cjs/index.js +8 -6
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/{Pressability.native.js → injectStyles.js} +18 -10
- package/dist/cjs/injectStyles.js.map +7 -0
- package/dist/cjs/insertFont.js +2 -2
- package/dist/cjs/insertFont.js.map +2 -2
- package/dist/cjs/static.js +0 -0
- package/dist/cjs/static.js.map +0 -0
- package/dist/cjs/styled.js +11 -1
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/types-rnw.js +0 -0
- package/dist/cjs/types-rnw.js.map +0 -0
- package/dist/cjs/types.js +0 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/updateTheme.js +0 -0
- package/dist/cjs/updateTheme.js.map +0 -0
- package/dist/cjs/vendor/Pressability.js +0 -0
- package/dist/cjs/vendor/Pressability.js.map +0 -0
- package/dist/cjs/vendor/Pressability.native.js +0 -0
- package/dist/cjs/vendor/Pressability.native.js.map +0 -0
- package/dist/cjs/views/FontLanguage.js +0 -0
- package/dist/cjs/views/FontLanguage.js.map +0 -0
- package/dist/cjs/views/FontLanguage.native.js +0 -0
- package/dist/cjs/views/FontLanguage.native.js.map +0 -0
- package/dist/cjs/views/FontLanguage.types.js +0 -0
- package/dist/cjs/views/FontLanguage.types.js.map +0 -0
- package/dist/cjs/views/Slot.js +0 -0
- package/dist/cjs/views/Slot.js.map +0 -0
- package/dist/cjs/views/Stack.js +0 -0
- package/dist/cjs/views/Stack.js.map +0 -0
- package/dist/cjs/{helpers/createTamaguiProvider.js → views/TamaguiProvider.js} +41 -37
- package/dist/cjs/views/TamaguiProvider.js.map +7 -0
- package/dist/cjs/views/Text.js +0 -0
- package/dist/cjs/views/Text.js.map +0 -0
- package/dist/cjs/views/Theme.js +4 -3
- package/dist/cjs/views/Theme.js.map +2 -2
- package/dist/cjs/views/ThemeInverse.js +0 -0
- package/dist/cjs/views/ThemeInverse.js.map +0 -0
- package/dist/cjs/views/ThemeProvider.js +10 -6
- package/dist/cjs/views/ThemeProvider.js.map +2 -2
- package/dist/cjs/views/ThemeReset.js +0 -0
- package/dist/cjs/views/ThemeReset.js.map +0 -0
- package/dist/esm/Tamagui.js +1 -1
- package/dist/esm/Tamagui.js.map +1 -1
- package/dist/esm/addTheme.js +27 -21
- package/dist/esm/addTheme.js.map +2 -2
- package/dist/esm/conf.js +0 -0
- package/dist/esm/conf.js.map +0 -0
- package/dist/esm/config.js +43 -0
- package/dist/esm/config.js.map +7 -0
- package/dist/esm/constants/constants.js +0 -0
- package/dist/esm/constants/constants.js.map +0 -0
- package/dist/esm/constants/platform.js +5 -1
- package/dist/esm/constants/platform.js.map +2 -2
- package/dist/esm/constants/platform.native.js +28 -0
- package/dist/esm/constants/platform.native.js.map +7 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js +0 -0
- package/dist/esm/contexts/ButtonInsideButtonContext.js.map +0 -0
- package/dist/esm/contexts/FontLanguageContext.js +0 -0
- package/dist/esm/contexts/FontLanguageContext.js.map +0 -0
- package/dist/esm/contexts/TextAncestorContext.js +0 -0
- package/dist/esm/contexts/TextAncestorContext.js.map +0 -0
- package/dist/esm/contexts/ThemeContext.js +0 -0
- package/dist/esm/contexts/ThemeContext.js.map +0 -0
- package/dist/esm/createComponent.js +77 -73
- package/dist/esm/createComponent.js.map +2 -2
- package/dist/esm/createComponent.server.js +408 -0
- package/dist/esm/createComponent.server.js.map +7 -0
- package/dist/esm/createFont.js +0 -0
- package/dist/esm/createFont.js.map +0 -0
- package/dist/esm/createShorthands.js +0 -0
- package/dist/esm/createShorthands.js.map +0 -0
- package/dist/esm/createTamagui.js +30 -31
- package/dist/esm/createTamagui.js.map +2 -2
- package/dist/esm/createTheme.js +0 -0
- package/dist/esm/createTheme.js.map +0 -0
- package/dist/esm/createTokens.js +0 -0
- package/dist/esm/createTokens.js.map +0 -0
- package/dist/esm/createVariable.js +19 -33
- package/dist/esm/createVariable.js.map +2 -2
- package/dist/esm/createVariables.js +5 -2
- package/dist/esm/createVariables.js.map +2 -2
- package/dist/esm/helpers/RNComponents.js +11 -8
- package/dist/esm/helpers/RNComponents.js.map +2 -2
- package/dist/esm/helpers/ThemeManager.js +6 -8
- package/dist/esm/helpers/ThemeManager.js.map +2 -2
- package/dist/esm/helpers/areEqualSets.js +0 -0
- package/dist/esm/helpers/areEqualSets.js.map +0 -0
- package/dist/esm/helpers/assignNativePropsToWeb.js +0 -1
- package/dist/esm/helpers/assignNativePropsToWeb.js.map +2 -2
- package/dist/esm/helpers/assignNativePropsToWeb.native.js +0 -0
- package/dist/esm/helpers/assignNativePropsToWeb.native.js.map +0 -0
- package/dist/esm/helpers/calc.js +0 -0
- package/dist/esm/helpers/calc.js.map +0 -0
- package/dist/esm/helpers/createMediaStyle.js +0 -0
- package/dist/esm/helpers/createMediaStyle.js.map +0 -0
- package/dist/esm/helpers/createPropMapper.js +2 -2
- package/dist/esm/helpers/createPropMapper.js.map +2 -2
- package/dist/esm/helpers/createShallowUpdate.js +0 -0
- package/dist/esm/helpers/createShallowUpdate.js.map +0 -0
- package/dist/esm/helpers/cssHash.js +0 -0
- package/dist/esm/helpers/cssHash.js.map +0 -0
- package/dist/esm/helpers/expandStyle.js +0 -0
- package/dist/esm/helpers/expandStyle.js.map +0 -0
- package/dist/esm/helpers/expandStyles.js +3 -3
- package/dist/esm/helpers/expandStyles.js.map +2 -2
- package/dist/esm/helpers/extendStaticConfig.js +0 -0
- package/dist/esm/helpers/extendStaticConfig.js.map +0 -0
- package/dist/esm/helpers/fixNativeShadow.js +0 -0
- package/dist/esm/helpers/fixNativeShadow.js.map +0 -0
- package/dist/esm/helpers/getAnimationDriver.js +8 -0
- package/dist/esm/helpers/getAnimationDriver.js.map +7 -0
- package/dist/esm/helpers/getExpandedShorthands.js +2 -2
- package/dist/esm/helpers/getExpandedShorthands.js.map +2 -2
- package/dist/esm/helpers/getFont.js +1 -1
- package/dist/esm/helpers/getFont.js.map +2 -2
- package/dist/esm/helpers/getFontLanguage.js +0 -0
- package/dist/esm/helpers/getFontLanguage.js.map +0 -0
- package/dist/esm/helpers/getSize.js +1 -1
- package/dist/esm/helpers/getSize.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.js +12 -13
- package/dist/esm/helpers/getSplitStyles.js.map +2 -2
- package/dist/esm/helpers/getStackSize.js +0 -0
- package/dist/esm/helpers/getStackSize.js.map +0 -0
- package/dist/esm/helpers/getStylesAtomic.js +5 -3
- package/dist/esm/helpers/getStylesAtomic.js.map +2 -2
- package/dist/esm/helpers/getStylesAtomic.native.js +0 -0
- package/dist/esm/helpers/getStylesAtomic.native.js.map +0 -0
- package/dist/esm/helpers/getThemeCSSRules.js +0 -0
- package/dist/esm/helpers/getThemeCSSRules.js.map +0 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js +0 -0
- package/dist/esm/helpers/getThemeCSSRules.native.js.map +0 -0
- package/dist/esm/helpers/getVariantExtras.js +1 -1
- package/dist/esm/helpers/getVariantExtras.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.js +0 -0
- package/dist/esm/helpers/insertStyleRule.js.map +0 -0
- package/dist/esm/helpers/isObj.js +0 -0
- package/dist/esm/helpers/isObj.js.map +0 -0
- package/dist/esm/helpers/isTamaguiComponent.js +0 -0
- package/dist/esm/helpers/isTamaguiComponent.js.map +0 -0
- package/dist/esm/helpers/isTamaguiElement.js +0 -0
- package/dist/esm/helpers/isTamaguiElement.js.map +0 -0
- package/dist/esm/helpers/matchMedia.js +0 -0
- package/dist/esm/helpers/matchMedia.js.map +0 -0
- package/dist/esm/helpers/matchMedia.native.js +0 -0
- package/dist/esm/helpers/matchMedia.native.js.map +0 -0
- package/dist/esm/helpers/mergeProps.js +0 -0
- package/dist/esm/helpers/mergeProps.js.map +0 -0
- package/dist/esm/helpers/mergeTransform.js +0 -0
- package/dist/esm/helpers/mergeTransform.js.map +0 -0
- package/dist/esm/helpers/normalizeColor.js +1 -1
- package/dist/esm/helpers/normalizeColor.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.js +0 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +2 -2
- package/dist/esm/helpers/proxyThemeVariables.js +0 -0
- package/dist/esm/helpers/proxyThemeVariables.js.map +0 -0
- package/dist/esm/helpers/pseudoDescriptors.js +0 -0
- package/dist/esm/helpers/pseudoDescriptors.js.map +0 -0
- package/dist/esm/helpers/registerCSSVariable.js +0 -0
- package/dist/esm/helpers/registerCSSVariable.js.map +2 -2
- package/dist/esm/helpers/startTransition.js +0 -0
- package/dist/esm/helpers/startTransition.js.map +0 -0
- package/dist/esm/helpers/themeable.js +0 -0
- package/dist/esm/helpers/themeable.js.map +0 -0
- package/dist/esm/helpers/themes.js +0 -0
- package/dist/esm/helpers/themes.js.map +0 -0
- package/dist/esm/helpers/useAnimationDriver.js +1 -0
- package/dist/esm/helpers/useAnimationDriver.js.map +7 -0
- package/dist/esm/helpers/validate.js +0 -0
- package/dist/esm/helpers/validate.js.map +0 -0
- package/dist/esm/helpers/withStaticProperties.js +0 -0
- package/dist/esm/helpers/withStaticProperties.js.map +0 -0
- package/dist/esm/hooks/getThemeUnwrapped.js +2 -0
- package/dist/esm/hooks/getThemeUnwrapped.js.map +2 -2
- package/dist/esm/hooks/useAnimationDriver.js +1 -0
- package/dist/esm/hooks/useAnimationDriver.js.map +7 -0
- package/dist/esm/hooks/useConstant.js +4 -1
- package/dist/esm/hooks/useConstant.js.map +2 -2
- package/dist/esm/hooks/useFeatures.js +9 -1
- package/dist/esm/hooks/useFeatures.js.map +2 -2
- package/dist/esm/hooks/useId.js +0 -0
- package/dist/esm/hooks/useId.js.map +0 -0
- package/dist/esm/hooks/useIsMounted.js +0 -0
- package/dist/esm/hooks/useIsMounted.js.map +0 -0
- package/dist/esm/hooks/useIsSSR.js +4 -4
- package/dist/esm/hooks/useIsSSR.js.map +2 -2
- package/dist/esm/hooks/useIsTouchDevice.js +0 -0
- package/dist/esm/hooks/useIsTouchDevice.js.map +0 -0
- package/dist/esm/hooks/useMedia.js +0 -0
- package/dist/esm/hooks/useMedia.js.map +0 -0
- package/dist/esm/hooks/usePressable.js +0 -0
- package/dist/esm/hooks/usePressable.js.map +0 -0
- package/dist/esm/hooks/useSafeRef.js +0 -0
- package/dist/esm/hooks/useSafeRef.js.map +0 -0
- package/dist/esm/hooks/useServerContext.js +4 -0
- package/dist/esm/hooks/useServerContext.js.map +7 -0
- package/dist/esm/hooks/useServerHooks.js +11 -0
- package/dist/esm/hooks/useServerHooks.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +73 -45
- package/dist/esm/hooks/useTheme.js.map +2 -2
- package/dist/esm/hooks/useUnmountEffect.js +0 -0
- package/dist/esm/hooks/useUnmountEffect.js.map +0 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/injectStyles.js +16 -0
- package/dist/esm/injectStyles.js.map +7 -0
- package/dist/esm/insertFont.js +1 -1
- package/dist/esm/insertFont.js.map +1 -1
- package/dist/esm/static.js +0 -0
- package/dist/esm/static.js.map +0 -0
- package/dist/esm/styled.js +11 -1
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/types-rnw.js +0 -0
- package/dist/esm/types-rnw.js.map +0 -0
- package/dist/esm/types.js +0 -0
- package/dist/esm/types.js.map +0 -0
- package/dist/esm/updateTheme.js +0 -0
- package/dist/esm/updateTheme.js.map +0 -0
- package/dist/esm/vendor/Pressability.js +0 -0
- package/dist/esm/vendor/Pressability.js.map +0 -0
- package/dist/esm/vendor/Pressability.native.js +0 -0
- package/dist/esm/vendor/Pressability.native.js.map +0 -0
- package/dist/esm/views/FontLanguage.js +0 -0
- package/dist/esm/views/FontLanguage.js.map +0 -0
- package/dist/esm/views/FontLanguage.native.js +0 -0
- package/dist/esm/views/FontLanguage.native.js.map +0 -0
- package/dist/esm/views/FontLanguage.types.js +0 -0
- package/dist/esm/views/FontLanguage.types.js.map +0 -0
- package/dist/esm/views/Slot.js +0 -0
- package/dist/esm/views/Slot.js.map +0 -0
- package/dist/esm/views/Stack.js +0 -0
- package/dist/esm/views/Stack.js.map +0 -0
- package/dist/esm/views/TamaguiProvider.js +46 -0
- package/dist/esm/views/TamaguiProvider.js.map +7 -0
- package/dist/esm/views/Text.js +0 -0
- package/dist/esm/views/Text.js.map +0 -0
- package/dist/esm/views/Theme.js +4 -3
- package/dist/esm/views/Theme.js.map +2 -2
- package/dist/esm/views/ThemeInverse.js +0 -0
- package/dist/esm/views/ThemeInverse.js.map +0 -0
- package/dist/esm/views/ThemeProvider.js +10 -6
- package/dist/esm/views/ThemeProvider.js.map +2 -2
- package/dist/esm/views/ThemeReset.js +0 -0
- package/dist/esm/views/ThemeReset.js.map +0 -0
- package/package.json +36 -14
- package/src/Tamagui.ts +44 -0
- package/src/addTheme.ts +66 -0
- package/src/config.ts +38 -0
- package/src/constants/constants.ts +15 -0
- package/src/constants/platform.native.ts +14 -0
- package/src/constants/platform.ts +24 -0
- package/src/contexts/ButtonInsideButtonContext.tsx +3 -0
- package/src/contexts/FontLanguageContext.tsx +5 -0
- package/src/contexts/TextAncestorContext.tsx +10 -0
- package/src/contexts/ThemeContext.tsx +5 -0
- package/src/createComponent.tsx +1338 -0
- package/src/createFont.ts +26 -0
- package/src/createShorthands.ts +5 -0
- package/src/createTamagui.ts +232 -0
- package/src/createTheme.ts +13 -0
- package/src/createTokens.ts +35 -0
- package/src/createVariable.ts +77 -0
- package/src/createVariables.ts +42 -0
- package/src/helpers/RNComponents.tsx +14 -0
- package/src/helpers/ThemeManager.tsx +229 -0
- package/src/helpers/areEqualSets.tsx +9 -0
- package/src/helpers/assignNativePropsToWeb.native.tsx +1 -0
- package/src/helpers/assignNativePropsToWeb.tsx +178 -0
- package/src/helpers/calc.ts +65 -0
- package/src/helpers/createMediaStyle.ts +48 -0
- package/src/helpers/createPropMapper.ts +457 -0
- package/src/helpers/createShallowUpdate.tsx +20 -0
- package/src/helpers/cssHash.ts +28 -0
- package/src/helpers/expandStyle.ts +81 -0
- package/src/helpers/expandStyles.ts +105 -0
- package/src/helpers/extendStaticConfig.ts +76 -0
- package/src/helpers/fixNativeShadow.tsx +2 -0
- package/src/helpers/getAnimationDriver.tsx +5 -0
- package/src/helpers/getExpandedShorthands.ts +15 -0
- package/src/helpers/getFont.tsx +40 -0
- package/src/helpers/getFontLanguage.ts +2 -0
- package/src/helpers/getSize.ts +22 -0
- package/src/helpers/getSplitStyles.tsx +685 -0
- package/src/helpers/getStackSize.ts +22 -0
- package/src/helpers/getStylesAtomic.native.ts +3 -0
- package/src/helpers/getStylesAtomic.ts +292 -0
- package/src/helpers/getThemeCSSRules.native.ts +3 -0
- package/src/helpers/getThemeCSSRules.ts +105 -0
- package/src/helpers/getVariantExtras.tsx +83 -0
- package/src/helpers/insertStyleRule.tsx +150 -0
- package/src/helpers/isObj.ts +1 -0
- package/src/helpers/isTamaguiComponent.tsx +15 -0
- package/src/helpers/isTamaguiElement.tsx +14 -0
- package/src/helpers/matchMedia.native.ts +6 -0
- package/src/helpers/matchMedia.ts +16 -0
- package/src/helpers/mergeProps.ts +56 -0
- package/src/helpers/mergeTransform.ts +14 -0
- package/src/helpers/normalizeColor.ts +53 -0
- package/src/helpers/normalizeValueWithProperty.ts +78 -0
- package/src/helpers/proxyThemeVariables.tsx +13 -0
- package/src/helpers/pseudoDescriptors.ts +18 -0
- package/src/helpers/registerCSSVariable.ts +11 -0
- package/src/helpers/startTransition.ts +4 -0
- package/src/helpers/themeable.tsx +45 -0
- package/src/helpers/themes.ts +69 -0
- package/src/helpers/validate.ts +80 -0
- package/src/helpers/withStaticProperties.tsx +7 -0
- package/src/hooks/getThemeUnwrapped.tsx +8 -0
- package/src/hooks/useConstant.tsx +19 -0
- package/src/hooks/useFeatures.tsx +289 -0
- package/src/hooks/useId.tsx +1 -0
- package/src/hooks/useIsMounted.ts +17 -0
- package/src/hooks/useIsSSR.tsx +20 -0
- package/src/hooks/useIsTouchDevice.tsx +21 -0
- package/src/hooks/useMedia.tsx +167 -0
- package/src/hooks/usePressable.tsx +9 -0
- package/src/hooks/useSafeRef.ts +50 -0
- package/src/hooks/useServerHooks.tsx +13 -0
- package/src/hooks/useTheme.tsx +264 -0
- package/src/hooks/useUnmountEffect.ts +5 -0
- package/src/index.ts +80 -0
- package/src/injectStyles.ts +20 -0
- package/src/insertFont.ts +69 -0
- package/src/static.ts +15 -0
- package/src/styled.tsx +149 -0
- package/src/types-rnw.tsx +162 -0
- package/src/types.tsx +1267 -0
- package/src/updateTheme.ts +23 -0
- package/src/vendor/Pressability.native.tsx +3 -0
- package/src/vendor/Pressability.tsx +2 -0
- package/src/views/FontLanguage.native.tsx +9 -0
- package/src/views/FontLanguage.tsx +18 -0
- package/src/views/FontLanguage.types.ts +13 -0
- package/src/views/Slot.tsx +152 -0
- package/src/views/Stack.tsx +24 -0
- package/src/views/TamaguiProvider.tsx +57 -0
- package/src/views/Text.tsx +79 -0
- package/src/views/Theme.tsx +72 -0
- package/src/views/ThemeInverse.tsx +33 -0
- package/src/views/ThemeProvider.tsx +62 -0
- package/src/views/ThemeReset.tsx +43 -0
- package/types/conf.d.ts +1 -1
- package/types/config.d.ts +27 -0
- package/types/constants/platform.d.ts +3 -2
- package/types/constants/platform.native.d.ts +13 -0
- package/types/createComponent.server.d.ts +36 -0
- package/types/createTamagui.d.ts +1 -1
- package/types/createTheme.d.ts +1 -1
- package/types/createVariable.d.ts +15 -12
- package/types/helpers/RNComponents.d.ts +1 -1
- package/types/helpers/ThemeManager.d.ts +2 -8
- package/types/helpers/getAnimationDriver.d.ts +6 -0
- package/types/helpers/registerCSSVariable.d.ts +2 -2
- package/types/helpers/useAnimationDriver.d.ts +1 -0
- package/types/hooks/useAnimationDriver.d.ts +1 -0
- package/types/hooks/useServerContext.d.ts +2 -0
- package/types/hooks/useServerHooks.d.ts +4 -0
- package/types/hooks/useTheme.d.ts +5 -21
- package/types/index.d.ts +3 -1
- package/types/injectStyles.d.ts +7 -0
- package/types/types.d.ts +24 -1
- package/types/views/TamaguiProvider.d.ts +4 -0
- package/types/views/ThemeProvider.d.ts +0 -1
- package/dist/cjs/Pressability.js.map +0 -7
- package/dist/cjs/Pressability.native.js.map +0 -7
- package/dist/cjs/ThemeContext.js.map +0 -7
- package/dist/cjs/ThemeManager.js +0 -211
- package/dist/cjs/ThemeManager.js.map +0 -7
- package/dist/cjs/defaultComponentState.js +0 -2
- package/dist/cjs/ensureThemeVariable.js +0 -152
- package/dist/cjs/ensureThemeVariable.js.map +0 -7
- package/dist/cjs/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/cjs/helpers/ensureThemeVariable.js +0 -152
- package/dist/cjs/helpers/ensureThemeVariable.js.map +0 -7
- package/dist/cjs/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/cjs/loadTheme.js +0 -64
- package/dist/cjs/loadTheme.js.map +0 -7
- package/dist/cjs/views/TextAncestorContext.js +0 -44
- package/dist/cjs/views/TextAncestorContext.js.map +0 -7
- package/dist/esm/Pressability.js +0 -7
- package/dist/esm/Pressability.js.map +0 -7
- package/dist/esm/Pressability.native.js +0 -7
- package/dist/esm/Pressability.native.js.map +0 -7
- package/dist/esm/ThemeContext.js +0 -6
- package/dist/esm/ThemeContext.js.map +0 -7
- package/dist/esm/ThemeManager.js +0 -185
- package/dist/esm/ThemeManager.js.map +0 -7
- package/dist/esm/defaultComponentState.js +0 -1
- package/dist/esm/ensureThemeVariable.js +0 -125
- package/dist/esm/ensureThemeVariable.js.map +0 -7
- package/dist/esm/helpers/createTamaguiProvider.js +0 -42
- package/dist/esm/helpers/createTamaguiProvider.js.map +0 -7
- package/dist/esm/helpers/ensureThemeVariable.js +0 -125
- package/dist/esm/helpers/ensureThemeVariable.js.map +0 -7
- package/dist/esm/helpers/nativeGestureHandler.native.js +0 -2
- package/dist/esm/helpers/nativeGestureHandler.native.js.map +0 -7
- package/dist/esm/loadTheme.js +0 -40
- package/dist/esm/loadTheme.js.map +0 -7
- package/dist/esm/views/TextAncestorContext.js +0 -15
- package/dist/esm/views/TextAncestorContext.js.map +0 -7
- package/types/helpers/createTamaguiProvider.d.ts +0 -3
package/dist/esm/ThemeManager.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { createContext } from "react";
|
|
2
|
-
import { getThemes } from "./conf";
|
|
3
|
-
import { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from "./constants/constants";
|
|
4
|
-
import { getThemeUnwrapped } from "./hooks/getThemeUnwrapped";
|
|
5
|
-
class ThemeManager {
|
|
6
|
-
constructor(name = "", theme = null, parentManager = null, reset = false) {
|
|
7
|
-
this.name = name;
|
|
8
|
-
this.theme = theme;
|
|
9
|
-
this.parentManager = parentManager;
|
|
10
|
-
this.reset = reset;
|
|
11
|
-
this.keys = /* @__PURE__ */ new Map();
|
|
12
|
-
this.listeners = /* @__PURE__ */ new Map();
|
|
13
|
-
this.themeListeners = /* @__PURE__ */ new Set();
|
|
14
|
-
this.className = null;
|
|
15
|
-
let parent = parentManager;
|
|
16
|
-
let tries = 0;
|
|
17
|
-
while (true) {
|
|
18
|
-
tries++;
|
|
19
|
-
if (tries > 10) {
|
|
20
|
-
throw new Error(`Nested 10 of the same theme in a row, likely error`);
|
|
21
|
-
}
|
|
22
|
-
if (!parent)
|
|
23
|
-
break;
|
|
24
|
-
if (parent.name === name) {
|
|
25
|
-
parent = parent.parentManager;
|
|
26
|
-
} else {
|
|
27
|
-
this.parentManager = parent;
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
get didChangeTheme() {
|
|
33
|
-
return this.parentManager && this.name !== this.parentManager.fullName;
|
|
34
|
-
}
|
|
35
|
-
get parentName() {
|
|
36
|
-
var _a;
|
|
37
|
-
return ((_a = this.parentManager) == null ? void 0 : _a.name) || null;
|
|
38
|
-
}
|
|
39
|
-
get fullName() {
|
|
40
|
-
return this.getNextTheme().name || this.name || "";
|
|
41
|
-
}
|
|
42
|
-
getValue(key) {
|
|
43
|
-
let theme = this.theme;
|
|
44
|
-
let manager = this;
|
|
45
|
-
while (true) {
|
|
46
|
-
if (!theme)
|
|
47
|
-
return;
|
|
48
|
-
if (key in theme) {
|
|
49
|
-
return theme[key];
|
|
50
|
-
}
|
|
51
|
-
manager = this.parentManager;
|
|
52
|
-
if (!manager) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (manager.theme === theme) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
theme = manager.theme;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
update({ name, theme, className } = {}) {
|
|
62
|
-
const nameChanged = name !== this.name;
|
|
63
|
-
if (!nameChanged) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
this.className = className || null;
|
|
67
|
-
this.name = name || "";
|
|
68
|
-
this.theme = theme;
|
|
69
|
-
this.notifyListeners();
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
getNextTheme(props = {}, debug) {
|
|
73
|
-
var _a;
|
|
74
|
-
const { themes = getThemes(), name, componentName } = props;
|
|
75
|
-
if (props.reset && name) {
|
|
76
|
-
return {
|
|
77
|
-
name,
|
|
78
|
-
theme: themes[name],
|
|
79
|
-
className: this.getClassName(name)
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
const parentIsReset = (_a = this.parentManager) == null ? void 0 : _a.reset;
|
|
83
|
-
if (!name) {
|
|
84
|
-
if (componentName) {
|
|
85
|
-
const names = [
|
|
86
|
-
`${this.name}_${componentName}`,
|
|
87
|
-
`${withoutComponentName(this.name)}_${componentName}`
|
|
88
|
-
];
|
|
89
|
-
for (const name2 of names) {
|
|
90
|
-
if (name2 in themes) {
|
|
91
|
-
const className = this.getClassName(name2);
|
|
92
|
-
return { name: name2, theme: themes[name2], className };
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
name: this.name,
|
|
98
|
-
theme: this.theme
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
let nextName = name || this.name || "";
|
|
102
|
-
let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName;
|
|
103
|
-
while (true) {
|
|
104
|
-
if (nextName in themes) {
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
nextName = `${parentName}_${name}`;
|
|
108
|
-
if (nextName in themes) {
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
if (!parentName.includes(THEME_NAME_SEPARATOR)) {
|
|
112
|
-
console.warn("theme not found", name);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR));
|
|
116
|
-
}
|
|
117
|
-
if (componentName) {
|
|
118
|
-
const names = [
|
|
119
|
-
`${nextName}_${componentName}`,
|
|
120
|
-
`${withoutComponentName(nextName)}_${componentName}`
|
|
121
|
-
];
|
|
122
|
-
for (const name2 of names) {
|
|
123
|
-
if (name2 in themes) {
|
|
124
|
-
nextName = name2;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
let theme = themes[nextName];
|
|
129
|
-
if (!theme) {
|
|
130
|
-
theme = themes[`light_${nextName}`];
|
|
131
|
-
}
|
|
132
|
-
if (process.env.NODE_ENV === "development") {
|
|
133
|
-
if (debug) {
|
|
134
|
-
console.log("getNextTheme", this.getClassName(nextName), { props, nextName, parentName });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
name: nextName,
|
|
139
|
-
theme: getThemeUnwrapped(theme),
|
|
140
|
-
className: this.getClassName(nextName)
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
getClassName(name) {
|
|
144
|
-
return `${THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace("light_", "").replace("dark_", "");
|
|
145
|
-
}
|
|
146
|
-
track(uuid, keys) {
|
|
147
|
-
if (!this.name)
|
|
148
|
-
return;
|
|
149
|
-
this.keys.set(uuid, keys);
|
|
150
|
-
}
|
|
151
|
-
notifyListeners() {
|
|
152
|
-
var _a;
|
|
153
|
-
if (!this.name) {
|
|
154
|
-
this.keys.clear();
|
|
155
|
-
}
|
|
156
|
-
for (const [uuid, keys] of this.keys.entries()) {
|
|
157
|
-
if (keys.size) {
|
|
158
|
-
(_a = this.listeners.get(uuid)) == null ? void 0 : _a();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
this.themeListeners.forEach((cb) => cb(this.name, this));
|
|
162
|
-
}
|
|
163
|
-
onChangeTheme(cb) {
|
|
164
|
-
this.themeListeners.add(cb);
|
|
165
|
-
return () => {
|
|
166
|
-
this.themeListeners.delete(cb);
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
onUpdate(uuid, cb) {
|
|
170
|
-
this.listeners.set(uuid, cb);
|
|
171
|
-
return () => {
|
|
172
|
-
this.listeners.delete(uuid);
|
|
173
|
-
this.keys.delete(uuid);
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
const ThemeManagerContext = createContext(null);
|
|
178
|
-
const emptyManager = new ThemeManager();
|
|
179
|
-
const withoutComponentName = (name) => name.replace(/(\_[A-Z][a-zA-Z]+)+$/g, "");
|
|
180
|
-
export {
|
|
181
|
-
ThemeManager,
|
|
182
|
-
ThemeManagerContext,
|
|
183
|
-
emptyManager
|
|
184
|
-
};
|
|
185
|
-
//# sourceMappingURL=ThemeManager.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ThemeManager.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createContext } from 'react'\n\nimport { getThemes } from './conf'\nimport { THEME_CLASSNAME_PREFIX, THEME_NAME_SEPARATOR } from './constants/constants'\nimport { getThemeUnwrapped } from './hooks/getThemeUnwrapped'\nimport { ThemeObject, Themes } from './types'\n\ntype ThemeListener = (name: string | null, themeManager: ThemeManager) => void\n\nexport type SetActiveThemeProps = {\n className?: string\n parentManager?: ThemeManager | null\n name?: string | null\n theme?: any\n}\n\nexport type GetNextThemeProps = {\n themes?: Themes\n name?: string | null\n componentName?: string | null\n reset?: boolean\n}\n\nexport class ThemeManager {\n keys = new Map<any, Set<string>>()\n listeners = new Map<any, Function>()\n themeListeners = new Set<ThemeListener>()\n className: string | null = null\n\n constructor(\n public name: string = '',\n public theme: ThemeObject | null = null,\n public parentManager: ThemeManager | null = null,\n public reset: boolean = false\n ) {\n // find the nearest different parentManager\n let parent = parentManager\n let tries = 0\n while (true) {\n tries++\n if (tries > 10) {\n throw new Error(`Nested 10 of the same theme in a row, likely error`)\n }\n if (!parent) break\n if (parent.name === name) {\n // go up if same\n parent = parent.parentManager\n } else {\n this.parentManager = parent\n break\n }\n }\n }\n\n get didChangeTheme() {\n return this.parentManager && this.name !== this.parentManager.fullName\n }\n\n get parentName() {\n return this.parentManager?.name || null\n }\n\n get fullName(): string {\n return this.getNextTheme().name || this.name || ''\n // const parentName = this.parentManager?.fullName || ''\n // const name = this.name || ''\n // const parts = [...new Set([...`${parentName}_${name}`.split('_')])].filter(Boolean)\n // return parts.join('_')\n }\n\n // gets value going up to parents\n getValue(key: string) {\n let theme = this.theme\n let manager = this as ThemeManager | null\n while (true) {\n if (!theme) return\n if (key in theme) {\n return theme[key]\n }\n manager = this.parentManager\n if (!manager) {\n return\n }\n if (manager.theme === theme) {\n return\n }\n theme = manager.theme\n }\n }\n\n update({ name, theme, className }: SetActiveThemeProps = {}) {\n // className compare on web, avoids light/dark re-renders\n const nameChanged = name !== this.name\n if (!nameChanged) {\n return false\n }\n this.className = className || null\n this.name = name || ''\n this.theme = theme\n this.notifyListeners()\n return true\n }\n\n getNextTheme(props: GetNextThemeProps = {}, debug?: any) {\n const { themes = getThemes(), name, componentName } = props\n\n if (props.reset && name) {\n return {\n name: name,\n theme: themes[name],\n className: this.getClassName(name),\n }\n }\n\n const parentIsReset = this.parentManager?.reset\n\n if (!name) {\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${this.name}_${componentName}`,\n `${withoutComponentName(this.name)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n const className = this.getClassName(name)\n return { name, theme: themes[name], className }\n }\n }\n }\n return {\n name: this.name,\n theme: this.theme,\n }\n }\n\n let nextName = name || this.name || ''\n let parentName = parentIsReset ? this.parentName || this.fullName : this.fullName\n\n while (true) {\n if (nextName in themes) {\n break\n }\n nextName = `${parentName}_${name}`\n if (nextName in themes) {\n break\n }\n if (!parentName.includes(THEME_NAME_SEPARATOR)) {\n // not found!\n console.warn('theme not found', name)\n // this happens in next during _document.getInitialProps and has a terrible/non-existent stack trace\n // throw new Error(`Theme not found: ${name}`)\n break\n }\n // go up one\n parentName = parentName.slice(0, parentName.lastIndexOf(THEME_NAME_SEPARATOR))\n }\n\n if (componentName) {\n // allow for _Card_Button or just _Button\n const names = [\n `${nextName}_${componentName}`,\n `${withoutComponentName(nextName)}_${componentName}`,\n ]\n for (const name of names) {\n if (name in themes) {\n nextName = name\n }\n }\n }\n\n let theme = themes[nextName]\n if (!theme) {\n theme = themes[`light_${nextName}`]\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (debug) {\n console.log('getNextTheme', this.getClassName(nextName), { props, nextName, parentName })\n }\n }\n\n return {\n name: nextName,\n theme: getThemeUnwrapped(theme),\n className: this.getClassName(nextName),\n }\n }\n\n getClassName(name: string) {\n return `${THEME_CLASSNAME_PREFIX}${name} t_Theme`.replace('light_', '').replace('dark_', '')\n }\n\n track(uuid: any, keys: Set<string>) {\n if (!this.name) return\n this.keys.set(uuid, keys)\n }\n\n notifyListeners() {\n if (!this.name) {\n this.keys.clear()\n }\n for (const [uuid, keys] of this.keys.entries()) {\n if (keys.size) {\n this.listeners.get(uuid)?.()\n }\n }\n this.themeListeners.forEach((cb) => cb(this.name, this))\n }\n\n onChangeTheme(cb: ThemeListener) {\n this.themeListeners.add(cb)\n return () => {\n this.themeListeners.delete(cb)\n }\n }\n\n onUpdate(uuid: any, cb: Function) {\n this.listeners.set(uuid, cb)\n return () => {\n this.listeners.delete(uuid)\n this.keys.delete(uuid)\n }\n }\n}\n\nexport const ThemeManagerContext = createContext<ThemeManager | null>(null)\nexport const emptyManager = new ThemeManager()\n\nconst withoutComponentName = (name: string) => name.replace(/(\\_[A-Z][a-zA-Z]+)+$/g, '')\n"],
|
|
5
|
-
"mappings": "AAAA;AAEA;AACA;AACA;AAmBO,MAAM,aAAa;AAAA,EAMxB,YACS,OAAe,IACf,QAA4B,MAC5B,gBAAqC,MACrC,QAAiB,OACxB;AAJO;AACA;AACA;AACA;AATT,gBAAO,oBAAI,IAAsB;AACjC,qBAAY,oBAAI,IAAmB;AACnC,0BAAiB,oBAAI,IAAmB;AACxC,qBAA2B;AASzB,QAAI,SAAS;AACb,QAAI,QAAQ;AACZ,WAAO,MAAM;AACX;AACA,UAAI,QAAQ,IAAI;AACd,cAAM,IAAI,MAAM,oDAAoD;AAAA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@ -1,125 +0,0 @@
|
|
|
1
|
-
import { THEME_CLASSNAME_PREFIX } from "./constants/constants";
|
|
2
|
-
import { createVariable, isVariable } from "./createVariable";
|
|
3
|
-
import { tokensValueToVariable } from "./helpers/registerCSSVariable";
|
|
4
|
-
import { GetThemeUnwrapped } from "./hooks/getThemeUnwrapped";
|
|
5
|
-
const themes = {};
|
|
6
|
-
function ensureThemeVariable(theme, key) {
|
|
7
|
-
const val = theme[key];
|
|
8
|
-
const themeKey = key;
|
|
9
|
-
if (!isVariable(val)) {
|
|
10
|
-
theme[key] = createVariable({
|
|
11
|
-
key: themeKey,
|
|
12
|
-
name: themeKey,
|
|
13
|
-
val
|
|
14
|
-
});
|
|
15
|
-
} else {
|
|
16
|
-
if (val.name !== themeKey) {
|
|
17
|
-
theme[key] = createVariable({
|
|
18
|
-
key: val.name,
|
|
19
|
-
name: themeKey,
|
|
20
|
-
val: val.val
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function proxyThemeToParents(themeName, themes2) {
|
|
26
|
-
const cur = [];
|
|
27
|
-
const parents = themeName.split("_").slice(0, -1).map((part) => {
|
|
28
|
-
cur.push(part);
|
|
29
|
-
return cur.join("_");
|
|
30
|
-
});
|
|
31
|
-
if (!parents.length) {
|
|
32
|
-
return themes2[themeName];
|
|
33
|
-
}
|
|
34
|
-
const og = themes2[themeName];
|
|
35
|
-
return new Proxy(og, {
|
|
36
|
-
get(target, key) {
|
|
37
|
-
if (key === GetThemeUnwrapped) {
|
|
38
|
-
return og;
|
|
39
|
-
}
|
|
40
|
-
if (Reflect.has(target, key)) {
|
|
41
|
-
return Reflect.get(target, key);
|
|
42
|
-
}
|
|
43
|
-
for (let i = parents.length - 1; i >= 0; i--) {
|
|
44
|
-
const parent = themes2[parents[i]];
|
|
45
|
-
if (!parent) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (Reflect.has(parent, key)) {
|
|
49
|
-
return Reflect.get(parent, key);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return Reflect.get(target, key);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function getThemeCSSRules({
|
|
57
|
-
config,
|
|
58
|
-
themeName,
|
|
59
|
-
theme,
|
|
60
|
-
names
|
|
61
|
-
}) {
|
|
62
|
-
const cssRuleSets = [];
|
|
63
|
-
const hasDarkLight = "light" in config.themes && "dark" in config.themes;
|
|
64
|
-
const CNP = `.${THEME_CLASSNAME_PREFIX}`;
|
|
65
|
-
let vars = "";
|
|
66
|
-
for (const themeKey in theme) {
|
|
67
|
-
const variable = theme[themeKey];
|
|
68
|
-
let value = null;
|
|
69
|
-
if (variable.isFloating || !tokensValueToVariable.has(variable.val)) {
|
|
70
|
-
value = variable.val;
|
|
71
|
-
} else {
|
|
72
|
-
value = tokensValueToVariable.get(variable.val).variable;
|
|
73
|
-
}
|
|
74
|
-
vars += `--${themeKey}:${value};`;
|
|
75
|
-
}
|
|
76
|
-
const isDarkOrLightBase = themeName === "dark" || themeName === "light";
|
|
77
|
-
const selectors = names.map((name) => {
|
|
78
|
-
return `${CNP}${name}`;
|
|
79
|
-
});
|
|
80
|
-
if (hasDarkLight) {
|
|
81
|
-
for (const subName of names) {
|
|
82
|
-
const isDark = isDarkOrLightBase || subName.startsWith("dark_");
|
|
83
|
-
const childSelector = `${CNP}${subName.replace(isDark ? "dark_" : "light_", "")}`;
|
|
84
|
-
const order = isDark ? ["dark", "light"] : ["light", "dark"];
|
|
85
|
-
if (isDarkOrLightBase) {
|
|
86
|
-
order.reverse();
|
|
87
|
-
}
|
|
88
|
-
const [stronger, weaker] = order;
|
|
89
|
-
const max = config.maxDarkLightNesting ?? 3;
|
|
90
|
-
new Array(Math.round(max * 1.5)).fill(void 0).forEach((_, pi) => {
|
|
91
|
-
const isOdd = pi % 2 === 1;
|
|
92
|
-
if (isOdd && pi < 3)
|
|
93
|
-
return;
|
|
94
|
-
const parents = new Array(pi + 1).fill(void 0).map((_2, psi) => {
|
|
95
|
-
return `${CNP}${psi % 2 === 0 ? stronger : weaker}`;
|
|
96
|
-
});
|
|
97
|
-
let parentSelectors = parents.length > 1 ? parents.slice(1) : parents;
|
|
98
|
-
if (isOdd) {
|
|
99
|
-
const [_first, second, ...rest] = parentSelectors;
|
|
100
|
-
parentSelectors = [second, ...rest, second];
|
|
101
|
-
}
|
|
102
|
-
const lastParentSelector = parentSelectors[parentSelectors.length - 1];
|
|
103
|
-
selectors.push(`${parentSelectors.join(" ")} ${childSelector === lastParentSelector ? "" : childSelector}`);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
const rootSep = config.themeClassNameOnRoot ? "" : " ";
|
|
108
|
-
const css = `${selectors.map((x) => `:root${rootSep}${x}`).join(", ")} {${vars}}`;
|
|
109
|
-
cssRuleSets.push(css);
|
|
110
|
-
if (config.shouldAddPrefersColorThemes && isDarkOrLightBase) {
|
|
111
|
-
const isDark = themeName.startsWith("dark");
|
|
112
|
-
cssRuleSets.push(`@media(prefers-color-scheme: ${isDark ? "dark" : "light"}) {
|
|
113
|
-
body { background:${theme.background}; color: ${theme.color} }
|
|
114
|
-
:root {${vars} }
|
|
115
|
-
}`);
|
|
116
|
-
}
|
|
117
|
-
return cssRuleSets;
|
|
118
|
-
}
|
|
119
|
-
export {
|
|
120
|
-
ensureThemeVariable,
|
|
121
|
-
getThemeCSSRules,
|
|
122
|
-
proxyThemeToParents,
|
|
123
|
-
themes
|
|
124
|
-
};
|
|
125
|
-
//# sourceMappingURL=ensureThemeVariable.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/ensureThemeVariable.ts"],
|
|
4
|
-
"sourcesContent": ["import { THEME_CLASSNAME_PREFIX } from './constants/constants'\nimport { Variable, createVariable, isVariable } from './createVariable'\nimport { tokensValueToVariable } from './helpers/registerCSSVariable'\nimport { GetThemeUnwrapped } from './hooks/getThemeUnwrapped'\nimport { CreateTamaguiProps, ThemeObject } from './types'\n\nexport const themes = {}\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}\nexport function proxyThemeToParents(themeName: string, themes: CreateTamaguiProps['themes']) {\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 if (!parents.length) {\n return themes[themeName]\n }\n\n // proxy fallback values to parent theme values\n const og = themes[themeName]\n return new Proxy(og, {\n get(target, key) {\n if (key === GetThemeUnwrapped) {\n return og\n }\n if (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}\nexport function getThemeCSSRules({\n config,\n themeName,\n theme,\n names,\n}: {\n config: CreateTamaguiProps\n themeName: string\n theme: ThemeObject\n names: string[]\n}) {\n const cssRuleSets: string[] = []\n\n // special case for SSR\n const hasDarkLight = 'light' in config.themes && 'dark' in config.themes\n const CNP = `.${THEME_CLASSNAME_PREFIX}`\n let vars = ''\n\n // themeToVariableToValueMap.set(theme, {})\n // const varToValMap = themeToVariableToValueMap.get(theme)\n for (const themeKey in theme) {\n const variable = theme[themeKey] as Variable\n let value: any = null\n // if (varToValMap) {\n // varToValMap[variable.variable] = variable.val\n // }\n if (variable.isFloating || !tokensValueToVariable.has(variable.val)) {\n value = variable.val\n } else {\n value = tokensValueToVariable.get(variable.val)!.variable\n }\n vars += `--${themeKey}:${value};`\n }\n\n const isDarkOrLightBase = themeName === 'dark' || themeName === 'light'\n const selectors = names.map((name) => {\n return `${CNP}${name}`\n })\n\n // since we dont specify dark/light in classnames we have to do an awkward specificity war\n // use config.maxDarkLightNesting to determine how deep you can nest until it breaks\n if (hasDarkLight) {\n for (const subName of names) {\n const isDark = isDarkOrLightBase || subName.startsWith('dark_')\n const childSelector = `${CNP}${subName.replace(isDark ? 'dark_' : 'light_', '')}`\n const order = isDark ? ['dark', 'light'] : ['light', 'dark']\n if (isDarkOrLightBase) {\n order.reverse()\n }\n const [stronger, weaker] = order\n const max = config.maxDarkLightNesting ?? 3\n\n new Array(Math.round(max * 1.5)).fill(undefined).forEach((_, pi) => {\n const isOdd = pi % 2 === 1\n if (isOdd && pi < 3) return\n const parents = new Array(pi + 1).fill(undefined).map((_, psi) => {\n return `${CNP}${psi % 2 === 0 ? stronger : weaker}`\n })\n let parentSelectors = parents.length > 1 ? parents.slice(1) : parents\n if (isOdd) {\n const [_first, second, ...rest] = parentSelectors\n parentSelectors = [second, ...rest, second]\n }\n // avoid .t_light .t_light at the end (make sure child is unique from last parent)\n const lastParentSelector = parentSelectors[parentSelectors.length - 1]\n selectors.push(\n `${parentSelectors.join(' ')} ${\n childSelector === lastParentSelector ? '' : childSelector\n }`\n )\n })\n }\n }\n\n const rootSep = config.themeClassNameOnRoot ? '' : ' '\n const css = `${selectors.map((x) => `:root${rootSep}${x}`).join(', ')} {${vars}}`\n cssRuleSets.push(css)\n\n if (config.shouldAddPrefersColorThemes && isDarkOrLightBase) {\n // add media prefers for dark/light base\n const isDark = themeName.startsWith('dark')\n cssRuleSets.push(\n `@media(prefers-color-scheme: ${isDark ? 'dark' : 'light'}) {\nbody { background:${theme.background}; color: ${theme.color} }\n:root {${vars} } \n}`\n )\n }\n\n return cssRuleSets\n}\n"],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AAAA,QAC7C,CAAC;AACD,YAAI,kBAAkB,QAAQ,SAAS,IAAI,QAAQ,MAAM,CAAC,IAAI;AAC9D,YAAI,OAAO;AACT,gBAAM,CAAC,QAAQ,WAAW,QAAQ;AAClC,4BAAkB,CAAC,QAAQ,GAAG,MAAM,MAAM;AAAA,QAC5C;AAEA,cAAM,qBAAqB,gBAAgB,gBAAgB,SAAS;AACpE,kBAAU,KACR,GAAG,gBAAgB,KAAK,GAAG,KACzB,kBAAkB,qBAAqB,KAAK,eAEhD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,QAAM,UAAU,OAAO,uBAAuB,KAAK;AACnD,QAAM,MAAM,GAAG,UAAU,IAAI,CAAC,MAAM,QAAQ,UAAU,GAAG,EAAE,KAAK,IAAI,MAAM;AAC1E,cAAY,KAAK,GAAG;AAEpB,MAAI,OAAO,+BAA+B,mBAAmB;AAE3D,UAAM,SAAS,UAAU,WAAW,MAAM;AAC1C,gBAAY,KACV,gCAAgC,SAAS,SAAS;AAAA,oBACpC,MAAM,sBAAsB,MAAM;AAAA,SAC7C;AAAA,EAEL;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { isClient, isSSR } from "../constants/platform";
|
|
3
|
-
import { ButtonInsideButtonContext } from "../contexts/ButtonInsideButtonContext";
|
|
4
|
-
import { TextAncestorProvider } from "../contexts/TextAncestorContext";
|
|
5
|
-
import { useMediaQueryListeners } from "../hooks/useMedia";
|
|
6
|
-
import { ThemeProvider } from "../views/ThemeProvider";
|
|
7
|
-
function createTamaguiProvider(config) {
|
|
8
|
-
return function TamaguiProvider({
|
|
9
|
-
disableInjectCSS,
|
|
10
|
-
children,
|
|
11
|
-
...themePropsProvider
|
|
12
|
-
}) {
|
|
13
|
-
if (!isSSR) {
|
|
14
|
-
useMediaQueryListeners();
|
|
15
|
-
}
|
|
16
|
-
if (isClient) {
|
|
17
|
-
React.useLayoutEffect(() => {
|
|
18
|
-
if (disableInjectCSS)
|
|
19
|
-
return;
|
|
20
|
-
const style = document.createElement("style");
|
|
21
|
-
style.appendChild(document.createTextNode(config.getCSS()));
|
|
22
|
-
document.head.appendChild(style);
|
|
23
|
-
return () => {
|
|
24
|
-
document.head.removeChild(style);
|
|
25
|
-
};
|
|
26
|
-
}, [disableInjectCSS]);
|
|
27
|
-
}
|
|
28
|
-
return /* @__PURE__ */ React.createElement(ButtonInsideButtonContext.Provider, {
|
|
29
|
-
value: false
|
|
30
|
-
}, /* @__PURE__ */ React.createElement(TextAncestorProvider, null, /* @__PURE__ */ React.createElement(ThemeProvider, {
|
|
31
|
-
themes: config.themes,
|
|
32
|
-
defaultTheme: config.defaultTheme || "light",
|
|
33
|
-
themeClassNameOnRoot: config.themeClassNameOnRoot,
|
|
34
|
-
disableRootThemeClass: config.disableRootThemeClass,
|
|
35
|
-
...themePropsProvider
|
|
36
|
-
}, children)));
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
createTamaguiProvider
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=createTamaguiProvider.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/createTamaguiProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\n\nimport { isClient, isSSR } from '../constants/platform'\nimport { ButtonInsideButtonContext } from '../contexts/ButtonInsideButtonContext'\nimport { TextAncestorProvider } from '../contexts/TextAncestorContext'\nimport { useMediaQueryListeners } from '../hooks/useMedia'\nimport { TamaguiInternalConfig, TamaguiProviderProps } from '../types'\nimport { ThemeProvider } from '../views/ThemeProvider'\n\nexport function createTamaguiProvider(config: TamaguiInternalConfig) {\n return function TamaguiProvider({\n disableInjectCSS,\n children,\n ...themePropsProvider\n }: TamaguiProviderProps) {\n if (!isSSR) {\n useMediaQueryListeners()\n }\n\n if (isClient) {\n // inject CSS if asked to (not SSR compliant)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(() => {\n if (disableInjectCSS) return\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(config.getCSS()))\n document.head.appendChild(style)\n return () => {\n document.head.removeChild(style)\n }\n }, [disableInjectCSS])\n }\n\n return (\n <ButtonInsideButtonContext.Provider value={false}>\n <TextAncestorProvider>\n <ThemeProvider\n themes={config.themes}\n defaultTheme={config.defaultTheme || 'light'}\n themeClassNameOnRoot={config.themeClassNameOnRoot}\n disableRootThemeClass={config.disableRootThemeClass}\n {...themePropsProvider}\n >\n {children}\n </ThemeProvider>\n </TextAncestorProvider>\n </ButtonInsideButtonContext.Provider>\n )\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AAEA;AACA;AACA;AACA;AAEA;AAEO,+BAA+B,QAA+B;AACnE,SAAO,yBAAyB;AAAA,IAC9B;AAAA,IACA;AAAA,OACG;AAAA,KACoB;AACvB,QAAI,CAAC,OAAO;AACV,6BAAuB;AAAA,IACzB;AAEA,QAAI,UAAU;AAGZ,YAAM,gBAAgB,MAAM;AAC1B,YAAI;AAAkB;AACtB,cAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,cAAM,YAAY,SAAS,eAAe,OAAO,OAAO,CAAC,CAAC;AAC1D,iBAAS,KAAK,YAAY,KAAK;AAC/B,eAAO,MAAM;AACX,mBAAS,KAAK,YAAY,KAAK;AAAA,QACjC;AAAA,MACF,GAAG,CAAC,gBAAgB,CAAC;AAAA,IACvB;AAEA,WACE,oCAAC,0BAA0B,UAA1B;AAAA,MAAmC,OAAO;AAAA,OACzC,oCAAC,4BACC,oCAAC;AAAA,MACC,QAAQ,OAAO;AAAA,MACf,cAAc,OAAO,gBAAgB;AAAA,MACrC,sBAAsB,OAAO;AAAA,MAC7B,uBAAuB,OAAO;AAAA,MAC7B,GAAG;AAAA,OAEH,QACH,CACF,CACF;AAAA,EAEJ;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { THEME_CLASSNAME_PREFIX } from "./constants/constants";
|
|
2
|
-
import { createVariable, isVariable } from "./createVariable";
|
|
3
|
-
import { tokensValueToVariable } from "./helpers/registerCSSVariable";
|
|
4
|
-
import { GetThemeUnwrapped } from "./hooks/getThemeUnwrapped";
|
|
5
|
-
const themes = {};
|
|
6
|
-
function ensureThemeVariable(theme, key) {
|
|
7
|
-
const val = theme[key];
|
|
8
|
-
const themeKey = key;
|
|
9
|
-
if (!isVariable(val)) {
|
|
10
|
-
theme[key] = createVariable({
|
|
11
|
-
key: themeKey,
|
|
12
|
-
name: themeKey,
|
|
13
|
-
val
|
|
14
|
-
});
|
|
15
|
-
} else {
|
|
16
|
-
if (val.name !== themeKey) {
|
|
17
|
-
theme[key] = createVariable({
|
|
18
|
-
key: val.name,
|
|
19
|
-
name: themeKey,
|
|
20
|
-
val: val.val
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function proxyThemeToParents(themeName, themes2) {
|
|
26
|
-
const cur = [];
|
|
27
|
-
const parents = themeName.split("_").slice(0, -1).map((part) => {
|
|
28
|
-
cur.push(part);
|
|
29
|
-
return cur.join("_");
|
|
30
|
-
});
|
|
31
|
-
if (!parents.length) {
|
|
32
|
-
return themes2[themeName];
|
|
33
|
-
}
|
|
34
|
-
const og = themes2[themeName];
|
|
35
|
-
return new Proxy(og, {
|
|
36
|
-
get(target, key) {
|
|
37
|
-
if (key === GetThemeUnwrapped) {
|
|
38
|
-
return og;
|
|
39
|
-
}
|
|
40
|
-
if (Reflect.has(target, key)) {
|
|
41
|
-
return Reflect.get(target, key);
|
|
42
|
-
}
|
|
43
|
-
for (let i = parents.length - 1; i >= 0; i--) {
|
|
44
|
-
const parent = themes2[parents[i]];
|
|
45
|
-
if (!parent) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (Reflect.has(parent, key)) {
|
|
49
|
-
return Reflect.get(parent, key);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return Reflect.get(target, key);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function getThemeCSSRules({
|
|
57
|
-
config,
|
|
58
|
-
themeName,
|
|
59
|
-
theme,
|
|
60
|
-
names
|
|
61
|
-
}) {
|
|
62
|
-
const cssRuleSets = [];
|
|
63
|
-
const hasDarkLight = "light" in config.themes && "dark" in config.themes;
|
|
64
|
-
const CNP = `.${THEME_CLASSNAME_PREFIX}`;
|
|
65
|
-
let vars = "";
|
|
66
|
-
for (const themeKey in theme) {
|
|
67
|
-
const variable = theme[themeKey];
|
|
68
|
-
let value = null;
|
|
69
|
-
if (variable.isFloating || !tokensValueToVariable.has(variable.val)) {
|
|
70
|
-
value = variable.val;
|
|
71
|
-
} else {
|
|
72
|
-
value = tokensValueToVariable.get(variable.val).variable;
|
|
73
|
-
}
|
|
74
|
-
vars += `--${themeKey}:${value};`;
|
|
75
|
-
}
|
|
76
|
-
const isDarkOrLightBase = themeName === "dark" || themeName === "light";
|
|
77
|
-
const selectors = names.map((name) => {
|
|
78
|
-
return `${CNP}${name}`;
|
|
79
|
-
});
|
|
80
|
-
if (hasDarkLight) {
|
|
81
|
-
for (const subName of names) {
|
|
82
|
-
const isDark = isDarkOrLightBase || subName.startsWith("dark_");
|
|
83
|
-
const childSelector = `${CNP}${subName.replace(isDark ? "dark_" : "light_", "")}`;
|
|
84
|
-
const order = isDark ? ["dark", "light"] : ["light", "dark"];
|
|
85
|
-
if (isDarkOrLightBase) {
|
|
86
|
-
order.reverse();
|
|
87
|
-
}
|
|
88
|
-
const [stronger, weaker] = order;
|
|
89
|
-
const max = config.maxDarkLightNesting ?? 3;
|
|
90
|
-
new Array(Math.round(max * 1.5)).fill(void 0).forEach((_, pi) => {
|
|
91
|
-
const isOdd = pi % 2 === 1;
|
|
92
|
-
if (isOdd && pi < 3)
|
|
93
|
-
return;
|
|
94
|
-
const parents = new Array(pi + 1).fill(void 0).map((_2, psi) => {
|
|
95
|
-
return `${CNP}${psi % 2 === 0 ? stronger : weaker}`;
|
|
96
|
-
});
|
|
97
|
-
let parentSelectors = parents.length > 1 ? parents.slice(1) : parents;
|
|
98
|
-
if (isOdd) {
|
|
99
|
-
const [_first, second, ...rest] = parentSelectors;
|
|
100
|
-
parentSelectors = [second, ...rest, second];
|
|
101
|
-
}
|
|
102
|
-
const lastParentSelector = parentSelectors[parentSelectors.length - 1];
|
|
103
|
-
selectors.push(`${parentSelectors.join(" ")} ${childSelector === lastParentSelector ? "" : childSelector}`);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
const rootSep = config.themeClassNameOnRoot ? "" : " ";
|
|
108
|
-
const css = `${selectors.map((x) => `:root${rootSep}${x}`).join(", ")} {${vars}}`;
|
|
109
|
-
cssRuleSets.push(css);
|
|
110
|
-
if (config.shouldAddPrefersColorThemes && isDarkOrLightBase) {
|
|
111
|
-
const isDark = themeName.startsWith("dark");
|
|
112
|
-
cssRuleSets.push(`@media(prefers-color-scheme: ${isDark ? "dark" : "light"}) {
|
|
113
|
-
body { background:${theme.background}; color: ${theme.color} }
|
|
114
|
-
:root {${vars} }
|
|
115
|
-
}`);
|
|
116
|
-
}
|
|
117
|
-
return cssRuleSets;
|
|
118
|
-
}
|
|
119
|
-
export {
|
|
120
|
-
ensureThemeVariable,
|
|
121
|
-
getThemeCSSRules,
|
|
122
|
-
proxyThemeToParents,
|
|
123
|
-
themes
|
|
124
|
-
};
|
|
125
|
-
//# sourceMappingURL=ensureThemeVariable.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/helpers/ensureThemeVariable.ts"],
|
|
4
|
-
"sourcesContent": ["import { THEME_CLASSNAME_PREFIX } from './constants/constants'\nimport { Variable, createVariable, isVariable } from './createVariable'\nimport { tokensValueToVariable } from './helpers/registerCSSVariable'\nimport { GetThemeUnwrapped } from './hooks/getThemeUnwrapped'\nimport { CreateTamaguiProps, ThemeObject } from './types'\n\nexport const themes = {}\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}\nexport function proxyThemeToParents(themeName: string, themes: CreateTamaguiProps['themes']) {\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 if (!parents.length) {\n return themes[themeName]\n }\n\n // proxy fallback values to parent theme values\n const og = themes[themeName]\n return new Proxy(og, {\n get(target, key) {\n if (key === GetThemeUnwrapped) {\n return og\n }\n if (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}\nexport function getThemeCSSRules({\n config,\n themeName,\n theme,\n names,\n}: {\n config: CreateTamaguiProps\n themeName: string\n theme: ThemeObject\n names: string[]\n}) {\n const cssRuleSets: string[] = []\n\n // special case for SSR\n const hasDarkLight = 'light' in config.themes && 'dark' in config.themes\n const CNP = `.${THEME_CLASSNAME_PREFIX}`\n let vars = ''\n\n // themeToVariableToValueMap.set(theme, {})\n // const varToValMap = themeToVariableToValueMap.get(theme)\n for (const themeKey in theme) {\n const variable = theme[themeKey] as Variable\n let value: any = null\n // if (varToValMap) {\n // varToValMap[variable.variable] = variable.val\n // }\n if (variable.isFloating || !tokensValueToVariable.has(variable.val)) {\n value = variable.val\n } else {\n value = tokensValueToVariable.get(variable.val)!.variable\n }\n vars += `--${themeKey}:${value};`\n }\n\n const isDarkOrLightBase = themeName === 'dark' || themeName === 'light'\n const selectors = names.map((name) => {\n return `${CNP}${name}`\n })\n\n // since we dont specify dark/light in classnames we have to do an awkward specificity war\n // use config.maxDarkLightNesting to determine how deep you can nest until it breaks\n if (hasDarkLight) {\n for (const subName of names) {\n const isDark = isDarkOrLightBase || subName.startsWith('dark_')\n const childSelector = `${CNP}${subName.replace(isDark ? 'dark_' : 'light_', '')}`\n const order = isDark ? ['dark', 'light'] : ['light', 'dark']\n if (isDarkOrLightBase) {\n order.reverse()\n }\n const [stronger, weaker] = order\n const max = config.maxDarkLightNesting ?? 3\n\n new Array(Math.round(max * 1.5)).fill(undefined).forEach((_, pi) => {\n const isOdd = pi % 2 === 1\n if (isOdd && pi < 3) return\n const parents = new Array(pi + 1).fill(undefined).map((_, psi) => {\n return `${CNP}${psi % 2 === 0 ? stronger : weaker}`\n })\n let parentSelectors = parents.length > 1 ? parents.slice(1) : parents\n if (isOdd) {\n const [_first, second, ...rest] = parentSelectors\n parentSelectors = [second, ...rest, second]\n }\n // avoid .t_light .t_light at the end (make sure child is unique from last parent)\n const lastParentSelector = parentSelectors[parentSelectors.length - 1]\n selectors.push(\n `${parentSelectors.join(' ')} ${\n childSelector === lastParentSelector ? '' : childSelector\n }`\n )\n })\n }\n }\n\n const rootSep = config.themeClassNameOnRoot ? '' : ' '\n const css = `${selectors.map((x) => `:root${rootSep}${x}`).join(', ')} {${vars}}`\n cssRuleSets.push(css)\n\n if (config.shouldAddPrefersColorThemes && isDarkOrLightBase) {\n // add media prefers for dark/light base\n const isDark = themeName.startsWith('dark')\n cssRuleSets.push(\n `@media(prefers-color-scheme: ${isDark ? 'dark' : 'light'}) {\nbody { background:${theme.background};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G,QAAQ;AAChE,iBAAO,GAAG,MAAM,MAAM,MAAM,IAAI,WAAW;AAAA,QAC7C,CAAC;AACD,YAAI,kBAAkB,QAAQ,SAAS,IAAI,QAAQ,MAAM,CAAC,IAAI;AAC9D,YAAI,OAAO;AACT,gBAAM,CAAC,QAAQ,WAAW,QAAQ;AAClC,4BAAkB,CAAC,QAAQ,GAAG,MAAM,MAAM;AAAA,QAC5C;AAEA,cAAM,qBAAqB,gBAAgB,gBAAgB,SAAS;AACpE,kBAAU,KACR,GAAG,gBAAgB,KAAK,GAAG,KACzB,kBAAkB,qBAAqB,KAAK,eAEhD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,QAAM,UAAU,OAAO,uBAAuB,KAAK;AACnD,QAAM,MAAM,GAAG,UAAU,IAAI,CAAC,MAAM,QAAQ,UAAU,GAAG,EAAE,KAAK,IAAI,MAAM;AAC1E,cAAY,KAAK,GAAG;AAEpB,MAAI,OAAO,+BAA+B,mBAAmB;AAE3D,UAAM,SAAS,UAAU,WAAW,MAAM;AAC1C,gBAAY,KACV,gCAAgC,SAAS,SAAS;AAAA,oBACpC,MAAM,sBAAsB,MAAM;AAAA,SAC7C;AAAA,EAEL;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/loadTheme.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { getConfig } from "./conf";
|
|
2
|
-
import { ensureThemeVariable, getThemeCSSRules, proxyThemeToParents } from "./helpers/themes";
|
|
3
|
-
const loadTheme = ({
|
|
4
|
-
name: themeName,
|
|
5
|
-
theme: themeIn,
|
|
6
|
-
insertCSS
|
|
7
|
-
}) => {
|
|
8
|
-
const config = getConfig();
|
|
9
|
-
if (!config) {
|
|
10
|
-
throw new Error(`Must run createTamagui once before loading theme`);
|
|
11
|
-
}
|
|
12
|
-
if (config.themes[themeName]) {
|
|
13
|
-
throw new Error(`Already defined theme "${themeName}", use updateTheme to change values`);
|
|
14
|
-
}
|
|
15
|
-
const theme = { ...themeIn };
|
|
16
|
-
for (const key in theme) {
|
|
17
|
-
ensureThemeVariable(theme, key);
|
|
18
|
-
}
|
|
19
|
-
const cssRules = getThemeCSSRules({
|
|
20
|
-
config,
|
|
21
|
-
themeName,
|
|
22
|
-
names: [themeName],
|
|
23
|
-
theme
|
|
24
|
-
});
|
|
25
|
-
const themeProxied = proxyThemeToParents(themeName, theme, config.themes);
|
|
26
|
-
config.themes[themeName] = themeProxied;
|
|
27
|
-
if (insertCSS && typeof document !== "undefined") {
|
|
28
|
-
const style = document.createElement("style");
|
|
29
|
-
style.appendChild(document.createTextNode(cssRules.join("\n")));
|
|
30
|
-
document.head.appendChild(style);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
theme: themeProxied,
|
|
34
|
-
cssRules
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
loadTheme
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=loadTheme.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/loadTheme.ts"],
|
|
4
|
-
"sourcesContent": ["import { getConfig } from './conf'\nimport { ensureThemeVariable, getThemeCSSRules, proxyThemeToParents } from './helpers/themes'\nimport { ThemeObject } from './types'\n\nexport const loadTheme = ({\n name: themeName,\n theme: themeIn,\n insertCSS,\n}: {\n name: string\n theme: ThemeObject\n insertCSS?: boolean\n}) => {\n const config = getConfig()\n if (!config) {\n throw new Error(`Must run createTamagui once before loading theme`)\n }\n if (config.themes[themeName]) {\n throw new Error(`Already defined theme \"${themeName}\", use updateTheme to change values`)\n }\n const theme = { ...themeIn }\n for (const key in theme) {\n ensureThemeVariable(theme, key)\n }\n const cssRules = getThemeCSSRules({\n config,\n themeName,\n names: [themeName],\n theme,\n })\n const themeProxied = proxyThemeToParents(themeName, theme, config.themes)\n config.themes[themeName] = themeProxied\n\n if (insertCSS && typeof document !== 'undefined') {\n const style = document.createElement('style')\n style.appendChild(document.createTextNode(cssRules.join('\\n')))\n document.head.appendChild(style)\n }\n\n return {\n theme: themeProxied,\n cssRules,\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AACA;AAGO,MAAM,YAAY,CAAC;AAAA,EACxB,MAAM;AAAA,EACN,OAAO;AAAA,EACP;AAAA,MAKI;AACJ,QAAM,SAAS,UAAU;AACzB,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AACA,MAAI,OAAO,OAAO,YAAY;AAC5B,UAAM,IAAI,MAAM,0BAA0B,8CAA8C;AAAA,EAC1F;AACA,QAAM,QAAQ,EAAE,GAAG,QAAQ;AAC3B,aAAW,OAAO,OAAO;AACvB,wBAAoB,OAAO,GAAG;AAAA,EAChC;AACA,QAAM,WAAW,iBAAiB;AAAA,IAChC;AAAA,IACA;AAAA,IACA,OAAO,CAAC,SAAS;AAAA,IACjB;AAAA,EACF,CAAC;AACD,QAAM,eAAe,oBAAoB,WAAW,OAAO,OAAO,MAAM;AACxE,SAAO,OAAO,aAAa;AAE3B,MAAI,aAAa,OAAO,aAAa,aAAa;AAChD,UAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,UAAM,YAAY,SAAS,eAAe,SAAS,KAAK,IAAI,CAAC,CAAC;AAC9D,aAAS,KAAK,YAAY,KAAK;AAAA,EACjC;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { TextAncestorContext as RNWTextAncestorContext } from "@tamagui/rnw";
|
|
2
|
-
import React, { createContext } from "react";
|
|
3
|
-
const FallbackNativeContext = createContext(false);
|
|
4
|
-
const TextAncestorContext = RNWTextAncestorContext ?? FallbackNativeContext;
|
|
5
|
-
const TextAncestorProvider = (props) => {
|
|
6
|
-
return /* @__PURE__ */ React.createElement(TextAncestorContext.Provider, {
|
|
7
|
-
value: false
|
|
8
|
-
}, props.children);
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
FallbackNativeContext,
|
|
12
|
-
TextAncestorContext,
|
|
13
|
-
TextAncestorProvider
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=TextAncestorContext.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/views/TextAncestorContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import { TextAncestorContext as RNWTextAncestorContext } from '@tamagui/rnw'\nimport React, { createContext } from 'react'\n\nexport const FallbackNativeContext = createContext(false)\n\nexport const TextAncestorContext = RNWTextAncestorContext ?? FallbackNativeContext\n\nexport const TextAncestorProvider = (props) => {\n return <TextAncestorContext.Provider value={false}>{props.children}</TextAncestorContext.Provider>\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AACA;AAEO,MAAM,wBAAwB,cAAc,KAAK;AAEjD,MAAM,sBAAsB,0BAA0B;AAEtD,MAAM,uBAAuB,CAAC,UAAU;AAC7C,SAAO,oCAAC,oBAAoB,UAApB;AAAA,IAA6B,OAAO;AAAA,KAAQ,MAAM,QAAS;AACrE;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { TamaguiInternalConfig, TamaguiProviderProps } from '../types';
|
|
2
|
-
export declare function createTamaguiProvider(config: TamaguiInternalConfig): ({ disableInjectCSS, children, ...themePropsProvider }: TamaguiProviderProps) => JSX.Element;
|
|
3
|
-
//# sourceMappingURL=createTamaguiProvider.d.ts.map
|