motion 12.6.3-alpha.0 → 12.6.3

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 (74) hide show
  1. package/dist/cjs/debug.js +12 -12
  2. package/dist/cjs/index.js +402 -352
  3. package/dist/cjs/mini.js +339 -352
  4. package/dist/cjs/react-client.js +169 -181
  5. package/dist/cjs/react-m.js +18 -22
  6. package/dist/cjs/react-mini.js +275 -336
  7. package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +2 -2
  8. package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +7 -4
  9. package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +8 -6
  10. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +10 -8
  11. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +2 -2
  12. package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +2 -2
  13. package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +11 -1
  14. package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +3 -3
  15. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +1 -2
  16. package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +1 -2
  17. package/dist/es/framer-motion/dist/es/animation/optimized-appear/handoff.mjs +2 -4
  18. package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +4 -6
  19. package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +3 -3
  20. package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +1 -2
  21. package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +2 -2
  22. package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +5 -10
  23. package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +1 -2
  24. package/dist/es/framer-motion/dist/es/motion/index.mjs +2 -3
  25. package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +3 -5
  26. package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +19 -27
  27. package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +1 -1
  28. package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +3 -4
  29. package/dist/es/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +1 -2
  30. package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +5 -6
  31. package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +1 -2
  32. package/dist/es/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
  33. package/dist/es/framer-motion/dist/es/render/dom/utils/filter-props.mjs +1 -1
  34. package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +1 -2
  35. package/dist/es/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +2 -3
  36. package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +3 -5
  37. package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +1 -1
  38. package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +1 -1
  39. package/dist/es/framer-motion/dist/es/utils/mix/complex.mjs +1 -2
  40. package/dist/es/framer-motion/dist/es/value/types/complex/index.mjs +2 -3
  41. package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +2 -2
  42. package/dist/es/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +0 -7
  43. package/dist/es/motion/lib/react.mjs +0 -1
  44. package/dist/es/motion-dom/dist/es/animation/{controls/BaseGroup.mjs → GroupAnimation.mjs} +4 -5
  45. package/dist/es/motion-dom/dist/es/animation/GroupAnimationWithThen.mjs +9 -0
  46. package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +161 -0
  47. package/dist/es/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +1 -1
  48. package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +12 -0
  49. package/dist/es/motion-dom/dist/es/animation/keyframes/hydrate.mjs +26 -0
  50. package/dist/es/motion-dom/dist/es/animation/utils/get-value-transition.mjs +3 -5
  51. package/dist/es/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs +3 -0
  52. package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +14 -0
  53. package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +26 -0
  54. package/dist/es/motion-dom/dist/es/animation/waapi/easing/supported.mjs +15 -0
  55. package/dist/es/{framer-motion/dist/es/animation/animators/waapi/index.mjs → motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs} +8 -6
  56. package/dist/es/{framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs → motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs} +2 -2
  57. package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +14 -0
  58. package/dist/es/motion-dom/dist/es/animation/waapi/utils/linear.mjs +1 -4
  59. package/dist/es/motion-dom/dist/es/animation/waapi/utils/px-values.mjs +39 -0
  60. package/dist/es/motion-dom/dist/es/gestures/press/index.mjs +1 -1
  61. package/dist/es/motion-dom/dist/es/render/dom/style.mjs +15 -0
  62. package/dist/es/motion-dom/dist/es/utils/resolve-elements.mjs +2 -7
  63. package/dist/es/motion-dom/dist/es/utils/supports/flags.mjs +1 -3
  64. package/dist/es/motion-dom/dist/es/utils/supports/memo.mjs +1 -1
  65. package/dist/es/motion-dom/dist/es/value/index.mjs +1 -1
  66. package/dist/es/motion-utils/dist/es/errors.mjs +2 -4
  67. package/dist/motion.dev.js +402 -352
  68. package/dist/motion.js +1 -1
  69. package/package.json +3 -3
  70. package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +0 -116
  71. package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +0 -8
  72. package/dist/es/motion-dom/dist/es/animation/controls/Group.mjs +0 -13
  73. package/dist/es/motion-dom/dist/es/animation/waapi/NativeAnimationControls.mjs +0 -85
  74. package/dist/es/motion-dom/dist/es/animation/waapi/utils/easing.mjs +0 -44
@@ -5,11 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var react = require('react');
7
7
 
