@jsenv/navi 0.29.463 → 0.29.464

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.
@@ -11837,6 +11837,8 @@ const keptNameWeakMap = new WeakMap();
11837
11837
  const getRouteActionKeptName = (routeAction) => {
11838
11838
  return keptNameWeakMap.get(routeAction);
11839
11839
  };
11840
+ // Shared by every route action without a `when`.
11841
+ const NOT_GATED_SIGNAL = signal(false);
11840
11842
  let activeRouteActionsPrevious = new Set();
11841
11843
  /**
11842
11844
  * The route actions asking something for the page on screen: their route
@@ -11863,19 +11865,17 @@ const activeRouteActionsSignal = computed(() => {
11863
11865
  });
11864
11866
 
11865
11867
  /**
11866
- * Whether a route action of the page on screen asks nothing yet: its route
11867
- * matches and its params (or `when`) say no. Gated on app state not there yet,
11868
- * or never meant to ask on this page — nothing tells one from the other before
11869
- * it asks. Read by the scroll restoration, which stays ready for it.
11868
+ * Whether a route action of the page on screen waits for app state to ask: its
11869
+ * route matches and its `when` says no. Params that say no are not waiting:
11870
+ * they read the address, and this one asks nothing of the action — a later ask
11871
+ * is the page changing under the reader (a search typed), not arriving. Read
11872
+ * by the scroll restoration, which stays ready for it.
11870
11873
  *
11871
11874
  * @type {import("@preact/signals").ReadonlySignal<boolean>}
11872
11875
  */
