luxen-ui 0.21.4 → 0.22.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.
Files changed (56) hide show
  1. package/cdn/chunks/lit-html.js +1 -1
  2. package/cdn/chunks/lit-html.js.map +1 -1
  3. package/cdn/custom-elements.json +693 -670
  4. package/cdn/elements/alert-dialog/alert-dialog.d.ts +1 -0
  5. package/cdn/elements/alert-dialog/alert-dialog.d.ts.map +1 -1
  6. package/cdn/elements/alert-dialog/alert-dialog.js.map +1 -1
  7. package/cdn/elements/avatar/avatar.js +1 -1
  8. package/cdn/elements/color-scheme-icon/color-scheme-icon.js +1 -1
  9. package/cdn/elements/dialog/dialog.d.ts +1 -0
  10. package/cdn/elements/dialog/dialog.d.ts.map +1 -1
  11. package/cdn/elements/dialog/dialog.js.map +1 -1
  12. package/cdn/elements/dialog/dialog.styles.js +1 -1
  13. package/cdn/elements/dialog/dialog.styles.js.map +1 -1
  14. package/cdn/elements/drawer/drawer.d.ts +2 -1
  15. package/cdn/elements/drawer/drawer.d.ts.map +1 -1
  16. package/cdn/elements/drawer/drawer.js +1 -1
  17. package/cdn/elements/drawer/drawer.js.map +1 -1
  18. package/cdn/elements/tree/tree.d.ts +6 -0
  19. package/cdn/elements/tree/tree.d.ts.map +1 -1
  20. package/cdn/elements/tree/tree.js +1 -1
  21. package/cdn/elements/tree/tree.js.map +1 -1
  22. package/cdn/elements/tree-item/tree-item.d.ts +17 -2
  23. package/cdn/elements/tree-item/tree-item.d.ts.map +1 -1
  24. package/cdn/elements/tree-item/tree-item.js +4 -4
  25. package/cdn/elements/tree-item/tree-item.js.map +1 -1
  26. package/dist/custom-elements.json +693 -670
  27. package/dist/elements/alert-dialog/alert-dialog.d.ts +1 -0
  28. package/dist/elements/alert-dialog/alert-dialog.d.ts.map +1 -1
  29. package/dist/elements/alert-dialog/alert-dialog.js +1 -0
  30. package/dist/elements/dialog/dialog.css +18 -1
  31. package/dist/elements/dialog/dialog.d.ts +1 -0
  32. package/dist/elements/dialog/dialog.d.ts.map +1 -1
  33. package/dist/elements/dialog/dialog.js +1 -0
  34. package/dist/elements/drawer/drawer.css +11 -0
  35. package/dist/elements/drawer/drawer.d.ts +2 -1
  36. package/dist/elements/drawer/drawer.d.ts.map +1 -1
  37. package/dist/elements/drawer/drawer.js +2 -1
  38. package/dist/elements/tree/tree.d.ts +6 -0
  39. package/dist/elements/tree/tree.d.ts.map +1 -1
  40. package/dist/elements/tree/tree.js +24 -8
  41. package/dist/elements/tree-item/tree-item.d.ts +17 -2
  42. package/dist/elements/tree-item/tree-item.d.ts.map +1 -1
  43. package/dist/elements/tree-item/tree-item.js +31 -8
  44. package/dist/metadata/alert-dialog.json +5 -0
  45. package/dist/metadata/dialog.json +5 -0
  46. package/dist/metadata/drawer.json +5 -0
  47. package/dist/metadata/index.json +18 -3
  48. package/dist/metadata/tree-item.json +1 -1
  49. package/dist/metadata/tree.json +1 -1
  50. package/dist/templates/elements/alert-dialog.md +1 -0
  51. package/dist/templates/elements/dialog.md +1 -0
  52. package/dist/templates/elements/drawer.md +1 -0
  53. package/dist/templates/elements/tree-item.md +2 -1
  54. package/dist/templates/elements/tree.md +11 -0
  55. package/package.json +1 -1
  56. package/templates/SKILL.md.tpl +2 -1
