@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
|
@@ -1777,12 +1777,21 @@ var TemplateResult = class TemplateResult {
|
|
|
1777
1777
|
}
|
|
1778
1778
|
renderNestedTemplate(part, template) {
|
|
1779
1779
|
this.ensureMarkers(part);
|
|
1780
|
+
if (part.nestedContainer) {
|
|
1781
|
+
if (part.nestedContainer.__templateKey === getTemplateKey(template.strings)) {
|
|
1782
|
+
template.renderInto(part.nestedContainer);
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
const oldParts = part.nestedContainer.__parts;
|
|
1786
|
+
if (oldParts) this.cleanupParts(oldParts);
|
|
1787
|
+
}
|
|
1780
1788
|
this.clearRenderedNodes(part);
|
|
1781
1789
|
part.node.textContent = "";
|
|
1782
|
-
const
|
|
1783
|
-
template.renderInto(
|
|
1784
|
-
part.
|
|
1785
|
-
part.
|
|
1790
|
+
const container = document.createDocumentFragment();
|
|
1791
|
+
template.renderInto(container);
|
|
1792
|
+
part.nestedContainer = container;
|
|
1793
|
+
part.renderedNodes = Array.from(container.childNodes);
|
|
1794
|
+
part.endMarker.parentNode.insertBefore(container, part.endMarker);
|
|
1786
1795
|
}
|
|
1787
1796
|
renderNode(part, node) {
|
|
1788
1797
|
this.ensureMarkers(part);
|
|
@@ -18609,35 +18618,9 @@ var DialogService = class DialogService$1 {
|
|
|
18609
18618
|
if (config) dialogElements.dialogRef.applyConfig(config);
|
|
18610
18619
|
dialogComponent.component.onDialogRefSet?.(dialogElements.dialogRef);
|
|
18611
18620
|
}
|
|
18612
|
-
if (!dialogElements) {
|
|
18613
|
-
const mlDialog = this.findDialogElement(dialogID);
|
|
18614
|
-
if (mlDialog) {
|
|
18615
|
-
mlDialog.component.open();
|
|
18616
|
-
dialogElements = this._dialogs.get(dialogID);
|
|
18617
|
-
}
|
|
18618
|
-
if (!dialogElements) throw new Error(`Dialog "${dialogID}" not found. Ensure an <ml-dialog #${dialogID}> exists in the DOM.`);
|
|
18619
|
-
return dialogElements.dialogRef;
|
|
18620
|
-
}
|
|
18621
18621
|
dialogElements.dialogRef.open();
|
|
18622
18622
|
return dialogElements.dialogRef;
|
|
18623
18623
|
}
|
|
18624
|
-
findDialogElement(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;
|
|
18630
|
-
}
|
|
18631
|
-
deepFindDialog(root, dialogID) {
|
|
18632
|
-
const shadowRoot = root.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) {
|
|
18636
|
-
const result = this.deepFindDialog(child, dialogID);
|
|
18637
|
-
if (result) return result;
|
|
18638
|
-
}
|
|
18639
|
-
return null;
|
|
18640
|
-
}
|
|
18641
18624
|
close(dialogID, result) {
|
|
18642
18625
|
if (this._dialogs.has(dialogID)) this._dialogs.get(dialogID).dialogRef.close(result);
|
|
18643
18626
|
}
|
|
@@ -18663,16 +18646,10 @@ var DialogComponent = class DialogComponent$1 {
|
|
|
18663
18646
|
this._dialogID = newID();
|
|
18664
18647
|
this._registered = false;
|
|
18665
18648
|
}
|
|
18666
|
-
onCreate() {
|
|
18667
|
-
this.registerDialog();
|
|
18668
|
-
}
|
|
18669
18649
|
registerDialog() {
|
|
18670
18650
|
if (this._registered) return;
|
|
18671
18651
|
const dialogEl = this.elementRef.shadowRoot?.querySelector("dialog");
|
|
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
|
-
}
|
|
18652
|
+
if (!dialogEl) return;
|
|
18676
18653
|
this._dialogEl = dialogEl;
|
|
18677
18654
|
this._dialogID = this.createDialogID();
|
|
18678
18655
|
this._dialogEl.id = this._dialogID;
|