react-native-screen-transitions 3.4.0-alpha.0 → 3.4.0-alpha.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/README.md +65 -2
- package/lib/commonjs/shared/animation/snap-to.js +5 -1
- package/lib/commonjs/shared/animation/snap-to.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/utils/build-boundary-match-key.js +5 -10
- package/lib/commonjs/shared/components/create-boundary-component/utils/build-boundary-match-key.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/helpers/get-active-overlay.js +2 -2
- package/lib/commonjs/shared/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/index.js +1 -3
- package/lib/commonjs/shared/components/overlay/index.js.map +1 -1
- package/lib/commonjs/shared/components/overlay/variations/overlay-host.js +2 -16
- package/lib/commonjs/shared/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/commonjs/shared/components/scene-view.js +2 -4
- package/lib/commonjs/shared/components/scene-view.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +9 -6
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/content.js +47 -55
- 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 +77 -0
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -0
- 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 +17 -4
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
- package/lib/commonjs/shared/constants.js +6 -2
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/hooks/gestures/resolve-screen-gesture-target.js +49 -0
- package/lib/commonjs/shared/hooks/gestures/resolve-screen-gesture-target.js.map +1 -0
- package/lib/commonjs/shared/hooks/gestures/types.js +2 -0
- package/lib/commonjs/shared/hooks/gestures/types.js.map +1 -0
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture.js +7 -3
- package/lib/commonjs/shared/hooks/gestures/use-screen-gesture.js.map +1 -1
- package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/commonjs/shared/index.js +15 -3
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js +55 -18
- package/lib/commonjs/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js +44 -0
- package/lib/commonjs/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/animation.provider.js +31 -17
- package/lib/commonjs/shared/providers/screen/animation/animation.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/derivations.js +1 -9
- package/lib/commonjs/shared/providers/screen/animation/helpers/derivations.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +11 -6
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/resolve-screen-animation-target.js +33 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/resolve-screen-animation-target.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/types.js +2 -0
- package/lib/commonjs/shared/providers/screen/animation/types.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/animation/use-screen-animation.js +9 -3
- package/lib/commonjs/shared/providers/screen/animation/use-screen-animation.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 +8 -2
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js +7 -0
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js +6 -0
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js +24 -9
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/geometry.js +3 -2
- package/lib/commonjs/shared/utils/bounds/helpers/geometry.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js +3 -2
- package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js +2 -2
- package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js +6 -5
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js +4 -3
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/index.js +3 -3
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/accessor.js +54 -0
- package/lib/commonjs/shared/utils/bounds/zoom/accessor.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/build.js +541 -0
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/config.js +118 -0
- package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/index.js +20 -0
- package/lib/commonjs/shared/utils/bounds/zoom/index.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/zoom/types.js.map +1 -0
- package/lib/commonjs/shared/utils/gesture/validate-snap-points.js +11 -5
- package/lib/commonjs/shared/utils/gesture/validate-snap-points.js.map +1 -1
- package/lib/commonjs/shared/utils/overlay/visibility.js +2 -9
- package/lib/commonjs/shared/utils/overlay/visibility.js.map +1 -1
- package/lib/module/shared/animation/snap-to.js +5 -1
- package/lib/module/shared/animation/snap-to.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/utils/build-boundary-match-key.js +5 -10
- package/lib/module/shared/components/create-boundary-component/utils/build-boundary-match-key.js.map +1 -1
- package/lib/module/shared/components/overlay/helpers/get-active-overlay.js +3 -3
- package/lib/module/shared/components/overlay/helpers/get-active-overlay.js.map +1 -1
- package/lib/module/shared/components/overlay/index.js +1 -3
- package/lib/module/shared/components/overlay/index.js.map +1 -1
- package/lib/module/shared/components/overlay/variations/overlay-host.js +3 -17
- package/lib/module/shared/components/overlay/variations/overlay-host.js.map +1 -1
- package/lib/module/shared/components/scene-view.js +3 -5
- package/lib/module/shared/components/scene-view.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js +9 -6
- package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/content.js +52 -60
- 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 +72 -0
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js.map +1 -0
- 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 +17 -4
- package/lib/module/shared/components/screen-lifecycle/hooks/use-open-transition.js.map +1 -1
- package/lib/module/shared/constants.js +6 -2
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/hooks/gestures/resolve-screen-gesture-target.js +45 -0
- package/lib/module/shared/hooks/gestures/resolve-screen-gesture-target.js.map +1 -0
- package/lib/module/shared/hooks/gestures/types.js +2 -0
- package/lib/module/shared/hooks/gestures/types.js.map +1 -0
- package/lib/module/shared/hooks/gestures/use-screen-gesture.js +7 -4
- package/lib/module/shared/hooks/gestures/use-screen-gesture.js.map +1 -1
- package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/module/shared/index.js +1 -2
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js +55 -18
- package/lib/module/shared/providers/gestures/handlers/use-handlers.js.map +1 -1
- package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js +38 -0
- package/lib/module/shared/providers/gestures/helpers/gesture-snap-points.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/animation.provider.js +30 -15
- package/lib/module/shared/providers/screen/animation/animation.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/derivations.js +1 -9
- package/lib/module/shared/providers/screen/animation/helpers/derivations.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +11 -6
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/resolve-screen-animation-target.js +29 -0
- package/lib/module/shared/providers/screen/animation/helpers/resolve-screen-animation-target.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/index.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/types.js +2 -0
- package/lib/module/shared/providers/screen/animation/types.js.map +1 -0
- package/lib/module/shared/providers/screen/animation/use-screen-animation.js +9 -3
- package/lib/module/shared/providers/screen/animation/use-screen-animation.js.map +1 -1
- package/lib/module/shared/providers/stack/direct.provider.js +2 -2
- package/lib/module/shared/providers/stack/direct.provider.js.map +1 -1
- package/lib/module/shared/providers/stack/helpers/use-processed-routes.js +2 -2
- package/lib/module/shared/providers/stack/helpers/use-processed-routes.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +8 -2
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/resolver.js +7 -0
- package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js +6 -0
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js +24 -9
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/geometry.js +3 -2
- package/lib/module/shared/utils/bounds/helpers/geometry.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/interpolators.js +3 -2
- package/lib/module/shared/utils/bounds/helpers/interpolators.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/link-accessor.js +2 -2
- package/lib/module/shared/utils/bounds/helpers/link-accessor.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js +6 -5
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +1 -1
- package/lib/module/shared/utils/bounds/helpers/style-composers.js +4 -3
- package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +1 -1
- package/lib/module/shared/utils/bounds/index.js +3 -3
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/accessor.js +49 -0
- package/lib/module/shared/utils/bounds/zoom/accessor.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/build.js +536 -0
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/config.js +112 -0
- package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/index.js +5 -0
- package/lib/module/shared/utils/bounds/zoom/index.js.map +1 -0
- package/lib/module/shared/utils/bounds/zoom/types.js.map +1 -0
- package/lib/module/shared/utils/gesture/validate-snap-points.js +11 -5
- package/lib/module/shared/utils/gesture/validate-snap-points.js.map +1 -1
- package/lib/module/shared/utils/overlay/visibility.js +1 -7
- package/lib/module/shared/utils/overlay/visibility.js.map +1 -1
- package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/utils/build-boundary-match-key.d.ts +0 -1
- package/lib/typescript/shared/components/create-boundary-component/utils/build-boundary-match-key.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/helpers/get-active-overlay.d.ts +1 -1
- package/lib/typescript/shared/components/overlay/index.d.ts +0 -2
- package/lib/typescript/shared/components/overlay/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/overlay/variations/overlay-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/scene-view.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 +7 -0
- package/lib/typescript/shared/components/screen-container/layers/maybe-masked-navigation-container.d.ts.map +1 -0
- 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.map +1 -1
- package/lib/typescript/shared/constants.d.ts +3 -0
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/gestures/resolve-screen-gesture-target.d.ts +10 -0
- package/lib/typescript/shared/hooks/gestures/resolve-screen-gesture-target.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/gestures/types.d.ts +4 -0
- package/lib/typescript/shared/hooks/gestures/types.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture.d.ts +4 -2
- package/lib/typescript/shared/hooks/gestures/use-screen-gesture.d.ts.map +1 -1
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts +1 -2
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +16 -17
- 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 +18 -0
- package/lib/typescript/shared/providers/gestures/helpers/gesture-snap-points.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/animation.provider.d.ts +6 -3
- package/lib/typescript/shared/providers/screen/animation/animation.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/derivations.d.ts +0 -2
- package/lib/typescript/shared/providers/screen/animation/helpers/derivations.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/resolve-screen-animation-target.d.ts +11 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/resolve-screen-animation-target.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/index.d.ts +1 -1
- package/lib/typescript/shared/providers/screen/animation/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/types.d.ts +4 -0
- package/lib/typescript/shared/providers/screen/animation/types.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/animation/use-screen-animation.d.ts +5 -1
- package/lib/typescript/shared/providers/screen/animation/use-screen-animation.d.ts.map +1 -1
- package/lib/typescript/shared/providers/stack/direct.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +4 -0
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/types.d.ts +2 -0
- package/lib/typescript/shared/stores/bounds/types.d.ts.map +1 -1
- package/lib/typescript/shared/types/animation.types.d.ts +26 -51
- package/lib/typescript/shared/types/animation.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +46 -9
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +3 -3
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/types/overlay.types.d.ts +1 -22
- package/lib/typescript/shared/types/overlay.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/screen.types.d.ts +16 -15
- package/lib/typescript/shared/types/screen.types.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts +2 -2
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.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/helpers/geometry.d.ts +3 -2
- package/lib/typescript/shared/utils/bounds/helpers/geometry.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts +3 -2
- package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts +3 -2
- package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts +2 -1
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts +4 -3
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/types/options.d.ts +5 -4
- package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts +17 -0
- package/lib/typescript/shared/utils/bounds/zoom/accessor.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts +4 -0
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +43 -0
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/index.d.ts +3 -0
- package/lib/typescript/shared/utils/bounds/zoom/index.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts +17 -0
- package/lib/typescript/shared/utils/bounds/zoom/types.d.ts.map +1 -0
- package/lib/typescript/shared/utils/gesture/validate-snap-points.d.ts +5 -3
- package/lib/typescript/shared/utils/gesture/validate-snap-points.d.ts.map +1 -1
- package/lib/typescript/shared/utils/overlay/visibility.d.ts +1 -4
- package/lib/typescript/shared/utils/overlay/visibility.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/shared/animation/snap-to.ts +12 -1
- package/src/shared/components/create-boundary-component/utils/build-boundary-match-key.ts +2 -14
- package/src/shared/components/overlay/helpers/get-active-overlay.ts +3 -3
- package/src/shared/components/overlay/index.ts +0 -2
- package/src/shared/components/overlay/variations/overlay-host.tsx +2 -16
- package/src/shared/components/scene-view.tsx +0 -3
- package/src/shared/components/screen-container/layers/backdrop.tsx +25 -6
- package/src/shared/components/screen-container/layers/content.tsx +80 -77
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +93 -0
- package/src/shared/components/screen-lifecycle/hooks/use-close-transition/index.ts +1 -2
- package/src/shared/components/screen-lifecycle/hooks/use-open-transition.ts +20 -6
- package/src/shared/constants.ts +6 -2
- package/src/shared/hooks/gestures/resolve-screen-gesture-target.ts +66 -0
- package/src/shared/hooks/gestures/types.ts +5 -0
- package/src/shared/hooks/gestures/use-screen-gesture.ts +10 -3
- package/src/shared/hooks/navigation/use-stack.tsx +1 -2
- package/src/shared/index.ts +14 -16
- package/src/shared/providers/gestures/handlers/use-handlers.ts +67 -24
- package/src/shared/providers/gestures/helpers/gesture-snap-points.ts +72 -0
- package/src/shared/providers/screen/animation/animation.provider.tsx +46 -10
- package/src/shared/providers/screen/animation/helpers/derivations.ts +0 -8
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +26 -5
- package/src/shared/providers/screen/animation/helpers/resolve-screen-animation-target.ts +44 -0
- package/src/shared/providers/screen/animation/index.tsx +4 -1
- package/src/shared/providers/screen/animation/types.ts +5 -0
- package/src/shared/providers/screen/animation/use-screen-animation.tsx +16 -3
- package/src/shared/providers/stack/direct.provider.tsx +2 -5
- package/src/shared/providers/stack/helpers/use-processed-routes.ts +2 -2
- package/src/shared/stores/animation.store.ts +13 -1
- package/src/shared/stores/bounds/internals/resolver.ts +13 -1
- package/src/shared/stores/bounds/types.ts +2 -0
- package/src/shared/types/animation.types.ts +25 -58
- package/src/shared/types/bounds.types.ts +30 -10
- package/src/shared/types/index.ts +2 -15
- package/src/shared/types/overlay.types.ts +1 -28
- package/src/shared/types/screen.types.ts +17 -16
- package/src/shared/utils/animation/animate-to-progress.ts +7 -0
- package/src/shared/utils/bounds/helpers/build-bounds-options.ts +2 -2
- package/src/shared/utils/bounds/helpers/compute-bounds-styles.ts +34 -8
- package/src/shared/utils/bounds/helpers/geometry.ts +3 -2
- package/src/shared/utils/bounds/helpers/interpolators.ts +8 -6
- package/src/shared/utils/bounds/helpers/link-accessor.ts +10 -6
- package/src/shared/utils/bounds/helpers/resolve-bound-tag.ts +9 -6
- package/src/shared/utils/bounds/helpers/style-composers.ts +4 -3
- package/src/shared/utils/bounds/index.ts +6 -8
- package/src/shared/utils/bounds/types/options.ts +6 -4
- package/src/shared/utils/bounds/zoom/accessor.ts +69 -0
- package/src/shared/utils/bounds/zoom/build.ts +705 -0
- package/src/shared/utils/bounds/zoom/config.ts +179 -0
- package/src/shared/utils/bounds/zoom/index.ts +2 -0
- package/src/shared/utils/bounds/zoom/types.ts +22 -0
- package/src/shared/utils/gesture/validate-snap-points.ts +20 -8
- package/src/shared/utils/overlay/visibility.ts +1 -16
- package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js +0 -64
- package/lib/commonjs/shared/components/overlay/variations/screen-overlay.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/math.js +0 -132
- package/lib/commonjs/shared/utils/bounds/helpers/math.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/navigation-accessor.js +0 -45
- package/lib/commonjs/shared/utils/bounds/helpers/navigation-accessor.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/helpers.js +0 -60
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/helpers.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/index.js +0 -20
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/index.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/types.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/zoom.js +0 -295
- package/lib/commonjs/shared/utils/bounds/sugar/navigation/zoom.js.map +0 -1
- package/lib/module/shared/components/overlay/variations/screen-overlay.js +0 -61
- package/lib/module/shared/components/overlay/variations/screen-overlay.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/math.js +0 -115
- package/lib/module/shared/utils/bounds/helpers/math.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/navigation-accessor.js +0 -40
- package/lib/module/shared/utils/bounds/helpers/navigation-accessor.js.map +0 -1
- package/lib/module/shared/utils/bounds/sugar/navigation/helpers.js +0 -54
- package/lib/module/shared/utils/bounds/sugar/navigation/helpers.js.map +0 -1
- package/lib/module/shared/utils/bounds/sugar/navigation/index.js +0 -15
- package/lib/module/shared/utils/bounds/sugar/navigation/index.js.map +0 -1
- package/lib/module/shared/utils/bounds/sugar/navigation/types.js.map +0 -1
- package/lib/module/shared/utils/bounds/sugar/navigation/zoom.js +0 -290
- package/lib/module/shared/utils/bounds/sugar/navigation/zoom.js.map +0 -1
- package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts +0 -10
- package/lib/typescript/shared/components/overlay/variations/screen-overlay.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/math.d.ts +0 -38
- package/lib/typescript/shared/utils/bounds/helpers/math.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/navigation-accessor.d.ts +0 -16
- package/lib/typescript/shared/utils/bounds/helpers/navigation-accessor.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/sugar/navigation/helpers.d.ts +0 -17
- package/lib/typescript/shared/utils/bounds/sugar/navigation/helpers.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/sugar/navigation/index.d.ts +0 -3
- package/lib/typescript/shared/utils/bounds/sugar/navigation/index.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/sugar/navigation/types.d.ts +0 -18
- package/lib/typescript/shared/utils/bounds/sugar/navigation/types.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/sugar/navigation/zoom.d.ts +0 -4
- package/lib/typescript/shared/utils/bounds/sugar/navigation/zoom.d.ts.map +0 -1
- package/src/shared/components/overlay/variations/screen-overlay.tsx +0 -68
- package/src/shared/utils/bounds/helpers/math.ts +0 -161
- package/src/shared/utils/bounds/helpers/navigation-accessor.ts +0 -61
- package/src/shared/utils/bounds/sugar/navigation/helpers.ts +0 -74
- package/src/shared/utils/bounds/sugar/navigation/index.ts +0 -14
- package/src/shared/utils/bounds/sugar/navigation/types.ts +0 -26
- package/src/shared/utils/bounds/sugar/navigation/zoom.ts +0 -348
- /package/lib/commonjs/shared/utils/bounds/{sugar/navigation → zoom}/types.js +0 -0
- /package/lib/module/shared/utils/bounds/{sugar/navigation → zoom}/types.js +0 -0
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
type CombinedScaleMode = "multiply" | "average" | "max" | "min";
|
|
2
|
-
|
|
3
|
-
export const clamp = (value: number, min: number, max: number): number => {
|
|
4
|
-
"worklet";
|
|
5
|
-
const lower = min < max ? min : max;
|
|
6
|
-
const upper = max > min ? max : min;
|
|
7
|
-
|
|
8
|
-
if (value < lower) return lower;
|
|
9
|
-
if (value > upper) return upper;
|
|
10
|
-
|
|
11
|
-
return value;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const clamp01 = (value: number): number => {
|
|
15
|
-
"worklet";
|
|
16
|
-
return clamp(value, 0, 1);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const lerp = (from: number, to: number, t: number): number => {
|
|
20
|
-
"worklet";
|
|
21
|
-
return from + (to - from) * t;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const safeDivide = (
|
|
25
|
-
numerator: number,
|
|
26
|
-
denominator: number,
|
|
27
|
-
fallback = 0,
|
|
28
|
-
): number => {
|
|
29
|
-
"worklet";
|
|
30
|
-
if (denominator === 0) return fallback;
|
|
31
|
-
return numerator / denominator;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const inverseLerp = (
|
|
35
|
-
value: number,
|
|
36
|
-
inMin: number,
|
|
37
|
-
inMax: number,
|
|
38
|
-
): number => {
|
|
39
|
-
"worklet";
|
|
40
|
-
return safeDivide(value - inMin, inMax - inMin, 0);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const mapRangeClamped = (
|
|
44
|
-
value: number,
|
|
45
|
-
inMin: number,
|
|
46
|
-
inMax: number,
|
|
47
|
-
outMin: number,
|
|
48
|
-
outMax: number,
|
|
49
|
-
): number => {
|
|
50
|
-
"worklet";
|
|
51
|
-
const t = clamp01(inverseLerp(value, inMin, inMax));
|
|
52
|
-
return lerp(outMin, outMax, t);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const applyPowerCurve = (value: number, exponent: number): number => {
|
|
56
|
-
"worklet";
|
|
57
|
-
const safeExponent = exponent > 0 ? exponent : 1;
|
|
58
|
-
const magnitude = Math.abs(value) ** safeExponent;
|
|
59
|
-
return value < 0 ? -magnitude : magnitude;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const normalizedToTranslation = ({
|
|
63
|
-
normalized,
|
|
64
|
-
dimension,
|
|
65
|
-
resistance,
|
|
66
|
-
}: {
|
|
67
|
-
normalized: number;
|
|
68
|
-
dimension: number;
|
|
69
|
-
resistance: number;
|
|
70
|
-
}): number => {
|
|
71
|
-
"worklet";
|
|
72
|
-
const distance = Math.max(0, dimension) * resistance;
|
|
73
|
-
return mapRangeClamped(normalized, -1, 1, -distance, distance);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const normalizedToScale = ({
|
|
77
|
-
normalized,
|
|
78
|
-
outputRange,
|
|
79
|
-
exponent = 1,
|
|
80
|
-
positiveOnly = true,
|
|
81
|
-
}: {
|
|
82
|
-
normalized: number;
|
|
83
|
-
outputRange: readonly [number, number];
|
|
84
|
-
exponent?: number;
|
|
85
|
-
positiveOnly?: boolean;
|
|
86
|
-
}): number => {
|
|
87
|
-
"worklet";
|
|
88
|
-
const [outputStart, outputEnd] = outputRange;
|
|
89
|
-
const raw = positiveOnly
|
|
90
|
-
? mapRangeClamped(normalized, 0, 1, outputStart, outputEnd)
|
|
91
|
-
: mapRangeClamped(normalized, -1, 1, outputStart, outputEnd);
|
|
92
|
-
|
|
93
|
-
return applyPowerCurve(raw, exponent);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export const combineScales = (
|
|
97
|
-
scaleX: number,
|
|
98
|
-
scaleY: number,
|
|
99
|
-
mode: CombinedScaleMode = "multiply",
|
|
100
|
-
): number => {
|
|
101
|
-
"worklet";
|
|
102
|
-
|
|
103
|
-
switch (mode) {
|
|
104
|
-
case "average":
|
|
105
|
-
return (scaleX + scaleY) / 2;
|
|
106
|
-
case "max":
|
|
107
|
-
return Math.max(scaleX, scaleY);
|
|
108
|
-
case "min":
|
|
109
|
-
return Math.min(scaleX, scaleY);
|
|
110
|
-
default:
|
|
111
|
-
return scaleX * scaleY;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const computeCenterScaleShift = ({
|
|
116
|
-
center,
|
|
117
|
-
containerCenter,
|
|
118
|
-
scale,
|
|
119
|
-
}: {
|
|
120
|
-
center: number;
|
|
121
|
-
containerCenter: number;
|
|
122
|
-
scale: number;
|
|
123
|
-
}): number => {
|
|
124
|
-
"worklet";
|
|
125
|
-
return (center - containerCenter) * (scale - 1);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export const compensateTranslationForParentScale = ({
|
|
129
|
-
translation,
|
|
130
|
-
parentScale,
|
|
131
|
-
epsilon,
|
|
132
|
-
}: {
|
|
133
|
-
translation: number;
|
|
134
|
-
parentScale: number;
|
|
135
|
-
epsilon: number;
|
|
136
|
-
}): number => {
|
|
137
|
-
"worklet";
|
|
138
|
-
const safeParentScale = Math.max(parentScale, epsilon);
|
|
139
|
-
return safeDivide(translation, safeParentScale, translation);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
export const composeCompensatedTranslation = ({
|
|
143
|
-
gesture,
|
|
144
|
-
parentScale,
|
|
145
|
-
centerShift = 0,
|
|
146
|
-
epsilon,
|
|
147
|
-
}: {
|
|
148
|
-
gesture: number;
|
|
149
|
-
parentScale: number;
|
|
150
|
-
centerShift?: number;
|
|
151
|
-
epsilon: number;
|
|
152
|
-
}): number => {
|
|
153
|
-
"worklet";
|
|
154
|
-
return (
|
|
155
|
-
compensateTranslationForParentScale({
|
|
156
|
-
translation: gesture,
|
|
157
|
-
parentScale,
|
|
158
|
-
epsilon,
|
|
159
|
-
}) + centerShift
|
|
160
|
-
);
|
|
161
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { ScreenInterpolationProps } from "../../../types/animation.types";
|
|
2
|
-
import type { BoundsNavigationOptions } from "../../../types/bounds.types";
|
|
3
|
-
import { buildNavigationStyles } from "../sugar/navigation";
|
|
4
|
-
import type { BoundsOptions } from "../types/options";
|
|
5
|
-
import type { ResolveBoundTagParams } from "./resolve-bound-tag";
|
|
6
|
-
|
|
7
|
-
type NavigationAccessorParams = {
|
|
8
|
-
id?: string;
|
|
9
|
-
group?: string;
|
|
10
|
-
getProps: () => Omit<ScreenInterpolationProps, "bounds">;
|
|
11
|
-
resolveBoundTag: (params: ResolveBoundTagParams) => string | undefined;
|
|
12
|
-
computeRaw: (
|
|
13
|
-
overrides?: Partial<BoundsOptions>,
|
|
14
|
-
frameProps?: Omit<ScreenInterpolationProps, "bounds">,
|
|
15
|
-
) => Record<string, unknown>;
|
|
16
|
-
zoomBaseOptions?: Pick<BoundsOptions, "anchor" | "scaleMode" | "target">;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const createNavigationAccessor = ({
|
|
20
|
-
id,
|
|
21
|
-
group,
|
|
22
|
-
getProps,
|
|
23
|
-
resolveBoundTag,
|
|
24
|
-
computeRaw,
|
|
25
|
-
zoomBaseOptions,
|
|
26
|
-
}: NavigationAccessorParams) => {
|
|
27
|
-
"worklet";
|
|
28
|
-
|
|
29
|
-
const resolvedId = id ?? "";
|
|
30
|
-
|
|
31
|
-
const computeNavigationPresetStyles = (
|
|
32
|
-
preset: "zoom",
|
|
33
|
-
navigationOptions?: BoundsNavigationOptions,
|
|
34
|
-
) => {
|
|
35
|
-
"worklet";
|
|
36
|
-
const frameProps = getProps();
|
|
37
|
-
return buildNavigationStyles({
|
|
38
|
-
id: resolvedId,
|
|
39
|
-
group,
|
|
40
|
-
preset,
|
|
41
|
-
navigationOptions,
|
|
42
|
-
props: frameProps,
|
|
43
|
-
resolveTag: resolveBoundTag,
|
|
44
|
-
computeRaw: (overrides) =>
|
|
45
|
-
computeRaw(
|
|
46
|
-
{
|
|
47
|
-
...(overrides ?? {}),
|
|
48
|
-
raw: true,
|
|
49
|
-
},
|
|
50
|
-
frameProps,
|
|
51
|
-
),
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
zoom: () => {
|
|
57
|
-
"worklet";
|
|
58
|
-
return computeNavigationPresetStyles("zoom", zoomBaseOptions);
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { BoundStore } from "../../../../stores/bounds";
|
|
2
|
-
import type { BoundsNavigationOptions } from "../../../../types/bounds.types";
|
|
3
|
-
import type { BoundsOptions } from "../../types/options";
|
|
4
|
-
import type { ResolveTag } from "./types";
|
|
5
|
-
|
|
6
|
-
export const toNumber = (value: unknown, fallback = 0): number => {
|
|
7
|
-
"worklet";
|
|
8
|
-
return typeof value === "number" ? value : fallback;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const resolveNavigationConfig = ({
|
|
12
|
-
id,
|
|
13
|
-
group,
|
|
14
|
-
navigationOptions,
|
|
15
|
-
currentRouteKey,
|
|
16
|
-
resolveTag,
|
|
17
|
-
defaultAnchor,
|
|
18
|
-
}: {
|
|
19
|
-
id: string;
|
|
20
|
-
group?: string;
|
|
21
|
-
navigationOptions?: BoundsNavigationOptions;
|
|
22
|
-
currentRouteKey?: string;
|
|
23
|
-
resolveTag: ResolveTag;
|
|
24
|
-
defaultAnchor: BoundsOptions["anchor"] | undefined;
|
|
25
|
-
}): {
|
|
26
|
-
resolvedTag: string;
|
|
27
|
-
sharedOptions: Partial<BoundsOptions>;
|
|
28
|
-
explicitTarget: BoundsOptions["target"] | undefined;
|
|
29
|
-
} | null => {
|
|
30
|
-
"worklet";
|
|
31
|
-
const resolvedTag = resolveTag({ id, group });
|
|
32
|
-
if (!resolvedTag) return null;
|
|
33
|
-
|
|
34
|
-
// Try direct boundary config for the current screen first.
|
|
35
|
-
const boundaryConfig = currentRouteKey
|
|
36
|
-
? BoundStore.getBoundaryConfig(resolvedTag, currentRouteKey)
|
|
37
|
-
: null;
|
|
38
|
-
|
|
39
|
-
// Fallback: when the current screen has no Boundary (e.g. a zoom detail
|
|
40
|
-
// screen without a destination element), inherit config from the link's
|
|
41
|
-
// source screen so that props like scaleMode propagate to both sides.
|
|
42
|
-
let effectiveConfig = boundaryConfig;
|
|
43
|
-
if (!effectiveConfig) {
|
|
44
|
-
// For no-destination navigation zoom, the focused route won't appear in
|
|
45
|
-
// a completed link yet. Fall back to the latest unscoped link so source
|
|
46
|
-
// boundary defaults (anchor/scaleMode/target) still propagate.
|
|
47
|
-
const scopedLink = currentRouteKey
|
|
48
|
-
? BoundStore.getActiveLink(resolvedTag, currentRouteKey)
|
|
49
|
-
: null;
|
|
50
|
-
const link = scopedLink ?? BoundStore.getActiveLink(resolvedTag);
|
|
51
|
-
if (link?.source) {
|
|
52
|
-
effectiveConfig = BoundStore.getBoundaryConfig(
|
|
53
|
-
resolvedTag,
|
|
54
|
-
link.source.screenKey,
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const sharedOptions: Partial<BoundsOptions> = {
|
|
60
|
-
...(navigationOptions ?? {}),
|
|
61
|
-
anchor:
|
|
62
|
-
navigationOptions?.anchor ?? effectiveConfig?.anchor ?? defaultAnchor,
|
|
63
|
-
scaleMode:
|
|
64
|
-
navigationOptions?.scaleMode ?? effectiveConfig?.scaleMode ?? "uniform",
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const explicitTarget = navigationOptions?.target ?? effectiveConfig?.target;
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
resolvedTag,
|
|
71
|
-
sharedOptions,
|
|
72
|
-
explicitTarget,
|
|
73
|
-
};
|
|
74
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { NO_STYLES } from "../../../../constants";
|
|
2
|
-
import type { BuildNavigationStylesParams } from "./types";
|
|
3
|
-
import { buildZoomNavigationStyles } from "./zoom";
|
|
4
|
-
|
|
5
|
-
export const buildNavigationStyles = (params: BuildNavigationStylesParams) => {
|
|
6
|
-
"worklet";
|
|
7
|
-
|
|
8
|
-
switch (params.preset) {
|
|
9
|
-
case "zoom":
|
|
10
|
-
return buildZoomNavigationStyles(params);
|
|
11
|
-
default:
|
|
12
|
-
return NO_STYLES;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ScreenInterpolationProps } from "../../../../types/animation.types";
|
|
2
|
-
import type {
|
|
3
|
-
BoundsNavigationOptions,
|
|
4
|
-
BoundsNavigationPreset,
|
|
5
|
-
} from "../../../../types/bounds.types";
|
|
6
|
-
import type { BoundsOptions } from "../../types/options";
|
|
7
|
-
|
|
8
|
-
export type ResolveTag = (params: {
|
|
9
|
-
id?: string;
|
|
10
|
-
group?: string;
|
|
11
|
-
}) => string | undefined;
|
|
12
|
-
|
|
13
|
-
export type ComputeRaw = (
|
|
14
|
-
overrides: Partial<BoundsOptions>,
|
|
15
|
-
frameProps?: Omit<ScreenInterpolationProps, "bounds">,
|
|
16
|
-
) => Record<string, unknown>;
|
|
17
|
-
|
|
18
|
-
export type BuildNavigationStylesParams = {
|
|
19
|
-
id: string;
|
|
20
|
-
group?: string;
|
|
21
|
-
preset: BoundsNavigationPreset;
|
|
22
|
-
navigationOptions?: BoundsNavigationOptions;
|
|
23
|
-
props: Omit<ScreenInterpolationProps, "bounds">;
|
|
24
|
-
resolveTag: ResolveTag;
|
|
25
|
-
computeRaw: ComputeRaw;
|
|
26
|
-
};
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
import { interpolate } from "react-native-reanimated";
|
|
2
|
-
import {
|
|
3
|
-
EPSILON,
|
|
4
|
-
NAVIGATION_CONTAINER_STYLE_ID,
|
|
5
|
-
NAVIGATION_MASK_STYLE_ID,
|
|
6
|
-
NO_STYLES,
|
|
7
|
-
} from "../../../../constants";
|
|
8
|
-
import { BoundStore } from "../../../../stores/bounds";
|
|
9
|
-
import type { TransitionInterpolatedStyle } from "../../../../types/animation.types";
|
|
10
|
-
import type { Layout } from "../../../../types/screen.types";
|
|
11
|
-
import { interpolateClamped } from "../../helpers/interpolate";
|
|
12
|
-
import {
|
|
13
|
-
combineScales,
|
|
14
|
-
composeCompensatedTranslation,
|
|
15
|
-
computeCenterScaleShift,
|
|
16
|
-
normalizedToScale,
|
|
17
|
-
normalizedToTranslation,
|
|
18
|
-
} from "../../helpers/math";
|
|
19
|
-
import type { BoundsOptions } from "../../types/options";
|
|
20
|
-
import { resolveNavigationConfig, toNumber } from "./helpers";
|
|
21
|
-
import type { BuildNavigationStylesParams } from "./types";
|
|
22
|
-
|
|
23
|
-
const DRAG_RESISTANCE = 0.4;
|
|
24
|
-
const DIRECTIONAL_DRAG_SCALE_OUTPUT = [1, 0.25] as const;
|
|
25
|
-
const IDENTITY_DRAG_SCALE_OUTPUT = [1, 1] as const;
|
|
26
|
-
|
|
27
|
-
const getZoomContentTarget = ({
|
|
28
|
-
explicitTarget,
|
|
29
|
-
resolvedTag,
|
|
30
|
-
currentRouteKey,
|
|
31
|
-
previousRouteKey,
|
|
32
|
-
nextRouteKey,
|
|
33
|
-
entering,
|
|
34
|
-
screenLayout,
|
|
35
|
-
anchor,
|
|
36
|
-
}: {
|
|
37
|
-
explicitTarget: BoundsOptions["target"] | undefined;
|
|
38
|
-
resolvedTag: string;
|
|
39
|
-
currentRouteKey?: string;
|
|
40
|
-
previousRouteKey?: string;
|
|
41
|
-
nextRouteKey?: string;
|
|
42
|
-
entering: boolean;
|
|
43
|
-
screenLayout: Layout;
|
|
44
|
-
anchor: BoundsOptions["anchor"] | undefined;
|
|
45
|
-
}) => {
|
|
46
|
-
"worklet";
|
|
47
|
-
if (explicitTarget !== undefined) return explicitTarget;
|
|
48
|
-
|
|
49
|
-
const resolvedPair = BoundStore.resolveTransitionPair(resolvedTag, {
|
|
50
|
-
currentScreenKey: currentRouteKey,
|
|
51
|
-
previousScreenKey: previousRouteKey,
|
|
52
|
-
nextScreenKey: nextRouteKey,
|
|
53
|
-
entering,
|
|
54
|
-
});
|
|
55
|
-
const sourceBounds = resolvedPair.sourceBounds;
|
|
56
|
-
const screenWidth = screenLayout.width;
|
|
57
|
-
|
|
58
|
-
if (!sourceBounds || sourceBounds.width <= 0 || screenWidth <= 0) {
|
|
59
|
-
return "fullscreen" as const;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const height = (sourceBounds.height / sourceBounds.width) * screenWidth;
|
|
63
|
-
let horizontalAnchor: "leading" | "center" | "trailing";
|
|
64
|
-
switch (anchor) {
|
|
65
|
-
case "topLeading":
|
|
66
|
-
case "leading":
|
|
67
|
-
case "bottomLeading":
|
|
68
|
-
horizontalAnchor = "leading";
|
|
69
|
-
break;
|
|
70
|
-
case "topTrailing":
|
|
71
|
-
case "trailing":
|
|
72
|
-
case "bottomTrailing":
|
|
73
|
-
horizontalAnchor = "trailing";
|
|
74
|
-
break;
|
|
75
|
-
default:
|
|
76
|
-
horizontalAnchor = "center";
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
let verticalAnchor: "top" | "center" | "bottom";
|
|
81
|
-
switch (anchor) {
|
|
82
|
-
case "topLeading":
|
|
83
|
-
case "top":
|
|
84
|
-
case "topTrailing":
|
|
85
|
-
verticalAnchor = "top";
|
|
86
|
-
break;
|
|
87
|
-
case "bottomLeading":
|
|
88
|
-
case "bottom":
|
|
89
|
-
case "bottomTrailing":
|
|
90
|
-
verticalAnchor = "bottom";
|
|
91
|
-
break;
|
|
92
|
-
default:
|
|
93
|
-
verticalAnchor = "center";
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
const x =
|
|
97
|
-
horizontalAnchor === "leading"
|
|
98
|
-
? 0
|
|
99
|
-
: horizontalAnchor === "trailing"
|
|
100
|
-
? screenLayout.width - screenWidth
|
|
101
|
-
: (screenLayout.width - screenWidth) / 2;
|
|
102
|
-
const y =
|
|
103
|
-
verticalAnchor === "top"
|
|
104
|
-
? 0
|
|
105
|
-
: verticalAnchor === "bottom"
|
|
106
|
-
? screenLayout.height - height
|
|
107
|
-
: (screenLayout.height - height) / 2;
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
x,
|
|
111
|
-
y,
|
|
112
|
-
pageX: x,
|
|
113
|
-
pageY: y,
|
|
114
|
-
width: screenWidth,
|
|
115
|
-
height,
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export const buildZoomNavigationStyles = ({
|
|
120
|
-
id,
|
|
121
|
-
group,
|
|
122
|
-
navigationOptions,
|
|
123
|
-
props,
|
|
124
|
-
resolveTag,
|
|
125
|
-
computeRaw,
|
|
126
|
-
}: BuildNavigationStylesParams): TransitionInterpolatedStyle => {
|
|
127
|
-
"worklet";
|
|
128
|
-
|
|
129
|
-
const focused = props.focused;
|
|
130
|
-
const progress = props.progress;
|
|
131
|
-
const currentRouteKey = props.current?.route.key;
|
|
132
|
-
const previousRouteKey = props.previous?.route.key;
|
|
133
|
-
const nextRouteKey = props.next?.route.key;
|
|
134
|
-
const entering = !props.next;
|
|
135
|
-
const screenLayout = props.layouts.screen;
|
|
136
|
-
|
|
137
|
-
const normX = props.active.gesture.normX;
|
|
138
|
-
const normY = props.active.gesture.normY;
|
|
139
|
-
const initialDirection = props.active.gesture.direction;
|
|
140
|
-
|
|
141
|
-
const xScaleOutput =
|
|
142
|
-
initialDirection === "horizontal"
|
|
143
|
-
? DIRECTIONAL_DRAG_SCALE_OUTPUT
|
|
144
|
-
: IDENTITY_DRAG_SCALE_OUTPUT;
|
|
145
|
-
const yScaleOutput =
|
|
146
|
-
initialDirection === "vertical"
|
|
147
|
-
? DIRECTIONAL_DRAG_SCALE_OUTPUT
|
|
148
|
-
: IDENTITY_DRAG_SCALE_OUTPUT;
|
|
149
|
-
|
|
150
|
-
const dragX = normalizedToTranslation({
|
|
151
|
-
normalized: normX,
|
|
152
|
-
dimension: screenLayout.width,
|
|
153
|
-
resistance: DRAG_RESISTANCE,
|
|
154
|
-
});
|
|
155
|
-
const dragY = normalizedToTranslation({
|
|
156
|
-
normalized: normY,
|
|
157
|
-
dimension: screenLayout.height,
|
|
158
|
-
resistance: DRAG_RESISTANCE,
|
|
159
|
-
});
|
|
160
|
-
const dragXScale = normalizedToScale({
|
|
161
|
-
normalized: normX,
|
|
162
|
-
outputRange: xScaleOutput,
|
|
163
|
-
exponent: 2,
|
|
164
|
-
});
|
|
165
|
-
const dragYScale = normalizedToScale({
|
|
166
|
-
normalized: normY,
|
|
167
|
-
outputRange: yScaleOutput,
|
|
168
|
-
exponent: 2,
|
|
169
|
-
});
|
|
170
|
-
const dragScale = combineScales(dragXScale, dragYScale);
|
|
171
|
-
|
|
172
|
-
const resolvedConfig = resolveNavigationConfig({
|
|
173
|
-
id,
|
|
174
|
-
group,
|
|
175
|
-
navigationOptions,
|
|
176
|
-
currentRouteKey,
|
|
177
|
-
resolveTag,
|
|
178
|
-
defaultAnchor: "top",
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
if (!resolvedConfig) return NO_STYLES;
|
|
182
|
-
|
|
183
|
-
const { resolvedTag, sharedOptions, explicitTarget } = resolvedConfig;
|
|
184
|
-
|
|
185
|
-
if (focused) {
|
|
186
|
-
const contentTarget = getZoomContentTarget({
|
|
187
|
-
explicitTarget,
|
|
188
|
-
resolvedTag,
|
|
189
|
-
currentRouteKey,
|
|
190
|
-
previousRouteKey,
|
|
191
|
-
nextRouteKey,
|
|
192
|
-
entering,
|
|
193
|
-
screenLayout,
|
|
194
|
-
anchor: sharedOptions.anchor,
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
const contentRaw = computeRaw({
|
|
198
|
-
...sharedOptions,
|
|
199
|
-
method: "content",
|
|
200
|
-
target: contentTarget,
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
const maskRaw = computeRaw({
|
|
204
|
-
...sharedOptions,
|
|
205
|
-
method: "size",
|
|
206
|
-
space: "absolute",
|
|
207
|
-
target: "fullscreen",
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
const focusedFade = props.active?.closing
|
|
211
|
-
? interpolate(progress, [0.6, 1], [0, 1], "clamp")
|
|
212
|
-
: interpolate(progress, [0, 0.5], [0, 1], "clamp");
|
|
213
|
-
const maskWidth = Math.max(1, toNumber(maskRaw.width));
|
|
214
|
-
const maskHeight = Math.max(1, toNumber(maskRaw.height));
|
|
215
|
-
const contentTranslateX = toNumber(contentRaw.translateX) + dragX;
|
|
216
|
-
const contentTranslateY = toNumber(contentRaw.translateY) + dragY;
|
|
217
|
-
const contentScale = toNumber(contentRaw.scale, 1) * dragScale;
|
|
218
|
-
const maskTranslateX = toNumber(maskRaw.translateX) + dragX;
|
|
219
|
-
const maskTranslateY = toNumber(maskRaw.translateY) + dragY;
|
|
220
|
-
|
|
221
|
-
return {
|
|
222
|
-
[NAVIGATION_CONTAINER_STYLE_ID]: {
|
|
223
|
-
style: {
|
|
224
|
-
opacity: focusedFade,
|
|
225
|
-
transform: [
|
|
226
|
-
{ translateX: contentTranslateX },
|
|
227
|
-
{ translateY: contentTranslateY },
|
|
228
|
-
{ scale: contentScale },
|
|
229
|
-
],
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
[NAVIGATION_MASK_STYLE_ID]: {
|
|
233
|
-
style: {
|
|
234
|
-
width: maskWidth,
|
|
235
|
-
height: maskHeight,
|
|
236
|
-
transform: [
|
|
237
|
-
{ translateX: maskTranslateX },
|
|
238
|
-
{ translateY: maskTranslateY },
|
|
239
|
-
{ scale: dragScale },
|
|
240
|
-
],
|
|
241
|
-
borderRadius: 12,
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
// Signal the destination boundary to stay visible during the transition.
|
|
245
|
-
// Without this, useAssociatedStyles enters "waiting-first-style" mode
|
|
246
|
-
// (opacity: 0) because it detects previous-screen evidence but never
|
|
247
|
-
// receives a resolved style for this tag.
|
|
248
|
-
[resolvedTag]: {
|
|
249
|
-
style: { opacity: 1 },
|
|
250
|
-
},
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const unfocusedFade = props.active?.closing
|
|
255
|
-
? interpolate(progress, [1.6, 2], [1, 0], "clamp")
|
|
256
|
-
: interpolate(progress, [1, 1.5], [1, 0], "clamp");
|
|
257
|
-
const unfocusedScale = interpolateClamped(progress, [1, 2], [1, 0.95]);
|
|
258
|
-
const isUnfocusedIdle = props.active.settled === 1;
|
|
259
|
-
|
|
260
|
-
const elementTarget =
|
|
261
|
-
sharedOptions.scaleMode === "match"
|
|
262
|
-
? ("fullscreen" as const)
|
|
263
|
-
: getZoomContentTarget({
|
|
264
|
-
explicitTarget,
|
|
265
|
-
resolvedTag,
|
|
266
|
-
currentRouteKey,
|
|
267
|
-
previousRouteKey,
|
|
268
|
-
nextRouteKey,
|
|
269
|
-
entering,
|
|
270
|
-
screenLayout,
|
|
271
|
-
anchor: sharedOptions.anchor,
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
const elementRaw = computeRaw({
|
|
275
|
-
...sharedOptions,
|
|
276
|
-
method: "transform",
|
|
277
|
-
space: "relative",
|
|
278
|
-
target: elementTarget,
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
// Keep compensation tied to the element target's center. In `scaleMode: "match"`
|
|
282
|
-
// this target is fullscreen, so the center offset should resolve to zero.
|
|
283
|
-
const elementCenterY =
|
|
284
|
-
typeof elementTarget === "object"
|
|
285
|
-
? elementTarget.pageY + elementTarget.height / 2
|
|
286
|
-
: screenLayout.height / 2;
|
|
287
|
-
|
|
288
|
-
const scaleShiftY = computeCenterScaleShift({
|
|
289
|
-
center: elementCenterY,
|
|
290
|
-
containerCenter: screenLayout.height / 2,
|
|
291
|
-
scale: dragScale,
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
const compensatedGestureX = composeCompensatedTranslation({
|
|
295
|
-
gesture: dragX,
|
|
296
|
-
parentScale: unfocusedScale,
|
|
297
|
-
epsilon: EPSILON,
|
|
298
|
-
});
|
|
299
|
-
// dragY is measured in screen space and must be unscaled by the parent
|
|
300
|
-
// content shrink, while scaleShiftY is already in the parent's local space.
|
|
301
|
-
const compensatedGestureY = composeCompensatedTranslation({
|
|
302
|
-
gesture: dragY,
|
|
303
|
-
parentScale: unfocusedScale,
|
|
304
|
-
centerShift: scaleShiftY,
|
|
305
|
-
epsilon: EPSILON,
|
|
306
|
-
});
|
|
307
|
-
const elementTranslateX =
|
|
308
|
-
toNumber(elementRaw.translateX) + compensatedGestureX;
|
|
309
|
-
const elementTranslateY =
|
|
310
|
-
toNumber(elementRaw.translateY) + compensatedGestureY;
|
|
311
|
-
const elementScaleX = toNumber(elementRaw.scaleX, 1) * dragScale;
|
|
312
|
-
const elementScaleY = toNumber(elementRaw.scaleY, 1) * dragScale;
|
|
313
|
-
|
|
314
|
-
const resolvedElementStyle = isUnfocusedIdle
|
|
315
|
-
? {
|
|
316
|
-
transform: [
|
|
317
|
-
{ translateX: 0 },
|
|
318
|
-
{ translateY: 0 },
|
|
319
|
-
{ scaleX: 1 },
|
|
320
|
-
{ scaleY: 1 },
|
|
321
|
-
],
|
|
322
|
-
opacity: 0,
|
|
323
|
-
zIndex: 0,
|
|
324
|
-
elevation: 0,
|
|
325
|
-
}
|
|
326
|
-
: {
|
|
327
|
-
transform: [
|
|
328
|
-
{ translateX: elementTranslateX },
|
|
329
|
-
{ translateY: elementTranslateY },
|
|
330
|
-
{ scaleX: elementScaleX },
|
|
331
|
-
{ scaleY: elementScaleY },
|
|
332
|
-
],
|
|
333
|
-
opacity: unfocusedFade,
|
|
334
|
-
zIndex: 9999,
|
|
335
|
-
elevation: 9999,
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
return {
|
|
339
|
-
content: {
|
|
340
|
-
style: {
|
|
341
|
-
transform: [{ scale: unfocusedScale }],
|
|
342
|
-
},
|
|
343
|
-
},
|
|
344
|
-
[resolvedTag]: {
|
|
345
|
-
style: resolvedElementStyle,
|
|
346
|
-
},
|
|
347
|
-
};
|
|
348
|
-
};
|
|
File without changes
|
|
File without changes
|