motion-v 0.12.0-beta.2 → 0.12.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
|
@@ -5518,27 +5518,39 @@ function handlePressEvent(state2, event, lifecycle) {
|
|
|
5518
5518
|
}
|
|
5519
5519
|
class PressGesture extends Feature {
|
|
5520
5520
|
isActive() {
|
|
5521
|
-
return Boolean(this.state.options.
|
|
5521
|
+
return Boolean(this.state.options.whilePress);
|
|
5522
5522
|
}
|
|
5523
5523
|
constructor(state2) {
|
|
5524
5524
|
super(state2);
|
|
5525
5525
|
}
|
|
5526
5526
|
mount() {
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
(
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5527
|
+
this.register();
|
|
5528
|
+
}
|
|
5529
|
+
update() {
|
|
5530
|
+
const preProps = this.state.visualElement.prevProps;
|
|
5531
|
+
if (preProps.whilePress !== this.state.options.whilePress) {
|
|
5532
|
+
this.register();
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
register() {
|
|
5536
|
+
this.unmount();
|
|
5537
|
+
if (this.isActive()) {
|
|
5538
|
+
const element = this.state.element;
|
|
5539
|
+
if (!element)
|
|
5540
|
+
return;
|
|
5541
|
+
this.unmount = press(
|
|
5542
|
+
element,
|
|
5543
|
+
(el, startEvent) => {
|
|
5544
|
+
handlePressEvent(this.state, startEvent, "Start");
|
|
5545
|
+
return (endEvent, { success }) => handlePressEvent(
|
|
5546
|
+
this.state,
|
|
5547
|
+
endEvent,
|
|
5548
|
+
success ? "End" : "Cancel"
|
|
5549
|
+
);
|
|
5550
|
+
},
|
|
5551
|
+
{ useGlobalTarget: this.state.options.globalPressTarget }
|
|
5552
|
+
);
|
|
5553
|
+
}
|
|
5542
5554
|
}
|
|
5543
5555
|
}
|
|
5544
5556
|
function handleHoverEvent(state2, entry, lifecycle) {
|
|
@@ -8481,7 +8493,7 @@ class MotionState {
|
|
|
8481
8493
|
if (isAnimate) {
|
|
8482
8494
|
this.animateUpdates({
|
|
8483
8495
|
isFallback: !isActive && name !== "exit" && this.visualElement.isControllingVariants,
|
|
8484
|
-
isExit: this.activeStates.exit
|
|
8496
|
+
isExit: name === "exit" && this.activeStates.exit
|
|
8485
8497
|
});
|
|
8486
8498
|
}
|
|
8487
8499
|
}
|