framer-motion 11.0.3 → 11.0.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.
Files changed (37) hide show
  1. package/dist/cjs/dom-entry.js +1 -1
  2. package/dist/cjs/{index-legacy-18f65389.js → index-legacy-2f239609.js} +234 -207
  3. package/dist/cjs/index.js +25 -20
  4. package/dist/dom-entry.d.ts +4 -1
  5. package/dist/dom.js +1 -0
  6. package/dist/es/animation/animators/js/index.mjs +4 -4
  7. package/dist/es/animation/animators/waapi/create-accelerated-animation.mjs +0 -1
  8. package/dist/es/animation/sequence/utils/edit.mjs +2 -2
  9. package/dist/es/components/Reorder/utils/check-reorder.mjs +2 -2
  10. package/dist/es/dom-entry.mjs +1 -1
  11. package/dist/es/gestures/drag/VisualElementDragControls.mjs +3 -3
  12. package/dist/es/gestures/drag/utils/constraints.mjs +7 -3
  13. package/dist/es/index.mjs +1 -1
  14. package/dist/es/projection/animation/mix-values.mjs +6 -6
  15. package/dist/es/projection/geometry/delta-apply.mjs +2 -2
  16. package/dist/es/projection/geometry/delta-calc.mjs +3 -3
  17. package/dist/es/projection/geometry/delta-remove.mjs +3 -3
  18. package/dist/es/projection/node/create-projection-node.mjs +6 -5
  19. package/dist/es/projection/styles/scale-box-shadow.mjs +2 -2
  20. package/dist/es/render/dom/utils/is-css-variable.mjs +4 -3
  21. package/dist/es/render/utils/motion-values.mjs +1 -1
  22. package/dist/es/utils/clamp.mjs +7 -1
  23. package/dist/es/utils/interpolate.mjs +2 -21
  24. package/dist/es/utils/{mix-color.mjs → mix/color.mjs} +9 -8
  25. package/dist/es/utils/mix/complex.mjs +89 -0
  26. package/dist/es/utils/mix/index.mjs +14 -0
  27. package/dist/es/utils/{mix.mjs → mix/number.mjs} +4 -2
  28. package/dist/es/utils/offsets/fill.mjs +2 -2
  29. package/dist/es/value/index.mjs +1 -1
  30. package/dist/es/value/types/complex/index.mjs +51 -54
  31. package/dist/framer-motion.dev.js +257 -226
  32. package/dist/framer-motion.js +1 -1
  33. package/dist/index.d.ts +6 -2
  34. package/dist/projection.dev.js +220 -193
  35. package/package.json +8 -8
  36. package/dist/cjs/index-legacy-777cef1e.js +0 -5719
  37. package/dist/es/utils/mix-complex.mjs +0 -64
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var indexLegacy = require('./index-legacy-18f65389.js');
5
+ var indexLegacy = require('./index-legacy-2f239609.js');
6
6
 
7
7
 
8
8
 
@@ -329,8 +329,9 @@ function buildTransform(transform, { enableHardwareAcceleration = true, allowTra
329
329
 
330
330
  const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token);
331
331
  const isCSSVariableName = checkStringStartsWith("--");
332
- const isCSSVariableToken = checkStringStartsWith("var(--");
333
- const cssVariableRegex = /var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g;
332
+ const startsAsVariableToken = checkStringStartsWith("var(--");
333
+ const isCSSVariableToken = (key) => startsAsVariableToken(key) && singleCssVariableRegex.test(key);
334
+ const singleCssVariableRegex = /var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)$/i;
334
335
 
