@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
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { ContextMenu } from './ContextMenu';
|
|
2
|
+
import { LGraphNode, NodeId } from './LGraphNode';
|
|
3
|
+
import { LinkId, LLink } from './LLink';
|
|
4
|
+
import { Reroute, RerouteId } from './Reroute';
|
|
5
|
+
import { SubgraphInputNode } from './subgraph/SubgraphInputNode';
|
|
6
|
+
import { SubgraphOutputNode } from './subgraph/SubgraphOutputNode';
|
|
7
|
+
import { LinkDirection, RenderShape } from './types/globalEnums';
|
|
8
|
+
import { IBaseWidget } from './types/widgets';
|
|
9
|
+
import { Rectangle } from './infrastructure/Rectangle';
|
|
10
|
+
import { CanvasPointerEvent } from './types/events';
|
|
11
|
+
export type Dictionary<T> = {
|
|
12
|
+
[key: string]: T;
|
|
13
|
+
};
|
|
14
|
+
/** Allows all properties to be null. The same as `Partial<T>`, but adds null instead of undefined. */
|
|
15
|
+
export type NullableProperties<T> = {
|
|
16
|
+
[P in keyof T]: T[P] | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* If {@link T} is `null` or `undefined`, evaluates to {@link Result}. Otherwise, evaluates to {@link T}.
|
|
20
|
+
* Useful for functions that return e.g. `undefined` when a param is nullish.
|
|
21
|
+
*/
|
|
22
|
+
export type WhenNullish<T, Result> = T & {} | (T extends null ? Result : T extends undefined ? Result : T & {});
|
|
23
|
+
/** A type with each of the {@link Properties} made optional. */
|
|
24
|
+
export type OptionalProps<T, Properties extends keyof T> = Omit<T, Properties> & {
|
|
25
|
+
[K in Properties]?: T[K];
|
|
26
|
+
};
|
|
27
|
+
/** A type with each of the {@link Properties} marked as required. */
|
|
28
|
+
export type RequiredProps<T, Properties extends keyof T> = Omit<T, Properties> & {
|
|
29
|
+
[K in Properties]-?: T[K];
|
|
30
|
+
};
|
|
31
|
+
/** Bitwise AND intersection of two types; returns a new, non-union type that includes only properties that exist on both types. */
|
|
32
|
+
export type SharedIntersection<T1, T2> = {
|
|
33
|
+
[P in keyof T1 as P extends keyof T2 ? P : never]: T1[P];
|
|
34
|
+
} & {
|
|
35
|
+
[P in keyof T2 as P extends keyof T1 ? P : never]: T2[P];
|
|
36
|
+
};
|
|
37
|
+
export type CanvasColour = string | CanvasGradient | CanvasPattern;
|
|
38
|
+
/**
|
|
39
|
+
* Any object that has a {@link boundingRect}.
|
|
40
|
+
*/
|
|
41
|
+
export interface HasBoundingRect {
|
|
42
|
+
/**
|
|
43
|
+
* A rectangle that represents the outer edges of the item.
|
|
44
|
+
*
|
|
45
|
+
* Used for various calculations, such as overlap, selective rendering, and click checks.
|
|
46
|
+
* For most items, this is cached position & size as `x, y, width, height`.
|
|
47
|
+
* Some items (such as nodes and slots) may extend above and/or to the left of their {@link pos}.
|
|
48
|
+
* @readonly
|
|
49
|
+
* @see {@link move}
|
|
50
|
+
*/
|
|
51
|
+
readonly boundingRect: ReadOnlyRect;
|
|
52
|
+
}
|
|
53
|
+
/** An object containing a set of child objects */
|
|
54
|
+
export interface Parent<TChild> {
|
|
55
|
+
/** All objects owned by the parent object. */
|
|
56
|
+
readonly children?: ReadonlySet<TChild>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* An object that can be positioned, selected, and moved.
|
|
60
|
+
*
|
|
61
|
+
* May contain other {@link Positionable} objects.
|
|
62
|
+
*/
|
|
63
|
+
export interface Positionable extends Parent<Positionable>, HasBoundingRect {
|
|
64
|
+
readonly id: NodeId | RerouteId | number;
|
|
65
|
+
/**
|
|
66
|
+
* Position in graph coordinates. This may be the top-left corner,
|
|
67
|
+
* the centre, or another point depending on concrete type.
|
|
68
|
+
* @default 0,0
|
|
69
|
+
*/
|
|
70
|
+
readonly pos: Point;
|
|
71
|
+
/** true if this object is part of the selection, otherwise false. */
|
|
72
|
+
selected?: boolean;
|
|
73
|
+
/** See {@link IPinnable.pinned} */
|
|
74
|
+
readonly pinned?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* When explicitly set to `false`, no options to delete this item will be provided.
|
|
77
|
+
* @default undefined (true)
|
|
78
|
+
*/
|
|
79
|
+
readonly removable?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Adds a delta to the current position.
|
|
82
|
+
* @param deltaX X value to add to current position
|
|
83
|
+
* @param deltaY Y value to add to current position
|
|
84
|
+
* @param skipChildren If true, any child objects like group contents will not be moved
|
|
85
|
+
*/
|
|
86
|
+
move(deltaX: number, deltaY: number, skipChildren?: boolean): void;
|
|
87
|
+
/**
|
|
88
|
+
* Snaps this item to a grid.
|
|
89
|
+
*
|
|
90
|
+
* Position values are rounded to the nearest multiple of {@link snapTo}.
|
|
91
|
+
* @param snapTo The size of the grid to align to
|
|
92
|
+
* @returns `true` if it moved, or `false` if the snap was rejected (e.g. `pinned`)
|
|
93
|
+
*/
|
|
94
|
+
snapToGrid(snapTo: number): boolean;
|
|
95
|
+
/** Called whenever the item is selected */
|
|
96
|
+
onSelected?(): void;
|
|
97
|
+
/** Called whenever the item is deselected */
|
|
98
|
+
onDeselected?(): void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A color option to customize the color of {@link LGraphNode} or {@link LGraphGroup}.
|
|
102
|
+
* @see {@link LGraphCanvas.node_colors}
|
|
103
|
+
*/
|
|
104
|
+
export interface ColorOption {
|
|
105
|
+
color: string;
|
|
106
|
+
bgcolor: string;
|
|
107
|
+
groupcolor: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* An object that can be colored with a {@link ColorOption}.
|
|
111
|
+
*/
|
|
112
|
+
export interface IColorable {
|
|
113
|
+
setColorOption(colorOption: ColorOption | null): void;
|
|
114
|
+
getColorOption(): ColorOption | null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* An object that can be pinned.
|
|
118
|
+
*
|
|
119
|
+
* Prevents the object being accidentally moved or resized by mouse interaction.
|
|
120
|
+
*/
|
|
121
|
+
export interface IPinnable {
|
|
122
|
+
readonly pinned: boolean;
|
|
123
|
+
pin(value?: boolean): void;
|
|
124
|
+
unpin(): void;
|
|
125
|
+
}
|
|
126
|
+
export interface ReadonlyLinkNetwork {
|
|
127
|
+
readonly links: ReadonlyMap<LinkId, LLink>;
|
|
128
|
+
readonly reroutes: ReadonlyMap<RerouteId, Reroute>;
|
|
129
|
+
readonly floatingLinks: ReadonlyMap<LinkId, LLink>;
|
|
130
|
+
getNodeById(id: NodeId | null | undefined): LGraphNode | null;
|
|
131
|
+
getLink(id: null | undefined): undefined;
|
|
132
|
+
getLink(id: LinkId | null | undefined): LLink | undefined;
|
|
133
|
+
getReroute(parentId: null | undefined): undefined;
|
|
134
|
+
getReroute(parentId: RerouteId | null | undefined): Reroute | undefined;
|
|
135
|
+
readonly inputNode?: SubgraphInputNode;
|
|
136
|
+
readonly outputNode?: SubgraphOutputNode;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Contains a list of links, reroutes, and nodes.
|
|
140
|
+
*/
|
|
141
|
+
export interface LinkNetwork extends ReadonlyLinkNetwork {
|
|
142
|
+
readonly links: Map<LinkId, LLink>;
|
|
143
|
+
readonly reroutes: Map<RerouteId, Reroute>;
|
|
144
|
+
addFloatingLink(link: LLink): LLink;
|
|
145
|
+
removeReroute(id: number): unknown;
|
|
146
|
+
removeFloatingLink(link: LLink): void;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Locates graph items.
|
|
150
|
+
*/
|
|
151
|
+
export interface ItemLocator {
|
|
152
|
+
getNodeOnPos(x: number, y: number, nodeList?: LGraphNode[]): LGraphNode | null;
|
|
153
|
+
getRerouteOnPos(x: number, y: number): Reroute | undefined;
|
|
154
|
+
getIoNodeOnPos?(x: number, y: number): SubgraphInputNode | SubgraphOutputNode | undefined;
|
|
155
|
+
}
|
|
156
|
+
/** Contains a cached 2D canvas path and a centre point, with an optional forward angle. */
|
|
157
|
+
export interface LinkSegment {
|
|
158
|
+
/** Link / reroute ID */
|
|
159
|
+
readonly id: LinkId | RerouteId;
|
|
160
|
+
/** The {@link id} of the reroute that this segment starts from (output side), otherwise `undefined`. */
|
|
161
|
+
readonly parentId?: RerouteId;
|
|
162
|
+
/** The last canvas 2D path that was used to render this segment */
|
|
163
|
+
path?: Path2D;
|
|
164
|
+
/** Centre point of the {@link path}. Calculated during render only - can be inaccurate */
|
|
165
|
+
readonly _pos: Float32Array;
|
|
166
|
+
/**
|
|
167
|
+
* Y-forward along the {@link path} from its centre point, in radians.
|
|
168
|
+
* `undefined` if using circles for link centres.
|
|
169
|
+
* Calculated during render only - can be inaccurate.
|
|
170
|
+
*/
|
|
171
|
+
_centreAngle?: number;
|
|
172
|
+
/** Whether the link is currently being moved. @internal */
|
|
173
|
+
_dragging?: boolean;
|
|
174
|
+
/** Output node ID */
|
|
175
|
+
readonly origin_id: NodeId | undefined;
|
|
176
|
+
/** Output slot index */
|
|
177
|
+
readonly origin_slot: number | undefined;
|
|
178
|
+
}
|
|
179
|
+
export interface IInputOrOutput {
|
|
180
|
+
input?: INodeInputSlot | null;
|
|
181
|
+
output?: INodeOutputSlot | null;
|
|
182
|
+
}
|
|
183
|
+
export interface IFoundSlot extends IInputOrOutput {
|
|
184
|
+
slot: number;
|
|
185
|
+
link_pos: Point;
|
|
186
|
+
}
|
|
187
|
+
/** A point represented as `[x, y]` co-ordinates */
|
|
188
|
+
export type Point = [x: number, y: number] | Float32Array | Float64Array;
|
|
189
|
+
/** A size represented as `[width, height]` */
|
|
190
|
+
export type Size = [width: number, height: number] | Float32Array | Float64Array;
|
|
191
|
+
/** A very firm array */
|
|
192
|
+
type ArRect = [x: number, y: number, width: number, height: number];
|
|
193
|
+
/** A rectangle starting at top-left coordinates `[x, y, width, height]` */
|
|
194
|
+
export type Rect = ArRect | Float32Array | Float64Array;
|
|
195
|
+
/** A point represented as `[x, y]` co-ordinates that will not be modified */
|
|
196
|
+
export type ReadOnlyPoint = readonly [x: number, y: number] | ReadOnlyTypedArray<Float32Array> | ReadOnlyTypedArray<Float64Array>;
|
|
197
|
+
/** A size represented as `[width, height]` that will not be modified */
|
|
198
|
+
export type ReadOnlySize = readonly [width: number, height: number] | ReadOnlyTypedArray<Float32Array> | ReadOnlyTypedArray<Float64Array>;
|
|
199
|
+
/** A rectangle starting at top-left coordinates `[x, y, width, height]` that will not be modified */
|
|
200
|
+
export type ReadOnlyRect = readonly [x: number, y: number, width: number, height: number] | ReadOnlyTypedArray<Float32Array> | ReadOnlyTypedArray<Float64Array>;
|
|
201
|
+
type TypedArrays = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
202
|
+
type TypedBigIntArrays = BigInt64Array | BigUint64Array;
|
|
203
|
+
export type ReadOnlyTypedArray<T extends TypedArrays | TypedBigIntArrays> = Omit<Readonly<T>, "fill" | "copyWithin" | "reverse" | "set" | "sort" | "subarray">;
|
|
204
|
+
/** Union of property names that are of type Match */
|
|
205
|
+
export type KeysOfType<T, Match> = Exclude<{
|
|
206
|
+
[P in keyof T]: T[P] extends Match ? P : never;
|
|
207
|
+
}[keyof T], undefined>;
|
|
208
|
+
/** A new type that contains only the properties of T that are of type Match */
|
|
209
|
+
export type PickByType<T, Match> = {
|
|
210
|
+
[P in keyof T]: Extract<T[P], Match>;
|
|
211
|
+
};
|
|
212
|
+
/** The names of all (optional) methods and functions in T */
|
|
213
|
+
export type MethodNames<T> = KeysOfType<T, ((...args: any) => any) | undefined>;
|
|
214
|
+
export interface IBoundaryNodes {
|
|
215
|
+
top: LGraphNode;
|
|
216
|
+
right: LGraphNode;
|
|
217
|
+
bottom: LGraphNode;
|
|
218
|
+
left: LGraphNode;
|
|
219
|
+
}
|
|
220
|
+
export type Direction = "top" | "bottom" | "left" | "right";
|
|
221
|
+
/** Resize handle positions (compass points) */
|
|
222
|
+
export type CompassCorners = "NE" | "SE" | "SW" | "NW";
|
|
223
|
+
/**
|
|
224
|
+
* A string that represents a specific data / slot type, e.g. `STRING`.
|
|
225
|
+
*
|
|
226
|
+
* Can be comma-delimited to specify multiple allowed types, e.g. `STRING,INT`.
|
|
227
|
+
*/
|
|
228
|
+
export type ISlotType = number | string;
|
|
229
|
+
export interface INodeSlot extends HasBoundingRect {
|
|
230
|
+
/**
|
|
231
|
+
* The name of the slot in English.
|
|
232
|
+
* Will be included in the serialized data.
|
|
233
|
+
*/
|
|
234
|
+
name: string;
|
|
235
|
+
/**
|
|
236
|
+
* The localized name of the slot to display in the UI.
|
|
237
|
+
* Takes higher priority than {@link name} if set.
|
|
238
|
+
* Will be included in the serialized data.
|
|
239
|
+
*/
|
|
240
|
+
localized_name?: string;
|
|
241
|
+
/**
|
|
242
|
+
* The name of the slot to display in the UI, modified by the user.
|
|
243
|
+
* Takes higher priority than {@link display_name} if set.
|
|
244
|
+
* Will be included in the serialized data.
|
|
245
|
+
*/
|
|
246
|
+
label?: string;
|
|
247
|
+
type: ISlotType;
|
|
248
|
+
dir?: LinkDirection;
|
|
249
|
+
removable?: boolean;
|
|
250
|
+
shape?: RenderShape;
|
|
251
|
+
color_off?: CanvasColour;
|
|
252
|
+
color_on?: CanvasColour;
|
|
253
|
+
locked?: boolean;
|
|
254
|
+
nameLocked?: boolean;
|
|
255
|
+
pos?: Point;
|
|
256
|
+
/** @remarks Automatically calculated; not included in serialisation. */
|
|
257
|
+
boundingRect: Rect;
|
|
258
|
+
/**
|
|
259
|
+
* A list of floating link IDs that are connected to this slot.
|
|
260
|
+
* This is calculated at runtime; it is **not** serialized.
|
|
261
|
+
*/
|
|
262
|
+
_floatingLinks?: Set<LLink>;
|
|
263
|
+
/**
|
|
264
|
+
* Whether the slot has errors. It is **not** serialized.
|
|
265
|
+
*/
|
|
266
|
+
hasErrors?: boolean;
|
|
267
|
+
}
|
|
268
|
+
export interface INodeFlags {
|
|
269
|
+
skip_repeated_outputs?: boolean;
|
|
270
|
+
allow_interaction?: boolean;
|
|
271
|
+
pinned?: boolean;
|
|
272
|
+
collapsed?: boolean;
|
|
273
|
+
/** Configuration setting for {@link LGraphNode.connectInputToOutput} */
|
|
274
|
+
keepAllLinksOnBypass?: boolean;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* A widget that is linked to a slot.
|
|
278
|
+
*
|
|
279
|
+
* This is set by the ComfyUI_frontend logic. See
|
|
280
|
+
* https://github.com/Comfy-Org/ComfyUI_frontend/blob/b80e0e1a3c74040f328c4e344326c969c97f67e0/src/extensions/core/widgetInputs.ts#L659
|
|
281
|
+
*/
|
|
282
|
+
export interface IWidgetLocator {
|
|
283
|
+
name: string;
|
|
284
|
+
}
|
|
285
|
+
export interface INodeInputSlot extends INodeSlot {
|
|
286
|
+
link: LinkId | null;
|
|
287
|
+
widget?: IWidgetLocator;
|
|
288
|
+
/**
|
|
289
|
+
* Internal use only; API is not finalised and may change at any time.
|
|
290
|
+
*/
|
|
291
|
+
_widget?: IBaseWidget;
|
|
292
|
+
}
|
|
293
|
+
export interface IWidgetInputSlot extends INodeInputSlot {
|
|
294
|
+
widget: IWidgetLocator;
|
|
295
|
+
}
|
|
296
|
+
export interface INodeOutputSlot extends INodeSlot {
|
|
297
|
+
links: LinkId[] | null;
|
|
298
|
+
_data?: unknown;
|
|
299
|
+
slot_index?: number;
|
|
300
|
+
}
|
|
301
|
+
/** Links */
|
|
302
|
+
export interface ConnectingLink extends IInputOrOutput {
|
|
303
|
+
node: LGraphNode;
|
|
304
|
+
slot: number;
|
|
305
|
+
pos: Point;
|
|
306
|
+
direction?: LinkDirection;
|
|
307
|
+
afterRerouteId?: RerouteId;
|
|
308
|
+
/** The first reroute on a chain */
|
|
309
|
+
firstRerouteId?: RerouteId;
|
|
310
|
+
/** The link being moved, or `undefined` if creating a new link. */
|
|
311
|
+
link?: LLink;
|
|
312
|
+
}
|
|
313
|
+
interface IContextMenuBase {
|
|
314
|
+
title?: string;
|
|
315
|
+
className?: string;
|
|
316
|
+
}
|
|
317
|
+
/** ContextMenu */
|
|
318
|
+
export interface IContextMenuOptions<TValue = unknown, TExtra = unknown> extends IContextMenuBase {
|
|
319
|
+
ignore_item_callbacks?: boolean;
|
|
320
|
+
parentMenu?: ContextMenu<TValue>;
|
|
321
|
+
event?: MouseEvent;
|
|
322
|
+
extra?: TExtra;
|
|
323
|
+
/** @deprecated Context menu scrolling is now controlled by the browser */
|
|
324
|
+
scroll_speed?: number;
|
|
325
|
+
left?: number;
|
|
326
|
+
top?: number;
|
|
327
|
+
/** @deprecated Context menus no longer scale using transform */
|
|
328
|
+
scale?: number;
|
|
329
|
+
node?: LGraphNode;
|
|
330
|
+
autoopen?: boolean;
|
|
331
|
+
callback?(value?: string | IContextMenuValue<TValue>, options?: unknown, event?: MouseEvent, previous_menu?: ContextMenu<TValue>, extra?: unknown): void | boolean;
|
|
332
|
+
}
|
|
333
|
+
export interface IContextMenuValue<TValue = unknown, TExtra = unknown, TCallbackValue = unknown> extends IContextMenuBase {
|
|
334
|
+
value?: TValue;
|
|
335
|
+
content: string | undefined;
|
|
336
|
+
has_submenu?: boolean;
|
|
337
|
+
disabled?: boolean;
|
|
338
|
+
submenu?: IContextMenuSubmenu<TValue>;
|
|
339
|
+
property?: string;
|
|
340
|
+
type?: string;
|
|
341
|
+
slot?: IFoundSlot;
|
|
342
|
+
callback?(this: ContextMenuDivElement<TValue>, value?: TCallbackValue, options?: unknown, event?: MouseEvent, previous_menu?: ContextMenu<TValue>, extra?: TExtra): void | boolean;
|
|
343
|
+
}
|
|
344
|
+
export interface IContextMenuSubmenu<TValue = unknown> extends IContextMenuOptions<TValue> {
|
|
345
|
+
options: ConstructorParameters<typeof ContextMenu<TValue>>[0];
|
|
346
|
+
}
|
|
347
|
+
export interface ContextMenuDivElement<TValue = unknown> extends HTMLDivElement {
|
|
348
|
+
value?: string | IContextMenuValue<TValue>;
|
|
349
|
+
onclick_callback?: never;
|
|
350
|
+
}
|
|
351
|
+
export type INodeSlotContextItem = [string, ISlotType, Partial<INodeInputSlot & INodeOutputSlot>];
|
|
352
|
+
export interface DefaultConnectionColors {
|
|
353
|
+
getConnectedColor(type: ISlotType): CanvasColour;
|
|
354
|
+
getDisconnectedColor(type: ISlotType): CanvasColour;
|
|
355
|
+
}
|
|
356
|
+
export interface ISubgraphInput extends INodeInputSlot {
|
|
357
|
+
_listenerController?: AbortController;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Shorthand for {@link Parameters} of optional callbacks.
|
|
361
|
+
* @example
|
|
362
|
+
* ```ts
|
|
363
|
+
* const { onClick } = CustomClass.prototype
|
|
364
|
+
* CustomClass.prototype.onClick = function (...args: CallbackParams<typeof onClick>) {
|
|
365
|
+
* const r = onClick?.apply(this, args)
|
|
366
|
+
* // ...
|
|
367
|
+
* return r
|
|
368
|
+
* }
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
export type CallbackParams<T extends ((...args: any) => any) | undefined> = Parameters<Exclude<T, undefined>>;
|
|
372
|
+
/**
|
|
373
|
+
* Shorthand for {@link ReturnType} of optional callbacks.
|
|
374
|
+
* @see {@link CallbackParams}
|
|
375
|
+
*/
|
|
376
|
+
export type CallbackReturn<T extends ((...args: any) => any) | undefined> = ReturnType<Exclude<T, undefined>>;
|
|
377
|
+
/**
|
|
378
|
+
* An object that can be hovered over.
|
|
379
|
+
*/
|
|
380
|
+
export interface Hoverable extends HasBoundingRect {
|
|
381
|
+
readonly boundingRect: Rectangle;
|
|
382
|
+
isPointerOver: boolean;
|
|
383
|
+
containsPoint(point: Point): boolean;
|
|
384
|
+
onPointerMove(e: CanvasPointerEvent): void;
|
|
385
|
+
onPointerEnter?(e?: CanvasPointerEvent): void;
|
|
386
|
+
onPointerLeave?(e?: CanvasPointerEvent): void;
|
|
387
|
+
}
|
|
388
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ContextMenu } from './ContextMenu';
|
|
2
|
+
import { ConnectingLink, Point, IContextMenuOptions, INodeSlot, Size } from './interfaces';
|
|
3
|
+
import { LGraphNode } from './LGraphNode';
|
|
4
|
+
import { CanvasEventDetail } from './types/events';
|
|
5
|
+
import { RenderShape, TitleMode } from './types/globalEnums';
|
|
6
|
+
import { LiteGraphGlobal } from './LiteGraphGlobal';
|
|
7
|
+
export { Subgraph } from './subgraph/Subgraph';
|
|
8
|
+
export declare const LiteGraph: LiteGraphGlobal;
|
|
9
|
+
/** @deprecated Use {@link Point} instead. */
|
|
10
|
+
export type Vector2 = Point;
|
|
11
|
+
/** @deprecated Use {@link Rect} instead. */
|
|
12
|
+
export type Vector4 = [number, number, number, number];
|
|
13
|
+
export interface IContextMenuItem {
|
|
14
|
+
content: string;
|
|
15
|
+
callback?: ContextMenuEventListener;
|
|
16
|
+
/** Used as innerHTML for extra child element */
|
|
17
|
+
title?: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
has_submenu?: boolean;
|
|
20
|
+
submenu?: {
|
|
21
|
+
options: IContextMenuItem[];
|
|
22
|
+
} & IContextMenuOptions;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export type ContextMenuEventListener = (value: IContextMenuItem, options: IContextMenuOptions, event: MouseEvent, parentMenu: ContextMenu<unknown> | undefined, node: LGraphNode) => boolean | void;
|
|
26
|
+
export interface LinkReleaseContext {
|
|
27
|
+
node_to?: LGraphNode;
|
|
28
|
+
node_from?: LGraphNode;
|
|
29
|
+
slot_from: INodeSlot;
|
|
30
|
+
type_filter_in?: string;
|
|
31
|
+
type_filter_out?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface LinkReleaseContextExtended {
|
|
34
|
+
links: ConnectingLink[];
|
|
35
|
+
}
|
|
36
|
+
export interface LiteGraphCanvasEvent extends CustomEvent<CanvasEventDetail> {
|
|
37
|
+
}
|
|
38
|
+
export interface LGraphNodeConstructor<T extends LGraphNode = LGraphNode> {
|
|
39
|
+
new (title: string, type?: string): T;
|
|
40
|
+
title: string;
|
|
41
|
+
type: string;
|
|
42
|
+
size?: Size;
|
|
43
|
+
min_height?: number;
|
|
44
|
+
slot_start_y?: number;
|
|
45
|
+
widgets_info?: any;
|
|
46
|
+
collapsable?: boolean;
|
|
47
|
+
color?: string;
|
|
48
|
+
bgcolor?: string;
|
|
49
|
+
shape?: RenderShape;
|
|
50
|
+
title_mode?: TitleMode;
|
|
51
|
+
title_color?: string;
|
|
52
|
+
title_text_color?: string;
|
|
53
|
+
keepAllLinksOnBypass: boolean;
|
|
54
|
+
resizeHandleSize?: number;
|
|
55
|
+
resizeEdgeSize?: number;
|
|
56
|
+
}
|
|
57
|
+
export { InputIndicators } from './canvas/InputIndicators';
|
|
58
|
+
export { LinkConnector } from './canvas/LinkConnector';
|
|
59
|
+
export { isOverNodeInput, isOverNodeOutput } from './canvas/measureSlots';
|
|
60
|
+
export { CanvasPointer } from './CanvasPointer';
|
|
61
|
+
export * as Constants from './constants';
|
|
62
|
+
export { ContextMenu } from './ContextMenu';
|
|
63
|
+
export { CurveEditor } from './CurveEditor';
|
|
64
|
+
export { DragAndScale } from './DragAndScale';
|
|
65
|
+
export { LabelPosition, SlotDirection, SlotShape, SlotType } from './draw';
|
|
66
|
+
export { strokeShape } from './draw';
|
|
67
|
+
export { Rectangle } from './infrastructure/Rectangle';
|
|
68
|
+
export type { CanvasColour, ColorOption, ConnectingLink, Direction, IBoundaryNodes, IColorable, IContextMenuOptions, IContextMenuValue, IFoundSlot, IInputOrOutput, INodeFlags, INodeInputSlot, INodeOutputSlot, INodeSlot, ISlotType, KeysOfType, LinkNetwork, LinkSegment, MethodNames, PickByType, Point, Positionable, ReadonlyLinkNetwork, ReadOnlyPoint, ReadOnlyRect, Rect, Size, } from './interfaces';
|
|
69
|
+
export { LGraph } from './LGraph';
|
|
70
|
+
export { BadgePosition, LGraphBadge, type LGraphBadgeOptions } from './LGraphBadge';
|
|
71
|
+
export { LGraphCanvas, type LGraphCanvasState } from './LGraphCanvas';
|
|
72
|
+
export { LGraphGroup } from './LGraphGroup';
|
|
73
|
+
export { LGraphNode, type NodeId } from './LGraphNode';
|
|
74
|
+
export { type LinkId, LLink } from './LLink';
|
|
75
|
+
export { clamp, createBounds } from './measure';
|
|
76
|
+
export { Reroute, type RerouteId } from './Reroute';
|
|
77
|
+
export { type ExecutableLGraphNode, ExecutableNodeDTO, type ExecutionId } from './subgraph/ExecutableNodeDTO';
|
|
78
|
+
export { SubgraphNode } from './subgraph/SubgraphNode';
|
|
79
|
+
export type { CanvasPointerEvent } from './types/events';
|
|
80
|
+
export { CanvasItem, EaseFunction, LGraphEventMode, LinkMarkerShape, RenderShape, TitleMode, } from './types/globalEnums';
|
|
81
|
+
export type { ExportedSubgraph, ExportedSubgraphInstance, ExportedSubgraphIONode, ISerialisedGraph, SerialisableGraph, SerialisableLLink, SubgraphIO, } from './types/serialisation';
|
|
82
|
+
export type { IWidget } from './types/widgets';
|
|
83
|
+
export { isColorable } from './utils/type';
|
|
84
|
+
export { createUuidv4 } from './utils/uuid';
|
|
85
|
+
export { BaseSteppedWidget } from './widgets/BaseSteppedWidget';
|
|
86
|
+
export { BaseWidget } from './widgets/BaseWidget';
|
|
87
|
+
export { BooleanWidget } from './widgets/BooleanWidget';
|
|
88
|
+
export { ButtonWidget } from './widgets/ButtonWidget';
|
|
89
|
+
export { ComboWidget } from './widgets/ComboWidget';
|
|
90
|
+
export { KnobWidget } from './widgets/KnobWidget';
|
|
91
|
+
export { LegacyWidget } from './widgets/LegacyWidget';
|
|
92
|
+
export { NumberWidget } from './widgets/NumberWidget';
|
|
93
|
+
export { SliderWidget } from './widgets/SliderWidget';
|
|
94
|
+
export { TextWidget } from './widgets/TextWidget';
|
|
95
|
+
export { isComboWidget } from './widgets/widgetMap';
|