framer-motion 10.7.0 → 10.8.0
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 +2 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/{wrap-95f58a8f.js → wrap-d596148c.js} +35 -4
- package/dist/dom-entry.d.ts +348 -774
- package/dist/es/animation/animate.mjs +9 -2
- package/dist/es/animation/utils/stagger.mjs +26 -0
- package/dist/es/dom-entry.mjs +1 -0
- package/dist/es/index.mjs +1 -0
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +35 -4
- package/dist/framer-motion.js +1 -1
- package/dist/index.d.ts +322 -50
- package/dist/projection.dev.js +2 -2
- package/dist/three-entry.d.ts +68 -10
- package/package.json +2 -2
package/dist/cjs/dom-entry.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var wrap = require('./wrap-
|
|
5
|
+
var wrap = require('./wrap-d596148c.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -36,6 +36,7 @@ exports.motionValue = wrap.motionValue;
|
|
|
36
36
|
exports.pipe = wrap.pipe;
|
|
37
37
|
exports.progress = wrap.progress;
|
|
38
38
|
exports.scroll = wrap.scroll;
|
|
39
|
+
exports.stagger = wrap.stagger;
|
|
39
40
|
exports.sync = wrap.sync;
|
|
40
41
|
exports.transform = wrap.transform;
|
|
41
42
|
Object.defineProperty(exports, 'warning', {
|
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-d596148c.js');
|
|
7
7
|
|
|
8
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
9
|
|
|
@@ -6121,6 +6121,7 @@ exports.progress = wrap.progress;
|
|
|
6121
6121
|
exports.px = wrap.px;
|
|
6122
6122
|
exports.scroll = wrap.scroll;
|
|
6123
6123
|
exports.spring = wrap.spring;
|
|
6124
|
+
exports.stagger = wrap.stagger;
|
|
6124
6125
|
exports.sync = wrap.sync;
|
|
6125
6126
|
exports.transform = wrap.transform;
|
|
6126
6127
|
Object.defineProperty(exports, 'warning', {
|
|
@@ -2569,7 +2569,7 @@ class MotionValue {
|
|
|
2569
2569
|
* This will be replaced by the build step with the latest version number.
|
|
2570
2570
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2571
2571
|
*/
|
|
2572
|
-
this.version = "10.
|
|
2572
|
+
this.version = "10.8.0";
|
|
2573
2573
|
/**
|
|
2574
2574
|
* Duration, in milliseconds, since last updating frame.
|
|
2575
2575
|
*
|
|
@@ -3728,7 +3728,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
3728
3728
|
* and warn against mismatches.
|
|
3729
3729
|
*/
|
|
3730
3730
|
if (process.env.NODE_ENV === "development") {
|
|
3731
|
-
warnOnce(nextValue.version === "10.
|
|
3731
|
+
warnOnce(nextValue.version === "10.8.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 10.8.0 may not work as expected.`);
|
|
3732
3732
|
}
|
|
3733
3733
|
}
|
|
3734
3734
|
else if (isMotionValue(prevValue)) {
|
|
@@ -4424,12 +4424,19 @@ function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
|
4424
4424
|
createVisualElement(element);
|
|
4425
4425
|
}
|
|
4426
4426
|
const visualElement = visualElementStore.get(element);
|
|
4427
|
-
|
|
4427
|
+
const transition = { ...options };
|
|
4428
|
+
/**
|
|
4429
|
+
* Resolve stagger function if provided.
|
|
4430
|
+
*/
|
|
4431
|
+
if (typeof transition.delay === "function") {
|
|
4432
|
+
transition.delay = transition.delay(i, numElements);
|
|
4433
|
+
}
|
|
4434
|
+
animations.push(...animateTarget(visualElement, { ...keyframes, transition }, {}));
|
|
4428
4435
|
}
|
|
4429
4436
|
return new GroupPlaybackControls(animations);
|
|
4430
4437
|
}
|
|
4431
4438
|
const createScopedAnimate = (scope) => {
|
|
4432
|
-
function scopedAnimate(valueOrElement, keyframes, options
|
|
4439
|
+
function scopedAnimate(valueOrElement, keyframes, options) {
|
|
4433
4440
|
let animation;
|
|
4434
4441
|
if (isDOMKeyframes(keyframes)) {
|
|
4435
4442
|
animation = animateElements(valueOrElement, keyframes, options, scope);
|
|
@@ -4901,6 +4908,29 @@ function inView(elementOrSelector, onStart, { root, margin: rootMargin, amount =
|
|
|
4901
4908
|
return () => observer.disconnect();
|
|
4902
4909
|
}
|
|
4903
4910
|
|
|
4911
|
+
function getOriginIndex(origin, total) {
|
|
4912
|
+
if (origin === "first") {
|
|
4913
|
+
return 0;
|
|
4914
|
+
}
|
|
4915
|
+
else {
|
|
4916
|
+
const lastIndex = total - 1;
|
|
4917
|
+
return origin === "last" ? lastIndex : lastIndex / 2;
|
|
4918
|
+
}
|
|
4919
|
+
}
|
|
4920
|
+
function stagger(duration = 0.1, { startDelay = 0, origin = 0, ease } = {}) {
|
|
4921
|
+
return (i, total) => {
|
|
4922
|
+
const originIndex = typeof origin === "number" ? origin : getOriginIndex(origin, total);
|
|
4923
|
+
const distance = Math.abs(originIndex - i);
|
|
4924
|
+
let delay = duration * distance;
|
|
4925
|
+
if (ease) {
|
|
4926
|
+
const maxDelay = total * duration;
|
|
4927
|
+
const easingFunction = easingDefinitionToFunction(ease);
|
|
4928
|
+
delay = easingFunction(delay / maxDelay) * maxDelay;
|
|
4929
|
+
}
|
|
4930
|
+
return startDelay + delay;
|
|
4931
|
+
};
|
|
4932
|
+
}
|
|
4933
|
+
|
|
4904
4934
|
const isCustomValueType = (v) => {
|
|
4905
4935
|
return typeof v === "object" && v.mix;
|
|
4906
4936
|
};
|
|
@@ -5019,6 +5049,7 @@ exports.scroll = scroll;
|
|
|
5019
5049
|
exports.secondsToMilliseconds = secondsToMilliseconds;
|
|
5020
5050
|
exports.setValues = setValues;
|
|
5021
5051
|
exports.spring = spring;
|
|
5052
|
+
exports.stagger = stagger;
|
|
5022
5053
|
exports.sync = sync;
|
|
5023
5054
|
exports.transform = transform;
|
|
5024
5055
|
exports.transformBox = transformBox;
|