motion 12.23.0 → 12.23.2
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/motion.dev.js +23 -18
- package/package.json +3 -3
package/dist/motion.dev.js
CHANGED
|
@@ -35,14 +35,19 @@
|
|
|
35
35
|
exports.warning = () => { };
|
|
36
36
|
exports.invariant = () => { };
|
|
37
37
|
{
|
|
38
|
-
|
|
38
|
+
const formatMessage = (message, errorCode) => {
|
|
39
|
+
return errorCode
|
|
40
|
+
? `${message}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${errorCode}`
|
|
41
|
+
: message;
|
|
42
|
+
};
|
|
43
|
+
exports.warning = (check, message, errorCode) => {
|
|
39
44
|
if (!check && typeof console !== "undefined") {
|
|
40
|
-
console.warn(message);
|
|
45
|
+
console.warn(formatMessage(message, errorCode));
|
|
41
46
|
}
|
|
42
47
|
};
|
|
43
|
-
exports.invariant = (check, message) => {
|
|
48
|
+
exports.invariant = (check, message, errorCode) => {
|
|
44
49
|
if (!check) {
|
|
45
|
-
throw new Error(message);
|
|
50
|
+
throw new Error(formatMessage(message, errorCode));
|
|
46
51
|
}
|
|
47
52
|
};
|
|
48
53
|
}
|
|
@@ -291,13 +296,13 @@
|
|
|
291
296
|
const easingDefinitionToFunction = (definition) => {
|
|
292
297
|
if (isBezierDefinition(definition)) {
|
|
293
298
|
// If cubic bezier definition, create bezier curve
|
|
294
|
-
exports.invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values
|
|
299
|
+
exports.invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`, "cubic-bezier-length");
|
|
295
300
|
const [x1, y1, x2, y2] = definition;
|
|
296
301
|
return cubicBezier(x1, y1, x2, y2);
|
|
297
302
|
}
|
|
298
303
|
else if (isValidEasing(definition)) {
|
|
299
304
|
// Else lookup from table
|
|
300
|
-
exports.invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'
|
|
305
|
+
exports.invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'`, "invalid-easing-type");
|
|
301
306
|
return easingLookup[definition];
|
|
302
307
|
}
|
|
303
308
|
return definition;
|
|
@@ -857,7 +862,7 @@
|
|
|
857
862
|
const getColorType = (v) => colorTypes.find((type) => type.test(v));
|
|
858
863
|
function asRGBA(color) {
|
|
859
864
|
const type = getColorType(color);
|
|
860
|
-
exports.warning(Boolean(type), `'${color}' is not an animatable color. Use the equivalent color code instead
|
|
865
|
+
exports.warning(Boolean(type), `'${color}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable");
|
|
861
866
|
if (!Boolean(type))
|
|
862
867
|
return false;
|
|
863
868
|
let model = type.parse(color);
|
|
@@ -975,7 +980,7 @@
|
|
|
975
980
|
return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template);
|
|
976
981
|
}
|
|
977
982
|
else {
|
|
978
|
-
exports.warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition
|
|
983
|
+
exports.warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`, "complex-values-different");
|
|
979
984
|
return mixImmediate(origin, target);
|
|
980
985
|
}
|
|
981
986
|
};
|
|
@@ -1081,7 +1086,7 @@
|
|
|
1081
1086
|
function findSpring({ duration = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass, }) {
|
|
1082
1087
|
let envelope;
|
|
1083
1088
|
let derivative;
|
|
1084
|
-
exports.warning(duration <= secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less");
|
|
1089
|
+
exports.warning(duration <= secondsToMilliseconds(springDefaults.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
|
|
1085
1090
|
let dampingRatio = 1 - bounce;
|
|
1086
1091
|
/**
|
|
1087
1092
|
* Restrict dampingRatio and duration to within acceptable ranges.
|
|
@@ -1441,7 +1446,7 @@
|
|
|
1441
1446
|
*/
|
|
1442
1447
|
function interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) {
|
|
1443
1448
|
const inputLength = input.length;
|
|
1444
|
-
exports.invariant(inputLength === output.length, "Both input and output ranges must be the same length");
|
|
1449
|
+
exports.invariant(inputLength === output.length, "Both input and output ranges must be the same length", "range-length");
|
|
1445
1450
|
/**
|
|
1446
1451
|
* If we're only provided a single input, we can just make a function
|
|
1447
1452
|
* that returns the output.
|
|
@@ -1633,7 +1638,7 @@
|
|
|
1633
1638
|
let { keyframes: keyframes$1 } = options;
|
|
1634
1639
|
const generatorFactory = type || keyframes;
|
|
1635
1640
|
if (generatorFactory !== keyframes) {
|
|
1636
|
-
exports.invariant(keyframes$1.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}
|
|
1641
|
+
exports.invariant(keyframes$1.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`, "spring-two-frames");
|
|
1637
1642
|
}
|
|
1638
1643
|
if (generatorFactory !== keyframes &&
|
|
1639
1644
|
typeof keyframes$1[0] !== "number") {
|
|
@@ -2334,7 +2339,7 @@
|
|
|
2334
2339
|
this.isPseudoElement = Boolean(pseudoElement);
|
|
2335
2340
|
this.allowFlatten = allowFlatten;
|
|
2336
2341
|
this.options = options;
|
|
2337
|
-
exports.invariant(typeof options.type !== "string", `
|
|
2342
|
+
exports.invariant(typeof options.type !== "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
|
|
2338
2343
|
const transition = applyGeneratorOptions(options);
|
|
2339
2344
|
this.animation = startWaapiAnimation(element, name, keyframes, transition, pseudoElement);
|
|
2340
2345
|
if (transition.autoplay === false) {
|
|
@@ -2550,7 +2555,7 @@
|
|
|
2550
2555
|
* @internal
|
|
2551
2556
|
*/
|
|
2552
2557
|
const isAnimatable = (value, name) => {
|
|
2553
|
-
// If the list of keys
|
|
2558
|
+
// If the list of keys that might be non-animatable grows, replace with Set
|
|
2554
2559
|
if (name === "zIndex")
|
|
2555
2560
|
return false;
|
|
2556
2561
|
// If it's a number or a keyframes array, we can animate it. We might at some point
|
|
@@ -2595,7 +2600,7 @@
|
|
|
2595
2600
|
const targetKeyframe = keyframes[keyframes.length - 1];
|
|
2596
2601
|
const isOriginAnimatable = isAnimatable(originKeyframe, name);
|
|
2597
2602
|
const isTargetAnimatable = isAnimatable(targetKeyframe, name);
|
|
2598
|
-
exports.warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value -
|
|
2603
|
+
exports.warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". "${isOriginAnimatable ? targetKeyframe : originKeyframe}" is not an animatable value.`, "value-not-animatable");
|
|
2599
2604
|
// Always skip if any of these are true
|
|
2600
2605
|
if (!isOriginAnimatable || !isTargetAnimatable) {
|
|
2601
2606
|
return false;
|
|
@@ -2925,7 +2930,7 @@
|
|
|
2925
2930
|
}
|
|
2926
2931
|
const maxDepth = 4;
|
|
2927
2932
|
function getVariableValue(current, element, depth = 1) {
|
|
2928
|
-
exports.invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency
|
|
2933
|
+
exports.invariant(depth <= maxDepth, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
|
|
2929
2934
|
const [token, fallback] = parseCSSVariable(current);
|
|
2930
2935
|
// No CSS variable detected
|
|
2931
2936
|
if (!token)
|
|
@@ -5134,7 +5139,7 @@
|
|
|
5134
5139
|
* Handle repeat options
|
|
5135
5140
|
*/
|
|
5136
5141
|
if (repeat) {
|
|
5137
|
-
exports.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20");
|
|
5142
|
+
exports.invariant(repeat < MAX_REPEAT, "Repeat count too high, must be less than 20", "repeat-count-high");
|
|
5138
5143
|
duration = calculateRepeatDuration(duration, repeat);
|
|
5139
5144
|
const originalKeyframes = [...valueKeyframesAsList];
|
|
5140
5145
|
const originalTimes = [...times];
|
|
@@ -6710,7 +6715,7 @@
|
|
|
6710
6715
|
else {
|
|
6711
6716
|
const subjects = resolveSubjects(subject, keyframes, scope);
|
|
6712
6717
|
const numSubjects = subjects.length;
|
|
6713
|
-
exports.invariant(Boolean(numSubjects), "No valid elements provided.");
|
|
6718
|
+
exports.invariant(Boolean(numSubjects), "No valid elements provided.", "no-valid-elements");
|
|
6714
6719
|
for (let i = 0; i < numSubjects; i++) {
|
|
6715
6720
|
const thisSubject = subjects[i];
|
|
6716
6721
|
const createVisualElement = thisSubject instanceof Element
|
|
@@ -6778,7 +6783,7 @@
|
|
|
6778
6783
|
function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
6779
6784
|
const elements = resolveElements(elementOrSelector, scope);
|
|
6780
6785
|
const numElements = elements.length;
|
|
6781
|
-
exports.invariant(Boolean(numElements), "No valid
|
|
6786
|
+
exports.invariant(Boolean(numElements), "No valid elements provided.", "no-valid-elements");
|
|
6782
6787
|
/**
|
|
6783
6788
|
* WAAPI doesn't support interrupting animations.
|
|
6784
6789
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion",
|
|
3
|
-
"version": "12.23.
|
|
3
|
+
"version": "12.23.2",
|
|
4
4
|
"description": "An animation library for JavaScript and React.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.mjs",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"postpublish": "git push --tags"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"framer-motion": "^12.23.
|
|
79
|
+
"framer-motion": "^12.23.2",
|
|
80
80
|
"tslib": "^2.4.0"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"optional": true
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "17e0e4150c125139bb41f16e2db297683b9e6513"
|
|
99
99
|
}
|