mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-20 22:17:02 +08:00
wip
This commit is contained in:
parent
37aec1b438
commit
ee05e6a3a8
BIN
web/fonts/materialdesignicons-webfont.woff2
Normal file
BIN
web/fonts/materialdesignicons-webfont.woff2
Normal file
Binary file not shown.
@ -5,6 +5,7 @@
|
||||
<title>ComfyUI</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<link rel="stylesheet" type="text/css" href="./lib/litegraph.css" />
|
||||
<link rel="stylesheet" type="text/css" href="./lib/materialdesignicons.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="./style.css" />
|
||||
<link rel="stylesheet" type="text/css" href="./user.css" />
|
||||
<script type="text/javascript" src="./lib/litegraph.core.js"></script>
|
||||
|
||||
@ -4,7 +4,9 @@
|
||||
"paths": {
|
||||
"/*": ["./*"]
|
||||
},
|
||||
"lib": ["DOM", "ES2022"]
|
||||
"lib": ["DOM", "ES2022"],
|
||||
"target": "ES2015",
|
||||
"module": "es2020"
|
||||
},
|
||||
"include": ["."]
|
||||
}
|
||||
|
||||
3
web/lib/materialdesignicons.min.css
vendored
Normal file
3
web/lib/materialdesignicons.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -6,8 +6,7 @@ import { defaultGraph } from "./defaultGraph.js";
|
||||
import { getPngMetadata, getWebpMetadata, importA1111, getLatentMetadata } from "./pnginfo.js";
|
||||
import { addDomClippingSetting } from "./domWidget.js";
|
||||
import { createImageHost, calculateImageGrid } from "./ui/imagePreview.js"
|
||||
import { Workflows } from "./workflows.js"
|
||||
import "./ui/menu.js"
|
||||
import { ComfyAppMenu } from "./ui/menu/index.js"
|
||||
export const ANIM_PREVIEW_WIDGET = "$$comfy_animation_preview"
|
||||
|
||||
function sanitizeNodeName(string) {
|
||||
@ -53,6 +52,7 @@ export class ComfyApp {
|
||||
constructor() {
|
||||
this.ui = new ComfyUI(this);
|
||||
this.logging = new ComfyLogging(this);
|
||||
new ComfyAppMenu(this);
|
||||
|
||||
/**
|
||||
* List of extensions that are registered with the app
|
||||
@ -77,8 +77,6 @@ export class ComfyApp {
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.shiftDown = false;
|
||||
|
||||
new Workflows();
|
||||
}
|
||||
|
||||
getPreviewFormatParam() {
|
||||
|
||||
@ -6,17 +6,22 @@ import { ComfySettingsDialog } from "./ui/settings.js";
|
||||
export const ComfyDialog = _ComfyDialog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param { string } tag HTML Element Tag and optional classes e.g. div.class1.class2
|
||||
* @template { string | (keyof HTMLElementTagNameMap) } K
|
||||
* @typedef { K extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[K] : HTMLElement } ElementType
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template { string | (keyof HTMLElementTagNameMap) } K
|
||||
* @param { K } tag HTML Element Tag and optional classes e.g. div.class1.class2
|
||||
* @param { string | Element | Element[] | ({
|
||||
* parent?: Element,
|
||||
* $?: (el: HTMLElement) => void,
|
||||
* $?: (el: ElementType<K>) => void,
|
||||
* dataset?: DOMStringMap,
|
||||
* style?: Partial<CSSStyleDeclaration>,
|
||||
* for?: string
|
||||
* } & Omit<Partial<HTMLElement>, "style">) | undefined } [propsOrChildren]
|
||||
* } & Omit<Partial<ElementType<K>>, "style">) | undefined } [propsOrChildren]
|
||||
* @param { string | Element | Element[] | undefined } [children]
|
||||
* @returns
|
||||
* @returns { ElementType<K> }
|
||||
*/
|
||||
export function $el(tag, propsOrChildren, children) {
|
||||
const split = tag.split(".");
|
||||
@ -587,7 +592,7 @@ export class ComfyUI {
|
||||
name: "Enable Dev mode Options",
|
||||
type: "boolean",
|
||||
defaultValue: false,
|
||||
onChange: function(value) { document.getElementById("comfy-dev-save-api-button").style.display = value ? "block" : "none"},
|
||||
onChange: function(value) { document.getElementById("comfy-dev-save-api-button").style.display = value ? "flex" : "none"},
|
||||
});
|
||||
|
||||
dragElement(this.menuContainer, this.settings);
|
||||
|
||||
98
web/scripts/ui/components/button.js
Normal file
98
web/scripts/ui/components/button.js
Normal file
@ -0,0 +1,98 @@
|
||||
// @ts-check
|
||||
|
||||
import { $el } from "../../ui.js";
|
||||
import { applyClasses, toggleElement } from "../utils.js";
|
||||
import { prop } from "../../utils.js";
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* icon?: string;
|
||||
* iconSize?: number;
|
||||
* content?: string | HTMLElement;
|
||||
* tooltip?: string;
|
||||
* action?: (e: Event, btn: ComfyButton) => void,
|
||||
* classList?: import("../utils.js").ClassList,
|
||||
* visibilitySetting?: { id: string, showValue: any },
|
||||
* app?: import("../../app.js").ComfyApp
|
||||
* }} ComfyButtonProps
|
||||
*/
|
||||
export class ComfyButton {
|
||||
#over = 0;
|
||||
iconElement = $el("i.mdi");
|
||||
contentElement = $el("span");
|
||||
/**
|
||||
* @type {import("./popup.js").ComfyPopup}
|
||||
*/
|
||||
popup;
|
||||
|
||||
/**
|
||||
* @param {ComfyButtonProps} opts
|
||||
*/
|
||||
constructor({ icon, iconSize, content, tooltip, action, classList = "comfyui-button", visibilitySetting, app }) {
|
||||
this.element = $el("button", [this.iconElement, this.contentElement]);
|
||||
|
||||
this.icon = prop(this, "icon", icon, toggleElement(this.iconElement, { onShow: this.updateIcon }));
|
||||
this.iconSize = prop(this, "iconSize", iconSize, this.updateIcon);
|
||||
this.content = prop(
|
||||
this,
|
||||
"content",
|
||||
content,
|
||||
toggleElement(this.contentElement, {
|
||||
onShow: (el, v) => {
|
||||
if (typeof v === "string") {
|
||||
el.textContent = v;
|
||||
} else {
|
||||
el.replaceChildren(v);
|
||||
}
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
this.tooltip = prop(this, "tooltip", tooltip, (v) => (this.element.title = v ?? ""));
|
||||
this.classList = prop(this, "classList", classList, this.updateClasses);
|
||||
this.hidden = prop(this, "hidden", false, this.updateClasses);
|
||||
this.action = prop(this, "action", action);
|
||||
this.element.addEventListener("click", (e) => {
|
||||
if (this.popup) {
|
||||
// we are either a touch device or triggered by click not hover
|
||||
if (!this.#over) {
|
||||
this.popup.toggle();
|
||||
}
|
||||
}
|
||||
this.action?.(e, this);
|
||||
});
|
||||
|
||||
if (visibilitySetting?.id) {
|
||||
const settingUpdated = () => {
|
||||
this.hidden = app.ui.settings.getSettingValue(visibilitySetting.id) !== visibilitySetting.showValue;
|
||||
};
|
||||
app.ui.settings.addEventListener(visibilitySetting.id + ".change", settingUpdated);
|
||||
settingUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
updateIcon = () => (this.iconElement.className = `mdi mdi-${this.icon}${this.iconSize ? " mdi-" + this.iconSize : ""}`);
|
||||
updateClasses = () => applyClasses(this.element, this.classList, ...(this.hidden ? ["hidden"] : []));
|
||||
|
||||
/**
|
||||
*
|
||||
* @param { import("./popup.js").ComfyPopup } popup
|
||||
* @param { "click" | "hover" } mode
|
||||
*/
|
||||
withPopup(popup, mode = "click") {
|
||||
this.popup = popup;
|
||||
|
||||
if (mode === "hover") {
|
||||
for (const el of [this.element, this.popup.element]) {
|
||||
el.addEventListener("mouseenter", () => {
|
||||
this.popup.open = !!++this.#over;
|
||||
});
|
||||
el.addEventListener("mouseleave", () => {
|
||||
this.popup.open = !!--this.#over;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
45
web/scripts/ui/components/buttonGroup.js
Normal file
45
web/scripts/ui/components/buttonGroup.js
Normal file
@ -0,0 +1,45 @@
|
||||
// @ts-check
|
||||
|
||||
import { $el } from "../../ui.js";
|
||||
import { ComfyButton } from "./button.js";
|
||||
import { prop } from "../../utils.js";
|
||||
|
||||
export class ComfyButtonGroup {
|
||||
element = $el("div.comfyui-button-group");
|
||||
|
||||
/** @param {Array<ComfyButton>} buttons */
|
||||
constructor(...buttons) {
|
||||
this.buttons = prop(this, "buttons", buttons, () => this.update());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {ComfyButton} button
|
||||
* @param {number} index
|
||||
*/
|
||||
insert(button, index) {
|
||||
this.buttons.splice(index, 0, button);
|
||||
this.update();
|
||||
}
|
||||
|
||||
/** @param {ComfyButton} button */
|
||||
append(button) {
|
||||
this.buttons.push(button);
|
||||
this.update();
|
||||
}
|
||||
|
||||
/** @param {ComfyButton|number} indexOrButton */
|
||||
remove(indexOrButton) {
|
||||
if (typeof indexOrButton !== "number") {
|
||||
indexOrButton = this.buttons.indexOf(indexOrButton);
|
||||
}
|
||||
if (indexOrButton > -1) {
|
||||
const r = this.buttons.splice(indexOrButton, 1);
|
||||
this.update();
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
update() {
|
||||
this.element.replaceChildren(...this.buttons.map((b) => b.element));
|
||||
}
|
||||
}
|
||||
114
web/scripts/ui/components/popup.js
Normal file
114
web/scripts/ui/components/popup.js
Normal file
@ -0,0 +1,114 @@
|
||||
// @ts-check
|
||||
|
||||
import { prop } from "../../utils.js";
|
||||
import { $el } from "../../ui.js";
|
||||
import { applyClasses } from "../utils.js";
|
||||
|
||||
export class ComfyPopup extends EventTarget {
|
||||
element = $el("div.comfyui-popup");
|
||||
|
||||
/**
|
||||
* @param {{
|
||||
* target: HTMLElement,
|
||||
* container?: HTMLElement,
|
||||
* classList?: import("../utils.js").ClassList,
|
||||
* ignoreTarget?: boolean,
|
||||
* closeOnEscape?: boolean,
|
||||
* position?: "absolute" | "relative",
|
||||
* horizontal?: "left" | "right"
|
||||
* }} param0
|
||||
* @param {...HTMLElement} children
|
||||
*/
|
||||
constructor(
|
||||
{
|
||||
target,
|
||||
container = document.body,
|
||||
classList = "",
|
||||
ignoreTarget = true,
|
||||
closeOnEscape = true,
|
||||
position = "absolute",
|
||||
horizontal = "left",
|
||||
},
|
||||
...children
|
||||
) {
|
||||
super();
|
||||
this.target = target;
|
||||
this.ignoreTarget = ignoreTarget;
|
||||
this.container = container;
|
||||
this.position = position;
|
||||
this.closeOnEscape = closeOnEscape;
|
||||
this.horizontal = horizontal;
|
||||
|
||||
container.append(this.element);
|
||||
|
||||
this.children = prop(this, "children", children, () => this.element.replaceChildren(...this.children));
|
||||
this.classList = prop(this, "classList", classList, () => applyClasses(this.element, this.classList, "comfyui-popup", horizontal));
|
||||
this.open = prop(this, "open", false, (v, o) => {
|
||||
if (v === o) return;
|
||||
if (v) {
|
||||
this.#show();
|
||||
} else {
|
||||
this.#hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
toggle() {
|
||||
this.open = !this.open;
|
||||
}
|
||||
|
||||
#hide() {
|
||||
this.element.classList.remove("open");
|
||||
window.removeEventListener("resize", this.#update);
|
||||
window.removeEventListener("click", this.#clickHandler, { capture: true });
|
||||
window.removeEventListener("keydown", this.#escHandler, { capture: true });
|
||||
|
||||
this.dispatchEvent(new CustomEvent("close"));
|
||||
this.dispatchEvent(new CustomEvent("change"));
|
||||
}
|
||||
|
||||
#show() {
|
||||
this.element.classList.add("open");
|
||||
this.#update();
|
||||
|
||||
window.addEventListener("resize", this.#update);
|
||||
window.addEventListener("click", this.#clickHandler, { capture: true });
|
||||
if (this.closeOnEscape) {
|
||||
window.addEventListener("keydown", this.#escHandler, { capture: true });
|
||||
}
|
||||
|
||||
this.dispatchEvent(new CustomEvent("open"));
|
||||
this.dispatchEvent(new CustomEvent("change"));
|
||||
}
|
||||
|
||||
#escHandler = (e) => {
|
||||
if (e.key === "Escape") {
|
||||
this.open = false;
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
};
|
||||
|
||||
#clickHandler = (e) => {
|
||||
/** @type {any} */
|
||||
const target = e.target;
|
||||
if (!this.element.contains(target) && this.ignoreTarget && !this.target.contains(target)) {
|
||||
this.open = false;
|
||||
}
|
||||
};
|
||||
|
||||
#update = () => {
|
||||
const rect = this.target.getBoundingClientRect();
|
||||
if (this.position === "absolute") {
|
||||
if (this.horizontal === "left") {
|
||||
this.element.style.setProperty("--left", rect.left + "px");
|
||||
} else {
|
||||
this.element.style.setProperty("--left", rect.right - this.element.clientWidth + "px");
|
||||
}
|
||||
this.element.style.setProperty("--top", rect.bottom + "px");
|
||||
} else {
|
||||
this.element.style.setProperty("--left", 0 + "px");
|
||||
this.element.style.setProperty("--top", rect.height + "px");
|
||||
}
|
||||
};
|
||||
}
|
||||
43
web/scripts/ui/components/splitButton.js
Normal file
43
web/scripts/ui/components/splitButton.js
Normal file
@ -0,0 +1,43 @@
|
||||
// @ts-check
|
||||
|
||||
import { $el } from "../../ui.js";
|
||||
import { ComfyButton } from "./button.js";
|
||||
import { prop } from "../../utils.js";
|
||||
import { ComfyPopup } from "./popup.js";
|
||||
|
||||
export class ComfySplitButton {
|
||||
/**
|
||||
* @param {{
|
||||
* primary: ComfyButton,
|
||||
* mode?: "hover" | "click",
|
||||
* horizontal?: "left" | "right",
|
||||
* position?: "relative" | "absolute"
|
||||
* }} param0
|
||||
* @param {Array<ComfyButton>} items
|
||||
*/
|
||||
constructor({ primary, mode, horizontal = "left", position = "relative" }, ...items) {
|
||||
this.arrow = new ComfyButton({
|
||||
icon: "chevron-down",
|
||||
});
|
||||
this.element = $el("div.comfyui-split-button" + (mode === "hover" ? ".hover" : ""), [
|
||||
$el("div.comfyui-split-primary", primary.element),
|
||||
$el("div.comfyui-split-arrow", this.arrow.element),
|
||||
]);
|
||||
this.popup = new ComfyPopup({
|
||||
target: this.element,
|
||||
container: position === "relative" ? this.element : document.body,
|
||||
classList: "comfyui-split-button-popup",
|
||||
closeOnEscape: mode === "click",
|
||||
position,
|
||||
horizontal,
|
||||
});
|
||||
|
||||
this.arrow.withPopup(this.popup, mode);
|
||||
|
||||
this.items = prop(this, "items", items, () => this.update());
|
||||
}
|
||||
|
||||
update() {
|
||||
this.popup.element.replaceChildren(...this.items.map((b) => b.element));
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
import { $el } from "../ui.js";
|
||||
|
||||
export class ComfyDialog {
|
||||
export class ComfyDialog extends EventTarget {
|
||||
constructor() {
|
||||
super();
|
||||
this.element = $el("div.comfy-modal", { parent: document.body }, [
|
||||
$el("div.comfy-modal-content", [$el("p", { $: (p) => (this.textElement = p) }), ...this.createButtons()]),
|
||||
]);
|
||||
|
||||
@ -1,556 +0,0 @@
|
||||
// @ts-check
|
||||
|
||||
import { $el } from "../ui.js";
|
||||
|
||||
/**
|
||||
* @typedef { {
|
||||
* id: string,
|
||||
* icon?: string,
|
||||
* text?: string,
|
||||
* tooltip?: string,
|
||||
* callback?: (e: Event) => void,
|
||||
* $?: (el: HTMLElement) => void,
|
||||
* } | HTMLElement } ComfyMenuButton
|
||||
*/
|
||||
|
||||
$el("style", {
|
||||
parent: document.body,
|
||||
textContent: `
|
||||
.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-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;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
|
||||
.mobile-show {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 750px) {
|
||||
.comfy-app-menu {
|
||||
flex-wrap: wrap;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.comfy-app-menu.open {
|
||||
border-bottom: 2px solid var(--border-color)
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.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: 420px) {
|
||||
.comfy-workflow-menu {
|
||||
width: auto !important;
|
||||
}
|
||||
.comfy-workflow-menu span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
`,
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* @param { string } tag
|
||||
* @param { ComfyMenuButton } config
|
||||
* @param { boolean } showText
|
||||
* @returns
|
||||
*/
|
||||
function getMenuButtonContent(tag, config, showText = true) {
|
||||
const children = [];
|
||||
const props = {};
|
||||
if (config.id) {
|
||||
props.id = config.id;
|
||||
}
|
||||
if ("onclick" in config) {
|
||||
children.push(config);
|
||||
} else {
|
||||
if (config.icon) {
|
||||
children.push($el(`i.mdi.mdi-${config.icon}`));
|
||||
}
|
||||
if (config.text) {
|
||||
children.push($el("span" + (!showText ? ".comfy-menu-item-text-hidden" : ""), config.text));
|
||||
}
|
||||
if (config.tooltip) {
|
||||
props.title = config.tooltip;
|
||||
}
|
||||
if (config.callback) {
|
||||
props.onclick = (e) => config.callback(e);
|
||||
}
|
||||
props.$ = config.$;
|
||||
}
|
||||
return $el(tag, props, children);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param { { event: string, eventSource: HTMLElement, className: string, classTarget?: HTMLElement, captureRoot?: HTMLElement } } param0
|
||||
*/
|
||||
function toggleOnEvent({ event, eventSource, className, classTarget, captureRoot }) {
|
||||
const toggle = () => {
|
||||
classTarget ??= eventSource;
|
||||
captureRoot ??= classTarget;
|
||||
|
||||
if (classTarget.classList.contains(className)) {
|
||||
classTarget.classList.remove(className);
|
||||
console.log("removeEventListener", event);
|
||||
window.removeEventListener(event, closeHandler, { capture: true });
|
||||
} else {
|
||||
classTarget.classList.add(className);
|
||||
window.addEventListener(event, closeHandler, { capture: true });
|
||||
console.log("addEventListener", event);
|
||||
}
|
||||
};
|
||||
const closeHandler = (e) => {
|
||||
console.log(captureRoot, e.target);
|
||||
if (!captureRoot.contains(e.target)) {
|
||||
console.log("bye")
|
||||
toggle();
|
||||
}
|
||||
};
|
||||
|
||||
eventSource.addEventListener(event, toggle);
|
||||
}
|
||||
|
||||
export class ComfyMenuSplitButton {
|
||||
/**
|
||||
* @param { {
|
||||
* primary?: Element | string,
|
||||
* items: Array<{ action?: "toggle" } & ComfyMenuButton >,
|
||||
* showPrimaryInList?: boolean,
|
||||
* showPrimaryText?: boolean,
|
||||
* showArrow?: boolean
|
||||
* } } config
|
||||
*/
|
||||
constructor({ primary, items, showPrimaryInList, showPrimaryText = false, showArrow = true }) {
|
||||
let primaryItem;
|
||||
if (typeof primary === "string") {
|
||||
primaryItem = items.find((item) => item.id === primary);
|
||||
if (!primaryItem) {
|
||||
console.warn("Invalid primary item for split button: " + primary);
|
||||
}
|
||||
} else {
|
||||
primaryItem = primary;
|
||||
}
|
||||
if (!primaryItem) {
|
||||
primaryItem = items[0];
|
||||
}
|
||||
|
||||
this.element = $el("div.comfy-split-button.comfy-menu-item");
|
||||
|
||||
const menu = $el(
|
||||
"ul.comfy-split-menu",
|
||||
items
|
||||
.map((item) => {
|
||||
if (item === primaryItem && !showPrimaryInList) return;
|
||||
return getMenuButtonContent("li", item);
|
||||
})
|
||||
.filter(Boolean)
|
||||
);
|
||||
|
||||
const toggle = "action" in primaryItem && primaryItem.action === "toggle";
|
||||
const primaryEl = getMenuButtonContent("button.comfy-split-primary", primaryItem, showPrimaryText);
|
||||
|
||||
if (toggle) {
|
||||
toggleOnEvent({
|
||||
event: "click",
|
||||
eventSource: primaryEl,
|
||||
className: "comfy-split-visible",
|
||||
classTarget: this.element,
|
||||
});
|
||||
}
|
||||
|
||||
const children = [
|
||||
primaryEl,
|
||||
showArrow
|
||||
? $el(
|
||||
"button.comfy-split-open",
|
||||
{
|
||||
$: (el) => {
|
||||
toggleOnEvent({
|
||||
event: "touchstart",
|
||||
eventSource: el,
|
||||
className: "comfy-split-visible",
|
||||
classTarget: this.element,
|
||||
});
|
||||
},
|
||||
},
|
||||
[$el("i.mdi.mdi-chevron-down"), menu]
|
||||
)
|
||||
: menu,
|
||||
];
|
||||
|
||||
this.element.append(...children);
|
||||
}
|
||||
}
|
||||
|
||||
export class ComfyMenuGroup {
|
||||
/**
|
||||
* @param { { className?: string, items: Array<ComfyMenuButton>, showText?: boolean } } config
|
||||
*/
|
||||
constructor({ className, items, showText = false }) {
|
||||
this.element = $el(
|
||||
"div.comfy-menu-group.comfy-menu-item",
|
||||
items.map((item) => ("onclick" in item ? item : getMenuButtonContent("button", item, showText)))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class ComfyWorkflows {
|
||||
constructor() {
|
||||
this.element = $el(
|
||||
"div.comfy-menu-item.comfy-workflow-menu",
|
||||
{
|
||||
style: { width: "150px", padding: "0 10px", display: "flex", gap: "5px" },
|
||||
},
|
||||
[
|
||||
$el("i.mdi.mdi-graph.mdi-18px", {
|
||||
style: {
|
||||
transform: "rotate(-90deg)",
|
||||
},
|
||||
}),
|
||||
$el("span", {
|
||||
style: {
|
||||
whiteSpace: "nowrap",
|
||||
textOverflow: "ellipsis",
|
||||
overflow: "hidden",
|
||||
userSelect: "none"
|
||||
}
|
||||
}, "Some complex outpainting workflow"),
|
||||
$el("i.mdi.mdi-chevron-down.mdi-18px"),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class ComfyQueueButton {
|
||||
constructor() {
|
||||
this.element = $el("div", "qqqqqqq");
|
||||
}
|
||||
}
|
||||
|
||||
export class ComfyExtraOptions {
|
||||
constructor() {
|
||||
this.element = $el("div");
|
||||
}
|
||||
}
|
||||
|
||||
export class ComfyMenu {
|
||||
constructor() {
|
||||
const mobileCollapse = (t) => {
|
||||
if (t.element) t = t.element;
|
||||
t.classList.add("comfy-menu-mobile-collapse");
|
||||
return t;
|
||||
};
|
||||
|
||||
this.el = $el("nav.comfy-app-menu", { parent: document.body });
|
||||
this.logo = $el("h1.comfy-app-logo.mobile-hide", "ComfyUI");
|
||||
this.workflows = new ComfyWorkflows();
|
||||
this.extraOptions = new ComfyExtraOptions();
|
||||
this.queueButton = new ComfyQueueButton();
|
||||
this.saveActions = new ComfyMenuSplitButton({
|
||||
items: [
|
||||
{
|
||||
id: "comfy-save-workflow-button",
|
||||
icon: "content-save",
|
||||
tooltip: "Save your current workflow",
|
||||
text: "Save",
|
||||
callback: () => {
|
||||
alert("swave");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "comfy-save-workflow-as-button",
|
||||
icon: "content-save-edit",
|
||||
tooltip: "Save your current workflow with a new name",
|
||||
text: "Save as",
|
||||
callback: () => {
|
||||
alert("swaveas");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "comfy-save-button",
|
||||
icon: "download",
|
||||
text: "Export",
|
||||
tooltip: "Download a JSON file of your workflow for sharing",
|
||||
callback: () => {},
|
||||
},
|
||||
{
|
||||
id: "comfy-dev-save-api-button",
|
||||
icon: "api",
|
||||
tooltip: "Download a JSON file in API format for use with the ComfyUI API",
|
||||
text: "Export (API format)",
|
||||
callback: () => {},
|
||||
},
|
||||
],
|
||||
});
|
||||
this.commonActions = new ComfyMenuGroup({
|
||||
items: [
|
||||
{
|
||||
id: "comfy-refresh-button",
|
||||
icon: "refresh",
|
||||
tooltip: "Refresh widgets to use newly added models or files",
|
||||
text: "Refresh",
|
||||
callback: () => {},
|
||||
},
|
||||
{
|
||||
id: "comfy-clipspace-button",
|
||||
icon: "clipboard-edit-outline",
|
||||
tooltip: "Open the Clipspace manager",
|
||||
text: "Clipspace",
|
||||
callback: () => {},
|
||||
},
|
||||
{
|
||||
id: "comfy-clear-button",
|
||||
icon: "cancel",
|
||||
tooltip: "Clear the current workflow",
|
||||
text: "Clear",
|
||||
callback: () => {},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
this.viewHistory = new ComfyMenuSplitButton({
|
||||
showArrow: false,
|
||||
items: [
|
||||
{
|
||||
id: "comfy-view-queue-button",
|
||||
icon: "history",
|
||||
tooltip: "View and manage the prompt queue",
|
||||
text: "View History",
|
||||
action: "toggle",
|
||||
},
|
||||
new ComfyQueueButton().element,
|
||||
],
|
||||
});
|
||||
|
||||
this.promptList = new ComfyMenuGroup({
|
||||
items: [
|
||||
this.viewHistory.element,
|
||||
{
|
||||
id: "comfy-view-history-button",
|
||||
icon: "format-list-numbered",
|
||||
tooltip: "View prompt history to reload previous generations",
|
||||
text: "View Queue",
|
||||
callback: () => {},
|
||||
},
|
||||
],
|
||||
});
|
||||
this.promptList.element.classList.add("mobile-pull-right");
|
||||
|
||||
this.queueActions = new ComfyMenuSplitButton({
|
||||
primary: this.queueButton.element,
|
||||
items: [
|
||||
{
|
||||
id: "queue-front-button",
|
||||
icon: "numeric-1-box-outline",
|
||||
tooltip: "Queue this prompt at the front of the queue",
|
||||
text: "Queue Front",
|
||||
callback: () => {},
|
||||
},
|
||||
this.extraOptions.element,
|
||||
],
|
||||
});
|
||||
this.queueActions.element.classList.add("pull-right");
|
||||
|
||||
this.settingsButton = new ComfyMenuGroup({
|
||||
items: [
|
||||
{
|
||||
id: "comfy-settings-btn",
|
||||
icon: "cog",
|
||||
tooltip: "Open ComfyUI settings",
|
||||
text: "Settings",
|
||||
callback: () => {},
|
||||
},
|
||||
],
|
||||
});
|
||||
this.settingsButton.element.style.background = "transparent";
|
||||
|
||||
this.mobileMenuButton = new ComfyMenuGroup({
|
||||
items: [
|
||||
{
|
||||
id: "comfy-settings-btn",
|
||||
icon: "menu",
|
||||
tooltip: "Show Menu",
|
||||
text: "Menu",
|
||||
$: (el) => {
|
||||
toggleOnEvent({
|
||||
className: "open",
|
||||
event: "click",
|
||||
eventSource: el,
|
||||
classTarget: this.el,
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
this.mobileMenuButton.element.style.background = "transparent";
|
||||
this.mobileMenuButton.element.classList.add("mobile-show");
|
||||
|
||||
this.el.append(
|
||||
this.logo,
|
||||
this.workflows.element,
|
||||
this.saveActions.element,
|
||||
mobileCollapse(this.commonActions.element),
|
||||
mobileCollapse(this.promptList.element),
|
||||
this.queueActions.element,
|
||||
mobileCollapse(this.settingsButton.element),
|
||||
this.mobileMenuButton.element
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new ComfyMenu().el);
|
||||
0
web/scripts/ui/menu/extraOptions.js
Normal file
0
web/scripts/ui/menu/extraOptions.js
Normal file
0
web/scripts/ui/menu/history.js
Normal file
0
web/scripts/ui/menu/history.js
Normal file
159
web/scripts/ui/menu/index.js
Normal file
159
web/scripts/ui/menu/index.js
Normal file
@ -0,0 +1,159 @@
|
||||
// @ts-check
|
||||
|
||||
import { $el } from "../../ui.js";
|
||||
import { addStylesheet, downloadBlob } from "../../utils.js";
|
||||
import { ComfyButton } from "../components/button.js";
|
||||
import { ComfyButtonGroup } from "../components/buttonGroup.js";
|
||||
import { ComfySplitButton } from "../components/splitButton.js";
|
||||
import { ComfyQueueButton } from "./queueButton.js";
|
||||
import { ComfyWorkflows } from "./workflows.js";
|
||||
|
||||
addStylesheet("menu.css", import.meta.url);
|
||||
|
||||
const collapseOnMobile = (t) => {
|
||||
(t.element ?? t).classList.add("comfyui-menu-mobile-collapse");
|
||||
return t;
|
||||
};
|
||||
const showOnMobile = (t) => {
|
||||
(t.element ?? t).classList.add("sm-show");
|
||||
return t;
|
||||
};
|
||||
|
||||
export class ComfyAppMenu {
|
||||
/**
|
||||
* @param { import("../../app.js").ComfyApp } app
|
||||
*/
|
||||
constructor(app) {
|
||||
this.app = app;
|
||||
|
||||
const getSaveButton = (t) =>
|
||||
new ComfyButton({
|
||||
icon: "content-save",
|
||||
tooltip: "Save the current workflow",
|
||||
action: () => this.exportWorkflow("workflow", "workflow"),
|
||||
content: t,
|
||||
});
|
||||
|
||||
this.logo = $el("h1.comfyui-logo.sm-hide", { title: "ComfyUI" }, "ComfyUI");
|
||||
this.workflows = new ComfyWorkflows();
|
||||
this.element = $el("nav.comfyui-menu", { parent: document.body }, [
|
||||
this.logo,
|
||||
this.workflows.element,
|
||||
new ComfySplitButton(
|
||||
{
|
||||
primary: getSaveButton(),
|
||||
mode: "hover",
|
||||
},
|
||||
getSaveButton("Save"),
|
||||
new ComfyButton({
|
||||
icon: "content-save-edit",
|
||||
content: "Save As",
|
||||
tooltip: "Save the current graph as a new workflow",
|
||||
}),
|
||||
new ComfyButton({
|
||||
icon: "download",
|
||||
content: "Export",
|
||||
tooltip: "Export the current workflow as JSON",
|
||||
action: () => this.exportWorkflow("workflow", "workflow"),
|
||||
}),
|
||||
new ComfyButton({
|
||||
icon: "api",
|
||||
content: "Export (API Format)",
|
||||
tooltip: "Export the current workflow as JSON for use with the ComfyUI API",
|
||||
action: () => this.exportWorkflow("workflow_api", "output"),
|
||||
visibilitySetting: { id: "Comfy.DevMode", showValue: "true" },
|
||||
app
|
||||
})
|
||||
).element,
|
||||
collapseOnMobile(
|
||||
new ComfyButtonGroup(
|
||||
new ComfyButton({
|
||||
icon: "refresh",
|
||||
content: "Refresh",
|
||||
action: () => {
|
||||
console.log("refresh");
|
||||
},
|
||||
}),
|
||||
new ComfyButton({
|
||||
icon: "clipboard-edit-outline",
|
||||
content: "Clipspace",
|
||||
action: () => {
|
||||
console.log("clipboard-edit-outline");
|
||||
},
|
||||
}),
|
||||
new ComfyButton({
|
||||
icon: "cancel",
|
||||
content: "Clear",
|
||||
action: () => {
|
||||
console.log("cancel");
|
||||
},
|
||||
})
|
||||
)
|
||||
).element,
|
||||
$el("section.comfyui-menu-push"),
|
||||
collapseOnMobile(
|
||||
new ComfyButton({
|
||||
icon: "cog",
|
||||
content: "Settings",
|
||||
action: () => {
|
||||
app.ui.settings.show();
|
||||
},
|
||||
})
|
||||
).element,
|
||||
collapseOnMobile(
|
||||
new ComfyButtonGroup(
|
||||
new ComfyButton({
|
||||
icon: "history",
|
||||
content: "View History",
|
||||
action: () => {
|
||||
console.log("history");
|
||||
},
|
||||
}),
|
||||
new ComfyButton({
|
||||
icon: "format-list-numbered",
|
||||
content: "View Queue",
|
||||
action: () => {
|
||||
console.log("format-list-numbered");
|
||||
},
|
||||
})
|
||||
)
|
||||
).element,
|
||||
new ComfyQueueButton().element,
|
||||
showOnMobile(
|
||||
new ComfyButton({
|
||||
icon: "menu",
|
||||
action: (_, btn) => {
|
||||
btn.icon = this.element.classList.toggle("expanded") ? "close" : "menu";
|
||||
},
|
||||
classList: "comfyui-button comfyui-menu-button",
|
||||
})
|
||||
).element,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} defaultName
|
||||
*/
|
||||
getFilename(defaultName) {
|
||||
if (this.app.ui.settings.getSettingValue("Comfy.PromptFilename")) {
|
||||
defaultName = prompt("Save workflow as:", defaultName);
|
||||
if (!defaultName) return;
|
||||
if (!defaultName.toLowerCase().endsWith(".json")) {
|
||||
defaultName += ".json";
|
||||
}
|
||||
}
|
||||
return defaultName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} [filename]
|
||||
* @param { "workflow" | "output" } [promptProperty]
|
||||
*/
|
||||
async exportWorkflow(filename, promptProperty) {
|
||||
const p = await this.app.graphToPrompt();
|
||||
const json = JSON.stringify(p[promptProperty], null, 2);
|
||||
const blob = new Blob([json], { type: "application/json" });
|
||||
const file = this.getFilename(filename);
|
||||
downloadBlob(file, blob);
|
||||
}
|
||||
}
|
||||
520
web/scripts/ui/menu/menu.css
Normal file
520
web/scripts/ui/menu/menu.css
Normal file
@ -0,0 +1,520 @@
|
||||
/* Utilities */
|
||||
@media only screen and (max-width: 779px) {
|
||||
.sm-hide {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 780px) {
|
||||
.sm-show {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Generic */
|
||||
.comfyui-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
.primary .comfyui-button {
|
||||
background-color: var(--primary-bg) !important;
|
||||
color: var(--primary-fg) !important;
|
||||
}
|
||||
|
||||
.primary .comfyui-button:hover {
|
||||
background-color: var(--primary-hover-bg) !important;
|
||||
color: var(--primary-hover-fg) !important;
|
||||
}
|
||||
|
||||
/* Popup */
|
||||
.comfyui-popup {
|
||||
position: absolute;
|
||||
left: var(--left);
|
||||
right: var(--right);
|
||||
top: var(--top);
|
||||
z-index: 1000;
|
||||
max-height: calc(100vh - var(--top) - 10px);
|
||||
max-width: calc(100vw - var(--left) - 10px);
|
||||
}
|
||||
|
||||
.comfyui-popup:not(.open) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Split button */
|
||||
.comfyui-split-button {
|
||||
position: relative;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.comfyui-split-primary {
|
||||
flex: auto;
|
||||
}
|
||||
|
||||
.comfyui-split-primary .comfyui-button {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
border-right: 1px solid var(--comfy-menu-bg);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.comfyui-split-arrow .comfyui-button {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
}
|
||||
|
||||
.comfyui-split-button-popup {
|
||||
white-space: nowrap;
|
||||
background-color: var(--border-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.comfyui-split-button-popup>.comfyui-button {
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
color: var(--fg-color);
|
||||
padding: 8px 12px 8px 8px;
|
||||
}
|
||||
|
||||
.comfyui-split-button-popup>.comfyui-button:hover {
|
||||
background-color: var(--comfy-input-bg)
|
||||
}
|
||||
|
||||
/* Button group */
|
||||
.comfyui-button-group {
|
||||
display: flex;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.comfyui-button-group>.comfyui-button {
|
||||
padding: 4px 10px;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/* Menu */
|
||||
.comfyui-menu {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
background: var(--comfy-menu-bg);
|
||||
color: var(--fg-color);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 0.8em;
|
||||
display: flex;
|
||||
padding: 4px 8px;
|
||||
align-items: center;
|
||||
gap: 0.8em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.comfyui-menu .mdi::before {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.comfyui-menu .comfyui-button {
|
||||
background: var(--comfy-input-bg);
|
||||
color: var(--fg-color);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.comfyui-menu .comfyui-button:hover {
|
||||
background: var(--border-color);
|
||||
}
|
||||
|
||||
.comfyui-menu .comfyui-split-button-popup>.comfyui-button {
|
||||
border-radius: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.comfyui-menu .comfyui-split-button-popup>.comfyui-button:hover {
|
||||
background-color: var(--comfy-input-bg);
|
||||
}
|
||||
|
||||
.comfyui-menu .comfyui-split-button-popup.left {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.comfyui-menu-push {
|
||||
margin-left: -0.8em;
|
||||
flex: auto;
|
||||
}
|
||||
|
||||
.comfyui-logo {
|
||||
font-size: 1.2em;
|
||||
margin: 0;
|
||||
user-select: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
@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 {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 779px) {
|
||||
.comfyui-menu {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.comfyui-menu>*:not(.comfyui-menu-mobile-collapse) {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
.comfyui-menu>.comfyui-menu-mobile-collapse {
|
||||
order: 9999;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.comfyui-menu>.comfyui-menu-mobile-collapse.comfyui-button-group {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.comfyui-menu>.comfyui-menu-mobile-collapse .comfyui-button,
|
||||
.comfyui-menu>.comfyui-menu-mobile-collapse.comfyui-button {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.comfyui-menu>.comfyui-menu-mobile-collapse .comfyui-button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.comfyui-menu:not(.expanded)>.comfyui-menu-mobile-collapse {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.comfyui-queue-action {
|
||||
margin-right: 44px;
|
||||
}
|
||||
|
||||
.comfyui-menu-button {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 480px) {
|
||||
.comfyui-workflows-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 335px) {
|
||||
.comfyui-queue-action {
|
||||
margin-right: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.comfyui-queue-action .comfyui-button {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
/* Workflows */
|
||||
.comfyui-workflows-button {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
.comfyui-workflows-button.unsaved {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.comfyui-workflows-button.unsaved .comfyui-workflows-label:after {
|
||||
content: "*"
|
||||
}
|
||||
|
||||
.comfyui-workflows-button-inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
}
|
||||
|
||||
.comfyui-workflows-button-inner .mdi-graph::before {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.comfyui-workflows-popup {
|
||||
width: 100%;
|
||||
max-width: 350px;
|
||||
padding: 10px;
|
||||
overflow: auto;
|
||||
background-color: var(--border-color);
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
|
||||
/* Queue button */
|
||||
.comfyui-queue-action .comfyui-split-primary .comfyui-button {
|
||||
padding-right: 12px;
|
||||
}
|
||||
|
||||
.comfyui-queue-count {
|
||||
margin-left: 5px;
|
||||
border-radius: 10px;
|
||||
background-color: rgb(8, 80, 153);
|
||||
padding: 2px 4px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
/*
|
||||
.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;
|
||||
}
|
||||
} */
|
||||
0
web/scripts/ui/menu/queue.js
Normal file
0
web/scripts/ui/menu/queue.js
Normal file
37
web/scripts/ui/menu/queueButton.js
Normal file
37
web/scripts/ui/menu/queueButton.js
Normal file
@ -0,0 +1,37 @@
|
||||
// @ts-check
|
||||
|
||||
import { ComfyButton } from "../components/button.js";
|
||||
import { $el } from "../../ui.js";
|
||||
import { ComfySplitButton } from "../components/splitButton.js";
|
||||
|
||||
export class ComfyQueueButton {
|
||||
element = $el("div.comfyui-queue-action");
|
||||
|
||||
constructor() {
|
||||
const btn = new ComfySplitButton(
|
||||
{
|
||||
primary: new ComfyButton({
|
||||
content: $el("div", [
|
||||
$el("span", {
|
||||
textContent: "Queue",
|
||||
}),
|
||||
$el("span.comfyui-queue-count", {
|
||||
textContent: "99+",
|
||||
title: "186 prompts queued"
|
||||
}),
|
||||
]),
|
||||
icon: "play",
|
||||
classList: "comfyui-button",
|
||||
}),
|
||||
mode: "click",
|
||||
position: "absolute",
|
||||
horizontal: "right",
|
||||
},
|
||||
new ComfyButton({
|
||||
content: $el("button", { style: { height: "300px", width: "300px" } }),
|
||||
})
|
||||
);
|
||||
btn.element.classList.add("primary");
|
||||
this.element.append(btn.element);
|
||||
}
|
||||
}
|
||||
47
web/scripts/ui/menu/workflows.js
Normal file
47
web/scripts/ui/menu/workflows.js
Normal file
@ -0,0 +1,47 @@
|
||||
// @ts-check
|
||||
|
||||
import { ComfyButton } from "../components/button.js";
|
||||
import { prop } from "../../utils.js";
|
||||
import { $el } from "../../ui.js";
|
||||
import { ComfyPopup } from "../components/popup.js";
|
||||
|
||||
export class ComfyWorkflows {
|
||||
element = $el("div.comfyui-workflows");
|
||||
|
||||
get open() {
|
||||
return this.popup.open;
|
||||
}
|
||||
|
||||
set open(open) {
|
||||
this.popup.open = open;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
const classList = {
|
||||
"comfyui-workflows-button": true,
|
||||
"comfyui-button": true,
|
||||
unsaved: true,
|
||||
};
|
||||
this.button = new ComfyButton({
|
||||
content: $el("div.comfyui-workflows-button-inner", [$el("i.mdi.mdi-graph"), $el("span.comfyui-workflows-label", "Unsaved workflow")]),
|
||||
icon: "chevron-down",
|
||||
classList,
|
||||
});
|
||||
|
||||
this.element.append(this.button.element);
|
||||
|
||||
this.popup = new ComfyPopup(
|
||||
{ target: this.element, classList: "comfyui-workflows-popup" },
|
||||
$el("button", { style: { height: "300px" } }, "aaa")
|
||||
);
|
||||
this.popup.addEventListener("change", () => {
|
||||
this.button.icon = "chevron-" + (this.popup.open ? "up" : "down");
|
||||
});
|
||||
this.button.withPopup(this.popup);
|
||||
|
||||
this.unsaved = prop(this, "unsaved", classList.unsaved, (v) => {
|
||||
classList.unsaved = v;
|
||||
this.button.classList = classList;
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -37,6 +37,17 @@ export class ComfySettingsDialog extends ComfyDialog {
|
||||
return Object.values(this.settingsLookup);
|
||||
}
|
||||
|
||||
#dispatchChange(id, value, oldValue) {
|
||||
this.dispatchEvent(
|
||||
new CustomEvent(id + ".change", {
|
||||
detail: {
|
||||
value,
|
||||
oldValue
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
async load() {
|
||||
if (this.app.storageLocation === "browser") {
|
||||
this.settingsValues = localStorage;
|
||||
@ -46,7 +57,9 @@ export class ComfySettingsDialog extends ComfyDialog {
|
||||
|
||||
// Trigger onChange for any settings added before load
|
||||
for (const id in this.settingsLookup) {
|
||||
this.settingsLookup[id].onChange?.(this.settingsValues[this.getId(id)]);
|
||||
const value = this.settingsValues[this.getId(id)];
|
||||
this.settingsLookup[id].onChange?.(value);
|
||||
this.#dispatchChange(id, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +93,7 @@ export class ComfySettingsDialog extends ComfyDialog {
|
||||
if (id in this.settingsLookup) {
|
||||
this.settingsLookup[id].onChange?.(value, oldValue);
|
||||
}
|
||||
this.#dispatchChange(id, value, oldValue);
|
||||
|
||||
await api.storeSetting(id, value);
|
||||
}
|
||||
|
||||
56
web/scripts/ui/utils.js
Normal file
56
web/scripts/ui/utils.js
Normal file
@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @typedef { string | string[] | Record<string, boolean> } ClassList
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param { HTMLElement } element
|
||||
* @param { ClassList } classList
|
||||
* @param { string[] } requiredClasses
|
||||
*/
|
||||
export function applyClasses(element, classList, ...requiredClasses) {
|
||||
classList ??= "";
|
||||
|
||||
let str;
|
||||
if (typeof classList === "string") {
|
||||
str = classList;
|
||||
} else if (classList instanceof Array) {
|
||||
str = classList.join(" ");
|
||||
} else {
|
||||
str = Object.entries(classList).reduce((p, c) => {
|
||||
if (c[1]) {
|
||||
p += (p.length ? " " : "") + c[0];
|
||||
}
|
||||
return p;
|
||||
}, "");
|
||||
}
|
||||
element.className = str;
|
||||
if (requiredClasses) {
|
||||
element.classList.add(...requiredClasses);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param { HTMLElement } element
|
||||
* @param { { onHide?: (el: HTMLElement) => void, onShow?: (el: HTMLElement, value) => void } } [param1]
|
||||
* @returns
|
||||
*/
|
||||
export function toggleElement(element, { onHide, onShow } = {}) {
|
||||
let placeholder;
|
||||
let hidden;
|
||||
return (value) => {
|
||||
if (value) {
|
||||
if (hidden) {
|
||||
hidden = false;
|
||||
placeholder.replaceWith(element);
|
||||
}
|
||||
onShow?.(element, value);
|
||||
} else {
|
||||
if (!placeholder) {
|
||||
placeholder = document.createComment("");
|
||||
}
|
||||
hidden = true;
|
||||
element.replaceWith(placeholder);
|
||||
onHide?.(element);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -86,3 +86,44 @@ export async function addStylesheet(urlOrFile, relativeTo) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param { string } filename
|
||||
* @param { Blob } blob
|
||||
*/
|
||||
export function downloadBlob(filename, blob) {
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = $el("a", {
|
||||
href: url,
|
||||
download: filename,
|
||||
style: { display: "none" },
|
||||
parent: document.body,
|
||||
});
|
||||
a.click();
|
||||
setTimeout(function () {
|
||||
a.remove();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @param {string} name
|
||||
* @param {T} [defaultValue]
|
||||
* @param {(currentValue: any, previousValue: any)=>void} [onChanged]
|
||||
* @returns {T}
|
||||
*/
|
||||
export function prop(target, name, defaultValue, onChanged) {
|
||||
let currentValue;
|
||||
Object.defineProperty(target, name, {
|
||||
get() {
|
||||
return currentValue;
|
||||
},
|
||||
set(newValue) {
|
||||
const prevValue = currentValue;
|
||||
currentValue = newValue;
|
||||
onChanged?.(currentValue, prevValue, target, name);
|
||||
},
|
||||
});
|
||||
return defaultValue;
|
||||
}
|
||||
@ -1,301 +0,0 @@
|
||||
import { $el } from "./ui.js";
|
||||
import { addStylesheet } from "./utils.js";
|
||||
|
||||
addStylesheet("https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css");
|
||||
|
||||
const $i = (n, s = 24, o) => $el(`span.mdi.mdi-${n}${s ? `.mdi-${s}px` : ""}`, o ?? {});
|
||||
|
||||
$el(
|
||||
"style",
|
||||
{ parent: document.head },
|
||||
`
|
||||
.comfy-nav {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 450px;
|
||||
z-index: 99;
|
||||
background: var(--comfy-menu-bg);
|
||||
font-family: Arial;
|
||||
padding: 4px 8px;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
width: calc(100vw - 16px);
|
||||
height: 30px;
|
||||
color: var(--fg-color);
|
||||
|
||||
h1 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.comfy-nav-split-btn {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
height: 100%;
|
||||
color: var(--fg-color);
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
border-radius: 4px;
|
||||
background: var(--comfy-input-bg);
|
||||
position: relative;
|
||||
.mdi {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.mdi:hover {
|
||||
background: var(--border-color);
|
||||
}
|
||||
.btn-icon {
|
||||
display: flex;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
padding: 0 8px;
|
||||
}
|
||||
.mdi-chevron-down {
|
||||
border-left: 1px solid var(--border-color);
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
.mdi-chevron-down:hover .comfy-nav-split-dropdown {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.comfy-nav-split-dropdown {
|
||||
display: none;
|
||||
background: var(--border-color);
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
|
||||
li {
|
||||
white-space: nowrap;
|
||||
padding: 8px 10px;
|
||||
text-align: left;
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
align-items: center;
|
||||
}
|
||||
li:hover {
|
||||
background: var(--comfy-input-bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mdi {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.comfy-workflow-nav {
|
||||
border-radius: 4px;
|
||||
height: 100%;
|
||||
padding: 0 5px 0 10px;
|
||||
background: var(--comfy-input-bg);
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
.comfy-workflow-list {
|
||||
display: none
|
||||
}
|
||||
}
|
||||
.comfy-workflow-nav:hover {
|
||||
background: var(--border-color);
|
||||
}
|
||||
|
||||
.unsaved {
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
export class Workflows {
|
||||
/** @type { boolean } */
|
||||
#autoSave;
|
||||
|
||||
/** @type { string | undefined } */
|
||||
name;
|
||||
|
||||
get autoSave() {
|
||||
return this.#autoSave;
|
||||
}
|
||||
|
||||
set autoSave(value) {
|
||||
this.#autoSave = value;
|
||||
}
|
||||
|
||||
async loadWorkflows() {}
|
||||
|
||||
async saveWorkflow() {}
|
||||
|
||||
async newWorkflow(name) {}
|
||||
|
||||
constructor() {
|
||||
const el = $el(
|
||||
"nav.comfy-nav",
|
||||
{
|
||||
style: {},
|
||||
},
|
||||
[
|
||||
$el("span.mdi.mdi-graph-outline.mdi-24px", { style: { marginRight: "-5px", transform: "rotate(-90deg)" } }),
|
||||
$el("h1", "ComfyUI"),
|
||||
$el("div.comfy-workflow-nav", [
|
||||
$el("span.unsaved", "Unsaved Workflow*"),
|
||||
$i("chevron-down", 18),
|
||||
$el("div.comfy-workflow-list", []),
|
||||
]),
|
||||
$el("button.comfy-nav-split-btn", {}, [
|
||||
$i("content-save.btn-icon", 18),
|
||||
$el("span.mdi.mdi-chevron-down.mdi-18px", [
|
||||
$el(
|
||||
"div",
|
||||
{
|
||||
style: {
|
||||
position: "absolute",
|
||||
top: "calc(100% - 2px)",
|
||||
right: 0,
|
||||
background: "var(--comfy-menu-bg)",
|
||||
},
|
||||
},
|
||||
$el(
|
||||
"ul.comfy-nav-split-dropdown",
|
||||
{
|
||||
style: {
|
||||
listStyle: "none",
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
whiteSpace: "no-wrap",
|
||||
},
|
||||
},
|
||||
[
|
||||
$el("li", [$i("content-save", 18), $el("span", "Save")]),
|
||||
$el("li", [$i("content-save-edit", 18), $el("span", "Save as")]),
|
||||
$el("li", [$i("api", 18), $el("span", "Save (API format)")]),
|
||||
$el("li", [$i("download", 18), $el("span", "Download")]),
|
||||
// $el("li", {
|
||||
// style: {
|
||||
// borderTop: "1px solid rgba(255,255,255,0.5)"
|
||||
// }
|
||||
// }, [$i("checkbox-outline", 18), $el("span", "Auto save (on)")]),
|
||||
]
|
||||
)
|
||||
),
|
||||
]),
|
||||
]),
|
||||
$el(
|
||||
"div",
|
||||
{
|
||||
style: {
|
||||
height: "100%",
|
||||
background: "var(--comfy-input-bg)",
|
||||
borderRadius: "4px",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
},
|
||||
},
|
||||
[
|
||||
$i("refresh", 24, { style: { background: "var(--comfy-input-bg)", borderRadius: "4px", padding: "0 10px" } }),
|
||||
$el("div", { style: { width: "1px", height: "90%", background: "var(--border-color", opacity: "0.5" } }),
|
||||
$i("clipboard-edit-outline", 24, { style: { background: "var(--comfy-input-bg)", borderRadius: "4px", padding: "0 10px" } }),
|
||||
$el("div", { style: { width: "1px", height: "90%", background: "var(--border-color", opacity: "0.5" } }),
|
||||
$i("cancel", 24, { style: { background: "var(--comfy-input-bg)", borderRadius: "4px", padding: "0 10px" } }),
|
||||
]
|
||||
),
|
||||
$el(
|
||||
"div",
|
||||
{
|
||||
style: {
|
||||
marginLeft: "auto",
|
||||
height: "100%",
|
||||
background: "var(--comfy-input-bg)",
|
||||
borderRadius: "4px",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
},
|
||||
},
|
||||
[
|
||||
$i("history", 24, { style: { background: "var(--comfy-input-bg)", borderRadius: "4px", padding: "0 10px" } }),
|
||||
$el("div", { style: { width: "1px", height: "90%", background: "var(--border-color", opacity: "0.5" } }),
|
||||
$i("format-list-numbered", 24, { style: { background: "var(--comfy-input-bg)", borderRadius: "4px", padding: "0 10px" } }),
|
||||
]
|
||||
),
|
||||
$el(
|
||||
"button.comfy-nav-split-btn",
|
||||
{
|
||||
|
||||
},
|
||||
[
|
||||
$i("play.btn-icon"),
|
||||
$el(
|
||||
"span.btn-icon",
|
||||
{
|
||||
style: {
|
||||
width: "60px",
|
||||
position: "relative",
|
||||
top: "7px",
|
||||
left: "-10px",
|
||||
},
|
||||
},
|
||||
[
|
||||
$el("span", "Queue"),
|
||||
$el(
|
||||
"span",
|
||||
{
|
||||
style: {
|
||||
background: "dodgerblue",
|
||||
color: "#fff",
|
||||
height: "16px",
|
||||
borderRadius: "25%",
|
||||
marginLeft: "5px",
|
||||
padding: "0 2px",
|
||||
},
|
||||
},
|
||||
"182"
|
||||
),
|
||||
]
|
||||
),
|
||||
$el("span.mdi.mdi-chevron-down.mdi-18px", [
|
||||
$el(
|
||||
"div",
|
||||
{
|
||||
style: {
|
||||
position: "absolute",
|
||||
top: "calc(100% - 2px)",
|
||||
right: 0,
|
||||
background: "var(--comfy-menu-bg)",
|
||||
},
|
||||
},
|
||||
$el(
|
||||
"ul.comfy-nav-split-dropdown",
|
||||
{
|
||||
style: {
|
||||
listStyle: "none",
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
whiteSpace: "no-wrap",
|
||||
},
|
||||
},
|
||||
[
|
||||
$el("li", [$i("numeric-1-box-outline", 18), $el("span", "Queue front")]),
|
||||
$el("li", [$el("div", {}, [
|
||||
|
||||
])])
|
||||
// $el("li", {
|
||||
// style: {
|
||||
// borderTop: "1px solid rgba(255,255,255,0.5)"
|
||||
// }
|
||||
// }, [$i("checkbox-outline", 18), $el("span", "Auto save (on)")]),
|
||||
]
|
||||
)
|
||||
),
|
||||
]),
|
||||
]
|
||||
),
|
||||
$i("cog", 24, { style: { } }),
|
||||
]
|
||||
);
|
||||
|
||||
document.body.append(el);
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,10 @@
|
||||
--border-color: #4e4e4e;
|
||||
--tr-even-bg-color: #222;
|
||||
--tr-odd-bg-color: #353535;
|
||||
--primary-bg: #236692;
|
||||
--primary-fg: #ffffff;
|
||||
--primary-hover-bg: #3485bb;
|
||||
--primary-hover-fg: #ffffff;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user