@@ -47,6 +47,7 @@ export declare class CancelEvent extends Event {
47
47
  * @cssproperty [--padding=1.5rem] - Padding applied to the header, footer, and inline-padding of the body.
48
48
  * @cssproperty [--show-duration=200ms] - Open transition duration.
49
49
  * @cssproperty [--hide-duration=200ms] - Close transition duration.
50
+ * @cssproperty [--easing=cubic-bezier(0.32, 0.72, 0, 1)] - Timing function of the open and close transitions, backdrop included.
50
51
  * @cssproperty --backdrop - Backdrop color.
51
52
  * @cssproperty [--backdrop-blur=0] - Backdrop blur amount (any CSS length).
52
53
  *
@@ -1 +1 @@
1
- {"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/html/elements/alert-dialog/alert-dialog.ts"],"names":[],"mappings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,OAAO,GAAG,oBAAoB,GACvC,IAAI,CAAC;CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"alert-dialog.js","names":[],"sources":["../../../src/html/elements/alert-dialog/alert-dialog.css?inline","../../../src/html/elements/alert-dialog/alert-dialog.ts"],"sourcesContent":["/*\n * Layout for l-alert-dialog. Unlayered to match dialog.css (the inherited\n * shared styles) so these overrides win — inside a shadow root there's no host\n * cascade to guard against, and layered rules can't override dialog.css's\n * unlayered ones. The `.l-button` appearance comes from the shared button-core\n * (imported in alert-dialog.ts), not from here.\n *\n * Visual rhythm: a confirmation reads better with the title and description\n * grouped tight and the actions set off in their own bar.\n */\n\n/* Interruptive by nature: a stronger backdrop (the token meant for immersive\n overlays) plus a touch of blur pulls focus firmly onto the confirmation.\n Consumers can still retune --backdrop / --backdrop-blur. */\n:host {\n --backdrop: var(--l-backdrop-strong);\n --backdrop-blur: 2px;\n}\n\n/* Pull the description up close under the title (title keeps the inherited\n 1.125rem / 600 from dialog.css). */\n[part='header'] {\n padding-block-end: 0.5rem;\n}\n\n/* Muted, smaller description with a comfortable reading measure, plus its own\n block-end gap so the footer divider isn't crowded. */\n[part='body'] {\n padding-block-end: var(--padding);\n color: var(--l-color-text-secondary);\n font-size: var(--l-text-sm);\n line-height: 1.5;\n}\n\n/* Footer as a distinct action bar: subtle fill + top divider, corners rounded\n to match the dialog (which doesn't clip its overflow). */\n[part='footer'] {\n padding: 1rem var(--padding);\n border-top: 1px solid var(--l-color-border);\n background: var(--l-color-bg-fill-neutral-subtle);\n border-end-start-radius: var(--border-radius);\n border-end-end-radius: var(--border-radius);\n}\n","import { html, nothing, unsafeCSS, type PropertyValues } from 'lit';\n// Only the spinner fragment needs the static tag function; the outer template\n// stays on lit's `html` so `renderFooter()` keeps the return type `Dialog`\n// declares. A static-html result nests inside a regular one just fine.\nimport { html as staticHtml } from 'lit/static-html.js';\nimport { property } from 'lit/decorators.js';\nimport { cls } from '../../registry.js';\nimport { staticTag } from '../../static-tag.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport { HasSlotController } from '../../shared/controllers/has-slot-controller.js';\nimport { Dialog } from '../dialog/dialog.js';\nimport dialogStyles from '../dialog/dialog.styles.js';\nimport buttonStyles from '../../shared/styles/button-core.styles.js';\nimport rawAlertStyles from './alert-dialog.css?inline';\nimport '../spinner/index.js';\n\n// The built-in actions render as `.l-button`, styled inside the shadow root from\n// the SAME shared button-core as the light-DOM `.l-button` (single source of\n// truth — no copy to drift). alert-dialog.css adds only the dialog layout.\n// The class is emitted through `cls('button')` so it tracks a renamed\n// `cssPrefix` — button-core.css ships as a real CSS file the consumer's postcss\n// re-prefixes, and a static literal would desync from it (see button-core.css).\nconst alertStyles = unsafeCSS(rawAlertStyles);\n\n/**\n * Fired when the user accepts an alert dialog (the confirm action). Cancelable —\n * call `event.preventDefault()` to keep the dialog open (e.g. to await an async\n * task); close it yourself afterwards by setting `open = false`.\n *\n * Does not bubble and is not composed: listen on the element itself.\n */\nexport class ConfirmEvent extends Event {\n constructor() {\n super('confirm', { bubbles: false, composed: false, cancelable: true });\n }\n}\n\n/**\n * Fired when the user dismisses an alert dialog (the cancel action, Escape, or a\n * close request). Cancelable — call `event.preventDefault()` to keep it open.\n *\n * Does not bubble and is not composed: listen on the element itself.\n */\nexport class CancelEvent extends Event {\n constructor() {\n super('cancel', { bubbles: false, composed: false, cancelable: true });\n }\n}\n\n/**\n * An interruptive confirmation dialog built on `<l-dialog>`. Renders its own\n * cancel/confirm actions and exposes `role=\"alertdialog\"`. Use it to confirm a\n * consequential action (delete, publish, discard) — not for generic content.\n *\n * Open and close by toggling the `open` property (or the `--show` / `--hide`\n * Invoker commands). The dialog closes automatically when the user picks an\n * action, unless the matching `confirm` / `cancel` event is canceled.\n *\n * @slot - Description text. Provides the dialog's accessible description.\n * @slot title - Custom heading element. Overrides the default `<h2>` rendered from the `title` property. Also provides the dialog's accessible name.\n * @slot cancel - Replaces the built-in cancel action (e.g. a link). Keep it focusable.\n * @slot confirm - Replaces the built-in confirm action.\n *\n * @csspart dialog - The native `<dialog>` element.\n * @csspart header - The header wrapper containing the title.\n * @csspart title - The dialog title heading.\n * @csspart body - The body wrapper around the description.\n * @csspart footer - The footer wrapper around the actions.\n * @csspart button - Both built-in action buttons.\n * @csspart cancel - The built-in cancel button.\n * @csspart confirm - The built-in confirm button.\n *\n * @cssproperty [--width=31rem] - Dialog width.\n * @cssproperty [--border-radius=6px] - Dialog border radius.\n * @cssproperty [--padding=1.5rem] - Padding applied to the header, footer, and inline-padding of the body.\n * @cssproperty [--show-duration=200ms] - Open transition duration.\n * @cssproperty [--hide-duration=200ms] - Close transition duration.\n * @cssproperty --backdrop - Backdrop color.\n * @cssproperty [--backdrop-blur=0] - Backdrop blur amount (any CSS length).\n *\n * @event confirm - Fired when the user accepts. Cancelable — `preventDefault()` keeps it open for async work.\n * @event cancel - Fired when the user dismisses (cancel action, Escape). Cancelable — `preventDefault()` keeps it open.\n * @event show - Fired when the dialog is about to open. Cancelable.\n * @event hide - Fired when the dialog is about to close via the `open` property. Cancelable. (The confirm, cancel, and Escape paths close natively and emit `confirm`/`cancel` instead of `hide`.)\n * @event after-show - Fired after the open animation completes. Not cancelable.\n * @event after-hide - Fired after the close animation completes. Not cancelable.\n *\n * @command --show - Sets `open = true`.\n * @command --hide - Sets `open = false`.\n *\n * @customElement l-alert-dialog\n */\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- typed addEventListener overloads merged below.\nexport class AlertDialog extends Dialog {\n static override styles = [hostStyles, dialogStyles, buttonStyles, alertStyles];\n\n /** Label for the confirm action. */\n @property({ attribute: 'confirm-text' })\n confirmText = 'Confirm';\n\n /** Label for the cancel action. */\n @property({ attribute: 'cancel-text' })\n cancelText = 'Cancel';\n\n /** Visual tone. `danger` renders the confirm action as destructive. */\n @property({ reflect: true })\n tone?: 'danger';\n\n /** Show a busy state on the confirm action (spinner + `aria-disabled`); the\n * cancel action stays operable as an escape hatch. */\n @property({ type: Boolean, reflect: true })\n loading = false;\n\n protected override get _role() {\n return 'alertdialog';\n }\n\n // Wire aria-describedby to the body only when it actually has content, so a\n // title-only confirmation doesn't advertise an empty description.\n private _bodyContent = new HasSlotController(this, '[default]');\n protected override get _bodyId() {\n return this._bodyContent.test('[default]') ? 'description' : '';\n }\n\n // Alert dialogs are interruptive: they are never dismissable by clicking\n // outside, so the inherited `light-dismiss` is forced off (a vetoed dismissal\n // gesture must go through an explicit action).\n protected override willUpdate(changed: PropertyValues<this>) {\n super.willUpdate(changed);\n if (this.lightDismiss) this.lightDismiss = false;\n }\n\n // Native Escape / close request → cancel intent. A vetoed `cancel` keeps the\n // dialog open; otherwise the native close proceeds (emitting `after-hide`).\n protected override _onCancel(e: Event) {\n if (!this.dispatchEvent(new CancelEvent())) e.preventDefault();\n }\n\n // Focus the least destructive action on open: an author `[autofocus]`, else\n // the slotted cancel action, else the built-in cancel button (in shadow DOM,\n // so the base light-DOM lookup can't reach it). Try each in order and keep the\n // first that actually takes focus — this skips a non-focusable slotted cancel\n // without rejecting a focusable one that reports `tabIndex === -1` (a custom\n // element with `delegatesFocus`, `<div role=\"button\" tabindex=\"0\">`, etc.).\n protected override _focusInitial() {\n const candidates = [\n this.querySelector<HTMLElement>('[autofocus]'),\n this.querySelector<HTMLElement>('[slot=\"cancel\"]'),\n this.renderRoot.querySelector<HTMLElement>('[data-cancel]'),\n ];\n for (const el of candidates) {\n if (!el || el.matches('[disabled], [aria-disabled=\"true\"]')) continue;\n el.focus({ preventScroll: true });\n // `document.activeElement` resolves to the shadow host when focus lands\n // inside an open shadow root, so this also covers delegatesFocus.\n if (el === document.activeElement || el.contains(document.activeElement)) return;\n }\n }\n\n private _close() {\n // Close natively rather than via `open = false` so we don't also emit the\n // inherited cancelable `hide` — `confirm` / `cancel` are the intent events.\n if (this.dialog.open) this.dialog.close();\n }\n\n // Activate an action unless its control is disabled. The built-in confirm also\n // respects `loading` via the property — immune to render timing, so a fast\n // second click in the window before `aria-disabled` is flushed can't fire a\n // duplicate confirm mid-async. A slotted action the consumer drives carries no\n // disabled state unless the author adds one, so it stays operable.\n private _activate(el: Element, event: ConfirmEvent | CancelEvent) {\n if (el.hasAttribute('data-confirm') && this.loading) return;\n if (el.matches('[disabled], [aria-disabled=\"true\"]')) return;\n if (this.dispatchEvent(event)) this._close();\n }\n\n // Single delegated handler covering both the built-in buttons (marked with\n // `data-confirm` / `data-cancel`) and slotted replacements (`slot=\"confirm\"` /\n // `slot=\"cancel\"`). `composedPath()` flattens across the slot boundary, so a\n // click on light-DOM slotted content still resolves here.\n private _onFooterClick = (e: Event) => {\n for (const node of e.composedPath()) {\n if (node === e.currentTarget) break;\n if (!(node instanceof Element)) continue;\n if (node.matches('[slot=\"confirm\"], [data-confirm]'))\n return this._activate(node, new ConfirmEvent());\n if (node.matches('[slot=\"cancel\"], [data-cancel]'))\n return this._activate(node, new CancelEvent());\n }\n };\n\n protected override renderFooter() {\n const confirmVariant = this.tone === 'danger' ? 'destructive' : 'primary';\n const spinnerTag = staticTag('spinner');\n return html`\n <footer\n part=\"footer\"\n @click=${this._onFooterClick}\n >\n <slot name=\"cancel\">\n <button\n part=\"button cancel\"\n class=${cls('button')}\n type=\"button\"\n data-cancel\n >\n ${this.cancelText}\n </button>\n </slot>\n <slot name=\"confirm\">\n <button\n part=\"button confirm\"\n class=${cls('button')}\n type=\"button\"\n data-confirm\n data-variant=${confirmVariant}\n aria-disabled=${this.loading ? 'true' : nothing}\n aria-busy=${this.loading ? 'true' : nothing}\n >\n ${this.loading\n ? staticHtml`<${spinnerTag} aria-hidden=\"true\"></${spinnerTag}>`\n : nothing}\n ${this.confirmText}\n </button>\n </slot>\n </footer>\n `;\n }\n}\n\n// `confirm` and `cancel` collide with lib.dom's event maps, so we cannot augment\n// the global map (as the shared lifecycle events do). Declaration-merge typed\n// listener overloads onto the element instead — must come after the class so the\n// CEM analyzer reads the class first.\nexport interface AlertDialog {\n addEventListener(\n type: 'confirm',\n listener: (this: AlertDialog, ev: ConfirmEvent) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n addEventListener(\n type: 'cancel',\n listener: (this: AlertDialog, ev: CancelEvent) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n removeEventListener(\n type: 'confirm',\n listener: (this: AlertDialog, ev: ConfirmEvent) => void,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: 'cancel',\n listener: (this: AlertDialog, ev: CancelEvent) => void,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n}\n"],"mappings":"8iBCsBA,IAAM,EAAc,EAAU,gcAAc,EAS/B,EAAb,cAAkC,KAAM,CACtC,aAAc,CACZ,MAAM,UAAW,CAAE,QAAS,GAAO,SAAU,GAAO,WAAY,EAAK,CAAC,CACxE,CACF,EAQa,EAAb,cAAiC,KAAM,CACrC,aAAc,CACZ,MAAM,SAAU,CAAE,QAAS,GAAO,SAAU,GAAO,WAAY,EAAK,CAAC,CACvE,CACF,EA8Ca,EAAb,cAAiC,CAAO,gDAKxB,0BAID,sBASH,qBAQa,IAAI,EAAkB,KAAM,WAAW,sBA6DpC,GAAa,CACrC,IAAK,IAAM,KAAQ,EAAE,aAAa,EAAG,CACnC,GAAI,IAAS,EAAE,cAAe,MACxB,gBAAgB,QACtB,IAAI,EAAK,QAAQ,kCAAkC,EACjD,OAAO,KAAK,UAAU,EAAM,IAAI,CAAc,EAChD,GAAI,EAAK,QAAQ,gCAAgC,EAC/C,OAAO,KAAK,UAAU,EAAM,IAAI,CAAa,CAFC,CAGlD,CACF,qBA/FyB,CAAC,EAAY,EAAc,EAAc,CAAW,EAmB7E,IAAuB,OAAQ,CAC7B,MAAO,aACT,CAKA,IAAuB,SAAU,CAC/B,OAAO,KAAK,aAAa,KAAK,WAAW,EAAI,cAAgB,EAC/D,CAKA,WAA8B,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,EAAA,UAAA,OAAA,IAAA,EAAA,KAK1B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,UAAA,IAAA,EAAA"}
1
+ {"version":3,"file":"alert-dialog.js","names":[],"sources":["../../../src/html/elements/alert-dialog/alert-dialog.css?inline","../../../src/html/elements/alert-dialog/alert-dialog.ts"],"sourcesContent":["/*\n * Layout for l-alert-dialog. Unlayered to match dialog.css (the inherited\n * shared styles) so these overrides win — inside a shadow root there's no host\n * cascade to guard against, and layered rules can't override dialog.css's\n * unlayered ones. The `.l-button` appearance comes from the shared button-core\n * (imported in alert-dialog.ts), not from here.\n *\n * Visual rhythm: a confirmation reads better with the title and description\n * grouped tight and the actions set off in their own bar.\n */\n\n/* Interruptive by nature: a stronger backdrop (the token meant for immersive\n overlays) plus a touch of blur pulls focus firmly onto the confirmation.\n Consumers can still retune --backdrop / --backdrop-blur. */\n:host {\n --backdrop: var(--l-backdrop-strong);\n --backdrop-blur: 2px;\n}\n\n/* Pull the description up close under the title (title keeps the inherited\n 1.125rem / 600 from dialog.css). */\n[part='header'] {\n padding-block-end: 0.5rem;\n}\n\n/* Muted, smaller description with a comfortable reading measure, plus its own\n block-end gap so the footer divider isn't crowded. */\n[part='body'] {\n padding-block-end: var(--padding);\n color: var(--l-color-text-secondary);\n font-size: var(--l-text-sm);\n line-height: 1.5;\n}\n\n/* Footer as a distinct action bar: subtle fill + top divider, corners rounded\n to match the dialog (which doesn't clip its overflow). */\n[part='footer'] {\n padding: 1rem var(--padding);\n border-top: 1px solid var(--l-color-border);\n background: var(--l-color-bg-fill-neutral-subtle);\n border-end-start-radius: var(--border-radius);\n border-end-end-radius: var(--border-radius);\n}\n","import { html, nothing, unsafeCSS, type PropertyValues } from 'lit';\n// Only the spinner fragment needs the static tag function; the outer template\n// stays on lit's `html` so `renderFooter()` keeps the return type `Dialog`\n// declares. A static-html result nests inside a regular one just fine.\nimport { html as staticHtml } from 'lit/static-html.js';\nimport { property } from 'lit/decorators.js';\nimport { cls } from '../../registry.js';\nimport { staticTag } from '../../static-tag.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport { HasSlotController } from '../../shared/controllers/has-slot-controller.js';\nimport { Dialog } from '../dialog/dialog.js';\nimport dialogStyles from '../dialog/dialog.styles.js';\nimport buttonStyles from '../../shared/styles/button-core.styles.js';\nimport rawAlertStyles from './alert-dialog.css?inline';\nimport '../spinner/index.js';\n\n// The built-in actions render as `.l-button`, styled inside the shadow root from\n// the SAME shared button-core as the light-DOM `.l-button` (single source of\n// truth — no copy to drift). alert-dialog.css adds only the dialog layout.\n// The class is emitted through `cls('button')` so it tracks a renamed\n// `cssPrefix` — button-core.css ships as a real CSS file the consumer's postcss\n// re-prefixes, and a static literal would desync from it (see button-core.css).\nconst alertStyles = unsafeCSS(rawAlertStyles);\n\n/**\n * Fired when the user accepts an alert dialog (the confirm action). Cancelable —\n * call `event.preventDefault()` to keep the dialog open (e.g. to await an async\n * task); close it yourself afterwards by setting `open = false`.\n *\n * Does not bubble and is not composed: listen on the element itself.\n */\nexport class ConfirmEvent extends Event {\n constructor() {\n super('confirm', { bubbles: false, composed: false, cancelable: true });\n }\n}\n\n/**\n * Fired when the user dismisses an alert dialog (the cancel action, Escape, or a\n * close request). Cancelable — call `event.preventDefault()` to keep it open.\n *\n * Does not bubble and is not composed: listen on the element itself.\n */\nexport class CancelEvent extends Event {\n constructor() {\n super('cancel', { bubbles: false, composed: false, cancelable: true });\n }\n}\n\n/**\n * An interruptive confirmation dialog built on `<l-dialog>`. Renders its own\n * cancel/confirm actions and exposes `role=\"alertdialog\"`. Use it to confirm a\n * consequential action (delete, publish, discard) — not for generic content.\n *\n * Open and close by toggling the `open` property (or the `--show` / `--hide`\n * Invoker commands). The dialog closes automatically when the user picks an\n * action, unless the matching `confirm` / `cancel` event is canceled.\n *\n * @slot - Description text. Provides the dialog's accessible description.\n * @slot title - Custom heading element. Overrides the default `<h2>` rendered from the `title` property. Also provides the dialog's accessible name.\n * @slot cancel - Replaces the built-in cancel action (e.g. a link). Keep it focusable.\n * @slot confirm - Replaces the built-in confirm action.\n *\n * @csspart dialog - The native `<dialog>` element.\n * @csspart header - The header wrapper containing the title.\n * @csspart title - The dialog title heading.\n * @csspart body - The body wrapper around the description.\n * @csspart footer - The footer wrapper around the actions.\n * @csspart button - Both built-in action buttons.\n * @csspart cancel - The built-in cancel button.\n * @csspart confirm - The built-in confirm button.\n *\n * @cssproperty [--width=31rem] - Dialog width.\n * @cssproperty [--border-radius=6px] - Dialog border radius.\n * @cssproperty [--padding=1.5rem] - Padding applied to the header, footer, and inline-padding of the body.\n * @cssproperty [--show-duration=200ms] - Open transition duration.\n * @cssproperty [--hide-duration=200ms] - Close transition duration.\n * @cssproperty [--easing=cubic-bezier(0.32, 0.72, 0, 1)] - Timing function of the open and close transitions, backdrop included.\n * @cssproperty --backdrop - Backdrop color.\n * @cssproperty [--backdrop-blur=0] - Backdrop blur amount (any CSS length).\n *\n * @event confirm - Fired when the user accepts. Cancelable — `preventDefault()` keeps it open for async work.\n * @event cancel - Fired when the user dismisses (cancel action, Escape). Cancelable — `preventDefault()` keeps it open.\n * @event show - Fired when the dialog is about to open. Cancelable.\n * @event hide - Fired when the dialog is about to close via the `open` property. Cancelable. (The confirm, cancel, and Escape paths close natively and emit `confirm`/`cancel` instead of `hide`.)\n * @event after-show - Fired after the open animation completes. Not cancelable.\n * @event after-hide - Fired after the close animation completes. Not cancelable.\n *\n * @command --show - Sets `open = true`.\n * @command --hide - Sets `open = false`.\n *\n * @customElement l-alert-dialog\n */\n// oxlint-disable-next-line typescript/no-unsafe-declaration-merging -- typed addEventListener overloads merged below.\nexport class AlertDialog extends Dialog {\n static override styles = [hostStyles, dialogStyles, buttonStyles, alertStyles];\n\n /** Label for the confirm action. */\n @property({ attribute: 'confirm-text' })\n confirmText = 'Confirm';\n\n /** Label for the cancel action. */\n @property({ attribute: 'cancel-text' })\n cancelText = 'Cancel';\n\n /** Visual tone. `danger` renders the confirm action as destructive. */\n @property({ reflect: true })\n tone?: 'danger';\n\n /** Show a busy state on the confirm action (spinner + `aria-disabled`); the\n * cancel action stays operable as an escape hatch. */\n @property({ type: Boolean, reflect: true })\n loading = false;\n\n protected override get _role() {\n return 'alertdialog';\n }\n\n // Wire aria-describedby to the body only when it actually has content, so a\n // title-only confirmation doesn't advertise an empty description.\n private _bodyContent = new HasSlotController(this, '[default]');\n protected override get _bodyId() {\n return this._bodyContent.test('[default]') ? 'description' : '';\n }\n\n // Alert dialogs are interruptive: they are never dismissable by clicking\n // outside, so the inherited `light-dismiss` is forced off (a vetoed dismissal\n // gesture must go through an explicit action).\n protected override willUpdate(changed: PropertyValues<this>) {\n super.willUpdate(changed);\n if (this.lightDismiss) this.lightDismiss = false;\n }\n\n // Native Escape / close request → cancel intent. A vetoed `cancel` keeps the\n // dialog open; otherwise the native close proceeds (emitting `after-hide`).\n protected override _onCancel(e: Event) {\n if (!this.dispatchEvent(new CancelEvent())) e.preventDefault();\n }\n\n // Focus the least destructive action on open: an author `[autofocus]`, else\n // the slotted cancel action, else the built-in cancel button (in shadow DOM,\n // so the base light-DOM lookup can't reach it). Try each in order and keep the\n // first that actually takes focus — this skips a non-focusable slotted cancel\n // without rejecting a focusable one that reports `tabIndex === -1` (a custom\n // element with `delegatesFocus`, `<div role=\"button\" tabindex=\"0\">`, etc.).\n protected override _focusInitial() {\n const candidates = [\n this.querySelector<HTMLElement>('[autofocus]'),\n this.querySelector<HTMLElement>('[slot=\"cancel\"]'),\n this.renderRoot.querySelector<HTMLElement>('[data-cancel]'),\n ];\n for (const el of candidates) {\n if (!el || el.matches('[disabled], [aria-disabled=\"true\"]')) continue;\n el.focus({ preventScroll: true });\n // `document.activeElement` resolves to the shadow host when focus lands\n // inside an open shadow root, so this also covers delegatesFocus.\n if (el === document.activeElement || el.contains(document.activeElement)) return;\n }\n }\n\n private _close() {\n // Close natively rather than via `open = false` so we don't also emit the\n // inherited cancelable `hide` — `confirm` / `cancel` are the intent events.\n if (this.dialog.open) this.dialog.close();\n }\n\n // Activate an action unless its control is disabled. The built-in confirm also\n // respects `loading` via the property — immune to render timing, so a fast\n // second click in the window before `aria-disabled` is flushed can't fire a\n // duplicate confirm mid-async. A slotted action the consumer drives carries no\n // disabled state unless the author adds one, so it stays operable.\n private _activate(el: Element, event: ConfirmEvent | CancelEvent) {\n if (el.hasAttribute('data-confirm') && this.loading) return;\n if (el.matches('[disabled], [aria-disabled=\"true\"]')) return;\n if (this.dispatchEvent(event)) this._close();\n }\n\n // Single delegated handler covering both the built-in buttons (marked with\n // `data-confirm` / `data-cancel`) and slotted replacements (`slot=\"confirm\"` /\n // `slot=\"cancel\"`). `composedPath()` flattens across the slot boundary, so a\n // click on light-DOM slotted content still resolves here.\n private _onFooterClick = (e: Event) => {\n for (const node of e.composedPath()) {\n if (node === e.currentTarget) break;\n if (!(node instanceof Element)) continue;\n if (node.matches('[slot=\"confirm\"], [data-confirm]'))\n return this._activate(node, new ConfirmEvent());\n if (node.matches('[slot=\"cancel\"], [data-cancel]'))\n return this._activate(node, new CancelEvent());\n }\n };\n\n protected override renderFooter() {\n const confirmVariant = this.tone === 'danger' ? 'destructive' : 'primary';\n const spinnerTag = staticTag('spinner');\n return html`\n <footer\n part=\"footer\"\n @click=${this._onFooterClick}\n >\n <slot name=\"cancel\">\n <button\n part=\"button cancel\"\n class=${cls('button')}\n type=\"button\"\n data-cancel\n >\n ${this.cancelText}\n </button>\n </slot>\n <slot name=\"confirm\">\n <button\n part=\"button confirm\"\n class=${cls('button')}\n type=\"button\"\n data-confirm\n data-variant=${confirmVariant}\n aria-disabled=${this.loading ? 'true' : nothing}\n aria-busy=${this.loading ? 'true' : nothing}\n >\n ${this.loading\n ? staticHtml`<${spinnerTag} aria-hidden=\"true\"></${spinnerTag}>`\n : nothing}\n ${this.confirmText}\n </button>\n </slot>\n </footer>\n `;\n }\n}\n\n// `confirm` and `cancel` collide with lib.dom's event maps, so we cannot augment\n// the global map (as the shared lifecycle events do). Declaration-merge typed\n// listener overloads onto the element instead — must come after the class so the\n// CEM analyzer reads the class first.\nexport interface AlertDialog {\n addEventListener(\n type: 'confirm',\n listener: (this: AlertDialog, ev: ConfirmEvent) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n addEventListener(\n type: 'cancel',\n listener: (this: AlertDialog, ev: CancelEvent) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n removeEventListener(\n type: 'confirm',\n listener: (this: AlertDialog, ev: ConfirmEvent) => void,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: 'cancel',\n listener: (this: AlertDialog, ev: CancelEvent) => void,\n options?: boolean | EventListenerOptions,\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void;\n}\n"],"mappings":"8iBCsBA,IAAM,EAAc,EAAU,gcAAc,EAS/B,EAAb,cAAkC,KAAM,CACtC,aAAc,CACZ,MAAM,UAAW,CAAE,QAAS,GAAO,SAAU,GAAO,WAAY,EAAK,CAAC,CACxE,CACF,EAQa,EAAb,cAAiC,KAAM,CACrC,aAAc,CACZ,MAAM,SAAU,CAAE,QAAS,GAAO,SAAU,GAAO,WAAY,EAAK,CAAC,CACvE,CACF,EA+Ca,EAAb,cAAiC,CAAO,gDAKxB,0BAID,sBASH,qBAQa,IAAI,EAAkB,KAAM,WAAW,sBA6DpC,GAAa,CACrC,IAAK,IAAM,KAAQ,EAAE,aAAa,EAAG,CACnC,GAAI,IAAS,EAAE,cAAe,MACxB,gBAAgB,QACtB,IAAI,EAAK,QAAQ,kCAAkC,EACjD,OAAO,KAAK,UAAU,EAAM,IAAI,CAAc,EAChD,GAAI,EAAK,QAAQ,gCAAgC,EAC/C,OAAO,KAAK,UAAU,EAAM,IAAI,CAAa,CAFC,CAGlD,CACF,qBA/FyB,CAAC,EAAY,EAAc,EAAc,CA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A,EAAA,KAItC,EAAS,CAAE,UAAW,aAAc,CAAC,CAAA,EAAA,EAAA,UAAA,aAAA,IAAA,EAAA,KAIrC,EAAS,CAAE,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,OAAA,IAAA,EAAA,KAK1B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,UAAA,IAAA,EAAA"}
@@ -1,4 +1,4 @@
1
- import{i as e}from"../../chunks/lit.js";import{i as t,r as n,t as r}from"../../chunks/decorate.js";import{a as i,o as a,t as o}from"../../chunks/lit-html.js";import{LuxenElement as s}from"../../shared/luxen-element.js";import{r as c,t as l}from"../../chunks/static-html.js";import u from"../../shared/styles/host.styles.js";var d=e(`:host{--size:40px;--_font-size:calc(var(--size) * .4);width:var(--size);height:var(--size);border-radius:calc(var(--size) * .15);isolation:isolate;vertical-align:middle;color:var(--l-color-text-secondary);flex-shrink:0;justify-content:center;align-items:center;display:inline-flex;position:relative}:host([size=xs]){--size:24px;--_font-size:.75rem}:host([size=sm]){--size:32px;--_font-size:.875rem}:host([size=lg]){--size:48px;--_font-size:1.25rem}:host([size=xl]){--size:56px;--_font-size:1.25rem}img{object-fit:cover;border-radius:inherit;width:100%;height:100%}.initials{margin:auto}.icon{color:currentColor;width:60%;height:60%}.badge{z-index:1;min-width:12px;height:12px;box-shadow:0 0 0 2px var(--l-color-surface);background-color:var(--l-color-surface);font-size:.625rem;font-weight:var(--l-font-weight-medium);font-variant-numeric:tabular-nums;color:var(--l-color-text-primary);border-radius:3px;justify-content:center;align-items:center;padding-inline:2px;line-height:1;display:flex;position:absolute;bottom:0;right:0;overflow:hidden}.base:after{content:"";border-radius:inherit;pointer-events:none;position:absolute;inset:0;box-shadow:inset 0 0 0 1px var(--lightningcss-light,oklch(0% 0 0/.07))var(--lightningcss-dark,oklch(100% 0 0/.1))}.base{border-radius:calc(var(--size) * .15);background-color:var(--color,var(--l-color-bg-fill-neutral-soft));--_on:calc(255 * ( 1 - sign(.2126 * (r / 255) * (r / 255) + .7152 * (g / 255) * (g / 255) + .0722 * (b / 255) * (b / 255) - .2) ) / 2);width:100%;height:100%;color:var(--text-color,rgb(from var(--color) var(--_on) var(--_on) var(--_on)));font-size:var(--_font-size);font-weight:var(--l-font-weight-medium);text-transform:uppercase;cursor:inherit;border:none;justify-content:center;align-items:center;padding:0;line-height:1;display:inline-flex}@supports (color:contrast-color(red)){.base{color:var(--text-color,contrast-color(var(--color)))}}button.base{cursor:pointer}button.base:focus-visible{outline:2px solid var(--l-focus-ring);outline-offset:2px}button.base:hover{box-shadow:inset 0 0 0 1.5px var(--l-color-border-interactive)}@container style(--appearance:circle){.base{border-radius:50%}}`);function f(e=``){let t=e.normalize(`NFC`).trim().split(/\s+/).filter(Boolean);if(t.length===0)return``;let n=e=>[...e][0];return(n(t[0])+(t.length>1?n(t[t.length-1]):``)).toUpperCase()}var p=a`<svg class="icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
1
+ import{i as e}from"../../chunks/lit.js";import{i as t,r as n,t as r}from"../../chunks/decorate.js";import{a as i,s as a,t as o}from"../../chunks/lit-html.js";import{LuxenElement as s}from"../../shared/luxen-element.js";import{r as c,t as l}from"../../chunks/static-html.js";import u from"../../shared/styles/host.styles.js";var d=e(`:host{--size:40px;--_font-size:calc(var(--size) * .4);width:var(--size);height:var(--size);border-radius:calc(var(--size) * .15);isolation:isolate;vertical-align:middle;color:var(--l-color-text-secondary);flex-shrink:0;justify-content:center;align-items:center;display:inline-flex;position:relative}:host([size=xs]){--size:24px;--_font-size:.75rem}:host([size=sm]){--size:32px;--_font-size:.875rem}:host([size=lg]){--size:48px;--_font-size:1.25rem}:host([size=xl]){--size:56px;--_font-size:1.25rem}img{object-fit:cover;border-radius:inherit;width:100%;height:100%}.initials{margin:auto}.icon{color:currentColor;width:60%;height:60%}.badge{z-index:1;min-width:12px;height:12px;box-shadow:0 0 0 2px var(--l-color-surface);background-color:var(--l-color-surface);font-size:.625rem;font-weight:var(--l-font-weight-medium);font-variant-numeric:tabular-nums;color:var(--l-color-text-primary);border-radius:3px;justify-content:center;align-items:center;padding-inline:2px;line-height:1;display:flex;position:absolute;bottom:0;right:0;overflow:hidden}.base:after{content:"";border-radius:inherit;pointer-events:none;position:absolute;inset:0;box-shadow:inset 0 0 0 1px var(--lightningcss-light,oklch(0% 0 0/.07))var(--lightningcss-dark,oklch(100% 0 0/.1))}.base{border-radius:calc(var(--size) * .15);background-color:var(--color,var(--l-color-bg-fill-neutral-soft));--_on:calc(255 * ( 1 - sign(.2126 * (r / 255) * (r / 255) + .7152 * (g / 255) * (g / 255) + .0722 * (b / 255) * (b / 255) - .2) ) / 2);width:100%;height:100%;color:var(--text-color,rgb(from var(--color) var(--_on) var(--_on) var(--_on)));font-size:var(--_font-size);font-weight:var(--l-font-weight-medium);text-transform:uppercase;cursor:inherit;border:none;justify-content:center;align-items:center;padding:0;line-height:1;display:inline-flex}@supports (color:contrast-color(red)){.base{color:var(--text-color,contrast-color(var(--color)))}}button.base{cursor:pointer}button.base:focus-visible{outline:2px solid var(--l-focus-ring);outline-offset:2px}button.base:hover{box-shadow:inset 0 0 0 1.5px var(--l-color-border-interactive)}@container style(--appearance:circle){.base{border-radius:50%}}`);function f(e=``){let t=e.normalize(`NFC`).trim().split(/\s+/).filter(Boolean);if(t.length===0)return``;let n=e=>[...e][0];return(n(t[0])+(t.length>1?n(t[t.length-1]):``)).toUpperCase()}var p=a`<svg class="icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
2
2
  <path d="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z" />
3
3
  </svg>`,m=class extends s{constructor(...e){super(...e),this.src=``,this.name=``,this.size=`md`,this.badge=0,this.interactive=!1,this._hasError=!1,this._onError=()=>{this._hasError=!0}}static{this.styles=[u,d]}willUpdate(e){e.has(`src`)&&(this._hasError=!1)}connectedCallback(){super.connectedCallback(),!this.interactive&&!this.hasAttribute(`role`)&&this.setAttribute(`role`,`img`)}updated(){this.interactive?(this.getAttribute(`role`)===`img`&&this.removeAttribute(`role`),this.removeAttribute(`aria-label`)):(this.hasAttribute(`role`)||this.setAttribute(`role`,`img`),this.name&&this.setAttribute(`aria-label`,this.name));let e=getComputedStyle(this).getPropertyValue(`--appearance`).trim()===`circle`;this.style.borderRadius=e?`50%`:``}get _tag(){return this.interactive?l`button`:l`div`}render(){let e=this.src&&!this._hasError?i`<img
4
4
  src=${this.src}
@@ -1,4 +1,4 @@
1
- import{colorScheme as e}from"../../color-scheme.js";import{i as t}from"../../chunks/lit.js";import{i as n,t as r}from"../../chunks/decorate.js";import{a as i,o as a}from"../../chunks/lit-html.js";import{LuxenElement as o}from"../../shared/luxen-element.js";import s from"../../shared/styles/host.styles.js";var c=t(`:host{--size:1em;--color:currentColor;inline-size:var(--size);block-size:var(--size);color:var(--color);flex:none;display:inline-flex}svg{fill:currentColor;block-size:100%;inline-size:100%;transition:rotate .5s cubic-bezier(.16,1,.3,1);rotate:0deg}.disc,.ray,.biter{transform-box:fill-box;transform-origin:50%}.disc{transition:scale .5s cubic-bezier(.16,1,.3,1);scale:.56}.biter{transition:translate .5s cubic-bezier(.16,1,.3,1);translate:16px -16px}.ray{transition:scale .3s cubic-bezier(.34,1.56,.64,1);transition-delay:calc(var(--i) * 18ms);scale:1}:host([data-scheme=dark]) svg{rotate:40deg}:host([data-scheme=dark]) .disc{scale:1}:host([data-scheme=dark]) .biter{translate:5px -5px}:host([data-scheme=dark]) .ray{scale:0}@media (prefers-reduced-motion:reduce){svg,.disc,.biter,.ray{transition-duration:0s;transition-delay:0s}}`),l=Array.from({length:8},(e,t)=>{let n=t*Math.PI/4;return{i:t,cx:(12+Math.cos(n)*9.2).toFixed(2),cy:(12+Math.sin(n)*9.2).toFixed(2)}}),u=class extends o{static{this.styles=[s,c]}connectedCallback(){super.connectedCallback(),this._unsubscribe=e.subscribe(()=>this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribe?.(),this._unsubscribe=void 0}willUpdate(){this.dataset.scheme=this.scheme??e.current,this.label?(this.setAttribute(`role`,`img`),this.setAttribute(`aria-label`,this.label),this.removeAttribute(`aria-hidden`)):(this.removeAttribute(`role`),this.removeAttribute(`aria-label`),this.setAttribute(`aria-hidden`,`true`))}render(){return i`
1
+ import{colorScheme as e}from"../../color-scheme.js";import{i as t}from"../../chunks/lit.js";import{i as n,t as r}from"../../chunks/decorate.js";import{a as i,s as a}from"../../chunks/lit-html.js";import{LuxenElement as o}from"../../shared/luxen-element.js";import s from"../../shared/styles/host.styles.js";var c=t(`:host{--size:1em;--color:currentColor;inline-size:var(--size);block-size:var(--size);color:var(--color);flex:none;display:inline-flex}svg{fill:currentColor;block-size:100%;inline-size:100%;transition:rotate .5s cubic-bezier(.16,1,.3,1);rotate:0deg}.disc,.ray,.biter{transform-box:fill-box;transform-origin:50%}.disc{transition:scale .5s cubic-bezier(.16,1,.3,1);scale:.56}.biter{transition:translate .5s cubic-bezier(.16,1,.3,1);translate:16px -16px}.ray{transition:scale .3s cubic-bezier(.34,1.56,.64,1);transition-delay:calc(var(--i) * 18ms);scale:1}:host([data-scheme=dark]) svg{rotate:40deg}:host([data-scheme=dark]) .disc{scale:1}:host([data-scheme=dark]) .biter{translate:5px -5px}:host([data-scheme=dark]) .ray{scale:0}@media (prefers-reduced-motion:reduce){svg,.disc,.biter,.ray{transition-duration:0s;transition-delay:0s}}`),l=Array.from({length:8},(e,t)=>{let n=t*Math.PI/4;return{i:t,cx:(12+Math.cos(n)*9.2).toFixed(2),cy:(12+Math.sin(n)*9.2).toFixed(2)}}),u=class extends o{static{this.styles=[s,c]}connectedCallback(){super.connectedCallback(),this._unsubscribe=e.subscribe(()=>this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribe?.(),this._unsubscribe=void 0}willUpdate(){this.dataset.scheme=this.scheme??e.current,this.label?(this.setAttribute(`role`,`img`),this.setAttribute(`aria-label`,this.label),this.removeAttribute(`aria-hidden`)):(this.removeAttribute(`role`),this.removeAttribute(`aria-label`),this.setAttribute(`aria-hidden`,`true`))}render(){return i`
2
2
  <svg
3
3
  part="base"
4
4
  viewBox="0 0 24 24"
@@ -22,6 +22,7 @@ import { LuxenElement } from '../../shared/luxen-element.js';
22
22
  * @cssproperty [--padding=1.5rem] - Padding applied to the header, footer, and inline-padding of the body. Set to `0` to remove all internal spacing (e.g. for edge-to-edge media).
23
23
  * @cssproperty [--show-duration=200ms] - Open transition duration.
24
24
  * @cssproperty [--hide-duration=200ms] - Close transition duration.
25
+ * @cssproperty [--easing=cubic-bezier(0.32, 0.72, 0, 1)] - Timing function of the open and close transitions, backdrop included.
25
26
  * @cssproperty --backdrop - Backdrop color.
26
27
  * @cssproperty [--backdrop-blur=0] - Backdrop blur amount (any CSS length). `0` means no blur; set e.g. `4px` for a subtle frost.
27
28
  *
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/html/elements/dialog/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAkC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,MAAO,SAAQ,YAAY;IACtC,MAAM,CAAC,MAAM,4BAAwB;IAErC,oFAAoF;IAEpF,KAAK,SAAM;IAEX,kCAAkC;IAElC,IAAI,UAAS;IAEb,0CAA0C;IAE1C,YAAY,UAAS;IAErB,uDAAuD;IAEvD,aAAa,UAAS;IAMtB,OAAO,CAAC,MAAM,CAAyC;IAGvD,MAAM,EAAG,iBAAiB,CAAC;IAI3B,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAAc;IAMvD,SAAS,KAAK,KAAK,IAAI,MAAM,CAE5B;IACD,S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AY;IASZ,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC;IAqCrC,OAAO,CAAC,UAAU;IAclB,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK;IAM5B,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,eAAe,CAAC,CAAY;IAEpC,OAAO,CAAC,aAAa;YAcP,UAAU;IAWxB,SAAS,CAAC,aAAa;IAKvB,MAAM;IAqCN,SAAS,CAAC,YAAY;CAUvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","names":[],"sources":["../../../src/html/elements/dialog/dialog.ts"],"sourcesContent":["import { html, nothing, type PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { LuxenElement } from '../../shared/luxen-element.js';\nimport { HasSlotController } from '../../shared/controllers/has-slot-controller.js';\nimport { ShowEvent, AfterShowEvent, HideEvent, AfterHideEvent } from '../../events/index.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport styles from './dialog.styles.js';\n\ninterface CommandEventLike extends Event {\n command: string;\n source: Element | null;\n}\n\nconst supportsClosedBy =\n typeof HTMLDialogElement !== 'undefined' && 'closedBy' in HTMLDialogElement.prototype;\n\n// Native <dialog> doesn't lock body scroll. Inject a global rule that uses\n// `:has()` to freeze the root scroll container whenever any modal l-dialog\n// is open. Purely declarative — no manual lock/unlock bookkeeping.\n// Symbol guard makes the injection idempotent across HMR reloads.\n//\n// `scrollbar-gutter: stable` only applies to centered modals — it prevents\n// the page behind from shifting horizontally when the scrollbar disappears.\n// Edge-attached modals (drawers) opt out via `data-modal=\"edge\"`: a reserved\n// gutter would push the drawer off the actual viewport edge.\nconst SCROLL_LOCK_SHEET = Symbol.for('luxen-dialog-scroll-lock');\nif (typeof document !== 'undefined' && !(SCROLL_LOCK_SHEET in document)) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(`\n html:has([data-modal]) { overflow: hidden; }\n html:has([data-modal=\"centered\"]) { scrollbar-gutter: stable; }\n `);\n document.adoptedStyleSheets.push(sheet);\n Object.defineProperty(document, SCROLL_LOCK_SHEET, { value: sheet });\n}\n\n/**\n * A modal dialog rendered in the top layer via the native `<dialog>` element.\n *\n * Open and close by toggling the `open` property (or the `--show` / `--hide`\n * Invoker commands). There are no public `show()` / `close()` methods.\n *\n * @slot - Body content.\n * @slot title - Custom heading element. Overrides the default `<h2>` rendered from the `title` property. Also provides the dialog's accessible name.\n * @slot close - Close button (typically `<button class=\"l-close\">`).\n * @slot footer - Footer actions.\n *\n * @csspart dialog - The native `<dialog>` element.\n * @csspart header - The header wrapper containing the title and close slot.\n * @csspart title - The dialog title heading.\n * @csspart body - The body wrapper around the default slot.\n * @csspart footer - The footer wrapper around the footer slot.\n *\n * @cssproperty [--width=31rem] - Dialog width.\n * @cssproperty [--border-radius=6px] - Dialog border radius.\n * @cssproperty [--padding=1.5rem] - Padding applied to the header, footer, and inline-padding of the body. Set to `0` to remove all internal spacing (e.g. for edge-to-edge media).\n * @cssproperty [--show-duration=200ms] - Open transition duration.\n * @cssproperty [--hide-duration=200ms] - Close transition duration.\n * @cssproperty --backdrop - Backdrop color.\n * @cssproperty [--backdrop-blur=0] - Backdrop blur amount (any CSS length). `0` means no blur; set e.g. `4px` for a subtle frost.\n *\n * @event show - Fired when the dialog is about to open. Cancelable — call `event.preventDefault()` to keep it closed.\n * @event after-show - Fired after the open animation completes. Not cancelable.\n * @event hide - Fired when the dialog is about to close. Cancelable — call `event.preventDefault()` to keep it open.\n * @event after-hide - Fired after the close animation completes. Not cancelable.\n *\n * @command --show - Sets `open = true`.\n * @command --hide - Sets `open = false`.\n *\n * @customElement l-dialog\n */\nexport class Dialog extends LuxenElement {\n static styles = [hostStyles, styles];\n\n /** Dialog title rendered in the header and used as the dialog's accessible name. */\n @property()\n title = '';\n\n /** Whether the dialog is open. */\n @property({ type: Boolean, reflect: true })\n open = false;\n\n /** Close when the backdrop is clicked. */\n @property({ type: Boolean, reflect: true, attribute: 'light-dismiss' })\n lightDismiss = false;\n\n /** Hide the header entirely (title and close slot). */\n @property({ type: Boolean, reflect: true, attribute: 'without-header' })\n withoutHeader = false;\n\n // Tracks whether the footer slot has content, so the footer row can collapse\n // when empty (toggles `data-empty` below). A controller drives this because\n // `:host(:has(> [slot='footer']))` is invalid — `:has()` can't be nested in\n // `:host()`, so browsers drop the whole rule.\n private _slots = new HasSlotController(this, 'footer');\n\n @query('dialog')\n dialog!: HTMLDialogElement;\n\n // Drives the scroll-lock stylesheet: `centered` reserves the scrollbar\n // gutter (no page shift); `edge` skips it (drawers sit flush to the edge).\n protected _modalKind: 'centered' | 'edge' = 'centered';\n\n // Subclass seams (defaults keep `l-dialog` unchanged). `alert-dialog`\n // overrides these to expose `role=\"alertdialog\"` and wire `aria-describedby`\n // to the body. `_bodyId` drives both the body's `id` and `aria-describedby`,\n // so the association can't drift; an empty string emits neither.\n protected get _role(): string {\n return '';\n }\n protected get _bodyId(): string {\n return '';\n }\n\n private _mouseDownTarget: EventTarget | null = null;\n\n private _commandListener: EventListenerObject = {\n handleEvent: (e: Event) => this._onCommand(e as CommandEventLike),\n };\n\n // --- Lifecycle ---\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener('command', this._commandListener);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('command', this._commandListener);\n }\n\n firstUpdated() {\n this.dialog.addEventListener('cancel', (e) => this._onCancel(e));\n this.dialog.addEventListener('close', () => this._onNativeClose());\n this.dialog.addEventListener('mousedown', (e) => {\n this._mouseDownTarget = e.target;\n });\n this.dialog.addEventListener('click', (e) => this._onDialogClick(e));\n }\n\n updated(changed: PropertyValues<this>) {\n if (!changed.has('open')) return;\n\n if (this.open && !this.dialog.open) {\n // Opening — cancelable. Revert the property if consumer prevents.\n if (!this.dispatchEvent(new ShowEvent())) {\n // Defer the revert so it lands outside the current update cycle and\n // doesn't schedule a new update from inside updated().\n queueMicrotask(() => {\n this.open = false;\n });\n return;\n }\n this.setAttribute('data-modal', this._modalKind);\n this.dialog.showModal();\n this._focusInitial();\n void this._emitAfter('after-show');\n } else if (!this.open && this.dialog.open) {\n // Closing — cancelable. Revert the property if consumer prevents.\n if (!this.dispatchEvent(new HideEvent())) {\n // Defer the revert so it lands outside the current update cycle and\n // doesn't schedule a new update from inside updated().\n queueMicrotask(() => {\n this.open = true;\n });\n return;\n }\n this.dialog.close();\n // `after-hide` is emitted from `_onNativeClose` (runs for every close path).\n }\n }\n\n // --- Event handlers ---\n\n // Custom commands on a custom element must start with `--`.\n // Built-in commands like \"close\" are reserved for native elements\n // and won't fire here.\n private _onCommand(e: CommandEventLike) {\n switch (e.command) {\n case '--hide':\n this.open = false;\n break;\n case '--show':\n this.open = true;\n break;\n }\n }\n\n // Fires on Escape and on `closedby=\"any\"` close requests.\n // Does NOT fire when script calls `.close()`, so `updated()`'s cancelable\n // `hide` emit doesn't collide with this one.\n protected _onCancel(e: Event) {\n if (!this.dispatchEvent(new HideEvent())) {\n e.preventDefault();\n }\n }\n\n private _onNativeClose() {\n this.open = false;\n this.removeAttribute('data-modal');\n void this._emitAfter('after-hide');\n }\n\n private _onDialogClick(e: MouseEvent) {\n // With `dialog { padding: 0 }`, `e.target === this.dialog` only fires\n // for backdrop clicks. The mousedown guard prevents drag-out dismissal.\n const clickedBackdrop = e.target === this.dialog && this._mouseDownTarget === this.dialog;\n this._mouseDownTarget = null;\n if (!clickedBackdrop) return;\n\n if (this.lightDismiss) {\n // When `supportsClosedBy`, the native `closedby=\"any\"` already closed.\n if (!supportsClosedBy) this.open = false;\n return;\n }\n this._nudgeDismiss();\n }\n\n private _nudgeAnimation?: Animation;\n\n private _nudgeDismiss() {\n if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;\n this._nudgeAnimation?.cancel();\n this._nudgeAnimation = this.dialog.animate(\n [{ transform: 'scale(1)' }, { transform: 'scale(1.02)' }, { transform: 'scale(1)' }],\n { duration: 250, easing: 'ease-in-out' },\n );\n }\n\n // Awaits every active animation on the dialog (transitions + @keyframes)\n // and then emits. Resolves immediately when no animations are running,\n // which covers `prefers-reduced-motion` and consumers that zero the\n // duration custom properties — cases where `transitionend` never fires.\n // Waits one frame first so @starting-style transitions have registered.\n private async _emitAfter(name: 'after-show' | 'after-hide') {\n await new Promise((r) => requestAnimationFrame(() => r(null)));\n const anims = this.dialog.getAnimations({ subtree: false });\n await Promise.all(anims.map((a) => a.finished.catch(() => {})));\n if ((name === 'after-show') !== this.open) return;\n this.dispatchEvent(name === 'after-show' ? new AfterShowEvent() : new AfterHideEvent());\n }\n\n // Firefox/Safari don't reliably resolve `[autofocus]` when `<dialog>`\n // is in shadow DOM and the target is in light DOM. Resolve it manually.\n // Subclasses (alert-dialog) override to fall back to a shadow-DOM target.\n protected _focusInitial() {\n const target = this.querySelector<HTMLElement>('[autofocus]');\n target?.focus({ preventScroll: true });\n }\n\n render() {\n const closedby = this.lightDismiss && supportsClosedBy ? 'any' : nothing;\n return html`\n <dialog\n part=\"dialog\"\n role=${this._role || nothing}\n closedby=${closedby}\n aria-labelledby=${this.withoutHeader ? nothing : 'title-area'}\n aria-label=${this.title || nothing}\n aria-describedby=${this._bodyId || nothing}\n >\n ${this.withoutHeader\n ? nothing\n : html`\n <header part=\"header\">\n <slot\n name=\"title\"\n id=\"title-area\"\n >\n ${this.title ? html`<h2 part=\"title\">${this.title}</h2>` : nothing}\n </slot>\n <slot name=\"close\"></slot>\n </header>\n `}\n <div\n part=\"body\"\n id=${this._bodyId || nothing}\n >\n <slot></slot>\n </div>\n ${this.renderFooter()}\n </dialog>\n `;\n }\n\n // Footer row. Overridden by subclasses (alert-dialog) to render their own\n // actions in place of the default `footer` slot.\n protected renderFooter() {\n return html`\n <footer\n part=\"footer\"\n ?data-empty=${!this._slots.test('footer')}\n >\n <slot name=\"footer\"></slot>\n </footer>\n `;\n }\n}\n"],"mappings":"0kBAaA,IAAM,EACJ,OAAO,kBAAsB,KAAe,aAAc,kBAAkB,UAWxE,EAAoB,OAAO,IAAI,0BA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ExB,KADoB,cAA2B,aAC/C,CAAA,EAAQ,MAAM,CAAE,cAAe,EAAK,CAAC,CACvC,CAEA,QAAS,CACP,IAAM,EAAW,KAAK,cAAgB,EAAmB,MAAQ,EACjE,MAAO,EAAI;;;eAGA,KAAK,OAAS,EAAQ;mBAClB,EAAS;0BACF,KAAK,cAAgB,EAAU,aAAa;qBACjD,KAAK,OAAS,EAAQ;2BAChB,KAAK,SAAW,EAAQ;;UAEzC,KAAK,cACH,EACA,CAAI;;;;;;oBAMI,KAAK,MAAQ,CAAI,oBAAoB,KAAK,MAAM,OAAS,EAAQ;;;;cAIvE;;;eAGC,KAAK,SAAW,EAAQ;;;;UAI7B,KAAK,aAAa,EAAE;;KAG5B,CAIA,cAAyB,CACvB,MAAO,EAAI;;;sBAGO,CAAC,KAAK,OAAO,KAAK,QAAQ,EAAE;;;;KAKhD,CACF,KA/NG,EAAS,CAAA,EAAA,EAAA,UAAA,QAAA,IAAA,EAAA,KAIT,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,OAAA,IAAA,EAAA,KAIzC,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,eAAgB,CAAC,CAAA,EAAA,EAAA,UAAA,eAAA,IAAA,EAAA,KAIrE,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,gBAAiB,CAAC,CAAA,EAAA,EAAA,UAAA,gBAAA,IAAA,EAAA,KAStE,EAAM,QAAQ,CAAA,EAAA,EAAA,UAAA,SAAA,IAAA,EAAA"}
1
+ {"version":3,"file":"dialog.js","names":[],"sources":["../../../src/html/elements/dialog/dialog.ts"],"sourcesContent":["import { html, nothing, type PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { LuxenElement } from '../../shared/luxen-element.js';\nimport { HasSlotController } from '../../shared/controllers/has-slot-controller.js';\nimport { ShowEvent, AfterShowEvent, HideEvent, AfterHideEvent } from '../../events/index.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport styles from './dialog.styles.js';\n\ninterface CommandEventLike extends Event {\n command: string;\n source: Element | null;\n}\n\nconst supportsClosedBy =\n typeof HTMLDialogElement !== 'undefined' && 'closedBy' in HTMLDialogElement.prototype;\n\n// Native <dialog> doesn't lock body scroll. Inject a global rule that uses\n// `:has()` to freeze the root scroll container whenever any modal l-dialog\n// is open. Purely declarative — no manual lock/unlock bookkeeping.\n// Symbol guard makes the injection idempotent across HMR reloads.\n//\n// `scrollbar-gutter: stable` only applies to centered modals — it prevents\n// the page behind from shifting horizontally when the scrollbar disappears.\n// Edge-attached modals (drawers) opt out via `data-modal=\"edge\"`: a reserved\n// gutter would push the drawer off the actual viewport edge.\nconst SCROLL_LOCK_SHEET = Symbol.for('luxen-dialog-scroll-lock');\nif (typeof document !== 'undefined' && !(SCROLL_LOCK_SHEET in document)) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(`\n html:has([data-modal]) { overflow: hidden; }\n html:has([data-modal=\"centered\"]) { scrollbar-gutter: stable; }\n `);\n document.adoptedStyleSheets.push(sheet);\n Object.defineProperty(document, SCROLL_LOCK_SHEET, { value: sheet });\n}\n\n/**\n * A modal dialog rendered in the top layer via the native `<dialog>` element.\n *\n * Open and close by toggling the `open` property (or the `--show` / `--hide`\n * Invoker commands). There are no public `show()` / `close()` methods.\n *\n * @slot - Body content.\n * @slot title - Custom heading element. Overrides the default `<h2>` rendered from the `title` property. Also provides the dialog's accessible name.\n * @slot close - Close button (typically `<button class=\"l-close\">`).\n * @slot footer - Footer actions.\n *\n * @csspart dialog - The native `<dialog>` element.\n * @csspart header - The header wrapper containing the title and close slot.\n * @csspart title - The dialog title heading.\n * @csspart body - The body wrapper around the default slot.\n * @csspart footer - The footer wrapper around the footer slot.\n *\n * @cssproperty [--width=31rem] - Dialog width.\n * @cssproperty [--border-radius=6px] - Dialog border radius.\n * @cssproperty [--padding=1.5rem] - Padding applied to the header, footer, and inline-padding of the body. Set to `0` to remove all internal spacing (e.g. for edge-to-edge media).\n * @cssproperty [--show-duration=200ms] - Open transition duration.\n * @cssproperty [--hide-duration=200ms] - Close transition duration.\n * @cssproperty [--easing=cubic-bezier(0.32, 0.72, 0, 1)] - Timing function of the open and close transitions, backdrop included.\n * @cssproperty --backdrop - Backdrop color.\n * @cssproperty [--backdrop-blur=0] - Backdrop blur amount (any CSS length). `0` means no blur; set e.g. `4px` for a subtle frost.\n *\n * @event show - Fired when the dialog is about to open. Cancelable — call `event.preventDefault()` to keep it closed.\n * @event after-show - Fired after the open animation completes. Not cancelable.\n * @event hide - Fired when the dialog is about to close. Cancelable — call `event.preventDefault()` to keep it open.\n * @event after-hide - Fired after the close animation completes. Not cancelable.\n *\n * @command --show - Sets `open = true`.\n * @command --hide - Sets `open = false`.\n *\n * @customElement l-dialog\n */\nexport class Dialog extends LuxenElement {\n static styles = [hostStyles, styles];\n\n /** Dialog title rendered in the header and used as the dialog's accessible name. */\n @property()\n title = '';\n\n /** Whether the dialog is open. */\n @property({ type: Boolean, reflect: true })\n open = false;\n\n /** Close when the backdrop is clicked. */\n @property({ type: Boolean, reflect: true, attribute: 'light-dismiss' })\n lightDismiss = false;\n\n /** Hide the header entirely (title and close slot). */\n @property({ type: Boolean, reflect: true, attribute: 'without-header' })\n withoutHeader = false;\n\n // Tracks whether the footer slot has content, so the footer row can collapse\n // when empty (toggles `data-empty` below). A controller drives this because\n // `:host(:has(> [slot='footer']))` is invalid — `:has()` can't be nested in\n // `:host()`, so browsers drop the whole rule.\n private _slots = new HasSlotController(this, 'footer');\n\n @query('dialog')\n dialog!: HTMLDialogElement;\n\n // Drives the scroll-lock stylesheet: `centered` reserves the scrollbar\n // gutter (no page shift); `edge` skips it (drawers sit flush to the edge).\n protected _modalKind: 'centered' | 'edge' = 'centered';\n\n // Subclass seams (defaults keep `l-dialog` unchanged). `alert-dialog`\n // overrides these to expose `role=\"alertdialog\"` and wire `aria-describedby`\n // to the body. `_bodyId` drives both the body's `id` and `aria-describedby`,\n // so the association can't drift; an empty string emits neither.\n protected get _role(): string {\n return '';\n }\n protected get _bodyId(): string {\n return '';\n }\n\n private _mouseDownTarget: EventTarget | null = null;\n\n private _commandListener: EventListenerObject = {\n handleEvent: (e: Event) => this._onCommand(e as CommandEventLike),\n };\n\n // --- Lifecycle ---\n\n connectedCallback() {\n super.connectedCallback();\n this.addEventListener('command', this._commandListener);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('command', this._commandListener);\n }\n\n firstUpdated() {\n this.dialog.addEventListener('cancel', (e) => this._onCancel(e));\n this.dialog.addEventListener('close', () => this._onNativeClose());\n this.dialog.addEventListener('mousedown', (e) => {\n this._mouseDownTarget = e.target;\n });\n this.dialog.addEventListener('click', (e) => this._onDialogClick(e));\n }\n\n updated(changed: PropertyValues<this>) {\n if (!changed.has('open')) return;\n\n if (this.open && !this.dialog.open) {\n // Opening — cancelable. Revert the property if consumer prevents.\n if (!this.dispatchEvent(new ShowEvent())) {\n // Defer the revert so it lands outside the current update cycle and\n // doesn't schedule a new update from inside updated().\n queueMicrotask(() => {\n this.open = false;\n });\n return;\n }\n this.setAttribute('data-modal', this._modalKind);\n this.dialog.showModal();\n this._focusInitial();\n void this._emitAfter('after-show');\n } else if (!this.open && this.dialog.open) {\n // Closing — cancelable. Revert the property if consumer prevents.\n if (!this.dispatchEvent(new HideEvent())) {\n // Defer the revert so it lands outside the current update cycle and\n // doesn't schedule a new update from inside updated().\n queueMicrotask(() => {\n this.open = true;\n });\n return;\n }\n this.dialog.close();\n // `after-hide` is emitted from `_onNativeClose` (runs for every close path).\n }\n }\n\n // --- Event handlers ---\n\n // Custom commands on a custom element must start with `--`.\n // Built-in commands like \"close\" are reserved for native elements\n // and won't fire here.\n private _onCommand(e: CommandEventLike) {\n switch (e.command) {\n case '--hide':\n this.open = false;\n break;\n case '--show':\n this.open = true;\n break;\n }\n }\n\n // Fires on Escape and on `closedby=\"any\"` close requests.\n // Does NOT fire when script calls `.close()`, so `updated()`'s cancelable\n // `hide` emit doesn't collide with this one.\n protected _onCancel(e: Event) {\n if (!this.dispatchEvent(new HideEvent())) {\n e.preventDefault();\n }\n }\n\n private _onNativeClose() {\n this.open = false;\n this.removeAttribute('data-modal');\n void this._emitAfter('after-hide');\n }\n\n private _onDialogClick(e: MouseEvent) {\n // With `dialog { padding: 0 }`, `e.target === this.dialog` only fires\n // for backdrop clicks. The mousedown guard prevents drag-out dismissal.\n const clickedBackdrop = e.target === this.dialog && this._mouseDownTarget === this.dialog;\n this._mouseDownTarget = null;\n if (!clickedBackdrop) return;\n\n if (this.lightDismiss) {\n // When `supportsClosedBy`, the native `closedby=\"any\"` already closed.\n if (!supportsClosedBy) this.open = false;\n return;\n }\n this._nudgeDismiss();\n }\n\n private _nudgeAnimation?: Animation;\n\n private _nudgeDismiss() {\n if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;\n this._nudgeAnimation?.cancel();\n this._nudgeAnimation = this.dialog.animate(\n [{ transform: 'scale(1)' }, { transform: 'scale(1.02)' }, { transform: 'scale(1)' }],\n { duration: 250, easing: 'ease-in-out' },\n );\n }\n\n // Awaits every active animation on the dialog (transitions + @keyframes)\n // and then emits. Resolves immediately when no animations are running,\n // which covers `prefers-reduced-motion` and consumers that zero the\n // duration custom properties — cases where `transitionend` never fires.\n // Waits one frame first so @starting-style transitions have registered.\n private async _emitAfter(name: 'after-show' | 'after-hide') {\n await new Promise((r) => requestAnimationFrame(() => r(null)));\n const anims = this.dialog.getAnimations({ subtree: false });\n await Promise.all(anims.map((a) => a.finished.catch(() => {})));\n if ((name === 'after-show') !== this.open) return;\n this.dispatchEvent(name === 'after-show' ? new AfterShowEvent() : new AfterHideEvent());\n }\n\n // Firefox/Safari don't reliably resolve `[autofocus]` when `<dialog>`\n // is in shadow DOM and the target is in light DOM. Resolve it manually.\n // Subclasses (alert-dialog) override to fall back to a shadow-DOM target.\n protected _focusInitial() {\n const target = this.querySelector<HTMLElement>('[autofocus]');\n target?.focus({ preventScroll: true });\n }\n\n render() {\n const closedby = this.lightDismiss && supportsClosedBy ? 'any' : nothing;\n return html`\n <dialog\n part=\"dialog\"\n role=${this._role || nothing}\n closedby=${closedby}\n aria-labelledby=${this.withoutHeader ? nothing : 'title-area'}\n aria-label=${this.title || nothing}\n aria-describedby=${this._bodyId || nothing}\n >\n ${this.withoutHeader\n ? nothing\n : html`\n <header part=\"header\">\n <slot\n name=\"title\"\n id=\"title-area\"\n >\n ${this.title ? html`<h2 part=\"title\">${this.title}</h2>` : nothing}\n </slot>\n <slot name=\"close\"></slot>\n </header>\n `}\n <div\n part=\"body\"\n id=${this._bodyId || nothing}\n >\n <slot></slot>\n </div>\n ${this.renderFooter()}\n </dialog>\n `;\n }\n\n // Footer row. Overridden by subclasses (alert-dialog) to render their own\n // actions in place of the default `footer` slot.\n protected renderFooter() {\n return html`\n <footer\n part=\"footer\"\n ?data-empty=${!this._slots.test('footer')}\n >\n <slot name=\"footer\"></slot>\n </footer>\n `;\n }\n}\n"],"mappings":"0kBAaA,IAAM,EACJ,OAAO,kBAAsB,KAAe,aAAc,kBAAkB,UAWxE,EAAoB,OAAO,IAAI,0BAA0B,EAC/D,GAAI,OAAO,SAAa,KAAe,EAAE,KAAqB,UAAW,CACvE,IAAM,EAAQ,IAAI,cAClB,EAAM,YAAY;;;GAGjB,EACD,SAAS,mBAAmB,KAAK,CAAK,EACtC,OAAO,eAAe,SAAU,EAAmB,CAAE,MAAO,CAAM,CAAC,CACrE,CAsCA,IAAa,EAAb,cAA4B,CAAa,0CAK/B,aAID,qBAIQ,sBAIC,eAMC,IAAI,EAAkB,KAAM,QAAQ,kBAOT,iCAaG,2BAEC,CAC9C,YAAc,GAAa,KAAK,WAAW,CAAqB,CAClE,qBA9CgB,CAAC,EAAY,CAAM,EAmCnC,IAAc,OAAgB,CAC5B,MAAO,EACT,CACA,IAAc,SAAkB,CAC9B,MAAO,EACT,CAUA,mBAAoB,CAClB,MAAM,kBAAkB,EACxB,KAAK,iBAAiB,UAAW,KAAK,gBAAgB,CACxD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,EAAS,CAAA,EAAA,EAAA,UAAA,QAAA,IAAA,EAAA,KAIT,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,OAAA,IAAA,EAAA,KAIzC,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,eAAgB,CAAC,CAAA,EAAA,EAAA,UAAA,eAAA,IAAA,EAAA,KAIrE,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,gBAAiB,CAAC,CAAA,EAAA,EAAA,UAAA,gBAAA,IAAA,EAAA,KAStE,EAAM,QAAQ,CAAA,EAAA,EAAA,UAAA,SAAA,IAAA,EAAA"}
@@ -1,2 +1,2 @@
1
- import{i as e}from"../../chunks/lit.js";var t=e(`:host{--width:31rem;--border-radius:6px;--padding:1.5rem;--header-padding:var(--padding);--footer-padding:var(--padding);--show-duration:.2s;--hide-duration:.2s;--backdrop:var(--l-backdrop);--backdrop-blur:0;display:contents}dialog{box-sizing:border-box;width:var(--width);max-inline-size:min(90vw, var(--width));border-radius:var(--border-radius);background-color:var(--l-color-surface-overlay);max-block-size:min(80dvb,100%);color:var(--l-color-text-primary);opacity:0;transition-property:opacity,display,overlay;transition-duration:var(--hide-duration);transition-behavior:allow-discrete;border:0;margin:auto;padding:0;position:fixed;inset:0}dialog::backdrop{background:var(--backdrop);-webkit-backdrop-filter:blur(var(--backdrop-blur));backdrop-filter:blur(var(--backdrop-blur))}dialog[open]{opacity:1;transition-duration:var(--show-duration);grid-template-rows:auto minmax(0,1fr) auto;display:grid}@starting-style{dialog[open]{opacity:0}}[part=header]{padding:var(--header-padding);justify-content:space-between;align-items:center;gap:1rem;display:flex}[part=title]{font-size:1.125rem;font-weight:var(--l-font-weight-semibold);margin:0;line-height:1.4}[part=body]{padding-inline:var(--padding);grid-row:2;overflow-y:auto}[part=footer]{padding:var(--footer-padding);grid-row:3;place-content:end;gap:.5rem;display:flex}[part=footer][data-empty]{display:none}[part=body]:has(~[part=footer][data-empty]){padding-block-end:var(--padding)}:host([without-header]) [part=body]{padding-block-start:var(--padding)}::slotted(menu[slot=footer]){display:contents}@media (prefers-reduced-motion:reduce){:host{--show-duration:0s;--hide-duration:0s}}`);export{t as default};
1
+ import{i as e}from"../../chunks/lit.js";var t=e(`:host{--width:31rem;--border-radius:6px;--padding:1.5rem;--header-padding:var(--padding);--footer-padding:var(--padding);--show-duration:.2s;--hide-duration:.2s;--easing:cubic-bezier(.32, .72, 0, 1);--backdrop:var(--l-backdrop);--backdrop-blur:0;display:contents}dialog{box-sizing:border-box;width:var(--width);max-inline-size:min(90vw, var(--width));border-radius:var(--border-radius);background-color:var(--l-color-surface-overlay);max-block-size:min(80dvb,100%);color:var(--l-color-text-primary);opacity:0;transition-property:opacity,display,overlay;transition-duration:var(--hide-duration);transition-timing-function:var(--easing);transition-behavior:allow-discrete;border:0;margin:auto;padding:0;position:fixed;inset:0}dialog::backdrop{background:var(--backdrop);-webkit-backdrop-filter:blur(var(--backdrop-blur));backdrop-filter:blur(var(--backdrop-blur));opacity:0;transition-property:opacity,display,overlay;transition-duration:var(--hide-duration);transition-timing-function:var(--easing);transition-behavior:allow-discrete}dialog[open]{opacity:1;transition-duration:var(--show-duration);grid-template-rows:auto minmax(0,1fr) auto;display:grid}dialog[open]::backdrop{opacity:1;transition-duration:var(--show-duration)}@starting-style{dialog[open],dialog[open]::backdrop{opacity:0}}[part=header]{padding:var(--header-padding);justify-content:space-between;align-items:center;gap:1rem;display:flex}[part=title]{font-size:1.125rem;font-weight:var(--l-font-weight-semibold);margin:0;line-height:1.4}[part=body]{padding-inline:var(--padding);grid-row:2;overflow-y:auto}[part=footer]{padding:var(--footer-padding);grid-row:3;place-content:end;gap:.5rem;display:flex}[part=footer][data-empty]{display:none}[part=body]:has(~[part=footer][data-empty]){padding-block-end:var(--padding)}:host([without-header]) [part=body]{padding-block-start:var(--padding)}::slotted(menu[slot=footer]){display:contents}@media (prefers-reduced-motion:reduce){:host{--show-duration:0s;--hide-duration:0s}}`);export{t as default};
2
2
  //# sourceMappingURL=dialog.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.styles.js","names":[],"sources":["../../../src/html/elements/dialog/dialog.css?inline","../../../src/html/elements/dialog/dialog.styles.ts"],"sourcesContent":[":host {\n --width: 31rem;\n --border-radius: 6px;\n --padding: 1.5rem;\n --header-padding: var(--padding);\n --footer-padding: var(--padding);\n --show-duration: 200ms;\n --hide-duration: 200ms;\n --backdrop: var(--l-backdrop);\n --backdrop-blur: 0;\n\n display: contents;\n}\n\ndialog {\n position: fixed;\n inset: 0;\n box-sizing: border-box;\n width: var(--width);\n max-inline-size: min(90vw, var(--width));\n max-block-size: min(80dvb, 100%);\n margin: auto;\n padding: 0;\n border: 0;\n border-radius: var(--border-radius);\n background-color: var(--l-color-surface-overlay);\n color: var(--l-color-text-primary);\n\n /* EXIT STATE */\n opacity: 0;\n\n transition-property: opacity, display, overlay;\n transition-duration: var(--hide-duration);\n transition-behavior: allow-discrete;\n\n &::backdrop {\n background: var(--backdrop);\n backdrop-filter: blur(var(--backdrop-blur));\n }\n\n /* OPEN STATE */\n /* grid layout pins header/footer; the middle row (body) scrolls via\n overflow on [part='body'] and minmax(0, 1fr) allowing it to shrink. */\n &[open] {\n display: grid;\n grid-template-rows: auto minmax(0, 1fr) auto;\n opacity: 1;\n transition-duration: var(--show-duration);\n }\n\n /* BEFORE-OPEN STATE */\n @starting-style {\n &[open] {\n opacity: 0;\n }\n }\n}\n\n[part='header'] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 1rem;\n padding: var(--header-padding);\n}\n\n[part='title'] {\n margin: 0;\n font-size: 1.125rem;\n font-weight: var(--l-font-weight-semibold);\n line-height: 1.4;\n}\n\n/* Pin body and footer so the layout stays correct when [without-header]\n removes the header and only two children auto-place into the grid. */\n[part='body'] {\n grid-row: 2;\n padding-inline: var(--padding);\n overflow-y: auto;\n}\n\n[part='footer'] {\n grid-row: 3;\n display: flex;\n place-content: end;\n gap: 0.5rem;\n padding: var(--footer-padding);\n}\n\n/* Collapse the footer row when nothing is slotted into it, so an empty\n dialog/drawer reserves no space at the bottom. `data-empty` is toggled by the\n HasSlotController in dialog.ts: `:host(:has(...))` can't be used because\n `:has()` is invalid inside `:host()` and the whole rule is dropped by the\n browser. */\n[part='footer'][data-empty] {\n display: none;\n}\n\n/* With the footer collapsed, the body has to provide its own block-end padding\n (normally inherited visually from the footer padding below it). */\n[part='body']:has(~ [part='footer'][data-empty]) {\n padding-block-end: var(--padding);\n}\n\n/* Without a header, the body has to provide its own block-start padding\n (normally inherited visually from the header padding above it). */\n:host([without-header]) [part='body'] {\n padding-block-start: var(--padding);\n}\n\n::slotted(menu[slot='footer']) {\n display: contents;\n}\n\n@media (prefers-reduced-motion: reduce) {\n :host {\n --show-duration: 0ms;\n --hide-duration: 0ms;\n }\n}\n","import { unsafeCSS } from 'lit';\nimport raw from './dialog.css?inline';\n\n/**\n * Wrapper module: imported by both `dialog.ts` and `drawer.ts`.\n * `unsafeCSS()` is called once here so both importers share the same\n * `CSSResult` instance (one constructed `CSSStyleSheet`, not two).\n */\nexport default unsafeCSS(raw);\n"],"mappings":"wCCQA,IAAA,EAAe,EAAU,ymDAAG"}
1
+ {"version":3,"file":"dialog.styles.js","names":[],"sources":["../../../src/html/elements/dialog/dialog.css?inline","../../../src/html/elements/dialog/dialog.styles.ts"],"sourcesContent":[":host {\n --width: 31rem;\n --border-radius: 6px;\n --padding: 1.5rem;\n --header-padding: var(--padding);\n --footer-padding: var(--padding);\n --show-duration: 200ms;\n --hide-duration: 200ms;\n /* Fast start, soft landing: the surface is nearly in place early, the\n tail only settles it. */\n --easing: cubic-bezier(0.32, 0.72, 0, 1);\n --backdrop: var(--l-backdrop);\n --backdrop-blur: 0;\n\n display: contents;\n}\n\ndialog {\n position: fixed;\n inset: 0;\n box-sizing: border-box;\n width: var(--width);\n max-inline-size: min(90vw, var(--width));\n max-block-size: min(80dvb, 100%);\n margin: auto;\n padding: 0;\n border: 0;\n border-radius: var(--border-radius);\n background-color: var(--l-color-surface-overlay);\n color: var(--l-color-text-primary);\n\n /* EXIT STATE */\n opacity: 0;\n\n transition-property: opacity, display, overlay;\n transition-duration: var(--hide-duration);\n transition-timing-function: var(--easing);\n transition-behavior: allow-discrete;\n\n /* The backdrop does not inherit the dialog's opacity: without its own\n transition it pops in and out at full strength. */\n &::backdrop {\n background: var(--backdrop);\n backdrop-filter: blur(var(--backdrop-blur));\n opacity: 0;\n transition-property: opacity, display, overlay;\n transition-duration: var(--hide-duration);\n transition-timing-function: var(--easing);\n transition-behavior: allow-discrete;\n }\n\n /* OPEN STATE */\n /* grid layout pins header/footer; the middle row (body) scrolls via\n overflow on [part='body'] and minmax(0, 1fr) allowing it to shrink. */\n &[open] {\n display: grid;\n grid-template-rows: auto minmax(0, 1fr) auto;\n opacity: 1;\n transition-duration: var(--show-duration);\n }\n\n &[open]::backdrop {\n opacity: 1;\n transition-duration: var(--show-duration);\n }\n\n /* BEFORE-OPEN STATE */\n @starting-style {\n &[open],\n &[open]::backdrop {\n opacity: 0;\n }\n }\n}\n\n[part='header'] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 1rem;\n padding: var(--header-padding);\n}\n\n[part='title'] {\n margin: 0;\n font-size: 1.125rem;\n font-weight: var(--l-font-weight-semibold);\n line-height: 1.4;\n}\n\n/* Pin body and footer so the layout stays correct when [without-header]\n removes the header and only two children auto-place into the grid. */\n[part='body'] {\n grid-row: 2;\n padding-inline: var(--padding);\n overflow-y: auto;\n}\n\n[part='footer'] {\n grid-row: 3;\n display: flex;\n place-content: end;\n gap: 0.5rem;\n padding: var(--footer-padding);\n}\n\n/* Collapse the footer row when nothing is slotted into it, so an empty\n dialog/drawer reserves no space at the bottom. `data-empty` is toggled by the\n HasSlotController in dialog.ts: `:host(:has(...))` can't be used because\n `:has()` is invalid inside `:host()` and the whole rule is dropped by the\n browser. */\n[part='footer'][data-empty] {\n display: none;\n}\n\n/* With the footer collapsed, the body has to provide its own block-end padding\n (normally inherited visually from the footer padding below it). */\n[part='body']:has(~ [part='footer'][data-empty]) {\n padding-block-end: var(--padding);\n}\n\n/* Without a header, the body has to provide its own block-start padding\n (normally inherited visually from the header padding above it). */\n:host([without-header]) [part='body'] {\n padding-block-start: var(--padding);\n}\n\n::slotted(menu[slot='footer']) {\n display: contents;\n}\n\n@media (prefers-reduced-motion: reduce) {\n :host {\n --show-duration: 0ms;\n --hide-duration: 0ms;\n }\n}\n","import { unsafeCSS } from 'lit';\nimport raw from './dialog.css?inline';\n\n/**\n * Wrapper module: imported by both `dialog.ts` and `drawer.ts`.\n * `unsafeCSS()` is called once here so both importers share the same\n * `CSSResult` instance (one constructed `CSSStyleSheet`, not two).\n */\nexport default unsafeCSS(raw);\n"],"mappings":"wCCQA,IAAA,EAAe,EAAU,o8DAAG"}
@@ -20,8 +20,9 @@ import { Dialog } from '../dialog/dialog.js';
20
20
  * @cssproperty --border-radius - Drawer border radius on the inner edges (all corners when `inset`). Default `0.375rem`.
21
21
  * @cssproperty --inset-gap - Gap between the drawer and the viewport edges when `inset` is set. Default `1rem`.
22
22
  * @cssproperty --shadow - Drop shadow applied to the floating panel when `inset` is set. Set to `none` to remove it.
23
- * @cssproperty --show-duration - Open transition duration. Default `200ms`.
23
+ * @cssproperty --show-duration - Open transition duration. Default `300ms`.
24
24
  * @cssproperty --hide-duration - Close transition duration. Default `200ms`.
25
+ * @cssproperty --easing - Timing function of the open and close transitions, backdrop included. Default `cubic-bezier(0.32, 0.72, 0, 1)`.
25
26
  * @cssproperty --backdrop - Backdrop color.
26
27
  *
27
28
  * @event show - Fired when the drawer is about to open. Cancelable — call `event.preventDefault()` to keep it closed.
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/html/elements/drawer/drawer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,MAAO,SAAQ,MAAM;IAChC,OAAgB,MAAM,4BAA4C;IAIlE,UAAmB,UAAU,EAAG,MAAM,CAAU;IAEhD,iFAAiF;IAEjF,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;IAE/C,qGAAqG;IAErG,KAAK,UAAS;CACf"}
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/html/elements/drawer/drawer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,MAAO,SAAQ,MAAM;IAChC,OAAgB,MAAM,4BAA4C;IAIlE,UAAmB,UAAU,EAAG,MAAM,CAAU;IAEhD,iFAAiF;IAEjF,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;IAE/C,qGAAqG;IAErG,KAAK,UAAS;CACf"}
@@ -1,2 +1,2 @@
1
- import{i as e}from"../../chunks/lit.js";import{i as t,t as n}from"../../chunks/decorate.js";import r from"../../shared/styles/host.styles.js";import i from"../dialog/dialog.styles.js";import{Dialog as a}from"../dialog/dialog.js";var o=e(`:host{--size:320px;--border-radius:.375rem;--inset-gap:1rem;--shadow:var(--l-shadow-lg)}dialog{width:min(var(--size), 100dvw);max-inline-size:100dvw;height:100dvh;border-radius:0 var(--border-radius) var(--border-radius) 0;opacity:1;max-block-size:100dvh;margin:0;transition-property:translate,display,overlay;inset:0;translate:-100%}dialog[open]{translate:0}@starting-style{dialog[open]{translate:-100%}}:host([placement=end]) dialog{border-radius:var(--border-radius) 0 0 var(--border-radius);margin-inline-start:auto;translate:100%}:host([placement=end]) dialog[open]{translate:0}@starting-style{:host([placement=end]) dialog[open]{translate:100%}}:host([placement=bottom]) dialog{width:100dvw;max-inline-size:100dvw;height:min(var(--size), 100dvh);border-radius:var(--border-radius) var(--border-radius) 0 0;max-block-size:100dvh;margin-block-start:auto;translate:0 100%}:host([placement=bottom]) dialog[open]{translate:0}@starting-style{:host([placement=bottom]) dialog[open]{translate:0 100%}}:host([placement=top]) dialog{width:100dvw;max-inline-size:100dvw;height:min(var(--size), 100dvh);border-radius:0 0 var(--border-radius) var(--border-radius);max-block-size:100dvh;translate:0 -100%}:host([placement=top]) dialog[open]{translate:0}@starting-style{:host([placement=top]) dialog[open]{translate:0 -100%}}:host([inset]) dialog{border-radius:var(--border-radius);box-shadow:var(--shadow)}:host([inset]:not([placement])) dialog,:host([inset][placement=start]) dialog,:host([inset][placement=end]) dialog{height:calc(100dvh - 2 * var(--inset-gap));inset-block:var(--inset-gap)}:host([inset][placement=top]) dialog,:host([inset][placement=bottom]) dialog{width:calc(100dvw - 2 * var(--inset-gap));inset-inline:var(--inset-gap)}:host([inset]:not([placement])) dialog,:host([inset][placement=start]) dialog{inset-inline-start:var(--inset-gap)}:host([inset]:not([placement])) dialog:not([open]),:host([inset][placement=start]) dialog:not([open]){translate:calc(-100% - var(--inset-gap)) 0}@starting-style{:host([inset]:not([placement])) dialog[open],:host([inset][placement=start]) dialog[open]{translate:calc(-100% - var(--inset-gap)) 0}}:host([inset][placement=end]) dialog{margin-inline-start:0;inset-inline-start:auto;inset-inline-end:var(--inset-gap)}:host([inset][placement=end]) dialog:not([open]){translate:calc(100% + var(--inset-gap)) 0}@starting-style{:host([inset][placement=end]) dialog[open]{translate:calc(100% + var(--inset-gap)) 0}}:host([inset][placement=top]) dialog{inset-block-start:var(--inset-gap)}:host([inset][placement=top]) dialog:not([open]){translate:0 calc(-100% - var(--inset-gap))}@starting-style{:host([inset][placement=top]) dialog[open]{translate:0 calc(-100% - var(--inset-gap))}}:host([inset][placement=bottom]) dialog{margin-block-start:0;inset-block-start:auto;inset-block-end:var(--inset-gap)}:host([inset][placement=bottom]) dialog:not([open]){translate:0 calc(100% + var(--inset-gap))}@starting-style{:host([inset][placement=bottom]) dialog[open]{translate:0 calc(100% + var(--inset-gap))}}`),s=class extends a{constructor(...e){super(...e),this._modalKind=`edge`,this.inset=!1}static{this.styles=[r,i,o]}};n([t({reflect:!0})],s.prototype,`placement`,void 0),n([t({type:Boolean,reflect:!0})],s.prototype,`inset`,void 0);export{s as Drawer};
1
+ import{i as e}from"../../chunks/lit.js";import{i as t,t as n}from"../../chunks/decorate.js";import r from"../../shared/styles/host.styles.js";import i from"../dialog/dialog.styles.js";import{Dialog as a}from"../dialog/dialog.js";var o=e(`:host{--size:320px;--border-radius:.375rem;--inset-gap:1rem;--shadow:var(--l-shadow-lg);--show-duration:.3s}@media (prefers-reduced-motion:reduce){:host{--show-duration:0s;--hide-duration:0s}}dialog{width:min(var(--size), 100dvw);max-inline-size:100dvw;height:100dvh;border-radius:0 var(--border-radius) var(--border-radius) 0;opacity:1;max-block-size:100dvh;margin:0;transition-property:translate,display,overlay;inset:0;translate:-100%}dialog[open]{translate:0}@starting-style{dialog[open]{translate:-100%}}:host([placement=end]) dialog{border-radius:var(--border-radius) 0 0 var(--border-radius);margin-inline-start:auto;translate:100%}:host([placement=end]) dialog[open]{translate:0}@starting-style{:host([placement=end]) dialog[open]{translate:100%}}:host([placement=bottom]) dialog{width:100dvw;max-inline-size:100dvw;height:min(var(--size), 100dvh);border-radius:var(--border-radius) var(--border-radius) 0 0;max-block-size:100dvh;margin-block-start:auto;translate:0 100%}:host([placement=bottom]) dialog[open]{translate:0}@starting-style{:host([placement=bottom]) dialog[open]{translate:0 100%}}:host([placement=top]) dialog{width:100dvw;max-inline-size:100dvw;height:min(var(--size), 100dvh);border-radius:0 0 var(--border-radius) var(--border-radius);max-block-size:100dvh;translate:0 -100%}:host([placement=top]) dialog[open]{translate:0}@starting-style{:host([placement=top]) dialog[open]{translate:0 -100%}}:host([inset]) dialog{border-radius:var(--border-radius);box-shadow:var(--shadow)}:host([inset]:not([placement])) dialog,:host([inset][placement=start]) dialog,:host([inset][placement=end]) dialog{height:calc(100dvh - 2 * var(--inset-gap));inset-block:var(--inset-gap)}:host([inset][placement=top]) dialog,:host([inset][placement=bottom]) dialog{width:calc(100dvw - 2 * var(--inset-gap));inset-inline:var(--inset-gap)}:host([inset]:not([placement])) dialog,:host([inset][placement=start]) dialog{inset-inline-start:var(--inset-gap)}:host([inset]:not([placement])) dialog:not([open]),:host([inset][placement=start]) dialog:not([open]){translate:calc(-100% - var(--inset-gap)) 0}@starting-style{:host([inset]:not([placement])) dialog[open],:host([inset][placement=start]) dialog[open]{translate:calc(-100% - var(--inset-gap)) 0}}:host([inset][placement=end]) dialog{margin-inline-start:0;inset-inline-start:auto;inset-inline-end:var(--inset-gap)}:host([inset][placement=end]) dialog:not([open]){translate:calc(100% + var(--inset-gap)) 0}@starting-style{:host([inset][placement=end]) dialog[open]{translate:calc(100% + var(--inset-gap)) 0}}:host([inset][placement=top]) dialog{inset-block-start:var(--inset-gap)}:host([inset][placement=top]) dialog:not([open]){translate:0 calc(-100% - var(--inset-gap))}@starting-style{:host([inset][placement=top]) dialog[open]{translate:0 calc(-100% - var(--inset-gap))}}:host([inset][placement=bottom]) dialog{margin-block-start:0;inset-block-start:auto;inset-block-end:var(--inset-gap)}:host([inset][placement=bottom]) dialog:not([open]){translate:0 calc(100% + var(--inset-gap))}@starting-style{:host([inset][placement=bottom]) dialog[open]{translate:0 calc(100% + var(--inset-gap))}}`),s=class extends a{constructor(...e){super(...e),this._modalKind=`edge`,this.inset=!1}static{this.styles=[r,i,o]}};n([t({reflect:!0})],s.prototype,`placement`,void 0),n([t({type:Boolean,reflect:!0})],s.prototype,`inset`,void 0);export{s as Drawer};
2
2
  //# sourceMappingURL=drawer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","names":[],"sources":["../../../src/html/elements/drawer/drawer.css?inline","../../../src/html/elements/drawer/drawer.ts"],"sourcesContent":[":host {\n --size: 320px;\n --border-radius: 0.375rem;\n --inset-gap: 1rem;\n --shadow: var(--l-shadow-lg);\n}\n\n/* Override dialog's opacity fade with a slide from the inline-start edge. */\ndialog {\n inset: 0;\n margin: 0;\n width: min(var(--size), 100dvw);\n max-inline-size: 100dvw;\n height: 100dvh;\n max-block-size: 100dvh;\n border-radius: 0 var(--border-radius) var(--border-radius) 0;\n opacity: 1;\n translate: -100% 0;\n transition-property: translate, display, overlay;\n}\n\ndialog[open] {\n translate: 0 0;\n}\n\n@starting-style {\n dialog[open] {\n translate: -100% 0;\n }\n}\n\n/* Inline-end edge */\n:host([placement='end']) dialog {\n border-radius: var(--border-radius) 0 0 var(--border-radius);\n margin-inline-start: auto;\n translate: 100% 0;\n}\n\n:host([placement='end']) dialog[open] {\n translate: 0 0;\n}\n\n@starting-style {\n :host([placement='end']) dialog[open] {\n translate: 100% 0;\n }\n}\n\n/* Block-end (bottom) edge */\n:host([placement='bottom']) dialog {\n width: 100dvw;\n max-inline-size: 100dvw;\n height: min(var(--size), 100dvh);\n max-block-size: 100dvh;\n margin-block-start: auto;\n border-radius: var(--border-radius) var(--border-radius) 0 0;\n translate: 0 100%;\n}\n\n:host([placement='bottom']) dialog[open] {\n translate: 0 0;\n}\n\n@starting-style {\n :host([placement='bottom']) dialog[open] {\n translate: 0 100%;\n }\n}\n\n/* Block-start (top) edge */\n:host([placement='top']) dialog {\n width: 100dvw;\n max-inline-size: 100dvw;\n height: min(var(--size), 100dvh);\n max-block-size: 100dvh;\n border-radius: 0 0 var(--border-radius) var(--border-radius);\n translate: 0 -100%;\n}\n\n:host([placement='top']) dialog[open] {\n translate: 0 0;\n}\n\n@starting-style {\n :host([placement='top']) dialog[open] {\n translate: 0 -100%;\n }\n}\n\n/* Inset: float the drawer away from the viewport edges with a uniform gap and\n round every corner. The off-screen translate grows by the gap so the panel\n still clears the viewport edge during the slide (it no longer sits flush). */\n:host([inset]) dialog {\n border-radius: var(--border-radius);\n box-shadow: var(--shadow);\n}\n\n/* Inline-edge drawers (start/end): inset the block edges, shrink height to fit. */\n:host([inset]:not([placement])) dialog,\n:host([inset][placement='start']) dialog,\n:host([inset][placement='end']) dialog {\n height: calc(100dvh - 2 * var(--inset-gap));\n inset-block: var(--inset-gap);\n}\n\n/* Block-edge drawers (top/bottom): inset the inline edges, shrink width to fit. */\n:host([inset][placement='top']) dialog,\n:host([inset][placement='bottom']) dialog {\n width: calc(100dvw - 2 * var(--inset-gap));\n inset-inline: var(--inset-gap);\n}\n\n/* Inline-start edge: gap on the start side. */\n:host([inset]:not([placement])) dialog,\n:host([inset][placement='start']) dialog {\n inset-inline-start: var(--inset-gap);\n}\n\n:host([inset]:not([placement])) dialog:not([open]),\n:host([inset][placement='start']) dialog:not([open]) {\n translate: calc(-100% - var(--inset-gap)) 0;\n}\n\n@starting-style {\n :host([inset]:not([placement])) dialog[open],\n :host([inset][placement='start']) dialog[open] {\n translate: calc(-100% - var(--inset-gap)) 0;\n }\n}\n\n/* Inline-end edge: gap on the end side (override the base auto margin). */\n:host([inset][placement='end']) dialog {\n inset-inline-start: auto;\n inset-inline-end: var(--inset-gap);\n margin-inline-start: 0;\n}\n\n:host([inset][placement='end']) dialog:not([open]) {\n translate: calc(100% + var(--inset-gap)) 0;\n}\n\n@starting-style {\n :host([inset][placement='end']) dialog[open] {\n translate: calc(100% + var(--inset-gap)) 0;\n }\n}\n\n/* Block-start (top) edge: gap on the top side. */\n:host([inset][placement='top']) dialog {\n inset-block-start: var(--inset-gap);\n}\n\n:host([inset][placement='top']) dialog:not([open]) {\n translate: 0 calc(-100% - var(--inset-gap));\n}\n\n@starting-style {\n :host([inset][placement='top']) dialog[open] {\n translate: 0 calc(-100% - var(--inset-gap));\n }\n}\n\n/* Block-end (bottom) edge: gap on the bottom side (override the base auto margin). */\n:host([inset][placement='bottom']) dialog {\n inset-block-start: auto;\n inset-block-end: var(--inset-gap);\n margin-block-start: 0;\n}\n\n:host([inset][placement='bottom']) dialog:not([open]) {\n translate: 0 calc(100% + var(--inset-gap));\n}\n\n@starting-style {\n :host([inset][placement='bottom']) dialog[open] {\n translate: 0 calc(100% + var(--inset-gap));\n }\n}\n","import { unsafeCSS } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport { Dialog } from '../dialog/dialog.js';\nimport dialogStyles from '../dialog/dialog.styles.js';\nimport rawDrawerStyles from './drawer.css?inline';\n\nconst drawerStyles = unsafeCSS(rawDrawerStyles);\n\n/**\n * A drawer that slides in from a screen edge. Extends `<l-dialog>`.\n *\n * Open and close by toggling the `open` property (or the `--show` / `--hide`\n * Invoker commands). Always opens as modal.\n *\n * @slot - Body content.\n * @slot title - Custom heading element. Overrides the default `<h2>` rendered from the `title` property. Also provides the dialog's accessible name.\n * @slot close - Close button (typically `<button class=\"l-close\">`).\n * @slot footer - Footer actions.\n *\n * @csspart dialog - The native `<dialog>` element.\n * @csspart header - The header wrapper containing the title and close slot.\n * @csspart title - The drawer title heading.\n * @csspart body - The body wrapper around the default slot.\n * @csspart footer - The footer wrapper around the footer slot.\n *\n * @cssproperty --size - Drawer size on the axis perpendicular to its edge (width for `start`/`end`, height for `top`/`bottom`). Default `320px`.\n * @cssproperty --border-radius - Drawer border radius on the inner edges (all corners when `inset`). Default `0.375rem`.\n * @cssproperty --inset-gap - Gap between the drawer and the viewport edges when `inset` is set. Default `1rem`.\n * @cssproperty --shadow - Drop shadow applied to the floating panel when `inset` is set. Set to `none` to remove it.\n * @cssproperty --show-duration - Open transition duration. Default `200ms`.\n * @cssproperty --hide-duration - Close transition duration. Default `200ms`.\n * @cssproperty --backdrop - Backdrop color.\n *\n * @event show - Fired when the drawer is about to open. Cancelable — call `event.preventDefault()` to keep it closed.\n * @event after-show - Fired after the open animation completes. Not cancelable.\n * @event hide - Fired when the drawer is about to close. Cancelable — call `event.preventDefault()` to keep it open.\n * @event after-hide - Fired after the close animation completes. Not cancelable.\n *\n * @command --show - Sets `open = true`.\n * @command --hide - Sets `open = false`.\n *\n * @customElement l-drawer\n */\nexport class Drawer extends Dialog {\n static override styles = [hostStyles, dialogStyles, drawerStyles];\n\n // Edge-attached: opt out of the centered modal's stable scrollbar gutter,\n // which would otherwise push the drawer off the actual viewport edge.\n protected override _modalKind = 'edge' as const;\n\n /** Edge the drawer slides in from. Defaults to the start (inline-start) edge. */\n @property({ reflect: true })\n placement?: 'start' | 'end' | 'top' | 'bottom';\n\n /** Detach the drawer from the viewport edges, floating it with a uniform gap and rounded corners. */\n @property({ type: Boolean, reflect: true })\n inset = false;\n}\n"],"mappings":"qOCOA,IAAM,EAAe,EAAU,89FAAe,EAqCjC,EAAb,cAA4B,CAAO,+CAKD,kBAQxB,sBAZiB,CAAC,EAAY,EAAc,CAAY,EAalE,KANG,EAAS,CAAE,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,YAAA,IAAA,EAAA,KAI1B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,QAAA,IAAA,EAAA"}
1
+ {"version":3,"file":"drawer.js","names":[],"sources":["../../../src/html/elements/drawer/drawer.css?inline","../../../src/html/elements/drawer/drawer.ts"],"sourcesContent":[":host {\n --size: 320px;\n --border-radius: 0.375rem;\n --inset-gap: 1rem;\n --shadow: var(--l-shadow-lg);\n /* A slide travels much further than the dialog's fade. */\n --show-duration: 300ms;\n}\n\n/* Restated: this sheet comes after dialog.css, so the default above would\n otherwise win over its reduced-motion override. */\n@media (prefers-reduced-motion: reduce) {\n :host {\n --show-duration: 0ms;\n --hide-duration: 0ms;\n }\n}\n\n/* Override dialog's opacity fade with a slide from the inline-start edge. */\ndialog {\n inset: 0;\n margin: 0;\n width: min(var(--size), 100dvw);\n max-inline-size: 100dvw;\n height: 100dvh;\n max-block-size: 100dvh;\n border-radius: 0 var(--border-radius) var(--border-radius) 0;\n opacity: 1;\n translate: -100% 0;\n transition-property: translate, display, overlay;\n}\n\ndialog[open] {\n translate: 0 0;\n}\n\n@starting-style {\n dialog[open] {\n translate: -100% 0;\n }\n}\n\n/* Inline-end edge */\n:host([placement='end']) dialog {\n border-radius: var(--border-radius) 0 0 var(--border-radius);\n margin-inline-start: auto;\n translate: 100% 0;\n}\n\n:host([placement='end']) dialog[open] {\n translate: 0 0;\n}\n\n@starting-style {\n :host([placement='end']) dialog[open] {\n translate: 100% 0;\n }\n}\n\n/* Block-end (bottom) edge */\n:host([placement='bottom']) dialog {\n width: 100dvw;\n max-inline-size: 100dvw;\n height: min(var(--size), 100dvh);\n max-block-size: 100dvh;\n margin-block-start: auto;\n border-radius: var(--border-radius) var(--border-radius) 0 0;\n translate: 0 100%;\n}\n\n:host([placement='bottom']) dialog[open] {\n translate: 0 0;\n}\n\n@starting-style {\n :host([placement='bottom']) dialog[open] {\n translate: 0 100%;\n }\n}\n\n/* Block-start (top) edge */\n:host([placement='top']) dialog {\n width: 100dvw;\n max-inline-size: 100dvw;\n height: min(var(--size), 100dvh);\n max-block-size: 100dvh;\n border-radius: 0 0 var(--border-radius) var(--border-radius);\n translate: 0 -100%;\n}\n\n:host([placement='top']) dialog[open] {\n translate: 0 0;\n}\n\n@starting-style {\n :host([placement='top']) dialog[open] {\n translate: 0 -100%;\n }\n}\n\n/* Inset: float the drawer away from the viewport edges with a uniform gap and\n round every corner. The off-screen translate grows by the gap so the panel\n still clears the viewport edge during the slide (it no longer sits flush). */\n:host([inset]) dialog {\n border-radius: var(--border-radius);\n box-shadow: var(--shadow);\n}\n\n/* Inline-edge drawers (start/end): inset the block edges, shrink height to fit. */\n:host([inset]:not([placement])) dialog,\n:host([inset][placement='start']) dialog,\n:host([inset][placement='end']) dialog {\n height: calc(100dvh - 2 * var(--inset-gap));\n inset-block: var(--inset-gap);\n}\n\n/* Block-edge drawers (top/bottom): inset the inline edges, shrink width to fit. */\n:host([inset][placement='top']) dialog,\n:host([inset][placement='bottom']) dialog {\n width: calc(100dvw - 2 * var(--inset-gap));\n inset-inline: var(--inset-gap);\n}\n\n/* Inline-start edge: gap on the start side. */\n:host([inset]:not([placement])) dialog,\n:host([inset][placement='start']) dialog {\n inset-inline-start: var(--inset-gap);\n}\n\n:host([inset]:not([placement])) dialog:not([open]),\n:host([inset][placement='start']) dialog:not([open]) {\n translate: calc(-100% - var(--inset-gap)) 0;\n}\n\n@starting-style {\n :host([inset]:not([placement])) dialog[open],\n :host([inset][placement='start']) dialog[open] {\n translate: calc(-100% - var(--inset-gap)) 0;\n }\n}\n\n/* Inline-end edge: gap on the end side (override the base auto margin). */\n:host([inset][placement='end']) dialog {\n inset-inline-start: auto;\n inset-inline-end: var(--inset-gap);\n margin-inline-start: 0;\n}\n\n:host([inset][placement='end']) dialog:not([open]) {\n translate: calc(100% + var(--inset-gap)) 0;\n}\n\n@starting-style {\n :host([inset][placement='end']) dialog[open] {\n translate: calc(100% + var(--inset-gap)) 0;\n }\n}\n\n/* Block-start (top) edge: gap on the top side. */\n:host([inset][placement='top']) dialog {\n inset-block-start: var(--inset-gap);\n}\n\n:host([inset][placement='top']) dialog:not([open]) {\n translate: 0 calc(-100% - var(--inset-gap));\n}\n\n@starting-style {\n :host([inset][placement='top']) dialog[open] {\n translate: 0 calc(-100% - var(--inset-gap));\n }\n}\n\n/* Block-end (bottom) edge: gap on the bottom side (override the base auto margin). */\n:host([inset][placement='bottom']) dialog {\n inset-block-start: auto;\n inset-block-end: var(--inset-gap);\n margin-block-start: 0;\n}\n\n:host([inset][placement='bottom']) dialog:not([open]) {\n translate: 0 calc(100% + var(--inset-gap));\n}\n\n@starting-style {\n :host([inset][placement='bottom']) dialog[open] {\n translate: 0 calc(100% + var(--inset-gap));\n }\n}\n","import { unsafeCSS } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport { Dialog } from '../dialog/dialog.js';\nimport dialogStyles from '../dialog/dialog.styles.js';\nimport rawDrawerStyles from './drawer.css?inline';\n\nconst drawerStyles = unsafeCSS(rawDrawerStyles);\n\n/**\n * A drawer that slides in from a screen edge. Extends `<l-dialog>`.\n *\n * Open and close by toggling the `open` property (or the `--show` / `--hide`\n * Invoker commands). Always opens as modal.\n *\n * @slot - Body content.\n * @slot title - Custom heading element. Overrides the default `<h2>` rendered from the `title` property. Also provides the dialog's accessible name.\n * @slot close - Close button (typically `<button class=\"l-close\">`).\n * @slot footer - Footer actions.\n *\n * @csspart dialog - The native `<dialog>` element.\n * @csspart header - The header wrapper containing the title and close slot.\n * @csspart title - The drawer title heading.\n * @csspart body - The body wrapper around the default slot.\n * @csspart footer - The footer wrapper around the footer slot.\n *\n * @cssproperty --size - Drawer size on the axis perpendicular to its edge (width for `start`/`end`, height for `top`/`bottom`). Default `320px`.\n * @cssproperty --border-radius - Drawer border radius on the inner edges (all corners when `inset`). Default `0.375rem`.\n * @cssproperty --inset-gap - Gap between the drawer and the viewport edges when `inset` is set. Default `1rem`.\n * @cssproperty --shadow - Drop shadow applied to the floating panel when `inset` is set. Set to `none` to remove it.\n * @cssproperty --show-duration - Open transition duration. Default `300ms`.\n * @cssproperty --hide-duration - Close transition duration. Default `200ms`.\n * @cssproperty --easing - Timing function of the open and close transitions, backdrop included. Default `cubic-bezier(0.32, 0.72, 0, 1)`.\n * @cssproperty --backdrop - Backdrop color.\n *\n * @event show - Fired when the drawer is about to open. Cancelable — call `event.preventDefault()` to keep it closed.\n * @event after-show - Fired after the open animation completes. Not cancelable.\n * @event hide - Fired when the drawer is about to close. Cancelable — call `event.preventDefault()` to keep it open.\n * @event after-hide - Fired after the close animation completes. Not cancelable.\n *\n * @command --show - Sets `open = true`.\n * @command --hide - Sets `open = false`.\n *\n * @customElement l-drawer\n */\nexport class Drawer extends Dialog {\n static override styles = [hostStyles, dialogStyles, drawerStyles];\n\n // Edge-attached: opt out of the centered modal's stable scrollbar gutter,\n // which would otherwise push the drawer off the actual viewport edge.\n protected override _modalKind = 'edge' as const;\n\n /** Edge the drawer slides in from. Defaults to the start (inline-start) edge. */\n @property({ reflect: true })\n placement?: 'start' | 'end' | 'top' | 'bottom';\n\n /** Detach the drawer from the viewport edges, floating it with a uniform gap and rounded corners. */\n @property({ type: Boolean, reflect: true })\n inset = false;\n}\n"],"mappings":"qOCOA,IAAM,EAAe,EAAU,skGAAe,EAsCjC,EAAb,cAA4B,CAAO,+CAKD,kBAQxB,sBAZiB,CAAC,EAAY,EAAc,CAAY,EAalE,KANG,EAAS,CAAE,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,YAAA,IAAA,EAAA,KAI1B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,QAAA,IAAA,EAAA"}
@@ -52,6 +52,10 @@ export declare class Tree extends LuxenElement {
52
52
  * When set with `selection="multiple"`, parent and children selection are decoupled:
53
53
  * toggling a parent does NOT toggle its descendants and vice versa.
54
54
  * Without it, selection cascades both ways and branches may become indeterminate.
55
+ *
56
+ * In independent mode the tree never writes `indeterminate`: the consumer owns
57
+ * it (e.g. to show a partial state computed from rows not in the DOM). On
58
+ * leaving the cascade, the tree clears only the flags its cascade wrote.
55
59
  */
56
60
  accessor independent: boolean;
57
61
  connectedCallback(): void;
@@ -85,6 +89,8 @@ export declare class Tree extends LuxenElement {
85
89
  private _setSingleSelection;
86
90
  private _selectItem;
87
91
  private _setSubtreeSelection;
92
+ /** Whether selection cascades between parents and children. */
93
+ private get _cascades();
88
94
  /** Propagate child state UP to parents (indeterminate / auto-checked). */
89
95
  private _updateBranchStates;
90
96
  private _emitSelectionChange;
@@ -1 +1 @@
1
- {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/html/elements/tree/tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAO1D,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpE,mDAAmD;AACnD,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,SAAS,EAAE,QA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X,OAAO,CAAC,QAAQ;IAoBhB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,cAAc;IAUtB,2DAA2D;IAC3D,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,aAAa,CAEnB;IAEF,OAAO,CAAC,kBAAkB;IAuB1B,OAAO,CAAC,mBAAmB;IAQ3B,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,oBAAoB;IAS5B,+DAA+D;IAC/D,OAAO,KAAK,SAAS,GAEpB;IAED,0EAA0E;IAC1E,OAAO,CAAC,mBAAmB;IAqC3B,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,QAAQ,CAqDd;IAEF,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,UAAU,CAMhB;IAEF,OAAO,CAAC,UAAU,CAqEhB;IAEO,MAAM;CAahB"}
@@ -1,4 +1,4 @@
1
- import{tagName as e}from"../../registry.js";import{i as t}from"../../chunks/lit.js";import{i as n,t as r}from"../../chunks/decorate.js";import{a as i}from"../../chunks/lit-html.js";import{LuxenElement as a}from"../../shared/luxen-element.js";import o from"../../shared/styles/host.styles.js";var s=t(`:host{--indent-size:1rem;--indent-guide-width:1px;--indent-guide-style:solid;--indent-guide-color:var(--l-color-border-interactive);--row-height:1.75rem;--row-padding-inline:.25rem;--chevron-size:1.125rem;--item-gap:.375rem;color:var(--l-color-text-primary);font-family:inherit;line-height:1.5;display:block}.tree{outline:none;display:block}.tree:focus-visible{outline:2px solid var(--l-focus-ring);outline-offset:2px;border-radius:.375rem}`),c=class extends Event{constructor(e){super(`selection-change`,{bubbles:!1,composed:!1,cancelable:!1}),this.selection=e}},l=class extends a{constructor(...t){super(...t),this._internals=this.attachInternals(),this._lastFocusedItem=null,this.#e=`single`,this.#t=!1,this._onItemToggle=e=>{this._selectItem(e.item,e.checked)},this._onClick=e=>{let t=this._itemFromEvent(e);if(!t||t.disabled)return;let n=e.composedPath();if(n.some(e=>e instanceof HTMLInputElement&&e.type===`checkbox`))return;let r=new Set([`BUTTON`,`A`,`INPUT`,`SELECT`,`TEXTAREA`]),i=new Set([`button`,`link`,`menuitem`,`menuitemcheckbox`]);if(n.some(e=>{if(!(e instanceof HTMLElement)||e===t||e.getAttribute?.(`part`)===`expand-button`||e instanceof HTMLInputElement&&e.type===`checkbox`)return!1;if(r.has(e.tagName))return!0;let n=e.getAttribute?.(`role`);return n!==null&&i.has(n)}))return;let a=n.some(e=>e instanceof HTMLElement&&e.getAttribute?.(`part`)===`expand-button`);if(this._focusItem(t),a){t.toggle();return}switch(this.selection){case`single`:this._setSingleSelection(t),t.isLeaf()||t.toggle();break;case`leaf`:t.isLeaf()?this._setSingleSelection(t):t.toggle();break;case`multiple`:this._selectItem(t,!t.selected);break;case`none`:t.toggle();break}},this._onFocusIn=t=>{let n=t.target;if(n instanceof HTMLElement){let t=n.closest(e(`tree-item`));t&&(this._lastFocusedItem=t)}},this._onKeyDown=t=>{let n=this._lastFocusedItem??this._visibleItems()[0];if(!n)return;let r=this._visibleItems(),i=r.indexOf(n);switch(t.key){case`ArrowDown`:{t.preventDefault();let e=r[Math.min(i+1,r.length-1)];e&&this._focusItem(e);break}case`ArrowUp`:{t.preventDefault();let e=r[Math.max(i-1,0)];e&&this._focusItem(e);break}case`ArrowRight`:if(t.preventDefault(),!n.isLeaf()&&!n.expanded)n.expanded=!0;else if(n.expanded){let e=n.getChildrenItems()[0];e&&this._focusItem(e)}break;case`ArrowLeft`:if(t.preventDefault(),n.expanded&&!n.isLeaf())n.expanded=!1;else{let t=n.parentElement?.closest(e(`tree-item`));t&&this._focusItem(t)}break;case`Home`:t.preventDefault(),r[0]&&this._focusItem(r[0]);break;case`End`:{t.preventDefault();let e=r[r.length-1];e&&this._focusItem(e);break}case`Enter`:case` `:t.preventDefault(),this._handleRowActivate(n);break;case`*`:{t.preventDefault();let r=(n.parentElement?Array.from(n.parentElement.children):[]).filter(t=>t.tagName===e(`tree-item`).toUpperCase());for(let e of r)e.isLeaf()||(e.expanded=!0);break}}}}static{this.styles=[o,s]}#e;get selection(){return this.#e}set selection(e){this.#e=e}#t;get independent(){return this.#t}set independent(e){this.#t=e}connectedCallback(){super.connectedCallback(),this._internals.role=`tree`,this.hasAttribute(`role`)||this.setAttribute(`role`,`tree`),this._mutationObserver=new MutationObserver(()=>this._syncAll()),this._mutationObserver.observe(this,{childList:!0,subtree:!0}),this.addEventListener(`selection-toggle`,this._onItemToggle),queueMicrotask(()=>this._syncAll())}disconnectedCallback(){super.disconnectedCallback(),this._mutationObserver?.disconnect(),this.removeEventListener(`selection-toggle`,this._onItemToggle)}updated(e){if(e.has(`selection`)){let e=this.selection===`multiple`?`true`:`false`;this._internals.ariaMultiSelectable=e,this.setAttribute(`aria-multiselectable`,e)}(e.has(`selection`)||e.has(`independent`))&&this._syncAll()}getAllItems({includeDisabled:t=!0}={}){let n=e(`tree-item`);return Array.from(this.querySelectorAll(n)).filter(e=>t||!e.disabled)}getSelection(){return this.getAllItems().filter(e=>e.selected)}expandAll(){for(let e of this.getAllItems())e.isLeaf()||(e.expanded=!0)}collapseAll(){for(let e of this.getAllItems())e.expanded=!1}_syncAll(){customElements.upgrade(this);let t=e(`tree-item`),n=this._rootItems();if(n.some(e=>typeof e.getChildrenItems!=`function`)){customElements.whenDefined(t).then(()=>this._syncAll());return}let r=this.selection===`multiple`;this._syncLevel(n,0,r),this._updateBranchStates(),this._ensureTabStop()}_syncLevel(e,t,n){let r=e.length;e.forEach((e,i)=>{e.depth=t,e.showCheckbox=n&&this._canShowCheckboxOn(e),e.setPosition(t+1,i+1,r),this._syncLevel(e.getChildrenItems(),t+1,n)})}_canShowCheckboxOn(e){return this.selection===`multiple`}_rootItems(){let t=e(`tree-item`).toUpperCase();return Array.from(this.children).filter(e=>e.tagName===t)}_ensureTabStop(){let e=this._visibleItems();if(e.length!==0&&!e.some(e=>e.tabIndex===0)){for(let t of e)t.tabIndex=-1;e[0].tabIndex=0}}_visibleItems(){let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&t(r.getChildrenItems())};return t(this._rootItems()),e}_handleRowActivate(e){if(!e.disabled)switch(this.selection){case`single`:this._setSingleSelection(e),e.isLeaf()||e.toggle();break;case`leaf`:e.isLeaf()?this._setSingleSelection(e):e.toggle();break;case`multiple`:this._selectItem(e,!e.selected);break;case`none`:e.toggle();break}}_setSingleSelection(e){for(let t of this.getAllItems())t!==e&&t.selected&&(t.selected=!1);e.selected=!0,this._emitSelectionChange()}_selectItem(e,t){e.disabled||(e.selected=t,this.selection===`multiple`&&!this.independent&&this._setSubtreeSelection(e,t),e.indeterminate=!1,this._updateBranchStates(),this._emitSelectionChange())}_setSubtreeSelection(e,t){for(let n of e.getChildrenItems())n.disabled||(n.selected=t,n.indeterminate=!1,this._setSubtreeSelection(n,t))}_updateBranchStates(){if(this.selection!==`multiple`||this.independent){for(let e of this.getAllItems())e.indeterminate=!1;return}let e=t=>{let n=t.getChildrenItems({includeDisabled:!1});if(n.length===0)return{all:t.selected,any:t.selected};let r=!0,i=!1;for(let t of n){let n=e(t);n.all||(r=!1),n.any&&(i=!0)}return t.selected=r,t.indeterminate=!r&&i,{all:r&&(t.getChildrenItems().length>0?r:t.selected),any:i}};for(let t of this._rootItems())e(t)}_emitSelectionChange(){this.dispatchEvent(new c(this.getSelection()))}_itemFromEvent(t){let n=e(`tree-item`),r=t.composedPath();for(let e of r)if(e instanceof HTMLElement&&e.matches?.(n))return e;return null}_focusItem(e){let t=this._visibleItems();for(let e of t)e.tabIndex=-1;e.tabIndex=0,e.focus(),this._lastFocusedItem=e}render(){return i`
1
+ import{tagName as e}from"../../registry.js";import{i as t}from"../../chunks/lit.js";import{i as n,t as r}from"../../chunks/decorate.js";import{a as i}from"../../chunks/lit-html.js";import{LuxenElement as a}from"../../shared/luxen-element.js";import o from"../../shared/styles/host.styles.js";var s=t(`:host{--indent-size:1rem;--indent-guide-width:1px;--indent-guide-style:solid;--indent-guide-color:var(--l-color-border-interactive);--row-height:1.75rem;--row-padding-inline:.25rem;--chevron-size:1.125rem;--item-gap:.375rem;color:var(--l-color-text-primary);font-family:inherit;line-height:1.5;display:block}.tree{outline:none;display:block}.tree:focus-visible{outline:2px solid var(--l-focus-ring);outline-offset:2px;border-radius:.375rem}`),c=class extends Event{constructor(e){super(`selection-change`,{bubbles:!1,composed:!1,cancelable:!1}),this.selection=e}},l=class extends a{constructor(...t){super(...t),this._internals=this.attachInternals(),this._lastFocusedItem=null,this.#e=`single`,this.#t=!1,this._onItemToggle=e=>{this._selectItem(e.item,e.checked)},this._onClick=e=>{let t=this._itemFromEvent(e);if(!t||t.disabled)return;let n=e.composedPath();if(n.some(e=>e instanceof HTMLInputElement&&e.type===`checkbox`))return;let r=new Set([`BUTTON`,`A`,`INPUT`,`SELECT`,`TEXTAREA`]),i=new Set([`button`,`link`,`menuitem`,`menuitemcheckbox`]);if(n.some(e=>{if(!(e instanceof HTMLElement)||e===t||e.getAttribute?.(`part`)===`expand-button`||e instanceof HTMLInputElement&&e.type===`checkbox`)return!1;if(r.has(e.tagName))return!0;let n=e.getAttribute?.(`role`);return n!==null&&i.has(n)}))return;let a=n.some(e=>e instanceof HTMLElement&&e.getAttribute?.(`part`)===`expand-button`);if(this._focusItem(t),a){t.toggle();return}switch(this.selection){case`single`:this._setSingleSelection(t),t.isLeaf()||t.toggle();break;case`leaf`:t.isLeaf()?this._setSingleSelection(t):t.toggle();break;case`multiple`:this._selectItem(t,!t.selected);break;case`none`:t.toggle();break}},this._onFocusIn=t=>{let n=t.target;if(n instanceof HTMLElement){let t=n.closest(e(`tree-item`));t&&(this._lastFocusedItem=t)}},this._onKeyDown=t=>{let n=this._lastFocusedItem??this._visibleItems()[0];if(!n)return;let r=this._visibleItems(),i=r.indexOf(n);switch(t.key){case`ArrowDown`:{t.preventDefault();let e=r[Math.min(i+1,r.length-1)];e&&this._focusItem(e);break}case`ArrowUp`:{t.preventDefault();let e=r[Math.max(i-1,0)];e&&this._focusItem(e);break}case`ArrowRight`:if(t.preventDefault(),!n.isLeaf()&&!n.expanded)n.expanded=!0;else if(n.expanded){let e=n.getChildrenItems()[0];e&&this._focusItem(e)}break;case`ArrowLeft`:if(t.preventDefault(),n.expanded&&!n.isLeaf())n.expanded=!1;else{let t=n.parentElement?.closest(e(`tree-item`));t&&this._focusItem(t)}break;case`Home`:t.preventDefault(),r[0]&&this._focusItem(r[0]);break;case`End`:{t.preventDefault();let e=r[r.length-1];e&&this._focusItem(e);break}case`Enter`:case` `:t.preventDefault(),this._handleRowActivate(n);break;case`*`:{t.preventDefault();let r=(n.parentElement?Array.from(n.parentElement.children):[]).filter(t=>t.tagName===e(`tree-item`).toUpperCase());for(let e of r)e.isLeaf()||(e.expanded=!0);break}}}}static{this.styles=[o,s]}#e;get selection(){return this.#e}set selection(e){this.#e=e}#t;get independent(){return this.#t}set independent(e){this.#t=e}connectedCallback(){super.connectedCallback(),this._internals.role=`tree`,this.hasAttribute(`role`)||this.setAttribute(`role`,`tree`),this._mutationObserver=new MutationObserver(()=>this._syncAll()),this._mutationObserver.observe(this,{childList:!0,subtree:!0}),this.addEventListener(`selection-toggle`,this._onItemToggle),queueMicrotask(()=>this._syncAll())}disconnectedCallback(){super.disconnectedCallback(),this._mutationObserver?.disconnect(),this.removeEventListener(`selection-toggle`,this._onItemToggle)}updated(e){if(e.has(`selection`)){let e=this.selection===`multiple`?`true`:`false`;this._internals.ariaMultiSelectable=e,this.setAttribute(`aria-multiselectable`,e)}(e.has(`selection`)||e.has(`independent`))&&this._syncAll()}getAllItems({includeDisabled:t=!0}={}){let n=e(`tree-item`);return Array.from(this.querySelectorAll(n)).filter(e=>t||!e.disabled)}getSelection(){return this.getAllItems().filter(e=>e.selected)}expandAll(){for(let e of this.getAllItems())e.isLeaf()||(e.expanded=!0)}collapseAll(){for(let e of this.getAllItems())e.expanded=!1}_syncAll(){customElements.upgrade(this);let t=e(`tree-item`),n=this._rootItems();if(n.some(e=>typeof e.getChildrenItems!=`function`)){customElements.whenDefined(t).then(()=>this._syncAll());return}let r=this.selection===`multiple`;this._syncLevel(n,0,r),this._updateBranchStates(),this._ensureTabStop()}_syncLevel(e,t,n){let r=e.length;e.forEach((e,i)=>{e.depth=t,e.showCheckbox=n&&this._canShowCheckboxOn(e),e.setPosition(t+1,i+1,r),this._syncLevel(e.getChildrenItems(),t+1,n)})}_canShowCheckboxOn(e){return this.selection===`multiple`}_rootItems(){let t=e(`tree-item`).toUpperCase();return Array.from(this.children).filter(e=>e.tagName===t)}_ensureTabStop(){let e=this._visibleItems();if(e.length!==0&&!e.some(e=>e.tabIndex===0)){for(let t of e)t.tabIndex=-1;e[0].tabIndex=0}}_visibleItems(){let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&t(r.getChildrenItems())};return t(this._rootItems()),e}_handleRowActivate(e){if(!e.disabled)switch(this.selection){case`single`:this._setSingleSelection(e),e.isLeaf()||e.toggle();break;case`leaf`:e.isLeaf()?this._setSingleSelection(e):e.toggle();break;case`multiple`:this._selectItem(e,!e.selected);break;case`none`:e.toggle();break}}_setSingleSelection(e){for(let t of this.getAllItems())t!==e&&t.selected&&(t.selected=!1);e.selected=!0,this._emitSelectionChange()}_selectItem(e,t){e.disabled||(e.selected=t,this._cascades&&(this._setSubtreeSelection(e,t),e._setCascadeIndeterminate(!1)),this._updateBranchStates(),this._emitSelectionChange())}_setSubtreeSelection(e,t){for(let n of e.getChildrenItems())n.disabled||(n.selected=t,n._setCascadeIndeterminate(!1),this._setSubtreeSelection(n,t))}get _cascades(){return this.selection===`multiple`&&!this.independent}_updateBranchStates(){if(!this._cascades){for(let e of this.getAllItems())e._cascadeIndeterminate&&e._setCascadeIndeterminate(!1);return}let e=t=>{let n=t.getChildrenItems({includeDisabled:!1});if(n.length===0)return t._setCascadeIndeterminate(!1),{all:t.selected,any:t.selected};let r=!0,i=!1;for(let t of n){let n=e(t);n.all||(r=!1),n.any&&(i=!0)}return t.selected=r,t._setCascadeIndeterminate(!r&&i),{all:r&&(t.getChildrenItems().length>0?r:t.selected),any:i}};for(let t of this._rootItems())e(t)}_emitSelectionChange(){this.dispatchEvent(new c(this.getSelection()))}_itemFromEvent(t){let n=e(`tree-item`),r=t.composedPath();for(let e of r)if(e instanceof HTMLElement&&e.matches?.(n))return e;return null}_focusItem(e){let t=this._visibleItems();for(let e of t)e.tabIndex=-1;e.tabIndex=0,e.focus(),this._lastFocusedItem=e}render(){return i`
2
2
  <div
3
3
  class="tree"
4
4
  part="base"
@@ -1 +1 @@
1
- {"version":3,"file":"tree.js","names":[],"sources":["../../../src/html/elements/tree/tree.css?inline","../../../src/html/elements/tree/tree.ts"],"sourcesContent":[":host {\n --indent-size: 1rem;\n --indent-guide-width: 1px;\n --indent-guide-style: solid;\n --indent-guide-color: var(--l-color-border-interactive);\n --row-height: 1.75rem;\n --row-padding-inline: 0.25rem;\n --chevron-size: 1.125rem;\n --item-gap: 0.375rem;\n\n display: block;\n color: var(--l-color-text-primary);\n font-family: inherit;\n line-height: 1.5;\n}\n\n.tree {\n display: block;\n outline: none;\n}\n\n.tree:focus-visible {\n outline: 2px solid var(--l-focus-ring);\n outline-offset: 2px;\n border-radius: 0.375rem;\n}\n","import { html, unsafeCSS, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { LuxenElement } from '../../shared/luxen-element.js';\nimport { tagName } from '../../registry.js';\nimport type { TreeItem } from '../tree-item/tree-item.js';\nimport type { TreeItemSelectionToggleEvent } from '../tree-item/tree-item.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport rawStyles from './tree.css?inline';\n\nconst styles = unsafeCSS(rawStyles);\n\nexport type TreeSelection = 'single' | 'multiple' | 'leaf' | 'none';\n\n/** Fired when the tree's selected items change. */\nexport class SelectionChangeEvent extends Event {\n readonly selection: TreeItem[];\n constructor(selection: TreeItem[]) {\n super('selection-change', { bubbles: false, composed: false, cancelable: false });\n this.selection = selection;\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'selection-change': SelectionChangeEvent;\n }\n}\n\n/**\n * A hierarchical tree view composed of `<l-tree-item>` children.\n *\n * The host carries `role=\"tree\"`, so give it an accessible name with\n * `aria-label` or `aria-labelledby` (e.g. `<l-tree aria-label=\"Files\">`).\n *\n * @slot - One or more `l-tree-item` elements.\n *\n * @csspart base - The root tree container.\n *\n * @cssproperty --indent-size - Horizontal indent per depth level. Default `1rem`.\n * @cssproperty --indent-guide-width - Thickness of the vertical guide line between a parent and its children. Default `1px`. Set to `0` to hide guides.\n * @cssproperty --indent-guide-style - Line style of the guide (`solid`, `dashed`, `dotted`, `double`…). Default `solid`.\n * @cssproperty --indent-guide-color - Color of the guide line.\n * @cssproperty --row-height - Minimum row height. Default `1.75rem`.\n * @cssproperty --row-padding-inline - Inner inline padding of the row; also drives the content slot left indent and the indent guide column. Default `0.25rem`.\n * @cssproperty --chevron-size - Size of the expand/collapse chevron box. Default `1.125rem`.\n * @cssproperty --item-gap - Horizontal gap between chevron, prefix, label and suffix on the row; also drives the content slot left indent. Default `0.375rem`.\n *\n * @event selection-change - Fired when the selected items change. Properties: `selection: TreeItem[]`.\n *\n * @customElement l-tree\n */\nexport class Tree extends LuxenElement {\n static override styles = [hostStyles, styles];\n\n private _internals = this.attachInternals();\n private _mutationObserver?: MutationObserver;\n private _lastFocusedItem: TreeItem | null = null;\n\n /**\n * Selection behaviour:\n * - `single` (default): at most one item selected via `aria-selected`.\n * - `multiple`: any number of items selected. Checkboxes are rendered.\n * - `leaf`: only leaf items can be selected (single). Branches just toggle.\n * - `none`: purely navigable, no selection state.\n */\n @property({ reflect: true })\n accessor selection: TreeSelection = 'single';\n\n /**\n * When set with `selection=\"multiple\"`, parent and children selection are decoupled:\n * toggling a parent does NOT toggle its descendants and vice versa.\n * Without it, selection cascades both ways and branches may become indeterminate.\n */\n @property({ type: Boolean, reflect: true })\n accessor independent = false;\n\n override connectedCallback() {\n super.connectedCallback();\n this._internals.role = 'tree';\n // Mirror the role to a DOM attribute too. The ElementInternals role alone is\n // not `[role]`-selectable (CSS, querySelector, Cypress/Playwright CSS), which\n // silently breaks consumers migrating from libraries that expose an attribute\n // role. Respect an author-provided role if one is already set.\n if (!this.hasAttribute('role')) this.setAttribute('role', 'tree');\n this._mutationObserver = new MutationObserver(() => this._syncAll());\n this._mutationObserver.observe(this, { childList: true, subtree: true });\n this.addEventListener('selection-toggle', this._onItemToggle as EventListener);\n\n // Defer sync to let light DOM upgrade.\n queueMicrotask(() => this._syncAll());\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this._mutationObserver?.disconnect();\n this.removeEventListener('selection-toggle', this._onItemToggle as EventListener);\n }\n\n override updated(changed: PropertyValues<this>) {\n if (changed.has('selection')) {\n // Mirror to ElementInternals (a11y tree) and a content attribute, so\n // `[aria-multiselectable]` selectors keep matching — see tree-item `_aria`.\n const multiselectable = this.selection === 'multiple' ? 'true' : 'false';\n this._internals.ariaMultiSelectable = multiselectable;\n this.setAttribute('aria-multiselectable', multiselectable);\n }\n if (changed.has('selection') || changed.has('independent')) {\n this._syncAll();\n }\n }\n\n // --- Public API ---\n\n /** Returns all items in document (flat) order, including nested ones. */\n getAllItems({ includeDisabled = true } = {}): TreeItem[] {\n const tag = tagName('tree-item');\n return Array.from(this.querySelectorAll<TreeItem>(tag)).filter(\n (item) => includeDisabled || !item.disabled,\n );\n }\n\n /** Returns currently selected items. */\n getSelection(): TreeItem[] {\n return this.getAllItems().filter((i) => i.selected);\n }\n\n /** Expands every item that has children. */\n expandAll() {\n for (const item of this.getAllItems()) {\n if (!item.isLeaf()) item.expanded = true;\n }\n }\n\n /** Collapses every item. */\n collapseAll() {\n for (const item of this.getAllItems()) {\n item.expanded = false;\n }\n }\n\n // --- Sync / ARIA / depth / checkbox visibility ---\n\n private _syncAll() {\n // `_syncAll()` may run from `updated()` before `<l-tree-item>` is registered\n // (e.g. when the tree module is imported before tree-item, or in async chunks).\n // Force-upgrade any pending custom elements in our subtree, then bail and retry\n // once the registration completes if any item is still un-upgraded.\n customElements.upgrade(this);\n const itemTag = tagName('tree-item');\n const roots = this._rootItems();\n if (roots.some((r) => typeof r.getChildrenItems !== 'function')) {\n void customElements.whenDefined(itemTag).then(() => this._syncAll());\n return;\n }\n\n const showCheckbox = this.selection === 'multiple';\n this._syncLevel(roots, 0, showCheckbox);\n this._updateBranchStates();\n // Ensure at least one item is tabbable.\n this._ensureTabStop();\n }\n\n /**\n * Sync depth, checkbox visibility and ARIA position for a sibling group, then\n * recurse. `aria-level`/`aria-setsize`/`aria-posinset` let screen readers\n * announce \"level N, M of K\" — valuable here because `lazy` items mean the\n * full set isn't always in the DOM (see WAI-ARIA Tree View pattern).\n */\n private _syncLevel(items: TreeItem[], depth: number, showCheckbox: boolean) {\n const setSize = items.length;\n items.forEach((item, index) => {\n item.depth = depth;\n item.showCheckbox = showCheckbox && this._canShowCheckboxOn(item);\n item.setPosition(depth + 1, index + 1, setSize);\n this._syncLevel(item.getChildrenItems(), depth + 1, showCheckbox);\n });\n }\n\n private _canShowCheckboxOn(_item: TreeItem): boolean {\n if (this.selection !== 'multiple') return false;\n // In cascade mode, branches get a checkbox too so you can bulk-toggle children.\n // In leaf-only selection, hidden here because selection !== 'multiple'.\n return true;\n }\n\n private _rootItems(): TreeItem[] {\n const tag = tagName('tree-item').toUpperCase();\n return (Array.from(this.children) as TreeItem[]).filter((el) => el.tagName === tag);\n }\n\n private _ensureTabStop() {\n const items = this._visibleItems();\n if (items.length === 0) return;\n const hasTabStop = items.some((i) => i.tabIndex === 0);\n if (!hasTabStop) {\n for (const i of items) i.tabIndex = -1;\n items[0].tabIndex = 0;\n }\n }\n\n /** Items currently visible (parent chain all expanded). */\n private _visibleItems(): TreeItem[] {\n const out: TreeItem[] = [];\n const walk = (items: TreeItem[]) => {\n for (const i of items) {\n out.push(i);\n if (i.expanded) walk(i.getChildrenItems());\n }\n };\n walk(this._rootItems());\n return out;\n }\n\n // --- Selection handling ---\n\n private _onItemToggle = (event: TreeItemSelectionToggleEvent) => {\n this._selectItem(event.item, event.checked);\n };\n\n private _handleRowActivate(item: TreeItem) {\n if (item.disabled) return;\n\n switch (this.selection) {\n case 'single':\n this._setSingleSelection(item);\n // Mirror the row-click behaviour: activating a branch also toggles it,\n // so keyboard users expand lazy branches (and trigger their fetch) too.\n if (!item.isLeaf()) item.toggle();\n break;\n case 'leaf':\n if (item.isLeaf()) this._setSingleSelection(item);\n else item.toggle();\n break;\n case 'multiple':\n this._selectItem(item, !item.selected);\n break;\n case 'none':\n item.toggle();\n break;\n }\n }\n\n private _setSingleSelection(item: TreeItem) {\n for (const i of this.getAllItems()) {\n if (i !== item && i.selected) i.selected = false;\n }\n item.selected = true;\n this._emitSelectionChange();\n }\n\n private _selectItem(item: TreeItem, value: boolean) {\n if (item.disabled) return;\n item.selected = value;\n\n if (this.selection === 'multiple' && !this.independent) {\n // Cascade DOWN: toggling a branch toggles all descendants.\n this._setSubtreeSelection(item, value);\n }\n\n item.indeterminate = false;\n this._updateBranchStates();\n this._emitSelectionChange();\n }\n\n private _setSubtreeSelection(item: TreeItem, value: boolean) {\n for (const child of item.getChildrenItems()) {\n if (child.disabled) continue;\n child.selected = value;\n child.indeterminate = false;\n this._setSubtreeSelection(child, value);\n }\n }\n\n /** Propagate child state UP to parents (indeterminate / auto-checked). */\n private _updateBranchStates() {\n if (this.selection !== 'multiple' || this.independent) {\n // In independent or non-multiple modes, clear any indeterminate flags.\n for (const i of this.getAllItems()) i.indeterminate = false;\n return;\n }\n\n const recompute = (item: TreeItem): { all: boolean; any: boolean } => {\n const children = item.getChildrenItems({ includeDisabled: false });\n if (children.length === 0) {\n return { all: item.selected, any: item.selected };\n }\n\n let all = true;\n let any = false;\n for (const child of children) {\n const state = recompute(child);\n if (!state.all) all = false;\n if (state.any) any = true;\n }\n\n item.selected = all;\n item.indeterminate = !all && any;\n return { all: all && (item.getChildrenItems().length > 0 ? all : item.selected), any };\n };\n\n for (const root of this._rootItems()) recompute(root);\n }\n\n private _emitSelectionChange() {\n this.dispatchEvent(new SelectionChangeEvent(this.getSelection()));\n }\n\n // --- Keyboard / focus ---\n\n private _onClick = (event: MouseEvent) => {\n const item = this._itemFromEvent(event);\n if (!item || item.disabled) return;\n\n const path = event.composedPath();\n const onCheckbox = path.some((n) => n instanceof HTMLInputElement && n.type === 'checkbox');\n if (onCheckbox) return; // handled via change event\n\n // Clicks on consumer-provided interactive elements (buttons, links, form\n // controls, menu items…) must not toggle the row — the consumer owns that\n // interaction. Works regardless of which slot the element was placed in.\n const INTERACTIVE_TAGS = new Set(['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA']);\n const INTERACTIVE_ROLES = new Set(['button', 'link', 'menuitem', 'menuitemcheckbox']);\n const onInteractive = path.some((n) => {\n if (!(n instanceof HTMLElement) || n === item) return false;\n if (n.getAttribute?.('part') === 'expand-button') return false;\n if (n instanceof HTMLInputElement && n.type === 'checkbox') return false;\n if (INTERACTIVE_TAGS.has(n.tagName)) return true;\n const role = n.getAttribute?.('role');\n return role !== null && INTERACTIVE_ROLES.has(role);\n });\n if (onInteractive) return;\n\n const onExpand = path.some(\n (n) => n instanceof HTMLElement && n.getAttribute?.('part') === 'expand-button',\n );\n\n this._focusItem(item);\n\n if (onExpand) {\n item.toggle();\n return;\n }\n\n // Row click (label area): mode-dependent behaviour.\n switch (this.selection) {\n case 'single':\n this._setSingleSelection(item);\n if (!item.isLeaf()) item.toggle();\n break;\n case 'leaf':\n if (item.isLeaf()) this._setSingleSelection(item);\n else item.toggle();\n break;\n case 'multiple':\n // The whole row acts like a <label> for the checkbox: clicking anywhere\n // on it toggles selection. Use the chevron to expand/collapse branches.\n this._selectItem(item, !item.selected);\n break;\n case 'none':\n item.toggle();\n break;\n }\n };\n\n private _itemFromEvent(event: Event): TreeItem | null {\n const tag = tagName('tree-item');\n const path = event.composedPath();\n for (const node of path) {\n if (node instanceof HTMLElement && node.matches?.(tag)) {\n return node as TreeItem;\n }\n }\n return null;\n }\n\n private _focusItem(item: TreeItem) {\n const visible = this._visibleItems();\n for (const i of visible) i.tabIndex = -1;\n item.tabIndex = 0;\n item.focus();\n this._lastFocusedItem = item;\n }\n\n private _onFocusIn = (event: FocusEvent) => {\n const target = event.target;\n if (target instanceof HTMLElement) {\n const item = target.closest<TreeItem>(tagName('tree-item'));\n if (item) this._lastFocusedItem = item;\n }\n };\n\n private _onKeyDown = (event: KeyboardEvent) => {\n const current = this._lastFocusedItem ?? this._visibleItems()[0];\n if (!current) return;\n\n const visible = this._visibleItems();\n const index = visible.indexOf(current);\n\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault();\n const next = visible[Math.min(index + 1, visible.length - 1)];\n if (next) this._focusItem(next);\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n const prev = visible[Math.max(index - 1, 0)];\n if (prev) this._focusItem(prev);\n break;\n }\n case 'ArrowRight': {\n event.preventDefault();\n if (!current.isLeaf() && !current.expanded) {\n current.expanded = true;\n } else if (current.expanded) {\n const first = current.getChildrenItems()[0];\n if (first) this._focusItem(first);\n }\n break;\n }\n case 'ArrowLeft': {\n event.preventDefault();\n if (current.expanded && !current.isLeaf()) {\n current.expanded = false;\n } else {\n const parent = current.parentElement?.closest(tagName('tree-item')) as TreeItem | null;\n if (parent) this._focusItem(parent);\n }\n break;\n }\n case 'Home': {\n event.preventDefault();\n if (visible[0]) this._focusItem(visible[0]);\n break;\n }\n case 'End': {\n event.preventDefault();\n const last = visible[visible.length - 1];\n if (last) this._focusItem(last);\n break;\n }\n case 'Enter':\n case ' ': {\n event.preventDefault();\n this._handleRowActivate(current);\n break;\n }\n case '*': {\n event.preventDefault();\n // Expand all siblings of the current item.\n const siblings = (\n current.parentElement ? (Array.from(current.parentElement.children) as TreeItem[]) : []\n ).filter((el) => el.tagName === tagName('tree-item').toUpperCase());\n for (const sib of siblings) {\n if (!sib.isLeaf()) sib.expanded = true;\n }\n break;\n }\n }\n };\n\n override render() {\n return html`\n <div\n class=\"tree\"\n part=\"base\"\n @click=${this._onClick}\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AW;;;;KAKjC,CACF,KA1ZG,EAAS,CAAE,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,YAAA,IAAA,KAQ1B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,cAAA,IAAA"}
1
+ {"version":3,"file":"tree.js","names":[],"sources":["../../../src/html/elements/tree/tree.css?inline","../../../src/html/elements/tree/tree.ts"],"sourcesContent":[":host {\n --indent-size: 1rem;\n --indent-guide-width: 1px;\n --indent-guide-style: solid;\n --indent-guide-color: var(--l-color-border-interactive);\n --row-height: 1.75rem;\n --row-padding-inline: 0.25rem;\n --chevron-size: 1.125rem;\n --item-gap: 0.375rem;\n\n display: block;\n color: var(--l-color-text-primary);\n font-family: inherit;\n line-height: 1.5;\n}\n\n.tree {\n display: block;\n outline: none;\n}\n\n.tree:focus-visible {\n outline: 2px solid var(--l-focus-ring);\n outline-offset: 2px;\n border-radius: 0.375rem;\n}\n","import { html, unsafeCSS, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { LuxenElement } from '../../shared/luxen-element.js';\nimport { tagName } from '../../registry.js';\nimport type { TreeItem } from '../tree-item/tree-item.js';\nimport type { TreeItemSelectionToggleEvent } from '../tree-item/tree-item.js';\nimport hostStyles from '../../shared/styles/host.styles.js';\nimport rawStyles from './tree.css?inline';\n\nconst styles = unsafeCSS(rawStyles);\n\nexport type TreeSelection = 'single' | 'multiple' | 'leaf' | 'none';\n\n/** Fired when the tree's selected items change. */\nexport class SelectionChangeEvent extends Event {\n readonly selection: TreeItem[];\n constructor(selection: TreeItem[]) {\n super('selection-change', { bubbles: false, composed: false, cancelable: false });\n this.selection = selection;\n }\n}\n\ndeclare global {\n interface GlobalEventHandlersEventMap {\n 'selection-change': SelectionChangeEvent;\n }\n}\n\n/**\n * A hierarchical tree view composed of `<l-tree-item>` children.\n *\n * The host carries `role=\"tree\"`, so give it an accessible name with\n * `aria-label` or `aria-labelledby` (e.g. `<l-tree aria-label=\"Files\">`).\n *\n * @slot - One or more `l-tree-item` elements.\n *\n * @csspart base - The root tree container.\n *\n * @cssproperty --indent-size - Horizontal indent per depth level. Default `1rem`.\n * @cssproperty --indent-guide-width - Thickness of the vertical guide line between a parent and its children. Default `1px`. Set to `0` to hide guides.\n * @cssproperty --indent-guide-style - Line style of the guide (`solid`, `dashed`, `dotted`, `double`…). Default `solid`.\n * @cssproperty --indent-guide-color - Color of the guide line.\n * @cssproperty --row-height - Minimum row height. Default `1.75rem`.\n * @cssproperty --row-padding-inline - Inner inline padding of the row; also drives the content slot left indent and the indent guide column. Default `0.25rem`.\n * @cssproperty --chevron-size - Size of the expand/collapse chevron box. Default `1.125rem`.\n * @cssproperty --item-gap - Horizontal gap between chevron, prefix, label and suffix on the row; also drives the content slot left indent. Default `0.375rem`.\n *\n * @event selection-change - Fired when the selected items change. Properties: `selection: TreeItem[]`.\n *\n * @customElement l-tree\n */\nexport class Tree extends LuxenElement {\n static override styles = [hostStyles, styles];\n\n private _internals = this.attachInternals();\n private _mutationObserver?: MutationObserver;\n private _lastFocusedItem: TreeItem | null = null;\n\n /**\n * Selection behaviour:\n * - `single` (default): at most one item selected via `aria-selected`.\n * - `multiple`: any number of items selected. Checkboxes are rendered.\n * - `leaf`: only leaf items can be selected (single). Branches just toggle.\n * - `none`: purely navigable, no selection state.\n */\n @property({ reflect: true })\n accessor selection: TreeSelection = 'single';\n\n /**\n * When set with `selection=\"multiple\"`, parent and children selection are decoupled:\n * toggling a parent does NOT toggle its descendants and vice versa.\n * Without it, selection cascades both ways and branches may become indeterminate.\n *\n * In independent mode the tree never writes `indeterminate`: the consumer owns\n * it (e.g. to show a partial state computed from rows not in the DOM). On\n * leaving the cascade, the tree clears only the flags its cascade wrote.\n */\n @property({ type: Boolean, reflect: true })\n accessor independent = false;\n\n override connectedCallback() {\n super.connectedCallback();\n this._internals.role = 'tree';\n // Mirror the role to a DOM attribute too. The ElementInternals role alone is\n // not `[role]`-selectable (CSS, querySelector, Cypress/Playwright CSS), which\n // silently breaks consumers migrating from libraries that expose an attribute\n // role. Respect an author-provided role if one is already set.\n if (!this.hasAttribute('role')) this.setAttribute('role', 'tree');\n this._mutationObserver = new MutationObserver(() => this._syncAll());\n this._mutationObserver.observe(this, { childList: true, subtree: true });\n this.addEventListener('selection-toggle', this._onItemToggle as EventListener);\n\n // Defer sync to let light DOM upgrade.\n queueMicrotask(() => this._syncAll());\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this._mutationObserver?.disconnect();\n this.removeEventListener('selection-toggle', this._onItemToggle as EventListener);\n }\n\n override updated(changed: PropertyValues<this>) {\n if (changed.has('selection')) {\n // Mirror to ElementInternals (a11y tree) and a content attribute, so\n // `[aria-multiselectable]` selectors keep matching — see tree-item `_aria`.\n const multiselectable = this.selection === 'multiple' ? 'true' : 'false';\n this._internals.ariaMultiSelectable = multiselectable;\n this.setAttribute('aria-multiselectable', multiselectable);\n }\n if (changed.has('selection') || changed.has('independent')) {\n this._syncAll();\n }\n }\n\n // --- Public API ---\n\n /** Returns all items in document (flat) order, including nested ones. */\n getAllItems({ includeDisabled = true } = {}): TreeItem[] {\n const tag = tagName('tree-item');\n return Array.from(this.querySelectorAll<TreeItem>(tag)).filter(\n (item) => includeDisabled || !item.disabled,\n );\n }\n\n /** Returns currently selected items. */\n getSelection(): TreeItem[] {\n return this.getAllItems().filter((i) => i.selected);\n }\n\n /** Expands every item that has children. */\n expandAll() {\n for (const item of this.getAllItems()) {\n if (!item.isLeaf()) item.expanded = true;\n }\n }\n\n /** Collapses every item. */\n collapseAll() {\n for (const item of this.getAllItems()) {\n item.expanded = false;\n }\n }\n\n // --- Sync / ARIA / depth / checkbox visibility ---\n\n private _syncAll() {\n // `_syncAll()` may run from `updated()` before `<l-tree-item>` is registered\n // (e.g. when the tree module is imported before tree-item, or in async chunks).\n // Force-upgrade any pending custom elements in our subtree, then bail and retry\n // once the registration completes if any item is still un-upgraded.\n customElements.upgrade(this);\n const itemTag = tagName('tree-item');\n const roots = this._rootItems();\n if (roots.some((r) => typeof r.getChildrenItems !== 'function')) {\n void customElements.whenDefined(itemTag).then(() => this._syncAll());\n return;\n }\n\n const showCheckbox = this.selection === 'multiple';\n this._syncLevel(roots, 0, showCheckbox);\n this._updateBranchStates();\n // Ensure at least one item is tabbable.\n this._ensureTabStop();\n }\n\n /**\n * Sync depth, checkbox visibility and ARIA position for a sibling group, then\n * recurse. `aria-level`/`aria-setsize`/`aria-posinset` let screen readers\n * announce \"level N, M of K\" — valuable here because `lazy` items mean the\n * full set isn't always in the DOM (see WAI-ARIA Tree View pattern).\n */\n private _syncLevel(items: TreeItem[], depth: number, showCheckbox: boolean) {\n const setSize = items.length;\n items.forEach((item, index) => {\n item.depth = depth;\n item.showCheckbox = showCheckbox && this._canShowCheckboxOn(item);\n item.setPosition(depth + 1, index + 1, setSize);\n this._syncLevel(item.getChildrenItems(), depth + 1, showCheckbox);\n });\n }\n\n private _canShowCheckboxOn(_item: TreeItem): boolean {\n if (this.selection !== 'multiple') return false;\n // In cascade mode, branches get a checkbox too so you can bulk-toggle children.\n // In leaf-only selection, hidden here because selection !== 'multiple'.\n return true;\n }\n\n private _rootItems(): TreeItem[] {\n const tag = tagName('tree-item').toUpperCase();\n return (Array.from(this.children) as TreeItem[]).filter((el) => el.tagName === tag);\n }\n\n private _ensureTabStop() {\n const items = this._visibleItems();\n if (items.length === 0) return;\n const hasTabStop = items.some((i) => i.tabIndex === 0);\n if (!hasTabStop) {\n for (const i of items) i.tabIndex = -1;\n items[0].tabIndex = 0;\n }\n }\n\n /** Items currently visible (parent chain all expanded). */\n private _visibleItems(): TreeItem[] {\n const out: TreeItem[] = [];\n const walk = (items: TreeItem[]) => {\n for (const i of items) {\n out.push(i);\n if (i.expanded) walk(i.getChildrenItems());\n }\n };\n walk(this._rootItems());\n return out;\n }\n\n // --- Selection handling ---\n\n private _onItemToggle = (event: TreeItemSelectionToggleEvent) => {\n this._selectItem(event.item, event.checked);\n };\n\n private _handleRowActivate(item: TreeItem) {\n if (item.disabled) return;\n\n switch (this.selection) {\n case 'single':\n this._setSingleSelection(item);\n // Mirror the row-click behaviour: activating a branch also toggles it,\n // so keyboard users expand lazy branches (and trigger their fetch) too.\n if (!item.isLeaf()) item.toggle();\n break;\n case 'leaf':\n if (item.isLeaf()) this._setSingleSelection(item);\n else item.toggle();\n break;\n case 'multiple':\n this._selectItem(item, !item.selected);\n break;\n case 'none':\n item.toggle();\n break;\n }\n }\n\n private _setSingleSelection(item: TreeItem) {\n for (const i of this.getAllItems()) {\n if (i !== item && i.selected) i.selected = false;\n }\n item.selected = true;\n this._emitSelectionChange();\n }\n\n private _selectItem(item: TreeItem, value: boolean) {\n if (item.disabled) return;\n item.selected = value;\n\n if (this._cascades) {\n // Cascade DOWN: toggling a branch toggles all descendants.\n this._setSubtreeSelection(item, value);\n item._setCascadeIndeterminate(false);\n }\n\n this._updateBranchStates();\n this._emitSelectionChange();\n }\n\n private _setSubtreeSelection(item: TreeItem, value: boolean) {\n for (const child of item.getChildrenItems()) {\n if (child.disabled) continue;\n child.selected = value;\n child._setCascadeIndeterminate(false);\n this._setSubtreeSelection(child, value);\n }\n }\n\n /** Whether selection cascades between parents and children. */\n private get _cascades(): boolean {\n return this.selection === 'multiple' && !this.independent;\n }\n\n /** Propagate child state UP to parents (indeterminate / auto-checked). */\n private _updateBranchStates() {\n if (!this._cascades) {\n // Outside the cascade the tree does not own `indeterminate` (the consumer\n // drives it in independent mode): only clear the flags the cascade wrote,\n // so a value the consumer set — even in the same tick as the mode switch —\n // survives.\n for (const i of this.getAllItems()) {\n if (i._cascadeIndeterminate) i._setCascadeIndeterminate(false);\n }\n return;\n }\n\n const recompute = (item: TreeItem): { all: boolean; any: boolean } => {\n const children = item.getChildrenItems({ includeDisabled: false });\n if (children.length === 0) {\n // A leaf (or a branch with only disabled children) has no partial state;\n // drop any flag the consumer left from independent mode.\n item._setCascadeIndeterminate(false);\n return { all: item.selected, any: item.selected };\n }\n\n let all = true;\n let any = false;\n for (const child of children) {\n const state = recompute(child);\n if (!state.all) all = false;\n if (state.any) any = true;\n }\n\n item.selected = all;\n item._setCascadeIndeterminate(!all && any);\n return { all: all && (item.getChildrenItems().length > 0 ? all : item.selected), any };\n };\n\n for (const root of this._rootItems()) recompute(root);\n }\n\n private _emitSelectionChange() {\n this.dispatchEvent(new SelectionChangeEvent(this.getSelection()));\n }\n\n // --- Keyboard / focus ---\n\n private _onClick = (event: MouseEvent) => {\n const item = this._itemFromEvent(event);\n if (!item || item.disabled) return;\n\n const path = event.composedPath();\n const onCheckbox = path.some((n) => n instanceof HTMLInputElement && n.type === 'checkbox');\n if (onCheckbox) return; // handled via change event\n\n // Clicks on consumer-provided interactive elements (buttons, links, form\n // controls, menu items…) must not toggle the row — the consumer owns that\n // interaction. Works regardless of which slot the element was placed in.\n const INTERACTIVE_TAGS = new Set(['BUTTON', 'A', 'INPUT', 'SELECT', 'TEXTAREA']);\n const INTERACTIVE_ROLES = new Set(['button', 'link', 'menuitem', 'menuitemcheckbox']);\n const onInteractive = path.some((n) => {\n if (!(n instanceof HTMLElement) || n === item) return false;\n if (n.getAttribute?.('part') === 'expand-button') return false;\n if (n instanceof HTMLInputElement && n.type === 'checkbox') return false;\n if (INTERACTIVE_TAGS.has(n.tagName)) return true;\n const role = n.getAttribute?.('role');\n return role !== null && INTERACTIVE_ROLES.has(role);\n });\n if (onInteractive) return;\n\n const onExpand = path.some(\n (n) => n instanceof HTMLElement && n.getAttribute?.('part') === 'expand-button',\n );\n\n this._focusItem(item);\n\n if (onExpand) {\n item.toggle();\n return;\n }\n\n // Row click (label area): mode-dependent behaviour.\n switch (this.selection) {\n case 'single':\n this._setSingleSelection(item);\n if (!item.isLeaf()) item.toggle();\n break;\n case 'leaf':\n if (item.isLeaf()) this._setSingleSelection(item);\n else item.toggle();\n break;\n case 'multiple':\n // The whole row acts like a <label> for the checkbox: clicking anywhere\n // on it toggles selection. Use the chevron to expand/collapse branches.\n this._selectItem(item, !item.selected);\n break;\n case 'none':\n item.toggle();\n break;\n }\n };\n\n private _itemFromEvent(event: Event): TreeItem | null {\n const tag = tagName('tree-item');\n const path = event.composedPath();\n for (const node of path) {\n if (node instanceof HTMLElement && node.matches?.(tag)) {\n return node as TreeItem;\n }\n }\n return null;\n }\n\n private _focusItem(item: TreeItem) {\n const visible = this._visibleItems();\n for (const i of visible) i.tabIndex = -1;\n item.tabIndex = 0;\n item.focus();\n this._lastFocusedItem = item;\n }\n\n private _onFocusIn = (event: FocusEvent) => {\n const target = event.target;\n if (target instanceof HTMLElement) {\n const item = target.closest<TreeItem>(tagName('tree-item'));\n if (item) this._lastFocusedItem = item;\n }\n };\n\n private _onKeyDown = (event: KeyboardEvent) => {\n const current = this._lastFocusedItem ?? this._visibleItems()[0];\n if (!current) return;\n\n const visible = this._visibleItems();\n const index = visible.indexOf(current);\n\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault();\n const next = visible[Math.min(index + 1, visible.length - 1)];\n if (next) this._focusItem(next);\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n const prev = visible[Math.max(index - 1, 0)];\n if (prev) this._focusItem(prev);\n break;\n }\n case 'ArrowRight': {\n event.preventDefault();\n if (!current.isLeaf() && !current.expanded) {\n current.expanded = true;\n } else if (current.expanded) {\n const first = current.getChildrenItems()[0];\n if (first) this._focusItem(first);\n }\n break;\n }\n case 'ArrowLeft': {\n event.preventDefault();\n if (current.expanded && !current.isLeaf()) {\n current.expanded = false;\n } else {\n const parent = current.parentElement?.closest(tagName('tree-item')) as TreeItem | null;\n if (parent) this._focusItem(parent);\n }\n break;\n }\n case 'Home': {\n event.preventDefault();\n if (visible[0]) this._focusItem(visible[0]);\n break;\n }\n case 'End': {\n event.preventDefault();\n const last = visible[visible.length - 1];\n if (last) this._focusItem(last);\n break;\n }\n case 'Enter':\n case ' ': {\n event.preventDefault();\n this._handleRowActivate(current);\n break;\n }\n case '*': {\n event.preventDefault();\n // Expand all siblings of the current item.\n const siblings = (\n current.parentElement ? (Array.from(current.parentElement.children) as TreeItem[]) : []\n ).filter((el) => el.tagName === tagName('tree-item').toUpperCase());\n for (const sib of siblings) {\n if (!sib.isLeaf()) sib.expanded = true;\n }\n break;\n }\n }\n };\n\n override render() {\n return html`\n <div\n class=\"tree\"\n part=\"base\"\n @click=${this._onClick}\n @keydown=${this._onKeyDown}\n @focusin=${this._onFocusIn}\n >\n <slot></slot>\n </div>\n `;\n }\n}\n"],"mappings":"oSCSA,IAAM,EAAS,EAAU,0bAAS,EAKrB,EAAb,cAA0C,KAAM,CAE9C,YAAY,EAAuB,CACjC,MAAM,mBAAoB,CAAE,QAAS,GAAO,SAAU,GAAO,WAAY,EAAM,CAAC,EAChF,KAAK,UAAY,CACnB,CACF,EA+Ba,EAAb,cAA0B,CAAa,+CAGhB,KAAK,gBAAgB,wBAEE,aAUR,iBAYb,sBA6IE,GAAwC,CAC/D,KAAK,YAAY,EAAM,KAAM,EAAM,OAAO,CAC5C,gBAyGoB,GAAsB,CACxC,IAAM,EAAO,KAAK,eAAe,CAAK,EACtC,GAAI,CAAC,GAAQ,EAAK,SAAU,OAE5B,IAAM,EAAO,EAAM,aAAa,EAEhC,GADmB,EAAK,KAAM,GAAM,aAAa,kBAAoB,EAAE,OAAS,UAC5E,EAAY,OAKhB,IAAM,EAAmB,IAAI,IAAI,CAAC,SAAU,IAAK,QAAS,SAAU,UAAU,CAAC,EACzE,EAAoB,IAAI,IAAI,CAAC,SAAU,OAAQ,WAAY,kBAAkB,CAAC,EASpF,GARsB,EAAK,KAAM,GAAM,CAGrC,GAFI,EAAE,aAAa,cAAgB,IAAM,GACrC,EAAE,eAAe,MAAM,IAAM,iBAC7B,aAAa,kBAAoB,EAAE,OAAS,WAAY,MAAO,GACnE,GAAI,EAAiB,IAAI,EAAE,OAAO,EAAG,MAAO,GAC5C,IAAM,EAAO,EAAE,eAAe,MAAM,EACpC,OAAO,IAAS,MAAQ,EAAkB,IAAI,CAAI,CACpD,CACI,EAAe,OAEnB,IAAM,EAA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e,EAAK,UAAU,CAAG,EACnD,OAAO,EAGX,OAAO,IACT,CAEA,WAAmB,EAAgB,CACjC,IAAM,EAAU,KAAK,cAAc,EACnC,IAAK,IAAM,KAAK,EAAS,EAAE,SAAW,GACtC,EAAK,SAAW,EAChB,EAAK,MAAM,EACX,KAAK,iBAAmB,CAC1B,CAiFA,QAAkB,CAChB,MAAO,EAAI;;;;iBAIE,KAAK,SAAS;mBACZ,KAAK,WAAW;mBAChB,KAAK,WAAW;;;;KAKjC,CACF,KA3aG,EAAS,CAAE,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,YAAA,IAAA,KAY1B,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,CAAA,EAAA,EAAA,UAAA,cAAA,IAAA"}
@@ -65,8 +65,23 @@ export declare class TreeItem extends LuxenElement {
65
65
  accessor expanded: boolean;
66
66
  /** Whether the item is selected. */
67
67
  accessor selected: boolean;
68
- /** Whether the checkbox is indeterminate (some descendants selected). */
69
- accessor indeterminate: boolean;
68
+ /**
69
+ * Whether the checkbox is indeterminate (some descendants selected). Managed by
70
+ * `<l-tree>` in cascade mode; set it yourself with `independent`.
71
+ * @default false
72
+ */
73
+ get indeterminate(): boolean;
74
+ set indeterminate(value: boolean);
75
+ private _indeterminate;
76
+ /**
77
+ * Whether the current `indeterminate` was written by `<l-tree>`'s cascade, so
78
+ * the tree can clear its own flags on leaving the cascade without touching the
79
+ * consumer's.
80
+ * @internal
81
+ */
82
+ _cascadeIndeterminate: boolean;
83
+ /** @internal Set by `<l-tree>`'s cascade. */
84
+ _setCascadeIndeterminate(value: boolean): void;
70
85
  /** Whether the item is disabled. */
71
86
  accessor disabled: boolean;
72
87
  /** Marks this item as having children that will be loaded on first expand. */