@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/jsenv_navi.js
CHANGED
|
@@ -9871,15 +9871,16 @@ const [publishRouteRender, observeRouteRender] = createPubSub();
|
|
|
9871
9871
|
*
|
|
9872
9872
|
* A page whose height depends on something still loading is not there at the
|
|
9873
9873
|
* moment it is put back, and a position beyond what has arrived is clamped.
|
|
9874
|
-
*
|
|
9875
|
-
*
|
|
9876
|
-
*
|
|
9877
|
-
*
|
|
9878
|
-
*
|
|
9879
|
-
*
|
|
9880
|
-
* (
|
|
9881
|
-
*
|
|
9882
|
-
*
|
|
9874
|
+
* So it is written into what is there, as far as that goes, and written again
|
|
9875
|
+
* once the page is whole (see putBackMeanwhile). What navi knows a first render
|
|
9876
|
+
* left out, it waits for: a `<Box mount="after-paint">` is built before the
|
|
9877
|
+
* offset that shows it is written (see mount_after_paint.jsx), and a reload or
|
|
9878
|
+
* a return waits for the route actions the page has nothing to draw for — its
|
|
9879
|
+
* code among them — including one whose `when` lets it ask after the position
|
|
9880
|
+
* is written (see stayForLateAsks). Anything else only the page knows, and it
|
|
9881
|
+
* says so (useHoldScrollRestoration). A wait can be long, so the reader
|
|
9882
|
+
* reaching for the page during it cancels the position: moved afterwards, they
|
|
9883
|
+
* would lose whatever they had started on.
|
|
9883
9884
|
*
|
|
9884
9885
|
* WHEN a page is arrived at is not decided here either. A document navigation
|
|
9885
9886
|
* lands where its kind says (see via_history.js), and one scrollport can be
|
|
@@ -10024,8 +10025,8 @@ const suspendScrollRecording = () => {
|
|
|
10024
10025
|
// the reader reaching for the page: where they are is theirs (see
|
|
10025
10026
|
// installScrollRestoration).
|
|
10026
10027
|
let pendingRestoration = null;
|
|
10027
|
-
const startRestoration = (position
|
|
10028
|
-
const restoration = { position, due: false
|
|
10028
|
+
const startRestoration = (position) => {
|
|
10029
|
+
const restoration = { position, due: false };
|
|
10029
10030
|
pendingRestoration = restoration;
|
|
10030
10031
|
return restoration;
|
|
10031
10032
|
};
|
|
@@ -10085,15 +10086,13 @@ const isDocumentHeld = () => {
|
|
|
10085
10086
|
return false;
|
|
10086
10087
|
};
|
|
10087
10088
|
|
|
10088
|
-
// A
|
|
10089
|
-
//
|
|
10090
|
-
//
|
|
10091
|
-
// what is there meanwhile, as far as that goes
|
|
10092
|
-
// and again once the page is whole, when what
|
|
10089
|
+
// A position waiting for the page to be whole is written after the reader has
|
|
10090
|
+
// seen the page at its top, and seen as a jump — after the movement, when a
|
|
10091
|
+
// route transition photographs the page as soon as it renders, stand-ins and
|
|
10092
|
+
// all. So it is also written into what is there meanwhile, as far as that goes
|
|
10093
|
+
// (the browser clamps the rest), and again once the page is whole, when what
|
|
10094
|
+
// it stands on has grown or shrunk.
|
|
10093
10095
|
const putBackMeanwhile = (restoration) => {
|
|
10094
|
-
if (!restoration.meanwhile) {
|
|
10095
|
-
return;
|
|
10096
|
-
}
|
|
10097
10096
|
// Out of whatever commit or effect is asking: see scrollTo.
|
|
10098
10097
|
queueMicrotask(() => {
|
|
10099
10098
|
if (pendingRestoration !== restoration || isDocumentHeld()) {
|
|
@@ -10130,11 +10129,11 @@ const holdScrollRestoration = () => {
|
|
|
10130
10129
|
};
|
|
10131
10130
|
|
|
10132
10131
|
/**
|
|
10133
|
-
*
|
|
10134
|
-
*
|
|
10135
|
-
*
|
|
10136
|
-
*
|
|
10137
|
-
*
|
|
10132
|
+
* Says the page is not whole yet to the scroll position a reload or a
|
|
10133
|
+
* back/forward gives it: written into what the page shows meanwhile, it is
|
|
10134
|
+
* clamped to that height. Put back again after the commit in which `held`
|
|
10135
|
+
* turns false — unless the reader has reached for the page in the meantime (a
|
|
10136
|
+
* finger, a click, a wheel, a key), or gone elsewhere.
|
|
10138
10137
|
*
|
|
10139
10138
|
* The page's route actions are waited for without this — its code, a read
|
|
10140
10139
|
* with no answer yet, one whose `when` holds later. This is for
|
|
@@ -10384,7 +10383,7 @@ const restoreScrollPositionOnReturn = (url) => {
|
|
|
10384
10383
|
if (!position) {
|
|
10385
10384
|
return;
|
|
10386
10385
|
}
|
|
10387
|
-
const restoration = startRestoration(position
|
|
10386
|
+
const restoration = startRestoration(position);
|
|
10388
10387
|
whenPageRendered(() => {
|
|
10389
10388
|
putBackOnceAnswered(restoration);
|
|
10390
10389
|
});
|