@jsenv/navi 0.30.34 → 0.30.35

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.
@@ -42836,9 +42836,23 @@ const RouteTravel = ({
42836
42836
  params
42837
42837
  }) => new URL(route.buildUrl(params), window.location.href).pathname;
42838
42838
 
42839
+ // The pane laid out as the page on screen for the length of a movement, let go of
42840
+ // when the row rests. Not what readers are told the page held is
42841
+ // (route_travel_hold.js): that follows the hand, and goes at its lift.
42842
+ const heldPaneRef = useRef(null);
42843
+ const releasePaneAtRest = () => {
42844
+ const heldPane = heldPaneRef.current;
42845
+ if (heldPane) {
42846
+ heldPaneRef.current = null;
42847
+ heldPane.removeAttribute("data-route-row-held");
42848
+ }
42849
+ };
42850
+
42839
42851
  // One movement, whoever set it off, from the first thing that moves to the row
42840
- // at rest. Null when nothing moves.
42841
- const beginMovement = fields => {
42852
+ // at rest. Null when nothing moves. `paneAtRest` is the pane the row rests on as it
42853
+ // begins: laid out as the page on screen until the row rests again, wherever the
42854
+ // address goes meanwhile (see the CSS).
42855
+ const beginMovement = (fields, paneAtRest) => {
42842
42856
  const row = rowRef.current;
42843
42857
  if (movementRef.current) {
42844
42858
  Object.assign(movementRef.current, fields);
@@ -42853,6 +42867,11 @@ const RouteTravel = ({
42853
42867
  ...fields
42854
42868
  };
42855
42869
  movementRef.current = movement;
42870
+ // In a window the page is a picture, contained with what it holds.
42871
+ if (!windowed && paneAtRest) {
42872
+ heldPaneRef.current = paneAtRest;
42873
+ paneAtRest.setAttribute("data-route-row-held", "");
42874
+ }
42856
42875
  if (movement.scrollsDocument) {
42857
42876
  // Whatever the browser does with the offset meanwhile (clamping it to a page
42858
42877
  // shorter than the trip) is not the reader scrolling, and the address it
@@ -43090,24 +43109,6 @@ const RouteTravel = ({
43090
43109
  rowRef.current.removeAttribute("data-route-row-travelling");
43091
43110
  };
43092
43111
 
43093
- // The address runs ahead of a hand to build the page it pulls towards (onScroll):
43094
- // the pane under the hand stays laid out as the page on screen until the hand lets
43095
- // go, whatever `inert` says (see the CSS). What reads the page held is told apart
43096
- // (route_travel_hold.js), and both are let go of together.
43097
- const heldPaneRef = useRef(null);
43098
- const holdPaneOnScreen = pane => {
43099
- heldPaneRef.current = pane;
43100
- pane.setAttribute("data-route-row-held", "");
43101
- };
43102
- const releaseHold = () => {
43103
- releaseHeldPage();
43104
- const heldPane = heldPaneRef.current;
43105
- if (heldPane) {
43106
- heldPaneRef.current = null;
43107
- heldPane.removeAttribute("data-route-row-held");
43108
- }
43109
- };
43110
-
43111
43112
  // Every column back where the map says, and the row on the page of the address, in
43112
43113
  // one go: that page stands at the same place on screen either way.
43113
43114
  const putRowBack = movement => {
@@ -43136,7 +43137,7 @@ const RouteTravel = ({
43136
43137
  const position = row.scrollLeft;
43137
43138
  movement.rowTaken = true;
43138
43139
  // A travel no hand set off holds nothing: it goes where it goes.
43139
- releaseHold();
43140
+ releaseHeldPage();
43140
43141
  row.style.setProperty("--navi-route-row-stand", `${-position}px`);
43141
43142
  row.setAttribute("data-route-row-taken", "");
43142
43143
  afterFrames(2, () => {
@@ -43168,7 +43169,8 @@ const RouteTravel = ({
43168
43169
  putRowBack(movement);
43169
43170
  row.removeAttribute("data-route-row-taken");
43170
43171
  publishRouteRowMove(null);
43171
- releaseHold();
43172
+ releaseHeldPage();
43173
+ releasePaneAtRest();
43172
43174
  if (liveRef.current) {
43173
43175
  liveRef.current.style.top = "";
43174
43176
  }
@@ -43281,9 +43283,11 @@ const RouteTravel = ({
43281
43283
  return;
43282
43284
  }
43283
43285
  const movementBefore = movementRef.current;
43286
+ // The row still rests on the page answered before. Held in the commit that made
43287
+ // its pane inert, so no frame paints it contained.
43284
43288
  const movement = beginMovement({
43285
43289
  travelling: true
43286
- });
43290
+ }, panesOf(row)[pages.findIndex(each => samePage(each, answered))]);
43287
43291
  if (movementBefore?.byHand && !movementBefore.rowTaken) {
43288
43292
  sayRowMoves();
43289
43293
  takeRowFromHand(movement);
@@ -43351,7 +43355,7 @@ const RouteTravel = ({
43351
43355
  }
43352
43356
  const movement = moving || beginMovement({
43353
43357
  byHand: true
43354
- });
43358
+ }, pane);
43355
43359
  sayRowMoves();
43356
43360
  if (movement.travelling || !travelByDrag || !pane) {
43357
43361
  return;
@@ -43388,12 +43392,8 @@ const RouteTravel = ({
43388
43392
  return;
43389
43393
  }
43390
43394
  leavePictureOfLive(movement);
43391
- } else {
43392
- if (paneTowards.hasAttribute("data-built")) {
43393
- return;
43394
- }
43395
- // Before the address moves: the render that makes it inert must find it held.
43396
- holdPaneOnScreen(pane);
43395
+ } else if (paneTowards.hasAttribute("data-built")) {
43396
+ return;
43397
43397
  }
43398
43398
  holdPage(pages[currentIndex], page);
43399
43399
  askFor(page);
@@ -43424,8 +43424,9 @@ const RouteTravel = ({
43424
43424
  askForPageOfRow(index, movement);
43425
43425
  }
43426
43426
  // After the address: a pull coming back to its page must not light the tab the
43427
- // address ran ahead to, even for a render.
43428
- releaseHold();
43427
+ // address ran ahead to, even for a render. Only what readers are told: the
43428
+ // panes keep their layout until the row rests.
43429
+ releaseHeldPage();
43429
43430
  };
43430
43431
  const stopWatching = watchRowScroll(row, {
43431
43432
  onScroll,
@@ -43481,7 +43482,8 @@ const RouteTravel = ({
43481
43482
  row.removeAttribute("data-route-row-travelling");
43482
43483
  movementRef.current = null;
43483
43484
  publishRouteRowMove(null);
43484
- releaseHold();
43485
+ releaseHeldPage();
43486
+ releasePaneAtRest();
43485
43487
  };
43486
43488
  }, [windowed]);
43487
43489