You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
652 B
32 lines
652 B
import { $el } from "../ui.js"; |
|
|
|
export class ComfyDialog { |
|
constructor() { |
|
this.element = $el("div.comfy-modal", { parent: document.body }, [ |
|
$el("div.comfy-modal-content", [$el("p", { $: (p) => (this.textElement = p) }), ...this.createButtons()]), |
|
]); |
|
} |
|
|
|
createButtons() { |
|
return [ |
|
$el("button", { |
|
type: "button", |
|
textContent: "Close", |
|
onclick: () => this.close(), |
|
}), |
|
]; |
|
} |
|
|
|
close() { |
|
this.element.style.display = "none"; |
|
} |
|
|
|
show(html) { |
|
if (typeof html === "string") { |
|
this.textElement.innerHTML = html; |
|
} else { |
|
this.textElement.replaceChildren(html); |
|
} |
|
this.element.style.display = "flex"; |
|
} |
|
}
|
|
|