335
336
  /**
336
337
  * Provided a value and a ValueType, returns the value as that value type.
@@ -341,7 +342,13 @@ const getValueAsType = (value, type) => {
341
342
  : value;
342
343
  };
343
344
 
344
- const clamp = (min, max, v) => Math.min(Math.max(v, min), max);
345
+ const clamp = (min, max, v) => {
346
+ if (v > max)
347
+ return max;
348
+ if (v < min)
349
+ return min;
350
+ return v;
351
+ };
345
352
 
346
353
  const number = {
347
354
  test: (v) => typeof v === "number",
@@ -948,6 +955,89 @@ const easingDefinitionToFunction = (definition) => {
948
955
  return definition;
949
956
  };
950
957
 
958
+ /*
959
+ Progress within given range
960
+
961
+ Given a lower limit and an upper limit, we return the progress
962
+ (expressed as a number 0-1) represented by the given value, and
963
+ limit that progress to within 0-1.
964
+
965
+ @param [number]: Lower limit
966
+ @param [number]: Upper limit
967
+ @param [number]: Value to find progress within given range
968
+ @return [number]: Progress of value within range as expressed 0-1
969
+ */
970
+ const progress = (from, to, value) => {
971
+ const toFromDifference = to - from;
972
+ return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
973
+ };
974
+
975
+ /*
976
+ Value in range from progress
977
+
978
+ Given a lower limit and an upper limit, we return the value within
979
+ that range as expressed by progress (usually a number from 0 to 1)
980
+
981
+ So progress = 0.5 would change
982
+
983
+ from -------- to
984
+
985
+ to
986
+
987
+ from ---- to
988
+
989
+ E.g. from = 10, to = 20, progress = 0.5 => 15
990
+
991
+ @param [number]: Lower limit of range
992
+ @param [number]: Upper limit of range
993
+ @param [number]: The progress between lower and upper limits expressed 0-1
994
+ @return [number]: Value as calculated from progress within range (not limited within range)
995
+ */
996
+ const mixNumber$1 = (from, to, progress) => {
997
+ return from + (to - from) * progress;
998
+ };
999
+
1000
+ // Adapted from https://gist.github.com/mjackson/5311256
1001
+ function hueToRgb(p, q, t) {
1002
+ if (t < 0)
1003
+ t += 1;
1004
+ if (t > 1)
1005
+ t -= 1;
1006
+ if (t < 1 / 6)
1007
+ return p + (q - p) * 6 * t;
1008
+ if (t < 1 / 2)
1009
+ return q;
1010
+ if (t < 2 / 3)
1011
+ return p + (q - p) * (2 / 3 - t) * 6;
1012
+ return p;
1013
+ }
1014
+ function hslaToRgba({ hue, saturation, lightness, alpha }) {
1015
+ hue /= 360;
1016
+ saturation /= 100;
1017
+ lightness /= 100;
1018
+ let red = 0;
1019
+ let green = 0;
1020
+ let blue = 0;
1021
+ if (!saturation) {
1022
+ red = green = blue = lightness;
1023
+ }
1024
+ else {
1025
+ const q = lightness < 0.5
1026
+ ? lightness * (1 + saturation)
1027
+ : lightness + saturation - lightness * saturation;
1028
+ const p = 2 * lightness - q;
1029
+ red = hueToRgb(p, q, hue + 1 / 3);
1030
+ green = hueToRgb(p, q, hue);
1031
+ blue = hueToRgb(p, q, hue - 1 / 3);
1032
+ }
1033
+ return {
1034
+ red: Math.round(red * 255),
1035
+ green: Math.round(green * 255),
1036
+ blue: Math.round(blue * 255),
1037
+ alpha,
1038
+ };
1039
+ }
1040
+
951
1041
  /**
952
1042
  * Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,
953
1043
  * but false if a number or multiple colors
@@ -1039,98 +1129,13 @@ const hsla = {
1039
1129
  },
1040
1130
  };
1041
1131
 
1042
- const color = {
1043
- test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
1044
- parse: (v) => {
1045
- if (rgba.test(v)) {
1046
- return rgba.parse(v);
1047
- }
1048
- else if (hsla.test(v)) {
1049
- return hsla.parse(v);
1050
- }
1051
- else {
1052
- return hex.parse(v);
1053
- }
1054
- },
1055
- transform: (v) => {
1056
- return isString(v)
1057
- ? v
1058
- : v.hasOwnProperty("red")
1059
- ? rgba.transform(v)
1060
- : hsla.transform(v);
1061
- },
1062
- };
1063
-
1064
- /*
1065
- Value in range from progress
1066
-
1067
- Given a lower limit and an upper limit, we return the value within
1068
- that range as expressed by progress (usually a number from 0 to 1)
1069
-
1070
- So progress = 0.5 would change
1071
-
1072
- from -------- to
1073
-
1074
- to
1075
-
1076
- from ---- to
1077
-
1078
- E.g. from = 10, to = 20, progress = 0.5 => 15
1079
-
1080
- @param [number]: Lower limit of range
1081
- @param [number]: Upper limit of range
1082
- @param [number]: The progress between lower and upper limits expressed 0-1
1083
- @return [number]: Value as calculated from progress within range (not limited within range)
1084
- */
1085
- const mix = (from, to, progress) => -progress * from + progress * to + from;
1086
-
1087
- // Adapted from https://gist.github.com/mjackson/5311256
1088
- function hueToRgb(p, q, t) {
1089
- if (t < 0)
1090
- t += 1;
1091
- if (t > 1)
1092
- t -= 1;
1093
- if (t < 1 / 6)
1094
- return p + (q - p) * 6 * t;
1095
- if (t < 1 / 2)
1096
- return q;
1097
- if (t < 2 / 3)
1098
- return p + (q - p) * (2 / 3 - t) * 6;
1099
- return p;
1100
- }
1101
- function hslaToRgba({ hue, saturation, lightness, alpha }) {
1102
- hue /= 360;
1103
- saturation /= 100;
1104
- lightness /= 100;
1105
- let red = 0;
1106
- let green = 0;
1107
- let blue = 0;
1108
- if (!saturation) {
1109
- red = green = blue = lightness;
1110
- }
1111
- else {
1112
- const q = lightness < 0.5
1113
- ? lightness * (1 + saturation)
1114
- : lightness + saturation - lightness * saturation;
1115
- const p = 2 * lightness - q;
1116
- red = hueToRgb(p, q, hue + 1 / 3);
1117
- green = hueToRgb(p, q, hue);
1118
- blue = hueToRgb(p, q, hue - 1 / 3);
1119
- }
1120
- return {
1121
- red: Math.round(red * 255),
1122
- green: Math.round(green * 255),
1123
- blue: Math.round(blue * 255),
1124
- alpha,
1125
- };
1126
- }
1127
-
1128
1132
  // Linear color space blending
