motion-v 0.8.0 → 0.9.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.
@@ -68,6 +68,9 @@ class MotionState {
68
68
  // Initialize animation target values
69
69
  initTarget(initialVariantSource) {
70
70
  this.baseTarget = resolveVariant(this.options[initialVariantSource] || this.context[initialVariantSource], this.options.variants) || {};
71
+ for (const key in this.baseTarget) {
72
+ this.visualElement.setStaticValue(key, this.baseTarget[key]);
73
+ }
71
74
  this.target = {};
72
75
  }
73
76
  // Get initial animation state
@@ -104,15 +107,6 @@ class MotionState {
104
107
  }
105
108
  this.visualElement.state = this;
106
109
  this.updateOptions();
107
- if (typeof this.initial === "object") {
108
- for (const key in this.initial) {
109
- this.visualElement.setStaticValue(key, this.initial[key]);
110
- }
111
- } else if (typeof this.initial === "string" && this.options.variants) {
112
- for (const key in this.options.variants[this.initial]) {
113
- this.visualElement.setStaticValue(key, this.options.variants[this.initial][key]);
114
- }
115
- }
116
110
  this.featureManager.mount();
117
111
  if (!notAnimate && this.options.animate) {
118
112
  this.animateUpdates();
@@ -184,7 +178,8 @@ class MotionState {
184
178
  }
185
179
  willUpdate(label) {
186
180
  var _a;
187
- (_a = this.visualElement.projection) == null ? void 0 : _a.willUpdate();
181
+ if (this.options.layout || this.options.layoutId)
182
+ (_a = this.visualElement.projection) == null ? void 0 : _a.willUpdate();
188
183
  }
189
184
  }
190
185
  export {
@@ -1,3 +1,3 @@
1
1
  import { Ref } from 'vue';
2
2
  import { Options } from '../types/state';
3
- export declare function useInView<T extends Element = any>(domRef: Ref<T>, options?: Options['inViewOptions'] | Ref<Options['inViewOptions']>): Ref<boolean>;
3
+ export declare function useInView<T extends Element = any>(domRef: Ref<T | null>, options?: Options['inViewOptions'] | Ref<Options['inViewOptions']>): Ref<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-v",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -68,6 +68,7 @@
68
68
  "@vue/test-utils": "^2.4.5",
69
69
  "happy-dom": "^16.0.1",
70
70
  "jsdom": "^24.0.0",
71
+ "rimraf": "^6.0.1",
71
72
  "vite": "^5.4.8",
72
73
  "vite-plugin-dts": "^4.2.4",
73
74
  "vitest": "^1.4.0",
@@ -75,7 +76,7 @@
75
76
  },
76
77
  "scripts": {
77
78
  "dev": "vite build --watch",
78
- "build": "rm -rf dist && vite build",
79
+ "build": "rimraf dist && vite build",
79
80
  "test": "vitest --dom",
80
81
  "coverage": "vitest run --coverage",
81
82
  "pub:release": "pnpm publish --access public"