@rcarls/rc-dialog 0.4.2 → 0.6.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.
- package/CHANGELOG.md +20 -0
- package/README.md +49 -46
- package/dist/custom-elements.json +1 -1
- package/dist/{rc-dialog-D9jUBKJn.js → rc-dialog-CPmkVy7u.js} +4 -1
- package/dist/rc-dialog-CPmkVy7u.js.map +1 -0
- package/dist/rc-dialog-define.js +1 -1
- package/dist/rc-dialog.js +1 -1
- package/dist/types/packages/rc-dialog/src/rc-dialog.d.ts +2 -0
- package/package.json +2 -2
- package/dist/rc-dialog-D9jUBKJn.js.map +0 -1
- package/dist/types/packages/rc-dialog/src/rc-dialog.test.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @rcarls/rc-dialog
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 57370e4: Align component metadata, aggregate framework typings, development-time native-child
|
|
8
|
+
validation, controlled menu state, package declarations, and public documentation before the
|
|
9
|
+
next release.
|
|
10
|
+
- Updated dependencies [6683eb9]
|
|
11
|
+
- Updated dependencies [ee7ba6c]
|
|
12
|
+
- Updated dependencies [30eb232]
|
|
13
|
+
- @rcarls/rc-common@0.6.0
|
|
14
|
+
|
|
15
|
+
## 0.5.0
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [4ae2ef0]
|
|
20
|
+
- Updated dependencies [689340c]
|
|
21
|
+
- @rcarls/rc-common@0.5.0
|
|
22
|
+
|
|
3
23
|
## 0.4.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm install @rcarls/rc-dialog
|
|
|
15
15
|
## Import
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
|
-
import '@rcarls/rc-dialog';
|
|
18
|
+
import '@rcarls/rc-dialog'; // side-effect: registers <rc-dialog>
|
|
19
19
|
import { RCDialog } from '@rcarls/rc-dialog'; // named class export
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -45,22 +45,22 @@ Place a `<dialog>` element directly inside `<rc-dialog>`. The inner `<dialog>` m
|
|
|
45
45
|
|
|
46
46
|
### Properties / attributes
|
|
47
47
|
|
|
48
|
-
| Property
|
|
49
|
-
|
|
50
|
-
| `open`
|
|
51
|
-
| `defaultOpen`
|
|
52
|
-
| `modal`
|
|
53
|
-
| `movable`
|
|
54
|
-
| `moveHandle`
|
|
55
|
-
| `moveBounds`
|
|
56
|
-
| `moveStep`
|
|
57
|
-
| `resize`
|
|
58
|
-
| `resizeOrigin`
|
|
59
|
-
| `resizeHandle`
|
|
60
|
-
| `resizeThreshold` | `resize-threshold` | `number`
|
|
61
|
-
| `resizeStep`
|
|
62
|
-
| `closedBy`
|
|
63
|
-
| `lightDismiss`
|
|
48
|
+
| Property | Attribute | Type | Default | Description |
|
|
49
|
+
| ----------------- | ------------------ | -------------------------------------------------------------------------------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| `open` | `open` | `boolean` | None | Controlled open state. Setting to `true`/`false` opens/closes the dialog silently (no `rc-dialog-toggle` event). Reads the inner `<dialog>.open` value. |
|
|
51
|
+
| `defaultOpen` | `default-open` | `boolean` | `false` | Uncontrolled initial open state. The component takes ownership after initialization. |
|
|
52
|
+
| `modal` | None | `boolean` | `true` | Whether controlled `open` / `defaultOpen` opens as modal (`showModal`) or non-modal (`show`). No effect on direct `showModal()` / `show()` calls. JS property only; no attribute. |
|
|
53
|
+
| `movable` | `movable` | `boolean` | `false` | Enable drag-to-move. Named `movable` (not `draggable`) to avoid colliding with the HTML `draggable` attribute. |
|
|
54
|
+
| `moveHandle` | `move-handle` | `string` | `''` | CSS selector for the drag handle within the inner `<dialog>` (for example, `'.titlebar'`). Defaults to the whole dialog. |
|
|
55
|
+
| `moveBounds` | `move-bounds` | `'viewport' \| 'parent'` | `'viewport'` | Constrains drag within the viewport or the nearest positioned ancestor. |
|
|
56
|
+
| `moveStep` | `move-step` | `number` | `4` | Keyboard arrow-key step in px when moving. Shift multiplies by 10×. |
|
|
57
|
+
| `resize` | `resize` | `'none' \| 'both' \| 'horizontal' \| 'vertical'` | `'none'` | Enables edge/corner resizing, mirroring CSS `resize` semantics. |
|
|
58
|
+
| `resizeOrigin` | `resize-origin` | `'' \| 'top' \| 'right' \| 'bottom' \| 'left' \| 'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `''` | Constrains fallback edge detection or supplies the default origin for explicit handles. Empty keeps free edge detection. |
|
|
59
|
+
| `resizeHandle` | `resize-handle` | `string` | `''` | CSS selector for explicit resize handles within the inner `<dialog>`. Matching handles receive pointer and keyboard resize behavior. |
|
|
60
|
+
| `resizeThreshold` | `resize-threshold` | `number` | `8` | Edge hit-test band in px (straddles the border, half inside and half outside). |
|
|
61
|
+
| `resizeStep` | `resize-step` | `number` | `4` | Keyboard arrow-key step in px when resizing. Shift multiplies by 10×. |
|
|
62
|
+
| `closedBy` | `closed-by` | `'any' \| 'closerequest' \| 'none' \| ''` | `''` | Proxied to the inner `<dialog closedby="...">` attribute (Chrome 134+, Safari 18.4+, Firefox 139+). `'any'` = Escape or backdrop click; `'closerequest'` = Escape only; `'none'` = programmatic only. |
|
|
63
|
+
| `lightDismiss` | `light-dismiss` | `boolean` | `false` | JS fallback for backdrop-click dismissal. Detects clicks whose target is the `<dialog>` element itself and calls `requestClose()`. Works in all browsers alongside or instead of `closed-by`. |
|
|
64
64
|
|
|
65
65
|
### Methods
|
|
66
66
|
|
|
@@ -77,19 +77,19 @@ requestClose(returnValue?): void
|
|
|
77
77
|
### Read-only getters
|
|
78
78
|
|
|
79
79
|
```ts
|
|
80
|
-
open: boolean
|
|
81
|
-
returnValue: string
|
|
80
|
+
open: boolean; // Whether the inner <dialog> is currently open.
|
|
81
|
+
returnValue: string; // The return value set when the dialog last closed.
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
### Events
|
|
85
85
|
|
|
86
|
-
| Event
|
|
87
|
-
|
|
88
|
-
| `rc-dialog-open`
|
|
89
|
-
| `rc-dialog-toggle`
|
|
90
|
-
| `rc-dialog-request-close` | **Yes**
|
|
91
|
-
| `rc-dialog-cancel`
|
|
92
|
-
| `rc-dialog-close`
|
|
86
|
+
| Event | Cancelable | Detail | Description |
|
|
87
|
+
| ------------------------- | ---------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
88
|
+
| `rc-dialog-open` | No | None | Fired when the dialog opens via `showModal()` or `show()`. |
|
|
89
|
+
| `rc-dialog-toggle` | No | `{ open: boolean, returnValue: string }` | Fired when user or native interaction changes the open state. Not fired on silent host writes (`open` property). |
|
|
90
|
+
| `rc-dialog-request-close` | **Yes** | `{ returnValue: string }` | Fired before close (Escape, backdrop click, or `requestClose()`). Call `preventDefault()` to block. |
|
|
91
|
+
| `rc-dialog-cancel` | No | None | Fired after `rc-dialog-request-close` when the close was not prevented. Backward-compatible alias. |
|
|
92
|
+
| `rc-dialog-close` | No | `{ returnValue: string }` | Fired after the dialog has closed. |
|
|
93
93
|
|
|
94
94
|
---
|
|
95
95
|
|
|
@@ -123,9 +123,7 @@ Drag the `.titlebar` to reposition. Focus the titlebar and use **Arrow keys** to
|
|
|
123
123
|
|
|
124
124
|
```html
|
|
125
125
|
<rc-dialog id="dlg" movable move-handle=".titlebar" resize="both">
|
|
126
|
-
<dialog aria-labelledby="dlg-title" style="min-width: 20rem; min-height: 10rem;">
|
|
127
|
-
…
|
|
128
|
-
</dialog>
|
|
126
|
+
<dialog aria-labelledby="dlg-title" style="min-width: 20rem; min-height: 10rem;">…</dialog>
|
|
129
127
|
</rc-dialog>
|
|
130
128
|
```
|
|
131
129
|
|
|
@@ -160,11 +158,18 @@ No titlebar or footer structure is required. Any layout is valid.
|
|
|
160
158
|
|
|
161
159
|
```html
|
|
162
160
|
<rc-dialog id="dlg">
|
|
163
|
-
<dialog
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
<dialog
|
|
162
|
+
aria-labelledby="dlg-title"
|
|
163
|
+
aria-describedby="dlg-desc"
|
|
164
|
+
style="border-radius: 12px; padding: 2rem; position: relative;"
|
|
165
|
+
>
|
|
166
|
+
<button
|
|
167
|
+
style="position:absolute;top:.5rem;right:.5rem;"
|
|
168
|
+
onclick="document.querySelector('#dlg').close()"
|
|
169
|
+
aria-label="Close"
|
|
170
|
+
>
|
|
171
|
+
✕
|
|
172
|
+
</button>
|
|
168
173
|
<h3 id="dlg-title">Quick note</h3>
|
|
169
174
|
<p id="dlg-desc">Content here.</p>
|
|
170
175
|
</dialog>
|
|
@@ -178,9 +183,7 @@ technology treats this with higher urgency.
|
|
|
178
183
|
|
|
179
184
|
```html
|
|
180
185
|
<rc-dialog id="confirm">
|
|
181
|
-
<dialog role="alertdialog"
|
|
182
|
-
aria-labelledby="confirm-title"
|
|
183
|
-
aria-describedby="confirm-msg">
|
|
186
|
+
<dialog role="alertdialog" aria-labelledby="confirm-title" aria-describedby="confirm-msg">
|
|
184
187
|
<div class="titlebar"><span id="confirm-title">Delete item?</span></div>
|
|
185
188
|
<p id="confirm-msg">This action cannot be undone.</p>
|
|
186
189
|
<div class="footer">
|
|
@@ -291,7 +294,7 @@ the body grows and the header/footer stay fixed:
|
|
|
291
294
|
dialog[open] {
|
|
292
295
|
display: flex;
|
|
293
296
|
flex-direction: column;
|
|
294
|
-
overflow: hidden;
|
|
297
|
+
overflow: hidden; /* dialog box doesn't scroll; body does */
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
.dlg-header,
|
|
@@ -302,7 +305,7 @@ dialog[open] {
|
|
|
302
305
|
.dlg-body {
|
|
303
306
|
flex: 1;
|
|
304
307
|
overflow: auto;
|
|
305
|
-
min-height: 0;
|
|
308
|
+
min-height: 0; /* lets flex child shrink below content height */
|
|
306
309
|
}
|
|
307
310
|
```
|
|
308
311
|
|
|
@@ -314,10 +317,10 @@ dialog[open] {
|
|
|
314
317
|
|
|
315
318
|
## Browser support
|
|
316
319
|
|
|
317
|
-
| Feature
|
|
318
|
-
|
|
319
|
-
| Core (`<dialog>` delegation, events) | Chrome 37+, Firefox 98+, Safari 15.4+
|
|
320
|
-
| Drag / resize
|
|
321
|
-
| `closed-by` attribute proxy
|
|
322
|
-
| `requestClose()` native method
|
|
323
|
-
| `light-dismiss` JS fallback
|
|
320
|
+
| Feature | Requirement |
|
|
321
|
+
| ------------------------------------ | --------------------------------------------------------------------------- |
|
|
322
|
+
| Core (`<dialog>` delegation, events) | Chrome 37+, Firefox 98+, Safari 15.4+ |
|
|
323
|
+
| Drag / resize | Any browser supporting Pointer Events |
|
|
324
|
+
| `closed-by` attribute proxy | Chrome 134+, Safari 18.4+, Firefox 139+ |
|
|
325
|
+
| `requestClose()` native method | Chrome 134+, Safari 18.4+, Firefox 139+ (fallback active on older browsers) |
|
|
326
|
+
| `light-dismiss` JS fallback | All browsers |
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"text": "boolean"
|
|
183
183
|
},
|
|
184
184
|
"default": "true",
|
|
185
|
-
"description": "Whether
|
|
185
|
+
"description": "Whether controlled open state uses `showModal()` instead of `show()`. JavaScript property only; no attribute is observed."
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
188
|
"kind": "field",
|
|
@@ -241,6 +241,9 @@ o([
|
|
|
241
241
|
o([
|
|
242
242
|
r({ type: Boolean, attribute: "light-dismiss" })
|
|
243
243
|
], n.prototype, "lightDismiss", 2);
|
|
244
|
+
o([
|
|
245
|
+
r({ attribute: !1 })
|
|
246
|
+
], n.prototype, "modal", 2);
|
|
244
247
|
o([
|
|
245
248
|
r({ type: Boolean, attribute: "open", reflect: !0 })
|
|
246
249
|
], n.prototype, "open", 1);
|
|
@@ -250,4 +253,4 @@ o([
|
|
|
250
253
|
export {
|
|
251
254
|
n as R
|
|
252
255
|
};
|
|
253
|
-
//# sourceMappingURL=rc-dialog-
|
|
256
|
+
//# sourceMappingURL=rc-dialog-CPmkVy7u.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rc-dialog-CPmkVy7u.js","sources":["../src/rc-dialog.ts"],"sourcesContent":["import { LitElement, nothing, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport {\n DragController,\n NativeChildController,\n ResizeController,\n type ResizeDirection,\n type ResizeLifecycleDetail,\n type ResizeOrigin,\n warnMissingDirectChild,\n} from '@rcarls/rc-common';\n\n/** Detail shape for `rc-dialog-close` and `rc-dialog-request-close`. */\nexport interface RCDialogCloseEvent {\n returnValue: string;\n}\n\n/** Detail shape for `rc-dialog-toggle`. */\nexport interface RCDialogToggleEvent {\n open: boolean;\n returnValue: string;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'rc-dialog': RCDialog;\n }\n\n interface HTMLElementEventMap {\n 'rc-dialog-open': CustomEvent<Record<string, never>>;\n 'rc-dialog-close': CustomEvent<RCDialogCloseEvent>;\n 'rc-dialog-request-close': CustomEvent<RCDialogCloseEvent>;\n 'rc-dialog-cancel': CustomEvent<Record<string, never>>;\n 'rc-dialog-toggle': CustomEvent<RCDialogToggleEvent>;\n }\n}\n\n/**\n * Draggable, resizable wrapper for a native <dialog>, following the WAI-ARIA Dialog Modal\n * pattern.\n *\n * @see {@link https://richardcarls.github.io/rc-webcomponents/components/rc-dialog rc-dialog docs}\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/ WAI-ARIA Dialog Modal pattern}\n *\n * @slot - Place a `<dialog>` element with your content here.\n *\n * @fires rc-dialog-open - Fired when the dialog opens via `showModal()` or `show()`.\n * @fires rc-dialog-toggle - Fired when user/native interaction changes open state.\n * @fires rc-dialog-request-close - Fired before the dialog closes (cancellable).\n * @fires rc-dialog-cancel - Mirrors the inner `<dialog>` cancel event when the\n * close was not prevented. Backward-compatible alias for `rc-dialog-request-close`.\n * @fires rc-dialog-close - Mirrors the inner `<dialog>` close event.\n * `detail: { returnValue: string }`\n *\n * @attr open - Controlled open state. Reads the inner `<dialog>.open` value.\n * @attr default-open - Initial uncontrolled open state.\n * @attr movable - Allow the dialog to be moved by dragging.\n * @attr move-handle - CSS selector (within the inner `<dialog>`) for the drag handle element.\n * @attr move-bounds - Bounds constraint for movement: `viewport` or `parent`.\n * @attr move-step - Keyboard arrow-key step in px for moving.\n * @attr resize - Enable resizing, mirroring the CSS `resize` property values.\n * @attr resize-origin - Origin for resize edge hit-testing or explicit handles.\n * @attr resize-handle - CSS selector, scoped to the inner `<dialog>`, for one or more explicit\n * resize handles.\n * @attr resize-threshold - Edge hit-test thickness in px for resize detection.\n * @attr resize-step - Keyboard arrow-key step in px for resizing.\n * @attr closed-by - Proxied to the inner `<dialog closedby=\"...\">` attribute.\n * @attr light-dismiss - When present and the dialog is modal, a click on the backdrop area calls\n * `requestClose()`.\n * @prop modal - Whether controlled open state uses `showModal()` instead of `show()`.\n * JavaScript property only; no attribute is observed.\n *\n * @cssprop [--rc-dialog-scrim=color-mix(in srgb, CanvasText 32%, transparent)] - Modal backdrop color.\n *\n */\nexport class RCDialog extends LitElement {\n override createRenderRoot() {\n return this;\n }\n\n /**\n * Allow the dialog to be moved by dragging.\n *\n * Use `move-handle` to restrict dragging to a specific child\n * element (e.g. a titlebar).\n */\n @property({ type: Boolean, reflect: true })\n movable = false;\n\n /** CSS selector (within the inner `<dialog>`) for the drag handle element. */\n @property({ type: String, attribute: 'move-handle' })\n moveHandle = '';\n\n /** Bounds constraint for movement. */\n @property({ type: String, attribute: 'move-bounds' })\n moveBounds: 'viewport' | 'parent' = 'viewport';\n\n /** Keyboard arrow-key step in px for moving. */\n @property({ type: Number, attribute: 'move-step' })\n moveStep = 4;\n\n /** Enable resizing, mirroring the CSS `resize` property values. */\n @property({ type: String, reflect: true })\n resize: 'none' | 'both' | 'horizontal' | 'vertical' = 'none';\n\n /**\n * Origin for resize edge hit-testing or explicit handles.\n *\n * Empty preserves the historical free edge-detection behavior.\n */\n @property({ type: String, attribute: 'resize-origin' })\n resizeOrigin: ResizeOrigin = '';\n\n /**\n * CSS selector, scoped to the inner `<dialog>`, for one or more explicit\n * resize handles.\n *\n * Handles may override host behavior with:\n * - `data-rc-dialog-resize-axis=\"x|y|both\"`\n * - `data-rc-dialog-resize-origin=\"top|right|bottom|left|top-left|...\"`\n */\n @property({ type: String, attribute: 'resize-handle' })\n resizeHandle = '';\n\n /** Edge hit-test thickness in px for resize detection. */\n @property({ type: Number, attribute: 'resize-threshold' })\n resizeThreshold = 8;\n\n /** Keyboard arrow-key step in px for resizing. */\n @property({ type: Number, attribute: 'resize-step' })\n resizeStep = 4;\n\n /**\n * Proxied to the inner `<dialog closedby=\"...\">` attribute.\n *\n * Progressive enhancement, no-op in older browsers.\n *\n * - `'any'` — Escape OR backdrop click closes the dialog.\n * - `'closerequest'` — Escape only (browser default for modal dialogs).\n * - `'none'` — Only programmatic `close()` / `requestClose()`.\n * - `''` — Attribute absent; use `light-dismiss` for JS fallback.\n */\n @property({ type: String, attribute: 'closed-by', reflect: true })\n closedBy: 'any' | 'closerequest' | 'none' | '' = '';\n\n /**\n * When true and the dialog is modal, a click on the backdrop area calls\n * `requestClose()`.\n */\n @property({ type: Boolean, attribute: 'light-dismiss' })\n lightDismiss = false;\n\n /**\n * Whether to open as modal with controlled open. Default: `true`.\n */\n @property({ attribute: false })\n modal = true;\n\n /** The inner `<dialog>` element, resolved from the direct light-DOM child. */\n protected get _$dialog(): HTMLDialogElement | null {\n return this._dialogController.child;\n }\n\n private _controlledOpen: boolean | undefined = undefined;\n private _defaultOpen = false;\n protected readonly _dialogController = new NativeChildController<HTMLDialogElement>(this, {\n selector: ':scope > dialog',\n observe: true,\n onChange: ($dialog) => this._setupDialog($dialog),\n onMissing: () => {\n if (import.meta.env.DEV) {\n warnMissingDirectChild(this, {\n selector: ':scope > dialog',\n message:\n '[rc-dialog] No direct child <dialog> found. Place a native <dialog> inside <rc-dialog>.',\n });\n }\n },\n });\n\n // Tracks which <dialog> has its listeners wired; used by _teardownDialog to\n // remove listeners even after the element is removed from the DOM.\n protected _$wired: WeakRef<HTMLDialogElement> | null = null;\n protected _suppressNextCloseToggle = false;\n\n /** The element that had focus when the dialog was opened; restored on close. */\n protected _$opener: Element | null = null;\n\n /** Whether the inner `<dialog>` is currently open. Host writes update silently. */\n @property({ type: Boolean, attribute: 'open', reflect: true })\n get open(): boolean {\n return this._$dialog?.open ?? false;\n }\n\n set open(value: boolean | undefined) {\n const oldValue = this._controlledOpen;\n\n this._controlledOpen = value;\n\n if (value !== undefined) {\n this._applyOpen(value, true, this.modal);\n }\n\n this.requestUpdate('open', oldValue);\n }\n\n /** Initial uncontrolled open state. */\n @property({ type: Boolean, attribute: 'default-open' })\n get defaultOpen(): boolean {\n return this._defaultOpen;\n }\n\n set defaultOpen(value: boolean) {\n const oldValue = this._defaultOpen;\n\n this._defaultOpen = value;\n\n if (this._controlledOpen === undefined && value && this.isConnected) {\n this._applyOpen(true, true, this.modal);\n }\n\n this.requestUpdate('defaultOpen', oldValue);\n }\n\n /** The return value set when the dialog was closed. */\n get returnValue(): string {\n return this._$dialog?.returnValue ?? '';\n }\n\n /** Opens the inner `<dialog>` as a modal and fires `rc-dialog-open`. */\n showModal(): void {\n if (this._applyOpen(true, false, true)) {\n this.dispatchEvent(new CustomEvent('rc-dialog-open', { bubbles: true, composed: true }));\n this._dispatchToggle(true);\n }\n }\n\n /**\n * Opens the inner `<dialog>` (non-modal) and fires `rc-dialog-open`.\n */\n show(): void {\n if (this._applyOpen(true, false, false)) {\n this.dispatchEvent(new CustomEvent('rc-dialog-open', { bubbles: true, composed: true }));\n this._dispatchToggle(true);\n }\n }\n\n /** Closes the inner `<dialog>`, optionally setting a return value. */\n close(returnValue?: string): void {\n this._$dialog?.close(returnValue);\n }\n\n /**\n * Requests the inner `<dialog>` to close, firing a cancelable `cancel` event\n * first.\n */\n requestClose(returnValue?: string): void {\n const $dialog = this._$dialog;\n\n if (!$dialog) {\n return;\n }\n\n if ('requestClose' in $dialog && typeof $dialog.requestClose === 'function') {\n $dialog.requestClose(returnValue);\n } else {\n // Synthesize a cancelable cancel event; _onCancel fires rc-dialog-request-close.\n // If not prevented, _onCancel does not call $dlg.close() — we do it here.\n const ev = new Event('cancel', { cancelable: true, bubbles: false });\n const prevented = !$dialog.dispatchEvent(ev);\n\n if (!prevented) {\n $dialog.close(returnValue);\n }\n }\n }\n\n override render() {\n return nothing;\n }\n\n override firstUpdated() {\n this._dialogController.sync();\n }\n\n /** Wires event listeners, drag/resize controllers, and initial open state for the inner `<dialog>`. */\n protected _setupDialog($dialog: HTMLDialogElement | null = this._$dialog) {\n if (!$dialog) {\n this._teardownDialog();\n\n return;\n }\n\n if (this._$wired?.deref() === $dialog) {\n return;\n }\n\n this._teardownDialog();\n this._$wired = new WeakRef($dialog);\n\n if (import.meta.env.DEV) {\n const hasLabel =\n $dialog.hasAttribute('aria-labelledby') || $dialog.hasAttribute('aria-label');\n\n if (!hasLabel) {\n console.warn(\n '[rc-dialog] The inner <dialog> is missing aria-labelledby or ' +\n 'aria-label. Add one to satisfy the ARIA dialog pattern.',\n $dialog,\n );\n }\n\n if (\n $dialog.getAttribute('role') === 'alertdialog' &&\n !$dialog.hasAttribute('aria-describedby')\n ) {\n console.warn(\n '[rc-dialog] <dialog role=\"alertdialog\"> should have aria-describedby ' +\n 'pointing to the alert message text.',\n $dialog,\n );\n }\n\n if (!$dialog.querySelector('button:not([disabled])')) {\n console.warn(\n '[rc-dialog] No enabled <button> found inside <dialog>. APG recommends ' +\n 'including a visible close button in the tab sequence.',\n $dialog,\n );\n }\n }\n\n $dialog.addEventListener('close', this._onClose);\n $dialog.addEventListener('cancel', this._onCancel);\n\n if (this.lightDismiss && 'closedBy' in HTMLDialogElement.prototype) {\n $dialog.setAttribute('closedby', 'any');\n } else if (this.lightDismiss) {\n $dialog.addEventListener('click', this._onBackdropClick);\n } else {\n if (this.closedBy) {\n $dialog.setAttribute('closedby', this.closedBy);\n }\n }\n\n if (this.movable || this.moveHandle) {\n const $handle = this.moveHandle\n ? ($dialog.querySelector<Element>(this.moveHandle) ?? $dialog)\n : $dialog;\n\n new DragController(this, {\n target: $dialog,\n handle: $handle,\n bounds: this.moveBounds,\n step: this.moveStep,\n });\n }\n\n if (this.resize !== 'none') {\n const $handles = this._resizeHandles($dialog);\n\n if ($handles.length > 0) {\n for (const $handle of $handles) {\n // TODO: add a separate resize-bounds attribute; moveBounds is a proxy for now.\n new ResizeController(this, {\n target: $dialog,\n direction: this._resizeDirectionForHandle($handle),\n handle: $handle,\n origin: this._resizeOriginForHandle($handle),\n threshold: this.resizeThreshold,\n step: this.resizeStep,\n bounds: this.moveBounds,\n onResizeStart: (detail) => this._onResizeStart(detail),\n onResize: (detail) => this._onResize(detail),\n onResizeEnd: (detail) => this._onResizeEnd(detail),\n });\n }\n } else {\n // TODO: add a separate resize-bounds attribute; moveBounds is a proxy for now.\n new ResizeController(this, {\n target: $dialog,\n direction: this.resize,\n origin: this.resizeOrigin,\n threshold: this.resizeThreshold,\n step: this.resizeStep,\n bounds: this.moveBounds,\n onResizeStart: (detail) => this._onResizeStart(detail),\n onResize: (detail) => this._onResize(detail),\n onResizeEnd: (detail) => this._onResizeEnd(detail),\n });\n }\n }\n\n if (this._controlledOpen !== undefined) {\n this._applyOpen(this._controlledOpen, true, this.modal);\n } else if (this.defaultOpen) {\n this._applyOpen(true, true, this.modal);\n }\n }\n\n override updated(changed: PropertyValues) {\n const $dialog = this._$dialog;\n\n if (!$dialog) {\n return;\n }\n\n if (changed.has('closedBy')) {\n if (this.closedBy) {\n $dialog.setAttribute('closedby', this.closedBy);\n } else {\n $dialog.removeAttribute('closedby');\n }\n }\n\n if (changed.has('lightDismiss')) {\n if (this.lightDismiss && 'closedBy' in HTMLDialogElement.prototype) {\n // Native support available — delegate to closedby=\"any\" instead of JS handler.\n $dialog.setAttribute('closedby', 'any');\n $dialog.removeEventListener('click', this._onBackdropClick);\n } else if (this.lightDismiss) {\n $dialog.addEventListener('click', this._onBackdropClick);\n } else {\n $dialog.removeEventListener('click', this._onBackdropClick);\n\n if (this.closedBy) {\n $dialog.setAttribute('closedby', this.closedBy);\n } else {\n $dialog.removeAttribute('closedby');\n }\n }\n }\n }\n\n override disconnectedCallback() {\n this._teardownDialog();\n\n super.disconnectedCallback();\n }\n\n /** Removes all event listeners attached to the inner `<dialog>` and clears cached state. */\n protected _teardownDialog(): void {\n const $dialog = this._$wired?.deref();\n\n if (!$dialog) {\n return;\n }\n\n $dialog.removeEventListener('close', this._onClose);\n $dialog.removeEventListener('cancel', this._onCancel);\n $dialog.removeEventListener('click', this._onBackdropClick);\n\n this._$wired = null;\n this._$opener = null;\n }\n\n protected _onClose = () => {\n // Restore focus to the element that triggered the open, per APG focus management.\n if (this._$opener instanceof HTMLElement) {\n if (this._$opener.isConnected) {\n this._$opener.focus();\n } else {\n // Opener was removed from the DOM while the dialog was open; fall back\n // to body so focus is not left stranded.\n document.body.focus();\n }\n }\n\n this._$opener = null;\n\n this.dispatchEvent(\n new CustomEvent('rc-dialog-close', {\n bubbles: true,\n composed: true,\n detail: { returnValue: this.returnValue },\n }),\n );\n\n if (!this._suppressNextCloseToggle) {\n this._dispatchToggle(false);\n }\n\n this._suppressNextCloseToggle = false;\n this.requestUpdate('open');\n };\n\n /**\n * Intercepts the native `cancel` event.\n */\n protected _onCancel = (e: Event) => {\n const requestCloseEvent = new CustomEvent('rc-dialog-request-close', {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: { returnValue: this.returnValue },\n });\n const prevented = !this.dispatchEvent(requestCloseEvent);\n\n if (prevented) {\n e.preventDefault();\n } else {\n this.dispatchEvent(new CustomEvent('rc-dialog-cancel', { bubbles: true, composed: true }));\n }\n };\n\n /**\n * Detects backdrop clicks.\n */\n protected _onBackdropClick = (e: MouseEvent) => {\n if (e.target === this._$dialog) {\n this.requestClose();\n }\n };\n\n /** Hook for subclasses to respond when a resize gesture begins. */\n protected _onResizeStart(_detail: ResizeLifecycleDetail): void {}\n\n /** Hook for subclasses to respond to each resize update during an active gesture. */\n protected _onResize(_detail: ResizeLifecycleDetail): void {}\n\n /** Hook for subclasses to respond after a resize gesture has settled. */\n protected _onResizeEnd(_detail: ResizeLifecycleDetail): void {}\n\n protected _resizeHandles($dialog: HTMLDialogElement): Element[] {\n if (!this.resizeHandle) {\n return [];\n }\n\n try {\n return [...$dialog.querySelectorAll(this.resizeHandle)];\n } catch {\n if (import.meta.env.DEV) {\n console.warn('[rc-dialog] Invalid resize-handle selector.', this.resizeHandle);\n }\n\n return [];\n }\n }\n\n protected _resizeDirectionForHandle($handle: Element): ResizeDirection {\n const axis = $handle.getAttribute('data-rc-dialog-resize-axis');\n\n switch (axis) {\n case 'x':\n return 'horizontal';\n case 'y':\n return 'vertical';\n case 'both':\n return 'both';\n default:\n return this.resize;\n }\n }\n\n protected _resizeOriginForHandle($handle: Element): ResizeOrigin {\n return (\n ($handle.getAttribute('data-rc-dialog-resize-origin') as ResizeOrigin | null) ??\n this.resizeOrigin\n );\n }\n\n /**\n * Opens or closes the inner `<dialog>` and returns `true` if state actually changed.\n *\n * @param open - whether to open (`true`) or close (`false`)\n * @param silent - when `true`, suppresses the outgoing `rc-dialog-toggle` event\n * @param modal - whether to call `showModal()` (`true`) or `show()` (`false`)\n */\n protected _applyOpen(open: boolean, silent: boolean, modal = true): boolean {\n const $dialog = this._$dialog;\n\n if (!$dialog) {\n return false;\n }\n\n if (open) {\n if ($dialog.open) {\n return false;\n }\n\n // Capture focus owner before the dialog steals it, so we can restore on close.\n this._$opener = document.activeElement;\n modal ? $dialog.showModal() : $dialog.show();\n this.requestUpdate('open');\n\n return true;\n }\n\n if (!$dialog.open) {\n return false;\n }\n\n this._suppressNextCloseToggle = silent;\n $dialog.close();\n this.requestUpdate('open');\n\n return true;\n }\n\n /** Dispatches `rc-dialog-toggle` with the current open state and return value. */\n protected _dispatchToggle(open: boolean): void {\n this.dispatchEvent(\n new CustomEvent('rc-dialog-toggle', {\n bubbles: true,\n composed: true,\n detail: { open, returnValue: this.returnValue },\n }),\n );\n }\n}\n\nexport default RCDialog;\n"],"names":["RCDialog","LitElement","NativeChildController","$dialog","requestCloseEvent","value","oldValue","returnValue","ev","nothing","$handle","DragController","$handles","ResizeController","detail","changed","_detail","open","silent","modal","__decorateClass","property"],"mappings":";;;;;;;;AA4EO,MAAMA,UAAiBC,EAAW;AAAA,EAAlC,cAAA;AAAA,UAAA,GAAA,SAAA,GAYL,KAAA,UAAU,IAIV,KAAA,aAAa,IAIb,KAAA,aAAoC,YAIpC,KAAA,WAAW,GAIX,KAAA,SAAsD,QAQtD,KAAA,eAA6B,IAW7B,KAAA,eAAe,IAIf,KAAA,kBAAkB,GAIlB,KAAA,aAAa,GAab,KAAA,WAAiD,IAOjD,KAAA,eAAe,IAMf,KAAA,QAAQ,IAOR,KAAQ,kBAAuC,QAC/C,KAAQ,eAAe,IACvB,KAAmB,oBAAoB,IAAIC,EAAyC,MAAM;AAAA,MACxF,UAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU,CAACC,MAAY,KAAK,aAAaA,CAAO;AAAA,MAChD,WAAW,MAAM;AAAA,MAQjB;AAAA,IAAA,CACD,GAID,KAAU,UAA6C,MACvD,KAAU,2BAA2B,IAGrC,KAAU,WAA2B,MA8QrC,KAAU,WAAW,MAAM;AAEzB,MAAI,KAAK,oBAAoB,gBACvB,KAAK,SAAS,cAChB,KAAK,SAAS,MAAA,IAId,SAAS,KAAK,MAAA,IAIlB,KAAK,WAAW,MAEhB,KAAK;AAAA,QACH,IAAI,YAAY,mBAAmB;AAAA,UACjC,SAAS;AAAA,UACT,UAAU;AAAA,UACV,QAAQ,EAAE,aAAa,KAAK,YAAA;AAAA,QAAY,CACzC;AAAA,MAAA,GAGE,KAAK,4BACR,KAAK,gBAAgB,EAAK,GAG5B,KAAK,2BAA2B,IAChC,KAAK,cAAc,MAAM;AAAA,IAC3B,GAKA,KAA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8 @@ declare global {
|
|
|
53
53
|
* @attr closed-by - Proxied to the inner `<dialog closedby="...">` attribute.
|
|
54
54
|
* @attr light-dismiss - When present and the dialog is modal, a click on the backdrop area calls
|
|
55
55
|
* `requestClose()`.
|
|
56
|
+
* @prop modal - Whether controlled open state uses `showModal()` instead of `show()`.
|
|
57
|
+
* JavaScript property only; no attribute is observed.
|
|
56
58
|
*
|
|
57
59
|
* @cssprop [--rc-dialog-scrim=color-mix(in srgb, CanvasText 32%, transparent)] - Modal backdrop color.
|
|
58
60
|
*
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.6.0",
|
|
7
7
|
"description": "Draggable, resizable wrapper for a native <dialog>.",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"test:browser:firefox": "vitest --run --project=firefox"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@rcarls/rc-common": "0.
|
|
48
|
+
"@rcarls/rc-common": "0.6.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@custom-elements-manifest/analyzer": "0.11.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rc-dialog-D9jUBKJn.js","sources":["../src/rc-dialog.ts"],"sourcesContent":["import { LitElement, nothing, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport {\n DragController,\n NativeChildController,\n ResizeController,\n type ResizeDirection,\n type ResizeLifecycleDetail,\n type ResizeOrigin,\n warnMissingDirectChild,\n} from '@rcarls/rc-common';\n\n/** Detail shape for `rc-dialog-close` and `rc-dialog-request-close`. */\nexport interface RCDialogCloseEvent {\n returnValue: string;\n}\n\n/** Detail shape for `rc-dialog-toggle`. */\nexport interface RCDialogToggleEvent {\n open: boolean;\n returnValue: string;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'rc-dialog': RCDialog;\n }\n\n interface HTMLElementEventMap {\n 'rc-dialog-open': CustomEvent<Record<string, never>>;\n 'rc-dialog-close': CustomEvent<RCDialogCloseEvent>;\n 'rc-dialog-request-close': CustomEvent<RCDialogCloseEvent>;\n 'rc-dialog-cancel': CustomEvent<Record<string, never>>;\n 'rc-dialog-toggle': CustomEvent<RCDialogToggleEvent>;\n }\n}\n\n/**\n * Draggable, resizable wrapper for a native <dialog>, following the WAI-ARIA Dialog Modal\n * pattern.\n *\n * @see {@link https://richardcarls.github.io/rc-webcomponents/components/rc-dialog rc-dialog docs}\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/ WAI-ARIA Dialog Modal pattern}\n *\n * @slot - Place a `<dialog>` element with your content here.\n *\n * @fires rc-dialog-open - Fired when the dialog opens via `showModal()` or `show()`.\n * @fires rc-dialog-toggle - Fired when user/native interaction changes open state.\n * @fires rc-dialog-request-close - Fired before the dialog closes (cancellable).\n * @fires rc-dialog-cancel - Mirrors the inner `<dialog>` cancel event when the\n * close was not prevented. Backward-compatible alias for `rc-dialog-request-close`.\n * @fires rc-dialog-close - Mirrors the inner `<dialog>` close event.\n * `detail: { returnValue: string }`\n *\n * @attr open - Controlled open state. Reads the inner `<dialog>.open` value.\n * @attr default-open - Initial uncontrolled open state.\n * @attr movable - Allow the dialog to be moved by dragging.\n * @attr move-handle - CSS selector (within the inner `<dialog>`) for the drag handle element.\n * @attr move-bounds - Bounds constraint for movement: `viewport` or `parent`.\n * @attr move-step - Keyboard arrow-key step in px for moving.\n * @attr resize - Enable resizing, mirroring the CSS `resize` property values.\n * @attr resize-origin - Origin for resize edge hit-testing or explicit handles.\n * @attr resize-handle - CSS selector, scoped to the inner `<dialog>`, for one or more explicit\n * resize handles.\n * @attr resize-threshold - Edge hit-test thickness in px for resize detection.\n * @attr resize-step - Keyboard arrow-key step in px for resizing.\n * @attr closed-by - Proxied to the inner `<dialog closedby=\"...\">` attribute.\n * @attr light-dismiss - When present and the dialog is modal, a click on the backdrop area calls\n * `requestClose()`.\n *\n * @cssprop [--rc-dialog-scrim=color-mix(in srgb, CanvasText 32%, transparent)] - Modal backdrop color.\n *\n */\nexport class RCDialog extends LitElement {\n override createRenderRoot() {\n return this;\n }\n\n /**\n * Allow the dialog to be moved by dragging.\n *\n * Use `move-handle` to restrict dragging to a specific child\n * element (e.g. a titlebar).\n */\n @property({ type: Boolean, reflect: true })\n movable = false;\n\n /** CSS selector (within the inner `<dialog>`) for the drag handle element. */\n @property({ type: String, attribute: 'move-handle' })\n moveHandle = '';\n\n /** Bounds constraint for movement. */\n @property({ type: String, attribute: 'move-bounds' })\n moveBounds: 'viewport' | 'parent' = 'viewport';\n\n /** Keyboard arrow-key step in px for moving. */\n @property({ type: Number, attribute: 'move-step' })\n moveStep = 4;\n\n /** Enable resizing, mirroring the CSS `resize` property values. */\n @property({ type: String, reflect: true })\n resize: 'none' | 'both' | 'horizontal' | 'vertical' = 'none';\n\n /**\n * Origin for resize edge hit-testing or explicit handles.\n *\n * Empty preserves the historical free edge-detection behavior.\n */\n @property({ type: String, attribute: 'resize-origin' })\n resizeOrigin: ResizeOrigin = '';\n\n /**\n * CSS selector, scoped to the inner `<dialog>`, for one or more explicit\n * resize handles.\n *\n * Handles may override host behavior with:\n * - `data-rc-dialog-resize-axis=\"x|y|both\"`\n * - `data-rc-dialog-resize-origin=\"top|right|bottom|left|top-left|...\"`\n */\n @property({ type: String, attribute: 'resize-handle' })\n resizeHandle = '';\n\n /** Edge hit-test thickness in px for resize detection. */\n @property({ type: Number, attribute: 'resize-threshold' })\n resizeThreshold = 8;\n\n /** Keyboard arrow-key step in px for resizing. */\n @property({ type: Number, attribute: 'resize-step' })\n resizeStep = 4;\n\n /**\n * Proxied to the inner `<dialog closedby=\"...\">` attribute.\n *\n * Progressive enhancement, no-op in older browsers.\n *\n * - `'any'` — Escape OR backdrop click closes the dialog.\n * - `'closerequest'` — Escape only (browser default for modal dialogs).\n * - `'none'` — Only programmatic `close()` / `requestClose()`.\n * - `''` — Attribute absent; use `light-dismiss` for JS fallback.\n */\n @property({ type: String, attribute: 'closed-by', reflect: true })\n closedBy: 'any' | 'closerequest' | 'none' | '' = '';\n\n /**\n * When true and the dialog is modal, a click on the backdrop area calls\n * `requestClose()`.\n */\n @property({ type: Boolean, attribute: 'light-dismiss' })\n lightDismiss = false;\n\n /**\n * Whether to open as modal with controlled open. Default: `true`.\n */\n modal = true;\n\n /** The inner `<dialog>` element, resolved from the direct light-DOM child. */\n protected get _$dialog(): HTMLDialogElement | null {\n return this._dialogController.child;\n }\n\n private _controlledOpen: boolean | undefined = undefined;\n private _defaultOpen = false;\n protected readonly _dialogController = new NativeChildController<HTMLDialogElement>(this, {\n selector: ':scope > dialog',\n observe: true,\n onChange: ($dialog) => this._setupDialog($dialog),\n onMissing: () => {\n if (import.meta.env.DEV) {\n warnMissingDirectChild(this, {\n selector: ':scope > dialog',\n message:\n '[rc-dialog] No direct child <dialog> found. Place a native <dialog> inside <rc-dialog>.',\n });\n }\n },\n });\n\n // Tracks which <dialog> has its listeners wired; used by _teardownDialog to\n // remove listeners even after the element is removed from the DOM.\n protected _$wired: WeakRef<HTMLDialogElement> | null = null;\n protected _suppressNextCloseToggle = false;\n\n /** The element that had focus when the dialog was opened; restored on close. */\n protected _$opener: Element | null = null;\n\n /** Whether the inner `<dialog>` is currently open. Host writes update silently. */\n @property({ type: Boolean, attribute: 'open', reflect: true })\n get open(): boolean {\n return this._$dialog?.open ?? false;\n }\n\n set open(value: boolean | undefined) {\n const oldValue = this._controlledOpen;\n\n this._controlledOpen = value;\n\n if (value !== undefined) {\n this._applyOpen(value, true, this.modal);\n }\n\n this.requestUpdate('open', oldValue);\n }\n\n /** Initial uncontrolled open state. */\n @property({ type: Boolean, attribute: 'default-open' })\n get defaultOpen(): boolean {\n return this._defaultOpen;\n }\n\n set defaultOpen(value: boolean) {\n const oldValue = this._defaultOpen;\n\n this._defaultOpen = value;\n\n if (this._controlledOpen === undefined && value && this.isConnected) {\n this._applyOpen(true, true, this.modal);\n }\n\n this.requestUpdate('defaultOpen', oldValue);\n }\n\n /** The return value set when the dialog was closed. */\n get returnValue(): string {\n return this._$dialog?.returnValue ?? '';\n }\n\n /** Opens the inner `<dialog>` as a modal and fires `rc-dialog-open`. */\n showModal(): void {\n if (this._applyOpen(true, false, true)) {\n this.dispatchEvent(new CustomEvent('rc-dialog-open', { bubbles: true, composed: true }));\n this._dispatchToggle(true);\n }\n }\n\n /**\n * Opens the inner `<dialog>` (non-modal) and fires `rc-dialog-open`.\n */\n show(): void {\n if (this._applyOpen(true, false, false)) {\n this.dispatchEvent(new CustomEvent('rc-dialog-open', { bubbles: true, composed: true }));\n this._dispatchToggle(true);\n }\n }\n\n /** Closes the inner `<dialog>`, optionally setting a return value. */\n close(returnValue?: string): void {\n this._$dialog?.close(returnValue);\n }\n\n /**\n * Requests the inner `<dialog>` to close, firing a cancelable `cancel` event\n * first.\n */\n requestClose(returnValue?: string): void {\n const $dialog = this._$dialog;\n\n if (!$dialog) {\n return;\n }\n\n if ('requestClose' in $dialog && typeof $dialog.requestClose === 'function') {\n $dialog.requestClose(returnValue);\n } else {\n // Synthesize a cancelable cancel event; _onCancel fires rc-dialog-request-close.\n // If not prevented, _onCancel does not call $dlg.close() — we do it here.\n const ev = new Event('cancel', { cancelable: true, bubbles: false });\n const prevented = !$dialog.dispatchEvent(ev);\n\n if (!prevented) {\n $dialog.close(returnValue);\n }\n }\n }\n\n override render() {\n return nothing;\n }\n\n override firstUpdated() {\n this._dialogController.sync();\n }\n\n /** Wires event listeners, drag/resize controllers, and initial open state for the inner `<dialog>`. */\n protected _setupDialog($dialog: HTMLDialogElement | null = this._$dialog) {\n if (!$dialog) {\n this._teardownDialog();\n\n return;\n }\n\n if (this._$wired?.deref() === $dialog) {\n return;\n }\n\n this._teardownDialog();\n this._$wired = new WeakRef($dialog);\n\n if (import.meta.env.DEV) {\n const hasLabel =\n $dialog.hasAttribute('aria-labelledby') || $dialog.hasAttribute('aria-label');\n\n if (!hasLabel) {\n console.warn(\n '[rc-dialog] The inner <dialog> is missing aria-labelledby or ' +\n 'aria-label. Add one to satisfy the ARIA dialog pattern.',\n $dialog,\n );\n }\n\n if (\n $dialog.getAttribute('role') === 'alertdialog' &&\n !$dialog.hasAttribute('aria-describedby')\n ) {\n console.warn(\n '[rc-dialog] <dialog role=\"alertdialog\"> should have aria-describedby ' +\n 'pointing to the alert message text.',\n $dialog,\n );\n }\n\n if (!$dialog.querySelector('button:not([disabled])')) {\n console.warn(\n '[rc-dialog] No enabled <button> found inside <dialog>. APG recommends ' +\n 'including a visible close button in the tab sequence.',\n $dialog,\n );\n }\n }\n\n $dialog.addEventListener('close', this._onClose);\n $dialog.addEventListener('cancel', this._onCancel);\n\n if (this.lightDismiss && 'closedBy' in HTMLDialogElement.prototype) {\n $dialog.setAttribute('closedby', 'any');\n } else if (this.lightDismiss) {\n $dialog.addEventListener('click', this._onBackdropClick);\n } else {\n if (this.closedBy) {\n $dialog.setAttribute('closedby', this.closedBy);\n }\n }\n\n if (this.movable || this.moveHandle) {\n const $handle = this.moveHandle\n ? ($dialog.querySelector<Element>(this.moveHandle) ?? $dialog)\n : $dialog;\n\n new DragController(this, {\n target: $dialog,\n handle: $handle,\n bounds: this.moveBounds,\n step: this.moveStep,\n });\n }\n\n if (this.resize !== 'none') {\n const $handles = this._resizeHandles($dialog);\n\n if ($handles.length > 0) {\n for (const $handle of $handles) {\n // TODO: add a separate resize-bounds attribute; moveBounds is a proxy for now.\n new ResizeController(this, {\n target: $dialog,\n direction: this._resizeDirectionForHandle($handle),\n handle: $handle,\n origin: this._resizeOriginForHandle($handle),\n threshold: this.resizeThreshold,\n step: this.resizeStep,\n bounds: this.moveBounds,\n onResizeStart: (detail) => this._onResizeStart(detail),\n onResize: (detail) => this._onResize(detail),\n onResizeEnd: (detail) => this._onResizeEnd(detail),\n });\n }\n } else {\n // TODO: add a separate resize-bounds attribute; moveBounds is a proxy for now.\n new ResizeController(this, {\n target: $dialog,\n direction: this.resize,\n origin: this.resizeOrigin,\n threshold: this.resizeThreshold,\n step: this.resizeStep,\n bounds: this.moveBounds,\n onResizeStart: (detail) => this._onResizeStart(detail),\n onResize: (detail) => this._onResize(detail),\n onResizeEnd: (detail) => this._onResizeEnd(detail),\n });\n }\n }\n\n if (this._controlledOpen !== undefined) {\n this._applyOpen(this._controlledOpen, true, this.modal);\n } else if (this.defaultOpen) {\n this._applyOpen(true, true, this.modal);\n }\n }\n\n override updated(changed: PropertyValues) {\n const $dialog = this._$dialog;\n\n if (!$dialog) {\n return;\n }\n\n if (changed.has('closedBy')) {\n if (this.closedBy) {\n $dialog.setAttribute('closedby', this.closedBy);\n } else {\n $dialog.removeAttribute('closedby');\n }\n }\n\n if (changed.has('lightDismiss')) {\n if (this.lightDismiss && 'closedBy' in HTMLDialogElement.prototype) {\n // Native support available — delegate to closedby=\"any\" instead of JS handler.\n $dialog.setAttribute('closedby', 'any');\n $dialog.removeEventListener('click', this._onBackdropClick);\n } else if (this.lightDismiss) {\n $dialog.addEventListener('click', this._onBackdropClick);\n } else {\n $dialog.removeEventListener('click', this._onBackdropClick);\n\n if (this.closedBy) {\n $dialog.setAttribute('closedby', this.closedBy);\n } else {\n $dialog.removeAttribute('closedby');\n }\n }\n }\n }\n\n override disconnectedCallback() {\n this._teardownDialog();\n\n super.disconnectedCallback();\n }\n\n /** Removes all event listeners attached to the inner `<dialog>` and clears cached state. */\n protected _teardownDialog(): void {\n const $dialog = this._$wired?.deref();\n\n if (!$dialog) {\n return;\n }\n\n $dialog.removeEventListener('close', this._onClose);\n $dialog.removeEventListener('cancel', this._onCancel);\n $dialog.removeEventListener('click', this._onBackdropClick);\n\n this._$wired = null;\n this._$opener = null;\n }\n\n protected _onClose = () => {\n // Restore focus to the element that triggered the open, per APG focus management.\n if (this._$opener instanceof HTMLElement) {\n if (this._$opener.isConnected) {\n this._$opener.focus();\n } else {\n // Opener was removed from the DOM while the dialog was open; fall back\n // to body so focus is not left stranded.\n document.body.focus();\n }\n }\n\n this._$opener = null;\n\n this.dispatchEvent(\n new CustomEvent('rc-dialog-close', {\n bubbles: true,\n composed: true,\n detail: { returnValue: this.returnValue },\n }),\n );\n\n if (!this._suppressNextCloseToggle) {\n this._dispatchToggle(false);\n }\n\n this._suppressNextCloseToggle = false;\n this.requestUpdate('open');\n };\n\n /**\n * Intercepts the native `cancel` event.\n */\n protected _onCancel = (e: Event) => {\n const requestCloseEvent = new CustomEvent('rc-dialog-request-close', {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: { returnValue: this.returnValue },\n });\n const prevented = !this.dispatchEvent(requestCloseEvent);\n\n if (prevented) {\n e.preventDefault();\n } else {\n this.dispatchEvent(new CustomEvent('rc-dialog-cancel', { bubbles: true, composed: true }));\n }\n };\n\n /**\n * Detects backdrop clicks.\n */\n protected _onBackdropClick = (e: MouseEvent) => {\n if (e.target === this._$dialog) {\n this.requestClose();\n }\n };\n\n /** Hook for subclasses to respond when a resize gesture begins. */\n protected _onResizeStart(_detail: ResizeLifecycleDetail): void {}\n\n /** Hook for subclasses to respond to each resize update during an active gesture. */\n protected _onResize(_detail: ResizeLifecycleDetail): void {}\n\n /** Hook for subclasses to respond after a resize gesture has settled. */\n protected _onResizeEnd(_detail: ResizeLifecycleDetail): void {}\n\n protected _resizeHandles($dialog: HTMLDialogElement): Element[] {\n if (!this.resizeHandle) {\n return [];\n }\n\n try {\n return [...$dialog.querySelectorAll(this.resizeHandle)];\n } catch {\n if (import.meta.env.DEV) {\n console.warn('[rc-dialog] Invalid resize-handle selector.', this.resizeHandle);\n }\n\n return [];\n }\n }\n\n protected _resizeDirectionForHandle($handle: Element): ResizeDirection {\n const axis = $handle.getAttribute('data-rc-dialog-resize-axis');\n\n switch (axis) {\n case 'x':\n return 'horizontal';\n case 'y':\n return 'vertical';\n case 'both':\n return 'both';\n default:\n return this.resize;\n }\n }\n\n protected _resizeOriginForHandle($handle: Element): ResizeOrigin {\n return (\n ($handle.getAttribute('data-rc-dialog-resize-origin') as ResizeOrigin | null) ??\n this.resizeOrigin\n );\n }\n\n /**\n * Opens or closes the inner `<dialog>` and returns `true` if state actually changed.\n *\n * @param open - whether to open (`true`) or close (`false`)\n * @param silent - when `true`, suppresses the outgoing `rc-dialog-toggle` event\n * @param modal - whether to call `showModal()` (`true`) or `show()` (`false`)\n */\n protected _applyOpen(open: boolean, silent: boolean, modal = true): boolean {\n const $dialog = this._$dialog;\n\n if (!$dialog) {\n return false;\n }\n\n if (open) {\n if ($dialog.open) {\n return false;\n }\n\n // Capture focus owner before the dialog steals it, so we can restore on close.\n this._$opener = document.activeElement;\n modal ? $dialog.showModal() : $dialog.show();\n this.requestUpdate('open');\n\n return true;\n }\n\n if (!$dialog.open) {\n return false;\n }\n\n this._suppressNextCloseToggle = silent;\n $dialog.close();\n this.requestUpdate('open');\n\n return true;\n }\n\n /** Dispatches `rc-dialog-toggle` with the current open state and return value. */\n protected _dispatchToggle(open: boolean): void {\n this.dispatchEvent(\n new CustomEvent('rc-dialog-toggle', {\n bubbles: true,\n composed: true,\n detail: { open, returnValue: this.returnValue },\n }),\n );\n }\n}\n\nexport default RCDialog;\n"],"names":["RCDialog","LitElement","NativeChildController","$dialog","requestCloseEvent","value","oldValue","returnValue","ev","nothing","$handle","DragController","$handles","ResizeController","detail","changed","_detail","open","silent","modal","__decorateClass","property"],"mappings":";;;;;;;;AA0EO,MAAMA,UAAiBC,EAAW;AAAA,EAAlC,cAAA;AAAA,UAAA,GAAA,SAAA,GAYL,KAAA,UAAU,IAIV,KAAA,aAAa,IAIb,KAAA,aAAoC,YAIpC,KAAA,WAAW,GAIX,KAAA,SAAsD,QAQtD,KAAA,eAA6B,IAW7B,KAAA,eAAe,IAIf,KAAA,kBAAkB,GAIlB,KAAA,aAAa,GAab,KAAA,WAAiD,IAOjD,KAAA,eAAe,IAKf,KAAA,QAAQ,IAOR,KAAQ,kBAAuC,QAC/C,KAAQ,eA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