framer-motion 5.3.0 → 5.4.0-beta
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/es/animation/utils/easing.mjs +1 -1
- package/dist/es/animation/utils/transitions.mjs +9 -3
- package/dist/es/components/AnimatePresence/index.mjs +1 -1
- package/dist/es/components/AnimatePresence/use-presence.mjs +1 -27
- package/dist/es/components/AnimateSharedLayout.mjs +1 -1
- package/dist/es/components/Reorder/Item.mjs +5 -4
- package/dist/es/context/MotionContext/index.mjs +1 -1
- package/dist/es/events/use-dom-event.mjs +2 -31
- package/dist/es/events/use-pointer-event.mjs +2 -5
- package/dist/es/gestures/use-hover-gesture.mjs +4 -1
- package/dist/es/gestures/use-tap-gesture.mjs +4 -1
- package/dist/es/gestures/utils/event-type.mjs +1 -8
- package/dist/es/index.mjs +1 -0
- package/dist/es/motion/features/viewport/use-viewport.mjs +2 -2
- package/dist/es/motion/index.mjs +1 -1
- package/dist/es/motion/utils/use-visual-state.mjs +29 -10
- package/dist/es/motion/utils/valid-prop.mjs +1 -0
- package/dist/es/projection/animation/mix-values.mjs +1 -1
- package/dist/es/projection/geometry/models.mjs +1 -11
- package/dist/es/projection/node/create-projection-node.mjs +4 -1167
- package/dist/es/projection/styles/scale-border-radius.mjs +1 -1
- package/dist/es/projection/styles/transform.mjs +5 -5
- package/dist/es/render/dom/motion-proxy.mjs +3 -0
- package/dist/es/render/dom/utils/css-variables-conversion.mjs +2 -2
- package/dist/es/render/dom/utils/filter-props.mjs +3 -1
- package/dist/es/render/dom/value-types/dimensions.mjs +1 -8
- package/dist/es/render/html/use-props.mjs +6 -4
- package/dist/es/render/html/utils/build-transform.mjs +2 -2
- package/dist/es/render/svg/utils/path.mjs +1 -1
- package/dist/es/render/svg/utils/transform-origin.mjs +1 -1
- package/dist/es/render/three/create-visual-element.mjs +42 -0
- package/dist/es/render/three/gestures/use-hover.mjs +22 -0
- package/dist/es/render/three/gestures/use-tap.mjs +56 -0
- package/dist/es/render/three/motion.mjs +30 -0
- package/dist/es/render/three/use-render.mjs +11 -0
- package/dist/es/render/three/utils/read-value.mjs +43 -0
- package/dist/es/render/three/utils/set-value.mjs +59 -0
- package/dist/es/render/utils/animation-state.mjs +5 -4
- package/dist/es/render/utils/animation.mjs +1 -4
- package/dist/es/render/utils/setters.mjs +3 -42
- package/dist/es/three-entry.mjs +1 -0
- package/dist/es/utils/array.mjs +2 -13
- package/dist/es/utils/use-force-update.mjs +13 -9
- package/dist/es/utils/use-instant-transition-state.mjs +5 -0
- package/dist/es/utils/use-instant-transition.mjs +28 -0
- package/dist/framer-motion-three.cjs.js +2995 -0
- package/dist/framer-motion.cjs.js +147 -84
- package/dist/framer-motion.dev.js +139 -76
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +35 -23
- 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/package.json +179 -158
- package/types/components/Reorder/Item.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/motion/features/types.d.ts +1 -1
- package/types/motion/features/viewport/types.d.ts +1 -1
- package/types/render/three/create-visual-element.d.ts +6 -0
- package/types/render/three/gestures/use-hover.d.ts +10 -0
- package/types/render/three/gestures/use-tap.d.ts +8 -0
- package/types/render/three/motion.d.ts +5 -0
- package/types/render/three/types.d.ts +24 -0
- package/types/render/three/use-render.d.ts +4 -0
- package/types/render/three/utils/read-value.d.ts +2 -0
- package/types/render/three/utils/set-value.d.ts +2 -0
- package/types/render/utils/animation-state.d.ts +1 -1
- package/types/render/utils/lifecycles.d.ts +8 -8
- package/types/render/utils/setters.d.ts +1 -0
- package/types/three-entry.d.ts +1 -0
- package/types/utils/use-instant-transition-state.d.ts +3 -0
- package/types/utils/use-instant-transition.d.ts +1 -0
- package/CHANGELOG.md +0 -1953
|
@@ -27,7 +27,7 @@ var easingDefinitionToFunction = function (definition) {
|
|
|
27
27
|
}
|
|
28
28
|
else if (typeof definition === "string") {
|
|
29
29
|
// Else lookup from table
|
|
30
|
-
invariant(easingLookup[definition] !== undefined, "Invalid easing type '"
|
|
30
|
+
invariant(easingLookup[definition] !== undefined, "Invalid easing type '".concat(definition, "'"));
|
|
31
31
|
return easingLookup[definition];
|
|
32
32
|
}
|
|
33
33
|
return definition;
|
|
@@ -6,6 +6,8 @@ import { isAnimatable } from './is-animatable.mjs';
|
|
|
6
6
|
import { getDefaultTransition } from './default-transitions.mjs';
|
|
7
7
|
import { warning } from 'hey-listen';
|
|
8
8
|
import { getAnimatableNone } from '../../render/dom/value-types/animatable-none.mjs';
|
|
9
|
+
import { instantAnimationState } from '../../utils/use-instant-transition-state.mjs';
|
|
10
|
+
import { resolveFinalValueInKeyframes } from '../../utils/resolve-value.mjs';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Decide whether a transition is defined on a given Transition.
|
|
@@ -124,7 +126,7 @@ function getAnimation(key, value, target, transition, onComplete) {
|
|
|
124
126
|
target = getZeroUnit(origin);
|
|
125
127
|
}
|
|
126
128
|
var isOriginAnimatable = isAnimatable(key, origin);
|
|
127
|
-
warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate "
|
|
129
|
+
warning(isOriginAnimatable === isTargetAnimatable, "You are trying to animate ".concat(key, " from \"").concat(origin, "\" to \"").concat(target, "\". ").concat(origin, " is not an animatable value - to enable this animation set ").concat(origin, " to a value animatable to ").concat(target, " via the `style` property."));
|
|
128
130
|
function start() {
|
|
129
131
|
var options = {
|
|
130
132
|
from: origin,
|
|
@@ -148,9 +150,10 @@ function getAnimation(key, value, target, transition, onComplete) {
|
|
|
148
150
|
}
|
|
149
151
|
function set() {
|
|
150
152
|
var _a, _b;
|
|
151
|
-
|
|
153
|
+
var finalTarget = resolveFinalValueInKeyframes(target);
|
|
154
|
+
value.set(finalTarget);
|
|
152
155
|
onComplete();
|
|
153
|
-
(_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition,
|
|
156
|
+
(_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, finalTarget);
|
|
154
157
|
(_b = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _b === void 0 ? void 0 : _b.call(valueTransition);
|
|
155
158
|
return { stop: function () { } };
|
|
156
159
|
}
|
|
@@ -182,6 +185,9 @@ function getValueTransition(transition, key) {
|
|
|
182
185
|
*/
|
|
183
186
|
function startAnimation(key, value, target, transition) {
|
|
184
187
|
if (transition === void 0) { transition = {}; }
|
|
188
|
+
if (instantAnimationState.current) {
|
|
189
|
+
transition = { type: false };
|
|
190
|
+
}
|
|
185
191
|
return value.start(function (onComplete) {
|
|
186
192
|
var delayTimer;
|
|
187
193
|
var controls;
|
|
@@ -14,7 +14,7 @@ function updateChildLookup(children, allChildren) {
|
|
|
14
14
|
var key = getChildKey(child);
|
|
15
15
|
if (process.env.NODE_ENV !== "production" && seenChildren) {
|
|
16
16
|
if (seenChildren.has(key)) {
|
|
17
|
-
console.warn("Children of AnimatePresence require unique keys. \""
|
|
17
|
+
console.warn("Children of AnimatePresence require unique keys. \"".concat(key, "\" is a duplicate."));
|
|
18
18
|
}
|
|
19
19
|
seenChildren.add(key);
|
|
20
20
|
}
|
|
@@ -38,34 +38,8 @@ function usePresence() {
|
|
|
38
38
|
var safeToRemove = function () { return onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete(id); };
|
|
39
39
|
return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
|
|
40
40
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
|
|
43
|
-
* There is no `safeToRemove` function.
|
|
44
|
-
*
|
|
45
|
-
* ```jsx
|
|
46
|
-
* import { useIsPresent } from "framer-motion"
|
|
47
|
-
*
|
|
48
|
-
* export const Component = () => {
|
|
49
|
-
* const isPresent = useIsPresent()
|
|
50
|
-
*
|
|
51
|
-
* useEffect(() => {
|
|
52
|
-
* !isPresent && console.log("I've been removed!")
|
|
53
|
-
* }, [isPresent])
|
|
54
|
-
*
|
|
55
|
-
* return <div />
|
|
56
|
-
* }
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
function useIsPresent() {
|
|
62
|
-
return isPresent(useContext(PresenceContext));
|
|
63
|
-
}
|
|
64
|
-
function isPresent(context) {
|
|
65
|
-
return context === null ? true : context.isPresent;
|
|
66
|
-
}
|
|
67
41
|
var counter = 0;
|
|
68
42
|
var incrementId = function () { return counter++; };
|
|
69
43
|
var useUniqueId = function () { return useConstant(incrementId); };
|
|
70
44
|
|
|
71
|
-
export {
|
|
45
|
+
export { usePresence };
|
|
@@ -5,7 +5,7 @@ import { LayoutGroup } from './LayoutGroup/index.mjs';
|
|
|
5
5
|
var id = 0;
|
|
6
6
|
var AnimateSharedLayout = function (_a) {
|
|
7
7
|
var children = _a.children;
|
|
8
|
-
return (React.createElement(LayoutGroup, { id: useConstant(function () { return "asl-"
|
|
8
|
+
return (React.createElement(LayoutGroup, { id: useConstant(function () { return "asl-".concat(id++); }) }, children));
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { AnimateSharedLayout };
|
|
@@ -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, props = __rest(_a, ["children", "style", "value", "as"]);
|
|
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"]);
|
|
18
18
|
var Component = useConstant(function () { return motion(as); });
|
|
19
19
|
var context = useContext(ReorderContext);
|
|
20
20
|
var point = {
|
|
@@ -23,7 +23,7 @@ function ReorderItem(_a, externalRef) {
|
|
|
23
23
|
};
|
|
24
24
|
var zIndex = useTransform([point.x, point.y], function (_a) {
|
|
25
25
|
var _b = __read(_a, 2), latestX = _b[0], latestY = _b[1];
|
|
26
|
-
return latestX || latestY ? 1 :
|
|
26
|
+
return latestX || latestY ? 1 : "unset";
|
|
27
27
|
});
|
|
28
28
|
var layout = useRef(null);
|
|
29
29
|
invariant(Boolean(context), "Reorder.Item must be a child of Reorder.Group");
|
|
@@ -31,10 +31,11 @@ function ReorderItem(_a, externalRef) {
|
|
|
31
31
|
useEffect(function () {
|
|
32
32
|
registerItem(value, layout.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: true, onDrag: function (
|
|
35
|
-
var velocity =
|
|
34
|
+
return (React.createElement(Component, __assign({ drag: axis }, props, { dragSnapToOrigin: true, style: __assign(__assign({}, style), { x: point.x, y: point.y, zIndex: zIndex }), layout: true, onDrag: function (event, gesturePoint) {
|
|
35
|
+
var velocity = gesturePoint.velocity;
|
|
36
36
|
velocity[axis] &&
|
|
37
37
|
updateOrder(value, point[axis].get(), velocity[axis]);
|
|
38
|
+
onDrag === null || onDrag === void 0 ? void 0 : onDrag(event, gesturePoint);
|
|
38
39
|
}, onLayoutMeasure: function (measured) {
|
|
39
40
|
layout.current = measured;
|
|
40
41
|
}, ref: externalRef }), children));
|
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react';
|
|
2
2
|
|
|
3
3
|
function addDomEvent(target, eventName, handler, options) {
|
|
4
4
|
target.addEventListener(eventName, handler, options);
|
|
5
5
|
return function () { return target.removeEventListener(eventName, handler, options); };
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Attaches an event listener directly to the provided DOM element.
|
|
9
|
-
*
|
|
10
|
-
* Bypassing React's event system can be desirable, for instance when attaching non-passive
|
|
11
|
-
* event handlers.
|
|
12
|
-
*
|
|
13
|
-
* ```jsx
|
|
14
|
-
* const ref = useRef(null)
|
|
15
|
-
*
|
|
16
|
-
* useDomEvent(ref, 'wheel', onWheel, { passive: false })
|
|
17
|
-
*
|
|
18
|
-
* return <div ref={ref} />
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @param ref - React.RefObject that's been provided to the element you want to bind the listener to.
|
|
22
|
-
* @param eventName - Name of the event you want listen for.
|
|
23
|
-
* @param handler - Function to fire when receiving the event.
|
|
24
|
-
* @param options - Options to pass to `Event.addEventListener`.
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
function useDomEvent(ref, eventName, handler, options) {
|
|
29
|
-
useEffect(function () {
|
|
30
|
-
var element = ref.current;
|
|
31
|
-
if (handler && element) {
|
|
32
|
-
return addDomEvent(element, eventName, handler, options);
|
|
33
|
-
}
|
|
34
|
-
}, [ref, eventName, handler, options]);
|
|
35
|
-
}
|
|
36
7
|
|
|
37
|
-
export { addDomEvent
|
|
8
|
+
export { addDomEvent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addDomEvent } from './use-dom-event.mjs';
|
|
2
2
|
import { wrapHandler } from './event-info.mjs';
|
|
3
3
|
import { supportsPointerEvents, supportsTouchEvents, supportsMouseEvents } from './utils.mjs';
|
|
4
4
|
|
|
@@ -33,8 +33,5 @@ function getPointerEventName(name) {
|
|
|
33
33
|
function addPointerEvent(target, eventName, handler, options) {
|
|
34
34
|
return addDomEvent(target, getPointerEventName(eventName), wrapHandler(handler, eventName === "pointerdown"), options);
|
|
35
35
|
}
|
|
36
|
-
function usePointerEvent(ref, eventName, handler, options) {
|
|
37
|
-
return useDomEvent(ref, getPointerEventName(eventName), handler && wrapHandler(handler, eventName === "pointerdown"), options);
|
|
38
|
-
}
|
|
39
36
|
|
|
40
|
-
export { addPointerEvent
|
|
37
|
+
export { addPointerEvent };
|
|
@@ -8,8 +8,11 @@ function createHoverEvent(visualElement, isActive, callback) {
|
|
|
8
8
|
var _a;
|
|
9
9
|
if (!isMouseEvent(event) || isDragActive())
|
|
10
10
|
return;
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Ensure we trigger animations before firing event callback
|
|
13
|
+
*/
|
|
12
14
|
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Hover, isActive);
|
|
15
|
+
callback === null || callback === void 0 ? void 0 : callback(event, info);
|
|
13
16
|
};
|
|
14
17
|
}
|
|
15
18
|
function useHoverGesture(_a) {
|
|
@@ -50,8 +50,11 @@ function useTapGesture(_a) {
|
|
|
50
50
|
return;
|
|
51
51
|
isPressing.current = true;
|
|
52
52
|
cancelPointerEndListeners.current = pipe(addPointerEvent(window, "pointerup", onPointerUp), addPointerEvent(window, "pointercancel", onPointerCancel));
|
|
53
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Ensure we trigger animations before firing event callback
|
|
55
|
+
*/
|
|
54
56
|
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, true);
|
|
57
|
+
onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);
|
|
55
58
|
}
|
|
56
59
|
usePointerEvent(visualElement, "pointerdown", hasPressListeners ? onPointerDown : undefined);
|
|
57
60
|
useUnmountEffect(removePointerEndListener);
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
function isMouseEvent(event) {
|
|
2
|
-
// PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
|
|
3
|
-
if (typeof PointerEvent !== "undefined" && event instanceof PointerEvent) {
|
|
4
|
-
return !!(event.pointerType === "mouse");
|
|
5
|
-
}
|
|
6
|
-
return event instanceof MouseEvent;
|
|
7
|
-
}
|
|
8
1
|
function isTouchEvent(event) {
|
|
9
2
|
var hasTouches = !!event.touches;
|
|
10
3
|
return hasTouches;
|
|
11
4
|
}
|
|
12
5
|
|
|
13
|
-
export {
|
|
6
|
+
export { isTouchEvent };
|
package/dist/es/index.mjs
CHANGED
|
@@ -31,6 +31,7 @@ export { useDomEvent } from './events/use-dom-event.mjs';
|
|
|
31
31
|
export { createMotionComponent } from './motion/index.mjs';
|
|
32
32
|
export { visualElement } from './render/index.mjs';
|
|
33
33
|
export { addScaleCorrector } from './projection/styles/scale-correction.mjs';
|
|
34
|
+
export { useInstantTransition } from './utils/use-instant-transition.mjs';
|
|
34
35
|
export { useInstantLayoutTransition } from './projection/use-instant-layout-transition.mjs';
|
|
35
36
|
export { useResetProjection } from './projection/use-reset-projection.mjs';
|
|
36
37
|
export { MotionConfigContext } from './context/MotionConfigContext.mjs';
|
|
@@ -59,7 +59,7 @@ function useIntersectionObserver(shouldObserve, state, visualElement, _a) {
|
|
|
59
59
|
var callback = isIntersecting
|
|
60
60
|
? props.onViewportEnter
|
|
61
61
|
: props.onViewportLeave;
|
|
62
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
62
|
+
callback === null || callback === void 0 ? void 0 : callback(entry);
|
|
63
63
|
};
|
|
64
64
|
return observeIntersection(visualElement.getInstance(), options, intersectionCallback);
|
|
65
65
|
}, [shouldObserve, root, rootMargin, amount]);
|
|
@@ -88,7 +88,7 @@ function useMissingIntersectionObserver(shouldObserve, state, visualElement) {
|
|
|
88
88
|
var _a;
|
|
89
89
|
state.hasEnteredView = true;
|
|
90
90
|
var onViewportEnter = visualElement.getProps().onViewportEnter;
|
|
91
|
-
onViewportEnter === null || onViewportEnter === void 0 ? void 0 : onViewportEnter();
|
|
91
|
+
onViewportEnter === null || onViewportEnter === void 0 ? void 0 : onViewportEnter(null);
|
|
92
92
|
(_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.InView, true);
|
|
93
93
|
});
|
|
94
94
|
}, [shouldObserve]);
|
package/dist/es/motion/index.mjs
CHANGED
|
@@ -78,7 +78,7 @@ function createMotionComponent(_a) {
|
|
|
78
78
|
*/
|
|
79
79
|
return (React.createElement(VisualElementHandler, { visualElement: context.visualElement, props: __assign(__assign({}, config), props) },
|
|
80
80
|
features,
|
|
81
|
-
React.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, config.isStatic))));
|
|
81
|
+
React.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, config.isStatic, context.visualElement))));
|
|
82
82
|
}
|
|
83
83
|
return forwardRef(MotionComponent);
|
|
84
84
|
}
|
|
@@ -18,13 +18,17 @@ function makeState(_a, props, context, presenceContext) {
|
|
|
18
18
|
}
|
|
19
19
|
return state;
|
|
20
20
|
}
|
|
21
|
-
var makeUseVisualState = function (config) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
var makeUseVisualState = function (config) {
|
|
22
|
+
return function (props, isStatic) {
|
|
23
|
+
var context = useContext(MotionContext);
|
|
24
|
+
var presenceContext = useContext(PresenceContext);
|
|
25
|
+
return isStatic
|
|
26
|
+
? makeState(config, props, context, presenceContext)
|
|
27
|
+
: useConstant(function () {
|
|
28
|
+
return makeState(config, props, context, presenceContext);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
};
|
|
28
32
|
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
29
33
|
var values = {};
|
|
30
34
|
var blockInitialAnimation = (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false;
|
|
@@ -42,7 +46,8 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
|
42
46
|
initial !== null && initial !== void 0 ? initial : (initial = context.initial);
|
|
43
47
|
animate !== null && animate !== void 0 ? animate : (animate = context.animate);
|
|
44
48
|
}
|
|
45
|
-
var
|
|
49
|
+
var initialAnimationIsBlocked = blockInitialAnimation || initial === false;
|
|
50
|
+
var variantToSet = initialAnimationIsBlocked ? animate : initial;
|
|
46
51
|
if (variantToSet &&
|
|
47
52
|
typeof variantToSet !== "boolean" &&
|
|
48
53
|
!isAnimationControls(variantToSet)) {
|
|
@@ -52,8 +57,22 @@ function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
|
52
57
|
if (!resolved)
|
|
53
58
|
return;
|
|
54
59
|
var transitionEnd = resolved.transitionEnd; resolved.transition; var target = __rest(resolved, ["transitionEnd", "transition"]);
|
|
55
|
-
for (var key in target)
|
|
56
|
-
|
|
60
|
+
for (var key in target) {
|
|
61
|
+
var valueTarget = target[key];
|
|
62
|
+
if (Array.isArray(valueTarget)) {
|
|
63
|
+
/**
|
|
64
|
+
* Take final keyframe if the initial animation is blocked because
|
|
65
|
+
* we want to initialise at the end of that blocked animation.
|
|
66
|
+
*/
|
|
67
|
+
var index = initialAnimationIsBlocked
|
|
68
|
+
? valueTarget.length - 1
|
|
69
|
+
: 0;
|
|
70
|
+
valueTarget = valueTarget[index];
|
|
71
|
+
}
|
|
72
|
+
if (valueTarget !== null) {
|
|
73
|
+
values[key] = valueTarget;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
57
76
|
for (var key in transitionEnd)
|
|
58
77
|
values[key] = transitionEnd[key];
|
|
59
78
|
});
|
|
@@ -18,7 +18,7 @@ function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnl
|
|
|
18
18
|
* Mix border radius
|
|
19
19
|
*/
|
|
20
20
|
for (var i = 0; i < numBorders; i++) {
|
|
21
|
-
var borderLabel = "border"
|
|
21
|
+
var borderLabel = "border".concat(borders[i], "Radius");
|
|
22
22
|
var followRadius = getRadius(follow, borderLabel);
|
|
23
23
|
var leadRadius = getRadius(lead, borderLabel);
|
|
24
24
|
if (followRadius === undefined && leadRadius === undefined)
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
var createAxisDelta = function () { return ({
|
|
2
|
-
translate: 0,
|
|
3
|
-
scale: 1,
|
|
4
|
-
origin: 0,
|
|
5
|
-
originPoint: 0,
|
|
6
|
-
}); };
|
|
7
|
-
var createDelta = function () { return ({
|
|
8
|
-
x: createAxisDelta(),
|
|
9
|
-
y: createAxisDelta(),
|
|
10
|
-
}); };
|
|
11
1
|
var createAxis = function () { return ({ min: 0, max: 0 }); };
|
|
12
2
|
var createBox = function () { return ({
|
|
13
3
|
x: createAxis(),
|
|
14
4
|
y: createAxis(),
|
|
15
5
|
}); };
|
|
16
6
|
|
|
17
|
-
export { createAxis,
|
|
7
|
+
export { createAxis, createBox };
|