framer-motion 9.1.1 → 9.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/dist/cjs/index.js CHANGED
@@ -150,25 +150,14 @@ function isAnimationControls(v) {
150
150
  return typeof v === "object" && typeof v.start === "function";
151
151
  }
152
152
 
153
- exports.AnimationType = void 0;
154
- (function (AnimationType) {
155
- AnimationType["Animate"] = "animate";
156
- AnimationType["Hover"] = "whileHover";
157
- AnimationType["Tap"] = "whileTap";
158
- AnimationType["Drag"] = "whileDrag";
159
- AnimationType["Focus"] = "whileFocus";
160
- AnimationType["InView"] = "whileInView";
161
- AnimationType["Exit"] = "exit";
162
- })(exports.AnimationType || (exports.AnimationType = {}));
163
-
164
153
  const variantPriorityOrder$1 = [
165
- exports.AnimationType.Animate,
166
- exports.AnimationType.InView,
167
- exports.AnimationType.Focus,
168
- exports.AnimationType.Hover,
169
- exports.AnimationType.Tap,
170
- exports.AnimationType.Drag,
171
- exports.AnimationType.Exit,
154
+ "animate" /* AnimationType.Animate */,
155
+ "whileInView" /* AnimationType.InView */,
156
+ "whileFocus" /* AnimationType.Focus */,
157
+ "whileHover" /* AnimationType.Hover */,
158
+ "whileTap" /* AnimationType.Tap */,
159
+ "whileDrag" /* AnimationType.Drag */,
160
+ "exit" /* AnimationType.Exit */,
172
161
  ];
173
162
  const variantProps = ["initial", ...variantPriorityOrder$1];
174
163
 
@@ -1416,7 +1405,7 @@ function addHoverEvent(node, isActive) {
1416
1405
  return;
1417
1406
  const props = node.getProps();
1418
1407
  if (node.animationState && props.whileHover) {
1419
- node.animationState.setActive(exports.AnimationType.Hover, isActive);
1408
+ node.animationState.setActive("whileHover" /* AnimationType.Hover */, isActive);
1420
1409
  }
1421
1410
  if (props[callbackName]) {
1422
1411
  props[callbackName](event, info);
@@ -1454,13 +1443,13 @@ class FocusGesture extends Feature {
1454
1443
  }
1455
1444
  if (!isFocusVisible || !this.node.animationState)
1456
1445
  return;
1457
- this.node.animationState.setActive(exports.AnimationType.Focus, true);
1446
+ this.node.animationState.setActive("whileFocus" /* AnimationType.Focus */, true);
1458
1447
  this.isActive = true;
1459
1448
  }
1460
1449
  onBlur() {
1461
1450
  if (!this.isActive || !this.node.animationState)
1462
1451
  return;
1463
- this.node.animationState.setActive(exports.AnimationType.Focus, false);
1452
+ this.node.animationState.setActive("whileFocus" /* AnimationType.Focus */, false);
1464
1453
  this.isActive = false;
1465
1454
  }
1466
1455
  mount() {
@@ -1556,7 +1545,7 @@ class PressGesture extends Feature {
1556
1545
  * Ensure we trigger animations before firing event callback
1557
1546
  */
1558
1547
  if (whileTap && this.node.animationState) {
1559
- this.node.animationState.setActive(exports.AnimationType.Tap, true);
1548
+ this.node.animationState.setActive("whileTap" /* AnimationType.Tap */, true);
1560
1549
  }
1561
1550
  onTapStart && onTapStart(event, info);
1562
1551
  }
@@ -1565,7 +1554,7 @@ class PressGesture extends Feature {
1565
1554
  this.isPressing = false;
1566
1555
  const props = this.node.getProps();
1567
1556
  if (props.whileTap && this.node.animationState) {
1568
- this.node.animationState.setActive(exports.AnimationType.Tap, false);
1557
+ this.node.animationState.setActive("whileTap" /* AnimationType.Tap */, false);
1569
1558
  }
1570
1559
  return !isDragActive();
1571
1560
  }
@@ -1660,7 +1649,7 @@ class InViewFeature extends Feature {
1660
1649
  const { onViewportEnter } = this.node.getProps();
1661
1650
  onViewportEnter && onViewportEnter(null);
1662
1651
  if (this.node.animationState) {
1663
- this.node.animationState.setActive(exports.AnimationType.InView, true);
1652
+ this.node.animationState.setActive("whileInView" /* AnimationType.InView */, true);
1664
1653
  }
1665
1654
  });
1666
1655
  }
