@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
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type { PropMappedValue } from '../types'
|
|
2
|
+
import { classifyBorderComponents } from './borderComponents'
|
|
2
3
|
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
|
|
11
|
-
'inset',
|
|
12
|
-
'outset',
|
|
13
|
-
'none',
|
|
14
|
-
'hidden',
|
|
15
|
-
])
|
|
4
|
+
// native width props want numbers: px and unitless become numbers, the CSS
|
|
5
|
+
// width keywords map to their user-agent px values, anything else passes as-is
|
|
6
|
+
export function toNativeBorderWidth(width: string): string | number {
|
|
7
|
+
if (width === 'thin') return 1
|
|
8
|
+
if (width === 'medium') return 3
|
|
9
|
+
if (width === 'thick') return 5
|
|
10
|
+
return width.endsWith('px') || !/[a-z%]/i.test(width) ? Number.parseFloat(width) : width
|
|
11
|
+
}
|
|
16
12
|
|
|
17
13
|
// parses CSS border shorthand: "<width> <style> <color>"
|
|
18
14
|
// components can appear in any order, all are optional
|
|
@@ -28,46 +24,28 @@ export function parseBorderShorthand(value: string): PropMappedValue | undefined
|
|
|
28
24
|
]
|
|
29
25
|
}
|
|
30
26
|
|
|
31
|
-
const
|
|
32
|
-
let borderWidth: string | number | undefined
|
|
33
|
-
let borderStyle: string | undefined
|
|
34
|
-
let borderColor: string | undefined
|
|
35
|
-
|
|
36
|
-
for (const part of parts) {
|
|
37
|
-
// check if it's a border style keyword
|
|
38
|
-
if (borderStyles.has(part)) {
|
|
39
|
-
borderStyle = part
|
|
40
|
-
}
|
|
41
|
-
// check if it's a length (number or ends with px/em/rem/etc)
|
|
42
|
-
else if (/^[\d.]+(?:px|em|rem|%|pt|vw|vh)?$/.test(part)) {
|
|
43
|
-
const num = parseFloat(part)
|
|
44
|
-
borderWidth = part.endsWith('px') || !part.match(/[a-z%]/i) ? num : part
|
|
45
|
-
}
|
|
46
|
-
// otherwise assume it's a color
|
|
47
|
-
else {
|
|
48
|
-
borderColor = part
|
|
49
|
-
}
|
|
50
|
-
}
|
|
27
|
+
const { width, style, color } = classifyBorderComponents(value)
|
|
51
28
|
|
|
52
29
|
const result: PropMappedValue = []
|
|
53
30
|
|
|
54
31
|
// expand to individual width props (RN doesn't support borderWidth shorthand)
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
result.push(['
|
|
58
|
-
result.push(['
|
|
59
|
-
result.push(['
|
|
32
|
+
if (width !== undefined) {
|
|
33
|
+
const nativeWidth = toNativeBorderWidth(width)
|
|
34
|
+
result.push(['borderTopWidth', nativeWidth])
|
|
35
|
+
result.push(['borderRightWidth', nativeWidth])
|
|
36
|
+
result.push(['borderBottomWidth', nativeWidth])
|
|
37
|
+
result.push(['borderLeftWidth', nativeWidth])
|
|
60
38
|
}
|
|
61
39
|
// borderStyle is supported as-is on native
|
|
62
|
-
if (
|
|
63
|
-
result.push(['borderStyle',
|
|
40
|
+
if (style !== undefined) {
|
|
41
|
+
result.push(['borderStyle', style])
|
|
64
42
|
}
|
|
65
43
|
// expand to individual color props (RN doesn't support borderColor shorthand)
|
|
66
|
-
if (
|
|
67
|
-
result.push(['borderTopColor',
|
|
68
|
-
result.push(['borderRightColor',
|
|
69
|
-
result.push(['borderBottomColor',
|
|
70
|
-
result.push(['borderLeftColor',
|
|
44
|
+
if (color !== undefined) {
|
|
45
|
+
result.push(['borderTopColor', color])
|
|
46
|
+
result.push(['borderRightColor', color])
|
|
47
|
+
result.push(['borderBottomColor', color])
|
|
48
|
+
result.push(['borderLeftColor', color])
|
|
71
49
|
}
|
|
72
50
|
|
|
73
51
|
return result.length > 0 ? result : undefined
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import type { PropMappedValue } from '../types'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const outlineStyles = new Set([
|
|
5
|
-
'solid',
|
|
6
|
-
'dashed',
|
|
7
|
-
'dotted',
|
|
8
|
-
'double',
|
|
9
|
-
'groove',
|
|
10
|
-
'ridge',
|
|
11
|
-
'inset',
|
|
12
|
-
'outset',
|
|
13
|
-
'none',
|
|
14
|
-
'hidden',
|
|
15
|
-
])
|
|
2
|
+
import { classifyBorderComponents } from './borderComponents'
|
|
3
|
+
import { toNativeBorderWidth } from './parseBorderShorthand.native'
|
|
16
4
|
|
|
17
5
|
// parses CSS outline shorthand: "<width> <style> <color>"
|
|
18
6
|
// components can appear in any order, all are optional
|
|
@@ -25,37 +13,18 @@ export function parseOutlineShorthand(value: string): PropMappedValue | undefine
|
|
|
25
13
|
]
|
|
26
14
|
}
|
|
27
15
|
|
|
28
|
-
const
|
|
29
|
-
let outlineWidth: string | number | undefined
|
|
30
|
-
let outlineStyle: string | undefined
|
|
31
|
-
let outlineColor: string | undefined
|
|
32
|
-
|
|
33
|
-
for (const part of parts) {
|
|
34
|
-
// check if it's an outline style keyword
|
|
35
|
-
if (outlineStyles.has(part)) {
|
|
36
|
-
outlineStyle = part
|
|
37
|
-
}
|
|
38
|
-
// check if it's a length (number or ends with px/em/rem/etc)
|
|
39
|
-
else if (/^[\d.]+(?:px|em|rem|%|pt|vw|vh)?$/.test(part)) {
|
|
40
|
-
const num = parseFloat(part)
|
|
41
|
-
outlineWidth = part.endsWith('px') || !part.match(/[a-z%]/i) ? num : part
|
|
42
|
-
}
|
|
43
|
-
// otherwise assume it's a color
|
|
44
|
-
else {
|
|
45
|
-
outlineColor = part
|
|
46
|
-
}
|
|
47
|
-
}
|
|
16
|
+
const { width, style, color } = classifyBorderComponents(value, true)
|
|
48
17
|
|
|
49
18
|
const result: PropMappedValue = []
|
|
50
19
|
|
|
51
|
-
if (
|
|
52
|
-
result.push(['outlineWidth',
|
|
20
|
+
if (width !== undefined) {
|
|
21
|
+
result.push(['outlineWidth', toNativeBorderWidth(width)])
|
|
53
22
|
}
|
|
54
|
-
if (
|
|
55
|
-
result.push(['outlineStyle',
|
|
23
|
+
if (style !== undefined) {
|
|
24
|
+
result.push(['outlineStyle', style])
|
|
56
25
|
}
|
|
57
|
-
if (
|
|
58
|
-
result.push(['outlineColor',
|
|
26
|
+
if (color !== undefined) {
|
|
27
|
+
result.push(['outlineColor', color])
|
|
59
28
|
}
|
|
60
29
|
|
|
61
30
|
return result.length > 0 ? result : undefined
|
|
@@ -5,112 +5,45 @@
|
|
|
5
5
|
// insets on native (see resolveSafeArea.native.ts).
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
type Edge = 'top' | '
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
paddingBlock: ['top', 'bottom'],
|
|
27
|
-
paddingInline: ['left', 'right'],
|
|
28
|
-
paddingBlockStart: 'top',
|
|
29
|
-
paddingBlockEnd: 'bottom',
|
|
30
|
-
paddingInlineStart: 'left',
|
|
31
|
-
paddingInlineEnd: 'right',
|
|
32
|
-
// margin
|
|
33
|
-
margin: ['top', 'right', 'bottom', 'left'],
|
|
34
|
-
marginTop: 'top',
|
|
35
|
-
marginBottom: 'bottom',
|
|
36
|
-
marginLeft: 'left',
|
|
37
|
-
marginRight: 'right',
|
|
38
|
-
marginHorizontal: ['left', 'right'],
|
|
39
|
-
marginVertical: ['top', 'bottom'],
|
|
40
|
-
marginStart: 'left',
|
|
41
|
-
marginEnd: 'right',
|
|
42
|
-
marginBlock: ['top', 'bottom'],
|
|
43
|
-
marginInline: ['left', 'right'],
|
|
44
|
-
marginBlockStart: 'top',
|
|
45
|
-
marginBlockEnd: 'bottom',
|
|
46
|
-
marginInlineStart: 'left',
|
|
47
|
-
marginInlineEnd: 'right',
|
|
48
|
-
// inset
|
|
49
|
-
inset: ['top', 'right', 'bottom', 'left'],
|
|
50
|
-
top: 'top',
|
|
51
|
-
bottom: 'bottom',
|
|
52
|
-
left: 'left',
|
|
53
|
-
right: 'right',
|
|
54
|
-
start: 'left',
|
|
55
|
-
end: 'right',
|
|
8
|
+
type Edge = 'top' | 'right' | 'bottom' | 'left'
|
|
9
|
+
|
|
10
|
+
const allEdges: Edge[] = ['top', 'right', 'bottom', 'left']
|
|
11
|
+
const suffixEdges: Record<string, Edge[]> = {
|
|
12
|
+
Horizontal: ['left', 'right'],
|
|
13
|
+
Inline: ['left', 'right'],
|
|
14
|
+
Vertical: ['top', 'bottom'],
|
|
15
|
+
Block: ['top', 'bottom'],
|
|
16
|
+
Start: ['left'],
|
|
17
|
+
InlineStart: ['left'],
|
|
18
|
+
End: ['right'],
|
|
19
|
+
InlineEnd: ['right'],
|
|
20
|
+
Top: ['top'],
|
|
21
|
+
BlockStart: ['top'],
|
|
22
|
+
Bottom: ['bottom'],
|
|
23
|
+
BlockEnd: ['bottom'],
|
|
24
|
+
Left: ['left'],
|
|
25
|
+
Right: ['right'],
|
|
56
26
|
}
|
|
57
27
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return key in propEdges
|
|
28
|
+
function safeAreaEdges(key: string): [string, Edge[]] | undefined {
|
|
29
|
+
if (key === 'inset') return ['', allEdges]
|
|
30
|
+
if (/^(top|right|bottom|left)$/.test(key)) return ['', [key as Edge]]
|
|
31
|
+
if (key === 'start') return ['', ['left']]
|
|
32
|
+
if (key === 'end') return ['', ['right']]
|
|
33
|
+
const match = /^(padding|margin)(.*)$/.exec(key)
|
|
34
|
+
if (!match) return
|
|
35
|
+
const edges = match[2] ? suffixEdges[match[2]] : allEdges
|
|
36
|
+
return edges && [match[1], edges]
|
|
68
37
|
}
|
|
69
38
|
|
|
70
39
|
// resolve key="safe" -> array of [edge-key, value] pairs.
|
|
71
40
|
// returns undefined if key isn't safe-area-aware.
|
|
72
41
|
export function expandSafeAreaValue(key: string): Array<[string, string]> | undefined {
|
|
73
|
-
const
|
|
74
|
-
if (!
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// for inset: emit bare top/right/bottom/left (the actual CSS sides).
|
|
81
|
-
const base = baseKeyForExpansion[key]
|
|
82
|
-
if (base === '') {
|
|
83
|
-
return edges.map((e) => [edgeToSideKey[e], envForEdge[e]])
|
|
84
|
-
}
|
|
85
|
-
return edges.map((e) => [`${base}${edgeToPascal[e]}`, envForEdge[e]])
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const edgeToPascal: Record<Edge, string> = {
|
|
89
|
-
top: 'Top',
|
|
90
|
-
bottom: 'Bottom',
|
|
91
|
-
left: 'Left',
|
|
92
|
-
right: 'Right',
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const edgeToSideKey: Record<Edge, string> = {
|
|
96
|
-
top: 'top',
|
|
97
|
-
bottom: 'bottom',
|
|
98
|
-
left: 'left',
|
|
99
|
-
right: 'right',
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// for each multi-edge prop, what's the base name to prepend Top/Bottom/etc?
|
|
103
|
-
// '' = no prefix (use bare edge names like 'top', 'left')
|
|
104
|
-
const baseKeyForExpansion: Record<string, string> = {
|
|
105
|
-
padding: 'padding',
|
|
106
|
-
paddingHorizontal: 'padding',
|
|
107
|
-
paddingVertical: 'padding',
|
|
108
|
-
paddingBlock: 'padding',
|
|
109
|
-
paddingInline: 'padding',
|
|
110
|
-
margin: 'margin',
|
|
111
|
-
marginHorizontal: 'margin',
|
|
112
|
-
marginVertical: 'margin',
|
|
113
|
-
marginBlock: 'margin',
|
|
114
|
-
marginInline: 'margin',
|
|
115
|
-
inset: '',
|
|
42
|
+
const match = safeAreaEdges(key)
|
|
43
|
+
if (!match) return
|
|
44
|
+
const [base, edges] = match
|
|
45
|
+
return edges.map((edge) => [
|
|
46
|
+
base ? `${base}${edge[0].toUpperCase()}${edge.slice(1)}` : edge,
|
|
47
|
+
`env(safe-area-inset-${edge})`,
|
|
48
|
+
])
|
|
116
49
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { GetStyleState } from '../types'
|
|
2
|
+
import { emitVariantStyle, walkConditionalValue } from './getSplitStyles'
|
|
3
|
+
import { isObj } from './isObj'
|
|
4
|
+
import { skipProps } from './skipProps'
|
|
5
|
+
import { styleOriginalValues } from './styleOriginalValues'
|
|
6
|
+
import { normalizeValueWithProperty } from './normalizeValueWithProperty'
|
|
7
|
+
import { getDynamicEnv, isStyledDynamic } from './styledDynamic'
|
|
8
|
+
|
|
9
|
+
export function resolveVariantStyle(
|
|
10
|
+
state: GetStyleState,
|
|
11
|
+
variants: Record<string, any>,
|
|
12
|
+
key: string,
|
|
13
|
+
value: any,
|
|
14
|
+
parentKey = key,
|
|
15
|
+
parentCondition?: unknown
|
|
16
|
+
) {
|
|
17
|
+
const definition = variants[key]
|
|
18
|
+
// bare styled.dynamic<T>(): the prop is typed and consumed here; its style
|
|
19
|
+
// comes from a component resolver reading it off props
|
|
20
|
+
if (typeof definition !== 'function' && isStyledDynamic(definition)) {
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
if (
|
|
24
|
+
!(
|
|
25
|
+
typeof value === 'string' &&
|
|
26
|
+
definition &&
|
|
27
|
+
typeof definition === 'object' &&
|
|
28
|
+
value in definition
|
|
29
|
+
) &&
|
|
30
|
+
walkConditionalValue(state, key, value, parentCondition, (payload, condition) =>
|
|
31
|
+
resolveSelection(state, variants, key, payload, parentKey, condition || undefined)
|
|
32
|
+
)
|
|
33
|
+
) {
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
resolveSelection(state, variants, key, value, parentKey, parentCondition)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function resolveSelection(
|
|
40
|
+
state: GetStyleState,
|
|
41
|
+
variants: Record<string, any>,
|
|
42
|
+
key: string,
|
|
43
|
+
value: any,
|
|
44
|
+
parentKey: string,
|
|
45
|
+
condition?: unknown
|
|
46
|
+
) {
|
|
47
|
+
const definition = variants[key]
|
|
48
|
+
let output
|
|
49
|
+
if (isStyledDynamic(definition) && typeof definition === 'function') {
|
|
50
|
+
// styled.dynamic(fn): pure function of the (per-clause) value + env
|
|
51
|
+
output = definition(value, getDynamicEnv(state))
|
|
52
|
+
} else if (definition && typeof definition === 'object' && value !== undefined) {
|
|
53
|
+
output = definition[value]
|
|
54
|
+
}
|
|
55
|
+
if (!isObj(output)) return
|
|
56
|
+
|
|
57
|
+
const originals = styleOriginalValues.get(output)
|
|
58
|
+
for (const outputKey in output) {
|
|
59
|
+
if (!state.styleProps.noSkip && outputKey in skipProps) continue
|
|
60
|
+
const raw = output[outputKey]
|
|
61
|
+
// A dynamic's static shape is allowed to use undefined values for
|
|
62
|
+
// conditionals. They are absent, matching resolver output semantics, and
|
|
63
|
+
// must not normalize into an "undefined" atomic rule.
|
|
64
|
+
if (raw == null) continue
|
|
65
|
+
const value = state.styleProps.noNormalize
|
|
66
|
+
? raw
|
|
67
|
+
: normalizeValueWithProperty(raw, state.conf.shorthands[outputKey] || outputKey)
|
|
68
|
+
emitVariantStyle(
|
|
69
|
+
state,
|
|
70
|
+
outputKey,
|
|
71
|
+
value,
|
|
72
|
+
originals?.[outputKey] ?? raw,
|
|
73
|
+
condition,
|
|
74
|
+
parentKey === key && outputKey === key
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { stylePropsAll } from '@tamagui/helpers'
|
|
2
|
+
|
|
3
|
+
import { getConfig } from '../config'
|
|
4
|
+
import type { Shorthands } from '../types'
|
|
5
|
+
|
|
6
|
+
type StringKey<Props> = Extract<keyof Props, string>
|
|
7
|
+
type Simplify<Value> = { [Key in keyof Value]: Value[Key] }
|
|
8
|
+
|
|
9
|
+
type ExpandedShorthandKey<
|
|
10
|
+
Key extends PropertyKey,
|
|
11
|
+
ShorthandMap extends object = Shorthands,
|
|
12
|
+
> = Key extends keyof ShorthandMap
|
|
13
|
+
? ShorthandMap[Key] extends PropertyKey
|
|
14
|
+
? ShorthandMap[Key]
|
|
15
|
+
: Key
|
|
16
|
+
: Key
|
|
17
|
+
|
|
18
|
+
type ShorthandKeysMatchingFilter<
|
|
19
|
+
Filter extends object,
|
|
20
|
+
ShorthandMap extends object = Shorthands,
|
|
21
|
+
> = {
|
|
22
|
+
[Key in keyof ShorthandMap]-?: ShorthandMap[Key] extends keyof Filter ? Key : never
|
|
23
|
+
}[keyof ShorthandMap]
|
|
24
|
+
|
|
25
|
+
type KeysMatchingFilter<Filter extends object, ShorthandMap extends object = Shorthands> =
|
|
26
|
+
| keyof Filter
|
|
27
|
+
| ShorthandKeysMatchingFilter<Filter, ShorthandMap>
|
|
28
|
+
|
|
29
|
+
type StyleKeys = KeysMatchingFilter<typeof stylePropsAll>
|
|
30
|
+
|
|
31
|
+
type ExpandedProps<
|
|
32
|
+
Props extends object,
|
|
33
|
+
Keys extends keyof Props,
|
|
34
|
+
ShorthandMap extends object,
|
|
35
|
+
> = Simplify<
|
|
36
|
+
{
|
|
37
|
+
[Key in Extract<Keys, keyof ShorthandMap> as ExpandedShorthandKey<
|
|
38
|
+
Key,
|
|
39
|
+
ShorthandMap
|
|
40
|
+
>]: Props[Key]
|
|
41
|
+
} & Omit<Pick<Props, Keys>, keyof ShorthandMap>
|
|
42
|
+
>
|
|
43
|
+
|
|
44
|
+
type SelectedProps<
|
|
45
|
+
Props extends object,
|
|
46
|
+
Keys extends keyof Props,
|
|
47
|
+
ExpandShorthands extends boolean,
|
|
48
|
+
ShorthandMap extends object = Shorthands,
|
|
49
|
+
> = ExpandShorthands extends true
|
|
50
|
+
? ExpandedProps<Props, Keys, ShorthandMap>
|
|
51
|
+
: Pick<Props, Keys>
|
|
52
|
+
|
|
53
|
+
export type SplitStylePropsResult<
|
|
54
|
+
Props extends object,
|
|
55
|
+
Keys extends PropertyKey,
|
|
56
|
+
ExpandShorthands extends boolean = false,
|
|
57
|
+
ShorthandMap extends object = Shorthands,
|
|
58
|
+
> = [
|
|
59
|
+
SelectedProps<Props, Extract<keyof Props, Keys>, ExpandShorthands, ShorthandMap>,
|
|
60
|
+
Omit<Props, Keys>,
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
export type SplitStylePropsFilterCallback<Props extends object> = (
|
|
64
|
+
key: string,
|
|
65
|
+
value: Props[StringKey<Props>],
|
|
66
|
+
originalKey: StringKey<Props>,
|
|
67
|
+
isStyleProp: boolean
|
|
68
|
+
) => boolean
|
|
69
|
+
|
|
70
|
+
export type SplitStylePropsFilter<Props extends object> =
|
|
71
|
+
| Readonly<Record<string, unknown>>
|
|
72
|
+
| SplitStylePropsFilterCallback<Props>
|
|
73
|
+
|
|
74
|
+
export type SplitStylePropsOptions<Props extends object> = {
|
|
75
|
+
expandShorthands?: boolean
|
|
76
|
+
filter?: SplitStylePropsFilter<Props>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** partitions authored props in one pass without resolving style values */
|
|
80
|
+
export function splitStyleProps<
|
|
81
|
+
Props extends object,
|
|
82
|
+
const ExpandShorthands extends boolean = false,
|
|
83
|
+
>(
|
|
84
|
+
props: Props,
|
|
85
|
+
options?: { expandShorthands?: ExpandShorthands }
|
|
86
|
+
): SplitStylePropsResult<Props, StyleKeys, ExpandShorthands>
|
|
87
|
+
|
|
88
|
+
export function splitStyleProps<
|
|
89
|
+
Props extends object,
|
|
90
|
+
const Filter extends Readonly<Record<string, unknown>>,
|
|
91
|
+
const ExpandShorthands extends boolean = false,
|
|
92
|
+
>(
|
|
93
|
+
props: Props,
|
|
94
|
+
options: { expandShorthands?: ExpandShorthands; filter: Filter }
|
|
95
|
+
): SplitStylePropsResult<Props, KeysMatchingFilter<Filter>, ExpandShorthands>
|
|
96
|
+
|
|
97
|
+
export function splitStyleProps<
|
|
98
|
+
Props extends object,
|
|
99
|
+
SelectedKey extends StringKey<Props>,
|
|
100
|
+
const ExpandShorthands extends boolean = false,
|
|
101
|
+
>(
|
|
102
|
+
props: Props,
|
|
103
|
+
options: {
|
|
104
|
+
expandShorthands?: ExpandShorthands
|
|
105
|
+
filter: (
|
|
106
|
+
key: string,
|
|
107
|
+
value: Props[StringKey<Props>],
|
|
108
|
+
originalKey: StringKey<Props>,
|
|
109
|
+
isStyleProp: boolean
|
|
110
|
+
) => originalKey is SelectedKey
|
|
111
|
+
}
|
|
112
|
+
): SplitStylePropsResult<Props, SelectedKey, ExpandShorthands>
|
|
113
|
+
|
|
114
|
+
export function splitStyleProps<
|
|
115
|
+
Props extends object,
|
|
116
|
+
const ExpandShorthands extends boolean = false,
|
|
117
|
+
>(
|
|
118
|
+
props: Props,
|
|
119
|
+
options: {
|
|
120
|
+
expandShorthands?: ExpandShorthands
|
|
121
|
+
filter: SplitStylePropsFilterCallback<Props>
|
|
122
|
+
}
|
|
123
|
+
): [Partial<SelectedProps<Props, keyof Props, ExpandShorthands>>, Partial<Props>]
|
|
124
|
+
|
|
125
|
+
export function splitStyleProps(
|
|
126
|
+
props: object,
|
|
127
|
+
options: {
|
|
128
|
+
expandShorthands?: boolean
|
|
129
|
+
filter?:
|
|
130
|
+
| Readonly<Record<string, unknown>>
|
|
131
|
+
| ((
|
|
132
|
+
key: string,
|
|
133
|
+
value: unknown,
|
|
134
|
+
originalKey: string,
|
|
135
|
+
isStyleProp: boolean
|
|
136
|
+
) => boolean)
|
|
137
|
+
} = {}
|
|
138
|
+
) {
|
|
139
|
+
const styleProps: Record<string, unknown> = {}
|
|
140
|
+
const regularProps: Record<string, unknown> = {}
|
|
141
|
+
const { expandShorthands = false, filter } = options
|
|
142
|
+
const shorthands = getConfig().shorthands
|
|
143
|
+
const filterIsFunction = typeof filter === 'function'
|
|
144
|
+
const propsRecord = props as Record<string, unknown>
|
|
145
|
+
|
|
146
|
+
for (const originalKey in props) {
|
|
147
|
+
if (!Object.hasOwn(props, originalKey)) continue
|
|
148
|
+
|
|
149
|
+
const value = propsRecord[originalKey]
|
|
150
|
+
const key = shorthands[originalKey] || originalKey
|
|
151
|
+
const isStyleProp = key in stylePropsAll
|
|
152
|
+
const selected = filter
|
|
153
|
+
? filterIsFunction
|
|
154
|
+
? filter(key, value, originalKey, isStyleProp)
|
|
155
|
+
: Object.hasOwn(filter, key)
|
|
156
|
+
: isStyleProp
|
|
157
|
+
|
|
158
|
+
if (selected) {
|
|
159
|
+
styleProps[expandShorthands ? key : originalKey] = value
|
|
160
|
+
} else {
|
|
161
|
+
regularProps[originalKey] = value
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return [styleProps, regularProps]
|
|
166
|
+
}
|
|
@@ -30,10 +30,14 @@ export type FrontendStaticConfig = {
|
|
|
30
30
|
*/
|
|
31
31
|
passthroughClassName?: string
|
|
32
32
|
variants?: Record<string, Record<string, any>>
|
|
33
|
-
compoundVariants?: readonly Record<string, any>[]
|
|
34
33
|
styleFrontend?: StyleFrontend
|
|
35
34
|
}
|
|
36
35
|
|
|
36
|
+
export type FrontendStaticConfigNormalization = Pick<
|
|
37
|
+
FrontendStaticConfig,
|
|
38
|
+
'baseStyle' | 'passthroughClassName' | 'variants'
|
|
39
|
+
>
|
|
40
|
+
|
|
37
41
|
/**
|
|
38
42
|
* What the internal View/Text factory and a frontend-bound `styled()` hand back: an
|
|
39
43
|
* opaque component object carrying its static config. Deliberately not core's
|
|
@@ -60,6 +64,8 @@ export type FrontendClassPlan =
|
|
|
60
64
|
preserveRawClass: boolean
|
|
61
65
|
}
|
|
62
66
|
|
|
67
|
+
export type FrontendClassSink = (entry: FrontendClassPlanEntry) => void
|
|
68
|
+
|
|
63
69
|
/**
|
|
64
70
|
* A component's authoring syntax. It is chosen by the package the component was
|
|
65
71
|
* imported from and frozen onto its static config when the component is created:
|
|
@@ -73,21 +79,22 @@ export type FrontendClassPlan =
|
|
|
73
79
|
* contribution, merging, web lowering, and native evaluation all stay in core.
|
|
74
80
|
*/
|
|
75
81
|
export type StyleFrontend = {
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
/** resolves one class candidate and sends claimed entries to the shared cursor */
|
|
83
|
+
resolveClassName?: (
|
|
84
|
+
candidate: string,
|
|
85
|
+
config: StyleFrontendConfig,
|
|
86
|
+
sink: FrontendClassSink
|
|
87
|
+
) => boolean | null
|
|
81
88
|
|
|
82
89
|
/**
|
|
83
90
|
* Resolves frontend-specific static style input (a class-string base, string
|
|
84
|
-
* variant values
|
|
85
|
-
* Called once per (staticConfig, config)
|
|
91
|
+
* variant values) into ordinary style objects.
|
|
92
|
+
* Called once per (staticConfig, config revision) by the shared runtime cache.
|
|
86
93
|
*/
|
|
87
94
|
normalizeStaticConfig?: <Config extends FrontendStaticConfig>(
|
|
88
95
|
staticConfig: Config,
|
|
89
96
|
config: StyleFrontendConfig
|
|
90
|
-
) =>
|
|
97
|
+
) => FrontendStaticConfigNormalization
|
|
91
98
|
}
|
|
92
99
|
|
|
93
100
|
/**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StaticConfig, StylePiece, TamaguiInternalConfig } from '../types'
|
|
2
|
+
import { getConfigRevisionState } from './grammarConfig'
|
|
3
|
+
|
|
4
|
+
export type StyleStaticConfig = {
|
|
5
|
+
baseStyle: Record<string, any> | undefined
|
|
6
|
+
baseVariantProps: Record<string, any> | undefined
|
|
7
|
+
baseStylePiece: StylePiece | undefined
|
|
8
|
+
baseStylePieces: Record<string, StylePiece> | undefined
|
|
9
|
+
defaultProps: Record<string, any> | undefined
|
|
10
|
+
styledContextKeys: Set<string> | null
|
|
11
|
+
variants: StaticConfig['variants']
|
|
12
|
+
variantStyleResolver: any
|
|
13
|
+
passthroughClassName: string | undefined
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getStyleStaticConfig(
|
|
17
|
+
staticConfig: StaticConfig,
|
|
18
|
+
conf: TamaguiInternalConfig
|
|
19
|
+
): StyleStaticConfig {
|
|
20
|
+
return getConfigRevisionState(conf).styleStaticConfig(staticConfig, conf)
|
|
21
|
+
}
|