mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
77 lines (76 loc) • 4.03 kB
TypeScript
import type { LayoutData } from '../../types.js';
import type { LayoutTestBackend, LayoutTestBackendId, OrthogonalTrace } from './types.js';
import type { DdltFixtureProfile, SizesFixture } from './types.js';
/**
* Thrown when a backend cannot reproduce the browser layout of a fixture without a DOM. The
* sweep reports such fixtures as unsupported for that backend instead of scoring them.
*/
export declare class DdltUnsupportedFixtureError extends Error {
constructor(message: string);
}
export interface ParseApplySizesAndLayoutOptions {
trace?: OrthogonalTrace;
/**
* Config applied over the fixture's own frontmatter before parsing, e.g.
* `{ layered: { edgeRouting: 'stepped' } }` (see `ParseToLayoutDataOptions.config`).
*/
config?: Record<string, unknown>;
}
/**
* DOMUS orthogonal routing + overlay finalize. **Not available on this branch.**
* Throws on call so any accidental usage of the domus backend surfaces as a
* loud error rather than a silent no-op.
*/
export declare function runDomusOrthogonalDdlt(_layout: LayoutData, _options?: {
trace?: OrthogonalTrace;
}): Promise<void>;
/**
* Swimlanes pipeline (mirrors `swimlanes/query-process.ddlt.spec.ts`).
* Mutates `layout` to hold the finished `LayoutData` from the swimlanes subgraph.
*/
export declare function runSwimlanesDdlt(layout: LayoutData, sizes: SizesFixture): void;
/**
* Mirrors the production grid prepare/measure/layout sequence while replacing DOM measurement
* with captured fixture sizes. Keep this adapter thin so DDLT exercises production layout code.
*/
export declare function runGridDdlt(layout: LayoutData, sizes: SizesFixture): void;
/**
* The size step shared by every backend that measures on the `LayoutData` itself (`layered`,
* `dagre`): content sizes onto leaf nodes, centre-label sizes onto labelled edges and, where the
* fixture has them, title sizes onto subgraphs. This stands in for `createGraphWithElements` /
* dagre's measure in the browser.
*/
export declare function applyMeasuredSizes(layout: LayoutData, sizes: SizesFixture): void;
/**
* `layout: layered`: the same layout core the browser renderer runs (`layered/render.ts` hands
* `runLayeredLayoutCore` to the common renderer). Expects sizes already applied.
*/
export declare function runLayeredDdlt(layout: LayoutData): void;
/**
* `layout: dagre`: the browser's prepare and layout core (`prepareLayoutForDagre`,
* `runDagreLayoutCore`), with the DOM measure replaced by the sizes already on `layout`.
*
* Subgraphs that dagre renders recursively (`clusterNode`: no edges cross their border) are
* laid out during the browser's measure, in their own coordinates, and sized from the painted
* DOM; that cannot be reproduced without a DOM, so such fixtures throw
* {@link DdltUnsupportedFixtureError}.
*/
export declare function runDagreDdlt(layout: LayoutData): void;
/**
* Parse `.mmd`, apply fixture sizes, then run the given backend (mutates returned `LayoutData`).
* Backends that need fixture sizes between preparation and layout (`swimlanes`, `grid`) are
* dispatched here. `layered` and `dagre` share one parse + size path so they see identical
* inputs; `'domus-orthogonal'` throws rather than silently falling back to a different algorithm.
*/
export declare function parseApplySizesAndLayout(mmdPath: string, sizes: SizesFixture, backendId: LayoutTestBackendId, options?: ParseApplySizesAndLayoutOptions): Promise<LayoutData>;
/**
* Returns a DOM-free layout runner for `LayoutData` that already carries its sizes. `swimlanes`
* must use `parseApplySizesAndLayout()` (needs fixture sizes mid-pipeline); `domus-orthogonal`
* throws.
*/
export declare function getLayoutTestBackend(id: LayoutTestBackendId): LayoutTestBackend;
/**
* Selects the layout backend for a fixture profile.
* Legacy flowchart profiles retain DOMUS rather than silently switching to a newer backend.
*/
export declare function backendsForProfile(profile: DdltFixtureProfile): LayoutTestBackendId[];