Migrate app.js (#12)

* Rename js to ts

* Fix all tsc errors

* nit
This commit is contained in:
Chenlei Hu
2024-06-14 17:11:19 -04:00
committed by GitHub
parent 23074eb823
commit 1376459cd8
10 changed files with 213 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
import { LGraphNode, IWidget } from "./litegraph";
import { LGraphNode, IWidget, LGraph } from "./litegraph";
import { ComfyApp } from "../../scripts/app";
export interface ComfyExtension {
@@ -74,3 +74,8 @@ export type ComfyObjectInfo = {
};
export type ComfyObjectInfoConfig = [string | any[]] | [string | any[], any];
declare global {
const app: ComfyApp;
const graph: LGraph;
}

View File

@@ -221,7 +221,7 @@ export declare class LGraph {
*/
updateExecutionOrder(): void;
/** This is more internal, it computes the executable nodes in order and returns it */
computeExecutionOrder<T = any>(only_onExecute: boolean, set_level: any): T;
computeExecutionOrder<T = any>(only_onExecute: boolean, set_level?: any): T;
/**
* Returns all the nodes that could affect this one (ancestors) by crawling all the inputs recursively.
* It doesn't include the node itself
@@ -357,7 +357,7 @@ export declare class LGraph {
clearTriggeredSlots(): void;
/* Called when something visually changed (not the graph!) */
change(): void;
setDirtyCanvas(fg: boolean, bg: boolean): void;
setDirtyCanvas(fg: boolean, bg?: boolean): void;
/** Destroys a link */
removeLink(link_id: number): void;
/** Creates a Object containing all the info about this graph, it can be serialized */
@@ -457,6 +457,8 @@ export declare class LGraphNode {
| typeof LiteGraph.NEVER
| typeof LiteGraph.ALWAYS;
widgets?: IWidget[];
/** If set to true widgets do not start after the slots */
widgets_up: boolean;
/** widgets start at y distance from the top of the node */
@@ -1075,6 +1077,12 @@ export declare class LGraphCanvas {
visible_links: LLink[];
visible_nodes: LGraphNode[];
zoom_modify_alpha: boolean;
//mouse in canvas coordinates, where 0,0 is the top-left corner of the blue rectangle
mouse: Vector2;
//mouse in graph coordinates, where 0,0 is the top-left corner of the blue rectangle
graph_mouse: Vector2;
pointer_is_down?: boolean;
/** clears all the data inside */
clear(): void;
@@ -1309,8 +1317,8 @@ declare global {
y: number,
width: number,
height: number,
radius: number,
radiusLow: number
radius: number | Vector4,
radiusLow?: number
): void;
}
@@ -1319,6 +1327,11 @@ declare global {
}
const LiteGraph: {
DEFAULT_GROUP_FONT_SIZE: any;
overlapBounding(visible_area: any, _bounding: any): unknown;
release_link_on_empty_shows_menu: boolean;
alt_drag_do_clone_nodes: boolean;
GRID_SHAPE: number;
VERSION: number;
CANVAS_GRID_SIZE: number;