@juleshry/vue-animejs 1.0.1 → 1.2.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 +21 -304
- package/dist/composables/use-animatable.d.ts +12 -6
- package/dist/composables/use-animatable.d.ts.map +1 -1
- package/dist/composables/use-animate.d.ts +3 -3
- package/dist/composables/use-animate.d.ts.map +1 -1
- package/dist/composables/use-draggable.d.ts +2 -2
- package/dist/composables/use-draggable.d.ts.map +1 -1
- package/dist/composables/use-layout.d.ts +2 -2
- package/dist/composables/use-layout.d.ts.map +1 -1
- package/dist/composables/use-raw-animatable.d.ts +17 -0
- package/dist/composables/use-raw-animatable.d.ts.map +1 -0
- package/dist/composables/use-raw-animate.d.ts +3 -0
- package/dist/composables/use-raw-animate.d.ts.map +1 -1
- package/dist/composables/use-scope.d.ts.map +1 -1
- package/dist/composables/use-svg-drawable.d.ts +2 -2
- package/dist/composables/use-svg-drawable.d.ts.map +1 -1
- package/dist/composables/use-svg.d.ts.map +1 -1
- package/dist/composables/use-text.d.ts +2 -2
- package/dist/composables/use-text.d.ts.map +1 -1
- package/dist/composables/use-timeline.d.ts +20 -20
- package/dist/composables/use-timeline.d.ts.map +1 -1
- package/dist/composables/use-timer.d.ts +15 -15
- package/dist/composables/use-timer.d.ts.map +1 -1
- package/dist/composables/use-waapi.d.ts +2 -2
- package/dist/composables/use-waapi.d.ts.map +1 -1
- package/dist/directives/v-animate.d.ts +12 -0
- package/dist/directives/v-animate.d.ts.map +1 -0
- package/dist/directives/v-draggable.d.ts +12 -0
- package/dist/directives/v-draggable.d.ts.map +1 -0
- package/dist/directives/v-svg-drawable.d.ts +13 -0
- package/dist/directives/v-svg-drawable.d.ts.map +1 -0
- package/dist/directives/v-text-split.d.ts +16 -0
- package/dist/directives/v-text-split.d.ts.map +1 -0
- package/dist/directives/v-waapi.d.ts +12 -0
- package/dist/directives/v-waapi.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +460 -345
- package/dist/index.js.map +1 -1
- package/dist/utils/resolve-target.d.ts +12 -3
- package/dist/utils/resolve-target.d.ts.map +1 -1
- package/package.json +20 -19
package/README.md
CHANGED
|
@@ -2,14 +2,20 @@
|
|
|
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"
|
|
7
|
-
|
|
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
|
|
11
17
|
|
|
12
|
-
**vue-animejs** wraps Anime.js v4 as idiomatic Vue 3 composables. It integrates with Vue's reactivity system — pass a `ref` as a target or option and the animation updates automatically. Lifecycle cleanup is handled for you.
|
|
18
|
+
**vue-animejs** wraps Anime.js v4 as idiomatic Vue 3 composables. It integrates with Vue's reactivity system — pass a `ref` as a target or option and the animation updates automatically. Lifecycle cleanup is handled for you, and every composable is safe to call during SSR (Nuxt, `@vue/server-renderer`) — Anime.js instances are only created once mounted in a browser.
|
|
13
19
|
|
|
14
20
|
**Before** — raw Anime.js in a Vue component:
|
|
15
21
|
|
|
@@ -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,19 @@ 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
|
-
|
|
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
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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 |
|
|
94
|
+
| `v-draggable` | Make an element draggable declaratively |
|
|
95
|
+
| `v-svg-drawable` | Animate SVG stroke drawing declaratively via the `draw` property |
|
|
96
|
+
| `v-waapi` | Animate via WAAPI declaratively |
|
|
97
|
+
| `v-text-split` | Split text into animatable lines, words, and chars declaratively |
|
|
307
98
|
|
|
308
|
-
|
|
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>
|
|
99
|
+
## 🚀 Usage
|
|
378
100
|
|
|
379
|
-
|
|
380
|
-
<p ref="el">Hello, world!</p>
|
|
381
|
-
</template>
|
|
382
|
-
```
|
|
101
|
+
For full API docs and live demos, see **[the doc here](https://vue-animejs.juleshry.dev)**.
|
|
383
102
|
|
|
384
103
|
## 👨🚀 Contributors
|
|
385
104
|
|
|
@@ -399,9 +118,7 @@ See the [Contributing Guide](./CONTRIBUTING.md).
|
|
|
399
118
|
## 🗺️ TODO
|
|
400
119
|
|
|
401
120
|
- [ ] Allow reactive refs inside option objects
|
|
402
|
-
- [ ] Finish doc website
|
|
403
121
|
- [ ] Add components
|
|
404
|
-
- [ ] Add directives
|
|
405
122
|
|
|
406
123
|
## 📄 License
|
|
407
124
|
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
1
|
+
import { type Animatable, type AnimatableParams, type AnimatableProperty, type AnimatablePropertyParamsOptions } from "animejs";
|
|
2
|
+
import { type MaybeRef, type ShallowRef } from "vue";
|
|
3
3
|
import { type AnimationTargets } from "@src/utils/resolve-target.ts";
|
|
4
|
-
|
|
4
|
+
/** The keys of `T` that represent animatable properties, excluding Anime.js's reserved config keys (`ease`, `duration`, `unit`, `modifier`, `composition`). */
|
|
5
|
+
export type AnimatablePropertyKeys<T extends AnimatableParams> = Exclude<keyof T, keyof AnimatablePropertyParamsOptions>;
|
|
6
|
+
/** An `AnimatableObject` narrowed to only the property setters/getters implied by `T`. */
|
|
7
|
+
export type TypedAnimatableObject<T extends AnimatableParams> = Animatable & {
|
|
8
|
+
[K in AnimatablePropertyKeys<T>]: AnimatableProperty;
|
|
9
|
+
};
|
|
10
|
+
export interface UseAnimatableReturn<T extends AnimatableParams = AnimatableParams> {
|
|
5
11
|
/** The underlying Anime.js animatable instance. `undefined` until the target is available. */
|
|
6
|
-
animatable:
|
|
12
|
+
animatable: Readonly<ShallowRef<TypedAnimatableObject<T> | undefined>>;
|
|
7
13
|
/** Cancels the animatable and restores all animated properties to their original values. */
|
|
8
|
-
revert: () =>
|
|
14
|
+
revert: () => TypedAnimatableObject<T> | undefined;
|
|
9
15
|
}
|
|
10
16
|
/**
|
|
11
17
|
* Wraps Anime.js `createAnimatable()` into a Vue composable. Reactively re-creates the animatable when the target or options change, and reverts it automatically on unmount.
|
|
@@ -13,5 +19,5 @@ export interface UseAnimatableReturn {
|
|
|
13
19
|
* @param targets - The element(s) to make animatable. Accepts a template ref, a CSS selector, a DOM element, or a reactive ref to any of these.
|
|
14
20
|
* @param options - Anime.js animatable parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
15
21
|
*/
|
|
16
|
-
export declare function useAnimatable(targets: AnimationTargets, options?: MaybeRef<
|
|
22
|
+
export declare function useAnimatable<T extends AnimatableParams = AnimatableParams>(targets: AnimationTargets, options?: MaybeRef<T>): UseAnimatableReturn<T>;
|
|
17
23
|
//# sourceMappingURL=use-animatable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-animatable.d.ts","sourceRoot":"","sources":["../../src/composables/use-animatable.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-animatable.d.ts","sourceRoot":"","sources":["../../src/composables/use-animatable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EAGrC,MAAM,SAAS,CAAA;AAChB,OAAO,EAIL,KAAK,QAAQ,EAEb,KAAK,UAAU,EAIhB,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAEnF,+JAA+J;AAC/J,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,+BAA+B,CAAC,CAAA;AAExH,0FAA0F;AAC1F,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,gBAAgB,IAAI,UAAU,GAAG;KAC1E,CAAC,IAAI,sBAAsB,CAAC,CAAC,CAAC,GAAG,kBAAkB;CACrD,CAAA;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB;IAChF,8FAA8F;IAC9F,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAA;IACtE,4FAA4F;IAC5F,MAAM,EAAE,MAAM,qBAAqB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CACnD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,EACzE,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,QAAQ,CAAC,CAAC,CAAW,GAC7B,mBAAmB,CAAC,CAAC,CAAC,CAkCxB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type MaybeRef, type ShallowRef } from "vue";
|
|
2
2
|
import { type JSAnimation, type AnimationParams } from "animejs";
|
|
3
3
|
import { type AnimationTargets } from "@src/utils/resolve-target.ts";
|
|
4
4
|
export interface UseAnimateReturn {
|
|
5
5
|
/** The underlying Anime.js animation instance. `undefined` until the target is available. */
|
|
6
|
-
animation:
|
|
6
|
+
animation: Readonly<ShallowRef<JSAnimation | undefined>>;
|
|
7
7
|
/** Starts or resumes the animation. */
|
|
8
8
|
play: () => JSAnimation | undefined;
|
|
9
9
|
/** Reverses playback direction. */
|
|
@@ -34,7 +34,7 @@ export interface UseAnimateReturn {
|
|
|
34
34
|
/**
|
|
35
35
|
* Wraps Anime.js `animate()` into a Vue composable. Reactively re-creates the animation when the target or options change, and cancels it automatically on unmount.
|
|
36
36
|
*
|
|
37
|
-
* @param _target - The element(s) to animate. Accepts a template ref, a CSS selector, a DOM element,
|
|
37
|
+
* @param _target - The element(s) to animate. Accepts a template ref, a CSS selector, a DOM element, a reactive ref to any of these, or an array of them.
|
|
38
38
|
* @param _options - Anime.js animation parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
39
39
|
*/
|
|
40
40
|
export declare function useAnimate(_target: AnimationTargets, _options?: MaybeRef<AnimationParams>): UseAnimateReturn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-animate.d.ts","sourceRoot":"","sources":["../../src/composables/use-animate.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-animate.d.ts","sourceRoot":"","sources":["../../src/composables/use-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAmB,KAAK,UAAU,EAA4B,MAAM,KAAK,CAAA;AAC/G,OAAO,EAAE,KAAK,WAAW,EAA8B,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE5F,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAEnF,MAAM,WAAW,gBAAgB;IAC/B,6FAA6F;IAC7F,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC,CAAA;IACxD,uCAAuC;IACvC,IAAI,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACnC,mCAAmC;IACnC,OAAO,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACtC,oDAAoD;IACpD,KAAK,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACpC,iDAAiD;IACjD,OAAO,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACtC,qDAAqD;IACrD,SAAS,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACxC,mCAAmC;IACnC,MAAM,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACrC,qDAAqD;IACrD,QAAQ,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACvC,mEAAmE;IACnE,MAAM,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACrC,2FAA2F;IAC3F,MAAM,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACrC,gHAAgH;IAChH,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,WAAW,GAAG,SAAS,CAAA;IACvD,wCAAwC;IACxC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,KAAK,WAAW,GAAG,SAAS,CAAA;IACpH,sDAAsD;IACtD,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAA;IACzD,uEAAuE;IACvE,OAAO,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,GAAE,QAAQ,CAAC,eAAe,CAAM,GAAG,gBAAgB,CAgGhH"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type MaybeRef, type ShallowRef } from "vue";
|
|
2
2
|
import { type Draggable, type DraggableParams, type EasingParam } from "animejs";
|
|
3
3
|
import { type AnimationTargets } from "@src/utils/resolve-target.ts";
|
|
4
4
|
export interface UseDraggableReturn {
|
|
5
5
|
/** The underlying Anime.js draggable instance. `undefined` until the target is available. */
|
|
6
|
-
draggable:
|
|
6
|
+
draggable: Readonly<ShallowRef<Draggable | undefined>>;
|
|
7
7
|
/** Disables drag interactions without destroying the instance. */
|
|
8
8
|
disable: () => void;
|
|
9
9
|
/** Re-enables drag interactions after `disable()`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-draggable.d.ts","sourceRoot":"","sources":["../../src/composables/use-draggable.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-draggable.d.ts","sourceRoot":"","sources":["../../src/composables/use-draggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAmB,KAAK,UAAU,EAA4B,MAAM,KAAK,CAAA;AAE/G,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAmB,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AACjG,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAEnF,MAAM,WAAW,kBAAkB;IACjC,6FAA6F;IAC7F,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC,CAAA;IACtD,kEAAkE;IAClE,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,sDAAsD;IACtD,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,gGAAgG;IAChG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACvD,gGAAgG;IAChG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACvD,wDAAwD;IACxD,aAAa,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,IAAI,CAAA;IAC5E,uDAAuD;IACvD,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,IAAI,CAAA;IAC3E,wDAAwD;IACxD,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,4EAA4E;IAC5E,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,wDAAwD;IACxD,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,GAAE,QAAQ,CAAC,eAAe,CAAM,GAAG,kBAAkB,CA6EnH"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type MaybeComputedElementRef } from "@vueuse/core";
|
|
2
2
|
import { type AutoLayout, type AutoLayoutParams, type DOMTargetSelector, type LayoutAnimationParams, type Timeline } from "animejs";
|
|
3
|
-
import { type
|
|
3
|
+
import { type MaybeRef, type ShallowRef } from "vue";
|
|
4
4
|
export interface UseLayoutReturn {
|
|
5
5
|
/** The underlying Anime.js `AutoLayout` instance. `undefined` until the root element is available. */
|
|
6
|
-
layout:
|
|
6
|
+
layout: Readonly<ShallowRef<AutoLayout | undefined>>;
|
|
7
7
|
/** Snapshots the current positions of all tracked children so the next layout change can be animated. */
|
|
8
8
|
record: () => void;
|
|
9
9
|
/** Animates all children from their recorded positions to their new positions. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-layout.d.ts","sourceRoot":"","sources":["../../src/composables/use-layout.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-layout.d.ts","sourceRoot":"","sources":["../../src/composables/use-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,uBAAuB,EAAkB,MAAM,cAAc,CAAA;AAErF,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EAErB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACd,MAAM,SAAS,CAAA;AAChB,OAAO,EAAkB,KAAK,QAAQ,EAAmB,KAAK,UAAU,EAA4B,MAAM,KAAK,CAAA;AAE/G,MAAM,WAAW,eAAe;IAC9B,sGAAsG;IACtG,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAA;IACpD,yGAAyG;IACzG,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,kFAAkF;IAClF,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,qBAAqB,KAAK,QAAQ,GAAG,SAAS,CAAA;IACjE,oGAAoG;IACpG,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,EAAE,MAAM,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACxF,oFAAoF;IACpF,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,uBAAuB,EAC3D,MAAM,GAAE,QAAQ,CAAC,gBAAgB,CAAM,GACtC,eAAe,CAyCjB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AnimatableObject, type AnimatableParams } from "animejs";
|
|
2
|
+
import { type MaybeRef } from "vue";
|
|
3
|
+
import { type AnimationTargets } from "@src/utils/resolve-target.ts";
|
|
4
|
+
/** The Anime.js `AnimatableObject` instance returned by `useRawAnimatable`. */
|
|
5
|
+
export type UseRawAnimatableReturn = AnimatableObject;
|
|
6
|
+
/**
|
|
7
|
+
* Thin wrapper around Anime.js `createAnimatable()`. Resolves the target (unwrapping refs and Vue
|
|
8
|
+
* component refs via `.$el`) and immediately creates the animatable.
|
|
9
|
+
*
|
|
10
|
+
* SSR-safety is the caller's responsibility: invoke this from inside your own `onMounted` (it runs
|
|
11
|
+
* unconditionally and immediately, with no client-only guard), never at `setup()` top level.
|
|
12
|
+
*
|
|
13
|
+
* @param targets - The element(s) to make animatable. Accepts a template ref, a Vue component ref, a CSS selector, a DOM element, or a reactive ref to any of these.
|
|
14
|
+
* @param options - Anime.js animatable parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useRawAnimatable(targets: AnimationTargets, options?: MaybeRef<AnimatableParams>): UseRawAnimatableReturn;
|
|
17
|
+
//# sourceMappingURL=use-raw-animatable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-raw-animatable.d.ts","sourceRoot":"","sources":["../../src/composables/use-raw-animatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAoB,MAAM,SAAS,CAAA;AACxF,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAEnF,+EAA+E;AAC/E,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,CAAA;AAErD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,QAAQ,CAAC,gBAAgB,CAAM,GACvC,sBAAsB,CAQxB"}
|
|
@@ -7,6 +7,9 @@ export type UseRawAnimateReturn = JSAnimation;
|
|
|
7
7
|
* Thin wrapper around Anime.js `animate()`. Resolves the target (unwrapping refs and Vue component
|
|
8
8
|
* refs via `.$el`) and immediately starts the animation.
|
|
9
9
|
*
|
|
10
|
+
* SSR-safety is the caller's responsibility: invoke this from inside your own `onMounted` (it runs
|
|
11
|
+
* unconditionally and immediately, with no client-only guard), never at `setup()` top level.
|
|
12
|
+
*
|
|
10
13
|
* @param _target - The element(s) to animate. Accepts a template ref, a Vue component ref, a CSS selector, a DOM element, or a reactive ref to any of these.
|
|
11
14
|
* @param _options - Anime.js animation parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
12
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-raw-animate.d.ts","sourceRoot":"","sources":["../../src/composables/use-raw-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAEnF,uEAAuE;AACvE,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAA;AAE7C
|
|
1
|
+
{"version":3,"file":"use-raw-animate.d.ts","sourceRoot":"","sources":["../../src/composables/use-raw-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAEnF,uEAAuE;AACvE,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAA;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,QAAQ,GAAE,QAAQ,CAAC,eAAe,CAAM,GACvC,mBAAmB,CAQrB"}
|
|
@@ -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,
|
|
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,EAAkB,KAAK,QAAQ,EAAmB,KAAK,UAAU,EAA4B,MAAM,KAAK,CAAA;AAE/G,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"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type DrawableSVGGeometry, type DOMTargetSelector } from "animejs";
|
|
2
2
|
import { type MaybeComputedElementRef } from "@vueuse/core";
|
|
3
|
-
import { type MaybeRef, type
|
|
3
|
+
import { type MaybeRef, type ShallowRef } from "vue";
|
|
4
4
|
export interface UseSvgDrawableReturn {
|
|
5
5
|
/**
|
|
6
6
|
* The Anime.js drawable Proxy for the target element. `undefined` until the element is available.
|
|
7
7
|
* Pass this ref — not the original template ref — as the `useAnimate` target to animate the `draw` property.
|
|
8
8
|
*/
|
|
9
|
-
drawable:
|
|
9
|
+
drawable: Readonly<ShallowRef<DrawableSVGGeometry | undefined>>;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Wraps an SVG geometry element in Anime.js's drawable Proxy. The proxy intercepts `setAttribute('draw', …)` calls and translates normalised `draw` values (`0`–`1`) into the correct `stroke-dasharray` / `stroke-dashoffset` updates. Pass the returned `drawable` ref as the target to `useAnimate`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-svg-drawable.d.ts","sourceRoot":"","sources":["../../src/composables/use-svg-drawable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"use-svg-drawable.d.ts","sourceRoot":"","sources":["../../src/composables/use-svg-drawable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,EAAY,KAAK,uBAAuB,EAAkB,MAAM,cAAc,CAAA;AACrF,OAAO,EAAkB,KAAK,QAAQ,EAAmB,KAAK,UAAU,EAA4B,MAAM,KAAK,CAAA;AAG/G,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC,CAAA;CAChE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,uBAAuB,EAC7D,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAK,EAC3B,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAK,GACxB,oBAAoB,CAsBtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-svg.d.ts","sourceRoot":"","sources":["../../src/composables/use-svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AACpE,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,KAAK,CAAA;AAE1C,MAAM,WAAW,YAAY;IAC3B,+IAA+I;IAC/I,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,aAAa,CAAA;IACtF,yKAAyK;IACzK,gBAAgB,EAAE,CAChB,IAAI,EAAE,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,EACnC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,KACtB,UAAU,CAAC,OAAO,GAAG,CAAC,gBAAgB,CAAC,CAAA;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,YAAY,
|
|
1
|
+
{"version":3,"file":"use-svg.d.ts","sourceRoot":"","sources":["../../src/composables/use-svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AACpE,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,KAAK,CAAA;AAE1C,MAAM,WAAW,YAAY;IAC3B,+IAA+I;IAC/I,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,aAAa,CAAA;IACtF,yKAAyK;IACzK,gBAAgB,EAAE,CAChB,IAAI,EAAE,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,EACnC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,KACtB,UAAU,CAAC,OAAO,GAAG,CAAC,gBAAgB,CAAC,CAAA;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,YAAY,CAoBrC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type TextSplitter, type TextSplitterParams } from "animejs";
|
|
2
2
|
import { type MaybeComputedElementRef } from "@vueuse/core";
|
|
3
|
-
import { type ComputedRef, type
|
|
3
|
+
import { type ComputedRef, type MaybeRef, type ShallowRef } from "vue";
|
|
4
4
|
export interface UseTextReturn {
|
|
5
5
|
/** The underlying Anime.js `TextSplitter` instance. `undefined` until the target is available. */
|
|
6
|
-
splitter:
|
|
6
|
+
splitter: Readonly<ShallowRef<TextSplitter | undefined>>;
|
|
7
7
|
/** Reactive array of `<span>` elements representing each line after splitting. */
|
|
8
8
|
lines: ComputedRef<HTMLElement[]>;
|
|
9
9
|
/** Reactive array of `<span>` elements representing each word after splitting. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-text.d.ts","sourceRoot":"","sources":["../../src/composables/use-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"use-text.d.ts","sourceRoot":"","sources":["../../src/composables/use-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,EAAY,KAAK,uBAAuB,EAAkB,MAAM,cAAc,CAAA;AAErF,OAAO,EAQL,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,UAAU,EAChB,MAAM,KAAK,CAAA;AAEZ,MAAM,WAAW,aAAa;IAC5B,kGAAkG;IAClG,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC,CAAA;IACxD,kFAAkF;IAClF,KAAK,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAA;IACjC,kFAAkF;IAClF,KAAK,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAA;IACjC,uFAAuF;IACvF,KAAK,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAA;IACjC,kFAAkF;IAClF,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,qGAAqG;IACrG,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,QAAQ,CAAC,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,EAAE,CAAC,GAAG,uBAAuB,EAC5F,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACrC,aAAa,CA0Cf"}
|