motion-v 0.12.0-beta.1 → 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) {
|
|
@@ -8173,7 +8185,7 @@ function animateUpdates({
|
|
|
8173
8185
|
else
|
|
8174
8186
|
animationOptions = resolveStateAnimation.call(this, controlActiveState);
|
|
8175
8187
|
const factories = createAnimationFactories.call(this, prevTarget, animationOptions, controlDelay);
|
|
8176
|
-
const { getChildAnimations, childAnimations } = setupChildAnimations.call(this,
|
|
8188
|
+
const { getChildAnimations, childAnimations } = setupChildAnimations.call(this, animationOptions, this.activeStates, isFallback);
|
|
8177
8189
|
return executeAnimations.call(this, {
|
|
8178
8190
|
factories,
|
|
8179
8191
|
getChildAnimations,
|
|
@@ -8237,7 +8249,7 @@ function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
|
8237
8249
|
{ [key]: keyValue },
|
|
8238
8250
|
{
|
|
8239
8251
|
...animationOptions,
|
|
8240
|
-
delay: (((_a2 = animationOptions[key]) == null ? void 0 : _a2.delay) || (animationOptions == null ? void 0 : animationOptions.delay) || 0) + controlDelay
|
|
8252
|
+
delay: (((_a2 = animationOptions == null ? void 0 : animationOptions[key]) == null ? void 0 : _a2.delay) || (animationOptions == null ? void 0 : animationOptions.delay) || 0) + controlDelay
|
|
8241
8253
|
}
|
|
8242
8254
|
);
|
|
8243
8255
|
});
|
|
@@ -8397,7 +8409,10 @@ class MotionState {
|
|
|
8397
8409
|
this.updateOptions();
|
|
8398
8410
|
this.featureManager.mount();
|
|
8399
8411
|
if (!notAnimate && this.options.animate) {
|
|
8400
|
-
this.
|
|
8412
|
+
if (this.visualElement.type === "svg") {
|
|
8413
|
+
this.visualElement.updateDimensions();
|
|
8414
|
+
}
|
|
8415
|
+
this.startAnimation();
|
|
8401
8416
|
}
|
|
8402
8417
|
if (this.options.layoutId) {
|
|
8403
8418
|
mountedLayoutIds.add(this.options.layoutId);
|
|
@@ -8478,7 +8493,7 @@ class MotionState {
|
|
|
8478
8493
|
if (isAnimate) {
|
|
8479
8494
|
this.animateUpdates({
|
|
8480
8495
|
isFallback: !isActive && name !== "exit" && this.visualElement.isControllingVariants,
|
|
8481
|
-
isExit: this.activeStates.exit
|
|
8496
|
+
isExit: name === "exit" && this.activeStates.exit
|
|
8482
8497
|
});
|
|
8483
8498
|
}
|
|
8484
8499
|
}
|
|
@@ -23,27 +23,39 @@ function handlePressEvent(state, event, lifecycle) {
|
|
|
23
23
|
}
|
|
24
24
|
class PressGesture extends Feature {
|
|
25
25
|
isActive() {
|
|
26
|
-
return Boolean(this.state.options.
|
|
26
|
+
return Boolean(this.state.options.whilePress);
|
|
27
27
|
}
|
|
28
28
|
constructor(state) {
|
|
29
29
|
super(state);
|
|
30
30
|
}
|
|
31
31
|
mount() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
this.register();
|
|
33
|
+
}
|
|
34
|
+
update() {
|
|
35
|
+
const preProps = this.state.visualElement.prevProps;
|
|
36
|
+
if (preProps.whilePress !== this.state.options.whilePress) {
|
|
37
|
+
this.register();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
register() {
|
|
41
|
+
this.unmount();
|
|
42
|
+
if (this.isActive()) {
|
|
43
|
+
const element = this.state.element;
|
|
44
|
+
if (!element)
|
|
45
|
+
return;
|
|
46
|
+
this.unmount = press(
|
|
47
|
+
element,
|
|
48
|
+
(el, startEvent) => {
|
|
49
|
+
handlePressEvent(this.state, startEvent, "Start");
|
|
50
|
+
return (endEvent, { success }) => handlePressEvent(
|
|
51
|
+
this.state,
|
|
52
|
+
endEvent,
|
|
53
|
+
success ? "End" : "Cancel"
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
{ useGlobalTarget: this.state.options.globalPressTarget }
|
|
57
|
+
);
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
60
|
}
|
|
49
61
|
export {
|
|
@@ -25,7 +25,7 @@ function animateUpdates({
|
|
|
25
25
|
else
|
|
26
26
|
animationOptions = resolveStateAnimation.call(this, controlActiveState);
|
|
27
27
|
const factories = createAnimationFactories.call(this, prevTarget, animationOptions, controlDelay);
|
|
28
|
-
const { getChildAnimations, childAnimations } = setupChildAnimations.call(this,
|
|
28
|
+
const { getChildAnimations, childAnimations } = setupChildAnimations.call(this, animationOptions, this.activeStates, isFallback);
|
|
29
29
|
return executeAnimations.call(this, {
|
|
30
30
|
factories,
|
|
31
31
|
getChildAnimations,
|
|
@@ -89,7 +89,7 @@ function createAnimationFactories(prevTarget, animationOptions, controlDelay) {
|
|
|
89
89
|
{ [key]: keyValue },
|
|
90
90
|
{
|
|
91
91
|
...animationOptions,
|
|
92
|
-
delay: (((_a2 = animationOptions[key]) == null ? void 0 : _a2.delay) || (animationOptions == null ? void 0 : animationOptions.delay) || 0) + controlDelay
|
|
92
|
+
delay: (((_a2 = animationOptions == null ? void 0 : animationOptions[key]) == null ? void 0 : _a2.delay) || (animationOptions == null ? void 0 : animationOptions.delay) || 0) + controlDelay
|
|
93
93
|
}
|
|
94
94
|
);
|
|
95
95
|
});
|
|
@@ -112,7 +112,10 @@ class MotionState {
|
|
|
112
112
|
this.updateOptions();
|
|
113
113
|
this.featureManager.mount();
|
|
114
114
|
if (!notAnimate && this.options.animate) {
|
|
115
|
-
this.
|
|
115
|
+
if (this.visualElement.type === "svg") {
|
|
116
|
+
this.visualElement.updateDimensions();
|
|
117
|
+
}
|
|
118
|
+
this.startAnimation();
|
|
116
119
|
}
|
|
117
120
|
if (this.options.layoutId) {
|
|
118
121
|
mountedLayoutIds.add(this.options.layoutId);
|
|
@@ -193,7 +196,7 @@ class MotionState {
|
|
|
193
196
|
if (isAnimate) {
|
|
194
197
|
this.animateUpdates({
|
|
195
198
|
isFallback: !isActive && name !== "exit" && this.visualElement.isControllingVariants,
|
|
196
|
-
isExit: this.activeStates.exit
|
|
199
|
+
isExit: name === "exit" && this.activeStates.exit
|
|
197
200
|
});
|
|
198
201
|
}
|
|
199
202
|
}
|