import { Connection, Node, NodeId, Port } from '../../../types/core'; import { NodeDefinition } from '../../../types/NodeDefinition'; /** * How the editor should respond when a port at capacity is used to start a new connection drag. */ export declare enum ConnectionSwitchBehavior { /** Simply append the new connection */ Append = "append", /** Ignore the drag result completely */ Ignore = "ignore" } export type BehaviorContext = { behavior: ConnectionSwitchBehavior; existingConnections: Connection[]; maxConnections?: number; }; /** * Parameters required to plan how a drag between two ports should be handled. */ export type ConnectionPlanParams = { fromPort: Port; toPort: Port; nodes: Record; connections: Record; getNodeDefinition: (type: string) => NodeDefinition | undefined; }; /** * Result of evaluating how to handle a connection drag. */ export type ConnectionPlan = { behavior: ConnectionSwitchBehavior; connection: Omit | null; connectionIdsToReplace: string[]; }; /** * Decide how to handle a completed drag between two ports while respecting connection limits. */ export declare const planConnectionChange: ({ fromPort, toPort, nodes, connections, getNodeDefinition, }: ConnectionPlanParams) => ConnectionPlan; /** * Get the connection switch context for a given port. * Used to determine how to handle connections when a port is at or near capacity. */ export declare const getConnectionSwitchContext: (port: Port, nodes: Record, connections: Record, getNodeDefinition: (type: string) => NodeDefinition | undefined) => BehaviorContext;