@melodicdev/components 1.0.14 → 1.0.16
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 +14 -37
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +161 -176
- package/lib/components/overlays/dialog/dialog.component.d.ts +2 -3
- package/lib/components/overlays/dialog/dialog.component.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.component.js +1 -6
- package/lib/components/overlays/dialog/dialog.service.d.ts +0 -2
- package/lib/components/overlays/dialog/dialog.service.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog.service.js +0 -42
- package/package.json +1 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare class DialogComponent implements IElementRef,
|
|
1
|
+
import type { OnDestroy, IElementRef } from '@melodicdev/core';
|
|
2
|
+
export declare class DialogComponent implements IElementRef, 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;
|
|
10
9
|
private registerDialog;
|
|
11
10
|
onDestroy(): void;
|
|
12
11
|
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,
|
|
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"}
|
|
@@ -17,17 +17,12 @@ let DialogComponent = class DialogComponent {
|
|
|
17
17
|
this._dialogID = newID();
|
|
18
18
|
this._registered = false;
|
|
19
19
|
}
|
|
20
|
-
onCreate() {
|
|
21
|
-
this.registerDialog();
|
|
22
|
-
}
|
|
23
20
|
registerDialog() {
|
|
24
21
|
if (this._registered)
|
|
25
22
|
return;
|
|
26
23
|
const dialogEl = this.elementRef.shadowRoot?.querySelector('dialog');
|
|
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);
|
|
24
|
+
if (!dialogEl)
|
|
29
25
|
return;
|
|
30
|
-
}
|
|
31
26
|
this._dialogEl = dialogEl;
|
|
32
27
|
this._dialogID = this.createDialogID();
|
|
33
28
|
this._dialogEl.id = this._dialogID;
|
|
@@ -7,8 +7,6 @@ export declare class DialogService {
|
|
|
7
7
|
removeDialog(dialogID: UniqueID): void;
|
|
8
8
|
open<TResult = unknown, TData = unknown>(dialogComponent: new (...args: any[]) => any, config?: IDialogConfig<TData>): DialogRef<TResult, TData>;
|
|
9
9
|
open<TResult = unknown, TData = unknown>(dialogID: UniqueID): DialogRef<TResult, TData>;
|
|
10
|
-
private findDialogElement;
|
|
11
|
-
private deepFindDialog;
|
|
12
10
|
close<T = unknown>(dialogID: UniqueID, result?: T): void;
|
|
13
11
|
private cleanUpDialog;
|
|
14
12
|
private mountDialog;
|
|
@@ -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;
|
|
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;IA2BvF,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"}
|
|
@@ -40,51 +40,9 @@ let DialogService = class DialogService {
|
|
|
40
40
|
}
|
|
41
41
|
dialogComponent.component.onDialogRefSet?.(dialogElements.dialogRef);
|
|
42
42
|
}
|
|
43
|
-
// Lazy resolution: if the dialog wasn't registered during lifecycle hooks
|
|
44
|
-
// (e.g. nested router-outlet), find it in the DOM and trigger registration.
|
|
45
|
-
if (!dialogElements) {
|
|
46
|
-
const mlDialog = this.findDialogElement(dialogID);
|
|
47
|
-
if (mlDialog) {
|
|
48
|
-
mlDialog.component.open();
|
|
49
|
-
dialogElements = this._dialogs.get(dialogID);
|
|
50
|
-
}
|
|
51
|
-
if (!dialogElements) {
|
|
52
|
-
throw new Error(`Dialog "${dialogID}" not found. Ensure an <ml-dialog #${dialogID}> exists in the DOM.`);
|
|
53
|
-
}
|
|
54
|
-
return dialogElements.dialogRef;
|
|
55
|
-
}
|
|
56
43
|
dialogElements.dialogRef.open();
|
|
57
44
|
return dialogElements.dialogRef;
|
|
58
45
|
}
|
|
59
|
-
findDialogElement(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;
|
|
69
|
-
}
|
|
70
|
-
deepFindDialog(root, dialogID) {
|
|
71
|
-
const shadowRoot = root.shadowRoot;
|
|
72
|
-
if (!shadowRoot)
|
|
73
|
-
return null;
|
|
74
|
-
for (const el of shadowRoot.querySelectorAll('ml-dialog')) {
|
|
75
|
-
if (el.hasAttribute(`#${dialogID}`)) {
|
|
76
|
-
return el;
|
|
77
|
-
}
|
|
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;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
46
|
close(dialogID, result) {
|
|
89
47
|
if (this._dialogs.has(dialogID)) {
|
|
90
48
|
const dialogElements = this._dialogs.get(dialogID);
|