@flemo/core 1.12.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/index.d.ts +2 -1
- package/dist/index.mjs +480 -346
- 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,
|
|
@@ -227,13 +241,13 @@ function o(t = [], n = -1) {
|
|
|
227
241
|
}
|
|
228
242
|
//#endregion
|
|
229
243
|
//#region src/utils/getMatchedPathPattern.ts
|
|
230
|
-
function
|
|
244
|
+
function c(e, t) {
|
|
231
245
|
return Array.isArray(e) ? e.find((e) => i(e).regexp.test(t)) ?? "" : i(e).regexp.test(t) ? e : "";
|
|
232
246
|
}
|
|
233
247
|
//#endregion
|
|
234
248
|
//#region src/utils/getParams.ts
|
|
235
|
-
function
|
|
236
|
-
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());
|
|
237
251
|
return i ? {
|
|
238
252
|
...i.params,
|
|
239
253
|
...o
|
|
@@ -241,24 +255,24 @@ function c(e, t, r) {
|
|
|
241
255
|
}
|
|
242
256
|
//#endregion
|
|
243
257
|
//#region src/history/seedInitialHistory.ts
|
|
244
|
-
function
|
|
258
|
+
function u(e, t, n, r) {
|
|
245
259
|
return {
|
|
246
260
|
id: "root",
|
|
247
261
|
pathname: t,
|
|
248
|
-
params:
|
|
262
|
+
params: l(e, t, n),
|
|
249
263
|
transitionName: r,
|
|
250
264
|
layoutId: null
|
|
251
265
|
};
|
|
252
266
|
}
|
|
253
267
|
//#endregion
|
|
254
268
|
//#region src/utils/isServer.ts
|
|
255
|
-
function
|
|
269
|
+
function d() {
|
|
256
270
|
return typeof document > "u";
|
|
257
271
|
}
|
|
258
272
|
//#endregion
|
|
259
273
|
//#region src/history/ensureWindowHistoryState.ts
|
|
260
|
-
function
|
|
261
|
-
if (
|
|
274
|
+
function f(e, t, n = {}) {
|
|
275
|
+
if (d()) return;
|
|
262
276
|
let r = {
|
|
263
277
|
id: "root",
|
|
264
278
|
index: 0,
|
|
@@ -279,12 +293,24 @@ function d(e, t, n = {}) {
|
|
|
279
293
|
}, "", window.location.href);
|
|
280
294
|
}
|
|
281
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
|
|
282
308
|
//#region src/history/historyDriver.ts
|
|
283
|
-
var
|
|
309
|
+
var m = (e, t) => ({
|
|
284
310
|
...window.history.state ?? {},
|
|
285
311
|
[e]: t
|
|
286
312
|
});
|
|
287
|
-
function
|
|
313
|
+
function h(e) {
|
|
288
314
|
return e === void 0 ? {
|
|
289
315
|
readState: () => window.history.state,
|
|
290
316
|
readPathname: () => window.location.pathname,
|
|
@@ -302,8 +328,8 @@ function p(e) {
|
|
|
302
328
|
} : {
|
|
303
329
|
readState: () => window.history.state?.[e] ?? null,
|
|
304
330
|
readPathname: () => window.location.pathname,
|
|
305
|
-
pushState: (t, n) => window.history.pushState(
|
|
306
|
-
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),
|
|
307
333
|
go: (e) => window.history.go(e),
|
|
308
334
|
back: () => window.history.back(),
|
|
309
335
|
subscribe: (t) => {
|
|
@@ -317,7 +343,7 @@ function p(e) {
|
|
|
317
343
|
}
|
|
318
344
|
//#endregion
|
|
319
345
|
//#region src/navigate/selfPopGuard.ts
|
|
320
|
-
function
|
|
346
|
+
function g() {
|
|
321
347
|
let e = 0;
|
|
322
348
|
return {
|
|
323
349
|
mark() {
|
|
@@ -328,72 +354,149 @@ function m() {
|
|
|
328
354
|
}
|
|
329
355
|
};
|
|
330
356
|
}
|
|
331
|
-
var
|
|
332
|
-
function
|
|
333
|
-
|
|
357
|
+
var _ = g();
|
|
358
|
+
function v() {
|
|
359
|
+
_.mark();
|
|
334
360
|
}
|
|
335
|
-
function
|
|
336
|
-
return
|
|
361
|
+
function y() {
|
|
362
|
+
return _.consume();
|
|
337
363
|
}
|
|
338
364
|
//#endregion
|
|
339
365
|
//#region src/history/createHistorySync.ts
|
|
340
|
-
function
|
|
341
|
-
let { stores: t, driver: n =
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
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) => {
|
|
345
377
|
if (i) {
|
|
346
|
-
|
|
378
|
+
a.abort();
|
|
347
379
|
return;
|
|
348
380
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
r.abort();
|
|
381
|
+
if (e.ownsPathname && !e.ownsPathname(r.pathname)) {
|
|
382
|
+
a.abort();
|
|
352
383
|
return;
|
|
353
384
|
}
|
|
354
|
-
|
|
355
|
-
|
|
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();
|
|
356
388
|
return;
|
|
357
389
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
390
|
+
if (!s?.id) {
|
|
391
|
+
a.abort();
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
let _ = p.findIndex((e) => e.id === s.id);
|
|
395
|
+
if (_ === f) {
|
|
396
|
+
a.abort();
|
|
361
397
|
return;
|
|
362
398
|
}
|
|
363
|
-
let
|
|
364
|
-
id:
|
|
365
|
-
pathname:
|
|
366
|
-
params:
|
|
367
|
-
transitionName:
|
|
368
|
-
layoutId:
|
|
369
|
-
frameIndex:
|
|
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
|
|
370
406
|
};
|
|
371
|
-
if (
|
|
372
|
-
let e =
|
|
373
|
-
if (!(
|
|
374
|
-
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();
|
|
375
411
|
return;
|
|
376
412
|
}
|
|
377
|
-
return
|
|
378
|
-
|
|
413
|
+
return d(u), o(s.status === "REPLACING" ? "REPLACING" : "PUSHING"), m(v), async () => {
|
|
414
|
+
o("COMPLETED");
|
|
379
415
|
};
|
|
380
416
|
}
|
|
381
|
-
let
|
|
382
|
-
return
|
|
383
|
-
|
|
417
|
+
let y = f - 1;
|
|
418
|
+
return d(u), g(y), o("POPPING"), async () => {
|
|
419
|
+
h(y + 1), o("COMPLETED"), y > _ && !i && c(r);
|
|
384
420
|
};
|
|
385
421
|
}, {
|
|
386
|
-
id:
|
|
387
|
-
control: {
|
|
422
|
+
id: u,
|
|
423
|
+
control: {
|
|
424
|
+
manual: !0,
|
|
425
|
+
maxLifetimeMs: a
|
|
426
|
+
}
|
|
388
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);
|
|
389
451
|
});
|
|
390
|
-
|
|
391
|
-
|
|
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), _();
|
|
392
461
|
};
|
|
393
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
|
+
}
|
|
394
497
|
//#endregion
|
|
395
498
|
//#region src/history/memoryHistoryDriver.ts
|
|
396
|
-
function
|
|
499
|
+
function ne(e) {
|
|
397
500
|
let t = [{
|
|
398
501
|
state: e?.state ?? null,
|
|
399
502
|
url: e?.url ?? "/"
|
|
@@ -435,7 +538,7 @@ function y(e) {
|
|
|
435
538
|
}
|
|
436
539
|
//#endregion
|
|
437
540
|
//#region src/navigate/store.ts
|
|
438
|
-
function
|
|
541
|
+
function re() {
|
|
439
542
|
return e((e) => ({
|
|
440
543
|
status: "IDLE",
|
|
441
544
|
transitionTaskId: null,
|
|
@@ -445,11 +548,11 @@ function b() {
|
|
|
445
548
|
}
|
|
446
549
|
//#endregion
|
|
447
550
|
//#region src/navigate/createNavigationController.ts
|
|
448
|
-
var
|
|
551
|
+
var O = (e, t, n) => {
|
|
449
552
|
let { regexp: r } = i(e);
|
|
450
553
|
for (let e = t - 1; e >= 0; e--) if (r.test(n[e].pathname)) return t - e;
|
|
451
554
|
return -1;
|
|
452
|
-
},
|
|
555
|
+
}, k = (e, t) => typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.trunc(e)) : t, A = async (e, t, n, r) => {
|
|
453
556
|
let i, a = new Promise((t) => {
|
|
454
557
|
i = e.subscribe(() => t(!0));
|
|
455
558
|
}), o = new Promise((e) => setTimeout(() => e(!1), 200));
|
|
@@ -457,8 +560,8 @@ var x = (e, t, n) => {
|
|
|
457
560
|
let s = await Promise.race([a, o]);
|
|
458
561
|
i(), s && r();
|
|
459
562
|
};
|
|
460
|
-
function
|
|
461
|
-
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 = () => {
|
|
462
565
|
let e = r.readState();
|
|
463
566
|
if (!e?.id) return null;
|
|
464
567
|
let { index: n, histories: i, adoptHistory: a, truncateHistory: o } = t.history.getState();
|
|
@@ -472,172 +575,181 @@ function w(e) {
|
|
|
472
575
|
layoutId: e.layoutId ?? null,
|
|
473
576
|
frameIndex: e.index
|
|
474
577
|
}), e;
|
|
475
|
-
},
|
|
476
|
-
let { status:
|
|
477
|
-
if (
|
|
478
|
-
let
|
|
479
|
-
(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) => {
|
|
480
583
|
if (t.life && !t.life.alive) {
|
|
481
584
|
a.abort();
|
|
482
585
|
return;
|
|
483
586
|
}
|
|
484
|
-
let
|
|
485
|
-
if (
|
|
486
|
-
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);
|
|
487
590
|
return e < 0 ? 0 : e;
|
|
488
591
|
}
|
|
489
|
-
return Math.min(
|
|
592
|
+
return Math.min(k(u?.skip, 0), Math.max(0, d));
|
|
490
593
|
})(), { setStatus: y, setTransitionTaskId: b } = t.navigate.getState();
|
|
491
|
-
y("PUSHING"), b(
|
|
492
|
-
let { pathname:
|
|
493
|
-
id:
|
|
494
|
-
pathname:
|
|
495
|
-
params:
|
|
496
|
-
transitionName:
|
|
497
|
-
layoutId:
|
|
498
|
-
},
|
|
499
|
-
if (v === 0) return
|
|
500
|
-
id:
|
|
501
|
-
index:
|
|
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,
|
|
502
605
|
status: "PUSHING",
|
|
503
|
-
params:
|
|
504
|
-
transitionName:
|
|
505
|
-
layoutId:
|
|
506
|
-
},
|
|
507
|
-
...
|
|
508
|
-
frameIndex:
|
|
606
|
+
params: l,
|
|
607
|
+
transitionName: p,
|
|
608
|
+
layoutId: m
|
|
609
|
+
}, x), g({
|
|
610
|
+
...C,
|
|
611
|
+
frameIndex: w + 1
|
|
509
612
|
}), () => {
|
|
510
613
|
y("COMPLETED");
|
|
511
614
|
};
|
|
512
|
-
let
|
|
615
|
+
let T = f[d - v]?.frameIndex ?? d - v;
|
|
513
616
|
return g({
|
|
514
|
-
...
|
|
515
|
-
frameIndex:
|
|
516
|
-
}), await
|
|
517
|
-
|
|
518
|
-
id:
|
|
519
|
-
index:
|
|
617
|
+
...C,
|
|
618
|
+
frameIndex: T + 1
|
|
619
|
+
}), await A(r, i, v, () => {
|
|
620
|
+
s(), r.pushState({
|
|
621
|
+
id: h,
|
|
622
|
+
index: T + 1,
|
|
520
623
|
status: "PUSHING",
|
|
521
|
-
params:
|
|
522
|
-
transitionName:
|
|
523
|
-
layoutId:
|
|
524
|
-
},
|
|
624
|
+
params: l,
|
|
625
|
+
transitionName: p,
|
|
626
|
+
layoutId: m
|
|
627
|
+
}, x);
|
|
525
628
|
}), async () => {
|
|
526
629
|
_(v), y("COMPLETED");
|
|
527
630
|
};
|
|
528
631
|
}, {
|
|
529
|
-
id:
|
|
530
|
-
control: {
|
|
632
|
+
id: h,
|
|
633
|
+
control: {
|
|
634
|
+
manual: !0,
|
|
635
|
+
maxLifetimeMs: a
|
|
636
|
+
}
|
|
531
637
|
})).result?.();
|
|
532
|
-
},
|
|
533
|
-
let { status:
|
|
534
|
-
if (
|
|
535
|
-
let
|
|
536
|
-
(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) => {
|
|
537
643
|
if (t.life && !t.life.alive) {
|
|
538
644
|
a.abort();
|
|
539
645
|
return;
|
|
540
646
|
}
|
|
541
|
-
let
|
|
542
|
-
if (
|
|
543
|
-
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);
|
|
544
650
|
return e < 0 ? 0 : e + 1;
|
|
545
651
|
}
|
|
546
|
-
return Math.min(
|
|
652
|
+
return Math.min(k(u?.skip, 0) + 1, d + 1);
|
|
547
653
|
})();
|
|
548
654
|
if (y <= 0) {
|
|
549
655
|
a.abort();
|
|
550
656
|
return;
|
|
551
657
|
}
|
|
552
|
-
let { setStatus: b, setTransitionTaskId:
|
|
553
|
-
b("REPLACING"),
|
|
554
|
-
let { pathname:
|
|
555
|
-
id:
|
|
556
|
-
pathname:
|
|
557
|
-
params:
|
|
558
|
-
transitionName:
|
|
559
|
-
layoutId:
|
|
560
|
-
},
|
|
561
|
-
if (y === 1) return
|
|
562
|
-
id:
|
|
563
|
-
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,
|
|
564
670
|
status: "REPLACING",
|
|
565
|
-
params:
|
|
566
|
-
transitionName:
|
|
567
|
-
layoutId:
|
|
568
|
-
},
|
|
569
|
-
...
|
|
570
|
-
frameIndex:
|
|
671
|
+
params: l,
|
|
672
|
+
transitionName: p,
|
|
673
|
+
layoutId: m
|
|
674
|
+
}, S), g({
|
|
675
|
+
...w,
|
|
676
|
+
frameIndex: T
|
|
571
677
|
}), async () => {
|
|
572
678
|
_(d), b("COMPLETED");
|
|
573
679
|
};
|
|
574
|
-
let
|
|
680
|
+
let E = y <= d ? (f[d - y]?.frameIndex ?? d - y) + 1 : f[0]?.frameIndex ?? 0;
|
|
575
681
|
return v(y - 1), g({
|
|
576
|
-
...
|
|
577
|
-
frameIndex:
|
|
578
|
-
}), y <= d ? await
|
|
579
|
-
|
|
580
|
-
id:
|
|
581
|
-
index:
|
|
682
|
+
...w,
|
|
683
|
+
frameIndex: E
|
|
684
|
+
}), y <= d ? await A(r, i, y, () => {
|
|
685
|
+
s(), r.pushState({
|
|
686
|
+
id: h,
|
|
687
|
+
index: E,
|
|
582
688
|
status: "REPLACING",
|
|
583
|
-
params:
|
|
584
|
-
transitionName:
|
|
585
|
-
layoutId:
|
|
586
|
-
},
|
|
587
|
-
}) : await
|
|
588
|
-
|
|
589
|
-
id:
|
|
590
|
-
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,
|
|
591
697
|
status: "REPLACING",
|
|
592
|
-
params:
|
|
593
|
-
transitionName:
|
|
594
|
-
layoutId:
|
|
595
|
-
},
|
|
698
|
+
params: l,
|
|
699
|
+
transitionName: p,
|
|
700
|
+
layoutId: m
|
|
701
|
+
}, S);
|
|
596
702
|
}), async () => {
|
|
597
703
|
_(t.history.getState().index - 1), b("COMPLETED");
|
|
598
704
|
};
|
|
599
705
|
}, {
|
|
600
|
-
id:
|
|
601
|
-
control: {
|
|
706
|
+
id: h,
|
|
707
|
+
control: {
|
|
708
|
+
manual: !0,
|
|
709
|
+
maxLifetimeMs: a
|
|
710
|
+
}
|
|
602
711
|
})).result?.();
|
|
603
|
-
},
|
|
604
|
-
let
|
|
605
|
-
(await
|
|
712
|
+
}, d = async (e, n) => {
|
|
713
|
+
let s = o.generateTaskId();
|
|
714
|
+
(await o.addTask(async (a) => {
|
|
606
715
|
if (t.life && !t.life.alive) {
|
|
607
716
|
a.abort();
|
|
608
717
|
return;
|
|
609
718
|
}
|
|
610
|
-
|
|
611
|
-
let { index:
|
|
612
|
-
if (
|
|
719
|
+
c();
|
|
720
|
+
let { index: o, histories: l, popHistory: u, popHistories: d, setPendingIndex: f, setTransitionName: p } = t.history.getState();
|
|
721
|
+
if (o <= 0) {
|
|
613
722
|
a.abort();
|
|
614
723
|
return;
|
|
615
724
|
}
|
|
616
|
-
let m = Math.min(e(
|
|
725
|
+
let m = Math.min(e(o, l), o);
|
|
617
726
|
if (m <= 0) {
|
|
618
727
|
a.abort();
|
|
619
728
|
return;
|
|
620
729
|
}
|
|
621
|
-
f(
|
|
730
|
+
f(o - m);
|
|
622
731
|
let { setStatus: h, setTransitionTaskId: g } = t.navigate.getState();
|
|
623
|
-
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 () => {
|
|
624
733
|
u(t.history.getState().index), h("COMPLETED");
|
|
625
734
|
};
|
|
626
735
|
}, {
|
|
627
|
-
id:
|
|
628
|
-
control: {
|
|
736
|
+
id: s,
|
|
737
|
+
control: {
|
|
738
|
+
manual: !0,
|
|
739
|
+
maxLifetimeMs: a
|
|
740
|
+
}
|
|
629
741
|
})).result?.();
|
|
630
742
|
};
|
|
631
743
|
return {
|
|
632
|
-
push:
|
|
633
|
-
replace:
|
|
744
|
+
push: l,
|
|
745
|
+
replace: u,
|
|
634
746
|
pop: async (e) => {
|
|
635
|
-
await
|
|
747
|
+
await d((t, n) => {
|
|
636
748
|
if (e?.until != null) {
|
|
637
|
-
let r =
|
|
749
|
+
let r = O(e.until, t, n);
|
|
638
750
|
return r < 0 ? 0 : r;
|
|
639
751
|
}
|
|
640
|
-
let r =
|
|
752
|
+
let r = k(e?.skip, 1);
|
|
641
753
|
return r <= 0 ? 0 : Math.min(r, t);
|
|
642
754
|
}, e?.transitionName);
|
|
643
755
|
}
|
|
@@ -645,18 +757,18 @@ function w(e) {
|
|
|
645
757
|
}
|
|
646
758
|
//#endregion
|
|
647
759
|
//#region src/navigate/createStepController.ts
|
|
648
|
-
var
|
|
760
|
+
var ae = (e) => {
|
|
649
761
|
let t = e;
|
|
650
762
|
return t?.step ? t.params ?? {} : null;
|
|
651
|
-
},
|
|
763
|
+
}, oe = (e, t) => {
|
|
652
764
|
let n = new URLSearchParams(Object.fromEntries(Object.entries(t).map(([e, t]) => [e, String(t)]))).toString();
|
|
653
765
|
return n ? `${e}?${n}` : e;
|
|
654
766
|
};
|
|
655
|
-
function
|
|
656
|
-
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;
|
|
657
769
|
return {
|
|
658
770
|
pushStep: async (e) => {
|
|
659
|
-
(await
|
|
771
|
+
(await o.addTask(async () => {
|
|
660
772
|
let t = i(e), r = n.readState();
|
|
661
773
|
return r?.step || n.replaceState({
|
|
662
774
|
...r,
|
|
@@ -665,35 +777,35 @@ function D(e) {
|
|
|
665
777
|
...n.readState(),
|
|
666
778
|
step: !0,
|
|
667
779
|
params: e
|
|
668
|
-
}, t), async () =>
|
|
780
|
+
}, t), async () => s(e);
|
|
669
781
|
})).result?.();
|
|
670
782
|
},
|
|
671
783
|
replaceStep: async (e) => {
|
|
672
|
-
(await
|
|
784
|
+
(await o.addTask(async () => {
|
|
673
785
|
let t = i(e);
|
|
674
786
|
return n.replaceState({
|
|
675
787
|
...n.readState(),
|
|
676
788
|
step: !0,
|
|
677
789
|
params: e
|
|
678
|
-
}, t), async () =>
|
|
790
|
+
}, t), async () => s(e);
|
|
679
791
|
})).result?.();
|
|
680
792
|
},
|
|
681
793
|
popStep: async () => {
|
|
682
|
-
let e =
|
|
683
|
-
(await
|
|
794
|
+
let e = o.generateTaskId();
|
|
795
|
+
(await o.addTask(async (i) => {
|
|
684
796
|
let a = new Promise((e) => {
|
|
685
797
|
let t = n.subscribe((n) => {
|
|
686
798
|
t(), e(n.state);
|
|
687
799
|
});
|
|
688
|
-
}),
|
|
800
|
+
}), o = new Promise((e) => setTimeout(() => e(void 0), 200));
|
|
689
801
|
r(), n.back();
|
|
690
|
-
let c = await Promise.race([a,
|
|
802
|
+
let c = await Promise.race([a, o]);
|
|
691
803
|
if (!c) {
|
|
692
804
|
i.abort();
|
|
693
805
|
return;
|
|
694
806
|
}
|
|
695
807
|
if (c.step) {
|
|
696
|
-
|
|
808
|
+
s(c.params ?? {}), i.abort();
|
|
697
809
|
return;
|
|
698
810
|
}
|
|
699
811
|
let { setStatus: l, setTransitionTaskId: u } = t.navigate.getState(), { index: d, popHistory: f } = t.history.getState();
|
|
@@ -702,30 +814,38 @@ function D(e) {
|
|
|
702
814
|
};
|
|
703
815
|
}, {
|
|
704
816
|
id: e,
|
|
705
|
-
control: {
|
|
817
|
+
control: {
|
|
818
|
+
manual: !0,
|
|
819
|
+
maxLifetimeMs: a
|
|
820
|
+
}
|
|
706
821
|
})).result?.();
|
|
707
822
|
}
|
|
708
823
|
};
|
|
709
824
|
}
|
|
710
|
-
function
|
|
825
|
+
function ce(e, t) {
|
|
711
826
|
return e.subscribe((e) => {
|
|
712
827
|
let n = e.state;
|
|
713
|
-
n?.step &&
|
|
828
|
+
n?.step && o.addTask(async () => {
|
|
714
829
|
t(n.params ?? {});
|
|
715
830
|
});
|
|
716
831
|
});
|
|
717
832
|
}
|
|
718
833
|
//#endregion
|
|
719
834
|
//#region src/transition/store.ts
|
|
720
|
-
function
|
|
835
|
+
function le(t = "cupertino") {
|
|
721
836
|
return e((e) => ({
|
|
722
837
|
defaultTransitionName: t,
|
|
723
838
|
setDefaultTransitionName: (t) => e({ defaultTransitionName: t })
|
|
724
839
|
}));
|
|
725
840
|
}
|
|
726
841
|
//#endregion
|
|
842
|
+
//#region src/utils/matchesPathname.ts
|
|
843
|
+
function ue(e, t) {
|
|
844
|
+
return i(e).regexp.test(t);
|
|
845
|
+
}
|
|
846
|
+
//#endregion
|
|
727
847
|
//#region src/screen/store.ts
|
|
728
|
-
function
|
|
848
|
+
function de() {
|
|
729
849
|
return e((e) => ({
|
|
730
850
|
dragStatus: "IDLE",
|
|
731
851
|
replaceTransitionStatus: "IDLE",
|
|
@@ -756,49 +876,62 @@ function A() {
|
|
|
756
876
|
}
|
|
757
877
|
//#endregion
|
|
758
878
|
//#region src/core/createRouterScope.ts
|
|
759
|
-
var
|
|
879
|
+
var fe = {
|
|
760
880
|
mark: () => {},
|
|
761
881
|
consume: () => !1
|
|
762
|
-
};
|
|
763
|
-
function
|
|
764
|
-
let { routePaths: t, pathname: n, search: r, defaultTransitionName: i, memory: a, browserDriver:
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
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
|
|
769
898
|
} : {
|
|
770
|
-
...
|
|
899
|
+
...l,
|
|
771
900
|
frameIndex: 0
|
|
772
901
|
};
|
|
773
902
|
if (e.hostedScope) return e.hostedScope.life.alive = !0, e.hostedScope.history.getState().index === -1 && e.hostedScope.history.setState({
|
|
774
903
|
index: 0,
|
|
775
|
-
histories: [
|
|
904
|
+
histories: [p]
|
|
776
905
|
}), e.hostedScope;
|
|
777
|
-
let
|
|
906
|
+
let m = a ? ne({
|
|
778
907
|
state: {
|
|
779
|
-
id:
|
|
908
|
+
id: p.id,
|
|
780
909
|
index: 0,
|
|
781
910
|
status: "IDLE",
|
|
782
|
-
params:
|
|
783
|
-
transitionName:
|
|
784
|
-
layoutId:
|
|
911
|
+
params: p.params,
|
|
912
|
+
transitionName: p.transitionName,
|
|
913
|
+
layoutId: p.layoutId
|
|
785
914
|
},
|
|
786
|
-
url:
|
|
787
|
-
}) :
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
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,
|
|
794
922
|
markSelfInduced: h.mark,
|
|
795
923
|
consume: h.consume,
|
|
924
|
+
routerKey: e.routerKey,
|
|
925
|
+
zoneEntryId: e.zoneEntryId,
|
|
926
|
+
ownsPathname: (e) => ue(t, e),
|
|
927
|
+
persistent: !!c,
|
|
796
928
|
life: { alive: !0 }
|
|
797
929
|
};
|
|
930
|
+
return c && pe.set(c, _), _;
|
|
798
931
|
}
|
|
799
932
|
//#endregion
|
|
800
933
|
//#region src/screen/createScreenSelector.ts
|
|
801
|
-
function
|
|
934
|
+
function he(e, t) {
|
|
802
935
|
return e.map((n, r) => ({
|
|
803
936
|
...n,
|
|
804
937
|
isActive: r === t,
|
|
@@ -811,7 +944,7 @@ function ne(e, t) {
|
|
|
811
944
|
}
|
|
812
945
|
//#endregion
|
|
813
946
|
//#region src/screen/computeScreenFreeze.ts
|
|
814
|
-
function
|
|
947
|
+
function ge(e) {
|
|
815
948
|
let t = e.status === "COMPLETED" && e.dragStatus === "IDLE";
|
|
816
949
|
return !e.isActive && t || e.isPrev && e.index - 2 <= e.zIndex && e.replaceTransitionStatus === "IDLE" || e.isPrev && e.index - 2 > e.zIndex;
|
|
817
950
|
}
|
|
@@ -838,7 +971,7 @@ function j({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exit
|
|
|
838
971
|
}
|
|
839
972
|
//#endregion
|
|
840
973
|
//#region src/transition/createRawTransition.ts
|
|
841
|
-
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 }) {
|
|
842
975
|
return {
|
|
843
976
|
name: e,
|
|
844
977
|
initial: t,
|
|
@@ -859,10 +992,10 @@ function ie({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
859
992
|
}
|
|
860
993
|
//#endregion
|
|
861
994
|
//#region src/transition/cupertino.ts
|
|
862
|
-
var
|
|
995
|
+
var ve = (e, t, n) => {
|
|
863
996
|
let [r, i] = t, [a, o] = n;
|
|
864
997
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
865
|
-
},
|
|
998
|
+
}, ye = j({
|
|
866
999
|
name: "cupertino",
|
|
867
1000
|
initial: { x: "100%" },
|
|
868
1001
|
idle: {
|
|
@@ -922,7 +1055,7 @@ var ae = (e, t, n) => {
|
|
|
922
1055
|
swipeDirection: "x",
|
|
923
1056
|
onSwipeStart: async () => !0,
|
|
924
1057
|
onSwipe: (e, t, { animate: n, currentScreen: r, prevScreen: i, onProgress: a }) => {
|
|
925
|
-
let { offset: o } = t, s = o.x, c =
|
|
1058
|
+
let { offset: o } = t, s = o.x, c = ve(s, [0, window.innerWidth], [0, 100]);
|
|
926
1059
|
return a?.(!0, c), n(r, { x: Math.max(0, s) }, { duration: 0 }), n(i, { x: `${-30 + c * .3}%` }, { duration: 0 }), c;
|
|
927
1060
|
},
|
|
928
1061
|
onSwipeEnd: async (e, t, { animate: n, currentScreen: r, prevScreen: i, onStart: a }) => {
|
|
@@ -946,10 +1079,10 @@ var ae = (e, t, n) => {
|
|
|
946
1079
|
})]), c;
|
|
947
1080
|
}
|
|
948
1081
|
}
|
|
949
|
-
}),
|
|
1082
|
+
}), be = (e, t, n) => {
|
|
950
1083
|
let [r, i] = t, [a, o] = n;
|
|
951
1084
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
952
|
-
},
|
|
1085
|
+
}, xe = j({
|
|
953
1086
|
name: "layout",
|
|
954
1087
|
initial: { opacity: .97 },
|
|
955
1088
|
idle: {
|
|
@@ -977,7 +1110,7 @@ var ae = (e, t, n) => {
|
|
|
977
1110
|
swipeDirection: "y",
|
|
978
1111
|
onSwipeStart: async () => !0,
|
|
979
1112
|
onSwipe: (e, t, { animate: n, currentScreen: r, onProgress: i }) => {
|
|
980
|
-
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);
|
|
981
1114
|
return i?.(!0, 100), n(r, {
|
|
982
1115
|
y: f,
|
|
983
1116
|
opacity: c
|
|
@@ -994,7 +1127,7 @@ var ae = (e, t, n) => {
|
|
|
994
1127
|
}, { duration: .3 })]), c;
|
|
995
1128
|
}
|
|
996
1129
|
}
|
|
997
|
-
}),
|
|
1130
|
+
}), Se = j({
|
|
998
1131
|
name: "material",
|
|
999
1132
|
initial: { y: "100%" },
|
|
1000
1133
|
idle: {
|
|
@@ -1102,7 +1235,7 @@ var ae = (e, t, n) => {
|
|
|
1102
1235
|
})]), c;
|
|
1103
1236
|
}
|
|
1104
1237
|
}
|
|
1105
|
-
}),
|
|
1238
|
+
}), Ce = j({
|
|
1106
1239
|
name: "none",
|
|
1107
1240
|
initial: {},
|
|
1108
1241
|
idle: {
|
|
@@ -1125,20 +1258,20 @@ var ae = (e, t, n) => {
|
|
|
1125
1258
|
value: {},
|
|
1126
1259
|
options: { duration: 0 }
|
|
1127
1260
|
}
|
|
1128
|
-
}),
|
|
1129
|
-
["none",
|
|
1130
|
-
["cupertino",
|
|
1131
|
-
["material",
|
|
1132
|
-
["layout",
|
|
1261
|
+
}), M = new Map([
|
|
1262
|
+
["none", Ce],
|
|
1263
|
+
["cupertino", ye],
|
|
1264
|
+
["material", Se],
|
|
1265
|
+
["layout", xe]
|
|
1133
1266
|
]);
|
|
1134
1267
|
//#endregion
|
|
1135
1268
|
//#region src/transition/resolveTransition.ts
|
|
1136
|
-
function
|
|
1137
|
-
return
|
|
1269
|
+
function we(e) {
|
|
1270
|
+
return M.get(e) ?? M.get("none");
|
|
1138
1271
|
}
|
|
1139
1272
|
//#endregion
|
|
1140
1273
|
//#region src/transition/decorator/createDecorator.ts
|
|
1141
|
-
function
|
|
1274
|
+
function Te({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
1142
1275
|
return {
|
|
1143
1276
|
name: e,
|
|
1144
1277
|
initial: t,
|
|
@@ -1159,7 +1292,7 @@ function de({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
|
1159
1292
|
}
|
|
1160
1293
|
//#endregion
|
|
1161
1294
|
//#region src/transition/decorator/createRawDecorator.ts
|
|
1162
|
-
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 }) {
|
|
1163
1296
|
return {
|
|
1164
1297
|
name: e,
|
|
1165
1298
|
initial: t,
|
|
@@ -1180,30 +1313,30 @@ function fe({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
1180
1313
|
}
|
|
1181
1314
|
//#endregion
|
|
1182
1315
|
//#region src/transition/decorator/overlay.ts
|
|
1183
|
-
var
|
|
1316
|
+
var N = "rgba(0, 0, 0, 0.3)", De = Te({
|
|
1184
1317
|
name: "overlay",
|
|
1185
1318
|
initial: {
|
|
1186
1319
|
opacity: 0,
|
|
1187
|
-
backgroundColor:
|
|
1320
|
+
backgroundColor: N
|
|
1188
1321
|
},
|
|
1189
1322
|
idle: {
|
|
1190
1323
|
value: {
|
|
1191
1324
|
opacity: 0,
|
|
1192
|
-
backgroundColor:
|
|
1325
|
+
backgroundColor: N
|
|
1193
1326
|
},
|
|
1194
1327
|
options: { duration: 0 }
|
|
1195
1328
|
},
|
|
1196
1329
|
enter: {
|
|
1197
1330
|
value: {
|
|
1198
1331
|
opacity: 1,
|
|
1199
|
-
backgroundColor:
|
|
1332
|
+
backgroundColor: N
|
|
1200
1333
|
},
|
|
1201
1334
|
options: { duration: .7 }
|
|
1202
1335
|
},
|
|
1203
1336
|
exit: {
|
|
1204
1337
|
value: {
|
|
1205
1338
|
opacity: 0,
|
|
1206
|
-
backgroundColor:
|
|
1339
|
+
backgroundColor: N
|
|
1207
1340
|
},
|
|
1208
1341
|
options: { duration: .6 }
|
|
1209
1342
|
},
|
|
@@ -1212,10 +1345,10 @@ var P = "rgba(0, 0, 0, 0.3)", pe = de({
|
|
|
1212
1345
|
onSwipe: (e, t, { animate: n, prevDecorator: r }) => n(r, { opacity: Math.max(0, 1 - t / 100) }, { duration: 0 }),
|
|
1213
1346
|
onSwipeEnd: (e, { animate: t, prevDecorator: n }) => t(n, { opacity: +!e }, { duration: .3 })
|
|
1214
1347
|
}
|
|
1215
|
-
}),
|
|
1348
|
+
}), P = new Map([["overlay", De]]);
|
|
1216
1349
|
//#endregion
|
|
1217
1350
|
//#region src/transition/partTransition/createPartTransition.ts
|
|
1218
|
-
function
|
|
1351
|
+
function Oe({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
1219
1352
|
return {
|
|
1220
1353
|
name: e,
|
|
1221
1354
|
initial: t,
|
|
@@ -1236,7 +1369,7 @@ function me({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
|
1236
1369
|
}
|
|
1237
1370
|
//#endregion
|
|
1238
1371
|
//#region src/transition/partTransition/createRawPartTransition.ts
|
|
1239
|
-
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 }) {
|
|
1240
1373
|
return {
|
|
1241
1374
|
name: e,
|
|
1242
1375
|
initial: t,
|
|
@@ -1257,7 +1390,7 @@ function he({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
1257
1390
|
}
|
|
1258
1391
|
//#endregion
|
|
1259
1392
|
//#region src/transition/partTransition/partTransition.ts
|
|
1260
|
-
var
|
|
1393
|
+
var F = /* @__PURE__ */ new Map(), I = {
|
|
1261
1394
|
"IDLE-true": "self",
|
|
1262
1395
|
"IDLE-false": "self",
|
|
1263
1396
|
"PUSHING-true": "initial",
|
|
@@ -1268,7 +1401,7 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1268
1401
|
"POPPING-false": "PUSHING-false",
|
|
1269
1402
|
"COMPLETED-true": "self",
|
|
1270
1403
|
"COMPLETED-false": "self"
|
|
1271
|
-
},
|
|
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([
|
|
1272
1405
|
"x",
|
|
1273
1406
|
"y",
|
|
1274
1407
|
"z",
|
|
@@ -1279,7 +1412,7 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1279
1412
|
"rotateX",
|
|
1280
1413
|
"rotateY",
|
|
1281
1414
|
"rotateZ"
|
|
1282
|
-
]),
|
|
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) => {
|
|
1283
1416
|
switch (e) {
|
|
1284
1417
|
case "x": return `translateX(${t})`;
|
|
1285
1418
|
case "y": return `translateY(${t})`;
|
|
@@ -1293,23 +1426,23 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1293
1426
|
case "rotateY": return `rotateY(${t})`;
|
|
1294
1427
|
default: return "";
|
|
1295
1428
|
}
|
|
1296
|
-
},
|
|
1429
|
+
}, We = (e) => {
|
|
1297
1430
|
let t = /* @__PURE__ */ new Set(), n = !1, r = (e) => {
|
|
1298
|
-
if (
|
|
1431
|
+
if (Ne(e)) for (let r of Object.keys(e)) {
|
|
1299
1432
|
let i = e[r];
|
|
1300
|
-
|
|
1433
|
+
Ie(r, i) !== "" && (Re.has(r) ? n = !0 : t.add(Le(r)));
|
|
1301
1434
|
}
|
|
1302
1435
|
};
|
|
1303
1436
|
r(e.initial);
|
|
1304
1437
|
for (let t of Object.values(e.variants)) r(t.value);
|
|
1305
1438
|
return n && t.add("transform"), Array.from(t);
|
|
1306
|
-
},
|
|
1307
|
-
if (!
|
|
1439
|
+
}, L = (e) => {
|
|
1440
|
+
if (!Ne(e)) return [];
|
|
1308
1441
|
let t = [], n = !0, r = [];
|
|
1309
1442
|
for (let i of Object.keys(e)) {
|
|
1310
|
-
let a = e[i], o =
|
|
1311
|
-
o !== "" && (
|
|
1312
|
-
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),
|
|
1313
1446
|
value: o
|
|
1314
1447
|
}));
|
|
1315
1448
|
}
|
|
@@ -1317,7 +1450,7 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1317
1450
|
property: "transform",
|
|
1318
1451
|
value: n ? "none" : t.join(" ")
|
|
1319
1452
|
}), r;
|
|
1320
|
-
},
|
|
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" ? {
|
|
1321
1454
|
linear: "linear",
|
|
1322
1455
|
easeIn: "ease-in",
|
|
1323
1456
|
easeOut: "ease-out",
|
|
@@ -1327,33 +1460,33 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1327
1460
|
backIn: "cubic-bezier(0.31, 0.01, 0.66, -0.59)",
|
|
1328
1461
|
backOut: "cubic-bezier(0.33, 1.53, 0.69, 0.99)",
|
|
1329
1462
|
anticipate: "cubic-bezier(0.36, 0, 0.66, -0.56)"
|
|
1330
|
-
}[e] ?? "ease" : "ease",
|
|
1463
|
+
}[e] ?? "ease" : "ease", Ge = (e) => {
|
|
1331
1464
|
if (!e) return 0;
|
|
1332
1465
|
let t = e.duration;
|
|
1333
1466
|
return typeof t == "number" && t >= 0 ? t : 0;
|
|
1334
|
-
},
|
|
1467
|
+
}, Ke = (e) => e && typeof e.delay == "number" && e.delay > 0 ? e.delay : 0, qe = (e, t) => {
|
|
1335
1468
|
let [n, r] = t.split("-");
|
|
1336
1469
|
return `[data-flemo-screen][data-flemo-transition="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1337
|
-
},
|
|
1470
|
+
}, Je = (e, t) => {
|
|
1338
1471
|
let [n, r] = t.split("-");
|
|
1339
1472
|
return `[data-flemo-decorator][data-flemo-decorator-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1340
|
-
},
|
|
1473
|
+
}, Ye = (e, t) => {
|
|
1341
1474
|
let [n, r] = t.split("-");
|
|
1342
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"]`;
|
|
1343
|
-
},
|
|
1476
|
+
}, Xe = (e, t) => {
|
|
1344
1477
|
let [n, r] = t.split("-");
|
|
1345
1478
|
return `[data-flemo-part-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1346
|
-
},
|
|
1347
|
-
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;
|
|
1348
1481
|
if (s.length === 0 && o.length === 0) return "";
|
|
1349
|
-
if (c <= 0 && l <= 0) return s.length === 0 ? "" : `${f} {\n${
|
|
1350
|
-
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 = [
|
|
1351
1484
|
`@keyframes ${p} {`,
|
|
1352
1485
|
" from {",
|
|
1353
|
-
|
|
1486
|
+
R(o).replace(/^/gm, " "),
|
|
1354
1487
|
" }",
|
|
1355
1488
|
" to {",
|
|
1356
|
-
|
|
1489
|
+
R(s).replace(/^/gm, " "),
|
|
1357
1490
|
" }",
|
|
1358
1491
|
"}"
|
|
1359
1492
|
].join("\n"), h = [
|
|
@@ -1363,90 +1496,96 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1363
1496
|
l > 0 ? `${l}s` : null,
|
|
1364
1497
|
"both"
|
|
1365
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];
|
|
1366
|
-
return `${m}\n${`${f} {\n animation: ${h};\n${_}${v === "PUSHING" || v === "REPLACING" ? " contain: layout;\n pointer-events: none;\n" : ""}}`}${e === "screen" && n.endsWith("-false") &&
|
|
1367
|
-
},
|
|
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) => {
|
|
1368
1501
|
if (!e) return !1;
|
|
1369
1502
|
if (e.opacity === 0) return !0;
|
|
1370
1503
|
let t = (e) => typeof e == "string" && e.trim().endsWith("%") && Math.abs(parseFloat(e)) >= 100;
|
|
1371
1504
|
return t(e.x) || t(e.y);
|
|
1372
|
-
},
|
|
1373
|
-
let i =
|
|
1374
|
-
return i.length === 0 ? "" : `${e(t, n)} {\n${
|
|
1375
|
-
},
|
|
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 = []) => {
|
|
1376
1509
|
let r = [];
|
|
1377
1510
|
for (let t of e) {
|
|
1378
1511
|
let e = t.name;
|
|
1379
|
-
for (let n of
|
|
1380
|
-
let i = t.variants[n], a =
|
|
1512
|
+
for (let n of Ae) {
|
|
1513
|
+
let i = t.variants[n], a = I[n];
|
|
1381
1514
|
if (a === "self") {
|
|
1382
|
-
r.push(
|
|
1515
|
+
r.push(H(qe, e, n, i));
|
|
1383
1516
|
continue;
|
|
1384
1517
|
}
|
|
1385
1518
|
let o = a === "initial" ? t.initial : t.variants[a].value;
|
|
1386
|
-
r.push(
|
|
1519
|
+
r.push(V("screen", e, n, o, i, qe));
|
|
1387
1520
|
}
|
|
1388
1521
|
}
|
|
1389
1522
|
for (let e of t) {
|
|
1390
1523
|
let t = e.name;
|
|
1391
|
-
for (let n of
|
|
1392
|
-
let i = e.variants[n], a =
|
|
1524
|
+
for (let n of je) {
|
|
1525
|
+
let i = e.variants[n], a = I[n];
|
|
1393
1526
|
if (a === "self") {
|
|
1394
|
-
r.push(
|
|
1527
|
+
r.push(H(Je, t, n, i));
|
|
1395
1528
|
continue;
|
|
1396
1529
|
}
|
|
1397
1530
|
let o = a === "initial" ? e.initial : e.variants[a].value;
|
|
1398
|
-
r.push(
|
|
1531
|
+
r.push(V("decorator", t, n, o, i, Je));
|
|
1399
1532
|
}
|
|
1400
1533
|
}
|
|
1401
1534
|
for (let e of n) {
|
|
1402
1535
|
let t = e.name;
|
|
1403
|
-
for (let n of
|
|
1404
|
-
let i = e.variants[n], a =
|
|
1536
|
+
for (let n of je) {
|
|
1537
|
+
let i = e.variants[n], a = I[n];
|
|
1405
1538
|
if (a === "self") {
|
|
1406
|
-
r.push(
|
|
1539
|
+
r.push(H(Xe, t, n, i));
|
|
1407
1540
|
continue;
|
|
1408
1541
|
}
|
|
1409
1542
|
let o = a === "initial" ? e.initial : e.variants[a].value;
|
|
1410
|
-
r.push(
|
|
1543
|
+
r.push(V("part", t, n, o, i, Xe));
|
|
1411
1544
|
}
|
|
1412
1545
|
}
|
|
1413
|
-
return [...r.filter((e) => e.length > 0),
|
|
1414
|
-
},
|
|
1546
|
+
return [...r.filter((e) => e.length > 0), $e].join("\n\n");
|
|
1547
|
+
}, $e = [
|
|
1415
1548
|
"[data-flemo-anim-hold=\"true\"],",
|
|
1416
1549
|
"[data-flemo-anim-hold=\"park\"],",
|
|
1417
1550
|
"[data-flemo-anim-hold=\"true\"] [data-flemo-part-name],",
|
|
1418
1551
|
"[data-flemo-anim-hold=\"park\"] [data-flemo-part-name] {",
|
|
1419
1552
|
" animation-play-state: paused !important;",
|
|
1420
1553
|
"}"
|
|
1421
|
-
].join("\n"),
|
|
1422
|
-
let n =
|
|
1554
|
+
].join("\n"), et = (e, t) => {
|
|
1555
|
+
let n = I[t];
|
|
1423
1556
|
if (n === "self") return !1;
|
|
1424
|
-
let r = e.variants[t], i =
|
|
1557
|
+
let r = e.variants[t], i = Ge(r.options), a = Ke(r.options);
|
|
1425
1558
|
if (i <= 0 && a <= 0) return !1;
|
|
1426
|
-
let o =
|
|
1559
|
+
let o = L(n === "initial" ? e.initial : e.variants[n].value), s = L(r.value);
|
|
1427
1560
|
return o.length > 0 || s.length > 0;
|
|
1428
|
-
},
|
|
1429
|
-
function
|
|
1430
|
-
if (
|
|
1431
|
-
let e =
|
|
1432
|
-
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);
|
|
1433
1566
|
}
|
|
1434
1567
|
//#endregion
|
|
1435
1568
|
//#region src/transition/registerTransitionDefinitions.ts
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
return
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
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();
|
|
1445
1584
|
};
|
|
1446
1585
|
}
|
|
1447
1586
|
//#endregion
|
|
1448
1587
|
//#region src/transition/enteringInitialStyle.ts
|
|
1449
|
-
function
|
|
1588
|
+
function ot(e) {
|
|
1450
1589
|
let { initial: t, isActive: n, status: r } = e;
|
|
1451
1590
|
if (!n || r !== "PUSHING" && r !== "REPLACING") return {};
|
|
1452
1591
|
let i = {};
|
|
@@ -1454,7 +1593,7 @@ function He(e) {
|
|
|
1454
1593
|
}
|
|
1455
1594
|
//#endregion
|
|
1456
1595
|
//#region src/transition/animateInline.ts
|
|
1457
|
-
var
|
|
1596
|
+
var st = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, K = /* @__PURE__ */ new WeakMap(), ct = (e, t) => {
|
|
1458
1597
|
let n = K.get(e);
|
|
1459
1598
|
n || (n = /* @__PURE__ */ new Set(), K.set(e, n)), n.add(t);
|
|
1460
1599
|
}, q = (e, t) => {
|
|
@@ -1471,18 +1610,18 @@ var Ue = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, K = /* @__
|
|
|
1471
1610
|
}
|
|
1472
1611
|
e.style.removeProperty("transform"), e.style.removeProperty("opacity");
|
|
1473
1612
|
}, J = (e, t, n = {}) => {
|
|
1474
|
-
if (!
|
|
1475
|
-
let r = e, i =
|
|
1613
|
+
if (!st(e)) return Promise.resolve();
|
|
1614
|
+
let r = e, i = L(t);
|
|
1476
1615
|
if (i.length === 0) return Promise.resolve();
|
|
1477
|
-
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);
|
|
1478
1617
|
if (a <= 0 && o <= 0) {
|
|
1479
1618
|
r.style.transition = "none";
|
|
1480
|
-
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);
|
|
1481
1620
|
return Promise.resolve();
|
|
1482
1621
|
}
|
|
1483
1622
|
let c = i.map((e) => `${e.property} ${a}s ${s} ${o}s`).join(", ");
|
|
1484
1623
|
r.style.transition = c, r.offsetWidth;
|
|
1485
|
-
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);
|
|
1486
1625
|
return new Promise((e) => {
|
|
1487
1626
|
let t = !1, n = () => {
|
|
1488
1627
|
t || (t = !0, r.removeEventListener("transitionend", i), e());
|
|
@@ -1492,26 +1631,26 @@ var Ue = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, K = /* @__
|
|
|
1492
1631
|
r.addEventListener("transitionend", i), setTimeout(n, (a + o) * 1e3 + 60);
|
|
1493
1632
|
});
|
|
1494
1633
|
}, Y = "data-flemo-skip-animation", X = () => {};
|
|
1495
|
-
function
|
|
1634
|
+
function lt(e) {
|
|
1496
1635
|
return { driveScreenLifecycle: (t) => {
|
|
1497
|
-
let { getElements: n, transitionName: r, prevTransitionName: i, status:
|
|
1498
|
-
if (!s) return
|
|
1499
|
-
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") {
|
|
1500
1639
|
e.setDragStatus("IDLE"), e.setReplaceTransitionStatus("IDLE");
|
|
1501
1640
|
let { scope: t, decorator: r, bars: i } = n();
|
|
1502
1641
|
t && (q(t), t.removeAttribute(Y)), r && (q(r), r.removeAttribute(Y));
|
|
1503
1642
|
for (let e of i ?? []) e && (q(e), e.style.removeProperty("will-change"));
|
|
1504
1643
|
return X;
|
|
1505
1644
|
}
|
|
1506
|
-
if (
|
|
1645
|
+
if (a === "IDLE") return X;
|
|
1507
1646
|
let { scope: c } = n();
|
|
1508
1647
|
if (!c) return X;
|
|
1509
1648
|
let l = () => {
|
|
1510
1649
|
let t = e.getTransitionTaskId();
|
|
1511
|
-
t &&
|
|
1512
|
-
}, u =
|
|
1513
|
-
if (!(c.getAttribute("data-flemo-skip-animation") !== "true" &&
|
|
1514
|
-
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) => {
|
|
1515
1654
|
e.target === c && e.animationName === f && (c.removeEventListener("animationend", p), l());
|
|
1516
1655
|
};
|
|
1517
1656
|
return c.addEventListener("animationend", p), () => {
|
|
@@ -1522,7 +1661,7 @@ function Ge(e) {
|
|
|
1522
1661
|
//#endregion
|
|
1523
1662
|
//#region src/utils/findScrollable.ts
|
|
1524
1663
|
function Z(e, t) {
|
|
1525
|
-
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);
|
|
1526
1665
|
if (!o) return {
|
|
1527
1666
|
element: null,
|
|
1528
1667
|
hasMarker: !1
|
|
@@ -1545,7 +1684,7 @@ function Z(e, t) {
|
|
|
1545
1684
|
hasMarker: !1
|
|
1546
1685
|
};
|
|
1547
1686
|
}
|
|
1548
|
-
function
|
|
1687
|
+
function ut(e) {
|
|
1549
1688
|
if (!e) return null;
|
|
1550
1689
|
let t = e, n = typeof t.composedPath == "function" ? t.composedPath() : void 0;
|
|
1551
1690
|
if (n && n.length) {
|
|
@@ -1563,8 +1702,8 @@ function $(e, t) {
|
|
|
1563
1702
|
}
|
|
1564
1703
|
//#endregion
|
|
1565
1704
|
//#region src/core/engine/createSwipeController.ts
|
|
1566
|
-
var
|
|
1567
|
-
function
|
|
1705
|
+
var dt = "data-flemo-skip-animation";
|
|
1706
|
+
function ft(e) {
|
|
1568
1707
|
let t = null, n = null, r = {
|
|
1569
1708
|
current: [],
|
|
1570
1709
|
prev: []
|
|
@@ -1626,7 +1765,7 @@ function Je(e) {
|
|
|
1626
1765
|
current: i,
|
|
1627
1766
|
prev: s
|
|
1628
1767
|
};
|
|
1629
|
-
let c =
|
|
1768
|
+
let c = We(e.getTransition()).join(", ");
|
|
1630
1769
|
for (let e of i) e.style.willChange = c;
|
|
1631
1770
|
for (let e of s) e.style.willChange = c;
|
|
1632
1771
|
}, b = () => {
|
|
@@ -1644,7 +1783,7 @@ function Je(e) {
|
|
|
1644
1783
|
};
|
|
1645
1784
|
}, S = (e, t, n) => {
|
|
1646
1785
|
let r = (r, i) => {
|
|
1647
|
-
let a =
|
|
1786
|
+
let a = F.get(r.getAttribute("data-flemo-part-name"));
|
|
1648
1787
|
if (!a) return;
|
|
1649
1788
|
let o = {
|
|
1650
1789
|
animate: J,
|
|
@@ -1727,7 +1866,7 @@ function Je(e) {
|
|
|
1727
1866
|
}), S("end", e, 0);
|
|
1728
1867
|
}
|
|
1729
1868
|
})) {
|
|
1730
|
-
c?.setAttribute(
|
|
1869
|
+
c?.setAttribute(dt, "true"), l?.setAttribute(dt, "true");
|
|
1731
1870
|
for (let e of r.current) e.style.removeProperty("will-change");
|
|
1732
1871
|
for (let e of r.prev) q(e), e.style.removeProperty("will-change");
|
|
1733
1872
|
r = {
|
|
@@ -1775,7 +1914,7 @@ function Je(e) {
|
|
|
1775
1914
|
}
|
|
1776
1915
|
//#endregion
|
|
1777
1916
|
//#region src/screen/computeBarRiding.ts
|
|
1778
|
-
function
|
|
1917
|
+
function pt(e) {
|
|
1779
1918
|
return !(e.status === "PUSHING" || e.status === "POPPING" || e.status === "REPLACING") || !e.isTopOrTopPrev ? {
|
|
1780
1919
|
app: !1,
|
|
1781
1920
|
nav: !1
|
|
@@ -1786,24 +1925,24 @@ function Ye(e) {
|
|
|
1786
1925
|
}
|
|
1787
1926
|
//#endregion
|
|
1788
1927
|
//#region src/screen/animStartAnchor.ts
|
|
1789
|
-
function
|
|
1928
|
+
function mt(e) {
|
|
1790
1929
|
return !(e.status === "PUSHING" || e.status === "POPPING" || e.status === "REPLACING") || !e.isTopOrTopPrev ? null : `${e.status}:${e.transitionName}`;
|
|
1791
1930
|
}
|
|
1792
|
-
var
|
|
1793
|
-
function
|
|
1794
|
-
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);
|
|
1795
1934
|
}
|
|
1796
|
-
function
|
|
1797
|
-
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(() => {});
|
|
1798
1937
|
}
|
|
1799
|
-
function
|
|
1938
|
+
function yt(e, t = {}) {
|
|
1800
1939
|
let n = !1, r = 0, i = () => {
|
|
1801
1940
|
let r = t.scope;
|
|
1802
1941
|
if (!r || typeof r.querySelectorAll != "function") {
|
|
1803
1942
|
e();
|
|
1804
1943
|
return;
|
|
1805
1944
|
}
|
|
1806
|
-
let i =
|
|
1945
|
+
let i = _t(r);
|
|
1807
1946
|
if (i.length === 0) {
|
|
1808
1947
|
e();
|
|
1809
1948
|
return;
|
|
@@ -1823,7 +1962,7 @@ function tt(e, t = {}) {
|
|
|
1823
1962
|
}
|
|
1824
1963
|
//#endregion
|
|
1825
1964
|
//#region src/screen/observeBarHeight.ts
|
|
1826
|
-
function
|
|
1965
|
+
function bt(e, t) {
|
|
1827
1966
|
e.offsetHeight > 0 && t(e.offsetHeight);
|
|
1828
1967
|
let n = new ResizeObserver(([e]) => {
|
|
1829
1968
|
e.contentRect.height > 0 && t(e.contentRect.height);
|
|
@@ -1834,14 +1973,14 @@ function nt(e, t) {
|
|
|
1834
1973
|
}
|
|
1835
1974
|
//#endregion
|
|
1836
1975
|
//#region src/screen/observeViewportScrollHeight.ts
|
|
1837
|
-
var
|
|
1838
|
-
function
|
|
1976
|
+
var xt = 0;
|
|
1977
|
+
function St(e) {
|
|
1839
1978
|
let t = 0, n = () => {
|
|
1840
1979
|
cancelAnimationFrame(t), t = requestAnimationFrame(() => {
|
|
1841
1980
|
let t = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
|
|
1842
1981
|
t = t < 0 ? 0 : t;
|
|
1843
|
-
let n = t -
|
|
1844
|
-
n = n < 0 ? 0 : n,
|
|
1982
|
+
let n = t - xt;
|
|
1983
|
+
n = n < 0 ? 0 : n, xt ||= t, e(t, n);
|
|
1845
1984
|
});
|
|
1846
1985
|
};
|
|
1847
1986
|
return window.visualViewport?.addEventListener("resize", n), window.visualViewport?.addEventListener("scroll", n), () => {
|
|
@@ -1849,13 +1988,8 @@ function it(e) {
|
|
|
1849
1988
|
};
|
|
1850
1989
|
}
|
|
1851
1990
|
//#endregion
|
|
1852
|
-
//#region src/utils/matchesPathname.ts
|
|
1853
|
-
function at(e, t) {
|
|
1854
|
-
return i(e).regexp.test(t);
|
|
1855
|
-
}
|
|
1856
|
-
//#endregion
|
|
1857
1991
|
//#region src/utils/isOpaqueColor.ts
|
|
1858
|
-
function
|
|
1992
|
+
function Ct(e) {
|
|
1859
1993
|
let t = e.trim().toLowerCase();
|
|
1860
1994
|
if (t === "transparent" || t === "") return !1;
|
|
1861
1995
|
if (t.match(/^rgb\(\s*\d+[\s,]+\d+[\s,]+\d+\s*\)$/)) return !0;
|
|
@@ -1866,7 +2000,7 @@ function ot(e) {
|
|
|
1866
2000
|
}
|
|
1867
2001
|
//#endregion
|
|
1868
2002
|
//#region src/utils/buildRoutePath.ts
|
|
1869
|
-
function
|
|
2003
|
+
function wt(e, n) {
|
|
1870
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();
|
|
1871
2005
|
return {
|
|
1872
2006
|
pathname: `${a}${c ? `?${c}` : ""}`,
|
|
@@ -1874,4 +2008,4 @@ function st(e, n) {
|
|
|
1874
2008
|
};
|
|
1875
2009
|
}
|
|
1876
2010
|
//#endregion
|
|
1877
|
-
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 };
|