@tamagui/web 3.0.0-beta.765.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 +9 -7
- package/dist/cjs/createTamagui.native.cjs +9 -7
- package/dist/cjs/createTamagui.native.js +9 -7
- package/dist/cjs/createTamagui.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 +2 -1
- package/dist/cjs/helpers/insertStyleRule.native.cjs +68 -5
- package/dist/cjs/helpers/insertStyleRule.native.js +68 -5
- 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 +9 -7
- package/dist/esm/createTamagui.mjs.map +1 -1
- package/dist/esm/createTamagui.native.js +9 -7
- package/dist/esm/createTamagui.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 +2 -1
- package/dist/esm/helpers/insertStyleRule.mjs.map +1 -1
- package/dist/esm/helpers/insertStyleRule.native.js +69 -3
- 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 +10 -9
- 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 +4 -2
- 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 +40 -30
- 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/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 +29 -22
- 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
|
@@ -24,8 +24,6 @@ var useComponentState_exports = {};
|
|
|
24
24
|
__export(useComponentState_exports, { useComponentState: () => useComponentState });
|
|
25
25
|
module.exports = __toCommonJS(useComponentState_exports);
|
|
26
26
|
var import_constants = require("@tamagui/constants");
|
|
27
|
-
var import_helpers = require("@tamagui/helpers");
|
|
28
|
-
var import_runtime = require("@tamagui/style-grammar/runtime");
|
|
29
27
|
var import_is_equal_shallow = require("@tamagui/is-equal-shallow");
|
|
30
28
|
var import_use_did_finish_ssr = require("@tamagui/use-did-finish-ssr");
|
|
31
29
|
var import_react = require("react");
|
|
@@ -39,74 +37,6 @@ function _type_of(obj) {
|
|
|
39
37
|
"@swc/helpers - typeof";
|
|
40
38
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
41
39
|
}
|
|
42
|
-
var platformPseudoModifiers = /* @__PURE__ */ new Set([
|
|
43
|
-
"hover",
|
|
44
|
-
"press",
|
|
45
|
-
"focus"
|
|
46
|
-
]);
|
|
47
|
-
var enterModifier = /* @__PURE__ */ new Set(["enter"]);
|
|
48
|
-
var lifecycleHandler = {
|
|
49
|
-
segment(ctx, start, end, isBase, valid) {
|
|
50
|
-
var scan = ctx.flatScan;
|
|
51
|
-
if (!isBase && valid && start < end && scan[3]) scan[2] = true;
|
|
52
|
-
scan[3] = false;
|
|
53
|
-
},
|
|
54
|
-
chain(ctx, start, end, valid) {
|
|
55
|
-
var scan = ctx.flatScan;
|
|
56
|
-
scan[3] = false;
|
|
57
|
-
if (!valid) return true;
|
|
58
|
-
for (var index = start; index <= end; index++) {
|
|
59
|
-
if (index !== end && scan[0].charCodeAt(index) !== 58) continue;
|
|
60
|
-
if (scan[1].has((0, import_runtime.canonicalClauseModifier)(scan[0].slice(start, index)))) {
|
|
61
|
-
scan[3] = true;
|
|
62
|
-
}
|
|
63
|
-
start = index + 1;
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
function hasFlatModifier(props, config, modifiers, ctx, variants) {
|
|
69
|
-
var _ctx;
|
|
70
|
-
var scan = (_ctx = ctx).flatScan || (_ctx.flatScan = [
|
|
71
|
-
"",
|
|
72
|
-
enterModifier,
|
|
73
|
-
false,
|
|
74
|
-
false
|
|
75
|
-
]);
|
|
76
|
-
for (var key in props) {
|
|
77
|
-
var value = props[key];
|
|
78
|
-
var isString = typeof value === "string";
|
|
79
|
-
if (isString ? value.indexOf(":") === -1 : !value || (typeof value === "undefined" ? "undefined" : _type_of(value)) !== "object") {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
var property = config.shorthands[key] || key;
|
|
83
|
-
if (!(property in import_helpers.stylePropsAll) && property !== "transition" && !(variants && key in variants)) {
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (!isString) {
|
|
87
|
-
if (property === "transition") continue;
|
|
88
|
-
for (var chain in value) {
|
|
89
|
-
if (chain === "default" || value[chain] == null) continue;
|
|
90
|
-
var start = 0;
|
|
91
|
-
for (var index = 0; index <= chain.length; index++) {
|
|
92
|
-
if (index !== chain.length && chain.charCodeAt(index) !== 58) continue;
|
|
93
|
-
if (modifiers.has((0, import_runtime.canonicalClauseModifier)(chain.slice(start, index)))) {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
start = index + 1;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
scan[0] = value;
|
|
102
|
-
scan[1] = modifiers;
|
|
103
|
-
scan[2] = false;
|
|
104
|
-
scan[3] = false;
|
|
105
|
-
(0, import_runtime.scanFlatValue)(value, lifecycleHandler, ctx);
|
|
106
|
-
if (scan[2]) return true;
|
|
107
|
-
}
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
40
|
var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
111
41
|
"use no memo";
|
|
112
42
|
var _getPlatformDriver, _animationDriver_usePresence;
|
|
@@ -130,35 +60,62 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
130
60
|
if (!needsHydration && hasAnimationProp) {
|
|
131
61
|
curStateRef.hasAnimated = true;
|
|
132
62
|
}
|
|
133
|
-
var
|
|
63
|
+
var platformPseudoPossible = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = (0, import_constants.getPlatformDriver)()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo));
|
|
134
64
|
var willBeAnimatedClient = (function() {
|
|
135
|
-
var next = !!((hasAnimationProp ||
|
|
65
|
+
var next = !!((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations);
|
|
136
66
|
return Boolean(next || curStateRef.hasAnimated);
|
|
137
67
|
})();
|
|
138
68
|
var willBeAnimated = !import_constants.isServer && willBeAnimatedClient;
|
|
139
|
-
if (willBeAnimated && !curStateRef.hasAnimated) {
|
|
69
|
+
if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {
|
|
140
70
|
curStateRef.hasAnimated = true;
|
|
141
71
|
}
|
|
142
72
|
var { disableClassName } = props;
|
|
143
|
-
|
|
73
|
+
if (willBeAnimated && !isHOC && props["animatePresence"] !== false) {
|
|
74
|
+
curStateRef.shouldRegisterPresence = true;
|
|
75
|
+
} else {
|
|
76
|
+
var _curStateRef;
|
|
77
|
+
var _shouldRegisterPresence;
|
|
78
|
+
(_shouldRegisterPresence = (_curStateRef = curStateRef).shouldRegisterPresence) !== null && _shouldRegisterPresence !== void 0 ? _shouldRegisterPresence : _curStateRef.shouldRegisterPresence = false;
|
|
79
|
+
}
|
|
80
|
+
var presenceResult = (animationDriver === null || animationDriver === void 0 ? void 0 : (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver, curStateRef)) || null;
|
|
81
|
+
var presence = !isHOC && willBeAnimated && props["animatePresence"] !== false ? presenceResult : null;
|
|
144
82
|
var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];
|
|
145
83
|
var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;
|
|
146
84
|
var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;
|
|
147
|
-
var
|
|
148
|
-
var
|
|
149
|
-
var canImmediatelyEnter = hasEnterStyle || isEntering;
|
|
150
|
-
var shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName);
|
|
151
|
-
var initialState = shouldEnter ? canImmediatelyEnter ? import_defaultComponentState.defaultComponentStateShouldEnter : import_defaultComponentState.defaultComponentState : import_defaultComponentState.defaultComponentStateMounted;
|
|
85
|
+
var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && inputStyle !== "css";
|
|
86
|
+
var initialState = { ...import_defaultComponentState.defaultComponentStateMounted };
|
|
152
87
|
var disabled = isDisabled(props);
|
|
153
88
|
if (disabled != null) {
|
|
154
89
|
initialState.disabled = disabled;
|
|
155
90
|
}
|
|
156
91
|
var states = (0, import_react.useState)(initialState);
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
92
|
+
var initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted;
|
|
93
|
+
var state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? { ...states[0] } : states[0];
|
|
94
|
+
if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {
|
|
95
|
+
state.unmounted = true;
|
|
96
|
+
}
|
|
97
|
+
if (initialStyleFrameUnmounted !== void 0) {
|
|
98
|
+
state.unmounted = initialStyleFrameUnmounted;
|
|
99
|
+
}
|
|
100
|
+
if (props.forceStyle) {
|
|
101
|
+
if (state === states[0]) state = { ...state };
|
|
102
|
+
state[props.forceStyle] = true;
|
|
103
|
+
}
|
|
104
|
+
if (!curStateRef.setState) {
|
|
105
|
+
var reactSetState = states[1];
|
|
106
|
+
curStateRef.setState = function(stateOrGetState) {
|
|
107
|
+
var pendingUnmounted = curStateRef.initialStyleFrameUnmounted;
|
|
108
|
+
curStateRef.initialStyleFrameUnmounted = void 0;
|
|
109
|
+
reactSetState(function(previous) {
|
|
110
|
+
var current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? {
|
|
111
|
+
...previous,
|
|
112
|
+
unmounted: pendingUnmounted
|
|
113
|
+
} : previous;
|
|
114
|
+
return typeof stateOrGetState === "function" ? stateOrGetState(current) : stateOrGetState;
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
var setState = curStateRef.setState;
|
|
162
119
|
var isAnimated = willBeAnimated;
|
|
163
120
|
if (import_constants.isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated) {
|
|
164
121
|
isAnimated = false;
|
|
@@ -218,7 +175,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
218
175
|
noClass = false;
|
|
219
176
|
} else {
|
|
220
177
|
if (import_constants.isWeb && isHydrated) {
|
|
221
|
-
var isAnimatedAndHydrated =
|
|
178
|
+
var isAnimatedAndHydrated = !!((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC) && isHydrated;
|
|
222
179
|
var isClassNameDisabled = !staticConfig.acceptsClassName && ((0, import_config.getSetting)("disableSSR") || !state.unmounted);
|
|
223
180
|
var isDisabledManually = disableClassName && !state.unmounted;
|
|
224
181
|
if (isAnimatedAndHydrated && outputStyle !== "css" || isDisabledManually || isClassNameDisabled) {
|
|
@@ -233,14 +190,14 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
233
190
|
}
|
|
234
191
|
}
|
|
235
192
|
}
|
|
236
|
-
|
|
193
|
+
var result = {
|
|
237
194
|
props: outProps,
|
|
238
195
|
startedUnhydrated: curStateRef.startedUnhydrated,
|
|
239
196
|
curStateRef,
|
|
240
197
|
disabled,
|
|
241
198
|
groupName,
|
|
242
199
|
hasAnimationProp,
|
|
243
|
-
hasEnterStyle,
|
|
200
|
+
hasEnterStyle: false,
|
|
244
201
|
isAnimated,
|
|
245
202
|
isExiting,
|
|
246
203
|
isHydrated,
|
|
@@ -255,8 +212,33 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
255
212
|
outputStyle,
|
|
256
213
|
willBeAnimated,
|
|
257
214
|
willBeAnimatedClient,
|
|
258
|
-
platformPseudo
|
|
215
|
+
platformPseudo: platformPseudoPossible,
|
|
216
|
+
finalizeStyleFlags(hasEnterStyle, hasPlatformPseudo) {
|
|
217
|
+
var platformPseudo = platformPseudoPossible && hasPlatformPseudo;
|
|
218
|
+
var nextWillBeAnimatedClient = Boolean((hasAnimationProp || platformPseudo) && !isHOC && useAnimations || curStateRef.hasAnimated);
|
|
219
|
+
var nextWillBeAnimated = !import_constants.isServer && nextWillBeAnimatedClient;
|
|
220
|
+
if (nextWillBeAnimated && !curStateRef.hasAnimated) {
|
|
221
|
+
curStateRef.hasAnimated = true;
|
|
222
|
+
}
|
|
223
|
+
if (!curStateRef.didFinalizeInitialStyleFrame) {
|
|
224
|
+
curStateRef.didFinalizeInitialStyleFrame = true;
|
|
225
|
+
var shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName);
|
|
226
|
+
var unmounted = shouldEnter ? hasEnterStyle || isEntering ? "should-enter" : true : false;
|
|
227
|
+
state.unmounted = unmounted;
|
|
228
|
+
curStateRef.initialStyleFrameUnmounted = unmounted || void 0;
|
|
229
|
+
}
|
|
230
|
+
result.hasEnterStyle = hasEnterStyle;
|
|
231
|
+
result.platformPseudo = platformPseudo;
|
|
232
|
+
result.willBeAnimatedClient = nextWillBeAnimatedClient;
|
|
233
|
+
result.willBeAnimated = nextWillBeAnimated;
|
|
234
|
+
result.isAnimated = import_constants.isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated ? false : nextWillBeAnimated;
|
|
235
|
+
if (nextWillBeAnimated && !isHOC && props["animatePresence"] !== false) {
|
|
236
|
+
curStateRef.shouldRegisterPresence = true;
|
|
237
|
+
}
|
|
238
|
+
return result;
|
|
239
|
+
}
|
|
259
240
|
};
|
|
241
|
+
return result;
|
|
260
242
|
};
|
|
261
243
|
function hasAnimatedStyleValue(style) {
|
|
262
244
|
for (var k in style) {
|
|
@@ -24,8 +24,6 @@ var useComponentState_exports = {};
|
|
|
24
24
|
__export(useComponentState_exports, { useComponentState: () => useComponentState });
|
|
25
25
|
module.exports = __toCommonJS(useComponentState_exports);
|
|
26
26
|
var import_constants = require("@tamagui/constants");
|
|
27
|
-
var import_helpers = require("@tamagui/helpers");
|
|
28
|
-
var import_runtime = require("@tamagui/style-grammar/runtime");
|
|
29
27
|
var import_is_equal_shallow = require("@tamagui/is-equal-shallow");
|
|
30
28
|
var import_use_did_finish_ssr = require("@tamagui/use-did-finish-ssr");
|
|
31
29
|
var import_react = require("react");
|
|
@@ -39,74 +37,6 @@ function _type_of(obj) {
|
|
|
39
37
|
"@swc/helpers - typeof";
|
|
40
38
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
41
39
|
}
|
|
42
|
-
var platformPseudoModifiers = /* @__PURE__ */ new Set([
|
|
43
|
-
"hover",
|
|
44
|
-
"press",
|
|
45
|
-
"focus"
|
|
46
|
-
]);
|
|
47
|
-
var enterModifier = /* @__PURE__ */ new Set(["enter"]);
|
|
48
|
-
var lifecycleHandler = {
|
|
49
|
-
segment(ctx, start, end, isBase, valid) {
|
|
50
|
-
var scan = ctx.flatScan;
|
|
51
|
-
if (!isBase && valid && start < end && scan[3]) scan[2] = true;
|
|
52
|
-
scan[3] = false;
|
|
53
|
-
},
|
|
54
|
-
chain(ctx, start, end, valid) {
|
|
55
|
-
var scan = ctx.flatScan;
|
|
56
|
-
scan[3] = false;
|
|
57
|
-
if (!valid) return true;
|
|
58
|
-
for (var index = start; index <= end; index++) {
|
|
59
|
-
if (index !== end && scan[0].charCodeAt(index) !== 58) continue;
|
|
60
|
-
if (scan[1].has((0, import_runtime.canonicalClauseModifier)(scan[0].slice(start, index)))) {
|
|
61
|
-
scan[3] = true;
|
|
62
|
-
}
|
|
63
|
-
start = index + 1;
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
function hasFlatModifier(props, config, modifiers, ctx, variants) {
|
|
69
|
-
var _ctx;
|
|
70
|
-
var scan = (_ctx = ctx).flatScan || (_ctx.flatScan = [
|
|
71
|
-
"",
|
|
72
|
-
enterModifier,
|
|
73
|
-
false,
|
|
74
|
-
false
|
|
75
|
-
]);
|
|
76
|
-
for (var key in props) {
|
|
77
|
-
var value = props[key];
|
|
78
|
-
var isString = typeof value === "string";
|
|
79
|
-
if (isString ? value.indexOf(":") === -1 : !value || (typeof value === "undefined" ? "undefined" : _type_of(value)) !== "object") {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
var property = config.shorthands[key] || key;
|
|
83
|
-
if (!(property in import_helpers.stylePropsAll) && property !== "transition" && !(variants && key in variants)) {
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (!isString) {
|
|
87
|
-
if (property === "transition") continue;
|
|
88
|
-
for (var chain in value) {
|
|
89
|
-
if (chain === "default" || value[chain] == null) continue;
|
|
90
|
-
var start = 0;
|
|
91
|
-
for (var index = 0; index <= chain.length; index++) {
|
|
92
|
-
if (index !== chain.length && chain.charCodeAt(index) !== 58) continue;
|
|
93
|
-
if (modifiers.has((0, import_runtime.canonicalClauseModifier)(chain.slice(start, index)))) {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
start = index + 1;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
scan[0] = value;
|
|
102
|
-
scan[1] = modifiers;
|
|
103
|
-
scan[2] = false;
|
|
104
|
-
scan[3] = false;
|
|
105
|
-
(0, import_runtime.scanFlatValue)(value, lifecycleHandler, ctx);
|
|
106
|
-
if (scan[2]) return true;
|
|
107
|
-
}
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
40
|
var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
111
41
|
"use no memo";
|
|
112
42
|
var _getPlatformDriver, _animationDriver_usePresence;
|
|
@@ -130,35 +60,62 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
130
60
|
if (!needsHydration && hasAnimationProp) {
|
|
131
61
|
curStateRef.hasAnimated = true;
|
|
132
62
|
}
|
|
133
|
-
var
|
|
63
|
+
var platformPseudoPossible = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = (0, import_constants.getPlatformDriver)()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo));
|
|
134
64
|
var willBeAnimatedClient = (function() {
|
|
135
|
-
var next = !!((hasAnimationProp ||
|
|
65
|
+
var next = !!((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations);
|
|
136
66
|
return Boolean(next || curStateRef.hasAnimated);
|
|
137
67
|
})();
|
|
138
68
|
var willBeAnimated = !import_constants.isServer && willBeAnimatedClient;
|
|
139
|
-
if (willBeAnimated && !curStateRef.hasAnimated) {
|
|
69
|
+
if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {
|
|
140
70
|
curStateRef.hasAnimated = true;
|
|
141
71
|
}
|
|
142
72
|
var { disableClassName } = props;
|
|
143
|
-
|
|
73
|
+
if (willBeAnimated && !isHOC && props["animatePresence"] !== false) {
|
|
74
|
+
curStateRef.shouldRegisterPresence = true;
|
|
75
|
+
} else {
|
|
76
|
+
var _curStateRef;
|
|
77
|
+
var _shouldRegisterPresence;
|
|
78
|
+
(_shouldRegisterPresence = (_curStateRef = curStateRef).shouldRegisterPresence) !== null && _shouldRegisterPresence !== void 0 ? _shouldRegisterPresence : _curStateRef.shouldRegisterPresence = false;
|
|
79
|
+
}
|
|
80
|
+
var presenceResult = (animationDriver === null || animationDriver === void 0 ? void 0 : (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver, curStateRef)) || null;
|
|
81
|
+
var presence = !isHOC && willBeAnimated && props["animatePresence"] !== false ? presenceResult : null;
|
|
144
82
|
var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];
|
|
145
83
|
var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;
|
|
146
84
|
var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;
|
|
147
|
-
var
|
|
148
|
-
var
|
|
149
|
-
var canImmediatelyEnter = hasEnterStyle || isEntering;
|
|
150
|
-
var shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName);
|
|
151
|
-
var initialState = shouldEnter ? canImmediatelyEnter ? import_defaultComponentState.defaultComponentStateShouldEnter : import_defaultComponentState.defaultComponentState : import_defaultComponentState.defaultComponentStateMounted;
|
|
85
|
+
var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && inputStyle !== "css";
|
|
86
|
+
var initialState = { ...import_defaultComponentState.defaultComponentStateMounted };
|
|
152
87
|
var disabled = isDisabled(props);
|
|
153
88
|
if (disabled != null) {
|
|
154
89
|
initialState.disabled = disabled;
|
|
155
90
|
}
|
|
156
91
|
var states = (0, import_react.useState)(initialState);
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
92
|
+
var initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted;
|
|
93
|
+
var state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? { ...states[0] } : states[0];
|
|
94
|
+
if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {
|
|
95
|
+
state.unmounted = true;
|
|
96
|
+
}
|
|
97
|
+
if (initialStyleFrameUnmounted !== void 0) {
|
|
98
|
+
state.unmounted = initialStyleFrameUnmounted;
|
|
99
|
+
}
|
|
100
|
+
if (props.forceStyle) {
|
|
101
|
+
if (state === states[0]) state = { ...state };
|
|
102
|
+
state[props.forceStyle] = true;
|
|
103
|
+
}
|
|
104
|
+
if (!curStateRef.setState) {
|
|
105
|
+
var reactSetState = states[1];
|
|
106
|
+
curStateRef.setState = function(stateOrGetState) {
|
|
107
|
+
var pendingUnmounted = curStateRef.initialStyleFrameUnmounted;
|
|
108
|
+
curStateRef.initialStyleFrameUnmounted = void 0;
|
|
109
|
+
reactSetState(function(previous) {
|
|
110
|
+
var current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? {
|
|
111
|
+
...previous,
|
|
112
|
+
unmounted: pendingUnmounted
|
|
113
|
+
} : previous;
|
|
114
|
+
return typeof stateOrGetState === "function" ? stateOrGetState(current) : stateOrGetState;
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
var setState = curStateRef.setState;
|
|
162
119
|
var isAnimated = willBeAnimated;
|
|
163
120
|
if (import_constants.isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated) {
|
|
164
121
|
isAnimated = false;
|
|
@@ -218,7 +175,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
218
175
|
noClass = false;
|
|
219
176
|
} else {
|
|
220
177
|
if (import_constants.isWeb && isHydrated) {
|
|
221
|
-
var isAnimatedAndHydrated =
|
|
178
|
+
var isAnimatedAndHydrated = !!((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC) && isHydrated;
|
|
222
179
|
var isClassNameDisabled = !staticConfig.acceptsClassName && ((0, import_config.getSetting)("disableSSR") || !state.unmounted);
|
|
223
180
|
var isDisabledManually = disableClassName && !state.unmounted;
|
|
224
181
|
if (isAnimatedAndHydrated && outputStyle !== "css" || isDisabledManually || isClassNameDisabled) {
|
|
@@ -233,14 +190,14 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
233
190
|
}
|
|
234
191
|
}
|
|
235
192
|
}
|
|
236
|
-
|
|
193
|
+
var result = {
|
|
237
194
|
props: outProps,
|
|
238
195
|
startedUnhydrated: curStateRef.startedUnhydrated,
|
|
239
196
|
curStateRef,
|
|
240
197
|
disabled,
|
|
241
198
|
groupName,
|
|
242
199
|
hasAnimationProp,
|
|
243
|
-
hasEnterStyle,
|
|
200
|
+
hasEnterStyle: false,
|
|
244
201
|
isAnimated,
|
|
245
202
|
isExiting,
|
|
246
203
|
isHydrated,
|
|
@@ -255,8 +212,33 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
255
212
|
outputStyle,
|
|
256
213
|
willBeAnimated,
|
|
257
214
|
willBeAnimatedClient,
|
|
258
|
-
platformPseudo
|
|
215
|
+
platformPseudo: platformPseudoPossible,
|
|
216
|
+
finalizeStyleFlags(hasEnterStyle, hasPlatformPseudo) {
|
|
217
|
+
var platformPseudo = platformPseudoPossible && hasPlatformPseudo;
|
|
218
|
+
var nextWillBeAnimatedClient = Boolean((hasAnimationProp || platformPseudo) && !isHOC && useAnimations || curStateRef.hasAnimated);
|
|
219
|
+
var nextWillBeAnimated = !import_constants.isServer && nextWillBeAnimatedClient;
|
|
220
|
+
if (nextWillBeAnimated && !curStateRef.hasAnimated) {
|
|
221
|
+
curStateRef.hasAnimated = true;
|
|
222
|
+
}
|
|
223
|
+
if (!curStateRef.didFinalizeInitialStyleFrame) {
|
|
224
|
+
curStateRef.didFinalizeInitialStyleFrame = true;
|
|
225
|
+
var shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName);
|
|
226
|
+
var unmounted = shouldEnter ? hasEnterStyle || isEntering ? "should-enter" : true : false;
|
|
227
|
+
state.unmounted = unmounted;
|
|
228
|
+
curStateRef.initialStyleFrameUnmounted = unmounted || void 0;
|
|
229
|
+
}
|
|
230
|
+
result.hasEnterStyle = hasEnterStyle;
|
|
231
|
+
result.platformPseudo = platformPseudo;
|
|
232
|
+
result.willBeAnimatedClient = nextWillBeAnimatedClient;
|
|
233
|
+
result.willBeAnimated = nextWillBeAnimated;
|
|
234
|
+
result.isAnimated = import_constants.isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated ? false : nextWillBeAnimated;
|
|
235
|
+
if (nextWillBeAnimated && !isHOC && props["animatePresence"] !== false) {
|
|
236
|
+
curStateRef.shouldRegisterPresence = true;
|
|
237
|
+
}
|
|
238
|
+
return result;
|
|
239
|
+
}
|
|
259
240
|
};
|
|
241
|
+
return result;
|
|
260
242
|
};
|
|
261
243
|
function hasAnimatedStyleValue(style) {
|
|
262
244
|
for (var k in style) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComponentState.native.js","names":[],"sources":["cjs/hooks/useComponentState.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useComponentState_exports = {};\n__export(useComponentState_exports, {\n useComponentState: () => useComponentState\n});\nmodule.exports = __toCommonJS(useComponentState_exports);\nvar import_constants = require(\"@tamagui/constants\");\nvar import_helpers = require(\"@tamagui/helpers\");\nvar import_runtime = require(\"@tamagui/style-grammar/runtime\");\nvar import_is_equal_shallow = require(\"@tamagui/is-equal-shallow\");\nvar import_use_did_finish_ssr = require(\"@tamagui/use-did-finish-ssr\");\nvar import_react = require(\"react\");\nvar import_config = require(\"../config\");\nvar import_formatDiagnostic = require(\"../helpers/formatDiagnostic\");\nvar import_isOptimizedForFirstRender = require(\"./isOptimizedForFirstRender\");\nvar import_defaultComponentState = require(\"../defaultComponentState\");\nvar import_isObj = require(\"../helpers/isObj\");\nvar import_log = require(\"../helpers/log\");\nfunction _type_of(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nvar platformPseudoModifiers = /* @__PURE__ */ new Set([\n \"hover\",\n \"press\",\n \"focus\"\n]);\nvar enterModifier = /* @__PURE__ */ new Set([\n \"enter\"\n]);\nvar lifecycleHandler = {\n segment(ctx, start, end, isBase, valid) {\n var scan = ctx.flatScan;\n if (!isBase && valid && start < end && scan[3]) scan[2] = true;\n scan[3] = false;\n },\n chain(ctx, start, end, valid) {\n var scan = ctx.flatScan;\n scan[3] = false;\n if (!valid) return true;\n for (var index = start; index <= end; index++) {\n if (index !== end && scan[0].charCodeAt(index) !== 58) continue;\n if (scan[1].has((0, import_runtime.canonicalClauseModifier)(scan[0].slice(start, index)))) {\n scan[3] = true;\n }\n start = index + 1;\n }\n return true;\n }\n};\nfunction hasFlatModifier(props, config, modifiers, ctx, variants) {\n var _ctx;\n var scan = (_ctx = ctx).flatScan || (_ctx.flatScan = [\n \"\",\n enterModifier,\n false,\n false\n ]);\n for (var key in props) {\n var value = props[key];\n var isString = typeof value === \"string\";\n if (isString ? value.indexOf(\":\") === -1 : !value || (typeof value === \"undefined\" ? \"undefined\" : _type_of(value)) !== \"object\") {\n continue;\n }\n var property = config.shorthands[key] || key;\n if (!(property in import_helpers.stylePropsAll) && property !== \"transition\" && // conditional variant props resolve style branches too, so their\n // lifecycle clauses drive the same decision\n !(variants && key in variants)) {\n continue;\n }\n if (!isString) {\n if (property === \"transition\") continue;\n for (var chain in value) {\n if (chain === \"default\" || value[chain] == null) continue;\n var start = 0;\n for (var index = 0; index <= chain.length; index++) {\n if (index !== chain.length && chain.charCodeAt(index) !== 58) continue;\n if (modifiers.has((0, import_runtime.canonicalClauseModifier)(chain.slice(start, index)))) {\n return true;\n }\n start = index + 1;\n }\n }\n continue;\n }\n scan[0] = value;\n scan[1] = modifiers;\n scan[2] = false;\n scan[3] = false;\n (0, import_runtime.scanFlatValue)(value, lifecycleHandler, ctx);\n if (scan[2]) return true;\n }\n return false;\n}\nvar useComponentState = function(props, animationDriver, staticConfig, config) {\n \"use no memo\";\n var _getPlatformDriver, _animationDriver_usePresence;\n var isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)();\n var needsHydration = !(0, import_use_did_finish_ssr.useIsClientOnly)();\n var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;\n var { isHOC } = staticConfig;\n var stateRef = (0, import_react.useRef)(\n // performance: avoid creating object every render\n void 0\n );\n if (!stateRef.current) {\n stateRef.current = {\n startedUnhydrated: needsHydration && !isHydrated,\n optimizeForFirstRender: (0, import_isOptimizedForFirstRender.isOptimizedForFirstRender)()\n };\n }\n var hasAnimationProp = Boolean(!isHOC && \"transition\" in props || props.style && hasAnimatedStyleValue(props.style));\n var _animationDriver_inputStyle;\n var inputStyle = (_animationDriver_inputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.inputStyle) !== null && _animationDriver_inputStyle !== void 0 ? _animationDriver_inputStyle : \"css\";\n var _animationDriver_outputStyle;\n var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : \"css\";\n var curStateRef = stateRef.current;\n if (!needsHydration && hasAnimationProp) {\n curStateRef.hasAnimated = true;\n }\n var platformPseudo = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = (0, import_constants.getPlatformDriver)()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo) && hasFlatModifier(props, config, platformPseudoModifiers, curStateRef, staticConfig.variants));\n var willBeAnimatedClient = (function() {\n var next = !!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations);\n return Boolean(next || curStateRef.hasAnimated);\n })();\n var willBeAnimated = !import_constants.isServer && willBeAnimatedClient;\n if (willBeAnimated && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n var { disableClassName } = props;\n var presence = !isHOC && willBeAnimated && props[\"animatePresence\"] !== false && (animationDriver === null || animationDriver === void 0 ? void 0 : (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver)) || null;\n var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];\n var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;\n var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;\n var hasEnterStyle = hasFlatModifier(props, config, enterModifier, curStateRef, staticConfig.variants);\n var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && ((animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isReactNative) || inputStyle !== \"css\");\n var canImmediatelyEnter = hasEnterStyle || isEntering;\n var shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || // disableClassName doesnt work server side, only client, so needs hydrate\n // this is just for a better ux, supports css variables for light/dark, media queries, etc\n disableClassName);\n var initialState = shouldEnter ? (\n // on the very first render we switch all spring animation drivers to css rendering\n // this is because we need to use css variables, which they don't support to do proper SSR\n // without flickers of the wrong colors.\n // but once we do that initial hydration and we are in client side rendering mode,\n // we can avoid the extra re-render on mount\n canImmediatelyEnter ? import_defaultComponentState.defaultComponentStateShouldEnter : import_defaultComponentState.defaultComponentState\n ) : import_defaultComponentState.defaultComponentStateMounted;\n var disabled = isDisabled(props);\n if (disabled != null) {\n initialState.disabled = disabled;\n }\n var states = (0, import_react.useState)(initialState);\n var state = props.forceStyle ? {\n ...states[0],\n [props.forceStyle]: true\n } : states[0];\n var setState = states[1];\n var isAnimated = willBeAnimated;\n if (import_constants.isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated) {\n isAnimated = false;\n curStateRef.willHydrate = true;\n }\n if (disabled !== state.disabled) {\n if (disabled) {\n Object.assign(state, import_defaultComponentState.defaultComponentStateMounted);\n }\n state.disabled = disabled;\n setState(function(_) {\n return {\n ...state\n };\n });\n }\n var groupName = props.group;\n if (!stateRef.current.baseSetStateShallow) {\n var r = stateRef.current;\n r.baseSetStateShallow = function(stateOrGetState) {\n setState(function(prev) {\n var next = typeof stateOrGetState === \"function\" ? stateOrGetState(prev) : stateOrGetState;\n var update = (0, import_is_equal_shallow.mergeIfNotShallowEqual)(prev, next);\n if (process.env.NODE_ENV === \"development\") {\n var dbg = r.__debug;\n if (dbg && update !== prev) {\n console.groupCollapsed(`setStateShallow CHANGE`, \"=>\", update);\n console.info(`previously`, prev);\n console.trace();\n console.groupEnd();\n }\n }\n return update;\n });\n };\n }\n if (process.env.NODE_ENV === \"development\") {\n ;\n stateRef.current.__debug = props.debug;\n }\n var setStateShallow = stateRef.current.baseSetStateShallow;\n if (process.env.NODE_ENV === \"development\" && globalThis.time) globalThis.time`state-useCreateShallowSetState`;\n var outProps = props;\n if (presenceState && isAnimated && isHydrated && staticConfig.variants) {\n if (process.env.NODE_ENV === \"development\" && props.debug === \"verbose\") {\n var _staticConfig_Component, _staticConfig_Component1;\n console.warn((0, import_formatDiagnostic.formatDiagnostic)(\"TAMAGUI_PRESENCE_STATE\", ((_staticConfig_Component = staticConfig.Component) === null || _staticConfig_Component === void 0 ? void 0 : _staticConfig_Component.displayName) || ((_staticConfig_Component1 = staticConfig.Component) === null || _staticConfig_Component1 === void 0 ? void 0 : _staticConfig_Component1.name) || \"TamaguiComponent\", \"AnimatePresence supplied lifecycle state to an animated component\", 'Remove debug=\"verbose\" after inspecting the animation state', \"presenceState\", presenceState));\n }\n var { custom } = presenceState;\n if ((0, import_isObj.isObj)(custom)) {\n outProps = {\n ...props,\n ...custom\n };\n }\n }\n var noClass = !import_constants.isWeb || !!props.forceStyle;\n if (!isHydrated) {\n noClass = false;\n } else {\n if (import_constants.isWeb && isHydrated) {\n var isAnimatedAndHydrated = isAnimated && isHydrated;\n var isClassNameDisabled = !staticConfig.acceptsClassName && ((0, import_config.getSetting)(\"disableSSR\") || !state.unmounted);\n var isDisabledManually = disableClassName && !state.unmounted;\n if (\n // Only disable className for animation drivers that output inline styles (not css)\n isAnimatedAndHydrated && outputStyle !== \"css\" || isDisabledManually || isClassNameDisabled\n ) {\n noClass = true;\n if (process.env.NODE_ENV === \"development\" && props.debug === \"verbose\") {\n (0, import_log.log)(`avoiding className`, {\n isAnimatedAndHydrated,\n isDisabledManually,\n isClassNameDisabled\n });\n }\n }\n }\n }\n return {\n props: outProps,\n startedUnhydrated: curStateRef.startedUnhydrated,\n curStateRef,\n disabled,\n groupName,\n hasAnimationProp,\n hasEnterStyle,\n isAnimated,\n isExiting,\n isHydrated,\n presence,\n presenceState,\n setState,\n setStateShallow,\n noClass,\n state,\n stateRef,\n inputStyle,\n outputStyle,\n willBeAnimated,\n willBeAnimatedClient,\n platformPseudo\n };\n};\nfunction hasAnimatedStyleValue(style) {\n for (var k in style) {\n var val = style[k];\n if (val && (typeof val === \"undefined\" ? \"undefined\" : _type_of(val)) === \"object\" && \"_animation\" in val) {\n return true;\n }\n }\n return false;\n}\nvar isDisabled = function(props) {\n var _props_accessibilityState;\n return props.disabled || props.passThrough || ((_props_accessibilityState = props.accessibilityState) === null || _props_accessibilityState === void 0 ? void 0 : _props_accessibilityState.disabled) || props[\"aria-disabled\"] || props.accessibilityDisabled || false;\n};\n//# sourceMappingURL=useComponentState.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,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OAAO;CACpC,KAAK,IAAI,KAAK,OAAO;EACnB,IAAI,MAAM,MAAM;EAChB,IAAI,QAAQ,OAAO,QAAQ,cAAc,cAAc,SAAS,GAAG,OAAO,YAAY,gBAAgB,KAAK;GACzG,OAAO;EACT;CACF;CACA,OAAO;AACT;AACA,IAAI,aAAa,SAAS,OAAO;CAC/B,IAAI;CACJ,OAAO,MAAM,YAAY,MAAM,iBAAiB,4BAA4B,MAAM,wBAAwB,QAAQ,8BAA8B,KAAK,IAAI,KAAK,IAAI,0BAA0B,aAAa,MAAM,oBAAoB,MAAM,yBAAyB;AACpQ"}
|
|
1
|
+
{"version":3,"file":"useComponentState.native.js","names":[],"sources":["cjs/hooks/useComponentState.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar useComponentState_exports = {};\n__export(useComponentState_exports, {\n useComponentState: () => useComponentState\n});\nmodule.exports = __toCommonJS(useComponentState_exports);\nvar import_constants = require(\"@tamagui/constants\");\nvar import_is_equal_shallow = require(\"@tamagui/is-equal-shallow\");\nvar import_use_did_finish_ssr = require(\"@tamagui/use-did-finish-ssr\");\nvar import_react = require(\"react\");\nvar import_config = require(\"../config\");\nvar import_formatDiagnostic = require(\"../helpers/formatDiagnostic\");\nvar import_isOptimizedForFirstRender = require(\"./isOptimizedForFirstRender\");\nvar import_defaultComponentState = require(\"../defaultComponentState\");\nvar import_isObj = require(\"../helpers/isObj\");\nvar import_log = require(\"../helpers/log\");\nfunction _type_of(obj) {\n \"@swc/helpers - typeof\";\n return obj && typeof Symbol !== \"undefined\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n}\nvar useComponentState = function(props, animationDriver, staticConfig, config) {\n \"use no memo\";\n var _getPlatformDriver, _animationDriver_usePresence;\n var isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)();\n var needsHydration = !(0, import_use_did_finish_ssr.useIsClientOnly)();\n var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;\n var { isHOC } = staticConfig;\n var stateRef = (0, import_react.useRef)(\n // performance: avoid creating object every render\n void 0\n );\n if (!stateRef.current) {\n stateRef.current = {\n startedUnhydrated: needsHydration && !isHydrated,\n optimizeForFirstRender: (0, import_isOptimizedForFirstRender.isOptimizedForFirstRender)()\n };\n }\n var hasAnimationProp = Boolean(!isHOC && \"transition\" in props || props.style && hasAnimatedStyleValue(props.style));\n var _animationDriver_inputStyle;\n var inputStyle = (_animationDriver_inputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.inputStyle) !== null && _animationDriver_inputStyle !== void 0 ? _animationDriver_inputStyle : \"css\";\n var _animationDriver_outputStyle;\n var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : \"css\";\n var curStateRef = stateRef.current;\n if (!needsHydration && hasAnimationProp) {\n curStateRef.hasAnimated = true;\n }\n var platformPseudoPossible = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = (0, import_constants.getPlatformDriver)()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo));\n var willBeAnimatedClient = (function() {\n var next = !!((hasAnimationProp || platformPseudoPossible) && !isHOC && useAnimations);\n return Boolean(next || curStateRef.hasAnimated);\n })();\n var willBeAnimated = !import_constants.isServer && willBeAnimatedClient;\n if (willBeAnimated && hasAnimationProp && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n var { disableClassName } = props;\n if (willBeAnimated && !isHOC && props[\"animatePresence\"] !== false) {\n curStateRef.shouldRegisterPresence = true;\n } else {\n var _curStateRef;\n var _shouldRegisterPresence;\n (_shouldRegisterPresence = (_curStateRef = curStateRef).shouldRegisterPresence) !== null && _shouldRegisterPresence !== void 0 ? _shouldRegisterPresence : _curStateRef.shouldRegisterPresence = false;\n }\n var presenceResult = (animationDriver === null || animationDriver === void 0 ? void 0 : (_animationDriver_usePresence = animationDriver.usePresence) === null || _animationDriver_usePresence === void 0 ? void 0 : _animationDriver_usePresence.call(animationDriver, curStateRef)) || null;\n var presence = !isHOC && willBeAnimated && props[\"animatePresence\"] !== false ? presenceResult : null;\n var presenceState = presence === null || presence === void 0 ? void 0 : presence[2];\n var isExiting = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === false;\n var isEntering = (presenceState === null || presenceState === void 0 ? void 0 : presenceState.isPresent) === true && presenceState.initial !== false;\n var hasAnimationThatNeedsHydrate = hasAnimationProp && !isHydrated && inputStyle !== \"css\";\n var initialState = {\n ...import_defaultComponentState.defaultComponentStateMounted\n };\n var disabled = isDisabled(props);\n if (disabled != null) {\n initialState.disabled = disabled;\n }\n var states = (0, import_react.useState)(initialState);\n var initialStyleFrameUnmounted = curStateRef.initialStyleFrameUnmounted;\n var state = !curStateRef.didFinalizeInitialStyleFrame && !isHOC || initialStyleFrameUnmounted !== void 0 ? {\n ...states[0]\n } : states[0];\n if (!curStateRef.didFinalizeInitialStyleFrame && !isHOC) {\n state.unmounted = true;\n }\n if (initialStyleFrameUnmounted !== void 0) {\n state.unmounted = initialStyleFrameUnmounted;\n }\n if (props.forceStyle) {\n if (state === states[0]) state = {\n ...state\n };\n state[props.forceStyle] = true;\n }\n if (!curStateRef.setState) {\n var reactSetState = states[1];\n curStateRef.setState = function(stateOrGetState) {\n var pendingUnmounted = curStateRef.initialStyleFrameUnmounted;\n curStateRef.initialStyleFrameUnmounted = void 0;\n reactSetState(function(previous) {\n var current = pendingUnmounted !== void 0 && previous.unmounted !== pendingUnmounted ? {\n ...previous,\n unmounted: pendingUnmounted\n } : previous;\n return typeof stateOrGetState === \"function\" ? stateOrGetState(current) : stateOrGetState;\n });\n };\n }\n var setState = curStateRef.setState;\n var isAnimated = willBeAnimated;\n if (import_constants.isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated) {\n isAnimated = false;\n curStateRef.willHydrate = true;\n }\n if (disabled !== state.disabled) {\n if (disabled) {\n Object.assign(state, import_defaultComponentState.defaultComponentStateMounted);\n }\n state.disabled = disabled;\n setState(function(_) {\n return {\n ...state\n };\n });\n }\n var groupName = props.group;\n if (!stateRef.current.baseSetStateShallow) {\n var r = stateRef.current;\n r.baseSetStateShallow = function(stateOrGetState) {\n setState(function(prev) {\n var next = typeof stateOrGetState === \"function\" ? stateOrGetState(prev) : stateOrGetState;\n var update = (0, import_is_equal_shallow.mergeIfNotShallowEqual)(prev, next);\n if (process.env.NODE_ENV === \"development\") {\n var dbg = r.__debug;\n if (dbg && update !== prev) {\n console.groupCollapsed(`setStateShallow CHANGE`, \"=>\", update);\n console.info(`previously`, prev);\n console.trace();\n console.groupEnd();\n }\n }\n return update;\n });\n };\n }\n if (process.env.NODE_ENV === \"development\") {\n ;\n stateRef.current.__debug = props.debug;\n }\n var setStateShallow = stateRef.current.baseSetStateShallow;\n if (process.env.NODE_ENV === \"development\" && globalThis.time) globalThis.time`state-useCreateShallowSetState`;\n var outProps = props;\n if (presenceState && isAnimated && isHydrated && staticConfig.variants) {\n if (process.env.NODE_ENV === \"development\" && props.debug === \"verbose\") {\n var _staticConfig_Component, _staticConfig_Component1;\n console.warn((0, import_formatDiagnostic.formatDiagnostic)(\"TAMAGUI_PRESENCE_STATE\", ((_staticConfig_Component = staticConfig.Component) === null || _staticConfig_Component === void 0 ? void 0 : _staticConfig_Component.displayName) || ((_staticConfig_Component1 = staticConfig.Component) === null || _staticConfig_Component1 === void 0 ? void 0 : _staticConfig_Component1.name) || \"TamaguiComponent\", \"AnimatePresence supplied lifecycle state to an animated component\", 'Remove debug=\"verbose\" after inspecting the animation state', \"presenceState\", presenceState));\n }\n var { custom } = presenceState;\n if ((0, import_isObj.isObj)(custom)) {\n outProps = {\n ...props,\n ...custom\n };\n }\n }\n var noClass = !import_constants.isWeb || !!props.forceStyle;\n if (!isHydrated) {\n noClass = false;\n } else {\n if (import_constants.isWeb && isHydrated) {\n var isAnimatedAndHydrated = !!((hasAnimationProp || curStateRef.hasAnimated) && useAnimations && !isHOC) && isHydrated;\n var isClassNameDisabled = !staticConfig.acceptsClassName && ((0, import_config.getSetting)(\"disableSSR\") || !state.unmounted);\n var isDisabledManually = disableClassName && !state.unmounted;\n if (\n // Only disable className for animation drivers that output inline styles (not css)\n isAnimatedAndHydrated && outputStyle !== \"css\" || isDisabledManually || isClassNameDisabled\n ) {\n noClass = true;\n if (process.env.NODE_ENV === \"development\" && props.debug === \"verbose\") {\n (0, import_log.log)(`avoiding className`, {\n isAnimatedAndHydrated,\n isDisabledManually,\n isClassNameDisabled\n });\n }\n }\n }\n }\n var result = {\n props: outProps,\n startedUnhydrated: curStateRef.startedUnhydrated,\n curStateRef,\n disabled,\n groupName,\n hasAnimationProp,\n hasEnterStyle: false,\n isAnimated,\n isExiting,\n isHydrated,\n presence,\n presenceState,\n setState,\n setStateShallow,\n noClass,\n state,\n stateRef,\n inputStyle,\n outputStyle,\n willBeAnimated,\n willBeAnimatedClient,\n platformPseudo: platformPseudoPossible,\n finalizeStyleFlags(hasEnterStyle, hasPlatformPseudo) {\n var platformPseudo = platformPseudoPossible && hasPlatformPseudo;\n var nextWillBeAnimatedClient = Boolean((hasAnimationProp || platformPseudo) && !isHOC && useAnimations || curStateRef.hasAnimated);\n var nextWillBeAnimated = !import_constants.isServer && nextWillBeAnimatedClient;\n if (nextWillBeAnimated && !curStateRef.hasAnimated) {\n curStateRef.hasAnimated = true;\n }\n if (!curStateRef.didFinalizeInitialStyleFrame) {\n curStateRef.didFinalizeInitialStyleFrame = true;\n var shouldEnter = !isHOC && (hasEnterStyle || isEntering || hasAnimationThatNeedsHydrate || disableClassName);\n var unmounted = shouldEnter ? hasEnterStyle || isEntering ? \"should-enter\" : true : false;\n state.unmounted = unmounted;\n curStateRef.initialStyleFrameUnmounted = unmounted || void 0;\n }\n result.hasEnterStyle = hasEnterStyle;\n result.platformPseudo = platformPseudo;\n result.willBeAnimatedClient = nextWillBeAnimatedClient;\n result.willBeAnimated = nextWillBeAnimated;\n result.isAnimated = import_constants.isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated ? false : nextWillBeAnimated;\n if (nextWillBeAnimated && !isHOC && props[\"animatePresence\"] !== false) {\n curStateRef.shouldRegisterPresence = true;\n }\n return result;\n }\n };\n return result;\n};\nfunction hasAnimatedStyleValue(style) {\n for (var k in style) {\n var val = style[k];\n if (val && (typeof val === \"undefined\" ? \"undefined\" : _type_of(val)) === \"object\" && \"_animation\" in val) {\n return true;\n }\n }\n return false;\n}\nvar isDisabled = function(props) {\n var _props_accessibilityState;\n return props.disabled || props.passThrough || ((_props_accessibilityState = props.accessibilityState) === null || _props_accessibilityState === void 0 ? void 0 : _props_accessibilityState.disabled) || props[\"aria-disabled\"] || props.accessibilityDisabled || false;\n};\n//# sourceMappingURL=useComponentState.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK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AAM,wBAAwB,QAAQ,8BAA8B,KAAK,IAAI,KAAK,IAAI,0BAA0B,aAAa,MAAM,oBAAoB,MAAM,yBAAyB;AACpQ"}
|
|
@@ -24,7 +24,7 @@ __export(useMedia_exports, {
|
|
|
24
24
|
_mediaListenerStats: () => _mediaListenerStats,
|
|
25
25
|
configureMedia: () => configureMedia,
|
|
26
26
|
getMediaState: () => getMediaState,
|
|
27
|
-
mediaKeyMatch: () => mediaKeyMatch,
|
|
27
|
+
mediaKeyMatch: () => import_mediaState2.mediaKeyMatch,
|
|
28
28
|
mediaKeyToQuery: () => mediaKeyToQuery,
|
|
29
29
|
setMediaShouldUpdate: () => setMediaShouldUpdate,
|
|
30
30
|
setupMediaListeners: () => setupMediaListeners,
|
|
@@ -40,6 +40,7 @@ var import_isOptimizedForFirstRender = require("./isOptimizedForFirstRender.cjs"
|
|
|
40
40
|
var import_matchMedia = require("../helpers/matchMedia.cjs");
|
|
41
41
|
var import_mediaObjectToString = require("../helpers/mediaObjectToString.cjs");
|
|
42
42
|
var import_mediaState = require("../helpers/mediaState.cjs");
|
|
43
|
+
var import_mediaState2 = require("../helpers/mediaState.cjs");
|
|
43
44
|
let initState;
|
|
44
45
|
const dispose = /* @__PURE__ */ new Set();
|
|
45
46
|
let mediaVersion = 0;
|
|
@@ -349,7 +350,7 @@ function getMediaState(mediaGroups, layout) {
|
|
|
349
350
|
let res;
|
|
350
351
|
try {
|
|
351
352
|
res = Object.fromEntries([...mediaGroups].map((mediaKey) => {
|
|
352
|
-
return [mediaKey, mediaKeyMatch(mediaKey, layout)];
|
|
353
|
+
return [mediaKey, (0, import_mediaState.mediaKeyMatch)(mediaKey, layout)];
|
|
353
354
|
}));
|
|
354
355
|
} finally {
|
|
355
356
|
disableMediaTouch = false;
|
|
@@ -360,16 +361,3 @@ const cachedMediaKeyToQuery = {};
|
|
|
360
361
|
function mediaKeyToQuery(key) {
|
|
361
362
|
return cachedMediaKeyToQuery[key] || (cachedMediaKeyToQuery[key] = (0, import_mediaObjectToString.mediaObjectToString)(import_mediaState.mediaQueryConfig[key]));
|
|
362
363
|
}
|
|
363
|
-
function mediaKeyMatch(key, dimensions) {
|
|
364
|
-
const mediaQueries = import_mediaState.mediaQueryConfig[key];
|
|
365
|
-
for (const query in mediaQueries) {
|
|
366
|
-
const expectedVal = +mediaQueries[query];
|
|
367
|
-
const isMax = query.startsWith("max");
|
|
368
|
-
const isWidth = query.endsWith("Width");
|
|
369
|
-
const givenVal = dimensions[isWidth ? "width" : "height"];
|
|
370
|
-
if (isMax ? givenVal >= expectedVal : givenVal <= expectedVal) {
|
|
371
|
-
return false;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return true;
|
|
375
|
-
}
|
|
@@ -26,7 +26,7 @@ __export(useMedia_exports, {
|
|
|
26
26
|
_mediaListenerStats: () => _mediaListenerStats,
|
|
27
27
|
configureMedia: () => configureMedia,
|
|
28
28
|
getMediaState: () => getMediaState,
|
|
29
|
-
mediaKeyMatch: () => mediaKeyMatch,
|
|
29
|
+
mediaKeyMatch: () => import_mediaState2.mediaKeyMatch,
|
|
30
30
|
mediaKeyToQuery: () => mediaKeyToQuery,
|
|
31
31
|
setMediaShouldUpdate: () => setMediaShouldUpdate,
|
|
32
32
|
setupMediaListeners: () => setupMediaListeners,
|
|
@@ -42,6 +42,7 @@ var import_isOptimizedForFirstRender = require("./isOptimizedForFirstRender.nati
|
|
|
42
42
|
var import_matchMedia = require("../helpers/matchMedia.native.js");
|
|
43
43
|
var import_mediaObjectToString = require("../helpers/mediaObjectToString.native.js");
|
|
44
44
|
var import_mediaState = require("../helpers/mediaState.native.js");
|
|
45
|
+
var import_mediaState2 = require("../helpers/mediaState.native.js");
|
|
45
46
|
var initState;
|
|
46
47
|
var dispose = /* @__PURE__ */ new Set();
|
|
47
48
|
var mediaVersion = 0;
|
|
@@ -505,7 +506,7 @@ function getMediaState(mediaGroups, layout) {
|
|
|
505
506
|
var res;
|
|
506
507
|
try {
|
|
507
508
|
res = Object.fromEntries([...mediaGroups].map(function(mediaKey) {
|
|
508
|
-
return [mediaKey, mediaKeyMatch(mediaKey, layout)];
|
|
509
|
+
return [mediaKey, (0, import_mediaState.mediaKeyMatch)(mediaKey, layout)];
|
|
509
510
|
}));
|
|
510
511
|
} finally {
|
|
511
512
|
disableMediaTouch = false;
|
|
@@ -516,16 +517,3 @@ var cachedMediaKeyToQuery = {};
|
|
|
516
517
|
function mediaKeyToQuery(key) {
|
|
517
518
|
return cachedMediaKeyToQuery[key] || (cachedMediaKeyToQuery[key] = (0, import_mediaObjectToString.mediaObjectToString)(import_mediaState.mediaQueryConfig[key]));
|
|
518
519
|
}
|
|
519
|
-
function mediaKeyMatch(key, dimensions) {
|
|
520
|
-
var mediaQueries = import_mediaState.mediaQueryConfig[key];
|
|
521
|
-
for (var query in mediaQueries) {
|
|
522
|
-
var expectedVal = +mediaQueries[query];
|
|
523
|
-
var isMax = query.startsWith("max");
|
|
524
|
-
var isWidth = query.endsWith("Width");
|
|
525
|
-
var givenVal = dimensions[isWidth ? "width" : "height"];
|
|
526
|
-
if (isMax ? givenVal >= expectedVal : givenVal <= expectedVal) {
|
|
527
|
-
return false;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
return true;
|
|
531
|
-
}
|