@jsenv/navi 0.29.498 → 0.29.499
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 +24 -25
- package/dist/dev/jsenv_navi.js.map +2 -2
- package/dist/jsenv_navi.js +24 -25
- package/dist/jsenv_navi.js.map +2 -2
- package/docs/navigation.md +8 -7
- package/package.json +1 -1
package/dist/dev/jsenv_navi.js
CHANGED
|
@@ -10276,15 +10276,16 @@ const [publishRouteRender, observeRouteRender] = createPubSub();
|
|
|
10276
10276
|
*
|
|
10277
10277
|
* A page whose height depends on something still loading is not there at the
|
|
10278
10278
|
* moment it is put back, and a position beyond what has arrived is clamped.
|
|
10279
|
-
*
|
|
10280
|
-
*
|
|
10281
|
-
*
|
|
10282
|
-
*
|
|
10283
|
-
*
|
|
10284
|
-
*
|
|
10285
|
-
* (
|
|
10286
|
-
*
|
|
10287
|
-
*
|
|
10279
|
+
* So it is written into what is there, as far as that goes, and written again
|
|
10280
|
+
* once the page is whole (see putBackMeanwhile). What navi knows a first render
|
|
10281
|
+
* left out, it waits for: a `<Box mount="after-paint">` is built before the
|
|
10282
|
+
* offset that shows it is written (see mount_after_paint.jsx), and a reload or
|
|
10283
|
+
* a return waits for the route actions the page has nothing to draw for — its
|
|
10284
|
+
* code among them — including one whose `when` lets it ask after the position
|
|
10285
|
+
* is written (see stayForLateAsks). Anything else only the page knows, and it
|
|
10286
|
+
* says so (useHoldScrollRestoration). A wait can be long, so the reader
|
|
10287
|
+
* reaching for the page during it cancels the position: moved afterwards, they
|
|
10288
|
+
* would lose whatever they had started on.
|
|
10288
10289
|
*
|
|
10289
10290
|
* WHEN a page is arrived at is not decided here either. A document navigation
|
|
10290
10291
|
* lands where its kind says (see via_history.js), and one scrollport can be
|
|
@@ -10429,8 +10430,8 @@ const suspendScrollRecording = () => {
|
|
|
10429
10430
|
// the reader reaching for the page: where they are is theirs (see
|
|
10430
10431
|
// installScrollRestoration).
|
|
10431
10432
|
let pendingRestoration = null;
|
|
10432
|
-
const startRestoration = (position
|
|
10433
|
-
const restoration = { position, due: false
|
|
10433
|
+
const startRestoration = (position) => {
|
|
10434
|
+
const restoration = { position, due: false };
|
|
10434
10435
|
pendingRestoration = restoration;
|
|
10435
10436
|
return restoration;
|
|
10436
10437
|
};
|
|
@@ -10490,15 +10491,13 @@ const isDocumentHeld = () => {
|
|
|
10490
10491
|
return false;
|
|
10491
10492
|
};
|
|
10492
10493
|
|
|
10493
|
-
// A
|
|
10494
|
-
//
|
|
10495
|
-
//
|
|
10496
|
-
// what is there meanwhile, as far as that goes
|
|
10497
|
-
// and again once the page is whole, when what
|
|
10494
|
+
// A position waiting for the page to be whole is written after the reader has
|
|
10495
|
+
// seen the page at its top, and seen as a jump — after the movement, when a
|
|
10496
|
+
// route transition photographs the page as soon as it renders, stand-ins and
|
|
10497
|
+
// all. So it is also written into what is there meanwhile, as far as that goes
|
|
10498
|
+
// (the browser clamps the rest), and again once the page is whole, when what
|
|
10499
|
+
// it stands on has grown or shrunk.
|
|
10498
10500
|
const putBackMeanwhile = (restoration) => {
|
|
10499
|
-
if (!restoration.meanwhile) {
|
|
10500
|
-
return;
|
|
10501
|
-
}
|
|
10502
10501
|
// Out of whatever commit or effect is asking: see scrollTo.
|
|
10503
10502
|
queueMicrotask(() => {
|
|
10504
10503
|
if (pendingRestoration !== restoration || isDocumentHeld()) {
|
|
@@ -10535,11 +10534,11 @@ const holdScrollRestoration = () => {
|
|
|
10535
10534
|
};
|
|
10536
10535
|
|
|
10537
10536
|
/**
|
|
10538
|
-
*
|
|
10539
|
-
*
|
|
10540
|
-
*
|
|
10541
|
-
*
|
|
10542
|
-
*
|
|
10537
|
+
* Says the page is not whole yet to the scroll position a reload or a
|
|
10538
|
+
* back/forward gives it: written into what the page shows meanwhile, it is
|
|
10539
|
+
* clamped to that height. Put back again after the commit in which `held`
|
|
10540
|
+
* turns false — unless the reader has reached for the page in the meantime (a
|
|
10541
|
+
* finger, a click, a wheel, a key), or gone elsewhere.
|
|
10543
10542
|
*
|
|
10544
10543
|
* The page's route actions are waited for without this — its code, a read
|
|
10545
10544
|
* with no answer yet, one whose `when` holds later. This is for
|
|
@@ -10789,7 +10788,7 @@ const restoreScrollPositionOnReturn = (url) => {
|
|
|
10789
10788
|
if (!position) {
|
|
10790
10789
|
return;
|
|
10791
10790
|
}
|
|
10792
|
-
const restoration = startRestoration(position
|
|
10791
|
+
const restoration = startRestoration(position);
|
|
10793
10792
|
whenPageRendered(() => {
|
|
10794
10793
|
putBackOnceAnswered(restoration);
|
|
10795
10794
|
});
|