UNPKG

@jalez/react-flow-automated-layout

Version:

A React library for automated layout of nested node graphs with parent-child relationships using React Flow

33 lines (32 loc) 1.36 kB
import { Node, Edge } from '@xyflow/react'; import { LayoutDirection, LayoutEngine } from '../context/LayoutContext'; export interface LayoutConfig { dagreDirection: string; nodeParentIdMapWithChildIdSet: Map<string, Set<string>>; nodeIdWithNode: Map<string, Node>; nodes: Node[]; edges: Edge[]; margin: number; nodeSpacing: number; layerSpacing: number; nodeWidth: number; nodeHeight: number; layoutHidden?: boolean; noParentKey?: string; } /** * Process selected node IDs for layout calculations (refactored to use LayoutConfig) */ export declare const processSelectedNodes: (selectedNodes: Node[], config: LayoutConfig, signal?: AbortSignal) => Promise<{ nodes: Node[]; edges: Edge[]; }>; /** * Hook for layout calculation functionality */ export declare const useLayoutCalculation: (layoutEngines: Record<string, LayoutEngine>, direction: LayoutDirection, algorithm: string, parentResizingOptions: any, nodeParentIdMapWithChildIdSet: Map<string, Set<string>>, nodeIdWithNode: Map<string, Node>, nodeSpacing: number, layerSpacing: number, nodeWidth?: number, nodeHeight?: number, layoutHidden?: boolean, noParentKey?: string) => { calculateLayout: (nodes: Node[], edges: Edge[], selectedNodes?: Node[], signal?: AbortSignal) => Promise<{ nodes: Node[]; edges: Edge[]; }>; };