2.1 KB51 lines
Blame
1/**
2 * Bidirectional Tidy-Tree Layout Algorithm for Generic Diagrams
3 *
4 * This module provides a layout algorithm implementation using the
5 * non-layered-tidy-tree-layout algorithm for positioning nodes and edges
6 * in tree structures with a bidirectional approach.
7 *
8 * The algorithm creates two separate trees that grow horizontally in opposite
9 * directions from a central root node:
10 * - Left tree: grows horizontally to the left (children alternate: 1st, 3rd, 5th...)
11 * - Right tree: grows horizontally to the right (children alternate: 2nd, 4th, 6th...)
12 *
13 * This creates a balanced, symmetric layout that is ideal for mindmaps,
14 * organizational charts, and other tree-based diagrams.
15 *
16 * The algorithm follows the unified rendering pattern and can be used
17 * by any diagram type that provides compatible LayoutData.
18 */
19
20/**
21 * Render function for the bidirectional tidy-tree layout algorithm
22 *
23 * This function follows the unified rendering pattern used by all layout algorithms.
24 * It takes LayoutData, inserts nodes into DOM, runs the bidirectional tidy-tree layout algorithm,
25 * and renders the positioned elements to the SVG.
26 *
27 * Features:
28 * - Alternates root children between left and right trees
29 * - Left tree grows horizontally to the left (rotated 90° counterclockwise)
30 * - Right tree grows horizontally to the right (rotated 90° clockwise)
31 * - Uses tidy-tree algorithm for optimal spacing within each tree
32 * - Creates symmetric, balanced layouts
33 * - Maintains proper edge connections between all nodes
34 *
35 * Layout Structure:
36 * ```
37 * [Child 3] ← [Child 1] ← [Root] → [Child 2] → [Child 4]
38 * ↓ ↓ ↓ ↓
39 * [GrandChild] [GrandChild] [GrandChild] [GrandChild]
40 * ```
41 *
42 * @param layoutData - Layout data containing nodes, edges, and configuration
43 * @param svg - SVG element to render to
44 * @param helpers - Internal helper functions for rendering
45 * @param options - Rendering options
46 */
47export { default } from './layouts.js';
48export * from './types.js';
49export * from './layout.js';
50export { render } from './render.js';
51