react-native-screen-transitions 3.4.0-alpha.3 → 3.4.0-alpha.4
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/lib/commonjs/component-stack/components/component-screen.js +1 -1
- package/lib/commonjs/component-stack/components/component-screen.js.map +1 -1
- package/lib/commonjs/shared/animation/snap-to.js +6 -3
- package/lib/commonjs/shared/animation/snap-to.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +47 -4
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +2 -2
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/index.js +3 -16
- package/lib/commonjs/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/commonjs/shared/components/native-screen.js +3 -3
- package/lib/commonjs/shared/components/native-screen.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js +1 -1
- package/lib/commonjs/shared/components/screen-container/deferred-visibility-host.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js +18 -14
- package/lib/commonjs/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +8 -5
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/content.js +12 -28
- package/lib/commonjs/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js +17 -4
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js +4 -2
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/index.js +6 -1
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-close-transition/index.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-open-transition.js +13 -11
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
- package/lib/commonjs/shared/components/screen-lifecycle/index.js +5 -3
- package/lib/commonjs/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/commonjs/shared/configs/presets.js +3 -4
- package/lib/commonjs/shared/configs/presets.js.map +1 -1
- package/lib/commonjs/shared/constants.js +16 -2
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js +2 -2
- package/lib/commonjs/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +12 -9
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js +5 -5
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/register-direction-claims.js +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/register-direction-claims.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/use-build-gestures.js +1 -1
- package/lib/commonjs/shared/providers/gestures/use-build-gestures.js.map +1 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js +5 -5
- package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/has-transitions-enabled.js +17 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/has-transitions-enabled.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js +72 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +22 -108
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +42 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js +17 -3
- package/lib/commonjs/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles.provider.js +4 -1
- package/lib/commonjs/shared/providers/screen/styles.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js +1 -1
- package/lib/commonjs/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-processed-routes.js +1 -1
- package/lib/commonjs/shared/providers/stack/helpers/use-processed-routes.js.map +1 -1
- package/lib/commonjs/shared/stores/animation.store.js +12 -40
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/stores/gesture.store.js +13 -33
- package/lib/commonjs/shared/stores/gesture.store.js.map +1 -1
- package/lib/commonjs/shared/stores/system.store.js +31 -0
- package/lib/commonjs/shared/stores/system.store.js.map +1 -0
- package/lib/commonjs/shared/types/bounds.types.js +1 -3
- package/lib/commonjs/shared/types/bounds.types.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js +2 -2
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js +23 -50
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/build.js +96 -355
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.js +15 -101
- package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/math.js +154 -0
- package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/types.js +1 -3
- package/lib/commonjs/shared/utils/bounds/zoom/types.js.map +1 -1
- package/lib/commonjs/shared/utils/create-store.js +54 -0
- package/lib/commonjs/shared/utils/create-store.js.map +1 -0
- package/lib/module/component-stack/components/component-screen.js +1 -1
- package/lib/module/component-stack/components/component-screen.js.map +1 -1
- package/lib/module/shared/animation/snap-to.js +6 -3
- package/lib/module/shared/animation/snap-to.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js +48 -5
- package/lib/module/shared/components/create-boundary-component/hooks/use-group-active-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js +2 -2
- package/lib/module/shared/components/create-boundary-component/hooks/use-initial-layout-handler.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/index.js +3 -16
- package/lib/module/shared/components/create-boundary-component/index.js.map +1 -1
- package/lib/module/shared/components/native-screen.js +3 -3
- package/lib/module/shared/components/native-screen.js.map +1 -1
- package/lib/module/shared/components/screen-container/deferred-visibility-host.js +2 -2
- package/lib/module/shared/components/screen-container/deferred-visibility-host.js.map +1 -1
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js +18 -14
- package/lib/module/shared/components/screen-container/hooks/use-content-layout.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js +8 -5
- package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/content.js +13 -29
- package/lib/module/shared/components/screen-container/layers/content.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js +19 -6
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js +4 -2
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/index.js +6 -1
- package/lib/module/shared/components/screen-lifecycle/hooks/use-close-transition/index.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/hooks/use-open-transition.js +13 -11
- package/lib/module/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
- package/lib/module/shared/components/screen-lifecycle/index.js +5 -3
- package/lib/module/shared/components/screen-lifecycle/index.js.map +1 -1
- package/lib/module/shared/configs/presets.js +3 -4
- package/lib/module/shared/configs/presets.js.map +1 -1
- package/lib/module/shared/constants.js +16 -2
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/animation/use-associated-style.js +2 -2
- package/lib/module/shared/hooks/animation/use-associated-style.js.map +1 -1
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js +12 -9
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js +5 -5
- package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -1
- package/lib/module/shared/providers/gestures/helpers/register-direction-claims.js +1 -1
- package/lib/module/shared/providers/gestures/helpers/register-direction-claims.js.map +1 -1
- package/lib/module/shared/providers/gestures/use-build-gestures.js +1 -1
- package/lib/module/shared/providers/gestures/use-build-gestures.js.map +1 -1
- package/lib/module/shared/providers/register-bounds.provider.js +5 -5
- package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/has-transitions-enabled.js +12 -0
- package/lib/module/shared/providers/screen/animation/helpers/has-transitions-enabled.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js +67 -0
- package/lib/module/shared/providers/screen/animation/helpers/hydrate-transition-state.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +22 -108
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +37 -0
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -0
- package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js +15 -2
- package/lib/module/shared/providers/screen/helpers/resolve-interpolated-style-output.js.map +1 -1
- package/lib/module/shared/providers/screen/styles.provider.js +5 -2
- package/lib/module/shared/providers/screen/styles.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/use-processed-routes.js +1 -1
- package/lib/module/shared/providers/stack/helpers/use-processed-routes.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +12 -40
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/stores/gesture.store.js +13 -33
- package/lib/module/shared/stores/gesture.store.js.map +1 -1
- package/lib/module/shared/stores/system.store.js +27 -0
- package/lib/module/shared/stores/system.store.js.map +1 -0
- package/lib/module/shared/types/bounds.types.js +9 -1
- package/lib/module/shared/types/bounds.types.js.map +1 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js +2 -2
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js +23 -50
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/build.js +89 -348
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/config.js +12 -98
- package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/math.js +136 -0
- package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/types.js +1 -1
- package/lib/module/shared/utils/bounds/zoom/types.js.map +1 -1
- package/lib/module/shared/utils/create-store.js +50 -0
- package/lib/module/shared/utils/create-store.js.map +1 -0
- package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts +1 -2
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-group-active-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-initial-layout-handler.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/native-screen.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/hooks/use-content-layout.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/backdrop.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/content.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition/index.d.ts +2 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-close-transition/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-open-transition.d.ts +2 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-open-transition.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/index.d.ts.map +1 -1
- package/lib/typescript/shared/configs/presets.d.ts.map +1 -1
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/animation/use-associated-style.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +3 -3
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/handlers/use-handlers.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/helpers/gesture-snap-points.d.ts +2 -2
- package/lib/typescript/shared/providers/gestures/helpers/gesture-snap-points.d.ts.map +1 -1
- package/lib/typescript/shared/providers/gestures/use-build-gestures.d.ts.map +1 -1
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/has-transitions-enabled.d.ts +8 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/has-transitions-enabled.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts +22 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts +4 -2
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +21 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts +6 -2
- package/lib/typescript/shared/providers/screen/helpers/resolve-interpolated-style-output.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +10 -17
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/gesture.store.d.ts +24 -14
- package/lib/typescript/shared/stores/gesture.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/system.store.d.ts +27 -0
- package/lib/typescript/shared/stores/system.store.d.ts.map +1 -0
- package/lib/typescript/shared/types/animation.types.d.ts +38 -9
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +14 -42
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +2 -2
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +11 -0
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +3 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/index.d.ts +2 -3
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts +2 -3
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +15 -41
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +44 -0
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts +8 -13
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/create-store.d.ts +14 -0
- package/lib/typescript/shared/utils/create-store.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/component-stack/components/component-screen.tsx +1 -1
- package/src/shared/animation/snap-to.ts +10 -4
- package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +1 -1
- package/src/shared/components/create-boundary-component/hooks/use-group-active-measurement.ts +82 -10
- package/src/shared/components/create-boundary-component/hooks/use-initial-layout-handler.ts +2 -5
- package/src/shared/components/create-boundary-component/index.tsx +3 -22
- package/src/shared/components/native-screen.tsx +3 -9
- package/src/shared/components/screen-container/deferred-visibility-host.tsx +2 -2
- package/src/shared/components/screen-container/hooks/use-content-layout.ts +42 -43
- package/src/shared/components/screen-container/layers/backdrop.tsx +12 -6
- package/src/shared/components/screen-container/layers/content.tsx +17 -49
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +26 -5
- package/src/shared/components/screen-lifecycle/hooks/use-close-transition/helpers/reset-stores-for-screen.ts +4 -2
- package/src/shared/components/screen-lifecycle/hooks/use-close-transition/index.ts +8 -0
- package/src/shared/components/screen-lifecycle/hooks/use-open-transition.ts +21 -10
- package/src/shared/components/screen-lifecycle/index.tsx +8 -2
- package/src/shared/configs/presets.ts +8 -7
- package/src/shared/constants.ts +14 -0
- package/src/shared/hooks/animation/use-associated-style.ts +2 -8
- package/src/shared/index.ts +2 -0
- package/src/shared/providers/gestures/handlers/use-handlers.ts +13 -10
- package/src/shared/providers/gestures/helpers/gesture-snap-points.ts +12 -10
- package/src/shared/providers/gestures/helpers/register-direction-claims.ts +1 -1
- package/src/shared/providers/gestures/use-build-gestures.ts +1 -3
- package/src/shared/providers/register-bounds.provider.tsx +5 -11
- package/src/shared/providers/screen/animation/helpers/has-transitions-enabled.ts +14 -0
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state.ts +108 -0
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +37 -199
- package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +77 -0
- package/src/shared/providers/screen/helpers/resolve-interpolated-style-output.ts +24 -4
- package/src/shared/providers/screen/styles.provider.tsx +5 -1
- package/src/shared/providers/stack/direct.provider.tsx +1 -1
- package/src/shared/providers/stack/helpers/use-processed-routes.ts +1 -1
- package/src/shared/stores/animation.store.ts +11 -61
- package/src/shared/stores/gesture.store.ts +25 -45
- package/src/shared/stores/system.store.ts +44 -0
- package/src/shared/types/animation.types.ts +41 -9
- package/src/shared/types/bounds.types.ts +25 -25
- package/src/shared/types/index.ts +2 -0
- package/src/shared/types/screen.types.ts +12 -0
- package/src/shared/utils/animation/animate-to-progress.ts +4 -2
- package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +0 -1
- package/src/shared/utils/bounds/index.ts +26 -75
- package/src/shared/utils/bounds/zoom/build.ts +167 -494
- package/src/shared/utils/bounds/zoom/config.ts +14 -164
- package/src/shared/utils/bounds/zoom/math.ts +193 -0
- package/src/shared/utils/bounds/zoom/types.ts +15 -17
- package/src/shared/utils/create-store.ts +62 -0
- package/lib/commonjs/shared/utils/bounds/types/frame-props.js +0 -6
- package/lib/commonjs/shared/utils/bounds/types/frame-props.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/zoom/accessor.js +0 -54
- package/lib/commonjs/shared/utils/bounds/zoom/accessor.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/zoom/index.js +0 -20
- package/lib/commonjs/shared/utils/bounds/zoom/index.js.map +0 -1
- package/lib/module/shared/utils/bounds/types/frame-props.js +0 -4
- package/lib/module/shared/utils/bounds/types/frame-props.js.map +0 -1
- package/lib/module/shared/utils/bounds/zoom/accessor.js +0 -49
- package/lib/module/shared/utils/bounds/zoom/accessor.js.map +0 -1
- package/lib/module/shared/utils/bounds/zoom/index.js +0 -5
- package/lib/module/shared/utils/bounds/zoom/index.js.map +0 -1
- package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts +0 -5
- package/lib/typescript/shared/utils/bounds/types/frame-props.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts +0 -17
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/zoom/index.d.ts +0 -3
- package/lib/typescript/shared/utils/bounds/zoom/index.d.ts.map +0 -1
- package/src/shared/utils/bounds/types/frame-props.ts +0 -5
- package/src/shared/utils/bounds/zoom/accessor.ts +0 -69
- package/src/shared/utils/bounds/zoom/index.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { interpolate
|
|
1
|
+
import { interpolate } from "react-native-reanimated";
|
|
2
2
|
import {
|
|
3
3
|
EPSILON,
|
|
4
4
|
HIDDEN_STYLE,
|
|
@@ -10,246 +10,56 @@ import {
|
|
|
10
10
|
BoundStore,
|
|
11
11
|
type ResolvedTransitionPair,
|
|
12
12
|
} from "../../../stores/bounds";
|
|
13
|
-
import type {
|
|
14
|
-
ScreenStyleInterpolator,
|
|
15
|
-
TransitionInterpolatedStyle,
|
|
16
|
-
} from "../../../types/animation.types";
|
|
17
|
-
import type { BoundsNavigationZoomOptions } from "../../../types/bounds.types";
|
|
13
|
+
import type { TransitionInterpolatedStyle } from "../../../types/animation.types";
|
|
18
14
|
import type { Layout } from "../../../types/screen.types";
|
|
15
|
+
import { computeBoundStyles } from "../helpers/compute-bounds-styles";
|
|
19
16
|
import type { BoundsOptions } from "../types/options";
|
|
20
17
|
import {
|
|
21
|
-
|
|
22
|
-
resolveZoomConfig,
|
|
18
|
+
getZoomAnchor,
|
|
23
19
|
toNumber,
|
|
20
|
+
ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
|
|
21
|
+
ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
|
|
22
|
+
ZOOM_DRAG_RESISTANCE,
|
|
23
|
+
ZOOM_MASK_OUTSET,
|
|
24
|
+
ZOOM_SHARED_OPTIONS,
|
|
24
25
|
} from "./config";
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
import {
|
|
27
|
+
combineScales,
|
|
28
|
+
composeCompensatedTranslation,
|
|
29
|
+
computeCenterScaleShift,
|
|
30
|
+
normalizedToTranslation,
|
|
31
|
+
resolveDirectionalDragScale,
|
|
32
|
+
} from "./math";
|
|
33
|
+
import type { BuildZoomStylesParams, ZoomInterpolatedStyle } from "./types";
|
|
28
34
|
|
|
29
35
|
const IDENTITY_DRAG_SCALE_OUTPUT = [1, 1] as const;
|
|
30
|
-
type ZoomMask = NonNullable<BoundsNavigationZoomOptions["mask"]>;
|
|
31
|
-
type ZoomRadiusValue = Exclude<ZoomMask["borderRadius"], undefined>;
|
|
32
|
-
|
|
33
|
-
const clamp = (value: number, min: number, max: number): number => {
|
|
34
|
-
"worklet";
|
|
35
|
-
const lower = min < max ? min : max;
|
|
36
|
-
const upper = max > min ? max : min;
|
|
37
|
-
|
|
38
|
-
if (value < lower) return lower;
|
|
39
|
-
if (value > upper) return upper;
|
|
40
|
-
|
|
41
|
-
return value;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const clamp01 = (value: number): number => {
|
|
45
|
-
"worklet";
|
|
46
|
-
return clamp(value, 0, 1);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const lerp = (from: number, to: number, t: number): number => {
|
|
50
|
-
"worklet";
|
|
51
|
-
return from + (to - from) * t;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const safeDivide = (
|
|
55
|
-
numerator: number,
|
|
56
|
-
denominator: number,
|
|
57
|
-
fallback = 0,
|
|
58
|
-
): number => {
|
|
59
|
-
"worklet";
|
|
60
|
-
if (denominator === 0) return fallback;
|
|
61
|
-
return numerator / denominator;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const inverseLerp = (value: number, inMin: number, inMax: number): number => {
|
|
65
|
-
"worklet";
|
|
66
|
-
return safeDivide(value - inMin, inMax - inMin, 0);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const mapRangeClamped = (
|
|
70
|
-
value: number,
|
|
71
|
-
inMin: number,
|
|
72
|
-
inMax: number,
|
|
73
|
-
outMin: number,
|
|
74
|
-
outMax: number,
|
|
75
|
-
): number => {
|
|
76
|
-
"worklet";
|
|
77
|
-
const t = clamp01(inverseLerp(value, inMin, inMax));
|
|
78
|
-
return lerp(outMin, outMax, t);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const applyPowerCurve = (value: number, exponent: number): number => {
|
|
82
|
-
"worklet";
|
|
83
|
-
const safeExponent = exponent > 0 ? exponent : 1;
|
|
84
|
-
const magnitude = Math.abs(value) ** safeExponent;
|
|
85
|
-
return value < 0 ? -magnitude : magnitude;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const normalizedToTranslation = ({
|
|
89
|
-
normalized,
|
|
90
|
-
dimension,
|
|
91
|
-
resistance,
|
|
92
|
-
}: {
|
|
93
|
-
normalized: number;
|
|
94
|
-
dimension: number;
|
|
95
|
-
resistance: number;
|
|
96
|
-
}): number => {
|
|
97
|
-
"worklet";
|
|
98
|
-
const distance = Math.max(0, dimension) * resistance;
|
|
99
|
-
return mapRangeClamped(normalized, -1, 1, -distance, distance);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const normalizedToScale = ({
|
|
103
|
-
normalized,
|
|
104
|
-
outputRange,
|
|
105
|
-
exponent = 1,
|
|
106
|
-
positiveOnly = true,
|
|
107
|
-
}: {
|
|
108
|
-
normalized: number;
|
|
109
|
-
outputRange: readonly [number, number];
|
|
110
|
-
exponent?: number;
|
|
111
|
-
positiveOnly?: boolean;
|
|
112
|
-
}): number => {
|
|
113
|
-
"worklet";
|
|
114
|
-
const [outputStart, outputEnd] = outputRange;
|
|
115
|
-
const raw = positiveOnly
|
|
116
|
-
? mapRangeClamped(normalized, 0, 1, outputStart, outputEnd)
|
|
117
|
-
: mapRangeClamped(normalized, -1, 1, outputStart, outputEnd);
|
|
118
|
-
|
|
119
|
-
return applyPowerCurve(raw, exponent);
|
|
120
|
-
};
|
|
121
36
|
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
scaleY: number,
|
|
125
|
-
mode: CombinedScaleMode = "multiply",
|
|
37
|
+
const getSourceBorderRadius = (
|
|
38
|
+
resolvedPair: ResolvedTransitionPair,
|
|
126
39
|
): number => {
|
|
127
40
|
"worklet";
|
|
128
41
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
case "max":
|
|
133
|
-
return Math.max(scaleX, scaleY);
|
|
134
|
-
case "min":
|
|
135
|
-
return Math.min(scaleX, scaleY);
|
|
136
|
-
default:
|
|
137
|
-
return scaleX * scaleY;
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const computeCenterScaleShift = ({
|
|
142
|
-
center,
|
|
143
|
-
containerCenter,
|
|
144
|
-
scale,
|
|
145
|
-
}: {
|
|
146
|
-
center: number;
|
|
147
|
-
containerCenter: number;
|
|
148
|
-
scale: number;
|
|
149
|
-
}): number => {
|
|
150
|
-
"worklet";
|
|
151
|
-
return (center - containerCenter) * (scale - 1);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const compensateTranslationForParentScale = ({
|
|
155
|
-
translation,
|
|
156
|
-
parentScale,
|
|
157
|
-
epsilon,
|
|
158
|
-
}: {
|
|
159
|
-
translation: number;
|
|
160
|
-
parentScale: number;
|
|
161
|
-
epsilon: number;
|
|
162
|
-
}): number => {
|
|
163
|
-
"worklet";
|
|
164
|
-
const safeParentScale = Math.max(parentScale, epsilon);
|
|
165
|
-
return safeDivide(translation, safeParentScale, translation);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
const composeCompensatedTranslation = ({
|
|
169
|
-
gesture,
|
|
170
|
-
parentScale,
|
|
171
|
-
centerShift = 0,
|
|
172
|
-
epsilon,
|
|
173
|
-
}: {
|
|
174
|
-
gesture: number;
|
|
175
|
-
parentScale: number;
|
|
176
|
-
centerShift?: number;
|
|
177
|
-
epsilon: number;
|
|
178
|
-
}): number => {
|
|
179
|
-
"worklet";
|
|
180
|
-
return (
|
|
181
|
-
compensateTranslationForParentScale({
|
|
182
|
-
translation: gesture,
|
|
183
|
-
parentScale,
|
|
184
|
-
epsilon,
|
|
185
|
-
}) + centerShift
|
|
186
|
-
);
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const resolveDirectionalDragScale = ({
|
|
190
|
-
normalized,
|
|
191
|
-
dismissDirection,
|
|
192
|
-
shrinkMin,
|
|
193
|
-
growMax,
|
|
194
|
-
exponent,
|
|
195
|
-
}: {
|
|
196
|
-
normalized: number;
|
|
197
|
-
dismissDirection: "positive" | "negative";
|
|
198
|
-
shrinkMin: number;
|
|
199
|
-
growMax: number;
|
|
200
|
-
exponent: number;
|
|
201
|
-
}) => {
|
|
202
|
-
"worklet";
|
|
203
|
-
|
|
204
|
-
const dismissalRelative =
|
|
205
|
-
dismissDirection === "negative" ? -normalized : normalized;
|
|
206
|
-
|
|
207
|
-
if (dismissalRelative >= 0) {
|
|
208
|
-
return normalizedToScale({
|
|
209
|
-
normalized: dismissalRelative,
|
|
210
|
-
outputRange: [1, shrinkMin],
|
|
211
|
-
exponent,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const oppositeDrag = Math.min(1, Math.abs(dismissalRelative));
|
|
216
|
-
return interpolate(oppositeDrag, [0, 1], [1, growMax], "clamp");
|
|
42
|
+
return typeof resolvedPair.sourceStyles?.borderRadius === "number"
|
|
43
|
+
? resolvedPair.sourceStyles.borderRadius
|
|
44
|
+
: 0;
|
|
217
45
|
};
|
|
218
46
|
|
|
219
47
|
const getZoomContentTarget = ({
|
|
220
48
|
explicitTarget,
|
|
221
|
-
resolvedTag,
|
|
222
|
-
currentRouteKey,
|
|
223
|
-
previousRouteKey,
|
|
224
|
-
nextRouteKey,
|
|
225
|
-
entering,
|
|
226
49
|
screenLayout,
|
|
227
50
|
anchor,
|
|
228
51
|
resolvedPair,
|
|
229
52
|
}: {
|
|
230
53
|
explicitTarget: BoundsOptions["target"] | undefined;
|
|
231
|
-
resolvedTag: string;
|
|
232
|
-
currentRouteKey?: string;
|
|
233
|
-
previousRouteKey?: string;
|
|
234
|
-
nextRouteKey?: string;
|
|
235
|
-
entering: boolean;
|
|
236
54
|
screenLayout: Layout;
|
|
237
55
|
anchor: BoundsOptions["anchor"] | undefined;
|
|
238
|
-
resolvedPair
|
|
56
|
+
resolvedPair: ResolvedTransitionPair;
|
|
239
57
|
}) => {
|
|
240
58
|
"worklet";
|
|
241
|
-
if (explicitTarget !== undefined) return explicitTarget;
|
|
242
59
|
|
|
243
|
-
|
|
244
|
-
resolvedPair ??
|
|
245
|
-
BoundStore.resolveTransitionPair(resolvedTag, {
|
|
246
|
-
currentScreenKey: currentRouteKey,
|
|
247
|
-
previousScreenKey: previousRouteKey,
|
|
248
|
-
nextScreenKey: nextRouteKey,
|
|
249
|
-
entering,
|
|
250
|
-
});
|
|
60
|
+
if (explicitTarget) return explicitTarget;
|
|
251
61
|
|
|
252
|
-
const sourceBounds =
|
|
62
|
+
const sourceBounds = resolvedPair.sourceBounds;
|
|
253
63
|
const screenWidth = screenLayout.width;
|
|
254
64
|
|
|
255
65
|
if (!sourceBounds || sourceBounds.width <= 0 || screenWidth <= 0) {
|
|
@@ -257,45 +67,14 @@ const getZoomContentTarget = ({
|
|
|
257
67
|
}
|
|
258
68
|
|
|
259
69
|
const height = (sourceBounds.height / sourceBounds.width) * screenWidth;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
case "trailing":
|
|
269
|
-
case "bottomTrailing":
|
|
270
|
-
horizontalAnchor = "trailing";
|
|
271
|
-
break;
|
|
272
|
-
default:
|
|
273
|
-
horizontalAnchor = "center";
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
let verticalAnchor: "top" | "center" | "bottom";
|
|
278
|
-
switch (anchor) {
|
|
279
|
-
case "topLeading":
|
|
280
|
-
case "top":
|
|
281
|
-
case "topTrailing":
|
|
282
|
-
verticalAnchor = "top";
|
|
283
|
-
break;
|
|
284
|
-
case "bottomLeading":
|
|
285
|
-
case "bottom":
|
|
286
|
-
case "bottomTrailing":
|
|
287
|
-
verticalAnchor = "bottom";
|
|
288
|
-
break;
|
|
289
|
-
default:
|
|
290
|
-
verticalAnchor = "center";
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
const x =
|
|
294
|
-
horizontalAnchor === "leading"
|
|
295
|
-
? 0
|
|
296
|
-
: horizontalAnchor === "trailing"
|
|
297
|
-
? screenLayout.width - screenWidth
|
|
298
|
-
: (screenLayout.width - screenWidth) / 2;
|
|
70
|
+
const verticalAnchor =
|
|
71
|
+
anchor === "bottomLeading" ||
|
|
72
|
+
anchor === "bottom" ||
|
|
73
|
+
anchor === "bottomTrailing"
|
|
74
|
+
? "bottom"
|
|
75
|
+
: anchor === "center" || anchor === "leading" || anchor === "trailing"
|
|
76
|
+
? "center"
|
|
77
|
+
: "top";
|
|
299
78
|
const y =
|
|
300
79
|
verticalAnchor === "top"
|
|
301
80
|
? 0
|
|
@@ -304,158 +83,27 @@ const getZoomContentTarget = ({
|
|
|
304
83
|
: (screenLayout.height - height) / 2;
|
|
305
84
|
|
|
306
85
|
return {
|
|
307
|
-
x,
|
|
86
|
+
x: 0,
|
|
308
87
|
y,
|
|
309
|
-
pageX:
|
|
88
|
+
pageX: 0,
|
|
310
89
|
pageY: y,
|
|
311
90
|
width: screenWidth,
|
|
312
91
|
height,
|
|
313
92
|
};
|
|
314
93
|
};
|
|
315
94
|
|
|
316
|
-
const getStyleRadius = (
|
|
317
|
-
styles: StyleProps | null,
|
|
318
|
-
property:
|
|
319
|
-
| "borderRadius"
|
|
320
|
-
| "borderTopLeftRadius"
|
|
321
|
-
| "borderTopRightRadius"
|
|
322
|
-
| "borderBottomLeftRadius"
|
|
323
|
-
| "borderBottomRightRadius",
|
|
324
|
-
): number | undefined => {
|
|
325
|
-
"worklet";
|
|
326
|
-
if (!styles || typeof styles !== "object") return undefined;
|
|
327
|
-
|
|
328
|
-
const styleRecord = styles as Record<string, unknown>;
|
|
329
|
-
const direct = styleRecord[property];
|
|
330
|
-
if (typeof direct === "number") return direct;
|
|
331
|
-
|
|
332
|
-
if (property !== "borderRadius") {
|
|
333
|
-
const fallback = styleRecord.borderRadius;
|
|
334
|
-
if (typeof fallback === "number") return fallback;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
return undefined;
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
const resolveRadiusRange = ({
|
|
341
|
-
value,
|
|
342
|
-
progress,
|
|
343
|
-
sourceRadius,
|
|
344
|
-
destinationRadius,
|
|
345
|
-
fallback,
|
|
346
|
-
}: {
|
|
347
|
-
value: ZoomRadiusValue | undefined;
|
|
348
|
-
progress: number;
|
|
349
|
-
sourceRadius?: number;
|
|
350
|
-
destinationRadius?: number;
|
|
351
|
-
fallback: number;
|
|
352
|
-
}): number => {
|
|
353
|
-
"worklet";
|
|
354
|
-
|
|
355
|
-
if (typeof value === "number") return value;
|
|
356
|
-
|
|
357
|
-
if (value === "auto") {
|
|
358
|
-
const from = sourceRadius ?? fallback;
|
|
359
|
-
const to = destinationRadius ?? fallback;
|
|
360
|
-
return interpolate(progress, [0, 1], [from, to], "clamp");
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
if (value && typeof value === "object") {
|
|
364
|
-
const from = typeof value.from === "number" ? value.from : fallback;
|
|
365
|
-
const to = typeof value.to === "number" ? value.to : fallback;
|
|
366
|
-
return interpolate(progress, [0, 1], [from, to], "clamp");
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
const from = sourceRadius ?? fallback;
|
|
370
|
-
const to = destinationRadius ?? fallback;
|
|
371
|
-
return interpolate(progress, [0, 1], [from, to], "clamp");
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
const resolveMaskRadii = ({
|
|
375
|
-
progress,
|
|
376
|
-
zoomOptions,
|
|
377
|
-
resolvedPair,
|
|
378
|
-
}: {
|
|
379
|
-
progress: number;
|
|
380
|
-
zoomOptions: ResolvedZoomOptions;
|
|
381
|
-
resolvedPair: ResolvedTransitionPair;
|
|
382
|
-
}) => {
|
|
383
|
-
"worklet";
|
|
384
|
-
const sourceStyles = resolvedPair.sourceStyles;
|
|
385
|
-
const destinationStyles = resolvedPair.destinationStyles;
|
|
386
|
-
|
|
387
|
-
const defaultRadius = resolveRadiusRange({
|
|
388
|
-
value: zoomOptions.mask.borderRadius,
|
|
389
|
-
progress,
|
|
390
|
-
sourceRadius: getStyleRadius(sourceStyles, "borderRadius"),
|
|
391
|
-
destinationRadius: getStyleRadius(destinationStyles, "borderRadius"),
|
|
392
|
-
fallback: 12,
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
const topLeftValue =
|
|
396
|
-
zoomOptions.mask.borderTopLeftRadius ?? zoomOptions.mask.borderRadius;
|
|
397
|
-
const topRightValue =
|
|
398
|
-
zoomOptions.mask.borderTopRightRadius ?? zoomOptions.mask.borderRadius;
|
|
399
|
-
const bottomLeftValue =
|
|
400
|
-
zoomOptions.mask.borderBottomLeftRadius ?? zoomOptions.mask.borderRadius;
|
|
401
|
-
const bottomRightValue =
|
|
402
|
-
zoomOptions.mask.borderBottomRightRadius ?? zoomOptions.mask.borderRadius;
|
|
403
|
-
|
|
404
|
-
return {
|
|
405
|
-
borderRadius: defaultRadius,
|
|
406
|
-
borderTopLeftRadius: resolveRadiusRange({
|
|
407
|
-
value: topLeftValue,
|
|
408
|
-
progress,
|
|
409
|
-
sourceRadius: getStyleRadius(sourceStyles, "borderTopLeftRadius"),
|
|
410
|
-
destinationRadius: getStyleRadius(
|
|
411
|
-
destinationStyles,
|
|
412
|
-
"borderTopLeftRadius",
|
|
413
|
-
),
|
|
414
|
-
fallback: defaultRadius,
|
|
415
|
-
}),
|
|
416
|
-
borderTopRightRadius: resolveRadiusRange({
|
|
417
|
-
value: topRightValue,
|
|
418
|
-
progress,
|
|
419
|
-
sourceRadius: getStyleRadius(sourceStyles, "borderTopRightRadius"),
|
|
420
|
-
destinationRadius: getStyleRadius(
|
|
421
|
-
destinationStyles,
|
|
422
|
-
"borderTopRightRadius",
|
|
423
|
-
),
|
|
424
|
-
fallback: defaultRadius,
|
|
425
|
-
}),
|
|
426
|
-
borderBottomLeftRadius: resolveRadiusRange({
|
|
427
|
-
value: bottomLeftValue,
|
|
428
|
-
progress,
|
|
429
|
-
sourceRadius: getStyleRadius(sourceStyles, "borderBottomLeftRadius"),
|
|
430
|
-
destinationRadius: getStyleRadius(
|
|
431
|
-
destinationStyles,
|
|
432
|
-
"borderBottomLeftRadius",
|
|
433
|
-
),
|
|
434
|
-
fallback: defaultRadius,
|
|
435
|
-
}),
|
|
436
|
-
borderBottomRightRadius: resolveRadiusRange({
|
|
437
|
-
value: bottomRightValue,
|
|
438
|
-
progress,
|
|
439
|
-
sourceRadius: getStyleRadius(sourceStyles, "borderBottomRightRadius"),
|
|
440
|
-
destinationRadius: getStyleRadius(
|
|
441
|
-
destinationStyles,
|
|
442
|
-
"borderBottomRightRadius",
|
|
443
|
-
),
|
|
444
|
-
fallback: defaultRadius,
|
|
445
|
-
}),
|
|
446
|
-
};
|
|
447
|
-
};
|
|
448
|
-
|
|
449
95
|
export const buildZoomStyles = ({
|
|
450
|
-
|
|
451
|
-
group,
|
|
96
|
+
resolvedTag,
|
|
452
97
|
zoomOptions,
|
|
453
98
|
props,
|
|
454
|
-
|
|
455
|
-
computeRaw,
|
|
456
|
-
}: BuildZoomStylesParams): ReturnType<ScreenStyleInterpolator> => {
|
|
99
|
+
}: BuildZoomStylesParams): ZoomInterpolatedStyle => {
|
|
457
100
|
"worklet";
|
|
458
101
|
|
|
102
|
+
if (!resolvedTag) return {};
|
|
103
|
+
|
|
104
|
+
const explicitTarget = zoomOptions?.target;
|
|
105
|
+
const debug = zoomOptions?.DEBUG === true;
|
|
106
|
+
|
|
459
107
|
const focused = props.focused;
|
|
460
108
|
const progress = props.progress;
|
|
461
109
|
const currentRouteKey = props.current?.route.key;
|
|
@@ -463,43 +111,41 @@ export const buildZoomStyles = ({
|
|
|
463
111
|
const nextRouteKey = props.next?.route.key;
|
|
464
112
|
const entering = !props.next;
|
|
465
113
|
const screenLayout = props.layouts.screen;
|
|
466
|
-
const
|
|
114
|
+
const resolvedZoomAnchor = getZoomAnchor(explicitTarget);
|
|
115
|
+
const zoomComputeParams = {
|
|
116
|
+
id: resolvedTag,
|
|
117
|
+
previous: props.previous,
|
|
118
|
+
current: props.current,
|
|
119
|
+
next: props.next,
|
|
120
|
+
progress,
|
|
121
|
+
dimensions: screenLayout,
|
|
122
|
+
} as const;
|
|
123
|
+
const baseRawOptions = {
|
|
124
|
+
id: resolvedTag,
|
|
125
|
+
raw: true,
|
|
126
|
+
scaleMode: ZOOM_SHARED_OPTIONS.scaleMode,
|
|
127
|
+
} as const;
|
|
128
|
+
|
|
129
|
+
const resolvedPair = BoundStore.resolveTransitionPair(resolvedTag, {
|
|
467
130
|
currentScreenKey: currentRouteKey,
|
|
468
131
|
previousScreenKey: previousRouteKey,
|
|
469
132
|
nextScreenKey: nextRouteKey,
|
|
470
133
|
entering,
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
const resolvedConfig = resolveZoomConfig({
|
|
474
|
-
id,
|
|
475
|
-
group,
|
|
476
|
-
zoomOptions,
|
|
477
|
-
currentRouteKey,
|
|
478
|
-
resolveTag,
|
|
479
|
-
defaultAnchor: "top",
|
|
480
134
|
});
|
|
481
135
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
const {
|
|
485
|
-
resolvedTag,
|
|
486
|
-
sharedOptions,
|
|
487
|
-
explicitTarget,
|
|
488
|
-
zoomOptions: resolvedZoomOptions,
|
|
489
|
-
} = resolvedConfig;
|
|
490
|
-
|
|
491
|
-
const resolvedPair = BoundStore.resolveTransitionPair(
|
|
492
|
-
resolvedTag,
|
|
493
|
-
transitionContext,
|
|
494
|
-
);
|
|
136
|
+
const sourceBorderRadius = getSourceBorderRadius(resolvedPair);
|
|
137
|
+
const targetBorderRadius = zoomOptions?.borderRadius ?? sourceBorderRadius;
|
|
495
138
|
|
|
496
139
|
const focusedVisibilityStyles = {
|
|
497
140
|
[resolvedTag]: VISIBLE_STYLE,
|
|
498
141
|
} satisfies TransitionInterpolatedStyle;
|
|
142
|
+
const focusedContainerStyleId = props.navigationMaskEnabled
|
|
143
|
+
? NAVIGATION_MASK_CONTAINER_STYLE_ID
|
|
144
|
+
: "content";
|
|
499
145
|
|
|
500
146
|
if (!resolvedPair.sourceBounds) {
|
|
501
147
|
return {
|
|
502
|
-
[
|
|
148
|
+
[focusedContainerStyleId]: HIDDEN_STYLE,
|
|
503
149
|
};
|
|
504
150
|
}
|
|
505
151
|
|
|
@@ -509,12 +155,12 @@ export const buildZoomStyles = ({
|
|
|
509
155
|
const dragX = normalizedToTranslation({
|
|
510
156
|
normalized: normX,
|
|
511
157
|
dimension: screenLayout.width,
|
|
512
|
-
resistance:
|
|
158
|
+
resistance: ZOOM_DRAG_RESISTANCE,
|
|
513
159
|
});
|
|
514
160
|
const dragY = normalizedToTranslation({
|
|
515
161
|
normalized: normY,
|
|
516
162
|
dimension: screenLayout.height,
|
|
517
|
-
resistance:
|
|
163
|
+
resistance: ZOOM_DRAG_RESISTANCE,
|
|
518
164
|
});
|
|
519
165
|
const dragXScale =
|
|
520
166
|
initialDirection === "horizontal" ||
|
|
@@ -525,8 +171,8 @@ export const buildZoomStyles = ({
|
|
|
525
171
|
initialDirection === "horizontal-inverted"
|
|
526
172
|
? "negative"
|
|
527
173
|
: "positive",
|
|
528
|
-
shrinkMin:
|
|
529
|
-
growMax:
|
|
174
|
+
shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
|
|
175
|
+
growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
|
|
530
176
|
exponent: 2,
|
|
531
177
|
})
|
|
532
178
|
: IDENTITY_DRAG_SCALE_OUTPUT[0];
|
|
@@ -536,8 +182,8 @@ export const buildZoomStyles = ({
|
|
|
536
182
|
normalized: normY,
|
|
537
183
|
dismissDirection:
|
|
538
184
|
initialDirection === "vertical-inverted" ? "negative" : "positive",
|
|
539
|
-
shrinkMin:
|
|
540
|
-
growMax:
|
|
185
|
+
shrinkMin: ZOOM_DRAG_DIRECTIONAL_SCALE_MIN,
|
|
186
|
+
growMax: ZOOM_DRAG_DIRECTIONAL_SCALE_MAX,
|
|
541
187
|
exponent: 2,
|
|
542
188
|
})
|
|
543
189
|
: IDENTITY_DRAG_SCALE_OUTPUT[1];
|
|
@@ -546,33 +192,51 @@ export const buildZoomStyles = ({
|
|
|
546
192
|
if (focused) {
|
|
547
193
|
const contentTarget = getZoomContentTarget({
|
|
548
194
|
explicitTarget,
|
|
549
|
-
resolvedTag,
|
|
550
|
-
currentRouteKey,
|
|
551
|
-
previousRouteKey,
|
|
552
|
-
nextRouteKey,
|
|
553
|
-
entering,
|
|
554
195
|
screenLayout,
|
|
555
|
-
anchor:
|
|
196
|
+
anchor: ZOOM_SHARED_OPTIONS.anchor,
|
|
556
197
|
resolvedPair,
|
|
557
198
|
});
|
|
558
199
|
|
|
559
|
-
const contentRaw =
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
200
|
+
const contentRaw = computeBoundStyles(
|
|
201
|
+
zoomComputeParams,
|
|
202
|
+
{
|
|
203
|
+
...baseRawOptions,
|
|
204
|
+
anchor: resolvedZoomAnchor,
|
|
205
|
+
method: "content",
|
|
206
|
+
target: contentTarget,
|
|
207
|
+
},
|
|
208
|
+
resolvedPair,
|
|
209
|
+
) as Record<string, unknown>;
|
|
210
|
+
|
|
211
|
+
const maskRaw = computeBoundStyles(
|
|
212
|
+
zoomComputeParams,
|
|
213
|
+
{
|
|
214
|
+
...baseRawOptions,
|
|
215
|
+
anchor: ZOOM_SHARED_OPTIONS.anchor,
|
|
216
|
+
method: "size",
|
|
217
|
+
space: "absolute",
|
|
218
|
+
target: "fullscreen",
|
|
219
|
+
},
|
|
220
|
+
resolvedPair,
|
|
221
|
+
) as Record<string, unknown>;
|
|
571
222
|
|
|
572
223
|
const focusedFade = props.active?.closing
|
|
573
|
-
? interpolate(progress, [0.6, 1], [0, 1], "clamp")
|
|
574
|
-
: interpolate(progress, [0, 0.5], [0, 1], "clamp");
|
|
575
|
-
|
|
224
|
+
? interpolate(progress, [0.6, 1], [0, debug ? 0.5 : 1], "clamp")
|
|
225
|
+
: interpolate(progress, [0, 0.5], [0, debug ? 0.5 : 1], "clamp");
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* This is also how swiftui handles their navigation zoom.
|
|
229
|
+
* They remove clipping as soon as the screen stops animating
|
|
230
|
+
*/
|
|
231
|
+
const shouldRemoveClipping = !props.active.animating;
|
|
232
|
+
const focusedMaskBorderRadius = interpolate(
|
|
233
|
+
progress,
|
|
234
|
+
[0, 1],
|
|
235
|
+
[sourceBorderRadius, shouldRemoveClipping ? 0 : targetBorderRadius],
|
|
236
|
+
"clamp",
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
const { top, right, bottom, left } = ZOOM_MASK_OUTSET;
|
|
576
240
|
const maskWidth = Math.max(1, toNumber(maskRaw.width) + left + right);
|
|
577
241
|
const maskHeight = Math.max(1, toNumber(maskRaw.height) + top + bottom);
|
|
578
242
|
const contentTranslateX = toNumber(contentRaw.translateX) + dragX;
|
|
@@ -580,11 +244,6 @@ export const buildZoomStyles = ({
|
|
|
580
244
|
const contentScale = toNumber(contentRaw.scale, 1) * dragScale;
|
|
581
245
|
const maskTranslateX = toNumber(maskRaw.translateX) + dragX - left;
|
|
582
246
|
const maskTranslateY = toNumber(maskRaw.translateY) + dragY - top;
|
|
583
|
-
const maskRadii = resolveMaskRadii({
|
|
584
|
-
progress,
|
|
585
|
-
zoomOptions: resolvedZoomOptions,
|
|
586
|
-
resolvedPair,
|
|
587
|
-
});
|
|
588
247
|
const focusedContentStyle = {
|
|
589
248
|
opacity: focusedFade,
|
|
590
249
|
transform: [
|
|
@@ -592,83 +251,98 @@ export const buildZoomStyles = ({
|
|
|
592
251
|
{ translateY: contentTranslateY },
|
|
593
252
|
{ scale: contentScale },
|
|
594
253
|
],
|
|
254
|
+
borderRadius: focusedMaskBorderRadius,
|
|
255
|
+
overflow: "hidden" as const,
|
|
595
256
|
};
|
|
596
257
|
|
|
597
|
-
|
|
598
|
-
[
|
|
258
|
+
const focusedStyles: ZoomInterpolatedStyle = {
|
|
259
|
+
[focusedContainerStyleId]: {
|
|
599
260
|
style: focusedContentStyle,
|
|
600
261
|
},
|
|
601
|
-
|
|
262
|
+
...focusedVisibilityStyles,
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
if (props.navigationMaskEnabled) {
|
|
266
|
+
focusedStyles[NAVIGATION_MASK_ELEMENT_STYLE_ID] = {
|
|
602
267
|
style: {
|
|
603
268
|
width: maskWidth,
|
|
604
269
|
height: maskHeight,
|
|
270
|
+
borderRadius: focusedMaskBorderRadius,
|
|
605
271
|
transform: [
|
|
606
272
|
{ translateX: maskTranslateX },
|
|
607
273
|
{ translateY: maskTranslateY },
|
|
608
274
|
{ scale: dragScale },
|
|
609
275
|
],
|
|
610
|
-
borderRadius: maskRadii.borderRadius,
|
|
611
|
-
borderTopLeftRadius: maskRadii.borderTopLeftRadius,
|
|
612
|
-
borderTopRightRadius: maskRadii.borderTopRightRadius,
|
|
613
|
-
borderBottomLeftRadius: maskRadii.borderBottomLeftRadius,
|
|
614
|
-
borderBottomRightRadius: maskRadii.borderBottomRightRadius,
|
|
615
|
-
...(resolvedZoomOptions.mask.borderCurve
|
|
616
|
-
? { borderCurve: resolvedZoomOptions.mask.borderCurve }
|
|
617
|
-
: {}),
|
|
618
276
|
},
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return focusedStyles;
|
|
622
281
|
}
|
|
623
282
|
|
|
624
283
|
const unfocusedFade = props.active?.closing
|
|
625
|
-
? interpolate(progress, [1.6, 2], [1, 0], "clamp")
|
|
626
|
-
: interpolate(progress, [1, 1.5], [1, 0], "clamp");
|
|
284
|
+
? interpolate(progress, [1.6, 2], [1, debug ? 0.5 : 0], "clamp")
|
|
285
|
+
: interpolate(progress, [1, 1.5], [1, debug ? 0.5 : 0], "clamp");
|
|
286
|
+
|
|
627
287
|
const unfocusedScale = interpolate(progress, [1, 2], [1, 0.95], "clamp");
|
|
628
288
|
const isUnfocusedIdle = props.active.settled === 1;
|
|
629
|
-
|
|
630
289
|
const elementTarget =
|
|
631
|
-
|
|
632
|
-
? (
|
|
633
|
-
: getZoomContentTarget({
|
|
290
|
+
explicitTarget !== undefined || resolvedPair.destinationBounds
|
|
291
|
+
? getZoomContentTarget({
|
|
634
292
|
explicitTarget,
|
|
635
|
-
resolvedTag,
|
|
636
|
-
currentRouteKey,
|
|
637
|
-
previousRouteKey,
|
|
638
|
-
nextRouteKey,
|
|
639
|
-
entering,
|
|
640
293
|
screenLayout,
|
|
641
|
-
anchor:
|
|
294
|
+
anchor: ZOOM_SHARED_OPTIONS.anchor,
|
|
642
295
|
resolvedPair,
|
|
643
|
-
})
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
296
|
+
})
|
|
297
|
+
: ("fullscreen" as const);
|
|
298
|
+
|
|
299
|
+
const elementRaw = computeBoundStyles(
|
|
300
|
+
zoomComputeParams,
|
|
301
|
+
{
|
|
302
|
+
...baseRawOptions,
|
|
303
|
+
anchor: resolvedZoomAnchor,
|
|
304
|
+
method: "transform",
|
|
305
|
+
space: "relative",
|
|
306
|
+
target: elementTarget,
|
|
307
|
+
},
|
|
308
|
+
resolvedPair,
|
|
309
|
+
) as Record<string, unknown>;
|
|
310
|
+
const boundTargetCenterX =
|
|
311
|
+
explicitTarget === "bound" && resolvedPair.destinationBounds
|
|
312
|
+
? resolvedPair.destinationBounds.pageX +
|
|
313
|
+
resolvedPair.destinationBounds.width / 2
|
|
314
|
+
: undefined;
|
|
315
|
+
const boundTargetCenterY =
|
|
316
|
+
explicitTarget === "bound" && resolvedPair.destinationBounds
|
|
317
|
+
? resolvedPair.destinationBounds.pageY +
|
|
318
|
+
resolvedPair.destinationBounds.height / 2
|
|
319
|
+
: undefined;
|
|
320
|
+
const elementCenterX =
|
|
321
|
+
boundTargetCenterX ??
|
|
322
|
+
(typeof elementTarget === "object"
|
|
323
|
+
? elementTarget.pageX + elementTarget.width / 2
|
|
324
|
+
: screenLayout.width / 2);
|
|
654
325
|
const elementCenterY =
|
|
655
|
-
|
|
326
|
+
boundTargetCenterY ??
|
|
327
|
+
(typeof elementTarget === "object"
|
|
656
328
|
? elementTarget.pageY + elementTarget.height / 2
|
|
657
|
-
: screenLayout.height / 2;
|
|
658
|
-
|
|
329
|
+
: screenLayout.height / 2);
|
|
330
|
+
const scaleShiftX = computeCenterScaleShift({
|
|
331
|
+
center: elementCenterX,
|
|
332
|
+
containerCenter: screenLayout.width / 2,
|
|
333
|
+
scale: dragScale,
|
|
334
|
+
});
|
|
659
335
|
const scaleShiftY = computeCenterScaleShift({
|
|
660
336
|
center: elementCenterY,
|
|
661
337
|
containerCenter: screenLayout.height / 2,
|
|
662
338
|
scale: dragScale,
|
|
663
339
|
});
|
|
664
|
-
|
|
665
340
|
const compensatedGestureX = composeCompensatedTranslation({
|
|
666
341
|
gesture: dragX,
|
|
667
342
|
parentScale: unfocusedScale,
|
|
343
|
+
centerShift: scaleShiftX,
|
|
668
344
|
epsilon: EPSILON,
|
|
669
345
|
});
|
|
670
|
-
// dragY is measured in screen space and must be unscaled by the parent
|
|
671
|
-
// content shrink, while scaleShiftY is already in the parent's local space.
|
|
672
346
|
const compensatedGestureY = composeCompensatedTranslation({
|
|
673
347
|
gesture: dragY,
|
|
674
348
|
parentScale: unfocusedScale,
|
|
@@ -681,7 +355,6 @@ export const buildZoomStyles = ({
|
|
|
681
355
|
toNumber(elementRaw.translateY) + compensatedGestureY;
|
|
682
356
|
const elementScaleX = toNumber(elementRaw.scaleX, 1) * dragScale;
|
|
683
357
|
const elementScaleY = toNumber(elementRaw.scaleY, 1) * dragScale;
|
|
684
|
-
|
|
685
358
|
const resolvedElementStyle = isUnfocusedIdle
|
|
686
359
|
? {
|
|
687
360
|
transform: [
|