framer-motion 12.6.2 → 12.6.3
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/{create-BLp_edji.js → create-B2InJs4e.js} +68 -115
- package/dist/cjs/dom-mini.js +14 -219
- package/dist/cjs/dom.js +56 -199
- package/dist/cjs/index.js +32 -156
- package/dist/cjs/m.js +8 -12
- package/dist/cjs/mini.js +10 -214
- package/dist/dom-mini.d.ts +3 -3
- package/dist/dom-mini.js +1 -1
- package/dist/dom.d.ts +17 -14
- package/dist/dom.js +1 -1
- package/dist/es/animation/animate/index.mjs +2 -2
- package/dist/es/animation/animators/AcceleratedAnimation.mjs +5 -3
- package/dist/es/animation/animators/MainThreadAnimation.mjs +6 -4
- package/dist/es/animation/animators/waapi/animate-elements.mjs +10 -9
- package/dist/es/animation/animators/waapi/animate-sequence.mjs +2 -2
- package/dist/es/animation/animators/waapi/animate-style.mjs +2 -2
- package/dist/es/animation/generators/spring/index.mjs +9 -1
- package/dist/es/animation/interfaces/motion-value.mjs +2 -2
- package/dist/es/animation/interfaces/visual-element-target.mjs +1 -2
- package/dist/es/animation/interfaces/visual-element-variant.mjs +1 -2
- package/dist/es/animation/optimized-appear/handoff.mjs +2 -4
- package/dist/es/animation/optimized-appear/start.mjs +4 -6
- package/dist/es/animation/sequence/create.mjs +2 -2
- package/dist/es/animation/sequence/utils/calc-time.mjs +1 -2
- package/dist/es/components/AnimatePresence/index.mjs +2 -2
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +5 -10
- package/dist/es/motion/features/animation/index.mjs +1 -2
- package/dist/es/motion/index.mjs +2 -3
- package/dist/es/motion/utils/use-visual-element.mjs +3 -5
- package/dist/es/projection/node/create-projection-node.mjs +17 -25
- package/dist/es/projection/styles/transform.mjs +1 -1
- package/dist/es/render/VisualElement.mjs +3 -4
- package/dist/es/render/dom/DOMKeyframesResolver.mjs +1 -2
- package/dist/es/render/dom/resize/handle-element.mjs +5 -6
- package/dist/es/render/dom/scroll/track.mjs +1 -2
- package/dist/es/render/dom/utils/css-variables-conversion.mjs +1 -1
- package/dist/es/render/dom/utils/filter-props.mjs +1 -1
- package/dist/es/render/html/utils/scrape-motion-values.mjs +1 -2
- package/dist/es/render/utils/KeyframesResolver.mjs +2 -3
- package/dist/es/render/utils/animation-state.mjs +3 -5
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/render/utils/resolve-variants.mjs +1 -1
- package/dist/es/utils/mix/complex.mjs +1 -2
- package/dist/es/value/types/complex/index.mjs +2 -3
- package/dist/es/value/use-scroll.mjs +2 -2
- package/dist/framer-motion.dev.js +445 -414
- package/dist/framer-motion.js +1 -1
- package/dist/mini.d.ts +1 -1
- package/dist/mini.js +1 -1
- package/dist/size-rollup-animate.js +1 -1
- package/dist/size-rollup-dom-animation-assets.js +1 -1
- package/dist/size-rollup-dom-animation-m.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max-assets.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/dist/size-rollup-scroll.js +1 -1
- package/dist/size-rollup-waapi-animate.js +1 -1
- package/dist/types/index.d.ts +28 -31
- package/package.json +4 -4
- package/dist/es/animation/animators/waapi/NativeAnimation.mjs +0 -112
- package/dist/es/animation/animators/waapi/index.mjs +0 -32
- package/dist/es/animation/animators/waapi/utils/style.mjs +0 -8
- package/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +0 -13
|
@@ -2,7 +2,6 @@ import { isForcedMotionValue } from '../../../motion/utils/is-forced-motion-valu
|
|
|
2
2
|
import { isMotionValue } from '../../../value/utils/is-motion-value.mjs';
|
|
3
3
|
|
|
4
4
|
function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
5
|
-
var _a;
|
|
6
5
|
const { style } = props;
|
|
7
6
|
const newValues = {};
|
|
8
7
|
for (const key in style) {
|
|
@@ -10,7 +9,7 @@ function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
|
10
9
|
(prevProps.style &&
|
|
11
10
|
isMotionValue(prevProps.style[key])) ||
|
|
12
11
|
isForcedMotionValue(key, props) ||
|
|
13
|
-
|
|
12
|
+
visualElement?.getValue(key)?.liveStyle !== undefined) {
|
|
14
13
|
newValues[key] = style[key];
|
|
15
14
|
}
|
|
16
15
|
}
|
|
@@ -28,8 +28,7 @@ function measureAllKeyframes() {
|
|
|
28
28
|
const restore = transformsToRestore.get(element);
|
|
29
29
|
if (restore) {
|
|
30
30
|
restore.forEach(([key, value]) => {
|
|
31
|
-
|
|
32
|
-
(_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value);
|
|
31
|
+
element.getValue(key)?.set(value);
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
34
|
});
|
|
@@ -116,7 +115,7 @@ class KeyframeResolver {
|
|
|
116
115
|
* If the first keyframe is null, we need to find its value by sampling the element
|
|
117
116
|
*/
|
|
118
117
|
if (i === 0) {
|
|
119
|
-
const currentValue = motionValue
|
|
118
|
+
const currentValue = motionValue?.get();
|
|
120
119
|
const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
121
120
|
if (currentValue !== undefined) {
|
|
122
121
|
unresolvedKeyframes[0] = currentValue;
|
|
@@ -21,9 +21,8 @@ function createAnimationState(visualElement) {
|
|
|
21
21
|
* each active animation type into an object of resolved values for it.
|
|
22
22
|
*/
|
|
23
23
|
const buildResolvedTypeValues = (type) => (acc, definition) => {
|
|
24
|
-
var _a;
|
|
25
24
|
const resolved = resolveVariant(visualElement, definition, type === "exit"
|
|
26
|
-
?
|
|
25
|
+
? visualElement.presenceContext?.custom
|
|
27
26
|
: undefined);
|
|
28
27
|
if (resolved) {
|
|
29
28
|
const { transition, transitionEnd, ...target } = resolved;
|
|
@@ -271,7 +270,7 @@ function createAnimationState(visualElement) {
|
|
|
271
270
|
if (motionValue)
|
|
272
271
|
motionValue.liveStyle = true;
|
|
273
272
|
// @ts-expect-error - @mattgperry to figure if we should do something here
|
|
274
|
-
fallbackAnimation[key] = fallbackTarget
|
|
273
|
+
fallbackAnimation[key] = fallbackTarget ?? null;
|
|
275
274
|
});
|
|
276
275
|
animations.push({ animation: fallbackAnimation });
|
|
277
276
|
}
|
|
@@ -288,12 +287,11 @@ function createAnimationState(visualElement) {
|
|
|
288
287
|
* Change whether a certain animation type is active.
|
|
289
288
|
*/
|
|
290
289
|
function setActive(type, isActive) {
|
|
291
|
-
var _a;
|
|
292
290
|
// If the active state hasn't changed, we can safely do nothing here
|
|
293
291
|
if (state[type].isActive === isActive)
|
|
294
292
|
return Promise.resolve();
|
|
295
293
|
// Propagate active change to children
|
|
296
|
-
|
|
294
|
+
visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive));
|
|
297
295
|
state[type].isActive = isActive;
|
|
298
296
|
const animations = animateChanges(type);
|
|
299
297
|
for (const key in state) {
|
|
@@ -17,7 +17,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
17
17
|
* and warn against mismatches.
|
|
18
18
|
*/
|
|
19
19
|
if (process.env.NODE_ENV === "development") {
|
|
20
|
-
warnOnce(nextValue.version === "12.6.
|
|
20
|
+
warnOnce(nextValue.version === "12.6.3", `Attempting to mix Motion versions ${nextValue.version} with 12.6.3 may not work as expected.`);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
else if (isMotionValue(prevValue)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function getValueState(visualElement) {
|
|
2
2
|
const state = [{}, {}];
|
|
3
|
-
visualElement
|
|
3
|
+
visualElement?.values.forEach((value, key) => {
|
|
4
4
|
state[0][key] = value.get();
|
|
5
5
|
state[1][key] = value.getVelocity();
|
|
6
6
|
});
|
|
@@ -57,13 +57,12 @@ function mixObject(a, b) {
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
function matchOrder(origin, target) {
|
|
60
|
-
var _a;
|
|
61
60
|
const orderedOrigin = [];
|
|
62
61
|
const pointers = { color: 0, var: 0, number: 0 };
|
|
63
62
|
for (let i = 0; i < target.values.length; i++) {
|
|
64
63
|
const type = target.types[i];
|
|
65
64
|
const originIndex = origin.indexes[type][pointers[type]];
|
|
66
|
-
const originValue =
|
|
65
|
+
const originValue = origin.values[originIndex] ?? 0;
|
|
67
66
|
orderedOrigin[i] = originValue;
|
|
68
67
|
pointers[type]++;
|
|
69
68
|
}
|
|
@@ -4,11 +4,10 @@ import { floatRegex } from '../utils/float-regex.mjs';
|
|
|
4
4
|
import { sanitize } from '../utils/sanitize.mjs';
|
|
5
5
|
|
|
6
6
|
function test(v) {
|
|
7
|
-
var _a, _b;
|
|
8
7
|
return (isNaN(v) &&
|
|
9
8
|
typeof v === "string" &&
|
|
10
|
-
(
|
|
11
|
-
(
|
|
9
|
+
(v.match(floatRegex)?.length || 0) +
|
|
10
|
+
(v.match(colorRegex)?.length || 0) >
|
|
12
11
|
0);
|
|
13
12
|
}
|
|
14
13
|
const NUMBER_TOKEN = "number";
|
|
@@ -29,8 +29,8 @@ function useScroll({ container, target, layoutEffect = true, ...options } = {})
|
|
|
29
29
|
values.scrollYProgress.set(y.progress);
|
|
30
30
|
}, {
|
|
31
31
|
...options,
|
|
32
|
-
container:
|
|
33
|
-
target:
|
|
32
|
+
container: container?.current || undefined,
|
|
33
|
+
target: target?.current || undefined,
|
|
34
34
|
});
|
|
35
35
|
}, [container, target, JSON.stringify(options.offset)]);
|
|
36
36
|
return values;
|