@jsenv/navi 0.29.497 → 0.29.498
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/dev/jsenv_navi.js +29 -8
- package/dist/dev/jsenv_navi.js.map +2 -2
- package/dist/jsenv_navi.js +29 -8
- package/dist/jsenv_navi.js.map +2 -2
- package/docs/navigation.md +5 -2
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -10429,8 +10429,8 @@ const suspendScrollRecording = () => {
|
|
|
10429
10429
|
// the reader reaching for the page: where they are is theirs (see
|
|
10430
10430
|
// installScrollRestoration).
|
|
10431
10431
|
let pendingRestoration = null;
|
|
10432
|
-
const startRestoration = (position) => {
|
|
10433
|
-
const restoration = { position, due: false };
|
|
10432
|
+
const startRestoration = (position, { meanwhile = false } = {}) => {
|
|
10433
|
+
const restoration = { position, due: false, meanwhile };
|
|
10434
10434
|
pendingRestoration = restoration;
|
|
10435
10435
|
return restoration;
|
|
10436
10436
|
};
|
|
@@ -10443,6 +10443,7 @@ const putBack = (restoration) => {
|
|
|
10443
10443
|
restoration.due = true;
|
|
10444
10444
|
if (restorationHoldCount) {
|
|
10445
10445
|
// The page is not whole yet: the last release puts it back.
|
|
10446
|
+
putBackMeanwhile(restoration);
|
|
10446
10447
|
return;
|
|
10447
10448
|
}
|
|
10448
10449
|
if (isDocumentHeld()) {
|
|
@@ -10489,6 +10490,24 @@ const isDocumentHeld = () => {
|
|
|
10489
10490
|
return false;
|
|
10490
10491
|
};
|
|
10491
10492
|
|
|
10493
|
+
// A return is photographed by its route transition as soon as its page has
|
|
10494
|
+
// rendered, stand-ins and all, and a position waiting for the page to be whole
|
|
10495
|
+
// is written after the movement, seen as a jump. So it is also written into
|
|
10496
|
+
// what is there meanwhile, as far as that goes — the browser clamps the rest —
|
|
10497
|
+
// and again once the page is whole, when what it stands on has grown or shrunk.
|
|
10498
|
+
const putBackMeanwhile = (restoration) => {
|
|
10499
|
+
if (!restoration.meanwhile) {
|
|
10500
|
+
return;
|
|
10501
|
+
}
|
|
10502
|
+
// Out of whatever commit or effect is asking: see scrollTo.
|
|
10503
|
+
queueMicrotask(() => {
|
|
10504
|
+
if (pendingRestoration !== restoration || isDocumentHeld()) {
|
|
10505
|
+
return;
|
|
10506
|
+
}
|
|
10507
|
+
scrollTo(restoration.position);
|
|
10508
|
+
});
|
|
10509
|
+
};
|
|
10510
|
+
|
|
10492
10511
|
// What a page holds instead: not the place, which stays the url's, but the
|
|
10493
10512
|
// moment it is put back (see useHoldScrollRestoration). Counted: several parts
|
|
10494
10513
|
// of one page can be waiting.
|
|
@@ -10632,6 +10651,7 @@ const putBackOnceAnswered = (restoration) => {
|
|
|
10632
10651
|
});
|
|
10633
10652
|
return;
|
|
10634
10653
|
}
|
|
10654
|
+
putBackMeanwhile(restoration);
|
|
10635
10655
|
// A reader drawing its own wait subscribes in an effect, after the first
|
|
10636
10656
|
// paint (see afterPaint): an answer that came before is drawn only then.
|
|
10637
10657
|
let waitCount = 2;
|
|
@@ -10755,11 +10775,12 @@ const restoreScrollPosition = (url) => {
|
|
|
10755
10775
|
};
|
|
10756
10776
|
|
|
10757
10777
|
// A traversal back to `url`. The offset is written once the page returned to is
|
|
10758
|
-
// rendered
|
|
10759
|
-
//
|
|
10760
|
-
//
|
|
10761
|
-
//
|
|
10762
|
-
// is a scroll recorded under the
|
|
10778
|
+
// rendered (see whenPageRendered): written sooner, the document still holds the
|
|
10779
|
+
// page being left and clamps it to that height. Again once it has answered (see
|
|
10780
|
+
// putBackOnceAnswered), when it rendered stand-ins (see putBackMeanwhile). It
|
|
10781
|
+
// is read at once all the same — a page left taller than the one arriving is
|
|
10782
|
+
// clamped by the render itself, and that clamp is a scroll recorded under the
|
|
10783
|
+
// url already returned to.
|
|
10763
10784
|
const restoreScrollPositionOnReturn = (url) => {
|
|
10764
10785
|
pendingRestoration = null;
|
|
10765
10786
|
const href = new URL(url, window.location.href).href;
|
|
@@ -10768,7 +10789,7 @@ const restoreScrollPositionOnReturn = (url) => {
|
|
|
10768
10789
|
if (!position) {
|
|
10769
10790
|
return;
|
|
10770
10791
|
}
|
|
10771
|
-
const restoration = startRestoration(position);
|
|
10792
|
+
const restoration = startRestoration(position, { meanwhile: true });
|
|
10772
10793
|
whenPageRendered(() => {
|
|
10773
10794
|
putBackOnceAnswered(restoration);
|
|
10774
10795
|
});
|