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