react-native-screen-transitions 3.9.0 → 3.10.0
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/shared/animation/snap-to.js +2 -0
- package/lib/commonjs/shared/animation/snap-to.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/components/boundary-target.js +19 -20
- package/lib/commonjs/shared/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/create-boundary-component.js +16 -2
- package/lib/commonjs/shared/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js +5 -0
- package/lib/commonjs/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js +1 -3
- package/lib/commonjs/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/index.js +4 -3
- package/lib/commonjs/shared/components/boundary/index.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +47 -187
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js +21 -13
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/host.js +1 -12
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +40 -33
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js +3 -4
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +46 -130
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js +45 -9
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +2 -29
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/handoff-target.js +33 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/handoff-target.js.map +1 -0
- package/lib/commonjs/shared/components/boundary/portal/utils/resolve-portal.js +19 -15
- package/lib/commonjs/shared/components/boundary/portal/utils/resolve-portal.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/teleport-control.js +1 -10
- package/lib/commonjs/shared/components/boundary/portal/utils/teleport-control.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js +18 -36
- package/lib/commonjs/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js +7 -0
- package/lib/commonjs/shared/components/boundary/utils/refresh-signals.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/utils/resolve-boundary-target.js +29 -0
- package/lib/commonjs/shared/components/boundary/utils/resolve-boundary-target.js.map +1 -0
- package/lib/commonjs/shared/components/masked-view.js +9 -1
- package/lib/commonjs/shared/components/masked-view.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js +3 -1
- package/lib/commonjs/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/commonjs/shared/components/screen-container/layers/maybe-masked-navigation-container.js +9 -1
- 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-transition-start-controller.js +2 -0
- package/lib/commonjs/shared/components/screen-lifecycle/hooks/use-transition-start-controller.js.map +1 -1
- package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js +4 -1
- package/lib/commonjs/shared/providers/helpers/measured-bounds-writes.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/gestures.provider.js +2 -8
- package/lib/commonjs/shared/providers/screen/gestures/gestures.provider.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.js +1 -0
- package/lib/commonjs/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js +37 -3
- package/lib/commonjs/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +1 -0
- package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-release.js +3 -2
- package/lib/commonjs/shared/providers/screen/gestures/pinch/behavior/pinch-release.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/gestures/types.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/transition-visual-state.js +42 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/transition-visual-state.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/visibility-gate.js +11 -5
- package/lib/commonjs/shared/providers/screen/styles/helpers/visibility-gate.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +23 -10
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +10 -8
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/links.js +4 -4
- package/lib/commonjs/shared/stores/bounds/internals/links.js.map +1 -1
- package/lib/commonjs/shared/stores/scroll.store.js +20 -2
- package/lib/commonjs/shared/stores/scroll.store.js.map +1 -1
- package/lib/commonjs/shared/stores/system.store.js +2 -0
- package/lib/commonjs/shared/stores/system.store.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js +23 -1
- package/lib/commonjs/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/animate.js +14 -2
- package/lib/commonjs/shared/utils/animation/animate.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/spring/spring.js +22 -2
- package/lib/commonjs/shared/utils/animation/spring/spring.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/spring/springUtils.js +96 -0
- package/lib/commonjs/shared/utils/animation/spring/springUtils.js.map +1 -1
- package/lib/commonjs/shared/utils/animation/state.js +4 -0
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js +17 -5
- package/lib/commonjs/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js +44 -20
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/drag.js +2 -31
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/drag.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/helpers.js +3 -17
- package/lib/commonjs/shared/utils/bounds/navigation/zoom/helpers.js.map +1 -1
- package/lib/module/shared/animation/snap-to.js +2 -0
- package/lib/module/shared/animation/snap-to.js.map +1 -1
- package/lib/module/shared/components/boundary/components/boundary-target.js +19 -20
- package/lib/module/shared/components/boundary/components/boundary-target.js.map +1 -1
- package/lib/module/shared/components/boundary/create-boundary-component.js +17 -3
- package/lib/module/shared/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js +5 -0
- package/lib/module/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.js.map +1 -1
- package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js +1 -3
- package/lib/module/shared/components/boundary/hooks/use-boundary-measurement.js.map +1 -1
- package/lib/module/shared/components/boundary/index.js +3 -2
- package/lib/module/shared/components/boundary/index.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js +49 -189
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js +21 -13
- package/lib/module/shared/components/boundary/portal/components/boundary-content-portal/index.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/host.js +2 -13
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js +43 -36
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js +3 -4
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js +50 -134
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js +44 -9
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/index.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js +1 -27
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/utils/handoff-target.js +28 -0
- package/lib/module/shared/components/boundary/portal/utils/handoff-target.js.map +1 -0
- package/lib/module/shared/components/boundary/portal/utils/resolve-portal.js +19 -15
- package/lib/module/shared/components/boundary/portal/utils/resolve-portal.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/utils/teleport-control.js +0 -8
- package/lib/module/shared/components/boundary/portal/utils/teleport-control.js.map +1 -1
- package/lib/module/shared/components/boundary/providers/boundary-root.provider.js +19 -37
- package/lib/module/shared/components/boundary/providers/boundary-root.provider.js.map +1 -1
- package/lib/module/shared/components/boundary/utils/refresh-signals.js +7 -0
- package/lib/module/shared/components/boundary/utils/refresh-signals.js.map +1 -1
- package/lib/module/shared/components/boundary/utils/resolve-boundary-target.js +24 -0
- package/lib/module/shared/components/boundary/utils/resolve-boundary-target.js.map +1 -0
- package/lib/module/shared/components/masked-view.js +10 -2
- package/lib/module/shared/components/masked-view.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js +3 -1
- package/lib/module/shared/components/screen-container/layers/backdrop.js.map +1 -1
- package/lib/module/shared/components/screen-container/layers/maybe-masked-navigation-container.js +10 -2
- 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-transition-start-controller.js +2 -0
- package/lib/module/shared/components/screen-lifecycle/hooks/use-transition-start-controller.js.map +1 -1
- package/lib/module/shared/providers/helpers/measured-bounds-writes.js +4 -1
- package/lib/module/shared/providers/helpers/measured-bounds-writes.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/gestures.provider.js +2 -8
- package/lib/module/shared/providers/screen/gestures/gestures.provider.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.js +1 -0
- package/lib/module/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js +35 -2
- package/lib/module/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js +1 -0
- package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-release.js +3 -2
- package/lib/module/shared/providers/screen/gestures/pinch/behavior/pinch-release.js.map +1 -1
- package/lib/module/shared/providers/screen/gestures/types.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/transition-visual-state.js +35 -0
- package/lib/module/shared/providers/screen/styles/helpers/transition-visual-state.js.map +1 -0
- package/lib/module/shared/providers/screen/styles/helpers/visibility-gate.js +11 -5
- package/lib/module/shared/providers/screen/styles/helpers/visibility-gate.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +23 -10
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js +10 -8
- package/lib/module/shared/providers/screen/styles/hooks/use-maybe-block-visibility.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/links.js +4 -4
- package/lib/module/shared/stores/bounds/internals/links.js.map +1 -1
- package/lib/module/shared/stores/scroll.store.js +17 -0
- package/lib/module/shared/stores/scroll.store.js.map +1 -1
- package/lib/module/shared/stores/system.store.js +2 -0
- package/lib/module/shared/stores/system.store.js.map +1 -1
- package/lib/module/shared/utils/animation/animate-to-progress.js +21 -0
- package/lib/module/shared/utils/animation/animate-to-progress.js.map +1 -1
- package/lib/module/shared/utils/animation/animate.js +14 -2
- package/lib/module/shared/utils/animation/animate.js.map +1 -1
- package/lib/module/shared/utils/animation/spring/spring.js +23 -3
- package/lib/module/shared/utils/animation/spring/spring.js.map +1 -1
- package/lib/module/shared/utils/animation/spring/springUtils.js +95 -0
- package/lib/module/shared/utils/animation/spring/springUtils.js.map +1 -1
- package/lib/module/shared/utils/animation/state.js +2 -0
- package/lib/module/shared/utils/bounds/navigation/reveal/math.js +16 -5
- package/lib/module/shared/utils/bounds/navigation/reveal/math.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/build.js +46 -22
- package/lib/module/shared/utils/bounds/navigation/zoom/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/drag.js +2 -30
- package/lib/module/shared/utils/bounds/navigation/zoom/drag.js.map +1 -1
- package/lib/module/shared/utils/bounds/navigation/zoom/helpers.js +4 -18
- package/lib/module/shared/utils/bounds/navigation/zoom/helpers.js.map +1 -1
- package/lib/typescript/shared/animation/snap-to.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts +2 -1
- package/lib/typescript/shared/components/boundary/components/boundary-target.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/create-boundary-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/hooks/use-boundary-measurement.d.ts +3 -4
- package/lib/typescript/shared/components/boundary/hooks/use-boundary-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/index.d.ts +6 -9
- package/lib/typescript/shared/components/boundary/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts +1 -3
- package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-content-portal/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts +1 -10
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts +1 -3
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts +2 -2
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/index.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.d.ts +0 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts +1 -10
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/utils/handoff-target.d.ts +12 -0
- package/lib/typescript/shared/components/boundary/portal/utils/handoff-target.d.ts.map +1 -0
- package/lib/typescript/shared/components/boundary/portal/utils/resolve-portal.d.ts +2 -3
- package/lib/typescript/shared/components/boundary/portal/utils/resolve-portal.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/utils/teleport-control.d.ts +0 -4
- package/lib/typescript/shared/components/boundary/portal/utils/teleport-control.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts +8 -12
- package/lib/typescript/shared/components/boundary/providers/boundary-root.provider.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/utils/refresh-signals.d.ts +1 -0
- package/lib/typescript/shared/components/boundary/utils/refresh-signals.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/utils/resolve-boundary-target.d.ts +12 -0
- package/lib/typescript/shared/components/boundary/utils/resolve-boundary-target.d.ts.map +1 -0
- package/lib/typescript/shared/components/masked-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/maybe-masked-navigation-container.d.ts.map +1 -1
- package/lib/typescript/shared/components/screen-lifecycle/hooks/use-transition-start-controller.d.ts.map +1 -1
- package/lib/typescript/shared/providers/helpers/measured-bounds-writes.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/gestures.provider.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.d.ts +2 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/pinch/behavior/pinch-release.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/gestures/types.d.ts +1 -9
- package/lib/typescript/shared/providers/screen/gestures/types.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/transition-visual-state.d.ts +18 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/transition-visual-state.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/visibility-gate.d.ts +2 -2
- package/lib/typescript/shared/providers/screen/styles/helpers/visibility-gate.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/hooks/use-maybe-block-visibility.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/links.d.ts +1 -1
- package/lib/typescript/shared/stores/bounds/internals/links.d.ts.map +1 -1
- package/lib/typescript/shared/stores/scroll.store.d.ts +7 -0
- package/lib/typescript/shared/stores/scroll.store.d.ts.map +1 -1
- package/lib/typescript/shared/stores/system.store.d.ts +5 -0
- package/lib/typescript/shared/stores/system.store.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts +6 -1
- package/lib/typescript/shared/utils/animation/animate-to-progress.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/animate.d.ts +2 -2
- package/lib/typescript/shared/utils/animation/animate.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/spring/spring.d.ts +2 -2
- package/lib/typescript/shared/utils/animation/spring/spring.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/spring/springUtils.d.ts +3 -0
- package/lib/typescript/shared/utils/animation/spring/springUtils.d.ts.map +1 -1
- package/lib/typescript/shared/utils/animation/state.d.ts +6 -0
- package/lib/typescript/shared/utils/animation/state.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts +9 -0
- package/lib/typescript/shared/utils/bounds/navigation/reveal/math.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/drag.d.ts +2 -11
- package/lib/typescript/shared/utils/bounds/navigation/zoom/drag.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/navigation/zoom/helpers.d.ts +7 -4
- package/lib/typescript/shared/utils/bounds/navigation/zoom/helpers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/animation/snap-to.ts +5 -0
- package/src/shared/components/boundary/components/boundary-target.tsx +37 -23
- package/src/shared/components/boundary/create-boundary-component.tsx +29 -3
- package/src/shared/components/boundary/hooks/lifecycles/use-refresh-boundary.ts +11 -0
- package/src/shared/components/boundary/hooks/use-boundary-measurement.ts +3 -9
- package/src/shared/components/boundary/index.tsx +4 -8
- package/src/shared/components/boundary/portal/components/boundary-content-portal/hooks/use-boundary-content-portal-attachment.ts +73 -275
- package/src/shared/components/boundary/portal/components/boundary-content-portal/index.tsx +31 -12
- package/src/shared/components/boundary/portal/components/boundary-portal/components/host.tsx +2 -12
- package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-boundary-host.tsx +64 -62
- package/src/shared/components/boundary/portal/components/boundary-portal/helpers/offset-style.ts +2 -9
- package/src/shared/components/boundary/portal/components/boundary-portal/hooks/use-boundary-portal-attachment.ts +73 -186
- package/src/shared/components/boundary/portal/components/boundary-portal/index.tsx +72 -12
- package/src/shared/components/boundary/portal/components/boundary-portal/stores/host-registry.store.ts +0 -1
- package/src/shared/components/boundary/portal/components/boundary-portal/stores/portal-boundary-host.store.ts +2 -39
- package/src/shared/components/boundary/portal/utils/handoff-target.ts +48 -0
- package/src/shared/components/boundary/portal/utils/resolve-portal.ts +26 -18
- package/src/shared/components/boundary/portal/utils/teleport-control.ts +0 -12
- package/src/shared/components/boundary/providers/boundary-root.provider.tsx +28 -80
- package/src/shared/components/boundary/utils/refresh-signals.ts +8 -0
- package/src/shared/components/boundary/utils/resolve-boundary-target.tsx +39 -0
- package/src/shared/components/masked-view.tsx +20 -4
- package/src/shared/components/screen-container/layers/backdrop.tsx +3 -1
- package/src/shared/components/screen-container/layers/maybe-masked-navigation-container.tsx +14 -4
- package/src/shared/components/screen-lifecycle/hooks/use-transition-start-controller.ts +2 -0
- package/src/shared/providers/helpers/measured-bounds-writes.ts +1 -0
- package/src/shared/providers/screen/gestures/gestures.provider.tsx +2 -10
- package/src/shared/providers/screen/gestures/pan/behavior/pan-lifecycle.ts +1 -0
- package/src/shared/providers/screen/gestures/pinch/activation/use-pinch-activation.ts +74 -3
- package/src/shared/providers/screen/gestures/pinch/behavior/pinch-lifecycle.ts +1 -0
- package/src/shared/providers/screen/gestures/pinch/behavior/pinch-release.ts +2 -4
- package/src/shared/providers/screen/gestures/types.ts +0 -14
- package/src/shared/providers/screen/styles/helpers/transition-visual-state.ts +44 -0
- package/src/shared/providers/screen/styles/helpers/visibility-gate.ts +17 -7
- package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +30 -15
- package/src/shared/providers/screen/styles/hooks/use-maybe-block-visibility.tsx +14 -13
- package/src/shared/stores/bounds/internals/links.ts +13 -2
- package/src/shared/stores/scroll.store.ts +23 -0
- package/src/shared/stores/system.store.ts +8 -0
- package/src/shared/utils/animation/animate-to-progress.ts +59 -28
- package/src/shared/utils/animation/animate.ts +18 -2
- package/src/shared/utils/animation/spring/spring.ts +36 -1
- package/src/shared/utils/animation/spring/springUtils.ts +130 -0
- package/src/shared/utils/animation/state.ts +8 -0
- package/src/shared/utils/bounds/navigation/reveal/math.ts +21 -5
- package/src/shared/utils/bounds/navigation/zoom/build.ts +77 -23
- package/src/shared/utils/bounds/navigation/zoom/drag.ts +3 -42
- package/src/shared/utils/bounds/navigation/zoom/helpers.ts +9 -23
- package/lib/commonjs/shared/components/boundary/hooks/use-register-target.js +0 -32
- package/lib/commonjs/shared/components/boundary/hooks/use-register-target.js.map +0 -1
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +0 -51
- package/lib/commonjs/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +0 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js +0 -220
- package/lib/commonjs/shared/components/boundary/portal/utils/ownership.js.map +0 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/shallow-equal.js +0 -29
- package/lib/commonjs/shared/components/boundary/portal/utils/shallow-equal.js.map +0 -1
- package/lib/commonjs/shared/components/boundary/portal/utils/visible-host.js +0 -25
- package/lib/commonjs/shared/components/boundary/portal/utils/visible-host.js.map +0 -1
- package/lib/commonjs/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.js +0 -64
- package/lib/commonjs/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.js.map +0 -1
- package/lib/commonjs/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.js +0 -21
- package/lib/commonjs/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.js.map +0 -1
- package/lib/commonjs/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.js +0 -29
- package/lib/commonjs/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.js.map +0 -1
- package/lib/commonjs/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.js +0 -38
- package/lib/commonjs/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.js.map +0 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/opening-phase.js +0 -32
- package/lib/commonjs/shared/providers/screen/styles/helpers/opening-phase.js.map +0 -1
- package/lib/module/shared/components/boundary/hooks/use-register-target.js +0 -27
- package/lib/module/shared/components/boundary/hooks/use-register-target.js.map +0 -1
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js +0 -46
- package/lib/module/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.js.map +0 -1
- package/lib/module/shared/components/boundary/portal/utils/ownership.js +0 -213
- package/lib/module/shared/components/boundary/portal/utils/ownership.js.map +0 -1
- package/lib/module/shared/components/boundary/portal/utils/shallow-equal.js +0 -24
- package/lib/module/shared/components/boundary/portal/utils/shallow-equal.js.map +0 -1
- package/lib/module/shared/components/boundary/portal/utils/visible-host.js +0 -20
- package/lib/module/shared/components/boundary/portal/utils/visible-host.js.map +0 -1
- package/lib/module/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.js +0 -59
- package/lib/module/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.js.map +0 -1
- package/lib/module/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.js +0 -15
- package/lib/module/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.js.map +0 -1
- package/lib/module/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.js +0 -24
- package/lib/module/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.js.map +0 -1
- package/lib/module/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.js +0 -33
- package/lib/module/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.js.map +0 -1
- package/lib/module/shared/providers/screen/styles/helpers/opening-phase.js +0 -26
- package/lib/module/shared/providers/screen/styles/helpers/opening-phase.js.map +0 -1
- package/lib/typescript/shared/components/boundary/hooks/use-register-target.d.ts +0 -10
- package/lib/typescript/shared/components/boundary/hooks/use-register-target.d.ts.map +0 -1
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts +0 -13
- package/lib/typescript/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.d.ts.map +0 -1
- package/lib/typescript/shared/components/boundary/portal/utils/ownership.d.ts +0 -34
- package/lib/typescript/shared/components/boundary/portal/utils/ownership.d.ts.map +0 -1
- package/lib/typescript/shared/components/boundary/portal/utils/shallow-equal.d.ts +0 -8
- package/lib/typescript/shared/components/boundary/portal/utils/shallow-equal.d.ts.map +0 -1
- package/lib/typescript/shared/components/boundary/portal/utils/visible-host.d.ts +0 -8
- package/lib/typescript/shared/components/boundary/portal/utils/visible-host.d.ts.map +0 -1
- package/lib/typescript/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.d.ts +0 -15
- package/lib/typescript/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.d.ts.map +0 -1
- package/lib/typescript/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.d.ts +0 -4
- package/lib/typescript/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.d.ts.map +0 -1
- package/lib/typescript/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.d.ts +0 -5
- package/lib/typescript/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.d.ts.map +0 -1
- package/lib/typescript/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.d.ts +0 -9
- package/lib/typescript/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.d.ts.map +0 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/opening-phase.d.ts +0 -16
- package/lib/typescript/shared/providers/screen/styles/helpers/opening-phase.d.ts.map +0 -1
- package/src/shared/components/boundary/hooks/use-register-target.ts +0 -43
- package/src/shared/components/boundary/portal/components/boundary-portal/components/portal-slot.tsx +0 -79
- package/src/shared/components/boundary/portal/utils/ownership.ts +0 -319
- package/src/shared/components/boundary/portal/utils/shallow-equal.ts +0 -25
- package/src/shared/components/boundary/portal/utils/visible-host.ts +0 -24
- package/src/shared/providers/screen/gestures/rotation/activation/use-rotation-activation.ts +0 -88
- package/src/shared/providers/screen/gestures/rotation/behavior/rotation-lifecycle.ts +0 -19
- package/src/shared/providers/screen/gestures/rotation/behavior/use-rotation-behavior.ts +0 -47
- package/src/shared/providers/screen/gestures/rotation/use-build-rotation-gesture.ts +0 -50
- package/src/shared/providers/screen/styles/helpers/opening-phase.ts +0 -25
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { withTiming } from "react-native-reanimated";
|
|
4
4
|
import { withInternalSpring } from "./spring";
|
|
5
|
+
const linearEasing = progress => {
|
|
6
|
+
"worklet";
|
|
7
|
+
|
|
8
|
+
return progress;
|
|
9
|
+
};
|
|
5
10
|
export const isSpringAnimationConfig = config => {
|
|
6
11
|
"worklet";
|
|
7
12
|
|
|
@@ -10,10 +15,17 @@ export const isSpringAnimationConfig = config => {
|
|
|
10
15
|
}
|
|
11
16
|
return "stiffness" in config || "damping" in config || "mass" in config || "velocity" in config || "overshootClamping" in config || "energyThreshold" in config || "dampingRatio" in config || "clamp" in config;
|
|
12
17
|
};
|
|
13
|
-
export const animate = (toValue, config, callback) => {
|
|
18
|
+
export const animate = (toValue, config, callback, animationProgress) => {
|
|
14
19
|
"worklet";
|
|
15
20
|
|
|
16
21
|
if (!isSpringAnimationConfig(config)) {
|
|
22
|
+
if (animationProgress) {
|
|
23
|
+
animationProgress.value.set(animationProgress.from);
|
|
24
|
+
animationProgress.value.set(withTiming(animationProgress.to, {
|
|
25
|
+
...config,
|
|
26
|
+
easing: linearEasing
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
17
29
|
return withTiming(toValue, config, finished => {
|
|
18
30
|
"worklet";
|
|
19
31
|
|
|
@@ -24,6 +36,6 @@ export const animate = (toValue, config, callback) => {
|
|
|
24
36
|
});
|
|
25
37
|
});
|
|
26
38
|
}
|
|
27
|
-
return withInternalSpring(toValue, config, callback);
|
|
39
|
+
return withInternalSpring(toValue, config, callback, animationProgress);
|
|
28
40
|
};
|
|
29
41
|
//# sourceMappingURL=animate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withTiming","withInternalSpring","isSpringAnimationConfig","config","animate","toValue","callback","finished","didFinish","settled"],"sourceRoot":"../../../../../src","sources":["shared/utils/animation/animate.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,yBAAyB;AACpD,SAA4BC,kBAAkB,QAAQ,UAAU;AAShE,OAAO,MAAMC,uBAAuB,GACnCC,MAAyC,IACJ;EACrC,SAAS;;EACT,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IAClD,OAAO,KAAK;EACb;EAEA,OACC,WAAW,IAAIA,MAAM,IACrB,SAAS,IAAIA,MAAM,IACnB,MAAM,IAAIA,MAAM,IAChB,UAAU,IAAIA,MAAM,IACpB,mBAAmB,IAAIA,MAAM,IAC7B,iBAAiB,IAAIA,MAAM,IAC3B,cAAc,IAAIA,MAAM,IACxB,OAAO,IAAIA,MAAM;AAEnB,CAAC;AAED,OAAO,MAAMC,OAAO,GAAGA,CACtBC,OAAe,EACfF,MAA8B,EAC9BG,QAAiC,
|
|
1
|
+
{"version":3,"names":["withTiming","withInternalSpring","linearEasing","progress","isSpringAnimationConfig","config","animate","toValue","callback","animationProgress","value","set","from","to","easing","finished","didFinish","settled"],"sourceRoot":"../../../../../src","sources":["shared/utils/animation/animate.ts"],"mappings":";;AACA,SAASA,UAAU,QAAQ,yBAAyB;AACpD,SAA4BC,kBAAkB,QAAQ,UAAU;AAShE,MAAMC,YAAY,GAAIC,QAAgB,IAAK;EAC1C,SAAS;;EACT,OAAOA,QAAQ;AAChB,CAAC;AAED,OAAO,MAAMC,uBAAuB,GACnCC,MAAyC,IACJ;EACrC,SAAS;;EACT,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IAClD,OAAO,KAAK;EACb;EAEA,OACC,WAAW,IAAIA,MAAM,IACrB,SAAS,IAAIA,MAAM,IACnB,MAAM,IAAIA,MAAM,IAChB,UAAU,IAAIA,MAAM,IACpB,mBAAmB,IAAIA,MAAM,IAC7B,iBAAiB,IAAIA,MAAM,IAC3B,cAAc,IAAIA,MAAM,IACxB,OAAO,IAAIA,MAAM;AAEnB,CAAC;AAED,OAAO,MAAMC,OAAO,GAAGA,CACtBC,OAAe,EACfF,MAA8B,EAC9BG,QAAiC,EACjCC,iBAA2C,KACvC;EACJ,SAAS;;EAET,IAAI,CAACL,uBAAuB,CAACC,MAAM,CAAC,EAAE;IACrC,IAAII,iBAAiB,EAAE;MACtBA,iBAAiB,CAACC,KAAK,CAACC,GAAG,CAACF,iBAAiB,CAACG,IAAI,CAAC;MACnDH,iBAAiB,CAACC,KAAK,CAACC,GAAG,CAC1BX,UAAU,CAACS,iBAAiB,CAACI,EAAE,EAAE;QAChC,GAAGR,MAAM;QACTS,MAAM,EAAEZ;MACT,CAAC,CACF,CAAC;IACF;IAEA,OAAOF,UAAU,CAACO,OAAO,EAAEF,MAAM,EAAGU,QAAQ,IAAK;MAChD,SAAS;;MACT,MAAMC,SAAS,GAAGD,QAAQ,KAAK,IAAI;MACnCP,QAAQ,GAAG;QACVO,QAAQ,EAAEC,SAAS;QACnBC,OAAO,EAAED;MACV,CAAC,CAAC;IACH,CAAC,CAAC;EACH;EAEA,OAAOf,kBAAkB,CAACM,OAAO,EAAEF,MAAM,EAAEG,QAAQ,EAAEC,iBAAiB,CAAC;AACxE,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { calculateNewStiffnessToMatchDuration, checkIfConfigIsValid, criticallyDampedSpringCalculations, getEnergy, initialCalculations, isAnimationSettledCalculation, isAnimationTerminatingCalculation, safeMergeConfigs, scaleZetaToMatchClamps, underDampedSpringCalculations } from "./springUtils";
|
|
3
|
+
import { calculateNewStiffnessToMatchDuration, calculateSpringAnimationDuration, checkIfConfigIsValid, criticallyDampedSpringCalculations, getEnergy, initialCalculations, isAnimationSettledCalculation, isAnimationTerminatingCalculation, safeMergeConfigs, scaleZetaToMatchClamps, underDampedSpringCalculations } from "./springUtils";
|
|
4
4
|
const REACT_NATIVE_RUNTIME_KIND = 1;
|
|
5
5
|
const REDUCE_MOTION_SYSTEM = "system";
|
|
6
6
|
const REDUCE_MOTION_ALWAYS = "always";
|
|
7
7
|
const DEFAULT_SPRING_SETTLE_DISTANCE = 0.001;
|
|
8
|
+
const MAX_UNFINISHED_ANIMATION_PROGRESS = 1 - 1e-6;
|
|
8
9
|
const DEFAULT_SPRING_CONFIG = {
|
|
9
10
|
damping: 120,
|
|
10
11
|
mass: 4,
|
|
@@ -30,7 +31,7 @@ const getReduceMotionForAnimation = config => {
|
|
|
30
31
|
}
|
|
31
32
|
return config === REDUCE_MOTION_ALWAYS;
|
|
32
33
|
};
|
|
33
|
-
const defineSpringAnimation = (_starting, factory) => {
|
|
34
|
+
const defineSpringAnimation = (_starting, factory, onReducedMotion) => {
|
|
34
35
|
"worklet";
|
|
35
36
|
|
|
36
37
|
const create = () => {
|
|
@@ -42,6 +43,7 @@ const defineSpringAnimation = (_starting, factory) => {
|
|
|
42
43
|
"worklet";
|
|
43
44
|
|
|
44
45
|
if (animation.reduceMotion) {
|
|
46
|
+
onReducedMotion?.();
|
|
45
47
|
animation.current = animation.toValue;
|
|
46
48
|
animation.onFrame = () => true;
|
|
47
49
|
return;
|
|
@@ -74,9 +76,10 @@ const defineSpringAnimation = (_starting, factory) => {
|
|
|
74
76
|
* to the native spring handoff behavior while keeping our own surface small and
|
|
75
77
|
* easy to extend with callbacks tailored to the transition lifecycle.
|
|
76
78
|
*/
|
|
77
|
-
export const withInternalSpring = (toValue, userConfig, callback) => {
|
|
79
|
+
export const withInternalSpring = (toValue, userConfig, callback, animationProgress) => {
|
|
78
80
|
"worklet";
|
|
79
81
|
|
|
82
|
+
// biome-ignore format: Keep this Reanimated fork aligned with its upstream layout.
|
|
80
83
|
return defineSpringAnimation(toValue, () => {
|
|
81
84
|
"worklet";
|
|
82
85
|
|
|
@@ -115,6 +118,7 @@ export const withInternalSpring = (toValue, userConfig, callback) => {
|
|
|
115
118
|
} = animation;
|
|
116
119
|
if (config.skipAnimation) {
|
|
117
120
|
animation.current = toValue;
|
|
121
|
+
animationProgress?.value.set(animationProgress.to);
|
|
118
122
|
animation.lastTimestamp = 0;
|
|
119
123
|
return true;
|
|
120
124
|
}
|
|
@@ -124,6 +128,7 @@ export const withInternalSpring = (toValue, userConfig, callback) => {
|
|
|
124
128
|
} = animation;
|
|
125
129
|
const deltaTime = Math.min(Math.max(now - lastTimestamp, 0), 64);
|
|
126
130
|
animation.lastTimestamp = now;
|
|
131
|
+
animation.animationProgressElapsed += deltaTime;
|
|
127
132
|
const t = deltaTime / 1000;
|
|
128
133
|
const v0 = velocity;
|
|
129
134
|
const x0 = current - toValue;
|
|
@@ -153,6 +158,7 @@ export const withInternalSpring = (toValue, userConfig, callback) => {
|
|
|
153
158
|
if (isAnimationTerminatingCalculation(animation, config)) {
|
|
154
159
|
animation.velocity = 0;
|
|
155
160
|
animation.current = toValue;
|
|
161
|
+
animationProgress?.value.set(animationProgress.to);
|
|
156
162
|
settled = true;
|
|
157
163
|
animation.settled = true;
|
|
158
164
|
// clear lastTimestamp to avoid using stale value by the next spring animation that starts after this one
|
|
@@ -160,6 +166,11 @@ export const withInternalSpring = (toValue, userConfig, callback) => {
|
|
|
160
166
|
return true;
|
|
161
167
|
}
|
|
162
168
|
notifySettled(animation);
|
|
169
|
+
if (animationProgress) {
|
|
170
|
+
const elapsedFraction = animation.animationProgressDuration <= 0 ? MAX_UNFINISHED_ANIMATION_PROGRESS : Math.min(animation.animationProgressElapsed / animation.animationProgressDuration, MAX_UNFINISHED_ANIMATION_PROGRESS);
|
|
171
|
+
const nextAnimationProgress = animationProgress.from + (animationProgress.to - animationProgress.from) * elapsedFraction;
|
|
172
|
+
animationProgress.value.set(nextAnimationProgress);
|
|
173
|
+
}
|
|
163
174
|
return false;
|
|
164
175
|
}
|
|
165
176
|
function isTriggeredTwice(previousAnimation, animation) {
|
|
@@ -208,6 +219,9 @@ export const withInternalSpring = (toValue, userConfig, callback) => {
|
|
|
208
219
|
}
|
|
209
220
|
const initialEnergy = getEnergy(x0, config.velocity, config.stiffness, config.mass);
|
|
210
221
|
animation.initialEnergy = initialEnergy;
|
|
222
|
+
animation.animationProgressElapsed = 0;
|
|
223
|
+
animation.animationProgressDuration = config.skipAnimation ? 0 : calculateSpringAnimationDuration(animation, config);
|
|
224
|
+
animationProgress?.value.set(animationProgress.from);
|
|
211
225
|
animation.lastTimestamp = previousAnimation?.lastTimestamp || now;
|
|
212
226
|
animation.startTimestamp = triggeredTwice ? previousAnimation?.startTimestamp || now : now;
|
|
213
227
|
notifySettled(animation);
|
|
@@ -235,9 +249,15 @@ export const withInternalSpring = (toValue, userConfig, callback) => {
|
|
|
235
249
|
omega0: 0,
|
|
236
250
|
omega1: 0,
|
|
237
251
|
initialEnergy: 0,
|
|
252
|
+
animationProgressElapsed: 0,
|
|
253
|
+
animationProgressDuration: 0,
|
|
238
254
|
reduceMotion: getReduceMotionForAnimation(config.reduceMotion)
|
|
239
255
|
};
|
|
240
256
|
return animation;
|
|
257
|
+
}, () => {
|
|
258
|
+
"worklet";
|
|
259
|
+
|
|
260
|
+
animationProgress?.value.set(animationProgress.to);
|
|
241
261
|
});
|
|
242
262
|
};
|
|
243
263
|
//# sourceMappingURL=spring.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["calculateNewStiffnessToMatchDuration","checkIfConfigIsValid","criticallyDampedSpringCalculations","getEnergy","initialCalculations","isAnimationSettledCalculation","isAnimationTerminatingCalculation","safeMergeConfigs","scaleZetaToMatchClamps","underDampedSpringCalculations","REACT_NATIVE_RUNTIME_KIND","REDUCE_MOTION_SYSTEM","REDUCE_MOTION_ALWAYS","DEFAULT_SPRING_SETTLE_DISTANCE","DEFAULT_SPRING_CONFIG","damping","mass","stiffness","duration","dampingRatio","overshootClamping","energyThreshold","velocity","reduceMotion","undefined","clamp","getRuntimeKind","globalThis","__RUNTIME_KIND","getReduceMotionForAnimation","config","defineSpringAnimation","_starting","factory","create","animation","baseOnStart","onStart","value","timestamp","previousAnimation","current","toValue","onFrame","__isAnimationDefinition","withInternalSpring","userConfig","callback","useDuration","skipAnimation","settleDistance","settled","notifySettled","finished","springOnFrame","now","lastTimestamp","deltaTime","Math","min","max","t","v0","x0","zeta","omega0","omega1","position","newPosition","newVelocity","isTriggeredTwice","startTimestamp","triggeredTwice","startValue","actualDuration","initialEnergy","didFinish"],"sourceRoot":"../../../../../../src","sources":["shared/utils/animation/spring/spring.ts"],"mappings":";;AAaA,SACCA,oCAAoC,EACpCC,oBAAoB,EACpBC,kCAAkC,EAClCC,SAAS,EACTC,mBAAmB,EACnBC,6BAA6B,EAC7BC,iCAAiC,EACjCC,gBAAgB,EAChBC,sBAAsB,EACtBC,6BAA6B,QACvB,eAAe;AAItB,MAAMC,yBAAyB,GAAG,CAAC;AACnC,MAAMC,oBAAoB,GAAG,QAAQ;AACrC,MAAMC,oBAAoB,GAAG,QAAQ;AACrC,MAAMC,8BAA8B,GAAG,KAAK;
|
|
1
|
+
{"version":3,"names":["calculateNewStiffnessToMatchDuration","calculateSpringAnimationDuration","checkIfConfigIsValid","criticallyDampedSpringCalculations","getEnergy","initialCalculations","isAnimationSettledCalculation","isAnimationTerminatingCalculation","safeMergeConfigs","scaleZetaToMatchClamps","underDampedSpringCalculations","REACT_NATIVE_RUNTIME_KIND","REDUCE_MOTION_SYSTEM","REDUCE_MOTION_ALWAYS","DEFAULT_SPRING_SETTLE_DISTANCE","MAX_UNFINISHED_ANIMATION_PROGRESS","DEFAULT_SPRING_CONFIG","damping","mass","stiffness","duration","dampingRatio","overshootClamping","energyThreshold","velocity","reduceMotion","undefined","clamp","getRuntimeKind","globalThis","__RUNTIME_KIND","getReduceMotionForAnimation","config","defineSpringAnimation","_starting","factory","onReducedMotion","create","animation","baseOnStart","onStart","value","timestamp","previousAnimation","current","toValue","onFrame","__isAnimationDefinition","withInternalSpring","userConfig","callback","animationProgress","useDuration","skipAnimation","settleDistance","settled","notifySettled","finished","springOnFrame","now","set","to","lastTimestamp","deltaTime","Math","min","max","animationProgressElapsed","t","v0","x0","zeta","omega0","omega1","position","newPosition","newVelocity","elapsedFraction","animationProgressDuration","nextAnimationProgress","from","isTriggeredTwice","startTimestamp","triggeredTwice","startValue","actualDuration","initialEnergy","didFinish"],"sourceRoot":"../../../../../../src","sources":["shared/utils/animation/spring/spring.ts"],"mappings":";;AAaA,SACCA,oCAAoC,EACpCC,gCAAgC,EAChCC,oBAAoB,EACpBC,kCAAkC,EAClCC,SAAS,EACTC,mBAAmB,EACnBC,6BAA6B,EAC7BC,iCAAiC,EACjCC,gBAAgB,EAChBC,sBAAsB,EACtBC,6BAA6B,QACvB,eAAe;AAItB,MAAMC,yBAAyB,GAAG,CAAC;AACnC,MAAMC,oBAAoB,GAAG,QAAQ;AACrC,MAAMC,oBAAoB,GAAG,QAAQ;AACrC,MAAMC,8BAA8B,GAAG,KAAK;AAC5C,MAAMC,iCAAiC,GAAG,CAAC,GAAG,IAAI;AAElD,MAAMC,qBAAqB,GAAG;EAC7BC,OAAO,EAAE,GAAG;EACZC,IAAI,EAAE,CAAC;EACPC,SAAS,EAAE,GAAG;EACdC,QAAQ,EAAE,GAAG;EACbC,YAAY,EAAE,CAAC;EACfC,iBAAiB,EAAE,KAAK;EACxBC,eAAe,EAAE,IAAI;EACrBC,QAAQ,EAAE,CAAC;EACXC,YAAY,EAAEC,SAAS;EACvBC,KAAK,EAAED;AACR,CAAwC;AAExC,MAAME,cAAc,GAAGA,CAAA,KAAM;EAC5B,SAAS;;EACT,OAAQC,UAAU,CAAiCC,cAAc;AAClE,CAAC;AAED,MAAMC,2BAA2B,GAAIC,MAAqB,IAAK;EAC9D,SAAS;;EACT,IAAI,CAACA,MAAM,IAAIA,MAAM,KAAKpB,oBAAoB,E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AAEV,KAAK,CAACmB,GAAG,CAACT,iBAAiB,CAACU,EAAE,CAAC;EACnD,CAAC,CAAC;AACH,CAA+B","ignoreList":[]}
|
|
@@ -261,6 +261,101 @@ export function underDampedSpringCalculations(animation, precalculatedValues) {
|
|
|
261
261
|
velocity: underDampedVelocity
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
|
+
const MAX_SPRING_DURATION_SECONDS = 60;
|
|
265
|
+
const SPRING_DURATION_PRECISION_SECONDS = 0.0001;
|
|
266
|
+
const MAX_OVERSHOOT_DURATION_SAMPLES = 4096;
|
|
267
|
+
export function calculateSpringAnimationDuration(animation, config) {
|
|
268
|
+
"worklet";
|
|
269
|
+
|
|
270
|
+
const startPosition = animation.current;
|
|
271
|
+
const startVelocity = animation.velocity;
|
|
272
|
+
const x0 = startPosition - animation.toValue;
|
|
273
|
+
const stateAt = time => {
|
|
274
|
+
"worklet";
|
|
275
|
+
|
|
276
|
+
return animation.zeta < 1 ? underDampedSpringCalculations(animation, {
|
|
277
|
+
zeta: animation.zeta,
|
|
278
|
+
v0: startVelocity,
|
|
279
|
+
x0,
|
|
280
|
+
omega0: animation.omega0,
|
|
281
|
+
omega1: animation.omega1,
|
|
282
|
+
t: time
|
|
283
|
+
}) : criticallyDampedSpringCalculations(animation, {
|
|
284
|
+
v0: startVelocity,
|
|
285
|
+
x0,
|
|
286
|
+
omega0: animation.omega0,
|
|
287
|
+
t: time
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
const terminatesByEnergyAt = time => {
|
|
291
|
+
"worklet";
|
|
292
|
+
|
|
293
|
+
if (animation.initialEnergy === 0) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
const state = stateAt(time);
|
|
297
|
+
const energy = getEnergy(animation.toValue - state.position, state.velocity, config.stiffness, config.mass);
|
|
298
|
+
return energy / animation.initialEnergy <= config.energyThreshold;
|
|
299
|
+
};
|
|
300
|
+
if (terminatesByEnergyAt(0)) {
|
|
301
|
+
return 0;
|
|
302
|
+
}
|
|
303
|
+
let lowerBound = 0;
|
|
304
|
+
let upperBound = 1 / 60;
|
|
305
|
+
while (upperBound < MAX_SPRING_DURATION_SECONDS && !terminatesByEnergyAt(upperBound)) {
|
|
306
|
+
lowerBound = upperBound;
|
|
307
|
+
upperBound *= 2;
|
|
308
|
+
}
|
|
309
|
+
upperBound = Math.min(upperBound, MAX_SPRING_DURATION_SECONDS);
|
|
310
|
+
if (terminatesByEnergyAt(upperBound)) {
|
|
311
|
+
while (upperBound - lowerBound > SPRING_DURATION_PRECISION_SECONDS) {
|
|
312
|
+
const midpoint = (lowerBound + upperBound) / 2;
|
|
313
|
+
if (terminatesByEnergyAt(midpoint)) {
|
|
314
|
+
upperBound = midpoint;
|
|
315
|
+
} else {
|
|
316
|
+
lowerBound = midpoint;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
const energyDuration = upperBound;
|
|
321
|
+
if (!config.overshootClamping || energyDuration === 0) {
|
|
322
|
+
return energyDuration * 1000;
|
|
323
|
+
}
|
|
324
|
+
const leftBound = animation.startValue >= 0 ? animation.toValue : animation.toValue + animation.startValue;
|
|
325
|
+
const rightBound = leftBound + Math.abs(animation.startValue);
|
|
326
|
+
const isOutsideBoundsAt = time => {
|
|
327
|
+
"worklet";
|
|
328
|
+
|
|
329
|
+
const {
|
|
330
|
+
position
|
|
331
|
+
} = stateAt(time);
|
|
332
|
+
return position < leftBound || position > rightBound;
|
|
333
|
+
};
|
|
334
|
+
const frequency = animation.zeta < 1 ? animation.omega1 : animation.omega0;
|
|
335
|
+
const sampleStep = frequency > 0 ? Math.min(1 / 240, Math.PI / (frequency * 8)) : 1 / 240;
|
|
336
|
+
const sampleCount = Math.min(MAX_OVERSHOOT_DURATION_SAMPLES, Math.max(1, Math.ceil(energyDuration / sampleStep)));
|
|
337
|
+
const effectiveStep = energyDuration / sampleCount;
|
|
338
|
+
let previousTime = 0;
|
|
339
|
+
for (let index = 1; index <= sampleCount; index += 1) {
|
|
340
|
+
const time = effectiveStep * index;
|
|
341
|
+
if (!isOutsideBoundsAt(time)) {
|
|
342
|
+
previousTime = time;
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
let crossingLowerBound = previousTime;
|
|
346
|
+
let crossingUpperBound = time;
|
|
347
|
+
while (crossingUpperBound - crossingLowerBound > SPRING_DURATION_PRECISION_SECONDS) {
|
|
348
|
+
const midpoint = (crossingLowerBound + crossingUpperBound) / 2;
|
|
349
|
+
if (isOutsideBoundsAt(midpoint)) {
|
|
350
|
+
crossingUpperBound = midpoint;
|
|
351
|
+
} else {
|
|
352
|
+
crossingLowerBound = midpoint;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return crossingUpperBound * 1000;
|
|
356
|
+
}
|
|
357
|
+
return energyDuration * 1000;
|
|
358
|
+
}
|
|
264
359
|
export function isAnimationTerminatingCalculation(animation, config) {
|
|
265
360
|
"worklet";
|
|
266
361
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["checkIfConfigIsValid","config","errorMessage","forEach","prop","value","duration","clamp","min","max","console","warn","safeMergeConfigs","defaults","userConfig","filtered","Object","fromEntries","entries","filter","v","undefined","bisectRoot","func","precision","maxIterations","direction","idx","current","Math","abs","initialCalculations","stiffness","skipAnimation","zeta","omega0","omega1","useDuration","mass","m","dampingRatio","sqrt","damping","c","k","scaleZetaToMatchClamps","animation","toValue","startValue","toValueNum","Number","firstBound","secondBound","relativeExtremum1","relativeExtremum2","newZeta1","log","PI","newZeta2","zetaSatisfyingClamp","x","getEnergy","displacement","velocity","potentialEnergy","kineticEnergy","calculateNewStiffnessToMatchDuration","x0","v0","energyThreshold","threshold","targetDuration","energyDiffForStiffness","perceptualCoefficient","MILLISECONDS_IN_SECOND","settlingDuration","xtk","exp","vtk","e0","etk","energyFraction","EPSILON","criticallyDampedSpringCalculations","precalculatedValues","t","criticallyDampedEnvelope","criticallyDampedPosition","criticallyDampedVelocity","position","underDampedSpringCalculations","sin1","sin","cos1","cos","underDampedEnvelope","underDampedFrag1","underDampedPosition","underDampedVelocity","isAnimationTerminatingCalculation","initialEnergy","overshootClamping","leftBound","rightBound","currentEnergy","isAnimationSettledCalculation","distance","settleDistance","maxSettledEnergy"],"sourceRoot":"../../../../../../src","sources":["shared/utils/animation/spring/springUtils.ts"],"mappings":";;AAKA;AACA;;AA4BA,OAAO,SAASA,oBAAoBA,CAACC,MAA2B,EAAW;EAC1E,SAAS;;EACT,IAAIC,YAAY,GAAG,EAAE;EAEpB,CAAC,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAClEC,OAAO,CAAEC,IAAI,IAAK;IACnB,MAAMC,KAAK,GAAGJ,MAAM,CAACG,IAAI,CAAC;IAC1B,IAAIC,KAAK,IAAI,CAAC,EAAE;MACfH,YAAY,IAAI,KAAKE,IAAI,sCAAsCC,KAAK,EAAE;IACvE;EACD,CAAC,CAAC;EAEF,IAAIJ,MAAM,CAACK,QAAQ,GAAG,CAAC,EAAE;IACxBJ,YAAY,IAAI,qCAAqCD,MAAM,CAACK,QAAQ,EAAE;EACvE;EAEA,IACCL,MAAM,CAACM,KAAK,EAAEC,GAAG,IACjBP,MAAM,CAACM,KAAK,EAAEE,GAAG,IACjBR,MAAM,CAACM,KAAK,CAACC,GAAG,GAAGP,MAAM,CAACM,KAAK,CAACE,GAAG,EAClC;IACDP,YAAY,IAAI,gEAAgED,MAAM,CAACM,KAAK,CAACC,GAAG,UAAUP,MAAM,CAACM,KAAK,CAACE,GAAG,IAAI;EAC/H;EAEA,IAAIP,YAAY,KAAK,EAAE,EAAE;IACxBQ,OAAO,CAACC,IAAI,CAAC,wBAAwBT,YAAY,EAAE,CAAC;EACrD;EAEA,OAAOA,YAAY,KAAK,EAAE;AAC3B;AAEA,OAAO,SAASU,gBAAgBA,CAC/BC,QAAiB,EACjBC,UAA6B,EACnB;EACV,SAAS;;EACT,IAAI,CAACA,UAAU,EAAE;IAChB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DzG,MAAM,CAAC+B,SAAS,EAChB/B,MAAM,CAACqC,IACR,CAAC;EAED,OAAOkE,aAAa,IAAII,gBAAgB;AACzC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["checkIfConfigIsValid","config","errorMessage","forEach","prop","value","duration","clamp","min","max","console","warn","safeMergeConfigs","defaults","userConfig","filtered","Object","fromEntries","entries","filter","v","undefined","bisectRoot","func","precision","maxIterations","direction","idx","current","Math","abs","initialCalculations","stiffness","skipAnimation","zeta","omega0","omega1","useDuration","mass","m","dampingRatio","sqrt","damping","c","k","scaleZetaToMatchClamps","animation","toValue","startValue","toValueNum","Number","firstBound","secondBound","relativeExtremum1","relativeExtremum2","newZeta1","log","PI","newZeta2","zetaSatisfyingClamp","x","getEnergy","displacement","velocity","potentialEnergy","kineticEnergy","calculateNewStiffnessToMatchDuration","x0","v0","energyThreshold","threshold","targetDuration","energyDiffForStiffness","perceptualCoefficient","MILLISECONDS_IN_SECOND","settlingDuration","xtk","exp","vtk","e0","etk","energyFraction","EPSILON","criticallyDampedSpringCalculations","precalculatedValues","t","criticallyDampedEnvelope","criticallyDampedPosition","criticallyDampedVelocity","position","underDampedSpringCalculations","sin1","sin","cos1","cos","underDampedEnvelope","underDampedFrag1","underDampedPosition","underDampedVelocity","MAX_SPRING_DURATION_SECONDS","SPRING_DURATION_PRECISION_SECONDS","MAX_OVERSHOOT_DURATION_SAMPLES","calculateSpringAnimationDuration","startPosition","startVelocity","stateAt","time","terminatesByEnergyAt","initialEnergy","state","energy","lowerBound","upperBound","midpoint","energyDuration","overshootClamping","leftBound","rightBound","isOutsideBoundsAt","frequency","sampleStep","sampleCount","ceil","effectiveStep","previousTime","index","crossingLowerBound","crossingUpperBound","isAnimationTerminatingCalculation","currentEnergy","isAnimationSettledCalculation","distance","settleDistance","maxSettledEnergy"],"sourceRoot":"../../../../../../src","sources":["shared/utils/animation/spring/springUtils.ts"],"mappings":";;AAKA;AACA;;AA8BA,OAAO,SAASA,oBAAoBA,CAACC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GAAGA,OAAO,GAAGC,UAAU;IAClE,MAAMqE,UAAU,GAAGD,SAAS,GAAGvF,IAAI,CAACC,GAAG,CAACkB,UAAU,CAAC;IACnD,IAAIpB,OAAO,GAAGwF,SAAS,IAAIxF,OAAO,GAAGyF,UAAU,EAAE;MAChD,OAAO,IAAI;IACZ;EACD;EACA,MAAMY,aAAa,GAAGpE,SAAS,CAC9Bd,OAAO,GAAGnB,OAAO,EACjBmC,QAAQ,EACR9D,MAAM,CAAC+B,SAAS,EAChB/B,MAAM,CAACqC,IACR,CAAC;EAED,OACCsE,aAAa,KAAK,CAAC,IACnBqB,aAAa,GAAGrB,aAAa,IAAI3G,MAAM,CAACoE,eAAe;AAEzD;AAEA,OAAO,SAAS6D,6BAA6BA,CAC5CpF,SAA+B,EAC/B7C,MAA+C,EACrC;EACV,SAAS;;EACT,MAAM;IAAE8C,OAAO;IAAEgB,QAAQ;IAAEnC;EAAQ,CAAC,GAAGkB,SAAS;EAChD,MAAMqF,QAAQ,GAAGtG,IAAI,CAACpB,GAAG,CAAC,CAAC,EAAER,MAAM,CAACmI,cAAc,CAAC;EAEnD,IAAID,QAAQ,KAAK,CAAC,EAAE;IACnB,OAAOH,iCAAiC,CAAClF,SAAS,EAAE7C,MAAM,CAAC;EAC5D;EAEA,MAAMgI,aAAa,GAAGpE,SAAS,CAC9Bd,OAAO,GAAGnB,OAAO,EACjBmC,QAAQ,EACR9D,MAAM,CAAC+B,SAAS,EAChB/B,MAAM,CAACqC,IACR,CAAC;EACD,MAAM+F,gBAAgB,GAAGxE,SAAS,CACjCsE,QAAQ,EACR,CAAC,EACDlI,MAAM,CAAC+B,SAAS,EAChB/B,MAAM,CAACqC,IACR,CAAC;EAED,OAAO2F,aAAa,IAAII,gBAAgB;AACzC","ignoreList":[]}
|
|
@@ -118,6 +118,18 @@ function getBoundsCenterY(bounds) {
|
|
|
118
118
|
|
|
119
119
|
return bounds.pageY + bounds.height / 2;
|
|
120
120
|
}
|
|
121
|
+
export function resolveRevealContentBaseTransformFromGeometry({
|
|
122
|
+
progress,
|
|
123
|
+
geometry
|
|
124
|
+
}) {
|
|
125
|
+
"worklet";
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
translateX: mixUnit(geometry.tx, 0, progress),
|
|
129
|
+
translateY: mixUnit(geometry.ty, 0, progress),
|
|
130
|
+
scale: mixUnit(geometry.s, 1, progress)
|
|
131
|
+
};
|
|
132
|
+
}
|
|
121
133
|
export function resolveRevealContentBaseTransform({
|
|
122
134
|
progress,
|
|
123
135
|
sourceBounds,
|
|
@@ -135,11 +147,10 @@ export function resolveRevealContentBaseTransform({
|
|
|
135
147
|
anchor,
|
|
136
148
|
scaleMode: "uniform"
|
|
137
149
|
});
|
|
138
|
-
return {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
};
|
|
150
|
+
return resolveRevealContentBaseTransformFromGeometry({
|
|
151
|
+
geometry,
|
|
152
|
+
progress
|
|
153
|
+
});
|
|
143
154
|
}
|
|
144
155
|
export function resolveTrackedSourceElementTransform({
|
|
145
156
|
sourceBounds,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["EPSILON","computeContentTransformGeometry","DRAG_DIRECTIONAL_SCALE_EXPONENT","DRAG_DIRECTIONAL_SCALE_MAX","DRAG_DIRECTIONAL_SCALE_MIN","clampUnit","value","Math","min","max","mixUnit","from","to","progress","interpolateClamped","inputStart","inputEnd","outputStart","outputEnd","resolveSafeScale","scale","abs","resolveUnitDragTranslation","translation","dimension","baseDistance","resolveRevealDirectionalDragScale","normalized","inverted","dismissalRelative","rawScale","oppositeDrag","resolveUniformScale","sourceWidth","sourceHeight","destinationWidth","destinationHeight","sx","sy","sourceAspect","destinationAspect","aspectDifference","resolveRevealGestureHandoff","rawDrag","maxSensitivity","clampedRawDrag","gestureSensitivity","releaseBoost","releaseSensitivity","gestureReleaseVelocityScale","resolveDismissScaleHandoff","releaseScale","targetScale","velocity","velocityDepth","closeProgress","easeIn","cos","PI","scaleProgress","baseScale","orbitDepth","orbitScale","sin","resolveAspectRatioMaskHeight","maskWidth","maskHeight","targetWidth","targetHeight","safeMaskWidth","safeMaskHeight","safeTargetWidth","safeTargetHeight","targetAspectHeight","getBoundsCenterX","bounds","pageX","width","getBoundsCenterY","pageY","height","
|
|
1
|
+
{"version":3,"names":["EPSILON","computeContentTransformGeometry","DRAG_DIRECTIONAL_SCALE_EXPONENT","DRAG_DIRECTIONAL_SCALE_MAX","DRAG_DIRECTIONAL_SCALE_MIN","clampUnit","value","Math","min","max","mixUnit","from","to","progress","interpolateClamped","inputStart","inputEnd","outputStart","outputEnd","resolveSafeScale","scale","abs","resolveUnitDragTranslation","translation","dimension","baseDistance","resolveRevealDirectionalDragScale","normalized","inverted","dismissalRelative","rawScale","oppositeDrag","resolveUniformScale","sourceWidth","sourceHeight","destinationWidth","destinationHeight","sx","sy","sourceAspect","destinationAspect","aspectDifference","resolveRevealGestureHandoff","rawDrag","maxSensitivity","clampedRawDrag","gestureSensitivity","releaseBoost","releaseSensitivity","gestureReleaseVelocityScale","resolveDismissScaleHandoff","releaseScale","targetScale","velocity","velocityDepth","closeProgress","easeIn","cos","PI","scaleProgress","baseScale","orbitDepth","orbitScale","sin","resolveAspectRatioMaskHeight","maskWidth","maskHeight","targetWidth","targetHeight","safeMaskWidth","safeMaskHeight","safeTargetWidth","safeTargetHeight","targetAspectHeight","getBoundsCenterX","bounds","pageX","width","getBoundsCenterY","pageY","height","resolveRevealContentBaseTransformFromGeometry","geometry","translateX","tx","translateY","ty","s","resolveRevealContentBaseTransform","sourceBounds","destinationBounds","screenLayout","anchor","start","end","entering","dimensions","scaleMode","resolveTrackedSourceElementTransform","contentTranslateX","contentTranslateY","contentScale","parentScale","screenWidth","screenHeight","screenCenterX","screenCenterY","safeParentScale","safeSourceWidth","safeSourceHeight","sourceCenterX","sourceCenterY","destinationCenterX","destinationCenterY","trackedCenterX","trackedCenterY","scaleX","scaleY"],"sourceRoot":"../../../../../../../src","sources":["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aAAa,IAAIL,YAAY,GACnDD,iBAAiB;EAElB,OAAO;IACNjB,UAAU,EACT,CAAC+B,cAAc,GAAGT,aAAa,IAAIE,eAAe,GAClDF,aAAa,GACbK,aAAa;IACdzB,UAAU,EACT,CAAC8B,cAAc,GAAGT,aAAa,IAAIC,eAAe,GAClDD,aAAa,GACbK,aAAa;IACdK,MAAM,EACJ1B,iBAAiB,CAACb,KAAK,GAAGwB,YAAY,IACtCO,eAAe,GAAGD,eAAe,CAAC;IACpCU,MAAM,EACJ3B,iBAAiB,CAACV,MAAM,GAAGqB,YAAY,IACvCQ,gBAAgB,GAAGF,eAAe;EACrC,CAAC;AACF","ignoreList":[]}
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { interpolate } from "react-native-reanimated";
|
|
4
4
|
import { EPSILON, NAVIGATION_MASK_ELEMENT_STYLE_ID } from "../../../../constants";
|
|
5
|
+
import { getVisualScrollAxisDelta } from "../../../../stores/scroll.store";
|
|
5
6
|
import { createBoundsAccessorCore } from "../../helpers/create-bounds-accessor-core";
|
|
7
|
+
import { computeContentTransformGeometry } from "../../helpers/geometry";
|
|
6
8
|
import { getSourceBorderRadius } from "../helpers";
|
|
7
|
-
import {
|
|
9
|
+
import { resolveRevealContentBaseTransformFromGeometry } from "../reveal/math";
|
|
8
10
|
import { ZOOM_BACKDROP_MAX_OPACITY, ZOOM_BACKGROUND_SCALE, ZOOM_FOCUSED_ELEMENT_CLOSE_OPACITY_RANGE, ZOOM_FOCUSED_ELEMENT_OPEN_OPACITY_RANGE, ZOOM_SCREEN_A_FADE_END, ZOOM_SHARED_OPTIONS, ZOOM_UNFOCUSED_ELEMENT_CLOSE_OPACITY_RANGE, ZOOM_UNFOCUSED_ELEMENT_OPEN_OPACITY_RANGE } from "./config";
|
|
9
|
-
import { resolveZoomDragState
|
|
11
|
+
import { resolveZoomDragState } from "./drag";
|
|
10
12
|
import { resolveZoomBackdropOpacity, resolveZoomPinchFocalOffset, resolveZoomTrackedSourceTransform } from "./helpers";
|
|
11
13
|
import { resolveZoomNavigationMaskStyle, ZOOM_NAVIGATION_MASK_BORDER_RADIUS } from "./mask";
|
|
12
14
|
import { getZoomContentAnchor, getZoomContentTarget, resolveZoomTrackingContentTarget } from "./targets";
|
|
@@ -72,25 +74,30 @@ export function buildZoomStyles({
|
|
|
72
74
|
if (!trackingContentTarget) {
|
|
73
75
|
return {};
|
|
74
76
|
}
|
|
77
|
+
const isDismissing = active.gesture.dismissing === 1;
|
|
78
|
+
const dismissalTrackingGeometry = isDismissing ? computeContentTransformGeometry({
|
|
79
|
+
start: sourceBounds,
|
|
80
|
+
end: trackingContentTarget,
|
|
81
|
+
entering: true,
|
|
82
|
+
dimensions: screenLayout,
|
|
83
|
+
anchor: zoomContentAnchor,
|
|
84
|
+
scaleMode: "uniform"
|
|
85
|
+
}) : null;
|
|
86
|
+
const dismissalCollapsedContentScale = dismissalTrackingGeometry ? resolveRevealContentBaseTransformFromGeometry({
|
|
87
|
+
geometry: dismissalTrackingGeometry,
|
|
88
|
+
progress: 0
|
|
89
|
+
}).scale : 1;
|
|
75
90
|
const drag = resolveZoomDragState({
|
|
76
91
|
gesture: active.gesture,
|
|
77
92
|
activeTransitionProgress,
|
|
78
93
|
screenLayout,
|
|
79
|
-
|
|
80
|
-
trackingContentTarget,
|
|
94
|
+
collapsedContentScale: dismissalCollapsedContentScale,
|
|
81
95
|
dragOptions: zoomOptions?.drag
|
|
82
96
|
});
|
|
83
|
-
const trackedGestureScale = resolveZoomTrackedGestureScale({
|
|
84
|
-
drag,
|
|
85
|
-
activeTransitionProgress,
|
|
86
|
-
screenLayout,
|
|
87
|
-
sourceBounds,
|
|
88
|
-
trackingContentTarget
|
|
89
|
-
});
|
|
90
97
|
const focalGesture = drag.isDismissing ? active.gesture.handoff : active.gesture;
|
|
91
98
|
const focalProgress = drag.isDismissing ? activeTransitionProgress : 1;
|
|
92
99
|
const pinchFocalOffset = active.gesture.handoff.active === "pinch-in" ? resolveZoomPinchFocalOffset({
|
|
93
|
-
gestureScale: drag.isDismissing ? focalGesture.scale :
|
|
100
|
+
gestureScale: drag.isDismissing ? focalGesture.scale : drag.gestureScale,
|
|
94
101
|
pinchOriginX: focalGesture.pinchOriginX,
|
|
95
102
|
pinchOriginY: focalGesture.pinchOriginY,
|
|
96
103
|
progress: focalProgress,
|
|
@@ -101,6 +108,11 @@ export function buildZoomStyles({
|
|
|
101
108
|
y: 0
|
|
102
109
|
};
|
|
103
110
|
if (focused) {
|
|
111
|
+
const capturedSourceScroll = sourceBounds.scroll;
|
|
112
|
+
const liveSourceScroll = props.inactive?.layouts.scroll;
|
|
113
|
+
const sourceScrollWeight = keepFocusedVisible && (active.entering || active.closing) ? 1 - Math.min(Math.max(activeTransitionProgress, 0), 1) : 0;
|
|
114
|
+
const sourceScrollDeltaX = getVisualScrollAxisDelta(liveSourceScroll, capturedSourceScroll, "horizontal") * sourceScrollWeight;
|
|
115
|
+
const sourceScrollDeltaY = getVisualScrollAxisDelta(liveSourceScroll, capturedSourceScroll, "vertical") * sourceScrollWeight;
|
|
104
116
|
const sourceBorderRadius = getSourceBorderRadius(link);
|
|
105
117
|
const navigationMaskEnabled = current.options.navigationMaskEnabled;
|
|
106
118
|
const backdropOpacity = resolveZoomBackdropOpacity({
|
|
@@ -121,8 +133,8 @@ export function buildZoomStyles({
|
|
|
121
133
|
const contentBaseTranslateX = contentRaw.translateX;
|
|
122
134
|
const contentBaseTranslateY = contentRaw.translateY;
|
|
123
135
|
const contentBaseScale = contentRaw.scale;
|
|
124
|
-
const contentTranslateX = contentBaseTranslateX + drag.dragX + pinchFocalOffset.x * contentBaseScale;
|
|
125
|
-
const contentTranslateY = contentBaseTranslateY + drag.dragY + pinchFocalOffset.y * contentBaseScale;
|
|
136
|
+
const contentTranslateX = contentBaseTranslateX + drag.dragX + pinchFocalOffset.x * contentBaseScale - sourceScrollDeltaX;
|
|
137
|
+
const contentTranslateY = contentBaseTranslateY + drag.dragY + pinchFocalOffset.y * contentBaseScale - sourceScrollDeltaY;
|
|
126
138
|
const contentScale = drag.isDismissing ? drag.dismissContentScale : contentBaseScale * drag.gestureScale;
|
|
127
139
|
return {
|
|
128
140
|
options: {
|
|
@@ -201,16 +213,29 @@ export function buildZoomStyles({
|
|
|
201
213
|
}
|
|
202
214
|
};
|
|
203
215
|
}
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
screenLayout
|
|
216
|
+
const trackingGeometry = dismissalTrackingGeometry ?? computeContentTransformGeometry({
|
|
217
|
+
start: sourceBounds,
|
|
218
|
+
end: trackingContentTarget,
|
|
219
|
+
entering: true,
|
|
220
|
+
dimensions: screenLayout,
|
|
221
|
+
anchor: zoomContentAnchor,
|
|
222
|
+
scaleMode: "uniform"
|
|
223
|
+
});
|
|
224
|
+
const trackedContentBaseTransform = resolveRevealContentBaseTransformFromGeometry({
|
|
225
|
+
geometry: trackingGeometry,
|
|
226
|
+
progress: activeTransitionProgress
|
|
227
|
+
});
|
|
228
|
+
const collapsedContentScale = drag.isDismissing ? dismissalCollapsedContentScale : resolveRevealContentBaseTransformFromGeometry({
|
|
229
|
+
geometry: trackingGeometry,
|
|
230
|
+
progress: 0
|
|
209
231
|
}).scale;
|
|
232
|
+
const trackedGestureScale = drag.isDismissing ? drag.dismissContentScale / trackedContentBaseTransform.scale : drag.gestureScale;
|
|
233
|
+
const trackedContentBaseScale = trackedContentBaseTransform.scale;
|
|
210
234
|
const trackedDragX = drag.dragX + pinchFocalOffset.x * trackedContentBaseScale;
|
|
211
235
|
const trackedDragY = drag.dragY + pinchFocalOffset.y * trackedContentBaseScale;
|
|
212
236
|
const trackedSourceElement = resolveZoomTrackedSourceTransform({
|
|
213
|
-
|
|
237
|
+
contentBaseTransform: trackedContentBaseTransform,
|
|
238
|
+
collapsedContentScale,
|
|
214
239
|
sourceBounds,
|
|
215
240
|
destinationBounds: trackingContentTarget,
|
|
216
241
|
screenLayout,
|
|
@@ -218,8 +243,7 @@ export function buildZoomStyles({
|
|
|
218
243
|
dragY: trackedDragY,
|
|
219
244
|
gestureScale: trackedGestureScale,
|
|
220
245
|
parentScale: unfocusedContentScale,
|
|
221
|
-
rotation: drag.rotation
|
|
222
|
-
anchor: zoomContentAnchor
|
|
246
|
+
rotation: drag.rotation
|
|
223
247
|
});
|
|
224
248
|
return {
|
|
225
249
|
content: unfocusedContent,
|