framer-motion 8.3.0 → 8.3.2

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
@@ -1547,6 +1547,7 @@ function useTapGesture({ onTap, onTapStart, onTapCancel, whileTap, visualElement
1547
1547
  return !isDragActive();
1548
1548
  }
1549
1549
  function onPointerUp(event, info) {
1550
+ var _a, _b, _c, _d;
1550
1551
  if (!checkPointerEnd())
1551
1552
  return;
1552
1553
  /**
@@ -1554,15 +1555,17 @@ function useTapGesture({ onTap, onTapStart, onTapCancel, whileTap, visualElement
1554
1555
  * as, or a child of, this component's element
1555
1556
  */
1556
1557
  !isNodeOrChild(visualElement.current, event.target)
1557
- ? onTapCancel && onTapCancel(event, info)
1558
- : onTap && onTap(event, info);
1558
+ ? (_b = (_a = visualElement.getProps()).onTapCancel) === null || _b === void 0 ? void 0 : _b.call(_a, event, info)
1559
+ : (_d = (_c = visualElement.getProps()).onTap) === null || _d === void 0 ? void 0 : _d.call(_c, event, info);
1559
1560
  }
1560
1561
  function onPointerCancel(event, info) {
1562
+ var _a, _b;
1561
1563
  if (!checkPointerEnd())
1562
1564
  return;
1563
- onTapCancel && onTapCancel(event, info);
1565
+ (_b = (_a = visualElement.getProps()).onTapCancel) === null || _b === void 0 ? void 0 : _b.call(_a, event, info);
1564
1566
  }
1565
1567
  const startPress = React.useCallback((event, info) => {
1568
+ var _a, _b;
1566
1569
  removePointerEndListener();
1567
1570
  if (isPressing.current)
1568
1571
  return;
@@ -1573,8 +1576,8 @@ function useTapGesture({ onTap, onTapStart, onTapCancel, whileTap, visualElement
1573
1576
  */
1574
1577
  visualElement.animationState &&
1575
1578
  visualElement.animationState.setActive(exports.AnimationType.Tap, true);
1576
- onTapStart && onTapStart(event, info);
1577
- }, [onTapStart, visualElement]);
1579
+ (_b = (_a = visualElement.getProps()).onTapStart) === null || _b === void 0 ? void 0 : _b.call(_a, event, info);
1580
+ }, [Boolean(onTapStart), visualElement]);
1578
1581
  usePointerEvent(visualElement, "pointerdown", hasPressListeners ? startPress : undefined, eventOptions);
1579
1582
  useUnmountEffect(removePointerEndListener);
1580
1583
  }
