@flemo/react 1.5.2 → 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 +279 -572
- 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,20 +1,20 @@
|
|
|
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
|
|
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 =
|
|
16
|
+
function ye() {
|
|
17
|
+
let e = z();
|
|
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 be = 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 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 _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 } = 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 W({ 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 W({ 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) 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
|
-
}, [
|
|
116
|
+
function J(e, t, n = []) {
|
|
117
|
+
l(() => he(e, t, n), [
|
|
315
118
|
e,
|
|
316
119
|
t,
|
|
317
120
|
n
|
|
@@ -319,101 +122,80 @@ function be(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 = _ ? 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));
|
|
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
|
-
j,
|
|
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
|
|
@@ -422,28 +204,24 @@ function Z({ element: 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,92 +233,44 @@ function Me() {
|
|
|
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
|
-
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
241
|
function Ie() {
|
|
471
|
-
let { routePath: e } =
|
|
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
267
|
function Le() {
|
|
538
|
-
return a(
|
|
268
|
+
return a(xe);
|
|
539
269
|
}
|
|
540
270
|
//#endregion
|
|
541
271
|
//#region src/screen/ScreenFreeze.tsx
|
|
542
272
|
function Re({ freeze: e, children: n }) {
|
|
543
|
-
return /* @__PURE__ */
|
|
273
|
+
return /* @__PURE__ */ L(t, {
|
|
544
274
|
mode: e ? "hidden" : "visible",
|
|
545
275
|
children: n
|
|
546
276
|
});
|
|
@@ -548,15 +278,15 @@ function Re({ freeze: e, children: n }) {
|
|
|
548
278
|
//#endregion
|
|
549
279
|
//#region src/stores/useNavigateStore.ts
|
|
550
280
|
function Q(e) {
|
|
551
|
-
return
|
|
281
|
+
return W(z().navigate, e);
|
|
552
282
|
}
|
|
553
283
|
//#endregion
|
|
554
284
|
//#region src/screen/ScreenDecorator.tsx
|
|
555
285
|
function ze({ ref: e, style: t, ...n }) {
|
|
556
|
-
let { isActive: r, transitionName: i } =
|
|
286
|
+
let { isActive: r, transitionName: i } = B(), a = d(null);
|
|
557
287
|
c(e, () => a.current);
|
|
558
|
-
let o = Q((e) => e.status), { decoratorName: s } =
|
|
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,22 +307,11 @@ function ze({ 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 - 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
|
-
}, []), {
|
|
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
|
};
|
|
@@ -600,164 +319,152 @@ function Ve() {
|
|
|
600
319
|
//#endregion
|
|
601
320
|
//#region src/stores/useScreenStore.ts
|
|
602
321
|
function $(e) {
|
|
603
|
-
return
|
|
322
|
+
return W(z().screen, e);
|
|
604
323
|
}
|
|
605
324
|
//#endregion
|
|
606
325
|
//#region src/screen/ScreenMotion.tsx
|
|
607
|
-
function
|
|
608
|
-
let { id:
|
|
609
|
-
oe.current ||=
|
|
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:
|
|
620
|
-
isRoot:
|
|
621
|
-
isActive:
|
|
622
|
-
status:
|
|
623
|
-
dragStatus:
|
|
338
|
+
viewportScrollHeight: me,
|
|
339
|
+
isRoot: b,
|
|
340
|
+
isActive: y,
|
|
341
|
+
status: D,
|
|
342
|
+
dragStatus: O,
|
|
624
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:
|
|
632
|
-
isRoot:
|
|
633
|
-
isActive:
|
|
634
|
-
status:
|
|
635
|
-
dragStatus:
|
|
350
|
+
viewportScrollHeight: me,
|
|
351
|
+
isRoot: b,
|
|
352
|
+
isActive: y,
|
|
353
|
+
status: D,
|
|
354
|
+
dragStatus: O,
|
|
636
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:
|
|
682
|
-
isActive:
|
|
398
|
+
transitionName: S,
|
|
399
|
+
prevTransitionName: C,
|
|
400
|
+
status: D,
|
|
401
|
+
isActive: y
|
|
683
402
|
}), [
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
403
|
+
ce,
|
|
404
|
+
D,
|
|
405
|
+
y,
|
|
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 && V(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 && H(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 } =
|
|
717
|
-
return e(
|
|
423
|
+
let { registerSharedBars: e, unregisterSharedBars: t } = E.screen.getState();
|
|
424
|
+
return e(v, {
|
|
718
425
|
topBar: !!a,
|
|
719
426
|
bottomBar: !!s
|
|
720
|
-
}), () => t(
|
|
427
|
+
}), () => t(v);
|
|
721
428
|
}, [
|
|
722
|
-
|
|
429
|
+
v,
|
|
723
430
|
a,
|
|
724
431
|
s,
|
|
725
|
-
|
|
432
|
+
E.screen
|
|
726
433
|
]);
|
|
727
|
-
let
|
|
728
|
-
status:
|
|
729
|
-
isTopOrTopPrev:
|
|
434
|
+
let Ee = y || x === A - 1, { app: De, nav: Oe } = g({
|
|
435
|
+
status: D,
|
|
436
|
+
isTopOrTopPrev: Ee,
|
|
730
437
|
hasTopBar: !!a,
|
|
731
438
|
hasNavBar: !!s,
|
|
732
|
-
partnerBars:
|
|
733
|
-
}), X =
|
|
734
|
-
status:
|
|
735
|
-
isTopOrTopPrev:
|
|
736
|
-
transitionName:
|
|
737
|
-
}), [
|
|
439
|
+
partnerBars: ie
|
|
440
|
+
}), X = te({
|
|
441
|
+
status: D,
|
|
442
|
+
isTopOrTopPrev: Ee,
|
|
443
|
+
transitionName: S
|
|
444
|
+
}), [ke, Ae] = f({
|
|
738
445
|
key: X,
|
|
739
446
|
released: X === null
|
|
740
447
|
});
|
|
741
|
-
|
|
448
|
+
ke.key !== X && Ae({
|
|
742
449
|
key: X,
|
|
743
450
|
released: X === null
|
|
744
451
|
});
|
|
745
|
-
let Z = X !== null &&
|
|
452
|
+
let Z = X !== null && ke.key === X && !ke.released;
|
|
746
453
|
o(() => {
|
|
747
|
-
if (Z) return
|
|
454
|
+
if (Z) return ge(() => Ae((e) => e.key === X && !e.released ? {
|
|
748
455
|
key: X,
|
|
749
456
|
released: !0
|
|
750
457
|
} : e));
|
|
751
458
|
}, [Z, X]);
|
|
752
|
-
let
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
})
|
|
757
|
-
return /* @__PURE__ */
|
|
758
|
-
ref:
|
|
459
|
+
let Me = le({
|
|
460
|
+
initial: ue,
|
|
461
|
+
isActive: y,
|
|
462
|
+
status: D
|
|
463
|
+
});
|
|
464
|
+
return /* @__PURE__ */ _e("div", {
|
|
465
|
+
ref: Se,
|
|
759
466
|
style: {
|
|
760
|
-
position:
|
|
467
|
+
position: T,
|
|
761
468
|
top: 0,
|
|
762
469
|
left: 0,
|
|
763
470
|
width: "100%",
|
|
@@ -769,10 +476,10 @@ function He({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
769
476
|
overscrollBehavior: "contain"
|
|
770
477
|
},
|
|
771
478
|
children: [
|
|
772
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ L("div", {
|
|
773
480
|
"data-swipe-at-edge-bar": !0,
|
|
774
481
|
style: {
|
|
775
|
-
position:
|
|
482
|
+
position: T,
|
|
776
483
|
top: 0,
|
|
777
484
|
left: 0,
|
|
778
485
|
width: 8,
|
|
@@ -780,128 +487,128 @@ function He({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
780
487
|
zIndex: 1
|
|
781
488
|
}
|
|
782
489
|
}),
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
ref:
|
|
785
|
-
...
|
|
786
|
-
onPointerDown:
|
|
787
|
-
onPointerMove:
|
|
788
|
-
onPointerUp:
|
|
789
|
-
onPointerCancel:
|
|
490
|
+
/* @__PURE__ */ _e("div", {
|
|
491
|
+
ref: V,
|
|
492
|
+
..._,
|
|
493
|
+
onPointerDown: we,
|
|
494
|
+
onPointerMove: Te,
|
|
495
|
+
onPointerUp: Y,
|
|
496
|
+
onPointerCancel: Y,
|
|
790
497
|
"data-flemo-screen": !0,
|
|
791
|
-
"data-flemo-transition":
|
|
792
|
-
"data-flemo-status":
|
|
793
|
-
"data-flemo-active":
|
|
498
|
+
"data-flemo-transition": S,
|
|
499
|
+
"data-flemo-status": D,
|
|
500
|
+
"data-flemo-active": y ? "true" : "false",
|
|
794
501
|
"data-flemo-anim-hold": Z ? "true" : "false",
|
|
795
502
|
style: {
|
|
796
503
|
display: "flex",
|
|
797
504
|
flexDirection: "column",
|
|
798
505
|
height: "100%",
|
|
799
|
-
backgroundColor:
|
|
800
|
-
overflowY:
|
|
801
|
-
touchAction:
|
|
802
|
-
...
|
|
803
|
-
...
|
|
506
|
+
backgroundColor: m,
|
|
507
|
+
overflowY: h ? void 0 : "auto",
|
|
508
|
+
touchAction: de === "x" ? "pan-y" : de === "y" ? "pan-x" : "auto",
|
|
509
|
+
...Me,
|
|
510
|
+
..._.style
|
|
804
511
|
},
|
|
805
512
|
children: [
|
|
806
|
-
!
|
|
513
|
+
!ee && t && /* @__PURE__ */ L("div", {
|
|
807
514
|
style: { minHeight: t },
|
|
808
|
-
children: /* @__PURE__ */
|
|
809
|
-
position:
|
|
515
|
+
children: /* @__PURE__ */ L("div", { style: {
|
|
516
|
+
position: T,
|
|
810
517
|
top: 0,
|
|
811
518
|
width: "100%",
|
|
812
519
|
minHeight: t,
|
|
813
520
|
backgroundColor: n
|
|
814
521
|
} })
|
|
815
522
|
}),
|
|
816
|
-
a && /* @__PURE__ */
|
|
523
|
+
a && /* @__PURE__ */ L("div", { style: {
|
|
817
524
|
width: "100%",
|
|
818
|
-
minHeight:
|
|
525
|
+
minHeight: he
|
|
819
526
|
} }),
|
|
820
527
|
c,
|
|
821
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ L("div", {
|
|
822
529
|
style: {
|
|
823
530
|
display: "flex",
|
|
824
531
|
flexDirection: "column",
|
|
825
532
|
flexGrow: 1,
|
|
826
|
-
overflowY:
|
|
827
|
-
...
|
|
533
|
+
overflowY: h ? "auto" : void 0,
|
|
534
|
+
...D !== "IDLE" && D !== "COMPLETED" ? {
|
|
828
535
|
transform: "translateZ(0)",
|
|
829
536
|
willChange: "transform"
|
|
830
537
|
} : null
|
|
831
538
|
},
|
|
832
|
-
children: /* @__PURE__ */
|
|
833
|
-
value:
|
|
539
|
+
children: /* @__PURE__ */ L(je.Provider, {
|
|
540
|
+
value: be,
|
|
834
541
|
children: e
|
|
835
542
|
})
|
|
836
543
|
}),
|
|
837
544
|
l,
|
|
838
|
-
s && /* @__PURE__ */
|
|
839
|
-
display:
|
|
545
|
+
s && /* @__PURE__ */ L("div", { style: {
|
|
546
|
+
display: F ? "none" : void 0,
|
|
840
547
|
width: "100%",
|
|
841
|
-
minHeight:
|
|
548
|
+
minHeight: R
|
|
842
549
|
} }),
|
|
843
|
-
!
|
|
550
|
+
!p && r && /* @__PURE__ */ L("div", {
|
|
844
551
|
style: {
|
|
845
|
-
display:
|
|
552
|
+
display: F ? "none" : void 0,
|
|
846
553
|
minHeight: r
|
|
847
554
|
},
|
|
848
|
-
children: /* @__PURE__ */
|
|
849
|
-
position:
|
|
555
|
+
children: /* @__PURE__ */ L("div", { style: {
|
|
556
|
+
position: T,
|
|
850
557
|
bottom: 0,
|
|
851
558
|
width: "100%",
|
|
852
559
|
minHeight: r,
|
|
853
560
|
backgroundColor: i
|
|
854
561
|
} })
|
|
855
562
|
}),
|
|
856
|
-
/* @__PURE__ */
|
|
857
|
-
ref:
|
|
563
|
+
/* @__PURE__ */ L("div", {
|
|
564
|
+
ref: xe,
|
|
858
565
|
"data-flemo-layer-mount": !0
|
|
859
566
|
})
|
|
860
567
|
]
|
|
861
568
|
}),
|
|
862
|
-
a && /* @__PURE__ */
|
|
863
|
-
ref:
|
|
569
|
+
a && /* @__PURE__ */ L("div", {
|
|
570
|
+
ref: U,
|
|
864
571
|
"data-flemo-bar": "app",
|
|
865
|
-
"data-flemo-bar-transition":
|
|
866
|
-
"data-flemo-bar-status":
|
|
867
|
-
"data-flemo-bar-active":
|
|
868
|
-
"data-flemo-bar-riding":
|
|
572
|
+
"data-flemo-bar-transition": S,
|
|
573
|
+
"data-flemo-bar-status": D,
|
|
574
|
+
"data-flemo-bar-active": y ? "true" : "false",
|
|
575
|
+
"data-flemo-bar-riding": De ? "true" : "false",
|
|
869
576
|
"data-flemo-anim-hold": Z ? "true" : "false",
|
|
870
577
|
style: {
|
|
871
|
-
position:
|
|
872
|
-
top:
|
|
578
|
+
position: T,
|
|
579
|
+
top: ee ? 0 : t,
|
|
873
580
|
left: 0,
|
|
874
581
|
width: "100%",
|
|
875
582
|
zIndex: 1
|
|
876
583
|
},
|
|
877
584
|
children: a
|
|
878
585
|
}),
|
|
879
|
-
s && /* @__PURE__ */
|
|
880
|
-
ref:
|
|
586
|
+
s && /* @__PURE__ */ L("div", {
|
|
587
|
+
ref: W,
|
|
881
588
|
"data-flemo-bar": "nav",
|
|
882
|
-
"data-flemo-bar-transition":
|
|
883
|
-
"data-flemo-bar-status":
|
|
884
|
-
"data-flemo-bar-active":
|
|
885
|
-
"data-flemo-bar-riding":
|
|
589
|
+
"data-flemo-bar-transition": S,
|
|
590
|
+
"data-flemo-bar-status": D,
|
|
591
|
+
"data-flemo-bar-active": y ? "true" : "false",
|
|
592
|
+
"data-flemo-bar-riding": Oe ? "true" : "false",
|
|
886
593
|
"data-flemo-anim-hold": Z ? "true" : "false",
|
|
887
594
|
style: {
|
|
888
|
-
display:
|
|
889
|
-
position:
|
|
890
|
-
bottom:
|
|
595
|
+
display: F ? "none" : void 0,
|
|
596
|
+
position: T,
|
|
597
|
+
bottom: p ? 0 : r,
|
|
891
598
|
left: 0,
|
|
892
599
|
width: "100%",
|
|
893
600
|
zIndex: 1
|
|
894
601
|
},
|
|
895
602
|
children: s
|
|
896
603
|
}),
|
|
897
|
-
|
|
898
|
-
ref:
|
|
604
|
+
P && /* @__PURE__ */ L(ze, {
|
|
605
|
+
ref: H,
|
|
899
606
|
"data-flemo-anim-hold": Z ? "true" : "false"
|
|
900
607
|
}),
|
|
901
|
-
/* @__PURE__ */
|
|
608
|
+
/* @__PURE__ */ L("div", {
|
|
902
609
|
"data-swipe-at-edge-bar": !0,
|
|
903
610
|
style: {
|
|
904
|
-
position:
|
|
611
|
+
position: T,
|
|
905
612
|
top: 0,
|
|
906
613
|
right: 0,
|
|
907
614
|
width: 8,
|
|
@@ -914,19 +621,19 @@ function He({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
914
621
|
}
|
|
915
622
|
//#endregion
|
|
916
623
|
//#region src/screen/Screen.tsx
|
|
917
|
-
function
|
|
918
|
-
let { isActive: n, isPrev: r, zIndex: i } =
|
|
919
|
-
return /* @__PURE__ */
|
|
920
|
-
freeze:
|
|
624
|
+
function He({ children: e, ...t }) {
|
|
625
|
+
let { isActive: n, isPrev: r, zIndex: i } = B();
|
|
626
|
+
return /* @__PURE__ */ L(Re, {
|
|
627
|
+
freeze: _({
|
|
921
628
|
isActive: n,
|
|
922
629
|
isPrev: r,
|
|
923
630
|
zIndex: i,
|
|
924
|
-
index:
|
|
631
|
+
index: G((e) => e.index),
|
|
925
632
|
status: Q((e) => e.status),
|
|
926
633
|
dragStatus: $((e) => e.dragStatus),
|
|
927
634
|
replaceTransitionStatus: $((e) => e.replaceTransitionStatus)
|
|
928
635
|
}),
|
|
929
|
-
children: /* @__PURE__ */
|
|
636
|
+
children: /* @__PURE__ */ L(Ve, {
|
|
930
637
|
...t,
|
|
931
638
|
children: e
|
|
932
639
|
})
|
|
@@ -934,9 +641,9 @@ function Ue({ children: e, ...t }) {
|
|
|
934
641
|
}
|
|
935
642
|
//#endregion
|
|
936
643
|
//#region src/screen/Part.tsx
|
|
937
|
-
function
|
|
938
|
-
let { isActive: a } =
|
|
939
|
-
return /* @__PURE__ */
|
|
644
|
+
function Ue({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
645
|
+
let { isActive: a } = B();
|
|
646
|
+
return /* @__PURE__ */ L("div", {
|
|
940
647
|
ref: e,
|
|
941
648
|
"data-flemo-part-name": t,
|
|
942
649
|
"data-flemo-status": Q((e) => e.status),
|
|
@@ -948,20 +655,20 @@ function We({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
|
948
655
|
}
|
|
949
656
|
//#endregion
|
|
950
657
|
//#region src/stores/RouterScopeProvider.tsx
|
|
951
|
-
function
|
|
952
|
-
let [t] =
|
|
953
|
-
history:
|
|
954
|
-
navigate:
|
|
955
|
-
transition:
|
|
956
|
-
screen:
|
|
957
|
-
driver:
|
|
958
|
-
markSelfInduced:
|
|
959
|
-
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
|
|
960
667
|
}));
|
|
961
|
-
return /* @__PURE__ */ R
|
|
668
|
+
return /* @__PURE__ */ L(R.Provider, {
|
|
962
669
|
value: t,
|
|
963
670
|
children: e
|
|
964
671
|
});
|
|
965
672
|
}
|
|
966
673
|
//#endregion
|
|
967
|
-
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",
|