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