entity

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

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

type AnimationOptions struct {
	IntervalMS int
	MaxFrames  int
}

AnimationOptions configures animated SVG/GIF sampling.

type BoardOptions

type BoardOptions struct {
	Path               []string
	IncludeDescendants *bool
	MaxBoards          int
}

BoardOptions selects a board and controls descendant composition.

type Connection

type Connection struct {
	From       string
	To         string
	Label      string
	Attributes map[string]string
}

Connection represents a connection between shapes.

type DagreLayoutOptions

type DagreLayoutOptions struct {
	NodeSeparation int
	EdgeSeparation int
}

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

type FontOptions struct {
	Regular string
	Mono    string
}

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

type RenderLimits struct {
	MaxWidth       int
	MaxHeight      int
	MaxPixels      int64
	MaxOutputBytes int64
}

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 Shape

type Shape struct {
	ID         string
	Label      string
	Attributes map[string]string
}

Shape represents a shape in a D2 diagram.

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

type TALALayoutOptions struct {
	Seeds          []int64
	MaxConcurrency int
}

TALALayoutOptions configures deterministic TALA attempts.

type Theme

type Theme struct {
	ID   int
	Name string
}

Theme represents a D2 diagram theme.

type ThemeOptions

type ThemeOptions struct {
	LightID       *int64
	DarkID        *int64
	LightOverride map[string]string
	DarkOverride  map[string]string
}

ThemeOptions configures light/dark themes and token overrides.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL