motion 11.12.0 → 11.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.turbo/turbo-build.log +14 -14
  2. package/dist/cjs/index.js +54 -48
  3. package/dist/cjs/mini.js +21 -25
  4. package/dist/cjs/react-client.js +142 -104
  5. package/dist/cjs/react-mini.js +21 -25
  6. package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +1 -1
  7. package/dist/es/framer-motion/dist/es/animation/animate/subject.mjs +1 -1
  8. package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +2 -1
  9. package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +1 -1
  10. package/dist/es/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +1 -1
  11. package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +2 -2
  12. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +2 -2
  13. package/dist/es/framer-motion/dist/es/animation/generators/spring/find.mjs +1 -1
  14. package/dist/es/framer-motion/dist/es/animation/hooks/animation-controls.mjs +1 -1
  15. package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +2 -1
  16. package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +1 -1
  17. package/dist/es/framer-motion/dist/es/components/AnimateSharedLayout.mjs +1 -1
  18. package/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs +1 -1
  19. package/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs +1 -1
  20. package/dist/es/framer-motion/dist/es/easing/cubic-bezier.mjs +2 -1
  21. package/dist/es/framer-motion/dist/es/easing/utils/map.mjs +2 -2
  22. package/dist/es/framer-motion/dist/es/events/event-info.mjs +3 -3
  23. package/dist/es/framer-motion/dist/es/frameloop/frame.mjs +2 -1
  24. package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +12 -15
  25. package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +2 -1
  26. package/dist/es/framer-motion/dist/es/gestures/hover.mjs +18 -22
  27. package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +2 -1
  28. package/dist/es/framer-motion/dist/es/gestures/press.mjs +3 -2
  29. package/dist/es/framer-motion/dist/es/motion/index.mjs +1 -1
  30. package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +2 -1
  31. package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +2 -1
  32. package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +1 -1
  33. package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +2 -1
  34. package/dist/es/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
  35. package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +1 -1
  36. package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
  37. package/dist/es/framer-motion/dist/es/utils/interpolate.mjs +2 -2
  38. package/dist/es/framer-motion/dist/es/utils/mix/color.mjs +1 -1
  39. package/dist/es/framer-motion/dist/es/utils/mix/complex.mjs +1 -1
  40. package/dist/es/framer-motion/dist/es/value/index.mjs +1 -1
  41. package/dist/es/framer-motion/dist/es/value/use-inverted-scale.mjs +1 -1
  42. package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +1 -1
  43. package/dist/es/motion/lib/index.mjs +3 -1
  44. package/dist/es/motion/lib/react.mjs +3 -2
  45. package/dist/es/motion-dom/dist/es/gestures/drag/state/is-active.mjs +9 -0
  46. package/dist/es/motion-dom/dist/es/gestures/drag/state/set-active.mjs +28 -0
  47. package/dist/es/motion-dom/dist/es/gestures/hover.mjs +46 -0
  48. package/dist/es/motion-dom/dist/es/utils/resolve-elements.mjs +22 -0
  49. package/dist/motion.dev.js +54 -48
  50. package/dist/motion.js +1 -1
  51. package/package.json +3 -3
  52. package/dist/es/framer-motion/dist/es/gestures/drag/utils/lock.mjs +0 -53
  53. package/dist/es/framer-motion/dist/es/render/dom/utils/resolve-element.mjs +0 -28
  54. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/errors.mjs +0 -0
  55. /package/dist/es/{framer-motion/dist/es/utils → motion-utils/dist/es}/noop.mjs +0 -0
@@ -112,6 +112,27 @@ class GroupPlaybackControls {
112
112
  }
113
113
  }
114
114
 
115
+ function resolveElements(elementOrSelector, scope, selectorCache) {
116
+ var _a;
117
+ if (elementOrSelector instanceof Element) {
118
+ return [elementOrSelector];
119
+ }
120
+ else if (typeof elementOrSelector === "string") {
121
+ let root = document;
122
+ if (scope) {
123
+ // TODO: Refactor to utils package
124
+ // invariant(
125
+ // Boolean(scope.current),
126
+ // "Scope provided, but no element detected."
127
+ // )
128
+ root = scope.current;
129
+ }
130
+ const elements = (_a = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a !== void 0 ? _a : root.querySelectorAll(elementOrSelector);
131
+ return elements ? Array.from(elements) : [];
132
+ }
133
+ return Array.from(elementOrSelector);
134
+ }
135
+
115
136
  const noop = (any) => any;
116
137
 
117
138
  let invariant = noop;
@@ -123,31 +144,6 @@ if (process.env.NODE_ENV !== "production") {
123
144
  };
124
145
  }
