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
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Projection = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- /*! *****************************************************************************
7
+ /******************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
9
9
 
10
10
  Permission to use, copy, modify, and/or distribute this software for any
@@ -206,7 +206,7 @@
206
206
  };
207
207
  }
208
208
 
209
- const clamp$1 = (min, max, v) => Math.min(Math.max(v, min), max);
209
+ const clamp$2 = (min, max, v) => Math.min(Math.max(v, min), max);
210
210
 
211
211
  const safeMin = 0.001;
212
212
  const minDuration = 0.01;
@@ -218,8 +218,8 @@
218
218
  let derivative;
219
219
  warning(duration <= maxDuration * 1000, "Spring duration must be 10 seconds or less");
220
220
  let dampingRatio = 1 - bounce;
221
- dampingRatio = clamp$1(minDamping, maxDamping, dampingRatio);
222
- duration = clamp$1(minDuration, maxDuration, duration / 1000);
221
+ dampingRatio = clamp$2(minDamping, maxDamping, dampingRatio);
222
+ duration = clamp$2(minDuration, maxDuration, duration / 1000);
223
223
  if (dampingRatio < 1) {
224
224
  envelope = (undampedFreq) => {
225
225
  const exponentialDecay = undampedFreq * dampingRatio;
@@ -405,43 +405,39 @@
405
405
 
406
406
  const mix = (from, to, progress) => -progress * from + progress * to + from;
407
407
 
408
- const clamp = (min, max) => (v) => Math.max(Math.min(v, max), min);
409
- const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v);
410
- const floatRegex = /(-)?([\d]*\.?[\d])+/g;
411
- 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;
412
- const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;
413
- function isString(v) {
408
+ const clamp$1 = (min, max) => (v) => Math.max(Math.min(v, max), min);
409
+ const sanitize$1 = (v) => (v % 1 ? Number(v.toFixed(5)) : v);
410
+ const floatRegex$1 = /(-)?([\d]*\.?[\d])+/g;
411
+ 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;
412
+ const singleColorRegex$1 = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;
413
+ function isString$1(v) {
414
414
  return typeof v === 'string';
415
415
  }
416
416
 
417
- const number = {
417
+ const number$1 = {
418
418
  test: (v) => typeof v === 'number',
419
419
  parse: parseFloat,
420
420
  transform: (v) => v,
421
421
  };
422
- const alpha = Object.assign(Object.assign({}, number), { transform: clamp(0, 1) });
423
- const scale = Object.assign(Object.assign({}, number), { default: 1 });
422
+ const alpha$1 = Object.assign(Object.assign({}, number$1), { transform: clamp$1(0, 1) });
423
+ Object.assign(Object.assign({}, number$1), { default: 1 });
424
424
 
425
- const createUnitType = (unit) => ({
426
- test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1,
425
+ const createUnitType$1 = (unit) => ({
426
+ test: (v) => isString$1(v) && v.endsWith(unit) && v.split(' ').length === 1,
427
427
  parse: parseFloat,
428
428
  transform: (v) => `${v}${unit}`,
429
429
  });
430
- const degrees = createUnitType('deg');
431
- const percent = createUnitType('%');
432
- const px = createUnitType('px');
433
- const vh = createUnitType('vh');
434
- const vw = createUnitType('vw');
435
- const progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) });
430
+ const percent$1 = createUnitType$1('%');
431
+ Object.assign(Object.assign({}, percent$1), { parse: (v) => percent$1.parse(v) / 100, transform: (v) => percent$1.transform(v * 100) });
436
432
 
437
- const isColorString = (type, testProp) => (v) => {
438
- return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) ||
433
+ const isColorString$1 = (type, testProp) => (v) => {
434
+ return Boolean((isString$1(v) && singleColorRegex$1.test(v) && v.startsWith(type)) ||
439
435
  (testProp && Object.prototype.hasOwnProperty.call(v, testProp)));
440
436
  };
441
- const splitColor = (aName, bName, cName) => (v) => {
442
- if (!isString(v))
437
+ const splitColor$1 = (aName, bName, cName) => (v) => {
438
+ if (!isString$1(v))
443
439
  return v;
444
- const [a, b, c, alpha] = v.match(floatRegex);
440
+ const [a, b, c, alpha] = v.match(floatRegex$1);
445
441
  return {
446
442
  [aName]: parseFloat(a),
447
443
  [bName]: parseFloat(b),
@@ -450,39 +446,39 @@
450
446
  };
451
447
  };
452
448
 
453
- const hsla = {
454
- test: isColorString('hsl', 'hue'),
455
- parse: splitColor('hue', 'saturation', 'lightness'),
456
- transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
449
+ const hsla$1 = {
450
+ test: isColorString$1('hsl', 'hue'),
451
+ parse: splitColor$1('hue', 'saturation', 'lightness'),
452
+ transform: ({ hue, saturation, lightness, alpha: alpha$1$1 = 1 }) => {
457
453
  return ('hsla(' +
458
454
  Math.round(hue) +
459
455
  ', ' +
460
- percent.transform(sanitize(saturation)) +
456
+ percent$1.transform(sanitize$1(saturation)) +
461
457
  ', ' +
462
- percent.transform(sanitize(lightness)) +
458
+ percent$1.transform(sanitize$1(lightness)) +
463
459
  ', ' +
464
- sanitize(alpha.transform(alpha$1)) +
460
+ sanitize$1(alpha$1.transform(alpha$1$1)) +
465
461
  ')');
466
462
  },
467
463
  };
468
464
 
469
- const clampRgbUnit = clamp(0, 255);
470
- const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) });
471
- const rgba = {
472
- test: isColorString('rgb', 'red'),
473
- parse: splitColor('red', 'green', 'blue'),
474
- transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => 'rgba(' +
475
- rgbUnit.transform(red) +
465
+ const clampRgbUnit$1 = clamp$1(0, 255);
466
+ const rgbUnit$1 = Object.assign(Object.assign({}, number$1), { transform: (v) => Math.round(clampRgbUnit$1(v)) });
467
+ const rgba$1 = {
468
+ test: isColorString$1('rgb', 'red'),
469
+ parse: splitColor$1('red', 'green', 'blue'),
470
+ transform: ({ red, green, blue, alpha: alpha$1$1 = 1 }) => 'rgba(' +
471
+ rgbUnit$1.transform(red) +
476
472
  ', ' +
477
- rgbUnit.transform(green) +
473
+ rgbUnit$1.transform(green) +
478
474
  ', ' +
479
- rgbUnit.transform(blue) +
475
+ rgbUnit$1.transform(blue) +
480
476
  ', ' +
481
- sanitize(alpha.transform(alpha$1)) +
477
+ sanitize$1(alpha$1.transform(alpha$1$1)) +
482
478
  ')',
483
479
  };
484
480
 
485
- function parseHex(v) {
481
+ function parseHex$1(v) {
486
482
  let r = '';
487
483
  let g = '';
488
484
  let b = '';
@@ -510,101 +506,81 @@
510
506
  alpha: a ? parseInt(a, 16) / 255 : 1,
511
507
  };
512
508
  }
513
- const hex = {
514
- test: isColorString('#'),
515
- parse: parseHex,
516
- transform: rgba.transform,
509
+ const hex$1 = {
510
+ test: isColorString$1('#'),
511
+ parse: parseHex$1,
512
+ transform: rgba$1.transform,
517
513
  };
518
514
 
519
- const color = {
520
- test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
515
+ const color$1 = {
516
+ test: (v) => rgba$1.test(v) || hex$1.test(v) || hsla$1.test(v),
521
517
  parse: (v) => {
522
- if (rgba.test(v)) {
523
- return rgba.parse(v);
518
+ if (rgba$1.test(v)) {
519
+ return rgba$1.parse(v);
524
520
  }
525
- else if (hsla.test(v)) {
526
- return hsla.parse(v);
521
+ else if (hsla$1.test(v)) {
522
+ return hsla$1.parse(v);
527
523
  }
528
524
  else {
529
- return hex.parse(v);
525
+ return hex$1.parse(v);
530
526
  }
531
527
  },
532
528
  transform: (v) => {
533
- return isString(v)
529
+ return isString$1(v)
534
530
  ? v
535
531
  : v.hasOwnProperty('red')
536
- ? rgba.transform(v)
537
- : hsla.transform(v);
532
+ ? rgba$1.transform(v)
533
+ : hsla$1.transform(v);
538
534
  },
539
535
  };
540
536
 
541
- const colorToken = '${c}';
542
- const numberToken = '${n}';
543
- function test(v) {
537
+ const colorToken$1 = '${c}';
538
+ const numberToken$1 = '${n}';
539
+ function test$1(v) {
544
540
  var _a, _b, _c, _d;
545
541
  return (isNaN(v) &&
546
- isString(v) &&
547
- ((_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);
542
+ isString$1(v) &&
543
+ ((_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);
548
544
  }
549
- function analyse$1(v) {
545
+ function analyse$2(v) {
550
546
  if (typeof v === 'number')
551
547
  v = `${v}`;
552
548
  const values = [];
553
549
  let numColors = 0;
554
- const colors = v.match(colorRegex);
550
+ const colors = v.match(colorRegex$1);
555
551
  if (colors) {
556
552
  numColors = colors.length;
557
- v = v.replace(colorRegex, colorToken);
558
- values.push(...colors.map(color.parse));
553
+ v = v.replace(colorRegex$1, colorToken$1);
554
+ values.push(...colors.map(color$1.parse));
559
555
  }
560
- const numbers = v.match(floatRegex);
556
+ const numbers = v.match(floatRegex$1);
561
557
  if (numbers) {
562
- v = v.replace(floatRegex, numberToken);
563
- values.push(...numbers.map(number.parse));
558
+ v = v.replace(floatRegex$1, numberToken$1);
559
+ values.push(...numbers.map(number$1.parse));
564
560
  }
565
561
  return { values, numColors, tokenised: v };
566
562
  }
567
- function parse(v) {
568
- return analyse$1(v).values;
563
+ function parse$1(v) {
564
+ return analyse$2(v).values;
569
565
  }
570
- function createTransformer(v) {
571
- const { values, numColors, tokenised } = analyse$1(v);
566
+ function createTransformer$1(v) {
567
+ const { values, numColors, tokenised } = analyse$2(v);
572
568
  const numValues = values.length;
573
569
  return (v) => {
574
570
  let output = tokenised;
575
571
  for (let i = 0; i < numValues; i++) {
576
- output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i]));
572
+ output = output.replace(i < numColors ? colorToken$1 : numberToken$1, i < numColors ? color$1.transform(v[i]) : sanitize$1(v[i]));
577
573
  }
578
574
  return output;
579
575
  };
580
576
  }
581
- const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v;
582
- function getAnimatableNone$1(v) {
583
- const parsed = parse(v);
584
- const transformer = createTransformer(v);
585
- return transformer(parsed.map(convertNumbersToZero));
586
- }
587
- const complex = { test, parse, createTransformer, getAnimatableNone: getAnimatableNone$1 };
588
-
589
- const maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']);
590
- function applyDefaultFilter(v) {
591
- let [name, value] = v.slice(0, -1).split('(');
592
- if (name === 'drop-shadow')
593
- return v;
594
- const [number] = value.match(floatRegex) || [];
595
- if (!number)
596
- return v;
597
- const unit = value.replace(number, '');
598
- let defaultValue = maxDefaults.has(name) ? 1 : 0;
599
- if (number !== value)
600
- defaultValue *= 100;
601
- return name + '(' + defaultValue + unit + ')';
577
+ const convertNumbersToZero$1 = (v) => typeof v === 'number' ? 0 : v;
578
+ function getAnimatableNone$2(v) {
579
+ const parsed = parse$1(v);
580
+ const transformer = createTransformer$1(v);
581
+ return transformer(parsed.map(convertNumbersToZero$1));
602
582
  }
603
- const functionRegex = /([a-z-]*)\(.*?\)/g;
604
- const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v) => {
605
- const functions = v.match(functionRegex);
606
- return functions ? functions.map(applyDefaultFilter).join(' ') : v;
607
- } });
583
+ const complex$1 = { test: test$1, parse: parse$1, createTransformer: createTransformer$1, getAnimatableNone: getAnimatableNone$2 };
608
584
 
609
585
  function hueToRgb(p, q, t) {
610
586
  if (t < 0)
@@ -651,7 +627,7 @@
651
627
  const toExpo = to * to;
652
628
  return Math.sqrt(Math.max(0, v * (toExpo - fromExpo) + fromExpo));
653
629
  };
654
- const colorTypes = [hex, rgba, hsla];
630
+ const colorTypes = [hex$1, rgba$1, hsla$1];
655
631
  const getColorType = (v) => colorTypes.find((type) => type.test(v));
656
632
  const notAnimatable = (color) => `'${color}' is not an animatable color. Use the equivalent color code instead.`;
657
633
  const mixColor = (from, to) => {
@@ -661,13 +637,13 @@
661
637
  invariant(!!toColorType, notAnimatable(to));
662
638
  let fromColor = fromColorType.parse(from);
663
639
  let toColor = toColorType.parse(to);
664
- if (fromColorType === hsla) {
640
+ if (fromColorType === hsla$1) {
665
641
  fromColor = hslaToRgba(fromColor);
666
- fromColorType = rgba;
642
+ fromColorType = rgba$1;
667
643
  }
668
- if (toColorType === hsla) {
644
+ if (toColorType === hsla$1) {
669
645
  toColor = hslaToRgba(toColor);
670
- toColorType = rgba;
646
+ toColorType = rgba$1;
671
647
  }
672
648
  const blended = Object.assign({}, fromColor);
673
649
  return (v) => {
@@ -690,7 +666,7 @@
690
666
  if (isNum(origin)) {
691
667
  return (v) => mix(origin, target, v);
692
668
  }
693
- else if (color.test(origin)) {
669
+ else if (color$1.test(origin)) {
694
670
  return mixColor(origin, target);
695
671
  }
696
672
  else {
@@ -723,8 +699,8 @@
723
699
  return output;
724
700
  };
725
701
  };
726
- function analyse(value) {
727
- const parsed = complex.parse(value);
702
+ function analyse$1(value) {
703
+ const parsed = complex$1.parse(value);
728
704
  const numValues = parsed.length;
729
705
  let numNumbers = 0;
730
706
  let numRGB = 0;
@@ -745,9 +721,9 @@
745
721
  return { parsed, numNumbers, numRGB, numHSL };
746
722
  }
747
723
  const mixComplex = (origin, target) => {
748
- const template = complex.createTransformer(target);
749
- const originStats = analyse(origin);
750
- const targetStats = analyse(target);
724
+ const template = complex$1.createTransformer(target);
725
+ const originStats = analyse$1(origin);
726
+ const targetStats = analyse$1(target);
751
727
  const canInterpolate = originStats.numHSL === targetStats.numHSL &&
752
728
  originStats.numRGB === targetStats.numRGB &&
753
729
  originStats.numNumbers >= targetStats.numNumbers;
@@ -766,7 +742,7 @@
766
742
  return mixNumber;
767
743
  }
768
744
  else if (typeof v === 'string') {
769
- if (color.test(v)) {
745
+ if (color$1.test(v)) {
770
746
  return mixColor;
771
747
  }
772
748
  else {
@@ -838,7 +814,7 @@
838
814
  ? fastInterpolate(input, mixers)
839
815
  : slowInterpolate(input, mixers);
840
816
  return isClamp
841
- ? (v) => interpolator(clamp$1(input[0], input[inputLength - 1], v))
817
+ ? (v) => interpolator(clamp$2(input[0], input[inputLength - 1], v))
842
818
  : interpolator;
843
819
  }
844
820
 
@@ -1281,7 +1257,7 @@
1281
1257
  * This will be replaced by the build step with the latest version number.
1282
1258
  * When MotionValues are provided to motion components, warn if versions are mixed.
1283
1259
  */
