@codebolt/litegraph 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +19 -0
- package/README.md +161 -0
- package/dist/CanvasPointer.d.ts +120 -0
- package/dist/ContextMenu.d.ts +41 -0
- package/dist/CurveEditor.d.ts +18 -0
- package/dist/DragAndScale.d.ts +67 -0
- package/dist/LGraph.d.ts +407 -0
- package/dist/LGraphBadge.d.ts +33 -0
- package/dist/LGraphButton.d.ts +27 -0
- package/dist/LGraphCanvas.d.ts +772 -0
- package/dist/LGraphGroup.d.ts +81 -0
- package/dist/LGraphIcon.d.ts +22 -0
- package/dist/LGraphNode.d.ts +883 -0
- package/dist/LLink.d.ts +194 -0
- package/dist/LiteGraphGlobal.d.ts +360 -0
- package/dist/MapProxyHandler.d.ts +13 -0
- package/dist/Reroute.d.ts +185 -0
- package/dist/canvas/FloatingRenderLink.d.ts +55 -0
- package/dist/canvas/InputIndicators.d.ts +45 -0
- package/dist/canvas/LinkConnector.d.ts +165 -0
- package/dist/canvas/MovingInputLink.d.ts +34 -0
- package/dist/canvas/MovingLinkBase.d.ts +55 -0
- package/dist/canvas/MovingOutputLink.d.ts +30 -0
- package/dist/canvas/RenderLink.d.ts +39 -0
- package/dist/canvas/ToInputFromIoNodeLink.d.ts +37 -0
- package/dist/canvas/ToInputRenderLink.d.ts +35 -0
- package/dist/canvas/ToOutputFromIoNodeLink.d.ts +33 -0
- package/dist/canvas/ToOutputFromRerouteLink.d.ts +15 -0
- package/dist/canvas/ToOutputRenderLink.d.ts +32 -0
- package/dist/canvas/measureSlots.d.ts +22 -0
- package/dist/constants.d.ts +9 -0
- package/dist/css/litegraph.css +638 -0
- package/dist/draw.d.ts +65 -0
- package/dist/infrastructure/ConstrainedSize.d.ts +27 -0
- package/dist/infrastructure/CustomEventTarget.d.ts +72 -0
- package/dist/infrastructure/InvalidLinkError.d.ts +3 -0
- package/dist/infrastructure/LGraphCanvasEventMap.d.ts +41 -0
- package/dist/infrastructure/LGraphEventMap.d.ts +43 -0
- package/dist/infrastructure/LinkConnectorEventMap.d.ts +47 -0
- package/dist/infrastructure/NullGraphError.d.ts +3 -0
- package/dist/infrastructure/Rectangle.d.ts +163 -0
- package/dist/infrastructure/RecursionError.d.ts +6 -0
- package/dist/infrastructure/SlotIndexError.d.ts +3 -0
- package/dist/infrastructure/SubgraphEventMap.d.ts +49 -0
- package/dist/infrastructure/SubgraphInputEventMap.d.ts +13 -0
- package/dist/interfaces.d.ts +388 -0
- package/dist/litegraph.d.ts +95 -0
- package/dist/litegraph.es.js +17613 -0
- package/dist/litegraph.es.js.map +1 -0
- package/dist/litegraph.umd.js +3 -0
- package/dist/litegraph.umd.js.map +1 -0
- package/dist/measure.d.ts +168 -0
- package/dist/node/NodeInputSlot.d.ts +20 -0
- package/dist/node/NodeOutputSlot.d.ts +18 -0
- package/dist/node/NodeSlot.d.ts +35 -0
- package/dist/node/SlotBase.d.ts +27 -0
- package/dist/node/slotUtils.d.ts +17 -0
- package/dist/polyfills.d.ts +1 -0
- package/dist/strings.d.ts +22 -0
- package/dist/subgraph/EmptySubgraphInput.d.ts +15 -0
- package/dist/subgraph/EmptySubgraphOutput.d.ts +15 -0
- package/dist/subgraph/ExecutableNodeDTO.d.ts +96 -0
- package/dist/subgraph/Subgraph.d.ts +65 -0
- package/dist/subgraph/SubgraphIONodeBase.d.ts +80 -0
- package/dist/subgraph/SubgraphInput.d.ts +47 -0
- package/dist/subgraph/SubgraphInputNode.d.ts +33 -0
- package/dist/subgraph/SubgraphNode.d.ts +73 -0
- package/dist/subgraph/SubgraphOutput.d.ts +30 -0
- package/dist/subgraph/SubgraphOutputNode.d.ts +31 -0
- package/dist/subgraph/SubgraphSlotBase.d.ts +61 -0
- package/dist/subgraph/subgraphUtils.d.ts +77 -0
- package/dist/types/NodeLike.d.ts +7 -0
- package/dist/types/events.d.ts +64 -0
- package/dist/types/globalEnums.d.ts +130 -0
- package/dist/types/serialisation.d.ts +198 -0
- package/dist/types/utility.d.ts +11 -0
- package/dist/types/widgets.d.ts +209 -0
- package/dist/utils/arrange.d.ts +22 -0
- package/dist/utils/collections.d.ts +38 -0
- package/dist/utils/feedback.d.ts +7 -0
- package/dist/utils/object.d.ts +1 -0
- package/dist/utils/spaceDistribution.d.ts +11 -0
- package/dist/utils/textUtils.d.ts +9 -0
- package/dist/utils/type.d.ts +14 -0
- package/dist/utils/uuid.d.ts +13 -0
- package/dist/utils/widget.d.ts +7 -0
- package/dist/widgets/BaseSteppedWidget.d.ts +34 -0
- package/dist/widgets/BaseWidget.d.ts +125 -0
- package/dist/widgets/BooleanWidget.d.ts +9 -0
- package/dist/widgets/ButtonWidget.d.ts +16 -0
- package/dist/widgets/ComboWidget.d.ts +17 -0
- package/dist/widgets/KnobWidget.d.ts +20 -0
- package/dist/widgets/LegacyWidget.d.ts +14 -0
- package/dist/widgets/NumberWidget.d.ts +18 -0
- package/dist/widgets/SliderWidget.d.ts +20 -0
- package/dist/widgets/TextWidget.d.ts +13 -0
- package/dist/widgets/widgetMap.d.ts +50 -0
- package/package.json +76 -0
package/dist/LLink.d.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { CanvasColour, INodeInputSlot, INodeOutputSlot, ISlotType, LinkNetwork, LinkSegment, ReadonlyLinkNetwork } from './interfaces';
|
|
2
|
+
import { LGraphNode, NodeId } from './LGraphNode';
|
|
3
|
+
import { Reroute, RerouteId } from './Reroute';
|
|
4
|
+
import { Serialisable, SerialisableLLink, SubgraphIO } from './types/serialisation';
|
|
5
|
+
export type LinkId = number;
|
|
6
|
+
export type SerialisedLLinkArray = [
|
|
7
|
+
id: LinkId,
|
|
8
|
+
origin_id: NodeId,
|
|
9
|
+
origin_slot: number,
|
|
10
|
+
target_id: NodeId,
|
|
11
|
+
target_slot: number,
|
|
12
|
+
type: ISlotType
|
|
13
|
+
];
|
|
14
|
+
export type ResolvedConnection = BaseResolvedConnection & ((ResolvedSubgraphInput & ResolvedNormalOutput) | (ResolvedNormalInput & ResolvedSubgraphOutput) | (ResolvedNormalInput & ResolvedNormalOutput));
|
|
15
|
+
interface BaseResolvedConnection {
|
|
16
|
+
link: LLink;
|
|
17
|
+
/** The node on the input side of the link (owns {@link input}) */
|
|
18
|
+
inputNode?: LGraphNode;
|
|
19
|
+
/** The input the link is connected to (mutually exclusive with {@link subgraphOutput}) */
|
|
20
|
+
input?: INodeInputSlot;
|
|
21
|
+
/** The node on the output side of the link (owns {@link output}) */
|
|
22
|
+
outputNode?: LGraphNode;
|
|
23
|
+
/** The output the link is connected to (mutually exclusive with {@link subgraphInput}) */
|
|
24
|
+
output?: INodeOutputSlot;
|
|
25
|
+
/** The subgraph output the link is connected to (mutually exclusive with {@link input}) */
|
|
26
|
+
subgraphOutput?: SubgraphIO;
|
|
27
|
+
/** The subgraph input the link is connected to (mutually exclusive with {@link output}) */
|
|
28
|
+
subgraphInput?: SubgraphIO;
|
|
29
|
+
}
|
|
30
|
+
interface ResolvedNormalInput {
|
|
31
|
+
inputNode: LGraphNode | undefined;
|
|
32
|
+
input: INodeInputSlot | undefined;
|
|
33
|
+
subgraphOutput?: undefined;
|
|
34
|
+
}
|
|
35
|
+
interface ResolvedNormalOutput {
|
|
36
|
+
outputNode: LGraphNode | undefined;
|
|
37
|
+
output: INodeOutputSlot | undefined;
|
|
38
|
+
subgraphInput?: undefined;
|
|
39
|
+
}
|
|
40
|
+
interface ResolvedSubgraphInput {
|
|
41
|
+
inputNode?: undefined;
|
|
42
|
+
/** The actual input slot the link is connected to (mutually exclusive with {@link subgraphOutput}) */
|
|
43
|
+
input?: undefined;
|
|
44
|
+
subgraphOutput: SubgraphIO;
|
|
45
|
+
}
|
|
46
|
+
interface ResolvedSubgraphOutput {
|
|
47
|
+
outputNode?: undefined;
|
|
48
|
+
output?: undefined;
|
|
49
|
+
subgraphInput: SubgraphIO;
|
|
50
|
+
}
|
|
51
|
+
type BasicReadonlyNetwork = Pick<ReadonlyLinkNetwork, "getNodeById" | "links" | "getLink" | "inputNode" | "outputNode">;
|
|
52
|
+
export declare class LLink implements LinkSegment, Serialisable<SerialisableLLink> {
|
|
53
|
+
#private;
|
|
54
|
+
static _drawDebug: boolean;
|
|
55
|
+
/** Link ID */
|
|
56
|
+
id: LinkId;
|
|
57
|
+
parentId?: RerouteId;
|
|
58
|
+
type: ISlotType;
|
|
59
|
+
/** Output node ID */
|
|
60
|
+
origin_id: NodeId;
|
|
61
|
+
/** Output slot index */
|
|
62
|
+
origin_slot: number;
|
|
63
|
+
/** Input node ID */
|
|
64
|
+
target_id: NodeId;
|
|
65
|
+
/** Input slot index */
|
|
66
|
+
target_slot: number;
|
|
67
|
+
data?: number | string | boolean | {
|
|
68
|
+
toToolTip?(): string;
|
|
69
|
+
};
|
|
70
|
+
_data?: unknown;
|
|
71
|
+
/** Centre point of the link, calculated during render only - can be inaccurate */
|
|
72
|
+
_pos: Float32Array;
|
|
73
|
+
/** @todo Clean up - never implemented in comfy. */
|
|
74
|
+
_last_time?: number;
|
|
75
|
+
/** The last canvas 2D path that was used to render this link */
|
|
76
|
+
path?: Path2D;
|
|
77
|
+
/** @inheritdoc */
|
|
78
|
+
_centreAngle?: number;
|
|
79
|
+
/** @inheritdoc */
|
|
80
|
+
_dragging?: boolean;
|
|
81
|
+
/** Custom colour for this link only */
|
|
82
|
+
get color(): CanvasColour | null | undefined;
|
|
83
|
+
set color(value: CanvasColour);
|
|
84
|
+
get isFloatingOutput(): boolean;
|
|
85
|
+
get isFloatingInput(): boolean;
|
|
86
|
+
get isFloating(): boolean;
|
|
87
|
+
/** `true` if this link is connected to a subgraph input node (the actual origin is in a different graph). */
|
|
88
|
+
get originIsIoNode(): boolean;
|
|
89
|
+
/** `true` if this link is connected to a subgraph output node (the actual target is in a different graph). */
|
|
90
|
+
get targetIsIoNode(): boolean;
|
|
91
|
+
constructor(id: LinkId, type: ISlotType, origin_id: NodeId, origin_slot: number, target_id: NodeId, target_slot: number, parentId?: RerouteId);
|
|
92
|
+
/** @deprecated Use {@link LLink.create} */
|
|
93
|
+
static createFromArray(data: SerialisedLLinkArray): LLink;
|
|
94
|
+
/**
|
|
95
|
+
* LLink static factory: creates a new LLink from the provided data.
|
|
96
|
+
* @param data Serialised LLink data to create the link from
|
|
97
|
+
* @returns A new LLink
|
|
98
|
+
*/
|
|
99
|
+
static create(data: SerialisableLLink): LLink;
|
|
100
|
+
/**
|
|
101
|
+
* Gets all reroutes from the output slot to this segment. If this segment is a reroute, it will not be included.
|
|
102
|
+
* @returns An ordered array of all reroutes from the node output to
|
|
103
|
+
* this reroute or the reroute before it. Otherwise, an empty array.
|
|
104
|
+
*/
|
|
105
|
+
static getReroutes(network: Pick<ReadonlyLinkNetwork, "reroutes">, linkSegment: LinkSegment): Reroute[];
|
|
106
|
+
static getFirstReroute(network: Pick<ReadonlyLinkNetwork, "reroutes">, linkSegment: LinkSegment): Reroute | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Finds the reroute in the chain after the provided reroute ID.
|
|
109
|
+
* @param network The network this link belongs to
|
|
110
|
+
* @param linkSegment The starting point of the search (input side).
|
|
111
|
+
* Typically the LLink object itself, but can be any link segment.
|
|
112
|
+
* @param rerouteId The matching reroute will have this set as its {@link parentId}.
|
|
113
|
+
* @returns The reroute that was found, `undefined` if no reroute was found, or `null` if an infinite loop was detected.
|
|
114
|
+
*/
|
|
115
|
+
static findNextReroute(network: Pick<ReadonlyLinkNetwork, "reroutes">, linkSegment: LinkSegment, rerouteId: RerouteId): Reroute | null | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Gets the origin node of a link.
|
|
118
|
+
* @param network The network to search
|
|
119
|
+
* @param linkId The ID of the link to get the origin node of
|
|
120
|
+
* @returns The origin node of the link, or `undefined` if the link is not found or the origin node is not found
|
|
121
|
+
*/
|
|
122
|
+
static getOriginNode(network: BasicReadonlyNetwork, linkId: LinkId): LGraphNode | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Gets the target node of a link.
|
|
125
|
+
* @param network The network to search
|
|
126
|
+
* @param linkId The ID of the link to get the target node of
|
|
127
|
+
* @returns The target node of the link, or `undefined` if the link is not found or the target node is not found
|
|
128
|
+
*/
|
|
129
|
+
static getTargetNode(network: BasicReadonlyNetwork, linkId: LinkId): LGraphNode | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Resolves a link ID to the link, node, and slot objects.
|
|
132
|
+
* @param linkId The {@link id} of the link to resolve
|
|
133
|
+
* @param network The link network to search
|
|
134
|
+
* @returns An object containing the input and output nodes, as well as the input and output slots.
|
|
135
|
+
* @remarks This method is heavier than others; it will always resolve all objects.
|
|
136
|
+
* Whilst the performance difference should in most cases be negligible,
|
|
137
|
+
* it is recommended to use simpler methods where appropriate.
|
|
138
|
+
*/
|
|
139
|
+
static resolve(linkId: LinkId | null | undefined, network: BasicReadonlyNetwork): ResolvedConnection | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Resolves a list of link IDs to the link, node, and slot objects.
|
|
142
|
+
* Discards invalid link IDs.
|
|
143
|
+
* @param linkIds An iterable of link {@link id}s to resolve
|
|
144
|
+
* @param network The link network to search
|
|
145
|
+
* @returns An array of resolved connections. If a link is not found, it is not included in the array.
|
|
146
|
+
* @see {@link LLink.resolve}
|
|
147
|
+
*/
|
|
148
|
+
static resolveMany(linkIds: Iterable<LinkId>, network: BasicReadonlyNetwork): ResolvedConnection[];
|
|
149
|
+
/**
|
|
150
|
+
* Resolves the primitive ID values stored in the link to the referenced objects.
|
|
151
|
+
* @param network The link network to search
|
|
152
|
+
* @returns An object containing the input and output nodes, as well as the input and output slots.
|
|
153
|
+
* @remarks This method is heavier than others; it will always resolve all objects.
|
|
154
|
+
* Whilst the performance difference should in most cases be negligible,
|
|
155
|
+
* it is recommended to use simpler methods where appropriate.
|
|
156
|
+
*/
|
|
157
|
+
resolve(network: BasicReadonlyNetwork): ResolvedConnection;
|
|
158
|
+
configure(o: LLink | SerialisedLLinkArray): void;
|
|
159
|
+
/**
|
|
160
|
+
* Checks if the specified node id and output index are this link's origin (output side).
|
|
161
|
+
* @param nodeId ID of the node to check
|
|
162
|
+
* @param outputIndex The array index of the node output
|
|
163
|
+
* @returns `true` if the origin matches, otherwise `false`.
|
|
164
|
+
*/
|
|
165
|
+
hasOrigin(nodeId: NodeId, outputIndex: number): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Checks if the specified node id and input index are this link's target (input side).
|
|
168
|
+
* @param nodeId ID of the node to check
|
|
169
|
+
* @param inputIndex The array index of the node input
|
|
170
|
+
* @returns `true` if the target matches, otherwise `false`.
|
|
171
|
+
*/
|
|
172
|
+
hasTarget(nodeId: NodeId, inputIndex: number): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Creates a floating link from this link.
|
|
175
|
+
* @param slotType The side of the link that is still connected
|
|
176
|
+
* @param parentId The parent reroute ID of the link
|
|
177
|
+
* @returns A new LLink that is floating
|
|
178
|
+
*/
|
|
179
|
+
toFloating(slotType: "input" | "output", parentId: RerouteId): LLink;
|
|
180
|
+
/**
|
|
181
|
+
* Disconnects a link and removes it from the graph, cleaning up any reroutes that are no longer used
|
|
182
|
+
* @param network The container (LGraph) where reroutes should be updated
|
|
183
|
+
* @param keepReroutes If `undefined`, reroutes will be automatically removed if no links remain.
|
|
184
|
+
* If `input` or `output`, reroutes will not be automatically removed, and retain a connection to the input or output, respectively.
|
|
185
|
+
*/
|
|
186
|
+
disconnect(network: LinkNetwork, keepReroutes?: "input" | "output"): void;
|
|
187
|
+
/**
|
|
188
|
+
* @deprecated Prefer {@link LLink.asSerialisable} (returns an object, not an array)
|
|
189
|
+
* @returns An array representing this LLink
|
|
190
|
+
*/
|
|
191
|
+
serialize(): SerialisedLLinkArray;
|
|
192
|
+
asSerialisable(): SerialisableLLink;
|
|
193
|
+
}
|
|
194
|
+
export {};
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { Dictionary, ISlotType, Rect, WhenNullish } from './interfaces';
|
|
2
|
+
import { InputIndicators } from './canvas/InputIndicators';
|
|
3
|
+
import { ContextMenu } from './ContextMenu';
|
|
4
|
+
import { CurveEditor } from './CurveEditor';
|
|
5
|
+
import { DragAndScale } from './DragAndScale';
|
|
6
|
+
import { LabelPosition, SlotDirection, SlotShape, SlotType } from './draw';
|
|
7
|
+
import { Rectangle } from './infrastructure/Rectangle';
|
|
8
|
+
import { LGraph } from './LGraph';
|
|
9
|
+
import { LGraphCanvas } from './LGraphCanvas';
|
|
10
|
+
import { LGraphGroup } from './LGraphGroup';
|
|
11
|
+
import { LGraphNode } from './LGraphNode';
|
|
12
|
+
import { LLink } from './LLink';
|
|
13
|
+
import { distance, isInsideRectangle, overlapBounding } from './measure';
|
|
14
|
+
import { Reroute } from './Reroute';
|
|
15
|
+
import { SubgraphIONodeBase } from './subgraph/SubgraphIONodeBase';
|
|
16
|
+
import { SubgraphSlot } from './subgraph/SubgraphSlotBase';
|
|
17
|
+
import { LGraphEventMode, LinkDirection, LinkRenderType, NodeSlotType, RenderShape, TitleMode } from './types/globalEnums';
|
|
18
|
+
import { createUuidv4 } from './utils/uuid';
|
|
19
|
+
/**
|
|
20
|
+
* The Global Scope. It contains all the registered node classes.
|
|
21
|
+
*/
|
|
22
|
+
export declare class LiteGraphGlobal {
|
|
23
|
+
SlotShape: typeof SlotShape;
|
|
24
|
+
SlotDirection: typeof SlotDirection;
|
|
25
|
+
SlotType: typeof SlotType;
|
|
26
|
+
LabelPosition: typeof LabelPosition;
|
|
27
|
+
/** Used in serialised graphs at one point. */
|
|
28
|
+
VERSION: 0.4;
|
|
29
|
+
CANVAS_GRID_SIZE: number;
|
|
30
|
+
NODE_TITLE_HEIGHT: number;
|
|
31
|
+
NODE_TITLE_TEXT_Y: number;
|
|
32
|
+
NODE_SLOT_HEIGHT: number;
|
|
33
|
+
NODE_WIDGET_HEIGHT: number;
|
|
34
|
+
NODE_WIDTH: number;
|
|
35
|
+
NODE_MIN_WIDTH: number;
|
|
36
|
+
NODE_COLLAPSED_RADIUS: number;
|
|
37
|
+
NODE_COLLAPSED_WIDTH: number;
|
|
38
|
+
NODE_TITLE_COLOR: string;
|
|
39
|
+
NODE_SELECTED_TITLE_COLOR: string;
|
|
40
|
+
NODE_TEXT_SIZE: number;
|
|
41
|
+
NODE_TEXT_COLOR: string;
|
|
42
|
+
NODE_TEXT_HIGHLIGHT_COLOR: string;
|
|
43
|
+
NODE_SUBTEXT_SIZE: number;
|
|
44
|
+
NODE_DEFAULT_COLOR: string;
|
|
45
|
+
NODE_DEFAULT_BGCOLOR: string;
|
|
46
|
+
NODE_DEFAULT_BOXCOLOR: string;
|
|
47
|
+
NODE_DEFAULT_SHAPE: RenderShape;
|
|
48
|
+
NODE_BOX_OUTLINE_COLOR: string;
|
|
49
|
+
NODE_ERROR_COLOUR: string;
|
|
50
|
+
NODE_FONT: string;
|
|
51
|
+
DEFAULT_FONT: string;
|
|
52
|
+
DEFAULT_SHADOW_COLOR: string;
|
|
53
|
+
DEFAULT_GROUP_FONT: number;
|
|
54
|
+
DEFAULT_GROUP_FONT_SIZE?: any;
|
|
55
|
+
GROUP_FONT: string;
|
|
56
|
+
WIDGET_BGCOLOR: string;
|
|
57
|
+
WIDGET_OUTLINE_COLOR: string;
|
|
58
|
+
WIDGET_ADVANCED_OUTLINE_COLOR: string;
|
|
59
|
+
WIDGET_TEXT_COLOR: string;
|
|
60
|
+
WIDGET_SECONDARY_TEXT_COLOR: string;
|
|
61
|
+
WIDGET_DISABLED_TEXT_COLOR: string;
|
|
62
|
+
LINK_COLOR: string;
|
|
63
|
+
EVENT_LINK_COLOR: string;
|
|
64
|
+
CONNECTING_LINK_COLOR: string;
|
|
65
|
+
/** avoid infinite loops */
|
|
66
|
+
MAX_NUMBER_OF_NODES: number;
|
|
67
|
+
/** default node position */
|
|
68
|
+
DEFAULT_POSITION: number[];
|
|
69
|
+
/** ,"circle" */
|
|
70
|
+
VALID_SHAPES: ("default" | "box" | "round" | "card")[];
|
|
71
|
+
ROUND_RADIUS: number;
|
|
72
|
+
BOX_SHAPE: RenderShape;
|
|
73
|
+
ROUND_SHAPE: RenderShape;
|
|
74
|
+
CIRCLE_SHAPE: RenderShape;
|
|
75
|
+
CARD_SHAPE: RenderShape;
|
|
76
|
+
ARROW_SHAPE: RenderShape;
|
|
77
|
+
/** intended for slot arrays */
|
|
78
|
+
GRID_SHAPE: RenderShape;
|
|
79
|
+
INPUT: NodeSlotType;
|
|
80
|
+
OUTPUT: NodeSlotType;
|
|
81
|
+
/** for outputs */
|
|
82
|
+
EVENT: -1;
|
|
83
|
+
/** for inputs */
|
|
84
|
+
ACTION: -1;
|
|
85
|
+
/** helper, will add "On Request" and more in the future */
|
|
86
|
+
NODE_MODES: string[];
|
|
87
|
+
/** use with node_box_coloured_by_mode */
|
|
88
|
+
NODE_MODES_COLORS: string[];
|
|
89
|
+
ALWAYS: LGraphEventMode;
|
|
90
|
+
ON_EVENT: LGraphEventMode;
|
|
91
|
+
NEVER: LGraphEventMode;
|
|
92
|
+
ON_TRIGGER: LGraphEventMode;
|
|
93
|
+
UP: LinkDirection;
|
|
94
|
+
DOWN: LinkDirection;
|
|
95
|
+
LEFT: LinkDirection;
|
|
96
|
+
RIGHT: LinkDirection;
|
|
97
|
+
CENTER: LinkDirection;
|
|
98
|
+
/** helper */
|
|
99
|
+
LINK_RENDER_MODES: string[];
|
|
100
|
+
HIDDEN_LINK: LinkRenderType;
|
|
101
|
+
STRAIGHT_LINK: LinkRenderType;
|
|
102
|
+
LINEAR_LINK: LinkRenderType;
|
|
103
|
+
SPLINE_LINK: LinkRenderType;
|
|
104
|
+
NORMAL_TITLE: TitleMode;
|
|
105
|
+
NO_TITLE: TitleMode;
|
|
106
|
+
TRANSPARENT_TITLE: TitleMode;
|
|
107
|
+
AUTOHIDE_TITLE: TitleMode;
|
|
108
|
+
/** arrange nodes vertically */
|
|
109
|
+
VERTICAL_LAYOUT: string;
|
|
110
|
+
/** used to redirect calls */
|
|
111
|
+
proxy: null;
|
|
112
|
+
node_images_path: string;
|
|
113
|
+
debug: boolean;
|
|
114
|
+
catch_exceptions: boolean;
|
|
115
|
+
throw_errors: boolean;
|
|
116
|
+
/** 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 */
|
|
117
|
+
allow_scripts: boolean;
|
|
118
|
+
/** nodetypes by string */
|
|
119
|
+
registered_node_types: Record<string, typeof LGraphNode>;
|
|
120
|
+
/** @deprecated used for dropping files in the canvas. It appears the code that enables this was removed, but the object remains and is references by built-in drag drop. */
|
|
121
|
+
node_types_by_file_extension: Record<string, {
|
|
122
|
+
type: string;
|
|
123
|
+
}>;
|
|
124
|
+
/** node types by classname */
|
|
125
|
+
Nodes: Record<string, typeof LGraphNode>;
|
|
126
|
+
/** used to store vars between graphs */
|
|
127
|
+
Globals: {};
|
|
128
|
+
/** @deprecated Unused and will be deleted. */
|
|
129
|
+
searchbox_extras: Dictionary<unknown>;
|
|
130
|
+
/** [true!] this make the nodes box (top left circle) coloured when triggered (execute/action), visual feedback */
|
|
131
|
+
node_box_coloured_when_on: boolean;
|
|
132
|
+
/** [true!] nodebox based on node mode, visual feedback */
|
|
133
|
+
node_box_coloured_by_mode: boolean;
|
|
134
|
+
/** [false on mobile] better true if not touch device, TODO add an helper/listener to close if false */
|
|
135
|
+
dialog_close_on_mouse_leave: boolean;
|
|
136
|
+
dialog_close_on_mouse_leave_delay: number;
|
|
137
|
+
/** [false!] prefer false if results too easy to break links - implement with ALT or TODO custom keys */
|
|
138
|
+
shift_click_do_break_link_from: boolean;
|
|
139
|
+
/** [false!]prefer false, way too easy to break links */
|
|
140
|
+
click_do_break_link_to: boolean;
|
|
141
|
+
/** [true!] who accidentally ctrl-alt-clicks on an in/output? nobody! that's who! */
|
|
142
|
+
ctrl_alt_click_do_break_link: boolean;
|
|
143
|
+
/** [true!] snaps links when dragging connections over valid targets */
|
|
144
|
+
snaps_for_comfy: boolean;
|
|
145
|
+
/** [true!] renders a partial border to highlight when a dragged link is snapped to a node */
|
|
146
|
+
snap_highlights_node: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* If `true`, items always snap to the grid - modifier keys are ignored.
|
|
149
|
+
* When {@link snapToGrid} is falsy, a value of `1` is used.
|
|
150
|
+
* Default: `false`
|
|
151
|
+
*/
|
|
152
|
+
alwaysSnapToGrid?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* When set to a positive number, when nodes are moved their positions will
|
|
155
|
+
* be rounded to the nearest multiple of this value. Half up.
|
|
156
|
+
* Default: `undefined`
|
|
157
|
+
* @todo Not implemented - see {@link LiteGraph.CANVAS_GRID_SIZE}
|
|
158
|
+
*/
|
|
159
|
+
snapToGrid?: number;
|
|
160
|
+
/** [false on mobile] better true if not touch device, TODO add an helper/listener to close if false */
|
|
161
|
+
search_hide_on_mouse_leave: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* [true!] enable filtering slots type in the search widget
|
|
164
|
+
* !requires auto_load_slot_types or manual set registered_slot_[in/out]_types and slot_types_[in/out]
|
|
165
|
+
*/
|
|
166
|
+
search_filter_enabled: boolean;
|
|
167
|
+
/** [true!] opens the results list when opening the search widget */
|
|
168
|
+
search_show_all_on_open: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* [if want false, use true, run, get vars values to be statically set, than disable]
|
|
171
|
+
* nodes types and nodeclass association with node types need to be calculated,
|
|
172
|
+
* if dont want this, calculate once and set registered_slot_[in/out]_types and slot_types_[in/out]
|
|
173
|
+
*/
|
|
174
|
+
auto_load_slot_types: boolean;
|
|
175
|
+
/** slot types for nodeclass */
|
|
176
|
+
registered_slot_in_types: Record<string, {
|
|
177
|
+
nodes: string[];
|
|
178
|
+
}>;
|
|
179
|
+
/** slot types for nodeclass */
|
|
180
|
+
registered_slot_out_types: Record<string, {
|
|
181
|
+
nodes: string[];
|
|
182
|
+
}>;
|
|
183
|
+
/** slot types IN */
|
|
184
|
+
slot_types_in: string[];
|
|
185
|
+
/** slot types OUT */
|
|
186
|
+
slot_types_out: string[];
|
|
187
|
+
/**
|
|
188
|
+
* specify for each IN slot type a(/many) default node(s), use single string, array, or object
|
|
189
|
+
* (with node, title, parameters, ..) like for search
|
|
190
|
+
*/
|
|
191
|
+
slot_types_default_in: Record<string, string[]>;
|
|
192
|
+
/**
|
|
193
|
+
* specify for each OUT slot type a(/many) default node(s), use single string, array, or object
|
|
194
|
+
* (with node, title, parameters, ..) like for search
|
|
195
|
+
*/
|
|
196
|
+
slot_types_default_out: Record<string, string[]>;
|
|
197
|
+
/** [true!] very handy, ALT click to clone and drag the new node */
|
|
198
|
+
alt_drag_do_clone_nodes: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* [true!] will create and connect event slots when using action/events connections,
|
|
201
|
+
* !WILL CHANGE node mode when using onTrigger (enable mode colors), onExecuted does not need this
|
|
202
|
+
*/
|
|
203
|
+
do_add_triggers_slots: boolean;
|
|
204
|
+
/** [false!] being events, it is strongly reccomended to use them sequentially, one by one */
|
|
205
|
+
allow_multi_output_for_events: boolean;
|
|
206
|
+
/** [true!] allows to create and connect a ndoe clicking with the third button (wheel) */
|
|
207
|
+
middle_click_slot_add_default_node: boolean;
|
|
208
|
+
/** [true!] dragging a link to empty space will open a menu, add from list, search or defaults */
|
|
209
|
+
release_link_on_empty_shows_menu: boolean;
|
|
210
|
+
/** "mouse"|"pointer" use mouse for retrocompatibility issues? (none found @ now) */
|
|
211
|
+
pointerevents_method: string;
|
|
212
|
+
/**
|
|
213
|
+
* [true!] allows ctrl + shift + v to paste nodes with the outputs of the unselected nodes connected
|
|
214
|
+
* with the inputs of the newly pasted nodes
|
|
215
|
+
*/
|
|
216
|
+
ctrl_shift_v_paste_connect_unselected_outputs: boolean;
|
|
217
|
+
use_uuids: boolean;
|
|
218
|
+
highlight_selected_group: boolean;
|
|
219
|
+
/** Whether to scale context with the graph when zooming in. Zooming out never makes context menus smaller. */
|
|
220
|
+
context_menu_scaling: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Debugging flag. Repeats deprecation warnings every time they are reported.
|
|
223
|
+
* May impact performance.
|
|
224
|
+
*/
|
|
225
|
+
alwaysRepeatWarnings: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Array of callbacks to execute when Litegraph first reports a deprecated API being used.
|
|
228
|
+
* @see alwaysRepeatWarnings By default, will not repeat identical messages.
|
|
229
|
+
*/
|
|
230
|
+
onDeprecationWarning: ((message: string, source?: object) => void)[];
|
|
231
|
+
/**
|
|
232
|
+
* If `true`, mouse wheel events will be interpreted as trackpad gestures.
|
|
233
|
+
* Tested on MacBook M4 Pro.
|
|
234
|
+
* @default false
|
|
235
|
+
* @see macGesturesRequireMac
|
|
236
|
+
*/
|
|
237
|
+
macTrackpadGestures: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* If both this setting and {@link macTrackpadGestures} are `true`, trackpad gestures will
|
|
240
|
+
* only be enabled when the browser user agent includes "Mac".
|
|
241
|
+
* @default true
|
|
242
|
+
* @see macTrackpadGestures
|
|
243
|
+
*/
|
|
244
|
+
macGesturesRequireMac: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* "standard": change the dragging on left mouse button click to select, enable middle-click or spacebar+left-click dragging
|
|
247
|
+
* "legacy": Enable dragging on left-click (original behavior)
|
|
248
|
+
* @default "legacy"
|
|
249
|
+
*/
|
|
250
|
+
canvasNavigationMode: "standard" | "legacy";
|
|
251
|
+
/**
|
|
252
|
+
* If `true`, widget labels and values will both be truncated (proportionally to size),
|
|
253
|
+
* until they fit within the widget.
|
|
254
|
+
*
|
|
255
|
+
* Otherwise, the label will be truncated completely before the value is truncated.
|
|
256
|
+
* @default false
|
|
257
|
+
*/
|
|
258
|
+
truncateWidgetTextEvenly: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* If `true`, widget values will be completely truncated when shrinking a widget,
|
|
261
|
+
* before truncating widget labels. {@link truncateWidgetTextEvenly} must be `false`.
|
|
262
|
+
* @default false
|
|
263
|
+
*/
|
|
264
|
+
truncateWidgetValuesFirst: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* If `true`, the current viewport scale & offset of the first attached canvas will be included with the graph when exporting.
|
|
267
|
+
* @default true
|
|
268
|
+
*/
|
|
269
|
+
saveViewportWithGraph: boolean;
|
|
270
|
+
LGraph: typeof LGraph;
|
|
271
|
+
LLink: typeof LLink;
|
|
272
|
+
LGraphNode: typeof LGraphNode;
|
|
273
|
+
LGraphGroup: typeof LGraphGroup;
|
|
274
|
+
DragAndScale: typeof DragAndScale;
|
|
275
|
+
LGraphCanvas: typeof LGraphCanvas;
|
|
276
|
+
ContextMenu: typeof ContextMenu;
|
|
277
|
+
CurveEditor: typeof CurveEditor;
|
|
278
|
+
Reroute: typeof Reroute;
|
|
279
|
+
constructor();
|
|
280
|
+
Classes: {
|
|
281
|
+
readonly SubgraphSlot: typeof SubgraphSlot;
|
|
282
|
+
readonly SubgraphIONodeBase: typeof SubgraphIONodeBase;
|
|
283
|
+
readonly Rectangle: typeof Rectangle;
|
|
284
|
+
readonly InputIndicators: typeof InputIndicators;
|
|
285
|
+
};
|
|
286
|
+
onNodeTypeRegistered?(type: string, base_class: typeof LGraphNode): void;
|
|
287
|
+
onNodeTypeReplaced?(type: string, base_class: typeof LGraphNode, prev: unknown): void;
|
|
288
|
+
/**
|
|
289
|
+
* Register a node class so it can be listed when the user wants to create a new one
|
|
290
|
+
* @param type name of the node and path
|
|
291
|
+
* @param base_class class containing the structure of a node
|
|
292
|
+
*/
|
|
293
|
+
registerNodeType(type: string, base_class: typeof LGraphNode): void;
|
|
294
|
+
/**
|
|
295
|
+
* removes a node type from the system
|
|
296
|
+
* @param type name of the node or the node constructor itself
|
|
297
|
+
*/
|
|
298
|
+
unregisterNodeType(type: string | typeof LGraphNode): void;
|
|
299
|
+
/**
|
|
300
|
+
* Save a slot type and his node
|
|
301
|
+
* @param type name of the node or the node constructor itself
|
|
302
|
+
* @param slot_type name of the slot type (variable type), eg. string, number, array, boolean, ..
|
|
303
|
+
*/
|
|
304
|
+
registerNodeAndSlotType(type: LGraphNode, slot_type: ISlotType, out?: boolean): void;
|
|
305
|
+
/**
|
|
306
|
+
* Removes all previously registered node's types
|
|
307
|
+
*/
|
|
308
|
+
clearRegisteredTypes(): void;
|
|
309
|
+
/**
|
|
310
|
+
* Create a node of a given type with a name. The node is not attached to any graph yet.
|
|
311
|
+
* @param type full name of the node class. p.e. "math/sin"
|
|
312
|
+
* @param title a name to distinguish from other nodes
|
|
313
|
+
* @param options to set options
|
|
314
|
+
*/
|
|
315
|
+
createNode(type: string, title?: string, options?: Dictionary<unknown>): LGraphNode | null;
|
|
316
|
+
/**
|
|
317
|
+
* Returns a registered node type with a given name
|
|
318
|
+
* @param type full name of the node class. p.e. "math/sin"
|
|
319
|
+
* @returns the node class
|
|
320
|
+
*/
|
|
321
|
+
getNodeType(type: string): typeof LGraphNode;
|
|
322
|
+
/**
|
|
323
|
+
* Returns a list of node types matching one category
|
|
324
|
+
* @param category category name
|
|
325
|
+
* @returns array with all the node classes
|
|
326
|
+
*/
|
|
327
|
+
getNodeTypesInCategory(category: string, filter?: string): (typeof LGraphNode)[];
|
|
328
|
+
/**
|
|
329
|
+
* Returns a list with all the node type categories
|
|
330
|
+
* @param filter only nodes with ctor.filter equal can be shown
|
|
331
|
+
* @returns array with all the names of the categories
|
|
332
|
+
*/
|
|
333
|
+
getNodeTypesCategories(filter?: string): string[];
|
|
334
|
+
reloadNodes(folder_wildcard: string): void;
|
|
335
|
+
/** @deprecated Prefer {@link structuredClone} */
|
|
336
|
+
cloneObject<T extends object | undefined | null>(obj: T, target?: T): WhenNullish<T, null>;
|
|
337
|
+
/** @see {@link createUuidv4} @inheritdoc */
|
|
338
|
+
uuidv4: typeof createUuidv4;
|
|
339
|
+
/**
|
|
340
|
+
* Returns if the types of two slots are compatible (taking into account wildcards, etc)
|
|
341
|
+
* @param type_a output
|
|
342
|
+
* @param type_b input
|
|
343
|
+
* @returns true if they can be connected
|
|
344
|
+
*/
|
|
345
|
+
isValidConnection(type_a: ISlotType, type_b: ISlotType): boolean;
|
|
346
|
+
getParameterNames(func: (...args: any) => any): string[];
|
|
347
|
+
pointerListenerAdd(oDOM: Node, sEvIn: string, fCall: (e: Event) => boolean | void, capture?: boolean): void;
|
|
348
|
+
pointerListenerRemove(oDOM: Node, sEvent: string, fCall: (e: Event) => boolean | void, capture?: boolean): void;
|
|
349
|
+
getTime(): number;
|
|
350
|
+
distance: typeof distance;
|
|
351
|
+
colorToString(c: [number, number, number, number]): string;
|
|
352
|
+
isInsideRectangle: typeof isInsideRectangle;
|
|
353
|
+
growBounding(bounding: Rect, x: number, y: number): void;
|
|
354
|
+
overlapBounding: typeof overlapBounding;
|
|
355
|
+
isInsideBounding(p: number[], bb: number[][]): boolean;
|
|
356
|
+
hex2num(hex: string): number[];
|
|
357
|
+
num2hex(triplet: number[]): string;
|
|
358
|
+
closeAllContextMenus(ref_window?: Window): void;
|
|
359
|
+
extendClass(target: any, origin: any): void;
|
|
360
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporary workaround until downstream consumers migrate to Map.
|
|
3
|
+
* A brittle wrapper with many flaws, but should be fine for simple maps using int indexes.
|
|
4
|
+
*/
|
|
5
|
+
export declare class MapProxyHandler<V> implements ProxyHandler<Map<number | string, V>> {
|
|
6
|
+
getOwnPropertyDescriptor(target: Map<number | string, V>, p: string | symbol): PropertyDescriptor | undefined;
|
|
7
|
+
has(target: Map<number | string, V>, p: string | symbol): boolean;
|
|
8
|
+
ownKeys(target: Map<number | string, V>): ArrayLike<string | symbol>;
|
|
9
|
+
get(target: Map<number | string, V>, p: string | symbol): any;
|
|
10
|
+
set(target: Map<number | string, V>, p: string | symbol, newValue: any): boolean;
|
|
11
|
+
deleteProperty(target: Map<number | string, V>, p: string | symbol): boolean;
|
|
12
|
+
static bindAllMethods(map: Map<any, any>): void;
|
|
13
|
+
}
|