@flemo/core 1.11.0 → 1.12.0
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/history/store.d.ts +2 -0
- package/dist/index.mjs +156 -149
- package/package.json +1 -1
package/dist/history/store.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface HistoryStore {
|
|
|
19
19
|
setPendingIndex: (index: number) => void;
|
|
20
20
|
adoptHistory: (history: History) => void;
|
|
21
21
|
truncateHistory: (position: number) => void;
|
|
22
|
+
truncationEpoch: number;
|
|
23
|
+
bumpTruncationEpoch: () => void;
|
|
22
24
|
setTransitionName: (index: number, transitionName: TransitionName) => void;
|
|
23
25
|
}
|
|
24
26
|
export type HistoryStoreApi = StoreApi<HistoryStore>;
|
package/dist/index.mjs
CHANGED
|
@@ -212,6 +212,8 @@ function o(t = [], n = -1) {
|
|
|
212
212
|
pendingIndex: t,
|
|
213
213
|
histories: e.histories.slice(0, t + 1)
|
|
214
214
|
})),
|
|
215
|
+
truncationEpoch: 0,
|
|
216
|
+
bumpTruncationEpoch: () => e((e) => ({ truncationEpoch: e.truncationEpoch + 1 })),
|
|
215
217
|
setTransitionName: (t, n) => e((e) => {
|
|
216
218
|
let r = e.histories[t];
|
|
217
219
|
if (!r || r.transitionName === n) return {};
|
|
@@ -338,27 +340,27 @@ function _() {
|
|
|
338
340
|
function v(e) {
|
|
339
341
|
let { stores: t, driver: n = p(), consume: r = _ } = e, i = !1, o = n.subscribe(async (e) => {
|
|
340
342
|
if (i || r()) return;
|
|
341
|
-
let o = e.state, s = a.generateTaskId();
|
|
343
|
+
let o = e.state, s = t.history.getState().truncationEpoch, c = a.generateTaskId();
|
|
342
344
|
(await a.addTask(async (r) => {
|
|
343
345
|
if (i) {
|
|
344
346
|
r.abort();
|
|
345
347
|
return;
|
|
346
348
|
}
|
|
347
|
-
|
|
349
|
+
let { setStatus: a, setTransitionTaskId: l } = t.navigate.getState(), { index: u, histories: d, addHistory: f, popHistory: p, popHistories: m, setPendingIndex: h } = t.history.getState();
|
|
350
|
+
if (s !== t.history.getState().truncationEpoch && n.readState()?.id !== e.state?.id) {
|
|
348
351
|
r.abort();
|
|
349
352
|
return;
|
|
350
353
|
}
|
|
351
|
-
let { setStatus: a, setTransitionTaskId: c } = t.navigate.getState(), { index: l, histories: u, addHistory: d, popHistory: f, popHistories: p, setPendingIndex: m } = t.history.getState();
|
|
352
354
|
if (!o?.id) {
|
|
353
355
|
r.abort();
|
|
354
356
|
return;
|
|
355
357
|
}
|
|
356
|
-
let
|
|
357
|
-
if (
|
|
358
|
+
let g = d.findIndex((e) => e.id === o.id);
|
|
359
|
+
if (g === u) {
|
|
358
360
|
r.abort();
|
|
359
361
|
return;
|
|
360
362
|
}
|
|
361
|
-
let
|
|
363
|
+
let _ = {
|
|
362
364
|
id: o.id,
|
|
363
365
|
pathname: e.pathname,
|
|
364
366
|
params: o.params,
|
|
@@ -366,22 +368,22 @@ function v(e) {
|
|
|
366
368
|
layoutId: o.layoutId,
|
|
367
369
|
frameIndex: o.index
|
|
368
370
|
};
|
|
369
|
-
if (
|
|
370
|
-
let e = u
|
|
371
|
+
if (g === -1) {
|
|
372
|
+
let e = d[u]?.frameIndex ?? u;
|
|
371
373
|
if (!(o.index > e && (o.status === "PUSHING" || o.status === "REPLACING"))) {
|
|
372
|
-
t.history.getState().adoptHistory(
|
|
374
|
+
t.history.getState().adoptHistory(_), r.abort();
|
|
373
375
|
return;
|
|
374
376
|
}
|
|
375
|
-
return c
|
|
377
|
+
return l(c), a(o.status === "REPLACING" ? "REPLACING" : "PUSHING"), f(_), async () => {
|
|
376
378
|
a("COMPLETED");
|
|
377
379
|
};
|
|
378
380
|
}
|
|
379
|
-
let
|
|
380
|
-
return c
|
|
381
|
-
|
|
381
|
+
let v = u - g - 1;
|
|
382
|
+
return l(c), v > 0 && m(v), h(g), a("POPPING"), async () => {
|
|
383
|
+
p(g + 1), a("COMPLETED");
|
|
382
384
|
};
|
|
383
385
|
}, {
|
|
384
|
-
id:
|
|
386
|
+
id: c,
|
|
385
387
|
control: { manual: !0 }
|
|
386
388
|
})).result?.();
|
|
387
389
|
});
|
|
@@ -456,7 +458,7 @@ var x = (e, t, n) => {
|
|
|
456
458
|
i(), s && r();
|
|
457
459
|
};
|
|
458
460
|
function w(e) {
|
|
459
|
-
let { stores: t, buildPathname: n, driver: r = p(), markSelfInduced: i = g } = e, o = () => {
|
|
461
|
+
let { stores: t, buildPathname: n, driver: r = p(), markSelfInduced: i = g } = e, o = () => t.history.getState().bumpTruncationEpoch(), s = () => {
|
|
460
462
|
let e = r.readState();
|
|
461
463
|
if (!e?.id) return null;
|
|
462
464
|
let { index: n, histories: i, adoptHistory: a, truncateHistory: o } = t.history.getState();
|
|
@@ -470,142 +472,142 @@ function w(e) {
|
|
|
470
472
|
layoutId: e.layoutId ?? null,
|
|
471
473
|
frameIndex: e.index
|
|
472
474
|
}), e;
|
|
473
|
-
},
|
|
474
|
-
let { status:
|
|
475
|
-
if (
|
|
476
|
-
let
|
|
475
|
+
}, c = async (e, c, l) => {
|
|
476
|
+
let { status: u } = t.navigate.getState();
|
|
477
|
+
if (u !== "COMPLETED" && u !== "IDLE") return;
|
|
478
|
+
let d = t.transition.getState().defaultTransitionName, { transitionName: f = d, layoutId: p = null } = l ?? {}, m = a.generateTaskId();
|
|
477
479
|
(await a.addTask(async (a) => {
|
|
478
480
|
if (t.life && !t.life.alive) {
|
|
479
481
|
a.abort();
|
|
480
482
|
return;
|
|
481
483
|
}
|
|
482
|
-
let
|
|
483
|
-
if (
|
|
484
|
-
let e = x(
|
|
484
|
+
let u = s(), { index: d, histories: h, addHistory: g, popHistories: _ } = t.history.getState(), v = (() => {
|
|
485
|
+
if (l?.until != null) {
|
|
486
|
+
let e = x(l.until, d, h);
|
|
485
487
|
return e < 0 ? 0 : e;
|
|
486
488
|
}
|
|
487
|
-
return Math.min(S(
|
|
488
|
-
})(), { setStatus:
|
|
489
|
-
|
|
490
|
-
let { pathname:
|
|
491
|
-
id:
|
|
492
|
-
pathname:
|
|
493
|
-
params:
|
|
494
|
-
transitionName:
|
|
495
|
-
layoutId:
|
|
496
|
-
},
|
|
497
|
-
if (
|
|
498
|
-
id:
|
|
499
|
-
index:
|
|
489
|
+
return Math.min(S(l?.skip, 0), Math.max(0, d));
|
|
490
|
+
})(), { setStatus: y, setTransitionTaskId: b } = t.navigate.getState();
|
|
491
|
+
y("PUSHING"), b(m);
|
|
492
|
+
let { pathname: w, toPathname: T } = n(e, c ?? {}), E = {
|
|
493
|
+
id: m,
|
|
494
|
+
pathname: T,
|
|
495
|
+
params: c ?? {},
|
|
496
|
+
transitionName: f,
|
|
497
|
+
layoutId: p
|
|
498
|
+
}, D = u?.index ?? h[d]?.frameIndex ?? d;
|
|
499
|
+
if (v === 0) return o(), r.pushState({
|
|
500
|
+
id: m,
|
|
501
|
+
index: D + 1,
|
|
500
502
|
status: "PUSHING",
|
|
501
|
-
params:
|
|
502
|
-
transitionName:
|
|
503
|
-
layoutId:
|
|
504
|
-
},
|
|
505
|
-
...
|
|
506
|
-
frameIndex:
|
|
503
|
+
params: c,
|
|
504
|
+
transitionName: f,
|
|
505
|
+
layoutId: p
|
|
506
|
+
}, w), g({
|
|
507
|
+
...E,
|
|
508
|
+
frameIndex: D + 1
|
|
507
509
|
}), () => {
|
|
508
|
-
|
|
510
|
+
y("COMPLETED");
|
|
509
511
|
};
|
|
510
|
-
let
|
|
511
|
-
return
|
|
512
|
-
...
|
|
513
|
-
frameIndex:
|
|
514
|
-
}), await C(r, i,
|
|
515
|
-
r.pushState({
|
|
516
|
-
id:
|
|
517
|
-
index:
|
|
512
|
+
let O = h[d - v]?.frameIndex ?? d - v;
|
|
513
|
+
return g({
|
|
514
|
+
...E,
|
|
515
|
+
frameIndex: O + 1
|
|
516
|
+
}), await C(r, i, v, () => {
|
|
517
|
+
o(), r.pushState({
|
|
518
|
+
id: m,
|
|
519
|
+
index: O + 1,
|
|
518
520
|
status: "PUSHING",
|
|
519
|
-
params:
|
|
520
|
-
transitionName:
|
|
521
|
-
layoutId:
|
|
522
|
-
},
|
|
521
|
+
params: c,
|
|
522
|
+
transitionName: f,
|
|
523
|
+
layoutId: p
|
|
524
|
+
}, w);
|
|
523
525
|
}), async () => {
|
|
524
|
-
|
|
526
|
+
_(v), y("COMPLETED");
|
|
525
527
|
};
|
|
526
528
|
}, {
|
|
527
|
-
id:
|
|
529
|
+
id: m,
|
|
528
530
|
control: { manual: !0 }
|
|
529
531
|
})).result?.();
|
|
530
|
-
},
|
|
531
|
-
let { status:
|
|
532
|
-
if (
|
|
533
|
-
let
|
|
532
|
+
}, l = async (e, c, l) => {
|
|
533
|
+
let { status: u } = t.navigate.getState();
|
|
534
|
+
if (u !== "COMPLETED" && u !== "IDLE") return;
|
|
535
|
+
let d = t.transition.getState().defaultTransitionName, { transitionName: f = d, layoutId: p = null } = l ?? {}, m = a.generateTaskId();
|
|
534
536
|
(await a.addTask(async (a) => {
|
|
535
537
|
if (t.life && !t.life.alive) {
|
|
536
538
|
a.abort();
|
|
537
539
|
return;
|
|
538
540
|
}
|
|
539
|
-
let
|
|
540
|
-
if (
|
|
541
|
-
let e = x(
|
|
541
|
+
let u = s(), { index: d, histories: h, addHistory: g, replaceHistory: _, popHistories: v } = t.history.getState(), y = (() => {
|
|
542
|
+
if (l?.until != null) {
|
|
543
|
+
let e = x(l.until, d, h);
|
|
542
544
|
return e < 0 ? 0 : e + 1;
|
|
543
545
|
}
|
|
544
|
-
return Math.min(S(
|
|
546
|
+
return Math.min(S(l?.skip, 0) + 1, d + 1);
|
|
545
547
|
})();
|
|
546
|
-
if (
|
|
548
|
+
if (y <= 0) {
|
|
547
549
|
a.abort();
|
|
548
550
|
return;
|
|
549
551
|
}
|
|
550
|
-
let { setStatus:
|
|
551
|
-
|
|
552
|
-
let { pathname:
|
|
553
|
-
id:
|
|
554
|
-
pathname:
|
|
555
|
-
params:
|
|
556
|
-
transitionName:
|
|
557
|
-
layoutId:
|
|
558
|
-
},
|
|
559
|
-
if (
|
|
560
|
-
id:
|
|
561
|
-
index:
|
|
552
|
+
let { setStatus: b, setTransitionTaskId: w } = t.navigate.getState();
|
|
553
|
+
b("REPLACING"), w(m);
|
|
554
|
+
let { pathname: T, toPathname: E } = n(e, c ?? {}), D = {
|
|
555
|
+
id: m,
|
|
556
|
+
pathname: E,
|
|
557
|
+
params: c ?? {},
|
|
558
|
+
transitionName: f,
|
|
559
|
+
layoutId: p
|
|
560
|
+
}, O = u?.index ?? h[d]?.frameIndex ?? d;
|
|
561
|
+
if (y === 1) return o(), r.replaceState({
|
|
562
|
+
id: m,
|
|
563
|
+
index: O,
|
|
562
564
|
status: "REPLACING",
|
|
563
|
-
params:
|
|
564
|
-
transitionName:
|
|
565
|
-
layoutId:
|
|
566
|
-
},
|
|
567
|
-
...
|
|
568
|
-
frameIndex:
|
|
565
|
+
params: c,
|
|
566
|
+
transitionName: f,
|
|
567
|
+
layoutId: p
|
|
568
|
+
}, T), g({
|
|
569
|
+
...D,
|
|
570
|
+
frameIndex: O
|
|
569
571
|
}), async () => {
|
|
570
|
-
|
|
572
|
+
_(d), b("COMPLETED");
|
|
571
573
|
};
|
|
572
|
-
let
|
|
573
|
-
return
|
|
574
|
-
...
|
|
575
|
-
frameIndex:
|
|
576
|
-
}),
|
|
577
|
-
r.pushState({
|
|
578
|
-
id:
|
|
579
|
-
index:
|
|
574
|
+
let k = y <= d ? (h[d - y]?.frameIndex ?? d - y) + 1 : h[0]?.frameIndex ?? 0;
|
|
575
|
+
return v(y - 1), g({
|
|
576
|
+
...D,
|
|
577
|
+
frameIndex: k
|
|
578
|
+
}), y <= d ? await C(r, i, y, () => {
|
|
579
|
+
o(), r.pushState({
|
|
580
|
+
id: m,
|
|
581
|
+
index: k,
|
|
580
582
|
status: "REPLACING",
|
|
581
|
-
params:
|
|
582
|
-
transitionName:
|
|
583
|
-
layoutId:
|
|
584
|
-
},
|
|
585
|
-
}) : await C(r, i,
|
|
586
|
-
r.replaceState({
|
|
587
|
-
id:
|
|
588
|
-
index:
|
|
583
|
+
params: c,
|
|
584
|
+
transitionName: f,
|
|
585
|
+
layoutId: p
|
|
586
|
+
}, T);
|
|
587
|
+
}) : await C(r, i, d, () => {
|
|
588
|
+
o(), r.replaceState({
|
|
589
|
+
id: m,
|
|
590
|
+
index: k,
|
|
589
591
|
status: "REPLACING",
|
|
590
|
-
params:
|
|
591
|
-
transitionName:
|
|
592
|
-
layoutId:
|
|
593
|
-
},
|
|
592
|
+
params: c,
|
|
593
|
+
transitionName: f,
|
|
594
|
+
layoutId: p
|
|
595
|
+
}, T);
|
|
594
596
|
}), async () => {
|
|
595
|
-
|
|
597
|
+
_(t.history.getState().index - 1), b("COMPLETED");
|
|
596
598
|
};
|
|
597
599
|
}, {
|
|
598
|
-
id:
|
|
600
|
+
id: m,
|
|
599
601
|
control: { manual: !0 }
|
|
600
602
|
})).result?.();
|
|
601
|
-
},
|
|
602
|
-
let
|
|
603
|
+
}, u = async (e, n) => {
|
|
604
|
+
let o = a.generateTaskId();
|
|
603
605
|
(await a.addTask(async (a) => {
|
|
604
606
|
if (t.life && !t.life.alive) {
|
|
605
607
|
a.abort();
|
|
606
608
|
return;
|
|
607
609
|
}
|
|
608
|
-
|
|
610
|
+
s();
|
|
609
611
|
let { index: c, histories: l, popHistory: u, popHistories: d, setPendingIndex: f, setTransitionName: p } = t.history.getState();
|
|
610
612
|
if (c <= 0) {
|
|
611
613
|
a.abort();
|
|
@@ -618,19 +620,19 @@ function w(e) {
|
|
|
618
620
|
}
|
|
619
621
|
f(c - m);
|
|
620
622
|
let { setStatus: h, setTransitionTaskId: g } = t.navigate.getState();
|
|
621
|
-
return n && p(c, n), h("POPPING"), g(
|
|
623
|
+
return n && p(c, n), h("POPPING"), g(o), d(m - 1), i(), m === 1 ? r.back() : r.go(-m), async () => {
|
|
622
624
|
u(t.history.getState().index), h("COMPLETED");
|
|
623
625
|
};
|
|
624
626
|
}, {
|
|
625
|
-
id:
|
|
627
|
+
id: o,
|
|
626
628
|
control: { manual: !0 }
|
|
627
629
|
})).result?.();
|
|
628
630
|
};
|
|
629
631
|
return {
|
|
630
|
-
push:
|
|
631
|
-
replace:
|
|
632
|
+
push: c,
|
|
633
|
+
replace: l,
|
|
632
634
|
pop: async (e) => {
|
|
633
|
-
await
|
|
635
|
+
await u((t, n) => {
|
|
634
636
|
if (e?.until != null) {
|
|
635
637
|
let r = x(e.until, t, n);
|
|
636
638
|
return r < 0 ? 0 : r;
|
|
@@ -715,7 +717,7 @@ function O(e, t) {
|
|
|
715
717
|
}
|
|
716
718
|
//#endregion
|
|
717
719
|
//#region src/transition/store.ts
|
|
718
|
-
function
|
|
720
|
+
function k(t = "cupertino") {
|
|
719
721
|
return e((e) => ({
|
|
720
722
|
defaultTransitionName: t,
|
|
721
723
|
setDefaultTransitionName: (t) => e({ defaultTransitionName: t })
|
|
@@ -723,7 +725,7 @@ function ee(t = "cupertino") {
|
|
|
723
725
|
}
|
|
724
726
|
//#endregion
|
|
725
727
|
//#region src/screen/store.ts
|
|
726
|
-
function
|
|
728
|
+
function A() {
|
|
727
729
|
return e((e) => ({
|
|
728
730
|
dragStatus: "IDLE",
|
|
729
731
|
replaceTransitionStatus: "IDLE",
|
|
@@ -754,14 +756,19 @@ function k() {
|
|
|
754
756
|
}
|
|
755
757
|
//#endregion
|
|
756
758
|
//#region src/core/createRouterScope.ts
|
|
757
|
-
var
|
|
759
|
+
var ee = {
|
|
758
760
|
mark: () => {},
|
|
759
761
|
consume: () => !1
|
|
760
762
|
};
|
|
761
|
-
function
|
|
762
|
-
let { routePaths: t, pathname: n, search: r, defaultTransitionName: i, memory: a, browserDriver: s } = e, c = l(t, n, r, i), d = s && !u() ? s.readState()
|
|
763
|
+
function te(e) {
|
|
764
|
+
let { routePaths: t, pathname: n, search: r, defaultTransitionName: i, memory: a, browserDriver: s } = e, c = l(t, n, r, i), d = s && !u() ? s.readState() : null, f = d?.id ? {
|
|
765
|
+
...c,
|
|
766
|
+
id: d.id,
|
|
767
|
+
params: d.params ?? c.params,
|
|
768
|
+
frameIndex: d.index ?? 0
|
|
769
|
+
} : {
|
|
763
770
|
...c,
|
|
764
|
-
frameIndex:
|
|
771
|
+
frameIndex: 0
|
|
765
772
|
};
|
|
766
773
|
if (e.hostedScope) return e.hostedScope.life.alive = !0, e.hostedScope.history.getState().index === -1 && e.hostedScope.history.setState({
|
|
767
774
|
index: 0,
|
|
@@ -777,12 +784,12 @@ function ne(e) {
|
|
|
777
784
|
layoutId: f.layoutId
|
|
778
785
|
},
|
|
779
786
|
url: f.pathname
|
|
780
|
-
}) : s, h = a ?
|
|
787
|
+
}) : s, h = a ? ee : m();
|
|
781
788
|
return {
|
|
782
789
|
history: o([f], 0),
|
|
783
790
|
navigate: b(),
|
|
784
|
-
transition:
|
|
785
|
-
screen:
|
|
791
|
+
transition: k(i),
|
|
792
|
+
screen: A(),
|
|
786
793
|
driver: p,
|
|
787
794
|
markSelfInduced: h.mark,
|
|
788
795
|
consume: h.consume,
|
|
@@ -791,7 +798,7 @@ function ne(e) {
|
|
|
791
798
|
}
|
|
792
799
|
//#endregion
|
|
793
800
|
//#region src/screen/createScreenSelector.ts
|
|
794
|
-
function
|
|
801
|
+
function ne(e, t) {
|
|
795
802
|
return e.map((n, r) => ({
|
|
796
803
|
...n,
|
|
797
804
|
isActive: r === t,
|
|
@@ -804,13 +811,13 @@ function re(e, t) {
|
|
|
804
811
|
}
|
|
805
812
|
//#endregion
|
|
806
813
|
//#region src/screen/computeScreenFreeze.ts
|
|
807
|
-
function
|
|
814
|
+
function re(e) {
|
|
808
815
|
let t = e.status === "COMPLETED" && e.dragStatus === "IDLE";
|
|
809
816
|
return !e.isActive && t || e.isPrev && e.index - 2 <= e.zIndex && e.replaceTransitionStatus === "IDLE" || e.isPrev && e.index - 2 > e.zIndex;
|
|
810
817
|
}
|
|
811
818
|
//#endregion
|
|
812
819
|
//#region src/transition/createTransition.ts
|
|
813
|
-
function
|
|
820
|
+
function j({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exitBack: o, options: s }) {
|
|
814
821
|
return {
|
|
815
822
|
name: e,
|
|
816
823
|
initial: t,
|
|
@@ -831,7 +838,7 @@ function A({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exit
|
|
|
831
838
|
}
|
|
832
839
|
//#endregion
|
|
833
840
|
//#region src/transition/createRawTransition.ts
|
|
834
|
-
function
|
|
841
|
+
function ie({ 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
842
|
return {
|
|
836
843
|
name: e,
|
|
837
844
|
initial: t,
|
|
@@ -852,10 +859,10 @@ function ae({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
852
859
|
}
|
|
853
860
|
//#endregion
|
|
854
861
|
//#region src/transition/cupertino.ts
|
|
855
|
-
var
|
|
862
|
+
var ae = (e, t, n) => {
|
|
856
863
|
let [r, i] = t, [a, o] = n;
|
|
857
864
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
858
|
-
},
|
|
865
|
+
}, oe = j({
|
|
859
866
|
name: "cupertino",
|
|
860
867
|
initial: { x: "100%" },
|
|
861
868
|
idle: {
|
|
@@ -915,7 +922,7 @@ var oe = (e, t, n) => {
|
|
|
915
922
|
swipeDirection: "x",
|
|
916
923
|
onSwipeStart: async () => !0,
|
|
917
924
|
onSwipe: (e, t, { animate: n, currentScreen: r, prevScreen: i, onProgress: a }) => {
|
|
918
|
-
let { offset: o } = t, s = o.x, c =
|
|
925
|
+
let { offset: o } = t, s = o.x, c = ae(s, [0, window.innerWidth], [0, 100]);
|
|
919
926
|
return a?.(!0, c), n(r, { x: Math.max(0, s) }, { duration: 0 }), n(i, { x: `${-30 + c * .3}%` }, { duration: 0 }), c;
|
|
920
927
|
},
|
|
921
928
|
onSwipeEnd: async (e, t, { animate: n, currentScreen: r, prevScreen: i, onStart: a }) => {
|
|
@@ -939,10 +946,10 @@ var oe = (e, t, n) => {
|
|
|
939
946
|
})]), c;
|
|
940
947
|
}
|
|
941
948
|
}
|
|
942
|
-
}),
|
|
949
|
+
}), se = (e, t, n) => {
|
|
943
950
|
let [r, i] = t, [a, o] = n;
|
|
944
951
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
945
|
-
},
|
|
952
|
+
}, M = j({
|
|
946
953
|
name: "layout",
|
|
947
954
|
initial: { opacity: .97 },
|
|
948
955
|
idle: {
|
|
@@ -970,7 +977,7 @@ var oe = (e, t, n) => {
|
|
|
970
977
|
swipeDirection: "y",
|
|
971
978
|
onSwipeStart: async () => !0,
|
|
972
979
|
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 =
|
|
980
|
+
let { offset: a } = t, o = a.y, s = Math.max(0, Math.min(56, o)), c = se(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
981
|
return i?.(!0, 100), n(r, {
|
|
975
982
|
y: f,
|
|
976
983
|
opacity: c
|
|
@@ -987,7 +994,7 @@ var oe = (e, t, n) => {
|
|
|
987
994
|
}, { duration: .3 })]), c;
|
|
988
995
|
}
|
|
989
996
|
}
|
|
990
|
-
}),
|
|
997
|
+
}), ce = j({
|
|
991
998
|
name: "material",
|
|
992
999
|
initial: { y: "100%" },
|
|
993
1000
|
idle: {
|
|
@@ -1095,7 +1102,7 @@ var oe = (e, t, n) => {
|
|
|
1095
1102
|
})]), c;
|
|
1096
1103
|
}
|
|
1097
1104
|
}
|
|
1098
|
-
}),
|
|
1105
|
+
}), le = j({
|
|
1099
1106
|
name: "none",
|
|
1100
1107
|
initial: {},
|
|
1101
1108
|
idle: {
|
|
@@ -1118,20 +1125,20 @@ var oe = (e, t, n) => {
|
|
|
1118
1125
|
value: {},
|
|
1119
1126
|
options: { duration: 0 }
|
|
1120
1127
|
}
|
|
1121
|
-
}),
|
|
1122
|
-
["none",
|
|
1123
|
-
["cupertino",
|
|
1124
|
-
["material",
|
|
1125
|
-
["layout",
|
|
1128
|
+
}), N = new Map([
|
|
1129
|
+
["none", le],
|
|
1130
|
+
["cupertino", oe],
|
|
1131
|
+
["material", ce],
|
|
1132
|
+
["layout", M]
|
|
1126
1133
|
]);
|
|
1127
1134
|
//#endregion
|
|
1128
1135
|
//#region src/transition/resolveTransition.ts
|
|
1129
|
-
function
|
|
1130
|
-
return
|
|
1136
|
+
function ue(e) {
|
|
1137
|
+
return N.get(e) ?? N.get("none");
|
|
1131
1138
|
}
|
|
1132
1139
|
//#endregion
|
|
1133
1140
|
//#region src/transition/decorator/createDecorator.ts
|
|
1134
|
-
function
|
|
1141
|
+
function de({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
1135
1142
|
return {
|
|
1136
1143
|
name: e,
|
|
1137
1144
|
initial: t,
|
|
@@ -1173,7 +1180,7 @@ function fe({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
1173
1180
|
}
|
|
1174
1181
|
//#endregion
|
|
1175
1182
|
//#region src/transition/decorator/overlay.ts
|
|
1176
|
-
var P = "rgba(0, 0, 0, 0.3)", pe =
|
|
1183
|
+
var P = "rgba(0, 0, 0, 0.3)", pe = de({
|
|
1177
1184
|
name: "overlay",
|
|
1178
1185
|
initial: {
|
|
1179
1186
|
opacity: 0,
|
|
@@ -1421,17 +1428,17 @@ var I = /* @__PURE__ */ new Map(), L = {
|
|
|
1421
1428
|
}, Be = "data-flemo";
|
|
1422
1429
|
function G() {
|
|
1423
1430
|
if (u()) return;
|
|
1424
|
-
let e = Le(
|
|
1431
|
+
let e = Le(N.values(), F.values(), I.values()), t = document.head.querySelector(`style[${Be}]`);
|
|
1425
1432
|
t || (t = document.createElement("style"), t.setAttribute(Be, ""), document.head.appendChild(t)), t.textContent !== e && (t.textContent = e);
|
|
1426
1433
|
}
|
|
1427
1434
|
//#endregion
|
|
1428
1435
|
//#region src/transition/registerTransitionDefinitions.ts
|
|
1429
1436
|
function Ve(e, t, n = []) {
|
|
1430
|
-
for (let t of e)
|
|
1437
|
+
for (let t of e) N.set(t.name, t);
|
|
1431
1438
|
for (let e of t) F.set(e.name, e);
|
|
1432
1439
|
for (let e of n) I.set(e.name, e);
|
|
1433
1440
|
return G(), () => {
|
|
1434
|
-
for (let t of e)
|
|
1441
|
+
for (let t of e) N.delete(t.name);
|
|
1435
1442
|
for (let e of t) F.delete(e.name);
|
|
1436
1443
|
for (let e of n) I.delete(e.name);
|
|
1437
1444
|
G();
|
|
@@ -1502,7 +1509,7 @@ function Ge(e) {
|
|
|
1502
1509
|
let l = () => {
|
|
1503
1510
|
let t = e.getTransitionTaskId();
|
|
1504
1511
|
t && a.resolveTask(t);
|
|
1505
|
-
}, u =
|
|
1512
|
+
}, u = ue(r), d = `${o}-true`;
|
|
1506
1513
|
if (!(c.getAttribute("data-flemo-skip-animation") !== "true" && ze(u, d))) return queueMicrotask(l), X;
|
|
1507
1514
|
let f = H("screen", r, d), p = (e) => {
|
|
1508
1515
|
e.target === c && e.animationName === f && (c.removeEventListener("animationend", p), l());
|
|
@@ -1867,4 +1874,4 @@ function st(e, n) {
|
|
|
1867
1874
|
};
|
|
1868
1875
|
}
|
|
1869
1876
|
//#endregion
|
|
1870
|
-
export { Ze as ANIM_HOLD_RELEASE_BACKSTOP_MS, Y as SKIP_ANIMATION_ATTR, a as TaskManger, Xe as animHoldKey, J as animateInline, H as animationName, E as appendParamsQuery, G as applyTransitionStyles, st as buildRoutePath, $ as canProgrammaticallyScroll, q as clearInlineAnimation, Ae as collectAnimatedProperties, Le as compileTransitionStyles, Ye as computeBarRiding,
|
|
1877
|
+
export { Ze as ANIM_HOLD_RELEASE_BACKSTOP_MS, Y as SKIP_ANIMATION_ATTR, a as TaskManger, Xe as animHoldKey, J as animateInline, H as animationName, E as appendParamsQuery, G as applyTransitionStyles, st as buildRoutePath, $ as canProgrammaticallyScroll, q as clearInlineAnimation, Ae as collectAnimatedProperties, Le as compileTransitionStyles, Ye as computeBarRiding, re as computeScreenFreeze, _ as consumeSelfInducedPop, p as createBrowserHistoryDriver, de as createDecorator, o as createHistoryStore, v as createHistorySync, y as createMemoryHistoryDriver, b as createNavigateStore, w as createNavigationController, me as createPartTransition, fe as createRawDecorator, he as createRawPartTransition, ie as createRawTransition, te as createRouterScope, ne as createScreenSelector, A as createScreenStore, m as createSelfPopGuard, D as createStepController, Je as createSwipeController, j as createTransition, Ge as createTransitionEngine, k as createTransitionStore, oe as cupertino, F as decoratorMap, et as eagerlyDecodeImages, B as easingToCss, d as ensureWindowHistoryState, He as enteringInitialStyle, Z as findScrollable, s as getMatchedPathPattern, c as getParams, ot as isOpaqueColor, u as isServer, M as layout, g as markSelfInducedPop, at as matchesPathname, ce as material, le as none, nt as observeBarHeight, it as observeViewportScrollHeight, Q as overflowsAxis, pe as overlay, I as partTransitionMap, T as readStepParams, Ve as registerTransitionDefinitions, ue as resolveTransition, tt as scheduleAnimHoldRelease, l as seedInitialHistory, O as subscribeStepParamsRestore, R as targetToDecls, N as transitionMap, ze as variantHasAnimation };
|
package/package.json
CHANGED