@threadlabs/looma 0.15.7 → 0.16.0

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.
@@ -1,10 +1,17 @@
1
1
  <template component="ui-dialog" controller="./ui-dialog.js">
2
2
  <defs>
3
3
  <prop name="open" type="boolean" default="false">Whether the dialog is open initially or when set externally.</prop>
4
- <prop name="modeless" type="boolean" default="false">Open without a backdrop or making the rest of the page inert; dialogs are modal by default.</prop>
5
- <prop name="closedby" type="any | closerequest | none" default="closerequest"
6
- >Which user close requests work: any includes outside presses, closerequest includes Escape, and none requires an action.</prop>
7
- <prop name="alert" type="boolean" default="false">Use alert dialog semantics and require an explicit action instead of the header close button.</prop>
4
+ <prop name="modal" type="boolean" default="false"
5
+ >Open in the top layer with a backdrop and make the rest of the page inert until it closes, like native showModal(). Without it the dialog is non-modal,
6
+ like native show().</prop>
7
+ <prop name="modeless" type="boolean" default="false"
8
+ >Deprecated: does nothing, since dialogs are non-modal unless modal is set. Accepted so markup written for 0.15 keeps working; modal wins when both are
9
+ set.</prop>
10
+ <prop name="closedby" type="any | closerequest | none"
11
+ >Which user close requests work: any includes outside presses, closerequest includes Escape, and none requires an action. Unset follows native dialog:
12
+ closerequest when modal, none when not.</prop>
13
+ <prop name="alert" type="boolean" default="false"
14
+ >Use alert dialog semantics and require an explicit action instead of the header close button. An alert dialog is always modal.</prop>
8
15
  <prop name="size" type="sm | md | lg | fullscreen" default="md">Choose a compact, standard, wide, or viewport-filling dialog.</prop>
9
16
  <prop name="label" type="string">Visible title in the dialog header; also its accessible name.</prop>
10
17
  <prop name="for" type="string" default="">ID of the control that opens the dialog.</prop>
@@ -58,8 +58,10 @@ export default function controller(host) {
58
58
  else dialog?.removeAttribute("role");
59
59
  syncTrigger();
60
60
  const open = Boolean(host.state.internalOpen);
61
- const modal = !host.state.modeless;
62
- const requestedClosedBy = String(host.state.closedby ?? "closerequest");
61
+ // `modeless` is a deprecated no-op: non-modal is the default. An alert dialog is always modal (APG alertdialog).
62
+ const modal = Boolean(host.state.modal || host.state.alert);
63
+ // An unset or unknown closedby follows native <dialog>'s auto state: closerequest when modal, none otherwise.
64
+ const requestedClosedBy = ["any", "closerequest", "none"].includes(host.state.closedby) ? host.state.closedby : modal ? "closerequest" : "none";
63
65
  const closedBy = host.state.alert && requestedClosedBy === "any" ? "closerequest" : requestedClosedBy;
64
66
  trigger?.setAttribute("aria-expanded", String(open));
65
67
  if (!dialog) return;