125
146
 
126
- function resolveElements(elements, scope, selectorCache) {
127
- var _a;
128
- if (typeof elements === "string") {
129
- let root = document;
130
- if (scope) {
131
- invariant(Boolean(scope.current), "Scope provided, but no element detected.");
132
- root = scope.current;
133
- }
134
- if (selectorCache) {
135
- (_a = selectorCache[elements]) !== null && _a !== void 0 ? _a : (selectorCache[elements] = root.querySelectorAll(elements));
136
- elements = selectorCache[elements];
137
- }
138
- else {
139
- elements = root.querySelectorAll(elements);
140
- }
141
- }
142
- else if (elements instanceof Element) {
143
- elements = [elements];
144
- }
145
- /**
146
- * Return an empty array
147
- */
148
- return Array.from(elements || []);
149
- }
150
-
151
147
  /**
152
148
  * Converts seconds to milliseconds
153
149
  *
@@ -1,4 +1,4 @@
1
- import { resolveElements } from '../../render/dom/utils/resolve-element.mjs';
1
+ import { resolveElements } from '../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
2
2
  import { isDOMKeyframes } from '../utils/is-dom-keyframes.mjs';
3
3
 
4
4
  function resolveSubjects(subject, keyframes, scope, selectorCache) {
@@ -1,5 +1,5 @@
1
+ import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
1
2
  import { visualElementStore } from '../../render/store.mjs';
2
- import { invariant } from '../../utils/errors.mjs';
3
3
  import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
4
4
  import { animateTarget } from '../interfaces/visual-element-target.mjs';
5
5
  import { createDOMVisualElement, createObjectVisualElement } from '../utils/create-visual-element.mjs';
@@ -2,7 +2,8 @@ import { anticipate } from '../../easing/anticipate.mjs';
2
2
  import { backInOut } from '../../easing/back.mjs';
3
3
  import { circInOut } from '../../easing/circ.mjs';
4
4
  import { DOMKeyframesResolver } from '../../render/dom/DOMKeyframesResolver.mjs';
5
- import { noop } from '../../utils/noop.mjs';
5
+ import '../../../../../motion-utils/dist/es/errors.mjs';
6
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
6
7
  import { millisecondsToSeconds, secondsToMilliseconds } from '../../utils/time-conversion.mjs';
7
8
  import { isGenerator } from '../generators/utils/is-generator.mjs';
8
9
  import { BaseAnimation } from './BaseAnimation.mjs';
@@ -8,7 +8,7 @@ import { mix } from '../../utils/mix/index.mjs';
8
8
  import { calcGeneratorDuration } from '../generators/utils/calc-duration.mjs';
9
9
  import { millisecondsToSeconds, secondsToMilliseconds } from '../../utils/time-conversion.mjs';
10
10
  import { clamp } from '../../utils/clamp.mjs';
11
- import { invariant } from '../../utils/errors.mjs';
11
+ import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
12
12
  import { frameloopDriver } from './drivers/driver-frameloop.mjs';
13
13
  import { getFinalKeyframe } from './waapi/utils/get-final-keyframe.mjs';
14
14
  import { isGenerator } from '../generators/utils/is-generator.mjs';
@@ -1,4 +1,4 @@
1
- import { warning } from '../../../utils/errors.mjs';
1
+ import { warning } from '../../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { isGenerator } from '../../generators/utils/is-generator.mjs';
3
3
  import { isAnimatable } from '../../utils/is-animatable.mjs';
4
4
 
@@ -1,8 +1,8 @@
1
1
  import { startWaapiAnimation } from './index.mjs';
2
2
  import { createGeneratorEasing } from '../../../easing/utils/create-generator-easing.mjs';
3
3
  import { browserNumberValueTypes } from '../../../render/dom/value-types/number-browser.mjs';
4
- import { invariant } from '../../../utils/errors.mjs';
5
- import { noop } from '../../../utils/noop.mjs';
4
+ import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
5
+ import { noop } from '../../../../../../motion-utils/dist/es/noop.mjs';
6
6
  import { secondsToMilliseconds, millisecondsToSeconds } from '../../../utils/time-conversion.mjs';
7
7
  import { isGenerator } from '../../generators/utils/is-generator.mjs';
8
8
  import { attachTimeline } from './utils/attach-timeline.mjs';
@@ -1,5 +1,5 @@
1
- import { resolveElements } from '../../../render/dom/utils/resolve-element.mjs';
2
- import { invariant } from '../../../utils/errors.mjs';
1
+ import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
2
+ import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
3
3
  import { secondsToMilliseconds } from '../../../utils/time-conversion.mjs';
4
4
  import { getValueTransition } from '../../utils/get-value-transition.mjs';
5
5
  import { NativeAnimation } from './NativeAnimation.mjs';
@@ -1,4 +1,4 @@
1
- import { warning } from '../../../utils/errors.mjs';
1
+ import { warning } from '../../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { clamp } from '../../../utils/clamp.mjs';
3
3
  import { secondsToMilliseconds, millisecondsToSeconds } from '../../../utils/time-conversion.mjs';
4
4
  import { springDefaults } from './defaults.mjs';
@@ -1,4 +1,4 @@
1
- import { invariant } from '../../utils/errors.mjs';
1
+ import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { setTarget } from '../../render/utils/setters.mjs';
3
3
  import { animateVisualElement } from '../interfaces/visual-element.mjs';
4
4
 
@@ -3,7 +3,8 @@ import { startWaapiAnimation } from '../animators/waapi/index.mjs';
3
3
  import { optimizedAppearDataId } from './data-id.mjs';
4
4
  import { handoffOptimizedAppearAnimation } from './handoff.mjs';
5
5
  import { appearAnimationStore, appearComplete } from './store.mjs';
6
- import { noop } from '../../utils/noop.mjs';
6
+ import '../../../../../motion-utils/dist/es/errors.mjs';
7
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
7
8
  import { getOptimisedAppearId } from './get-appear-id.mjs';
8
9
 
9
10
  /**
@@ -3,7 +3,7 @@ import { jsx, Fragment } from 'react/jsx-runtime';
3
3
  import { useMemo, useRef, useState, useContext } from 'react';
4
4
  import { PresenceChild } from './PresenceChild.mjs';
5
5
  import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
6
- import { invariant } from '../../utils/errors.mjs';
6
+ import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
7
7
  import { useConstant } from '../../utils/use-constant.mjs';
8
8
  import { onlyElements, getChildKey } from './utils.mjs';
9
9
  import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { invariant } from '../utils/errors.mjs';
2
+ import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
3
3
  import * as React from 'react';
4
4
  import { useConstant } from '../utils/use-constant.mjs';
5
5
  import { LayoutGroup } from './LayoutGroup/index.mjs';
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { invariant } from '../../utils/errors.mjs';
3
+ import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
4
4
  import { forwardRef, useRef, useEffect } from 'react';
5
5
  import { ReorderContext } from '../../context/ReorderContext.mjs';
6
6
  import { motion } from '../../render/components/motion/proxy.mjs';
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { invariant } from '../../utils/errors.mjs';
3
+ import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
4
4
  import { forwardRef, useContext } from 'react';
5
5
  import { ReorderContext } from '../../context/ReorderContext.mjs';
6
6
  import { motion } from '../../render/components/motion/proxy.mjs';
@@ -1,4 +1,5 @@
1
- import { noop } from '../utils/noop.mjs';
1
+ import '../../../../motion-utils/dist/es/errors.mjs';
2
+ import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
2
3
 
3
4
  /*
4
5
  Bezier function generator
@@ -1,6 +1,6 @@
1
- import { invariant } from '../../utils/errors.mjs';
1
+ import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
2
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
2
3
  import { cubicBezier } from '../cubic-bezier.mjs';
3
- import { noop } from '../../utils/noop.mjs';
4
4
  import { easeIn, easeInOut, easeOut } from '../ease.mjs';
5
5
  import { circIn, circInOut, circOut } from '../circ.mjs';
6
6
  import { backIn, backInOut, backOut } from '../back.mjs';
@@ -1,10 +1,10 @@
1
1
  import { isPrimaryPointer } from './utils/is-primary-pointer.mjs';
2
2
 
3
- function extractEventInfo(event, pointType = "page") {
3
+ function extractEventInfo(event) {
4
4
  return {
5
5
  point: {
6
- x: event[`${pointType}X`],
7
- y: event[`${pointType}Y`],
6
+ x: event.pageX,
7
+ y: event.pageY,
8
8
  },
9
9
  };
10
10
  }
@@ -1,4 +1,5 @@
1
- import { noop } from '../utils/noop.mjs';
1
+ import '../../../../motion-utils/dist/es/errors.mjs';
2
+ import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
2
3
  import { createRenderBatcher } from './batcher.mjs';
3
4
 
4
5
  const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
@@ -1,6 +1,6 @@
1
- import { invariant } from '../../utils/errors.mjs';
1
+ import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
2
+ import { setDragLock } from '../../../../../motion-dom/dist/es/gestures/drag/state/set-active.mjs';
2
3
  import { PanSession } from '../pan/PanSession.mjs';
3
- import { getGlobalLock } from './utils/lock.mjs';
4
4
  import { isRefObject } from '../../utils/is-ref-object.mjs';
5
5
  import { addPointerEvent } from '../../events/add-pointer-event.mjs';
6
6
  import { applyConstraints, calcRelativeConstraints, resolveDragElastic, calcViewportConstraints, rebaseAxisConstraints, calcOrigin, defaultElastic } from './utils/constraints.mjs';
@@ -25,10 +25,7 @@ const elementDragControls = new WeakMap();
25
25
  // let latestPointerEvent: PointerEvent
26
26
  class VisualElementDragControls {
27
27
  constructor(visualElement) {
28
- // This is a reference to the global drag gesture lock, ensuring only one component
29
- // can "capture" the drag of one or both axes.
30
- // TODO: Look into moving this into pansession?
31
- this.openGlobalLock = null;
28
+ this.openDragLock = null;
32
29
  this.isDragging = false;
33
30
  this.currentDirection = null;
34
31
  this.originPoint = { x: 0, y: 0 };
@@ -56,18 +53,18 @@ class VisualElementDragControls {
56
53
  // the component.
57
54
  dragSnapToOrigin ? this.pauseAnimation() : this.stopAnimation();
58
55
  if (snapToCursor) {
59
- this.snapToCursor(extractEventInfo(event, "page").point);
56
+ this.snapToCursor(extractEventInfo(event).point);
60
57
  }
61
58
  };
62
59
  const onStart = (event, info) => {
63
60
  // Attempt to grab the global drag gesture lock - maybe make this part of PanSession
64
61
  const { drag, dragPropagation, onDragStart } = this.getProps();
65
62
  if (drag && !dragPropagation) {
66
- if (this.openGlobalLock)
67
- this.openGlobalLock();
68
- this.openGlobalLock = getGlobalLock(drag);
63
+ if (this.openDragLock)
64
+ this.openDragLock();
65
+ this.openDragLock = setDragLock(drag);
69
66
  // If we don 't have the lock, don't start dragging
70
- if (!this.openGlobalLock)
67
+ if (!this.openDragLock)
71
68
  return;
72
69
  }
73
70
  this.isDragging = true;
@@ -109,7 +106,7 @@ class VisualElementDragControls {
109
106
  // latestPointerEvent = event
110
107
  const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
111
108
  // If we didn't successfully receive the gesture lock, early return.
112
- if (!dragPropagation && !this.openGlobalLock)
109
+ if (!dragPropagation && !this.openDragLock)
113
110
  return;
114
111
  const { offset } = info;
115
112
  // Attempt to detect drag direction if directionLock is true
@@ -177,9 +174,9 @@ class VisualElementDragControls {
177
174
  this.panSession && this.panSession.end();
178
175
  this.panSession = undefined;
179
176
  const { dragPropagation } = this.getProps();
180
- if (!dragPropagation && this.openGlobalLock) {
181
- this.openGlobalLock();
182
- this.openGlobalLock = null;
177
+ if (!dragPropagation && this.openDragLock) {
178
+ this.openDragLock();
179
+ this.openDragLock = null;
183
180
  }
184
181
  animationState && animationState.setActive("whileDrag", false);
185
182
  }
@@ -1,5 +1,6 @@
1
1
  import { Feature } from '../../motion/features/Feature.mjs';
2
- import { noop } from '../../utils/noop.mjs';
2
+ import '../../../../../motion-utils/dist/es/errors.mjs';
3
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
3
4
  import { VisualElementDragControls } from './VisualElementDragControls.mjs';
4
5
 
5
6
  class DragGesture extends Feature {
@@ -1,31 +1,27 @@
1
- import { addPointerEvent } from '../events/add-pointer-event.mjs';
2
- import { pipe } from '../utils/pipe.mjs';
3
- import { isDragActive } from './drag/utils/lock.mjs';
4
1
  import { Feature } from '../motion/features/Feature.mjs';
2
+ import { hover } from '../../../../motion-dom/dist/es/gestures/hover.mjs';
3
+ import { extractEventInfo } from '../events/event-info.mjs';
5
4
  import { frame } from '../frameloop/frame.mjs';
6
5
 
7
- function addHoverEvent(node, isActive) {
8
- const eventName = isActive ? "pointerenter" : "pointerleave";
9
- const callbackName = isActive ? "onHoverStart" : "onHoverEnd";
10
- const handleEvent = (event, info) => {
11
- if (event.pointerType === "touch" || isDragActive())
12
- return;
13
- const props = node.getProps();
14
- if (node.animationState && props.whileHover) {
15
- node.animationState.setActive("whileHover", isActive);
16
- }
17
- const callback = props[callbackName];
18
- if (callback) {
19
- frame.postRender(() => callback(event, info));
20
- }
21
- };
22
- return addPointerEvent(node.current, eventName, handleEvent, {
23
- passive: !node.getProps()[callbackName],
24
- });
6
+ function handleHoverEvent(node, event, isActive) {
7
+ const { props } = node;
8
+ if (node.animationState && props.whileHover) {
9
+ node.animationState.setActive("whileHover", isActive);
10
+ }
11
+ const callback = props[isActive ? "onHoverStart" : "onHoverEnd"];
12
+ if (callback) {
13
+ frame.postRender(() => callback(event, extractEventInfo(event)));
14
+ }
25
15
  }
26
16
  class HoverGesture extends Feature {
27
17
  mount() {
28
- this.unmount = pipe(addHoverEvent(this.node, true), addHoverEvent(this.node, false));
18
+ const { current, props } = this.node;
19
+ if (!current)
20
+ return;
21
+ this.unmount = hover(current, (startEvent) => {
22
+ handleHoverEvent(this.node, startEvent, true);
23
+ return (endEvent) => handleHoverEvent(this.node, endEvent, false);
24
+ }, { passive: !props.onHoverStart && !props.onHoverEnd });
29
25
  }
30
26
  unmount() { }
31
27
  }
@@ -1,7 +1,8 @@
1
1
  import { PanSession } from './PanSession.mjs';
2
2
  import { addPointerEvent } from '../../events/add-pointer-event.mjs';
3
3
  import { Feature } from '../../motion/features/Feature.mjs';
4
- import { noop } from '../../utils/noop.mjs';
4
+ import '../../../../../motion-utils/dist/es/errors.mjs';
5
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
5
6
  import { getContextWindow } from '../../utils/get-context-window.mjs';
6
7
  import { frame } from '../../frameloop/frame.mjs';
7
8
 
@@ -3,9 +3,10 @@ import { addDomEvent } from '../events/add-dom-event.mjs';
3
3
  import { addPointerEvent } from '../events/add-pointer-event.mjs';
4
4
  import { Feature } from '../motion/features/Feature.mjs';
5
5
  import { pipe } from '../utils/pipe.mjs';
6
- import { isDragActive } from './drag/utils/lock.mjs';
6
+ import { isDragActive } from '../../../../motion-dom/dist/es/gestures/drag/state/is-active.mjs';
7
7
  import { isNodeOrChild } from './utils/is-node-or-child.mjs';
8
- import { noop } from '../utils/noop.mjs';
8
+ import '../../../../motion-utils/dist/es/errors.mjs';
9
+ import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
9
10
  import { frame } from '../frameloop/frame.mjs';
10
11
 
11
12
  function fireSyntheticPointerEvent(name, handler) {
@@ -11,7 +11,7 @@ import { isBrowser } from '../utils/is-browser.mjs';
11
11
  import { LayoutGroupContext } from '../context/LayoutGroupContext.mjs';
12
12
  import { LazyContext } from '../context/LazyContext.mjs';
13
13
  import { motionComponentSymbol } from './utils/symbol.mjs';
14
- import { warning, invariant } from '../utils/errors.mjs';
14
+ import { warning, invariant } from '../../../../motion-utils/dist/es/errors.mjs';
15
15
  import { featureDefinitions } from './features/definitions.mjs';
16
16
 
17
17
  /**
@@ -1,7 +1,8 @@
1
1
  import { circOut } from '../../easing/circ.mjs';
2
2
  import { progress } from '../../utils/progress.mjs';
3
3
  import { mixNumber } from '../../utils/mix/number.mjs';
4
- import { noop } from '../../utils/noop.mjs';
4
+ import '../../../../../motion-utils/dist/es/errors.mjs';
5
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
5
6
  import { percent, px } from '../../value/types/numbers/units.mjs';
6
7
 
7
8
  const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
@@ -20,7 +20,8 @@ import { isSVGElement } from '../../render/dom/utils/is-svg-element.mjs';
20
20
  import { animateSingleValue } from '../../animation/animate/single-value.mjs';
21
21
  import { clamp } from '../../utils/clamp.mjs';
22
22
  import { cancelFrame, frameData, frameSteps, frame } from '../../frameloop/frame.mjs';
23
- import { noop } from '../../utils/noop.mjs';
23
+ import '../../../../../motion-utils/dist/es/errors.mjs';
24
+ import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
24
25
  import { time } from '../../frameloop/sync-time.mjs';
25
26
  import { microtask } from '../../frameloop/microtask.mjs';
26
27
  import { getOptimisedAppearId } from '../../animation/optimized-appear/get-appear-id.mjs';
@@ -1,4 +1,4 @@
1
- import { resolveElements } from '../utils/resolve-element.mjs';
1
+ import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
2
2
 
3
3
  const resizeHandlers = new WeakMap();
4
4
  let observer;
@@ -1,7 +1,8 @@
1
1
  import { scrollInfo } from './track.mjs';
2
2
  import { observeTimeline } from './observe.mjs';
3
3
  import { supportsScrollTimeline } from './supports.mjs';
4
- import { noop } from '../../../utils/noop.mjs';
4
+ import '../../../../../../motion-utils/dist/es/errors.mjs';
5
+ import { noop } from '../../../../../../motion-utils/dist/es/noop.mjs';
5
6
 
6
7
  function scrollTimelineFallback({ source, container, axis = "y", }) {
7
8
  // Support legacy source argument. Deprecate later.
@@ -1,4 +1,4 @@
1
- import { invariant } from '../../../utils/errors.mjs';
1
+ import { invariant } from '../../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { isNumericalString } from '../../../utils/is-numerical-string.mjs';
3
3
  import { isCSSVariableToken } from './is-css-variable.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { resolveElements } from '../utils/resolve-element.mjs';
1
+ import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
2
2
 
3
3
  const thresholds = {
4
4
  some: 0,
@@ -17,7 +17,7 @@ function updateMotionValuesFromProps(element, next, prev) {
17
17
  * and warn against mismatches.
18
18
  */
