import type { GraphDescription } from '../types/graph.js'; export { type GraphLayout, type LaidOutEdge, type LaidOutNode, layoutGraph } from './layout.js'; /** Anything that can describe itself: a compiled graph, or a description already taken from one. */ export type Describable = GraphDescription | { describe(): GraphDescription; }; /** Options for `toMermaid()`. */ export interface MermaidOptions { /** Layout direction. Defaults to top-down. */ direction?: 'TD' | 'LR'; /** Draw each subgraph's nodes inside it, or show it as a single node. Defaults to `expand`. */ subgraphs?: 'expand' | 'collapse'; /** * Nodes to highlight — typically `checkpoint.next` or the nodes of the step being inspected, so a * diagram shows where a thread is. */ highlight?: readonly string[]; } /** * Renders a graph as a Mermaid flowchart. * * Mermaid rather than an image, because GitHub, GitLab, most documentation sites, and many chat tools * render it natively, and it diffs as text. For PNG or SVG output, pass the result to any Mermaid * renderer; none is bundled, so the graph runtime pays nothing for diagrams. * * Solid arrows are edges that are always taken, dotted ones are chosen at run time, and a node whose * router has neither a mapping nor declared `ends` points at a `?`, because its targets cannot be * known without running it. */ export declare function toMermaid(graph: Describable, options?: MermaidOptions): string; /** Colours and marks for `toSvg()`. Every field has a light default. */ export interface SvgOptions { /** Nodes to highlight, such as `checkpoint.next`, to show where a thread is. */ highlight?: readonly string[]; /** Text read by screen readers and shown as the image title. Defaults to the graph's name. */ title?: string; /** Colours, as any CSS colour. */ colors?: { /** Canvas. Defaults to white. */ background?: string; /** Node boxes. */ node?: string; /** Node borders and edges. */ line?: string; /** Text. */ text?: string; /** Highlighted node borders. */ highlight?: string; /** Edges that point back up the diagram, as cycles do. */ back?: string; }; } /** * Draws a graph as a standalone SVG document. * * Uses the same layered layout the studio draws with, and needs no dependency: write the string to a * `.svg` file, inline it in a page, or pass it to any SVG rasterizer for PNG. Solid edges are always * taken, dashed ones are chosen at run time, edges that go back up the diagram curve round the side, * and every name is escaped. */ export declare function toSvg(graph: Describable, options?: SvgOptions): string; /** The description as JSON, for a UI or a test that wants the shape rather than a picture. */ export declare function toGraphJSON(graph: Describable): GraphDescription;