@tamagui/animations-motion 1.132.10 → 1.132.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/createAnimations.cjs +47 -65
- package/dist/cjs/createAnimations.js +47 -55
- package/dist/cjs/createAnimations.js.map +2 -2
- package/dist/cjs/createAnimations.native.js +51 -71
- package/dist/cjs/createAnimations.native.js.map +2 -2
- package/dist/esm/createAnimations.js +47 -55
- package/dist/esm/createAnimations.js.map +2 -2
- package/dist/esm/createAnimations.mjs +47 -65
- package/dist/esm/createAnimations.mjs.map +1 -1
- package/dist/esm/createAnimations.native.js +49 -72
- package/dist/esm/createAnimations.native.js.map +1 -1
- package/package.json +4 -4
- package/src/createAnimations.tsx +109 -122
- package/types/createAnimations.d.ts.map +2 -2
|
@@ -72,7 +72,7 @@ function createAnimations(animationsProp) {
|
|
|
72
72
|
sendExitComplete = presence?.[1],
|
|
73
73
|
isFirstRender = (0, import_react2.useRef)(!0),
|
|
74
74
|
[scope, animate] = (0, import_react.useAnimate)(),
|
|
75
|
-
|
|
75
|
+
lastDoAnimate = (0, import_react2.useRef)(null),
|
|
76
76
|
controls = (0, import_react2.useRef)(null),
|
|
77
77
|
styleKey = JSON.stringify(style),
|
|
78
78
|
shouldDebug =
|
|
@@ -85,67 +85,53 @@ function createAnimations(animationsProp) {
|
|
|
85
85
|
} = (0, import_react2.useMemo)(() => getMotionAnimatedProps(props, style, disableAnimation), [isExiting, animationKey, styleKey]),
|
|
86
86
|
animationsQueue = (0, import_react2.useRef)([]),
|
|
87
87
|
lastAnimateAt = (0, import_react2.useRef)(0),
|
|
88
|
-
minTimeBetweenAnimations = 16.667,
|
|
89
88
|
disposed = (0, import_react2.useRef)(!1),
|
|
90
89
|
[firstRenderStyle] = (0, import_react2.useState)(style),
|
|
91
90
|
lastDontAnimate = (0, import_react2.useRef)(firstRenderStyle);
|
|
92
91
|
(0, import_react2.useLayoutEffect)(() => () => {
|
|
93
92
|
disposed.current = !0;
|
|
94
93
|
}, []);
|
|
95
|
-
const
|
|
96
|
-
const waitForNextAnimationFrame = () => {
|
|
97
|
-
const queue = animationsQueue.current,
|
|
98
|
-
last = queue[queue.length - 1];
|
|
99
|
-
if (animationsQueue.current = [], !last) {
|
|
100
|
-
console.error("Should never hit");
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (!props2) return;
|
|
104
|
-
const elapsed = Date.now() - lastAnimateAt.current;
|
|
105
|
-
elapsed > minTimeBetweenAnimations && animationsQueue.current.length && console.info("slow", elapsed, {
|
|
106
|
-
props: props2
|
|
107
|
-
}), scope.current ? flushAnimation(props2) : disposed.current || requestAnimationFrame(waitForNextAnimationFrame);
|
|
108
|
-
},
|
|
109
|
-
hasQueue = animationsQueue.current.length,
|
|
110
|
-
shouldWait = hasQueue || lastAnimateAt.current && Date.now() - lastAnimateAt.current > minTimeBetweenAnimations;
|
|
111
|
-
isExiting || isFirstRender.current || scope.current && !shouldWait ? flushAnimation(props2) : (animationsQueue.current.push(props2), hasQueue || waitForNextAnimationFrame());
|
|
112
|
-
},
|
|
113
|
-
updateFirstAnimationStyle = () => stateRef.current.host instanceof HTMLElement ? lastAnimationStyle.current ? !1 : (lastAnimationStyle.current = style, animate(scope.current, doAnimate || {}, {
|
|
94
|
+
const updateFirstAnimationStyle = () => stateRef.current.host instanceof HTMLElement ? lastDoAnimate.current ? !1 : (lastAnimateAt.current = Date.now(), lastDoAnimate.current = doAnimate || {}, animate(scope.current, doAnimate || {}, {
|
|
114
95
|
type: !1
|
|
115
|
-
}).complete(),
|
|
96
|
+
}).complete(), shouldDebug && (console.groupCollapsed("[motion] \u{1F30A} FIRST"), console.info(doAnimate), console.groupEnd()), !0) : !1,
|
|
116
97
|
flushAnimation = ({
|
|
117
|
-
doAnimate: doAnimate2,
|
|
118
|
-
|
|
119
|
-
|
|
98
|
+
doAnimate: doAnimate2 = {},
|
|
99
|
+
animationOptions: animationOptions2 = {},
|
|
100
|
+
dontAnimate: dontAnimate2
|
|
120
101
|
}) => {
|
|
121
102
|
try {
|
|
122
103
|
const node = stateRef.current.host;
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const curDontAnimate = lastDontAnimate.current;
|
|
127
|
-
if (node && curDontAnimate) {
|
|
128
|
-
for (const key in curDontAnimate) key in style || (console.info("deleting!", key, {
|
|
129
|
-
dontAnimate: dontAnimate2,
|
|
130
|
-
doAnimate: doAnimate2
|
|
131
|
-
}), delete node.style[key]);
|
|
132
|
-
const newDontAnimate = getDiff(curDontAnimate, dontAnimate2);
|
|
133
|
-
newDontAnimate && Object.assign(node.style, newDontAnimate);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
if (lastDontAnimate.current = dontAnimate2 || {}, updateFirstAnimationStyle()) return;
|
|
137
|
-
const diff = getDiff(lastAnimationStyle.current, next);
|
|
138
|
-
if (shouldDebug && (console.groupCollapsed(`[motion] \u{1F30A} animate (${JSON.stringify(diff, null, 2)})`), console.info({
|
|
139
|
-
next,
|
|
104
|
+
if (shouldDebug && (console.groupCollapsed(`[motion] \u{1F30A} animate (${JSON.stringify(getDiff(lastDoAnimate.current, doAnimate2), null, 2)})`), console.info({
|
|
105
|
+
doAnimate: doAnimate2,
|
|
106
|
+
dontAnimate: dontAnimate2,
|
|
140
107
|
animationOptions: animationOptions2,
|
|
141
108
|
animationProps,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
109
|
+
lastDoAnimate: {
|
|
110
|
+
...lastDoAnimate.current
|
|
111
|
+
},
|
|
112
|
+
lastDontAnimate: {
|
|
113
|
+
...lastDontAnimate.current
|
|
145
114
|
},
|
|
146
|
-
isExiting
|
|
147
|
-
|
|
148
|
-
|
|
115
|
+
isExiting,
|
|
116
|
+
style,
|
|
117
|
+
node
|
|
118
|
+
}), console.groupCollapsed("trace >"), console.trace(), console.groupEnd(), console.groupEnd()), !(node instanceof HTMLElement)) return;
|
|
119
|
+
if (dontAnimate2) {
|
|
120
|
+
const prev = lastDontAnimate.current;
|
|
121
|
+
if (prev) {
|
|
122
|
+
removeRemovedStyles(prev, dontAnimate2, node);
|
|
123
|
+
const changed = getDiff(prev, dontAnimate2);
|
|
124
|
+
changed && Object.assign(node.style, changed);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (lastDontAnimate.current = dontAnimate2 || {}, doAnimate2) {
|
|
128
|
+
if (updateFirstAnimationStyle()) return;
|
|
129
|
+
const lastAnimated = lastDoAnimate.current;
|
|
130
|
+
lastAnimated && removeRemovedStyles(lastAnimated, doAnimate2, node);
|
|
131
|
+
const diff = getDiff(lastDoAnimate.current, doAnimate2);
|
|
132
|
+
diff && (controls.current = animate(scope.current, diff, animationOptions2));
|
|
133
|
+
}
|
|
134
|
+
lastDoAnimate.current = doAnimate2, lastAnimateAt.current = Date.now();
|
|
149
135
|
} finally {
|
|
150
136
|
isExiting && (controls.current ? controls.current.finished.then(() => {
|
|
151
137
|
sendExitComplete?.();
|
|
@@ -154,36 +140,29 @@ function createAnimations(animationsProp) {
|
|
|
154
140
|
};
|
|
155
141
|
useStyleEmitter?.(nextStyle => {
|
|
156
142
|
const animationProps2 = getMotionAnimatedProps(props, nextStyle, disableAnimation);
|
|
157
|
-
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const animateKey = JSON.stringify(doAnimate);
|
|
162
|
-
(0, import_core.useIsomorphicLayoutEffect)(() => {
|
|
143
|
+
flushAnimation(animationProps2);
|
|
144
|
+
});
|
|
145
|
+
const animateKey = JSON.stringify(style);
|
|
146
|
+
return (0, import_core.useIsomorphicLayoutEffect)(() => {
|
|
163
147
|
if (isFirstRender.current) {
|
|
164
|
-
updateFirstAnimationStyle(), isFirstRender.current = !1;
|
|
148
|
+
updateFirstAnimationStyle(), isFirstRender.current = !1, lastDontAnimate.current = dontAnimate, lastDoAnimate.current = doAnimate || {};
|
|
165
149
|
return;
|
|
166
150
|
}
|
|
167
|
-
|
|
151
|
+
animationsQueue.current = [], flushAnimation({
|
|
168
152
|
doAnimate,
|
|
169
153
|
dontAnimate,
|
|
170
154
|
animationOptions
|
|
171
|
-
})
|
|
172
|
-
}, [animateKey, isExiting,
|
|
173
|
-
const [initialStyle] = (0, import_react2.useState)(() => ({
|
|
174
|
-
...dontAnimate,
|
|
175
|
-
...doAnimate
|
|
176
|
-
}));
|
|
177
|
-
return shouldDebug && (console.groupCollapsed("[motion] \u{1F30A} render"), console.info({
|
|
155
|
+
});
|
|
156
|
+
}, [animateKey, isExiting]), shouldDebug && (console.groupCollapsed("[motion] \u{1F30A} render"), console.info({
|
|
178
157
|
style,
|
|
179
158
|
doAnimate,
|
|
180
159
|
dontAnimate,
|
|
181
160
|
animateKey,
|
|
182
161
|
scope,
|
|
183
162
|
animationOptions,
|
|
184
|
-
initialStyle,
|
|
185
163
|
isExiting,
|
|
186
|
-
isFirstRender: isFirstRender.current
|
|
164
|
+
isFirstRender: isFirstRender.current,
|
|
165
|
+
animationProps
|
|
187
166
|
}), console.groupEnd()), {
|
|
188
167
|
// we never change this, after first render on
|
|
189
168
|
style: firstRenderStyle,
|
|
@@ -265,6 +244,9 @@ function createAnimations(animationsProp) {
|
|
|
265
244
|
};
|
|
266
245
|
}
|
|
267
246
|
}
|
|
247
|
+
function removeRemovedStyles(prev, next, node) {
|
|
248
|
+
for (const key in prev) key in next || (node.style[key] = "");
|
|
249
|
+
}
|
|
268
250
|
const disableAnimationProps = /* @__PURE__ */new Set(["alignContent", "alignItems", "aspectRatio", "backdropFilter", "boxSizing", "contain", "display", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "justifyContent", "marginRight", "marginLeft", "marginBottom", "marginTop", "maxHeight", "maxWidth", "minHeight", "minWidth", "outlineColor", "outlineStyle", "outlineWidth", "overflow", "overflowX", "overflowY", "pointerEvents", "position", "textWrap", "transformOrigin", "zIndex", "WebkitBackdropFilter"]),
|
|
269
251
|
MotionView = createMotionView("div"),
|
|
270
252
|
MotionText = createMotionView("span");
|
|
@@ -46,7 +46,7 @@ function createAnimations(animationsProp) {
|
|
|
46
46
|
usePresence: import_use_presence.usePresence,
|
|
47
47
|
ResetPresence: import_use_presence.ResetPresence,
|
|
48
48
|
useAnimations: (animationProps) => {
|
|
49
|
-
const { props, style, componentState, stateRef, useStyleEmitter, presence } = animationProps, animationKey = Array.isArray(props.animation) ? props.animation[0] : props.animation, disableAnimation = componentState.unmounted === !0 || !animationKey, isExiting = presence?.[0] === !1, sendExitComplete = presence?.[1], isFirstRender = (0, import_react2.useRef)(!0), [scope, animate] = (0, import_react.useAnimate)(),
|
|
49
|
+
const { props, style, componentState, stateRef, useStyleEmitter, presence } = animationProps, animationKey = Array.isArray(props.animation) ? props.animation[0] : props.animation, disableAnimation = componentState.unmounted === !0 || !animationKey, isExiting = presence?.[0] === !1, sendExitComplete = presence?.[1], isFirstRender = (0, import_react2.useRef)(!0), [scope, animate] = (0, import_react.useAnimate)(), lastDoAnimate = (0, import_react2.useRef)(null), controls = (0, import_react2.useRef)(null), styleKey = JSON.stringify(style), shouldDebug = (
|
|
50
50
|
// process.env.NODE_ENV === 'development' &&
|
|
51
51
|
props.debug && props.debug !== "profile"
|
|
52
52
|
), {
|
|
@@ -57,58 +57,50 @@ function createAnimations(animationsProp) {
|
|
|
57
57
|
props,
|
|
58
58
|
style,
|
|
59
59
|
disableAnimation
|
|
60
|
-
), [isExiting, animationKey, styleKey]), animationsQueue = (0, import_react2.useRef)([]), lastAnimateAt = (0, import_react2.useRef)(0),
|
|
60
|
+
), [isExiting, animationKey, styleKey]), animationsQueue = (0, import_react2.useRef)([]), lastAnimateAt = (0, import_react2.useRef)(0), disposed = (0, import_react2.useRef)(!1), [firstRenderStyle] = (0, import_react2.useState)(style), lastDontAnimate = (0, import_react2.useRef)(firstRenderStyle);
|
|
61
61
|
(0, import_react2.useLayoutEffect)(() => () => {
|
|
62
62
|
disposed.current = !0;
|
|
63
63
|
}, []);
|
|
64
|
-
const
|
|
65
|
-
const waitForNextAnimationFrame = () => {
|
|
66
|
-
const queue = animationsQueue.current, last = queue[queue.length - 1];
|
|
67
|
-
if (animationsQueue.current = [], !last) {
|
|
68
|
-
console.error("Should never hit");
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (!props2) return;
|
|
72
|
-
const elapsed = Date.now() - lastAnimateAt.current;
|
|
73
|
-
elapsed > minTimeBetweenAnimations && animationsQueue.current.length && console.info("slow", elapsed, { props: props2 }), scope.current ? flushAnimation(props2) : disposed.current || requestAnimationFrame(waitForNextAnimationFrame);
|
|
74
|
-
}, hasQueue = animationsQueue.current.length, shouldWait = hasQueue || lastAnimateAt.current && Date.now() - lastAnimateAt.current > minTimeBetweenAnimations;
|
|
75
|
-
isExiting || isFirstRender.current || scope.current && !shouldWait ? flushAnimation(props2) : (animationsQueue.current.push(props2), hasQueue || waitForNextAnimationFrame());
|
|
76
|
-
}, updateFirstAnimationStyle = () => stateRef.current.host instanceof HTMLElement ? lastAnimationStyle.current ? !1 : (lastAnimationStyle.current = style, animate(scope.current, doAnimate || {}, {
|
|
64
|
+
const updateFirstAnimationStyle = () => stateRef.current.host instanceof HTMLElement ? lastDoAnimate.current ? !1 : (lastAnimateAt.current = Date.now(), lastDoAnimate.current = doAnimate || {}, animate(scope.current, doAnimate || {}, {
|
|
77
65
|
type: !1
|
|
78
|
-
}).complete(),
|
|
79
|
-
doAnimate: doAnimate2,
|
|
80
|
-
|
|
81
|
-
|
|
66
|
+
}).complete(), shouldDebug && (console.groupCollapsed("[motion] \u{1F30A} FIRST"), console.info(doAnimate), console.groupEnd()), !0) : !1, flushAnimation = ({
|
|
67
|
+
doAnimate: doAnimate2 = {},
|
|
68
|
+
animationOptions: animationOptions2 = {},
|
|
69
|
+
dontAnimate: dontAnimate2
|
|
82
70
|
}) => {
|
|
83
71
|
try {
|
|
84
72
|
const node = stateRef.current.host;
|
|
85
|
-
if (!(node instanceof HTMLElement) || !doAnimate2 && !dontAnimate2)
|
|
86
|
-
return;
|
|
87
|
-
const next = doAnimate2 || {};
|
|
88
|
-
if (dontAnimate2) {
|
|
89
|
-
const curDontAnimate = lastDontAnimate.current;
|
|
90
|
-
if (node && curDontAnimate) {
|
|
91
|
-
for (const key in curDontAnimate)
|
|
92
|
-
key in style || (console.info("deleting!", key, { dontAnimate: dontAnimate2, doAnimate: doAnimate2 }), delete node.style[key]);
|
|
93
|
-
const newDontAnimate = getDiff(curDontAnimate, dontAnimate2);
|
|
94
|
-
newDontAnimate && Object.assign(node.style, newDontAnimate);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (lastDontAnimate.current = dontAnimate2 || {}, updateFirstAnimationStyle())
|
|
98
|
-
return;
|
|
99
|
-
const diff = getDiff(lastAnimationStyle.current, next);
|
|
100
73
|
if (shouldDebug && (console.groupCollapsed(
|
|
101
|
-
`[motion] \u{1F30A} animate (${JSON.stringify(
|
|
74
|
+
`[motion] \u{1F30A} animate (${JSON.stringify(getDiff(lastDoAnimate.current, doAnimate2), null, 2)})`
|
|
102
75
|
), console.info({
|
|
103
|
-
|
|
76
|
+
doAnimate: doAnimate2,
|
|
77
|
+
dontAnimate: dontAnimate2,
|
|
104
78
|
animationOptions: animationOptions2,
|
|
105
79
|
animationProps,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
isExiting
|
|
109
|
-
|
|
80
|
+
lastDoAnimate: { ...lastDoAnimate.current },
|
|
81
|
+
lastDontAnimate: { ...lastDontAnimate.current },
|
|
82
|
+
isExiting,
|
|
83
|
+
style,
|
|
84
|
+
node
|
|
85
|
+
}), console.groupCollapsed("trace >"), console.trace(), console.groupEnd(), console.groupEnd()), !(node instanceof HTMLElement))
|
|
110
86
|
return;
|
|
111
|
-
|
|
87
|
+
if (dontAnimate2) {
|
|
88
|
+
const prev = lastDontAnimate.current;
|
|
89
|
+
if (prev) {
|
|
90
|
+
removeRemovedStyles(prev, dontAnimate2, node);
|
|
91
|
+
const changed = getDiff(prev, dontAnimate2);
|
|
92
|
+
changed && Object.assign(node.style, changed);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (lastDontAnimate.current = dontAnimate2 || {}, doAnimate2) {
|
|
96
|
+
if (updateFirstAnimationStyle())
|
|
97
|
+
return;
|
|
98
|
+
const lastAnimated = lastDoAnimate.current;
|
|
99
|
+
lastAnimated && removeRemovedStyles(lastAnimated, doAnimate2, node);
|
|
100
|
+
const diff = getDiff(lastDoAnimate.current, doAnimate2);
|
|
101
|
+
diff && (controls.current = animate(scope.current, diff, animationOptions2));
|
|
102
|
+
}
|
|
103
|
+
lastDoAnimate.current = doAnimate2, lastAnimateAt.current = Date.now();
|
|
112
104
|
} finally {
|
|
113
105
|
isExiting && (controls.current ? controls.current.finished.then(() => {
|
|
114
106
|
sendExitComplete?.();
|
|
@@ -121,33 +113,29 @@ function createAnimations(animationsProp) {
|
|
|
121
113
|
nextStyle,
|
|
122
114
|
disableAnimation
|
|
123
115
|
);
|
|
124
|
-
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const animateKey = JSON.stringify(doAnimate);
|
|
129
|
-
(0, import_core.useIsomorphicLayoutEffect)(() => {
|
|
116
|
+
flushAnimation(animationProps2);
|
|
117
|
+
});
|
|
118
|
+
const animateKey = JSON.stringify(style);
|
|
119
|
+
return (0, import_core.useIsomorphicLayoutEffect)(() => {
|
|
130
120
|
if (isFirstRender.current) {
|
|
131
|
-
updateFirstAnimationStyle(), isFirstRender.current = !1;
|
|
121
|
+
updateFirstAnimationStyle(), isFirstRender.current = !1, lastDontAnimate.current = dontAnimate, lastDoAnimate.current = doAnimate || {};
|
|
132
122
|
return;
|
|
133
123
|
}
|
|
134
|
-
|
|
124
|
+
animationsQueue.current = [], flushAnimation({
|
|
135
125
|
doAnimate,
|
|
136
126
|
dontAnimate,
|
|
137
127
|
animationOptions
|
|
138
|
-
})
|
|
139
|
-
}, [animateKey, isExiting,
|
|
140
|
-
const [initialStyle] = (0, import_react2.useState)(() => ({ ...dontAnimate, ...doAnimate }));
|
|
141
|
-
return shouldDebug && (console.groupCollapsed("[motion] \u{1F30A} render"), console.info({
|
|
128
|
+
});
|
|
129
|
+
}, [animateKey, isExiting]), shouldDebug && (console.groupCollapsed("[motion] \u{1F30A} render"), console.info({
|
|
142
130
|
style,
|
|
143
131
|
doAnimate,
|
|
144
132
|
dontAnimate,
|
|
145
133
|
animateKey,
|
|
146
134
|
scope,
|
|
147
135
|
animationOptions,
|
|
148
|
-
initialStyle,
|
|
149
136
|
isExiting,
|
|
150
|
-
isFirstRender: isFirstRender.current
|
|
137
|
+
isFirstRender: isFirstRender.current,
|
|
138
|
+
animationProps
|
|
151
139
|
}), console.groupEnd()), {
|
|
152
140
|
// we never change this, after first render on
|
|
153
141
|
style: firstRenderStyle,
|
|
@@ -239,6 +227,10 @@ function createAnimations(animationsProp) {
|
|
|
239
227
|
};
|
|
240
228
|
}
|
|
241
229
|
}
|
|
230
|
+
function removeRemovedStyles(prev, next, node) {
|
|
231
|
+
for (const key in prev)
|
|
232
|
+
key in next || (node.style[key] = "");
|
|
233
|
+
}
|
|
242
234
|
const disableAnimationProps = /* @__PURE__ */ new Set([
|
|
243
235
|
"alignContent",
|
|
244
236
|
"alignItems",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/createAnimations.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAcO,0BACP,sBAA2C,kCAC3C,eAQO,yBACPA,gBAOO,
|
|
5
|
-
"names": ["import_react", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAcO,0BACP,sBAA2C,kCAC3C,eAQO,yBACPA,gBAOO,2BAwmBI;AA9lBX,MAAM,sBAAsB,oBAAI,QAA6C;AAQtE,SAAS,iBACd,gBACoB;AAIpB,QAAM,aAAgB,CAAC;AACvB,a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,SAAS,EAAE,GAAG,WAAW,OAAO,kBAAkB,CAAC,GAC3D,UAAU,OAAO,OACjB,mBAAmB,kBAAM,oBAAoB,KAAK,OAAO,UAAU,EAAK;AAE9E,wCAAU,MAAM;AACd,UAAK;AAEL,eAAO,cAAc,YAAY,GAAG,UAAU,CAAC,UAAU;AACvD,gBAAM,YAAY,cAAc,SAAS,KAAK,GACxC,kBAAkB,oBAAoB,IAAI,cAAc,WAAW,GACnE,OAAO,QAAQ,SAEf,WAAW,SAAS,EAAE,OAAO,UAAU,CAAC,EAAE;AAEhD,cAAI,YAAY,gBAAgB,aAAa;AAC3C,kBAAM,wBACJ,iBAAiB,SAAS,WACtB;AAAA,cACE,MAAM;AAAA,cACN,WAAW,iBAAiB,YAAY,KAAK;AAAA,YAC/C,IACA,iBAAiB,SAAS,WACxB,EAAE,MAAM,SAAS,UAAU,EAAE,IAC7B;AAAA,cACE,MAAM;AAAA,cACN,GAAI;AAAA,YACN;AAER,oBAAQ,MAAM,UAAiB,qBAAqB;AAAA,UACtD;AAAA,QACF,CAAC;AAAA,IACH,GAAG,CAAC,aAAa,CAAC,GAEX,4CAAC,WAAS,GAAG,kBAAkB,KAAK,cAAc;AAAA,EAC3D,CAAC;AAED,mBAAU,gBAAmB,IAEtB;AACT;AAEA,SAAS,QACP,UACA,MACgC;AAChC,MAAI,CAAC;AACH,WAAO;AAGT,MAAI,OAAuC;AAC3C,aAAW,OAAO;AAChB,IAAI,KAAK,GAAG,MAAM,SAAS,GAAG,MAC5B,SAAS,CAAC,GACV,KAAK,GAAG,IAAI,KAAK,GAAG;AAGxB,SAAO;AACT;",
|
|
5
|
+
"names": ["import_react", "doAnimate", "animationOptions", "dontAnimate", "animationProps", "React", "props"]
|
|
6
6
|
}
|
|
@@ -46,7 +46,7 @@ function createAnimations(animationsProp) {
|
|
|
46
46
|
usePresence: import_use_presence.usePresence,
|
|
47
47
|
ResetPresence: import_use_presence.ResetPresence,
|
|
48
48
|
useAnimations: function(animationProps) {
|
|
49
|
-
var { props, style, componentState, stateRef, useStyleEmitter, presence } = animationProps, animationKey = Array.isArray(props.animation) ? props.animation[0] : props.animation, isHydrating = componentState.unmounted === !0, disableAnimation = isHydrating || !animationKey, isExiting = (presence == null ? void 0 : presence[0]) === !1, sendExitComplete = presence == null ? void 0 : presence[1], isFirstRender = (0, import_react2.useRef)(!0), [scope, animate] = (0, import_react.useAnimate)(),
|
|
49
|
+
var { props, style, componentState, stateRef, useStyleEmitter, presence } = animationProps, animationKey = Array.isArray(props.animation) ? props.animation[0] : props.animation, isHydrating = componentState.unmounted === !0, disableAnimation = isHydrating || !animationKey, isExiting = (presence == null ? void 0 : presence[0]) === !1, sendExitComplete = presence == null ? void 0 : presence[1], isFirstRender = (0, import_react2.useRef)(!0), [scope, animate] = (0, import_react.useAnimate)(), lastDoAnimate = (0, import_react2.useRef)(null), controls = (0, import_react2.useRef)(null), styleKey = JSON.stringify(style), shouldDebug = (
|
|
50
50
|
// process.env.NODE_ENV === 'development' &&
|
|
51
51
|
props.debug && props.debug !== "profile"
|
|
52
52
|
), { dontAnimate = {}, doAnimate, animationOptions } = (0, import_react2.useMemo)(function() {
|
|
@@ -56,73 +56,61 @@ function createAnimations(animationsProp) {
|
|
|
56
56
|
isExiting,
|
|
57
57
|
animationKey,
|
|
58
58
|
styleKey
|
|
59
|
-
]), animationsQueue = (0, import_react2.useRef)([]), lastAnimateAt = (0, import_react2.useRef)(0),
|
|
59
|
+
]), animationsQueue = (0, import_react2.useRef)([]), lastAnimateAt = (0, import_react2.useRef)(0), disposed = (0, import_react2.useRef)(!1), [firstRenderStyle] = (0, import_react2.useState)(style), lastDontAnimate = (0, import_react2.useRef)(firstRenderStyle);
|
|
60
60
|
(0, import_react2.useLayoutEffect)(function() {
|
|
61
61
|
return function() {
|
|
62
62
|
disposed.current = !0;
|
|
63
63
|
};
|
|
64
64
|
}, []);
|
|
65
|
-
var
|
|
66
|
-
var waitForNextAnimationFrame = function() {
|
|
67
|
-
var queue = animationsQueue.current, last = queue[queue.length - 1];
|
|
68
|
-
if (animationsQueue.current = [], !last) {
|
|
69
|
-
console.error("Should never hit");
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (props2) {
|
|
73
|
-
var elapsed = Date.now() - lastAnimateAt.current;
|
|
74
|
-
elapsed > minTimeBetweenAnimations && animationsQueue.current.length && console.info("slow", elapsed, {
|
|
75
|
-
props: props2
|
|
76
|
-
}), scope.current ? flushAnimation(props2) : disposed.current || requestAnimationFrame(waitForNextAnimationFrame);
|
|
77
|
-
}
|
|
78
|
-
}, hasQueue = animationsQueue.current.length, shouldWait = hasQueue || lastAnimateAt.current && Date.now() - lastAnimateAt.current > minTimeBetweenAnimations;
|
|
79
|
-
isExiting || isFirstRender.current || scope.current && !shouldWait ? flushAnimation(props2) : (animationsQueue.current.push(props2), hasQueue || waitForNextAnimationFrame());
|
|
80
|
-
}, updateFirstAnimationStyle = function() {
|
|
65
|
+
var updateFirstAnimationStyle = function() {
|
|
81
66
|
var node = stateRef.current.host;
|
|
82
67
|
if (!(node instanceof HTMLElement))
|
|
83
68
|
return !1;
|
|
84
|
-
if (!
|
|
85
|
-
|
|
69
|
+
if (!lastDoAnimate.current) {
|
|
70
|
+
lastAnimateAt.current = Date.now(), lastDoAnimate.current = doAnimate || {};
|
|
86
71
|
var firstAnimation = animate(scope.current, doAnimate || {}, {
|
|
87
72
|
type: !1
|
|
88
73
|
});
|
|
89
|
-
return firstAnimation.complete(),
|
|
74
|
+
return firstAnimation.complete(), shouldDebug && (console.groupCollapsed("[motion] \u{1F30A} FIRST"), console.info(doAnimate), console.groupEnd()), !0;
|
|
90
75
|
}
|
|
91
76
|
return !1;
|
|
92
77
|
}, flushAnimation = function(param) {
|
|
93
|
-
var { doAnimate: doAnimate2
|
|
78
|
+
var { doAnimate: doAnimate2 = {}, animationOptions: animationOptions2 = {}, dontAnimate: dontAnimate2 } = param;
|
|
94
79
|
try {
|
|
95
80
|
var node = stateRef.current.host;
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (dontAnimate2) {
|
|
100
|
-
var curDontAnimate = lastDontAnimate.current;
|
|
101
|
-
if (node && curDontAnimate) {
|
|
102
|
-
for (var key2 in curDontAnimate)
|
|
103
|
-
key2 in style || (console.info("deleting!", key2, {
|
|
104
|
-
dontAnimate: dontAnimate2,
|
|
105
|
-
doAnimate: doAnimate2
|
|
106
|
-
}), delete node.style[key2]);
|
|
107
|
-
var newDontAnimate = getDiff(curDontAnimate, dontAnimate2);
|
|
108
|
-
newDontAnimate && Object.assign(node.style, newDontAnimate);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (lastDontAnimate.current = dontAnimate2 || {}, updateFirstAnimationStyle())
|
|
112
|
-
return;
|
|
113
|
-
var diff = getDiff(lastAnimationStyle.current, next);
|
|
114
|
-
if (shouldDebug && (console.groupCollapsed(`[motion] \u{1F30A} animate (${JSON.stringify(diff, null, 2)})`), console.info({
|
|
115
|
-
next,
|
|
81
|
+
if (shouldDebug && (console.groupCollapsed(`[motion] \u{1F30A} animate (${JSON.stringify(getDiff(lastDoAnimate.current, doAnimate2), null, 2)})`), console.info({
|
|
82
|
+
doAnimate: doAnimate2,
|
|
83
|
+
dontAnimate: dontAnimate2,
|
|
116
84
|
animationOptions: animationOptions2,
|
|
117
85
|
animationProps,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
86
|
+
lastDoAnimate: {
|
|
87
|
+
...lastDoAnimate.current
|
|
88
|
+
},
|
|
89
|
+
lastDontAnimate: {
|
|
90
|
+
...lastDontAnimate.current
|
|
121
91
|
},
|
|
122
|
-
isExiting
|
|
123
|
-
|
|
92
|
+
isExiting,
|
|
93
|
+
style,
|
|
94
|
+
node
|
|
95
|
+
}), console.groupCollapsed("trace >"), console.trace(), console.groupEnd(), console.groupEnd()), !(node instanceof HTMLElement))
|
|
124
96
|
return;
|
|
125
|
-
|
|
97
|
+
if (dontAnimate2) {
|
|
98
|
+
var prev = lastDontAnimate.current;
|
|
99
|
+
if (prev) {
|
|
100
|
+
removeRemovedStyles(prev, dontAnimate2, node);
|
|
101
|
+
var changed = getDiff(prev, dontAnimate2);
|
|
102
|
+
changed && Object.assign(node.style, changed);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (lastDontAnimate.current = dontAnimate2 || {}, doAnimate2) {
|
|
106
|
+
if (updateFirstAnimationStyle())
|
|
107
|
+
return;
|
|
108
|
+
var lastAnimated = lastDoAnimate.current;
|
|
109
|
+
lastAnimated && removeRemovedStyles(lastAnimated, doAnimate2, node);
|
|
110
|
+
var diff = getDiff(lastDoAnimate.current, doAnimate2);
|
|
111
|
+
diff && (controls.current = animate(scope.current, diff, animationOptions2));
|
|
112
|
+
}
|
|
113
|
+
lastDoAnimate.current = doAnimate2, lastAnimateAt.current = Date.now();
|
|
126
114
|
} finally {
|
|
127
115
|
isExiting && (controls.current ? controls.current.finished.then(function() {
|
|
128
116
|
sendExitComplete == null || sendExitComplete();
|
|
@@ -131,44 +119,32 @@ function createAnimations(animationsProp) {
|
|
|
131
119
|
};
|
|
132
120
|
useStyleEmitter == null || useStyleEmitter(function(nextStyle) {
|
|
133
121
|
var _$animationProps = getMotionAnimatedProps(props, nextStyle, disableAnimation);
|
|
134
|
-
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
};
|
|
139
|
-
}, []);
|
|
140
|
-
var animateKey = JSON.stringify(doAnimate);
|
|
141
|
-
(0, import_core.useIsomorphicLayoutEffect)(function() {
|
|
122
|
+
flushAnimation(_$animationProps);
|
|
123
|
+
});
|
|
124
|
+
var animateKey = JSON.stringify(style);
|
|
125
|
+
return (0, import_core.useIsomorphicLayoutEffect)(function() {
|
|
142
126
|
if (isFirstRender.current) {
|
|
143
|
-
updateFirstAnimationStyle(), isFirstRender.current = !1;
|
|
127
|
+
updateFirstAnimationStyle(), isFirstRender.current = !1, lastDontAnimate.current = dontAnimate, lastDoAnimate.current = doAnimate || {};
|
|
144
128
|
return;
|
|
145
129
|
}
|
|
146
|
-
|
|
130
|
+
animationsQueue.current = [], flushAnimation({
|
|
147
131
|
doAnimate,
|
|
148
132
|
dontAnimate,
|
|
149
133
|
animationOptions
|
|
150
|
-
})
|
|
134
|
+
});
|
|
151
135
|
}, [
|
|
152
136
|
animateKey,
|
|
153
|
-
isExiting
|
|
154
|
-
|
|
155
|
-
]);
|
|
156
|
-
var [initialStyle] = (0, import_react2.useState)(function() {
|
|
157
|
-
return {
|
|
158
|
-
...dontAnimate,
|
|
159
|
-
...doAnimate
|
|
160
|
-
};
|
|
161
|
-
});
|
|
162
|
-
return shouldDebug && (console.groupCollapsed("[motion] \u{1F30A} render"), console.info({
|
|
137
|
+
isExiting
|
|
138
|
+
]), shouldDebug && (console.groupCollapsed("[motion] \u{1F30A} render"), console.info({
|
|
163
139
|
style,
|
|
164
140
|
doAnimate,
|
|
165
141
|
dontAnimate,
|
|
166
142
|
animateKey,
|
|
167
143
|
scope,
|
|
168
144
|
animationOptions,
|
|
169
|
-
initialStyle,
|
|
170
145
|
isExiting,
|
|
171
|
-
isFirstRender: isFirstRender.current
|
|
146
|
+
isFirstRender: isFirstRender.current,
|
|
147
|
+
animationProps
|
|
172
148
|
}), console.groupEnd()), {
|
|
173
149
|
// we never change this, after first render on
|
|
174
150
|
style: firstRenderStyle,
|
|
@@ -270,6 +246,10 @@ function createAnimations(animationsProp) {
|
|
|
270
246
|
};
|
|
271
247
|
}
|
|
272
248
|
}
|
|
249
|
+
function removeRemovedStyles(prev, next, node) {
|
|
250
|
+
for (var key in prev)
|
|
251
|
+
key in next || (node.style[key] = "");
|
|
252
|
+
}
|
|
273
253
|
var disableAnimationProps = /* @__PURE__ */ new Set([
|
|
274
254
|
"alignContent",
|
|
275
255
|
"alignItems",
|