19
19
  if (process.env.NODE_ENV === "development") {
20
- warnOnce(nextValue.version === "11.12.0", `Attempting to mix Motion versions ${nextValue.version} with 11.12.0 may not work as expected.`);
20
+ warnOnce(nextValue.version === "11.13.0", `Attempting to mix Motion versions ${nextValue.version} with 11.13.0 may not work as expected.`);
21
21
  }
22
22
  }
23
23
  else if (isMotionValue(prevValue)) {
@@ -1,8 +1,8 @@
1
- import { invariant } from './errors.mjs';
2
1
  import { clamp } from './clamp.mjs';
3
2
  import { pipe } from './pipe.mjs';
4
3
  import { progress } from './progress.mjs';
5
- import { noop } from './noop.mjs';
4
+ import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
5
+ import { noop } from '../../../../motion-utils/dist/es/noop.mjs';
6
6
  import { mix } from './mix/index.mjs';
7
7
 
8
8
  function createMixers(output, ease, customMixer) {
@@ -1,5 +1,5 @@
1
1
  import { mixNumber } from './number.mjs';
2
- import { warning } from '../errors.mjs';
2
+ import { warning } from '../../../../../motion-utils/dist/es/errors.mjs';
3
3
  import { hslaToRgba } from '../hsla-to-rgba.mjs';
4
4
  import { hex } from '../../value/types/color/hex.mjs';
5
5
  import { rgba } from '../../value/types/color/rgba.mjs';
@@ -1,7 +1,7 @@
1
1
  import { mixNumber as mixNumber$1 } from './number.mjs';
2
2
  import { mixColor } from './color.mjs';
3
3
  import { pipe } from '../pipe.mjs';
4
- import { warning } from '../errors.mjs';
4
+ import { warning } from '../../../../../motion-utils/dist/es/errors.mjs';
5
5
  import { color } from '../../value/types/color/index.mjs';
6
6
  import { complex, analyseComplexValue } from '../../value/types/complex/index.mjs';
7
7
  import { isCSSVariableToken } from '../../render/dom/utils/is-css-variable.mjs';
@@ -34,7 +34,7 @@ class MotionValue {
34
34
  * This will be replaced by the build step with the latest version number.
35
35
  * When MotionValues are provided to motion components, warn if versions are mixed.
36
36
  */
37
- this.version = "11.12.0";
37
+ this.version = "11.13.0";
38
38
  /**
39
39
  * Tracks whether this value can output a velocity. Currently this is only true
40
40
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -1,5 +1,5 @@
1
1
  import { useTransform } from './use-transform.mjs';
2
- import { invariant, warning } from '../utils/errors.mjs';
2
+ import { invariant, warning } from '../../../../motion-utils/dist/es/errors.mjs';
3
3
  import { useMotionValue } from './use-motion-value.mjs';
4
4
  import { MotionContext } from '../context/MotionContext/index.mjs';
5
5
  import { useContext } from 'react';
@@ -1,7 +1,7 @@
1
1
  import { motionValue } from './index.mjs';
2
2
  import { useConstant } from '../utils/use-constant.mjs';
3
3
  import { useEffect } from 'react';
4
- import { warning } from '../utils/errors.mjs';
4
+ import { warning } from '../../../../motion-utils/dist/es/errors.mjs';
5
5
  import { scroll } from '../render/dom/scroll/index.mjs';
6
6
  import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
7
7
 
@@ -1,3 +1,6 @@
1
+ export { invariant } from '../../motion-utils/dist/es/errors.mjs';
2
+ export { noop } from '../../motion-utils/dist/es/noop.mjs';
3
+ export { isDragActive } from '../../motion-dom/dist/es/gestures/drag/state/is-active.mjs';
1
4
  export { MotionValue, motionValue } from '../../framer-motion/dist/es/value/index.mjs';
2
5
  export { animate, createScopedAnimate } from '../../framer-motion/dist/es/animation/animate/index.mjs';
3
6
  export { animateMini } from '../../framer-motion/dist/es/animation/animators/waapi/animate-style.mjs';
@@ -20,7 +23,6 @@ export { transform } from '../../framer-motion/dist/es/utils/transform.mjs';
20
23
  export { clamp } from '../../framer-motion/dist/es/utils/clamp.mjs';
21
24
  export { delayInSeconds as delay } from '../../framer-motion/dist/es/utils/delay.mjs';
22
25
  export { distance, distance2D } from '../../framer-motion/dist/es/utils/distance.mjs';
23
- export { invariant, warning } from '../../framer-motion/dist/es/utils/errors.mjs';
24
26
  export { interpolate } from '../../framer-motion/dist/es/utils/interpolate.mjs';
25
27
  export { mix } from '../../framer-motion/dist/es/utils/mix/index.mjs';
26
28
  export { pipe } from '../../framer-motion/dist/es/utils/pipe.mjs';
@@ -65,6 +65,9 @@ export { useAnimatedState as useDeprecatedAnimatedState } from '../../framer-mot
65
65
  export { useInvertedScale as useDeprecatedInvertedScale } from '../../framer-motion/dist/es/value/use-inverted-scale.mjs';
66
66
  export { AnimateSharedLayout } from '../../framer-motion/dist/es/components/AnimateSharedLayout.mjs';
67
67
  export { delay } from '../../framer-motion/dist/es/utils/delay.mjs';
68
+ export { invariant } from '../../motion-utils/dist/es/errors.mjs';
69
+ export { noop } from '../../motion-utils/dist/es/noop.mjs';
70
+ export { isDragActive } from '../../motion-dom/dist/es/gestures/drag/state/is-active.mjs';
68
71
  export { MotionValue, motionValue } from '../../framer-motion/dist/es/value/index.mjs';
69
72
  export { animate, createScopedAnimate } from '../../framer-motion/dist/es/animation/animate/index.mjs';
70
73
  export { animateMini } from '../../framer-motion/dist/es/animation/animators/waapi/animate-style.mjs';
@@ -90,7 +93,6 @@ export { steps } from '../../framer-motion/dist/es/easing/steps.mjs';
90
93
  export { mirrorEasing } from '../../framer-motion/dist/es/easing/modifiers/mirror.mjs';
91
94
  export { reverseEasing } from '../../framer-motion/dist/es/easing/modifiers/reverse.mjs';
92
95
  export { distance, distance2D } from '../../framer-motion/dist/es/utils/distance.mjs';
93
- export { invariant, warning } from '../../framer-motion/dist/es/utils/errors.mjs';
94
96
  export { interpolate } from '../../framer-motion/dist/es/utils/interpolate.mjs';
95
97
  export { cancelFrame, frame, frameData, frameSteps } from '../../framer-motion/dist/es/frameloop/frame.mjs';
96
98
  export { animations } from '../../framer-motion/dist/es/motion/features/animations.mjs';
@@ -98,7 +100,6 @@ export { createBox } from '../../framer-motion/dist/es/projection/geometry/model
98
100
  export { calcLength } from '../../framer-motion/dist/es/projection/geometry/delta-calc.mjs';
99
101
  export { filterProps } from '../../framer-motion/dist/es/render/dom/utils/filter-props.mjs';
100
102
  export { makeUseVisualState } from '../../framer-motion/dist/es/motion/utils/use-visual-state.mjs';
101
- export { isDragActive } from '../../framer-motion/dist/es/gestures/drag/utils/lock.mjs';
102
103
  export { addPointerEvent } from '../../framer-motion/dist/es/events/add-pointer-event.mjs';
103
104
  export { addPointerInfo } from '../../framer-motion/dist/es/events/event-info.mjs';
104
105
  export { isMotionValue } from '../../framer-motion/dist/es/value/utils/is-motion-value.mjs';
@@ -0,0 +1,9 @@
1
+ const isDragging = {
2
+ x: false,
3
+ y: false,
4
+ };
5
+ function isDragActive() {
6
+ return isDragging.x || isDragging.y;
7
+ }
8
+
9
+ export { isDragActive, isDragging };
@@ -0,0 +1,28 @@
1
+ import { isDragging } from './is-active.mjs';
2
+
3
+ function setDragLock(axis) {
4
+ if (axis === "x" || axis === "y") {
5
+ if (isDragging[axis]) {
6
+ return null;
7
+ }
8
+ else {
9
+ isDragging[axis] = true;
10
+ return () => {
11
+ isDragging[axis] = false;
12
+ };
13
+ }
14
+ }
15
+ else {
16
+ if (isDragging.x || isDragging.y) {
17
+ return null;
18
+ }
19
+ else {
20
+ isDragging.x = isDragging.y = true;
21
+ return () => {
22
+ isDragging.x = isDragging.y = false;
23
+ };
24
+ }
25
+ }
26
+ }
27
+
28
+ export { setDragLock };