1129
1133
  // Explained https://www.youtube.com/watch?v=LKnqECcg6Gw
1130
1134
  // Demonstrated http://codepen.io/osublake/pen/xGVVaN
1131
1135
  const mixLinearColor = (from, to, v) => {
1132
1136
  const fromExpo = from * from;
1133
- return Math.sqrt(Math.max(0, v * (to * to - fromExpo) + fromExpo));
1137
+ const expo = v * (to * to - fromExpo) + fromExpo;
1138
+ return expo < 0 ? 0 : Math.sqrt(expo);
1134
1139
  };
1135
1140
  const colorTypes = [hex, rgba, hsla];
1136
1141
  const getColorType = (v) => colorTypes.find((type) => type.test(v));
@@ -1152,11 +1157,33 @@ const mixColor = (from, to) => {
1152
1157
  blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v);
1153
1158
  blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v);
1154
1159
  blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v);
1155
- blended.alpha = mix(fromRGBA.alpha, toRGBA.alpha, v);
1160
+ blended.alpha = mixNumber$1(fromRGBA.alpha, toRGBA.alpha, v);
1156
1161
  return rgba.transform(blended);
1157
1162
  };
1158
1163
  };
1159
1164
 
1165
+ const color = {
1166
+ test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
1167
+ parse: (v) => {
1168
+ if (rgba.test(v)) {
1169
+ return rgba.parse(v);
1170
+ }
1171
+ else if (hsla.test(v)) {
1172
+ return hsla.parse(v);
1173
+ }
1174
+ else {
1175
+ return hex.parse(v);
1176
+ }
1177
+ },
1178
+ transform: (v) => {
1179
+ return isString(v)
1180
+ ? v
1181
+ : v.hasOwnProperty("red")
1182
+ ? rgba.transform(v)
1183
+ : hsla.transform(v);
1184
+ },
1185
+ };
1186
+
1160
1187
  function test(v) {
1161
1188
  var _a, _b;
1162
1189
  return (isNaN(v) &&
@@ -1165,65 +1192,65 @@ function test(v) {
1165
1192
  (((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) >
1166
1193
  0);
1167
1194
  }
1168
- const cssVarTokeniser = {
1169
- regex: cssVariableRegex,
1170
- countKey: "Vars",
1171
- token: "${v}",
1172
- parse: noop,
1173
- };
1174
- const colorTokeniser = {
1175
- regex: colorRegex,
1176
- countKey: "Colors",
1177
- token: "${c}",
1178
- parse: color.parse,
1179
- };
1180
- const numberTokeniser = {
1181
- regex: floatRegex,
1182
- countKey: "Numbers",
1183
- token: "${n}",
1184
- parse: number.parse,
1185
- };
1186
- function tokenise(info, { regex, countKey, token, parse }) {
1187
- const matches = info.tokenised.match(regex);
1188
- if (!matches)
1189
- return;
1190
- info["num" + countKey] = matches.length;
1191
- info.tokenised = info.tokenised.replace(regex, token);
1192
- info.values.push(...matches.map(parse));
1193
- }
1195
+ const NUMBER_TOKEN = "number";
1196
+ const COLOR_TOKEN = "color";
1197
+ const VAR_TOKEN = "var";
1198
+ const VAR_FUNCTION_TOKEN = "var(";
1199
+ const SPLIT_TOKEN = "${}";
1200
+ const complexRegex = /(var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\))|(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))|((-)?([\d]*\.?[\d])+)/gi;
1194
1201
  function analyseComplexValue(value) {
1195
1202
  const originalValue = value.toString();
1196
- const info = {
1197
- value: originalValue,
1198
- tokenised: originalValue,
1199
- values: [],
1200
- numVars: 0,
1201
- numColors: 0,
1202
- numNumbers: 0,
1203
+ const matchedValues = originalValue.match(complexRegex) || [];
1204
+ const values = [];
1205
+ const indexes = {
1206
+ color: [],
1207
+ number: [],
1208
+ var: [],
1203
1209
  };
1204
- if (info.value.includes("var(--"))
1205
- tokenise(info, cssVarTokeniser);
1206
- tokenise(info, colorTokeniser);
1207
- tokenise(info, numberTokeniser);
1208
- return info;
1210
+ const types = [];
1211
+ for (let i = 0; i < matchedValues.length; i++) {
1212
+ const parsedValue = matchedValues[i];
1213
+ if (color.test(parsedValue)) {
1214
+ indexes.color.push(i);
1215
+ types.push(COLOR_TOKEN);
1216
+ values.push(color.parse(parsedValue));
1217
+ }
1218
+ else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
1219
+ indexes.var.push(i);
1220
+ types.push(VAR_TOKEN);
1221
+ values.push(parsedValue);
1222
+ }
1223
+ else {
1224
+ indexes.number.push(i);
1225
+ types.push(NUMBER_TOKEN);
1226
+ values.push(parseFloat(parsedValue));
1227
+ }
1228
+ }
1229
+ const tokenised = originalValue.replace(complexRegex, SPLIT_TOKEN);
1230
+ const split = tokenised.split(SPLIT_TOKEN);
1231
+ return { values, split, indexes, types };
1209
1232
  }
1210
1233
  function parseComplexValue(v) {
1211
1234
  return analyseComplexValue(v).values;
1212
1235
  }
1213
1236
  function createTransformer(source) {
1214
- const { values, numColors, numVars, tokenised } = analyseComplexValue(source);
1215
- const numValues = values.length;
1237
+ const { split, types } = analyseComplexValue(source);
1238
+ const numSections = split.length;
1216
1239
  return (v) => {
1217
- let output = tokenised;
1218
- for (let i = 0; i < numValues; i++) {
1219
- if (i < numVars) {
1220
- output = output.replace(cssVarTokeniser.token, v[i]);
1221
- }
1222
- else if (i < numVars + numColors) {
1223
- output = output.replace(colorTokeniser.token, color.transform(v[i]));
1224
- }
1225
- else {
1226
- output = output.replace(numberTokeniser.token, sanitize(v[i]));
1240
+ let output = "";
1241
+ for (let i = 0; i < numSections; i++) {
1242
+ output += split[i];
1243
+ if (v[i] !== undefined) {
1244
+ const type = types[i];
1245
+ if (type === NUMBER_TOKEN) {
1246
+ output += sanitize(v[i]);
1247
+ }
1248
+ else if (type === COLOR_TOKEN) {
1249
+ output += color.transform(v[i]);
1250
+ }
1251
+ else {
1252
+ output += v[i];
1253
+ }
1227
1254
  }
1228
1255
  }
1229
1256
  return output;
@@ -1242,37 +1269,48 @@ const complex = {
1242
1269
  getAnimatableNone: getAnimatableNone$1,
1243
1270
  };
1244
1271
 
1245
- const mixImmediate = (origin, target) => (p) => `${p > 0 ? target : origin}`;
1246
- function getMixer$1(origin, target) {
1247
- if (typeof origin === "number") {
1248
- return (v) => mix(origin, target, v);
1272
+ function mixImmediate(a, b) {
1273
+ return (p) => (p > 0 ? b : a);
1274
+ }
1275
+ function mixNumber(a, b) {
1276
+ return (p) => mixNumber$1(a, b, p);
1277
+ }
1278
+ function getMixer$1(a) {
1279
+ if (typeof a === "number") {
1280
+ return mixNumber;
1249
1281
  }
1250
- else if (color.test(origin)) {
1251
- return mixColor(origin, target);
1282
+ else if (typeof a === "string") {
1283
+ return isCSSVariableToken(a)
1284
+ ? mixImmediate
1285
+ : color.test(a)
1286
+ ? mixColor
1287
+ : mixComplex;
1252
1288
  }
1253
- else {
1254
- return origin.startsWith("var(")
1255
- ? mixImmediate(origin, target)
1256
- : mixComplex(origin, target);
1289
+ else if (Array.isArray(a)) {
1290
+ return mixArray;
1257
1291
  }
1292
+ else if (typeof a === "object") {
1293
+ return color.test(a) ? mixColor : mixObject;
1294
+ }
1295
+ return mixImmediate;
1258
1296
  }
1259
- const mixArray = (from, to) => {
1260
- const output = [...from];
1297
+ function mixArray(a, b) {
1298
+ const output = [...a];
1261
1299
  const numValues = output.length;
1262
- const blendValue = from.map((fromThis, i) => getMixer$1(fromThis, to[i]));
1263
- return (v) => {
1300
+ const blendValue = a.map((v, i) => getMixer$1(v)(v, b[i]));
1301
+ return (p) => {
1264
1302
  for (let i = 0; i < numValues; i++) {
1265
- output[i] = blendValue[i](v);
1303
+ output[i] = blendValue[i](p);
1266
1304
  }
1267
1305
  return output;
1268
1306
  };
1269
- };
1270
- const mixObject = (origin, target) => {
1271
- const output = { ...origin, ...target };
1307
+ }
1308
+ function mixObject(a, b) {
1309
+ const output = { ...a, ...b };
1272
1310
  const blendValue = {};
1273
1311
  for (const key in output) {
1274
- if (origin[key] !== undefined && target[key] !== undefined) {
1275
- blendValue[key] = getMixer$1(origin[key], target[key]);
1312
+ if (a[key] !== undefined && b[key] !== undefined) {
1313
+ blendValue[key] = getMixer$1(a[key])(a[key], b[key]);
1276
1314
  }
1277
1315
  }
1278
1316
  return (v) => {
@@ -1281,16 +1319,29 @@ const mixObject = (origin, target) => {
1281
1319
  }
1282
1320
  return output;
1283
1321
  };
1284
- };
1322
+ }
1323
+ function matchOrder(origin, target) {
1324
+ var _a;
1325
+ const orderedOrigin = [];
1326
+ const pointers = { color: 0, var: 0, number: 0 };
1327
+ for (let i = 0; i < target.values.length; i++) {
1328
+ const type = target.types[i];
1329
+ const originIndex = origin.indexes[type][pointers[type]];
1330
+ const originValue = (_a = origin.values[originIndex]) !== null && _a !== void 0 ? _a : 0;
1331
+ orderedOrigin[i] = originValue;
1332
+ pointers[type]++;
1333
+ }
1334
+ return orderedOrigin;
1335
+ }
1285
1336
  const mixComplex = (origin, target) => {
1286
1337
  const template = complex.createTransformer(target);
1287
1338
  const originStats = analyseComplexValue(origin);
1288
1339
  const targetStats = analyseComplexValue(target);
1289
- const canInterpolate = originStats.numVars === targetStats.numVars &&
1290
- originStats.numColors === targetStats.numColors &&
1291
- originStats.numNumbers >= targetStats.numNumbers;
1340
+ const canInterpolate = originStats.indexes.var.length === targetStats.indexes.var.length &&
1341
+ originStats.indexes.color.length === targetStats.indexes.color.length &&
1342
+ originStats.indexes.number.length >= targetStats.indexes.number.length;
1292
1343
  if (canInterpolate) {
1293
- return pipe(mixArray(originStats.values, targetStats.values), template);
1344
+ return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template);
1294
1345
  }
1295
1346
  else {
1296
1347
  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.`);
@@ -1298,42 +1349,19 @@ const mixComplex = (origin, target) => {
1298
1349
  }
1299
1350
  };
1300
1351
 
1301
- /*
1302
- Progress within given range
1303
-
1304
- Given a lower limit and an upper limit, we return the progress
1305
- (expressed as a number 0-1) represented by the given value, and
1306
- limit that progress to within 0-1.
1307
-
1308
- @param [number]: Lower limit
1309
- @param [number]: Upper limit
1310
- @param [number]: Value to find progress within given range
1311
- @return [number]: Progress of value within range as expressed 0-1
1312
- */
1313
- const progress = (from, to, value) => {
1314
- const toFromDifference = to - from;
1315
- return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
1316
- };
1317
-
1318
- const mixNumber = (from, to) => (p) => mix(from, to, p);
1319
- function detectMixerFactory(v) {
1320
- if (typeof v === "number") {
1321
- return mixNumber;
1322
- }
1323
- else if (typeof v === "string") {
1324
- return color.test(v) ? mixColor : mixComplex;
1325
- }
1326
- else if (Array.isArray(v)) {
1327
- return mixArray;
1352
+ function mix(from, to, p) {
1353
+ if (typeof from === "number" &&
1354
+ typeof to === "number" &&
1355
+ typeof p === "number") {
1356
+ return mixNumber$1(from, to, p);
1328
1357
  }
1329
- else if (typeof v === "object") {
1330
- return mixObject;
1331
- }
1332
- return mixNumber;
1358
+ const mixer = getMixer$1(from);
1359
+ return mixer(from, to);
1333
1360
  }
1361
+
1334
1362
  function createMixers(output, ease, customMixer) {
1335
1363
  const mixers = [];
1336
- const mixerFactory = customMixer || detectMixerFactory(output[0]);
1364
+ const mixerFactory = customMixer || mix;
1337
1365
  const numMixers = output.length - 1;
1338
1366
  for (let i = 0; i < numMixers; i++) {
1339
1367
  let mixer = mixerFactory(output[i], output[i + 1]);
@@ -1400,7 +1428,7 @@ function fillOffset(offset, remaining) {
1400
1428
  const min = offset[offset.length - 1];
1401
1429
  for (let i = 1; i <= remaining; i++) {
1402
1430
  const offsetProgress = progress(0, remaining, i);
1403
- offset.push(mix(min, 1, offsetProgress));
1431
+ offset.push(mixNumber$1(min, 1, offsetProgress));
1404
1432
  }
1405
1433
  }
1406
1434
 
@@ -1829,6 +1857,7 @@ const types = {
1829
1857
  keyframes: keyframes,
1830
1858
  spring,
1831
1859
  };
1860
+ const percentToProgress = (percent) => percent / 100;
1832
1861
  /**
1833
1862
  * Animate a single value on the main thread.
1834
1863
  *
@@ -1864,9 +1893,7 @@ function animateValue({ autoplay = true, delay = 0, driver = frameloopDriver, ke
1864
1893
  if (process.env.NODE_ENV !== "production") {
1865
1894
  exports.invariant(keyframes$1.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`);
1866
1895
  }
1867
- mapNumbersToKeyframes = interpolate([0, 100], keyframes$1, {
1868
- clamp: false,
1869
- });
1896
+ mapNumbersToKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));
1870
1897
  keyframes$1 = [0, 100];
1871
1898
  }
1872
1899
  const generator = generatorFactory({ ...options, keyframes: keyframes$1 });
@@ -2131,7 +2158,6 @@ const acceleratedValues = new Set([
2131
2158
  "clipPath",
2132
2159
  "filter",
2133
2160
  "transform",
2134
- "backgroundColor",
2135
2161
  ]);
2136
2162
  /**
2137
2163
  * 10ms is chosen here as it strikes a balance between smooth
@@ -2750,7 +2776,7 @@ class MotionValue {
2750
2776
  * This will be replaced by the build step with the latest version number.
2751
2777
  * When MotionValues are provided to motion components, warn if versions are mixed.
2752
2778
  */
2753
- this.version = "11.0.3";
2779
+ this.version = "11.0.5";
2754
2780
  /**
2755
2781
  * Tracks whether this value can output a velocity. Currently this is only true
2756
2782
  * if the value is numerical, but we might be able to widen the scope here and support
@@ -3449,7 +3475,7 @@ function translateAxis(axis, distance) {
3449
3475
  */
3450
3476
  function transformAxis(axis, transforms, [key, scaleKey, originKey]) {
3451
3477
  const axisOrigin = transforms[originKey] !== undefined ? transforms[originKey] : 0.5;
3452
- const originPoint = mix(axis.min, axis.max, axisOrigin);
3478
+ const originPoint = mixNumber$1(axis.min, axis.max, axisOrigin);
3453
3479
  // Apply the axis delta to the final axis
3454
3480
  applyAxisDelta(axis, transforms[key], transforms[scaleKey], originPoint, transforms.scale);
3455
3481
  }
@@ -3978,7 +4004,7 @@ function updateMotionValuesFromProps(element, next, prev) {
3978
4004
  * and warn against mismatches.
3979
4005
  */
3980
4006
  if (process.env.NODE_ENV === "development") {
3981
- warnOnce(nextValue.version === "11.0.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.0.3 may not work as expected.`);
4007
+ warnOnce(nextValue.version === "11.0.5", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.0.5 may not work as expected.`);
3982
4008
  }
3983
4009
  }
3984
4010
  else if (isMotionValue(prevValue)) {
@@ -4713,7 +4739,7 @@ function addKeyframes(sequence, keyframes, easing, offset, startTime, endTime) {
4713
4739
  for (let i = 0; i < keyframes.length; i++) {
4714
4740
  sequence.push({
4715
4741
  value: keyframes[i],
4716
- at: mix(startTime, endTime, offset[i]),
4742
+ at: mixNumber$1(startTime, endTime, offset[i]),
4717
4743
  easing: getEasingForSegment(easing, i),
4718
4744
  });
4719
4745
  }
@@ -5681,6 +5707,7 @@ exports.measurePageBox = measurePageBox;
5681
5707
  exports.millisecondsToSeconds = millisecondsToSeconds;
5682
5708
  exports.mirrorEasing = mirrorEasing;
5683
5709
  exports.mix = mix;
5710
+ exports.mixNumber = mixNumber$1;
5684
5711
  exports.motionValue = motionValue;
5685
5712
  exports.moveItem = moveItem;
5686
5713
  exports.noop = noop;