Documentation
¶
Overview ¶
Package render provides diagram renderers for PIDL protocols.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type D2Renderer ¶ added in v0.2.0
type D2Renderer struct {
// Style determines the diagram style (sequence, flow, or arch).
Style D2Style
// Title includes the protocol name as diagram title.
Title bool
// ShowDescriptions includes flow descriptions as tooltips.
ShowDescriptions bool
// Direction sets the diagram direction (down, right, left, up).
Direction string
// ShowNotes renders flow notes as D2 notes/labels.
ShowNotes bool
// ShowAnnotations renders flow annotations.
ShowAnnotations bool
// ShowConditions indicates conditional flows.
ShowConditions bool
// ShowAlternatives renders alternative paths.
ShowAlternatives bool
}
D2Renderer renders PIDL protocols as D2 diagrams.
func NewD2 ¶ added in v0.2.0
func NewD2() *D2Renderer
NewD2 creates a new D2 renderer with default options (sequence diagram).
func NewD2Arch ¶ added in v0.2.0
func NewD2Arch() *D2Renderer
NewD2Arch creates a new D2 renderer for architecture diagrams.
func NewD2Flow ¶ added in v0.2.0
func NewD2Flow() *D2Renderer
NewD2Flow creates a new D2 renderer for data flow diagrams.
func (*D2Renderer) Format ¶ added in v0.2.0
func (r *D2Renderer) Format() Format
Format returns the output format.
func (*D2Renderer) RenderString ¶ added in v0.2.0
func (r *D2Renderer) RenderString(p *pidl.Protocol) (string, error)
RenderString returns the D2 diagram as a string.
type DOTRenderer ¶
type DOTRenderer struct {
// Title includes the protocol name as graph label.
Title bool
// RankDir sets the graph direction (LR, TB, RL, BT).
RankDir string
// MergeEdges combines multiple flows between the same entities.
MergeEdges bool
// ShowPhases groups nodes by phase using subgraphs.
ShowPhases bool
// ShowConditions includes condition text in edge labels.
ShowConditions bool
// ShowAnnotations includes annotation counts in edge labels.
ShowAnnotations bool
}
DOTRenderer renders PIDL protocols as Graphviz DOT data flow diagrams.
func (*DOTRenderer) Format ¶
func (r *DOTRenderer) Format() Format
Format returns the output format.
func (*DOTRenderer) RenderString ¶
func (r *DOTRenderer) RenderString(p *pidl.Protocol) (string, error)
RenderString returns the DOT diagram as a string.
type Format ¶
type Format string
Format represents a diagram output format.
func MustParseFormat ¶
MustParseFormat parses a format string, panicking on error.
func ParseFormat ¶
ParseFormat parses a format string, returning an error if invalid.
func SupportedFormats ¶
func SupportedFormats() []Format
SupportedFormats returns all supported output formats.
func (Format) FileExtension ¶
FileExtension returns the conventional file extension for this format.
type MermaidRenderer ¶
type MermaidRenderer struct {
// Title includes the protocol name as diagram title.
Title bool
// Autonumber adds sequence numbers to messages.
Autonumber bool
// ShowNotes renders flow notes as Mermaid notes.
ShowNotes bool
// ShowAnnotations renders flow annotations as notes with type prefixes.
ShowAnnotations bool
// ShowConditions wraps conditional flows in opt blocks.
ShowConditions bool
// ShowAlternatives renders alternative paths as alt/else blocks.
ShowAlternatives bool
}
MermaidRenderer renders PIDL protocols as Mermaid sequence diagrams.
func NewMermaid ¶
func NewMermaid() *MermaidRenderer
NewMermaid creates a new Mermaid renderer with default options.
func (*MermaidRenderer) Format ¶
func (r *MermaidRenderer) Format() Format
Format returns the output format.
func (*MermaidRenderer) RenderString ¶
func (r *MermaidRenderer) RenderString(p *pidl.Protocol) (string, error)
RenderString returns the Mermaid diagram as a string.
type PlantUMLRenderer ¶
type PlantUMLRenderer struct {
// Title includes the protocol name as diagram title.
Title bool
// ShowDescriptions includes flow descriptions as notes.
ShowDescriptions bool
// ShowNotes renders flow notes as PlantUML notes.
ShowNotes bool
// ShowAnnotations renders flow annotations as notes with type prefixes.
ShowAnnotations bool
// ShowConditions wraps conditional flows in opt blocks.
ShowConditions bool
// ShowAlternatives renders alternative paths as alt/else blocks.
ShowAlternatives bool
}
PlantUMLRenderer renders PIDL protocols as PlantUML sequence diagrams.
func NewPlantUML ¶
func NewPlantUML() *PlantUMLRenderer
NewPlantUML creates a new PlantUML renderer with default options.
func (*PlantUMLRenderer) Format ¶
func (r *PlantUMLRenderer) Format() Format
Format returns the output format.
func (*PlantUMLRenderer) RenderString ¶
func (r *PlantUMLRenderer) RenderString(p *pidl.Protocol) (string, error)
RenderString returns the PlantUML diagram as a string.
type Renderer ¶
type Renderer interface {
// Render writes the diagram to the writer.
Render(w io.Writer, p *pidl.Protocol) error
// RenderString returns the diagram as a string.
RenderString(p *pidl.Protocol) (string, error)
// Format returns the output format name.
Format() Format
}
Renderer generates diagram output from a Protocol.
type SVGNetworkRenderer ¶ added in v0.3.0
type SVGNetworkRenderer struct {
// Animated enables CSS animations.
Animated bool
// Theme selects the color scheme ("light", "dark", "auto").
Theme string
// Title includes the protocol name in the diagram.
Title bool
// Direction is the layout direction ("horizontal" or "vertical").
Direction string
// BoundaryOverrides allows CLI-specified boundary assignments.
// Map of boundary ID to entity IDs.
BoundaryOverrides map[string][]string
// contains filtered or unexported fields
}
SVGNetworkRenderer renders PIDL protocols as SVG network boundary diagrams.
func NewSVGNetwork ¶ added in v0.3.0
func NewSVGNetwork() *SVGNetworkRenderer
NewSVGNetwork creates a new SVG network renderer with default options.
func (*SVGNetworkRenderer) AddBoundaryOverride ¶ added in v0.3.0
func (r *SVGNetworkRenderer) AddBoundaryOverride(boundaryID string, entityIDs []string)
AddBoundaryOverride adds a CLI-specified boundary assignment.
func (*SVGNetworkRenderer) Format ¶ added in v0.3.0
func (r *SVGNetworkRenderer) Format() Format
Format returns the output format.
func (*SVGNetworkRenderer) RenderString ¶ added in v0.3.0
func (r *SVGNetworkRenderer) RenderString(p *pidl.Protocol) (string, error)
RenderString returns the SVG diagram as a string.
type SVGRenderer ¶ added in v0.3.0
type SVGRenderer struct {
// Animated enables CSS animations (moving dots along message lines).
// This is used by FormatSVGAnimated.
Animated bool
// Theme selects the color scheme ("light", "dark", "auto").
Theme string
// Title includes the protocol name in the diagram.
Title bool
// ShowNotes renders flow notes.
ShowNotes bool
// ShowStepNumbers shows step numbers on messages.
ShowStepNumbers bool
// ParticipantSpacing sets horizontal spacing between participants.
ParticipantSpacing int
// MessageSpacing sets vertical spacing between messages.
MessageSpacing int
// Template is the name of a built-in template to use.
Template string
// TemplateDir is a path to a custom template directory.
TemplateDir string
// AnimationConfig contains global animation settings.
AnimationConfig svg.AnimationConfig
// contains filtered or unexported fields
}
SVGRenderer renders PIDL protocols as SVG sequence diagrams.
func NewSVG ¶ added in v0.3.0
func NewSVG() *SVGRenderer
NewSVG creates a new SVG renderer with default options.
func NewSVGAnimated ¶ added in v0.3.0
func NewSVGAnimated() *SVGRenderer
NewSVGAnimated creates a new SVG renderer with animations enabled.
func NewSVGWithTemplate ¶ added in v0.3.0
func NewSVGWithTemplate(templateName string) (*SVGRenderer, error)
NewSVGWithTemplate creates an SVG renderer using the specified template.
func NewSVGWithTemplateDir ¶ added in v0.3.0
func NewSVGWithTemplateDir(dir string) (*SVGRenderer, error)
NewSVGWithTemplateDir creates an SVG renderer using a template from a directory.
func (*SVGRenderer) Format ¶ added in v0.3.0
func (r *SVGRenderer) Format() Format
Format returns the output format.
func (*SVGRenderer) RenderString ¶ added in v0.3.0
func (r *SVGRenderer) RenderString(p *pidl.Protocol) (string, error)
RenderString returns the SVG diagram as a string.