@jsenv/navi 0.29.380 → 0.29.382

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.
@@ -22936,11 +22936,13 @@ const withCurrentHandlers = (computed, props) => {
22936
22936
  * - It runs the update no matter what. A transition is about the animation,
22937
22937
  * never about the change.
22938
22938
  * - It swallows the rejection a SKIPPED transition produces. Starting a
22939
- * transition while another is running skips that other one, and a skipped
22940
- * transition rejects its promises; nothing is waiting on them, so the
22941
- * rejection surfaces as an unhandled error (a full error overlay in dev) for
22942
- * something that is not an error at all — two updates close together is
22943
- * normal in a list that is being edited.
22939
+ * transition while another is running skips that other one, and so does the
22940
+ * document going hidden or its viewport changing size mid-movement; a skipped
22941
+ * transition rejects `ready` with a DOMException that has no stack. Nothing
22942
+ * is waiting on it, so the rejection surfaces as an unhandled error (a full
22943
+ * error overlay in dev, an `unhandledrejection` in an app's error reporting)
22944
+ * for something that is not an error at all — two updates close together is
22945
+ * normal in a list that is being edited, and a phone locks its screen.
22944
22946
  *
22945
22947
  * navi calls it from wherever it animates a DOM change itself (see list.jsx),
22946
22948
  * which is why an application using navi finds the API already there.
@@ -23002,12 +23004,22 @@ const startViewTransition$2 = (updateCallback) => {
23002
23004
  };
23003
23005
 
23004
23006
  // "Skipped" is an outcome, not a failure — anything else is still a real error
23005
- // and must keep travelling.
23007
+ // and must keep travelling. The browser skips for three reasons and names them
23008
+ // differently: `skipTransition()` / another transition starting is an
23009
+ // "AbortError" that says skipped, while a document hidden mid-movement, a
23010
+ // snapshot containing block that changed size (address bar folding, keyboard
23011
+ // opening) and the DOM-update timeout are "InvalidStateError"s that say
23012
+ // aborted. All three are recognized by the message: the name alone would let
23013
+ // an update callback throwing its own InvalidStateError pass for a skip.
23006
23014
  const ignoreSkip = (e) => {
23007
23015
  if (e && e.name === "AbortError") {
23008
23016
  return;
23009
23017
  }
23010
- if (e && typeof e.message === "string" && e.message.includes("skipped")) {
23018
+ if (
23019
+ e &&
23020
+ typeof e.message === "string" &&
23021
+ /^Transition was (?:skipped|aborted)/.test(e.message)
23022
+ ) {
23011
23023
  return;
23012
23024
  }
23013
23025
  throw e;
@@ -40905,6 +40917,11 @@ const uiStateHoldsNothing = (uiState) => {
40905
40917
  */
40906
40918
  const NO_ACTION_YET = Symbol("no_action_yet");
40907
40919
 
40920
+ // The control types rendered as an element `<label for>` can name: HTML's
40921
+ // labelable elements are button, input, select, textarea, output, meter and
40922
+ // progress — a picker's trigger is one of them, a link or a details is not.
40923
+ const CONTROL_TYPES_A_LABEL_CAN_POINT_AT = new Set(["button", "input", "select", "picker"]);
40924
+
40908
40925
  // Resets field-specific contexts so nested fields inside this component
40909
40926
  // don't inherit the current field's id, message props, or interface reporting.
40910
40927
  // Sets ParentUIStateControllerContext to the leaf's own uiStateController so
@@ -41002,8 +41019,13 @@ const useControlProps = (props, {
41002
41019
  standalone
41003
41020
  } = props;
41004
41021
  const idDefault = useId();
41005
- const controlId = useContext(ControlIdContext);
41006
- props.id = props.id || controlId || idDefault;
41022
+ // A Field's id is what its Label points at, so only a control a label can
41023
+ // point at (see the set) takes it. A link in the label's own text is a
41024
+ // control too, but never that target: taking the id would make two elements
41025
+ // answer for it, and the label would read the link's state as its control's.
41026
+ const fieldId = useContext(ControlIdContext);
41027
+ const labelable = CONTROL_TYPES_A_LABEL_CAN_POINT_AT.has(controlType);
41028
+ props.id = props.id || (labelable ? fieldId : undefined) || idDefault;
41007
41029
  const controlName = useContext(ControlNameContext);
41008
41030
  props.name = props.name || controlName;
41009
41031
  const isCheckable = isCheckableInput(controlType, props.type);