/** * Contains classes for classic scheme such as Node, Input, Output, Control, Socket, Connection * @module * @group Primary */ import { ConnectionBase, NodeBase } from '../types'; type PortId = string; /** * The socket class * @priority 7 */ export declare class Socket { name: string; /** * @constructor * @param name Name of the socket */ constructor(name: string); } /** * General port class */ export declare class Port { socket: S; label?: string | undefined; multipleConnections?: boolean | undefined; /** * Port id, unique string generated by `getUID` function */ id: PortId; /** * Port index, used for sorting ports. Default is `0` */ index?: number; /** * @constructor * @param socket Socket instance * @param label Label of the port * @param multipleConnections Whether the output port can have multiple connections */ constructor(socket: S, label?: string | undefined, multipleConnections?: boolean | undefined); } /** * The input port class * @priority 6 */ export declare class Input extends Port { socket: S; label?: string | undefined; multipleConnections?: boolean | undefined; /** * Control instance */ control: Control | null; /** * Whether the control is visible. Can be managed dynamically by extensions. Default is `true` */ showControl: boolean; /** * @constructor * @param socket Socket instance * @param label Label of the input port * @param multipleConnections Whether the output port can have multiple connections. Default is `false` */ constructor(socket: S, label?: string | undefined, multipleConnections?: boolean | undefined); /** * Add control to the input port * @param control Control instance */ addControl(control: Control): void; /** * Remove control from the input port */ removeControl(): void; } /** * The output port class * @priority 5 */ export declare class Output extends Port { /** * @constructor * @param socket Socket instance * @param label Label of the output port * @param multipleConnections Whether the output port can have multiple connections. Default is `true` */ constructor(socket: S, label?: string, multipleConnections?: boolean); } /** * General control class * @priority 5 */ export declare class Control { /** * Control id, unique string generated by `getUID` function */ id: string; /** * Control index, used for sorting controls. Default is `0` */ index?: number; constructor(); } /** * Input control options */ type InputControlOptions = { /** Whether the control is readonly. Default is `false` */ readonly?: boolean; /** Initial value of the control */ initial?: N; /** Callback function that is called when the control value changes */ change?: (value: N) => void; }; /** * The input control class * @example new InputControl('text', { readonly: true, initial: 'hello' }) */ export declare class InputControl extends Control { type: T; options?: InputControlOptions | undefined; value?: N; readonly: boolean; /** * @constructor * @param type Type of the control: `text` or `number` * @param options Control options */ constructor(type: T, options?: InputControlOptions | undefined); /** * Set control value * @param value Value to set */ setValue(value?: N): void; } /** * The node class * @priority 10 * @example new Node('math') */ export declare class Node implements NodeBase { label: string; /** * Node id, unique string generated by `getUID` function */ id: NodeBase['id']; /** * Node inputs */ inputs: { [key in keyof Inputs]?: Input>; }; /** * Node outputs */ outputs: { [key in keyof Outputs]?: Output>; }; /** * Node controls */ controls: Controls; /** * Whether the node is selected. Default is `false` */ selected?: boolean; constructor(label: string); hasInput(key: K): boolean; addInput(key: K, input: Input>): void; removeInput(key: keyof Inputs): void; hasOutput(key: K): boolean; addOutput(key: K, output: Output>): void; removeOutput(key: keyof Outputs): void; hasControl(key: K): boolean; addControl(key: K, control: Controls[K]): void; removeControl(key: keyof Controls): void; } /** * The connection class * @priority 9 */ export declare class Connection implements ConnectionBase { sourceOutput: keyof Source['outputs']; targetInput: keyof Target['inputs']; /** * Connection id, unique string generated by `getUID` function */ id: ConnectionBase['id']; /** * Source node id */ source: NodeBase['id']; /** * Target node id */ target: NodeBase['id']; /** * @constructor * @param source Source node instance * @param sourceOutput Source node output key * @param target Target node instance * @param targetInput Target node input key */ constructor(source: Source, sourceOutput: keyof Source['outputs'], target: Target, targetInput: keyof Target['inputs']); } export {}; //# sourceMappingURL=classic.d.ts.map