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