@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.
@@ -16774,16 +16774,19 @@ var Bi = class {
16774
16774
  return a.dialogRef.open(), a.dialogRef;
16775
16775
  }
16776
16776
  findDialogElement(t) {
16777
- return this.deepFindDialog(document.body, t);
16777
+ for (const r of document.body.querySelectorAll("*")) if (r.shadowRoot) {
16778
+ const l = this.deepFindDialog(r, t);
16779
+ if (l) return l;
16780
+ }
16781
+ return null;
16778
16782
  }
16779
16783
  deepFindDialog(t, r) {
16780
16784
  const l = t.shadowRoot;
16781
- if (l) {
16782
- for (const a of l.querySelectorAll("ml-dialog")) if (a.hasAttribute(`#${r}`)) return a;
16783
- for (const a of l.querySelectorAll("*")) if (a.shadowRoot) {
16784
- const o = this.deepFindDialog(a, r);
16785
- if (o) return o;
16786
- }
16785
+ if (!l) return null;
16786
+ for (const a of l.querySelectorAll("ml-dialog")) if (a.hasAttribute(`#${r}`)) return a;
16787
+ for (const a of l.querySelectorAll("*")) if (a.shadowRoot) {
16788
+ const o = this.deepFindDialog(a, r);
16789
+ if (o) return o;
16787
16790
  }
16788
16791
  return null;
16789
16792
  }
@@ -16806,10 +16809,17 @@ var nr, Re = class {
16806
16809
  constructor() {
16807
16810
  this._dialogID = Zl(), this._registered = !1;
16808
16811
  }
16812
+ onCreate() {
16813
+ this.registerDialog();
16814
+ }
16809
16815
  registerDialog() {
16810
16816
  if (this._registered) return;
16811
16817
  const t = this.elementRef.shadowRoot?.querySelector("dialog");
16812
- t && (this._dialogEl = t, this._dialogID = this.createDialogID(), this._dialogEl.id = this._dialogID, this._dialogRef = this._dialogService.addDialog(this._dialogID, this._dialogEl), this._registered = !0);
16818
+ if (!t) {
16819
+ 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);
16820
+ return;
16821
+ }
16822
+ this._dialogEl = t, this._dialogID = this.createDialogID(), this._dialogEl.id = this._dialogID, this._dialogRef = this._dialogService.addDialog(this._dialogID, this._dialogEl), this._registered = !0;
16813
16823
  }
16814
16824
  onDestroy() {
16815
16825
  this._dialogService.removeDialog(this._dialogID);
@@ -1,11 +1,12 @@
1
- import type { OnDestroy, IElementRef } from '@melodicdev/core';
2
- export declare class DialogComponent implements IElementRef, OnDestroy {
1
+ import type { OnCreate, OnDestroy, IElementRef } from '@melodicdev/core';
2
+ export declare class DialogComponent implements IElementRef, OnCreate, OnDestroy {
3
3
  elementRef: HTMLElement;
4
4
  private readonly _dialogService;
5
5
  private _dialogID;
6
6
  private _dialogEl;
7
7
  private _dialogRef;
8
8
  private _registered;
9
+ onCreate(): void;
9
10
  private registerDialog;
10
11
  onDestroy(): void;
11
12
  open(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog.component.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAK/D,qBAMa,eAAgB,YAAW,WAAW,EAAE,SAAS;IACtD,UAAU,EAAG,WAAW,CAAC;IAGhC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAEhD,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,cAAc;IAatB,SAAS,IAAI,IAAI;IAIjB,IAAI,IAAI,IAAI;IAKZ,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI;IAIpC,OAAO,CAAC,cAAc;CAQtB"}
1
+ {"version":3,"file":"dialog.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog.component.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAKzE,qBAMa,eAAgB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IAChE,UAAU,EAAG,WAAW,CAAC;IAGhC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAEhD,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,WAAW,CAAS;IAE5B,QAAQ,IAAI,IAAI;IAIhB,OAAO,CAAC,cAAc;IAgBtB,SAAS,IAAI,IAAI;IAIjB,IAAI,IAAI,IAAI;IAKZ,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI;IAIpC,OAAO,CAAC,cAAc;CAQtB"}
@@ -17,12 +17,17 @@ let DialogComponent = class DialogComponent {
17
17
  this._dialogID = newID();
18
18
  this._registered = false;
19
19
  }
20
+ onCreate() {
21
+ this.registerDialog();
22
+ }
20
23
  registerDialog() {
21
24
  if (this._registered)
22
25
  return;
23
26
  const dialogEl = this.elementRef.shadowRoot?.querySelector('dialog');
24
- if (!dialogEl)
27
+ if (!dialogEl) {
28
+ 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);
25
29
  return;
30
+ }
26
31
  this._dialogEl = dialogEl;
27
32
  this._dialogID = this.createDialogID();
28
33
  this._dialogEl.id = this._dialogID;
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.service.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,S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AQ,EAAE,QAAQ,EAAE,iBAAiB,GAAG,SAAS;IAerE,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAItC,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO,EAAE,eAAe,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC;IAChJ,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC;IA4CvF,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,cAAc;IAoBtB,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI;IAOxD,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,aAAa;CAGrB"}
@@ -57,22 +57,30 @@ let DialogService = class DialogService {
57
57
  return dialogElements.dialogRef;
58
58
  }
59
59
  findDialogElement(dialogID) {
60
- return this.deepFindDialog(document.body, dialogID);
60
+ // Traverse all shadow roots starting from document.body's children
61
+ for (const child of document.body.querySelectorAll('*')) {
62
+ if (child.shadowRoot) {
63
+ const result = this.deepFindDialog(child, dialogID);
64
+ if (result)
65
+ return result;
66
+ }
67
+ }
68
+ return null;
61
69
  }
62
70
  deepFindDialog(root, dialogID) {
63
71
  const shadowRoot = root.shadowRoot;
64
- if (shadowRoot) {
65
- for (const el of shadowRoot.querySelectorAll('ml-dialog')) {
66
- if (el.hasAttribute(`#${dialogID}`)) {
67
- return el;
68
- }
72
+ if (!shadowRoot)
73
+ return null;
74
+ for (const el of shadowRoot.querySelectorAll('ml-dialog')) {
75
+ if (el.hasAttribute(`#${dialogID}`)) {
76
+ return el;
69
77
  }
70
- for (const child of shadowRoot.querySelectorAll('*')) {
71
- if (child.shadowRoot) {
72
- const result = this.deepFindDialog(child, dialogID);
73
- if (result)
74
- return result;
75
- }
78
+ }
79
+ for (const child of shadowRoot.querySelectorAll('*')) {
80
+ if (child.shadowRoot) {
81
+ const result = this.deepFindDialog(child, dialogID);
82
+ if (result)
83
+ return result;
76
84
  }
77
85
  }
78
86
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melodicdev/components",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Themeable UI component library built on the Melodic Framework",
5
5
  "license": "MIT",
6
6
  "author": "Melodic Development",