@juleshry/vue-animejs 1.0.0 → 1.1.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/README.md CHANGED
@@ -2,9 +2,15 @@
2
2
  <img src="./docs/src/public/icon-animated.svg" alt="vue-animejs" width="120" />
3
3
 
4
4
  <h1 align="center">vue-animejs</h1>
5
- <p align="center">Vue 3 composables for <a href="https://animejs.com/">Anime.js</a> v4 — reactive animations that integrate naturally with Vue's reactivity system and component lifecycle.</p>
6
- <p align="center"><a href="https://vue-animejs.juleshry.dev">📖 Documentation</a></p>
7
- <p align="center"><a href="https://app.netlify.com/projects/vue-animejs/deploys"><img src="https://api.netlify.com/api/v1/badges/8017f5b4-47b7-45e4-a5d6-269d638a71ab/deploy-status" alt="Netlify Status" style="vertical-align: middle" /></a>&nbsp;&nbsp;<a href="https://ko-fi.com/C7O720SP29"><img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="ko-fi" style="vertical-align: middle" /></a></p>
5
+ <p align="center">Vue 3 composables and directives for <a href="https://animejs.com/">Anime.js</a> v4 — reactive animations that integrate naturally with Vue's reactivity system and component lifecycle.</p>
6
+ <p align="center">
7
+ <a href="https://www.npmjs.com/package/@juleshry/vue-animejs"><img src="https://img.shields.io/npm/v/%40juleshry%2Fvue-animejs?label=npm&color=a1b858" alt="npm version" /></a>
8
+ <a href="https://www.npmjs.com/package/@juleshry/vue-animejs"><img src="https://img.shields.io/npm/dm/%40juleshry%2Fvue-animejs?color=50a36f" alt="npm downloads" /></a>
9
+ <a href="https://vue-animejs.juleshry.dev"><img src="https://img.shields.io/badge/docs%20%26%20demos-vue--animejs-4fc08d" alt="docs & demos" /></a>
10
+ <a href="https://github.com/juleshry/vue-animejs"><img src="https://img.shields.io/github/stars/juleshry/vue-animejs?style=flat&color=yellow" alt="GitHub stars" /></a>
11
+ </p>
12
+ <p align="center"><a href="https://app.netlify.com/projects/vue-animejs/deploys"><img src="https://api.netlify.com/api/v1/badges/8017f5b4-47b7-45e4-a5d6-269d638a71ab/deploy-status" alt="Netlify Status" /></a></p>
13
+ <p align="center"><a href="https://ko-fi.com/C7O720SP29"><img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="ko-fi" /></a></p>
8
14
  </div>
9
15
 
10
16
  ## 🚀 Overview
@@ -63,7 +69,7 @@ useAnimate(el, { translateX: 250, duration: 800 })
63
69
  - Anime.js 4+
64
70
  - @vueuse/core 14+
65
71
 
66
- ## 🦄 Composables
72
+ ## 🦄 Composables & Directives
67
73
 
68
74
  | Composable | Description |
69
75
  |------------------|---------------------------------------------------|
@@ -80,306 +86,15 @@ useAnimate(el, { translateX: 250, duration: 800 })
80
86
  | `useSvgDrawable` | Animate SVG stroke drawing with the `draw` property |
81
87
  | `useText` | Split text into animatable lines, words, and chars |
82
88
 
