Documentation
¶
Index ¶
- type ASCIICharset
- type ASCIIOptions
- type AnimationOptions
- type BoardOptions
- type Connection
- type DagreLayoutOptions
- type Diagram
- type DiagramDiagnostic
- type DiagramGraph
- type DiagramValidationResult
- type ELKLayoutOptions
- type ExportFormat
- type FontOptions
- type GraphEdge
- type GraphObject
- type LayoutEngine
- type LayoutOptions
- type OracleOperation
- type OracleOperationType
- type OracleResult
- type RenderLimits
- type RenderOptions
- type Shape
- type SourcePosition
- type SourceRange
- type TALALayoutOptions
- type Theme
- type ThemeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASCIICharset ¶
type ASCIICharset string
ASCIICharset selects the bundled ASCII renderer character set.
const ( ASCIIExtended ASCIICharset = "extended" ASCIIStandard ASCIICharset = "standard" )
type ASCIIOptions ¶
type ASCIIOptions struct {
Charset ASCIICharset
}
ASCIIOptions configures text rendering.
type AnimationOptions ¶
AnimationOptions configures animated SVG/GIF sampling.
type BoardOptions ¶
BoardOptions selects a board and controls descendant composition.
type Connection ¶
Connection represents a connection between shapes.
type DagreLayoutOptions ¶
DagreLayoutOptions configures Dagre spacing. Zero values use D2 defaults.
type Diagram ¶
type Diagram struct {
ID string
Content string
WorkspaceRoot string
Format ExportFormat
Theme *Theme
}
Diagram represents a D2 diagram entity.
type DiagramDiagnostic ¶
type DiagramDiagnostic struct {
Severity string `json:"severity"`
Message string `json:"message"`
Range *SourceRange `json:"range,omitempty"`
}
DiagramDiagnostic describes a D2 validation problem.
type DiagramGraph ¶
type DiagramGraph struct {
ID string
Content string
Objects map[string]*GraphObject
Edges map[string]*GraphEdge
}
DiagramGraph represents the internal graph structure
type DiagramValidationResult ¶
type DiagramValidationResult struct {
Valid bool `json:"valid"`
Diagnostics []DiagramDiagnostic `json:"diagnostics"`
RepairAvailable bool `json:"repair_available"`
RepairedContent string `json:"repaired_content,omitempty"`
Repairs []string `json:"repairs,omitempty"`
}
DiagramValidationResult describes source validity and any conservative repair.
type ELKLayoutOptions ¶
type ELKLayoutOptions struct {
Algorithm string
NodeSpacing int
Padding string
EdgeNodeSpacing int
SelfLoopSpacing int
}
ELKLayoutOptions configures public ELK layout settings. Zero values use D2 defaults.
type ExportFormat ¶
type ExportFormat string
ExportFormat represents the output format for diagram export.
const ( // FormatSVG represents SVG export format. FormatSVG ExportFormat = "svg" // FormatPNG represents PNG export format. FormatPNG ExportFormat = "png" // FormatPDF represents PDF export format. FormatPDF ExportFormat = "pdf" )
const ( FormatPPTX ExportFormat = "pptx" FormatGIF ExportFormat = "gif" FormatASCII ExportFormat = "ascii" )
Additional bundled D2 export formats.
type FontOptions ¶
FontOptions selects bundled D2 font families.
type GraphEdge ¶
type GraphEdge struct {
ID string
From string
To string
Label string
Attributes map[string]interface{}
}
GraphEdge represents a connection in the diagram
type GraphObject ¶
type GraphObject struct {
ID string
Label string
Shape string
Parent string
Attributes map[string]interface{}
}
GraphObject represents a shape in the diagram
type LayoutEngine ¶
type LayoutEngine string
LayoutEngine identifies a bundled D2 layout engine.
const ( LayoutDagre LayoutEngine = "dagre" LayoutELK LayoutEngine = "elk" LayoutTALA LayoutEngine = "tala" )
type LayoutOptions ¶
type LayoutOptions struct {
Engine LayoutEngine
Dagre DagreLayoutOptions
ELK ELKLayoutOptions
TALA TALALayoutOptions
}
LayoutOptions contains engine-specific public D2 v0.9 settings.
type OracleOperation ¶
type OracleOperation struct {
Type OracleOperationType
DiagramID string
BoardPath []string // For multi-board support
Key string
Value *string
Tag *string
NewKey *string
IncludeDescendants bool
}
OracleOperation represents a diagram manipulation operation
type OracleOperationType ¶
type OracleOperationType string
OracleOperationType defines the type of oracle operation
const ( OracleCreate OracleOperationType = "create" OracleSet OracleOperationType = "set" OracleDelete OracleOperationType = "delete" OracleMove OracleOperationType = "move" OracleRename OracleOperationType = "rename" )
type OracleResult ¶
type OracleResult struct {
Success bool
NewKey string
IDDeltas map[string]string // Maps old IDs to new IDs
Graph *DiagramGraph // The resulting graph state
}
OracleResult represents the result of an oracle operation
type RenderLimits ¶
RenderLimits bounds raster and encoded output work.
type RenderOptions ¶
type RenderOptions struct {
Layout LayoutOptions
Theme ThemeOptions
Font FontOptions
Animation AnimationOptions
Boards BoardOptions
ASCII ASCIIOptions
Padding *int64
Center *bool
Scale *float64
Sketch *bool
Limits RenderLimits
}
RenderOptions configures compilation, layout, rendering, and bounded board composition.
type SourcePosition ¶
type SourcePosition struct {
Line int `json:"line"`
Column int `json:"column"`
Byte int `json:"-"`
}
SourcePosition identifies a position in D2 source.
type SourceRange ¶
type SourceRange struct {
Start SourcePosition `json:"start"`
End SourcePosition `json:"end"`
}
SourceRange identifies a half-open range in D2 source.
type TALALayoutOptions ¶
TALALayoutOptions configures deterministic TALA attempts.