framer-motion 10.2.3 → 10.2.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 (36) hide show
  1. package/dist/cjs/dom-entry.js +1 -1
  2. package/dist/cjs/index.js +18 -20
  3. package/dist/cjs/{wrap-27fda06a.js → wrap-62da7859.js} +456 -437
  4. package/dist/dom-entry.d.ts +485 -37
  5. package/dist/es/animation/GroupPlaybackControls.mjs +25 -0
  6. package/dist/es/animation/animate.mjs +2 -3
  7. package/dist/es/animation/create-instant-animation.mjs +13 -3
  8. package/dist/es/animation/generators/inertia.mjs +87 -0
  9. package/dist/es/animation/{legacy-popmotion → generators}/keyframes.mjs +8 -15
  10. package/dist/es/animation/{legacy-popmotion/find-spring.mjs → generators/spring/find.mjs} +6 -5
  11. package/dist/es/animation/generators/spring/index.mjs +129 -0
  12. package/dist/es/animation/generators/utils/velocity.mjs +9 -0
  13. package/dist/es/animation/index.mjs +2 -10
  14. package/dist/es/animation/js/driver-frameloop.mjs +12 -0
  15. package/dist/es/animation/js/index.mjs +206 -0
  16. package/dist/es/animation/optimized-appear/handoff.mjs +3 -1
  17. package/dist/es/animation/waapi/create-accelerated-animation.mjs +16 -10
  18. package/dist/es/frameloop/index.mjs +3 -4
  19. package/dist/es/gestures/pan/PanSession.mjs +2 -2
  20. package/dist/es/index.mjs +2 -3
  21. package/dist/es/render/utils/motion-values.mjs +1 -1
  22. package/dist/es/utils/time-conversion.mjs +2 -1
  23. package/dist/es/value/index.mjs +3 -3
  24. package/dist/es/value/use-spring.mjs +1 -1
  25. package/dist/es/value/use-velocity.mjs +4 -6
  26. package/dist/framer-motion.dev.js +475 -458
  27. package/dist/framer-motion.js +1 -1
  28. package/dist/index.d.ts +175 -218
  29. package/dist/projection.dev.js +5849 -5830
  30. package/dist/three-entry.d.ts +62 -63
  31. package/package.json +7 -11
  32. package/dist/es/animation/legacy-popmotion/decay.mjs +0 -34
  33. package/dist/es/animation/legacy-popmotion/index.mjs +0 -163
  34. package/dist/es/animation/legacy-popmotion/inertia.mjs +0 -90
  35. package/dist/es/animation/legacy-popmotion/spring.mjs +0 -143
  36. package/dist/es/frameloop/on-next-frame.mjs +0 -12
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var wrap = require('./wrap-27fda06a.js');
5
+ var wrap = require('./wrap-62da7859.js');
6
6
 
7
7
 
8
8
 
package/dist/cjs/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var wrap = require('./wrap-27fda06a.js');
6
+ var wrap = require('./wrap-62da7859.js');
7
7
 
8
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
9
 
@@ -2392,7 +2392,7 @@ function getVelocity(history, timeDelta) {
2392
2392
  if (!timestampedPoint) {
2393
2393
  return { x: 0, y: 0 };
2394
2394
  }
2395
- const time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;
2395
+ const time = wrap.millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);
2396
2396
  if (time === 0) {
2397
2397
  return { x: 0, y: 0 };
2398
2398
  }
@@ -5516,7 +5516,7 @@ function updateMotionValuesFromProps(element, next, prev) {
5516
5516
  * and warn against mismatches.
5517
5517
  */
5518
5518
  if (process.env.NODE_ENV === "development") {
5519
- wrap.warnOnce(nextValue.version === "10.2.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.3 may not work as expected.`);
5519
+ wrap.warnOnce(nextValue.version === "10.2.4", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.4 may not work as expected.`);
5520
5520
  }
5521
5521
  }
5522
5522
  else if (wrap.isMotionValue(prevValue)) {
@@ -7114,6 +7114,16 @@ function useSpring(source, config = {}) {
7114
7114
  return value;
7115
7115
  }
7116
7116
 
7117
+ function useMotionValueEvent(value, event, callback) {
7118
+ /**
7119
+ * useInsertionEffect will create subscriptions before any other
7120
+ * effects will run. Effects run upwards through the tree so it
7121
+ * can be that binding a useLayoutEffect higher up the tree can
7122
+ * miss changes from lower down the tree.
7123
+ */
7124
+ React.useInsertionEffect(() => value.on(event, callback), [value, event, callback]);
7125
+ }
7126
+
7117
7127
  /**
7118
7128
  * Creates a `MotionValue` that updates when the velocity of the provided `MotionValue` changes.
7119
7129
  *
@@ -7127,11 +7137,9 @@ function useSpring(source, config = {}) {
7127
7137
  */
7128
7138
  function useVelocity(value) {
7129
7139
  const velocity = useMotionValue(value.getVelocity());
7130
- React.useEffect(() => {
7131
- return value.on("velocityChange", (newVelocity) => {
7132
- velocity.set(newVelocity);
7133
- });
7134
- }, [value]);
7140
+ useMotionValueEvent(value, "velocityChange", (newVelocity) => {
7141
+ velocity.set(newVelocity);
7142
+ });
7135
7143
  return velocity;
7136
7144
  }
7137
7145
 
@@ -7250,16 +7258,6 @@ function useWillChange() {
7250
7258
  return useConstant(() => new WillChangeMotionValue("auto"));
7251
7259
  }
7252
7260
 
7253
- function useMotionValueEvent(value, event, callback) {
7254
- /**
7255
- * useInsertionEffect will create subscriptions before any other
7256
- * effects will run. Effects run upwards through the tree so it
7257
- * can be that binding a useLayoutEffect higher up the tree can
7258
- * miss changes from lower down the tree.
7259
- */
7260
- React.useInsertionEffect(() => value.on(event, callback), [value, event, callback]);
7261
- }
7262
-
7263
7261
  /**
7264
7262
  * A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting.
7265
7263
  *
@@ -7681,7 +7679,8 @@ sync) {
7681
7679
  */
7682
7680
  sync.update(() => {
7683
7681
  if (value.animation) {
7684
- value.animation.currentTime = performance.now() - sampledTime;
7682
+ value.animation.currentTime =
7683
+ performance.now() - wrap.millisecondsToSeconds(sampledTime);
7685
7684
  }
7686
7685
  });
7687
7686
  /**
@@ -7884,7 +7883,6 @@ exports.easeInOut = wrap.easeInOut;
7884
7883
  exports.easeOut = wrap.easeOut;
7885
7884
  exports.frameData = wrap.frameData;
7886
7885
  exports.inView = wrap.inView;
7887
- exports.inertia = wrap.inertia;
7888
7886
  exports.interpolate = wrap.interpolate;
7889
7887
  Object.defineProperty(exports, 'invariant', {
7890
7888
  enumerable: true,