@ssgoi/core 2.1.0 → 2.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.
Files changed (54) hide show
  1. package/README.md +10 -11
  2. package/dist/animator.d.ts.map +1 -1
  3. package/dist/create-ssgoi-transition-context.d.ts.map +1 -1
  4. package/dist/create-transition-callback.d.ts.map +1 -1
  5. package/dist/index.cjs +2 -1
  6. package/dist/index.js +204 -126
  7. package/dist/transition-strategy.d.ts +5 -0
  8. package/dist/transition-strategy.d.ts.map +1 -1
  9. package/dist/transition.d.ts.map +1 -1
  10. package/dist/transitions/blur.d.ts.map +1 -1
  11. package/dist/transitions/bounce.d.ts +1 -1
  12. package/dist/transitions/bounce.d.ts.map +1 -1
  13. package/dist/transitions/fly.d.ts.map +1 -1
  14. package/dist/transitions/index.cjs +1 -1
  15. package/dist/transitions/index.d.ts +1 -0
  16. package/dist/transitions/index.d.ts.map +1 -1
  17. package/dist/transitions/index.js +175 -119
  18. package/dist/transitions/mask.d.ts +31 -0
  19. package/dist/transitions/mask.d.ts.map +1 -0
  20. package/dist/transitions/none.d.ts.map +1 -1
  21. package/dist/transitions/rotate.d.ts +1 -1
  22. package/dist/transitions/scale.d.ts +1 -1
  23. package/dist/transitions/slide.d.ts +2 -2
  24. package/dist/transitions/slide.d.ts.map +1 -1
  25. package/dist/types.d.ts.map +1 -1
  26. package/dist/utils/get-rect.d.ts +7 -0
  27. package/dist/utils/get-rect.d.ts.map +1 -0
  28. package/dist/utils/get-scrolling-element.d.ts +6 -0
  29. package/dist/utils/get-scrolling-element.d.ts.map +1 -0
  30. package/dist/utils/index.d.ts +6 -0
  31. package/dist/utils/index.d.ts.map +1 -0
  32. package/dist/utils/parse-caller-location.d.ts +6 -0
  33. package/dist/utils/parse-caller-location.d.ts.map +1 -0
  34. package/dist/utils/prepare-outgoing.d.ts +6 -0
  35. package/dist/utils/prepare-outgoing.d.ts.map +1 -0
  36. package/dist/utils/sleep.d.ts +7 -0
  37. package/dist/utils/sleep.d.ts.map +1 -0
  38. package/dist/utils.d.ts.map +1 -1
  39. package/dist/view-transitions/blind.d.ts +13 -0
  40. package/dist/view-transitions/blind.d.ts.map +1 -0
  41. package/dist/view-transitions/fade.d.ts.map +1 -1
  42. package/dist/view-transitions/hero.d.ts.map +1 -1
  43. package/dist/view-transitions/index.cjs +30 -1
  44. package/dist/view-transitions/index.d.ts +2 -0
  45. package/dist/view-transitions/index.d.ts.map +1 -1
  46. package/dist/view-transitions/index.js +371 -217
  47. package/dist/view-transitions/pinterest.d.ts.map +1 -1
  48. package/dist/view-transitions/slide.d.ts +8 -0
  49. package/dist/view-transitions/slide.d.ts.map +1 -0
  50. package/package.json +14 -9
  51. package/dist/utils-8Eptbv7c.cjs +0 -2
  52. package/dist/utils-DTRMUQW4.js +0 -31
  53. package/dist/view-transitions/ripple.d.ts +0 -7
  54. package/dist/view-transitions/ripple.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,9 +1,8 @@
