@juleshry/vue-animejs 1.2.2 → 1.4.0-beta.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/dist/index.js CHANGED
@@ -1,84 +1,84 @@
1
- import { computed as e, isRef as t, markRaw as n, shallowReadonly as r, shallowRef as i, toValue as a, unref as o, watch as s } from "vue";
2
- import { animate as c, createAnimatable as l, createDraggable as u, createLayout as d, createScope as f, createTimeline as p, createTimer as m, splitText as h, svg as g, waapi as _ } from "animejs";
3
- import { isClient as v, tryOnMounted as y, tryOnUnmounted as b, unrefElement as x } from "@vueuse/core";
1
+ import { computed as e, isRef as t, markRaw as n, normalizeStyle as r, shallowReadonly as i, shallowRef as a, toValue as o, unref as s, watch as c } from "vue";
2
+ import { animate as l, createAnimatable as u, createDraggable as d, createLayout as f, createScope as p, createTimeline as m, createTimer as h, onScroll as g, splitText as _, svg as v, waapi as y } from "animejs";
3
+ import { isClient as b, tryOnMounted as x, tryOnUnmounted as S, unrefElement as C } from "@vueuse/core";
4
4
  //#region src/utils/resolve-target.ts
5
- function S(e) {
5
+ function w(e) {
6
6
  if (Array.isArray(e)) {
7
- let t = e.map((e) => x(e)).filter((e) => e != null);
7
+ let t = e.map((e) => C(e)).filter((e) => e != null);
8
8
  return t.length > 0 ? t : void 0;
9
9
  }
10
- return x(e);
10
+ return C(e);
11
11
  }
12
12
  //#endregion
13
13
  //#region src/composables/use-animate.ts
14
- function C(e, a = {}) {
15
- let l = i(), { stop: u } = s([() => S(e), () => o(a)], ([e, t]) => {
14
+ function T(e, r = {}) {
15
+ let o = a(), { stop: u } = c([() => w(e), () => s(r)], ([e, t]) => {
16
16
  d(e, t);
17
17
  }, {
18
18
  flush: "post",
19
- immediate: !t(e) && v
19
+ immediate: !t(e) && b
20
20
  });
21
- b(() => {
22
- u(), x();
21
+ S(() => {
22
+ u(), y();
23
23
  });
24
24
  function d(e, t) {
25
- if (C(), !e) {
26
- console.warn("Target element is null or undefined"), l.value = void 0;
25
+ if (x(), !e) {
26
+ console.warn("Target element is null or undefined"), o.value = void 0;
27
27
  return;
28
28
  }
29
- l.value = n(c(e, t));
29
+ o.value = n(l(e, t));
30
30
  }
31
31
  function f() {
32
- return l.value?.play();
32
+ return o.value?.play();
33
33
  }
34
34
  function p() {
35
- return l.value?.reverse();
35
+ return o.value?.reverse();
36
36
  }
37
37
  function m() {
38
- return l.value?.pause();
38
+ return o.value?.pause();
39
39
  }
40
40
  function h() {
41
- return l.value?.restart();
41
+ return o.value?.restart();
42
42
  }
43
43
  function g() {
44
- return l.value?.alternate();
44
+ return o.value?.alternate();
45
45
  }
46
46
  function _() {
47
- return l.value?.resume();
47
+ return o.value?.resume();
48
+ }
49
+ function v() {
50
+ return o.value?.complete();
48
51
  }
49
52
  function y() {
50
- return l.value?.complete();
53
+ return o.value?.cancel();
51
54
  }
52
55
  function x() {
53
- return l.value?.cancel();
56
+ return o.value?.revert();
54
57
  }
55
- function C() {
56
- return l.value?.revert();
57
- }
58
- function w(e) {
59
- return l.value?.reset(e);
58
+ function C(e) {
59
+ return o.value?.reset(e);
60
60
  }
61
61
  function T(e, t, n) {
62
- return l.value?.seek(e, t, n);
62
+ return o.value?.seek(e, t, n);
63
63
  }
64
64
  function E(e) {
65
- return l.value?.stretch(e);
65
+ return o.value?.stretch(e);
66
66
  }
67
67
  function D() {
68
- return l.value?.refresh();
68
+ return o.value?.refresh();
69
69
  }
70
70
  return {
71
- animation: r(l),
71
+ animation: i(o),
72
72
  play: f,
73
73
  reverse: p,
74
74
  pause: m,
75
75
  restart: h,
76
76
  alternate: g,
77
77
  resume: _,
78
- complete: y,
79
- cancel: x,
80
- revert: C,
81
- reset: w,
78
+ complete: v,
79
+ cancel: y,
80
+ revert: x,
81
+ reset: C,
82
82
  seek: T,
83
83
  stretch: E,
84
84
  refresh: D
@@ -86,25 +86,25 @@ function C(e, a = {}) {
86
86
  }
87
87
  //#endregion
88
88
  //#region src/composables/use-raw-animate.ts
89
- function w(e, t = {}) {
90
- let n = S(e);
91
- return n || console.warn("Target is undefined"), c(n, o(t));
89
+ function E(e, t = {}) {
90
+ let n = w(e);
91
+ return n || console.warn("Target is undefined"), l(n, s(t));
92
92
  }
93
93
  //#endregion
94
94
  //#region src/composables/use-timer.ts
95
- function T(e = {}) {
96
- let t = i(), a;
97
- function c(e) {
98
- e !== a && (a = e, S(), t.value = n(m(e)));
95
+ function D(e = {}) {
96
+ let t = a(), r;
97
+ function o(e) {
98
+ e !== r && (r = e, y(), t.value = n(h(e)));
99
99
  }
100
- y(() => {
101
- c(o(e));
100
+ x(() => {
101
+ o(s(e));
102
102
  });
103
- let { stop: l } = s(() => o(e), (e) => {
104
- v && c(e);
103
+ let { stop: l } = c(() => s(e), (e) => {
104
+ b && o(e);
105
105
  }, { deep: 1 });
106
- b(() => {
107
- l(), S();
106
+ S(() => {
107
+ l(), y();
108
108
  });
109
109
  function u() {
110
110
  return t.value?.play();
@@ -118,7 +118,7 @@ function T(e = {}) {
118
118
  function p() {
119
119
  return t.value?.restart();
120
120
  }
121
- function h() {
121
+ function m() {
122
122
  return t.value?.alternate();
123
123
  }
124
124
  function g() {
@@ -127,10 +127,10 @@ function T(e = {}) {
127
127
  function _() {
128
128
  return t.value?.complete();
129
129
  }
130
- function x(e) {
130
+ function v(e) {
131
131
  return t.value?.reset(e);
132
132
  }
133
- function S() {
133
+ function y() {
134
134
  return t.value?.cancel();
135
135
  }
136
136
  function C() {
@@ -143,16 +143,16 @@ function T(e = {}) {
143
143
  return t.value?.stretch(e);
144
144
  }
145
145
  return {
146
- timer: r(t),
146
+ timer: i(t),
147
147
  play: u,
148
148
  reverse: d,
149
149
  pause: f,
150
150
  restart: p,
151
- alternate: h,
151
+ alternate: m,
152
152
  resume: g,
153
153
  complete: _,
154
- reset: x,
155
- cancel: S,
154
+ reset: v,
155
+ cancel: y,
156
156
  revert: C,
157
157
  seek: w,
158
158
  stretch: T
@@ -160,24 +160,24 @@ function T(e = {}) {
160
160
  }
161
161
  //#endregion
162
162
  //#region src/composables/use-timeline.ts
163
- function E(e = {}) {
164
- let t = !1, c, l = [], u = i();
163
+ function O(e = {}) {
164
+ let t = !1, r, l = [], u = a();
165
165
  function d() {
166
- for (let e of l) e.type === "add" ? u.value?.add(S(e.targets), a(e.params), e.position) : e.type === "set" ? u.value?.set(S(e.targets), a(e.params), e.position) : u.value?.call(e.callback, e.position);
166
+ for (let e of l) e.type === "add" ? u.value?.add(w(e.targets), o(e.params), e.position) : e.type === "set" ? u.value?.set(w(e.targets), o(e.params), e.position) : u.value?.call(e.callback, e.position);
167
167
  }
168
168
  function f(e) {
169
- e !== c && (c = e, F(), u.value = n(p(e)), d());
169
+ e !== r && (r = e, N(), u.value = n(m(e)), d());
170
170
  }
171
- let { stop: m } = s(() => o(e), (e) => {
172
- v && f(e);
171
+ let { stop: p } = c(() => s(e), (e) => {
172
+ b && f(e);
173
173
  }, {
174
174
  flush: "post",
175
175
  deep: 1
176
176
  });
177
- y(() => {
178
- f(o(e)), t = !0;
179
- }), b(() => {
180
- m(), P();
177
+ x(() => {
178
+ f(s(e)), t = !0;
179
+ }), S(() => {
180
+ p(), M();
181
181
  });
182
182
  function h(e, n, r) {
183
183
  return l.push({
@@ -186,7 +186,7 @@ function E(e = {}) {
186
186
  params: n,
187
187
  position: r
188
188
  }), t ? {
189
- ...u.value?.add(S(e), a(n), r),
189
+ ...u.value?.add(w(e), o(n), r),
190
190
  add: h,
191
191
  set: g,
192
192
  remove: _
@@ -204,7 +204,7 @@ function E(e = {}) {
204
204
  params: n,
205
205
  position: r
206
206
  }), t ? {
207
- ...u.value?.set(S(e), a(n), r),
207
+ ...u.value?.set(w(e), o(n), r),
208
208
  add: h,
209
209
  set: g,
210
210
  remove: _
@@ -217,7 +217,7 @@ function E(e = {}) {
217
217
  }
218
218
  function _(e, n) {
219
219
  return t ? {
220
- ...u.value?.remove(S(e), n),
220
+ ...u.value?.remove(w(e), n),
221
221
  add: h,
222
222
  set: g,
223
223
  remove: _
@@ -228,13 +228,13 @@ function E(e = {}) {
228
228
  remove: _
229
229
  });
230
230
  }
231
- function x(e, t) {
231
+ function v(e, t) {
232
232
  return u.value?.sync(e, t);
233
233
  }
234
- function C(e, t) {
234
+ function y(e, t) {
235
235
  return u.value?.label(e, t);
236
236
  }
237
- function w(e, t) {
237
+ function C(e, t) {
238
238
  return l.push({
239
239
  type: "call",
240
240
  callback: e,
@@ -256,198 +256,237 @@ function E(e = {}) {
256
256
  function k() {
257
257
  return u.value?.restart();
258
258
  }
259
- function A() {
259
+ function ee() {
260
260
  return u.value?.alternate();
261
261
  }
262
- function j() {
262
+ function te() {
263
263
  return u.value?.resume();
264
264
  }
265
- function M() {
265
+ function A() {
266
266
  return u.value?.complete();
267
267
  }
268
- function N(e) {
268
+ function j(e) {
269
269
  return u.value?.reset(e);
270
270
  }
271
- function P() {
271
+ function M() {
272
272
  return u.value?.cancel();
273
273
  }
274
- function F() {
274
+ function N() {
275
275
  return u.value?.revert();
276
276
  }
277
- function I(e, t, n) {
277
+ function P(e, t, n) {
278
278
  return u.value?.seek(e, t, n);
279
279
  }
280
- function L(e) {
280
+ function F(e) {
281
281
  return u.value?.stretch(e);
282
282
  }
283
- function R() {
283
+ function I() {
284
284
  return u.value?.refresh();
285
285
  }
286
286
  return {
287
- timeline: r(u),
287
+ timeline: i(u),
288
288
  add: h,
289
289
  set: g,
290
- sync: x,
291
- label: C,
290
+ sync: v,
291
+ label: y,
292
292
  remove: _,
293
- call: w,
293
+ call: C,
294
294
  init: T,
295
295
  play: E,
296
296
  reverse: D,
297
297
  pause: O,
298
298
  restart: k,
299
- alternate: A,
300
- resume: j,
301
- complete: M,
302
- reset: N,
303
- cancel: P,
304
- revert: F,
305
- seek: I,
306
- stretch: L,
307
- refresh: R
299
+ alternate: ee,
300
+ resume: te,
301
+ complete: A,
302
+ reset: j,
303
+ cancel: M,
304
+ revert: N,
305
+ seek: P,
306
+ stretch: F,
307
+ refresh: I
308
308
  };
309
309
  }
310
310
  //#endregion
311
311
  //#region src/composables/use-animatable.ts
312
- function D(a, c = {}) {
313
- let u = i(), d = e(() => ({
314
- el: S(a),
315
- opt: o(c)
316
- })), { stop: f } = s(d, ({ el: e, opt: t }) => {
312
+ function k(r, o = {}) {
313
+ let l = a(), d = e(() => ({
314
+ el: w(r),
315
+ opt: s(o)
316
+ })), { stop: f } = c(d, ({ el: e, opt: t }) => {
317
317
  if (p(), !e) {
318
- console.warn("Targets element is null or undefined"), u.value = void 0;
318
+ console.warn("Targets element is null or undefined"), l.value = void 0;
319
319
  return;
320
320
  }
321
- u.value = n(l(e, t));
321
+ l.value = n(u(e, t));
322
322
  }, {
323
323
  flush: "post",
324
- immediate: !t(a) && v
324
+ immediate: !t(r) && b
325
325
  });
326
- b(() => {
326
+ S(() => {
327
327
  f(), p();
328
328
  });
329
329
  function p() {
330
- return u.value?.revert();
330
+ return l.value?.revert();
331
331
  }
332
332
  return {
333
- animatable: r(u),
333
+ animatable: i(l),
334
334
  revert: p
335
335
  };
336
336
  }
337
337
  //#endregion
338
338
  //#region src/composables/use-raw-animatable.ts
339
- function O(e, t = {}) {
340
- let n = S(e);
341
- return n || console.warn("Targets element is null or undefined"), l(n, o(t));
339
+ function ee(e, t = {}) {
340
+ let n = w(e);
341
+ return n || console.warn("Targets element is null or undefined"), u(n, s(t));
342
342
  }
343
343
  //#endregion
344
344
  //#region src/composables/use-draggable.ts
345
- function k(e, a = {}) {
346
- let c = i(), { stop: l } = s([() => S(e), () => o(a)], ([e, t]) => {
347
- if (x(), !e) {
348
- console.warn("Targets element is null or undefined"), c.value = void 0;
345
+ function te(e, r = {}) {
346
+ let o = a(), { stop: l } = c([() => w(e), () => s(r)], ([e, t]) => {
347
+ if (y(), !e) {
348
+ console.warn("Targets element is null or undefined"), o.value = void 0;
349
349
  return;
350
350
  }
351
- c.value = n(u(e, t));
351
+ o.value = n(d(e, t));
352
352
  }, {
353
353
  flush: "post",
354
- immediate: !t(e) && v
354
+ immediate: !t(e) && b
355
355
  });
356
- b(() => {
357
- x(), l();
356
+ S(() => {
357
+ y(), l();
358
358
  });
359
- function d() {
360
- return c.value?.disable();
359
+ function u() {
360
+ return o.value?.disable();
361
361
  }
362
362
  function f() {
363
- return c.value?.enable();
363
+ return o.value?.enable();
364
364
  }
365
365
  function p(e, t) {
366
- return c.value?.setX(e, t);
366
+ return o.value?.setX(e, t);
367
367
  }
368
368
  function m(e, t) {
369
- return c.value?.setY(e, t);
369
+ return o.value?.setY(e, t);
370
370
  }
371
371
  function h(e, t, n) {
372
- return c.value?.animateInView(e, t, n);
372
+ return o.value?.animateInView(e, t, n);
373
373
  }
374
374
  function g(e, t, n) {
375
- return c.value?.scrollInView(e, t, n);
375
+ return o.value?.scrollInView(e, t, n);
376
376
  }
377
377
  function _() {
378
- return c.value?.stop();
378
+ return o.value?.stop();
379
+ }
380
+ function v() {
381
+ return o.value?.reset();
379
382
  }
380
383
  function y() {
381
- return c.value?.reset();
384
+ return o.value?.revert();
382
385
  }
383
386
  function x() {
384
- return c.value?.revert();
385
- }
386
- function C() {
387
- return c.value?.refresh();
387
+ return o.value?.refresh();
388
388
  }
389
389
  return {
390
- draggable: r(c),
391
- disable: d,
390
+ draggable: i(o),
391
+ disable: u,
392
392
  enable: f,
393
393
  setX: p,
394
394
  setY: m,
395
395
  animateInView: h,
396
396
  scrollInView: g,
397
397
  stop: _,
398
- reset: y,
399
- revert: x,
400
- refresh: C
398
+ reset: v,
399
+ revert: y,
400
+ refresh: x
401
401
  };
402
402
  }
403
403
  //#endregion
404
404
  //#region src/composables/use-layout.ts
405
- function A(e, a = {}) {
406
- let c = i(), { stop: l } = s([() => S(e), () => o(a)], ([e, t]) => {
405
+ function A(e, r = {}) {
406
+ let o = a(), { stop: l } = c([() => w(e), () => s(r)], ([e, t]) => {
407
407
  if (m(), !e) {
408
- console.warn("Target element is null or undefined"), c.value = void 0;
408
+ console.warn("Target element is null or undefined"), o.value = void 0;
409
409
  return;
410
410
  }
411
- c.value = n(d(e, t));
411
+ o.value = n(f(e, t));
412
412
  }, {
413
413
  flush: "post",
414
- immediate: !t(e) && v
414
+ immediate: !t(e) && b
415
415
  });
416
- b(() => {
416
+ S(() => {
417
417
  m(), l();
418
418
  });
419
419
  function u() {
420
- return c.value?.record();
420
+ return o.value?.record();
421
421
  }
422
- function f(e) {
423
- return c.value?.animate(e);
422
+ function d(e) {
423
+ return o.value?.animate(e);
424
424
  }
425
425
  function p(e, t) {
426
- return c.value?.update(e, t);
426
+ return o.value?.update(e, t);
427
427
  }
428
428
  function m() {
429
- return c.value?.revert();
429
+ return o.value?.revert();
430
430
  }
431
431
  return {
432
- layout: r(c),
432
+ layout: i(o),
433
433
  record: u,
434
- animate: f,
434
+ animate: d,
435
435
  update: p,
436
436
  revert: m
437
437
  };
438
438
  }
439
439
  //#endregion
440
+ //#region src/composables/use-scroll.ts
441
+ function j(t, r, i = {}) {
442
+ let a, o = e(() => {
443
+ if (a?.revert(), a = void 0, !b) return;
444
+ let e = w(t), o = w(r);
445
+ if (e && o) return a = n(g({
446
+ ...s(i),
447
+ container: e,
448
+ target: o
449
+ })), a;
450
+ }), c = e(() => o.value ?? !1), l = e(() => ({ autoplay: c.value }));
451
+ S(() => a?.revert());
452
+ function u() {
453
+ return o.value?.refresh();
454
+ }
455
+ function d() {
456
+ return o.value?.revert();
457
+ }
458
+ function f() {
459
+ o.value?.debug();
460
+ }
461
+ function p() {
462
+ return o.value?.removeDebug();
463
+ }
464
+ function m(e) {
465
+ return o.value?.link(e);
466
+ }
467
+ return {
468
+ observer: o,
469
+ autoplay: c,
470
+ autoplayComputed: l,
471
+ refresh: u,
472
+ revert: d,
473
+ debug: f,
474
+ removeDebug: p,
475
+ link: m
476
+ };
477
+ }
478
+ //#endregion
440
479
  //#region src/composables/use-svg.ts
441
- function j() {
480
+ function M() {
442
481
  function e(e, t) {
443
482
  return (n, r, i, a) => {
444
- let s = o(e);
445
- return s ? g.morphTo(s, o(t))(n, r, i, a) : "";
483
+ let o = s(e);
484
+ return o ? v.morphTo(o, s(t))(n, r, i, a) : "";
446
485
  };
447
486
  }
448
487
  function t(e, t) {
449
- let n = o(e) ?? "";
450
- return g.createMotionPath(n, o(t));
488
+ let n = s(e) ?? "";
489
+ return v.createMotionPath(n, s(t));
451
490
  }
452
491
  return {
453
492
  morphTo: e,
@@ -456,95 +495,95 @@ function j() {
456
495
  }
457
496
  //#endregion
458
497
  //#region src/composables/use-svg-drawable.ts
459
- function M(e, a = 0, c = 0) {
460
- let l = i(), { stop: u } = s(() => S(e), (e) => {
498
+ function N(e, r = 0, o = 0) {
499
+ let l = a(), { stop: u } = c(() => w(e), (e) => {
461
500
  if (l.value = void 0, !e) {
462
501
  console.warn("[useSvgDrawable] Target element is null or undefined");
463
502
  return;
464
503
  }
465
- l.value = n(g.createDrawable(e, o(a), o(c))[0]);
504
+ l.value = n(v.createDrawable(e, s(r), s(o))[0]);
466
505
  }, {
467
506
  flush: "post",
468
- immediate: !t(e) && v
507
+ immediate: !t(e) && b
469
508
  });
470
- return b(() => {
509
+ return S(() => {
471
510
  u(), l.value = void 0;
472
- }), { drawable: r(l) };
511
+ }), { drawable: i(l) };
473
512
  }
474
513
  //#endregion
475
514
  //#region src/composables/use-text.ts
476
- function N(a, c) {
477
- let l = i(), u = e(() => l.value?.lines ?? []), d = e(() => l.value?.words ?? []), f = e(() => l.value?.chars ?? []), { stop: p } = s([() => S(a), () => o(c)], ([e, t]) => {
478
- m(), l.value = void 0, e && (l.value = n(h(e, t)));
515
+ function P(r, o) {
516
+ let l = a(), u = e(() => l.value?.lines ?? []), d = e(() => l.value?.words ?? []), f = e(() => l.value?.chars ?? []), { stop: p } = c([() => w(r), () => s(o)], ([e, t]) => {
517
+ m(), l.value = void 0, e && (l.value = n(_(e, t)));
479
518
  }, {
480
519
  flush: "post",
481
- immediate: !t(a) && v
520
+ immediate: !t(r) && b
482
521
  });
483
- b(() => {
522
+ S(() => {
484
523
  p(), l.value = void 0, m();
485
524
  });
486
525
  function m() {
487
526
  l.value?.revert();
488
527
  }
489
- function g() {
528
+ function h() {
490
529
  l.value?.refresh();
491
530
  }
492
531
  return {
493
- splitter: r(l),
532
+ splitter: i(l),
494
533
  lines: u,
495
534
  words: d,
496
535
  chars: f,
497
536
  revert: m,
498
- refresh: g
537
+ refresh: h
499
538
  };
500
539
  }
501
540
  //#endregion
502
541
  //#region src/composables/use-waapi.ts
503
- function P(e, a = {}) {
504
- let c = i(), { stop: l } = s([() => S(e), () => o(a)], ([e, t]) => {
505
- c.value = n(_.animate(e, t));
542
+ function F(e, r = {}) {
543
+ let o = a(), { stop: l } = c([() => w(e), () => s(r)], ([e, t]) => {
544
+ o.value = n(y.animate(e, t));
506
545
  }, {
507
546
  flush: "post",
508
- immediate: !t(e) && v
547
+ immediate: !t(e) && b
509
548
  });
510
- b(() => {
549
+ S(() => {
511
550
  l();
512
551
  });
513
552
  function u() {
514
- return c.value?.resume();
553
+ return o.value?.resume();
515
554
  }
516
555
  function d() {
517
- return c.value?.pause();
556
+ return o.value?.pause();
518
557
  }
519
558
  function f() {
520
- return c.value?.alternate();
559
+ return o.value?.alternate();
521
560
  }
522
561
  function p() {
523
- return c.value?.play();
562
+ return o.value?.play();
524
563
  }
525
564
  function m() {
526
- return c.value?.reverse();
565
+ return o.value?.reverse();
527
566
  }
528
567
  function h(e, t) {
529
- return c.value?.seek(o(e), o(t));
568
+ return o.value?.seek(s(e), s(t));
530
569
  }
531
570
  function g() {
532
- return c.value?.restart();
571
+ return o.value?.restart();
533
572
  }
534
- function y() {
535
- return c.value?.commitStyles();
573
+ function _() {
574
+ return o.value?.commitStyles();
575
+ }
576
+ function v() {
577
+ return o.value?.complete();
536
578
  }
537
579
  function x() {
538
- return c.value?.complete();
580
+ return o.value?.cancel();
539
581
  }
540
582
  function C() {
541
- return c.value?.cancel();
542
- }
543
- function w() {
544
- return c.value?.revert();
583
+ return o.value?.revert();
545
584
  }
546
585
  return {
547
- animation: r(c),
586
+ animation: i(o),
548
587
  resume: u,
549
588
  pause: d,
550
589
  alternate: f,
@@ -552,159 +591,298 @@ function P(e, a = {}) {
552
591
  reverse: m,
553
592
  seek: h,
554
593
  restart: g,
555
- commitStyles: y,
556
- complete: x,
557
- cancel: C,
558
- revert: w,
559
- convertEase: F
594
+ commitStyles: _,
595
+ complete: v,
596
+ cancel: x,
597
+ revert: C,
598
+ convertEase: I
560
599
  };
561
600
  }
562
- function F(e, t = 100) {
563
- return _.convertEase(o(e), o(t));
601
+ function I(e, t = 100) {
602
+ return y.convertEase(s(e), s(t));
564
603
  }
565
604
  //#endregion
566
605
  //#region src/composables/use-scope.ts
567
- function I(e) {
568
- let a = i(void 0), c = [], l = [], u = [], d = !1, p;
569
- y(() => {
570
- d = !0, a.value = n(f(o(e)));
571
- for (let e of c) a.value.add(e);
572
- for (let [e, t] of l) a.value.add(e, t);
573
- for (let e of u) a.value.addOnce(e);
574
- c.length = 0, l.length = 0, u.length = 0, t(e) && (p = s(e, (e) => {
575
- a.value?.revert(), a.value = n(f(e));
606
+ function ne(e) {
607
+ let r = a(void 0), o = [], l = [], u = [], d = !1, f;
608
+ x(() => {
609
+ d = !0, r.value = n(p(s(e)));
610
+ for (let e of o) r.value.add(e);
611
+ for (let [e, t] of l) r.value.add(e, t);
612
+ for (let e of u) r.value.addOnce(e);
613
+ o.length = 0, l.length = 0, u.length = 0, t(e) && (f = c(e, (e) => {
614
+ r.value?.revert(), r.value = n(p(e));
576
615
  }, { flush: "post" }));
577
- }), b(() => {
578
- a.value?.revert(), p?.();
616
+ }), S(() => {
617
+ r.value?.revert(), f?.();
579
618
  });
580
619
  function m(e) {
581
- return d ? a.value?.add(e) : void c.push(e);
620
+ return d ? r.value?.add(e) : void o.push(e);
582
621
  }
583
622
  function h(e, t) {
584
- return d ? a.value?.add(e, t) : void l.push([e, t]);
623
+ return d ? r.value?.add(e, t) : void l.push([e, t]);
585
624
  }
586
625
  function g(e) {
587
- return d ? a.value?.addOnce(e) : void u.push(e);
626
+ return d ? r.value?.addOnce(e) : void u.push(e);
588
627
  }
589
628
  function _(e) {
590
- return a.value?.keepTime(e);
629
+ return r.value?.keepTime(e);
591
630
  }
592
631
  function v() {
593
- return a.value?.revert();
632
+ return r.value?.revert();
594
633
  }
595
- function x() {
596
- return a.value?.refresh();
634
+ function y() {
635
+ return r.value?.refresh();
597
636
  }
598
637
  return {
599
- scope: r(a),
638
+ scope: i(r),
600
639
  add: m,
601
640
  registerMethod: h,
602
641
  addOnce: g,
603
642
  keepTime: _,
604
643
  revert: v,
605
- refresh: x
644
+ refresh: y
606
645
  };
607
646
  }
608
647
  //#endregion
648
+ //#region src/utils/kebab-case.ts
649
+ function L(e) {
650
+ return e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
651
+ }
652
+ //#endregion
653
+ //#region src/utils/initial-style.ts
654
+ function R(e) {
655
+ let t = {}, n = {};
656
+ for (let [r, i] of Object.entries(e ?? {})) {
657
+ let e = re(i);
658
+ if (e === void 0) continue;
659
+ let a = se[r] ?? r;
660
+ if (B.includes(a)) {
661
+ let t = oe(e, ae(a));
662
+ t !== void 0 && (n[a] = t);
663
+ } else r.startsWith("--") ? e !== "" && (t[r] = String(e)) : ce.has(r) ? z(e) && (t[L(r)] = String(e)) : typeof e == "string" && V.test(e) && (t[L(r)] = e);
664
+ }
665
+ let r = B.filter((e) => e in n).map((e) => `${e}(${n[e]})`).join(" ");
666
+ return r && (t.transform = r), t;
667
+ }
668
+ function re(e) {
669
+ if (Array.isArray(e)) return e.length === 2 ? ie(e[0]) : void 0;
670
+ if (typeof e == "object" && e && "from" in e) return ie(e.from);
671
+ }
672
+ function ie(e) {
673
+ return typeof e == "number" || typeof e == "string" ? e : void 0;
674
+ }
675
+ function z(e) {
676
+ return typeof e == "number" ? Number.isFinite(e) : le.test(e);
677
+ }
678
+ function ae(e) {
679
+ return e.startsWith("scale") ? "" : e.startsWith("rotate") || e.startsWith("skew") ? "deg" : "px";
680
+ }
681
+ function oe(e, t) {
682
+ return z(e) ? `${e}${t}` : typeof e == "string" && V.test(e) ? e : void 0;
683
+ }
684
+ var B = [
685
+ "perspective",
686
+ "translateX",
687
+ "translateY",
688
+ "translateZ",
689
+ "rotate",
690
+ "rotateX",
691
+ "rotateY",
692
+ "rotateZ",
693
+ "scale",
694
+ "scaleX",
695
+ "scaleY",
696
+ "scaleZ",
697
+ "skew",
698
+ "skewX",
699
+ "skewY"
700
+ ], se = {
701
+ x: "translateX",
702
+ y: "translateY",
703
+ z: "translateZ"
704
+ }, ce = /* @__PURE__ */ new Set([
705
+ "opacity",
706
+ "zIndex",
707
+ "order",
708
+ "flexGrow",
709
+ "flexShrink",
710
+ "fontWeight"
711
+ ]), le = /^-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i, V = /^-?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?([a-z]+|%)$/i, H = "data-anime-ssr", U = "data-anime-ssr-attrs";
712
+ function W({ style: e = {}, attrs: t = {} }) {
713
+ let n = {}, r = Object.keys(e), i = Object.keys(t);
714
+ return r.length && (n.style = e, n[H] = r.join(",")), i.length && (Object.assign(n, t), n[U] = i.join(",")), n;
715
+ }
716
+ function G(e, t) {
717
+ let n = e.getAttribute(H);
718
+ if (n !== null) {
719
+ let r = ue(t?.style);
720
+ for (let t of n.split(",")) {
721
+ let n = r.getPropertyValue(t);
722
+ n ? e.style.setProperty(t, n, r.getPropertyPriority(t)) : e.style.removeProperty(t);
723
+ }
724
+ e.removeAttribute(H);
725
+ }
726
+ let r = e.getAttribute(U);
727
+ if (r !== null) {
728
+ for (let n of r.split(",")) {
729
+ let r = t?.[n];
730
+ r == null ? e.removeAttribute(n) : e.setAttribute(n, String(r));
731
+ }
732
+ e.removeAttribute(U);
733
+ }
734
+ }
735
+ function ue(e) {
736
+ let t = document.createElement("div").style, n = r(e);
737
+ if (typeof n == "string") t.cssText = n;
738
+ else if (n) for (let [e, r] of Object.entries(n)) r != null && t.setProperty(e.startsWith("--") ? e : L(e), String(r));
739
+ return t;
740
+ }
741
+ //#endregion
609
742
  //#region src/directives/v-animate.ts
610
- var L = /* @__PURE__ */ new WeakMap(), R = {
743
+ var K = /* @__PURE__ */ new WeakMap(), de = {
744
+ getSSRProps(e) {
745
+ return W({ style: R(e.value) });
746
+ },
747
+ created(e, t, n) {
748
+ G(e, n.props);
749
+ },
611
750
  mounted(e, t) {
612
- t.value && L.set(e, c(e, t.value));
751
+ t.value && K.set(e, l(e, t.value));
613
752
  },
614
753
  updated(e, t) {
615
754
  if (t.value === t.oldValue) return;
616
- let n = L.get(e);
617
- n?.cancel(), n?.revert(), t.value && L.set(e, c(e, t.value));
755
+ let n = K.get(e);
756
+ n?.cancel(), n?.revert(), t.value && K.set(e, l(e, t.value));
618
757
  },
619
758
  unmounted(e) {
620
- let t = L.get(e);
621
- t?.cancel(), t?.revert(), L.delete(e);
759
+ let t = K.get(e);
760
+ t?.cancel(), t?.revert(), K.delete(e);
622
761
  }
623
- }, z = /* @__PURE__ */ new WeakMap(), B = {
762
+ }, q = /* @__PURE__ */ new WeakMap(), fe = {
624
763
  mounted(e, t) {
625
- z.set(e, u(e, t.value ?? {}));
764
+ q.set(e, d(e, t.value ?? {}));
626
765
  },
627
766
  updated(e, t) {
628
- t.value !== t.oldValue && (z.get(e)?.revert(), z.set(e, u(e, t.value ?? {})));
767
+ t.value !== t.oldValue && (q.get(e)?.revert(), q.set(e, d(e, t.value ?? {})));
629
768
  },
630
769
  unmounted(e) {
631
- z.get(e)?.revert(), z.delete(e);
770
+ q.get(e)?.revert(), q.delete(e);
632
771
  }
633
- }, V = /* @__PURE__ */ new WeakMap();
634
- function H(e, t) {
635
- let n = g.createDrawable(e)[0];
772
+ };
773
+ //#endregion
774
+ //#region src/utils/initial-draw.ts
775
+ function pe(e) {
776
+ let [t, n] = he(me(e?.draw)), r = t * -J, i = n * J + r, a = J + (t === 0 && n === 1 || t === 1 && n === 0 ? 0 : 10) - i, o = R(e);
777
+ return t === n && (o["stroke-linecap"] = "butt"), {
778
+ attrs: {
779
+ pathLength: `${J}`,
780
+ "stroke-dasharray": `${i} ${a}`,
781
+ "stroke-dashoffset": `${r}`
782
+ },
783
+ style: o
784
+ };
785
+ }
786
+ function me(e) {
787
+ return Array.isArray(e) ? e.length >= 2 && typeof e[0] == "string" ? e[0] : Y : typeof e == "object" && e && "from" in e && typeof e.from == "string" ? e.from : Y;
788
+ }
789
+ function he(e) {
790
+ let t = e.trim().split(/\s+/), n = +t[0], r = +t[1];
791
+ return Number.isFinite(n) && Number.isFinite(r) ? [n, r] : [0, 0];
792
+ }
793
+ var J = 1e3, Y = "0 0", X = /* @__PURE__ */ new WeakMap();
794
+ function Z(e, t) {
795
+ let n = v.createDrawable(e)[0];
636
796
  return {
637
797
  drawable: n,
638
- animation: t ? c(n, t) : void 0
798
+ animation: t ? l(n, t) : void 0
639
799
  };
640
800
  }
641
- var U = {
801
+ var ge = {
802
+ getSSRProps(e) {
803
+ return W(pe(e.value));
804
+ },
805
+ created(e, t, n) {
806
+ G(e, n.props);
807
+ },
642
808
  mounted(e, t) {
643
- V.set(e, H(e, t.value));
809
+ X.set(e, Z(e, t.value));
644
810
  },
645
811
  updated(e, t) {
646
812
  if (t.value === t.oldValue) return;
647
- let n = V.get(e);
648
- n?.animation?.cancel(), n?.animation?.revert(), V.set(e, H(e, t.value));
813
+ let n = X.get(e);
814
+ n?.animation?.cancel(), n?.animation?.revert(), X.set(e, Z(e, t.value));
649
815
  },
650
816
  unmounted(e) {
651
- let t = V.get(e);
652
- t?.animation?.cancel(), t?.animation?.revert(), V.delete(e);
817
+ let t = X.get(e);
818
+ t?.animation?.cancel(), t?.animation?.revert(), X.delete(e);
653
819
  }
654
- }, W = /* @__PURE__ */ new WeakMap(), G = {
820
+ }, Q = /* @__PURE__ */ new WeakMap();
821
+ function _e(e, t) {
822
+ let n = e.style.cssText;
823
+ return {
824
+ animation: y.animate(e, t),
825
+ originalStyle: n
826
+ };
827
+ }
828
+ var ve = {
829
+ getSSRProps(e) {
830
+ return W({ style: R(e.value) });
831
+ },
832
+ created(e, t, n) {
833
+ G(e, n.props);
834
+ },
655
835
  mounted(e, t) {
656
- t.value && W.set(e, {
657
- animation: _.animate(e, t.value),
658
- originalStyle: e.style.cssText
659
- });
836
+ t.value && Q.set(e, _e(e, t.value));
660
837
  },
661
838
  updated(e, t) {
662
839
  if (t.value === t.oldValue) return;
663
- let n = W.get(e);
664
- n && (n.animation.cancel(), e.style.cssText = n.originalStyle, W.delete(e)), t.value && W.set(e, {
665
- animation: _.animate(e, t.value),
666
- originalStyle: e.style.cssText
667
- });
840
+ let n = Q.get(e);
841
+ n && (n.animation.cancel(), e.style.cssText = n.originalStyle, Q.delete(e)), t.value && Q.set(e, _e(e, t.value));
668
842
  },
669
843
  unmounted(e) {
670
- let t = W.get(e);
671
- t && (t.animation.cancel(), e.style.cssText = t.originalStyle, W.delete(e));
844
+ let t = Q.get(e);
845
+ t && (t.animation.cancel(), e.style.cssText = t.originalStyle, Q.delete(e));
672
846
  }
673
- }, K = /* @__PURE__ */ new WeakMap();
674
- function q(e, t) {
675
- let { animation: n, ...r } = t ?? {}, i = h(e, r), a = {
676
- splitter: i,
847
+ }, $ = /* @__PURE__ */ new WeakMap();
848
+ function ye(e, t, n) {
849
+ let { animation: r, ssrHidden: i, ...a } = t ?? {}, o = _(e, a), s = {
850
+ splitter: o,
677
851
  animation: void 0
678
852
  };
679
- if (n) {
680
- if (r.lines) (document.fonts?.ready ?? Promise.resolve()).then(() => {
681
- K.get(e) === a && (a.animation = c(i.lines, n));
853
+ if (r) {
854
+ if (a.lines) (document.fonts?.ready ?? Promise.resolve()).then(() => {
855
+ $.get(e) === s && (s.animation = l(o.lines, r), G(e, n));
682
856
  });
683
857
  else {
684
- let e = r.chars ? i.chars : i.words;
685
- a.animation = c(e, n);
858
+ let t = a.chars ? o.chars : o.words;
859
+ s.animation = l(t, r), G(e, n);
686
860
  }
687
- }
688
- return a;
861
+ } else G(e, n);
862
+ return s;
689
863
  }
690
- function J(e) {
864
+ function be(e) {
691
865
  e.animation?.cancel(), e.splitter.revert();
692
866
  }
693
- var Y = {
694
- mounted(e, t) {
695
- K.set(e, q(e, t.value));
867
+ var xe = {
868
+ getSSRProps(e) {
869
+ return e.value?.ssrHidden ? W({ style: { visibility: "hidden" } }) : {};
696
870
  },
697
- updated(e, t) {
871
+ created() {},
872
+ mounted(e, t, n) {
873
+ $.set(e, ye(e, t.value, n.props));
874
+ },
875
+ updated(e, t, n) {
698
876
  if (t.value === t.oldValue) return;
699
- let n = K.get(e);
700
- n && J(n), K.set(e, q(e, t.value));
877
+ let r = $.get(e);
878
+ r && be(r), $.set(e, ye(e, t.value, n.props));
701
879
  },
702
880
  unmounted(e) {
703
- let t = K.get(e);
704
- t && J(t), K.delete(e);
881
+ let t = $.get(e);
882
+ t && be(t), $.delete(e);
705
883
  }
706
884
  };
707
885
  //#endregion
708
- export { D as useAnimatable, C as useAnimate, k as useDraggable, A as useLayout, O as useRawAnimatable, w as useRawAnimate, I as useScope, j as useSvg, M as useSvgDrawable, N as useText, E as useTimeline, T as useTimer, P as useWaapi, R as vAnimate, B as vDraggable, U as vSvgDrawable, Y as vTextSplit, G as vWaapi };
886
+ export { k as useAnimatable, T as useAnimate, te as useDraggable, A as useLayout, ee as useRawAnimatable, E as useRawAnimate, ne as useScope, j as useScroll, M as useSvg, N as useSvgDrawable, P as useText, O as useTimeline, D as useTimer, F as useWaapi, de as vAnimate, fe as vDraggable, ge as vSvgDrawable, xe as vTextSplit, ve as vWaapi };
709
887
 
710
888
  //# sourceMappingURL=index.js.map