framer-motion 12.23.26 → 12.23.28
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/client.js +2 -1
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/debug.js +1 -0
- package/dist/cjs/debug.js.map +1 -0
- package/dist/cjs/dom-mini.js +1 -0
- package/dist/cjs/dom-mini.js.map +1 -0
- package/dist/cjs/dom.js +1 -0
- package/dist/cjs/dom.js.map +1 -0
- package/dist/cjs/{feature-bundle-kvRbMDEA.js → feature-bundle-Dt2VtvSZ.js} +3 -2
- package/dist/cjs/feature-bundle-Dt2VtvSZ.js.map +1 -0
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/m.js +1 -0
- package/dist/cjs/m.js.map +1 -0
- package/dist/cjs/mini.js +1 -0
- package/dist/cjs/mini.js.map +1 -0
- package/dist/dom-mini.js +1 -1
- package/dist/dom.js +1 -1
- package/dist/es/animation/animate/index.mjs +1 -0
- package/dist/es/animation/animate/index.mjs.map +1 -0
- package/dist/es/animation/animate/resolve-subjects.mjs +1 -0
- package/dist/es/animation/animate/resolve-subjects.mjs.map +1 -0
- package/dist/es/animation/animate/sequence.mjs +1 -0
- package/dist/es/animation/animate/sequence.mjs.map +1 -0
- package/dist/es/animation/animate/single-value.mjs +1 -0
- package/dist/es/animation/animate/single-value.mjs.map +1 -0
- package/dist/es/animation/animate/subject.mjs +1 -0
- package/dist/es/animation/animate/subject.mjs.map +1 -0
- package/dist/es/animation/animators/waapi/animate-elements.mjs +1 -0
- package/dist/es/animation/animators/waapi/animate-elements.mjs.map +1 -0
- package/dist/es/animation/animators/waapi/animate-sequence.mjs +1 -0
- package/dist/es/animation/animators/waapi/animate-sequence.mjs.map +1 -0
- package/dist/es/animation/animators/waapi/animate-style.mjs +1 -0
- package/dist/es/animation/animators/waapi/animate-style.mjs.map +1 -0
- package/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +1 -0
- package/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs.map +1 -0
- package/dist/es/animation/hooks/animation-controls.mjs +1 -0
- package/dist/es/animation/hooks/animation-controls.mjs.map +1 -0
- package/dist/es/animation/hooks/use-animate-style.mjs +1 -0
- package/dist/es/animation/hooks/use-animate-style.mjs.map +1 -0
- package/dist/es/animation/hooks/use-animate.mjs +1 -0
- package/dist/es/animation/hooks/use-animate.mjs.map +1 -0
- package/dist/es/animation/hooks/use-animated-state.mjs +1 -0
- package/dist/es/animation/hooks/use-animated-state.mjs.map +1 -0
- package/dist/es/animation/hooks/use-animation.mjs +1 -0
- package/dist/es/animation/hooks/use-animation.mjs.map +1 -0
- package/dist/es/animation/interfaces/motion-value.mjs +1 -0
- package/dist/es/animation/interfaces/motion-value.mjs.map +1 -0
- package/dist/es/animation/interfaces/visual-element-target.mjs +1 -0
- package/dist/es/animation/interfaces/visual-element-target.mjs.map +1 -0
- package/dist/es/animation/interfaces/visual-element-variant.mjs +1 -0
- package/dist/es/animation/interfaces/visual-element-variant.mjs.map +1 -0
- package/dist/es/animation/interfaces/visual-element.mjs +1 -0
- package/dist/es/animation/interfaces/visual-element.mjs.map +1 -0
- package/dist/es/animation/optimized-appear/data-id.mjs +1 -0
- package/dist/es/animation/optimized-appear/data-id.mjs.map +1 -0
- package/dist/es/animation/optimized-appear/get-appear-id.mjs +1 -0
- package/dist/es/animation/optimized-appear/get-appear-id.mjs.map +1 -0
- package/dist/es/animation/optimized-appear/handoff.mjs +1 -0
- package/dist/es/animation/optimized-appear/handoff.mjs.map +1 -0
- package/dist/es/animation/optimized-appear/start.mjs +1 -0
- package/dist/es/animation/optimized-appear/start.mjs.map +1 -0
- package/dist/es/animation/optimized-appear/store-id.mjs +1 -0
- package/dist/es/animation/optimized-appear/store-id.mjs.map +1 -0
- package/dist/es/animation/optimized-appear/store.mjs +1 -0
- package/dist/es/animation/optimized-appear/store.mjs.map +1 -0
- package/dist/es/animation/sequence/create.mjs +1 -0
- package/dist/es/animation/sequence/create.mjs.map +1 -0
- package/dist/es/animation/sequence/utils/calc-repeat-duration.mjs +1 -0
- package/dist/es/animation/sequence/utils/calc-repeat-duration.mjs.map +1 -0
- package/dist/es/animation/sequence/utils/calc-time.mjs +1 -0
- package/dist/es/animation/sequence/utils/calc-time.mjs.map +1 -0
- package/dist/es/animation/sequence/utils/edit.mjs +1 -0
- package/dist/es/animation/sequence/utils/edit.mjs.map +1 -0
- package/dist/es/animation/sequence/utils/normalize-times.mjs +1 -0
- package/dist/es/animation/sequence/utils/normalize-times.mjs.map +1 -0
- package/dist/es/animation/sequence/utils/sort.mjs +1 -0
- package/dist/es/animation/sequence/utils/sort.mjs.map +1 -0
- package/dist/es/animation/utils/calc-child-stagger.mjs +1 -0
- package/dist/es/animation/utils/calc-child-stagger.mjs.map +1 -0
- package/dist/es/animation/utils/create-visual-element.mjs +1 -0
- package/dist/es/animation/utils/create-visual-element.mjs.map +1 -0
- package/dist/es/animation/utils/default-transitions.mjs +1 -0
- package/dist/es/animation/utils/default-transitions.mjs.map +1 -0
- package/dist/es/animation/utils/is-animation-controls.mjs +1 -0
- package/dist/es/animation/utils/is-animation-controls.mjs.map +1 -0
- package/dist/es/animation/utils/is-dom-keyframes.mjs +1 -0
- package/dist/es/animation/utils/is-dom-keyframes.mjs.map +1 -0
- package/dist/es/animation/utils/is-keyframes-target.mjs +1 -0
- package/dist/es/animation/utils/is-keyframes-target.mjs.map +1 -0
- package/dist/es/animation/utils/is-transition-defined.mjs +1 -0
- package/dist/es/animation/utils/is-transition-defined.mjs.map +1 -0
- package/dist/es/client.mjs +1 -0
- package/dist/es/client.mjs.map +1 -0
- package/dist/es/components/AnimatePresence/PopChild.mjs +1 -0
- package/dist/es/components/AnimatePresence/PopChild.mjs.map +1 -0
- package/dist/es/components/AnimatePresence/PresenceChild.mjs +1 -0
- package/dist/es/components/AnimatePresence/PresenceChild.mjs.map +1 -0
- package/dist/es/components/AnimatePresence/index.mjs +1 -0
- package/dist/es/components/AnimatePresence/index.mjs.map +1 -0
- package/dist/es/components/AnimatePresence/use-presence-data.mjs +1 -0
- package/dist/es/components/AnimatePresence/use-presence-data.mjs.map +1 -0
- package/dist/es/components/AnimatePresence/use-presence.mjs +1 -0
- package/dist/es/components/AnimatePresence/use-presence.mjs.map +1 -0
- package/dist/es/components/AnimatePresence/utils.mjs +1 -0
- package/dist/es/components/AnimatePresence/utils.mjs.map +1 -0
- package/dist/es/components/AnimateSharedLayout.mjs +1 -0
- package/dist/es/components/AnimateSharedLayout.mjs.map +1 -0
- package/dist/es/components/LayoutGroup/index.mjs +1 -0
- package/dist/es/components/LayoutGroup/index.mjs.map +1 -0
- package/dist/es/components/LazyMotion/index.mjs +1 -0
- package/dist/es/components/LazyMotion/index.mjs.map +1 -0
- package/dist/es/components/MotionConfig/index.mjs +1 -0
- package/dist/es/components/MotionConfig/index.mjs.map +1 -0
- package/dist/es/components/Reorder/Group.mjs +1 -0
- package/dist/es/components/Reorder/Group.mjs.map +1 -0
- package/dist/es/components/Reorder/Item.mjs +1 -0
- package/dist/es/components/Reorder/Item.mjs.map +1 -0
- package/dist/es/components/Reorder/namespace.mjs +1 -0
- package/dist/es/components/Reorder/namespace.mjs.map +1 -0
- package/dist/es/components/Reorder/utils/check-reorder.mjs +1 -0
- package/dist/es/components/Reorder/utils/check-reorder.mjs.map +1 -0
- package/dist/es/context/DeprecatedLayoutGroupContext.mjs +1 -0
- package/dist/es/context/DeprecatedLayoutGroupContext.mjs.map +1 -0
- package/dist/es/context/LayoutGroupContext.mjs +1 -0
- package/dist/es/context/LayoutGroupContext.mjs.map +1 -0
- package/dist/es/context/LazyContext.mjs +1 -0
- package/dist/es/context/LazyContext.mjs.map +1 -0
- package/dist/es/context/MotionConfigContext.mjs +1 -0
- package/dist/es/context/MotionConfigContext.mjs.map +1 -0
- package/dist/es/context/MotionContext/create.mjs +1 -0
- package/dist/es/context/MotionContext/create.mjs.map +1 -0
- package/dist/es/context/MotionContext/index.mjs +1 -0
- package/dist/es/context/MotionContext/index.mjs.map +1 -0
- package/dist/es/context/MotionContext/utils.mjs +1 -0
- package/dist/es/context/MotionContext/utils.mjs.map +1 -0
- package/dist/es/context/PresenceContext.mjs +1 -0
- package/dist/es/context/PresenceContext.mjs.map +1 -0
- package/dist/es/context/ReorderContext.mjs +1 -0
- package/dist/es/context/ReorderContext.mjs.map +1 -0
- package/dist/es/context/SwitchLayoutGroupContext.mjs +1 -0
- package/dist/es/context/SwitchLayoutGroupContext.mjs.map +1 -0
- package/dist/es/debug.mjs +1 -0
- package/dist/es/debug.mjs.map +1 -0
- package/dist/es/dom-mini.mjs +1 -0
- package/dist/es/dom-mini.mjs.map +1 -0
- package/dist/es/dom.mjs +1 -0
- package/dist/es/dom.mjs.map +1 -0
- package/dist/es/events/add-dom-event.mjs +1 -0
- package/dist/es/events/add-dom-event.mjs.map +1 -0
- package/dist/es/events/add-pointer-event.mjs +1 -0
- package/dist/es/events/add-pointer-event.mjs.map +1 -0
- package/dist/es/events/event-info.mjs +1 -0
- package/dist/es/events/event-info.mjs.map +1 -0
- package/dist/es/events/use-dom-event.mjs +1 -0
- package/dist/es/events/use-dom-event.mjs.map +1 -0
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +1 -0
- package/dist/es/gestures/drag/VisualElementDragControls.mjs.map +1 -0
- package/dist/es/gestures/drag/index.mjs +1 -0
- package/dist/es/gestures/drag/index.mjs.map +1 -0
- package/dist/es/gestures/drag/use-drag-controls.mjs +1 -0
- package/dist/es/gestures/drag/use-drag-controls.mjs.map +1 -0
- package/dist/es/gestures/drag/utils/constraints.mjs +1 -0
- package/dist/es/gestures/drag/utils/constraints.mjs.map +1 -0
- package/dist/es/gestures/focus.mjs +1 -0
- package/dist/es/gestures/focus.mjs.map +1 -0
- package/dist/es/gestures/hover.mjs +1 -0
- package/dist/es/gestures/hover.mjs.map +1 -0
- package/dist/es/gestures/pan/PanSession.mjs +1 -0
- package/dist/es/gestures/pan/PanSession.mjs.map +1 -0
- package/dist/es/gestures/pan/index.mjs +1 -0
- package/dist/es/gestures/pan/index.mjs.map +1 -0
- package/dist/es/gestures/press.mjs +1 -0
- package/dist/es/gestures/press.mjs.map +1 -0
- package/dist/es/index.mjs +1 -0
- package/dist/es/index.mjs.map +1 -0
- package/dist/es/m.mjs +1 -0
- package/dist/es/m.mjs.map +1 -0
- package/dist/es/mini.mjs +1 -0
- package/dist/es/mini.mjs.map +1 -0
- package/dist/es/motion/features/Feature.mjs +1 -0
- package/dist/es/motion/features/Feature.mjs.map +1 -0
- package/dist/es/motion/features/animation/exit.mjs +1 -0
- package/dist/es/motion/features/animation/exit.mjs.map +1 -0
- package/dist/es/motion/features/animation/index.mjs +1 -0
- package/dist/es/motion/features/animation/index.mjs.map +1 -0
- package/dist/es/motion/features/animations.mjs +1 -0
- package/dist/es/motion/features/animations.mjs.map +1 -0
- package/dist/es/motion/features/definitions.mjs +1 -0
- package/dist/es/motion/features/definitions.mjs.map +1 -0
- package/dist/es/motion/features/drag.mjs +1 -0
- package/dist/es/motion/features/drag.mjs.map +1 -0
- package/dist/es/motion/features/gestures.mjs +1 -0
- package/dist/es/motion/features/gestures.mjs.map +1 -0
- package/dist/es/motion/features/layout/MeasureLayout.mjs +1 -0
- package/dist/es/motion/features/layout/MeasureLayout.mjs.map +1 -0
- package/dist/es/motion/features/layout.mjs +1 -0
- package/dist/es/motion/features/layout.mjs.map +1 -0
- package/dist/es/motion/features/load-features.mjs +1 -0
- package/dist/es/motion/features/load-features.mjs.map +1 -0
- package/dist/es/motion/features/viewport/index.mjs +1 -0
- package/dist/es/motion/features/viewport/index.mjs.map +1 -0
- package/dist/es/motion/features/viewport/observers.mjs +1 -0
- package/dist/es/motion/features/viewport/observers.mjs.map +1 -0
- package/dist/es/motion/index.mjs +1 -0
- package/dist/es/motion/index.mjs.map +1 -0
- package/dist/es/motion/utils/is-forced-motion-value.mjs +1 -0
- package/dist/es/motion/utils/is-forced-motion-value.mjs.map +1 -0
- package/dist/es/motion/utils/is-motion-component.mjs +1 -0
- package/dist/es/motion/utils/is-motion-component.mjs.map +1 -0
- package/dist/es/motion/utils/symbol.mjs +1 -0
- package/dist/es/motion/utils/symbol.mjs.map +1 -0
- package/dist/es/motion/utils/unwrap-motion-component.mjs +1 -0
- package/dist/es/motion/utils/unwrap-motion-component.mjs.map +1 -0
- package/dist/es/motion/utils/use-motion-ref.mjs +1 -0
- package/dist/es/motion/utils/use-motion-ref.mjs.map +1 -0
- package/dist/es/motion/utils/use-visual-element.mjs +1 -0
- package/dist/es/motion/utils/use-visual-element.mjs.map +1 -0
- package/dist/es/motion/utils/use-visual-state.mjs +1 -0
- package/dist/es/motion/utils/use-visual-state.mjs.map +1 -0
- package/dist/es/motion/utils/valid-prop.mjs +1 -0
- package/dist/es/motion/utils/valid-prop.mjs.map +1 -0
- package/dist/es/projection/animation/mix-values.mjs +1 -0
- package/dist/es/projection/animation/mix-values.mjs.map +1 -0
- package/dist/es/projection/geometry/conversion.mjs +1 -0
- package/dist/es/projection/geometry/conversion.mjs.map +1 -0
- package/dist/es/projection/geometry/copy.mjs +1 -0
- package/dist/es/projection/geometry/copy.mjs.map +1 -0
- package/dist/es/projection/geometry/delta-apply.mjs +2 -1
- package/dist/es/projection/geometry/delta-apply.mjs.map +1 -0
- package/dist/es/projection/geometry/delta-calc.mjs +1 -0
- package/dist/es/projection/geometry/delta-calc.mjs.map +1 -0
- package/dist/es/projection/geometry/delta-remove.mjs +1 -0
- package/dist/es/projection/geometry/delta-remove.mjs.map +1 -0
- package/dist/es/projection/geometry/models.mjs +1 -0
- package/dist/es/projection/geometry/models.mjs.map +1 -0
- package/dist/es/projection/geometry/utils.mjs +1 -0
- package/dist/es/projection/geometry/utils.mjs.map +1 -0
- package/dist/es/projection/node/DocumentProjectionNode.mjs +1 -0
- package/dist/es/projection/node/DocumentProjectionNode.mjs.map +1 -0
- package/dist/es/projection/node/HTMLProjectionNode.mjs +1 -0
- package/dist/es/projection/node/HTMLProjectionNode.mjs.map +1 -0
- package/dist/es/projection/node/create-projection-node.mjs +2 -1
- package/dist/es/projection/node/create-projection-node.mjs.map +1 -0
- package/dist/es/projection/node/group.mjs +1 -0
- package/dist/es/projection/node/group.mjs.map +1 -0
- package/dist/es/projection/node/state.mjs +1 -0
- package/dist/es/projection/node/state.mjs.map +1 -0
- package/dist/es/projection/shared/stack.mjs +1 -0
- package/dist/es/projection/shared/stack.mjs.map +1 -0
- package/dist/es/projection/styles/scale-border-radius.mjs +1 -0
- package/dist/es/projection/styles/scale-border-radius.mjs.map +1 -0
- package/dist/es/projection/styles/scale-box-shadow.mjs +1 -0
- package/dist/es/projection/styles/scale-box-shadow.mjs.map +1 -0
- package/dist/es/projection/styles/scale-correction.mjs +1 -0
- package/dist/es/projection/styles/scale-correction.mjs.map +1 -0
- package/dist/es/projection/styles/transform.mjs +1 -0
- package/dist/es/projection/styles/transform.mjs.map +1 -0
- package/dist/es/projection/use-instant-layout-transition.mjs +1 -0
- package/dist/es/projection/use-instant-layout-transition.mjs.map +1 -0
- package/dist/es/projection/use-reset-projection.mjs +1 -0
- package/dist/es/projection/use-reset-projection.mjs.map +1 -0
- package/dist/es/projection/utils/each-axis.mjs +1 -0
- package/dist/es/projection/utils/each-axis.mjs.map +1 -0
- package/dist/es/projection/utils/has-transform.mjs +1 -0
- package/dist/es/projection/utils/has-transform.mjs.map +1 -0
- package/dist/es/projection/utils/measure.mjs +1 -0
- package/dist/es/projection/utils/measure.mjs.map +1 -0
- package/dist/es/projection.mjs +1 -0
- package/dist/es/projection.mjs.map +1 -0
- package/dist/es/render/VisualElement.mjs +1 -0
- package/dist/es/render/VisualElement.mjs.map +1 -0
- package/dist/es/render/components/create-proxy.mjs +1 -0
- package/dist/es/render/components/create-proxy.mjs.map +1 -0
- package/dist/es/render/components/m/create.mjs +1 -0
- package/dist/es/render/components/m/create.mjs.map +1 -0
- package/dist/es/render/components/m/elements.mjs +1 -0
- package/dist/es/render/components/m/elements.mjs.map +1 -0
- package/dist/es/render/components/m/proxy.mjs +1 -0
- package/dist/es/render/components/m/proxy.mjs.map +1 -0
- package/dist/es/render/components/motion/create.mjs +1 -0
- package/dist/es/render/components/motion/create.mjs.map +1 -0
- package/dist/es/render/components/motion/elements.mjs +1 -0
- package/dist/es/render/components/motion/elements.mjs.map +1 -0
- package/dist/es/render/components/motion/feature-bundle.mjs +1 -0
- package/dist/es/render/components/motion/feature-bundle.mjs.map +1 -0
- package/dist/es/render/components/motion/proxy.mjs +1 -0
- package/dist/es/render/components/motion/proxy.mjs.map +1 -0
- package/dist/es/render/dom/DOMVisualElement.mjs +1 -0
- package/dist/es/render/dom/DOMVisualElement.mjs.map +1 -0
- package/dist/es/render/dom/create-visual-element.mjs +1 -0
- package/dist/es/render/dom/create-visual-element.mjs.map +1 -0
- package/dist/es/render/dom/features-animation.mjs +1 -0
- package/dist/es/render/dom/features-animation.mjs.map +1 -0
- package/dist/es/render/dom/features-max.mjs +1 -0
- package/dist/es/render/dom/features-max.mjs.map +1 -0
- package/dist/es/render/dom/features-min.mjs +1 -0
- package/dist/es/render/dom/features-min.mjs.map +1 -0
- package/dist/es/render/dom/scroll/attach-animation.mjs +1 -0
- package/dist/es/render/dom/scroll/attach-animation.mjs.map +1 -0
- package/dist/es/render/dom/scroll/attach-function.mjs +1 -0
- package/dist/es/render/dom/scroll/attach-function.mjs.map +1 -0
- package/dist/es/render/dom/scroll/index.mjs +1 -0
- package/dist/es/render/dom/scroll/index.mjs.map +1 -0
- package/dist/es/render/dom/scroll/info.mjs +1 -0
- package/dist/es/render/dom/scroll/info.mjs.map +1 -0
- package/dist/es/render/dom/scroll/offsets/edge.mjs +1 -0
- package/dist/es/render/dom/scroll/offsets/edge.mjs.map +1 -0
- package/dist/es/render/dom/scroll/offsets/index.mjs +1 -0
- package/dist/es/render/dom/scroll/offsets/index.mjs.map +1 -0
- package/dist/es/render/dom/scroll/offsets/inset.mjs +1 -0
- package/dist/es/render/dom/scroll/offsets/inset.mjs.map +1 -0
- package/dist/es/render/dom/scroll/offsets/offset.mjs +1 -0
- package/dist/es/render/dom/scroll/offsets/offset.mjs.map +1 -0
- package/dist/es/render/dom/scroll/offsets/presets.mjs +1 -0
- package/dist/es/render/dom/scroll/offsets/presets.mjs.map +1 -0
- package/dist/es/render/dom/scroll/on-scroll-handler.mjs +1 -0
- package/dist/es/render/dom/scroll/on-scroll-handler.mjs.map +1 -0
- package/dist/es/render/dom/scroll/track.mjs +1 -0
- package/dist/es/render/dom/scroll/track.mjs.map +1 -0
- package/dist/es/render/dom/scroll/utils/get-timeline.mjs +1 -0
- package/dist/es/render/dom/scroll/utils/get-timeline.mjs.map +1 -0
- package/dist/es/render/dom/use-render.mjs +1 -0
- package/dist/es/render/dom/use-render.mjs.map +1 -0
- package/dist/es/render/dom/utils/camel-to-dash.mjs +1 -0
- package/dist/es/render/dom/utils/camel-to-dash.mjs.map +1 -0
- package/dist/es/render/dom/utils/filter-props.mjs +1 -0
- package/dist/es/render/dom/utils/filter-props.mjs.map +1 -0
- package/dist/es/render/dom/utils/is-svg-component.mjs +1 -0
- package/dist/es/render/dom/utils/is-svg-component.mjs.map +1 -0
- package/dist/es/render/dom/viewport/index.mjs +1 -0
- package/dist/es/render/dom/viewport/index.mjs.map +1 -0
- package/dist/es/render/html/HTMLVisualElement.mjs +1 -0
- package/dist/es/render/html/HTMLVisualElement.mjs.map +1 -0
- package/dist/es/render/html/use-html-visual-state.mjs +1 -0
- package/dist/es/render/html/use-html-visual-state.mjs.map +1 -0
- package/dist/es/render/html/use-props.mjs +1 -0
- package/dist/es/render/html/use-props.mjs.map +1 -0
- package/dist/es/render/html/utils/build-styles.mjs +1 -0
- package/dist/es/render/html/utils/build-styles.mjs.map +1 -0
- package/dist/es/render/html/utils/build-transform.mjs +1 -0
- package/dist/es/render/html/utils/build-transform.mjs.map +1 -0
- package/dist/es/render/html/utils/create-render-state.mjs +1 -0
- package/dist/es/render/html/utils/create-render-state.mjs.map +1 -0
- package/dist/es/render/html/utils/render.mjs +1 -0
- package/dist/es/render/html/utils/render.mjs.map +1 -0
- package/dist/es/render/html/utils/scrape-motion-values.mjs +1 -0
- package/dist/es/render/html/utils/scrape-motion-values.mjs.map +1 -0
- package/dist/es/render/object/ObjectVisualElement.mjs +1 -0
- package/dist/es/render/object/ObjectVisualElement.mjs.map +1 -0
- package/dist/es/render/store.mjs +1 -0
- package/dist/es/render/store.mjs.map +1 -0
- package/dist/es/render/svg/SVGVisualElement.mjs +1 -0
- package/dist/es/render/svg/SVGVisualElement.mjs.map +1 -0
- package/dist/es/render/svg/lowercase-elements.mjs +1 -0
- package/dist/es/render/svg/lowercase-elements.mjs.map +1 -0
- package/dist/es/render/svg/use-props.mjs +1 -0
- package/dist/es/render/svg/use-props.mjs.map +1 -0
- package/dist/es/render/svg/use-svg-visual-state.mjs +1 -0
- package/dist/es/render/svg/use-svg-visual-state.mjs.map +1 -0
- package/dist/es/render/svg/utils/build-attrs.mjs +1 -0
- package/dist/es/render/svg/utils/build-attrs.mjs.map +1 -0
- package/dist/es/render/svg/utils/camel-case-attrs.mjs +1 -0
- package/dist/es/render/svg/utils/camel-case-attrs.mjs.map +1 -0
- package/dist/es/render/svg/utils/create-render-state.mjs +1 -0
- package/dist/es/render/svg/utils/create-render-state.mjs.map +1 -0
- package/dist/es/render/svg/utils/is-svg-tag.mjs +1 -0
- package/dist/es/render/svg/utils/is-svg-tag.mjs.map +1 -0
- package/dist/es/render/svg/utils/path.mjs +1 -0
- package/dist/es/render/svg/utils/path.mjs.map +1 -0
- package/dist/es/render/svg/utils/render.mjs +1 -0
- package/dist/es/render/svg/utils/render.mjs.map +1 -0
- package/dist/es/render/svg/utils/scrape-motion-values.mjs +1 -0
- package/dist/es/render/svg/utils/scrape-motion-values.mjs.map +1 -0
- package/dist/es/render/utils/animation-state.mjs +1 -0
- package/dist/es/render/utils/animation-state.mjs.map +1 -0
- package/dist/es/render/utils/compare-by-depth.mjs +1 -0
- package/dist/es/render/utils/compare-by-depth.mjs.map +1 -0
- package/dist/es/render/utils/flat-tree.mjs +1 -0
- package/dist/es/render/utils/flat-tree.mjs.map +1 -0
- package/dist/es/render/utils/get-variant-context.mjs +1 -0
- package/dist/es/render/utils/get-variant-context.mjs.map +1 -0
- package/dist/es/render/utils/is-controlling-variants.mjs +1 -0
- package/dist/es/render/utils/is-controlling-variants.mjs.map +1 -0
- package/dist/es/render/utils/is-variant-label.mjs +1 -0
- package/dist/es/render/utils/is-variant-label.mjs.map +1 -0
- package/dist/es/render/utils/motion-values.mjs +1 -0
- package/dist/es/render/utils/motion-values.mjs.map +1 -0
- package/dist/es/render/utils/resolve-dynamic-variants.mjs +1 -0
- package/dist/es/render/utils/resolve-dynamic-variants.mjs.map +1 -0
- package/dist/es/render/utils/resolve-variants.mjs +1 -0
- package/dist/es/render/utils/resolve-variants.mjs.map +1 -0
- package/dist/es/render/utils/setters.mjs +1 -0
- package/dist/es/render/utils/setters.mjs.map +1 -0
- package/dist/es/render/utils/variant-props.mjs +1 -0
- package/dist/es/render/utils/variant-props.mjs.map +1 -0
- package/dist/es/utils/delay.mjs +1 -0
- package/dist/es/utils/delay.mjs.map +1 -0
- package/dist/es/utils/distance.mjs +1 -0
- package/dist/es/utils/distance.mjs.map +1 -0
- package/dist/es/utils/get-context-window.mjs +1 -0
- package/dist/es/utils/get-context-window.mjs.map +1 -0
- package/dist/es/utils/is-browser.mjs +1 -0
- package/dist/es/utils/is-browser.mjs.map +1 -0
- package/dist/es/utils/is-ref-object.mjs +1 -0
- package/dist/es/utils/is-ref-object.mjs.map +1 -0
- package/dist/es/utils/reduced-motion/index.mjs +1 -0
- package/dist/es/utils/reduced-motion/index.mjs.map +1 -0
- package/dist/es/utils/reduced-motion/state.mjs +1 -0
- package/dist/es/utils/reduced-motion/state.mjs.map +1 -0
- package/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs +1 -0
- package/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs.map +1 -0
- package/dist/es/utils/reduced-motion/use-reduced-motion.mjs +1 -0
- package/dist/es/utils/reduced-motion/use-reduced-motion.mjs.map +1 -0
- package/dist/es/utils/shallow-compare.mjs +1 -0
- package/dist/es/utils/shallow-compare.mjs.map +1 -0
- package/dist/es/utils/use-animation-frame.mjs +1 -0
- package/dist/es/utils/use-animation-frame.mjs.map +1 -0
- package/dist/es/utils/use-composed-ref.mjs +1 -0
- package/dist/es/utils/use-composed-ref.mjs.map +1 -0
- package/dist/es/utils/use-constant.mjs +1 -0
- package/dist/es/utils/use-constant.mjs.map +1 -0
- package/dist/es/utils/use-cycle.mjs +1 -0
- package/dist/es/utils/use-cycle.mjs.map +1 -0
- package/dist/es/utils/use-force-update.mjs +1 -0
- package/dist/es/utils/use-force-update.mjs.map +1 -0
- package/dist/es/utils/use-in-view.mjs +1 -0
- package/dist/es/utils/use-in-view.mjs.map +1 -0
- package/dist/es/utils/use-instant-transition.mjs +1 -0
- package/dist/es/utils/use-instant-transition.mjs.map +1 -0
- package/dist/es/utils/use-is-mounted.mjs +1 -0
- package/dist/es/utils/use-is-mounted.mjs.map +1 -0
- package/dist/es/utils/use-isomorphic-effect.mjs +1 -0
- package/dist/es/utils/use-isomorphic-effect.mjs.map +1 -0
- package/dist/es/utils/use-motion-value-event.mjs +1 -0
- package/dist/es/utils/use-motion-value-event.mjs.map +1 -0
- package/dist/es/utils/use-page-in-view.mjs +1 -0
- package/dist/es/utils/use-page-in-view.mjs.map +1 -0
- package/dist/es/utils/use-unmount-effect.mjs +1 -0
- package/dist/es/utils/use-unmount-effect.mjs.map +1 -0
- package/dist/es/value/scroll/use-element-scroll.mjs +1 -0
- package/dist/es/value/scroll/use-element-scroll.mjs.map +1 -0
- package/dist/es/value/scroll/use-viewport-scroll.mjs +1 -0
- package/dist/es/value/scroll/use-viewport-scroll.mjs.map +1 -0
- package/dist/es/value/use-combine-values.mjs +1 -0
- package/dist/es/value/use-combine-values.mjs.map +1 -0
- package/dist/es/value/use-computed.mjs +1 -0
- package/dist/es/value/use-computed.mjs.map +1 -0
- package/dist/es/value/use-inverted-scale.mjs +1 -0
- package/dist/es/value/use-inverted-scale.mjs.map +1 -0
- package/dist/es/value/use-motion-template.mjs +1 -0
- package/dist/es/value/use-motion-template.mjs.map +1 -0
- package/dist/es/value/use-motion-value.mjs +1 -0
- package/dist/es/value/use-motion-value.mjs.map +1 -0
- package/dist/es/value/use-scroll.mjs +1 -0
- package/dist/es/value/use-scroll.mjs.map +1 -0
- package/dist/es/value/use-spring.mjs +1 -0
- package/dist/es/value/use-spring.mjs.map +1 -0
- package/dist/es/value/use-time.mjs +1 -0
- package/dist/es/value/use-time.mjs.map +1 -0
- package/dist/es/value/use-transform.mjs +1 -0
- package/dist/es/value/use-transform.mjs.map +1 -0
- package/dist/es/value/use-velocity.mjs +1 -0
- package/dist/es/value/use-velocity.mjs.map +1 -0
- package/dist/es/value/use-will-change/WillChangeMotionValue.mjs +1 -0
- package/dist/es/value/use-will-change/WillChangeMotionValue.mjs.map +1 -0
- package/dist/es/value/use-will-change/add-will-change.mjs +1 -0
- package/dist/es/value/use-will-change/add-will-change.mjs.map +1 -0
- package/dist/es/value/use-will-change/index.mjs +1 -0
- package/dist/es/value/use-will-change/index.mjs.map +1 -0
- package/dist/es/value/use-will-change/is.mjs +1 -0
- package/dist/es/value/use-will-change/is.mjs.map +1 -0
- package/dist/es/value/utils/resolve-motion-value.mjs +1 -0
- package/dist/es/value/utils/resolve-motion-value.mjs.map +1 -0
- package/dist/framer-motion.dev.js +28 -5
- package/dist/framer-motion.js +1 -1
- package/dist/m.d.ts +1 -1
- package/dist/mini.js +1 -1
- package/dist/size-rollup-animate.js +2 -1
- package/dist/size-rollup-animate.js.map +1 -0
- package/dist/size-rollup-dom-animation-assets.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max-assets.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -0
- package/dist/size-rollup-m.js.map +1 -0
- package/dist/size-rollup-motion.js +2 -1
- package/dist/size-rollup-motion.js.map +1 -0
- package/dist/size-rollup-scroll.js +2 -1
- package/dist/size-rollup-scroll.js.map +1 -0
- package/dist/size-rollup-waapi-animate.js +2 -1
- package/dist/size-rollup-waapi-animate.js.map +1 -0
- package/dist/types/client.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/{types.d-DagZKalS.d.ts → types.d-C8SDx5n-.d.ts} +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../../../src/components/AnimatePresence/utils.ts"],"sourcesContent":["import { isValidElement, Children, ReactElement, ReactNode } from \"react\"\n\nexport type ComponentKey = string | number\n\nexport const getChildKey = (child: ReactElement<any>): ComponentKey =>\n child.key || \"\"\n\nexport function onlyElements(children: ReactNode): ReactElement<any>[] {\n const filtered: ReactElement<any>[] = []\n\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child)) filtered.push(child)\n })\n\n return filtered\n}\n"],"names":[],"mappings":";;AAIO,MAAM,WAAW,GAAG,CAAC,KAAwB,KAChD,KAAK,CAAC,GAAG,IAAI,GAAE;AAEb,SAAU,YAAY,CAAC,QAAmB,EAAA;IAC5C,MAAM,QAAQ,GAAwB,EAAE,CAAA;;IAGxC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,KAAI;QACjC,IAAI,cAAc,CAAC,KAAK,CAAC;AAAE,YAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACnD,KAAC,CAAC,CAAA;AAEF,IAAA,OAAO,QAAQ,CAAA;AACnB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimateSharedLayout.mjs","sources":["../../../src/components/AnimateSharedLayout.tsx"],"sourcesContent":["\"use client\"\n\nimport { invariant } from \"motion-utils\"\nimport * as React from \"react\"\nimport { useConstant } from \"../utils/use-constant\"\nimport { LayoutGroup } from \"./LayoutGroup\"\n\nlet id = 0\nexport const AnimateSharedLayout: React.FunctionComponent<\n React.PropsWithChildren<unknown>\n> = ({ children }: React.PropsWithChildren<{}>) => {\n React.useEffect(() => {\n invariant(\n false,\n \"AnimateSharedLayout is deprecated: https://www.framer.com/docs/guide-upgrade/##shared-layout-animations\"\n )\n }, [])\n\n return (\n <LayoutGroup id={useConstant(() => `asl-${id++}`)}>\n {children}\n </LayoutGroup>\n )\n}\n"],"names":[],"mappings":";;;;;;;AAOA;;AAII;AACI;;;AAWR;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/components/LayoutGroup/index.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { MutableRefObject, useContext, useMemo, useRef } from \"react\"\nimport {\n LayoutGroupContext,\n LayoutGroupContextProps,\n} from \"../../context/LayoutGroupContext\"\nimport { DeprecatedLayoutGroupContext } from \"../../context/DeprecatedLayoutGroupContext\"\nimport { nodeGroup } from \"../../projection\"\nimport { useForceUpdate } from \"../../utils/use-force-update\"\n\ntype InheritOption = boolean | \"id\"\n\nexport interface Props {\n id?: string\n inherit?: InheritOption\n}\n\nconst shouldInheritGroup = (inherit: InheritOption) => inherit === true\nconst shouldInheritId = (inherit: InheritOption) =>\n shouldInheritGroup(inherit === true) || inherit === \"id\"\n\nexport const LayoutGroup: React.FunctionComponent<\n React.PropsWithChildren<Props>\n> = ({ children, id, inherit = true }) => {\n const layoutGroupContext = useContext(LayoutGroupContext)\n const deprecatedLayoutGroupContext = useContext(\n DeprecatedLayoutGroupContext\n )\n const [forceRender, key] = useForceUpdate()\n const context = useRef(\n null\n ) as MutableRefObject<LayoutGroupContextProps | null>\n\n const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext\n if (context.current === null) {\n if (shouldInheritId(inherit) && upstreamId) {\n id = id ? upstreamId + \"-\" + id : upstreamId\n }\n\n context.current = {\n id,\n group: shouldInheritGroup(inherit)\n ? layoutGroupContext.group || nodeGroup()\n : nodeGroup(),\n }\n }\n\n const memoizedContext = useMemo(\n () => ({ ...context.current, forceRender }),\n [key]\n )\n\n return (\n <LayoutGroupContext.Provider value={memoizedContext}>\n {children}\n </LayoutGroupContext.Provider>\n )\n}\n"],"names":[],"mappings":";;;;;;;;AAmBA;AACA;AAGO;AAGH;AACA;;AAIA;AAIA;AACA;AACI;AACI;;;;AAKA;AACI;;;;;AAUZ;AAKJ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/components/LazyMotion/index.tsx"],"sourcesContent":["\"use client\"\n\nimport { useEffect, useRef, useState } from \"react\"\nimport { LazyContext } from \"../../context/LazyContext\"\nimport { loadFeatures } from \"../../motion/features/load-features\"\nimport { FeatureBundle, LazyFeatureBundle } from \"../../motion/features/types\"\nimport { CreateVisualElement } from \"../../render/types\"\nimport { LazyProps } from \"./types\"\n\n/**\n * Used in conjunction with the `m` component to reduce bundle size.\n *\n * `m` is a version of the `motion` component that only loads functionality\n * critical for the initial render.\n *\n * `LazyMotion` can then be used to either synchronously or asynchronously\n * load animation and gesture support.\n *\n * ```jsx\n * // Synchronous loading\n * import { LazyMotion, m, domAnimation } from \"framer-motion\"\n *\n * function App() {\n * return (\n * <LazyMotion features={domAnimation}>\n * <m.div animate={{ scale: 2 }} />\n * </LazyMotion>\n * )\n * }\n *\n * // Asynchronous loading\n * import { LazyMotion, m } from \"framer-motion\"\n *\n * function App() {\n * return (\n * <LazyMotion features={() => import('./path/to/domAnimation')}>\n * <m.div animate={{ scale: 2 }} />\n * </LazyMotion>\n * )\n * }\n * ```\n *\n * @public\n */\nexport function LazyMotion({ children, features, strict = false }: LazyProps) {\n const [, setIsLoaded] = useState(!isLazyBundle(features))\n const loadedRenderer = useRef<undefined | CreateVisualElement>(undefined)\n\n /**\n * If this is a synchronous load, load features immediately\n */\n if (!isLazyBundle(features)) {\n const { renderer, ...loadedFeatures } = features\n loadedRenderer.current = renderer\n loadFeatures(loadedFeatures)\n }\n\n useEffect(() => {\n if (isLazyBundle(features)) {\n features().then(({ renderer, ...loadedFeatures }) => {\n loadFeatures(loadedFeatures)\n loadedRenderer.current = renderer\n setIsLoaded(true)\n })\n }\n }, [])\n\n return (\n <LazyContext.Provider\n value={{ renderer: loadedRenderer.current, strict }}\n >\n {children}\n </LazyContext.Provider>\n )\n}\n\nfunction isLazyBundle(\n features: FeatureBundle | LazyFeatureBundle\n): features is LazyFeatureBundle {\n return typeof features === \"function\"\n}\n"],"names":[],"mappings":";;;;;;AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;AACG;AACF;AACA;AAEA;;AAEG;AACH;;AAEI;;;;AAKA;AACI;;AAEI;;AAEJ;;;;AAWZ;AAEA;AAGI;AACJ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/components/MotionConfig/index.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { useContext, useMemo } from \"react\"\nimport { MotionConfigContext } from \"../../context/MotionConfigContext\"\nimport {\n loadExternalIsValidProp,\n IsValidProp,\n} from \"../../render/dom/utils/filter-props\"\nimport { useConstant } from \"../../utils/use-constant\"\n\nexport interface MotionConfigProps extends Partial<MotionConfigContext> {\n children?: React.ReactNode\n isValidProp?: IsValidProp\n}\n\n/**\n * `MotionConfig` is used to set configuration options for all children `motion` components.\n *\n * ```jsx\n * import { motion, MotionConfig } from \"framer-motion\"\n *\n * export function App() {\n * return (\n * <MotionConfig transition={{ type: \"spring\" }}>\n * <motion.div animate={{ x: 100 }} />\n * </MotionConfig>\n * )\n * }\n * ```\n *\n * @public\n */\nexport function MotionConfig({\n children,\n isValidProp,\n ...config\n}: MotionConfigProps) {\n isValidProp && loadExternalIsValidProp(isValidProp)\n\n /**\n * Inherit props from any parent MotionConfig components\n */\n config = { ...useContext(MotionConfigContext), ...config }\n\n /**\n * Don't allow isStatic to change between renders as it affects how many hooks\n * motion components fire.\n */\n config.isStatic = useConstant(() => config.isStatic)\n\n /**\n * Creating a new config context object will re-render every `motion` component\n * every time it renders. So we only want to create a new one sparingly.\n */\n const context = useMemo(\n () => config,\n [\n JSON.stringify(config.transition),\n config.transformPagePoint,\n config.reducedMotion,\n ]\n )\n\n return (\n <MotionConfigContext.Provider value={context as MotionConfigContext}>\n {children}\n </MotionConfigContext.Provider>\n )\n}\n"],"names":[],"mappings":";;;;;;;AAgBA;;;;;;;;;;;;;;;;AAgBG;AACG;AAKF;AAEA;;AAEG;;AAGH;;;AAGG;AACH;AAEA;;;AAGG;;AAIK;AACA;AACA;AACH;AAGL;AAKJ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Group.mjs","sources":["../../../../src/components/Reorder/Group.tsx"],"sourcesContent":["\"use client\"\n\nimport { invariant } from \"motion-utils\"\nimport * as React from \"react\"\nimport { forwardRef, FunctionComponent, useEffect, useRef } from \"react\"\nimport { ReorderContext } from \"../../context/ReorderContext\"\nimport { motion } from \"../../render/components/motion/proxy\"\nimport { HTMLMotionProps } from \"../../render/html/types\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport {\n DefaultGroupElement,\n ItemData,\n ReorderContextProps,\n ReorderElementTag,\n} from \"./types\"\nimport { checkReorder } from \"./utils/check-reorder\"\n\nexport interface Props<\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n> {\n /**\n * A HTML element to render this component as. Defaults to `\"ul\"`.\n *\n * @public\n */\n as?: TagName\n\n /**\n * The axis to reorder along. By default, items will be draggable on this axis.\n * To make draggable on both axes, set `<Reorder.Item drag />`\n *\n * @public\n */\n axis?: \"x\" | \"y\"\n\n /**\n * A callback to fire with the new value order. For instance, if the values\n * are provided as a state from `useState`, this could be the set state function.\n *\n * @public\n */\n onReorder: (newOrder: V[]) => void\n\n /**\n * The latest values state.\n *\n * ```jsx\n * function Component() {\n * const [items, setItems] = useState([0, 1, 2])\n *\n * return (\n * <Reorder.Group values={items} onReorder={setItems}>\n * {items.map((item) => <Reorder.Item key={item} value={item} />)}\n * </Reorder.Group>\n * )\n * }\n * ```\n *\n * @public\n */\n values: V[]\n}\n\ntype ReorderGroupProps<\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n> = Props<V, TagName> &\n Omit<HTMLMotionProps<TagName>, \"values\"> &\n React.PropsWithChildren<{}>\n\nexport function ReorderGroupComponent<\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n>(\n {\n children,\n as = \"ul\" as TagName,\n axis = \"y\",\n onReorder,\n values,\n ...props\n }: ReorderGroupProps<V, TagName>,\n externalRef?: React.ForwardedRef<any>\n): JSX.Element {\n const Component = useConstant(\n () => motion[as as keyof typeof motion]\n ) as FunctionComponent<\n React.PropsWithChildren<HTMLMotionProps<any> & { ref?: React.Ref<any> }>\n >\n\n const order: ItemData<V>[] = []\n const isReordering = useRef(false)\n\n invariant(\n Boolean(values),\n \"Reorder.Group must be provided a values prop\",\n \"reorder-values\"\n )\n\n const context: ReorderContextProps<V> = {\n axis,\n registerItem: (value, layout) => {\n // If the entry was already added, update it rather than adding it again\n const idx = order.findIndex((entry) => value === entry.value)\n if (idx !== -1) {\n order[idx].layout = layout[axis]\n } else {\n order.push({ value: value, layout: layout[axis] })\n }\n order.sort(compareMin)\n },\n updateOrder: (item, offset, velocity) => {\n if (isReordering.current) return\n\n const newOrder = checkReorder(order, item, offset, velocity)\n\n if (order !== newOrder) {\n isReordering.current = true\n onReorder(\n newOrder\n .map(getValue)\n .filter((value) => values.indexOf(value) !== -1)\n )\n }\n },\n }\n\n useEffect(() => {\n isReordering.current = false\n })\n\n return (\n <Component {...props} ref={externalRef} ignoreStrict>\n <ReorderContext.Provider value={context}>\n {children}\n </ReorderContext.Provider>\n </Component>\n )\n}\n\nexport const ReorderGroup = /*@__PURE__*/ forwardRef(ReorderGroupComponent) as <\n V,\n TagName extends ReorderElementTag = DefaultGroupElement\n>(\n props: ReorderGroupProps<V, TagName> & { ref?: React.ForwardedRef<any> }\n) => ReturnType<typeof ReorderGroupComponent>\n\nfunction getValue<V>(item: ItemData<V>) {\n return item.value\n}\n\nfunction compareMin<V>(a: ItemData<V>, b: ItemData<V>) {\n return a.layout.min - b.layout.min\n}\n"],"names":[],"mappings":";;;;;;;;;AAuEM;AAcF;;AAOA;;AAQA;;AAEI;;AAEI;AACA;;;;AAGI;;AAEJ;;;;;AAKA;AAEA;AACI;AACA;;AAGS;;;;;AAOjB;AACJ;;AASJ;AAEa;AAOb;;AAEA;AAEA;;AAEA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.mjs","sources":["../../../../src/components/Reorder/Item.tsx"],"sourcesContent":["\"use client\"\n\nimport { isMotionValue } from \"motion-dom\"\nimport { invariant } from \"motion-utils\"\nimport * as React from \"react\"\nimport { forwardRef, FunctionComponent, useContext } from \"react\"\nimport { ReorderContext } from \"../../context/ReorderContext\"\nimport { motion } from \"../../render/components/motion/proxy\"\nimport { HTMLMotionProps } from \"../../render/html/types\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport { useMotionValue } from \"../../value/use-motion-value\"\nimport { useTransform } from \"../../value/use-transform\"\n\nimport { DefaultItemElement, ReorderElementTag } from \"./types\"\n\nexport interface Props<\n V,\n TagName extends ReorderElementTag = DefaultItemElement\n> {\n /**\n * A HTML element to render this component as. Defaults to `\"li\"`.\n *\n * @public\n */\n as?: TagName\n\n /**\n * The value in the list that this component represents.\n *\n * @public\n */\n value: V\n\n /**\n * A subset of layout options primarily used to disable layout=\"size\"\n *\n * @public\n * @default true\n */\n layout?: true | \"position\"\n}\n\nfunction useDefaultMotionValue(value: any, defaultValue: number = 0) {\n return isMotionValue(value) ? value : useMotionValue(defaultValue)\n}\n\ntype ReorderItemProps<\n V,\n TagName extends ReorderElementTag = DefaultItemElement\n> = Props<V, TagName> &\n Omit<HTMLMotionProps<TagName>, \"value\" | \"layout\"> &\n React.PropsWithChildren<{}>\n\nexport function ReorderItemComponent<\n V,\n TagName extends ReorderElementTag = DefaultItemElement\n>(\n {\n children,\n style = {},\n value,\n as = \"li\" as TagName,\n onDrag,\n layout = true,\n ...props\n }: ReorderItemProps<V, TagName>,\n externalRef?: React.ForwardedRef<any>\n): JSX.Element {\n const Component = useConstant(\n () => motion[as as keyof typeof motion]\n ) as FunctionComponent<\n React.PropsWithChildren<HTMLMotionProps<any> & { ref?: React.Ref<any> }>\n >\n\n const context = useContext(ReorderContext)\n const point = {\n x: useDefaultMotionValue(style.x),\n y: useDefaultMotionValue(style.y),\n }\n\n const zIndex = useTransform([point.x, point.y], ([latestX, latestY]) =>\n latestX || latestY ? 1 : \"unset\"\n )\n\n invariant(\n Boolean(context),\n \"Reorder.Item must be a child of Reorder.Group\",\n \"reorder-item-child\"\n )\n\n const { axis, registerItem, updateOrder } = context!\n\n return (\n <Component\n drag={axis}\n {...props}\n dragSnapToOrigin\n style={{ ...style, x: point.x, y: point.y, zIndex }}\n layout={layout}\n onDrag={(event, gesturePoint) => {\n const { velocity } = gesturePoint\n velocity[axis] &&\n updateOrder(value, point[axis].get(), velocity[axis])\n\n onDrag && onDrag(event, gesturePoint)\n }}\n onLayoutMeasure={(measured) => registerItem(value, measured)}\n ref={externalRef}\n ignoreStrict\n >\n {children}\n </Component>\n )\n}\n\nexport const ReorderItem = /*@__PURE__*/ forwardRef(ReorderItemComponent) as <\n V,\n TagName extends ReorderElementTag = DefaultItemElement\n>(\n props: ReorderItemProps<V, TagName> & { ref?: React.ForwardedRef<any> }\n) => ReturnType<typeof ReorderItemComponent>\n"],"names":[],"mappings":";;;;;;;;;;;AA0CA;AACI;AACJ;AASM;AAeF;AAMA;AACA;AACI;AACA;;AAGJ;;;;AAoBY;;AAEI;AAEJ;;AAShB;AAEa;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-reorder.mjs","sources":["../../../../../src/components/Reorder/utils/check-reorder.ts"],"sourcesContent":["import { mixNumber } from \"motion-dom\"\nimport { moveItem } from \"motion-utils\"\nimport { ItemData } from \"../types\"\n\nexport function checkReorder<T>(\n order: ItemData<T>[],\n value: T,\n offset: number,\n velocity: number\n): ItemData<T>[] {\n if (!velocity) return order\n\n const index = order.findIndex((item) => item.value === value)\n\n if (index === -1) return order\n\n const nextOffset = velocity > 0 ? 1 : -1\n const nextItem = order[index + nextOffset]\n\n if (!nextItem) return order\n\n const item = order[index]\n const nextLayout = nextItem.layout\n const nextItemCenter = mixNumber(nextLayout.min, nextLayout.max, 0.5)\n\n if (\n (nextOffset === 1 && item.layout.max + offset > nextItemCenter) ||\n (nextOffset === -1 && item.layout.min + offset < nextItemCenter)\n ) {\n return moveItem(order, index, index + nextOffset)\n }\n\n return order\n}\n"],"names":[],"mappings":";;;AAIM,SAAU,YAAY,CACxB,KAAoB,EACpB,KAAQ,EACR,MAAc,EACd,QAAgB,EAAA;AAEhB,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,KAAK,CAAA;AAE3B,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,CAAA;IAE7D,IAAI,KAAK,KAAK,CAAC,CAAC;AAAE,QAAA,OAAO,KAAK,CAAA;AAE9B,IAAA,MAAM,UAAU,GAAG,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACxC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,CAAA;AAE1C,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,KAAK,CAAA;AAE3B,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAA;AACzB,IAAA,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAA;AAClC,IAAA,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAErE,IAAA,IACI,CAAC,UAAU,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,GAAG,cAAc;AAC9D,SAAC,UAAU,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,GAAG,cAAc,CAAC,EAClE;QACE,OAAO,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,UAAU,CAAC,CAAA;KACpD;AAED,IAAA,OAAO,KAAK,CAAA;AAChB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeprecatedLayoutGroupContext.mjs","sources":["../../../src/context/DeprecatedLayoutGroupContext.ts"],"sourcesContent":["\"use client\"\n\nimport { createContext } from \"react\"\n\n/**\n * Note: Still used by components generated by old versions of Framer\n *\n * @deprecated\n */\nexport const DeprecatedLayoutGroupContext = createContext<string | null>(null)\n"],"names":[],"mappings":";;;AAIA;;;;AAIG;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutGroupContext.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyContext.mjs","sources":["../../../src/context/LazyContext.ts"],"sourcesContent":["\"use client\"\n\nimport { createContext } from \"react\"\nimport { CreateVisualElement } from \"../render/types\"\n\nexport interface LazyContextProps {\n renderer?: CreateVisualElement\n strict: boolean\n}\n\nexport const LazyContext = createContext<LazyContextProps>({ strict: false })\n"],"names":[],"mappings":";;;AAUO;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MotionConfigContext.mjs","sources":["../../../src/context/MotionConfigContext.tsx"],"sourcesContent":["\"use client\"\n\nimport type { Transition } from \"motion-dom\"\nimport { TransformPoint } from \"motion-utils\"\nimport { createContext } from \"react\"\n\nexport type ReducedMotionConfig = \"always\" | \"never\" | \"user\"\n\n/**\n * @public\n */\nexport interface MotionConfigContext {\n /**\n * Internal, exported only for usage in Framer\n */\n transformPagePoint: TransformPoint\n\n /**\n * Internal. Determines whether this is a static context ie the Framer canvas. If so,\n * it'll disable all dynamic functionality.\n */\n isStatic: boolean\n\n /**\n * Defines a new default transition for the entire tree.\n *\n * @public\n */\n transition?: Transition\n\n /**\n * If true, will respect the device prefersReducedMotion setting by switching\n * transform animations off.\n *\n * @public\n */\n reducedMotion?: ReducedMotionConfig\n\n /**\n * A custom `nonce` attribute used when wanting to enforce a Content Security Policy (CSP).\n * For more details see:\n * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles\n *\n * @public\n */\n nonce?: string\n}\n\n/**\n * @public\n */\nexport const MotionConfigContext = createContext<MotionConfigContext>({\n transformPagePoint: (p) => p,\n isStatic: false,\n reducedMotion: \"never\",\n})\n"],"names":[],"mappings":";;;AAgDA;;AAEG;AACI;AACH;AACA;AACA;AACH;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.mjs","sources":["../../../../src/context/MotionContext/create.ts"],"sourcesContent":["\"use client\"\n\nimport { useContext, useMemo } from \"react\"\nimport { MotionContext, type MotionContextProps } from \".\"\nimport { MotionProps } from \"../../motion/types\"\nimport { getCurrentTreeVariants } from \"./utils\"\n\nexport function useCreateMotionContext<Instance>(\n props: MotionProps\n): MotionContextProps<Instance> {\n const { initial, animate } = getCurrentTreeVariants(\n props,\n useContext(MotionContext)\n )\n\n return useMemo(\n () => ({ initial, animate }),\n [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]\n )\n}\n\nfunction variantLabelsAsDependency(\n prop: undefined | string | string[] | boolean\n) {\n return Array.isArray(prop) ? prop.join(\" \") : prop\n}\n"],"names":[],"mappings":";;;;;AAOM;AAGF;;AASJ;AAEA;AAGI;AACJ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/context/MotionContext/index.ts"],"sourcesContent":["\"use client\"\n\nimport { createContext } from \"react\"\nimport type { VisualElement } from \"../../render/VisualElement\"\n\nexport interface MotionContextProps<Instance = unknown> {\n visualElement?: VisualElement<Instance>\n initial?: false | string | string[]\n animate?: string | string[]\n}\n\nexport const MotionContext = /* @__PURE__ */ createContext<MotionContextProps>(\n {}\n)\n"],"names":[],"mappings":";;;AAWa;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../../../src/context/MotionContext/utils.ts"],"sourcesContent":["import type { MotionContextProps } from \".\"\nimport { MotionProps } from \"../../motion/types\"\nimport { isControllingVariants } from \"../../render/utils/is-controlling-variants\"\nimport { isVariantLabel } from \"../../render/utils/is-variant-label\"\n\nexport function getCurrentTreeVariants(\n props: MotionProps,\n context: MotionContextProps\n): MotionContextProps {\n if (isControllingVariants(props)) {\n const { initial, animate } = props\n return {\n initial:\n initial === false || isVariantLabel(initial)\n ? (initial as any)\n : undefined,\n animate: isVariantLabel(animate) ? animate : undefined,\n }\n }\n return props.inherit !== false ? context : {}\n}\n"],"names":[],"mappings":";;;AAKgB,SAAA,sBAAsB,CAClC,KAAkB,EAClB,OAA2B,EAAA;AAE3B,IAAA,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE;AAC9B,QAAA,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;QAClC,OAAO;YACH,OAAO,EACH,OAAO,KAAK,KAAK,IAAI,cAAc,CAAC,OAAO,CAAC;AACxC,kBAAG,OAAe;AAClB,kBAAE,SAAS;AACnB,YAAA,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,SAAS;SACzD,CAAA;KACJ;AACD,IAAA,OAAO,KAAK,CAAC,OAAO,KAAK,KAAK,GAAG,OAAO,GAAG,EAAE,CAAA;AACjD;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PresenceContext.mjs","sources":["../../../src/context/PresenceContext.ts"],"sourcesContent":["\"use client\"\n\nimport { createContext } from \"react\"\nimport { VariantLabels } from \"../motion/types\"\n\n/**\n * @public\n */\nexport interface PresenceContextProps {\n id: string\n isPresent: boolean\n register: (id: string | number) => () => void\n onExitComplete?: (id: string | number) => void\n initial?: false | VariantLabels\n custom?: any\n}\n\n/**\n * @public\n */\nexport const PresenceContext =\n /* @__PURE__ */ createContext<PresenceContextProps | null>(null)\n"],"names":[],"mappings":";;;AAiBA;;AAEG;;AAEC;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReorderContext.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchLayoutGroupContext.mjs","sources":["../../../src/context/SwitchLayoutGroupContext.ts"],"sourcesContent":["\"use client\"\n\nimport type { Transition } from \"motion-dom\"\nimport { createContext } from \"react\"\nimport { IProjectionNode } from \"../projection/node/types\"\n\nexport interface SwitchLayoutGroup {\n register?: (member: IProjectionNode) => void\n deregister?: (member: IProjectionNode) => void\n}\n\nexport type SwitchLayoutGroupContext = SwitchLayoutGroup &\n InitialPromotionConfig\n\nexport type InitialPromotionConfig = {\n /**\n * The initial transition to use when the elements in this group mount (and automatically promoted).\n * Subsequent updates should provide a transition in the promote method.\n */\n transition?: Transition\n /**\n * If the follow tree should preserve its opacity when the lead is promoted on mount\n */\n shouldPreserveFollowOpacity?: (member: IProjectionNode) => boolean\n}\n\n/**\n * Internal, exported only for usage in Framer\n */\nexport const SwitchLayoutGroupContext = createContext<SwitchLayoutGroupContext>(\n {}\n)\n"],"names":[],"mappings":";;;AA0BA;;AAEG;;;"}
|
package/dist/es/debug.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/es/dom-mini.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom-mini.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/es/dom.mjs
CHANGED
|
@@ -7,3 +7,4 @@ export { scrollInfo } from './render/dom/scroll/track.mjs';
|
|
|
7
7
|
export { inView } from './render/dom/viewport/index.mjs';
|
|
8
8
|
export { delayInSeconds as delay } from './utils/delay.mjs';
|
|
9
9
|
export { distance, distance2D } from './utils/distance.mjs';
|
|
10
|
+
//# sourceMappingURL=dom.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-dom-event.mjs","sources":["../../../src/events/add-dom-event.ts"],"sourcesContent":["export function addDomEvent(\n target: EventTarget,\n eventName: string,\n handler: EventListener,\n options: AddEventListenerOptions = { passive: true }\n) {\n target.addEventListener(eventName, handler, options)\n\n return () => target.removeEventListener(eventName, handler)\n}\n"],"names":[],"mappings":"AAAgB,SAAA,WAAW,CACvB,MAAmB,EACnB,SAAiB,EACjB,OAAsB,EACtB,OAAmC,GAAA,EAAE,OAAO,EAAE,IAAI,EAAE,EAAA;IAEpD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAEpD,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC/D;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-pointer-event.mjs","sources":["../../../src/events/add-pointer-event.ts"],"sourcesContent":["import { addDomEvent } from \"./add-dom-event\"\nimport { addPointerInfo, EventListenerWithPointInfo } from \"./event-info\"\n\nexport function addPointerEvent(\n target: EventTarget,\n eventName: string,\n handler: EventListenerWithPointInfo,\n options?: AddEventListenerOptions\n) {\n return addDomEvent(target, eventName, addPointerInfo(handler), options)\n}\n"],"names":[],"mappings":";;;AAGM,SAAU,eAAe,CAC3B,MAAmB,EACnB,SAAiB,EACjB,OAAmC,EACnC,OAAiC,EAAA;AAEjC,IAAA,OAAO,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAA;AAC3E;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-info.mjs","sources":["../../../src/events/event-info.ts"],"sourcesContent":["import { EventInfo, isPrimaryPointer } from \"motion-dom\"\n\nexport type EventListenerWithPointInfo = (\n e: PointerEvent,\n info: EventInfo\n) => void\n\nexport function extractEventInfo(event: PointerEvent): EventInfo {\n return {\n point: {\n x: event.pageX,\n y: event.pageY,\n },\n }\n}\n\nexport const addPointerInfo = (\n handler: EventListenerWithPointInfo\n): EventListener => {\n return (event: PointerEvent) =>\n isPrimaryPointer(event) && handler(event, extractEventInfo(event))\n}\n"],"names":[],"mappings":";;AAOM,SAAU,gBAAgB,CAAC,KAAmB,EAAA;IAChD,OAAO;AACH,QAAA,KAAK,EAAE;YACH,CAAC,EAAE,KAAK,CAAC,KAAK;YACd,CAAC,EAAE,KAAK,CAAC,KAAK;AACjB,SAAA;KACJ,CAAA;AACL,CAAC;AAEY,MAAA,cAAc,GAAG,CAC1B,OAAmC,KACpB;AACf,IAAA,OAAO,CAAC,KAAmB,KACvB,gBAAgB,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAA;AAC1E;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dom-event.mjs","sources":["../../../src/events/use-dom-event.ts"],"sourcesContent":["\"use client\"\n\nimport { RefObject, useEffect } from \"react\"\nimport { addDomEvent } from \"./add-dom-event\"\n\n/**\n * Attaches an event listener directly to the provided DOM element.\n *\n * Bypassing React's event system can be desirable, for instance when attaching non-passive\n * event handlers.\n *\n * ```jsx\n * const ref = useRef(null)\n *\n * useDomEvent(ref, 'wheel', onWheel, { passive: false })\n *\n * return <div ref={ref} />\n * ```\n *\n * @param ref - React.RefObject that's been provided to the element you want to bind the listener to.\n * @param eventName - Name of the event you want listen for.\n * @param handler - Function to fire when receiving the event.\n * @param options - Options to pass to `Event.addEventListener`.\n *\n * @public\n */\nexport function useDomEvent(\n ref: RefObject<EventTarget | null>,\n eventName: string,\n handler?: EventListener | undefined,\n options?: AddEventListenerOptions\n) {\n useEffect(() => {\n const element = ref.current\n\n if (handler && element) {\n return addDomEvent(element, eventName, handler, options)\n }\n }, [ref, eventName, handler, options])\n}\n"],"names":[],"mappings":";;;;AAKA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG;;AAOE;AAEA;;;;AAIR;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisualElementDragControls.mjs","sources":["../../../../src/gestures/drag/VisualElementDragControls.ts"],"sourcesContent":["import {\n PanInfo,\n ResolvedConstraints,\n Transition,\n frame,\n mixNumber,\n percent,\n setDragLock,\n} from \"motion-dom\"\nimport { Axis, Point, invariant } from \"motion-utils\"\nimport { animateMotionValue } from \"../../animation/interfaces/motion-value\"\nimport { addDomEvent } from \"../../events/add-dom-event\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { extractEventInfo } from \"../../events/event-info\"\nimport { MotionProps } from \"../../motion/types\"\nimport {\n convertBoundingBoxToBox,\n convertBoxToBoundingBox,\n} from \"../../projection/geometry/conversion\"\nimport { calcLength } from \"../../projection/geometry/delta-calc\"\nimport { createBox } from \"../../projection/geometry/models\"\nimport { LayoutUpdateData } from \"../../projection/node/types\"\nimport { eachAxis } from \"../../projection/utils/each-axis\"\nimport { measurePageBox } from \"../../projection/utils/measure\"\nimport type { VisualElement } from \"../../render/VisualElement\"\nimport { getContextWindow } from \"../../utils/get-context-window\"\nimport { isRefObject } from \"../../utils/is-ref-object\"\nimport { addValueToWillChange } from \"../../value/use-will-change/add-will-change\"\nimport { PanSession } from \"../pan/PanSession\"\nimport {\n applyConstraints,\n calcOrigin,\n calcRelativeConstraints,\n calcViewportConstraints,\n defaultElastic,\n rebaseAxisConstraints,\n resolveDragElastic,\n} from \"./utils/constraints\"\n\nexport const elementDragControls = new WeakMap<\n VisualElement,\n VisualElementDragControls\n>()\n\nexport interface DragControlOptions {\n /**\n * This distance after which dragging starts and a direction is locked in.\n *\n * @public\n */\n distanceThreshold?: number\n\n /**\n * Whether to immediately snap to the cursor when dragging starts.\n *\n * @public\n */\n snapToCursor?: boolean\n}\n\ntype DragDirection = \"x\" | \"y\"\n\nexport class VisualElementDragControls {\n private visualElement: VisualElement<HTMLElement>\n\n private panSession?: PanSession\n\n private openDragLock: VoidFunction | null = null\n\n isDragging = false\n private currentDirection: DragDirection | null = null\n\n private originPoint: Point = { x: 0, y: 0 }\n\n /**\n * The permitted boundaries of travel, in pixels.\n */\n private constraints: ResolvedConstraints | false = false\n\n private hasMutatedConstraints = false\n\n /**\n * The per-axis resolved elastic values.\n */\n private elastic = createBox()\n\n /**\n * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n private latestPointerEvent: PointerEvent | null = null\n\n /**\n * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.\n */\n private latestPanInfo: PanInfo | null = null\n\n constructor(visualElement: VisualElement<HTMLElement>) {\n this.visualElement = visualElement\n }\n\n start(\n originEvent: PointerEvent,\n { snapToCursor = false, distanceThreshold }: DragControlOptions = {}\n ) {\n /**\n * Don't start dragging if this component is exiting\n */\n const { presenceContext } = this.visualElement\n if (presenceContext && presenceContext.isPresent === false) return\n\n const onSessionStart = (event: PointerEvent) => {\n const { dragSnapToOrigin } = this.getProps()\n\n // Stop or pause any animations on both axis values immediately. This allows the user to throw and catch\n // the component.\n dragSnapToOrigin ? this.pauseAnimation() : this.stopAnimation()\n\n if (snapToCursor) {\n this.snapToCursor(extractEventInfo(event).point)\n }\n }\n\n const onStart = (event: PointerEvent, info: PanInfo) => {\n // Attempt to grab the global drag gesture lock - maybe make this part of PanSession\n const { drag, dragPropagation, onDragStart } = this.getProps()\n\n if (drag && !dragPropagation) {\n if (this.openDragLock) this.openDragLock()\n\n this.openDragLock = setDragLock(drag)\n\n // If we don 't have the lock, don't start dragging\n if (!this.openDragLock) return\n }\n\n this.latestPointerEvent = event\n this.latestPanInfo = info\n this.isDragging = true\n\n this.currentDirection = null\n\n this.resolveConstraints()\n\n if (this.visualElement.projection) {\n this.visualElement.projection.isAnimationBlocked = true\n this.visualElement.projection.target = undefined\n }\n\n /**\n * Record gesture origin\n */\n eachAxis((axis) => {\n let current = this.getAxisMotionValue(axis).get() || 0\n\n /**\n * If the MotionValue is a percentage value convert to px\n */\n if (percent.test(current)) {\n const { projection } = this.visualElement\n\n if (projection && projection.layout) {\n const measuredAxis = projection.layout.layoutBox[axis]\n\n if (measuredAxis) {\n const length = calcLength(measuredAxis)\n current = length * (parseFloat(current) / 100)\n }\n }\n }\n\n this.originPoint[axis] = current\n })\n\n // Fire onDragStart event\n if (onDragStart) {\n frame.postRender(() => onDragStart(event, info))\n }\n\n addValueToWillChange(this.visualElement, \"transform\")\n\n const { animationState } = this.visualElement\n animationState && animationState.setActive(\"whileDrag\", true)\n }\n\n const onMove = (event: PointerEvent, info: PanInfo) => {\n this.latestPointerEvent = event\n this.latestPanInfo = info\n\n const {\n dragPropagation,\n dragDirectionLock,\n onDirectionLock,\n onDrag,\n } = this.getProps()\n\n // If we didn't successfully receive the gesture lock, early return.\n if (!dragPropagation && !this.openDragLock) return\n\n const { offset } = info\n // Attempt to detect drag direction if directionLock is true\n if (dragDirectionLock && this.currentDirection === null) {\n this.currentDirection = getCurrentDirection(offset)\n\n // If we've successfully set a direction, notify listener\n if (this.currentDirection !== null) {\n onDirectionLock && onDirectionLock(this.currentDirection)\n }\n\n return\n }\n\n // Update each point with the latest position\n this.updateAxis(\"x\", info.point, offset)\n this.updateAxis(\"y\", info.point, offset)\n\n /**\n * Ideally we would leave the renderer to fire naturally at the end of\n * this frame but if the element is about to change layout as the result\n * of a re-render we want to ensure the browser can read the latest\n * bounding box to ensure the pointer and element don't fall out of sync.\n */\n this.visualElement.render()\n\n /**\n * This must fire after the render call as it might trigger a state\n * change which itself might trigger a layout update.\n */\n onDrag && onDrag(event, info)\n }\n\n const onSessionEnd = (event: PointerEvent, info: PanInfo) => {\n this.latestPointerEvent = event\n this.latestPanInfo = info\n\n this.stop(event, info)\n\n this.latestPointerEvent = null\n this.latestPanInfo = null\n }\n\n const resumeAnimation = () =>\n eachAxis(\n (axis) =>\n this.getAnimationState(axis) === \"paused\" &&\n this.getAxisMotionValue(axis).animation?.play()\n )\n\n const { dragSnapToOrigin } = this.getProps()\n this.panSession = new PanSession(\n originEvent,\n {\n onSessionStart,\n onStart,\n onMove,\n onSessionEnd,\n resumeAnimation,\n },\n {\n transformPagePoint: this.visualElement.getTransformPagePoint(),\n dragSnapToOrigin,\n distanceThreshold,\n contextWindow: getContextWindow(this.visualElement),\n }\n )\n }\n\n /**\n * @internal\n */\n stop(event?: PointerEvent, panInfo?: PanInfo) {\n const finalEvent = event || this.latestPointerEvent\n const finalPanInfo = panInfo || this.latestPanInfo\n\n const isDragging = this.isDragging\n this.cancel()\n if (!isDragging || !finalPanInfo || !finalEvent) return\n\n const { velocity } = finalPanInfo\n this.startAnimation(velocity)\n\n const { onDragEnd } = this.getProps()\n if (onDragEnd) {\n frame.postRender(() => onDragEnd(finalEvent, finalPanInfo))\n }\n }\n\n /**\n * @internal\n */\n cancel() {\n this.isDragging = false\n\n const { projection, animationState } = this.visualElement\n\n if (projection) {\n projection.isAnimationBlocked = false\n }\n\n this.panSession && this.panSession.end()\n this.panSession = undefined\n\n const { dragPropagation } = this.getProps()\n\n if (!dragPropagation && this.openDragLock) {\n this.openDragLock()\n this.openDragLock = null\n }\n\n animationState && animationState.setActive(\"whileDrag\", false)\n }\n\n private updateAxis(axis: DragDirection, _point: Point, offset?: Point) {\n const { drag } = this.getProps()\n\n // If we're not dragging this axis, do an early return.\n if (!offset || !shouldDrag(axis, drag, this.currentDirection)) return\n\n const axisValue = this.getAxisMotionValue(axis)\n let next = this.originPoint[axis] + offset[axis]\n\n // Apply constraints\n if (this.constraints && this.constraints[axis]) {\n next = applyConstraints(\n next,\n this.constraints[axis],\n this.elastic[axis]\n )\n }\n\n axisValue.set(next)\n }\n\n private resolveConstraints() {\n const { dragConstraints, dragElastic } = this.getProps()\n\n const layout =\n this.visualElement.projection &&\n !this.visualElement.projection.layout\n ? this.visualElement.projection.measure(false)\n : this.visualElement.projection?.layout\n\n const prevConstraints = this.constraints\n\n if (dragConstraints && isRefObject(dragConstraints)) {\n if (!this.constraints) {\n this.constraints = this.resolveRefConstraints()\n }\n } else {\n if (dragConstraints && layout) {\n this.constraints = calcRelativeConstraints(\n layout.layoutBox,\n dragConstraints\n )\n } else {\n this.constraints = false\n }\n }\n\n this.elastic = resolveDragElastic(dragElastic)\n\n /**\n * If we're outputting to external MotionValues, we want to rebase the measured constraints\n * from viewport-relative to component-relative.\n */\n if (\n prevConstraints !== this.constraints &&\n layout &&\n this.constraints &&\n !this.hasMutatedConstraints\n ) {\n eachAxis((axis) => {\n if (\n this.constraints !== false &&\n this.getAxisMotionValue(axis)\n ) {\n this.constraints[axis] = rebaseAxisConstraints(\n layout.layoutBox[axis],\n this.constraints[axis]\n )\n }\n })\n }\n }\n\n private resolveRefConstraints() {\n const { dragConstraints: constraints, onMeasureDragConstraints } =\n this.getProps()\n if (!constraints || !isRefObject(constraints)) return false\n\n const constraintsElement = constraints.current as HTMLElement\n\n invariant(\n constraintsElement !== null,\n \"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.\",\n \"drag-constraints-ref\"\n )\n\n const { projection } = this.visualElement\n\n // TODO\n if (!projection || !projection.layout) return false\n\n const constraintsBox = measurePageBox(\n constraintsElement,\n projection.root!,\n this.visualElement.getTransformPagePoint()\n )\n\n let measuredConstraints = calcViewportConstraints(\n projection.layout.layoutBox,\n constraintsBox\n )\n\n /**\n * If there's an onMeasureDragConstraints listener we call it and\n * if different constraints are returned, set constraints to that\n */\n if (onMeasureDragConstraints) {\n const userConstraints = onMeasureDragConstraints(\n convertBoxToBoundingBox(measuredConstraints)\n )\n\n this.hasMutatedConstraints = !!userConstraints\n\n if (userConstraints) {\n measuredConstraints = convertBoundingBoxToBox(userConstraints)\n }\n }\n\n return measuredConstraints\n }\n\n private startAnimation(velocity: Point) {\n const {\n drag,\n dragMomentum,\n dragElastic,\n dragTransition,\n dragSnapToOrigin,\n onDragTransitionEnd,\n } = this.getProps()\n\n const constraints: Partial<ResolvedConstraints> = this.constraints || {}\n\n const momentumAnimations = eachAxis((axis) => {\n if (!shouldDrag(axis, drag, this.currentDirection)) {\n return\n }\n\n let transition = (constraints && constraints[axis]) || {}\n\n if (dragSnapToOrigin) transition = { min: 0, max: 0 }\n\n /**\n * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame\n * of spring animations so we should look into adding a disable spring option to `inertia`.\n * We could do something here where we affect the `bounceStiffness` and `bounceDamping`\n * using the value of `dragElastic`.\n */\n const bounceStiffness = dragElastic ? 200 : 1000000\n const bounceDamping = dragElastic ? 40 : 10000000\n\n const inertia: Transition = {\n type: \"inertia\",\n velocity: dragMomentum ? velocity[axis] : 0,\n bounceStiffness,\n bounceDamping,\n timeConstant: 750,\n restDelta: 1,\n restSpeed: 10,\n ...dragTransition,\n ...transition,\n }\n\n // If we're not animating on an externally-provided `MotionValue` we can use the\n // component's animation controls which will handle interactions with whileHover (etc),\n // otherwise we just have to animate the `MotionValue` itself.\n return this.startAxisValueAnimation(axis, inertia)\n })\n\n // Run all animations and then resolve the new drag constraints.\n return Promise.all(momentumAnimations).then(onDragTransitionEnd)\n }\n\n private startAxisValueAnimation(\n axis: DragDirection,\n transition: Transition\n ) {\n const axisValue = this.getAxisMotionValue(axis)\n\n addValueToWillChange(this.visualElement, axis)\n\n return axisValue.start(\n animateMotionValue(\n axis,\n axisValue,\n 0,\n transition,\n this.visualElement,\n false\n )\n )\n }\n\n private stopAnimation() {\n eachAxis((axis) => this.getAxisMotionValue(axis).stop())\n }\n\n private pauseAnimation() {\n eachAxis((axis) => this.getAxisMotionValue(axis).animation?.pause())\n }\n\n private getAnimationState(axis: DragDirection) {\n return this.getAxisMotionValue(axis).animation?.state\n }\n\n /**\n * Drag works differently depending on which props are provided.\n *\n * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.\n * - Otherwise, we apply the delta to the x/y motion values.\n */\n private getAxisMotionValue(axis: DragDirection) {\n const dragKey =\n `_drag${axis.toUpperCase()}` as `_drag${Uppercase<DragDirection>}`\n const props = this.visualElement.getProps()\n const externalMotionValue = props[dragKey]\n\n return externalMotionValue\n ? externalMotionValue\n : this.visualElement.getValue(\n axis,\n (props.initial\n ? props.initial[axis as keyof typeof props.initial]\n : undefined) || 0\n )\n }\n\n private snapToCursor(point: Point) {\n eachAxis((axis) => {\n const { drag } = this.getProps()\n\n // If we're not dragging this axis, do an early return.\n if (!shouldDrag(axis, drag, this.currentDirection)) return\n\n const { projection } = this.visualElement\n const axisValue = this.getAxisMotionValue(axis)\n\n if (projection && projection.layout) {\n const { min, max } = projection.layout.layoutBox[axis]\n\n axisValue.set(point[axis] - mixNumber(min, max, 0.5))\n }\n })\n }\n\n /**\n * When the viewport resizes we want to check if the measured constraints\n * have changed and, if so, reposition the element within those new constraints\n * relative to where it was before the resize.\n */\n scalePositionWithinConstraints() {\n if (!this.visualElement.current) return\n\n const { drag, dragConstraints } = this.getProps()\n const { projection } = this.visualElement\n if (!isRefObject(dragConstraints) || !projection || !this.constraints)\n return\n\n /**\n * Stop current animations as there can be visual glitching if we try to do\n * this mid-animation\n */\n this.stopAnimation()\n\n /**\n * Record the relative position of the dragged element relative to the\n * constraints box and save as a progress value.\n */\n const boxProgress = { x: 0, y: 0 }\n eachAxis((axis) => {\n const axisValue = this.getAxisMotionValue(axis)\n if (axisValue && this.constraints !== false) {\n const latest = axisValue.get()\n boxProgress[axis] = calcOrigin(\n { min: latest, max: latest },\n this.constraints[axis] as Axis\n )\n }\n })\n\n /**\n * Update the layout of this element and resolve the latest drag constraints\n */\n const { transformTemplate } = this.visualElement.getProps()\n this.visualElement.current.style.transform = transformTemplate\n ? transformTemplate({}, \"\")\n : \"none\"\n projection.root && projection.root.updateScroll()\n projection.updateLayout()\n this.resolveConstraints()\n\n /**\n * For each axis, calculate the current progress of the layout axis\n * within the new constraints.\n */\n eachAxis((axis) => {\n if (!shouldDrag(axis, drag, null)) return\n\n /**\n * Calculate a new transform based on the previous box progress\n */\n const axisValue = this.getAxisMotionValue(axis)\n const { min, max } = (this.constraints as ResolvedConstraints)[\n axis\n ] as Axis\n axisValue.set(mixNumber(min, max, boxProgress[axis]))\n })\n }\n\n addListeners() {\n if (!this.visualElement.current) return\n elementDragControls.set(this.visualElement, this)\n const element = this.visualElement.current\n\n /**\n * Attach a pointerdown event listener on this DOM element to initiate drag tracking.\n */\n const stopPointerListener = addPointerEvent(\n element,\n \"pointerdown\",\n (event) => {\n const { drag, dragListener = true } = this.getProps()\n drag && dragListener && this.start(event)\n }\n )\n\n const measureDragConstraints = () => {\n const { dragConstraints } = this.getProps()\n if (isRefObject(dragConstraints) && dragConstraints.current) {\n this.constraints = this.resolveRefConstraints()\n }\n }\n\n const { projection } = this.visualElement\n\n const stopMeasureLayoutListener = projection!.addEventListener(\n \"measure\",\n measureDragConstraints\n )\n\n if (projection && !projection!.layout) {\n projection.root && projection.root.updateScroll()\n projection.updateLayout()\n }\n\n frame.read(measureDragConstraints)\n\n /**\n * Attach a window resize listener to scale the draggable target within its defined\n * constraints as the window resizes.\n */\n const stopResizeListener = addDomEvent(window, \"resize\", () =>\n this.scalePositionWithinConstraints()\n )\n\n /**\n * If the element's layout changes, calculate the delta and apply that to\n * the drag gesture's origin point.\n */\n const stopLayoutUpdateListener = projection!.addEventListener(\n \"didUpdate\",\n (({ delta, hasLayoutChanged }: LayoutUpdateData) => {\n if (this.isDragging && hasLayoutChanged) {\n eachAxis((axis) => {\n const motionValue = this.getAxisMotionValue(axis)\n if (!motionValue) return\n\n this.originPoint[axis] += delta[axis].translate\n motionValue.set(\n motionValue.get() + delta[axis].translate\n )\n })\n\n this.visualElement.render()\n }\n }) as any\n )\n\n return () => {\n stopResizeListener()\n stopPointerListener()\n stopMeasureLayoutListener()\n stopLayoutUpdateListener && stopLayoutUpdateListener()\n }\n }\n\n getProps(): MotionProps {\n const props = this.visualElement.getProps()\n const {\n drag = false,\n dragDirectionLock = false,\n dragPropagation = false,\n dragConstraints = false,\n dragElastic = defaultElastic,\n dragMomentum = true,\n } = props\n return {\n ...props,\n drag,\n dragDirectionLock,\n dragPropagation,\n dragConstraints,\n dragElastic,\n dragMomentum,\n }\n }\n}\n\nfunction shouldDrag(\n direction: DragDirection,\n drag: boolean | DragDirection | undefined,\n currentDirection: null | DragDirection\n) {\n return (\n (drag === true || drag === direction) &&\n (currentDirection === null || currentDirection === direction)\n )\n}\n\n/**\n * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower\n * than the provided threshold, return `null`.\n *\n * @param offset - The x/y offset from origin.\n * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.\n */\nfunction getCurrentDirection(\n offset: Point,\n lockThreshold = 10\n): DragDirection | null {\n let direction: DragDirection | null = null\n\n if (Math.abs(offset.y) > lockThreshold) {\n direction = \"y\"\n } else if (Math.abs(offset.x) > lockThreshold) {\n direction = \"x\"\n }\n\n return direction\n}\n\nexport function expectsResolvedDragConstraints({\n dragConstraints,\n onMeasureDragConstraints,\n}: MotionProps) {\n return isRefObject(dragConstraints) && !!onMeasureDragConstraints\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAuCa,MAAA,mBAAmB,GAAG,IAAI,OAAO,GAG3C;MAoBU,yBAAyB,CAAA;AAkClC,IAAA,WAAA,CAAY,aAAyC,EAAA;QA7B7C,IAAY,CAAA,YAAA,GAAwB,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AAA;IAE1C,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE;QACpC,SAAS,GAAG,GAAG,CAAA;KAClB;SAAM,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE;QAC3C,SAAS,GAAG,GAAG,CAAA;KAClB;AAED,IAAA,OAAO,SAAS,CAAA;AACpB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/gestures/drag/index.ts"],"sourcesContent":["import { Feature } from \"../../motion/features/Feature\"\nimport type { VisualElement } from \"../../render/VisualElement\"\nimport { noop } from \"motion-utils\"\nimport { VisualElementDragControls } from \"./VisualElementDragControls\"\n\nexport class DragGesture extends Feature<HTMLElement> {\n controls: VisualElementDragControls\n\n removeGroupControls: Function = noop\n removeListeners: Function = noop\n\n constructor(node: VisualElement<HTMLElement>) {\n super(node)\n this.controls = new VisualElementDragControls(node)\n }\n\n mount() {\n // If we've been provided a DragControls for manual control over the drag gesture,\n // subscribe this component to it on mount.\n const { dragControls } = this.node.getProps()\n\n if (dragControls) {\n this.removeGroupControls = dragControls.subscribe(this.controls)\n }\n\n this.removeListeners = this.controls.addListeners() || noop\n }\n\n unmount() {\n this.removeGroupControls()\n this.removeListeners()\n }\n}\n"],"names":[],"mappings":";;;;AAKM,MAAO,WAAY,SAAQ,OAAoB,CAAA;AAMjD,IAAA,WAAA,CAAY,IAAgC,EAAA;QACxC,KAAK,CAAC,IAAI,CAAC,CAAA;QAJf,IAAmB,CAAA,mBAAA,GAAa,IAAI,CAAA;QACpC,IAAe,CAAA,eAAA,GAAa,IAAI,CAAA;QAI5B,IAAI,CAAC,QAAQ,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAA;KACtD;IAED,KAAK,GAAA;;;QAGD,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAA;QAE7C,IAAI,YAAY,EAAE;YACd,IAAI,CAAC,mBAAmB,GAAG,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;SACnE;QAED,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,IAAI,IAAI,CAAA;KAC9D;IAED,OAAO,GAAA;QACH,IAAI,CAAC,mBAAmB,EAAE,CAAA;QAC1B,IAAI,CAAC,eAAe,EAAE,CAAA;KACzB;AACJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-drag-controls.mjs","sources":["../../../../src/gestures/drag/use-drag-controls.ts"],"sourcesContent":["import * as React from \"react\"\nimport { useConstant } from \"../../utils/use-constant\"\nimport {\n DragControlOptions,\n VisualElementDragControls,\n} from \"./VisualElementDragControls\"\n\n/**\n * Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n * dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n * <>\n * <div onPointerDown={startDrag} />\n * <motion.div drag=\"x\" dragControls={dragControls} />\n * </>\n * )\n * ```\n *\n * @public\n */\nexport class DragControls {\n private componentControls = new Set<VisualElementDragControls>()\n\n /**\n * Subscribe a component's internal `VisualElementDragControls` to the user-facing API.\n *\n * @internal\n */\n subscribe(controls: VisualElementDragControls): () => void {\n this.componentControls.add(controls)\n\n return () => this.componentControls.delete(controls)\n }\n\n /**\n * Start a drag gesture on every `motion` component that has this set of drag controls\n * passed into it via the `dragControls` prop.\n *\n * ```jsx\n * dragControls.start(e, {\n * snapToCursor: true\n * })\n * ```\n *\n * @param event - PointerEvent\n * @param options - Options\n *\n * @public\n */\n start(\n event: React.PointerEvent | PointerEvent,\n options?: DragControlOptions\n ) {\n this.componentControls.forEach((controls) => {\n controls.start(\n (event as React.PointerEvent).nativeEvent || event,\n options\n )\n })\n }\n\n /**\n * Cancels a drag gesture.\n *\n * ```jsx\n * dragControls.cancel()\n * ```\n *\n * @public\n */\n cancel() {\n this.componentControls.forEach((controls) => {\n controls.cancel()\n })\n }\n\n /**\n * Stops a drag gesture.\n *\n * ```jsx\n * dragControls.stop()\n * ```\n *\n * @public\n */\n stop() {\n this.componentControls.forEach((controls) => {\n controls.stop()\n })\n }\n}\n\nconst createDragControls = () => new DragControls()\n\n/**\n * Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop\n * and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we\n * might want to initiate that dragging from a different component than the draggable one.\n *\n * By creating a `dragControls` using the `useDragControls` hook, we can pass this into\n * the draggable component's `dragControls` prop. It exposes a `start` method\n * that can start dragging from pointer events on other components.\n *\n * ```jsx\n * const dragControls = useDragControls()\n *\n * function startDrag(event) {\n * dragControls.start(event, { snapToCursor: true })\n * }\n *\n * return (\n * <>\n * <div onPointerDown={startDrag} />\n * <motion.div drag=\"x\" dragControls={dragControls} />\n * </>\n * )\n * ```\n *\n * @public\n */\nexport function useDragControls() {\n return useConstant(createDragControls)\n}\n"],"names":[],"mappings":";;AAOA;;;;;;;;;;;;;;;;;;;AAmBG;MACU,YAAY,CAAA;AAAzB,IAAA,WAAA,GAAA;AACY,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,GAAG,EAA6B,CAAA;KAqEnE;AAnEG;;;;AAIG;AACH,IAAA,SAAS,CAAC,QAAmC,EAAA;AACzC,QAAA,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QAEpC,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;KACvD;AAED;;;;;;;;;;;;;;AAcG;IACH,KAAK,CACD,KAAwC,EACxC,OAA4B,EAAA;QAE5B,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAI;YACxC,QAAQ,CAAC,KAAK,CACT,KAA4B,CAAC,WAAW,IAAI,KAAK,EAClD,OAAO,CACV,CAAA;AACL,SAAC,CAAC,CAAA;KACL;AAED;;;;;;;;AAQG;IACH,MAAM,GAAA;QACF,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAI;YACxC,QAAQ,CAAC,MAAM,EAAE,CAAA;AACrB,SAAC,CAAC,CAAA;KACL;AAED;;;;;;;;AAQG;IACH,IAAI,GAAA;QACA,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAI;YACxC,QAAQ,CAAC,IAAI,EAAE,CAAA;AACnB,SAAC,CAAC,CAAA;KACL;AACJ,CAAA;AAED,MAAM,kBAAkB,GAAG,MAAM,IAAI,YAAY,EAAE,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;SACa,eAAe,GAAA;AAC3B,IAAA,OAAO,WAAW,CAAC,kBAAkB,CAAC,CAAA;AAC1C;;;;"}
|
|
@@ -126,3 +126,4 @@ function resolvePointElastic(dragElastic, label) {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
export { applyConstraints, calcOrigin, calcRelativeAxisConstraints, calcRelativeConstraints, calcViewportAxisConstraints, calcViewportConstraints, defaultElastic, rebaseAxisConstraints, resolveAxisElastic, resolveDragElastic, resolvePointElastic };
|
|
129
|
+
//# sourceMappingURL=constraints.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints.mjs","sources":["../../../../../src/gestures/drag/utils/constraints.ts"],"sourcesContent":["import type { DragElastic, ResolvedConstraints } from \"motion-dom\"\nimport { mixNumber } from \"motion-dom\"\nimport {\n Axis,\n BoundingBox,\n Box,\n progress as calcProgress,\n clamp,\n Point,\n} from \"motion-utils\"\nimport { calcLength } from \"../../../projection/geometry/delta-calc\"\n\n/**\n * Apply constraints to a point. These constraints are both physical along an\n * axis, and an elastic factor that determines how much to constrain the point\n * by if it does lie outside the defined parameters.\n */\nexport function applyConstraints(\n point: number,\n { min, max }: Partial<Axis>,\n elastic?: Axis\n): number {\n if (min !== undefined && point < min) {\n // If we have a min point defined, and this is outside of that, constrain\n point = elastic\n ? mixNumber(min, point, elastic.min)\n : Math.max(point, min)\n } else if (max !== undefined && point > max) {\n // If we have a max point defined, and this is outside of that, constrain\n point = elastic\n ? mixNumber(max, point, elastic.max)\n : Math.min(point, max)\n }\n\n return point\n}\n\n/**\n * Calculates a min projection point based on a pointer, pointer progress\n * within the drag target, and constraints.\n *\n * For instance if an element was 100px width, we were dragging from 0.25\n * along this axis, the pointer is at 200px, and there were no constraints,\n * we would calculate a min projection point of 175px.\n */\nexport function calcConstrainedMinPoint(\n point: number,\n length: number,\n progress: number,\n constraints?: Partial<Axis>,\n elastic?: Axis\n): number {\n // Calculate a min point for this axis and apply it to the current pointer\n const min = point - length * progress\n\n return constraints ? applyConstraints(min, constraints, elastic) : min\n}\n\n/**\n * Calculate constraints in terms of the viewport when defined relatively to the\n * measured axis. This is measured from the nearest edge, so a max constraint of 200\n * on an axis with a max value of 300 would return a constraint of 500 - axis length\n */\nexport function calcRelativeAxisConstraints(\n axis: Axis,\n min?: number,\n max?: number\n): Partial<Axis> {\n return {\n min: min !== undefined ? axis.min + min : undefined,\n max:\n max !== undefined\n ? axis.max + max - (axis.max - axis.min)\n : undefined,\n }\n}\n\n/**\n * Calculate constraints in terms of the viewport when\n * defined relatively to the measured bounding box.\n */\nexport function calcRelativeConstraints(\n layoutBox: Box,\n { top, left, bottom, right }: Partial<BoundingBox>\n): ResolvedConstraints {\n return {\n x: calcRelativeAxisConstraints(layoutBox.x, left, right),\n y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),\n }\n}\n\n/**\n * Calculate viewport constraints when defined as another viewport-relative axis\n */\nexport function calcViewportAxisConstraints(\n layoutAxis: Axis,\n constraintsAxis: Axis\n) {\n let min = constraintsAxis.min - layoutAxis.min\n let max = constraintsAxis.max - layoutAxis.max\n\n // If the constraints axis is actually smaller than the layout axis then we can\n // flip the constraints\n if (\n constraintsAxis.max - constraintsAxis.min <\n layoutAxis.max - layoutAxis.min\n ) {\n ;[min, max] = [max, min]\n }\n\n return { min, max }\n}\n\n/**\n * Calculate viewport constraints when defined as another viewport-relative box\n */\nexport function calcViewportConstraints(layoutBox: Box, constraintsBox: Box) {\n return {\n x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),\n y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),\n }\n}\n\n/**\n * Calculate a transform origin relative to the source axis, between 0-1, that results\n * in an asthetically pleasing scale/transform needed to project from source to target.\n */\nexport function calcOrigin(source: Axis, target: Axis): number {\n let origin = 0.5\n const sourceLength = calcLength(source)\n const targetLength = calcLength(target)\n\n if (targetLength > sourceLength) {\n origin = calcProgress(target.min, target.max - sourceLength, source.min)\n } else if (sourceLength > targetLength) {\n origin = calcProgress(source.min, source.max - targetLength, target.min)\n }\n\n return clamp(0, 1, origin)\n}\n\n/**\n * Calculate the relative progress of one constraints box relative to another.\n * Imagine a page scroll bar. At the top, this would return 0, at the bottom, 1.\n * Anywhere in-between, a value between 0 and 1.\n *\n * This also handles flipped constraints, for instance a draggable container within\n * a smaller viewport like a scrollable view.\n */\nexport function calcProgressWithinConstraints(\n layoutBox: Box,\n constraintsBox: Box\n): Point {\n return {\n x: calcOrigin(layoutBox.x, constraintsBox.x),\n y: calcOrigin(layoutBox.y, constraintsBox.y),\n }\n}\n\n/**\n * Calculate the an axis position based on two axes and a progress value.\n */\nexport function calcPositionFromProgress(\n axis: Axis,\n constraints: Axis,\n progress: number\n): Axis {\n const axisLength = axis.max - axis.min\n const min = mixNumber(\n constraints.min,\n constraints.max - axisLength,\n progress\n )\n return { min, max: min + axisLength }\n}\n\n/**\n * Rebase the calculated viewport constraints relative to the layout.min point.\n */\nexport function rebaseAxisConstraints(\n layout: Axis,\n constraints: Partial<Axis>\n): Partial<Axis> {\n const relativeConstraints: Partial<Axis> = {}\n\n if (constraints.min !== undefined) {\n relativeConstraints.min = constraints.min - layout.min\n }\n\n if (constraints.max !== undefined) {\n relativeConstraints.max = constraints.max - layout.min\n }\n\n return relativeConstraints\n}\n\nexport const defaultElastic = 0.35\n/**\n * Accepts a dragElastic prop and returns resolved elastic values for each axis.\n */\nexport function resolveDragElastic(\n dragElastic: DragElastic = defaultElastic\n): Box {\n if (dragElastic === false) {\n dragElastic = 0\n } else if (dragElastic === true) {\n dragElastic = defaultElastic\n }\n\n return {\n x: resolveAxisElastic(dragElastic, \"left\", \"right\"),\n y: resolveAxisElastic(dragElastic, \"top\", \"bottom\"),\n }\n}\n\nexport function resolveAxisElastic(\n dragElastic: DragElastic,\n minLabel: string,\n maxLabel: string\n): Axis {\n return {\n min: resolvePointElastic(dragElastic, minLabel),\n max: resolvePointElastic(dragElastic, maxLabel),\n }\n}\n\nexport function resolvePointElastic(\n dragElastic: DragElastic,\n label: string\n): number {\n return typeof dragElastic === \"number\"\n ? dragElastic\n : dragElastic[label as keyof typeof dragElastic] || 0\n}\n"],"names":["calcProgress"],"mappings":";;;;AAYA;;;;AAIG;AACG,SAAU,gBAAgB,CAC5B,KAAa,EACb,EAAE,GAAG,EAAE,GAAG,EAAiB,EAC3B,OAAc,EAAA;IAEd,IAAI,GAAG,KAAK,SAAS,IAAI,KAAK,GAAG,GAAG,EAAE;;AAElC,QAAA,KAAK,GAAG,OAAO;cACT,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;cAClC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;KAC7B;SAAM,IAAI,GAAG,KAAK,SAAS,IAAI,KAAK,GAAG,GAAG,EAAE;;AAEzC,QAAA,KAAK,GAAG,OAAO;cACT,SAAS,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;cAClC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;KAC7B;AAED,IAAA,OAAO,KAAK,CAAA;AAChB,CAAC;AAuBD;;;;AAIG;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,MAAM,cAAc,GAAG,KAAI;AAClC;;AAEG;AACa,SAAA,kBAAkB,CAC9B,WAAA,GAA2B,cAAc,EAAA;AAEzC,IAAA,IAAI,WAAW,KAAK,KAAK,EAAE;QACvB,WAAW,GAAG,CAAC,CAAA;KAClB;AAAM,SAAA,IAAI,WAAW,KAAK,IAAI,EAAE;QAC7B,WAAW,GAAG,cAAc,CAAA;KAC/B;IAED,OAAO;QACH,CAAC,EAAE,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;QACnD,CAAC,EAAE,kBAAkB,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC;KACtD,CAAA;AACL,CAAC;SAEe,kBAAkB,CAC9B,WAAwB,EACxB,QAAgB,EAChB,QAAgB,EAAA;IAEhB,OAAO;AACH,QAAA,GAAG,EAAE,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC;AAC/C,QAAA,GAAG,EAAE,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC;KAClD,CAAA;AACL,CAAC;AAEe,SAAA,mBAAmB,CAC/B,WAAwB,EACxB,KAAa,EAAA;IAEb,OAAO,OAAO,WAAW,KAAK,QAAQ;AAClC,UAAE,WAAW;AACb,UAAE,WAAW,CAAC,KAAiC,CAAC,IAAI,CAAC,CAAA;AAC7D;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.mjs","sources":["../../../src/gestures/focus.ts"],"sourcesContent":["import { pipe } from \"motion-utils\"\nimport { addDomEvent } from \"../events/add-dom-event\"\nimport { Feature } from \"../motion/features/Feature\"\n\nexport class FocusGesture extends Feature<Element> {\n private isActive = false\n\n onFocus() {\n let isFocusVisible = false\n\n /**\n * If this element doesn't match focus-visible then don't\n * apply whileHover. But, if matches throws that focus-visible\n * is not a valid selector then in that browser outline styles will be applied\n * to the element by default and we want to match that behaviour with whileFocus.\n */\n try {\n isFocusVisible = this.node.current!.matches(\":focus-visible\")\n } catch (e) {\n isFocusVisible = true\n }\n\n if (!isFocusVisible || !this.node.animationState) return\n\n this.node.animationState.setActive(\"whileFocus\", true)\n this.isActive = true\n }\n\n onBlur() {\n if (!this.isActive || !this.node.animationState) return\n this.node.animationState.setActive(\"whileFocus\", false)\n this.isActive = false\n }\n\n mount() {\n this.unmount = pipe(\n addDomEvent(this.node.current!, \"focus\", () => this.onFocus()),\n addDomEvent(this.node.current!, \"blur\", () => this.onBlur())\n ) as VoidFunction\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;;;AAIM,MAAO,YAAa,SAAQ,OAAgB,CAAA;AAAlD,IAAA,WAAA,GAAA;;QACY,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAA;KAqC3B;IAnCG,OAAO,GAAA;QACH,IAAI,cAAc,GAAG,KAAK,CAAA;AAE1B;;;;;AAKG;AACH,QAAA,IAAI;YACA,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,OAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;SAChE;QAAC,OAAO,CAAC,EAAE;YACR,cAAc,GAAG,IAAI,CAAA;SACxB;QAED,IAAI,CAAC,cAAc,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc;YAAE,OAAM;QAExD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,CAAA;AACtD,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;KACvB;IAED,MAAM,GAAA;QACF,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc;YAAE,OAAM;QACvD,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;AACvD,QAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;KACxB;IAED,KAAK,GAAA;AACD,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CACf,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAQ,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,EAC9D,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAQ,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAC/C,CAAA;KACpB;AAED,IAAA,OAAO,MAAK;AACf;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover.mjs","sources":["../../../src/gestures/hover.ts"],"sourcesContent":["import { frame, hover } from \"motion-dom\"\nimport { extractEventInfo } from \"../events/event-info\"\nimport { Feature } from \"../motion/features/Feature\"\nimport type { VisualElement } from \"../render/VisualElement\"\n\nfunction handleHoverEvent(\n node: VisualElement<Element>,\n event: PointerEvent,\n lifecycle: \"Start\" | \"End\"\n) {\n const { props } = node\n\n if (node.animationState && props.whileHover) {\n node.animationState.setActive(\"whileHover\", lifecycle === \"Start\")\n }\n\n const eventName = (\"onHover\" + lifecycle) as \"onHoverStart\" | \"onHoverEnd\"\n const callback = props[eventName]\n if (callback) {\n frame.postRender(() => callback(event, extractEventInfo(event)))\n }\n}\n\nexport class HoverGesture extends Feature<Element> {\n mount() {\n const { current } = this.node\n if (!current) return\n\n this.unmount = hover(current, (_element, startEvent) => {\n handleHoverEvent(this.node, startEvent, \"Start\")\n\n return (endEvent) => handleHoverEvent(this.node, endEvent, \"End\")\n })\n }\n\n unmount() {}\n}\n"],"names":[],"mappings":";;;;AAKA,SAAS,gBAAgB,CACrB,IAA4B,EAC5B,KAAmB,EACnB,SAA0B,EAAA;AAE1B,IAAA,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;IAEtB,IAAI,IAAI,CAAC,cAAc,IAAI,KAAK,CAAC,UAAU,EAAE;QACzC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,YAAY,EAAE,SAAS,KAAK,OAAO,CAAC,CAAA;KACrE;AAED,IAAA,MAAM,SAAS,IAAI,SAAS,GAAG,SAAS,CAAkC,CAAA;AAC1E,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;IACjC,IAAI,QAAQ,EAAE;AACV,QAAA,KAAK,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KACnE;AACL,CAAC;AAEK,MAAO,YAAa,SAAQ,OAAgB,CAAA;IAC9C,KAAK,GAAA;AACD,QAAA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;AAC7B,QAAA,IAAI,CAAC,OAAO;YAAE,OAAM;AAEpB,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,UAAU,KAAI;YACnD,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;AAEhD,YAAA,OAAO,CAAC,QAAQ,KAAK,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;AACrE,SAAC,CAAC,CAAA;KACL;AAED,IAAA,OAAO,MAAK;AACf;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanSession.mjs","sources":["../../../../src/gestures/pan/PanSession.ts"],"sourcesContent":["import type { EventInfo, PanHandler } from \"motion-dom\"\nimport { cancelFrame, frame, frameData, isPrimaryPointer } from \"motion-dom\"\nimport {\n millisecondsToSeconds,\n pipe,\n Point,\n secondsToMilliseconds,\n TransformPoint,\n} from \"motion-utils\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { extractEventInfo } from \"../../events/event-info\"\nimport { distance2D } from \"../../utils/distance\"\n\ninterface PanSessionHandlers {\n onSessionStart: PanHandler\n onStart: PanHandler\n onMove: PanHandler\n onEnd: PanHandler\n onSessionEnd: PanHandler\n resumeAnimation: () => void\n}\n\ninterface PanSessionOptions {\n transformPagePoint?: TransformPoint\n dragSnapToOrigin?: boolean\n distanceThreshold?: number\n contextWindow?: (Window & typeof globalThis) | null\n}\n\ninterface TimestampedPoint extends Point {\n timestamp: number\n}\n\n/**\n * @internal\n */\nexport class PanSession {\n /**\n * @internal\n */\n private history: TimestampedPoint[]\n\n /**\n * @internal\n */\n private startEvent: PointerEvent | null = null\n\n /**\n * @internal\n */\n private lastMoveEvent: PointerEvent | null = null\n\n /**\n * @internal\n */\n private lastMoveEventInfo: EventInfo | null = null\n\n /**\n * @internal\n */\n private transformPagePoint?: TransformPoint\n\n /**\n * @internal\n */\n private handlers: Partial<PanSessionHandlers> = {}\n\n /**\n * @internal\n */\n private removeListeners: Function\n\n /**\n * For determining if an animation should resume after it is interupted\n *\n * @internal\n */\n private dragSnapToOrigin: boolean\n\n /**\n * The distance after which panning should start.\n *\n * @internal\n */\n private distanceThreshold: number\n\n /**\n * @internal\n */\n private contextWindow: PanSessionOptions[\"contextWindow\"] = window\n\n constructor(\n event: PointerEvent,\n handlers: Partial<PanSessionHandlers>,\n {\n transformPagePoint,\n contextWindow = window,\n dragSnapToOrigin = false,\n distanceThreshold = 3,\n }: PanSessionOptions = {}\n ) {\n // If we have more than one touch, don't start detecting this gesture\n if (!isPrimaryPointer(event)) return\n\n this.dragSnapToOrigin = dragSnapToOrigin\n this.handlers = handlers\n this.transformPagePoint = transformPagePoint\n this.distanceThreshold = distanceThreshold\n this.contextWindow = contextWindow || window\n\n const info = extractEventInfo(event)\n const initialInfo = transformPoint(info, this.transformPagePoint)\n const { point } = initialInfo\n\n const { timestamp } = frameData\n\n this.history = [{ ...point, timestamp }]\n\n const { onSessionStart } = handlers\n onSessionStart &&\n onSessionStart(event, getPanInfo(initialInfo, this.history))\n\n this.removeListeners = pipe(\n addPointerEvent(\n this.contextWindow,\n \"pointermove\",\n this.handlePointerMove\n ),\n addPointerEvent(\n this.contextWindow,\n \"pointerup\",\n this.handlePointerUp\n ),\n addPointerEvent(\n this.contextWindow,\n \"pointercancel\",\n this.handlePointerUp\n )\n )\n }\n\n private updatePoint = () => {\n if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return\n\n const info = getPanInfo(this.lastMoveEventInfo, this.history)\n const isPanStarted = this.startEvent !== null\n\n // Only start panning if the offset is larger than 3 pixels. If we make it\n // any larger than this we'll want to reset the pointer history\n // on the first update to avoid visual snapping to the cursor.\n const isDistancePastThreshold =\n distance2D(info.offset, { x: 0, y: 0 }) >= this.distanceThreshold\n\n if (!isPanStarted && !isDistancePastThreshold) return\n\n const { point } = info\n const { timestamp } = frameData\n this.history.push({ ...point, timestamp })\n\n const { onStart, onMove } = this.handlers\n\n if (!isPanStarted) {\n onStart && onStart(this.lastMoveEvent, info)\n this.startEvent = this.lastMoveEvent\n }\n\n onMove && onMove(this.lastMoveEvent, info)\n }\n\n private handlePointerMove = (event: PointerEvent, info: EventInfo) => {\n this.lastMoveEvent = event\n this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint)\n\n // Throttle mouse move event to once per frame\n frame.update(this.updatePoint, true)\n }\n\n private handlePointerUp = (event: PointerEvent, info: EventInfo) => {\n this.end()\n\n const { onEnd, onSessionEnd, resumeAnimation } = this.handlers\n\n if (this.dragSnapToOrigin) resumeAnimation && resumeAnimation()\n if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return\n\n const panInfo = getPanInfo(\n event.type === \"pointercancel\"\n ? this.lastMoveEventInfo\n : transformPoint(info, this.transformPagePoint),\n this.history\n )\n\n if (this.startEvent && onEnd) {\n onEnd(event, panInfo)\n }\n\n onSessionEnd && onSessionEnd(event, panInfo)\n }\n\n updateHandlers(handlers: Partial<PanSessionHandlers>) {\n this.handlers = handlers\n }\n\n end() {\n this.removeListeners && this.removeListeners()\n cancelFrame(this.updatePoint)\n }\n}\n\nfunction transformPoint(\n info: EventInfo,\n transformPagePoint?: (point: Point) => Point\n) {\n return transformPagePoint ? { point: transformPagePoint(info.point) } : info\n}\n\nfunction subtractPoint(a: Point, b: Point): Point {\n return { x: a.x - b.x, y: a.y - b.y }\n}\n\nfunction getPanInfo({ point }: EventInfo, history: TimestampedPoint[]) {\n return {\n point,\n delta: subtractPoint(point, lastDevicePoint(history)),\n offset: subtractPoint(point, startDevicePoint(history)),\n velocity: getVelocity(history, 0.1),\n }\n}\n\nfunction startDevicePoint(history: TimestampedPoint[]): TimestampedPoint {\n return history[0]\n}\n\nfunction lastDevicePoint(history: TimestampedPoint[]): TimestampedPoint {\n return history[history.length - 1]\n}\n\nfunction getVelocity(history: TimestampedPoint[], timeDelta: number): Point {\n if (history.length < 2) {\n return { x: 0, y: 0 }\n }\n\n let i = history.length - 1\n let timestampedPoint: TimestampedPoint | null = null\n const lastPoint = lastDevicePoint(history)\n while (i >= 0) {\n timestampedPoint = history[i]\n if (\n lastPoint.timestamp - timestampedPoint.timestamp >\n secondsToMilliseconds(timeDelta)\n ) {\n break\n }\n i--\n }\n\n if (!timestampedPoint) {\n return { x: 0, y: 0 }\n }\n\n const time = millisecondsToSeconds(\n lastPoint.timestamp - timestampedPoint.timestamp\n )\n if (time === 0) {\n return { x: 0, y: 0 }\n }\n\n const currentVelocity = {\n x: (lastPoint.x - timestampedPoint.x) / time,\n y: (lastPoint.y - timestampedPoint.y) / time,\n }\n\n if (currentVelocity.x === Infinity) {\n currentVelocity.x = 0\n }\n if (currentVelocity.y === Infinity) {\n currentVelocity.y = 0\n }\n\n return currentVelocity\n}\n"],"names":[],"mappings":";;;;;;AAiCA;;AAEG;MACU,UAAU,CAAA;AAuDnB,IAAA,WAAA,CACI,KAAmB,EACnB,QAAqC,EACrC,EACI,kBAAkB,EAClB,aAAa,GAAG,MAAM,EACtB,gBAAgB,GAAG,KAAK,EACxB,iBAAiB,GAAG,CAAC,MACF,EAAE,EAAA;AAzD7B;;AAEG;QACK,IAAU,CAAA,UAAA,GAAwB,IAAI,CAAA;AAE9C;;AAEG;QACK,IAAa,CAAA,aAAA,GAAwB,IAAI,CAAA;AAEjD;;AAEG;QACK,IAAiB,CAAA,iBAAA,GAAqB,IAA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C,CAAC,CAAA;AAC7B,QAAA,IACI,SAAS,CAAC,SAAS,GAAG,gBAAgB,CAAC,SAAS;AAChD,YAAA,qBAAqB,CAAC,SAAS,CAAC,EAClC;YACE,MAAK;SACR;AACD,QAAA,CAAC,EAAE,CAAA;KACN;IAED,IAAI,CAAC,gBAAgB,EAAE;QACnB,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;KACxB;AAED,IAAA,MAAM,IAAI,GAAG,qBAAqB,CAC9B,SAAS,CAAC,SAAS,GAAG,gBAAgB,CAAC,SAAS,CACnD,CAAA;AACD,IAAA,IAAI,IAAI,KAAK,CAAC,EAAE;QACZ,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;KACxB;AAED,IAAA,MAAM,eAAe,GAAG;QACpB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,IAAI,IAAI;QAC5C,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,IAAI,IAAI;KAC/C,CAAA;AAED,IAAA,IAAI,eAAe,CAAC,CAAC,KAAK,QAAQ,EAAE;AAChC,QAAA,eAAe,CAAC,CAAC,GAAG,CAAC,CAAA;KACxB;AACD,IAAA,IAAI,eAAe,CAAC,CAAC,KAAK,QAAQ,EAAE;AAChC,QAAA,eAAe,CAAC,CAAC,GAAG,CAAC,CAAA;KACxB;AAED,IAAA,OAAO,eAAe,CAAA;AAC1B;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/gestures/pan/index.ts"],"sourcesContent":["import type { PanInfo } from \"motion-dom\"\nimport { frame } from \"motion-dom\"\nimport { noop } from \"motion-utils\"\nimport { addPointerEvent } from \"../../events/add-pointer-event\"\nimport { Feature } from \"../../motion/features/Feature\"\nimport { getContextWindow } from \"../../utils/get-context-window\"\nimport { PanSession } from \"./PanSession\"\n\ntype PanEventHandler = (event: PointerEvent, info: PanInfo) => void\nconst asyncHandler =\n (handler?: PanEventHandler) => (event: PointerEvent, info: PanInfo) => {\n if (handler) {\n frame.postRender(() => handler(event, info))\n }\n }\n\nexport class PanGesture extends Feature<Element> {\n private session?: PanSession\n\n private removePointerDownListener: Function = noop\n\n onPointerDown(pointerDownEvent: PointerEvent) {\n this.session = new PanSession(\n pointerDownEvent,\n this.createPanHandlers(),\n {\n transformPagePoint: this.node.getTransformPagePoint(),\n contextWindow: getContextWindow(this.node),\n }\n )\n }\n\n createPanHandlers() {\n const { onPanSessionStart, onPanStart, onPan, onPanEnd } =\n this.node.getProps()\n\n return {\n onSessionStart: asyncHandler(onPanSessionStart),\n onStart: asyncHandler(onPanStart),\n onMove: onPan,\n onEnd: (event: PointerEvent, info: PanInfo) => {\n delete this.session\n if (onPanEnd) {\n frame.postRender(() => onPanEnd(event, info))\n }\n },\n }\n }\n\n mount() {\n this.removePointerDownListener = addPointerEvent(\n this.node.current!,\n \"pointerdown\",\n (event: PointerEvent) => this.onPointerDown(event)\n )\n }\n\n update() {\n this.session && this.session.updateHandlers(this.createPanHandlers())\n }\n\n unmount() {\n this.removePointerDownListener()\n this.session && this.session.end()\n }\n}\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,YAAY,GACd,CAAC,OAAyB,KAAK,CAAC,KAAmB,EAAE,IAAa,KAAI;IAClE,IAAI,OAAO,EAAE;AACT,QAAA,KAAK,CAAC,UAAU,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;KAC/C;AACL,CAAC,CAAA;AAEC,MAAO,UAAW,SAAQ,OAAgB,CAAA;AAAhD,IAAA,WAAA,GAAA;;QAGY,IAAyB,CAAA,yBAAA,GAAa,IAAI,CAAA;KA8CrD;AA5CG,IAAA,aAAa,CAAC,gBAA8B,EAAA;AACxC,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CACzB,gBAAgB,E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