framer-motion 12.22.0 → 12.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var create = require('./create-Dr1Bf9gl.js');
5
+ var create = require('./create-C-c1JfhA.js');
6
6
  require('motion-dom');
7
7
  require('motion-utils');
8
8
  require('react/jsx-runtime');
@@ -4607,6 +4607,14 @@ class VisualElementDragControls {
4607
4607
  * The per-axis resolved elastic values.
4608
4608
  */
4609
4609
  this.elastic = createBox();
4610
+ /**
4611
+ * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.
4612
+ */
4613
+ this.latestPointerEvent = null;
4614
+ /**
4615
+ * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.
4616
+ */
4617
+ this.latestPanInfo = null;
4610
4618
  this.visualElement = visualElement;
4611
4619
  }
4612
4620
  start(originEvent, { snapToCursor = false, distanceThreshold } = {}) {
@@ -4636,6 +4644,8 @@ class VisualElementDragControls {
4636
4644
  if (!this.openDragLock)
4637
4645
  return;
4638
4646
  }
4647
+ this.latestPointerEvent = event;
4648
+ this.latestPanInfo = info;
4639
4649
  this.isDragging = true;
4640
4650
  this.currentDirection = null;
4641
4651
  this.resolveConstraints();
@@ -4672,7 +4682,8 @@ class VisualElementDragControls {
4672
4682
  animationState && animationState.setActive("whileDrag", true);
4673
4683
  };
4674
4684
  const onMove = (event, info) => {
4675
- // latestPointerEvent = event
4685
+ this.latestPointerEvent = event;
4686
+ this.latestPanInfo = info;
4676
4687
  const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
4677
4688
  // If we didn't successfully receive the gesture lock, early return.
4678
4689
  if (!dragPropagation && !this.openDragLock)
@@ -4703,7 +4714,13 @@ class VisualElementDragControls {
4703
4714
  */
4704
4715
  onDrag && onDrag(event, info);
4705
4716
  };
4706
- const onSessionEnd = (event, info) => this.stop(event, info);
4717
+ const onSessionEnd = (event, info) => {
4718
+ this.latestPointerEvent = event;
4719
+ this.latestPanInfo = info;
4720
+ this.stop(event, info);
4721
+ this.latestPointerEvent = null;
4722
+ this.latestPanInfo = null;
4723
+ };
4707
4724
  const resumeAnimation = () => eachAxis((axis) => this.getAnimationState(axis) === "paused" &&
4708
4725
  this.getAxisMotionValue(axis).animation?.play());
4709
4726
  const { dragSnapToOrigin } = this.getProps();
@@ -4720,18 +4737,26 @@ class VisualElementDragControls {
4720
4737
  contextWindow: getContextWindow(this.visualElement),
4721
4738
  });
4722
4739
  }
