@jsenv/navi 0.30.7 → 0.30.9

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.
@@ -41741,9 +41741,11 @@ const readRowStretch = (scroller, pages, page, { sideways } = {}) => {
41741
41741
  /**
41742
41742
  * @param {Element} scroller
41743
41743
  * @param {object} options
41744
- * @param {(move: {finger: boolean}) => void} options.onScroll - the row moved.
41745
- * `finger`: a touch has come since the row last stopped, so a lift will say where
41746
- * it goes (`onLeftToSnap`). Without one (a trackpad, a wheel) nothing will.
41744
+ * @param {(move: {finger: boolean, lifted: boolean}) => void} options.onScroll - the
41745
+ * row moved. `finger`: a touch has come since the row last stopped, so a lift will
41746
+ * say where it goes (`onLeftToSnap`). Without one (a trackpad, a wheel) nothing
41747
+ * will. `lifted`: that finger has lifted and none has landed since: no hand moves
41748
+ * the row, the snap the lift left running does.
41747
41749
  * @param {(event: Event|null) => void} options.onLand - the row may have stopped.
41748
41750
  * Read `pageAtRest` to know whether it stopped on a page. Heard more than once
41749
41751
  * for one landing, so what it does must find nothing to do the second time.
@@ -41774,7 +41776,10 @@ const watchRowScroll = (
41774
41776
  stoppedTimeout = setTimeout(landOnSilence, STOPPED_SILENCE);
41775
41777
  };
41776
41778
  const onScrollEvent = () => {
41777
- onScroll({ finger: touchedSinceStop });
41779
+ onScroll({
41780
+ finger: touchedSinceStop,
41781
+ lifted: touchedSinceStop && !touching,
41782
+ });
41778
41783
  armSilence();
41779
41784
  if (!liftedAt) {
41780
41785
  return;
@@ -42358,7 +42363,8 @@ const RouteTravel = ({
42358
42363
  const row = rowRef.current;
42359
42364
  const isClipped = () => row.getAttribute("data-route-row-taken") === "clip";
42360
42365
  const onScroll = ({
42361
- finger
42366
+ finger,
42367
+ lifted
42362
42368
  }) => {
42363
42369
  const {
42364
42370
  pages,
@@ -42393,6 +42399,12 @@ const RouteTravel = ({
42393
42399
  } = readRowFrame(row, panes);
42394
42400
  followPageOnScreen(pages[panes.indexOf(fraction >= 0.5 && toward ? toward : base)], askedPageRef.current || pages[currentIndex]);
42395
42401
  }
42402
+ // The pull is read from the pane of the address. Once the finger has lifted,
42403
+ // the address is where the snap goes (onLeftToSnap), and what still lies
42404
+ // between is the snap playing out, not a hand pulling towards the neighbour.
42405
+ if (lifted) {
42406
+ return;
42407
+ }
42396
42408
  const pulled = row.scrollLeft - pane.offsetLeft;
42397
42409
  if (Math.abs(pulled) < SET_OFF_PULL) {
42398
42410
  return;
@@ -87358,10 +87370,13 @@ const useListScrollSync = ({
87358
87370
  };
87359
87371
  // Items that came in at another size than what stood in for them (a
87360
87372
  // skeleton becoming its item) leave the window short of the screen, or past
87361
- // it, and nothing scrolled to say so. Asked on the next frame, not inside
87362
- // the resize delivery: the window it frames is a render, which resizes what
87363
- // is observed once more, and the browser gives up on the loop
87364
- // ("ResizeObserver loop completed with undelivered notifications").
87373
+ // it, and nothing scrolled to say so. A held list too: its hold places it but
87374
+ // leaves the window to the screen (see holdWindow), and a placement that
87375
+ // moves nothing — a document too short to scroll — fires no scroll that
87376
+ // would size it. Asked on the next frame, not inside the resize delivery:
87377
+ // the window it frames is a render, which resizes what is observed once
87378
+ // more, and the browser gives up on the loop ("ResizeObserver loop
87379
+ // completed with undelivered notifications").
87365
87380
  const onItemsResizedRef = useRef(null);
87366
87381
  onItemsResizedRef.current = () => {
87367
87382
  settleWindow();
@@ -87526,9 +87541,7 @@ const useListScrollSync = ({
87526
87541
  const putTopItemBack = entries => {
87527
87542
  const listResized = entries.some(entry => entry.target === listEl);
87528
87543
  if (listResized) {
87529
- if (onGeometryChangeRef.current()) {
87530
- return;
87531
- }
87544
+ const placed = onGeometryChangeRef.current();
87532
87545
  cancelAnimationFrame(itemsResizedFrame);
87533
87546
  itemsResizedFrame = requestAnimationFrame(() => {
87534
87547
  if (pageLeftRef.current) {
@@ -87536,6 +87549,9 @@ const useListScrollSync = ({
87536
87549
  }
87537
87550
  onItemsResizedRef.current();
87538
87551
  });
87552
+ if (placed) {
87553
+ return;
87554
+ }
87539
87555
  }
87540
87556
  if (!entries.some(entry => entry.target === scrollerEl)) {
87541
87557
  return;