@@ -2072,7 +2075,7 @@ class MotionValue {
2072
2075
  * This will be replaced by the build step with the latest version number.
2073
2076
  * When MotionValues are provided to motion components, warn if versions are mixed.
2074
2077
  */
2075
- this.version = "8.3.0";
2078
+ this.version = "8.3.2";
2076
2079
  /**
2077
2080
  * Duration, in milliseconds, since last updating frame.
2078
2081
  *
@@ -5928,7 +5931,7 @@ function updateMotionValuesFromProps(element, next, prev) {
5928
5931
  * and warn against mismatches.
5929
5932
  */
5930
5933
  if (process.env.NODE_ENV === "development") {
5931
- warnOnce(nextValue.version === "8.3.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.3.0 may not work as expected.`);
5934
+ warnOnce(nextValue.version === "8.3.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.3.2 may not work as expected.`);
5932
5935
  }
5933
5936
  }
5934
5937
  else if (isMotionValue(prevValue)) {
@@ -9208,12 +9211,13 @@ function useMotionTemplate(fragments, ...values) {
9208
9211
  for (let i = 0; i < numFragments; i++) {
9209
9212
  output += fragments[i];
9210
9213
  const value = values[i];
9211
- if (value)
9212
- output += values[i].get();
9214
+ if (value) {
9215
+ output += isMotionValue(value) ? value.get() : value;
9216
+ }
9213
9217
  }
9214
9218
  return output;
9215
9219
  }
9216
- return useCombineMotionValues(values, buildValue);
9220
+ return useCombineMotionValues(values.filter(isMotionValue), buildValue);
9217
9221
  }
9218
9222
 
9219
9223
  /**
@@ -35,6 +35,7 @@ function useTapGesture({ onTap, onTapStart, onTapCancel, whileTap, visualElement
35
35
  return !isDragActive();
36
36
  }
37
37
  function onPointerUp(event, info) {
38
+ var _a, _b, _c, _d;
38
39
  if (!checkPointerEnd())
39
40
  return;
40
41
  /**
@@ -42,15 +43,17 @@ function useTapGesture({ onTap, onTapStart, onTapCancel, whileTap, visualElement
42
43
  * as, or a child of, this component's element
43
44
  */
44
45
  !isNodeOrChild(visualElement.current, event.target)
45
- ? onTapCancel && onTapCancel(event, info)
46
- : onTap && onTap(event, info);
46
+ ? (_b = (_a = visualElement.getProps()).onTapCancel) === null || _b === void 0 ? void 0 : _b.call(_a, event, info)
47
+ : (_d = (_c = visualElement.getProps()).onTap) === null || _d === void 0 ? void 0 : _d.call(_c, event, info);
47
48
  }
48
49
  function onPointerCancel(event, info) {
50
+ var _a, _b;
49
51
  if (!checkPointerEnd())
50
52
  return;
51
- onTapCancel && onTapCancel(event, info);
53
+ (_b = (_a = visualElement.getProps()).onTapCancel) === null || _b === void 0 ? void 0 : _b.call(_a, event, info);
52
54
  }
53
55
  const startPress = useCallback((event, info) => {
56
+ var _a, _b;
54
57
  removePointerEndListener();
55
58
  if (isPressing.current)
56
59
  return;
@@ -61,8 +64,8 @@ function useTapGesture({ onTap, onTapStart, onTapCancel, whileTap, visualElement
61
64
  */
62
65
  visualElement.animationState &&
63
66
  visualElement.animationState.setActive(AnimationType.Tap, true);
64
- onTapStart && onTapStart(event, info);
65
- }, [onTapStart, visualElement]);
67
+ (_b = (_a = visualElement.getProps()).onTapStart) === null || _b === void 0 ? void 0 : _b.call(_a, event, info);
68
+ }, [Boolean(onTapStart), visualElement]);
66
69
  usePointerEvent(visualElement, "pointerdown", hasPressListeners ? startPress : undefined, eventOptions);
67
70
  useUnmountEffect(removePointerEndListener);
68
71
  }