4723
- stop(event, info) {
4740
+ /**
4741
+ * @internal
4742
+ */
4743
+ stop(event, panInfo) {
4744
+ const finalEvent = event || this.latestPointerEvent;
4745
+ const finalPanInfo = panInfo || this.latestPanInfo;
4724
4746
  const isDragging = this.isDragging;
4725
4747
  this.cancel();
4726
- if (!isDragging)
4748
+ if (!isDragging || !finalPanInfo || !finalEvent)
4727
4749
  return;
4728
- const { velocity } = info;
4750
+ const { velocity } = finalPanInfo;
4729
4751
  this.startAnimation(velocity);
4730
4752
  const { onDragEnd } = this.getProps();
4731
4753
  if (onDragEnd) {
4732
- motionDom.frame.postRender(() => onDragEnd(event, info));
4754
+ motionDom.frame.postRender(() => onDragEnd(finalEvent, finalPanInfo));
4733
4755
  }
4734
4756
  }
4757
+ /**
4758
+ * @internal
4759
+ */
4735
4760
  cancel() {
4736
4761
  this.isDragging = false;
4737
4762
  const { projection, animationState } = this.visualElement;
@@ -205,7 +205,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
205
205
  * Handle repeat options
206
206
  */
207
207
  if (repeat) {
208
- motionUtils.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
208
+ motionUtils.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20", "repeat-count-high");
209
209
  duration = calculateRepeatDuration(duration, repeat);
210
210
  const originalKeyframes = [...valueKeyframesAsList];
211
211
  const originalTimes = [...times];
@@ -343,7 +343,7 @@ const isNumberKeyframesArray = (keyframes) => keyframes.every(isNumber);
343
343
  function animateElements(elementOrSelector, keyframes, options, scope) {
344
344
  const elements = motionDom.resolveElements(elementOrSelector, scope);
345
345
  const numElements = elements.length;
346
- motionUtils.invariant(Boolean(numElements), "No valid element provided.");
346
+ motionUtils.invariant(Boolean(numElements), "No valid elements provided.", "no-valid-elements");
347
347
  /**
348
348
  * WAAPI doesn't support interrupting animations.
349
349
  *
package/dist/cjs/dom.js CHANGED
@@ -205,7 +205,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
205
205
  * Handle repeat options
206
206
  */
207
207
  if (repeat) {
208
- motionUtils.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
208
+ motionUtils.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20", "repeat-count-high");
209
209
  duration = calculateRepeatDuration(duration, repeat);
210
210
  const originalKeyframes = [...valueKeyframesAsList];
211
211
  const originalTimes = [...times];
@@ -1781,7 +1781,7 @@ function animateSubject(subject, keyframes, options, scope) {
1781
1781
  else {
1782
1782
  const subjects = resolveSubjects(subject, keyframes, scope);
1783
1783
  const numSubjects = subjects.length;
1784
- motionUtils.invariant(Boolean(numSubjects), "No valid elements provided.");
1784
+ motionUtils.invariant(Boolean(numSubjects), "No valid elements provided.", "no-valid-elements");
1785
1785
  for (let i = 0; i < numSubjects; i++) {
1786
1786
  const thisSubject = subjects[i];
1787
1787
  const createVisualElement = thisSubject instanceof Element
@@ -1849,7 +1849,7 @@ const animate = createScopedAnimate();
1849
1849
  function animateElements(elementOrSelector, keyframes, options, scope) {
1850
1850
  const elements = motionDom.resolveElements(elementOrSelector, scope);
1851
1851
  const numElements = elements.length;
1852
- motionUtils.invariant(Boolean(numElements), "No valid element provided.");
1852
+ motionUtils.invariant(Boolean(numElements), "No valid elements provided.", "no-valid-elements");
1853
1853
  /**
1854
1854
  * WAAPI doesn't support interrupting animations.
1855
1855
  *
package/dist/cjs/index.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
- var create = require('./create-Dr1Bf9gl.js');
7
+ var create = require('./create-C-c1JfhA.js');
8
8
  var motionDom = require('motion-dom');
9
9
  var motionUtils = require('motion-utils');
10
10
 
@@ -723,7 +723,7 @@ function ReorderItemComponent({ children, style = {}, value, as = "li", onDrag,
723
723
  y: useDefaultMotionValue(style.y),
724
724
  };
725
725
  const zIndex = useTransform([point.x, point.y], ([latestX, latestY]) => latestX || latestY ? 1 : "unset");
726
- motionUtils.invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
726
+ motionUtils.invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group", "reorder-item-child");
727
727
  const { axis, registerItem, updateOrder } = context;
728
728
  return (jsxRuntime.jsx(Component, { drag: axis, ...props, dragSnapToOrigin: true, style: { ...style, x: point.x, y: point.y, zIndex }, layout: layout, onDrag: (event, gesturePoint) => {
729
729
  const { velocity } = gesturePoint;
@@ -940,7 +940,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
940
940
  * Handle repeat options
941
941
  */
942
942
  if (repeat) {
943
- motionUtils.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
943
+ motionUtils.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20", "repeat-count-high");
944
944
  duration = calculateRepeatDuration(duration, repeat);
945
945
  const originalKeyframes = [...valueKeyframesAsList];
946
946
  const originalTimes = [...times];
@@ -1167,7 +1167,7 @@ function animateSubject(subject, keyframes, options, scope) {
1167
1167
  else {
1168
1168
  const subjects = resolveSubjects(subject, keyframes, scope);
1169
1169
  const numSubjects = subjects.length;
1170
- motionUtils.invariant(Boolean(numSubjects), "No valid elements provided.");
1170
+ motionUtils.invariant(Boolean(numSubjects), "No valid elements provided.", "no-valid-elements");
1171
1171
  for (let i = 0; i < numSubjects; i++) {
1172
1172
  const thisSubject = subjects[i];
1173
1173
  const createVisualElement = thisSubject instanceof Element
@@ -1235,7 +1235,7 @@ const animate = createScopedAnimate();
1235
1235
  function animateElements(elementOrSelector, keyframes, options, scope) {
1236
1236
  const elements = motionDom.resolveElements(elementOrSelector, scope);
1237
1237
  const numElements = elements.length;
1238
- motionUtils.invariant(Boolean(numElements), "No valid element provided.");
1238
+ motionUtils.invariant(Boolean(numElements), "No valid elements provided.", "no-valid-elements");
1239
1239
  /**
1240
1240
  * WAAPI doesn't support interrupting animations.
1241
1241
  *
@@ -2309,6 +2309,34 @@ class DragControls {
2309
2309
  controls.start(event.nativeEvent || event, options);
2310
2310
  });
2311
2311
  }
2312
+ /**
2313
+ * Cancels a drag gesture.
2314
+ *
2315
+ * ```jsx
2316
+ * dragControls.cancel()
2317
+ * ```
2318
+ *
2319
+ * @public
2320
+ */
2321
+ cancel() {
2322
+ this.componentControls.forEach((controls) => {
2323
+ controls.cancel();
2324
+ });
2325
+ }
2326
+ /**
2327
+ * Stops a drag gesture.
2328
+ *
2329
+ * ```jsx
2330
+ * dragControls.stop()
2331
+ * ```
2332
+ *
2333
+ * @public
2334
+ */
2335
+ stop() {
2336
+ this.componentControls.forEach((controls) => {
2337
+ controls.stop();
2338
+ });
2339
+ }
2312
2340
  }
2313
2341
  const createDragControls = () => new DragControls();
2314
2342
  /**
package/dist/cjs/mini.js CHANGED
@@ -28,7 +28,7 @@ function useUnmountEffect(callback) {
28
28
  function animateElements(elementOrSelector, keyframes, options, scope) {
29
29
  const elements = motionDom.resolveElements(elementOrSelector, scope);
30
30
  const numElements = elements.length;
31
- motionUtils.invariant(Boolean(numElements), "No valid element provided.");
31
+ motionUtils.invariant(Boolean(numElements), "No valid elements provided.", "no-valid-elements");
32
32
  /**
33
33
  * WAAPI doesn't support interrupting animations.
34
34
  *
@@ -25,7 +25,7 @@ function animateSubject(subject, keyframes, options, scope) {
25
25
  else {
26
26
  const subjects = resolveSubjects(subject, keyframes, scope);
27
27
  const numSubjects = subjects.length;
28
- invariant(Boolean(numSubjects), "No valid elements provided.");
28
+ invariant(Boolean(numSubjects), "No valid elements provided.", "no-valid-elements");
29
29
  for (let i = 0; i < numSubjects; i++) {
30
30
  const thisSubject = subjects[i];
31
31
  const createVisualElement = thisSubject instanceof Element
@@ -4,7 +4,7 @@ import { invariant, secondsToMilliseconds } from 'motion-utils';
4
4
  function animateElements(elementOrSelector, keyframes, options, scope) {
5
5
  const elements = resolveElements(elementOrSelector, scope);
6
6
  const numElements = elements.length;
7
- invariant(Boolean(numElements), "No valid element provided.");
7
+ invariant(Boolean(numElements), "No valid elements provided.", "no-valid-elements");
8
8
  /**
9
9
  * WAAPI doesn't support interrupting animations.
10
10
  *
@@ -111,7 +111,7 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
111
111
  * Handle repeat options
112
112
  */
113
113
  if (repeat) {
114
- invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
114
+ invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20", "repeat-count-high");
115
115
  duration = calculateRepeatDuration(duration, repeat);
116
116
  const originalKeyframes = [...valueKeyframesAsList];
117
117
  const originalTimes = [...times];
@@ -20,7 +20,7 @@ function ReorderItemComponent({ children, style = {}, value, as = "li", onDrag,
20
20
  y: useDefaultMotionValue(style.y),
21
21
  };
22
22
  const zIndex = useTransform([point.x, point.y], ([latestX, latestY]) => latestX || latestY ? 1 : "unset");
23
- invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
23
+ invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group", "reorder-item-child");
24
24
  const { axis, registerItem, updateOrder } = context;
25
25
  return (jsx(Component, { drag: axis, ...props, dragSnapToOrigin: true, style: { ...style, x: point.x, y: point.y, zIndex }, layout: layout, onDrag: (event, gesturePoint) => {
26
26
  const { velocity } = gesturePoint;
@@ -31,6 +31,14 @@ class VisualElementDragControls {
31
31
  * The per-axis resolved elastic values.
32
32
  */
33
33
  this.elastic = createBox();
34
+ /**
35
+ * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.
36
+ */
37
+ this.latestPointerEvent = null;
38
+ /**
39
+ * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.
40
+ */
41
+ this.latestPanInfo = null;
34
42
  this.visualElement = visualElement;
35
43
  }
36
44
  start(originEvent, { snapToCursor = false, distanceThreshold } = {}) {
@@ -60,6 +68,8 @@ class VisualElementDragControls {
60
68
  if (!this.openDragLock)
61
69
  return;
62
70
  }
71
+ this.latestPointerEvent = event;
72
+ this.latestPanInfo = info;
63
73
  this.isDragging = true;
64
74
  this.currentDirection = null;
65
75
  this.resolveConstraints();
@@ -96,7 +106,8 @@ class VisualElementDragControls {
96
106
  animationState && animationState.setActive("whileDrag", true);
97
107
  };
98
108
  const onMove = (event, info) => {
99
- // latestPointerEvent = event
109
+ this.latestPointerEvent = event;
110
+ this.latestPanInfo = info;
100
111
  const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
101
112
  // If we didn't successfully receive the gesture lock, early return.
102
113
  if (!dragPropagation && !this.openDragLock)
@@ -127,7 +138,13 @@ class VisualElementDragControls {
127
138
  */
128
139
  onDrag && onDrag(event, info);
129
140
  };
130
- const onSessionEnd = (event, info) => this.stop(event, info);
141
+ const onSessionEnd = (event, info) => {
142
+ this.latestPointerEvent = event;
143
+ this.latestPanInfo = info;
144
+ this.stop(event, info);
145
+ this.latestPointerEvent = null;
146
+ this.latestPanInfo = null;
147
+ };
131
148
  const resumeAnimation = () => eachAxis((axis) => this.getAnimationState(axis) === "paused" &&
132
149
  this.getAxisMotionValue(axis).animation?.play());
133
150
  const { dragSnapToOrigin } = this.getProps();
@@ -144,18 +161,26 @@ class VisualElementDragControls {
144
161
  contextWindow: getContextWindow(this.visualElement),
145
162
  });
146
163
  }
147
- stop(event, info) {
164
+ /**
165
+ * @internal
166
+ */
167
+ stop(event, panInfo) {
168
+ const finalEvent = event || this.latestPointerEvent;
169
+ const finalPanInfo = panInfo || this.latestPanInfo;
148
170
  const isDragging = this.isDragging;
149
171
  this.cancel();
150
- if (!isDragging)
172
+ if (!isDragging || !finalPanInfo || !finalEvent)
151
173
  return;
152
- const { velocity } = info;
174
+ const { velocity } = finalPanInfo;
153
175
  this.startAnimation(velocity);
154
176
  const { onDragEnd } = this.getProps();
155
177
  if (onDragEnd) {
156
- frame.postRender(() => onDragEnd(event, info));
178
+ frame.postRender(() => onDragEnd(finalEvent, finalPanInfo));
157
179
  }
158
180
  }
181
+ /**
182
+ * @internal
183
+ */
159
184
  cancel() {
160
185
  this.isDragging = false;
161
186
  const { projection, animationState } = this.visualElement;
@@ -53,6 +53,34 @@ class DragControls {
53
53
  controls.start(event.nativeEvent || event, options);
54
54
  });
55
55
  }
56
+ /**
57
+ * Cancels a drag gesture.
58
+ *
59
+ * ```jsx
60
+ * dragControls.cancel()
61
+ * ```
62
+ *
63
+ * @public
64
+ */
65
+ cancel() {
66
+ this.componentControls.forEach((controls) => {
67
+ controls.cancel();
68
+ });
69
+ }
70
+ /**
71
+ * Stops a drag gesture.
72
+ *
73
+ * ```jsx
74
+ * dragControls.stop()
75
+ * ```
76
+ *
77
+ * @public
78
+ */
79
+ stop() {
80
+ this.componentControls.forEach((controls) => {
81
+ controls.stop();
82
+ });
83
+ }
56
84
  }
57
85
  const createDragControls = () => new DragControls();
58
86
  /**
@@ -114,14 +114,19 @@
114
114
  exports.warning = () => { };
115
115
  exports.invariant = () => { };
116
116
  {
117
- exports.warning = (check, message) => {
117
+ const formatMessage = (message, errorCode) => {
118
+ return errorCode
119
+ ? `${message}. For more information and steps for solving, visit https://motion.dev/error/${errorCode}`
120
+ : message;
121
+ };
122
+ exports.warning = (check, message, errorCode) => {
118
123
  if (!check && typeof console !== "undefined") {
119
- console.warn(message);
124
+ console.warn(formatMessage(message, errorCode));
120
125
  }
121
126
  };
122
- exports.invariant = (check, message) => {
127
+ exports.invariant = (check, message, errorCode) => {
123
128
  if (!check) {
124
- throw new Error(message);
129
+ throw new Error(formatMessage(message, errorCode));
125
130
  }
126
131
  };
127
132
  }
@@ -1712,7 +1717,7 @@
1712
1717
  let { keyframes: keyframes$1 } = options;
1713
1718
  const generatorFactory = type || keyframes;
1714
1719
  if (generatorFactory !== keyframes) {
1715
- exports.invariant(keyframes$1.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`);
1720
+ exports.invariant(keyframes$1.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`, "spring-two-frames");
1716
1721
  }
1717
1722
  if (generatorFactory !== keyframes &&
1718
1723
  typeof keyframes$1[0] !== "number") {
@@ -10105,6 +10110,14 @@
10105
10110
  * The per-axis resolved elastic values.
10106
10111
  */
10107
10112
  this.elastic = createBox();
10113
+ /**
10114
+ * The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.
10115
+ */
10116
+ this.latestPointerEvent = null;
10117
+ /**
10118
+ * The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.
10119
+ */
10120
+ this.latestPanInfo = null;
10108
10121
  this.visualElement = visualElement;
10109
10122
  }
10110
10123
  start(originEvent, { snapToCursor = false, distanceThreshold } = {}) {
@@ -10134,6 +10147,8 @@
10134
10147
  if (!this.openDragLock)
10135
10148
  return;
10136
10149
  }
10150
+ this.latestPointerEvent = event;
10151
+ this.latestPanInfo = info;
10137
10152
  this.isDragging = true;
10138
10153
  this.currentDirection = null;
10139
10154
  this.resolveConstraints();
@@ -10170,7 +10185,8 @@
10170
10185
  animationState && animationState.setActive("whileDrag", true);
10171
10186
  };
10172
10187
  const onMove = (event, info) => {
10173
- // latestPointerEvent = event
10188
+ this.latestPointerEvent = event;
10189
+ this.latestPanInfo = info;
10174
10190
  const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
10175
10191
  // If we didn't successfully receive the gesture lock, early return.
10176
10192
  if (!dragPropagation && !this.openDragLock)
@@ -10201,7 +10217,13 @@
10201
10217
  */
10202
10218
  onDrag && onDrag(event, info);
10203
10219
  };
10204
- const onSessionEnd = (event, info) => this.stop(event, info);
10220
+ const onSessionEnd = (event, info) => {
10221
+ this.latestPointerEvent = event;
10222
+ this.latestPanInfo = info;
10223
+ this.stop(event, info);
10224
+ this.latestPointerEvent = null;
10225
+ this.latestPanInfo = null;
10226
+ };
10205
10227
  const resumeAnimation = () => eachAxis((axis) => this.getAnimationState(axis) === "paused" &&
10206
10228
  this.getAxisMotionValue(axis).animation?.play());
10207
10229
  const { dragSnapToOrigin } = this.getProps();
@@ -10218,18 +10240,26 @@
10218
10240
  contextWindow: getContextWindow(this.visualElement),
10219
10241
  });
10220
10242
  }
10221
- stop(event, info) {
10243
+ /**
10244
+ * @internal
10245
+ */
10246
+ stop(event, panInfo) {
10247
+ const finalEvent = event || this.latestPointerEvent;
10248
+ const finalPanInfo = panInfo || this.latestPanInfo;
10222
10249
  const isDragging = this.isDragging;
10223
10250
  this.cancel();
10224
- if (!isDragging)
10251
+ if (!isDragging || !finalPanInfo || !finalEvent)
10225
10252
  return;
10226
- const { velocity } = info;
10253
+ const { velocity } = finalPanInfo;
10227
10254
  this.startAnimation(velocity);
10228
10255
  const { onDragEnd } = this.getProps();
10229
10256
  if (onDragEnd) {
10230
- frame.postRender(() => onDragEnd(event, info));
10257
+ frame.postRender(() => onDragEnd(finalEvent, finalPanInfo));
10231
10258
  }
10232
10259
  }
10260
+ /**
10261
+ * @internal
10262
+ */
10233
10263
  cancel() {
10234
10264
  this.isDragging = false;
10235
10265
  const { projection, animationState } = this.visualElement;
@@ -11863,7 +11893,7 @@
11863
11893
  y: useDefaultMotionValue(style.y),
11864
11894
  };
11865
11895
  const zIndex = useTransform([point.x, point.y], ([latestX, latestY]) => latestX || latestY ? 1 : "unset");
11866
- exports.invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
11896
+ exports.invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group", "reorder-item-child");
11867
11897
  const { axis, registerItem, updateOrder } = context;
11868
11898
  return (jsx(Component, { drag: axis, ...props, dragSnapToOrigin: true, style: { ...style, x: point.x, y: point.y, zIndex }, layout: layout, onDrag: (event, gesturePoint) => {
11869
11899
  const { velocity } = gesturePoint;
@@ -12080,7 +12110,7 @@
12080
12110
  * Handle repeat options
12081
12111
  */
12082
12112
  if (repeat) {
12083
- exports.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
12113
+ exports.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20", "repeat-count-high");
12084
12114
  duration = calculateRepeatDuration(duration, repeat);
12085
12115
  const originalKeyframes = [...valueKeyframesAsList];
12086
12116
  const originalTimes = [...times];
@@ -12307,7 +12337,7 @@
12307
12337
  else {
12308
12338
  const subjects = resolveSubjects(subject, keyframes, scope);
12309
12339
  const numSubjects = subjects.length;
12310
- exports.invariant(Boolean(numSubjects), "No valid elements provided.");
12340
+ exports.invariant(Boolean(numSubjects), "No valid elements provided.", "no-valid-elements");
12311
12341
  for (let i = 0; i < numSubjects; i++) {
12312
12342
  const thisSubject = subjects[i];
12313
12343
  const createVisualElement = thisSubject instanceof Element
@@ -12375,7 +12405,7 @@
12375
12405
  function animateElements(elementOrSelector, keyframes, options, scope) {
12376
12406
  const elements = resolveElements(elementOrSelector, scope);
12377
12407
  const numElements = elements.length;
12378
- exports.invariant(Boolean(numElements), "No valid element provided.");
12408
+ exports.invariant(Boolean(numElements), "No valid elements provided.", "no-valid-elements");
12379
12409
  /**
12380
12410
  * WAAPI doesn't support interrupting animations.
12381
12411
  *
@@ -13449,6 +13479,34 @@
13449
13479
  controls.start(event.nativeEvent || event, options);
13450
13480
  });
13451
13481
  }
13482
+ /**
13483
+ * Cancels a drag gesture.
13484
+ *
13485
+ * ```jsx
13486
+ * dragControls.cancel()
13487
+ * ```
13488
+ *
13489
+ * @public
13490
+ */
13491
+ cancel() {
13492
+ this.componentControls.forEach((controls) => {
13493
+ controls.cancel();
13494
+ });
13495
+ }
13496
+ /**
13497
+ * Stops a drag gesture.
13498
+ *
13499
+ * ```jsx
13500
+ * dragControls.stop()
13501
+ * ```
13502
+ *
13503
+ * @public
13504
+ */
13505
+ stop() {
13506
+ this.componentControls.forEach((controls) => {
13507
+ controls.stop();
13508
+ });
13509
+ }
13452
13510
  }
13453
13511
  const createDragControls = () => new DragControls();
13454
13512
  /**