@flemo/react 1.5.2 → 1.5.4
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 +270 -568
- package/dist/navigate/__tests__/useStepChrome.test.d.ts +1 -0
- package/dist/screen/__tests__/ScreenMotion.branches.test.d.ts +1 -0
- package/dist/stores/StoreContext.d.ts +2 -11
- package/dist/transition/styles.d.ts +1 -1
- package/dist/utils/buildRoutePath.d.ts +1 -1
- package/package.json +2 -2
- package/dist/screen/ParamsProvider/useParamsDispatch.d.ts +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import e, { Activity as t, Children as n, createContext as r, isValidElement as i, useContext as a, useEffect as o, useId as s, useImperativeHandle as c, useInsertionEffect as l, useLayoutEffect as u, useReducer as d, useRef as f, useState as p } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
//#region
|
|
6
|
-
var
|
|
2
|
+
import { animHoldKey as ee, appendParamsQuery as m, buildRoutePath as h, computeBarRiding as g, computeScreenFreeze as _, consumeSelfInducedPop as v, createBrowserHistoryDriver as y, createBrowserHistoryDriver as b, createDecorator as x, createHistoryStore as S, createHistorySync as C, createNavigateStore as te, createNavigationController as w, createPartTransition as T, createRawDecorator as E, createRawPartTransition as D, createRawTransition as O, createRouterScope as ne, createScreenSelector as re, createScreenStore as k, createStepController as A, createSwipeController as ie, createTransition as ae, createTransitionEngine as oe, createTransitionStore as se, decoratorMap as ce, ensureWindowHistoryState as le, enteringInitialStyle as ue, getMatchedPathPattern as de, isServer as j, markSelfInducedPop as fe, matchesPathname as pe, observeBarHeight as me, observeViewportScrollHeight as he, partTransitionMap as M, readStepParams as N, registerTransitionDefinitions as P, resolveTransition as ge, scheduleAnimHoldRelease as _e, subscribeStepParamsRestore as ve } from "@flemo/core";
|
|
3
|
+
import { jsx as F, jsxs as ye } from "react/jsx-runtime";
|
|
4
|
+
import { createPortal as be } from "react-dom";
|
|
5
|
+
//#region src/stores/StoreContext.ts
|
|
6
|
+
var I = r(null);
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/stores/useStores.ts
|
|
9
|
-
function
|
|
10
|
-
let e = a(
|
|
9
|
+
function L() {
|
|
10
|
+
let e = a(I);
|
|
11
11
|
if (!e) throw Error("flemo stores are missing. Render inside a <Router>.");
|
|
12
12
|
return e;
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/history/HistoryListener.tsx
|
|
16
|
-
function
|
|
17
|
-
let e =
|
|
16
|
+
function xe() {
|
|
17
|
+
let e = L();
|
|
18
18
|
return o(() => C({
|
|
19
19
|
stores: e,
|
|
20
20
|
driver: e.driver,
|
|
@@ -23,194 +23,7 @@ function V() {
|
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/screen/ScreenContext.ts
|
|
26
|
-
var
|
|
27
|
-
Object.defineProperty(e, "__esModule", { value: !0 }), e.PathError = e.TokenData = void 0, e.parse = c, e.compile = l, e.pathToRegexp = f;
|
|
28
|
-
var t = "/", n = (e) => e, r = /^[$_\p{ID_Start}]$/u, i = /^[$\u200c\u200d\p{ID_Continue}]$/u;
|
|
29
|
-
function a(e) {
|
|
30
|
-
return e.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
|
|
31
|
-
}
|
|
32
|
-
var o = class {
|
|
33
|
-
constructor(e, t) {
|
|
34
|
-
this.tokens = e, this.originalPath = t;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
e.TokenData = o;
|
|
38
|
-
var s = class extends TypeError {
|
|
39
|
-
constructor(e, t) {
|
|
40
|
-
let n = e;
|
|
41
|
-
t && (n += `: ${t}`), n += "; visit https://git.new/pathToRegexpError for info", super(n), this.originalPath = t;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
e.PathError = s;
|
|
45
|
-
function c(e, t = {}) {
|
|
46
|
-
let { encodePath: a = n } = t, c = [...e], l = 0;
|
|
47
|
-
function u(t) {
|
|
48
|
-
let n = [], o = "";
|
|
49
|
-
function d() {
|
|
50
|
-
o &&= (n.push({
|
|
51
|
-
type: "text",
|
|
52
|
-
value: a(o)
|
|
53
|
-
}), "");
|
|
54
|
-
}
|
|
55
|
-
for (; l < c.length;) {
|
|
56
|
-
let a = c[l++];
|
|
57
|
-
if (a === t) return d(), n;
|
|
58
|
-
if (a === "\\") {
|
|
59
|
-
if (l === c.length) throw new s(`Unexpected end after \\ at index ${l}`, e);
|
|
60
|
-
o += c[l++];
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
if (a === ":" || a === "*") {
|
|
64
|
-
let t = a === ":" ? "param" : "wildcard", o = "";
|
|
65
|
-
if (r.test(c[l])) do
|
|
66
|
-
o += c[l++];
|
|
67
|
-
while (i.test(c[l]));
|
|
68
|
-
else if (c[l] === "\"") {
|
|
69
|
-
let t = l;
|
|
70
|
-
for (; l < c.length;) {
|
|
71
|
-
if (c[++l] === "\"") {
|
|
72
|
-
l++, t = 0;
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
c[l] === "\\" && l++, o += c[l];
|
|
76
|
-
}
|
|
77
|
-
if (t) throw new s(`Unterminated quote at index ${t}`, e);
|
|
78
|
-
}
|
|
79
|
-
if (!o) throw new s(`Missing parameter name at index ${l}`, e);
|
|
80
|
-
d(), n.push({
|
|
81
|
-
type: t,
|
|
82
|
-
name: o
|
|
83
|
-
});
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (a === "{") {
|
|
87
|
-
d(), n.push({
|
|
88
|
-
type: "group",
|
|
89
|
-
tokens: u("}")
|
|
90
|
-
});
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
if (a === "}" || a === "(" || a === ")" || a === "[" || a === "]" || a === "+" || a === "?" || a === "!") throw new s(`Unexpected ${a} at index ${l - 1}`, e);
|
|
94
|
-
o += a;
|
|
95
|
-
}
|
|
96
|
-
if (t) throw new s(`Unexpected end at index ${l}, expected ${t}`, e);
|
|
97
|
-
return d(), n;
|
|
98
|
-
}
|
|
99
|
-
return new o(u(""), e);
|
|
100
|
-
}
|
|
101
|
-
function l(e, n = {}) {
|
|
102
|
-
let { encode: r = encodeURIComponent, delimiter: i = t } = n, a = u((typeof e == "object" ? e : c(e, n)).tokens, i, r);
|
|
103
|
-
return function(e = {}) {
|
|
104
|
-
let t = [], n = a(e, t);
|
|
105
|
-
if (t.length) throw TypeError(`Missing parameters: ${t.join(", ")}`);
|
|
106
|
-
return n;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function u(e, t, n) {
|
|
110
|
-
let r = e.map((e) => d(e, t, n));
|
|
111
|
-
return (e, t) => {
|
|
112
|
-
let n = "";
|
|
113
|
-
for (let i of r) n += i(e, t);
|
|
114
|
-
return n;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function d(e, t, r) {
|
|
118
|
-
if (e.type === "text") return () => e.value;
|
|
119
|
-
if (e.type === "group") {
|
|
120
|
-
let n = u(e.tokens, t, r);
|
|
121
|
-
return (e, t) => {
|
|
122
|
-
let r = t.length, i = n(e, t);
|
|
123
|
-
return t.length === r ? i : (t.length = r, "");
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
let i = r || n;
|
|
127
|
-
return e.type === "wildcard" && r !== !1 ? (n, r) => {
|
|
128
|
-
let a = n[e.name];
|
|
129
|
-
if (a == null) return r.push(e.name), "";
|
|
130
|
-
if (!Array.isArray(a) || a.length === 0) throw TypeError(`Expected "${e.name}" to be a non-empty array`);
|
|
131
|
-
let o = "";
|
|
132
|
-
for (let n = 0; n < a.length; n++) {
|
|
133
|
-
if (typeof a[n] != "string") throw TypeError(`Expected "${e.name}/${n}" to be a string`);
|
|
134
|
-
n > 0 && (o += t), o += i(a[n]);
|
|
135
|
-
}
|
|
136
|
-
return o;
|
|
137
|
-
} : (t, n) => {
|
|
138
|
-
let r = t[e.name];
|
|
139
|
-
if (r == null) return n.push(e.name), "";
|
|
140
|
-
if (typeof r != "string") throw TypeError(`Expected "${e.name}" to be a string`);
|
|
141
|
-
return i(r);
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function f(e, n = {}) {
|
|
145
|
-
let { delimiter: r = t, end: i = !0, sensitive: o = !1, trailing: l = !0 } = n, u = [], d = "", f = 0;
|
|
146
|
-
function h(e) {
|
|
147
|
-
if (Array.isArray(e)) {
|
|
148
|
-
for (let t of e) h(t);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
let t = typeof e == "object" ? e : c(e, n);
|
|
152
|
-
p(t.tokens, 0, [], (e) => {
|
|
153
|
-
if (f >= 256) throw new s("Too many path combinations", t.originalPath);
|
|
154
|
-
f > 0 && (d += "|"), d += m(e, r, u, t.originalPath), f++;
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
h(e);
|
|
158
|
-
let g = `^(?:${d})`;
|
|
159
|
-
return l && (g += "(?:" + a(r) + "$)?"), g += i ? "$" : "(?=" + a(r) + "|$)", {
|
|
160
|
-
regexp: new RegExp(g, o ? "" : "i"),
|
|
161
|
-
keys: u
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function p(e, t, n, r) {
|
|
165
|
-
for (; t < e.length;) {
|
|
166
|
-
let i = e[t++];
|
|
167
|
-
if (i.type === "group") {
|
|
168
|
-
let a = n.length;
|
|
169
|
-
p(i.tokens, 0, n, (n) => p(e, t, n, r)), n.length = a;
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
n.push(i);
|
|
173
|
-
}
|
|
174
|
-
r(n);
|
|
175
|
-
}
|
|
176
|
-
function m(e, t, n, r) {
|
|
177
|
-
let i = "", o = "", c = "", l = 0, u = 0, d = 0;
|
|
178
|
-
function f(n, r) {
|
|
179
|
-
for (; n < e.length;) {
|
|
180
|
-
let i = e[n++];
|
|
181
|
-
if (i.type === r) return !0;
|
|
182
|
-
if (i.type === "text" && i.value.includes(t)) break;
|
|
183
|
-
}
|
|
184
|
-
return !1;
|
|
185
|
-
}
|
|
186
|
-
function p(t) {
|
|
187
|
-
let n = "";
|
|
188
|
-
for (; t < e.length;) {
|
|
189
|
-
let r = e[t++];
|
|
190
|
-
if (r.type !== "text") break;
|
|
191
|
-
n += r.value;
|
|
192
|
-
}
|
|
193
|
-
return n;
|
|
194
|
-
}
|
|
195
|
-
for (; d < e.length;) {
|
|
196
|
-
let m = e[d++];
|
|
197
|
-
if (m.type === "text") {
|
|
198
|
-
i += a(m.value), o += m.value, l === 2 && (c += m.value), m.value.includes(t) && (u = 0);
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
if (m.type === "param" || m.type === "wildcard") {
|
|
202
|
-
if (l && !o) throw new s(`Missing text before "${m.name}" ${m.type}`, r);
|
|
203
|
-
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 = "";
|
|
204
|
-
continue;
|
|
205
|
-
}
|
|
206
|
-
throw TypeError(`Unknown token type: ${m.type}`);
|
|
207
|
-
}
|
|
208
|
-
return i;
|
|
209
|
-
}
|
|
210
|
-
function h(e, t) {
|
|
211
|
-
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)}]`);
|
|
212
|
-
}
|
|
213
|
-
})))(), H = r({
|
|
26
|
+
var R = r({
|
|
214
27
|
id: "",
|
|
215
28
|
isActive: !1,
|
|
216
29
|
isRoot: !0,
|
|
@@ -225,15 +38,15 @@ var me = (/* @__PURE__ */ pe(((e) => {
|
|
|
225
38
|
});
|
|
226
39
|
//#endregion
|
|
227
40
|
//#region src/screen/useScreen.ts
|
|
228
|
-
function
|
|
229
|
-
return a(
|
|
41
|
+
function z() {
|
|
42
|
+
return a(R);
|
|
230
43
|
}
|
|
231
44
|
//#endregion
|
|
232
45
|
//#region src/screen/ParamsProvider/ParamsContext.ts
|
|
233
|
-
var
|
|
46
|
+
var Se = r({}), B = r(() => {});
|
|
234
47
|
//#endregion
|
|
235
48
|
//#region src/screen/ParamsProvider/ParamsReducer.ts
|
|
236
|
-
function
|
|
49
|
+
function V(e, t) {
|
|
237
50
|
switch (t.type) {
|
|
238
51
|
case "SET": return t.params;
|
|
239
52
|
default: return e;
|
|
@@ -241,25 +54,20 @@ function _e(e, t) {
|
|
|
241
54
|
}
|
|
242
55
|
//#endregion
|
|
243
56
|
//#region src/screen/ParamsProvider/ParamsProvider.tsx
|
|
244
|
-
function
|
|
245
|
-
let { isActive: t, params: n } =
|
|
57
|
+
function H({ children: e }) {
|
|
58
|
+
let { isActive: t, params: n } = z(), { driver: r } = L(), [i, a] = d(V, n);
|
|
246
59
|
return o(() => {
|
|
247
|
-
if (t) return r
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
type: "SET",
|
|
252
|
-
params: t.params ?? {}
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
});
|
|
60
|
+
if (t) return ve(r, (e) => a({
|
|
61
|
+
type: "SET",
|
|
62
|
+
params: e
|
|
63
|
+
}));
|
|
256
64
|
}, [
|
|
257
65
|
t,
|
|
258
66
|
a,
|
|
259
67
|
r
|
|
260
|
-
]), /* @__PURE__ */
|
|
68
|
+
]), /* @__PURE__ */ F(B.Provider, {
|
|
261
69
|
value: a,
|
|
262
|
-
children: /* @__PURE__ */
|
|
70
|
+
children: /* @__PURE__ */ F(Se.Provider, {
|
|
263
71
|
value: i,
|
|
264
72
|
children: e
|
|
265
73
|
})
|
|
@@ -267,51 +75,41 @@ function W({ children: e }) {
|
|
|
267
75
|
}
|
|
268
76
|
//#endregion
|
|
269
77
|
//#region ../../node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.17_react@19.2.7/node_modules/zustand/esm/react.mjs
|
|
270
|
-
var
|
|
271
|
-
function
|
|
78
|
+
var U = (e) => e;
|
|
79
|
+
function W(t, n = U) {
|
|
272
80
|
let r = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), e.useCallback(() => n(t.getInitialState()), [t, n]));
|
|
273
81
|
return e.useDebugValue(r), r;
|
|
274
82
|
}
|
|
275
83
|
//#endregion
|
|
276
84
|
//#region src/stores/useHistoryStore.ts
|
|
277
|
-
function
|
|
278
|
-
return
|
|
85
|
+
function G(e) {
|
|
86
|
+
return W(L().history, e);
|
|
279
87
|
}
|
|
280
88
|
//#endregion
|
|
281
89
|
//#region src/renderer/Renderer.tsx
|
|
282
|
-
function
|
|
283
|
-
let t =
|
|
284
|
-
return
|
|
285
|
-
let [r] = n.toArray(e).filter((e) => (
|
|
286
|
-
return /* @__PURE__ */ R
|
|
90
|
+
function K({ children: e }) {
|
|
91
|
+
let t = G((e) => e.index);
|
|
92
|
+
return re(G((e) => e.histories), t).map((t) => {
|
|
93
|
+
let [r] = n.toArray(e).filter((e) => pe(e.props.path, t.pathname));
|
|
94
|
+
return /* @__PURE__ */ F(R.Provider, {
|
|
287
95
|
value: {
|
|
288
96
|
...t,
|
|
289
|
-
routePath:
|
|
97
|
+
routePath: de(r.props.path, t.pathname)
|
|
290
98
|
},
|
|
291
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ F(H, { children: r })
|
|
292
100
|
}, t.id);
|
|
293
101
|
});
|
|
294
102
|
}
|
|
295
103
|
//#endregion
|
|
296
104
|
//#region src/screen/ScreenViewportContext.ts
|
|
297
|
-
var
|
|
298
|
-
function
|
|
299
|
-
return a(
|
|
105
|
+
var q = r({ contained: !1 });
|
|
106
|
+
function Ce() {
|
|
107
|
+
return a(q);
|
|
300
108
|
}
|
|
301
109
|
//#endregion
|
|
302
110
|
//#region src/transition/styles.ts
|
|
303
|
-
function
|
|
304
|
-
l(() =>
|
|
305
|
-
for (let t of e) L.set(t.name, t);
|
|
306
|
-
for (let e of t) N.set(e.name, e);
|
|
307
|
-
for (let e of n) ce.set(e.name, e);
|
|
308
|
-
return g(), () => {
|
|
309
|
-
for (let t of e) L.delete(t.name);
|
|
310
|
-
for (let e of t) N.delete(e.name);
|
|
311
|
-
for (let e of n) ce.delete(e.name);
|
|
312
|
-
g();
|
|
313
|
-
};
|
|
314
|
-
}, [
|
|
111
|
+
function J(e, t, n = []) {
|
|
112
|
+
l(() => P(e, t, n), [
|
|
315
113
|
e,
|
|
316
114
|
t,
|
|
317
115
|
n
|
|
@@ -319,101 +117,80 @@ function be(e, t, n = []) {
|
|
|
319
117
|
}
|
|
320
118
|
//#endregion
|
|
321
119
|
//#region src/RouterDepthContext.ts
|
|
322
|
-
var
|
|
323
|
-
function
|
|
324
|
-
return /* @__PURE__ */
|
|
120
|
+
var we = r(0), Te = { contained: !0 };
|
|
121
|
+
function Y({ children: e, className: t, style: n }) {
|
|
122
|
+
return /* @__PURE__ */ F("div", {
|
|
325
123
|
className: t,
|
|
326
124
|
style: {
|
|
327
125
|
position: "relative",
|
|
328
126
|
overflow: "hidden",
|
|
329
127
|
...n
|
|
330
128
|
},
|
|
331
|
-
children: /* @__PURE__ */
|
|
332
|
-
value:
|
|
333
|
-
children: /* @__PURE__ */
|
|
129
|
+
children: /* @__PURE__ */ F(q.Provider, {
|
|
130
|
+
value: Te,
|
|
131
|
+
children: /* @__PURE__ */ F(K, { children: e })
|
|
334
132
|
})
|
|
335
133
|
});
|
|
336
134
|
}
|
|
337
135
|
//#endregion
|
|
338
136
|
//#region src/Router.tsx
|
|
339
|
-
function
|
|
137
|
+
function Ee(e) {
|
|
340
138
|
let t = null;
|
|
341
139
|
return n.forEach(e, (e) => {
|
|
342
140
|
if (t || !i(e)) return;
|
|
343
|
-
if (e.type ===
|
|
141
|
+
if (e.type === Y) {
|
|
344
142
|
t = n.toArray(e.props.children).filter(i);
|
|
345
143
|
return;
|
|
346
144
|
}
|
|
347
145
|
let r = e.props.children;
|
|
348
146
|
if (r) {
|
|
349
|
-
let e =
|
|
147
|
+
let e = Ee(r);
|
|
350
148
|
e && (t = e);
|
|
351
149
|
}
|
|
352
150
|
}), t;
|
|
353
151
|
}
|
|
354
|
-
var
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
id: t.id,
|
|
368
|
-
index: 0,
|
|
369
|
-
status: "IDLE",
|
|
370
|
-
params: t.params,
|
|
371
|
-
transitionName: t.transitionName,
|
|
372
|
-
layoutId: t.layoutId
|
|
373
|
-
},
|
|
374
|
-
url: t.pathname
|
|
375
|
-
}) : E, a = _ ? we : re();
|
|
376
|
-
return {
|
|
377
|
-
history: ee([t], 0),
|
|
378
|
-
navigate: ne(),
|
|
379
|
-
transition: ae(r),
|
|
380
|
-
screen: A(),
|
|
381
|
-
driver: i,
|
|
382
|
-
markSelfInduced: a.mark,
|
|
383
|
-
consume: a.consume
|
|
384
|
-
};
|
|
385
|
-
});
|
|
386
|
-
M.transition.setState({ defaultTransitionName: r }), be(i, c, l), o(() => {
|
|
387
|
-
_ || F() || (oe(w ? null : v, r, M.history.getState().histories[0]?.params ?? {}), g && !w && E && E.readPathname() !== j && E.replaceState(E.readState(), j));
|
|
152
|
+
var De = [], Oe = [], X = [], ke = { contained: !0 };
|
|
153
|
+
function Ae({ children: e, initPath: t = "/", defaultTransitionName: r = "cupertino", transitions: i = De, decorators: c = Oe, partTransitions: l = X, history: u = "browser", createDriver: d, className: f, style: ee }) {
|
|
154
|
+
let m = a(we), h = m > 0, g = u === "memory", _ = s(), v = Ee(e), y = v !== null, x = a(I), S = h ? null : x, C = S !== null, te = d ?? b, [w] = p(() => g ? null : te(C ? void 0 : _)), T = !h && !g && !j(), E = T && w ? w.readPathname() : t || "/", D = E.indexOf("?"), O = (D >= 0 ? E.slice(0, D) : E) || "/", re = T ? window.location.search : D >= 0 ? E.slice(D) : "", [k] = p(() => ne({
|
|
155
|
+
routePaths: (v ?? n.toArray(e)).map((e) => e.props.path).flat(),
|
|
156
|
+
pathname: O,
|
|
157
|
+
search: re,
|
|
158
|
+
defaultTransitionName: r,
|
|
159
|
+
memory: g,
|
|
160
|
+
browserDriver: w,
|
|
161
|
+
hostedScope: S
|
|
162
|
+
}));
|
|
163
|
+
k.transition.setState({ defaultTransitionName: r }), J(i, c, l), o(() => {
|
|
164
|
+
g || j() || (le(C ? null : _, r, k.history.getState().histories[0]?.params ?? {}), h && !C && w && w.readPathname() !== O && w.replaceState(w.readState(), O));
|
|
388
165
|
}, [
|
|
389
|
-
_,
|
|
390
|
-
w,
|
|
391
166
|
g,
|
|
392
|
-
|
|
393
|
-
|
|
167
|
+
C,
|
|
168
|
+
h,
|
|
169
|
+
_,
|
|
170
|
+
O,
|
|
394
171
|
r,
|
|
395
|
-
|
|
396
|
-
|
|
172
|
+
k.history,
|
|
173
|
+
w
|
|
397
174
|
]);
|
|
398
|
-
let
|
|
399
|
-
value:
|
|
400
|
-
children: /* @__PURE__ */
|
|
401
|
-
value:
|
|
402
|
-
children: [!
|
|
403
|
-
value:
|
|
404
|
-
children:
|
|
405
|
-
}) :
|
|
175
|
+
let A = y ? e : /* @__PURE__ */ F(K, { children: e }), ie = /* @__PURE__ */ F(we.Provider, {
|
|
176
|
+
value: m + 1,
|
|
177
|
+
children: /* @__PURE__ */ ye(I.Provider, {
|
|
178
|
+
value: k,
|
|
179
|
+
children: [!g && /* @__PURE__ */ F(xe, {}), h ? /* @__PURE__ */ F(q.Provider, {
|
|
180
|
+
value: ke,
|
|
181
|
+
children: A
|
|
182
|
+
}) : A]
|
|
406
183
|
})
|
|
407
184
|
});
|
|
408
|
-
return
|
|
185
|
+
return h ? /* @__PURE__ */ F("div", {
|
|
409
186
|
className: f,
|
|
410
187
|
style: {
|
|
411
188
|
position: "relative",
|
|
412
189
|
overflow: "hidden",
|
|
413
|
-
...
|
|
190
|
+
...ee
|
|
414
191
|
},
|
|
415
|
-
children:
|
|
416
|
-
}) :
|
|
192
|
+
children: ie
|
|
193
|
+
}) : ie;
|
|
417
194
|
}
|
|
418
195
|
//#endregion
|
|
419
196
|
//#region src/Route.tsx
|
|
@@ -422,28 +199,24 @@ function Z({ element: e }) {
|
|
|
422
199
|
}
|
|
423
200
|
//#endregion
|
|
424
201
|
//#region src/screen/LayerMountContext.ts
|
|
425
|
-
var
|
|
202
|
+
var je = r(null);
|
|
426
203
|
//#endregion
|
|
427
204
|
//#region src/screen/Layer.tsx
|
|
428
|
-
function
|
|
429
|
-
let t = a(
|
|
430
|
-
return t ?
|
|
205
|
+
function Me({ children: e }) {
|
|
206
|
+
let t = a(je);
|
|
207
|
+
return t ? be(e, t) : e;
|
|
431
208
|
}
|
|
432
209
|
//#endregion
|
|
433
210
|
//#region src/utils/buildRoutePath.ts
|
|
434
|
-
function
|
|
435
|
-
|
|
436
|
-
return {
|
|
437
|
-
pathname: `${r}${o ? `?${o}` : ""}`,
|
|
438
|
-
toPathname: r
|
|
439
|
-
};
|
|
211
|
+
function Ne(e, t) {
|
|
212
|
+
return h(e, t);
|
|
440
213
|
}
|
|
441
214
|
//#endregion
|
|
442
215
|
//#region src/navigate/useNavigate.ts
|
|
443
|
-
function
|
|
444
|
-
let e =
|
|
216
|
+
function Pe() {
|
|
217
|
+
let e = L(), t = w({
|
|
445
218
|
stores: e,
|
|
446
|
-
buildPathname: (e, t) =>
|
|
219
|
+
buildPathname: (e, t) => Ne(e, t),
|
|
447
220
|
driver: e.driver,
|
|
448
221
|
markSelfInduced: e.markSelfInduced
|
|
449
222
|
});
|
|
@@ -455,92 +228,44 @@ function Me() {
|
|
|
455
228
|
}
|
|
456
229
|
//#endregion
|
|
457
230
|
//#region src/navigate/usePathname.ts
|
|
458
|
-
function
|
|
459
|
-
return
|
|
231
|
+
function Fe() {
|
|
232
|
+
return G((e) => e.histories[e.pendingIndex]?.pathname ?? "/");
|
|
460
233
|
}
|
|
461
234
|
//#endregion
|
|
462
235
|
//#region src/navigate/useStep.ts
|
|
463
|
-
var Pe = (e) => {
|
|
464
|
-
let t = e;
|
|
465
|
-
return t?.step ? t.params ?? {} : null;
|
|
466
|
-
}, Fe = (e, t) => {
|
|
467
|
-
let n = new URLSearchParams(Object.fromEntries(Object.entries(t).map(([e, t]) => [e, String(t)]))).toString();
|
|
468
|
-
return n ? `${e}?${n}` : e;
|
|
469
|
-
};
|
|
470
236
|
function Ie() {
|
|
471
|
-
let { routePath: e } =
|
|
237
|
+
let { routePath: e } = z(), t = L(), n = a(B), { driver: r, markSelfInduced: i } = t, [s, c] = p(null);
|
|
472
238
|
o(() => {
|
|
473
|
-
if (!e) return c(
|
|
239
|
+
if (!e) return c(N(r.readState())), r.subscribe((e) => c(N(e.state)));
|
|
474
240
|
}, [e, r]);
|
|
475
|
-
let l = (
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
241
|
+
let l = A({
|
|
242
|
+
stores: t,
|
|
243
|
+
driver: r,
|
|
244
|
+
markSelfInduced: i,
|
|
245
|
+
buildStepPathname: (t) => e ? Ne(e, t).pathname : m(r.readPathname(), t),
|
|
246
|
+
applyParams: (t) => {
|
|
247
|
+
n({
|
|
248
|
+
type: "SET",
|
|
249
|
+
params: t
|
|
250
|
+
}), e || c(t);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
481
253
|
return {
|
|
482
254
|
step: s,
|
|
483
|
-
pushStep:
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
return n?.step || r.replaceState({
|
|
487
|
-
...n,
|
|
488
|
-
step: !0
|
|
489
|
-
}, r.readPathname()), r.pushState({
|
|
490
|
-
...r.readState(),
|
|
491
|
-
step: !0,
|
|
492
|
-
params: e
|
|
493
|
-
}, t), async () => u(e);
|
|
494
|
-
})).result?.();
|
|
495
|
-
},
|
|
496
|
-
replaceStep: async (e) => {
|
|
497
|
-
(await m.addTask(async () => {
|
|
498
|
-
let t = l(e);
|
|
499
|
-
return r.replaceState({
|
|
500
|
-
...r.readState(),
|
|
501
|
-
step: !0,
|
|
502
|
-
params: e
|
|
503
|
-
}, t), async () => u(e);
|
|
504
|
-
})).result?.();
|
|
505
|
-
},
|
|
506
|
-
popStep: async () => {
|
|
507
|
-
let e = m.generateTaskId();
|
|
508
|
-
(await m.addTask(async (n) => {
|
|
509
|
-
let a = new Promise((e) => {
|
|
510
|
-
let t = r.subscribe((n) => {
|
|
511
|
-
t(), e(n.state);
|
|
512
|
-
});
|
|
513
|
-
}), o = new Promise((e) => setTimeout(() => e(void 0), 200));
|
|
514
|
-
i(), r.back();
|
|
515
|
-
let s = await Promise.race([a, o]);
|
|
516
|
-
if (!s) {
|
|
517
|
-
n.abort();
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
if (s.step) {
|
|
521
|
-
u(s.params ?? {}), n.abort();
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
let { setStatus: c, setTransitionTaskId: l } = t.navigate.getState(), { index: d, popHistory: f } = t.history.getState();
|
|
525
|
-
return c("POPPING"), l(e), async () => {
|
|
526
|
-
f(d), c("COMPLETED");
|
|
527
|
-
};
|
|
528
|
-
}, {
|
|
529
|
-
id: e,
|
|
530
|
-
control: { manual: !0 }
|
|
531
|
-
})).result?.();
|
|
532
|
-
}
|
|
255
|
+
pushStep: (e) => l.pushStep(e),
|
|
256
|
+
replaceStep: (e) => l.replaceStep(e),
|
|
257
|
+
popStep: l.popStep
|
|
533
258
|
};
|
|
534
259
|
}
|
|
535
260
|
//#endregion
|
|
536
261
|
//#region src/screen/ParamsProvider/useParams.ts
|
|
537
262
|
function Le() {
|
|
538
|
-
return a(
|
|
263
|
+
return a(Se);
|
|
539
264
|
}
|
|
540
265
|
//#endregion
|
|
541
266
|
//#region src/screen/ScreenFreeze.tsx
|
|
542
267
|
function Re({ freeze: e, children: n }) {
|
|
543
|
-
return /* @__PURE__ */
|
|
268
|
+
return /* @__PURE__ */ F(t, {
|
|
544
269
|
mode: e ? "hidden" : "visible",
|
|
545
270
|
children: n
|
|
546
271
|
});
|
|
@@ -548,15 +273,15 @@ function Re({ freeze: e, children: n }) {
|
|
|
548
273
|
//#endregion
|
|
549
274
|
//#region src/stores/useNavigateStore.ts
|
|
550
275
|
function Q(e) {
|
|
551
|
-
return
|
|
276
|
+
return W(L().navigate, e);
|
|
552
277
|
}
|
|
553
278
|
//#endregion
|
|
554
279
|
//#region src/screen/ScreenDecorator.tsx
|
|
555
280
|
function ze({ ref: e, style: t, ...n }) {
|
|
556
|
-
let { isActive: r, transitionName: i } =
|
|
281
|
+
let { isActive: r, transitionName: i } = z(), a = f(null);
|
|
557
282
|
c(e, () => a.current);
|
|
558
|
-
let o = Q((e) => e.status), { decoratorName: s } =
|
|
559
|
-
return l ? /* @__PURE__ */
|
|
283
|
+
let o = Q((e) => e.status), { decoratorName: s } = ge(i), l = ce.get(s);
|
|
284
|
+
return l ? /* @__PURE__ */ F("div", {
|
|
560
285
|
ref: a,
|
|
561
286
|
"data-flemo-decorator": !0,
|
|
562
287
|
"data-flemo-decorator-name": l.name,
|
|
@@ -577,22 +302,11 @@ function ze({ ref: e, style: t, ...n }) {
|
|
|
577
302
|
}
|
|
578
303
|
//#endregion
|
|
579
304
|
//#region src/screen/useViewportScrollHeight.ts
|
|
580
|
-
|
|
581
|
-
function Ve() {
|
|
305
|
+
function Be() {
|
|
582
306
|
let [e, t] = p(0), [n, r] = p(0);
|
|
583
|
-
return o(() => {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
let e = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
|
|
587
|
-
e = e < 0 ? 0 : e;
|
|
588
|
-
let n = e - Be;
|
|
589
|
-
n = n < 0 ? 0 : n, Be ||= e, r(n), t(e);
|
|
590
|
-
});
|
|
591
|
-
};
|
|
592
|
-
return window.visualViewport?.addEventListener("resize", n), window.visualViewport?.addEventListener("scroll", n), () => {
|
|
593
|
-
cancelAnimationFrame(e), window.visualViewport?.removeEventListener("resize", n), window.visualViewport?.removeEventListener("scroll", n);
|
|
594
|
-
};
|
|
595
|
-
}, []), {
|
|
307
|
+
return o(() => he((e, n) => {
|
|
308
|
+
r(n), t(e);
|
|
309
|
+
}), []), {
|
|
596
310
|
viewportScrollHeight: e,
|
|
597
311
|
changedViewportScrollHeight: n
|
|
598
312
|
};
|
|
@@ -600,164 +314,152 @@ function Ve() {
|
|
|
600
314
|
//#endregion
|
|
601
315
|
//#region src/stores/useScreenStore.ts
|
|
602
316
|
function $(e) {
|
|
603
|
-
return
|
|
317
|
+
return W(L().screen, e);
|
|
604
318
|
}
|
|
605
319
|
//#endregion
|
|
606
320
|
//#region src/screen/ScreenMotion.tsx
|
|
607
|
-
function
|
|
608
|
-
let { id:
|
|
609
|
-
|
|
610
|
-
getTransitionTaskId: () =>
|
|
611
|
-
setDragStatus:
|
|
612
|
-
setReplaceTransitionStatus:
|
|
321
|
+
function Ve({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigationBarHeight: r, systemNavigationBarColor: i, sharedTopBar: a, sharedBottomBar: s, topBar: c, bottomBar: l, hideStatusBar: d, hideSystemNavigationBar: m, backgroundColor: h = "white", contentScrollable: _ = !0, ...v }) {
|
|
322
|
+
let { id: y, isActive: b, isRoot: x, zIndex: S, transitionName: C, prevTransitionName: te } = z(), { contained: w } = Ce(), T = w ? "absolute" : "fixed", E = L(), D = Q((e) => e.status), O = $((e) => e.dragStatus), ne = E.screen.getState().setDragStatus, re = E.screen.getState().setReplaceTransitionStatus, k = G((e) => e.index), A = G((e) => e.histories), ae = b ? A[k - 1]?.id : A[k]?.id, se = $((e) => ae ? e.sharedBars[ae] : void 0), le = f(null);
|
|
323
|
+
le.current ||= oe({
|
|
324
|
+
getTransitionTaskId: () => E.navigate.getState().transitionTaskId,
|
|
325
|
+
setDragStatus: ne,
|
|
326
|
+
setReplaceTransitionStatus: re
|
|
613
327
|
});
|
|
614
|
-
let
|
|
615
|
-
transition:
|
|
616
|
-
decorator:
|
|
328
|
+
let de = le.current, j = ge(C), { initial: fe, swipeDirection: pe, decoratorName: he } = j, M = ce.get(he), { viewportScrollHeight: N } = Be(), P = N > 0, [ve, be] = p(0), [I, xe] = p(0), [R, Se] = p(null), B = f(null), V = f(null), H = f(null), U = f(null), W = f(null), K = f({
|
|
329
|
+
transition: j,
|
|
330
|
+
decorator: M,
|
|
617
331
|
hasSharedTopBar: !!a,
|
|
618
332
|
hasSharedBottomBar: !!s,
|
|
619
|
-
viewportScrollHeight:
|
|
620
|
-
isRoot:
|
|
621
|
-
isActive:
|
|
622
|
-
status:
|
|
623
|
-
dragStatus:
|
|
624
|
-
index:
|
|
333
|
+
viewportScrollHeight: N,
|
|
334
|
+
isRoot: x,
|
|
335
|
+
isActive: b,
|
|
336
|
+
status: D,
|
|
337
|
+
dragStatus: O,
|
|
338
|
+
index: k
|
|
625
339
|
});
|
|
626
|
-
|
|
627
|
-
transition:
|
|
628
|
-
decorator:
|
|
340
|
+
K.current = {
|
|
341
|
+
transition: j,
|
|
342
|
+
decorator: M,
|
|
629
343
|
hasSharedTopBar: !!a,
|
|
630
344
|
hasSharedBottomBar: !!s,
|
|
631
|
-
viewportScrollHeight:
|
|
632
|
-
isRoot:
|
|
633
|
-
isActive:
|
|
634
|
-
status:
|
|
635
|
-
dragStatus:
|
|
636
|
-
index:
|
|
345
|
+
viewportScrollHeight: N,
|
|
346
|
+
isRoot: x,
|
|
347
|
+
isActive: b,
|
|
348
|
+
status: D,
|
|
349
|
+
dragStatus: O,
|
|
350
|
+
index: k
|
|
637
351
|
};
|
|
638
|
-
let
|
|
639
|
-
|
|
640
|
-
getTransition: () =>
|
|
641
|
-
getDecorator: () =>
|
|
352
|
+
let q = f(null);
|
|
353
|
+
q.current ||= ie({
|
|
354
|
+
getTransition: () => K.current.transition,
|
|
355
|
+
getDecorator: () => K.current.decorator,
|
|
642
356
|
getElements: () => ({
|
|
643
|
-
scope:
|
|
644
|
-
screenContainer:
|
|
645
|
-
decorator:
|
|
646
|
-
sharedTopBar:
|
|
647
|
-
sharedBottomBar:
|
|
357
|
+
scope: V.current,
|
|
358
|
+
screenContainer: B.current,
|
|
359
|
+
decorator: H.current,
|
|
360
|
+
sharedTopBar: U.current,
|
|
361
|
+
sharedBottomBar: W.current
|
|
648
362
|
}),
|
|
649
|
-
hasSharedTopBar: () =>
|
|
650
|
-
hasSharedBottomBar: () =>
|
|
651
|
-
getViewportScrollHeight: () =>
|
|
363
|
+
hasSharedTopBar: () => K.current.hasSharedTopBar,
|
|
364
|
+
hasSharedBottomBar: () => K.current.hasSharedBottomBar,
|
|
365
|
+
getViewportScrollHeight: () => K.current.viewportScrollHeight,
|
|
652
366
|
isReadyForDrag: () => {
|
|
653
|
-
let e =
|
|
367
|
+
let e = K.current;
|
|
654
368
|
return !e.isRoot && e.isActive && e.status === "COMPLETED" && e.dragStatus === "IDLE" && !!e.transition.swipeDirection && e.viewportScrollHeight < 10;
|
|
655
369
|
},
|
|
656
370
|
getPartnerBars: () => {
|
|
657
|
-
let e =
|
|
658
|
-
return n ?
|
|
371
|
+
let e = K.current, t = E.history.getState().histories, n = e.isActive ? t[e.index - 1]?.id : t[e.index]?.id;
|
|
372
|
+
return n ? E.screen.getState().sharedBars[n] : void 0;
|
|
659
373
|
},
|
|
660
|
-
setDragStatus:
|
|
374
|
+
setDragStatus: ne,
|
|
661
375
|
back: () => window.history.back()
|
|
662
376
|
});
|
|
663
|
-
let
|
|
377
|
+
let J = q.current, we = (e) => J.pointerDown(e.nativeEvent), Te = (e) => J.pointerMove(e.nativeEvent), Y = (e) => J.pointerUp(e.nativeEvent);
|
|
664
378
|
o(() => {
|
|
665
|
-
let e =
|
|
379
|
+
let e = V.current;
|
|
666
380
|
if (!e) return;
|
|
667
381
|
let t = (e) => {
|
|
668
|
-
|
|
382
|
+
J.shouldPreventTouch() && e.preventDefault(), e.target?.dataset.swipeAtEdgeBar === "true" && e.preventDefault();
|
|
669
383
|
};
|
|
670
384
|
return e.addEventListener("touchmove", t, { passive: !1 }), () => {
|
|
671
385
|
e.removeEventListener("touchmove", t);
|
|
672
386
|
};
|
|
673
|
-
}, [
|
|
387
|
+
}, [J]), u(() => de.driveScreenLifecycle({
|
|
674
388
|
getElements: () => ({
|
|
675
|
-
scope:
|
|
676
|
-
decorator:
|
|
677
|
-
bars: [
|
|
389
|
+
scope: V.current,
|
|
390
|
+
decorator: H.current,
|
|
391
|
+
bars: [U.current, W.current]
|
|
678
392
|
}),
|
|
679
393
|
transitionName: C,
|
|
680
394
|
prevTransitionName: te,
|
|
681
|
-
status:
|
|
682
|
-
isActive:
|
|
395
|
+
status: D,
|
|
396
|
+
isActive: b
|
|
683
397
|
}), [
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
398
|
+
de,
|
|
399
|
+
D,
|
|
400
|
+
b,
|
|
687
401
|
te,
|
|
688
402
|
C
|
|
689
403
|
]), u(() => {
|
|
690
|
-
let e =
|
|
404
|
+
let e = U.current;
|
|
691
405
|
if (!e) {
|
|
692
|
-
|
|
406
|
+
be(0);
|
|
693
407
|
return;
|
|
694
408
|
}
|
|
695
|
-
|
|
696
|
-
let t = new ResizeObserver(([e]) => {
|
|
697
|
-
e.contentRect.height > 0 && V(e.contentRect.height);
|
|
698
|
-
});
|
|
699
|
-
return t.observe(e), () => {
|
|
700
|
-
t.disconnect();
|
|
701
|
-
};
|
|
409
|
+
return me(e, be);
|
|
702
410
|
}, [a]), u(() => {
|
|
703
|
-
let e =
|
|
411
|
+
let e = W.current;
|
|
704
412
|
if (!e) {
|
|
705
|
-
|
|
413
|
+
xe(0);
|
|
706
414
|
return;
|
|
707
415
|
}
|
|
708
|
-
|
|
709
|
-
let t = new ResizeObserver(([e]) => {
|
|
710
|
-
e.contentRect.height > 0 && H(e.contentRect.height);
|
|
711
|
-
});
|
|
712
|
-
return t.observe(e), () => {
|
|
713
|
-
t.disconnect();
|
|
714
|
-
};
|
|
416
|
+
return me(e, xe);
|
|
715
417
|
}, [s]), u(() => {
|
|
716
|
-
let { registerSharedBars: e, unregisterSharedBars: t } =
|
|
717
|
-
return e(
|
|
418
|
+
let { registerSharedBars: e, unregisterSharedBars: t } = E.screen.getState();
|
|
419
|
+
return e(y, {
|
|
718
420
|
topBar: !!a,
|
|
719
421
|
bottomBar: !!s
|
|
720
|
-
}), () => t(
|
|
422
|
+
}), () => t(y);
|
|
721
423
|
}, [
|
|
722
|
-
|
|
424
|
+
y,
|
|
723
425
|
a,
|
|
724
426
|
s,
|
|
725
|
-
|
|
427
|
+
E.screen
|
|
726
428
|
]);
|
|
727
|
-
let
|
|
728
|
-
status:
|
|
729
|
-
isTopOrTopPrev:
|
|
429
|
+
let Ee = b || S === k - 1, { app: De, nav: Oe } = g({
|
|
430
|
+
status: D,
|
|
431
|
+
isTopOrTopPrev: Ee,
|
|
730
432
|
hasTopBar: !!a,
|
|
731
433
|
hasNavBar: !!s,
|
|
732
|
-
partnerBars:
|
|
733
|
-
}), X =
|
|
734
|
-
status:
|
|
735
|
-
isTopOrTopPrev:
|
|
434
|
+
partnerBars: se
|
|
435
|
+
}), X = ee({
|
|
436
|
+
status: D,
|
|
437
|
+
isTopOrTopPrev: Ee,
|
|
736
438
|
transitionName: C
|
|
737
|
-
}), [
|
|
439
|
+
}), [ke, Ae] = p({
|
|
738
440
|
key: X,
|
|
739
441
|
released: X === null
|
|
740
442
|
});
|
|
741
|
-
|
|
443
|
+
ke.key !== X && Ae({
|
|
742
444
|
key: X,
|
|
743
445
|
released: X === null
|
|
744
446
|
});
|
|
745
|
-
let Z = X !== null &&
|
|
447
|
+
let Z = X !== null && ke.key === X && !ke.released;
|
|
746
448
|
o(() => {
|
|
747
|
-
if (Z) return
|
|
449
|
+
if (Z) return _e(() => Ae((e) => e.key === X && !e.released ? {
|
|
748
450
|
key: X,
|
|
749
451
|
released: !0
|
|
750
452
|
} : e));
|
|
751
453
|
}, [Z, X]);
|
|
752
|
-
let
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
})
|
|
757
|
-
return /* @__PURE__ */
|
|
758
|
-
ref:
|
|
454
|
+
let Me = ue({
|
|
455
|
+
initial: fe,
|
|
456
|
+
isActive: b,
|
|
457
|
+
status: D
|
|
458
|
+
});
|
|
459
|
+
return /* @__PURE__ */ ye("div", {
|
|
460
|
+
ref: B,
|
|
759
461
|
style: {
|
|
760
|
-
position:
|
|
462
|
+
position: T,
|
|
761
463
|
top: 0,
|
|
762
464
|
left: 0,
|
|
763
465
|
width: "100%",
|
|
@@ -769,10 +471,10 @@ function He({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
769
471
|
overscrollBehavior: "contain"
|
|
770
472
|
},
|
|
771
473
|
children: [
|
|
772
|
-
/* @__PURE__ */
|
|
474
|
+
/* @__PURE__ */ F("div", {
|
|
773
475
|
"data-swipe-at-edge-bar": !0,
|
|
774
476
|
style: {
|
|
775
|
-
position:
|
|
477
|
+
position: T,
|
|
776
478
|
top: 0,
|
|
777
479
|
left: 0,
|
|
778
480
|
width: 8,
|
|
@@ -780,95 +482,95 @@ function He({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
780
482
|
zIndex: 1
|
|
781
483
|
}
|
|
782
484
|
}),
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
ref:
|
|
785
|
-
...
|
|
786
|
-
onPointerDown:
|
|
787
|
-
onPointerMove:
|
|
788
|
-
onPointerUp:
|
|
789
|
-
onPointerCancel:
|
|
485
|
+
/* @__PURE__ */ ye("div", {
|
|
486
|
+
ref: V,
|
|
487
|
+
...v,
|
|
488
|
+
onPointerDown: we,
|
|
489
|
+
onPointerMove: Te,
|
|
490
|
+
onPointerUp: Y,
|
|
491
|
+
onPointerCancel: Y,
|
|
790
492
|
"data-flemo-screen": !0,
|
|
791
493
|
"data-flemo-transition": C,
|
|
792
|
-
"data-flemo-status":
|
|
793
|
-
"data-flemo-active":
|
|
494
|
+
"data-flemo-status": D,
|
|
495
|
+
"data-flemo-active": b ? "true" : "false",
|
|
794
496
|
"data-flemo-anim-hold": Z ? "true" : "false",
|
|
795
497
|
style: {
|
|
796
498
|
display: "flex",
|
|
797
499
|
flexDirection: "column",
|
|
798
500
|
height: "100%",
|
|
799
|
-
backgroundColor:
|
|
800
|
-
overflowY:
|
|
801
|
-
touchAction:
|
|
802
|
-
...
|
|
803
|
-
...
|
|
501
|
+
backgroundColor: h,
|
|
502
|
+
overflowY: _ ? void 0 : "auto",
|
|
503
|
+
touchAction: pe === "x" ? "pan-y" : pe === "y" ? "pan-x" : "auto",
|
|
504
|
+
...Me,
|
|
505
|
+
...v.style
|
|
804
506
|
},
|
|
805
507
|
children: [
|
|
806
|
-
!d && t && /* @__PURE__ */
|
|
508
|
+
!d && t && /* @__PURE__ */ F("div", {
|
|
807
509
|
style: { minHeight: t },
|
|
808
|
-
children: /* @__PURE__ */
|
|
809
|
-
position:
|
|
510
|
+
children: /* @__PURE__ */ F("div", { style: {
|
|
511
|
+
position: T,
|
|
810
512
|
top: 0,
|
|
811
513
|
width: "100%",
|
|
812
514
|
minHeight: t,
|
|
813
515
|
backgroundColor: n
|
|
814
516
|
} })
|
|
815
517
|
}),
|
|
816
|
-
a && /* @__PURE__ */
|
|
518
|
+
a && /* @__PURE__ */ F("div", { style: {
|
|
817
519
|
width: "100%",
|
|
818
|
-
minHeight:
|
|
520
|
+
minHeight: ve
|
|
819
521
|
} }),
|
|
820
522
|
c,
|
|
821
|
-
/* @__PURE__ */
|
|
523
|
+
/* @__PURE__ */ F("div", {
|
|
822
524
|
style: {
|
|
823
525
|
display: "flex",
|
|
824
526
|
flexDirection: "column",
|
|
825
527
|
flexGrow: 1,
|
|
826
|
-
overflowY:
|
|
827
|
-
...
|
|
528
|
+
overflowY: _ ? "auto" : void 0,
|
|
529
|
+
...D !== "IDLE" && D !== "COMPLETED" ? {
|
|
828
530
|
transform: "translateZ(0)",
|
|
829
531
|
willChange: "transform"
|
|
830
532
|
} : null
|
|
831
533
|
},
|
|
832
|
-
children: /* @__PURE__ */
|
|
833
|
-
value:
|
|
534
|
+
children: /* @__PURE__ */ F(je.Provider, {
|
|
535
|
+
value: R,
|
|
834
536
|
children: e
|
|
835
537
|
})
|
|
836
538
|
}),
|
|
837
539
|
l,
|
|
838
|
-
s && /* @__PURE__ */
|
|
839
|
-
display:
|
|
540
|
+
s && /* @__PURE__ */ F("div", { style: {
|
|
541
|
+
display: P ? "none" : void 0,
|
|
840
542
|
width: "100%",
|
|
841
|
-
minHeight:
|
|
543
|
+
minHeight: I
|
|
842
544
|
} }),
|
|
843
|
-
!m && r && /* @__PURE__ */
|
|
545
|
+
!m && r && /* @__PURE__ */ F("div", {
|
|
844
546
|
style: {
|
|
845
|
-
display:
|
|
547
|
+
display: P ? "none" : void 0,
|
|
846
548
|
minHeight: r
|
|
847
549
|
},
|
|
848
|
-
children: /* @__PURE__ */
|
|
849
|
-
position:
|
|
550
|
+
children: /* @__PURE__ */ F("div", { style: {
|
|
551
|
+
position: T,
|
|
850
552
|
bottom: 0,
|
|
851
553
|
width: "100%",
|
|
852
554
|
minHeight: r,
|
|
853
555
|
backgroundColor: i
|
|
854
556
|
} })
|
|
855
557
|
}),
|
|
856
|
-
/* @__PURE__ */
|
|
857
|
-
ref:
|
|
558
|
+
/* @__PURE__ */ F("div", {
|
|
559
|
+
ref: Se,
|
|
858
560
|
"data-flemo-layer-mount": !0
|
|
859
561
|
})
|
|
860
562
|
]
|
|
861
563
|
}),
|
|
862
|
-
a && /* @__PURE__ */
|
|
863
|
-
ref:
|
|
564
|
+
a && /* @__PURE__ */ F("div", {
|
|
565
|
+
ref: U,
|
|
864
566
|
"data-flemo-bar": "app",
|
|
865
567
|
"data-flemo-bar-transition": C,
|
|
866
|
-
"data-flemo-bar-status":
|
|
867
|
-
"data-flemo-bar-active":
|
|
868
|
-
"data-flemo-bar-riding":
|
|
568
|
+
"data-flemo-bar-status": D,
|
|
569
|
+
"data-flemo-bar-active": b ? "true" : "false",
|
|
570
|
+
"data-flemo-bar-riding": De ? "true" : "false",
|
|
869
571
|
"data-flemo-anim-hold": Z ? "true" : "false",
|
|
870
572
|
style: {
|
|
871
|
-
position:
|
|
573
|
+
position: T,
|
|
872
574
|
top: d ? 0 : t,
|
|
873
575
|
left: 0,
|
|
874
576
|
width: "100%",
|
|
@@ -876,17 +578,17 @@ function He({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
876
578
|
},
|
|
877
579
|
children: a
|
|
878
580
|
}),
|
|
879
|
-
s && /* @__PURE__ */
|
|
880
|
-
ref:
|
|
581
|
+
s && /* @__PURE__ */ F("div", {
|
|
582
|
+
ref: W,
|
|
881
583
|
"data-flemo-bar": "nav",
|
|
882
584
|
"data-flemo-bar-transition": C,
|
|
883
|
-
"data-flemo-bar-status":
|
|
884
|
-
"data-flemo-bar-active":
|
|
885
|
-
"data-flemo-bar-riding":
|
|
585
|
+
"data-flemo-bar-status": D,
|
|
586
|
+
"data-flemo-bar-active": b ? "true" : "false",
|
|
587
|
+
"data-flemo-bar-riding": Oe ? "true" : "false",
|
|
886
588
|
"data-flemo-anim-hold": Z ? "true" : "false",
|
|
887
589
|
style: {
|
|
888
|
-
display:
|
|
889
|
-
position:
|
|
590
|
+
display: P ? "none" : void 0,
|
|
591
|
+
position: T,
|
|
890
592
|
bottom: m ? 0 : r,
|
|
891
593
|
left: 0,
|
|
892
594
|
width: "100%",
|
|
@@ -894,14 +596,14 @@ function He({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
894
596
|
},
|
|
895
597
|
children: s
|
|
896
598
|
}),
|
|
897
|
-
|
|
898
|
-
ref:
|
|
599
|
+
M && /* @__PURE__ */ F(ze, {
|
|
600
|
+
ref: H,
|
|
899
601
|
"data-flemo-anim-hold": Z ? "true" : "false"
|
|
900
602
|
}),
|
|
901
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ F("div", {
|
|
902
604
|
"data-swipe-at-edge-bar": !0,
|
|
903
605
|
style: {
|
|
904
|
-
position:
|
|
606
|
+
position: T,
|
|
905
607
|
top: 0,
|
|
906
608
|
right: 0,
|
|
907
609
|
width: 8,
|
|
@@ -914,19 +616,19 @@ function He({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
914
616
|
}
|
|
915
617
|
//#endregion
|
|
916
618
|
//#region src/screen/Screen.tsx
|
|
917
|
-
function
|
|
918
|
-
let { isActive: n, isPrev: r, zIndex: i } =
|
|
919
|
-
return /* @__PURE__ */
|
|
920
|
-
freeze:
|
|
619
|
+
function He({ children: e, ...t }) {
|
|
620
|
+
let { isActive: n, isPrev: r, zIndex: i } = z();
|
|
621
|
+
return /* @__PURE__ */ F(Re, {
|
|
622
|
+
freeze: _({
|
|
921
623
|
isActive: n,
|
|
922
624
|
isPrev: r,
|
|
923
625
|
zIndex: i,
|
|
924
|
-
index:
|
|
626
|
+
index: G((e) => e.index),
|
|
925
627
|
status: Q((e) => e.status),
|
|
926
628
|
dragStatus: $((e) => e.dragStatus),
|
|
927
629
|
replaceTransitionStatus: $((e) => e.replaceTransitionStatus)
|
|
928
630
|
}),
|
|
929
|
-
children: /* @__PURE__ */
|
|
631
|
+
children: /* @__PURE__ */ F(Ve, {
|
|
930
632
|
...t,
|
|
931
633
|
children: e
|
|
932
634
|
})
|
|
@@ -934,9 +636,9 @@ function Ue({ children: e, ...t }) {
|
|
|
934
636
|
}
|
|
935
637
|
//#endregion
|
|
936
638
|
//#region src/screen/Part.tsx
|
|
937
|
-
function
|
|
938
|
-
let { isActive: a } =
|
|
939
|
-
return /* @__PURE__ */
|
|
639
|
+
function Ue({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
640
|
+
let { isActive: a } = z();
|
|
641
|
+
return /* @__PURE__ */ F("div", {
|
|
940
642
|
ref: e,
|
|
941
643
|
"data-flemo-part-name": t,
|
|
942
644
|
"data-flemo-status": Q((e) => e.status),
|
|
@@ -948,20 +650,20 @@ function We({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
|
948
650
|
}
|
|
949
651
|
//#endregion
|
|
950
652
|
//#region src/stores/RouterScopeProvider.tsx
|
|
951
|
-
function
|
|
653
|
+
function We({ children: e }) {
|
|
952
654
|
let [t] = p(() => ({
|
|
953
|
-
history:
|
|
954
|
-
navigate:
|
|
955
|
-
transition:
|
|
956
|
-
screen:
|
|
957
|
-
driver:
|
|
958
|
-
markSelfInduced:
|
|
959
|
-
consume:
|
|
655
|
+
history: S(),
|
|
656
|
+
navigate: te(),
|
|
657
|
+
transition: se(),
|
|
658
|
+
screen: k(),
|
|
659
|
+
driver: b(),
|
|
660
|
+
markSelfInduced: fe,
|
|
661
|
+
consume: v
|
|
960
662
|
}));
|
|
961
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ F(I.Provider, {
|
|
962
664
|
value: t,
|
|
963
665
|
children: e
|
|
964
666
|
});
|
|
965
667
|
}
|
|
966
668
|
//#endregion
|
|
967
|
-
export {
|
|
669
|
+
export { Me as Layer, Ue as Part, Z as Route, Ae as Router, We as RouterScopeProvider, He as Screen, R as ScreenContext, ze as ScreenDecorator, Re as ScreenFreeze, Ve as ScreenMotion, Y as Slot, y as createBrowserHistoryDriver, x as createDecorator, T as createPartTransition, E as createRawDecorator, D as createRawPartTransition, O as createRawTransition, ae as createTransition, M as partTransitionMap, G as useHistoryStore, Pe as useNavigate, Q as useNavigateStore, Le as useParams, Fe as usePathname, z as useScreen, $ as useScreenStore, Ie as useStep, L as useStores, Be as useViewportScrollHeight };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export interface FlemoStores {
|
|
4
|
-
history: HistoryStoreApi;
|
|
5
|
-
navigate: NavigateStoreApi;
|
|
6
|
-
transition: TransitionStoreApi;
|
|
7
|
-
screen: ScreenStoreApi;
|
|
8
|
-
driver: HistoryDriver;
|
|
9
|
-
markSelfInduced: () => void;
|
|
10
|
-
consume: () => boolean;
|
|
11
|
-
}
|
|
1
|
+
import { FlemoStores } from '@flemo/core';
|
|
2
|
+
export type { FlemoStores };
|
|
12
3
|
declare const StoreContext: import('react').Context<FlemoStores | null>;
|
|
13
4
|
export default StoreContext;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Decorator, PartTransition, Transition } from '@flemo/core';
|
|
2
2
|
export default function useTransitionStyles(transitions: Transition[], decorators: Decorator[], partTransitions?: PartTransition[]): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Path } from 'path-to-regexp';
|
|
2
1
|
import { RegisterRoute } from '../Route';
|
|
2
|
+
import { Path } from 'path-to-regexp';
|
|
3
3
|
export default function buildRoutePath<T extends keyof RegisterRoute>(path: Path, params: RegisterRoute[T]): {
|
|
4
4
|
pathname: string;
|
|
5
5
|
toPathname: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemo/react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "React bindings for flemo: Router, Route, Screen, and the screen-transition runtime.",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"path-to-regexp": "^8.4.2",
|
|
38
38
|
"zustand": "^5.0.14",
|
|
39
|
-
"@flemo/core": "1.
|
|
39
|
+
"@flemo/core": "1.9.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useParamsDispatch(): import('react').Dispatch<import('./ParamsDispatchContext').ParamsDispatchContextType>;
|