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
@@ -26,7 +26,7 @@ class MotionValue {
26
26
  * This will be replaced by the build step with the latest version number.
27
27
  * When MotionValues are provided to motion components, warn if versions are mixed.
28
28
  */
29
- this.version = "10.2.3";
29
+ this.version = "10.2.4";
30
30
  /**
31
31
  * Duration, in milliseconds, since last updating frame.
32
32
  *
@@ -272,7 +272,7 @@ class MotionValue {
272
272
  this.stop();
273
273
  return new Promise((resolve) => {
274
274
  this.hasAnimated = true;
275
- this.animation = startAnimation(resolve) || null;
275
+ this.animation = startAnimation(resolve);
276
276
  if (this.events.animationStart) {
277
277
  this.events.animationStart.notify();
278
278
  }
@@ -306,7 +306,7 @@ class MotionValue {
306
306
  return !!this.animation;
307
307
  }
308
308
  clearAnimation() {
309
- this.animation = null;
309
+ delete this.animation;
310
310
  }
311
311
  /**
312
312
  * Destroy and clean up subscribers to this `MotionValue`.
@@ -2,8 +2,8 @@ import { useContext, useRef, useInsertionEffect } from 'react';
2
2
  import { isMotionValue } from './utils/is-motion-value.mjs';
3
3
  import { useMotionValue } from './use-motion-value.mjs';
4
4
  import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
5
- import { animateValue } from '../animation/legacy-popmotion/index.mjs';
6
5
  import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
6
+ import { animateValue } from '../animation/js/index.mjs';
7
7
 
8
8
  /**
9
9
  * Creates a `MotionValue` that, when `set`, will use a spring animation to animate to its new state.
@@ -1,4 +1,4 @@
1
- import { useEffect } from 'react';
1
+ import { useMotionValueEvent } from '../utils/use-motion-value-event.mjs';
2
2
  import { useMotionValue } from './use-motion-value.mjs';
3
3
 
4
4
  /**
@@ -14,11 +14,9 @@ import { useMotionValue } from './use-motion-value.mjs';
14
14
  */
15
15
  function useVelocity(value) {
16
16
  const velocity = useMotionValue(value.getVelocity());
17
- useEffect(() => {
18
- return value.on("velocityChange", (newVelocity) => {
19
- velocity.set(newVelocity);
20
- });
21
- }, [value]);
17
+ useMotionValueEvent(value, "velocityChange", (newVelocity) => {
18
+ velocity.set(newVelocity);
19
+ });
22
20
  return velocity;
23
21
  }
24
22