@flemo/react 1.10.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/index.d.ts +1 -1
- package/dist/index.mjs +452 -379
- package/dist/screen/Screen.d.ts +3 -0
- package/dist/screen/ScreenMotion.d.ts +1 -1
- package/dist/screen/store.d.ts +1 -1
- 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.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,9 +61,9 @@ function U({ 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
|
})
|
|
@@ -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 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
|
|
84
85
|
//#region src/RouterIdContext.ts
|
|
85
|
-
var
|
|
86
|
+
var He = 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 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, {
|
|
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: ve(r.props.path, t.pathname)
|
|
99
100
|
},
|
|
100
|
-
children: /* @__PURE__ */
|
|
101
|
+
children: /* @__PURE__ */ N(Be, { 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 U = r({ contained: !1 });
|
|
108
|
+
function We() {
|
|
109
|
+
return o(U);
|
|
109
110
|
}
|
|
110
111
|
//#endregion
|
|
111
112
|
//#region src/transition/styles.ts
|
|
112
|
-
function
|
|
113
|
-
|
|
113
|
+
function Ge(e, t, n = []) {
|
|
114
|
+
u(() => Ae(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 Ke = r(0), qe = { contained: !0 };
|
|
123
|
+
function Je({ children: e, className: t, style: n }) {
|
|
124
|
+
return /* @__PURE__ */ N("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__ */ N(U.Provider, {
|
|
132
|
+
value: qe,
|
|
133
|
+
children: /* @__PURE__ */ N(Ue, { children: e })
|
|
133
134
|
})
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
//#endregion
|
|
137
138
|
//#region src/Router.tsx
|
|
138
|
-
function
|
|
139
|
+
function Ye(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 === Je) {
|
|
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 = Ye(r);
|
|
149
150
|
e && (t = e);
|
|
150
151
|
}
|
|
151
152
|
}), t;
|
|
152
153
|
}
|
|
153
|
-
var
|
|
154
|
-
function
|
|
155
|
-
let
|
|
156
|
-
|
|
157
|
-
|
|
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({
|
|
158
161
|
routePaths: t,
|
|
159
|
-
pathname:
|
|
160
|
-
search:
|
|
162
|
+
pathname: le,
|
|
163
|
+
search: ue,
|
|
161
164
|
defaultTransitionName: r,
|
|
162
165
|
memory: g,
|
|
163
|
-
browserDriver:
|
|
164
|
-
hostedScope:
|
|
165
|
-
routerKey:
|
|
166
|
-
zoneEntryId: h && !
|
|
167
|
-
persistKey: h && !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
|
|
168
171
|
});
|
|
169
172
|
});
|
|
170
|
-
|
|
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(() => {
|
|
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 < et) return;
|
|
177
183
|
n = r, t && clearTimeout(t);
|
|
178
184
|
let i = e;
|
|
179
|
-
e =
|
|
185
|
+
e = be(), i?.(), t = setTimeout(() => {
|
|
180
186
|
t = null, e?.(), e = null;
|
|
181
|
-
},
|
|
187
|
+
}, tt);
|
|
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 && !
|
|
199
|
-
seedPathname:
|
|
200
|
+
}, []), s(() => {
|
|
201
|
+
g || !C || Ne({
|
|
202
|
+
driver: C,
|
|
203
|
+
routerKey: S ? null : y,
|
|
204
|
+
nested: h && !S,
|
|
205
|
+
seedPathname: le,
|
|
200
206
|
defaultTransitionName: r,
|
|
201
|
-
rootParams:
|
|
207
|
+
rootParams: O.history.getState().histories[0]?.params ?? {}
|
|
202
208
|
});
|
|
203
209
|
}, [
|
|
204
210
|
g,
|
|
205
|
-
|
|
211
|
+
S,
|
|
206
212
|
h,
|
|
207
|
-
|
|
208
|
-
|
|
213
|
+
y,
|
|
214
|
+
le,
|
|
209
215
|
r,
|
|
210
|
-
|
|
211
|
-
|
|
216
|
+
O.history,
|
|
217
|
+
C
|
|
212
218
|
]);
|
|
213
|
-
let
|
|
214
|
-
value:
|
|
215
|
-
children: /* @__PURE__ */
|
|
216
|
-
value:
|
|
217
|
-
children: /* @__PURE__ */
|
|
218
|
-
value:
|
|
219
|
-
children: [!g && /* @__PURE__ */
|
|
220
|
-
value:
|
|
221
|
-
children:
|
|
222
|
-
}) :
|
|
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]
|
|
223
229
|
})
|
|
224
230
|
})
|
|
225
231
|
});
|
|
226
|
-
return h ? /* @__PURE__ */
|
|
232
|
+
return h ? /* @__PURE__ */ N("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: fe
|
|
240
|
+
}) : fe;
|
|
235
241
|
}
|
|
236
242
|
//#endregion
|
|
237
243
|
//#region src/Route.tsx
|
|
238
|
-
function
|
|
244
|
+
function K({ element: e }) {
|
|
239
245
|
return e;
|
|
240
246
|
}
|
|
241
247
|
//#endregion
|
|
242
248
|
//#region src/utils/buildRoutePath.ts
|
|
243
|
-
function
|
|
244
|
-
return
|
|
249
|
+
function q(e, t) {
|
|
250
|
+
return ne(e, t);
|
|
245
251
|
}
|
|
246
252
|
//#endregion
|
|
247
253
|
//#region src/navigate/useNavigate.ts
|
|
248
|
-
function
|
|
249
|
-
let e =
|
|
254
|
+
function nt() {
|
|
255
|
+
let e = F(), t = se({
|
|
250
256
|
stores: e,
|
|
251
|
-
buildPathname: (e, t) =>
|
|
257
|
+
buildPathname: (e, t) => q(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 rt() {
|
|
270
|
+
return H((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 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)));
|
|
272
278
|
}, [e, r]);
|
|
273
|
-
let l =
|
|
279
|
+
let l = D({
|
|
274
280
|
stores: t,
|
|
275
281
|
driver: r,
|
|
276
282
|
markSelfInduced: i,
|
|
277
|
-
buildStepPathname: (t) => e ?
|
|
283
|
+
buildStepPathname: (t) => e ? q(e, t).pathname : te(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 J() {
|
|
301
|
+
return o(R);
|
|
296
302
|
}
|
|
297
303
|
//#endregion
|
|
298
304
|
//#region src/screen/ScreenFreeze.tsx
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
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",
|
|
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 ot = /* @__PURE__ */ new WeakMap();
|
|
328
|
+
function st(e) {
|
|
329
|
+
let t = ot.get(e);
|
|
330
|
+
return t || (t = ae(), ot.set(e, t)), t;
|
|
311
331
|
}
|
|
312
332
|
//#endregion
|
|
313
333
|
//#region src/stores/useNavigateStore.ts
|
|
314
|
-
function
|
|
315
|
-
return
|
|
334
|
+
function ct(e) {
|
|
335
|
+
return V(F().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 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", {
|
|
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 ut() {
|
|
365
|
+
let [e, t] = m(0), [n, r] = m(0);
|
|
366
|
+
return s(() => Te((e, n) => {
|
|
347
367
|
r(n), t(e);
|
|
348
368
|
}), []), {
|
|
349
369
|
viewportScrollHeight: e,
|
|
@@ -352,284 +372,344 @@ function Ze() {
|
|
|
352
372
|
}
|
|
353
373
|
//#endregion
|
|
354
374
|
//#region src/stores/useScreenStore.ts
|
|
355
|
-
function
|
|
356
|
-
return
|
|
375
|
+
function X(e) {
|
|
376
|
+
return V(F().screen, e);
|
|
357
377
|
}
|
|
358
378
|
//#endregion
|
|
359
379
|
//#region src/screen/ScreenMotion.tsx
|
|
360
|
-
function
|
|
361
|
-
let { id:
|
|
362
|
-
|
|
363
|
-
getTransitionTaskId: () =>
|
|
364
|
-
setDragStatus:
|
|
365
|
-
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
|
|
366
386
|
});
|
|
367
|
-
let
|
|
368
|
-
|
|
369
|
-
let
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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({
|
|
424
|
+
transition: M,
|
|
425
|
+
decorator: Ie,
|
|
426
|
+
hasSharedTopBar: !!c,
|
|
427
|
+
hasSharedBottomBar: !!u,
|
|
428
|
+
sharedTopBarId: l,
|
|
429
|
+
sharedBottomBarId: f,
|
|
430
|
+
viewportScrollHeight: P,
|
|
431
|
+
isRoot: b,
|
|
432
|
+
isActive: y,
|
|
433
|
+
status: k,
|
|
434
|
+
dragStatus: he,
|
|
435
|
+
index: D
|
|
380
436
|
});
|
|
381
437
|
J.current = {
|
|
382
|
-
transition:
|
|
383
|
-
decorator:
|
|
384
|
-
hasSharedTopBar: !!
|
|
385
|
-
hasSharedBottomBar: !!
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
438
|
+
transition: M,
|
|
439
|
+
decorator: Ie,
|
|
440
|
+
hasSharedTopBar: !!c,
|
|
441
|
+
hasSharedBottomBar: !!u,
|
|
442
|
+
sharedTopBarId: l,
|
|
443
|
+
sharedBottomBarId: f,
|
|
444
|
+
viewportScrollHeight: P,
|
|
445
|
+
isRoot: b,
|
|
446
|
+
isActive: y,
|
|
447
|
+
status: k,
|
|
448
|
+
dragStatus: he,
|
|
449
|
+
index: D
|
|
392
450
|
};
|
|
393
|
-
let
|
|
394
|
-
|
|
451
|
+
let at = p(null);
|
|
452
|
+
at.current ||= le({
|
|
395
453
|
getTransition: () => J.current.transition,
|
|
396
454
|
getDecorator: () => J.current.decorator,
|
|
397
455
|
getElements: () => ({
|
|
398
|
-
scope:
|
|
399
|
-
screenContainer:
|
|
400
|
-
decorator:
|
|
456
|
+
scope: W.current,
|
|
457
|
+
screenContainer: Qe.current,
|
|
458
|
+
decorator: $e.current,
|
|
401
459
|
sharedTopBar: G.current,
|
|
402
|
-
sharedBottomBar:
|
|
460
|
+
sharedBottomBar: K.current
|
|
403
461
|
}),
|
|
404
462
|
hasSharedTopBar: () => J.current.hasSharedTopBar,
|
|
405
463
|
hasSharedBottomBar: () => J.current.hasSharedBottomBar,
|
|
464
|
+
getSharedTopBarId: () => J.current.sharedTopBarId,
|
|
465
|
+
getSharedBottomBarId: () => J.current.sharedBottomBarId,
|
|
406
466
|
getViewportScrollHeight: () => J.current.viewportScrollHeight,
|
|
407
467
|
isReadyForDrag: () => {
|
|
408
468
|
let e = J.current;
|
|
409
469
|
return !e.isRoot && e.isActive && e.status === "COMPLETED" && e.dragStatus === "IDLE" && !!e.transition.swipeDirection && e.viewportScrollHeight < 10;
|
|
410
470
|
},
|
|
411
471
|
getPartnerBars: () => {
|
|
412
|
-
let e = J.current, t =
|
|
413
|
-
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;
|
|
414
474
|
},
|
|
415
|
-
|
|
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,
|
|
416
480
|
back: () => window.history.back()
|
|
417
481
|
});
|
|
418
|
-
let Y =
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
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;
|
|
423
489
|
if (!e) return;
|
|
424
490
|
let t = (e) => {
|
|
425
|
-
Y.shouldPreventTouch() && e.preventDefault()
|
|
491
|
+
Y.shouldPreventTouch() && e.preventDefault();
|
|
426
492
|
};
|
|
427
493
|
return e.addEventListener("touchmove", t, { passive: !1 }), () => {
|
|
428
494
|
e.removeEventListener("touchmove", t);
|
|
429
495
|
};
|
|
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);
|
|
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);
|
|
450
511
|
}, [
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
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;
|
|
457
528
|
if (!e) return;
|
|
458
|
-
let { registerScreenSurface: t, unregisterScreenSurface: n } =
|
|
459
|
-
return t(
|
|
529
|
+
let { registerScreenSurface: t, unregisterScreenSurface: n } = T.screen.getState();
|
|
530
|
+
return t(v, { opaqueBackground: xe(getComputedStyle(e).backgroundColor) }), () => n(v);
|
|
460
531
|
}, [
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
532
|
+
v,
|
|
533
|
+
ae,
|
|
534
|
+
k,
|
|
535
|
+
T.screen
|
|
465
536
|
]);
|
|
466
|
-
let
|
|
467
|
-
status:
|
|
468
|
-
isTopOrTopPrev:
|
|
469
|
-
hasTopBar:
|
|
470
|
-
hasNavBar:
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
537
|
+
let ht = de, { app: gt, nav: _t } = re({
|
|
538
|
+
status: k,
|
|
539
|
+
isTopOrTopPrev: ht,
|
|
540
|
+
hasTopBar: I,
|
|
541
|
+
hasNavBar: R,
|
|
542
|
+
topBarId: l,
|
|
543
|
+
bottomBarId: f,
|
|
544
|
+
partnerBars: Se,
|
|
545
|
+
partnerMetadata: j
|
|
546
|
+
}), Z = ee({
|
|
547
|
+
status: k,
|
|
548
|
+
isTopOrTopPrev: ht,
|
|
549
|
+
transitionName: S
|
|
550
|
+
}), vt = ie({
|
|
551
|
+
isActive: y,
|
|
552
|
+
isPrev: se,
|
|
553
|
+
zIndex: x,
|
|
554
|
+
index: D,
|
|
555
|
+
status: k,
|
|
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
|
|
487
561
|
});
|
|
488
|
-
|
|
489
|
-
key:
|
|
490
|
-
released:
|
|
491
|
-
}),
|
|
492
|
-
let
|
|
493
|
-
|
|
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({
|
|
494
568
|
getElements: () => ({
|
|
495
|
-
scope:
|
|
496
|
-
decorator:
|
|
497
|
-
bars: [G.current,
|
|
569
|
+
scope: W.current,
|
|
570
|
+
decorator: $e.current,
|
|
571
|
+
bars: [G.current, K.current]
|
|
498
572
|
}),
|
|
499
|
-
transitionName:
|
|
500
|
-
prevTransitionName:
|
|
501
|
-
status:
|
|
502
|
-
isActive:
|
|
503
|
-
animHoldReleased: !
|
|
573
|
+
transitionName: S,
|
|
574
|
+
prevTransitionName: ce,
|
|
575
|
+
status: k,
|
|
576
|
+
isActive: y,
|
|
577
|
+
animHoldReleased: !Q
|
|
504
578
|
}), [
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
]),
|
|
512
|
-
if (!
|
|
513
|
-
let e =
|
|
514
|
-
return
|
|
515
|
-
if (J.current.transition.driver === "native" && !
|
|
579
|
+
Ee,
|
|
580
|
+
k,
|
|
581
|
+
y,
|
|
582
|
+
ce,
|
|
583
|
+
S,
|
|
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()) {
|
|
516
590
|
for (let e of [
|
|
517
|
-
|
|
591
|
+
W.current,
|
|
518
592
|
G.current,
|
|
519
|
-
|
|
520
|
-
|
|
593
|
+
K.current,
|
|
594
|
+
$e.current
|
|
521
595
|
]) e?.isConnected && e.getAttribute("data-flemo-anim-hold") !== null && e.setAttribute("data-flemo-anim-hold", "false");
|
|
522
|
-
|
|
596
|
+
Qe.current && (Qe.current.style.zIndex = "");
|
|
523
597
|
}
|
|
524
|
-
|
|
598
|
+
Re(() => St((t) => t.key === e && !t.released ? {
|
|
525
599
|
key: e,
|
|
526
600
|
released: !0
|
|
527
|
-
} : t);
|
|
601
|
+
} : t));
|
|
528
602
|
}, {
|
|
529
|
-
scope:
|
|
530
|
-
decodeWait:
|
|
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
|
|
531
612
|
});
|
|
532
613
|
}, [
|
|
533
|
-
Z,
|
|
534
|
-
X,
|
|
535
614
|
Q,
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
615
|
+
Z,
|
|
616
|
+
$,
|
|
617
|
+
y,
|
|
618
|
+
k,
|
|
619
|
+
T.navigate
|
|
539
620
|
]);
|
|
540
|
-
let
|
|
541
|
-
initial:
|
|
542
|
-
isActive:
|
|
543
|
-
status:
|
|
621
|
+
let Ct = $ === "park-under" || $ === "park-over" ? {} : _e({
|
|
622
|
+
initial: Ae,
|
|
623
|
+
isActive: y,
|
|
624
|
+
status: k
|
|
544
625
|
});
|
|
545
|
-
return /* @__PURE__ */
|
|
546
|
-
ref:
|
|
626
|
+
return /* @__PURE__ */ Le("div", {
|
|
627
|
+
ref: Qe,
|
|
628
|
+
onClickCapture: mt,
|
|
547
629
|
style: {
|
|
548
|
-
position:
|
|
630
|
+
position: w,
|
|
549
631
|
top: 0,
|
|
550
632
|
left: 0,
|
|
551
633
|
width: "100%",
|
|
552
634
|
height: "100%",
|
|
553
635
|
display: "flex",
|
|
554
|
-
zIndex:
|
|
636
|
+
zIndex: $ === "park-under" ? -1 : void 0,
|
|
555
637
|
contain: "layout style",
|
|
556
638
|
flexDirection: "column",
|
|
557
639
|
boxSizing: "border-box",
|
|
558
640
|
overscrollBehavior: "contain"
|
|
559
641
|
},
|
|
560
642
|
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,
|
|
643
|
+
/* @__PURE__ */ Le("div", {
|
|
644
|
+
ref: W,
|
|
645
|
+
...oe,
|
|
646
|
+
onPointerDown: ot,
|
|
647
|
+
onPointerMove: dt,
|
|
648
|
+
onPointerUp: ft,
|
|
649
|
+
onPointerCancel: pt,
|
|
579
650
|
"data-flemo-screen": !0,
|
|
580
|
-
"data-flemo-router":
|
|
581
|
-
"data-flemo-transition":
|
|
582
|
-
"data-flemo-status":
|
|
583
|
-
"data-flemo-active":
|
|
584
|
-
"data-flemo-anim-hold":
|
|
651
|
+
"data-flemo-router": E ?? void 0,
|
|
652
|
+
"data-flemo-transition": S,
|
|
653
|
+
"data-flemo-status": k,
|
|
654
|
+
"data-flemo-active": y ? "true" : "false",
|
|
655
|
+
"data-flemo-anim-hold": $,
|
|
585
656
|
style: {
|
|
586
657
|
display: "flex",
|
|
587
658
|
flexDirection: "column",
|
|
588
659
|
height: "100%",
|
|
589
|
-
backgroundColor:
|
|
590
|
-
overflowY:
|
|
591
|
-
touchAction:
|
|
592
|
-
...
|
|
593
|
-
...
|
|
660
|
+
backgroundColor: ae,
|
|
661
|
+
overflowY: _ ? void 0 : "auto",
|
|
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
|
|
594
666
|
},
|
|
595
667
|
children: [
|
|
596
|
-
!
|
|
668
|
+
!h && t && /* @__PURE__ */ N("div", {
|
|
597
669
|
style: { minHeight: t },
|
|
598
|
-
children: /* @__PURE__ */
|
|
599
|
-
position:
|
|
670
|
+
children: /* @__PURE__ */ N("div", { style: {
|
|
671
|
+
position: w,
|
|
600
672
|
top: 0,
|
|
601
673
|
width: "100%",
|
|
602
674
|
minHeight: t,
|
|
603
675
|
backgroundColor: n
|
|
604
676
|
} })
|
|
605
677
|
}),
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
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", {
|
|
612
688
|
style: {
|
|
613
689
|
display: "flex",
|
|
614
690
|
flexDirection: "column",
|
|
615
691
|
flexGrow: 1,
|
|
616
|
-
overflowY:
|
|
692
|
+
overflowY: _ ? "auto" : void 0
|
|
617
693
|
},
|
|
618
694
|
children: e
|
|
619
695
|
}),
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
minHeight: De
|
|
625
|
-
} }),
|
|
626
|
-
!te && r && /* @__PURE__ */ L("div", {
|
|
696
|
+
ne,
|
|
697
|
+
u && /* @__PURE__ */ N("div", {
|
|
698
|
+
ref: tt,
|
|
699
|
+
"data-flemo-bar-spacer": "nav",
|
|
627
700
|
style: {
|
|
628
|
-
display:
|
|
701
|
+
display: ze ? "none" : void 0,
|
|
702
|
+
width: "100%",
|
|
703
|
+
minHeight: Ze
|
|
704
|
+
}
|
|
705
|
+
}),
|
|
706
|
+
!g && r && /* @__PURE__ */ N("div", {
|
|
707
|
+
style: {
|
|
708
|
+
display: ze ? "none" : void 0,
|
|
629
709
|
minHeight: r
|
|
630
710
|
},
|
|
631
|
-
children: /* @__PURE__ */
|
|
632
|
-
position:
|
|
711
|
+
children: /* @__PURE__ */ N("div", { style: {
|
|
712
|
+
position: w,
|
|
633
713
|
bottom: 0,
|
|
634
714
|
width: "100%",
|
|
635
715
|
minHeight: r,
|
|
@@ -638,96 +718,89 @@ function Qe({ children: e, statusBarHeight: t, statusBarColor: n, systemNavigati
|
|
|
638
718
|
})
|
|
639
719
|
]
|
|
640
720
|
}),
|
|
641
|
-
|
|
642
|
-
ref:
|
|
721
|
+
c && /* @__PURE__ */ N("div", {
|
|
722
|
+
ref: rt,
|
|
643
723
|
"data-flemo-bar": "app",
|
|
644
|
-
"data-flemo-
|
|
645
|
-
"data-flemo-bar-
|
|
646
|
-
"data-flemo-
|
|
647
|
-
"data-flemo-bar-
|
|
648
|
-
"data-flemo-bar-
|
|
649
|
-
"data-flemo-
|
|
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,
|
|
727
|
+
"data-flemo-bar-transition": S,
|
|
728
|
+
"data-flemo-bar-status": k,
|
|
729
|
+
"data-flemo-bar-active": y ? "true" : "false",
|
|
730
|
+
"data-flemo-bar-riding": gt ? "true" : "false",
|
|
731
|
+
"data-flemo-anim-hold": $,
|
|
650
732
|
style: {
|
|
651
|
-
position:
|
|
652
|
-
top:
|
|
733
|
+
position: w,
|
|
734
|
+
top: h ? 0 : t,
|
|
653
735
|
left: 0,
|
|
654
736
|
width: "100%",
|
|
655
737
|
zIndex: 1
|
|
656
738
|
},
|
|
657
|
-
children:
|
|
739
|
+
children: c
|
|
658
740
|
}),
|
|
659
|
-
|
|
660
|
-
ref:
|
|
741
|
+
u && /* @__PURE__ */ N("div", {
|
|
742
|
+
ref: it,
|
|
661
743
|
"data-flemo-bar": "nav",
|
|
662
|
-
"data-flemo-
|
|
663
|
-
"data-flemo-bar-
|
|
664
|
-
"data-flemo-
|
|
665
|
-
"data-flemo-bar-
|
|
666
|
-
"data-flemo-bar-
|
|
667
|
-
"data-flemo-
|
|
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,
|
|
747
|
+
"data-flemo-bar-transition": S,
|
|
748
|
+
"data-flemo-bar-status": k,
|
|
749
|
+
"data-flemo-bar-active": y ? "true" : "false",
|
|
750
|
+
"data-flemo-bar-riding": _t ? "true" : "false",
|
|
751
|
+
"data-flemo-anim-hold": $,
|
|
668
752
|
style: {
|
|
669
|
-
display:
|
|
670
|
-
position:
|
|
671
|
-
bottom:
|
|
753
|
+
display: ze ? "none" : void 0,
|
|
754
|
+
position: w,
|
|
755
|
+
bottom: g ? 0 : r,
|
|
672
756
|
left: 0,
|
|
673
757
|
width: "100%",
|
|
674
758
|
zIndex: 1
|
|
675
759
|
},
|
|
676
|
-
children:
|
|
760
|
+
children: u
|
|
677
761
|
}),
|
|
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
|
-
}
|
|
762
|
+
Ie && /* @__PURE__ */ N(lt, {
|
|
763
|
+
ref: $e,
|
|
764
|
+
"data-flemo-anim-hold": $
|
|
692
765
|
})
|
|
693
766
|
]
|
|
694
767
|
});
|
|
695
768
|
}
|
|
696
769
|
//#endregion
|
|
697
770
|
//#region src/screen/Screen.tsx
|
|
698
|
-
function
|
|
699
|
-
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({
|
|
700
773
|
isActive: n,
|
|
701
774
|
isPrev: r,
|
|
702
775
|
zIndex: i,
|
|
703
776
|
index: a,
|
|
704
|
-
status:
|
|
777
|
+
status: o,
|
|
705
778
|
dragStatus: c,
|
|
706
779
|
replaceTransitionStatus: l
|
|
707
|
-
}), [d, f] =
|
|
708
|
-
return u === "live" && d && f(!1), u === "immediate" && !d && f(!0),
|
|
780
|
+
}), [d, f] = m(u !== "live");
|
|
781
|
+
return u === "live" && d && f(!1), u === "immediate" && !d && f(!0), s(() => {
|
|
709
782
|
if (u !== "deferred" || d) return;
|
|
710
|
-
let e = setTimeout(() => f(!0),
|
|
783
|
+
let e = setTimeout(() => f(!0), pt);
|
|
711
784
|
return () => clearTimeout(e);
|
|
712
|
-
}, [u, d]), /* @__PURE__ */
|
|
785
|
+
}, [u, d]), /* @__PURE__ */ N(Y, {
|
|
713
786
|
freeze: d,
|
|
714
|
-
children: /* @__PURE__ */
|
|
787
|
+
children: /* @__PURE__ */ N(dt, {
|
|
715
788
|
...t,
|
|
716
789
|
children: e
|
|
717
790
|
})
|
|
718
791
|
});
|
|
719
792
|
}
|
|
720
|
-
var
|
|
793
|
+
var pt = 600;
|
|
721
794
|
//#endregion
|
|
722
795
|
//#region src/screen/Part.tsx
|
|
723
|
-
function
|
|
724
|
-
let { isActive:
|
|
725
|
-
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", {
|
|
726
799
|
ref: e,
|
|
727
800
|
"data-flemo-part-name": t,
|
|
728
801
|
"data-flemo-router": d,
|
|
729
802
|
"data-flemo-status": p,
|
|
730
|
-
"data-flemo-active":
|
|
803
|
+
"data-flemo-active": a ? "true" : "false",
|
|
731
804
|
style: n,
|
|
732
805
|
...i,
|
|
733
806
|
children: r
|
|
@@ -735,21 +808,21 @@ function tt({ ref: e, name: t, style: n, children: r, ...i }) {
|
|
|
735
808
|
}
|
|
736
809
|
//#endregion
|
|
737
810
|
//#region src/stores/RouterScopeProvider.tsx
|
|
738
|
-
function
|
|
739
|
-
let [t] =
|
|
740
|
-
history:
|
|
741
|
-
navigate:
|
|
742
|
-
transition:
|
|
743
|
-
screen:
|
|
744
|
-
driver:
|
|
745
|
-
markSelfInduced:
|
|
746
|
-
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,
|
|
747
820
|
life: { alive: !0 }
|
|
748
821
|
}));
|
|
749
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ N(P.Provider, {
|
|
750
823
|
value: t,
|
|
751
824
|
children: e
|
|
752
825
|
});
|
|
753
826
|
}
|
|
754
827
|
//#endregion
|
|
755
|
-
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;
|
|
@@ -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,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.24.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
|