11873
11876
  const routeActionYetToAskSignal = computed(() => {
11874
- for (const {
11875
- routeMatchingSignal,
11876
- askingSignal,
11877
- } of routeActionEntriesSignal.value) {
11878
- if (routeMatchingSignal.value && !askingSignal.value) {
11877
+ for (const { gatedSignal } of routeActionEntriesSignal.value) {
11878
+ if (gatedSignal.value) {
11879
11879
  return true;
11880
11880
  }
11881
11881
  }
@@ -11948,7 +11948,9 @@ const activeRouteReadsSignal = computed(() => {
11948
11948
  * params when the condition holds at that moment — a page's code only some
11949
11949
  * readers may download (`() => meIsAdminSignal.value`). A condition reading
11950
11950
  * the address belongs in the params: a link reads `when` as it is, not as
11951
- * the address it leads to will make it.
11951
+ * the address it leads to will make it. It is also what a reload's scroll
11952
+ * position waits for: the page is not whole while a `when` says no, whereas
11953
+ * params that say no ask nothing on this page (see scroll_restoration.js).
11952
11954
  * @param {boolean} [options.prefetch=true] - `false` keeps the action from
11953
11955
  * being prerun ahead of what asks for it, when the read is not worth a
11954
11956
  * hover or a press that may not end in an opening.
@@ -11995,8 +11997,10 @@ const routeAction = (
11995
11997
  ...routeActionEntriesSignal.peek(),
11996
11998
  {
11997
11999
  routeAction: actionBoundToRoute,
11998
- routeMatchingSignal,
11999
12000
  askingSignal: computed(() => Boolean(readParamsAsked())),
12001
+ gatedSignal: when
12002
+ ? computed(() => Boolean(routeMatchingSignal.value) && !when())
12003
+ : NOT_GATED_SIGNAL,
12000
12004
  },
12001
12005
  ];
12002
12006
  for (const route of routes) {
@@ -12154,8 +12158,8 @@ const haveSameMembers = (setA, setB) => {
12154
12158
  * mount="after-paint">` is built before the offset that shows it is written
12155
12159
  * (see mount_after_paint.jsx), and a reload or a return waits for the route
12156
12160
  * actions the page has nothing to draw for — its code among them — including
12157
- * one that starts asking after the position is written (see
12158
- * putBackOnceAnswered). Anything else only the page knows, and it says so
12161
+ * one whose `when` lets it ask after the position is written (see
12162
+ * stayForLateAsks). Anything else only the page knows, and it says so
12159
12163
  * (useHoldScrollRestoration). A wait can be long, so the reader reaching for
12160
12164
  * the page during it cancels the position: moved afterwards, they would lose
12161
12165
  * whatever they had started on.
@@ -12360,7 +12364,7 @@ const holdScrollRestoration = () => {
12360
12364
  * meantime (a finger, a click, a wheel, a key), or gone elsewhere.
12361
12365
  *
12362
12366
  * The page's route actions are waited for without this — its code, a read
12363
- * with no answer yet, one gated on app state that asks later. This is for
12367
+ * with no answer yet, one whose `when` holds later. This is for
12364
12368
  * what navi cannot see: a read the page starts itself, content whose height
12365
12369
  * arrives late.
12366
12370
  *
@@ -12501,14 +12505,15 @@ const readUnansweredRouteActions = () => {
12501
12505
  return unanswered;
12502
12506
  };
12503
12507
 
12504
- // A page can start asking after the position is written: an action gated on
12505
- // app state not there yet (`when`, or params reading an app-wide read), and
12506
- // nothing tells "not yet" from "never" before it asks (see
12507
- // routeActionYetToAskSignal). So a written position stays pending while a
12508
- // route action of the page has not asked: the next one that starts without an
12509
- // answer is waited for like the first ones, and the position put back once it
12510
- // is drawn. Not told when the restoration is dropped (pendingRestoration is no
12511
- // signal): it notices at its next run.
12508
+ // A page can still be arriving after the position is written: an action whose
12509
+ // `when` waits for app state not there yet (see routeActionYetToAskSignal). So
12510
+ // a written position stays pending while one does: the next one that starts
12511
+ // without an answer is waited for like the first ones, and the position put
12512
+ // back once it is drawn. Params that say no are not waited for: the address
12513
+ // asks nothing of the action, and one that asks later — a search typed — is
12514
+ // the page moving on under the reader, not arriving. Not told when the
12515
+ // restoration is dropped (pendingRestoration is no signal): it notices at its
12516
+ // next run.
12512
12517
  const stayForLateAsks = (restoration) => {
12513
12518
  effect(function () {
12514
12519
  let running = false;
@@ -84420,6 +84425,24 @@ const PickerButton = props => {
84420
84425
  clearConfirm,
84421
84426
  requestValue
84422
84427
  };
84428
+ // `--navi-select`/`--navi-unselect` about one entry of the list the picker
84429
+ // holds — a chip on the façade, a suggestion beside the field. Answered here
84430
+ // rather than by the control drawing that list in the popup, even though rows
84431
+ // are what such a control owns: a picker given its own value builds its popup
84432
+ // only on first open (see popup_content_mount.js), so before that there is no
84433
+ // such control at all — and building the whole popup to have someone to talk
84434
+ // to, for a cross, is the wrong price. The picker holds the value in the first
84435
+ // place and hands it down whenever the popup is built.
84436
+ //
84437
+ // Heard on both elements, like every request a control answers: a chip inside
84438
+ // the picker aims at its root (the parent control), one standing elsewhere
84439
+ // names it with `commandFor`, and the picker's id is on its input.
84440
+ const onRequestSelect = e => {
84441
+ requestPickerListEntry(ref.current, inputRef.current, e, "select");
84442
+ };
84443
+ const onRequestUnselect = e => {
84444
+ requestPickerListEntry(ref.current, inputRef.current, e, "unselect");
84445
+ };
84423
84446
  return (
84424
84447
  /* Read-only crosses into everything the picker is made of: what it really
84425
84448
  holds is drawn by controls of their own — in the popup, and on the façade
@@ -84480,23 +84503,9 @@ const PickerButton = props => {
84480
84503
  ,
84481
84504
  onnavi_request_open: inputProps.onnavi_request_open,
84482
84505
  onnavi_request_close: inputProps.onnavi_request_close,
84483
- onnavi_open_press: inputProps.onnavi_open_press
84484
- // `--navi-select`/`--navi-unselect` about one entry of the list the
84485
- // picker holds — a chip on the façade, a suggestion beside the field.
84486
- // Answered here rather than by the control drawing that list in the
84487
- // popup, even though rows are what such a control owns: a picker given
84488
- // its own value builds its popup only on first open (see
84489
- // popup_content_mount.js), so before that there is no such control at
84490
- // all — and building the whole popup to have someone to talk to, for a
84491
- // cross, is the wrong price. The picker holds the value in the first
84492
- // place and hands it down whenever the popup is built.
84493
- ,
84494
- onnavi_request_select: e => {
84495
- requestPickerListEntry(ref.current, inputRef.current, e, "select");
84496
- },
84497
- onnavi_request_unselect: e => {
84498
- requestPickerListEntry(ref.current, inputRef.current, e, "unselect");
84499
- },
84506
+ onnavi_open_press: inputProps.onnavi_open_press,
84507
+ onnavi_request_select: onRequestSelect,
84508
+ onnavi_request_unselect: onRequestUnselect,
84500
84509
  children: [jsx("span", {
84501
84510
  className: "navi_picker_box",
84502
84511
  style: hangingChevronSize === undefined ? undefined : {
@@ -84518,6 +84527,8 @@ const PickerButton = props => {
84518
84527
  children: undefined // we will render children into the div
84519
84528
  ,
84520
84529
  ui: ui,
84530
+ onnavi_request_select: onRequestSelect,
84531
+ onnavi_request_unselect: onRequestUnselect,
84521
84532
  onCopy: e => {
84522
84533
  const pickerEl = ref.current;
84523
84534
  if (isWithinPickerContent(e.target, pickerEl)) {