/** * Graph model shared by node/edge diagrams (class, object, component, * deployment, use case, state, ArchiMate, ER, DOT, legacy activity). * * The model is format-agnostic: it knows shapes and roles by name but nothing * about Excalidraw or SVG. Layout fields start at zero and are filled in by * the layout pass. * @module model/graph */ export type Member = { /** * Display text (visibility stripped). */ text: string; visibility: "+" | "-" | "#" | "~" | null; isStatic: boolean; isAbstract: boolean; isMethod: boolean; }; export type Compartment = { /** * Optional separator title (`-- title --`). */ title: string | null; separator: "line" | "dashed" | "dotted" | "double"; members: Member[]; }; /** * A class-like compartment row. * @typedef {object} Member * @property {string} text Display text (visibility stripped). * @property {"+" | "-" | "#" | "~" | null} visibility * @property {boolean} isStatic * @property {boolean} isAbstract * @property {boolean} isMethod */ /** * @typedef {object} Compartment * @property {string | null} title Optional separator title (`-- title --`). * @property {"line" | "dashed" | "dotted" | "double"} separator * @property {Member[]} members */ /** @public */ export declare class GraphNode { /** Stable identifier. */ id: string; /** Display label (creole allowed). */ label: any; /** Shape name from {@link import("../draw/shapes.mjs").SHAPES} or `class` / `container`. */ shape: any; /** Theme role. */ role: any; /** PlantUML keyword used to declare the node (`class`, `component`, …). */ keyword: any; /** @type {string[]} */ stereotypes: string[]; /** @type {import("../syntax/color.mjs").ColorSpec} */ colors: import("../syntax/color.mjs").ColorSpec; /** @type {string | null} */ link: string | null; /** @type {GraphNode | null} */ parent: GraphNode | null; /** @type {GraphNode[]} */ children: GraphNode[]; /** Whether the node is drawn as a container around its children. */ container: any; /** Class-like header extras. */ classHeader: any; /** @type {Compartment[]} */ compartments: Compartment[]; /** Long description under the label (deployment `[...]` bodies, state descriptions). */ description: any; /** Hidden nodes are laid out but not drawn. */ hidden: boolean; /** Removed nodes are neither laid out nor drawn. */ removed: boolean; /** Arbitrary per-module data. */ data: any; x: number; y: number; width: number; height: number; /** Header height reserved inside containers. */ headerHeight: number; /** * @param {string} id * @param {Record} [init] */ constructor(id: string, init?: Record); /** @returns {number} Nesting depth (0 = top level). */ get depth(): number; } /** @public */ export declare class GraphEdge { id: string; from: string; to: string; /** @type {string | null} */ startHead: string | null; /** @type {string | null} */ endHead: string | null; /** @type {"solid" | "dashed" | "dotted"} */ lineStyle: "solid" | "dashed" | "dotted"; bold: any; hidden: any; /** @type {string | null} */ color: string | null; /** @type {number | null} */ thickness: number | null; /** @type {string | null} */ label: string | null; /** @type {string | null} */ fromLabel: string | null; /** @type {string | null} */ toLabel: string | null; /** @type {"up" | "down" | "left" | "right" | null} */ direction: "up" | "down" | "left" | "right" | null; /** Arrow body length (1 = short). */ length: any; /** Role used for colours. */ role: any; /** Arbitrary per-module data. */ data: any; /** @type {[number, number][]} */ points: [number, number][]; /** @type {{ x: number, y: number, width: number, height: number } | null} */ labelBox: { x: number; y: number; width: number; height: number; } | null; /** @type {{ x: number, y: number, width: number, height: number } | null} */ fromLabelBox: { x: number; y: number; width: number; height: number; } | null; /** @type {{ x: number, y: number, width: number, height: number } | null} */ toLabelBox: { x: number; y: number; width: number; height: number; } | null; /** * @param {string} id * @param {string} from * @param {string} to * @param {Record} [init] */ constructor(id: string, from: string, to: string, init?: Record); } /** @public */ export declare class GraphModel { kind: string; meta: import("../syntax/commons.mjs").DiagramMeta; /** @type {Map} */ nodes: Map; /** Additional names (display labels) resolving to node ids. */ /** @type {Map} */ aliases: Map; /** @type {GraphEdge[]} */ edges: GraphEdge[]; edgeSeq: number; /** Layout direction requested by the diagram. */ /** @type {"TB" | "LR"} */ direction: "TB" | "LR"; /** Layout width/height after layout. */ width: number; height: number; /** @param {string} kind */ constructor(kind: string); /** * Find a node by id or alias. * @param {string} name * @returns {GraphNode | undefined} */ find(name: string): GraphNode | undefined; /** * Add a node (or return the existing one with the same id). * @param {string} id * @param {Record} [init] * @returns {GraphNode} */ add(id: string, init?: Record): GraphNode; /** * Move a node under a new parent. * @param {GraphNode} node * @param {GraphNode | null} parent */ reparent(node: GraphNode, parent: GraphNode | null): void; /** * @param {string} from * @param {string} to * @param {Record} [init] * @returns {GraphEdge} */ connect(from: string, to: string, init?: Record): GraphEdge; /** @returns {GraphNode[]} Top-level nodes in declaration order. */ roots(): GraphNode[]; }