framer-motion 4.1.2 → 4.1.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Framer Motion adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [4.1.3] 2021-04-07
6
+
7
+ ### Fixed
8
+
9
+ - Animating to/between `0rem` and other non-specifically handled unit types.
10
+
5
11
  ## [4.1.2] 2021-04-01
6
12
 
7
13
  ### Fixed
@@ -6,8 +6,6 @@ import { isAnimatable } from './is-animatable.js';
6
6
  import { getDefaultTransition } from './default-transitions.js';
7
7
  import { warning } from 'hey-listen';
8
8
  import { getAnimatableNone } from '../../render/dom/value-types/animatable-none.js';
9
- import { findDimensionValueType } from '../../render/dom/value-types/dimensions.js';
10
- import { getValueAsType } from '../../render/dom/value-types/get-as-type.js';
11
9
 
12
10
  /**
13
11
  * Decide whether a transition is defined on a given Transition.
@@ -168,7 +166,9 @@ function isZero(value) {
168
166
  value.indexOf(" ") === -1));
169
167
  }
170
168
  function getZeroUnit(potentialUnitType) {
171
- return getValueAsType(0, findDimensionValueType(potentialUnitType));
169
+ return typeof potentialUnitType === "number"
170
+ ? 0
171
+ : getAnimatableNone("", potentialUnitType);
172
172
  }
173
173
  function getValueTransition(transition, key) {
174
174
  return transition[key] || transition["default"] || transition;
@@ -1823,30 +1823,6 @@ function getAnimatableNone(key, value) {
1823
1823
  return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
1824
1824
  }
1825
1825
 
1826
- /**
1827
- * Tests a provided value against a ValueType
1828
- */
1829
- var testValueType = function (v) { return function (type) { return type.test(v); }; };
1830
-
1831
- /**
1832
- * ValueType for "auto"
1833
- */
1834
- var auto = {
1835
- test: function (v) { return v === "auto"; },
1836
- parse: function (v) { return v; },
1837
- };
1838
-
1839
- /**
1840
- * A list of value types commonly used for dimensions
1841
- */
1842
- var dimensionValueTypes = [styleValueTypes.number, styleValueTypes.px, styleValueTypes.percent, styleValueTypes.degrees, styleValueTypes.vw, styleValueTypes.vh, auto];
1843
- /**
1844
- * Tests a dimensional value against the list of dimension ValueTypes
1845
- */
1846
- var findDimensionValueType = function (v) {
1847
- return dimensionValueTypes.find(testValueType(v));
1848
- };
1849
-
1850
1826
  /**
1851
1827
  * Decide whether a transition is defined on a given Transition.
1852
1828
  * This filters out orchestration options and returns true
@@ -2006,7 +1982,9 @@ function isZero(value) {
2006
1982
  value.indexOf(" ") === -1));
2007
1983
  }
2008
1984
  function getZeroUnit(potentialUnitType) {
2009
- return getValueAsType(0, findDimensionValueType(potentialUnitType));
1985
+ return typeof potentialUnitType === "number"
1986
+ ? 0
1987
+ : getAnimatableNone("", potentialUnitType);
2010
1988
  }
2011
1989
  function getValueTransition(transition, key) {
2012
1990
  return transition[key] || transition["default"] || transition;
@@ -2424,6 +2402,30 @@ function motionValue(init) {
2424
2402
  return new MotionValue(init);
2425
2403
  }
2426
2404
 
2405
+ /**
2406
+ * Tests a provided value against a ValueType
2407
+ */
2408
+ var testValueType = function (v) { return function (type) { return type.test(v); }; };
2409
+
2410
+ /**
2411
+ * ValueType for "auto"
2412
+ */
2413
+ var auto = {
2414
+ test: function (v) { return v === "auto"; },
2415
+ parse: function (v) { return v; },
2416
+ };
2417
+
2418
+ /**
2419
+ * A list of value types commonly used for dimensions
2420
+ */
2421
+ var dimensionValueTypes = [styleValueTypes.number, styleValueTypes.px, styleValueTypes.percent, styleValueTypes.degrees, styleValueTypes.vw, styleValueTypes.vh, auto];
2422
+ /**
2423
+ * Tests a dimensional value against the list of dimension ValueTypes
2424
+ */
2425
+ var findDimensionValueType = function (v) {
2426
+ return dimensionValueTypes.find(testValueType(v));
2427
+ };
2428
+
2427
2429
  /**
2428
2430
  * A list of all ValueTypes
2429
2431
  */
@@ -3045,30 +3045,6 @@
3045
3045
  return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
3046
3046
  }
3047
3047
 
3048
- /**
3049
- * Tests a provided value against a ValueType
3050
- */
3051
- var testValueType = function (v) { return function (type) { return type.test(v); }; };
3052
-
3053
- /**
3054
- * ValueType for "auto"
3055
- */
3056
- var auto = {
3057
- test: function (v) { return v === "auto"; },
3058
- parse: function (v) { return v; },
3059
- };
3060
-
3061
- /**
3062
- * A list of value types commonly used for dimensions
3063
- */
3064
- var dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
3065
- /**
3066
- * Tests a dimensional value against the list of dimension ValueTypes
3067
- */
3068
- var findDimensionValueType = function (v) {
3069
- return dimensionValueTypes.find(testValueType(v));
3070
- };
3071
-
3072
3048
  /**
3073
3049
  * Decide whether a transition is defined on a given Transition.
3074
3050
  * This filters out orchestration options and returns true
@@ -3228,7 +3204,9 @@
3228
3204
  value.indexOf(" ") === -1));
3229
3205
  }
3230
3206
  function getZeroUnit(potentialUnitType) {
3231
- return getValueAsType(0, findDimensionValueType(potentialUnitType));
3207
+ return typeof potentialUnitType === "number"
3208
+ ? 0
3209
+ : getAnimatableNone("", potentialUnitType);
3232
3210
  }
3233
3211
  function getValueTransition(transition, key) {
3234
3212
  return transition[key] || transition["default"] || transition;
@@ -3646,6 +3624,30 @@
3646
3624
  return new MotionValue(init);
3647
3625
  }
3648
3626
 
3627
+ /**
3628
+ * Tests a provided value against a ValueType
3629
+ */
3630
+ var testValueType = function (v) { return function (type) { return type.test(v); }; };
3631
+
3632
+ /**
3633
+ * ValueType for "auto"
3634
+ */
3635
+ var auto = {
3636
+ test: function (v) { return v === "auto"; },
3637
+ parse: function (v) { return v; },
3638
+ };
3639
+
3640
+ /**
3641
+ * A list of value types commonly used for dimensions
3642
+ */
3643
+ var dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
3644
+ /**
3645
+ * Tests a dimensional value against the list of dimension ValueTypes
3646
+ */
3647
+ var findDimensionValueType = function (v) {
3648
+ return dimensionValueTypes.find(testValueType(v));
3649
+ };
3650
+
3649
3651
  /**
3650
3652
  * A list of all ValueTypes
3651
3653
  */