import { GraphLayout, GraphLayoutProps } from "../../core/graph-layout.js"; import type { Graph, NodeInterface, EdgeInterface } from "../../graph/graph.js"; import { coordCenter, coordGreedy, coordQuad, coordSimplex, coordTopological, decrossDfs, decrossOpt, decrossTwoLayer, layeringLongestPath, layeringSimplex, layeringTopological, type DefaultGrid, type DefaultSugiyama, type DefaultZherebko, type LayoutResult, type MutGraph, type NodeSize } from 'd3-dag'; export type D3DagLayoutProps = GraphLayoutProps & { /** Which high-level layout operator to use. */ layout?: 'sugiyama' | 'grid' | 'zherebko'; /** Layering operator used by sugiyama layouts. */ layering?: 'simplex' | 'longestPath' | 'topological'; /** Accessor for node rank for layering */ nodeRank?: string | ((node: NodeInterface) => number | undefined); /** Decrossing operator used by sugiyama layouts. */ decross?: 'twoLayer' | 'opt' | 'dfs'; /** Coordinate assignment operator used by sugiyama layouts. */ coord?: 'simplex' | 'greedy' | 'quad' | 'center' | 'topological'; /** Node sizing accessor passed to the active layout. */ nodeSize?: NodeSize; /** Optional gap between nodes. Alias: separation. */ gap?: readonly [number, number]; /** Optional gap between nodes. */ separation?: readonly [number, number]; /** Orientation transform applied after the layout finishes. */ orientation?: 'TB' | 'BT' | 'LR' | 'RL'; /** Whether to center the layout along each axis. */ center?: boolean | { x?: boolean; y?: boolean; }; /** How to convert the Graph into a DAG. */ dagBuilder?: 'graph' | 'connect' | 'stratify'; customDagBuilder?: DagBuilder; customLayout?: D3DagLayoutOperator; customLayering?: LayeringOperator; customDecross?: DecrossOperator; customCoord?: CoordOperator; }; export type D3DagLayoutOperator = DefaultSugiyama | DefaultGrid | DefaultZherebko | ((dag: MutGraph) => LayoutResult); type DagBuilder = (graph: Graph) => MutGraph; type LayeringOperator = ReturnType | ReturnType | ReturnType; type DecrossOperator = ReturnType | ReturnType | ReturnType; type CoordOperator = ReturnType | ReturnType | ReturnType | ReturnType | ReturnType; /** * Layout that orchestrates d3-dag operators from declarative options. */ export declare class D3DagLayout extends GraphLayout { static defaultProps: Readonly>; protected readonly _name = "D3DagLayout"; protected _graph: Graph | null; private _dag; private _layoutOperator; private _rawNodePositions; private _rawEdgePoints; private _nodePositions; private _edgePoints; private _edgeControlPoints; private _lockedNodePositions; private _dagBounds; protected _nodeLookup: Map; protected _stringIdLookup: Map; protected _edgeLookup: Map; protected _incomingParentMap: Map; constructor(props: D3DagLayoutProps, defaultProps?: Required); setProps(options: Partial): void; initializeGraph(graph: Graph): void; updateGraph(graph: Graph): void; start(): void; update(): void; resume(): void; stop(): void; toggleCollapsedChain(chainId: string): void; setCollapsedChains(chainIds: Iterable): void; getNodePosition(node: NodeInterface): [number, number] | null; getEdgePosition(edge: EdgeInterface): { type: string; sourcePosition: [number, number]; targetPosition: [number, number]; controlPoints: [number, number][]; } | null; getLinkControlPoints(edge: EdgeInterface): [number, number][]; lockNodePosition(node: NodeInterface, x: number, y: number): void; unlockNodePosition(node: NodeInterface): void; protected _runLayout(): void; protected _refreshCollapsedChains(): void; private _buildDag; private _buildDagWithGraph; private _buildDagWithConnect; private _buildDagWithStratify; protected _shouldSkipNode(_nodeId: string | number): boolean; protected _mapNodeId(nodeId: string | number): string | number; protected _updateCollapsedChainNodeMetadata(): void; protected _getIncomingEdges(node: NodeInterface): EdgeInterface[]; protected _getOutgoingEdges(node: NodeInterface): EdgeInterface[]; private _ensureEdgeData; private _getLayoutOperator; private _cacheGeometry; private _updateTransformedGeometry; private _getOffsets; protected _updateBounds(): void; protected _edgeKey(sourceId: string | number, targetId: string | number): string; protected _toDagId(id: string | number): string; protected _fromDagId(id: string): string | number; } export {}; //# sourceMappingURL=d3-dag-layout.d.ts.map