@flemo/react 1.3.2 → 1.4.1
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/Router.d.ts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +278 -652
- package/dist/navigate/useNavigate.d.ts +6 -8
- package/dist/screen/Part.d.ts +7 -0
- package/dist/screen/store.d.ts +2 -16
- package/dist/transition/styles.d.ts +2 -2
- package/package.json +4 -4
- package/dist/transition/__tests__/animateInline.test.d.ts +0 -1
- package/dist/transition/animateInline.d.ts +0 -4
- /package/dist/screen/__tests__/{store.test.d.ts → Part.test.d.ts} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,57 +1,24 @@
|
|
|
1
1
|
import e, { Children as t, createContext as n, useContext as r, useEffect as i, useImperativeHandle as a, useInsertionEffect as o, useLayoutEffect as s, useReducer as c, useRef as l, useState as u } from "react";
|
|
2
|
-
import { TaskManger as d,
|
|
3
|
-
import { jsx as
|
|
2
|
+
import { TaskManger as d, applyTransitionStyles as f, computeScreenFreeze as p, createDecorator as m, createHistoryStore as h, createHistorySync as g, createNavigateStore as _, createNavigationController as v, createPartTransition as y, createRawDecorator as b, createRawPartTransition as ee, createRawTransition as x, createScreenSelector as te, createScreenStore as S, createSwipeController as ne, createTransition as C, createTransitionEngine as re, createTransitionStore as w, decoratorMap as T, driveBarRiding as ie, ensureWindowHistoryState as E, getMatchedPathPattern as ae, isServer as D, markSelfInducedPop as oe, partTransitionMap as O, partTransitionMap as k, seedInitialHistory as A, transitionMap as j } from "@flemo/core";
|
|
3
|
+
import { jsx as M, jsxs as se } from "react/jsx-runtime";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
|
-
var
|
|
5
|
+
var ce = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), N = n(null);
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/stores/useStores.ts
|
|
8
|
-
function
|
|
9
|
-
let e = r(
|
|
8
|
+
function P() {
|
|
9
|
+
let e = r(N);
|
|
10
10
|
if (!e) throw Error("flemo stores are missing. Render inside a <Router>.");
|
|
11
11
|
return e;
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/history/HistoryListener.tsx
|
|
15
|
-
function
|
|
16
|
-
let e =
|
|
17
|
-
return i(() => {
|
|
18
|
-
let t = async (t) => {
|
|
19
|
-
if (h()) return;
|
|
20
|
-
let n = t.state?.id, r = d.generateTaskId();
|
|
21
|
-
(await d.addTask(async (i) => {
|
|
22
|
-
let a = t.state?.index, o = t.state?.status, s = t.state?.params, c = t.state?.transitionName, l = t.state?.layoutId, { setStatus: u, setTransitionTaskId: d } = e.navigate.getState(), { index: f, addHistory: p, popHistory: m } = e.history.getState(), h = a < f, g = o === "PUSHING" && a > f, _ = o === "REPLACING" && a > f, v = window.location.pathname;
|
|
23
|
-
if (!h && !g && !_) {
|
|
24
|
-
i.abort();
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
return d(r), h ? u("POPPING") : g ? (u("PUSHING"), p({
|
|
28
|
-
id: n,
|
|
29
|
-
pathname: v,
|
|
30
|
-
params: s,
|
|
31
|
-
transitionName: c,
|
|
32
|
-
layoutId: l
|
|
33
|
-
})) : _ && (u("REPLACING"), p({
|
|
34
|
-
id: n,
|
|
35
|
-
pathname: v,
|
|
36
|
-
params: s,
|
|
37
|
-
transitionName: c,
|
|
38
|
-
layoutId: l
|
|
39
|
-
})), async () => {
|
|
40
|
-
h && m(a + 1), u("COMPLETED");
|
|
41
|
-
};
|
|
42
|
-
}, {
|
|
43
|
-
id: r,
|
|
44
|
-
control: { manual: !0 }
|
|
45
|
-
})).result?.();
|
|
46
|
-
};
|
|
47
|
-
return window.addEventListener("popstate", t), () => {
|
|
48
|
-
window.removeEventListener("popstate", t);
|
|
49
|
-
};
|
|
50
|
-
}, [e]), null;
|
|
15
|
+
function F() {
|
|
16
|
+
let e = P();
|
|
17
|
+
return i(() => g({ stores: e }), [e]), null;
|
|
51
18
|
}
|
|
52
19
|
//#endregion
|
|
53
20
|
//#region src/screen/ScreenContext.ts
|
|
54
|
-
var
|
|
21
|
+
var I = (/* @__PURE__ */ ce(((e) => {
|
|
55
22
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.PathError = e.TokenData = void 0, e.parse = c, e.compile = l, e.pathToRegexp = f;
|
|
56
23
|
var t = "/", n = (e) => e, r = /^[$_\p{ID_Start}]$/u, i = /^[$\u200c\u200d\p{ID_Continue}]$/u;
|
|
57
24
|
function a(e) {
|
|
@@ -238,7 +205,7 @@ var O = (/* @__PURE__ */ le(((e) => {
|
|
|
238
205
|
function h(e, t) {
|
|
239
206
|
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)}]`);
|
|
240
207
|
}
|
|
241
|
-
})))(),
|
|
208
|
+
})))(), L = n({
|
|
242
209
|
id: "",
|
|
243
210
|
isActive: !1,
|
|
244
211
|
isRoot: !0,
|
|
@@ -253,15 +220,15 @@ var O = (/* @__PURE__ */ le(((e) => {
|
|
|
253
220
|
});
|
|
254
221
|
//#endregion
|
|
255
222
|
//#region src/screen/useScreen.ts
|
|
256
|
-
function
|
|
257
|
-
return r(
|
|
223
|
+
function R() {
|
|
224
|
+
return r(L);
|
|
258
225
|
}
|
|
259
226
|
//#endregion
|
|
260
227
|
//#region src/screen/ParamsProvider/ParamsContext.ts
|
|
261
|
-
var
|
|
228
|
+
var le = n({}), z = n(() => {});
|
|
262
229
|
//#endregion
|
|
263
230
|
//#region src/screen/ParamsProvider/ParamsReducer.ts
|
|
264
|
-
function
|
|
231
|
+
function ue(e, t) {
|
|
265
232
|
switch (t.type) {
|
|
266
233
|
case "SET": return t.params;
|
|
267
234
|
default: return e;
|
|
@@ -269,8 +236,8 @@ function de(e, t) {
|
|
|
269
236
|
}
|
|
270
237
|
//#endregion
|
|
271
238
|
//#region src/screen/ParamsProvider/ParamsProvider.tsx
|
|
272
|
-
function
|
|
273
|
-
let { isActive: t, params: n } =
|
|
239
|
+
function B({ children: e }) {
|
|
240
|
+
let { isActive: t, params: n } = R(), [r, a] = c(ue, n);
|
|
274
241
|
return i(() => {
|
|
275
242
|
let e = async (e) => {
|
|
276
243
|
e.state?.step && await d.addTask(async () => {
|
|
@@ -283,143 +250,92 @@ function fe({ children: e }) {
|
|
|
283
250
|
return t && window.addEventListener("popstate", e), () => {
|
|
284
251
|
window.removeEventListener("popstate", e);
|
|
285
252
|
};
|
|
286
|
-
}, [t, a]), /* @__PURE__ */
|
|
253
|
+
}, [t, a]), /* @__PURE__ */ M(z.Provider, {
|
|
287
254
|
value: a,
|
|
288
|
-
children: /* @__PURE__ */
|
|
255
|
+
children: /* @__PURE__ */ M(le.Provider, {
|
|
289
256
|
value: r,
|
|
290
257
|
children: e
|
|
291
258
|
})
|
|
292
259
|
});
|
|
293
260
|
}
|
|
294
261
|
//#endregion
|
|
295
|
-
//#region ../../node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.17_react@19.2.7/node_modules/zustand/esm/
|
|
296
|
-
var
|
|
297
|
-
|
|
298
|
-
let i = typeof e == "function" ? e(t) : e;
|
|
299
|
-
if (!Object.is(i, t)) {
|
|
300
|
-
let e = t;
|
|
301
|
-
t = r ?? (typeof i != "object" || !i) ? i : Object.assign({}, t, i), n.forEach((n) => n(t, e));
|
|
302
|
-
}
|
|
303
|
-
}, i = () => t, a = {
|
|
304
|
-
setState: r,
|
|
305
|
-
getState: i,
|
|
306
|
-
getInitialState: () => o,
|
|
307
|
-
subscribe: (e) => (n.add(e), () => n.delete(e))
|
|
308
|
-
}, o = t = e(r, i, a);
|
|
309
|
-
return a;
|
|
310
|
-
}, pe = ((e) => e ? N(e) : N), me = (e) => e;
|
|
311
|
-
function P(t, n = me) {
|
|
262
|
+
//#region ../../node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.17_react@19.2.7/node_modules/zustand/esm/react.mjs
|
|
263
|
+
var V = (e) => e;
|
|
264
|
+
function H(t, n = V) {
|
|
312
265
|
let r = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), e.useCallback(() => n(t.getInitialState()), [t, n]));
|
|
313
266
|
return e.useDebugValue(r), r;
|
|
314
267
|
}
|
|
315
268
|
//#endregion
|
|
316
269
|
//#region src/stores/useHistoryStore.ts
|
|
317
|
-
function
|
|
318
|
-
return P(
|
|
270
|
+
function U(e) {
|
|
271
|
+
return H(P().history, e);
|
|
319
272
|
}
|
|
320
273
|
//#endregion
|
|
321
274
|
//#region src/renderer/Renderer.tsx
|
|
322
|
-
function
|
|
323
|
-
let n =
|
|
324
|
-
return
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
prevTransitionName: r[n - 1]?.transitionName,
|
|
335
|
-
layoutId: r[t].layoutId,
|
|
336
|
-
routePath: ae(e.props.path, r[t].pathname)
|
|
337
|
-
},
|
|
338
|
-
children: /* @__PURE__ */ T(fe, { children: e })
|
|
339
|
-
}, r[t].id));
|
|
340
|
-
}
|
|
341
|
-
//#endregion
|
|
342
|
-
//#region src/screen/store.ts
|
|
343
|
-
function ge() {
|
|
344
|
-
return pe((e) => ({
|
|
345
|
-
dragStatus: "IDLE",
|
|
346
|
-
replaceTransitionStatus: "IDLE",
|
|
347
|
-
sharedBars: {},
|
|
348
|
-
setDragStatus: (t) => e({ dragStatus: t }),
|
|
349
|
-
setReplaceTransitionStatus: (t) => e({ replaceTransitionStatus: t }),
|
|
350
|
-
registerSharedBars: (t, n) => e((e) => ({ sharedBars: {
|
|
351
|
-
...e.sharedBars,
|
|
352
|
-
[t]: n
|
|
353
|
-
} })),
|
|
354
|
-
unregisterSharedBars: (t) => e((e) => {
|
|
355
|
-
let n = { ...e.sharedBars };
|
|
356
|
-
return delete n[t], { sharedBars: n };
|
|
357
|
-
})
|
|
358
|
-
}));
|
|
275
|
+
function W({ children: e }) {
|
|
276
|
+
let n = U((e) => e.index);
|
|
277
|
+
return te(U((e) => e.histories), n).map((n) => {
|
|
278
|
+
let [r] = t.toArray(e).filter((e) => (0, I.pathToRegexp)(e.props.path).regexp.test(n.pathname));
|
|
279
|
+
return /* @__PURE__ */ M(L.Provider, {
|
|
280
|
+
value: {
|
|
281
|
+
...n,
|
|
282
|
+
routePath: ae(r.props.path, n.pathname)
|
|
283
|
+
},
|
|
284
|
+
children: /* @__PURE__ */ M(B, { children: r })
|
|
285
|
+
}, n.id);
|
|
286
|
+
});
|
|
359
287
|
}
|
|
360
288
|
//#endregion
|
|
361
289
|
//#region src/transition/styles.ts
|
|
362
|
-
|
|
363
|
-
if (oe()) return;
|
|
364
|
-
let e = m(w.values(), ne.values()), t = document.head.querySelector(`style[${_e}]`);
|
|
365
|
-
t || (t = document.createElement("style"), t.setAttribute(_e, ""), document.head.appendChild(t)), t.textContent !== e && (t.textContent = e);
|
|
366
|
-
};
|
|
367
|
-
function L(e, t) {
|
|
290
|
+
function G(e, t, n = []) {
|
|
368
291
|
o(() => {
|
|
369
|
-
for (let t of e)
|
|
370
|
-
for (let e of t)
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
for (let
|
|
374
|
-
|
|
292
|
+
for (let t of e) j.set(t.name, t);
|
|
293
|
+
for (let e of t) T.set(e.name, e);
|
|
294
|
+
for (let e of n) k.set(e.name, e);
|
|
295
|
+
return f(), () => {
|
|
296
|
+
for (let t of e) j.delete(t.name);
|
|
297
|
+
for (let e of t) T.delete(e.name);
|
|
298
|
+
for (let e of n) k.delete(e.name);
|
|
299
|
+
f();
|
|
375
300
|
};
|
|
376
|
-
}, [
|
|
301
|
+
}, [
|
|
302
|
+
e,
|
|
303
|
+
t,
|
|
304
|
+
n
|
|
305
|
+
]);
|
|
377
306
|
}
|
|
378
307
|
//#endregion
|
|
379
308
|
//#region src/Router.tsx
|
|
380
|
-
var
|
|
381
|
-
function
|
|
382
|
-
let
|
|
383
|
-
let n =
|
|
384
|
-
|
|
385
|
-
pathname: c,
|
|
386
|
-
params: x(t.toArray(e).map((e) => e.props.path).flat(), c, l),
|
|
387
|
-
transitionName: a,
|
|
388
|
-
layoutId: null
|
|
389
|
-
};
|
|
390
|
-
return d ? (d.history.getState().index === -1 && d.history.setState({
|
|
309
|
+
var K = [], q = [], J = [];
|
|
310
|
+
function Y({ children: e, initPath: n = "/", defaultTransitionName: a = "cupertino", transitions: o = K, decorators: s = q, partTransitions: c = J }) {
|
|
311
|
+
let l = D() ? n || "/" : window.location.pathname, d = D() ? l.split("?")[1] || "" : window.location.search, f = r(N), [p] = u(() => {
|
|
312
|
+
let n = A(t.toArray(e).map((e) => e.props.path).flat(), l, d, a);
|
|
313
|
+
return f ? (f.history.getState().index === -1 && f.history.setState({
|
|
391
314
|
index: 0,
|
|
392
315
|
histories: [n]
|
|
393
|
-
}),
|
|
394
|
-
history:
|
|
395
|
-
navigate:
|
|
396
|
-
transition:
|
|
397
|
-
screen:
|
|
316
|
+
}), f) : {
|
|
317
|
+
history: h([n], 0),
|
|
318
|
+
navigate: _(),
|
|
319
|
+
transition: w(a),
|
|
320
|
+
screen: S()
|
|
398
321
|
};
|
|
399
322
|
});
|
|
400
|
-
return
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
params: {},
|
|
406
|
-
transitionName: a,
|
|
407
|
-
layoutId: null
|
|
408
|
-
}, "", window.location.href);
|
|
409
|
-
}, [a]), /* @__PURE__ */ ce(E.Provider, {
|
|
410
|
-
value: f,
|
|
411
|
-
children: [/* @__PURE__ */ T(ue, {}), /* @__PURE__ */ T(he, { children: e })]
|
|
323
|
+
return p.transition.setState({ defaultTransitionName: a }), G(o, s, c), i(() => {
|
|
324
|
+
E(a);
|
|
325
|
+
}, [a]), /* @__PURE__ */ se(N.Provider, {
|
|
326
|
+
value: p,
|
|
327
|
+
children: [/* @__PURE__ */ M(F, {}), /* @__PURE__ */ M(W, { children: e })]
|
|
412
328
|
});
|
|
413
329
|
}
|
|
414
330
|
//#endregion
|
|
415
331
|
//#region src/Route.tsx
|
|
416
|
-
function
|
|
332
|
+
function de({ element: e }) {
|
|
417
333
|
return e;
|
|
418
334
|
}
|
|
419
335
|
//#endregion
|
|
420
336
|
//#region src/utils/buildRoutePath.ts
|
|
421
|
-
function
|
|
422
|
-
let n = t ?? {}, r = (0,
|
|
337
|
+
function X(e, t) {
|
|
338
|
+
let n = t ?? {}, r = (0, I.compile)(e)(Object.fromEntries(Object.entries(n).map(([e, t]) => [e, String(t)]))), i = (typeof e == "string" ? (0, I.parse)(e) : e).tokens.filter((e) => e.type === "param").map((e) => e.name), a = Object.fromEntries(Object.entries(n).filter(([e]) => !i.includes(e))), o = new URLSearchParams(a).toString();
|
|
423
339
|
return {
|
|
424
340
|
pathname: `${r}${o ? `?${o}` : ""}`,
|
|
425
341
|
toPathname: r
|
|
@@ -427,170 +343,25 @@ function H(e, t) {
|
|
|
427
343
|
}
|
|
428
344
|
//#endregion
|
|
429
345
|
//#region src/navigate/useNavigate.ts
|
|
430
|
-
|
|
431
|
-
let
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
let n, r = new Promise((e) => {
|
|
436
|
-
n = () => e(!0), window.addEventListener("popstate", n, { once: !0 });
|
|
437
|
-
}), i = new Promise((e) => setTimeout(() => e(!1), 200));
|
|
438
|
-
if (S(), window.history.go(-e), !await Promise.race([r, i])) {
|
|
439
|
-
window.removeEventListener("popstate", n);
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
t();
|
|
443
|
-
};
|
|
444
|
-
function G() {
|
|
445
|
-
let e = D(), t = async (t, n, r) => {
|
|
446
|
-
let { status: i } = e.navigate.getState();
|
|
447
|
-
if (i !== "COMPLETED" && i !== "IDLE") return;
|
|
448
|
-
let a = e.transition.getState().defaultTransitionName, { transitionName: o = a, layoutId: s = null } = r ?? {}, c = d.generateTaskId();
|
|
449
|
-
(await d.addTask(async () => {
|
|
450
|
-
let { index: i, histories: a, addHistory: l, popHistories: u } = e.history.getState(), d = (() => {
|
|
451
|
-
if (r?.until != null) {
|
|
452
|
-
let e = U(r.until, i, a);
|
|
453
|
-
return e < 0 ? 0 : e;
|
|
454
|
-
}
|
|
455
|
-
return Math.min(ve(r?.skip, 0), Math.max(0, i));
|
|
456
|
-
})(), { setStatus: f, setTransitionTaskId: p } = e.navigate.getState();
|
|
457
|
-
f("PUSHING"), p(c);
|
|
458
|
-
let { pathname: m, toPathname: h } = H(t, n ?? {}), g = {
|
|
459
|
-
id: c,
|
|
460
|
-
pathname: h,
|
|
461
|
-
params: n ?? {},
|
|
462
|
-
transitionName: o,
|
|
463
|
-
layoutId: s
|
|
464
|
-
};
|
|
465
|
-
return d === 0 ? (window.history.pushState({
|
|
466
|
-
id: c,
|
|
467
|
-
index: i + 1,
|
|
468
|
-
status: "PUSHING",
|
|
469
|
-
params: n,
|
|
470
|
-
transitionName: o,
|
|
471
|
-
layoutId: s
|
|
472
|
-
}, "", m), l(g), () => {
|
|
473
|
-
f("COMPLETED");
|
|
474
|
-
}) : (l(g), await W(d, () => {
|
|
475
|
-
window.history.pushState({
|
|
476
|
-
id: c,
|
|
477
|
-
index: e.history.getState().index - d,
|
|
478
|
-
status: "PUSHING",
|
|
479
|
-
params: n,
|
|
480
|
-
transitionName: o,
|
|
481
|
-
layoutId: s
|
|
482
|
-
}, "", m);
|
|
483
|
-
}), async () => {
|
|
484
|
-
u(d), f("COMPLETED");
|
|
485
|
-
});
|
|
486
|
-
}, {
|
|
487
|
-
id: c,
|
|
488
|
-
control: { manual: !0 }
|
|
489
|
-
})).result?.();
|
|
490
|
-
}, n = async (t, n, r) => {
|
|
491
|
-
let { status: i } = e.navigate.getState();
|
|
492
|
-
if (i !== "COMPLETED" && i !== "IDLE") return;
|
|
493
|
-
let a = e.transition.getState().defaultTransitionName, { transitionName: o = a, layoutId: s = null } = r ?? {}, c = d.generateTaskId();
|
|
494
|
-
(await d.addTask(async (i) => {
|
|
495
|
-
let { index: a, histories: l, addHistory: u, replaceHistory: d, popHistories: f } = e.history.getState(), p = (() => {
|
|
496
|
-
if (r?.until != null) {
|
|
497
|
-
let e = U(r.until, a, l);
|
|
498
|
-
return e < 0 ? 0 : e + 1;
|
|
499
|
-
}
|
|
500
|
-
return Math.min(ve(r?.skip, 0) + 1, a + 1);
|
|
501
|
-
})();
|
|
502
|
-
if (p <= 0) {
|
|
503
|
-
i.abort();
|
|
504
|
-
return;
|
|
505
|
-
}
|
|
506
|
-
let { setStatus: m, setTransitionTaskId: h } = e.navigate.getState();
|
|
507
|
-
m("REPLACING"), h(c);
|
|
508
|
-
let { pathname: g, toPathname: _ } = H(t, n ?? {}), v = {
|
|
509
|
-
id: c,
|
|
510
|
-
pathname: _,
|
|
511
|
-
params: n ?? {},
|
|
512
|
-
transitionName: o,
|
|
513
|
-
layoutId: s
|
|
514
|
-
};
|
|
515
|
-
return p === 1 ? (window.history.replaceState({
|
|
516
|
-
id: c,
|
|
517
|
-
index: a,
|
|
518
|
-
status: "REPLACING",
|
|
519
|
-
params: n,
|
|
520
|
-
transitionName: o,
|
|
521
|
-
layoutId: s
|
|
522
|
-
}, "", g), u(v), async () => {
|
|
523
|
-
d(a), m("COMPLETED");
|
|
524
|
-
}) : (f(p - 1), u(v), p <= a ? await W(p, () => {
|
|
525
|
-
window.history.pushState({
|
|
526
|
-
id: c,
|
|
527
|
-
index: e.history.getState().index - 1,
|
|
528
|
-
status: "REPLACING",
|
|
529
|
-
params: n,
|
|
530
|
-
transitionName: o,
|
|
531
|
-
layoutId: s
|
|
532
|
-
}, "", g);
|
|
533
|
-
}) : await W(a, () => {
|
|
534
|
-
window.history.replaceState({
|
|
535
|
-
id: c,
|
|
536
|
-
index: 0,
|
|
537
|
-
status: "REPLACING",
|
|
538
|
-
params: n,
|
|
539
|
-
transitionName: o,
|
|
540
|
-
layoutId: s
|
|
541
|
-
}, "", g);
|
|
542
|
-
}), async () => {
|
|
543
|
-
d(e.history.getState().index - 1), m("COMPLETED");
|
|
544
|
-
});
|
|
545
|
-
}, {
|
|
546
|
-
id: c,
|
|
547
|
-
control: { manual: !0 }
|
|
548
|
-
})).result?.();
|
|
549
|
-
}, r = async (t, n) => {
|
|
550
|
-
let r = d.generateTaskId();
|
|
551
|
-
(await d.addTask(async (i) => {
|
|
552
|
-
let { index: a, histories: o, popHistory: s, popHistories: c, setTransitionName: l } = e.history.getState();
|
|
553
|
-
if (a <= 0) {
|
|
554
|
-
i.abort();
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
let u = Math.min(t(a, o), a);
|
|
558
|
-
if (u <= 0) {
|
|
559
|
-
i.abort();
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
let { setStatus: d, setTransitionTaskId: f } = e.navigate.getState();
|
|
563
|
-
return n && l(a, n), d("POPPING"), f(r), c(u - 1), S(), u === 1 ? window.history.back() : window.history.go(-u), async () => {
|
|
564
|
-
s(e.history.getState().index), d("COMPLETED");
|
|
565
|
-
};
|
|
566
|
-
}, {
|
|
567
|
-
id: r,
|
|
568
|
-
control: { manual: !0 }
|
|
569
|
-
})).result?.();
|
|
570
|
-
};
|
|
346
|
+
function fe() {
|
|
347
|
+
let e = v({
|
|
348
|
+
stores: P(),
|
|
349
|
+
buildPathname: (e, t) => X(e, t)
|
|
350
|
+
});
|
|
571
351
|
return {
|
|
572
|
-
push: t,
|
|
573
|
-
replace: n,
|
|
574
|
-
pop:
|
|
575
|
-
await r((t, n) => {
|
|
576
|
-
if (e?.until != null) {
|
|
577
|
-
let r = U(e.until, t, n);
|
|
578
|
-
return r < 0 ? 0 : r;
|
|
579
|
-
}
|
|
580
|
-
let r = ve(e?.skip, 1);
|
|
581
|
-
return r <= 0 ? 0 : Math.min(r, t);
|
|
582
|
-
}, e?.transitionName);
|
|
583
|
-
}
|
|
352
|
+
push: (t, n, r) => e.push(t, n ?? {}, r),
|
|
353
|
+
replace: (t, n, r) => e.replace(t, n ?? {}, r),
|
|
354
|
+
pop: (t) => e.pop(t)
|
|
584
355
|
};
|
|
585
356
|
}
|
|
586
357
|
//#endregion
|
|
587
358
|
//#region src/navigate/useStep.ts
|
|
588
|
-
function
|
|
589
|
-
let { routePath: e } =
|
|
359
|
+
function pe() {
|
|
360
|
+
let { routePath: e } = R(), t = P(), n = r(z);
|
|
590
361
|
return {
|
|
591
362
|
pushStep: async (t) => {
|
|
592
363
|
(await d.addTask(async () => {
|
|
593
|
-
let { pathname: r } =
|
|
364
|
+
let { pathname: r } = X(e, t);
|
|
594
365
|
return window.history.state?.step || window.history.replaceState({
|
|
595
366
|
...window.history.state,
|
|
596
367
|
step: !0
|
|
@@ -606,7 +377,7 @@ function ye() {
|
|
|
606
377
|
},
|
|
607
378
|
replaceStep: async (t) => {
|
|
608
379
|
(await d.addTask(async () => {
|
|
609
|
-
let { pathname: r } =
|
|
380
|
+
let { pathname: r } = X(e, t);
|
|
610
381
|
return window.history.replaceState({
|
|
611
382
|
...window.history.state,
|
|
612
383
|
step: !0,
|
|
@@ -623,7 +394,7 @@ function ye() {
|
|
|
623
394
|
let i = new Promise((e) => {
|
|
624
395
|
window.addEventListener("popstate", (t) => e(t.state), { once: !0 });
|
|
625
396
|
}), a = new Promise((e) => setTimeout(() => e(void 0), 200));
|
|
626
|
-
|
|
397
|
+
oe(), window.history.back();
|
|
627
398
|
let o = await Promise.race([i, a]);
|
|
628
399
|
if (!o) {
|
|
629
400
|
r.abort();
|
|
@@ -649,30 +420,30 @@ function ye() {
|
|
|
649
420
|
}
|
|
650
421
|
//#endregion
|
|
651
422
|
//#region src/screen/ParamsProvider/useParams.ts
|
|
652
|
-
function
|
|
653
|
-
return r(
|
|
423
|
+
function me() {
|
|
424
|
+
return r(le);
|
|
654
425
|
}
|
|
655
426
|
//#endregion
|
|
656
427
|
//#region src/screen/ScreenFreeze.tsx
|
|
657
|
-
function
|
|
428
|
+
function Z({ freeze: e, children: t }) {
|
|
658
429
|
let n = l(t);
|
|
659
|
-
return e || (n.current = t), /* @__PURE__ */
|
|
430
|
+
return e || (n.current = t), /* @__PURE__ */ M("div", {
|
|
660
431
|
style: { display: e ? "none" : void 0 },
|
|
661
432
|
children: n.current
|
|
662
433
|
});
|
|
663
434
|
}
|
|
664
435
|
//#endregion
|
|
665
436
|
//#region src/stores/useNavigateStore.ts
|
|
666
|
-
function
|
|
667
|
-
return P(
|
|
437
|
+
function Q(e) {
|
|
438
|
+
return H(P().navigate, e);
|
|
668
439
|
}
|
|
669
440
|
//#endregion
|
|
670
441
|
//#region src/screen/ScreenDecorator.tsx
|
|
671
|
-
function
|
|
672
|
-
let { isActive: r, transitionName: i } =
|
|
442
|
+
function he({ ref: e, style: t, ...n }) {
|
|
443
|
+
let { isActive: r, transitionName: i } = R(), o = l(null);
|
|
673
444
|
a(e, () => o.current);
|
|
674
|
-
let s =
|
|
675
|
-
return u ? /* @__PURE__ */
|
|
445
|
+
let s = Q((e) => e.status), { decoratorName: c } = j.get(i) ?? j.get("none"), u = T.get(c);
|
|
446
|
+
return u ? /* @__PURE__ */ M("div", {
|
|
676
447
|
ref: o,
|
|
677
448
|
"data-flemo-decorator": !0,
|
|
678
449
|
"data-flemo-decorator-name": u.name,
|
|
@@ -693,16 +464,16 @@ function Se({ ref: e, style: t, ...n }) {
|
|
|
693
464
|
}
|
|
694
465
|
//#endregion
|
|
695
466
|
//#region src/screen/useViewportScrollHeight.ts
|
|
696
|
-
var
|
|
697
|
-
function
|
|
467
|
+
var ge = 0;
|
|
468
|
+
function _e() {
|
|
698
469
|
let [e, t] = u(0), [n, r] = u(0);
|
|
699
470
|
return i(() => {
|
|
700
471
|
let e = 0, n = () => {
|
|
701
472
|
cancelAnimationFrame(e), e = requestAnimationFrame(() => {
|
|
702
473
|
let e = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
|
|
703
474
|
e = e < 0 ? 0 : e;
|
|
704
|
-
let n = e -
|
|
705
|
-
n = n < 0 ? 0 : n,
|
|
475
|
+
let n = e - ge;
|
|
476
|
+
n = n < 0 ? 0 : n, ge ||= e, r(n), t(e);
|
|
706
477
|
});
|
|
707
478
|
};
|
|
708
479
|
return window.visualViewport?.addEventListener("resize", n), window.visualViewport?.addEventListener("scroll", n), () => {
|
|
@@ -714,327 +485,163 @@ function Ce() {
|
|
|
714
485
|
};
|
|
715
486
|
}
|
|
716
487
|
//#endregion
|
|
717
|
-
//#region src/transition/animateInline.ts
|
|
718
|
-
var we = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, J = /* @__PURE__ */ new WeakMap(), Y = (e, t) => {
|
|
719
|
-
let n = J.get(e);
|
|
720
|
-
n || (n = /* @__PURE__ */ new Set(), J.set(e, n)), n.add(t);
|
|
721
|
-
}, X = (e, t) => {
|
|
722
|
-
if (e.style.transition = "", t) {
|
|
723
|
-
let n = J.get(e);
|
|
724
|
-
for (let r of t) e.style.removeProperty(r), n?.delete(r);
|
|
725
|
-
return;
|
|
726
|
-
}
|
|
727
|
-
let n = J.get(e);
|
|
728
|
-
if (n && n.size > 0) {
|
|
729
|
-
for (let t of n) e.style.removeProperty(t);
|
|
730
|
-
n.clear();
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
e.style.removeProperty("transform"), e.style.removeProperty("opacity");
|
|
734
|
-
}, Z = (e, t, n = {}) => {
|
|
735
|
-
if (!we(e)) return Promise.resolve();
|
|
736
|
-
let r = e, i = C(t);
|
|
737
|
-
if (i.length === 0) return Promise.resolve();
|
|
738
|
-
let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s = re(n.ease);
|
|
739
|
-
if (a <= 0 && o <= 0) {
|
|
740
|
-
r.style.transition = "none";
|
|
741
|
-
for (let e of i) r.style.setProperty(e.property, e.value), Y(r, e.property);
|
|
742
|
-
return Promise.resolve();
|
|
743
|
-
}
|
|
744
|
-
let c = i.map((e) => `${e.property} ${a}s ${s} ${o}s`).join(", ");
|
|
745
|
-
r.style.transition = c, r.offsetWidth;
|
|
746
|
-
for (let e of i) r.style.setProperty(e.property, e.value), Y(r, e.property);
|
|
747
|
-
return new Promise((e) => {
|
|
748
|
-
let t = !1, n = () => {
|
|
749
|
-
t || (t = !0, r.removeEventListener("transitionend", i), e());
|
|
750
|
-
}, i = (e) => {
|
|
751
|
-
e.target === r && n();
|
|
752
|
-
};
|
|
753
|
-
r.addEventListener("transitionend", i), setTimeout(n, (a + o) * 1e3 + 60);
|
|
754
|
-
});
|
|
755
|
-
};
|
|
756
|
-
//#endregion
|
|
757
488
|
//#region src/stores/useScreenStore.ts
|
|
758
|
-
function
|
|
759
|
-
return P(
|
|
489
|
+
function $(e) {
|
|
490
|
+
return H(P().screen, e);
|
|
760
491
|
}
|
|
761
492
|
//#endregion
|
|
762
493
|
//#region src/screen/ScreenMotion.tsx
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
},
|
|
794
|
-
delta: {
|
|
795
|
-
x: e.clientX - t.x,
|
|
796
|
-
y: e.clientY - t.y
|
|
797
|
-
},
|
|
798
|
-
velocity: be.current
|
|
799
|
-
};
|
|
800
|
-
}, De = (e) => {
|
|
801
|
-
let t = e.timeStamp, n = Math.max(1, t - ye.current), r = G.current;
|
|
802
|
-
be.current = {
|
|
803
|
-
x: (e.clientX - r.x) / n * 1e3,
|
|
804
|
-
y: (e.clientY - r.y) / n * 1e3
|
|
805
|
-
}, G.current = {
|
|
806
|
-
x: e.clientX,
|
|
807
|
-
y: e.clientY
|
|
808
|
-
}, ye.current = t;
|
|
809
|
-
}, Oe = (e, t, n) => {
|
|
810
|
-
let r = Z(e, t, n);
|
|
811
|
-
if (e === I.current) for (let e of B.current.current) Z(e, t, n);
|
|
812
|
-
else if (e === L.current) for (let e of B.current.prev) Z(e, t, n);
|
|
813
|
-
return r;
|
|
814
|
-
}, ke = (e) => {
|
|
815
|
-
let t = b ? S.history.getState().histories[O - 1]?.id : S.history.getState().histories[O]?.id, n = t ? S.screen.getState().sharedBars[t] : void 0, r = [], i = Y.current, a = $.current;
|
|
816
|
-
i && Re && !n?.appBar && r.push(i), a && ze && !n?.navigationBar && r.push(a);
|
|
817
|
-
let o = [];
|
|
818
|
-
if (e) {
|
|
819
|
-
let t = e.querySelector("[data-flemo-bar=\"app\"]"), n = e.querySelector("[data-flemo-bar=\"nav\"]");
|
|
820
|
-
t && !Re && o.push(t), n && !ze && o.push(n);
|
|
821
|
-
}
|
|
822
|
-
B.current = {
|
|
823
|
-
current: r,
|
|
824
|
-
prev: o
|
|
825
|
-
};
|
|
826
|
-
let s = p(k).join(", ");
|
|
827
|
-
for (let e of r) e.style.willChange = s;
|
|
828
|
-
for (let e of o) e.style.willChange = s;
|
|
829
|
-
}, Ae = () => {
|
|
830
|
-
for (let e of B.current.current) X(e), e.style.removeProperty("will-change");
|
|
831
|
-
for (let e of B.current.prev) X(e), e.style.removeProperty("will-change");
|
|
832
|
-
B.current = {
|
|
833
|
-
current: [],
|
|
834
|
-
prev: []
|
|
835
|
-
};
|
|
836
|
-
}, je = async (e) => {
|
|
837
|
-
if (!M || N > 10) return;
|
|
838
|
-
let t = I.current;
|
|
839
|
-
if (!t) return;
|
|
840
|
-
let n = _e.current?.parentElement?.previousElementSibling;
|
|
841
|
-
L.current = n?.querySelector("[data-flemo-screen]") ?? null, z.current = n?.querySelector("[data-flemo-decorator]") ?? null, L.current && (U.current = !0, ve.current = e.timeStamp, W.current = {
|
|
842
|
-
x: e.clientX,
|
|
843
|
-
y: e.clientY
|
|
844
|
-
}, G.current = {
|
|
845
|
-
x: e.clientX,
|
|
846
|
-
y: e.clientY
|
|
847
|
-
}, ye.current = e.timeStamp, be.current = {
|
|
848
|
-
x: 0,
|
|
849
|
-
y: 0
|
|
850
|
-
}, t.setPointerCapture(e.pointerId), ke(n), await k?.onSwipeStart(e, Ee(e), {
|
|
851
|
-
animate: Oe,
|
|
852
|
-
currentScreen: t,
|
|
853
|
-
prevScreen: L.current,
|
|
854
|
-
onStart: (e) => fe?.onSwipeStart?.(e, {
|
|
855
|
-
animate: Z,
|
|
856
|
-
currentDecorator: R.current,
|
|
857
|
-
prevDecorator: z.current
|
|
858
|
-
})
|
|
859
|
-
}) ? E("PENDING") : (E("IDLE"), U.current = !1, Ae()));
|
|
860
|
-
}, Me = (e) => {
|
|
861
|
-
!M || !U.current || N > 10 || (De(e), k.onSwipe(e, Ee(e), {
|
|
862
|
-
animate: Oe,
|
|
863
|
-
currentScreen: I.current,
|
|
864
|
-
prevScreen: L.current,
|
|
865
|
-
onProgress: (e, t) => fe?.onSwipe?.(e, t, {
|
|
866
|
-
animate: Z,
|
|
867
|
-
currentDecorator: R.current,
|
|
868
|
-
prevDecorator: z.current
|
|
869
|
-
})
|
|
870
|
-
}));
|
|
871
|
-
}, Ne = async (e) => {
|
|
872
|
-
if (!M || !U.current) return;
|
|
873
|
-
U.current = !1;
|
|
874
|
-
let t = I.current;
|
|
875
|
-
t && t.hasPointerCapture(e.pointerId) && t.releasePointerCapture(e.pointerId);
|
|
876
|
-
let n = Ee(e);
|
|
877
|
-
if (await k?.onSwipeEnd(e, n, {
|
|
878
|
-
animate: Oe,
|
|
879
|
-
currentScreen: I.current,
|
|
880
|
-
prevScreen: L.current,
|
|
881
|
-
onStart: (e) => fe?.onSwipeEnd?.(e, {
|
|
882
|
-
animate: Z,
|
|
883
|
-
currentDecorator: R.current,
|
|
884
|
-
prevDecorator: z.current
|
|
885
|
-
})
|
|
886
|
-
})) {
|
|
887
|
-
I.current?.setAttribute(Q, "true"), R.current?.setAttribute(Q, "true");
|
|
888
|
-
for (let e of B.current.current) e.style.removeProperty("will-change");
|
|
889
|
-
for (let e of B.current.prev) X(e), e.style.removeProperty("will-change");
|
|
890
|
-
B.current = {
|
|
891
|
-
current: [],
|
|
892
|
-
prev: []
|
|
893
|
-
}, window.history.back();
|
|
894
|
-
} else X(I.current), L.current && X(L.current), R.current && X(R.current), z.current && X(z.current), Ae(), E("IDLE");
|
|
895
|
-
}, Pe = (e) => {
|
|
896
|
-
!re && b && C === "COMPLETED" && le === "IDLE" && M && N < 10 && (K.current = ie(e.target, {
|
|
897
|
-
direction: "x",
|
|
898
|
-
verifyByScroll: !0
|
|
899
|
-
}), q.current = ie(e.target, {
|
|
900
|
-
direction: "y",
|
|
901
|
-
verifyByScroll: !0
|
|
902
|
-
}), we.current = e.clientX, J.current = e.clientY, (!K.current.element && !q.current.element || K.current.element || q.current.element) && (V.current = !0));
|
|
903
|
-
}, Fe = (e) => {
|
|
904
|
-
if (N > 10) return;
|
|
905
|
-
if (U.current) {
|
|
906
|
-
Me(e.nativeEvent);
|
|
907
|
-
return;
|
|
908
|
-
}
|
|
909
|
-
let t = !K.current.element && !q.current.element;
|
|
910
|
-
if (V.current && t) {
|
|
911
|
-
V.current = !1, H.current = !0;
|
|
912
|
-
let t = e.clientY - J.current, n = e.clientX - we.current;
|
|
913
|
-
(M === "y" && t > 0 || M === "x" && n > 0) && je(e.nativeEvent);
|
|
914
|
-
} else if (V.current && !t) {
|
|
915
|
-
let t = e.clientX - we.current, n = e.clientY - J.current, r = q.current.element && q.current.element.scrollTop <= 0, i = K.current.element && K.current.element.scrollLeft <= 0 && K.current.hasMarker;
|
|
916
|
-
(M === "y" && (r || K.current.element) && n > 0 && Math.abs(t) < 2 || M === "x" && (i || q.current.element) && t > 0 && Math.abs(n) < 2) && (V.current = !1, H.current = !0, je(e.nativeEvent));
|
|
917
|
-
}
|
|
918
|
-
}, Ie = (e) => {
|
|
919
|
-
V.current = !1, H.current = !1, U.current && Ne(e.nativeEvent);
|
|
494
|
+
function ve({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigationBarHeight: r, systemNavigationBarColor: a, sharedAppBar: o, sharedNavigationBar: c, appBar: d, navigationBar: f, hideStatusBar: p, hideSystemNavigationBar: m, backgroundColor: h = "white", contentScrollable: g = !0, ..._ }) {
|
|
495
|
+
let { id: v, isActive: y, isRoot: b, zIndex: ee, transitionName: x, prevTransitionName: te } = R(), S = P(), C = Q((e) => e.status), w = $((e) => e.dragStatus), E = S.screen.getState().setDragStatus, ae = S.screen.getState().setReplaceTransitionStatus, D = U((e) => e.index), oe = l(null);
|
|
496
|
+
oe.current ||= re({
|
|
497
|
+
getTransitionTaskId: () => S.navigate.getState().transitionTaskId,
|
|
498
|
+
setDragStatus: E,
|
|
499
|
+
setReplaceTransitionStatus: ae
|
|
500
|
+
});
|
|
501
|
+
let O = oe.current, k = j.get(x) ?? j.get("none"), { initial: A, swipeDirection: ce, decoratorName: N } = k, F = T.get(N), { viewportScrollHeight: I } = _e(), L = I > 0, [le, z] = u(0), [ue, B] = u(0), V = l(null), H = l(null), W = l(null), G = l(null), K = l(null), q = l({
|
|
502
|
+
transition: k,
|
|
503
|
+
decorator: F,
|
|
504
|
+
hasSharedAppBar: !!o,
|
|
505
|
+
hasSharedNavigationBar: !!c,
|
|
506
|
+
viewportScrollHeight: I,
|
|
507
|
+
isRoot: b,
|
|
508
|
+
isActive: y,
|
|
509
|
+
status: C,
|
|
510
|
+
dragStatus: w,
|
|
511
|
+
index: D
|
|
512
|
+
});
|
|
513
|
+
q.current = {
|
|
514
|
+
transition: k,
|
|
515
|
+
decorator: F,
|
|
516
|
+
hasSharedAppBar: !!o,
|
|
517
|
+
hasSharedNavigationBar: !!c,
|
|
518
|
+
viewportScrollHeight: I,
|
|
519
|
+
isRoot: b,
|
|
520
|
+
isActive: y,
|
|
521
|
+
status: C,
|
|
522
|
+
dragStatus: w,
|
|
523
|
+
index: D
|
|
920
524
|
};
|
|
525
|
+
let J = l(null);
|
|
526
|
+
J.current ||= ne({
|
|
527
|
+
getTransition: () => q.current.transition,
|
|
528
|
+
getDecorator: () => q.current.decorator,
|
|
529
|
+
getElements: () => ({
|
|
530
|
+
scope: H.current,
|
|
531
|
+
screenContainer: V.current,
|
|
532
|
+
decorator: W.current,
|
|
533
|
+
sharedAppBar: G.current,
|
|
534
|
+
sharedNavigationBar: K.current
|
|
535
|
+
}),
|
|
536
|
+
hasSharedAppBar: () => q.current.hasSharedAppBar,
|
|
537
|
+
hasSharedNavigationBar: () => q.current.hasSharedNavigationBar,
|
|
538
|
+
getViewportScrollHeight: () => q.current.viewportScrollHeight,
|
|
539
|
+
isReadyForDrag: () => {
|
|
540
|
+
let e = q.current;
|
|
541
|
+
return !e.isRoot && e.isActive && e.status === "COMPLETED" && e.dragStatus === "IDLE" && !!e.transition.swipeDirection && e.viewportScrollHeight < 10;
|
|
542
|
+
},
|
|
543
|
+
getPartnerBars: () => {
|
|
544
|
+
let e = q.current, t = S.history.getState().histories, n = e.isActive ? t[e.index - 1]?.id : t[e.index]?.id;
|
|
545
|
+
return n ? S.screen.getState().sharedBars[n] : void 0;
|
|
546
|
+
},
|
|
547
|
+
setDragStatus: E,
|
|
548
|
+
back: () => window.history.back()
|
|
549
|
+
});
|
|
550
|
+
let Y = J.current, de = (e) => Y.pointerDown(e.nativeEvent), X = (e) => Y.pointerMove(e.nativeEvent), fe = (e) => Y.pointerUp(e.nativeEvent);
|
|
921
551
|
i(() => {
|
|
922
|
-
let e =
|
|
552
|
+
let e = H.current;
|
|
923
553
|
if (!e) return;
|
|
924
554
|
let t = (e) => {
|
|
925
|
-
|
|
555
|
+
Y.shouldPreventTouch() && e.preventDefault(), e.target?.dataset.swipeAtEdgeBar === "true" && e.preventDefault();
|
|
926
556
|
};
|
|
927
557
|
return e.addEventListener("touchmove", t, { passive: !1 }), () => {
|
|
928
558
|
e.removeEventListener("touchmove", t);
|
|
929
559
|
};
|
|
930
|
-
}, []), s(() => {
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
let t = () => {
|
|
943
|
-
let e = S.navigate.getState().transitionTaskId;
|
|
944
|
-
e && d.resolveTask(e);
|
|
945
|
-
}, n = `${C}-true`;
|
|
946
|
-
if (!(e.getAttribute(Q) !== "true" && se(k, n))) {
|
|
947
|
-
queueMicrotask(t);
|
|
948
|
-
return;
|
|
949
|
-
}
|
|
950
|
-
let r = f("screen", x, n), i = (n) => {
|
|
951
|
-
n.target === e && n.animationName === r && (e.removeEventListener("animationend", i), t());
|
|
952
|
-
};
|
|
953
|
-
return e.addEventListener("animationend", i), () => {
|
|
954
|
-
e.removeEventListener("animationend", i);
|
|
955
|
-
};
|
|
956
|
-
}, [
|
|
560
|
+
}, [Y]), s(() => O.driveScreenLifecycle({
|
|
561
|
+
getElements: () => ({
|
|
562
|
+
scope: H.current,
|
|
563
|
+
decorator: W.current,
|
|
564
|
+
bars: [G.current, K.current]
|
|
565
|
+
}),
|
|
566
|
+
transitionName: x,
|
|
567
|
+
prevTransitionName: te,
|
|
568
|
+
status: C,
|
|
569
|
+
isActive: y
|
|
570
|
+
}), [
|
|
571
|
+
O,
|
|
957
572
|
C,
|
|
958
|
-
b,
|
|
959
573
|
y,
|
|
960
|
-
|
|
961
|
-
x
|
|
962
|
-
k,
|
|
963
|
-
E,
|
|
964
|
-
ue,
|
|
965
|
-
S.navigate
|
|
574
|
+
te,
|
|
575
|
+
x
|
|
966
576
|
]), s(() => {
|
|
967
|
-
let e =
|
|
577
|
+
let e = G.current;
|
|
968
578
|
if (!e) {
|
|
969
|
-
|
|
579
|
+
z(0);
|
|
970
580
|
return;
|
|
971
581
|
}
|
|
972
|
-
e.offsetHeight > 0 &&
|
|
582
|
+
e.offsetHeight > 0 && z(e.offsetHeight);
|
|
973
583
|
let t = new ResizeObserver(([e]) => {
|
|
974
|
-
e.contentRect.height > 0 &&
|
|
584
|
+
e.contentRect.height > 0 && z(e.contentRect.height);
|
|
975
585
|
});
|
|
976
586
|
return t.observe(e), () => {
|
|
977
587
|
t.disconnect();
|
|
978
588
|
};
|
|
979
589
|
}, [o]), s(() => {
|
|
980
|
-
let e =
|
|
590
|
+
let e = K.current;
|
|
981
591
|
if (!e) {
|
|
982
|
-
|
|
592
|
+
B(0);
|
|
983
593
|
return;
|
|
984
594
|
}
|
|
985
|
-
e.offsetHeight > 0 &&
|
|
595
|
+
e.offsetHeight > 0 && B(e.offsetHeight);
|
|
986
596
|
let t = new ResizeObserver(([e]) => {
|
|
987
|
-
e.contentRect.height > 0 &&
|
|
597
|
+
e.contentRect.height > 0 && B(e.contentRect.height);
|
|
988
598
|
});
|
|
989
599
|
return t.observe(e), () => {
|
|
990
600
|
t.disconnect();
|
|
991
601
|
};
|
|
992
602
|
}, [c]), s(() => {
|
|
993
603
|
let { registerSharedBars: e, unregisterSharedBars: t } = S.screen.getState();
|
|
994
|
-
return e(
|
|
604
|
+
return e(v, {
|
|
995
605
|
appBar: !!o,
|
|
996
606
|
navigationBar: !!c
|
|
997
|
-
}), () => t(
|
|
607
|
+
}), () => t(v);
|
|
998
608
|
}, [
|
|
999
|
-
|
|
609
|
+
v,
|
|
1000
610
|
o,
|
|
1001
611
|
c,
|
|
1002
612
|
S.screen
|
|
1003
613
|
]);
|
|
1004
|
-
let
|
|
1005
|
-
s(() => {
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
O,
|
|
1025
|
-
Re,
|
|
1026
|
-
ze,
|
|
614
|
+
let pe = y || ee === D - 1, me = !!o, Z = !!c;
|
|
615
|
+
s(() => ie({
|
|
616
|
+
appBar: G.current,
|
|
617
|
+
navBar: K.current,
|
|
618
|
+
isTopOrTopPrev: pe,
|
|
619
|
+
isActive: y,
|
|
620
|
+
index: D,
|
|
621
|
+
hasAppBar: me,
|
|
622
|
+
hasNavBar: Z,
|
|
623
|
+
getStatus: () => S.navigate.getState().status,
|
|
624
|
+
getHistories: () => S.history.getState().histories,
|
|
625
|
+
getSharedBars: () => S.screen.getState().sharedBars,
|
|
626
|
+
subscribeStatus: (e) => S.navigate.subscribe(e),
|
|
627
|
+
subscribeSharedBars: (e) => S.screen.subscribe(e)
|
|
628
|
+
}), [
|
|
629
|
+
pe,
|
|
630
|
+
y,
|
|
631
|
+
D,
|
|
632
|
+
me,
|
|
633
|
+
Z,
|
|
1027
634
|
S.history,
|
|
1028
635
|
S.navigate,
|
|
1029
636
|
S.screen
|
|
1030
637
|
]);
|
|
1031
|
-
let
|
|
1032
|
-
if (!
|
|
638
|
+
let ge = (() => {
|
|
639
|
+
if (!y || C !== "PUSHING" && C !== "REPLACING") return {};
|
|
1033
640
|
let e = {};
|
|
1034
|
-
return typeof
|
|
641
|
+
return typeof A.x == "number" && (e.transform = `translateX(${A.x}px)`), typeof A.x == "string" && (e.transform = `translateX(${A.x})`), typeof A.y == "number" && (e.transform = `translateY(${A.y}px)`), typeof A.y == "string" && (e.transform = `translateY(${A.y})`), typeof A.opacity == "number" && (e.opacity = `${A.opacity}`), e;
|
|
1035
642
|
})();
|
|
1036
|
-
return /* @__PURE__ */
|
|
1037
|
-
ref:
|
|
643
|
+
return /* @__PURE__ */ se("div", {
|
|
644
|
+
ref: V,
|
|
1038
645
|
style: {
|
|
1039
646
|
position: "fixed",
|
|
1040
647
|
top: 0,
|
|
@@ -1048,7 +655,7 @@ function $({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigatio
|
|
|
1048
655
|
overscrollBehavior: "contain"
|
|
1049
656
|
},
|
|
1050
657
|
children: [
|
|
1051
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ M("div", {
|
|
1052
659
|
"data-swipe-at-edge-bar": !0,
|
|
1053
660
|
style: {
|
|
1054
661
|
position: "fixed",
|
|
@@ -1059,31 +666,31 @@ function $({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigatio
|
|
|
1059
666
|
zIndex: 1
|
|
1060
667
|
}
|
|
1061
668
|
}),
|
|
1062
|
-
/* @__PURE__ */
|
|
1063
|
-
ref:
|
|
1064
|
-
...
|
|
1065
|
-
onPointerDown:
|
|
1066
|
-
onPointerMove:
|
|
1067
|
-
onPointerUp:
|
|
1068
|
-
onPointerCancel:
|
|
669
|
+
/* @__PURE__ */ se("div", {
|
|
670
|
+
ref: H,
|
|
671
|
+
..._,
|
|
672
|
+
onPointerDown: de,
|
|
673
|
+
onPointerMove: X,
|
|
674
|
+
onPointerUp: fe,
|
|
675
|
+
onPointerCancel: fe,
|
|
1069
676
|
"data-flemo-screen": !0,
|
|
1070
677
|
"data-flemo-transition": x,
|
|
1071
678
|
"data-flemo-status": C,
|
|
1072
|
-
"data-flemo-active":
|
|
679
|
+
"data-flemo-active": y ? "true" : "false",
|
|
1073
680
|
style: {
|
|
1074
681
|
display: "flex",
|
|
1075
682
|
flexDirection: "column",
|
|
1076
683
|
height: "100%",
|
|
1077
|
-
backgroundColor:
|
|
1078
|
-
overflowY:
|
|
1079
|
-
touchAction:
|
|
1080
|
-
...
|
|
1081
|
-
...
|
|
684
|
+
backgroundColor: h,
|
|
685
|
+
overflowY: g ? void 0 : "auto",
|
|
686
|
+
touchAction: ce === "x" ? "pan-y" : ce === "y" ? "pan-x" : "auto",
|
|
687
|
+
...ge,
|
|
688
|
+
..._.style
|
|
1082
689
|
},
|
|
1083
690
|
children: [
|
|
1084
|
-
!
|
|
691
|
+
!p && t && /* @__PURE__ */ M("div", {
|
|
1085
692
|
style: { minHeight: t },
|
|
1086
|
-
children: /* @__PURE__ */
|
|
693
|
+
children: /* @__PURE__ */ M("div", { style: {
|
|
1087
694
|
position: "fixed",
|
|
1088
695
|
top: 0,
|
|
1089
696
|
width: "100%",
|
|
@@ -1091,36 +698,33 @@ function $({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigatio
|
|
|
1091
698
|
backgroundColor: n
|
|
1092
699
|
} })
|
|
1093
700
|
}),
|
|
1094
|
-
o && /* @__PURE__ */
|
|
701
|
+
o && /* @__PURE__ */ M("div", { style: {
|
|
1095
702
|
width: "100%",
|
|
1096
|
-
minHeight:
|
|
703
|
+
minHeight: le
|
|
1097
704
|
} }),
|
|
1098
|
-
|
|
1099
|
-
/* @__PURE__ */
|
|
705
|
+
d,
|
|
706
|
+
/* @__PURE__ */ M("div", {
|
|
1100
707
|
style: {
|
|
1101
708
|
display: "flex",
|
|
1102
709
|
flexDirection: "column",
|
|
1103
710
|
flexGrow: 1,
|
|
1104
|
-
overflowY:
|
|
1105
|
-
...C !== "IDLE" && C !== "COMPLETED" ? {
|
|
1106
|
-
transform: "translateZ(0)",
|
|
1107
|
-
willChange: "transform"
|
|
1108
|
-
} : null
|
|
711
|
+
overflowY: g ? "auto" : void 0,
|
|
712
|
+
...C !== "IDLE" && C !== "COMPLETED" ? { willChange: "opacity" } : null
|
|
1109
713
|
},
|
|
1110
714
|
children: e
|
|
1111
715
|
}),
|
|
1112
|
-
|
|
1113
|
-
c && /* @__PURE__ */
|
|
1114
|
-
display:
|
|
716
|
+
f,
|
|
717
|
+
c && /* @__PURE__ */ M("div", { style: {
|
|
718
|
+
display: L ? "none" : void 0,
|
|
1115
719
|
width: "100%",
|
|
1116
|
-
minHeight:
|
|
720
|
+
minHeight: ue
|
|
1117
721
|
} }),
|
|
1118
|
-
!
|
|
722
|
+
!m && r && /* @__PURE__ */ M("div", {
|
|
1119
723
|
style: {
|
|
1120
|
-
display:
|
|
724
|
+
display: L ? "none" : void 0,
|
|
1121
725
|
minHeight: r
|
|
1122
726
|
},
|
|
1123
|
-
children: /* @__PURE__ */
|
|
727
|
+
children: /* @__PURE__ */ M("div", { style: {
|
|
1124
728
|
position: "fixed",
|
|
1125
729
|
bottom: 0,
|
|
1126
730
|
width: "100%",
|
|
@@ -1130,39 +734,39 @@ function $({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigatio
|
|
|
1130
734
|
})
|
|
1131
735
|
]
|
|
1132
736
|
}),
|
|
1133
|
-
o && /* @__PURE__ */
|
|
1134
|
-
ref:
|
|
737
|
+
o && /* @__PURE__ */ M("div", {
|
|
738
|
+
ref: G,
|
|
1135
739
|
"data-flemo-bar": "app",
|
|
1136
740
|
"data-flemo-bar-transition": x,
|
|
1137
741
|
"data-flemo-bar-status": C,
|
|
1138
|
-
"data-flemo-bar-active":
|
|
742
|
+
"data-flemo-bar-active": y ? "true" : "false",
|
|
1139
743
|
style: {
|
|
1140
744
|
position: "fixed",
|
|
1141
|
-
top:
|
|
745
|
+
top: p ? 0 : t,
|
|
1142
746
|
left: 0,
|
|
1143
747
|
width: "100%",
|
|
1144
748
|
zIndex: 1
|
|
1145
749
|
},
|
|
1146
750
|
children: o
|
|
1147
751
|
}),
|
|
1148
|
-
c && /* @__PURE__ */
|
|
1149
|
-
ref:
|
|
752
|
+
c && /* @__PURE__ */ M("div", {
|
|
753
|
+
ref: K,
|
|
1150
754
|
"data-flemo-bar": "nav",
|
|
1151
755
|
"data-flemo-bar-transition": x,
|
|
1152
756
|
"data-flemo-bar-status": C,
|
|
1153
|
-
"data-flemo-bar-active":
|
|
757
|
+
"data-flemo-bar-active": y ? "true" : "false",
|
|
1154
758
|
style: {
|
|
1155
|
-
display:
|
|
759
|
+
display: L ? "none" : void 0,
|
|
1156
760
|
position: "fixed",
|
|
1157
|
-
bottom:
|
|
761
|
+
bottom: m ? 0 : r,
|
|
1158
762
|
left: 0,
|
|
1159
763
|
width: "100%",
|
|
1160
764
|
zIndex: 1
|
|
1161
765
|
},
|
|
1162
766
|
children: c
|
|
1163
767
|
}),
|
|
1164
|
-
|
|
1165
|
-
/* @__PURE__ */
|
|
768
|
+
F && /* @__PURE__ */ M(he, { ref: W }),
|
|
769
|
+
/* @__PURE__ */ M("div", {
|
|
1166
770
|
"data-swipe-at-edge-bar": !0,
|
|
1167
771
|
style: {
|
|
1168
772
|
position: "fixed",
|
|
@@ -1178,29 +782,51 @@ function $({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigatio
|
|
|
1178
782
|
}
|
|
1179
783
|
//#endregion
|
|
1180
784
|
//#region src/screen/Screen.tsx
|
|
1181
|
-
function
|
|
1182
|
-
let { isActive: n, isPrev: r, zIndex: i } =
|
|
1183
|
-
return /* @__PURE__ */
|
|
1184
|
-
freeze:
|
|
1185
|
-
|
|
785
|
+
function ye({ children: e, ...t }) {
|
|
786
|
+
let { isActive: n, isPrev: r, zIndex: i } = R();
|
|
787
|
+
return /* @__PURE__ */ M(Z, {
|
|
788
|
+
freeze: p({
|
|
789
|
+
isActive: n,
|
|
790
|
+
isPrev: r,
|
|
791
|
+
zIndex: i,
|
|
792
|
+
index: U((e) => e.index),
|
|
793
|
+
status: Q((e) => e.status),
|
|
794
|
+
dragStatus: $((e) => e.dragStatus),
|
|
795
|
+
replaceTransitionStatus: $((e) => e.replaceTransitionStatus)
|
|
796
|
+
}),
|
|
797
|
+
children: /* @__PURE__ */ M(ve, {
|
|
1186
798
|
...t,
|
|
1187
799
|
children: e
|
|
1188
800
|
})
|
|
1189
801
|
});
|
|
1190
802
|
}
|
|
1191
803
|
//#endregion
|
|
804
|
+
//#region src/screen/Part.tsx
|
|
805
|
+
function be({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
806
|
+
let { isActive: a } = R();
|
|
807
|
+
return /* @__PURE__ */ M("div", {
|
|
808
|
+
ref: e,
|
|
809
|
+
"data-flemo-part-name": t,
|
|
810
|
+
"data-flemo-status": Q((e) => e.status),
|
|
811
|
+
"data-flemo-active": a ? "true" : "false",
|
|
812
|
+
style: n,
|
|
813
|
+
...i,
|
|
814
|
+
children: r
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
//#endregion
|
|
1192
818
|
//#region src/stores/RouterScopeProvider.tsx
|
|
1193
|
-
function
|
|
819
|
+
function xe({ children: e }) {
|
|
1194
820
|
let [t] = u(() => ({
|
|
1195
|
-
history:
|
|
1196
|
-
navigate:
|
|
1197
|
-
transition:
|
|
1198
|
-
screen:
|
|
821
|
+
history: h(),
|
|
822
|
+
navigate: _(),
|
|
823
|
+
transition: w(),
|
|
824
|
+
screen: S()
|
|
1199
825
|
}));
|
|
1200
|
-
return /* @__PURE__ */
|
|
826
|
+
return /* @__PURE__ */ M(N.Provider, {
|
|
1201
827
|
value: t,
|
|
1202
828
|
children: e
|
|
1203
829
|
});
|
|
1204
830
|
}
|
|
1205
831
|
//#endregion
|
|
1206
|
-
export {
|
|
832
|
+
export { be as Part, de as Route, Y as Router, xe as RouterScopeProvider, ye as Screen, L as ScreenContext, he as ScreenDecorator, Z as ScreenFreeze, ve as ScreenMotion, m as createDecorator, y as createPartTransition, b as createRawDecorator, ee as createRawPartTransition, x as createRawTransition, C as createTransition, O as partTransitionMap, U as useHistoryStore, fe as useNavigate, Q as useNavigateStore, me as useParams, R as useScreen, $ as useScreenStore, pe as useStep, P as useStores, _e as useViewportScrollHeight };
|