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