framer-motion 6.5.0 → 7.0.1

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 (32) hide show
  1. package/README.md +14 -11
  2. package/dist/cjs/index.js +21 -27
  3. package/dist/es/components/AnimatePresence/PresenceChild.mjs +1 -2
  4. package/dist/es/components/AnimatePresence/use-presence.mjs +1 -2
  5. package/dist/es/context/MotionContext/create.mjs +1 -1
  6. package/dist/es/gestures/PanSession.mjs +1 -1
  7. package/dist/es/gestures/drag/VisualElementDragControls.mjs +2 -1
  8. package/dist/es/gestures/drag/utils/constraints.mjs +1 -1
  9. package/dist/es/projection/animation/mix-values.mjs +2 -2
  10. package/dist/es/projection/node/create-projection-node.mjs +1 -1
  11. package/dist/es/render/dom/utils/unit-conversion.mjs +1 -1
  12. package/dist/es/render/html/visual-element.mjs +1 -1
  13. package/dist/es/render/utils/motion-values.mjs +1 -1
  14. package/dist/es/utils/use-animation-frame.mjs +5 -7
  15. package/dist/es/value/index.mjs +1 -1
  16. package/dist/es/value/scroll/use-element-scroll.mjs +3 -0
  17. package/dist/es/value/scroll/use-viewport-scroll.mjs +3 -0
  18. package/dist/es/value/use-on-change.mjs +3 -3
  19. package/dist/framer-motion.dev.js +330 -182
  20. package/dist/framer-motion.js +1 -1
  21. package/dist/index.d.ts +23 -7
  22. package/dist/projection.dev.js +295 -118
  23. package/dist/size-rollup-dom-animation.js +1 -1
  24. package/dist/size-rollup-dom-max.js +1 -1
  25. package/dist/size-webpack-dom-animation.js +1 -1
  26. package/dist/size-webpack-dom-max.js +1 -2
  27. package/dist/size-webpack-m.js +1 -2
  28. package/dist/three-entry.d.ts +2 -2
  29. package/package.json +13 -18
  30. package/dist/es/utils/use-id.mjs +0 -15
  31. package/dist/size-webpack-dom-max.js.LICENSE.txt +0 -14
  32. package/dist/size-webpack-m.js.LICENSE.txt +0 -14
@@ -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.
@@ -3162,18 +3339,6 @@
3162
3339
  hover: makeRenderlessComponent(useHoverGesture),
3163
3340
  };
3164
3341
 
3165
- var counter = 0;
3166
- var incrementId = function () { return counter++; };
3167
- var useId = function () { return useConstant(incrementId); };
3168
- /**
3169
- * Ideally we'd use the following code to support React 18 optionally.
3170
- * But this fairly fails in Webpack (otherwise treeshaking wouldn't work at all).
3171
- * Need to come up with a different way of figuring this out.
3172
- */
3173
- // export const useId = (React as any).useId
3174
- // ? (React as any).useId
3175
- // : () => useConstant(incrementId)
3176
-
3177
3342
  /**
3178
3343
  * When a component is the child of `AnimatePresence`, it can use `usePresence`
3179
3344
  * to access information about whether it's still present in the React tree.
@@ -3205,7 +3370,7 @@
3205
3370
  // It's safe to call the following hooks conditionally (after an early return) because the context will always
3206
3371
  // either be null or non-null for the lifespan of the component.
3207
3372
  // Replace with useId when released in React
3208
- var id = useId();
3373
+ var id = React.useId();
3209
3374
  React.useEffect(function () { return register(id); }, []);
3210
3375
  var safeToRemove = function () { return onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete(id); };
3211
3376
  return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
@@ -3311,7 +3476,7 @@
3311
3476
  if (typeof value === "number" || Array.isArray(value))
3312
3477
  return true;
3313
3478
  if (typeof value === "string" && // It's animatable if we have a string
3314
- complex.test(value) && // And it contains numbers and/or colors
3479
+ complex$1.test(value) && // And it contains numbers and/or colors
3315
3480
  !value.startsWith("url(") // Unless it starts with "url("
3316
3481
  ) {
3317
3482
  return true;
@@ -3374,9 +3539,9 @@
3374
3539
  */
