framer-motion 6.3.6 → 6.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -470,6 +470,11 @@ var MotionValue = /** @class */ (function () {
470
470
  */
471
471
  function MotionValue(init) {
472
472
  var _this = this;
473
+ /**
474
+ * This will be replaced by the build step with the latest version number.
475
+ * When MotionValues are provided to motion components, warn if versions are mixed.
476
+ */
477
+ this.version = "6.3.8";
473
478
  /**
474
479
  * Duration, in milliseconds, since last updating frame.
475
480
  *
@@ -5962,6 +5967,13 @@ function updateMotionValuesFromProps(element, next, prev) {
5962
5967
  * to our visual element's motion value map.
5963
5968
  */
5964
5969
  element.addValue(key, nextValue);
5970
+ /**
5971
+ * Check the version of the incoming motion value with this version
5972
+ * and warn against mismatches.
5973
+ */
5974
+ if (process.env.NODE_ENV === "development") {
5975
+ warnOnce(nextValue.version !== "6.3.8", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.8 may not work as expected."));
5976
+ }
5965
5977
  }
5966
5978
  else if (isMotionValue(prevValue)) {
5967
5979
  /**
@@ -6692,6 +6704,9 @@ var checkAndConvertChangedValueTypes = function (visualElement, target, origin,
6692
6704
  }
6693
6705
  });
6694
6706
  if (changedValueTypeKeys.length) {
6707
+ var scrollY_1 = changedValueTypeKeys.indexOf("height") >= 0
6708
+ ? window.pageYOffset
6709
+ : null;
6695
6710
  var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
6696
6711
  // If we removed transform values, reapply them before the next render
6697
6712
  if (removedTransformValues.length) {
@@ -6702,6 +6717,9 @@ var checkAndConvertChangedValueTypes = function (visualElement, target, origin,
6702
6717
  }
6703
6718
  // Reapply original values
6704
6719
  visualElement.syncRender();
6720
+ // Restore scroll position
6721
+ if (scrollY_1 !== null)
6722
+ window.scrollTo({ top: scrollY_1 });
6705
6723
  return { target: convertedTarget, transitionEnd: transitionEnd };
6706
6724
  }
6707
6725
  else {
@@ -226,6 +226,9 @@ var checkAndConvertChangedValueTypes = function (visualElement, target, origin,
226
226
  }
227
227
  });
228
228
  if (changedValueTypeKeys.length) {
229
+ var scrollY_1 = changedValueTypeKeys.indexOf("height") >= 0
230
+ ? window.pageYOffset
231
+ : null;
229
232
  var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
230
233
  // If we removed transform values, reapply them before the next render
231
234
  if (removedTransformValues.length) {
@@ -236,6 +239,9 @@ var checkAndConvertChangedValueTypes = function (visualElement, target, origin,
236
239
  }
237
240
  // Reapply original values
238
241
  visualElement.syncRender();
242
+ // Restore scroll position
243
+ if (scrollY_1 !== null)
244
+ window.scrollTo({ top: scrollY_1 });
239
245
  return { target: convertedTarget, transitionEnd: transitionEnd };
240
246
  }
241
247
  else {
@@ -1,3 +1,4 @@
1
+ import { warnOnce } from '../../utils/warn-once.mjs';
1
2
  import { motionValue } from '../../value/index.mjs';
2
3
  import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
3
4
 
@@ -12,6 +13,13 @@ function updateMotionValuesFromProps(element, next, prev) {
12
13
  * to our visual element's motion value map.
13
14
  */
14
15
  element.addValue(key, nextValue);
16
+ /**
17
+ * Check the version of the incoming motion value with this version
18
+ * and warn against mismatches.
19
+ */
20
+ if (process.env.NODE_ENV === "development") {
21
+ warnOnce(nextValue.version !== "6.3.8", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.8 may not work as expected."));
22
+ }
15
23
  }
16
24
  else if (isMotionValue(prevValue)) {
17
25
  /**
@@ -21,6 +21,11 @@ var MotionValue = /** @class */ (function () {
21
21
  */
22
22
  function MotionValue(init) {
23
23
  var _this = this;
24
+ /**
25
+ * This will be replaced by the build step with the latest version number.
26
+ * When MotionValues are provided to motion components, warn if versions are mixed.
27
+ */
28
+ this.version = "6.3.8";
24
29
  /**
25
30
  * Duration, in milliseconds, since last updating frame.
26
31
  *
@@ -1695,6 +1695,11 @@
1695
1695
  */
1696
1696
  function MotionValue(init) {
1697
1697
  var _this = this;
1698
+ /**
1699
+ * This will be replaced by the build step with the latest version number.
1700
+ * When MotionValues are provided to motion components, warn if versions are mixed.
1701
+ */
1702
+ this.version = "6.3.8";
1698
1703
  /**
1699
1704
  * Duration, in milliseconds, since last updating frame.
1700
1705
  *
@@ -7187,6 +7192,13 @@
7187
7192
  * to our visual element's motion value map.
7188
7193
  */
7189
7194
  element.addValue(key, nextValue);
7195
+ /**
7196
+ * Check the version of the incoming motion value with this version
7197
+ * and warn against mismatches.
7198
+ */
7199
+ {
7200
+ warnOnce(nextValue.version !== "6.3.8", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.8 may not work as expected."));
7201
+ }
7190
7202
  }
7191
7203
  else if (isMotionValue(prevValue)) {
7192
7204
  /**
@@ -7917,6 +7929,9 @@
7917
7929
  }
7918
7930
  });
7919
7931
  if (changedValueTypeKeys.length) {
7932
+ var scrollY_1 = changedValueTypeKeys.indexOf("height") >= 0
7933
+ ? window.pageYOffset
7934
+ : null;
7920
7935
  var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
7921
7936
  // If we removed transform values, reapply them before the next render
7922
7937
  if (removedTransformValues.length) {
@@ -7927,6 +7942,9 @@
7927
7942
  }
7928
7943
  // Reapply original values
7929
7944
  visualElement.syncRender();
7945
+ // Restore scroll position
7946
+ if (scrollY_1 !== null)
7947
+ window.scrollTo({ top: scrollY_1 });
7930
7948
  return { target: convertedTarget, transitionEnd: transitionEnd };
7931
7949
  }
7932
7950
  else {