framer-motion 7.0.1 → 7.0.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/cjs/index.js +2 -2
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +104 -281
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +115 -292
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-webpack-dom-animation.js +1 -1
- package/dist/size-webpack-dom-max.js +1 -1
- package/dist/size-webpack-m.js +1 -1
- package/package.json +7 -9
package/dist/cjs/index.js
CHANGED
|
@@ -2437,7 +2437,7 @@ var MotionValue = /** @class */ (function () {
|
|
|
2437
2437
|
* This will be replaced by the build step with the latest version number.
|
|
2438
2438
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
2439
2439
|
*/
|
|
2440
|
-
this.version = "7.0.
|
|
2440
|
+
this.version = "7.0.2";
|
|
2441
2441
|
/**
|
|
2442
2442
|
* Duration, in milliseconds, since last updating frame.
|
|
2443
2443
|
*
|
|
@@ -4407,7 +4407,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
4407
4407
|
* and warn against mismatches.
|
|
4408
4408
|
*/
|
|
4409
4409
|
if (process.env.NODE_ENV === "development") {
|
|
4410
|
-
warnOnce(nextValue.version === "7.0.
|
|
4410
|
+
warnOnce(nextValue.version === "7.0.2", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.0.2 may not work as expected."));
|
|
4411
4411
|
}
|
|
4412
4412
|
}
|
|
4413
4413
|
else if (isMotionValue(prevValue)) {
|
|
@@ -18,7 +18,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
18
18
|
* and warn against mismatches.
|
|
19
19
|
*/
|
|
20
20
|
if (process.env.NODE_ENV === "development") {
|
|
21
|
-
warnOnce(nextValue.version === "7.0.
|
|
21
|
+
warnOnce(nextValue.version === "7.0.2", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.0.2 may not work as expected."));
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
else if (isMotionValue(prevValue)) {
|
package/dist/es/value/index.mjs
CHANGED
|
@@ -25,7 +25,7 @@ var MotionValue = /** @class */ (function () {
|
|
|
25
25
|
* This will be replaced by the build step with the latest version number.
|
|
26
26
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
27
27
|
*/
|
|
28
|
-
this.version = "7.0.
|
|
28
|
+
this.version = "7.0.2";
|
|
29
29
|
/**
|
|
30
30
|
* Duration, in milliseconds, since last updating frame.
|
|
31
31
|
*
|
|
@@ -887,43 +887,43 @@
|
|
|
887
887
|
: value;
|
|
888
888
|
};
|
|
889
889
|
|
|
890
|
-
const clamp$
|
|
891
|
-
const sanitize
|
|
892
|
-
const floatRegex
|
|
893
|
-
const colorRegex
|
|
894
|
-
const singleColorRegex
|
|
895
|
-
function isString$
|
|
890
|
+
const clamp$2 = (min, max) => (v) => Math.max(Math.min(v, max), min);
|
|
891
|
+
const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v);
|
|
892
|
+
const floatRegex = /(-)?([\d]*\.?[\d])+/g;
|
|
893
|
+
const colorRegex = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi;
|
|
894
|
+
const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;
|
|
895
|
+
function isString$1(v) {
|
|
896
896
|
return typeof v === 'string';
|
|
897
897
|
}
|
|
898
898
|
|
|
899
|
-
const number
|
|
899
|
+
const number = {
|
|
900
900
|
test: (v) => typeof v === 'number',
|
|
901
901
|
parse: parseFloat,
|
|
902
902
|
transform: (v) => v,
|
|
903
903
|
};
|
|
904
|
-
const alpha
|
|
905
|
-
const scale = Object.assign(Object.assign({}, number
|
|
904
|
+
const alpha = Object.assign(Object.assign({}, number), { transform: clamp$2(0, 1) });
|
|
905
|
+
const scale = Object.assign(Object.assign({}, number), { default: 1 });
|
|
906
906
|
|
|
907
|
-
const createUnitType
|
|
908
|
-
test: (v) => isString$
|
|
907
|
+
const createUnitType = (unit) => ({
|
|
908
|
+
test: (v) => isString$1(v) && v.endsWith(unit) && v.split(' ').length === 1,
|
|
909
909
|
parse: parseFloat,
|
|
910
910
|
transform: (v) => `${v}${unit}`,
|
|
911
911
|
});
|
|
912
|
-
const degrees = createUnitType
|
|
913
|
-
const percent
|
|
914
|
-
const px = createUnitType
|
|
915
|
-
const vh = createUnitType
|
|
916
|
-
const vw = createUnitType
|
|
917
|
-
const progressPercentage = Object.assign(Object.assign({}, percent
|
|
918
|
-
|
|
919
|
-
const isColorString
|
|
920
|
-
return Boolean((isString$
|
|
912
|
+
const degrees = createUnitType('deg');
|
|
913
|
+
const percent = createUnitType('%');
|
|
914
|
+
const px = createUnitType('px');
|
|
915
|
+
const vh = createUnitType('vh');
|
|
916
|
+
const vw = createUnitType('vw');
|
|
917
|
+
const progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) });
|
|
918
|
+
|
|
919
|
+
const isColorString = (type, testProp) => (v) => {
|
|
920
|
+
return Boolean((isString$1(v) && singleColorRegex.test(v) && v.startsWith(type)) ||
|
|
921
921
|
(testProp && Object.prototype.hasOwnProperty.call(v, testProp)));
|
|
922
922
|
};
|
|
923
|
-
const splitColor
|
|
924
|
-
if (!isString$
|
|
923
|
+
const splitColor = (aName, bName, cName) => (v) => {
|
|
924
|
+
if (!isString$1(v))
|
|
925
925
|
return v;
|
|
926
|
-
const [a, b, c, alpha] = v.match(floatRegex
|
|
926
|
+
const [a, b, c, alpha] = v.match(floatRegex);
|
|
927
927
|
return {
|
|
928
928
|
[aName]: parseFloat(a),
|
|
929
929
|
[bName]: parseFloat(b),
|
|
@@ -932,39 +932,39 @@
|
|
|
932
932
|
};
|
|
933
933
|
};
|
|
934
934
|
|
|
935
|
-
const hsla
|
|
936
|
-
test: isColorString
|
|
937
|
-
parse: splitColor
|
|
938
|
-
transform: ({ hue, saturation, lightness, alpha: alpha$1
|
|
935
|
+
const hsla = {
|
|
936
|
+
test: isColorString('hsl', 'hue'),
|
|
937
|
+
parse: splitColor('hue', 'saturation', 'lightness'),
|
|
938
|
+
transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
|
|
939
939
|
return ('hsla(' +
|
|
940
940
|
Math.round(hue) +
|
|
941
941
|
', ' +
|
|
942
|
-
percent
|
|
942
|
+
percent.transform(sanitize(saturation)) +
|
|
943
943
|
', ' +
|
|
944
|
-
percent
|
|
944
|
+
percent.transform(sanitize(lightness)) +
|
|
945
945
|
', ' +
|
|
946
|
-
sanitize
|
|
946
|
+
sanitize(alpha.transform(alpha$1)) +
|
|
947
947
|
')');
|
|
948
948
|
},
|
|
949
949
|
};
|
|
950
950
|
|
|
951
|
-
const clampRgbUnit
|
|
952
|
-
const rgbUnit
|
|
953
|
-
const rgba
|
|
954
|
-
test: isColorString
|
|
955
|
-
parse: splitColor
|
|
956
|
-
transform: ({ red, green, blue, alpha: alpha$1
|
|
957
|
-
rgbUnit
|
|
951
|
+
const clampRgbUnit = clamp$2(0, 255);
|
|
952
|
+
const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) });
|
|
953
|
+
const rgba = {
|
|
954
|
+
test: isColorString('rgb', 'red'),
|
|
955
|
+
parse: splitColor('red', 'green', 'blue'),
|
|
956
|
+
transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => 'rgba(' +
|
|
957
|
+
rgbUnit.transform(red) +
|
|
958
958
|
', ' +
|
|
959
|
-
rgbUnit
|
|
959
|
+
rgbUnit.transform(green) +
|
|
960
960
|
', ' +
|
|
961
|
-
rgbUnit
|
|
961
|
+
rgbUnit.transform(blue) +
|
|
962
962
|
', ' +
|
|
963
|
-
sanitize
|
|
963
|
+
sanitize(alpha.transform(alpha$1)) +
|
|
964
964
|
')',
|
|
965
965
|
};
|
|
966
966
|
|
|
967
|
-
function parseHex
|
|
967
|
+
function parseHex(v) {
|
|
968
968
|
let r = '';
|
|
969
969
|
let g = '';
|
|
970
970
|
let b = '';
|
|
@@ -992,88 +992,88 @@
|
|
|
992
992
|
alpha: a ? parseInt(a, 16) / 255 : 1,
|
|
993
993
|
};
|
|
994
994
|
}
|
|
995
|
-
const hex
|
|
996
|
-
test: isColorString
|
|
997
|
-
parse: parseHex
|
|
998
|
-
transform: rgba
|
|
995
|
+
const hex = {
|
|
996
|
+
test: isColorString('#'),
|
|
997
|
+
parse: parseHex,
|
|
998
|
+
transform: rgba.transform,
|
|
999
999
|
};
|
|
1000
1000
|
|
|
1001
|
-
const color
|
|
1002
|
-
test: (v) => rgba
|
|
1001
|
+
const color = {
|
|
1002
|
+
test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
|
|
1003
1003
|
parse: (v) => {
|
|
1004
|
-
if (rgba
|
|
1005
|
-
return rgba
|
|
1004
|
+
if (rgba.test(v)) {
|
|
1005
|
+
return rgba.parse(v);
|
|
1006
1006
|
}
|
|
1007
|
-
else if (hsla
|
|
1008
|
-
return hsla
|
|
1007
|
+
else if (hsla.test(v)) {
|
|
1008
|
+
return hsla.parse(v);
|
|
1009
1009
|
}
|
|
1010
1010
|
else {
|
|
1011
|
-
return hex
|
|
1011
|
+
return hex.parse(v);
|
|
1012
1012
|
}
|
|
1013
1013
|
},
|
|
1014
1014
|
transform: (v) => {
|
|
1015
|
-
return isString$
|
|
1015
|
+
return isString$1(v)
|
|
1016
1016
|
? v
|
|
1017
1017
|
: v.hasOwnProperty('red')
|
|
1018
|
-
? rgba
|
|
1019
|
-
: hsla
|
|
1018
|
+
? rgba.transform(v)
|
|
1019
|
+
: hsla.transform(v);
|
|
1020
1020
|
},
|
|
1021
1021
|
};
|
|
1022
1022
|
|
|
1023
|
-
const colorToken
|
|
1024
|
-
const numberToken
|
|
1025
|
-
function test
|
|
1023
|
+
const colorToken = '${c}';
|
|
1024
|
+
const numberToken = '${n}';
|
|
1025
|
+
function test(v) {
|
|
1026
1026
|
var _a, _b, _c, _d;
|
|
1027
1027
|
return (isNaN(v) &&
|
|
1028
|
-
isString$
|
|
1029
|
-
((_b = (_a = v.match(floatRegex
|
|
1028
|
+
isString$1(v) &&
|
|
1029
|
+
((_b = (_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0);
|
|
1030
1030
|
}
|
|
1031
|
-
function analyse$
|
|
1031
|
+
function analyse$1(v) {
|
|
1032
1032
|
if (typeof v === 'number')
|
|
1033
1033
|
v = `${v}`;
|
|
1034
1034
|
const values = [];
|
|
1035
1035
|
let numColors = 0;
|
|
1036
|
-
const colors = v.match(colorRegex
|
|
1036
|
+
const colors = v.match(colorRegex);
|
|
1037
1037
|
if (colors) {
|
|
1038
1038
|
numColors = colors.length;
|
|
1039
|
-
v = v.replace(colorRegex
|
|
1040
|
-
values.push(...colors.map(color
|
|
1039
|
+
v = v.replace(colorRegex, colorToken);
|
|
1040
|
+
values.push(...colors.map(color.parse));
|
|
1041
1041
|
}
|
|
1042
|
-
const numbers = v.match(floatRegex
|
|
1042
|
+
const numbers = v.match(floatRegex);
|
|
1043
1043
|
if (numbers) {
|
|
1044
|
-
v = v.replace(floatRegex
|
|
1045
|
-
values.push(...numbers.map(number
|
|
1044
|
+
v = v.replace(floatRegex, numberToken);
|
|
1045
|
+
values.push(...numbers.map(number.parse));
|
|
1046
1046
|
}
|
|
1047
1047
|
return { values, numColors, tokenised: v };
|
|
1048
1048
|
}
|
|
1049
|
-
function parse
|
|
1050
|
-
return analyse$
|
|
1049
|
+
function parse(v) {
|
|
1050
|
+
return analyse$1(v).values;
|
|
1051
1051
|
}
|
|
1052
|
-
function createTransformer
|
|
1053
|
-
const { values, numColors, tokenised } = analyse$
|
|
1052
|
+
function createTransformer(v) {
|
|
1053
|
+
const { values, numColors, tokenised } = analyse$1(v);
|
|
1054
1054
|
const numValues = values.length;
|
|
1055
1055
|
return (v) => {
|
|
1056
1056
|
let output = tokenised;
|
|
1057
1057
|
for (let i = 0; i < numValues; i++) {
|
|
1058
|
-
output = output.replace(i < numColors ? colorToken
|
|
1058
|
+
output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i]));
|
|
1059
1059
|
}
|
|
1060
1060
|
return output;
|
|
1061
1061
|
};
|
|
1062
1062
|
}
|
|
1063
|
-
const convertNumbersToZero
|
|
1064
|
-
function getAnimatableNone$
|
|
1065
|
-
const parsed = parse
|
|
1066
|
-
const transformer = createTransformer
|
|
1067
|
-
return transformer(parsed.map(convertNumbersToZero
|
|
1063
|
+
const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v;
|
|
1064
|
+
function getAnimatableNone$1(v) {
|
|
1065
|
+
const parsed = parse(v);
|
|
1066
|
+
const transformer = createTransformer(v);
|
|
1067
|
+
return transformer(parsed.map(convertNumbersToZero));
|
|
1068
1068
|
}
|
|
1069
|
-
const complex
|
|
1069
|
+
const complex = { test, parse, createTransformer, getAnimatableNone: getAnimatableNone$1 };
|
|
1070
1070
|
|
|
1071
1071
|
const maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']);
|
|
1072
1072
|
function applyDefaultFilter(v) {
|
|
1073
1073
|
let [name, value] = v.slice(0, -1).split('(');
|
|
1074
1074
|
if (name === 'drop-shadow')
|
|
1075
1075
|
return v;
|
|
1076
|
-
const [number] = value.match(floatRegex
|
|
1076
|
+
const [number] = value.match(floatRegex) || [];
|
|
1077
1077
|
if (!number)
|
|
1078
1078
|
return v;
|
|
1079
1079
|
const unit = value.replace(number, '');
|
|
@@ -1083,12 +1083,12 @@
|
|
|
1083
1083
|
return name + '(' + defaultValue + unit + ')';
|
|
1084
1084
|
}
|
|
1085
1085
|
const functionRegex = /([a-z-]*)\(.*?\)/g;
|
|
1086
|
-
const filter = Object.assign(Object.assign({}, complex
|
|
1086
|
+
const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v) => {
|
|
1087
1087
|
const functions = v.match(functionRegex);
|
|
1088
1088
|
return functions ? functions.map(applyDefaultFilter).join(' ') : v;
|
|
1089
1089
|
} });
|
|
1090
1090
|
|
|
1091
|
-
var int = __assign(__assign({}, number
|
|
1091
|
+
var int = __assign(__assign({}, number), { transform: Math.round });
|
|
1092
1092
|
|
|
1093
1093
|
var numberValueTypes = {
|
|
1094
1094
|
// Border props
|
|
@@ -1145,15 +1145,15 @@
|
|
|
1145
1145
|
z: px,
|
|
1146
1146
|
perspective: px,
|
|
1147
1147
|
transformPerspective: px,
|
|
1148
|
-
opacity: alpha
|
|
1148
|
+
opacity: alpha,
|
|
1149
1149
|
originX: progressPercentage,
|
|
1150
1150
|
originY: progressPercentage,
|
|
1151
1151
|
originZ: px,
|
|
1152
1152
|
// Misc
|
|
1153
1153
|
zIndex: int,
|
|
1154
1154
|
// SVG
|
|
1155
|
-
fillOpacity: alpha
|
|
1156
|
-
strokeOpacity: alpha
|
|
1155
|
+
fillOpacity: alpha,
|
|
1156
|
+
strokeOpacity: alpha,
|
|
1157
1157
|
numOctaves: int,
|
|
1158
1158
|
};
|
|
1159
1159
|
|
|
@@ -2008,7 +2008,7 @@
|
|
|
2008
2008
|
return React.useEffect(function () { return function () { return callback(); }; }, []);
|
|
2009
2009
|
}
|
|
2010
2010
|
|
|
2011
|
-
const clamp$
|
|
2011
|
+
const clamp$1 = (min, max, v) => Math.min(Math.max(v, min), max);
|
|
2012
2012
|
|
|
2013
2013
|
const safeMin = 0.001;
|
|
2014
2014
|
const minDuration = 0.01;
|
|
@@ -2020,8 +2020,8 @@
|
|
|
2020
2020
|
let derivative;
|
|
2021
2021
|
warning(duration <= maxDuration * 1000, "Spring duration must be 10 seconds or less");
|
|
2022
2022
|
let dampingRatio = 1 - bounce;
|
|
2023
|
-
dampingRatio = clamp$
|
|
2024
|
-
duration = clamp$
|
|
2023
|
+
dampingRatio = clamp$1(minDamping, maxDamping, dampingRatio);
|
|
2024
|
+
duration = clamp$1(minDuration, maxDuration, duration / 1000);
|
|
2025
2025
|
if (dampingRatio < 1) {
|
|
2026
2026
|
envelope = (undampedFreq) => {
|
|
2027
2027
|
const exponentialDecay = undampedFreq * dampingRatio;
|
|
@@ -2207,183 +2207,6 @@
|
|
|
2207
2207
|
|
|
2208
2208
|
const mix$1 = (from, to, progress) => -progress * from + progress * to + from;
|
|
2209
2209
|
|
|
2210
|
-
const clamp$1 = (min, max) => (v) => Math.max(Math.min(v, max), min);
|
|
2211
|
-
const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v);
|
|
2212
|
-
const floatRegex = /(-)?([\d]*\.?[\d])+/g;
|
|
2213
|
-
const colorRegex = /(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi;
|
|
2214
|
-
const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;
|
|
2215
|
-
function isString$1(v) {
|
|
2216
|
-
return typeof v === 'string';
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
const number = {
|
|
2220
|
-
test: (v) => typeof v === 'number',
|
|
2221
|
-
parse: parseFloat,
|
|
2222
|
-
transform: (v) => v,
|
|
2223
|
-
};
|
|
2224
|
-
const alpha = Object.assign(Object.assign({}, number), { transform: clamp$1(0, 1) });
|
|
2225
|
-
Object.assign(Object.assign({}, number), { default: 1 });
|
|
2226
|
-
|
|
2227
|
-
const createUnitType = (unit) => ({
|
|
2228
|
-
test: (v) => isString$1(v) && v.endsWith(unit) && v.split(' ').length === 1,
|
|
2229
|
-
parse: parseFloat,
|
|
2230
|
-
transform: (v) => `${v}${unit}`,
|
|
2231
|
-
});
|
|
2232
|
-
const percent = createUnitType('%');
|
|
2233
|
-
Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) });
|
|
2234
|
-
|
|
2235
|
-
const isColorString = (type, testProp) => (v) => {
|
|
2236
|
-
return Boolean((isString$1(v) && singleColorRegex.test(v) && v.startsWith(type)) ||
|
|
2237
|
-
(testProp && Object.prototype.hasOwnProperty.call(v, testProp)));
|
|
2238
|
-
};
|
|
2239
|
-
const splitColor = (aName, bName, cName) => (v) => {
|
|
2240
|
-
if (!isString$1(v))
|
|
2241
|
-
return v;
|
|
2242
|
-
const [a, b, c, alpha] = v.match(floatRegex);
|
|
2243
|
-
return {
|
|
2244
|
-
[aName]: parseFloat(a),
|
|
2245
|
-
[bName]: parseFloat(b),
|
|
2246
|
-
[cName]: parseFloat(c),
|
|
2247
|
-
alpha: alpha !== undefined ? parseFloat(alpha) : 1,
|
|
2248
|
-
};
|
|
2249
|
-
};
|
|
2250
|
-
|
|
2251
|
-
const hsla = {
|
|
2252
|
-
test: isColorString('hsl', 'hue'),
|
|
2253
|
-
parse: splitColor('hue', 'saturation', 'lightness'),
|
|
2254
|
-
transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
|
|
2255
|
-
return ('hsla(' +
|
|
2256
|
-
Math.round(hue) +
|
|
2257
|
-
', ' +
|
|
2258
|
-
percent.transform(sanitize(saturation)) +
|
|
2259
|
-
', ' +
|
|
2260
|
-
percent.transform(sanitize(lightness)) +
|
|
2261
|
-
', ' +
|
|
2262
|
-
sanitize(alpha.transform(alpha$1)) +
|
|
2263
|
-
')');
|
|
2264
|
-
},
|
|
2265
|
-
};
|
|
2266
|
-
|
|
2267
|
-
const clampRgbUnit = clamp$1(0, 255);
|
|
2268
|
-
const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) });
|
|
2269
|
-
const rgba = {
|
|
2270
|
-
test: isColorString('rgb', 'red'),
|
|
2271
|
-
parse: splitColor('red', 'green', 'blue'),
|
|
2272
|
-
transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => 'rgba(' +
|
|
2273
|
-
rgbUnit.transform(red) +
|
|
2274
|
-
', ' +
|
|
2275
|
-
rgbUnit.transform(green) +
|
|
2276
|
-
', ' +
|
|
2277
|
-
rgbUnit.transform(blue) +
|
|
2278
|
-
', ' +
|
|
2279
|
-
sanitize(alpha.transform(alpha$1)) +
|
|
2280
|
-
')',
|
|
2281
|
-
};
|
|
2282
|
-
|
|
2283
|
-
function parseHex(v) {
|
|
2284
|
-
let r = '';
|
|
2285
|
-
let g = '';
|
|
2286
|
-
let b = '';
|
|
2287
|
-
let a = '';
|
|
2288
|
-
if (v.length > 5) {
|
|
2289
|
-
r = v.substr(1, 2);
|
|
2290
|
-
g = v.substr(3, 2);
|
|
2291
|
-
b = v.substr(5, 2);
|
|
2292
|
-
a = v.substr(7, 2);
|
|
2293
|
-
}
|
|
2294
|
-
else {
|
|
2295
|
-
r = v.substr(1, 1);
|
|
2296
|
-
g = v.substr(2, 1);
|
|
2297
|
-
b = v.substr(3, 1);
|
|
2298
|
-
a = v.substr(4, 1);
|
|
2299
|
-
r += r;
|
|
2300
|
-
g += g;
|
|
2301
|
-
b += b;
|
|
2302
|
-
a += a;
|
|
2303
|
-
}
|
|
2304
|
-
return {
|
|
2305
|
-
red: parseInt(r, 16),
|
|
2306
|
-
green: parseInt(g, 16),
|
|
2307
|
-
blue: parseInt(b, 16),
|
|
2308
|
-
alpha: a ? parseInt(a, 16) / 255 : 1,
|
|
2309
|
-
};
|
|
2310
|
-
}
|
|
2311
|
-
const hex = {
|
|
2312
|
-
test: isColorString('#'),
|
|
2313
|
-
parse: parseHex,
|
|
2314
|
-
transform: rgba.transform,
|
|
2315
|
-
};
|
|
2316
|
-
|
|
2317
|
-
const color = {
|
|
2318
|
-
test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
|
|
2319
|
-
parse: (v) => {
|
|
2320
|
-
if (rgba.test(v)) {
|
|
2321
|
-
return rgba.parse(v);
|
|
2322
|
-
}
|
|
2323
|
-
else if (hsla.test(v)) {
|
|
2324
|
-
return hsla.parse(v);
|
|
2325
|
-
}
|
|
2326
|
-
else {
|
|
2327
|
-
return hex.parse(v);
|
|
2328
|
-
}
|
|
2329
|
-
},
|
|
2330
|
-
transform: (v) => {
|
|
2331
|
-
return isString$1(v)
|
|
2332
|
-
? v
|
|
2333
|
-
: v.hasOwnProperty('red')
|
|
2334
|
-
? rgba.transform(v)
|
|
2335
|
-
: hsla.transform(v);
|
|
2336
|
-
},
|
|
2337
|
-
};
|
|
2338
|
-
|
|
2339
|
-
const colorToken = '${c}';
|
|
2340
|
-
const numberToken = '${n}';
|
|
2341
|
-
function test(v) {
|
|
2342
|
-
var _a, _b, _c, _d;
|
|
2343
|
-
return (isNaN(v) &&
|
|
2344
|
-
isString$1(v) &&
|
|
2345
|
-
((_b = (_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0);
|
|
2346
|
-
}
|
|
2347
|
-
function analyse$1(v) {
|
|
2348
|
-
if (typeof v === 'number')
|
|
2349
|
-
v = `${v}`;
|
|
2350
|
-
const values = [];
|
|
2351
|
-
let numColors = 0;
|
|
2352
|
-
const colors = v.match(colorRegex);
|
|
2353
|
-
if (colors) {
|
|
2354
|
-
numColors = colors.length;
|
|
2355
|
-
v = v.replace(colorRegex, colorToken);
|
|
2356
|
-
values.push(...colors.map(color.parse));
|
|
2357
|
-
}
|
|
2358
|
-
const numbers = v.match(floatRegex);
|
|
2359
|
-
if (numbers) {
|
|
2360
|
-
v = v.replace(floatRegex, numberToken);
|
|
2361
|
-
values.push(...numbers.map(number.parse));
|
|
2362
|
-
}
|
|
2363
|
-
return { values, numColors, tokenised: v };
|
|
2364
|
-
}
|
|
2365
|
-
function parse(v) {
|
|
2366
|
-
return analyse$1(v).values;
|
|
2367
|
-
}
|
|
2368
|
-
function createTransformer(v) {
|
|
2369
|
-
const { values, numColors, tokenised } = analyse$1(v);
|
|
2370
|
-
const numValues = values.length;
|
|
2371
|
-
return (v) => {
|
|
2372
|
-
let output = tokenised;
|
|
2373
|
-
for (let i = 0; i < numValues; i++) {
|
|
2374
|
-
output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i]));
|
|
2375
|
-
}
|
|
2376
|
-
return output;
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2379
|
-
const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v;
|
|
2380
|
-
function getAnimatableNone$1(v) {
|
|
2381
|
-
const parsed = parse(v);
|
|
2382
|
-
const transformer = createTransformer(v);
|
|
2383
|
-
return transformer(parsed.map(convertNumbersToZero));
|
|
2384
|
-
}
|
|
2385
|
-
const complex = { test, parse, createTransformer, getAnimatableNone: getAnimatableNone$1 };
|
|
2386
|
-
|
|
2387
2210
|
function hueToRgb(p, q, t) {
|
|
2388
2211
|
if (t < 0)
|
|
2389
2212
|
t += 1;
|
|
@@ -2616,7 +2439,7 @@
|
|
|
2616
2439
|
? fastInterpolate(input, mixers)
|
|
2617
2440
|
: slowInterpolate(input, mixers);
|
|
2618
2441
|
return isClamp
|
|
2619
|
-
? (v) => interpolator(clamp$
|
|
2442
|
+
? (v) => interpolator(clamp$1(input[0], input[inputLength - 1], v))
|
|
2620
2443
|
: interpolator;
|
|
2621
2444
|
}
|
|
2622
2445
|
|
|
@@ -3476,7 +3299,7 @@
|
|
|
3476
3299
|
if (typeof value === "number" || Array.isArray(value))
|
|
3477
3300
|
return true;
|
|
3478
3301
|
if (typeof value === "string" && // It's animatable if we have a string
|
|
3479
|
-
complex
|
|
3302
|
+
complex.test(value) && // And it contains numbers and/or colors
|
|
3480
3303
|
!value.startsWith("url(") // Unless it starts with "url("
|
|
3481
3304
|
) {
|
|
3482
3305
|
return true;
|
|
@@ -3539,9 +3362,9 @@
|
|
|
3539
3362
|
*/
|
|
3540
3363
|
var defaultValueTypes = __assign(__assign({}, numberValueTypes), {
|
|
3541
3364
|
// Color props
|
|
3542
|
-
color: color
|
|
3365
|
+
color: color, backgroundColor: color, outlineColor: color, fill: color, stroke: color,
|
|
3543
3366
|
// Border props
|
|
3544
|
-
borderColor: color
|
|
3367
|
+
borderColor: color, borderTopColor: color, borderRightColor: color, borderBottomColor: color, borderLeftColor: color, filter: filter, WebkitFilter: filter });
|
|
3545
3368
|
/**
|
|
3546
3369
|
* Gets the default ValueType for the provided value key
|
|
3547
3370
|
*/
|
|
@@ -3551,7 +3374,7 @@
|
|
|
3551
3374
|
var _a;
|
|
3552
3375
|
var defaultValueType = getDefaultValueType(key);
|
|
3553
3376
|
if (defaultValueType !== filter)
|
|
3554
|
-
defaultValueType = complex
|
|
3377
|
+
defaultValueType = complex;
|
|
3555
3378
|
// If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
|
|
3556
3379
|
return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
|
|
3557
3380
|
}
|
|
@@ -3847,7 +3670,7 @@
|
|
|
3847
3670
|
* This will be replaced by the build step with the latest version number.
|
|
3848
3671
|
* When MotionValues are provided to motion components, warn if versions are mixed.
|
|
3849
3672
|
*/
|
|
3850
|
-
this.version = "7.0.
|
|
3673
|
+
this.version = "7.0.2";
|
|
3851
3674
|
/**
|
|
3852
3675
|
* Duration, in milliseconds, since last updating frame.
|
|
3853
3676
|
*
|
|
@@ -4146,7 +3969,7 @@
|
|
|
4146
3969
|
/**
|
|
4147
3970
|
* A list of value types commonly used for dimensions
|
|
4148
3971
|
*/
|
|
4149
|
-
var dimensionValueTypes = [number
|
|
3972
|
+
var dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
|
|
4150
3973
|
/**
|
|
4151
3974
|
* Tests a dimensional value against the list of dimension ValueTypes
|
|
4152
3975
|
*/
|
|
@@ -4157,7 +3980,7 @@
|
|
|
4157
3980
|
/**
|
|
4158
3981
|
* A list of all ValueTypes
|
|
4159
3982
|
*/
|
|
4160
|
-
var valueTypes = __spreadArray(__spreadArray([], __read(dimensionValueTypes), false), [color
|
|
3983
|
+
var valueTypes = __spreadArray(__spreadArray([], __read(dimensionValueTypes), false), [color, complex], false);
|
|
4161
3984
|
/**
|
|
4162
3985
|
* Tests a value against the list of ValueTypes
|
|
4163
3986
|
*/
|
|
@@ -4243,7 +4066,7 @@
|
|
|
4243
4066
|
// If this is a number read as a string, ie "0" or "200", convert it to a number
|
|
4244
4067
|
value = parseFloat(value);
|
|
4245
4068
|
}
|
|
4246
|
-
else if (!findValueType(value) && complex
|
|
4069
|
+
else if (!findValueType(value) && complex.test(targetValue)) {
|
|
4247
4070
|
value = getAnimatableNone(key, targetValue);
|
|
4248
4071
|
}
|
|
4249
4072
|
visualElement.addValue(key, motionValue(value));
|
|
@@ -5032,7 +4855,7 @@
|
|
|
5032
4855
|
else if (sourceLength > targetLength) {
|
|
5033
4856
|
origin = progress$1(source.min, source.max - targetLength, target.min);
|
|
5034
4857
|
}
|
|
5035
|
-
return clamp$
|
|
4858
|
+
return clamp$1(0, 1, origin);
|
|
5036
4859
|
}
|
|
5037
4860
|
/**
|
|
5038
4861
|
* Rebase the calculated viewport constraints relative to the layout.min point.
|
|
@@ -5337,7 +5160,7 @@
|
|
|
5337
5160
|
/**
|
|
5338
5161
|
* If the MotionValue is a percentage value convert to px
|
|
5339
5162
|
*/
|
|
5340
|
-
if (percent
|
|
5163
|
+
if (percent.test(current)) {
|
|
5341
5164
|
var measuredAxis = (_b = (_a = _this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.actual[axis];
|
|
5342
5165
|
if (measuredAxis) {
|
|
5343
5166
|
var length_1 = calcLength(measuredAxis);
|
|
@@ -5817,7 +5640,7 @@
|
|
|
5817
5640
|
* and warn against mismatches.
|
|
5818
5641
|
*/
|
|
5819
5642
|
{
|
|
5820
|
-
warnOnce(nextValue.version === "7.0.
|
|
5643
|
+
warnOnce(nextValue.version === "7.0.2", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.0.2 may not work as expected."));
|
|
5821
5644
|
}
|
|
5822
5645
|
}
|
|
5823
5646
|
else if (isMotionValue(prevValue)) {
|
|
@@ -6349,7 +6172,7 @@
|
|
|
6349
6172
|
value.set(to);
|
|
6350
6173
|
};
|
|
6351
6174
|
var isNumOrPxType = function (v) {
|
|
6352
|
-
return v === number
|
|
6175
|
+
return v === number || v === px;
|
|
6353
6176
|
};
|
|
6354
6177
|
var BoundingBoxDimension;
|
|
6355
6178
|
(function (BoundingBoxDimension) {
|
|
@@ -6765,11 +6588,11 @@
|
|
|
6765
6588
|
return varToken;
|
|
6766
6589
|
});
|
|
6767
6590
|
}
|
|
6768
|
-
var shadow = complex
|
|
6591
|
+
var shadow = complex.parse(latest);
|
|
6769
6592
|
// TODO: Doesn't support multiple shadows
|
|
6770
6593
|
if (shadow.length > 5)
|
|
6771
6594
|
return original;
|
|
6772
|
-
var template = complex
|
|
6595
|
+
var template = complex.createTransformer(latest);
|
|
6773
6596
|
var offset = typeof shadow[0] !== "number" ? 1 : 0;
|
|
6774
6597
|
// Calculate the overall context scale
|
|
6775
6598
|
var xScale = projectionDelta.x.scale * treeScale.x;
|
|
@@ -6998,7 +6821,7 @@
|
|
|
6998
6821
|
isPx(followRadius) === isPx(leadRadius);
|
|
6999
6822
|
if (canMix) {
|
|
7000
6823
|
target[borderLabel] = Math.max(mix$1(asNumber(followRadius), asNumber(leadRadius), progress), 0);
|
|
7001
|
-
if (percent
|
|
6824
|
+
if (percent.test(leadRadius) || percent.test(followRadius)) {
|
|
7002
6825
|
target[borderLabel] += "%";
|
|
7003
6826
|
}
|
|
7004
6827
|
}
|
|
@@ -7092,7 +6915,7 @@
|
|
|
7092
6915
|
if (origin === void 0) { origin = 0.5; }
|
|
7093
6916
|
if (originAxis === void 0) { originAxis = axis; }
|
|
7094
6917
|
if (sourceAxis === void 0) { sourceAxis = axis; }
|
|
7095
|
-
if (percent
|
|
6918
|
+
if (percent.test(translate)) {
|
|
7096
6919
|
translate = parseFloat(translate);
|
|
7097
6920
|
var relativeProgress = mix$1(sourceAxis.min, sourceAxis.max, translate / 100);
|
|
7098
6921
|
translate = relativeProgress - sourceAxis.min;
|