motion-v 0.5.0-beta.2 → 0.5.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/dist/cjs/index.js +1564 -608
- package/dist/es/animation/use-animate.mjs +1 -1
- package/dist/es/components/AnimatePresence.vue.mjs +1 -4
- package/dist/es/components/Motion.vue.mjs +50 -16
- package/dist/es/components/presence.mjs +2 -3
- package/dist/es/events/add-pointer-event.mjs +8 -0
- package/dist/es/events/event-info.mjs +16 -0
- package/dist/es/events/utils/is-primary-pointer.mjs +10 -0
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/GroupPlaybackControls.mjs +3 -0
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animate/subject.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +4 -0
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +7 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +8 -2
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +3 -3
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/index.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/linear.mjs +1 -2
- package/dist/es/external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/animation/generators/spring/defaults.mjs +32 -0
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/generators/spring/find.mjs +9 -16
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/generators/spring/index.mjs +46 -17
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/sequence/create.mjs +23 -2
- package/dist/es/external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/animation/sequence/utils/calc-repeat-duration.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/animation/sequence/utils/normalize-times.mjs +8 -0
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/cubic-bezier.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/utils/map.mjs +2 -2
- package/dist/es/external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/events/add-dom-event.mjs +7 -0
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/frameloop/frame.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/frameloop/render-step.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/animation/mix-values.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/node/create-projection-node.mjs +2 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +15 -0
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/resize/handle-element.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/index.mjs +13 -6
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/viewport/index.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +0 -14
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/interpolate.mjs +2 -2
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/mix/color.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/mix/complex.mjs +1 -1
- package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/index.mjs +1 -1
- package/dist/es/features/feature-manager.mjs +26 -7
- package/dist/es/features/feature.mjs +10 -0
- package/dist/es/features/gestures/drag/VisualElementDragControls.mjs +450 -0
- package/dist/es/features/gestures/drag/index.mjs +26 -0
- package/dist/es/features/gestures/drag/lock.mjs +42 -0
- package/dist/es/features/gestures/drag/utils/constraints.mjs +93 -0
- package/dist/es/features/gestures/drag/utils/is.mjs +6 -0
- package/dist/es/features/gestures/hover/index.mjs +40 -0
- package/dist/es/features/gestures/in-view/index.mjs +39 -0
- package/dist/es/features/gestures/pan/PanSession.mjs +150 -0
- package/dist/es/features/gestures/pan/index.mjs +69 -0
- package/dist/es/features/gestures/press/index.mjs +51 -0
- package/dist/es/features/layout/config.mjs +2 -2
- package/dist/es/features/layout/layout.mjs +24 -51
- package/dist/es/features/layout/projection.mjs +39 -0
- package/dist/es/features/svg.mjs +1 -1
- package/dist/es/index.mjs +41 -31
- package/dist/es/projection/conversion.mjs +31 -0
- package/dist/es/projection/geometry/delta-apply.mjs +7 -0
- package/dist/es/projection/geometry/delta-calc.mjs +6 -0
- package/dist/es/projection/geometry/models.mjs +11 -0
- package/dist/es/projection/utils/each-axis.mjs +6 -0
- package/dist/es/projection/utils/measure.mjs +20 -0
- package/dist/es/state/animate-variants-children.mjs +1 -1
- package/dist/es/state/create-visual-element.mjs +2 -2
- package/dist/es/state/motion-state.mjs +24 -7
- package/dist/es/state/utils/is-present.mjs +7 -0
- package/dist/es/state/utils.mjs +0 -3
- package/dist/es/utils/clamp.mjs +10 -0
- package/dist/es/utils/get-context-window.mjs +6 -0
- package/dist/es/utils/mix/number.mjs +6 -0
- package/dist/es/utils/progress.mjs +7 -0
- package/dist/es/utils/time-conversion.mjs +8 -0
- package/dist/es/utils/use-animation-frame.mjs +1 -1
- package/dist/es/utils/use-in-view.mjs +1 -1
- package/dist/es/value/types/numbers/units.mjs +11 -0
- package/dist/es/value/use-combine-values.mjs +2 -2
- package/dist/es/value/use-computed.mjs +1 -1
- package/dist/es/value/use-scroll.mjs +3 -3
- package/dist/es/value/use-spring.mjs +3 -3
- package/dist/es/value/use-time.mjs +1 -1
- package/dist/es/value/use-transform.mjs +1 -1
- package/dist/es/value/use-velocity.mjs +2 -2
- package/dist/es/value/use-will-change/add-will-change.mjs +10 -0
- package/dist/es/value/use-will-change/is.mjs +7 -0
- package/dist/src/animation/animation-controls.d.ts +7 -0
- package/dist/src/animation/types.d.ts +12 -0
- package/dist/src/animation/use-animation.d.ts +0 -0
- package/dist/src/components/AnimatePresence.d.ts +1 -1
- package/dist/src/events/add-dom-event.d.ts +1 -0
- package/dist/src/events/add-pointer-event.d.ts +2 -0
- package/dist/src/events/event-info.d.ts +4 -0
- package/dist/src/events/index.d.ts +5 -0
- package/dist/src/events/types.d.ts +5 -0
- package/dist/src/events/utils/index.d.ts +1 -0
- package/dist/src/events/utils/is-primary-pointer.d.ts +1 -0
- package/dist/src/features/feature-manager.d.ts +3 -0
- package/dist/src/features/feature.d.ts +6 -3
- package/dist/src/features/gestures/drag/VisualElementDragControls.d.ts +57 -0
- package/dist/src/features/gestures/drag/index.d.ts +8 -10
- package/dist/src/features/gestures/drag/lock.d.ts +4 -0
- package/dist/src/features/gestures/drag/types.d.ts +149 -70
- package/dist/src/features/gestures/drag/use-drag-controls.d.ts +73 -0
- package/dist/src/features/gestures/drag/utils/constraints.d.ts +55 -0
- package/dist/src/features/gestures/drag/utils/is.d.ts +1 -0
- package/dist/src/features/gestures/hover/index.d.ts +7 -0
- package/dist/src/features/gestures/hover/types.d.ts +8 -0
- package/dist/src/features/gestures/in-view/index.d.ts +7 -0
- package/dist/src/features/gestures/in-view/types.d.ts +18 -0
- package/dist/src/features/gestures/pan/PanSession.d.ts +139 -0
- package/dist/src/features/gestures/pan/index.d.ts +16 -0
- package/dist/src/features/gestures/pan/types.d.ts +7 -0
- package/dist/src/features/gestures/press/index.d.ts +9 -0
- package/dist/src/features/gestures/press/types.d.ts +13 -0
- package/dist/src/features/index.d.ts +1 -1
- package/dist/src/features/layout/layout.d.ts +3 -2
- package/dist/src/features/layout/projection.d.ts +7 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/projection/conversion.d.ts +14 -0
- package/dist/src/projection/geometry/delta-apply.d.ts +2 -0
- package/dist/src/projection/geometry/delta-calc.d.ts +2 -0
- package/dist/src/projection/geometry/models.d.ts +3 -0
- package/dist/src/projection/node/types.d.ts +16 -0
- package/dist/src/projection/utils/each-axis.d.ts +3 -0
- package/dist/src/projection/utils/measure.d.ts +3 -0
- package/dist/src/render/utils/setters.d.ts +3 -0
- package/dist/src/state/motion-state.d.ts +6 -3
- package/dist/src/state/utils/is-present.d.ts +2 -0
- package/dist/src/state/utils.d.ts +0 -1
- package/dist/src/types/framer-motion.d.ts +0 -78
- package/dist/src/types/state.d.ts +10 -23
- package/dist/src/utils/clamp.d.ts +1 -0
- package/dist/src/utils/get-context-window.d.ts +2 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/mix/number.d.ts +1 -0
- package/dist/src/utils/noop.d.ts +1 -0
- package/dist/src/utils/progress.d.ts +1 -0
- package/dist/src/utils/time-conversion.d.ts +8 -0
- package/dist/src/value/types/numbers/units.d.ts +30 -0
- package/dist/src/value/use-will-change/add-will-change.d.ts +2 -0
- package/dist/src/value/use-will-change/is.d.ts +2 -0
- package/dist/src/value/use-will-change/types.d.ts +4 -0
- package/package.json +5 -3
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/resolve-element.mjs +0 -23
- package/dist/es/external/.pnpm/hey-listen@1.0.8/external/hey-listen/dist/hey-listen.es.mjs +0 -20
- package/dist/es/features/events.mjs +0 -69
- package/dist/es/features/gestures/base.mjs +0 -19
- package/dist/es/features/gestures/hover.mjs +0 -46
- package/dist/es/features/gestures/in-view.mjs +0 -39
- package/dist/es/features/gestures/press.mjs +0 -37
- package/dist/es/utils/events.mjs +0 -8
- package/dist/src/features/events.d.ts +0 -6
- package/dist/src/features/gestures/hover.d.ts +0 -10
- package/dist/src/features/gestures/in-view.d.ts +0 -8
- package/dist/src/features/gestures/press.d.ts +0 -8
- /package/dist/es/{external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/events → events}/add-dom-event.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animate/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animate/sequence.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animate/single-value.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/utils/accelerated-values.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/easing.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/attach-timeline.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/memo-supports.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-flags.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-linear-easing.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/generators/inertia.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/generators/keyframes.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/generators/utils/is-generator.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/generators/utils/velocity.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/interfaces/motion-value.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/sequence/utils/edit.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/sequence/utils/sort.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/create-visual-element.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/default-transitions.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/get-value-transition.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/is-animatable.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/is-none.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/animation/utils/stagger.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/anticipate.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/back.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/circ.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/ease.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/modifiers/mirror.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/modifiers/reverse.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/steps.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/utils/create-generator-easing.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/utils/get-easing-for-segment.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/easing/utils/is-easing-array.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/frameloop/batcher.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/frameloop/index-legacy.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/frameloop/microtask.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/frameloop/sync-time.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/motion/features/definitions.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/geometry/conversion.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/geometry/copy.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/geometry/delta-apply.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/geometry/delta-calc.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/geometry/delta-remove.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/geometry/models.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/geometry/utils.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/node/state.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/shared/stack.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/styles/scale-correction.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/styles/transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/utils/each-axis.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/utils/has-transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/projection/utils/measure.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/VisualElement.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/resize/handle-window.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/resize/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/info.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/observe.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/supports.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/scroll/track.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/defaults.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/dimensions.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/find.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/number-browser.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/number.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/test.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/type-auto.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/dom/value-types/type-int.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/html/utils/build-styles.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/html/utils/build-transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/html/utils/make-none-animatable.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/html/utils/render.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/html/utils/transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/store.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/svg/utils/path.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/svg/utils/render.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/compare-by-depth.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/flat-tree.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/is-variant-label.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/resolve-variants.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/setters.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/render/utils/variant-props.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/GlobalConfig.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/array.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/clamp.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/delay.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/distance.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/hsla-to-rgba.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/is-browser.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/is-numerical-string.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/is-zero-value-string.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/memo.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/mix/immediate.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/mix/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/mix/number.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/mix/visibility.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/offsets/default.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/offsets/fill.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/offsets/time.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/pipe.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/progress.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/reduced-motion/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/reduced-motion/state.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/resolve-value.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/subscription-manager.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/time-conversion.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/transform.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/velocity-per-second.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/warn-once.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/utils/wrap.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/color/hex.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/color/hsla.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/color/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/color/rgba.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/color/utils.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/complex/filter.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/complex/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/numbers/index.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/numbers/units.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/utils/color-regex.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/utils/float-regex.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/utils/is-nullish.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/utils/sanitize.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/types/utils/single-color-regex.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/use-will-change/is.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/utils/is-motion-value.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11 → framer-motion@11.15.0}/external/framer-motion/dist/es/value/utils/resolve-motion-value.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11/external/framer-motion/dist/es/utils → motion-utils@11.14.3/external/motion-utils/dist/es}/errors.mjs +0 -0
- /package/dist/es/external/.pnpm/{framer-motion@11.11.11/external/framer-motion/dist/es/utils → motion-utils@11.14.3/external/motion-utils/dist/es}/noop.mjs +0 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import { addPointerEvent } from "../../../events/add-pointer-event.mjs";
|
|
2
|
+
import { extractEventInfo } from "../../../events/event-info.mjs";
|
|
3
|
+
import { addDomEvent } from "../../../events/add-dom-event.mjs";
|
|
4
|
+
import { getGlobalLock } from "./lock.mjs";
|
|
5
|
+
import { applyConstraints, calcRelativeConstraints, resolveDragElastic, calcViewportConstraints, rebaseAxisConstraints, calcOrigin, defaultElastic } from "./utils/constraints.mjs";
|
|
6
|
+
import { isHTMLElement } from "./utils/is.mjs";
|
|
7
|
+
import { PanSession } from "../pan/PanSession.mjs";
|
|
8
|
+
import { calcLength } from "../../../projection/geometry/delta-calc.mjs";
|
|
9
|
+
import { createBox } from "../../../projection/geometry/models.mjs";
|
|
10
|
+
import { eachAxis } from "../../../projection/utils/each-axis.mjs";
|
|
11
|
+
import { percent } from "../../../value/types/numbers/units.mjs";
|
|
12
|
+
import { addValueToWillChange } from "../../../value/use-will-change/add-will-change.mjs";
|
|
13
|
+
import { measurePageBox } from "../../../projection/utils/measure.mjs";
|
|
14
|
+
import { convertBoxToBoundingBox, convertBoundingBoxToBox } from "../../../projection/conversion.mjs";
|
|
15
|
+
import { animateMotionValue } from "../../../external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/animation/interfaces/motion-value.mjs";
|
|
16
|
+
import { mixNumber } from "../../../utils/mix/number.mjs";
|
|
17
|
+
import { invariant } from "hey-listen";
|
|
18
|
+
import { isPresent } from "../../../state/utils/is-present.mjs";
|
|
19
|
+
import { getContextWindow } from "../../../utils/get-context-window.mjs";
|
|
20
|
+
import { frame } from "../../../external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/frameloop/frame.mjs";
|
|
21
|
+
const elementDragControls = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
class VisualElementDragControls {
|
|
23
|
+
constructor(visualElement) {
|
|
24
|
+
this.openGlobalLock = null;
|
|
25
|
+
this.isDragging = false;
|
|
26
|
+
this.currentDirection = null;
|
|
27
|
+
this.originPoint = { x: 0, y: 0 };
|
|
28
|
+
this.constraints = false;
|
|
29
|
+
this.hasMutatedConstraints = false;
|
|
30
|
+
this.elastic = createBox();
|
|
31
|
+
this.visualElement = visualElement;
|
|
32
|
+
}
|
|
33
|
+
start(originEvent, { snapToCursor = false } = {}) {
|
|
34
|
+
if (!isPresent(this.visualElement))
|
|
35
|
+
return;
|
|
36
|
+
const onSessionStart = (event) => {
|
|
37
|
+
const { dragSnapToOrigin: dragSnapToOrigin2 } = this.getProps();
|
|
38
|
+
dragSnapToOrigin2 ? this.pauseAnimation() : this.stopAnimation();
|
|
39
|
+
if (snapToCursor) {
|
|
40
|
+
this.snapToCursor(extractEventInfo(event, "page").point);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const onStart = (event, info) => {
|
|
44
|
+
const { drag, dragPropagation, onDragStart } = this.getProps();
|
|
45
|
+
if (drag && !dragPropagation) {
|
|
46
|
+
if (this.openGlobalLock)
|
|
47
|
+
this.openGlobalLock();
|
|
48
|
+
this.openGlobalLock = getGlobalLock(drag);
|
|
49
|
+
if (!this.openGlobalLock)
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.isDragging = true;
|
|
53
|
+
this.currentDirection = null;
|
|
54
|
+
this.resolveConstraints();
|
|
55
|
+
if (this.visualElement.projection) {
|
|
56
|
+
this.visualElement.projection.isAnimationBlocked = true;
|
|
57
|
+
this.visualElement.projection.target = void 0;
|
|
58
|
+
}
|
|
59
|
+
eachAxis((axis) => {
|
|
60
|
+
let current = this.getAxisMotionValue(axis).get() || 0;
|
|
61
|
+
if (percent.test(current)) {
|
|
62
|
+
const { projection } = this.visualElement;
|
|
63
|
+
if (projection && projection.layout) {
|
|
64
|
+
const measuredAxis = projection.layout.layoutBox[axis];
|
|
65
|
+
if (measuredAxis) {
|
|
66
|
+
const length = calcLength(measuredAxis);
|
|
67
|
+
current = length * (parseFloat(current) / 100);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
this.originPoint[axis] = current;
|
|
72
|
+
});
|
|
73
|
+
if (onDragStart) {
|
|
74
|
+
frame.postRender(() => onDragStart(event, info));
|
|
75
|
+
}
|
|
76
|
+
addValueToWillChange(this.visualElement, "transform");
|
|
77
|
+
const state = this.visualElement.state;
|
|
78
|
+
state.setActive("whileDrag", true);
|
|
79
|
+
};
|
|
80
|
+
const onMove = (event, info) => {
|
|
81
|
+
const {
|
|
82
|
+
dragPropagation,
|
|
83
|
+
dragDirectionLock,
|
|
84
|
+
onDirectionLock,
|
|
85
|
+
onDrag
|
|
86
|
+
} = this.getProps();
|
|
87
|
+
if (!dragPropagation && !this.openGlobalLock)
|
|
88
|
+
return;
|
|
89
|
+
const { offset } = info;
|
|
90
|
+
if (dragDirectionLock && this.currentDirection === null) {
|
|
91
|
+
this.currentDirection = getCurrentDirection(offset);
|
|
92
|
+
if (this.currentDirection !== null) {
|
|
93
|
+
onDirectionLock && onDirectionLock(this.currentDirection);
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this.updateAxis("x", info.point, offset);
|
|
98
|
+
this.updateAxis("y", info.point, offset);
|
|
99
|
+
this.visualElement.render();
|
|
100
|
+
onDrag && onDrag(event, info);
|
|
101
|
+
};
|
|
102
|
+
const onSessionEnd = (event, info) => this.stop(event, info);
|
|
103
|
+
const resumeAnimation = () => eachAxis(
|
|
104
|
+
(axis) => {
|
|
105
|
+
var _a;
|
|
106
|
+
return this.getAnimationState(axis) === "paused" && ((_a = this.getAxisMotionValue(axis).animation) == null ? void 0 : _a.play());
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
const { dragSnapToOrigin } = this.getProps();
|
|
110
|
+
this.panSession = new PanSession(
|
|
111
|
+
originEvent,
|
|
112
|
+
{
|
|
113
|
+
onSessionStart,
|
|
114
|
+
onStart,
|
|
115
|
+
onMove,
|
|
116
|
+
onSessionEnd,
|
|
117
|
+
resumeAnimation
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
121
|
+
dragSnapToOrigin,
|
|
122
|
+
contextWindow: getContextWindow(this.visualElement)
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
stop(event, info) {
|
|
127
|
+
const isDragging = this.isDragging;
|
|
128
|
+
this.cancel();
|
|
129
|
+
if (!isDragging)
|
|
130
|
+
return;
|
|
131
|
+
const { velocity } = info;
|
|
132
|
+
this.startAnimation(velocity);
|
|
133
|
+
const { onDragEnd } = this.getProps();
|
|
134
|
+
if (onDragEnd) {
|
|
135
|
+
frame.postRender(() => onDragEnd(event, info));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
cancel() {
|
|
139
|
+
this.isDragging = false;
|
|
140
|
+
const { projection, animationState } = this.visualElement;
|
|
141
|
+
if (projection) {
|
|
142
|
+
projection.isAnimationBlocked = false;
|
|
143
|
+
}
|
|
144
|
+
this.panSession && this.panSession.end();
|
|
145
|
+
this.panSession = void 0;
|
|
146
|
+
const { dragPropagation } = this.getProps();
|
|
147
|
+
if (!dragPropagation && this.openGlobalLock) {
|
|
148
|
+
this.openGlobalLock();
|
|
149
|
+
this.openGlobalLock = null;
|
|
150
|
+
}
|
|
151
|
+
const state = this.visualElement.state;
|
|
152
|
+
state.setActive("whileDrag", false);
|
|
153
|
+
}
|
|
154
|
+
updateAxis(axis, _point, offset) {
|
|
155
|
+
const { drag } = this.getProps();
|
|
156
|
+
if (!offset || !shouldDrag(axis, drag, this.currentDirection))
|
|
157
|
+
return;
|
|
158
|
+
const axisValue = this.getAxisMotionValue(axis);
|
|
159
|
+
let next = this.originPoint[axis] + offset[axis];
|
|
160
|
+
if (this.constraints && this.constraints[axis]) {
|
|
161
|
+
next = applyConstraints(
|
|
162
|
+
next,
|
|
163
|
+
this.constraints[axis],
|
|
164
|
+
this.elastic[axis]
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
axisValue.set(next);
|
|
168
|
+
}
|
|
169
|
+
resolveConstraints() {
|
|
170
|
+
var _a;
|
|
171
|
+
const { dragConstraints, dragElastic } = this.getProps();
|
|
172
|
+
const layout = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(false) : (_a = this.visualElement.projection) == null ? void 0 : _a.layout;
|
|
173
|
+
const prevConstraints = this.constraints;
|
|
174
|
+
if (dragConstraints && isHTMLElement(dragConstraints)) {
|
|
175
|
+
if (!this.constraints) {
|
|
176
|
+
this.constraints = this.resolveRefConstraints();
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
if (dragConstraints && layout) {
|
|
180
|
+
this.constraints = calcRelativeConstraints(
|
|
181
|
+
layout.layoutBox,
|
|
182
|
+
dragConstraints
|
|
183
|
+
);
|
|
184
|
+
} else {
|
|
185
|
+
this.constraints = false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
this.elastic = resolveDragElastic(dragElastic);
|
|
189
|
+
if (prevConstraints !== this.constraints && layout && this.constraints && !this.hasMutatedConstraints) {
|
|
190
|
+
eachAxis((axis) => {
|
|
191
|
+
if (this.constraints !== false && this.getAxisMotionValue(axis)) {
|
|
192
|
+
this.constraints[axis] = rebaseAxisConstraints(
|
|
193
|
+
layout.layoutBox[axis],
|
|
194
|
+
this.constraints[axis]
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
resolveRefConstraints() {
|
|
201
|
+
const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();
|
|
202
|
+
if (!constraints || !isHTMLElement(constraints))
|
|
203
|
+
return false;
|
|
204
|
+
const constraintsElement = constraints;
|
|
205
|
+
invariant(
|
|
206
|
+
constraintsElement !== null,
|
|
207
|
+
"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop."
|
|
208
|
+
);
|
|
209
|
+
const { projection } = this.visualElement;
|
|
210
|
+
if (!projection || !projection.layout)
|
|
211
|
+
return false;
|
|
212
|
+
const constraintsBox = measurePageBox(
|
|
213
|
+
constraintsElement,
|
|
214
|
+
projection.root,
|
|
215
|
+
this.visualElement.getTransformPagePoint()
|
|
216
|
+
);
|
|
217
|
+
let measuredConstraints = calcViewportConstraints(
|
|
218
|
+
projection.layout.layoutBox,
|
|
219
|
+
constraintsBox
|
|
220
|
+
);
|
|
221
|
+
if (onMeasureDragConstraints) {
|
|
222
|
+
const userConstraints = onMeasureDragConstraints(
|
|
223
|
+
convertBoxToBoundingBox(measuredConstraints)
|
|
224
|
+
);
|
|
225
|
+
this.hasMutatedConstraints = !!userConstraints;
|
|
226
|
+
if (userConstraints) {
|
|
227
|
+
measuredConstraints = convertBoundingBoxToBox(userConstraints);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return measuredConstraints;
|
|
231
|
+
}
|
|
232
|
+
startAnimation(velocity) {
|
|
233
|
+
const {
|
|
234
|
+
drag,
|
|
235
|
+
dragMomentum,
|
|
236
|
+
dragElastic,
|
|
237
|
+
dragTransition,
|
|
238
|
+
dragSnapToOrigin,
|
|
239
|
+
onDragTransitionEnd
|
|
240
|
+
} = this.getProps();
|
|
241
|
+
const constraints = this.constraints || {};
|
|
242
|
+
const momentumAnimations = eachAxis((axis) => {
|
|
243
|
+
if (!shouldDrag(axis, drag, this.currentDirection)) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
let transition = constraints && constraints[axis] || {};
|
|
247
|
+
if (dragSnapToOrigin)
|
|
248
|
+
transition = { min: 0, max: 0 };
|
|
249
|
+
const bounceStiffness = dragElastic ? 200 : 1e6;
|
|
250
|
+
const bounceDamping = dragElastic ? 40 : 1e7;
|
|
251
|
+
const inertia = {
|
|
252
|
+
type: "inertia",
|
|
253
|
+
velocity: dragMomentum ? velocity[axis] : 0,
|
|
254
|
+
bounceStiffness,
|
|
255
|
+
bounceDamping,
|
|
256
|
+
timeConstant: 750,
|
|
257
|
+
restDelta: 1,
|
|
258
|
+
restSpeed: 10,
|
|
259
|
+
...dragTransition,
|
|
260
|
+
...transition
|
|
261
|
+
};
|
|
262
|
+
return this.startAxisValueAnimation(axis, inertia);
|
|
263
|
+
});
|
|
264
|
+
return Promise.all(momentumAnimations).then(onDragTransitionEnd);
|
|
265
|
+
}
|
|
266
|
+
startAxisValueAnimation(axis, transition) {
|
|
267
|
+
const axisValue = this.getAxisMotionValue(axis);
|
|
268
|
+
addValueToWillChange(this.visualElement, axis);
|
|
269
|
+
return axisValue.start(
|
|
270
|
+
animateMotionValue(
|
|
271
|
+
axis,
|
|
272
|
+
axisValue,
|
|
273
|
+
0,
|
|
274
|
+
transition,
|
|
275
|
+
this.visualElement,
|
|
276
|
+
false
|
|
277
|
+
)
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
stopAnimation() {
|
|
281
|
+
if (!isPresent(this.visualElement))
|
|
282
|
+
return;
|
|
283
|
+
eachAxis((axis) => this.getAxisMotionValue(axis).stop());
|
|
284
|
+
}
|
|
285
|
+
pauseAnimation() {
|
|
286
|
+
eachAxis((axis) => {
|
|
287
|
+
var _a;
|
|
288
|
+
return (_a = this.getAxisMotionValue(axis).animation) == null ? void 0 : _a.pause();
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
getAnimationState(axis) {
|
|
292
|
+
var _a;
|
|
293
|
+
return (_a = this.getAxisMotionValue(axis).animation) == null ? void 0 : _a.state;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Drag works differently depending on which props are provided.
|
|
297
|
+
*
|
|
298
|
+
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
|
|
299
|
+
* - Otherwise, we apply the delta to the x/y motion values.
|
|
300
|
+
*/
|
|
301
|
+
getAxisMotionValue(axis) {
|
|
302
|
+
const dragKey = `_drag${axis.toUpperCase()}`;
|
|
303
|
+
const props = this.visualElement.getProps();
|
|
304
|
+
const externalMotionValue = props[dragKey];
|
|
305
|
+
return externalMotionValue || this.visualElement.getValue(
|
|
306
|
+
axis,
|
|
307
|
+
(props.initial ? props.initial[axis] : void 0) || 0
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
snapToCursor(point) {
|
|
311
|
+
eachAxis((axis) => {
|
|
312
|
+
const { drag } = this.getProps();
|
|
313
|
+
if (!shouldDrag(axis, drag, this.currentDirection))
|
|
314
|
+
return;
|
|
315
|
+
const { projection } = this.visualElement;
|
|
316
|
+
const axisValue = this.getAxisMotionValue(axis);
|
|
317
|
+
if (projection && projection.layout) {
|
|
318
|
+
const { min, max } = projection.layout.layoutBox[axis];
|
|
319
|
+
axisValue.set(point[axis] - mixNumber(min, max, 0.5));
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* When the viewport resizes we want to check if the measured constraints
|
|
325
|
+
* have changed and, if so, reposition the element within those new constraints
|
|
326
|
+
* relative to where it was before the resize.
|
|
327
|
+
*/
|
|
328
|
+
scalePositionWithinConstraints() {
|
|
329
|
+
if (!this.visualElement.current)
|
|
330
|
+
return;
|
|
331
|
+
const { drag, dragConstraints } = this.getProps();
|
|
332
|
+
const { projection } = this.visualElement;
|
|
333
|
+
if (!isHTMLElement(dragConstraints) || !projection || !this.constraints)
|
|
334
|
+
return;
|
|
335
|
+
this.stopAnimation();
|
|
336
|
+
const boxProgress = { x: 0, y: 0 };
|
|
337
|
+
eachAxis((axis) => {
|
|
338
|
+
const axisValue = this.getAxisMotionValue(axis);
|
|
339
|
+
if (axisValue && this.constraints !== false) {
|
|
340
|
+
const latest = axisValue.get();
|
|
341
|
+
boxProgress[axis] = calcOrigin(
|
|
342
|
+
{ min: latest, max: latest },
|
|
343
|
+
this.constraints[axis]
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
const { transformTemplate } = this.visualElement.getProps();
|
|
348
|
+
this.visualElement.current.style.transform = transformTemplate ? transformTemplate({}, "") : "none";
|
|
349
|
+
projection.root && projection.root.updateScroll();
|
|
350
|
+
projection.updateLayout();
|
|
351
|
+
this.resolveConstraints();
|
|
352
|
+
eachAxis((axis) => {
|
|
353
|
+
if (!shouldDrag(axis, drag, null))
|
|
354
|
+
return;
|
|
355
|
+
const axisValue = this.getAxisMotionValue(axis);
|
|
356
|
+
const { min, max } = this.constraints[axis];
|
|
357
|
+
axisValue.set(mixNumber(min, max, boxProgress[axis]));
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
addListeners() {
|
|
361
|
+
if (!this.visualElement.current)
|
|
362
|
+
return;
|
|
363
|
+
elementDragControls.set(this.visualElement, this);
|
|
364
|
+
const element = this.visualElement.current;
|
|
365
|
+
const stopPointerListener = addPointerEvent(
|
|
366
|
+
element,
|
|
367
|
+
"pointerdown",
|
|
368
|
+
(event) => {
|
|
369
|
+
const { drag, dragListener = true } = this.getProps();
|
|
370
|
+
drag && dragListener && this.start(event);
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
const measureDragConstraints = () => {
|
|
374
|
+
const { dragConstraints } = this.getProps();
|
|
375
|
+
if (isHTMLElement(dragConstraints)) {
|
|
376
|
+
this.constraints = this.resolveRefConstraints();
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
const { projection } = this.visualElement;
|
|
380
|
+
const stopMeasureLayoutListener = projection.addEventListener(
|
|
381
|
+
"measure",
|
|
382
|
+
measureDragConstraints
|
|
383
|
+
);
|
|
384
|
+
if (projection && !projection.layout) {
|
|
385
|
+
projection.root && projection.root.updateScroll();
|
|
386
|
+
projection.updateLayout();
|
|
387
|
+
}
|
|
388
|
+
frame.read(measureDragConstraints);
|
|
389
|
+
const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints());
|
|
390
|
+
const stopLayoutUpdateListener = projection.addEventListener(
|
|
391
|
+
"didUpdate",
|
|
392
|
+
({ delta, hasLayoutChanged }) => {
|
|
393
|
+
if (this.isDragging && hasLayoutChanged) {
|
|
394
|
+
eachAxis((axis) => {
|
|
395
|
+
const motionValue = this.getAxisMotionValue(axis);
|
|
396
|
+
if (!motionValue)
|
|
397
|
+
return;
|
|
398
|
+
this.originPoint[axis] += delta[axis].translate;
|
|
399
|
+
motionValue.set(
|
|
400
|
+
motionValue.get() + delta[axis].translate
|
|
401
|
+
);
|
|
402
|
+
});
|
|
403
|
+
this.visualElement.render();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
return () => {
|
|
408
|
+
stopResizeListener();
|
|
409
|
+
stopPointerListener();
|
|
410
|
+
stopMeasureLayoutListener();
|
|
411
|
+
stopLayoutUpdateListener && stopLayoutUpdateListener();
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
getProps() {
|
|
415
|
+
const props = this.visualElement.getProps();
|
|
416
|
+
const {
|
|
417
|
+
drag = false,
|
|
418
|
+
dragDirectionLock = false,
|
|
419
|
+
dragPropagation = false,
|
|
420
|
+
dragConstraints = false,
|
|
421
|
+
dragElastic = defaultElastic,
|
|
422
|
+
dragMomentum = true
|
|
423
|
+
} = props;
|
|
424
|
+
return {
|
|
425
|
+
...props,
|
|
426
|
+
drag,
|
|
427
|
+
dragDirectionLock,
|
|
428
|
+
dragPropagation,
|
|
429
|
+
dragConstraints,
|
|
430
|
+
dragElastic,
|
|
431
|
+
dragMomentum
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function shouldDrag(direction, drag, currentDirection) {
|
|
436
|
+
return (drag === true || drag === direction) && (currentDirection === null || currentDirection === direction);
|
|
437
|
+
}
|
|
438
|
+
function getCurrentDirection(offset, lockThreshold = 10) {
|
|
439
|
+
let direction = null;
|
|
440
|
+
if (Math.abs(offset.y) > lockThreshold) {
|
|
441
|
+
direction = "y";
|
|
442
|
+
} else if (Math.abs(offset.x) > lockThreshold) {
|
|
443
|
+
direction = "x";
|
|
444
|
+
}
|
|
445
|
+
return direction;
|
|
446
|
+
}
|
|
447
|
+
export {
|
|
448
|
+
VisualElementDragControls,
|
|
449
|
+
elementDragControls
|
|
450
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Feature } from "../../feature.mjs";
|
|
2
|
+
import { VisualElementDragControls } from "./VisualElementDragControls.mjs";
|
|
3
|
+
import { noop } from "../../../external/.pnpm/motion-utils@11.14.3/external/motion-utils/dist/es/noop.mjs";
|
|
4
|
+
import "../../../external/.pnpm/motion-utils@11.14.3/external/motion-utils/dist/es/errors.mjs";
|
|
5
|
+
class DragGesture extends Feature {
|
|
6
|
+
constructor(state) {
|
|
7
|
+
super(state);
|
|
8
|
+
this.removeGroupControls = noop;
|
|
9
|
+
this.removeListeners = noop;
|
|
10
|
+
this.controls = new VisualElementDragControls(state.visualElement);
|
|
11
|
+
}
|
|
12
|
+
mount() {
|
|
13
|
+
const { dragControls } = this.state.options;
|
|
14
|
+
if (dragControls) {
|
|
15
|
+
this.removeGroupControls = dragControls.subscribe(this.controls);
|
|
16
|
+
}
|
|
17
|
+
this.removeListeners = this.controls.addListeners() || noop;
|
|
18
|
+
}
|
|
19
|
+
unmount() {
|
|
20
|
+
this.removeGroupControls();
|
|
21
|
+
this.removeListeners();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
DragGesture
|
|
26
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function createLock(name) {
|
|
2
|
+
let lock = null;
|
|
3
|
+
return () => {
|
|
4
|
+
const openLock = () => {
|
|
5
|
+
lock = null;
|
|
6
|
+
};
|
|
7
|
+
if (lock === null) {
|
|
8
|
+
lock = name;
|
|
9
|
+
return openLock;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const globalHorizontalLock = createLock("dragHorizontal");
|
|
15
|
+
const globalVerticalLock = createLock("dragVertical");
|
|
16
|
+
function getGlobalLock(drag) {
|
|
17
|
+
let lock = false;
|
|
18
|
+
if (drag === "y") {
|
|
19
|
+
lock = globalVerticalLock();
|
|
20
|
+
} else if (drag === "x") {
|
|
21
|
+
lock = globalHorizontalLock();
|
|
22
|
+
} else {
|
|
23
|
+
const openHorizontal = globalHorizontalLock();
|
|
24
|
+
const openVertical = globalVerticalLock();
|
|
25
|
+
if (openHorizontal && openVertical) {
|
|
26
|
+
lock = () => {
|
|
27
|
+
openHorizontal();
|
|
28
|
+
openVertical();
|
|
29
|
+
};
|
|
30
|
+
} else {
|
|
31
|
+
if (openHorizontal)
|
|
32
|
+
openHorizontal();
|
|
33
|
+
if (openVertical)
|
|
34
|
+
openVertical();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return lock;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
createLock,
|
|
41
|
+
getGlobalLock
|
|
42
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { calcLength } from "../../../../projection/geometry/delta-calc.mjs";
|
|
2
|
+
import { clamp } from "../../../../utils/clamp.mjs";
|
|
3
|
+
import { mixNumber } from "../../../../utils/mix/number.mjs";
|
|
4
|
+
import { progress } from "../../../../utils/progress.mjs";
|
|
5
|
+
function applyConstraints(point, { min, max }, elastic) {
|
|
6
|
+
if (min !== void 0 && point < min) {
|
|
7
|
+
point = elastic ? mixNumber(min, point, elastic.min) : Math.max(point, min);
|
|
8
|
+
} else if (max !== void 0 && point > max) {
|
|
9
|
+
point = elastic ? mixNumber(max, point, elastic.max) : Math.min(point, max);
|
|
10
|
+
}
|
|
11
|
+
return point;
|
|
12
|
+
}
|
|
13
|
+
const defaultElastic = 0.35;
|
|
14
|
+
function calcRelativeConstraints(layoutBox, { top, left, bottom, right }) {
|
|
15
|
+
return {
|
|
16
|
+
x: calcRelativeAxisConstraints(layoutBox.x, left, right),
|
|
17
|
+
y: calcRelativeAxisConstraints(layoutBox.y, top, bottom)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function calcRelativeAxisConstraints(axis, min, max) {
|
|
21
|
+
return {
|
|
22
|
+
min: min !== void 0 ? axis.min + min : void 0,
|
|
23
|
+
max: max !== void 0 ? axis.max + max - (axis.max - axis.min) : void 0
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function resolveDragElastic(dragElastic = defaultElastic) {
|
|
27
|
+
if (dragElastic === false) {
|
|
28
|
+
dragElastic = 0;
|
|
29
|
+
} else if (dragElastic === true) {
|
|
30
|
+
dragElastic = defaultElastic;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
x: resolveAxisElastic(dragElastic, "left", "right"),
|
|
34
|
+
y: resolveAxisElastic(dragElastic, "top", "bottom")
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
|
|
38
|
+
return {
|
|
39
|
+
min: resolvePointElastic(dragElastic, minLabel),
|
|
40
|
+
max: resolvePointElastic(dragElastic, maxLabel)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function resolvePointElastic(dragElastic, label) {
|
|
44
|
+
return typeof dragElastic === "number" ? dragElastic : dragElastic[label] || 0;
|
|
45
|
+
}
|
|
46
|
+
function rebaseAxisConstraints(layout, constraints) {
|
|
47
|
+
const relativeConstraints = {};
|
|
48
|
+
if (constraints.min !== void 0) {
|
|
49
|
+
relativeConstraints.min = constraints.min - layout.min;
|
|
50
|
+
}
|
|
51
|
+
if (constraints.max !== void 0) {
|
|
52
|
+
relativeConstraints.max = constraints.max - layout.min;
|
|
53
|
+
}
|
|
54
|
+
return relativeConstraints;
|
|
55
|
+
}
|
|
56
|
+
function calcViewportConstraints(layoutBox, constraintsBox) {
|
|
57
|
+
return {
|
|
58
|
+
x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
|
|
59
|
+
y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
|
|
63
|
+
let min = constraintsAxis.min - layoutAxis.min;
|
|
64
|
+
let max = constraintsAxis.max - layoutAxis.max;
|
|
65
|
+
if (constraintsAxis.max - constraintsAxis.min < layoutAxis.max - layoutAxis.min) {
|
|
66
|
+
[min, max] = [max, min];
|
|
67
|
+
}
|
|
68
|
+
return { min, max };
|
|
69
|
+
}
|
|
70
|
+
function calcOrigin(source, target) {
|
|
71
|
+
let origin = 0.5;
|
|
72
|
+
const sourceLength = calcLength(source);
|
|
73
|
+
const targetLength = calcLength(target);
|
|
74
|
+
if (targetLength > sourceLength) {
|
|
75
|
+
origin = progress(target.min, target.max - sourceLength, source.min);
|
|
76
|
+
} else if (sourceLength > targetLength) {
|
|
77
|
+
origin = progress(source.min, source.max - targetLength, target.min);
|
|
78
|
+
}
|
|
79
|
+
return clamp(0, 1, origin);
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
applyConstraints,
|
|
83
|
+
calcOrigin,
|
|
84
|
+
calcRelativeAxisConstraints,
|
|
85
|
+
calcRelativeConstraints,
|
|
86
|
+
calcViewportAxisConstraints,
|
|
87
|
+
calcViewportConstraints,
|
|
88
|
+
defaultElastic,
|
|
89
|
+
rebaseAxisConstraints,
|
|
90
|
+
resolveAxisElastic,
|
|
91
|
+
resolveDragElastic,
|
|
92
|
+
resolvePointElastic
|
|
93
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Feature } from "../../feature.mjs";
|
|
2
|
+
import { hover } from "motion-dom";
|
|
3
|
+
import { frame } from "../../../external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/frameloop/frame.mjs";
|
|
4
|
+
import { extractEventInfo } from "../press/index.mjs";
|
|
5
|
+
function handleHoverEvent(state, event, lifecycle) {
|
|
6
|
+
const props = state.options;
|
|
7
|
+
if (props.hover) {
|
|
8
|
+
state.setActive("hover", lifecycle === "Start");
|
|
9
|
+
}
|
|
10
|
+
const eventName = `onHover${lifecycle}`;
|
|
11
|
+
const callback = props[eventName];
|
|
12
|
+
if (callback) {
|
|
13
|
+
frame.postRender(() => callback(event, extractEventInfo(event)));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class HoverGesture extends Feature {
|
|
17
|
+
isActive() {
|
|
18
|
+
return Boolean(this.state.getOptions().hover);
|
|
19
|
+
}
|
|
20
|
+
constructor(state) {
|
|
21
|
+
super(state);
|
|
22
|
+
}
|
|
23
|
+
mount() {
|
|
24
|
+
const element = this.state.element;
|
|
25
|
+
if (!element)
|
|
26
|
+
return;
|
|
27
|
+
this.unmount = hover(
|
|
28
|
+
element,
|
|
29
|
+
(startEvent) => {
|
|
30
|
+
handleHoverEvent(this.state, startEvent, "Start");
|
|
31
|
+
return (endEvent) => {
|
|
32
|
+
handleHoverEvent(this.state, endEvent, "End");
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
HoverGesture
|
|
40
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Feature } from "../../feature.mjs";
|
|
2
|
+
import { inView } from "../../../external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/render/dom/viewport/index.mjs";
|
|
3
|
+
import { frame } from "../../../external/.pnpm/framer-motion@11.15.0/external/framer-motion/dist/es/frameloop/frame.mjs";
|
|
4
|
+
function handleHoverEvent(state, entry, lifecycle) {
|
|
5
|
+
const props = state.options;
|
|
6
|
+
if (props.inView) {
|
|
7
|
+
state.setActive("inView", lifecycle === "Enter");
|
|
8
|
+
}
|
|
9
|
+
const eventName = `onViewport${lifecycle}`;
|
|
10
|
+
const callback = props[eventName];
|
|
11
|
+
if (callback) {
|
|
12
|
+
frame.postRender(() => callback(entry));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
class InViewGesture extends Feature {
|
|
16
|
+
isActive() {
|
|
17
|
+
return Boolean(this.state.getOptions().inView);
|
|
18
|
+
}
|
|
19
|
+
constructor(state) {
|
|
20
|
+
super(state);
|
|
21
|
+
}
|
|
22
|
+
mount() {
|
|
23
|
+
const element = this.state.element;
|
|
24
|
+
if (!element)
|
|
25
|
+
return;
|
|
26
|
+
this.unmount = inView(
|
|
27
|
+
element,
|
|
28
|
+
(entry) => {
|
|
29
|
+
handleHoverEvent(this.state, entry, "Enter");
|
|
30
|
+
return (endEvent) => {
|
|
31
|
+
handleHoverEvent(this.state, entry, "Leave");
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
InViewGesture
|
|
39
|
+
};
|