@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
package/src/styled.tsx
CHANGED
|
@@ -1,77 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
ButtonHTMLAttributes,
|
|
4
|
-
FormHTMLAttributes,
|
|
5
|
-
HTMLAttributes,
|
|
6
|
-
InputHTMLAttributes,
|
|
7
|
-
LabelHTMLAttributes,
|
|
8
|
-
SelectHTMLAttributes,
|
|
9
|
-
TextareaHTMLAttributes,
|
|
10
|
-
} from 'react'
|
|
1
|
+
import { stylePropsInput, stylePropsText } from '@tamagui/helpers'
|
|
2
|
+
|
|
11
3
|
import { createComponent } from './createComponent'
|
|
12
|
-
import {
|
|
13
|
-
componentDisplayName,
|
|
14
|
-
setComponentDisplayName,
|
|
15
|
-
} from './helpers/componentDisplayName'
|
|
4
|
+
import { componentDisplayName } from './helpers/componentDisplayName'
|
|
16
5
|
import { mergeVariants } from './helpers/mergeVariants'
|
|
6
|
+
import { resolveVariantStyle } from './helpers/resolveVariantStyle'
|
|
7
|
+
import { styledDynamic } from './helpers/styledDynamic'
|
|
17
8
|
import type { FrontendComponent, StyleFrontend } from './helpers/styleFrontend'
|
|
18
9
|
import { warnOnce } from './helpers/warnOnce'
|
|
19
10
|
import type { GetRef } from './interfaces/GetRef'
|
|
20
11
|
import { getReactNativeConfig } from './setupReactNative'
|
|
21
12
|
import type {
|
|
22
|
-
CompoundVariantDefinition,
|
|
23
13
|
GetBaseStyles,
|
|
24
14
|
GetNonStyledProps,
|
|
25
15
|
GetProps,
|
|
26
16
|
GetStaticConfig,
|
|
27
17
|
GetStyledVariants,
|
|
28
|
-
InferStyleProps,
|
|
29
18
|
InferStyledProps,
|
|
30
|
-
StackStyle,
|
|
31
|
-
StackStyleBase,
|
|
32
19
|
StaticConfig,
|
|
33
20
|
StaticConfigPublic,
|
|
34
21
|
StylableComponent,
|
|
35
22
|
StyledContext,
|
|
23
|
+
StyledDynamicFn,
|
|
24
|
+
StyledDynamicProp,
|
|
36
25
|
TamaDefer,
|
|
37
26
|
TamaguiComponent,
|
|
38
|
-
TamaguiComponentPropsBase,
|
|
39
|
-
TextStyle,
|
|
40
|
-
TextStylePropsBase,
|
|
41
|
-
ThemeValueByCategory,
|
|
42
27
|
ThemeValueGet,
|
|
43
28
|
VariantDefinitions,
|
|
44
|
-
VariantResolverKey,
|
|
45
|
-
VariantResolverValue,
|
|
46
|
-
VariantSpreadFunction,
|
|
47
29
|
} from './types'
|
|
48
|
-
import type { Text } from './views/Text'
|
|
49
|
-
|
|
50
|
-
export { createVariantResolver } from './types'
|
|
51
30
|
|
|
52
31
|
type AreVariantsUndefined<Variants> =
|
|
53
32
|
// because we pass in the Generic variants which for some reason has this :)
|
|
54
33
|
Required<Variants> extends { _isEmpty: 1 } ? true : false
|
|
55
34
|
|
|
56
|
-
// these stay strict (exact branch keys): defaultVariants, options roots,
|
|
57
|
-
//
|
|
58
|
-
// there remain type errors. the conditional flat forms (clause strings and
|
|
35
|
+
// these stay strict (exact branch keys): defaultVariants, options roots, and
|
|
36
|
+
// the stored component variants all use them, so typos there remain type errors. the conditional flat forms (clause strings and
|
|
59
37
|
// objects) widen only at the final public props, in WithThemeAndShorthands
|
|
60
38
|
type GetVariantAcceptedValues<V> = V extends object
|
|
61
39
|
? {
|
|
62
|
-
|
|
40
|
+
// the fn carrier check runs first: the bare carrier's phantom is
|
|
41
|
+
// optional, so it would match a fn too and infer unknown
|
|
42
|
+
[Key in keyof V]?: V[Key] extends StyledDynamicFn<infer Val, any>
|
|
63
43
|
? Val
|
|
64
|
-
:
|
|
44
|
+
: V[Key] extends StyledDynamicProp<infer Val>
|
|
45
|
+
? Val
|
|
46
|
+
: GetVariantAcceptedValue<keyof V[Key]>
|
|
65
47
|
}
|
|
66
48
|
: undefined
|
|
67
49
|
|
|
68
|
-
type GetVariantAcceptedValue<Key> = Key extends 'true' | 'false'
|
|
69
|
-
? boolean
|
|
70
|
-
: Key extends string
|
|
71
|
-
? VariantResolverKey<Key> extends never
|
|
72
|
-
? Key
|
|
73
|
-
: VariantResolverValue<Key>
|
|
74
|
-
: Key
|
|
50
|
+
type GetVariantAcceptedValue<Key> = Key extends 'true' | 'false' ? boolean : Key
|
|
75
51
|
|
|
76
52
|
type NoInferLocal<T> = [T][T extends any ? 0 : never]
|
|
77
53
|
type IsAny<T> = 0 extends 1 & T ? true : false
|
|
@@ -109,18 +85,6 @@ export type StyledOptions<
|
|
|
109
85
|
ContextPropKeys,
|
|
110
86
|
keyof GetStyledContextAllProps<Context> & string
|
|
111
87
|
>[]
|
|
112
|
-
compoundVariants?: readonly CompoundVariantDefinition<
|
|
113
|
-
NoInferLocal<
|
|
114
|
-
GetCompoundVariantMatchProps<
|
|
115
|
-
ParentComponent,
|
|
116
|
-
StyledConfig,
|
|
117
|
-
Variants,
|
|
118
|
-
Context,
|
|
119
|
-
ContextPropKeys
|
|
120
|
-
>
|
|
121
|
-
>,
|
|
122
|
-
Partial<InferStyleProps<ParentComponent, StyledConfig>>
|
|
123
|
-
>[]
|
|
124
88
|
render?: string | React.ReactElement
|
|
125
89
|
}
|
|
126
90
|
|
|
@@ -154,33 +118,6 @@ type GetStyledContextVariantProps<
|
|
|
154
118
|
Keys extends string,
|
|
155
119
|
> = Omit<GetStyledContextProps<Context, Keys>, keyof GetProps<ParentComponent>>
|
|
156
120
|
|
|
157
|
-
type GetCompoundVariantMatchProps<
|
|
158
|
-
ParentComponent extends StylableComponent,
|
|
159
|
-
StyledConfig extends StaticConfigPublic,
|
|
160
|
-
Variants extends VariantDefinitions<ParentComponent, StyledConfig>,
|
|
161
|
-
Context,
|
|
162
|
-
ContextPropKeys extends string,
|
|
163
|
-
> = Omit<StyledMergedVariants<ParentComponent, StyledConfig, Variants>, '_isEmpty'> &
|
|
164
|
-
GetStyledContextProps<Context, ContextPropKeys>
|
|
165
|
-
|
|
166
|
-
type StyledCustomTokenProps<
|
|
167
|
-
ParentComponent extends StylableComponent,
|
|
168
|
-
StyledConfig extends StaticConfigPublic,
|
|
169
|
-
ParentStylesBase extends object,
|
|
170
|
-
Accepted = StyledConfig['accept'],
|
|
171
|
-
> =
|
|
172
|
-
Accepted extends Record<string, any>
|
|
173
|
-
? {
|
|
174
|
-
[Key in keyof Accepted]?:
|
|
175
|
-
| (Key extends keyof ParentStylesBase ? ParentStylesBase[Key] : never)
|
|
176
|
-
| (Accepted[Key] extends 'style'
|
|
177
|
-
? Partial<InferStyleProps<ParentComponent, StyledConfig>>
|
|
178
|
-
: Accepted[Key] extends 'textStyle'
|
|
179
|
-
? Partial<InferStyleProps<typeof Text, StyledConfig>>
|
|
180
|
-
: ThemeValueByCategory<Accepted[Key]>)
|
|
181
|
-
}
|
|
182
|
-
: {}
|
|
183
|
-
|
|
184
121
|
type StyledMergedVariants<
|
|
185
122
|
ParentComponent extends StylableComponent,
|
|
186
123
|
StyledConfig extends StaticConfigPublic,
|
|
@@ -217,15 +154,7 @@ type StyledComponentResult<
|
|
|
217
154
|
TamaDefer,
|
|
218
155
|
GetRef<ParentComponent>,
|
|
219
156
|
GetNonStyledProps<ParentComponent>,
|
|
220
|
-
|
|
221
|
-
? ParentStylesBase &
|
|
222
|
-
StyledCustomTokenProps<
|
|
223
|
-
ParentComponent,
|
|
224
|
-
StyledConfig,
|
|
225
|
-
ParentStylesBase,
|
|
226
|
-
StyledConfig['accept']
|
|
227
|
-
>
|
|
228
|
-
: ParentStylesBase,
|
|
157
|
+
ParentStylesBase,
|
|
229
158
|
StyledVariantsWithContext<
|
|
230
159
|
StyledMergedVariants<ParentComponent, StyledConfig, Variants>,
|
|
231
160
|
GetStyledContextVariantProps<ParentComponent, Context, ContextPropKeys>
|
|
@@ -233,181 +162,14 @@ type StyledComponentResult<
|
|
|
233
162
|
GetStaticConfig<ParentComponent, StyledConfig>
|
|
234
163
|
>
|
|
235
164
|
|
|
236
|
-
// ---- HTML element support for styledHtml('tagName') ----
|
|
237
|
-
|
|
238
|
-
// text-like elements use TextStylePropsBase
|
|
239
|
-
type TextLikeElements =
|
|
240
|
-
| 'a'
|
|
241
|
-
| 'abbr'
|
|
242
|
-
| 'b'
|
|
243
|
-
| 'bdi'
|
|
244
|
-
| 'bdo'
|
|
245
|
-
| 'cite'
|
|
246
|
-
| 'code'
|
|
247
|
-
| 'data'
|
|
248
|
-
| 'del'
|
|
249
|
-
| 'dfn'
|
|
250
|
-
| 'em'
|
|
251
|
-
| 'i'
|
|
252
|
-
| 'ins'
|
|
253
|
-
| 'kbd'
|
|
254
|
-
| 'label'
|
|
255
|
-
| 'mark'
|
|
256
|
-
| 'q'
|
|
257
|
-
| 's'
|
|
258
|
-
| 'samp'
|
|
259
|
-
| 'small'
|
|
260
|
-
| 'span'
|
|
261
|
-
| 'strong'
|
|
262
|
-
| 'sub'
|
|
263
|
-
| 'sup'
|
|
264
|
-
| 'time'
|
|
265
|
-
| 'u'
|
|
266
|
-
| 'var'
|
|
267
|
-
|
|
268
|
-
// props that conflict with tamagui style props
|
|
269
|
-
type ConflictingHTMLProps =
|
|
270
|
-
| 'color'
|
|
271
|
-
| 'display'
|
|
272
|
-
| 'height'
|
|
273
|
-
| 'width'
|
|
274
|
-
| 'size'
|
|
275
|
-
| 'left'
|
|
276
|
-
| 'right'
|
|
277
|
-
| 'top'
|
|
278
|
-
| 'bottom'
|
|
279
|
-
| 'translate'
|
|
280
|
-
| 'content'
|
|
281
|
-
|
|
282
|
-
// map HTML tag to its specific attributes
|
|
283
|
-
type HTMLElementSpecificProps<T extends keyof HTMLElementTagNameMap> = T extends 'a'
|
|
284
|
-
? Omit<AnchorHTMLAttributes<HTMLAnchorElement>, ConflictingHTMLProps>
|
|
285
|
-
: T extends 'button'
|
|
286
|
-
? Omit<ButtonHTMLAttributes<HTMLButtonElement>, ConflictingHTMLProps>
|
|
287
|
-
: T extends 'input'
|
|
288
|
-
? Omit<InputHTMLAttributes<HTMLInputElement>, ConflictingHTMLProps>
|
|
289
|
-
: T extends 'select'
|
|
290
|
-
? Omit<SelectHTMLAttributes<HTMLSelectElement>, ConflictingHTMLProps>
|
|
291
|
-
: T extends 'textarea'
|
|
292
|
-
? Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, ConflictingHTMLProps>
|
|
293
|
-
: T extends 'form'
|
|
294
|
-
? Omit<FormHTMLAttributes<HTMLFormElement>, ConflictingHTMLProps>
|
|
295
|
-
: T extends 'label'
|
|
296
|
-
? Omit<LabelHTMLAttributes<HTMLLabelElement>, ConflictingHTMLProps>
|
|
297
|
-
: Omit<HTMLAttributes<HTMLElement>, ConflictingHTMLProps>
|
|
298
|
-
|
|
299
|
-
// base style props based on element type. the BASE type feeds TamaguiComponent,
|
|
300
|
-
// whose GetFinalProps applies WithThemeAndShorthands itself — passing the
|
|
301
|
-
// already-wrapped TextStyle/StackStyle there wraps twice, which the flat object
|
|
302
|
-
// value form turns into a type-explosion. authored options still use the
|
|
303
|
-
// wrapped form so tokens and clauses typecheck in the definition
|
|
304
|
-
type HTMLElementStyleBase<T extends keyof HTMLElementTagNameMap> =
|
|
305
|
-
T extends TextLikeElements ? TextStylePropsBase : StackStyleBase
|
|
306
|
-
type HTMLElementStyle<T extends keyof HTMLElementTagNameMap> = T extends TextLikeElements
|
|
307
|
-
? TextStyle
|
|
308
|
-
: StackStyle
|
|
309
|
-
|
|
310
|
-
// runtime check for text-like elements
|
|
311
|
-
const textLikeElements = new Set<string>([
|
|
312
|
-
'a',
|
|
313
|
-
'abbr',
|
|
314
|
-
'b',
|
|
315
|
-
'bdi',
|
|
316
|
-
'bdo',
|
|
317
|
-
'cite',
|
|
318
|
-
'code',
|
|
319
|
-
'data',
|
|
320
|
-
'del',
|
|
321
|
-
'dfn',
|
|
322
|
-
'em',
|
|
323
|
-
'i',
|
|
324
|
-
'ins',
|
|
325
|
-
'kbd',
|
|
326
|
-
'label',
|
|
327
|
-
'mark',
|
|
328
|
-
'q',
|
|
329
|
-
's',
|
|
330
|
-
'samp',
|
|
331
|
-
'small',
|
|
332
|
-
'span',
|
|
333
|
-
'strong',
|
|
334
|
-
'sub',
|
|
335
|
-
'sup',
|
|
336
|
-
'time',
|
|
337
|
-
'u',
|
|
338
|
-
'var',
|
|
339
|
-
])
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* styledHtml() for HTML element tags like 'a', 'button', 'div', etc.
|
|
343
|
-
* Automatically provides element-specific props (href for anchors, type for buttons, etc.)
|
|
344
|
-
*
|
|
345
|
-
* @example
|
|
346
|
-
* const StyledAnchor = styledHtml('a', {
|
|
347
|
-
* color: 'blue10',
|
|
348
|
-
* textDecorationLine: 'underline',
|
|
349
|
-
* })
|
|
350
|
-
* // StyledAnchor now accepts `href` prop with proper typing
|
|
351
|
-
* <StyledAnchor href="/path">Link</StyledAnchor>
|
|
352
|
-
*/
|
|
353
|
-
export function styledHtml<
|
|
354
|
-
Tag extends keyof HTMLElementTagNameMap,
|
|
355
|
-
Variants extends VariantDefinitions<any, any> | undefined = undefined,
|
|
356
|
-
>(
|
|
357
|
-
tag: Tag,
|
|
358
|
-
options?: Partial<HTMLElementStyle<Tag>> & {
|
|
359
|
-
displayName?: string
|
|
360
|
-
variants?: Variants
|
|
361
|
-
defaultVariants?: GetVariantAcceptedValues<NonNullable<Variants>>
|
|
362
|
-
context?: StyledContext
|
|
363
|
-
}
|
|
364
|
-
) {
|
|
365
|
-
type StyleBase = HTMLElementStyleBase<Tag>
|
|
366
|
-
type HTMLProps = HTMLElementSpecificProps<Tag>
|
|
367
|
-
type VariantProps = Variants extends undefined
|
|
368
|
-
? {}
|
|
369
|
-
: AreVariantsUndefined<NonNullable<Variants>> extends true
|
|
370
|
-
? {}
|
|
371
|
-
: GetVariantAcceptedValues<NonNullable<Variants>>
|
|
372
|
-
|
|
373
|
-
const isText = textLikeElements.has(tag)
|
|
374
|
-
const { variants, displayName, defaultVariants, context, ...defaultProps } =
|
|
375
|
-
options || {}
|
|
376
|
-
|
|
377
|
-
const conf: Partial<StaticConfig> = {
|
|
378
|
-
Component: tag as any,
|
|
379
|
-
variants: variants as any,
|
|
380
|
-
defaultProps: defaultProps as any,
|
|
381
|
-
defaultVariants,
|
|
382
|
-
isText,
|
|
383
|
-
acceptsClassName: true,
|
|
384
|
-
context,
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (defaultProps['children'] || context) {
|
|
388
|
-
conf.neverFlatten = true
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
const component = setComponentDisplayName(createComponent(conf), displayName)
|
|
392
|
-
|
|
393
|
-
return component as any as TamaguiComponent<
|
|
394
|
-
TamaDefer,
|
|
395
|
-
HTMLElementTagNameMap[Tag],
|
|
396
|
-
TamaguiComponentPropsBase & HTMLProps,
|
|
397
|
-
StyleBase,
|
|
398
|
-
VariantProps,
|
|
399
|
-
{}
|
|
400
|
-
>
|
|
401
|
-
}
|
|
402
|
-
|
|
403
165
|
/**
|
|
404
166
|
* styled() for creating Tamagui components from other components.
|
|
405
167
|
*
|
|
406
168
|
* Core's public overload is object-only. The class-string form belongs to
|
|
407
|
-
* `@tamagui/tailwind`, which reaches
|
|
169
|
+
* `@tamagui/tailwind`, which reaches the implementation through
|
|
408
170
|
* `createFrontendStyled`.
|
|
409
171
|
*/
|
|
410
|
-
function
|
|
172
|
+
function styledFn<
|
|
411
173
|
ParentComponent extends StylableComponent,
|
|
412
174
|
StyledConfig extends StaticConfigPublic,
|
|
413
175
|
Variants extends VariantDefinitions<ParentComponent, StyledConfig>,
|
|
@@ -430,10 +192,15 @@ function styled<
|
|
|
430
192
|
Context,
|
|
431
193
|
ContextPropKeys
|
|
432
194
|
>
|
|
433
|
-
function
|
|
195
|
+
function styledFn(...args: any[]) {
|
|
434
196
|
return (styledImpl as any)(undefined, ...args)
|
|
435
197
|
}
|
|
436
198
|
|
|
199
|
+
const styled = Object.assign(styledFn, {
|
|
200
|
+
/** see styledDynamic: value/prop carriers usable as `variants` entries */
|
|
201
|
+
dynamic: styledDynamic,
|
|
202
|
+
})
|
|
203
|
+
|
|
437
204
|
/**
|
|
438
205
|
* Builds a `styled()` bound to one frontend descriptor. Components it creates carry
|
|
439
206
|
* that descriptor immutably, so behavior follows import provenance instead of any
|
|
@@ -509,20 +276,6 @@ function styledImpl<
|
|
|
509
276
|
| (Key extends keyof OurVariantProps ? OurVariantProps[Key] : undefined)
|
|
510
277
|
}
|
|
511
278
|
|
|
512
|
-
type Accepted = StyledConfig['accept']
|
|
513
|
-
type CustomTokenProps =
|
|
514
|
-
Accepted extends Record<string, any>
|
|
515
|
-
? {
|
|
516
|
-
[Key in keyof Accepted]?:
|
|
517
|
-
| (Key extends keyof ParentStylesBase ? ParentStylesBase[Key] : never)
|
|
518
|
-
| (Accepted[Key] extends 'style'
|
|
519
|
-
? Partial<InferStyleProps<ParentComponent, StyledConfig>>
|
|
520
|
-
: Accepted[Key] extends 'textStyle'
|
|
521
|
-
? Partial<InferStyleProps<typeof Text, StyledConfig>>
|
|
522
|
-
: ThemeValueByCategory<Accepted[Key]>)
|
|
523
|
-
}
|
|
524
|
-
: {}
|
|
525
|
-
|
|
526
279
|
/**
|
|
527
280
|
* de-opting a bit of type niceness because were hitting depth issues too soon
|
|
528
281
|
* before we had:
|
|
@@ -537,9 +290,7 @@ function styledImpl<
|
|
|
537
290
|
TamaDefer,
|
|
538
291
|
GetRef<ParentComponent>,
|
|
539
292
|
ParentNonStyledProps,
|
|
540
|
-
|
|
541
|
-
? ParentStylesBase & CustomTokenProps
|
|
542
|
-
: ParentStylesBase,
|
|
293
|
+
ParentStylesBase,
|
|
543
294
|
StyledVariantsWithContext<
|
|
544
295
|
MergedVariants,
|
|
545
296
|
GetStyledContextVariantProps<ParentComponent, Context, ContextPropKeys>
|
|
@@ -547,11 +298,12 @@ function styledImpl<
|
|
|
547
298
|
GetStaticConfig<ParentComponent, StyledConfig>
|
|
548
299
|
>
|
|
549
300
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
301
|
+
if (!ComponentIn) {
|
|
302
|
+
throw new Error(
|
|
303
|
+
process.env.NODE_ENV === 'development'
|
|
304
|
+
? 'No component given to styled()'
|
|
305
|
+
: '❌ Error 006'
|
|
306
|
+
)
|
|
555
307
|
}
|
|
556
308
|
|
|
557
309
|
const parentStaticConfig = ComponentIn['staticConfig'] as StaticConfig | undefined
|
|
@@ -599,13 +351,11 @@ function styledImpl<
|
|
|
599
351
|
defaultVariants,
|
|
600
352
|
context,
|
|
601
353
|
contextProps,
|
|
602
|
-
compoundVariants,
|
|
603
354
|
...defaultProps
|
|
604
355
|
} = (options || {}) as Record<string, any>
|
|
605
356
|
|
|
606
357
|
let parentDefaultVariants
|
|
607
358
|
let parentDefaultProps
|
|
608
|
-
let parentCompoundVariants
|
|
609
359
|
const mergedBaseClassName =
|
|
610
360
|
parentStaticConfig?.baseClassName && baseClassName
|
|
611
361
|
? `${parentStaticConfig.baseClassName} ${baseClassName}`
|
|
@@ -636,14 +386,9 @@ function styledImpl<
|
|
|
636
386
|
if (parentStaticConfig.variants) {
|
|
637
387
|
variants = mergeVariants(parentStaticConfig.variants, variants)
|
|
638
388
|
}
|
|
639
|
-
parentCompoundVariants = parentStaticConfig.compoundVariants
|
|
640
389
|
}
|
|
641
390
|
}
|
|
642
391
|
|
|
643
|
-
const mergedCompoundVariants =
|
|
644
|
-
parentCompoundVariants || compoundVariants
|
|
645
|
-
? [...(parentCompoundVariants || []), ...(compoundVariants || [])]
|
|
646
|
-
: undefined
|
|
647
392
|
const mergedContext = context || parentStaticConfig?.context
|
|
648
393
|
const mergedContextProps = context
|
|
649
394
|
? contextProps
|
|
@@ -659,7 +404,15 @@ function styledImpl<
|
|
|
659
404
|
}
|
|
660
405
|
}
|
|
661
406
|
|
|
407
|
+
const isInput = Boolean(config?.isInput || parentStaticConfig?.isInput)
|
|
662
408
|
const isText = Boolean(config?.isText || parentStaticConfig?.isText)
|
|
409
|
+
const validStyles =
|
|
410
|
+
config?.validStyles ||
|
|
411
|
+
(config?.isInput
|
|
412
|
+
? stylePropsInput
|
|
413
|
+
: config?.isText
|
|
414
|
+
? stylePropsText
|
|
415
|
+
: parentStaticConfig?.validStyles)
|
|
663
416
|
|
|
664
417
|
const acceptsClassName =
|
|
665
418
|
config?.acceptsClassName ??
|
|
@@ -674,7 +427,6 @@ function styledImpl<
|
|
|
674
427
|
Component,
|
|
675
428
|
}),
|
|
676
429
|
variants,
|
|
677
|
-
compoundVariants: mergedCompoundVariants,
|
|
678
430
|
baseClassName: mergedBaseClassName,
|
|
679
431
|
defaultProps,
|
|
680
432
|
defaultVariants,
|
|
@@ -682,15 +434,19 @@ function styledImpl<
|
|
|
682
434
|
isReactNative: resolvedIsReactNative,
|
|
683
435
|
}),
|
|
684
436
|
isText,
|
|
437
|
+
isInput,
|
|
438
|
+
validStyles,
|
|
685
439
|
acceptsClassName,
|
|
686
440
|
context: mergedContext,
|
|
687
441
|
contextProps: mergedContextProps,
|
|
688
442
|
...reactNativeConfig,
|
|
689
443
|
isStyledHOC: Boolean(parentStaticConfig?.isHOC),
|
|
690
444
|
parentStaticConfig,
|
|
445
|
+
displayName: displayName || (ComponentIn as any)[componentDisplayName],
|
|
691
446
|
// only an explicitly bound frontend overrides the one inherited from the parent
|
|
692
447
|
...(frontend && { styleFrontend: frontend }),
|
|
693
448
|
}
|
|
449
|
+
;(conf as any).variantStyleResolver = resolveVariantStyle
|
|
694
450
|
|
|
695
451
|
if (process.env.TAMAGUI_TARGET !== 'native') {
|
|
696
452
|
delete conf.isReactNative
|
|
@@ -704,10 +460,7 @@ function styledImpl<
|
|
|
704
460
|
return conf
|
|
705
461
|
})()
|
|
706
462
|
|
|
707
|
-
const component =
|
|
708
|
-
createComponent(staticConfigProps || {}),
|
|
709
|
-
displayName || (ComponentIn as any)[componentDisplayName]
|
|
710
|
-
)
|
|
463
|
+
const component = createComponent(staticConfigProps || {})
|
|
711
464
|
|
|
712
465
|
for (const key in ComponentIn) {
|
|
713
466
|
// dont inherit propTypes
|
|
@@ -720,43 +473,4 @@ function styledImpl<
|
|
|
720
473
|
return component as any as StyledComponent
|
|
721
474
|
}
|
|
722
475
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
type StyledHtmlFactory<Tag extends keyof HTMLElementTagNameMap> = <
|
|
726
|
-
Variants extends VariantDefinitions<any, any> | undefined = undefined,
|
|
727
|
-
>(
|
|
728
|
-
options?: Partial<HTMLElementStyle<Tag>> & {
|
|
729
|
-
displayName?: string
|
|
730
|
-
variants?: Variants
|
|
731
|
-
defaultVariants?: GetVariantAcceptedValues<NonNullable<Variants>>
|
|
732
|
-
context?: StyledContext
|
|
733
|
-
}
|
|
734
|
-
) => TamaguiComponent<
|
|
735
|
-
TamaDefer,
|
|
736
|
-
HTMLElementTagNameMap[Tag],
|
|
737
|
-
TamaguiComponentPropsBase & HTMLElementSpecificProps<Tag>,
|
|
738
|
-
HTMLElementStyleBase<Tag>,
|
|
739
|
-
Variants extends undefined
|
|
740
|
-
? {}
|
|
741
|
-
: AreVariantsUndefined<NonNullable<Variants>> extends true
|
|
742
|
-
? {}
|
|
743
|
-
: GetVariantAcceptedValues<NonNullable<Variants>>,
|
|
744
|
-
{}
|
|
745
|
-
>
|
|
746
|
-
|
|
747
|
-
type StyledHtmlFactories = {
|
|
748
|
-
[K in keyof HTMLElementTagNameMap]: StyledHtmlFactory<K>
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
// use a proxy to make styled.a(), styled.div() etc work
|
|
752
|
-
const styledExport = new Proxy(styled as typeof styled & StyledHtmlFactories, {
|
|
753
|
-
get(target, prop: string) {
|
|
754
|
-
if (prop in target) {
|
|
755
|
-
return (target as any)[prop]
|
|
756
|
-
}
|
|
757
|
-
// return factory for HTML elements
|
|
758
|
-
return (options: any) => styledHtml(prop as keyof HTMLElementTagNameMap, options)
|
|
759
|
-
},
|
|
760
|
-
})
|
|
761
|
-
|
|
762
|
-
export { styledExport as styled }
|
|
476
|
+
export { styled }
|