Let's try this. Global LiteGraph with the wrong types.

This commit is contained in:
DrJKL
2023-11-27 18:18:44 -08:00
parent 4686a3d9f7
commit 9de52bb2c3
3 changed files with 26 additions and 20 deletions
+4
View File
@@ -1 +1,5 @@
declare global {
const LiteGraph: any;
const LGraphCanvas: any;
}
export {};
+14 -15
View File
@@ -1,24 +1,23 @@
var c = Object.defineProperty;
var i = (r, o, t) => o in r ? c(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
var e = (r, o, t) => (i(r, typeof o != "symbol" ? o + "" : o, t), t);
import { LiteGraph as l, LGraphCanvas as s } from "../../../lib/litegraph.core.js";
import { app as n } from "../../../scripts/app.js";
import { ComfyWidgets as a } from "../../../scripts/widgets.js";
function p() {
var s = Object.defineProperty;
var l = (r, o, t) => o in r ? s(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
var e = (r, o, t) => (l(r, typeof o != "symbol" ? o + "" : o, t), t);
import { app as c } from "../../../scripts/app.js";
import { ComfyWidgets as i } from "../../../scripts/widgets.js";
function a() {
console.log("%cSetting up ComfyUI-Anchors...", "color:green");
}
n.registerExtension({
c.registerExtension({
name: "drjkl.custom_nodes.anchors",
async registerCustomNodes(r) {
class o {
constructor() {
e(this, "color", s.node_colors.yellow.color);
e(this, "bgcolor", s.node_colors.yellow.bgcolor);
e(this, "groupcolor", s.node_colors.yellow.groupcolor);
e(this, "color", LGraphCanvas.node_colors.yellow.color);
e(this, "bgcolor", LGraphCanvas.node_colors.yellow.bgcolor);
e(this, "groupcolor", LGraphCanvas.node_colors.yellow.groupcolor);
e(this, "serialize_widgets", !0);
e(this, "isVirtualNode", !0);
e(this, "properties", { text: "" });
a.STRING(
i.STRING(
this,
"",
["", { default: this.properties.text, multiline: !1 }],
@@ -26,16 +25,16 @@ n.registerExtension({
);
}
}
e(o, "category", "utils"), l.registerNodeType(
e(o, "category", "utils"), LiteGraph.registerNodeType(
"Anchor",
Object.assign(o, {
title_mode: l.NORMAL_TITLE,
title_mode: LiteGraph.NORMAL_TITLE,
title: "⚓",
collapsable: !0
})
);
},
async setup() {
p();
a();
}
});
+8 -5
View File
@@ -1,10 +1,13 @@
import {
LGraphCanvas,
LiteGraph,
} from '../../ComfyUI/web/lib/litegraph.core.js';
import { app } from '../../ComfyUI/web/scripts/app.js';
import { ComfyWidgets } from '../../ComfyUI/web/scripts/widgets.js';
import { ComfyExtension } from '../../ComfyUI/web/types/comfy';
import { type ComfyExtension } from '../../ComfyUI/web/types/comfy';
declare global {
// TODO: Oh god... What have I gotten myself into...?
// Nah, this'll be fun.
const LiteGraph: any;
const LGraphCanvas: any;
}
function setupAnchors() {
console.log(`%cSetting up ComfyUI-Anchors...`, 'color:green');