@flemo/react 1.6.1 → 1.6.3

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