@@ -1697,7 +1686,7 @@ class InViewFeature extends Feature {
1697
1686
  this.hasEnteredView = true;
1698
1687
  }
1699
1688
  if (this.node.animationState) {
1700
- this.node.animationState.setActive(exports.AnimationType.InView, isIntersecting);
1689
+ this.node.animationState.setActive("whileInView" /* AnimationType.InView */, isIntersecting);
1701
1690
  }
1702
1691
  /**
1703
1692
  * Use the latest committed props rather than the ones in scope
@@ -2011,7 +2000,7 @@ class MotionValue {
2011
2000
  * This will be replaced by the build step with the latest version number.
2012
2001
  * When MotionValues are provided to motion components, warn if versions are mixed.
2013
2002
  */
2014
- this.version = "9.1.1";
2003
+ this.version = "9.1.3";
2015
2004
  /**
2016
2005
  * Duration, in milliseconds, since last updating frame.
2017
2006
  *
@@ -4191,13 +4180,13 @@ function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
4191
4180
  }
4192
4181
 
4193
4182
  const variantPriorityOrder = [
4194
- exports.AnimationType.Animate,
4195
- exports.AnimationType.InView,
4196
- exports.AnimationType.Focus,
4197
- exports.AnimationType.Hover,
4198
- exports.AnimationType.Tap,
4199
- exports.AnimationType.Drag,
4200
- exports.AnimationType.Exit,
4183
+ "animate" /* AnimationType.Animate */,
4184
+ "whileInView" /* AnimationType.InView */,
4185
+ "whileFocus" /* AnimationType.Focus */,
4186
+ "whileHover" /* AnimationType.Hover */,
4187
+ "whileTap" /* AnimationType.Tap */,
4188
+ "whileDrag" /* AnimationType.Drag */,
4189
+ "exit" /* AnimationType.Exit */,
4201
4190
  ];
4202
4191
  const reversePriorityOrder = [...variantPriorityOrder].reverse();
4203
4192
  const numAnimationTypes = variantPriorityOrder.length;
@@ -4499,13 +4488,13 @@ function createTypeState(isActive = false) {
4499
4488
  }
4500
4489
  function createState() {
4501
4490
  return {
4502
- [exports.AnimationType.Animate]: createTypeState(true),
4503
- [exports.AnimationType.InView]: createTypeState(),
4504
- [exports.AnimationType.Hover]: createTypeState(),
4505
- [exports.AnimationType.Tap]: createTypeState(),
4506
- [exports.AnimationType.Drag]: createTypeState(),
4507
- [exports.AnimationType.Focus]: createTypeState(),
4508
- [exports.AnimationType.Exit]: createTypeState(),
4491
+ ["animate" /* AnimationType.Animate */]: createTypeState(true),
4492
+ ["whileInView" /* AnimationType.InView */]: createTypeState(),
4493
+ ["whileHover" /* AnimationType.Hover */]: createTypeState(),
4494
+ ["whileTap" /* AnimationType.Tap */]: createTypeState(),
4495
+ ["whileDrag" /* AnimationType.Drag */]: createTypeState(),
4496
+ ["whileFocus" /* AnimationType.Focus */]: createTypeState(),
4497
+ ["exit" /* AnimationType.Exit */]: createTypeState(),
4509
4498
  };
4510
4499
  }
4511
4500
 
