framer-motion 6.5.1 → 7.0.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.
@@ -27,7 +27,7 @@
27
27
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
28
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
29
 
30
- /*! *****************************************************************************
30
+ /******************************************************************************
31
31
  Copyright (c) Microsoft Corporation.
32
32
 
33
33
  Permission to use, copy, modify, and/or distribute this software for any
@@ -69,7 +69,7 @@
69
69
  return __assign.apply(this, arguments);
70
70
  };
71
71
 
72
- function __rest$1(s, e) {
72
+ function __rest(s, e) {
73
73
  var t = {};
74
74
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
75
75
  t[p] = s[p];
@@ -887,43 +887,43 @@
887
887
  : value;
888
888
  };
889
889
 
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,3}\s*\/*\s*[\d\.]+%?\))/gi;
894
- const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;
895
- function isString$1(v) {
890
+ const clamp$3 = (min, max) => (v) => Math.max(Math.min(v, max), min);
891
+ const sanitize$1 = (v) => (v % 1 ? Number(v.toFixed(5)) : v);
892
+ const floatRegex$1 = /(-)?([\d]*\.?[\d])+/g;
893
+ const colorRegex$1 = /(#[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;
894
+ const singleColorRegex$1 = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;
895
+ function isString$2(v) {
896
896
  return typeof v === 'string';
897
897
  }
898
898
 
899
- const number = {
899
+ const number$1 = {
900
900
  test: (v) => typeof v === 'number',
901
901
  parse: parseFloat,
902
902
  transform: (v) => v,
903
903
  };
904
- const alpha = Object.assign(Object.assign({}, number), { transform: clamp$2(0, 1) });
905
- const scale = Object.assign(Object.assign({}, number), { default: 1 });
904
+ const alpha$1 = Object.assign(Object.assign({}, number$1), { transform: clamp$3(0, 1) });
905
+ const scale = Object.assign(Object.assign({}, number$1), { default: 1 });
906
906
 
907
- const createUnitType = (unit) => ({
908
- test: (v) => isString$1(v) && v.endsWith(unit) && v.split(' ').length === 1,
907
+ const createUnitType$1 = (unit) => ({
908
+ test: (v) => isString$2(v) && v.endsWith(unit) && v.split(' ').length === 1,
909
909
  parse: parseFloat,
910
910
  transform: (v) => `${v}${unit}`,
911
911
  });
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)) ||
912
+ const degrees = createUnitType$1('deg');
913
+ const percent$1 = createUnitType$1('%');
914
+ const px = createUnitType$1('px');
915
+ const vh = createUnitType$1('vh');
916
+ const vw = createUnitType$1('vw');
917
+ const progressPercentage = Object.assign(Object.assign({}, percent$1), { parse: (v) => percent$1.parse(v) / 100, transform: (v) => percent$1.transform(v * 100) });
918
+
919
+ const isColorString$1 = (type, testProp) => (v) => {
920
+ return Boolean((isString$2(v) && singleColorRegex$1.test(v) && v.startsWith(type)) ||
921
921
  (testProp && Object.prototype.hasOwnProperty.call(v, testProp)));
922
922
  };
923
- const splitColor = (aName, bName, cName) => (v) => {
924
- if (!isString$1(v))
923
+ const splitColor$1 = (aName, bName, cName) => (v) => {
924
+ if (!isString$2(v))
925
925
  return v;
926
- const [a, b, c, alpha] = v.match(floatRegex);
926
+ const [a, b, c, alpha] = v.match(floatRegex$1);
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('hsl', 'hue'),
937
- parse: splitColor('hue', 'saturation', 'lightness'),
938
- transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
935
+ const hsla$1 = {
936
+ test: isColorString$1('hsl', 'hue'),
937
+ parse: splitColor$1('hue', 'saturation', 'lightness'),
938
+ transform: ({ hue, saturation, lightness, alpha: alpha$1$1 = 1 }) => {
939
939
  return ('hsla(' +
940
940
  Math.round(hue) +
941
941
  ', ' +
942
- percent.transform(sanitize(saturation)) +
942
+ percent$1.transform(sanitize$1(saturation)) +
943
943
  ', ' +
944
- percent.transform(sanitize(lightness)) +
944
+ percent$1.transform(sanitize$1(lightness)) +
945
945
  ', ' +
946
- sanitize(alpha.transform(alpha$1)) +
946
+ sanitize$1(alpha$1.transform(alpha$1$1)) +
947
947
  ')');
948
948
  },
949
949
  };
950
950
 
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) +
951
+ const clampRgbUnit$1 = clamp$3(0, 255);
952
+ const rgbUnit$1 = Object.assign(Object.assign({}, number$1), { transform: (v) => Math.round(clampRgbUnit$1(v)) });
953
+ const rgba$1 = {
954
+ test: isColorString$1('rgb', 'red'),
955
+ parse: splitColor$1('red', 'green', 'blue'),
956
+ transform: ({ red, green, blue, alpha: alpha$1$1 = 1 }) => 'rgba(' +
957
+ rgbUnit$1.transform(red) +
958
958
  ', ' +
959
- rgbUnit.transform(green) +
959
+ rgbUnit$1.transform(green) +
960
960
  ', ' +
961
- rgbUnit.transform(blue) +
961
+ rgbUnit$1.transform(blue) +
962
962
  ', ' +
963
- sanitize(alpha.transform(alpha$1)) +
963
+ sanitize$1(alpha$1.transform(alpha$1$1)) +
964
964
  ')',
965
965
  };
966
966
 
967
- function parseHex(v) {
967
+ function parseHex$1(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.transform,
995
+ const hex$1 = {
996
+ test: isColorString$1('#'),
997
+ parse: parseHex$1,
998
+ transform: rgba$1.transform,
999
999
  };
1000
1000
 
1001
- const color = {
1002
- test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
1001
+ const color$1 = {
1002
+ test: (v) => rgba$1.test(v) || hex$1.test(v) || hsla$1.test(v),
1003
1003
  parse: (v) => {
1004
- if (rgba.test(v)) {
1005
- return rgba.parse(v);
1004
+ if (rgba$1.test(v)) {
1005
+ return rgba$1.parse(v);
1006
1006
  }
1007
- else if (hsla.test(v)) {
1008
- return hsla.parse(v);
1007
+ else if (hsla$1.test(v)) {
1008
+ return hsla$1.parse(v);
1009
1009
  }
1010
1010
  else {
1011
- return hex.parse(v);
1011
+ return hex$1.parse(v);
1012
1012
  }
1013
1013
  },
1014
1014
  transform: (v) => {
1015
- return isString$1(v)
1015
+ return isString$2(v)
1016
1016
  ? v
1017
1017
  : v.hasOwnProperty('red')
1018
- ? rgba.transform(v)
1019
- : hsla.transform(v);
1018
+ ? rgba$1.transform(v)
1019
+ : hsla$1.transform(v);
1020
1020
  },
1021
1021
  };
1022
1022
 
1023
- const colorToken = '${c}';
1024
- const numberToken = '${n}';
1025
- function test(v) {
1023
+ const colorToken$1 = '${c}';
1024
+ const numberToken$1 = '${n}';
1025
+ function test$1(v) {
1026
1026
  var _a, _b, _c, _d;
1027
1027
  return (isNaN(v) &&
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);
1028
+ isString$2(v) &&
1029
+ ((_b = (_a = v.match(floatRegex$1)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + ((_d = (_c = v.match(colorRegex$1)) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0);
1030
1030
  }
1031
- function analyse$1(v) {
1031
+ function analyse$2(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$1);
1037
1037
  if (colors) {
1038
1038
  numColors = colors.length;
1039
- v = v.replace(colorRegex, colorToken);
1040
- values.push(...colors.map(color.parse));
1039
+ v = v.replace(colorRegex$1, colorToken$1);
1040
+ values.push(...colors.map(color$1.parse));
1041
1041
  }
1042
- const numbers = v.match(floatRegex);
1042
+ const numbers = v.match(floatRegex$1);
1043
1043
  if (numbers) {
1044
- v = v.replace(floatRegex, numberToken);
1045
- values.push(...numbers.map(number.parse));
1044
+ v = v.replace(floatRegex$1, numberToken$1);
1045
+ values.push(...numbers.map(number$1.parse));
1046
1046
  }
1047
1047
  return { values, numColors, tokenised: v };
1048
1048
  }
1049
- function parse(v) {
1050
- return analyse$1(v).values;
1049
+ function parse$1(v) {
1050
+ return analyse$2(v).values;
1051
1051
  }
1052
- function createTransformer(v) {
1053
- const { values, numColors, tokenised } = analyse$1(v);
1052
+ function createTransformer$1(v) {
1053
+ const { values, numColors, tokenised } = analyse$2(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 : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i]));
1058
+ output = output.replace(i < numColors ? colorToken$1 : numberToken$1, i < numColors ? color$1.transform(v[i]) : sanitize$1(v[i]));
1059
1059
  }
1060
1060
  return output;
1061
1061
  };
1062
1062
  }
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));
1063
+ const convertNumbersToZero$1 = (v) => typeof v === 'number' ? 0 : v;
1064
+ function getAnimatableNone$2(v) {
1065
+ const parsed = parse$1(v);
1066
+ const transformer = createTransformer$1(v);
1067
+ return transformer(parsed.map(convertNumbersToZero$1));
1068
1068
  }
1069
- const complex = { test, parse, createTransformer, getAnimatableNone: getAnimatableNone$1 };
1069
+ const complex$1 = { test: test$1, parse: parse$1, createTransformer: createTransformer$1, getAnimatableNone: getAnimatableNone$2 };
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$1) || [];
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), { getAnimatableNone: (v) => {
1086
+ const filter = Object.assign(Object.assign({}, complex$1), { 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), { transform: Math.round });
1091
+ var int = __assign(__assign({}, number$1), { 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$1,
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$1,
1156
+ strokeOpacity: alpha$1,
1157
1157
  numOctaves: int,
1158
1158
  };
1159
1159
 
@@ -1457,7 +1457,7 @@
1457
1457
  function buildSVGAttrs(state, _a, options, transformTemplate) {
1458
1458
  var attrX = _a.attrX, attrY = _a.attrY, originX = _a.originX, originY = _a.originY, pathLength = _a.pathLength, _b = _a.pathSpacing, pathSpacing = _b === void 0 ? 1 : _b, _c = _a.pathOffset, pathOffset = _c === void 0 ? 0 : _c,
1459
1459
  // This is object creation, which we try to avoid per-frame.
1460
- latest = __rest$1(_a, ["attrX", "attrY", "originX", "originY", "pathLength", "pathSpacing", "pathOffset"]);
1460
+ latest = __rest(_a, ["attrX", "attrY", "originX", "originY", "pathLength", "pathSpacing", "pathOffset"]);
1461
1461
  buildHTMLStyles(state, latest, options, transformTemplate);
1462
1462
  state.attrs = state.style;
1463
1463
  state.style = {};
@@ -1671,7 +1671,7 @@
1671
1671
  var resolved = resolveVariantFromProps(props, definition);
1672
1672
  if (!resolved)
1673
1673
  return;
1674
- var transitionEnd = resolved.transitionEnd; resolved.transition; var target = __rest$1(resolved, ["transitionEnd", "transition"]);
1674
+ var transitionEnd = resolved.transitionEnd; resolved.transition; var target = __rest(resolved, ["transitionEnd", "transition"]);
1675
1675
  for (var key in target) {
1676
1676
  var valueTarget = target[key];
1677
1677
  if (Array.isArray(valueTarget)) {
@@ -2008,7 +2008,7 @@
2008
2008
  return React.useEffect(function () { return function () { return callback(); }; }, []);
2009
2009
  }
2010
2010
 
2011
- const clamp$1 = (min, max, v) => Math.min(Math.max(v, min), max);
2011
+ const clamp$2 = (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$1(minDamping, maxDamping, dampingRatio);
2024
- duration = clamp$1(minDuration, maxDuration, duration / 1000);
2023
+ dampingRatio = clamp$2(minDamping, maxDamping, dampingRatio);
2024
+ duration = clamp$2(minDuration, maxDuration, duration / 1000);
2025
2025
  if (dampingRatio < 1) {
2026
2026
  envelope = (undampedFreq) => {
2027
2027
  const exponentialDecay = undampedFreq * dampingRatio;
@@ -2101,7 +2101,7 @@
2101
2101
  return springOptions;
2102
2102
  }
2103
2103
  function spring(_a) {
2104
- var { from = 0.0, to = 1.0, restSpeed = 2, restDelta } = _a, options = __rest$1(_a, ["from", "to", "restSpeed", "restDelta"]);
2104
+ var { from = 0.0, to = 1.0, restSpeed = 2, restDelta } = _a, options = __rest(_a, ["from", "to", "restSpeed", "restDelta"]);
2105
2105
  const state = { done: false, value: from };
2106
2106
  let { stiffness, damping, mass, velocity, duration, isResolvedFromDuration, } = getSpringOptions(options);
2107
2107
  let resolveSpring = zero;
@@ -2207,6 +2207,183 @@
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
+
2210
2387
  function hueToRgb(p, q, t) {
2211
2388
  if (t < 0)
2212
2389
  t += 1;
@@ -2439,7 +2616,7 @@
2439
2616
  ? fastInterpolate(input, mixers)
2440
2617
  : slowInterpolate(input, mixers);
2441
2618
  return isClamp
2442
- ? (v) => interpolator(clamp$1(input[0], input[inputLength - 1], v))
2619
+ ? (v) => interpolator(clamp$2(input[0], input[inputLength - 1], v))
2443
2620
  : interpolator;
2444
2621
  }
2445
2622
 
@@ -2567,12 +2744,12 @@
2567
2744
  }
2568
2745
 
2569
2746
  const defaultTimestep = (1 / 60) * 1000;
2570
- const getCurrentTime$1 = typeof performance !== "undefined"
2747
+ const getCurrentTime = typeof performance !== "undefined"
2571
2748
  ? () => performance.now()
2572
2749
  : () => Date.now();
2573
2750
  const onNextFrame = typeof window !== "undefined"
2574
2751
  ? (callback) => window.requestAnimationFrame(callback)
2575
- : (callback) => setTimeout(() => callback(getCurrentTime$1()), defaultTimestep);
2752
+ : (callback) => setTimeout(() => callback(getCurrentTime()), defaultTimestep);
2576
2753
 
2577
2754
  function createRenderStep(runNextFrame) {
2578
2755
  let toRun = [];
@@ -2709,7 +2886,7 @@
2709
2886
  };
2710
2887
  function animate$1(_a) {
2711
2888
  var _b, _c;
2712
- var { from, autoplay = true, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = "loop", repeatDelay = 0, onPlay, onStop, onComplete, onRepeat, onUpdate } = _a, options = __rest$1(_a, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]);
2889
+ var { from, autoplay = true, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = "loop", repeatDelay = 0, onPlay, onStop, onComplete, onRepeat, onUpdate } = _a, options = __rest(_a, ["from", "autoplay", "driver", "elapsed", "repeat", "repeatType", "repeatDelay", "onPlay", "onStop", "onComplete", "onRepeat", "onUpdate"]);
2713
2890
  let { to } = options;
2714
2891
  let driverControls;
2715
2892
  let repeatCount = 0;
@@ -3029,7 +3206,7 @@
3029
3206
  entries.forEach(fireObserverCallback);
3030
3207
  };
3031
3208
  function initIntersectionObserver(_a) {
3032
- var root = _a.root, options = __rest$1(_a, ["root"]);
3209
+ var root = _a.root, options = __rest(_a, ["root"]);
3033
3210
  var lookupRoot = root || document;
3034
3211
  /**
3035
3212
  * If we don't have an observer lookup map for this root, create one.
@@ -3311,7 +3488,7 @@
3311
3488
  if (typeof value === "number" || Array.isArray(value))
3312
3489
  return true;
3313
3490
  if (typeof value === "string" && // It's animatable if we have a string
3314
- complex.test(value) && // And it contains numbers and/or colors
3491
+ complex$1.test(value) && // And it contains numbers and/or colors
3315
3492
  !value.startsWith("url(") // Unless it starts with "url("
3316
3493
  ) {
3317
3494
  return true;
@@ -3374,9 +3551,9 @@
3374
3551
  */
