@flemo/react 1.12.7 → 1.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import e, { Activity as t, Children as n, createContext as r, isValidElement as i, useCallback as a, useContext as o, useEffect as s, useId as c, useImperativeHandle as l, useInsertionEffect as u, useLayoutEffect as d, useReducer as f, useRef as p, useState as m, useSyncExternalStore as ee } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { flushSync as
|
|
2
|
+
import { ANIM_HOLD as h, ANIM_HOLD_ATTR as te, animHoldKey as ne, appendParamsQuery as re, buildRoutePath as ie, computeBarRiding as ae, computeScreenFreeze as oe, computeScreenFreezeMode as g, consumeSelfInducedPop as _, createAnimHoldCoordinator as se, createBrowserHistoryDriver as v, createBrowserHistoryDriver as y, createDecorator as b, createHistoryStore as x, createNavigateStore as ce, createNavigationController as le, createPartTransition as S, createRawDecorator as ue, createRawPartTransition as C, createRawTransition as w, createRouterScope as T, createScreenSelector as E, createScreenStore as D, createStepController as O, createSwipeController as de, createTransition as k, createTransitionEngine as fe, createTransitionStore as A, decoratorMap as pe, eagerlyDecodeImages as j, ensureScopeHistorySync as M, enteringInitialStyle as me, getMatchedPathPattern as he, isDesktopBlink as ge, isOpaqueColor as _e, isServer as ve, markSelfInducedPop as N, matchesPathname as ye, observeBarHeight as be, observeViewportScrollHeight as xe, partTransitionMap as Se, readStepParams as Ce, registerTransitionDefinitions as we, releaseScopeHistorySync as Te, resolvePlatformProfile as Ee, resolveTransition as De, restLayerPromotionEnabled as Oe, seedRouterEntry as ke, sharedBarsMatch as Ae, startFlemoRuntime as je, subscribeStepParamsRestore as Me } from "@flemo/core";
|
|
3
|
+
import { jsx as P, jsxs as Ne } from "react/jsx-runtime";
|
|
4
|
+
import { flushSync as Pe } from "react-dom";
|
|
5
5
|
//#region src/stores/StoreContext.ts
|
|
6
|
-
var
|
|
6
|
+
var Fe = r(null);
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/stores/useStores.ts
|
|
9
|
-
function
|
|
10
|
-
let e = o(
|
|
9
|
+
function F() {
|
|
10
|
+
let e = o(Fe);
|
|
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 s(() => (M(e), () =>
|
|
16
|
+
function Ie() {
|
|
17
|
+
let e = F();
|
|
18
|
+
return s(() => (M(e), () => Te(e)), [e]), null;
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/screen/ScreenContext.ts
|
|
22
|
-
var
|
|
22
|
+
var I = r({
|
|
23
23
|
id: "",
|
|
24
24
|
isActive: !1,
|
|
25
25
|
isRoot: !0,
|
|
@@ -34,15 +34,15 @@ var z = r({
|
|
|
34
34
|
});
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/screen/useScreen.ts
|
|
37
|
-
function
|
|
38
|
-
return o(
|
|
37
|
+
function L() {
|
|
38
|
+
return o(I);
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/screen/ParamsProvider/ParamsContext.ts
|
|
42
|
-
var
|
|
42
|
+
var Le = r({}), R = r(() => {});
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/screen/ParamsProvider/ParamsReducer.ts
|
|
45
|
-
function
|
|
45
|
+
function z(e, t) {
|
|
46
46
|
switch (t.type) {
|
|
47
47
|
case "SET": return t.params;
|
|
48
48
|
default: return e;
|
|
@@ -50,10 +50,10 @@ function He(e, t) {
|
|
|
50
50
|
}
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region src/screen/ParamsProvider/ParamsProvider.tsx
|
|
53
|
-
function
|
|
54
|
-
let { isActive: t, params: n } =
|
|
53
|
+
function B({ children: e }) {
|
|
54
|
+
let { isActive: t, params: n } = L(), { driver: r } = F(), [i, a] = f(z, n);
|
|
55
55
|
return s(() => {
|
|
56
|
-
if (t) return
|
|
56
|
+
if (t) return Me(r, (e) => a({
|
|
57
57
|
type: "SET",
|
|
58
58
|
params: e
|
|
59
59
|
}));
|
|
@@ -61,9 +61,9 @@ function Ue({ children: e }) {
|
|
|
61
61
|
t,
|
|
62
62
|
a,
|
|
63
63
|
r
|
|
64
|
-
]), /* @__PURE__ */
|
|
64
|
+
]), /* @__PURE__ */ P(R.Provider, {
|
|
65
65
|
value: a,
|
|
66
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ P(Le.Provider, {
|
|
67
67
|
value: i,
|
|
68
68
|
children: e
|
|
69
69
|
})
|
|
@@ -71,47 +71,47 @@ function Ue({ children: e }) {
|
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region ../../node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.18_react@19.2.8/node_modules/zustand/esm/react.mjs
|
|
74
|
-
var
|
|
75
|
-
function H(t, n =
|
|
74
|
+
var V = (e) => e;
|
|
75
|
+
function H(t, n = V) {
|
|
76
76
|
let r = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), e.useCallback(() => n(t.getInitialState()), [t, n]));
|
|
77
77
|
return e.useDebugValue(r), r;
|
|
78
78
|
}
|
|
79
79
|
//#endregion
|
|
80
80
|
//#region src/stores/useHistoryStore.ts
|
|
81
81
|
function U(e) {
|
|
82
|
-
return H(
|
|
82
|
+
return H(F().history, e);
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region src/RouterIdContext.ts
|
|
86
|
-
var
|
|
86
|
+
var Re = r(null);
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region src/renderer/Renderer.tsx
|
|
89
|
-
function
|
|
90
|
-
let t = U((e) => e.index), r = U((e) => e.histories), i =
|
|
89
|
+
function ze({ children: e }) {
|
|
90
|
+
let t = U((e) => e.index), r = U((e) => e.histories), i = F(), a = o(I), s = o(Re);
|
|
91
91
|
return E(r, t).map((t) => {
|
|
92
|
-
let [r] = n.toArray(e).filter((e) =>
|
|
93
|
-
return r ? /* @__PURE__ */
|
|
92
|
+
let [r] = n.toArray(e).filter((e) => ye(e.props.path, t.pathname));
|
|
93
|
+
return r ? /* @__PURE__ */ P(I.Provider, {
|
|
94
94
|
value: {
|
|
95
95
|
...t,
|
|
96
96
|
isPrev: t.isPrev || a.isPrev,
|
|
97
97
|
navigateStore: i.navigate,
|
|
98
98
|
routerId: s ?? void 0,
|
|
99
|
-
routePath:
|
|
99
|
+
routePath: he(r.props.path, t.pathname)
|
|
100
100
|
},
|
|
101
|
-
children: /* @__PURE__ */
|
|
101
|
+
children: /* @__PURE__ */ P(B, { children: r })
|
|
102
102
|
}, t.id) : null;
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/screen/ScreenViewportContext.ts
|
|
107
|
-
var
|
|
108
|
-
function
|
|
109
|
-
return o(
|
|
107
|
+
var W = r({ contained: !1 });
|
|
108
|
+
function Be() {
|
|
109
|
+
return o(W);
|
|
110
110
|
}
|
|
111
111
|
//#endregion
|
|
112
112
|
//#region src/transition/styles.ts
|
|
113
|
-
function
|
|
114
|
-
u(() =>
|
|
113
|
+
function Ve(e, t, n = []) {
|
|
114
|
+
u(() => we(e, t, n), [
|
|
115
115
|
e,
|
|
116
116
|
t,
|
|
117
117
|
n
|
|
@@ -119,50 +119,50 @@ function Ye(e, t, n = []) {
|
|
|
119
119
|
}
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region src/utils/devDiagnostics.ts
|
|
122
|
-
function
|
|
122
|
+
function He() {
|
|
123
123
|
return typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
!
|
|
125
|
+
function Ue(e) {
|
|
126
|
+
!He() || typeof console > "u" || console.error(`[flemo] ${e}`);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
if (
|
|
128
|
+
function We(e) {
|
|
129
|
+
if (He()) throw Error(`[flemo] ${e}`);
|
|
130
130
|
}
|
|
131
131
|
//#endregion
|
|
132
132
|
//#region src/RouterDepthContext.ts
|
|
133
|
-
var
|
|
133
|
+
var Ge = r(0), Ke = r(null), qe = [
|
|
134
134
|
"current",
|
|
135
135
|
"parent",
|
|
136
136
|
"root",
|
|
137
137
|
"nearest-owner"
|
|
138
|
-
],
|
|
138
|
+
], Je = (e) => qe.includes(e), Ye = (e) => {
|
|
139
139
|
let t = [];
|
|
140
140
|
for (let n = e; n; n = n.parent) t.push(n);
|
|
141
141
|
return t;
|
|
142
142
|
};
|
|
143
|
-
function
|
|
144
|
-
return e.routePaths.length === 0 || e.routePaths.some((e) => e === t) ? !0 : n ?
|
|
143
|
+
function G(e, t, n) {
|
|
144
|
+
return e.routePaths.length === 0 || e.routePaths.some((e) => e === t) ? !0 : n ? ye(e.routePaths, n) : !1;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
146
|
+
function K(e) {
|
|
147
|
+
return Ye(e).map((e, t) => {
|
|
148
148
|
let n = t === 0 ? "current" : `${t} level(s) up`;
|
|
149
149
|
return e.name ? `"${e.name}" (${n})` : `<unnamed> (${n})`;
|
|
150
150
|
}).join(", ");
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Xe({ from: e, target: t, path: n, pathname: r }) {
|
|
153
153
|
if (t === void 0) return {
|
|
154
154
|
node: e,
|
|
155
155
|
message: null
|
|
156
156
|
};
|
|
157
157
|
let i = null, a = null;
|
|
158
|
-
if (typeof t == "string" ?
|
|
159
|
-
let t =
|
|
158
|
+
if (typeof t == "string" ? Je(t) ? i = t : a = t : "scope" in t ? i = t.scope : a = t.name, a !== null) {
|
|
159
|
+
let t = Ye(e).find((e) => e.name === a);
|
|
160
160
|
return t ? {
|
|
161
161
|
node: t,
|
|
162
162
|
message: null
|
|
163
163
|
} : {
|
|
164
164
|
node: null,
|
|
165
|
-
message: `no <Router name="${a}"> encloses this call. Routers in scope: ${
|
|
165
|
+
message: `no <Router name="${a}"> encloses this call. Routers in scope: ${K(e)}.`
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
switch (i) {
|
|
@@ -174,7 +174,7 @@ function J({ from: e, target: t, path: n, pathname: r }) {
|
|
|
174
174
|
message: "router: \"parent\" was requested, but the enclosing <Router> is the outermost one (it has no parent Router)."
|
|
175
175
|
};
|
|
176
176
|
case "root": {
|
|
177
|
-
let t =
|
|
177
|
+
let t = Ye(e);
|
|
178
178
|
return {
|
|
179
179
|
node: t[t.length - 1],
|
|
180
180
|
message: null
|
|
@@ -185,13 +185,13 @@ function J({ from: e, target: t, path: n, pathname: r }) {
|
|
|
185
185
|
node: e,
|
|
186
186
|
message: "router: \"nearest-owner\" needs a route to search for, and pop() carries none. Falling back to \"current\" — name the Router explicitly for a cross-Router pop."
|
|
187
187
|
};
|
|
188
|
-
let t =
|
|
188
|
+
let t = Ye(e).find((e) => G(e, n, r));
|
|
189
189
|
return t ? {
|
|
190
190
|
node: t,
|
|
191
191
|
message: null
|
|
192
192
|
} : {
|
|
193
193
|
node: null,
|
|
194
|
-
message: `no <Router> in scope declares a <Route path="${n}">. Routers in scope: ${
|
|
194
|
+
message: `no <Router> in scope declares a <Route path="${n}">. Routers in scope: ${K(e)}.`
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
default: return {
|
|
@@ -200,162 +200,137 @@ function J({ from: e, target: t, path: n, pathname: r }) {
|
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function Ze(e) {
|
|
204
204
|
if (!e.name) return null;
|
|
205
205
|
for (let t = e.parent; t; t = t.parent) if (t.name === e.name) return t;
|
|
206
206
|
return null;
|
|
207
207
|
}
|
|
208
208
|
//#endregion
|
|
209
209
|
//#region src/Slot.tsx
|
|
210
|
-
var
|
|
211
|
-
function
|
|
212
|
-
return /* @__PURE__ */
|
|
210
|
+
var Qe = { contained: !0 };
|
|
211
|
+
function q({ children: e, className: t, style: n }) {
|
|
212
|
+
return /* @__PURE__ */ P("div", {
|
|
213
213
|
className: t,
|
|
214
214
|
style: {
|
|
215
215
|
position: "relative",
|
|
216
216
|
overflow: "hidden",
|
|
217
217
|
...n
|
|
218
218
|
},
|
|
219
|
-
children: /* @__PURE__ */
|
|
220
|
-
value:
|
|
221
|
-
children: /* @__PURE__ */
|
|
219
|
+
children: /* @__PURE__ */ P(W.Provider, {
|
|
220
|
+
value: Qe,
|
|
221
|
+
children: /* @__PURE__ */ P(ze, { children: e })
|
|
222
222
|
})
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region src/Router.tsx
|
|
227
|
-
function
|
|
227
|
+
function J(e) {
|
|
228
228
|
let t = null;
|
|
229
229
|
return n.forEach(e, (e) => {
|
|
230
230
|
if (t || !i(e)) return;
|
|
231
|
-
if (e.type ===
|
|
231
|
+
if (e.type === q) {
|
|
232
232
|
t = n.toArray(e.props.children).filter(i);
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
235
|
let r = e.props.children;
|
|
236
236
|
if (r) {
|
|
237
|
-
let e =
|
|
237
|
+
let e = J(r);
|
|
238
238
|
e && (t = e);
|
|
239
239
|
}
|
|
240
240
|
}), t;
|
|
241
241
|
}
|
|
242
|
-
var
|
|
243
|
-
function
|
|
244
|
-
let
|
|
242
|
+
var $e = typeof window > "u" ? s : d, et = typeof window > "u" ? s : u, tt = [], nt = [], Y = [], rt = { contained: !0 };
|
|
243
|
+
function X({ children: e, name: t, strictRoutes: r = !1, initPath: a = "/", defaultTransitionName: l = "cupertino", transitions: u = tt, decorators: d = nt, partTransitions: f = Y, history: p = "browser", createDriver: ee, className: h, style: te }) {
|
|
244
|
+
let ne = o(Ge), re = c(), [ie, ae] = m(!1);
|
|
245
245
|
s(() => ae(!0), []);
|
|
246
|
-
let oe = ie ? re : null, g =
|
|
247
|
-
routePaths:
|
|
248
|
-
pathname:
|
|
249
|
-
search:
|
|
246
|
+
let oe = ie ? re : null, g = ne > 0, _ = p === "memory", se = c(), v = o(I), b = o(Fe), x = g && v.id ? `_F_${b?.routerKey ?? ""}${v.id}_` : se, ce = J(e), le = ce !== null, S = (ce ?? n.toArray(e).filter(i)).flatMap((e) => e.props?.path ? [e.props.path].flat() : []), ue = g ? null : b, C = ue !== null, w = ee ?? y, [E] = m(() => _ ? null : w(C ? void 0 : x)), D = !g && !_ && !ve(), O = D && E ? E.readPathname() : a || "/", de = O.indexOf("?"), k = (de >= 0 ? O.slice(0, de) : O) || "/", fe = D ? window.location.search : de >= 0 ? O.slice(de) : "", [A] = m(() => T({
|
|
247
|
+
routePaths: S,
|
|
248
|
+
pathname: k,
|
|
249
|
+
search: fe,
|
|
250
250
|
defaultTransitionName: l,
|
|
251
251
|
memory: _,
|
|
252
|
-
browserDriver:
|
|
253
|
-
hostedScope:
|
|
254
|
-
routerKey:
|
|
255
|
-
zoneEntryId: g && !
|
|
256
|
-
persistKey: g && !_ && !
|
|
252
|
+
browserDriver: E,
|
|
253
|
+
hostedScope: ue,
|
|
254
|
+
routerKey: C ? void 0 : x,
|
|
255
|
+
zoneEntryId: g && !C && v.id || void 0,
|
|
256
|
+
persistKey: g && !_ && !C ? x : void 0
|
|
257
257
|
}));
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
$e(() => {
|
|
259
|
+
A.transition.getState().defaultTransitionName !== l && A.transition.setState({ defaultTransitionName: l });
|
|
260
260
|
});
|
|
261
|
-
let
|
|
261
|
+
let pe = o(Ke), [j] = m(() => ({
|
|
262
262
|
name: t,
|
|
263
|
-
stores:
|
|
264
|
-
routePaths:
|
|
263
|
+
stores: A,
|
|
264
|
+
routePaths: S,
|
|
265
265
|
strictRoutes: r,
|
|
266
|
-
parent:
|
|
267
|
-
depth:
|
|
266
|
+
parent: pe,
|
|
267
|
+
depth: ne
|
|
268
268
|
}));
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
et(() => {
|
|
270
|
+
j.name = t, j.stores = A, j.routePaths = S, j.strictRoutes = r, j.parent = pe;
|
|
271
271
|
}), s(() => {
|
|
272
|
-
|
|
273
|
-
}, [
|
|
274
|
-
|
|
275
|
-
}), [
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
let r = Date.now();
|
|
282
|
-
if (r - n < ut) return;
|
|
283
|
-
n = r, t && clearTimeout(t);
|
|
284
|
-
let i = e;
|
|
285
|
-
e = N(), i?.(), t = setTimeout(() => {
|
|
286
|
-
t = null, e?.(), e = null;
|
|
287
|
-
}, dt);
|
|
288
|
-
}, i = [
|
|
289
|
-
"pointerdown",
|
|
290
|
-
"pointermove",
|
|
291
|
-
"wheel",
|
|
292
|
-
"touchstart",
|
|
293
|
-
"keydown"
|
|
294
|
-
];
|
|
295
|
-
for (let e of i) document.addEventListener(e, r, { passive: !0 });
|
|
296
|
-
return () => {
|
|
297
|
-
for (let e of i) document.removeEventListener(e, r);
|
|
298
|
-
t && clearTimeout(t), e?.();
|
|
299
|
-
};
|
|
300
|
-
}, []), s(() => {
|
|
301
|
-
_ || !O || Ie({
|
|
302
|
-
driver: O,
|
|
303
|
-
routerKey: E ? null : x,
|
|
304
|
-
nested: g && !E,
|
|
305
|
-
seedPathname: A,
|
|
272
|
+
Ze(j) && Ue(`duplicate <Router name="${j.name}">: an enclosing <Router> already uses that name, so \`router\` targets resolve to the nearer one. Give each nested Router a unique name.`);
|
|
273
|
+
}, [j, t]), $e(() => (A.life.alive = !0, () => {
|
|
274
|
+
A.life.alive = !1;
|
|
275
|
+
}), [A]), Ve(u, d, f), s(() => je(), []), s(() => {
|
|
276
|
+
_ || !E || ke({
|
|
277
|
+
driver: E,
|
|
278
|
+
routerKey: C ? null : x,
|
|
279
|
+
nested: g && !C,
|
|
280
|
+
seedPathname: k,
|
|
306
281
|
defaultTransitionName: l,
|
|
307
|
-
rootParams:
|
|
282
|
+
rootParams: A.history.getState().histories[0]?.params ?? {}
|
|
308
283
|
});
|
|
309
284
|
}, [
|
|
310
285
|
_,
|
|
311
|
-
|
|
286
|
+
C,
|
|
312
287
|
g,
|
|
313
288
|
x,
|
|
314
|
-
|
|
289
|
+
k,
|
|
315
290
|
l,
|
|
316
|
-
|
|
317
|
-
|
|
291
|
+
A.history,
|
|
292
|
+
E
|
|
318
293
|
]);
|
|
319
|
-
let
|
|
294
|
+
let M = le ? e : /* @__PURE__ */ P(ze, { children: e }), me = /* @__PURE__ */ P(Re.Provider, {
|
|
320
295
|
value: oe,
|
|
321
|
-
children: /* @__PURE__ */
|
|
322
|
-
value:
|
|
323
|
-
children: /* @__PURE__ */
|
|
324
|
-
value:
|
|
325
|
-
children: /* @__PURE__ */
|
|
326
|
-
value:
|
|
327
|
-
children: [!_ && /* @__PURE__ */
|
|
328
|
-
value:
|
|
329
|
-
children:
|
|
330
|
-
}) :
|
|
296
|
+
children: /* @__PURE__ */ P(Ge.Provider, {
|
|
297
|
+
value: ne + 1,
|
|
298
|
+
children: /* @__PURE__ */ P(Ke.Provider, {
|
|
299
|
+
value: j,
|
|
300
|
+
children: /* @__PURE__ */ Ne(Fe.Provider, {
|
|
301
|
+
value: A,
|
|
302
|
+
children: [!_ && /* @__PURE__ */ P(Ie, {}), g ? /* @__PURE__ */ P(W.Provider, {
|
|
303
|
+
value: rt,
|
|
304
|
+
children: M
|
|
305
|
+
}) : M]
|
|
331
306
|
})
|
|
332
307
|
})
|
|
333
308
|
})
|
|
334
309
|
});
|
|
335
|
-
return g ? /* @__PURE__ */
|
|
336
|
-
className:
|
|
310
|
+
return g ? /* @__PURE__ */ P("div", {
|
|
311
|
+
className: h,
|
|
337
312
|
style: {
|
|
338
313
|
position: "relative",
|
|
339
314
|
overflow: "hidden",
|
|
340
|
-
...
|
|
315
|
+
...te
|
|
341
316
|
},
|
|
342
|
-
children:
|
|
343
|
-
}) :
|
|
317
|
+
children: me
|
|
318
|
+
}) : me;
|
|
344
319
|
}
|
|
345
320
|
//#endregion
|
|
346
321
|
//#region src/Route.tsx
|
|
347
|
-
function
|
|
322
|
+
function it({ element: e }) {
|
|
348
323
|
return e;
|
|
349
324
|
}
|
|
350
325
|
//#endregion
|
|
351
326
|
//#region src/utils/buildRoutePath.ts
|
|
352
|
-
function
|
|
353
|
-
return
|
|
327
|
+
function at(e, t) {
|
|
328
|
+
return ie(e, t);
|
|
354
329
|
}
|
|
355
330
|
//#endregion
|
|
356
331
|
//#region src/navigate/useNavigate.ts
|
|
357
|
-
function
|
|
358
|
-
let t =
|
|
332
|
+
function ot(e) {
|
|
333
|
+
let t = F(), n = o(Ke) ?? {
|
|
359
334
|
stores: t,
|
|
360
335
|
routePaths: [],
|
|
361
336
|
strictRoutes: !1,
|
|
@@ -364,24 +339,24 @@ function Z(e) {
|
|
|
364
339
|
}, r = (t, r, i) => {
|
|
365
340
|
let a = t ?? e?.router, o;
|
|
366
341
|
if (r) try {
|
|
367
|
-
o =
|
|
342
|
+
o = at(r, i).toPathname;
|
|
368
343
|
} catch {
|
|
369
344
|
o = void 0;
|
|
370
345
|
}
|
|
371
|
-
let { node: s, message: c } =
|
|
346
|
+
let { node: s, message: c } = Xe({
|
|
372
347
|
from: n,
|
|
373
348
|
target: a,
|
|
374
349
|
path: r,
|
|
375
350
|
pathname: o
|
|
376
351
|
});
|
|
377
|
-
if (!s) return
|
|
378
|
-
if (c &&
|
|
352
|
+
if (!s) return We(c ?? "the requested Router could not be resolved."), null;
|
|
353
|
+
if (c && Ue(c), r && !G(s, r, o)) {
|
|
379
354
|
let e = `"${r}" is not declared by ${s.name ? `<Router name="${s.name}">` : "the target <Router>"}, so the navigation cannot mount a screen there. Declare a matching <Route>, target the Router that owns it, or use \`router: "nearest-owner"\`.`;
|
|
380
|
-
a !== void 0 || s.strictRoutes ?
|
|
355
|
+
a !== void 0 || s.strictRoutes ? We(e) : Ue(e);
|
|
381
356
|
}
|
|
382
|
-
return
|
|
357
|
+
return le({
|
|
383
358
|
stores: s.stores,
|
|
384
|
-
buildPathname: (e, t) =>
|
|
359
|
+
buildPathname: (e, t) => at(e, t),
|
|
385
360
|
driver: s.stores.driver,
|
|
386
361
|
markSelfInduced: s.stores.markSelfInduced
|
|
387
362
|
});
|
|
@@ -403,21 +378,21 @@ function Z(e) {
|
|
|
403
378
|
}
|
|
404
379
|
//#endregion
|
|
405
380
|
//#region src/navigate/usePathname.ts
|
|
406
|
-
function
|
|
381
|
+
function st() {
|
|
407
382
|
return U((e) => e.histories[e.pendingIndex]?.pathname ?? "/");
|
|
408
383
|
}
|
|
409
384
|
//#endregion
|
|
410
385
|
//#region src/navigate/useStep.ts
|
|
411
|
-
function
|
|
412
|
-
let { routePath: e } =
|
|
386
|
+
function ct() {
|
|
387
|
+
let { routePath: e } = L(), t = F(), n = o(R), { driver: r, markSelfInduced: i } = t, [a, c] = m(null);
|
|
413
388
|
s(() => {
|
|
414
|
-
if (!e) return c(
|
|
389
|
+
if (!e) return c(Ce(r.readState())), r.subscribe((e) => c(Ce(e.state)));
|
|
415
390
|
}, [e, r]);
|
|
416
391
|
let l = O({
|
|
417
392
|
stores: t,
|
|
418
393
|
driver: r,
|
|
419
394
|
markSelfInduced: i,
|
|
420
|
-
buildStepPathname: (t) => e ?
|
|
395
|
+
buildStepPathname: (t) => e ? at(e, t).pathname : re(r.readPathname(), t),
|
|
421
396
|
applyParams: (t) => {
|
|
422
397
|
n({
|
|
423
398
|
type: "SET",
|
|
@@ -434,50 +409,50 @@ function gt() {
|
|
|
434
409
|
}
|
|
435
410
|
//#endregion
|
|
436
411
|
//#region src/screen/ParamsProvider/useParams.ts
|
|
437
|
-
function
|
|
438
|
-
return o(
|
|
412
|
+
function lt() {
|
|
413
|
+
return o(Le);
|
|
439
414
|
}
|
|
440
415
|
//#endregion
|
|
441
416
|
//#region src/screen/ScreenFreeze.tsx
|
|
442
|
-
var
|
|
443
|
-
function
|
|
417
|
+
var ut = 3e3;
|
|
418
|
+
function dt({ freeze: e, children: n }) {
|
|
444
419
|
let [r, i] = m(e), a = p(null);
|
|
445
420
|
return !e && r && i(!1), s(() => {
|
|
446
421
|
if (!(!e || r)) {
|
|
447
|
-
if (!
|
|
422
|
+
if (!ge()) {
|
|
448
423
|
i(!0);
|
|
449
424
|
return;
|
|
450
425
|
}
|
|
451
426
|
return a.current = setTimeout(() => {
|
|
452
427
|
a.current = null, i(!0);
|
|
453
|
-
},
|
|
428
|
+
}, ut), () => {
|
|
454
429
|
a.current !== null && (clearTimeout(a.current), a.current = null);
|
|
455
430
|
};
|
|
456
431
|
}
|
|
457
|
-
}, [e, r]), /* @__PURE__ */
|
|
432
|
+
}, [e, r]), /* @__PURE__ */ P(t, {
|
|
458
433
|
mode: e && r ? "hidden" : "visible",
|
|
459
434
|
children: n
|
|
460
435
|
});
|
|
461
436
|
}
|
|
462
437
|
//#endregion
|
|
463
438
|
//#region src/screen/scopeAnimHoldCoordinator.ts
|
|
464
|
-
var
|
|
465
|
-
function
|
|
466
|
-
let t =
|
|
467
|
-
return t || (t =
|
|
439
|
+
var ft = /* @__PURE__ */ new WeakMap();
|
|
440
|
+
function pt(e) {
|
|
441
|
+
let t = ft.get(e);
|
|
442
|
+
return t || (t = se(), ft.set(e, t)), t;
|
|
468
443
|
}
|
|
469
444
|
//#endregion
|
|
470
445
|
//#region src/stores/useNavigateStore.ts
|
|
471
|
-
function
|
|
472
|
-
return H(
|
|
446
|
+
function mt(e) {
|
|
447
|
+
return H(F().navigate, e);
|
|
473
448
|
}
|
|
474
449
|
//#endregion
|
|
475
450
|
//#region src/screen/ScreenDecorator.tsx
|
|
476
|
-
function
|
|
477
|
-
let { isActive: r, isPrev: i, transitionName: a } =
|
|
451
|
+
function ht({ ref: e, style: t, ...n }) {
|
|
452
|
+
let { isActive: r, isPrev: i, transitionName: a } = L(), o = p(null);
|
|
478
453
|
l(e, () => o.current);
|
|
479
|
-
let s =
|
|
480
|
-
return u ? /* @__PURE__ */
|
|
454
|
+
let s = mt((e) => i ? "COMPLETED" : e.status), { decoratorName: c } = De(a), u = pe.get(c);
|
|
455
|
+
return u ? /* @__PURE__ */ P("div", {
|
|
481
456
|
ref: o,
|
|
482
457
|
"data-flemo-decorator": !0,
|
|
483
458
|
"data-flemo-decorator-name": u.name,
|
|
@@ -498,9 +473,9 @@ function Ct({ ref: e, style: t, ...n }) {
|
|
|
498
473
|
}
|
|
499
474
|
//#endregion
|
|
500
475
|
//#region src/screen/useViewportScrollHeight.ts
|
|
501
|
-
function
|
|
476
|
+
function gt() {
|
|
502
477
|
let [e, t] = m(0), [n, r] = m(0);
|
|
503
|
-
return s(() =>
|
|
478
|
+
return s(() => xe((e, n) => {
|
|
504
479
|
r(n), t(e);
|
|
505
480
|
}), []), {
|
|
506
481
|
viewportScrollHeight: e,
|
|
@@ -509,96 +484,96 @@ function wt() {
|
|
|
509
484
|
}
|
|
510
485
|
//#endregion
|
|
511
486
|
//#region src/utils/useHydrationSafeFlag.ts
|
|
512
|
-
var
|
|
513
|
-
function
|
|
514
|
-
return ee(
|
|
487
|
+
var Z = () => () => {}, _t = () => !1;
|
|
488
|
+
function vt(e) {
|
|
489
|
+
return ee(Z, e, _t);
|
|
515
490
|
}
|
|
516
491
|
//#endregion
|
|
517
492
|
//#region src/stores/useScreenStore.ts
|
|
518
|
-
function
|
|
519
|
-
return H(
|
|
493
|
+
function Q(e) {
|
|
494
|
+
return H(F().screen, e);
|
|
520
495
|
}
|
|
521
496
|
//#endregion
|
|
522
497
|
//#region src/screen/ScreenMotion.tsx
|
|
523
|
-
function
|
|
524
|
-
let { id:
|
|
525
|
-
|
|
498
|
+
function yt({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigationBarHeight: r, systemNavigationBarColor: i, sharedTopBar: c, sharedTopBarId: l, sharedBottomBar: u, sharedBottomBarId: f, topBar: ee, bottomBar: re, hideStatusBar: ie, hideSystemNavigationBar: g, backgroundColor: _ = "white", contentScrollable: se = !0, ...v }) {
|
|
499
|
+
let { id: y, isActive: b, isRoot: x, isPrev: ce, zIndex: le, transitionName: S, prevTransitionName: ue } = L(), { contained: C } = Be(), w = C ? "absolute" : "fixed", T = F(), E = o(Re), D = U((e) => e.index), O = U((e) => e.histories), k = b || le === D - 1, A = mt((e) => k ? e.status : "COMPLETED"), M = Q((e) => e.dragStatus), he = Q((e) => e.replaceTransitionStatus), ge = T.screen.getState().setDragStatus, ve = T.screen.getState().setReplaceTransitionStatus, N = b ? O[D - 1]?.id : O[D]?.id, ye = Q((e) => N ? e.sharedBars[N] : void 0), xe = Q((e) => N ? e.sharedBarMetadata[N] : void 0), Se = Q((e) => N ? e.screenSurfaces[N] : void 0), Ce = p(null);
|
|
500
|
+
Ce.current ||= fe({
|
|
526
501
|
getTransitionTaskId: () => T.navigate.getState().transitionTaskId,
|
|
527
|
-
setDragStatus:
|
|
528
|
-
setReplaceTransitionStatus:
|
|
502
|
+
setDragStatus: ge,
|
|
503
|
+
setReplaceTransitionStatus: ve
|
|
529
504
|
});
|
|
530
|
-
let
|
|
531
|
-
|
|
532
|
-
let
|
|
533
|
-
key:
|
|
505
|
+
let we = Ce.current, Te = p(null);
|
|
506
|
+
Te.current ||= pt(T.navigate);
|
|
507
|
+
let ke = De(S), { initial: je, swipeDirection: Me, decoratorName: Fe } = ke, Ie = pe.get(Fe), { viewportScrollHeight: I } = gt(), Le = I > 0, R = !!c, z = !!u, B = R ? `${typeof l}:${String(l)}` : null, V = z ? `${typeof f}:${String(f)}` : null, [H, ze] = m({
|
|
508
|
+
key: B,
|
|
534
509
|
height: 0
|
|
535
|
-
}), [
|
|
510
|
+
}), [W, Ve] = m({
|
|
536
511
|
key: V,
|
|
537
512
|
height: 0
|
|
538
|
-
}),
|
|
539
|
-
e <= 0 ||
|
|
540
|
-
key:
|
|
513
|
+
}), He = p(H), Ue = p(W), We = H.key === B ? H.height : 0, Ge = W.key === V ? W.height : 0, Ke = Ae(R ? { id: l } : void 0, xe?.topBar) ? xe?.topBar?.height ?? 0 : 0, qe = Ae(z ? { id: f } : void 0, xe?.bottomBar) ? xe?.bottomBar?.height ?? 0 : 0, Je = We || Ke, Ye = Ge || qe, G = p(null), K = p(null), Xe = p(null), Ze = p(null), Qe = p(null), q = p(null), J = p(null), $e = a((e) => {
|
|
514
|
+
e <= 0 || B === null || (Ze.current && (Ze.current.style.minHeight = `${e}px`), He.current = {
|
|
515
|
+
key: B,
|
|
541
516
|
height: e
|
|
542
|
-
},
|
|
543
|
-
key:
|
|
517
|
+
}, ze((t) => t.key === B && t.height === e ? t : {
|
|
518
|
+
key: B,
|
|
544
519
|
height: e
|
|
545
|
-
}), T.screen.getState().updateSharedBarHeight(
|
|
520
|
+
}), T.screen.getState().updateSharedBarHeight(y, "topBar", e));
|
|
546
521
|
}, [
|
|
547
|
-
|
|
522
|
+
y,
|
|
548
523
|
T.screen,
|
|
549
|
-
|
|
550
|
-
]),
|
|
551
|
-
e <= 0 || V === null || (
|
|
524
|
+
B
|
|
525
|
+
]), et = a((e) => {
|
|
526
|
+
e <= 0 || V === null || (Qe.current && (Qe.current.style.minHeight = `${e}px`), Ue.current = {
|
|
552
527
|
key: V,
|
|
553
528
|
height: e
|
|
554
|
-
},
|
|
529
|
+
}, Ve((t) => t.key === V && t.height === e ? t : {
|
|
555
530
|
key: V,
|
|
556
531
|
height: e
|
|
557
|
-
}), T.screen.getState().updateSharedBarHeight(
|
|
532
|
+
}), T.screen.getState().updateSharedBarHeight(y, "bottomBar", e));
|
|
558
533
|
}, [
|
|
559
534
|
V,
|
|
560
|
-
|
|
535
|
+
y,
|
|
561
536
|
T.screen
|
|
562
|
-
]),
|
|
563
|
-
q.current = e, e?.offsetHeight &&
|
|
564
|
-
}, [
|
|
565
|
-
J.current = e, e?.offsetHeight &&
|
|
566
|
-
}, [
|
|
567
|
-
transition:
|
|
568
|
-
decorator:
|
|
537
|
+
]), tt = a((e) => {
|
|
538
|
+
q.current = e, e?.offsetHeight && $e(e.offsetHeight);
|
|
539
|
+
}, [$e]), nt = a((e) => {
|
|
540
|
+
J.current = e, e?.offsetHeight && et(e.offsetHeight);
|
|
541
|
+
}, [et]), Y = p({
|
|
542
|
+
transition: ke,
|
|
543
|
+
decorator: Ie,
|
|
569
544
|
hasSharedTopBar: !!c,
|
|
570
545
|
hasSharedBottomBar: !!u,
|
|
571
546
|
sharedTopBarId: l,
|
|
572
547
|
sharedBottomBarId: f,
|
|
573
|
-
viewportScrollHeight:
|
|
574
|
-
isRoot:
|
|
575
|
-
isActive:
|
|
548
|
+
viewportScrollHeight: I,
|
|
549
|
+
isRoot: x,
|
|
550
|
+
isActive: b,
|
|
576
551
|
status: A,
|
|
577
|
-
dragStatus:
|
|
552
|
+
dragStatus: M,
|
|
578
553
|
index: D
|
|
579
554
|
});
|
|
580
555
|
Y.current = {
|
|
581
|
-
transition:
|
|
582
|
-
decorator:
|
|
556
|
+
transition: ke,
|
|
557
|
+
decorator: Ie,
|
|
583
558
|
hasSharedTopBar: !!c,
|
|
584
559
|
hasSharedBottomBar: !!u,
|
|
585
560
|
sharedTopBarId: l,
|
|
586
561
|
sharedBottomBarId: f,
|
|
587
|
-
viewportScrollHeight:
|
|
588
|
-
isRoot:
|
|
589
|
-
isActive:
|
|
562
|
+
viewportScrollHeight: I,
|
|
563
|
+
isRoot: x,
|
|
564
|
+
isActive: b,
|
|
590
565
|
status: A,
|
|
591
|
-
dragStatus:
|
|
566
|
+
dragStatus: M,
|
|
592
567
|
index: D
|
|
593
568
|
};
|
|
594
|
-
let
|
|
595
|
-
|
|
569
|
+
let rt = p(null);
|
|
570
|
+
rt.current ||= de({
|
|
596
571
|
getTransition: () => Y.current.transition,
|
|
597
572
|
getDecorator: () => Y.current.decorator,
|
|
598
573
|
getElements: () => ({
|
|
599
|
-
scope:
|
|
600
|
-
screenContainer:
|
|
601
|
-
decorator:
|
|
574
|
+
scope: K.current,
|
|
575
|
+
screenContainer: G.current,
|
|
576
|
+
decorator: Xe.current,
|
|
602
577
|
sharedTopBar: q.current,
|
|
603
578
|
sharedBottomBar: J.current
|
|
604
579
|
}),
|
|
@@ -619,160 +594,160 @@ function Dt({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
619
594
|
let e = Y.current, t = T.history.getState().histories, n = e.isActive ? t[e.index - 1]?.id : t[e.index]?.id;
|
|
620
595
|
return n ? T.screen.getState().sharedBarMetadata[n] : void 0;
|
|
621
596
|
},
|
|
622
|
-
setDragStatus:
|
|
597
|
+
setDragStatus: ge,
|
|
623
598
|
back: () => window.history.back()
|
|
624
599
|
});
|
|
625
|
-
let X =
|
|
600
|
+
let X = rt.current, it = (e) => X.pointerDown(e.nativeEvent), at = (e) => X.pointerMove(e.nativeEvent), ot = (e) => X.pointerUp(e.nativeEvent), st = (e) => X.pointerCancel(e.nativeEvent), ct = (e) => X.lostPointerCapture(e.nativeEvent), lt = (e) => {
|
|
626
601
|
(A === "PUSHING" || A === "REPLACING") && (e.preventDefault(), e.stopPropagation());
|
|
627
602
|
};
|
|
628
603
|
s(() => {
|
|
629
|
-
|
|
604
|
+
j(K.current);
|
|
630
605
|
}, []), s(() => {
|
|
631
|
-
let e =
|
|
606
|
+
let e = K.current;
|
|
632
607
|
if (!e) return;
|
|
633
608
|
let t = (e) => {
|
|
634
609
|
X.shouldPreventTouch() && e.preventDefault();
|
|
635
610
|
};
|
|
636
611
|
return e.addEventListener("touchmove", t, { passive: !1 }), () => {
|
|
637
|
-
e.removeEventListener("touchmove", t);
|
|
612
|
+
e.removeEventListener("touchmove", t), X.abandon();
|
|
638
613
|
};
|
|
639
614
|
}, [X]), d(() => {
|
|
640
|
-
let { registerSharedBars: e, unregisterSharedBars: t } = T.screen.getState(), n =
|
|
641
|
-
return e(
|
|
642
|
-
topBar:
|
|
643
|
-
bottomBar:
|
|
615
|
+
let { registerSharedBars: e, unregisterSharedBars: t } = T.screen.getState(), n = He.current, r = Ue.current;
|
|
616
|
+
return e(y, {
|
|
617
|
+
topBar: R,
|
|
618
|
+
bottomBar: z
|
|
644
619
|
}, {
|
|
645
|
-
topBar:
|
|
620
|
+
topBar: R ? {
|
|
646
621
|
id: l,
|
|
647
|
-
height: n.key ===
|
|
622
|
+
height: n.key === B ? n.height : void 0
|
|
648
623
|
} : void 0,
|
|
649
|
-
bottomBar:
|
|
624
|
+
bottomBar: z ? {
|
|
650
625
|
id: f,
|
|
651
626
|
height: r.key === V ? r.height : void 0
|
|
652
627
|
} : void 0
|
|
653
|
-
}), () => t(
|
|
628
|
+
}), () => t(y);
|
|
654
629
|
}, [
|
|
655
630
|
V,
|
|
631
|
+
z,
|
|
656
632
|
R,
|
|
657
|
-
|
|
658
|
-
v,
|
|
633
|
+
y,
|
|
659
634
|
f,
|
|
660
635
|
l,
|
|
661
636
|
T.screen,
|
|
662
|
-
|
|
637
|
+
B
|
|
663
638
|
]), d(() => {
|
|
664
639
|
let e = q.current;
|
|
665
|
-
if (e) return
|
|
666
|
-
}, [
|
|
640
|
+
if (e) return be(e, $e);
|
|
641
|
+
}, [$e, c]), d(() => {
|
|
667
642
|
let e = J.current;
|
|
668
|
-
if (e) return
|
|
669
|
-
}, [
|
|
670
|
-
let e =
|
|
643
|
+
if (e) return be(e, et);
|
|
644
|
+
}, [et, u]), d(() => {
|
|
645
|
+
let e = K.current;
|
|
671
646
|
if (!e) return;
|
|
672
647
|
let { registerScreenSurface: t, unregisterScreenSurface: n } = T.screen.getState();
|
|
673
|
-
return t(
|
|
648
|
+
return t(y, { opaqueBackground: _e(getComputedStyle(e).backgroundColor) }), () => n(y);
|
|
674
649
|
}, [
|
|
675
|
-
|
|
676
|
-
|
|
650
|
+
y,
|
|
651
|
+
_,
|
|
677
652
|
A,
|
|
678
653
|
T.screen
|
|
679
654
|
]);
|
|
680
|
-
let
|
|
655
|
+
let ut = k, { app: dt, nav: ft } = ae({
|
|
681
656
|
status: A,
|
|
682
|
-
isTopOrTopPrev:
|
|
683
|
-
hasTopBar:
|
|
684
|
-
hasNavBar:
|
|
657
|
+
isTopOrTopPrev: ut,
|
|
658
|
+
hasTopBar: R,
|
|
659
|
+
hasNavBar: z,
|
|
685
660
|
topBarId: l,
|
|
686
661
|
bottomBarId: f,
|
|
687
|
-
partnerBars:
|
|
688
|
-
partnerMetadata:
|
|
689
|
-
}), Z =
|
|
662
|
+
partnerBars: ye,
|
|
663
|
+
partnerMetadata: xe
|
|
664
|
+
}), Z = ne({
|
|
690
665
|
status: A,
|
|
691
|
-
isTopOrTopPrev:
|
|
666
|
+
isTopOrTopPrev: ut,
|
|
692
667
|
transitionName: S
|
|
693
|
-
}),
|
|
694
|
-
isActive:
|
|
695
|
-
isPrev:
|
|
696
|
-
zIndex:
|
|
668
|
+
}), _t = oe({
|
|
669
|
+
isActive: b,
|
|
670
|
+
isPrev: ce,
|
|
671
|
+
zIndex: le,
|
|
697
672
|
index: D,
|
|
698
673
|
status: A,
|
|
699
|
-
dragStatus:
|
|
700
|
-
replaceTransitionStatus:
|
|
701
|
-
}),
|
|
674
|
+
dragStatus: M,
|
|
675
|
+
replaceTransitionStatus: he
|
|
676
|
+
}), yt = p(_t), bt = p(Z !== null && _t), xt = p(null), [St, Ct] = m({
|
|
702
677
|
key: Z,
|
|
703
678
|
released: Z === null
|
|
704
679
|
});
|
|
705
|
-
|
|
680
|
+
St.key !== Z && (Ct({
|
|
706
681
|
key: Z,
|
|
707
682
|
released: Z === null
|
|
708
|
-
}),
|
|
709
|
-
let
|
|
710
|
-
d(() =>
|
|
683
|
+
}), xt.current = null, bt.current = Z !== null && yt.current), yt.current = _t;
|
|
684
|
+
let wt = Z !== null && St.key === Z && !St.released && xt.current !== Z, $ = wt ? !b && Se?.opaqueBackground ? h.PARK : b && (A === "PUSHING" || A === "REPLACING") && Se?.opaqueBackground ? Ee().parkOver ? h.PARK_OVER : h.PARK_UNDER : h.HELD : h.RELEASED, Tt = vt(Oe);
|
|
685
|
+
d(() => we.driveScreenLifecycle({
|
|
711
686
|
getElements: () => ({
|
|
712
|
-
scope:
|
|
713
|
-
decorator:
|
|
687
|
+
scope: K.current,
|
|
688
|
+
decorator: Xe.current,
|
|
714
689
|
bars: [q.current, J.current]
|
|
715
690
|
}),
|
|
716
691
|
transitionName: S,
|
|
717
|
-
prevTransitionName:
|
|
692
|
+
prevTransitionName: ue,
|
|
718
693
|
status: A,
|
|
719
|
-
isActive:
|
|
720
|
-
animHoldReleased: !
|
|
694
|
+
isActive: b,
|
|
695
|
+
animHoldReleased: !wt
|
|
721
696
|
}), [
|
|
722
|
-
|
|
697
|
+
we,
|
|
723
698
|
A,
|
|
724
|
-
|
|
725
|
-
|
|
699
|
+
b,
|
|
700
|
+
ue,
|
|
726
701
|
S,
|
|
727
|
-
|
|
702
|
+
wt
|
|
728
703
|
]), s(() => {
|
|
729
|
-
if (!
|
|
704
|
+
if (!wt || Z === null) return;
|
|
730
705
|
let e = Z, t = T.navigate.getState().transitionTaskId, n = t === null ? e : `${e}#${t}`;
|
|
731
|
-
return
|
|
732
|
-
let t =
|
|
733
|
-
if (
|
|
706
|
+
return Te.current.join(n, () => {
|
|
707
|
+
let t = Y.current.transition.driver === "native", n = Ee({ authoredNativeDriver: t }).atomicReleaseFlip;
|
|
708
|
+
if (n) {
|
|
734
709
|
for (let e of [
|
|
735
|
-
|
|
710
|
+
K.current,
|
|
736
711
|
q.current,
|
|
737
712
|
J.current,
|
|
738
|
-
|
|
739
|
-
]) e?.isConnected && e.getAttribute(
|
|
740
|
-
|
|
713
|
+
Xe.current
|
|
714
|
+
]) e?.isConnected && e.getAttribute(te) !== null && e.setAttribute(te, h.RELEASED);
|
|
715
|
+
G.current && (G.current.style.zIndex = ""), xt.current = e;
|
|
741
716
|
}
|
|
742
717
|
{
|
|
743
|
-
let
|
|
718
|
+
let t = () => Ct((t) => t.key === e && !t.released ? {
|
|
744
719
|
key: e,
|
|
745
720
|
released: !0
|
|
746
721
|
} : t);
|
|
747
|
-
|
|
722
|
+
n && Ee().deferReleaseCommit && typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => t()) : Pe(t);
|
|
748
723
|
}
|
|
749
724
|
}, {
|
|
750
|
-
scope:
|
|
751
|
-
decodeWait:
|
|
752
|
-
contentSettle:
|
|
725
|
+
scope: K.current,
|
|
726
|
+
decodeWait: bt.current,
|
|
727
|
+
contentSettle: Ee().renderSettleGate && (b && A === "PUSHING" || A === "POPPING") ? {
|
|
753
728
|
firstWaitMs: 120,
|
|
754
729
|
capMs: 700,
|
|
755
730
|
graceMs: 60,
|
|
756
|
-
minNodes:
|
|
731
|
+
minNodes: b ? 30 : 1,
|
|
757
732
|
renderSettleOnly: !0
|
|
758
733
|
} : void 0
|
|
759
734
|
});
|
|
760
735
|
}, [
|
|
761
|
-
|
|
736
|
+
wt,
|
|
762
737
|
Z,
|
|
763
|
-
|
|
764
|
-
|
|
738
|
+
$,
|
|
739
|
+
b,
|
|
765
740
|
A,
|
|
766
741
|
T.navigate
|
|
767
742
|
]);
|
|
768
|
-
let
|
|
769
|
-
initial:
|
|
770
|
-
isActive:
|
|
743
|
+
let Et = $ === h.PARK_UNDER || $ === h.PARK_OVER ? {} : me({
|
|
744
|
+
initial: je,
|
|
745
|
+
isActive: b,
|
|
771
746
|
status: A
|
|
772
747
|
});
|
|
773
|
-
return /* @__PURE__ */
|
|
774
|
-
ref:
|
|
775
|
-
onClickCapture:
|
|
748
|
+
return /* @__PURE__ */ Ne("div", {
|
|
749
|
+
ref: G,
|
|
750
|
+
onClickCapture: lt,
|
|
776
751
|
style: {
|
|
777
752
|
position: w,
|
|
778
753
|
top: 0,
|
|
@@ -780,41 +755,42 @@ function Dt({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
780
755
|
width: "100%",
|
|
781
756
|
height: "100%",
|
|
782
757
|
display: "flex",
|
|
783
|
-
zIndex:
|
|
758
|
+
zIndex: $ === h.PARK_UNDER ? -1 : void 0,
|
|
784
759
|
contain: "layout style",
|
|
785
760
|
flexDirection: "column",
|
|
786
761
|
boxSizing: "border-box",
|
|
787
762
|
overscrollBehavior: "contain"
|
|
788
763
|
},
|
|
789
764
|
children: [
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
ref:
|
|
792
|
-
...
|
|
793
|
-
onPointerDown:
|
|
794
|
-
onPointerMove:
|
|
795
|
-
onPointerUp:
|
|
796
|
-
onPointerCancel:
|
|
765
|
+
/* @__PURE__ */ Ne("div", {
|
|
766
|
+
ref: K,
|
|
767
|
+
...v,
|
|
768
|
+
onPointerDown: it,
|
|
769
|
+
onPointerMove: at,
|
|
770
|
+
onPointerUp: ot,
|
|
771
|
+
onPointerCancel: st,
|
|
772
|
+
onLostPointerCapture: ct,
|
|
797
773
|
"data-flemo-screen": !0,
|
|
798
774
|
"data-flemo-router": E ?? void 0,
|
|
799
775
|
"data-flemo-transition": S,
|
|
800
776
|
"data-flemo-status": A,
|
|
801
|
-
"data-flemo-active":
|
|
802
|
-
"data-flemo-anim-hold":
|
|
777
|
+
"data-flemo-active": b ? "true" : "false",
|
|
778
|
+
"data-flemo-anim-hold": $,
|
|
803
779
|
style: {
|
|
804
780
|
display: "flex",
|
|
805
781
|
flexDirection: "column",
|
|
806
782
|
height: "100%",
|
|
807
|
-
backgroundColor:
|
|
808
|
-
overflowY:
|
|
783
|
+
backgroundColor: _,
|
|
784
|
+
overflowY: se ? void 0 : "auto",
|
|
809
785
|
touchAction: Me === "x" ? "pan-y" : Me === "y" ? "pan-x" : "auto",
|
|
810
|
-
...
|
|
811
|
-
...
|
|
812
|
-
...
|
|
786
|
+
...Tt && le === D && !C ? { willChange: "transform" } : {},
|
|
787
|
+
...Et,
|
|
788
|
+
...v.style
|
|
813
789
|
},
|
|
814
790
|
children: [
|
|
815
|
-
!
|
|
791
|
+
!ie && t && /* @__PURE__ */ P("div", {
|
|
816
792
|
style: { minHeight: t },
|
|
817
|
-
children: /* @__PURE__ */
|
|
793
|
+
children: /* @__PURE__ */ P("div", { style: {
|
|
818
794
|
position: w,
|
|
819
795
|
top: 0,
|
|
820
796
|
width: "100%",
|
|
@@ -822,40 +798,40 @@ function Dt({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
822
798
|
backgroundColor: n
|
|
823
799
|
} })
|
|
824
800
|
}),
|
|
825
|
-
c && /* @__PURE__ */
|
|
826
|
-
ref:
|
|
801
|
+
c && /* @__PURE__ */ P("div", {
|
|
802
|
+
ref: Ze,
|
|
827
803
|
"data-flemo-bar-spacer": "app",
|
|
828
804
|
style: {
|
|
829
805
|
width: "100%",
|
|
830
|
-
minHeight:
|
|
806
|
+
minHeight: Je
|
|
831
807
|
}
|
|
832
808
|
}),
|
|
833
809
|
ee,
|
|
834
|
-
/* @__PURE__ */
|
|
810
|
+
/* @__PURE__ */ P("div", {
|
|
835
811
|
style: {
|
|
836
812
|
display: "flex",
|
|
837
813
|
flexDirection: "column",
|
|
838
814
|
flexGrow: 1,
|
|
839
|
-
overflowY:
|
|
815
|
+
overflowY: se ? "auto" : void 0
|
|
840
816
|
},
|
|
841
817
|
children: e
|
|
842
818
|
}),
|
|
843
|
-
|
|
844
|
-
u && /* @__PURE__ */
|
|
845
|
-
ref:
|
|
819
|
+
re,
|
|
820
|
+
u && /* @__PURE__ */ P("div", {
|
|
821
|
+
ref: Qe,
|
|
846
822
|
"data-flemo-bar-spacer": "nav",
|
|
847
823
|
style: {
|
|
848
|
-
display:
|
|
824
|
+
display: Le ? "none" : void 0,
|
|
849
825
|
width: "100%",
|
|
850
|
-
minHeight:
|
|
826
|
+
minHeight: Ye
|
|
851
827
|
}
|
|
852
828
|
}),
|
|
853
|
-
!
|
|
829
|
+
!g && r && /* @__PURE__ */ P("div", {
|
|
854
830
|
style: {
|
|
855
|
-
display:
|
|
831
|
+
display: Le ? "none" : void 0,
|
|
856
832
|
minHeight: r
|
|
857
833
|
},
|
|
858
|
-
children: /* @__PURE__ */
|
|
834
|
+
children: /* @__PURE__ */ P("div", { style: {
|
|
859
835
|
position: w,
|
|
860
836
|
bottom: 0,
|
|
861
837
|
width: "100%",
|
|
@@ -865,58 +841,58 @@ function Dt({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
865
841
|
})
|
|
866
842
|
]
|
|
867
843
|
}),
|
|
868
|
-
c && /* @__PURE__ */
|
|
869
|
-
ref:
|
|
844
|
+
c && /* @__PURE__ */ P("div", {
|
|
845
|
+
ref: tt,
|
|
870
846
|
"data-flemo-bar": "app",
|
|
871
847
|
"data-flemo-bar-id": l,
|
|
872
848
|
"data-flemo-bar-id-type": l === void 0 ? void 0 : typeof l,
|
|
873
849
|
"data-flemo-router": E ?? void 0,
|
|
874
850
|
"data-flemo-bar-transition": S,
|
|
875
851
|
"data-flemo-bar-status": A,
|
|
876
|
-
"data-flemo-bar-active":
|
|
877
|
-
"data-flemo-bar-riding":
|
|
878
|
-
"data-flemo-anim-hold":
|
|
852
|
+
"data-flemo-bar-active": b ? "true" : "false",
|
|
853
|
+
"data-flemo-bar-riding": dt ? "true" : "false",
|
|
854
|
+
"data-flemo-anim-hold": $,
|
|
879
855
|
style: {
|
|
880
856
|
position: w,
|
|
881
|
-
top:
|
|
857
|
+
top: ie ? 0 : t,
|
|
882
858
|
left: 0,
|
|
883
859
|
width: "100%",
|
|
884
860
|
zIndex: 1
|
|
885
861
|
},
|
|
886
862
|
children: c
|
|
887
863
|
}),
|
|
888
|
-
u && /* @__PURE__ */
|
|
889
|
-
ref:
|
|
864
|
+
u && /* @__PURE__ */ P("div", {
|
|
865
|
+
ref: nt,
|
|
890
866
|
"data-flemo-bar": "nav",
|
|
891
867
|
"data-flemo-bar-id": f,
|
|
892
868
|
"data-flemo-bar-id-type": f === void 0 ? void 0 : typeof f,
|
|
893
869
|
"data-flemo-router": E ?? void 0,
|
|
894
870
|
"data-flemo-bar-transition": S,
|
|
895
871
|
"data-flemo-bar-status": A,
|
|
896
|
-
"data-flemo-bar-active":
|
|
897
|
-
"data-flemo-bar-riding":
|
|
898
|
-
"data-flemo-anim-hold":
|
|
872
|
+
"data-flemo-bar-active": b ? "true" : "false",
|
|
873
|
+
"data-flemo-bar-riding": ft ? "true" : "false",
|
|
874
|
+
"data-flemo-anim-hold": $,
|
|
899
875
|
style: {
|
|
900
|
-
display:
|
|
876
|
+
display: Le ? "none" : void 0,
|
|
901
877
|
position: w,
|
|
902
|
-
bottom:
|
|
878
|
+
bottom: g ? 0 : r,
|
|
903
879
|
left: 0,
|
|
904
880
|
width: "100%",
|
|
905
881
|
zIndex: 1
|
|
906
882
|
},
|
|
907
883
|
children: u
|
|
908
884
|
}),
|
|
909
|
-
|
|
910
|
-
ref:
|
|
911
|
-
"data-flemo-anim-hold":
|
|
885
|
+
Ie && /* @__PURE__ */ P(ht, {
|
|
886
|
+
ref: Xe,
|
|
887
|
+
"data-flemo-anim-hold": $
|
|
912
888
|
})
|
|
913
889
|
]
|
|
914
890
|
});
|
|
915
891
|
}
|
|
916
892
|
//#endregion
|
|
917
893
|
//#region src/screen/Screen.tsx
|
|
918
|
-
function
|
|
919
|
-
let { isActive: n, isPrev: r, zIndex: i } =
|
|
894
|
+
function bt({ children: e, ...t }) {
|
|
895
|
+
let { isActive: n, isPrev: r, zIndex: i } = L(), a = U((e) => e.index), o = mt((e) => e.status), c = Q((e) => e.dragStatus), l = Q((e) => e.replaceTransitionStatus), u = g({
|
|
920
896
|
isActive: n,
|
|
921
897
|
isPrev: r,
|
|
922
898
|
zIndex: i,
|
|
@@ -927,22 +903,22 @@ function Ot({ children: e, ...t }) {
|
|
|
927
903
|
}), [d, f] = m(u !== "live");
|
|
928
904
|
return u === "live" && d && f(!1), u === "immediate" && !d && f(!0), s(() => {
|
|
929
905
|
if (u !== "deferred" || d) return;
|
|
930
|
-
let e = setTimeout(() => f(!0),
|
|
906
|
+
let e = setTimeout(() => f(!0), xt);
|
|
931
907
|
return () => clearTimeout(e);
|
|
932
|
-
}, [u, d]), /* @__PURE__ */
|
|
908
|
+
}, [u, d]), /* @__PURE__ */ P(dt, {
|
|
933
909
|
freeze: d,
|
|
934
|
-
children: /* @__PURE__ */
|
|
910
|
+
children: /* @__PURE__ */ P(yt, {
|
|
935
911
|
...t,
|
|
936
912
|
children: e
|
|
937
913
|
})
|
|
938
914
|
});
|
|
939
915
|
}
|
|
940
|
-
var
|
|
916
|
+
var xt = 600;
|
|
941
917
|
//#endregion
|
|
942
918
|
//#region src/screen/Part.tsx
|
|
943
|
-
function
|
|
944
|
-
let { isActive: a, isPrev: s, navigateStore: c, routerId: l } =
|
|
945
|
-
return /* @__PURE__ */
|
|
919
|
+
function St({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
920
|
+
let { isActive: a, isPrev: s, navigateStore: c, routerId: l } = L(), u = o(Re), d = l ?? u ?? void 0, f = F(), p = H(c ?? f.navigate, (e) => s ? "COMPLETED" : e.status);
|
|
921
|
+
return /* @__PURE__ */ P("div", {
|
|
946
922
|
ref: e,
|
|
947
923
|
"data-flemo-part-name": t,
|
|
948
924
|
"data-flemo-router": d,
|
|
@@ -955,21 +931,21 @@ function At({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
|
955
931
|
}
|
|
956
932
|
//#endregion
|
|
957
933
|
//#region src/stores/RouterScopeProvider.tsx
|
|
958
|
-
function
|
|
934
|
+
function Ct({ children: e }) {
|
|
959
935
|
let [t] = m(() => ({
|
|
960
|
-
history:
|
|
961
|
-
navigate:
|
|
936
|
+
history: x(),
|
|
937
|
+
navigate: ce(),
|
|
962
938
|
transition: A(),
|
|
963
939
|
screen: D(),
|
|
964
|
-
driver:
|
|
965
|
-
markSelfInduced:
|
|
966
|
-
consume:
|
|
940
|
+
driver: y(),
|
|
941
|
+
markSelfInduced: N,
|
|
942
|
+
consume: _,
|
|
967
943
|
life: { alive: !0 }
|
|
968
944
|
}));
|
|
969
|
-
return /* @__PURE__ */
|
|
945
|
+
return /* @__PURE__ */ P(Fe.Provider, {
|
|
970
946
|
value: t,
|
|
971
947
|
children: e
|
|
972
948
|
});
|
|
973
949
|
}
|
|
974
950
|
//#endregion
|
|
975
|
-
export {
|
|
951
|
+
export { St as Part, it as Route, X as Router, Ct as RouterScopeProvider, bt as Screen, I as ScreenContext, ht as ScreenDecorator, dt as ScreenFreeze, yt as ScreenMotion, q as Slot, v as createBrowserHistoryDriver, b as createDecorator, S as createPartTransition, ue as createRawDecorator, C as createRawPartTransition, w as createRawTransition, k as createTransition, Se as partTransitionMap, U as useHistoryStore, ot as useNavigate, mt as useNavigateStore, lt as useParams, st as usePathname, L as useScreen, Q as useScreenStore, ct as useStep, F as useStores, gt as useViewportScrollHeight };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemo/react",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.8",
|
|
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.30.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@testing-library/jest-dom": "^6.9.1",
|
|
File without changes
|