| |
| |
| |
|
|
| export type Vector2 = [number, number]; |
| export type Vector4 = [number, number, number, number]; |
| export type widgetTypes = |
| | "number" |
| | "slider" |
| | "combo" |
| | "text" |
| | "toggle" |
| | "button"; |
| export type SlotShape = |
| | typeof LiteGraph.BOX_SHAPE |
| | typeof LiteGraph.CIRCLE_SHAPE |
| | typeof LiteGraph.ARROW_SHAPE |
| | typeof LiteGraph.SQUARE_SHAPE |
| | number; |
|
|
| |
| export interface INodeSlot { |
| name: string; |
| type: string | -1; |
| label?: string; |
| dir?: |
| | typeof LiteGraph.UP |
| | typeof LiteGraph.RIGHT |
| | typeof LiteGraph.DOWN |
| | typeof LiteGraph.LEFT; |
| color_on?: string; |
| color_off?: string; |
| shape?: SlotShape; |
| locked?: boolean; |
| nameLocked?: boolean; |
| } |
|
|
| export interface INodeInputSlot extends INodeSlot { |
| link: LLink["id"] | null; |
| } |
| export interface INodeOutputSlot extends INodeSlot { |
| links: LLink["id"][] | null; |
| } |
|
|
| export type WidgetCallback<T extends IWidget = IWidget> = ( |
| this: T, |
| value: T["value"], |
| graphCanvas: LGraphCanvas, |
| node: LGraphNode, |
| pos: Vector2, |
| event?: MouseEvent |
| ) => void; |
|
|
| export interface IWidget<TValue = any, TOptions = any> { |
| name: string | null; |
| value: TValue; |
| options?: TOptions; |
| type?: widgetTypes; |
| y?: number; |
| property?: string; |
| last_y?: number; |
| clicked?: boolean; |
| marker?: boolean; |
| callback?: WidgetCallback<this>; |
| |
| draw?( |
| ctx: CanvasRenderingContext2D, |
| node: LGraphNode, |
| width: number, |
| posY: number, |
| height: number |
| ): void; |
| |
| |
| |
| |
| mouse?( |
| event: MouseEvent, |
| pos: Vector2, |
| node: LGraphNode |
| ): boolean; |
| |
| computeSize?(width: number): [number, number]; |
| } |
| export interface IButtonWidget extends IWidget<null, {}> { |
| type: "button"; |
| } |
| export interface IToggleWidget |
| extends IWidget<boolean, { on?: string; off?: string }> { |
| type: "toggle"; |
| } |
| export interface ISliderWidget |
| extends IWidget<number, { max: number; min: number }> { |
| type: "slider"; |
| } |
| export interface INumberWidget extends IWidget<number, { precision: number }> { |
| type: "number"; |
| } |
| export interface IComboWidget |
| extends IWidget< |
| string[], |
| { |
| values: |
| | string[] |
| | ((widget: IComboWidget, node: LGraphNode) => string[]); |
| } |
| > { |
| type: "combo"; |
| } |
|
|
| export interface ITextWidget extends IWidget<string, {}> { |
| type: "text"; |
| } |
|
|
| export interface IContextMenuItem { |
| content: string; |
| callback?: ContextMenuEventListener; |
| |
| title?: string; |
| disabled?: boolean; |
| has_submenu?: boolean; |
| submenu?: { |
| options: ContextMenuItem[]; |
| } & IContextMenuOptions; |
| className?: string; |
| } |
| export interface IContextMenuOptions { |
| callback?: ContextMenuEventListener; |
| ignore_item_callbacks?: Boolean; |
| event?: MouseEvent | CustomEvent; |
| parentMenu?: ContextMenu; |
| autoopen?: boolean; |
| title?: string; |
| extra?: any; |
| } |
|
|
| export type ContextMenuItem = IContextMenuItem | null; |
| export type ContextMenuEventListener = ( |
| value: ContextMenuItem, |
| options: IContextMenuOptions, |
| event: MouseEvent, |
| parentMenu: ContextMenu | undefined, |
| node: LGraphNode |
| ) => boolean | void; |
|
|
| export const LiteGraph: { |
| VERSION: number; |
|
|
| CANVAS_GRID_SIZE: number; |
|
|
| NODE_TITLE_HEIGHT: number; |
| NODE_TITLE_TEXT_Y: number; |
| NODE_SLOT_HEIGHT: number; |
| NODE_WIDGET_HEIGHT: number; |
| NODE_WIDTH: number; |
| NODE_MIN_WIDTH: number; |
| NODE_COLLAPSED_RADIUS: number; |
| NODE_COLLAPSED_WIDTH: number; |
| NODE_TITLE_COLOR: string; |
| NODE_TEXT_SIZE: number; |
| NODE_TEXT_COLOR: string; |
| NODE_SUBTEXT_SIZE: number; |
| NODE_DEFAULT_COLOR: string; |
| NODE_DEFAULT_BGCOLOR: string; |
| NODE_DEFAULT_BOXCOLOR: string; |
| NODE_DEFAULT_SHAPE: string; |
| DEFAULT_SHADOW_COLOR: string; |
| DEFAULT_GROUP_FONT: number; |
|
|
| LINK_COLOR: string; |
| EVENT_LINK_COLOR: string; |
| CONNECTING_LINK_COLOR: string; |
|
|
| MAX_NUMBER_OF_NODES: number; |
| DEFAULT_POSITION: Vector2; |
| VALID_SHAPES: ["default", "box", "round", "card"]; |
|
|
| |
| BOX_SHAPE: 1; |
| ROUND_SHAPE: 2; |
| CIRCLE_SHAPE: 3; |
| CARD_SHAPE: 4; |
| ARROW_SHAPE: 5; |
| SQUARE_SHAPE: 6; |
|
|
| |
| INPUT: 1; |
| OUTPUT: 2; |
|
|
| EVENT: -1; |
| ACTION: -1; |
|
|
| ALWAYS: 0; |
| ON_EVENT: 1; |
| NEVER: 2; |
| ON_TRIGGER: 3; |
|
|
| UP: 1; |
| DOWN: 2; |
| LEFT: 3; |
| RIGHT: 4; |
| CENTER: 5; |
|
|
| STRAIGHT_LINK: 0; |
| LINEAR_LINK: 1; |
| SPLINE_LINK: 2; |
|
|
| NORMAL_TITLE: 0; |
| NO_TITLE: 1; |
| TRANSPARENT_TITLE: 2; |
| AUTOHIDE_TITLE: 3; |
|
|
| node_images_path: string; |
|
|
| debug: boolean; |
| catch_exceptions: boolean; |
| throw_errors: boolean; |
| |
| allow_scripts: boolean; |
| |
| registered_node_types: Record<string, LGraphNodeConstructor>; |
| |
| node_types_by_file_extension: Record<string, LGraphNodeConstructor>; |
| |
| Nodes: Record<string, LGraphNodeConstructor>; |
|
|
| |
| searchbox_extras: Record< |
| string, |
| { |
| data: { outputs: string[][]; title: string }; |
| desc: string; |
| type: string; |
| } |
| >; |
|
|
| createNode<T extends LGraphNode = LGraphNode>(type: string): T; |
| |
| registerNodeType(type: string, base: { new (): LGraphNode }): void; |
| |
| unregisterNodeType(type: string): void; |
| |
| clearRegisteredTypes(): void; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| wrapFunctionAsNode( |
| name: string, |
| func: (...args: any[]) => any, |
| param_types?: string[], |
| return_type?: string, |
| properties?: object |
| ): void; |
|
|
| |
| |
| |
| |
| addNodeMethod(name: string, func: (...args: any[]) => any): void; |
|
|
| |
| |
| |
| |
| |
| |
| createNode<T extends LGraphNode>( |
| type: string, |
| title: string, |
| options: object |
| ): T; |
|
|
| |
| |
| |
| |
| getNodeType<T extends LGraphNode>(type: string): LGraphNodeConstructor<T>; |
|
|
| |
| |
| |
| |
| |
| |
| |
| getNodeTypesInCategory( |
| category: string, |
| filter: string |
| ): LGraphNodeConstructor[]; |
|
|
| |
| |
| |
| |
| |
| |
| getNodeTypesCategories(filter: string): string[]; |
|
|
| |
| reloadNodes(folder_wildcard: string): void; |
|
|
| getTime(): number; |
| LLink: typeof LLink; |
| LGraph: typeof LGraph; |
| DragAndScale: typeof DragAndScale; |
| compareObjects(a: object, b: object): boolean; |
| distance(a: Vector2, b: Vector2): number; |
| colorToString(c: string): string; |
| isInsideRectangle( |
| x: number, |
| y: number, |
| left: number, |
| top: number, |
| width: number, |
| height: number |
| ): boolean; |
| growBounding(bounding: Vector4, x: number, y: number): Vector4; |
| isInsideBounding(p: Vector2, bb: Vector4): boolean; |
| hex2num(hex: string): [number, number, number]; |
| num2hex(triplet: [number, number, number]): string; |
| ContextMenu: typeof ContextMenu; |
| extendClass<A, B>(target: A, origin: B): A & B; |
| getParameterNames(func: string): string[]; |
| }; |
|
|
| export type serializedLGraph< |
| TNode = ReturnType<LGraphNode["serialize"]>, |
| |
| TLink = [number, number, number, number, number, string], |
| TGroup = ReturnType<LGraphGroup["serialize"]> |
| > = { |
| last_node_id: LGraph["last_node_id"]; |
| last_link_id: LGraph["last_link_id"]; |
| nodes: TNode[]; |
| links: TLink[]; |
| groups: TGroup[]; |
| config: LGraph["config"]; |
| version: typeof LiteGraph.VERSION; |
| }; |
|
|
| export declare class LGraph { |
| static supported_types: string[]; |
| static STATUS_STOPPED: 1; |
| static STATUS_RUNNING: 2; |
|
|
| constructor(o?: object); |
|
|
| filter: string; |
| catch_errors: boolean; |
| |
| config: object; |
| elapsed_time: number; |
| fixedtime: number; |
| fixedtime_lapse: number; |
| globaltime: number; |
| inputs: any; |
| iteration: number; |
| last_link_id: number; |
| last_node_id: number; |
| last_update_time: number; |
| links: Record<number, LLink>; |
| list_of_graphcanvas: LGraphCanvas[]; |
| outputs: any; |
| runningtime: number; |
| starttime: number; |
| status: typeof LGraph.STATUS_RUNNING | typeof LGraph.STATUS_STOPPED; |
|
|
| private _nodes: LGraphNode[]; |
| private _groups: LGraphGroup[]; |
| private _nodes_by_id: Record<number, LGraphNode>; |
| |
| private _nodes_executable: |
| | (LGraphNode & { onExecute: NonNullable<LGraphNode["onExecute"]> }[]) |
| | null; |
| |
| private _nodes_in_order: LGraphNode[]; |
| private _version: number; |
|
|
| getSupportedTypes(): string[]; |
| |
| clear(): void; |
| |
| attachCanvas(graphCanvas: LGraphCanvas): void; |
| |
| detachCanvas(graphCanvas: LGraphCanvas): void; |
| |
| |
| |
| |
| start(interval?: number): void; |
| |
| stop(): void; |
| |
| |
| |
| |
| runStep(num?: number, do_not_catch_errors?: boolean): void; |
| |
| |
| |
| |
| updateExecutionOrder(): void; |
| |
| computeExecutionOrder<T = any>(only_onExecute: boolean, set_level: any): T; |
| |
| |
| |
| |
| |
| getAncestors(node: LGraphNode): LGraphNode[]; |
| |
| |
| |
| arrange(margin?: number,layout?: string): void; |
| |
| |
| |
| |
| getTime(): number; |
|
|
| |
| |
| |
| |
| getFixedTime(): number; |
|
|
| |
| |
| |
| |
| |
| getElapsedTime(): number; |
| |
| |
| |
| |
| |
| sendEventToAllNodes(eventName: string, params: any[], mode?: any): void; |
|
|
| sendActionToCanvas(action: any, params: any[]): void; |
| |
| |
| |
| |
| add(node: LGraphNode, skip_compute_order?: boolean): void; |
| |
| |
| |
| |
| onNodeAdded(node: LGraphNode): void; |
| |
| remove(node: LGraphNode): void; |
| |
| getNodeById(id: number): LGraphNode | undefined; |
| |
| |
| |
| |
| |
| findNodesByClass<T extends LGraphNode>( |
| classObject: LGraphNodeConstructor<T> |
| ): T[]; |
| |
| |
| |
| |
| |
| findNodesByType<T extends LGraphNode = LGraphNode>(type: string): T[]; |
| |
| |
| |
| |
| |
| findNodeByTitle<T extends LGraphNode = LGraphNode>(title: string): T | null; |
| |
| |
| |
| |
| |
| findNodesByTitle<T extends LGraphNode = LGraphNode>(title: string): T[]; |
| |
| |
| |
| |
| |
| |
| |
| getNodeOnPos<T extends LGraphNode = LGraphNode>( |
| x: number, |
| y: number, |
| node_list?: LGraphNode[], |
| margin?: number |
| ): T | null; |
| |
| |
| |
| |
| |
| |
| getGroupOnPos(x: number, y: number): LGraphGroup | null; |
|
|
| onAction(action: any, param: any): void; |
| trigger(action: any, param: any): void; |
| |
| addInput(name: string, type: string, value?: any): void; |
| |
| setInputData(name: string, data: any): void; |
| |
| getInputData<T = any>(name: string): T; |
| |
| renameInput(old_name: string, name: string): false | undefined; |
| |
| changeInputType(name: string, type: string): false | undefined; |
| |
| removeInput(name: string): boolean; |
| |
| addOutput(name: string, type: string, value: any): void; |
| |
| setOutputData(name: string, value: string): void; |
| |
| getOutputData<T = any>(name: string): T; |
|
|
| |
| renameOutput(old_name: string, name: string): false | undefined; |
| |
| changeOutputType(name: string, type: string): false | undefined; |
| |
| removeOutput(name: string): boolean; |
| triggerInput(name: string, value: any): void; |
| setCallback(name: string, func: (...args: any[]) => any): void; |
| beforeChange(info?: LGraphNode): void; |
| afterChange(info?: LGraphNode): void; |
| connectionChange(node: LGraphNode): void; |
| |
| isLive(): boolean; |
| |
| clearTriggeredSlots(): void; |
| |
| change(): void; |
| setDirtyCanvas(fg: boolean, bg: boolean): void; |
| |
| removeLink(link_id: number): void; |
| |
| serialize<T extends serializedLGraph>(): T; |
| |
| |
| |
| |
| |
| configure(data: object, keep_old?: boolean): boolean | undefined; |
| load(url: string): void; |
| } |
|
|
| export type SerializedLLink = [number, string, number, number, number, number]; |
| export declare class LLink { |
| id: number; |
| type: string; |
| origin_id: number; |
| origin_slot: number; |
| target_id: number; |
| target_slot: number; |
| constructor( |
| id: number, |
| type: string, |
| origin_id: number, |
| origin_slot: number, |
| target_id: number, |
| target_slot: number |
| ); |
| configure(o: LLink | SerializedLLink): void; |
| serialize(): SerializedLLink; |
| } |
|
|
| export type SerializedLGraphNode<T extends LGraphNode = LGraphNode> = { |
| id: T["id"]; |
| type: T["type"]; |
| pos: T["pos"]; |
| size: T["size"]; |
| flags: T["flags"]; |
| mode: T["mode"]; |
| inputs: T["inputs"]; |
| outputs: T["outputs"]; |
| title: T["title"]; |
| properties: T["properties"]; |
| widgets_values?: IWidget["value"][]; |
| }; |
|
|
| |
| export declare class LGraphNode { |
| static title_color: string; |
| static title: string; |
| static type: null | string; |
| static widgets_up: boolean; |
| constructor(title?: string); |
|
|
| title: string; |
| type: null | string; |
| size: Vector2; |
| graph: null | LGraph; |
| graph_version: number; |
| pos: Vector2; |
| is_selected: boolean; |
| mouseOver: boolean; |
|
|
| id: number; |
|
|
| |
| inputs: INodeInputSlot[]; |
| outputs: INodeOutputSlot[]; |
| connections: any[]; |
|
|
| |
| properties: Record<string, any>; |
| properties_info: any[]; |
|
|
| flags: Partial<{ |
| collapsed: boolean |
| }>; |
|
|
| color: string; |
| bgcolor: string; |
| boxcolor: string; |
| shape: |
| | typeof LiteGraph.BOX_SHAPE |
| | typeof LiteGraph.ROUND_SHAPE |
| | typeof LiteGraph.CIRCLE_SHAPE |
| | typeof LiteGraph.CARD_SHAPE |
| | typeof LiteGraph.ARROW_SHAPE; |
|
|
| serialize_widgets: boolean; |
| skip_list: boolean; |
|
|
| |
| mode?: |
| | typeof LiteGraph.ON_EVENT |
| | typeof LiteGraph.ON_TRIGGER |
| | typeof LiteGraph.NEVER |
| | typeof LiteGraph.ALWAYS; |
|
|
| |
| widgets_up: boolean; |
| |
| widgets_start_y: number; |
| |
| clip_area: boolean; |
| |
| resizable: boolean; |
| |
| horizontal: boolean; |
| |
| has_errors?: boolean; |
|
|
| |
| configure(info: SerializedLGraphNode): void; |
| |
| serialize(): SerializedLGraphNode; |
| |
| clone(): this; |
| |
| toString(): string; |
| |
| getTitle(): string; |
| |
| setProperty(name: string, value: any): void; |
| |
| setOutputData(slot: number, data: any): void; |
| |
| setOutputDataType(slot: number, type: string): void; |
| |
| |
| |
| |
| |
| |
| getInputData<T = any>(slot: number, force_update?: boolean): T; |
| |
| |
| |
| |
| |
| getInputDataType(slot: number): string; |
| |
| |
| |
| |
| |
| |
| getInputDataByName<T = any>(slot_name: string, force_update?: boolean): T; |
| |
| isInputConnected(slot: number): boolean; |
| |
| getInputInfo( |
| slot: number |
| ): { link: number; name: string; type: string | 0 } | null; |
| |
| getInputNode(slot: number): LGraphNode | null; |
| |
| getInputOrProperty<T = any>(name: string): T; |
| |
| getOutputData<T = any>(slot: number): T | null; |
| |
| getOutputInfo( |
| slot: number |
| ): { name: string; type: string; links: number[] } | null; |
| |
| isOutputConnected(slot: number): boolean; |
| |
| isAnyOutputConnected(): boolean; |
| |
| getOutputNodes(slot: number): LGraphNode[]; |
| |
| trigger(action: string, param: any): void; |
| |
| |
| |
| |
| |
| |
| triggerSlot(slot: number, param: any, link_id?: number): void; |
| |
| |
| |
| |
| |
| clearTriggeredSlot(slot: number, link_id?: number): void; |
| |
| |
| |
| |
| |
| |
| |
| addProperty<T = any>( |
| name: string, |
| default_value: any, |
| type: string, |
| extra_info?: object |
| ): T; |
| |
| |
| |
| |
| |
| |
| addOutput( |
| name: string, |
| type: string | -1, |
| extra_info?: Partial<INodeOutputSlot> |
| ): INodeOutputSlot; |
| |
| |
| |
| |
| addOutputs( |
| array: [string, string | -1, Partial<INodeOutputSlot> | undefined][] |
| ): void; |
| |
| removeOutput(slot: number): void; |
| |
| |
| |
| |
| |
| |
| addInput( |
| name: string, |
| type: string | -1, |
| extra_info?: Partial<INodeInputSlot> |
| ): INodeInputSlot; |
| |
| |
| |
| |
| addInputs( |
| array: [string, string | -1, Partial<INodeInputSlot> | undefined][] |
| ): void; |
| |
| removeInput(slot: number): void; |
| |
| |
| |
| |
| |
| |
| |
| addConnection( |
| name: string, |
| type: string, |
| pos: Vector2, |
| direction: string |
| ): { |
| name: string; |
| type: string; |
| pos: Vector2; |
| direction: string; |
| links: null; |
| }; |
| setValue(v: any): void; |
| |
| computeSize(): [number, number]; |
| |
| |
| |
| |
| addWidget<T extends IWidget>( |
| type: T["type"], |
| name: string, |
| value: T["value"], |
| callback?: WidgetCallback<T> | string, |
| options?: T["options"] |
| ): T; |
|
|
| addCustomWidget<T extends IWidget>(customWidget: T): T; |
|
|
| |
| |
| |
| |
| getBounding(): Vector4; |
| |
| isPointInside( |
| x: number, |
| y: number, |
| margin?: number, |
| skipTitle?: boolean |
| ): boolean; |
| |
| getSlotInPosition( |
| x: number, |
| y: number |
| ): { |
| input?: INodeInputSlot; |
| output?: INodeOutputSlot; |
| slot: number; |
| link_pos: Vector2; |
| }; |
| |
| |
| |
| |
| |
| findInputSlot(name: string): number; |
| |
| |
| |
| |
| |
| findOutputSlot(name: string): number; |
| |
| |
| |
| |
| |
| |
| |
| connect<T = any>( |
| slot: number | string, |
| targetNode: LGraphNode, |
| targetSlot: number | string |
| ): T | null; |
| |
| |
| |
| |
| |
| |
| disconnectOutput(slot: number | string, targetNode?: LGraphNode): boolean; |
| |
| |
| |
| |
| |
| disconnectInput(slot: number | string): boolean; |
| |
| |
| |
| |
| |
| |
| |
| getConnectionPos( |
| is_input: boolean, |
| slot: number | string, |
| out?: Vector2 |
| ): Vector2; |
| |
| alignToGrid(): void; |
| |
| trace(msg: string): void; |
| |
| setDirtyCanvas(fg: boolean, bg: boolean): void; |
| loadImage(url: string): void; |
| |
| captureInput(v: any): void; |
| |
| collapse(force: boolean): void; |
| |
| pin(v?: boolean): void; |
| localToScreen(x: number, y: number, graphCanvas: LGraphCanvas): Vector2; |
|
|
| |
| onDrawBackground?( |
| ctx: CanvasRenderingContext2D, |
| canvas: HTMLCanvasElement |
| ): void; |
| onDrawForeground?( |
| ctx: CanvasRenderingContext2D, |
| canvas: HTMLCanvasElement |
| ): void; |
|
|
| |
| onMouseDown?( |
| event: MouseEvent, |
| pos: Vector2, |
| graphCanvas: LGraphCanvas |
| ): void; |
| onMouseMove?( |
| event: MouseEvent, |
| pos: Vector2, |
| graphCanvas: LGraphCanvas |
| ): void; |
| onMouseUp?( |
| event: MouseEvent, |
| pos: Vector2, |
| graphCanvas: LGraphCanvas |
| ): void; |
| onMouseEnter?( |
| event: MouseEvent, |
| pos: Vector2, |
| graphCanvas: LGraphCanvas |
| ): void; |
| onMouseLeave?( |
| event: MouseEvent, |
| pos: Vector2, |
| graphCanvas: LGraphCanvas |
| ): void; |
| onKey?(event: KeyboardEvent, pos: Vector2, graphCanvas: LGraphCanvas): void; |
|
|
| |
| onSelected?(): void; |
| |
| onDeselected?(): void; |
| |
| onExecute?(): void; |
| |
| onSerialize?(o: SerializedLGraphNode): void; |
| |
| onConfigure?(o: SerializedLGraphNode): void; |
| |
| |
| |
| |
| onAdded?(graph: LGraph): void; |
| |
| |
| |
| |
| onRemoved?(): void; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| onConnectInput?( |
| inputIndex: number, |
| outputType: INodeOutputSlot["type"], |
| outputSlot: INodeOutputSlot, |
| outputNode: LGraphNode, |
| outputIndex: number |
| ): boolean; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| onConnectOutput?( |
| outputIndex: number, |
| inputType: INodeInputSlot["type"], |
| inputSlot: INodeInputSlot, |
| inputNode: LGraphNode, |
| inputIndex: number |
| ): boolean; |
|
|
| |
| |
| |
| |
| |
| |
| |
| onBeforeConnectInput?( |
| inputIndex: number |
| ): number; |
| |
| |
| onConnectionsChange( |
| type: number, |
| slotIndex: number, |
| isConnected: boolean, |
| link: LLink, |
| ioSlot: (INodeOutputSlot | INodeInputSlot) |
| ): void; |
|
|
| |
| |
| |
| |
| |
| |
| |
| onPropertyChanged?(property: string, value: any, prevValue: any): void | boolean; |
|
|
| |
| getMenuOptions?(graphCanvas: LGraphCanvas): ContextMenuItem[]; |
| getSlotMenuOptions?(slot: INodeSlot): ContextMenuItem[]; |
| } |
|
|
| export type LGraphNodeConstructor<T extends LGraphNode = LGraphNode> = { |
| new (): T; |
| }; |
|
|
| export type SerializedLGraphGroup = { |
| title: LGraphGroup["title"]; |
| bounding: LGraphGroup["_bounding"]; |
| color: LGraphGroup["color"]; |
| font: LGraphGroup["font"]; |
| }; |
| export declare class LGraphGroup { |
| title: string; |
| private _bounding: Vector4; |
| color: string; |
| font: string; |
|
|
| configure(o: SerializedLGraphGroup): void; |
| serialize(): SerializedLGraphGroup; |
| move(deltaX: number, deltaY: number, ignoreNodes?: boolean): void; |
| recomputeInsideNodes(): void; |
| isPointInside: LGraphNode["isPointInside"]; |
| setDirtyCanvas: LGraphNode["setDirtyCanvas"]; |
| } |
|
|
| export declare class DragAndScale { |
| constructor(element?: HTMLElement, skipEvents?: boolean); |
| offset: [number, number]; |
| scale: number; |
| max_scale: number; |
| min_scale: number; |
| onredraw: Function | null; |
| enabled: boolean; |
| last_mouse: Vector2; |
| element: HTMLElement | null; |
| visible_area: Vector4; |
| bindEvents(element: HTMLElement): void; |
| computeVisibleArea(): void; |
| onMouse(e: MouseEvent): void; |
| toCanvasContext(ctx: CanvasRenderingContext2D): void; |
| convertOffsetToCanvas(pos: Vector2): Vector2; |
| convertCanvasToOffset(pos: Vector2): Vector2; |
| mouseDrag(x: number, y: number): void; |
| changeScale(value: number, zooming_center?: Vector2): void; |
| changeDeltaScale(value: number, zooming_center?: Vector2): void; |
| reset(): void; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| export declare class LGraphCanvas { |
| static node_colors: Record< |
| string, |
| { |
| color: string; |
| bgcolor: string; |
| groupcolor: string; |
| } |
| >; |
| static link_type_colors: Record<string, string>; |
| static gradients: object; |
| static search_limit: number; |
|
|
| static getFileExtension(url: string): string; |
| static decodeHTML(str: string): string; |
|
|
| static onMenuCollapseAll(): void; |
| static onMenuNodeEdit(): void; |
| static onShowPropertyEditor( |
| item: any, |
| options: any, |
| e: any, |
| menu: any, |
| node: any |
| ): void; |
| |
| static onGroupAdd: ContextMenuEventListener; |
| |
| static onMenuAdd: ContextMenuEventListener; |
| static showMenuNodeOptionalInputs: ContextMenuEventListener; |
| static showMenuNodeOptionalOutputs: ContextMenuEventListener; |
| static onShowMenuNodeProperties: ContextMenuEventListener; |
| static onResizeNode: ContextMenuEventListener; |
| static onMenuNodeCollapse: ContextMenuEventListener; |
| static onMenuNodePin: ContextMenuEventListener; |
| static onMenuNodeMode: ContextMenuEventListener; |
| static onMenuNodeColors: ContextMenuEventListener; |
| static onMenuNodeShapes: ContextMenuEventListener; |
| static onMenuNodeRemove: ContextMenuEventListener; |
| static onMenuNodeClone: ContextMenuEventListener; |
|
|
| constructor( |
| canvas: HTMLCanvasElement | string, |
| graph?: LGraph, |
| options?: { |
| skip_render?: boolean; |
| autoresize?: boolean; |
| } |
| ); |
|
|
| static active_canvas: HTMLCanvasElement; |
| |
| allow_dragcanvas: boolean; |
| allow_dragnodes: boolean; |
| |
| allow_interaction: boolean; |
| |
| allow_reconnect_links: boolean; |
| |
| multi_select: boolean; |
| |
| allow_searchbox: boolean; |
| always_render_background: boolean; |
| autoresize?: boolean; |
| background_image: string; |
| bgcanvas: HTMLCanvasElement; |
| bgctx: CanvasRenderingContext2D; |
| canvas: HTMLCanvasElement; |
| canvas_mouse: Vector2; |
| clear_background: boolean; |
| connecting_node: LGraphNode | null; |
| connections_width: number; |
| ctx: CanvasRenderingContext2D; |
| current_node: LGraphNode | null; |
| default_connection_color: { |
| input_off: string; |
| input_on: string; |
| output_off: string; |
| output_on: string; |
| }; |
| default_link_color: string; |
| dirty_area: Vector4 | null; |
| dirty_bgcanvas?: boolean; |
| dirty_canvas?: boolean; |
| drag_mode: boolean; |
| dragging_canvas: boolean; |
| dragging_rectangle: Vector4 | null; |
| ds: DragAndScale; |
| |
| editor_alpha: number; |
| filter: any; |
| fps: number; |
| frame: number; |
| graph: LGraph; |
| highlighted_links: Record<number, boolean>; |
| highquality_render: boolean; |
| inner_text_font: string; |
| is_rendering: boolean; |
| last_draw_time: number; |
| last_mouse: Vector2; |
| |
| |
| |
| |
| last_mouse_position: Vector2; |
| |
| last_mouseclick: number; |
| links_render_mode: |
| | typeof LiteGraph.STRAIGHT_LINK |
| | typeof LiteGraph.LINEAR_LINK |
| | typeof LiteGraph.SPLINE_LINK; |
| live_mode: boolean; |
| node_capturing_input: LGraphNode | null; |
| node_dragged: LGraphNode | null; |
| node_in_panel: LGraphNode | null; |
| node_over: LGraphNode | null; |
| node_title_color: string; |
| node_widget: [LGraphNode, IWidget] | null; |
| |
| onDrawBackground: |
| | ((ctx: CanvasRenderingContext2D, visibleArea: Vector4) => void) |
| | null; |
| |
| onDrawForeground: |
| | ((ctx: CanvasRenderingContext2D, visibleArea: Vector4) => void) |
| | null; |
| onDrawOverlay: ((ctx: CanvasRenderingContext2D) => void) | null; |
| |
| onMouse: ((event: MouseEvent) => boolean) | null; |
| |
| onDrawLinkTooltip: ((ctx: CanvasRenderingContext2D, link: LLink, _this: this) => void) | null; |
| |
| onNodeMoved: ((node: LGraphNode) => void) | null; |
| |
| onNodeSelected: ((node: LGraphNode) => void) | null; |
| |
| onNodeDeselected: ((node: LGraphNode) => void) | null; |
| |
| onShowNodePanel: ((node: LGraphNode) => void) | null; |
| |
| onNodeDblClicked: ((node: LGraphNode) => void) | null; |
| |
| onSelectionChange: ((nodes: Record<number, LGraphNode>) => void) | null; |
| |
| onSearchBox: |
| | (( |
| helper: Element, |
| value: string, |
| graphCanvas: LGraphCanvas |
| ) => string[]) |
| | null; |
| onSearchBoxSelection: |
| | ((name: string, event: MouseEvent, graphCanvas: LGraphCanvas) => void) |
| | null; |
| pause_rendering: boolean; |
| render_canvas_border: boolean; |
| render_collapsed_slots: boolean; |
| render_connection_arrows: boolean; |
| render_connections_border: boolean; |
| render_connections_shadows: boolean; |
| render_curved_connections: boolean; |
| render_execution_order: boolean; |
| render_only_selected: boolean; |
| render_shadows: boolean; |
| render_title_colored: boolean; |
| round_radius: number; |
| selected_group: null | LGraphGroup; |
| selected_group_resizing: boolean; |
| selected_nodes: Record<number, LGraphNode>; |
| show_info: boolean; |
| title_text_font: string; |
| |
| use_gradients: boolean; |
| visible_area: DragAndScale["visible_area"]; |
| visible_links: LLink[]; |
| visible_nodes: LGraphNode[]; |
| zoom_modify_alpha: boolean; |
|
|
| |
| clear(): void; |
| |
| setGraph(graph: LGraph, skipClear?: boolean): void; |
| |
| openSubgraph(graph: LGraph): void; |
| |
| closeSubgraph(): void; |
| |
| setCanvas(canvas: HTMLCanvasElement, skipEvents?: boolean): void; |
| |
| bindEvents(): void; |
| |
| unbindEvents(): void; |
|
|
| |
| |
| |
| |
| enableWebGL(): void; |
|
|
| |
| |
| |
| |
| |
| setDirty(fg: boolean, bg: boolean): void; |
|
|
| |
| |
| |
| |
| getCanvasWindow(): Window; |
| |
| startRendering(): void; |
| |
| stopRendering(): void; |
|
|
| processMouseDown(e: MouseEvent): boolean | undefined; |
| processMouseMove(e: MouseEvent): boolean | undefined; |
| processMouseUp(e: MouseEvent): boolean | undefined; |
| processMouseWheel(e: MouseEvent): boolean | undefined; |
|
|
| |
| isOverNodeBox(node: LGraphNode, canvasX: number, canvasY: number): boolean; |
| |
| isOverNodeInput( |
| node: LGraphNode, |
| canvasX: number, |
| canvasY: number, |
| slotPos: Vector2 |
| ): boolean; |
|
|
| |
| processKey(e: KeyboardEvent): boolean | undefined; |
|
|
| copyToClipboard(): void; |
| pasteFromClipboard(): void; |
| processDrop(e: DragEvent): void; |
| checkDropItem(e: DragEvent): void; |
| processNodeDblClicked(n: LGraphNode): void; |
| processNodeSelected(n: LGraphNode, e: MouseEvent): void; |
| processNodeDeselected(node: LGraphNode): void; |
|
|
| |
| selectNode(node: LGraphNode, add?: boolean): void; |
| |
| selectNodes(nodes?: LGraphNode[], add?: boolean): void; |
| |
| deselectNode(node: LGraphNode): void; |
| |
| deselectAllNodes(): void; |
| |
| deleteSelectedNodes(): void; |
|
|
| |
| centerOnNode(node: LGraphNode): void; |
| |
| setZoom(value: number, center: Vector2): void; |
| |
| bringToFront(node: LGraphNode): void; |
| |
| sendToBack(node: LGraphNode): void; |
| |
| computeVisibleNodes(nodes: LGraphNode[]): LGraphNode[]; |
| |
| draw(forceFG?: boolean, forceBG?: boolean): void; |
| |
| drawFrontCanvas(): void; |
| |
| renderInfo(ctx: CanvasRenderingContext2D, x: number, y: number): void; |
| |
| drawBackCanvas(): void; |
| |
| drawNode(node: LGraphNode, ctx: CanvasRenderingContext2D): void; |
| |
| drawSlotGraphic(ctx: CanvasRenderingContext2D, pos: number[], shape: SlotShape, horizontal: boolean): void; |
| |
| drawNodeShape( |
| node: LGraphNode, |
| ctx: CanvasRenderingContext2D, |
| size: [number, number], |
| fgColor: string, |
| bgColor: string, |
| selected: boolean, |
| mouseOver: boolean |
| ): void; |
| |
| drawConnections(ctx: CanvasRenderingContext2D): void; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| renderLink( |
| a: Vector2, |
| b: Vector2, |
| link: object, |
| skipBorder: boolean, |
| flow: boolean, |
| color?: string, |
| startDir?: number, |
| endDir?: number, |
| numSublines?: number |
| ): void; |
|
|
| computeConnectionPoint( |
| a: Vector2, |
| b: Vector2, |
| t: number, |
| startDir?: number, |
| endDir?: number |
| ): void; |
|
|
| drawExecutionOrder(ctx: CanvasRenderingContext2D): void; |
| |
| drawNodeWidgets( |
| node: LGraphNode, |
| posY: number, |
| ctx: CanvasRenderingContext2D, |
| activeWidget: object |
| ): void; |
| |
| processNodeWidgets( |
| node: LGraphNode, |
| pos: Vector2, |
| event: Event, |
| activeWidget: object |
| ): void; |
| |
| drawGroups(canvas: any, ctx: CanvasRenderingContext2D): void; |
| adjustNodesSize(): void; |
| |
| resize(width?: number, height?: number): void; |
| |
| |
| |
| |
| switchLiveMode(transition?: boolean): void; |
| onNodeSelectionChange(): void; |
| touchHandler(event: TouchEvent): void; |
|
|
| showLinkMenu(link: LLink, e: any): false; |
| prompt( |
| title: string, |
| value: any, |
| callback: Function, |
| event: any |
| ): HTMLDivElement; |
| showSearchBox(event?: MouseEvent): void; |
| showEditPropertyValue(node: LGraphNode, property: any, options: any): void; |
| createDialog( |
| html: string, |
| options?: { position?: Vector2; event?: MouseEvent } |
| ): void; |
|
|
| convertOffsetToCanvas: DragAndScale["convertOffsetToCanvas"]; |
| convertCanvasToOffset: DragAndScale["convertCanvasToOffset"]; |
| |
| convertEventToCanvasOffset(e: MouseEvent): Vector2; |
| |
| adjustMouseEvent(e: MouseEvent): void; |
|
|
| getCanvasMenuOptions(): ContextMenuItem[]; |
| getNodeMenuOptions(node: LGraphNode): ContextMenuItem[]; |
| getGroupMenuOptions(): ContextMenuItem[]; |
| |
| getMenuOptions?(): ContextMenuItem[]; |
| |
| getExtraMenuOptions?(): ContextMenuItem[]; |
| |
| processContextMenu(node: LGraphNode, event: Event): void; |
| } |
|
|
| declare class ContextMenu { |
| static trigger( |
| element: HTMLElement, |
| event_name: string, |
| params: any, |
| origin: any |
| ): void; |
| static isCursorOverElement(event: MouseEvent, element: HTMLElement): void; |
| static closeAllContextMenus(window: Window): void; |
| constructor(values: ContextMenuItem[], options?: IContextMenuOptions, window?: Window); |
| options: IContextMenuOptions; |
| parentMenu?: ContextMenu; |
| lock: boolean; |
| current_submenu?: ContextMenu; |
| addItem( |
| name: string, |
| value: ContextMenuItem, |
| options?: IContextMenuOptions |
| ): void; |
| close(e?: MouseEvent, ignore_parent_menu?: boolean): void; |
| getTopMenu(): void; |
| getFirstEvent(): void; |
| } |
|
|
| declare global { |
| interface CanvasRenderingContext2D { |
| |
| roundRect( |
| x: number, |
| y: number, |
| width: number, |
| height: number, |
| radius: number, |
| radiusLow: number |
| ): void; |
| } |
|
|
| interface Math { |
| clamp(v: number, min: number, max: number): number; |
| } |
| } |
|
|