@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.
@@ -27871,7 +27871,7 @@ installImportMetaCssBuild(import.meta);
27871
27871
 
27872
27872
  /**
27873
27873
  * The window two pages are seen through while one replaces the other, measured
27874
- * once and published for the length of the movement.
27874
+ * at the one moment both exist and published for the length of the movement.
27875
27875
  *
27876
27876
  * Both ways of moving from one route to another need the same numbers, so they
27877
27877
  * are written under the same names and read by the same CSS formulas —
@@ -27896,6 +27896,18 @@ installImportMetaCssBuild(import.meta);
27896
27896
  * in the window — one page is scrolled and the other is not, one has a top
27897
27897
  * bar over it and the other has the screen. Each picture is placed at its
27898
27898
  * own corner inside the window.
27899
+ * - **where the arriving state IS, frame after frame.** The browser places the
27900
+ * group from the live arriving element on every frame of the movement — that
27901
+ * is what makes a picture pair follow an element that moves — and the
27902
+ * formula that moves the group back to the window's corner cancels that
27903
+ * placement with this corner. Read once, the two stop cancelling the moment
27904
+ * anything scrolls the document under the movement (a slice landing and
27905
+ * putting a row back, a list placing its default row, a height growing under
27906
+ * a restored offset): the window drifts by as much, and both pictures with
27907
+ * it — the photograph of the page being left included. So this corner alone
27908
+ * is kept live, as often as the browser reads its side of it. It is also
27909
+ * the arriving picture's own corner, which then stays where the page really
27910
+ * is and lands with no jump when the pictures are dropped.
27899
27911
  * - **the band the state being left kept free**, next to the one the arriving
27900
27912
  * state keeps free. A band is furniture — a fixed bar, a sticky row — and
27901
27913
  * the pictures are cut at it so they are not watched painting over it. Read
@@ -27905,8 +27917,11 @@ installImportMetaCssBuild(import.meta);
27905
27917
  * at the one moment the state being left still exists, the cut can be taken
27906
27918
  * at what is furniture on BOTH sides (see the clip formulas).
27907
27919
  *
27908
- * Only the measuring needs JS, and only for the one moment both states exist:
27909
- * the page arriving is in the DOM and the transition has not started playing.
27920
+ * Only the measuring needs JS, and apart from the arriving corner it happens
27921
+ * at the one moment both states exist: the page arriving is in the DOM and the
27922
+ * transition has not started playing. The window, the corner of the state
27923
+ * being left and its band describe a state that no longer exists, and reading
27924
+ * them again is what must never happen.
27910
27925
  * Everything DERIVED from these numbers — the band a fixed bar covers, how far
27911
27926
  * a page travels — is derived in CSS, so the application's own numbers (the
27912
27927
  * room its bars give back, see layout/safe_area.js; what covers the box from
@@ -28007,6 +28022,8 @@ const WINDOW_PROPERTIES = [
28007
28022
  // after another has replaced it must not wipe numbers the new one is standing
28008
28023
  // on.
28009
28024
  let windowOwner = null;
28025
+ // Stops re-reading the arriving state's corner, when a movement is on.
28026
+ let unfollowArrivingState = null;
28010
28027
 
28011
28028
  /**
28012
28029
  * The state being left, taken while rendering is held — the page arriving is
@@ -28052,6 +28069,7 @@ const holdTransitionWindow = (owner, element, stateBefore) => {
28052
28069
  style.setProperty(OLD_BAND_RIGHT_PROPERTY, `${oldBand.right}px`);
28053
28070
  style.setProperty(OLD_BAND_BOTTOM_PROPERTY, `${oldBand.bottom}px`);
28054
28071
  style.setProperty(OLD_BAND_LEFT_PROPERTY, `${oldBand.left}px`);
28072
+ followArrivingState(element, rectAfter);
28055
28073
  };
28056
28074
 
28057
28075
  // The live layout takes the box back. A discontinuity by construction — the
@@ -28063,12 +28081,45 @@ const releaseTransitionWindow = (owner) => {
28063
28081
  return;
28064
28082
  }
28065
28083
  windowOwner = null;
28084
+ if (unfollowArrivingState) {
28085
+ unfollowArrivingState();
28086
+ }
28066
28087
  const { style } = document.documentElement;
28067
28088
  for (const property of WINDOW_PROPERTIES) {
28068
28089
  style.removeProperty(property);
28069
28090
  }
28070
28091
  };
28071
28092
 
28093
+ // The arriving state's corner, re-read every frame — as often as the browser
28094
+ // refreshes the group's placement from the same element (see the top of the
28095
+ // file). Requested, never awaited: the first call runs inside the update
28096
+ // callback, where a frame cannot come. Written only when it moved: a custom
28097
+ // property set on the root recomputes the style of the whole document.
28098
+ const followArrivingState = (element, rectAtHold) => {
28099
+ if (unfollowArrivingState) {
28100
+ unfollowArrivingState();
28101
+ }
28102
+ const { style } = document.documentElement;
28103
+ let top = rectAtHold.top;
28104
+ let left = rectAtHold.left;
28105
+ let frame = requestAnimationFrame(function read() {
28106
+ const rect = element.getBoundingClientRect();
28107
+ if (rect.top !== top) {
28108
+ top = rect.top;
28109
+ style.setProperty(WINDOW_NEW_TOP_PROPERTY, `${top}px`);
28110
+ }
28111
+ if (rect.left !== left) {
28112
+ left = rect.left;
28113
+ style.setProperty(WINDOW_NEW_LEFT_PROPERTY, `${left}px`);
28114
+ }
28115
+ frame = requestAnimationFrame(read);
28116
+ });
28117
+ unfollowArrivingState = () => {
28118
+ unfollowArrivingState = null;
28119
+ cancelAnimationFrame(frame);
28120
+ };
28121
+ };
28122
+
28072
28123
  // A band nothing can be wider than, published for an edge nothing is known
28073
28124
  // about: taken as the smaller of the two, it leaves the live band standing on
28074
28125
  // its own, which is the movement navi played before it knew any of this.
@@ -76098,6 +76149,14 @@ function WheelUI(props) {
76098
76149
  if (trackedItemsRef.current.length === 0) {
76099
76150
  return;
76100
76151
  }
76152
+ // Without a box (display: none, rows not laid out yet) every position below
76153
+ // multiplies by an item size of 0: nothing can be placed. Leave
76154
+ // centeredIndexRef null rather than claim a row is centered, so the render
76155
+ // that brings the wheel back on screen doesn't read it as "already there".
76156
+ if (getItemSize(viewportEl) === 0) {
76157
+ centeredIndexRef.current = null;
76158
+ return;
76159
+ }
76101
76160
  let selectedIndex = getIndexForValue(currentValueRef.current);
76102
76161
  if (selectedIndex < 0) {
76103
76162
  selectedIndex = 0;
@@ -76144,7 +76203,7 @@ function WheelUI(props) {
76144
76203
  const requestedBehavior = pendingBehaviorRef.current;
76145
76204
  pendingBehaviorRef.current = null;
76146
76205
  const viewportEl = getViewport();
76147
- if (!viewportEl || viewportEl.offsetParent === null) {
76206
+ if (!viewportEl) {
76148
76207
  return;
76149
76208
  }
76150
76209
  let behavior = "auto";