import { DrawFlowEditorMode, DrawflowEventsMap, DrawflowExport, DrawflowNode, DrawflowNodeLive } from './types'; export * from './components/node.component'; export * from './types'; export * from './utils'; export declare class Drawflow extends EventTarget { #private; protected readonly container: HTMLElement; protected readonly render?: object | undefined; protected readonly parent?: object | undefined; /** * doesn't dispatch any event if true */ silentMode: boolean; protected readonly precanvas: HTMLElement; protected ele_selected: HTMLElement | SVGElement | null; protected node_selected: HTMLElement | null; protected drag: boolean; get canvasX(): number; set canvasX(val: number); get canvasY(): number; set canvasY(val: number); get canvasW(): number; set canvasW(value: number); get canvasH(): number; set canvasH(value: number); /** * Active reroute * @default false */ reroute: boolean; /** * Fix adding points * @default false */ reroute_fix_curvature: boolean; /** * Curvature * @default 0.5 */ curvature: number; /** * Curvature reroute first point and last point * @default 0.5 */ reroute_curvature_start_end: number; /** * Curvature reroute * @default 0.5 */ reroute_curvature: number; /** * Width of reroute * @default 6 */ reroute_width: number; private drag_point; private editor_selected; private connection; private connection_ele; protected connection_selected: SVGPathElement | null; /** * Canvas origin x coordinate */ canvas_x: number; /** * Canvas origin x coordinate */ canvas_y: number; private pos_x; private pos_x_start; private pos_y; private pos_y_start; private mouse_x; private mouse_y; get line_path(): number; set line_path(value: number); private first_click; /** * Force the first input to drop the connection on top of the node * @default false */ force_first_input: boolean; /** * Drag nodes on click inputs * @default true */ draggable_inputs: boolean; private noderegister; /** * Graph data object */ data: DrawflowExport; private module; get currentModule(): string; set editor_mode(mode: DrawFlowEditorMode); get editor_mode(): DrawFlowEditorMode; get block_position(): boolean; set block_position(val: boolean); get zoom(): number; set zoom(zoom: number); get zoom_max(): number; set zoom_max(value: number); get zoom_min(): number; set zoom_min(value: number); /** * Default zoom value update * @default 0.1 */ zoom_factor: number; private evCache; private prevDiff; constructor(container: HTMLElement, render?: object | undefined, parent?: object | undefined); private pointerdown_handler; private pointermove_handler; private pointerup_handler; private remove_event; protected onDeleteNode(event: Event): void; private removeReouteConnectionSelected; private click; protected onNodeSelected(event: Event): void; private clickStart; private position; private dragEnd; protected blur(): void; protected contextmenu(e: GlobalEventHandlersEventMap['contextmenu']): void; protected contextmenuDel(): void; private key; private zoom_enter; /** end event handlers */ start(): void; load(): void; updateNodePosition(id: DrawflowNode['id'], x: number, y: number, module?: string): void; /** Increment zoom by zoom_factor */ zoom_in(): void; /** Decrement zoom by zoom_factor */ zoom_out(): void; /** Restores zoom to 1 */ zoom_reset(): void; private drawConnection; private updateConnection; /** * Add connection. Ex: 15,16,'output_1','input_1' * @param outputNodeId * @param inputNodeId * @param outputName * @param inputName */ addConnection(id_output: DrawflowNode['id'], id_input: DrawflowNode['id'], output_class: `output_${number}`, input_class: `input_${number}`, connection_class?: string): void; /** * Update connections position from Node Ex id: node-x * @param id */ updateConnectionNodes(id: `node-${DrawflowNode['id']}`): void; private dblclick; private createReroutePoint; private removeReroutePoint; /** * * @param name Name of module registered. * @param component HTML to drawn or vue component. * @param props Only for vue. Props of component. Not Required * @param options Only for vue. Options of component. Not Required */ registerNode(name: string, component: HTMLElement): void; registerNode(name: string, component: any, // eslint-disable-line @typescript-eslint/no-explicit-any props: object, options: object): void; isNodeRegister(name: string): boolean; private _getNodeFromId; /** * Get Info of node. Ex: id: 5 */ getNodeFromId(id: DrawflowNode['id']): DrawflowNodeLive; /** * Return Array of nodes id. Ex: name: telegram */ getNodesFromName(name: string): DrawflowNode['id'][]; protected renderNodeFirstTime(dataNode: DrawflowNode, precanvas: HTMLElement): void; /** * @param nodeData - DrawflowNode object */ addNode(nodeData: Omit): DrawflowNode['id']; /** * @param name Name of module * @param inputs Number of inputs * @param outputs Number of outputs * @param posx Position on start node left * @param posy Position on start node top * @param className Added classname to de node * @param data Data passed to node * @param html HTML drawn on node or name of register node. * @param typenode Default false, true for Object HTML, vue for vue * @param preventRemove * * @deprecated */ addNode(name: DrawflowNode['name'], num_in: number, num_out: number, ele_pos_x: number, ele_pos_y: number, classoverride: string, data: any, html: string, typenode: DrawflowNode['typenode'], preventRemove?: boolean): DrawflowNode['id']; private addNodeImport; private addRerouteImport; /** * Add input to node. Ex id: 5 * @param id */ addNodeInput(id: DrawflowNode['id']): void; /** * Add output to node. Ex id: 5 * @param id */ addNodeOutput(id: DrawflowNode['id']): void; /** * Remove input to node. Ex id: 5, input_2 * @param id * @param inputId * * TODO: revisar */ removeNodeInput(id: DrawflowNode['id'], inputId: `input_${number}`): void; /** * Remove output to node. Ex id: 5, output_2 * @param id * @param outputId * * TODO: revisra */ removeNodeOutput(id: DrawflowNode['id'], outputId: `output_${number}`): void; /** * Remove node. Ex id: node-x */ removeNodeId(nodeId: DrawflowNode['id'], options?: { notify?: boolean; cancelable?: boolean; }): void; private removeConnectionSelected; /** * Remove connection. Ex: 15,16,'output_1','input_1' * @param sourceNodeId * @param targetNodeId * @param sourceSlot * @param targetSlot */ removeSingleConnection(sourceNodeId: DrawflowNode['id'], targetNodeId: DrawflowNode['id'], sourceSlot: `output_${number}`, targetSlot: `input_${number}`): boolean; /** * Remove node connections. Ex id: x * @param nodeId */ removeConnectionNodeId(nodeId: DrawflowNode['id']): void; /** * Get name of module where is the id. Ex id: 5 * @param id */ getModuleFromNodeId(id: DrawflowNode['id']): string; addModule(moduleName: string): void; changeModule(name: string): void; removeModule(name: string): void; /** Clear data of module selected */ clearModuleSelected(): void; /** Clear all data of all modules and modules remove. */ clear(): void; export(): DrawflowExport; toJson(): DrawflowExport; /** * * @param data * @param notifi - default to true */ import(data: DrawflowExport, notifi?: boolean): void; getElementOfNode(nodeId: DrawflowNode['id']): HTMLElement | null; protected _getConnectionEl(sourceNodeId: DrawflowNode['id'], targetNodeId: DrawflowNode['id'], sourceSlot: `output_${number}`, targetSlot: `input_${number}`): SVGSVGElement | null; addEventListener(type: K, listener: (this: Drawflow, ev: DrawflowEventsMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: '$all', listener: (this: Drawflow, ev: AllEvent) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: Drawflow, ev: DrawflowEventsMap[K]) => any, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; dispatchEvent(event: DrawflowEventsMap[K]): boolean; clearSelection(): void; addReroutePoint(x: number, y: number, sourceNodeId: DrawflowNode['id'], targetNodeId: DrawflowNode['id'], sourceSlot: `output_${number}`, targetSlot: `input_${number}`): void; } export declare class AllEvent extends Event { readonly originalEventType: K; readonly detail: DrawflowEventsMap[K]['detail']; constructor(originalEventType: K, detail: DrawflowEventsMap[K]['detail']); }