motion-v 1.0.0 → 1.0.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
@@ -6733,7 +6733,6 @@ class AnimationFeature extends Feature {
6733
6733
  const prevTarget = this.state.target;
6734
6734
  this.state.target = { ...this.state.baseTarget };
6735
6735
  let animationOptions = {};
6736
- const transition = { ...this.state.options.transition };
6737
6736
  animationOptions = this.resolveStateAnimation({
6738
6737
  controlActiveState,
6739
6738
  directAnimate,
@@ -6745,7 +6744,7 @@ class AnimationFeature extends Feature {
6745
6744
  factories,
6746
6745
  getChildAnimations,
6747
6746
  childAnimations,
6748
- transition,
6747
+ transition: animationOptions,
6749
6748
  controlActiveState,
6750
6749
  isExit
6751
6750
  });
@@ -8467,8 +8466,9 @@ class MotionState {
8467
8466
  this.target = {};
8468
8467
  }
8469
8468
  // Update visual element with new options
8470
- updateOptions() {
8469
+ updateOptions(options) {
8471
8470
  var _a;
8471
+ this.options = options;
8472
8472
  (_a = this.visualElement) == null ? void 0 : _a.update({
8473
8473
  ...this.options,
8474
8474
  whileTap: this.options.whilePress,
@@ -8489,8 +8489,7 @@ class MotionState {
8489
8489
  "Animation state must be mounted with valid Element"
8490
8490
  );
8491
8491
  this.element = element;
8492
- this.options = options;
8493
- this.updateOptions();
8492
+ this.updateOptions(options);
8494
8493
  this.featureManager.mount();
8495
8494
  if (!notAnimate && this.options.animate) {
8496
8495
  if (this.type === "svg") {
@@ -8539,12 +8538,9 @@ class MotionState {
8539
8538
  mountedStates.delete(this.element);
8540
8539
  this.featureManager.unmount();
8541
8540
  (_c = this.visualElement) == null ? void 0 : _c.unmount();
8541
+ this.clearAnimation();
8542
8542
  };
8543
- if (shouldDelay) {
8544
- Promise.resolve().then(unmountState);
8545
- } else {
8546
- unmountState();
8547
- }
8543
+ shouldDelay ? Promise.resolve().then(unmountState) : unmountState();
8548
8544
  };
8549
8545
  unmount();
8550
8546
  }
@@ -8558,8 +8554,7 @@ class MotionState {
8558
8554
  // Update motion state with new options
8559
8555
  update(options) {
8560
8556
  const hasAnimateChange = isAnimateChanged(this.options, options);
8561
- this.options = options;
8562
- this.updateOptions();
8557
+ this.updateOptions(options);
8563
8558
  this.featureManager.update();
8564
8559
  if (hasAnimateChange) {
8565
8560
  this.startAnimation();
@@ -27,7 +27,6 @@ class AnimationFeature extends Feature {
27
27
  const prevTarget = this.state.target;
28
28
  this.state.target = { ...this.state.baseTarget };
29
29
  let animationOptions = {};
30
- const transition = { ...this.state.options.transition };
31
30
  animationOptions = this.resolveStateAnimation({
32
31
  controlActiveState,
33
32
  directAnimate,
@@ -39,7 +38,7 @@ class AnimationFeature extends Feature {
39
38
  factories,
40
39
  getChildAnimations,
41
40
  childAnimations,
42
- transition,
41
+ transition: animationOptions,
43
42
  controlActiveState,
44
43
  isExit
45
44
  });
@@ -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 = 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
- if (shouldDelay) {
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 = options;
153
- this.updateOptions();
149
+ this.updateOptions(options);
154
150
  this.featureManager.update();
155
151
  if (hasAnimateChange) {
156
152
  this.startAnimation();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-v",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",