framer-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 (68) hide show
  1. package/dist/cjs/client.js +1 -1
  2. package/dist/cjs/{create-CTAzqVbr.js → create-B2InJs4e.js} +68 -120
  3. package/dist/cjs/dom-mini.js +14 -219
  4. package/dist/cjs/dom.js +56 -204
  5. package/dist/cjs/index.js +32 -157
  6. package/dist/cjs/m.js +8 -12
  7. package/dist/cjs/mini.js +10 -214
  8. package/dist/dom-mini.d.ts +3 -3
  9. package/dist/dom-mini.js +1 -1
  10. package/dist/dom.d.ts +17 -14
  11. package/dist/dom.js +1 -1
  12. package/dist/es/animation/animate/index.mjs +2 -2
  13. package/dist/es/animation/animators/AcceleratedAnimation.mjs +5 -3
  14. package/dist/es/animation/animators/MainThreadAnimation.mjs +6 -4
  15. package/dist/es/animation/animators/waapi/animate-elements.mjs +10 -9
  16. package/dist/es/animation/animators/waapi/animate-sequence.mjs +2 -2
  17. package/dist/es/animation/animators/waapi/animate-style.mjs +2 -2
  18. package/dist/es/animation/generators/spring/index.mjs +9 -1
  19. package/dist/es/animation/interfaces/motion-value.mjs +2 -2
  20. package/dist/es/animation/interfaces/visual-element-target.mjs +1 -2
  21. package/dist/es/animation/interfaces/visual-element-variant.mjs +1 -2
  22. package/dist/es/animation/optimized-appear/handoff.mjs +2 -4
  23. package/dist/es/animation/optimized-appear/start.mjs +4 -6
  24. package/dist/es/animation/sequence/create.mjs +2 -2
  25. package/dist/es/animation/sequence/utils/calc-time.mjs +1 -2
  26. package/dist/es/components/AnimatePresence/index.mjs +2 -2
  27. package/dist/es/gestures/drag/VisualElementDragControls.mjs +5 -10
  28. package/dist/es/index.mjs +0 -1
  29. package/dist/es/motion/features/animation/index.mjs +1 -2
  30. package/dist/es/motion/index.mjs +2 -3
  31. package/dist/es/motion/utils/use-visual-element.mjs +3 -5
  32. package/dist/es/projection/node/create-projection-node.mjs +17 -25
  33. package/dist/es/projection/styles/transform.mjs +1 -1
  34. package/dist/es/render/VisualElement.mjs +3 -4
  35. package/dist/es/render/dom/DOMKeyframesResolver.mjs +1 -2
  36. package/dist/es/render/dom/resize/handle-element.mjs +5 -6
  37. package/dist/es/render/dom/scroll/track.mjs +1 -2
  38. package/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
  39. package/dist/es/render/dom/utils/filter-props.mjs +1 -1
  40. package/dist/es/render/html/utils/scrape-motion-values.mjs +1 -2
  41. package/dist/es/render/utils/KeyframesResolver.mjs +2 -3
  42. package/dist/es/render/utils/animation-state.mjs +3 -5
  43. package/dist/es/render/utils/motion-values.mjs +1 -1
  44. package/dist/es/render/utils/resolve-variants.mjs +1 -1
  45. package/dist/es/utils/mix/complex.mjs +1 -2
  46. package/dist/es/value/types/complex/index.mjs +2 -3
  47. package/dist/es/value/use-scroll.mjs +2 -2
  48. package/dist/es/value/use-will-change/add-will-change.mjs +0 -6
  49. package/dist/framer-motion.dev.js +445 -420
  50. package/dist/framer-motion.js +1 -1
  51. package/dist/mini.d.ts +1 -1
  52. package/dist/mini.js +1 -1
  53. package/dist/size-rollup-animate.js +1 -1
  54. package/dist/size-rollup-dom-animation-assets.js +1 -1
  55. package/dist/size-rollup-dom-animation-m.js +1 -1
  56. package/dist/size-rollup-dom-animation.js +1 -1
  57. package/dist/size-rollup-dom-max-assets.js +1 -1
  58. package/dist/size-rollup-dom-max.js +1 -1
  59. package/dist/size-rollup-m.js +1 -1
  60. package/dist/size-rollup-motion.js +1 -1
  61. package/dist/size-rollup-scroll.js +1 -1
  62. package/dist/size-rollup-waapi-animate.js +1 -1
  63. package/dist/types/index.d.ts +29 -38
  64. package/package.json +4 -4
  65. package/dist/es/animation/animators/waapi/NativeAnimation.mjs +0 -112
  66. package/dist/es/animation/animators/waapi/index.mjs +0 -32
  67. package/dist/es/animation/animators/waapi/utils/style.mjs +0 -8
  68. package/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +0 -13
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var create = require('./create-CTAzqVbr.js');
5
+ var create = require('./create-B2InJs4e.js');
6
6
  require('motion-dom');
