Migrate widgets.js (#4)

* Rename js to ts

* Fix ts error

* nit
This commit is contained in:
Chenlei Hu
2024-06-14 09:23:21 -04:00
committed by GitHub
parent 74abc34624
commit 92b08c0808
5 changed files with 7 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
import {app} from "../../scripts/app.js";
import {ComfyWidgets} from "../../scripts/widgets.js";
import {ComfyWidgets} from "../../scripts/widgets";
// Node that add notes to your project
app.registerExtension({

View File

@@ -1,5 +1,5 @@
import { app } from "../../scripts/app.js";
import { ComfyWidgets } from "../../scripts/widgets.js";
import { ComfyWidgets } from "../../scripts/widgets";
// Adds defaults for quickly adding nodes with middle click on the input/output
app.registerExtension({

View File

@@ -1,4 +1,4 @@
import { ComfyWidgets, addValueControlWidgets } from "../../scripts/widgets.js";
import { ComfyWidgets, addValueControlWidgets } from "../../scripts/widgets";
import { app } from "../../scripts/app.js";
import { applyTextReplacements } from "../../scripts/utils.js";

View File

@@ -1,5 +1,5 @@
import { ComfyLogging } from "./logging.js";
import { ComfyWidgets, initWidgets } from "./widgets.js";
import { ComfyWidgets, initWidgets } from "./widgets";
import { ComfyUI, $el } from "./ui.js";
import { api } from "./api.js";
import { defaultGraph } from "./defaultGraph.js";

View File

@@ -213,7 +213,7 @@ function seedWidget(node, inputName, inputData, app, widgetName) {
return seed;
}
function createIntWidget(node, inputName, inputData, app, isSeedInput) {
function createIntWidget(node, inputName, inputData, app, isSeedInput: boolean = false) {
const control = inputData[1]?.control_after_generate;
if (!isSeedInput && control) {
return seedWidget(node, inputName, inputData, app, typeof control === "string" ? control : undefined);
@@ -398,13 +398,11 @@ export const ComfyWidgets = {
},
get : function() {
let value = "";
if (this._real_value) {
value = this._real_value;
} else {
if (!this._real_value) {
return default_value;
}
let value = this._real_value;
if (value.filename) {
let real_value = value;
value = "";