@@ -22,7 +22,7 @@ function updateMotionValuesFromProps(element, next, prev) {
22
22
  * and warn against mismatches.
23
23
  */
24
24
  if (process.env.NODE_ENV === "development") {
25
- warnOnce(nextValue.version === "8.3.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.3.0 may not work as expected.`);
25
+ warnOnce(nextValue.version === "8.3.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.3.2 may not work as expected.`);
26
26
  }
27
27
  }
28
28
  else if (isMotionValue(prevValue)) {
@@ -25,7 +25,7 @@ class MotionValue {
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 = "8.3.0";
28
+ this.version = "8.3.2";
29
29
  /**
30
30
  * Duration, in milliseconds, since last updating frame.
31
31
  *
@@ -1,4 +1,5 @@
1
1
  import { useCombineMotionValues } from './use-combine-values.mjs';
2
+ import { isMotionValue } from './utils/is-motion-value.mjs';
2
3
 
3
4
  /**
4
5
  * Combine multiple motion values into a new one using a string template literal.
@@ -32,12 +33,13 @@ function useMotionTemplate(fragments, ...values) {
32
33
  for (let i = 0; i < numFragments; i++) {
33
34
  output += fragments[i];
34
35
  const value = values[i];
35
- if (value)
36
- output += values[i].get();
36
+ if (value) {
37
+ output += isMotionValue(value) ? value.get() : value;
38
+ }
37
39
  }
38
40
  return output;
39
41
  }
40
- return useCombineMotionValues(values, buildValue);
42
+ return useCombineMotionValues(values.filter(isMotionValue), buildValue);
41
43
  }
42
44
 
43
45
  export { useMotionTemplate };
@@ -1545,6 +1545,7 @@
1545
1545
  return !isDragActive();
1546
1546
  }
1547
1547
  function onPointerUp(event, info) {
1548
+ var _a, _b, _c, _d;
1548
1549
  if (!checkPointerEnd())
1549
1550
  return;
1550
1551
  /**
@@ -1552,15 +1553,17 @@
1552
1553
  * as, or a child of, this component's element
1553
1554
  */
1554
1555
  !isNodeOrChild(visualElement.current, event.target)
1555
- ? onTapCancel && onTapCancel(event, info)
1556
- : onTap && onTap(event, info);
1556
+ ? (_b = (_a = visualElement.getProps()).onTapCancel) === null || _b === void 0 ? void 0 : _b.call(_a, event, info)
1557
+ : (_d = (_c = visualElement.getProps()).onTap) === null || _d === void 0 ? void 0 : _d.call(_c, event, info);
1557
1558
  }
1558
1559
  function onPointerCancel(event, info) {
1560
+ var _a, _b;
1559
1561
  if (!checkPointerEnd())
1560
1562
  return;
1561
- onTapCancel && onTapCancel(event, info);
1563
+ (_b = (_a = visualElement.getProps()).onTapCancel) === null || _b === void 0 ? void 0 : _b.call(_a, event, info);
1562
1564
  }
1563
1565
  const startPress = React.useCallback((event, info) => {
1566
+ var _a, _b;
1564
1567
  removePointerEndListener();
1565
1568
  if (isPressing.current)
1566
1569
  return;
@@ -1571,8 +1574,8 @@
1571
1574
  */
1572
1575
  visualElement.animationState &&
1573
1576
  visualElement.animationState.setActive(exports.AnimationType.Tap, true);
1574
- onTapStart && onTapStart(event, info);
1575
- }, [onTapStart, visualElement]);
1577
+ (_b = (_a = visualElement.getProps()).onTapStart) === null || _b === void 0 ? void 0 : _b.call(_a, event, info);
1578
+ }, [Boolean(onTapStart), visualElement]);
1576
1579
  usePointerEvent(visualElement, "pointerdown", hasPressListeners ? startPress : undefined, eventOptions);
1577
1580
  useUnmountEffect(removePointerEndListener);
1578
1581
  }
@@ -2070,7 +2073,7 @@
2070
2073
  * This will be replaced by the build step with the latest version number.
2071
2074
  * When MotionValues are provided to motion components, warn if versions are mixed.
2072
2075
  */
2073
- this.version = "8.3.0";
2076
+ this.version = "8.3.2";
2074
2077
  /**
2075
2078
  * Duration, in milliseconds, since last updating frame.
2076
2079
  *
@@ -5941,7 +5944,7 @@
5941
5944
  * and warn against mismatches.
5942
5945
  */
5943
5946
  {
5944
- warnOnce(nextValue.version === "8.3.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.3.0 may not work as expected.`);
5947
+ warnOnce(nextValue.version === "8.3.2", `Attempting to mix Framer Motion versions ${nextValue.version} with 8.3.2 may not work as expected.`);
5945
5948
  }
5946
5949
  }
5947
5950
  else if (isMotionValue(prevValue)) {
@@ -9219,12 +9222,13 @@
9219
9222
  for (let i = 0; i < numFragments; i++) {
9220
9223
  output += fragments[i];
9221
9224
  const value = values[i];
9222
- if (value)
9223
- output += values[i].get();
9225
+ if (value) {
9226
+ output += isMotionValue(value) ? value.get() : value;
9227
+ }
9224
9228
  }
9225
9229
  return output;
9226
9230
  }
9227
- return useCombineMotionValues(values, buildValue);
9231
+ return useCombineMotionValues(values.filter(isMotionValue), buildValue);
9228
9232
  }
9229
9233
 
9230
9234
  /**