Make necessary type def changes for TS repo (#3)

* Make necessary type def changes for TS repo

* Revert unwanted changes

* Revert more accidental changes

* Update version
This commit is contained in:
Chenlei Hu
2024-07-05 15:48:20 -04:00
committed by GitHub
parent 716180540f
commit 8f1d91f952
2 changed files with 33 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@comfyorg/litegraph",
"version": "0.7.17",
"version": "0.7.18",
"description": "A graph node editor similar to PD or UDK Blueprints. It works in an HTML5 Canvas and allows to export graphs to be included in applications.",
"main": "build/litegraph.core.js",
"types": "src/litegraph.d.ts",

29
src/litegraph.d.ts vendored
View File

@@ -52,6 +52,9 @@ export type WidgetCallback<T extends IWidget = IWidget> = (
) => void;
export interface IWidget<TValue = any, TOptions = any> {
// linked widgets, e.g. seed+seedControl
linkedWidgets: IWidget[];
name: string | null;
value: TValue;
options?: TOptions;
@@ -144,6 +147,11 @@ export type ContextMenuEventListener = (
) => boolean | void;
export 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;
@@ -348,6 +356,7 @@ export declare class LGraph {
static supported_types: string[];
static STATUS_STOPPED: 1;
static STATUS_RUNNING: 2;
extra: any;
constructor(o?: object);
@@ -407,7 +416,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
@@ -543,7 +552,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 */
@@ -593,6 +602,11 @@ export type SerializedLGraphNode<T extends LGraphNode = LGraphNode> = {
/** https://github.com/jagenjo/litegraph.js/blob/master/guides/README.md#lgraphnode */
export declare class LGraphNode {
onResize?: Function;
// Used in group node
setInnerNodes(nodes: LGraphNode[]);
static title_color: string;
static title: string;
static type: null | string;
@@ -643,6 +657,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 */
@@ -1038,6 +1054,7 @@ export declare class LGraphNode {
}
export type LGraphNodeConstructor<T extends LGraphNode = LGraphNode> = {
nodeData: any; // Used by group node.
new (): T;
};
@@ -1210,6 +1227,8 @@ export declare class LGraphCanvas {
node_over: LGraphNode | null;
node_title_color: string;
node_widget: [LGraphNode, IWidget] | null;
last_mouse_dragging: boolean;
/** Called by `LGraphCanvas.drawBackCanvas` */
onDrawBackground:
| ((ctx: CanvasRenderingContext2D, visibleArea: Vector4) => void)
@@ -1269,6 +1288,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;