3375
3540
  var defaultValueTypes = __assign(__assign({}, numberValueTypes), {
3376
3541
  // Color props
3377
- color: color, backgroundColor: color, outlineColor: color, fill: color, stroke: color,
3542
+ color: color$1, backgroundColor: color$1, outlineColor: color$1, fill: color$1, stroke: color$1,
3378
3543
  // Border props
3379
- borderColor: color, borderTopColor: color, borderRightColor: color, borderBottomColor: color, borderLeftColor: color, filter: filter, WebkitFilter: filter });
3544
+ borderColor: color$1, borderTopColor: color$1, borderRightColor: color$1, borderBottomColor: color$1, borderLeftColor: color$1, filter: filter, WebkitFilter: filter });
3380
3545
  /**
3381
3546
  * Gets the default ValueType for the provided value key
3382
3547
  */
@@ -3386,7 +3551,7 @@
3386
3551
  var _a;
3387
3552
  var defaultValueType = getDefaultValueType(key);
3388
3553
  if (defaultValueType !== filter)
3389
- defaultValueType = complex;
3554
+ defaultValueType = complex$1;
3390
3555
  // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
3391
3556
  return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
3392
3557
  }
@@ -3401,7 +3566,7 @@
3401
3566
  * if any options are left.
3402
3567
  */
3403
3568
  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"]);
3569
+ _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
3570
  return !!Object.keys(transition).length;
3406
3571
  }
3407
3572
  var legacyRepeatWarning = false;
@@ -3409,7 +3574,7 @@
3409
3574
  * Convert Framer Motion's Transition type into Popmotion-compatible options.
3410
3575
  */
3411
3576
  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"]);
3577
+ 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
3578
  var options = __assign({}, transition);
3414
3579
  if (times)
3415
3580
  options["offset"] = times;
@@ -3682,7 +3847,7 @@
3682
3847
  * This will be replaced by the build step with the latest version number.
3683
3848
  * When MotionValues are provided to motion components, warn if versions are mixed.
3684
3849
  */
3685
- this.version = "6.5.0";
3850
+ this.version = "7.0.1";
3686
3851
  /**
3687
3852
  * Duration, in milliseconds, since last updating frame.
3688
3853
  *
@@ -3981,7 +4146,7 @@
3981
4146
  /**
3982
4147
  * A list of value types commonly used for dimensions
3983
4148
  */
3984
- var dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
4149
+ var dimensionValueTypes = [number$1, px, percent$1, degrees, vw, vh, auto];
3985
4150
  /**
3986
4151
  * Tests a dimensional value against the list of dimension ValueTypes
3987
4152
  */
@@ -3992,7 +4157,7 @@
3992
4157
  /**
3993
4158
  * A list of all ValueTypes
3994
4159
  */
3995
- var valueTypes = __spreadArray(__spreadArray([], __read(dimensionValueTypes), false), [color, complex], false);
4160
+ var valueTypes = __spreadArray(__spreadArray([], __read(dimensionValueTypes), false), [color$1, complex$1], false);
3996
4161
  /**
3997
4162
  * Tests a value against the list of ValueTypes
3998
4163
  */
@@ -4012,7 +4177,7 @@
4012
4177
  }
