Serialize node links instead of widget values

Syncing litegraph widget state is kinda annoying, and unnecessary since
everything will be moved to separate UI component nodes. Instead I
modified the input slot type to store the min/max/step to be copied into
the default UI node later. Now nothing uses litegraph's widgets anymore
This commit is contained in:
space-nuko
2023-04-30 16:37:15 -07:00
parent 1b64c3a502
commit 7880c68d7f
10 changed files with 254 additions and 213 deletions

View File

@@ -5,6 +5,7 @@ import TextWidget from "$lib/widgets/TextWidget.svelte";
import { type WidgetUIState } from "$lib/stores/nodeState";
import { get } from "svelte/store"
import layoutState from "$lib/stores/layoutState"
import type { SvelteComponentDev } from "svelte/internal";
export function download(filename: string, text: string, type: string = "text/plain") {
const blob = new Blob([text], { type: type });
@@ -20,13 +21,11 @@ export function download(filename: string, text: string, type: string = "text/pl
}, 0);
}
export function getComponentForWidgetState(item: WidgetUIState): any {
let ctor: any = null;
export function getComponentForWidgetState(item: WidgetUIState): typeof SvelteComponentDev {
// custom widgets with TypeScript sources
let override = ComfyApp.widget_type_overrides[item.widget.type]
if (override) {
return override;
return override
}
// litegraph.ts built-in widgets