7
7
  require('motion-utils');
8
8
  require('react/jsx-runtime');
@@ -477,11 +477,10 @@ const color = {
477
477
  const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
478
478
 
479
479
  function test(v) {
480
- var _a, _b;
481
480
  return (isNaN(v) &&
482
481
  typeof v === "string" &&
483
- (((_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) +
484
- (((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) >
482
+ (v.match(floatRegex)?.length || 0) +
483
+ (v.match(colorRegex)?.length || 0) >
485
484
  0);
486
485
  }
487
486
  const NUMBER_TOKEN = "number";
@@ -869,8 +868,7 @@ function measureAllKeyframes() {
869
868
  const restore = transformsToRestore.get(element);
870
869
  if (restore) {
871
870
  restore.forEach(([key, value]) => {
872
- var _a;
873
- (_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value);
871
+ element.getValue(key)?.set(value);
874
872
  });
875
873
  }
876
874
  });
@@ -957,7 +955,7 @@ class KeyframeResolver {
957
955
  * If the first keyframe is null, we need to find its value by sampling the element
958
956
  */
959
957
  if (i === 0) {
960
- const currentValue = motionValue === null || motionValue === void 0 ? void 0 : motionValue.get();
958
+ const currentValue = motionValue?.get();
961
959
  const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
962
960
  if (currentValue !== undefined) {
963
961
  unresolvedKeyframes[0] = currentValue;
@@ -1038,7 +1036,7 @@ function parseCSSVariable(current) {
1038
1036
  if (!match)
1039
1037
  return [,];
1040
1038
  const [, token1, token2, fallback] = match;
1041
- return [`--${token1 !== null && token1 !== void 0 ? token1 : token2}`, fallback];
1039
+ return [`--${token1 ?? token2}`, fallback];
1042
1040
  }
1043
1041
  const maxDepth = 4;
1044
1042
  function getVariableValue(current, element, depth = 1) {
@@ -1177,7 +1175,6 @@ class DOMKeyframesResolver extends KeyframeResolver {
1177
1175
  }
1178
1176
  }
1179
1177
  measureEndState() {
1180
- var _a;
1181
1178
  const { element, name, unresolvedKeyframes } = this;
1182
1179
  if (!element || !element.current)
1183
1180
  return;
@@ -1190,7 +1187,7 @@ class DOMKeyframesResolver extends KeyframeResolver {
1190
1187
  this.finalKeyframe = finalKeyframe;
1191
1188
  }
1192
1189
  // If we removed transform values, reapply them before the next render
1193
- if ((_a = this.removedTransforms) === null || _a === void 0 ? void 0 : _a.length) {
1190
+ if (this.removedTransforms?.length) {
1194
1191
  this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
1195
1192
  element
1196
1193
  .getValue(unsetTransformName)
@@ -1546,13 +1543,12 @@ function mixObject(a, b) {
1546
1543
  };
1547
1544
  }
1548
1545
  function matchOrder(origin, target) {
1549
- var _a;
1550
1546
  const orderedOrigin = [];
1551
1547
  const pointers = { color: 0, var: 0, number: 0 };
1552
1548
  for (let i = 0; i < target.values.length; i++) {
1553
1549
  const type = target.types[i];
1554
1550
  const originIndex = origin.indexes[type][pointers[type]];
1555
- const originValue = (_a = origin.values[originIndex]) !== null && _a !== void 0 ? _a : 0;
1551
+ const originValue = origin.values[originIndex] ?? 0;
1556
1552
  orderedOrigin[i] = originValue;
1557
1553
  pointers[type]++;
1558
1554
  }
@@ -1856,9 +1852,17 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
1856
1852
  const easing = motionDom.generateLinearEasing((progress) => generator.next(calculatedDuration * progress).value, calculatedDuration, 30);
1857
1853
  return calculatedDuration + "ms " + easing;
1858
1854
  },
1855
+ toTransition: () => { },
1859
1856
  };
1860
1857
  return generator;
1861
1858
  }
1859
+ spring.applyToOptions = (options) => {
1860
+ const generatorOptions = motionDom.createGeneratorEasing(options, 100, spring);
1861
+ options.ease = motionDom.supportsLinearEasing() ? generatorOptions.ease : "easeOut";
1862
+ options.duration = motionUtils.secondsToMilliseconds(generatorOptions.duration);
1863
+ options.type = "keyframes";
1864
+ return options;
1865
+ };
1862
1866
 
1863
1867
  function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) {
1864
1868
  const origin = keyframes[0];
@@ -2180,7 +2184,7 @@ class MainThreadAnimation extends BaseAnimation {
2180
2184
  onStop && onStop();
2181
2185
  };
2182
2186
  const { name, motionValue, element, keyframes } = this.options;
2183
- const KeyframeResolver$1 = (element === null || element === void 0 ? void 0 : element.KeyframeResolver) || KeyframeResolver;
2187
+ const KeyframeResolver$1 = element?.KeyframeResolver || KeyframeResolver;
2184
2188
  const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
2185
2189
  this.resolver = new KeyframeResolver$1(keyframes, onResolved, name, motionValue, element);
2186
2190
  this.resolver.scheduleResolve();
@@ -2430,7 +2434,7 @@ class MainThreadAnimation extends BaseAnimation {
2430
2434
  this.startTime = now - this.holdTime;
2431
2435
  }
2432
2436
  else if (!this.startTime) {
2433
- this.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
2437
+ this.startTime = startTime ?? this.calcStartTime();
2434
2438
  }
2435
2439
  else if (this.state === "finished") {
2436
2440
  this.startTime = now;
@@ -2448,13 +2452,12 @@ class MainThreadAnimation extends BaseAnimation {
2448
2452
  this.driver.start();
2449
2453
  }
2450
2454
  pause() {
2451
- var _a;
2452
2455
  if (!this._resolved) {
2453
2456
  this.pendingPlayState = "paused";
2454
2457
  return;
2455
2458
  }
2456
2459
  this.state = "paused";
2457
- this.holdTime = (_a = this.currentTime) !== null && _a !== void 0 ? _a : 0;
2460
+ this.holdTime = this.currentTime ?? 0;
2458
2461
  }
2459
2462
  complete() {
2460
2463
  if (this.state !== "running") {
@@ -2495,6 +2498,9 @@ class MainThreadAnimation extends BaseAnimation {
2495
2498
  this.startTime = 0;
2496
2499
  return this.tick(time, true);
2497
2500
  }
2501
+ get finished() {
2502
+ return this.currentFinishedPromise;
2503
+ }
2498
2504
  }
2499
2505
  // Legacy interface
2500
2506
  function animateValue(options) {
@@ -2514,35 +2520,6 @@ const acceleratedValues = new Set([
2514
2520
  // "background-color"
2515
2521
  ]);
2516
2522
 
2517
- function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease = "easeInOut", times, } = {}) {
2518
- const keyframeOptions = { [valueName]: keyframes };
2519
- if (times)
2520
- keyframeOptions.offset = times;
2521
- const easing = motionDom.mapEasingToNativeEasing(ease, duration);
2522
- /**
2523
- * If this is an easing array, apply to keyframes, not animation as a whole
2524
- */
2525
- if (Array.isArray(easing))
2526
- keyframeOptions.easing = easing;
2527
- if (motionDom.statsBuffer.value) {
2528
- motionDom.activeAnimations.waapi++;
2529
- }
2530
- const animation = element.animate(keyframeOptions, {
2531
- delay,
2532
- duration,
2533
- easing: !Array.isArray(easing) ? easing : "linear",
2534
- fill: "both",
2535
- iterations: repeat + 1,
2536
- direction: repeatType === "reverse" ? "alternate" : "normal",
2537
- });
2538
- if (motionDom.statsBuffer.value) {
2539
- animation.finished.finally(() => {
2540
- motionDom.activeAnimations.waapi--;
2541
- });
2542
- }
2543
- return animation;
2544
- }
2545
-
2546
2523
  const supportsWaapi = /*@__PURE__*/ motionUtils.memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
2547
2524
 
2548
2525
  /**
@@ -2650,10 +2627,10 @@ class AcceleratedAnimation extends BaseAnimation {
2650
2627
  ease = pregeneratedAnimation.ease;
2651
2628
  type = "keyframes";
2652
2629
  }
2653
- const animation = startWaapiAnimation(motionValue.owner.current, name, keyframes, { ...this.options, duration, times, ease });
2630
+ const animation = motionDom.startWaapiAnimation(motionValue.owner.current, name, keyframes, { ...this.options, duration, times, ease });
2654
2631
  // Override the browser calculated startTime with one synchronised to other JS
2655
2632
  // and WAAPI animations starting this event loop.
2656
- animation.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
2633
+ animation.startTime = startTime ?? this.calcStartTime();
2657
2634
  if (this.pendingTimeline) {
2658
2635
  motionDom.attachTimeline(animation, this.pendingTimeline);
2659
2636
  this.pendingTimeline = undefined;
@@ -2712,6 +2689,9 @@ class AcceleratedAnimation extends BaseAnimation {
2712
2689
  const { animation } = resolved;
2713
2690
  return animation.playbackRate;
2714
2691
  }
2692
+ get finished() {
2693
+ return this.resolved.animation.finished;
2694
+ }
2715
2695
  set speed(newSpeed) {
2716
2696
  const { resolved } = this;
2717
2697
  if (!resolved)
@@ -2983,7 +2963,7 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
2983
2963
  });
2984
2964
  // We still want to return some animation controls here rather
2985
2965
  // than returning undefined
2986
- return new motionDom.GroupPlaybackControls([]);
2966
+ return new motionDom.GroupAnimationWithThen([]);
2987
2967
  }
2988
2968
  }
2989
2969
  /**
@@ -3561,7 +3541,7 @@ function buildProjectionTransform(delta, treeScale, latestTransform) {
3561
3541
  */
3562
3542
  const xTranslate = delta.x.translate / treeScale.x;
3563
3543
  const yTranslate = delta.y.translate / treeScale.y;
3564
- const zTranslate = (latestTransform === null || latestTransform === void 0 ? void 0 : latestTransform.z) || 0;
3544
+ const zTranslate = latestTransform?.z || 0;
3565
3545
  if (xTranslate || yTranslate || zTranslate) {
3566
3546
  transform = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `;
3567
3547
  }
@@ -3664,7 +3644,7 @@ function cancelTreeOptimisedTransformAnimations(projectionNode) {
3664
3644
  }
3665
3645
  function createProjectionNode$1({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {
3666
3646
  return class ProjectionNode {
3667
- constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
3647
+ constructor(latestValues = {}, parent = defaultParent?.()) {
3668
3648
  /**
3669
3649
  * A unique ID generated for every projection node.
3670
3650
  */
@@ -4195,12 +4175,11 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4195
4175
  };
4196
4176
  }
4197
4177
  measurePageBox() {
4198
- var _a;
4199
4178
  const { visualElement } = this.options;
4200
4179
  if (!visualElement)
4201
4180
  return createBox();
4202
4181
  const box = visualElement.measureViewportBox();
4203
- const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) || this.path.some(checkNodeWasScrollRoot);
4182
+ const wasInScrollRoot = this.scroll?.wasRoot || this.path.some(checkNodeWasScrollRoot);
4204
4183
  if (!wasInScrollRoot) {
4205
4184
  // Remove viewport scroll to give page-relative coordinates
4206
4185
  const { scroll } = this.root;
@@ -4212,10 +4191,9 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4212
4191
  return box;
4213
4192
  }
4214
4193
  removeElementScroll(box) {
4215
- var _a;
4216
4194
  const boxWithoutScroll = createBox();
4217
4195
  copyBoxInto(boxWithoutScroll, box);
4218
- if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
4196
+ if (this.scroll?.wasRoot) {
4219
4197
  return boxWithoutScroll;
4220
4198
  }
4221
4199
  /**
@@ -4318,7 +4296,6 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4318
4296
  }
4319
4297
  }
4320
4298
  resolveTargetDelta(forceRecalculation = false) {
4321
- var _a;
4322
4299
  /**
4323
4300
  * Once the dirty status of nodes has been spread through the tree, we also
4324
4301
  * need to check if we have a shared node of a different depth that has itself
@@ -4336,7 +4313,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4336
4313
  const canSkip = !(forceRecalculation ||
4337
4314
  (isShared && this.isSharedProjectionDirty) ||
4338
4315
  this.isProjectionDirty ||
4339
- ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
4316
+ this.parent?.isProjectionDirty ||
4340
4317
  this.attemptToResolveRelativeTarget ||
4341
4318
  this.root.updateBlockedByResize);
4342
4319
  if (canSkip)
@@ -4461,7 +4438,6 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4461
4438
  this.layout);
4462
4439
  }
4463
4440
  calcProjection() {
4464
- var _a;
4465
4441
  const lead = this.getLead();
4466
4442
  const isShared = Boolean(this.resumingFrom) || this !== lead;
4467
4443
  let canSkip = true;
@@ -4469,7 +4445,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4469
4445
  * If this is a normal layout animation and neither this node nor its nearest projecting
4470
4446
  * is dirty then we can't skip.
4471
4447
  */
4472
- if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) {
4448
+ if (this.isProjectionDirty || this.parent?.isProjectionDirty) {
4473
4449
  canSkip = false;
4474
4450
  }
4475
4451
  /**
@@ -4581,8 +4557,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4581
4557
  // TODO: Schedule render
4582
4558
  }
4583
4559
  scheduleRender(notifyAll = true) {
4584
- var _a;
4585
- (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.scheduleRender();
4560
+ this.options.visualElement?.scheduleRender();
4586
4561
  if (notifyAll) {
4587
4562
  const stack = this.getStack();
4588
4563
  stack && stack.scheduleRender();
@@ -4769,14 +4744,12 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4769
4744
  return stack ? stack.lead === this : true;
4770
4745
  }
4771
4746
  getLead() {
4772
- var _a;
4773
4747
  const { layoutId } = this.options;
4774
- return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
4748
+ return layoutId ? this.getStack()?.lead || this : this;
4775
4749
  }
4776
4750
  getPrevLead() {
4777
- var _a;
4778
4751
  const { layoutId } = this.options;
4779
- return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : undefined;
4752
+ return layoutId ? this.getStack()?.prevLead : undefined;
4780
4753
  }
4781
4754
  getStack() {
4782
4755
  const { layoutId } = this.options;
@@ -4850,7 +4823,6 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4850
4823
  visualElement.scheduleRender();
4851
4824
  }
4852
4825
  getProjectionStyles(styleProp) {
4853
- var _a, _b;
4854
4826
  if (!this.instance || this.isSVG)
4855
4827
  return undefined;
4856
4828
  if (!this.isVisible) {
@@ -4864,7 +4836,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4864
4836
  this.needsReset = false;
4865
4837
  styles.opacity = "";
4866
4838
  styles.pointerEvents =
4867
- resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
4839
+ resolveMotionValue(styleProp?.pointerEvents) || "";
4868
4840
  styles.transform = transformTemplate
4869
4841
  ? transformTemplate(this.latestValues, "")
4870
4842
  : "none";
@@ -4879,7 +4851,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4879
4851
  ? this.latestValues.opacity
4880
4852
  : 1;
4881
4853
  emptyStyles.pointerEvents =
4882
- resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
4854
+ resolveMotionValue(styleProp?.pointerEvents) || "";
4883
4855
  }
4884
4856
  if (this.hasProjected && !hasTransform(this.latestValues)) {
4885
4857
  emptyStyles.transform = transformTemplate
@@ -4904,7 +4876,9 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4904
4876
  */
4905
4877
  styles.opacity =
4906
4878
  lead === this
4907
- ? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1
4879
+ ? valuesToRender.opacity ??
4880
+ this.latestValues.opacity ??
4881
+ 1
4908
4882
  : this.preserveOpacity
4909
4883
  ? this.latestValues.opacity
4910
4884
  : valuesToRender.opacityExit;
@@ -4965,7 +4939,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4965
4939
  if (this.options.layoutId) {
4966
4940
  styles.pointerEvents =
4967
4941
  lead === this
4968
- ? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || ""
4942
+ ? resolveMotionValue(styleProp?.pointerEvents) || ""
4969
4943
  : "none";
4970
4944
  }
4971
4945
  return styles;
@@ -4975,7 +4949,7 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
4975
4949
  }
4976
4950
  // Only run on root
4977
4951
  resetTree() {
4978
- this.root.nodes.forEach((node) => { var _a; return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop(); });
4952
+ this.root.nodes.forEach((node) => node.currentAnimation?.stop());
4979
4953
  this.root.nodes.forEach(clearMeasurements);
4980
4954
  this.root.sharedNodes.clear();
4981
4955
  }
@@ -4985,8 +4959,7 @@ function updateLayout(node) {
4985
4959
  node.updateLayout();
4986
4960
  }
4987
4961
  function notifyLayoutUpdate(node) {
4988
- var _a;
4989
- const snapshot = ((_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node.snapshot;
4962
+ const snapshot = node.resumeFrom?.snapshot || node.snapshot;
4990
4963
  if (node.isLead() &&
4991
4964
  node.layout &&
4992
4965
  snapshot &&
@@ -5192,8 +5165,7 @@ function shouldAnimatePositionOnly(animationType, snapshot, layout) {
5192
5165
  !isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2)));
5193
5166
  }
5194
5167
  function checkNodeWasScrollRoot(node) {
5195
- var _a;
5196
- return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
5168
+ return node !== node.root && node.scroll?.wasRoot;
5197
5169
  }
5198
5170
 
5199
5171
  function addDomEvent(target, eventName, handler, options = { passive: true }) {
@@ -5451,7 +5423,7 @@ function updateMotionValuesFromProps(element, next, prev) {
5451
5423
  * and warn against mismatches.
5452
5424
  */
5453
5425
  if (process.env.NODE_ENV === "development") {
5454
- motionUtils.warnOnce(nextValue.version === "12.6.3-alpha.0", `Attempting to mix Motion versions ${nextValue.version} with 12.6.3-alpha.0 may not work as expected.`);
5426
+ motionUtils.warnOnce(nextValue.version === "12.6.3", `Attempting to mix Motion versions ${nextValue.version} with 12.6.3 may not work as expected.`);
5455
5427
  }
5456
5428
  }
5457
5429
  else if (isMotionValue(prevValue)) {
@@ -5492,7 +5464,7 @@ function updateMotionValuesFromProps(element, next, prev) {
5492
5464
 
5493
5465
  function getValueState(visualElement) {
5494
5466
  const state = [{}, {}];
5495
- visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
5467
+ visualElement?.values.forEach((value, key) => {
5496
5468
  state[0][key] = value.get();
5497
5469
  state[1][key] = value.getVelocity();
5498
5470
  });
@@ -5910,10 +5882,10 @@ class VisualElement {
5910
5882
  * directly from the instance (which might have performance implications).
5911
5883
  */
5912
5884
  readValue(key, target) {
5913
- var _a;
5914
5885
  let value = this.latestValues[key] !== undefined || !this.current
5915
5886
  ? this.latestValues[key]
5916
- : (_a = this.getBaseTargetFromProps(this.props, key)) !== null && _a !== void 0 ? _a : this.readValueFromInstance(this.current, key, this.options);
5887
+ : this.getBaseTargetFromProps(this.props, key) ??
5888
+ this.readValueFromInstance(this.current, key, this.options);
5917
5889
  if (value !== undefined && value !== null) {
5918
5890
  if (typeof value === "string" &&
5919
5891
  (isNumericalString(value) || isZeroValueString(value))) {
@@ -5939,11 +5911,10 @@ class VisualElement {
5939
5911
  * props.
5940
5912
  */
5941
5913
  getBaseTarget(key) {
5942
- var _a;
5943
5914
  const { initial } = this.props;
5944
5915
  let valueFromInitial;
5945
5916
  if (typeof initial === "string" || typeof initial === "object") {
5946
- const variant = resolveVariantFromProps(this.props, initial, (_a = this.presenceContext) === null || _a === void 0 ? void 0 : _a.custom);
5917
+ const variant = resolveVariantFromProps(this.props, initial, this.presenceContext?.custom);
5947
5918
  if (variant) {
5948
5919
  valueFromInitial = variant[key];
5949
5920
  }
@@ -6161,7 +6132,6 @@ function isForcedMotionValue(key, { layout, layoutId }) {
6161
6132
  }
6162
6133
 
6163
6134
  function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
6164
- var _a;
6165
6135
  const { style } = props;
6166
6136
  const newValues = {};
6167
6137
  for (const key in style) {
@@ -6169,7 +6139,7 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
6169
6139
  (prevProps.style &&
6170
6140
  isMotionValue(prevProps.style[key])) ||
6171
6141
  isForcedMotionValue(key, props) ||
6172
- ((_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a === void 0 ? void 0 : _a.liveStyle) !== undefined) {
6142
+ visualElement?.getValue(key)?.liveStyle !== undefined) {
6173
6143
  newValues[key] = style[key];
6174
6144
  }
6175
6145
  }
@@ -6303,7 +6273,7 @@ try {
6303
6273
  */
6304
6274
  loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
6305
6275
  }
6306
- catch (_a) {
6276
+ catch {
6307
6277
  // We don't need to actually do anything here - the fallback is the existing `isPropValid`.
6308
6278
  }
6309
6279
  function filterProps(props, isDom, forwardMotionProps) {
@@ -6371,11 +6341,6 @@ function addValueToWillChange(visualElement, key) {
6371
6341
  if (isWillChangeMotionValue(willChange)) {
6372
6342
  return willChange.add(key);
6373
6343
  }
6374
- else if (!willChange && motionUtils.MotionGlobalConfig.WillChange) {
6375
- const newWillChange = new motionUtils.MotionGlobalConfig.WillChange("auto");
6376
- visualElement.addValue("willChange", newWillChange);
6377
- newWillChange.add(key);
6378
- }
6379
6344
  }
6380
6345
 
6381
6346
  /**
@@ -6390,7 +6355,6 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
6390
6355
  return shouldBlock;
6391
6356
  }
6392
6357
  function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {
6393
- var _a;
6394
6358
  let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
6395
6359
  if (transitionOverride)
6396
6360
  transition = transitionOverride;
@@ -6399,7 +6363,7 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
6399
6363
  visualElement.animationState &&
6400
6364
  visualElement.animationState.getState()[type];
6401
6365
  for (const key in target) {
6402
- const value = visualElement.getValue(key, (_a = visualElement.latestValues[key]) !== null && _a !== void 0 ? _a : null);
6366
+ const value = visualElement.getValue(key, visualElement.latestValues[key] ?? null);
6403
6367
  const valueTarget = target[key];
6404
6368
  if (valueTarget === undefined ||
6405
6369
  (animationTypeState &&
@@ -6445,9 +6409,8 @@ function animateTarget(visualElement, targetAndTransition, { delay = 0, transiti
6445
6409
  }
6446
6410
 
6447
6411
  function animateVariant(visualElement, variant, options = {}) {
6448
- var _a;
6449
6412
  const resolved = resolveVariant(visualElement, variant, options.type === "exit"
6450
- ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom
6413
+ ? visualElement.presenceContext?.custom
6451
6414
  : undefined);
6452
6415
  let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
6453
6416
  if (options.transitionOverride) {
@@ -6578,9 +6541,8 @@ function createAnimationState(visualElement) {
6578
6541
  * each active animation type into an object of resolved values for it.
6579
6542
  */
6580
6543
  const buildResolvedTypeValues = (type) => (acc, definition) => {
6581
- var _a;
6582
6544
  const resolved = resolveVariant(visualElement, definition, type === "exit"
6583
- ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom
6545
+ ? visualElement.presenceContext?.custom
6584
6546
  : undefined);
6585
6547
  if (resolved) {
6586
6548
  const { transition, transitionEnd, ...target } = resolved;
@@ -6828,7 +6790,7 @@ function createAnimationState(visualElement) {
6828
6790
  if (motionValue)
6829
6791
  motionValue.liveStyle = true;
6830
6792
  // @ts-expect-error - @mattgperry to figure if we should do something here
6831
- fallbackAnimation[key] = fallbackTarget !== null && fallbackTarget !== void 0 ? fallbackTarget : null;
6793
+ fallbackAnimation[key] = fallbackTarget ?? null;
6832
6794
  });
6833
6795
  animations.push({ animation: fallbackAnimation });
6834
6796
  }
@@ -6845,12 +6807,11 @@ function createAnimationState(visualElement) {
6845
6807
  * Change whether a certain animation type is active.
6846
6808
  */
6847
6809
  function setActive(type, isActive) {
6848
- var _a;
6849
6810
  // If the active state hasn't changed, we can safely do nothing here
6850
6811
  if (state[type].isActive === isActive)
6851
6812
  return Promise.resolve();
6852
6813
  // Propagate active change to children
6853
- (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach((child) => { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
6814
+ visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive));
6854
6815
  state[type].isActive = isActive;
6855
6816
  const animations = animateChanges(type);
6856
6817
  for (const key in state) {
@@ -6936,9 +6897,8 @@ class AnimationFeature extends Feature {
6936
6897
  }
6937
6898
  }
6938
6899
  unmount() {
6939
- var _a;
6940
6900
  this.node.animationState.reset();
6941
- (_a = this.unmountControls) === null || _a === void 0 ? void 0 : _a.call(this);
6901
+ this.unmountControls?.();
6942
6902
  }
6943
6903
  }
6944
6904
 
@@ -7406,11 +7366,8 @@ class VisualElementDragControls {
7406
7366
  onDrag && onDrag(event, info);
7407
7367
  };
7408
7368
  const onSessionEnd = (event, info) => this.stop(event, info);
7409
- const resumeAnimation = () => eachAxis((axis) => {
7410
- var _a;
7411
- return this.getAnimationState(axis) === "paused" &&
7412
- ((_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.play());
7413
- });
7369
+ const resumeAnimation = () => eachAxis((axis) => this.getAnimationState(axis) === "paused" &&
7370
+ this.getAxisMotionValue(axis).animation?.play());
7414
7371
  const { dragSnapToOrigin } = this.getProps();
7415
7372
  this.panSession = new PanSession(originEvent, {
7416
7373
  onSessionStart,
@@ -7465,12 +7422,11 @@ class VisualElementDragControls {
7465
7422
  axisValue.set(next);
7466
7423
  }
7467
7424
  resolveConstraints() {
7468
- var _a;
7469
7425
  const { dragConstraints, dragElastic } = this.getProps();
7470
7426
  const layout = this.visualElement.projection &&
7471
7427
  !this.visualElement.projection.layout
7472
7428
  ? this.visualElement.projection.measure(false)
7473
- : (_a = this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout;
7429
+ : this.visualElement.projection?.layout;
7474
7430
  const prevConstraints = this.constraints;
7475
7431
  if (dragConstraints && isRefObject(dragConstraints)) {
7476
7432
  if (!this.constraints) {
@@ -7573,11 +7529,10 @@ class VisualElementDragControls {
7573
7529
  eachAxis((axis) => this.getAxisMotionValue(axis).stop());
7574
7530
  }
7575
7531
  pauseAnimation() {
7576
- eachAxis((axis) => { var _a; return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.pause(); });
7532
+ eachAxis((axis) => this.getAxisMotionValue(axis).animation?.pause());
7577
7533
  }
7578
7534
  getAnimationState(axis) {
7579
- var _a;
7580
- return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.state;
7535
+ return this.getAxisMotionValue(axis).animation?.state;
7581
7536
  }
7582
7537
  /**
7583
7538
  * Drag works differently depending on which props are provided.
@@ -8238,7 +8193,6 @@ function useMotionRef(visualState, visualElement, externalRef) {
8238
8193
  }
8239
8194
 
8240
8195
  function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
8241
- var _a, _b;
8242
8196
  const { visualElement: parent } = React.useContext(MotionContext);
8243
8197
  const lazyContext = React.useContext(LazyContext);
8244
8198
  const presenceContext = React.useContext(PresenceContext);
@@ -8288,8 +8242,8 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
8288
8242
  */
8289
8243
  const optimisedAppearId = props[optimizedAppearDataAttribute];
8290
8244
  const wantsHandoff = React.useRef(Boolean(optimisedAppearId) &&
8291
- !((_a = window.MotionHandoffIsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId)) &&
8292
- ((_b = window.MotionHasOptimisedAnimation) === null || _b === void 0 ? void 0 : _b.call(window, optimisedAppearId)));
8245
+ !window.MotionHandoffIsComplete?.(optimisedAppearId) &&
8246
+ window.MotionHasOptimisedAnimation?.(optimisedAppearId));
8293
8247
  useIsomorphicLayoutEffect(() => {
8294
8248
  if (!visualElement)
8295
8249
  return;
@@ -8320,8 +8274,7 @@ function useVisualElement(Component, visualState, props, createVisualElement, Pr
8320
8274
  if (wantsHandoff.current) {
8321
8275
  // This ensures all future calls to animateChanges() in this component will run in useEffect
8322
8276
  queueMicrotask(() => {
8323
- var _a;
8324
- (_a = window.MotionHandoffMarkAsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId);
8277
+ window.MotionHandoffMarkAsComplete?.(optimisedAppearId);
8325
8278
  });
8326
8279
  wantsHandoff.current = false;
8327
8280
  }
@@ -8369,7 +8322,6 @@ function getClosestProjectingNode(visualElement) {
8369
8322
  * component "offline", or outside the React render cycle.
8370
8323
  */
8371
8324
  function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
8372
- var _a, _b;
8373
8325
  preloadedFeatures && loadFeatures(preloadedFeatures);
8374
8326
  function MotionComponent(props, externalRef) {
8375
8327
  /**
@@ -8405,7 +8357,7 @@ function createRendererMotionComponent({ preloadedFeatures, createVisualElement,
8405
8357
  }
8406
8358
  MotionComponent.displayName = `motion.${typeof Component === "string"
8407
8359
  ? Component
8408
- : `create(${(_b = (_a = Component.displayName) !== null && _a !== void 0 ? _a : Component.name) !== null && _b !== void 0 ? _b : ""})`}`;
8360
+ : `create(${Component.displayName ?? Component.name ?? ""})`}`;
8409
8361
  const ForwardRefMotionComponent = React.forwardRef(MotionComponent);
8410
8362
  ForwardRefMotionComponent[motionComponentSymbol] = Component;
8411
8363
  return ForwardRefMotionComponent;
@@ -8437,7 +8389,7 @@ function getProjectionFunctionality(props) {
8437
8389
  return {};
8438
8390
  const combined = { ...drag, ...layout };
8439
8391
  return {
8440
- MeasureLayout: (drag === null || drag === void 0 ? void 0 : drag.isEnabled(props)) || (layout === null || layout === void 0 ? void 0 : layout.isEnabled(props))
8392
+ MeasureLayout: drag?.isEnabled(props) || layout?.isEnabled(props)
8441
8393
  ? combined.MeasureLayout
8442
8394
  : undefined,
8443
8395
  ProjectionNode: combined.ProjectionNode,
@@ -8998,7 +8950,6 @@ exports.anticipate = anticipate;
8998
8950
  exports.backIn = backIn;
8999
8951
  exports.backInOut = backInOut;
9000
8952
  exports.backOut = backOut;
9001
- exports.browserNumberValueTypes = browserNumberValueTypes;
9002
8953
  exports.buildTransform = buildTransform;
9003
8954
  exports.calcLength = calcLength;
9004
8955
  exports.camelToDash = camelToDash;
@@ -9027,7 +8978,6 @@ exports.fillOffset = fillOffset;
9027
8978
  exports.filterProps = filterProps;
9028
8979
  exports.findSpring = findSpring;
9029
8980
  exports.gestureAnimations = gestureAnimations;
9030
- exports.getFinalKeyframe = getFinalKeyframe;
9031
8981
  exports.getOptimisedAppearId = getOptimisedAppearId;
9032
8982
  exports.hasReducedMotionListener = hasReducedMotionListener;
9033
8983
  exports.inertia = inertia;
@@ -9058,8 +9008,6 @@ exports.reverseEasing = reverseEasing;
9058
9008
  exports.rootProjectionNode = rootProjectionNode;
9059
9009
  exports.setTarget = setTarget;
9060
9010
  exports.spring = spring;
9061
- exports.startWaapiAnimation = startWaapiAnimation;
9062
- exports.supportsWaapi = supportsWaapi;
9063
9011
  exports.transformProps = transformProps;
9064
9012
  exports.useConstant = useConstant;
9065
9013
  exports.useIsPresent = useIsPresent;