@flemo/react 1.6.0 → 1.6.2

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