framer-motion 7.0.3 → 7.1.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.
package/dist/cjs/index.js CHANGED
@@ -748,9 +748,7 @@ function buildTransform(_a, _b, transformIsDefault, transformTemplate) {
748
748
  if (!transformHasZ && enableHardwareAcceleration) {
749
749
  transformString += "translateZ(0)";
750
750
  }
751
- else {
752
- transformString = transformString.trim();
753
- }
751
+ transformString = transformString.trim();
754
752
  // If we have a custom `transform` template, pass our transform values and
755
753
  // generated transformString to that before returning
756
754
  if (transformTemplate) {
@@ -2357,11 +2355,13 @@ var isNumericalString = function (v) { return /^\-?\d*\.?\d+$/.test(v); };
2357
2355
  var isZeroValueString = function (v) { return /^0[^.\s]+$/.test(v); };
2358
2356
 
2359
2357
  function addUniqueItem(arr, item) {
2360
- arr.indexOf(item) === -1 && arr.push(item);
2358
+ if (arr.indexOf(item) === -1)
2359
+ arr.push(item);
2361
2360
  }
2362
2361
  function removeItem(arr, item) {
2363
2362
  var index = arr.indexOf(item);
2364
- index > -1 && arr.splice(index, 1);
2363
+ if (index > -1)
2364
+ arr.splice(index, 1);
2365
2365
  }
2366
2366
  // Adapted from array-move
2367
2367
  function moveItem(_a, fromIndex, toIndex) {
@@ -2437,7 +2437,7 @@ var MotionValue = /** @class */ (function () {
2437
2437
  * This will be replaced by the build step with the latest version number.
2438
2438
  * When MotionValues are provided to motion components, warn if versions are mixed.
2439
2439
  */
2440
- this.version = "7.0.3";
2440
+ this.version = "7.1.0";
2441
2441
  /**
2442
2442
  * Duration, in milliseconds, since last updating frame.
2443
2443
  *
@@ -2857,6 +2857,10 @@ function getOrigin(target, transition, visualElement) {
2857
2857
  return origin;
2858
2858
  }
2859
2859
 
2860
+ function isWillChangeMotionValue(value) {
2861
+ return Boolean(isMotionValue(value) && value.add);
2862
+ }
2863
+
2860
2864
  function animateVisualElement(visualElement, definition, options) {
2861
2865
  if (options === void 0) { options = {}; }
2862
2866
  visualElement.notifyAnimationStart(definition);
@@ -2928,18 +2932,19 @@ function animateTarget(visualElement, definition, _a) {
2928
2932
  var _b;
2929
2933
  var _c = _a === void 0 ? {} : _a, _d = _c.delay, delay = _d === void 0 ? 0 : _d, transitionOverride = _c.transitionOverride, type = _c.type;
2930
2934
  var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = tslib.__rest(_e, ["transition", "transitionEnd"]);
2935
+ var willChange = visualElement.getValue("willChange");
2931
2936
  if (transitionOverride)
2932
2937
  transition = transitionOverride;
2933
2938
  var animations = [];
2934
2939
  var animationTypeState = type && ((_b = visualElement.animationState) === null || _b === void 0 ? void 0 : _b.getState()[type]);
2935
- for (var key in target) {
2940
+ var _loop_1 = function (key) {
2936
2941
  var value = visualElement.getValue(key);
2937
2942
  var valueTarget = target[key];
2938
2943
  if (!value ||
2939
2944
  valueTarget === undefined ||
2940
2945
  (animationTypeState &&
2941
2946
  shouldBlockAnimation(animationTypeState, key))) {
2942
- continue;
2947
+ return "continue";
2943
2948
  }
2944
2949
  var valueTransition = tslib.__assign({ delay: delay }, transition);
2945
2950
  /**
@@ -2949,7 +2954,14 @@ function animateTarget(visualElement, definition, _a) {
2949
2954
  valueTransition = tslib.__assign(tslib.__assign({}, valueTransition), { type: false, delay: 0 });
2950
2955
  }
2951
2956
  var animation = startAnimation(key, value, valueTarget, valueTransition);
2957
+ if (isWillChangeMotionValue(willChange)) {
2958
+ willChange.add(key);
2959
+ animation = animation.then(function () { return willChange.remove(key); });
2960
+ }
2952
2961
  animations.push(animation);
2962
+ };
2963
+ for (var key in target) {
2964
+ _loop_1(key);
2953
2965
  }
2954
2966
  return Promise.all(animations).then(function () {
2955
2967
  transitionEnd && setTarget(visualElement, transitionEnd);
@@ -3018,7 +3030,6 @@ function animateList(visualElement) {
3018
3030
  function createAnimationState(visualElement) {
3019
3031
  var animate = animateList(visualElement);
3020
3032
  var state = createState();
3021
- var allAnimatedKeys = {};
3022
3033
  var isInitialRender = true;
3023
3034
  /**
3024
3035
  * This function will be used to reduce the animation definitions for
@@ -3032,9 +3043,6 @@ function createAnimationState(visualElement) {
3032
3043
  }
3033
3044
  return acc;
3034
3045
  };
3035
- function isAnimated(key) {
3036
- return allAnimatedKeys[key] !== undefined;
3037
- }
3038
3046
  /**
3039
3047
  * This just allows us to inject mocked animation functions
3040
3048
  * @internal
@@ -3248,7 +3256,6 @@ function createAnimationState(visualElement) {
3248
3256
  for (var i = 0; i < numAnimationTypes; i++) {
3249
3257
  _loop_1(i);
3250
3258
  }
3251
- allAnimatedKeys = tslib.__assign({}, encounteredKeys);
3252
3259
  /**
3253
3260
  * If there are some removed value that haven't been dealt with,
3254
3261
  * we need to create a new animation that falls back either to the value
@@ -3291,7 +3298,6 @@ function createAnimationState(visualElement) {
3291
3298
  return animations;
3292
3299
  }
3293
3300
  return {
3294
- isAnimated: isAnimated,
3295
3301
  animateChanges: animateChanges,
3296
3302
  setActive: setActive,
3297
3303
  setAnimateFunction: setAnimateFunction,
@@ -4393,6 +4399,7 @@ function createLifecycles() {
4393
4399
 
4394
4400
  function updateMotionValuesFromProps(element, next, prev) {
4395
4401
  var _a;
4402
+ var willChange = next.willChange;
4396
4403
  for (var key in next) {
4397
4404
  var nextValue = next[key];
4398
4405
  var prevValue = prev[key];
@@ -4402,20 +4409,26 @@ function updateMotionValuesFromProps(element, next, prev) {
4402
4409
  * to our visual element's motion value map.
4403
4410
  */
4404
4411
  element.addValue(key, nextValue);
4412
+ if (isWillChangeMotionValue(willChange)) {
4413
+ willChange.add(key);
4414
+ }
4405
4415
  /**
4406
4416
  * Check the version of the incoming motion value with this version
4407
4417
  * and warn against mismatches.
4408
4418
  */
4409
4419
  if (process.env.NODE_ENV === "development") {
4410
- warnOnce(nextValue.version === "7.0.3", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.0.3 may not work as expected."));
4420
+ warnOnce(nextValue.version === "7.1.0", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.1.0 may not work as expected."));
4411
4421
  }
4412
4422
  }
4413
4423
  else if (isMotionValue(prevValue)) {
4414
4424
  /**
4415
- * If we're swapping to a new motion value, create a new motion value
4416
- * from that
4425
+ * If we're swapping from a motion value to a static value,
4426
+ * create a new motion value from that
4417
4427
  */
4418
4428
  element.addValue(key, motionValue(nextValue));
4429
+ if (isWillChangeMotionValue(willChange)) {
4430
+ willChange.remove(key);
4431
+ }
4419
4432
  }
4420
4433
  else if (prevValue !== nextValue) {
4421
4434
  /**
@@ -4528,11 +4541,14 @@ var visualElement = function (_a) {
4528
4541
  * Doing so will break some tests but this isn't neccessarily a breaking change,
4529
4542
  * more a reflection of the test.
4530
4543
  */
4531
- var initialMotionValues = scrapeMotionValuesFromProps(props);
4544
+ var _b = scrapeMotionValuesFromProps(props), willChange = _b.willChange, initialMotionValues = tslib.__rest(_b, ["willChange"]);
4532
4545
  for (var key in initialMotionValues) {
4533
4546
  var value = initialMotionValues[key];
4534
4547
  if (latestValues[key] !== undefined && isMotionValue(value)) {
4535
4548
  value.set(latestValues[key], false);
4549
+ if (isWillChangeMotionValue(willChange)) {
4550
+ willChange.add(key);
4551
+ }
4536
4552
  }
4537
4553
  }
4538
4554
  /**
@@ -5153,7 +5169,7 @@ var checkAndConvertChangedValueTypes = function (visualElement, target, origin,
5153
5169
  // Reapply original values
5154
5170
  visualElement.syncRender();
5155
5171
  // Restore scroll position
5156
- if (scrollY_1 !== null)
5172
+ if (isBrowser && scrollY_1 !== null)
5157
5173
  window.scrollTo({ top: scrollY_1 });
5158
5174
  return { target: convertedTarget, transitionEnd: transitionEnd };
5159
5175
  }
@@ -4,6 +4,7 @@ import { isKeyframesTarget } from '../../../animation/utils/is-keyframes-target.
4
4
  import { invariant } from 'hey-listen';
5
5
  import { transformProps } from '../../html/utils/transform.mjs';
6
6
  import { findDimensionValueType } from '../value-types/dimensions.mjs';
7
+ import { isBrowser } from '../../../utils/is-browser.mjs';
7
8
 
8
9
  var positionalKeys = new Set([
9
10
  "width",
@@ -240,7 +241,7 @@ var checkAndConvertChangedValueTypes = function (visualElement, target, origin,
240
241
  // Reapply original values
241
242
  visualElement.syncRender();
242
243
  // Restore scroll position
243
- if (scrollY_1 !== null)
244
+ if (isBrowser && scrollY_1 !== null)
244
245
  window.scrollTo({ top: scrollY_1 });
245
246
  return { target: convertedTarget, transitionEnd: transitionEnd };
246
247
  }
@@ -33,9 +33,7 @@ function buildTransform(_a, _b, transformIsDefault, transformTemplate) {
33
33
  if (!transformHasZ && enableHardwareAcceleration) {
34
34
  transformString += "translateZ(0)";
35
35
  }
36
- else {
37
- transformString = transformString.trim();
38
- }
36
+ transformString = transformString.trim();
39
37
  // If we have a custom `transform` template, pass our transform values and
40
38
  // generated transformString to that before returning
41
39
  if (transformTemplate) {
@@ -1,6 +1,7 @@
1
- import { __assign, __spreadArray, __read } from 'tslib';
1
+ import { __assign, __rest, __spreadArray, __read } from 'tslib';
2
2
  import sync, { cancelSync } from 'framesync';
3
3
  import { motionValue } from '../value/index.mjs';
4
+ import { isWillChangeMotionValue } from '../value/use-will-change/is.mjs';
4
5
  import { isMotionValue } from '../value/utils/is-motion-value.mjs';
5
6
  import { variantPriorityOrder } from './utils/animation-state.mjs';
6
7
  import { createLifecycles } from './utils/lifecycles.mjs';
@@ -94,11 +95,14 @@ var visualElement = function (_a) {
94
95
  * Doing so will break some tests but this isn't neccessarily a breaking change,
95
96
  * more a reflection of the test.
96
97
  */
97
- var initialMotionValues = scrapeMotionValuesFromProps(props);
98
+ var _b = scrapeMotionValuesFromProps(props), willChange = _b.willChange, initialMotionValues = __rest(_b, ["willChange"]);
98
99
  for (var key in initialMotionValues) {
99
100
  var value = initialMotionValues[key];
100
101
  if (latestValues[key] !== undefined && isMotionValue(value)) {
101
102
  value.set(latestValues[key], false);
103
+ if (isWillChangeMotionValue(willChange)) {
104
+ willChange.add(key);
105
+ }
102
106
  }
103
107
  }
104
108
  /**
@@ -28,7 +28,6 @@ function animateList(visualElement) {
28
28
  function createAnimationState(visualElement) {
29
29
  var animate = animateList(visualElement);
30
30
  var state = createState();
31
- var allAnimatedKeys = {};
32
31
  var isInitialRender = true;
33
32
  /**
34
33
  * This function will be used to reduce the animation definitions for
@@ -42,9 +41,6 @@ function createAnimationState(visualElement) {
42
41
  }
43
42
  return acc;
44
43
  };
45
- function isAnimated(key) {
46
- return allAnimatedKeys[key] !== undefined;
47
- }
48
44
  /**
49
45
  * This just allows us to inject mocked animation functions
50
46
  * @internal
@@ -258,7 +254,6 @@ function createAnimationState(visualElement) {
258
254
  for (var i = 0; i < numAnimationTypes; i++) {
259
255
  _loop_1(i);
260
256
  }
261
- allAnimatedKeys = __assign({}, encounteredKeys);
262
257
  /**
263
258
  * If there are some removed value that haven't been dealt with,
264
259
  * we need to create a new animation that falls back either to the value
@@ -301,7 +296,6 @@ function createAnimationState(visualElement) {
301
296
  return animations;
302
297
  }
303
298
  return {
304
- isAnimated: isAnimated,
305
299
  animateChanges: animateChanges,
306
300
  setActive: setActive,
307
301
  setAnimateFunction: setAnimateFunction,
@@ -3,6 +3,7 @@ import { startAnimation } from '../../animation/utils/transitions.mjs';
3
3
  import { setTarget } from './setters.mjs';
4
4
  import { resolveVariant } from './variants.mjs';
5
5
  import { isTransformProp } from '../html/utils/transform.mjs';
6
+ import { isWillChangeMotionValue } from '../../value/use-will-change/is.mjs';
6
7
 
7
8
  function animateVisualElement(visualElement, definition, options) {
8
9
  if (options === void 0) { options = {}; }
@@ -75,18 +76,19 @@ function animateTarget(visualElement, definition, _a) {
75
76
  var _b;
76
77
  var _c = _a === void 0 ? {} : _a, _d = _c.delay, delay = _d === void 0 ? 0 : _d, transitionOverride = _c.transitionOverride, type = _c.type;
77
78
  var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = __rest(_e, ["transition", "transitionEnd"]);
79
+ var willChange = visualElement.getValue("willChange");
78
80
  if (transitionOverride)
79
81
  transition = transitionOverride;
80
82
  var animations = [];
81
83
  var animationTypeState = type && ((_b = visualElement.animationState) === null || _b === void 0 ? void 0 : _b.getState()[type]);
82
- for (var key in target) {
84
+ var _loop_1 = function (key) {
83
85
  var value = visualElement.getValue(key);
84
86
  var valueTarget = target[key];
85
87
  if (!value ||
86
88
  valueTarget === undefined ||
87
89
  (animationTypeState &&
88
90
  shouldBlockAnimation(animationTypeState, key))) {
89
- continue;
91
+ return "continue";
90
92
  }
91
93
  var valueTransition = __assign({ delay: delay }, transition);
92
94
  /**
@@ -96,7 +98,14 @@ function animateTarget(visualElement, definition, _a) {
96
98
  valueTransition = __assign(__assign({}, valueTransition), { type: false, delay: 0 });
97
99
  }
98
100
  var animation = startAnimation(key, value, valueTarget, valueTransition);
101
+ if (isWillChangeMotionValue(willChange)) {
102
+ willChange.add(key);
103
+ animation = animation.then(function () { return willChange.remove(key); });
104
+ }
99
105
  animations.push(animation);
106
+ };
107
+ for (var key in target) {
108
+ _loop_1(key);
100
109
  }
101
110
  return Promise.all(animations).then(function () {
102
111
  transitionEnd && setTarget(visualElement, transitionEnd);
@@ -1,9 +1,11 @@
1
+ import { isWillChangeMotionValue } from '../../value/use-will-change/is.mjs';
1
2
  import { warnOnce } from '../../utils/warn-once.mjs';
2
3
  import { motionValue } from '../../value/index.mjs';
3
4
  import { isMotionValue } from '../../value/utils/is-motion-value.mjs';
4
5
 
5
6
  function updateMotionValuesFromProps(element, next, prev) {
6
7
  var _a;
8
+ var willChange = next.willChange;
7
9
  for (var key in next) {
8
10
  var nextValue = next[key];
9
11
  var prevValue = prev[key];
@@ -13,20 +15,26 @@ function updateMotionValuesFromProps(element, next, prev) {
13
15
  * to our visual element's motion value map.
14
16
  */
15
17
  element.addValue(key, nextValue);
18
+ if (isWillChangeMotionValue(willChange)) {
19
+ willChange.add(key);
20
+ }
16
21
  /**
17
22
  * Check the version of the incoming motion value with this version
18
23
  * and warn against mismatches.
19
24
  */
20
25
  if (process.env.NODE_ENV === "development") {
21
- warnOnce(nextValue.version === "7.0.3", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.0.3 may not work as expected."));
26
+ warnOnce(nextValue.version === "7.1.0", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.1.0 may not work as expected."));
22
27
  }
23
28
  }
24
29
  else if (isMotionValue(prevValue)) {
25
30
  /**
26
- * If we're swapping to a new motion value, create a new motion value
27
- * from that
31
+ * If we're swapping from a motion value to a static value,
32
+ * create a new motion value from that
28
33
  */
29
34
  element.addValue(key, motionValue(nextValue));
35
+ if (isWillChangeMotionValue(willChange)) {
36
+ willChange.remove(key);
37
+ }
30
38
  }
31
39
  else if (prevValue !== nextValue) {
32
40
  /**
@@ -1,11 +1,13 @@
1
1
  import { __read } from 'tslib';
2
2
 
3
3
  function addUniqueItem(arr, item) {
4
- arr.indexOf(item) === -1 && arr.push(item);
4
+ if (arr.indexOf(item) === -1)
5
+ arr.push(item);
5
6
  }
6
7
  function removeItem(arr, item) {
7
8
  var index = arr.indexOf(item);
8
- index > -1 && arr.splice(index, 1);
9
+ if (index > -1)
10
+ arr.splice(index, 1);
9
11
  }
10
12
  // Adapted from array-move
11
13
  function moveItem(_a, fromIndex, toIndex) {
@@ -25,7 +25,7 @@ var MotionValue = /** @class */ (function () {
25
25
  * This will be replaced by the build step with the latest version number.
26
26
  * When MotionValues are provided to motion components, warn if versions are mixed.
27
27
  */
28
- this.version = "7.0.3";
28
+ this.version = "7.1.0";
29
29
  /**
30
30
  * Duration, in milliseconds, since last updating frame.
31
31
  *
@@ -0,0 +1,7 @@
1
+ import { isMotionValue } from '../utils/is-motion-value.mjs';
2
+
3
+ function isWillChangeMotionValue(value) {
4
+ return Boolean(isMotionValue(value) && value.add);
5
+ }
6
+
7
+ export { isWillChangeMotionValue };
@@ -849,9 +849,7 @@
849
849
  if (!transformHasZ && enableHardwareAcceleration) {
850
850
  transformString += "translateZ(0)";
851
851
  }
852
- else {
853
- transformString = transformString.trim();
854
- }
852
+ transformString = transformString.trim();
855
853
  // If we have a custom `transform` template, pass our transform values and
856
854
  // generated transformString to that before returning
857
855
  if (transformTemplate) {
@@ -3590,11 +3588,13 @@
3590
3588
  var isZeroValueString = function (v) { return /^0[^.\s]+$/.test(v); };
3591
3589
 
3592
3590
  function addUniqueItem(arr, item) {
3593
- arr.indexOf(item) === -1 && arr.push(item);
3591
+ if (arr.indexOf(item) === -1)
3592
+ arr.push(item);
3594
3593
  }
3595
3594
  function removeItem(arr, item) {
3596
3595
  var index = arr.indexOf(item);
3597
- index > -1 && arr.splice(index, 1);
3596
+ if (index > -1)
3597
+ arr.splice(index, 1);
3598
3598
  }
3599
3599
  // Adapted from array-move
3600
3600
  function moveItem(_a, fromIndex, toIndex) {
@@ -3670,7 +3670,7 @@
3670
3670
  * This will be replaced by the build step with the latest version number.
3671
3671
  * When MotionValues are provided to motion components, warn if versions are mixed.
3672
3672
  */
3673
- this.version = "7.0.3";
3673
+ this.version = "7.1.0";
3674
3674
  /**
3675
3675
  * Duration, in milliseconds, since last updating frame.
3676
3676
  *
@@ -4090,6 +4090,10 @@
4090
4090
  return origin;
4091
4091
  }
4092
4092
 
4093
+ function isWillChangeMotionValue(value) {
4094
+ return Boolean(isMotionValue(value) && value.add);
4095
+ }
4096
+
4093
4097
  function animateVisualElement(visualElement, definition, options) {
4094
4098
  if (options === void 0) { options = {}; }
4095
4099
  visualElement.notifyAnimationStart(definition);
@@ -4161,18 +4165,19 @@
4161
4165
  var _b;
4162
4166
  var _c = _a === void 0 ? {} : _a, _d = _c.delay, delay = _d === void 0 ? 0 : _d, transitionOverride = _c.transitionOverride, type = _c.type;
4163
4167
  var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = __rest(_e, ["transition", "transitionEnd"]);
4168
+ var willChange = visualElement.getValue("willChange");
4164
4169
  if (transitionOverride)
4165
4170
  transition = transitionOverride;
4166
4171
  var animations = [];
4167
4172
  var animationTypeState = type && ((_b = visualElement.animationState) === null || _b === void 0 ? void 0 : _b.getState()[type]);
4168
- for (var key in target) {
4173
+ var _loop_1 = function (key) {
4169
4174
  var value = visualElement.getValue(key);
4170
4175
  var valueTarget = target[key];
4171
4176
  if (!value ||
4172
4177
  valueTarget === undefined ||
4173
4178
  (animationTypeState &&
4174
4179
  shouldBlockAnimation(animationTypeState, key))) {
4175
- continue;
4180
+ return "continue";
4176
4181
  }
4177
4182
  var valueTransition = __assign({ delay: delay }, transition);
4178
4183
  /**
@@ -4182,7 +4187,14 @@
4182
4187
  valueTransition = __assign(__assign({}, valueTransition), { type: false, delay: 0 });
4183
4188
  }
4184
4189
  var animation = startAnimation(key, value, valueTarget, valueTransition);
4190
+ if (isWillChangeMotionValue(willChange)) {
4191
+ willChange.add(key);
4192
+ animation = animation.then(function () { return willChange.remove(key); });
4193
+ }
4185
4194
  animations.push(animation);
4195
+ };
4196
+ for (var key in target) {
4197
+ _loop_1(key);
4186
4198
  }
4187
4199
  return Promise.all(animations).then(function () {
4188
4200
  transitionEnd && setTarget(visualElement, transitionEnd);
@@ -4251,7 +4263,6 @@
4251
4263
  function createAnimationState(visualElement) {
4252
4264
  var animate = animateList(visualElement);
4253
4265
  var state = createState();
4254
- var allAnimatedKeys = {};
4255
4266
  var isInitialRender = true;
4256
4267
  /**
4257
4268
  * This function will be used to reduce the animation definitions for
@@ -4265,9 +4276,6 @@
4265
4276
  }
4266
4277
  return acc;
4267
4278
  };
4268
- function isAnimated(key) {
4269
- return allAnimatedKeys[key] !== undefined;
4270
- }
4271
4279
  /**
4272
4280
  * This just allows us to inject mocked animation functions
4273
4281
  * @internal
@@ -4481,7 +4489,6 @@
4481
4489
  for (var i = 0; i < numAnimationTypes; i++) {
4482
4490
  _loop_1(i);
4483
4491
  }
4484
- allAnimatedKeys = __assign({}, encounteredKeys);
4485
4492
  /**
4486
4493
  * If there are some removed value that haven't been dealt with,
4487
4494
  * we need to create a new animation that falls back either to the value
@@ -4524,7 +4531,6 @@
4524
4531
  return animations;
4525
4532
  }
4526
4533
  return {
4527
- isAnimated: isAnimated,
4528
4534
  animateChanges: animateChanges,
4529
4535
  setActive: setActive,
4530
4536
  setAnimateFunction: setAnimateFunction,
@@ -5626,6 +5632,7 @@
5626
5632
 
5627
5633
  function updateMotionValuesFromProps(element, next, prev) {
5628
5634
  var _a;
5635
+ var willChange = next.willChange;
5629
5636
  for (var key in next) {
5630
5637
  var nextValue = next[key];
5631
5638
  var prevValue = prev[key];
@@ -5635,20 +5642,26 @@
5635
5642
  * to our visual element's motion value map.
5636
5643
  */
5637
5644
  element.addValue(key, nextValue);
5645
+ if (isWillChangeMotionValue(willChange)) {
5646
+ willChange.add(key);
5647
+ }
5638
5648
  /**
5639
5649
  * Check the version of the incoming motion value with this version
5640
5650
  * and warn against mismatches.
5641
5651
  */
5642
5652
  {
5643
- warnOnce(nextValue.version === "7.0.3", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.0.3 may not work as expected."));
5653
+ warnOnce(nextValue.version === "7.1.0", "Attempting to mix Framer Motion versions ".concat(nextValue.version, " with 7.1.0 may not work as expected."));
5644
5654
  }
5645
5655
  }
5646
5656
  else if (isMotionValue(prevValue)) {
5647
5657
  /**
5648
- * If we're swapping to a new motion value, create a new motion value
5649
- * from that
5658
+ * If we're swapping from a motion value to a static value,
5659
+ * create a new motion value from that
5650
5660
  */
5651
5661
  element.addValue(key, motionValue(nextValue));
5662
+ if (isWillChangeMotionValue(willChange)) {
5663
+ willChange.remove(key);
5664
+ }
5652
5665
  }
5653
5666
  else if (prevValue !== nextValue) {
5654
5667
  /**
@@ -5761,11 +5774,14 @@
5761
5774
  * Doing so will break some tests but this isn't neccessarily a breaking change,
5762
5775
  * more a reflection of the test.
5763
5776
  */
5764
- var initialMotionValues = scrapeMotionValuesFromProps(props);
5777
+ var _b = scrapeMotionValuesFromProps(props), willChange = _b.willChange, initialMotionValues = __rest(_b, ["willChange"]);
5765
5778
  for (var key in initialMotionValues) {
5766
5779
  var value = initialMotionValues[key];
5767
5780
  if (latestValues[key] !== undefined && isMotionValue(value)) {
5768
5781
  value.set(latestValues[key], false);
5782
+ if (isWillChangeMotionValue(willChange)) {
5783
+ willChange.add(key);
5784
+ }
5769
5785
  }
5770
5786
  }
5771
5787
  /**
@@ -6386,7 +6402,7 @@
6386
6402
  // Reapply original values
6387
6403
  visualElement.syncRender();
6388
6404
  // Restore scroll position
6389
- if (scrollY_1 !== null)
6405
+ if (isBrowser && scrollY_1 !== null)
6390
6406
  window.scrollTo({ top: scrollY_1 });
6391
6407
  return { target: convertedTarget, transitionEnd: transitionEnd };
6392
6408
  }