@jsenv/navi 0.29.495 → 0.29.497

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.
@@ -80767,12 +80767,14 @@ const PickerCustomResolver = props => {
80767
80767
  return renderResolver(PickerNative, props);
80768
80768
  }
80769
80769
  if (props.mode === "callout") {
80770
- // A tooltip is an icon one presses, unless told otherwise. Own-property
80771
- // rather than undefined: an explicit variant={undefined} asks for the
80772
- // field-like drawing back. "circle" is the icon variant with the status
80773
- // icon drawn round — a word about the trigger, not a drawing of its own.
80774
- if (!Object.hasOwn(props, "variant")) {
80770
+ // A tooltip is an icon one presses, unless told otherwise; "picker" asks
80771
+ // for the field-like drawing back. "circle" is the icon variant with the
80772
+ // status icon drawn round — a word about the trigger, not a drawing of its
80773
+ // own.
80774
+ if (props.variant === undefined) {
80775
80775
  props.variant = "icon";
80776
+ } else if (props.variant === "picker") {
80777
+ props.variant = undefined;
80776
80778
  }
80777
80779
  const circle = props.variant === "circle";
80778
80780
  if (circle) {
@@ -82277,11 +82279,10 @@ const PickerConfirmResolver = props => {
82277
82279
  openWhileReadOnly = false
82278
82280
  } = props;
82279
82281
  // A button, unless told otherwise: nothing is picked here, the popup is a
82280
- // question, and a question is asked by pressing something. "picker" — or an
82281
- // explicit `variant={undefined}` — is how a caller asks for the field-like
82282
- // drawing back; a destructuring default could not tell that from nothing
82283
- // being said.
82284
- const variant = Object.hasOwn(props, "variant") ? props.variant === "picker" ? undefined : props.variant : "button";
82282
+ // question, and a question is asked by pressing something. "picker" is how a
82283
+ // caller asks for the field-like drawing back — a word, not an undefined, so
82284
+ // a wrapper forwarding `variant={variant}` keeps the button.
82285
+ const variant = props.variant === undefined ? "button" : props.variant === "picker" ? undefined : props.variant;
82285
82286
 
82286
82287
  // From the picker's own input, as its press would have been: the input is
82287
82288
  // what carries `command`/`commandFor` in the DOM, and what a form sending
@@ -86714,19 +86715,28 @@ const useListScrollSync = ({
86714
86715
  });
86715
86716
  }, []);
86716
86717
  // What to do when the list's own geometry moves under it, kept fresh for the
86717
- // observer below (which is installed once).
86718
+ // observer below (which is installed once). A held list is placed inside the
86719
+ // resize delivery, so the browser paints it where it lands; answers whether
86720
+ // it was.
86718
86721
  const onGeometryChangeRef = useRef(null);
86719
86722
  onGeometryChangeRef.current = () => {
86720
- settleWindow();
86721
- if (heldSomewhere) {
86722
- placeWhereHeld();
86723
- return true;
86723
+ if (!heldSomewhere) {
86724
+ return false;
86724
86725
  }
86725
- // Items that came in at another size than what stood in for them (a
86726
- // skeleton becoming its item) leave the window short of the screen, or past
86727
- // it, and nothing scrolled to say so.
86726
+ settleWindow();
86727
+ placeWhereHeld();
86728
+ return true;
86729
+ };
86730
+ // Items that came in at another size than what stood in for them (a
86731
+ // skeleton becoming its item) leave the window short of the screen, or past
86732
+ // it, and nothing scrolled to say so. Asked on the next frame, not inside
86733
+ // the resize delivery: the window it frames is a render, which resizes what
86734
+ // is observed once more, and the browser gives up on the loop
86735
+ // ("ResizeObserver loop completed with undelivered notifications").
86736
+ const onItemsResizedRef = useRef(null);
86737
+ onItemsResizedRef.current = () => {
86738
+ settleWindow();
86728
86739
  evaluateWindowRef.current("items resized");
86729
- return false;
86730
86740
  };
86731
86741
  // The box around a held list changing shape is the hold's to answer too: it
86732
86742
  // places the list again, the way it writes every scroll of its own (see
@@ -86875,10 +86885,20 @@ const useListScrollSync = ({
86875
86885
  // which this would undo. The SCROLLER resizing is the window around it
86876
86886
  // changing shape, and then the item that was at the top goes back where it
86877
86887
  // was.
86888
+ let itemsResizedFrame;
86878
86889
  const putTopItemBack = entries => {
86879
86890
  const listResized = entries.some(entry => entry.target === listEl);
86880
- if (listResized && onGeometryChangeRef.current()) {
86881
- return;
86891
+ if (listResized) {
86892
+ if (onGeometryChangeRef.current()) {
86893
+ return;
86894
+ }
86895
+ cancelAnimationFrame(itemsResizedFrame);
86896
+ itemsResizedFrame = requestAnimationFrame(() => {
86897
+ if (pageLeftRef.current) {
86898
+ return;
86899
+ }
86900
+ onItemsResizedRef.current();
86901
+ });
86882
86902
  }
86883
86903
  if (!entries.some(entry => entry.target === scrollerEl)) {
86884
86904
  return;
@@ -86931,6 +86951,7 @@ const useListScrollSync = ({
86931
86951
  observer.observe(listEl);
86932
86952
  return () => {
86933
86953
  observer.disconnect();
86954
+ cancelAnimationFrame(itemsResizedFrame);
86934
86955
  };
86935
86956
  }, [scrollerElResolved]);
86936
86957
 
@@ -87536,7 +87557,7 @@ const useStuckWindowWarning = ({
87536
87557
  // Scrolling nothing, the box keeps out of reach only the items past what
87537
87558
  // it shows. A list standing whole on the window's screen is one the window
87538
87559
  // covers at its next evaluation: an item added in this commit is drawn on
87539
- // the resize it causes (see onGeometryChangeRef), after this effect.
87560
+ // the resize it causes (see onItemsResizedRef), after this effect.
87540
87561
  const listEl = getListEl();
87541
87562
  if (!listEl) {
87542
87563
  return;
@@ -95001,9 +95022,8 @@ const PickerUI = /*#__PURE__*/Object.assign(PickerDefaultUI, {
95001
95022
  * not sit in — an object on a map saying
95002
95023
  * `triggerNaviCommand(pickerEl, "--navi-open", event, { anchor, value })` —
95003
95024
  * therefore wants an element of its own to stretch into rather than the
95004
- * nearest positioned ancestor it happens to find. `"picker"` (or an explicit
95005
- * `variant={undefined}`) asks a confirm or callout picker for the field-like
95006
- * drawing every other picker has.
95025
+ * nearest positioned ancestor it happens to find. `"picker"` asks a confirm
95026
+ * or callout picker for the field-like drawing every other picker has.
95007
95027
  * @param {boolean} [cta] A call to action: filled with the accent, its border
95008
95028
  * matching, as `cta` draws a Button — for a confirm picker that is a row's
95009
95029
  * main action.