mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2026-05-13 18:37:25 +08:00
Fix deprecated ui.js, button.js and buttonGroup.js imports in comfyui-manager.js
This commit is contained in:
parent
c09c86e7c5
commit
85a189e225
@ -1,6 +1,5 @@
|
|||||||
import { api } from "../../scripts/api.js";
|
import { api } from "../../scripts/api.js";
|
||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app.js";
|
||||||
import { $el, ComfyDialog } from "../../scripts/ui.js";
|
|
||||||
import {
|
import {
|
||||||
SUPPORTED_OUTPUT_NODE_TYPES,
|
SUPPORTED_OUTPUT_NODE_TYPES,
|
||||||
ShareDialog,
|
ShareDialog,
|
||||||
@ -22,6 +21,27 @@ import { ModelManager } from "./model-manager.js";
|
|||||||
import { SnapshotManager } from "./snapshot.js";
|
import { SnapshotManager } from "./snapshot.js";
|
||||||
import { buildGuiFrame, createSettingsCombo } from "./comfyui-gui-builder.js";
|
import { buildGuiFrame, createSettingsCombo } from "./comfyui-gui-builder.js";
|
||||||
|
|
||||||
|
// === SHIM FOR NEW COMFYUI (removes ui.js, button.js + buttonGroup.js warnings) ===
|
||||||
|
let $el, ComfyDialog, ComfyButton, ComfyButtonGroup;
|
||||||
|
|
||||||
|
if (window?.comfyAPI?.ui) {
|
||||||
|
({ $el, ComfyDialog } = window.comfyAPI.ui);
|
||||||
|
} else {
|
||||||
|
({ $el, ComfyDialog } = await import("../../scripts/ui.js"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window?.comfyAPI?.button) {
|
||||||
|
ComfyButton = window.comfyAPI.button.ComfyButton;
|
||||||
|
} else {
|
||||||
|
ComfyButton = (await import("../../scripts/ui/components/button.js")).ComfyButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window?.comfyAPI?.buttonGroup?.ComfyButtonGroup) {
|
||||||
|
ComfyButtonGroup = window.comfyAPI.buttonGroup.ComfyButtonGroup;
|
||||||
|
} else {
|
||||||
|
ComfyButtonGroup = (await import("../../scripts/ui/components/buttonGroup.js")).ComfyButtonGroup;
|
||||||
|
}
|
||||||
|
|
||||||
let manager_version = await getVersion();
|
let manager_version = await getVersion();
|
||||||
|
|
||||||
var docStyle = document.createElement('style');
|
var docStyle = document.createElement('style');
|
||||||
@ -1567,8 +1587,9 @@ app.registerExtension({
|
|||||||
try {
|
try {
|
||||||
// new style Manager buttons
|
// new style Manager buttons
|
||||||
// unload models button into new style Manager button
|
// unload models button into new style Manager button
|
||||||
let cmGroup = new (await import("../../scripts/ui/components/buttonGroup.js")).ComfyButtonGroup(
|
// Use hoisted ComfyButton + ComfyButtonGroup from shim at top of file
|
||||||
new(await import("../../scripts/ui/components/button.js")).ComfyButton({
|
let cmGroup = new ComfyButtonGroup(
|
||||||
|
new ComfyButton({
|
||||||
icon: "puzzle",
|
icon: "puzzle",
|
||||||
action: () => {
|
action: () => {
|
||||||
if(!manager_instance)
|
if(!manager_instance)
|
||||||
@ -1579,7 +1600,7 @@ app.registerExtension({
|
|||||||
content: "Manager",
|
content: "Manager",
|
||||||
classList: "comfyui-button comfyui-menu-mobile-collapse primary"
|
classList: "comfyui-button comfyui-menu-mobile-collapse primary"
|
||||||
}).element,
|
}).element,
|
||||||
new(await import("../../scripts/ui/components/button.js")).ComfyButton({
|
new ComfyButton({
|
||||||
icon: "star",
|
icon: "star",
|
||||||
action: () => {
|
action: () => {
|
||||||
if(!manager_instance)
|
if(!manager_instance)
|
||||||
@ -1592,21 +1613,21 @@ app.registerExtension({
|
|||||||
},
|
},
|
||||||
tooltip: "Show favorite custom node list"
|
tooltip: "Show favorite custom node list"
|
||||||
}).element,
|
}).element,
|
||||||
new(await import("../../scripts/ui/components/button.js")).ComfyButton({
|
new ComfyButton({
|
||||||
icon: "vacuum-outline",
|
icon: "vacuum-outline",
|
||||||
action: () => {
|
action: () => {
|
||||||
free_models();
|
free_models();
|
||||||
},
|
},
|
||||||
tooltip: "Unload Models"
|
tooltip: "Unload Models"
|
||||||
}).element,
|
}).element,
|
||||||
new(await import("../../scripts/ui/components/button.js")).ComfyButton({
|
new ComfyButton({
|
||||||
icon: "vacuum",
|
icon: "vacuum",
|
||||||
action: () => {
|
action: () => {
|
||||||
free_models(true);
|
free_models(true);
|
||||||
},
|
},
|
||||||
tooltip: "Free model and node cache"
|
tooltip: "Free model and node cache"
|
||||||
}).element,
|
}).element,
|
||||||
new(await import("../../scripts/ui/components/button.js")).ComfyButton({
|
new ComfyButton({
|
||||||
icon: "share",
|
icon: "share",
|
||||||
action: () => {
|
action: () => {
|
||||||
if (share_option === 'openart') {
|
if (share_option === 'openart') {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user