4013
4178
  function setTarget(visualElement, definition) {
4014
4179
  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"]);
4180
+ var _a = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = __rest(_a, ["transitionEnd", "transition"]);
4016
4181
  target = __assign(__assign({}, target), transitionEnd);
4017
4182
  for (var key in target) {
4018
4183
  var value = resolveFinalValueInKeyframes(target[key]);
@@ -4078,7 +4243,7 @@
4078
4243
  // If this is a number read as a string, ie "0" or "200", convert it to a number
4079
4244
  value = parseFloat(value);
4080
4245
  }
4081
- else if (!findValueType(value) && complex.test(targetValue)) {
4246
+ else if (!findValueType(value) && complex$1.test(targetValue)) {
4082
4247
  value = getAnimatableNone(key, targetValue);
4083
4248
  }
4084
4249
  visualElement.addValue(key, motionValue(value));
@@ -4172,7 +4337,7 @@
4172
4337
  function animateTarget(visualElement, definition, _a) {
4173
4338
  var _b;
4174
4339
  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"]);
4340
+ var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = __rest(_e, ["transition", "transitionEnd"]);
4176
4341
  if (transitionOverride)
4177
4342
  transition = transitionOverride;
4178
4343
  var animations = [];
@@ -4272,7 +4437,7 @@
4272
4437
  var buildResolvedTypeValues = function (acc, definition) {
4273
4438
  var resolved = resolveVariant(visualElement, definition);
4274
4439
  if (resolved) {
4275
- resolved.transition; var transitionEnd = resolved.transitionEnd, target = __rest$1(resolved, ["transition", "transitionEnd"]);
4440
+ resolved.transition; var transitionEnd = resolved.transitionEnd, target = __rest(resolved, ["transition", "transitionEnd"]);
4276
4441
  acc = __assign(__assign(__assign({}, acc), target), transitionEnd);
4277
4442
  }
4278
4443
  return acc;
@@ -4608,8 +4773,8 @@
4608
4773
  */
4609
4774
  var PanSession = /** @class */ (function () {
4610
4775
  function PanSession(event, handlers, _a) {
4611
- var _this = this;
4612
4776
  var _b = _a === void 0 ? {} : _a, transformPagePoint = _b.transformPagePoint;
4777
+ var _this = this;
4613
4778
  /**
4614
4779
  * @internal
4615
4780
  */
@@ -4867,7 +5032,7 @@
4867
5032
  else if (sourceLength > targetLength) {
4868
5033
  origin = progress$1(source.min, source.max - targetLength, target.min);
4869
5034
  }
4870
- return clamp$1(0, 1, origin);
5035
+ return clamp$2(0, 1, origin);
4871
5036
  }
4872
5037
  /**
4873
5038
  * Rebase the calculated viewport constraints relative to the layout.min point.
@@ -5172,7 +5337,7 @@
5172
5337
  /**
5173
5338
  * If the MotionValue is a percentage value convert to px
5174
5339
  */
5175
- if (percent.test(current)) {
5340
+ if (percent$1.test(current)) {
5176
5341
  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
5342
  if (measuredAxis) {
5178
5343
  var length_1 = calcLength(measuredAxis);
@@ -5480,7 +5645,7 @@
5480
5645
  * If the element's layout changes, calculate the delta and apply that to
5481
5646
  * the drag gesture's origin point.
5482
5647
  */
5483
- projection.addEventListener("didUpdate", (function (_a) {
5648
+ var stopLayoutUpdateListener = projection.addEventListener("didUpdate", (function (_a) {
5484
5649
  var delta = _a.delta, hasLayoutChanged = _a.hasLayoutChanged;
5485
5650
  if (_this.isDragging && hasLayoutChanged) {
5486
5651
  eachAxis(function (axis) {
@@ -5497,6 +5662,7 @@
5497
5662
  stopResizeListener();
5498
5663
  stopPointerListener();
5499
5664
  stopMeasureLayoutListener();
5665
+ stopLayoutUpdateListener === null || stopLayoutUpdateListener === void 0 ? void 0 : stopLayoutUpdateListener();
5500
5666
  };
5501
5667
  };
5502
5668
  VisualElementDragControls.prototype.getProps = function () {
@@ -5651,7 +5817,7 @@
5651
5817
  * and warn against mismatches.
5652
5818
  */
5653
5819
  {
5654
- warnOnce(nextValue.version === "6.5.0", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.5.0 may not work as expected."));
5820
+ warnOnce(nextValue.version === "7.0.1", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.0.1 may not work as expected."));
5655
5821
  }
5656
5822
  }
5657
5823
  else if (isMotionValue(prevValue)) {
@@ -6124,7 +6290,7 @@
6124
6290
  */
6125
6291
  function resolveCSSVariables(visualElement, _a, transitionEnd) {
6126
6292
  var _b;
6127
- var target = __rest$1(_a, []);
6293
+ var target = __rest(_a, []);
6128
6294
  var element = visualElement.getInstance();
6129
6295
  if (!(element instanceof Element))
6130
6296
  return { target: target, transitionEnd: transitionEnd };
@@ -6183,7 +6349,7 @@
6183
6349
  value.set(to);
6184
6350
  };
6185
6351
  var isNumOrPxType = function (v) {
6186
- return v === number || v === px;
6352
+ return v === number$1 || v === px;
6187
6353
  };
6188
6354
  var BoundingBoxDimension;
6189
6355
  (function (BoundingBoxDimension) {
@@ -6490,9 +6656,9 @@
6490
6656
  * can be animated by Motion.
6491
6657
  */
6492
6658
  makeTargetAnimatable: function (element, _a, _b, isMounted) {
6659
+ var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, ["transition", "transitionEnd"]);
6493
6660
  var transformValues = _b.transformValues;
6494
6661
  if (isMounted === void 0) { isMounted = true; }
6495
- var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest$1(_a, ["transition", "transitionEnd"]);
6496
6662
  var origin = getOrigin(target, transition || {}, element);
6497
6663
  /**
6498
6664
  * If Framer has provided a function to convert `Color` etc value types, convert them
@@ -6599,11 +6765,11 @@
6599
6765
  return varToken;
6600
6766
  });
6601
6767
  }
6602
- var shadow = complex.parse(latest);
6768
+ var shadow = complex$1.parse(latest);
6603
6769
  // TODO: Doesn't support multiple shadows
6604
6770
  if (shadow.length > 5)
6605
6771
  return original;
6606
- var template = complex.createTransformer(latest);
6772
+ var template = complex$1.createTransformer(latest);
6607
6773
  var offset = typeof shadow[0] !== "number" ? 1 : 0;
6608
6774
  // Calculate the overall context scale
6609
6775
  var xScale = projectionDelta.x.scale * treeScale.x;
@@ -6832,7 +6998,7 @@
6832
6998
  isPx(followRadius) === isPx(leadRadius);
6833
6999
  if (canMix) {
6834
7000
  target[borderLabel] = Math.max(mix$1(asNumber(followRadius), asNumber(leadRadius), progress), 0);
6835
- if (percent.test(leadRadius) || percent.test(followRadius)) {
7001
+ if (percent$1.test(leadRadius) || percent$1.test(followRadius)) {
6836
7002
  target[borderLabel] += "%";
6837
7003
  }
6838
7004
  }
@@ -6926,7 +7092,7 @@
6926
7092
  if (origin === void 0) { origin = 0.5; }
6927
7093
  if (originAxis === void 0) { originAxis = axis; }
6928
7094
  if (sourceAxis === void 0) { sourceAxis = axis; }
6929
- if (percent.test(translate)) {
7095
+ if (percent$1.test(translate)) {
6930
7096
  translate = parseFloat(translate);
6931
7097
  var relativeProgress = mix$1(sourceAxis.min, sourceAxis.max, translate / 100);
6932
7098
  translate = relativeProgress - sourceAxis.min;
@@ -7152,9 +7318,9 @@
7152
7318
  var attachResizeListener = _a.attachResizeListener, defaultParent = _a.defaultParent, measureScroll = _a.measureScroll, checkIsScrollRoot = _a.checkIsScrollRoot, resetTransform = _a.resetTransform;
7153
7319
  return /** @class */ (function () {
7154
7320
  function ProjectionNode(id, latestValues, parent) {
7155
- var _this = this;
7156
7321
  if (latestValues === void 0) { latestValues = {}; }
7157
7322
  if (parent === void 0) { parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent(); }
7323
+ var _this = this;
7158
7324
  /**
7159
7325
  * A Set containing all this component's children. This is used to iterate
7160
7326
  * through the children.
@@ -8422,7 +8588,7 @@
8422
8588
  var PresenceChild = function (_a) {
8423
8589
  var children = _a.children, initial = _a.initial, isPresent = _a.isPresent, onExitComplete = _a.onExitComplete, custom = _a.custom, presenceAffectsLayout = _a.presenceAffectsLayout;
8424
8590
  var presenceChildren = useConstant(newChildrenMap);
8425
- var id = useId();
8591
+ var id = React.useId();
8426
8592
  var context = React.useMemo(function () { return ({
8427
8593
  id: id,
8428
8594
  initial: initial,
@@ -8704,7 +8870,7 @@
8704
8870
  * @public
8705
8871
  */
8706
8872
  function MotionConfig(_a) {
8707
- var children = _a.children, isValidProp = _a.isValidProp, config = __rest$1(_a, ["children", "isValidProp"]);
8873
+ var children = _a.children, isValidProp = _a.isValidProp, config = __rest(_a, ["children", "isValidProp"]);
8708
8874
  isValidProp && loadExternalIsValidProp(isValidProp);
8709
8875
  /**
8710
8876
  * Inherit props from any parent MotionConfig components
@@ -8766,14 +8932,14 @@
8766
8932
  * If this is a synchronous load, load features immediately
8767
8933
  */
8768
8934
  if (!isLazyBundle(features)) {
8769
- var renderer = features.renderer, loadedFeatures = __rest$1(features, ["renderer"]);
8935
+ var renderer = features.renderer, loadedFeatures = __rest(features, ["renderer"]);
8770
8936
  loadedRenderer.current = renderer;
8771
8937
  loadFeatures(loadedFeatures);
8772
8938
  }
8773
8939
  React.useEffect(function () {
8774
8940
  if (isLazyBundle(features)) {
8775
8941
  features().then(function (_a) {
8776
- var renderer = _a.renderer, loadedFeatures = __rest$1(_a, ["renderer"]);
8942
+ var renderer = _a.renderer, loadedFeatures = __rest(_a, ["renderer"]);
8777
8943
  loadFeatures(loadedFeatures);
8778
8944
  loadedRenderer.current = renderer;
8779
8945
  setIsLoaded(true);
@@ -8809,7 +8975,7 @@
8809
8975
  }
8810
8976
 
8811
8977
  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"]);
8978
+ 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
8979
  var Component = useConstant(function () { return motion(as); });
8814
8980
  var order = [];
8815
8981
  var isReordering = React.useRef(false);
@@ -8904,13 +9070,13 @@
8904
9070
  }
8905
9071
 
8906
9072
  function useOnChange(value, callback) {
8907
- React.useEffect(function () {
9073
+ useIsomorphicLayoutEffect(function () {
8908
9074
  if (isMotionValue(value))
8909
9075
  return value.onChange(callback);
8910
9076
  }, [callback]);
8911
9077
  }
8912
9078
  function useMultiOnChange(values, handler) {
8913
- React.useEffect(function () {
9079
+ useIsomorphicLayoutEffect(function () {
8914
9080
  var subscriptions = values.map(function (value) { return value.onChange(handler); });
8915
9081
  return function () { return subscriptions.forEach(function (unsubscribe) { return unsubscribe(); }); };
8916
9082
  });
@@ -8969,7 +9135,7 @@
8969
9135
  return isMotionValue(value) ? value : useMotionValue(defaultValue);
8970
9136
  }
8971
9137
  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"]);
9138
+ 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
9139
  var Component = useConstant(function () { return motion(as); });
8974
9140
  var context = React.useContext(ReorderContext);
8975
9141
  var point = {
@@ -9123,7 +9289,7 @@
9123
9289
  const clamp = (min, max, v) => Math.min(Math.max(v, min), max);
9124
9290
 
9125
9291
  const isNumber = (value) => typeof value === "number";
9126
- const isString = (value) => typeof value === "string";
9292
+
9127
9293
  const isEasingList = (easing) => Array.isArray(easing) && !isNumber(easing[0]);
9128
9294
 
9129
9295
  const wrap = (min, max, v) => {
@@ -9179,6 +9345,10 @@
9179
9345
  };
9180
9346
  }
9181
9347
 
9348
+ const isFunction = (value) => typeof value === "function";
9349
+
9350
+ const isString = (value) => typeof value === "string";
9351
+
9182
9352
  /*
9183
9353
  Convert velocity into velocity per second
9184
9354
 
@@ -9209,33 +9379,6 @@
9209
9379
  return Array.from(elements || []);
9210
9380
  }
9211
9381
 
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
9382
  const thresholds = {
9240
9383
  any: 0,
9241
9384
  all: 1,
@@ -9263,7 +9406,7 @@
9263
9406
  return;
9264
9407
  if (entry.isIntersecting) {
9265
9408
  const newOnEnd = onStart(entry);
9266
- if (typeof newOnEnd === "function") {
9409
+ if (isFunction(newOnEnd)) {
9267
9410
  activeIntersections.set(entry.target, newOnEnd);
9268
9411
  }
9269
9412
  else {
@@ -9376,7 +9519,7 @@
9376
9519
  }
9377
9520
 
9378
9521
  function resize(a, b) {
9379
- return typeof a === "function" ? resizeWindow(a) : resizeElement(a, b);
9522
+ return isFunction(a) ? resizeWindow(a) : resizeElement(a, b);
9380
9523
  }
9381
9524
 
9382
9525
  /**
@@ -9626,7 +9769,7 @@
9626
9769
  resolveOffsets(element, info, options);
9627
9770
  }
9628
9771
  },
9629
- notify: typeof onScroll === "function"
9772
+ notify: isFunction(onScroll)
9630
9773
  ? () => onScroll(info)
9631
9774
  : scrubAnimation(onScroll, info[axis]),
9632
9775
  };
@@ -9732,7 +9875,7 @@
9732
9875
  }); };
9733
9876
  function useScroll(_a) {
9734
9877
  if (_a === void 0) { _a = {}; }
9735
- var container = _a.container, target = _a.target, options = __rest$1(_a, ["container", "target"]);
9878
+ var container = _a.container, target = _a.target, options = __rest(_a, ["container", "target"]);
9736
9879
  var values = useConstant(createScrollMotionValues);
9737
9880
  useIsomorphicLayoutEffect(function () {
9738
9881
  return scroll(function (_a) {
@@ -9746,28 +9889,33 @@
9746
9889
  return values;
9747
9890
  }
9748
9891
 
9892
+ /**
9893
+ * @deprecated useElementScroll is deprecated. Convert to useScroll({ container: ref })
9894
+ */
9749
9895
  function useElementScroll(ref) {
9750
9896
  warnOnce(false, "useElementScroll is deprecated. Convert to useScroll({ container: ref }).");
9751
9897
  return useScroll({ container: ref });
9752
9898
  }
9753
9899
 
9900
+ /**
9901
+ * @deprecated useViewportScroll is deprecated. Convert to useScroll()
9902
+ */
9754
9903
  function useViewportScroll() {
9755
9904
  warnOnce(false, "useViewportScroll is deprecated. Convert to useScroll().");
9756
9905
  return useScroll();
9757
9906
  }
9758
9907
 
9759
- var getCurrentTime = typeof performance !== "undefined"
9760
- ? function () { return performance.now(); }
9761
- : function () { return Date.now(); };
9762
9908
  function useAnimationFrame(callback) {
9763
- var initialTimestamp = useConstant(getCurrentTime);
9909
+ var initialTimestamp = React.useRef(0);
9764
9910
  var isStatic = React.useContext(MotionConfigContext).isStatic;
9765
9911
  React.useEffect(function () {
9766
9912
  if (isStatic)
9767
9913
  return;
9768
9914
  var provideTimeSinceStart = function (_a) {
9769
9915
  var timestamp = _a.timestamp;
9770
- callback(timestamp - initialTimestamp);
9916
+ if (!initialTimestamp.current)
9917
+ initialTimestamp.current = timestamp;
9918
+ callback(timestamp - initialTimestamp.current);
9771
9919
  };
9772
9920
  sync.update(provideTimeSinceStart, true);
9773
9921
  return function () { return cancelSync.update(provideTimeSinceStart); };
@@ -10094,7 +10242,7 @@
10094
10242
  return options.initialState[key] || 0;
10095
10243
  },
10096
10244
  makeTargetAnimatable: function (element, _a) {
10097
- var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest$1(_a, ["transition", "transitionEnd"]);
10245
+ var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, ["transition", "transitionEnd"]);
10098
10246
  var origin = getOrigin(target, transition || {}, element);
10099
10247
  checkTargetForNewValues(element, target, origin);
10100
10248
  return __assign({ transition: transition, transitionEnd: transitionEnd }, target);