...

Package d2layouts

import "oss.terrastruct.com/d2/d2layouts"
Overview
Index
Subdirectories

Overview ▾

func DefaultRouter

func DefaultRouter(ctx context.Context, graph *d2graph.Graph, edges []*d2graph.Edge) error

func ExtractSubgraph

func ExtractSubgraph(container *d2graph.Object, includeSelf bool) (nestedGraph *d2graph.Graph, externalEdges []*d2graph.Edge, externalEdgeIDs []edgeIDs)

func FitToGraph

func FitToGraph(container *d2graph.Object, nestedGraph *d2graph.Graph, padding geo.Spacing)

func InjectNested

func InjectNested(container *d2graph.Object, nestedGraph *d2graph.Graph, isRoot bool)

func LayoutNested

func LayoutNested(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, coreLayout d2graph.LayoutGraph, edgeRouter d2graph.RouteEdges) error

func PositionNested

func PositionNested(container *d2graph.Object, nestedGraph *d2graph.Graph)

func SaveChildrenOrder

func SaveChildrenOrder(container *d2graph.Object) (restoreOrder func())

func SaveOrder

func SaveOrder(g *d2graph.Graph) (restoreOrder func())

type DiagramType

type DiagramType string

a grid diagram at a constant near is

const (
    DefaultGraphType  DiagramType = ""
    ConstantNearGraph DiagramType = "constant-near"
    GridDiagram       DiagramType = "grid-diagram"
    SequenceDiagram   DiagramType = "sequence-diagram"
)

type GraphInfo

type GraphInfo struct {
    IsConstantNear bool
    DiagramType    DiagramType
}

func NestedGraphInfo

func NestedGraphInfo(obj *d2graph.Object) (gi GraphInfo)

Subdirectories

Name Synopsis
..
d2dagrelayout
d2elklayout d2elklayout is a wrapper around the Javascript port of ELK.
d2grid
d2layoutfeatures
d2near d2near applies near keywords when they're constants Intended to be run as the last stage of layout after the diagram has already undergone layout
d2sequence