Files
Maxed-Out-99-ComfyUI-MaxedOut/web/lib/mxd_dialog.js
T
Maxed-Out-99andClaude Fable 5 4cb19be2e0 Restructure web/ into lib+nodes+vendor; merge power lora loader forks
- web/lib/: the shared rgthree-derived layer (mxd_* utils, dialogs, api,
  runtime) + its CSS, moved as a unit.
- web/nodes/: one extension file per node/feature, _mxd suffix dropped.
- web/vendor/zip_loader/: vendored zip import addon.
- index.js explicitly imports every module; loraloader_mxd_entry.js
  folded into it and deleted.

Power Lora Loader merge: new web/nodes/power_lora_base.js holds the
shared node machinery, header row, and single-strength lora row widget.
power_lora_loader.js (dual model/clip strengths) and
ltx2_power_lora_loader.js (per-layer strength rows) are now thin
subclasses (~450 duplicated lines removed). Serialization formats,
widget names, extension names, and node targets unchanged.

better_combos.js scoped to MXD latent loaders only: removed the
pysssss CheckpointLoader/LoraLoader patching (already disabled behind
ENABLE_PYSSSS_NODE_ENHANCEMENTS=false, so provably inert), the dead
' MXD' alias config entries, and the no-op refreshComboInNodes wrapper.

scripts/check_web.py clean; node schema unchanged (68 identical).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 06:41:35 -07:00

112 lines
3.9 KiB
JavaScript

import { createElement as $el, getClosestOrSelf, setAttributes } from "./mxd_utils_dom.js";
export class MxdDialog extends EventTarget {
constructor(options) {
super();
this.options = options;
let container = $el("div.mxd-dialog-container");
this.element = $el("dialog", {
classes: ["mxd-dialog", options.class || ""],
child: container,
parent: document.body,
events: {
click: (event) => {
if (!this.element.open ||
event.target === container ||
getClosestOrSelf(event.target, `.mxd-dialog-container`) === container) {
return;
}
return this.close();
},
},
});
this.element.addEventListener("close", (event) => {
this.onDialogElementClose();
});
this.titleElement = $el("div.mxd-dialog-container-title", {
parent: container,
children: !options.title
? null
: options.title instanceof Element || Array.isArray(options.title)
? options.title
: typeof options.title === "string"
? !options.title.includes("<h2")
? $el("h2", { html: options.title })
: options.title
: options.title,
});
this.contentElement = $el("div.mxd-dialog-container-content", {
parent: container,
child: options.content,
});
const footerEl = $el("footer.mxd-dialog-container-footer", { parent: container });
for (const button of options.buttons || []) {
$el("button", {
text: button.label,
className: button.className,
disabled: !!button.disabled,
parent: footerEl,
events: {
click: (e) => {
var _a;
(_a = button.callback) === null || _a === void 0 ? void 0 : _a.call(button, e);
},
},
});
}
if (options.closeButtonLabel !== false) {
$el("button", {
text: options.closeButtonLabel || "Close",
className: "mxd-button",
parent: footerEl,
events: {
click: (e) => {
this.close(e);
},
},
});
}
}
setTitle(content) {
const title = typeof content !== "string" || content.includes("<h2")
? content
: $el("h2", { html: content });
setAttributes(this.titleElement, { children: title });
}
setContent(content) {
setAttributes(this.contentElement, { children: content });
}
show() {
document.body.classList.add("mxd-dialog-open");
this.element.showModal();
this.dispatchEvent(new CustomEvent("show"));
return this;
}
async close(e) {
if (this.options.onBeforeClose && !(await this.options.onBeforeClose())) {
return;
}
this.element.close();
}
onDialogElementClose() {
document.body.classList.remove("mxd-dialog-open");
this.element.remove();
this.dispatchEvent(new CustomEvent("close", this.getCloseEventDetail()));
}
getCloseEventDetail() {
return { detail: null };
}
}
export class MxdHelpDialog extends MxdDialog {
constructor(node, content, opts = {}) {
const title = (node.type || node.title || "").replace(/\s*\(mxd\).*/, " <small>by mxd</small>");
const options = Object.assign({}, opts, {
class: "-iconed -help",
title,
content,
});
super(options);
}
}