@melodicdev/components 1.0.12 → 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,21 +18622,17 @@ var DialogService = class DialogService$1 {
18622
18622
  return dialogElements.dialogRef;
18623
18623
  }
18624
18624
  findDialogElement(dialogID) {
18625
- const allDialogs = document.querySelectorAll("ml-dialog");
18626
- for (const dialog of allDialogs) if (dialog.hasAttribute(`#${dialogID}`)) return dialog;
18627
- 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;
18628
18630
  }
18629
18631
  deepFindDialog(root, dialogID) {
18630
18632
  const shadowRoot = root.shadowRoot;
18631
- if (shadowRoot) {
18632
- const match = shadowRoot.querySelector(`ml-dialog[\\#${dialogID}]`);
18633
- if (match) return match;
18634
- for (const child of shadowRoot.querySelectorAll("*")) {
18635
- const result = this.deepFindDialog(child, dialogID);
18636
- if (result) return result;
18637
- }
18638
- }
18639
- for (const child of root.querySelectorAll("*")) if (child.shadowRoot) {
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) {
18640
18636
  const result = this.deepFindDialog(child, dialogID);
18641
18637
  if (result) return result;
18642
18638
  }
@@ -18667,10 +18663,16 @@ var DialogComponent = class DialogComponent$1 {
18667
18663
  this._dialogID = newID();
18668
18664
  this._registered = false;
18669
18665
  }
18666
+ onCreate() {
18667
+ this.registerDialog();
18668
+ }
18670
18669
  registerDialog() {
18671
18670
  if (this._registered) return;
18672
18671
  const dialogEl = this.elementRef.shadowRoot?.querySelector("dialog");
18673
- 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
+ }
18674
18676
  this._dialogEl = dialogEl;
18675
18677
  this._dialogID = this.createDialogID();
18676
18678
  this._dialogEl.id = this._dialogID;