1284
- this.version = "6.5.0";
1260
+ this.version = "7.0.1";
1285
1261
  /**
1286
1262
  * Duration, in milliseconds, since last updating frame.
1287
1263
  *
@@ -1610,6 +1586,207 @@
1610
1586
  return Array.isArray(ease) && typeof ease[0] !== "number";
1611
1587
  };
1612
1588
 
1589
+ const clamp = (min, max) => (v) => Math.max(Math.min(v, max), min);
1590
+ const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v);
1591
+ const floatRegex = /(-)?([\d]*\.?[\d])+/g;
1592
+ 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;
1593
+ const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;
1594
+ function isString(v) {
1595
+ return typeof v === 'string';
1596
+ }
1597
+
1598
+ const number = {
1599
+ test: (v) => typeof v === 'number',
1600
+ parse: parseFloat,
1601
+ transform: (v) => v,
1602
+ };
1603
+ const alpha = Object.assign(Object.assign({}, number), { transform: clamp(0, 1) });
1604
+ const scale = Object.assign(Object.assign({}, number), { default: 1 });
1605
+
1606
+ const createUnitType = (unit) => ({
1607
+ test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1,
1608
+ parse: parseFloat,
1609
+ transform: (v) => `${v}${unit}`,
1610
+ });
1611
+ const degrees = createUnitType('deg');
1612
+ const percent = createUnitType('%');
1613
+ const px = createUnitType('px');
1614
+ const vh = createUnitType('vh');
1615
+ const vw = createUnitType('vw');
1616
+ const progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) });
1617
+
1618
+ const isColorString = (type, testProp) => (v) => {
1619
+ return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) ||
1620
+ (testProp && Object.prototype.hasOwnProperty.call(v, testProp)));
1621
+ };
1622
+ const splitColor = (aName, bName, cName) => (v) => {
1623
+ if (!isString(v))
1624
+ return v;
1625
+ const [a, b, c, alpha] = v.match(floatRegex);
1626
+ return {
1627
+ [aName]: parseFloat(a),
1628
+ [bName]: parseFloat(b),
1629
+ [cName]: parseFloat(c),
1630
+ alpha: alpha !== undefined ? parseFloat(alpha) : 1,
1631
+ };
1632
+ };
1633
+
1634
+ const hsla = {
1635
+ test: isColorString('hsl', 'hue'),
1636
+ parse: splitColor('hue', 'saturation', 'lightness'),
1637
+ transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
1638
+ return ('hsla(' +
1639
+ Math.round(hue) +
1640
+ ', ' +
1641
+ percent.transform(sanitize(saturation)) +
1642
+ ', ' +
1643
+ percent.transform(sanitize(lightness)) +
1644
+ ', ' +
1645
+ sanitize(alpha.transform(alpha$1)) +
1646
+ ')');
1647
+ },
1648
+ };
1649
+
1650
+ const clampRgbUnit = clamp(0, 255);
1651
+ const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) });
1652
+ const rgba = {
1653
+ test: isColorString('rgb', 'red'),
1654
+ parse: splitColor('red', 'green', 'blue'),
1655
+ transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => 'rgba(' +
1656
+ rgbUnit.transform(red) +
1657
+ ', ' +
1658
+ rgbUnit.transform(green) +
1659
+ ', ' +
1660
+ rgbUnit.transform(blue) +
1661
+ ', ' +
1662
+ sanitize(alpha.transform(alpha$1)) +
1663
+ ')',
1664
+ };
1665
+
1666
+ function parseHex(v) {
1667
+ let r = '';
1668
+ let g = '';
1669
+ let b = '';
1670
+ let a = '';
1671
+ if (v.length > 5) {
1672
+ r = v.substr(1, 2);
1673
+ g = v.substr(3, 2);
1674
+ b = v.substr(5, 2);
1675
+ a = v.substr(7, 2);
1676
+ }
1677
+ else {
1678
+ r = v.substr(1, 1);
1679
+ g = v.substr(2, 1);
1680
+ b = v.substr(3, 1);
1681
+ a = v.substr(4, 1);
1682
+ r += r;
1683
+ g += g;
1684
+ b += b;
1685
+ a += a;
1686
+ }
1687
+ return {
1688
+ red: parseInt(r, 16),
1689
+ green: parseInt(g, 16),
1690
+ blue: parseInt(b, 16),
1691
+ alpha: a ? parseInt(a, 16) / 255 : 1,
1692
+ };
1693
+ }
1694
+ const hex = {
1695
+ test: isColorString('#'),
1696
+ parse: parseHex,
1697
+ transform: rgba.transform,
1698
+ };
1699
+
1700
+ const color = {
1701
+ test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
1702
+ parse: (v) => {
1703
+ if (rgba.test(v)) {
1704
+ return rgba.parse(v);
1705
+ }
1706
+ else if (hsla.test(v)) {
1707
+ return hsla.parse(v);
1708
+ }
1709
+ else {
1710
+ return hex.parse(v);
1711
+ }
1712
+ },
1713
+ transform: (v) => {
1714
+ return isString(v)
1715
+ ? v
1716
+ : v.hasOwnProperty('red')
1717
+ ? rgba.transform(v)
1718
+ : hsla.transform(v);
1719
+ },
1720
+ };
1721
+
1722
+ const colorToken = '${c}';
1723
+ const numberToken = '${n}';
1724
+ function test(v) {
1725
+ var _a, _b, _c, _d;
1726
+ return (isNaN(v) &&
1727
+ isString(v) &&
1728
+ ((_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);
1729
+ }
1730
+ function analyse(v) {
1731
+ if (typeof v === 'number')
1732
+ v = `${v}`;
1733
+ const values = [];
1734
+ let numColors = 0;
1735
+ const colors = v.match(colorRegex);
1736
+ if (colors) {
1737
+ numColors = colors.length;
1738
+ v = v.replace(colorRegex, colorToken);
1739
+ values.push(...colors.map(color.parse));
1740
+ }
1741
+ const numbers = v.match(floatRegex);
1742
+ if (numbers) {
1743
+ v = v.replace(floatRegex, numberToken);
1744
+ values.push(...numbers.map(number.parse));
1745
+ }
1746
+ return { values, numColors, tokenised: v };
1747
+ }
1748
+ function parse(v) {
1749
+ return analyse(v).values;
1750
+ }
1751
+ function createTransformer(v) {
1752
+ const { values, numColors, tokenised } = analyse(v);
1753
+ const numValues = values.length;
1754
+ return (v) => {
1755
+ let output = tokenised;
1756
+ for (let i = 0; i < numValues; i++) {
1757
+ output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i]));
1758
+ }
1759
+ return output;
1760
+ };
1761
+ }
1762
+ const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v;
1763
+ function getAnimatableNone$1(v) {
1764
+ const parsed = parse(v);
1765
+ const transformer = createTransformer(v);
1766
+ return transformer(parsed.map(convertNumbersToZero));
1767
+ }
1768
+ const complex = { test, parse, createTransformer, getAnimatableNone: getAnimatableNone$1 };
1769
+
1770
+ const maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']);
1771
+ function applyDefaultFilter(v) {
1772
+ let [name, value] = v.slice(0, -1).split('(');
1773
+ if (name === 'drop-shadow')
1774
+ return v;
1775
+ const [number] = value.match(floatRegex) || [];
1776
+ if (!number)
1777
+ return v;
1778
+ const unit = value.replace(number, '');
1779
+ let defaultValue = maxDefaults.has(name) ? 1 : 0;
1780
+ if (number !== value)
1781
+ defaultValue *= 100;
1782
+ return name + '(' + defaultValue + unit + ')';
1783
+ }
1784
+ const functionRegex = /([a-z-]*)\(.*?\)/g;
1785
+ const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v) => {
1786
+ const functions = v.match(functionRegex);
1787
+ return functions ? functions.map(applyDefaultFilter).join(' ') : v;
1788
+ } });
1789
+
1613
1790
  /**
1614
1791
  * Check if a value is animatable. Examples:
1615
1792
  *
@@ -2643,9 +2820,9 @@
2643
2820
  var attachResizeListener = _a.attachResizeListener, defaultParent = _a.defaultParent, measureScroll = _a.measureScroll, checkIsScrollRoot = _a.checkIsScrollRoot, resetTransform = _a.resetTransform;
2644
2821
  return /** @class */ (function () {
2645
2822
  function ProjectionNode(id, latestValues, parent) {
2646
- var _this = this;
2647
2823
  if (latestValues === void 0) { latestValues = {}; }
2648
2824
  if (parent === void 0) { parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent(); }
2825
+ var _this = this;
2649
2826
  /**
2650
2827
  * A Set containing all this component's children. This is used to iterate
2651
2828
  * through the children.
@@ -4338,7 +4515,7 @@
4338
4515
  * and warn against mismatches.
4339
4516
  */
4340
4517
  {
4341
- warnOnce(nextValue.version === "6.5.0", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.5.0 may not work as expected."));
4518
+ warnOnce(nextValue.version === "7.0.1", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.0.1 may not work as expected."));
4342
4519
  }
4343
4520
  }
4344
4521
  else if (isMotionValue(prevValue)) {
@@ -5234,9 +5411,9 @@
5234
5411
  * can be animated by Motion.
5235
5412
  */
5236
5413
  makeTargetAnimatable: function (element, _a, _b, isMounted) {
5414
+ var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, ["transition", "transitionEnd"]);
5237
5415
  var transformValues = _b.transformValues;
5238
5416
  if (isMounted === void 0) { isMounted = true; }
5239
- var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, ["transition", "transitionEnd"]);
5240
5417
  var origin = getOrigin(target, transition || {}, element);
5241
5418
  /**
5242
5419
  * If Framer has provided a function to convert `Color` etc value types, convert them