motion 12.6.3 → 12.6.4

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 (60) hide show
  1. package/dist/cjs/index.js +17 -2
  2. package/dist/cjs/mini.js +177 -0
  3. package/dist/cjs/react-client.js +17 -2
  4. package/dist/cjs/react-m.js +10 -0
  5. package/dist/cjs/react-mini.js +177 -0
  6. package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +1 -0
  7. package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +1 -0
  8. package/dist/es/framer-motion/dist/es/animation/animate/single-value.mjs +1 -0
  9. package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +1 -0
  10. package/dist/es/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +1 -0
  11. package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +1 -0
  12. package/dist/es/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +1 -0
  13. package/dist/es/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +1 -0
  14. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +1 -0
  15. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +1 -0
  16. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +1 -0
  17. package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +1 -0
  18. package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +1 -0
  19. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +1 -0
  20. package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +1 -0
  21. package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +1 -0
  22. package/dist/es/framer-motion/dist/es/easing/utils/map.mjs +1 -0
  23. package/dist/es/framer-motion/dist/es/events/event-info.mjs +1 -0
  24. package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +1 -0
  25. package/dist/es/framer-motion/dist/es/gestures/hover.mjs +1 -0
  26. package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +1 -0
  27. package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +1 -0
  28. package/dist/es/framer-motion/dist/es/gestures/press.mjs +1 -0
  29. package/dist/es/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs +1 -0
  30. package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +1 -0
  31. package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +1 -0
  32. package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +1 -0
  33. package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +1 -0
  34. package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +1 -0
  35. package/dist/es/framer-motion/dist/es/render/dom/scroll/observe.mjs +1 -0
  36. package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +1 -0
  37. package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +1 -0
  38. package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +1 -0
  39. package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +1 -0
  40. package/dist/es/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +1 -0
  41. package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +2 -1
  42. package/dist/es/framer-motion/dist/es/render/utils/setters.mjs +1 -0
  43. package/dist/es/framer-motion/dist/es/utils/delay.mjs +1 -0
  44. package/dist/es/framer-motion/dist/es/utils/use-animation-frame.mjs +1 -0
  45. package/dist/es/framer-motion/dist/es/utils/use-force-update.mjs +1 -0
  46. package/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs +1 -0
  47. package/dist/es/framer-motion/dist/es/value/use-combine-values.mjs +1 -0
  48. package/dist/es/framer-motion/dist/es/value/use-computed.mjs +1 -0
  49. package/dist/es/framer-motion/dist/es/value/use-motion-value.mjs +1 -0
  50. package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +1 -0
  51. package/dist/es/framer-motion/dist/es/value/use-spring.mjs +1 -0
  52. package/dist/es/framer-motion/dist/es/value/use-velocity.mjs +1 -0
  53. package/dist/es/framer-motion/dist/es/value/use-will-change/WillChangeMotionValue.mjs +1 -0
  54. package/dist/es/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +7 -0
  55. package/dist/es/motion/lib/react.mjs +1 -0
  56. package/dist/es/motion-dom/dist/es/frameloop/index-legacy.mjs +12 -0
  57. package/dist/es/motion-dom/dist/es/value/index.mjs +1 -1
  58. package/dist/motion.dev.js +17 -2
  59. package/dist/motion.js +1 -1
  60. package/package.json +3 -3
