@flemo/react 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RouterIdContext.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +452 -354
- package/dist/screen/Screen.d.ts +3 -0
- package/dist/screen/ScreenContext.d.ts +1 -0
- package/dist/screen/ScreenMotion.d.ts +1 -1
- package/dist/screen/store.d.ts +1 -1
- package/package.json +11 -11
- /package/dist/screen/__tests__/{ScreenMotion.suspendedMountEffects.test.d.ts → ScreenFreeze.test.d.ts} +0 -0
- /package/dist/{utils/__tests__/buildRoutePath.test.d.ts → screen/__tests__/ScreenMotion.outerPartHold.test.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { default as useScreenStore } from './stores/useScreenStore';
|
|
|
18
18
|
export { default as useStores } from './stores/useStores';
|
|
19
19
|
export { default as RouterScopeProvider } from './stores/RouterScopeProvider';
|
|
20
20
|
export { type FlemoStores } from './stores/StoreContext';
|
|
21
|
-
export { type SharedBarPresence } from './screen/store';
|
|
21
|
+
export { type SharedBarId, type SharedBarMetadata, type SharedBarPresence, type SharedBarsMetadata } from './screen/store';
|
|
22
22
|
export { default as useViewportScrollHeight } from './screen/useViewportScrollHeight';
|
|
23
23
|
export { createTransition, createRawTransition, createDecorator, createRawDecorator, createPartTransition, createRawPartTransition, partTransitionMap, createBrowserHistoryDriver } from '@flemo/core';
|
|
24
24
|
export type { TransitionName, RegisterTransition, DecoratorName, RegisterDecorator, PartTransitionName, RegisterPartTransition, PartTransitionOptions, HistoryDriver, HistoryNavEvent } from '@flemo/core';
|
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import e, { Activity as t, Children as n, createContext as r, isValidElement as i,
|
|
2
|
-
import { animHoldKey as ee, appendParamsQuery as
|
|
3
|
-
import { jsx as
|
|
1
|
+
import e, { Activity as t, Children as n, createContext as r, isValidElement as i, useCallback as a, useContext as o, useEffect as s, useId as c, useImperativeHandle as l, useInsertionEffect as u, useLayoutEffect as d, useReducer as f, useRef as p, useState as m } from "react";
|
|
2
|
+
import { animHoldKey as ee, appendParamsQuery as te, buildRoutePath as ne, computeBarRiding as re, computeScreenFreeze as ie, computeScreenFreezeMode as h, consumeSelfInducedPop as g, createAnimHoldCoordinator as ae, createBrowserHistoryDriver as _, createBrowserHistoryDriver as oe, createDecorator as v, createHistoryStore as y, createNavigateStore as b, createNavigationController as se, createPartTransition as x, createRawDecorator as S, createRawPartTransition as ce, createRawTransition as C, createRouterScope as w, createScreenSelector as T, createScreenStore as E, createStepController as D, createSwipeController as le, createTransition as ue, createTransitionEngine as O, createTransitionStore as de, decoratorMap as fe, detectBlinkEngine as pe, eagerlyDecodeImages as me, ensureGpuPipelinePrewarm as k, ensureImageDecodeOffloader as he, ensureScopeHistorySync as ge, enteringInitialStyle as _e, getMatchedPathPattern as ve, governedCompiledActive as ye, holdCompositorWarm as be, isLegacyAndroidBlink as A, isOpaqueColor as xe, isServer as Se, markSelfInducedPop as j, matchesPathname as Ce, observeBarHeight as we, observeViewportScrollHeight as Te, partTransitionMap as Ee, readImageOffloadOverride as De, readPrerasterFlag as Oe, readSettleGateFlag as ke, readStepParams as M, registerTransitionDefinitions as Ae, releaseScopeHistorySync as je, resolveTransition as Me, seedRouterEntry as Ne, sharedBarsMatch as Pe, steadySixtyPlayerEligible as Fe, subscribeStepParamsRestore as Ie } from "@flemo/core";
|
|
3
|
+
import { jsx as N, jsxs as Le } from "react/jsx-runtime";
|
|
4
|
+
import { flushSync as Re } from "react-dom";
|
|
4
5
|
//#region src/stores/StoreContext.ts
|
|
5
|
-
var
|
|
6
|
+
var P = r(null);
|
|
6
7
|
//#endregion
|
|
7
8
|
//#region src/stores/useStores.ts
|
|
8
|
-
function
|
|
9
|
-
let e =
|
|
9
|
+
function F() {
|
|
10
|
+
let e = o(P);
|
|
10
11
|
if (!e) throw Error("flemo stores are missing. Render inside a <Router>.");
|
|
11
12
|
return e;
|
|
12
13
|
}
|
|
13
14
|
//#endregion
|
|
14
15
|
//#region src/history/HistoryListener.tsx
|
|
15
|
-
function
|
|
16
|
-
let e =
|
|
17
|
-
return
|
|
16
|
+
function ze() {
|
|
17
|
+
let e = F();
|
|
18
|
+
return s(() => (ge(e), () => je(e)), [e]), null;
|
|
18
19
|
}
|
|
19
20
|
//#endregion
|
|
20
21
|
//#region src/screen/ScreenContext.ts
|
|
21
|
-
var
|
|
22
|
+
var I = r({
|
|
22
23
|
id: "",
|
|
23
24
|
isActive: !1,
|
|
24
25
|
isRoot: !0,
|
|
@@ -33,15 +34,15 @@ var B = r({
|
|
|
33
34
|
});
|
|
34
35
|
//#endregion
|
|
35
36
|
//#region src/screen/useScreen.ts
|
|
36
|
-
function
|
|
37
|
-
return
|
|
37
|
+
function L() {
|
|
38
|
+
return o(I);
|
|
38
39
|
}
|
|
39
40
|
//#endregion
|
|
40
41
|
//#region src/screen/ParamsProvider/ParamsContext.ts
|
|
41
|
-
var
|
|
42
|
+
var R = r({}), z = r(() => {});
|
|
42
43
|
//#endregion
|
|
43
44
|
//#region src/screen/ParamsProvider/ParamsReducer.ts
|
|
44
|
-
function
|
|
45
|
+
function B(e, t) {
|
|
45
46
|
switch (t.type) {
|
|
46
47
|
case "SET": return t.params;
|
|
47
48
|
default: return e;
|
|
@@ -49,10 +50,10 @@ function H(e, t) {
|
|
|
49
50
|
}
|
|
50
51
|
//#endregion
|
|
51
52
|
//#region src/screen/ParamsProvider/ParamsProvider.tsx
|
|
52
|
-
function
|
|
53
|
-
let { isActive: t, params: n } =
|
|
54
|
-
return
|
|
55
|
-
if (t) return
|
|
53
|
+
function Be({ children: e }) {
|
|
54
|
+
let { isActive: t, params: n } = L(), { driver: r } = F(), [i, a] = f(B, n);
|
|
55
|
+
return s(() => {
|
|
56
|
+
if (t) return Ie(r, (e) => a({
|
|
56
57
|
type: "SET",
|
|
57
58
|
params: e
|
|
58
59
|
}));
|
|
@@ -60,53 +61,57 @@ function De({ children: e }) {
|
|
|
60
61
|
t,
|
|
61
62
|
a,
|
|
62
63
|
r
|
|
63
|
-
]), /* @__PURE__ */
|
|
64
|
+
]), /* @__PURE__ */ N(z.Provider, {
|
|
64
65
|
value: a,
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ N(R.Provider, {
|
|
66
67
|
value: i,
|
|
67
68
|
children: e
|
|
68
69
|
})
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
//#endregion
|
|
72
|
-
//#region ../../node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.
|
|
73
|
-
var
|
|
74
|
-
function
|
|
73
|
+
//#region ../../node_modules/.pnpm/zustand@5.0.14_@types+react@19.2.18_react@19.2.8/node_modules/zustand/esm/react.mjs
|
|
74
|
+
var Ve = (e) => e;
|
|
75
|
+
function V(t, n = Ve) {
|
|
75
76
|
let r = e.useSyncExternalStore(t.subscribe, e.useCallback(() => n(t.getState()), [t, n]), e.useCallback(() => n(t.getInitialState()), [t, n]));
|
|
76
77
|
return e.useDebugValue(r), r;
|
|
77
78
|
}
|
|
78
79
|
//#endregion
|
|
79
80
|
//#region src/stores/useHistoryStore.ts
|
|
80
|
-
function
|
|
81
|
-
return
|
|
81
|
+
function H(e) {
|
|
82
|
+
return V(F().history, e);
|
|
82
83
|
}
|
|
83
84
|
//#endregion
|
|
85
|
+
//#region src/RouterIdContext.ts
|
|
86
|
+
var He = r(null);
|
|
87
|
+
//#endregion
|
|
84
88
|
//#region src/renderer/Renderer.tsx
|
|
85
|
-
function
|
|
86
|
-
let t =
|
|
87
|
-
return
|
|
88
|
-
let [r] = n.toArray(e).filter((e) =>
|
|
89
|
-
return r ? /* @__PURE__ */
|
|
89
|
+
function Ue({ children: e }) {
|
|
90
|
+
let t = H((e) => e.index), r = H((e) => e.histories), i = F(), a = o(I), s = o(He);
|
|
91
|
+
return T(r, t).map((t) => {
|
|
92
|
+
let [r] = n.toArray(e).filter((e) => Ce(e.props.path, t.pathname));
|
|
93
|
+
return r ? /* @__PURE__ */ N(I.Provider, {
|
|
90
94
|
value: {
|
|
91
95
|
...t,
|
|
92
|
-
isPrev: t.isPrev ||
|
|
96
|
+
isPrev: t.isPrev || a.isPrev,
|
|
93
97
|
navigateStore: i.navigate,
|
|
94
|
-
|
|
98
|
+
routerId: s ?? void 0,
|
|
99
|
+
routePath: ve(r.props.path, t.pathname)
|
|
95
100
|
},
|
|
96
|
-
children: /* @__PURE__ */
|
|
101
|
+
children: /* @__PURE__ */ N(Be, { children: r })
|
|
97
102
|
}, t.id) : null;
|
|
98
103
|
});
|
|
99
104
|
}
|
|
100
105
|
//#endregion
|
|
101
106
|
//#region src/screen/ScreenViewportContext.ts
|
|
102
|
-
var
|
|
103
|
-
function
|
|
104
|
-
return
|
|
107
|
+
var U = r({ contained: !1 });
|
|
108
|
+
function We() {
|
|
109
|
+
return o(U);
|
|
105
110
|
}
|
|
106
111
|
//#endregion
|
|
107
112
|
//#region src/transition/styles.ts
|
|
108
|
-
function
|
|
109
|
-
|
|
113
|
+
function Ge(e, t, n = []) {
|
|
114
|
+
u(() => Ae(e, t, n), [
|
|
110
115
|
e,
|
|
111
116
|
t,
|
|
112
117
|
n
|
|
@@ -114,64 +119,72 @@ function J(e, t, n = []) {
|
|
|
114
119
|
}
|
|
115
120
|
//#endregion
|
|
116
121
|
//#region src/RouterDepthContext.ts
|
|
117
|
-
var
|
|
118
|
-
function
|
|
119
|
-
return /* @__PURE__ */
|
|
122
|
+
var Ke = r(0), qe = { contained: !0 };
|
|
123
|
+
function Je({ children: e, className: t, style: n }) {
|
|
124
|
+
return /* @__PURE__ */ N("div", {
|
|
120
125
|
className: t,
|
|
121
126
|
style: {
|
|
122
127
|
position: "relative",
|
|
123
128
|
overflow: "hidden",
|
|
124
129
|
...n
|
|
125
130
|
},
|
|
126
|
-
children: /* @__PURE__ */
|
|
127
|
-
value:
|
|
128
|
-
children: /* @__PURE__ */
|
|
131
|
+
children: /* @__PURE__ */ N(U.Provider, {
|
|
132
|
+
value: qe,
|
|
133
|
+
children: /* @__PURE__ */ N(Ue, { children: e })
|
|
129
134
|
})
|
|
130
135
|
});
|
|
131
136
|
}
|
|
132
137
|
//#endregion
|
|
133
138
|
//#region src/Router.tsx
|
|
134
|
-
function
|
|
139
|
+
function Ye(e) {
|
|
135
140
|
let t = null;
|
|
136
141
|
return n.forEach(e, (e) => {
|
|
137
142
|
if (t || !i(e)) return;
|
|
138
|
-
if (e.type ===
|
|
143
|
+
if (e.type === Je) {
|
|
139
144
|
t = n.toArray(e.props.children).filter(i);
|
|
140
145
|
return;
|
|
141
146
|
}
|
|
142
147
|
let r = e.props.children;
|
|
143
148
|
if (r) {
|
|
144
|
-
let e =
|
|
149
|
+
let e = Ye(r);
|
|
145
150
|
e && (t = e);
|
|
146
151
|
}
|
|
147
152
|
}), t;
|
|
148
153
|
}
|
|
149
|
-
var
|
|
150
|
-
function
|
|
151
|
-
let
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
154
|
+
var Xe = typeof window > "u" ? s : d, Ze = [], Qe = [], W = [], $e = { contained: !0 }, et = 500, tt = 3e3;
|
|
155
|
+
function G({ children: e, initPath: t = "/", defaultTransitionName: r = "cupertino", transitions: i = Ze, decorators: a = Qe, partTransitions: l = W, history: u = "browser", createDriver: d, className: f, style: p }) {
|
|
156
|
+
let ee = o(Ke), te = c(), [ne, re] = m(!1);
|
|
157
|
+
s(() => re(!0), []);
|
|
158
|
+
let ie = ne ? te : null, h = ee > 0, g = u === "memory", ae = c(), _ = o(I), v = o(P), y = h && _.id ? `_F_${v?.routerKey ?? ""}${_.id}_` : ae, b = Ye(e), se = b !== null, x = h ? null : v, S = x !== null, ce = d ?? oe, [C] = m(() => g ? null : ce(S ? void 0 : y)), T = !h && !g && !Se(), E = T && C ? C.readPathname() : t || "/", D = E.indexOf("?"), le = (D >= 0 ? E.slice(0, D) : E) || "/", ue = T ? window.location.search : D >= 0 ? E.slice(D) : "", [O] = m(() => {
|
|
159
|
+
let t = (b ?? n.toArray(e)).map((e) => e.props.path).flat();
|
|
160
|
+
return w({
|
|
161
|
+
routePaths: t,
|
|
162
|
+
pathname: le,
|
|
163
|
+
search: ue,
|
|
164
|
+
defaultTransitionName: r,
|
|
165
|
+
memory: g,
|
|
166
|
+
browserDriver: C,
|
|
167
|
+
hostedScope: x,
|
|
168
|
+
routerKey: S ? void 0 : y,
|
|
169
|
+
zoneEntryId: h && !S && _.id || void 0,
|
|
170
|
+
persistKey: h && !g && !S ? y : void 0
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
O.transition.setState({ defaultTransitionName: r }), Xe(() => (O.life.alive = !0, () => {
|
|
174
|
+
O.life.alive = !1;
|
|
175
|
+
}), [O]), Ge(i, a, l), s(() => {
|
|
176
|
+
let e = De();
|
|
177
|
+
if (e !== "off") return e === "on" || A() ? he() : void 0;
|
|
178
|
+
}, []), s(() => k(), []), s(() => {
|
|
166
179
|
if (typeof document > "u") return;
|
|
167
180
|
let e = null, t = null, n = 0, r = () => {
|
|
168
181
|
let r = Date.now();
|
|
169
|
-
if (r - n <
|
|
182
|
+
if (r - n < et) return;
|
|
170
183
|
n = r, t && clearTimeout(t);
|
|
171
184
|
let i = e;
|
|
172
|
-
e =
|
|
185
|
+
e = be(), i?.(), t = setTimeout(() => {
|
|
173
186
|
t = null, e?.(), e = null;
|
|
174
|
-
},
|
|
187
|
+
}, tt);
|
|
175
188
|
}, i = [
|
|
176
189
|
"pointerdown",
|
|
177
190
|
"pointermove",
|
|
@@ -184,61 +197,64 @@ function ze({ children: e, initPath: t = "/", defaultTransitionName: r = "cupert
|
|
|
184
197
|
for (let e of i) document.removeEventListener(e, r);
|
|
185
198
|
t && clearTimeout(t), e?.();
|
|
186
199
|
};
|
|
187
|
-
}, []),
|
|
188
|
-
g || !
|
|
189
|
-
driver:
|
|
200
|
+
}, []), s(() => {
|
|
201
|
+
g || !C || Ne({
|
|
202
|
+
driver: C,
|
|
190
203
|
routerKey: S ? null : y,
|
|
191
204
|
nested: h && !S,
|
|
192
|
-
seedPathname:
|
|
205
|
+
seedPathname: le,
|
|
193
206
|
defaultTransitionName: r,
|
|
194
|
-
rootParams:
|
|
207
|
+
rootParams: O.history.getState().histories[0]?.params ?? {}
|
|
195
208
|
});
|
|
196
209
|
}, [
|
|
197
210
|
g,
|
|
198
211
|
S,
|
|
199
212
|
h,
|
|
200
213
|
y,
|
|
201
|
-
|
|
214
|
+
le,
|
|
202
215
|
r,
|
|
203
|
-
|
|
204
|
-
|
|
216
|
+
O.history,
|
|
217
|
+
C
|
|
205
218
|
]);
|
|
206
|
-
let
|
|
207
|
-
value:
|
|
208
|
-
children: /* @__PURE__ */
|
|
209
|
-
value:
|
|
210
|
-
children:
|
|
211
|
-
value:
|
|
212
|
-
children:
|
|
213
|
-
|
|
219
|
+
let de = se ? e : /* @__PURE__ */ N(Ue, { children: e }), fe = /* @__PURE__ */ N(He.Provider, {
|
|
220
|
+
value: ie,
|
|
221
|
+
children: /* @__PURE__ */ N(Ke.Provider, {
|
|
222
|
+
value: ee + 1,
|
|
223
|
+
children: /* @__PURE__ */ Le(P.Provider, {
|
|
224
|
+
value: O,
|
|
225
|
+
children: [!g && /* @__PURE__ */ N(ze, {}), h ? /* @__PURE__ */ N(U.Provider, {
|
|
226
|
+
value: $e,
|
|
227
|
+
children: de
|
|
228
|
+
}) : de]
|
|
229
|
+
})
|
|
214
230
|
})
|
|
215
231
|
});
|
|
216
|
-
return h ? /* @__PURE__ */
|
|
232
|
+
return h ? /* @__PURE__ */ N("div", {
|
|
217
233
|
className: f,
|
|
218
234
|
style: {
|
|
219
235
|
position: "relative",
|
|
220
236
|
overflow: "hidden",
|
|
221
|
-
...
|
|
237
|
+
...p
|
|
222
238
|
},
|
|
223
|
-
children:
|
|
224
|
-
}) :
|
|
239
|
+
children: fe
|
|
240
|
+
}) : fe;
|
|
225
241
|
}
|
|
226
242
|
//#endregion
|
|
227
243
|
//#region src/Route.tsx
|
|
228
|
-
function
|
|
244
|
+
function K({ element: e }) {
|
|
229
245
|
return e;
|
|
230
246
|
}
|
|
231
247
|
//#endregion
|
|
232
248
|
//#region src/utils/buildRoutePath.ts
|
|
233
|
-
function
|
|
234
|
-
return
|
|
249
|
+
function q(e, t) {
|
|
250
|
+
return ne(e, t);
|
|
235
251
|
}
|
|
236
252
|
//#endregion
|
|
237
253
|
//#region src/navigate/useNavigate.ts
|
|
238
|
-
function
|
|
239
|
-
let e =
|
|
254
|
+
function nt() {
|
|
255
|
+
let e = F(), t = se({
|
|
240
256
|
stores: e,
|
|
241
|
-
buildPathname: (e, t) =>
|
|
257
|
+
buildPathname: (e, t) => q(e, t),
|
|
242
258
|
driver: e.driver,
|
|
243
259
|
markSelfInduced: e.markSelfInduced
|
|
244
260
|
});
|
|
@@ -250,21 +266,21 @@ function Be() {
|
|
|
250
266
|
}
|
|
251
267
|
//#endregion
|
|
252
268
|
//#region src/navigate/usePathname.ts
|
|
253
|
-
function
|
|
254
|
-
return
|
|
269
|
+
function rt() {
|
|
270
|
+
return H((e) => e.histories[e.pendingIndex]?.pathname ?? "/");
|
|
255
271
|
}
|
|
256
272
|
//#endregion
|
|
257
273
|
//#region src/navigate/useStep.ts
|
|
258
|
-
function
|
|
259
|
-
let { routePath: e } =
|
|
260
|
-
|
|
261
|
-
if (!e) return c(
|
|
274
|
+
function it() {
|
|
275
|
+
let { routePath: e } = L(), t = F(), n = o(z), { driver: r, markSelfInduced: i } = t, [a, c] = m(null);
|
|
276
|
+
s(() => {
|
|
277
|
+
if (!e) return c(M(r.readState())), r.subscribe((e) => c(M(e.state)));
|
|
262
278
|
}, [e, r]);
|
|
263
|
-
let l =
|
|
279
|
+
let l = D({
|
|
264
280
|
stores: t,
|
|
265
281
|
driver: r,
|
|
266
282
|
markSelfInduced: i,
|
|
267
|
-
buildStepPathname: (t) => e ?
|
|
283
|
+
buildStepPathname: (t) => e ? q(e, t).pathname : te(r.readPathname(), t),
|
|
268
284
|
applyParams: (t) => {
|
|
269
285
|
n({
|
|
270
286
|
type: "SET",
|
|
@@ -273,7 +289,7 @@ function He() {
|
|
|
273
289
|
}
|
|
274
290
|
});
|
|
275
291
|
return {
|
|
276
|
-
step:
|
|
292
|
+
step: a,
|
|
277
293
|
pushStep: (e) => l.pushStep(e),
|
|
278
294
|
replaceStep: (e) => l.replaceStep(e),
|
|
279
295
|
popStep: l.popStep
|
|
@@ -281,36 +297,50 @@ function He() {
|
|
|
281
297
|
}
|
|
282
298
|
//#endregion
|
|
283
299
|
//#region src/screen/ParamsProvider/useParams.ts
|
|
284
|
-
function
|
|
285
|
-
return
|
|
300
|
+
function J() {
|
|
301
|
+
return o(R);
|
|
286
302
|
}
|
|
287
303
|
//#endregion
|
|
288
304
|
//#region src/screen/ScreenFreeze.tsx
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
305
|
+
var at = 3e3;
|
|
306
|
+
function Y({ freeze: e, children: n }) {
|
|
307
|
+
let [r, i] = m(e), a = p(null);
|
|
308
|
+
return !e && r && i(!1), s(() => {
|
|
309
|
+
if (!(!e || r)) {
|
|
310
|
+
if (!Fe()) {
|
|
311
|
+
i(!0);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
return a.current = setTimeout(() => {
|
|
315
|
+
a.current = null, i(!0);
|
|
316
|
+
}, at), () => {
|
|
317
|
+
a.current !== null && (clearTimeout(a.current), a.current = null);
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
}, [e, r]), /* @__PURE__ */ N(t, {
|
|
321
|
+
mode: e && r ? "hidden" : "visible",
|
|
292
322
|
children: n
|
|
293
323
|
});
|
|
294
324
|
}
|
|
295
325
|
//#endregion
|
|
296
326
|
//#region src/screen/scopeAnimHoldCoordinator.ts
|
|
297
|
-
var
|
|
298
|
-
function
|
|
299
|
-
let t =
|
|
300
|
-
return t || (t =
|
|
327
|
+
var ot = /* @__PURE__ */ new WeakMap();
|
|
328
|
+
function st(e) {
|
|
329
|
+
let t = ot.get(e);
|
|
330
|
+
return t || (t = ae(), ot.set(e, t)), t;
|
|
301
331
|
}
|
|
302
332
|
//#endregion
|
|
303
333
|
//#region src/stores/useNavigateStore.ts
|
|
304
|
-
function
|
|
305
|
-
return
|
|
334
|
+
function ct(e) {
|
|
335
|
+
return V(F().navigate, e);
|
|
306
336
|
}
|
|
307
337
|
//#endregion
|
|
308
338
|
//#region src/screen/ScreenDecorator.tsx
|
|
309
|
-
function
|
|
310
|
-
let { isActive: r, isPrev: i, transitionName: a } =
|
|
311
|
-
|
|
312
|
-
let s =
|
|
313
|
-
return u ? /* @__PURE__ */
|
|
339
|
+
function lt({ ref: e, style: t, ...n }) {
|
|
340
|
+
let { isActive: r, isPrev: i, transitionName: a } = L(), o = p(null);
|
|
341
|
+
l(e, () => o.current);
|
|
342
|
+
let s = ct((e) => i ? "COMPLETED" : e.status), { decoratorName: c } = Me(a), u = fe.get(c);
|
|
343
|
+
return u ? /* @__PURE__ */ N("div", {
|
|
314
344
|
ref: o,
|
|
315
345
|
"data-flemo-decorator": !0,
|
|
316
346
|
"data-flemo-decorator-name": u.name,
|
|
@@ -331,9 +361,9 @@ function qe({ ref: e, style: t, ...n }) {
|
|
|
331
361
|
}
|
|
332
362
|
//#endregion
|
|
333
363
|
//#region src/screen/useViewportScrollHeight.ts
|
|
334
|
-
function
|
|
335
|
-
let [e, t] =
|
|
336
|
-
return
|
|
364
|
+
function ut() {
|
|
365
|
+
let [e, t] = m(0), [n, r] = m(0);
|
|
366
|
+
return s(() => Te((e, n) => {
|
|
337
367
|
r(n), t(e);
|
|
338
368
|
}), []), {
|
|
339
369
|
viewportScrollHeight: e,
|
|
@@ -342,251 +372,319 @@ function Je() {
|
|
|
342
372
|
}
|
|
343
373
|
//#endregion
|
|
344
374
|
//#region src/stores/useScreenStore.ts
|
|
345
|
-
function
|
|
346
|
-
return
|
|
375
|
+
function X(e) {
|
|
376
|
+
return V(F().screen, e);
|
|
347
377
|
}
|
|
348
378
|
//#endregion
|
|
349
379
|
//#region src/screen/ScreenMotion.tsx
|
|
350
|
-
function
|
|
351
|
-
let { id:
|
|
352
|
-
|
|
353
|
-
getTransitionTaskId: () =>
|
|
354
|
-
setDragStatus:
|
|
355
|
-
setReplaceTransitionStatus:
|
|
380
|
+
function dt({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigationBarHeight: r, systemNavigationBarColor: i, sharedTopBar: c, sharedTopBarId: l, sharedBottomBar: u, sharedBottomBarId: f, topBar: te, bottomBar: ne, hideStatusBar: h, hideSystemNavigationBar: g, backgroundColor: ae = "white", contentScrollable: _ = !0, ...oe }) {
|
|
381
|
+
let { id: v, isActive: y, isRoot: b, isPrev: se, zIndex: x, transitionName: S, prevTransitionName: ce } = L(), { contained: C } = We(), w = C ? "absolute" : "fixed", T = F(), E = o(He), D = H((e) => e.index), ue = H((e) => e.histories), de = y || x === D - 1, k = ct((e) => de ? e.status : "COMPLETED"), he = X((e) => e.dragStatus), ge = X((e) => e.replaceTransitionStatus), ve = T.screen.getState().setDragStatus, be = T.screen.getState().setReplaceTransitionStatus, A = y ? ue[D - 1]?.id : ue[D]?.id, Se = X((e) => A ? e.sharedBars[A] : void 0), j = X((e) => A ? e.sharedBarMetadata[A] : void 0), Ce = X((e) => A ? e.screenSurfaces[A] : void 0), Te = p(null);
|
|
382
|
+
Te.current ||= O({
|
|
383
|
+
getTransitionTaskId: () => T.navigate.getState().transitionTaskId,
|
|
384
|
+
setDragStatus: ve,
|
|
385
|
+
setReplaceTransitionStatus: be
|
|
356
386
|
});
|
|
357
|
-
let
|
|
358
|
-
|
|
359
|
-
let M =
|
|
387
|
+
let Ee = Te.current, De = p(null);
|
|
388
|
+
De.current ||= st(T.navigate);
|
|
389
|
+
let M = Me(S), { initial: Ae, swipeDirection: je, decoratorName: Ne } = M, Ie = fe.get(Ne), { viewportScrollHeight: P } = ut(), ze = P > 0, I = !!c, R = !!u, z = I ? `${typeof l}:${String(l)}` : null, B = R ? `${typeof f}:${String(f)}` : null, [Be, Ve] = m({
|
|
390
|
+
key: z,
|
|
391
|
+
height: 0
|
|
392
|
+
}), [V, Ue] = m({
|
|
393
|
+
key: B,
|
|
394
|
+
height: 0
|
|
395
|
+
}), U = p(Be), Ge = p(V), Ke = Be.key === z ? Be.height : 0, qe = V.key === B ? V.height : 0, Je = Pe(I ? { id: l } : void 0, j?.topBar) ? j?.topBar?.height ?? 0 : 0, Ye = Pe(R ? { id: f } : void 0, j?.bottomBar) ? j?.bottomBar?.height ?? 0 : 0, Xe = Ke || Je, Ze = qe || Ye, Qe = p(null), W = p(null), $e = p(null), et = p(null), tt = p(null), G = p(null), K = p(null), q = a((e) => {
|
|
396
|
+
e <= 0 || z === null || (et.current && (et.current.style.minHeight = `${e}px`), U.current = {
|
|
397
|
+
key: z,
|
|
398
|
+
height: e
|
|
399
|
+
}, Ve((t) => t.key === z && t.height === e ? t : {
|
|
400
|
+
key: z,
|
|
401
|
+
height: e
|
|
402
|
+
}), T.screen.getState().updateSharedBarHeight(v, "topBar", e));
|
|
403
|
+
}, [
|
|
404
|
+
v,
|
|
405
|
+
T.screen,
|
|
406
|
+
z
|
|
407
|
+
]), nt = a((e) => {
|
|
408
|
+
e <= 0 || B === null || (tt.current && (tt.current.style.minHeight = `${e}px`), Ge.current = {
|
|
409
|
+
key: B,
|
|
410
|
+
height: e
|
|
411
|
+
}, Ue((t) => t.key === B && t.height === e ? t : {
|
|
412
|
+
key: B,
|
|
413
|
+
height: e
|
|
414
|
+
}), T.screen.getState().updateSharedBarHeight(v, "bottomBar", e));
|
|
415
|
+
}, [
|
|
416
|
+
B,
|
|
417
|
+
v,
|
|
418
|
+
T.screen
|
|
419
|
+
]), rt = a((e) => {
|
|
420
|
+
G.current = e, e?.offsetHeight && q(e.offsetHeight);
|
|
421
|
+
}, [q]), it = a((e) => {
|
|
422
|
+
K.current = e, e?.offsetHeight && nt(e.offsetHeight);
|
|
423
|
+
}, [nt]), J = p({
|
|
360
424
|
transition: M,
|
|
361
|
-
decorator:
|
|
362
|
-
hasSharedTopBar: !!
|
|
363
|
-
hasSharedBottomBar: !!
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
425
|
+
decorator: Ie,
|
|
426
|
+
hasSharedTopBar: !!c,
|
|
427
|
+
hasSharedBottomBar: !!u,
|
|
428
|
+
sharedTopBarId: l,
|
|
429
|
+
sharedBottomBarId: f,
|
|
430
|
+
viewportScrollHeight: P,
|
|
431
|
+
isRoot: b,
|
|
432
|
+
isActive: y,
|
|
367
433
|
status: k,
|
|
368
|
-
dragStatus:
|
|
434
|
+
dragStatus: he,
|
|
369
435
|
index: D
|
|
370
436
|
});
|
|
371
|
-
|
|
437
|
+
J.current = {
|
|
372
438
|
transition: M,
|
|
373
|
-
decorator:
|
|
374
|
-
hasSharedTopBar: !!
|
|
375
|
-
hasSharedBottomBar: !!
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
439
|
+
decorator: Ie,
|
|
440
|
+
hasSharedTopBar: !!c,
|
|
441
|
+
hasSharedBottomBar: !!u,
|
|
442
|
+
sharedTopBarId: l,
|
|
443
|
+
sharedBottomBarId: f,
|
|
444
|
+
viewportScrollHeight: P,
|
|
445
|
+
isRoot: b,
|
|
446
|
+
isActive: y,
|
|
379
447
|
status: k,
|
|
380
|
-
dragStatus:
|
|
448
|
+
dragStatus: he,
|
|
381
449
|
index: D
|
|
382
450
|
};
|
|
383
|
-
let
|
|
384
|
-
|
|
385
|
-
getTransition: () =>
|
|
386
|
-
getDecorator: () =>
|
|
451
|
+
let at = p(null);
|
|
452
|
+
at.current ||= le({
|
|
453
|
+
getTransition: () => J.current.transition,
|
|
454
|
+
getDecorator: () => J.current.decorator,
|
|
387
455
|
getElements: () => ({
|
|
388
|
-
scope:
|
|
389
|
-
screenContainer:
|
|
390
|
-
decorator:
|
|
391
|
-
sharedTopBar:
|
|
392
|
-
sharedBottomBar:
|
|
456
|
+
scope: W.current,
|
|
457
|
+
screenContainer: Qe.current,
|
|
458
|
+
decorator: $e.current,
|
|
459
|
+
sharedTopBar: G.current,
|
|
460
|
+
sharedBottomBar: K.current
|
|
393
461
|
}),
|
|
394
|
-
hasSharedTopBar: () =>
|
|
395
|
-
hasSharedBottomBar: () =>
|
|
396
|
-
|
|
462
|
+
hasSharedTopBar: () => J.current.hasSharedTopBar,
|
|
463
|
+
hasSharedBottomBar: () => J.current.hasSharedBottomBar,
|
|
464
|
+
getSharedTopBarId: () => J.current.sharedTopBarId,
|
|
465
|
+
getSharedBottomBarId: () => J.current.sharedBottomBarId,
|
|
466
|
+
getViewportScrollHeight: () => J.current.viewportScrollHeight,
|
|
397
467
|
isReadyForDrag: () => {
|
|
398
|
-
let e =
|
|
468
|
+
let e = J.current;
|
|
399
469
|
return !e.isRoot && e.isActive && e.status === "COMPLETED" && e.dragStatus === "IDLE" && !!e.transition.swipeDirection && e.viewportScrollHeight < 10;
|
|
400
470
|
},
|
|
401
471
|
getPartnerBars: () => {
|
|
402
|
-
let e =
|
|
403
|
-
return n ?
|
|
472
|
+
let e = J.current, t = T.history.getState().histories, n = e.isActive ? t[e.index - 1]?.id : t[e.index]?.id;
|
|
473
|
+
return n ? T.screen.getState().sharedBars[n] : void 0;
|
|
404
474
|
},
|
|
405
|
-
|
|
475
|
+
getPartnerBarMetadata: () => {
|
|
476
|
+
let e = J.current, t = T.history.getState().histories, n = e.isActive ? t[e.index - 1]?.id : t[e.index]?.id;
|
|
477
|
+
return n ? T.screen.getState().sharedBarMetadata[n] : void 0;
|
|
478
|
+
},
|
|
479
|
+
setDragStatus: ve,
|
|
406
480
|
back: () => window.history.back()
|
|
407
481
|
});
|
|
408
|
-
let
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
482
|
+
let Y = at.current, ot = (e) => Y.pointerDown(e.nativeEvent), dt = (e) => Y.pointerMove(e.nativeEvent), ft = (e) => Y.pointerUp(e.nativeEvent), pt = (e) => Y.pointerCancel(e.nativeEvent), mt = (e) => {
|
|
483
|
+
(k === "PUSHING" || k === "REPLACING") && (e.preventDefault(), e.stopPropagation());
|
|
484
|
+
};
|
|
485
|
+
s(() => {
|
|
486
|
+
me(W.current);
|
|
487
|
+
}, []), s(() => {
|
|
488
|
+
let e = W.current;
|
|
413
489
|
if (!e) return;
|
|
414
490
|
let t = (e) => {
|
|
415
|
-
|
|
491
|
+
Y.shouldPreventTouch() && e.preventDefault();
|
|
416
492
|
};
|
|
417
493
|
return e.addEventListener("touchmove", t, { passive: !1 }), () => {
|
|
418
494
|
e.removeEventListener("touchmove", t);
|
|
419
495
|
};
|
|
420
|
-
}, [
|
|
421
|
-
let e = U.current;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
let { registerSharedBars: e, unregisterSharedBars: t } = E.screen.getState();
|
|
436
|
-
return e(y, {
|
|
437
|
-
topBar: !!a,
|
|
438
|
-
bottomBar: !!s
|
|
439
|
-
}), () => t(y);
|
|
496
|
+
}, [Y]), d(() => {
|
|
497
|
+
let { registerSharedBars: e, unregisterSharedBars: t } = T.screen.getState(), n = U.current, r = Ge.current;
|
|
498
|
+
return e(v, {
|
|
499
|
+
topBar: I,
|
|
500
|
+
bottomBar: R
|
|
501
|
+
}, {
|
|
502
|
+
topBar: I ? {
|
|
503
|
+
id: l,
|
|
504
|
+
height: n.key === z ? n.height : void 0
|
|
505
|
+
} : void 0,
|
|
506
|
+
bottomBar: R ? {
|
|
507
|
+
id: f,
|
|
508
|
+
height: r.key === B ? r.height : void 0
|
|
509
|
+
} : void 0
|
|
510
|
+
}), () => t(v);
|
|
440
511
|
}, [
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
512
|
+
B,
|
|
513
|
+
R,
|
|
514
|
+
I,
|
|
515
|
+
v,
|
|
516
|
+
f,
|
|
517
|
+
l,
|
|
518
|
+
T.screen,
|
|
519
|
+
z
|
|
520
|
+
]), d(() => {
|
|
521
|
+
let e = G.current;
|
|
522
|
+
if (e) return we(e, q);
|
|
523
|
+
}, [q, c]), d(() => {
|
|
524
|
+
let e = K.current;
|
|
525
|
+
if (e) return we(e, nt);
|
|
526
|
+
}, [nt, u]), d(() => {
|
|
527
|
+
let e = W.current;
|
|
447
528
|
if (!e) return;
|
|
448
|
-
let { registerScreenSurface: t, unregisterScreenSurface: n } =
|
|
449
|
-
return t(
|
|
529
|
+
let { registerScreenSurface: t, unregisterScreenSurface: n } = T.screen.getState();
|
|
530
|
+
return t(v, { opaqueBackground: xe(getComputedStyle(e).backgroundColor) }), () => n(v);
|
|
450
531
|
}, [
|
|
451
|
-
|
|
452
|
-
|
|
532
|
+
v,
|
|
533
|
+
ae,
|
|
453
534
|
k,
|
|
454
|
-
|
|
535
|
+
T.screen
|
|
455
536
|
]);
|
|
456
|
-
let
|
|
537
|
+
let ht = de, { app: gt, nav: _t } = re({
|
|
457
538
|
status: k,
|
|
458
|
-
isTopOrTopPrev:
|
|
459
|
-
hasTopBar:
|
|
460
|
-
hasNavBar:
|
|
461
|
-
|
|
462
|
-
|
|
539
|
+
isTopOrTopPrev: ht,
|
|
540
|
+
hasTopBar: I,
|
|
541
|
+
hasNavBar: R,
|
|
542
|
+
topBarId: l,
|
|
543
|
+
bottomBarId: f,
|
|
544
|
+
partnerBars: Se,
|
|
545
|
+
partnerMetadata: j
|
|
546
|
+
}), Z = ee({
|
|
463
547
|
status: k,
|
|
464
|
-
isTopOrTopPrev:
|
|
548
|
+
isTopOrTopPrev: ht,
|
|
465
549
|
transitionName: S
|
|
466
|
-
}),
|
|
467
|
-
isActive:
|
|
468
|
-
isPrev:
|
|
550
|
+
}), vt = ie({
|
|
551
|
+
isActive: y,
|
|
552
|
+
isPrev: se,
|
|
469
553
|
zIndex: x,
|
|
470
554
|
index: D,
|
|
471
555
|
status: k,
|
|
472
|
-
dragStatus:
|
|
473
|
-
replaceTransitionStatus:
|
|
474
|
-
}),
|
|
475
|
-
key:
|
|
476
|
-
released:
|
|
556
|
+
dragStatus: he,
|
|
557
|
+
replaceTransitionStatus: ge
|
|
558
|
+
}), yt = p(vt), bt = p(Z !== null && vt), [xt, St] = m({
|
|
559
|
+
key: Z,
|
|
560
|
+
released: Z === null
|
|
477
561
|
});
|
|
478
|
-
|
|
479
|
-
key:
|
|
480
|
-
released:
|
|
481
|
-
}),
|
|
482
|
-
let
|
|
483
|
-
|
|
562
|
+
xt.key !== Z && (St({
|
|
563
|
+
key: Z,
|
|
564
|
+
released: Z === null
|
|
565
|
+
}), bt.current = Z !== null && yt.current), yt.current = vt;
|
|
566
|
+
let Q = Z !== null && xt.key === Z && !xt.released, $ = Q ? !y && Ce?.opaqueBackground ? "park" : y && (k === "PUSHING" || k === "REPLACING") && Ce?.opaqueBackground ? Oe() ? "park-over" : "park-under" : "true" : "false";
|
|
567
|
+
d(() => Ee.driveScreenLifecycle({
|
|
484
568
|
getElements: () => ({
|
|
485
|
-
scope:
|
|
486
|
-
decorator:
|
|
487
|
-
bars: [
|
|
569
|
+
scope: W.current,
|
|
570
|
+
decorator: $e.current,
|
|
571
|
+
bars: [G.current, K.current]
|
|
488
572
|
}),
|
|
489
573
|
transitionName: S,
|
|
490
|
-
prevTransitionName:
|
|
574
|
+
prevTransitionName: ce,
|
|
491
575
|
status: k,
|
|
492
|
-
isActive:
|
|
493
|
-
animHoldReleased: !
|
|
576
|
+
isActive: y,
|
|
577
|
+
animHoldReleased: !Q
|
|
494
578
|
}), [
|
|
495
|
-
|
|
579
|
+
Ee,
|
|
496
580
|
k,
|
|
497
|
-
|
|
498
|
-
|
|
581
|
+
y,
|
|
582
|
+
ce,
|
|
499
583
|
S,
|
|
500
|
-
|
|
501
|
-
]),
|
|
502
|
-
if (!
|
|
503
|
-
let e =
|
|
504
|
-
return
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
584
|
+
Q
|
|
585
|
+
]), s(() => {
|
|
586
|
+
if (!Q || Z === null) return;
|
|
587
|
+
let e = Z, t = T.navigate.getState().transitionTaskId, n = t === null ? e : `${e}#${t}`;
|
|
588
|
+
return De.current.join(n, () => {
|
|
589
|
+
if ((J.current.transition.driver === "native" || ye()) && !pe()) {
|
|
590
|
+
for (let e of [
|
|
591
|
+
W.current,
|
|
592
|
+
G.current,
|
|
593
|
+
K.current,
|
|
594
|
+
$e.current
|
|
595
|
+
]) e?.isConnected && e.getAttribute("data-flemo-anim-hold") !== null && e.setAttribute("data-flemo-anim-hold", "false");
|
|
596
|
+
Qe.current && (Qe.current.style.zIndex = "");
|
|
597
|
+
}
|
|
598
|
+
Re(() => St((t) => t.key === e && !t.released ? {
|
|
599
|
+
key: e,
|
|
600
|
+
released: !0
|
|
601
|
+
} : t));
|
|
602
|
+
}, {
|
|
603
|
+
scope: W.current,
|
|
604
|
+
decodeWait: bt.current,
|
|
605
|
+
contentSettle: ke() && (y && k === "PUSHING" || k === "POPPING") ? {
|
|
606
|
+
firstWaitMs: 120,
|
|
607
|
+
capMs: 700,
|
|
608
|
+
graceMs: 60,
|
|
609
|
+
minNodes: y ? 30 : 1,
|
|
610
|
+
renderSettleOnly: !0
|
|
611
|
+
} : void 0
|
|
510
612
|
});
|
|
511
613
|
}, [
|
|
512
|
-
|
|
513
|
-
Y,
|
|
614
|
+
Q,
|
|
514
615
|
Z,
|
|
515
|
-
|
|
616
|
+
$,
|
|
617
|
+
y,
|
|
516
618
|
k,
|
|
517
|
-
|
|
619
|
+
T.navigate
|
|
518
620
|
]);
|
|
519
|
-
let
|
|
520
|
-
initial:
|
|
521
|
-
isActive:
|
|
621
|
+
let Ct = $ === "park-under" || $ === "park-over" ? {} : _e({
|
|
622
|
+
initial: Ae,
|
|
623
|
+
isActive: y,
|
|
522
624
|
status: k
|
|
523
625
|
});
|
|
524
|
-
return /* @__PURE__ */
|
|
525
|
-
ref:
|
|
626
|
+
return /* @__PURE__ */ Le("div", {
|
|
627
|
+
ref: Qe,
|
|
628
|
+
onClickCapture: mt,
|
|
526
629
|
style: {
|
|
527
|
-
position:
|
|
630
|
+
position: w,
|
|
528
631
|
top: 0,
|
|
529
632
|
left: 0,
|
|
530
633
|
width: "100%",
|
|
531
634
|
height: "100%",
|
|
532
635
|
display: "flex",
|
|
533
|
-
zIndex:
|
|
636
|
+
zIndex: $ === "park-under" ? -1 : void 0,
|
|
534
637
|
contain: "layout style",
|
|
535
638
|
flexDirection: "column",
|
|
536
639
|
boxSizing: "border-box",
|
|
537
640
|
overscrollBehavior: "contain"
|
|
538
641
|
},
|
|
539
642
|
children: [
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
height: "100%",
|
|
548
|
-
zIndex: 1
|
|
549
|
-
}
|
|
550
|
-
}),
|
|
551
|
-
/* @__PURE__ */ Ce("div", {
|
|
552
|
-
ref: H,
|
|
553
|
-
...v,
|
|
554
|
-
onPointerDown: ke,
|
|
555
|
-
onPointerMove: Ae,
|
|
556
|
-
onPointerUp: je,
|
|
557
|
-
onPointerCancel: je,
|
|
643
|
+
/* @__PURE__ */ Le("div", {
|
|
644
|
+
ref: W,
|
|
645
|
+
...oe,
|
|
646
|
+
onPointerDown: ot,
|
|
647
|
+
onPointerMove: dt,
|
|
648
|
+
onPointerUp: ft,
|
|
649
|
+
onPointerCancel: pt,
|
|
558
650
|
"data-flemo-screen": !0,
|
|
651
|
+
"data-flemo-router": E ?? void 0,
|
|
559
652
|
"data-flemo-transition": S,
|
|
560
653
|
"data-flemo-status": k,
|
|
561
|
-
"data-flemo-active":
|
|
562
|
-
"data-flemo-anim-hold":
|
|
654
|
+
"data-flemo-active": y ? "true" : "false",
|
|
655
|
+
"data-flemo-anim-hold": $,
|
|
563
656
|
style: {
|
|
564
657
|
display: "flex",
|
|
565
658
|
flexDirection: "column",
|
|
566
659
|
height: "100%",
|
|
567
|
-
backgroundColor:
|
|
660
|
+
backgroundColor: ae,
|
|
568
661
|
overflowY: _ ? void 0 : "auto",
|
|
569
|
-
touchAction:
|
|
570
|
-
...
|
|
571
|
-
...
|
|
662
|
+
touchAction: je === "x" ? "pan-y" : je === "y" ? "pan-x" : "auto",
|
|
663
|
+
...(Oe() || Fe()) && ($ !== "false" || x === D && !C) ? { willChange: "transform" } : {},
|
|
664
|
+
...Ct,
|
|
665
|
+
...oe.style
|
|
572
666
|
},
|
|
573
667
|
children: [
|
|
574
|
-
!
|
|
668
|
+
!h && t && /* @__PURE__ */ N("div", {
|
|
575
669
|
style: { minHeight: t },
|
|
576
|
-
children: /* @__PURE__ */
|
|
577
|
-
position:
|
|
670
|
+
children: /* @__PURE__ */ N("div", { style: {
|
|
671
|
+
position: w,
|
|
578
672
|
top: 0,
|
|
579
673
|
width: "100%",
|
|
580
674
|
minHeight: t,
|
|
581
675
|
backgroundColor: n
|
|
582
676
|
} })
|
|
583
677
|
}),
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
678
|
+
c && /* @__PURE__ */ N("div", {
|
|
679
|
+
ref: et,
|
|
680
|
+
"data-flemo-bar-spacer": "app",
|
|
681
|
+
style: {
|
|
682
|
+
width: "100%",
|
|
683
|
+
minHeight: Xe
|
|
684
|
+
}
|
|
685
|
+
}),
|
|
686
|
+
te,
|
|
687
|
+
/* @__PURE__ */ N("div", {
|
|
590
688
|
style: {
|
|
591
689
|
display: "flex",
|
|
592
690
|
flexDirection: "column",
|
|
@@ -595,19 +693,23 @@ function Ye({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
595
693
|
},
|
|
596
694
|
children: e
|
|
597
695
|
}),
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
696
|
+
ne,
|
|
697
|
+
u && /* @__PURE__ */ N("div", {
|
|
698
|
+
ref: tt,
|
|
699
|
+
"data-flemo-bar-spacer": "nav",
|
|
700
|
+
style: {
|
|
701
|
+
display: ze ? "none" : void 0,
|
|
702
|
+
width: "100%",
|
|
703
|
+
minHeight: Ze
|
|
704
|
+
}
|
|
705
|
+
}),
|
|
706
|
+
!g && r && /* @__PURE__ */ N("div", {
|
|
605
707
|
style: {
|
|
606
|
-
display:
|
|
708
|
+
display: ze ? "none" : void 0,
|
|
607
709
|
minHeight: r
|
|
608
710
|
},
|
|
609
|
-
children: /* @__PURE__ */
|
|
610
|
-
position:
|
|
711
|
+
children: /* @__PURE__ */ N("div", { style: {
|
|
712
|
+
position: w,
|
|
611
713
|
bottom: 0,
|
|
612
714
|
width: "100%",
|
|
613
715
|
minHeight: r,
|
|
@@ -616,92 +718,88 @@ function Ye({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
616
718
|
})
|
|
617
719
|
]
|
|
618
720
|
}),
|
|
619
|
-
|
|
620
|
-
ref:
|
|
721
|
+
c && /* @__PURE__ */ N("div", {
|
|
722
|
+
ref: rt,
|
|
621
723
|
"data-flemo-bar": "app",
|
|
724
|
+
"data-flemo-bar-id": l,
|
|
725
|
+
"data-flemo-bar-id-type": l === void 0 ? void 0 : typeof l,
|
|
726
|
+
"data-flemo-router": E ?? void 0,
|
|
622
727
|
"data-flemo-bar-transition": S,
|
|
623
728
|
"data-flemo-bar-status": k,
|
|
624
|
-
"data-flemo-bar-active":
|
|
625
|
-
"data-flemo-bar-riding":
|
|
626
|
-
"data-flemo-anim-hold":
|
|
729
|
+
"data-flemo-bar-active": y ? "true" : "false",
|
|
730
|
+
"data-flemo-bar-riding": gt ? "true" : "false",
|
|
731
|
+
"data-flemo-anim-hold": $,
|
|
627
732
|
style: {
|
|
628
|
-
position:
|
|
629
|
-
top:
|
|
733
|
+
position: w,
|
|
734
|
+
top: h ? 0 : t,
|
|
630
735
|
left: 0,
|
|
631
736
|
width: "100%",
|
|
632
737
|
zIndex: 1
|
|
633
738
|
},
|
|
634
|
-
children:
|
|
739
|
+
children: c
|
|
635
740
|
}),
|
|
636
|
-
|
|
637
|
-
ref:
|
|
741
|
+
u && /* @__PURE__ */ N("div", {
|
|
742
|
+
ref: it,
|
|
638
743
|
"data-flemo-bar": "nav",
|
|
744
|
+
"data-flemo-bar-id": f,
|
|
745
|
+
"data-flemo-bar-id-type": f === void 0 ? void 0 : typeof f,
|
|
746
|
+
"data-flemo-router": E ?? void 0,
|
|
639
747
|
"data-flemo-bar-transition": S,
|
|
640
748
|
"data-flemo-bar-status": k,
|
|
641
|
-
"data-flemo-bar-active":
|
|
642
|
-
"data-flemo-bar-riding":
|
|
643
|
-
"data-flemo-anim-hold":
|
|
749
|
+
"data-flemo-bar-active": y ? "true" : "false",
|
|
750
|
+
"data-flemo-bar-riding": _t ? "true" : "false",
|
|
751
|
+
"data-flemo-anim-hold": $,
|
|
644
752
|
style: {
|
|
645
|
-
display:
|
|
646
|
-
position:
|
|
647
|
-
bottom:
|
|
753
|
+
display: ze ? "none" : void 0,
|
|
754
|
+
position: w,
|
|
755
|
+
bottom: g ? 0 : r,
|
|
648
756
|
left: 0,
|
|
649
757
|
width: "100%",
|
|
650
758
|
zIndex: 1
|
|
651
759
|
},
|
|
652
|
-
children:
|
|
653
|
-
}),
|
|
654
|
-
P && /* @__PURE__ */ L(qe, {
|
|
655
|
-
ref: De,
|
|
656
|
-
"data-flemo-anim-hold": Z
|
|
760
|
+
children: u
|
|
657
761
|
}),
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
position: T,
|
|
662
|
-
top: 0,
|
|
663
|
-
right: 0,
|
|
664
|
-
width: 8,
|
|
665
|
-
height: "100%",
|
|
666
|
-
zIndex: 1
|
|
667
|
-
}
|
|
762
|
+
Ie && /* @__PURE__ */ N(lt, {
|
|
763
|
+
ref: $e,
|
|
764
|
+
"data-flemo-anim-hold": $
|
|
668
765
|
})
|
|
669
766
|
]
|
|
670
767
|
});
|
|
671
768
|
}
|
|
672
769
|
//#endregion
|
|
673
770
|
//#region src/screen/Screen.tsx
|
|
674
|
-
function
|
|
675
|
-
let { isActive: n, isPrev: r, zIndex: i } =
|
|
771
|
+
function ft({ children: e, ...t }) {
|
|
772
|
+
let { isActive: n, isPrev: r, zIndex: i } = L(), a = H((e) => e.index), o = ct((e) => e.status), c = X((e) => e.dragStatus), l = X((e) => e.replaceTransitionStatus), u = h({
|
|
676
773
|
isActive: n,
|
|
677
774
|
isPrev: r,
|
|
678
775
|
zIndex: i,
|
|
679
|
-
index:
|
|
680
|
-
status:
|
|
681
|
-
dragStatus:
|
|
682
|
-
replaceTransitionStatus:
|
|
683
|
-
}), [
|
|
684
|
-
return
|
|
685
|
-
if (
|
|
686
|
-
let e = setTimeout(() =>
|
|
776
|
+
index: a,
|
|
777
|
+
status: o,
|
|
778
|
+
dragStatus: c,
|
|
779
|
+
replaceTransitionStatus: l
|
|
780
|
+
}), [d, f] = m(u !== "live");
|
|
781
|
+
return u === "live" && d && f(!1), u === "immediate" && !d && f(!0), s(() => {
|
|
782
|
+
if (u !== "deferred" || d) return;
|
|
783
|
+
let e = setTimeout(() => f(!0), pt);
|
|
687
784
|
return () => clearTimeout(e);
|
|
688
|
-
}, [
|
|
689
|
-
freeze:
|
|
690
|
-
children: /* @__PURE__ */
|
|
785
|
+
}, [u, d]), /* @__PURE__ */ N(Y, {
|
|
786
|
+
freeze: d,
|
|
787
|
+
children: /* @__PURE__ */ N(dt, {
|
|
691
788
|
...t,
|
|
692
789
|
children: e
|
|
693
790
|
})
|
|
694
791
|
});
|
|
695
792
|
}
|
|
696
|
-
var
|
|
793
|
+
var pt = 600;
|
|
697
794
|
//#endregion
|
|
698
795
|
//#region src/screen/Part.tsx
|
|
699
|
-
function
|
|
700
|
-
let { isActive: a, isPrev:
|
|
701
|
-
return /* @__PURE__ */
|
|
796
|
+
function mt({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
797
|
+
let { isActive: a, isPrev: s, navigateStore: c, routerId: l } = L(), u = o(He), d = l ?? u ?? void 0, f = F(), p = V(c ?? f.navigate, (e) => s ? "COMPLETED" : e.status);
|
|
798
|
+
return /* @__PURE__ */ N("div", {
|
|
702
799
|
ref: e,
|
|
703
800
|
"data-flemo-part-name": t,
|
|
704
|
-
"data-flemo-
|
|
801
|
+
"data-flemo-router": d,
|
|
802
|
+
"data-flemo-status": p,
|
|
705
803
|
"data-flemo-active": a ? "true" : "false",
|
|
706
804
|
style: n,
|
|
707
805
|
...i,
|
|
@@ -710,21 +808,21 @@ function Qe({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
|
710
808
|
}
|
|
711
809
|
//#endregion
|
|
712
810
|
//#region src/stores/RouterScopeProvider.tsx
|
|
713
|
-
function
|
|
714
|
-
let [t] =
|
|
715
|
-
history:
|
|
716
|
-
navigate:
|
|
717
|
-
transition:
|
|
718
|
-
screen:
|
|
719
|
-
driver:
|
|
720
|
-
markSelfInduced:
|
|
721
|
-
consume:
|
|
811
|
+
function ht({ children: e }) {
|
|
812
|
+
let [t] = m(() => ({
|
|
813
|
+
history: y(),
|
|
814
|
+
navigate: b(),
|
|
815
|
+
transition: de(),
|
|
816
|
+
screen: E(),
|
|
817
|
+
driver: oe(),
|
|
818
|
+
markSelfInduced: j,
|
|
819
|
+
consume: g,
|
|
722
820
|
life: { alive: !0 }
|
|
723
821
|
}));
|
|
724
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ N(P.Provider, {
|
|
725
823
|
value: t,
|
|
726
824
|
children: e
|
|
727
825
|
});
|
|
728
826
|
}
|
|
729
827
|
//#endregion
|
|
730
|
-
export {
|
|
828
|
+
export { mt as Part, K as Route, G as Router, ht as RouterScopeProvider, ft as Screen, I as ScreenContext, lt as ScreenDecorator, Y as ScreenFreeze, dt as ScreenMotion, Je as Slot, _ as createBrowserHistoryDriver, v as createDecorator, x as createPartTransition, S as createRawDecorator, ce as createRawPartTransition, C as createRawTransition, ue as createTransition, Ee as partTransitionMap, H as useHistoryStore, nt as useNavigate, ct as useNavigateStore, J as useParams, rt as usePathname, L as useScreen, X as useScreenStore, it as useStep, F as useStores, ut as useViewportScrollHeight };
|
package/dist/screen/Screen.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { SharedBarId } from '@flemo/core';
|
|
2
3
|
export interface ScreenProps extends PropsWithChildren<Omit<ComponentPropsWithoutRef<"div">, "onPointerDown" | "onPointerMove" | "onPointerUp" | "onPointerCancel">> {
|
|
3
4
|
statusBarHeight?: string;
|
|
4
5
|
statusBarColor?: string;
|
|
@@ -6,7 +7,9 @@ export interface ScreenProps extends PropsWithChildren<Omit<ComponentPropsWithou
|
|
|
6
7
|
systemNavigationBarColor?: string;
|
|
7
8
|
backgroundColor?: string;
|
|
8
9
|
sharedTopBar?: ReactNode;
|
|
10
|
+
sharedTopBarId?: SharedBarId;
|
|
9
11
|
sharedBottomBar?: ReactNode;
|
|
12
|
+
sharedBottomBarId?: SharedBarId;
|
|
10
13
|
topBar?: ReactNode;
|
|
11
14
|
bottomBar?: ReactNode;
|
|
12
15
|
hideStatusBar?: boolean;
|
|
@@ -9,6 +9,7 @@ export interface ScreenContextProps extends History {
|
|
|
9
9
|
prevTransitionName: TransitionName;
|
|
10
10
|
routePath: Path;
|
|
11
11
|
navigateStore?: FlemoStores["navigate"];
|
|
12
|
+
routerId?: string;
|
|
12
13
|
}
|
|
13
14
|
declare const ScreenContext: import('react').Context<ScreenContextProps>;
|
|
14
15
|
export default ScreenContext;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ScreenProps } from './Screen';
|
|
2
|
-
declare function ScreenMotion({ children, statusBarHeight, statusBarColor, systemNavigationBarHeight, systemNavigationBarColor, sharedTopBar, sharedBottomBar, topBar, bottomBar, hideStatusBar, hideSystemNavigationBar, backgroundColor, contentScrollable, ...props }: ScreenProps): import("react").JSX.Element;
|
|
2
|
+
declare function ScreenMotion({ children, statusBarHeight, statusBarColor, systemNavigationBarHeight, systemNavigationBarColor, sharedTopBar, sharedTopBarId, sharedBottomBar, sharedBottomBarId, topBar, bottomBar, hideStatusBar, hideSystemNavigationBar, backgroundColor, contentScrollable, ...props }: ScreenProps): import("react").JSX.Element;
|
|
3
3
|
export default ScreenMotion;
|
package/dist/screen/store.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { createScreenStore as default } from '@flemo/core';
|
|
2
|
-
export type { ScreenStore, ScreenStoreApi, SharedBarPresence } from '@flemo/core';
|
|
2
|
+
export type { ScreenStore, ScreenStoreApi, SharedBarId, SharedBarMetadata, SharedBarPresence, SharedBarsMetadata } from '@flemo/core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemo/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
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,30 +36,30 @@
|
|
|
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.24.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@testing-library/jest-dom": "^6.9.1",
|
|
43
43
|
"@testing-library/react": "^16.3.2",
|
|
44
44
|
"@types/node": "^24.13.1",
|
|
45
|
-
"@types/react": "^19.2.
|
|
46
|
-
"@types/react-dom": "^19.2.
|
|
47
|
-
"@vitejs/plugin-react-swc": "^4.3.
|
|
45
|
+
"@types/react": "^19.2.18",
|
|
46
|
+
"@types/react-dom": "^19.2.4",
|
|
47
|
+
"@vitejs/plugin-react-swc": "^4.3.3",
|
|
48
48
|
"@vitest/coverage-v8": "^4.1.10",
|
|
49
|
-
"eslint": "^9.39.
|
|
49
|
+
"eslint": "^9.39.5",
|
|
50
50
|
"jsdom": "^29.1.1",
|
|
51
|
-
"react": "^19.2.
|
|
52
|
-
"react-dom": "^19.2.
|
|
51
|
+
"react": "^19.2.8",
|
|
52
|
+
"react-dom": "^19.2.8",
|
|
53
53
|
"typescript": "^6.0.3",
|
|
54
|
-
"vite": "^8.1
|
|
54
|
+
"vite": "^8.2.1",
|
|
55
55
|
"vite-plugin-dts": "^5.0.3",
|
|
56
56
|
"vitest": "^4.1.10",
|
|
57
57
|
"@flemo/eslint-config": "0.0.0",
|
|
58
58
|
"@flemo/tsconfig": "0.0.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"react": "^19.2.
|
|
62
|
-
"react-dom": "^19.2.
|
|
61
|
+
"react": "^19.2.8",
|
|
62
|
+
"react-dom": "^19.2.8"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
File without changes
|
|
File without changes
|