1
- var M = Object.defineProperty;
2
- var x = (i, t, o) => t in i ? M(i, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[t] = o;
1
+ var _ = Object.defineProperty;
2
+ var x = (i, t, o) => t in i ? _(i, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[t] = o;
3
3
  var g = (i, t, o) => x(i, typeof t != "symbol" ? t + "" : t, o);
4
- import { animate as E } from "popmotion";
5
- import { p as U, g as _ } from "./utils-DTRMUQW4.js";
6
- class V {
4
+ import { animate as O } from "popmotion";
5
+ class A {
7
6
  constructor(t) {
8
7
  g(this, "options");
9
8
  g(this, "currentValue");
@@ -23,38 +22,38 @@ class V {
23
22
  return;
24
23
  }
25
24
  let n = this.currentValue, e = performance.now();
26
- const m = {
25
+ const u = {
27
26
  from: this.currentValue,
28
27
  to: o,
29
28
  stiffness: this.options.spring.stiffness,
30
29
  damping: this.options.spring.damping,
31
30
  mass: 1
32
31
  };
33
- typeof this.velocity == "number" && (m.velocity = this.velocity * 1e3), this.controls = E({
34
- ...m,
35
- onUpdate: (a) => {
32
+ typeof this.velocity == "number" && (u.velocity = this.velocity * 1e3), this.controls = O({
33
+ ...u,
34
+ onUpdate: (s) => {
36
35
  const f = performance.now(), h = (f - e) / 1e3;
37
36
  if (h > 0) {
38
- if (typeof a == "number" && typeof n == "number") {
39
- const c = (a - n) / h;
40
- this.velocity = c / 1e3;
41
- } else if (typeof a == "object" && a !== null) {
42
- const c = {};
43
- Object.keys(a).forEach((u) => {
44
- const r = a[u], s = n[u];
45
- if (typeof r == "number" && typeof s == "number") {
46
- const p = (r - s) / h;
47
- c[u] = p / 1e3;
37
+ if (typeof s == "number" && typeof n == "number") {
38
+ const a = (s - n) / h;
39
+ this.velocity = a / 1e3;
40
+ } else if (typeof s == "object" && s !== null) {
41
+ const a = {};
42
+ Object.keys(s).forEach((m) => {
43
+ const r = s[m], c = n[m];
44
+ if (typeof r == "number" && typeof c == "number") {
45
+ const p = (r - c) / h;
46
+ a[m] = p / 1e3;
48
47
  }
49
- }), this.velocity = c;
48
+ }), this.velocity = a;
50
49
  }
51
- n = a, e = f;
50
+ n = s, e = f;
52
51
  }
53
- this.currentValue = a, this.options.onUpdate(a);
52
+ this.currentValue = s, this.options.onUpdate(s);
54
53
  },
55
54
  onComplete: () => {
56
- this.currentValue = o, this.isAnimating = !1, this.controls = null, typeof this.velocity == "object" && this.velocity !== null ? Object.keys(this.velocity).forEach((a) => {
57
- this.velocity[a] = 0;
55
+ this.currentValue = o, this.isAnimating = !1, this.controls = null, typeof this.velocity == "object" && this.velocity !== null ? Object.keys(this.velocity).forEach((s) => {
56
+ this.velocity[s] = 0;
58
57
  }) : this.velocity = 0, this.options.onComplete();
59
58
  }
60
59
  });
@@ -62,46 +61,48 @@ class V {
62
61
  g(this, "animateObject", (t, o) => {
63
62
  const n = this.currentValue, e = Object.keys(n);
64
63
  this.animationMap = /* @__PURE__ */ new Map(), this.activeAnimations.clear(), this.completedAnimations.clear(), this.updatedProperties.clear();
65
- const m = { ...n }, a = {};
64
+ const u = { ...n }, s = {};
66
65
  let f = !1;
67
66
  const h = () => {
68
- const c = e.filter((r) => !this.completedAnimations.has(r));
69
- if (c.every((r) => this.updatedProperties.has(r)) && c.length > 0) {
67
+ const a = e.filter((r) => !this.completedAnimations.has(r));
68
+ if (a.every(
69
+ (r) => this.updatedProperties.has(r)
70
+ ) && a.length > 0) {
70
71
  if (typeof this.velocity == "object" && this.velocity) {
71
72
  const r = performance.now();
72
- Object.keys(m).forEach((s) => {
73
- if (a[s]) {
74
- const p = (r - a[s]) / 1e3, l = this.currentValue[s], d = m[s];
75
- typeof l == "number" && typeof d == "number" && p > 0 && (this.velocity[s] = (d - l) / p / 1e3);
73
+ Object.keys(u).forEach((c) => {
74
+ if (s[c]) {
75
+ const p = (r - s[c]) / 1e3, l = this.currentValue[c], d = u[c];
76
+ typeof l == "number" && typeof d == "number" && p > 0 && (this.velocity[c] = (d - l) / p / 1e3);
76
77
  }
77
- a[s] = r;
78
+ s[c] = r;
78
79
  });
79
80
  }
80
- this.currentValue = { ...m }, this.options.onUpdate(this.currentValue), this.updatedProperties.clear(), !f && this.options.onStart && (f = !0, this.options.onStart());
81
+ this.currentValue = { ...u }, this.options.onUpdate(this.currentValue), this.updatedProperties.clear(), !f && this.options.onStart && (f = !0, this.options.onStart());
81
82
  }
82
83
  };
83
- e.forEach((c) => {
84
- this.activeAnimations.add(c);
85
- const u = {
86
- from: n[c],
87
- to: t[c],
84
+ e.forEach((a) => {
85
+ this.activeAnimations.add(a);
86
+ const m = {
87
+ from: n[a],
88
+ to: t[a],
88
89
  stiffness: this.options.spring.stiffness,
89
90
  damping: this.options.spring.damping,
90
91
  mass: 1
91
92
  };
92
- typeof this.velocity == "object" && this.velocity && c in this.velocity && (u.velocity = this.velocity[c] * 1e3);
93
- const r = E({
94
- ...u,
95
- onUpdate: (s) => {
96
- m[c] = s, this.updatedProperties.add(c), h();
93
+ typeof this.velocity == "object" && this.velocity && a in this.velocity && (m.velocity = this.velocity[a] * 1e3);
94
+ const r = O({
95
+ ...m,
96
+ onUpdate: (c) => {
97
+ u[a] = c, this.updatedProperties.add(a), h();
97
98
  },
98
99
  onComplete: () => {
99
- this.completedAnimations.add(c), this.updatedProperties.delete(c), this.completedAnimations.size === e.length && (this.currentValue = t, this.isAnimating = !1, this.animationMap = null, typeof this.velocity == "object" && this.velocity && Object.keys(this.velocity).forEach((s) => {
100
- this.velocity[s] = 0;
100
+ this.completedAnimations.add(a), this.updatedProperties.delete(a), this.completedAnimations.size === e.length && (this.currentValue = t, this.isAnimating = !1, this.animationMap = null, typeof this.velocity == "object" && this.velocity && Object.keys(this.velocity).forEach((c) => {
101
+ this.velocity[c] = 0;
101
102
  }), this.options.onComplete());
102
103
  }
103
104
  });
104
- this.animationMap.set(c, r);
105
+ this.animationMap.set(a, r);
105
106
  });
106
107
  });
107
108
  if (this.options = {
@@ -177,23 +178,23 @@ class V {
177
178
  }
178
179
  // Static factory method
179
180
  static fromState(t, o) {
180
- const n = new V(o);
181
+ const n = new A(o);
181
182
  return n.setValue(t.position), n.setVelocity(t.velocity), n;
182
183
  }
183
184
  }
184
- const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
185
+ const j = Symbol.for("TRANSITION_STRATEGY"), U = (i) => ({
185
186
  runIn: async (t) => {
186
187
  const { currentAnimation: o } = i;
187
188
  if (o && o.direction === "out") {
188
- const a = o.animator.getCurrentState();
189
+ const s = o.animator.getCurrentState();
189
190
  if (o.animator.stop(), t.out) {
190
- const f = await t.out, { from: h = 1, to: c = 0 } = f;
191
+ const f = await t.out, { from: h = 1, to: a = 0 } = f;
191
192
  return {
192
193
  config: f,
193
- state: a,
194
+ state: s,
194
195
  from: h,
195
196
  // OUT animation's from
196
- to: c,
197
+ to: a,
197
198
  // OUT animation's to
198
199
  direction: "backward"
199
200
  // Will actually go 0→1
@@ -211,7 +212,7 @@ const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
211
212
  to: 1,
212
213
  direction: "forward"
213
214
  };
214
- const { from: e = 0, to: m = 1 } = n;
215
+ const { from: e = 0, to: u = 1 } = n;
215
216
  return {
216
217
  config: n,
217
218
  state: {
@@ -219,25 +220,25 @@ const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
219
220
  velocity: 0
220
221
  },
221
222
  from: e,
222
- to: m,
223
+ to: u,
223
224
  direction: "forward"
224
225
  };
225
226
  },
226
227
  runOut: async (t) => {
227
228
  const { currentAnimation: o } = i;
228
229
  if (o && o.direction === "in") {
229
- const a = o.animator.getCurrentState();
230
+ const s = o.animator.getCurrentState();
230
231
  if (o.animator.stop(), t.in) {
231
- const f = await t.in, { from: h = 0, to: c = 1 } = f;
232
+ const f = await t.in, { from: h = 0, to: a = 1 } = f;
232
233
  return {
233
234
  config: f,
234
235
  state: {
235
- position: a.position,
236
- velocity: a.velocity
236
+ position: s.position,
237
+ velocity: s.velocity
237
238
  },
238
239
  from: h,
239
240
  // IN animation's from
240
- to: c,
241
+ to: a,
241
242
  // IN animation's to
242
243
  direction: "backward"
243
244
  // Will actually go 1→0
@@ -255,7 +256,7 @@ const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
255
256
  to: 0,
256
257
  direction: "forward"
257
258
  };
258
- const { from: e = 1, to: m = 0 } = n;
259
+ const { from: e = 1, to: u = 0 } = n;
259
260
  return {
260
261
  config: n,
261
262
  state: {
@@ -263,29 +264,78 @@ const k = Symbol.for("TRANSITION_STRATEGY"), I = (i) => ({
263
264
  velocity: 0
264
265
  },
265
266
  from: e,
266
- to: m,
267
+ to: u,
268
+ direction: "forward"
269
+ };
270
+ }
271
+ }), I = (i) => ({
272
+ runIn: async (t) => {
273
+ const o = await t.in;
274
+ if (!o)
275
+ return {
276
+ state: {
277
+ position: 0,
278
+ velocity: 0
279
+ },
280
+ from: 0,
281
+ to: 1,
282
+ direction: "forward"
283
+ };
284
+ const { from: n = 0, to: e = 1 } = o;
285
+ return {
286
+ config: o,
287
+ state: {
288
+ position: n,
289
+ velocity: 0
290
+ },
291
+ from: n,
292
+ to: e,
293
+ direction: "forward"
294
+ };
295
+ },
296
+ runOut: async (t) => {
297
+ const o = await t.out;
298
+ if (!o)
299
+ return {
300
+ state: {
301
+ position: 1,
302
+ velocity: 0
303
+ },
304
+ from: 1,
305
+ to: 0,
306
+ direction: "forward"
307
+ };
308
+ const { from: n = 1, to: e = 0 } = o;
309
+ return {
310
+ config: o,
311
+ state: {
312
+ position: n,
313
+ velocity: 0
314
+ },
315
+ from: n,
316
+ to: e,
267
317
  direction: "forward"
268
318
  };
269
319
  }
270
320
  });
271
- function D(i, t) {
272
- var u;
273
- let o = null, n = null, e = null, m = null;
274
- const a = {
321
+ function N(i, t) {
322
+ var m;
323
+ let o = null, n = null, e = null, u = null;
324
+ const s = {
275
325
  get currentAnimation() {
276
326
  return o;
277
327
  }
278
- }, f = ((u = t == null ? void 0 : t.strategy) == null ? void 0 : u.call(t, a)) || I(a), h = async (r) => {
328
+ }, f = ((m = t == null ? void 0 : t.strategy) == null ? void 0 : m.call(t, s)) || U(s), h = async (r) => {
279
329
  var y, S;
280
330
  n && (n.remove(), n = null);
281
- const s = i(), p = {
282
- in: s.in && Promise.resolve(s.in(r)),
283
- out: s.out && Promise.resolve(s.out(r))
331
+ const c = i(), p = {
332
+ in: c.in && Promise.resolve(c.in(r)),
333
+ out: c.out && Promise.resolve(c.out(r))
284
334
  }, l = await f.runIn(p);
285
335
  if (!l.config)
286
336
  return;
287
337
  (S = (y = l.config).prepare) == null || S.call(y, r), l.config.wait && await l.config.wait();
288
- const d = V.fromState(l.state, {
338
+ const d = A.fromState(l.state, {
289
339
  from: l.from,
290
340
  to: l.to,
291
341
  spring: l.config.spring,
@@ -297,85 +347,107 @@ function D(i, t) {
297
347
  }
298
348
  });
299
349
  o = { animator: d, direction: "in" }, l.direction === "forward" ? d.forward() : d.backward();
300
- }, c = async (r) => {
350
+ }, a = async (r) => {
301
351
  var S, v;
302
352
  n = r;
303
- const s = i(), p = {
304
- in: s.in && Promise.resolve(s.in(r)),
305
- out: s.out && Promise.resolve(s.out(r))
353
+ const c = i(), p = {
354
+ in: c.in && Promise.resolve(c.in(r)),
355
+ out: c.out && Promise.resolve(c.out(r))
306
356
  }, l = await f.runOut(p);
307
357
  if (!l.config)
308
358
  return;
309
359
  (v = (S = l.config).prepare) == null || v.call(S, r), y(), l.config.wait && await l.config.wait();
310
- const d = V.fromState(l.state, {
360
+ const d = A.fromState(l.state, {
311
361
  from: l.from,
312
362
  to: l.to,
313
363
  spring: l.config.spring,
314
364
  onStart: l.config.onStart,
315
365
  onUpdate: l.config.tick,
316
366
  onComplete: () => {
317
- var w, T, O;
318
- (T = (w = l.config) == null ? void 0 : w.onEnd) == null || T.call(w), n && (n.remove(), n = null), o = null, (O = t == null ? void 0 : t.onCleanupEnd) == null || O.call(t);
367
+ var w, T, E;
368
+ (T = (w = l.config) == null ? void 0 : w.onEnd) == null || T.call(w), n && (n.remove(), n = null), o = null, (E = t == null ? void 0 : t.onCleanupEnd) == null || E.call(t);
319
369
  }
320
370
  });
321
371
  o = { animator: d, direction: "out" }, l.direction === "forward" ? d.forward() : d.backward();
322
372
  function y() {
323
- !e || !n || (m && e.contains(m) ? e.insertBefore(n, m) : e.appendChild(n));
373
+ !e || !n || (u && e.contains(u) ? e.insertBefore(n, u) : e.appendChild(n));
324
374
  }
325
375
  };
326
376
  return (r) => {
327
377
  if (r)
328
- return e = r.parentElement, m = r.nextElementSibling, h(r), () => {
329
- const s = r.cloneNode(!0);
330
- c(s);
378
+ return e = r.parentElement, u = r.nextElementSibling, h(r), () => {
379
+ const c = r.cloneNode(!0);
380
+ a(c);
331
381
  };
332
382
  };
333
383
  }
334
- const A = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
335
- function N(i, t, o) {
336
- A.set(i, t);
384
+ const D = 3, k = (i) => {
385
+ if (!i) return null;
386
+ const t = i.split(`
387
+ `).map((o) => o.trim());
388
+ for (let o = D; o < Math.min(t.length, 6); o++) {
389
+ const n = t[o], e = n == null ? void 0 : n.match(/\(?([^):]+):(\d+):(\d+)\)?$/);
390
+ if (!e)
391
+ continue;
392
+ const u = e[1] ?? "", s = e[2] ?? "0", f = e[3] ?? "0";
393
+ return { file: u.split(/[\\/]/).pop() || u, line: s, column: f };
394
+ }
395
+ return null;
396
+ }, V = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map();
397
+ function $(i, t, o) {
398
+ V.set(i, t);
337
399
  let n = C.get(i);
338
- return n || (n = D(
400
+ return n || (n = N(
339
401
  () => {
340
- const e = A.get(i);
402
+ const e = V.get(i);
341
403
  return e || (console.warn(`Transition "${String(i)}" not found`), {});
342
404
  },
343
405
  {
344
406
  strategy: o,
345
- onCleanupEnd: () => P(i)
407
+ onCleanupEnd: () => M(i)
346
408
  }
347
409
  ), C.set(i, n), n);
348
410
  }
349
- function P(i) {
350
- A.delete(i), C.delete(i);
411
+ function M(i) {
412
+ V.delete(i), C.delete(i);
351
413
  }
352
- function $() {
353
- const i = U(new Error().stack);
414
+ function F() {
415
+ const i = k(new Error().stack);
354
416
  return i ? `auto_${i.file}_${i.line}_${i.column}` : Symbol(`ssgoi_auto_${Date.now()}`);
355
417
  }
356
- const R = globalThis.FinalizationRegistry, j = R ? new R((i) => {
418
+ const R = globalThis.FinalizationRegistry, P = R ? new R((i) => {
357
419
  try {
358
- P(i);
420
+ M(i);
359
421
  } catch {
360
422
  }
361
423
  }) : void 0;
362
- function Y(i) {
363
- const t = i.key ?? $();
364
- if (i.ref && j)
424
+ function H(i) {
425
+ const t = i.key ?? F();
426
+ if (i.ref && P)
365
427
  try {
366
- j.register(i.ref, t);
428
+ P.register(i.ref, t);
367
429
  } catch {
368
430
  }
369
- return N(
431
+ return $(
370
432
  t,
371
433
  {
372
434
  in: i.in,
373
435
  out: i.out
374
436
  },
375
- i[k]
437
+ i[j]
376
438
  );
377
439
  }
378
- function F(i) {
440
+ const K = (i) => {
441
+ let t = i.parentElement;
442
+ for (; t && t !== document.body; ) {
443
+ const o = window.getComputedStyle(t), n = o.overflow + o.overflowY + o.overflowX;
444
+ if (n.includes("auto") || n.includes("scroll") || t.scrollHeight > t.clientHeight || t.scrollWidth > t.clientWidth)
445
+ return t;
446
+ t = t.parentElement;
447
+ }
448
+ return document.documentElement;
449
+ };
450
+ function W(i) {
379
451
  const t = i.filter((o) => o.symmetric).map((o) => ({
380
452
  from: o.to,
381
453
  to: o.from,
@@ -394,39 +466,42 @@ function L() {
394
466
  });
395
467
  };
396
468
  return {
397
- startScrollTracking: (a, f) => {
398
- i || (i = _(a), (i === document.documentElement ? window : i).addEventListener("scroll", n, {
469
+ startScrollTracking: (s, f) => {
470
+ i || (i = K(s), (i === document.documentElement ? window : i).addEventListener("scroll", n, {
399
471
  passive: !0
400
472
  })), o = f;
401
473
  },
402
- calculateScrollOffset: (a, f) => {
403
- const h = a && t.has(a) ? t.get(a) : { x: 0, y: 0 }, c = f && t.has(f) ? t.get(f) : { x: 0, y: 0 };
474
+ calculateScrollOffset: (s, f) => {
475
+ const h = s && t.has(s) ? t.get(s) : { x: 0, y: 0 }, a = f && t.has(f) ? t.get(f) : { x: 0, y: 0 };
404
476
  return {
405
- x: -c.x + h.x,
406
- y: -c.y + h.y
477
+ x: -a.x + h.x,
478
+ y: -a.y + h.y
407
479
  };
408
480
  }
409
481
  };
410
482
  }
411
- function B(i) {
483
+ function X(i) {
412
484
  const {
413
485
  transitions: t = [],
414
486
  defaultTransition: o,
415
- middleware: n = (u, r) => ({ from: u, to: r })
487
+ middleware: n = (m, r) => ({ from: m, to: r })
416
488
  // Identity function as default
417
489
  } = i;
418
490
  let e = null;
419
- const m = F(t), { startScrollTracking: a, calculateScrollOffset: f } = L();
491
+ const u = W(t), { startScrollTracking: s, calculateScrollOffset: f } = L();
420
492
  function h() {
421
493
  if (e != null && e.from && (e != null && e.to)) {
422
- const { from: u, to: r } = n(
494
+ const { from: m, to: r } = n(
423
495
  e.from,
424
496
  e.to
425
497
  ), p = z(
426
- u,
498
+ m,
427
499
  r,
428
- m
429
- ) || o, d = { scrollOffset: f(e.from, e.to) };
500
+ u
501
+ ) || o, d = { scrollOffset: f(
502
+ e.from,
503
+ e.to
504
+ ) };
430
505
  p && (p.out && e.outResolve && e.outResolve(
431
506
  (y) => p.out(y, d)
432
507
  ), p.in && e.inResolve && e.inResolve(
@@ -434,15 +509,17 @@ function B(i) {
434
509
  )), e = null;
435
510
  }
436
511
  }
437
- const c = async (u, r) => r === "in" && (!e || !e.from) ? () => ({}) : (e || (e = {}), r === "out" ? (e.from = u, new Promise((s) => {
438
- e.outResolve = s, h();
439
- })) : (e.to = u, new Promise((s) => {
440
- e.inResolve = s, h();
512
+ const a = async (m, r) => r === "in" && (!e || !e.from) ? () => ({}) : (e || (e = {}), r === "out" ? (e.from = m, new Promise((c) => {
513
+ e.outResolve = c, h();
514
+ })) : (e.to = m, new Promise((c) => {
515
+ e.inResolve = c, h();
441
516
  })));
442
- return (u) => ({
443
- key: u,
444
- in: async (r) => (a(r, u), (await c(u, "in"))(r)),
445
- out: async (r) => (await c(u, "out"))(r)
517
+ return (m) => ({
518
+ key: m,
519
+ in: async (r) => (s(r, m), (await a(m, "in"))(r)),
520
+ out: async (r) => (await a(m, "out"))(r),
521
+ // Add page transition strategy for page-level transitions
522
+ [j]: I
446
523
  });
447
524
  }
448
525
  function z(i, t, o) {
@@ -464,9 +541,10 @@ function b(i, t) {
464
541
  return i === t;
465
542
  }
466
543
  export {
467
- k as TRANSITION_STRATEGY,
468
- I as createDefaultStrategy,
469
- B as createSggoiTransitionContext,
470
- $ as generateAutoKey,
471
- Y as transition
544
+ j as TRANSITION_STRATEGY,
545
+ U as createDefaultStrategy,
546
+ I as createPageTransitionStrategy,
547
+ X as createSggoiTransitionContext,
548
+ F as generateAutoKey,
549
+ H as transition
472
550
  };
@@ -57,4 +57,9 @@ export interface TransitionStrategy<TAnimationValue = number> {
57
57
  * - Cleanup callback: Handles exit transitions
58
58
  */
59
59
  export declare const createDefaultStrategy: <TAnimationValue = number>(context: StrategyContext<TAnimationValue>) => TransitionStrategy<TAnimationValue>;
60
+ /**
61
+ * Page transition strategy - Always starts fresh without checking current animations
62
+ * This is used for page-level transitions where each transition should be independent
63
+ */
64
+ export declare const createPageTransitionStrategy: <TAnimationValue = number>(_: StrategyContext<TAnimationValue>) => TransitionStrategy<TAnimationValue>;
60
65
  //# sourceMappingURL=transition-strategy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transition-strategy.d.ts","sourceRoot":"","sources":["../src/lib/transition-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,mBAAmB,eAAoC,CAAC;AAErE,MAAM,WAAW,eAAe,CAAC,eAAe,GAAG,MAAM;IAEvD,gBAAgB,EAAE;QAChB,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;QACpC,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;KACzB,GAAG,IAAI,CAAC;CACV;AAED,MAAM,WAAW,cAAc,CAAC,eAAe,GAAG,MAAM;IACtD,MAAM,CAAC,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAC3C,KAAK,EAAE;QACL,QAAQ,EAAE,eAAe,CAAC;QAC1B,QAAQ,EAAE,eAAe,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5E,CAAC;IACF,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB,CAAC,eAAe,GAAG,MAAM;IACzD,EAAE,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC;IAChD,GAAG,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,UAAU,CAAC,eAAe,GAAG,MAAM,EACjD,OAAO,EAAE,iBAAiB,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG;IACvD,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KAAK,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC5G,GACA,kBAAkB,CAmBpB"}
1
+ {"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../src/lib/transition.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgE7C,wBAAgB,eAAe,IAAI,aAAa,CAY/C;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,UAAU,CAAC,eAAe,GAAG,MAAM,EACjD,OAAO,EAAE,iBAAiB,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG;IACvD,CAAC,mBAAmB,CAAC,CAAC,EAAE,CACtB,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,KACtC,kBAAkB,CAAC,eAAe,CAAC,CAAC;CAC1C,GACA,kBAAkB,CAkBpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/blur.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB;;kBAe5B,WAAW;;wBArBb,MAAM;sBACR,MAAM;;yBAsBG,MAAM;;mBAmBV,WAAW;;wBA1Cd,MAAM;sBACR,MAAM;;yBA2CG,MAAM;;CAqB5B,CAAC"}
1
+ {"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/blur.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,IAAI,GAAI,UAAS,WAAgB;;kBAe5B,WAAW;;wBArBb,MAAM;sBACR,MAAM;;yBAsBG,MAAM;;mBAwBV,WAAW;;wBA/Cd,MAAM;sBACR,MAAM;;yBAgDG,MAAM;;CA0B5B,CAAC"}
@@ -4,7 +4,7 @@ interface BounceOptions {
4
4
  intensity?: number;
5
5
  scale?: boolean;
6
6
  fade?: boolean;
7
- direction?: 'up' | 'down';
7
+ direction?: "up" | "down";
8
8
  spring?: {
9
9
  stiffness?: number;
10
10
  damping?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"bounce.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/b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cd,MAAM;sBACR,MAAM;;yBAgDG,MAAM;;CA6B5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fly.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/fly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,UAAU;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,GAAG,GAAI,UAAS,UAAe;;kBAkB1B,WAAW;;wBAxBb,MAAM;sBACR,MAAM;;yBAyBG,MAAM;;mBAQV,WAAW;;wBAlCd,MAAM;sBACR,MAAM;;yBAmCG,MAAM;;CAU5B,CAAC"}
1
+ {"version":3,"file":"fly.d.ts","sourceRoot":"","sources":["../../src/lib/transitions/fly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,UAAU;IAClB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,GAAG,GAAI,UAAS,UAAe;;kBAkB1B,WAAW;;wBAxBb,MAAM;sBACR,MAAM;;yBAyBG,MAAM;;mBAcV,WAAW;;wBAxCd,MAAM;sBACR,MAAM;;yBAyCG,MAAM;;CAgB5B,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=($={})=>{const{from:n=0,to:s=1,spring:r={stiffness:300,damping:30},key:u}=$;return{in:l=>({spring:r,tick:y=>{const c=n+(s-n)*y;l.style.opacity=c.toString()}}),out:l=>({spring:r,tick:y=>{const c=n+(s-n)*y;l.style.opacity=c.toString()}}),...u&&{key:u}}},m=($={})=>{const{start:n=0,opacity:s=0,axis:r="both",spring:u={stiffness:300,damping:30},key:l}=$,y=c=>{switch(r){case"x":return`scaleX(${c})`;case"y":return`scaleY(${c})`;case"both":default:return`scale(${c})`}};return{in:c=>({spring:u,tick:t=>{const e=n+(1-n)*t;c.style.transform=y(e),c.style.opacity=(s+(1-s)*t).toString()}}),out:c=>({spring:u,tick:t=>{const e=n+(1-n)*t;c.style.transform=y(e),c.style.opacity=(s+(1-s)*t).toString()}}),...l&&{key:l}}},d=($={})=>{const{direction:n,distance:s=100,opacity:r=0,fade:u=!0,axis:l,spring:y={stiffness:400,damping:35},key:c}=$,e=n||(l==="x"?"left":l==="y"?"up":"left"),o=a=>typeof a=="number"?`${a}px`:a,f=a=>{const i=1-a,p=typeof s=="number"?i*s:`calc(${o(s)} * ${i})`;switch(e){case"left":return typeof s=="number"?`translateX(${-p}px)`:`translateX(calc(-1 * ${p}))`;case"right":return typeof s=="number"?`translateX(${p}px)`:`translateX(${p})`;case"up":return typeof s=="number"?`translateY(${-p}px)`:`translateY(calc(-1 * ${p}))`;case"down":return typeof s=="number"?`translateY(${p}px)`:`translateY(${p})`}};return{in:a=>({spring:y,tick:i=>{a.style.transform=f(i),u&&(a.style.opacity=(r+(1-r)*i).toString())}}),out:a=>({spring:y,tick:i=>{a.style.transform=f(i),u&&(a.style.opacity=(r+(1-r)*i).toString())}}),...c&&{key:c}}},g=($={})=>{const{degrees:n=360,clockwise:s=!0,scale:r=!1,fade:u=!0,origin:l="center",axis:y="2d",perspective:c=800,spring:t={stiffness:500,damping:25},key:e}=$,o=s?n:-n,f=a=>{const i=(1-a)*o;switch(y){case"x":return`perspective(${c}px) rotateX(${i}deg)`;case"y":return`perspective(${c}px) rotateY(${i}deg)`;case"z":return`rotateZ(${i}deg)`;case"2d":default:return`rotate(${i}deg)`}};return{in:a=>({spring:t,tick:i=>{const p=[f(i)];r&&p.push(`scale(${i})`),a.style.transform=p.join(" "),a.style.transformOrigin=l,u&&(a.style.opacity=i.toString())}}),out:a=>({spring:t,tick:i=>{const p=[f(i)];r&&p.push(`scale(${i})`),a.style.transform=p.join(" "),a.style.transformOrigin=l,u&&(a.style.opacity=i.toString())}}),...e&&{key:e}}},x=($={})=>{const{height:n=20,intensity:s=1,scale:r=!0,fade:u=!0,direction:l="up",spring:y={stiffness:800,damping:15},key:c}=$;return{in:t=>({spring:y,tick:e=>{const o=[],f=Math.sin(e*Math.PI*(1+s)),a=1-e,i=f*n*a;if(l==="up"?o.push(`translateY(${-Math.abs(i)}px)`):o.push(`translateY(${Math.abs(i)}px)`),r){const p=.8+e*.2+f*.05*a;o.push(`scale(${p})`)}t.style.transform=o.join(" "),u&&(t.style.opacity=e.toString())}}),out:t=>({spring:y,tick:e=>{const o=[],f=Math.sin(e*Math.PI*(1+s)),a=1-e,i=f*n*a;if(l==="up"?o.push(`translateY(${-Math.abs(i)}px)`):o.push(`translateY(${Math.abs(i)}px)`),r){const p=.8+e*.2+f*.05*a;o.push(`scale(${p})`)}t.style.transform=o.join(" "),u&&(t.style.opacity=e.toString())}}),...c&&{key:c}}},k=($={})=>{const{amount:n=10,opacity:s=0,scale:r=!1,fade:u=!0,spring:l={stiffness:300,damping:30},key:y}=$,c=t=>typeof t=="number"?`${t}px`:t;return{in:t=>({spring:l,tick:e=>{const o=1-e,f=typeof n=="number"?o*n:`calc(${c(n)} * ${o})`;t.style.filter=typeof n=="number"?`blur(${f}px)`:`blur(${f})`,r&&(t.style.transform=`scale(${.8+e*.2})`),u&&(t.style.opacity=(s+(1-s)*e).toString())}}),out:t=>({spring:l,tick:e=>{const o=1-e,f=typeof n=="number"?o*n:`calc(${c(n)} * ${o})`;t.style.filter=typeof n=="number"?`blur(${f}px)`:`blur(${f})`,r&&(t.style.transform=`scale(${.8+e*.2})`),u&&(t.style.opacity=(s+(1-s)*e).toString())}}),...y&&{key:y}}},h=($={})=>{const{x:n=0,y:s=-100,opacity:r=0,spring:u={stiffness:400,damping:35},key:l}=$,y=t=>typeof t=="number"?`${t}px`:t,c=t=>typeof t=="number"?`${t}px`:t;return{in:t=>({spring:u,tick:e=>{const o=typeof n=="number"?(1-e)*n:`calc(${y(n)} * ${1-e})`,f=typeof s=="number"?(1-e)*s:`calc(${c(s)} * ${1-e})`;t.style.transform=`translate(${typeof n=="number"?o+"px":o}, ${typeof s=="number"?f+"px":f})`,t.style.opacity=(r+(1-r)*e).toString()}}),out:t=>({spring:u,tick:e=>{const o=typeof n=="number"?(1-e)*n:`calc(${y(n)} * ${1-e})`,f=typeof s=="number"?(1-e)*s:`calc(${c(s)} * ${1-e})`;t.style.transform=`translate(${typeof n=="number"?o+"px":o}, ${typeof s=="number"?f+"px":f})`,t.style.opacity=(r+(1-r)*e).toString()}}),...l&&{key:l}}},S=($={})=>{const{spring:n={stiffness:1e3,damping:100},key:s}=$;return{in:r=>({spring:n,tick:u=>{}}),out:r=>({spring:n,tick:u=>{}}),...s&&{key:s}}};exports.blur=k;exports.bounce=x;exports.fade=b;exports.fly=h;exports.none=S;exports.rotate=g;exports.scale=m;exports.slide=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=($={})=>{const{from:e=0,to:s=1,spring:o={stiffness:300,damping:30},key:l}=$;return{in:u=>({spring:o,tick:y=>{const a=e+(s-e)*y;u.style.opacity=a.toString()}}),out:u=>({spring:o,tick:y=>{const a=e+(s-e)*y;u.style.opacity=a.toString()}}),...l&&{key:l}}},h=($={})=>{const{start:e=0,opacity:s=0,axis:o="both",spring:l={stiffness:300,damping:30},key:u}=$,y=a=>{switch(o){case"x":return`scaleX(${a})`;case"y":return`scaleY(${a})`;case"both":default:return`scale(${a})`}};return{in:a=>({spring:l,tick:n=>{const t=e+(1-e)*n;a.style.transform=y(t),a.style.opacity=(s+(1-s)*n).toString()}}),out:a=>({spring:l,tick:n=>{const t=e+(1-e)*n;a.style.transform=y(t),a.style.opacity=(s+(1-s)*n).toString()}}),...u&&{key:u}}},x=($={})=>{const{direction:e,distance:s=100,opacity:o=0,fade:l=!0,axis:u,spring:y={stiffness:400,damping:35},key:a}=$,t=e||(u==="x"?"left":u==="y"?"up":"left"),c=i=>typeof i=="number"?`${i}px`:i,f=i=>{const r=1-i,p=typeof s=="number"?r*s:`calc(${c(s)} * ${r})`;switch(t){case"left":return typeof s=="number"?`translateX(${-p}px)`:`translateX(calc(-1 * ${p}))`;case"right":return typeof s=="number"?`translateX(${p}px)`:`translateX(${p})`;case"up":return typeof s=="number"?`translateY(${-p}px)`:`translateY(calc(-1 * ${p}))`;case"down":return typeof s=="number"?`translateY(${p}px)`:`translateY(${p})`}};return{in:i=>({spring:y,tick:r=>{i.style.transform=f(r),l&&(i.style.opacity=(o+(1-o)*r).toString())}}),out:i=>({spring:y,tick:r=>{i.style.transform=f(r),l&&(i.style.opacity=(o+(1-o)*r).toString())}}),...a&&{key:a}}},k=($={})=>{const{degrees:e=360,clockwise:s=!0,scale:o=!1,fade:l=!0,origin:u="center",axis:y="2d",perspective:a=800,spring:n={stiffness:500,damping:25},key:t}=$,c=s?e:-e,f=i=>{const r=(1-i)*c;switch(y){case"x":return`perspective(${a}px) rotateX(${r}deg)`;case"y":return`perspective(${a}px) rotateY(${r}deg)`;case"z":return`rotateZ(${r}deg)`;case"2d":default:return`rotate(${r}deg)`}};return{in:i=>({spring:n,tick:r=>{const p=[f(r)];o&&p.push(`scale(${r})`),i.style.transform=p.join(" "),i.style.transformOrigin=u,l&&(i.style.opacity=r.toString())}}),out:i=>({spring:n,tick:r=>{const p=[f(r)];o&&p.push(`scale(${r})`),i.style.transform=p.join(" "),i.style.transformOrigin=u,l&&(i.style.opacity=r.toString())}}),...t&&{key:t}}},S=($={})=>{const{height:e=20,intensity:s=1,scale:o=!0,fade:l=!0,direction:u="up",spring:y={stiffness:800,damping:15},key:a}=$;return{in:n=>({spring:y,tick:t=>{const c=[],f=Math.sin(t*Math.PI*(1+s)),i=1-t,r=f*e*i;if(u==="up"?c.push(`translateY(${-Math.abs(r)}px)`):c.push(`translateY(${Math.abs(r)}px)`),o){const p=.8+t*.2+f*.05*i;c.push(`scale(${p})`)}n.style.transform=c.join(" "),l&&(n.style.opacity=t.toString())}}),out:n=>({spring:y,tick:t=>{const c=[],f=Math.sin(t*Math.PI*(1+s)),i=1-t,r=f*e*i;if(u==="up"?c.push(`translateY(${-Math.abs(r)}px)`):c.push(`translateY(${Math.abs(r)}px)`),o){const p=.8+t*.2+f*.05*i;c.push(`scale(${p})`)}n.style.transform=c.join(" "),l&&(n.style.opacity=t.toString())}}),...a&&{key:a}}},M=($={})=>{const{amount:e=10,opacity:s=0,scale:o=!1,fade:l=!0,spring:u={stiffness:300,damping:30},key:y}=$,a=n=>typeof n=="number"?`${n}px`:n;return{in:n=>({spring:u,tick:t=>{const c=1-t,f=typeof e=="number"?c*e:`calc(${a(e)} * ${c})`;n.style.filter=typeof e=="number"?`blur(${f}px)`:`blur(${f})`,o&&(n.style.transform=`scale(${.8+t*.2})`),l&&(n.style.opacity=(s+(1-s)*t).toString())}}),out:n=>({spring:u,tick:t=>{const c=1-t,f=typeof e=="number"?c*e:`calc(${a(e)} * ${c})`;n.style.filter=typeof e=="number"?`blur(${f}px)`:`blur(${f})`,o&&(n.style.transform=`scale(${.8+t*.2})`),l&&(n.style.opacity=(s+(1-s)*t).toString())}}),...y&&{key:y}}},Y=($={})=>{const{x:e=0,y:s=-100,opacity:o=0,spring:l={stiffness:400,damping:35},key:u}=$,y=n=>typeof n=="number"?`${n}px`:n,a=n=>typeof n=="number"?`${n}px`:n;return{in:n=>({spring:l,tick:t=>{const c=typeof e=="number"?(1-t)*e:`calc(${y(e)} * ${1-t})`,f=typeof s=="number"?(1-t)*s:`calc(${a(s)} * ${1-t})`;n.style.transform=`translate(${typeof e=="number"?c+"px":c}, ${typeof s=="number"?f+"px":f})`,n.style.opacity=(o+(1-o)*t).toString()}}),out:n=>({spring:l,tick:t=>{const c=typeof e=="number"?(1-t)*e:`calc(${y(e)} * ${1-t})`,f=typeof s=="number"?(1-t)*s:`calc(${a(s)} * ${1-t})`;n.style.transform=`translate(${typeof e=="number"?c+"px":c}, ${typeof s=="number"?f+"px":f})`,n.style.opacity=(o+(1-o)*t).toString()}}),...u&&{key:u}}},O=($={})=>{const{shape:e="circle",origin:s="center",scale:o=1.5,fade:l=!1,spring:u={stiffness:300,damping:30},key:y}=$,a=()=>{switch(s){case"top":return"50% 0%";case"bottom":return"50% 100%";case"left":return"0% 50%";case"right":return"100% 50%";case"top-left":return"0% 0%";case"top-right":return"100% 0%";case"bottom-left":return"0% 100%";case"bottom-right":return"100% 100%";case"center":default:return"50% 50%"}},n=t=>{const c=t*o*100,f=a();switch(e){case"ellipse":return`ellipse(${c}% ${c*.75}% at ${f})`;case"square":const i=t*o*100,[r,p]=f.split(" "),m=parseFloat(r),g=parseFloat(p),b=i/2;return`polygon(${m-b}% ${g-b}%, ${m+b}% ${g-b}%, ${m+b}% ${g+b}%, ${m-b}% ${g+b}%)`;case"circle":default:return`circle(${c}% at ${f})`}};return{in:t=>({spring:u,tick:c=>{t.style.clipPath=n(c),l&&(t.style.opacity=c.toString())}}),out:t=>({spring:u,tick:c=>{t.style.clipPath=n(c),l&&(t.style.opacity=c.toString())}}),...y&&{key:y}}},V=($={})=>{const{spring:e={stiffness:1e3,damping:100},key:s}=$;return{in:o=>({spring:e,tick:l=>{}}),out:o=>({spring:e,tick:l=>{}}),...s&&{key:s}}};exports.blur=M;exports.bounce=S;exports.fade=d;exports.fly=Y;exports.mask=O;exports.none=V;exports.rotate=k;exports.scale=h;exports.slide=x;
@@ -5,5 +5,6 @@ export * from './rotate';
5
5
  export * from './bounce';
6
6
  export * from './blur';
7
7
  export * from './fly';
8
+ export * from './mask';
8
9
  export * from './none';
9
10
  //# sourceMappingURL=index.d.ts.map