@jsenv/navi 0.30.31 → 0.30.33

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.
@@ -14441,7 +14441,9 @@ const isRenderingPageChange = () => renderingPageChange;
14441
14441
  * outside its own nodes (a slot in a bar, the document a list scrolls) steps
14442
14442
  * out rather than showing with, or moving, the page arriving. Every box of it
14443
14443
  * measures 0×0 by then. Set after the render keeping the page, so that render
14444
- * and what it builds can only ask `hasLeft()`.
14444
+ * and what it builds can only ask `hasLeft()`. Cleared by the render showing
14445
+ * the page again, before anything below it renders: what mounts then never
14446
+ * reads its page as leaving.
14445
14447
  */
14446
14448
  const RoutePageContext = createContext(null);
14447
14449
 
@@ -38547,8 +38549,16 @@ const RouteRowPane = ({
38547
38549
  value: page
38548
38550
  }, branch.node));
38549
38551
  }
38552
+ // Back on screen before what it holds renders: built here, or mounted again under
38553
+ // it, that content runs its layout effects before this component's, and would
38554
+ // otherwise read its page as leaving.
38555
+ if (shown) {
38556
+ page.ownLeavingSignal.value = false;
38557
+ }
38550
38558
  useLayoutEffect(() => {
38551
- page.ownLeavingSignal.value = !shown;
38559
+ if (!shown) {
38560
+ page.ownLeavingSignal.value = true;
38561
+ }
38552
38562
  }, [shown]);
38553
38563
  return jsx("div", {
38554
38564
  "data-route-row-pane": "",
@@ -42989,9 +42999,12 @@ const RouteTravel = ({
42989
42999
  const row = rowRef.current;
42990
43000
  // Already moving, so there is no ease-in to play: it would stall the row for an
42991
43001
  // instant right where the eye is following it.
42992
- const inFlight = Boolean(movement.playing) || Boolean(movement.rowTaken);
42993
- if (movement.playing) {
42994
- movement.playing.stop();
43002
+ const replaced = movement.playing;
43003
+ const inFlight = Boolean(replaced) || Boolean(movement.rowTaken);
43004
+ if (replaced) {
43005
+ // Its frames only: the row stays travelling across the hand-over. Let go of,
43006
+ // it snaps to the nearest page at the read below, and the travel starts there.
43007
+ replaced.cancelFrame();
42995
43008
  }
42996
43009
  const from = row.scrollLeft;
42997
43010
  const {
@@ -43014,8 +43027,11 @@ const RouteTravel = ({
43014
43027
  const playing = {
43015
43028
  // Where this travel put the row, for a scroll event to tell it from a hand.
43016
43029
  written: from,
43017
- stop: () => {
43030
+ cancelFrame: () => {
43018
43031
  cancelAnimationFrame(frame);
43032
+ },
43033
+ stop: () => {
43034
+ playing.cancelFrame();
43019
43035
  if (movement.playing === playing) {
43020
43036
  movement.playing = null;
43021
43037
  row.removeAttribute("data-route-row-travelling");
@@ -43024,9 +43040,12 @@ const RouteTravel = ({
43024
43040
  };
43025
43041
  const step = now => {
43026
43042
  if (start === null) {
43027
- start = now;
43043
+ // When this frame runs, not when it began: under load it began while the
43044
+ // press was still being handled, and that time is no travel.
43045
+ start = performance.now();
43028
43046
  }
43029
- const elapsed = (now - start) / travelMs;
43047
+ // The next frame may have begun while this first one was still being handled.
43048
+ const elapsed = now > start ? (now - start) / travelMs : 0;
43030
43049
  // Read at every frame: the layout may move under the travel (a scrollbar
43031
43050
  // coming in narrows the row), and it goes where the page stands.
43032
43051
  const to = pane.offsetLeft;