@optionfactory/fml 9.0.0-rc23 → 9.0.0-rc24

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.
package/dist/ful.mjs CHANGED
@@ -693,6 +693,11 @@ class Bindings {
693
693
  * `rest` being the remainder of the path (`''` on an exact match) that a
694
694
  * composite can use to route the problem to an inner control.
695
695
  *
696
+ * A control counts only when it can show a problem, through a
697
+ * `setCustomValidity` of its own: a form-associated element that has none is
698
+ * skipped, so its problems fall to a shorter prefix or to the banner instead
699
+ * of being dropped.
700
+ *
696
701
  * Every other problem, and a field problem naming no control, is shown in
697
702
  * each `ful-errors` banner of the form: the banner gets `role="alert"`, is
698
703
  * revealed and holds the reasons one per line. With no such problem the
@@ -731,7 +736,7 @@ class Bindings {
731
736
  const parts = name.split('.');
732
737
  for (let i = parts.length; i !== 0; --i) {
733
738
  const prefix = parts.slice(0, i).join('.');
734
- const targets = named.get(prefix) ?? [];
739
+ const targets = (named.get(prefix) ?? []).filter((el) => typeof el.setCustomValidity === 'function');
735
740
  if (targets.length === 0) {
736
741
  continue;
737
742
  }
@@ -1189,6 +1194,14 @@ class Field extends ParsedElement {
1189
1194
  * accessibility tree.
1190
1195
  * - `also` are further controls that mirror `disabled` and `readOnly`
1191
1196
  * beside the claim target.
1197
+ *
1198
+ * The pieces are elements the field rendered itself, native controls or
1199
+ * wrappers of its own. A ful field is not one: it has no `readOnly`, its
1200
+ * host's role takes no aria, and a label's `for` names its host rather than
1201
+ * its control. A composite built from ful fields answers the inner field as
1202
+ * `control`, which forwards `focus()`, lets it render its own label with
1203
+ * `label` and `announces` null, and forwards the claims in its setters,
1204
+ * calling super first.
1192
1205
  * @param {{ slots: Record<string, DocumentFragment> | undefined }} conf
1193
1206
  * @returns {any} the pieces, or a promise of them
1194
1207
  * @throws {Error} when the subclass does not implement it
@@ -4576,7 +4589,7 @@ class RadioGroup extends Field {
4576
4589
  return;
4577
4590
  }
4578
4591
  /** @type {HTMLInputElement|null} */
4579
- const el = this.querySelector(`input[type=radio][value=${CSS.escape(String(value))}]`);
4592
+ const el = this.querySelector(`input[type=radio][value="${CSS.escape(String(value))}"]`);
4580
4593
  if (el === null) {
4581
4594
  clear();
4582
4595
  return;
@@ -6850,11 +6863,12 @@ class DialogSections {
6850
6863
  * `show`, and fills the content with what the callback resolves to. A
6851
6864
  * rejection is shown, as the problems' reasons, in the error section, and
6852
6865
  * the content is hidden. When a newer `update()` starts before the callback
6853
- * settles, this call paints nothing: it resolves with the section regardless,
6854
- * and still rejects with the callback's error.
6866
+ * settles, this call paints nothing and resolves `null`, the section being
6867
+ * the newer call's; it still rejects with the callback's error.
6855
6868
  * @param {() => Node|string|Promise<Node|string>} cb producing the content
6856
6869
  * @param {() => void} show opens the dialog when it is closed
6857
- * @returns {Promise<HTMLElement>} the content section
6870
+ * @returns {Promise<HTMLElement|null>} the content section, or `null` for a
6871
+ * call a newer one overtook
6858
6872
  * @throws {any} what the callback threw or rejected with
6859
6873
  */
6860
6874
  async update(cb, show) {
@@ -6867,7 +6881,7 @@ class DialogSections {
6867
6881
  try {
6868
6882
  const delivered = await cb();
6869
6883
  if (claim.stale) {
6870
- return this.#section;
6884
+ return null;
6871
6885
  }
6872
6886
  this.#section.replaceChildren(delivered);
6873
6887
  this.#loading?.setAttribute('hidden', '');
@@ -7113,11 +7127,12 @@ class Dialog extends ParsedElement {
7113
7127
  *
7114
7128
  * No `section:requested` is dispatched, and no `ask()` waiter is added:
7115
7129
  * listen for the `close` event to learn how the dialog ended. When a newer
7116
- * `update()` starts before the callback settles, this call paints nothing:
7117
- * it resolves with the body regardless, and still rejects with the
7118
- * callback's error.
7130
+ * `update()` starts before the callback settles, this call paints nothing
7131
+ * and resolves `null`, the body being the newer call's; it still rejects
7132
+ * with the callback's error.
7119
7133
  * @param {() => Node|string|Promise<Node|string>} cb producing the body content
7120
- * @returns {Promise<Element>} the body section, in the document
7134
+ * @returns {Promise<Element|null>} the body section, in the document, or
7135
+ * `null` for a call a newer one overtook
7121
7136
  * @throws {any} what the callback threw or rejected with
7122
7137
  */
7123
7138
  async update(cb) {
@@ -7407,12 +7422,13 @@ class Drawer extends ParsedElement {
7407
7422
  * which has `role="alert"`, and the content is hidden.
7408
7423
  *
7409
7424
  * No `section:requested` is dispatched. When a newer `update()` starts
7410
- * before the callback settles, this call paints nothing: it resolves with
7411
- * the content section regardless, and still rejects with the callback's
7412
- * error.
7425
+ * before the callback settles, this call paints nothing and resolves
7426
+ * `null`, the content section being the newer call's; it still rejects with
7427
+ * the callback's error.
7413
7428
  * @param {string} header the title, set as text
7414
7429
  * @param {() => Node|string|Promise<Node|string>} cb producing the content
7415
- * @returns {Promise<Element>} the content section, in the document
7430
+ * @returns {Promise<Element|null>} the content section, in the document, or
7431
+ * `null` for a call a newer one overtook
7416
7432
  * @throws {any} what the callback threw or rejected with
7417
7433
  */
7418
7434
  async update(header, cb) {