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