framer-motion 10.2.4 → 10.2.5
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/dom-entry.js +1 -1
- package/dist/cjs/index.js +23 -7
- package/dist/cjs/{wrap-62da7859.js → wrap-0d5542ae.js} +19 -19
- package/dist/es/projection/node/create-projection-node.mjs +22 -5
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +3114 -3098
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/projection.dev.js +24 -7
- package/dist/three-entry.d.ts +2 -1
- package/package.json +6 -6
package/dist/cjs/dom-entry.js
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var wrap = require('./wrap-
|
|
6
|
+
var wrap = require('./wrap-0d5542ae.js');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
@@ -4227,10 +4227,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
4227
4227
|
this.target = undefined;
|
|
4228
4228
|
this.isLayoutDirty = false;
|
|
4229
4229
|
}
|
|
4230
|
-
|
|
4231
|
-
* Frame calculations
|
|
4232
|
-
*/
|
|
4233
|
-
resolveTargetDelta() {
|
|
4230
|
+
resolveTargetDelta(forceRecalculation = false) {
|
|
4234
4231
|
var _a;
|
|
4235
4232
|
/**
|
|
4236
4233
|
* Once the dirty status of nodes has been spread through the tree, we also
|
|
@@ -4246,7 +4243,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
4246
4243
|
* We don't use transform for this step of processing so we don't
|
|
4247
4244
|
* need to check whether any nodes have changed transform.
|
|
4248
4245
|
*/
|
|
4249
|
-
const canSkip = !(
|
|
4246
|
+
const canSkip = !(forceRecalculation ||
|
|
4247
|
+
(isShared && this.isSharedProjectionDirty) ||
|
|
4250
4248
|
this.isProjectionDirty ||
|
|
4251
4249
|
((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
|
|
4252
4250
|
this.attemptToResolveRelativeTarget);
|
|
@@ -4258,6 +4256,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
4258
4256
|
*/
|
|
4259
4257
|
if (!this.layout || !(layout || layoutId))
|
|
4260
4258
|
return;
|
|
4259
|
+
this.resolvedRelativeTargetAt = wrap.frameData.timestamp;
|
|
4261
4260
|
/**
|
|
4262
4261
|
* If we don't have a targetDelta but do have a layout, we can attempt to resolve
|
|
4263
4262
|
* a relativeParent. This will allow a component to perform scale correction
|
|
@@ -4298,6 +4297,16 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
4298
4297
|
this.relativeTargetOrigin &&
|
|
4299
4298
|
this.relativeParent &&
|
|
4300
4299
|
this.relativeParent.target) {
|
|
4300
|
+
/**
|
|
4301
|
+
* If the parent target isn't up-to-date, force it to update.
|
|
4302
|
+
* This is an unfortunate de-optimisation as it means any updating relative
|
|
4303
|
+
* projection will cause all the relative parents to recalculate back
|
|
4304
|
+
* up the tree.
|
|
4305
|
+
*/
|
|
4306
|
+
if (this.relativeParent.resolvedRelativeTargetAt !==
|
|
4307
|
+
wrap.frameData.timestamp) {
|
|
4308
|
+
this.relativeParent.resolveTargetDelta(true);
|
|
4309
|
+
}
|
|
4301
4310
|
calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
|
|
4302
4311
|
/**
|
|
4303
4312
|
* If we've only got a targetDelta, resolve it into a target
|
|
@@ -4384,6 +4393,13 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
4384
4393
|
(this.isSharedProjectionDirty || this.isTransformDirty)) {
|
|
4385
4394
|
canSkip = false;
|
|
4386
4395
|
}
|
|
4396
|
+
/**
|
|
4397
|
+
* If we have resolved the target this frame we must recalculate the
|
|
4398
|
+
* projection to ensure it visually represents the internal calculations.
|
|
4399
|
+
*/
|
|
4400
|
+
if (this.resolvedRelativeTargetAt === wrap.frameData.timestamp) {
|
|
4401
|
+
canSkip = false;
|
|
4402
|
+
}
|
|
4387
4403
|
if (canSkip)
|
|
4388
4404
|
return;
|
|
4389
4405
|
const { layout, layoutId } = this.options;
|
|
@@ -5516,7 +5532,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
5516
5532
|
* and warn against mismatches.
|
|
5517
5533
|
*/
|
|
5518
5534
|
if (process.env.NODE_ENV === "development") {
|
|
5519
|
-
wrap.warnOnce(nextValue.version === "10.2.
|
|
5535
|
+
wrap.warnOnce(nextValue.version === "10.2.5", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.5 may not work as expected.`);
|
|
5520
5536
|
}
|
|
5521
5537
|
}
|
|
5522
5538
|
else if (wrap.isMotionValue(prevValue)) {
|
|
@@ -404,7 +404,7 @@ class MotionValue {
|
|
|
404
404
|
* This will be replaced by the build step with the latest version number.
|
|
405
405
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
406
406
|
*/
|
|
407
|
-
this.version = "10.2.
|
|
407
|
+
this.version = "10.2.5";
|
|
408
408
|
/**
|
|
409
409
|
* Duration, in milliseconds, since last updating frame.
|
|
410
410
|
*
|
|
@@ -2365,24 +2365,6 @@ function delay(callback, timeout) {
|
|
|
2365
2365
|
return () => cancelSync.read(checkElapsed);
|
|
2366
2366
|
}
|
|
2367
2367
|
|
|
2368
|
-
const isCustomValueType = (v) => {
|
|
2369
|
-
return typeof v === "object" && v.mix;
|
|
2370
|
-
};
|
|
2371
|
-
const getMixer = (v) => (isCustomValueType(v) ? v.mix : undefined);
|
|
2372
|
-
function transform(...args) {
|
|
2373
|
-
const useImmediate = !Array.isArray(args[0]);
|
|
2374
|
-
const argOffset = useImmediate ? 0 : -1;
|
|
2375
|
-
const inputValue = args[0 + argOffset];
|
|
2376
|
-
const inputRange = args[1 + argOffset];
|
|
2377
|
-
const outputRange = args[2 + argOffset];
|
|
2378
|
-
const options = args[3 + argOffset];
|
|
2379
|
-
const interpolator = interpolate(inputRange, outputRange, {
|
|
2380
|
-
mixer: getMixer(outputRange[0]),
|
|
2381
|
-
...options,
|
|
2382
|
-
});
|
|
2383
|
-
return useImmediate ? interpolator(inputValue) : interpolator;
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
2368
|
function resolveElements(elements, selectorCache) {
|
|
2387
2369
|
var _a;
|
|
2388
2370
|
if (typeof elements === "string") {
|
|
@@ -2858,6 +2840,24 @@ function inView(elementOrSelector, onStart, { root, margin: rootMargin, amount =
|
|
|
2858
2840
|
return () => observer.disconnect();
|
|
2859
2841
|
}
|
|
2860
2842
|
|
|
2843
|
+
const isCustomValueType = (v) => {
|
|
2844
|
+
return typeof v === "object" && v.mix;
|
|
2845
|
+
};
|
|
2846
|
+
const getMixer = (v) => (isCustomValueType(v) ? v.mix : undefined);
|
|
2847
|
+
function transform(...args) {
|
|
2848
|
+
const useImmediate = !Array.isArray(args[0]);
|
|
2849
|
+
const argOffset = useImmediate ? 0 : -1;
|
|
2850
|
+
const inputValue = args[0 + argOffset];
|
|
2851
|
+
const inputRange = args[1 + argOffset];
|
|
2852
|
+
const outputRange = args[2 + argOffset];
|
|
2853
|
+
const options = args[3 + argOffset];
|
|
2854
|
+
const interpolator = interpolate(inputRange, outputRange, {
|
|
2855
|
+
mixer: getMixer(outputRange[0]),
|
|
2856
|
+
...options,
|
|
2857
|
+
});
|
|
2858
|
+
return useImmediate ? interpolator(inputValue) : interpolator;
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
2861
|
const wrap = (min, max, v) => {
|
|
2862
2862
|
const rangeSize = max - min;
|
|
2863
2863
|
return ((((v - min) % rangeSize) + rangeSize) % rangeSize) + min;
|
|
@@ -20,6 +20,7 @@ import { globalProjectionState } from './state.mjs';
|
|
|
20
20
|
import { delay } from '../../utils/delay.mjs';
|
|
21
21
|
import { mix } from '../../utils/mix.mjs';
|
|
22
22
|
import { record } from '../../debug/record.mjs';
|
|
23
|
+
import { frameData } from '../../frameloop/data.mjs';
|
|
23
24
|
|
|
24
25
|
const transformAxes = ["", "X", "Y", "Z"];
|
|
25
26
|
/**
|
|
@@ -629,10 +630,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
629
630
|
this.target = undefined;
|
|
630
631
|
this.isLayoutDirty = false;
|
|
631
632
|
}
|
|
632
|
-
|
|
633
|
-
* Frame calculations
|
|
634
|
-
*/
|
|
635
|
-
resolveTargetDelta() {
|
|
633
|
+
resolveTargetDelta(forceRecalculation = false) {
|
|
636
634
|
var _a;
|
|
637
635
|
/**
|
|
638
636
|
* Once the dirty status of nodes has been spread through the tree, we also
|
|
@@ -648,7 +646,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
648
646
|
* We don't use transform for this step of processing so we don't
|
|
649
647
|
* need to check whether any nodes have changed transform.
|
|
650
648
|
*/
|
|
651
|
-
const canSkip = !(
|
|
649
|
+
const canSkip = !(forceRecalculation ||
|
|
650
|
+
(isShared && this.isSharedProjectionDirty) ||
|
|
652
651
|
this.isProjectionDirty ||
|
|
653
652
|
((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
|
|
654
653
|
this.attemptToResolveRelativeTarget);
|
|
@@ -660,6 +659,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
660
659
|
*/
|
|
661
660
|
if (!this.layout || !(layout || layoutId))
|
|
662
661
|
return;
|
|
662
|
+
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
663
663
|
/**
|
|
664
664
|
* If we don't have a targetDelta but do have a layout, we can attempt to resolve
|
|
665
665
|
* a relativeParent. This will allow a component to perform scale correction
|
|
@@ -700,6 +700,16 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
700
700
|
this.relativeTargetOrigin &&
|
|
701
701
|
this.relativeParent &&
|
|
702
702
|
this.relativeParent.target) {
|
|
703
|
+
/**
|
|
704
|
+
* If the parent target isn't up-to-date, force it to update.
|
|
705
|
+
* This is an unfortunate de-optimisation as it means any updating relative
|
|
706
|
+
* projection will cause all the relative parents to recalculate back
|
|
707
|
+
* up the tree.
|
|
708
|
+
*/
|
|
709
|
+
if (this.relativeParent.resolvedRelativeTargetAt !==
|
|
710
|
+
frameData.timestamp) {
|
|
711
|
+
this.relativeParent.resolveTargetDelta(true);
|
|
712
|
+
}
|
|
703
713
|
calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
|
|
704
714
|
/**
|
|
705
715
|
* If we've only got a targetDelta, resolve it into a target
|
|
@@ -786,6 +796,13 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
786
796
|
(this.isSharedProjectionDirty || this.isTransformDirty)) {
|
|
787
797
|
canSkip = false;
|
|
788
798
|
}
|
|
799
|
+
/**
|
|
800
|
+
* If we have resolved the target this frame we must recalculate the
|
|
801
|
+
* projection to ensure it visually represents the internal calculations.
|
|
802
|
+
*/
|
|
803
|
+
if (this.resolvedRelativeTargetAt === frameData.timestamp) {
|
|
804
|
+
canSkip = false;
|
|
805
|
+
}
|
|
789
806
|
if (canSkip)
|
|
790
807
|
return;
|
|
791
808
|
const { layout, layoutId } = this.options;
|
|
@@ -22,7 +22,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
22
22
|
* and warn against mismatches.
|
|
23
23
|
*/
|
|
24
24
|
if (process.env.NODE_ENV === "development") {
|
|
25
|
-
warnOnce(nextValue.version === "10.2.
|
|
25
|
+
warnOnce(nextValue.version === "10.2.5", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.2.5 may not work as expected.`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ class MotionValue {
|
|
|
26
26
|
* This will be replaced by the build step with the latest version number.
|
|
27
27
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
28
28
|
*/
|
|
29
|
-
this.version = "10.2.
|
|
29
|
+
this.version = "10.2.5";
|
|
30
30
|
/**
|
|
31
31
|
* Duration, in milliseconds, since last updating frame.
|
|
32
32
|
*
|