flemo 1.4.1 → 1.5.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.d.ts CHANGED
@@ -11,5 +11,6 @@ export { default as createRawDecorator } from './transition/decorator/createRawD
11
11
  export { default as Screen, type ScreenProps } from './screen/Screen';
12
12
  export { default as LayoutScreen } from './screen/LayoutScreen';
13
13
  export { default as LayoutConfig } from './screen/LayoutConfig';
14
+ export { default as useViewportScrollHeight } from './screen/useViewportScrollHeight';
14
15
  export type { TransitionName, RegisterTransition } from './transition/typing';
15
16
  export type { DecoratorName, RegisterDecorator } from './transition/decorator/typing';
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { jsx as D, jsxs as yt } from "react/jsx-runtime";
2
- import ot, { useEffect as Y, createContext as Et, useContext as St, useReducer as Yt, Children as kt, Suspense as qt, useImperativeHandle as Bt, useState as it, useRef as $, useLayoutEffect as vt } from "react";
3
- import { transform as Mt, useAnimate as Ct, motion as Rt, useDragControls as Xt, AnimatePresence as zt, MotionConfig as Kt } from "motion/react";
4
- var H = {}, Tt;
5
- function Wt() {
6
- if (Tt) return H;
7
- Tt = 1, Object.defineProperty(H, "__esModule", { value: !0 }), H.PathError = H.TokenData = void 0, H.parse = l, H.compile = w, H.match = I, H.pathToRegexp = L, H.stringify = Q;
1
+ import { jsx as x, jsxs as yt } from "react/jsx-runtime";
2
+ import at, { useEffect as Y, createContext as Et, useContext as St, useReducer as qt, Children as Mt, useImperativeHandle as Bt, useState as ot, useRef as $, useLayoutEffect as Tt, Activity as Ct } from "react";
3
+ import { transform as bt, useAnimate as Rt, motion as At, useDragControls as Xt, AnimatePresence as Kt, MotionConfig as Wt } from "motion/react";
4
+ var H = {}, Lt;
5
+ function zt() {
6
+ if (Lt) return H;
7
+ Lt = 1, Object.defineProperty(H, "__esModule", { value: !0 }), H.PathError = H.TokenData = void 0, H.parse = l, H.compile = E, H.match = L, H.pathToRegexp = D, H.stringify = Q;
8
8
  const n = "/", e = (i) => i, t = /^[$_\p{ID_Start}]$/u, s = /^[$\u200c\u200d\p{ID_Continue}]$/u, r = {
9
9
  // Groups.
10
10
  "{": "{",
@@ -41,74 +41,74 @@ function Wt() {
41
41
  const { encodePath: y = e } = d, m = [...i], f = [];
42
42
  let p = 0, S = 0;
43
43
  function T() {
44
- let E = "";
44
+ let w = "";
45
45
  if (t.test(m[p]))
46
46
  do
47
- E += m[p++];
47
+ w += m[p++];
48
48
  while (s.test(m[p]));
49
49
  else if (m[p] === '"') {
50
- let b = p;
50
+ let R = p;
51
51
  for (; p++ < m.length; ) {
52
52
  if (m[p] === '"') {
53
- p++, b = 0;
53
+ p++, R = 0;
54
54
  break;
55
55
  }
56
- m[p] === "\\" && p++, E += m[p];
56
+ m[p] === "\\" && p++, w += m[p];
57
57
  }
58
- if (b)
59
- throw new h(`Unterminated quote at index ${b}`, i);
58
+ if (R)
59
+ throw new h(`Unterminated quote at index ${R}`, i);
60
60
  }
61
- if (!E)
61
+ if (!w)
62
62
  throw new h(`Missing parameter name at index ${p}`, i);
63
- return E;
63
+ return w;
64
64
  }
65
65
  for (; p < m.length; ) {
66
- const E = m[p], b = r[E];
67
- b ? f.push({ type: b, index: p++, value: E }) : E === "\\" ? f.push({ type: "escape", index: p++, value: m[p++] }) : E === ":" ? f.push({ type: "param", index: p++, value: T() }) : E === "*" ? f.push({ type: "wildcard", index: p++, value: T() }) : f.push({ type: "char", index: p++, value: E });
66
+ const w = m[p], R = r[w];
67
+ R ? f.push({ type: R, index: p++, value: w }) : w === "\\" ? f.push({ type: "escape", index: p++, value: m[p++] }) : w === ":" ? f.push({ type: "param", index: p++, value: T() }) : w === "*" ? f.push({ type: "wildcard", index: p++, value: T() }) : f.push({ type: "char", index: p++, value: w });
68
68
  }
69
69
  f.push({ type: "end", index: p, value: "" });
70
- function C(E) {
71
- const b = [];
70
+ function C(w) {
71
+ const R = [];
72
72
  for (; ; ) {
73
73
  const N = f[S++];
74
- if (N.type === E)
74
+ if (N.type === w)
75
75
  break;
76
76
  if (N.type === "char" || N.type === "escape") {
77
77
  let O = N.value, j = f[S];
78
78
  for (; j.type === "char" || j.type === "escape"; )
79
79
  O += j.value, j = f[++S];
80
- b.push({
80
+ R.push({
81
81
  type: "text",
82
82
  value: y(O)
83
83
  });
84
84
  continue;
85
85
  }
86
86
  if (N.type === "param" || N.type === "wildcard") {
87
- b.push({
87
+ R.push({
88
88
  type: N.type,
89
89
  name: N.value
90
90
  });
91
91
  continue;
92
92
  }
93
93
  if (N.type === "{") {
94
- b.push({
94
+ R.push({
95
95
  type: "group",
96
96
  tokens: C("}")
97
97
  });
98
98
  continue;
99
99
  }
100
- throw new h(`Unexpected ${N.type} at index ${N.index}, expected ${E}`, i);
100
+ throw new h(`Unexpected ${N.type} at index ${N.index}, expected ${w}`, i);
101
101
  }
102
- return b;
102
+ return R;
103
103
  }
104
104
  return new u(C("end"), i);
105
105
  }
106
- function w(i, d = {}) {
106
+ function E(i, d = {}) {
107
107
  const { encode: y = encodeURIComponent, delimiter: m = n } = d, f = typeof i == "object" ? i : l(i, d), p = g(f.tokens, m, y);
108
108
  return function(T = {}) {
109
- const [C, ...E] = p(T);
110
- if (E.length)
111
- throw new TypeError(`Missing parameters: ${E.join(", ")}`);
109
+ const [C, ...w] = p(T);
110
+ if (w.length)
111
+ throw new TypeError(`Missing parameters: ${w.join(", ")}`);
112
112
  return C;
113
113
  };
114
114
  }
@@ -156,36 +156,36 @@ function Wt() {
156
156
  return [m(p)];
157
157
  };
158
158
  }
159
- function I(i, d = {}) {
160
- const { decode: y = decodeURIComponent, delimiter: m = n } = d, { regexp: f, keys: p } = L(i, d), S = p.map((T) => y === !1 ? e : T.type === "param" ? y : (C) => C.split(m).map(y));
159
+ function L(i, d = {}) {
160
+ const { decode: y = decodeURIComponent, delimiter: m = n } = d, { regexp: f, keys: p } = D(i, d), S = p.map((T) => y === !1 ? e : T.type === "param" ? y : (C) => C.split(m).map(y));
161
161
  return function(C) {
162
- const E = f.exec(C);
163
- if (!E)
162
+ const w = f.exec(C);
163
+ if (!w)
164
164
  return !1;
165
- const b = E[0], N = /* @__PURE__ */ Object.create(null);
166
- for (let O = 1; O < E.length; O++) {
167
- if (E[O] === void 0)
165
+ const R = w[0], N = /* @__PURE__ */ Object.create(null);
166
+ for (let O = 1; O < w.length; O++) {
167
+ if (w[O] === void 0)
168
168
  continue;
169
- const j = p[O - 1], nt = S[O - 1];
170
- N[j.name] = nt(E[O]);
169
+ const j = p[O - 1], ut = S[O - 1];
170
+ N[j.name] = ut(w[O]);
171
171
  }
172
- return { path: b, params: N };
172
+ return { path: R, params: N };
173
173
  };
174
174
  }
175
- function L(i, d = {}) {
175
+ function D(i, d = {}) {
176
176
  const { delimiter: y = n, end: m = !0, sensitive: f = !1, trailing: p = !0 } = d, S = [], T = f ? "" : "i", C = [];
177
- for (const N of x(i, [])) {
177
+ for (const N of I(i, [])) {
178
178
  const O = typeof N == "object" ? N : l(N, d);
179
179
  for (const j of P(O.tokens, 0, []))
180
180
  C.push(M(j, y, S, O.originalPath));
181
181
  }
182
- let E = `^(?:${C.join("|")})`;
183
- return p && (E += `(?:${o(y)}$)?`), E += m ? "$" : `(?=${o(y)}|$)`, { regexp: new RegExp(E, T), keys: S };
182
+ let w = `^(?:${C.join("|")})`;
183
+ return p && (w += `(?:${o(y)}$)?`), w += m ? "$" : `(?=${o(y)}|$)`, { regexp: new RegExp(w, T), keys: S };
184
184
  }
185
- function x(i, d) {
185
+ function I(i, d) {
186
186
  if (Array.isArray(i))
187
187
  for (const y of i)
188
- x(y, d);
188
+ I(y, d);
189
189
  else
190
190
  d.push(i);
191
191
  return d;
@@ -211,19 +211,19 @@ function Wt() {
211
211
  if (T.type === "param" || T.type === "wildcard") {
212
212
  if (!S && !p)
213
213
  throw new h(`Missing text before "${T.name}" ${T.type}`, m);
214
- T.type === "param" ? f += `(${K(d, S ? "" : p)}+)` : f += "([\\s\\S]+)", y.push(T), p = "", S = !1;
214
+ T.type === "param" ? f += `(${W(d, S ? "" : p)}+)` : f += "([\\s\\S]+)", y.push(T), p = "", S = !1;
215
215
  continue;
216
216
  }
217
217
  }
218
218
  return f;
219
219
  }
220
- function K(i, d) {
220
+ function W(i, d) {
221
221
  return d.length < 2 ? i.length < 2 ? `[^${o(i + d)}]` : `(?:(?!${o(i)})[^${o(d)}])` : i.length < 2 ? `(?:(?!${o(d)})[^${o(i)}])` : `(?:(?!${o(d)}|${o(i)})[\\s\\S])`;
222
222
  }
223
223
  function _(i) {
224
224
  let d = "", y = 0;
225
225
  function m(f) {
226
- return k(f) && R(i[y]) ? f : JSON.stringify(f);
226
+ return k(f) && b(i[y]) ? f : JSON.stringify(f);
227
227
  }
228
228
  for (; y < i.length; ) {
229
229
  const f = i[y++];
@@ -254,17 +254,17 @@ function Wt() {
254
254
  const [d, ...y] = i;
255
255
  return t.test(d) && y.every((m) => s.test(m));
256
256
  }
257
- function R(i) {
257
+ function b(i) {
258
258
  return i && i.type === "text" ? !s.test(i.value[0]) : !0;
259
259
  }
260
260
  return H;
261
261
  }
262
- var z = Wt();
262
+ var K = zt();
263
263
  function Jt(n, e, t) {
264
- const s = Array.isArray(n) ? n.find((u) => z.pathToRegexp(u).regexp.test(e)) || "" : z.pathToRegexp(n).regexp.test(e) ? n : "", r = z.match(s)(e), a = new URLSearchParams(t), o = Object.fromEntries(a.entries());
264
+ const s = Array.isArray(n) ? n.find((u) => K.pathToRegexp(u).regexp.test(e)) || "" : K.pathToRegexp(n).regexp.test(e) ? n : "", r = K.match(s)(e), a = new URLSearchParams(t), o = Object.fromEntries(a.entries());
265
265
  return r ? { ...r.params, ...o } : {};
266
266
  }
267
- function Lt() {
267
+ function Dt() {
268
268
  return typeof document > "u";
269
269
  }
270
270
  class Zt {
@@ -335,7 +335,7 @@ class Zt {
335
335
  return new Promise((r, a) => {
336
336
  this.taskQueue = this.taskQueue.then(async () => {
337
337
  try {
338
- const { control: o, validate: u, rollback: h, dependencies: l = [], delay: w } = t, g = new AbortController(), c = {
338
+ const { control: o, validate: u, rollback: h, dependencies: l = [], delay: E } = t, g = new AbortController(), c = {
339
339
  id: s,
340
340
  execute: e,
341
341
  timestamp: Date.now(),
@@ -348,7 +348,7 @@ class Zt {
348
348
  control: o,
349
349
  abortController: g
350
350
  };
351
- this.tasks.set(c.id, c), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(c), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((L) => L.id !== c.id));
351
+ this.tasks.set(c.id, c), this.pendingTaskQueue.length > 0 && (this.pendingTaskQueue.push(c), await this.waitForPendingTasks(), this.pendingTaskQueue = this.pendingTaskQueue.filter((D) => D.id !== c.id));
352
352
  try {
353
353
  if (!await this.acquireLock(c.id))
354
354
  throw c.status = "FAILED", new Error("FAILED");
@@ -361,8 +361,8 @@ class Zt {
361
361
  }
362
362
  if (c.validate && !await c.validate())
363
363
  throw c.status = "FAILED", new Error("FAILED");
364
- w && w > 0 && await new Promise((P) => setTimeout(P, w));
365
- const x = await c.execute(c.abortController);
364
+ E && E > 0 && await new Promise((P) => setTimeout(P, E));
365
+ const I = await c.execute(c.abortController);
366
366
  if (c.abortController.signal.aborted) {
367
367
  c.status = "COMPLETED", await this.onTaskStatusChange(c.id, "COMPLETED"), r({
368
368
  success: !0,
@@ -376,37 +376,37 @@ class Zt {
376
376
  if (t.control) {
377
377
  const P = t.control;
378
378
  if (P.delay && P.delay > 0 && await new Promise((M) => setTimeout(M, P.delay)), P.manual) {
379
- c.status = "MANUAL_PENDING", c.manualResolver = { resolve: r, reject: a, result: x }, this.pendingTaskQueue.push(c), await this.onTaskStatusChange(c.id, "MANUAL_PENDING");
379
+ c.status = "MANUAL_PENDING", c.manualResolver = { resolve: r, reject: a, result: I }, this.pendingTaskQueue.push(c), await this.onTaskStatusChange(c.id, "MANUAL_PENDING");
380
380
  return;
381
381
  }
382
382
  if (P.signal) {
383
- c.status = "SIGNAL_PENDING", c.manualResolver = { resolve: r, reject: a, result: x }, this.signalListeners.has(P.signal) || this.signalListeners.set(P.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(P.signal).add(c.id), this.pendingTaskQueue.push(c), await this.onTaskStatusChange(c.id, "SIGNAL_PENDING");
383
+ c.status = "SIGNAL_PENDING", c.manualResolver = { resolve: r, reject: a, result: I }, this.signalListeners.has(P.signal) || this.signalListeners.set(P.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(P.signal).add(c.id), this.pendingTaskQueue.push(c), await this.onTaskStatusChange(c.id, "SIGNAL_PENDING");
384
384
  return;
385
385
  }
386
386
  if (P.condition && !await P.condition()) {
387
- c.status = "MANUAL_PENDING", c.manualResolver = { resolve: r, reject: a, result: x }, this.pendingTaskQueue.push(c), await this.onTaskStatusChange(c.id, "MANUAL_PENDING");
387
+ c.status = "MANUAL_PENDING", c.manualResolver = { resolve: r, reject: a, result: I }, this.pendingTaskQueue.push(c), await this.onTaskStatusChange(c.id, "MANUAL_PENDING");
388
388
  return;
389
389
  }
390
390
  }
391
391
  c.status = "COMPLETED", await this.onTaskStatusChange(c.id, "COMPLETED"), r({
392
392
  success: !0,
393
- result: x,
393
+ result: I,
394
394
  taskId: c.id,
395
395
  timestamp: Date.now(),
396
396
  instanceId: this.instanceId
397
397
  });
398
- } catch (x) {
398
+ } catch (I) {
399
399
  if (c.status = "FAILED", c.rollback)
400
400
  try {
401
401
  await c.rollback(), c.status = "ROLLEDBACK";
402
402
  } catch {
403
403
  }
404
- throw await this.onTaskStatusChange(c.id, c.status), x;
404
+ throw await this.onTaskStatusChange(c.id, c.status), I;
405
405
  } finally {
406
406
  this.releaseLock(c.id);
407
407
  }
408
- } catch (L) {
409
- a(L);
408
+ } catch (D) {
409
+ a(D);
410
410
  }
411
411
  } catch (o) {
412
412
  a(o);
@@ -440,29 +440,29 @@ class Zt {
440
440
  await Promise.all(e.map((t) => this.resolveTask(t.id)));
441
441
  }
442
442
  }
443
- const V = new Zt(), Dt = (n) => {
443
+ const F = new Zt(), It = (n) => {
444
444
  let e;
445
- const t = /* @__PURE__ */ new Set(), s = (l, w) => {
445
+ const t = /* @__PURE__ */ new Set(), s = (l, E) => {
446
446
  const g = typeof l == "function" ? l(e) : l;
447
447
  if (!Object.is(g, e)) {
448
448
  const c = e;
449
- e = w ?? (typeof g != "object" || g === null) ? g : Object.assign({}, e, g), t.forEach((I) => I(e, c));
449
+ e = E ?? (typeof g != "object" || g === null) ? g : Object.assign({}, e, g), t.forEach((L) => L(e, c));
450
450
  }
451
451
  }, r = () => e, u = { setState: s, getState: r, getInitialState: () => h, subscribe: (l) => (t.add(l), () => t.delete(l)) }, h = e = n(s, r, u);
452
452
  return u;
453
- }, te = ((n) => n ? Dt(n) : Dt), ee = (n) => n;
453
+ }, te = ((n) => n ? It(n) : It), ee = (n) => n;
454
454
  function ne(n, e = ee) {
455
- const t = ot.useSyncExternalStore(
455
+ const t = at.useSyncExternalStore(
456
456
  n.subscribe,
457
- ot.useCallback(() => e(n.getState()), [n, e]),
458
- ot.useCallback(() => e(n.getInitialState()), [n, e])
457
+ at.useCallback(() => e(n.getState()), [n, e]),
458
+ at.useCallback(() => e(n.getInitialState()), [n, e])
459
459
  );
460
- return ot.useDebugValue(t), t;
460
+ return at.useDebugValue(t), t;
461
461
  }
462
- const It = (n) => {
462
+ const xt = (n) => {
463
463
  const e = te(n), t = (s) => ne(e, s);
464
464
  return Object.assign(t, e), t;
465
- }, ct = ((n) => n ? It(n) : It), q = ct((n) => ({
465
+ }, it = ((n) => n ? xt(n) : xt), q = it((n) => ({
466
466
  index: -1,
467
467
  histories: [],
468
468
  addHistory: (e) => n((t) => ({
@@ -477,7 +477,7 @@ const It = (n) => {
477
477
  index: t.index - 1,
478
478
  histories: t.histories.filter((s, r) => r !== e)
479
479
  }))
480
- })), U = ct((n) => ({
480
+ })), U = it((n) => ({
481
481
  status: "IDLE",
482
482
  setStatus: (e) => n({ status: e })
483
483
  }));
@@ -485,27 +485,27 @@ function re() {
485
485
  return Y(() => {
486
486
  const n = async (e) => {
487
487
  const t = e.state?.id;
488
- (await V.addTask(
488
+ (await F.addTask(
489
489
  async (s) => {
490
- const r = e.state?.index, a = e.state?.status, o = e.state?.params, u = e.state?.transitionName, h = e.state?.layoutId, l = U.getState().setStatus, { index: w, addHistory: g, popHistory: c } = q.getState(), I = r < w, L = a === "PUSHING" && r > w, x = a === "REPLACING" && r > w, P = window.location.pathname;
491
- if (!I && !L && !x) {
490
+ const r = e.state?.index, a = e.state?.status, o = e.state?.params, u = e.state?.transitionName, h = e.state?.layoutId, l = U.getState().setStatus, { index: E, addHistory: g, popHistory: c } = q.getState(), L = r < E, D = a === "PUSHING" && r > E, I = a === "REPLACING" && r > E, P = window.location.pathname;
491
+ if (!L && !D && !I) {
492
492
  s.abort();
493
493
  return;
494
494
  }
495
- return I ? l("POPPING") : L ? (l("PUSHING"), g({
495
+ return L ? l("POPPING") : D ? (l("PUSHING"), g({
496
496
  id: t,
497
497
  pathname: P,
498
498
  params: o,
499
499
  transitionName: u,
500
500
  layoutId: h
501
- })) : x && (l("REPLACING"), g({
501
+ })) : I && (l("REPLACING"), g({
502
502
  id: t,
503
503
  pathname: P,
504
504
  params: o,
505
505
  transitionName: u,
506
506
  layoutId: h
507
507
  })), async () => {
508
- I && c(r + 1), l("COMPLETED");
508
+ L && c(r + 1), l("COMPLETED");
509
509
  };
510
510
  },
511
511
  {
@@ -521,17 +521,12 @@ function re() {
521
521
  };
522
522
  }, []), null;
523
523
  }
524
- const bt = Et({}), At = Et(() => {
524
+ const Ot = Et({}), Gt = Et(() => {
525
525
  });
526
526
  function se(n, e) {
527
- switch (e.type) {
528
- case "SET":
529
- return e.params;
530
- default:
531
- return n;
532
- }
527
+ return e.type === "SET" ? e.params : n;
533
528
  }
534
- const Ot = Et({
529
+ const $t = Et({
535
530
  id: "",
536
531
  isActive: !1,
537
532
  isRoot: !0,
@@ -544,31 +539,31 @@ const Ot = Et({
544
539
  layoutId: null
545
540
  });
546
541
  function Z() {
547
- return St(Ot);
542
+ return St($t);
548
543
  }
549
544
  function ae({ children: n }) {
550
- const { isActive: e, params: t } = Z(), [s, r] = Yt(se, t);
545
+ const { isActive: e, params: t } = Z(), [s, r] = qt(se, t);
551
546
  return Y(() => {
552
547
  const a = async (o) => {
553
- o.state?.step && await V.addTask(async () => {
548
+ o.state?.step && await F.addTask(async () => {
554
549
  r({ type: "SET", params: o.state?.params || {} });
555
550
  });
556
551
  };
557
552
  return e && window.addEventListener("popstate", a), () => {
558
553
  window.removeEventListener("popstate", a);
559
554
  };
560
- }, [e, r]), /* @__PURE__ */ D(At.Provider, { value: r, children: /* @__PURE__ */ D(bt.Provider, { value: s, children: n }) });
555
+ }, [e, r]), /* @__PURE__ */ x(Gt.Provider, { value: r, children: /* @__PURE__ */ x(Ot.Provider, { value: s, children: n }) });
561
556
  }
562
557
  function oe({ children: n }) {
563
558
  const e = q((s) => s.index), t = q((s) => s.histories);
564
559
  return t.map(
565
- (s) => kt.toArray(n).filter(
566
- (r) => z.pathToRegexp(r.props.path).regexp.test(
560
+ (s) => Mt.toArray(n).filter(
561
+ (r) => K.pathToRegexp(r.props.path).regexp.test(
567
562
  s.pathname
568
563
  )
569
564
  )
570
- ).map(([s], r) => /* @__PURE__ */ D(
571
- Ot.Provider,
565
+ ).map(([s], r) => /* @__PURE__ */ x(
566
+ $t.Provider,
572
567
  {
573
568
  value: {
574
569
  id: t[r].id,
@@ -582,7 +577,7 @@ function oe({ children: n }) {
582
577
  prevTransitionName: t[e - 1]?.transitionName,
583
578
  layoutId: t[r].layoutId
584
579
  },
585
- children: /* @__PURE__ */ D(ae, { children: s })
580
+ children: /* @__PURE__ */ x(ae, { children: s })
586
581
  },
587
582
  t[r].id
588
583
  ));
@@ -665,11 +660,11 @@ const ce = ie({
665
660
  }
666
661
  )
667
662
  }
668
- }), Pt = /* @__PURE__ */ new Map([["overlay", ce]]), mt = ct((n) => ({
663
+ }), Pt = /* @__PURE__ */ new Map([["overlay", ce]]), mt = it((n) => ({
669
664
  defaultTransitionName: "cupertino",
670
665
  setDefaultTransitionName: (e) => n({ defaultTransitionName: e })
671
666
  }));
672
- function ut({
667
+ function ct({
673
668
  name: n,
674
669
  initial: e,
675
670
  idle: t,
@@ -697,7 +692,7 @@ function ut({
697
692
  ...u
698
693
  };
699
694
  }
700
- const ue = ut({
695
+ const ue = ct({
701
696
  name: "cupertino",
702
697
  initial: {
703
698
  x: "100%"
@@ -751,7 +746,7 @@ const ue = ut({
751
746
  swipeDirection: "x",
752
747
  onSwipeStart: async () => !0,
753
748
  onSwipe: (n, e, { animate: t, currentScreen: s, prevScreen: r, onProgress: a }) => {
754
- const { offset: o } = e, u = o.x, h = Mt(u, [0, window.innerWidth], [0, 100]);
749
+ const { offset: o } = e, u = o.x, h = bt(u, [0, window.innerWidth], [0, 100]);
755
750
  return a?.(!0, h), t(
756
751
  s,
757
752
  {
@@ -796,7 +791,7 @@ const ue = ut({
796
791
  ]), l;
797
792
  }
798
793
  }
799
- }), le = ut({
794
+ }), le = ct({
800
795
  name: "layout",
801
796
  initial: {
802
797
  opacity: 0.97
@@ -846,7 +841,7 @@ const ue = ut({
846
841
  swipeDirection: "y",
847
842
  onSwipeStart: async () => !0,
848
843
  onSwipe: (n, e, { animate: t, currentScreen: s, onProgress: r }) => {
849
- const { offset: a } = e, o = a.y, u = Math.max(0, Math.min(56, o)), h = Mt(u, [0, 56], [1, 0.96]), l = Math.max(0, o - 56), w = Math.min(1, l / 160), g = Math.sqrt(w) * 12, c = Math.max(0, u + g), I = Math.min(56, c);
844
+ const { offset: a } = e, o = a.y, u = Math.max(0, Math.min(56, o)), h = bt(u, [0, 56], [1, 0.96]), l = Math.max(0, o - 56), E = Math.min(1, l / 160), g = Math.sqrt(E) * 12, c = Math.max(0, u + g), L = Math.min(56, c);
850
845
  return r?.(!0, 100), t(
851
846
  s,
852
847
  {
@@ -856,7 +851,7 @@ const ue = ut({
856
851
  {
857
852
  duration: 0
858
853
  }
859
- ), I;
854
+ ), L;
860
855
  },
861
856
  onSwipeEnd: async (n, e, { animate: t, currentScreen: s, prevScreen: r, onStart: a }) => {
862
857
  const { offset: o, velocity: u } = e, l = o.y > 56 || u.y > 20;
@@ -884,7 +879,7 @@ const ue = ut({
884
879
  ]), l;
885
880
  }
886
881
  }
887
- }), de = ut({
882
+ }), de = ct({
888
883
  name: "material",
889
884
  initial: {
890
885
  y: "100%"
@@ -937,8 +932,8 @@ const ue = ut({
937
932
  swipeDirection: "y",
938
933
  onSwipeStart: async () => !0,
939
934
  onSwipe: (n, e, { animate: t, currentScreen: s, prevScreen: r, onProgress: a }) => {
940
- const { offset: o } = e, u = o.y, h = Math.max(0, Math.min(56, u)), l = Math.max(0, u - 56), w = Math.min(1, l / 160), g = Math.sqrt(w) * 12, c = Math.max(0, h + g), I = Math.min(56, c);
941
- return a?.(!0, I), t(
935
+ const { offset: o } = e, u = o.y, h = Math.max(0, Math.min(56, u)), l = Math.max(0, u - 56), E = Math.min(1, l / 160), g = Math.sqrt(E) * 12, c = Math.max(0, h + g), L = Math.min(56, c);
936
+ return a?.(!0, L), t(
942
937
  s,
943
938
  {
944
939
  y: c
@@ -949,10 +944,10 @@ const ue = ut({
949
944
  ), t(
950
945
  r,
951
946
  {
952
- y: -56 + I
947
+ y: -56 + L
953
948
  },
954
949
  { duration: 0 }
955
- ), I;
950
+ ), L;
956
951
  },
957
952
  onSwipeEnd: async (n, e, { animate: t, currentScreen: s, prevScreen: r, onStart: a }) => {
958
953
  const { offset: o, velocity: u } = e, l = o.y > 56 || u.y > 20;
@@ -980,7 +975,7 @@ const ue = ut({
980
975
  ]), l;
981
976
  }
982
977
  }
983
- }), pe = ut({
978
+ }), pe = ct({
984
979
  name: "none",
985
980
  initial: {},
986
981
  idle: {
@@ -1027,14 +1022,14 @@ const ue = ut({
1027
1022
  }
1028
1023
  return n;
1029
1024
  })();
1030
- function ve({
1025
+ function Se({
1031
1026
  children: n,
1032
1027
  initPath: e = "/",
1033
1028
  defaultTransitionName: t = "cupertino",
1034
1029
  transitions: s = [],
1035
1030
  decorators: r = []
1036
1031
  }) {
1037
- const a = Lt() ? e || "/" : window.location.pathname, o = Lt() ? a.split("?")[1] || "" : window.location.search;
1032
+ const a = Dt() ? e || "/" : window.location.pathname, o = Dt() ? a.split("?")[1] || "" : window.location.search;
1038
1033
  return mt.setState({
1039
1034
  defaultTransitionName: t
1040
1035
  }), q.setState({
@@ -1044,7 +1039,7 @@ function ve({
1044
1039
  id: "root",
1045
1040
  pathname: a,
1046
1041
  params: Jt(
1047
- kt.toArray(n).map((u) => u.props.path).flat(),
1042
+ Mt.toArray(n).map((u) => u.props.path).flat(),
1048
1043
  a,
1049
1044
  o
1050
1045
  ),
@@ -1080,33 +1075,33 @@ function ve({
1080
1075
  height: "100%"
1081
1076
  },
1082
1077
  children: [
1083
- /* @__PURE__ */ D(re, {}),
1084
- /* @__PURE__ */ D(oe, { children: n })
1078
+ /* @__PURE__ */ x(re, {}),
1079
+ /* @__PURE__ */ x(oe, { children: n })
1085
1080
  ]
1086
1081
  }
1087
1082
  );
1088
1083
  }
1089
- function Te({ element: n }) {
1084
+ function Pe({ element: n }) {
1090
1085
  return n;
1091
1086
  }
1092
- function Le() {
1087
+ function ve() {
1093
1088
  return {
1094
1089
  push: async (s, r, a = {}) => {
1095
1090
  const { status: o, setStatus: u } = U.getState();
1096
1091
  if (o !== "COMPLETED" && o !== "IDLE")
1097
1092
  return;
1098
- const { index: h, addHistory: l } = q.getState(), w = mt.getState().defaultTransitionName, { transitionName: g = w, layoutId: c = null } = a, I = V.generateTaskId();
1099
- (await V.addTask(
1093
+ const { index: h, addHistory: l } = q.getState(), E = mt.getState().defaultTransitionName, { transitionName: g = E, layoutId: c = null } = a, L = F.generateTaskId();
1094
+ (await F.addTask(
1100
1095
  async () => {
1101
1096
  u("PUSHING");
1102
- const L = z.compile(s), x = Object.fromEntries(
1103
- Object.entries(r).map(([k, R]) => [k, String(R)])
1104
- ), P = L(x), M = z.parse(s).tokens.filter((k) => k.type === "param").map((k) => k.name), K = Object.fromEntries(
1097
+ const D = K.compile(s), I = Object.fromEntries(
1098
+ Object.entries(r).map(([k, b]) => [k, String(b)])
1099
+ ), P = D(I), M = K.parse(s).tokens.filter((k) => k.type === "param").map((k) => k.name), W = Object.fromEntries(
1105
1100
  Object.entries(r).filter(([k]) => !M.includes(k))
1106
- ), _ = new URLSearchParams(K).toString(), Q = `${P}${_ ? `?${_}` : ""}`;
1101
+ ), _ = new URLSearchParams(W).toString(), Q = `${P}${_ ? `?${_}` : ""}`;
1107
1102
  return window.history.pushState(
1108
1103
  {
1109
- id: I,
1104
+ id: L,
1110
1105
  index: h + 1,
1111
1106
  status: "PUSHING",
1112
1107
  params: r,
@@ -1116,7 +1111,7 @@ function Le() {
1116
1111
  "",
1117
1112
  Q
1118
1113
  ), l({
1119
- id: I,
1114
+ id: L,
1120
1115
  pathname: P,
1121
1116
  params: r,
1122
1117
  transitionName: g,
@@ -1126,7 +1121,7 @@ function Le() {
1126
1121
  };
1127
1122
  },
1128
1123
  {
1129
- id: I,
1124
+ id: L,
1130
1125
  control: {
1131
1126
  manual: !0
1132
1127
  }
@@ -1137,38 +1132,38 @@ function Le() {
1137
1132
  const { status: o, setStatus: u } = U.getState();
1138
1133
  if (o !== "COMPLETED" && o !== "IDLE")
1139
1134
  return;
1140
- const { index: h, addHistory: l } = q.getState(), w = q.getState().replaceHistory, g = mt.getState().defaultTransitionName, { transitionName: c = g, layoutId: I = null } = a, L = V.generateTaskId();
1141
- (await V.addTask(
1135
+ const { index: h, addHistory: l } = q.getState(), E = q.getState().replaceHistory, g = mt.getState().defaultTransitionName, { transitionName: c = g, layoutId: L = null } = a, D = F.generateTaskId();
1136
+ (await F.addTask(
1142
1137
  async () => {
1143
1138
  u("REPLACING");
1144
- const x = z.compile(s), P = Object.fromEntries(
1145
- Object.entries(r).map(([R, i]) => [R, String(i)])
1146
- ), M = x(P), K = z.parse(s).tokens.filter((R) => R.type === "param").map((R) => R.name), _ = Object.fromEntries(
1147
- Object.entries(r).filter(([R]) => !K.includes(R))
1139
+ const I = K.compile(s), P = Object.fromEntries(
1140
+ Object.entries(r).map(([b, i]) => [b, String(i)])
1141
+ ), M = I(P), W = K.parse(s).tokens.filter((b) => b.type === "param").map((b) => b.name), _ = Object.fromEntries(
1142
+ Object.entries(r).filter(([b]) => !W.includes(b))
1148
1143
  ), Q = new URLSearchParams(_).toString(), k = `${M}${Q ? `?${Q}` : ""}`;
1149
1144
  return window.history.replaceState(
1150
1145
  {
1151
- id: L,
1146
+ id: D,
1152
1147
  index: h,
1153
1148
  status: "REPLACING",
1154
1149
  params: r,
1155
1150
  transitionName: c,
1156
- layoutId: I
1151
+ layoutId: L
1157
1152
  },
1158
1153
  "",
1159
1154
  k
1160
1155
  ), l({
1161
- id: L,
1156
+ id: D,
1162
1157
  pathname: M,
1163
1158
  params: r,
1164
1159
  transitionName: c,
1165
- layoutId: I
1160
+ layoutId: L
1166
1161
  }), async () => {
1167
- w(h), u("COMPLETED");
1162
+ E(h), u("COMPLETED");
1168
1163
  };
1169
1164
  },
1170
1165
  {
1171
- id: L,
1166
+ id: D,
1172
1167
  control: {
1173
1168
  manual: !0
1174
1169
  }
@@ -1181,12 +1176,12 @@ function Le() {
1181
1176
  }
1182
1177
  };
1183
1178
  }
1184
- function De() {
1185
- const n = St(At);
1179
+ function Te() {
1180
+ const n = St(Gt);
1186
1181
  return {
1187
1182
  pushStep: async (r) => {
1188
1183
  const a = U.getState().status;
1189
- a !== "COMPLETED" && a !== "IDLE" || (await V.addTask(async () => {
1184
+ a !== "COMPLETED" && a !== "IDLE" || (await F.addTask(async () => {
1190
1185
  const o = new URLSearchParams(r).toString(), u = `${window.location.pathname}${o ? `?${o}` : ""}`;
1191
1186
  return window.history.state?.step || window.history.replaceState(
1192
1187
  {
@@ -1208,7 +1203,7 @@ function De() {
1208
1203
  },
1209
1204
  replaceStep: async (r) => {
1210
1205
  const a = U.getState().status;
1211
- a !== "COMPLETED" && a !== "IDLE" || (await V.addTask(async () => {
1206
+ a !== "COMPLETED" && a !== "IDLE" || (await F.addTask(async () => {
1212
1207
  const o = new URLSearchParams(r).toString(), u = `${window.location.pathname}${o ? `?${o}` : ""}`;
1213
1208
  return window.history.replaceState(
1214
1209
  {
@@ -1227,10 +1222,10 @@ function De() {
1227
1222
  }
1228
1223
  };
1229
1224
  }
1230
- function Ie() {
1231
- return St(bt);
1225
+ function Le() {
1226
+ return St(Ot);
1232
1227
  }
1233
- function xe({
1228
+ function De({
1234
1229
  name: n,
1235
1230
  initial: e,
1236
1231
  idle: t,
@@ -1241,7 +1236,7 @@ function xe({
1241
1236
  popOnEnter: u,
1242
1237
  popOnExit: h,
1243
1238
  completedOnExit: l,
1244
- completedOnEnter: w,
1239
+ completedOnEnter: E,
1245
1240
  options: g
1246
1241
  }) {
1247
1242
  return {
@@ -1257,12 +1252,12 @@ function xe({
1257
1252
  "POPPING-false": h,
1258
1253
  "POPPING-true": u,
1259
1254
  "COMPLETED-false": l,
1260
- "COMPLETED-true": w
1255
+ "COMPLETED-true": E
1261
1256
  },
1262
1257
  ...g
1263
1258
  };
1264
1259
  }
1265
- function Ne({
1260
+ function Ie({
1266
1261
  name: n,
1267
1262
  initial: e,
1268
1263
  idle: t,
@@ -1273,7 +1268,7 @@ function Ne({
1273
1268
  popOnEnter: u,
1274
1269
  popOnExit: h,
1275
1270
  completedOnEnter: l,
1276
- completedOnExit: w,
1271
+ completedOnExit: E,
1277
1272
  options: g
1278
1273
  }) {
1279
1274
  return {
@@ -1288,45 +1283,32 @@ function Ne({
1288
1283
  "REPLACING-true": a,
1289
1284
  "POPPING-false": h,
1290
1285
  "POPPING-true": u,
1291
- "COMPLETED-false": w,
1286
+ "COMPLETED-false": E,
1292
1287
  "COMPLETED-true": l
1293
1288
  },
1294
1289
  ...g
1295
1290
  };
1296
1291
  }
1297
- const he = { then() {
1298
- } };
1299
- function ge({
1300
- freeze: n,
1301
- children: e
1302
- }) {
1303
- if (n)
1304
- throw he;
1305
- return e;
1306
- }
1307
- function Gt({ freeze: n, children: e, placeholder: t }) {
1308
- return /* @__PURE__ */ D(qt, { fallback: t, children: /* @__PURE__ */ D(ge, { freeze: n, children: e }) });
1309
- }
1310
- function xt(n, e) {
1292
+ function Nt(n, e) {
1311
1293
  const {
1312
1294
  direction: t = "x",
1313
1295
  markerSelector: s = "[data-swipe-at-edge]",
1314
1296
  depthLimit: r = 24,
1315
1297
  verifyByScroll: a = !1
1316
- } = e ?? {}, o = ye(n);
1298
+ } = e ?? {}, o = he(n);
1317
1299
  if (!o) return { element: null, hasMarker: !1 };
1318
1300
  const u = o.closest?.(s);
1319
- if (u instanceof HTMLElement && wt(u, t) && (!a || Nt(u, t)))
1301
+ if (u instanceof HTMLElement && wt(u, t) && (!a || kt(u, t)))
1320
1302
  return { element: u, hasMarker: !0 };
1321
1303
  let h = o, l = 0;
1322
1304
  for (; h && h !== document.body && l < r; ) {
1323
- if (wt(h, t) && (!a || Nt(h, t)))
1305
+ if (wt(h, t) && (!a || kt(h, t)))
1324
1306
  return { element: h, hasMarker: !1 };
1325
1307
  h = h.parentElement, l++;
1326
1308
  }
1327
1309
  return { element: null, hasMarker: !1 };
1328
1310
  }
1329
- function ye(n) {
1311
+ function he(n) {
1330
1312
  if (!n) return null;
1331
1313
  const e = n, t = typeof e.composedPath == "function" ? e.composedPath() : void 0;
1332
1314
  if (t && t.length) {
@@ -1338,7 +1320,7 @@ function ye(n) {
1338
1320
  function wt(n, e) {
1339
1321
  return e === "y" ? n.scrollHeight - n.clientHeight > 1 : n.scrollWidth - n.clientWidth > 1;
1340
1322
  }
1341
- function Nt(n, e) {
1323
+ function kt(n, e) {
1342
1324
  if (!wt(n, e)) return !1;
1343
1325
  if (e === "y") {
1344
1326
  const t = n.scrollTop;
@@ -1356,19 +1338,19 @@ function Nt(n, e) {
1356
1338
  return n.scrollLeft = t, r;
1357
1339
  }
1358
1340
  }
1359
- function me({ children: n, ref: e, ...t }) {
1360
- const { isActive: s, transitionName: r } = Z(), [a, o] = Ct();
1341
+ function ge({ children: n, ref: e, ...t }) {
1342
+ const { isActive: s, transitionName: r } = Z(), [a, o] = Rt();
1361
1343
  Bt(e, () => a.current);
1362
- const u = U((c) => c.status), h = et.get(r), { decoratorName: l } = h, { initial: w, variants: g } = Pt.get(l);
1344
+ const u = U((c) => c.status), h = et.get(r), { decoratorName: l } = h, { initial: E, variants: g } = Pt.get(l);
1363
1345
  return Y(() => {
1364
1346
  if (!a.current) return;
1365
- const { value: c, options: I } = g[`${u}-${s}`];
1366
- o(a.current, c, I);
1367
- }, [u, s, o, g, a]), /* @__PURE__ */ D(
1368
- Rt.div,
1347
+ const { value: c, options: L } = g[`${u}-${s}`];
1348
+ o(a.current, c, L);
1349
+ }, [u, s, o, g, a]), /* @__PURE__ */ x(
1350
+ At.div,
1369
1351
  {
1370
1352
  ref: a,
1371
- initial: w,
1353
+ initial: E,
1372
1354
  style: {
1373
1355
  position: "absolute",
1374
1356
  top: 0,
@@ -1382,15 +1364,15 @@ function me({ children: n, ref: e, ...t }) {
1382
1364
  }
1383
1365
  );
1384
1366
  }
1385
- const J = ct((n) => ({
1367
+ const J = it((n) => ({
1386
1368
  dragStatus: "IDLE",
1387
1369
  replaceTransitionStatus: "IDLE",
1388
1370
  setDragStatus: (e) => n({ dragStatus: e }),
1389
1371
  setReplaceTransitionStatus: (e) => n({ replaceTransitionStatus: e })
1390
1372
  }));
1391
1373
  let gt = 0;
1392
- function we() {
1393
- const [n, e] = it(0), [t, s] = it(0);
1374
+ function ye() {
1375
+ const [n, e] = ot(0), [t, s] = ot(0);
1394
1376
  return Y(() => {
1395
1377
  const r = () => {
1396
1378
  let a = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
@@ -1403,7 +1385,7 @@ function we() {
1403
1385
  };
1404
1386
  }, []), { viewportScrollHeight: n, changedViewportScrollHeight: t };
1405
1387
  }
1406
- function $t({
1388
+ function Ht({
1407
1389
  children: n,
1408
1390
  statusBarHeight: e,
1409
1391
  statusBarColor: t,
@@ -1414,83 +1396,83 @@ function $t({
1414
1396
  appBar: u,
1415
1397
  navigationBar: h,
1416
1398
  hideStatusBar: l,
1417
- hideSystemNavigationBar: w,
1399
+ hideSystemNavigationBar: E,
1418
1400
  backgroundColor: g = "white",
1419
1401
  contentScrollable: c = !0,
1420
- ...I
1402
+ ...L
1421
1403
  }) {
1422
- const [L, x] = Ct(), { id: P, isActive: M, isRoot: K, transitionName: _, prevTransitionName: Q } = Z(), k = Xt(), R = U((v) => v.status), i = J((v) => v.dragStatus), d = J.getState().setDragStatus, y = J.getState().setReplaceTransitionStatus, m = et.get(_), { variants: f, initial: p, swipeDirection: S, decoratorName: T } = m, C = Pt.get(T), { viewportScrollHeight: E } = we(), [b, N] = it(0), [O, j] = it(0), nt = $(null), rt = $(null), st = $(null), at = $(null), B = $(!1), tt = $(!1), X = $({
1404
+ const [D, I] = Rt(), { id: P, isActive: M, isRoot: W, transitionName: _, prevTransitionName: Q } = Z(), k = Xt(), b = U((v) => v.status), i = J((v) => v.dragStatus), d = J.getState().setDragStatus, y = J.getState().setReplaceTransitionStatus, m = et.get(_), { variants: f, initial: p, swipeDirection: S, decoratorName: T } = m, C = Pt.get(T), { viewportScrollHeight: w } = ye(), R = w > 0, [N, O] = ot(0), [j, ut] = ot(0), vt = $(null), nt = $(null), rt = $(null), st = $(null), B = $(!1), tt = $(!1), X = $({
1423
1405
  element: null,
1424
1406
  hasMarker: !1
1425
- }), W = $({ element: null, hasMarker: !1 }), lt = $(0), dt = $(0), pt = $(null), ft = $(null), Ht = async (v, G) => {
1426
- if (!S || E > 10)
1407
+ }), z = $({ element: null, hasMarker: !1 }), lt = $(0), dt = $(0), pt = $(null), ft = $(null), Ut = async (v, G) => {
1408
+ if (!S || w > 10)
1427
1409
  return;
1428
- const A = nt.current?.previousSibling;
1429
- rt.current = A?.querySelector("[data-screen]"), at.current = A?.querySelector("[data-decorator]");
1430
- const F = await m?.onSwipeStart(v, G, {
1431
- animate: x,
1432
- currentScreen: L.current,
1433
- prevScreen: rt.current,
1410
+ const A = vt.current?.previousSibling;
1411
+ nt.current = A?.querySelector("[data-screen]"), st.current = A?.querySelector("[data-decorator]");
1412
+ const V = await m?.onSwipeStart(v, G, {
1413
+ animate: I,
1414
+ currentScreen: D.current,
1415
+ prevScreen: nt.current,
1434
1416
  dragControls: k,
1435
1417
  onStart: (ht) => C?.onSwipeStart?.(ht, {
1436
- animate: x,
1437
- currentDecorator: st.current,
1438
- prevDecorator: at.current
1418
+ animate: I,
1419
+ currentDecorator: rt.current,
1420
+ prevDecorator: st.current
1439
1421
  })
1440
1422
  });
1441
- d(F ? "PENDING" : "IDLE");
1442
- }, Ut = (v, G) => {
1443
- !S || i !== "PENDING" || E > 10 || m?.onSwipe(v, G, {
1444
- animate: x,
1445
- currentScreen: L.current,
1446
- prevScreen: rt.current,
1423
+ d(V ? "PENDING" : "IDLE");
1424
+ }, _t = (v, G) => {
1425
+ !S || i !== "PENDING" || w > 10 || m?.onSwipe(v, G, {
1426
+ animate: I,
1427
+ currentScreen: D.current,
1428
+ prevScreen: nt.current,
1447
1429
  dragControls: k,
1448
- onProgress: (A, F) => C?.onSwipe?.(A, F, {
1449
- animate: x,
1450
- currentDecorator: st.current,
1451
- prevDecorator: at.current
1430
+ onProgress: (A, V) => C?.onSwipe?.(A, V, {
1431
+ animate: I,
1432
+ currentDecorator: rt.current,
1433
+ prevDecorator: st.current
1452
1434
  })
1453
1435
  });
1454
- }, _t = async (v, G) => {
1455
- if (!S || i !== "PENDING" || E > 10)
1436
+ }, jt = async (v, G) => {
1437
+ if (!S || i !== "PENDING" || w > 10)
1456
1438
  return;
1457
1439
  await m?.onSwipeEnd(v, G, {
1458
- animate: x,
1459
- currentScreen: L.current,
1460
- prevScreen: rt.current,
1461
- onStart: (F) => C?.onSwipeEnd?.(F, {
1462
- animate: x,
1463
- currentDecorator: st.current,
1464
- prevDecorator: at.current
1440
+ animate: I,
1441
+ currentScreen: D.current,
1442
+ prevScreen: nt.current,
1443
+ onStart: (V) => C?.onSwipeEnd?.(V, {
1444
+ animate: I,
1445
+ currentDecorator: rt.current,
1446
+ prevDecorator: st.current
1465
1447
  })
1466
1448
  }) ? window.history.back() : d("IDLE");
1467
- }, jt = (v) => {
1468
- if (!(!K && M && R === "COMPLETED" && i === "IDLE" && !!S && E < 10))
1449
+ }, Vt = (v) => {
1450
+ if (!(!W && M && b === "COMPLETED" && i === "IDLE" && !!S && w < 10))
1469
1451
  return;
1470
- X.current = xt(v.target, {
1452
+ X.current = Nt(v.target, {
1471
1453
  direction: "x",
1472
1454
  verifyByScroll: !0
1473
- }), W.current = xt(v.target, {
1455
+ }), z.current = Nt(v.target, {
1474
1456
  direction: "y",
1475
1457
  verifyByScroll: !0
1476
- }), lt.current = v.clientX, dt.current = v.clientY, (!X.current.element && !W.current.element || X.current.element || W.current.element) && (B.current = !0);
1477
- }, Ft = (v) => {
1478
- if (E > 10)
1458
+ }), lt.current = v.clientX, dt.current = v.clientY, (!X.current.element && !z.current.element || X.current.element || z.current.element) && (B.current = !0);
1459
+ }, Qt = (v) => {
1460
+ if (w > 10)
1479
1461
  return;
1480
- const G = !X.current.element && !W.current.element;
1462
+ const G = !X.current.element && !z.current.element;
1481
1463
  if (B.current && G) {
1482
1464
  B.current = !1, tt.current = !0;
1483
- const A = v.clientY - dt.current, F = v.clientX - lt.current;
1484
- (S === "y" && A > 0 || S === "x" && F > 0) && k.start(v);
1465
+ const A = v.clientY - dt.current, V = v.clientX - lt.current;
1466
+ (S === "y" && A > 0 || S === "x" && V > 0) && k.start(v);
1485
1467
  } else if (B.current && !G) {
1486
- const A = v.clientX - lt.current, F = v.clientY - dt.current, ht = W.current.element && W.current.element.scrollTop <= 0, Vt = X.current.element && X.current.element.scrollLeft <= 0 && X.current.hasMarker;
1487
- (S === "y" && (ht || X.current.element) && F > 0 && Math.abs(A) < 2 || S === "x" && (Vt || W.current.element) && A > 0 && Math.abs(F) < 2) && (B.current = !1, tt.current = !0, k.start(v));
1468
+ const A = v.clientX - lt.current, V = v.clientY - dt.current, ht = z.current.element && z.current.element.scrollTop <= 0, Yt = X.current.element && X.current.element.scrollLeft <= 0 && X.current.hasMarker;
1469
+ (S === "y" && (ht || X.current.element) && V > 0 && Math.abs(A) < 2 || S === "x" && (Yt || z.current.element) && A > 0 && Math.abs(V) < 2) && (B.current = !1, tt.current = !0, k.start(v));
1488
1470
  }
1489
- }, Qt = () => {
1471
+ }, Ft = () => {
1490
1472
  B.current = !1, tt.current = !1;
1491
1473
  };
1492
1474
  return Y(() => {
1493
- const v = L.current;
1475
+ const v = D.current;
1494
1476
  if (!v) return;
1495
1477
  const G = (A) => {
1496
1478
  tt.current && A.preventDefault(), A.target?.dataset.swipeAtEdgeBar === "true" && A.preventDefault();
@@ -1500,32 +1482,32 @@ function $t({
1500
1482
  }), () => {
1501
1483
  v.removeEventListener("touchmove", G);
1502
1484
  };
1503
- }, [L]), Y(() => {
1504
- L.current && (async () => {
1505
- const { value: v, options: G } = f[`${R}-${M}`];
1506
- !M && R === "REPLACING" && Q !== _ && (y("PENDING"), await x(L.current, fe, {
1485
+ }, [D]), Y(() => {
1486
+ D.current && (async () => {
1487
+ const { value: v, options: G } = f[`${b}-${M}`];
1488
+ !M && b === "REPLACING" && Q !== _ && (y("PENDING"), await I(D.current, fe, {
1507
1489
  duration: 0.1
1508
- })), M && R === "COMPLETED" && (d("IDLE"), y("IDLE")), await x(L.current, v, G), await V.resolveTask(P);
1490
+ })), M && b === "COMPLETED" && (d("IDLE"), y("IDLE")), await I(D.current, v, G), await F.resolveTask(P);
1509
1491
  })();
1510
1492
  }, [
1511
- R,
1493
+ b,
1512
1494
  M,
1513
1495
  P,
1514
1496
  Q,
1515
1497
  _,
1516
- x,
1517
- L,
1498
+ I,
1499
+ D,
1518
1500
  f,
1519
1501
  d,
1520
1502
  y
1521
- ]), vt(() => {
1522
- pt.current && N(pt.current.offsetHeight);
1523
- }, [a]), vt(() => {
1524
- ft.current && j(ft.current.offsetHeight);
1503
+ ]), Tt(() => {
1504
+ pt.current && O(pt.current.offsetHeight);
1505
+ }, [a]), Tt(() => {
1506
+ ft.current && ut(ft.current.offsetHeight);
1525
1507
  }, [o]), /* @__PURE__ */ yt(
1526
1508
  "div",
1527
1509
  {
1528
- ref: nt,
1510
+ ref: vt,
1529
1511
  style: {
1530
1512
  position: "absolute",
1531
1513
  top: 0,
@@ -1540,7 +1522,7 @@ function $t({
1540
1522
  overscrollBehavior: "contain"
1541
1523
  },
1542
1524
  children: [
1543
- /* @__PURE__ */ D(
1525
+ /* @__PURE__ */ x(
1544
1526
  "div",
1545
1527
  {
1546
1528
  "data-swipe-at-edge-bar": !0,
@@ -1554,7 +1536,7 @@ function $t({
1554
1536
  }
1555
1537
  }
1556
1538
  ),
1557
- a && /* @__PURE__ */ D(
1539
+ a && /* @__PURE__ */ x(
1558
1540
  "div",
1559
1541
  {
1560
1542
  ref: pt,
@@ -1568,20 +1550,24 @@ function $t({
1568
1550
  }
1569
1551
  ),
1570
1552
  /* @__PURE__ */ yt(
1571
- Rt.div,
1553
+ At.div,
1572
1554
  {
1573
- ref: L,
1574
- ...I,
1555
+ ref: D,
1556
+ ...L,
1575
1557
  initial: p,
1576
1558
  drag: S,
1577
1559
  dragListener: !1,
1578
1560
  dragControls: k,
1579
- onDragStart: Ht,
1580
- onDrag: Ut,
1581
- onDragEnd: _t,
1582
- onPointerDown: jt,
1583
- onPointerMove: Ft,
1584
- onPointerUp: Qt,
1561
+ onDragStart: Ut,
1562
+ onDrag: _t,
1563
+ onDragEnd: jt,
1564
+ onPointerDown: Vt,
1565
+ onPointerMove: Qt,
1566
+ onPointerUp: Ft,
1567
+ transition: {
1568
+ inherit: !0,
1569
+ ...L.transition
1570
+ },
1585
1571
  "data-screen": !0,
1586
1572
  style: {
1587
1573
  display: "flex",
@@ -1589,10 +1575,10 @@ function $t({
1589
1575
  height: "100%",
1590
1576
  backgroundColor: g,
1591
1577
  overflowY: c ? void 0 : "auto",
1592
- ...I.style
1578
+ ...L.style
1593
1579
  },
1594
1580
  children: [
1595
- !l && e && /* @__PURE__ */ D("div", { style: { minHeight: e }, children: /* @__PURE__ */ D(
1581
+ !l && e && /* @__PURE__ */ x("div", { style: { minHeight: e }, children: /* @__PURE__ */ x(
1596
1582
  "div",
1597
1583
  {
1598
1584
  style: {
@@ -1604,17 +1590,17 @@ function $t({
1604
1590
  }
1605
1591
  }
1606
1592
  ) }),
1607
- a && /* @__PURE__ */ D(
1593
+ a && /* @__PURE__ */ x(
1608
1594
  "div",
1609
1595
  {
1610
1596
  style: {
1611
1597
  width: "100%",
1612
- minHeight: b
1598
+ minHeight: N
1613
1599
  }
1614
1600
  }
1615
1601
  ),
1616
1602
  u,
1617
- /* @__PURE__ */ D(
1603
+ /* @__PURE__ */ x(
1618
1604
  "div",
1619
1605
  {
1620
1606
  style: {
@@ -1627,45 +1613,55 @@ function $t({
1627
1613
  }
1628
1614
  ),
1629
1615
  h,
1630
- o && /* @__PURE__ */ D(
1616
+ o && /* @__PURE__ */ x(
1631
1617
  "div",
1632
1618
  {
1633
1619
  style: {
1620
+ display: R ? "none" : void 0,
1634
1621
  width: "100%",
1635
- minHeight: O
1622
+ minHeight: j
1636
1623
  }
1637
1624
  }
1638
1625
  ),
1639
- !w && s && /* @__PURE__ */ D("div", { style: { minHeight: s }, children: /* @__PURE__ */ D(
1626
+ !E && s && /* @__PURE__ */ x(
1640
1627
  "div",
1641
1628
  {
1642
1629
  style: {
1643
- position: "fixed",
1644
- bottom: 0,
1645
- width: "100%",
1646
- minHeight: s,
1647
- backgroundColor: r
1648
- }
1630
+ display: R ? "none" : void 0,
1631
+ minHeight: s
1632
+ },
1633
+ children: /* @__PURE__ */ x(
1634
+ "div",
1635
+ {
1636
+ style: {
1637
+ position: "fixed",
1638
+ bottom: 0,
1639
+ width: "100%",
1640
+ minHeight: s,
1641
+ backgroundColor: r
1642
+ }
1643
+ }
1644
+ )
1649
1645
  }
1650
- ) })
1646
+ )
1651
1647
  ]
1652
1648
  }
1653
1649
  ),
1654
- o && /* @__PURE__ */ D(
1650
+ o && /* @__PURE__ */ x(
1655
1651
  "div",
1656
1652
  {
1657
1653
  ref: ft,
1658
1654
  style: {
1659
1655
  position: "absolute",
1660
- bottom: w ? 0 : s,
1656
+ bottom: E ? 0 : s,
1661
1657
  left: 0,
1662
1658
  width: "100%"
1663
1659
  },
1664
1660
  children: o
1665
1661
  }
1666
1662
  ),
1667
- C && /* @__PURE__ */ D(me, { ref: st }),
1668
- /* @__PURE__ */ D(
1663
+ C && /* @__PURE__ */ x(ge, { ref: rt }),
1664
+ /* @__PURE__ */ x(
1669
1665
  "div",
1670
1666
  {
1671
1667
  "data-swipe-at-edge-bar": !0,
@@ -1683,28 +1679,28 @@ function $t({
1683
1679
  }
1684
1680
  );
1685
1681
  }
1686
- function ke({ children: n, ...e }) {
1687
- const { isActive: t, isPrev: s, zIndex: r } = Z(), a = q((g) => g.index), o = U((g) => g.status), u = J((g) => g.dragStatus), h = J((g) => g.replaceTransitionStatus), w = !t && (o === "COMPLETED" && u === "IDLE") || s && a - 2 <= r && h === "IDLE" || s && a - 2 > r;
1688
- return /* @__PURE__ */ D(Gt, { freeze: w, children: /* @__PURE__ */ D($t, { ...e, children: n }) });
1682
+ function xe({ children: n, ...e }) {
1683
+ const { isActive: t, isPrev: s, zIndex: r } = Z(), a = q((g) => g.index), o = U((g) => g.status), u = J((g) => g.dragStatus), h = J((g) => g.replaceTransitionStatus), E = !t && (o === "COMPLETED" && u === "IDLE") || s && a - 2 <= r && h === "IDLE" || s && a - 2 > r;
1684
+ return /* @__PURE__ */ x(Ht, { ...e, children: /* @__PURE__ */ x(Ct, { mode: E ? "hidden" : "visible", children: n }) });
1689
1685
  }
1690
- function Me({ children: n, ...e }) {
1691
- const { isActive: t, isPrev: s, zIndex: r } = Z(), a = q((g) => g.index), o = U((g) => g.status), u = J((g) => g.dragStatus), h = J((g) => g.replaceTransitionStatus), w = !t && (o === "COMPLETED" && u === "IDLE") || s && a - 2 <= r && h === "IDLE" || s && a - 2 > r;
1692
- return /* @__PURE__ */ D(Gt, { freeze: w, children: /* @__PURE__ */ D(
1693
- $t,
1686
+ function Ne({ children: n, ...e }) {
1687
+ const { isActive: t, isPrev: s, zIndex: r } = Z(), a = q((g) => g.index), o = U((g) => g.status), u = J((g) => g.dragStatus), h = J((g) => g.replaceTransitionStatus), E = !t && (o === "COMPLETED" && u === "IDLE") || s && a - 2 <= r && h === "IDLE" || s && a - 2 > r;
1688
+ return /* @__PURE__ */ x(
1689
+ Ht,
1694
1690
  {
1695
1691
  ...e,
1696
1692
  style: {
1697
1693
  backgroundColor: "transparent",
1698
1694
  ...e.style
1699
1695
  },
1700
- children: /* @__PURE__ */ D(zt, { children: n })
1696
+ children: /* @__PURE__ */ x(Kt, { children: /* @__PURE__ */ x(Ct, { mode: E ? "hidden" : "visible", children: n }) })
1701
1697
  }
1702
- ) });
1698
+ );
1703
1699
  }
1704
- function Ce({ children: n, ...e }) {
1700
+ function ke({ children: n, ...e }) {
1705
1701
  const { isActive: t, transitionName: s } = Z(), r = U((o) => o.status), a = et.get(s);
1706
- return /* @__PURE__ */ D(
1707
- Kt,
1702
+ return /* @__PURE__ */ x(
1703
+ Wt,
1708
1704
  {
1709
1705
  transition: a?.variants[`${r}-${t}`]?.options,
1710
1706
  ...e,
@@ -1713,17 +1709,18 @@ function Ce({ children: n, ...e }) {
1713
1709
  );
1714
1710
  }
1715
1711
  export {
1716
- Ce as LayoutConfig,
1717
- Me as LayoutScreen,
1718
- Te as Route,
1719
- ve as Router,
1720
- ke as Screen,
1712
+ ke as LayoutConfig,
1713
+ Ne as LayoutScreen,
1714
+ Pe as Route,
1715
+ Se as Router,
1716
+ xe as Screen,
1721
1717
  ie as createDecorator,
1722
- Ne as createRawDecorator,
1723
- xe as createRawTransition,
1724
- ut as createTransition,
1725
- Le as useNavigate,
1726
- Ie as useParams,
1718
+ Ie as createRawDecorator,
1719
+ De as createRawTransition,
1720
+ ct as createTransition,
1721
+ ve as useNavigate,
1722
+ Le as useParams,
1727
1723
  Z as useScreen,
1728
- De as useStep
1724
+ Te as useStep,
1725
+ ye as useViewportScrollHeight
1729
1726
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flemo",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "A modern React router library with built-in motion animations and smooth transitions",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "path-to-regexp": "^8.2.0",
46
- "zustand": "^5.0.7"
46
+ "zustand": "^5.0.11"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@eslint/js": "^9.33.0",
@@ -69,8 +69,8 @@
69
69
  },
70
70
  "peerDependencies": {
71
71
  "motion": "^12.0.0",
72
- "react": "^19.0.0",
73
- "react-dom": "^19.0.0"
72
+ "react": "^19.2.0",
73
+ "react-dom": "^19.2.0"
74
74
  },
75
75
  "lint-staged": {
76
76
  "*.{js,mjs,ts,jsx,tsx,mts,json}": "prettier --write",
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- interface ScreenFreezeProps {
3
- freeze: boolean;
4
- children: ReactNode;
5
- placeholder?: ReactNode;
6
- }
7
- declare function ScreenFreeze({ freeze, children, placeholder }: ScreenFreezeProps): import("react").JSX.Element;
8
- export default ScreenFreeze;