@flemo/react 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +130 -126
- package/dist/renderer/Renderer.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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,
|
|
3
|
-
import { jsx as L, jsxs as
|
|
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, createNavigateStore as S, createNavigationController as C, createPartTransition as w, createRawDecorator as T, createRawPartTransition as E, createRawTransition as D, createRouterScope as ne, createScreenSelector as O, createScreenStore as k, createStepController as A, createSwipeController as re, createTransition as j, createTransitionEngine as ie, createTransitionStore as M, decoratorMap as ae, eagerlyDecodeImages as oe, ensureScopeHistorySync as se, enteringInitialStyle as ce, getMatchedPathPattern as le, isOpaqueColor as ue, isServer as de, markSelfInducedPop as fe, matchesPathname as N, observeBarHeight as pe, observeViewportScrollHeight as me, partTransitionMap as he, readStepParams as ge, registerTransitionDefinitions as P, releaseScopeHistorySync as F, resolveTransition as _e, scheduleAnimHoldRelease as ve, seedRouterEntry as I, subscribeStepParamsRestore as ye } from "@flemo/core";
|
|
3
|
+
import { jsx as L, jsxs as be } from "react/jsx-runtime";
|
|
4
4
|
//#region src/stores/StoreContext.ts
|
|
5
5
|
var R = r(null);
|
|
6
6
|
//#endregion
|
|
@@ -12,13 +12,9 @@ function z() {
|
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/history/HistoryListener.tsx
|
|
15
|
-
function
|
|
15
|
+
function xe() {
|
|
16
16
|
let e = z();
|
|
17
|
-
return o(() =>
|
|
18
|
-
stores: e,
|
|
19
|
-
driver: e.driver,
|
|
20
|
-
consume: e.consume
|
|
21
|
-
}), [e]), null;
|
|
17
|
+
return o(() => (se(e), () => F(e)), [e]), null;
|
|
22
18
|
}
|
|
23
19
|
//#endregion
|
|
24
20
|
//#region src/screen/ScreenContext.ts
|
|
@@ -42,10 +38,10 @@ function V() {
|
|
|
42
38
|
}
|
|
43
39
|
//#endregion
|
|
44
40
|
//#region src/screen/ParamsProvider/ParamsContext.ts
|
|
45
|
-
var H = r({}),
|
|
41
|
+
var H = r({}), U = r(() => {});
|
|
46
42
|
//#endregion
|
|
47
43
|
//#region src/screen/ParamsProvider/ParamsReducer.ts
|
|
48
|
-
function
|
|
44
|
+
function W(e, t) {
|
|
49
45
|
switch (t.type) {
|
|
50
46
|
case "SET": return t.params;
|
|
51
47
|
default: return e;
|
|
@@ -53,10 +49,10 @@ function U(e, t) {
|
|
|
53
49
|
}
|
|
54
50
|
//#endregion
|
|
55
51
|
//#region src/screen/ParamsProvider/ParamsProvider.tsx
|
|
56
|
-
function
|
|
57
|
-
let { isActive: t, params: n } = V(), { driver: r } = z(), [i, a] = d(
|
|
52
|
+
function G({ children: e }) {
|
|
53
|
+
let { isActive: t, params: n } = V(), { driver: r } = z(), [i, a] = d(W, n);
|
|
58
54
|
return o(() => {
|
|
59
|
-
if (t) return
|
|
55
|
+
if (t) return ye(r, (e) => a({
|
|
60
56
|
type: "SET",
|
|
61
57
|
params: e
|
|
62
58
|
}));
|
|
@@ -64,7 +60,7 @@ function Se({ children: e }) {
|
|
|
64
60
|
t,
|
|
65
61
|
a,
|
|
66
62
|
r
|
|
67
|
-
]), /* @__PURE__ */ L(
|
|
63
|
+
]), /* @__PURE__ */ L(U.Provider, {
|
|
68
64
|
value: a,
|
|
69
65
|
children: /* @__PURE__ */ L(H.Provider, {
|
|
70
66
|
value: i,
|
|
@@ -74,41 +70,41 @@ function Se({ children: e }) {
|
|
|
74
70
|
}
|
|
75
71
|
//#endregion
|
|
76
72
|
//#region ../../node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.17_react@19.2.7/node_modules/zustand/esm/react.mjs
|
|
77
|
-
var
|
|
78
|
-
function
|
|
73
|
+
var K = (e) => e;
|
|
74
|
+
function q(t, n = K) {
|
|
79
75
|
let r = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), e.useCallback(() => n(t.getInitialState()), [t, n]));
|
|
80
76
|
return e.useDebugValue(r), r;
|
|
81
77
|
}
|
|
82
78
|
//#endregion
|
|
83
79
|
//#region src/stores/useHistoryStore.ts
|
|
84
|
-
function
|
|
85
|
-
return
|
|
80
|
+
function J(e) {
|
|
81
|
+
return q(z().history, e);
|
|
86
82
|
}
|
|
87
83
|
//#endregion
|
|
88
84
|
//#region src/renderer/Renderer.tsx
|
|
89
|
-
function
|
|
90
|
-
let t =
|
|
91
|
-
return
|
|
92
|
-
let [r] = n.toArray(e).filter((e) =>
|
|
93
|
-
return /* @__PURE__ */ L(B.Provider, {
|
|
85
|
+
function Se({ children: e }) {
|
|
86
|
+
let t = J((e) => e.index);
|
|
87
|
+
return O(J((e) => e.histories), t).map((t) => {
|
|
88
|
+
let [r] = n.toArray(e).filter((e) => N(e.props.path, t.pathname));
|
|
89
|
+
return r ? /* @__PURE__ */ L(B.Provider, {
|
|
94
90
|
value: {
|
|
95
91
|
...t,
|
|
96
92
|
routePath: le(r.props.path, t.pathname)
|
|
97
93
|
},
|
|
98
|
-
children: /* @__PURE__ */ L(
|
|
99
|
-
}, t.id);
|
|
94
|
+
children: /* @__PURE__ */ L(G, { children: r })
|
|
95
|
+
}, t.id) : null;
|
|
100
96
|
});
|
|
101
97
|
}
|
|
102
98
|
//#endregion
|
|
103
99
|
//#region src/screen/ScreenViewportContext.ts
|
|
104
|
-
var
|
|
100
|
+
var Y = r({ contained: !1 });
|
|
105
101
|
function Ce() {
|
|
106
|
-
return a(
|
|
102
|
+
return a(Y);
|
|
107
103
|
}
|
|
108
104
|
//#endregion
|
|
109
105
|
//#region src/transition/styles.ts
|
|
110
|
-
function
|
|
111
|
-
l(() =>
|
|
106
|
+
function we(e, t, n = []) {
|
|
107
|
+
l(() => P(e, t, n), [
|
|
112
108
|
e,
|
|
113
109
|
t,
|
|
114
110
|
n
|
|
@@ -116,8 +112,8 @@ function Y(e, t, n = []) {
|
|
|
116
112
|
}
|
|
117
113
|
//#endregion
|
|
118
114
|
//#region src/RouterDepthContext.ts
|
|
119
|
-
var
|
|
120
|
-
function
|
|
115
|
+
var Te = r(0), Ee = { contained: !0 };
|
|
116
|
+
function De({ children: e, className: t, style: n }) {
|
|
121
117
|
return /* @__PURE__ */ L("div", {
|
|
122
118
|
className: t,
|
|
123
119
|
style: {
|
|
@@ -125,46 +121,54 @@ function Ee({ children: e, className: t, style: n }) {
|
|
|
125
121
|
overflow: "hidden",
|
|
126
122
|
...n
|
|
127
123
|
},
|
|
128
|
-
children: /* @__PURE__ */ L(
|
|
129
|
-
value:
|
|
130
|
-
children: /* @__PURE__ */ L(
|
|
124
|
+
children: /* @__PURE__ */ L(Y.Provider, {
|
|
125
|
+
value: Ee,
|
|
126
|
+
children: /* @__PURE__ */ L(Se, { children: e })
|
|
131
127
|
})
|
|
132
128
|
});
|
|
133
129
|
}
|
|
134
130
|
//#endregion
|
|
135
131
|
//#region src/Router.tsx
|
|
136
|
-
function
|
|
132
|
+
function Oe(e) {
|
|
137
133
|
let t = null;
|
|
138
134
|
return n.forEach(e, (e) => {
|
|
139
135
|
if (t || !i(e)) return;
|
|
140
|
-
if (e.type ===
|
|
136
|
+
if (e.type === De) {
|
|
141
137
|
t = n.toArray(e.props.children).filter(i);
|
|
142
138
|
return;
|
|
143
139
|
}
|
|
144
140
|
let r = e.props.children;
|
|
145
141
|
if (r) {
|
|
146
|
-
let e =
|
|
142
|
+
let e = Oe(r);
|
|
147
143
|
e && (t = e);
|
|
148
144
|
}
|
|
149
145
|
}), t;
|
|
150
146
|
}
|
|
151
|
-
var
|
|
152
|
-
function
|
|
153
|
-
let m = a(
|
|
147
|
+
var ke = typeof window > "u" ? o : u, X = [], Ae = [], je = [], Me = { contained: !0 };
|
|
148
|
+
function Z({ children: e, initPath: t = "/", defaultTransitionName: r = "cupertino", transitions: i = X, decorators: c = Ae, partTransitions: l = je, history: u = "browser", createDriver: d, className: f, style: ee }) {
|
|
149
|
+
let m = a(Te), h = m > 0, g = u === "memory", _ = s(), v = a(B), y = h && v.id ? `_F_${v.id}_` : _, x = Oe(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) || "/", re = D ? window.location.search : k >= 0 ? O.slice(k) : "", [j] = p(() => ne({
|
|
154
150
|
routePaths: (x ?? n.toArray(e)).map((e) => e.props.path).flat(),
|
|
155
151
|
pathname: A,
|
|
156
|
-
search:
|
|
152
|
+
search: re,
|
|
157
153
|
defaultTransitionName: r,
|
|
158
154
|
memory: g,
|
|
159
155
|
browserDriver: E,
|
|
160
|
-
hostedScope: C
|
|
156
|
+
hostedScope: C,
|
|
157
|
+
routerKey: w ? void 0 : y,
|
|
158
|
+
zoneEntryId: h && !w && v.id || void 0,
|
|
159
|
+
persistKey: h && !g && !w ? y : void 0
|
|
161
160
|
}));
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}), [
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
j.transition.setState({ defaultTransitionName: r }), ke(() => (j.life.alive = !0, () => {
|
|
162
|
+
j.life.alive = !1;
|
|
163
|
+
}), [j]), we(i, c, l), o(() => {
|
|
164
|
+
g || !E || I({
|
|
165
|
+
driver: E,
|
|
166
|
+
routerKey: w ? null : y,
|
|
167
|
+
nested: h && !w,
|
|
168
|
+
seedPathname: A,
|
|
169
|
+
defaultTransitionName: r,
|
|
170
|
+
rootParams: j.history.getState().histories[0]?.params ?? {}
|
|
171
|
+
});
|
|
168
172
|
}, [
|
|
169
173
|
g,
|
|
170
174
|
w,
|
|
@@ -172,17 +176,17 @@ function je({ children: e, initPath: t = "/", defaultTransitionName: r = "cupert
|
|
|
172
176
|
y,
|
|
173
177
|
A,
|
|
174
178
|
r,
|
|
175
|
-
|
|
179
|
+
j.history,
|
|
176
180
|
E
|
|
177
181
|
]);
|
|
178
|
-
let
|
|
182
|
+
let ie = te ? e : /* @__PURE__ */ L(Se, { children: e }), M = /* @__PURE__ */ L(Te.Provider, {
|
|
179
183
|
value: m + 1,
|
|
180
|
-
children: /* @__PURE__ */
|
|
181
|
-
value:
|
|
182
|
-
children: [!g && /* @__PURE__ */ L(
|
|
183
|
-
value:
|
|
184
|
-
children:
|
|
185
|
-
}) :
|
|
184
|
+
children: /* @__PURE__ */ be(R.Provider, {
|
|
185
|
+
value: j,
|
|
186
|
+
children: [!g && /* @__PURE__ */ L(xe, {}), h ? /* @__PURE__ */ L(Y.Provider, {
|
|
187
|
+
value: Me,
|
|
188
|
+
children: ie
|
|
189
|
+
}) : ie]
|
|
186
190
|
})
|
|
187
191
|
});
|
|
188
192
|
return h ? /* @__PURE__ */ L("div", {
|
|
@@ -192,25 +196,25 @@ function je({ children: e, initPath: t = "/", defaultTransitionName: r = "cupert
|
|
|
192
196
|
overflow: "hidden",
|
|
193
197
|
...ee
|
|
194
198
|
},
|
|
195
|
-
children:
|
|
196
|
-
}) :
|
|
199
|
+
children: M
|
|
200
|
+
}) : M;
|
|
197
201
|
}
|
|
198
202
|
//#endregion
|
|
199
203
|
//#region src/Route.tsx
|
|
200
|
-
function
|
|
204
|
+
function Ne({ element: e }) {
|
|
201
205
|
return e;
|
|
202
206
|
}
|
|
203
207
|
//#endregion
|
|
204
208
|
//#region src/utils/buildRoutePath.ts
|
|
205
|
-
function
|
|
209
|
+
function Pe(e, t) {
|
|
206
210
|
return h(e, t);
|
|
207
211
|
}
|
|
208
212
|
//#endregion
|
|
209
213
|
//#region src/navigate/useNavigate.ts
|
|
210
|
-
function
|
|
211
|
-
let e = z(), t =
|
|
214
|
+
function Fe() {
|
|
215
|
+
let e = z(), t = C({
|
|
212
216
|
stores: e,
|
|
213
|
-
buildPathname: (e, t) =>
|
|
217
|
+
buildPathname: (e, t) => Pe(e, t),
|
|
214
218
|
driver: e.driver,
|
|
215
219
|
markSelfInduced: e.markSelfInduced
|
|
216
220
|
});
|
|
@@ -222,21 +226,21 @@ function Ne() {
|
|
|
222
226
|
}
|
|
223
227
|
//#endregion
|
|
224
228
|
//#region src/navigate/usePathname.ts
|
|
225
|
-
function
|
|
226
|
-
return
|
|
229
|
+
function Ie() {
|
|
230
|
+
return J((e) => e.histories[e.pendingIndex]?.pathname ?? "/");
|
|
227
231
|
}
|
|
228
232
|
//#endregion
|
|
229
233
|
//#region src/navigate/useStep.ts
|
|
230
|
-
function
|
|
231
|
-
let { routePath: e } = V(), t = z(), n = a(
|
|
234
|
+
function Le() {
|
|
235
|
+
let { routePath: e } = V(), t = z(), n = a(U), { driver: r, markSelfInduced: i } = t, [s, c] = p(null);
|
|
232
236
|
o(() => {
|
|
233
|
-
if (!e) return c(
|
|
237
|
+
if (!e) return c(ge(r.readState())), r.subscribe((e) => c(ge(e.state)));
|
|
234
238
|
}, [e, r]);
|
|
235
|
-
let l =
|
|
239
|
+
let l = A({
|
|
236
240
|
stores: t,
|
|
237
241
|
driver: r,
|
|
238
242
|
markSelfInduced: i,
|
|
239
|
-
buildStepPathname: (t) => e ?
|
|
243
|
+
buildStepPathname: (t) => e ? Pe(e, t).pathname : m(r.readPathname(), t),
|
|
240
244
|
applyParams: (t) => {
|
|
241
245
|
n({
|
|
242
246
|
type: "SET",
|
|
@@ -253,12 +257,12 @@ function Fe() {
|
|
|
253
257
|
}
|
|
254
258
|
//#endregion
|
|
255
259
|
//#region src/screen/ParamsProvider/useParams.ts
|
|
256
|
-
function
|
|
260
|
+
function Re() {
|
|
257
261
|
return a(H);
|
|
258
262
|
}
|
|
259
263
|
//#endregion
|
|
260
264
|
//#region src/screen/ScreenFreeze.tsx
|
|
261
|
-
function
|
|
265
|
+
function ze({ freeze: e, children: n }) {
|
|
262
266
|
return /* @__PURE__ */ L(t, {
|
|
263
267
|
mode: e ? "hidden" : "visible",
|
|
264
268
|
children: n
|
|
@@ -267,11 +271,11 @@ function Le({ freeze: e, children: n }) {
|
|
|
267
271
|
//#endregion
|
|
268
272
|
//#region src/stores/useNavigateStore.ts
|
|
269
273
|
function Q(e) {
|
|
270
|
-
return
|
|
274
|
+
return q(z().navigate, e);
|
|
271
275
|
}
|
|
272
276
|
//#endregion
|
|
273
277
|
//#region src/screen/ScreenDecorator.tsx
|
|
274
|
-
function
|
|
278
|
+
function Be({ ref: e, style: t, ...n }) {
|
|
275
279
|
let { isActive: r, transitionName: i } = V(), a = f(null);
|
|
276
280
|
c(e, () => a.current);
|
|
277
281
|
let o = Q((e) => e.status), { decoratorName: s } = _e(i), l = ae.get(s);
|
|
@@ -296,9 +300,9 @@ function Re({ ref: e, style: t, ...n }) {
|
|
|
296
300
|
}
|
|
297
301
|
//#endregion
|
|
298
302
|
//#region src/screen/useViewportScrollHeight.ts
|
|
299
|
-
function
|
|
303
|
+
function Ve() {
|
|
300
304
|
let [e, t] = p(0), [n, r] = p(0);
|
|
301
|
-
return o(() =>
|
|
305
|
+
return o(() => me((e, n) => {
|
|
302
306
|
r(n), t(e);
|
|
303
307
|
}), []), {
|
|
304
308
|
viewportScrollHeight: e,
|
|
@@ -308,19 +312,19 @@ function ze() {
|
|
|
308
312
|
//#endregion
|
|
309
313
|
//#region src/stores/useScreenStore.ts
|
|
310
314
|
function $(e) {
|
|
311
|
-
return
|
|
315
|
+
return q(z().screen, e);
|
|
312
316
|
}
|
|
313
317
|
//#endregion
|
|
314
318
|
//#region src/screen/ScreenMotion.tsx
|
|
315
|
-
function
|
|
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),
|
|
317
|
-
|
|
319
|
+
function He({ 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 }) {
|
|
320
|
+
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), ne = $((e) => e.dragStatus), O = E.screen.getState().setDragStatus, k = E.screen.getState().setReplaceTransitionStatus, A = J((e) => e.index), j = J((e) => e.histories), M = b ? j[A - 1]?.id : j[A]?.id, se = $((e) => M ? e.sharedBars[M] : void 0), le = $((e) => M ? e.screenSurfaces[M] : void 0), de = f(null);
|
|
321
|
+
de.current ||= ie({
|
|
318
322
|
getTransitionTaskId: () => E.navigate.getState().transitionTaskId,
|
|
319
|
-
setDragStatus:
|
|
323
|
+
setDragStatus: O,
|
|
320
324
|
setReplaceTransitionStatus: k
|
|
321
325
|
});
|
|
322
|
-
let
|
|
323
|
-
transition:
|
|
326
|
+
let fe = de.current, N = _e(S), { initial: me, swipeDirection: he, decoratorName: ge } = N, P = ae.get(ge), { viewportScrollHeight: F } = Ve(), I = F > 0, [ye, R] = p(0), [xe, B] = p(0), H = f(null), U = f(null), W = f(null), G = f(null), K = f(null), q = f({
|
|
327
|
+
transition: N,
|
|
324
328
|
decorator: P,
|
|
325
329
|
hasSharedTopBar: !!a,
|
|
326
330
|
hasSharedBottomBar: !!s,
|
|
@@ -328,11 +332,11 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
328
332
|
isRoot: x,
|
|
329
333
|
isActive: b,
|
|
330
334
|
status: D,
|
|
331
|
-
dragStatus:
|
|
335
|
+
dragStatus: ne,
|
|
332
336
|
index: A
|
|
333
337
|
});
|
|
334
338
|
q.current = {
|
|
335
|
-
transition:
|
|
339
|
+
transition: N,
|
|
336
340
|
decorator: P,
|
|
337
341
|
hasSharedTopBar: !!a,
|
|
338
342
|
hasSharedBottomBar: !!s,
|
|
@@ -340,19 +344,19 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
340
344
|
isRoot: x,
|
|
341
345
|
isActive: b,
|
|
342
346
|
status: D,
|
|
343
|
-
dragStatus:
|
|
347
|
+
dragStatus: ne,
|
|
344
348
|
index: A
|
|
345
349
|
};
|
|
346
|
-
let
|
|
347
|
-
|
|
350
|
+
let Se = f(null);
|
|
351
|
+
Se.current ||= re({
|
|
348
352
|
getTransition: () => q.current.transition,
|
|
349
353
|
getDecorator: () => q.current.decorator,
|
|
350
354
|
getElements: () => ({
|
|
351
355
|
scope: U.current,
|
|
352
|
-
screenContainer:
|
|
353
|
-
decorator:
|
|
354
|
-
sharedTopBar:
|
|
355
|
-
sharedBottomBar:
|
|
356
|
+
screenContainer: H.current,
|
|
357
|
+
decorator: W.current,
|
|
358
|
+
sharedTopBar: G.current,
|
|
359
|
+
sharedBottomBar: K.current
|
|
356
360
|
}),
|
|
357
361
|
hasSharedTopBar: () => q.current.hasSharedTopBar,
|
|
358
362
|
hasSharedBottomBar: () => q.current.hasSharedBottomBar,
|
|
@@ -365,10 +369,10 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
365
369
|
let e = q.current, t = E.history.getState().histories, n = e.isActive ? t[e.index - 1]?.id : t[e.index]?.id;
|
|
366
370
|
return n ? E.screen.getState().sharedBars[n] : void 0;
|
|
367
371
|
},
|
|
368
|
-
setDragStatus:
|
|
372
|
+
setDragStatus: O,
|
|
369
373
|
back: () => window.history.back()
|
|
370
374
|
});
|
|
371
|
-
let Y =
|
|
375
|
+
let Y = Se.current, we = (e) => Y.pointerDown(e.nativeEvent), Te = (e) => Y.pointerMove(e.nativeEvent), Ee = (e) => Y.pointerUp(e.nativeEvent);
|
|
372
376
|
o(() => {
|
|
373
377
|
oe(U.current);
|
|
374
378
|
}, []), o(() => {
|
|
@@ -380,36 +384,36 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
380
384
|
return e.addEventListener("touchmove", t, { passive: !1 }), () => {
|
|
381
385
|
e.removeEventListener("touchmove", t);
|
|
382
386
|
};
|
|
383
|
-
}, [Y]), u(() =>
|
|
387
|
+
}, [Y]), u(() => fe.driveScreenLifecycle({
|
|
384
388
|
getElements: () => ({
|
|
385
389
|
scope: U.current,
|
|
386
|
-
decorator:
|
|
387
|
-
bars: [
|
|
390
|
+
decorator: W.current,
|
|
391
|
+
bars: [G.current, K.current]
|
|
388
392
|
}),
|
|
389
393
|
transitionName: S,
|
|
390
394
|
prevTransitionName: C,
|
|
391
395
|
status: D,
|
|
392
396
|
isActive: b
|
|
393
397
|
}), [
|
|
394
|
-
|
|
398
|
+
fe,
|
|
395
399
|
D,
|
|
396
400
|
b,
|
|
397
401
|
C,
|
|
398
402
|
S
|
|
399
403
|
]), u(() => {
|
|
400
|
-
let e =
|
|
404
|
+
let e = G.current;
|
|
401
405
|
if (!e) {
|
|
402
|
-
|
|
406
|
+
R(0);
|
|
403
407
|
return;
|
|
404
408
|
}
|
|
405
|
-
return
|
|
409
|
+
return pe(e, R);
|
|
406
410
|
}, [a]), u(() => {
|
|
407
|
-
let e =
|
|
411
|
+
let e = K.current;
|
|
408
412
|
if (!e) {
|
|
409
|
-
|
|
413
|
+
B(0);
|
|
410
414
|
return;
|
|
411
415
|
}
|
|
412
|
-
return
|
|
416
|
+
return pe(e, B);
|
|
413
417
|
}, [s]), u(() => {
|
|
414
418
|
let { registerSharedBars: e, unregisterSharedBars: t } = E.screen.getState();
|
|
415
419
|
return e(y, {
|
|
@@ -437,7 +441,7 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
437
441
|
isTopOrTopPrev: De,
|
|
438
442
|
hasTopBar: !!a,
|
|
439
443
|
hasNavBar: !!s,
|
|
440
|
-
partnerBars:
|
|
444
|
+
partnerBars: se
|
|
441
445
|
}), X = ee({
|
|
442
446
|
status: D,
|
|
443
447
|
isTopOrTopPrev: De,
|
|
@@ -450,7 +454,7 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
450
454
|
key: X,
|
|
451
455
|
released: X === null
|
|
452
456
|
});
|
|
453
|
-
let Me = X !== null && Ae.key === X && !Ae.released, Z = Me ? !b &&
|
|
457
|
+
let Me = X !== null && Ae.key === X && !Ae.released, Z = Me ? !b && le?.opaqueBackground ? "park" : "true" : "false";
|
|
454
458
|
o(() => {
|
|
455
459
|
if (Me) return ve(() => je((e) => e.key === X && !e.released ? {
|
|
456
460
|
key: X,
|
|
@@ -458,12 +462,12 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
458
462
|
} : e));
|
|
459
463
|
}, [Me, X]);
|
|
460
464
|
let Ne = ce({
|
|
461
|
-
initial:
|
|
465
|
+
initial: me,
|
|
462
466
|
isActive: b,
|
|
463
467
|
status: D
|
|
464
468
|
});
|
|
465
|
-
return /* @__PURE__ */
|
|
466
|
-
ref:
|
|
469
|
+
return /* @__PURE__ */ be("div", {
|
|
470
|
+
ref: H,
|
|
467
471
|
style: {
|
|
468
472
|
position: T,
|
|
469
473
|
top: 0,
|
|
@@ -488,7 +492,7 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
488
492
|
zIndex: 1
|
|
489
493
|
}
|
|
490
494
|
}),
|
|
491
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ be("div", {
|
|
492
496
|
ref: U,
|
|
493
497
|
...v,
|
|
494
498
|
onPointerDown: we,
|
|
@@ -523,7 +527,7 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
523
527
|
}),
|
|
524
528
|
a && /* @__PURE__ */ L("div", { style: {
|
|
525
529
|
width: "100%",
|
|
526
|
-
minHeight:
|
|
530
|
+
minHeight: ye
|
|
527
531
|
} }),
|
|
528
532
|
c,
|
|
529
533
|
/* @__PURE__ */ L("div", {
|
|
@@ -539,7 +543,7 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
539
543
|
s && /* @__PURE__ */ L("div", { style: {
|
|
540
544
|
display: I ? "none" : void 0,
|
|
541
545
|
width: "100%",
|
|
542
|
-
minHeight:
|
|
546
|
+
minHeight: xe
|
|
543
547
|
} }),
|
|
544
548
|
!m && r && /* @__PURE__ */ L("div", {
|
|
545
549
|
style: {
|
|
@@ -557,7 +561,7 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
557
561
|
]
|
|
558
562
|
}),
|
|
559
563
|
a && /* @__PURE__ */ L("div", {
|
|
560
|
-
ref:
|
|
564
|
+
ref: G,
|
|
561
565
|
"data-flemo-bar": "app",
|
|
562
566
|
"data-flemo-bar-transition": S,
|
|
563
567
|
"data-flemo-bar-status": D,
|
|
@@ -574,7 +578,7 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
574
578
|
children: a
|
|
575
579
|
}),
|
|
576
580
|
s && /* @__PURE__ */ L("div", {
|
|
577
|
-
ref:
|
|
581
|
+
ref: K,
|
|
578
582
|
"data-flemo-bar": "nav",
|
|
579
583
|
"data-flemo-bar-transition": S,
|
|
580
584
|
"data-flemo-bar-status": D,
|
|
@@ -591,8 +595,8 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
591
595
|
},
|
|
592
596
|
children: s
|
|
593
597
|
}),
|
|
594
|
-
P && /* @__PURE__ */ L(
|
|
595
|
-
ref:
|
|
598
|
+
P && /* @__PURE__ */ L(Be, {
|
|
599
|
+
ref: W,
|
|
596
600
|
"data-flemo-anim-hold": Z
|
|
597
601
|
}),
|
|
598
602
|
/* @__PURE__ */ L("div", {
|
|
@@ -611,19 +615,19 @@ function Be({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
611
615
|
}
|
|
612
616
|
//#endregion
|
|
613
617
|
//#region src/screen/Screen.tsx
|
|
614
|
-
function
|
|
618
|
+
function Ue({ children: e, ...t }) {
|
|
615
619
|
let { isActive: n, isPrev: r, zIndex: i } = V();
|
|
616
|
-
return /* @__PURE__ */ L(
|
|
620
|
+
return /* @__PURE__ */ L(ze, {
|
|
617
621
|
freeze: _({
|
|
618
622
|
isActive: n,
|
|
619
623
|
isPrev: r,
|
|
620
624
|
zIndex: i,
|
|
621
|
-
index:
|
|
625
|
+
index: J((e) => e.index),
|
|
622
626
|
status: Q((e) => e.status),
|
|
623
627
|
dragStatus: $((e) => e.dragStatus),
|
|
624
628
|
replaceTransitionStatus: $((e) => e.replaceTransitionStatus)
|
|
625
629
|
}),
|
|
626
|
-
children: /* @__PURE__ */ L(
|
|
630
|
+
children: /* @__PURE__ */ L(He, {
|
|
627
631
|
...t,
|
|
628
632
|
children: e
|
|
629
633
|
})
|
|
@@ -631,7 +635,7 @@ function Ve({ children: e, ...t }) {
|
|
|
631
635
|
}
|
|
632
636
|
//#endregion
|
|
633
637
|
//#region src/screen/Part.tsx
|
|
634
|
-
function
|
|
638
|
+
function We({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
635
639
|
let { isActive: a } = V();
|
|
636
640
|
return /* @__PURE__ */ L("div", {
|
|
637
641
|
ref: e,
|
|
@@ -645,12 +649,12 @@ function He({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
|
645
649
|
}
|
|
646
650
|
//#endregion
|
|
647
651
|
//#region src/stores/RouterScopeProvider.tsx
|
|
648
|
-
function
|
|
652
|
+
function Ge({ children: e }) {
|
|
649
653
|
let [t] = p(() => ({
|
|
650
654
|
history: te(),
|
|
651
|
-
navigate:
|
|
652
|
-
transition:
|
|
653
|
-
screen:
|
|
655
|
+
navigate: S(),
|
|
656
|
+
transition: M(),
|
|
657
|
+
screen: k(),
|
|
654
658
|
driver: b(),
|
|
655
659
|
markSelfInduced: fe,
|
|
656
660
|
consume: v,
|
|
@@ -662,4 +666,4 @@ function Ue({ children: e }) {
|
|
|
662
666
|
});
|
|
663
667
|
}
|
|
664
668
|
//#endregion
|
|
665
|
-
export {
|
|
669
|
+
export { We as Part, Ne as Route, Z as Router, Ge as RouterScopeProvider, Ue as Screen, B as ScreenContext, Be as ScreenDecorator, ze as ScreenFreeze, He as ScreenMotion, De as Slot, y as createBrowserHistoryDriver, x as createDecorator, w as createPartTransition, T as createRawDecorator, E as createRawPartTransition, D as createRawTransition, j as createTransition, he as partTransitionMap, J as useHistoryStore, Fe as useNavigate, Q as useNavigateStore, Re as useParams, Ie as usePathname, V as useScreen, $ as useScreenStore, Le as useStep, z as useStores, Ve as useViewportScrollHeight };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemo/react",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
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.12.
|
|
39
|
+
"@flemo/core": "1.12.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"vite": "^8.0.16",
|
|
55
55
|
"vite-plugin-dts": "^5.0.2",
|
|
56
56
|
"vitest": "^4.1.9",
|
|
57
|
-
"@flemo/
|
|
58
|
-
"@flemo/
|
|
57
|
+
"@flemo/tsconfig": "0.0.0",
|
|
58
|
+
"@flemo/eslint-config": "0.0.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"react": "^19.2.7",
|