@flemo/core 1.11.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/TaskManger.d.ts +7 -0
- package/dist/core/createRouterScope.d.ts +7 -0
- package/dist/history/__tests__/seedRouterEntry.test.d.ts +1 -0
- package/dist/history/createHistorySync.d.ts +17 -0
- package/dist/history/seedRouterEntry.d.ts +11 -0
- package/dist/history/store.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +490 -349
- package/dist/transition/__tests__/registerTransitionDefinitions.test.d.ts +0 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createStore as e } from "zustand/vanilla";
|
|
2
2
|
import { compile as t, match as n, parse as r, pathToRegexp as i } from "path-to-regexp";
|
|
3
|
-
|
|
3
|
+
//#region src/core/TaskManger.ts
|
|
4
|
+
var a = 1200, o = new class {
|
|
4
5
|
tasks = /* @__PURE__ */ new Map();
|
|
5
6
|
instanceId = Date.now().toString();
|
|
6
7
|
isLocked = !1;
|
|
@@ -8,6 +9,9 @@ var a = new class {
|
|
|
8
9
|
taskQueue = Promise.resolve();
|
|
9
10
|
signalListeners = /* @__PURE__ */ new Map();
|
|
10
11
|
pendingTaskQueue = [];
|
|
12
|
+
get pendingTaskIds() {
|
|
13
|
+
return this.pendingTaskQueue.map((e) => e.id);
|
|
14
|
+
}
|
|
11
15
|
isProcessingPending = !1;
|
|
12
16
|
async acquireLock(e) {
|
|
13
17
|
for (let t = 0; t < 10; t++) {
|
|
@@ -45,16 +49,20 @@ var a = new class {
|
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
52
|
+
pendingWaiters = /* @__PURE__ */ new Set();
|
|
53
|
+
notifyPendingWaiters() {
|
|
54
|
+
for (let e of [...this.pendingWaiters]) e();
|
|
55
|
+
}
|
|
48
56
|
async waitForPendingTasks() {
|
|
49
57
|
return new Promise((e) => {
|
|
50
|
-
let t = () => {
|
|
51
|
-
this.pendingTaskQueue.filter((e) => e.status === "MANUAL_PENDING" || e.status === "SIGNAL_PENDING").length === 0 ? e() :
|
|
58
|
+
let t = null, n = () => {
|
|
59
|
+
this.pendingTaskQueue.filter((e) => e.status === "MANUAL_PENDING" || e.status === "SIGNAL_PENDING").length === 0 ? (this.pendingWaiters.delete(n), t && clearTimeout(t), e()) : (t && clearTimeout(t), t = setTimeout(n, 100));
|
|
52
60
|
};
|
|
53
|
-
|
|
61
|
+
this.pendingWaiters.add(n), n();
|
|
54
62
|
});
|
|
55
63
|
}
|
|
56
64
|
async onTaskStatusChange(e, t) {
|
|
57
|
-
(t === "COMPLETED" || t === "FAILED" || t === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((t) => t.id !== e), await this.processPendingTasks());
|
|
65
|
+
(t === "COMPLETED" || t === "FAILED" || t === "ROLLEDBACK") && (this.pendingTaskQueue = this.pendingTaskQueue.filter((t) => t.id !== e), await this.processPendingTasks(), this.notifyPendingWaiters());
|
|
58
66
|
}
|
|
59
67
|
async addTask(e, t = {}) {
|
|
60
68
|
let n = t.id || this.generateTaskId();
|
|
@@ -103,7 +111,7 @@ var a = new class {
|
|
|
103
111
|
resolve: r,
|
|
104
112
|
reject: i,
|
|
105
113
|
result: e
|
|
106
|
-
}, this.pendingTaskQueue.push(d), await this.onTaskStatusChange(d.id, "MANUAL_PENDING");
|
|
114
|
+
}, this.pendingTaskQueue.push(d), this.armBackstop(d), await this.onTaskStatusChange(d.id, "MANUAL_PENDING");
|
|
107
115
|
return;
|
|
108
116
|
}
|
|
109
117
|
if (n.signal) {
|
|
@@ -111,7 +119,7 @@ var a = new class {
|
|
|
111
119
|
resolve: r,
|
|
112
120
|
reject: i,
|
|
113
121
|
result: e
|
|
114
|
-
}, this.signalListeners.has(n.signal) || this.signalListeners.set(n.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(n.signal).add(d.id), this.pendingTaskQueue.push(d), await this.onTaskStatusChange(d.id, "SIGNAL_PENDING");
|
|
122
|
+
}, this.signalListeners.has(n.signal) || this.signalListeners.set(n.signal, /* @__PURE__ */ new Set()), this.signalListeners.get(n.signal).add(d.id), this.pendingTaskQueue.push(d), this.armBackstop(d), await this.onTaskStatusChange(d.id, "SIGNAL_PENDING");
|
|
115
123
|
return;
|
|
116
124
|
}
|
|
117
125
|
if (n.condition && !await n.condition()) {
|
|
@@ -119,7 +127,7 @@ var a = new class {
|
|
|
119
127
|
resolve: r,
|
|
120
128
|
reject: i,
|
|
121
129
|
result: e
|
|
122
|
-
}, this.pendingTaskQueue.push(d), await this.onTaskStatusChange(d.id, "MANUAL_PENDING");
|
|
130
|
+
}, this.pendingTaskQueue.push(d), this.armBackstop(d), await this.onTaskStatusChange(d.id, "MANUAL_PENDING");
|
|
123
131
|
return;
|
|
124
132
|
}
|
|
125
133
|
}
|
|
@@ -147,9 +155,15 @@ var a = new class {
|
|
|
147
155
|
}).catch(i);
|
|
148
156
|
});
|
|
149
157
|
}
|
|
158
|
+
armBackstop(e) {
|
|
159
|
+
let t = e.control?.maxLifetimeMs;
|
|
160
|
+
!t || t <= 0 || typeof setTimeout > "u" || (e.backstopTimer = setTimeout(() => {
|
|
161
|
+
delete e.backstopTimer, this.resolveTask(e.id);
|
|
162
|
+
}, t));
|
|
163
|
+
}
|
|
150
164
|
async resolveTask(e) {
|
|
151
165
|
let t = this.tasks.get(e);
|
|
152
|
-
if (!t || t.status !== "MANUAL_PENDING" && t.status !== "SIGNAL_PENDING") return !1;
|
|
166
|
+
if (t?.backstopTimer && (clearTimeout(t.backstopTimer), delete t.backstopTimer), !t || t.status !== "MANUAL_PENDING" && t.status !== "SIGNAL_PENDING") return !1;
|
|
153
167
|
if (t.manualResolver) {
|
|
154
168
|
if (t.control?.condition && !await t.control.condition()) return !1;
|
|
155
169
|
t.status = "COMPLETED";
|
|
@@ -175,7 +189,7 @@ var a = new class {
|
|
|
175
189
|
}();
|
|
176
190
|
//#endregion
|
|
177
191
|
//#region src/history/store.ts
|
|
178
|
-
function
|
|
192
|
+
function s(t = [], n = -1) {
|
|
179
193
|
return e((e) => ({
|
|
180
194
|
index: n,
|
|
181
195
|
pendingIndex: n,
|
|
@@ -212,6 +226,8 @@ function o(t = [], n = -1) {
|
|
|
212
226
|
pendingIndex: t,
|
|
213
227
|
histories: e.histories.slice(0, t + 1)
|
|
214
228
|
})),
|
|
229
|
+
truncationEpoch: 0,
|
|
230
|
+
bumpTruncationEpoch: () => e((e) => ({ truncationEpoch: e.truncationEpoch + 1 })),
|
|
215
231
|
setTransitionName: (t, n) => e((e) => {
|
|
216
232
|
let r = e.histories[t];
|
|
217
233
|
if (!r || r.transitionName === n) return {};
|
|
@@ -225,13 +241,13 @@ function o(t = [], n = -1) {
|
|
|
225
241
|
}
|
|
226
242
|
//#endregion
|
|
227
243
|
//#region src/utils/getMatchedPathPattern.ts
|
|
228
|
-
function
|
|
244
|
+
function c(e, t) {
|
|
229
245
|
return Array.isArray(e) ? e.find((e) => i(e).regexp.test(t)) ?? "" : i(e).regexp.test(t) ? e : "";
|
|
230
246
|
}
|
|
231
247
|
//#endregion
|
|
232
248
|
//#region src/utils/getParams.ts
|
|
233
|
-
function
|
|
234
|
-
let i = n(
|
|
249
|
+
function l(e, t, r) {
|
|
250
|
+
let i = n(c(e, t))(t), a = new URLSearchParams(r), o = Object.fromEntries(a.entries());
|
|
235
251
|
return i ? {
|
|
236
252
|
...i.params,
|
|
237
253
|
...o
|
|
@@ -239,24 +255,24 @@ function c(e, t, r) {
|
|
|
239
255
|
}
|
|
240
256
|
//#endregion
|
|
241
257
|
//#region src/history/seedInitialHistory.ts
|
|
242
|
-
function
|
|
258
|
+
function u(e, t, n, r) {
|
|
243
259
|
return {
|
|
244
260
|
id: "root",
|
|
245
261
|
pathname: t,
|
|
246
|
-
params:
|
|
262
|
+
params: l(e, t, n),
|
|
247
263
|
transitionName: r,
|
|
248
264
|
layoutId: null
|
|
249
265
|
};
|
|
250
266
|
}
|
|
251
267
|
//#endregion
|
|
252
268
|
//#region src/utils/isServer.ts
|
|
253
|
-
function
|
|
269
|
+
function d() {
|
|
254
270
|
return typeof document > "u";
|
|
255
271
|
}
|
|
256
272
|
//#endregion
|
|
257
273
|
//#region src/history/ensureWindowHistoryState.ts
|
|
258
|
-
function
|
|
259
|
-
if (
|
|
274
|
+
function f(e, t, n = {}) {
|
|
275
|
+
if (d()) return;
|
|
260
276
|
let r = {
|
|
261
277
|
id: "root",
|
|
262
278
|
index: 0,
|
|
@@ -277,12 +293,24 @@ function d(e, t, n = {}) {
|
|
|
277
293
|
}, "", window.location.href);
|
|
278
294
|
}
|
|
279
295
|
//#endregion
|
|
296
|
+
//#region src/history/seedRouterEntry.ts
|
|
297
|
+
function p(e) {
|
|
298
|
+
let { driver: t, routerKey: n, nested: r, seedPathname: i, defaultTransitionName: a, rootParams: o } = e;
|
|
299
|
+
if (d()) return;
|
|
300
|
+
if (r) {
|
|
301
|
+
let e = t.readPathname().replace(/\/+$/, "") || "/";
|
|
302
|
+
if (!(e === i || e !== "/" && i.startsWith(`${e}/`))) return;
|
|
303
|
+
}
|
|
304
|
+
let s = r && n !== null ? t.readState() == null : !1;
|
|
305
|
+
f(n, a, o), r && n !== null && s && t.readPathname() !== i && t.replaceState(t.readState(), i);
|
|
306
|
+
}
|
|
307
|
+
//#endregion
|
|
280
308
|
//#region src/history/historyDriver.ts
|
|
281
|
-
var
|
|
309
|
+
var m = (e, t) => ({
|
|
282
310
|
...window.history.state ?? {},
|
|
283
311
|
[e]: t
|
|
284
312
|
});
|
|
285
|
-
function
|
|
313
|
+
function h(e) {
|
|
286
314
|
return e === void 0 ? {
|
|
287
315
|
readState: () => window.history.state,
|
|
288
316
|
readPathname: () => window.location.pathname,
|
|
@@ -300,8 +328,8 @@ function p(e) {
|
|
|
300
328
|
} : {
|
|
301
329
|
readState: () => window.history.state?.[e] ?? null,
|
|
302
330
|
readPathname: () => window.location.pathname,
|
|
303
|
-
pushState: (t, n) => window.history.pushState(
|
|
304
|
-
replaceState: (t, n) => window.history.replaceState(
|
|
331
|
+
pushState: (t, n) => window.history.pushState(m(e, t), "", n),
|
|
332
|
+
replaceState: (t, n) => window.history.replaceState(m(e, t), "", n),
|
|
305
333
|
go: (e) => window.history.go(e),
|
|
306
334
|
back: () => window.history.back(),
|
|
307
335
|
subscribe: (t) => {
|
|
@@ -315,7 +343,7 @@ function p(e) {
|
|
|
315
343
|
}
|
|
316
344
|
//#endregion
|
|
317
345
|
//#region src/navigate/selfPopGuard.ts
|
|
318
|
-
function
|
|
346
|
+
function g() {
|
|
319
347
|
let e = 0;
|
|
320
348
|
return {
|
|
321
349
|
mark() {
|
|
@@ -326,72 +354,149 @@ function m() {
|
|
|
326
354
|
}
|
|
327
355
|
};
|
|
328
356
|
}
|
|
329
|
-
var
|
|
330
|
-
function
|
|
331
|
-
|
|
357
|
+
var _ = g();
|
|
358
|
+
function v() {
|
|
359
|
+
_.mark();
|
|
332
360
|
}
|
|
333
|
-
function
|
|
334
|
-
return
|
|
361
|
+
function y() {
|
|
362
|
+
return _.consume();
|
|
335
363
|
}
|
|
336
364
|
//#endregion
|
|
337
365
|
//#region src/history/createHistorySync.ts
|
|
338
|
-
function
|
|
339
|
-
let { stores: t, driver: n =
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
366
|
+
function b(e) {
|
|
367
|
+
let { stores: t, driver: n = h(), consume: r = y } = e, i = !1, s = 0, c = async (e) => {
|
|
368
|
+
let n = e.state, r = t.history.getState().truncationEpoch, i = o.generateTaskId();
|
|
369
|
+
s += 1;
|
|
370
|
+
try {
|
|
371
|
+
await l(e, n, r, i);
|
|
372
|
+
} finally {
|
|
373
|
+
--s;
|
|
374
|
+
}
|
|
375
|
+
}, l = async (r, s, l, u) => {
|
|
376
|
+
(await o.addTask(async (a) => {
|
|
343
377
|
if (i) {
|
|
344
|
-
|
|
378
|
+
a.abort();
|
|
345
379
|
return;
|
|
346
380
|
}
|
|
347
|
-
if (
|
|
348
|
-
|
|
381
|
+
if (e.ownsPathname && !e.ownsPathname(r.pathname)) {
|
|
382
|
+
a.abort();
|
|
349
383
|
return;
|
|
350
384
|
}
|
|
351
|
-
let { setStatus:
|
|
352
|
-
if (
|
|
353
|
-
|
|
385
|
+
let { setStatus: o, setTransitionTaskId: d } = t.navigate.getState(), { index: f, histories: p, addHistory: m, popHistory: h, setPendingIndex: g } = t.history.getState();
|
|
386
|
+
if (l !== t.history.getState().truncationEpoch && n.readState()?.id !== r.state?.id) {
|
|
387
|
+
a.abort();
|
|
354
388
|
return;
|
|
355
389
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
r.abort();
|
|
390
|
+
if (!s?.id) {
|
|
391
|
+
a.abort();
|
|
359
392
|
return;
|
|
360
393
|
}
|
|
361
|
-
let
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
394
|
+
let _ = p.findIndex((e) => e.id === s.id);
|
|
395
|
+
if (_ === f) {
|
|
396
|
+
a.abort();
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
let v = {
|
|
400
|
+
id: s.id,
|
|
401
|
+
pathname: r.pathname,
|
|
402
|
+
params: s.params,
|
|
403
|
+
transitionName: s.transitionName,
|
|
404
|
+
layoutId: s.layoutId,
|
|
405
|
+
frameIndex: s.index
|
|
368
406
|
};
|
|
369
|
-
if (
|
|
370
|
-
let e =
|
|
371
|
-
if (!(
|
|
372
|
-
t.history.getState().adoptHistory(
|
|
407
|
+
if (_ === -1) {
|
|
408
|
+
let e = p[f]?.frameIndex ?? f;
|
|
409
|
+
if (!(s.index > e && (s.status === "PUSHING" || s.status === "REPLACING"))) {
|
|
410
|
+
t.history.getState().adoptHistory(v), a.abort();
|
|
373
411
|
return;
|
|
374
412
|
}
|
|
375
|
-
return
|
|
376
|
-
|
|
413
|
+
return d(u), o(s.status === "REPLACING" ? "REPLACING" : "PUSHING"), m(v), async () => {
|
|
414
|
+
o("COMPLETED");
|
|
377
415
|
};
|
|
378
416
|
}
|
|
379
|
-
let
|
|
380
|
-
return
|
|
381
|
-
|
|
417
|
+
let y = f - 1;
|
|
418
|
+
return d(u), g(y), o("POPPING"), async () => {
|
|
419
|
+
h(y + 1), o("COMPLETED"), y > _ && !i && c(r);
|
|
382
420
|
};
|
|
383
421
|
}, {
|
|
384
|
-
id:
|
|
385
|
-
control: {
|
|
422
|
+
id: u,
|
|
423
|
+
control: {
|
|
424
|
+
manual: !0,
|
|
425
|
+
maxLifetimeMs: a
|
|
426
|
+
}
|
|
386
427
|
})).result?.();
|
|
428
|
+
}, u = null, d = 0, f = "", p = 0, m = () => typeof performance < "u" ? performance.now() : Number.MAX_VALUE, g = () => {
|
|
429
|
+
i || typeof setTimeout > "u" || (u && clearTimeout(u), u = setTimeout(function e() {
|
|
430
|
+
if (u = null, i) return;
|
|
431
|
+
if (s > 0 || o.pendingTaskIds.length > 0 || m() - d < 400) {
|
|
432
|
+
u = setTimeout(e, 150);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
let r = n.readPathname(), { histories: a, index: l } = t.history.getState(), h = a[l];
|
|
436
|
+
if (!h || h.pathname === r) {
|
|
437
|
+
p = 0;
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
let g = n.readState(), _ = `${l}:${h.id}:${g?.id ?? "-"}:${r}`;
|
|
441
|
+
if (_ === f) {
|
|
442
|
+
if (p += 1, p > 4) return;
|
|
443
|
+
} else f = _, p = 0;
|
|
444
|
+
g?.id && g.id !== h.id && c({
|
|
445
|
+
state: g,
|
|
446
|
+
pathname: r
|
|
447
|
+
}), u = setTimeout(e, 150);
|
|
448
|
+
}, 150));
|
|
449
|
+
}, _ = n.subscribe((e) => {
|
|
450
|
+
if (!i && (d = m(), g(), C(e.pathname), !r())) return c(e);
|
|
387
451
|
});
|
|
388
|
-
|
|
389
|
-
|
|
452
|
+
if (e.routerKey && e.zoneEntryId && T(n, e.zoneEntryId)) {
|
|
453
|
+
let n = t.history.getState().histories[t.history.getState().index]?.pathname, r = w(n);
|
|
454
|
+
for (let t of r) c({
|
|
455
|
+
state: t.raw?.[e.routerKey] ?? null,
|
|
456
|
+
pathname: t.pathname
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
return g(), () => {
|
|
460
|
+
i = !0, u && clearTimeout(u), _();
|
|
390
461
|
};
|
|
391
462
|
}
|
|
463
|
+
var x = [], S = !1, C = (e) => {
|
|
464
|
+
S || typeof window > "u" || (S = !0, queueMicrotask(() => {
|
|
465
|
+
S = !1;
|
|
466
|
+
}), x.push({
|
|
467
|
+
raw: window.history.state,
|
|
468
|
+
pathname: e
|
|
469
|
+
}));
|
|
470
|
+
}, w = (e) => {
|
|
471
|
+
if (!e) return [];
|
|
472
|
+
for (let t = x.length - 1; t >= 0; --t) if (x[t].pathname === e) return x.slice(t + 1);
|
|
473
|
+
return [];
|
|
474
|
+
}, T = (e, t) => {
|
|
475
|
+
if (typeof window > "u") return !1;
|
|
476
|
+
let n = window.history.state;
|
|
477
|
+
return n ? Object.values(n).some((e) => !!e && typeof e == "object" && e.id === t) : !1;
|
|
478
|
+
};
|
|
479
|
+
function E(e, t) {
|
|
480
|
+
for (let n = x.length - 1; n >= 0; --n) if (x[n].pathname === t) return x[n].raw?.[e] ?? null;
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
483
|
+
var D = /* @__PURE__ */ new WeakMap();
|
|
484
|
+
function ee(e) {
|
|
485
|
+
D.has(e) || D.set(e, b({
|
|
486
|
+
stores: e,
|
|
487
|
+
driver: e.driver,
|
|
488
|
+
consume: e.consume,
|
|
489
|
+
routerKey: e.routerKey,
|
|
490
|
+
zoneEntryId: e.zoneEntryId,
|
|
491
|
+
ownsPathname: e.ownsPathname
|
|
492
|
+
}));
|
|
493
|
+
}
|
|
494
|
+
function te(e) {
|
|
495
|
+
e.persistent || (D.get(e)?.(), D.delete(e));
|
|
496
|
+
}
|
|
392
497
|
//#endregion
|
|
393
498
|
//#region src/history/memoryHistoryDriver.ts
|
|
394
|
-
function
|
|
499
|
+
function ne(e) {
|
|
395
500
|
let t = [{
|
|
396
501
|
state: e?.state ?? null,
|
|
397
502
|
url: e?.url ?? "/"
|
|
@@ -433,7 +538,7 @@ function y(e) {
|
|
|
433
538
|
}
|
|
434
539
|
//#endregion
|
|
435
540
|
//#region src/navigate/store.ts
|
|
436
|
-
function
|
|
541
|
+
function re() {
|
|
437
542
|
return e((e) => ({
|
|
438
543
|
status: "IDLE",
|
|
439
544
|
transitionTaskId: null,
|
|
@@ -443,11 +548,11 @@ function b() {
|
|
|
443
548
|
}
|
|
444
549
|
//#endregion
|
|
445
550
|
//#region src/navigate/createNavigationController.ts
|
|
446
|
-
var
|
|
551
|
+
var O = (e, t, n) => {
|
|
447
552
|
let { regexp: r } = i(e);
|
|
448
553
|
for (let e = t - 1; e >= 0; e--) if (r.test(n[e].pathname)) return t - e;
|
|
449
554
|
return -1;
|
|
450
|
-
},
|
|
555
|
+
}, k = (e, t) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.trunc(e)) : t, A = async (e, t, n, r) => {
|
|
451
556
|
let i, a = new Promise((t) => {
|
|
452
557
|
i = e.subscribe(() => t(!0));
|
|
453
558
|
}), o = new Promise((e) => setTimeout(() => e(!1), 200));
|
|
@@ -455,8 +560,8 @@ var x = (e, t, n) => {
|
|
|
455
560
|
let s = await Promise.race([a, o]);
|
|
456
561
|
i(), s && r();
|
|
457
562
|
};
|
|
458
|
-
function
|
|
459
|
-
let { stores: t, buildPathname: n, driver: r =
|
|
563
|
+
function ie(e) {
|
|
564
|
+
let { stores: t, buildPathname: n, driver: r = h(), markSelfInduced: i = v } = e, s = () => t.history.getState().bumpTruncationEpoch(), c = () => {
|
|
460
565
|
let e = r.readState();
|
|
461
566
|
if (!e?.id) return null;
|
|
462
567
|
let { index: n, histories: i, adoptHistory: a, truncateHistory: o } = t.history.getState();
|
|
@@ -470,172 +575,181 @@ function w(e) {
|
|
|
470
575
|
layoutId: e.layoutId ?? null,
|
|
471
576
|
frameIndex: e.index
|
|
472
577
|
}), e;
|
|
473
|
-
},
|
|
474
|
-
let { status:
|
|
475
|
-
if (
|
|
476
|
-
let
|
|
477
|
-
(await
|
|
578
|
+
}, l = async (e, l, u) => {
|
|
579
|
+
let { status: d } = t.navigate.getState();
|
|
580
|
+
if (d !== "COMPLETED" && d !== "IDLE") return;
|
|
581
|
+
let f = t.transition.getState().defaultTransitionName, { transitionName: p = f, layoutId: m = null } = u ?? {}, h = o.generateTaskId();
|
|
582
|
+
(await o.addTask(async (a) => {
|
|
478
583
|
if (t.life && !t.life.alive) {
|
|
479
584
|
a.abort();
|
|
480
585
|
return;
|
|
481
586
|
}
|
|
482
|
-
let
|
|
483
|
-
if (
|
|
484
|
-
let e =
|
|
587
|
+
let o = c(), { index: d, histories: f, addHistory: g, popHistories: _ } = t.history.getState(), v = (() => {
|
|
588
|
+
if (u?.until != null) {
|
|
589
|
+
let e = O(u.until, d, f);
|
|
485
590
|
return e < 0 ? 0 : e;
|
|
486
591
|
}
|
|
487
|
-
return Math.min(
|
|
488
|
-
})(), { setStatus:
|
|
489
|
-
|
|
490
|
-
let { pathname:
|
|
491
|
-
id:
|
|
492
|
-
pathname:
|
|
493
|
-
params:
|
|
494
|
-
transitionName:
|
|
495
|
-
layoutId:
|
|
496
|
-
},
|
|
497
|
-
if (
|
|
498
|
-
id:
|
|
499
|
-
index:
|
|
592
|
+
return Math.min(k(u?.skip, 0), Math.max(0, d));
|
|
593
|
+
})(), { setStatus: y, setTransitionTaskId: b } = t.navigate.getState();
|
|
594
|
+
y("PUSHING"), b(h);
|
|
595
|
+
let { pathname: x, toPathname: S } = n(e, l ?? {}), C = {
|
|
596
|
+
id: h,
|
|
597
|
+
pathname: S,
|
|
598
|
+
params: l ?? {},
|
|
599
|
+
transitionName: p,
|
|
600
|
+
layoutId: m
|
|
601
|
+
}, w = o?.index ?? f[d]?.frameIndex ?? d;
|
|
602
|
+
if (v === 0) return s(), r.pushState({
|
|
603
|
+
id: h,
|
|
604
|
+
index: w + 1,
|
|
500
605
|
status: "PUSHING",
|
|
501
|
-
params:
|
|
502
|
-
transitionName:
|
|
503
|
-
layoutId:
|
|
504
|
-
},
|
|
505
|
-
...
|
|
506
|
-
frameIndex:
|
|
606
|
+
params: l,
|
|
607
|
+
transitionName: p,
|
|
608
|
+
layoutId: m
|
|
609
|
+
}, x), g({
|
|
610
|
+
...C,
|
|
611
|
+
frameIndex: w + 1
|
|
507
612
|
}), () => {
|
|
508
|
-
|
|
613
|
+
y("COMPLETED");
|
|
509
614
|
};
|
|
510
|
-
let
|
|
511
|
-
return
|
|
512
|
-
...
|
|
513
|
-
frameIndex:
|
|
514
|
-
}), await
|
|
515
|
-
r.pushState({
|
|
516
|
-
id:
|
|
517
|
-
index:
|
|
615
|
+
let T = f[d - v]?.frameIndex ?? d - v;
|
|
616
|
+
return g({
|
|
617
|
+
...C,
|
|
618
|
+
frameIndex: T + 1
|
|
619
|
+
}), await A(r, i, v, () => {
|
|
620
|
+
s(), r.pushState({
|
|
621
|
+
id: h,
|
|
622
|
+
index: T + 1,
|
|
518
623
|
status: "PUSHING",
|
|
519
|
-
params:
|
|
520
|
-
transitionName:
|
|
521
|
-
layoutId:
|
|
522
|
-
},
|
|
624
|
+
params: l,
|
|
625
|
+
transitionName: p,
|
|
626
|
+
layoutId: m
|
|
627
|
+
}, x);
|
|
523
628
|
}), async () => {
|
|
524
|
-
|
|
629
|
+
_(v), y("COMPLETED");
|
|
525
630
|
};
|
|
526
631
|
}, {
|
|
527
|
-
id:
|
|
528
|
-
control: {
|
|
632
|
+
id: h,
|
|
633
|
+
control: {
|
|
634
|
+
manual: !0,
|
|
635
|
+
maxLifetimeMs: a
|
|
636
|
+
}
|
|
529
637
|
})).result?.();
|
|
530
|
-
},
|
|
531
|
-
let { status:
|
|
532
|
-
if (
|
|
533
|
-
let
|
|
534
|
-
(await
|
|
638
|
+
}, u = async (e, l, u) => {
|
|
639
|
+
let { status: d } = t.navigate.getState();
|
|
640
|
+
if (d !== "COMPLETED" && d !== "IDLE") return;
|
|
641
|
+
let f = t.transition.getState().defaultTransitionName, { transitionName: p = f, layoutId: m = null } = u ?? {}, h = o.generateTaskId();
|
|
642
|
+
(await o.addTask(async (a) => {
|
|
535
643
|
if (t.life && !t.life.alive) {
|
|
536
644
|
a.abort();
|
|
537
645
|
return;
|
|
538
646
|
}
|
|
539
|
-
let
|
|
540
|
-
if (
|
|
541
|
-
let e =
|
|
647
|
+
let o = c(), { index: d, histories: f, addHistory: g, replaceHistory: _, popHistories: v } = t.history.getState(), y = (() => {
|
|
648
|
+
if (u?.until != null) {
|
|
649
|
+
let e = O(u.until, d, f);
|
|
542
650
|
return e < 0 ? 0 : e + 1;
|
|
543
651
|
}
|
|
544
|
-
return Math.min(
|
|
652
|
+
return Math.min(k(u?.skip, 0) + 1, d + 1);
|
|
545
653
|
})();
|
|
546
|
-
if (
|
|
654
|
+
if (y <= 0) {
|
|
547
655
|
a.abort();
|
|
548
656
|
return;
|
|
549
657
|
}
|
|
550
|
-
let { setStatus:
|
|
551
|
-
|
|
552
|
-
let { pathname:
|
|
553
|
-
id:
|
|
554
|
-
pathname:
|
|
555
|
-
params:
|
|
556
|
-
transitionName:
|
|
557
|
-
layoutId:
|
|
558
|
-
},
|
|
559
|
-
if (
|
|
560
|
-
id:
|
|
561
|
-
index:
|
|
658
|
+
let { setStatus: b, setTransitionTaskId: x } = t.navigate.getState();
|
|
659
|
+
b("REPLACING"), x(h);
|
|
660
|
+
let { pathname: S, toPathname: C } = n(e, l ?? {}), w = {
|
|
661
|
+
id: h,
|
|
662
|
+
pathname: C,
|
|
663
|
+
params: l ?? {},
|
|
664
|
+
transitionName: p,
|
|
665
|
+
layoutId: m
|
|
666
|
+
}, T = o?.index ?? f[d]?.frameIndex ?? d;
|
|
667
|
+
if (y === 1) return s(), r.replaceState({
|
|
668
|
+
id: h,
|
|
669
|
+
index: T,
|
|
562
670
|
status: "REPLACING",
|
|
563
|
-
params:
|
|
564
|
-
transitionName:
|
|
565
|
-
layoutId:
|
|
566
|
-
},
|
|
567
|
-
...
|
|
568
|
-
frameIndex:
|
|
671
|
+
params: l,
|
|
672
|
+
transitionName: p,
|
|
673
|
+
layoutId: m
|
|
674
|
+
}, S), g({
|
|
675
|
+
...w,
|
|
676
|
+
frameIndex: T
|
|
569
677
|
}), async () => {
|
|
570
|
-
|
|
678
|
+
_(d), b("COMPLETED");
|
|
571
679
|
};
|
|
572
|
-
let
|
|
573
|
-
return
|
|
574
|
-
...
|
|
575
|
-
frameIndex:
|
|
576
|
-
}),
|
|
577
|
-
r.pushState({
|
|
578
|
-
id:
|
|
579
|
-
index:
|
|
680
|
+
let E = y <= d ? (f[d - y]?.frameIndex ?? d - y) + 1 : f[0]?.frameIndex ?? 0;
|
|
681
|
+
return v(y - 1), g({
|
|
682
|
+
...w,
|
|
683
|
+
frameIndex: E
|
|
684
|
+
}), y <= d ? await A(r, i, y, () => {
|
|
685
|
+
s(), r.pushState({
|
|
686
|
+
id: h,
|
|
687
|
+
index: E,
|
|
580
688
|
status: "REPLACING",
|
|
581
|
-
params:
|
|
582
|
-
transitionName:
|
|
583
|
-
layoutId:
|
|
584
|
-
},
|
|
585
|
-
}) : await
|
|
586
|
-
r.replaceState({
|
|
587
|
-
id:
|
|
588
|
-
index:
|
|
689
|
+
params: l,
|
|
690
|
+
transitionName: p,
|
|
691
|
+
layoutId: m
|
|
692
|
+
}, S);
|
|
693
|
+
}) : await A(r, i, d, () => {
|
|
694
|
+
s(), r.replaceState({
|
|
695
|
+
id: h,
|
|
696
|
+
index: E,
|
|
589
697
|
status: "REPLACING",
|
|
590
|
-
params:
|
|
591
|
-
transitionName:
|
|
592
|
-
layoutId:
|
|
593
|
-
},
|
|
698
|
+
params: l,
|
|
699
|
+
transitionName: p,
|
|
700
|
+
layoutId: m
|
|
701
|
+
}, S);
|
|
594
702
|
}), async () => {
|
|
595
|
-
|
|
703
|
+
_(t.history.getState().index - 1), b("COMPLETED");
|
|
596
704
|
};
|
|
597
705
|
}, {
|
|
598
|
-
id:
|
|
599
|
-
control: {
|
|
706
|
+
id: h,
|
|
707
|
+
control: {
|
|
708
|
+
manual: !0,
|
|
709
|
+
maxLifetimeMs: a
|
|
710
|
+
}
|
|
600
711
|
})).result?.();
|
|
601
|
-
},
|
|
602
|
-
let s =
|
|
603
|
-
(await
|
|
712
|
+
}, d = async (e, n) => {
|
|
713
|
+
let s = o.generateTaskId();
|
|
714
|
+
(await o.addTask(async (a) => {
|
|
604
715
|
if (t.life && !t.life.alive) {
|
|
605
716
|
a.abort();
|
|
606
717
|
return;
|
|
607
718
|
}
|
|
608
|
-
|
|
609
|
-
let { index:
|
|
610
|
-
if (
|
|
719
|
+
c();
|
|
720
|
+
let { index: o, histories: l, popHistory: u, popHistories: d, setPendingIndex: f, setTransitionName: p } = t.history.getState();
|
|
721
|
+
if (o <= 0) {
|
|
611
722
|
a.abort();
|
|
612
723
|
return;
|
|
613
724
|
}
|
|
614
|
-
let m = Math.min(e(
|
|
725
|
+
let m = Math.min(e(o, l), o);
|
|
615
726
|
if (m <= 0) {
|
|
616
727
|
a.abort();
|
|
617
728
|
return;
|
|
618
729
|
}
|
|
619
|
-
f(
|
|
730
|
+
f(o - m);
|
|
620
731
|
let { setStatus: h, setTransitionTaskId: g } = t.navigate.getState();
|
|
621
|
-
return n && p(
|
|
732
|
+
return n && p(o, n), h("POPPING"), g(s), d(m - 1), i(), m === 1 ? r.back() : r.go(-m), async () => {
|
|
622
733
|
u(t.history.getState().index), h("COMPLETED");
|
|
623
734
|
};
|
|
624
735
|
}, {
|
|
625
736
|
id: s,
|
|
626
|
-
control: {
|
|
737
|
+
control: {
|
|
738
|
+
manual: !0,
|
|
739
|
+
maxLifetimeMs: a
|
|
740
|
+
}
|
|
627
741
|
})).result?.();
|
|
628
742
|
};
|
|
629
743
|
return {
|
|
630
|
-
push:
|
|
631
|
-
replace:
|
|
744
|
+
push: l,
|
|
745
|
+
replace: u,
|
|
632
746
|
pop: async (e) => {
|
|
633
|
-
await
|
|
747
|
+
await d((t, n) => {
|
|
634
748
|
if (e?.until != null) {
|
|
635
|
-
let r =
|
|
749
|
+
let r = O(e.until, t, n);
|
|
636
750
|
return r < 0 ? 0 : r;
|
|
637
751
|
}
|
|
638
|
-
let r =
|
|
752
|
+
let r = k(e?.skip, 1);
|
|
639
753
|
return r <= 0 ? 0 : Math.min(r, t);
|
|
640
754
|
}, e?.transitionName);
|
|
641
755
|
}
|
|
@@ -643,18 +757,18 @@ function w(e) {
|
|
|
643
757
|
}
|
|
644
758
|
//#endregion
|
|
645
759
|
//#region src/navigate/createStepController.ts
|
|
646
|
-
var
|
|
760
|
+
var ae = (e) => {
|
|
647
761
|
let t = e;
|
|
648
762
|
return t?.step ? t.params ?? {} : null;
|
|
649
|
-
},
|
|
763
|
+
}, oe = (e, t) => {
|
|
650
764
|
let n = new URLSearchParams(Object.fromEntries(Object.entries(t).map(([e, t]) => [e, String(t)]))).toString();
|
|
651
765
|
return n ? `${e}?${n}` : e;
|
|
652
766
|
};
|
|
653
|
-
function
|
|
654
|
-
let { stores: t, driver: n, markSelfInduced: r, buildStepPathname: i, applyParams:
|
|
767
|
+
function se(e) {
|
|
768
|
+
let { stores: t, driver: n, markSelfInduced: r, buildStepPathname: i, applyParams: s } = e;
|
|
655
769
|
return {
|
|
656
770
|
pushStep: async (e) => {
|
|
657
|
-
(await
|
|
771
|
+
(await o.addTask(async () => {
|
|
658
772
|
let t = i(e), r = n.readState();
|
|
659
773
|
return r?.step || n.replaceState({
|
|
660
774
|
...r,
|
|
@@ -663,35 +777,35 @@ function D(e) {
|
|
|
663
777
|
...n.readState(),
|
|
664
778
|
step: !0,
|
|
665
779
|
params: e
|
|
666
|
-
}, t), async () =>
|
|
780
|
+
}, t), async () => s(e);
|
|
667
781
|
})).result?.();
|
|
668
782
|
},
|
|
669
783
|
replaceStep: async (e) => {
|
|
670
|
-
(await
|
|
784
|
+
(await o.addTask(async () => {
|
|
671
785
|
let t = i(e);
|
|
672
786
|
return n.replaceState({
|
|
673
787
|
...n.readState(),
|
|
674
788
|
step: !0,
|
|
675
789
|
params: e
|
|
676
|
-
}, t), async () =>
|
|
790
|
+
}, t), async () => s(e);
|
|
677
791
|
})).result?.();
|
|
678
792
|
},
|
|
679
793
|
popStep: async () => {
|
|
680
|
-
let e =
|
|
681
|
-
(await
|
|
794
|
+
let e = o.generateTaskId();
|
|
795
|
+
(await o.addTask(async (i) => {
|
|
682
796
|
let a = new Promise((e) => {
|
|
683
797
|
let t = n.subscribe((n) => {
|
|
684
798
|
t(), e(n.state);
|
|
685
799
|
});
|
|
686
|
-
}),
|
|
800
|
+
}), o = new Promise((e) => setTimeout(() => e(void 0), 200));
|
|
687
801
|
r(), n.back();
|
|
688
|
-
let c = await Promise.race([a,
|
|
802
|
+
let c = await Promise.race([a, o]);
|
|
689
803
|
if (!c) {
|
|
690
804
|
i.abort();
|
|
691
805
|
return;
|
|
692
806
|
}
|
|
693
807
|
if (c.step) {
|
|
694
|
-
|
|
808
|
+
s(c.params ?? {}), i.abort();
|
|
695
809
|
return;
|
|
696
810
|
}
|
|
697
811
|
let { setStatus: l, setTransitionTaskId: u } = t.navigate.getState(), { index: d, popHistory: f } = t.history.getState();
|
|
@@ -700,30 +814,38 @@ function D(e) {
|
|
|
700
814
|
};
|
|
701
815
|
}, {
|
|
702
816
|
id: e,
|
|
703
|
-
control: {
|
|
817
|
+
control: {
|
|
818
|
+
manual: !0,
|
|
819
|
+
maxLifetimeMs: a
|
|
820
|
+
}
|
|
704
821
|
})).result?.();
|
|
705
822
|
}
|
|
706
823
|
};
|
|
707
824
|
}
|
|
708
|
-
function
|
|
825
|
+
function ce(e, t) {
|
|
709
826
|
return e.subscribe((e) => {
|
|
710
827
|
let n = e.state;
|
|
711
|
-
n?.step &&
|
|
828
|
+
n?.step && o.addTask(async () => {
|
|
712
829
|
t(n.params ?? {});
|
|
713
830
|
});
|
|
714
831
|
});
|
|
715
832
|
}
|
|
716
833
|
//#endregion
|
|
717
834
|
//#region src/transition/store.ts
|
|
718
|
-
function
|
|
835
|
+
function le(t = "cupertino") {
|
|
719
836
|
return e((e) => ({
|
|
720
837
|
defaultTransitionName: t,
|
|
721
838
|
setDefaultTransitionName: (t) => e({ defaultTransitionName: t })
|
|
722
839
|
}));
|
|
723
840
|
}
|
|
724
841
|
//#endregion
|
|
842
|
+
//#region src/utils/matchesPathname.ts
|
|
843
|
+
function ue(e, t) {
|
|
844
|
+
return i(e).regexp.test(t);
|
|
845
|
+
}
|
|
846
|
+
//#endregion
|
|
725
847
|
//#region src/screen/store.ts
|
|
726
|
-
function
|
|
848
|
+
function de() {
|
|
727
849
|
return e((e) => ({
|
|
728
850
|
dragStatus: "IDLE",
|
|
729
851
|
replaceTransitionStatus: "IDLE",
|
|
@@ -754,44 +876,62 @@ function k() {
|
|
|
754
876
|
}
|
|
755
877
|
//#endregion
|
|
756
878
|
//#region src/core/createRouterScope.ts
|
|
757
|
-
var
|
|
879
|
+
var fe = {
|
|
758
880
|
mark: () => {},
|
|
759
881
|
consume: () => !1
|
|
760
|
-
};
|
|
761
|
-
function
|
|
762
|
-
let { routePaths: t, pathname: n, search: r, defaultTransitionName: i, memory: a, browserDriver:
|
|
763
|
-
|
|
764
|
-
|
|
882
|
+
}, pe = /* @__PURE__ */ new Map();
|
|
883
|
+
function me(e) {
|
|
884
|
+
let { routePaths: t, pathname: n, search: r, defaultTransitionName: i, memory: a, browserDriver: o } = e, c = d() ? void 0 : e.persistKey;
|
|
885
|
+
if (c) {
|
|
886
|
+
let e = pe.get(c);
|
|
887
|
+
if (e) {
|
|
888
|
+
e.life.alive = !0, e.navigate.getState().setStatus("IDLE"), e.navigate.getState().setTransitionTaskId(null);
|
|
889
|
+
let t = e.history.getState();
|
|
890
|
+
return t.setPendingIndex(t.index), e;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
let l = u(t, n, r, i), f = (e.routerKey && !d() ? E(e.routerKey, n) : null) ?? (o && !d() ? o.readState() : null), p = f?.id ? {
|
|
894
|
+
...l,
|
|
895
|
+
id: f.id,
|
|
896
|
+
params: f.params ?? l.params,
|
|
897
|
+
frameIndex: f.index ?? 0
|
|
898
|
+
} : {
|
|
899
|
+
...l,
|
|
900
|
+
frameIndex: 0
|
|
765
901
|
};
|
|
766
902
|
if (e.hostedScope) return e.hostedScope.life.alive = !0, e.hostedScope.history.getState().index === -1 && e.hostedScope.history.setState({
|
|
767
903
|
index: 0,
|
|
768
|
-
histories: [
|
|
904
|
+
histories: [p]
|
|
769
905
|
}), e.hostedScope;
|
|
770
|
-
let
|
|
906
|
+
let m = a ? ne({
|
|
771
907
|
state: {
|
|
772
|
-
id:
|
|
908
|
+
id: p.id,
|
|
773
909
|
index: 0,
|
|
774
910
|
status: "IDLE",
|
|
775
|
-
params:
|
|
776
|
-
transitionName:
|
|
777
|
-
layoutId:
|
|
911
|
+
params: p.params,
|
|
912
|
+
transitionName: p.transitionName,
|
|
913
|
+
layoutId: p.layoutId
|
|
778
914
|
},
|
|
779
|
-
url:
|
|
780
|
-
}) :
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
driver: p,
|
|
915
|
+
url: p.pathname
|
|
916
|
+
}) : o, h = a ? fe : g(), _ = {
|
|
917
|
+
history: s([p], 0),
|
|
918
|
+
navigate: re(),
|
|
919
|
+
transition: le(i),
|
|
920
|
+
screen: de(),
|
|
921
|
+
driver: m,
|
|
787
922
|
markSelfInduced: h.mark,
|
|
788
923
|
consume: h.consume,
|
|
924
|
+
routerKey: e.routerKey,
|
|
925
|
+
zoneEntryId: e.zoneEntryId,
|
|
926
|
+
ownsPathname: (e) => ue(t, e),
|
|
927
|
+
persistent: !!c,
|
|
789
928
|
life: { alive: !0 }
|
|
790
929
|
};
|
|
930
|
+
return c && pe.set(c, _), _;
|
|
791
931
|
}
|
|
792
932
|
//#endregion
|
|
793
933
|
//#region src/screen/createScreenSelector.ts
|
|
794
|
-
function
|
|
934
|
+
function he(e, t) {
|
|
795
935
|
return e.map((n, r) => ({
|
|
796
936
|
...n,
|
|
797
937
|
isActive: r === t,
|
|
@@ -804,13 +944,13 @@ function re(e, t) {
|
|
|
804
944
|
}
|
|
805
945
|
//#endregion
|
|
806
946
|
//#region src/screen/computeScreenFreeze.ts
|
|
807
|
-
function
|
|
947
|
+
function ge(e) {
|
|
808
948
|
let t = e.status === "COMPLETED" && e.dragStatus === "IDLE";
|
|
809
949
|
return !e.isActive && t || e.isPrev && e.index - 2 <= e.zIndex && e.replaceTransitionStatus === "IDLE" || e.isPrev && e.index - 2 > e.zIndex;
|
|
810
950
|
}
|
|
811
951
|
//#endregion
|
|
812
952
|
//#region src/transition/createTransition.ts
|
|
813
|
-
function
|
|
953
|
+
function j({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exitBack: o, options: s }) {
|
|
814
954
|
return {
|
|
815
955
|
name: e,
|
|
816
956
|
initial: t,
|
|
@@ -831,7 +971,7 @@ function A({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exit
|
|
|
831
971
|
}
|
|
832
972
|
//#endregion
|
|
833
973
|
//#region src/transition/createRawTransition.ts
|
|
834
|
-
function
|
|
974
|
+
function _e({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnExit: l, completedOnEnter: u, options: d }) {
|
|
835
975
|
return {
|
|
836
976
|
name: e,
|
|
837
977
|
initial: t,
|
|
@@ -852,10 +992,10 @@ function ae({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
852
992
|
}
|
|
853
993
|
//#endregion
|
|
854
994
|
//#region src/transition/cupertino.ts
|
|
855
|
-
var
|
|
995
|
+
var ve = (e, t, n) => {
|
|
856
996
|
let [r, i] = t, [a, o] = n;
|
|
857
997
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
858
|
-
},
|
|
998
|
+
}, ye = j({
|
|
859
999
|
name: "cupertino",
|
|
860
1000
|
initial: { x: "100%" },
|
|
861
1001
|
idle: {
|
|
@@ -915,7 +1055,7 @@ var oe = (e, t, n) => {
|
|
|
915
1055
|
swipeDirection: "x",
|
|
916
1056
|
onSwipeStart: async () => !0,
|
|
917
1057
|
onSwipe: (e, t, { animate: n, currentScreen: r, prevScreen: i, onProgress: a }) => {
|
|
918
|
-
let { offset: o } = t, s = o.x, c =
|
|
1058
|
+
let { offset: o } = t, s = o.x, c = ve(s, [0, window.innerWidth], [0, 100]);
|
|
919
1059
|
return a?.(!0, c), n(r, { x: Math.max(0, s) }, { duration: 0 }), n(i, { x: `${-30 + c * .3}%` }, { duration: 0 }), c;
|
|
920
1060
|
},
|
|
921
1061
|
onSwipeEnd: async (e, t, { animate: n, currentScreen: r, prevScreen: i, onStart: a }) => {
|
|
@@ -939,10 +1079,10 @@ var oe = (e, t, n) => {
|
|
|
939
1079
|
})]), c;
|
|
940
1080
|
}
|
|
941
1081
|
}
|
|
942
|
-
}),
|
|
1082
|
+
}), be = (e, t, n) => {
|
|
943
1083
|
let [r, i] = t, [a, o] = n;
|
|
944
1084
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
945
|
-
},
|
|
1085
|
+
}, xe = j({
|
|
946
1086
|
name: "layout",
|
|
947
1087
|
initial: { opacity: .97 },
|
|
948
1088
|
idle: {
|
|
@@ -970,7 +1110,7 @@ var oe = (e, t, n) => {
|
|
|
970
1110
|
swipeDirection: "y",
|
|
971
1111
|
onSwipeStart: async () => !0,
|
|
972
1112
|
onSwipe: (e, t, { animate: n, currentScreen: r, onProgress: i }) => {
|
|
973
|
-
let { offset: a } = t, o = a.y, s = Math.max(0, Math.min(56, o)), c =
|
|
1113
|
+
let { offset: a } = t, o = a.y, s = Math.max(0, Math.min(56, o)), c = be(s, [0, 56], [1, .96]), l = Math.max(0, o - 56), u = Math.min(1, l / 160), d = Math.sqrt(u) * 12, f = Math.max(0, s + d), p = Math.min(56, f);
|
|
974
1114
|
return i?.(!0, 100), n(r, {
|
|
975
1115
|
y: f,
|
|
976
1116
|
opacity: c
|
|
@@ -987,7 +1127,7 @@ var oe = (e, t, n) => {
|
|
|
987
1127
|
}, { duration: .3 })]), c;
|
|
988
1128
|
}
|
|
989
1129
|
}
|
|
990
|
-
}),
|
|
1130
|
+
}), Se = j({
|
|
991
1131
|
name: "material",
|
|
992
1132
|
initial: { y: "100%" },
|
|
993
1133
|
idle: {
|
|
@@ -1095,7 +1235,7 @@ var oe = (e, t, n) => {
|
|
|
1095
1235
|
})]), c;
|
|
1096
1236
|
}
|
|
1097
1237
|
}
|
|
1098
|
-
}),
|
|
1238
|
+
}), Ce = j({
|
|
1099
1239
|
name: "none",
|
|
1100
1240
|
initial: {},
|
|
1101
1241
|
idle: {
|
|
@@ -1119,19 +1259,19 @@ var oe = (e, t, n) => {
|
|
|
1119
1259
|
options: { duration: 0 }
|
|
1120
1260
|
}
|
|
1121
1261
|
}), M = new Map([
|
|
1122
|
-
["none",
|
|
1123
|
-
["cupertino",
|
|
1124
|
-
["material",
|
|
1125
|
-
["layout",
|
|
1262
|
+
["none", Ce],
|
|
1263
|
+
["cupertino", ye],
|
|
1264
|
+
["material", Se],
|
|
1265
|
+
["layout", xe]
|
|
1126
1266
|
]);
|
|
1127
1267
|
//#endregion
|
|
1128
1268
|
//#region src/transition/resolveTransition.ts
|
|
1129
|
-
function
|
|
1269
|
+
function we(e) {
|
|
1130
1270
|
return M.get(e) ?? M.get("none");
|
|
1131
1271
|
}
|
|
1132
1272
|
//#endregion
|
|
1133
1273
|
//#region src/transition/decorator/createDecorator.ts
|
|
1134
|
-
function
|
|
1274
|
+
function Te({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
1135
1275
|
return {
|
|
1136
1276
|
name: e,
|
|
1137
1277
|
initial: t,
|
|
@@ -1152,7 +1292,7 @@ function N({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
|
1152
1292
|
}
|
|
1153
1293
|
//#endregion
|
|
1154
1294
|
//#region src/transition/decorator/createRawDecorator.ts
|
|
1155
|
-
function
|
|
1295
|
+
function Ee({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnEnter: l, completedOnExit: u, options: d }) {
|
|
1156
1296
|
return {
|
|
1157
1297
|
name: e,
|
|
1158
1298
|
initial: t,
|
|
@@ -1173,30 +1313,30 @@ function fe({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
1173
1313
|
}
|
|
1174
1314
|
//#endregion
|
|
1175
1315
|
//#region src/transition/decorator/overlay.ts
|
|
1176
|
-
var
|
|
1316
|
+
var N = "rgba(0, 0, 0, 0.3)", De = Te({
|
|
1177
1317
|
name: "overlay",
|
|
1178
1318
|
initial: {
|
|
1179
1319
|
opacity: 0,
|
|
1180
|
-
backgroundColor:
|
|
1320
|
+
backgroundColor: N
|
|
1181
1321
|
},
|
|
1182
1322
|
idle: {
|
|
1183
1323
|
value: {
|
|
1184
1324
|
opacity: 0,
|
|
1185
|
-
backgroundColor:
|
|
1325
|
+
backgroundColor: N
|
|
1186
1326
|
},
|
|
1187
1327
|
options: { duration: 0 }
|
|
1188
1328
|
},
|
|
1189
1329
|
enter: {
|
|
1190
1330
|
value: {
|
|
1191
1331
|
opacity: 1,
|
|
1192
|
-
backgroundColor:
|
|
1332
|
+
backgroundColor: N
|
|
1193
1333
|
},
|
|
1194
1334
|
options: { duration: .7 }
|
|
1195
1335
|
},
|
|
1196
1336
|
exit: {
|
|
1197
1337
|
value: {
|
|
1198
1338
|
opacity: 0,
|
|
1199
|
-
backgroundColor:
|
|
1339
|
+
backgroundColor: N
|
|
1200
1340
|
},
|
|
1201
1341
|
options: { duration: .6 }
|
|
1202
1342
|
},
|
|
@@ -1205,10 +1345,10 @@ var P = "rgba(0, 0, 0, 0.3)", pe = N({
|
|
|
1205
1345
|
onSwipe: (e, t, { animate: n, prevDecorator: r }) => n(r, { opacity: Math.max(0, 1 - t / 100) }, { duration: 0 }),
|
|
1206
1346
|
onSwipeEnd: (e, { animate: t, prevDecorator: n }) => t(n, { opacity: +!e }, { duration: .3 })
|
|
1207
1347
|
}
|
|
1208
|
-
}),
|
|
1348
|
+
}), P = new Map([["overlay", De]]);
|
|
1209
1349
|
//#endregion
|
|
1210
1350
|
//#region src/transition/partTransition/createPartTransition.ts
|
|
1211
|
-
function
|
|
1351
|
+
function Oe({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
1212
1352
|
return {
|
|
1213
1353
|
name: e,
|
|
1214
1354
|
initial: t,
|
|
@@ -1229,7 +1369,7 @@ function me({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
|
1229
1369
|
}
|
|
1230
1370
|
//#endregion
|
|
1231
1371
|
//#region src/transition/partTransition/createRawPartTransition.ts
|
|
1232
|
-
function
|
|
1372
|
+
function ke({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnEnter: l, completedOnExit: u, options: d }) {
|
|
1233
1373
|
return {
|
|
1234
1374
|
name: e,
|
|
1235
1375
|
initial: t,
|
|
@@ -1250,7 +1390,7 @@ function he({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
1250
1390
|
}
|
|
1251
1391
|
//#endregion
|
|
1252
1392
|
//#region src/transition/partTransition/partTransition.ts
|
|
1253
|
-
var
|
|
1393
|
+
var F = /* @__PURE__ */ new Map(), I = {
|
|
1254
1394
|
"IDLE-true": "self",
|
|
1255
1395
|
"IDLE-false": "self",
|
|
1256
1396
|
"PUSHING-true": "initial",
|
|
@@ -1261,7 +1401,7 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1261
1401
|
"POPPING-false": "PUSHING-false",
|
|
1262
1402
|
"COMPLETED-true": "self",
|
|
1263
1403
|
"COMPLETED-false": "self"
|
|
1264
|
-
},
|
|
1404
|
+
}, Ae = Object.keys(I), je = Ae, Me = (e) => e.replace(/[^a-zA-Z0-9_-]/g, "_"), Ne = (e) => typeof e == "object" && !!e && !Array.isArray(e), Pe = new Set(/* @__PURE__ */ "opacity.scale.scaleX.scaleY.scaleZ.aspectRatio.columnCount.columns.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineHeight.lineClamp.order.orphans.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeWidth".split(".")), Fe = (e, t) => t.startsWith("--") || Pe.has(t) ? `${e}` : t === "rotate" || t === "rotateX" || t === "rotateY" || t === "rotateZ" ? `${e}deg` : `${e}px`, Ie = (e, t) => typeof t == "number" ? Fe(t, e) : typeof t == "string" ? t : "", Le = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), Re = new Set([
|
|
1265
1405
|
"x",
|
|
1266
1406
|
"y",
|
|
1267
1407
|
"z",
|
|
@@ -1272,7 +1412,7 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1272
1412
|
"rotateX",
|
|
1273
1413
|
"rotateY",
|
|
1274
1414
|
"rotateZ"
|
|
1275
|
-
]),
|
|
1415
|
+
]), ze = /^-?0(\.0+)?(px|%|em|rem|vh|vw|vmin|vmax)?$/, Be = /^-?0(\.0+)?(deg|rad|grad|turn)?$/, Ve = /^1(\.0+)?$/, He = (e, t) => e === "scale" || e === "scaleX" || e === "scaleY" ? t === 1 ? !0 : typeof t == "string" ? Ve.test(t.trim()) : !1 : e === "rotate" || e === "rotateX" || e === "rotateY" || e === "rotateZ" ? t === 0 ? !0 : typeof t == "string" ? Be.test(t.trim()) : !1 : t === 0 ? !0 : typeof t == "string" ? ze.test(t.trim()) : !1, Ue = (e, t) => {
|
|
1276
1416
|
switch (e) {
|
|
1277
1417
|
case "x": return `translateX(${t})`;
|
|
1278
1418
|
case "y": return `translateY(${t})`;
|
|
@@ -1286,23 +1426,23 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1286
1426
|
case "rotateY": return `rotateY(${t})`;
|
|
1287
1427
|
default: return "";
|
|
1288
1428
|
}
|
|
1289
|
-
},
|
|
1429
|
+
}, We = (e) => {
|
|
1290
1430
|
let t = /* @__PURE__ */ new Set(), n = !1, r = (e) => {
|
|
1291
|
-
if (
|
|
1431
|
+
if (Ne(e)) for (let r of Object.keys(e)) {
|
|
1292
1432
|
let i = e[r];
|
|
1293
|
-
|
|
1433
|
+
Ie(r, i) !== "" && (Re.has(r) ? n = !0 : t.add(Le(r)));
|
|
1294
1434
|
}
|
|
1295
1435
|
};
|
|
1296
1436
|
r(e.initial);
|
|
1297
1437
|
for (let t of Object.values(e.variants)) r(t.value);
|
|
1298
1438
|
return n && t.add("transform"), Array.from(t);
|
|
1299
|
-
},
|
|
1300
|
-
if (!
|
|
1439
|
+
}, L = (e) => {
|
|
1440
|
+
if (!Ne(e)) return [];
|
|
1301
1441
|
let t = [], n = !0, r = [];
|
|
1302
1442
|
for (let i of Object.keys(e)) {
|
|
1303
|
-
let a = e[i], o =
|
|
1304
|
-
o !== "" && (
|
|
1305
|
-
property:
|
|
1443
|
+
let a = e[i], o = Ie(i, a);
|
|
1444
|
+
o !== "" && (Re.has(i) ? (t.push(Ue(i, o)), He(i, a) || (n = !1)) : r.push({
|
|
1445
|
+
property: Le(i),
|
|
1306
1446
|
value: o
|
|
1307
1447
|
}));
|
|
1308
1448
|
}
|
|
@@ -1310,7 +1450,7 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1310
1450
|
property: "transform",
|
|
1311
1451
|
value: n ? "none" : t.join(" ")
|
|
1312
1452
|
}), r;
|
|
1313
|
-
},
|
|
1453
|
+
}, R = (e) => e.map((e) => ` ${e.property}: ${e.value};`).join("\n"), z = (e) => Array.isArray(e) ? e.length === 4 && e.every((e) => typeof e == "number") ? `cubic-bezier(${e.join(", ")})` : "linear" : typeof e == "string" ? {
|
|
1314
1454
|
linear: "linear",
|
|
1315
1455
|
easeIn: "ease-in",
|
|
1316
1456
|
easeOut: "ease-out",
|
|
@@ -1320,33 +1460,33 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1320
1460
|
backIn: "cubic-bezier(0.31, 0.01, 0.66, -0.59)",
|
|
1321
1461
|
backOut: "cubic-bezier(0.33, 1.53, 0.69, 0.99)",
|
|
1322
1462
|
anticipate: "cubic-bezier(0.36, 0, 0.66, -0.56)"
|
|
1323
|
-
}[e] ?? "ease" : "ease",
|
|
1463
|
+
}[e] ?? "ease" : "ease", Ge = (e) => {
|
|
1324
1464
|
if (!e) return 0;
|
|
1325
1465
|
let t = e.duration;
|
|
1326
1466
|
return typeof t == "number" && t >= 0 ? t : 0;
|
|
1327
|
-
},
|
|
1467
|
+
}, Ke = (e) => e && typeof e.delay == "number" && e.delay > 0 ? e.delay : 0, qe = (e, t) => {
|
|
1328
1468
|
let [n, r] = t.split("-");
|
|
1329
1469
|
return `[data-flemo-screen][data-flemo-transition="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1330
|
-
},
|
|
1470
|
+
}, Je = (e, t) => {
|
|
1331
1471
|
let [n, r] = t.split("-");
|
|
1332
1472
|
return `[data-flemo-decorator][data-flemo-decorator-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1333
|
-
},
|
|
1473
|
+
}, Ye = (e, t) => {
|
|
1334
1474
|
let [n, r] = t.split("-");
|
|
1335
1475
|
return `[data-flemo-bar][data-flemo-bar-transition="${e}"][data-flemo-bar-status="${n}"][data-flemo-bar-active="${r}"][data-flemo-bar-riding="true"]`;
|
|
1336
|
-
},
|
|
1476
|
+
}, Xe = (e, t) => {
|
|
1337
1477
|
let [n, r] = t.split("-");
|
|
1338
1478
|
return `[data-flemo-part-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1339
|
-
},
|
|
1340
|
-
let o =
|
|
1479
|
+
}, B = (e, t, n) => `flemo-${e}-${Me(t)}-${n}`, V = (e, t, n, r, i, a) => {
|
|
1480
|
+
let o = L(r), s = L(i.value), c = Ge(i.options), l = Ke(i.options), u = z(i.options?.ease), d = a(t, n), f = e === "screen" ? `${d},\n${Ye(t, n)}` : d;
|
|
1341
1481
|
if (s.length === 0 && o.length === 0) return "";
|
|
1342
|
-
if (c <= 0 && l <= 0) return s.length === 0 ? "" : `${f} {\n${
|
|
1343
|
-
let p =
|
|
1482
|
+
if (c <= 0 && l <= 0) return s.length === 0 ? "" : `${f} {\n${R(s)}\n animation: none;\n}`;
|
|
1483
|
+
let p = B(e, t, n), m = [
|
|
1344
1484
|
`@keyframes ${p} {`,
|
|
1345
1485
|
" from {",
|
|
1346
|
-
|
|
1486
|
+
R(o).replace(/^/gm, " "),
|
|
1347
1487
|
" }",
|
|
1348
1488
|
" to {",
|
|
1349
|
-
|
|
1489
|
+
R(s).replace(/^/gm, " "),
|
|
1350
1490
|
" }",
|
|
1351
1491
|
"}"
|
|
1352
1492
|
].join("\n"), h = [
|
|
@@ -1356,90 +1496,96 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1356
1496
|
l > 0 ? `${l}s` : null,
|
|
1357
1497
|
"both"
|
|
1358
1498
|
].filter(Boolean).join(" "), g = Array.from(new Set([...o.map((e) => e.property), ...s.map((e) => e.property)])), _ = g.length > 0 ? ` will-change: ${g.join(", ")};\n` : "", v = n.split("-")[0];
|
|
1359
|
-
return `${m}\n${`${f} {\n animation: ${h};\n${_}${v === "PUSHING" || v === "REPLACING" ? " contain: layout;\n pointer-events: none;\n" : ""}}`}${e === "screen" && n.endsWith("-false") &&
|
|
1360
|
-
},
|
|
1499
|
+
return `${m}\n${`${f} {\n animation: ${h};\n${_}${v === "PUSHING" || v === "REPLACING" ? " contain: layout;\n pointer-events: none;\n" : ""}}`}${e === "screen" && n.endsWith("-false") && Ze(r) && s.length > 0 ? `\n${d}[data-flemo-anim-hold="park"] {\n animation: none;\n${R(s)}\n}` : ""}`;
|
|
1500
|
+
}, Ze = (e) => {
|
|
1361
1501
|
if (!e) return !1;
|
|
1362
1502
|
if (e.opacity === 0) return !0;
|
|
1363
1503
|
let t = (e) => typeof e == "string" && e.trim().endsWith("%") && Math.abs(parseFloat(e)) >= 100;
|
|
1364
1504
|
return t(e.x) || t(e.y);
|
|
1365
|
-
},
|
|
1366
|
-
let i =
|
|
1367
|
-
return i.length === 0 ? "" : `${e(t, n)} {\n${
|
|
1368
|
-
},
|
|
1505
|
+
}, H = (e, t, n, r) => {
|
|
1506
|
+
let i = L(r.value);
|
|
1507
|
+
return i.length === 0 ? "" : `${e(t, n)} {\n${R(i)}\n}`;
|
|
1508
|
+
}, Qe = (e, t, n = []) => {
|
|
1369
1509
|
let r = [];
|
|
1370
1510
|
for (let t of e) {
|
|
1371
1511
|
let e = t.name;
|
|
1372
|
-
for (let n of
|
|
1373
|
-
let i = t.variants[n], a =
|
|
1512
|
+
for (let n of Ae) {
|
|
1513
|
+
let i = t.variants[n], a = I[n];
|
|
1374
1514
|
if (a === "self") {
|
|
1375
|
-
r.push(
|
|
1515
|
+
r.push(H(qe, e, n, i));
|
|
1376
1516
|
continue;
|
|
1377
1517
|
}
|
|
1378
1518
|
let o = a === "initial" ? t.initial : t.variants[a].value;
|
|
1379
|
-
r.push(
|
|
1519
|
+
r.push(V("screen", e, n, o, i, qe));
|
|
1380
1520
|
}
|
|
1381
1521
|
}
|
|
1382
1522
|
for (let e of t) {
|
|
1383
1523
|
let t = e.name;
|
|
1384
|
-
for (let n of
|
|
1385
|
-
let i = e.variants[n], a =
|
|
1524
|
+
for (let n of je) {
|
|
1525
|
+
let i = e.variants[n], a = I[n];
|
|
1386
1526
|
if (a === "self") {
|
|
1387
|
-
r.push(
|
|
1527
|
+
r.push(H(Je, t, n, i));
|
|
1388
1528
|
continue;
|
|
1389
1529
|
}
|
|
1390
1530
|
let o = a === "initial" ? e.initial : e.variants[a].value;
|
|
1391
|
-
r.push(
|
|
1531
|
+
r.push(V("decorator", t, n, o, i, Je));
|
|
1392
1532
|
}
|
|
1393
1533
|
}
|
|
1394
1534
|
for (let e of n) {
|
|
1395
1535
|
let t = e.name;
|
|
1396
|
-
for (let n of
|
|
1397
|
-
let i = e.variants[n], a =
|
|
1536
|
+
for (let n of je) {
|
|
1537
|
+
let i = e.variants[n], a = I[n];
|
|
1398
1538
|
if (a === "self") {
|
|
1399
|
-
r.push(
|
|
1539
|
+
r.push(H(Xe, t, n, i));
|
|
1400
1540
|
continue;
|
|
1401
1541
|
}
|
|
1402
1542
|
let o = a === "initial" ? e.initial : e.variants[a].value;
|
|
1403
|
-
r.push(
|
|
1543
|
+
r.push(V("part", t, n, o, i, Xe));
|
|
1404
1544
|
}
|
|
1405
1545
|
}
|
|
1406
|
-
return [...r.filter((e) => e.length > 0),
|
|
1407
|
-
},
|
|
1546
|
+
return [...r.filter((e) => e.length > 0), $e].join("\n\n");
|
|
1547
|
+
}, $e = [
|
|
1408
1548
|
"[data-flemo-anim-hold=\"true\"],",
|
|
1409
1549
|
"[data-flemo-anim-hold=\"park\"],",
|
|
1410
1550
|
"[data-flemo-anim-hold=\"true\"] [data-flemo-part-name],",
|
|
1411
1551
|
"[data-flemo-anim-hold=\"park\"] [data-flemo-part-name] {",
|
|
1412
1552
|
" animation-play-state: paused !important;",
|
|
1413
1553
|
"}"
|
|
1414
|
-
].join("\n"),
|
|
1415
|
-
let n =
|
|
1554
|
+
].join("\n"), et = (e, t) => {
|
|
1555
|
+
let n = I[t];
|
|
1416
1556
|
if (n === "self") return !1;
|
|
1417
|
-
let r = e.variants[t], i =
|
|
1557
|
+
let r = e.variants[t], i = Ge(r.options), a = Ke(r.options);
|
|
1418
1558
|
if (i <= 0 && a <= 0) return !1;
|
|
1419
|
-
let o =
|
|
1559
|
+
let o = L(n === "initial" ? e.initial : e.variants[n].value), s = L(r.value);
|
|
1420
1560
|
return o.length > 0 || s.length > 0;
|
|
1421
|
-
},
|
|
1422
|
-
function
|
|
1423
|
-
if (
|
|
1424
|
-
let e =
|
|
1425
|
-
t || (t = document.createElement("style"), t.setAttribute(
|
|
1561
|
+
}, tt = "data-flemo";
|
|
1562
|
+
function U() {
|
|
1563
|
+
if (d()) return;
|
|
1564
|
+
let e = Qe(M.values(), P.values(), F.values()), t = document.head.querySelector(`style[${tt}]`);
|
|
1565
|
+
t || (t = document.createElement("style"), t.setAttribute(tt, ""), document.head.appendChild(t)), t.textContent !== e && (t.textContent = e);
|
|
1426
1566
|
}
|
|
1427
1567
|
//#endregion
|
|
1428
1568
|
//#region src/transition/registerTransitionDefinitions.ts
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
return
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1569
|
+
var nt = /* @__PURE__ */ new Map(), rt = /* @__PURE__ */ new Map(), it = /* @__PURE__ */ new Map(), W = (e, t) => {
|
|
1570
|
+
e.set(t, (e.get(t) ?? 0) + 1);
|
|
1571
|
+
}, G = (e, t) => {
|
|
1572
|
+
let n = (e.get(t) ?? 1) - 1;
|
|
1573
|
+
return n <= 0 ? (e.delete(t), !0) : (e.set(t, n), !1);
|
|
1574
|
+
};
|
|
1575
|
+
function at(e, t, n = []) {
|
|
1576
|
+
for (let t of e) M.set(t.name, t), W(nt, t.name);
|
|
1577
|
+
for (let e of t) P.set(e.name, e), W(rt, e.name);
|
|
1578
|
+
for (let e of n) F.set(e.name, e), W(it, e.name);
|
|
1579
|
+
return U(), () => {
|
|
1580
|
+
for (let t of e) G(nt, t.name) && M.delete(t.name);
|
|
1581
|
+
for (let e of t) G(rt, e.name) && P.delete(e.name);
|
|
1582
|
+
for (let e of n) G(it, e.name) && F.delete(e.name);
|
|
1583
|
+
U();
|
|
1438
1584
|
};
|
|
1439
1585
|
}
|
|
1440
1586
|
//#endregion
|
|
1441
1587
|
//#region src/transition/enteringInitialStyle.ts
|
|
1442
|
-
function
|
|
1588
|
+
function ot(e) {
|
|
1443
1589
|
let { initial: t, isActive: n, status: r } = e;
|
|
1444
1590
|
if (!n || r !== "PUSHING" && r !== "REPLACING") return {};
|
|
1445
1591
|
let i = {};
|
|
@@ -1447,7 +1593,7 @@ function He(e) {
|
|
|
1447
1593
|
}
|
|
1448
1594
|
//#endregion
|
|
1449
1595
|
//#region src/transition/animateInline.ts
|
|
1450
|
-
var
|
|
1596
|
+
var st = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, K = /* @__PURE__ */ new WeakMap(), ct = (e, t) => {
|
|
1451
1597
|
let n = K.get(e);
|
|
1452
1598
|
n || (n = /* @__PURE__ */ new Set(), K.set(e, n)), n.add(t);
|
|
1453
1599
|
}, q = (e, t) => {
|
|
@@ -1464,18 +1610,18 @@ var Ue = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, K = /* @__
|
|
|
1464
1610
|
}
|
|
1465
1611
|
e.style.removeProperty("transform"), e.style.removeProperty("opacity");
|
|
1466
1612
|
}, J = (e, t, n = {}) => {
|
|
1467
|
-
if (!
|
|
1468
|
-
let r = e, i =
|
|
1613
|
+
if (!st(e)) return Promise.resolve();
|
|
1614
|
+
let r = e, i = L(t);
|
|
1469
1615
|
if (i.length === 0) return Promise.resolve();
|
|
1470
|
-
let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s =
|
|
1616
|
+
let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s = z(n.ease);
|
|
1471
1617
|
if (a <= 0 && o <= 0) {
|
|
1472
1618
|
r.style.transition = "none";
|
|
1473
|
-
for (let e of i) r.style.setProperty(e.property, e.value),
|
|
1619
|
+
for (let e of i) r.style.setProperty(e.property, e.value), ct(r, e.property);
|
|
1474
1620
|
return Promise.resolve();
|
|
1475
1621
|
}
|
|
1476
1622
|
let c = i.map((e) => `${e.property} ${a}s ${s} ${o}s`).join(", ");
|
|
1477
1623
|
r.style.transition = c, r.offsetWidth;
|
|
1478
|
-
for (let e of i) r.style.setProperty(e.property, e.value),
|
|
1624
|
+
for (let e of i) r.style.setProperty(e.property, e.value), ct(r, e.property);
|
|
1479
1625
|
return new Promise((e) => {
|
|
1480
1626
|
let t = !1, n = () => {
|
|
1481
1627
|
t || (t = !0, r.removeEventListener("transitionend", i), e());
|
|
@@ -1485,26 +1631,26 @@ var Ue = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, K = /* @__
|
|
|
1485
1631
|
r.addEventListener("transitionend", i), setTimeout(n, (a + o) * 1e3 + 60);
|
|
1486
1632
|
});
|
|
1487
1633
|
}, Y = "data-flemo-skip-animation", X = () => {};
|
|
1488
|
-
function
|
|
1634
|
+
function lt(e) {
|
|
1489
1635
|
return { driveScreenLifecycle: (t) => {
|
|
1490
|
-
let { getElements: n, transitionName: r, prevTransitionName: i, status:
|
|
1491
|
-
if (!s) return
|
|
1492
|
-
if (
|
|
1636
|
+
let { getElements: n, transitionName: r, prevTransitionName: i, status: a, isActive: s } = t;
|
|
1637
|
+
if (!s) return a === "REPLACING" && i !== r && e.setReplaceTransitionStatus("PENDING"), X;
|
|
1638
|
+
if (a === "COMPLETED") {
|
|
1493
1639
|
e.setDragStatus("IDLE"), e.setReplaceTransitionStatus("IDLE");
|
|
1494
1640
|
let { scope: t, decorator: r, bars: i } = n();
|
|
1495
1641
|
t && (q(t), t.removeAttribute(Y)), r && (q(r), r.removeAttribute(Y));
|
|
1496
1642
|
for (let e of i ?? []) e && (q(e), e.style.removeProperty("will-change"));
|
|
1497
1643
|
return X;
|
|
1498
1644
|
}
|
|
1499
|
-
if (
|
|
1645
|
+
if (a === "IDLE") return X;
|
|
1500
1646
|
let { scope: c } = n();
|
|
1501
1647
|
if (!c) return X;
|
|
1502
1648
|
let l = () => {
|
|
1503
1649
|
let t = e.getTransitionTaskId();
|
|
1504
|
-
t &&
|
|
1505
|
-
}, u =
|
|
1506
|
-
if (!(c.getAttribute("data-flemo-skip-animation") !== "true" &&
|
|
1507
|
-
let f =
|
|
1650
|
+
t && o.resolveTask(t);
|
|
1651
|
+
}, u = we(r), d = `${a}-true`;
|
|
1652
|
+
if (!(c.getAttribute("data-flemo-skip-animation") !== "true" && et(u, d))) return queueMicrotask(l), X;
|
|
1653
|
+
let f = B("screen", r, d), p = (e) => {
|
|
1508
1654
|
e.target === c && e.animationName === f && (c.removeEventListener("animationend", p), l());
|
|
1509
1655
|
};
|
|
1510
1656
|
return c.addEventListener("animationend", p), () => {
|
|
@@ -1515,7 +1661,7 @@ function Ge(e) {
|
|
|
1515
1661
|
//#endregion
|
|
1516
1662
|
//#region src/utils/findScrollable.ts
|
|
1517
1663
|
function Z(e, t) {
|
|
1518
|
-
let { direction: n = "x", markerSelector: r = "[data-swipe-at-edge]", depthLimit: i = 24, verifyByScroll: a = !1 } = t ?? {}, o =
|
|
1664
|
+
let { direction: n = "x", markerSelector: r = "[data-swipe-at-edge]", depthLimit: i = 24, verifyByScroll: a = !1 } = t ?? {}, o = ut(e);
|
|
1519
1665
|
if (!o) return {
|
|
1520
1666
|
element: null,
|
|
1521
1667
|
hasMarker: !1
|
|
@@ -1538,7 +1684,7 @@ function Z(e, t) {
|
|
|
1538
1684
|
hasMarker: !1
|
|
1539
1685
|
};
|
|
1540
1686
|
}
|
|
1541
|
-
function
|
|
1687
|
+
function ut(e) {
|
|
1542
1688
|
if (!e) return null;
|
|
1543
1689
|
let t = e, n = typeof t.composedPath == "function" ? t.composedPath() : void 0;
|
|
1544
1690
|
if (n && n.length) {
|
|
@@ -1556,8 +1702,8 @@ function $(e, t) {
|
|
|
1556
1702
|
}
|
|
1557
1703
|
//#endregion
|
|
1558
1704
|
//#region src/core/engine/createSwipeController.ts
|
|
1559
|
-
var
|
|
1560
|
-
function
|
|
1705
|
+
var dt = "data-flemo-skip-animation";
|
|
1706
|
+
function ft(e) {
|
|
1561
1707
|
let t = null, n = null, r = {
|
|
1562
1708
|
current: [],
|
|
1563
1709
|
prev: []
|
|
@@ -1619,7 +1765,7 @@ function Je(e) {
|
|
|
1619
1765
|
current: i,
|
|
1620
1766
|
prev: s
|
|
1621
1767
|
};
|
|
1622
|
-
let c =
|
|
1768
|
+
let c = We(e.getTransition()).join(", ");
|
|
1623
1769
|
for (let e of i) e.style.willChange = c;
|
|
1624
1770
|
for (let e of s) e.style.willChange = c;
|
|
1625
1771
|
}, b = () => {
|
|
@@ -1637,7 +1783,7 @@ function Je(e) {
|
|
|
1637
1783
|
};
|
|
1638
1784
|
}, S = (e, t, n) => {
|
|
1639
1785
|
let r = (r, i) => {
|
|
1640
|
-
let a =
|
|
1786
|
+
let a = F.get(r.getAttribute("data-flemo-part-name"));
|
|
1641
1787
|
if (!a) return;
|
|
1642
1788
|
let o = {
|
|
1643
1789
|
animate: J,
|
|
@@ -1720,7 +1866,7 @@ function Je(e) {
|
|
|
1720
1866
|
}), S("end", e, 0);
|
|
1721
1867
|
}
|
|
1722
1868
|
})) {
|
|
1723
|
-
c?.setAttribute(
|
|
1869
|
+
c?.setAttribute(dt, "true"), l?.setAttribute(dt, "true");
|
|
1724
1870
|
for (let e of r.current) e.style.removeProperty("will-change");
|
|
1725
1871
|
for (let e of r.prev) q(e), e.style.removeProperty("will-change");
|
|
1726
1872
|
r = {
|
|
@@ -1768,7 +1914,7 @@ function Je(e) {
|
|
|
1768
1914
|
}
|
|
1769
1915
|
//#endregion
|
|
1770
1916
|
//#region src/screen/computeBarRiding.ts
|
|
1771
|
-
function
|
|
1917
|
+
function pt(e) {
|
|
1772
1918
|
return !(e.status === "PUSHING" || e.status === "POPPING" || e.status === "REPLACING") || !e.isTopOrTopPrev ? {
|
|
1773
1919
|
app: !1,
|
|
1774
1920
|
nav: !1
|
|
@@ -1779,24 +1925,24 @@ function Ye(e) {
|
|
|
1779
1925
|
}
|
|
1780
1926
|
//#endregion
|
|
1781
1927
|
//#region src/screen/animStartAnchor.ts
|
|
1782
|
-
function
|
|
1928
|
+
function mt(e) {
|
|
1783
1929
|
return !(e.status === "PUSHING" || e.status === "POPPING" || e.status === "REPLACING") || !e.isTopOrTopPrev ? null : `${e.status}:${e.transitionName}`;
|
|
1784
1930
|
}
|
|
1785
|
-
var
|
|
1786
|
-
function
|
|
1787
|
-
return Array.from(e.querySelectorAll("img")).filter((e) => e.complete && typeof e.decode == "function").slice(0,
|
|
1931
|
+
var ht = 300, gt = 20;
|
|
1932
|
+
function _t(e) {
|
|
1933
|
+
return Array.from(e.querySelectorAll("img")).filter((e) => e.complete && typeof e.decode == "function").slice(0, gt);
|
|
1788
1934
|
}
|
|
1789
|
-
function
|
|
1790
|
-
if (!(!e || typeof e.querySelectorAll != "function")) for (let t of
|
|
1935
|
+
function vt(e) {
|
|
1936
|
+
if (!(!e || typeof e.querySelectorAll != "function")) for (let t of _t(e)) t.decode().catch(() => {});
|
|
1791
1937
|
}
|
|
1792
|
-
function
|
|
1938
|
+
function yt(e, t = {}) {
|
|
1793
1939
|
let n = !1, r = 0, i = () => {
|
|
1794
1940
|
let r = t.scope;
|
|
1795
1941
|
if (!r || typeof r.querySelectorAll != "function") {
|
|
1796
1942
|
e();
|
|
1797
1943
|
return;
|
|
1798
1944
|
}
|
|
1799
|
-
let i =
|
|
1945
|
+
let i = _t(r);
|
|
1800
1946
|
if (i.length === 0) {
|
|
1801
1947
|
e();
|
|
1802
1948
|
return;
|
|
@@ -1816,7 +1962,7 @@ function tt(e, t = {}) {
|
|
|
1816
1962
|
}
|
|
1817
1963
|
//#endregion
|
|
1818
1964
|
//#region src/screen/observeBarHeight.ts
|
|
1819
|
-
function
|
|
1965
|
+
function bt(e, t) {
|
|
1820
1966
|
e.offsetHeight > 0 && t(e.offsetHeight);
|
|
1821
1967
|
let n = new ResizeObserver(([e]) => {
|
|
1822
1968
|
e.contentRect.height > 0 && t(e.contentRect.height);
|
|
@@ -1827,14 +1973,14 @@ function nt(e, t) {
|
|
|
1827
1973
|
}
|
|
1828
1974
|
//#endregion
|
|
1829
1975
|
//#region src/screen/observeViewportScrollHeight.ts
|
|
1830
|
-
var
|
|
1831
|
-
function
|
|
1976
|
+
var xt = 0;
|
|
1977
|
+
function St(e) {
|
|
1832
1978
|
let t = 0, n = () => {
|
|
1833
1979
|
cancelAnimationFrame(t), t = requestAnimationFrame(() => {
|
|
1834
1980
|
let t = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
|
|
1835
1981
|
t = t < 0 ? 0 : t;
|
|
1836
|
-
let n = t -
|
|
1837
|
-
n = n < 0 ? 0 : n,
|
|
1982
|
+
let n = t - xt;
|
|
1983
|
+
n = n < 0 ? 0 : n, xt ||= t, e(t, n);
|
|
1838
1984
|
});
|
|
1839
1985
|
};
|
|
1840
1986
|
return window.visualViewport?.addEventListener("resize", n), window.visualViewport?.addEventListener("scroll", n), () => {
|
|
@@ -1842,13 +1988,8 @@ function it(e) {
|
|
|
1842
1988
|
};
|
|
1843
1989
|
}
|
|
1844
1990
|
//#endregion
|
|
1845
|
-
//#region src/utils/matchesPathname.ts
|
|
1846
|
-
function at(e, t) {
|
|
1847
|
-
return i(e).regexp.test(t);
|
|
1848
|
-
}
|
|
1849
|
-
//#endregion
|
|
1850
1991
|
//#region src/utils/isOpaqueColor.ts
|
|
1851
|
-
function
|
|
1992
|
+
function Ct(e) {
|
|
1852
1993
|
let t = e.trim().toLowerCase();
|
|
1853
1994
|
if (t === "transparent" || t === "") return !1;
|
|
1854
1995
|
if (t.match(/^rgb\(\s*\d+[\s,]+\d+[\s,]+\d+\s*\)$/)) return !0;
|
|
@@ -1859,7 +2000,7 @@ function ot(e) {
|
|
|
1859
2000
|
}
|
|
1860
2001
|
//#endregion
|
|
1861
2002
|
//#region src/utils/buildRoutePath.ts
|
|
1862
|
-
function
|
|
2003
|
+
function wt(e, n) {
|
|
1863
2004
|
let i = n ?? {}, a = t(e)(Object.fromEntries(Object.entries(i).map(([e, t]) => [e, String(t)]))), o = (typeof e == "string" ? r(e) : e).tokens.filter((e) => e.type === "param").map((e) => e.name), s = Object.fromEntries(Object.entries(i).filter(([e]) => !o.includes(e))), c = new URLSearchParams(s).toString();
|
|
1864
2005
|
return {
|
|
1865
2006
|
pathname: `${a}${c ? `?${c}` : ""}`,
|
|
@@ -1867,4 +2008,4 @@ function st(e, n) {
|
|
|
1867
2008
|
};
|
|
1868
2009
|
}
|
|
1869
2010
|
//#endregion
|
|
1870
|
-
export {
|
|
2011
|
+
export { ht as ANIM_HOLD_RELEASE_BACKSTOP_MS, Y as SKIP_ANIMATION_ATTR, o as TaskManger, mt as animHoldKey, J as animateInline, B as animationName, oe as appendParamsQuery, U as applyTransitionStyles, wt as buildRoutePath, $ as canProgrammaticallyScroll, q as clearInlineAnimation, We as collectAnimatedProperties, Qe as compileTransitionStyles, pt as computeBarRiding, ge as computeScreenFreeze, y as consumeSelfInducedPop, h as createBrowserHistoryDriver, Te as createDecorator, s as createHistoryStore, b as createHistorySync, ne as createMemoryHistoryDriver, re as createNavigateStore, ie as createNavigationController, Oe as createPartTransition, Ee as createRawDecorator, ke as createRawPartTransition, _e as createRawTransition, me as createRouterScope, he as createScreenSelector, de as createScreenStore, g as createSelfPopGuard, se as createStepController, ft as createSwipeController, j as createTransition, lt as createTransitionEngine, le as createTransitionStore, ye as cupertino, P as decoratorMap, vt as eagerlyDecodeImages, z as easingToCss, ee as ensureScopeHistorySync, f as ensureWindowHistoryState, ot as enteringInitialStyle, Z as findScrollable, c as getMatchedPathPattern, l as getParams, Ct as isOpaqueColor, d as isServer, xe as layout, v as markSelfInducedPop, ue as matchesPathname, Se as material, Ce as none, bt as observeBarHeight, St as observeViewportScrollHeight, Q as overflowsAxis, De as overlay, F as partTransitionMap, ae as readStepParams, at as registerTransitionDefinitions, te as releaseScopeHistorySync, we as resolveTransition, yt as scheduleAnimHoldRelease, u as seedInitialHistory, p as seedRouterEntry, ce as subscribeStepParamsRestore, L as targetToDecls, M as transitionMap, et as variantHasAnimation };
|