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