@jsenv/navi 0.29.400 → 0.29.402

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.
@@ -6288,6 +6288,9 @@ const CONTROL_ATTRIBUTE_SET = new Set([
6288
6288
  "onnavi_command",
6289
6289
  "onnavi_request_open",
6290
6290
  "onnavi_request_close",
6291
+ // The press announcing that request (see announceOpeningPress in
6292
+ // commands.js): heard where the request itself is.
6293
+ "onnavi_open_press",
6291
6294
 
6292
6295
  "data-callout-arrow-x",
6293
6296
  "data-callout-point-to-border-box",
@@ -38554,8 +38557,8 @@ const armOutsidePressClose = (
38554
38557
  * contents; a press is the start of one opening.
38555
38558
  *
38556
38559
  * Only what opens the popup can say its press is one, and it says so as the
38557
- * press starts, with a `navi_open_press` on the popup (see
38558
- * announceOpeningPress in commands.js): a `--navi-open` button, a picker's
38560
+ * press starts, with a `navi_open_press` delivered where the opening request
38561
+ * would be (see announceOpeningPress in commands.js): a `--navi-open` button, a picker's
38559
38562
  * trigger when a press is what opens it, an expandable's UI part. Not the
38560
38563
  * anchor: it says where the popup is placed, not what opens it — a card
38561
38564
  * opened by a hold is pressed all day by taps meant for what it holds.
@@ -38701,42 +38704,36 @@ const usePopupContentMount = (
38701
38704
  anchorElement.removeEventListener("focusin", warm);
38702
38705
  };
38703
38706
  }, [contentMounted, anchor, mount]);
38704
- // Warm on an opening press, for "while-opened" (see the top comment).
38705
- // Listening for as long as the popup is there, not only while the content is
38706
- // unmounted: the press that throws a warmed content away can be a new
38707
- // opening press of this same popup, and it must warm again.
38708
- useEffect(() => {
38709
- if (mount !== "while-opened") {
38710
- return undefined;
38711
- }
38712
- const element = openController.getElement?.();
38713
- if (!element) {
38714
- return undefined;
38715
- }
38716
- let stopPressWarm = null;
38717
- const onOpeningPress = () => {
38718
- if (contentMountedRef.current || openController.onOpen) {
38719
- return;
38720
- }
38721
- const cancelBuild = requestFrameAfterNext(() => {
38722
- setContentMounted(true);
38723
- });
38724
- const stopWatching = watchPressEnd(() => {
38725
- stopPressWarm = null;
38726
- cancelBuild();
38727
- if (!openController.opened) {
38728
- setContentMounted(false);
38707
+ // Warm on an opening press, for "while-opened" (see the top comment). Told
38708
+ // by the popup's own element, which hears the announcement where it hears
38709
+ // the opening request: `onnavi_open_press` beside each `onnavi_request_open`.
38710
+ const stopPressWarmRef = useRef(null);
38711
+ openController.onOpeningPress =
38712
+ mount === "while-opened"
38713
+ ? () => {
38714
+ if (contentMountedRef.current || openController.onOpen) {
38715
+ return;
38716
+ }
38717
+ const cancelBuild = requestFrameAfterNext(() => {
38718
+ setContentMounted(true);
38719
+ });
38720
+ const stopWatching = watchPressEnd(() => {
38721
+ stopPressWarmRef.current = null;
38722
+ cancelBuild();
38723
+ if (!openController.opened) {
38724
+ setContentMounted(false);
38725
+ }
38726
+ });
38727
+ stopPressWarmRef.current = () => {
38728
+ stopPressWarmRef.current = null;
38729
+ cancelBuild();
38730
+ stopWatching();
38731
+ };
38729
38732
  }
38730
- });
38731
- stopPressWarm = () => {
38732
- cancelBuild();
38733
- stopWatching();
38734
- };
38735
- };
38736
- element.addEventListener("navi_open_press", onOpeningPress);
38733
+ : null;
38734
+ useEffect(() => {
38737
38735
  return () => {
38738
- stopPressWarm?.();
38739
- element.removeEventListener("navi_open_press", onOpeningPress);
38736
+ stopPressWarmRef.current?.();
38740
38737
  };
38741
38738
  }, [mount]);
38742
38739
 
@@ -52302,6 +52299,13 @@ const Expandable = props => {
52302
52299
  onnavi_request_open: e => {
52303
52300
  rest.onnavi_request_open?.(e);
52304
52301
  openController.open(e);
52302
+ }
52303
+ // The press announcing that request (see announceOpeningPress in
52304
+ // commands.js), heard where the request is.
52305
+ ,
52306
+ onnavi_open_press: e => {
52307
+ rest.onnavi_open_press?.(e);
52308
+ openController.onOpeningPress?.();
52305
52309
  },
52306
52310
  onnavi_request_close: e => {
52307
52311
  rest.onnavi_request_close?.(e);
@@ -52381,6 +52385,9 @@ const ExpandableUI = ({
52381
52385
  onnavi_request_open: e => {
52382
52386
  openController.open(e);
52383
52387
  },
52388
+ onnavi_open_press: () => {
52389
+ openController.onOpeningPress?.();
52390
+ },
52384
52391
  onnavi_request_close: e => {
52385
52392
  openController.requestClose(e, {
52386
52393
  isCancel: e.detail?.isCancel
@@ -64667,6 +64674,12 @@ const UncontrolledDialog = props => {
64667
64674
  // built (see open_controller.js).
64668
64675
  value: e.detail?.value
64669
64676
  });
64677
+ }
64678
+ // The press announcing that request (see announceOpeningPress in
64679
+ // commands.js), heard where the request is.
64680
+ ,
64681
+ onnavi_open_press: () => {
64682
+ openController.onOpeningPress?.();
64670
64683
  },
64671
64684
  onnavi_request_close: e => {
64672
64685
  const closing = openController.requestClose(e, {
@@ -66430,6 +66443,12 @@ const UncontrolledPopover = props => {
66430
66443
  // built (see open_controller.js).
66431
66444
  value: e.detail?.value
66432
66445
  });
66446
+ }
66447
+ // The press announcing that request (see announceOpeningPress in
66448
+ // commands.js), heard where the request is.
66449
+ ,
66450
+ onnavi_open_press: () => {
66451
+ openController.onOpeningPress?.();
66433
66452
  },
66434
66453
  onnavi_request_close: e => {
66435
66454
  const closing = openController.requestClose(e, {
@@ -67386,7 +67405,8 @@ const usePopoverProps = props => {
67386
67405
  onKeyDownShortcuts(e);
67387
67406
  },
67388
67407
  children
67389
- // onnavi_request_open/onnavi_request_close: for the uncontrolled case,
67408
+ // onnavi_request_open/onnavi_request_close/onnavi_open_press: for the
67409
+ // uncontrolled case,
67390
67410
  // already arrive here as plain props via ...rest (wired by
67391
67411
  // UncontrolledPopover above, forwarded through ControlledPopover's own
67392
67412
  // {...props} spread) — nothing extra to add here. A controlled caller
@@ -68257,6 +68277,12 @@ const PickerCustom = props => {
68257
68277
  }
68258
68278
  });
68259
68279
  },
68280
+ // The press announcing that request (see announceOpeningPress in
68281
+ // commands.js), heard where the request is — here too for the same
68282
+ // reason. Nothing to gate: the announcer asked before saying it.
68283
+ onnavi_open_press: () => {
68284
+ openController.onOpeningPress?.();
68285
+ },
68260
68286
  onnavi_request_close: e => {
68261
68287
  requestInteraction({
68262
68288
  event: e,
@@ -68729,6 +68755,7 @@ const PickerCalloutPopup = ({
68729
68755
  onnavi_request_open,
68730
68756
  onnavi_request_close,
68731
68757
  onnavi_request_confirm,
68758
+ onnavi_open_press,
68732
68759
  mount,
68733
68760
  children: childrenProp
68734
68761
  }) => {
@@ -68821,6 +68848,7 @@ const PickerCalloutPopup = ({
68821
68848
  onnavi_request_open: onnavi_request_open,
68822
68849
  onnavi_request_close: onnavi_request_close,
68823
68850
  onnavi_request_confirm: onnavi_request_confirm,
68851
+ onnavi_open_press: onnavi_open_press,
68824
68852
  children: jsx("div", {
68825
68853
  ref: hostRef,
68826
68854
  "data-picker-content": "",
@@ -77690,11 +77718,12 @@ const PickerButton = props => {
77690
77718
  // we re-dispatch on the input (to get escape to close for instance)
77691
77719
  ,
77692
77720
  onKeyDown: inputProps.onKeyDown
77693
- // in case request open/close are dispatched on the control root ->
77694
- // redispatch them to the host
77721
+ // in case request open/close (or the press announcing an open) are
77722
+ // dispatched on the control root -> redispatch them to the host
77695
77723
  ,
77696
77724
  onnavi_request_open: inputProps.onnavi_request_open,
77697
- onnavi_request_close: inputProps.onnavi_request_close
77725
+ onnavi_request_close: inputProps.onnavi_request_close,
77726
+ onnavi_open_press: inputProps.onnavi_open_press
77698
77727
  // `--navi-select`/`--navi-unselect` about one entry of the list the
77699
77728
  // picker holds — a chip on the façade, a suggestion beside the field.
77700
77729
  // Answered here rather than by the control drawing that list in the