import { NodeEditor as BaseNodeEditor } from 'rete'; import { Connection, Node } from '../nodes'; import type { Variable } from '../variables'; import { type Readable } from 'svelte/store'; import { NodeFactory } from './NodeFactory.svelte'; import { SvelteMap, SvelteSet } from 'svelte/reactivity'; import { type SaveData } from '@selenite/commons'; import type { Schemes } from '../schemes'; export type CommentSaveData = { id: string; text: string; links: string[]; }; export type NodeEditorSaveData = SaveData; /** * A graph editor for visual programming. * * A low level class that manages nodes and connections. */ export declare class NodeEditor extends BaseNodeEditor { #private; factory?: NodeFactory; get area(): import("rete-area-plugin").AreaPlugin | undefined; variables: Record; previewedNodes: SvelteSet>, { [x: string]: import("../socket").Socket; }, { [x: string]: import("../control").Control; }, Record, Record>>; setName(name: string): void; readonly name = "Node Editor"; set graphId(id: string | undefined); get graphId(): string; get graphName(): string; set graphName(n: string); nameStore: Readable; onChangeNameListeners: ((name: string) => void)[]; addOnChangeNameListener(listener: (name: string) => void): void; id: string; nodesMap: SvelteMap>, { [x: string]: import("../socket").Socket; }, { [x: string]: import("../control").Control; }, Record, Record>>; connectionsMap: SvelteMap>, { [x: string]: import("../socket").Socket; }, { [x: string]: import("../control").Control; }, Record, Record>, Node>, { [x: string]: import("../socket").Socket; }, { [x: string]: import("../control").Control; }, Record, Record>>>; get nodes(): Node>, { [x: string]: import("../socket").Socket; }, { [x: string]: import("../control").Control; }, Record, Record>[]; selectedInputs: { node: Node>, { [x: string]: import("../socket").Socket; }, { [x: string]: import("../control").Control; }, Record, Record>; selected: [string, import("../socket").Input>][]; }[]; selectedOutputs: { node: Node>, { [x: string]: import("../socket").Socket; }, { [x: string]: import("../control").Control; }, Record, Record>; selected: [string, import("../socket").Output>][]; }[]; get connections(): Connection>, { [x: string]: import("../socket").Socket; }, { [x: string]: import("../control").Control; }, Record, Record>, Node>, { [x: string]: import("../socket").Socket; }, { [x: string]: import("../control").Control; }, Record, Record>>[]; constructor({ id }?: { id?: string; }); /** * Gets a node by id. * @param id - id of the node * @returns The node or undefined */ getNode(id: string): Node | undefined; /** * Gets all nodes. * @returns An array of all nodes in the editor */ getNodes(): Node[]; /** * Gets a connection by id. * @param id - id of the connection * @returns The connection or undefined */ getConnection(id: string): Connection | undefined; /** * Gets all connections. * @returns An array of all connections in the editor */ getConnections(): Connection[]; /** * Returns whether the editor has a node with the given id. * @param id - id of the node to check for */ hasNode(id: string): boolean; /** * Returns whether the editor has a node. * @param node - node to check for */ hasNode(node: Node): boolean; /** * Returns whether the editor has a connection with the given id. * @param id - id of the connection to check for */ hasConnection(id: string): boolean; /** * Returns whether the editor has a connection. * @param connection - connection to check for */ hasConnection(connection: Connection): boolean; /** * Adds a node to the editor. * @param node - node to add * @returns Whether the node was added */ addNode(node: Node): Promise; /** * Adds a connection to the editor. * @param conn - connection to add * @returns Whether the connection was added */ addConnection(conn: Connection): Promise; addExecConnection(source: Node, target: Node): Promise; addNewConnection(source: Node | string, sourceOutput: string, target: Node | string, targetInput: string): Promise; removeNode(id: string): Promise; removeNode(node: Node): Promise; removeConnection(id: string): Promise; removeConnection(conn: Connection): Promise; clearing: boolean; clear(): Promise; toJSON(): { editorName: string; graphName: string; id: string | undefined; variables: Record | Variable[]; previewedNodes: string[]; nodes: import("../nodes").NodeSaveData[]; connections: import("../nodes").ConnectionSaveData[]; comments: { id: string; text: string; links: string[]; }[]; }; }