@comfyorg/litegraph
Advanced tools
Comparing version 0.8.9 to 0.8.10
@@ -43,5 +43,5 @@ import { ContextMenu } from './ContextMenu'; | ||
export type Direction = "top" | "bottom" | "left" | "right"; | ||
export interface IOptionalInputsData { | ||
export interface IOptionalSlotData<TSlot extends INodeInputSlot | INodeOutputSlot> { | ||
content: string; | ||
value?: any; | ||
value: TSlot; | ||
className?: string; | ||
@@ -72,7 +72,7 @@ } | ||
export interface INodeInputSlot extends INodeSlot { | ||
link?: LinkId; | ||
link: LinkId | null; | ||
not_subgraph_input?: boolean; | ||
} | ||
export interface INodeOutputSlot extends INodeSlot { | ||
links?: LinkId[]; | ||
links: LinkId[] | null; | ||
_data?: unknown; | ||
@@ -79,0 +79,0 @@ slot_index?: number; |
@@ -1,9 +0,9 @@ | ||
import { CanvasColour, Dictionary, Direction, IBoundaryNodes, IContextMenuOptions, INodeInputSlot, INodeOutputSlot, IOptionalInputsData, Point, Rect, Rect32, Size, IContextMenuValue, ISlotType, ConnectingLink } from './interfaces'; | ||
import { CanvasColour, Dictionary, Direction, IBoundaryNodes, IContextMenuOptions, INodeInputSlot, INodeOutputSlot, IOptionalSlotData, Point, Rect, Rect32, Size, IContextMenuValue, ISlotType, ConnectingLink } from './interfaces'; | ||
import { IWidget } from './types/widgets'; | ||
import { LGraphNode, NodeId } from './LGraphNode'; | ||
import { CanvasDragEvent, CanvasMouseEvent, CanvasWheelEvent, CanvasEventDetail, CanvasPointerEvent } from './types/events'; | ||
import { LinkDirection, RenderShape, TitleMode } from './types/globalEnums'; | ||
import { LLink } from './LLink'; | ||
import { LGraph } from './LGraph'; | ||
import { ContextMenu } from './ContextMenu'; | ||
import { LinkDirection, RenderShape, TitleMode } from './types/globalEnums'; | ||
import { LGraphGroup } from './LGraphGroup'; | ||
@@ -208,3 +208,3 @@ import { DragAndScale } from './DragAndScale'; | ||
static active_canvas: LGraphCanvas; | ||
static onMenuNodeOutputs?(entries: IOptionalInputsData[]): IOptionalInputsData[]; | ||
static onMenuNodeOutputs?(entries: IOptionalSlotData<INodeOutputSlot>[]): IOptionalSlotData<INodeOutputSlot>[]; | ||
frame: number; | ||
@@ -211,0 +211,0 @@ last_draw_time: number; |
@@ -1,2 +0,2 @@ | ||
import { Dictionary, IContextMenuValue, IFoundSlot, INodeFlags, INodeInputSlot, INodeOutputSlot, IOptionalInputsData, ISlotType, Point, Rect, Size } from './interfaces'; | ||
import { Dictionary, IContextMenuValue, IFoundSlot, INodeFlags, INodeInputSlot, INodeOutputSlot, IOptionalSlotData, ISlotType, Point, Rect, Size } from './interfaces'; | ||
import { LGraph } from './LGraph'; | ||
@@ -25,4 +25,18 @@ import { IWidget, TWidgetValue } from './types/widgets'; | ||
} | ||
interface ConnectByTypeOptions { | ||
/** @deprecated Events */ | ||
createEventInCase?: boolean; | ||
/** Allow our wildcard slot to connect to typed slots on remote node. Default: true */ | ||
wildcardToTyped?: boolean; | ||
/** Allow our typed slot to connect to wildcard slots on remote node. Default: true */ | ||
typedToWildcard?: boolean; | ||
} | ||
interface FindFreeSlotOptions { | ||
/** Slots matching these types will be ignored. Default: [] */ | ||
typesNotAccepted?: ISlotType[]; | ||
/** If true, the slot itself is returned instead of the index. Default: false */ | ||
returnObj?: boolean; | ||
} | ||
export interface LGraphNode { | ||
constructor?: LGraphNodeConstructor; | ||
constructor: LGraphNodeConstructor; | ||
} | ||
@@ -34,2 +48,3 @@ /** | ||
export declare class LGraphNode { | ||
#private; | ||
static title?: string; | ||
@@ -138,3 +153,3 @@ static MAX_CONSOLE?: number; | ||
onMouseLeave?(this: LGraphNode, e: CanvasMouseEvent): void; | ||
getSlotMenuOptions?(this: LGraphNode, slot: any): IOptionalInputsData[]; | ||
getSlotMenuOptions?(this: LGraphNode, slot: IFoundSlot): IContextMenuValue[]; | ||
onDropItem?(this: LGraphNode, event: Event): boolean; | ||
@@ -150,4 +165,4 @@ onDropData?(this: LGraphNode, data: string | ArrayBuffer, filename: any, file: any): void; | ||
onNodeInputAdd?(this: LGraphNode, value: any): void; | ||
onMenuNodeInputs?(this: LGraphNode, entries: IOptionalInputsData[]): IOptionalInputsData[]; | ||
onMenuNodeOutputs?(this: LGraphNode, entries: IOptionalInputsData[]): IOptionalInputsData[]; | ||
onMenuNodeInputs?(this: LGraphNode, entries: IOptionalSlotData<INodeInputSlot>[]): IOptionalSlotData<INodeInputSlot>[]; | ||
onMenuNodeOutputs?(this: LGraphNode, entries: IOptionalSlotData<INodeOutputSlot>[]): IOptionalSlotData<INodeOutputSlot>[]; | ||
onGetInputs?(this: LGraphNode): INodeInputSlot[]; | ||
@@ -455,25 +470,21 @@ onGetOutputs?(this: LGraphNode): INodeOutputSlot[]; | ||
/** | ||
* returns the first free input slot | ||
* Finds the first free input slot. | ||
* @param {object} optsIn | ||
* @return {number | INodeInputSlot} the slot (-1 if not found) | ||
* @return The index of the first matching slot, the slot itself if returnObj is true, or -1 if not found. | ||
*/ | ||
findInputSlotFree<TReturn extends false>(optsIn?: { | ||
typesNotAccepted?: number[]; | ||
findInputSlotFree<TReturn extends false>(optsIn?: FindFreeSlotOptions & { | ||
returnObj?: TReturn; | ||
}): number; | ||
findInputSlotFree<TReturn extends true>(optsIn?: { | ||
typesNotAccepted?: number[]; | ||
findInputSlotFree<TReturn extends true>(optsIn?: FindFreeSlotOptions & { | ||
returnObj?: TReturn; | ||
}): INodeInputSlot; | ||
/** | ||
* returns the first output slot free | ||
* Finds the first free output slot. | ||
* @param {object} optsIn | ||
* @return {number | INodeOutputSlot} the slot (-1 if not found) | ||
* @return The index of the first matching slot, the slot itself if returnObj is true, or -1 if not found. | ||
*/ | ||
findOutputSlotFree<TReturn extends false>(optsIn?: { | ||
typesNotAccepted?: number[]; | ||
findOutputSlotFree<TReturn extends false>(optsIn?: FindFreeSlotOptions & { | ||
returnObj?: TReturn; | ||
}): number; | ||
findOutputSlotFree<TReturn extends true>(optsIn?: { | ||
typesNotAccepted?: number[]; | ||
findOutputSlotFree<TReturn extends true>(optsIn?: FindFreeSlotOptions & { | ||
returnObj?: TReturn; | ||
@@ -503,25 +514,37 @@ }): INodeOutputSlot; | ||
/** | ||
* Determines the slot index to connect to when attempting to connect by type. | ||
* | ||
* @param findInputs If true, searches for an input. Otherwise, an output. | ||
* @param node The node at the other end of the connection. | ||
* @param slotType The type of slot at the other end of the connection. | ||
* @param options Search restrictions to adhere to. | ||
* @see {connectByType} | ||
* @see {connectByTypeOutput} | ||
*/ | ||
findConnectByTypeSlot(findInputs: boolean, node: LGraphNode, slotType: ISlotType, options?: ConnectByTypeOptions): number | null; | ||
/** | ||
* connect this node output to the input of another node BY TYPE | ||
* @param {number_or_string} slot (could be the number of the slot or the string with the name of the slot) | ||
* @param {LGraphNode} node the target node | ||
* @param {string} target_type the input slot type of the target node | ||
* @param {number} slot (could be the number of the slot or the string with the name of the slot) | ||
* @param {LGraphNode} target_node the target node | ||
* @param {string} target_slotType the input slot type of the target node | ||
* @return {Object} the link_info is created, otherwise null | ||
*/ | ||
connectByType(slot: number, target_node: LGraphNode, target_slotType: ISlotType, optsIn?: unknown): LLink | null; | ||
connectByType(slot: number | string, target_node: LGraphNode, target_slotType: ISlotType, optsIn?: ConnectByTypeOptions): LLink | null; | ||
/** | ||
* connect this node input to the output of another node BY TYPE | ||
* @param {number_or_string} slot (could be the number of the slot or the string with the name of the slot) | ||
* @param {LGraphNode} node the target node | ||
* @param {string} target_type the output slot type of the target node | ||
* @method connectByType | ||
* @param {number | string} slot (could be the number of the slot or the string with the name of the slot) | ||
* @param {LGraphNode} source_node the target node | ||
* @param {string} source_slotType the output slot type of the target node | ||
* @return {Object} the link_info is created, otherwise null | ||
*/ | ||
connectByTypeOutput(slot: number, source_node: LGraphNode, source_slotType: ISlotType, optsIn?: unknown): any; | ||
connectByTypeOutput(slot: number | string, source_node: LGraphNode, source_slotType: ISlotType, optsIn?: ConnectByTypeOptions): LLink | null; | ||
/** | ||
* connect this node output to the input of another node | ||
* @param {number_or_string} slot (could be the number of the slot or the string with the name of the slot) | ||
* @param {LGraphNode} node the target node | ||
* @param {number_or_string} target_slot the input slot of the target node (could be the number of the slot or the string with the name of the slot, or -1 to connect a trigger) | ||
* Connect an output of this node to an input of another node | ||
* @param {number | string} slot (could be the number of the slot or the string with the name of the slot) | ||
* @param {LGraphNode} target_node the target node | ||
* @param {number | string} target_slot the input slot of the target node (could be the number of the slot or the string with the name of the slot, or -1 to connect a trigger) | ||
* @return {Object} the link_info is created, otherwise null | ||
*/ | ||
connect(slot: number, target_node: LGraphNode, target_slot: ISlotType | false): LLink | null; | ||
connect(slot: number | string, target_node: LGraphNode, target_slot: ISlotType): LLink | null; | ||
/** | ||
@@ -528,0 +551,0 @@ * disconnect one output to an specific node |
@@ -1,2 +0,2 @@ | ||
import { Point, ConnectingLink, INodeSlot, INodeInputSlot, INodeOutputSlot, CanvasColour, Direction, IBoundaryNodes, IContextMenuOptions, IContextMenuValue, IFoundSlot, IInputOrOutput, INodeFlags, IOptionalInputsData, ISlotType, KeysOfType, MethodNames, PickByType, Rect, Rect32, Size } from './interfaces'; | ||
import { Point, ConnectingLink, INodeSlot, INodeInputSlot, INodeOutputSlot, CanvasColour, Direction, IBoundaryNodes, IContextMenuOptions, IContextMenuValue, IFoundSlot, IInputOrOutput, INodeFlags, IOptionalSlotData, ISlotType, KeysOfType, MethodNames, PickByType, Rect, Rect32, Size } from './interfaces'; | ||
import { SlotShape, LabelPosition, SlotDirection, SlotType } from './draw'; | ||
@@ -18,3 +18,3 @@ import { IWidget } from './types/widgets'; | ||
export { LGraph, LGraphCanvas, DragAndScale, LGraphNode, LGraphGroup, LLink, ContextMenu, CurveEditor }; | ||
export { INodeSlot, INodeInputSlot, INodeOutputSlot, ConnectingLink, CanvasColour, Direction, IBoundaryNodes, IContextMenuOptions, IContextMenuValue, IFoundSlot, IInputOrOutput, INodeFlags, IOptionalInputsData, ISlotType, KeysOfType, MethodNames, PickByType, Rect, Rect32, Size }; | ||
export { INodeSlot, INodeInputSlot, INodeOutputSlot, ConnectingLink, CanvasColour, Direction, IBoundaryNodes, IContextMenuOptions, IContextMenuValue, IFoundSlot, IInputOrOutput, INodeFlags, IOptionalSlotData, ISlotType, KeysOfType, MethodNames, PickByType, Rect, Rect32, Size }; | ||
export { IWidget }; | ||
@@ -21,0 +21,0 @@ export { LGraphBadge, BadgePosition }; |
{ | ||
"name": "@comfyorg/litegraph", | ||
"version": "0.8.9", | ||
"version": "0.8.10", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "A graph node editor similar to PD or UDK Blueprints. It works in an HTML5 Canvas and allows to export graphs to be included in applications.", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Potential vulnerability
Supply chain riskInitial human review suggests the presence of a vulnerability in this package. It is pending further analysis and confirmation.
Found 1 instance in 1 package
2
2329513
15219