@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.
- package/assets/melodic-components.js +15 -13
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +16 -13
- package/lib/components/overlays/dialog/dialog.component.d.ts +3 -2
- package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.component.js +6 -1
- package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.service.js +13 -16
- package/package.json +1 -1
|
@@ -16774,21 +16774,17 @@ var Bi = class {
|
|
|
16774
16774
|
return a.dialogRef.open(), a.dialogRef;
|
|
16775
16775
|
}
|
|
16776
16776
|
findDialogElement(t) {
|
|
16777
|
-
const r
|
|
16778
|
-
|
|
16779
|
-
|
|
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;
|
|
16780
16782
|
}
|
|
16781
16783
|
deepFindDialog(t, r) {
|
|
16782
16784
|
const l = t.shadowRoot;
|
|
16783
|
-
if (l)
|
|
16784
|
-
|
|
16785
|
-
|
|
16786
|
-
for (const o of l.querySelectorAll("*")) {
|
|
16787
|
-
const s = this.deepFindDialog(o, r);
|
|
16788
|
-
if (s) return s;
|
|
16789
|
-
}
|
|
16790
|
-
}
|
|
16791
|
-
for (const a of t.querySelectorAll("*")) if (a.shadowRoot) {
|
|
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) {
|
|
16792
16788
|
const o = this.deepFindDialog(a, r);
|
|
16793
16789
|
if (o) return o;
|
|
16794
16790
|
}
|
|
@@ -16813,10 +16809,17 @@ var nr, Re = class {
|
|
|
16813
16809
|
constructor() {
|
|
16814
16810
|
this._dialogID = Zl(), this._registered = !1;
|
|
16815
16811
|
}
|
|
16812
|
+
onCreate() {
|
|
16813
|
+
this.registerDialog();
|
|
16814
|
+
}
|
|
16816
16815
|
registerDialog() {
|
|
16817
16816
|
if (this._registered) return;
|
|
16818
16817
|
const t = this.elementRef.shadowRoot?.querySelector("dialog");
|
|
16819
|
-
|
|
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;
|
|
16820
16823
|
}
|
|
16821
16824
|
onDestroy() {
|
|
16822
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;
|
|
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,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAW/D,qBACa,aAAa;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwC;IAEjE,SAAS,CAAC,QAAQ,EAAE,QAAQ,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;
|
|
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,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAW/D,qBACa,aAAa;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwC;IAEjE,SAAS,CAAC,QAAQ,EAAE,QAAQ,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,29 +57,26 @@ let DialogService = class DialogService {
|
|
|
57
57
|
return dialogElements.dialogRef;
|
|
58
58
|
}
|
|
59
59
|
findDialogElement(dialogID) {
|
|
60
|
-
//
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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;
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
return this.deepFindDialog(document.body, dialogID);
|
|
68
|
+
return null;
|
|
69
69
|
}
|
|
70
70
|
deepFindDialog(root, dialogID) {
|
|
71
71
|
const shadowRoot = root.shadowRoot;
|
|
72
|
-
if (shadowRoot)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const result = this.deepFindDialog(child, dialogID);
|
|
78
|
-
if (result)
|
|
79
|
-
return result;
|
|
72
|
+
if (!shadowRoot)
|
|
73
|
+
return null;
|
|
74
|
+
for (const el of shadowRoot.querySelectorAll('ml-dialog')) {
|
|
75
|
+
if (el.hasAttribute(`#${dialogID}`)) {
|
|
76
|
+
return el;
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
|
-
for (const child of
|
|
79
|
+
for (const child of shadowRoot.querySelectorAll('*')) {
|
|
83
80
|
if (child.shadowRoot) {
|
|
84
81
|
const result = this.deepFindDialog(child, dialogID);
|
|
85
82
|
if (result)
|