@tamagui/web 3.0.0-beta.807.1 → 3.0.0-beta.881.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/config.cjs +1 -1
- package/dist/cjs/config.native.cjs +1 -1
- package/dist/cjs/config.native.js +1 -1
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/createComponent.cjs +40 -19
- package/dist/cjs/createComponent.native.cjs +42 -21
- package/dist/cjs/createComponent.native.js +42 -21
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createStyledHOC.cjs +54 -4
- package/dist/cjs/createStyledHOC.native.cjs +55 -4
- package/dist/cjs/createStyledHOC.native.js +55 -4
- package/dist/cjs/createStyledHOC.native.js.map +1 -1
- package/dist/cjs/createTokens.cjs +1 -1
- package/dist/cjs/createTokens.native.cjs +1 -1
- package/dist/cjs/createTokens.native.js +1 -1
- package/dist/cjs/createTokens.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/dom/html.cjs +147 -99
- package/dist/cjs/dom/htmlRuntime.native.cjs +6 -2
- package/dist/cjs/dom/htmlRuntime.native.js +6 -2
- package/dist/cjs/dom/htmlRuntime.native.js.map +1 -1
- package/dist/cjs/dom/primitives.native.cjs +16 -13
- package/dist/cjs/dom/primitives.native.js +16 -13
- package/dist/cjs/dom/primitives.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/componentDisplayName.cjs +1 -11
- package/dist/cjs/helpers/componentDisplayName.native.cjs +1 -11
- package/dist/cjs/helpers/componentDisplayName.native.js +1 -11
- package/dist/cjs/helpers/componentDisplayName.native.js.map +1 -1
- 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 +8 -10
- package/dist/cjs/helpers/formatDiagnostic.native.cjs +8 -10
- package/dist/cjs/helpers/formatDiagnostic.native.js +8 -10
- package/dist/cjs/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/cjs/helpers/getCSSStylesAtomic.cjs +133 -114
- 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 +1063 -2168
- package/dist/cjs/helpers/getSplitStyles.native.cjs +1115 -2515
- package/dist/cjs/helpers/getSplitStyles.native.js +1115 -2515
- 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/splitStyleProps.cjs +46 -0
- package/dist/cjs/helpers/splitStyleProps.native.cjs +49 -0
- package/dist/cjs/helpers/splitStyleProps.native.js +51 -0
- package/dist/cjs/helpers/splitStyleProps.native.js.map +1 -0
- package/dist/cjs/helpers/{getDefaultProps.native.cjs → styleStaticConfig.cjs} +7 -8
- package/dist/cjs/helpers/{getDefaultProps.native.js → styleStaticConfig.native.cjs} +7 -8
- package/dist/cjs/helpers/styleStaticConfig.native.js +31 -0
- package/dist/cjs/helpers/styleStaticConfig.native.js.map +1 -0
- 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 +12 -74
- package/dist/cjs/helpers/tokenCategories.native.cjs +12 -76
- package/dist/cjs/helpers/tokenCategories.native.js +12 -76
- 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/hooks/useSplitStyles.cjs +2 -2
- package/dist/cjs/hooks/useSplitStyles.native.cjs +2 -2
- package/dist/cjs/hooks/useSplitStyles.native.js +2 -2
- package/dist/cjs/hooks/useSplitStyles.native.js.map +1 -1
- package/dist/cjs/{helpers/getDefaultProps.cjs → hooks/useStyle.cjs} +10 -4
- package/dist/cjs/{helpers/directStyleCSS.native.js → hooks/useStyle.native.cjs} +16 -6
- 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 +9 -12
- package/dist/cjs/index.native.cjs +9 -12
- package/dist/cjs/index.native.js +9 -12
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/internal-runtime.cjs +8 -7
- package/dist/cjs/internal-runtime.native.cjs +8 -7
- package/dist/cjs/internal-runtime.native.js +8 -7
- package/dist/cjs/internal-runtime.native.js.map +1 -1
- package/dist/cjs/static-resolve.cjs +8 -7
- package/dist/cjs/static-resolve.native.cjs +8 -7
- package/dist/cjs/static-resolve.native.js +8 -7
- 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 +15 -62
- package/dist/cjs/styled.native.cjs +15 -64
- package/dist/cjs/styled.native.js +15 -64
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/types.cjs +4 -22
- package/dist/cjs/types.native.cjs +4 -22
- package/dist/cjs/types.native.js +4 -22
- 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 +21 -14
- package/dist/cjs/views/Text.native.cjs +5 -2
- package/dist/cjs/views/Text.native.js +5 -2
- package/dist/cjs/views/Text.native.js.map +1 -1
- package/dist/cjs/views/Theme.cjs +2 -2
- package/dist/cjs/views/Theme.native.cjs +2 -2
- package/dist/cjs/views/Theme.native.js +2 -2
- package/dist/cjs/views/Theme.native.js.map +1 -1
- package/dist/cjs/views/ThemeDebug.cjs +1 -4
- package/dist/cjs/views/View.cjs +4 -2
- package/dist/cjs/views/View.native.cjs +4 -2
- package/dist/cjs/views/View.native.js +4 -2
- package/dist/cjs/views/View.native.js.map +1 -1
- package/dist/esm/config.mjs +1 -1
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/config.native.js +1 -1
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/createComponent.mjs +41 -20
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +43 -22
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createStyledHOC.mjs +55 -5
- package/dist/esm/createStyledHOC.mjs.map +1 -1
- package/dist/esm/createStyledHOC.native.js +56 -5
- package/dist/esm/createStyledHOC.native.js.map +1 -1
- package/dist/esm/createTokens.mjs +1 -1
- package/dist/esm/createTokens.mjs.map +1 -1
- package/dist/esm/createTokens.native.js +1 -1
- package/dist/esm/createTokens.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/dom/html.mjs +147 -99
- package/dist/esm/dom/html.mjs.map +1 -1
- package/dist/esm/dom/htmlRuntime.native.js +7 -3
- package/dist/esm/dom/htmlRuntime.native.js.map +1 -1
- package/dist/esm/dom/primitives.native.js +16 -13
- package/dist/esm/dom/primitives.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/componentDisplayName.mjs +1 -8
- package/dist/esm/helpers/componentDisplayName.mjs.map +1 -1
- package/dist/esm/helpers/componentDisplayName.native.js +1 -8
- package/dist/esm/helpers/componentDisplayName.native.js.map +1 -1
- 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 +8 -10
- package/dist/esm/helpers/formatDiagnostic.mjs.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.native.js +8 -10
- package/dist/esm/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomic.mjs +131 -114
- 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 +1052 -2151
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +1090 -2481
- 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/splitStyleProps.mjs +27 -0
- package/dist/esm/helpers/splitStyleProps.mjs.map +1 -0
- package/dist/esm/helpers/splitStyleProps.native.js +28 -0
- package/dist/esm/helpers/splitStyleProps.native.js.map +1 -0
- package/dist/esm/helpers/styleStaticConfig.mjs +8 -0
- package/dist/esm/helpers/styleStaticConfig.mjs.map +1 -0
- package/dist/esm/helpers/styleStaticConfig.native.js +8 -0
- package/dist/esm/helpers/styleStaticConfig.native.js.map +1 -0
- 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 +12 -72
- package/dist/esm/helpers/tokenCategories.mjs.map +1 -1
- package/dist/esm/helpers/tokenCategories.native.js +12 -74
- 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/useSplitStyles.mjs +2 -2
- package/dist/esm/hooks/useSplitStyles.mjs.map +1 -1
- package/dist/esm/hooks/useSplitStyles.native.js +2 -2
- package/dist/esm/hooks/useSplitStyles.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 +8 -8
- package/dist/esm/index.mjs +8 -8
- package/dist/esm/index.native.js +8 -8
- package/dist/esm/internal-runtime.mjs +8 -7
- package/dist/esm/internal-runtime.mjs.map +1 -1
- package/dist/esm/internal-runtime.native.js +8 -7
- package/dist/esm/internal-runtime.native.js.map +1 -1
- package/dist/esm/static-resolve.mjs +11 -9
- package/dist/esm/static-resolve.mjs.map +1 -1
- package/dist/esm/static-resolve.native.js +11 -9
- 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 +17 -62
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +17 -64
- package/dist/esm/styled.native.js.map +1 -1
- package/dist/esm/types.mjs +3 -21
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/types.native.js +3 -21
- 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 +21 -14
- package/dist/esm/views/Text.mjs.map +1 -1
- package/dist/esm/views/Text.native.js +4 -2
- package/dist/esm/views/Text.native.js.map +1 -1
- package/dist/esm/views/Theme.mjs +2 -2
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/Theme.native.js +2 -2
- 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/dist/esm/views/View.mjs +4 -2
- package/dist/esm/views/View.mjs.map +1 -1
- package/dist/esm/views/View.native.js +4 -2
- package/dist/esm/views/View.native.js.map +1 -1
- package/package.json +15 -15
- package/src/config.ts +1 -1
- package/src/createComponent.tsx +62 -31
- package/src/createStyledHOC.tsx +56 -9
- package/src/createTokens.ts +1 -1
- package/src/createVariable.ts +0 -10
- package/src/dom/html.tsx +778 -877
- package/src/dom/htmlRuntime.native.tsx +7 -3
- package/src/dom/primitives.native.tsx +30 -39
- package/src/helpers/borderComponents.ts +62 -0
- package/src/helpers/componentDisplayName.ts +0 -11
- package/src/helpers/createDesignSystem.ts +0 -2
- package/src/helpers/createStyledContext.tsx +15 -53
- package/src/helpers/formatDiagnostic.ts +11 -13
- package/src/helpers/getCSSStylesAtomic.native.ts +6 -3
- package/src/helpers/getCSSStylesAtomic.ts +197 -206
- package/src/helpers/getCSSStylesAtomicCompiled.ts +13 -1
- package/src/helpers/getDynamicVal.ts +4 -0
- package/src/helpers/getSplitStyles.tsx +2058 -4052
- 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/splitStyleProps.ts +166 -0
- package/src/helpers/styleFrontend.ts +16 -9
- package/src/helpers/styleStaticConfig.ts +21 -0
- package/src/helpers/styleStaticConfigCore.ts +110 -0
- package/src/helpers/styledDynamic.ts +191 -0
- package/src/helpers/tokenCategories.ts +32 -88
- 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/useSplitStyles.tsx +17 -2
- package/src/hooks/useStyle.ts +10 -0
- package/src/hooks/useTheme.tsx +1 -1
- package/src/hooks/useThemeState.ts +51 -264
- package/src/index.ts +14 -10
- package/src/internal-runtime.ts +10 -9
- package/src/internalRuntimeTypes.ts +1 -0
- package/src/static-resolve.ts +25 -18
- package/src/style.ts +97 -0
- package/src/styled.tsx +46 -332
- package/src/types.tsx +107 -192
- package/src/views/TamaguiProvider.tsx +0 -2
- package/src/views/Text.tsx +26 -21
- package/src/views/Theme.tsx +10 -8
- package/src/views/ThemeDebug.tsx +0 -1
- package/src/views/View.tsx +6 -7
- package/types/createComponent.d.ts.map +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/dom/html.d.ts.map +1 -1
- package/types/dom/htmlRuntime.native.d.ts.map +1 -1
- package/types/dom/primitives.native.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/componentDisplayName.d.ts +0 -3
- package/types/helpers/componentDisplayName.d.ts.map +1 -1
- package/types/helpers/createDesignSystem.d.ts.map +1 -1
- package/types/helpers/createStyledContext.d.ts.map +1 -1
- package/types/helpers/formatDiagnostic.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomic.d.ts +25 -22
- 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 +9 -11
- 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/splitStyleProps.d.ts +44 -0
- package/types/helpers/splitStyleProps.d.ts.map +1 -0
- package/types/helpers/styleFrontend.d.ts +7 -9
- package/types/helpers/styleFrontend.d.ts.map +1 -1
- package/types/helpers/styleStaticConfig.d.ts +14 -0
- package/types/helpers/styleStaticConfig.d.ts.map +1 -0
- 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/useSplitStyles.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 +8 -8
- package/types/index.d.ts.map +1 -1
- package/types/internal-runtime.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 +2 -2
- 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 +12 -48
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +75 -60
- 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/types/views/View.d.ts.map +1 -1
- package/dist/cjs/helpers/directStyleCSS.cjs +0 -348
- package/dist/cjs/helpers/directStyleCSS.native.cjs +0 -20
- 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/getDefaultProps.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/themeable.cjs +0 -92
- package/dist/cjs/helpers/themeable.native.cjs +0 -95
- package/dist/cjs/helpers/themeable.native.js +0 -97
- package/dist/cjs/helpers/themeable.native.js.map +0 -1
- package/dist/cjs/hooks/useProps.cjs +0 -129
- package/dist/cjs/hooks/useProps.native.cjs +0 -135
- package/dist/cjs/hooks/useProps.native.js +0 -137
- package/dist/cjs/hooks/useProps.native.js.map +0 -1
- package/dist/esm/helpers/directStyleCSS.mjs +0 -320
- 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/getDefaultProps.mjs +0 -4
- package/dist/esm/helpers/getDefaultProps.mjs.map +0 -1
- package/dist/esm/helpers/getDefaultProps.native.js +0 -6
- package/dist/esm/helpers/getDefaultProps.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/themeable.mjs +0 -67
- package/dist/esm/helpers/themeable.mjs.map +0 -1
- package/dist/esm/helpers/themeable.native.js +0 -68
- package/dist/esm/helpers/themeable.native.js.map +0 -1
- package/dist/esm/hooks/useProps.mjs +0 -100
- package/dist/esm/hooks/useProps.mjs.map +0 -1
- package/dist/esm/hooks/useProps.native.js +0 -104
- package/dist/esm/hooks/useProps.native.js.map +0 -1
- package/src/helpers/directStyleCSS.native.ts +0 -1
- package/src/helpers/directStyleCSS.ts +0 -534
- package/src/helpers/directStyleCSSCompiled.ts +0 -32
- package/src/helpers/getDefaultProps.ts +0 -3
- package/src/helpers/getVariantExtras.tsx +0 -95
- package/src/helpers/themeable.tsx +0 -96
- package/src/hooks/useProps.tsx +0 -186
- 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/getDefaultProps.d.ts +0 -3
- package/types/helpers/getDefaultProps.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/themeable.d.ts +0 -3
- package/types/helpers/themeable.d.ts.map +0 -1
- package/types/hooks/useProps.d.ts +0 -39
- package/types/hooks/useProps.d.ts.map +0 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
stylePropsInput,
|
|
3
|
+
stylePropsText,
|
|
4
|
+
validStyles as validStylesView,
|
|
5
|
+
} from '@tamagui/helpers'
|
|
6
|
+
import type { StaticConfig, StylePiece, TamaguiInternalConfig } from '../types'
|
|
7
|
+
import { createStylePiece } from '../style'
|
|
8
|
+
import type { StyleStaticConfig } from './styleStaticConfig'
|
|
9
|
+
|
|
10
|
+
const styleStaticConfigCache = new WeakMap<
|
|
11
|
+
StaticConfig,
|
|
12
|
+
WeakMap<TamaguiInternalConfig, { revision: number; value: StyleStaticConfig }>
|
|
13
|
+
>()
|
|
14
|
+
|
|
15
|
+
export function resolveStyleStaticConfig(
|
|
16
|
+
staticConfig: StaticConfig,
|
|
17
|
+
conf: TamaguiInternalConfig,
|
|
18
|
+
revision: number
|
|
19
|
+
): StyleStaticConfig {
|
|
20
|
+
let configCache = styleStaticConfigCache.get(staticConfig)
|
|
21
|
+
const cached = configCache?.get(conf)
|
|
22
|
+
if (cached?.revision === revision) return cached.value
|
|
23
|
+
|
|
24
|
+
const normalized = staticConfig.styleFrontend?.normalizeStaticConfig?.(
|
|
25
|
+
staticConfig,
|
|
26
|
+
conf
|
|
27
|
+
)
|
|
28
|
+
const variants = normalized ? normalized.variants : staticConfig.variants
|
|
29
|
+
const authoredBaseStyle = normalized ? normalized.baseStyle : staticConfig.baseStyle
|
|
30
|
+
const authoredDefaultProps = staticConfig.defaultProps
|
|
31
|
+
let baseStyle: Record<string, any> | undefined
|
|
32
|
+
let baseVariantProps: Record<string, any> | undefined
|
|
33
|
+
let defaultProps: Record<string, any> | undefined
|
|
34
|
+
const validStyles =
|
|
35
|
+
staticConfig.validStyles ||
|
|
36
|
+
(staticConfig.isInput
|
|
37
|
+
? stylePropsInput
|
|
38
|
+
: staticConfig.isText
|
|
39
|
+
? stylePropsText
|
|
40
|
+
: validStylesView)
|
|
41
|
+
if (authoredDefaultProps) {
|
|
42
|
+
for (const key in authoredDefaultProps) {
|
|
43
|
+
const isVariant = Boolean(variants?.[key])
|
|
44
|
+
const isStyle =
|
|
45
|
+
key !== 'transition' && (key in validStyles || key in conf.shorthands)
|
|
46
|
+
if (isVariant || isStyle) {
|
|
47
|
+
;(baseStyle ||= authoredBaseStyle ? { ...authoredBaseStyle } : {})[key] =
|
|
48
|
+
authoredDefaultProps[key]
|
|
49
|
+
}
|
|
50
|
+
if (isVariant || !isStyle) {
|
|
51
|
+
;(defaultProps ||= {})[key] = authoredDefaultProps[key]
|
|
52
|
+
}
|
|
53
|
+
if (isVariant) {
|
|
54
|
+
;(baseVariantProps ||= {})[key] = authoredDefaultProps[key]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const resolvedBaseStyle = baseStyle || authoredBaseStyle
|
|
59
|
+
let baseStylePiece
|
|
60
|
+
let baseStylePieces: Record<string, StylePiece> | undefined
|
|
61
|
+
if (resolvedBaseStyle && !(staticConfig as any).disableBaseStylePiece) {
|
|
62
|
+
let directBaseStyle: Record<string, any> | undefined
|
|
63
|
+
let directBaseKeys: string[] | undefined
|
|
64
|
+
const flushDirectBaseStyle = () => {
|
|
65
|
+
if (!directBaseStyle || !directBaseKeys) return
|
|
66
|
+
const piece = createStylePiece(directBaseStyle, 'base')
|
|
67
|
+
baseStylePiece ||= piece
|
|
68
|
+
baseStylePieces ||= {}
|
|
69
|
+
for (const key of directBaseKeys) {
|
|
70
|
+
baseStylePieces[key] = piece
|
|
71
|
+
}
|
|
72
|
+
directBaseStyle = undefined
|
|
73
|
+
directBaseKeys = undefined
|
|
74
|
+
}
|
|
75
|
+
for (const key in resolvedBaseStyle) {
|
|
76
|
+
const expanded = conf.shorthands[key] || key
|
|
77
|
+
if (key !== 'transition' && !variants?.[key] && expanded in validStyles) {
|
|
78
|
+
;(directBaseStyle ||= {})[key] = resolvedBaseStyle[key]
|
|
79
|
+
;(directBaseKeys ||= []).push(key)
|
|
80
|
+
} else {
|
|
81
|
+
// A default variant between direct declarations must run at that exact
|
|
82
|
+
// authored position. Keeping separate contiguous pieces preserves the
|
|
83
|
+
// base layer's ordinary last-write order while still precompiling it.
|
|
84
|
+
flushDirectBaseStyle()
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
flushDirectBaseStyle()
|
|
88
|
+
}
|
|
89
|
+
const keys = staticConfig.contextProps || staticConfig.context?.propKeys
|
|
90
|
+
const value: StyleStaticConfig = {
|
|
91
|
+
baseStyle: resolvedBaseStyle,
|
|
92
|
+
baseVariantProps,
|
|
93
|
+
baseStylePiece,
|
|
94
|
+
baseStylePieces,
|
|
95
|
+
defaultProps,
|
|
96
|
+
styledContextKeys: keys ? new Set(keys) : null,
|
|
97
|
+
variants,
|
|
98
|
+
variantStyleResolver: (staticConfig as any).variantStyleResolver,
|
|
99
|
+
passthroughClassName: normalized
|
|
100
|
+
? normalized.passthroughClassName
|
|
101
|
+
: staticConfig.passthroughClassName,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!configCache) {
|
|
105
|
+
configCache = new WeakMap()
|
|
106
|
+
styleStaticConfigCache.set(staticConfig, configCache)
|
|
107
|
+
}
|
|
108
|
+
configCache.set(conf, { revision, value })
|
|
109
|
+
return value
|
|
110
|
+
}
|
|
@@ -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,88 +1,4 @@
|
|
|
1
|
-
// The prop -> token-category tables.
|
|
2
|
-
//
|
|
3
|
-
// Its own module because both `propMapper` and `directStyle` bind props to
|
|
4
|
-
// these categories, and `propMapper` needs `directStyle`'s condition resolver:
|
|
5
|
-
// leaving the tables where the resolver's consumer lives made the two files
|
|
6
|
-
// import each other.
|
|
7
|
-
|
|
8
|
-
import { tokenCategories } from '@tamagui/helpers'
|
|
9
|
-
|
|
10
1
|
export type StyleTokenCategory = 'size' | 'space' | 'radius' | 'zIndex' | 'fontSize'
|
|
11
|
-
|
|
12
|
-
function mapTokenCategory(keys: Record<string, boolean>, category: StyleTokenCategory) {
|
|
13
|
-
return Object.fromEntries(Object.keys(keys).map((key) => [key, category]))
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// exported so the flat-value grammar adapter binds props to the same token
|
|
17
|
-
// categories the bare-token path already uses, rather than keeping a second table
|
|
18
|
-
export const tokenCategoryByProperty: Record<string, StyleTokenCategory> = {
|
|
19
|
-
...mapTokenCategory(tokenCategories.size, 'size'),
|
|
20
|
-
...mapTokenCategory(tokenCategories.radius, 'radius'),
|
|
21
|
-
...mapTokenCategory(tokenCategories.zIndex, 'zIndex'),
|
|
22
|
-
// the transform family's x/y are lengths from the space scale (v6 decision:
|
|
23
|
-
// `x="4"` resolves like `p="4"`), never the size category
|
|
24
|
-
x: 'space',
|
|
25
|
-
y: 'space',
|
|
26
|
-
fontSize: 'fontSize',
|
|
27
|
-
borderWidth: 'space',
|
|
28
|
-
borderTopWidth: 'space',
|
|
29
|
-
borderRightWidth: 'space',
|
|
30
|
-
borderBottomWidth: 'space',
|
|
31
|
-
borderLeftWidth: 'space',
|
|
32
|
-
borderBlockWidth: 'space',
|
|
33
|
-
borderBlockStartWidth: 'space',
|
|
34
|
-
borderBlockEndWidth: 'space',
|
|
35
|
-
borderInlineWidth: 'space',
|
|
36
|
-
borderInlineStartWidth: 'space',
|
|
37
|
-
borderInlineEndWidth: 'space',
|
|
38
|
-
outlineOffset: 'space',
|
|
39
|
-
outlineWidth: 'space',
|
|
40
|
-
gap: 'space',
|
|
41
|
-
rowGap: 'space',
|
|
42
|
-
columnGap: 'space',
|
|
43
|
-
top: 'space',
|
|
44
|
-
right: 'space',
|
|
45
|
-
bottom: 'space',
|
|
46
|
-
left: 'space',
|
|
47
|
-
inset: 'space',
|
|
48
|
-
insetBlock: 'space',
|
|
49
|
-
insetBlockEnd: 'space',
|
|
50
|
-
insetBlockStart: 'space',
|
|
51
|
-
insetInline: 'space',
|
|
52
|
-
insetInlineEnd: 'space',
|
|
53
|
-
insetInlineStart: 'space',
|
|
54
|
-
margin: 'space',
|
|
55
|
-
marginBlock: 'space',
|
|
56
|
-
marginBlockEnd: 'space',
|
|
57
|
-
marginBlockStart: 'space',
|
|
58
|
-
marginInline: 'space',
|
|
59
|
-
marginInlineEnd: 'space',
|
|
60
|
-
marginInlineStart: 'space',
|
|
61
|
-
marginTop: 'space',
|
|
62
|
-
marginRight: 'space',
|
|
63
|
-
marginBottom: 'space',
|
|
64
|
-
marginEnd: 'space',
|
|
65
|
-
marginLeft: 'space',
|
|
66
|
-
marginHorizontal: 'space',
|
|
67
|
-
marginStart: 'space',
|
|
68
|
-
marginVertical: 'space',
|
|
69
|
-
padding: 'space',
|
|
70
|
-
paddingBlock: 'space',
|
|
71
|
-
paddingBlockEnd: 'space',
|
|
72
|
-
paddingBlockStart: 'space',
|
|
73
|
-
paddingInline: 'space',
|
|
74
|
-
paddingInlineEnd: 'space',
|
|
75
|
-
paddingInlineStart: 'space',
|
|
76
|
-
paddingTop: 'space',
|
|
77
|
-
paddingRight: 'space',
|
|
78
|
-
paddingBottom: 'space',
|
|
79
|
-
paddingEnd: 'space',
|
|
80
|
-
paddingLeft: 'space',
|
|
81
|
-
paddingHorizontal: 'space',
|
|
82
|
-
paddingStart: 'space',
|
|
83
|
-
paddingVertical: 'space',
|
|
84
|
-
}
|
|
85
|
-
|
|
86
2
|
export type RuntimeTokenCategory = StyleTokenCategory | 'color' | 'font' | 'fontFamily'
|
|
87
3
|
|
|
88
4
|
export function getTokenCategoryForProperty(
|
|
@@ -97,8 +13,36 @@ export function getTokenCategoryForProperty(
|
|
|
97
13
|
) {
|
|
98
14
|
return 'font'
|
|
99
15
|
}
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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'
|
|
47
|
+
}
|
|
104
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
|