package/dist/cjs/index.js CHANGED
@@ -1065,7 +1065,7 @@ class MotionValue {
1065
1065
  * This will be replaced by the build step with the latest version number.
1066
1066
  * When MotionValues are provided to motion components, warn if versions are mixed.
1067
1067
  */
1068
- this.version = "12.6.3";
1068
+ this.version = "12.6.4";
1069
1069
  /**
1070
1070
  * Tracks whether this value can output a velocity. Currently this is only true
1071
1071
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -1340,6 +1340,16 @@ function motionValue(init, options) {
1340
1340
  return new MotionValue(init, options);
1341
1341
  }
1342
1342
 
1343
+ /**
1344
+ * @deprecated
1345
+ *
1346
+ * Use cancelFrame(callback) instead.
1347
+ */
1348
+ stepsOrder.reduce((acc, key) => {
1349
+ acc[key] = (process) => cancelFrame(process);
1350
+ return acc;
1351
+ }, {});
1352
+
1343
1353
  const clamp = (min, max, v) => {
1344
1354
  if (v > max)
1345
1355
  return max;
@@ -2135,6 +2145,11 @@ function addValueToWillChange(visualElement, key) {
2135
2145
  if (isWillChangeMotionValue(willChange)) {
2136
2146
  return willChange.add(key);
2137
2147
  }
2148
+ else if (!willChange && MotionGlobalConfig.WillChange) {
2149
+ const newWillChange = new MotionGlobalConfig.WillChange("auto");
2150
+ visualElement.addValue("willChange", newWillChange);
2151
+ newWillChange.add(key);
2152
+ }
2138
2153
  }
2139
2154
 
2140
2155
  /**
@@ -4767,7 +4782,7 @@ function updateMotionValuesFromProps(element, next, prev) {
4767
4782
  * and warn against mismatches.
4768
4783
  */
4769
4784
  if (process.env.NODE_ENV === "development") {
4770
- warnOnce(nextValue.version === "12.6.3", `Attempting to mix Motion versions ${nextValue.version} with 12.6.3 may not work as expected.`);
4785
+ warnOnce(nextValue.version === "12.6.4", `Attempting to mix Motion versions ${nextValue.version} with 12.6.4 may not work as expected.`);
4771
4786
  }
4772
4787
  }
4773
4788
  else if (isMotionValue(prevValue)) {
package/dist/cjs/mini.js CHANGED
@@ -239,6 +239,11 @@ function hydrateKeyframes(element, name, keyframes, pseudoElement) {
239
239
  return keyframes;
240
240
  }
241
241
 
242
+ const statsBuffer = {
243
+ value: null,
244
+ addProjectionMetrics: null,
245
+ };
246
+
242
247
  const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
243
248
 
244
249
  /**
@@ -535,6 +540,168 @@ function createGeneratorEasing(options, scale = 100, createGenerator) {
535
540
  };
536
541
  }
537
542
 
543
+ const stepsOrder = [
544
+ "read", // Read
545
+ "resolveKeyframes", // Write/Read/Write/Read
546
+ "update", // Compute
547
+ "preRender", // Compute
548
+ "render", // Write
549
+ "postRender", // Compute
550
+ ];
551
+
552
+ function createRenderStep(runNextFrame, stepName) {
553
+ /**
554
+ * We create and reuse two queues, one to queue jobs for the current frame
555
+ * and one for the next. We reuse to avoid triggering GC after x frames.
556
+ */
557
+ let thisFrame = new Set();
558
+ let nextFrame = new Set();
559
+ /**
560
+ * Track whether we're currently processing jobs in this step. This way
561
+ * we can decide whether to schedule new jobs for this frame or next.
562
+ */
563
+ let isProcessing = false;
564
+ let flushNextFrame = false;
565
+ /**
566
+ * A set of processes which were marked keepAlive when scheduled.
567
+ */
568
+ const toKeepAlive = new WeakSet();
569
+ let latestFrameData = {
570
+ delta: 0.0,
571
+ timestamp: 0.0,
572
+ isProcessing: false,
573
+ };
574
+ let numCalls = 0;
575
+ function triggerCallback(callback) {
576
+ if (toKeepAlive.has(callback)) {
577
+ step.schedule(callback);
578
+ runNextFrame();
579
+ }
580
+ numCalls++;
581
+ callback(latestFrameData);
582
+ }
583
+ const step = {
584
+ /**
585
+ * Schedule a process to run on the next frame.
586
+ */
587
+ schedule: (callback, keepAlive = false, immediate = false) => {
588
+ const addToCurrentFrame = immediate && isProcessing;
589
+ const queue = addToCurrentFrame ? thisFrame : nextFrame;
590
+ if (keepAlive)
591
+ toKeepAlive.add(callback);
592
+ if (!queue.has(callback))
593
+ queue.add(callback);
594
+ return callback;
595
+ },
596
+ /**
597
+ * Cancel the provided callback from running on the next frame.
598
+ */
599
+ cancel: (callback) => {
600
+ nextFrame.delete(callback);
601
+ toKeepAlive.delete(callback);
602
+ },
603
+ /**
604
+ * Execute all schedule callbacks.
605
+ */
606
+ process: (frameData) => {
607
+ latestFrameData = frameData;
608
+ /**
609
+ * If we're already processing we've probably been triggered by a flushSync
610
+ * inside an existing process. Instead of executing, mark flushNextFrame
611
+ * as true and ensure we flush the following frame at the end of this one.
612
+ */
613
+ if (isProcessing) {
614
+ flushNextFrame = true;
615
+ return;
616
+ }
617
+ isProcessing = true;
618
+ [thisFrame, nextFrame] = [nextFrame, thisFrame];
619
+ // Execute this frame
620
+ thisFrame.forEach(triggerCallback);
621
+ /**
622
+ * If we're recording stats then
623
+ */
624
+ if (stepName && statsBuffer.value) {
625
+ statsBuffer.value.frameloop[stepName].push(numCalls);
626
+ }
627
+ numCalls = 0;
628
+ // Clear the frame so no callbacks remain. This is to avoid
629
+ // memory leaks should this render step not run for a while.
630
+ thisFrame.clear();
631
+ isProcessing = false;
632
+ if (flushNextFrame) {
633
+ flushNextFrame = false;
634
+ step.process(frameData);
635
+ }
636
+ },
637
+ };
638
+ return step;
639
+ }
640
+
641
+ const maxElapsed = 40;
642
+ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
643
+ let runNextFrame = false;
644
+ let useDefaultElapsed = true;
645
+ const state = {
646
+ delta: 0.0,
647
+ timestamp: 0.0,
648
+ isProcessing: false,
649
+ };
650
+ const flagRunNextFrame = () => (runNextFrame = true);
651
+ const steps = stepsOrder.reduce((acc, key) => {
652
+ acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined);
653
+ return acc;
654
+ }, {});
655
+ const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
656
+ const processBatch = () => {
657
+ const timestamp = performance.now();
658
+ runNextFrame = false;
659
+ {
660
+ state.delta = useDefaultElapsed
661
+ ? 1000 / 60
662
+ : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
663
+ }
664
+ state.timestamp = timestamp;
665
+ state.isProcessing = true;
666
+ // Unrolled render loop for better per-frame performance
667
+ read.process(state);
668
+ resolveKeyframes.process(state);
669
+ update.process(state);
670
+ preRender.process(state);
671
+ render.process(state);
672
+ postRender.process(state);
673
+ state.isProcessing = false;
674
+ if (runNextFrame && allowKeepAlive) {
675
+ useDefaultElapsed = false;
676
+ scheduleNextBatch(processBatch);
677
+ }
678
+ };
679
+ const wake = () => {
680
+ runNextFrame = true;
681
+ useDefaultElapsed = true;
682
+ if (!state.isProcessing) {
683
+ scheduleNextBatch(processBatch);
684
+ }
685
+ };
686
+ const schedule = stepsOrder.reduce((acc, key) => {
687
+ const step = steps[key];
688
+ acc[key] = (process, keepAlive = false, immediate = false) => {
689
+ if (!runNextFrame)
690
+ wake();
691
+ return step.schedule(process, keepAlive, immediate);
692
+ };
693
+ return acc;
694
+ }, {});
695
+ const cancel = (process) => {
696
+ for (let i = 0; i < stepsOrder.length; i++) {
697
+ steps[stepsOrder[i]].cancel(process);
698
+ }
699
+ };
700
+ return { schedule, cancel, state, steps };
701
+ }
702
+
703
+ const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
704
+
538
705
  function resolveElements(elementOrSelector, scope, selectorCache) {
539
706
  if (elementOrSelector instanceof EventTarget) {
540
707
  return [elementOrSelector];
@@ -551,6 +718,16 @@ function resolveElements(elementOrSelector, scope, selectorCache) {
551
718
  return Array.from(elementOrSelector);
552
719
  }
553
720
 
721
+ /**
722
+ * @deprecated
723
+ *
724
+ * Use cancelFrame(callback) instead.
725
+ */
726
+ stepsOrder.reduce((acc, key) => {
727
+ acc[key] = (process) => cancelFrame(process);
728
+ return acc;
729
+ }, {});
730
+
554
731
  const wrap = (min, max, v) => {
555
732
  const rangeSize = max - min;
556
733
  return ((((v - min) % rangeSize) + rangeSize) % rangeSize) + min;
@@ -886,7 +886,7 @@ class MotionValue {
886
886
  * This will be replaced by the build step with the latest version number.
887
887
  * When MotionValues are provided to motion components, warn if versions are mixed.
888
888
  */
889
- this.version = "12.6.3";
889
+ this.version = "12.6.4";
890
890
  /**
891
891
  * Tracks whether this value can output a velocity. Currently this is only true
892
892
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -1161,6 +1161,16 @@ function motionValue(init, options) {
1161
1161
  return new MotionValue(init, options);
1162
1162
  }
1163
1163
 
1164
+ /**
1165
+ * @deprecated
1166
+ *
1167
+ * Use cancelFrame(callback) instead.
1168
+ */
1169
+ stepsOrder.reduce((acc, key) => {
1170
+ acc[key] = (process) => cancelFrame(process);
1171
+ return acc;
1172
+ }, {});
1173
+
1164
1174
  /**
1165
1175
  * Generate a list of every possible transform key.
1166
1176
  */
@@ -1247,6 +1257,11 @@ function addValueToWillChange(visualElement, key) {
1247
1257
  if (isWillChangeMotionValue(willChange)) {
1248
1258
  return willChange.add(key);
1249
1259
  }
1260
+ else if (!willChange && MotionGlobalConfig.WillChange) {
1261
+ const newWillChange = new MotionGlobalConfig.WillChange("auto");
1262
+ visualElement.addValue("willChange", newWillChange);
1263
+ newWillChange.add(key);
1264
+ }
1250
1265
  }
1251
1266
 
1252
1267
  /**
@@ -9330,7 +9345,7 @@ function updateMotionValuesFromProps(element, next, prev) {
9330
9345
  * and warn against mismatches.
9331
9346
  */
9332
9347
  if (process.env.NODE_ENV === "development") {
9333
- warnOnce(nextValue.version === "12.6.3", `Attempting to mix Motion versions ${nextValue.version} with 12.6.3 may not work as expected.`);
9348
+ warnOnce(nextValue.version === "12.6.4", `Attempting to mix Motion versions ${nextValue.version} with 12.6.4 may not work as expected.`);
9334
9349
  }
9335
9350
  }
9336
9351
  else if (isMotionValue(prevValue)) {
@@ -341,6 +341,16 @@ const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameStep
341
341
  const { schedule: microtask, cancel: cancelMicrotask } =
342
342
  /* @__PURE__ */ createRenderBatcher(queueMicrotask, false);
343
343
 
344
+ /**
345
+ * @deprecated
346
+ *
347
+ * Use cancelFrame(callback) instead.
348
+ */
349
+ stepsOrder.reduce((acc, key) => {
350
+ acc[key] = (process) => cancelFrame(process);
351
+ return acc;
352
+ }, {});
353
+
344
354
  /**
345
355
  * Convert camelCase to dash-case properties.
346
356
  */
@@ -236,6 +236,11 @@ function hydrateKeyframes(element, name, keyframes, pseudoElement) {
236
236
  return keyframes;
237
237
  }
238
238
 
239
+ const statsBuffer = {
240
+ value: null,
241
+ addProjectionMetrics: null,
242
+ };
243
+
239
244
  const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
240
245
 
241
246
  /**
@@ -501,6 +506,168 @@ function getValueTransition(transition, key) {
501
506
  transition);
502
507
  }
503
508
 
509
+ const stepsOrder = [
510
+ "read", // Read
511
+ "resolveKeyframes", // Write/Read/Write/Read
512
+ "update", // Compute
513
+ "preRender", // Compute
514
+ "render", // Write
515
+ "postRender", // Compute
516
+ ];
517
+
518
+ function createRenderStep(runNextFrame, stepName) {
519
+ /**
520
+ * We create and reuse two queues, one to queue jobs for the current frame
521
+ * and one for the next. We reuse to avoid triggering GC after x frames.
522
+ */
523
+ let thisFrame = new Set();
524
+ let nextFrame = new Set();
525
+ /**
526
+ * Track whether we're currently processing jobs in this step. This way
527
+ * we can decide whether to schedule new jobs for this frame or next.
528
+ */
529
+ let isProcessing = false;
530
+ let flushNextFrame = false;
531
+ /**
532
+ * A set of processes which were marked keepAlive when scheduled.
533
+ */
534
+ const toKeepAlive = new WeakSet();
535
+ let latestFrameData = {
536
+ delta: 0.0,
537
+ timestamp: 0.0,
538
+ isProcessing: false,
539
+ };
540
+ let numCalls = 0;
541
+ function triggerCallback(callback) {
542
+ if (toKeepAlive.has(callback)) {
543
+ step.schedule(callback);
544
+ runNextFrame();
545
+ }
546
+ numCalls++;
547
+ callback(latestFrameData);
548
+ }
549
+ const step = {
550
+ /**
551
+ * Schedule a process to run on the next frame.
552
+ */
553
+ schedule: (callback, keepAlive = false, immediate = false) => {
554
+ const addToCurrentFrame = immediate && isProcessing;
555
+ const queue = addToCurrentFrame ? thisFrame : nextFrame;
556
+ if (keepAlive)
557
+ toKeepAlive.add(callback);
558
+ if (!queue.has(callback))
559
+ queue.add(callback);
560
+ return callback;
561
+ },
562
+ /**
563
+ * Cancel the provided callback from running on the next frame.
564
+ */
565
+ cancel: (callback) => {
566
+ nextFrame.delete(callback);
567
+ toKeepAlive.delete(callback);
568
+ },
569
+ /**
570
+ * Execute all schedule callbacks.
571
+ */
572
+ process: (frameData) => {
573
+ latestFrameData = frameData;
574
+ /**
575
+ * If we're already processing we've probably been triggered by a flushSync
576
+ * inside an existing process. Instead of executing, mark flushNextFrame
577
+ * as true and ensure we flush the following frame at the end of this one.
578
+ */
579
+ if (isProcessing) {
580
+ flushNextFrame = true;
581
+ return;
582
+ }
583
+ isProcessing = true;
584
+ [thisFrame, nextFrame] = [nextFrame, thisFrame];
585
+ // Execute this frame
586
+ thisFrame.forEach(triggerCallback);
587
+ /**
588
+ * If we're recording stats then
589
+ */
590
+ if (stepName && statsBuffer.value) {
591
+ statsBuffer.value.frameloop[stepName].push(numCalls);
592
+ }
593
+ numCalls = 0;
594
+ // Clear the frame so no callbacks remain. This is to avoid
595
+ // memory leaks should this render step not run for a while.
596
+ thisFrame.clear();
597
+ isProcessing = false;
598
+ if (flushNextFrame) {
599
+ flushNextFrame = false;
600
+ step.process(frameData);
601
+ }
602
+ },
603
+ };
604
+ return step;
605
+ }
606
+
607
+ const maxElapsed = 40;
608
+ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
609
+ let runNextFrame = false;
610
+ let useDefaultElapsed = true;
611
+ const state = {
612
+ delta: 0.0,
613
+ timestamp: 0.0,
614
+ isProcessing: false,
615
+ };
616
+ const flagRunNextFrame = () => (runNextFrame = true);
617
+ const steps = stepsOrder.reduce((acc, key) => {
618
+ acc[key] = createRenderStep(flagRunNextFrame, allowKeepAlive ? key : undefined);
619
+ return acc;
620
+ }, {});
621
+ const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
622
+ const processBatch = () => {
623
+ const timestamp = performance.now();
624
+ runNextFrame = false;
625
+ {
626
+ state.delta = useDefaultElapsed
627
+ ? 1000 / 60
628
+ : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
629
+ }
630
+ state.timestamp = timestamp;
631
+ state.isProcessing = true;
632
+ // Unrolled render loop for better per-frame performance
633
+ read.process(state);
634
+ resolveKeyframes.process(state);
635
+ update.process(state);
636
+ preRender.process(state);
637
+ render.process(state);
638
+ postRender.process(state);
639
+ state.isProcessing = false;
640
+ if (runNextFrame && allowKeepAlive) {
641
+ useDefaultElapsed = false;
642
+ scheduleNextBatch(processBatch);
643
+ }
644
+ };
645
+ const wake = () => {
646
+ runNextFrame = true;
647
+ useDefaultElapsed = true;
648
+ if (!state.isProcessing) {
649
+ scheduleNextBatch(processBatch);
650
+ }
651
+ };
652
+ const schedule = stepsOrder.reduce((acc, key) => {
653
+ const step = steps[key];
654
+ acc[key] = (process, keepAlive = false, immediate = false) => {
655
+ if (!runNextFrame)
656
+ wake();
657
+ return step.schedule(process, keepAlive, immediate);
658
+ };
659
+ return acc;
660
+ }, {});
661
+ const cancel = (process) => {
662
+ for (let i = 0; i < stepsOrder.length; i++) {
663
+ steps[stepsOrder[i]].cancel(process);
664
+ }
665
+ };
666
+ return { schedule, cancel, state, steps };
667
+ }
668
+
669
+ const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = /* @__PURE__ */ createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
670
+
504
671
  function resolveElements(elementOrSelector, scope, selectorCache) {
505
672
  if (elementOrSelector instanceof EventTarget) {
506
673
  return [elementOrSelector];
@@ -517,6 +684,16 @@ function resolveElements(elementOrSelector, scope, selectorCache) {
517
684
  return Array.from(elementOrSelector);
518
685
  }
519
686
 
687
+ /**
688
+ * @deprecated
689
+ *
690
+ * Use cancelFrame(callback) instead.
691
+ */
692
+ stepsOrder.reduce((acc, key) => {
693
+ acc[key] = (process) => cancelFrame(process);
694
+ return acc;
695
+ }, {});
696
+
520
697
  function animateElements(elementOrSelector, keyframes, options, scope) {
521
698
  const elements = resolveElements(elementOrSelector, scope);
522
699
  const numElements = elements.length;
@@ -1,5 +1,6 @@
1
1
  import '../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { GroupAnimationWithThen } from '../../../../../motion-dom/dist/es/animation/GroupAnimationWithThen.mjs';
3
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
3
4
  import { animateSequence } from './sequence.mjs';
4
5
  import { animateSubject } from './subject.mjs';
5
6
 
@@ -1,5 +1,6 @@
1
1
  import '../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { resolveElements } from '../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
3
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
3
4
  import { isDOMKeyframes } from '../utils/is-dom-keyframes.mjs';
4
5
 
5
6
  function resolveSubjects(subject, keyframes, scope, selectorCache) {
@@ -1,5 +1,6 @@
1
1
  import '../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { motionValue } from '../../../../../motion-dom/dist/es/value/index.mjs';
3
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
3
4
  import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
4
5
  import { animateMotionValue } from '../interfaces/motion-value.mjs';
5
6
 
@@ -6,6 +6,7 @@ import { isGenerator } from '../../../../../motion-dom/dist/es/animation/generat
6
6
  import { isWaapiSupportedEasing } from '../../../../../motion-dom/dist/es/animation/waapi/easing/is-supported.mjs';
7
7
  import { supportsLinearEasing } from '../../../../../motion-dom/dist/es/utils/supports/linear-easing.mjs';
8
8
  import { attachTimeline } from '../../../../../motion-dom/dist/es/animation/waapi/utils/attach-timeline.mjs';
9
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
9
10
  import { anticipate } from '../../easing/anticipate.mjs';
10
11
  import { backInOut } from '../../easing/back.mjs';
11
12
  import { circInOut } from '../../easing/circ.mjs';
@@ -1,5 +1,6 @@
1
1
  import '../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { time } from '../../../../../motion-dom/dist/es/frameloop/sync-time.mjs';
3
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
3
4
  import { flushKeyframeResolvers } from '../../render/utils/KeyframesResolver.mjs';
4
5
  import { instantAnimationState } from '../../utils/use-instant-transition-state.mjs';
5
6
  import { canAnimate } from './utils/can-animate.mjs';
@@ -3,6 +3,7 @@ import { millisecondsToSeconds, secondsToMilliseconds } from '../../../../../mot
3
3
  import { activeAnimations } from '../../../../../motion-dom/dist/es/stats/animation-count.mjs';
4
4
  import { isGenerator } from '../../../../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs';
5
5
  import { calcGeneratorDuration } from '../../../../../motion-dom/dist/es/animation/generators/utils/calc-duration.mjs';
6
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
6
7
  import { KeyframeResolver } from '../../render/utils/KeyframesResolver.mjs';
7
8
  import { clamp } from '../../utils/clamp.mjs';
8
9
  import { mix } from '../../utils/mix/index.mjs';
@@ -1,6 +1,7 @@
1
1
  import '../../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { frame, cancelFrame, frameData } from '../../../../../../motion-dom/dist/es/frameloop/frame.mjs';
3
3
  import { time } from '../../../../../../motion-dom/dist/es/frameloop/sync-time.mjs';
4
+ import '../../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
4
5
 
5
6
  const frameloopDriver = (update) => {
6
7
  const passTimestamp = ({ timestamp }) => update(timestamp);
@@ -1,5 +1,6 @@
1
1
  import { warning } from '../../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { isGenerator } from '../../../../../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs';
3
+ import '../../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
3
4
  import { isAnimatable } from '../../utils/is-animatable.mjs';
4
5
 
5
6
  function hasKeyframesChanged(keyframes) {
@@ -3,6 +3,7 @@ import { secondsToMilliseconds } from '../../../../../../motion-utils/dist/es/ti
3
3
  import { NativeAnimation } from '../../../../../../motion-dom/dist/es/animation/NativeAnimation.mjs';
4
4
  import { getValueTransition } from '../../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
5
5
  import { resolveElements } from '../../../../../../motion-dom/dist/es/utils/resolve-elements.mjs';
6
+ import '../../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
6
7
 
7
8
  function animateElements(elementOrSelector, keyframes, options, scope) {
8
9
  const elements = resolveElements(elementOrSelector, scope);
@@ -1,5 +1,6 @@
1
1
  import '../../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { GroupAnimationWithThen } from '../../../../../../motion-dom/dist/es/animation/GroupAnimationWithThen.mjs';
3
+ import '../../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
3
4
  import { createAnimationsFromSequence } from '../../sequence/create.mjs';
4
5
  import { animateElements } from './animate-elements.mjs';
5
6
 
@@ -1,5 +1,6 @@
1
1
  import '../../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { GroupAnimationWithThen } from '../../../../../../motion-dom/dist/es/animation/GroupAnimationWithThen.mjs';
3
+ import '../../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
3
4
  import { animateElements } from './animate-elements.mjs';
4
5
 
5
6
  const createScopedWaapiAnimate = (scope) => {
@@ -4,6 +4,7 @@ import { supportsLinearEasing } from '../../../../../../motion-dom/dist/es/utils
4
4
  import { generateLinearEasing } from '../../../../../../motion-dom/dist/es/animation/waapi/utils/linear.mjs';
5
5
  import { calcGeneratorDuration, maxGeneratorDuration } from '../../../../../../motion-dom/dist/es/animation/generators/utils/calc-duration.mjs';
6
6
  import { createGeneratorEasing } from '../../../../../../motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs';
7
+ import '../../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
7
8
  import { clamp } from '../../../utils/clamp.mjs';
8
9
  import { calcGeneratorVelocity } from '../utils/velocity.mjs';
9
10
  import { springDefaults } from './defaults.mjs';
@@ -4,6 +4,7 @@ import { secondsToMilliseconds } from '../../../../../motion-utils/dist/es/time-
4
4
  import { GroupAnimationWithThen } from '../../../../../motion-dom/dist/es/animation/GroupAnimationWithThen.mjs';
5
5
  import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
6
6
  import { frame } from '../../../../../motion-dom/dist/es/frameloop/frame.mjs';
7
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
7
8
  import { instantAnimationState } from '../../utils/use-instant-transition-state.mjs';
8
9
  import { AcceleratedAnimation } from '../animators/AcceleratedAnimation.mjs';
9
10
  import { MainThreadAnimation } from '../animators/MainThreadAnimation.mjs';
@@ -1,6 +1,7 @@
1
1
  import '../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { getValueTransition } from '../../../../../motion-dom/dist/es/animation/utils/get-value-transition.mjs';
3
3
  import { frame } from '../../../../../motion-dom/dist/es/frameloop/frame.mjs';
4
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
4
5
  import { positionalKeys } from '../../render/html/utils/keys-position.mjs';
5
6
  import { setTarget } from '../../render/utils/setters.mjs';
6
7
  import { addValueToWillChange } from '../../value/use-will-change/add-will-change.mjs';
@@ -1,6 +1,7 @@
1
1
  import '../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
3
3
  import { startWaapiAnimation } from '../../../../../motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs';
4
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
4
5
  import { optimizedAppearDataId } from './data-id.mjs';
5
6
  import { getOptimisedAppearId } from './get-appear-id.mjs';
6
7
  import { handoffOptimizedAppearAnimation } from './handoff.mjs';
@@ -3,6 +3,7 @@ import { progress } from '../../../../../motion-utils/dist/es/progress.mjs';
3
3
  import { secondsToMilliseconds } from '../../../../../motion-utils/dist/es/time-conversion.mjs';
4
4
  import { isGenerator } from '../../../../../motion-dom/dist/es/animation/generators/utils/is-generator.mjs';
5
5
  import { createGeneratorEasing } from '../../../../../motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs';
6
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
6
7
  import { getEasingForSegment } from '../../easing/utils/get-easing-for-segment.mjs';
7
8
  import { defaultOffset } from '../../utils/offsets/default.mjs';
8
9
  import { fillOffset } from '../../utils/offsets/fill.mjs';
@@ -1,6 +1,7 @@
1
1
  import { invariant } from '../../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { noop } from '../../../../../motion-utils/dist/es/noop.mjs';
3
3
  import { isBezierDefinition } from '../../../../../motion-dom/dist/es/utils/is-bezier-definition.mjs';
4
+ import '../../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
4
5
  import { anticipate } from '../anticipate.mjs';
5
6
  import { backIn, backInOut, backOut } from '../back.mjs';
6
7
  import { circIn, circInOut, circOut } from '../circ.mjs';
@@ -1,5 +1,6 @@
1
1
  import '../../../../motion-utils/dist/es/errors.mjs';
2
2
  import { isPrimaryPointer } from '../../../../motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs';
3
+ import '../../../../motion-dom/dist/es/frameloop/index-legacy.mjs';
3
4
 
4
5
  function extractEventInfo(event) {
5
6
  return {