@archatlas/layout
v0.1.8
Published
Deterministic layout engine and serialization
Readme
Layout
@archatlas/layout provides deterministic layout algorithms for architecture maps.
Purpose
- Compute node/edge positions from semantic model
- Semantic zoom level mapping (zoom value → abstraction level)
- Deterministic and reproducible layout
Installation
pnpm add @archatlas/layoutUsage
import { computeLayout, computeSemanticZoomLevel } from '@archatlas/layout';
import type { ArchitectureModel, View } from '@archatlas/core-model';
const model: ArchitectureModel = /* ... */;
const view: View = model.views[0];
// Compute layout
const layout = computeLayout(model, view, { algorithm: 'deterministic-v1' });
// Map zoom to semantic level
const level = computeSemanticZoomLevel(0.5); // 'container'API
computeSemanticZoomLevel(zoom: number): ElementKind: Map 0-1 zoom to abstraction levelcomputeLayout(model, view, options): LayoutState: Compute deterministic layoutserializeLayoutState(layout): string: Serialize to JSONdeserializeLayoutState(json): LayoutState: Parse from JSON
License
See LICENSE in the monorepo root.