@@ -4556,7 +4545,7 @@ class ExitAnimationFeature extends Feature {
4556
4545
  if (!this.node.animationState || isPresent === prevIsPresent) {
4557
4546
  return;
4558
4547
  }
4559
- const exitAnimation = this.node.animationState.setActive(exports.AnimationType.Exit, !isPresent, { custom: custom !== null && custom !== void 0 ? custom : this.node.getProps().custom });
4548
+ const exitAnimation = this.node.animationState.setActive("exit" /* AnimationType.Exit */, !isPresent, { custom: custom !== null && custom !== void 0 ? custom : this.node.getProps().custom });
4560
4549
  if (onExitComplete && !isPresent) {
4561
4550
  exitAnimation.then(() => onExitComplete(this.id));
4562
4551
  }
@@ -5170,7 +5159,7 @@ class VisualElementDragControls {
5170
5159
  // Fire onDragStart event
5171
5160
  onDragStart && onDragStart(event, info);
5172
5161
  const { animationState } = this.visualElement;
5173
- animationState && animationState.setActive(exports.AnimationType.Drag, true);
5162
+ animationState && animationState.setActive("whileDrag" /* AnimationType.Drag */, true);
5174
5163
  };
5175
5164
  const onMove = (event, info) => {
5176
5165
  // latestPointerEvent = event
@@ -5235,7 +5224,7 @@ class VisualElementDragControls {
5235
5224
  this.openGlobalLock();
5236
5225
  this.openGlobalLock = null;
5237
5226
  }
5238
- animationState && animationState.setActive(exports.AnimationType.Drag, false);
5227
+ animationState && animationState.setActive("whileDrag" /* AnimationType.Drag */, false);
5239
5228
  }
5240
5229
  updateAxis(axis, _point, offset) {
5241
5230
  const { drag } = this.getProps();
@@ -5955,6 +5944,12 @@ class FlatTree {
5955
5944
  }
5956
5945
  }
5957
5946
 
5947
+ function record(data) {
5948
+ if (window.MotionDebug) {
5949
+ window.MotionDebug.record(data);
5950
+ }
5951
+ }
5952
+
5958
5953
  const transformAxes = ["", "X", "Y", "Z"];
5959
5954
  /**
5960
5955
  * We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1
@@ -5962,6 +5957,16 @@ const transformAxes = ["", "X", "Y", "Z"];
5962
5957
  */
5963
5958
  const animationTarget = 1000;
5964
5959
  let id$1 = 0;
5960
+ /**
5961
+ * Use a mutable data object for debug data so as to not create a new
5962
+ * object every frame.
5963
+ */
5964
+ const projectionFrameData = {
5965
+ type: "projectionFrame",
5966
+ totalNodes: 0,
5967
+ resolvedTargetDeltas: 0,
5968
+ recalculatedProjection: 0,
5969
+ };
5965
5970
  function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {
5966
5971
  return class ProjectionNode {
5967
5972
  constructor(elementId, latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
@@ -5999,12 +6004,21 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
5999
6004
  * and if one node is dirtied, they all are.
6000
6005
  */
6001
6006
  this.isLayoutDirty = false;
6002
- this.isTransformDirty = false;
6003
6007
  /**
6004
- * Flag to true if we think the projection calculations for this or any
6005
- * child might need recalculating as a result of an updated transform or layout animation.
6008
+ * Flag to true if we think the projection calculations for this node needs
6009
+ * recalculating as a result of an updated transform or layout animation.
6006
6010
  */
6007
6011
  this.isProjectionDirty = false;
6012
+ /**
6013
+ * Flag to true if the layout *or* transform has changed. This then gets propagated
6014
+ * throughout the projection tree, forcing any element below to recalculate on the next frame.
6015
+ */
6016
+ this.isSharedProjectionDirty = false;
6017
+ /**
6018
+ * Flag transform dirty. This gets propagated throughout the whole tree but is only
6019
+ * respected by shared nodes.
6020
+ */
6021
+ this.isTransformDirty = false;
6008
6022
  /**
6009
6023
  * Block layout updates for instant layout transitions throughout the tree.
6010
6024
  */
@@ -6055,9 +6069,19 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6055
6069
  * the next step.
6056
6070
  */
6057
6071
  this.updateProjection = () => {
6072
+ /**
6073
+ * Reset debug counts. Manually resetting rather than creating a new
6074
+ * object each frame.
6075
+ */
6076
+ projectionFrameData.totalNodes =
6077
+ projectionFrameData.resolvedTargetDeltas =
6078
+ projectionFrameData.recalculatedProjection =
6079
+ 0;
6058
6080
  this.nodes.forEach(propagateDirtyNodes);
6059
6081
  this.nodes.forEach(resolveTargetDelta);
6060
6082
  this.nodes.forEach(calcProjection);
6083
+ this.nodes.forEach(cleanDirtyNodes);
6084
+ record(projectionFrameData);
6061
6085
  };
6062
6086
  this.hasProjected = false;
6063
6087
  this.isVisible = true;
@@ -6513,13 +6537,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6513
6537
  }
6514
6538
  return boxWithoutTransform;
6515
6539
  }
6516
- /**
6517
- *
6518
- */
6519
6540
  setTargetDelta(delta) {
6520
6541
  this.targetDelta = delta;
6521
- this.isProjectionDirty = true;
6522
6542
  this.root.scheduleUpdateProjection();
6543
+ this.isProjectionDirty = true;
6523
6544
  }
6524
6545
  setOptions(options) {
6525
6546
  this.options = {
@@ -6541,6 +6562,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6541
6562
  * Frame calculations
6542
6563
  */
6543
6564
  resolveTargetDelta() {
6565
+ var _a;
6544
6566
  /**
6545
6567
  * Once the dirty status of nodes has been spread through the tree, we also
6546
6568
  * need to check if we have a shared node of a different depth that has itself
@@ -6549,11 +6571,17 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6549
6571
  const lead = this.getLead();
6550
6572
  this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
6551
6573
  this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
6574
+ this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
6575
+ const isShared = Boolean(this.resumingFrom) || this !== lead;
6552
6576
  /**
6553
6577
  * We don't use transform for this step of processing so we don't
6554
6578
  * need to check whether any nodes have changed transform.
6555
6579
  */
6556
- if (!this.isProjectionDirty && !this.attemptToResolveRelativeTarget)
6580
+ const canSkip = !((isShared && this.isSharedProjectionDirty) ||
6581
+ this.isProjectionDirty ||
6582
+ ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
6583
+ this.attemptToResolveRelativeTarget);
6584
+ if (canSkip)
6557
6585
  return;
6558
6586
  const { layout, layoutId } = this.options;
6559
6587
  /**
@@ -6643,6 +6671,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6643
6671
  this.relativeParent = this.relativeTarget = undefined;
6644
6672
  }
6645
6673
  }
6674
+ /**
6675
+ * Increase debug counter for resolved target deltas
6676
+ */
6677
+ projectionFrameData.resolvedTargetDeltas++;
6646
6678
  }
6647
6679
  getClosestProjectingParent() {
6648
6680
  if (!this.parent ||
@@ -6650,26 +6682,39 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6650
6682
  has2DTranslate(this.parent.latestValues)) {
6651
6683
  return undefined;
6652
6684
  }
6653
- if ((this.parent.relativeTarget ||
6654
- this.parent.targetDelta ||
6655
- this.parent.options.layoutRoot) &&
6656
- this.parent.layout) {
6685
+ if (this.parent.isProjecting()) {
6657
6686
  return this.parent;
6658
6687
  }
6659
6688
  else {
6660
6689
  return this.parent.getClosestProjectingParent();
6661
6690
  }
6662
6691
  }
6692
+ isProjecting() {
6693
+ return Boolean((this.relativeTarget ||
6694
+ this.targetDelta ||
6695
+ this.options.layoutRoot) &&
6696
+ this.layout);
6697
+ }
6663
6698
  calcProjection() {
6664
- const { isProjectionDirty, isTransformDirty } = this;
6665
- this.isProjectionDirty = this.isTransformDirty = false;
6699
+ var _a;
6666
6700
  const lead = this.getLead();
6667
6701
  const isShared = Boolean(this.resumingFrom) || this !== lead;
6668
6702
  let canSkip = true;
6669
- if (isProjectionDirty)
6703
+ /**
6704
+ * If this is a normal layout animation and neither this node nor its nearest projecting
6705
+ * is dirty then we can't skip.
6706
+ */
6707
+ if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) {
6670
6708
  canSkip = false;
6671
- if (isShared && isTransformDirty)
6709
+ }
6710
+ /**
6711
+ * If this is a shared layout animation and this node's shared projection is dirty then
6712
+ * we can't skip.
6713
+ */
6714
+ if (isShared &&
6715
+ (this.isSharedProjectionDirty || this.isTransformDirty)) {
6672
6716
  canSkip = false;
6717
+ }
6673
6718
  if (canSkip)
6674
6719
  return;
6675
6720
  const { layout, layoutId } = this.options;
@@ -6723,6 +6768,10 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6723
6768
  this.scheduleRender();
6724
6769
  this.notifyListeners("projectionUpdate", target);
6725
6770
  }
6771
+ /**
6772
+ * Increase debug counter for recalculated projections
6773
+ */
6774
+ projectionFrameData.recalculatedProjection++;
6726
6775
  }
6727
6776
  hide() {
6728
6777
  this.isVisible = false;
@@ -6765,6 +6814,7 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6765
6814
  this.options.crossfade === true &&
6766
6815
  !this.path.some(hasOpacityCrossfade));
6767
6816
  this.animationProgress = 0;
6817
+ let prevRelativeTarget;
6768
6818
  this.mixTargetDelta = (latest) => {
6769
6819
  const progress = latest / 1000;
6770
6820
  mixAxisDelta(targetDelta.x, delta.x, progress);
@@ -6777,6 +6827,17 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
6777
6827
  this.relativeParent.layout) {
6778
6828
  calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox);
6779
6829
  mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress);
6830
+ /**
6831
+ * If this is an unchanged relative target we can consider the
6832
+ * projection not dirty.
6833
+ */
6834
+ if (prevRelativeTarget &&
6835
+ boxEquals(this.relativeTarget, prevRelativeTarget)) {
6836
+ this.isProjectionDirty = false;
6837
+ }
6838
+ if (!prevRelativeTarget)
6839
+ prevRelativeTarget = createBox();
6840
+ copyBoxInto(prevRelativeTarget, this.relativeTarget);
6780
6841
  }
6781
6842
  if (isSharedLayoutAnimation) {
6782
6843
  this.animationValues = mixedValues;
@@ -7190,14 +7251,35 @@ function notifyLayoutUpdate(node) {
7190
7251
  }
7191
7252
  function propagateDirtyNodes(node) {
7192
7253
  /**
7193
- * Propagate isProjectionDirty. Nodes are ordered by depth, so if the parent here
7194
- * is dirty we can simply pass this forward.
7254
+ * Increase debug counter for nodes encountered this frame
7195
7255
  */
7196
- node.isProjectionDirty || (node.isProjectionDirty = Boolean(node.parent && node.parent.isProjectionDirty));
7256
+ projectionFrameData.totalNodes++;
7257
+ if (!node.parent)
7258
+ return;
7259
+ /**
7260
+ * If this node isn't projecting, propagate isProjectionDirty. It will have
7261
+ * no performance impact but it will allow the next child that *is* projecting
7262
+ * but *isn't* dirty to just check its parent to see if *any* ancestor needs
7263
+ * correcting.
7264
+ */
7265
+ if (!node.isProjecting()) {
7266
+ node.isProjectionDirty = node.parent.isProjectionDirty;
7267
+ }
7197
7268
  /**
7198
- * Propagate isTransformDirty.
7269
+ * Propagate isSharedProjectionDirty and isTransformDirty
7270
+ * throughout the whole tree. A future revision can take another look at
7271
+ * this but for safety we still recalcualte shared nodes.
7199
7272
  */
7200
- node.isTransformDirty || (node.isTransformDirty = Boolean(node.parent && node.parent.isTransformDirty));
7273
+ node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty ||
7274
+ node.parent.isProjectionDirty ||
7275
+ node.parent.isSharedProjectionDirty));
7276
+ node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty);
7277
+ }
7278
+ function cleanDirtyNodes(node) {
7279
+ node.isProjectionDirty =
7280
+ node.isSharedProjectionDirty =
7281
+ node.isTransformDirty =
7282
+ false;
7201
7283
  }
