@flemo/react 1.0.2 → 1.0.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.
- package/README.md +2 -2
- package/dist/index.mjs +202 -202
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -28,9 +28,9 @@ dependency. Apps that only need transition compilers or the navigation queue can
|
|
|
28
28
|
|
|
29
29
|
## Documentation
|
|
30
30
|
|
|
31
|
-
See [flemo
|
|
31
|
+
See [flemo.dev](https://flemo.dev) for the full guide — getting started,
|
|
32
32
|
transitions, shared-element morphs, gestures, and the complete API reference. A live playground is
|
|
33
|
-
at [flemo
|
|
33
|
+
at [flemo.dev/playground](https://flemo.dev/playground).
|
|
34
34
|
|
|
35
35
|
## License
|
|
36
36
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as N, jsxs as Ht, Fragment as fe } from "react/jsx-runtime";
|
|
2
|
-
import Pt, { useEffect as
|
|
3
|
-
import { consumeSelfInducedPop as ge, TaskManger as G, useNavigateStore as
|
|
2
|
+
import Pt, { useEffect as dt, createContext as Gt, useContext as Yt, useReducer as me, Children as te, useInsertionEffect as ye, useRef as L, useImperativeHandle as he, useState as bt, useLayoutEffect as xt } from "react";
|
|
3
|
+
import { consumeSelfInducedPop as ge, TaskManger as G, useNavigateStore as W, useHistoryStore as O, getMatchedPathPattern as we, transitionMap as ct, decoratorMap as yt, isServer as Mt, compileTransitionStyles as Se, useTransitionStore as Ot, getParams as ve, markSelfInducedPop as ee, targetToDecls as Te, easingToCss as Ee, variantHasAnimation as Pe, animationName as xe, findScrollable as qt, collectAnimatedProperties as be } from "@flemo/core";
|
|
4
4
|
import { createDecorator as tn, createRawDecorator as en, createRawTransition as nn, createTransition as rn } from "@flemo/core";
|
|
5
5
|
function Ie() {
|
|
6
|
-
return
|
|
6
|
+
return dt(() => {
|
|
7
7
|
const n = async (e) => {
|
|
8
8
|
if (ge())
|
|
9
9
|
return;
|
|
10
10
|
const r = e.state?.id, a = G.generateTaskId();
|
|
11
11
|
(await G.addTask(
|
|
12
12
|
async (u) => {
|
|
13
|
-
const i = e.state?.index, s = e.state?.status, T = e.state?.params, E = e.state?.transitionName, m = e.state?.layoutId, { setStatus: x, setTransitionTaskId:
|
|
14
|
-
if (!D && !
|
|
13
|
+
const i = e.state?.index, s = e.state?.status, T = e.state?.params, E = e.state?.transitionName, m = e.state?.layoutId, { setStatus: x, setTransitionTaskId: h } = W.getState(), { index: R, addHistory: $, popHistory: C } = O.getState(), D = i < R, q = s === "PUSHING" && i > R, M = s === "REPLACING" && i > R, Y = window.location.pathname;
|
|
14
|
+
if (!D && !q && !M) {
|
|
15
15
|
u.abort();
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return h(a), D ? x("POPPING") : q ? (x("PUSHING"), $({
|
|
19
19
|
id: r,
|
|
20
20
|
pathname: Y,
|
|
21
21
|
params: T,
|
|
@@ -47,7 +47,7 @@ function Ie() {
|
|
|
47
47
|
var j = {}, zt;
|
|
48
48
|
function Re() {
|
|
49
49
|
if (zt) return j;
|
|
50
|
-
zt = 1, Object.defineProperty(j, "__esModule", { value: !0 }), j.PathError = j.TokenData = void 0, j.parse = m, j.compile = x, j.match = $, j.pathToRegexp = C, j.stringify =
|
|
50
|
+
zt = 1, Object.defineProperty(j, "__esModule", { value: !0 }), j.PathError = j.TokenData = void 0, j.parse = m, j.compile = x, j.match = $, j.pathToRegexp = C, j.stringify = gt;
|
|
51
51
|
const n = "/", e = (o) => o, r = /^[$_\p{ID_Start}]$/u, a = /^[$\u200c\u200d\p{ID_Continue}]$/u, u = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
|
|
52
52
|
function i(o) {
|
|
53
53
|
return o.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
|
|
@@ -56,55 +56,55 @@ function Re() {
|
|
|
56
56
|
return o.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
|
|
57
57
|
}
|
|
58
58
|
class T {
|
|
59
|
-
constructor(c,
|
|
60
|
-
this.tokens = c, this.originalPath =
|
|
59
|
+
constructor(c, y) {
|
|
60
|
+
this.tokens = c, this.originalPath = y;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
j.TokenData = T;
|
|
64
64
|
class E extends TypeError {
|
|
65
|
-
constructor(c,
|
|
66
|
-
let
|
|
67
|
-
|
|
65
|
+
constructor(c, y) {
|
|
66
|
+
let p = c;
|
|
67
|
+
y && (p += `: ${y}`), p += "; visit https://git.new/pathToRegexpError for info", super(p), this.originalPath = y;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
j.PathError = E;
|
|
71
71
|
function m(o, c = {}) {
|
|
72
|
-
const { encodePath:
|
|
72
|
+
const { encodePath: y = e } = c, p = [...o];
|
|
73
73
|
let l = 0;
|
|
74
|
-
function g(
|
|
74
|
+
function g(d) {
|
|
75
75
|
const P = [];
|
|
76
76
|
let w = "";
|
|
77
77
|
function I() {
|
|
78
78
|
w && (P.push({
|
|
79
79
|
type: "text",
|
|
80
|
-
value:
|
|
80
|
+
value: y(w)
|
|
81
81
|
}), w = "");
|
|
82
82
|
}
|
|
83
|
-
for (; l <
|
|
84
|
-
const b =
|
|
85
|
-
if (b ===
|
|
83
|
+
for (; l < p.length; ) {
|
|
84
|
+
const b = p[l++];
|
|
85
|
+
if (b === d)
|
|
86
86
|
return I(), P;
|
|
87
87
|
if (b === "\\") {
|
|
88
|
-
if (l ===
|
|
88
|
+
if (l === p.length)
|
|
89
89
|
throw new E(`Unexpected end after \\ at index ${l}`, o);
|
|
90
|
-
w +=
|
|
90
|
+
w += p[l++];
|
|
91
91
|
continue;
|
|
92
92
|
}
|
|
93
93
|
if (b === ":" || b === "*") {
|
|
94
94
|
const U = b === ":" ? "param" : "wildcard";
|
|
95
95
|
let S = "";
|
|
96
|
-
if (r.test(
|
|
96
|
+
if (r.test(p[l]))
|
|
97
97
|
do
|
|
98
|
-
S +=
|
|
99
|
-
while (a.test(
|
|
100
|
-
else if (
|
|
98
|
+
S += p[l++];
|
|
99
|
+
while (a.test(p[l]));
|
|
100
|
+
else if (p[l] === '"') {
|
|
101
101
|
let H = l;
|
|
102
|
-
for (; l <
|
|
103
|
-
if (
|
|
102
|
+
for (; l < p.length; ) {
|
|
103
|
+
if (p[++l] === '"') {
|
|
104
104
|
l++, H = 0;
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
p[l] === "\\" && l++, S += p[l];
|
|
108
108
|
}
|
|
109
109
|
if (H)
|
|
110
110
|
throw new E(`Unterminated quote at index ${H}`, o);
|
|
@@ -125,14 +125,14 @@ function Re() {
|
|
|
125
125
|
throw new E(`Unexpected ${b} at index ${l - 1}`, o);
|
|
126
126
|
w += b;
|
|
127
127
|
}
|
|
128
|
-
if (
|
|
129
|
-
throw new E(`Unexpected end at index ${l}, expected ${
|
|
128
|
+
if (d)
|
|
129
|
+
throw new E(`Unexpected end at index ${l}, expected ${d}`, o);
|
|
130
130
|
return I(), P;
|
|
131
131
|
}
|
|
132
132
|
return new T(g(""), o);
|
|
133
133
|
}
|
|
134
134
|
function x(o, c = {}) {
|
|
135
|
-
const { encode:
|
|
135
|
+
const { encode: y = encodeURIComponent, delimiter: p = n } = c, l = typeof o == "object" ? o : m(o, c), g = h(l.tokens, p, y);
|
|
136
136
|
return function(P = {}) {
|
|
137
137
|
const w = [], I = g(P, w);
|
|
138
138
|
if (w.length)
|
|
@@ -140,50 +140,50 @@ function Re() {
|
|
|
140
140
|
return I;
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
const
|
|
143
|
+
function h(o, c, y) {
|
|
144
|
+
const p = o.map((l) => R(l, c, y));
|
|
145
145
|
return (l, g) => {
|
|
146
|
-
let
|
|
147
|
-
for (const P of
|
|
148
|
-
|
|
149
|
-
return
|
|
146
|
+
let d = "";
|
|
147
|
+
for (const P of p)
|
|
148
|
+
d += P(l, g);
|
|
149
|
+
return d;
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
function R(o, c,
|
|
152
|
+
function R(o, c, y) {
|
|
153
153
|
if (o.type === "text")
|
|
154
154
|
return () => o.value;
|
|
155
155
|
if (o.type === "group") {
|
|
156
|
-
const l =
|
|
157
|
-
return (g,
|
|
158
|
-
const P =
|
|
159
|
-
return
|
|
156
|
+
const l = h(o.tokens, c, y);
|
|
157
|
+
return (g, d) => {
|
|
158
|
+
const P = d.length, w = l(g, d);
|
|
159
|
+
return d.length === P ? w : (d.length = P, "");
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
const
|
|
163
|
-
return o.type === "wildcard" &&
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
162
|
+
const p = y || e;
|
|
163
|
+
return o.type === "wildcard" && y !== !1 ? (l, g) => {
|
|
164
|
+
const d = l[o.name];
|
|
165
|
+
if (d == null)
|
|
166
166
|
return g.push(o.name), "";
|
|
167
|
-
if (!Array.isArray(
|
|
167
|
+
if (!Array.isArray(d) || d.length === 0)
|
|
168
168
|
throw new TypeError(`Expected "${o.name}" to be a non-empty array`);
|
|
169
169
|
let P = "";
|
|
170
|
-
for (let w = 0; w <
|
|
171
|
-
if (typeof
|
|
170
|
+
for (let w = 0; w < d.length; w++) {
|
|
171
|
+
if (typeof d[w] != "string")
|
|
172
172
|
throw new TypeError(`Expected "${o.name}/${w}" to be a string`);
|
|
173
|
-
w > 0 && (P += c), P += d
|
|
173
|
+
w > 0 && (P += c), P += p(d[w]);
|
|
174
174
|
}
|
|
175
175
|
return P;
|
|
176
176
|
} : (l, g) => {
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
177
|
+
const d = l[o.name];
|
|
178
|
+
if (d == null)
|
|
179
179
|
return g.push(o.name), "";
|
|
180
|
-
if (typeof
|
|
180
|
+
if (typeof d != "string")
|
|
181
181
|
throw new TypeError(`Expected "${o.name}" to be a string`);
|
|
182
|
-
return d
|
|
182
|
+
return p(d);
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
185
|
function $(o, c = {}) {
|
|
186
|
-
const { decode:
|
|
186
|
+
const { decode: y = decodeURIComponent, delimiter: p = n } = c, { regexp: l, keys: g } = C(o, c), d = g.map((P) => y === !1 ? e : P.type === "param" ? y : (w) => w.split(p).map(y));
|
|
187
187
|
return function(w) {
|
|
188
188
|
const I = l.exec(w);
|
|
189
189
|
if (!I)
|
|
@@ -192,14 +192,14 @@ function Re() {
|
|
|
192
192
|
for (let S = 1; S < I.length; S++) {
|
|
193
193
|
if (I[S] === void 0)
|
|
194
194
|
continue;
|
|
195
|
-
const H = g[S - 1], _ =
|
|
195
|
+
const H = g[S - 1], _ = d[S - 1];
|
|
196
196
|
U[H.name] = _(I[S]);
|
|
197
197
|
}
|
|
198
198
|
return { path: b, params: U };
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
function C(o, c = {}) {
|
|
202
|
-
const { delimiter:
|
|
202
|
+
const { delimiter: y = n, end: p = !0, sensitive: l = !1, trailing: g = !0 } = c, d = [];
|
|
203
203
|
let P = "", w = 0;
|
|
204
204
|
function I(U) {
|
|
205
205
|
if (Array.isArray(U)) {
|
|
@@ -211,27 +211,27 @@ function Re() {
|
|
|
211
211
|
D(S.tokens, 0, [], (H) => {
|
|
212
212
|
if (w >= 256)
|
|
213
213
|
throw new E("Too many path combinations", S.originalPath);
|
|
214
|
-
w > 0 && (P += "|"), P +=
|
|
214
|
+
w > 0 && (P += "|"), P += q(H, y, d, S.originalPath), w++;
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
217
|
I(o);
|
|
218
218
|
let b = `^(?:${P})`;
|
|
219
|
-
return g && (b += "(?:" + s(
|
|
219
|
+
return g && (b += "(?:" + s(y) + "$)?"), b += p ? "$" : "(?=" + s(y) + "|$)", { regexp: new RegExp(b, l ? "" : "i"), keys: d };
|
|
220
220
|
}
|
|
221
|
-
function D(o, c,
|
|
221
|
+
function D(o, c, y, p) {
|
|
222
222
|
for (; c < o.length; ) {
|
|
223
223
|
const l = o[c++];
|
|
224
224
|
if (l.type === "group") {
|
|
225
|
-
const g =
|
|
226
|
-
D(l.tokens, 0,
|
|
225
|
+
const g = y.length;
|
|
226
|
+
D(l.tokens, 0, y, (d) => D(o, c, d, p)), y.length = g;
|
|
227
227
|
continue;
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
y.push(l);
|
|
230
230
|
}
|
|
231
|
-
|
|
231
|
+
p(y);
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
let l = "", g = "",
|
|
233
|
+
function q(o, c, y, p) {
|
|
234
|
+
let l = "", g = "", d = "", P = 0, w = 0, I = 0;
|
|
235
235
|
function b(S, H) {
|
|
236
236
|
for (; S < o.length; ) {
|
|
237
237
|
const _ = o[S++];
|
|
@@ -255,13 +255,13 @@ function Re() {
|
|
|
255
255
|
for (; I < o.length; ) {
|
|
256
256
|
const S = o[I++];
|
|
257
257
|
if (S.type === "text") {
|
|
258
|
-
l += s(S.value), g += S.value, P === 2 && (
|
|
258
|
+
l += s(S.value), g += S.value, P === 2 && (d += S.value), S.value.includes(c) && (w = 0);
|
|
259
259
|
continue;
|
|
260
260
|
}
|
|
261
261
|
if (S.type === "param" || S.type === "wildcard") {
|
|
262
262
|
if (P && !g)
|
|
263
|
-
throw new E(`Missing text before "${S.name}" ${S.type}`,
|
|
264
|
-
S.type === "param" ? (l += w & 2 ? `(${M(c, g)}+)` : b(I, "wildcard") ? `(${M(c, U(I))}+)` : w & 1 ? `(${M(c, g)}+|${s(g)})` : `(${M(c, "")}+)`, w |= P = 1) : (l += w & 2 ? `(${M(g, "")}+)` :
|
|
263
|
+
throw new E(`Missing text before "${S.name}" ${S.type}`, p);
|
|
264
|
+
S.type === "param" ? (l += w & 2 ? `(${M(c, g)}+)` : b(I, "wildcard") ? `(${M(c, U(I))}+)` : w & 1 ? `(${M(c, g)}+|${s(g)})` : `(${M(c, "")}+)`, w |= P = 1) : (l += w & 2 ? `(${M(g, "")}+)` : d ? `(${M(d, "")}+|${M(c, "")}+)` : "([^]+)", d = "", w |= P = 2), y.push(S), g = "";
|
|
265
265
|
continue;
|
|
266
266
|
}
|
|
267
267
|
throw new TypeError(`Unknown token type: ${S.type}`);
|
|
@@ -272,30 +272,30 @@ function Re() {
|
|
|
272
272
|
return c.length > o.length ? M(c, o) : (o === c && (c = ""), c.length > 1 ? `(?:(?!${s(o)}|${s(c)})[^])` : o.length > 1 ? `(?:(?!${s(o)})[^${s(c)}])` : `[^${s(o + c)}]`);
|
|
273
273
|
}
|
|
274
274
|
function Y(o, c) {
|
|
275
|
-
let
|
|
275
|
+
let y = "";
|
|
276
276
|
for (; c < o.length; ) {
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
279
|
-
|
|
277
|
+
const p = o[c++];
|
|
278
|
+
if (p.type === "text") {
|
|
279
|
+
y += i(p.value);
|
|
280
280
|
continue;
|
|
281
281
|
}
|
|
282
|
-
if (
|
|
283
|
-
|
|
282
|
+
if (p.type === "group") {
|
|
283
|
+
y += "{" + Y(p.tokens, 0) + "}";
|
|
284
284
|
continue;
|
|
285
285
|
}
|
|
286
|
-
if (
|
|
287
|
-
|
|
286
|
+
if (p.type === "param") {
|
|
287
|
+
y += ":" + B(p.name, o[c]);
|
|
288
288
|
continue;
|
|
289
289
|
}
|
|
290
|
-
if (
|
|
291
|
-
|
|
290
|
+
if (p.type === "wildcard") {
|
|
291
|
+
y += "*" + B(p.name, o[c]);
|
|
292
292
|
continue;
|
|
293
293
|
}
|
|
294
|
-
throw new TypeError(`Unknown token type: ${
|
|
294
|
+
throw new TypeError(`Unknown token type: ${p.type}`);
|
|
295
295
|
}
|
|
296
|
-
return
|
|
296
|
+
return y;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function gt(o) {
|
|
299
299
|
return Y(o.tokens, 0);
|
|
300
300
|
}
|
|
301
301
|
function B(o, c) {
|
|
@@ -317,7 +317,7 @@ const ne = Gt({
|
|
|
317
317
|
layoutId: null,
|
|
318
318
|
routePath: ""
|
|
319
319
|
});
|
|
320
|
-
function
|
|
320
|
+
function ht() {
|
|
321
321
|
return Yt(ne);
|
|
322
322
|
}
|
|
323
323
|
const re = Gt({}), oe = Gt(() => {
|
|
@@ -326,8 +326,8 @@ function De(n, e) {
|
|
|
326
326
|
return e.type === "SET" ? e.params : n;
|
|
327
327
|
}
|
|
328
328
|
function Le({ children: n }) {
|
|
329
|
-
const { isActive: e, params: r } =
|
|
330
|
-
return
|
|
329
|
+
const { isActive: e, params: r } = ht(), [a, u] = me(De, r);
|
|
330
|
+
return dt(() => {
|
|
331
331
|
const i = async (s) => {
|
|
332
332
|
s.state?.step && await G.addTask(async () => {
|
|
333
333
|
u({ type: "SET", params: s.state?.params || {} });
|
|
@@ -372,17 +372,17 @@ function Ne({ children: n }) {
|
|
|
372
372
|
}
|
|
373
373
|
const Kt = "data-flemo", Wt = () => {
|
|
374
374
|
if (Mt()) return;
|
|
375
|
-
const n = Se(
|
|
375
|
+
const n = Se(ct.values(), yt.values());
|
|
376
376
|
let e = document.head.querySelector(`style[${Kt}]`);
|
|
377
377
|
e || (e = document.createElement("style"), e.setAttribute(Kt, ""), document.head.appendChild(e)), e.textContent !== n && (e.textContent = n);
|
|
378
378
|
};
|
|
379
379
|
function $e(n, e) {
|
|
380
|
-
|
|
381
|
-
for (const r of n)
|
|
382
|
-
for (const r of e)
|
|
380
|
+
ye(() => {
|
|
381
|
+
for (const r of n) ct.set(r.name, r);
|
|
382
|
+
for (const r of e) yt.set(r.name, r);
|
|
383
383
|
return Wt(), () => {
|
|
384
|
-
for (const r of n)
|
|
385
|
-
for (const r of e)
|
|
384
|
+
for (const r of n) ct.delete(r.name);
|
|
385
|
+
for (const r of e) yt.delete(r.name);
|
|
386
386
|
Wt();
|
|
387
387
|
};
|
|
388
388
|
}, [n, e]);
|
|
@@ -413,7 +413,7 @@ function Fe({
|
|
|
413
413
|
layoutId: null
|
|
414
414
|
}
|
|
415
415
|
]
|
|
416
|
-
}), $e(a, u),
|
|
416
|
+
}), $e(a, u), dt(() => {
|
|
417
417
|
window.history.state?.index || window.history.replaceState(
|
|
418
418
|
{
|
|
419
419
|
id: "root",
|
|
@@ -436,24 +436,24 @@ function qe({ element: n }) {
|
|
|
436
436
|
}
|
|
437
437
|
function It(n, e) {
|
|
438
438
|
const r = e ?? {}, a = Bt.compile(n), u = Object.fromEntries(
|
|
439
|
-
Object.entries(r).map(([
|
|
440
|
-
), i = a(u), T = (typeof n == "string" ? Bt.parse(n) : n).tokens.filter((
|
|
441
|
-
Object.entries(r).filter(([
|
|
439
|
+
Object.entries(r).map(([h, R]) => [h, String(R)])
|
|
440
|
+
), i = a(u), T = (typeof n == "string" ? Bt.parse(n) : n).tokens.filter((h) => h.type === "param").map((h) => h.name), E = Object.fromEntries(
|
|
441
|
+
Object.entries(r).filter(([h]) => !T.includes(h))
|
|
442
442
|
), m = new URLSearchParams(E).toString();
|
|
443
443
|
return { pathname: `${i}${m ? `?${m}` : ""}`, toPathname: i };
|
|
444
444
|
}
|
|
445
445
|
function ze() {
|
|
446
446
|
return {
|
|
447
447
|
push: async (a, u, i) => {
|
|
448
|
-
const { status: s } =
|
|
448
|
+
const { status: s } = W.getState();
|
|
449
449
|
if (s !== "COMPLETED" && s !== "IDLE")
|
|
450
450
|
return;
|
|
451
|
-
const { index: T, addHistory: E } = O.getState(), m = Ot.getState().defaultTransitionName, { transitionName: x = m, layoutId:
|
|
451
|
+
const { index: T, addHistory: E } = O.getState(), m = Ot.getState().defaultTransitionName, { transitionName: x = m, layoutId: h = null } = i ?? {}, R = G.generateTaskId();
|
|
452
452
|
(await G.addTask(
|
|
453
453
|
async () => {
|
|
454
|
-
const { setStatus: $, setTransitionTaskId: C } =
|
|
454
|
+
const { setStatus: $, setTransitionTaskId: C } = W.getState();
|
|
455
455
|
$("PUSHING"), C(R);
|
|
456
|
-
const { pathname: D, toPathname:
|
|
456
|
+
const { pathname: D, toPathname: q } = It(a, u ?? {});
|
|
457
457
|
return window.history.pushState(
|
|
458
458
|
{
|
|
459
459
|
id: R,
|
|
@@ -461,16 +461,16 @@ function ze() {
|
|
|
461
461
|
status: "PUSHING",
|
|
462
462
|
params: u,
|
|
463
463
|
transitionName: x,
|
|
464
|
-
layoutId:
|
|
464
|
+
layoutId: h
|
|
465
465
|
},
|
|
466
466
|
"",
|
|
467
467
|
D
|
|
468
468
|
), E({
|
|
469
469
|
id: R,
|
|
470
|
-
pathname:
|
|
470
|
+
pathname: q,
|
|
471
471
|
params: u ?? {},
|
|
472
472
|
transitionName: x,
|
|
473
|
-
layoutId:
|
|
473
|
+
layoutId: h
|
|
474
474
|
}), () => {
|
|
475
475
|
$("COMPLETED");
|
|
476
476
|
};
|
|
@@ -484,31 +484,31 @@ function ze() {
|
|
|
484
484
|
)).result?.();
|
|
485
485
|
},
|
|
486
486
|
replace: async (a, u, i) => {
|
|
487
|
-
const { status: s } =
|
|
487
|
+
const { status: s } = W.getState();
|
|
488
488
|
if (s !== "COMPLETED" && s !== "IDLE")
|
|
489
489
|
return;
|
|
490
|
-
const { index: T, addHistory: E } = O.getState(), m = O.getState().replaceHistory, x = Ot.getState().defaultTransitionName, { transitionName:
|
|
490
|
+
const { index: T, addHistory: E } = O.getState(), m = O.getState().replaceHistory, x = Ot.getState().defaultTransitionName, { transitionName: h = x, layoutId: R = null } = i ?? {}, $ = G.generateTaskId();
|
|
491
491
|
(await G.addTask(
|
|
492
492
|
async () => {
|
|
493
|
-
const { setStatus: C, setTransitionTaskId: D } =
|
|
493
|
+
const { setStatus: C, setTransitionTaskId: D } = W.getState();
|
|
494
494
|
C("REPLACING"), D($);
|
|
495
|
-
const { pathname:
|
|
495
|
+
const { pathname: q, toPathname: M } = It(a, u ?? {});
|
|
496
496
|
return window.history.replaceState(
|
|
497
497
|
{
|
|
498
498
|
id: $,
|
|
499
499
|
index: T,
|
|
500
500
|
status: "REPLACING",
|
|
501
501
|
params: u,
|
|
502
|
-
transitionName:
|
|
502
|
+
transitionName: h,
|
|
503
503
|
layoutId: R
|
|
504
504
|
},
|
|
505
505
|
"",
|
|
506
|
-
|
|
506
|
+
q
|
|
507
507
|
), E({
|
|
508
508
|
id: $,
|
|
509
509
|
pathname: M,
|
|
510
510
|
params: u ?? {},
|
|
511
|
-
transitionName:
|
|
511
|
+
transitionName: h,
|
|
512
512
|
layoutId: R
|
|
513
513
|
}), async () => {
|
|
514
514
|
m(T), C("COMPLETED");
|
|
@@ -531,7 +531,7 @@ function ze() {
|
|
|
531
531
|
u.abort();
|
|
532
532
|
return;
|
|
533
533
|
}
|
|
534
|
-
const { setStatus: T, setTransitionTaskId: E } =
|
|
534
|
+
const { setStatus: T, setTransitionTaskId: E } = W.getState();
|
|
535
535
|
return T("POPPING"), E(a), ee(), window.history.back(), async () => {
|
|
536
536
|
s(i), T("COMPLETED");
|
|
537
537
|
};
|
|
@@ -547,7 +547,7 @@ function ze() {
|
|
|
547
547
|
};
|
|
548
548
|
}
|
|
549
549
|
function Ke() {
|
|
550
|
-
const { routePath: n } =
|
|
550
|
+
const { routePath: n } = ht(), e = Yt(oe);
|
|
551
551
|
return {
|
|
552
552
|
pushStep: async (i) => {
|
|
553
553
|
(await G.addTask(async () => {
|
|
@@ -610,8 +610,8 @@ function Ke() {
|
|
|
610
610
|
e({ type: "SET", params: m.params ?? {} }), s.abort();
|
|
611
611
|
return;
|
|
612
612
|
}
|
|
613
|
-
const { setStatus: x, setTransitionTaskId:
|
|
614
|
-
return x("POPPING"),
|
|
613
|
+
const { setStatus: x, setTransitionTaskId: h } = W.getState(), { index: R, popHistory: $ } = O.getState();
|
|
614
|
+
return x("POPPING"), h(i), async () => {
|
|
615
615
|
$(R), x("COMPLETED");
|
|
616
616
|
};
|
|
617
617
|
},
|
|
@@ -641,9 +641,9 @@ function Ce({ freeze: n, children: e }) {
|
|
|
641
641
|
);
|
|
642
642
|
}
|
|
643
643
|
function He({ ref: n, style: e, ...r }) {
|
|
644
|
-
const { isActive: a, transitionName: u } =
|
|
645
|
-
|
|
646
|
-
const s =
|
|
644
|
+
const { isActive: a, transitionName: u } = ht(), i = L(null);
|
|
645
|
+
he(n, () => i.current);
|
|
646
|
+
const s = W((x) => x.status), T = ct.get(u) ?? ct.get("none"), { decoratorName: E } = T, m = yt.get(E);
|
|
647
647
|
return m ? /* @__PURE__ */ N(
|
|
648
648
|
"div",
|
|
649
649
|
{
|
|
@@ -669,10 +669,10 @@ function He({ ref: n, style: e, ...r }) {
|
|
|
669
669
|
const Jt = (n) => {
|
|
670
670
|
let e;
|
|
671
671
|
const r = /* @__PURE__ */ new Set(), a = (m, x) => {
|
|
672
|
-
const
|
|
673
|
-
if (!Object.is(
|
|
672
|
+
const h = typeof m == "function" ? m(e) : m;
|
|
673
|
+
if (!Object.is(h, e)) {
|
|
674
674
|
const R = e;
|
|
675
|
-
e = x ?? (typeof
|
|
675
|
+
e = x ?? (typeof h != "object" || h === null) ? h : Object.assign({}, e, h), r.forEach(($) => $(e, R));
|
|
676
676
|
}
|
|
677
677
|
}, u = () => e, T = { setState: a, getState: u, getInitialState: () => E, subscribe: (m) => (r.add(m), () => r.delete(m)) }, E = e = n(a, u, T);
|
|
678
678
|
return T;
|
|
@@ -703,7 +703,7 @@ const Qt = (n) => {
|
|
|
703
703
|
let Ct = 0;
|
|
704
704
|
function Ge() {
|
|
705
705
|
const [n, e] = bt(0), [r, a] = bt(0);
|
|
706
|
-
return
|
|
706
|
+
return dt(() => {
|
|
707
707
|
let u = 0;
|
|
708
708
|
const i = () => {
|
|
709
709
|
cancelAnimationFrame(u), u = requestAnimationFrame(() => {
|
|
@@ -721,7 +721,7 @@ function Ge() {
|
|
|
721
721
|
const Ye = (n) => typeof HTMLElement < "u" && n instanceof HTMLElement, Ut = /* @__PURE__ */ new WeakMap(), Zt = (n, e) => {
|
|
722
722
|
let r = Ut.get(n);
|
|
723
723
|
r || (r = /* @__PURE__ */ new Set(), Ut.set(n, r)), r.add(e);
|
|
724
|
-
},
|
|
724
|
+
}, F = (n, e) => {
|
|
725
725
|
n.style.transition = "";
|
|
726
726
|
const r = Ut.get(n);
|
|
727
727
|
if (r && r.size > 0) {
|
|
@@ -731,7 +731,7 @@ const Ye = (n) => typeof HTMLElement < "u" && n instanceof HTMLElement, Ut = /*
|
|
|
731
731
|
return;
|
|
732
732
|
}
|
|
733
733
|
n.style.removeProperty("transform"), n.style.removeProperty("opacity");
|
|
734
|
-
},
|
|
734
|
+
}, lt = (n, e, r = {}) => {
|
|
735
735
|
if (!Ye(n)) return Promise.resolve();
|
|
736
736
|
const a = n, u = Te(e);
|
|
737
737
|
if (u.length === 0) return Promise.resolve();
|
|
@@ -748,14 +748,14 @@ const Ye = (n) => typeof HTMLElement < "u" && n instanceof HTMLElement, Ut = /*
|
|
|
748
748
|
a.style.setProperty(m.property, m.value), Zt(a, m.property);
|
|
749
749
|
return new Promise((m) => {
|
|
750
750
|
let x = !1;
|
|
751
|
-
const
|
|
751
|
+
const h = () => {
|
|
752
752
|
x || (x = !0, a.removeEventListener("transitionend", R), m());
|
|
753
753
|
}, R = ($) => {
|
|
754
|
-
$.target === a &&
|
|
754
|
+
$.target === a && h();
|
|
755
755
|
};
|
|
756
|
-
a.addEventListener("transitionend", R), setTimeout(
|
|
756
|
+
a.addEventListener("transitionend", R), setTimeout(h, (i + s) * 1e3 + 60);
|
|
757
757
|
});
|
|
758
|
-
},
|
|
758
|
+
}, pt = W, mt = "data-flemo-skip-animation";
|
|
759
759
|
function Ve({
|
|
760
760
|
children: n,
|
|
761
761
|
statusBarHeight: e,
|
|
@@ -768,18 +768,18 @@ function Ve({
|
|
|
768
768
|
navigationBar: E,
|
|
769
769
|
hideStatusBar: m,
|
|
770
770
|
hideSystemNavigationBar: x,
|
|
771
|
-
backgroundColor:
|
|
771
|
+
backgroundColor: h = "white",
|
|
772
772
|
contentScrollable: R = !0,
|
|
773
773
|
...$
|
|
774
774
|
}) {
|
|
775
|
-
const { id: C, isActive: D, isRoot:
|
|
775
|
+
const { id: C, isActive: D, isRoot: q, zIndex: M, transitionName: Y, prevTransitionName: gt } = ht(), B = pt((t) => t.status), o = Q((t) => t.dragStatus), c = Q.getState().setDragStatus, y = Q.getState().setReplaceTransitionStatus, p = O((t) => t.index), l = ct.get(Y) ?? ct.get("none"), { initial: g, swipeDirection: d, decoratorName: P } = l, w = yt.get(P), { viewportScrollHeight: I } = Ge(), b = I > 0, [U, S] = bt(0), [H, _] = bt(0), Vt = L(null), V = L(null), Z = L(null), z = L(null), ut = L(null), J = L({
|
|
776
776
|
current: [],
|
|
777
777
|
prev: []
|
|
778
|
-
}), tt = L(!1),
|
|
778
|
+
}), tt = L(!1), ft = L(!1), rt = L(!1), ae = L(0), Rt = L({ x: 0, y: 0 }), wt = L({ x: 0, y: 0 }), Dt = L(0), Lt = L({ x: 0, y: 0 }), et = L({
|
|
779
779
|
element: null,
|
|
780
780
|
hasMarker: !1
|
|
781
|
-
}), ot = L({ element: null, hasMarker: !1 }), Nt = L(0), $t = L(0),
|
|
782
|
-
const f =
|
|
781
|
+
}), ot = L({ element: null, hasMarker: !1 }), Nt = L(0), $t = L(0), at = L(null), it = L(null), At = (t) => {
|
|
782
|
+
const f = wt.current;
|
|
783
783
|
return {
|
|
784
784
|
point: { x: t.clientX, y: t.clientY },
|
|
785
785
|
offset: {
|
|
@@ -790,67 +790,67 @@ function Ve({
|
|
|
790
790
|
velocity: Lt.current
|
|
791
791
|
};
|
|
792
792
|
}, ie = (t) => {
|
|
793
|
-
const f = t.timeStamp, v = Math.max(1, f - Dt.current), k =
|
|
793
|
+
const f = t.timeStamp, v = Math.max(1, f - Dt.current), k = wt.current;
|
|
794
794
|
Lt.current = {
|
|
795
795
|
x: (t.clientX - k.x) / v * 1e3,
|
|
796
796
|
y: (t.clientY - k.y) / v * 1e3
|
|
797
|
-
},
|
|
797
|
+
}, wt.current = { x: t.clientX, y: t.clientY }, Dt.current = f;
|
|
798
798
|
}, kt = (t, f, v) => {
|
|
799
|
-
const k =
|
|
799
|
+
const k = lt(t, f, v);
|
|
800
800
|
if (t === V.current)
|
|
801
|
-
for (const A of
|
|
802
|
-
|
|
801
|
+
for (const A of J.current.current)
|
|
802
|
+
lt(A, f, v);
|
|
803
803
|
else if (t === Z.current)
|
|
804
|
-
for (const A of
|
|
805
|
-
|
|
804
|
+
for (const A of J.current.prev)
|
|
805
|
+
lt(A, f, v);
|
|
806
806
|
return k;
|
|
807
807
|
}, se = (t) => {
|
|
808
|
-
const f = D ? O.getState().histories[
|
|
809
|
-
A && vt && !v?.appBar && k.push(A),
|
|
808
|
+
const f = D ? O.getState().histories[p - 1]?.id : O.getState().histories[p]?.id, v = f ? Q.getState().sharedBars[f] : void 0, k = [], A = at.current, st = it.current;
|
|
809
|
+
A && vt && !v?.appBar && k.push(A), st && Tt && !v?.navigationBar && k.push(st);
|
|
810
810
|
const X = [];
|
|
811
811
|
if (t) {
|
|
812
812
|
const nt = t.querySelector('[data-flemo-bar="app"]'), Ft = t.querySelector('[data-flemo-bar="nav"]');
|
|
813
813
|
nt && !vt && X.push(nt), Ft && !Tt && X.push(Ft);
|
|
814
814
|
}
|
|
815
|
-
|
|
815
|
+
J.current = { current: k, prev: X };
|
|
816
816
|
const Et = be(l).join(", ");
|
|
817
817
|
for (const nt of k) nt.style.willChange = Et;
|
|
818
818
|
for (const nt of X) nt.style.willChange = Et;
|
|
819
819
|
}, _t = () => {
|
|
820
|
-
for (const t of
|
|
821
|
-
|
|
822
|
-
for (const t of
|
|
823
|
-
|
|
824
|
-
|
|
820
|
+
for (const t of J.current.current)
|
|
821
|
+
F(t), t.style.removeProperty("will-change");
|
|
822
|
+
for (const t of J.current.prev)
|
|
823
|
+
F(t), t.style.removeProperty("will-change");
|
|
824
|
+
J.current = { current: [], prev: [] };
|
|
825
825
|
}, St = async (t) => {
|
|
826
|
-
if (!
|
|
826
|
+
if (!d || I > 10) return;
|
|
827
827
|
const f = V.current;
|
|
828
828
|
if (!f) return;
|
|
829
829
|
const v = Vt.current?.parentElement?.previousElementSibling;
|
|
830
|
-
if (Z.current = v?.querySelector("[data-flemo-screen]") ?? null,
|
|
831
|
-
rt.current = !0, ae.current = t.timeStamp, Rt.current = { x: t.clientX, y: t.clientY },
|
|
830
|
+
if (Z.current = v?.querySelector("[data-flemo-screen]") ?? null, ut.current = v?.querySelector("[data-flemo-decorator]") ?? null, !Z.current) return;
|
|
831
|
+
rt.current = !0, ae.current = t.timeStamp, Rt.current = { x: t.clientX, y: t.clientY }, wt.current = { x: t.clientX, y: t.clientY }, Dt.current = t.timeStamp, Lt.current = { x: 0, y: 0 }, f.setPointerCapture(t.pointerId), se(v), await l?.onSwipeStart(t, At(t), {
|
|
832
832
|
animate: kt,
|
|
833
833
|
currentScreen: f,
|
|
834
834
|
prevScreen: Z.current,
|
|
835
835
|
onStart: (A) => w?.onSwipeStart?.(A, {
|
|
836
|
-
animate:
|
|
837
|
-
currentDecorator:
|
|
838
|
-
prevDecorator:
|
|
836
|
+
animate: lt,
|
|
837
|
+
currentDecorator: z.current,
|
|
838
|
+
prevDecorator: ut.current
|
|
839
839
|
})
|
|
840
840
|
}) ? c("PENDING") : (c("IDLE"), rt.current = !1, _t());
|
|
841
841
|
}, ce = (t) => {
|
|
842
|
-
!
|
|
842
|
+
!d || !rt.current || I > 10 || (ie(t), l.onSwipe(t, At(t), {
|
|
843
843
|
animate: kt,
|
|
844
844
|
currentScreen: V.current,
|
|
845
845
|
prevScreen: Z.current,
|
|
846
846
|
onProgress: (f, v) => w?.onSwipe?.(f, v, {
|
|
847
|
-
animate:
|
|
848
|
-
currentDecorator:
|
|
849
|
-
prevDecorator:
|
|
847
|
+
animate: lt,
|
|
848
|
+
currentDecorator: z.current,
|
|
849
|
+
prevDecorator: ut.current
|
|
850
850
|
})
|
|
851
851
|
}));
|
|
852
852
|
}, ue = async (t) => {
|
|
853
|
-
if (!
|
|
853
|
+
if (!d || !rt.current) return;
|
|
854
854
|
rt.current = !1;
|
|
855
855
|
const f = V.current;
|
|
856
856
|
f && f.hasPointerCapture(t.pointerId) && f.releasePointerCapture(t.pointerId);
|
|
@@ -860,21 +860,21 @@ function Ve({
|
|
|
860
860
|
currentScreen: V.current,
|
|
861
861
|
prevScreen: Z.current,
|
|
862
862
|
onStart: (A) => w?.onSwipeEnd?.(A, {
|
|
863
|
-
animate:
|
|
864
|
-
currentDecorator:
|
|
865
|
-
prevDecorator:
|
|
863
|
+
animate: lt,
|
|
864
|
+
currentDecorator: z.current,
|
|
865
|
+
prevDecorator: ut.current
|
|
866
866
|
})
|
|
867
867
|
})) {
|
|
868
|
-
V.current?.setAttribute(
|
|
869
|
-
for (const A of
|
|
868
|
+
V.current?.setAttribute(mt, "true"), z.current?.setAttribute(mt, "true");
|
|
869
|
+
for (const A of J.current.current)
|
|
870
870
|
A.style.removeProperty("will-change");
|
|
871
|
-
for (const A of
|
|
872
|
-
|
|
873
|
-
|
|
871
|
+
for (const A of J.current.prev)
|
|
872
|
+
F(A), A.style.removeProperty("will-change");
|
|
873
|
+
J.current = { current: [], prev: [] }, window.history.back();
|
|
874
874
|
} else
|
|
875
|
-
|
|
875
|
+
F(V.current), Z.current && F(Z.current), z.current && F(z.current), ut.current && F(ut.current), _t(), c("IDLE");
|
|
876
876
|
}, le = (t) => {
|
|
877
|
-
if (!(!
|
|
877
|
+
if (!(!q && D && B === "COMPLETED" && o === "IDLE" && !!d && I < 10))
|
|
878
878
|
return;
|
|
879
879
|
et.current = qt(t.target, {
|
|
880
880
|
direction: "x",
|
|
@@ -883,7 +883,7 @@ function Ve({
|
|
|
883
883
|
direction: "y",
|
|
884
884
|
verifyByScroll: !0
|
|
885
885
|
}), Nt.current = t.clientX, $t.current = t.clientY, (!et.current.element && !ot.current.element || et.current.element || ot.current.element) && (tt.current = !0);
|
|
886
|
-
},
|
|
886
|
+
}, pe = (t) => {
|
|
887
887
|
if (I > 10)
|
|
888
888
|
return;
|
|
889
889
|
if (rt.current) {
|
|
@@ -892,49 +892,49 @@ function Ve({
|
|
|
892
892
|
}
|
|
893
893
|
const f = !et.current.element && !ot.current.element;
|
|
894
894
|
if (tt.current && f) {
|
|
895
|
-
tt.current = !1,
|
|
895
|
+
tt.current = !1, ft.current = !0;
|
|
896
896
|
const v = t.clientY - $t.current, k = t.clientX - Nt.current;
|
|
897
|
-
(
|
|
897
|
+
(d === "y" && v > 0 || d === "x" && k > 0) && St(t.nativeEvent);
|
|
898
898
|
} else if (tt.current && !f) {
|
|
899
|
-
const v = t.clientX - Nt.current, k = t.clientY - $t.current, A = ot.current.element && ot.current.element.scrollTop <= 0,
|
|
900
|
-
(
|
|
899
|
+
const v = t.clientX - Nt.current, k = t.clientY - $t.current, A = ot.current.element && ot.current.element.scrollTop <= 0, st = et.current.element && et.current.element.scrollLeft <= 0 && et.current.hasMarker;
|
|
900
|
+
(d === "y" && (A || et.current.element) && k > 0 && Math.abs(v) < 2 || d === "x" && (st || ot.current.element) && v > 0 && Math.abs(k) < 2) && (tt.current = !1, ft.current = !0, St(t.nativeEvent));
|
|
901
901
|
}
|
|
902
902
|
}, jt = (t) => {
|
|
903
|
-
tt.current = !1,
|
|
903
|
+
tt.current = !1, ft.current = !1, rt.current && ue(t.nativeEvent);
|
|
904
904
|
};
|
|
905
|
-
|
|
905
|
+
dt(() => {
|
|
906
906
|
const t = V.current;
|
|
907
907
|
if (!t) return;
|
|
908
908
|
const f = (v) => {
|
|
909
|
-
|
|
909
|
+
ft.current && v.preventDefault(), v.target?.dataset.swipeAtEdgeBar === "true" && v.preventDefault();
|
|
910
910
|
};
|
|
911
911
|
return t.addEventListener("touchmove", f, {
|
|
912
912
|
passive: !1
|
|
913
913
|
}), () => {
|
|
914
914
|
t.removeEventListener("touchmove", f);
|
|
915
915
|
};
|
|
916
|
-
}, []),
|
|
916
|
+
}, []), dt(() => {
|
|
917
917
|
if (!D) {
|
|
918
|
-
B === "REPLACING" &&
|
|
918
|
+
B === "REPLACING" && gt !== Y && y("PENDING");
|
|
919
919
|
return;
|
|
920
920
|
}
|
|
921
921
|
if (B === "COMPLETED") {
|
|
922
|
-
c("IDLE"),
|
|
922
|
+
c("IDLE"), y("IDLE"), V.current && (F(V.current), V.current.removeAttribute(mt)), z.current && (F(z.current), z.current.removeAttribute(mt)), at.current && (F(at.current), at.current.style.removeProperty("will-change")), it.current && (F(it.current), it.current.style.removeProperty("will-change"));
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
925
925
|
if (B === "IDLE") return;
|
|
926
926
|
const t = V.current;
|
|
927
927
|
if (!t) return;
|
|
928
928
|
const f = () => {
|
|
929
|
-
const
|
|
930
|
-
|
|
929
|
+
const K = pt.getState().transitionTaskId;
|
|
930
|
+
K && G.resolveTask(K);
|
|
931
931
|
}, v = `${B}-true`;
|
|
932
|
-
if (!(!(t.getAttribute(
|
|
932
|
+
if (!(!(t.getAttribute(mt) === "true") && Pe(l, v))) {
|
|
933
933
|
queueMicrotask(f);
|
|
934
934
|
return;
|
|
935
935
|
}
|
|
936
|
-
const
|
|
937
|
-
|
|
936
|
+
const st = xe("screen", Y, v), X = (K) => {
|
|
937
|
+
K.target === t && K.animationName === st && (t.removeEventListener("animationend", X), f());
|
|
938
938
|
};
|
|
939
939
|
return t.addEventListener("animationend", X), () => {
|
|
940
940
|
t.removeEventListener("animationend", X);
|
|
@@ -943,13 +943,13 @@ function Ve({
|
|
|
943
943
|
B,
|
|
944
944
|
D,
|
|
945
945
|
C,
|
|
946
|
-
|
|
946
|
+
gt,
|
|
947
947
|
Y,
|
|
948
948
|
l,
|
|
949
949
|
c,
|
|
950
|
-
|
|
950
|
+
y
|
|
951
951
|
]), xt(() => {
|
|
952
|
-
const t =
|
|
952
|
+
const t = at.current;
|
|
953
953
|
if (!t) {
|
|
954
954
|
S(0);
|
|
955
955
|
return;
|
|
@@ -962,7 +962,7 @@ function Ve({
|
|
|
962
962
|
f.disconnect();
|
|
963
963
|
};
|
|
964
964
|
}, [i]), xt(() => {
|
|
965
|
-
const t =
|
|
965
|
+
const t = it.current;
|
|
966
966
|
if (!t) {
|
|
967
967
|
_(0);
|
|
968
968
|
return;
|
|
@@ -981,25 +981,25 @@ function Ve({
|
|
|
981
981
|
navigationBar: !!s
|
|
982
982
|
}), () => f(C);
|
|
983
983
|
}, [C, i, s]);
|
|
984
|
-
const Xt = D || M ===
|
|
984
|
+
const Xt = D || M === p - 1, vt = !!i, Tt = !!s;
|
|
985
985
|
xt(() => {
|
|
986
|
-
const t =
|
|
986
|
+
const t = at.current, f = it.current;
|
|
987
987
|
if (!t && !f) return;
|
|
988
988
|
const v = () => {
|
|
989
|
-
if (!(
|
|
989
|
+
if (!(pt.getState().status === "PUSHING" || pt.getState().status === "POPPING" || pt.getState().status === "REPLACING") || !Xt) {
|
|
990
990
|
t?.removeAttribute("data-flemo-bar-riding"), f?.removeAttribute("data-flemo-bar-riding");
|
|
991
991
|
return;
|
|
992
992
|
}
|
|
993
|
-
const X = D ? O.getState().histories[
|
|
993
|
+
const X = D ? O.getState().histories[p - 1]?.id : O.getState().histories[p]?.id, K = X ? Q.getState().sharedBars[X] : void 0, Et = vt && !K?.appBar, nt = Tt && !K?.navigationBar;
|
|
994
994
|
t && t.setAttribute("data-flemo-bar-riding", Et ? "true" : "false"), f && f.setAttribute("data-flemo-bar-riding", nt ? "true" : "false");
|
|
995
995
|
};
|
|
996
996
|
v();
|
|
997
|
-
const k = Q.subscribe(v), A =
|
|
997
|
+
const k = Q.subscribe(v), A = pt.subscribe(v);
|
|
998
998
|
return () => {
|
|
999
999
|
k(), A(), t?.removeAttribute("data-flemo-bar-riding"), f?.removeAttribute("data-flemo-bar-riding");
|
|
1000
1000
|
};
|
|
1001
|
-
}, [Xt, D,
|
|
1002
|
-
const
|
|
1001
|
+
}, [Xt, D, p, vt, Tt]);
|
|
1002
|
+
const de = (() => {
|
|
1003
1003
|
if (!D) return {};
|
|
1004
1004
|
if (B !== "PUSHING" && B !== "REPLACING") return {};
|
|
1005
1005
|
const t = {};
|
|
@@ -1046,7 +1046,7 @@ function Ve({
|
|
|
1046
1046
|
ref: V,
|
|
1047
1047
|
...$,
|
|
1048
1048
|
onPointerDown: le,
|
|
1049
|
-
onPointerMove:
|
|
1049
|
+
onPointerMove: pe,
|
|
1050
1050
|
onPointerUp: jt,
|
|
1051
1051
|
onPointerCancel: jt,
|
|
1052
1052
|
"data-flemo-screen": !0,
|
|
@@ -1057,10 +1057,10 @@ function Ve({
|
|
|
1057
1057
|
display: "flex",
|
|
1058
1058
|
flexDirection: "column",
|
|
1059
1059
|
height: "100%",
|
|
1060
|
-
backgroundColor:
|
|
1060
|
+
backgroundColor: h,
|
|
1061
1061
|
overflowY: R ? void 0 : "auto",
|
|
1062
|
-
touchAction:
|
|
1063
|
-
...
|
|
1062
|
+
touchAction: d === "x" ? "pan-y" : d === "y" ? "pan-x" : "auto",
|
|
1063
|
+
...de,
|
|
1064
1064
|
...$.style
|
|
1065
1065
|
},
|
|
1066
1066
|
children: [
|
|
@@ -1136,7 +1136,7 @@ function Ve({
|
|
|
1136
1136
|
i && /* @__PURE__ */ N(
|
|
1137
1137
|
"div",
|
|
1138
1138
|
{
|
|
1139
|
-
ref:
|
|
1139
|
+
ref: at,
|
|
1140
1140
|
"data-flemo-bar": "app",
|
|
1141
1141
|
"data-flemo-bar-transition": Y,
|
|
1142
1142
|
"data-flemo-bar-status": B,
|
|
@@ -1154,7 +1154,7 @@ function Ve({
|
|
|
1154
1154
|
s && /* @__PURE__ */ N(
|
|
1155
1155
|
"div",
|
|
1156
1156
|
{
|
|
1157
|
-
ref:
|
|
1157
|
+
ref: it,
|
|
1158
1158
|
"data-flemo-bar": "nav",
|
|
1159
1159
|
"data-flemo-bar-transition": Y,
|
|
1160
1160
|
"data-flemo-bar-status": B,
|
|
@@ -1170,7 +1170,7 @@ function Ve({
|
|
|
1170
1170
|
children: s
|
|
1171
1171
|
}
|
|
1172
1172
|
),
|
|
1173
|
-
w && /* @__PURE__ */ N(He, { ref:
|
|
1173
|
+
w && /* @__PURE__ */ N(He, { ref: z }),
|
|
1174
1174
|
/* @__PURE__ */ N(
|
|
1175
1175
|
"div",
|
|
1176
1176
|
{
|
|
@@ -1190,7 +1190,7 @@ function Ve({
|
|
|
1190
1190
|
);
|
|
1191
1191
|
}
|
|
1192
1192
|
function Je({ children: n, ...e }) {
|
|
1193
|
-
const { isActive: r, isPrev: a, zIndex: u } =
|
|
1193
|
+
const { isActive: r, isPrev: a, zIndex: u } = ht(), i = O((h) => h.index), s = W((h) => h.status), T = Q((h) => h.dragStatus), E = Q((h) => h.replaceTransitionStatus), x = !r && (s === "COMPLETED" && T === "IDLE") || a && i - 2 <= u && E === "IDLE" || a && i - 2 > u;
|
|
1194
1194
|
return /* @__PURE__ */ N(Ce, { freeze: x, children: /* @__PURE__ */ N(Ve, { ...e, children: n }) });
|
|
1195
1195
|
}
|
|
1196
1196
|
export {
|
|
@@ -1207,7 +1207,7 @@ export {
|
|
|
1207
1207
|
rn as createTransition,
|
|
1208
1208
|
ze as useNavigate,
|
|
1209
1209
|
We as useParams,
|
|
1210
|
-
|
|
1210
|
+
ht as useScreen,
|
|
1211
1211
|
Q as useScreenStore,
|
|
1212
1212
|
Ke as useStep,
|
|
1213
1213
|
Ge as useViewportScrollHeight
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemo/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.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",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"url": "https://github.com/kimjh96/flemo/issues",
|
|
32
32
|
"email": "kimjhs@kakao.com"
|
|
33
33
|
},
|
|
34
|
-
"homepage": "https://flemo
|
|
34
|
+
"homepage": "https://flemo.dev",
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"path-to-regexp": "^8.2.0",
|
|
38
38
|
"zustand": "^5.0.11",
|
|
39
|
-
"@flemo/core": "1.0.
|
|
39
|
+
"@flemo/core": "1.0.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@types/react": "^19.2.0",
|
|
46
46
|
"@types/react-dom": "^19.2.0",
|
|
47
47
|
"@vitejs/plugin-react-swc": "^4.0.1",
|
|
48
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
48
49
|
"eslint": "^9.33.0",
|
|
49
50
|
"jsdom": "^25.0.1",
|
|
50
51
|
"react": "^19.2.0",
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
"lint": "eslint \"**/*.{js,mjs,ts,jsx,tsx,mts}\"",
|
|
71
72
|
"typecheck": "tsc --noEmit",
|
|
72
73
|
"test": "vitest run",
|
|
74
|
+
"test:coverage": "vitest run --coverage",
|
|
73
75
|
"test:watch": "vitest",
|
|
74
76
|
"clean": "rm -rf dist .turbo"
|
|
75
77
|
}
|