From 115b647bf6422c9a8fcf5cb5460bc713253d9e82 Mon Sep 17 00:00:00 2001 From: ilyabeskrovniy Date: Tue, 7 Jul 2020 10:27:22 +0300 Subject: [PATCH] Fixed typings and documentation --- guides/README.md | 2 +- src/litegraph.d.ts | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/guides/README.md b/guides/README.md index 4743daf50..db26a2c27 100644 --- a/guides/README.md +++ b/guides/README.md @@ -64,7 +64,7 @@ There are several settings that could be defined or modified per node: * **collapsed**: if it is shown collapsed (small) * **redraw_on_mouse**: forces a redraw if the mouse passes over the widget * **widgets_up**: widgets do not start after the slots -* **widgets_y**: widgets should start being drawn from this Y +* **widgets_start_y**: widgets should start being drawn from this Y * **clip_area**: clips the content when rendering the node * **resizable**: if it can be resized dragging the corner * **horizontal**: if the slots should be placed horizontally on the top and bottom of the node diff --git a/src/litegraph.d.ts b/src/litegraph.d.ts index ec4cbaf95..2a54667cb 100644 --- a/src/litegraph.d.ts +++ b/src/litegraph.d.ts @@ -15,7 +15,7 @@ export type widgetTypes = /** https://github.com/jagenjo/litegraph.js/tree/master/guides#node-slots */ export interface INodeSlot { name: string; - type: string; + type: string | -1; label?: string; dir?: | typeof LiteGraph.UP @@ -601,7 +601,9 @@ export declare class LGraphNode { properties: Record; properties_info: any[]; - flags: object; + flags: Partial<{ + collapsed: boolean + }>; color: string; bgcolor: string; @@ -623,6 +625,17 @@ export declare class LGraphNode { | typeof LiteGraph.NEVER | typeof LiteGraph.ALWAYS; + /** 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 */ + widgets_start_y: number; + /** if you render outside the node, it will be clipped */ + clip_area: boolean; + /** if set to false it wont be resizable with the mouse */ + resizable: boolean; + /** slots are distributed horizontally */ + horizontal: boolean; + /** configure a node from an object containing the serialized info */ configure(info: SerializedLGraphNode): void; /** serialize the content */ @@ -715,7 +728,7 @@ export declare class LGraphNode { */ addOutput( name: string, - type: string, + type: string | -1, extra_info?: Partial ): void; /** @@ -723,7 +736,7 @@ export declare class LGraphNode { * @param array of triplets like [[name,type,extra_info],[...]] */ addOutputs( - array: [string, string, Partial | undefined][] + array: [string, string | -1, Partial | undefined][] ): void; /** remove an existing output slot */ removeOutput(slot: number): void; @@ -735,7 +748,7 @@ export declare class LGraphNode { */ addInput( name: string, - type: string, + type: string | -1, extra_info?: Partial ): void; /** @@ -743,7 +756,7 @@ export declare class LGraphNode { * @param array of triplets like [[name,type,extra_info],[...]] */ addInputs( - array: [string, string, Partial | undefined][] + array: [string, string | -1, Partial | undefined][] ): void; /** remove an existing input slot */ removeInput(slot: number): void; @@ -777,7 +790,7 @@ export declare class LGraphNode { type: T["type"], name: string, value: T["value"], - callback?: WidgetCallback, + callback?: WidgetCallback | string, options?: T["options"] ): T; @@ -1111,7 +1124,7 @@ export declare class LGraphCanvas { last_mouse_position: Vector2; /** Timestamp of last mouse click, defaults to 0 */ last_mouseclick: number; - link_render_mode: + links_render_mode: | typeof LiteGraph.STRAIGHT_LINK | typeof LiteGraph.LINEAR_LINK | typeof LiteGraph.SPLINE_LINK;