7202
7284
  function clearSnapshot(node) {
7203
7285
  node.clearSnapshot();
@@ -7521,15 +7603,6 @@ const hasPositionalKey = (target) => {
7521
7603
  return Object.keys(target).some(isPositionalKey);
7522
7604
  };
7523
7605
  const isNumOrPxType = (v) => v === number || v === px;
7524
- var BoundingBoxDimension;
7525
- (function (BoundingBoxDimension) {
7526
- BoundingBoxDimension["width"] = "width";
7527
- BoundingBoxDimension["height"] = "height";
7528
- BoundingBoxDimension["left"] = "left";
7529
- BoundingBoxDimension["right"] = "right";
7530
- BoundingBoxDimension["top"] = "top";
7531
- BoundingBoxDimension["bottom"] = "bottom";
7532
- })(BoundingBoxDimension || (BoundingBoxDimension = {}));
7533
7606
  const getPosFromMatrix = (matrix, pos) => parseFloat(matrix.split(", ")[pos]);
7534
7607
  const getTranslateFromMatrix = (pos2, pos3) => (_bbox, { transform }) => {
7535
7608
  if (transform === "none" || !transform)
@@ -7784,7 +7857,7 @@ function updateMotionValuesFromProps(element, next, prev) {
7784
7857
  * and warn against mismatches.
7785
7858
  */
7786
7859
  if (process.env.NODE_ENV === "development") {
7787
- warnOnce(nextValue.version === "9.1.1", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.1.1 may not work as expected.`);
7860
+ warnOnce(nextValue.version === "9.1.3", `Attempting to mix Framer Motion versions ${nextValue.version} with 9.1.3 may not work as expected.`);
7788
7861
  }
7789
7862
  }
7790
7863
  else if (isMotionValue(prevValue)) {
@@ -9299,6 +9372,17 @@ const Reorder = {
9299
9372
  Item,
9300
9373
  };
9301
9374
 
9375
+ exports.AnimationType = void 0;
9376
+ (function (AnimationType) {
9377
+ AnimationType["Animate"] = "animate";
9378
+ AnimationType["Hover"] = "whileHover";
9379
+ AnimationType["Tap"] = "whileTap";
9380
+ AnimationType["Drag"] = "whileDrag";
9381
+ AnimationType["Focus"] = "whileFocus";
9382
+ AnimationType["InView"] = "whileInView";
9383
+ AnimationType["Exit"] = "exit";
9384
+ })(exports.AnimationType || (exports.AnimationType = {}));
9385
+
9302
9386
  /**
9303
9387
  * @public
9304
9388
  */
@@ -0,0 +1,7 @@
1
+ function record(data) {
2
+ if (window.MotionDebug) {
3
+ window.MotionDebug.record(data);
4
+ }
5
+ }
6
+
7
+ export { record };
@@ -4,7 +4,6 @@ import { getGlobalLock } from './utils/lock.mjs';
4
4
  import { isRefObject } from '../../utils/is-ref-object.mjs';
5
5
  import { addPointerEvent } from '../../events/add-pointer-event.mjs';
6
6
  import { applyConstraints, calcRelativeConstraints, resolveDragElastic, calcViewportConstraints, defaultElastic, rebaseAxisConstraints, calcOrigin } from './utils/constraints.mjs';
7
- import { AnimationType } from '../../render/utils/types.mjs';
8
7
  import { createBox } from '../../projection/geometry/models.mjs';
9
8
  import { eachAxis } from '../../projection/utils/each-axis.mjs';
10
9
  import { measurePageBox } from '../../projection/utils/measure.mjs';
@@ -97,7 +96,7 @@ class VisualElementDragControls {
97
96
  // Fire onDragStart event
98
97
  onDragStart && onDragStart(event, info);
99
98
  const { animationState } = this.visualElement;
100
- animationState && animationState.setActive(AnimationType.Drag, true);
99
+ animationState && animationState.setActive("whileDrag" /* AnimationType.Drag */, true);
101
100
  };
102
101
  const onMove = (event, info) => {
103
102
  // latestPointerEvent = event
@@ -162,7 +161,7 @@ class VisualElementDragControls {
162
161
  this.openGlobalLock();
163
162
  this.openGlobalLock = null;
164
163
  }
165
- animationState && animationState.setActive(AnimationType.Drag, false);
164
+ animationState && animationState.setActive("whileDrag" /* AnimationType.Drag */, false);
166
165
  }
167
166
  updateAxis(axis, _point, offset) {
168
167
  const { drag } = this.getProps();
@@ -1,6 +1,5 @@
1
1
  import { addDomEvent } from '../events/add-dom-event.mjs';
2
2
  import { Feature } from '../motion/features/Feature.mjs';
3
- import { AnimationType } from '../render/utils/types.mjs';
4
3
  import { pipe } from '../utils/pipe.mjs';
5
4
 
6
5
  class FocusGesture extends Feature {
@@ -24,13 +23,13 @@ class FocusGesture extends Feature {
24
23
  }
25
24
  if (!isFocusVisible || !this.node.animationState)
26
25
  return;
27
- this.node.animationState.setActive(AnimationType.Focus, true);
26
+ this.node.animationState.setActive("whileFocus" /* AnimationType.Focus */, true);
28
27
  this.isActive = true;
29
28
  }
30
29
  onBlur() {
31
30
  if (!this.isActive || !this.node.animationState)
32
31
  return;
33
- this.node.animationState.setActive(AnimationType.Focus, false);
32
+ this.node.animationState.setActive("whileFocus" /* AnimationType.Focus */, false);
34
33
  this.isActive = false;
35
34
  }
36
35
  mount() {
@@ -1,5 +1,4 @@
1
1
  import { addPointerEvent } from '../events/add-pointer-event.mjs';
2
- import { AnimationType } from '../render/utils/types.mjs';
3
2
  import { pipe } from '../utils/pipe.mjs';
4
3
  import { isDragActive } from './drag/utils/lock.mjs';
5
4
  import { Feature } from '../motion/features/Feature.mjs';
@@ -12,7 +11,7 @@ function addHoverEvent(node, isActive) {
12
11
  return;
13
12
  const props = node.getProps();
14
13
  if (node.animationState && props.whileHover) {
15
- node.animationState.setActive(AnimationType.Hover, isActive);
14
+ node.animationState.setActive("whileHover" /* AnimationType.Hover */, isActive);
16
15
  }
17
16
  if (props[callbackName]) {
18
17
  props[callbackName](event, info);
@@ -2,7 +2,6 @@ import { extractEventInfo } from '../events/event-info.mjs';
2
2
  import { addDomEvent } from '../events/add-dom-event.mjs';
3
3
  import { addPointerEvent } from '../events/add-pointer-event.mjs';
4
4
  import { Feature } from '../motion/features/Feature.mjs';
5
- import { AnimationType } from '../render/utils/types.mjs';
6
5
  import { pipe } from '../utils/pipe.mjs';
7
6
  import { isDragActive } from './drag/utils/lock.mjs';
8
7
  import { isNodeOrChild } from './utils/is-node-or-child.mjs';
@@ -74,7 +73,7 @@ class PressGesture extends Feature {
74
73
  * Ensure we trigger animations before firing event callback
75
74
  */
76
75
  if (whileTap && this.node.animationState) {
77
- this.node.animationState.setActive(AnimationType.Tap, true);
76
+ this.node.animationState.setActive("whileTap" /* AnimationType.Tap */, true);
78
77
  }
79
78
  onTapStart && onTapStart(event, info);
80
79
  }
@@ -83,7 +82,7 @@ class PressGesture extends Feature {
83
82
  this.isPressing = false;
84
83
  const props = this.node.getProps();
85
84
  if (props.whileTap && this.node.animationState) {
86
- this.node.animationState.setActive(AnimationType.Tap, false);
85
+ this.node.animationState.setActive("whileTap" /* AnimationType.Tap */, false);
87
86
  }
88
87
  return !isDragActive();
89
88
  }
@@ -1,4 +1,3 @@
1
- import { AnimationType } from '../../../render/utils/types.mjs';
2
1
  import { Feature } from '../Feature.mjs';
3
2
 
4
3
  let id = 0;
@@ -15,7 +14,7 @@ class ExitAnimationFeature extends Feature {
15
14
  if (!this.node.animationState || isPresent === prevIsPresent) {
16
15
  return;
17
16
  }
18
- const exitAnimation = this.node.animationState.setActive(AnimationType.Exit, !isPresent, { custom: custom !== null && custom !== void 0 ? custom : this.node.getProps().custom });
17
+ const exitAnimation = this.node.animationState.setActive("exit" /* AnimationType.Exit */, !isPresent, { custom: custom !== null && custom !== void 0 ? custom : this.node.getProps().custom });
19
18
  if (onExitComplete && !isPresent) {
20
19
  exitAnimation.then(() => onExitComplete(this.id));
21
20
  }
@@ -1,4 +1,3 @@
1
- import { AnimationType } from '../../../render/utils/types.mjs';
2
1
  import { Feature } from '../Feature.mjs';
3
2
  import { observeIntersection } from './observers.mjs';
4
3
 
@@ -26,7 +25,7 @@ class InViewFeature extends Feature {
26
25
  const { onViewportEnter } = this.node.getProps();
27
26
  onViewportEnter && onViewportEnter(null);
28
27
  if (this.node.animationState) {
29
- this.node.animationState.setActive(AnimationType.InView, true);
28
+ this.node.animationState.setActive("whileInView" /* AnimationType.InView */, true);
30
29
  }
31
30
  });
32
31
  }
@@ -63,7 +62,7 @@ class InViewFeature extends Feature {
63
62
  this.hasEnteredView = true;
64
63
  }
65
64
  if (this.node.animationState) {
66
- this.node.animationState.setActive(AnimationType.InView, isIntersecting);
65
+ this.node.animationState.setActive("whileInView" /* AnimationType.InView */, isIntersecting);
67
66
  }
68
67
  /**
69
68
  * Use the latest committed props rather than the ones in scope