83
- ## 🚀 Usage
84
-
85
- ### `useAnimate`
86
-
87
- ```vue
88
- <script setup lang="ts">
89
- import { useTemplateRef } from 'vue'
90
- import { useAnimate } from '@juleshry/vue-animejs'
91
-
92
- const el = useTemplateRef<HTMLElement>('el')
93
-
94
- const { play, pause } = useAnimate(el, {
95
- translateX: 250,
96
- duration: 800,
97
- easing: 'easeInOutQuad',
98
- })
99
- </script>
100
-
101
- <template>
102
- <div ref="el" />
103
- <button @click="play">Play</button>
104
- <button @click="pause">Pause</button>
105
- </template>
106
- ```
107
-
108
- ### `useTimer`
109
-
110
- ```vue
111
- <script setup lang="ts">
112
- import { useTimer } from '@juleshry/vue-animejs'
113
-
114
- const { play, pause } = useTimer({
115
- duration: 3000,
116
- onUpdate: (self) => console.log(self.currentTime),
117
- })
118
- </script>
119
- ```
120
-
121
- ### `useTimeline`
122
-
123
- ```vue
124
- <script setup lang="ts">
125
- import { useTemplateRef } from 'vue'
126
- import { useTimeline } from '@juleshry/vue-animejs'
127
-
128
- const box = useTemplateRef<HTMLElement>('box')
129
-
130
- const { add, play } = useTimeline({ loop: true })
131
-
132
- add(box, { translateX: 100 })
133
- add(box, { translateY: 50 }, '+=200')
134
- play()
135
- </script>
136
- ```
137
-
138
- ### `useRawAnimate`
139
-
140
- ```vue
141
- <script setup lang="ts">
142
- import { useTemplateRef } from 'vue'
143
- import { useRawAnimate } from '@juleshry/vue-animejs'
144
-
145
- const el = useTemplateRef<HTMLElement>('el')
146
-
147
- // Returns the raw Anime.js JSAnimation instance directly
148
- const animation = useRawAnimate(el, { translateX: 250, duration: 800 })
149
- </script>
150
-
151
- <template>
152
- <div ref="el" />
153
- </template>
154
- ```
155
-
156
- ### `useAnimatable`
157
-
158
- ```vue
159
- <script setup lang="ts">
160
- import { useTemplateRef } from 'vue'
161
- import { useAnimatable } from '@juleshry/vue-animejs'
162
-
163
- const el = useTemplateRef<HTMLElement>('el')
164
-
165
- const { animatable } = useAnimatable(el, {
166
- x: 0,
167
- opacity: 1,
168
- })
169
- </script>
170
- ```
171
-
172
- ### `useWaapi`
173
-
174
- ```vue
175
- <script setup lang="ts">
176
- import { useTemplateRef } from 'vue'
177
- import { useWaapi } from '@juleshry/vue-animejs'
178
-
179
- const el = useTemplateRef<HTMLElement>('el')
180
-
181
- const { play, pause } = useWaapi(el, {
182
- translateX: 250,
183
- duration: 800,
184
- easing: 'easeInOutQuad',
185
- })
186
- </script>
187
-
188
- <template>
189
- <div ref="el" />
190
- <button @click="play">Play</button>
191
- <button @click="pause">Pause</button>
192
- </template>
193
- ```
194
-
195
- ### `useSvg`
196
-
197
- > **Note:** `morphTo` requires a live DOM element. Add each target as a hidden `<path>`, pass the ref directly to `morphTo`, and wrap in a `computed` — `useTimeline.add()` accepts `MaybeRef<AnimationParams>` and resolves the computed after mount, when the target elements are available.
198
-
199
- ```vue
200
- <script setup lang="ts">
201
- import { computed, useTemplateRef } from 'vue'
202
- import { useSvg, useTimeline } from '@juleshry/vue-animejs'
203
-
204
- const shape = useTemplateRef<SVGPathElement>('shape')
205
- const t_circle = useTemplateRef<SVGPathElement>('t-circle')
206
- const t_diamond = useTemplateRef<SVGPathElement>('t-diamond')
207
-
208
- const { morphTo } = useSvg()
209
-
210
- const { add } = useTimeline({
211
- loop: true,
212
- defaults: { duration: 1200, easing: 'easeInOutCubic' },
213
- loopDelay: 500,
214
- })
215
-
216
- add(shape, computed(() => ({ d: morphTo(t_circle) })))
217
- .add(shape, computed(() => ({ d: morphTo(t_diamond) })), '+=500')
218
- </script>
219
-
220
- <template>
221
- <svg viewBox="0 0 100 100">
222
- <path ref="shape" d="M 50 15 C 78 8, 95 28, 90 52 C 85 76, 68 90, 50 88 C 32 90, 15 76, 10 52 C 5 28, 22 8, 50 15 Z" />
223
- <path ref="t-circle" d="M 50 10 C 72 10, 90 28, 90 50 C 90 72, 72 90, 50 90 C 28 90, 10 72, 10 50 C 10 28, 28 10, 50 10 Z" visibility="hidden" />
224
- <path ref="t-diamond" d="M 50 5 C 54 32, 68 32, 95 50 C 68 68, 54 68, 50 95 C 46 68, 32 68, 5 50 C 32 32, 46 32, 50 5 Z" visibility="hidden" />
225
- </svg>
226
- </template>
227
- ```
228
-
229
- ### `useSvgDrawable`
230
-
231
- ```vue
232
- <script setup lang="ts">
233
- import { useTemplateRef } from 'vue'
234
- import { useAnimate, useSvgDrawable } from '@juleshry/vue-animejs'
235
-
236
- const circle_el = useTemplateRef<SVGCircleElement>('circle')
237
-
238
- const { drawable } = useSvgDrawable(circle_el)
239
-
240
- // draw values are normalised: 0 = hidden, 1 = fully drawn
241
- useAnimate(drawable, {
242
- draw: ['0 0', '0.5 1', '0 1'],
243
- duration: 1200,
244
- easing: 'easeInOutQuad',
245
- })
246
- </script>
247
-
248
- <template>
249
- <svg viewBox="0 0 100 100">
250
- <circle ref="circle" cx="50" cy="50" r="40" fill="none" stroke="currentColor" stroke-width="4" />
251
- </svg>
252
- </template>
253
- ```
254
-
255
- ### `useDraggable`
256
-
257
- ```vue
258
- <script setup lang="ts">
259
- import { useTemplateRef } from 'vue'
260
- import { useDraggable } from '@juleshry/vue-animejs'
89
+ **Directives** declarative alternatives for element-bound animations:
261
90
 
262
- const el = useTemplateRef<HTMLElement>('el')
263
-
264
- const { disable, enable } = useDraggable(el, {
265
- onGrab: () => console.log('grabbed'),
266
- onDrag: () => console.log('dragging'),
267
- onRelease: () => console.log('released'),
268
- })
269
- </script>
270
-
271
- <template>
272
- <div ref="el" />
273
- <button @click="disable">Disable</button>
274
- <button @click="enable">Enable</button>
275
- </template>
276
- ```
277
-
278
- ### `useLayout`
279
-
280
- > **Note:** Vue's DOM updates are asynchronous. Use `await nextTick()` between the state change and `animate()` so Anime.js reads the updated positions.
281
-
282
- ```vue
283
- <script setup lang="ts">
284
- import { nextTick, ref, useTemplateRef } from 'vue'
285
- import { useLayout } from '@juleshry/vue-animejs'
286
-
287
- const list = useTemplateRef<HTMLElement>('list')
288
- const { record, animate } = useLayout(list, {})
289
-
290
- const items = ref([1, 2, 3, 4, 5])
291
-
292
- async function shuffle() {
293
- record()
294
- items.value = [...items.value].sort(() => Math.random() - 0.5)
295
- await nextTick()
296
- animate({ duration: 600 })
297
- }
298
- </script>
299
-
300
- <template>
301
- <ul ref="list">
302
- <li v-for="item in items" :key="item">{{ item }}</li>
303
- </ul>
304
- <button @click="shuffle">Shuffle</button>
305
- </template>
306
- ```
91
+ | Directive | Description |
92
+ |--------------|--------------------------------------------------|
93
+ | `v-animate` | Animate an element declaratively via template attribute |
307
94
 