3375
3552
  var defaultValueTypes = __assign(__assign({}, numberValueTypes), {
3376
3553
  // Color props
3377
- color: color, backgroundColor: color, outlineColor: color, fill: color, stroke: color,
3554
+ color: color$1, backgroundColor: color$1, outlineColor: color$1, fill: color$1, stroke: color$1,
3378
3555
  // Border props
3379
- borderColor: color, borderTopColor: color, borderRightColor: color, borderBottomColor: color, borderLeftColor: color, filter: filter, WebkitFilter: filter });
3556
+ borderColor: color$1, borderTopColor: color$1, borderRightColor: color$1, borderBottomColor: color$1, borderLeftColor: color$1, filter: filter, WebkitFilter: filter });
3380
3557
  /**
3381
3558
  * Gets the default ValueType for the provided value key
3382
3559
  */
@@ -3386,7 +3563,7 @@
3386
3563
  var _a;
3387
3564
  var defaultValueType = getDefaultValueType(key);
3388
3565
  if (defaultValueType !== filter)
3389
- defaultValueType = complex;
3566
+ defaultValueType = complex$1;
3390
3567
  // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
3391
3568
  return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
3392
3569
  }
@@ -3401,7 +3578,7 @@
3401
3578
  * if any options are left.
3402
3579
  */
