@tamagui/web 3.0.0-beta.755.1 → 3.0.0-beta.804.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 +83 -86
- package/dist/cjs/createComponent.native.cjs +96 -103
- package/dist/cjs/createComponent.native.js +96 -103
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/createTamagui.cjs +10 -8
- package/dist/cjs/createTamagui.native.cjs +10 -8
- package/dist/cjs/createTamagui.native.js +10 -8
- package/dist/cjs/createTamagui.native.js.map +1 -1
- package/dist/cjs/dom/htmlRuntime.native.cjs +1 -0
- package/dist/cjs/dom/htmlRuntime.native.js +1 -0
- package/dist/cjs/dom/htmlRuntime.native.js.map +1 -1
- package/dist/cjs/helpers/defaultAnimationDriver.cjs +0 -1
- package/dist/cjs/helpers/defaultAnimationDriver.native.cjs +0 -1
- package/dist/cjs/helpers/defaultAnimationDriver.native.js +0 -1
- package/dist/cjs/helpers/defaultAnimationDriver.native.js.map +1 -1
- package/dist/cjs/helpers/directStyleCSS.cjs +348 -0
- package/dist/cjs/helpers/directStyleCSS.native.cjs +20 -0
- package/dist/cjs/helpers/directStyleCSS.native.js +22 -0
- package/dist/cjs/helpers/directStyleCSS.native.js.map +1 -0
- package/dist/cjs/helpers/directStyleCSSCompiled.cjs +40 -0
- package/dist/cjs/helpers/directStyleCSSCompiled.native.cjs +46 -0
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js +48 -0
- package/dist/cjs/helpers/directStyleCSSCompiled.native.js.map +1 -0
- package/dist/cjs/helpers/getCSSStylesAtomic.cjs +92 -74
- package/dist/cjs/helpers/{getFontLanguage.native.cjs → getCSSStylesAtomicCompiled.cjs} +12 -8
- package/dist/cjs/helpers/{getFontLanguage.native.js → getCSSStylesAtomicCompiled.native.cjs} +12 -8
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js +36 -0
- package/dist/cjs/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -0
- package/dist/cjs/helpers/getSplitStyles.cjs +2417 -548
- package/dist/cjs/helpers/getSplitStyles.native.cjs +2758 -621
- package/dist/cjs/helpers/getSplitStyles.native.js +2758 -621
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/getVariantExtras.cjs +8 -3
- package/dist/cjs/helpers/getVariantExtras.native.cjs +8 -3
- package/dist/cjs/helpers/getVariantExtras.native.js +8 -3
- package/dist/cjs/helpers/getVariantExtras.native.js.map +1 -1
- package/dist/cjs/helpers/insertStyleRule.cjs +3 -2
- package/dist/cjs/helpers/insertStyleRule.native.cjs +70 -7
- package/dist/cjs/helpers/insertStyleRule.native.js +70 -7
- package/dist/cjs/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/cjs/helpers/mediaState.cjs +12 -0
- package/dist/cjs/helpers/mediaState.native.cjs +12 -0
- package/dist/cjs/helpers/mediaState.native.js +12 -0
- package/dist/cjs/helpers/mediaState.native.js.map +1 -1
- package/dist/cjs/helpers/normalizeStyle.cjs +16 -2
- package/dist/cjs/helpers/normalizeStyle.native.cjs +16 -2
- package/dist/cjs/helpers/normalizeStyle.native.js +16 -2
- package/dist/cjs/helpers/normalizeStyle.native.js.map +1 -1
- package/dist/cjs/helpers/resolveRem.cjs +1 -1
- package/dist/cjs/helpers/skipProps.cjs +6 -1
- package/dist/cjs/helpers/skipProps.native.cjs +6 -1
- package/dist/cjs/helpers/skipProps.native.js +6 -1
- package/dist/cjs/helpers/skipProps.native.js.map +1 -1
- package/dist/cjs/helpers/styleFrontend.cjs +2 -8
- package/dist/cjs/helpers/styleFrontend.native.cjs +2 -10
- package/dist/cjs/helpers/styleFrontend.native.js +2 -10
- package/dist/cjs/helpers/styleFrontend.native.js.map +1 -1
- package/dist/cjs/helpers/styleToCSS.cjs +59 -0
- package/dist/cjs/helpers/{normalizeStylePropKeys.cjs → styleToCSS.native.cjs} +6 -4
- package/dist/cjs/helpers/{getFontLanguage.cjs → styleToCSS.native.js} +8 -4
- package/dist/cjs/helpers/styleToCSS.native.js.map +1 -0
- package/dist/cjs/helpers/subscribeToContextGroup.cjs +28 -1
- package/dist/cjs/helpers/subscribeToContextGroup.native.cjs +45 -1
- package/dist/cjs/helpers/subscribeToContextGroup.native.js +45 -1
- package/dist/cjs/helpers/subscribeToContextGroup.native.js.map +1 -1
- package/dist/cjs/helpers/variables.cjs +3 -2
- package/dist/cjs/helpers/variables.native.cjs +3 -2
- package/dist/cjs/helpers/variables.native.js +3 -2
- package/dist/cjs/helpers/variables.native.js.map +1 -1
- package/dist/cjs/helpers/wrapStyleTags.cjs +5 -3
- package/dist/cjs/helpers/wrapStyleTags.native.cjs +3 -1
- package/dist/cjs/helpers/wrapStyleTags.native.js +3 -1
- package/dist/cjs/helpers/wrapStyleTags.native.js.map +1 -1
- package/dist/cjs/hooks/useComponentState.cjs +70 -89
- package/dist/cjs/hooks/useComponentState.native.cjs +70 -88
- package/dist/cjs/hooks/useComponentState.native.js +70 -88
- package/dist/cjs/hooks/useComponentState.native.js.map +1 -1
- package/dist/cjs/hooks/useMedia.cjs +3 -15
- package/dist/cjs/hooks/useMedia.native.cjs +3 -15
- package/dist/cjs/hooks/useMedia.native.js +3 -15
- package/dist/cjs/hooks/useMedia.native.js.map +1 -1
- package/dist/cjs/hooks/useProps.cjs +7 -5
- package/dist/cjs/hooks/useProps.native.cjs +7 -5
- package/dist/cjs/hooks/useProps.native.js +7 -5
- package/dist/cjs/hooks/useProps.native.js.map +1 -1
- package/dist/cjs/hooks/useSplitStyles.cjs +42 -0
- package/dist/cjs/hooks/useSplitStyles.native.cjs +42 -0
- package/dist/cjs/hooks/useSplitStyles.native.js +44 -0
- package/dist/cjs/hooks/useSplitStyles.native.js.map +1 -0
- package/dist/cjs/index.cjs +184 -70
- package/dist/cjs/index.native.cjs +184 -70
- package/dist/cjs/index.native.js +184 -70
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/insertFont.cjs +1 -1
- package/dist/cjs/insertFont.native.cjs +1 -0
- package/dist/cjs/insertFont.native.js +1 -0
- package/dist/cjs/insertFont.native.js.map +1 -1
- package/dist/cjs/internal-runtime.cjs +33 -6
- package/dist/cjs/internal-runtime.native.cjs +33 -6
- package/dist/cjs/internal-runtime.native.js +33 -6
- package/dist/cjs/internal-runtime.native.js.map +1 -1
- package/dist/cjs/setupReactNative.cjs +1 -29
- package/dist/cjs/setupReactNative.native.cjs +1 -3
- package/dist/cjs/setupReactNative.native.js +1 -3
- package/dist/cjs/setupReactNative.native.js.map +1 -1
- package/dist/cjs/static-resolve.cjs +229 -0
- package/dist/cjs/static-resolve.native.cjs +242 -0
- package/dist/cjs/static-resolve.native.js +244 -0
- package/dist/cjs/static-resolve.native.js.map +1 -0
- package/dist/cjs/styled.cjs +23 -37
- package/dist/cjs/styled.native.cjs +22 -37
- package/dist/cjs/styled.native.js +22 -37
- package/dist/cjs/styled.native.js.map +1 -1
- package/dist/cjs/views/TamaguiProvider.cjs +4 -8
- package/dist/cjs/views/TamaguiProvider.native.cjs +4 -8
- package/dist/cjs/views/TamaguiProvider.native.js +4 -8
- package/dist/cjs/views/TamaguiProvider.native.js.map +1 -1
- package/dist/cjs/views/ThemeUpdate.cjs +1 -1
- package/dist/cjs/views/ThemeUpdate.native.cjs +1 -1
- package/dist/cjs/views/ThemeUpdate.native.js +1 -1
- package/dist/cjs/views/ThemeUpdate.native.js.map +1 -1
- package/dist/esm/createComponent.mjs +85 -88
- package/dist/esm/createComponent.mjs.map +1 -1
- package/dist/esm/createComponent.native.js +98 -105
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/createTamagui.mjs +10 -8
- package/dist/esm/createTamagui.mjs.map +1 -1
- package/dist/esm/createTamagui.native.js +10 -8
- package/dist/esm/createTamagui.native.js.map +1 -1
- package/dist/esm/dom/htmlRuntime.native.js +1 -0
- package/dist/esm/dom/htmlRuntime.native.js.map +1 -1
- package/dist/esm/helpers/defaultAnimationDriver.mjs +0 -1
- package/dist/esm/helpers/defaultAnimationDriver.mjs.map +1 -1
- package/dist/esm/helpers/defaultAnimationDriver.native.js +0 -1
- package/dist/esm/helpers/defaultAnimationDriver.native.js.map +1 -1
- package/dist/esm/helpers/directStyleCSS.mjs +320 -0
- package/dist/esm/helpers/directStyleCSS.mjs.map +1 -0
- package/dist/esm/helpers/directStyleCSS.native.js +1 -0
- package/dist/esm/helpers/directStyleCSSCompiled.mjs +11 -0
- package/dist/esm/helpers/directStyleCSSCompiled.mjs.map +1 -0
- package/dist/esm/helpers/directStyleCSSCompiled.native.js +15 -0
- package/dist/esm/helpers/directStyleCSSCompiled.native.js.map +1 -0
- package/dist/esm/helpers/getCSSStylesAtomic.mjs +86 -72
- package/dist/esm/helpers/getCSSStylesAtomic.mjs.map +1 -1
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs +9 -0
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.mjs.map +1 -0
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js +9 -0
- package/dist/esm/helpers/getCSSStylesAtomicCompiled.native.js.map +1 -0
- package/dist/esm/helpers/getSplitStyles.mjs +2406 -545
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +2751 -618
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/getVariantExtras.mjs +8 -3
- package/dist/esm/helpers/getVariantExtras.mjs.map +1 -1
- package/dist/esm/helpers/getVariantExtras.native.js +8 -3
- package/dist/esm/helpers/getVariantExtras.native.js.map +1 -1
- package/dist/esm/helpers/insertStyleRule.mjs +3 -2
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +71 -5
- package/dist/esm/helpers/insertStyleRule.native.js.map +1 -1
- package/dist/esm/helpers/mediaState.mjs +12 -1
- package/dist/esm/helpers/mediaState.mjs.map +1 -1
- package/dist/esm/helpers/mediaState.native.js +12 -1
- package/dist/esm/helpers/mediaState.native.js.map +1 -1
- package/dist/esm/helpers/normalizeStyle.mjs +16 -2
- package/dist/esm/helpers/normalizeStyle.mjs.map +1 -1
- package/dist/esm/helpers/normalizeStyle.native.js +16 -2
- package/dist/esm/helpers/normalizeStyle.native.js.map +1 -1
- package/dist/esm/helpers/resolveRem.mjs +1 -1
- package/dist/esm/helpers/resolveRem.mjs.map +1 -1
- package/dist/esm/helpers/skipProps.mjs +3 -1
- package/dist/esm/helpers/skipProps.mjs.map +1 -1
- package/dist/esm/helpers/skipProps.native.js +3 -1
- package/dist/esm/helpers/skipProps.native.js.map +1 -1
- package/dist/esm/helpers/styleFrontend.mjs +2 -4
- package/dist/esm/helpers/styleFrontend.mjs.map +1 -1
- package/dist/esm/helpers/styleFrontend.native.js +2 -6
- package/dist/esm/helpers/styleFrontend.native.js.map +1 -1
- package/dist/esm/helpers/styleToCSS.mjs +40 -0
- package/dist/esm/helpers/styleToCSS.mjs.map +1 -0
- package/dist/esm/helpers/styleToCSS.native.js +4 -0
- package/dist/esm/helpers/styleToCSS.native.js.map +1 -0
- package/dist/esm/helpers/subscribeToContextGroup.mjs +25 -1
- package/dist/esm/helpers/subscribeToContextGroup.mjs.map +1 -1
- package/dist/esm/helpers/subscribeToContextGroup.native.js +42 -1
- package/dist/esm/helpers/subscribeToContextGroup.native.js.map +1 -1
- package/dist/esm/helpers/variables.mjs +2 -1
- package/dist/esm/helpers/variables.mjs.map +1 -1
- package/dist/esm/helpers/variables.native.js +2 -1
- package/dist/esm/helpers/variables.native.js.map +1 -1
- package/dist/esm/helpers/wrapStyleTags.mjs +5 -3
- package/dist/esm/helpers/wrapStyleTags.mjs.map +1 -1
- package/dist/esm/helpers/wrapStyleTags.native.js +3 -1
- package/dist/esm/helpers/wrapStyleTags.native.js.map +1 -1
- package/dist/esm/hooks/useComponentState.mjs +71 -90
- package/dist/esm/hooks/useComponentState.mjs.map +1 -1
- package/dist/esm/hooks/useComponentState.native.js +71 -89
- package/dist/esm/hooks/useComponentState.native.js.map +1 -1
- package/dist/esm/hooks/useMedia.mjs +2 -15
- package/dist/esm/hooks/useMedia.mjs.map +1 -1
- package/dist/esm/hooks/useMedia.native.js +2 -15
- package/dist/esm/hooks/useMedia.native.js.map +1 -1
- package/dist/esm/hooks/useProps.mjs +7 -5
- package/dist/esm/hooks/useProps.mjs.map +1 -1
- package/dist/esm/hooks/useProps.native.js +7 -5
- package/dist/esm/hooks/useProps.native.js.map +1 -1
- package/dist/esm/hooks/useSplitStyles.mjs +17 -0
- package/dist/esm/hooks/useSplitStyles.mjs.map +1 -0
- package/dist/esm/hooks/useSplitStyles.native.js +14 -0
- package/dist/esm/hooks/useSplitStyles.native.js.map +1 -0
- package/dist/esm/index.js +57 -137
- package/dist/esm/index.mjs +57 -137
- package/dist/esm/index.native.js +57 -137
- package/dist/esm/insertFont.mjs +1 -1
- package/dist/esm/insertFont.mjs.map +1 -1
- package/dist/esm/insertFont.native.js +1 -0
- package/dist/esm/insertFont.native.js.map +1 -1
- package/dist/esm/internal-runtime.mjs +23 -4
- package/dist/esm/internal-runtime.mjs.map +1 -1
- package/dist/esm/internal-runtime.native.js +23 -4
- package/dist/esm/internal-runtime.native.js.map +1 -1
- package/dist/esm/setupReactNative.mjs +1 -29
- package/dist/esm/setupReactNative.mjs.map +1 -1
- package/dist/esm/setupReactNative.native.js +1 -3
- package/dist/esm/setupReactNative.native.js.map +1 -1
- package/dist/esm/static-resolve.mjs +194 -0
- package/dist/esm/static-resolve.mjs.map +1 -0
- package/dist/esm/static-resolve.native.js +205 -0
- package/dist/esm/static-resolve.native.js.map +1 -0
- package/dist/esm/styled.mjs +24 -40
- package/dist/esm/styled.mjs.map +1 -1
- package/dist/esm/styled.native.js +23 -40
- package/dist/esm/styled.native.js.map +1 -1
- package/dist/esm/views/TamaguiProvider.mjs +4 -8
- package/dist/esm/views/TamaguiProvider.mjs.map +1 -1
- package/dist/esm/views/TamaguiProvider.native.js +4 -8
- package/dist/esm/views/TamaguiProvider.native.js.map +1 -1
- package/dist/esm/views/ThemeUpdate.mjs +1 -1
- package/dist/esm/views/ThemeUpdate.mjs.map +1 -1
- package/dist/esm/views/ThemeUpdate.native.js +1 -1
- package/dist/esm/views/ThemeUpdate.native.js.map +1 -1
- package/package.json +25 -15
- package/reset.css +3 -3
- package/src/createComponent.tsx +175 -192
- package/src/createTamagui.ts +13 -10
- package/src/dom/html.native.tsx +99 -92
- package/src/dom/html.tsx +105 -98
- package/src/dom/htmlRuntime.native.tsx +1 -0
- package/src/helpers/defaultAnimationDriver.tsx +0 -1
- package/src/helpers/directStyleCSS.native.ts +1 -0
- package/src/helpers/directStyleCSS.ts +534 -0
- package/src/helpers/directStyleCSSCompiled.ts +32 -0
- package/src/helpers/getCSSStylesAtomic.ts +168 -88
- package/src/helpers/getCSSStylesAtomicCompiled.ts +9 -0
- package/src/helpers/getSplitStyles.tsx +4653 -1003
- package/src/helpers/getVariantExtras.tsx +15 -3
- package/src/helpers/insertStyleRule.tsx +8 -3
- package/src/helpers/mediaState.ts +15 -0
- package/src/helpers/normalizeStyle.ts +27 -2
- package/src/helpers/resolveRem.ts +1 -1
- package/src/helpers/skipProps.ts +3 -0
- package/src/helpers/styleFrontend.ts +20 -27
- package/src/helpers/styleToCSS.native.ts +1 -0
- package/src/helpers/styleToCSS.ts +43 -0
- package/src/helpers/subscribeToContextGroup.tsx +30 -0
- package/src/helpers/variables.ts +2 -1
- package/src/helpers/warnOnce.ts +3 -4
- package/src/helpers/wrapStyleTags.tsx +1 -1
- package/src/hooks/useComponentState.ts +118 -158
- package/src/hooks/useMedia.tsx +2 -18
- package/src/hooks/useProps.tsx +19 -15
- package/src/hooks/useSplitStyles.tsx +26 -0
- package/src/index.ts +298 -73
- package/src/insertFont.ts +5 -1
- package/src/internal-runtime.ts +49 -24
- package/src/internalRuntimeTypes.ts +2 -7
- package/src/setupReactNative.ts +7 -30
- package/src/static-resolve.ts +396 -0
- package/src/styled.tsx +34 -11
- package/src/types.tsx +41 -31
- package/src/views/TamaguiProvider.tsx +23 -22
- package/src/views/ThemeUpdate.tsx +3 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/createTamagui.d.ts.map +1 -1
- package/types/dom/html.d.ts +54 -50
- package/types/dom/html.d.ts.map +1 -1
- package/types/dom/html.native.d.ts +51 -47
- package/types/dom/html.native.d.ts.map +1 -1
- package/types/dom/htmlRuntime.native.d.ts.map +1 -1
- package/types/helpers/defaultAnimationDriver.d.ts.map +1 -1
- package/types/helpers/directStyleCSS.d.ts +28 -0
- package/types/helpers/directStyleCSS.d.ts.map +1 -0
- package/types/helpers/directStyleCSS.native.d.ts +2 -0
- package/types/helpers/directStyleCSS.native.d.ts.map +1 -0
- package/types/helpers/directStyleCSSCompiled.d.ts +10 -0
- package/types/helpers/directStyleCSSCompiled.d.ts.map +1 -0
- package/types/helpers/getCSSStylesAtomic.d.ts +22 -1
- package/types/helpers/getCSSStylesAtomic.d.ts.map +1 -1
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts +4 -0
- package/types/helpers/getCSSStylesAtomicCompiled.d.ts.map +1 -0
- package/types/helpers/getSplitStyles.d.ts +11 -4
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/getVariantExtras.d.ts.map +1 -1
- package/types/helpers/insertStyleRule.d.ts.map +1 -1
- package/types/helpers/mediaState.d.ts +4 -0
- package/types/helpers/mediaState.d.ts.map +1 -1
- package/types/helpers/normalizeStyle.d.ts +1 -1
- package/types/helpers/normalizeStyle.d.ts.map +1 -1
- package/types/helpers/skipProps.d.ts +2 -0
- package/types/helpers/skipProps.d.ts.map +1 -1
- package/types/helpers/styleFrontend.d.ts +13 -17
- package/types/helpers/styleFrontend.d.ts.map +1 -1
- package/types/helpers/styleToCSS.d.ts +2 -0
- package/types/helpers/styleToCSS.d.ts.map +1 -0
- package/types/helpers/styleToCSS.native.d.ts +2 -0
- package/types/helpers/styleToCSS.native.d.ts.map +1 -0
- package/types/helpers/subscribeToContextGroup.d.ts +1 -0
- package/types/helpers/subscribeToContextGroup.d.ts.map +1 -1
- package/types/helpers/variables.d.ts.map +1 -1
- package/types/helpers/warnOnce.d.ts.map +1 -1
- package/types/helpers/webPropsToSkip.native.d.ts +5 -0
- package/types/helpers/webPropsToSkip.native.d.ts.map +1 -1
- package/types/hooks/useComponentState.d.ts +3 -2
- package/types/hooks/useComponentState.d.ts.map +1 -1
- package/types/hooks/useMedia.d.ts +1 -5
- package/types/hooks/useMedia.d.ts.map +1 -1
- package/types/hooks/useProps.d.ts.map +1 -1
- package/types/hooks/useSplitStyles.d.ts +3 -0
- package/types/hooks/useSplitStyles.d.ts.map +1 -0
- package/types/index.d.ts +58 -72
- package/types/index.d.ts.map +1 -1
- package/types/insertFont.d.ts.map +1 -1
- package/types/internal-runtime.d.ts +24 -11
- package/types/internal-runtime.d.ts.map +1 -1
- package/types/internalRuntimeTypes.d.ts +1 -6
- package/types/internalRuntimeTypes.d.ts.map +1 -1
- package/types/setupReactNative.d.ts +2 -3
- package/types/setupReactNative.d.ts.map +1 -1
- package/types/static-resolve.d.ts +79 -0
- package/types/static-resolve.d.ts.map +1 -0
- package/types/styled.d.ts.map +1 -1
- package/types/types.d.ts +30 -23
- package/types/types.d.ts.map +1 -1
- package/types/views/TamaguiProvider.d.ts.map +1 -1
- package/types/views/ThemeUpdate.d.ts.map +1 -1
- package/dist/cjs/constants/accessibilityDirectMap.cjs +0 -34
- package/dist/cjs/constants/accessibilityDirectMap.native.cjs +0 -36
- package/dist/cjs/constants/accessibilityDirectMap.native.js +0 -38
- package/dist/cjs/constants/accessibilityDirectMap.native.js.map +0 -1
- package/dist/cjs/helpers/directStyle.cjs +0 -962
- package/dist/cjs/helpers/directStyle.native.cjs +0 -1165
- package/dist/cjs/helpers/directStyle.native.js +0 -1167
- package/dist/cjs/helpers/directStyle.native.js.map +0 -1
- package/dist/cjs/helpers/frontendProgram.cjs +0 -43
- package/dist/cjs/helpers/frontendProgram.native.cjs +0 -49
- package/dist/cjs/helpers/frontendProgram.native.js +0 -51
- package/dist/cjs/helpers/frontendProgram.native.js.map +0 -1
- package/dist/cjs/helpers/getFontLanguage.native.js.map +0 -1
- package/dist/cjs/helpers/normalizeStylePropKeys.native.cjs +0 -37
- package/dist/cjs/helpers/normalizeStylePropKeys.native.js +0 -39
- package/dist/cjs/helpers/normalizeStylePropKeys.native.js.map +0 -1
- package/dist/cjs/helpers/propMapper.cjs +0 -384
- package/dist/cjs/helpers/propMapper.native.cjs +0 -536
- package/dist/cjs/helpers/propMapper.native.js +0 -538
- package/dist/cjs/helpers/propMapper.native.js.map +0 -1
- package/dist/cjs/helpers/useRenderElement.cjs +0 -47
- package/dist/cjs/helpers/useRenderElement.native.cjs +0 -53
- package/dist/cjs/helpers/useRenderElement.native.js +0 -55
- package/dist/cjs/helpers/useRenderElement.native.js.map +0 -1
- package/dist/esm/constants/accessibilityDirectMap.mjs +0 -8
- package/dist/esm/constants/accessibilityDirectMap.mjs.map +0 -1
- package/dist/esm/constants/accessibilityDirectMap.native.js +0 -8
- package/dist/esm/constants/accessibilityDirectMap.native.js.map +0 -1
- package/dist/esm/helpers/directStyle.mjs +0 -929
- package/dist/esm/helpers/directStyle.mjs.map +0 -1
- package/dist/esm/helpers/directStyle.native.js +0 -1132
- package/dist/esm/helpers/directStyle.native.js.map +0 -1
- package/dist/esm/helpers/frontendProgram.mjs +0 -20
- package/dist/esm/helpers/frontendProgram.mjs.map +0 -1
- package/dist/esm/helpers/frontendProgram.native.js +0 -24
- package/dist/esm/helpers/frontendProgram.native.js.map +0 -1
- package/dist/esm/helpers/getFontLanguage.mjs +0 -4
- package/dist/esm/helpers/getFontLanguage.mjs.map +0 -1
- package/dist/esm/helpers/getFontLanguage.native.js +0 -6
- package/dist/esm/helpers/getFontLanguage.native.js.map +0 -1
- package/dist/esm/helpers/normalizeStylePropKeys.mjs +0 -4
- package/dist/esm/helpers/normalizeStylePropKeys.mjs.map +0 -1
- package/dist/esm/helpers/normalizeStylePropKeys.native.js +0 -15
- package/dist/esm/helpers/normalizeStylePropKeys.native.js.map +0 -1
- package/dist/esm/helpers/propMapper.mjs +0 -360
- package/dist/esm/helpers/propMapper.mjs.map +0 -1
- package/dist/esm/helpers/propMapper.native.js +0 -511
- package/dist/esm/helpers/propMapper.native.js.map +0 -1
- package/dist/esm/helpers/useRenderElement.mjs +0 -26
- package/dist/esm/helpers/useRenderElement.mjs.map +0 -1
- package/dist/esm/helpers/useRenderElement.native.js +0 -31
- package/dist/esm/helpers/useRenderElement.native.js.map +0 -1
- package/src/constants/accessibilityDirectMap.native.tsx +0 -10
- package/src/constants/accessibilityDirectMap.tsx +0 -11
- package/src/helpers/directStyle.ts +0 -2294
- package/src/helpers/frontendProgram.ts +0 -48
- package/src/helpers/getFontLanguage.ts +0 -2
- package/src/helpers/normalizeStylePropKeys.native.ts +0 -12
- package/src/helpers/normalizeStylePropKeys.ts +0 -3
- package/src/helpers/propMapper.ts +0 -721
- package/src/helpers/useRenderElement.tsx +0 -73
- package/types/constants/accessibilityDirectMap.d.ts +0 -6
- package/types/constants/accessibilityDirectMap.d.ts.map +0 -1
- package/types/constants/accessibilityDirectMap.native.d.ts +0 -6
- package/types/constants/accessibilityDirectMap.native.d.ts.map +0 -1
- package/types/helpers/directStyle.d.ts +0 -15
- package/types/helpers/directStyle.d.ts.map +0 -1
- package/types/helpers/frontendProgram.d.ts +0 -10
- package/types/helpers/frontendProgram.d.ts.map +0 -1
- package/types/helpers/getFontLanguage.d.ts +0 -2
- package/types/helpers/getFontLanguage.d.ts.map +0 -1
- package/types/helpers/normalizeStylePropKeys.d.ts +0 -2
- package/types/helpers/normalizeStylePropKeys.d.ts.map +0 -1
- package/types/helpers/normalizeStylePropKeys.native.d.ts +0 -13
- package/types/helpers/normalizeStylePropKeys.native.d.ts.map +0 -1
- package/types/helpers/propMapper.d.ts +0 -6
- package/types/helpers/propMapper.d.ts.map +0 -1
- package/types/helpers/useRenderElement.d.ts +0 -13
- package/types/helpers/useRenderElement.d.ts.map +0 -1
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { getPlatformDriver, isServer, isWeb } from '@tamagui/constants'
|
|
2
|
-
import { stylePropsAll } from '@tamagui/helpers'
|
|
3
|
-
import {
|
|
4
|
-
canonicalClauseModifier,
|
|
5
|
-
scanFlatValue,
|
|
6
|
-
type FlatValueHandler,
|
|
7
|
-
} from '@tamagui/style-grammar/runtime'
|
|
8
2
|
import { mergeIfNotShallowEqual } from '@tamagui/is-equal-shallow'
|
|
9
3
|
import { useDidFinishSSR, useIsClientOnly } from '@tamagui/use-did-finish-ssr'
|
|
10
4
|
import { useRef, useState } from 'react'
|
|
@@ -29,101 +23,6 @@ import type {
|
|
|
29
23
|
} from '../types'
|
|
30
24
|
import type { ViewProps } from '../views/View'
|
|
31
25
|
|
|
32
|
-
// canonical spellings only: `canonicalClauseModifier` folds `active` and
|
|
33
|
-
// `pressed` into `press` and `starting` into `enter` before the lookup, so the
|
|
34
|
-
// alias table in @tamagui/style-grammar stays the only place they are listed
|
|
35
|
-
const platformPseudoModifiers = new Set(['hover', 'press', 'focus'])
|
|
36
|
-
const enterModifier = new Set(['enter'])
|
|
37
|
-
|
|
38
|
-
type LifecycleScanContext = TamaguiComponentStateRef & {
|
|
39
|
-
// source, wanted modifiers, found, and pending match. created once per
|
|
40
|
-
// component and reused by both lifecycle questions on every render.
|
|
41
|
-
flatScan?: [string, ReadonlySet<string>, boolean, boolean]
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const lifecycleHandler: FlatValueHandler<LifecycleScanContext> = {
|
|
45
|
-
segment(ctx, start, end, isBase, valid) {
|
|
46
|
-
const scan = ctx.flatScan!
|
|
47
|
-
if (!isBase && valid && start < end && scan[3]) scan[2] = true
|
|
48
|
-
scan[3] = false
|
|
49
|
-
},
|
|
50
|
-
chain(ctx, start, end, valid) {
|
|
51
|
-
const scan = ctx.flatScan!
|
|
52
|
-
scan[3] = false
|
|
53
|
-
if (!valid) return true
|
|
54
|
-
for (let index = start; index <= end; index++) {
|
|
55
|
-
if (index !== end && scan[0].charCodeAt(index) !== 58) continue
|
|
56
|
-
if (scan[1].has(canonicalClauseModifier(scan[0].slice(start, index)))) {
|
|
57
|
-
scan[3] = true
|
|
58
|
-
}
|
|
59
|
-
start = index + 1
|
|
60
|
-
}
|
|
61
|
-
return true
|
|
62
|
-
},
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Does any flat style value on this component carry one of `modifiers`?
|
|
67
|
-
*
|
|
68
|
-
* It runs the same `scanFlatValue` lexer the style scanner runs, which is the
|
|
69
|
-
* whole reason it exists in this shape: a value the style scanner throws away
|
|
70
|
-
* used to still put the component on the should-enter path here, so it rendered
|
|
71
|
-
* an enter frame for a style that never arrived.
|
|
72
|
-
*/
|
|
73
|
-
function hasFlatModifier(
|
|
74
|
-
props: Record<string, any>,
|
|
75
|
-
config: TamaguiInternalConfig,
|
|
76
|
-
modifiers: ReadonlySet<string>,
|
|
77
|
-
ctx: LifecycleScanContext,
|
|
78
|
-
variants?: Record<string, any>
|
|
79
|
-
): boolean {
|
|
80
|
-
const scan = (ctx.flatScan ||= ['', enterModifier, false, false])
|
|
81
|
-
for (const key in props) {
|
|
82
|
-
const value = props[key]
|
|
83
|
-
const isString = typeof value === 'string'
|
|
84
|
-
if (isString ? value.indexOf(':') === -1 : !value || typeof value !== 'object') {
|
|
85
|
-
continue
|
|
86
|
-
}
|
|
87
|
-
const property = config.shorthands[key] || key
|
|
88
|
-
if (
|
|
89
|
-
!(property in stylePropsAll) &&
|
|
90
|
-
property !== 'transition' &&
|
|
91
|
-
// conditional variant props resolve style branches too, so their
|
|
92
|
-
// lifecycle clauses drive the same decision
|
|
93
|
-
!(variants && key in variants)
|
|
94
|
-
) {
|
|
95
|
-
continue
|
|
96
|
-
}
|
|
97
|
-
if (!isString) {
|
|
98
|
-
// an object-valued transition is the driver's per-lifecycle config
|
|
99
|
-
// grammar (`{ default, enter, exit }` timings), not a flat conditional
|
|
100
|
-
// style value — its keys name when to run, not what style arrives
|
|
101
|
-
if (property === 'transition') continue
|
|
102
|
-
// flat conditional objects carry the chain as the key; a structured leaf
|
|
103
|
-
// (shadowOffset) has no modifier-named key so it never matches
|
|
104
|
-
for (const chain in value) {
|
|
105
|
-
if (chain === 'default' || value[chain] == null) continue
|
|
106
|
-
let start = 0
|
|
107
|
-
for (let index = 0; index <= chain.length; index++) {
|
|
108
|
-
if (index !== chain.length && chain.charCodeAt(index) !== 58) continue
|
|
109
|
-
if (modifiers.has(canonicalClauseModifier(chain.slice(start, index)))) {
|
|
110
|
-
return true
|
|
111
|
-
}
|
|
112
|
-
start = index + 1
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
continue
|
|
116
|
-
}
|
|
117
|
-
scan[0] = value
|
|
118
|
-
scan[1] = modifiers
|
|
119
|
-
scan[2] = false
|
|
120
|
-
scan[3] = false
|
|
121
|
-
scanFlatValue(value, lifecycleHandler, ctx)
|
|
122
|
-
if (scan[2]) return true
|
|
123
|
-
}
|
|
124
|
-
return false
|
|
125
|
-
}
|
|
126
|
-
|
|
127
26
|
export const useComponentState = (
|
|
128
27
|
props: ViewProps | TextProps | Record<string, any>,
|
|
129
28
|
animationDriver: ComponentContextI['animationDriver'],
|
|
@@ -173,86 +72,70 @@ export const useComponentState = (
|
|
|
173
72
|
// driver-sourced (hover) or event-sourced (press/focus) but either way applies
|
|
174
73
|
// through the emitter with zero React commits; with no transition declared it
|
|
175
74
|
// resolves instant (see createComponent's effectiveTransition default).
|
|
176
|
-
const
|
|
75
|
+
const platformPseudoPossible = Boolean(
|
|
177
76
|
!isHOC &&
|
|
178
77
|
useAnimations &&
|
|
179
78
|
animationDriver?.avoidReRenders &&
|
|
180
|
-
getPlatformDriver()?.pseudo
|
|
181
|
-
hasFlatModifier(
|
|
182
|
-
props,
|
|
183
|
-
config,
|
|
184
|
-
platformPseudoModifiers,
|
|
185
|
-
curStateRef as LifecycleScanContext,
|
|
186
|
-
staticConfig.variants
|
|
187
|
-
)
|
|
79
|
+
getPlatformDriver()?.pseudo
|
|
188
80
|
)
|
|
189
81
|
|
|
190
|
-
|
|
191
|
-
const next = !!(
|
|
82
|
+
let willBeAnimatedClient = (() => {
|
|
83
|
+
const next = !!(
|
|
84
|
+
(hasAnimationProp || platformPseudoPossible) &&
|
|
85
|
+
!isHOC &&
|
|
86
|
+
useAnimations
|
|
87
|
+
)
|
|
192
88
|
return Boolean(next || curStateRef.hasAnimated)
|
|
193
89
|
})()
|
|
194
90
|
|
|
195
|
-
|
|
91
|
+
let willBeAnimated = !isServer && willBeAnimatedClient
|
|
196
92
|
|
|
197
93
|
// once animated, always animated to preserve hooks / vdom structure
|
|
198
|
-
if (willBeAnimated && !curStateRef.hasAnimated) {
|
|
94
|
+
if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {
|
|
199
95
|
curStateRef.hasAnimated = true
|
|
200
96
|
}
|
|
201
97
|
|
|
202
98
|
const { disableClassName } = props
|
|
203
99
|
|
|
204
100
|
// HOOK
|
|
101
|
+
// the registration decision must be current BEFORE this render commits: a
|
|
102
|
+
// presence parent with zero registered consumers completes an exit
|
|
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) {
|
|
109
|
+
curStateRef.shouldRegisterPresence = true
|
|
110
|
+
} else {
|
|
111
|
+
curStateRef.shouldRegisterPresence ??= false
|
|
112
|
+
}
|
|
113
|
+
const presenceResult = animationDriver?.usePresence?.(curStateRef) || null
|
|
114
|
+
// the hook call position is fixed, but the OBSERVED presence keeps the old
|
|
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
|
|
205
119
|
const presence =
|
|
206
|
-
|
|
207
|
-
willBeAnimated &&
|
|
208
|
-
props['animatePresence'] !== false &&
|
|
209
|
-
animationDriver?.usePresence?.()) ||
|
|
210
|
-
null
|
|
120
|
+
!isHOC && willBeAnimated && props['animatePresence'] !== false ? presenceResult : null
|
|
211
121
|
|
|
212
122
|
const presenceState = presence?.[2]
|
|
213
123
|
const isExiting = presenceState?.isPresent === false
|
|
214
124
|
const isEntering = presenceState?.isPresent === true && presenceState.initial !== false
|
|
215
125
|
|
|
216
|
-
const hasEnterStyle = hasFlatModifier(
|
|
217
|
-
props,
|
|
218
|
-
config,
|
|
219
|
-
enterModifier,
|
|
220
|
-
curStateRef as LifecycleScanContext,
|
|
221
|
-
staticConfig.variants
|
|
222
|
-
)
|
|
223
|
-
|
|
224
126
|
const hasAnimationThatNeedsHydrate =
|
|
225
|
-
hasAnimationProp &&
|
|
226
|
-
!isHydrated &&
|
|
227
|
-
(animationDriver?.isReactNative || inputStyle !== 'css')
|
|
228
|
-
|
|
229
|
-
const canImmediatelyEnter = hasEnterStyle || isEntering
|
|
230
|
-
|
|
231
|
-
// this can be conditional because its only ever needed with animations
|
|
232
|
-
const shouldEnter =
|
|
233
|
-
!isHOC &&
|
|
234
|
-
(hasEnterStyle ||
|
|
235
|
-
isEntering ||
|
|
236
|
-
hasAnimationThatNeedsHydrate ||
|
|
237
|
-
// disableClassName doesnt work server side, only client, so needs hydrate
|
|
238
|
-
// this is just for a better ux, supports css variables for light/dark, media queries, etc
|
|
239
|
-
disableClassName)
|
|
127
|
+
hasAnimationProp && !isHydrated && inputStyle !== 'css'
|
|
240
128
|
|
|
241
129
|
// two stage enter: because we switch from css driver to spring driver
|
|
242
130
|
// - first render: render to match server with css driver
|
|
243
131
|
// - second render: state.unmounted = should-enter, still rendering the initial,
|
|
244
132
|
// non-entered state but now with the spring animation driver
|
|
245
133
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
// we can avoid the extra re-render on mount
|
|
252
|
-
canImmediatelyEnter
|
|
253
|
-
? defaultComponentStateShouldEnter
|
|
254
|
-
: defaultComponentState
|
|
255
|
-
: defaultComponentStateMounted
|
|
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 }
|
|
256
139
|
|
|
257
140
|
// will be nice to deprecate half of these:
|
|
258
141
|
const disabled = isDisabled(props)
|
|
@@ -264,8 +147,43 @@ export const useComponentState = (
|
|
|
264
147
|
// HOOK
|
|
265
148
|
const states = useState<TamaguiComponentState>(initialState)
|
|
266
149
|
|
|
267
|
-
|
|
268
|
-
|
|
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
|
+
const initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted
|
|
155
|
+
let state =
|
|
156
|
+
(!curStateRef.didFinalizeInitialStyleFrame && !isHOC) ||
|
|
157
|
+
initialStyleFrameUnmounted !== undefined
|
|
158
|
+
? { ...states[0] }
|
|
159
|
+
: states[0]
|
|
160
|
+
if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {
|
|
161
|
+
state.unmounted = true
|
|
162
|
+
}
|
|
163
|
+
if (initialStyleFrameUnmounted !== undefined) {
|
|
164
|
+
state.unmounted = initialStyleFrameUnmounted
|
|
165
|
+
}
|
|
166
|
+
if (props.forceStyle) {
|
|
167
|
+
if (state === states[0]) state = { ...state }
|
|
168
|
+
state[props.forceStyle] = true
|
|
169
|
+
}
|
|
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
|
|
269
187
|
|
|
270
188
|
// apply states we never updated from avoiding re-renders in animation driver
|
|
271
189
|
// unsafe yea yea
|
|
@@ -369,7 +287,9 @@ export const useComponentState = (
|
|
|
369
287
|
// no matter what if fully unmounted or on the server we use className
|
|
370
288
|
// only once we hydrate do we switch to spring animation drivers or disableClassName etc
|
|
371
289
|
if (isWeb && isHydrated) {
|
|
372
|
-
const isAnimatedAndHydrated =
|
|
290
|
+
const isAnimatedAndHydrated =
|
|
291
|
+
!!((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC) &&
|
|
292
|
+
isHydrated
|
|
373
293
|
|
|
374
294
|
const isClassNameDisabled =
|
|
375
295
|
!staticConfig.acceptsClassName && (getSetting('disableSSR') || !state.unmounted)
|
|
@@ -395,14 +315,14 @@ export const useComponentState = (
|
|
|
395
315
|
}
|
|
396
316
|
}
|
|
397
317
|
|
|
398
|
-
|
|
318
|
+
const result = {
|
|
399
319
|
props: outProps,
|
|
400
320
|
startedUnhydrated: curStateRef.startedUnhydrated,
|
|
401
321
|
curStateRef,
|
|
402
322
|
disabled,
|
|
403
323
|
groupName,
|
|
404
324
|
hasAnimationProp,
|
|
405
|
-
hasEnterStyle,
|
|
325
|
+
hasEnterStyle: false,
|
|
406
326
|
isAnimated,
|
|
407
327
|
isExiting,
|
|
408
328
|
isHydrated,
|
|
@@ -417,8 +337,48 @@ export const useComponentState = (
|
|
|
417
337
|
outputStyle,
|
|
418
338
|
willBeAnimated,
|
|
419
339
|
willBeAnimatedClient,
|
|
420
|
-
platformPseudo,
|
|
340
|
+
platformPseudo: platformPseudoPossible,
|
|
341
|
+
finalizeStyleFlags(hasEnterStyle: boolean, hasPlatformPseudo: boolean) {
|
|
342
|
+
const platformPseudo = platformPseudoPossible && hasPlatformPseudo
|
|
343
|
+
const nextWillBeAnimatedClient = Boolean(
|
|
344
|
+
((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) ||
|
|
345
|
+
curStateRef.hasAnimated
|
|
346
|
+
)
|
|
347
|
+
const nextWillBeAnimated = !isServer && nextWillBeAnimatedClient
|
|
348
|
+
if (nextWillBeAnimated && !curStateRef.hasAnimated) {
|
|
349
|
+
curStateRef.hasAnimated = true
|
|
350
|
+
}
|
|
351
|
+
if (!curStateRef.didFinalizeInitialStyleFrame) {
|
|
352
|
+
curStateRef.didFinalizeInitialStyleFrame = true
|
|
353
|
+
const shouldEnter =
|
|
354
|
+
!isHOC &&
|
|
355
|
+
(hasEnterStyle ||
|
|
356
|
+
isEntering ||
|
|
357
|
+
hasAnimationThatNeedsHydrate ||
|
|
358
|
+
disableClassName)
|
|
359
|
+
const unmounted = shouldEnter
|
|
360
|
+
? hasEnterStyle || isEntering
|
|
361
|
+
? 'should-enter'
|
|
362
|
+
: true
|
|
363
|
+
: false
|
|
364
|
+
state.unmounted = unmounted
|
|
365
|
+
curStateRef.initialStyleFrameUnmounted = unmounted || undefined
|
|
366
|
+
}
|
|
367
|
+
result.hasEnterStyle = hasEnterStyle
|
|
368
|
+
result.platformPseudo = platformPseudo
|
|
369
|
+
result.willBeAnimatedClient = nextWillBeAnimatedClient
|
|
370
|
+
result.willBeAnimated = nextWillBeAnimated
|
|
371
|
+
result.isAnimated =
|
|
372
|
+
isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated
|
|
373
|
+
? false
|
|
374
|
+
: nextWillBeAnimated
|
|
375
|
+
if (nextWillBeAnimated && !isHOC && props['animatePresence'] !== false) {
|
|
376
|
+
curStateRef.shouldRegisterPresence = true
|
|
377
|
+
}
|
|
378
|
+
return result
|
|
379
|
+
},
|
|
421
380
|
}
|
|
381
|
+
return result
|
|
422
382
|
}
|
|
423
383
|
|
|
424
384
|
function hasAnimatedStyleValue(style: object) {
|
package/src/hooks/useMedia.tsx
CHANGED
|
@@ -7,10 +7,12 @@ import { matchMedia } from '../helpers/matchMedia'
|
|
|
7
7
|
import { mediaObjectToString } from '../helpers/mediaObjectToString'
|
|
8
8
|
import {
|
|
9
9
|
getMedia,
|
|
10
|
+
mediaKeyMatch,
|
|
10
11
|
mediaKeys,
|
|
11
12
|
mediaQueryConfig,
|
|
12
13
|
setMediaState,
|
|
13
14
|
} from '../helpers/mediaState'
|
|
15
|
+
export { mediaKeyMatch } from '../helpers/mediaState'
|
|
14
16
|
import type {
|
|
15
17
|
ComponentContextI,
|
|
16
18
|
DebugProp,
|
|
@@ -526,21 +528,3 @@ export function mediaKeyToQuery(key: string) {
|
|
|
526
528
|
(cachedMediaKeyToQuery[key] = mediaObjectToString(mediaQueryConfig[key]))
|
|
527
529
|
)
|
|
528
530
|
}
|
|
529
|
-
|
|
530
|
-
export function mediaKeyMatch(
|
|
531
|
-
key: string,
|
|
532
|
-
dimensions: { width: number; height: number }
|
|
533
|
-
) {
|
|
534
|
-
const mediaQueries = mediaQueryConfig[key]
|
|
535
|
-
for (const query in mediaQueries) {
|
|
536
|
-
const expectedVal = +mediaQueries[query]
|
|
537
|
-
const isMax = query.startsWith('max')
|
|
538
|
-
const isWidth = query.endsWith('Width')
|
|
539
|
-
const givenVal = dimensions[isWidth ? 'width' : 'height']
|
|
540
|
-
// if not max then min
|
|
541
|
-
if (isMax ? givenVal >= expectedVal : givenVal <= expectedVal) {
|
|
542
|
-
return false
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
return true
|
|
546
|
-
}
|
package/src/hooks/useProps.tsx
CHANGED
|
@@ -3,9 +3,12 @@ import React from 'react'
|
|
|
3
3
|
import { getConfig } from '../config'
|
|
4
4
|
import { ComponentContext } from '../contexts/ComponentContext'
|
|
5
5
|
import { GroupContext } from '../contexts/GroupContext'
|
|
6
|
-
import { useSplitStyles } from '
|
|
6
|
+
import { useSplitStyles } from './useSplitStyles'
|
|
7
7
|
import { subscribeToSafeArea } from '../helpers/resolveSafeAreaVariable'
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
subscribeToContextGroup,
|
|
10
|
+
useGroupSetRevision,
|
|
11
|
+
} from '../helpers/subscribeToContextGroup'
|
|
9
12
|
import type { SplitStyleProps, StaticConfig, ThemeParsed, UseMediaState } from '../types'
|
|
10
13
|
import type { ViewProps, ViewStyle } from '../views/View'
|
|
11
14
|
import { View } from '../views/View'
|
|
@@ -90,18 +93,19 @@ export function usePropsAndStyle<A extends PropsLikeObject>(
|
|
|
90
93
|
// useComponentState injects enter/exit presence variants onto a fresh copy
|
|
91
94
|
// (it no longer mutates our `props` in place), so use the returned object for
|
|
92
95
|
// style resolution below to keep those variants applied
|
|
96
|
+
const componentState = useComponentState(
|
|
97
|
+
props,
|
|
98
|
+
componentContext.animationDriver,
|
|
99
|
+
staticConfig,
|
|
100
|
+
getConfig()
|
|
101
|
+
)
|
|
93
102
|
const {
|
|
94
103
|
props: statefulProps,
|
|
95
104
|
state,
|
|
96
105
|
disabled,
|
|
97
106
|
setState,
|
|
98
107
|
setStateShallow,
|
|
99
|
-
} =
|
|
100
|
-
props,
|
|
101
|
-
componentContext.animationDriver,
|
|
102
|
-
staticConfig,
|
|
103
|
-
getConfig()
|
|
104
|
-
)
|
|
108
|
+
} = componentState
|
|
105
109
|
|
|
106
110
|
const mediaStateNow = opts?.noMedia
|
|
107
111
|
? // not safe to use mediaState but really marginal to hit this
|
|
@@ -128,7 +132,13 @@ export function usePropsAndStyle<A extends PropsLikeObject>(
|
|
|
128
132
|
groupContext
|
|
129
133
|
)
|
|
130
134
|
|
|
135
|
+
componentState.finalizeStyleFlags(
|
|
136
|
+
!!splitStyles?.hasEnterStyle,
|
|
137
|
+
!!splitStyles?.platformPseudo
|
|
138
|
+
)
|
|
139
|
+
|
|
131
140
|
const { mediaGroups, pseudoGroups } = splitStyles || {}
|
|
141
|
+
const groupSetRevision = useGroupSetRevision(pseudoGroups, mediaGroups)
|
|
132
142
|
|
|
133
143
|
useIsomorphicLayoutEffect(() => {
|
|
134
144
|
let disposeSafeArea: (() => void) | undefined
|
|
@@ -165,13 +175,7 @@ export function usePropsAndStyle<A extends PropsLikeObject>(
|
|
|
165
175
|
}
|
|
166
176
|
}
|
|
167
177
|
return disposeSafeArea
|
|
168
|
-
}, [
|
|
169
|
-
disabled,
|
|
170
|
-
groupContext,
|
|
171
|
-
splitStyles?.usesSafeArea,
|
|
172
|
-
pseudoGroups ? Object.keys([...pseudoGroups]).join('') : 0,
|
|
173
|
-
mediaGroups ? Object.keys([...mediaGroups]).join('') : 0,
|
|
174
|
-
])
|
|
178
|
+
}, [disabled, groupContext, splitStyles?.usesSafeArea, groupSetRevision])
|
|
175
179
|
|
|
176
180
|
return [
|
|
177
181
|
splitStyles?.viewProps || {},
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { getSplitStyles, type StyleSplitter } from '../helpers/getSplitStyles'
|
|
4
|
+
import { insertStyleRules } from '../helpers/insertStyleRule'
|
|
5
|
+
|
|
6
|
+
// on native no need to insert any css
|
|
7
|
+
const useInsertEffectCompat = isWeb
|
|
8
|
+
? React.useInsertionEffect || useIsomorphicLayoutEffect
|
|
9
|
+
: () => {}
|
|
10
|
+
|
|
11
|
+
// perf: ...args a bit expensive on native
|
|
12
|
+
export const useSplitStyles: StyleSplitter = (a, b, c, d, e, f, g, h, i, j, k, l, m) => {
|
|
13
|
+
'use no memo'
|
|
14
|
+
|
|
15
|
+
const res = getSplitStyles(a, b, c, d, e, f, g, h, i, j, k, l, m)
|
|
16
|
+
|
|
17
|
+
if (!process.env.TAMAGUI_DID_OUTPUT_CSS && process.env.TAMAGUI_TARGET !== 'native') {
|
|
18
|
+
useInsertEffectCompat(() => {
|
|
19
|
+
if (res) {
|
|
20
|
+
insertStyleRules(res.rulesToInsert)
|
|
21
|
+
}
|
|
22
|
+
}, [res?.rulesToInsert])
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return res
|
|
26
|
+
}
|