@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.
@@ -6067,6 +6067,9 @@ const CONTROL_ATTRIBUTE_SET = new Set([
6067
6067
  "onnavi_command",
6068
6068
  "onnavi_request_open",
6069
6069
  "onnavi_request_close",
6070
+ // The press announcing that request (see announceOpeningPress in
6071
+ // commands.js): heard where the request itself is.
6072
+ "onnavi_open_press",
6070
6073
 
6071
6074
  "data-callout-arrow-x",
6072
6075
  "data-callout-point-to-border-box",
@@ -37556,8 +37559,8 @@ const armOutsidePressClose = (
37556
37559
  * contents; a press is the start of one opening.
37557
37560
  *
37558
37561
  * Only what opens the popup can say its press is one, and it says so as the
37559
- * press starts, with a `navi_open_press` on the popup (see
37560
- * announceOpeningPress in commands.js): a `--navi-open` button, a picker's
37562
+ * press starts, with a `navi_open_press` delivered where the opening request
37563
+ * would be (see announceOpeningPress in commands.js): a `--navi-open` button, a picker's
37561
37564
  * trigger when a press is what opens it, an expandable's UI part. Not the
37562
37565
  * anchor: it says where the popup is placed, not what opens it — a card
37563
37566
  * opened by a hold is pressed all day by taps meant for what it holds.
@@ -37703,42 +37706,36 @@ const usePopupContentMount = (
37703
37706
  anchorElement.removeEventListener("focusin", warm);
37704
37707
  };
37705
37708
  }, [contentMounted, anchor, mount]);
37706
- // Warm on an opening press, for "while-opened" (see the top comment).
37707
- // Listening for as long as the popup is there, not only while the content is
37708
- // unmounted: the press that throws a warmed content away can be a new
37709
- // opening press of this same popup, and it must warm again.
37710
- useEffect(() => {
37711
- if (mount !== "while-opened") {
37712
- return undefined;
37713
- }
37714
- const element = openController.getElement?.();
37715
- if (!element) {
37716
- return undefined;
37717
- }
37718
- let stopPressWarm = null;
37719
- const onOpeningPress = () => {
37720
- if (contentMountedRef.current || openController.onOpen) {
37721
- return;
37722
- }
37723
- const cancelBuild = requestFrameAfterNext(() => {
37724
- setContentMounted(true);
37725
- });
37726
- const stopWatching = watchPressEnd(() => {
37727
- stopPressWarm = null;
37728
- cancelBuild();
37729
- if (!openController.opened) {
37730
- setContentMounted(false);
37709
+ // Warm on an opening press, for "while-opened" (see the top comment). Told
37710
+ // by the popup's own element, which hears the announcement where it hears
37711
+ // the opening request: `onnavi_open_press` beside each `onnavi_request_open`.
37712
+ const stopPressWarmRef = useRef(null);
37713
+ openController.onOpeningPress =
37714
+ mount === "while-opened"
37715
+ ? () => {
37716
+ if (contentMountedRef.current || openController.onOpen) {
37717
+ return;
37718
+ }
37719
+ const cancelBuild = requestFrameAfterNext(() => {
37720
+ setContentMounted(true);
37721
+ });
37722
+ const stopWatching = watchPressEnd(() => {
37723
+ stopPressWarmRef.current = null;
37724
+ cancelBuild();
37725
+ if (!openController.opened) {
37726
+ setContentMounted(false);
37727
+ }
37728
+ });
37729
+ stopPressWarmRef.current = () => {
37730
+ stopPressWarmRef.current = null;
37731
+ cancelBuild();
37732
+ stopWatching();
37733
+ };
37731
37734
  }
37732
- });
37733
- stopPressWarm = () => {
37734
- cancelBuild();
37735
- stopWatching();
37736
- };
37737
- };
37738
- element.addEventListener("navi_open_press", onOpeningPress);
37735
+ : null;
37736
+ useEffect(() => {
37739
37737
  return () => {
37740
- stopPressWarm?.();
37741
- element.removeEventListener("navi_open_press", onOpeningPress);
37738
+ stopPressWarmRef.current?.();
37742
37739
  };
37743
37740
  }, [mount]);
37744
37741
 
@@ -51152,6 +51149,13 @@ const Expandable = props => {
51152
51149
  onnavi_request_open: e => {
51153
51150
  rest.onnavi_request_open?.(e);
51154
51151
  openController.open(e);
51152
+ }
51153
+ // The press announcing that request (see announceOpeningPress in
51154
+ // commands.js), heard where the request is.
51155
+ ,
51156
+ onnavi_open_press: e => {
51157
+ rest.onnavi_open_press?.(e);
51158
+ openController.onOpeningPress?.();
51155
51159
  },
51156
51160
  onnavi_request_close: e => {
51157
51161
  rest.onnavi_request_close?.(e);
@@ -51231,6 +51235,9 @@ const ExpandableUI = ({
51231
51235
  onnavi_request_open: e => {
51232
51236
  openController.open(e);
51233
51237
  },
51238
+ onnavi_open_press: () => {
51239
+ openController.onOpeningPress?.();
51240
+ },
51234
51241
  onnavi_request_close: e => {
51235
51242
  openController.requestClose(e, {
51236
51243
  isCancel: e.detail?.isCancel
@@ -63397,6 +63404,12 @@ const UncontrolledDialog = props => {
63397
63404
  // built (see open_controller.js).
63398
63405
  value: e.detail?.value
63399
63406
  });
63407
+ }
63408
+ // The press announcing that request (see announceOpeningPress in
63409
+ // commands.js), heard where the request is.
63410
+ ,
63411
+ onnavi_open_press: () => {
63412
+ openController.onOpeningPress?.();
63400
63413
  },
63401
63414
  onnavi_request_close: e => {
63402
63415
  const closing = openController.requestClose(e, {
@@ -65078,6 +65091,12 @@ const UncontrolledPopover = props => {
65078
65091
  // built (see open_controller.js).
65079
65092
  value: e.detail?.value
65080
65093
  });
65094
+ }
65095
+ // The press announcing that request (see announceOpeningPress in
65096
+ // commands.js), heard where the request is.
65097
+ ,
65098
+ onnavi_open_press: () => {
65099
+ openController.onOpeningPress?.();
65081
65100
  },
65082
65101
  onnavi_request_close: e => {
65083
65102
  const closing = openController.requestClose(e, {
@@ -66027,7 +66046,8 @@ const usePopoverProps = props => {
66027
66046
  onKeyDownShortcuts(e);
66028
66047
  },
66029
66048
  children
66030
- // onnavi_request_open/onnavi_request_close: for the uncontrolled case,
66049
+ // onnavi_request_open/onnavi_request_close/onnavi_open_press: for the
66050
+ // uncontrolled case,
66031
66051
  // already arrive here as plain props via ...rest (wired by
66032
66052
  // UncontrolledPopover above, forwarded through ControlledPopover's own
66033
66053
  // {...props} spread) — nothing extra to add here. A controlled caller
@@ -66885,6 +66905,12 @@ const PickerCustom = props => {
66885
66905
  }
66886
66906
  });
66887
66907
  },
66908
+ // The press announcing that request (see announceOpeningPress in
66909
+ // commands.js), heard where the request is — here too for the same
66910
+ // reason. Nothing to gate: the announcer asked before saying it.
66911
+ onnavi_open_press: () => {
66912
+ openController.onOpeningPress?.();
66913
+ },
66888
66914
  onnavi_request_close: e => {
66889
66915
  requestInteraction({
66890
66916
  event: e,
@@ -67356,6 +67382,7 @@ const PickerCalloutPopup = ({
67356
67382
  onnavi_request_open,
67357
67383
  onnavi_request_close,
67358
67384
  onnavi_request_confirm,
67385
+ onnavi_open_press,
67359
67386
  mount,
67360
67387
  children: childrenProp
67361
67388
  }) => {
@@ -67448,6 +67475,7 @@ const PickerCalloutPopup = ({
67448
67475
  onnavi_request_open: onnavi_request_open,
67449
67476
  onnavi_request_close: onnavi_request_close,
67450
67477
  onnavi_request_confirm: onnavi_request_confirm,
67478
+ onnavi_open_press: onnavi_open_press,
67451
67479
  children: jsx("div", {
67452
67480
  ref: hostRef,
67453
67481
  "data-picker-content": "",
@@ -76202,11 +76230,12 @@ const PickerButton = props => {
76202
76230
  // we re-dispatch on the input (to get escape to close for instance)
76203
76231
  ,
76204
76232
  onKeyDown: inputProps.onKeyDown
76205
- // in case request open/close are dispatched on the control root ->
76206
- // redispatch them to the host
76233
+ // in case request open/close (or the press announcing an open) are
76234
+ // dispatched on the control root -> redispatch them to the host
76207
76235
  ,
76208
76236
  onnavi_request_open: inputProps.onnavi_request_open,
76209
- onnavi_request_close: inputProps.onnavi_request_close
76237
+ onnavi_request_close: inputProps.onnavi_request_close,
76238
+ onnavi_open_press: inputProps.onnavi_open_press
76210
76239
  // `--navi-select`/`--navi-unselect` about one entry of the list the
76211
76240
  // picker holds — a chip on the façade, a suggestion beside the field.
76212
76241
  // Answered here rather than by the control drawing that list in the