308
- When you mutate the DOM directly with `classList.toggle`, the change is synchronous — no `nextTick` needed:
309
-
310
- ```vue
311
- <script setup lang="ts">
312
- import { useTemplateRef } from 'vue'
313
- import { useLayout } from '@juleshry/vue-animejs'
314
-
315
- const container = useTemplateRef<HTMLElement>('container')
316
- const { update } = useLayout(container, {})
317
-
318
- function toggleLayout() {
319
- update(() => {
320
- container.value!.classList.toggle('grid')
321
- }, { duration: 600 })
322
- }
323
- </script>
324
-
325
- <template>
326
- <div ref="container" class="grid">
327
- <div v-for="i in 6" :key="i" class="item" />
328
- </div>
329
- <button @click="toggleLayout">Toggle layout</button>
330
- </template>
331
- ```
332
-
333
- ### `useScope`
334
-
335
- ```vue
336
- <script setup lang="ts">
337
- import { useTemplateRef } from 'vue'
338
- import { useAnimate, useScope } from '@juleshry/vue-animejs'
339
-
340
- const el = useTemplateRef<HTMLElement>('el')
341
-
342
- const { add, revert } = useScope({ mediaQuery: '(prefers-reduced-motion: no-preference)' })
343
-
344
- // Animations added via add() are automatically reverted when the scope reverts
345
- // or when the component unmounts
346
- add(scope => {
347
- useAnimate(el, { translateX: 250, duration: 800 })
348
- })
349
- </script>
350
-
351
- <template>
352
- <div ref="el" />
353
- <button @click="revert">Revert</button>
354
- </template>
355
- ```
356
-
357
- ### `useText`
358
-
359
- > **Note:** `words`, `chars`, and `lines` are `ComputedRef<HTMLElement[]>` — they populate after mount and can be passed directly to `useAnimate`.
360
-
361
- ```vue
362
- <script setup lang="ts">
363
- import { useTemplateRef } from 'vue'
364
- import { useAnimate, useText } from '@juleshry/vue-animejs'
365
- import { stagger } from 'animejs'
366
-
367
- const el = useTemplateRef<HTMLElement>('el')
368
-
369
- const { words, chars } = useText(el, { words: true, chars: true })
370
-
371
- // words and chars are ComputedRef<HTMLElement[]> — pass them directly as targets
372
- useAnimate(words, {
373
- y: ['100%', '0%'],
374
- duration: 600,
375
- delay: stagger(50),
376
- })
377
- </script>
95
+ ## 🚀 Usage
378
96
 
379
- <template>
380
- <p ref="el">Hello, world!</p>
381
- </template>
382
- ```
97
+ For full API docs and live demos, see **[the doc here](https://vue-animejs.juleshry.dev)**.
383
98
 
384
99
  ## 👨‍🚀 Contributors
385
100
 
@@ -399,9 +114,7 @@ See the [Contributing Guide](./CONTRIBUTING.md).
399
114
  ## 🗺️ TODO
400
115
 
401
116
  - [ ] Allow reactive refs inside option objects
402
- - [ ] Finish doc website
403
117
  - [ ] Add components
404
- - [ ] Add directives
405
118
 
406
119
  ## 📄 License
407
120
 
@@ -1,8 +1,8 @@
1
1
  import { type Scope, type ScopeMethod, type ScopeParams, type Tickable } from "animejs";
2
- import { type DeepReadonly, type MaybeRef, type ShallowRef } from "vue";
2
+ import { type MaybeRef, type ShallowRef } from "vue";
3
3
  export interface UseScopeReturn {
4
4
  /** The underlying Anime.js `Scope` instance. */
5
- scope: DeepReadonly<ShallowRef<Scope>>;
5
+ scope: Readonly<ShallowRef<Scope | undefined>>;
6
6
  /** Registers an anonymous method on the scope. Queued automatically if called before mount. */
7
7
  add: (method: ScopeMethod) => void;
8
8
  /** Registers a named method on the scope so it can be called via `scope.methods[name]()`. Queued automatically if called before mount. */
@@ -1 +1 @@
1
- {"version":3,"file":"use-scope.d.ts","sourceRoot":"","sources":["../../src/composables/use-scope.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AACpG,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,QAAQ,EAEb,KAAK,UAAU,EAIhB,MAAM,KAAK,CAAA;AAEZ,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,KAAK,EAAE,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;IACtC,+FAA+F;IAC/F,GAAG,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IAClC,0IAA0I;IAC1I,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACjE,2GAA2G;IAC3G,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACtC,qFAAqF;IACrF,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,QAAQ,KAAK,IAAI,CAAA;IACtD,0EAA0E;IAC1E,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,yEAAyE;IACzE,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,cAAc,CAyEtE"}
1
+ {"version":3,"file":"use-scope.d.ts","sourceRoot":"","sources":["../../src/composables/use-scope.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AACpG,OAAO,EAAS,KAAK,QAAQ,EAAmB,KAAK,UAAU,EAA4B,MAAM,KAAK,CAAA;AAEtG,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAA;IAC9C,+FAA+F;IAC/F,GAAG,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IAClC,0IAA0I;IAC1I,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACjE,2GAA2G;IAC3G,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACtC,qFAAqF;IACrF,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,QAAQ,KAAK,IAAI,CAAA;IACtD,0EAA0E;IAC1E,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,yEAAyE;IACzE,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,cAAc,CA2EtE"}
@@ -0,0 +1,12 @@
1
+ import { type AnimationParams } from "animejs";
2
+ import type { Directive } from "vue";
3
+ /**
4
+ * Declarative animation directive. Applies an Anime.js animation to the element on mount,
5
+ * re-creates it when the binding value changes, and reverts it on unmount.
6
+ *
7
+ * @example
8
+ * <div v-animate="{ translateX: 250, duration: 800 }" />
9
+ * <div v-animate="reactiveOptions" />
10
+ */
11
+ export declare const vAnimate: Directive<HTMLElement, AnimationParams>;
12
+ //# sourceMappingURL=v-animate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v-animate.d.ts","sourceRoot":"","sources":["../../src/directives/v-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,eAAe,EAAoB,MAAM,SAAS,CAAA;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAIpC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAAC,WAAW,EAAE,eAAe,CAkB5D,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { type DraggableParams } from "animejs";
2
+ import type { Directive } from "vue";
3
+ /**
4
+ * Declarative draggable directive. Makes the element draggable on mount,
5
+ * re-creates it when the binding value changes, and reverts it on unmount.
6
+ *
7
+ * @example
8
+ * <div v-draggable />
9
+ * <div v-draggable="{ snap: [0, 100] }" />
10
+ */
11
+ export declare const vDraggable: Directive<HTMLElement, DraggableParams | undefined>;
12
+ //# sourceMappingURL=v-draggable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v-draggable.d.ts","sourceRoot":"","sources":["../../src/directives/v-draggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAIpC;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,CAAC,WAAW,EAAE,eAAe,GAAG,SAAS,CAa1E,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { type AnimationParams } from "animejs";
2
+ import type { Directive } from "vue";
3
+ /**
4
+ * Declarative SVG drawable directive. Wraps the SVG geometry element in an Anime.js drawable
5
+ * Proxy and animates the `draw` property on mount. Re-creates it when the binding value changes
6
+ * and reverts on unmount.
7
+ *
8
+ * @example
9
+ * <path v-svg-drawable="{ draw: '0 1', duration: 1200 }" />
10
+ * <path v-svg-drawable="{ draw: ['0 0', '0.5 1', '0 1'], ease: 'inOutQuad', loop: true }" />
11
+ */
12
+ export declare const vSvgDrawable: Directive<SVGGeometryElement, AnimationParams | undefined>;
13
+ //# sourceMappingURL=v-svg-drawable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v-svg-drawable.d.ts","sourceRoot":"","sources":["../../src/directives/v-svg-drawable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,eAAe,EAA8C,MAAM,SAAS,CAAA;AACxG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAepC;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,CAAC,kBAAkB,EAAE,eAAe,GAAG,SAAS,CAiBnF,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { type AnimationParams, type TextSplitterParams } from "animejs";
2
+ import type { Directive } from "vue";
3
+ export interface VTextSplitValue extends TextSplitterParams {
4
+ animation?: AnimationParams;
5
+ }
6
+ /**
7
+ * Declarative text-split directive. Splits the element's text into chars, words, or lines on
8
+ * mount, and optionally animates the resulting spans. Re-creates on binding change, reverts on unmount.
9
+ *
10
+ * @example
11
+ * <p v-text-split="{ words: true, animation: { translateY: [20, 0], opacity: [0, 1], delay: stagger(60) } }">Hello</p>
12
+ * <p v-text-split="{ chars: true, animation: { opacity: [0, 1], delay: stagger(30) } }">Hello</p>
13
+ * <p v-text-split="{ lines: true, animation: { translateX: [-20, 0], delay: stagger(100) } }">Hello</p>
14
+ */
15
+ export declare const vTextSplit: Directive<HTMLElement, VTextSplitValue | undefined>;
16
+ //# sourceMappingURL=v-text-split.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v-text-split.d.ts","sourceRoot":"","sources":["../../src/directives/v-text-split.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EAGpB,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,SAAS,CAAC,EAAE,eAAe,CAAA;CAC5B;AAoCD;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,CAAC,WAAW,EAAE,eAAe,GAAG,SAAS,CAe1E,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { type WAAPIAnimationParams } from "animejs";
2
+ import type { Directive } from "vue";
3
+ /**
4
+ * Declarative WAAPI animation directive. Applies an Anime.js WAAPI animation to the element on
5
+ * mount, re-creates it when the binding value changes, and reverts it on unmount.
6
+ *
7
+ * @example
8
+ * <div v-waapi="{ translateX: 250, duration: 800 }" />
9
+ * <div v-waapi="reactiveOptions" />
10
+ */
11
+ export declare const vWaapi: Directive<HTMLElement, WAAPIAnimationParams>;
12
+ //# sourceMappingURL=v-waapi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v-waapi.d.ts","sourceRoot":"","sources":["../../src/directives/v-waapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,oBAAoB,EAAuB,MAAM,SAAS,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AASpC;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,EAAE,SAAS,CAAC,WAAW,EAAE,oBAAoB,CAiC/D,CAAA"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`vue`),t=require(`animejs`),n=require(`@vueuse/core`);function r(e){return(0,n.unrefElement)(e)}function i(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,t])=>{c(e,t)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{s(),g()});function c(e,n){if(_(),!e){console.warn(`Target element is null or undefined`),o.value=void 0;return}o.value=(0,t.animate)(e,n)}function l(){return o.value?.play()}function u(){return o.value?.reverse()}function d(){return o.value?.pause()}function f(){return o.value?.restart()}function p(){return o.value?.alternate()}function m(){return o.value?.resume()}function h(){return o.value?.complete()}function g(){return o.value?.cancel()}function _(){return o.value?.revert()}function v(e){return o.value?.reset(e)}function y(e,t,n){return o.value?.seek(e,t,n)}function b(e){return o.value?.stretch(e)}function x(){return o.value?.refresh()}return{animation:(0,e.readonly)(o),play:l,reverse:u,pause:d,restart:f,alternate:p,resume:m,complete:h,cancel:g,revert:_,reset:v,seek:y,stretch:b,refresh:x}}function a(n,i={}){let a=r(n);return a||console.warn(`Target is undefined`),(0,t.animate)(a,(0,e.unref)(i))}function o(r={}){let i=(0,e.shallowRef)((0,t.createTimer)((0,e.unref)(r))),{stop:a}=(0,e.watch)(()=>(0,e.unref)(r),e=>{m(),i.value=(0,t.createTimer)(e)},{deep:1});(0,n.tryOnUnmounted)(()=>{a(),m()});function o(){return i.value.play()}function s(){return i.value.reverse()}function c(){return i.value.pause()}function l(){return i.value.restart()}function u(){return i.value.alternate()}function d(){return i.value.resume()}function f(){return i.value.complete()}function p(e){return i.value.reset(e)}function m(){return i.value.cancel()}function h(){return i.value.revert()}function g(e,t,n){return i.value.seek(e,t,n)}function _(e){return i.value.stretch(e)}return{timer:(0,e.readonly)(i),play:o,reverse:s,pause:c,restart:l,alternate:u,resume:d,complete:f,reset:p,cancel:m,revert:h,seek:g,stretch:_}}function s(i={}){let a=!1,o=[],s=(0,e.shallowRef)((0,t.createTimeline)((0,e.unref)(i)));function c(){for(let t of o)t.type===`add`?s.value.add(r(t.targets),(0,e.toValue)(t.params),t.position):s.value.set(r(t.targets),(0,e.toValue)(t.params),t.position)}let{stop:l}=(0,e.watch)(()=>(0,e.unref)(i),e=>{E(),s.value=(0,t.createTimeline)(e),c()},{flush:`post`,deep:1});(0,n.tryOnMounted)(()=>{a=!0,c()}),(0,n.tryOnUnmounted)(()=>{l(),T()});function u(t,n,i){return o.push({type:`add`,targets:t,params:n,position:i}),a?{...s.value.add(r(t),(0,e.toValue)(n),i),add:u,set:d,remove:f}:{...s.value,add:u,set:d,remove:f}}function d(t,n,i){return o.push({type:`set`,targets:t,params:n,position:i}),a?{...s.value.set(r(t),(0,e.toValue)(n),i),add:u,set:d,remove:f}:{...s.value,add:u,set:d,remove:f}}function f(e,t){return a?{...s.value.remove(r(e),t),add:u,set:d,remove:f}:(console.warn(`Cannot remove from timeline before mount`),{...s.value,add:u,set:d,remove:f})}function p(e,t){return s.value.sync(e,t)}function m(e,t){return s.value.label(e,t)}function h(e,t){return s.value.call(e,t)}function g(e){return s.value.init(e)}function _(){return s.value.play()}function v(){return s.value.reverse()}function y(){return s.value.pause()}function b(){return s.value.restart()}function x(){return s.value.alternate()}function S(){return s.value.resume()}function C(){return s.value.complete()}function w(e){return s.value.reset(e)}function T(){return s.value.cancel()}function E(){return s.value.revert()}function D(e,t,n){return s.value.seek(e,t,n)}function O(e){return s.value.stretch(e)}function k(){return s.value.refresh()}return{timeline:(0,e.readonly)(s),add:u,set:d,sync:p,label:m,remove:f,call:h,init:g,play:_,reverse:v,pause:y,restart:b,alternate:x,resume:S,complete:C,reset:w,cancel:T,revert:E,seek:D,stretch:O,refresh:k}}function c(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)((0,e.computed)(()=>({el:r(i),opt:(0,e.unref)(a)})),({el:e,opt:n})=>{if(c(),!e){console.warn(`Targets element is null or undefined`),o.value=void 0;return}o.value=(0,t.createAnimatable)(e,n)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{s(),c()});function c(){return o.value?.revert()}return{animatable:(0,e.readonly)(o),revert:c}}function l(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,n])=>{if(g(),!e){console.warn(`Targets element is null or undefined`),o.value=void 0;return}o.value=(0,t.createDraggable)(e,n)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{g(),s()});function c(){return o.value?.disable()}function l(){return o.value?.enable()}function u(e,t){return o.value?.setX(e,t)}function d(e,t){return o.value?.setY(e,t)}function f(e,t,n){return o.value?.animateInView(e,t,n)}function p(e,t,n){return o.value?.scrollInView(e,t,n)}function m(){return o.value?.stop()}function h(){return o.value?.reset()}function g(){return o.value?.revert()}function _(){return o.value?.refresh()}return{draggable:(0,e.readonly)(o),disable:c,enable:l,setX:u,setY:d,animateInView:f,scrollInView:p,stop:m,reset:h,revert:g,refresh:_}}function u(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,n])=>{if(d(),!e){console.warn(`Target element is null or undefined`),o.value=void 0;return}o.value=(0,t.createLayout)(e,n)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{d(),s()});function c(){return o.value?.record()}function l(e){return o.value?.animate(e)}function u(e,t){return o.value?.update(e,t)}function d(){return o.value?.revert()}return{layout:(0,e.readonly)(o),record:c,animate:l,update:u,revert:d}}function d(){function n(n,r){let i=(0,e.unref)(n);return i?t.svg.morphTo((0,e.unref)(i),(0,e.unref)(r)):()=>``}function r(n,r){let i=(0,e.unref)(n)??``;return t.svg.createMotionPath(i,(0,e.unref)(r))}return{morphTo:n,createMotionPath:r}}function f(i,a=0,o=0){let s=(0,e.shallowRef)(),{stop:c}=(0,e.watch)(()=>r(i),n=>{if(s.value=void 0,!n){console.warn(`[useSvgDrawable] Target element is null or undefined`);return}s.value=t.svg.createDrawable(n,(0,e.unref)(a),(0,e.unref)(o))[0]},{flush:`post`,immediate:!(0,e.isRef)(i)});return(0,n.tryOnUnmounted)(()=>{c(),s.value=void 0}),{drawable:(0,e.readonly)(s)}}function p(i,a){let o=(0,e.shallowRef)(),s=(0,e.computed)(()=>o.value?.lines??[]),c=(0,e.computed)(()=>o.value?.words??[]),l=(0,e.computed)(()=>o.value?.chars??[]),{stop:u}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,n])=>{d(),o.value=void 0,e&&(o.value=(0,t.splitText)(e,n))},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{u(),o.value=void 0,d()});function d(){o.value?.revert()}function f(){o.value?.refresh()}return{splitter:(0,e.readonly)(o),lines:s,words:c,chars:l,revert:d,refresh:f}}function m(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,n])=>{o.value=t.waapi.animate(e,n)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{s()});function c(){return o.value?.resume()}function l(){return o.value?.pause()}function u(){return o.value?.alternate()}function d(){return o.value?.play()}function f(){return o.value?.reverse()}function p(t,n){return o.value?.seek((0,e.unref)(t),(0,e.unref)(n))}function m(){return o.value?.restart()}function g(){return o.value?.commitStyles()}function _(){return o.value?.complete()}function v(){return o.value?.cancel()}function y(){return o.value?.revert()}return{animation:(0,e.readonly)(o),resume:c,pause:l,alternate:u,play:d,reverse:f,seek:p,restart:m,commitStyles:g,complete:_,cancel:v,revert:y,convertEase:h}}function h(n,r=100){return t.waapi.convertEase((0,e.unref)(n),(0,e.unref)(r))}function g(r){let i=(0,e.shallowRef)((0,t.createScope)((0,e.unref)(r))),a=[],o=[],s=[],c=!1,l=(0,e.isRef)(r)?(0,e.watch)(r,e=>{i.value.revert(),i.value=(0,t.createScope)(e)},{flush:`post`}):void 0;(0,n.tryOnMounted)(()=>{c=!0;for(let e of a)i.value.add(e);for(let[e,t]of o)i.value.add(e,t);for(let e of s)i.value.addOnce(e);a.length=0,o.length=0,s.length=0}),(0,n.tryOnUnmounted)(()=>{i.value.revert(),l?.()});function u(e){return c?i.value.add(e):void a.push(e)}function d(e,t){return c?i.value.add(e,t):void o.push([e,t])}function f(e){return c?i.value.addOnce(e):void s.push(e)}function p(e){return i.value.keepTime(e)}function m(){return i.value.revert()}function h(){return i.value.refresh()}return{scope:(0,e.shallowReadonly)(i),add:u,registerMethod:d,addOnce:f,keepTime:p,revert:m,refresh:h}}exports.useAnimatable=c,exports.useAnimate=i,exports.useDraggable=l,exports.useLayout=u,exports.useRawAnimate=a,exports.useScope=g,exports.useSvg=d,exports.useSvgDrawable=f,exports.useText=p,exports.useTimeline=s,exports.useTimer=o,exports.useWaapi=m;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`vue`),t=require(`animejs`),n=require(`@vueuse/core`);function r(e){return(0,n.unrefElement)(e)}function i(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,t])=>{c(e,t)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{s(),g()});function c(e,n){if(_(),!e){console.warn(`Target element is null or undefined`),o.value=void 0;return}o.value=(0,t.animate)(e,n)}function l(){return o.value?.play()}function u(){return o.value?.reverse()}function d(){return o.value?.pause()}function f(){return o.value?.restart()}function p(){return o.value?.alternate()}function m(){return o.value?.resume()}function h(){return o.value?.complete()}function g(){return o.value?.cancel()}function _(){return o.value?.revert()}function v(e){return o.value?.reset(e)}function y(e,t,n){return o.value?.seek(e,t,n)}function b(e){return o.value?.stretch(e)}function x(){return o.value?.refresh()}return{animation:(0,e.readonly)(o),play:l,reverse:u,pause:d,restart:f,alternate:p,resume:m,complete:h,cancel:g,revert:_,reset:v,seek:y,stretch:b,refresh:x}}function a(n,i={}){let a=r(n);return a||console.warn(`Target is undefined`),(0,t.animate)(a,(0,e.unref)(i))}function o(r={}){let i=(0,e.shallowRef)((0,t.createTimer)((0,e.unref)(r))),{stop:a}=(0,e.watch)(()=>(0,e.unref)(r),e=>{m(),i.value=(0,t.createTimer)(e)},{deep:1});(0,n.tryOnUnmounted)(()=>{a(),m()});function o(){return i.value.play()}function s(){return i.value.reverse()}function c(){return i.value.pause()}function l(){return i.value.restart()}function u(){return i.value.alternate()}function d(){return i.value.resume()}function f(){return i.value.complete()}function p(e){return i.value.reset(e)}function m(){return i.value.cancel()}function h(){return i.value.revert()}function g(e,t,n){return i.value.seek(e,t,n)}function _(e){return i.value.stretch(e)}return{timer:(0,e.readonly)(i),play:o,reverse:s,pause:c,restart:l,alternate:u,resume:d,complete:f,reset:p,cancel:m,revert:h,seek:g,stretch:_}}function s(i={}){let a=!1,o=[],s=(0,e.shallowRef)((0,t.createTimeline)((0,e.unref)(i)));function c(){for(let t of o)t.type===`add`?s.value.add(r(t.targets),(0,e.toValue)(t.params),t.position):s.value.set(r(t.targets),(0,e.toValue)(t.params),t.position)}let{stop:l}=(0,e.watch)(()=>(0,e.unref)(i),e=>{E(),s.value=(0,t.createTimeline)(e),c()},{flush:`post`,deep:1});(0,n.tryOnMounted)(()=>{a=!0,c()}),(0,n.tryOnUnmounted)(()=>{l(),T()});function u(t,n,i){return o.push({type:`add`,targets:t,params:n,position:i}),a?{...s.value.add(r(t),(0,e.toValue)(n),i),add:u,set:d,remove:f}:{...s.value,add:u,set:d,remove:f}}function d(t,n,i){return o.push({type:`set`,targets:t,params:n,position:i}),a?{...s.value.set(r(t),(0,e.toValue)(n),i),add:u,set:d,remove:f}:{...s.value,add:u,set:d,remove:f}}function f(e,t){return a?{...s.value.remove(r(e),t),add:u,set:d,remove:f}:(console.warn(`Cannot remove from timeline before mount`),{...s.value,add:u,set:d,remove:f})}function p(e,t){return s.value.sync(e,t)}function m(e,t){return s.value.label(e,t)}function h(e,t){return s.value.call(e,t)}function g(e){return s.value.init(e)}function _(){return s.value.play()}function v(){return s.value.reverse()}function y(){return s.value.pause()}function b(){return s.value.restart()}function x(){return s.value.alternate()}function S(){return s.value.resume()}function C(){return s.value.complete()}function w(e){return s.value.reset(e)}function T(){return s.value.cancel()}function E(){return s.value.revert()}function D(e,t,n){return s.value.seek(e,t,n)}function O(e){return s.value.stretch(e)}function k(){return s.value.refresh()}return{timeline:(0,e.readonly)(s),add:u,set:d,sync:p,label:m,remove:f,call:h,init:g,play:_,reverse:v,pause:y,restart:b,alternate:x,resume:S,complete:C,reset:w,cancel:T,revert:E,seek:D,stretch:O,refresh:k}}function c(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)((0,e.computed)(()=>({el:r(i),opt:(0,e.unref)(a)})),({el:e,opt:n})=>{if(c(),!e){console.warn(`Targets element is null or undefined`),o.value=void 0;return}o.value=(0,t.createAnimatable)(e,n)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{s(),c()});function c(){return o.value?.revert()}return{animatable:(0,e.readonly)(o),revert:c}}function l(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,n])=>{if(g(),!e){console.warn(`Targets element is null or undefined`),o.value=void 0;return}o.value=(0,t.createDraggable)(e,n)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{g(),s()});function c(){return o.value?.disable()}function l(){return o.value?.enable()}function u(e,t){return o.value?.setX(e,t)}function d(e,t){return o.value?.setY(e,t)}function f(e,t,n){return o.value?.animateInView(e,t,n)}function p(e,t,n){return o.value?.scrollInView(e,t,n)}function m(){return o.value?.stop()}function h(){return o.value?.reset()}function g(){return o.value?.revert()}function _(){return o.value?.refresh()}return{draggable:(0,e.readonly)(o),disable:c,enable:l,setX:u,setY:d,animateInView:f,scrollInView:p,stop:m,reset:h,revert:g,refresh:_}}function u(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,n])=>{if(d(),!e){console.warn(`Target element is null or undefined`),o.value=void 0;return}o.value=(0,t.createLayout)(e,n)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{d(),s()});function c(){return o.value?.record()}function l(e){return o.value?.animate(e)}function u(e,t){return o.value?.update(e,t)}function d(){return o.value?.revert()}return{layout:(0,e.readonly)(o),record:c,animate:l,update:u,revert:d}}function d(){function n(n,r){let i=(0,e.unref)(n);return i?t.svg.morphTo((0,e.unref)(i),(0,e.unref)(r)):()=>``}function r(n,r){let i=(0,e.unref)(n)??``;return t.svg.createMotionPath(i,(0,e.unref)(r))}return{morphTo:n,createMotionPath:r}}function f(i,a=0,o=0){let s=(0,e.shallowRef)(),{stop:c}=(0,e.watch)(()=>r(i),n=>{if(s.value=void 0,!n){console.warn(`[useSvgDrawable] Target element is null or undefined`);return}s.value=t.svg.createDrawable(n,(0,e.unref)(a),(0,e.unref)(o))[0]},{flush:`post`,immediate:!(0,e.isRef)(i)});return(0,n.tryOnUnmounted)(()=>{c(),s.value=void 0}),{drawable:(0,e.readonly)(s)}}function p(i,a){let o=(0,e.shallowRef)(),s=(0,e.computed)(()=>o.value?.lines??[]),c=(0,e.computed)(()=>o.value?.words??[]),l=(0,e.computed)(()=>o.value?.chars??[]),{stop:u}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,n])=>{d(),o.value=void 0,e&&(o.value=(0,t.splitText)(e,n))},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{u(),o.value=void 0,d()});function d(){o.value?.revert()}function f(){o.value?.refresh()}return{splitter:(0,e.readonly)(o),lines:s,words:c,chars:l,revert:d,refresh:f}}function m(i,a={}){let o=(0,e.shallowRef)(),{stop:s}=(0,e.watch)([()=>r(i),()=>(0,e.unref)(a)],([e,n])=>{o.value=t.waapi.animate(e,n)},{flush:`post`,immediate:!(0,e.isRef)(i)});(0,n.tryOnUnmounted)(()=>{s()});function c(){return o.value?.resume()}function l(){return o.value?.pause()}function u(){return o.value?.alternate()}function d(){return o.value?.play()}function f(){return o.value?.reverse()}function p(t,n){return o.value?.seek((0,e.unref)(t),(0,e.unref)(n))}function m(){return o.value?.restart()}function g(){return o.value?.commitStyles()}function _(){return o.value?.complete()}function v(){return o.value?.cancel()}function y(){return o.value?.revert()}return{animation:(0,e.readonly)(o),resume:c,pause:l,alternate:u,play:d,reverse:f,seek:p,restart:m,commitStyles:g,complete:_,cancel:v,revert:y,convertEase:h}}function h(n,r=100){return t.waapi.convertEase((0,e.unref)(n),(0,e.unref)(r))}function g(r){let i=(0,e.shallowRef)(void 0),a=[],o=[],s=[],c=!1,l;(0,n.tryOnMounted)(()=>{c=!0,i.value=(0,t.createScope)((0,e.unref)(r));for(let e of a)i.value.add(e);for(let[e,t]of o)i.value.add(e,t);for(let e of s)i.value.addOnce(e);a.length=0,o.length=0,s.length=0,(0,e.isRef)(r)&&(l=(0,e.watch)(r,e=>{i.value?.revert(),i.value=(0,t.createScope)(e)},{flush:`post`}))}),(0,n.tryOnUnmounted)(()=>{i.value?.revert(),l?.()});function u(e){return c?i.value?.add(e):void a.push(e)}function d(e,t){return c?i.value?.add(e,t):void o.push([e,t])}function f(e){return c?i.value?.addOnce(e):void s.push(e)}function p(e){return i.value?.keepTime(e)}function m(){return i.value?.revert()}function h(){return i.value?.refresh()}return{scope:(0,e.shallowReadonly)(i),add:u,registerMethod:d,addOnce:f,keepTime:p,revert:m,refresh:h}}var _=new WeakMap,v={mounted(e,n){n.value&&_.set(e,(0,t.animate)(e,n.value))},updated(e,n){if(n.value===n.oldValue)return;let r=_.get(e);r?.cancel(),r?.revert(),n.value&&_.set(e,(0,t.animate)(e,n.value))},unmounted(e){let t=_.get(e);t?.cancel(),t?.revert(),_.delete(e)}},y=new WeakMap,b={mounted(e,n){y.set(e,(0,t.createDraggable)(e,n.value??{}))},updated(e,n){n.value!==n.oldValue&&(y.get(e)?.revert(),y.set(e,(0,t.createDraggable)(e,n.value??{})))},unmounted(e){y.get(e)?.revert(),y.delete(e)}},x=new WeakMap;function S(e,n){let r=t.svg.createDrawable(e)[0];return{drawable:r,animation:n?(0,t.animate)(r,n):void 0}}var C={mounted(e,t){x.set(e,S(e,t.value))},updated(e,t){if(t.value===t.oldValue)return;let n=x.get(e);n?.animation?.cancel(),n?.animation?.revert(),x.set(e,S(e,t.value))},unmounted(e){let t=x.get(e);t?.animation?.cancel(),t?.animation?.revert(),x.delete(e)}},w=new WeakMap,T={mounted(e,n){n.value&&w.set(e,{animation:t.waapi.animate(e,n.value),originalStyle:e.style.cssText})},updated(e,n){if(n.value===n.oldValue)return;let r=w.get(e);r&&(r.animation.cancel(),e.style.cssText=r.originalStyle,w.delete(e)),n.value&&w.set(e,{animation:t.waapi.animate(e,n.value),originalStyle:e.style.cssText})},unmounted(e){let t=w.get(e);t&&(t.animation.cancel(),e.style.cssText=t.originalStyle,w.delete(e))}},E=new WeakMap;function D(e,n){let{animation:r,...i}=n??{},a=(0,t.splitText)(e,i),o={splitter:a,animation:void 0};return r&&(i.lines?(document.fonts?.ready??Promise.resolve()).then(()=>{E.get(e)===o&&(o.animation=(0,t.animate)(a.lines,r))}):o.animation=(0,t.animate)(i.chars?a.chars:a.words,r)),o}function O(e){e.animation?.cancel(),e.splitter.revert()}var k={mounted(e,t){E.set(e,D(e,t.value))},updated(e,t){if(t.value===t.oldValue)return;let n=E.get(e);n&&O(n),E.set(e,D(e,t.value))},unmounted(e){let t=E.get(e);t&&O(t),E.delete(e)}};exports.useAnimatable=c,exports.useAnimate=i,exports.useDraggable=l,exports.useLayout=u,exports.useRawAnimate=a,exports.useScope=g,exports.useSvg=d,exports.useSvgDrawable=f,exports.useText=p,exports.useTimeline=s,exports.useTimer=o,exports.useWaapi=m,exports.vAnimate=v,exports.vDraggable=b,exports.vSvgDrawable=C,exports.vTextSplit=k,exports.vWaapi=T;
2
2
  //# sourceMappingURL=index.cjs.map