3403
3580
  function isTransitionDefined(_a) {
3404
- _a.when; _a.delay; _a.delayChildren; _a.staggerChildren; _a.staggerDirection; _a.repeat; _a.repeatType; _a.repeatDelay; _a.from; var transition = __rest$1(_a, ["when", "delay", "delayChildren", "staggerChildren", "staggerDirection", "repeat", "repeatType", "repeatDelay", "from"]);
3581
+ _a.when; _a.delay; _a.delayChildren; _a.staggerChildren; _a.staggerDirection; _a.repeat; _a.repeatType; _a.repeatDelay; _a.from; var transition = __rest(_a, ["when", "delay", "delayChildren", "staggerChildren", "staggerDirection", "repeat", "repeatType", "repeatDelay", "from"]);
3405
3582
  return !!Object.keys(transition).length;
3406
3583
  }
3407
3584
  var legacyRepeatWarning = false;
@@ -3409,7 +3586,7 @@
3409
3586
  * Convert Framer Motion's Transition type into Popmotion-compatible options.
3410
3587
  */
3411
3588
  function convertTransitionToAnimationOptions(_a) {
3412
- var ease = _a.ease, times = _a.times, yoyo = _a.yoyo, flip = _a.flip, loop = _a.loop, transition = __rest$1(_a, ["ease", "times", "yoyo", "flip", "loop"]);
3589
+ var ease = _a.ease, times = _a.times, yoyo = _a.yoyo, flip = _a.flip, loop = _a.loop, transition = __rest(_a, ["ease", "times", "yoyo", "flip", "loop"]);
3413
3590
  var options = __assign({}, transition);
3414
3591
  if (times)
3415
3592
  options["offset"] = times;
@@ -3682,7 +3859,7 @@
3682
3859
  * This will be replaced by the build step with the latest version number.
3683
3860
  * When MotionValues are provided to motion components, warn if versions are mixed.
3684
3861
  */
3685
- this.version = "6.5.1";
3862
+ this.version = "7.0.0";
3686
3863
  /**
3687
3864
  * Duration, in milliseconds, since last updating frame.
3688
3865
  *
@@ -3981,7 +4158,7 @@
3981
4158
  /**
3982
4159
  * A list of value types commonly used for dimensions
3983
4160
  */
3984
- var dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
4161
+ var dimensionValueTypes = [number$1, px, percent$1, degrees, vw, vh, auto];
3985
4162
  /**
3986
4163
  * Tests a dimensional value against the list of dimension ValueTypes
3987
4164
  */
@@ -3992,7 +4169,7 @@
3992
4169
  /**
3993
4170
  * A list of all ValueTypes
3994
4171
  */
3995
- var valueTypes = __spreadArray(__spreadArray([], __read(dimensionValueTypes), false), [color, complex], false);
4172
+ var valueTypes = __spreadArray(__spreadArray([], __read(dimensionValueTypes), false), [color$1, complex$1], false);
3996
4173
  /**
3997
4174
  * Tests a value against the list of ValueTypes
3998
4175
  */
@@ -4012,7 +4189,7 @@
4012
4189
  }
