framer-motion 6.2.10 → 6.3.2
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/index.js +24 -22
- package/dist/es/components/AnimateSharedLayout.mjs +4 -0
- package/dist/es/components/Reorder/Item.mjs +6 -6
- package/dist/es/motion/utils/valid-prop.mjs +1 -0
- package/dist/es/projection/node/create-projection-node.mjs +3 -2
- package/dist/es/render/utils/lifecycles.mjs +1 -0
- package/dist/es/utils/is-browser.mjs +1 -1
- package/dist/es/utils/use-cycle.mjs +10 -12
- package/dist/es/utils/use-reduced-motion.mjs +2 -1
- package/dist/es/value/scroll/use-viewport-scroll.mjs +0 -2
- package/dist/framer-motion.dev.js +24 -22
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +4 -2
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/dist/size-webpack-dom-animation.js +1 -1
- package/dist/size-webpack-dom-max.js +1 -1
- package/dist/size-webpack-m.js +1 -1
- package/package.json +5 -4
- package/types/components/LazyMotion/index.d.ts +1 -0
- package/types/components/Reorder/Group.d.ts +12 -12
- package/types/components/Reorder/Item.d.ts +20 -13
- package/types/components/Reorder/index.d.ts +24 -24
- package/types/motion/features/layout/MeasureLayout.d.ts +1 -0
- package/types/motion/features/layout/types.d.ts +6 -0
- package/types/motion/features/use-features.d.ts +1 -0
- package/types/motion/utils/VisualElementHandler.d.ts +1 -1
- package/types/projection/node/types.d.ts +1 -1
- package/types/render/utils/lifecycles.d.ts +7 -0
package/dist/cjs/index.js
CHANGED
|
@@ -141,7 +141,7 @@ function useVisualElementContext() {
|
|
|
141
141
|
*/
|
|
142
142
|
var PresenceContext = React.createContext(null);
|
|
143
143
|
|
|
144
|
-
var isBrowser = typeof
|
|
144
|
+
var isBrowser = typeof document !== "undefined";
|
|
145
145
|
|
|
146
146
|
var useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
147
147
|
|
|
@@ -150,7 +150,7 @@ var prefersReducedMotion = { current: null };
|
|
|
150
150
|
var hasDetected = false;
|
|
151
151
|
function initPrefersReducedMotion() {
|
|
152
152
|
hasDetected = true;
|
|
153
|
-
if (
|
|
153
|
+
if (!isBrowser)
|
|
154
154
|
return;
|
|
155
155
|
if (window.matchMedia) {
|
|
156
156
|
var motionMediaQuery_1 = window.matchMedia("(prefers-reduced-motion)");
|
|
@@ -1998,7 +1998,7 @@ function createProjectionNode(_a) {
|
|
|
1998
1998
|
}
|
|
1999
1999
|
// TODO: Check here if an animation exists
|
|
2000
2000
|
var layoutTransition = (_c = (_b = _this.options.transition) !== null && _b !== void 0 ? _b : visualElement.getDefaultTransition()) !== null && _c !== void 0 ? _c : defaultLayoutTransition;
|
|
2001
|
-
var
|
|
2001
|
+
var _g = visualElement.getProps(), onLayoutAnimationStart = _g.onLayoutAnimationStart, onLayoutAnimationComplete = _g.onLayoutAnimationComplete;
|
|
2002
2002
|
/**
|
|
2003
2003
|
* The target layout of the element might stay the same,
|
|
2004
2004
|
* but its position relative to its parent has changed.
|
|
@@ -2021,7 +2021,7 @@ function createProjectionNode(_a) {
|
|
|
2021
2021
|
_this.resumingFrom.resumingFrom = undefined;
|
|
2022
2022
|
}
|
|
2023
2023
|
_this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
|
|
2024
|
-
var animationOptions = tslib.__assign(tslib.__assign({}, getValueTransition(layoutTransition, "layout")), { onComplete: onLayoutAnimationComplete });
|
|
2024
|
+
var animationOptions = tslib.__assign(tslib.__assign({}, getValueTransition(layoutTransition, "layout")), { onPlay: onLayoutAnimationStart, onComplete: onLayoutAnimationComplete });
|
|
2025
2025
|
if (visualElement.shouldReduceMotion) {
|
|
2026
2026
|
animationOptions.delay = 0;
|
|
2027
2027
|
animationOptions.type = false;
|
|
@@ -2554,6 +2554,7 @@ function createProjectionNode(_a) {
|
|
|
2554
2554
|
ProjectionNode.prototype.startAnimation = function (options) {
|
|
2555
2555
|
var _this = this;
|
|
2556
2556
|
var _a, _b;
|
|
2557
|
+
this.notifyListeners("animationStart");
|
|
2557
2558
|
(_a = this.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();
|
|
2558
2559
|
if (this.resumingFrom) {
|
|
2559
2560
|
(_b = this.resumingFrom.currentAnimation) === null || _b === void 0 ? void 0 : _b.stop();
|
|
@@ -3458,6 +3459,7 @@ var validMotionProps = new Set([
|
|
|
3458
3459
|
"layout",
|
|
3459
3460
|
"layoutId",
|
|
3460
3461
|
"layoutDependency",
|
|
3462
|
+
"onLayoutAnimationStart",
|
|
3461
3463
|
"onLayoutAnimationComplete",
|
|
3462
3464
|
"onLayoutMeasure",
|
|
3463
3465
|
"onBeforeLayoutMeasure",
|
|
@@ -5907,6 +5909,7 @@ var names = [
|
|
|
5907
5909
|
"AnimationComplete",
|
|
5908
5910
|
"LayoutAnimationComplete",
|
|
5909
5911
|
"AnimationStart",
|
|
5912
|
+
"LayoutAnimationStart",
|
|
5910
5913
|
"SetAxisTarget",
|
|
5911
5914
|
"Unmount",
|
|
5912
5915
|
];
|
|
@@ -7413,6 +7416,9 @@ var LayoutGroup = function (_a) {
|
|
|
7413
7416
|
var id = 0;
|
|
7414
7417
|
var AnimateSharedLayout = function (_a) {
|
|
7415
7418
|
var children = _a.children;
|
|
7419
|
+
React__namespace.useEffect(function () {
|
|
7420
|
+
heyListen.warning(false, "AnimateSharedLayout is deprecated: https://www.framer.com/docs/guide-upgrade/##shared-layout-animations");
|
|
7421
|
+
}, []);
|
|
7416
7422
|
return (React__namespace.createElement(LayoutGroup, { id: useConstant(function () { return "asl-".concat(id++); }) }, children));
|
|
7417
7423
|
};
|
|
7418
7424
|
|
|
@@ -7699,7 +7705,7 @@ function useDefaultMotionValue(value, defaultValue) {
|
|
|
7699
7705
|
return isMotionValue(value) ? value : useMotionValue(defaultValue);
|
|
7700
7706
|
}
|
|
7701
7707
|
function ReorderItem(_a, externalRef) {
|
|
7702
|
-
var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, props = tslib.__rest(_a, ["children", "style", "value", "as", "onDrag"]);
|
|
7708
|
+
var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, _c = _a.layout, layout = _c === void 0 ? true : _c, props = tslib.__rest(_a, ["children", "style", "value", "as", "onDrag", "layout"]);
|
|
7703
7709
|
var Component = useConstant(function () { return motion(as); });
|
|
7704
7710
|
var context = React.useContext(ReorderContext);
|
|
7705
7711
|
var point = {
|
|
@@ -7710,19 +7716,19 @@ function ReorderItem(_a, externalRef) {
|
|
|
7710
7716
|
var _b = tslib.__read(_a, 2), latestX = _b[0], latestY = _b[1];
|
|
7711
7717
|
return latestX || latestY ? 1 : "unset";
|
|
7712
7718
|
});
|
|
7713
|
-
var
|
|
7719
|
+
var measuredLayout = React.useRef(null);
|
|
7714
7720
|
heyListen.invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
|
|
7715
|
-
var
|
|
7721
|
+
var _d = context, axis = _d.axis, registerItem = _d.registerItem, updateOrder = _d.updateOrder;
|
|
7716
7722
|
React.useEffect(function () {
|
|
7717
|
-
registerItem(value,
|
|
7723
|
+
registerItem(value, measuredLayout.current);
|
|
7718
7724
|
}, [context]);
|
|
7719
|
-
return (React__namespace.createElement(Component, tslib.__assign({ drag: axis }, props, { dragSnapToOrigin: true, style: tslib.__assign(tslib.__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout:
|
|
7725
|
+
return (React__namespace.createElement(Component, tslib.__assign({ drag: axis }, props, { dragSnapToOrigin: true, style: tslib.__assign(tslib.__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout: layout, onDrag: function (event, gesturePoint) {
|
|
7720
7726
|
var velocity = gesturePoint.velocity;
|
|
7721
7727
|
velocity[axis] &&
|
|
7722
7728
|
updateOrder(value, point[axis].get(), velocity[axis]);
|
|
7723
7729
|
onDrag === null || onDrag === void 0 ? void 0 : onDrag(event, gesturePoint);
|
|
7724
7730
|
}, onLayoutMeasure: function (measured) {
|
|
7725
|
-
|
|
7731
|
+
measuredLayout.current = measured;
|
|
7726
7732
|
}, ref: externalRef }), children));
|
|
7727
7733
|
}
|
|
7728
7734
|
var Item = React.forwardRef(ReorderItem);
|
|
@@ -7938,8 +7944,6 @@ function getViewportScrollOffsets() {
|
|
|
7938
7944
|
var hasListeners = false;
|
|
7939
7945
|
function addEventListeners() {
|
|
7940
7946
|
hasListeners = true;
|
|
7941
|
-
if (typeof window === "undefined")
|
|
7942
|
-
return;
|
|
7943
7947
|
var updateScrollValues = createScrollUpdater(viewportScrollValues, getViewportScrollOffsets);
|
|
7944
7948
|
addDomEvent(window, "scroll", updateScrollValues, { passive: true });
|
|
7945
7949
|
addDomEvent(window, "resize", updateScrollValues);
|
|
@@ -8142,16 +8146,14 @@ function useCycle() {
|
|
|
8142
8146
|
}
|
|
8143
8147
|
var index = React.useRef(0);
|
|
8144
8148
|
var _a = tslib.__read(React.useState(items[index.current]), 2), item = _a[0], setItem = _a[1];
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
},
|
|
8154
|
-
];
|
|
8149
|
+
var runCycle = React.useCallback(function (next) {
|
|
8150
|
+
index.current =
|
|
8151
|
+
typeof next !== "number"
|
|
8152
|
+
? popmotion.wrap(0, items.length, index.current + 1)
|
|
8153
|
+
: next;
|
|
8154
|
+
setItem(items[index.current]);
|
|
8155
|
+
}, tslib.__spreadArray([items.length], tslib.__read(items), false));
|
|
8156
|
+
return [item, runCycle];
|
|
8155
8157
|
}
|
|
8156
8158
|
|
|
8157
8159
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { warning } from 'hey-listen';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { useConstant } from '../utils/use-constant.mjs';
|
|
3
4
|
import { LayoutGroup } from './LayoutGroup/index.mjs';
|
|
@@ -5,6 +6,9 @@ import { LayoutGroup } from './LayoutGroup/index.mjs';
|
|
|
5
6
|
var id = 0;
|
|
6
7
|
var AnimateSharedLayout = function (_a) {
|
|
7
8
|
var children = _a.children;
|
|
9
|
+
React.useEffect(function () {
|
|
10
|
+
warning(false, "AnimateSharedLayout is deprecated: https://www.framer.com/docs/guide-upgrade/##shared-layout-animations");
|
|
11
|
+
}, []);
|
|
8
12
|
return (React.createElement(LayoutGroup, { id: useConstant(function () { return "asl-".concat(id++); }) }, children));
|
|
9
13
|
};
|
|
10
14
|
|
|
@@ -14,7 +14,7 @@ function useDefaultMotionValue(value, defaultValue) {
|
|
|
14
14
|
return isMotionValue(value) ? value : useMotionValue(defaultValue);
|
|
15
15
|
}
|
|
16
16
|
function ReorderItem(_a, externalRef) {
|
|
17
|
-
var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, props = __rest(_a, ["children", "style", "value", "as", "onDrag"]);
|
|
17
|
+
var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, _c = _a.layout, layout = _c === void 0 ? true : _c, props = __rest(_a, ["children", "style", "value", "as", "onDrag", "layout"]);
|
|
18
18
|
var Component = useConstant(function () { return motion(as); });
|
|
19
19
|
var context = useContext(ReorderContext);
|
|
20
20
|
var point = {
|
|
@@ -25,19 +25,19 @@ function ReorderItem(_a, externalRef) {
|
|
|
25
25
|
var _b = __read(_a, 2), latestX = _b[0], latestY = _b[1];
|
|
26
26
|
return latestX || latestY ? 1 : "unset";
|
|
27
27
|
});
|
|
28
|
-
var
|
|
28
|
+
var measuredLayout = useRef(null);
|
|
29
29
|
invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
|
|
30
|
-
var
|
|
30
|
+
var _d = context, axis = _d.axis, registerItem = _d.registerItem, updateOrder = _d.updateOrder;
|
|
31
31
|
useEffect(function () {
|
|
32
|
-
registerItem(value,
|
|
32
|
+
registerItem(value, measuredLayout.current);
|
|
33
33
|
}, [context]);
|
|
34
|
-
return (React.createElement(Component, __assign({ drag: axis }, props, { dragSnapToOrigin: true, style: __assign(__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout:
|
|
34
|
+
return (React.createElement(Component, __assign({ drag: axis }, props, { dragSnapToOrigin: true, style: __assign(__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout: layout, onDrag: function (event, gesturePoint) {
|
|
35
35
|
var velocity = gesturePoint.velocity;
|
|
36
36
|
velocity[axis] &&
|
|
37
37
|
updateOrder(value, point[axis].get(), velocity[axis]);
|
|
38
38
|
onDrag === null || onDrag === void 0 ? void 0 : onDrag(event, gesturePoint);
|
|
39
39
|
}, onLayoutMeasure: function (measured) {
|
|
40
|
-
|
|
40
|
+
measuredLayout.current = measured;
|
|
41
41
|
}, ref: externalRef }), children));
|
|
42
42
|
}
|
|
43
43
|
var Item = forwardRef(ReorderItem);
|
|
@@ -218,7 +218,7 @@ function createProjectionNode(_a) {
|
|
|
218
218
|
}
|
|
219
219
|
// TODO: Check here if an animation exists
|
|
220
220
|
var layoutTransition = (_c = (_b = _this.options.transition) !== null && _b !== void 0 ? _b : visualElement.getDefaultTransition()) !== null && _c !== void 0 ? _c : defaultLayoutTransition;
|
|
221
|
-
var
|
|
221
|
+
var _g = visualElement.getProps(), onLayoutAnimationStart = _g.onLayoutAnimationStart, onLayoutAnimationComplete = _g.onLayoutAnimationComplete;
|
|
222
222
|
/**
|
|
223
223
|
* The target layout of the element might stay the same,
|
|
224
224
|
* but its position relative to its parent has changed.
|
|
@@ -241,7 +241,7 @@ function createProjectionNode(_a) {
|
|
|
241
241
|
_this.resumingFrom.resumingFrom = undefined;
|
|
242
242
|
}
|
|
243
243
|
_this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
|
|
244
|
-
var animationOptions = __assign(__assign({}, getValueTransition(layoutTransition, "layout")), { onComplete: onLayoutAnimationComplete });
|
|
244
|
+
var animationOptions = __assign(__assign({}, getValueTransition(layoutTransition, "layout")), { onPlay: onLayoutAnimationStart, onComplete: onLayoutAnimationComplete });
|
|
245
245
|
if (visualElement.shouldReduceMotion) {
|
|
246
246
|
animationOptions.delay = 0;
|
|
247
247
|
animationOptions.type = false;
|
|
@@ -774,6 +774,7 @@ function createProjectionNode(_a) {
|
|
|
774
774
|
ProjectionNode.prototype.startAnimation = function (options) {
|
|
775
775
|
var _this = this;
|
|
776
776
|
var _a, _b;
|
|
777
|
+
this.notifyListeners("animationStart");
|
|
777
778
|
(_a = this.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();
|
|
778
779
|
if (this.resumingFrom) {
|
|
779
780
|
(_b = this.resumingFrom.currentAnimation) === null || _b === void 0 ? void 0 : _b.stop();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __read } from 'tslib';
|
|
2
|
-
import { useRef, useState } from 'react';
|
|
1
|
+
import { __read, __spreadArray } from 'tslib';
|
|
3
2
|
import { wrap } from 'popmotion';
|
|
3
|
+
import { useRef, useState, useCallback } from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments.
|
|
@@ -35,16 +35,14 @@ function useCycle() {
|
|
|
35
35
|
}
|
|
36
36
|
var index = useRef(0);
|
|
37
37
|
var _a = __read(useState(items[index.current]), 2), item = _a[0], setItem = _a[1];
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
];
|
|
38
|
+
var runCycle = useCallback(function (next) {
|
|
39
|
+
index.current =
|
|
40
|
+
typeof next !== "number"
|
|
41
|
+
? wrap(0, items.length, index.current + 1)
|
|
42
|
+
: next;
|
|
43
|
+
setItem(items[index.current]);
|
|
44
|
+
}, __spreadArray([items.length], __read(items), false));
|
|
45
|
+
return [item, runCycle];
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
export { useCycle };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { __read } from 'tslib';
|
|
2
2
|
import { useState, useContext } from 'react';
|
|
3
3
|
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
4
|
+
import { isBrowser } from './is-browser.mjs';
|
|
4
5
|
|
|
5
6
|
// Does this device prefer reduced motion? Returns `null` server-side.
|
|
6
7
|
var prefersReducedMotion = { current: null };
|
|
7
8
|
var hasDetected = false;
|
|
8
9
|
function initPrefersReducedMotion() {
|
|
9
10
|
hasDetected = true;
|
|
10
|
-
if (
|
|
11
|
+
if (!isBrowser)
|
|
11
12
|
return;
|
|
12
13
|
if (window.matchMedia) {
|
|
13
14
|
var motionMediaQuery_1 = window.matchMedia("(prefers-reduced-motion)");
|
|
@@ -14,8 +14,6 @@ function getViewportScrollOffsets() {
|
|
|
14
14
|
var hasListeners = false;
|
|
15
15
|
function addEventListeners() {
|
|
16
16
|
hasListeners = true;
|
|
17
|
-
if (typeof window === "undefined")
|
|
18
|
-
return;
|
|
19
17
|
var updateScrollValues = createScrollUpdater(viewportScrollValues, getViewportScrollOffsets);
|
|
20
18
|
addDomEvent(window, "scroll", updateScrollValues, { passive: true });
|
|
21
19
|
addDomEvent(window, "resize", updateScrollValues);
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
*/
|
|
235
235
|
var PresenceContext = React.createContext(null);
|
|
236
236
|
|
|
237
|
-
var isBrowser = typeof
|
|
237
|
+
var isBrowser = typeof document !== "undefined";
|
|
238
238
|
|
|
239
239
|
var useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
240
240
|
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
var hasDetected = false;
|
|
244
244
|
function initPrefersReducedMotion() {
|
|
245
245
|
hasDetected = true;
|
|
246
|
-
if (
|
|
246
|
+
if (!isBrowser)
|
|
247
247
|
return;
|
|
248
248
|
if (window.matchMedia) {
|
|
249
249
|
var motionMediaQuery_1 = window.matchMedia("(prefers-reduced-motion)");
|
|
@@ -3223,7 +3223,7 @@
|
|
|
3223
3223
|
}
|
|
3224
3224
|
// TODO: Check here if an animation exists
|
|
3225
3225
|
var layoutTransition = (_c = (_b = _this.options.transition) !== null && _b !== void 0 ? _b : visualElement.getDefaultTransition()) !== null && _c !== void 0 ? _c : defaultLayoutTransition;
|
|
3226
|
-
var
|
|
3226
|
+
var _g = visualElement.getProps(), onLayoutAnimationStart = _g.onLayoutAnimationStart, onLayoutAnimationComplete = _g.onLayoutAnimationComplete;
|
|
3227
3227
|
/**
|
|
3228
3228
|
* The target layout of the element might stay the same,
|
|
3229
3229
|
* but its position relative to its parent has changed.
|
|
@@ -3246,7 +3246,7 @@
|
|
|
3246
3246
|
_this.resumingFrom.resumingFrom = undefined;
|
|
3247
3247
|
}
|
|
3248
3248
|
_this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
|
|
3249
|
-
var animationOptions = __assign(__assign({}, getValueTransition(layoutTransition, "layout")), { onComplete: onLayoutAnimationComplete });
|
|
3249
|
+
var animationOptions = __assign(__assign({}, getValueTransition(layoutTransition, "layout")), { onPlay: onLayoutAnimationStart, onComplete: onLayoutAnimationComplete });
|
|
3250
3250
|
if (visualElement.shouldReduceMotion) {
|
|
3251
3251
|
animationOptions.delay = 0;
|
|
3252
3252
|
animationOptions.type = false;
|
|
@@ -3779,6 +3779,7 @@
|
|
|
3779
3779
|
ProjectionNode.prototype.startAnimation = function (options) {
|
|
3780
3780
|
var _this = this;
|
|
3781
3781
|
var _a, _b;
|
|
3782
|
+
this.notifyListeners("animationStart");
|
|
3782
3783
|
(_a = this.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();
|
|
3783
3784
|
if (this.resumingFrom) {
|
|
3784
3785
|
(_b = this.resumingFrom.currentAnimation) === null || _b === void 0 ? void 0 : _b.stop();
|
|
@@ -4683,6 +4684,7 @@
|
|
|
4683
4684
|
"layout",
|
|
4684
4685
|
"layoutId",
|
|
4685
4686
|
"layoutDependency",
|
|
4687
|
+
"onLayoutAnimationStart",
|
|
4686
4688
|
"onLayoutAnimationComplete",
|
|
4687
4689
|
"onLayoutMeasure",
|
|
4688
4690
|
"onBeforeLayoutMeasure",
|
|
@@ -7132,6 +7134,7 @@
|
|
|
7132
7134
|
"AnimationComplete",
|
|
7133
7135
|
"LayoutAnimationComplete",
|
|
7134
7136
|
"AnimationStart",
|
|
7137
|
+
"LayoutAnimationStart",
|
|
7135
7138
|
"SetAxisTarget",
|
|
7136
7139
|
"Unmount",
|
|
7137
7140
|
];
|
|
@@ -8636,6 +8639,9 @@
|
|
|
8636
8639
|
var id = 0;
|
|
8637
8640
|
var AnimateSharedLayout = function (_a) {
|
|
8638
8641
|
var children = _a.children;
|
|
8642
|
+
React__namespace.useEffect(function () {
|
|
8643
|
+
warning(false, "AnimateSharedLayout is deprecated: https://www.framer.com/docs/guide-upgrade/##shared-layout-animations");
|
|
8644
|
+
}, []);
|
|
8639
8645
|
return (React__namespace.createElement(LayoutGroup, { id: useConstant(function () { return "asl-".concat(id++); }) }, children));
|
|
8640
8646
|
};
|
|
8641
8647
|
|
|
@@ -8922,7 +8928,7 @@
|
|
|
8922
8928
|
return isMotionValue(value) ? value : useMotionValue(defaultValue);
|
|
8923
8929
|
}
|
|
8924
8930
|
function ReorderItem(_a, externalRef) {
|
|
8925
|
-
var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, props = __rest(_a, ["children", "style", "value", "as", "onDrag"]);
|
|
8931
|
+
var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, _c = _a.layout, layout = _c === void 0 ? true : _c, props = __rest(_a, ["children", "style", "value", "as", "onDrag", "layout"]);
|
|
8926
8932
|
var Component = useConstant(function () { return motion(as); });
|
|
8927
8933
|
var context = React.useContext(ReorderContext);
|
|
8928
8934
|
var point = {
|
|
@@ -8933,19 +8939,19 @@
|
|
|
8933
8939
|
var _b = __read(_a, 2), latestX = _b[0], latestY = _b[1];
|
|
8934
8940
|
return latestX || latestY ? 1 : "unset";
|
|
8935
8941
|
});
|
|
8936
|
-
var
|
|
8942
|
+
var measuredLayout = React.useRef(null);
|
|
8937
8943
|
invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
|
|
8938
|
-
var
|
|
8944
|
+
var _d = context, axis = _d.axis, registerItem = _d.registerItem, updateOrder = _d.updateOrder;
|
|
8939
8945
|
React.useEffect(function () {
|
|
8940
|
-
registerItem(value,
|
|
8946
|
+
registerItem(value, measuredLayout.current);
|
|
8941
8947
|
}, [context]);
|
|
8942
|
-
return (React__namespace.createElement(Component, __assign({ drag: axis }, props, { dragSnapToOrigin: true, style: __assign(__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout:
|
|
8948
|
+
return (React__namespace.createElement(Component, __assign({ drag: axis }, props, { dragSnapToOrigin: true, style: __assign(__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout: layout, onDrag: function (event, gesturePoint) {
|
|
8943
8949
|
var velocity = gesturePoint.velocity;
|
|
8944
8950
|
velocity[axis] &&
|
|
8945
8951
|
updateOrder(value, point[axis].get(), velocity[axis]);
|
|
8946
8952
|
onDrag === null || onDrag === void 0 ? void 0 : onDrag(event, gesturePoint);
|
|
8947
8953
|
}, onLayoutMeasure: function (measured) {
|
|
8948
|
-
|
|
8954
|
+
measuredLayout.current = measured;
|
|
8949
8955
|
}, ref: externalRef }), children));
|
|
8950
8956
|
}
|
|
8951
8957
|
var Item = React.forwardRef(ReorderItem);
|
|
@@ -9161,8 +9167,6 @@
|
|
|
9161
9167
|
var hasListeners = false;
|
|
9162
9168
|
function addEventListeners() {
|
|
9163
9169
|
hasListeners = true;
|
|
9164
|
-
if (typeof window === "undefined")
|
|
9165
|
-
return;
|
|
9166
9170
|
var updateScrollValues = createScrollUpdater(viewportScrollValues, getViewportScrollOffsets);
|
|
9167
9171
|
addDomEvent(window, "scroll", updateScrollValues, { passive: true });
|
|
9168
9172
|
addDomEvent(window, "resize", updateScrollValues);
|
|
@@ -9365,16 +9369,14 @@
|
|
|
9365
9369
|
}
|
|
9366
9370
|
var index = React.useRef(0);
|
|
9367
9371
|
var _a = __read(React.useState(items[index.current]), 2), item = _a[0], setItem = _a[1];
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
},
|
|
9377
|
-
];
|
|
9372
|
+
var runCycle = React.useCallback(function (next) {
|
|
9373
|
+
index.current =
|
|
9374
|
+
typeof next !== "number"
|
|
9375
|
+
? wrap(0, items.length, index.current + 1)
|
|
9376
|
+
: next;
|
|
9377
|
+
setItem(items[index.current]);
|
|
9378
|
+
}, __spreadArray([items.length], __read(items), false));
|
|
9379
|
+
return [item, runCycle];
|
|
9378
9380
|
}
|
|
9379
9381
|
|
|
9380
9382
|
/**
|