@tamagui/web 3.0.0-beta.831.1 → 3.0.0-beta.889.1
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/createComponent.cjs +12 -1
- package/dist/cjs/createComponent.native.cjs +12 -1
- package/dist/cjs/createComponent.native.js +12 -1
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createStyledHOC.cjs +1 -1
- package/dist/cjs/createStyledHOC.native.cjs +1 -1
- package/dist/cjs/createStyledHOC.native.js +1 -1
- package/dist/cjs/createStyledHOC.native.js.map +1 -1
- package/dist/cjs/createVariable.cjs +0 -10
- package/dist/cjs/createVariable.native.cjs +0 -10
- package/dist/cjs/createVariable.native.js +0 -10
- package/dist/cjs/createVariable.native.js.map +1 -1
- package/dist/cjs/helpers/borderComponents.cjs +62 -0
- package/dist/cjs/helpers/borderComponents.native.cjs +82 -0
- package/dist/cjs/helpers/borderComponents.native.js +84 -0
- package/dist/cjs/helpers/borderComponents.native.js.map +1 -0
- package/dist/cjs/helpers/createDesignSystem.cjs +0 -2
- package/dist/cjs/helpers/createStyledContext.cjs +10 -18
- package/dist/cjs/helpers/createStyledContext.native.cjs +14 -18
- package/dist/cjs/helpers/createStyledContext.native.js +14 -18
- package/dist/cjs/helpers/createStyledContext.native.js.map +1 -1
- package/dist/cjs/helpers/formatDiagnostic.cjs +6 -6
- package/dist/cjs/helpers/formatDiagnostic.native.cjs +6 -6
- package/dist/cjs/helpers/formatDiagnostic.native.js +6 -6
- package/dist/cjs/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/cjs/helpers/getCSSStylesAtomic.cjs +128 -109
- package/dist/cjs/helpers/getCSSStylesAtomic.native.cjs +11 -3
- package/dist/cjs/helpers/getCSSStylesAtomic.native.js +11 -3
- package/dist/cjs/helpers/getCSSStylesAtomic.native.js.map +1 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.cjs +13 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.cjs +15 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js +15 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
- package/dist/cjs/helpers/getDynamicVal.cjs +5 -1
- package/dist/cjs/helpers/getDynamicVal.native.cjs +5 -1
- package/dist/cjs/helpers/getDynamicVal.native.js +5 -1
- package/dist/cjs/helpers/getDynamicVal.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +1042 -1715
- package/dist/cjs/helpers/getSplitStyles.native.cjs +1081 -1887
- package/dist/cjs/helpers/getSplitStyles.native.js +1081 -1887
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/grammarConfig.cjs +163 -1
- package/dist/cjs/helpers/grammarConfig.native.cjs +186 -1
- package/dist/cjs/helpers/grammarConfig.native.js +186 -1
- package/dist/cjs/helpers/grammarConfig.native.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.cjs +5 -1
- package/dist/cjs/helpers/insertStyleRule.native.cjs +7 -1
- package/dist/cjs/helpers/insertStyleRule.native.js +7 -1
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/log.cjs +9 -8
- package/dist/cjs/helpers/log.native.cjs +9 -8
- package/dist/cjs/helpers/log.native.js +9 -8
- package/dist/cjs/helpers/log.native.js.map +1 -1
- package/dist/cjs/helpers/mergeVariants.cjs +44 -13
- package/dist/cjs/helpers/mergeVariants.native.cjs +79 -14
- package/dist/cjs/helpers/mergeVariants.native.js +79 -14
- package/dist/cjs/helpers/mergeVariants.native.js.map +1 -1
- package/dist/cjs/helpers/nativeOnlyProps.cjs +0 -1
- package/dist/cjs/helpers/nativeOnlyProps.native.cjs +0 -1
- package/dist/cjs/helpers/nativeOnlyProps.native.js +0 -1
- package/dist/cjs/helpers/nativeOnlyProps.native.js.map +1 -1
- package/dist/cjs/helpers/nativeStyleEngine.cjs +34 -14
- package/dist/cjs/helpers/nativeStyleEngine.native.cjs +36 -14
- package/dist/cjs/helpers/nativeStyleEngine.native.js +36 -14
- package/dist/cjs/helpers/nativeStyleEngine.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.cjs +7 -8
- package/dist/cjs/helpers/normalizeValueWithProperty.native.cjs +9 -8
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js +9 -8
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/cjs/helpers/parseBorderShorthand.native.cjs +25 -56
- package/dist/cjs/helpers/parseBorderShorthand.native.js +25 -56
- package/dist/cjs/helpers/parseBorderShorthand.native.js.map +1 -1
- package/dist/cjs/helpers/parseOutlineShorthand.native.cjs +9 -49
- package/dist/cjs/helpers/parseOutlineShorthand.native.js +9 -49
- package/dist/cjs/helpers/parseOutlineShorthand.native.js.map +1 -1
- package/dist/cjs/helpers/resolveSafeArea.cjs +35 -100
- package/dist/cjs/helpers/resolveVariantStyle.cjs +57 -0
- package/dist/cjs/helpers/resolveVariantStyle.native.cjs +67 -0
- package/dist/cjs/helpers/resolveVariantStyle.native.js +69 -0
- package/dist/cjs/helpers/resolveVariantStyle.native.js.map +1 -0
- package/dist/cjs/helpers/styleStaticConfig.cjs +1 -50
- package/dist/cjs/helpers/styleStaticConfig.native.cjs +1 -51
- package/dist/cjs/helpers/styleStaticConfig.native.js +1 -51
- package/dist/cjs/helpers/styleStaticConfig.native.js.map +1 -1
- package/dist/cjs/helpers/styleStaticConfigCore.cjs +107 -0
- package/dist/cjs/helpers/styleStaticConfigCore.native.cjs +127 -0
- package/dist/cjs/helpers/styleStaticConfigCore.native.js +129 -0
- package/dist/cjs/helpers/styleStaticConfigCore.native.js.map +1 -0
- package/dist/cjs/helpers/styledDynamic.cjs +160 -0
- package/dist/cjs/helpers/styledDynamic.native.cjs +195 -0
- package/dist/cjs/helpers/styledDynamic.native.js +197 -0
- package/dist/cjs/helpers/styledDynamic.native.js.map +1 -0
- package/dist/cjs/helpers/tokenCategories.cjs +15 -38
- package/dist/cjs/helpers/tokenCategories.native.cjs +15 -40
- package/dist/cjs/helpers/tokenCategories.native.js +15 -40
- package/dist/cjs/helpers/tokenCategories.native.js.map +1 -1
- package/dist/cjs/helpers/variableValue.cjs +17 -12
- package/dist/cjs/helpers/variableValue.native.cjs +46 -23
- package/dist/cjs/helpers/variableValue.native.js +46 -23
- package/dist/cjs/helpers/variableValue.native.js.map +1 -1
- package/dist/cjs/helpers/warnOnce.cjs +5 -4
- package/dist/cjs/helpers/warnOnce.native.cjs +6 -4
- package/dist/cjs/helpers/warnOnce.native.js +6 -4
- package/dist/cjs/helpers/warnOnce.native.js.map +1 -1
- package/dist/cjs/hooks/useAnimationDriver.cjs +2 -2
- package/dist/cjs/hooks/useAnimationDriver.native.cjs +2 -2
- package/dist/cjs/hooks/useAnimationDriver.native.js +2 -2
- package/dist/cjs/hooks/useAnimationDriver.native.js.map +1 -1
- package/dist/cjs/hooks/useComponentState.cjs +41 -82
- package/dist/cjs/hooks/useComponentState.native.cjs +45 -84
- package/dist/cjs/hooks/useComponentState.native.js +45 -84
- package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
- package/dist/cjs/hooks/useMedia.cjs +2 -2
- package/dist/cjs/hooks/useMedia.native.cjs +2 -2
- package/dist/cjs/hooks/useMedia.native.js +2 -2
- package/dist/cjs/hooks/useMedia.native.js.map +1 -1
- package/dist/cjs/{helpers/directStyleCSS.native.js → hooks/useStyle.cjs} +16 -8
- package/dist/cjs/{helpers/directStyleCSS.native.cjs → hooks/useStyle.native.cjs} +16 -4
- package/dist/cjs/hooks/useStyle.native.js +34 -0
- package/dist/cjs/hooks/useStyle.native.js.map +1 -0
- package/dist/cjs/hooks/useThemeState.cjs +25 -90
- package/dist/cjs/hooks/useThemeState.native.cjs +34 -94
- package/dist/cjs/hooks/useThemeState.native.js +34 -94
- package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
- package/dist/cjs/index.cjs +6 -3
- package/dist/cjs/index.native.cjs +6 -3
- package/dist/cjs/index.native.js +6 -3
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/static-resolve.cjs +2 -2
- package/dist/cjs/static-resolve.native.cjs +2 -2
- package/dist/cjs/static-resolve.native.js +2 -2
- package/dist/cjs/static-resolve.native.js.map +1 -1
- package/dist/cjs/style.cjs +91 -0
- package/dist/cjs/style.native.cjs +98 -0
- package/dist/cjs/style.native.js +100 -0
- package/dist/cjs/style.native.js.map +1 -0
- package/dist/cjs/styled.cjs +11 -6
- package/dist/cjs/styled.native.cjs +11 -6
- package/dist/cjs/styled.native.js +11 -6
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/types.cjs +6 -4
- package/dist/cjs/types.native.cjs +6 -4
- package/dist/cjs/types.native.js +6 -4
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.cjs +1 -2
- package/dist/cjs/views/TamaguiProvider.native.cjs +1 -2
- package/dist/cjs/views/TamaguiProvider.native.js +1 -2
- package/dist/cjs/views/TamaguiProvider.native.js.map +1 -1
- package/dist/cjs/views/Text.cjs +17 -12
- package/dist/cjs/views/Text.native.cjs +1 -0
- package/dist/cjs/views/Text.native.js +1 -0
- package/dist/cjs/views/Text.native.js.map +1 -1
- package/dist/cjs/views/Theme.cjs +3 -3
- package/dist/cjs/views/Theme.native.cjs +3 -3
- package/dist/cjs/views/Theme.native.js +3 -3
- package/dist/cjs/views/Theme.native.js.map +1 -1
- package/dist/cjs/views/ThemeDebug.cjs +1 -4
- package/dist/esm/createComponent.mjs +12 -1
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +12 -1
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createStyledHOC.mjs +1 -1
- package/dist/esm/createStyledHOC.mjs.map +1 -1
- package/dist/esm/createStyledHOC.native.js +1 -1
- package/dist/esm/createStyledHOC.native.js.map +1 -1
- package/dist/esm/createVariable.mjs +1 -9
- package/dist/esm/createVariable.mjs.map +1 -1
- package/dist/esm/createVariable.native.js +1 -9
- package/dist/esm/createVariable.native.js.map +1 -1
- package/dist/esm/helpers/borderComponents.mjs +37 -0
- package/dist/esm/helpers/borderComponents.mjs.map +1 -0
- package/dist/esm/helpers/borderComponents.native.js +55 -0
- package/dist/esm/helpers/borderComponents.native.js.map +1 -0
- package/dist/esm/helpers/createDesignSystem.mjs +0 -2
- package/dist/esm/helpers/createDesignSystem.mjs.map +1 -1
- package/dist/esm/helpers/createStyledContext.mjs +10 -18
- package/dist/esm/helpers/createStyledContext.mjs.map +1 -1
- package/dist/esm/helpers/createStyledContext.native.js +14 -18
- package/dist/esm/helpers/createStyledContext.native.js.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.mjs +6 -6
- package/dist/esm/helpers/formatDiagnostic.mjs.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.native.js +6 -6
- package/dist/esm/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomic.mjs +126 -109
- package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomic.native.js +7 -4
- package/dist/esm/helpers/getCSSStylesAtomic.native.js.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs +8 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js +10 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
- package/dist/esm/helpers/getDynamicVal.mjs +5 -1
- package/dist/esm/helpers/getDynamicVal.mjs.map +1 -1
- package/dist/esm/helpers/getDynamicVal.native.js +5 -1
- package/dist/esm/helpers/getDynamicVal.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +1034 -1705
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +1071 -1871
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/grammarConfig.mjs +164 -2
- package/dist/esm/helpers/grammarConfig.mjs.map +1 -1
- package/dist/esm/helpers/grammarConfig.native.js +187 -2
- package/dist/esm/helpers/grammarConfig.native.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +5 -2
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +7 -2
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/log.mjs +9 -8
- package/dist/esm/helpers/log.mjs.map +1 -1
- package/dist/esm/helpers/log.native.js +9 -8
- package/dist/esm/helpers/log.native.js.map +1 -1
- package/dist/esm/helpers/mergeVariants.mjs +44 -13
- package/dist/esm/helpers/mergeVariants.mjs.map +1 -1
- package/dist/esm/helpers/mergeVariants.native.js +79 -14
- package/dist/esm/helpers/mergeVariants.native.js.map +1 -1
- package/dist/esm/helpers/nativeOnlyProps.mjs +0 -1
- package/dist/esm/helpers/nativeOnlyProps.mjs.map +1 -1
- package/dist/esm/helpers/nativeOnlyProps.native.js +0 -1
- package/dist/esm/helpers/nativeOnlyProps.native.js.map +1 -1
- package/dist/esm/helpers/nativeStyleEngine.mjs +34 -15
- package/dist/esm/helpers/nativeStyleEngine.mjs.map +1 -1
- package/dist/esm/helpers/nativeStyleEngine.native.js +36 -15
- package/dist/esm/helpers/nativeStyleEngine.native.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.mjs +7 -8
- package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.native.js +9 -8
- package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/esm/helpers/parseBorderShorthand.native.js +23 -56
- package/dist/esm/helpers/parseBorderShorthand.native.js.map +1 -1
- package/dist/esm/helpers/parseOutlineShorthand.native.js +10 -49
- package/dist/esm/helpers/parseOutlineShorthand.native.js.map +1 -1
- package/dist/esm/helpers/resolveSafeArea.mjs +35 -97
- package/dist/esm/helpers/resolveSafeArea.mjs.map +1 -1
- package/dist/esm/helpers/resolveVariantStyle.mjs +38 -0
- package/dist/esm/helpers/resolveVariantStyle.mjs.map +1 -0
- package/dist/esm/helpers/resolveVariantStyle.native.js +46 -0
- package/dist/esm/helpers/resolveVariantStyle.native.js.map +1 -0
- package/dist/esm/helpers/styleStaticConfig.mjs +1 -50
- package/dist/esm/helpers/styleStaticConfig.mjs.map +1 -1
- package/dist/esm/helpers/styleStaticConfig.native.js +1 -51
- package/dist/esm/helpers/styleStaticConfig.native.js.map +1 -1
- package/dist/esm/helpers/styleStaticConfigCore.mjs +88 -0
- package/dist/esm/helpers/styleStaticConfigCore.mjs.map +1 -0
- package/dist/esm/helpers/styleStaticConfigCore.native.js +106 -0
- package/dist/esm/helpers/styleStaticConfigCore.native.js.map +1 -0
- package/dist/esm/helpers/styledDynamic.mjs +136 -0
- package/dist/esm/helpers/styledDynamic.mjs.map +1 -0
- package/dist/esm/helpers/styledDynamic.native.js +169 -0
- package/dist/esm/helpers/styledDynamic.native.js.map +1 -0
- package/dist/esm/helpers/tokenCategories.mjs +15 -36
- package/dist/esm/helpers/tokenCategories.mjs.map +1 -1
- package/dist/esm/helpers/tokenCategories.native.js +15 -38
- package/dist/esm/helpers/tokenCategories.native.js.map +1 -1
- package/dist/esm/helpers/variableValue.mjs +17 -12
- package/dist/esm/helpers/variableValue.mjs.map +1 -1
- package/dist/esm/helpers/variableValue.native.js +46 -23
- package/dist/esm/helpers/variableValue.native.js.map +1 -1
- package/dist/esm/helpers/warnOnce.mjs +5 -4
- package/dist/esm/helpers/warnOnce.mjs.map +1 -1
- package/dist/esm/helpers/warnOnce.native.js +6 -4
- package/dist/esm/helpers/warnOnce.native.js.map +1 -1
- package/dist/esm/hooks/useAnimationDriver.mjs +2 -2
- package/dist/esm/hooks/useAnimationDriver.mjs.map +1 -1
- package/dist/esm/hooks/useAnimationDriver.native.js +2 -2
- package/dist/esm/hooks/useAnimationDriver.native.js.map +1 -1
- package/dist/esm/hooks/useComponentState.mjs +41 -82
- package/dist/esm/hooks/useComponentState.mjs.map +1 -1
- package/dist/esm/hooks/useComponentState.native.js +45 -84
- package/dist/esm/hooks/useComponentState.native.js.map +1 -1
- package/dist/esm/hooks/useMedia.mjs +2 -2
- package/dist/esm/hooks/useMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +2 -2
- package/dist/esm/hooks/useMedia.native.js.map +1 -1
- package/dist/esm/hooks/useStyle.mjs +11 -0
- package/dist/esm/hooks/useStyle.mjs.map +1 -0
- package/dist/esm/hooks/useStyle.native.js +11 -0
- package/dist/esm/hooks/useStyle.native.js.map +1 -0
- package/dist/esm/hooks/useThemeState.mjs +25 -90
- package/dist/esm/hooks/useThemeState.mjs.map +1 -1
- package/dist/esm/hooks/useThemeState.native.js +34 -94
- package/dist/esm/hooks/useThemeState.native.js.map +1 -1
- package/dist/esm/index.js +6 -4
- package/dist/esm/index.mjs +6 -4
- package/dist/esm/index.native.js +6 -4
- package/dist/esm/static-resolve.mjs +3 -3
- package/dist/esm/static-resolve.mjs.map +1 -1
- package/dist/esm/static-resolve.native.js +3 -3
- package/dist/esm/static-resolve.native.js.map +1 -1
- package/dist/esm/style.mjs +58 -0
- package/dist/esm/style.mjs.map +1 -0
- package/dist/esm/style.native.js +63 -0
- package/dist/esm/style.native.js.map +1 -0
- package/dist/esm/styled.mjs +12 -6
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +12 -6
- package/dist/esm/styled.native.js.map +1 -1
- package/dist/esm/types.mjs +3 -4
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/types.native.js +3 -4
- package/dist/esm/types.native.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.mjs +1 -2
- package/dist/esm/views/TamaguiProvider.mjs.map +1 -1
- package/dist/esm/views/TamaguiProvider.native.js +1 -2
- package/dist/esm/views/TamaguiProvider.native.js.map +1 -1
- package/dist/esm/views/Text.mjs +17 -12
- package/dist/esm/views/Text.mjs.map +1 -1
- package/dist/esm/views/Theme.mjs +3 -3
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/Theme.native.js +3 -3
- package/dist/esm/views/Theme.native.js.map +1 -1
- package/dist/esm/views/ThemeDebug.mjs +1 -4
- package/dist/esm/views/ThemeDebug.mjs.map +1 -1
- package/package.json +15 -15
- package/src/createComponent.tsx +21 -1
- package/src/createStyledHOC.tsx +4 -2
- package/src/createVariable.ts +0 -10
- package/src/helpers/borderComponents.ts +62 -0
- package/src/helpers/createDesignSystem.ts +0 -2
- package/src/helpers/createStyledContext.tsx +15 -53
- package/src/helpers/formatDiagnostic.ts +9 -9
- package/src/helpers/getCSSStylesAtomic.native.ts +6 -3
- package/src/helpers/getCSSStylesAtomic.ts +192 -207
- package/src/helpers/getCSSStylesAtomicCompiled.ts +13 -1
- package/src/helpers/getDynamicVal.ts +4 -0
- package/src/helpers/getSplitStyles.tsx +2080 -3270
- package/src/helpers/grammarConfig.ts +218 -1
- package/src/helpers/insertStyleRule.tsx +4 -2
- package/src/helpers/log.ts +12 -11
- package/src/helpers/mergeVariants.ts +55 -18
- package/src/helpers/nativeOnlyProps.ts +0 -1
- package/src/helpers/nativeStyleEngine.ts +55 -14
- package/src/helpers/normalizeValueWithProperty.ts +10 -12
- package/src/helpers/parseBorderShorthand.native.ts +23 -45
- package/src/helpers/parseOutlineShorthand.native.ts +9 -40
- package/src/helpers/resolveSafeArea.ts +34 -101
- package/src/helpers/resolveVariantStyle.ts +77 -0
- package/src/helpers/styleFrontend.ts +8 -5
- package/src/helpers/styleStaticConfig.ts +5 -72
- package/src/helpers/styleStaticConfigCore.ts +110 -0
- package/src/helpers/styledDynamic.ts +191 -0
- package/src/helpers/tokenCategories.ts +40 -65
- package/src/helpers/variableValue.ts +20 -15
- package/src/helpers/warnOnce.ts +5 -4
- package/src/hooks/useAnimationDriver.ts +6 -2
- package/src/hooks/useComponentState.ts +55 -183
- package/src/hooks/useMedia.tsx +10 -8
- package/src/hooks/useStyle.ts +10 -0
- package/src/hooks/useThemeState.ts +51 -264
- package/src/index.ts +6 -6
- package/src/internalRuntimeTypes.ts +1 -0
- package/src/static-resolve.ts +7 -4
- package/src/style.ts +97 -0
- package/src/styled.tsx +39 -68
- package/src/types.tsx +105 -169
- package/src/views/TamaguiProvider.tsx +0 -2
- package/src/views/Text.tsx +20 -14
- package/src/views/Theme.tsx +13 -9
- package/src/views/ThemeDebug.tsx +0 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/createStyledHOC.d.ts +1 -1
- package/types/createStyledHOC.d.ts.map +1 -1
- package/types/createVariable.d.ts +0 -2
- package/types/createVariable.d.ts.map +1 -1
- package/types/helpers/borderComponents.d.ts +10 -0
- package/types/helpers/borderComponents.d.ts.map +1 -0
- package/types/helpers/createDesignSystem.d.ts.map +1 -1
- package/types/helpers/createStyledContext.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomic.d.ts +20 -19
- package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomic.native.d.ts +5 -0
- package/types/helpers/getCSSStylesAtomic.native.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts +6 -1
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts.map +1 -1
- package/types/helpers/getDynamicVal.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +3 -5
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/grammarConfig.d.ts +25 -2
- package/types/helpers/grammarConfig.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts +1 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/log.d.ts.map +1 -1
- package/types/helpers/mergeVariants.d.ts.map +1 -1
- package/types/helpers/nativeOnlyProps.d.ts +0 -1
- package/types/helpers/nativeOnlyProps.d.ts.map +1 -1
- package/types/helpers/nativeStyleEngine.d.ts +6 -0
- package/types/helpers/nativeStyleEngine.d.ts.map +1 -1
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -1
- package/types/helpers/parseBorderShorthand.native.d.ts +1 -0
- package/types/helpers/parseBorderShorthand.native.d.ts.map +1 -1
- package/types/helpers/parseOutlineShorthand.native.d.ts.map +1 -1
- package/types/helpers/resolveSafeArea.d.ts +0 -1
- package/types/helpers/resolveSafeArea.d.ts.map +1 -1
- package/types/helpers/resolveVariantStyle.d.ts +3 -0
- package/types/helpers/resolveVariantStyle.d.ts.map +1 -0
- package/types/helpers/styleFrontend.d.ts +3 -5
- package/types/helpers/styleFrontend.d.ts.map +1 -1
- package/types/helpers/styleStaticConfig.d.ts +4 -9
- package/types/helpers/styleStaticConfig.d.ts.map +1 -1
- package/types/helpers/styleStaticConfigCore.d.ts +4 -0
- package/types/helpers/styleStaticConfigCore.d.ts.map +1 -0
- package/types/helpers/styledDynamic.d.ts +18 -0
- package/types/helpers/styledDynamic.d.ts.map +1 -0
- package/types/helpers/tokenCategories.d.ts +0 -1
- package/types/helpers/tokenCategories.d.ts.map +1 -1
- package/types/helpers/variableValue.d.ts.map +1 -1
- package/types/helpers/warnOnce.d.ts.map +1 -1
- package/types/helpers/webPropsToSkip.native.d.ts +68 -68
- package/types/hooks/useAnimationDriver.d.ts.map +1 -1
- package/types/hooks/useComponentState.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useStyle.d.ts +4 -0
- package/types/hooks/useStyle.d.ts.map +1 -0
- package/types/hooks/useThemeState.d.ts +1 -11
- package/types/hooks/useThemeState.d.ts.map +1 -1
- package/types/index.d.ts +6 -4
- package/types/index.d.ts.map +1 -1
- package/types/internalRuntimeTypes.d.ts +1 -1
- package/types/internalRuntimeTypes.d.ts.map +1 -1
- package/types/static-resolve.d.ts.map +1 -1
- package/types/style.d.ts +18 -0
- package/types/style.d.ts.map +1 -0
- package/types/styled.d.ts +10 -10
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +74 -49
- package/types/types.d.ts.map +1 -1
- package/types/views/TamaguiProvider.d.ts +1 -1
- package/types/views/TamaguiProvider.d.ts.map +1 -1
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeDebug.d.ts.map +1 -1
- package/dist/cjs/helpers/directStyleCSS.cjs +0 -345
- package/dist/cjs/helpers/directStyleCSS.native.js.map +0 -1
- package/dist/cjs/helpers/directStyleCSSCompiled.cjs +0 -40
- package/dist/cjs/helpers/directStyleCSSCompiled.native.cjs +0 -46
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js +0 -48
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js.map +0 -1
- package/dist/cjs/helpers/getVariantExtras.cjs +0 -91
- package/dist/cjs/helpers/getVariantExtras.native.cjs +0 -94
- package/dist/cjs/helpers/getVariantExtras.native.js +0 -96
- package/dist/cjs/helpers/getVariantExtras.native.js.map +0 -1
- package/dist/cjs/helpers/variantResolvers.cjs +0 -87
- package/dist/cjs/helpers/variantResolvers.native.cjs +0 -140
- package/dist/cjs/helpers/variantResolvers.native.js +0 -142
- package/dist/cjs/helpers/variantResolvers.native.js.map +0 -1
- package/dist/esm/helpers/directStyleCSS.mjs +0 -317
- package/dist/esm/helpers/directStyleCSS.mjs.map +0 -1
- package/dist/esm/helpers/directStyleCSS.native.js +0 -1
- package/dist/esm/helpers/directStyleCSSCompiled.mjs +0 -11
- package/dist/esm/helpers/directStyleCSSCompiled.mjs.map +0 -1
- package/dist/esm/helpers/directStyleCSSCompiled.native.js +0 -15
- package/dist/esm/helpers/directStyleCSSCompiled.native.js.map +0 -1
- package/dist/esm/helpers/getVariantExtras.mjs +0 -69
- package/dist/esm/helpers/getVariantExtras.mjs.map +0 -1
- package/dist/esm/helpers/getVariantExtras.native.js +0 -70
- package/dist/esm/helpers/getVariantExtras.native.js.map +0 -1
- package/dist/esm/helpers/variantResolvers.mjs +0 -65
- package/dist/esm/helpers/variantResolvers.mjs.map +0 -1
- package/dist/esm/helpers/variantResolvers.native.js +0 -116
- package/dist/esm/helpers/variantResolvers.native.js.map +0 -1
- package/src/helpers/directStyleCSS.native.ts +0 -1
- package/src/helpers/directStyleCSS.ts +0 -513
- package/src/helpers/directStyleCSSCompiled.ts +0 -32
- package/src/helpers/getVariantExtras.tsx +0 -95
- package/src/helpers/variantResolvers.ts +0 -121
- package/types/helpers/directStyleCSS.d.ts +0 -28
- package/types/helpers/directStyleCSS.d.ts.map +0 -1
- package/types/helpers/directStyleCSS.native.d.ts +0 -2
- package/types/helpers/directStyleCSS.native.d.ts.map +0 -1
- package/types/helpers/directStyleCSSCompiled.d.ts +0 -10
- package/types/helpers/directStyleCSSCompiled.d.ts.map +0 -1
- package/types/helpers/getVariantExtras.d.ts +0 -4
- package/types/helpers/getVariantExtras.d.ts.map +0 -1
- package/types/helpers/variantResolvers.d.ts +0 -9
- package/types/helpers/variantResolvers.d.ts.map +0 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { getSetting } from '../config'
|
|
2
|
+
import { getVariableValue } from '../createVariable'
|
|
3
|
+
import type {
|
|
4
|
+
GenericFonts,
|
|
5
|
+
GetStyleState,
|
|
6
|
+
LanguageContextType,
|
|
7
|
+
StyledDynamic,
|
|
8
|
+
StyledDynamicEnv,
|
|
9
|
+
StyledDynamicFn,
|
|
10
|
+
StyledDynamicProp,
|
|
11
|
+
} from '../types'
|
|
12
|
+
import { styledDynamicSymbol } from '../types'
|
|
13
|
+
|
|
14
|
+
const fontLanguageCache = new WeakMap()
|
|
15
|
+
|
|
16
|
+
export function getFontsForLanguage(fonts: GenericFonts, language: LanguageContextType) {
|
|
17
|
+
if (fontLanguageCache.has(language)) return fontLanguageCache.get(language)
|
|
18
|
+
const next = { ...fonts }
|
|
19
|
+
for (const name in language) {
|
|
20
|
+
const lang = language[name]
|
|
21
|
+
if (lang !== 'default') next[name] = fonts[`${name}_${lang}`]
|
|
22
|
+
}
|
|
23
|
+
fontLanguageCache.set(language, next)
|
|
24
|
+
return next
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function isStyledDynamic(value: unknown): value is StyledDynamic {
|
|
28
|
+
return (
|
|
29
|
+
!!value &&
|
|
30
|
+
(typeof value === 'function' || typeof value === 'object') &&
|
|
31
|
+
styledDynamicSymbol in (value as object)
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const bareStyledDynamic: StyledDynamicProp = { [styledDynamicSymbol]: true }
|
|
36
|
+
const dynamicSpreadProbe = Symbol('tamagui.dynamicSpreadProbe')
|
|
37
|
+
const dynamicComputedProbe = '__tamagui_dynamic_computed_key__'
|
|
38
|
+
const dynamicComputedNumberProbe = 712_367_821
|
|
39
|
+
const dynamicShapeProbeValues = new WeakSet<object>()
|
|
40
|
+
|
|
41
|
+
function createDynamicShapeProbe(): any {
|
|
42
|
+
const target = function () {}
|
|
43
|
+
let probe: any
|
|
44
|
+
probe = new Proxy(target, {
|
|
45
|
+
apply: () => probe,
|
|
46
|
+
construct: () => probe,
|
|
47
|
+
get: (_target, key) => {
|
|
48
|
+
if (key === Symbol.toPrimitive) {
|
|
49
|
+
return (hint: string) =>
|
|
50
|
+
hint === 'number' ? dynamicComputedNumberProbe : dynamicComputedProbe
|
|
51
|
+
}
|
|
52
|
+
if (key === Symbol.iterator) {
|
|
53
|
+
return function* () {
|
|
54
|
+
yield dynamicComputedProbe
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (key === dynamicSpreadProbe) return true
|
|
58
|
+
return probe
|
|
59
|
+
},
|
|
60
|
+
getOwnPropertyDescriptor: (target, key) =>
|
|
61
|
+
key === dynamicSpreadProbe
|
|
62
|
+
? { configurable: true, enumerable: true, value: true }
|
|
63
|
+
: Reflect.getOwnPropertyDescriptor(target, key),
|
|
64
|
+
ownKeys: (target) => [...Reflect.ownKeys(target), dynamicSpreadProbe],
|
|
65
|
+
})
|
|
66
|
+
dynamicShapeProbeValues.add(probe)
|
|
67
|
+
return probe
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function findDynamicShapeViolation(value: unknown) {
|
|
71
|
+
if (!value || (typeof value !== 'object' && typeof value !== 'function')) return
|
|
72
|
+
const seen = new WeakSet<object>()
|
|
73
|
+
let spread = false
|
|
74
|
+
let computed = false
|
|
75
|
+
const visit = (current: object) => {
|
|
76
|
+
// A proxy used as an ordinary scalar/local value is valid. Its enumerable
|
|
77
|
+
// marker only means "spread" after object spread copies that descriptor
|
|
78
|
+
// onto a returned literal.
|
|
79
|
+
if (dynamicShapeProbeValues.has(current) || seen.has(current)) return
|
|
80
|
+
seen.add(current)
|
|
81
|
+
let descriptors: PropertyDescriptorMap
|
|
82
|
+
try {
|
|
83
|
+
descriptors = Object.getOwnPropertyDescriptors(current)
|
|
84
|
+
} catch {
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
for (const key of Reflect.ownKeys(descriptors)) {
|
|
88
|
+
if (key === dynamicSpreadProbe) spread = true
|
|
89
|
+
if (
|
|
90
|
+
typeof key === 'string' &&
|
|
91
|
+
(key.includes(dynamicComputedProbe) || key === String(dynamicComputedNumberProbe))
|
|
92
|
+
) {
|
|
93
|
+
computed = true
|
|
94
|
+
}
|
|
95
|
+
const nested = descriptors[key as keyof typeof descriptors]?.value
|
|
96
|
+
if (nested && (typeof nested === 'object' || typeof nested === 'function')) {
|
|
97
|
+
visit(nested)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
visit(value)
|
|
102
|
+
if (spread || computed) return { spread, computed }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function validateDynamicShape(fn: Function) {
|
|
106
|
+
try {
|
|
107
|
+
const probe = createDynamicShapeProbe()
|
|
108
|
+
// Helpers may diagnose the deliberately-invalid proxy value (for example a
|
|
109
|
+
// token resolver saying it is not a known size). Those are probe artifacts,
|
|
110
|
+
// not definition warnings; only the shape warning below should escape.
|
|
111
|
+
const warn = console.warn
|
|
112
|
+
let output
|
|
113
|
+
try {
|
|
114
|
+
console.warn = () => {}
|
|
115
|
+
output = fn(probe, probe)
|
|
116
|
+
} finally {
|
|
117
|
+
console.warn = warn
|
|
118
|
+
}
|
|
119
|
+
const violation = findDynamicShapeViolation(output)
|
|
120
|
+
if (!violation) return
|
|
121
|
+
const reasons = [
|
|
122
|
+
violation.spread ? 'a spread from a dynamic input' : '',
|
|
123
|
+
violation.computed ? 'a computed key from a dynamic input' : '',
|
|
124
|
+
].filter(Boolean)
|
|
125
|
+
console.warn(
|
|
126
|
+
`[tamagui] styled.dynamic${fn.name ? ` (${fn.name})` : ''} returned ${reasons.join(' and ')} during its development shape check. Dynamic style bodies require static object keys for extraction; this definition will deopt instead.`
|
|
127
|
+
)
|
|
128
|
+
} catch {
|
|
129
|
+
// The probe is intentionally best-effort. A body may depend on a concrete
|
|
130
|
+
// runtime value the proxy cannot model; definition must never fail for it.
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* `styled.dynamic<T>()` declares a typed variant prop that is consumed by
|
|
136
|
+
* styling (given style by a component `.resolve`). `styled.dynamic<T>(fn)`
|
|
137
|
+
* maps the value to a style fragment; it is invoked per clause payload so
|
|
138
|
+
* responsive/conditional values work, and the branded function stays callable
|
|
139
|
+
* inside other dynamics or resolvers.
|
|
140
|
+
*/
|
|
141
|
+
export function styledDynamic<Val>(): StyledDynamicProp<Val>
|
|
142
|
+
export function styledDynamic<Val>(
|
|
143
|
+
fn: (value: Val, env: StyledDynamicEnv) => Record<string, any> | null | undefined
|
|
144
|
+
): StyledDynamicFn<Val>
|
|
145
|
+
export function styledDynamic(fn?: any) {
|
|
146
|
+
if (!fn) return bareStyledDynamic
|
|
147
|
+
if (process.env.NODE_ENV === 'development') validateDynamicShape(fn)
|
|
148
|
+
fn[styledDynamicSymbol] = true
|
|
149
|
+
return fn
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* the env for `styled.dynamic` callbacks and `.resolve` resolvers: tokens,
|
|
154
|
+
* theme, fonts, and the active font. Built once per style pass.
|
|
155
|
+
*/
|
|
156
|
+
export function getDynamicEnv(styleState: GetStyleState): StyledDynamicEnv {
|
|
157
|
+
const cached = (styleState as any).flatDynamicEnv
|
|
158
|
+
if (cached) return cached
|
|
159
|
+
|
|
160
|
+
const { props, conf, context, theme } = styleState
|
|
161
|
+
let fonts = conf.fontsParsed
|
|
162
|
+
if (context?.language) {
|
|
163
|
+
fonts = getFontsForLanguage(conf.fontsParsed, context.language)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const next = {
|
|
167
|
+
fonts,
|
|
168
|
+
tokens: conf.tokensParsed,
|
|
169
|
+
theme,
|
|
170
|
+
get fontFamily() {
|
|
171
|
+
return (
|
|
172
|
+
getVariableValue(styleState.fontFamily || props.fontFamily) ||
|
|
173
|
+
props.fontFamily ||
|
|
174
|
+
getVariableValue(getSetting('defaultFont'))
|
|
175
|
+
)
|
|
176
|
+
},
|
|
177
|
+
get font() {
|
|
178
|
+
const found = fonts[this.fontFamily as string]
|
|
179
|
+
if (found) return found
|
|
180
|
+
|
|
181
|
+
const className = props.className
|
|
182
|
+
if (typeof className === 'string') {
|
|
183
|
+
const name = /(?:^|\s)font_(\S+)/.exec(className)?.[1]
|
|
184
|
+
if (name && fonts[name]) return fonts[name]
|
|
185
|
+
}
|
|
186
|
+
return fonts[conf.defaultFontToken]
|
|
187
|
+
},
|
|
188
|
+
} as StyledDynamicEnv
|
|
189
|
+
|
|
190
|
+
return ((styleState as any).flatDynamicEnv = next)
|
|
191
|
+
}
|
|
@@ -1,73 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getTokenCategoryName,
|
|
3
|
-
propToTokenCategoryCode,
|
|
4
|
-
tokenCategoryColor,
|
|
5
|
-
tokenCategoryFontFamily,
|
|
6
|
-
tokenCategoryFontSize,
|
|
7
|
-
tokenCategoryFontWeight,
|
|
8
|
-
tokenCategoryLetterSpacing,
|
|
9
|
-
tokenCategoryLineHeight,
|
|
10
|
-
tokenCategoryRadius,
|
|
11
|
-
tokenCategorySize,
|
|
12
|
-
tokenCategorySpace,
|
|
13
|
-
tokenCategoryZIndex,
|
|
14
|
-
} from '@tamagui/helpers'
|
|
15
|
-
|
|
16
1
|
export type StyleTokenCategory = 'size' | 'space' | 'radius' | 'zIndex' | 'fontSize'
|
|
17
2
|
export type RuntimeTokenCategory = StyleTokenCategory | 'color' | 'font' | 'fontFamily'
|
|
18
3
|
|
|
19
|
-
const legacyCategory = (property: string): StyleTokenCategory | undefined => {
|
|
20
|
-
const category = getTokenCategoryName(propToTokenCategoryCode[property])
|
|
21
|
-
return category === 'space' ||
|
|
22
|
-
category === 'size' ||
|
|
23
|
-
category === 'radius' ||
|
|
24
|
-
category === 'zIndex' ||
|
|
25
|
-
category === 'fontSize'
|
|
26
|
-
? category
|
|
27
|
-
: undefined
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// compatibility view for internal consumers that enumerated the old string map.
|
|
31
|
-
// the proxy keeps the numeric table canonical and only allocates keys on enumeration
|
|
32
|
-
export const tokenCategoryByProperty: Readonly<Record<string, StyleTokenCategory>> =
|
|
33
|
-
/* @__PURE__ */ new Proxy(Object.create(null), {
|
|
34
|
-
get(_, property) {
|
|
35
|
-
return typeof property === 'string' ? legacyCategory(property) : undefined
|
|
36
|
-
},
|
|
37
|
-
has(_, property) {
|
|
38
|
-
return typeof property === 'string' && legacyCategory(property) !== undefined
|
|
39
|
-
},
|
|
40
|
-
ownKeys() {
|
|
41
|
-
return Object.keys(propToTokenCategoryCode).filter(
|
|
42
|
-
(property) => legacyCategory(property) !== undefined
|
|
43
|
-
)
|
|
44
|
-
},
|
|
45
|
-
getOwnPropertyDescriptor(_, property) {
|
|
46
|
-
if (typeof property !== 'string' || legacyCategory(property) === undefined) return
|
|
47
|
-
return { configurable: true, enumerable: true }
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
|
|
51
4
|
export function getTokenCategoryForProperty(
|
|
52
5
|
property: string
|
|
53
6
|
): RuntimeTokenCategory | undefined {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
7
|
+
if (property === 'fontFamily') return 'fontFamily'
|
|
8
|
+
if (
|
|
9
|
+
property === 'fontSize' ||
|
|
10
|
+
property === 'fontWeight' ||
|
|
11
|
+
property === 'lineHeight' ||
|
|
12
|
+
property === 'letterSpacing'
|
|
13
|
+
) {
|
|
14
|
+
return 'font'
|
|
15
|
+
}
|
|
16
|
+
if (property === 'zIndex') return 'zIndex'
|
|
17
|
+
if (property === 'color' || property.endsWith('Color')) return 'color'
|
|
18
|
+
if (property.endsWith('Radius')) {
|
|
19
|
+
return property === 'shadowRadius' ? 'size' : 'radius'
|
|
20
|
+
}
|
|
21
|
+
if (
|
|
22
|
+
/^(?:width|height|(?:min|max)(?:Width|Height))$/.test(property) ||
|
|
23
|
+
property.endsWith('BlockSize') ||
|
|
24
|
+
property.endsWith('InlineSize') ||
|
|
25
|
+
property === 'blockSize' ||
|
|
26
|
+
property === 'inlineSize'
|
|
27
|
+
) {
|
|
28
|
+
return 'size'
|
|
29
|
+
}
|
|
30
|
+
if (
|
|
31
|
+
property === 'x' ||
|
|
32
|
+
property === 'y' ||
|
|
33
|
+
property === 'top' ||
|
|
34
|
+
property === 'right' ||
|
|
35
|
+
property === 'bottom' ||
|
|
36
|
+
property === 'left' ||
|
|
37
|
+
property === 'outlineOffset' ||
|
|
38
|
+
property === 'gap' ||
|
|
39
|
+
property.endsWith('Gap') ||
|
|
40
|
+
property.startsWith('margin') ||
|
|
41
|
+
property.startsWith('padding') ||
|
|
42
|
+
property.startsWith('inset') ||
|
|
43
|
+
((property.startsWith('border') || property === 'outlineWidth') &&
|
|
44
|
+
property.endsWith('Width'))
|
|
45
|
+
) {
|
|
46
|
+
return 'space'
|
|
72
47
|
}
|
|
73
48
|
}
|
|
@@ -24,22 +24,27 @@ export const findVariableToken = (
|
|
|
24
24
|
tokensParsed: TokensParsed,
|
|
25
25
|
name: string
|
|
26
26
|
): Variable | undefined => {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if (process.env.NODE_ENV === 'development') {
|
|
28
|
+
let found: Variable | undefined
|
|
29
|
+
let foundCategory: string | undefined
|
|
30
|
+
for (const category of tokenCategoryOrder) {
|
|
31
|
+
const token = tokensParsed[category]?.[name] as Variable | undefined
|
|
32
|
+
if (!token) continue
|
|
33
|
+
if (!found) {
|
|
34
|
+
found = token
|
|
35
|
+
foundCategory = category
|
|
36
|
+
} else {
|
|
37
|
+
warnOnce(
|
|
38
|
+
`ambiguous:${name}`,
|
|
39
|
+
`Theme inline value: "${name}" exists in multiple token categories; using "${foundCategory}". Rename one of the colliding tokens.`
|
|
40
|
+
)
|
|
41
|
+
break
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return found
|
|
45
|
+
}
|
|
29
46
|
for (const category of tokenCategoryOrder) {
|
|
30
47
|
const token = tokensParsed[category]?.[name] as Variable | undefined
|
|
31
|
-
if (
|
|
32
|
-
if (!found) {
|
|
33
|
-
found = token
|
|
34
|
-
foundCategory = category
|
|
35
|
-
if (process.env.NODE_ENV !== 'development') break
|
|
36
|
-
} else {
|
|
37
|
-
warnOnce(
|
|
38
|
-
`ambiguous:${name}`,
|
|
39
|
-
`Theme inline value: "${name}" exists in multiple token categories; using "${foundCategory}". Rename one of the colliding tokens.`
|
|
40
|
-
)
|
|
41
|
-
break
|
|
42
|
-
}
|
|
48
|
+
if (token) return token
|
|
43
49
|
}
|
|
44
|
-
return found
|
|
45
50
|
}
|
package/src/helpers/warnOnce.ts
CHANGED
|
@@ -15,10 +15,11 @@ const warnLimit = 500
|
|
|
15
15
|
const warned = process.env.NODE_ENV !== 'production' ? new Set<string>() : null
|
|
16
16
|
|
|
17
17
|
export function warnOnce(key: string, message = key) {
|
|
18
|
-
if (process.env.NODE_ENV
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
if (process.env.NODE_ENV === 'development') {
|
|
19
|
+
if (warned?.has(key) || (warned?.size ?? 0) >= warnLimit) return
|
|
20
|
+
warned?.add(key)
|
|
21
|
+
console.warn(`[tamagui] ${message}`)
|
|
22
|
+
}
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -16,7 +16,9 @@ export function useAnimationDriver(): AnimationDriver {
|
|
|
16
16
|
const { animationDriver } = useConfiguration()
|
|
17
17
|
if (!animationDriver || animationDriver.isStub) {
|
|
18
18
|
throw new Error(
|
|
19
|
-
|
|
19
|
+
process.env.NODE_ENV !== 'production'
|
|
20
|
+
? `No animation driver configured. Pass \`animations\` to createTamagui. See: https://tamagui.dev/docs/core/animations`
|
|
21
|
+
: '❌ Error 011'
|
|
20
22
|
)
|
|
21
23
|
}
|
|
22
24
|
return animationDriver
|
|
@@ -32,7 +34,9 @@ function useAnimatedNumberDriver(): AnimationDriverWithAnimatedNumbers {
|
|
|
32
34
|
typeof animatedDriver.useAnimatedNumberReaction !== 'function'
|
|
33
35
|
) {
|
|
34
36
|
throw new Error(
|
|
35
|
-
|
|
37
|
+
process.env.NODE_ENV !== 'production'
|
|
38
|
+
? `The configured animation driver does not include animated-number hooks. When using the CSS driver, import \`createAnimations\` from \`@tamagui/animations-css/extras\` instead of \`@tamagui/animations-css\`. See: https://tamagui.dev/docs/core/animations-css`
|
|
39
|
+
: '❌ Error 012'
|
|
36
40
|
)
|
|
37
41
|
}
|
|
38
42
|
return animatedDriver as AnimationDriverWithAnimatedNumbers
|