mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-22 09:36:59 +08:00
wip
This commit is contained in:
parent
ee05e6a3a8
commit
2783099013
@ -10,6 +10,7 @@ import { prop } from "../../utils.js";
|
|||||||
* iconSize?: number;
|
* iconSize?: number;
|
||||||
* content?: string | HTMLElement;
|
* content?: string | HTMLElement;
|
||||||
* tooltip?: string;
|
* tooltip?: string;
|
||||||
|
* enabled?: boolean;
|
||||||
* action?: (e: Event, btn: ComfyButton) => void,
|
* action?: (e: Event, btn: ComfyButton) => void,
|
||||||
* classList?: import("../utils.js").ClassList,
|
* classList?: import("../utils.js").ClassList,
|
||||||
* visibilitySetting?: { id: string, showValue: any },
|
* visibilitySetting?: { id: string, showValue: any },
|
||||||
@ -18,6 +19,7 @@ import { prop } from "../../utils.js";
|
|||||||
*/
|
*/
|
||||||
export class ComfyButton {
|
export class ComfyButton {
|
||||||
#over = 0;
|
#over = 0;
|
||||||
|
#popupOpen = false;
|
||||||
iconElement = $el("i.mdi");
|
iconElement = $el("i.mdi");
|
||||||
contentElement = $el("span");
|
contentElement = $el("span");
|
||||||
/**
|
/**
|
||||||
@ -28,7 +30,7 @@ export class ComfyButton {
|
|||||||
/**
|
/**
|
||||||
* @param {ComfyButtonProps} opts
|
* @param {ComfyButtonProps} opts
|
||||||
*/
|
*/
|
||||||
constructor({ icon, iconSize, content, tooltip, action, classList = "comfyui-button", visibilitySetting, app }) {
|
constructor({ icon, iconSize, content, tooltip, action, classList = "comfyui-button", visibilitySetting, app, enabled = true }) {
|
||||||
this.element = $el("button", [this.iconElement, this.contentElement]);
|
this.element = $el("button", [this.iconElement, this.contentElement]);
|
||||||
|
|
||||||
this.icon = prop(this, "icon", icon, toggleElement(this.iconElement, { onShow: this.updateIcon }));
|
this.icon = prop(this, "icon", icon, toggleElement(this.iconElement, { onShow: this.updateIcon }));
|
||||||
@ -48,9 +50,19 @@ export class ComfyButton {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
this.tooltip = prop(this, "tooltip", tooltip, (v) => (this.element.title = v ?? ""));
|
this.tooltip = prop(this, "tooltip", tooltip, (v) => {
|
||||||
|
if (v) {
|
||||||
|
this.element.title = v;
|
||||||
|
} else {
|
||||||
|
this.element.removeAttribute("title");
|
||||||
|
}
|
||||||
|
});
|
||||||
this.classList = prop(this, "classList", classList, this.updateClasses);
|
this.classList = prop(this, "classList", classList, this.updateClasses);
|
||||||
this.hidden = prop(this, "hidden", false, this.updateClasses);
|
this.hidden = prop(this, "hidden", false, this.updateClasses);
|
||||||
|
this.enabled = prop(this, "enabled", enabled, () => {
|
||||||
|
this.updateClasses();
|
||||||
|
this.element.disabled = !this.enabled;
|
||||||
|
});
|
||||||
this.action = prop(this, "action", action);
|
this.action = prop(this, "action", action);
|
||||||
this.element.addEventListener("click", (e) => {
|
this.element.addEventListener("click", (e) => {
|
||||||
if (this.popup) {
|
if (this.popup) {
|
||||||
@ -72,7 +84,21 @@ export class ComfyButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateIcon = () => (this.iconElement.className = `mdi mdi-${this.icon}${this.iconSize ? " mdi-" + this.iconSize : ""}`);
|
updateIcon = () => (this.iconElement.className = `mdi mdi-${this.icon}${this.iconSize ? " mdi-" + this.iconSize : ""}`);
|
||||||
updateClasses = () => applyClasses(this.element, this.classList, ...(this.hidden ? ["hidden"] : []));
|
updateClasses = () => {
|
||||||
|
const internalClasses = [];
|
||||||
|
if (this.hidden) {
|
||||||
|
internalClasses.push("hidden");
|
||||||
|
}
|
||||||
|
if (!this.enabled) {
|
||||||
|
internalClasses.push("disabled");
|
||||||
|
}
|
||||||
|
if (this.#popupOpen) {
|
||||||
|
internalClasses.push("popup-open");
|
||||||
|
} else {
|
||||||
|
internalClasses.push("popup-closed");
|
||||||
|
}
|
||||||
|
applyClasses(this.element, this.classList, ...internalClasses);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -93,6 +119,11 @@ export class ComfyButton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
popup.addEventListener("change", () => {
|
||||||
|
this.#popupOpen = popup.open;
|
||||||
|
this.updateClasses();
|
||||||
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { prop } from "../../utils.js";
|
|||||||
export class ComfyButtonGroup {
|
export class ComfyButtonGroup {
|
||||||
element = $el("div.comfyui-button-group");
|
element = $el("div.comfyui-button-group");
|
||||||
|
|
||||||
/** @param {Array<ComfyButton>} buttons */
|
/** @param {Array<ComfyButton | HTMLElement>} buttons */
|
||||||
constructor(...buttons) {
|
constructor(...buttons) {
|
||||||
this.buttons = prop(this, "buttons", buttons, () => this.update());
|
this.buttons = prop(this, "buttons", buttons, () => this.update());
|
||||||
}
|
}
|
||||||
@ -40,6 +40,6 @@ export class ComfyButtonGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
this.element.replaceChildren(...this.buttons.map((b) => b.element));
|
this.element.replaceChildren(...this.buttons.map((b) => b["element"] ?? b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,10 @@ export class ComfyPopup extends EventTarget {
|
|||||||
|
|
||||||
container.append(this.element);
|
container.append(this.element);
|
||||||
|
|
||||||
this.children = prop(this, "children", children, () => this.element.replaceChildren(...this.children));
|
this.children = prop(this, "children", children, () => {
|
||||||
|
this.element.replaceChildren(...this.children);
|
||||||
|
this.update();
|
||||||
|
});
|
||||||
this.classList = prop(this, "classList", classList, () => applyClasses(this.element, this.classList, "comfyui-popup", horizontal));
|
this.classList = prop(this, "classList", classList, () => applyClasses(this.element, this.classList, "comfyui-popup", horizontal));
|
||||||
this.open = prop(this, "open", false, (v, o) => {
|
this.open = prop(this, "open", false, (v, o) => {
|
||||||
if (v === o) return;
|
if (v === o) return;
|
||||||
@ -59,7 +62,7 @@ export class ComfyPopup extends EventTarget {
|
|||||||
|
|
||||||
#hide() {
|
#hide() {
|
||||||
this.element.classList.remove("open");
|
this.element.classList.remove("open");
|
||||||
window.removeEventListener("resize", this.#update);
|
window.removeEventListener("resize", this.update);
|
||||||
window.removeEventListener("click", this.#clickHandler, { capture: true });
|
window.removeEventListener("click", this.#clickHandler, { capture: true });
|
||||||
window.removeEventListener("keydown", this.#escHandler, { capture: true });
|
window.removeEventListener("keydown", this.#escHandler, { capture: true });
|
||||||
|
|
||||||
@ -69,9 +72,9 @@ export class ComfyPopup extends EventTarget {
|
|||||||
|
|
||||||
#show() {
|
#show() {
|
||||||
this.element.classList.add("open");
|
this.element.classList.add("open");
|
||||||
this.#update();
|
this.update();
|
||||||
|
|
||||||
window.addEventListener("resize", this.#update);
|
window.addEventListener("resize", this.update);
|
||||||
window.addEventListener("click", this.#clickHandler, { capture: true });
|
window.addEventListener("click", this.#clickHandler, { capture: true });
|
||||||
if (this.closeOnEscape) {
|
if (this.closeOnEscape) {
|
||||||
window.addEventListener("keydown", this.#escHandler, { capture: true });
|
window.addEventListener("keydown", this.#escHandler, { capture: true });
|
||||||
@ -97,7 +100,7 @@ export class ComfyPopup extends EventTarget {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#update = () => {
|
update = () => {
|
||||||
const rect = this.target.getBoundingClientRect();
|
const rect = this.target.getBoundingClientRect();
|
||||||
if (this.position === "absolute") {
|
if (this.position === "absolute") {
|
||||||
if (this.horizontal === "left") {
|
if (this.horizontal === "left") {
|
||||||
|
|||||||
@ -5,8 +5,11 @@ import { addStylesheet, downloadBlob } from "../../utils.js";
|
|||||||
import { ComfyButton } from "../components/button.js";
|
import { ComfyButton } from "../components/button.js";
|
||||||
import { ComfyButtonGroup } from "../components/buttonGroup.js";
|
import { ComfyButtonGroup } from "../components/buttonGroup.js";
|
||||||
import { ComfySplitButton } from "../components/splitButton.js";
|
import { ComfySplitButton } from "../components/splitButton.js";
|
||||||
|
import { ComfyViewHistoryButton } from "./viewHistory.js";
|
||||||
import { ComfyQueueButton } from "./queueButton.js";
|
import { ComfyQueueButton } from "./queueButton.js";
|
||||||
import { ComfyWorkflows } from "./workflows.js";
|
import { ComfyWorkflows } from "./workflows.js";
|
||||||
|
import { ComfyViewQueueButton } from "./viewQueue.js";
|
||||||
|
import { getInteruptButton } from "./interruptButton.js";
|
||||||
|
|
||||||
addStylesheet("menu.css", import.meta.url);
|
addStylesheet("menu.css", import.meta.url);
|
||||||
|
|
||||||
@ -49,6 +52,15 @@ export class ComfyAppMenu {
|
|||||||
icon: "content-save-edit",
|
icon: "content-save-edit",
|
||||||
content: "Save As",
|
content: "Save As",
|
||||||
tooltip: "Save the current graph as a new workflow",
|
tooltip: "Save the current graph as a new workflow",
|
||||||
|
action: () => {
|
||||||
|
let filename = prompt("Save workflow as:", "workflow");
|
||||||
|
if (!filename) return;
|
||||||
|
if (!filename.toLowerCase().endsWith(".json")) {
|
||||||
|
filename += ".json";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.exportWorkflow("workflow", "workflow");
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
new ComfyButton({
|
new ComfyButton({
|
||||||
icon: "download",
|
icon: "download",
|
||||||
@ -61,8 +73,8 @@ export class ComfyAppMenu {
|
|||||||
content: "Export (API Format)",
|
content: "Export (API Format)",
|
||||||
tooltip: "Export the current workflow as JSON for use with the ComfyUI API",
|
tooltip: "Export the current workflow as JSON for use with the ComfyUI API",
|
||||||
action: () => this.exportWorkflow("workflow_api", "output"),
|
action: () => this.exportWorkflow("workflow_api", "output"),
|
||||||
visibilitySetting: { id: "Comfy.DevMode", showValue: "true" },
|
visibilitySetting: { id: "Comfy.DevMode", showValue: true },
|
||||||
app
|
app,
|
||||||
})
|
})
|
||||||
).element,
|
).element,
|
||||||
collapseOnMobile(
|
collapseOnMobile(
|
||||||
@ -70,22 +82,24 @@ export class ComfyAppMenu {
|
|||||||
new ComfyButton({
|
new ComfyButton({
|
||||||
icon: "refresh",
|
icon: "refresh",
|
||||||
content: "Refresh",
|
content: "Refresh",
|
||||||
action: () => {
|
tooltip: "Refresh widgets in nodes to find new models or files",
|
||||||
console.log("refresh");
|
action: () => app.refreshComboInNodes(),
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
new ComfyButton({
|
new ComfyButton({
|
||||||
icon: "clipboard-edit-outline",
|
icon: "clipboard-edit-outline",
|
||||||
content: "Clipspace",
|
content: "Clipspace",
|
||||||
action: () => {
|
tooltip: "Open Clipspace window",
|
||||||
console.log("clipboard-edit-outline");
|
action: () => app["openClipspace"](),
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
new ComfyButton({
|
new ComfyButton({
|
||||||
icon: "cancel",
|
icon: "cancel",
|
||||||
content: "Clear",
|
content: "Clear",
|
||||||
|
tooltip: "Clears current workflow",
|
||||||
action: () => {
|
action: () => {
|
||||||
console.log("cancel");
|
if (!app.ui.settings.getSettingValue("Comfy.ConfirmClear", true) || confirm("Clear workflow?")) {
|
||||||
|
app.clean();
|
||||||
|
app.graph.clear();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@ -95,6 +109,7 @@ export class ComfyAppMenu {
|
|||||||
new ComfyButton({
|
new ComfyButton({
|
||||||
icon: "cog",
|
icon: "cog",
|
||||||
content: "Settings",
|
content: "Settings",
|
||||||
|
tooltip: "Open settings",
|
||||||
action: () => {
|
action: () => {
|
||||||
app.ui.settings.show();
|
app.ui.settings.show();
|
||||||
},
|
},
|
||||||
@ -102,28 +117,19 @@ export class ComfyAppMenu {
|
|||||||
).element,
|
).element,
|
||||||
collapseOnMobile(
|
collapseOnMobile(
|
||||||
new ComfyButtonGroup(
|
new ComfyButtonGroup(
|
||||||
new ComfyButton({
|
new ComfyViewHistoryButton(app).element,
|
||||||
icon: "history",
|
new ComfyViewQueueButton(app).element,
|
||||||
content: "View History",
|
getInteruptButton("sm-hide").element
|
||||||
action: () => {
|
|
||||||
console.log("history");
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
new ComfyButton({
|
|
||||||
icon: "format-list-numbered",
|
|
||||||
content: "View Queue",
|
|
||||||
action: () => {
|
|
||||||
console.log("format-list-numbered");
|
|
||||||
},
|
|
||||||
})
|
|
||||||
)
|
)
|
||||||
).element,
|
).element,
|
||||||
new ComfyQueueButton().element,
|
|
||||||
|
getInteruptButton("sm-show").element,
|
||||||
|
new ComfyQueueButton(app).element,
|
||||||
showOnMobile(
|
showOnMobile(
|
||||||
new ComfyButton({
|
new ComfyButton({
|
||||||
icon: "menu",
|
icon: "menu",
|
||||||
action: (_, btn) => {
|
action: (_, btn) => {
|
||||||
btn.icon = this.element.classList.toggle("expanded") ? "close" : "menu";
|
btn.icon = this.element.classList.toggle("expanded") ? "menu-open" : "menu";
|
||||||
},
|
},
|
||||||
classList: "comfyui-button comfyui-menu-button",
|
classList: "comfyui-button comfyui-menu-button",
|
||||||
})
|
})
|
||||||
|
|||||||
22
web/scripts/ui/menu/interruptButton.js
Normal file
22
web/scripts/ui/menu/interruptButton.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import { api } from "../../api.js";
|
||||||
|
import { ComfyButton } from "../components/button.js";
|
||||||
|
|
||||||
|
export function getInteruptButton(visibility) {
|
||||||
|
const btn = new ComfyButton({
|
||||||
|
icon: "close",
|
||||||
|
enabled: false,
|
||||||
|
action: () => {
|
||||||
|
api.interrupt();
|
||||||
|
},
|
||||||
|
classList: ["comfyui-button", "comfyui-interrupt-button", visibility],
|
||||||
|
});
|
||||||
|
|
||||||
|
api.addEventListener("status", ({ detail }) => {
|
||||||
|
const sz = detail?.exec_info?.queue_remaining;
|
||||||
|
btn.enabled = sz > 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
@ -1,520 +1,373 @@
|
|||||||
/* Utilities */
|
/* Utilities */
|
||||||
@media only screen and (max-width: 779px) {
|
@media only screen and (max-width: 779px) {
|
||||||
.sm-hide {
|
.sm-hide {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (min-width: 780px) {
|
@media only screen and (min-width: 780px) {
|
||||||
.sm-show {
|
.sm-show {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.relative {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic */
|
/* Generic */
|
||||||
.comfyui-button {
|
.comfyui-button {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5em;
|
gap: 0.5em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comfyui-button:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
.primary .comfyui-button {
|
.primary .comfyui-button {
|
||||||
background-color: var(--primary-bg) !important;
|
background-color: var(--primary-bg) !important;
|
||||||
color: var(--primary-fg) !important;
|
color: var(--primary-fg) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.primary .comfyui-button:hover {
|
.primary .comfyui-button:not(:disabled):hover {
|
||||||
background-color: var(--primary-hover-bg) !important;
|
background-color: var(--primary-hover-bg) !important;
|
||||||
color: var(--primary-hover-fg) !important;
|
color: var(--primary-hover-fg) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Popup */
|
/* Popup */
|
||||||
.comfyui-popup {
|
.comfyui-popup {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: var(--left);
|
left: var(--left);
|
||||||
right: var(--right);
|
right: var(--right);
|
||||||
top: var(--top);
|
top: var(--top);
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
max-height: calc(100vh - var(--top) - 10px);
|
max-height: calc(100vh - var(--top) - 10px);
|
||||||
max-width: calc(100vw - var(--left) - 10px);
|
max-width: calc(100vw - var(--left) - 10px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-popup:not(.open) {
|
.comfyui-popup:not(.open) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Split button */
|
/* Split button */
|
||||||
.comfyui-split-button {
|
.comfyui-split-button {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-split-primary {
|
.comfyui-split-primary {
|
||||||
flex: auto;
|
flex: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-split-primary .comfyui-button {
|
.comfyui-split-primary .comfyui-button {
|
||||||
border-top-right-radius: 0;
|
border-top-right-radius: 0;
|
||||||
border-bottom-right-radius: 0;
|
border-bottom-right-radius: 0;
|
||||||
border-right: 1px solid var(--comfy-menu-bg);
|
border-right: 1px solid var(--comfy-menu-bg);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-split-arrow .comfyui-button {
|
.comfyui-split-arrow .comfyui-button {
|
||||||
border-top-left-radius: 0;
|
border-top-left-radius: 0;
|
||||||
border-bottom-left-radius: 0;
|
border-bottom-left-radius: 0;
|
||||||
padding-left: 2px;
|
padding-left: 2px;
|
||||||
padding-right: 2px;
|
padding-right: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-split-button-popup {
|
.comfyui-split-button-popup {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
background-color: var(--border-color);
|
background-color: var(--border-color);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-split-button-popup>.comfyui-button {
|
.comfyui-split-button-popup > .comfyui-button {
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: var(--fg-color);
|
color: var(--fg-color);
|
||||||
padding: 8px 12px 8px 8px;
|
padding: 8px 12px 8px 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-split-button-popup>.comfyui-button:hover {
|
.comfyui-split-button-popup > .comfyui-button:not(:disabled):hover {
|
||||||
background-color: var(--comfy-input-bg)
|
background-color: var(--comfy-input-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Button group */
|
/* Button group */
|
||||||
.comfyui-button-group {
|
.comfyui-button-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-button-group>.comfyui-button {
|
.comfyui-button-group > .comfyui-button,
|
||||||
padding: 4px 10px;
|
.comfyui-button-group > .comfyui-button-wrapper > .comfyui-button {
|
||||||
border-radius: 0;
|
padding: 4px 10px;
|
||||||
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Menu */
|
/* Menu */
|
||||||
.comfyui-menu {
|
.comfyui-menu {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
background: var(--comfy-menu-bg);
|
background: var(--comfy-menu-bg);
|
||||||
color: var(--fg-color);
|
color: var(--fg-color);
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.8em;
|
gap: 0.8em;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu .mdi::before {
|
.comfyui-menu .mdi::before {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu .comfyui-button {
|
.comfyui-menu .comfyui-button {
|
||||||
background: var(--comfy-input-bg);
|
background: var(--comfy-input-bg);
|
||||||
color: var(--fg-color);
|
color: var(--fg-color);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu .comfyui-button:hover {
|
.comfyui-menu .comfyui-button:not(:disabled):hover {
|
||||||
background: var(--border-color);
|
background: var(--border-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu .comfyui-split-button-popup>.comfyui-button {
|
.comfyui-menu .comfyui-split-button-popup > .comfyui-button {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu .comfyui-split-button-popup>.comfyui-button:hover {
|
.comfyui-menu .comfyui-split-button-popup > .comfyui-button:not(:disabled):hover {
|
||||||
background-color: var(--comfy-input-bg);
|
background-color: var(--comfy-input-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu .comfyui-split-button-popup.left {
|
.comfyui-menu .comfyui-split-button-popup.left {
|
||||||
border-top-right-radius: 4px;
|
border-top-right-radius: 4px;
|
||||||
border-bottom-left-radius: 4px;
|
border-bottom-left-radius: 4px;
|
||||||
border-bottom-right-radius: 4px;
|
border-bottom-right-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comfyui-menu .comfyui-button.popup-open {
|
||||||
|
background-color: var(--border-color);
|
||||||
|
}
|
||||||
.comfyui-menu-push {
|
.comfyui-menu-push {
|
||||||
margin-left: -0.8em;
|
margin-left: -0.8em;
|
||||||
flex: auto;
|
flex: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-logo {
|
.comfyui-logo {
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (min-width: 780px) {
|
@media only screen and (min-width: 780px) {
|
||||||
|
.comfyui-menu > .comfyui-menu-mobile-collapse .comfyui-button span,
|
||||||
.comfyui-menu>.comfyui-menu-mobile-collapse .comfyui-button span,
|
.comfyui-menu > .comfyui-menu-mobile-collapse.comfyui-button span {
|
||||||
.comfyui-menu>.comfyui-menu-mobile-collapse.comfyui-button span {
|
display: none;
|
||||||
display: none;
|
}
|
||||||
}
|
.comfyui-menu > .comfyui-menu-mobile-collapse .comfyui-popup .comfyui-button span {
|
||||||
|
display: unset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 779px) {
|
@media only screen and (max-width: 779px) {
|
||||||
.comfyui-menu {
|
.comfyui-menu {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu>*:not(.comfyui-menu-mobile-collapse) {
|
.comfyui-menu > *:not(.comfyui-menu-mobile-collapse) {
|
||||||
order: 1;
|
order: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu>.comfyui-menu-mobile-collapse {
|
.comfyui-menu > .comfyui-menu-mobile-collapse {
|
||||||
order: 9999;
|
order: 9999;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu>.comfyui-menu-mobile-collapse.comfyui-button-group {
|
.comfyui-menu > .comfyui-menu-mobile-collapse.comfyui-button-group {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu>.comfyui-menu-mobile-collapse .comfyui-button,
|
.comfyui-menu > .comfyui-menu-mobile-collapse .comfyui-button,
|
||||||
.comfyui-menu>.comfyui-menu-mobile-collapse.comfyui-button {
|
.comfyui-menu > .comfyui-menu-mobile-collapse.comfyui-button {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
.comfyui-menu > .comfyui-menu-mobile-collapse .comfyui-button,
|
||||||
|
.comfyui-menu > .comfyui-menu-mobile-collapse .comfyui-button-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.comfyui-menu>.comfyui-menu-mobile-collapse .comfyui-button {
|
.comfyui-menu > .comfyui-menu-mobile-collapse .comfyui-popup {
|
||||||
width: 100%;
|
position: static;
|
||||||
}
|
background-color: var(--comfy-input-bg);
|
||||||
|
max-width: unset;
|
||||||
|
max-height: 50vh;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.comfyui-menu:not(.expanded)>.comfyui-menu-mobile-collapse {
|
.comfyui-menu:not(.expanded) > .comfyui-menu-mobile-collapse {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-queue-action {
|
.comfyui-queue-button {
|
||||||
margin-right: 44px;
|
margin-right: 44px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-menu-button {
|
.comfyui-menu-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comfyui-menu > .comfyui-menu-mobile-collapse .comfyui-view-list-popup {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 480px) {
|
@media only screen and (max-width: 490px) {
|
||||||
.comfyui-workflows-label {
|
.comfyui-workflows-label {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 335px) {
|
@media only screen and (max-width: 370px) {
|
||||||
.comfyui-queue-action {
|
.comfyui-queue-button {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.comfyui-queue-action .comfyui-button {
|
.comfyui-queue-button .comfyui-button {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
.comfyui-interrupt-button {
|
||||||
|
margin-right: 45px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Workflows */
|
/* Workflows */
|
||||||
.comfyui-workflows-button {
|
.comfyui-workflows-button {
|
||||||
flex-direction: row-reverse;
|
flex-direction: row-reverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-button.unsaved {
|
.comfyui-workflows-button.unsaved {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-button.unsaved .comfyui-workflows-label:after {
|
.comfyui-workflows-button.unsaved .comfyui-workflows-label:after {
|
||||||
content: "*"
|
content: "*";
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-button-inner {
|
.comfyui-workflows-button-inner {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 7px;
|
gap: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-button-inner .mdi-graph::before {
|
.comfyui-workflows-button-inner .mdi-graph::before {
|
||||||
transform: rotate(-90deg);
|
transform: rotate(-90deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-workflows-popup {
|
.comfyui-workflows-popup {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 350px;
|
max-width: 350px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
background-color: var(--border-color);
|
background-color: var(--border-color);
|
||||||
border-top-right-radius: 4px;
|
border-top-right-radius: 4px;
|
||||||
border-bottom-right-radius: 4px;
|
border-bottom-right-radius: 4px;
|
||||||
border-bottom-left-radius: 4px;
|
border-bottom-left-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* View List */
|
||||||
|
.comfyui-view-list-popup {
|
||||||
|
padding: 10px;
|
||||||
|
background-color: var(--border-color);
|
||||||
|
min-width: 170px;
|
||||||
|
min-height: 100px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
border-top-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.comfyui-view-list-popup h3 {
|
||||||
|
margin: 0 0 5px 0;
|
||||||
|
}
|
||||||
|
.comfyui-view-list-items {
|
||||||
|
width: 100%;
|
||||||
|
background: var(--comfy-menu-bg);
|
||||||
|
border-radius: 5px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex: auto;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.comfyui-view-list-items section {
|
||||||
|
max-height: 400px;
|
||||||
|
overflow: auto;
|
||||||
|
width: 100%;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto auto auto;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 5px;
|
||||||
|
padding: 5px 0;
|
||||||
|
}
|
||||||
|
.comfyui-view-list-items section + section {
|
||||||
|
border-top: 1px solid var(--border-color);
|
||||||
|
margin-top: 10px;
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
.comfyui-view-list-items section h5 {
|
||||||
|
grid-column: 1 / 4;
|
||||||
|
text-align: center;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
.comfyui-view-list-items span {
|
||||||
|
text-align: center;
|
||||||
|
padding: 0 2px;
|
||||||
|
}
|
||||||
|
.comfyui-view-list-popup footer {
|
||||||
|
margin-top: 10px;
|
||||||
|
display: flex;
|
||||||
|
gap: 5px;
|
||||||
|
}
|
||||||
|
.comfyui-view-list-popup footer .comfyui-button {
|
||||||
|
border: 1px solid transparent;
|
||||||
|
}
|
||||||
|
.comfyui-view-list-popup footer .comfyui-button:not(:disabled):hover {
|
||||||
|
border: 1px solid var(--comfy-menu-bg);
|
||||||
|
}
|
||||||
/* Queue button */
|
/* Queue button */
|
||||||
.comfyui-queue-action .comfyui-split-primary .comfyui-button {
|
.comfyui-queue-button .comfyui-split-primary .comfyui-button {
|
||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfyui-queue-count {
|
.comfyui-queue-count {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background-color: rgb(8, 80, 153);
|
background-color: rgb(8, 80, 153);
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
min-width: 1em;
|
||||||
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
.comfy-app-menu {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 99;
|
|
||||||
background: var(--comfy-menu-bg);
|
|
||||||
color: var(--fg-color);
|
|
||||||
font-family: Arial;
|
|
||||||
padding: 4px 8px;
|
|
||||||
display: flex;
|
|
||||||
gap: 0.8em;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 0.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-logo {
|
|
||||||
font-size: 1.2em;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu .pull-right {
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu button {
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
color: var(--fg-color);
|
|
||||||
height: 100%;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 0 10px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu button:hover,
|
|
||||||
.comfy-split-visible .comfy-split-open {
|
|
||||||
background: var(--border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-visible .comfy-split-open>.mdi {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu button:first-child {
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu button:last-child {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu button:not(:last-child) {
|
|
||||||
border-right: 1px solid var(--comfy-menu-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu button .mdi {
|
|
||||||
font-size: 1.7em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-menu-item {
|
|
||||||
height: 2.5em;
|
|
||||||
border-radius: 4px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
background: var(--comfy-input-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-button {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-button button:hover,
|
|
||||||
.comfy-split-visible .comfy-split-open {
|
|
||||||
background: var(--border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-button .comfy-split-primary {
|
|
||||||
border-top-left-radius: 4px;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
gap: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-button .comfy-split-primary .mdi {
|
|
||||||
font-size: 1.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-button .comfy-split-open {
|
|
||||||
border-top-right-radius: 4px;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
position: relative;
|
|
||||||
padding: 0 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-button .comfy-split-open:hover .comfy-split-menu,
|
|
||||||
.comfy-split-visible .comfy-split-menu {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-menu {
|
|
||||||
display: none;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-button ul {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
list-style: none;
|
|
||||||
text-align: left;
|
|
||||||
white-space: nowrap;
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
top: calc(100% - 2px);
|
|
||||||
background: var(--border-color);
|
|
||||||
border-radius: 4px;
|
|
||||||
border-top-right-radius: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-button li {
|
|
||||||
padding: 5px 10px;
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-split-button li:hover {
|
|
||||||
background: var(--comfy-menu-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-menu-item-text-hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-queue-button {
|
|
||||||
display: contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-queue-count {
|
|
||||||
border-radius: 10px;
|
|
||||||
background: #1260cc;
|
|
||||||
padding: 2px 4px;
|
|
||||||
font-size: 9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-show {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-width: 780px) {
|
|
||||||
.comfy-app-menu {
|
|
||||||
flex-wrap: wrap;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu.open {
|
|
||||||
box-shadow: 0px 0px 15px black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu:not(.open) .comfy-menu-mobile-collapse {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu>* {
|
|
||||||
order: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu .mobile-hide {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-app-menu .comfy-menu-mobile-collapse {
|
|
||||||
order: 9999;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-menu-mobile-collapse .comfy-menu-item-text-hidden {
|
|
||||||
display: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-menu-mobile-collapse.comfy-menu-group {
|
|
||||||
flex-wrap: wrap;
|
|
||||||
height: auto;
|
|
||||||
margin: 0 -10px;
|
|
||||||
width: calc(100% + 10px);
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-menu-mobile-collapse .comfy-menu-item {
|
|
||||||
width: 100%
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-menu-mobile-collapse.comfy-menu-group button {
|
|
||||||
width: 100%;
|
|
||||||
padding: 10px;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-pull-right {
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-show {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-menu-item {
|
|
||||||
background: var(--comfy-input-bg) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-menu-mobile-collapse .comfy-split-button {
|
|
||||||
height: auto;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-menu-mobile-collapse .comfy-split-menu {
|
|
||||||
position: static;
|
|
||||||
width: 100%;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-width: 480px) {
|
|
||||||
.comfy-app-menu {
|
|
||||||
padding: 4px 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-workflow-menu {
|
|
||||||
width: auto !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfy-workflow-menu span {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
@ -2,12 +2,17 @@
|
|||||||
|
|
||||||
import { ComfyButton } from "../components/button.js";
|
import { ComfyButton } from "../components/button.js";
|
||||||
import { $el } from "../../ui.js";
|
import { $el } from "../../ui.js";
|
||||||
|
import { api } from "../../api.js";
|
||||||
import { ComfySplitButton } from "../components/splitButton.js";
|
import { ComfySplitButton } from "../components/splitButton.js";
|
||||||
|
|
||||||
export class ComfyQueueButton {
|
export class ComfyQueueButton {
|
||||||
element = $el("div.comfyui-queue-action");
|
element = $el("div.comfyui-queue-button");
|
||||||
|
|
||||||
|
constructor(app) {
|
||||||
|
this.queueSizeElement = $el("span.comfyui-queue-count", {
|
||||||
|
textContent: "?",
|
||||||
|
});
|
||||||
|
|
||||||
constructor() {
|
|
||||||
const btn = new ComfySplitButton(
|
const btn = new ComfySplitButton(
|
||||||
{
|
{
|
||||||
primary: new ComfyButton({
|
primary: new ComfyButton({
|
||||||
@ -15,13 +20,13 @@ export class ComfyQueueButton {
|
|||||||
$el("span", {
|
$el("span", {
|
||||||
textContent: "Queue",
|
textContent: "Queue",
|
||||||
}),
|
}),
|
||||||
$el("span.comfyui-queue-count", {
|
this.queueSizeElement,
|
||||||
textContent: "99+",
|
|
||||||
title: "186 prompts queued"
|
|
||||||
}),
|
|
||||||
]),
|
]),
|
||||||
icon: "play",
|
icon: "play",
|
||||||
classList: "comfyui-button",
|
classList: "comfyui-button",
|
||||||
|
action: () => {
|
||||||
|
app.queuePrompt(0, 1);
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
mode: "click",
|
mode: "click",
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
@ -33,5 +38,13 @@ export class ComfyQueueButton {
|
|||||||
);
|
);
|
||||||
btn.element.classList.add("primary");
|
btn.element.classList.add("primary");
|
||||||
this.element.append(btn.element);
|
this.element.append(btn.element);
|
||||||
|
|
||||||
|
api.addEventListener("status", ({ detail }) => {
|
||||||
|
const sz = detail?.exec_info?.queue_remaining;
|
||||||
|
if (sz != null) {
|
||||||
|
this.queueSizeElement.textContent = sz > 99 ? "99+" : sz;
|
||||||
|
this.queueSizeElement.title = `${sz} promps in queue`;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
27
web/scripts/ui/menu/viewHistory.js
Normal file
27
web/scripts/ui/menu/viewHistory.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import { ComfyButton } from "../components/button.js";
|
||||||
|
import { ComfyViewList, ComfyViewListButton } from "./viewList.js";
|
||||||
|
|
||||||
|
export class ComfyViewHistoryButton extends ComfyViewListButton {
|
||||||
|
constructor(app) {
|
||||||
|
super(app, {
|
||||||
|
button: new ComfyButton({
|
||||||
|
content: "View History",
|
||||||
|
icon: "history",
|
||||||
|
tooltip: "View History",
|
||||||
|
classList: "comfyui-button comfyui-history-button",
|
||||||
|
}),
|
||||||
|
list: ComfyViewHistoryList,
|
||||||
|
mode: "History",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ComfyViewHistoryList extends ComfyViewList {
|
||||||
|
async loadItems() {
|
||||||
|
const items = await super.loadItems();
|
||||||
|
items["History"].reverse();
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
}
|
||||||
203
web/scripts/ui/menu/viewList.js
Normal file
203
web/scripts/ui/menu/viewList.js
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import { ComfyButton } from "../components/button.js";
|
||||||
|
import { $el } from "../../ui.js";
|
||||||
|
import { api } from "../../api.js";
|
||||||
|
import { ComfyPopup } from "../components/popup.js";
|
||||||
|
|
||||||
|
export class ComfyViewListButton {
|
||||||
|
get open() {
|
||||||
|
return this.popup.open;
|
||||||
|
}
|
||||||
|
|
||||||
|
set open(open) {
|
||||||
|
this.popup.open = open;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(app, { button, list, mode }) {
|
||||||
|
this.app = app;
|
||||||
|
this.button = button;
|
||||||
|
this.element = $el("div.comfyui-button-wrapper", this.button.element);
|
||||||
|
this.popup = new ComfyPopup({
|
||||||
|
target: this.element,
|
||||||
|
container: this.element,
|
||||||
|
horizontal: "right",
|
||||||
|
});
|
||||||
|
this.list = new (list ?? ComfyViewList)(app, mode, this.popup);
|
||||||
|
this.popup.children = [this.list.element];
|
||||||
|
this.popup.addEventListener("open", () => {
|
||||||
|
this.list.update();
|
||||||
|
});
|
||||||
|
this.popup.addEventListener("close", () => {
|
||||||
|
this.list.close();
|
||||||
|
});
|
||||||
|
this.button.withPopup(this.popup);
|
||||||
|
|
||||||
|
api.addEventListener("status", () => {
|
||||||
|
if (this.popup.open) {
|
||||||
|
this.popup.update();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ComfyViewList {
|
||||||
|
popup;
|
||||||
|
|
||||||
|
constructor(app, mode, popup) {
|
||||||
|
this.app = app;
|
||||||
|
this.mode = mode;
|
||||||
|
this.popup = popup;
|
||||||
|
this.type = mode.toLowerCase();
|
||||||
|
|
||||||
|
this.items = $el(`div.comfyui-${this.type}-items.comfyui-view-list-items`);
|
||||||
|
this.clear = new ComfyButton({
|
||||||
|
icon: "cancel",
|
||||||
|
content: "Clear",
|
||||||
|
action: async () => {
|
||||||
|
this.showSpinner(false);
|
||||||
|
await api.clearItems(this.type);
|
||||||
|
await this.update();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
this.refresh = new ComfyButton({
|
||||||
|
icon: "refresh",
|
||||||
|
content: "Refresh",
|
||||||
|
action: async () => {
|
||||||
|
await this.update(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
this.element = $el(`div.comfyui-${this.type}-popup.comfyui-view-list-popup`, [
|
||||||
|
$el("h3", mode),
|
||||||
|
this.items,
|
||||||
|
$el("footer", [this.clear.element, this.refresh.element]),
|
||||||
|
]);
|
||||||
|
|
||||||
|
api.addEventListener("status", () => {
|
||||||
|
if (this.popup.open) {
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async close() {
|
||||||
|
this.items.replaceChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
async update(resize = true) {
|
||||||
|
this.showSpinner(resize);
|
||||||
|
const res = await this.loadItems();
|
||||||
|
let any = false;
|
||||||
|
|
||||||
|
const names = Object.keys(res);
|
||||||
|
const sections = names
|
||||||
|
.map((section) => {
|
||||||
|
const items = res[section];
|
||||||
|
if (items?.length) {
|
||||||
|
any = true;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rows = [];
|
||||||
|
if (names.length > 1) {
|
||||||
|
rows.push($el("h5", section));
|
||||||
|
}
|
||||||
|
rows.push(...items.flatMap((item) => this.createRow(item, section)));
|
||||||
|
return $el("section", rows);
|
||||||
|
})
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
|
if (any) {
|
||||||
|
this.items.replaceChildren(...sections);
|
||||||
|
} else {
|
||||||
|
this.items.replaceChildren($el("h5", "None"));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.popup.update();
|
||||||
|
this.clear.enabled = this.refresh.enabled = true;
|
||||||
|
this.element.style.removeProperty("height");
|
||||||
|
}
|
||||||
|
|
||||||
|
showSpinner(resize = true) {
|
||||||
|
// if (!this.spinner) {
|
||||||
|
// this.spinner = createSpinner();
|
||||||
|
// }
|
||||||
|
// if (!resize) {
|
||||||
|
// this.element.style.height = this.element.clientHeight + "px";
|
||||||
|
// }
|
||||||
|
// this.clear.enabled = this.refresh.enabled = false;
|
||||||
|
// this.items.replaceChildren(
|
||||||
|
// $el(
|
||||||
|
// "div",
|
||||||
|
// {
|
||||||
|
// style: {
|
||||||
|
// fontSize: "18px",
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// this.spinner
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
// this.popup.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
async loadItems() {
|
||||||
|
return await api.getItems(this.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRow = (item, section) => {
|
||||||
|
return {
|
||||||
|
text: item.prompt[0] + "",
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
text: "Load",
|
||||||
|
action: async () => {
|
||||||
|
try {
|
||||||
|
await this.app.loadGraphData(item.prompt[3].extra_pnginfo.workflow);
|
||||||
|
if (item.outputs) {
|
||||||
|
this.app.nodeOutputs = item.outputs;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
alert("Error loading workflow: " + error.message);
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "Delete",
|
||||||
|
action: async () => {
|
||||||
|
try {
|
||||||
|
await api.deleteItem(this.type, item.prompt[1]);
|
||||||
|
this.update();
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
createRow = (item, section) => {
|
||||||
|
const row = this.getRow(item, section);
|
||||||
|
return [
|
||||||
|
$el("span", row.text),
|
||||||
|
...row.actions.map(
|
||||||
|
(a) =>
|
||||||
|
new ComfyButton({
|
||||||
|
content: a.text,
|
||||||
|
action: async (e, btn) => {
|
||||||
|
btn.enabled = false;
|
||||||
|
try {
|
||||||
|
await a.action();
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
} finally {
|
||||||
|
btn.enabled = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}).element
|
||||||
|
),
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
55
web/scripts/ui/menu/viewQueue.js
Normal file
55
web/scripts/ui/menu/viewQueue.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import { ComfyButton } from "../components/button.js";
|
||||||
|
import { ComfyViewList, ComfyViewListButton } from "./viewList.js";
|
||||||
|
import { api } from "/scripts/api.js";
|
||||||
|
|
||||||
|
export class ComfyViewQueueButton extends ComfyViewListButton {
|
||||||
|
constructor(app) {
|
||||||
|
super(app, {
|
||||||
|
button: new ComfyButton({
|
||||||
|
content: "View Queue",
|
||||||
|
icon: "format-list-numbered",
|
||||||
|
tooltip: "View Queue",
|
||||||
|
classList: "comfyui-button comfyui-queue-button",
|
||||||
|
}),
|
||||||
|
list: ComfyViewQueueList,
|
||||||
|
mode: "Queue",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ComfyViewQueueList extends ComfyViewList {
|
||||||
|
getRow(item, section) {
|
||||||
|
if (section !== "Running") {
|
||||||
|
return super.getRow(item, section);
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
text: item.prompt[0] + "",
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
text: "Load",
|
||||||
|
action: async () => {
|
||||||
|
try {
|
||||||
|
await this.app.loadGraphData(item.prompt[3].extra_pnginfo.workflow);
|
||||||
|
if (item.outputs) {
|
||||||
|
this.app.nodeOutputs = item.outputs;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
alert("Error loading workflow: " + error.message);
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "Cancel",
|
||||||
|
action: async () => {
|
||||||
|
try {
|
||||||
|
await api.interrupt();
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -140,6 +140,8 @@ export class ComfySettingsDialog extends ComfyDialog {
|
|||||||
onChange,
|
onChange,
|
||||||
name,
|
name,
|
||||||
render: () => {
|
render: () => {
|
||||||
|
if (type === "hidden") return;
|
||||||
|
|
||||||
const setter = (v) => {
|
const setter = (v) => {
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
onChange(v, value);
|
onChange(v, value);
|
||||||
@ -314,7 +316,7 @@ export class ComfySettingsDialog extends ComfyDialog {
|
|||||||
},
|
},
|
||||||
[$el("th"), $el("th", { style: { width: "33%" } })]
|
[$el("th"), $el("th", { style: { width: "33%" } })]
|
||||||
),
|
),
|
||||||
...this.settings.sort((a, b) => a.name.localeCompare(b.name)).map((s) => s.render())
|
...this.settings.sort((a, b) => a.name.localeCompare(b.name)).map((s) => s.render()).filter(Boolean)
|
||||||
);
|
);
|
||||||
this.element.showModal();
|
this.element.showModal();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,6 @@ body {
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
border-radius: 0 8px 8px 8px;
|
border-radius: 0 8px 8px 8px;
|
||||||
box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.4);
|
box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.4);
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.comfy-menu button,
|
.comfy-menu button,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user