mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
Bundle all core extensions (#27)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { ComfyDialog, $el } from "../../scripts/ui.js";
|
import { ComfyDialog, $el } from "../../scripts/ui";
|
||||||
import { ComfyApp } from "../../scripts/app.js";
|
import { ComfyApp } from "../../scripts/app";
|
||||||
|
|
||||||
export class ClipspaceDialog extends ComfyDialog {
|
export class ClipspaceDialog extends ComfyDialog {
|
||||||
static items = [];
|
static items = [];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {app} from "../../scripts/app.js";
|
import {app} from "../../scripts/app";
|
||||||
import {$el} from "../../scripts/ui.js";
|
import {$el} from "../../scripts/ui";
|
||||||
|
|
||||||
// Manage color palettes
|
// Manage color palettes
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {app} from "../../scripts/app.js";
|
import {app} from "../../scripts/app";
|
||||||
|
|
||||||
// Adds filtering to combo context menus
|
// Adds filtering to combo context menus
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
|
|
||||||
// Allows for simple dynamic prompt replacement
|
// Allows for simple dynamic prompt replacement
|
||||||
// Inputs in the format {a|b} will have a random value of a or b chosen when the prompt is queued.
|
// Inputs in the format {a|b} will have a random value of a or b chosen when the prompt is queued.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
|
|
||||||
// Allows you to edit the attention weight by holding ctrl (or cmd) and using the up/down arrow keys
|
// Allows you to edit the attention weight by holding ctrl (or cmd) and using the up/down arrow keys
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { api } from "../../scripts/api.js";
|
import { api } from "../../scripts/api";
|
||||||
import { mergeIfValid } from "./widgetInputs.js";
|
import { mergeIfValid } from "./widgetInputs";
|
||||||
import { ManageGroupDialog } from "./groupNodeManage.js";
|
import { ManageGroupDialog } from "./groupNodeManage";
|
||||||
|
|
||||||
const GROUP = Symbol();
|
const GROUP = Symbol();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { $el, ComfyDialog } from "../../scripts/ui.js";
|
import { $el, ComfyDialog } from "../../scripts/ui";
|
||||||
import { DraggableList } from "../../scripts/ui/draggableList.js";
|
import { DraggableList } from "../../scripts/ui/draggableList";
|
||||||
import { addStylesheet } from "../../scripts/utils.js";
|
import { addStylesheet } from "../../scripts/utils";
|
||||||
import { GroupNodeConfig, GroupNodeHandler } from "./groupNode.js";
|
import { GroupNodeConfig, GroupNodeHandler } from "./groupNode";
|
||||||
|
|
||||||
addStylesheet(import.meta.url);
|
addStylesheet(import.meta.url);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {app} from "../../scripts/app.js";
|
import {app} from "../../scripts/app";
|
||||||
|
|
||||||
function setNodeMode(node, mode) {
|
function setNodeMode(node, mode) {
|
||||||
node.mode = mode;
|
node.mode = mode;
|
||||||
|
|||||||
23
src/extensions/core/index.js
Normal file
23
src/extensions/core/index.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import "./clipspace";
|
||||||
|
import "./colorPalette";
|
||||||
|
import "./contextMenuFilter";
|
||||||
|
import "./dynamicPrompts";
|
||||||
|
import "./editAttention";
|
||||||
|
import "./groupNode";
|
||||||
|
import "./groupNodeManage";
|
||||||
|
import "./groupOptions";
|
||||||
|
import "./invertMenuScrolling";
|
||||||
|
import "./keybinds";
|
||||||
|
import "./linkRenderMode";
|
||||||
|
import "./maskeditor";
|
||||||
|
import "./nodeTemplates";
|
||||||
|
import "./noteNode";
|
||||||
|
import "./rerouteNode";
|
||||||
|
import "./saveImageExtraOutput";
|
||||||
|
import "./simpleTouchSupport";
|
||||||
|
import "./slotDefaults";
|
||||||
|
import "./snapToGrid";
|
||||||
|
import "./undoRedo";
|
||||||
|
import "./uploadImage";
|
||||||
|
import "./webcamCapture";
|
||||||
|
import "./widgetInputs";
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
|
|
||||||
// Inverts the scrolling of context menus
|
// Inverts the scrolling of context menus
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {app} from "../../scripts/app.js";
|
import {app} from "../../scripts/app";
|
||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "Comfy.Keybinds",
|
name: "Comfy.Keybinds",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
|
|
||||||
const id = "Comfy.LinkRenderMode";
|
const id = "Comfy.LinkRenderMode";
|
||||||
const ext = {
|
const ext = {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { ComfyDialog, $el } from "../../scripts/ui.js";
|
import { ComfyDialog, $el } from "../../scripts/ui";
|
||||||
import { ComfyApp } from "../../scripts/app.js";
|
import { ComfyApp } from "../../scripts/app";
|
||||||
import { api } from "../../scripts/api.js"
|
import { api } from "../../scripts/api";
|
||||||
import { ClipspaceDialog } from "./clipspace.js";
|
import { ClipspaceDialog } from "./clipspace";
|
||||||
|
|
||||||
// Helper function to convert a data URL to a Blob object
|
// Helper function to convert a data URL to a Blob object
|
||||||
function dataURLToBlob(dataURL) {
|
function dataURLToBlob(dataURL) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { api } from "../../scripts/api.js";
|
import { api } from "../../scripts/api";
|
||||||
import { ComfyDialog, $el } from "../../scripts/ui.js";
|
import { ComfyDialog, $el } from "../../scripts/ui";
|
||||||
import { GroupNodeConfig, GroupNodeHandler } from "./groupNode.js";
|
import { GroupNodeConfig, GroupNodeHandler } from "./groupNode";
|
||||||
|
|
||||||
// Adds the ability to save and add multiple nodes as a template
|
// Adds the ability to save and add multiple nodes as a template
|
||||||
// To save:
|
// To save:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {app} from "../../scripts/app.js";
|
import {app} from "../../scripts/app";
|
||||||
import {ComfyWidgets} from "../../scripts/widgets.js";
|
import {ComfyWidgets} from "../../scripts/widgets";
|
||||||
// Node that add notes to your project
|
// Node that add notes to your project
|
||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { mergeIfValid, getWidgetConfig, setWidgetConfig } from "./widgetInputs.js";
|
import { mergeIfValid, getWidgetConfig, setWidgetConfig } from "./widgetInputs";
|
||||||
|
|
||||||
// Node that allows you to redirect connections for cleaner graphs
|
// Node that allows you to redirect connections for cleaner graphs
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { applyTextReplacements } from "../../scripts/utils.js";
|
import { applyTextReplacements } from "../../scripts/utils";
|
||||||
// Use widget values and dates in output filenames
|
// Use widget values and dates in output filenames
|
||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
|
|
||||||
let touchZooming;
|
let touchZooming;
|
||||||
let touchCount = 0;
|
let touchCount = 0;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { ComfyWidgets } from "../../scripts/widgets.js";
|
import { ComfyWidgets } from "../../scripts/widgets";
|
||||||
// Adds defaults for quickly adding nodes with middle click on the input/output
|
// Adds defaults for quickly adding nodes with middle click on the input/output
|
||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
|
|
||||||
// Shift + drag/resize to snap to grid
|
// Shift + drag/resize to snap to grid
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { api } from "../../scripts/api.js"
|
import { api } from "../../scripts/api";
|
||||||
|
|
||||||
const MAX_HISTORY = 50;
|
const MAX_HISTORY = 50;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
|
|
||||||
// Adds an upload button to the nodes
|
// Adds an upload button to the nodes
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { api } from "../../scripts/api.js";
|
import { api } from "../../scripts/api";
|
||||||
|
|
||||||
const WEBCAM_READY = Symbol();
|
const WEBCAM_READY = Symbol();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ComfyWidgets, addValueControlWidgets } from "../../scripts/widgets.js";
|
import { ComfyWidgets, addValueControlWidgets } from "../../scripts/widgets";
|
||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app";
|
||||||
import { applyTextReplacements } from "../../scripts/utils.js";
|
import { applyTextReplacements } from "../../scripts/utils";
|
||||||
|
|
||||||
const CONVERTED_TYPE = "converted-widget";
|
const CONVERTED_TYPE = "converted-widget";
|
||||||
const VALID_TYPES = ["STRING", "combo", "number", "BOOLEAN"];
|
const VALID_TYPES = ["STRING", "combo", "number", "BOOLEAN"];
|
||||||
|
|||||||
@@ -1503,14 +1503,19 @@ export class ComfyApp {
|
|||||||
const extensions = await api.getExtensions();
|
const extensions = await api.getExtensions();
|
||||||
this.logging.addEntry("Comfy.App", "debug", { Extensions: extensions });
|
this.logging.addEntry("Comfy.App", "debug", { Extensions: extensions });
|
||||||
|
|
||||||
const extensionPromises = extensions.map(async ext => {
|
const extensionPromises = extensions
|
||||||
|
.filter(extension => !extension.includes("extensions/core"))
|
||||||
|
.map(async ext => {
|
||||||
try {
|
try {
|
||||||
await import(api.apiURL(ext));
|
await import(/* @vite-ignore */api.apiURL(ext));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error loading extension", ext, error);
|
console.error("Error loading extension", ext, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Need to load core extensions first as some custom extensions
|
||||||
|
// may depend on them.
|
||||||
|
await import("../extensions/core/index.js");
|
||||||
await Promise.all(extensionPromises);
|
await Promise.all(extensionPromises);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ function comfyAPIPlugin(): Plugin {
|
|||||||
return {
|
return {
|
||||||
name: 'comfy-api-plugin',
|
name: 'comfy-api-plugin',
|
||||||
transform(code: string, id: string) {
|
transform(code: string, id: string) {
|
||||||
if (id.endsWith('.ts')) {
|
// TODO: Remove second condition after all js files are converted to ts
|
||||||
|
if (id.endsWith('.ts') || (id.endsWith('.js') && id.includes("extensions/core"))) {
|
||||||
const result = transformExports(code, id);
|
const result = transformExports(code, id);
|
||||||
|
|
||||||
if (result.exports.length > 0) {
|
if (result.exports.length > 0) {
|
||||||
@@ -87,7 +88,6 @@ export default defineConfig({
|
|||||||
viteStaticCopy({
|
viteStaticCopy({
|
||||||
targets: [
|
targets: [
|
||||||
{src: "src/lib/*", dest: "lib/"},
|
{src: "src/lib/*", dest: "lib/"},
|
||||||
{src: "src/extensions/*", dest: "extensions/"},
|
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user