framer-motion 12.24.10 → 12.24.12
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.
- package/dist/cjs/client.js +1 -1
- package/dist/cjs/{feature-bundle-OJqyiRBo.js → feature-bundle-W9TOG4_M.js} +103 -4
- package/dist/cjs/{feature-bundle-OJqyiRBo.js.map → feature-bundle-W9TOG4_M.js.map} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/dom-mini.js +1 -1
- package/dist/dom.js +1 -1
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +1 -0
- package/dist/es/gestures/drag/VisualElementDragControls.mjs.map +1 -1
- package/dist/es/gestures/pan/PanSession.mjs +99 -1
- package/dist/es/gestures/pan/PanSession.mjs.map +1 -1
- package/dist/framer-motion.dev.js +119 -6
- package/dist/framer-motion.js +1 -1
- package/dist/mini.js +1 -1
- package/dist/size-rollup-animate.js +1 -1
- package/dist/size-rollup-animate.js.map +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-rollup-motion.js.map +1 -1
- package/dist/size-rollup-waapi-animate.js +1 -1
- package/dist/size-rollup-waapi-animate.js.map +1 -1
- package/package.json +3 -3
package/dist/cjs/client.js
CHANGED
|
@@ -3494,7 +3494,7 @@ function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
|
3494
3494
|
return newValues;
|
|
3495
3495
|
}
|
|
3496
3496
|
|
|
3497
|
-
function getComputedStyle(element) {
|
|
3497
|
+
function getComputedStyle$1(element) {
|
|
3498
3498
|
return window.getComputedStyle(element);
|
|
3499
3499
|
}
|
|
3500
3500
|
class HTMLVisualElement extends DOMVisualElement {
|
|
@@ -3510,7 +3510,7 @@ class HTMLVisualElement extends DOMVisualElement {
|
|
|
3510
3510
|
: motionDom.readTransformValue(instance, key);
|
|
3511
3511
|
}
|
|
3512
3512
|
else {
|
|
3513
|
-
const computedStyle = getComputedStyle(instance);
|
|
3513
|
+
const computedStyle = getComputedStyle$1(instance);
|
|
3514
3514
|
const value = (motionDom.isCSSVariableName(key)
|
|
3515
3515
|
? computedStyle.getPropertyValue(key)
|
|
3516
3516
|
: computedStyle[key]) || 0;
|
|
@@ -5105,11 +5105,12 @@ function distance2D(a, b) {
|
|
|
5105
5105
|
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
|
|
5106
5106
|
}
|
|
5107
5107
|
|
|
5108
|
+
const overflowStyles = /*#__PURE__*/ new Set(["auto", "scroll"]);
|
|
5108
5109
|
/**
|
|
5109
5110
|
* @internal
|
|
5110
5111
|
*/
|
|
5111
5112
|
class PanSession {
|
|
5112
|
-
constructor(event, handlers, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3, } = {}) {
|
|
5113
|
+
constructor(event, handlers, { transformPagePoint, contextWindow = window, dragSnapToOrigin = false, distanceThreshold = 3, element, } = {}) {
|
|
5113
5114
|
/**
|
|
5114
5115
|
* @internal
|
|
5115
5116
|
*/
|
|
@@ -5130,6 +5131,22 @@ class PanSession {
|
|
|
5130
5131
|
* @internal
|
|
5131
5132
|
*/
|
|
5132
5133
|
this.contextWindow = window;
|
|
5134
|
+
/**
|
|
5135
|
+
* Scroll positions of scrollable ancestors and window.
|
|
5136
|
+
* @internal
|
|
5137
|
+
*/
|
|
5138
|
+
this.scrollPositions = new Map();
|
|
5139
|
+
/**
|
|
5140
|
+
* Cleanup function for scroll listeners.
|
|
5141
|
+
* @internal
|
|
5142
|
+
*/
|
|
5143
|
+
this.removeScrollListeners = null;
|
|
5144
|
+
this.onElementScroll = (event) => {
|
|
5145
|
+
this.handleScroll(event.target);
|
|
5146
|
+
};
|
|
5147
|
+
this.onWindowScroll = () => {
|
|
5148
|
+
this.handleScroll(window);
|
|
5149
|
+
};
|
|
5133
5150
|
this.updatePoint = () => {
|
|
5134
5151
|
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
5135
5152
|
return;
|
|
@@ -5192,12 +5209,93 @@ class PanSession {
|
|
|
5192
5209
|
onSessionStart &&
|
|
5193
5210
|
onSessionStart(event, getPanInfo(initialInfo, this.history));
|
|
5194
5211
|
this.removeListeners = motionUtils.pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp));
|
|
5212
|
+
// Start scroll tracking if element provided
|
|
5213
|
+
if (element) {
|
|
5214
|
+
this.startScrollTracking(element);
|
|
5215
|
+
}
|
|
5216
|
+
}
|
|
5217
|
+
/**
|
|
5218
|
+
* Start tracking scroll on ancestors and window.
|
|
5219
|
+
*/
|
|
5220
|
+
startScrollTracking(element) {
|
|
5221
|
+
// Store initial scroll positions for scrollable ancestors
|
|
5222
|
+
let current = element.parentElement;
|
|
5223
|
+
while (current) {
|
|
5224
|
+
const style = getComputedStyle(current);
|
|
5225
|
+
if (overflowStyles.has(style.overflowX) ||
|
|
5226
|
+
overflowStyles.has(style.overflowY)) {
|
|
5227
|
+
this.scrollPositions.set(current, {
|
|
5228
|
+
x: current.scrollLeft,
|
|
5229
|
+
y: current.scrollTop,
|
|
5230
|
+
});
|
|
5231
|
+
}
|
|
5232
|
+
current = current.parentElement;
|
|
5233
|
+
}
|
|
5234
|
+
// Track window scroll
|
|
5235
|
+
this.scrollPositions.set(window, {
|
|
5236
|
+
x: window.scrollX,
|
|
5237
|
+
y: window.scrollY,
|
|
5238
|
+
});
|
|
5239
|
+
// Capture listener catches element scroll events as they bubble
|
|
5240
|
+
window.addEventListener("scroll", this.onElementScroll, {
|
|
5241
|
+
capture: true,
|
|
5242
|
+
passive: true,
|
|
5243
|
+
});
|
|
5244
|
+
// Direct window scroll listener (window scroll doesn't bubble)
|
|
5245
|
+
window.addEventListener("scroll", this.onWindowScroll, {
|
|
5246
|
+
passive: true,
|
|
5247
|
+
});
|
|
5248
|
+
this.removeScrollListeners = () => {
|
|
5249
|
+
window.removeEventListener("scroll", this.onElementScroll, {
|
|
5250
|
+
capture: true,
|
|
5251
|
+
});
|
|
5252
|
+
window.removeEventListener("scroll", this.onWindowScroll);
|
|
5253
|
+
};
|
|
5254
|
+
}
|
|
5255
|
+
/**
|
|
5256
|
+
* Handle scroll compensation during drag.
|
|
5257
|
+
*
|
|
5258
|
+
* For element scroll: adjusts history origin since pageX/pageY doesn't change.
|
|
5259
|
+
* For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.
|
|
5260
|
+
*/
|
|
5261
|
+
handleScroll(target) {
|
|
5262
|
+
const initial = this.scrollPositions.get(target);
|
|
5263
|
+
if (!initial)
|
|
5264
|
+
return;
|
|
5265
|
+
const isWindow = target === window;
|
|
5266
|
+
const current = isWindow
|
|
5267
|
+
? { x: window.scrollX, y: window.scrollY }
|
|
5268
|
+
: {
|
|
5269
|
+
x: target.scrollLeft,
|
|
5270
|
+
y: target.scrollTop,
|
|
5271
|
+
};
|
|
5272
|
+
const delta = { x: current.x - initial.x, y: current.y - initial.y };
|
|
5273
|
+
if (delta.x === 0 && delta.y === 0)
|
|
5274
|
+
return;
|
|
5275
|
+
if (isWindow) {
|
|
5276
|
+
// Window scroll: pageX/pageY changes, so update lastMoveEventInfo
|
|
5277
|
+
if (this.lastMoveEventInfo) {
|
|
5278
|
+
this.lastMoveEventInfo.point.x += delta.x;
|
|
5279
|
+
this.lastMoveEventInfo.point.y += delta.y;
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5282
|
+
else {
|
|
5283
|
+
// Element scroll: pageX/pageY unchanged, so adjust history origin
|
|
5284
|
+
if (this.history.length > 0) {
|
|
5285
|
+
this.history[0].x -= delta.x;
|
|
5286
|
+
this.history[0].y -= delta.y;
|
|
5287
|
+
}
|
|
5288
|
+
}
|
|
5289
|
+
this.scrollPositions.set(target, current);
|
|
5290
|
+
motionDom.frame.update(this.updatePoint, true);
|
|
5195
5291
|
}
|
|
5196
5292
|
updateHandlers(handlers) {
|
|
5197
5293
|
this.handlers = handlers;
|
|
5198
5294
|
}
|
|
5199
5295
|
end() {
|
|
5200
5296
|
this.removeListeners && this.removeListeners();
|
|
5297
|
+
this.removeScrollListeners && this.removeScrollListeners();
|
|
5298
|
+
this.scrollPositions.clear();
|
|
5201
5299
|
motionDom.cancelFrame(this.updatePoint);
|
|
5202
5300
|
}
|
|
5203
5301
|
}
|
|
@@ -5529,6 +5627,7 @@ class VisualElementDragControls {
|
|
|
5529
5627
|
dragSnapToOrigin,
|
|
5530
5628
|
distanceThreshold,
|
|
5531
5629
|
contextWindow: getContextWindow(this.visualElement),
|
|
5630
|
+
element: this.visualElement.current,
|
|
5532
5631
|
});
|
|
5533
5632
|
}
|
|
5534
5633
|
/**
|
|
@@ -6360,4 +6459,4 @@ exports.useIsPresent = useIsPresent;
|
|
|
6360
6459
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
6361
6460
|
exports.usePresence = usePresence;
|
|
6362
6461
|
exports.visualElementStore = visualElementStore;
|
|
6363
|
-
//# sourceMappingURL=feature-bundle-
|
|
6462
|
+
//# sourceMappingURL=feature-bundle-W9TOG4_M.js.map
|