motion-v 1.0.0 → 1.0.1
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
|
@@ -8467,8 +8467,9 @@ class MotionState {
|
|
|
8467
8467
|
this.target = {};
|
|
8468
8468
|
}
|
|
8469
8469
|
// Update visual element with new options
|
|
8470
|
-
updateOptions() {
|
|
8470
|
+
updateOptions(options) {
|
|
8471
8471
|
var _a;
|
|
8472
|
+
this.options = options;
|
|
8472
8473
|
(_a = this.visualElement) == null ? void 0 : _a.update({
|
|
8473
8474
|
...this.options,
|
|
8474
8475
|
whileTap: this.options.whilePress,
|
|
@@ -8489,8 +8490,7 @@ class MotionState {
|
|
|
8489
8490
|
"Animation state must be mounted with valid Element"
|
|
8490
8491
|
);
|
|
8491
8492
|
this.element = element;
|
|
8492
|
-
this.options
|
|
8493
|
-
this.updateOptions();
|
|
8493
|
+
this.updateOptions(options);
|
|
8494
8494
|
this.featureManager.mount();
|
|
8495
8495
|
if (!notAnimate && this.options.animate) {
|
|
8496
8496
|
if (this.type === "svg") {
|
|
@@ -8539,12 +8539,9 @@ class MotionState {
|
|
|
8539
8539
|
mountedStates.delete(this.element);
|
|
8540
8540
|
this.featureManager.unmount();
|
|
8541
8541
|
(_c = this.visualElement) == null ? void 0 : _c.unmount();
|
|
8542
|
+
this.clearAnimation();
|
|
8542
8543
|
};
|
|
8543
|
-
|
|
8544
|
-
Promise.resolve().then(unmountState);
|
|
8545
|
-
} else {
|
|
8546
|
-
unmountState();
|
|
8547
|
-
}
|
|
8544
|
+
shouldDelay ? Promise.resolve().then(unmountState) : unmountState();
|
|
8548
8545
|
};
|
|
8549
8546
|
unmount();
|
|
8550
8547
|
}
|
|
@@ -8558,8 +8555,7 @@ class MotionState {
|
|
|
8558
8555
|
// Update motion state with new options
|
|
8559
8556
|
update(options) {
|
|
8560
8557
|
const hasAnimateChange = isAnimateChanged(this.options, options);
|
|
8561
|
-
this.options
|
|
8562
|
-
this.updateOptions();
|
|
8558
|
+
this.updateOptions(options);
|
|
8563
8559
|
this.featureManager.update();
|
|
8564
8560
|
if (hasAnimateChange) {
|
|
8565
8561
|
this.startAnimation();
|
|
@@ -40,7 +40,7 @@ export declare class MotionState {
|
|
|
40
40
|
private _context;
|
|
41
41
|
get context(): MotionStateContext;
|
|
42
42
|
private initTarget;
|
|
43
|
-
updateOptions(): void;
|
|
43
|
+
updateOptions(options: Options): void;
|
|
44
44
|
beforeMount(): void;
|
|
45
45
|
mount(element: HTMLElement, options: Options, notAnimate?: boolean): void;
|
|
46
46
|
clearAnimation(): void;
|
|
@@ -58,8 +58,9 @@ class MotionState {
|
|
|
58
58
|
this.target = {};
|
|
59
59
|
}
|
|
60
60
|
// Update visual element with new options
|
|
61
|
-
updateOptions() {
|
|
61
|
+
updateOptions(options) {
|
|
62
62
|
var _a;
|
|
63
|
+
this.options = options;
|
|
63
64
|
(_a = this.visualElement) == null ? void 0 : _a.update({
|
|
64
65
|
...this.options,
|
|
65
66
|
whileTap: this.options.whilePress,
|
|
@@ -80,8 +81,7 @@ class MotionState {
|
|
|
80
81
|
"Animation state must be mounted with valid Element"
|
|
81
82
|
);
|
|
82
83
|
this.element = element;
|
|
83
|
-
this.options
|
|
84
|
-
this.updateOptions();
|
|
84
|
+
this.updateOptions(options);
|
|
85
85
|
this.featureManager.mount();
|
|
86
86
|
if (!notAnimate && this.options.animate) {
|
|
87
87
|
if (this.type === "svg") {
|
|
@@ -130,12 +130,9 @@ class MotionState {
|
|
|
130
130
|
mountedStates.delete(this.element);
|
|
131
131
|
this.featureManager.unmount();
|
|
132
132
|
(_c = this.visualElement) == null ? void 0 : _c.unmount();
|
|
133
|
+
this.clearAnimation();
|
|
133
134
|
};
|
|
134
|
-
|
|
135
|
-
Promise.resolve().then(unmountState);
|
|
136
|
-
} else {
|
|
137
|
-
unmountState();
|
|
138
|
-
}
|
|
135
|
+
shouldDelay ? Promise.resolve().then(unmountState) : unmountState();
|
|
139
136
|
};
|
|
140
137
|
unmount();
|
|
141
138
|
}
|
|
@@ -149,8 +146,7 @@ class MotionState {
|
|
|
149
146
|
// Update motion state with new options
|
|
150
147
|
update(options) {
|
|
151
148
|
const hasAnimateChange = isAnimateChanged(this.options, options);
|
|
152
|
-
this.options
|
|
153
|
-
this.updateOptions();
|
|
149
|
+
this.updateOptions(options);
|
|
154
150
|
this.featureManager.update();
|
|
155
151
|
if (hasAnimateChange) {
|
|
156
152
|
this.startAnimation();
|