@tamagui/web 3.0.0-beta.831.1 → 3.0.0-beta.889.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createComponent.cjs +12 -1
- package/dist/cjs/createComponent.native.cjs +12 -1
- package/dist/cjs/createComponent.native.js +12 -1
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createStyledHOC.cjs +1 -1
- package/dist/cjs/createStyledHOC.native.cjs +1 -1
- package/dist/cjs/createStyledHOC.native.js +1 -1
- package/dist/cjs/createStyledHOC.native.js.map +1 -1
- package/dist/cjs/createVariable.cjs +0 -10
- package/dist/cjs/createVariable.native.cjs +0 -10
- package/dist/cjs/createVariable.native.js +0 -10
- package/dist/cjs/createVariable.native.js.map +1 -1
- package/dist/cjs/helpers/borderComponents.cjs +62 -0
- package/dist/cjs/helpers/borderComponents.native.cjs +82 -0
- package/dist/cjs/helpers/borderComponents.native.js +84 -0
- package/dist/cjs/helpers/borderComponents.native.js.map +1 -0
- package/dist/cjs/helpers/createDesignSystem.cjs +0 -2
- package/dist/cjs/helpers/createStyledContext.cjs +10 -18
- package/dist/cjs/helpers/createStyledContext.native.cjs +14 -18
- package/dist/cjs/helpers/createStyledContext.native.js +14 -18
- package/dist/cjs/helpers/createStyledContext.native.js.map +1 -1
- package/dist/cjs/helpers/formatDiagnostic.cjs +6 -6
- package/dist/cjs/helpers/formatDiagnostic.native.cjs +6 -6
- package/dist/cjs/helpers/formatDiagnostic.native.js +6 -6
- package/dist/cjs/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/cjs/helpers/getCSSStylesAtomic.cjs +128 -109
- package/dist/cjs/helpers/getCSSStylesAtomic.native.cjs +11 -3
- package/dist/cjs/helpers/getCSSStylesAtomic.native.js +11 -3
- package/dist/cjs/helpers/getCSSStylesAtomic.native.js.map +1 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.cjs +13 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.cjs +15 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js +15 -1
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
- package/dist/cjs/helpers/getDynamicVal.cjs +5 -1
- package/dist/cjs/helpers/getDynamicVal.native.cjs +5 -1
- package/dist/cjs/helpers/getDynamicVal.native.js +5 -1
- package/dist/cjs/helpers/getDynamicVal.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +1042 -1715
- package/dist/cjs/helpers/getSplitStyles.native.cjs +1081 -1887
- package/dist/cjs/helpers/getSplitStyles.native.js +1081 -1887
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/grammarConfig.cjs +163 -1
- package/dist/cjs/helpers/grammarConfig.native.cjs +186 -1
- package/dist/cjs/helpers/grammarConfig.native.js +186 -1
- package/dist/cjs/helpers/grammarConfig.native.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.cjs +5 -1
- package/dist/cjs/helpers/insertStyleRule.native.cjs +7 -1
- package/dist/cjs/helpers/insertStyleRule.native.js +7 -1
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/log.cjs +9 -8
- package/dist/cjs/helpers/log.native.cjs +9 -8
- package/dist/cjs/helpers/log.native.js +9 -8
- package/dist/cjs/helpers/log.native.js.map +1 -1
- package/dist/cjs/helpers/mergeVariants.cjs +44 -13
- package/dist/cjs/helpers/mergeVariants.native.cjs +79 -14
- package/dist/cjs/helpers/mergeVariants.native.js +79 -14
- package/dist/cjs/helpers/mergeVariants.native.js.map +1 -1
- package/dist/cjs/helpers/nativeOnlyProps.cjs +0 -1
- package/dist/cjs/helpers/nativeOnlyProps.native.cjs +0 -1
- package/dist/cjs/helpers/nativeOnlyProps.native.js +0 -1
- package/dist/cjs/helpers/nativeOnlyProps.native.js.map +1 -1
- package/dist/cjs/helpers/nativeStyleEngine.cjs +34 -14
- package/dist/cjs/helpers/nativeStyleEngine.native.cjs +36 -14
- package/dist/cjs/helpers/nativeStyleEngine.native.js +36 -14
- package/dist/cjs/helpers/nativeStyleEngine.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeValueWithProperty.cjs +7 -8
- package/dist/cjs/helpers/normalizeValueWithProperty.native.cjs +9 -8
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js +9 -8
- package/dist/cjs/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/cjs/helpers/parseBorderShorthand.native.cjs +25 -56
- package/dist/cjs/helpers/parseBorderShorthand.native.js +25 -56
- package/dist/cjs/helpers/parseBorderShorthand.native.js.map +1 -1
- package/dist/cjs/helpers/parseOutlineShorthand.native.cjs +9 -49
- package/dist/cjs/helpers/parseOutlineShorthand.native.js +9 -49
- package/dist/cjs/helpers/parseOutlineShorthand.native.js.map +1 -1
- package/dist/cjs/helpers/resolveSafeArea.cjs +35 -100
- package/dist/cjs/helpers/resolveVariantStyle.cjs +57 -0
- package/dist/cjs/helpers/resolveVariantStyle.native.cjs +67 -0
- package/dist/cjs/helpers/resolveVariantStyle.native.js +69 -0
- package/dist/cjs/helpers/resolveVariantStyle.native.js.map +1 -0
- package/dist/cjs/helpers/styleStaticConfig.cjs +1 -50
- package/dist/cjs/helpers/styleStaticConfig.native.cjs +1 -51
- package/dist/cjs/helpers/styleStaticConfig.native.js +1 -51
- package/dist/cjs/helpers/styleStaticConfig.native.js.map +1 -1
- package/dist/cjs/helpers/styleStaticConfigCore.cjs +107 -0
- package/dist/cjs/helpers/styleStaticConfigCore.native.cjs +127 -0
- package/dist/cjs/helpers/styleStaticConfigCore.native.js +129 -0
- package/dist/cjs/helpers/styleStaticConfigCore.native.js.map +1 -0
- package/dist/cjs/helpers/styledDynamic.cjs +160 -0
- package/dist/cjs/helpers/styledDynamic.native.cjs +195 -0
- package/dist/cjs/helpers/styledDynamic.native.js +197 -0
- package/dist/cjs/helpers/styledDynamic.native.js.map +1 -0
- package/dist/cjs/helpers/tokenCategories.cjs +15 -38
- package/dist/cjs/helpers/tokenCategories.native.cjs +15 -40
- package/dist/cjs/helpers/tokenCategories.native.js +15 -40
- package/dist/cjs/helpers/tokenCategories.native.js.map +1 -1
- package/dist/cjs/helpers/variableValue.cjs +17 -12
- package/dist/cjs/helpers/variableValue.native.cjs +46 -23
- package/dist/cjs/helpers/variableValue.native.js +46 -23
- package/dist/cjs/helpers/variableValue.native.js.map +1 -1
- package/dist/cjs/helpers/warnOnce.cjs +5 -4
- package/dist/cjs/helpers/warnOnce.native.cjs +6 -4
- package/dist/cjs/helpers/warnOnce.native.js +6 -4
- package/dist/cjs/helpers/warnOnce.native.js.map +1 -1
- package/dist/cjs/hooks/useAnimationDriver.cjs +2 -2
- package/dist/cjs/hooks/useAnimationDriver.native.cjs +2 -2
- package/dist/cjs/hooks/useAnimationDriver.native.js +2 -2
- package/dist/cjs/hooks/useAnimationDriver.native.js.map +1 -1
- package/dist/cjs/hooks/useComponentState.cjs +41 -82
- package/dist/cjs/hooks/useComponentState.native.cjs +45 -84
- package/dist/cjs/hooks/useComponentState.native.js +45 -84
- package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
- package/dist/cjs/hooks/useMedia.cjs +2 -2
- package/dist/cjs/hooks/useMedia.native.cjs +2 -2
- package/dist/cjs/hooks/useMedia.native.js +2 -2
- package/dist/cjs/hooks/useMedia.native.js.map +1 -1
- package/dist/cjs/{helpers/directStyleCSS.native.js → hooks/useStyle.cjs} +16 -8
- package/dist/cjs/{helpers/directStyleCSS.native.cjs → hooks/useStyle.native.cjs} +16 -4
- package/dist/cjs/hooks/useStyle.native.js +34 -0
- package/dist/cjs/hooks/useStyle.native.js.map +1 -0
- package/dist/cjs/hooks/useThemeState.cjs +25 -90
- package/dist/cjs/hooks/useThemeState.native.cjs +34 -94
- package/dist/cjs/hooks/useThemeState.native.js +34 -94
- package/dist/cjs/hooks/useThemeState.native.js.map +1 -1
- package/dist/cjs/index.cjs +6 -3
- package/dist/cjs/index.native.cjs +6 -3
- package/dist/cjs/index.native.js +6 -3
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/static-resolve.cjs +2 -2
- package/dist/cjs/static-resolve.native.cjs +2 -2
- package/dist/cjs/static-resolve.native.js +2 -2
- package/dist/cjs/static-resolve.native.js.map +1 -1
- package/dist/cjs/style.cjs +91 -0
- package/dist/cjs/style.native.cjs +98 -0
- package/dist/cjs/style.native.js +100 -0
- package/dist/cjs/style.native.js.map +1 -0
- package/dist/cjs/styled.cjs +11 -6
- package/dist/cjs/styled.native.cjs +11 -6
- package/dist/cjs/styled.native.js +11 -6
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/types.cjs +6 -4
- package/dist/cjs/types.native.cjs +6 -4
- package/dist/cjs/types.native.js +6 -4
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.cjs +1 -2
- package/dist/cjs/views/TamaguiProvider.native.cjs +1 -2
- package/dist/cjs/views/TamaguiProvider.native.js +1 -2
- package/dist/cjs/views/TamaguiProvider.native.js.map +1 -1
- package/dist/cjs/views/Text.cjs +17 -12
- package/dist/cjs/views/Text.native.cjs +1 -0
- package/dist/cjs/views/Text.native.js +1 -0
- package/dist/cjs/views/Text.native.js.map +1 -1
- package/dist/cjs/views/Theme.cjs +3 -3
- package/dist/cjs/views/Theme.native.cjs +3 -3
- package/dist/cjs/views/Theme.native.js +3 -3
- package/dist/cjs/views/Theme.native.js.map +1 -1
- package/dist/cjs/views/ThemeDebug.cjs +1 -4
- package/dist/esm/createComponent.mjs +12 -1
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +12 -1
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createStyledHOC.mjs +1 -1
- package/dist/esm/createStyledHOC.mjs.map +1 -1
- package/dist/esm/createStyledHOC.native.js +1 -1
- package/dist/esm/createStyledHOC.native.js.map +1 -1
- package/dist/esm/createVariable.mjs +1 -9
- package/dist/esm/createVariable.mjs.map +1 -1
- package/dist/esm/createVariable.native.js +1 -9
- package/dist/esm/createVariable.native.js.map +1 -1
- package/dist/esm/helpers/borderComponents.mjs +37 -0
- package/dist/esm/helpers/borderComponents.mjs.map +1 -0
- package/dist/esm/helpers/borderComponents.native.js +55 -0
- package/dist/esm/helpers/borderComponents.native.js.map +1 -0
- package/dist/esm/helpers/createDesignSystem.mjs +0 -2
- package/dist/esm/helpers/createDesignSystem.mjs.map +1 -1
- package/dist/esm/helpers/createStyledContext.mjs +10 -18
- package/dist/esm/helpers/createStyledContext.mjs.map +1 -1
- package/dist/esm/helpers/createStyledContext.native.js +14 -18
- package/dist/esm/helpers/createStyledContext.native.js.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.mjs +6 -6
- package/dist/esm/helpers/formatDiagnostic.mjs.map +1 -1
- package/dist/esm/helpers/formatDiagnostic.native.js +6 -6
- package/dist/esm/helpers/formatDiagnostic.native.js.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomic.mjs +126 -109
- package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomic.native.js +7 -4
- package/dist/esm/helpers/getCSSStylesAtomic.native.js.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs +8 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js +10 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -1
- package/dist/esm/helpers/getDynamicVal.mjs +5 -1
- package/dist/esm/helpers/getDynamicVal.mjs.map +1 -1
- package/dist/esm/helpers/getDynamicVal.native.js +5 -1
- package/dist/esm/helpers/getDynamicVal.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +1034 -1705
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +1071 -1871
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/grammarConfig.mjs +164 -2
- package/dist/esm/helpers/grammarConfig.mjs.map +1 -1
- package/dist/esm/helpers/grammarConfig.native.js +187 -2
- package/dist/esm/helpers/grammarConfig.native.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +5 -2
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +7 -2
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/log.mjs +9 -8
- package/dist/esm/helpers/log.mjs.map +1 -1
- package/dist/esm/helpers/log.native.js +9 -8
- package/dist/esm/helpers/log.native.js.map +1 -1
- package/dist/esm/helpers/mergeVariants.mjs +44 -13
- package/dist/esm/helpers/mergeVariants.mjs.map +1 -1
- package/dist/esm/helpers/mergeVariants.native.js +79 -14
- package/dist/esm/helpers/mergeVariants.native.js.map +1 -1
- package/dist/esm/helpers/nativeOnlyProps.mjs +0 -1
- package/dist/esm/helpers/nativeOnlyProps.mjs.map +1 -1
- package/dist/esm/helpers/nativeOnlyProps.native.js +0 -1
- package/dist/esm/helpers/nativeOnlyProps.native.js.map +1 -1
- package/dist/esm/helpers/nativeStyleEngine.mjs +34 -15
- package/dist/esm/helpers/nativeStyleEngine.mjs.map +1 -1
- package/dist/esm/helpers/nativeStyleEngine.native.js +36 -15
- package/dist/esm/helpers/nativeStyleEngine.native.js.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.mjs +7 -8
- package/dist/esm/helpers/normalizeValueWithProperty.mjs.map +1 -1
- package/dist/esm/helpers/normalizeValueWithProperty.native.js +9 -8
- package/dist/esm/helpers/normalizeValueWithProperty.native.js.map +1 -1
- package/dist/esm/helpers/parseBorderShorthand.native.js +23 -56
- package/dist/esm/helpers/parseBorderShorthand.native.js.map +1 -1
- package/dist/esm/helpers/parseOutlineShorthand.native.js +10 -49
- package/dist/esm/helpers/parseOutlineShorthand.native.js.map +1 -1
- package/dist/esm/helpers/resolveSafeArea.mjs +35 -97
- package/dist/esm/helpers/resolveSafeArea.mjs.map +1 -1
- package/dist/esm/helpers/resolveVariantStyle.mjs +38 -0
- package/dist/esm/helpers/resolveVariantStyle.mjs.map +1 -0
- package/dist/esm/helpers/resolveVariantStyle.native.js +46 -0
- package/dist/esm/helpers/resolveVariantStyle.native.js.map +1 -0
- package/dist/esm/helpers/styleStaticConfig.mjs +1 -50
- package/dist/esm/helpers/styleStaticConfig.mjs.map +1 -1
- package/dist/esm/helpers/styleStaticConfig.native.js +1 -51
- package/dist/esm/helpers/styleStaticConfig.native.js.map +1 -1
- package/dist/esm/helpers/styleStaticConfigCore.mjs +88 -0
- package/dist/esm/helpers/styleStaticConfigCore.mjs.map +1 -0
- package/dist/esm/helpers/styleStaticConfigCore.native.js +106 -0
- package/dist/esm/helpers/styleStaticConfigCore.native.js.map +1 -0
- package/dist/esm/helpers/styledDynamic.mjs +136 -0
- package/dist/esm/helpers/styledDynamic.mjs.map +1 -0
- package/dist/esm/helpers/styledDynamic.native.js +169 -0
- package/dist/esm/helpers/styledDynamic.native.js.map +1 -0
- package/dist/esm/helpers/tokenCategories.mjs +15 -36
- package/dist/esm/helpers/tokenCategories.mjs.map +1 -1
- package/dist/esm/helpers/tokenCategories.native.js +15 -38
- package/dist/esm/helpers/tokenCategories.native.js.map +1 -1
- package/dist/esm/helpers/variableValue.mjs +17 -12
- package/dist/esm/helpers/variableValue.mjs.map +1 -1
- package/dist/esm/helpers/variableValue.native.js +46 -23
- package/dist/esm/helpers/variableValue.native.js.map +1 -1
- package/dist/esm/helpers/warnOnce.mjs +5 -4
- package/dist/esm/helpers/warnOnce.mjs.map +1 -1
- package/dist/esm/helpers/warnOnce.native.js +6 -4
- package/dist/esm/helpers/warnOnce.native.js.map +1 -1
- package/dist/esm/hooks/useAnimationDriver.mjs +2 -2
- package/dist/esm/hooks/useAnimationDriver.mjs.map +1 -1
- package/dist/esm/hooks/useAnimationDriver.native.js +2 -2
- package/dist/esm/hooks/useAnimationDriver.native.js.map +1 -1
- package/dist/esm/hooks/useComponentState.mjs +41 -82
- package/dist/esm/hooks/useComponentState.mjs.map +1 -1
- package/dist/esm/hooks/useComponentState.native.js +45 -84
- package/dist/esm/hooks/useComponentState.native.js.map +1 -1
- package/dist/esm/hooks/useMedia.mjs +2 -2
- package/dist/esm/hooks/useMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +2 -2
- package/dist/esm/hooks/useMedia.native.js.map +1 -1
- package/dist/esm/hooks/useStyle.mjs +11 -0
- package/dist/esm/hooks/useStyle.mjs.map +1 -0
- package/dist/esm/hooks/useStyle.native.js +11 -0
- package/dist/esm/hooks/useStyle.native.js.map +1 -0
- package/dist/esm/hooks/useThemeState.mjs +25 -90
- package/dist/esm/hooks/useThemeState.mjs.map +1 -1
- package/dist/esm/hooks/useThemeState.native.js +34 -94
- package/dist/esm/hooks/useThemeState.native.js.map +1 -1
- package/dist/esm/index.js +6 -4
- package/dist/esm/index.mjs +6 -4
- package/dist/esm/index.native.js +6 -4
- package/dist/esm/static-resolve.mjs +3 -3
- package/dist/esm/static-resolve.mjs.map +1 -1
- package/dist/esm/static-resolve.native.js +3 -3
- package/dist/esm/static-resolve.native.js.map +1 -1
- package/dist/esm/style.mjs +58 -0
- package/dist/esm/style.mjs.map +1 -0
- package/dist/esm/style.native.js +63 -0
- package/dist/esm/style.native.js.map +1 -0
- package/dist/esm/styled.mjs +12 -6
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +12 -6
- package/dist/esm/styled.native.js.map +1 -1
- package/dist/esm/types.mjs +3 -4
- package/dist/esm/types.mjs.map +1 -1
- package/dist/esm/types.native.js +3 -4
- package/dist/esm/types.native.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.mjs +1 -2
- package/dist/esm/views/TamaguiProvider.mjs.map +1 -1
- package/dist/esm/views/TamaguiProvider.native.js +1 -2
- package/dist/esm/views/TamaguiProvider.native.js.map +1 -1
- package/dist/esm/views/Text.mjs +17 -12
- package/dist/esm/views/Text.mjs.map +1 -1
- package/dist/esm/views/Theme.mjs +3 -3
- package/dist/esm/views/Theme.mjs.map +1 -1
- package/dist/esm/views/Theme.native.js +3 -3
- package/dist/esm/views/Theme.native.js.map +1 -1
- package/dist/esm/views/ThemeDebug.mjs +1 -4
- package/dist/esm/views/ThemeDebug.mjs.map +1 -1
- package/package.json +15 -15
- package/src/createComponent.tsx +21 -1
- package/src/createStyledHOC.tsx +4 -2
- package/src/createVariable.ts +0 -10
- package/src/helpers/borderComponents.ts +62 -0
- package/src/helpers/createDesignSystem.ts +0 -2
- package/src/helpers/createStyledContext.tsx +15 -53
- package/src/helpers/formatDiagnostic.ts +9 -9
- package/src/helpers/getCSSStylesAtomic.native.ts +6 -3
- package/src/helpers/getCSSStylesAtomic.ts +192 -207
- package/src/helpers/getCSSStylesAtomicCompiled.ts +13 -1
- package/src/helpers/getDynamicVal.ts +4 -0
- package/src/helpers/getSplitStyles.tsx +2080 -3270
- package/src/helpers/grammarConfig.ts +218 -1
- package/src/helpers/insertStyleRule.tsx +4 -2
- package/src/helpers/log.ts +12 -11
- package/src/helpers/mergeVariants.ts +55 -18
- package/src/helpers/nativeOnlyProps.ts +0 -1
- package/src/helpers/nativeStyleEngine.ts +55 -14
- package/src/helpers/normalizeValueWithProperty.ts +10 -12
- package/src/helpers/parseBorderShorthand.native.ts +23 -45
- package/src/helpers/parseOutlineShorthand.native.ts +9 -40
- package/src/helpers/resolveSafeArea.ts +34 -101
- package/src/helpers/resolveVariantStyle.ts +77 -0
- package/src/helpers/styleFrontend.ts +8 -5
- package/src/helpers/styleStaticConfig.ts +5 -72
- package/src/helpers/styleStaticConfigCore.ts +110 -0
- package/src/helpers/styledDynamic.ts +191 -0
- package/src/helpers/tokenCategories.ts +40 -65
- package/src/helpers/variableValue.ts +20 -15
- package/src/helpers/warnOnce.ts +5 -4
- package/src/hooks/useAnimationDriver.ts +6 -2
- package/src/hooks/useComponentState.ts +55 -183
- package/src/hooks/useMedia.tsx +10 -8
- package/src/hooks/useStyle.ts +10 -0
- package/src/hooks/useThemeState.ts +51 -264
- package/src/index.ts +6 -6
- package/src/internalRuntimeTypes.ts +1 -0
- package/src/static-resolve.ts +7 -4
- package/src/style.ts +97 -0
- package/src/styled.tsx +39 -68
- package/src/types.tsx +105 -169
- package/src/views/TamaguiProvider.tsx +0 -2
- package/src/views/Text.tsx +20 -14
- package/src/views/Theme.tsx +13 -9
- package/src/views/ThemeDebug.tsx +0 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/createStyledHOC.d.ts +1 -1
- package/types/createStyledHOC.d.ts.map +1 -1
- package/types/createVariable.d.ts +0 -2
- package/types/createVariable.d.ts.map +1 -1
- package/types/helpers/borderComponents.d.ts +10 -0
- package/types/helpers/borderComponents.d.ts.map +1 -0
- package/types/helpers/createDesignSystem.d.ts.map +1 -1
- package/types/helpers/createStyledContext.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomic.d.ts +20 -19
- package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomic.native.d.ts +5 -0
- package/types/helpers/getCSSStylesAtomic.native.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts +6 -1
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts.map +1 -1
- package/types/helpers/getDynamicVal.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts +3 -5
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/grammarConfig.d.ts +25 -2
- package/types/helpers/grammarConfig.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts +1 -0
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/log.d.ts.map +1 -1
- package/types/helpers/mergeVariants.d.ts.map +1 -1
- package/types/helpers/nativeOnlyProps.d.ts +0 -1
- package/types/helpers/nativeOnlyProps.d.ts.map +1 -1
- package/types/helpers/nativeStyleEngine.d.ts +6 -0
- package/types/helpers/nativeStyleEngine.d.ts.map +1 -1
- package/types/helpers/normalizeValueWithProperty.d.ts.map +1 -1
- package/types/helpers/parseBorderShorthand.native.d.ts +1 -0
- package/types/helpers/parseBorderShorthand.native.d.ts.map +1 -1
- package/types/helpers/parseOutlineShorthand.native.d.ts.map +1 -1
- package/types/helpers/resolveSafeArea.d.ts +0 -1
- package/types/helpers/resolveSafeArea.d.ts.map +1 -1
- package/types/helpers/resolveVariantStyle.d.ts +3 -0
- package/types/helpers/resolveVariantStyle.d.ts.map +1 -0
- package/types/helpers/styleFrontend.d.ts +3 -5
- package/types/helpers/styleFrontend.d.ts.map +1 -1
- package/types/helpers/styleStaticConfig.d.ts +4 -9
- package/types/helpers/styleStaticConfig.d.ts.map +1 -1
- package/types/helpers/styleStaticConfigCore.d.ts +4 -0
- package/types/helpers/styleStaticConfigCore.d.ts.map +1 -0
- package/types/helpers/styledDynamic.d.ts +18 -0
- package/types/helpers/styledDynamic.d.ts.map +1 -0
- package/types/helpers/tokenCategories.d.ts +0 -1
- package/types/helpers/tokenCategories.d.ts.map +1 -1
- package/types/helpers/variableValue.d.ts.map +1 -1
- package/types/helpers/warnOnce.d.ts.map +1 -1
- package/types/helpers/webPropsToSkip.native.d.ts +68 -68
- package/types/hooks/useAnimationDriver.d.ts.map +1 -1
- package/types/hooks/useComponentState.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useStyle.d.ts +4 -0
- package/types/hooks/useStyle.d.ts.map +1 -0
- package/types/hooks/useThemeState.d.ts +1 -11
- package/types/hooks/useThemeState.d.ts.map +1 -1
- package/types/index.d.ts +6 -4
- package/types/index.d.ts.map +1 -1
- package/types/internalRuntimeTypes.d.ts +1 -1
- package/types/internalRuntimeTypes.d.ts.map +1 -1
- package/types/static-resolve.d.ts.map +1 -1
- package/types/style.d.ts +18 -0
- package/types/style.d.ts.map +1 -0
- package/types/styled.d.ts +10 -10
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +74 -49
- package/types/types.d.ts.map +1 -1
- package/types/views/TamaguiProvider.d.ts +1 -1
- package/types/views/TamaguiProvider.d.ts.map +1 -1
- package/types/views/Text.d.ts.map +1 -1
- package/types/views/Theme.d.ts.map +1 -1
- package/types/views/ThemeDebug.d.ts.map +1 -1
- package/dist/cjs/helpers/directStyleCSS.cjs +0 -345
- package/dist/cjs/helpers/directStyleCSS.native.js.map +0 -1
- package/dist/cjs/helpers/directStyleCSSCompiled.cjs +0 -40
- package/dist/cjs/helpers/directStyleCSSCompiled.native.cjs +0 -46
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js +0 -48
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js.map +0 -1
- package/dist/cjs/helpers/getVariantExtras.cjs +0 -91
- package/dist/cjs/helpers/getVariantExtras.native.cjs +0 -94
- package/dist/cjs/helpers/getVariantExtras.native.js +0 -96
- package/dist/cjs/helpers/getVariantExtras.native.js.map +0 -1
- package/dist/cjs/helpers/variantResolvers.cjs +0 -87
- package/dist/cjs/helpers/variantResolvers.native.cjs +0 -140
- package/dist/cjs/helpers/variantResolvers.native.js +0 -142
- package/dist/cjs/helpers/variantResolvers.native.js.map +0 -1
- package/dist/esm/helpers/directStyleCSS.mjs +0 -317
- package/dist/esm/helpers/directStyleCSS.mjs.map +0 -1
- package/dist/esm/helpers/directStyleCSS.native.js +0 -1
- package/dist/esm/helpers/directStyleCSSCompiled.mjs +0 -11
- package/dist/esm/helpers/directStyleCSSCompiled.mjs.map +0 -1
- package/dist/esm/helpers/directStyleCSSCompiled.native.js +0 -15
- package/dist/esm/helpers/directStyleCSSCompiled.native.js.map +0 -1
- package/dist/esm/helpers/getVariantExtras.mjs +0 -69
- package/dist/esm/helpers/getVariantExtras.mjs.map +0 -1
- package/dist/esm/helpers/getVariantExtras.native.js +0 -70
- package/dist/esm/helpers/getVariantExtras.native.js.map +0 -1
- package/dist/esm/helpers/variantResolvers.mjs +0 -65
- package/dist/esm/helpers/variantResolvers.mjs.map +0 -1
- package/dist/esm/helpers/variantResolvers.native.js +0 -116
- package/dist/esm/helpers/variantResolvers.native.js.map +0 -1
- package/src/helpers/directStyleCSS.native.ts +0 -1
- package/src/helpers/directStyleCSS.ts +0 -513
- package/src/helpers/directStyleCSSCompiled.ts +0 -32
- package/src/helpers/getVariantExtras.tsx +0 -95
- package/src/helpers/variantResolvers.ts +0 -121
- package/types/helpers/directStyleCSS.d.ts +0 -28
- package/types/helpers/directStyleCSS.d.ts.map +0 -1
- package/types/helpers/directStyleCSS.native.d.ts +0 -2
- package/types/helpers/directStyleCSS.native.d.ts.map +0 -1
- package/types/helpers/directStyleCSSCompiled.d.ts +0 -10
- package/types/helpers/directStyleCSSCompiled.d.ts.map +0 -1
- package/types/helpers/getVariantExtras.d.ts +0 -4
- package/types/helpers/getVariantExtras.d.ts.map +0 -1
- package/types/helpers/variantResolvers.d.ts +0 -9
- package/types/helpers/variantResolvers.d.ts.map +0 -1
|
@@ -3,15 +3,9 @@ import { mergeIfNotShallowEqual } from '@tamagui/is-equal-shallow'
|
|
|
3
3
|
import { useDidFinishSSR, useIsClientOnly } from '@tamagui/use-did-finish-ssr'
|
|
4
4
|
import { useRef, useState } from 'react'
|
|
5
5
|
import { getSetting } from '../config'
|
|
6
|
-
import { formatDiagnostic } from '../helpers/formatDiagnostic'
|
|
7
6
|
import { isOptimizedForFirstRender } from './isOptimizedForFirstRender'
|
|
8
|
-
import {
|
|
9
|
-
defaultComponentState,
|
|
10
|
-
defaultComponentStateMounted,
|
|
11
|
-
defaultComponentStateShouldEnter,
|
|
12
|
-
} from '../defaultComponentState'
|
|
7
|
+
import { defaultComponentStateMounted } from '../defaultComponentState'
|
|
13
8
|
import { isObj } from '../helpers/isObj'
|
|
14
|
-
import { log } from '../helpers/log'
|
|
15
9
|
import type {
|
|
16
10
|
ComponentContextI,
|
|
17
11
|
StaticConfig,
|
|
@@ -41,18 +35,14 @@ export const useComponentState = (
|
|
|
41
35
|
const { isHOC } = staticConfig
|
|
42
36
|
|
|
43
37
|
const stateRef = useRef<TamaguiComponentStateRef>(
|
|
44
|
-
// performance: avoid creating object every render
|
|
45
38
|
undefined as unknown as TamaguiComponentStateRef
|
|
46
39
|
)
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
}
|
|
41
|
+
const curStateRef = (stateRef.current ||= {
|
|
42
|
+
startedUnhydrated: needsHydration && !isHydrated,
|
|
43
|
+
optimizeForFirstRender: isOptimizedForFirstRender(),
|
|
44
|
+
})
|
|
54
45
|
|
|
55
|
-
// after we get states mount we need to turn off isAnimated for server side
|
|
56
46
|
const hasAnimationProp = Boolean(
|
|
57
47
|
(!isHOC && 'transition' in props) ||
|
|
58
48
|
(props.style && hasAnimatedStyleValue(props.style))
|
|
@@ -60,18 +50,11 @@ export const useComponentState = (
|
|
|
60
50
|
|
|
61
51
|
const inputStyle = animationDriver?.inputStyle ?? 'css'
|
|
62
52
|
const outputStyle = animationDriver?.outputStyle ?? 'css'
|
|
63
|
-
const curStateRef = stateRef.current
|
|
64
53
|
|
|
65
54
|
if (!needsHydration && hasAnimationProp) {
|
|
66
55
|
curStateRef.hasAnimated = true
|
|
67
56
|
}
|
|
68
57
|
|
|
69
|
-
// A renderer platform driver with native pseudo states (react-native-gpui)
|
|
70
|
-
// makes any component with interaction clauses ride the animation-driver
|
|
71
|
-
// emitter path — no per-site transition/animation prop required. the flip is
|
|
72
|
-
// driver-sourced (hover) or event-sourced (press/focus) but either way applies
|
|
73
|
-
// through the emitter with zero React commits; with no transition declared it
|
|
74
|
-
// resolves instant (see createComponent's effectiveTransition default).
|
|
75
58
|
const platformPseudoPossible = Boolean(
|
|
76
59
|
!isHOC &&
|
|
77
60
|
useAnimations &&
|
|
@@ -79,45 +62,29 @@ export const useComponentState = (
|
|
|
79
62
|
getPlatformDriver()?.pseudo
|
|
80
63
|
)
|
|
81
64
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
useAnimations
|
|
87
|
-
)
|
|
88
|
-
return Boolean(next || curStateRef.hasAnimated)
|
|
89
|
-
})()
|
|
65
|
+
const willBeAnimatedClient = Boolean(
|
|
66
|
+
((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations) ||
|
|
67
|
+
curStateRef.hasAnimated
|
|
68
|
+
)
|
|
90
69
|
|
|
91
|
-
|
|
70
|
+
const willBeAnimated = !isServer && willBeAnimatedClient
|
|
92
71
|
|
|
93
|
-
// once animated, always animated to preserve hooks / vdom structure
|
|
94
72
|
if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {
|
|
95
73
|
curStateRef.hasAnimated = true
|
|
96
74
|
}
|
|
97
75
|
|
|
98
76
|
const { disableClassName } = props
|
|
99
77
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// instantly, so an animated frame that only registers after a later
|
|
104
|
-
// finalize pass never animates out. Everything the decision needs for the
|
|
105
|
-
// transition-prop case is pre-pass knowledge; finalizeStyleFlags can only
|
|
106
|
-
// widen it (pass-discovered platform pseudo), and a passThrough render
|
|
107
|
-
// keeps the widened value.
|
|
108
|
-
if (willBeAnimated && !isHOC && props['animatePresence'] !== false) {
|
|
78
|
+
const animatePresenceOptIn =
|
|
79
|
+
willBeAnimated && !isHOC && props['animatePresence'] !== false
|
|
80
|
+
if (animatePresenceOptIn) {
|
|
109
81
|
curStateRef.shouldRegisterPresence = true
|
|
110
82
|
} else {
|
|
111
83
|
curStateRef.shouldRegisterPresence ??= false
|
|
112
84
|
}
|
|
85
|
+
|
|
113
86
|
const presenceResult = animationDriver?.usePresence?.(curStateRef) || null
|
|
114
|
-
|
|
115
|
-
// conditional-call semantics: a frame that opted out (animatePresence false,
|
|
116
|
-
// HOC, not animated) must not see presence state — downstream that state
|
|
117
|
-
// wraps children in ResetPresence, which would null the context for the
|
|
118
|
-
// frame that actually animates the exit
|
|
119
|
-
const presence =
|
|
120
|
-
!isHOC && willBeAnimated && props['animatePresence'] !== false ? presenceResult : null
|
|
87
|
+
const presence = animatePresenceOptIn ? presenceResult : null
|
|
121
88
|
|
|
122
89
|
const presenceState = presence?.[2]
|
|
123
90
|
const isExiting = presenceState?.isPresent === false
|
|
@@ -126,37 +93,20 @@ export const useComponentState = (
|
|
|
126
93
|
const hasAnimationThatNeedsHydrate =
|
|
127
94
|
hasAnimationProp && !isHydrated && inputStyle !== 'css'
|
|
128
95
|
|
|
129
|
-
// two stage enter: because we switch from css driver to spring driver
|
|
130
|
-
// - first render: render to match server with css driver
|
|
131
|
-
// - second render: state.unmounted = should-enter, still rendering the initial,
|
|
132
|
-
// non-entered state but now with the spring animation driver
|
|
133
|
-
|
|
134
|
-
// the sole style pass decides whether an enter clause exists. A fresh first
|
|
135
|
-
// frame stays provisionally unmounted until that pass reports its flags —
|
|
136
|
-
// except an HOC, which never enters (shouldEnter is !isHOC && ...), so its
|
|
137
|
-
// pass must not resolve enter clauses as active on the first frame
|
|
138
|
-
const initialState = { ...defaultComponentStateMounted }
|
|
139
|
-
|
|
140
|
-
// will be nice to deprecate half of these:
|
|
141
96
|
const disabled = isDisabled(props)
|
|
142
97
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const states = useState<TamaguiComponentState>(initialState)
|
|
98
|
+
const [componentState, reactSetState] = useState<TamaguiComponentState>(() =>
|
|
99
|
+
disabled != null
|
|
100
|
+
? { ...defaultComponentStateMounted, disabled }
|
|
101
|
+
: defaultComponentStateMounted
|
|
102
|
+
)
|
|
149
103
|
|
|
150
|
-
// React owns a mounted state from the start. The first style pass gets a
|
|
151
|
-
// render-local provisional `unmounted` value so it can discover enter
|
|
152
|
-
// clauses without mutating React state during render. Only a real enter
|
|
153
|
-
// frame is carried in the ref until the first state update consumes it.
|
|
154
104
|
const initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted
|
|
155
105
|
let state =
|
|
156
106
|
(!curStateRef.didFinalizeInitialStyleFrame && !isHOC) ||
|
|
157
107
|
initialStyleFrameUnmounted !== undefined
|
|
158
|
-
? { ...
|
|
159
|
-
:
|
|
108
|
+
? { ...componentState }
|
|
109
|
+
: componentState
|
|
160
110
|
if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {
|
|
161
111
|
state.unmounted = true
|
|
162
112
|
}
|
|
@@ -164,43 +114,31 @@ export const useComponentState = (
|
|
|
164
114
|
state.unmounted = initialStyleFrameUnmounted
|
|
165
115
|
}
|
|
166
116
|
if (props.forceStyle) {
|
|
167
|
-
if (state ===
|
|
117
|
+
if (state === componentState) state = { ...state }
|
|
168
118
|
state[props.forceStyle] = true
|
|
169
119
|
}
|
|
170
|
-
if (!curStateRef.setState) {
|
|
171
|
-
const reactSetState = states[1]
|
|
172
|
-
curStateRef.setState = (stateOrGetState) => {
|
|
173
|
-
const pendingUnmounted = curStateRef.initialStyleFrameUnmounted
|
|
174
|
-
curStateRef.initialStyleFrameUnmounted = undefined
|
|
175
|
-
reactSetState((previous) => {
|
|
176
|
-
const current =
|
|
177
|
-
pendingUnmounted !== undefined && previous.unmounted !== pendingUnmounted
|
|
178
|
-
? { ...previous, unmounted: pendingUnmounted }
|
|
179
|
-
: previous
|
|
180
|
-
return typeof stateOrGetState === 'function'
|
|
181
|
-
? stateOrGetState(current)
|
|
182
|
-
: stateOrGetState
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
const setState = curStateRef.setState
|
|
187
120
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
121
|
+
const setState = (curStateRef.setState ||= (stateOrGetState) => {
|
|
122
|
+
const pendingUnmounted = curStateRef.initialStyleFrameUnmounted
|
|
123
|
+
curStateRef.initialStyleFrameUnmounted = undefined
|
|
124
|
+
reactSetState((previous) => {
|
|
125
|
+
const current =
|
|
126
|
+
pendingUnmounted !== undefined && previous.unmounted !== pendingUnmounted
|
|
127
|
+
? { ...previous, unmounted: pendingUnmounted }
|
|
128
|
+
: previous
|
|
129
|
+
return typeof stateOrGetState === 'function'
|
|
130
|
+
? stateOrGetState(current)
|
|
131
|
+
: stateOrGetState
|
|
132
|
+
})
|
|
133
|
+
})
|
|
193
134
|
|
|
194
|
-
// only web server + initial client render run this when not hydrated:
|
|
195
135
|
let isAnimated = willBeAnimated
|
|
196
|
-
if (isWeb && hasAnimationThatNeedsHydrate && !
|
|
136
|
+
if (isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated) {
|
|
197
137
|
isAnimated = false
|
|
198
138
|
curStateRef.willHydrate = true
|
|
199
139
|
}
|
|
200
140
|
|
|
201
|
-
// immediately update disabled state and reset component state
|
|
202
141
|
if (disabled !== state.disabled) {
|
|
203
|
-
// if disabled remove all press/focus/hover states
|
|
204
142
|
if (disabled) {
|
|
205
143
|
Object.assign(state, defaultComponentStateMounted)
|
|
206
144
|
}
|
|
@@ -210,107 +148,41 @@ export const useComponentState = (
|
|
|
210
148
|
|
|
211
149
|
const groupName = props.group as any as string | undefined
|
|
212
150
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// if the base shared the `setStateShallow` field, on the 2nd+ render this hook would
|
|
222
|
-
// read back the wrapper, the wrapper's escape hatch would point at itself, and a real
|
|
223
|
-
// re-render (e.g. unmounted 'should-enter' -> false) would never reach React, leaving
|
|
224
|
-
// enter animations stuck at opacity 0.
|
|
225
|
-
if (!stateRef.current.baseSetStateShallow) {
|
|
226
|
-
const r = stateRef.current
|
|
227
|
-
r.baseSetStateShallow = (stateOrGetState: any) => {
|
|
228
|
-
setState((prev: any) => {
|
|
229
|
-
const next =
|
|
230
|
-
typeof stateOrGetState === 'function' ? stateOrGetState(prev) : stateOrGetState
|
|
231
|
-
const update = mergeIfNotShallowEqual(prev, next)
|
|
232
|
-
if (process.env.NODE_ENV === 'development') {
|
|
233
|
-
const dbg = (r as any).__debug
|
|
234
|
-
if (dbg && update !== prev) {
|
|
235
|
-
console.groupCollapsed(`setStateShallow CHANGE`, '=>', update)
|
|
236
|
-
console.info(`previously`, prev)
|
|
237
|
-
console.trace()
|
|
238
|
-
console.groupEnd()
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return update
|
|
242
|
-
})
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if (process.env.NODE_ENV === 'development') {
|
|
246
|
-
;(stateRef.current as any).__debug = props.debug
|
|
247
|
-
}
|
|
248
|
-
const setStateShallow = stateRef.current.baseSetStateShallow!
|
|
249
|
-
if (process.env.NODE_ENV === 'development' && globalThis.time)
|
|
250
|
-
globalThis.time`state-useCreateShallowSetState`
|
|
251
|
-
|
|
252
|
-
// merge AnimatePresence's `custom` onto a FRESH props object — never mutate the
|
|
253
|
-
// caller's incoming props. with the ref-strip clone removed in createComponent, on
|
|
254
|
-
// the no-defaults path that input IS React's own props object and must stay
|
|
255
|
-
// immutable. the augmented copy is returned as `props` below.
|
|
151
|
+
const setStateShallow = (curStateRef.baseSetStateShallow ||= (stateOrGetState: any) => {
|
|
152
|
+
setState((prev: any) => {
|
|
153
|
+
const next =
|
|
154
|
+
typeof stateOrGetState === 'function' ? stateOrGetState(prev) : stateOrGetState
|
|
155
|
+
return mergeIfNotShallowEqual(prev, next)
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
|
|
256
159
|
let outProps: typeof props = props
|
|
257
160
|
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
258
|
-
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
259
|
-
console.warn(
|
|
260
|
-
formatDiagnostic(
|
|
261
|
-
'TAMAGUI_PRESENCE_STATE',
|
|
262
|
-
staticConfig.Component?.displayName ||
|
|
263
|
-
staticConfig.Component?.name ||
|
|
264
|
-
'TamaguiComponent',
|
|
265
|
-
'AnimatePresence supplied lifecycle state to an animated component',
|
|
266
|
-
'Remove debug="verbose" after inspecting the animation state',
|
|
267
|
-
'presenceState',
|
|
268
|
-
presenceState
|
|
269
|
-
)
|
|
270
|
-
)
|
|
271
|
-
}
|
|
272
161
|
const { custom } = presenceState
|
|
273
162
|
if (isObj(custom)) {
|
|
274
163
|
outProps = { ...props, ...custom }
|
|
275
164
|
}
|
|
276
165
|
}
|
|
277
166
|
|
|
278
|
-
let noClass = !isWeb ||
|
|
279
|
-
|
|
280
|
-
if (!isHydrated) {
|
|
281
|
-
noClass = false
|
|
282
|
-
} else {
|
|
283
|
-
// on server for SSR and animation compat added the && isHydrated but perhaps we want
|
|
284
|
-
// disableClassName="until-hydrated" to be more straightforward
|
|
285
|
-
// see issue if not, Button sets disableClassName to true <Button transition="" /> with
|
|
286
|
-
// the react-native driver errors because it tries to animate var(--color) to rbga(..)
|
|
287
|
-
// no matter what if fully unmounted or on the server we use className
|
|
288
|
-
// only once we hydrate do we switch to spring animation drivers or disableClassName etc
|
|
289
|
-
if (isWeb && isHydrated) {
|
|
290
|
-
const isAnimatedAndHydrated =
|
|
291
|
-
!!((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC) &&
|
|
292
|
-
isHydrated
|
|
167
|
+
let noClass = !isWeb || Boolean(props.forceStyle)
|
|
293
168
|
|
|
169
|
+
if (isWeb) {
|
|
170
|
+
if (!isHydrated) {
|
|
171
|
+
noClass = false
|
|
172
|
+
} else {
|
|
173
|
+
const isAnimatedAndHydrated = Boolean(
|
|
174
|
+
(hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC
|
|
175
|
+
)
|
|
294
176
|
const isClassNameDisabled =
|
|
295
177
|
!staticConfig.acceptsClassName && (getSetting('disableSSR') || !state.unmounted)
|
|
296
|
-
|
|
297
|
-
const isDisabledManually = disableClassName && !state.unmounted
|
|
178
|
+
const isDisabledManually = Boolean(disableClassName && !state.unmounted)
|
|
298
179
|
|
|
299
180
|
if (
|
|
300
|
-
// Only disable className for animation drivers that output inline styles (not css)
|
|
301
181
|
(isAnimatedAndHydrated && outputStyle !== 'css') ||
|
|
302
182
|
isDisabledManually ||
|
|
303
183
|
isClassNameDisabled
|
|
304
184
|
) {
|
|
305
185
|
noClass = true
|
|
306
|
-
|
|
307
|
-
if (process.env.NODE_ENV === 'development' && props.debug === 'verbose') {
|
|
308
|
-
log(`avoiding className`, {
|
|
309
|
-
isAnimatedAndHydrated,
|
|
310
|
-
isDisabledManually,
|
|
311
|
-
isClassNameDisabled,
|
|
312
|
-
})
|
|
313
|
-
}
|
|
314
186
|
}
|
|
315
187
|
}
|
|
316
188
|
}
|
|
@@ -369,7 +241,7 @@ export const useComponentState = (
|
|
|
369
241
|
result.willBeAnimatedClient = nextWillBeAnimatedClient
|
|
370
242
|
result.willBeAnimated = nextWillBeAnimated
|
|
371
243
|
result.isAnimated =
|
|
372
|
-
isWeb && hasAnimationThatNeedsHydrate && !
|
|
244
|
+
isWeb && hasAnimationThatNeedsHydrate && !isHOC && !isHydrated
|
|
373
245
|
? false
|
|
374
246
|
: nextWillBeAnimated
|
|
375
247
|
if (nextWillBeAnimated && !isHOC && props['animatePresence'] !== false) {
|
package/src/hooks/useMedia.tsx
CHANGED
|
@@ -75,14 +75,16 @@ export function setupMediaListeners() {
|
|
|
75
75
|
const match = getMatch()
|
|
76
76
|
if (!match) {
|
|
77
77
|
throw new Error(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
process.env.NODE_ENV !== 'production'
|
|
79
|
+
? formatDiagnostic(
|
|
80
|
+
'TAMAGUI_MEDIA_MATCH',
|
|
81
|
+
'useMedia',
|
|
82
|
+
'matchMedia returned no MediaQueryList',
|
|
83
|
+
'Provide a matchMedia implementation that returns a MediaQueryList',
|
|
84
|
+
'key,query,platform',
|
|
85
|
+
{ key, query: str, platform: isWeb ? 'web' : 'native' }
|
|
86
|
+
)
|
|
87
|
+
: '❌ Error 013'
|
|
86
88
|
)
|
|
87
89
|
}
|
|
88
90
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StylePiece, TextStyle } from '../types'
|
|
2
|
+
import { resolveStylePieceForTheme } from '../style'
|
|
3
|
+
import { useThemeWithState } from './useTheme'
|
|
4
|
+
|
|
5
|
+
/** Resolves a style piece to a native/inline style object for compatibility props. */
|
|
6
|
+
export function useStyle(piece?: StylePiece | null): TextStyle | undefined {
|
|
7
|
+
const [, themeState] = useThemeWithState({})
|
|
8
|
+
if (!piece) return
|
|
9
|
+
return resolveStylePieceForTheme(piece, themeState.theme, themeState.name)
|
|
10
|
+
}
|