@melodicdev/components 1.0.13 → 1.0.14

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.
@@ -18622,16 +18622,19 @@ var DialogService = class DialogService$1 {
18622
18622
  return dialogElements.dialogRef;
18623
18623
  }
18624
18624
  findDialogElement(dialogID) {
18625
- return this.deepFindDialog(document.body, dialogID);
18625
+ for (const child of document.body.querySelectorAll("*")) if (child.shadowRoot) {
18626
+ const result = this.deepFindDialog(child, dialogID);
18627
+ if (result) return result;
18628
+ }
18629
+ return null;
18626
18630
  }
18627
18631
  deepFindDialog(root, dialogID) {
18628
18632
  const shadowRoot = root.shadowRoot;
18629
- if (shadowRoot) {
18630
- for (const el of shadowRoot.querySelectorAll("ml-dialog")) if (el.hasAttribute(`#${dialogID}`)) return el;
18631
- for (const child of shadowRoot.querySelectorAll("*")) if (child.shadowRoot) {
18632
- const result = this.deepFindDialog(child, dialogID);
18633
- if (result) return result;
18634
- }
18633
+ if (!shadowRoot) return null;
18634
+ for (const el of shadowRoot.querySelectorAll("ml-dialog")) if (el.hasAttribute(`#${dialogID}`)) return el;
18635
+ for (const child of shadowRoot.querySelectorAll("*")) if (child.shadowRoot) {
18636
+ const result = this.deepFindDialog(child, dialogID);
18637
+ if (result) return result;
18635
18638
  }
18636
18639
  return null;
18637
18640
  }
@@ -18660,10 +18663,16 @@ var DialogComponent = class DialogComponent$1 {
18660
18663
  this._dialogID = newID();
18661
18664
  this._registered = false;
18662
18665
  }
18666
+ onCreate() {
18667
+ this.registerDialog();
18668
+ }
18663
18669
  registerDialog() {
18664
18670
  if (this._registered) return;
18665
18671
  const dialogEl = this.elementRef.shadowRoot?.querySelector("dialog");
18666
- if (!dialogEl) return;
18672
+ if (!dialogEl) {
18673
+ console.warn(`[ml-dialog] registerDialog failed: <dialog> not found in shadow root for #${this.createDialogID()}. elementRef:`, this.elementRef, "shadowRoot:", this.elementRef.shadowRoot, "shadowRoot children:", this.elementRef.shadowRoot?.children);
18674
+ return;
18675
+ }
18667
18676
  this._dialogEl = dialogEl;
18668
18677
  this._dialogID = this.createDialogID();
18669
18678
  this._dialogEl.id = this._dialogID;