@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.
@@ -41536,9 +41536,23 @@ const RouteTravel = ({
41536
41536
  params
41537
41537
  }) => new URL(route.buildUrl(params), window.location.href).pathname;
41538
41538
 
41539
+ // The pane laid out as the page on screen for the length of a movement, let go of
41540
+ // when the row rests. Not what readers are told the page held is
41541
+ // (route_travel_hold.js): that follows the hand, and goes at its lift.
41542
+ const heldPaneRef = useRef(null);
41543
+ const releasePaneAtRest = () => {
41544
+ const heldPane = heldPaneRef.current;
41545
+ if (heldPane) {
41546
+ heldPaneRef.current = null;
41547
+ heldPane.removeAttribute("data-route-row-held");
41548
+ }
41549
+ };
41550
+
41539
41551
  // One movement, whoever set it off, from the first thing that moves to the row
41540
- // at rest. Null when nothing moves.
41541
- const beginMovement = fields => {
41552
+ // at rest. Null when nothing moves. `paneAtRest` is the pane the row rests on as it
41553
+ // begins: laid out as the page on screen until the row rests again, wherever the
41554
+ // address goes meanwhile (see the CSS).
41555
+ const beginMovement = (fields, paneAtRest) => {
41542
41556
  const row = rowRef.current;
41543
41557
  if (movementRef.current) {
41544
41558
  Object.assign(movementRef.current, fields);
@@ -41553,6 +41567,11 @@ const RouteTravel = ({
41553
41567
  ...fields
41554
41568
  };
41555
41569
  movementRef.current = movement;
41570
+ // In a window the page is a picture, contained with what it holds.
41571
+ if (!windowed && paneAtRest) {
41572
+ heldPaneRef.current = paneAtRest;
41573
+ paneAtRest.setAttribute("data-route-row-held", "");
41574
+ }
41556
41575
  if (movement.scrollsDocument) {
41557
41576
  // Whatever the browser does with the offset meanwhile (clamping it to a page
41558
41577
  // shorter than the trip) is not the reader scrolling, and the address it
@@ -41790,24 +41809,6 @@ const RouteTravel = ({
41790
41809
  rowRef.current.removeAttribute("data-route-row-travelling");
41791
41810
  };
41792
41811
 
41793
- // The address runs ahead of a hand to build the page it pulls towards (onScroll):
41794
- // the pane under the hand stays laid out as the page on screen until the hand lets
41795
- // go, whatever `inert` says (see the CSS). What reads the page held is told apart
41796
- // (route_travel_hold.js), and both are let go of together.
41797
- const heldPaneRef = useRef(null);
41798
- const holdPaneOnScreen = pane => {
41799
- heldPaneRef.current = pane;
41800
- pane.setAttribute("data-route-row-held", "");
41801
- };
41802
- const releaseHold = () => {
41803
- releaseHeldPage();
41804
- const heldPane = heldPaneRef.current;
41805
- if (heldPane) {
41806
- heldPaneRef.current = null;
41807
- heldPane.removeAttribute("data-route-row-held");
41808
- }
41809
- };
41810
-
41811
41812
  // Every column back where the map says, and the row on the page of the address, in
41812
41813
  // one go: that page stands at the same place on screen either way.
41813
41814
  const putRowBack = movement => {
@@ -41836,7 +41837,7 @@ const RouteTravel = ({
41836
41837
  const position = row.scrollLeft;
41837
41838
  movement.rowTaken = true;
41838
41839
  // A travel no hand set off holds nothing: it goes where it goes.
41839
- releaseHold();
41840
+ releaseHeldPage();
41840
41841
  row.style.setProperty("--navi-route-row-stand", `${-position}px`);
41841
41842
  row.setAttribute("data-route-row-taken", "");
41842
41843
  afterFrames(2, () => {
@@ -41868,7 +41869,8 @@ const RouteTravel = ({
41868
41869
  putRowBack(movement);
41869
41870
  row.removeAttribute("data-route-row-taken");
41870
41871
  publishRouteRowMove(null);
41871
- releaseHold();
41872
+ releaseHeldPage();
41873
+ releasePaneAtRest();
41872
41874
  if (liveRef.current) {
41873
41875
  liveRef.current.style.top = "";
41874
41876
  }
@@ -41981,9 +41983,11 @@ const RouteTravel = ({
41981
41983
  return;
41982
41984
  }
41983
41985
  const movementBefore = movementRef.current;
41986
+ // The row still rests on the page answered before. Held in the commit that made
41987
+ // its pane inert, so no frame paints it contained.
41984
41988
  const movement = beginMovement({
41985
41989
  travelling: true
41986
- });
41990
+ }, panesOf(row)[pages.findIndex(each => samePage(each, answered))]);
41987
41991
  if (movementBefore?.byHand && !movementBefore.rowTaken) {
41988
41992
  sayRowMoves();
41989
41993
  takeRowFromHand(movement);
@@ -42051,7 +42055,7 @@ const RouteTravel = ({
42051
42055
  }
42052
42056
  const movement = moving || beginMovement({
42053
42057
  byHand: true
42054
- });
42058
+ }, pane);
42055
42059
  sayRowMoves();
42056
42060
  if (movement.travelling || !travelByDrag || !pane) {
42057
42061
  return;
@@ -42088,12 +42092,8 @@ const RouteTravel = ({
42088
42092
  return;
42089
42093
  }
42090
42094
  leavePictureOfLive(movement);
42091
- } else {
42092
- if (paneTowards.hasAttribute("data-built")) {
42093
- return;
42094
- }
42095
- // Before the address moves: the render that makes it inert must find it held.
42096
- holdPaneOnScreen(pane);
42095
+ } else if (paneTowards.hasAttribute("data-built")) {
42096
+ return;
42097
42097
  }
42098
42098
  holdPage(pages[currentIndex], page);
42099
42099
  askFor(page);
@@ -42124,8 +42124,9 @@ const RouteTravel = ({
42124
42124
  askForPageOfRow(index, movement);
42125
42125
  }
42126
42126
  // After the address: a pull coming back to its page must not light the tab the
42127
- // address ran ahead to, even for a render.
42128
- releaseHold();
42127
+ // address ran ahead to, even for a render. Only what readers are told: the
42128
+ // panes keep their layout until the row rests.
42129
+ releaseHeldPage();
42129
42130
  };
42130
42131
  const stopWatching = watchRowScroll(row, {
42131
42132
  onScroll,
@@ -42181,7 +42182,8 @@ const RouteTravel = ({
42181
42182
  row.removeAttribute("data-route-row-travelling");
42182
42183
  movementRef.current = null;
42183
42184
  publishRouteRowMove(null);
42184
- releaseHold();
42185
+ releaseHeldPage();
42186
+ releasePaneAtRest();
42185
42187
  };
42186
42188
  }, [windowed]);
42187
42189