@flemo/react 1.5.8 → 1.6.0
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.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { default as Router } from './Router';
|
|
2
2
|
export { default as Route, type RegisterRoute } from './Route';
|
|
3
3
|
export { default as Slot, type SlotProps } from './Slot';
|
|
4
|
-
export { default as Layer } from './screen/Layer';
|
|
5
4
|
export { default as useNavigate } from './navigate/useNavigate';
|
|
6
5
|
export { default as usePathname } from './navigate/usePathname';
|
|
7
6
|
export { default as useStep } from './navigate/useStep';
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import e, { Activity as t, Children as n, createContext as r, isValidElement as i, useContext as a, useEffect as o, useId as s, useImperativeHandle as c, useInsertionEffect as l, useLayoutEffect as u, useReducer as d, useRef as f, useState as p } from "react";
|
|
2
|
-
import { animHoldKey as ee, appendParamsQuery as m, buildRoutePath as h, computeBarRiding as g, computeScreenFreeze as _, consumeSelfInducedPop as v, createBrowserHistoryDriver as y, createBrowserHistoryDriver as b, createDecorator as x, createHistoryStore as te, createHistorySync as S, createNavigateStore as C, createNavigationController as w, createPartTransition as T, createRawDecorator as E, createRawPartTransition as D, createRawTransition as O, createRouterScope as ne, createScreenSelector as k, createScreenStore as A, createStepController as j, createSwipeController as M, createTransition as N, createTransitionEngine as re, createTransitionStore as ie, decoratorMap as ae, eagerlyDecodeImages as oe, ensureWindowHistoryState as se, enteringInitialStyle as ce, getMatchedPathPattern as le, isOpaqueColor as ue, isServer as de, markSelfInducedPop as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { createPortal as ye } from "react-dom";
|
|
2
|
+
import { animHoldKey as ee, appendParamsQuery as m, buildRoutePath as h, computeBarRiding as g, computeScreenFreeze as _, consumeSelfInducedPop as v, createBrowserHistoryDriver as y, createBrowserHistoryDriver as b, createDecorator as x, createHistoryStore as te, createHistorySync as S, createNavigateStore as C, createNavigationController as w, createPartTransition as T, createRawDecorator as E, createRawPartTransition as D, createRawTransition as O, createRouterScope as ne, createScreenSelector as k, createScreenStore as A, createStepController as j, createSwipeController as M, createTransition as N, createTransitionEngine as re, createTransitionStore as ie, decoratorMap as ae, eagerlyDecodeImages as oe, ensureWindowHistoryState as se, enteringInitialStyle as ce, getMatchedPathPattern as le, isOpaqueColor as ue, isServer as de, markSelfInducedPop as fe, matchesPathname as pe, observeBarHeight as me, observeViewportScrollHeight as he, partTransitionMap as ge, readStepParams as P, registerTransitionDefinitions as F, resolveTransition as _e, scheduleAnimHoldRelease as ve, subscribeStepParamsRestore as I } from "@flemo/core";
|
|
3
|
+
import { jsx as L, jsxs as ye } from "react/jsx-runtime";
|
|
5
4
|
//#region src/stores/StoreContext.ts
|
|
6
|
-
var
|
|
5
|
+
var R = r(null);
|
|
7
6
|
//#endregion
|
|
8
7
|
//#region src/stores/useStores.ts
|
|
9
|
-
function
|
|
10
|
-
let e = a(
|
|
8
|
+
function z() {
|
|
9
|
+
let e = a(R);
|
|
11
10
|
if (!e) throw Error("flemo stores are missing. Render inside a <Router>.");
|
|
12
11
|
return e;
|
|
13
12
|
}
|
|
14
13
|
//#endregion
|
|
15
14
|
//#region src/history/HistoryListener.tsx
|
|
16
15
|
function be() {
|
|
17
|
-
let e =
|
|
16
|
+
let e = z();
|
|
18
17
|
return o(() => S({
|
|
19
18
|
stores: e,
|
|
20
19
|
driver: e.driver,
|
|
@@ -23,7 +22,7 @@ function be() {
|
|
|
23
22
|
}
|
|
24
23
|
//#endregion
|
|
25
24
|
//#region src/screen/ScreenContext.ts
|
|
26
|
-
var
|
|
25
|
+
var B = r({
|
|
27
26
|
id: "",
|
|
28
27
|
isActive: !1,
|
|
29
28
|
isRoot: !0,
|
|
@@ -38,15 +37,15 @@ var V = r({
|
|
|
38
37
|
});
|
|
39
38
|
//#endregion
|
|
40
39
|
//#region src/screen/useScreen.ts
|
|
41
|
-
function
|
|
42
|
-
return a(
|
|
40
|
+
function V() {
|
|
41
|
+
return a(B);
|
|
43
42
|
}
|
|
44
43
|
//#endregion
|
|
45
44
|
//#region src/screen/ParamsProvider/ParamsContext.ts
|
|
46
|
-
var
|
|
45
|
+
var H = r({}), xe = r(() => {});
|
|
47
46
|
//#endregion
|
|
48
47
|
//#region src/screen/ParamsProvider/ParamsReducer.ts
|
|
49
|
-
function
|
|
48
|
+
function U(e, t) {
|
|
50
49
|
switch (t.type) {
|
|
51
50
|
case "SET": return t.params;
|
|
52
51
|
default: return e;
|
|
@@ -54,10 +53,10 @@ function Ce(e, t) {
|
|
|
54
53
|
}
|
|
55
54
|
//#endregion
|
|
56
55
|
//#region src/screen/ParamsProvider/ParamsProvider.tsx
|
|
57
|
-
function
|
|
58
|
-
let { isActive: t, params: n } =
|
|
56
|
+
function Se({ children: e }) {
|
|
57
|
+
let { isActive: t, params: n } = V(), { driver: r } = z(), [i, a] = d(U, n);
|
|
59
58
|
return o(() => {
|
|
60
|
-
if (t) return
|
|
59
|
+
if (t) return I(r, (e) => a({
|
|
61
60
|
type: "SET",
|
|
62
61
|
params: e
|
|
63
62
|
}));
|
|
@@ -65,9 +64,9 @@ function U({ children: e }) {
|
|
|
65
64
|
t,
|
|
66
65
|
a,
|
|
67
66
|
r
|
|
68
|
-
]), /* @__PURE__ */
|
|
67
|
+
]), /* @__PURE__ */ L(xe.Provider, {
|
|
69
68
|
value: a,
|
|
70
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ L(H.Provider, {
|
|
71
70
|
value: i,
|
|
72
71
|
children: e
|
|
73
72
|
})
|
|
@@ -83,33 +82,33 @@ function G(t, n = W) {
|
|
|
83
82
|
//#endregion
|
|
84
83
|
//#region src/stores/useHistoryStore.ts
|
|
85
84
|
function K(e) {
|
|
86
|
-
return G(
|
|
85
|
+
return G(z().history, e);
|
|
87
86
|
}
|
|
88
87
|
//#endregion
|
|
89
88
|
//#region src/renderer/Renderer.tsx
|
|
90
89
|
function q({ children: e }) {
|
|
91
90
|
let t = K((e) => e.index);
|
|
92
91
|
return k(K((e) => e.histories), t).map((t) => {
|
|
93
|
-
let [r] = n.toArray(e).filter((e) =>
|
|
94
|
-
return /* @__PURE__ */
|
|
92
|
+
let [r] = n.toArray(e).filter((e) => pe(e.props.path, t.pathname));
|
|
93
|
+
return /* @__PURE__ */ L(B.Provider, {
|
|
95
94
|
value: {
|
|
96
95
|
...t,
|
|
97
96
|
routePath: le(r.props.path, t.pathname)
|
|
98
97
|
},
|
|
99
|
-
children: /* @__PURE__ */
|
|
98
|
+
children: /* @__PURE__ */ L(Se, { children: r })
|
|
100
99
|
}, t.id);
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
102
|
//#endregion
|
|
104
103
|
//#region src/screen/ScreenViewportContext.ts
|
|
105
104
|
var J = r({ contained: !1 });
|
|
106
|
-
function
|
|
105
|
+
function Ce() {
|
|
107
106
|
return a(J);
|
|
108
107
|
}
|
|
109
108
|
//#endregion
|
|
110
109
|
//#region src/transition/styles.ts
|
|
111
|
-
function
|
|
112
|
-
l(() =>
|
|
110
|
+
function Y(e, t, n = []) {
|
|
111
|
+
l(() => F(e, t, n), [
|
|
113
112
|
e,
|
|
114
113
|
t,
|
|
115
114
|
n
|
|
@@ -117,41 +116,41 @@ function Te(e, t, n = []) {
|
|
|
117
116
|
}
|
|
118
117
|
//#endregion
|
|
119
118
|
//#region src/RouterDepthContext.ts
|
|
120
|
-
var
|
|
121
|
-
function
|
|
122
|
-
return /* @__PURE__ */
|
|
119
|
+
var we = r(0), Te = { contained: !0 };
|
|
120
|
+
function Ee({ children: e, className: t, style: n }) {
|
|
121
|
+
return /* @__PURE__ */ L("div", {
|
|
123
122
|
className: t,
|
|
124
123
|
style: {
|
|
125
124
|
position: "relative",
|
|
126
125
|
overflow: "hidden",
|
|
127
126
|
...n
|
|
128
127
|
},
|
|
129
|
-
children: /* @__PURE__ */
|
|
130
|
-
value:
|
|
131
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ L(J.Provider, {
|
|
129
|
+
value: Te,
|
|
130
|
+
children: /* @__PURE__ */ L(q, { children: e })
|
|
132
131
|
})
|
|
133
132
|
});
|
|
134
133
|
}
|
|
135
134
|
//#endregion
|
|
136
135
|
//#region src/Router.tsx
|
|
137
|
-
function
|
|
136
|
+
function De(e) {
|
|
138
137
|
let t = null;
|
|
139
138
|
return n.forEach(e, (e) => {
|
|
140
139
|
if (t || !i(e)) return;
|
|
141
|
-
if (e.type ===
|
|
140
|
+
if (e.type === Ee) {
|
|
142
141
|
t = n.toArray(e.props.children).filter(i);
|
|
143
142
|
return;
|
|
144
143
|
}
|
|
145
144
|
let r = e.props.children;
|
|
146
145
|
if (r) {
|
|
147
|
-
let e =
|
|
146
|
+
let e = De(r);
|
|
148
147
|
e && (t = e);
|
|
149
148
|
}
|
|
150
149
|
}), t;
|
|
151
150
|
}
|
|
152
|
-
var
|
|
153
|
-
function
|
|
154
|
-
let m = a(
|
|
151
|
+
var Oe = [], ke = [], X = [], Ae = { contained: !0 };
|
|
152
|
+
function je({ children: e, initPath: t = "/", defaultTransitionName: r = "cupertino", transitions: i = Oe, decorators: c = ke, partTransitions: l = X, history: u = "browser", createDriver: d, className: f, style: ee }) {
|
|
153
|
+
let m = a(we), h = m > 0, g = u === "memory", _ = s(), v = a(B), y = h && v.id ? `_F_${v.id}_` : _, x = De(e), te = x !== null, S = a(R), C = h ? null : S, w = C !== null, T = d ?? b, [E] = p(() => g ? null : T(w ? void 0 : y)), D = !h && !g && !de(), O = D && E ? E.readPathname() : t || "/", k = O.indexOf("?"), A = (k >= 0 ? O.slice(0, k) : O) || "/", j = D ? window.location.search : k >= 0 ? O.slice(k) : "", [M] = p(() => ne({
|
|
155
154
|
routePaths: (x ?? n.toArray(e)).map((e) => e.props.path).flat(),
|
|
156
155
|
pathname: A,
|
|
157
156
|
search: j,
|
|
@@ -162,7 +161,7 @@ function Me({ children: e, initPath: t = "/", defaultTransitionName: r = "cupert
|
|
|
162
161
|
}));
|
|
163
162
|
M.transition.setState({ defaultTransitionName: r }), o(() => (M.life.alive = !0, () => {
|
|
164
163
|
M.life.alive = !1;
|
|
165
|
-
}), [M]),
|
|
164
|
+
}), [M]), Y(i, c, l), o(() => {
|
|
166
165
|
if (g || de()) return;
|
|
167
166
|
let e = h && !w && E ? E.readState() == null : !1;
|
|
168
167
|
se(w ? null : y, r, M.history.getState().histories[0]?.params ?? {}), h && !w && E && e && E.readPathname() !== A && E.replaceState(E.readState(), A);
|
|
@@ -176,17 +175,17 @@ function Me({ children: e, initPath: t = "/", defaultTransitionName: r = "cupert
|
|
|
176
175
|
M.history,
|
|
177
176
|
E
|
|
178
177
|
]);
|
|
179
|
-
let N = te ? e : /* @__PURE__ */
|
|
178
|
+
let N = te ? e : /* @__PURE__ */ L(q, { children: e }), re = /* @__PURE__ */ L(we.Provider, {
|
|
180
179
|
value: m + 1,
|
|
181
|
-
children: /* @__PURE__ */
|
|
180
|
+
children: /* @__PURE__ */ ye(R.Provider, {
|
|
182
181
|
value: M,
|
|
183
|
-
children: [!g && /* @__PURE__ */
|
|
184
|
-
value:
|
|
182
|
+
children: [!g && /* @__PURE__ */ L(be, {}), h ? /* @__PURE__ */ L(J.Provider, {
|
|
183
|
+
value: Ae,
|
|
185
184
|
children: N
|
|
186
185
|
}) : N]
|
|
187
186
|
})
|
|
188
187
|
});
|
|
189
|
-
return h ? /* @__PURE__ */
|
|
188
|
+
return h ? /* @__PURE__ */ L("div", {
|
|
190
189
|
className: f,
|
|
191
190
|
style: {
|
|
192
191
|
position: "relative",
|
|
@@ -198,27 +197,18 @@ function Me({ children: e, initPath: t = "/", defaultTransitionName: r = "cupert
|
|
|
198
197
|
}
|
|
199
198
|
//#endregion
|
|
200
199
|
//#region src/Route.tsx
|
|
201
|
-
function
|
|
200
|
+
function Me({ element: e }) {
|
|
202
201
|
return e;
|
|
203
202
|
}
|
|
204
203
|
//#endregion
|
|
205
|
-
//#region src/screen/LayerMountContext.ts
|
|
206
|
-
var Pe = r(null);
|
|
207
|
-
//#endregion
|
|
208
|
-
//#region src/screen/Layer.tsx
|
|
209
|
-
function Fe({ children: e }) {
|
|
210
|
-
let t = a(Pe);
|
|
211
|
-
return t ? ye(e, t) : e;
|
|
212
|
-
}
|
|
213
|
-
//#endregion
|
|
214
204
|
//#region src/utils/buildRoutePath.ts
|
|
215
205
|
function Z(e, t) {
|
|
216
206
|
return h(e, t);
|
|
217
207
|
}
|
|
218
208
|
//#endregion
|
|
219
209
|
//#region src/navigate/useNavigate.ts
|
|
220
|
-
function
|
|
221
|
-
let e =
|
|
210
|
+
function Ne() {
|
|
211
|
+
let e = z(), t = w({
|
|
222
212
|
stores: e,
|
|
223
213
|
buildPathname: (e, t) => Z(e, t),
|
|
224
214
|
driver: e.driver,
|
|
@@ -232,15 +222,15 @@ function Ie() {
|
|
|
232
222
|
}
|
|
233
223
|
//#endregion
|
|
234
224
|
//#region src/navigate/usePathname.ts
|
|
235
|
-
function
|
|
225
|
+
function Pe() {
|
|
236
226
|
return K((e) => e.histories[e.pendingIndex]?.pathname ?? "/");
|
|
237
227
|
}
|
|
238
228
|
//#endregion
|
|
239
229
|
//#region src/navigate/useStep.ts
|
|
240
|
-
function
|
|
241
|
-
let { routePath: e } =
|
|
230
|
+
function Fe() {
|
|
231
|
+
let { routePath: e } = V(), t = z(), n = a(xe), { driver: r, markSelfInduced: i } = t, [s, c] = p(null);
|
|
242
232
|
o(() => {
|
|
243
|
-
if (!e) return c(
|
|
233
|
+
if (!e) return c(P(r.readState())), r.subscribe((e) => c(P(e.state)));
|
|
244
234
|
}, [e, r]);
|
|
245
235
|
let l = j({
|
|
246
236
|
stores: t,
|
|
@@ -263,13 +253,13 @@ function Re() {
|
|
|
263
253
|
}
|
|
264
254
|
//#endregion
|
|
265
255
|
//#region src/screen/ParamsProvider/useParams.ts
|
|
266
|
-
function
|
|
267
|
-
return a(
|
|
256
|
+
function Ie() {
|
|
257
|
+
return a(H);
|
|
268
258
|
}
|
|
269
259
|
//#endregion
|
|
270
260
|
//#region src/screen/ScreenFreeze.tsx
|
|
271
|
-
function
|
|
272
|
-
return /* @__PURE__ */
|
|
261
|
+
function Le({ freeze: e, children: n }) {
|
|
262
|
+
return /* @__PURE__ */ L(t, {
|
|
273
263
|
mode: e ? "hidden" : "visible",
|
|
274
264
|
children: n
|
|
275
265
|
});
|
|
@@ -277,15 +267,15 @@ function Be({ freeze: e, children: n }) {
|
|
|
277
267
|
//#endregion
|
|
278
268
|
//#region src/stores/useNavigateStore.ts
|
|
279
269
|
function Q(e) {
|
|
280
|
-
return G(
|
|
270
|
+
return G(z().navigate, e);
|
|
281
271
|
}
|
|
282
272
|
//#endregion
|
|
283
273
|
//#region src/screen/ScreenDecorator.tsx
|
|
284
|
-
function
|
|
285
|
-
let { isActive: r, transitionName: i } =
|
|
274
|
+
function Re({ ref: e, style: t, ...n }) {
|
|
275
|
+
let { isActive: r, transitionName: i } = V(), a = f(null);
|
|
286
276
|
c(e, () => a.current);
|
|
287
|
-
let o = Q((e) => e.status), { decoratorName: s } =
|
|
288
|
-
return l ? /* @__PURE__ */
|
|
277
|
+
let o = Q((e) => e.status), { decoratorName: s } = _e(i), l = ae.get(s);
|
|
278
|
+
return l ? /* @__PURE__ */ L("div", {
|
|
289
279
|
ref: a,
|
|
290
280
|
"data-flemo-decorator": !0,
|
|
291
281
|
"data-flemo-decorator-name": l.name,
|
|
@@ -306,9 +296,9 @@ function Ve({ ref: e, style: t, ...n }) {
|
|
|
306
296
|
}
|
|
307
297
|
//#endregion
|
|
308
298
|
//#region src/screen/useViewportScrollHeight.ts
|
|
309
|
-
function
|
|
299
|
+
function ze() {
|
|
310
300
|
let [e, t] = p(0), [n, r] = p(0);
|
|
311
|
-
return o(() =>
|
|
301
|
+
return o(() => he((e, n) => {
|
|
312
302
|
r(n), t(e);
|
|
313
303
|
}), []), {
|
|
314
304
|
viewportScrollHeight: e,
|
|
@@ -318,67 +308,67 @@ function He() {
|
|
|
318
308
|
//#endregion
|
|
319
309
|
//#region src/stores/useScreenStore.ts
|
|
320
310
|
function $(e) {
|
|
321
|
-
return G(
|
|
311
|
+
return G(z().screen, e);
|
|
322
312
|
}
|
|
323
313
|
//#endregion
|
|
324
314
|
//#region src/screen/ScreenMotion.tsx
|
|
325
|
-
function
|
|
326
|
-
let { id: y, isActive: b, isRoot: x, zIndex: te, transitionName: S, prevTransitionName: C } =
|
|
315
|
+
function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigationBarHeight: r, systemNavigationBarColor: i, sharedTopBar: a, sharedBottomBar: s, topBar: c, bottomBar: l, hideStatusBar: d, hideSystemNavigationBar: m, backgroundColor: h = "white", contentScrollable: _ = !0, ...v }) {
|
|
316
|
+
let { id: y, isActive: b, isRoot: x, zIndex: te, transitionName: S, prevTransitionName: C } = V(), { contained: w } = Ce(), T = w ? "absolute" : "fixed", E = z(), D = Q((e) => e.status), O = $((e) => e.dragStatus), ne = E.screen.getState().setDragStatus, k = E.screen.getState().setReplaceTransitionStatus, A = K((e) => e.index), j = K((e) => e.histories), N = b ? j[A - 1]?.id : j[A]?.id, ie = $((e) => N ? e.sharedBars[N] : void 0), se = $((e) => N ? e.screenSurfaces[N] : void 0), le = f(null);
|
|
327
317
|
le.current ||= re({
|
|
328
318
|
getTransitionTaskId: () => E.navigate.getState().transitionTaskId,
|
|
329
319
|
setDragStatus: ne,
|
|
330
320
|
setReplaceTransitionStatus: k
|
|
331
321
|
});
|
|
332
|
-
let de = le.current,
|
|
333
|
-
transition:
|
|
334
|
-
decorator:
|
|
322
|
+
let de = le.current, fe = _e(S), { initial: pe, swipeDirection: he, decoratorName: ge } = fe, P = ae.get(ge), { viewportScrollHeight: F } = ze(), I = F > 0, [R, be] = p(0), [B, H] = p(0), xe = f(null), U = f(null), Se = f(null), W = f(null), G = f(null), q = f({
|
|
323
|
+
transition: fe,
|
|
324
|
+
decorator: P,
|
|
335
325
|
hasSharedTopBar: !!a,
|
|
336
326
|
hasSharedBottomBar: !!s,
|
|
337
|
-
viewportScrollHeight:
|
|
327
|
+
viewportScrollHeight: F,
|
|
338
328
|
isRoot: x,
|
|
339
329
|
isActive: b,
|
|
340
330
|
status: D,
|
|
341
331
|
dragStatus: O,
|
|
342
332
|
index: A
|
|
343
333
|
});
|
|
344
|
-
|
|
345
|
-
transition:
|
|
346
|
-
decorator:
|
|
334
|
+
q.current = {
|
|
335
|
+
transition: fe,
|
|
336
|
+
decorator: P,
|
|
347
337
|
hasSharedTopBar: !!a,
|
|
348
338
|
hasSharedBottomBar: !!s,
|
|
349
|
-
viewportScrollHeight:
|
|
339
|
+
viewportScrollHeight: F,
|
|
350
340
|
isRoot: x,
|
|
351
341
|
isActive: b,
|
|
352
342
|
status: D,
|
|
353
343
|
dragStatus: O,
|
|
354
344
|
index: A
|
|
355
345
|
};
|
|
356
|
-
let
|
|
357
|
-
|
|
358
|
-
getTransition: () =>
|
|
359
|
-
getDecorator: () =>
|
|
346
|
+
let J = f(null);
|
|
347
|
+
J.current ||= M({
|
|
348
|
+
getTransition: () => q.current.transition,
|
|
349
|
+
getDecorator: () => q.current.decorator,
|
|
360
350
|
getElements: () => ({
|
|
361
351
|
scope: U.current,
|
|
362
|
-
screenContainer:
|
|
363
|
-
decorator:
|
|
364
|
-
sharedTopBar:
|
|
365
|
-
sharedBottomBar:
|
|
352
|
+
screenContainer: xe.current,
|
|
353
|
+
decorator: Se.current,
|
|
354
|
+
sharedTopBar: W.current,
|
|
355
|
+
sharedBottomBar: G.current
|
|
366
356
|
}),
|
|
367
|
-
hasSharedTopBar: () =>
|
|
368
|
-
hasSharedBottomBar: () =>
|
|
369
|
-
getViewportScrollHeight: () =>
|
|
357
|
+
hasSharedTopBar: () => q.current.hasSharedTopBar,
|
|
358
|
+
hasSharedBottomBar: () => q.current.hasSharedBottomBar,
|
|
359
|
+
getViewportScrollHeight: () => q.current.viewportScrollHeight,
|
|
370
360
|
isReadyForDrag: () => {
|
|
371
|
-
let e =
|
|
361
|
+
let e = q.current;
|
|
372
362
|
return !e.isRoot && e.isActive && e.status === "COMPLETED" && e.dragStatus === "IDLE" && !!e.transition.swipeDirection && e.viewportScrollHeight < 10;
|
|
373
363
|
},
|
|
374
364
|
getPartnerBars: () => {
|
|
375
|
-
let e =
|
|
365
|
+
let e = q.current, t = E.history.getState().histories, n = e.isActive ? t[e.index - 1]?.id : t[e.index]?.id;
|
|
376
366
|
return n ? E.screen.getState().sharedBars[n] : void 0;
|
|
377
367
|
},
|
|
378
368
|
setDragStatus: ne,
|
|
379
369
|
back: () => window.history.back()
|
|
380
370
|
});
|
|
381
|
-
let Y =
|
|
371
|
+
let Y = J.current, we = (e) => Y.pointerDown(e.nativeEvent), Te = (e) => Y.pointerMove(e.nativeEvent), Ee = (e) => Y.pointerUp(e.nativeEvent);
|
|
382
372
|
o(() => {
|
|
383
373
|
oe(U.current);
|
|
384
374
|
}, []), o(() => {
|
|
@@ -393,8 +383,8 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
393
383
|
}, [Y]), u(() => de.driveScreenLifecycle({
|
|
394
384
|
getElements: () => ({
|
|
395
385
|
scope: U.current,
|
|
396
|
-
decorator:
|
|
397
|
-
bars: [
|
|
386
|
+
decorator: Se.current,
|
|
387
|
+
bars: [W.current, G.current]
|
|
398
388
|
}),
|
|
399
389
|
transitionName: S,
|
|
400
390
|
prevTransitionName: C,
|
|
@@ -407,19 +397,19 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
407
397
|
C,
|
|
408
398
|
S
|
|
409
399
|
]), u(() => {
|
|
410
|
-
let e =
|
|
400
|
+
let e = W.current;
|
|
411
401
|
if (!e) {
|
|
412
|
-
|
|
402
|
+
be(0);
|
|
413
403
|
return;
|
|
414
404
|
}
|
|
415
|
-
return
|
|
405
|
+
return me(e, be);
|
|
416
406
|
}, [a]), u(() => {
|
|
417
|
-
let e =
|
|
407
|
+
let e = G.current;
|
|
418
408
|
if (!e) {
|
|
419
|
-
|
|
409
|
+
H(0);
|
|
420
410
|
return;
|
|
421
411
|
}
|
|
422
|
-
return
|
|
412
|
+
return me(e, H);
|
|
423
413
|
}, [s]), u(() => {
|
|
424
414
|
let { registerSharedBars: e, unregisterSharedBars: t } = E.screen.getState();
|
|
425
415
|
return e(y, {
|
|
@@ -442,38 +432,38 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
442
432
|
D,
|
|
443
433
|
E.screen
|
|
444
434
|
]);
|
|
445
|
-
let
|
|
435
|
+
let De = b || te === A - 1, { app: Oe, nav: ke } = g({
|
|
446
436
|
status: D,
|
|
447
|
-
isTopOrTopPrev:
|
|
437
|
+
isTopOrTopPrev: De,
|
|
448
438
|
hasTopBar: !!a,
|
|
449
439
|
hasNavBar: !!s,
|
|
450
440
|
partnerBars: ie
|
|
451
441
|
}), X = ee({
|
|
452
442
|
status: D,
|
|
453
|
-
isTopOrTopPrev:
|
|
443
|
+
isTopOrTopPrev: De,
|
|
454
444
|
transitionName: S
|
|
455
|
-
}), [
|
|
445
|
+
}), [Ae, je] = p({
|
|
456
446
|
key: X,
|
|
457
447
|
released: X === null
|
|
458
448
|
});
|
|
459
|
-
|
|
449
|
+
Ae.key !== X && je({
|
|
460
450
|
key: X,
|
|
461
451
|
released: X === null
|
|
462
452
|
});
|
|
463
|
-
let
|
|
453
|
+
let Me = X !== null && Ae.key === X && !Ae.released, Z = Me ? !b && se?.opaqueBackground ? "park" : "true" : "false";
|
|
464
454
|
o(() => {
|
|
465
|
-
if (
|
|
455
|
+
if (Me) return ve(() => je((e) => e.key === X && !e.released ? {
|
|
466
456
|
key: X,
|
|
467
457
|
released: !0
|
|
468
458
|
} : e));
|
|
469
|
-
}, [
|
|
470
|
-
let
|
|
471
|
-
initial:
|
|
459
|
+
}, [Me, X]);
|
|
460
|
+
let Ne = ce({
|
|
461
|
+
initial: pe,
|
|
472
462
|
isActive: b,
|
|
473
463
|
status: D
|
|
474
464
|
});
|
|
475
|
-
return /* @__PURE__ */
|
|
476
|
-
ref:
|
|
465
|
+
return /* @__PURE__ */ ye("div", {
|
|
466
|
+
ref: xe,
|
|
477
467
|
style: {
|
|
478
468
|
position: T,
|
|
479
469
|
top: 0,
|
|
@@ -487,7 +477,7 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
487
477
|
overscrollBehavior: "contain"
|
|
488
478
|
},
|
|
489
479
|
children: [
|
|
490
|
-
/* @__PURE__ */
|
|
480
|
+
/* @__PURE__ */ L("div", {
|
|
491
481
|
"data-swipe-at-edge-bar": !0,
|
|
492
482
|
style: {
|
|
493
483
|
position: T,
|
|
@@ -498,13 +488,13 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
498
488
|
zIndex: 1
|
|
499
489
|
}
|
|
500
490
|
}),
|
|
501
|
-
/* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ ye("div", {
|
|
502
492
|
ref: U,
|
|
503
493
|
...v,
|
|
504
|
-
onPointerDown:
|
|
505
|
-
onPointerMove:
|
|
506
|
-
onPointerUp:
|
|
507
|
-
onPointerCancel:
|
|
494
|
+
onPointerDown: we,
|
|
495
|
+
onPointerMove: Te,
|
|
496
|
+
onPointerUp: Ee,
|
|
497
|
+
onPointerCancel: Ee,
|
|
508
498
|
"data-flemo-screen": !0,
|
|
509
499
|
"data-flemo-transition": S,
|
|
510
500
|
"data-flemo-status": D,
|
|
@@ -516,14 +506,14 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
516
506
|
height: "100%",
|
|
517
507
|
backgroundColor: h,
|
|
518
508
|
overflowY: _ ? void 0 : "auto",
|
|
519
|
-
touchAction:
|
|
520
|
-
...
|
|
509
|
+
touchAction: he === "x" ? "pan-y" : he === "y" ? "pan-x" : "auto",
|
|
510
|
+
...Ne,
|
|
521
511
|
...v.style
|
|
522
512
|
},
|
|
523
513
|
children: [
|
|
524
|
-
!d && t && /* @__PURE__ */
|
|
514
|
+
!d && t && /* @__PURE__ */ L("div", {
|
|
525
515
|
style: { minHeight: t },
|
|
526
|
-
children: /* @__PURE__ */
|
|
516
|
+
children: /* @__PURE__ */ L("div", { style: {
|
|
527
517
|
position: T,
|
|
528
518
|
top: 0,
|
|
529
519
|
width: "100%",
|
|
@@ -531,59 +521,48 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
531
521
|
backgroundColor: n
|
|
532
522
|
} })
|
|
533
523
|
}),
|
|
534
|
-
a && /* @__PURE__ */
|
|
524
|
+
a && /* @__PURE__ */ L("div", { style: {
|
|
535
525
|
width: "100%",
|
|
536
|
-
minHeight:
|
|
526
|
+
minHeight: R
|
|
537
527
|
} }),
|
|
538
528
|
c,
|
|
539
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ L("div", {
|
|
540
530
|
style: {
|
|
541
531
|
display: "flex",
|
|
542
532
|
flexDirection: "column",
|
|
543
533
|
flexGrow: 1,
|
|
544
|
-
overflowY: _ ? "auto" : void 0
|
|
545
|
-
...D !== "IDLE" && D !== "COMPLETED" ? {
|
|
546
|
-
transform: "translateZ(0)",
|
|
547
|
-
willChange: "transform"
|
|
548
|
-
} : null
|
|
534
|
+
overflowY: _ ? "auto" : void 0
|
|
549
535
|
},
|
|
550
|
-
children:
|
|
551
|
-
value: xe,
|
|
552
|
-
children: e
|
|
553
|
-
})
|
|
536
|
+
children: e
|
|
554
537
|
}),
|
|
555
538
|
l,
|
|
556
|
-
s && /* @__PURE__ */
|
|
557
|
-
display:
|
|
539
|
+
s && /* @__PURE__ */ L("div", { style: {
|
|
540
|
+
display: I ? "none" : void 0,
|
|
558
541
|
width: "100%",
|
|
559
|
-
minHeight:
|
|
542
|
+
minHeight: B
|
|
560
543
|
} }),
|
|
561
|
-
!m && r && /* @__PURE__ */
|
|
544
|
+
!m && r && /* @__PURE__ */ L("div", {
|
|
562
545
|
style: {
|
|
563
|
-
display:
|
|
546
|
+
display: I ? "none" : void 0,
|
|
564
547
|
minHeight: r
|
|
565
548
|
},
|
|
566
|
-
children: /* @__PURE__ */
|
|
549
|
+
children: /* @__PURE__ */ L("div", { style: {
|
|
567
550
|
position: T,
|
|
568
551
|
bottom: 0,
|
|
569
552
|
width: "100%",
|
|
570
553
|
minHeight: r,
|
|
571
554
|
backgroundColor: i
|
|
572
555
|
} })
|
|
573
|
-
}),
|
|
574
|
-
/* @__PURE__ */ R("div", {
|
|
575
|
-
ref: Se,
|
|
576
|
-
"data-flemo-layer-mount": !0
|
|
577
556
|
})
|
|
578
557
|
]
|
|
579
558
|
}),
|
|
580
|
-
a && /* @__PURE__ */
|
|
581
|
-
ref:
|
|
559
|
+
a && /* @__PURE__ */ L("div", {
|
|
560
|
+
ref: W,
|
|
582
561
|
"data-flemo-bar": "app",
|
|
583
562
|
"data-flemo-bar-transition": S,
|
|
584
563
|
"data-flemo-bar-status": D,
|
|
585
564
|
"data-flemo-bar-active": b ? "true" : "false",
|
|
586
|
-
"data-flemo-bar-riding":
|
|
565
|
+
"data-flemo-bar-riding": Oe ? "true" : "false",
|
|
587
566
|
"data-flemo-anim-hold": Z,
|
|
588
567
|
style: {
|
|
589
568
|
position: T,
|
|
@@ -594,16 +573,16 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
594
573
|
},
|
|
595
574
|
children: a
|
|
596
575
|
}),
|
|
597
|
-
s && /* @__PURE__ */
|
|
598
|
-
ref:
|
|
576
|
+
s && /* @__PURE__ */ L("div", {
|
|
577
|
+
ref: G,
|
|
599
578
|
"data-flemo-bar": "nav",
|
|
600
579
|
"data-flemo-bar-transition": S,
|
|
601
580
|
"data-flemo-bar-status": D,
|
|
602
581
|
"data-flemo-bar-active": b ? "true" : "false",
|
|
603
|
-
"data-flemo-bar-riding":
|
|
582
|
+
"data-flemo-bar-riding": ke ? "true" : "false",
|
|
604
583
|
"data-flemo-anim-hold": Z,
|
|
605
584
|
style: {
|
|
606
|
-
display:
|
|
585
|
+
display: I ? "none" : void 0,
|
|
607
586
|
position: T,
|
|
608
587
|
bottom: m ? 0 : r,
|
|
609
588
|
left: 0,
|
|
@@ -612,11 +591,11 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
612
591
|
},
|
|
613
592
|
children: s
|
|
614
593
|
}),
|
|
615
|
-
|
|
616
|
-
ref:
|
|
594
|
+
P && /* @__PURE__ */ L(Re, {
|
|
595
|
+
ref: Se,
|
|
617
596
|
"data-flemo-anim-hold": Z
|
|
618
597
|
}),
|
|
619
|
-
/* @__PURE__ */
|
|
598
|
+
/* @__PURE__ */ L("div", {
|
|
620
599
|
"data-swipe-at-edge-bar": !0,
|
|
621
600
|
style: {
|
|
622
601
|
position: T,
|
|
@@ -632,9 +611,9 @@ function Ue({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
632
611
|
}
|
|
633
612
|
//#endregion
|
|
634
613
|
//#region src/screen/Screen.tsx
|
|
635
|
-
function
|
|
636
|
-
let { isActive: n, isPrev: r, zIndex: i } =
|
|
637
|
-
return /* @__PURE__ */
|
|
614
|
+
function Ve({ children: e, ...t }) {
|
|
615
|
+
let { isActive: n, isPrev: r, zIndex: i } = V();
|
|
616
|
+
return /* @__PURE__ */ L(Le, {
|
|
638
617
|
freeze: _({
|
|
639
618
|
isActive: n,
|
|
640
619
|
isPrev: r,
|
|
@@ -644,7 +623,7 @@ function We({ children: e, ...t }) {
|
|
|
644
623
|
dragStatus: $((e) => e.dragStatus),
|
|
645
624
|
replaceTransitionStatus: $((e) => e.replaceTransitionStatus)
|
|
646
625
|
}),
|
|
647
|
-
children: /* @__PURE__ */
|
|
626
|
+
children: /* @__PURE__ */ L(Be, {
|
|
648
627
|
...t,
|
|
649
628
|
children: e
|
|
650
629
|
})
|
|
@@ -652,9 +631,9 @@ function We({ children: e, ...t }) {
|
|
|
652
631
|
}
|
|
653
632
|
//#endregion
|
|
654
633
|
//#region src/screen/Part.tsx
|
|
655
|
-
function
|
|
656
|
-
let { isActive: a } =
|
|
657
|
-
return /* @__PURE__ */
|
|
634
|
+
function He({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
635
|
+
let { isActive: a } = V();
|
|
636
|
+
return /* @__PURE__ */ L("div", {
|
|
658
637
|
ref: e,
|
|
659
638
|
"data-flemo-part-name": t,
|
|
660
639
|
"data-flemo-status": Q((e) => e.status),
|
|
@@ -666,21 +645,21 @@ function Ge({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
|
666
645
|
}
|
|
667
646
|
//#endregion
|
|
668
647
|
//#region src/stores/RouterScopeProvider.tsx
|
|
669
|
-
function
|
|
648
|
+
function Ue({ children: e }) {
|
|
670
649
|
let [t] = p(() => ({
|
|
671
650
|
history: te(),
|
|
672
651
|
navigate: C(),
|
|
673
652
|
transition: ie(),
|
|
674
653
|
screen: A(),
|
|
675
654
|
driver: b(),
|
|
676
|
-
markSelfInduced:
|
|
655
|
+
markSelfInduced: fe,
|
|
677
656
|
consume: v,
|
|
678
657
|
life: { alive: !0 }
|
|
679
658
|
}));
|
|
680
|
-
return /* @__PURE__ */ R
|
|
659
|
+
return /* @__PURE__ */ L(R.Provider, {
|
|
681
660
|
value: t,
|
|
682
661
|
children: e
|
|
683
662
|
});
|
|
684
663
|
}
|
|
685
664
|
//#endregion
|
|
686
|
-
export {
|
|
665
|
+
export { He as Part, Me as Route, je as Router, Ue as RouterScopeProvider, Ve as Screen, B as ScreenContext, Re as ScreenDecorator, Le as ScreenFreeze, Be as ScreenMotion, Ee as Slot, y as createBrowserHistoryDriver, x as createDecorator, T as createPartTransition, E as createRawDecorator, D as createRawPartTransition, O as createRawTransition, N as createTransition, ge as partTransitionMap, K as useHistoryStore, Ne as useNavigate, Q as useNavigateStore, Ie as useParams, Pe as usePathname, V as useScreen, $ as useScreenStore, Fe as useStep, z as useStores, ze as useViewportScrollHeight };
|
package/package.json
CHANGED
package/dist/screen/Layer.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|