import { _ as GraphFormatConverter, f as Graph } from "../../types-BAEQTwK_.mjs"; //#region src/formats/d2/shared.d.ts type D2Arrow = '->' | '<-' | '--' | '<->'; /** Descriptor for a typed/block label (`|md ...|`, `|js ...|`, block strings). */ interface D2LabelBlock { kind: 'md' | 'code' | 'latex' | 'block'; /** Language tag for code blocks (e.g. `js`, `go`). */ lang?: string; /** The fence delimiter used (`|`, `||`, `` |` ``, etc.), preserved for emit. */ fence: string; } interface D2GridSpec { rows?: number; columns?: number; gap?: number; verticalGap?: number; horizontalGap?: number; } /** Source-level abstractions preserved from the original d2 text. */ interface D2Source { /** `vars: { ... }` blocks, stored as nested key/value maps. */ vars?: Record; /** `classes: { name: { ...style } }` definitions. */ classes?: Record>; /** `@path` import references in declaration order. */ imports?: string[]; } interface D2GraphData { diagramType: 'd2'; source?: D2Source; /** Comments before any statement / at file top. */ leadingComments?: string[]; /** Comments after the last statement. */ trailingComments?: string[]; } interface D2NodeData { /** Whether the author declared this node via dot-path or a `{ }` block. */ declarationForm?: 'dot' | 'block'; /** Relative positioning keyword/target (`near: top-center`, `near: a.b`). */ near?: string; /** Icon URL. */ icon?: string; tooltip?: string; link?: string; /** Names of `classes` applied to this node via `class:`. */ classes?: string[]; /** Typed/block label descriptor; absent for plain labels. */ labelBlock?: D2LabelBlock; /** Grid layout spec for grid containers. */ grid?: D2GridSpec; /** * Source-order list of direct child node IDs and edge IDs, used by * sequence diagrams (and any ordering-sensitive container) to replay * statement order on emit. */ order?: string[]; /** Comments immediately preceding this node's declaration. */ commentsBefore?: string[]; /** Reserved keywords with no canonical/typed home, preserved verbatim. */ reserved?: Record; } interface D2ArrowheadSpec { shape?: string; label?: string; } interface D2EdgeData { /** Authored connector glyph, for faithful re-emit (incl. reversed `<-`). */ arrow: D2Arrow; sourceArrowhead?: D2ArrowheadSpec; targetArrowhead?: D2ArrowheadSpec; classes?: string[]; labelBlock?: D2LabelBlock; commentsBefore?: string[]; reserved?: Record; } interface D2PortData { /** SQL column type (`int`, `varchar`, ...) or class member type. */ typeName?: string; /** SQL constraints (`primary_key`, `foreign_key`, `unique`). */ constraint?: string[]; /** Class member visibility marker (`+`, `-`, `#`). */ visibility?: string; /** True when this port came from a `shape: class` member rather than sql_table. */ classMember?: boolean; } type D2Graph = Graph; //#endregion //#region src/formats/d2/parser.d.ts declare function fromD2(input: string): D2Graph; //#endregion //#region src/formats/d2/emitter.d.ts declare function toD2(graph: D2Graph): string; //#endregion //#region src/formats/d2/index.d.ts /** * Bidirectional converter for [d2](https://d2lang.com/) diagram syntax. * * @example * ```ts * import { d2Converter } from '@statelyai/graph/d2'; * * const graph = d2Converter.from('a -> b: hello'); * const text = d2Converter.to(graph); * ``` */ declare const d2Converter: GraphFormatConverter; //#endregion export { type D2Arrow, type D2ArrowheadSpec, type D2EdgeData, type D2Graph, type D2GraphData, type D2GridSpec, type D2LabelBlock, type D2NodeData, type D2PortData, type D2Source, d2Converter, fromD2, toD2 };