@gausszhou/litegraph-core / LiteGraph
Class: LiteGraph
Defined in: packages/core/src/LiteGraph.ts:15
Constructors
Constructor
new LiteGraph(): LiteGraph;Returns
LiteGraph
Properties
_installedPlugins
static _installedPlugins: any = [];Defined in: packages/core/src/LiteGraph.ts:17
ACTION_LINK_COLOR
static ACTION_LINK_COLOR: string = "#86A";Defined in: packages/core/src/LiteGraph.ts:49
allow_multi_output_for_events
static allow_multi_output_for_events: boolean = true;Defined in: packages/core/src/LiteGraph.ts:122
allow_scripts
static allow_scripts: boolean = false;Defined in: packages/core/src/LiteGraph.ts:62
if set to true some nodes like Formula would be allowed to evaluate code that comes from unsafe sources (like node configuration), which could lead to exploits
alt_drag_do_clone_nodes
static alt_drag_do_clone_nodes: boolean = false;Defined in: packages/core/src/LiteGraph.ts:116
auto_load_slot_types
static auto_load_slot_types: boolean = false;Defined in: packages/core/src/LiteGraph.ts:100
auto_sort_node_types
static auto_sort_node_types: boolean = false;Defined in: packages/core/src/LiteGraph.ts:76
CANVAS_GRID_SIZE
static CANVAS_GRID_SIZE: number = 10;Defined in: packages/core/src/LiteGraph.ts:19
catch_exceptions
static catch_exceptions: boolean = true;Defined in: packages/core/src/LiteGraph.ts:59
click_do_break_link_to
static click_do_break_link_to: boolean = false;Defined in: packages/core/src/LiteGraph.ts:90
CONNECTING_LINK_COLOR
static CONNECTING_LINK_COLOR: string = "#AFA";Defined in: packages/core/src/LiteGraph.ts:50
debug
static debug: boolean = false;Defined in: packages/core/src/LiteGraph.ts:58
DEFAULT_GROUP_FONT_SIZE
static DEFAULT_GROUP_FONT_SIZE: number = 24;Defined in: packages/core/src/LiteGraph.ts:40
DEFAULT_POSITION
static DEFAULT_POSITION: Vector2;Defined in: packages/core/src/LiteGraph.ts:53
DEFAULT_SHADOW_COLOR
static DEFAULT_SHADOW_COLOR: string = "rgba(0,0,0,0.5)";Defined in: packages/core/src/LiteGraph.ts:39
dialog_close_on_mouse_leave
static dialog_close_on_mouse_leave: boolean = true;Defined in: packages/core/src/LiteGraph.ts:84
dialog_close_on_mouse_leave_delay
static dialog_close_on_mouse_leave_delay: number = 500;Defined in: packages/core/src/LiteGraph.ts:85
do_add_triggers_slots
static do_add_triggers_slots: boolean = false;Defined in: packages/core/src/LiteGraph.ts:119
EVENT_LINK_COLOR
static EVENT_LINK_COLOR: string = "#A86";Defined in: packages/core/src/LiteGraph.ts:48
Globals
static Globals: Record<any, any> = {};Defined in: packages/core/src/LiteGraph.ts:70
used to store vars between graphs *
graph_inputs_outputs_use_combo_widget
static graph_inputs_outputs_use_combo_widget: boolean = false;Defined in: packages/core/src/LiteGraph.ts:144
ignore_all_widget_events
static ignore_all_widget_events: boolean = false;Defined in: packages/core/src/LiteGraph.ts:131
LINK_COLOR
static LINK_COLOR: string = "#9A9";Defined in: packages/core/src/LiteGraph.ts:47
MAX_NUMBER_OF_NODES
static MAX_NUMBER_OF_NODES: number = 1000;Defined in: packages/core/src/LiteGraph.ts:52
middle_click_slot_add_default_node
static middle_click_slot_add_default_node: boolean = false;Defined in: packages/core/src/LiteGraph.ts:125
node_box_coloured_by_mode
static node_box_coloured_by_mode: boolean = false;Defined in: packages/core/src/LiteGraph.ts:81
node_box_coloured_when_on
static node_box_coloured_when_on: boolean = false;Defined in: packages/core/src/LiteGraph.ts:79
NODE_BOX_OUTLINE_COLOR
static NODE_BOX_OUTLINE_COLOR: string = "#FFF";Defined in: packages/core/src/LiteGraph.ts:38
NODE_COLLAPSED_RADIUS
static NODE_COLLAPSED_RADIUS: number = 10;Defined in: packages/core/src/LiteGraph.ts:27
NODE_COLLAPSED_WIDTH
static NODE_COLLAPSED_WIDTH: number = 80;Defined in: packages/core/src/LiteGraph.ts:28
NODE_DEFAULT_BGCOLOR
static NODE_DEFAULT_BGCOLOR: string = "#353535";Defined in: packages/core/src/LiteGraph.ts:35
NODE_DEFAULT_BOXCOLOR
static NODE_DEFAULT_BOXCOLOR: string = "#666";Defined in: packages/core/src/LiteGraph.ts:36
NODE_DEFAULT_COLOR
static NODE_DEFAULT_COLOR: string = "#333";Defined in: packages/core/src/LiteGraph.ts:34
NODE_DEFAULT_SHAPE
static NODE_DEFAULT_SHAPE: string = "box";Defined in: packages/core/src/LiteGraph.ts:37
node_images_path
static node_images_path: string = "";Defined in: packages/core/src/LiteGraph.ts:56
NODE_MIN_WIDTH
static NODE_MIN_WIDTH: number = 50;Defined in: packages/core/src/LiteGraph.ts:26
NODE_SELECTED_TITLE_COLOR
static NODE_SELECTED_TITLE_COLOR: string = "#FFF";Defined in: packages/core/src/LiteGraph.ts:30
NODE_SLOT_HEIGHT
static NODE_SLOT_HEIGHT: number = 20;Defined in: packages/core/src/LiteGraph.ts:23
NODE_SUBTEXT_SIZE
static NODE_SUBTEXT_SIZE: number = 12;Defined in: packages/core/src/LiteGraph.ts:33
NODE_TEXT_COLOR
static NODE_TEXT_COLOR: string = "#AAA";Defined in: packages/core/src/LiteGraph.ts:32
NODE_TEXT_SIZE
static NODE_TEXT_SIZE: number = 14;Defined in: packages/core/src/LiteGraph.ts:31
NODE_TITLE_COLOR
static NODE_TITLE_COLOR: string = "#999";Defined in: packages/core/src/LiteGraph.ts:29
NODE_TITLE_HEIGHT
static NODE_TITLE_HEIGHT: number = 20;Defined in: packages/core/src/LiteGraph.ts:21
NODE_TITLE_TEXT_Y
static NODE_TITLE_TEXT_Y: number = 15;Defined in: packages/core/src/LiteGraph.ts:22
node_types_by_file_extension
static node_types_by_file_extension: Record<string, LGraphNodeConstructor> = {};Defined in: packages/core/src/LiteGraph.ts:66
used for dropping files in the canvas
NODE_WIDGET_HEIGHT
static NODE_WIDGET_HEIGHT: number = 20;Defined in: packages/core/src/LiteGraph.ts:24
NODE_WIDTH
static NODE_WIDTH: number = 140;Defined in: packages/core/src/LiteGraph.ts:25
Nodes
static Nodes: Record<string, LGraphNodeConstructor> = {};Defined in: packages/core/src/LiteGraph.ts:68
node types by class name
pointerevents_method
static pointerevents_method: PointerEventsMethod = "mouse";Defined in: packages/core/src/LiteGraph.ts:134
proxy
static proxy: any = null;Defined in: packages/core/src/LiteGraph.ts:55
registered_node_types
static registered_node_types: Record<string, LGraphNodeConstructor> = {};Defined in: packages/core/src/LiteGraph.ts:64
node types by string
registered_slot_in_types
static registered_slot_in_types: Record<string, {
nodes: string[];
}> = {};Defined in: packages/core/src/LiteGraph.ts:103
registered_slot_out_types
static registered_slot_out_types: Record<string, {
nodes: string[];
}> = {};Defined in: packages/core/src/LiteGraph.ts:105
release_link_on_empty_shows_menu
static release_link_on_empty_shows_menu: boolean = false;Defined in: packages/core/src/LiteGraph.ts:128
search_box_refresh_interval_ms
static search_box_refresh_interval_ms: number = 250;Defined in: packages/core/src/LiteGraph.ts:141
search_filter_enabled
static search_filter_enabled: boolean = false;Defined in: packages/core/src/LiteGraph.ts:95
search_hide_on_mouse_leave
static search_hide_on_mouse_leave: boolean = true;Defined in: packages/core/src/LiteGraph.ts:93
search_show_all_on_open
static search_show_all_on_open: boolean = true;Defined in: packages/core/src/LiteGraph.ts:97
searchbox_extras
static searchbox_extras: Record<string, SearchboxExtra> = {};Defined in: packages/core/src/LiteGraph.ts:73
used to add extra features to the search box
serialize_slot_data
static serialize_slot_data: boolean = false;Defined in: packages/core/src/LiteGraph.ts:147
shift_click_do_break_link_from
static shift_click_do_break_link_from: boolean = false;Defined in: packages/core/src/LiteGraph.ts:88
slot_types_default_in
static slot_types_default_in: Record<string, NodeTypeSpec[]> = {};Defined in: packages/core/src/LiteGraph.ts:111
slot_types_default_out
static slot_types_default_out: Record<string, NodeTypeSpec[]> = {};Defined in: packages/core/src/LiteGraph.ts:113
slot_types_in
static slot_types_in: string[] = [];Defined in: packages/core/src/LiteGraph.ts:107
slot_types_out
static slot_types_out: string[] = [];Defined in: packages/core/src/LiteGraph.ts:109
throw_errors
static throw_errors: boolean = true;Defined in: packages/core/src/LiteGraph.ts:60
use_uuids
static use_uuids: boolean = false;Defined in: packages/core/src/LiteGraph.ts:138
VERSION
static VERSION: number = 10.0;Defined in: packages/core/src/LiteGraph.ts:16
WIDGET_BGCOLOR
static WIDGET_BGCOLOR: string = "#222";Defined in: packages/core/src/LiteGraph.ts:42
WIDGET_OUTLINE_COLOR
static WIDGET_OUTLINE_COLOR: string = "#666";Defined in: packages/core/src/LiteGraph.ts:43
WIDGET_SECONDARY_TEXT_COLOR
static WIDGET_SECONDARY_TEXT_COLOR: string = "#999";Defined in: packages/core/src/LiteGraph.ts:45
WIDGET_TEXT_COLOR
static WIDGET_TEXT_COLOR: string = "#DDD";Defined in: packages/core/src/LiteGraph.ts:44
Methods
clearRegisteredTypes()
static clearRegisteredTypes(): void;Defined in: packages/core/src/LiteGraph.ts:300
Removes all previously registered node's types.
Returns
void
cloneObject()
static cloneObject<T>(obj?, target?): T;Defined in: packages/core/src/LiteGraph.ts:537
Type Parameters
T
T
Parameters
obj?
T
target?
T
Returns
T
colorToString()
static colorToString(c): string;Defined in: packages/core/src/LiteGraph.ts:618
Parameters
c
number[]
Returns
string
compareObjects()
static compareObjects(a, b): boolean;Defined in: packages/core/src/LiteGraph.ts:603
Parameters
a
object
b
object
Returns
boolean
createNode()
static createNode<T>(
type,
title?,
options?
): T;Defined in: packages/core/src/LiteGraph.ts:314
Create a node of a given type with a name. The node is not attached to any graph yet.
Type Parameters
T
T extends LGraphNode
Parameters
type
| string | LGraphNodeConstructorFactory<T>
full name of the node class. p.e. "math/sin"
title?
string
options?
LiteGraphCreateNodeOptions = {}
to set options
Returns
T
distance()
static distance(a, b): number;Defined in: packages/core/src/LiteGraph.ts:612
Parameters
a
b
Returns
number
getNodeType()
static getNodeType<T>(type): LGraphNodeConstructor<T>;Defined in: packages/core/src/LiteGraph.ts:428
Returns a registered node type with a given name
Type Parameters
T
T extends LGraphNode
Parameters
type
string
full name of the node class. p.e. "math/sin"
Returns
getNodeTypesCategories()
static getNodeTypesCategories(filter): string[];Defined in: packages/core/src/LiteGraph.ts:472
Returns a list with all the node type categories
Parameters
filter
string
only nodes with ctor.filter equal can be shown
Returns
string[]
array with all the names of the categories
Method
getNodeTypesCategories
getNodeTypesInCategory()
static getNodeTypesInCategory(category, filter): LGraphNodeConstructor<LGraphNode>[];Defined in: packages/core/src/LiteGraph.ts:439
Returns a list of node types matching one category
Parameters
category
string
category name
filter
string
only nodes with ctor.filter equal can be shown
Returns
LGraphNodeConstructor<LGraphNode>[]
array with all the node classes
Method
getNodeTypesInCategory
getTime()
static getTime(): number;Defined in: packages/core/src/LiteGraph.ts:598
Returns
number
growBounding()
static growBounding(
bounding,
x,
y
): Vector4;Defined in: packages/core/src/LiteGraph.ts:647
Parameters
bounding
x
number
y
number
Returns
hex2num()
static hex2num(hex): [number, number, number];Defined in: packages/core/src/LiteGraph.ts:696
Parameters
hex
string
Returns
[number, number, number]
isInsideBounding()
static isInsideBounding(p, bb): boolean;Defined in: packages/core/src/LiteGraph.ts:663
Parameters
p
bb
Returns
boolean
isInsideRectangle()
static isInsideRectangle(
x,
y,
left,
top,
width,
height
): boolean;Defined in: packages/core/src/LiteGraph.ts:632
Parameters
x
number
y
number
left
number
top
number
width
number
height
number
Returns
boolean
isValidConnection()
static isValidConnection(type_a, type_b): boolean;Defined in: packages/core/src/LiteGraph.ts:559
Returns if the types of two slots are compatible (taking into account wildcards, etc)
Parameters
type_a
type_b
Returns
boolean
true if they can be connected
Method
isValidConnection
num2hex()
static num2hex(triplet): string;Defined in: packages/core/src/LiteGraph.ts:716
Parameters
triplet
[number, number, number]
Returns
string
onNodeTypeRegistered()?
static onNodeTypeRegistered?(type, regConfig): void;Defined in: packages/core/src/LiteGraph.ts:219
Parameters
type
string
regConfig
Returns
void
onNodeTypeReplaced()?
static onNodeTypeReplaced?(
type,
regConfig,
prev
): void;Defined in: packages/core/src/LiteGraph.ts:220
Parameters
type
string
regConfig
prev
Returns
void
overlapBounding()
static overlapBounding(a, b): boolean;Defined in: packages/core/src/LiteGraph.ts:676
Parameters
a
Float32Array
b
Float32Array
Returns
boolean
pointerListenerAdd()
static pointerListenerAdd(
oDOM,
sEvIn,
fCall,
capture?
): void;Defined in: packages/core/src/LiteGraph.ts:736
Parameters
oDOM
Node
sEvIn
string
fCall
(e) => any
capture?
boolean = false
Returns
void
pointerListenerRemove()
static pointerListenerRemove(
oDOM,
sEvent,
fCall,
capture?
): any;Defined in: packages/core/src/LiteGraph.ts:799
Parameters
oDOM
any
sEvent
string
fCall
any
capture?
boolean = false
Returns
any
registerNodeAndSlotType()
static registerNodeAndSlotType(
type,
slot_type,
out?
): void;Defined in: packages/core/src/LiteGraph.ts:244
Save a slot type and his node
Parameters
type
| string | LGraphNode | LGraphNodeConstructor<LGraphNode>
name of the node or the node constructor itself
slot_type
name of the slot type (variable type), eg. string, number, array, boolean, ..
out?
boolean = false
Returns
void
Method
registerSlotType
registerNodeType()
static registerNodeType<T>(config, nodeClass?): void;Defined in: packages/core/src/LiteGraph.ts:150
Register a node class so it can be listed when the user wants to create a new one
Type Parameters
T
T extends LGraphNode
Parameters
config
| string | LGraphNodeConstructor<LGraphNode>
nodeClass?
LGraphNodeConstructorFactory<T>
Returns
void
reloadNodes()
static reloadNodes(folder_wildcard): void;Defined in: packages/core/src/LiteGraph.ts:490
debug purposes: reloads all the js scripts that matches a wildcard
Parameters
folder_wildcard
string
Returns
void
unregisterNodeType()
static unregisterNodeType(type): void;Defined in: packages/core/src/LiteGraph.ts:223
removes a node type from the system
Parameters
type
| string | LGraphNodeConstructor<LGraphNode>
Returns
void
use()
static use(plugin): typeof default;Defined in: packages/core/src/LiteGraph.ts:823
Parameters
plugin
any
Returns
typeof default