@flemo/react 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,38 +1,38 @@
1
1
  import { jsx as k, jsxs as Bt, Fragment as ye } from "react/jsx-runtime";
2
2
  import xt, { useEffect as wt, createContext as _t, useContext as jt, useReducer as we, Children as oe, useInsertionEffect as ge, useRef as N, useImperativeHandle as Se, useState as bt, useLayoutEffect as mt } from "react";
3
- import { consumeSelfInducedPop as ve, TaskManger as V, useNavigateStore as J, useHistoryStore as G, getMatchedPathPattern as Ee, transitionMap as ut, decoratorMap as yt, isServer as Ut, compileTransitionStyles as Pe, useTransitionStore as Yt, getParams as Te, markSelfInducedPop as Ft, targetToDecls as xe, easingToCss as be, variantHasAnimation as Ie, animationName as Re, findScrollable as Jt, collectAnimatedProperties as De } from "@flemo/core";
3
+ import { consumeSelfInducedPop as ve, TaskManger as V, useNavigateStore as J, useHistoryStore as G, getMatchedPathPattern as Ee, transitionMap as ut, decoratorMap as yt, isServer as Ut, compileTransitionStyles as Te, useTransitionStore as Yt, getParams as Pe, markSelfInducedPop as Ft, targetToDecls as xe, easingToCss as be, variantHasAnimation as Ie, animationName as Re, findScrollable as Jt, collectAnimatedProperties as De } from "@flemo/core";
4
4
  import { createDecorator as rn, createRawDecorator as on, createRawTransition as sn, createTransition as an } from "@flemo/core";
