@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.
@@ -13832,7 +13832,9 @@ const isRenderingPageChange = () => renderingPageChange;
13832
13832
  * outside its own nodes (a slot in a bar, the document a list scrolls) steps
13833
13833
  * out rather than showing with, or moving, the page arriving. Every box of it
13834
13834
  * measures 0×0 by then. Set after the render keeping the page, so that render
13835
- * and what it builds can only ask `hasLeft()`.
13835
+ * and what it builds can only ask `hasLeft()`. Cleared by the render showing
13836
+ * the page again, before anything below it renders: what mounts then never
13837
+ * reads its page as leaving.
13836
13838
  */
13837
13839
  const RoutePageContext = createContext(null);
13838
13840
 
@@ -37287,8 +37289,16 @@ const RouteRowPane = ({
37287
37289
  value: page
37288
37290
  }, branch.node));
37289
37291
  }
37292
+ // Back on screen before what it holds renders: built here, or mounted again under
37293
+ // it, that content runs its layout effects before this component's, and would
37294
+ // otherwise read its page as leaving.
37295
+ if (shown) {
37296
+ page.ownLeavingSignal.value = false;
37297
+ }
37290
37298
  useLayoutEffect(() => {
37291
- page.ownLeavingSignal.value = !shown;
37299
+ if (!shown) {
37300
+ page.ownLeavingSignal.value = true;
37301
+ }
37292
37302
  }, [shown]);
37293
37303
  return jsx("div", {
37294
37304
  "data-route-row-pane": "",
@@ -41689,9 +41699,12 @@ const RouteTravel = ({
41689
41699
  const row = rowRef.current;
41690
41700
  // Already moving, so there is no ease-in to play: it would stall the row for an
41691
41701
  // instant right where the eye is following it.
41692
- const inFlight = Boolean(movement.playing) || Boolean(movement.rowTaken);
41693
- if (movement.playing) {
41694
- movement.playing.stop();
41702
+ const replaced = movement.playing;
41703
+ const inFlight = Boolean(replaced) || Boolean(movement.rowTaken);
41704
+ if (replaced) {
41705
+ // Its frames only: the row stays travelling across the hand-over. Let go of,
41706
+ // it snaps to the nearest page at the read below, and the travel starts there.
41707
+ replaced.cancelFrame();
41695
41708
  }
41696
41709
  const from = row.scrollLeft;
41697
41710
  const {
@@ -41714,8 +41727,11 @@ const RouteTravel = ({
41714
41727
  const playing = {
41715
41728
  // Where this travel put the row, for a scroll event to tell it from a hand.
41716
41729
  written: from,
41717
- stop: () => {
41730
+ cancelFrame: () => {
41718
41731
  cancelAnimationFrame(frame);
41732
+ },
41733
+ stop: () => {
41734
+ playing.cancelFrame();
41719
41735
  if (movement.playing === playing) {
41720
41736
  movement.playing = null;
41721
41737
  row.removeAttribute("data-route-row-travelling");
@@ -41724,9 +41740,12 @@ const RouteTravel = ({
41724
41740
  };
41725
41741
  const step = now => {
41726
41742
  if (start === null) {
41727
- start = now;
41743
+ // When this frame runs, not when it began: under load it began while the
41744
+ // press was still being handled, and that time is no travel.
41745
+ start = performance.now();
41728
41746
  }
41729
- const elapsed = (now - start) / travelMs;
41747
+ // The next frame may have begun while this first one was still being handled.
41748
+ const elapsed = now > start ? (now - start) / travelMs : 0;
41730
41749
  // Read at every frame: the layout may move under the travel (a scrollbar
41731
41750
  // coming in narrows the row), and it goes where the page stands.
41732
41751
  const to = pane.offsetLeft;