framer-motion 6.3.7-beta.0 → 6.3.7

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.7";
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.7", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.7 may not work as expected."));
5976
+ }
5965
5977
  }
5966
5978
  else if (isMotionValue(prevValue)) {
5967
5979
  /**
@@ -6692,9 +6704,6 @@ var checkAndConvertChangedValueTypes = function (visualElement, target, origin,
6692
6704
  }
6693
6705
  });
6694
6706
  if (changedValueTypeKeys.length) {
6695
- var scrollY_1 = changedValueTypeKeys.indexOf("height") >= 0
6696
- ? window.pageYOffset
6697
- : null;
6698
6707
  var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
6699
6708
  // If we removed transform values, reapply them before the next render
6700
6709
  if (removedTransformValues.length) {
@@ -6705,9 +6714,6 @@ var checkAndConvertChangedValueTypes = function (visualElement, target, origin,
6705
6714
  }
6706
6715
  // Reapply original values
6707
6716
  visualElement.syncRender();
6708
- // Restore scroll position
6709
- if (scrollY_1 !== null)
6710
- window.scrollTo({ top: scrollY_1 });
6711
6717
  return { target: convertedTarget, transitionEnd: transitionEnd };
6712
6718
  }
6713
6719
  else {
@@ -226,9 +226,6 @@ 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;
232
229
  var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
233
230
  // If we removed transform values, reapply them before the next render
234
231
  if (removedTransformValues.length) {
@@ -239,9 +236,6 @@ var checkAndConvertChangedValueTypes = function (visualElement, target, origin,
239
236
  }
240
237
  // Reapply original values
241
238
  visualElement.syncRender();
242
- // Restore scroll position
243
- if (scrollY_1 !== null)
244
- window.scrollTo({ top: scrollY_1 });
245
239
  return { target: convertedTarget, transitionEnd: transitionEnd };
246
240
  }
247
241
  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.7", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.7 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.7";
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.7";
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.7", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 6.3.7 may not work as expected."));
7201
+ }
7190
7202
  }
7191
7203
  else if (isMotionValue(prevValue)) {
7192
7204
  /**
@@ -7917,9 +7929,6 @@
7917
7929
  }
7918
7930
  });
7919
7931
  if (changedValueTypeKeys.length) {
7920
- var scrollY_1 = changedValueTypeKeys.indexOf("height") >= 0
7921
- ? window.pageYOffset
7922
- : null;
7923
7932
  var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
7924
7933
  // If we removed transform values, reapply them before the next render
7925
7934
  if (removedTransformValues.length) {
@@ -7930,9 +7939,6 @@
7930
7939
  }
7931
7940
  // Reapply original values
7932
7941
  visualElement.syncRender();
7933
- // Restore scroll position
7934
- if (scrollY_1 !== null)
7935
- window.scrollTo({ top: scrollY_1 });
7936
7942
  return { target: convertedTarget, transitionEnd: transitionEnd };
7937
7943
  }
7938
7944
  else {