@tamagui/web 1.2.5
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/README.md +1 -0
- package/dist/cjs/Tamagui.js +77 -0
- package/dist/cjs/Tamagui.js.map +7 -0
- package/dist/cjs/addTheme.js +78 -0
- package/dist/cjs/addTheme.js.map +7 -0
- package/dist/cjs/config.js +91 -0
- package/dist/cjs/config.js.map +7 -0
- package/dist/cjs/constants/constants.js +49 -0
- package/dist/cjs/constants/constants.js.map +7 -0
- package/dist/cjs/constants/isDevTools.js +37 -0
- package/dist/cjs/constants/isDevTools.js.map +7 -0
- package/dist/cjs/contexts/ButtonNestingContext.js +30 -0
- package/dist/cjs/contexts/ButtonNestingContext.js.map +7 -0
- package/dist/cjs/contexts/FontLanguageContext.js +30 -0
- package/dist/cjs/contexts/FontLanguageContext.js.map +7 -0
- package/dist/cjs/contexts/TextAncestorContext.js +30 -0
- package/dist/cjs/contexts/TextAncestorContext.js.map +7 -0
- package/dist/cjs/createComponent.js +874 -0
- package/dist/cjs/createComponent.js.map +7 -0
- package/dist/cjs/createFont.js +69 -0
- package/dist/cjs/createFont.js.map +7 -0
- package/dist/cjs/createShorthands.js +31 -0
- package/dist/cjs/createShorthands.js.map +7 -0
- package/dist/cjs/createTamagui.js +206 -0
- package/dist/cjs/createTamagui.js.map +7 -0
- package/dist/cjs/createTheme.js +31 -0
- package/dist/cjs/createTheme.js.map +7 -0
- package/dist/cjs/createTokens.js +39 -0
- package/dist/cjs/createTokens.js.map +7 -0
- package/dist/cjs/createVariable.js +111 -0
- package/dist/cjs/createVariable.js.map +7 -0
- package/dist/cjs/createVariables.js +60 -0
- package/dist/cjs/createVariables.js.map +7 -0
- package/dist/cjs/helpers/RNComponents.js +40 -0
- package/dist/cjs/helpers/RNComponents.js.map +7 -0
- package/dist/cjs/helpers/ThemeManager.js +234 -0
- package/dist/cjs/helpers/ThemeManager.js.map +7 -0
- package/dist/cjs/helpers/ThemeManagerContext.js +30 -0
- package/dist/cjs/helpers/ThemeManagerContext.js.map +7 -0
- package/dist/cjs/helpers/createMediaStyle.js +67 -0
- package/dist/cjs/helpers/createMediaStyle.js.map +7 -0
- package/dist/cjs/helpers/createPropMapper.js +423 -0
- package/dist/cjs/helpers/createPropMapper.js.map +7 -0
- package/dist/cjs/helpers/createProxy.js +43 -0
- package/dist/cjs/helpers/createProxy.js.map +7 -0
- package/dist/cjs/helpers/expandStyle.js +95 -0
- package/dist/cjs/helpers/expandStyle.js.map +7 -0
- package/dist/cjs/helpers/expandStyles.js +116 -0
- package/dist/cjs/helpers/expandStyles.js.map +7 -0
- package/dist/cjs/helpers/extendStaticConfig.js +91 -0
- package/dist/cjs/helpers/extendStaticConfig.js.map +7 -0
- package/dist/cjs/helpers/getAnimationDriver.js +32 -0
- package/dist/cjs/helpers/getAnimationDriver.js.map +7 -0
- package/dist/cjs/helpers/getExpandedShorthands.js +40 -0
- package/dist/cjs/helpers/getExpandedShorthands.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/getSplitStyles.js +850 -0
- package/dist/cjs/helpers/getSplitStyles.js.map +7 -0
- package/dist/cjs/helpers/getStylesAtomic.js +226 -0
- package/dist/cjs/helpers/getStylesAtomic.js.map +7 -0
- package/dist/cjs/helpers/getStylesAtomic.native.js +38 -0
- package/dist/cjs/helpers/getStylesAtomic.native.js.map +7 -0
- package/dist/cjs/helpers/getThemeCSSRules.js +110 -0
- package/dist/cjs/helpers/getThemeCSSRules.js.map +7 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js +31 -0
- package/dist/cjs/helpers/getThemeCSSRules.native.js.map +7 -0
- package/dist/cjs/helpers/getVariantExtras.js +92 -0
- package/dist/cjs/helpers/getVariantExtras.js.map +7 -0
- package/dist/cjs/helpers/insertStyleRule.js +218 -0
- package/dist/cjs/helpers/insertStyleRule.js.map +7 -0
- package/dist/cjs/helpers/isObj.js +29 -0
- package/dist/cjs/helpers/isObj.js.map +7 -0
- package/dist/cjs/helpers/isTamaguiComponent.js +32 -0
- package/dist/cjs/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/cjs/helpers/isTamaguiElement.js +33 -0
- package/dist/cjs/helpers/isTamaguiElement.js.map +7 -0
- package/dist/cjs/helpers/matchMedia.js +42 -0
- package/dist/cjs/helpers/matchMedia.js.map +7 -0
- package/dist/cjs/helpers/matchMedia.native.js +48 -0
- package/dist/cjs/helpers/matchMedia.native.js.map +7 -0
- package/dist/cjs/helpers/mergeProps.js +54 -0
- package/dist/cjs/helpers/mergeProps.js.map +7 -0
- package/dist/cjs/helpers/mergeTransform.js +47 -0
- package/dist/cjs/helpers/mergeTransform.js.map +7 -0
- package/dist/cjs/helpers/normalizeColor.js +71 -0
- package/dist/cjs/helpers/normalizeColor.js.map +7 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js +138 -0
- package/dist/cjs/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/cjs/helpers/proxyThemeVariables.js +40 -0
- package/dist/cjs/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/cjs/helpers/pseudoDescriptors.js +53 -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/themeable.js +62 -0
- package/dist/cjs/helpers/themeable.js.map +7 -0
- package/dist/cjs/helpers/themes.js +78 -0
- package/dist/cjs/helpers/themes.js.map +7 -0
- package/dist/cjs/helpers/timer.js +35 -0
- package/dist/cjs/helpers/timer.js.map +7 -0
- package/dist/cjs/helpers/useShallowSetState.js +59 -0
- package/dist/cjs/helpers/useShallowSetState.js.map +7 -0
- package/dist/cjs/helpers/warnOnce.js +38 -0
- package/dist/cjs/helpers/warnOnce.js.map +7 -0
- package/dist/cjs/helpers/withStaticProperties.js +32 -0
- package/dist/cjs/helpers/withStaticProperties.js.map +7 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js +34 -0
- package/dist/cjs/hooks/getThemeUnwrapped.js.map +7 -0
- package/dist/cjs/hooks/useId.js +29 -0
- package/dist/cjs/hooks/useId.js.map +7 -0
- package/dist/cjs/hooks/useIsTouchDevice.js +33 -0
- package/dist/cjs/hooks/useIsTouchDevice.js.map +7 -0
- package/dist/cjs/hooks/useMedia.js +263 -0
- package/dist/cjs/hooks/useMedia.js.map +7 -0
- package/dist/cjs/hooks/useSafeRef.js +59 -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/useStyle.js +61 -0
- package/dist/cjs/hooks/useStyle.js.map +7 -0
- package/dist/cjs/hooks/useTheme.js +230 -0
- package/dist/cjs/hooks/useTheme.js.map +7 -0
- package/dist/cjs/hooks/useThemeName.js +52 -0
- package/dist/cjs/hooks/useThemeName.js.map +7 -0
- package/dist/cjs/index.js +104 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/inject-styles.js +40 -0
- package/dist/cjs/inject-styles.js.map +7 -0
- package/dist/cjs/insertFont.js +93 -0
- package/dist/cjs/insertFont.js.map +7 -0
- package/dist/cjs/setupHooks.js +34 -0
- package/dist/cjs/setupHooks.js.map +7 -0
- package/dist/cjs/setupReactNative.js +51 -0
- package/dist/cjs/setupReactNative.js.map +7 -0
- package/dist/cjs/styled.js +95 -0
- package/dist/cjs/styled.js.map +7 -0
- package/dist/cjs/types.js +17 -0
- package/dist/cjs/types.js.map +7 -0
- package/dist/cjs/updateTheme.js +47 -0
- package/dist/cjs/updateTheme.js.map +7 -0
- package/dist/cjs/views/FontLanguage.js +41 -0
- package/dist/cjs/views/FontLanguage.js.map +7 -0
- package/dist/cjs/views/FontLanguage.native.js +35 -0
- package/dist/cjs/views/FontLanguage.native.js.map +7 -0
- package/dist/cjs/views/FontLanguage.types.js +17 -0
- package/dist/cjs/views/FontLanguage.types.js.map +7 -0
- package/dist/cjs/views/Slot.js +92 -0
- package/dist/cjs/views/Slot.js.map +7 -0
- package/dist/cjs/views/Stack.js +38 -0
- package/dist/cjs/views/Stack.js.map +7 -0
- package/dist/cjs/views/TamaguiProvider.js +90 -0
- package/dist/cjs/views/TamaguiProvider.js.map +7 -0
- package/dist/cjs/views/Text.js +94 -0
- package/dist/cjs/views/Text.js.map +7 -0
- package/dist/cjs/views/Theme.js +88 -0
- package/dist/cjs/views/Theme.js.map +7 -0
- package/dist/cjs/views/ThemeProvider.js +70 -0
- package/dist/cjs/views/ThemeProvider.js.map +7 -0
- package/dist/esm/Tamagui.js +41 -0
- package/dist/esm/Tamagui.js.map +7 -0
- package/dist/esm/addTheme.js +54 -0
- package/dist/esm/addTheme.js.map +7 -0
- package/dist/esm/config.js +58 -0
- package/dist/esm/config.js.map +7 -0
- package/dist/esm/constants/constants.js +22 -0
- package/dist/esm/constants/constants.js.map +7 -0
- package/dist/esm/constants/isDevTools.js +13 -0
- package/dist/esm/constants/isDevTools.js.map +7 -0
- package/dist/esm/contexts/ButtonNestingContext.js +6 -0
- package/dist/esm/contexts/ButtonNestingContext.js.map +7 -0
- package/dist/esm/contexts/FontLanguageContext.js +6 -0
- package/dist/esm/contexts/FontLanguageContext.js.map +7 -0
- package/dist/esm/contexts/TextAncestorContext.js +6 -0
- package/dist/esm/contexts/TextAncestorContext.js.map +7 -0
- package/dist/esm/createComponent.js +849 -0
- package/dist/esm/createComponent.js.map +7 -0
- package/dist/esm/createFont.js +45 -0
- package/dist/esm/createFont.js.map +7 -0
- package/dist/esm/createShorthands.js +7 -0
- package/dist/esm/createShorthands.js.map +7 -0
- package/dist/esm/createTamagui.js +190 -0
- package/dist/esm/createTamagui.js.map +7 -0
- package/dist/esm/createTheme.js +7 -0
- package/dist/esm/createTheme.js.map +7 -0
- package/dist/esm/createTokens.js +15 -0
- package/dist/esm/createTokens.js.map +7 -0
- package/dist/esm/createVariable.js +78 -0
- package/dist/esm/createVariable.js.map +7 -0
- package/dist/esm/createVariables.js +35 -0
- package/dist/esm/createVariables.js.map +7 -0
- package/dist/esm/helpers/RNComponents.js +16 -0
- package/dist/esm/helpers/RNComponents.js.map +7 -0
- package/dist/esm/helpers/ThemeManager.js +209 -0
- package/dist/esm/helpers/ThemeManager.js.map +7 -0
- package/dist/esm/helpers/ThemeManagerContext.js +6 -0
- package/dist/esm/helpers/ThemeManagerContext.js.map +7 -0
- package/dist/esm/helpers/createMediaStyle.js +42 -0
- package/dist/esm/helpers/createMediaStyle.js.map +7 -0
- package/dist/esm/helpers/createPropMapper.js +396 -0
- package/dist/esm/helpers/createPropMapper.js.map +7 -0
- package/dist/esm/helpers/createProxy.js +19 -0
- package/dist/esm/helpers/createProxy.js.map +7 -0
- package/dist/esm/helpers/expandStyle.js +71 -0
- package/dist/esm/helpers/expandStyle.js.map +7 -0
- package/dist/esm/helpers/expandStyles.js +90 -0
- package/dist/esm/helpers/expandStyles.js.map +7 -0
- package/dist/esm/helpers/extendStaticConfig.js +66 -0
- package/dist/esm/helpers/extendStaticConfig.js.map +7 -0
- package/dist/esm/helpers/getAnimationDriver.js +8 -0
- package/dist/esm/helpers/getAnimationDriver.js.map +7 -0
- package/dist/esm/helpers/getExpandedShorthands.js +16 -0
- package/dist/esm/helpers/getExpandedShorthands.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/getSplitStyles.js +849 -0
- package/dist/esm/helpers/getSplitStyles.js.map +7 -0
- package/dist/esm/helpers/getStylesAtomic.js +200 -0
- package/dist/esm/helpers/getStylesAtomic.js.map +7 -0
- package/dist/esm/helpers/getStylesAtomic.native.js +12 -0
- package/dist/esm/helpers/getStylesAtomic.native.js.map +7 -0
- package/dist/esm/helpers/getThemeCSSRules.js +86 -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 +67 -0
- package/dist/esm/helpers/getVariantExtras.js.map +7 -0
- package/dist/esm/helpers/insertStyleRule.js +186 -0
- package/dist/esm/helpers/insertStyleRule.js.map +7 -0
- package/dist/esm/helpers/isObj.js +5 -0
- package/dist/esm/helpers/isObj.js.map +7 -0
- package/dist/esm/helpers/isTamaguiComponent.js +8 -0
- package/dist/esm/helpers/isTamaguiComponent.js.map +7 -0
- package/dist/esm/helpers/isTamaguiElement.js +9 -0
- package/dist/esm/helpers/isTamaguiElement.js.map +7 -0
- package/dist/esm/helpers/matchMedia.js +17 -0
- package/dist/esm/helpers/matchMedia.js.map +7 -0
- package/dist/esm/helpers/matchMedia.native.js +23 -0
- package/dist/esm/helpers/matchMedia.native.js.map +7 -0
- package/dist/esm/helpers/mergeProps.js +30 -0
- package/dist/esm/helpers/mergeProps.js.map +7 -0
- package/dist/esm/helpers/mergeTransform.js +21 -0
- package/dist/esm/helpers/mergeTransform.js.map +7 -0
- package/dist/esm/helpers/normalizeColor.js +36 -0
- package/dist/esm/helpers/normalizeColor.js.map +7 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js +113 -0
- package/dist/esm/helpers/normalizeValueWithProperty.js.map +7 -0
- package/dist/esm/helpers/proxyThemeVariables.js +16 -0
- package/dist/esm/helpers/proxyThemeVariables.js.map +7 -0
- package/dist/esm/helpers/pseudoDescriptors.js +29 -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/themeable.js +28 -0
- package/dist/esm/helpers/themeable.js.map +7 -0
- package/dist/esm/helpers/themes.js +53 -0
- package/dist/esm/helpers/themes.js.map +7 -0
- package/dist/esm/helpers/timer.js +11 -0
- package/dist/esm/helpers/timer.js.map +7 -0
- package/dist/esm/helpers/useShallowSetState.js +35 -0
- package/dist/esm/helpers/useShallowSetState.js.map +7 -0
- package/dist/esm/helpers/warnOnce.js +14 -0
- package/dist/esm/helpers/warnOnce.js.map +7 -0
- package/dist/esm/helpers/withStaticProperties.js +8 -0
- package/dist/esm/helpers/withStaticProperties.js.map +7 -0
- package/dist/esm/hooks/getThemeUnwrapped.js +9 -0
- package/dist/esm/hooks/getThemeUnwrapped.js.map +7 -0
- package/dist/esm/hooks/useId.js +5 -0
- package/dist/esm/hooks/useId.js.map +7 -0
- package/dist/esm/hooks/useIsTouchDevice.js +9 -0
- package/dist/esm/hooks/useIsTouchDevice.js.map +7 -0
- package/dist/esm/hooks/useMedia.js +225 -0
- package/dist/esm/hooks/useMedia.js.map +7 -0
- package/dist/esm/hooks/useSafeRef.js +35 -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/useStyle.js +37 -0
- package/dist/esm/hooks/useStyle.js.map +7 -0
- package/dist/esm/hooks/useTheme.js +205 -0
- package/dist/esm/hooks/useTheme.js.map +7 -0
- package/dist/esm/hooks/useThemeName.js +28 -0
- package/dist/esm/hooks/useThemeName.js.map +7 -0
- package/dist/esm/index.js +77 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/inject-styles.js +16 -0
- package/dist/esm/inject-styles.js.map +7 -0
- package/dist/esm/insertFont.js +67 -0
- package/dist/esm/insertFont.js.map +7 -0
- package/dist/esm/setupHooks.js +9 -0
- package/dist/esm/setupHooks.js.map +7 -0
- package/dist/esm/setupReactNative.js +25 -0
- package/dist/esm/setupReactNative.js.map +7 -0
- package/dist/esm/styled.js +71 -0
- package/dist/esm/styled.js.map +7 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +7 -0
- package/dist/esm/updateTheme.js +23 -0
- package/dist/esm/updateTheme.js.map +7 -0
- package/dist/esm/views/FontLanguage.js +17 -0
- package/dist/esm/views/FontLanguage.js.map +7 -0
- package/dist/esm/views/FontLanguage.native.js +11 -0
- package/dist/esm/views/FontLanguage.native.js.map +7 -0
- package/dist/esm/views/FontLanguage.types.js +1 -0
- package/dist/esm/views/FontLanguage.types.js.map +7 -0
- package/dist/esm/views/Slot.js +66 -0
- package/dist/esm/views/Slot.js.map +7 -0
- package/dist/esm/views/Stack.js +14 -0
- package/dist/esm/views/Stack.js.map +7 -0
- package/dist/esm/views/TamaguiProvider.js +56 -0
- package/dist/esm/views/TamaguiProvider.js.map +7 -0
- package/dist/esm/views/Text.js +70 -0
- package/dist/esm/views/Text.js.map +7 -0
- package/dist/esm/views/Theme.js +63 -0
- package/dist/esm/views/Theme.js.map +7 -0
- package/dist/esm/views/ThemeProvider.js +45 -0
- package/dist/esm/views/ThemeProvider.js.map +7 -0
- package/package.json +73 -0
- package/reset.css +37 -0
- package/src/Tamagui.ts +48 -0
- package/src/addTheme.ts +65 -0
- package/src/config.ts +62 -0
- package/src/constants/constants.ts +17 -0
- package/src/constants/isDevTools.ts +12 -0
- package/src/contexts/ButtonNestingContext.tsx +3 -0
- package/src/contexts/FontLanguageContext.tsx +5 -0
- package/src/contexts/TextAncestorContext.tsx +3 -0
- package/src/createComponent.tsx +1133 -0
- package/src/createFont.ts +50 -0
- package/src/createShorthands.ts +7 -0
- package/src/createTamagui.ts +253 -0
- package/src/createTheme.ts +13 -0
- package/src/createTokens.ts +46 -0
- package/src/createVariable.ts +93 -0
- package/src/createVariables.ts +55 -0
- package/src/helpers/RNComponents.tsx +14 -0
- package/src/helpers/ThemeManager.tsx +285 -0
- package/src/helpers/ThemeManagerContext.tsx +5 -0
- package/src/helpers/createMediaStyle.ts +55 -0
- package/src/helpers/createPropMapper.ts +562 -0
- package/src/helpers/createProxy.ts +16 -0
- package/src/helpers/expandStyle.ts +82 -0
- package/src/helpers/expandStyles.ts +107 -0
- package/src/helpers/extendStaticConfig.ts +78 -0
- package/src/helpers/getAnimationDriver.tsx +5 -0
- package/src/helpers/getExpandedShorthands.ts +17 -0
- package/src/helpers/getFontLanguage.ts +2 -0
- package/src/helpers/getSplitStyles.tsx +1133 -0
- package/src/helpers/getStylesAtomic.native.ts +8 -0
- package/src/helpers/getStylesAtomic.ts +274 -0
- package/src/helpers/getThemeCSSRules.native.ts +3 -0
- package/src/helpers/getThemeCSSRules.ts +120 -0
- package/src/helpers/getVariantExtras.tsx +85 -0
- package/src/helpers/insertStyleRule.tsx +218 -0
- package/src/helpers/isObj.ts +1 -0
- package/src/helpers/isTamaguiComponent.tsx +11 -0
- package/src/helpers/isTamaguiElement.tsx +11 -0
- package/src/helpers/matchMedia.native.ts +23 -0
- package/src/helpers/matchMedia.ts +16 -0
- package/src/helpers/mergeProps.ts +56 -0
- package/src/helpers/mergeTransform.ts +30 -0
- package/src/helpers/normalizeColor.ts +38 -0
- package/src/helpers/normalizeValueWithProperty.ts +129 -0
- package/src/helpers/proxyThemeVariables.tsx +15 -0
- package/src/helpers/pseudoDescriptors.ts +40 -0
- package/src/helpers/registerCSSVariable.ts +13 -0
- package/src/helpers/themeable.tsx +44 -0
- package/src/helpers/themes.ts +67 -0
- package/src/helpers/timer.ts +9 -0
- package/src/helpers/useShallowSetState.tsx +41 -0
- package/src/helpers/warnOnce.tsx +11 -0
- package/src/helpers/withStaticProperties.tsx +7 -0
- package/src/hooks/getThemeUnwrapped.tsx +5 -0
- package/src/hooks/useId.tsx +1 -0
- package/src/hooks/useIsTouchDevice.tsx +6 -0
- package/src/hooks/useMedia.tsx +298 -0
- package/src/hooks/useSafeRef.ts +45 -0
- package/src/hooks/useServerHooks.tsx +12 -0
- package/src/hooks/useStyle.tsx +49 -0
- package/src/hooks/useTheme.tsx +274 -0
- package/src/hooks/useThemeName.tsx +27 -0
- package/src/index.ts +72 -0
- package/src/inject-styles.ts +20 -0
- package/src/insertFont.ts +73 -0
- package/src/setupHooks.ts +35 -0
- package/src/setupReactNative.ts +22 -0
- package/src/styled.tsx +195 -0
- package/src/types.tsx +1459 -0
- package/src/updateTheme.ts +26 -0
- package/src/views/FontLanguage.native.tsx +12 -0
- package/src/views/FontLanguage.tsx +16 -0
- package/src/views/FontLanguage.types.ts +13 -0
- package/src/views/Slot.tsx +95 -0
- package/src/views/Stack.tsx +25 -0
- package/src/views/TamaguiProvider.tsx +65 -0
- package/src/views/Text.tsx +87 -0
- package/src/views/Theme.tsx +83 -0
- package/src/views/ThemeProvider.tsx +55 -0
- package/types/Tamagui.d.ts +30 -0
- package/types/Tamagui.d.ts.map +1 -0
- package/types/addTheme.d.ts +32 -0
- package/types/addTheme.d.ts.map +1 -0
- package/types/config.d.ts +49 -0
- package/types/config.d.ts.map +1 -0
- package/types/constants/constants.d.ts +21 -0
- package/types/constants/constants.d.ts.map +1 -0
- package/types/constants/isDevTools.d.ts +2 -0
- package/types/constants/isDevTools.d.ts.map +1 -0
- package/types/contexts/ButtonNestingContext.d.ts +3 -0
- package/types/contexts/ButtonNestingContext.d.ts.map +1 -0
- package/types/contexts/FontLanguageContext.d.ts +5 -0
- package/types/contexts/FontLanguageContext.d.ts.map +1 -0
- package/types/contexts/TextAncestorContext.d.ts +3 -0
- package/types/contexts/TextAncestorContext.d.ts.map +1 -0
- package/types/createComponent.d.ts +23 -0
- package/types/createComponent.d.ts.map +1 -0
- package/types/createFont.d.ts +3 -0
- package/types/createFont.d.ts.map +1 -0
- package/types/createShorthands.d.ts +3 -0
- package/types/createShorthands.d.ts.map +1 -0
- package/types/createTamagui.d.ts +3 -0
- package/types/createTamagui.d.ts.map +1 -0
- package/types/createTheme.d.ts +7 -0
- package/types/createTheme.d.ts.map +1 -0
- package/types/createTokens.d.ts +28 -0
- package/types/createTokens.d.ts.map +1 -0
- package/types/createVariable.d.ts +26 -0
- package/types/createVariable.d.ts.map +1 -0
- package/types/createVariables.d.ts +11 -0
- package/types/createVariables.d.ts.map +1 -0
- package/types/helpers/RNComponents.d.ts +2 -0
- package/types/helpers/RNComponents.d.ts.map +1 -0
- package/types/helpers/ThemeManager.d.ts +36 -0
- package/types/helpers/ThemeManager.d.ts.map +1 -0
- package/types/helpers/ThemeManagerContext.d.ts +4 -0
- package/types/helpers/ThemeManagerContext.d.ts.map +1 -0
- package/types/helpers/createMediaStyle.d.ts +5 -0
- package/types/helpers/createMediaStyle.d.ts.map +1 -0
- package/types/helpers/createPropMapper.d.ts +7 -0
- package/types/helpers/createPropMapper.d.ts.map +1 -0
- package/types/helpers/createProxy.d.ts +2 -0
- package/types/helpers/createProxy.d.ts.map +1 -0
- package/types/helpers/expandStyle.d.ts +6 -0
- package/types/helpers/expandStyle.d.ts.map +1 -0
- package/types/helpers/expandStyles.d.ts +26 -0
- package/types/helpers/expandStyles.d.ts.map +1 -0
- package/types/helpers/extendStaticConfig.d.ts +4 -0
- package/types/helpers/extendStaticConfig.d.ts.map +1 -0
- package/types/helpers/getAnimationDriver.d.ts +6 -0
- package/types/helpers/getAnimationDriver.d.ts.map +1 -0
- package/types/helpers/getExpandedShorthands.d.ts +3 -0
- package/types/helpers/getExpandedShorthands.d.ts.map +1 -0
- package/types/helpers/getFontLanguage.d.ts +2 -0
- package/types/helpers/getFontLanguage.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +31 -0
- package/types/helpers/getSplitStyles.d.ts.map +1 -0
- package/types/helpers/getStylesAtomic.d.ts +18 -0
- package/types/helpers/getStylesAtomic.d.ts.map +1 -0
- package/types/helpers/getStylesAtomic.native.d.ts +4 -0
- package/types/helpers/getStylesAtomic.native.d.ts.map +1 -0
- package/types/helpers/getThemeCSSRules.d.ts +8 -0
- package/types/helpers/getThemeCSSRules.d.ts.map +1 -0
- package/types/helpers/getThemeCSSRules.native.d.ts +2 -0
- package/types/helpers/getThemeCSSRules.native.d.ts.map +1 -0
- package/types/helpers/getVariantExtras.d.ts +5 -0
- package/types/helpers/getVariantExtras.d.ts.map +1 -0
- package/types/helpers/insertStyleRule.d.ts +11 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -0
- package/types/helpers/isObj.d.ts +2 -0
- package/types/helpers/isObj.d.ts.map +1 -0
- package/types/helpers/isTamaguiComponent.d.ts +5 -0
- package/types/helpers/isTamaguiComponent.d.ts.map +1 -0
- package/types/helpers/isTamaguiElement.d.ts +3 -0
- package/types/helpers/isTamaguiElement.d.ts.map +1 -0
- package/types/helpers/matchMedia.d.ts +6 -0
- package/types/helpers/matchMedia.d.ts.map +1 -0
- package/types/helpers/matchMedia.native.d.ts +4 -0
- package/types/helpers/matchMedia.native.d.ts.map +1 -0
- package/types/helpers/mergeProps.d.ts +17 -0
- package/types/helpers/mergeProps.d.ts.map +1 -0
- package/types/helpers/mergeTransform.d.ts +9 -0
- package/types/helpers/mergeTransform.d.ts.map +1 -0
- package/types/helpers/normalizeColor.d.ts +4 -0
- package/types/helpers/normalizeColor.d.ts.map +1 -0
- package/types/helpers/normalizeValueWithProperty.d.ts +7 -0
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -0
- package/types/helpers/proxyThemeVariables.d.ts +2 -0
- package/types/helpers/proxyThemeVariables.d.ts.map +1 -0
- package/types/helpers/pseudoDescriptors.d.ts +10 -0
- package/types/helpers/pseudoDescriptors.d.ts.map +1 -0
- package/types/helpers/registerCSSVariable.d.ts +5 -0
- package/types/helpers/registerCSSVariable.d.ts.map +1 -0
- package/types/helpers/themeable.d.ts +12 -0
- package/types/helpers/themeable.d.ts.map +1 -0
- package/types/helpers/themes.d.ts +4 -0
- package/types/helpers/themes.d.ts.map +1 -0
- package/types/helpers/timer.d.ts +2 -0
- package/types/helpers/timer.d.ts.map +1 -0
- package/types/helpers/useShallowSetState.d.ts +5 -0
- package/types/helpers/useShallowSetState.d.ts.map +1 -0
- package/types/helpers/warnOnce.d.ts +2 -0
- package/types/helpers/warnOnce.d.ts.map +1 -0
- package/types/helpers/withStaticProperties.d.ts +2 -0
- package/types/helpers/withStaticProperties.d.ts.map +1 -0
- package/types/hooks/getThemeUnwrapped.d.ts +3 -0
- package/types/hooks/getThemeUnwrapped.d.ts.map +1 -0
- package/types/hooks/useId.d.ts +2 -0
- package/types/hooks/useId.d.ts.map +1 -0
- package/types/hooks/useIsTouchDevice.d.ts +2 -0
- package/types/hooks/useIsTouchDevice.d.ts.map +1 -0
- package/types/hooks/useMedia.d.ts +33 -0
- package/types/hooks/useMedia.d.ts.map +1 -0
- package/types/hooks/useSafeRef.d.ts +4 -0
- package/types/hooks/useSafeRef.d.ts.map +1 -0
- package/types/hooks/useServerHooks.d.ts +4 -0
- package/types/hooks/useServerHooks.d.ts.map +1 -0
- package/types/hooks/useStyle.d.ts +8 -0
- package/types/hooks/useStyle.d.ts.map +1 -0
- package/types/hooks/useTheme.d.ts +25 -0
- package/types/hooks/useTheme.d.ts.map +1 -0
- package/types/hooks/useThemeName.d.ts +5 -0
- package/types/hooks/useThemeName.d.ts.map +1 -0
- package/types/index.d.ts +56 -0
- package/types/index.d.ts.map +1 -0
- package/types/inject-styles.d.ts +7 -0
- package/types/inject-styles.d.ts.map +1 -0
- package/types/insertFont.d.ts +9 -0
- package/types/insertFont.d.ts.map +1 -0
- package/types/setupHooks.d.ts +14 -0
- package/types/setupHooks.d.ts.map +1 -0
- package/types/setupReactNative.d.ts +5 -0
- package/types/setupReactNative.d.ts.map +1 -0
- package/types/styled.d.ts +20 -0
- package/types/styled.d.ts.map +1 -0
- package/types/types.d.ts +715 -0
- package/types/types.d.ts.map +1 -0
- package/types/updateTheme.d.ts +30 -0
- package/types/updateTheme.d.ts.map +1 -0
- package/types/views/FontLanguage.d.ts +4 -0
- package/types/views/FontLanguage.d.ts.map +1 -0
- package/types/views/FontLanguage.native.d.ts +4 -0
- package/types/views/FontLanguage.native.d.ts.map +1 -0
- package/types/views/FontLanguage.types.d.ts +11 -0
- package/types/views/FontLanguage.types.d.ts.map +1 -0
- package/types/views/Slot.d.ts +11 -0
- package/types/views/Slot.d.ts.map +1 -0
- package/types/views/Stack.d.ts +4 -0
- package/types/views/Stack.d.ts.map +1 -0
- package/types/views/TamaguiProvider.d.ts +4 -0
- package/types/views/TamaguiProvider.d.ts.map +1 -0
- package/types/views/Text.d.ts +4 -0
- package/types/views/Text.d.ts.map +1 -0
- package/types/views/Theme.d.ts +8 -0
- package/types/views/Theme.d.ts.map +1 -0
- package/types/views/ThemeProvider.d.ts +12 -0
- package/types/views/ThemeProvider.d.ts.map +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { addTheme } from './addTheme'
|
|
2
|
+
import { activeThemeManagers } from './hooks/useTheme'
|
|
3
|
+
import { ThemeDefinition } from './types'
|
|
4
|
+
|
|
5
|
+
export function updateTheme({
|
|
6
|
+
name,
|
|
7
|
+
theme,
|
|
8
|
+
}: {
|
|
9
|
+
name: string
|
|
10
|
+
theme: Partial<Record<keyof ThemeDefinition, any>>
|
|
11
|
+
}) {
|
|
12
|
+
const next = addTheme({ name, theme, insertCSS: true, update: true })
|
|
13
|
+
|
|
14
|
+
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
15
|
+
activeThemeManagers.forEach((manager) => {
|
|
16
|
+
if (manager.state.name === name) {
|
|
17
|
+
manager.updateState({
|
|
18
|
+
name,
|
|
19
|
+
forceTheme: next.theme,
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return next
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
|
|
3
|
+
import { FontLanguageContext } from '../contexts/FontLanguageContext'
|
|
4
|
+
import { FontLanguageProps } from './FontLanguage.types'
|
|
5
|
+
|
|
6
|
+
export const FontLanguage = ({ children, ...props }: FontLanguageProps) => {
|
|
7
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8
|
+
const value = useMemo(() => props, [JSON.stringify(props)])
|
|
9
|
+
return (
|
|
10
|
+
<FontLanguageContext.Provider value={value}>{children}</FontLanguageContext.Provider>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FontLanguageProps } from './FontLanguage.types'
|
|
2
|
+
|
|
3
|
+
export const FontLanguage = ({ children, ...props }: FontLanguageProps) => {
|
|
4
|
+
return (
|
|
5
|
+
<div
|
|
6
|
+
style={{
|
|
7
|
+
display: 'contents',
|
|
8
|
+
}}
|
|
9
|
+
className={Object.entries(props)
|
|
10
|
+
.map(([name, language]) => `t_lang-${name}-${language}`)
|
|
11
|
+
.join(' ')}
|
|
12
|
+
>
|
|
13
|
+
{children}
|
|
14
|
+
</div>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { FontLanguages, FontTokens } from '../types'
|
|
4
|
+
|
|
5
|
+
type FontFamilies = FontTokens extends `$${infer Token}` ? Token : never
|
|
6
|
+
|
|
7
|
+
export type LanguageContextType = Partial<{
|
|
8
|
+
[key in FontFamilies]: FontLanguages | 'default'
|
|
9
|
+
}>
|
|
10
|
+
|
|
11
|
+
export type FontLanguageProps = LanguageContextType & {
|
|
12
|
+
children?: React.ReactNode
|
|
13
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// via radix
|
|
2
|
+
|
|
3
|
+
import { composeRefs } from '@tamagui/compose-refs'
|
|
4
|
+
import { isWeb } from '@tamagui/constants'
|
|
5
|
+
import { Children, ReactNode, cloneElement, forwardRef, isValidElement } from 'react'
|
|
6
|
+
|
|
7
|
+
/* -------------------------------------------------------------------------------------------------
|
|
8
|
+
* Slot
|
|
9
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
10
|
+
|
|
11
|
+
interface SlotProps {
|
|
12
|
+
children: ReactNode
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const Slot = forwardRef<any, SlotProps>(function Slot(props, forwardedRef) {
|
|
16
|
+
const { children, ...slotProps } = props
|
|
17
|
+
|
|
18
|
+
if (isValidElement(children)) {
|
|
19
|
+
const childProps = {
|
|
20
|
+
...mergeSlotProps(children, slotProps),
|
|
21
|
+
ref: composeRefs(forwardedRef, (children as any).ref),
|
|
22
|
+
}
|
|
23
|
+
return cloneElement(children, childProps)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return Children.count(children) > 1 ? Children.only(null) : null
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
/* -------------------------------------------------------------------------------------------------
|
|
30
|
+
* Slottable
|
|
31
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
32
|
+
|
|
33
|
+
export const Slottable = ({ children }: { children: ReactNode }) => {
|
|
34
|
+
return <>{children}</>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* ---------------------------------------------------------------------------------------------- */
|
|
38
|
+
|
|
39
|
+
const pressMap = isWeb
|
|
40
|
+
? {
|
|
41
|
+
onPress: 'onClick',
|
|
42
|
+
onPressOut: 'onMouseUp',
|
|
43
|
+
onPressIn: 'onMouseDown',
|
|
44
|
+
}
|
|
45
|
+
: {}
|
|
46
|
+
|
|
47
|
+
function mergeSlotProps(child: any, slotProps: Record<string, any>) {
|
|
48
|
+
const childProps = child.props
|
|
49
|
+
|
|
50
|
+
// all child props should override
|
|
51
|
+
const overrideProps = { ...childProps }
|
|
52
|
+
const isHTMLChild = typeof child.type === 'string'
|
|
53
|
+
|
|
54
|
+
if (isHTMLChild) {
|
|
55
|
+
for (const key in pressMap) {
|
|
56
|
+
if (key in slotProps) {
|
|
57
|
+
slotProps[pressMap[key]] = slotProps[key]
|
|
58
|
+
delete slotProps[key]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
for (let propName in childProps) {
|
|
64
|
+
const slotPropValue = slotProps[propName]
|
|
65
|
+
const childPropValue = childProps[propName]
|
|
66
|
+
|
|
67
|
+
if (isHTMLChild && pressMap[propName]) {
|
|
68
|
+
propName = pressMap[propName]
|
|
69
|
+
delete overrideProps[propName]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const isHandler = handleRegex.test(propName)
|
|
73
|
+
// if it's a handler, modify the override by composing the base handler
|
|
74
|
+
if (isHandler) {
|
|
75
|
+
overrideProps[propName] = mergeEvent(childPropValue, slotPropValue)
|
|
76
|
+
}
|
|
77
|
+
// if it's `style`, we merge them
|
|
78
|
+
else if (propName === 'style') {
|
|
79
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue }
|
|
80
|
+
} else if (propName === 'className') {
|
|
81
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(' ')
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return { ...slotProps, ...overrideProps }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const handleRegex = /^on[A-Z]/
|
|
89
|
+
|
|
90
|
+
export function mergeEvent(a?: Function, b?: Function) {
|
|
91
|
+
return (...args: unknown[]) => {
|
|
92
|
+
a?.(...args)
|
|
93
|
+
b?.(...args)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { View } from 'react-native'
|
|
2
|
+
|
|
3
|
+
import { stackDefaultStyles } from '../constants/constants'
|
|
4
|
+
import { createComponent } from '../createComponent'
|
|
5
|
+
import { StackProps, StackPropsBase } from '../types'
|
|
6
|
+
|
|
7
|
+
export const Stack = createComponent<StackProps, View, StackPropsBase>({
|
|
8
|
+
componentName: 'Stack',
|
|
9
|
+
acceptsClassName: true,
|
|
10
|
+
defaultProps: {
|
|
11
|
+
...stackDefaultStyles,
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
// test types
|
|
17
|
+
// export const YStack = styled(Stack, {
|
|
18
|
+
// flexDirection: 'column',
|
|
19
|
+
// })
|
|
20
|
+
// // test types
|
|
21
|
+
// const x00 = <Stack missing={0} /> // should err
|
|
22
|
+
// const x0 = <YStack missing={0} /> // should err
|
|
23
|
+
// const x1 = (props: StackProps) => <YStack {...props} />
|
|
24
|
+
// type ys = typeof YStack
|
|
25
|
+
// type ysv = ys extends StaticComponent<any, infer V> ? V : unknown
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { isClient, isRSC, isServer, isWeb } from '@tamagui/constants'
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { ButtonNestingContext } from '../contexts/ButtonNestingContext'
|
|
5
|
+
import { TextAncestorContext } from '../contexts/TextAncestorContext'
|
|
6
|
+
import { useMediaListeners } from '../hooks/useMedia'
|
|
7
|
+
import type { TamaguiProviderProps } from '../types'
|
|
8
|
+
import { ThemeProvider } from './ThemeProvider'
|
|
9
|
+
|
|
10
|
+
export function TamaguiProvider({
|
|
11
|
+
children,
|
|
12
|
+
disableInjectCSS,
|
|
13
|
+
config,
|
|
14
|
+
...themePropsProvider
|
|
15
|
+
}: TamaguiProviderProps) {
|
|
16
|
+
if (isRSC) {
|
|
17
|
+
return (
|
|
18
|
+
<span
|
|
19
|
+
style={{ display: 'contents' }}
|
|
20
|
+
className={`t_${Object.keys(config.themes)[0] || 'light'}`}
|
|
21
|
+
>
|
|
22
|
+
{children}
|
|
23
|
+
</span>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!(isWeb && isServer)) {
|
|
28
|
+
useMediaListeners(config)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (isClient) {
|
|
32
|
+
// inject CSS if asked to (not SSR compliant)
|
|
33
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
34
|
+
React.useLayoutEffect(() => {
|
|
35
|
+
// for easier support of hidden-until-js mount animations
|
|
36
|
+
// user must set t_unmounted on documentElement from SSR
|
|
37
|
+
if (document.documentElement.classList.contains('t_unmounted')) {
|
|
38
|
+
document.documentElement.classList.remove('t_unmounted')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (disableInjectCSS) return
|
|
42
|
+
const style = document.createElement('style')
|
|
43
|
+
style.appendChild(document.createTextNode(config.getCSS()))
|
|
44
|
+
document.head.appendChild(style)
|
|
45
|
+
return () => {
|
|
46
|
+
document.head.removeChild(style)
|
|
47
|
+
}
|
|
48
|
+
}, [config, disableInjectCSS])
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<ButtonNestingContext.Provider value={false}>
|
|
53
|
+
<TextAncestorContext.Provider value={false}>
|
|
54
|
+
<ThemeProvider
|
|
55
|
+
themeClassNameOnRoot={config.themeClassNameOnRoot}
|
|
56
|
+
disableRootThemeClass={config.disableRootThemeClass}
|
|
57
|
+
{...themePropsProvider}
|
|
58
|
+
defaultTheme={themePropsProvider.defaultTheme ?? Object.keys(config.themes)[0]}
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</ThemeProvider>
|
|
62
|
+
</TextAncestorContext.Provider>
|
|
63
|
+
</ButtonNestingContext.Provider>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { isWeb } from '@tamagui/constants'
|
|
2
|
+
import { stylePropsTextOnly, validStyles } from '@tamagui/helpers'
|
|
3
|
+
import type { Text as TextView } from 'react-native'
|
|
4
|
+
|
|
5
|
+
import { createComponent } from '../createComponent'
|
|
6
|
+
import { TextProps, TextPropsBase } from '../types'
|
|
7
|
+
|
|
8
|
+
const ellipseStyle = {
|
|
9
|
+
maxWidth: '100%',
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
textOverflow: 'ellipsis',
|
|
12
|
+
whiteSpace: 'nowrap',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const Text = createComponent<TextProps, TextView, TextPropsBase>({
|
|
16
|
+
componentName: 'Text',
|
|
17
|
+
acceptsClassName: true,
|
|
18
|
+
isText: true,
|
|
19
|
+
|
|
20
|
+
defaultProps: {
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
display: 'flex',
|
|
23
|
+
fontFamily: 'System',
|
|
24
|
+
...(isWeb
|
|
25
|
+
? {
|
|
26
|
+
display: 'inline',
|
|
27
|
+
boxSizing: 'border-box',
|
|
28
|
+
wordWrap: 'break-word',
|
|
29
|
+
margin: 0,
|
|
30
|
+
}
|
|
31
|
+
: {
|
|
32
|
+
suppressHighlighting: true,
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
inlineWhenUnflattened: new Set(['fontFamily']),
|
|
37
|
+
|
|
38
|
+
variants: {
|
|
39
|
+
...(isWeb && {
|
|
40
|
+
numberOfLines: {
|
|
41
|
+
1: ellipseStyle,
|
|
42
|
+
|
|
43
|
+
':number': (numberOfLines) =>
|
|
44
|
+
numberOfLines >= 1
|
|
45
|
+
? {
|
|
46
|
+
WebkitLineClamp: numberOfLines,
|
|
47
|
+
WebkitBoxOrient: 'vertical',
|
|
48
|
+
display: '-webkit-box',
|
|
49
|
+
overflow: 'hidden',
|
|
50
|
+
}
|
|
51
|
+
: null,
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
|
|
55
|
+
// ??
|
|
56
|
+
ellipsizeMode: {
|
|
57
|
+
'...': () => null,
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
selectable: {
|
|
61
|
+
true: {
|
|
62
|
+
userSelect: 'text',
|
|
63
|
+
cursor: 'text',
|
|
64
|
+
},
|
|
65
|
+
false: {
|
|
66
|
+
userSelect: 'none',
|
|
67
|
+
cursor: 'default',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
ellipse: {
|
|
72
|
+
true: isWeb
|
|
73
|
+
? ellipseStyle
|
|
74
|
+
: {
|
|
75
|
+
numberOfLines: 1,
|
|
76
|
+
lineBreakMode: 'clip',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
deoptProps: new Set(isWeb ? [] : ['ellipse']),
|
|
82
|
+
|
|
83
|
+
validStyles: {
|
|
84
|
+
...validStyles,
|
|
85
|
+
...stylePropsTextOnly,
|
|
86
|
+
},
|
|
87
|
+
})
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isWeb } from '@tamagui/constants'
|
|
2
|
+
import { Children, cloneElement } from 'react'
|
|
3
|
+
|
|
4
|
+
import { variableToString } from '../createVariable'
|
|
5
|
+
import { ThemeManagerContext } from '../helpers/ThemeManagerContext'
|
|
6
|
+
import { useServerRef } from '../hooks/useServerHooks'
|
|
7
|
+
import { ChangedThemeResponse, useChangeThemeEffect } from '../hooks/useTheme'
|
|
8
|
+
import { ThemeProps } from '../types'
|
|
9
|
+
|
|
10
|
+
export function Theme(props: ThemeProps) {
|
|
11
|
+
// @ts-expect-error only for internal views
|
|
12
|
+
if (props.disable) return props.children
|
|
13
|
+
const isRoot = !!props['_isRoot']
|
|
14
|
+
const themeState = useChangeThemeEffect(props, isRoot)
|
|
15
|
+
const children = props['data-themeable']
|
|
16
|
+
? Children.map(props.children, (child) =>
|
|
17
|
+
cloneElement(child, { ['data-themeable']: true })
|
|
18
|
+
)
|
|
19
|
+
: props.children
|
|
20
|
+
|
|
21
|
+
return useThemedChildren(themeState, children, props)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function useThemedChildren(
|
|
25
|
+
themeState: ChangedThemeResponse,
|
|
26
|
+
children: any,
|
|
27
|
+
options: { forceClassName?: boolean; shallow?: boolean }
|
|
28
|
+
) {
|
|
29
|
+
const { themeManager, isNewTheme, className, theme } = themeState
|
|
30
|
+
const { shallow, forceClassName } = options
|
|
31
|
+
|
|
32
|
+
const hasEverThemed = useServerRef(false)
|
|
33
|
+
if (isNewTheme) {
|
|
34
|
+
hasEverThemed.current = true
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// once a theme is set it always passes the context to avoid reparenting
|
|
38
|
+
// until then no context to avoid lots of context
|
|
39
|
+
if (!isNewTheme && !hasEverThemed.current && !forceClassName && !shallow) {
|
|
40
|
+
return children
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// be sure to memoize shouldReset to avoid reparenting
|
|
44
|
+
let next = children
|
|
45
|
+
|
|
46
|
+
if (shallow && themeManager) {
|
|
47
|
+
next = Children.map(next, (child) => {
|
|
48
|
+
return cloneElement(
|
|
49
|
+
child,
|
|
50
|
+
undefined,
|
|
51
|
+
<Theme name={themeManager.state.parentName}>{child.props.children}</Theme>
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
next = (
|
|
57
|
+
<ThemeManagerContext.Provider value={themeManager}>
|
|
58
|
+
{next}
|
|
59
|
+
</ThemeManagerContext.Provider>
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
if (isWeb) {
|
|
63
|
+
const enableClassName =
|
|
64
|
+
forceClassName === true || (forceClassName !== false && isNewTheme)
|
|
65
|
+
return (
|
|
66
|
+
<span
|
|
67
|
+
className="_dsp_contents"
|
|
68
|
+
{...(theme &&
|
|
69
|
+
enableClassName && {
|
|
70
|
+
className: `${className} ${forceClassName ? 'forced1' : ''} _dsp_contents`,
|
|
71
|
+
style: {
|
|
72
|
+
// in order to provide currentColor, set color by default
|
|
73
|
+
color: variableToString(theme.color),
|
|
74
|
+
},
|
|
75
|
+
})}
|
|
76
|
+
>
|
|
77
|
+
{next}
|
|
78
|
+
</span>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return next
|
|
83
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { isClient } from '@tamagui/constants'
|
|
2
|
+
import { createContext, useLayoutEffect, useMemo } from 'react'
|
|
3
|
+
|
|
4
|
+
import { THEME_CLASSNAME_PREFIX } from '../constants/constants'
|
|
5
|
+
import { Theme } from './Theme'
|
|
6
|
+
|
|
7
|
+
export type ThemeProviderProps = {
|
|
8
|
+
className?: string
|
|
9
|
+
defaultTheme: string
|
|
10
|
+
disableRootThemeClass?: boolean
|
|
11
|
+
themeClassNameOnRoot?: boolean
|
|
12
|
+
children?: any
|
|
13
|
+
reset?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const ThemeProviderRootContext = createContext<Pick<
|
|
17
|
+
ThemeProviderProps,
|
|
18
|
+
'defaultTheme'
|
|
19
|
+
> | null>(null)
|
|
20
|
+
|
|
21
|
+
export const ThemeProvider = (props: ThemeProviderProps) => {
|
|
22
|
+
// ensure theme is attached to root body node as well to work with modals by default
|
|
23
|
+
if (isClient) {
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
if (props.disableRootThemeClass) return
|
|
26
|
+
const cn = `${THEME_CLASSNAME_PREFIX}${props.defaultTheme}`
|
|
27
|
+
const target = props.themeClassNameOnRoot ? document.documentElement : document.body
|
|
28
|
+
target.classList.add(cn)
|
|
29
|
+
return () => {
|
|
30
|
+
target.classList.remove(cn)
|
|
31
|
+
}
|
|
32
|
+
}, [props.defaultTheme, props.disableRootThemeClass, props.themeClassNameOnRoot])
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<ThemeProviderRootContext.Provider
|
|
37
|
+
value={useMemo(() => {
|
|
38
|
+
return {
|
|
39
|
+
defaultTheme: props.defaultTheme,
|
|
40
|
+
}
|
|
41
|
+
// NOTE DON'T CHANGE THIS ITS ONLY USED BY useThemeName for SSR safety for now...
|
|
42
|
+
}, [])}
|
|
43
|
+
>
|
|
44
|
+
<Theme
|
|
45
|
+
className={props.className}
|
|
46
|
+
name={props.defaultTheme}
|
|
47
|
+
forceClassName={props.disableRootThemeClass ? false : undefined}
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
_isRoot
|
|
50
|
+
>
|
|
51
|
+
{props.children}
|
|
52
|
+
</Theme>
|
|
53
|
+
</ThemeProviderRootContext.Provider>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as Helpers from '@tamagui/helpers';
|
|
2
|
+
declare class TamaguiManager {
|
|
3
|
+
Helpers: typeof Helpers;
|
|
4
|
+
get mediaState(): {
|
|
5
|
+
[x: string]: boolean;
|
|
6
|
+
[x: number]: boolean;
|
|
7
|
+
};
|
|
8
|
+
get config(): import("./types").TamaguiInternalConfig<import("./types").CreateTokens<import("./types").VariableVal>, {
|
|
9
|
+
[key: string]: Partial<import("./types").TamaguiBaseTheme> & {
|
|
10
|
+
[key: string]: import("./types").VariableVal;
|
|
11
|
+
};
|
|
12
|
+
}, import("./types").GenericShorthands, {
|
|
13
|
+
[key: string]: {
|
|
14
|
+
[key: string]: string | number;
|
|
15
|
+
};
|
|
16
|
+
}, {
|
|
17
|
+
[key: string]: string | any[] | {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
};
|
|
20
|
+
}, import("./types").GenericFonts>;
|
|
21
|
+
get insertedRules(): string[];
|
|
22
|
+
get allSelectors(): Record<string, string>;
|
|
23
|
+
get allTransforms(): {};
|
|
24
|
+
get identifierToValue(): Map<string, any>;
|
|
25
|
+
}
|
|
26
|
+
export declare const Tamagui: TamaguiManager;
|
|
27
|
+
export declare const getValueFromIdentifier: (identifier: string) => any;
|
|
28
|
+
export declare const setIdentifierValue: (identifier: string, value: any) => void;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=Tamagui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tamagui.d.ts","sourceRoot":"","sources":["../src/Tamagui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAS3C,cAAM,cAAc;IAClB,OAAO,iBAAU;IAEjB,IAAI,UAAU;;;MAEb;IAED,IAAI,MAAM;;;;;;;;;;;;uCAET;IAED,IAAI,aAAa,aAEhB;IAED,IAAI,YAAY,2BAEf;IAED,IAAI,aAAa,OAEhB;IAED,IAAI,iBAAiB,qBAEpB;CACF;AAED,eAAO,MAAM,OAAO,gBAAuB,CAAA;AAI3C,eAAO,MAAM,sBAAsB,eAAgB,MAAM,QAExD,CAAA;AAED,eAAO,MAAM,kBAAkB,eAAgB,MAAM,SAAS,GAAG,SAEhE,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ThemeDefinition } from './types';
|
|
2
|
+
export declare function addTheme(props: {
|
|
3
|
+
name: string;
|
|
4
|
+
theme: Partial<Record<keyof ThemeDefinition, any>>;
|
|
5
|
+
insertCSS?: boolean;
|
|
6
|
+
update?: boolean;
|
|
7
|
+
}): {
|
|
8
|
+
theme: {
|
|
9
|
+
[x: string]: import("./createVariable").Variable<any>;
|
|
10
|
+
background?: import("./createVariable").Variable<any> | undefined;
|
|
11
|
+
backgroundHover?: import("./createVariable").Variable<any> | undefined;
|
|
12
|
+
backgroundPress?: import("./createVariable").Variable<any> | undefined;
|
|
13
|
+
backgroundFocus?: import("./createVariable").Variable<any> | undefined;
|
|
14
|
+
color?: import("./createVariable").Variable<any> | undefined;
|
|
15
|
+
colorHover?: import("./createVariable").Variable<any> | undefined;
|
|
16
|
+
colorPress?: import("./createVariable").Variable<any> | undefined;
|
|
17
|
+
colorFocus?: import("./createVariable").Variable<any> | undefined;
|
|
18
|
+
borderColor?: import("./createVariable").Variable<any> | undefined;
|
|
19
|
+
borderColorHover?: import("./createVariable").Variable<any> | undefined;
|
|
20
|
+
borderColorPress?: import("./createVariable").Variable<any> | undefined;
|
|
21
|
+
borderColorFocus?: import("./createVariable").Variable<any> | undefined;
|
|
22
|
+
shadowColor?: import("./createVariable").Variable<any> | undefined;
|
|
23
|
+
shadowColorHover?: import("./createVariable").Variable<any> | undefined;
|
|
24
|
+
shadowColorPress?: import("./createVariable").Variable<any> | undefined;
|
|
25
|
+
shadowColorFocus?: import("./createVariable").Variable<any> | undefined;
|
|
26
|
+
};
|
|
27
|
+
cssRules?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
theme: any;
|
|
30
|
+
cssRules: string[];
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=addTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addTheme.d.ts","sourceRoot":"","sources":["../src/addTheme.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAe,MAAM,SAAS,CAAA;AAEtD,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,eAAe,EAAE,GAAG,CAAC,CAAC,CAAA;IAClD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;;;;;;;;;;;;;;;;;;;;;;;;EAoDA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ConfigListener, TamaguiInternalConfig, Tokens } from './types';
|
|
2
|
+
export declare const setConfig: (next: TamaguiInternalConfig) => void;
|
|
3
|
+
export declare const setConfigFont: (name: string, font: any, fontParsed: any) => void;
|
|
4
|
+
export declare const getConfig: () => TamaguiInternalConfig<import("./types").CreateTokens<import("./types").VariableVal>, {
|
|
5
|
+
[key: string]: Partial<import("./types").TamaguiBaseTheme> & {
|
|
6
|
+
[key: string]: import("./types").VariableVal;
|
|
7
|
+
};
|
|
8
|
+
}, import("./types").GenericShorthands, {
|
|
9
|
+
[key: string]: {
|
|
10
|
+
[key: string]: string | number;
|
|
11
|
+
};
|
|
12
|
+
}, {
|
|
13
|
+
[key: string]: string | any[] | {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
};
|
|
16
|
+
}, import("./types").GenericFonts>;
|
|
17
|
+
export declare const getTokens: ({ prefixed }?: {
|
|
18
|
+
prefixed?: boolean | undefined;
|
|
19
|
+
}) => Tokens;
|
|
20
|
+
/**
|
|
21
|
+
* Note: this is the same as `getTokens`
|
|
22
|
+
*/
|
|
23
|
+
export declare const useTokens: () => import("./types").CreateTokens<import("./types").VariableVal>;
|
|
24
|
+
export declare const getThemes: () => {
|
|
25
|
+
[x: string]: {
|
|
26
|
+
[x: string]: import("./createVariable").Variable<any>;
|
|
27
|
+
background?: import("./createVariable").Variable<any> | undefined;
|
|
28
|
+
backgroundHover?: import("./createVariable").Variable<any> | undefined;
|
|
29
|
+
backgroundPress?: import("./createVariable").Variable<any> | undefined;
|
|
30
|
+
backgroundFocus?: import("./createVariable").Variable<any> | undefined;
|
|
31
|
+
color?: import("./createVariable").Variable<any> | undefined;
|
|
32
|
+
colorHover?: import("./createVariable").Variable<any> | undefined;
|
|
33
|
+
colorPress?: import("./createVariable").Variable<any> | undefined;
|
|
34
|
+
colorFocus?: import("./createVariable").Variable<any> | undefined;
|
|
35
|
+
borderColor?: import("./createVariable").Variable<any> | undefined;
|
|
36
|
+
borderColorHover?: import("./createVariable").Variable<any> | undefined;
|
|
37
|
+
borderColorPress?: import("./createVariable").Variable<any> | undefined;
|
|
38
|
+
borderColorFocus?: import("./createVariable").Variable<any> | undefined;
|
|
39
|
+
shadowColor?: import("./createVariable").Variable<any> | undefined;
|
|
40
|
+
shadowColorHover?: import("./createVariable").Variable<any> | undefined;
|
|
41
|
+
shadowColorPress?: import("./createVariable").Variable<any> | undefined;
|
|
42
|
+
shadowColorFocus?: import("./createVariable").Variable<any> | undefined;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare const configListeners: Set<ConfigListener>;
|
|
46
|
+
export declare const onConfiguredOnce: (cb: ConfigListener) => void;
|
|
47
|
+
export declare const updateConfig: (key: string, value: any) => void;
|
|
48
|
+
export declare const getFont: (name: string) => import("./types").GenericFont<string | number>;
|
|
49
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIvE,eAAO,MAAM,SAAS,SAAU,qBAAqB,SAGpD,CAAA;AAED,eAAO,MAAM,aAAa,SAAU,MAAM,QAAQ,GAAG,cAAc,GAAG,SAMrE,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;kCASrB,CAAA;AAED,eAAO,MAAM,SAAS;;MAAuD,MAC/B,CAAA;AAE9C;;GAEG;AACH,eAAO,MAAM,SAAS,qEAAoB,CAAA;AAE1C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CAAqB,CAAA;AAE3C,eAAO,MAAM,eAAe,qBAA4B,CAAA;AAExD,eAAO,MAAM,gBAAgB,OAAQ,cAAc,SAMlD,CAAA;AAED,eAAO,MAAM,YAAY,QAAS,MAAM,SAAS,GAAG,SAEnD,CAAA;AAGD,eAAO,MAAM,OAAO,SAAU,MAAM,mDAQnC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const THEME_NAME_SEPARATOR = "_";
|
|
2
|
+
export declare const THEME_CLASSNAME_PREFIX = "t_";
|
|
3
|
+
export declare const webOnlyDefaultStyles: {
|
|
4
|
+
display: string;
|
|
5
|
+
flexBasis: string;
|
|
6
|
+
boxSizing: string;
|
|
7
|
+
position: string;
|
|
8
|
+
minHeight: number;
|
|
9
|
+
minWidth: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const stackDefaultStyles: {
|
|
12
|
+
display: string;
|
|
13
|
+
flexBasis: string;
|
|
14
|
+
boxSizing: string;
|
|
15
|
+
position: string;
|
|
16
|
+
minHeight: number;
|
|
17
|
+
minWidth: number;
|
|
18
|
+
alignItems: string;
|
|
19
|
+
flexShrink: number;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,MAAM,CAAA;AACvC,eAAO,MAAM,sBAAsB,OAAO,CAAA;AAE1C,eAAO,MAAM,oBAAoB;;;;;;;CAOhC,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;CAI9B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDevTools.d.ts","sourceRoot":"","sources":["../../src/constants/isDevTools.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,KASnB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonNestingContext.d.ts","sourceRoot":"","sources":["../../src/contexts/ButtonNestingContext.tsx"],"names":[],"mappings":";AAEA,eAAO,MAAM,oBAAoB,kCAAuB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontLanguageContext.d.ts","sourceRoot":"","sources":["../../src/contexts/FontLanguageContext.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,mBAAmB;;UAAkD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextAncestorContext.d.ts","sourceRoot":"","sources":["../../src/contexts/TextAncestorContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAA;AAE5C,eAAO,MAAM,mBAAmB,wBAAuB,CAAA"}
|