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