@jsenv/navi 0.29.210 → 0.29.211

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.
@@ -27435,7 +27435,7 @@ installImportMetaCssBuild(import.meta);
27435
27435
 
27436
27436
  /**
27437
27437
  * The window two pages are seen through while one replaces the other, measured
27438
- * once and published for the length of the movement.
27438
+ * at the one moment both exist and published for the length of the movement.
27439
27439
  *
27440
27440
  * Both ways of moving from one route to another need the same numbers, so they
27441
27441
  * are written under the same names and read by the same CSS formulas —
@@ -27460,6 +27460,18 @@ installImportMetaCssBuild(import.meta);
27460
27460
  * in the window — one page is scrolled and the other is not, one has a top
27461
27461
  * bar over it and the other has the screen. Each picture is placed at its
27462
27462
  * own corner inside the window.
27463
+ * - **where the arriving state IS, frame after frame.** The browser places the
27464
+ * group from the live arriving element on every frame of the movement — that
27465
+ * is what makes a picture pair follow an element that moves — and the
27466
+ * formula that moves the group back to the window's corner cancels that
27467
+ * placement with this corner. Read once, the two stop cancelling the moment
27468
+ * anything scrolls the document under the movement (a slice landing and
27469
+ * putting a row back, a list placing its default row, a height growing under
27470
+ * a restored offset): the window drifts by as much, and both pictures with
27471
+ * it — the photograph of the page being left included. So this corner alone
27472
+ * is kept live, as often as the browser reads its side of it. It is also
27473
+ * the arriving picture's own corner, which then stays where the page really
27474
+ * is and lands with no jump when the pictures are dropped.
27463
27475
  * - **the band the state being left kept free**, next to the one the arriving
27464
27476
  * state keeps free. A band is furniture — a fixed bar, a sticky row — and
27465
27477
  * the pictures are cut at it so they are not watched painting over it. Read
@@ -27469,8 +27481,11 @@ installImportMetaCssBuild(import.meta);
27469
27481
  * at the one moment the state being left still exists, the cut can be taken
27470
27482
  * at what is furniture on BOTH sides (see the clip formulas).
27471
27483
  *
27472
- * Only the measuring needs JS, and only for the one moment both states exist:
27473
- * the page arriving is in the DOM and the transition has not started playing.
27484
+ * Only the measuring needs JS, and apart from the arriving corner it happens
27485
+ * at the one moment both states exist: the page arriving is in the DOM and the
27486
+ * transition has not started playing. The window, the corner of the state
27487
+ * being left and its band describe a state that no longer exists, and reading
27488
+ * them again is what must never happen.
27474
27489
  * Everything DERIVED from these numbers — the band a fixed bar covers, how far
27475
27490
  * a page travels — is derived in CSS, so the application's own numbers (the
27476
27491
  * room its bars give back, see layout/safe_area.js; what covers the box from
@@ -27571,6 +27586,8 @@ const WINDOW_PROPERTIES = [
27571
27586
  // after another has replaced it must not wipe numbers the new one is standing
27572
27587
  // on.
27573
27588
  let windowOwner = null;
27589
+ // Stops re-reading the arriving state's corner, when a movement is on.
27590
+ let unfollowArrivingState = null;
27574
27591
 
27575
27592
  /**
27576
27593
  * The state being left, taken while rendering is held — the page arriving is
@@ -27616,6 +27633,7 @@ const holdTransitionWindow = (owner, element, stateBefore) => {
27616
27633
  style.setProperty(OLD_BAND_RIGHT_PROPERTY, `${oldBand.right}px`);
27617
27634
  style.setProperty(OLD_BAND_BOTTOM_PROPERTY, `${oldBand.bottom}px`);
27618
27635
  style.setProperty(OLD_BAND_LEFT_PROPERTY, `${oldBand.left}px`);
27636
+ followArrivingState(element, rectAfter);
27619
27637
  };
27620
27638
 
27621
27639
  // The live layout takes the box back. A discontinuity by construction — the
@@ -27627,12 +27645,45 @@ const releaseTransitionWindow = (owner) => {
27627
27645
  return;
27628
27646
  }
27629
27647
  windowOwner = null;
27648
+ if (unfollowArrivingState) {
27649
+ unfollowArrivingState();
27650
+ }
27630
27651
  const { style } = document.documentElement;
27631
27652
  for (const property of WINDOW_PROPERTIES) {
27632
27653
  style.removeProperty(property);
27633
27654
  }
27634
27655
  };
27635
27656
 
27657
+ // The arriving state's corner, re-read every frame — as often as the browser
27658
+ // refreshes the group's placement from the same element (see the top of the
27659
+ // file). Requested, never awaited: the first call runs inside the update
27660
+ // callback, where a frame cannot come. Written only when it moved: a custom
27661
+ // property set on the root recomputes the style of the whole document.
27662
+ const followArrivingState = (element, rectAtHold) => {
27663
+ if (unfollowArrivingState) {
27664
+ unfollowArrivingState();
27665
+ }
27666
+ const { style } = document.documentElement;
27667
+ let top = rectAtHold.top;
27668
+ let left = rectAtHold.left;
27669
+ let frame = requestAnimationFrame(function read() {
27670
+ const rect = element.getBoundingClientRect();
27671
+ if (rect.top !== top) {
27672
+ top = rect.top;
27673
+ style.setProperty(WINDOW_NEW_TOP_PROPERTY, `${top}px`);
27674
+ }
27675
+ if (rect.left !== left) {
27676
+ left = rect.left;
27677
+ style.setProperty(WINDOW_NEW_LEFT_PROPERTY, `${left}px`);
27678
+ }
27679
+ frame = requestAnimationFrame(read);
27680
+ });
27681
+ unfollowArrivingState = () => {
27682
+ unfollowArrivingState = null;
27683
+ cancelAnimationFrame(frame);
27684
+ };
27685
+ };
27686
+
27636
27687
  // A band nothing can be wider than, published for an edge nothing is known
27637
27688
  // about: taken as the smaller of the two, it leaves the live band standing on
27638
27689
  // its own, which is the movement navi played before it knew any of this.
@@ -74880,6 +74931,14 @@ function WheelUI(props) {
74880
74931
  if (trackedItemsRef.current.length === 0) {
74881
74932
  return;
74882
74933
  }
74934
+ // Without a box (display: none, rows not laid out yet) every position below
74935
+ // multiplies by an item size of 0: nothing can be placed. Leave
74936
+ // centeredIndexRef null rather than claim a row is centered, so the render
74937
+ // that brings the wheel back on screen doesn't read it as "already there".
74938
+ if (getItemSize(viewportEl) === 0) {
74939
+ centeredIndexRef.current = null;
74940
+ return;
74941
+ }
74883
74942
  let selectedIndex = getIndexForValue(currentValueRef.current);
74884
74943
  if (selectedIndex < 0) {
74885
74944
  selectedIndex = 0;
@@ -74926,7 +74985,7 @@ function WheelUI(props) {
74926
74985
  const requestedBehavior = pendingBehaviorRef.current;
74927
74986
  pendingBehaviorRef.current = null;
74928
74987
  const viewportEl = getViewport();
74929
- if (!viewportEl || viewportEl.offsetParent === null) {
74988
+ if (!viewportEl) {
74930
74989
  return;
74931
74990
  }
74932
74991
  let behavior = "auto";