@ssgoi/core 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/animator/integrator/double-spring-integrator.d.ts +6 -0
  2. package/dist/animator/integrator/double-spring-integrator.d.ts.map +1 -1
  3. package/dist/animator/integrator/inertia-integrator.d.ts +15 -0
  4. package/dist/animator/integrator/inertia-integrator.d.ts.map +1 -1
  5. package/dist/animator/integrator/provider.d.ts.map +1 -1
  6. package/dist/animator/integrator/spring-integrator.d.ts +6 -0
  7. package/dist/animator/integrator/spring-integrator.d.ts.map +1 -1
  8. package/dist/animator/multi-animator.d.ts +16 -11
  9. package/dist/animator/multi-animator.d.ts.map +1 -1
  10. package/dist/animator/runner/css-runner.d.ts.map +1 -1
  11. package/dist/animator/single-animator.d.ts +6 -4
  12. package/dist/animator/single-animator.d.ts.map +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +299 -263
  15. package/dist/provider-Cs5iBqRD.cjs +1 -0
  16. package/dist/provider-Cu4NSF1Q.js +167 -0
  17. package/dist/transition/create-transition-callback.d.ts.map +1 -1
  18. package/dist/transition/transition-strategy.d.ts +6 -6
  19. package/dist/transition/transition-strategy.d.ts.map +1 -1
  20. package/dist/transitions/index.cjs +1 -1
  21. package/dist/transitions/index.js +1 -1
  22. package/dist/types.cjs +1 -1
  23. package/dist/types.d.ts +65 -35
  24. package/dist/types.d.ts.map +1 -1
  25. package/dist/types.js +39 -46
  26. package/dist/utils/index.d.ts +1 -0
  27. package/dist/utils/index.d.ts.map +1 -1
  28. package/dist/utils/wait-paint.d.ts +15 -0
  29. package/dist/utils/wait-paint.d.ts.map +1 -0
  30. package/dist/view-transitions/depth.d.ts.map +1 -1
  31. package/dist/view-transitions/drill.d.ts.map +1 -1
  32. package/dist/view-transitions/hero.d.ts.map +1 -1
  33. package/dist/view-transitions/index.cjs +15 -15
  34. package/dist/view-transitions/index.js +673 -688
  35. package/dist/view-transitions/pinterest.d.ts.map +1 -1
  36. package/dist/view-transitions/scroll.d.ts.map +1 -1
  37. package/dist/view-transitions/sheet.d.ts.map +1 -1
  38. package/dist/view-transitions/swap.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/provider-B6Xnh0BA.cjs +0 -1
  41. package/dist/provider-CMBovM_W.js +0 -134
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- var K = Object.defineProperty;
2
- var J = (n, i, t) => i in n ? K(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
3
- var d = (n, i, t) => J(n, typeof i != "symbol" ? i + "" : i, t);
4
- import { normalizeToMultiSpring as P, normalizeMultiSpringSchedule as U } from "./types.js";
5
- import { isCssAnimation as Ot, isMultiSpring as Lt, isSingleSpring as Dt, isTickAnimation as zt, validateAnimationMode as Nt, validateSpringItem as qt } from "./types.js";
6
- import { S as X, I as Q, a as Z } from "./provider-CMBovM_W.js";
7
- class tt {
1
+ var J = Object.defineProperty;
2
+ var Q = (n, i, t) => i in n ? J(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
3
+ var d = (n, i, t) => Q(n, typeof i != "symbol" ? i + "" : i, t);
4
+ import { normalizeToMultiAnimation as R, normalizeSchedule as N } from "./types.js";
5
+ import { isCssAnimation as Lt, isMultiAnimation as Dt, isSingleAnimation as zt, isTickAnimation as qt } from "./types.js";
6
+ import { S as Y, I as Z, a as tt } from "./provider-Cu4NSF1Q.js";
7
+ class et {
8
8
  constructor() {
9
9
  d(this, "listeners", /* @__PURE__ */ new Set());
10
10
  d(this, "rafId", null);
@@ -30,9 +30,9 @@ class tt {
30
30
  e > this.lagThreshold || e < 0 ? (this.startTime += e - this.adjustedLag, e = this.adjustedLag) : e > this.maxDeltaTime && (e = this.maxDeltaTime), this.lastUpdate = i;
31
31
  const o = i - this.startTime, s = o - this.nextTime;
32
32
  if (s > 0) {
33
- const l = e / 1e3;
33
+ const c = e / 1e3;
34
34
  this.elapsed = o / 1e3, this.nextTime += s + (s >= this.gap ? 4 : this.gap - s), this.listeners.forEach((r) => {
35
- r(l, this.elapsed);
35
+ r(c, this.elapsed);
36
36
  });
37
37
  }
38
38
  this.listeners.size > 0 ? this.rafId = requestAnimationFrame(this.tick) : (this.isRunning = !1, this.rafId = null);
@@ -68,64 +68,64 @@ class tt {
68
68
  return this.elapsed;
69
69
  }
70
70
  }
71
- const z = new tt();
72
- function et(n) {
71
+ const D = new et();
72
+ function it(n) {
73
73
  const {
74
74
  integrator: i,
75
75
  from: t,
76
76
  to: e,
77
77
  velocity: o = 0,
78
78
  onUpdate: s,
79
- onComplete: l,
79
+ onComplete: c,
80
80
  onStart: r
81
81
  } = n;
82
- let c = { position: t, velocity: o }, u = !0, m = 0, g = !1;
82
+ let a = { position: t, velocity: o }, u = !0, m = 0, g = !1;
83
83
  const y = (S) => {
84
84
  if (u) {
85
- if (g || (g = !0, r == null || r()), c = i.step(c, e, S), i.isSettled(c, e)) {
86
- if (m += Math.min(S, 0.033), m >= X) {
87
- c = { position: e, velocity: 0 }, u = !1, s(c.position), z.unsubscribe(y), l();
85
+ if (g || (g = !0, r == null || r()), a = i.step(a, e, S), i.isSettled(a, e)) {
86
+ if (m += Math.min(S, 0.033), m >= Y) {
87
+ a = { position: e, velocity: 0 }, u = !1, s(a.position), D.unsubscribe(y), c();
88
88
  return;
89
89
  }
90
90
  } else
91
91
  m = 0;
92
- s(c.position);
92
+ s(a.position);
93
93
  }
94
94
  };
95
- return z.subscribe(y), {
95
+ return D.subscribe(y), {
96
96
  stop: () => {
97
- u && (u = !1, z.unsubscribe(y));
97
+ u && (u = !1, D.unsubscribe(y));
98
98
  },
99
- getPosition: () => c.position,
100
- getVelocity: () => c.velocity,
99
+ getPosition: () => a.position,
100
+ getVelocity: () => a.velocity,
101
101
  isRunning: () => u
102
102
  };
103
103
  }
104
- const x = 1e3 / 60;
105
- function it(n, i, t, e = 0) {
106
- let s = { position: i, velocity: e }, l = 0;
104
+ const F = 1e3 / 60;
105
+ function nt(n, i, t, e = 0) {
106
+ let s = { position: i, velocity: e }, c = 0;
107
107
  const r = [];
108
- for (let c = 0; c < 600; c++) {
109
- const u = c * x;
108
+ for (let a = 0; a < 600; a++) {
109
+ const u = a * F;
110
110
  if (r.push({
111
111
  time: u,
112
112
  position: s.position,
113
113
  velocity: s.velocity
114
- }), s = n.step(s, t, x / 1e3), n.isSettled(s, t)) {
115
- if (l += x / 1e3, l >= X) {
114
+ }), s = n.step(s, t, F / 1e3), n.isSettled(s, t)) {
115
+ if (c += F / 1e3, c >= Y) {
116
116
  r.push({
117
- time: (c + 1) * x,
117
+ time: (a + 1) * F,
118
118
  position: t,
119
119
  velocity: 0
120
120
  });
121
121
  break;
122
122
  }
123
123
  } else
124
- l = 0;
124
+ c = 0;
125
125
  }
126
126
  return r;
127
127
  }
128
- function H(n, i) {
128
+ function U(n, i) {
129
129
  if (n.length === 0)
130
130
  return { position: 0, velocity: 0 };
131
131
  const t = n[0], e = n[n.length - 1];
@@ -138,63 +138,68 @@ function H(n, i) {
138
138
  const u = Math.floor((o + s) / 2);
139
139
  n[u].time <= i ? o = u : s = u;
140
140
  }
141
- const l = n[o], r = n[s], c = (i - l.time) / (r.time - l.time);
141
+ const c = n[o], r = n[s], a = (i - c.time) / (r.time - c.time);
142
142
  return {
143
- position: l.position + (r.position - l.position) * c,
144
- velocity: l.velocity + (r.velocity - l.velocity) * c
143
+ position: c.position + (r.position - c.position) * a,
144
+ velocity: c.velocity + (r.velocity - c.velocity) * a
145
145
  };
146
146
  }
147
- function nt(n, i) {
147
+ function rt(n, i) {
148
148
  return n.map((t) => i(t.position));
149
149
  }
150
- function rt(n) {
150
+ function ot(n) {
151
151
  const {
152
152
  integrator: i,
153
153
  element: t,
154
154
  from: e,
155
155
  to: o,
156
156
  velocity: s = 0,
157
- style: l,
157
+ style: c,
158
158
  onComplete: r,
159
- onStart: c
160
- } = n, u = it(i, e, o, s);
159
+ onStart: a
160
+ } = n, u = nt(i, e, o, s);
161
161
  if (u.length === 0)
162
- return c == null || c(), r(), {
162
+ return a == null || a(), r(), {
163
163
  stop: () => {
164
164
  },
165
165
  getPosition: () => o,
166
166
  getVelocity: () => 0,
167
167
  isRunning: () => !1
168
168
  };
169
- const m = nt(u, l), g = u[u.length - 1], y = g.time, S = t.animate(m, {
169
+ const m = rt(u, c), g = u[u.length - 1], y = g.time, S = m[0];
170
+ if (S)
171
+ for (const A of Object.keys(S))
172
+ t.style[A] = "";
173
+ const f = t.animate(m, {
170
174
  duration: y,
171
175
  fill: "forwards",
172
- easing: "linear"
176
+ easing: "linear",
177
+ composite: "replace"
173
178
  });
174
- let a = !0;
175
- const f = performance.now();
176
- return c == null || c(), S.onfinish = () => {
177
- a && (a = !1, r());
179
+ let l = !0;
180
+ const E = performance.now();
181
+ return a == null || a(), f.onfinish = () => {
182
+ l && (l = !1, r());
178
183
  }, {
179
184
  stop: () => {
180
- a && (a = !1, S.cancel());
185
+ l && (l = !1, f.cancel());
181
186
  },
182
187
  getPosition: () => {
183
- if (!a)
188
+ if (!l)
184
189
  return g.position;
185
- const A = performance.now() - f;
186
- return H(u, A).position;
190
+ const A = performance.now() - E;
191
+ return U(u, A).position;
187
192
  },
188
193
  getVelocity: () => {
189
- if (!a)
194
+ if (!l)
190
195
  return 0;
191
- const A = performance.now() - f;
192
- return H(u, A).velocity;
196
+ const A = performance.now() - E;
197
+ return U(u, A).velocity;
193
198
  },
194
- isRunning: () => a
199
+ isRunning: () => l
195
200
  };
196
201
  }
197
- class ot {
202
+ class st {
198
203
  /**
199
204
  * Get bound runner based on animation mode
200
205
  *
@@ -206,20 +211,20 @@ class ot {
206
211
  const { tick: t, css: e } = i;
207
212
  if (t && e)
208
213
  throw new Error("Cannot use both 'tick' and 'css' options together");
209
- return e ? (o) => rt({
214
+ return e ? (o) => ot({
210
215
  ...o,
211
216
  element: e.element,
212
217
  style: e.style
213
- }) : t ? (o) => et({
218
+ }) : t ? (o) => it({
214
219
  ...o,
215
220
  onUpdate: t
216
221
  }) : null;
217
222
  }
218
223
  }
219
- class Y {
224
+ class j {
220
225
  }
221
- const st = { stiffness: 300, damping: 30 };
222
- class O extends Y {
226
+ const at = { stiffness: 300, damping: 30 };
227
+ class H extends j {
223
228
  constructor(t) {
224
229
  super();
225
230
  d(this, "options");
@@ -228,28 +233,52 @@ class O extends Y {
228
233
  d(this, "isAnimating", !1);
229
234
  d(this, "currentValue");
230
235
  d(this, "currentVelocity", 0);
231
- this.options = {
236
+ d(this, "updateFn");
237
+ if (this.options = {
232
238
  from: t.from ?? 0,
233
239
  to: t.to ?? 1,
234
240
  physics: t.physics,
235
241
  onComplete: t.onComplete ?? (() => {
236
242
  }),
237
243
  onStart: t.onStart
238
- }, this.currentValue = this.options.from, this.runner = ot.from({
244
+ }, this.currentValue = this.options.from, t.tick)
245
+ this.updateFn = (e) => {
246
+ var o;
247
+ return (o = t.tick) == null ? void 0 : o.call(t, e);
248
+ };
249
+ else if (t.css) {
250
+ const { element: e, style: o } = t.css;
251
+ this.updateFn = (s) => {
252
+ const c = o(s);
253
+ for (const [r, a] of Object.entries(c))
254
+ e.style[r] = typeof a == "number" ? String(a) : a;
255
+ };
256
+ } else
257
+ this.updateFn = () => {
258
+ };
259
+ this.runner = st.from({
239
260
  tick: t.tick,
240
261
  css: t.css
241
262
  });
242
263
  }
264
+ /**
265
+ * Sync element state to current progress value
266
+ * Uses the update callback if provided
267
+ */
268
+ syncState() {
269
+ var t;
270
+ (t = this.updateFn) == null || t.call(this, this.currentValue);
271
+ }
243
272
  /**
244
273
  * Create Integrator from physics options
245
274
  * Priority: integrator factory > inertia/spring config > default spring
246
275
  */
247
276
  createIntegrator() {
248
277
  const t = this.options.physics;
249
- return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? Q.from({
278
+ return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? Z.from({
250
279
  spring: t.spring,
251
280
  inertia: t.inertia
252
- }) : new Z(st);
281
+ }) : new tt(at);
253
282
  }
254
283
  runAnimation(t) {
255
284
  var e, o;
@@ -309,17 +338,13 @@ class O extends Y {
309
338
  updateOptions(t) {
310
339
  this.options = { ...this.options, ...t };
311
340
  }
312
- static fromState(t, e) {
313
- const o = new O(e);
314
- return o.setValue(t.position), o.setVelocity(t.velocity), o;
315
- }
316
341
  }
317
- class L extends Y {
342
+ class M extends j {
318
343
  constructor(t) {
319
344
  super();
320
345
  d(this, "config");
321
346
  d(this, "animators", /* @__PURE__ */ new Map());
322
- d(this, "springOrder", []);
347
+ d(this, "itemOrder", []);
323
348
  d(this, "completedCount", 0);
324
349
  d(this, "completedAnimators", /* @__PURE__ */ new Set());
325
350
  d(this, "direction", "forward");
@@ -327,28 +352,32 @@ class L extends Y {
327
352
  d(this, "rafId", null);
328
353
  d(this, "from");
329
354
  d(this, "to");
330
- this.config = t.config, this.from = t.from, this.to = t.to, this.initializeAnimators();
355
+ d(this, "initialState");
356
+ this.config = t.config, this.from = t.from, this.to = t.to, this.initialState = t.state ?? {
357
+ position: t.from,
358
+ velocity: 0
359
+ }, this.initializeAnimators();
331
360
  }
332
361
  generateId() {
333
362
  return `spring_${this.idCounter++}`;
334
363
  }
335
364
  initializeAnimators() {
336
- this.config.springs.forEach((t) => {
337
- const e = this.generateId(), o = new O({
365
+ this.config.items.forEach((t, e) => {
366
+ const o = this.generateId(), s = new H({
338
367
  from: this.from,
339
368
  to: this.to,
340
369
  physics: t.physics,
341
370
  tick: t.tick,
342
371
  css: t.css,
343
- onComplete: () => this.onAnimatorComplete(e),
372
+ onComplete: () => this.onAnimatorComplete(o),
344
373
  onStart: t.onStart
345
374
  });
346
- this.animators.set(e, {
347
- id: e,
375
+ (e === 0 || t.normalizedOffset === 0) && (s.setValue(this.initialState.position), s.setVelocity(this.initialState.velocity), s.syncState()), this.animators.set(o, {
376
+ id: o,
348
377
  item: t,
349
- animator: o,
378
+ animator: s,
350
379
  started: !1
351
- }), this.springOrder.push(e);
380
+ }), this.itemOrder.push(o);
352
381
  });
353
382
  }
354
383
  /**
@@ -365,12 +394,12 @@ class L extends Y {
365
394
  * Backward: n-1, n-2, ..., 0
366
395
  */
367
396
  getOrderedIds() {
368
- return this.direction === "forward" ? this.springOrder : [...this.springOrder].reverse();
397
+ return this.direction === "forward" ? this.itemOrder : [...this.itemOrder].reverse();
369
398
  }
370
399
  onAnimatorComplete(t) {
371
- var o, s, l, r, c, u;
400
+ var o, s, c, r, a, u;
372
401
  const e = this.animators.get(t);
373
- !e || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (s = (o = e.item).onComplete) == null || s.call(o), (r = (l = this.config).onProgress) == null || r.call(l, this.completedCount, this.config.springs.length), this.completedCount === this.config.springs.length && (this.stopScheduler(), (u = (c = this.config).onEnd) == null || u.call(c)));
402
+ !e || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (s = (o = e.item).onComplete) == null || s.call(o), (r = (c = this.config).onProgress) == null || r.call(c, this.completedCount, this.config.items.length), this.completedCount === this.config.items.length && (this.stopScheduler(), (u = (a = this.config).onEnd) == null || u.call(a)));
374
403
  }
375
404
  /**
376
405
  * Check and start springs based on previous spring's progress
@@ -385,10 +414,10 @@ class L extends Y {
385
414
  this.startAnimator(o);
386
415
  continue;
387
416
  }
388
- const l = t[e - 1], r = this.animators.get(l);
417
+ const c = t[e - 1], r = this.animators.get(c);
389
418
  if (!r || !r.started) continue;
390
- const c = this.getAnimatorProgress(r), u = s.item.normalizedOffset;
391
- c >= u && this.startAnimator(o);
419
+ const a = this.getAnimatorProgress(r), u = s.item.normalizedOffset;
420
+ a >= u && this.startAnimator(o);
392
421
  }
393
422
  }
394
423
  startAnimator(t) {
@@ -409,7 +438,7 @@ class L extends Y {
409
438
  }
410
439
  getFirstAnimator() {
411
440
  var e;
412
- const t = this.springOrder[0];
441
+ const t = this.itemOrder[0];
413
442
  return t ? ((e = this.animators.get(t)) == null ? void 0 : e.animator) ?? null : null;
414
443
  }
415
444
  forward() {
@@ -436,19 +465,16 @@ class L extends Y {
436
465
  return;
437
466
  const e = t.animator.getCurrentState();
438
467
  if (e.position === e.to) {
439
- const s = O.fromState(
440
- { position: this.to, velocity: 0 },
441
- {
442
- from: this.to,
443
- to: this.from,
444
- physics: t.item.physics,
445
- tick: t.item.tick,
446
- css: t.item.css,
447
- onComplete: () => this.onAnimatorComplete(t.id),
448
- onStart: t.item.onStart
449
- }
450
- );
451
- s.forward(), t.animator = s;
468
+ const s = new H({
469
+ from: this.to,
470
+ to: this.from,
471
+ physics: t.item.physics,
472
+ tick: t.item.tick,
473
+ css: t.item.css,
474
+ onComplete: () => this.onAnimatorComplete(t.id),
475
+ onStart: t.item.onStart
476
+ });
477
+ s.setValue(this.to), s.setVelocity(0), s.syncState(), s.forward(), t.animator = s;
452
478
  } else
453
479
  t.animator.reverse();
454
480
  });
@@ -506,11 +532,10 @@ class L extends Y {
506
532
  * Uses first animator's state for initialization
507
533
  */
508
534
  static fromState(t, e) {
509
- const o = new L(e);
510
- return o.setValue(t.position), o.setVelocity(t.velocity), o;
535
+ return new M({ ...e, state: t });
511
536
  }
512
537
  }
513
- const W = Symbol.for("TRANSITION_STRATEGY"), at = (n) => ({
538
+ const W = Symbol.for("TRANSITION_STRATEGY"), ct = (n) => ({
514
539
  runIn: async (i) => {
515
540
  const { currentAnimation: t } = n;
516
541
  if (t && t.direction === "out") {
@@ -577,7 +602,7 @@ const W = Symbol.for("TRANSITION_STRATEGY"), at = (n) => ({
577
602
  direction: "forward"
578
603
  };
579
604
  }
580
- }), ct = () => ({
605
+ }), lt = () => ({
581
606
  runIn: async (n) => n.in ? {
582
607
  config: await n.in,
583
608
  state: {
@@ -614,48 +639,76 @@ const W = Symbol.for("TRANSITION_STRATEGY"), at = (n) => ({
614
639
  to: 0,
615
640
  direction: "forward"
616
641
  }
617
- }), j = "data-ssgoi-scope", G = "data-ssgoi-scope-ready";
618
- function bt() {
642
+ }), G = "data-ssgoi-scope", $ = "data-ssgoi-scope-ready";
643
+ function kt() {
619
644
  return (n) => {
620
645
  if (n)
621
- return n.setAttribute(j, ""), queueMicrotask(() => {
646
+ return n.setAttribute(G, ""), queueMicrotask(() => {
622
647
  queueMicrotask(() => {
623
- n.setAttribute(G, "true");
648
+ n.setAttribute($, "true");
624
649
  });
625
650
  }), () => {
626
651
  };
627
652
  };
628
653
  }
629
- function lt(n) {
630
- return n.hasAttribute(G);
631
- }
632
654
  function ut(n) {
633
- return n.closest(`[${j}]`);
655
+ return n.hasAttribute($);
656
+ }
657
+ function ft(n) {
658
+ return n.closest(`[${G}]`);
659
+ }
660
+ const dt = (n) => {
661
+ let i = n.parentElement;
662
+ for (; i && i !== document.body; ) {
663
+ const t = window.getComputedStyle(i), e = t.overflow + t.overflowY + t.overflowX;
664
+ if (e.includes("auto") || e.includes("scroll") || i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth)
665
+ return i;
666
+ i = i.parentElement;
667
+ }
668
+ return document.documentElement;
669
+ }, mt = (n) => {
670
+ let i = n.parentElement;
671
+ for (; i && i !== document.body; ) {
672
+ const t = window.getComputedStyle(i).position;
673
+ if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
674
+ return i;
675
+ i = i.parentElement;
676
+ }
677
+ return document.body;
678
+ };
679
+ function X(n) {
680
+ return new Promise((i) => {
681
+ requestAnimationFrame(() => {
682
+ requestAnimationFrame(() => {
683
+ i();
684
+ });
685
+ });
686
+ });
634
687
  }
635
- function ft(n, i) {
688
+ function ht(n, i) {
636
689
  var S;
637
690
  let t = null, e = null, o = null, s = null;
638
- const l = {
691
+ const c = {
639
692
  get currentAnimation() {
640
693
  return t;
641
694
  }
642
- }, r = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, l)) || at(l), c = async (a) => {
643
- var E;
695
+ }, r = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, c)) || ct(c), a = async (f) => {
696
+ var T;
644
697
  e && (e.remove(), e = null);
645
- const f = n(), A = f.in && f.in(a), k = !(i != null && i.strategy) && f.out ? f.out(a) : void 0;
646
- if (!A)
698
+ const l = n(), E = l.in && l.in(f), A = !(i != null && i.strategy) && l.out ? l.out(f) : void 0;
699
+ if (!E)
647
700
  return;
648
- const R = {
649
- in: P(A),
650
- out: k ? P(k) : void 0
651
- }, v = await r.runIn(R);
701
+ const I = {
702
+ in: R(E),
703
+ out: A ? R(A) : void 0
704
+ }, v = await r.runIn(I);
652
705
  if (!v.config) {
653
706
  t && (t.direction = "in");
654
707
  return;
655
708
  }
656
709
  const p = v.config;
657
- (E = p.prepare) == null || E.call(p, a), p.wait && await p.wait();
658
- const w = U(
710
+ (T = p.prepare) == null || T.call(p);
711
+ const w = N(
659
712
  {
660
713
  ...p,
661
714
  onEnd: () => {
@@ -663,97 +716,101 @@ function ft(n, i) {
663
716
  t = null, (C = p.onEnd) == null || C.call(p);
664
717
  }
665
718
  },
666
- a
667
- ), h = L.fromState(v.state, {
719
+ f
720
+ );
721
+ p.wait && await p.wait();
722
+ const h = M.fromState(v.state, {
668
723
  config: w,
669
724
  from: v.from,
670
725
  to: v.to
671
726
  });
672
- t = { controller: h, direction: "in" }, v.direction === "forward" ? h.forward() : h.backward();
673
- }, u = async (a) => {
727
+ t = { controller: h, direction: "in" }, await X(), v.direction === "forward" ? h.forward() : h.backward();
728
+ }, u = async (f) => {
674
729
  var C;
675
- e = a;
676
- const f = n(), A = !(i != null && i.strategy) && f.in ? f.in(a) : void 0, k = f.out && f.out(a);
677
- if (!k)
730
+ e = f;
731
+ const l = n(), E = !(i != null && i.strategy) && l.in ? l.in(f) : void 0, A = l.out && l.out(f);
732
+ if (!A)
678
733
  return;
679
- const R = {
680
- in: A ? P(A) : void 0,
681
- out: P(k)
682
- }, v = await r.runOut(R);
734
+ const I = {
735
+ in: E ? R(E) : void 0,
736
+ out: R(A)
737
+ }, v = await r.runOut(I);
683
738
  if (!v.config) {
684
739
  t && (t.direction = "out"), e && (e.remove(), e = null);
685
740
  return;
686
741
  }
687
742
  const p = v.config;
688
- (C = p.prepare) == null || C.call(p, a), E(), p.wait && await p.wait();
689
- const w = U(
743
+ T(), (C = p.prepare) == null || C.call(p);
744
+ const w = N(
690
745
  {
691
746
  ...p,
692
747
  onEnd: () => {
693
- var V, I;
694
- (V = p.onEnd) == null || V.call(p), e && (e.remove(), e = null), t = null, (I = i == null ? void 0 : i.onCleanupEnd) == null || I.call(i);
748
+ var V, P;
749
+ (V = p.onEnd) == null || V.call(p), e && (e.remove(), e = null), t = null, (P = i == null ? void 0 : i.onCleanupEnd) == null || P.call(i);
695
750
  }
696
751
  },
697
- a
698
- ), h = L.fromState(v.state, {
752
+ f
753
+ );
754
+ p.wait && await p.wait();
755
+ const h = M.fromState(v.state, {
699
756
  config: w,
700
757
  from: v.from,
701
758
  to: v.to
702
759
  });
703
- t = { controller: h, direction: "out" }, v.direction === "forward" ? h.forward() : h.backward();
704
- function E() {
760
+ t = { controller: h, direction: "out" }, await X(), v.direction === "forward" ? h.forward() : h.backward();
761
+ function T() {
705
762
  !o || !e || (s && o.contains(s) ? o.insertBefore(e, s) : o.appendChild(e));
706
763
  }
707
764
  };
708
765
  let m = null, g = !1;
709
- const y = (a) => () => {
766
+ const y = (f) => () => {
710
767
  if (g) return;
711
768
  g = !0;
712
- const f = a.cloneNode(!0);
769
+ const l = f.cloneNode(!0);
713
770
  m ? queueMicrotask(() => {
714
- document.contains(m) && u(f);
715
- }) : u(f);
771
+ document.contains(m) && u(l);
772
+ }) : u(l);
716
773
  };
717
- return (a) => {
718
- if (a)
774
+ return (f) => {
775
+ if (f)
719
776
  return requestAnimationFrame(() => {
720
- o = a.parentElement, s = a.nextElementSibling;
777
+ o = f.parentElement, s = f.nextElementSibling;
721
778
  }), g = !1, (i == null ? void 0 : i.scope) === "local" ? queueMicrotask(() => {
722
- m = ut(a), !(m && !lt(m)) && c(a);
723
- }) : c(a), y(a);
779
+ m = ft(f), !(m && !ut(m)) && a(f);
780
+ }) : a(f), y(f);
724
781
  };
725
782
  }
726
- const b = /* @__PURE__ */ new Map();
727
- let T = null, N = !1;
728
- function $(n) {
729
- if (n instanceof HTMLElement && b.has(n)) {
730
- const t = b.get(n);
731
- b.delete(n), queueMicrotask(() => {
783
+ const k = /* @__PURE__ */ new Map();
784
+ let b = null, z = !1;
785
+ function K(n) {
786
+ if (n instanceof HTMLElement && k.has(n)) {
787
+ const t = k.get(n);
788
+ k.delete(n), queueMicrotask(() => {
732
789
  t();
733
790
  });
734
791
  }
735
792
  const i = n.childNodes;
736
793
  for (let t = 0; t < i.length; t++) {
737
794
  const e = i[t];
738
- e && $(e);
795
+ e && K(e);
739
796
  }
740
797
  }
741
- function dt() {
742
- N || typeof document > "u" || (N = !0, T = new MutationObserver((n) => {
798
+ function gt() {
799
+ z || typeof document > "u" || (z = !0, b = new MutationObserver((n) => {
743
800
  for (const i of n) {
744
801
  const t = i.removedNodes;
745
802
  for (let e = 0; e < t.length; e++) {
746
803
  const o = t[e];
747
- o && $(o);
804
+ o && K(o);
748
805
  }
749
806
  }
750
- }), document.body ? T.observe(document.body, {
807
+ }), document.body ? b.observe(document.body, {
751
808
  childList: !0,
752
809
  subtree: !0
753
810
  }) : document.addEventListener(
754
811
  "DOMContentLoaded",
755
812
  () => {
756
- T == null || T.observe(document.body, {
813
+ b == null || b.observe(document.body, {
757
814
  childList: !0,
758
815
  subtree: !0
759
816
  });
@@ -761,48 +818,48 @@ function dt() {
761
818
  { once: !0 }
762
819
  ));
763
820
  }
764
- function mt(n, i) {
765
- dt(), b.set(n, i);
821
+ function pt(n, i) {
822
+ gt(), k.set(n, i);
766
823
  }
767
- function kt(n) {
768
- return b.has(n);
824
+ function Vt(n) {
825
+ return k.has(n);
769
826
  }
770
- function Vt() {
771
- return b.size;
827
+ function It() {
828
+ return k.size;
772
829
  }
773
- function Rt(n) {
774
- const i = b.get(n);
775
- return i ? (b.delete(n), i(), !0) : !1;
830
+ function Pt(n) {
831
+ const i = k.get(n);
832
+ return i ? (k.delete(n), i(), !0) : !1;
776
833
  }
777
- function It() {
778
- b.clear(), T == null || T.disconnect(), T = null, N = !1;
834
+ function Rt() {
835
+ k.clear(), b == null || b.disconnect(), b = null, z = !1;
779
836
  }
780
- const F = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
781
- function ht(n, i, t) {
782
- F.set(n, i);
837
+ const O = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
838
+ function wt(n, i, t) {
839
+ O.set(n, i);
783
840
  let e = q.get(n);
784
841
  if (e)
785
842
  return e;
786
843
  const o = i;
787
- return e = ft(
844
+ return e = ht(
788
845
  () => {
789
- const s = F.get(n);
846
+ const s = O.get(n);
790
847
  return s || (console.warn(`Transition "${String(n)}" not found`), {});
791
848
  },
792
849
  {
793
850
  strategy: t == null ? void 0 : t.strategy,
794
851
  scope: t == null ? void 0 : t.scope,
795
852
  onCleanupEnd: () => {
796
- F.get(n) === o && gt(n);
853
+ O.get(n) === o && yt(n);
797
854
  }
798
855
  }
799
856
  ), q.set(n, e), e;
800
857
  }
801
- function gt(n) {
802
- F.delete(n), q.delete(n), _.delete(n);
858
+ function yt(n) {
859
+ O.delete(n), q.delete(n), _.delete(n);
803
860
  }
804
- function Pt(n, i = "manual") {
805
- const t = ht(
861
+ function Ft(n, i = "manual") {
862
+ const t = wt(
806
863
  n.key,
807
864
  {
808
865
  in: n.in,
@@ -819,11 +876,11 @@ function Pt(n, i = "manual") {
819
876
  return e || (e = (o) => {
820
877
  if (o) {
821
878
  const s = t(o);
822
- s && mt(o, s);
879
+ s && pt(o, s);
823
880
  }
824
881
  }, _.set(n.key, e), e);
825
882
  }
826
- function pt(n) {
883
+ function vt(n) {
827
884
  const i = n.filter((t) => t.symmetric).map((t) => ({
828
885
  from: t.to,
829
886
  to: t.from,
@@ -831,24 +888,24 @@ function pt(n) {
831
888
  }));
832
889
  return [...n, ...i];
833
890
  }
834
- function wt(n) {
891
+ function St(n) {
835
892
  let i = !1, t = 0, e = 0, o = !1;
836
- const s = 50, l = (a) => {
893
+ const s = 50, c = (f) => {
837
894
  if (!n) return;
838
- const f = a.touches[0];
839
- f && (o = f.clientX < s, o && (t = f.clientX, e = f.clientY));
840
- }, r = (a) => {
895
+ const l = f.touches[0];
896
+ l && (o = l.clientX < s, o && (t = l.clientX, e = l.clientY));
897
+ }, r = (f) => {
841
898
  if (!n || !o) return;
842
- const f = a.touches[0];
843
- if (!f) return;
844
- const A = f.clientX - t, k = f.clientY - e;
845
- A > window.outerWidth / 2 - 5 && Math.abs(A) > Math.abs(k) ? i = !0 : i = !1;
846
- }, c = () => {
899
+ const l = f.touches[0];
900
+ if (!l) return;
901
+ const E = l.clientX - t, A = l.clientY - e;
902
+ E > window.outerWidth / 2 - 5 && Math.abs(E) > Math.abs(A) ? i = !0 : i = !1;
903
+ }, a = () => {
847
904
  n && (o = !1, t = 0, e = 0);
848
905
  }, u = () => i, m = () => {
849
- typeof window > "u" || n && (window.addEventListener("touchstart", l, { passive: !0 }), window.addEventListener("touchmove", r, { passive: !0 }), window.addEventListener("touchend", c, { passive: !0 }));
906
+ typeof window > "u" || n && (window.addEventListener("touchstart", c, { passive: !0 }), window.addEventListener("touchmove", r, { passive: !0 }), window.addEventListener("touchend", a, { passive: !0 }));
850
907
  }, g = () => {
851
- typeof window > "u" || (window.removeEventListener("touchstart", l), window.removeEventListener("touchmove", r), window.removeEventListener("touchend", c));
908
+ typeof window > "u" || (window.removeEventListener("touchstart", c), window.removeEventListener("touchmove", r), window.removeEventListener("touchend", a));
852
909
  };
853
910
  let y = 0;
854
911
  return {
@@ -860,26 +917,7 @@ function wt(n) {
860
917
  }
861
918
  };
862
919
  }
863
- const yt = (n) => {
864
- let i = n.parentElement;
865
- for (; i && i !== document.body; ) {
866
- const t = window.getComputedStyle(i), e = t.overflow + t.overflowY + t.overflowX;
867
- if (e.includes("auto") || e.includes("scroll") || i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth)
868
- return i;
869
- i = i.parentElement;
870
- }
871
- return document.documentElement;
872
- }, vt = (n) => {
873
- let i = n.parentElement;
874
- for (; i && i !== document.body; ) {
875
- const t = window.getComputedStyle(i).position;
876
- if (t === "relative" || t === "absolute" || t === "fixed" || t === "sticky")
877
- return i;
878
- i = i.parentElement;
879
- }
880
- return document.body;
881
- };
882
- function St() {
920
+ function Ct() {
883
921
  let n = null, i = null;
884
922
  const t = /* @__PURE__ */ new Map();
885
923
  let e = null;
@@ -891,7 +929,7 @@ function St() {
891
929
  };
892
930
  return {
893
931
  initializeContext: (m, g) => {
894
- i = m, n || (n = yt(m), (n === document.documentElement ? window : n).addEventListener("scroll", o, {
932
+ i = m, n || (n = dt(m), (n === document.documentElement ? window : n).addEventListener("scroll", o, {
895
933
  passive: !0
896
934
  })), e = g;
897
935
  },
@@ -903,11 +941,11 @@ function St() {
903
941
  };
904
942
  },
905
943
  getScrollContainer: () => n,
906
- getPositionedParentElement: () => i ? vt(i) : document.body,
944
+ getPositionedParentElement: () => i ? mt(i) : document.body,
907
945
  getScrollPosition: (m) => m && t.has(m) ? t.get(m) : { x: 0, y: 0 }
908
946
  };
909
947
  }
910
- function M(n, i) {
948
+ function x(n, i) {
911
949
  if (i === "*")
912
950
  return !0;
913
951
  if (i.endsWith("/*")) {
@@ -916,12 +954,12 @@ function M(n, i) {
916
954
  }
917
955
  return n === i;
918
956
  }
919
- function Ct(n, i, t) {
957
+ function At(n, i, t) {
920
958
  for (const e of t)
921
- if (M(n, e.from) && M(i, e.to))
959
+ if (x(n, e.from) && x(i, e.to))
922
960
  return e.transition;
923
961
  for (const e of t)
924
- if ((e.from === "*" || M(n, e.from)) && (e.to === "*" || M(i, e.to)))
962
+ if ((e.from === "*" || x(n, e.from)) && (e.to === "*" || x(i, e.to)))
925
963
  return e.transition;
926
964
  return null;
927
965
  }
@@ -933,29 +971,29 @@ function xt(n, i) {
933
971
  // Identity function as default
934
972
  skipOnIosSwipe: s = !0
935
973
  // Default to true - skip animations on iOS swipe
936
- } = n, { outFirst: l = !0 } = i || {};
974
+ } = n, { outFirst: c = !0 } = i || {};
937
975
  let r = null;
938
- const c = pt(t), {
976
+ const a = vt(t), {
939
977
  initializeContext: u,
940
978
  calculateScrollOffset: m,
941
979
  getScrollContainer: g,
942
980
  getPositionedParentElement: y,
943
981
  getScrollPosition: S
944
- } = St(), a = wt(s);
945
- a.initialize();
946
- function f() {
982
+ } = Ct(), f = St(s);
983
+ f.initialize();
984
+ function l() {
947
985
  if (r != null && r.from && (r != null && r.to)) {
948
986
  const { from: w, to: h } = o(
949
987
  r.from,
950
988
  r.to
951
- ), C = Ct(
989
+ ), C = At(
952
990
  w,
953
991
  h,
954
- c
992
+ a
955
993
  ) || e, V = m(
956
994
  r.from,
957
995
  r.to
958
- ), I = {
996
+ ), P = {
959
997
  scrollOffset: V,
960
998
  scroll: S(r.from),
961
999
  get scrollingElement() {
@@ -977,54 +1015,52 @@ function xt(n, i) {
977
1015
  }
978
1016
  };
979
1017
  C && (C.out && r.outResolve && r.outResolve(
980
- (D) => C.out(D, I)
1018
+ (L) => C.out(L, P)
981
1019
  ), C.in && r.inResolve && r.inResolve(
982
- (D) => C.in(D, B)
1020
+ (L) => C.in(L, B)
983
1021
  )), r = null;
984
1022
  }
985
1023
  }
986
- function A() {
1024
+ function E() {
987
1025
  r && (r.inResolve && r.inResolve(() => ({})), r.outResolve && r.outResolve(() => ({})), r = null);
988
1026
  }
989
- const v = l ? async (w, h) => a.isSwipePending() ? (a.resetSwipeDetection(), () => ({})) : h === "in" && (!r || !r.from) ? () => ({}) : (r || (r = {}), h === "out" ? (r.from = w, new Promise((E) => {
990
- r.outResolve = E, f();
991
- })) : (r.to = w, new Promise((E) => {
992
- r.inResolve = E, f();
993
- }))) : async (w, h) => a.isSwipePending() ? (a.resetSwipeDetection(), () => ({})) : (r && (h === "out" && r.from && r.from !== w || h === "in" && r.to && r.to !== w) && A(), r || (r = {}), h === "out" ? (r.from = w, new Promise((C) => {
994
- r.outResolve = C, f();
1027
+ const v = c ? async (w, h) => f.isSwipePending() ? (f.resetSwipeDetection(), () => ({})) : h === "in" && (!r || !r.from) ? () => ({}) : (r || (r = {}), h === "out" ? (r.from = w, new Promise((T) => {
1028
+ r.outResolve = T, l();
1029
+ })) : (r.to = w, new Promise((T) => {
1030
+ r.inResolve = T, l();
1031
+ }))) : async (w, h) => f.isSwipePending() ? (f.resetSwipeDetection(), () => ({})) : (r && (h === "out" && r.from && r.from !== w || h === "in" && r.to && r.to !== w) && E(), r || (r = {}), h === "out" ? (r.from = w, new Promise((C) => {
1032
+ r.outResolve = C, l();
995
1033
  })) : (r.to = w, new Promise((C) => {
996
- r.inResolve = C, f();
1034
+ r.inResolve = C, l();
997
1035
  })));
998
1036
  return (w) => ({
999
1037
  key: w,
1000
1038
  in: async (h) => (u(h, w), (await v(w, "in"))(h)),
1001
1039
  out: async (h) => (await v(w, "out"))(h),
1002
1040
  // Add page transition strategy for page-level transitions
1003
- [W]: ct
1041
+ [W]: lt
1004
1042
  });
1005
1043
  }
1006
1044
  export {
1007
- j as SCOPE_ATTR,
1008
- G as SCOPE_READY_ATTR,
1045
+ G as SCOPE_ATTR,
1046
+ $ as SCOPE_READY_ATTR,
1009
1047
  W as TRANSITION_STRATEGY,
1010
- at as createDefaultStrategy,
1011
- ct as createPageTransitionStrategy,
1048
+ ct as createDefaultStrategy,
1049
+ lt as createPageTransitionStrategy,
1012
1050
  xt as createSggoiTransitionContext,
1013
- bt as createTransitionScope,
1014
- ut as findScope,
1015
- Vt as getWatchedCount,
1016
- Ot as isCssAnimation,
1017
- Lt as isMultiSpring,
1018
- lt as isScopeReady,
1019
- Dt as isSingleSpring,
1020
- zt as isTickAnimation,
1021
- kt as isWatched,
1022
- U as normalizeMultiSpringSchedule,
1023
- P as normalizeToMultiSpring,
1024
- It as resetObserver,
1025
- Pt as transition,
1026
- Rt as triggerUnmount,
1027
- Nt as validateAnimationMode,
1028
- qt as validateSpringItem,
1029
- mt as watchUnmount
1051
+ kt as createTransitionScope,
1052
+ ft as findScope,
1053
+ It as getWatchedCount,
1054
+ Lt as isCssAnimation,
1055
+ Dt as isMultiAnimation,
1056
+ ut as isScopeReady,
1057
+ zt as isSingleAnimation,
1058
+ qt as isTickAnimation,
1059
+ Vt as isWatched,
1060
+ N as normalizeSchedule,
1061
+ R as normalizeToMultiAnimation,
1062
+ Rt as resetObserver,
1063
+ Ft as transition,
1064
+ Pt as triggerUnmount,
1065
+ pt as watchUnmount
1030
1066
  };