framer-motion 12.4.7 → 12.4.9

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.
@@ -1106,7 +1106,7 @@
1106
1106
  * This will be replaced by the build step with the latest version number.
1107
1107
  * When MotionValues are provided to motion components, warn if versions are mixed.
1108
1108
  */
1109
- this.version = "12.4.7";
1109
+ this.version = "12.4.9";
1110
1110
  /**
1111
1111
  * Tracks whether this value can output a velocity. Currently this is only true
1112
1112
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -5958,7 +5958,7 @@
5958
5958
  * and warn against mismatches.
5959
5959
  */
5960
5960
  {
5961
- warnOnce(nextValue.version === "12.4.7", `Attempting to mix Motion versions ${nextValue.version} with 12.4.7 may not work as expected.`);
5961
+ warnOnce(nextValue.version === "12.4.9", `Attempting to mix Motion versions ${nextValue.version} with 12.4.9 may not work as expected.`);
5962
5962
  }
5963
5963
  }
5964
5964
  else if (isMotionValue(prevValue)) {
@@ -10331,6 +10331,7 @@
10331
10331
  onMove && onMove(this.lastMoveEvent, info);
10332
10332
  };
10333
10333
  this.handlePointerMove = (event, info) => {
10334
+ this.index = getElementIndex(event.currentTarget);
10334
10335
  if (event.target instanceof Element &&
10335
10336
  event.target.hasPointerCapture &&
10336
10337
  event.pointerId !== undefined) {
@@ -10378,7 +10379,19 @@
10378
10379
  onSessionStart &&
10379
10380
  onSessionStart(event, getPanInfo(initialInfo, this.history));
10380
10381
  capturePointer(event, "set");
10381
- this.removeListeners = pipe(addPointerEvent(event.currentTarget, "pointermove", this.handlePointerMove), addPointerEvent(event.currentTarget, "pointerup", this.handlePointerUp), addPointerEvent(event.currentTarget, "pointercancel", this.handlePointerUp), addPointerEvent(event.currentTarget, "lostpointercapture", this.handlePointerUp));
10382
+ this.removeListeners = pipe(addPointerEvent(event.currentTarget, "pointermove", this.handlePointerMove), addPointerEvent(event.currentTarget, "pointerup", this.handlePointerUp), addPointerEvent(event.currentTarget, "pointercancel", this.handlePointerUp), addPointerEvent(event.currentTarget, "lostpointercapture", (lostPointerEvent, lostPointerInfo) => {
10383
+ const index = getElementIndex(lostPointerEvent.currentTarget);
10384
+ /**
10385
+ * If the pointer has lost capture because it's moved in the DOM
10386
+ * then we need to re-capture it.
10387
+ */
10388
+ if (index !== this.index) {
10389
+ capturePointer(lostPointerEvent, "set");
10390
+ }
10391
+ else {
10392
+ this.handlePointerUp(lostPointerEvent, lostPointerInfo);
10393
+ }
10394
+ }));
10382
10395
  }
10383
10396
  updateHandlers(handlers) {
10384
10397
  this.handlers = handlers;
@@ -10442,6 +10455,11 @@
10442
10455
  }
10443
10456
  return currentVelocity;
10444
10457
  }
10458
+ function getElementIndex(element) {
10459
+ if (!element.parentNode)
10460
+ return -1;
10461
+ return Array.from(element.parentNode.children).indexOf(element);
10462
+ }
10445
10463
 
10446
10464
  /**
10447
10465
  * Apply constraints to a point. These constraints are both physical along an
@@ -11138,7 +11156,8 @@
11138
11156
  projection.isPresent = isPresent;
11139
11157
  if (drag ||
11140
11158
  prevProps.layoutDependency !== layoutDependency ||
11141
- layoutDependency === undefined) {
11159
+ layoutDependency === undefined ||
11160
+ prevProps.isPresent !== isPresent) {
11142
11161
  projection.willUpdate();
11143
11162
  }
11144
11163
  else {