5
5
  function Le() {
6
6
  return wt(() => {
7
7
  const n = async (e) => {
8
8
  if (ve())
9
9
  return;
10
- const r = e.state?.id, a = V.generateTaskId();
10
+ const r = e.state?.id, c = V.generateTaskId();
11
11
  (await V.addTask(
12
- async (c) => {
13
- const i = e.state?.index, s = e.state?.status, w = e.state?.params, P = e.state?.transitionName, f = e.state?.layoutId, { setStatus: T, setTransitionTaskId: p } = J.getState(), { index: I, addHistory: L, popHistory: H } = G.getState(), R = i < I, U = s === "PUSHING" && i > I, C = s === "REPLACING" && i > I, A = window.location.pathname;
14
- if (!R && !U && !C) {
15
- c.abort();
12
+ async (a) => {
13
+ const i = e.state?.index, s = e.state?.status, w = e.state?.params, T = e.state?.transitionName, p = e.state?.layoutId, { setStatus: P, setTransitionTaskId: f } = J.getState(), { index: L, addHistory: R, popHistory: A } = G.getState(), b = i < L, U = s === "PUSHING" && i > L, M = s === "REPLACING" && i > L, $ = window.location.pathname;
14
+ if (!b && !U && !M) {
15
+ a.abort();
16
16
  return;
17
17
  }
18
- return p(a), R ? T("POPPING") : U ? (T("PUSHING"), L({
18
+ return f(c), b ? P("POPPING") : U ? (P("PUSHING"), R({
19
19
  id: r,
20
- pathname: A,
20
+ pathname: $,
21
21
  params: w,
22
- transitionName: P,
23
- layoutId: f
24
- })) : C && (T("REPLACING"), L({
22
+ transitionName: T,
23
+ layoutId: p
24
+ })) : M && (P("REPLACING"), R({
25
25
  id: r,
26
- pathname: A,
26
+ pathname: $,
27
27
  params: w,
28
- transitionName: P,
29
- layoutId: f
28
+ transitionName: T,
29
+ layoutId: p
30
30
  })), async () => {
31
- R && H(i + 1), T("COMPLETED");
31
+ b && A(i + 1), P("COMPLETED");
32
32
  };
33
33
  },
34
34
  {
35
- id: a,
35
+ id: c,
36
36
  control: {
37
37
  manual: !0
38
38
  }
@@ -47,8 +47,8 @@ function Le() {
47
47
  var F = {}, Qt;
48
48
  function Ne() {
49
49
  if (Qt) return F;
50
- Qt = 1, Object.defineProperty(F, "__esModule", { value: !0 }), F.PathError = F.TokenData = void 0, F.parse = f, F.compile = T, F.match = L, F.pathToRegexp = H, F.stringify = X;
51
- const n = "/", e = (o) => o, r = /^[$_\p{ID_Start}]$/u, a = /^[$\u200c\u200d\p{ID_Continue}]$/u, c = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
50
+ Qt = 1, Object.defineProperty(F, "__esModule", { value: !0 }), F.PathError = F.TokenData = void 0, F.parse = p, F.compile = P, F.match = R, F.pathToRegexp = A, F.stringify = X;
51
+ const n = "/", e = (o) => o, r = /^[$_\p{ID_Start}]$/u, c = /^[$\u200c\u200d\p{ID_Continue}]$/u, a = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
52
52
  function i(o) {
53
53
  return o.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
54
54
  }
@@ -61,14 +61,14 @@ function Ne() {
61
61
  }
62
62
  }
63
63
  F.TokenData = w;
64
- class P extends TypeError {
64
+ class T extends TypeError {
65
65
  constructor(u, y) {
66
66
  let l = u;
67
67
  y && (l += `: ${y}`), l += "; visit https://git.new/pathToRegexpError for info", super(l), this.originalPath = y;
68
68
  }
69
69
  }
70
- F.PathError = P;
71
- function f(o, u = {}) {
70
+ F.PathError = T;
71
+ function p(o, u = {}) {
72
72
  const { encodePath: y = e } = u, l = [...o];
73
73
  let d = 0;
74
74
  function g(m) {
@@ -81,22 +81,22 @@ function Ne() {
81
81
  }), S = "");
82
82
  }
83
83
  for (; d < l.length; ) {
84
- const b = l[d++];
85
- if (b === m)
84
+ const I = l[d++];
85
+ if (I === m)
86
86
  return D(), x;
87
- if (b === "\\") {
87
+ if (I === "\\") {
88
88
  if (d === l.length)
89
- throw new P(`Unexpected end after \\ at index ${d}`, o);
89
+ throw new T(`Unexpected end after \\ at index ${d}`, o);
90
90
  S += l[d++];
91
91
  continue;
92
92
  }
93
- if (b === ":" || b === "*") {
94
- const Y = b === ":" ? "param" : "wildcard";
93
+ if (I === ":" || I === "*") {
94
+ const Y = I === ":" ? "param" : "wildcard";
95
95
  let v = "";
96
96
  if (r.test(l[d]))
97
97
  do
98
98
  v += l[d++];
99
- while (a.test(l[d]));
99
+ while (c.test(l[d]));
100
100
  else if (l[d] === '"') {
101
101
  let B = d;
102
102
  for (; d < l.length; ) {
@@ -107,32 +107,32 @@ function Ne() {
107
107
  l[d] === "\\" && d++, v += l[d];
108
108
  }
109
109
  if (B)
110
- throw new P(`Unterminated quote at index ${B}`, o);
110
+ throw new T(`Unterminated quote at index ${B}`, o);
111
111
  }
112
112
  if (!v)
113
- throw new P(`Missing parameter name at index ${d}`, o);
113
+ throw new T(`Missing parameter name at index ${d}`, o);
114
114
  D(), x.push({ type: Y, name: v });
115
115
  continue;
116
116
  }
117
- if (b === "{") {
117
+ if (I === "{") {
118
118
  D(), x.push({
119
119
  type: "group",
120
120
  tokens: g("}")
121
121
  });
122
122
  continue;
123
123
  }
124
- if (b === "}" || b === "(" || b === ")" || b === "[" || b === "]" || b === "+" || b === "?" || b === "!")
125
- throw new P(`Unexpected ${b} at index ${d - 1}`, o);
126
- S += b;
124
+ if (I === "}" || I === "(" || I === ")" || I === "[" || I === "]" || I === "+" || I === "?" || I === "!")
125
+ throw new T(`Unexpected ${I} at index ${d - 1}`, o);
126
+ S += I;
127
127
  }
128
128
  if (m)
129
- throw new P(`Unexpected end at index ${d}, expected ${m}`, o);
129
+ throw new T(`Unexpected end at index ${d}, expected ${m}`, o);
130
130
  return D(), x;
131
131
  }
132
132
  return new w(g(""), o);
133
133
  }
134
- function T(o, u = {}) {
135
- const { encode: y = encodeURIComponent, delimiter: l = n } = u, d = typeof o == "object" ? o : f(o, u), g = p(d.tokens, l, y);
134
+ function P(o, u = {}) {
135
+ const { encode: y = encodeURIComponent, delimiter: l = n } = u, d = typeof o == "object" ? o : p(o, u), g = f(d.tokens, l, y);
136
136
  return function(x = {}) {
137
137
  const S = [], D = g(x, S);
138
138
  if (S.length)
@@ -140,8 +140,8 @@ function Ne() {
140
140
  return D;
141
141
  };
142
142
  }
143
- function p(o, u, y) {
144
- const l = o.map((d) => I(d, u, y));
143
+ function f(o, u, y) {
144
+ const l = o.map((d) => L(d, u, y));
145
145
  return (d, g) => {
146
146
  let m = "";
147
147
  for (const x of l)
@@ -149,11 +149,11 @@ function Ne() {
149
149
  return m;
150
150
  };
151
151
  }
152
- function I(o, u, y) {
152
+ function L(o, u, y) {
153
153
  if (o.type === "text")
154
154
  return () => o.value;
155
155
  if (o.type === "group") {
156
- const d = p(o.tokens, u, y);
156
+ const d = f(o.tokens, u, y);
157
157
  return (g, m) => {
158
158
  const x = m.length, S = d(g, m);
159
159
  return m.length === x ? S : (m.length = x, "");
@@ -182,23 +182,23 @@ function Ne() {
182
182
  return l(m);
183
183
  };
184
184
  }
185
- function L(o, u = {}) {
186
- const { decode: y = decodeURIComponent, delimiter: l = n } = u, { regexp: d, keys: g } = H(o, u), m = g.map((x) => y === !1 ? e : x.type === "param" ? y : (S) => S.split(l).map(y));
185
+ function R(o, u = {}) {
186
+ const { decode: y = decodeURIComponent, delimiter: l = n } = u, { regexp: d, keys: g } = A(o, u), m = g.map((x) => y === !1 ? e : x.type === "param" ? y : (S) => S.split(l).map(y));
187
187
  return function(S) {
188
188
  const D = d.exec(S);
189
189
  if (!D)
190
190
  return !1;
191
- const b = D[0], Y = /* @__PURE__ */ Object.create(null);
191
+ const I = D[0], Y = /* @__PURE__ */ Object.create(null);
192
192
  for (let v = 1; v < D.length; v++) {
193
193
  if (D[v] === void 0)
194
194
  continue;
195
195
  const B = g[v - 1], j = m[v - 1];
196
196
  Y[B.name] = j(D[v]);
197
197
  }
198
- return { path: b, params: Y };
198
+ return { path: I, params: Y };
199
199
  };
200
200
  }
201
- function H(o, u = {}) {
201
+ function A(o, u = {}) {
202
202
  const { delimiter: y = n, end: l = !0, sensitive: d = !1, trailing: g = !0 } = u, m = [];
203
203
  let x = "", S = 0;
204
204
  function D(Y) {
@@ -207,23 +207,23 @@ function Ne() {
207
207
  D(B);
208
208
  return;
209
209
  }
210
- const v = typeof Y == "object" ? Y : f(Y, u);
211
- R(v.tokens, 0, [], (B) => {
210
+ const v = typeof Y == "object" ? Y : p(Y, u);
211
+ b(v.tokens, 0, [], (B) => {
212
212
  if (S >= 256)
213
- throw new P("Too many path combinations", v.originalPath);
213
+ throw new T("Too many path combinations", v.originalPath);
214
214
  S > 0 && (x += "|"), x += U(B, y, m, v.originalPath), S++;
215
215
  });
216
216
  }
217
217
  D(o);
218
- let b = `^(?:${x})`;
219
- return g && (b += "(?:" + s(y) + "$)?"), b += l ? "$" : "(?=" + s(y) + "|$)", { regexp: new RegExp(b, d ? "" : "i"), keys: m };
218
+ let I = `^(?:${x})`;
219
+ return g && (I += "(?:" + s(y) + "$)?"), I += l ? "$" : "(?=" + s(y) + "|$)", { regexp: new RegExp(I, d ? "" : "i"), keys: m };
220
220
  }
221
- function R(o, u, y, l) {
221
+ function b(o, u, y, l) {
222
222
  for (; u < o.length; ) {
223
223
  const d = o[u++];
224
224
  if (d.type === "group") {
225
225
  const g = y.length;
226
- R(d.tokens, 0, y, (m) => R(o, u, m, l)), y.length = g;
226
+ b(d.tokens, 0, y, (m) => b(o, u, m, l)), y.length = g;
227
227
  continue;
228
228
  }
229
229
  y.push(d);
@@ -232,7 +232,7 @@ function Ne() {
232
232
  }
233
233
  function U(o, u, y, l) {
234
234
  let d = "", g = "", m = "", x = 0, S = 0, D = 0;
235
- function b(v, B) {
235
+ function I(v, B) {
236
236
  for (; v < o.length; ) {
237
237
  const j = o[v++];
238
238
  if (j.type === B)
@@ -260,18 +260,18 @@ function Ne() {
260
260
  }
261
261
  if (v.type === "param" || v.type === "wildcard") {
262
262
  if (x && !g)
263
- throw new P(`Missing text before "${v.name}" ${v.type}`, l);
264
- v.type === "param" ? (d += S & 2 ? `(${C(u, g)}+)` : b(D, "wildcard") ? `(${C(u, Y(D))}+)` : S & 1 ? `(${C(u, g)}+|${s(g)})` : `(${C(u, "")}+)`, S |= x = 1) : (d += S & 2 ? `(${C(g, "")}+)` : m ? `(${C(m, "")}+|${C(u, "")}+)` : "([^]+)", m = "", S |= x = 2), y.push(v), g = "";
263
+ throw new T(`Missing text before "${v.name}" ${v.type}`, l);
264
+ v.type === "param" ? (d += S & 2 ? `(${M(u, g)}+)` : I(D, "wildcard") ? `(${M(u, Y(D))}+)` : S & 1 ? `(${M(u, g)}+|${s(g)})` : `(${M(u, "")}+)`, S |= x = 1) : (d += S & 2 ? `(${M(g, "")}+)` : m ? `(${M(m, "")}+|${M(u, "")}+)` : "([^]+)", m = "", S |= x = 2), y.push(v), g = "";
265
265
  continue;
266
266
  }
267
267
  throw new TypeError(`Unknown token type: ${v.type}`);
268
268
  }
269
269
  return d;
270
270
  }
271
- function C(o, u) {
272
- return u.length > o.length ? C(u, o) : (o === u && (u = ""), u.length > 1 ? `(?:(?!${s(o)}|${s(u)})[^])` : o.length > 1 ? `(?:(?!${s(o)})[^${s(u)}])` : `[^${s(o + u)}]`);
271
+ function M(o, u) {
272
+ return u.length > o.length ? M(u, o) : (o === u && (u = ""), u.length > 1 ? `(?:(?!${s(o)}|${s(u)})[^])` : o.length > 1 ? `(?:(?!${s(o)})[^${s(u)}])` : `[^${s(o + u)}]`);
273
273
  }
274
- function A(o, u) {
274
+ function $(o, u) {
275
275
  let y = "";
276
276
  for (; u < o.length; ) {
277
277
  const l = o[u++];
@@ -280,7 +280,7 @@ function Ne() {
280
280
  continue;
281
281
  }
282
282
  if (l.type === "group") {
283
- y += "{" + A(l.tokens, 0) + "}";
283
+ y += "{" + $(l.tokens, 0) + "}";
284
284
  continue;
285
285
  }
286
286
  if (l.type === "param") {
@@ -296,10 +296,10 @@ function Ne() {
296
296
  return y;
297
297
  }
298
298
  function X(o) {
299
- return A(o.tokens, 0);
299
+ return $(o.tokens, 0);
300
300
  }
301
301
  function O(o, u) {
302
- return !c.test(o) || u?.type === "text" && a.test(u.value[0]) ? JSON.stringify(o) : o;
302
+ return !a.test(o) || u?.type === "text" && c.test(u.value[0]) ? JSON.stringify(o) : o;
303
303
  }
304
304
  return F;
305
305
  }
@@ -326,53 +326,53 @@ function ke(n, e) {
326
326
  return e.type === "SET" ? e.params : n;
327
327
  }
328
328
  function Ae({ children: n }) {
329
- const { isActive: e, params: r } = gt(), [a, c] = we(ke, r);
329
+ const { isActive: e, params: r } = gt(), [c, a] = we(ke, r);
330
330
  return wt(() => {
331
331
  const i = async (s) => {
332
332
  s.state?.step && await V.addTask(async () => {
333
- c({ type: "SET", params: s.state?.params || {} });
333
+ a({ type: "SET", params: s.state?.params || {} });
334
334
  });
335
335
  };
336
336
  return e && window.addEventListener("popstate", i), () => {
337
337
  window.removeEventListener("popstate", i);
338
338
  };
339
- }, [e, c]), /* @__PURE__ */ k(ae.Provider, { value: c, children: /* @__PURE__ */ k(se.Provider, { value: a, children: n }) });
339
+ }, [e, a]), /* @__PURE__ */ k(ae.Provider, { value: a, children: /* @__PURE__ */ k(se.Provider, { value: c, children: n }) });
340
340
  }
341
341
  function $e({ children: n }) {
342
- const e = G((a) => a.index), r = G((a) => a.histories);
342
+ const e = G((c) => c.index), r = G((c) => c.histories);
343
343
  return r.map(
344
- (a) => oe.toArray(n).filter(
345
- (c) => It.pathToRegexp(c.props.path).regexp.test(
346
- a.pathname
344
+ (c) => oe.toArray(n).filter(
345
+ (a) => It.pathToRegexp(a.props.path).regexp.test(
346
+ c.pathname
347
347
  )
348
348
  )
349
- ).map(([a], c) => /* @__PURE__ */ k(
349
+ ).map(([c], a) => /* @__PURE__ */ k(
350
350
  ie.Provider,
351
351
  {
352
352
  value: {
353
- id: r[c].id,
354
- isActive: c === e,
355
- isRoot: c === 0,
356
- isPrev: c < e - 1,
357
- zIndex: c,
358
- pathname: r[c].pathname,
359
- params: r[c].params,
353
+ id: r[a].id,
354
+ isActive: a === e,
355
+ isRoot: a === 0,
356
+ isPrev: a < e - 1,
357
+ zIndex: a,
358
+ pathname: r[a].pathname,
359
+ params: r[a].params,
360
360
  transitionName: r[e].transitionName,
361
361
  prevTransitionName: r[e - 1]?.transitionName,
362
- layoutId: r[c].layoutId,
362
+ layoutId: r[a].layoutId,
363
363
  routePath: Ee(
364
- a.props.path,
365
- r[c].pathname
364
+ c.props.path,
365
+ r[a].pathname
366
366
  )
367
367
  },
368
- children: /* @__PURE__ */ k(Ae, { children: a })
368
+ children: /* @__PURE__ */ k(Ae, { children: c })
369
369
  },
370
- r[c].id
370
+ r[a].id
371
371
  ));
372
372
  }
373
373
  const Zt = "data-flemo", te = () => {
374
374
  if (Ut()) return;
375
- const n = Pe(ut.values(), yt.values());
375
+ const n = Te(ut.values(), yt.values());
376
376
  let e = document.head.querySelector(`style[${Zt}]`);
377
377
  e || (e = document.createElement("style"), e.setAttribute(Zt, ""), document.head.appendChild(e)), e.textContent !== n && (e.textContent = n);
378
378
  };
@@ -392,8 +392,8 @@ function Ke({
392
392
  children: n,
393
393
  initPath: e = "/",
394
394
  defaultTransitionName: r = "cupertino",
395
- transitions: a = Me,
396
- decorators: c = He
395
+ transitions: c = Me,
396
+ decorators: a = He
397
397
  }) {
398
398
  const i = Ut() ? e || "/" : window.location.pathname, s = Ut() ? i.split("?")[1] || "" : window.location.search;
399
399
  return Yt.setState({
@@ -404,7 +404,7 @@ function Ke({
404
404
  {
405
405
  id: "root",
406
406
  pathname: i,
407
- params: Te(
407
+ params: Pe(
408
408
  oe.toArray(n).map((w) => w.props.path).flat(),
409
409
  i,
410
410
  s
@@ -413,7 +413,7 @@ function Ke({
413
413
  layoutId: null
414
414
  }
415
415
  ]
416
- }), Ce(a, c), wt(() => {
416
+ }), Ce(c, a), wt(() => {
417
417
  window.history.state?.index || window.history.replaceState(
418
418
  {
419
419
  id: "root",
@@ -435,132 +435,132 @@ function We({ element: n }) {
435
435
  return n;
436
436
  }
437
437
  function Rt(n, e) {
438
- const r = e ?? {}, a = It.compile(n), c = Object.fromEntries(
439
- Object.entries(r).map(([p, I]) => [p, String(I)])
440
- ), i = a(c), w = (typeof n == "string" ? It.parse(n) : n).tokens.filter((p) => p.type === "param").map((p) => p.name), P = Object.fromEntries(
441
- Object.entries(r).filter(([p]) => !w.includes(p))
442
- ), f = new URLSearchParams(P).toString();
443
- return { pathname: `${i}${f ? `?${f}` : ""}`, toPathname: i };
438
+ const r = e ?? {}, c = It.compile(n), a = Object.fromEntries(
439
+ Object.entries(r).map(([f, L]) => [f, String(L)])
440
+ ), i = c(a), w = (typeof n == "string" ? It.parse(n) : n).tokens.filter((f) => f.type === "param").map((f) => f.name), T = Object.fromEntries(
441
+ Object.entries(r).filter(([f]) => !w.includes(f))
442
+ ), p = new URLSearchParams(T).toString();
443
+ return { pathname: `${i}${p ? `?${p}` : ""}`, toPathname: i };
444
444
  }
445
445
  const Mt = (n, e, r) => {
446
- const { regexp: a } = It.pathToRegexp(n);
447
- for (let c = e - 1; c >= 0; c--)
448
- if (a.test(r[c].pathname))
449
- return e - c;
446
+ const { regexp: c } = It.pathToRegexp(n);
447
+ for (let a = e - 1; a >= 0; a--)
448
+ if (c.test(r[a].pathname))
449
+ return e - a;
450
450
  return -1;
451
451
  }, Ht = (n, e) => typeof n == "number" && Number.isFinite(n) ? Math.max(0, Math.trunc(n)) : e, Ot = async (n, e) => {
452
452
  let r;
453
- const a = new Promise((s) => {
453
+ const c = new Promise((s) => {
454
454
  r = () => s(!0), window.addEventListener("popstate", r, { once: !0 });
455
- }), c = new Promise((s) => setTimeout(() => s(!1), 200));
456
- if (Ft(), window.history.go(-n), !await Promise.race([a, c])) {
455
+ }), a = new Promise((s) => setTimeout(() => s(!1), 200));
456
+ if (Ft(), window.history.go(-n), !await Promise.race([c, a])) {
457
457
  window.removeEventListener("popstate", r);
458
458
  return;
459
459
  }
460
460
  e();
461
461
  };
462
462
  function Je() {
463
- const n = async (c, i, s) => {
463
+ const n = async (a, i, s) => {
464
464
  const { status: w } = J.getState();
465
465
  if (w !== "COMPLETED" && w !== "IDLE")
466
466
  return;
467
- const P = Yt.getState().defaultTransitionName, { transitionName: f = P, layoutId: T = null } = s ?? {}, p = V.generateTaskId();
467
+ const T = Yt.getState().defaultTransitionName, { transitionName: p = T, layoutId: P = null } = s ?? {}, f = V.generateTaskId();
468
468
  (await V.addTask(
469
469
  async () => {
470
- const { index: I, histories: L, addHistory: H, popHistories: R } = G.getState(), U = (() => {
470
+ const { index: L, histories: R, addHistory: A, popHistories: b } = G.getState(), U = (() => {
471
471
  if (s?.until != null) {
472
- const u = Mt(s.until, I, L);
472
+ const u = Mt(s.until, L, R);
473
473
  return u < 0 ? 0 : u;
474
474
  }
475
- return Math.min(Ht(s?.skip, 0), Math.max(0, I));
476
- })(), { setStatus: C, setTransitionTaskId: A } = J.getState();
477
- C("PUSHING"), A(p);
478
- const { pathname: X, toPathname: O } = Rt(c, i ?? {}), o = {
479
- id: p,
475
+ return Math.min(Ht(s?.skip, 0), Math.max(0, L));
476
+ })(), { setStatus: M, setTransitionTaskId: $ } = J.getState();
477
+ M("PUSHING"), $(f);
478
+ const { pathname: X, toPathname: O } = Rt(a, i ?? {}), o = {
479
+ id: f,
480
480
  pathname: O,
481
481
  params: i ?? {},
482
- transitionName: f,
483
- layoutId: T
482
+ transitionName: p,
483
+ layoutId: P
484
484
  };
485
485
  return U === 0 ? (window.history.pushState(
486
- { id: p, index: I + 1, status: "PUSHING", params: i, transitionName: f, layoutId: T },
486
+ { id: f, index: L + 1, status: "PUSHING", params: i, transitionName: p, layoutId: P },
487
487
  "",
488
488
  X
489
- ), H(o), () => {
490
- C("COMPLETED");
491
- }) : (H(o), await Ot(U, () => {
489
+ ), A(o), () => {
490
+ M("COMPLETED");
491
+ }) : (A(o), await Ot(U, () => {
492
492
  window.history.pushState(
493
493
  {
494
- id: p,
494
+ id: f,
495
495
  index: G.getState().index - U,
496
496
  status: "PUSHING",
497
497
  params: i,
498
- transitionName: f,
499
- layoutId: T
498
+ transitionName: p,
499
+ layoutId: P
500
500
  },
501
501
  "",
502
502
  X
503
503
  );
504
504
  }), async () => {
505
- R(U), C("COMPLETED");
505
+ b(U), M("COMPLETED");
506
506
  });
507
507
  },
508
508
  {
509
- id: p,
509
+ id: f,
510
510
  control: {
511
511
  manual: !0
512
512
  }
513
513
  }
514
514
  )).result?.();
515
- }, e = async (c, i, s) => {
515
+ }, e = async (a, i, s) => {
516
516
  const { status: w } = J.getState();
517
517
  if (w !== "COMPLETED" && w !== "IDLE")
518
518
  return;
519
- const P = Yt.getState().defaultTransitionName, { transitionName: f = P, layoutId: T = null } = s ?? {}, p = V.generateTaskId();
519
+ const T = Yt.getState().defaultTransitionName, { transitionName: p = T, layoutId: P = null } = s ?? {}, f = V.generateTaskId();
520
520
  (await V.addTask(
521
- async (I) => {
522
- const { index: L, histories: H, addHistory: R, replaceHistory: U, popHistories: C } = G.getState(), A = (() => {
521
+ async (L) => {
522
+ const { index: R, histories: A, addHistory: b, replaceHistory: U, popHistories: M } = G.getState(), $ = (() => {
523
523
  if (s?.until != null) {
524
- const l = Mt(s.until, L, H);
524
+ const l = Mt(s.until, R, A);
525
525
  return l < 0 ? 0 : l + 1;
526
526
  }
527
- return Math.min(Ht(s?.skip, 0) + 1, L + 1);
527
+ return Math.min(Ht(s?.skip, 0) + 1, R + 1);
528
528
  })();
529
- if (A <= 0) {
530
- I.abort();
529
+ if ($ <= 0) {
530
+ L.abort();
531
531
  return;
532
532
  }
533
533
  const { setStatus: X, setTransitionTaskId: O } = J.getState();
534
- X("REPLACING"), O(p);
535
- const { pathname: o, toPathname: u } = Rt(c, i ?? {}), y = {
536
- id: p,
534
+ X("REPLACING"), O(f);
535
+ const { pathname: o, toPathname: u } = Rt(a, i ?? {}), y = {
536
+ id: f,
537
537
  pathname: u,
538
538
  params: i ?? {},
539
- transitionName: f,
540
- layoutId: T
539
+ transitionName: p,
540
+ layoutId: P
541
541
  };
542
- return A === 1 ? (window.history.replaceState(
543
- { id: p, index: L, status: "REPLACING", params: i, transitionName: f, layoutId: T },
542
+ return $ === 1 ? (window.history.replaceState(
543
+ { id: f, index: R, status: "REPLACING", params: i, transitionName: p, layoutId: P },
544
544
  "",
545
545
  o
546
- ), R(y), async () => {
547
- U(L), X("COMPLETED");
548
- }) : (C(A - 1), R(y), A <= L ? await Ot(A, () => {
546
+ ), b(y), async () => {
547
+ U(R), X("COMPLETED");
548
+ }) : (M($ - 1), b(y), $ <= R ? await Ot($, () => {
549
549
  window.history.pushState(
550
550
  {
551
- id: p,
551
+ id: f,
552
552
  index: G.getState().index - 1,
553
553
  status: "REPLACING",
554
554
  params: i,
555
- transitionName: f,
556
- layoutId: T
555
+ transitionName: p,
556
+ layoutId: P
557
557
  },
558
558
  "",
559
559
  o
560
560
  );
561
- }) : await Ot(L, () => {
561
+ }) : await Ot(R, () => {
562
562
  window.history.replaceState(
563
- { id: p, index: 0, status: "REPLACING", params: i, transitionName: f, layoutId: T },
563
+ { id: f, index: 0, status: "REPLACING", params: i, transitionName: p, layoutId: P },
564
564
  "",
565
565
  o
566
566
  );
@@ -569,33 +569,33 @@ function Je() {
569
569
  });
570
570
  },
571
571
  {
572
- id: p,
572
+ id: f,
573
573
  control: {
574
574
  manual: !0
575
575
  }
576
576
  }
577
577
  )).result?.();
578
- }, r = async (c) => {
579
- const i = V.generateTaskId();
578
+ }, r = async (a, i) => {
579
+ const s = V.generateTaskId();
580
580
  (await V.addTask(
581
- async (s) => {
582
- const { index: w, histories: P, popHistory: f, popHistories: T } = G.getState();
583
- if (w <= 0) {
584
- s.abort();
581
+ async (w) => {
582
+ const { index: T, histories: p, popHistory: P, popHistories: f, setTransitionName: L } = G.getState();
583
+ if (T <= 0) {
584
+ w.abort();
585
585
  return;
586
586
  }
587
- const p = Math.min(c(w, P), w);
588
- if (p <= 0) {
589
- s.abort();
587
+ const R = Math.min(a(T, p), T);
588
+ if (R <= 0) {
589
+ w.abort();
590
590
  return;
591
591
  }
592
- const { setStatus: I, setTransitionTaskId: L } = J.getState();
593
- return I("POPPING"), L(i), T(p - 1), Ft(), p === 1 ? window.history.back() : window.history.go(-p), async () => {
594
- f(G.getState().index), I("COMPLETED");
592
+ const { setStatus: A, setTransitionTaskId: b } = J.getState();
593
+ return i && L(T, i), A("POPPING"), b(s), f(R - 1), Ft(), R === 1 ? window.history.back() : window.history.go(-R), async () => {
594
+ P(G.getState().index), A("COMPLETED");
595
595
  };
596
596
  },
597
597
  {
598
- id: i,
598
+ id: s,
599
599
  control: {
600
600
  manual: !0
601
601
  }
@@ -605,15 +605,15 @@ function Je() {
605
605
  return {
606
606
  push: n,
607
607
  replace: e,
608
- pop: async (c) => {
608
+ pop: async (a) => {
609
609
  await r((i, s) => {
610
- if (c?.until != null) {
611
- const P = Mt(c.until, i, s);
612
- return P < 0 ? 0 : P;
610
+ if (a?.until != null) {
611
+ const T = Mt(a.until, i, s);
612
+ return T < 0 ? 0 : T;
613
613
  }
614
- const w = Ht(c?.skip, 1);
614
+ const w = Ht(a?.skip, 1);
615
615
  return w <= 0 ? 0 : Math.min(w, i);
616
- });
616
+ }, a?.transitionName);
617
617
  }
618
618
  };
619
619
  }
@@ -659,31 +659,31 @@ function Qe() {
659
659
  const i = V.generateTaskId();
660
660
  (await V.addTask(
661
661
  async (s) => {
662
- const w = new Promise((H) => {
662
+ const w = new Promise((A) => {
663
663
  window.addEventListener(
664
664
  "popstate",
665
- (R) => H(R.state),
665
+ (b) => A(b.state),
666
666
  { once: !0 }
667
667
  );
668
- }), P = new Promise(
669
- (H) => setTimeout(() => H(void 0), 200)
668
+ }), T = new Promise(
669
+ (A) => setTimeout(() => A(void 0), 200)
670
670
  );
671
671
  Ft(), window.history.back();
672
- const f = await Promise.race([
672
+ const p = await Promise.race([
673
673
  w,
674
- P
674
+ T
675
675
  ]);
676
- if (!f) {
676
+ if (!p) {
677
677
  s.abort();
678
678
  return;
679
679
  }
680
- if (f.step) {
681
- e({ type: "SET", params: f.params ?? {} }), s.abort();
680
+ if (p.step) {
681
+ e({ type: "SET", params: p.params ?? {} }), s.abort();
682
682
  return;
683
683
  }
684
- const { setStatus: T, setTransitionTaskId: p } = J.getState(), { index: I, popHistory: L } = G.getState();
685
- return T("POPPING"), p(i), async () => {
686
- L(I), T("COMPLETED");
684
+ const { setStatus: P, setTransitionTaskId: f } = J.getState(), { index: L, popHistory: R } = G.getState();
685
+ return P("POPPING"), f(i), async () => {
686
+ R(L), P("COMPLETED");
687
687
  };
688
688
  },
689
689
  {
@@ -712,17 +712,17 @@ function Oe({ freeze: n, children: e }) {
712
712
  );
713
713
  }
714
714
  function Ge({ ref: n, style: e, ...r }) {
715
- const { isActive: a, transitionName: c } = gt(), i = N(null);
715
+ const { isActive: c, transitionName: a } = gt(), i = N(null);
716
716
  Se(n, () => i.current);
717
- const s = J((T) => T.status), w = ut.get(c) ?? ut.get("none"), { decoratorName: P } = w, f = yt.get(P);
718
- return f ? /* @__PURE__ */ k(
717
+ const s = J((P) => P.status), w = ut.get(a) ?? ut.get("none"), { decoratorName: T } = w, p = yt.get(T);
718
+ return p ? /* @__PURE__ */ k(
719
719
  "div",
720
720
  {
721
721
  ref: i,
722
722
  "data-flemo-decorator": !0,
723
- "data-flemo-decorator-name": f.name,
723
+ "data-flemo-decorator-name": p.name,
724
724
  "data-flemo-status": s,
725
- "data-flemo-active": a ? "true" : "false",
725
+ "data-flemo-active": c ? "true" : "false",
726
726
  style: {
727
727
  position: "absolute",
728
728
  top: 0,
@@ -739,13 +739,13 @@ function Ge({ ref: n, style: e, ...r }) {
739
739
  }
740
740
  const ee = (n) => {
741
741
  let e;
742
- const r = /* @__PURE__ */ new Set(), a = (f, T) => {
743
- const p = typeof f == "function" ? f(e) : f;
744
- if (!Object.is(p, e)) {
745
- const I = e;
746
- e = T ?? (typeof p != "object" || p === null) ? p : Object.assign({}, e, p), r.forEach((L) => L(e, I));
742
+ const r = /* @__PURE__ */ new Set(), c = (p, P) => {
743
+ const f = typeof p == "function" ? p(e) : p;
744
+ if (!Object.is(f, e)) {
745
+ const L = e;
746
+ e = P ?? (typeof f != "object" || f === null) ? f : Object.assign({}, e, f), r.forEach((R) => R(e, L));
747
747
  }
748
- }, c = () => e, w = { setState: a, getState: c, getInitialState: () => P, subscribe: (f) => (r.add(f), () => r.delete(f)) }, P = e = n(a, c, w);
748
+ }, a = () => e, w = { setState: c, getState: a, getInitialState: () => T, subscribe: (p) => (r.add(p), () => r.delete(p)) }, T = e = n(c, a, w);
749
749
  return w;
750
750
  }, Be = ((n) => n ? ee(n) : ee), Ue = (n) => n;
751
751
  function Ye(n, e = Ue) {
@@ -757,7 +757,7 @@ function Ye(n, e = Ue) {
757
757
  return xt.useDebugValue(r), r;
758
758
  }
759
759
  const ne = (n) => {
760
- const e = Be(n), r = (a) => Ye(e, a);
760
+ const e = Be(n), r = (c) => Ye(e, c);
761
761
  return Object.assign(r, e), r;
762
762
  }, Ve = ((n) => n ? ne(n) : ne), Z = Ve((n) => ({
763
763
  dragStatus: "IDLE",
@@ -765,27 +765,27 @@ const ne = (n) => {
765
765
  sharedBars: {},
766
766
  setDragStatus: (e) => n({ dragStatus: e }),
767
767
  setReplaceTransitionStatus: (e) => n({ replaceTransitionStatus: e }),
768
- registerSharedBars: (e, r) => n((a) => ({ sharedBars: { ...a.sharedBars, [e]: r } })),
768
+ registerSharedBars: (e, r) => n((c) => ({ sharedBars: { ...c.sharedBars, [e]: r } })),
769
769
  unregisterSharedBars: (e) => n((r) => {
770
- const a = { ...r.sharedBars };
771
- return delete a[e], { sharedBars: a };
770
+ const c = { ...r.sharedBars };
771
+ return delete c[e], { sharedBars: c };
772
772
  })
773
773
  }));
774
774
  let Gt = 0;
775
775
  function _e() {
776
- const [n, e] = bt(0), [r, a] = bt(0);
776
+ const [n, e] = bt(0), [r, c] = bt(0);
777
777
  return wt(() => {
778
- let c = 0;
778
+ let a = 0;
779
779
  const i = () => {
780
- cancelAnimationFrame(c), c = requestAnimationFrame(() => {
780
+ cancelAnimationFrame(a), a = requestAnimationFrame(() => {
781
781
  let s = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
782
782
  s = s < 0 ? 0 : s;
783
783
  let w = s - Gt;
784
- w = w < 0 ? 0 : w, Gt || (Gt = s), a(w), e(s);
784
+ w = w < 0 ? 0 : w, Gt || (Gt = s), c(w), e(s);
785
785
  });
786
786
  };
787
787
  return window.visualViewport?.addEventListener("resize", i), window.visualViewport?.addEventListener("scroll", i), () => {
788
- cancelAnimationFrame(c), window.visualViewport?.removeEventListener("resize", i), window.visualViewport?.removeEventListener("scroll", i);
788
+ cancelAnimationFrame(a), window.visualViewport?.removeEventListener("resize", i), window.visualViewport?.removeEventListener("scroll", i);
789
789
  };
790
790
  }, []), { viewportScrollHeight: n, changedViewportScrollHeight: r };
791
791
  }
@@ -796,54 +796,54 @@ const je = (n) => typeof HTMLElement < "u" && n instanceof HTMLElement, Vt = /*
796
796
  n.style.transition = "";
797
797
  const r = Vt.get(n);
798
798
  if (r && r.size > 0) {
799
- for (const a of r)
800
- n.style.removeProperty(a);
799
+ for (const c of r)
800
+ n.style.removeProperty(c);
801
801
  r.clear();
802
802
  return;
803
803
  }
804
804
  n.style.removeProperty("transform"), n.style.removeProperty("opacity");
805
805
  }, dt = (n, e, r = {}) => {
806
806
  if (!je(n)) return Promise.resolve();
807
- const a = n, c = xe(e);
808
- if (c.length === 0) return Promise.resolve();
807
+ const c = n, a = xe(e);
808
+ if (a.length === 0) return Promise.resolve();
809
809
  const i = typeof r.duration == "number" ? r.duration : 0, s = typeof r.delay == "number" && r.delay > 0 ? r.delay : 0, w = be(r.ease);
810
810
  if (i <= 0 && s <= 0) {
811
- a.style.transition = "none";
812
- for (const f of c)
813
- a.style.setProperty(f.property, f.value), re(a, f.property);
811
+ c.style.transition = "none";
812
+ for (const p of a)
813
+ c.style.setProperty(p.property, p.value), re(c, p.property);
814
814
  return Promise.resolve();
815
815
  }
816
- const P = c.map((f) => `${f.property} ${i}s ${w} ${s}s`).join(", ");
817
- a.style.transition = P, a.offsetWidth;
818
- for (const f of c)
819
- a.style.setProperty(f.property, f.value), re(a, f.property);
820
- return new Promise((f) => {
821
- let T = !1;
822
- const p = () => {
823
- T || (T = !0, a.removeEventListener("transitionend", I), f());
824
- }, I = (L) => {
825
- L.target === a && p();
816
+ const T = a.map((p) => `${p.property} ${i}s ${w} ${s}s`).join(", ");
817
+ c.style.transition = T, c.offsetWidth;
818
+ for (const p of a)
819
+ c.style.setProperty(p.property, p.value), re(c, p.property);
820
+ return new Promise((p) => {
821
+ let P = !1;
822
+ const f = () => {
823
+ P || (P = !0, c.removeEventListener("transitionend", L), p());
824
+ }, L = (R) => {
825
+ R.target === c && f();
826
826
  };
827
- a.addEventListener("transitionend", I), setTimeout(p, (i + s) * 1e3 + 60);
827
+ c.addEventListener("transitionend", L), setTimeout(f, (i + s) * 1e3 + 60);
828
828
  });
829
829
  }, pt = J, ht = "data-flemo-skip-animation";
830
830
  function Fe({
831
831
  children: n,
832
832
  statusBarHeight: e,
833
833
  statusBarColor: r,
834
- systemNavigationBarHeight: a,
835
- systemNavigationBarColor: c,
834
+ systemNavigationBarHeight: c,
835
+ systemNavigationBarColor: a,
836
836
  sharedAppBar: i,
837
837
  sharedNavigationBar: s,
838
838
  appBar: w,
839
- navigationBar: P,
840
- hideStatusBar: f,
841
- hideSystemNavigationBar: T,
842
- backgroundColor: p = "white",
843
- contentScrollable: I = !0,
844
- ...L
839
+ navigationBar: T,
840
+ hideStatusBar: p,
841
+ hideSystemNavigationBar: P,
842
+ backgroundColor: f = "white",
843
+ contentScrollable: L = !0,
844
+ ...R
845
845
  }) {
846
- const { id: H, isActive: R, isRoot: U, zIndex: C, transitionName: A, prevTransitionName: X } = gt(), O = pt((t) => t.status), o = Z((t) => t.dragStatus), u = Z.getState().setDragStatus, y = Z.getState().setReplaceTransitionStatus, l = G((t) => t.index), d = ut.get(A) ?? ut.get("none"), { initial: g, swipeDirection: m, decoratorName: x } = d, S = yt.get(x), { viewportScrollHeight: D } = _e(), b = D > 0, [Y, v] = bt(0), [B, j] = bt(0), Xt = N(null), _ = N(null), tt = N(null), K = N(null), lt = N(null), Q = N({
846
+ const { id: A, isActive: b, isRoot: U, zIndex: M, transitionName: $, prevTransitionName: X } = gt(), O = pt((t) => t.status), o = Z((t) => t.dragStatus), u = Z.getState().setDragStatus, y = Z.getState().setReplaceTransitionStatus, l = G((t) => t.index), d = ut.get($) ?? ut.get("none"), { initial: g, swipeDirection: m, decoratorName: x } = d, S = yt.get(x), { viewportScrollHeight: D } = _e(), I = D > 0, [Y, v] = bt(0), [B, j] = bt(0), Xt = N(null), _ = N(null), tt = N(null), K = N(null), lt = N(null), Q = N({
847
847
  current: [],
848
848
  prev: []
849
849
  }), et = N(!1), ft = N(!1), ot = N(!1), ce = N(0), Dt = N({ x: 0, y: 0 }), St = N({ x: 0, y: 0 }), Lt = N(0), Nt = N({ x: 0, y: 0 }), nt = N({
@@ -861,32 +861,32 @@ function Fe({
861
861
  velocity: Nt.current
862
862
  };
863
863
  }, ue = (t) => {
864
- const h = t.timeStamp, E = Math.max(1, h - Lt.current), M = St.current;
864
+ const h = t.timeStamp, E = Math.max(1, h - Lt.current), H = St.current;
865
865
  Nt.current = {
866
- x: (t.clientX - M.x) / E * 1e3,
867
- y: (t.clientY - M.y) / E * 1e3
866
+ x: (t.clientX - H.x) / E * 1e3,
867
+ y: (t.clientY - H.y) / E * 1e3
868
868
  }, St.current = { x: t.clientX, y: t.clientY }, Lt.current = h;
869
869
  }, Ct = (t, h, E) => {
870
- const M = dt(t, h, E);
870
+ const H = dt(t, h, E);
871
871
  if (t === _.current)
872
- for (const $ of Q.current.current)
873
- dt($, h, E);
872
+ for (const C of Q.current.current)
873
+ dt(C, h, E);
874
874
  else if (t === tt.current)
875
- for (const $ of Q.current.prev)
876
- dt($, h, E);
877
- return M;
875
+ for (const C of Q.current.prev)
876
+ dt(C, h, E);
877
+ return H;
878
878
  }, le = (t) => {
879
- const h = R ? G.getState().histories[l - 1]?.id : G.getState().histories[l]?.id, E = h ? Z.getState().sharedBars[h] : void 0, M = [], $ = st.current, ct = at.current;
880
- $ && Et && !E?.appBar && M.push($), ct && Pt && !E?.navigationBar && M.push(ct);
879
+ const h = b ? G.getState().histories[l - 1]?.id : G.getState().histories[l]?.id, E = h ? Z.getState().sharedBars[h] : void 0, H = [], C = st.current, ct = at.current;
880
+ C && Et && !E?.appBar && H.push(C), ct && Tt && !E?.navigationBar && H.push(ct);
881
881
  const q = [];
882
882
  if (t) {
883
883
  const rt = t.querySelector('[data-flemo-bar="app"]'), Wt = t.querySelector('[data-flemo-bar="nav"]');
884
- rt && !Et && q.push(rt), Wt && !Pt && q.push(Wt);
884
+ rt && !Et && q.push(rt), Wt && !Tt && q.push(Wt);
885
885
  }
886
- Q.current = { current: M, prev: q };
887
- const Tt = De(d).join(", ");
888
- for (const rt of M) rt.style.willChange = Tt;
889
- for (const rt of q) rt.style.willChange = Tt;
886
+ Q.current = { current: H, prev: q };
887
+ const Pt = De(d).join(", ");
888
+ for (const rt of H) rt.style.willChange = Pt;
889
+ for (const rt of q) rt.style.willChange = Pt;
890
890
  }, qt = () => {
891
891
  for (const t of Q.current.current)
892
892
  z(t), t.style.removeProperty("will-change");
@@ -903,7 +903,7 @@ function Fe({
903
903
  animate: Ct,
904
904
  currentScreen: h,
905
905
  prevScreen: tt.current,
906
- onStart: ($) => S?.onSwipeStart?.($, {
906
+ onStart: (C) => S?.onSwipeStart?.(C, {
907
907
  animate: dt,
908
908
  currentDecorator: K.current,
909
909
  prevDecorator: lt.current
@@ -930,22 +930,22 @@ function Fe({
930
930
  animate: Ct,
931
931
  currentScreen: _.current,
932
932
  prevScreen: tt.current,
933
- onStart: ($) => S?.onSwipeEnd?.($, {
933
+ onStart: (C) => S?.onSwipeEnd?.(C, {
934
934
  animate: dt,
935
935
  currentDecorator: K.current,
936
936
  prevDecorator: lt.current
937
937
  })
938
938
  })) {
939
939
  _.current?.setAttribute(ht, "true"), K.current?.setAttribute(ht, "true");
940
- for (const $ of Q.current.current)
941
- $.style.removeProperty("will-change");
942
- for (const $ of Q.current.prev)
943
- z($), $.style.removeProperty("will-change");
940
+ for (const C of Q.current.current)
941
+ C.style.removeProperty("will-change");
942
+ for (const C of Q.current.prev)
943
+ z(C), C.style.removeProperty("will-change");
944
944
  Q.current = { current: [], prev: [] }, window.history.back();
945
945
  } else
946
946
  z(_.current), tt.current && z(tt.current), K.current && z(K.current), lt.current && z(lt.current), qt(), u("IDLE");
947
947
  }, fe = (t) => {
948
- if (!(!U && R && O === "COMPLETED" && o === "IDLE" && !!m && D < 10))
948
+ if (!(!U && b && O === "COMPLETED" && o === "IDLE" && !!m && D < 10))
949
949
  return;
950
950
  nt.current = Jt(t.target, {
951
951
  direction: "x",
@@ -964,11 +964,11 @@ function Fe({
964
964
  const h = !nt.current.element && !it.current.element;
965
965
  if (et.current && h) {
966
966
  et.current = !1, ft.current = !0;
967
- const E = t.clientY - At.current, M = t.clientX - kt.current;
968
- (m === "y" && E > 0 || m === "x" && M > 0) && vt(t.nativeEvent);
967
+ const E = t.clientY - At.current, H = t.clientX - kt.current;
968
+ (m === "y" && E > 0 || m === "x" && H > 0) && vt(t.nativeEvent);
969
969
  } else if (et.current && !h) {
970
- const E = t.clientX - kt.current, M = t.clientY - At.current, $ = it.current.element && it.current.element.scrollTop <= 0, ct = nt.current.element && nt.current.element.scrollLeft <= 0 && nt.current.hasMarker;
971
- (m === "y" && ($ || nt.current.element) && M > 0 && Math.abs(E) < 2 || m === "x" && (ct || it.current.element) && E > 0 && Math.abs(M) < 2) && (et.current = !1, ft.current = !0, vt(t.nativeEvent));
970
+ const E = t.clientX - kt.current, H = t.clientY - At.current, C = it.current.element && it.current.element.scrollTop <= 0, ct = nt.current.element && nt.current.element.scrollLeft <= 0 && nt.current.hasMarker;
971
+ (m === "y" && (C || nt.current.element) && H > 0 && Math.abs(E) < 2 || m === "x" && (ct || it.current.element) && E > 0 && Math.abs(H) < 2) && (et.current = !1, ft.current = !0, vt(t.nativeEvent));
972
972
  }
973
973
  }, zt = (t) => {
974
974
  et.current = !1, ft.current = !1, ot.current && pe(t.nativeEvent);
@@ -985,8 +985,8 @@ function Fe({
985
985
  t.removeEventListener("touchmove", h);
986
986
  };
987
987
  }, []), mt(() => {
988
- if (!R) {
989
- O === "REPLACING" && X !== A && y("PENDING");
988
+ if (!b) {
989
+ O === "REPLACING" && X !== $ && y("PENDING");
990
990
  return;
991
991
  }
992
992
  if (O === "COMPLETED") {
@@ -1004,7 +1004,7 @@ function Fe({
1004
1004
  queueMicrotask(h);
1005
1005
  return;
1006
1006
  }
1007
- const ct = Re("screen", A, E), q = (W) => {
1007
+ const ct = Re("screen", $, E), q = (W) => {
1008
1008
  W.target === t && W.animationName === ct && (t.removeEventListener("animationend", q), h());
1009
1009
  };
1010
1010
  return t.addEventListener("animationend", q), () => {
@@ -1012,10 +1012,10 @@ function Fe({
1012
1012
  };
1013
1013
  }, [
1014
1014
  O,
1015
- R,
1016
- H,
1017
- X,
1015
+ b,
1018
1016
  A,
1017
+ X,
1018
+ $,
1019
1019
  d,
1020
1020
  u,
1021
1021
  y
@@ -1047,12 +1047,12 @@ function Fe({
1047
1047
  };
1048
1048
  }, [s]), mt(() => {
1049
1049
  const { registerSharedBars: t, unregisterSharedBars: h } = Z.getState();
1050
- return t(H, {
1050
+ return t(A, {
1051
1051
  appBar: !!i,
1052
1052
  navigationBar: !!s
1053
- }), () => h(H);
1054
- }, [H, i, s]);
1055
- const Kt = R || C === l - 1, Et = !!i, Pt = !!s;
1053
+ }), () => h(A);
1054
+ }, [A, i, s]);
1055
+ const Kt = b || M === l - 1, Et = !!i, Tt = !!s;
1056
1056
  mt(() => {
1057
1057
  const t = st.current, h = at.current;
1058
1058
  if (!t && !h) return;
@@ -1061,17 +1061,17 @@ function Fe({
1061
1061
  t?.removeAttribute("data-flemo-bar-riding"), h?.removeAttribute("data-flemo-bar-riding");
1062
1062
  return;
1063
1063
  }
1064
- const q = R ? G.getState().histories[l - 1]?.id : G.getState().histories[l]?.id, W = q ? Z.getState().sharedBars[q] : void 0, Tt = Et && !W?.appBar, rt = Pt && !W?.navigationBar;
1065
- t && t.setAttribute("data-flemo-bar-riding", Tt ? "true" : "false"), h && h.setAttribute("data-flemo-bar-riding", rt ? "true" : "false");
1064
+ const q = b ? G.getState().histories[l - 1]?.id : G.getState().histories[l]?.id, W = q ? Z.getState().sharedBars[q] : void 0, Pt = Et && !W?.appBar, rt = Tt && !W?.navigationBar;
1065
+ t && t.setAttribute("data-flemo-bar-riding", Pt ? "true" : "false"), h && h.setAttribute("data-flemo-bar-riding", rt ? "true" : "false");
1066
1066
  };
1067
1067
  E();
1068
- const M = Z.subscribe(E), $ = pt.subscribe(E);
1068
+ const H = Z.subscribe(E), C = pt.subscribe(E);
1069
1069
  return () => {
1070
- M(), $(), t?.removeAttribute("data-flemo-bar-riding"), h?.removeAttribute("data-flemo-bar-riding");
1070
+ H(), C(), t?.removeAttribute("data-flemo-bar-riding"), h?.removeAttribute("data-flemo-bar-riding");
1071
1071
  };
1072
- }, [Kt, R, l, Et, Pt]);
1072
+ }, [Kt, b, l, Et, Tt]);
1073
1073
  const he = (() => {
1074
- if (!R) return {};
1074
+ if (!b) return {};
1075
1075
  if (O !== "PUSHING" && O !== "REPLACING") return {};
1076
1076
  const t = {};
1077
1077
  return typeof g.x == "number" && (t.transform = `translateX(${g.x}px)`), typeof g.x == "string" && (t.transform = `translateX(${g.x})`), typeof g.y == "number" && (t.transform = `translateY(${g.y}px)`), typeof g.y == "string" && (t.transform = `translateY(${g.y})`), typeof g.opacity == "number" && (t.opacity = `${g.opacity}`), t;
@@ -1115,27 +1115,27 @@ function Fe({
1115
1115
  "div",
1116
1116
  {
1117
1117
  ref: _,
1118
- ...L,
1118
+ ...R,
1119
1119
  onPointerDown: fe,
1120
1120
  onPointerMove: me,
1121
1121
  onPointerUp: zt,
1122
1122
  onPointerCancel: zt,
1123
1123
  "data-flemo-screen": !0,
1124
- "data-flemo-transition": A,
1124
+ "data-flemo-transition": $,
1125
1125
  "data-flemo-status": O,
1126
- "data-flemo-active": R ? "true" : "false",
1126
+ "data-flemo-active": b ? "true" : "false",
1127
1127
  style: {
1128
1128
  display: "flex",
1129
1129
  flexDirection: "column",
1130
1130
  height: "100%",
1131
- backgroundColor: p,
1132
- overflowY: I ? void 0 : "auto",
1131
+ backgroundColor: f,
1132
+ overflowY: L ? void 0 : "auto",
1133
1133
  touchAction: m === "x" ? "pan-y" : m === "y" ? "pan-x" : "auto",
1134
1134
  ...he,
1135
- ...L.style
1135
+ ...R.style
1136
1136
  },
1137
1137
  children: [
1138
- !f && e && /* @__PURE__ */ k("div", { style: { minHeight: e }, children: /* @__PURE__ */ k(
1138
+ !p && e && /* @__PURE__ */ k("div", { style: { minHeight: e }, children: /* @__PURE__ */ k(
1139
1139
  "div",
1140
1140
  {
1141
1141
  style: {
@@ -1164,28 +1164,28 @@ function Fe({
1164
1164
  display: "flex",
1165
1165
  flexDirection: "column",
1166
1166
  flexGrow: 1,
1167
- overflowY: I ? "auto" : void 0
1167
+ overflowY: L ? "auto" : void 0
1168
1168
  },
1169
1169
  children: n
1170
1170
  }
1171
1171
  ),
1172
- P,
1172
+ T,
1173
1173
  s && /* @__PURE__ */ k(
1174
1174
  "div",
1175
1175
  {
1176
1176
  style: {
1177
- display: b ? "none" : void 0,
1177
+ display: I ? "none" : void 0,
1178
1178
  width: "100%",
1179
1179
  minHeight: B
1180
1180
  }
1181
1181
  }
1182
1182
  ),
1183
- !T && a && /* @__PURE__ */ k(
1183
+ !P && c && /* @__PURE__ */ k(
1184
1184
  "div",
1185
1185
  {
1186
1186
  style: {
1187
- display: b ? "none" : void 0,
1188
- minHeight: a
1187
+ display: I ? "none" : void 0,
1188
+ minHeight: c
1189
1189
  },
1190
1190
  children: /* @__PURE__ */ k(
1191
1191
  "div",
@@ -1194,8 +1194,8 @@ function Fe({
1194
1194
  position: "fixed",
1195
1195
  bottom: 0,
1196
1196
  width: "100%",
1197
- minHeight: a,
1198
- backgroundColor: c
1197
+ minHeight: c,
1198
+ backgroundColor: a
1199
1199
  }
1200
1200
  }
1201
1201
  )
@@ -1209,12 +1209,12 @@ function Fe({
1209
1209
  {
1210
1210
  ref: st,
1211
1211
  "data-flemo-bar": "app",
1212
- "data-flemo-bar-transition": A,
1212
+ "data-flemo-bar-transition": $,
1213
1213
  "data-flemo-bar-status": O,
1214
- "data-flemo-bar-active": R ? "true" : "false",
1214
+ "data-flemo-bar-active": b ? "true" : "false",
1215
1215
  style: {
1216
1216
  position: "fixed",
1217
- top: f ? 0 : e,
1217
+ top: p ? 0 : e,
1218
1218
  left: 0,
1219
1219
  width: "100%",
1220
1220
  zIndex: 1
@@ -1227,13 +1227,13 @@ function Fe({
1227
1227
  {
1228
1228
  ref: at,
1229
1229
  "data-flemo-bar": "nav",
1230
- "data-flemo-bar-transition": A,
1230
+ "data-flemo-bar-transition": $,
1231
1231
  "data-flemo-bar-status": O,
1232
- "data-flemo-bar-active": R ? "true" : "false",
1232
+ "data-flemo-bar-active": b ? "true" : "false",
1233
1233
  style: {
1234
- display: b ? "none" : void 0,
1234
+ display: I ? "none" : void 0,
1235
1235
  position: "fixed",
1236
- bottom: T ? 0 : a,
1236
+ bottom: P ? 0 : c,
1237
1237
  left: 0,
1238
1238
  width: "100%",
1239
1239
  zIndex: 1
@@ -1261,8 +1261,8 @@ function Fe({
1261
1261
  );
1262
1262
  }
1263
1263
  function tn({ children: n, ...e }) {
1264
- const { isActive: r, isPrev: a, zIndex: c } = gt(), i = G((p) => p.index), s = J((p) => p.status), w = Z((p) => p.dragStatus), P = Z((p) => p.replaceTransitionStatus), T = !r && (s === "COMPLETED" && w === "IDLE") || a && i - 2 <= c && P === "IDLE" || a && i - 2 > c;
1265
- return /* @__PURE__ */ k(Oe, { freeze: T, children: /* @__PURE__ */ k(Fe, { ...e, children: n }) });
1264
+ const { isActive: r, isPrev: c, zIndex: a } = gt(), i = G((f) => f.index), s = J((f) => f.status), w = Z((f) => f.dragStatus), T = Z((f) => f.replaceTransitionStatus), P = !r && (s === "COMPLETED" && w === "IDLE") || c && i - 2 <= a && T === "IDLE" || c && i - 2 > a;
1265
+ return /* @__PURE__ */ k(Oe, { freeze: P, children: /* @__PURE__ */ k(Fe, { ...e, children: n }) });
1266
1266
  }
1267
1267
  export {
1268
1268
  We as Route,
@@ -13,6 +13,8 @@ export default function useNavigate(): {
13
13
  layoutId?: string | number;
14
14
  transitionName?: TransitionName;
15
15
  }) => Promise<void>;
16
- pop: (options?: DistanceOptions) => Promise<void>;
16
+ pop: (options?: DistanceOptions & {
17
+ transitionName?: TransitionName;
18
+ }) => Promise<void>;
17
19
  };
18
20
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flemo/react",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "React bindings for flemo — Router, Route, Screen, and the screen-transition runtime.",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "path-to-regexp": "^8.2.0",
38
38
  "zustand": "^5.0.11",
39
- "@flemo/core": "1.2.0"
39
+ "@flemo/core": "1.3.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@testing-library/jest-dom": "^6.6.3",
@@ -54,8 +54,8 @@
54
54
  "vite": "^7.1.5",
55
55
  "vite-plugin-dts": "^4.5.4",
56
56
  "vitest": "^2.1.8",
57
- "@flemo/tsconfig": "0.0.0",
58
- "@flemo/eslint-config": "0.0.0"
57
+ "@flemo/eslint-config": "0.0.0",
58
+ "@flemo/tsconfig": "0.0.0"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "react": "^19.2.0",