import { SubgraphEventMap } from '../infrastructure/SubgraphEventMap'; import { DefaultConnectionColors, INodeInputSlot, INodeOutputSlot } from '../interfaces'; import { LGraphCanvas } from '../LGraphCanvas'; import { ExportedSubgraph, ExposedWidget, ISerialisedGraph, Serialisable, SerialisableGraph } from '../types/serialisation'; import { CustomEventTarget } from '../infrastructure/CustomEventTarget'; import { BaseLGraph, LGraph } from '../LGraph'; import { SubgraphInput } from './SubgraphInput'; import { SubgraphInputNode } from './SubgraphInputNode'; import { SubgraphOutput } from './SubgraphOutput'; import { SubgraphOutputNode } from './SubgraphOutputNode'; /** Internal; simplifies type definitions. */ export type GraphOrSubgraph = LGraph | Subgraph; /** A subgraph definition. */ export declare class Subgraph extends LGraph implements BaseLGraph, Serialisable { #private; readonly events: CustomEventTarget; /** Limits the number of levels / depth that subgraphs may be nested. Prevents uncontrolled programmatic nesting. */ static MAX_NESTED_SUBGRAPHS: number; /** The display name of the subgraph. */ name: string; readonly inputNode: SubgraphInputNode; readonly outputNode: SubgraphOutputNode; /** Ordered list of inputs to the subgraph itself. Similar to a reroute, with the input side in the graph, and the output side in the subgraph. */ readonly inputs: SubgraphInput[]; /** Ordered list of outputs from the subgraph itself. Similar to a reroute, with the input side in the subgraph, and the output side in the graph. */ readonly outputs: SubgraphOutput[]; /** A list of node widgets displayed in the parent graph, on the subgraph object. */ readonly widgets: ExposedWidget[]; get rootGraph(): LGraph; constructor(rootGraph: LGraph, data: ExportedSubgraph); getIoNodeOnPos(x: number, y: number): SubgraphInputNode | SubgraphOutputNode | undefined; configure(data: ISerialisedGraph & ExportedSubgraph | SerialisableGraph & ExportedSubgraph, keep_old?: boolean): boolean | undefined; attachCanvas(canvas: LGraphCanvas): void; addInput(name: string, type: string): SubgraphInput; addOutput(name: string, type: string): SubgraphOutput; /** * Renames an input slot in the subgraph. * @param input The input slot to rename. * @param name The new name for the input slot. */ renameInput(input: SubgraphInput, name: string): void; /** * Renames an output slot in the subgraph. * @param output The output slot to rename. * @param name The new name for the output slot. */ renameOutput(output: SubgraphOutput, name: string): void; /** * Removes an input slot from the subgraph. * @param input The input slot to remove. */ removeInput(input: SubgraphInput): void; /** * Removes an output slot from the subgraph. * @param output The output slot to remove. */ removeOutput(output: SubgraphOutput): void; draw(ctx: CanvasRenderingContext2D, colorContext: DefaultConnectionColors, fromSlot?: INodeInputSlot | INodeOutputSlot | SubgraphInput | SubgraphOutput, editorAlpha?: number): void; /** * Clones the subgraph, creating an identical copy with a new ID. * @returns A new subgraph with the same configuration, but a new ID. */ clone(keepId?: boolean): Subgraph; asSerialisable(): ExportedSubgraph & Required>; }