import { ClassicPreset } from 'rete'; import type { DataflowNode } from 'rete-engine'; import type { AreaExtra } from '../area'; import type { DataType, SocketType } from '../plugins/typed-sockets'; import type { NodeFactory, NodeEditor } from '../editor'; import type { GetRenderTypes } from 'rete-area-plugin/_types/types'; import { type ComponentSupportInterface, type BaseComponent, PythonNodeComponent, R_SocketSelection_NC, type ComponentParams } from '../components'; import { Socket, ExecSocket, Output, Input, Control, InputControl, type InputControlType, type InputControlParams, type SocketValueType, type SocketValueWithDatastructure, type SocketDatastructure } from '../socket'; import type { ConverterNode } from './data/common-data-nodes.svelte'; import type { AreaPlugin, NodeView } from 'rete-area-plugin'; import type { Schemes } from '../schemes'; import type { HTMLInputAttributes } from 'svelte/elements'; import { Rect, type SaveData } from '@selenite/commons'; import { SvelteMap } from 'svelte/reactivity'; /** * A map of node classes indexed by their id. */ export declare const nodeRegistry: SvelteMap>, { [x: string]: Socket; }, { [x: string]: Control; }, Record, Record>>>; /** * Registers a node class. */ export declare function registerNode; }, Outputs extends { [x: string]: Socket; }, Controls extends { [x: string]: Control; }, T extends 'abstract' | 'real' = 'real'>(id: string, type?: T): (target: T extends "abstract" ? unknown : NodeConstructor>) => void; /** * Registered converter nodes, from source to target. */ export declare const converters: Map>, { [x: string]: Socket; }, { [x: string]: Control; }, Record, Record>>>>; /** * Registers a converter node. */ export declare function registerConverter(source: S, target: T): (nodeClass: typeof ConverterNode) => void; export declare function hidden(nodeClass: NodeConstructor): void; export interface OutDataParams { socketLabel?: string; name: string; displayLabel?: boolean; displayName?: string; isArray?: boolean; type?: SocketType; } export interface InDataParams { socketLabel?: string; name: string; displayName?: string; initial?: unknown; control?: InputControlParams; isRequired?: boolean; isArray?: boolean; type?: SocketType; index?: number; } export interface NodeParams { label?: string; description?: string; name?: string; id?: string; width?: number; height?: number; factory?: NodeFactory; params?: Record; initialValues?: Node['initialValues'] | Record; state?: Record; } export type NodeSaveData = { params: Record; id: string; type: string; position?: { x: number; y: number; }; state: Record; inputControlValues: Node['initialValues']; selectedInputs: string[]; selectedOutputs: string[]; }; export type NodeConstructor = { new (params?: NodeParams): N; id?: string; /** Menu path of the node. */ path?: string[]; /** Search tags of the node. */ tags?: string[]; /** Description of the node. */ description?: string; /** Visibility of node */ visible?: boolean; }; /** * Decorator that adds a path to a node. */ export declare function path(...path: string[]): (target: NodeConstructor) => void; /** * Decorator that adds tags to a node */ export declare function tags(...tags: string[]): (target: NodeConstructor) => void; /** * Decorator that adds a description to a node. */ export declare function description(description: string): (target: NodeConstructor) => void; export type SocketsValues = { [K in keyof Sockets]: SocketValueWithDatastructure, Sockets[K]['datastructure']>; }; type DataSocket = Exclude> = Socket; type ExecSocketsKeys> = { [K in keyof Sockets]: Sockets[K] extends DataSocket ? never : K extends string ? K : never; }[keyof Sockets]; type DataSocketsKeys> = Exclude>; type DataSockets> = { [K in DataSocketsKeys]: Sockets[K]; }; export declare class Node = Record, Outputs extends { [key in string]: Socket; } = { [key in string]: Socket; }, Controls extends { [key in string]: Control; } = { [key in string]: Control; }, State extends Record = Record, Params extends Record = Record> implements ClassicPreset.Node, DataflowNode, ComponentSupportInterface { #private; pos: { x: number; y: number; }; get rect(): Rect; visible: boolean; get width(): number; get height(): number; set height(h: number); set width(w: number); emitResized(): Promise; get editor(): NodeEditor | undefined; get area(): AreaPlugin | undefined; get view(): NodeView | undefined; static description: string; static visible: boolean; private components; static activeFactory: NodeFactory | undefined; inEditor: boolean; private outData; private resolveEndExecutes; private naturalFlowExec; factory: NodeFactory | undefined; protected params: Params; static id: string; static nodeCounts: number; state: { name?: string; } & Partial; get name(): string | undefined; set name(n: string); description: string | undefined; inputs: { [key in keyof Inputs]?: Input> | undefined; }; outputs: { [key in keyof Outputs]?: Output> | undefined; }; controls: Controls; needsProcessing: boolean; sortedInputs: [string, Input>][]; sortedOutputs: [string, Output>][]; selectedInputs: [string, Input>][]; selectedOutputs: [string, Output>][]; sortedControls: [string, Control][]; readonly pythonComponent: PythonNodeComponent; readonly socketSelectionComponent: R_SocketSelection_NC; readonly ingoingDataConnections: Record[]>; readonly ingoingExecConnections: Record[]>; readonly outgoingDataConnections: Record[]>; readonly outgoingExecConnections: Record[]>; onRemoveIngoingConnection?: (conn: Connection) => void; initializePromise?: Promise; initialValues?: { inputs?: Record; controls?: Record; }; afterInitialize?: () => void; getFactory(): NodeFactory | undefined; getState(): Record; addInput(key: K, input: Input>): void; addOutput(key: K, output: Output>): void; getConnections(): Connection[]; outConnections: { [x: string]: Connection>, { [x: string]: Socket; }, { [x: string]: Control; }, Record, Record>, Node>, { [x: string]: Socket; }, { [x: string]: Control; }, Record, Record>>[]; }; inConnections: { [x: string]: Connection>, { [x: string]: Socket; }, { [x: string]: Control; }, Record, Record>, Node>, { [x: string]: Socket; }, { [x: string]: Control; }, Record, Record>>[]; }; constructor(params?: NodeParams); label: string; get id(): string; get previewed(): boolean; set previewed(previewed: boolean); get selected(): boolean; get picked(): boolean; hasInput(key: K): boolean; removeInput(key: keyof Inputs): void; hasOutput(key: K): boolean; removeOutput(key: keyof Outputs): void; hasControl(key: K): boolean; addControl(key: K, control: Controls[K]): void; removeControl(key: keyof Controls): void; setState(state: Record): void; getOutgoers(key: string): Node[] | null; addComponentByClass

, C extends BaseComponent>(componentClass: new (params: P) => C, params: Omit): C; getPosition(): { x: number; y: number; } | undefined; applyState(): void; toJSON(): NodeSaveData; static fromJSON(data: SaveData, { factory }: { factory?: NodeFactory; }): Promise; selectInput(key: string): void; deselectInput(key: string): void; selectOutput(key: string): void; deselectOutput(key: string): void; setNaturalFlow(outExec: string | undefined): void; getNaturalFlow(): string | undefined; fetchInputs(): Promise>; getDataflowEngine(): import("rete-engine").DataflowEngine | undefined; getEditor(): NodeEditor | undefined; setFactory(nodeFactory: NodeFactory): void; getArea(): AreaPlugin | undefined; onEndExecute(): void; waitForEndExecutePromise(): Promise; inputTypes: Record; outputTypes: Record; getWaitForChildrenPromises(output: ExecSocketsKeys): Promise; execute(input: ExecSocketsKeys, forward: (output: ExecSocketsKeys) => unknown, forwardExec?: boolean): void | Promise; addInExec(name?: ExecSocketsKeys, displayName?: string): void; addOutData & string>(key: K, params: { datastructure?: Outputs[K]['datastructure']; showLabel?: boolean; type: Outputs[K]['type']; isArray?: boolean; label?: string; index?: number; description?: string; }): Socket; oldAddOutData({ name, displayName, socketLabel, displayLabel, isArray, type }: OutDataParams): void; addInData>(key: K, params?: { type?: Inputs[K]['type']; datastructure?: Inputs[K]['datastructure'] extends 'scalar' ? 'scalar' | undefined : Inputs[K]['datastructure']; options?: string[]; control?: Partial>; label?: string; description?: string; isRequired?: boolean; alwaysShowLabel?: boolean; hideLabel?: boolean; initial?: SocketValueType; index?: number; props?: HTMLInputAttributes; changeType?: (type: SocketType) => void; }): Input; oldAddInData({ name, displayName, socketLabel, control, isArray, isRequired, type, index }: InDataParams): Input; makeInputControl(params: InputControlParams): InputControl; addInputControl(key: keyof Controls, params: InputControlParams): InputControl; addOutExec(name?: ExecSocketsKeys, displayName?: string, isNaturalFlow?: boolean): void; processDataflow: () => void; getWaitPromises(nodes: Node[]): Promise[]; getDataWithInputs>(key: K): Promise, Inputs[K]['datastructure']>>; getData>(key: K, inputs?: Record): SocketValueWithDatastructure, Inputs[K]['datastructure']>; data(inputs?: SocketsValues | undefined): SocketsValues> | Promise>>; setData(key: string, value: unknown): void; getOutData(): Record; updateElement(type?: GetRenderTypes, id?: string): void; } export type ConnectionSaveData = { id: string; source: string; target: string; sourceOutput: string; targetInput: string; }; export declare class Connection extends ClassicPreset.Connection { visible: boolean; get selected(): boolean; get picked(): boolean; factory?: NodeFactory; toJSON(): ConnectionSaveData; } export {};