@flemo/react 1.1.0 → 1.3.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/README.md +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.mjs +1180 -1263
- package/dist/navigate/useNavigate.d.ts +3 -1
- package/dist/screen/__tests__/Screen.test.d.ts +1 -0
- package/dist/screen/__tests__/ScreenDecorator.test.d.ts +1 -0
- package/dist/screen/store.d.ts +4 -3
- package/dist/stores/RouterScopeProvider.d.ts +3 -0
- package/dist/stores/StoreContext.d.ts +10 -0
- package/dist/stores/__tests__/RouterScopeProvider.test.d.ts +1 -0
- package/dist/stores/__tests__/testUtils.d.ts +4 -0
- package/dist/stores/useHistoryStore.d.ts +2 -0
- package/dist/stores/useNavigateStore.d.ts +2 -0
- package/dist/stores/useScreenStore.d.ts +2 -0
- package/dist/stores/useStores.d.ts +2 -0
- package/package.json +24 -24
package/dist/index.mjs
CHANGED
|
@@ -1,1285 +1,1202 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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();
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
return p(a), R ? T("POPPING") : U ? (T("PUSHING"), L({
|
|
19
|
-
id: r,
|
|
20
|
-
pathname: A,
|
|
21
|
-
params: w,
|
|
22
|
-
transitionName: P,
|
|
23
|
-
layoutId: f
|
|
24
|
-
})) : C && (T("REPLACING"), L({
|
|
25
|
-
id: r,
|
|
26
|
-
pathname: A,
|
|
27
|
-
params: w,
|
|
28
|
-
transitionName: P,
|
|
29
|
-
layoutId: f
|
|
30
|
-
})), async () => {
|
|
31
|
-
R && H(i + 1), T("COMPLETED");
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: a,
|
|
36
|
-
control: {
|
|
37
|
-
manual: !0
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
)).result?.();
|
|
41
|
-
};
|
|
42
|
-
return window.addEventListener("popstate", n), () => {
|
|
43
|
-
window.removeEventListener("popstate", n);
|
|
44
|
-
};
|
|
45
|
-
}, []), null;
|
|
1
|
+
import e, { Children as t, createContext as n, useContext as r, useEffect as i, useImperativeHandle as a, useInsertionEffect as o, useLayoutEffect as s, useReducer as c, useRef as l, useState as u } from "react";
|
|
2
|
+
import { TaskManger as d, animationName as f, collectAnimatedProperties as p, compileTransitionStyles as m, consumeSelfInducedPop as h, createDecorator as g, createHistoryStore as _, createNavigateStore as v, createRawDecorator as ee, createRawTransition as te, createTransition as y, createTransitionStore as b, decoratorMap as ne, easingToCss as re, findScrollable as ie, getMatchedPathPattern as ae, getParams as x, isServer as oe, markSelfInducedPop as S, targetToDecls as C, transitionMap as w, variantHasAnimation as se } from "@flemo/core";
|
|
3
|
+
import { jsx as T, jsxs as ce } from "react/jsx-runtime";
|
|
4
|
+
//#region \0rolldown/runtime.js
|
|
5
|
+
var le = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), E = n(null);
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/stores/useStores.ts
|
|
8
|
+
function D() {
|
|
9
|
+
let e = r(E);
|
|
10
|
+
if (!e) throw Error("flemo stores are missing. Render inside a <Router>.");
|
|
11
|
+
return e;
|
|
46
12
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (b === m)
|
|
86
|
-
return D(), x;
|
|
87
|
-
if (b === "\\") {
|
|
88
|
-
if (d === l.length)
|
|
89
|
-
throw new P(`Unexpected end after \\ at index ${d}`, o);
|
|
90
|
-
S += l[d++];
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
if (b === ":" || b === "*") {
|
|
94
|
-
const Y = b === ":" ? "param" : "wildcard";
|
|
95
|
-
let v = "";
|
|
96
|
-
if (r.test(l[d]))
|
|
97
|
-
do
|
|
98
|
-
v += l[d++];
|
|
99
|
-
while (a.test(l[d]));
|
|
100
|
-
else if (l[d] === '"') {
|
|
101
|
-
let B = d;
|
|
102
|
-
for (; d < l.length; ) {
|
|
103
|
-
if (l[++d] === '"') {
|
|
104
|
-
d++, B = 0;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
l[d] === "\\" && d++, v += l[d];
|
|
108
|
-
}
|
|
109
|
-
if (B)
|
|
110
|
-
throw new P(`Unterminated quote at index ${B}`, o);
|
|
111
|
-
}
|
|
112
|
-
if (!v)
|
|
113
|
-
throw new P(`Missing parameter name at index ${d}`, o);
|
|
114
|
-
D(), x.push({ type: Y, name: v });
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (b === "{") {
|
|
118
|
-
D(), x.push({
|
|
119
|
-
type: "group",
|
|
120
|
-
tokens: g("}")
|
|
121
|
-
});
|
|
122
|
-
continue;
|
|
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;
|
|
127
|
-
}
|
|
128
|
-
if (m)
|
|
129
|
-
throw new P(`Unexpected end at index ${d}, expected ${m}`, o);
|
|
130
|
-
return D(), x;
|
|
131
|
-
}
|
|
132
|
-
return new w(g(""), o);
|
|
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);
|
|
136
|
-
return function(x = {}) {
|
|
137
|
-
const S = [], D = g(x, S);
|
|
138
|
-
if (S.length)
|
|
139
|
-
throw new TypeError(`Missing parameters: ${S.join(", ")}`);
|
|
140
|
-
return D;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
function p(o, u, y) {
|
|
144
|
-
const l = o.map((d) => I(d, u, y));
|
|
145
|
-
return (d, g) => {
|
|
146
|
-
let m = "";
|
|
147
|
-
for (const x of l)
|
|
148
|
-
m += x(d, g);
|
|
149
|
-
return m;
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
function I(o, u, y) {
|
|
153
|
-
if (o.type === "text")
|
|
154
|
-
return () => o.value;
|
|
155
|
-
if (o.type === "group") {
|
|
156
|
-
const d = p(o.tokens, u, y);
|
|
157
|
-
return (g, m) => {
|
|
158
|
-
const x = m.length, S = d(g, m);
|
|
159
|
-
return m.length === x ? S : (m.length = x, "");
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
const l = y || e;
|
|
163
|
-
return o.type === "wildcard" && y !== !1 ? (d, g) => {
|
|
164
|
-
const m = d[o.name];
|
|
165
|
-
if (m == null)
|
|
166
|
-
return g.push(o.name), "";
|
|
167
|
-
if (!Array.isArray(m) || m.length === 0)
|
|
168
|
-
throw new TypeError(`Expected "${o.name}" to be a non-empty array`);
|
|
169
|
-
let x = "";
|
|
170
|
-
for (let S = 0; S < m.length; S++) {
|
|
171
|
-
if (typeof m[S] != "string")
|
|
172
|
-
throw new TypeError(`Expected "${o.name}/${S}" to be a string`);
|
|
173
|
-
S > 0 && (x += u), x += l(m[S]);
|
|
174
|
-
}
|
|
175
|
-
return x;
|
|
176
|
-
} : (d, g) => {
|
|
177
|
-
const m = d[o.name];
|
|
178
|
-
if (m == null)
|
|
179
|
-
return g.push(o.name), "";
|
|
180
|
-
if (typeof m != "string")
|
|
181
|
-
throw new TypeError(`Expected "${o.name}" to be a string`);
|
|
182
|
-
return l(m);
|
|
183
|
-
};
|
|
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));
|
|
187
|
-
return function(S) {
|
|
188
|
-
const D = d.exec(S);
|
|
189
|
-
if (!D)
|
|
190
|
-
return !1;
|
|
191
|
-
const b = D[0], Y = /* @__PURE__ */ Object.create(null);
|
|
192
|
-
for (let v = 1; v < D.length; v++) {
|
|
193
|
-
if (D[v] === void 0)
|
|
194
|
-
continue;
|
|
195
|
-
const B = g[v - 1], j = m[v - 1];
|
|
196
|
-
Y[B.name] = j(D[v]);
|
|
197
|
-
}
|
|
198
|
-
return { path: b, params: Y };
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
function H(o, u = {}) {
|
|
202
|
-
const { delimiter: y = n, end: l = !0, sensitive: d = !1, trailing: g = !0 } = u, m = [];
|
|
203
|
-
let x = "", S = 0;
|
|
204
|
-
function D(Y) {
|
|
205
|
-
if (Array.isArray(Y)) {
|
|
206
|
-
for (const B of Y)
|
|
207
|
-
D(B);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const v = typeof Y == "object" ? Y : f(Y, u);
|
|
211
|
-
R(v.tokens, 0, [], (B) => {
|
|
212
|
-
if (S >= 256)
|
|
213
|
-
throw new P("Too many path combinations", v.originalPath);
|
|
214
|
-
S > 0 && (x += "|"), x += U(B, y, m, v.originalPath), S++;
|
|
215
|
-
});
|
|
216
|
-
}
|
|
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 };
|
|
220
|
-
}
|
|
221
|
-
function R(o, u, y, l) {
|
|
222
|
-
for (; u < o.length; ) {
|
|
223
|
-
const d = o[u++];
|
|
224
|
-
if (d.type === "group") {
|
|
225
|
-
const g = y.length;
|
|
226
|
-
R(d.tokens, 0, y, (m) => R(o, u, m, l)), y.length = g;
|
|
227
|
-
continue;
|
|
228
|
-
}
|
|
229
|
-
y.push(d);
|
|
230
|
-
}
|
|
231
|
-
l(y);
|
|
232
|
-
}
|
|
233
|
-
function U(o, u, y, l) {
|
|
234
|
-
let d = "", g = "", m = "", x = 0, S = 0, D = 0;
|
|
235
|
-
function b(v, B) {
|
|
236
|
-
for (; v < o.length; ) {
|
|
237
|
-
const j = o[v++];
|
|
238
|
-
if (j.type === B)
|
|
239
|
-
return !0;
|
|
240
|
-
if (j.type === "text" && j.value.includes(u))
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
return !1;
|
|
244
|
-
}
|
|
245
|
-
function Y(v) {
|
|
246
|
-
let B = "";
|
|
247
|
-
for (; v < o.length; ) {
|
|
248
|
-
const j = o[v++];
|
|
249
|
-
if (j.type !== "text")
|
|
250
|
-
break;
|
|
251
|
-
B += j.value;
|
|
252
|
-
}
|
|
253
|
-
return B;
|
|
254
|
-
}
|
|
255
|
-
for (; D < o.length; ) {
|
|
256
|
-
const v = o[D++];
|
|
257
|
-
if (v.type === "text") {
|
|
258
|
-
d += s(v.value), g += v.value, x === 2 && (m += v.value), v.value.includes(u) && (S = 0);
|
|
259
|
-
continue;
|
|
260
|
-
}
|
|
261
|
-
if (v.type === "param" || v.type === "wildcard") {
|
|
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 = "";
|
|
265
|
-
continue;
|
|
266
|
-
}
|
|
267
|
-
throw new TypeError(`Unknown token type: ${v.type}`);
|
|
268
|
-
}
|
|
269
|
-
return d;
|
|
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)}]`);
|
|
273
|
-
}
|
|
274
|
-
function A(o, u) {
|
|
275
|
-
let y = "";
|
|
276
|
-
for (; u < o.length; ) {
|
|
277
|
-
const l = o[u++];
|
|
278
|
-
if (l.type === "text") {
|
|
279
|
-
y += i(l.value);
|
|
280
|
-
continue;
|
|
281
|
-
}
|
|
282
|
-
if (l.type === "group") {
|
|
283
|
-
y += "{" + A(l.tokens, 0) + "}";
|
|
284
|
-
continue;
|
|
285
|
-
}
|
|
286
|
-
if (l.type === "param") {
|
|
287
|
-
y += ":" + O(l.name, o[u]);
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
if (l.type === "wildcard") {
|
|
291
|
-
y += "*" + O(l.name, o[u]);
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
throw new TypeError(`Unknown token type: ${l.type}`);
|
|
295
|
-
}
|
|
296
|
-
return y;
|
|
297
|
-
}
|
|
298
|
-
function X(o) {
|
|
299
|
-
return A(o.tokens, 0);
|
|
300
|
-
}
|
|
301
|
-
function O(o, u) {
|
|
302
|
-
return !c.test(o) || u?.type === "text" && a.test(u.value[0]) ? JSON.stringify(o) : o;
|
|
303
|
-
}
|
|
304
|
-
return F;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/history/HistoryListener.tsx
|
|
15
|
+
function ue() {
|
|
16
|
+
let e = D();
|
|
17
|
+
return i(() => {
|
|
18
|
+
let t = async (t) => {
|
|
19
|
+
if (h()) return;
|
|
20
|
+
let n = t.state?.id, r = d.generateTaskId();
|
|
21
|
+
(await d.addTask(async (i) => {
|
|
22
|
+
let a = t.state?.index, o = t.state?.status, s = t.state?.params, c = t.state?.transitionName, l = t.state?.layoutId, { setStatus: u, setTransitionTaskId: d } = e.navigate.getState(), { index: f, addHistory: p, popHistory: m } = e.history.getState(), h = a < f, g = o === "PUSHING" && a > f, _ = o === "REPLACING" && a > f, v = window.location.pathname;
|
|
23
|
+
if (!h && !g && !_) {
|
|
24
|
+
i.abort();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
return d(r), h ? u("POPPING") : g ? (u("PUSHING"), p({
|
|
28
|
+
id: n,
|
|
29
|
+
pathname: v,
|
|
30
|
+
params: s,
|
|
31
|
+
transitionName: c,
|
|
32
|
+
layoutId: l
|
|
33
|
+
})) : _ && (u("REPLACING"), p({
|
|
34
|
+
id: n,
|
|
35
|
+
pathname: v,
|
|
36
|
+
params: s,
|
|
37
|
+
transitionName: c,
|
|
38
|
+
layoutId: l
|
|
39
|
+
})), async () => {
|
|
40
|
+
h && m(a + 1), u("COMPLETED");
|
|
41
|
+
};
|
|
42
|
+
}, {
|
|
43
|
+
id: r,
|
|
44
|
+
control: { manual: !0 }
|
|
45
|
+
})).result?.();
|
|
46
|
+
};
|
|
47
|
+
return window.addEventListener("popstate", t), () => {
|
|
48
|
+
window.removeEventListener("popstate", t);
|
|
49
|
+
};
|
|
50
|
+
}, [e]), null;
|
|
305
51
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/screen/ScreenContext.ts
|
|
54
|
+
var O = (/* @__PURE__ */ le(((e) => {
|
|
55
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.PathError = e.TokenData = void 0, e.parse = c, e.compile = l, e.pathToRegexp = f;
|
|
56
|
+
var t = "/", n = (e) => e, r = /^[$_\p{ID_Start}]$/u, i = /^[$\u200c\u200d\p{ID_Continue}]$/u;
|
|
57
|
+
function a(e) {
|
|
58
|
+
return e.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
|
|
59
|
+
}
|
|
60
|
+
var o = class {
|
|
61
|
+
constructor(e, t) {
|
|
62
|
+
this.tokens = e, this.originalPath = t;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
e.TokenData = o;
|
|
66
|
+
var s = class extends TypeError {
|
|
67
|
+
constructor(e, t) {
|
|
68
|
+
let n = e;
|
|
69
|
+
t && (n += `: ${t}`), n += "; visit https://git.new/pathToRegexpError for info", super(n), this.originalPath = t;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
e.PathError = s;
|
|
73
|
+
function c(e, t = {}) {
|
|
74
|
+
let { encodePath: a = n } = t, c = [...e], l = 0;
|
|
75
|
+
function u(t) {
|
|
76
|
+
let n = [], o = "";
|
|
77
|
+
function d() {
|
|
78
|
+
o &&= (n.push({
|
|
79
|
+
type: "text",
|
|
80
|
+
value: a(o)
|
|
81
|
+
}), "");
|
|
82
|
+
}
|
|
83
|
+
for (; l < c.length;) {
|
|
84
|
+
let a = c[l++];
|
|
85
|
+
if (a === t) return d(), n;
|
|
86
|
+
if (a === "\\") {
|
|
87
|
+
if (l === c.length) throw new s(`Unexpected end after \\ at index ${l}`, e);
|
|
88
|
+
o += c[l++];
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (a === ":" || a === "*") {
|
|
92
|
+
let t = a === ":" ? "param" : "wildcard", o = "";
|
|
93
|
+
if (r.test(c[l])) do
|
|
94
|
+
o += c[l++];
|
|
95
|
+
while (i.test(c[l]));
|
|
96
|
+
else if (c[l] === "\"") {
|
|
97
|
+
let t = l;
|
|
98
|
+
for (; l < c.length;) {
|
|
99
|
+
if (c[++l] === "\"") {
|
|
100
|
+
l++, t = 0;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
c[l] === "\\" && l++, o += c[l];
|
|
104
|
+
}
|
|
105
|
+
if (t) throw new s(`Unterminated quote at index ${t}`, e);
|
|
106
|
+
}
|
|
107
|
+
if (!o) throw new s(`Missing parameter name at index ${l}`, e);
|
|
108
|
+
d(), n.push({
|
|
109
|
+
type: t,
|
|
110
|
+
name: o
|
|
111
|
+
});
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (a === "{") {
|
|
115
|
+
d(), n.push({
|
|
116
|
+
type: "group",
|
|
117
|
+
tokens: u("}")
|
|
118
|
+
});
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (a === "}" || a === "(" || a === ")" || a === "[" || a === "]" || a === "+" || a === "?" || a === "!") throw new s(`Unexpected ${a} at index ${l - 1}`, e);
|
|
122
|
+
o += a;
|
|
123
|
+
}
|
|
124
|
+
if (t) throw new s(`Unexpected end at index ${l}, expected ${t}`, e);
|
|
125
|
+
return d(), n;
|
|
126
|
+
}
|
|
127
|
+
return new o(u(""), e);
|
|
128
|
+
}
|
|
129
|
+
function l(e, n = {}) {
|
|
130
|
+
let { encode: r = encodeURIComponent, delimiter: i = t } = n, a = u((typeof e == "object" ? e : c(e, n)).tokens, i, r);
|
|
131
|
+
return function(e = {}) {
|
|
132
|
+
let t = [], n = a(e, t);
|
|
133
|
+
if (t.length) throw TypeError(`Missing parameters: ${t.join(", ")}`);
|
|
134
|
+
return n;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function u(e, t, n) {
|
|
138
|
+
let r = e.map((e) => d(e, t, n));
|
|
139
|
+
return (e, t) => {
|
|
140
|
+
let n = "";
|
|
141
|
+
for (let i of r) n += i(e, t);
|
|
142
|
+
return n;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function d(e, t, r) {
|
|
146
|
+
if (e.type === "text") return () => e.value;
|
|
147
|
+
if (e.type === "group") {
|
|
148
|
+
let n = u(e.tokens, t, r);
|
|
149
|
+
return (e, t) => {
|
|
150
|
+
let r = t.length, i = n(e, t);
|
|
151
|
+
return t.length === r ? i : (t.length = r, "");
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
let i = r || n;
|
|
155
|
+
return e.type === "wildcard" && r !== !1 ? (n, r) => {
|
|
156
|
+
let a = n[e.name];
|
|
157
|
+
if (a == null) return r.push(e.name), "";
|
|
158
|
+
if (!Array.isArray(a) || a.length === 0) throw TypeError(`Expected "${e.name}" to be a non-empty array`);
|
|
159
|
+
let o = "";
|
|
160
|
+
for (let n = 0; n < a.length; n++) {
|
|
161
|
+
if (typeof a[n] != "string") throw TypeError(`Expected "${e.name}/${n}" to be a string`);
|
|
162
|
+
n > 0 && (o += t), o += i(a[n]);
|
|
163
|
+
}
|
|
164
|
+
return o;
|
|
165
|
+
} : (t, n) => {
|
|
166
|
+
let r = t[e.name];
|
|
167
|
+
if (r == null) return n.push(e.name), "";
|
|
168
|
+
if (typeof r != "string") throw TypeError(`Expected "${e.name}" to be a string`);
|
|
169
|
+
return i(r);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function f(e, n = {}) {
|
|
173
|
+
let { delimiter: r = t, end: i = !0, sensitive: o = !1, trailing: l = !0 } = n, u = [], d = "", f = 0;
|
|
174
|
+
function h(e) {
|
|
175
|
+
if (Array.isArray(e)) {
|
|
176
|
+
for (let t of e) h(t);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
let t = typeof e == "object" ? e : c(e, n);
|
|
180
|
+
p(t.tokens, 0, [], (e) => {
|
|
181
|
+
if (f >= 256) throw new s("Too many path combinations", t.originalPath);
|
|
182
|
+
f > 0 && (d += "|"), d += m(e, r, u, t.originalPath), f++;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
h(e);
|
|
186
|
+
let g = `^(?:${d})`;
|
|
187
|
+
return l && (g += "(?:" + a(r) + "$)?"), g += i ? "$" : "(?=" + a(r) + "|$)", {
|
|
188
|
+
regexp: new RegExp(g, o ? "" : "i"),
|
|
189
|
+
keys: u
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function p(e, t, n, r) {
|
|
193
|
+
for (; t < e.length;) {
|
|
194
|
+
let i = e[t++];
|
|
195
|
+
if (i.type === "group") {
|
|
196
|
+
let a = n.length;
|
|
197
|
+
p(i.tokens, 0, n, (n) => p(e, t, n, r)), n.length = a;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
n.push(i);
|
|
201
|
+
}
|
|
202
|
+
r(n);
|
|
203
|
+
}
|
|
204
|
+
function m(e, t, n, r) {
|
|
205
|
+
let i = "", o = "", c = "", l = 0, u = 0, d = 0;
|
|
206
|
+
function f(n, r) {
|
|
207
|
+
for (; n < e.length;) {
|
|
208
|
+
let i = e[n++];
|
|
209
|
+
if (i.type === r) return !0;
|
|
210
|
+
if (i.type === "text" && i.value.includes(t)) break;
|
|
211
|
+
}
|
|
212
|
+
return !1;
|
|
213
|
+
}
|
|
214
|
+
function p(t) {
|
|
215
|
+
let n = "";
|
|
216
|
+
for (; t < e.length;) {
|
|
217
|
+
let r = e[t++];
|
|
218
|
+
if (r.type !== "text") break;
|
|
219
|
+
n += r.value;
|
|
220
|
+
}
|
|
221
|
+
return n;
|
|
222
|
+
}
|
|
223
|
+
for (; d < e.length;) {
|
|
224
|
+
let m = e[d++];
|
|
225
|
+
if (m.type === "text") {
|
|
226
|
+
i += a(m.value), o += m.value, l === 2 && (c += m.value), m.value.includes(t) && (u = 0);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
if (m.type === "param" || m.type === "wildcard") {
|
|
230
|
+
if (l && !o) throw new s(`Missing text before "${m.name}" ${m.type}`, r);
|
|
231
|
+
m.type === "param" ? (i += u & 2 ? `(${h(t, o)}+)` : f(d, "wildcard") ? `(${h(t, p(d))}+)` : u & 1 ? `(${h(t, o)}+|${a(o)})` : `(${h(t, "")}+)`, u |= l = 1) : (i += u & 2 ? `(${h(o, "")}+)` : c ? `(${h(c, "")}+|${h(t, "")}+)` : "([^]+)", c = "", u |= l = 2), n.push(m), o = "";
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
throw TypeError(`Unknown token type: ${m.type}`);
|
|
235
|
+
}
|
|
236
|
+
return i;
|
|
237
|
+
}
|
|
238
|
+
function h(e, t) {
|
|
239
|
+
return t.length > e.length ? h(t, e) : (e === t && (t = ""), t.length > 1 ? `(?:(?!${a(e)}|${a(t)})[^])` : e.length > 1 ? `(?:(?!${a(e)})[^${a(t)}])` : `[^${a(e + t)}]`);
|
|
240
|
+
}
|
|
241
|
+
})))(), k = n({
|
|
242
|
+
id: "",
|
|
243
|
+
isActive: !1,
|
|
244
|
+
isRoot: !0,
|
|
245
|
+
isPrev: !1,
|
|
246
|
+
zIndex: 0,
|
|
247
|
+
pathname: "",
|
|
248
|
+
params: {},
|
|
249
|
+
transitionName: "none",
|
|
250
|
+
prevTransitionName: "none",
|
|
251
|
+
layoutId: null,
|
|
252
|
+
routePath: ""
|
|
319
253
|
});
|
|
320
|
-
|
|
321
|
-
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/screen/useScreen.ts
|
|
256
|
+
function A() {
|
|
257
|
+
return r(k);
|
|
322
258
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/screen/ParamsProvider/ParamsContext.ts
|
|
261
|
+
var j = n({}), M = n(() => {});
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/screen/ParamsProvider/ParamsReducer.ts
|
|
264
|
+
function de(e, t) {
|
|
265
|
+
switch (t.type) {
|
|
266
|
+
case "SET": return t.params;
|
|
267
|
+
default: return e;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/screen/ParamsProvider/ParamsProvider.tsx
|
|
272
|
+
function fe({ children: e }) {
|
|
273
|
+
let { isActive: t, params: n } = A(), [r, a] = c(de, n);
|
|
274
|
+
return i(() => {
|
|
275
|
+
let e = async (e) => {
|
|
276
|
+
e.state?.step && await d.addTask(async () => {
|
|
277
|
+
a({
|
|
278
|
+
type: "SET",
|
|
279
|
+
params: e.state?.params || {}
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
return t && window.addEventListener("popstate", e), () => {
|
|
284
|
+
window.removeEventListener("popstate", e);
|
|
285
|
+
};
|
|
286
|
+
}, [t, a]), /* @__PURE__ */ T(M.Provider, {
|
|
287
|
+
value: a,
|
|
288
|
+
children: /* @__PURE__ */ T(j.Provider, {
|
|
289
|
+
value: r,
|
|
290
|
+
children: e
|
|
291
|
+
})
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
//#endregion
|
|
295
|
+
//#region ../../node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.17_react@19.2.7/node_modules/zustand/esm/vanilla.mjs
|
|
296
|
+
var N = (e) => {
|
|
297
|
+
let t, n = /* @__PURE__ */ new Set(), r = (e, r) => {
|
|
298
|
+
let i = typeof e == "function" ? e(t) : e;
|
|
299
|
+
if (!Object.is(i, t)) {
|
|
300
|
+
let e = t;
|
|
301
|
+
t = r ?? (typeof i != "object" || !i) ? i : Object.assign({}, t, i), n.forEach((n) => n(t, e));
|
|
302
|
+
}
|
|
303
|
+
}, i = () => t, a = {
|
|
304
|
+
setState: r,
|
|
305
|
+
getState: i,
|
|
306
|
+
getInitialState: () => o,
|
|
307
|
+
subscribe: (e) => (n.add(e), () => n.delete(e))
|
|
308
|
+
}, o = t = e(r, i, a);
|
|
309
|
+
return a;
|
|
310
|
+
}, pe = ((e) => e ? N(e) : N), me = (e) => e;
|
|
311
|
+
function P(t, n = me) {
|
|
312
|
+
let r = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), e.useCallback(() => n(t.getInitialState()), [t, n]));
|
|
313
|
+
return e.useDebugValue(r), r;
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/stores/useHistoryStore.ts
|
|
317
|
+
function F(e) {
|
|
318
|
+
return P(D().history, e);
|
|
327
319
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/renderer/Renderer.tsx
|
|
322
|
+
function he({ children: e }) {
|
|
323
|
+
let n = F((e) => e.index), r = F((e) => e.histories);
|
|
324
|
+
return r.map((n) => t.toArray(e).filter((e) => (0, O.pathToRegexp)(e.props.path).regexp.test(n.pathname))).map(([e], t) => /* @__PURE__ */ T(k.Provider, {
|
|
325
|
+
value: {
|
|
326
|
+
id: r[t].id,
|
|
327
|
+
isActive: t === n,
|
|
328
|
+
isRoot: t === 0,
|
|
329
|
+
isPrev: t < n - 1,
|
|
330
|
+
zIndex: t,
|
|
331
|
+
pathname: r[t].pathname,
|
|
332
|
+
params: r[t].params,
|
|
333
|
+
transitionName: r[n].transitionName,
|
|
334
|
+
prevTransitionName: r[n - 1]?.transitionName,
|
|
335
|
+
layoutId: r[t].layoutId,
|
|
336
|
+
routePath: ae(e.props.path, r[t].pathname)
|
|
337
|
+
},
|
|
338
|
+
children: /* @__PURE__ */ T(fe, { children: e })
|
|
339
|
+
}, r[t].id));
|
|
340
340
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
params: r[c].params,
|
|
360
|
-
transitionName: r[e].transitionName,
|
|
361
|
-
prevTransitionName: r[e - 1]?.transitionName,
|
|
362
|
-
layoutId: r[c].layoutId,
|
|
363
|
-
routePath: Ee(
|
|
364
|
-
a.props.path,
|
|
365
|
-
r[c].pathname
|
|
366
|
-
)
|
|
367
|
-
},
|
|
368
|
-
children: /* @__PURE__ */ k(Ae, { children: a })
|
|
369
|
-
},
|
|
370
|
-
r[c].id
|
|
371
|
-
));
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/screen/store.ts
|
|
343
|
+
function ge() {
|
|
344
|
+
return pe((e) => ({
|
|
345
|
+
dragStatus: "IDLE",
|
|
346
|
+
replaceTransitionStatus: "IDLE",
|
|
347
|
+
sharedBars: {},
|
|
348
|
+
setDragStatus: (t) => e({ dragStatus: t }),
|
|
349
|
+
setReplaceTransitionStatus: (t) => e({ replaceTransitionStatus: t }),
|
|
350
|
+
registerSharedBars: (t, n) => e((e) => ({ sharedBars: {
|
|
351
|
+
...e.sharedBars,
|
|
352
|
+
[t]: n
|
|
353
|
+
} })),
|
|
354
|
+
unregisterSharedBars: (t) => e((e) => {
|
|
355
|
+
let n = { ...e.sharedBars };
|
|
356
|
+
return delete n[t], { sharedBars: n };
|
|
357
|
+
})
|
|
358
|
+
}));
|
|
372
359
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/transition/styles.ts
|
|
362
|
+
var _e = "data-flemo", I = () => {
|
|
363
|
+
if (oe()) return;
|
|
364
|
+
let e = m(w.values(), ne.values()), t = document.head.querySelector(`style[${_e}]`);
|
|
365
|
+
t || (t = document.createElement("style"), t.setAttribute(_e, ""), document.head.appendChild(t)), t.textContent !== e && (t.textContent = e);
|
|
378
366
|
};
|
|
379
|
-
function
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
367
|
+
function L(e, t) {
|
|
368
|
+
o(() => {
|
|
369
|
+
for (let t of e) w.set(t.name, t);
|
|
370
|
+
for (let e of t) ne.set(e.name, e);
|
|
371
|
+
return I(), () => {
|
|
372
|
+
for (let t of e) w.delete(t.name);
|
|
373
|
+
for (let e of t) ne.delete(e.name);
|
|
374
|
+
I();
|
|
375
|
+
};
|
|
376
|
+
}, [e, t]);
|
|
389
377
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
},
|
|
426
|
-
"",
|
|
427
|
-
window.location.href
|
|
428
|
-
);
|
|
429
|
-
}, [r]), /* @__PURE__ */ Bt(ye, { children: [
|
|
430
|
-
/* @__PURE__ */ k(Le, {}),
|
|
431
|
-
/* @__PURE__ */ k($e, { children: n })
|
|
432
|
-
] });
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/Router.tsx
|
|
380
|
+
var R = [], z = [];
|
|
381
|
+
function B({ children: e, initPath: n = "/", defaultTransitionName: a = "cupertino", transitions: o = R, decorators: s = z }) {
|
|
382
|
+
let c = oe() ? n || "/" : window.location.pathname, l = oe() ? c.split("?")[1] || "" : window.location.search, d = r(E), [f] = u(() => {
|
|
383
|
+
let n = {
|
|
384
|
+
id: "root",
|
|
385
|
+
pathname: c,
|
|
386
|
+
params: x(t.toArray(e).map((e) => e.props.path).flat(), c, l),
|
|
387
|
+
transitionName: a,
|
|
388
|
+
layoutId: null
|
|
389
|
+
};
|
|
390
|
+
return d ? (d.history.getState().index === -1 && d.history.setState({
|
|
391
|
+
index: 0,
|
|
392
|
+
histories: [n]
|
|
393
|
+
}), d) : {
|
|
394
|
+
history: _([n], 0),
|
|
395
|
+
navigate: v(),
|
|
396
|
+
transition: b(a),
|
|
397
|
+
screen: ge()
|
|
398
|
+
};
|
|
399
|
+
});
|
|
400
|
+
return f.transition.setState({ defaultTransitionName: a }), L(o, s), i(() => {
|
|
401
|
+
window.history.state?.index || window.history.replaceState({
|
|
402
|
+
id: "root",
|
|
403
|
+
index: 0,
|
|
404
|
+
status: "IDLE",
|
|
405
|
+
params: {},
|
|
406
|
+
transitionName: a,
|
|
407
|
+
layoutId: null
|
|
408
|
+
}, "", window.location.href);
|
|
409
|
+
}, [a]), /* @__PURE__ */ ce(E.Provider, {
|
|
410
|
+
value: f,
|
|
411
|
+
children: [/* @__PURE__ */ T(ue, {}), /* @__PURE__ */ T(he, { children: e })]
|
|
412
|
+
});
|
|
433
413
|
}
|
|
434
|
-
|
|
435
|
-
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/Route.tsx
|
|
416
|
+
function V({ element: e }) {
|
|
417
|
+
return e;
|
|
436
418
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/utils/buildRoutePath.ts
|
|
421
|
+
function H(e, t) {
|
|
422
|
+
let n = t ?? {}, r = (0, O.compile)(e)(Object.fromEntries(Object.entries(n).map(([e, t]) => [e, String(t)]))), i = (typeof e == "string" ? (0, O.parse)(e) : e).tokens.filter((e) => e.type === "param").map((e) => e.name), a = Object.fromEntries(Object.entries(n).filter(([e]) => !i.includes(e))), o = new URLSearchParams(a).toString();
|
|
423
|
+
return {
|
|
424
|
+
pathname: `${r}${o ? `?${o}` : ""}`,
|
|
425
|
+
toPathname: r
|
|
426
|
+
};
|
|
444
427
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
},
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
e();
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/navigate/useNavigate.ts
|
|
430
|
+
var U = (e, t, n) => {
|
|
431
|
+
let { regexp: r } = (0, O.pathToRegexp)(e);
|
|
432
|
+
for (let e = t - 1; e >= 0; e--) if (r.test(n[e].pathname)) return t - e;
|
|
433
|
+
return -1;
|
|
434
|
+
}, ve = (e, t) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.trunc(e)) : t, W = async (e, t) => {
|
|
435
|
+
let n, r = new Promise((e) => {
|
|
436
|
+
n = () => e(!0), window.addEventListener("popstate", n, { once: !0 });
|
|
437
|
+
}), i = new Promise((e) => setTimeout(() => e(!1), 200));
|
|
438
|
+
if (S(), window.history.go(-e), !await Promise.race([r, i])) {
|
|
439
|
+
window.removeEventListener("popstate", n);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
t();
|
|
461
443
|
};
|
|
462
|
-
function
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
)).result?.();
|
|
604
|
-
};
|
|
605
|
-
return {
|
|
606
|
-
push: n,
|
|
607
|
-
replace: e,
|
|
608
|
-
pop: async (c) => {
|
|
609
|
-
await r((i, s) => {
|
|
610
|
-
if (c?.until != null) {
|
|
611
|
-
const P = Mt(c.until, i, s);
|
|
612
|
-
return P < 0 ? 0 : P;
|
|
613
|
-
}
|
|
614
|
-
const w = Ht(c?.skip, 1);
|
|
615
|
-
return w <= 0 ? 0 : Math.min(w, i);
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
};
|
|
444
|
+
function G() {
|
|
445
|
+
let e = D(), t = async (t, n, r) => {
|
|
446
|
+
let { status: i } = e.navigate.getState();
|
|
447
|
+
if (i !== "COMPLETED" && i !== "IDLE") return;
|
|
448
|
+
let a = e.transition.getState().defaultTransitionName, { transitionName: o = a, layoutId: s = null } = r ?? {}, c = d.generateTaskId();
|
|
449
|
+
(await d.addTask(async () => {
|
|
450
|
+
let { index: i, histories: a, addHistory: l, popHistories: u } = e.history.getState(), d = (() => {
|
|
451
|
+
if (r?.until != null) {
|
|
452
|
+
let e = U(r.until, i, a);
|
|
453
|
+
return e < 0 ? 0 : e;
|
|
454
|
+
}
|
|
455
|
+
return Math.min(ve(r?.skip, 0), Math.max(0, i));
|
|
456
|
+
})(), { setStatus: f, setTransitionTaskId: p } = e.navigate.getState();
|
|
457
|
+
f("PUSHING"), p(c);
|
|
458
|
+
let { pathname: m, toPathname: h } = H(t, n ?? {}), g = {
|
|
459
|
+
id: c,
|
|
460
|
+
pathname: h,
|
|
461
|
+
params: n ?? {},
|
|
462
|
+
transitionName: o,
|
|
463
|
+
layoutId: s
|
|
464
|
+
};
|
|
465
|
+
return d === 0 ? (window.history.pushState({
|
|
466
|
+
id: c,
|
|
467
|
+
index: i + 1,
|
|
468
|
+
status: "PUSHING",
|
|
469
|
+
params: n,
|
|
470
|
+
transitionName: o,
|
|
471
|
+
layoutId: s
|
|
472
|
+
}, "", m), l(g), () => {
|
|
473
|
+
f("COMPLETED");
|
|
474
|
+
}) : (l(g), await W(d, () => {
|
|
475
|
+
window.history.pushState({
|
|
476
|
+
id: c,
|
|
477
|
+
index: e.history.getState().index - d,
|
|
478
|
+
status: "PUSHING",
|
|
479
|
+
params: n,
|
|
480
|
+
transitionName: o,
|
|
481
|
+
layoutId: s
|
|
482
|
+
}, "", m);
|
|
483
|
+
}), async () => {
|
|
484
|
+
u(d), f("COMPLETED");
|
|
485
|
+
});
|
|
486
|
+
}, {
|
|
487
|
+
id: c,
|
|
488
|
+
control: { manual: !0 }
|
|
489
|
+
})).result?.();
|
|
490
|
+
}, n = async (t, n, r) => {
|
|
491
|
+
let { status: i } = e.navigate.getState();
|
|
492
|
+
if (i !== "COMPLETED" && i !== "IDLE") return;
|
|
493
|
+
let a = e.transition.getState().defaultTransitionName, { transitionName: o = a, layoutId: s = null } = r ?? {}, c = d.generateTaskId();
|
|
494
|
+
(await d.addTask(async (i) => {
|
|
495
|
+
let { index: a, histories: l, addHistory: u, replaceHistory: d, popHistories: f } = e.history.getState(), p = (() => {
|
|
496
|
+
if (r?.until != null) {
|
|
497
|
+
let e = U(r.until, a, l);
|
|
498
|
+
return e < 0 ? 0 : e + 1;
|
|
499
|
+
}
|
|
500
|
+
return Math.min(ve(r?.skip, 0) + 1, a + 1);
|
|
501
|
+
})();
|
|
502
|
+
if (p <= 0) {
|
|
503
|
+
i.abort();
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
let { setStatus: m, setTransitionTaskId: h } = e.navigate.getState();
|
|
507
|
+
m("REPLACING"), h(c);
|
|
508
|
+
let { pathname: g, toPathname: _ } = H(t, n ?? {}), v = {
|
|
509
|
+
id: c,
|
|
510
|
+
pathname: _,
|
|
511
|
+
params: n ?? {},
|
|
512
|
+
transitionName: o,
|
|
513
|
+
layoutId: s
|
|
514
|
+
};
|
|
515
|
+
return p === 1 ? (window.history.replaceState({
|
|
516
|
+
id: c,
|
|
517
|
+
index: a,
|
|
518
|
+
status: "REPLACING",
|
|
519
|
+
params: n,
|
|
520
|
+
transitionName: o,
|
|
521
|
+
layoutId: s
|
|
522
|
+
}, "", g), u(v), async () => {
|
|
523
|
+
d(a), m("COMPLETED");
|
|
524
|
+
}) : (f(p - 1), u(v), p <= a ? await W(p, () => {
|
|
525
|
+
window.history.pushState({
|
|
526
|
+
id: c,
|
|
527
|
+
index: e.history.getState().index - 1,
|
|
528
|
+
status: "REPLACING",
|
|
529
|
+
params: n,
|
|
530
|
+
transitionName: o,
|
|
531
|
+
layoutId: s
|
|
532
|
+
}, "", g);
|
|
533
|
+
}) : await W(a, () => {
|
|
534
|
+
window.history.replaceState({
|
|
535
|
+
id: c,
|
|
536
|
+
index: 0,
|
|
537
|
+
status: "REPLACING",
|
|
538
|
+
params: n,
|
|
539
|
+
transitionName: o,
|
|
540
|
+
layoutId: s
|
|
541
|
+
}, "", g);
|
|
542
|
+
}), async () => {
|
|
543
|
+
d(e.history.getState().index - 1), m("COMPLETED");
|
|
544
|
+
});
|
|
545
|
+
}, {
|
|
546
|
+
id: c,
|
|
547
|
+
control: { manual: !0 }
|
|
548
|
+
})).result?.();
|
|
549
|
+
}, r = async (t, n) => {
|
|
550
|
+
let r = d.generateTaskId();
|
|
551
|
+
(await d.addTask(async (i) => {
|
|
552
|
+
let { index: a, histories: o, popHistory: s, popHistories: c, setTransitionName: l } = e.history.getState();
|
|
553
|
+
if (a <= 0) {
|
|
554
|
+
i.abort();
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
let u = Math.min(t(a, o), a);
|
|
558
|
+
if (u <= 0) {
|
|
559
|
+
i.abort();
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
let { setStatus: d, setTransitionTaskId: f } = e.navigate.getState();
|
|
563
|
+
return n && l(a, n), d("POPPING"), f(r), c(u - 1), S(), u === 1 ? window.history.back() : window.history.go(-u), async () => {
|
|
564
|
+
s(e.history.getState().index), d("COMPLETED");
|
|
565
|
+
};
|
|
566
|
+
}, {
|
|
567
|
+
id: r,
|
|
568
|
+
control: { manual: !0 }
|
|
569
|
+
})).result?.();
|
|
570
|
+
};
|
|
571
|
+
return {
|
|
572
|
+
push: t,
|
|
573
|
+
replace: n,
|
|
574
|
+
pop: async (e) => {
|
|
575
|
+
await r((t, n) => {
|
|
576
|
+
if (e?.until != null) {
|
|
577
|
+
let r = U(e.until, t, n);
|
|
578
|
+
return r < 0 ? 0 : r;
|
|
579
|
+
}
|
|
580
|
+
let r = ve(e?.skip, 1);
|
|
581
|
+
return r <= 0 ? 0 : Math.min(r, t);
|
|
582
|
+
}, e?.transitionName);
|
|
583
|
+
}
|
|
584
|
+
};
|
|
619
585
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
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");
|
|
687
|
-
};
|
|
688
|
-
},
|
|
689
|
-
{
|
|
690
|
-
id: i,
|
|
691
|
-
control: {
|
|
692
|
-
manual: !0
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
)).result?.();
|
|
696
|
-
}
|
|
697
|
-
};
|
|
586
|
+
//#endregion
|
|
587
|
+
//#region src/navigate/useStep.ts
|
|
588
|
+
function ye() {
|
|
589
|
+
let { routePath: e } = A(), t = D(), n = r(M);
|
|
590
|
+
return {
|
|
591
|
+
pushStep: async (t) => {
|
|
592
|
+
(await d.addTask(async () => {
|
|
593
|
+
let { pathname: r } = H(e, t);
|
|
594
|
+
return window.history.state?.step || window.history.replaceState({
|
|
595
|
+
...window.history.state,
|
|
596
|
+
step: !0
|
|
597
|
+
}, "", window.location.pathname), window.history.pushState({
|
|
598
|
+
...window.history.state,
|
|
599
|
+
step: !0,
|
|
600
|
+
params: t
|
|
601
|
+
}, "", r), async () => n({
|
|
602
|
+
type: "SET",
|
|
603
|
+
params: t
|
|
604
|
+
});
|
|
605
|
+
})).result?.();
|
|
606
|
+
},
|
|
607
|
+
replaceStep: async (t) => {
|
|
608
|
+
(await d.addTask(async () => {
|
|
609
|
+
let { pathname: r } = H(e, t);
|
|
610
|
+
return window.history.replaceState({
|
|
611
|
+
...window.history.state,
|
|
612
|
+
step: !0,
|
|
613
|
+
params: t
|
|
614
|
+
}, "", r), async () => n({
|
|
615
|
+
type: "SET",
|
|
616
|
+
params: t
|
|
617
|
+
});
|
|
618
|
+
})).result?.();
|
|
619
|
+
},
|
|
620
|
+
popStep: async () => {
|
|
621
|
+
let e = d.generateTaskId();
|
|
622
|
+
(await d.addTask(async (r) => {
|
|
623
|
+
let i = new Promise((e) => {
|
|
624
|
+
window.addEventListener("popstate", (t) => e(t.state), { once: !0 });
|
|
625
|
+
}), a = new Promise((e) => setTimeout(() => e(void 0), 200));
|
|
626
|
+
S(), window.history.back();
|
|
627
|
+
let o = await Promise.race([i, a]);
|
|
628
|
+
if (!o) {
|
|
629
|
+
r.abort();
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
if (o.step) {
|
|
633
|
+
n({
|
|
634
|
+
type: "SET",
|
|
635
|
+
params: o.params ?? {}
|
|
636
|
+
}), r.abort();
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
let { setStatus: s, setTransitionTaskId: c } = t.navigate.getState(), { index: l, popHistory: u } = t.history.getState();
|
|
640
|
+
return s("POPPING"), c(e), async () => {
|
|
641
|
+
u(l), s("COMPLETED");
|
|
642
|
+
};
|
|
643
|
+
}, {
|
|
644
|
+
id: e,
|
|
645
|
+
control: { manual: !0 }
|
|
646
|
+
})).result?.();
|
|
647
|
+
}
|
|
648
|
+
};
|
|
698
649
|
}
|
|
699
|
-
|
|
700
|
-
|
|
650
|
+
//#endregion
|
|
651
|
+
//#region src/screen/ParamsProvider/useParams.ts
|
|
652
|
+
function be() {
|
|
653
|
+
return r(j);
|
|
701
654
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
children: r.current
|
|
711
|
-
}
|
|
712
|
-
);
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region src/screen/ScreenFreeze.tsx
|
|
657
|
+
function K({ freeze: e, children: t }) {
|
|
658
|
+
let n = l(t);
|
|
659
|
+
return e || (n.current = t), /* @__PURE__ */ T("div", {
|
|
660
|
+
style: { display: e ? "none" : void 0 },
|
|
661
|
+
children: n.current
|
|
662
|
+
});
|
|
713
663
|
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
return f ? /* @__PURE__ */ k(
|
|
719
|
-
"div",
|
|
720
|
-
{
|
|
721
|
-
ref: i,
|
|
722
|
-
"data-flemo-decorator": !0,
|
|
723
|
-
"data-flemo-decorator-name": f.name,
|
|
724
|
-
"data-flemo-status": s,
|
|
725
|
-
"data-flemo-active": a ? "true" : "false",
|
|
726
|
-
style: {
|
|
727
|
-
position: "absolute",
|
|
728
|
-
top: 0,
|
|
729
|
-
left: 0,
|
|
730
|
-
width: "100%",
|
|
731
|
-
height: "100%",
|
|
732
|
-
pointerEvents: "none",
|
|
733
|
-
zIndex: 1,
|
|
734
|
-
...e
|
|
735
|
-
},
|
|
736
|
-
...r
|
|
737
|
-
}
|
|
738
|
-
) : null;
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region src/stores/useNavigateStore.ts
|
|
666
|
+
function xe(e) {
|
|
667
|
+
return P(D().navigate, e);
|
|
739
668
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
669
|
+
//#endregion
|
|
670
|
+
//#region src/screen/ScreenDecorator.tsx
|
|
671
|
+
function Se({ ref: e, style: t, ...n }) {
|
|
672
|
+
let { isActive: r, transitionName: i } = A(), o = l(null);
|
|
673
|
+
a(e, () => o.current);
|
|
674
|
+
let s = xe((e) => e.status), { decoratorName: c } = w.get(i) ?? w.get("none"), u = ne.get(c);
|
|
675
|
+
return u ? /* @__PURE__ */ T("div", {
|
|
676
|
+
ref: o,
|
|
677
|
+
"data-flemo-decorator": !0,
|
|
678
|
+
"data-flemo-decorator-name": u.name,
|
|
679
|
+
"data-flemo-status": s,
|
|
680
|
+
"data-flemo-active": r ? "true" : "false",
|
|
681
|
+
style: {
|
|
682
|
+
position: "absolute",
|
|
683
|
+
top: 0,
|
|
684
|
+
left: 0,
|
|
685
|
+
width: "100%",
|
|
686
|
+
height: "100%",
|
|
687
|
+
pointerEvents: "none",
|
|
688
|
+
zIndex: 1,
|
|
689
|
+
...t
|
|
690
|
+
},
|
|
691
|
+
...n
|
|
692
|
+
}) : null;
|
|
758
693
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
cancelAnimationFrame(c), c = requestAnimationFrame(() => {
|
|
781
|
-
let s = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
|
|
782
|
-
s = s < 0 ? 0 : s;
|
|
783
|
-
let w = s - Gt;
|
|
784
|
-
w = w < 0 ? 0 : w, Gt || (Gt = s), a(w), e(s);
|
|
785
|
-
});
|
|
786
|
-
};
|
|
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);
|
|
789
|
-
};
|
|
790
|
-
}, []), { viewportScrollHeight: n, changedViewportScrollHeight: r };
|
|
694
|
+
//#endregion
|
|
695
|
+
//#region src/screen/useViewportScrollHeight.ts
|
|
696
|
+
var q = 0;
|
|
697
|
+
function Ce() {
|
|
698
|
+
let [e, t] = u(0), [n, r] = u(0);
|
|
699
|
+
return i(() => {
|
|
700
|
+
let e = 0, n = () => {
|
|
701
|
+
cancelAnimationFrame(e), e = requestAnimationFrame(() => {
|
|
702
|
+
let e = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
|
|
703
|
+
e = e < 0 ? 0 : e;
|
|
704
|
+
let n = e - q;
|
|
705
|
+
n = n < 0 ? 0 : n, q ||= e, r(n), t(e);
|
|
706
|
+
});
|
|
707
|
+
};
|
|
708
|
+
return window.visualViewport?.addEventListener("resize", n), window.visualViewport?.addEventListener("scroll", n), () => {
|
|
709
|
+
cancelAnimationFrame(e), window.visualViewport?.removeEventListener("resize", n), window.visualViewport?.removeEventListener("scroll", n);
|
|
710
|
+
};
|
|
711
|
+
}, []), {
|
|
712
|
+
viewportScrollHeight: e,
|
|
713
|
+
changedViewportScrollHeight: n
|
|
714
|
+
};
|
|
791
715
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
sharedAppBar: i,
|
|
837
|
-
sharedNavigationBar: s,
|
|
838
|
-
appBar: w,
|
|
839
|
-
navigationBar: P,
|
|
840
|
-
hideStatusBar: f,
|
|
841
|
-
hideSystemNavigationBar: T,
|
|
842
|
-
backgroundColor: p = "white",
|
|
843
|
-
contentScrollable: I = !0,
|
|
844
|
-
...L
|
|
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({
|
|
847
|
-
current: [],
|
|
848
|
-
prev: []
|
|
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({
|
|
850
|
-
element: null,
|
|
851
|
-
hasMarker: !1
|
|
852
|
-
}), it = N({ element: null, hasMarker: !1 }), kt = N(0), At = N(0), st = N(null), at = N(null), $t = (t) => {
|
|
853
|
-
const h = St.current;
|
|
854
|
-
return {
|
|
855
|
-
point: { x: t.clientX, y: t.clientY },
|
|
856
|
-
offset: {
|
|
857
|
-
x: t.clientX - Dt.current.x,
|
|
858
|
-
y: t.clientY - Dt.current.y
|
|
859
|
-
},
|
|
860
|
-
delta: { x: t.clientX - h.x, y: t.clientY - h.y },
|
|
861
|
-
velocity: Nt.current
|
|
862
|
-
};
|
|
863
|
-
}, ue = (t) => {
|
|
864
|
-
const h = t.timeStamp, E = Math.max(1, h - Lt.current), M = St.current;
|
|
865
|
-
Nt.current = {
|
|
866
|
-
x: (t.clientX - M.x) / E * 1e3,
|
|
867
|
-
y: (t.clientY - M.y) / E * 1e3
|
|
868
|
-
}, St.current = { x: t.clientX, y: t.clientY }, Lt.current = h;
|
|
869
|
-
}, Ct = (t, h, E) => {
|
|
870
|
-
const M = dt(t, h, E);
|
|
871
|
-
if (t === _.current)
|
|
872
|
-
for (const $ of Q.current.current)
|
|
873
|
-
dt($, h, E);
|
|
874
|
-
else if (t === tt.current)
|
|
875
|
-
for (const $ of Q.current.prev)
|
|
876
|
-
dt($, h, E);
|
|
877
|
-
return M;
|
|
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);
|
|
881
|
-
const q = [];
|
|
882
|
-
if (t) {
|
|
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);
|
|
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;
|
|
890
|
-
}, qt = () => {
|
|
891
|
-
for (const t of Q.current.current)
|
|
892
|
-
z(t), t.style.removeProperty("will-change");
|
|
893
|
-
for (const t of Q.current.prev)
|
|
894
|
-
z(t), t.style.removeProperty("will-change");
|
|
895
|
-
Q.current = { current: [], prev: [] };
|
|
896
|
-
}, vt = async (t) => {
|
|
897
|
-
if (!m || D > 10) return;
|
|
898
|
-
const h = _.current;
|
|
899
|
-
if (!h) return;
|
|
900
|
-
const E = Xt.current?.parentElement?.previousElementSibling;
|
|
901
|
-
if (tt.current = E?.querySelector("[data-flemo-screen]") ?? null, lt.current = E?.querySelector("[data-flemo-decorator]") ?? null, !tt.current) return;
|
|
902
|
-
ot.current = !0, ce.current = t.timeStamp, Dt.current = { x: t.clientX, y: t.clientY }, St.current = { x: t.clientX, y: t.clientY }, Lt.current = t.timeStamp, Nt.current = { x: 0, y: 0 }, h.setPointerCapture(t.pointerId), le(E), await d?.onSwipeStart(t, $t(t), {
|
|
903
|
-
animate: Ct,
|
|
904
|
-
currentScreen: h,
|
|
905
|
-
prevScreen: tt.current,
|
|
906
|
-
onStart: ($) => S?.onSwipeStart?.($, {
|
|
907
|
-
animate: dt,
|
|
908
|
-
currentDecorator: K.current,
|
|
909
|
-
prevDecorator: lt.current
|
|
910
|
-
})
|
|
911
|
-
}) ? u("PENDING") : (u("IDLE"), ot.current = !1, qt());
|
|
912
|
-
}, de = (t) => {
|
|
913
|
-
!m || !ot.current || D > 10 || (ue(t), d.onSwipe(t, $t(t), {
|
|
914
|
-
animate: Ct,
|
|
915
|
-
currentScreen: _.current,
|
|
916
|
-
prevScreen: tt.current,
|
|
917
|
-
onProgress: (h, E) => S?.onSwipe?.(h, E, {
|
|
918
|
-
animate: dt,
|
|
919
|
-
currentDecorator: K.current,
|
|
920
|
-
prevDecorator: lt.current
|
|
921
|
-
})
|
|
922
|
-
}));
|
|
923
|
-
}, pe = async (t) => {
|
|
924
|
-
if (!m || !ot.current) return;
|
|
925
|
-
ot.current = !1;
|
|
926
|
-
const h = _.current;
|
|
927
|
-
h && h.hasPointerCapture(t.pointerId) && h.releasePointerCapture(t.pointerId);
|
|
928
|
-
const E = $t(t);
|
|
929
|
-
if (await d?.onSwipeEnd(t, E, {
|
|
930
|
-
animate: Ct,
|
|
931
|
-
currentScreen: _.current,
|
|
932
|
-
prevScreen: tt.current,
|
|
933
|
-
onStart: ($) => S?.onSwipeEnd?.($, {
|
|
934
|
-
animate: dt,
|
|
935
|
-
currentDecorator: K.current,
|
|
936
|
-
prevDecorator: lt.current
|
|
937
|
-
})
|
|
938
|
-
})) {
|
|
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");
|
|
944
|
-
Q.current = { current: [], prev: [] }, window.history.back();
|
|
945
|
-
} else
|
|
946
|
-
z(_.current), tt.current && z(tt.current), K.current && z(K.current), lt.current && z(lt.current), qt(), u("IDLE");
|
|
947
|
-
}, fe = (t) => {
|
|
948
|
-
if (!(!U && R && O === "COMPLETED" && o === "IDLE" && !!m && D < 10))
|
|
949
|
-
return;
|
|
950
|
-
nt.current = Jt(t.target, {
|
|
951
|
-
direction: "x",
|
|
952
|
-
verifyByScroll: !0
|
|
953
|
-
}), it.current = Jt(t.target, {
|
|
954
|
-
direction: "y",
|
|
955
|
-
verifyByScroll: !0
|
|
956
|
-
}), kt.current = t.clientX, At.current = t.clientY, (!nt.current.element && !it.current.element || nt.current.element || it.current.element) && (et.current = !0);
|
|
957
|
-
}, me = (t) => {
|
|
958
|
-
if (D > 10)
|
|
959
|
-
return;
|
|
960
|
-
if (ot.current) {
|
|
961
|
-
de(t.nativeEvent);
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
const h = !nt.current.element && !it.current.element;
|
|
965
|
-
if (et.current && h) {
|
|
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);
|
|
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));
|
|
972
|
-
}
|
|
973
|
-
}, zt = (t) => {
|
|
974
|
-
et.current = !1, ft.current = !1, ot.current && pe(t.nativeEvent);
|
|
975
|
-
};
|
|
976
|
-
wt(() => {
|
|
977
|
-
const t = _.current;
|
|
978
|
-
if (!t) return;
|
|
979
|
-
const h = (E) => {
|
|
980
|
-
ft.current && E.preventDefault(), E.target?.dataset.swipeAtEdgeBar === "true" && E.preventDefault();
|
|
981
|
-
};
|
|
982
|
-
return t.addEventListener("touchmove", h, {
|
|
983
|
-
passive: !1
|
|
984
|
-
}), () => {
|
|
985
|
-
t.removeEventListener("touchmove", h);
|
|
986
|
-
};
|
|
987
|
-
}, []), mt(() => {
|
|
988
|
-
if (!R) {
|
|
989
|
-
O === "REPLACING" && X !== A && y("PENDING");
|
|
990
|
-
return;
|
|
991
|
-
}
|
|
992
|
-
if (O === "COMPLETED") {
|
|
993
|
-
u("IDLE"), y("IDLE"), _.current && (z(_.current), _.current.removeAttribute(ht)), K.current && (z(K.current), K.current.removeAttribute(ht)), st.current && (z(st.current), st.current.style.removeProperty("will-change")), at.current && (z(at.current), at.current.style.removeProperty("will-change"));
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
if (O === "IDLE") return;
|
|
997
|
-
const t = _.current;
|
|
998
|
-
if (!t) return;
|
|
999
|
-
const h = () => {
|
|
1000
|
-
const W = pt.getState().transitionTaskId;
|
|
1001
|
-
W && V.resolveTask(W);
|
|
1002
|
-
}, E = `${O}-true`;
|
|
1003
|
-
if (!(!(t.getAttribute(ht) === "true") && Ie(d, E))) {
|
|
1004
|
-
queueMicrotask(h);
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
const ct = Re("screen", A, E), q = (W) => {
|
|
1008
|
-
W.target === t && W.animationName === ct && (t.removeEventListener("animationend", q), h());
|
|
1009
|
-
};
|
|
1010
|
-
return t.addEventListener("animationend", q), () => {
|
|
1011
|
-
t.removeEventListener("animationend", q);
|
|
1012
|
-
};
|
|
1013
|
-
}, [
|
|
1014
|
-
O,
|
|
1015
|
-
R,
|
|
1016
|
-
H,
|
|
1017
|
-
X,
|
|
1018
|
-
A,
|
|
1019
|
-
d,
|
|
1020
|
-
u,
|
|
1021
|
-
y
|
|
1022
|
-
]), mt(() => {
|
|
1023
|
-
const t = st.current;
|
|
1024
|
-
if (!t) {
|
|
1025
|
-
v(0);
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
|
-
v(t.offsetHeight);
|
|
1029
|
-
const h = new ResizeObserver(([E]) => {
|
|
1030
|
-
v(E.contentRect.height);
|
|
1031
|
-
});
|
|
1032
|
-
return h.observe(t), () => {
|
|
1033
|
-
h.disconnect();
|
|
1034
|
-
};
|
|
1035
|
-
}, [i]), mt(() => {
|
|
1036
|
-
const t = at.current;
|
|
1037
|
-
if (!t) {
|
|
1038
|
-
j(0);
|
|
1039
|
-
return;
|
|
1040
|
-
}
|
|
1041
|
-
j(t.offsetHeight);
|
|
1042
|
-
const h = new ResizeObserver(([E]) => {
|
|
1043
|
-
j(E.contentRect.height);
|
|
1044
|
-
});
|
|
1045
|
-
return h.observe(t), () => {
|
|
1046
|
-
h.disconnect();
|
|
1047
|
-
};
|
|
1048
|
-
}, [s]), mt(() => {
|
|
1049
|
-
const { registerSharedBars: t, unregisterSharedBars: h } = Z.getState();
|
|
1050
|
-
return t(H, {
|
|
1051
|
-
appBar: !!i,
|
|
1052
|
-
navigationBar: !!s
|
|
1053
|
-
}), () => h(H);
|
|
1054
|
-
}, [H, i, s]);
|
|
1055
|
-
const Kt = R || C === l - 1, Et = !!i, Pt = !!s;
|
|
1056
|
-
mt(() => {
|
|
1057
|
-
const t = st.current, h = at.current;
|
|
1058
|
-
if (!t && !h) return;
|
|
1059
|
-
const E = () => {
|
|
1060
|
-
if (!(pt.getState().status === "PUSHING" || pt.getState().status === "POPPING" || pt.getState().status === "REPLACING") || !Kt) {
|
|
1061
|
-
t?.removeAttribute("data-flemo-bar-riding"), h?.removeAttribute("data-flemo-bar-riding");
|
|
1062
|
-
return;
|
|
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");
|
|
1066
|
-
};
|
|
1067
|
-
E();
|
|
1068
|
-
const M = Z.subscribe(E), $ = pt.subscribe(E);
|
|
1069
|
-
return () => {
|
|
1070
|
-
M(), $(), t?.removeAttribute("data-flemo-bar-riding"), h?.removeAttribute("data-flemo-bar-riding");
|
|
1071
|
-
};
|
|
1072
|
-
}, [Kt, R, l, Et, Pt]);
|
|
1073
|
-
const he = (() => {
|
|
1074
|
-
if (!R) return {};
|
|
1075
|
-
if (O !== "PUSHING" && O !== "REPLACING") return {};
|
|
1076
|
-
const t = {};
|
|
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;
|
|
1078
|
-
})();
|
|
1079
|
-
return /* @__PURE__ */ Bt(
|
|
1080
|
-
"div",
|
|
1081
|
-
{
|
|
1082
|
-
ref: Xt,
|
|
1083
|
-
style: {
|
|
1084
|
-
position: "fixed",
|
|
1085
|
-
top: 0,
|
|
1086
|
-
left: 0,
|
|
1087
|
-
width: "100%",
|
|
1088
|
-
height: "100%",
|
|
1089
|
-
display: "flex",
|
|
1090
|
-
// `contain: layout style` keeps layout/style scoped without `paint`,
|
|
1091
|
-
// which would make this element the containing block for `position:
|
|
1092
|
-
// fixed` descendants and trap consumer overlays (e.g. bottom sheets)
|
|
1093
|
-
// inside the screen.
|
|
1094
|
-
contain: "layout style",
|
|
1095
|
-
flexDirection: "column",
|
|
1096
|
-
boxSizing: "border-box",
|
|
1097
|
-
overscrollBehavior: "contain"
|
|
1098
|
-
},
|
|
1099
|
-
children: [
|
|
1100
|
-
/* @__PURE__ */ k(
|
|
1101
|
-
"div",
|
|
1102
|
-
{
|
|
1103
|
-
"data-swipe-at-edge-bar": !0,
|
|
1104
|
-
style: {
|
|
1105
|
-
position: "fixed",
|
|
1106
|
-
top: 0,
|
|
1107
|
-
left: 0,
|
|
1108
|
-
width: 8,
|
|
1109
|
-
height: "100%",
|
|
1110
|
-
zIndex: 1
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
),
|
|
1114
|
-
/* @__PURE__ */ Bt(
|
|
1115
|
-
"div",
|
|
1116
|
-
{
|
|
1117
|
-
ref: _,
|
|
1118
|
-
...L,
|
|
1119
|
-
onPointerDown: fe,
|
|
1120
|
-
onPointerMove: me,
|
|
1121
|
-
onPointerUp: zt,
|
|
1122
|
-
onPointerCancel: zt,
|
|
1123
|
-
"data-flemo-screen": !0,
|
|
1124
|
-
"data-flemo-transition": A,
|
|
1125
|
-
"data-flemo-status": O,
|
|
1126
|
-
"data-flemo-active": R ? "true" : "false",
|
|
1127
|
-
style: {
|
|
1128
|
-
display: "flex",
|
|
1129
|
-
flexDirection: "column",
|
|
1130
|
-
height: "100%",
|
|
1131
|
-
backgroundColor: p,
|
|
1132
|
-
overflowY: I ? void 0 : "auto",
|
|
1133
|
-
touchAction: m === "x" ? "pan-y" : m === "y" ? "pan-x" : "auto",
|
|
1134
|
-
...he,
|
|
1135
|
-
...L.style
|
|
1136
|
-
},
|
|
1137
|
-
children: [
|
|
1138
|
-
!f && e && /* @__PURE__ */ k("div", { style: { minHeight: e }, children: /* @__PURE__ */ k(
|
|
1139
|
-
"div",
|
|
1140
|
-
{
|
|
1141
|
-
style: {
|
|
1142
|
-
position: "fixed",
|
|
1143
|
-
top: 0,
|
|
1144
|
-
width: "100%",
|
|
1145
|
-
minHeight: e,
|
|
1146
|
-
backgroundColor: r
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
) }),
|
|
1150
|
-
i && /* @__PURE__ */ k(
|
|
1151
|
-
"div",
|
|
1152
|
-
{
|
|
1153
|
-
style: {
|
|
1154
|
-
width: "100%",
|
|
1155
|
-
minHeight: Y
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
),
|
|
1159
|
-
w,
|
|
1160
|
-
/* @__PURE__ */ k(
|
|
1161
|
-
"div",
|
|
1162
|
-
{
|
|
1163
|
-
style: {
|
|
1164
|
-
display: "flex",
|
|
1165
|
-
flexDirection: "column",
|
|
1166
|
-
flexGrow: 1,
|
|
1167
|
-
overflowY: I ? "auto" : void 0
|
|
1168
|
-
},
|
|
1169
|
-
children: n
|
|
1170
|
-
}
|
|
1171
|
-
),
|
|
1172
|
-
P,
|
|
1173
|
-
s && /* @__PURE__ */ k(
|
|
1174
|
-
"div",
|
|
1175
|
-
{
|
|
1176
|
-
style: {
|
|
1177
|
-
display: b ? "none" : void 0,
|
|
1178
|
-
width: "100%",
|
|
1179
|
-
minHeight: B
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
),
|
|
1183
|
-
!T && a && /* @__PURE__ */ k(
|
|
1184
|
-
"div",
|
|
1185
|
-
{
|
|
1186
|
-
style: {
|
|
1187
|
-
display: b ? "none" : void 0,
|
|
1188
|
-
minHeight: a
|
|
1189
|
-
},
|
|
1190
|
-
children: /* @__PURE__ */ k(
|
|
1191
|
-
"div",
|
|
1192
|
-
{
|
|
1193
|
-
style: {
|
|
1194
|
-
position: "fixed",
|
|
1195
|
-
bottom: 0,
|
|
1196
|
-
width: "100%",
|
|
1197
|
-
minHeight: a,
|
|
1198
|
-
backgroundColor: c
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
)
|
|
1202
|
-
}
|
|
1203
|
-
)
|
|
1204
|
-
]
|
|
1205
|
-
}
|
|
1206
|
-
),
|
|
1207
|
-
i && /* @__PURE__ */ k(
|
|
1208
|
-
"div",
|
|
1209
|
-
{
|
|
1210
|
-
ref: st,
|
|
1211
|
-
"data-flemo-bar": "app",
|
|
1212
|
-
"data-flemo-bar-transition": A,
|
|
1213
|
-
"data-flemo-bar-status": O,
|
|
1214
|
-
"data-flemo-bar-active": R ? "true" : "false",
|
|
1215
|
-
style: {
|
|
1216
|
-
position: "fixed",
|
|
1217
|
-
top: f ? 0 : e,
|
|
1218
|
-
left: 0,
|
|
1219
|
-
width: "100%",
|
|
1220
|
-
zIndex: 1
|
|
1221
|
-
},
|
|
1222
|
-
children: i
|
|
1223
|
-
}
|
|
1224
|
-
),
|
|
1225
|
-
s && /* @__PURE__ */ k(
|
|
1226
|
-
"div",
|
|
1227
|
-
{
|
|
1228
|
-
ref: at,
|
|
1229
|
-
"data-flemo-bar": "nav",
|
|
1230
|
-
"data-flemo-bar-transition": A,
|
|
1231
|
-
"data-flemo-bar-status": O,
|
|
1232
|
-
"data-flemo-bar-active": R ? "true" : "false",
|
|
1233
|
-
style: {
|
|
1234
|
-
display: b ? "none" : void 0,
|
|
1235
|
-
position: "fixed",
|
|
1236
|
-
bottom: T ? 0 : a,
|
|
1237
|
-
left: 0,
|
|
1238
|
-
width: "100%",
|
|
1239
|
-
zIndex: 1
|
|
1240
|
-
},
|
|
1241
|
-
children: s
|
|
1242
|
-
}
|
|
1243
|
-
),
|
|
1244
|
-
S && /* @__PURE__ */ k(Ge, { ref: K }),
|
|
1245
|
-
/* @__PURE__ */ k(
|
|
1246
|
-
"div",
|
|
1247
|
-
{
|
|
1248
|
-
"data-swipe-at-edge-bar": !0,
|
|
1249
|
-
style: {
|
|
1250
|
-
position: "fixed",
|
|
1251
|
-
top: 0,
|
|
1252
|
-
right: 0,
|
|
1253
|
-
width: 8,
|
|
1254
|
-
height: "100%",
|
|
1255
|
-
zIndex: 1
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
)
|
|
1259
|
-
]
|
|
1260
|
-
}
|
|
1261
|
-
);
|
|
716
|
+
//#endregion
|
|
717
|
+
//#region src/transition/animateInline.ts
|
|
718
|
+
var we = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, J = /* @__PURE__ */ new WeakMap(), Y = (e, t) => {
|
|
719
|
+
let n = J.get(e);
|
|
720
|
+
n || (n = /* @__PURE__ */ new Set(), J.set(e, n)), n.add(t);
|
|
721
|
+
}, X = (e, t) => {
|
|
722
|
+
if (e.style.transition = "", t) {
|
|
723
|
+
let n = J.get(e);
|
|
724
|
+
for (let r of t) e.style.removeProperty(r), n?.delete(r);
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
let n = J.get(e);
|
|
728
|
+
if (n && n.size > 0) {
|
|
729
|
+
for (let t of n) e.style.removeProperty(t);
|
|
730
|
+
n.clear();
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
e.style.removeProperty("transform"), e.style.removeProperty("opacity");
|
|
734
|
+
}, Z = (e, t, n = {}) => {
|
|
735
|
+
if (!we(e)) return Promise.resolve();
|
|
736
|
+
let r = e, i = C(t);
|
|
737
|
+
if (i.length === 0) return Promise.resolve();
|
|
738
|
+
let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s = re(n.ease);
|
|
739
|
+
if (a <= 0 && o <= 0) {
|
|
740
|
+
r.style.transition = "none";
|
|
741
|
+
for (let e of i) r.style.setProperty(e.property, e.value), Y(r, e.property);
|
|
742
|
+
return Promise.resolve();
|
|
743
|
+
}
|
|
744
|
+
let c = i.map((e) => `${e.property} ${a}s ${s} ${o}s`).join(", ");
|
|
745
|
+
r.style.transition = c, r.offsetWidth;
|
|
746
|
+
for (let e of i) r.style.setProperty(e.property, e.value), Y(r, e.property);
|
|
747
|
+
return new Promise((e) => {
|
|
748
|
+
let t = !1, n = () => {
|
|
749
|
+
t || (t = !0, r.removeEventListener("transitionend", i), e());
|
|
750
|
+
}, i = (e) => {
|
|
751
|
+
e.target === r && n();
|
|
752
|
+
};
|
|
753
|
+
r.addEventListener("transitionend", i), setTimeout(n, (a + o) * 1e3 + 60);
|
|
754
|
+
});
|
|
755
|
+
};
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region src/stores/useScreenStore.ts
|
|
758
|
+
function Te(e) {
|
|
759
|
+
return P(D().screen, e);
|
|
1262
760
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
761
|
+
//#endregion
|
|
762
|
+
//#region src/screen/ScreenMotion.tsx
|
|
763
|
+
var Q = "data-flemo-skip-animation";
|
|
764
|
+
function $({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigationBarHeight: r, systemNavigationBarColor: a, sharedAppBar: o, sharedNavigationBar: c, appBar: m, navigationBar: h, hideStatusBar: g, hideSystemNavigationBar: _, backgroundColor: v = "white", contentScrollable: ee = !0, ...te }) {
|
|
765
|
+
let { id: y, isActive: b, isRoot: re, zIndex: ae, transitionName: x, prevTransitionName: oe } = A(), S = D(), C = xe((e) => e.status), le = Te((e) => e.dragStatus), E = S.screen.getState().setDragStatus, ue = S.screen.getState().setReplaceTransitionStatus, O = F((e) => e.index), k = w.get(x) ?? w.get("none"), { initial: j, swipeDirection: M, decoratorName: de } = k, fe = ne.get(de), { viewportScrollHeight: N } = Ce(), pe = N > 0, [me, P] = u(0), [he, ge] = u(0), _e = l(null), I = l(null), L = l(null), R = l(null), z = l(null), B = l({
|
|
766
|
+
current: [],
|
|
767
|
+
prev: []
|
|
768
|
+
}), V = l(!1), H = l(!1), U = l(!1), ve = l(0), W = l({
|
|
769
|
+
x: 0,
|
|
770
|
+
y: 0
|
|
771
|
+
}), G = l({
|
|
772
|
+
x: 0,
|
|
773
|
+
y: 0
|
|
774
|
+
}), ye = l(0), be = l({
|
|
775
|
+
x: 0,
|
|
776
|
+
y: 0
|
|
777
|
+
}), K = l({
|
|
778
|
+
element: null,
|
|
779
|
+
hasMarker: !1
|
|
780
|
+
}), q = l({
|
|
781
|
+
element: null,
|
|
782
|
+
hasMarker: !1
|
|
783
|
+
}), we = l(0), J = l(0), Y = l(null), $ = l(null), Ee = (e) => {
|
|
784
|
+
let t = G.current;
|
|
785
|
+
return {
|
|
786
|
+
point: {
|
|
787
|
+
x: e.clientX,
|
|
788
|
+
y: e.clientY
|
|
789
|
+
},
|
|
790
|
+
offset: {
|
|
791
|
+
x: e.clientX - W.current.x,
|
|
792
|
+
y: e.clientY - W.current.y
|
|
793
|
+
},
|
|
794
|
+
delta: {
|
|
795
|
+
x: e.clientX - t.x,
|
|
796
|
+
y: e.clientY - t.y
|
|
797
|
+
},
|
|
798
|
+
velocity: be.current
|
|
799
|
+
};
|
|
800
|
+
}, De = (e) => {
|
|
801
|
+
let t = e.timeStamp, n = Math.max(1, t - ye.current), r = G.current;
|
|
802
|
+
be.current = {
|
|
803
|
+
x: (e.clientX - r.x) / n * 1e3,
|
|
804
|
+
y: (e.clientY - r.y) / n * 1e3
|
|
805
|
+
}, G.current = {
|
|
806
|
+
x: e.clientX,
|
|
807
|
+
y: e.clientY
|
|
808
|
+
}, ye.current = t;
|
|
809
|
+
}, Oe = (e, t, n) => {
|
|
810
|
+
let r = Z(e, t, n);
|
|
811
|
+
if (e === I.current) for (let e of B.current.current) Z(e, t, n);
|
|
812
|
+
else if (e === L.current) for (let e of B.current.prev) Z(e, t, n);
|
|
813
|
+
return r;
|
|
814
|
+
}, ke = (e) => {
|
|
815
|
+
let t = b ? S.history.getState().histories[O - 1]?.id : S.history.getState().histories[O]?.id, n = t ? S.screen.getState().sharedBars[t] : void 0, r = [], i = Y.current, a = $.current;
|
|
816
|
+
i && Re && !n?.appBar && r.push(i), a && ze && !n?.navigationBar && r.push(a);
|
|
817
|
+
let o = [];
|
|
818
|
+
if (e) {
|
|
819
|
+
let t = e.querySelector("[data-flemo-bar=\"app\"]"), n = e.querySelector("[data-flemo-bar=\"nav\"]");
|
|
820
|
+
t && !Re && o.push(t), n && !ze && o.push(n);
|
|
821
|
+
}
|
|
822
|
+
B.current = {
|
|
823
|
+
current: r,
|
|
824
|
+
prev: o
|
|
825
|
+
};
|
|
826
|
+
let s = p(k).join(", ");
|
|
827
|
+
for (let e of r) e.style.willChange = s;
|
|
828
|
+
for (let e of o) e.style.willChange = s;
|
|
829
|
+
}, Ae = () => {
|
|
830
|
+
for (let e of B.current.current) X(e), e.style.removeProperty("will-change");
|
|
831
|
+
for (let e of B.current.prev) X(e), e.style.removeProperty("will-change");
|
|
832
|
+
B.current = {
|
|
833
|
+
current: [],
|
|
834
|
+
prev: []
|
|
835
|
+
};
|
|
836
|
+
}, je = async (e) => {
|
|
837
|
+
if (!M || N > 10) return;
|
|
838
|
+
let t = I.current;
|
|
839
|
+
if (!t) return;
|
|
840
|
+
let n = _e.current?.parentElement?.previousElementSibling;
|
|
841
|
+
L.current = n?.querySelector("[data-flemo-screen]") ?? null, z.current = n?.querySelector("[data-flemo-decorator]") ?? null, L.current && (U.current = !0, ve.current = e.timeStamp, W.current = {
|
|
842
|
+
x: e.clientX,
|
|
843
|
+
y: e.clientY
|
|
844
|
+
}, G.current = {
|
|
845
|
+
x: e.clientX,
|
|
846
|
+
y: e.clientY
|
|
847
|
+
}, ye.current = e.timeStamp, be.current = {
|
|
848
|
+
x: 0,
|
|
849
|
+
y: 0
|
|
850
|
+
}, t.setPointerCapture(e.pointerId), ke(n), await k?.onSwipeStart(e, Ee(e), {
|
|
851
|
+
animate: Oe,
|
|
852
|
+
currentScreen: t,
|
|
853
|
+
prevScreen: L.current,
|
|
854
|
+
onStart: (e) => fe?.onSwipeStart?.(e, {
|
|
855
|
+
animate: Z,
|
|
856
|
+
currentDecorator: R.current,
|
|
857
|
+
prevDecorator: z.current
|
|
858
|
+
})
|
|
859
|
+
}) ? E("PENDING") : (E("IDLE"), U.current = !1, Ae()));
|
|
860
|
+
}, Me = (e) => {
|
|
861
|
+
!M || !U.current || N > 10 || (De(e), k.onSwipe(e, Ee(e), {
|
|
862
|
+
animate: Oe,
|
|
863
|
+
currentScreen: I.current,
|
|
864
|
+
prevScreen: L.current,
|
|
865
|
+
onProgress: (e, t) => fe?.onSwipe?.(e, t, {
|
|
866
|
+
animate: Z,
|
|
867
|
+
currentDecorator: R.current,
|
|
868
|
+
prevDecorator: z.current
|
|
869
|
+
})
|
|
870
|
+
}));
|
|
871
|
+
}, Ne = async (e) => {
|
|
872
|
+
if (!M || !U.current) return;
|
|
873
|
+
U.current = !1;
|
|
874
|
+
let t = I.current;
|
|
875
|
+
t && t.hasPointerCapture(e.pointerId) && t.releasePointerCapture(e.pointerId);
|
|
876
|
+
let n = Ee(e);
|
|
877
|
+
if (await k?.onSwipeEnd(e, n, {
|
|
878
|
+
animate: Oe,
|
|
879
|
+
currentScreen: I.current,
|
|
880
|
+
prevScreen: L.current,
|
|
881
|
+
onStart: (e) => fe?.onSwipeEnd?.(e, {
|
|
882
|
+
animate: Z,
|
|
883
|
+
currentDecorator: R.current,
|
|
884
|
+
prevDecorator: z.current
|
|
885
|
+
})
|
|
886
|
+
})) {
|
|
887
|
+
I.current?.setAttribute(Q, "true"), R.current?.setAttribute(Q, "true");
|
|
888
|
+
for (let e of B.current.current) e.style.removeProperty("will-change");
|
|
889
|
+
for (let e of B.current.prev) X(e), e.style.removeProperty("will-change");
|
|
890
|
+
B.current = {
|
|
891
|
+
current: [],
|
|
892
|
+
prev: []
|
|
893
|
+
}, window.history.back();
|
|
894
|
+
} else X(I.current), L.current && X(L.current), R.current && X(R.current), z.current && X(z.current), Ae(), E("IDLE");
|
|
895
|
+
}, Pe = (e) => {
|
|
896
|
+
!re && b && C === "COMPLETED" && le === "IDLE" && M && N < 10 && (K.current = ie(e.target, {
|
|
897
|
+
direction: "x",
|
|
898
|
+
verifyByScroll: !0
|
|
899
|
+
}), q.current = ie(e.target, {
|
|
900
|
+
direction: "y",
|
|
901
|
+
verifyByScroll: !0
|
|
902
|
+
}), we.current = e.clientX, J.current = e.clientY, (!K.current.element && !q.current.element || K.current.element || q.current.element) && (V.current = !0));
|
|
903
|
+
}, Fe = (e) => {
|
|
904
|
+
if (N > 10) return;
|
|
905
|
+
if (U.current) {
|
|
906
|
+
Me(e.nativeEvent);
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
let t = !K.current.element && !q.current.element;
|
|
910
|
+
if (V.current && t) {
|
|
911
|
+
V.current = !1, H.current = !0;
|
|
912
|
+
let t = e.clientY - J.current, n = e.clientX - we.current;
|
|
913
|
+
(M === "y" && t > 0 || M === "x" && n > 0) && je(e.nativeEvent);
|
|
914
|
+
} else if (V.current && !t) {
|
|
915
|
+
let t = e.clientX - we.current, n = e.clientY - J.current, r = q.current.element && q.current.element.scrollTop <= 0, i = K.current.element && K.current.element.scrollLeft <= 0 && K.current.hasMarker;
|
|
916
|
+
(M === "y" && (r || K.current.element) && n > 0 && Math.abs(t) < 2 || M === "x" && (i || q.current.element) && t > 0 && Math.abs(n) < 2) && (V.current = !1, H.current = !0, je(e.nativeEvent));
|
|
917
|
+
}
|
|
918
|
+
}, Ie = (e) => {
|
|
919
|
+
V.current = !1, H.current = !1, U.current && Ne(e.nativeEvent);
|
|
920
|
+
};
|
|
921
|
+
i(() => {
|
|
922
|
+
let e = I.current;
|
|
923
|
+
if (!e) return;
|
|
924
|
+
let t = (e) => {
|
|
925
|
+
H.current && e.preventDefault(), e.target?.dataset.swipeAtEdgeBar === "true" && e.preventDefault();
|
|
926
|
+
};
|
|
927
|
+
return e.addEventListener("touchmove", t, { passive: !1 }), () => {
|
|
928
|
+
e.removeEventListener("touchmove", t);
|
|
929
|
+
};
|
|
930
|
+
}, []), s(() => {
|
|
931
|
+
if (!b) {
|
|
932
|
+
C === "REPLACING" && oe !== x && ue("PENDING");
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
if (C === "COMPLETED") {
|
|
936
|
+
E("IDLE"), ue("IDLE"), I.current && (X(I.current), I.current.removeAttribute(Q)), R.current && (X(R.current), R.current.removeAttribute(Q)), Y.current && (X(Y.current), Y.current.style.removeProperty("will-change")), $.current && (X($.current), $.current.style.removeProperty("will-change"));
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
if (C === "IDLE") return;
|
|
940
|
+
let e = I.current;
|
|
941
|
+
if (!e) return;
|
|
942
|
+
let t = () => {
|
|
943
|
+
let e = S.navigate.getState().transitionTaskId;
|
|
944
|
+
e && d.resolveTask(e);
|
|
945
|
+
}, n = `${C}-true`;
|
|
946
|
+
if (!(e.getAttribute(Q) !== "true" && se(k, n))) {
|
|
947
|
+
queueMicrotask(t);
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
let r = f("screen", x, n), i = (n) => {
|
|
951
|
+
n.target === e && n.animationName === r && (e.removeEventListener("animationend", i), t());
|
|
952
|
+
};
|
|
953
|
+
return e.addEventListener("animationend", i), () => {
|
|
954
|
+
e.removeEventListener("animationend", i);
|
|
955
|
+
};
|
|
956
|
+
}, [
|
|
957
|
+
C,
|
|
958
|
+
b,
|
|
959
|
+
y,
|
|
960
|
+
oe,
|
|
961
|
+
x,
|
|
962
|
+
k,
|
|
963
|
+
E,
|
|
964
|
+
ue,
|
|
965
|
+
S.navigate
|
|
966
|
+
]), s(() => {
|
|
967
|
+
let e = Y.current;
|
|
968
|
+
if (!e) {
|
|
969
|
+
P(0);
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
P(e.offsetHeight);
|
|
973
|
+
let t = new ResizeObserver(([e]) => {
|
|
974
|
+
P(e.contentRect.height);
|
|
975
|
+
});
|
|
976
|
+
return t.observe(e), () => {
|
|
977
|
+
t.disconnect();
|
|
978
|
+
};
|
|
979
|
+
}, [o]), s(() => {
|
|
980
|
+
let e = $.current;
|
|
981
|
+
if (!e) {
|
|
982
|
+
ge(0);
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
ge(e.offsetHeight);
|
|
986
|
+
let t = new ResizeObserver(([e]) => {
|
|
987
|
+
ge(e.contentRect.height);
|
|
988
|
+
});
|
|
989
|
+
return t.observe(e), () => {
|
|
990
|
+
t.disconnect();
|
|
991
|
+
};
|
|
992
|
+
}, [c]), s(() => {
|
|
993
|
+
let { registerSharedBars: e, unregisterSharedBars: t } = S.screen.getState();
|
|
994
|
+
return e(y, {
|
|
995
|
+
appBar: !!o,
|
|
996
|
+
navigationBar: !!c
|
|
997
|
+
}), () => t(y);
|
|
998
|
+
}, [
|
|
999
|
+
y,
|
|
1000
|
+
o,
|
|
1001
|
+
c,
|
|
1002
|
+
S.screen
|
|
1003
|
+
]);
|
|
1004
|
+
let Le = b || ae === O - 1, Re = !!o, ze = !!c;
|
|
1005
|
+
s(() => {
|
|
1006
|
+
let e = Y.current, t = $.current;
|
|
1007
|
+
if (!e && !t) return;
|
|
1008
|
+
let n = () => {
|
|
1009
|
+
if (!(S.navigate.getState().status === "PUSHING" || S.navigate.getState().status === "POPPING" || S.navigate.getState().status === "REPLACING") || !Le) {
|
|
1010
|
+
e?.removeAttribute("data-flemo-bar-riding"), t?.removeAttribute("data-flemo-bar-riding");
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
let n = b ? S.history.getState().histories[O - 1]?.id : S.history.getState().histories[O]?.id, r = n ? S.screen.getState().sharedBars[n] : void 0, i = Re && !r?.appBar, a = ze && !r?.navigationBar;
|
|
1014
|
+
e && e.setAttribute("data-flemo-bar-riding", i ? "true" : "false"), t && t.setAttribute("data-flemo-bar-riding", a ? "true" : "false");
|
|
1015
|
+
};
|
|
1016
|
+
n();
|
|
1017
|
+
let r = S.screen.subscribe(n), i = S.navigate.subscribe(n);
|
|
1018
|
+
return () => {
|
|
1019
|
+
r(), i(), e?.removeAttribute("data-flemo-bar-riding"), t?.removeAttribute("data-flemo-bar-riding");
|
|
1020
|
+
};
|
|
1021
|
+
}, [
|
|
1022
|
+
Le,
|
|
1023
|
+
b,
|
|
1024
|
+
O,
|
|
1025
|
+
Re,
|
|
1026
|
+
ze,
|
|
1027
|
+
S.history,
|
|
1028
|
+
S.navigate,
|
|
1029
|
+
S.screen
|
|
1030
|
+
]);
|
|
1031
|
+
let Be = (() => {
|
|
1032
|
+
if (!b || C !== "PUSHING" && C !== "REPLACING") return {};
|
|
1033
|
+
let e = {};
|
|
1034
|
+
return typeof j.x == "number" && (e.transform = `translateX(${j.x}px)`), typeof j.x == "string" && (e.transform = `translateX(${j.x})`), typeof j.y == "number" && (e.transform = `translateY(${j.y}px)`), typeof j.y == "string" && (e.transform = `translateY(${j.y})`), typeof j.opacity == "number" && (e.opacity = `${j.opacity}`), e;
|
|
1035
|
+
})();
|
|
1036
|
+
return /* @__PURE__ */ ce("div", {
|
|
1037
|
+
ref: _e,
|
|
1038
|
+
style: {
|
|
1039
|
+
position: "fixed",
|
|
1040
|
+
top: 0,
|
|
1041
|
+
left: 0,
|
|
1042
|
+
width: "100%",
|
|
1043
|
+
height: "100%",
|
|
1044
|
+
display: "flex",
|
|
1045
|
+
contain: "layout style",
|
|
1046
|
+
flexDirection: "column",
|
|
1047
|
+
boxSizing: "border-box",
|
|
1048
|
+
overscrollBehavior: "contain"
|
|
1049
|
+
},
|
|
1050
|
+
children: [
|
|
1051
|
+
/* @__PURE__ */ T("div", {
|
|
1052
|
+
"data-swipe-at-edge-bar": !0,
|
|
1053
|
+
style: {
|
|
1054
|
+
position: "fixed",
|
|
1055
|
+
top: 0,
|
|
1056
|
+
left: 0,
|
|
1057
|
+
width: 8,
|
|
1058
|
+
height: "100%",
|
|
1059
|
+
zIndex: 1
|
|
1060
|
+
}
|
|
1061
|
+
}),
|
|
1062
|
+
/* @__PURE__ */ ce("div", {
|
|
1063
|
+
ref: I,
|
|
1064
|
+
...te,
|
|
1065
|
+
onPointerDown: Pe,
|
|
1066
|
+
onPointerMove: Fe,
|
|
1067
|
+
onPointerUp: Ie,
|
|
1068
|
+
onPointerCancel: Ie,
|
|
1069
|
+
"data-flemo-screen": !0,
|
|
1070
|
+
"data-flemo-transition": x,
|
|
1071
|
+
"data-flemo-status": C,
|
|
1072
|
+
"data-flemo-active": b ? "true" : "false",
|
|
1073
|
+
style: {
|
|
1074
|
+
display: "flex",
|
|
1075
|
+
flexDirection: "column",
|
|
1076
|
+
height: "100%",
|
|
1077
|
+
backgroundColor: v,
|
|
1078
|
+
overflowY: ee ? void 0 : "auto",
|
|
1079
|
+
touchAction: M === "x" ? "pan-y" : M === "y" ? "pan-x" : "auto",
|
|
1080
|
+
...Be,
|
|
1081
|
+
...te.style
|
|
1082
|
+
},
|
|
1083
|
+
children: [
|
|
1084
|
+
!g && t && /* @__PURE__ */ T("div", {
|
|
1085
|
+
style: { minHeight: t },
|
|
1086
|
+
children: /* @__PURE__ */ T("div", { style: {
|
|
1087
|
+
position: "fixed",
|
|
1088
|
+
top: 0,
|
|
1089
|
+
width: "100%",
|
|
1090
|
+
minHeight: t,
|
|
1091
|
+
backgroundColor: n
|
|
1092
|
+
} })
|
|
1093
|
+
}),
|
|
1094
|
+
o && /* @__PURE__ */ T("div", { style: {
|
|
1095
|
+
width: "100%",
|
|
1096
|
+
minHeight: me
|
|
1097
|
+
} }),
|
|
1098
|
+
m,
|
|
1099
|
+
/* @__PURE__ */ T("div", {
|
|
1100
|
+
style: {
|
|
1101
|
+
display: "flex",
|
|
1102
|
+
flexDirection: "column",
|
|
1103
|
+
flexGrow: 1,
|
|
1104
|
+
overflowY: ee ? "auto" : void 0
|
|
1105
|
+
},
|
|
1106
|
+
children: e
|
|
1107
|
+
}),
|
|
1108
|
+
h,
|
|
1109
|
+
c && /* @__PURE__ */ T("div", { style: {
|
|
1110
|
+
display: pe ? "none" : void 0,
|
|
1111
|
+
width: "100%",
|
|
1112
|
+
minHeight: he
|
|
1113
|
+
} }),
|
|
1114
|
+
!_ && r && /* @__PURE__ */ T("div", {
|
|
1115
|
+
style: {
|
|
1116
|
+
display: pe ? "none" : void 0,
|
|
1117
|
+
minHeight: r
|
|
1118
|
+
},
|
|
1119
|
+
children: /* @__PURE__ */ T("div", { style: {
|
|
1120
|
+
position: "fixed",
|
|
1121
|
+
bottom: 0,
|
|
1122
|
+
width: "100%",
|
|
1123
|
+
minHeight: r,
|
|
1124
|
+
backgroundColor: a
|
|
1125
|
+
} })
|
|
1126
|
+
})
|
|
1127
|
+
]
|
|
1128
|
+
}),
|
|
1129
|
+
o && /* @__PURE__ */ T("div", {
|
|
1130
|
+
ref: Y,
|
|
1131
|
+
"data-flemo-bar": "app",
|
|
1132
|
+
"data-flemo-bar-transition": x,
|
|
1133
|
+
"data-flemo-bar-status": C,
|
|
1134
|
+
"data-flemo-bar-active": b ? "true" : "false",
|
|
1135
|
+
style: {
|
|
1136
|
+
position: "fixed",
|
|
1137
|
+
top: g ? 0 : t,
|
|
1138
|
+
left: 0,
|
|
1139
|
+
width: "100%",
|
|
1140
|
+
zIndex: 1
|
|
1141
|
+
},
|
|
1142
|
+
children: o
|
|
1143
|
+
}),
|
|
1144
|
+
c && /* @__PURE__ */ T("div", {
|
|
1145
|
+
ref: $,
|
|
1146
|
+
"data-flemo-bar": "nav",
|
|
1147
|
+
"data-flemo-bar-transition": x,
|
|
1148
|
+
"data-flemo-bar-status": C,
|
|
1149
|
+
"data-flemo-bar-active": b ? "true" : "false",
|
|
1150
|
+
style: {
|
|
1151
|
+
display: pe ? "none" : void 0,
|
|
1152
|
+
position: "fixed",
|
|
1153
|
+
bottom: _ ? 0 : r,
|
|
1154
|
+
left: 0,
|
|
1155
|
+
width: "100%",
|
|
1156
|
+
zIndex: 1
|
|
1157
|
+
},
|
|
1158
|
+
children: c
|
|
1159
|
+
}),
|
|
1160
|
+
fe && /* @__PURE__ */ T(Se, { ref: R }),
|
|
1161
|
+
/* @__PURE__ */ T("div", {
|
|
1162
|
+
"data-swipe-at-edge-bar": !0,
|
|
1163
|
+
style: {
|
|
1164
|
+
position: "fixed",
|
|
1165
|
+
top: 0,
|
|
1166
|
+
right: 0,
|
|
1167
|
+
width: 8,
|
|
1168
|
+
height: "100%",
|
|
1169
|
+
zIndex: 1
|
|
1170
|
+
}
|
|
1171
|
+
})
|
|
1172
|
+
]
|
|
1173
|
+
});
|
|
1266
1174
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1175
|
+
//#endregion
|
|
1176
|
+
//#region src/screen/Screen.tsx
|
|
1177
|
+
function Ee({ children: e, ...t }) {
|
|
1178
|
+
let { isActive: n, isPrev: r, zIndex: i } = A(), a = F((e) => e.index), o = xe((e) => e.status), s = Te((e) => e.dragStatus), c = Te((e) => e.replaceTransitionStatus);
|
|
1179
|
+
return /* @__PURE__ */ T(K, {
|
|
1180
|
+
freeze: !n && o === "COMPLETED" && s === "IDLE" || r && a - 2 <= i && c === "IDLE" || r && a - 2 > i,
|
|
1181
|
+
children: /* @__PURE__ */ T($, {
|
|
1182
|
+
...t,
|
|
1183
|
+
children: e
|
|
1184
|
+
})
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
//#endregion
|
|
1188
|
+
//#region src/stores/RouterScopeProvider.tsx
|
|
1189
|
+
function De({ children: e }) {
|
|
1190
|
+
let [t] = u(() => ({
|
|
1191
|
+
history: _(),
|
|
1192
|
+
navigate: v(),
|
|
1193
|
+
transition: b(),
|
|
1194
|
+
screen: ge()
|
|
1195
|
+
}));
|
|
1196
|
+
return /* @__PURE__ */ T(E.Provider, {
|
|
1197
|
+
value: t,
|
|
1198
|
+
children: e
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
//#endregion
|
|
1202
|
+
export { V as Route, B as Router, De as RouterScopeProvider, Ee as Screen, k as ScreenContext, Se as ScreenDecorator, K as ScreenFreeze, $ as ScreenMotion, g as createDecorator, ee as createRawDecorator, te as createRawTransition, y as createTransition, F as useHistoryStore, G as useNavigate, xe as useNavigateStore, be as useParams, A as useScreen, Te as useScreenStore, ye as useStep, D as useStores, Ce as useViewportScrollHeight };
|