4013
4190
  function setTarget(visualElement, definition) {
4014
4191
  var resolved = resolveVariant(visualElement, definition);
4015
- var _a = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = __rest$1(_a, ["transitionEnd", "transition"]);
4192
+ var _a = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = __rest(_a, ["transitionEnd", "transition"]);
4016
4193
  target = __assign(__assign({}, target), transitionEnd);
4017
4194
  for (var key in target) {
4018
4195
  var value = resolveFinalValueInKeyframes(target[key]);
@@ -4078,7 +4255,7 @@
4078
4255
  // If this is a number read as a string, ie "0" or "200", convert it to a number
4079
4256
  value = parseFloat(value);
4080
4257
  }
4081
- else if (!findValueType(value) && complex.test(targetValue)) {
4258
+ else if (!findValueType(value) && complex$1.test(targetValue)) {
4082
4259
  value = getAnimatableNone(key, targetValue);
4083
4260
  }
4084
4261
  visualElement.addValue(key, motionValue(value));
@@ -4172,7 +4349,7 @@
4172
4349
  function animateTarget(visualElement, definition, _a) {
4173
4350
  var _b;
4174
4351
  var _c = _a === void 0 ? {} : _a, _d = _c.delay, delay = _d === void 0 ? 0 : _d, transitionOverride = _c.transitionOverride, type = _c.type;
4175
- var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = __rest$1(_e, ["transition", "transitionEnd"]);
4352
+ var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = __rest(_e, ["transition", "transitionEnd"]);
4176
4353
  if (transitionOverride)
4177
4354
  transition = transitionOverride;
4178
4355
  var animations = [];
@@ -4272,7 +4449,7 @@
4272
4449
  var buildResolvedTypeValues = function (acc, definition) {
4273
4450
  var resolved = resolveVariant(visualElement, definition);
4274
4451
  if (resolved) {
4275
- resolved.transition; var transitionEnd = resolved.transitionEnd, target = __rest$1(resolved, ["transition", "transitionEnd"]);
4452
+ resolved.transition; var transitionEnd = resolved.transitionEnd, target = __rest(resolved, ["transition", "transitionEnd"]);
4276
4453
  acc = __assign(__assign(__assign({}, acc), target), transitionEnd);
4277
4454
  }
4278
4455
  return acc;
@@ -4608,8 +4785,8 @@
4608
4785
  */
4609
4786
  var PanSession = /** @class */ (function () {
4610
4787
  function PanSession(event, handlers, _a) {
4611
- var _this = this;
4612
4788
  var _b = _a === void 0 ? {} : _a, transformPagePoint = _b.transformPagePoint;
4789
+ var _this = this;
4613
4790
  /**
4614
4791
  * @internal
4615
4792
  */
@@ -4867,7 +5044,7 @@
4867
5044
  else if (sourceLength > targetLength) {
4868
5045
  origin = progress$1(source.min, source.max - targetLength, target.min);
4869
5046
  }
4870
- return clamp$1(0, 1, origin);
5047
+ return clamp$2(0, 1, origin);
4871
5048
  }
4872
5049
  /**
4873
5050
  * Rebase the calculated viewport constraints relative to the layout.min point.
@@ -5172,7 +5349,7 @@
5172
5349
  /**
5173
5350
  * If the MotionValue is a percentage value convert to px
5174
5351
  */
5175
- if (percent.test(current)) {
5352
+ if (percent$1.test(current)) {
5176
5353
  var measuredAxis = (_b = (_a = _this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.actual[axis];
5177
5354
  if (measuredAxis) {
5178
5355
  var length_1 = calcLength(measuredAxis);
@@ -5480,7 +5657,7 @@
5480
5657
  * If the element's layout changes, calculate the delta and apply that to
5481
5658
  * the drag gesture's origin point.
5482
5659
  */
5483
- projection.addEventListener("didUpdate", (function (_a) {
5660
+ var stopLayoutUpdateListener = projection.addEventListener("didUpdate", (function (_a) {
5484
5661
  var delta = _a.delta, hasLayoutChanged = _a.hasLayoutChanged;
5485
5662
  if (_this.isDragging && hasLayoutChanged) {
5486
5663
  eachAxis(function (axis) {
@@ -5497,6 +5674,7 @@
5497
5674
  stopResizeListener();
5498
5675
  stopPointerListener();
5499
5676
  stopMeasureLayoutListener();
5677
+ stopLayoutUpdateListener === null || stopLayoutUpdateListener === void 0 ? void 0 : stopLayoutUpdateListener();
5500
5678
  };
5501
5679
  };
5502
5680
  VisualElementDragControls.prototype.getProps = function () {
@@ -5651,7 +5829,7 @@
5651
5829
  * and warn against mismatches.
5652
5830
  */
5653
5831
  {
5654
- warnOnce(nextValue.version === "6.5.1", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.5.1 may not work as expected."));
5832
+ warnOnce(nextValue.version === "7.0.0", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.0.0 may not work as expected."));
5655
5833
  }
5656
5834
  }
5657
5835
  else if (isMotionValue(prevValue)) {
@@ -6124,7 +6302,7 @@
6124
6302
  */
6125
6303
  function resolveCSSVariables(visualElement, _a, transitionEnd) {
6126
6304
  var _b;
6127
- var target = __rest$1(_a, []);
6305
+ var target = __rest(_a, []);
6128
6306
  var element = visualElement.getInstance();
6129
6307
  if (!(element instanceof Element))
6130
6308
  return { target: target, transitionEnd: transitionEnd };
@@ -6183,7 +6361,7 @@
6183
6361
  value.set(to);
6184
6362
  };
6185
6363
  var isNumOrPxType = function (v) {
6186
- return v === number || v === px;
6364
+ return v === number$1 || v === px;
6187
6365
  };
6188
6366
  var BoundingBoxDimension;
6189
6367
  (function (BoundingBoxDimension) {
@@ -6490,9 +6668,9 @@
6490
6668
  * can be animated by Motion.
6491
6669
  */
6492
6670
  makeTargetAnimatable: function (element, _a, _b, isMounted) {
6671
+ var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, ["transition", "transitionEnd"]);
6493
6672
  var transformValues = _b.transformValues;
6494
6673
  if (isMounted === void 0) { isMounted = true; }
6495
- var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest$1(_a, ["transition", "transitionEnd"]);
6496
6674
  var origin = getOrigin(target, transition || {}, element);
6497
6675
  /**
6498
6676
  * If Framer has provided a function to convert `Color` etc value types, convert them
@@ -6599,11 +6777,11 @@
6599
6777
  return varToken;
6600
6778
  });
6601
6779
  }
6602
- var shadow = complex.parse(latest);
6780
+ var shadow = complex$1.parse(latest);
6603
6781
  // TODO: Doesn't support multiple shadows
6604
6782
  if (shadow.length > 5)
6605
6783
  return original;
6606
- var template = complex.createTransformer(latest);
6784
+ var template = complex$1.createTransformer(latest);
6607
6785
  var offset = typeof shadow[0] !== "number" ? 1 : 0;
6608
6786
  // Calculate the overall context scale
6609
6787
  var xScale = projectionDelta.x.scale * treeScale.x;
@@ -6832,7 +7010,7 @@
6832
7010
  isPx(followRadius) === isPx(leadRadius);
6833
7011
  if (canMix) {
6834
7012
  target[borderLabel] = Math.max(mix$1(asNumber(followRadius), asNumber(leadRadius), progress), 0);
6835
- if (percent.test(leadRadius) || percent.test(followRadius)) {
7013
+ if (percent$1.test(leadRadius) || percent$1.test(followRadius)) {
6836
7014
  target[borderLabel] += "%";
6837
7015
  }
6838
7016
  }
@@ -6926,7 +7104,7 @@
6926
7104
  if (origin === void 0) { origin = 0.5; }
6927
7105
  if (originAxis === void 0) { originAxis = axis; }
6928
7106
  if (sourceAxis === void 0) { sourceAxis = axis; }
6929
- if (percent.test(translate)) {
7107
+ if (percent$1.test(translate)) {
6930
7108
  translate = parseFloat(translate);
6931
7109
  var relativeProgress = mix$1(sourceAxis.min, sourceAxis.max, translate / 100);
6932
7110
  translate = relativeProgress - sourceAxis.min;
@@ -7152,9 +7330,9 @@
7152
7330
  var attachResizeListener = _a.attachResizeListener, defaultParent = _a.defaultParent, measureScroll = _a.measureScroll, checkIsScrollRoot = _a.checkIsScrollRoot, resetTransform = _a.resetTransform;
7153
7331
  return /** @class */ (function () {
7154
7332
  function ProjectionNode(id, latestValues, parent) {
7155
- var _this = this;
7156
7333
  if (latestValues === void 0) { latestValues = {}; }
7157
7334
  if (parent === void 0) { parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent(); }
7335
+ var _this = this;
7158
7336
  /**
7159
7337
  * A Set containing all this component's children. This is used to iterate
7160
7338
  * through the children.
@@ -8704,7 +8882,7 @@
8704
8882
  * @public
8705
8883
  */
8706
8884
  function MotionConfig(_a) {
8707
- var children = _a.children, isValidProp = _a.isValidProp, config = __rest$1(_a, ["children", "isValidProp"]);
8885
+ var children = _a.children, isValidProp = _a.isValidProp, config = __rest(_a, ["children", "isValidProp"]);
8708
8886
  isValidProp && loadExternalIsValidProp(isValidProp);
8709
8887
  /**
8710
8888
  * Inherit props from any parent MotionConfig components
@@ -8766,14 +8944,14 @@
8766
8944
  * If this is a synchronous load, load features immediately
8767
8945
  */
8768
8946
  if (!isLazyBundle(features)) {
8769
- var renderer = features.renderer, loadedFeatures = __rest$1(features, ["renderer"]);
8947
+ var renderer = features.renderer, loadedFeatures = __rest(features, ["renderer"]);
8770
8948
  loadedRenderer.current = renderer;
8771
8949
  loadFeatures(loadedFeatures);
8772
8950
  }
8773
8951
  React.useEffect(function () {
8774
8952
  if (isLazyBundle(features)) {
8775
8953
  features().then(function (_a) {
8776
- var renderer = _a.renderer, loadedFeatures = __rest$1(_a, ["renderer"]);
8954
+ var renderer = _a.renderer, loadedFeatures = __rest(_a, ["renderer"]);
8777
8955
  loadFeatures(loadedFeatures);
8778
8956
  loadedRenderer.current = renderer;
8779
8957
  setIsLoaded(true);
@@ -8809,7 +8987,7 @@
8809
8987
  }
8810
8988
 
8811
8989
  function ReorderGroup(_a, externalRef) {
8812
- var children = _a.children, _b = _a.as, as = _b === void 0 ? "ul" : _b, _c = _a.axis, axis = _c === void 0 ? "y" : _c, onReorder = _a.onReorder, values = _a.values, props = __rest$1(_a, ["children", "as", "axis", "onReorder", "values"]);
8990
+ var children = _a.children, _b = _a.as, as = _b === void 0 ? "ul" : _b, _c = _a.axis, axis = _c === void 0 ? "y" : _c, onReorder = _a.onReorder, values = _a.values, props = __rest(_a, ["children", "as", "axis", "onReorder", "values"]);
8813
8991
  var Component = useConstant(function () { return motion(as); });
8814
8992
  var order = [];
8815
8993
  var isReordering = React.useRef(false);
@@ -8969,7 +9147,7 @@
8969
9147
  return isMotionValue(value) ? value : useMotionValue(defaultValue);
8970
9148
  }
8971
9149
  function ReorderItem(_a, externalRef) {
8972
- var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, _c = _a.layout, layout = _c === void 0 ? true : _c, props = __rest$1(_a, ["children", "style", "value", "as", "onDrag", "layout"]);
9150
+ var children = _a.children, style = _a.style, value = _a.value, _b = _a.as, as = _b === void 0 ? "li" : _b, onDrag = _a.onDrag, _c = _a.layout, layout = _c === void 0 ? true : _c, props = __rest(_a, ["children", "style", "value", "as", "onDrag", "layout"]);
8973
9151
  var Component = useConstant(function () { return motion(as); });
8974
9152
  var context = React.useContext(ReorderContext);
8975
9153
  var point = {
@@ -9123,7 +9301,7 @@
9123
9301
  const clamp = (min, max, v) => Math.min(Math.max(v, min), max);
9124
9302
 
9125
9303
  const isNumber = (value) => typeof value === "number";
9126
- const isString = (value) => typeof value === "string";
9304
+
9127
9305
  const isEasingList = (easing) => Array.isArray(easing) && !isNumber(easing[0]);
9128
9306
 
9129
9307
  const wrap = (min, max, v) => {
@@ -9179,6 +9357,10 @@
9179
9357
  };
9180
9358
  }
9181
9359
 
9360
+ const isFunction = (value) => typeof value === "function";
9361
+
9362
+ const isString = (value) => typeof value === "string";
9363
+
9182
9364
  /*
9183
9365
  Convert velocity into velocity per second
9184
9366
 
@@ -9209,33 +9391,6 @@
9209
9391
  return Array.from(elements || []);
9210
9392
  }
9211
9393
 
9212
- /******************************************************************************
9213
- Copyright (c) Microsoft Corporation.
9214
-
9215
- Permission to use, copy, modify, and/or distribute this software for any
9216
- purpose with or without fee is hereby granted.
9217
-
9218
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9219
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9220
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
9221
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
9222
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
9223
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
9224
- PERFORMANCE OF THIS SOFTWARE.
9225
- ***************************************************************************** */
9226
-
9227
- function __rest(s, e) {
9228
- var t = {};
9229
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
9230
- t[p] = s[p];
9231
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
9232
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9233
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9234
- t[p[i]] = s[p[i]];
9235
- }
9236
- return t;
9237
- }
9238
-
9239
9394
  const thresholds = {
9240
9395
  any: 0,
9241
9396
  all: 1,
@@ -9263,7 +9418,7 @@
9263
9418
  return;
9264
9419
  if (entry.isIntersecting) {
9265
9420
  const newOnEnd = onStart(entry);
9266
- if (typeof newOnEnd === "function") {
9421
+ if (isFunction(newOnEnd)) {
9267
9422
  activeIntersections.set(entry.target, newOnEnd);
9268
9423
  }
9269
9424
  else {
@@ -9376,7 +9531,7 @@
9376
9531
  }
9377
9532
 
9378
9533
  function resize(a, b) {
9379
- return typeof a === "function" ? resizeWindow(a) : resizeElement(a, b);
9534
+ return isFunction(a) ? resizeWindow(a) : resizeElement(a, b);
9380
9535
  }
9381
9536
 
9382
9537
  /**
@@ -9626,7 +9781,7 @@
9626
9781
  resolveOffsets(element, info, options);
9627
9782
  }
9628
9783
  },
9629
- notify: typeof onScroll === "function"
9784
+ notify: isFunction(onScroll)
9630
9785
  ? () => onScroll(info)
9631
9786
  : scrubAnimation(onScroll, info[axis]),
9632
9787
  };
@@ -9732,7 +9887,7 @@
9732
9887
  }); };
9733
9888
  function useScroll(_a) {
9734
9889
  if (_a === void 0) { _a = {}; }
9735
- var container = _a.container, target = _a.target, options = __rest$1(_a, ["container", "target"]);
9890
+ var container = _a.container, target = _a.target, options = __rest(_a, ["container", "target"]);
9736
9891
  var values = useConstant(createScrollMotionValues);
9737
9892
  useIsomorphicLayoutEffect(function () {
9738
9893
  return scroll(function (_a) {
@@ -9746,28 +9901,33 @@
9746
9901
  return values;
9747
9902
  }
9748
9903
 
9904
+ /**
9905
+ * @deprecated useElementScroll is deprecated. Convert to useScroll({ container: ref })
9906
+ */
9749
9907
  function useElementScroll(ref) {
9750
9908
  warnOnce(false, "useElementScroll is deprecated. Convert to useScroll({ container: ref }).");
9751
9909
  return useScroll({ container: ref });
9752
9910
  }
9753
9911
 
9912
+ /**
9913
+ * @deprecated useViewportScroll is deprecated. Convert to useScroll()
9914
+ */
9754
9915
  function useViewportScroll() {
9755
9916
  warnOnce(false, "useViewportScroll is deprecated. Convert to useScroll().");
9756
9917
  return useScroll();
9757
9918
  }
9758
9919
 
9759
- var getCurrentTime = typeof performance !== "undefined"
9760
- ? function () { return performance.now(); }
9761
- : function () { return Date.now(); };
9762
9920
  function useAnimationFrame(callback) {
9763
- var initialTimestamp = useConstant(getCurrentTime);
9921
+ var initialTimestamp = React.useRef(0);
9764
9922
  var isStatic = React.useContext(MotionConfigContext).isStatic;
9765
9923
  React.useEffect(function () {
9766
9924
  if (isStatic)
9767
9925
  return;
9768
9926
  var provideTimeSinceStart = function (_a) {
9769
9927
  var timestamp = _a.timestamp;
9770
- callback(timestamp - initialTimestamp);
9928
+ if (!initialTimestamp.current)
9929
+ initialTimestamp.current = timestamp;
9930
+ callback(timestamp - initialTimestamp.current);
9771
9931
  };
9772
9932
  sync.update(provideTimeSinceStart, true);
9773
9933
  return function () { return cancelSync.update(provideTimeSinceStart); };
@@ -10094,7 +10254,7 @@
10094
10254
  return options.initialState[key] || 0;
10095
10255
  },
10096
10256
  makeTargetAnimatable: function (element, _a) {
10097
- var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest$1(_a, ["transition", "transitionEnd"]);
10257
+ var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, ["transition", "transitionEnd"]);
10098
10258
  var origin = getOrigin(target, transition || {}, element);
10099
10259
  checkTargetForNewValues(element, target, origin);
10100
10260
  return __assign({ transition: transition, transitionEnd: transitionEnd }, target);