8
- /*#__NO_SIDE_EFFECTS__*/
9
- const noop = (any) => any;
10
-
11
- let warning = noop;
12
- let invariant = noop;
8
+ let warning = () => { };
9
+ let invariant = () => { };
13
10
  if (process.env.NODE_ENV !== "production") {
14
11
  warning = (check, message) => {
15
12
  if (!check && typeof console !== "undefined") {
@@ -23,6 +20,9 @@ if (process.env.NODE_ENV !== "production") {
23
20
  };
24
21
  }
25
22
 
23
+ /*#__NO_SIDE_EFFECTS__*/
24
+ const noop = (any) => any;
25
+
26
26
  const LayoutGroupContext = react.createContext({});
27
27
 
28
28
  const LazyContext = react.createContext({ strict: false });
@@ -171,6 +171,11 @@ function useMotionRef(visualState, visualElement, externalRef) {
171
171
  [visualElement]);
172
172
  }
173
173
 
174
+ const statsBuffer = {
175
+ value: null,
176
+ addProjectionMetrics: null,
177
+ };
178
+
174
179
  const stepsOrder = [
175
180
  "read", // Read
176
181
  "resolveKeyframes", // Write/Read/Write/Read
@@ -180,11 +185,6 @@ const stepsOrder = [
180
185
  "postRender", // Compute
181
186
  ];
182
187
 
183
- const statsBuffer = {
184
- value: null,
185
- addProjectionMetrics: null,
186
- };
187
-
188
188
  function createRenderStep(runNextFrame, stepName) {
189
189
  /**
190
190
  * We create and reuse two queues, one to queue jobs for the current frame
@@ -363,7 +363,6 @@ const SwitchLayoutGroupContext = react.createContext({});
363
363
  const useIsomorphicLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect;
364
364
 
365
365
  function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
366
- var _a, _b;
367
366
  const { visualElement: parent } = react.useContext(MotionContext);
368
367
  const lazyContext = react.useContext(LazyContext);
369
368
  const presenceContext = react.useContext(PresenceContext);
@@ -413,8 +412,8 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
413
412
  */
414
413
  const optimisedAppearId = props[optimizedAppearDataAttribute];
415
414
  const wantsHandoff = react.useRef(Boolean(optimisedAppearId) &&
416
- !((_a = window.MotionHandoffIsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId)) &&
417
- ((_b = window.MotionHasOptimisedAnimation) === null || _b === void 0 ? void 0 : _b.call(window, optimisedAppearId)));
415
+ !window.MotionHandoffIsComplete?.(optimisedAppearId) &&
416
+ window.MotionHasOptimisedAnimation?.(optimisedAppearId));
418
417
  useIsomorphicLayoutEffect(() => {
419
418
  if (!visualElement)
420
419
  return;
@@ -445,8 +444,7 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
445
444
  if (wantsHandoff.current) {
446
445
  // This ensures all future calls to animateChanges() in this component will run in useEffect
447
446
  queueMicrotask(() => {
448
- var _a;
449
- (_a = window.MotionHandoffMarkAsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId);
447
+ window.MotionHandoffMarkAsComplete?.(optimisedAppearId);
450
448
  });
451
449
  wantsHandoff.current = false;
452
450
  }
@@ -494,7 +492,6 @@ function getClosestProjectingNode(visualElement) {
494
492
  * component "offline", or outside the React render cycle.
495
493
  */
496
494
  function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
497
- var _a, _b;
498
495
  preloadedFeatures && loadFeatures(preloadedFeatures);
499
496
  function MotionComponent(props, externalRef) {
500
497
  /**
@@ -530,7 +527,7 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
530
527
  }
531
528
  MotionComponent.displayName = `motion.${typeof Component === "string"
532
529
  ? Component
533
- : `create(${(_b = (_a = Component.displayName) !== null && _a !== void 0 ? _a : Component.name) !== null && _b !== void 0 ? _b : ""})`}`;
530
+ : `create(${Component.displayName ?? Component.name ?? ""})`}`;
534
531
  const ForwardRefMotionComponent = react.forwardRef(MotionComponent);
535
532
  ForwardRefMotionComponent[motionComponentSymbol] = Component;
536
533
  return ForwardRefMotionComponent;
@@ -562,7 +559,7 @@ function getProjectionFunctionality(props) {
562
559
  return {};
563
560
  const combined = { ...drag, ...layout };
564
561
  return {
565
- MeasureLayout: (drag === null || drag === void 0 ? void 0 : drag.isEnabled(props)) || (layout === null || layout === void 0 ? void 0 : layout.isEnabled(props))
562
+ MeasureLayout: drag?.isEnabled(props) || layout?.isEnabled(props)
566
563
  ? combined.MeasureLayout
567
564
  : undefined,
568
565
  ProjectionNode: combined.ProjectionNode,
@@ -993,7 +990,7 @@ try {
993
990
  */
994
991
  loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
995
992
  }
996
- catch (_a) {
993
+ catch {
997
994
  // We don't need to actually do anything here - the fallback is the existing `isPropValid`.
998
995
  }
999
996
  function filterProps(props, isDom, forwardMotionProps) {
@@ -1222,7 +1219,7 @@ function createUseRender(forwardMotionProps = false) {
1222
1219
 
1223
1220
  function getValueState(visualElement) {
1224
1221
  const state = [{}, {}];
1225
- visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
1222
+ visualElement?.values.forEach((value, key) => {
1226
1223
  state[0][key] = value.get();
1227
1224
  state[1][key] = value.getVelocity();
1228
1225
  });
@@ -1365,7 +1362,6 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
1365
1362
  }
1366
1363
 
1367
1364
  function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
1368
- var _a;
1369
1365
  const { style } = props;
1370
1366
  const newValues = {};
1371
1367
  for (const key in style) {
@@ -1373,7 +1369,7 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
1373
1369
  (prevProps.style &&
1374
1370
  isMotionValue(prevProps.style[key])) ||
1375
1371
  isForcedMotionValue(key, props) ||
1376
- ((_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a === void 0 ? void 0 : _a.liveStyle) !== undefined) {
1372
+ visualElement?.getValue(key)?.liveStyle !== undefined) {
1377
1373
  newValues[key] = style[key];
1378
1374
  }
1379
1375
  }