README

Milky2018/diago/diagram does not have a README file

#
Config

pub struct Config {
sketch : Bool?
theme_id : Int?
dark_theme_id : Int?
theme_overrides : ThemeOverrides?
dark_theme_overrides : ThemeOverrides?
pad : Double?
center : Bool?
layout_engine : String?
scale : Double?
no_xml_tag : Bool?
salt : String?
omit_version : Bool?
data : Map[String, ConfigDataValue]
} derive(
Debug
)

Configuration extracted from source (vars/config).

Caller-provided options may override these values.

#
Config::from_parts

fn Config::from_parts(sketch : Bool?, theme_id : Int?, dark_theme_id : Int?, theme_overrides : ThemeOverrides?, dark_theme_overrides : ThemeOverrides?, pad : Double?, center : Bool?, layout_engine : String?, scale : Double?, no_xml_tag : Bool?, salt : String?, omit_version : Bool?, data : Map[String, ConfigDataValue]) -> Config

#
Config::new

fn Config::new() -> Config

#
ConfigDataValue

pub(all) enum ConfigDataValue {
Text(String)
StringArray(Array[String])
} derive(Eq,
Debug
)

Typed values preserved from config data entries.

#
Connection

pub struct Connection {
index : Int
src_id : String
dst_id : String
src_syntax_id : String
dst_syntax_id : String
src_lookup_id : String
dst_lookup_id : String
identity_scope_depth : Int
classes : Array[String]
src_arrow : Bool
dst_arrow : Bool
src_arrowhead :
ArrowheadType

dst_arrowhead :
ArrowheadType

src_arrowhead_label : String?
dst_arrowhead_label : String?
src_arrowhead_label_color : String?
dst_arrowhead_label_color : String?
src_anchor : String?
dst_anchor : String?
label : String
icon : String?
icon_position : String?
icon_border_radius : Double?
link : String?
style :
StyleInput

route : Array[
Point
]
bend_points : Array[
Point
]?
is_curve : Bool
z_index : Int
reference_count : Int
label_box :
Box
?
src_column_index : Int?
dst_column_index : Int?
} derive(
Debug
)

Renderable connection.

This is derived from @graph.EdgeInput after layout has been applied.

#
Connection::legend_icon

fn Connection::legend_icon(src_id : String, dst_id : String, index : Int, src_arrow : Bool, dst_arrow : Bool, src_arrowhead :
ArrowheadType
, dst_arrowhead :
ArrowheadType
, style :
StyleInput
) -> Connection

Build the renderable connection used by the SVG legend's scaled icon.

#
Diagram

pub struct Diagram {
name : String
config : Config?
is_folder_only : Bool
description : String
font_family : String?
mono_font_family : String?
root : Shape
shapes : Array[Shape]
connections : Array[Connection]
activation_boxes : Array[(String,
Box
)]
sequence_notes : Array[(String, String,
Box
)]
sequence_fragments : Array[
SequenceFragmentLayout
]
layers : Array[Diagram]
scenarios : Array[Diagram]
steps : Array[Diagram]
legend :
LegendInput
?
} derive(
Debug
)

Render-ready diagram.

shapes does not include root.

#
Diagram::bytes

fn Diagram::bytes(self : Diagram) -> String

#
Diagram::find_object

fn Diagram::find_object(self : Diagram, id : String) -> Shape?

#
Diagram::get_board

fn Diagram::get_board(self : Diagram, board_path : Array[String]) -> Diagram?

Get a board by path.

Supports both explicit and shorthand paths:
  • Explicit: ["layers", "x", "scenarios", "y"]
  • Shorthand: ["x", "y"]

#
Diagram::get_corpus

fn Diagram::get_corpus(self : Diagram) -> String

#
Diagram::get_edges

fn Diagram::get_edges(self : Diagram) -> Array[Connection]

#
Diagram::get_nested_corpus

fn Diagram::get_nested_corpus(self : Diagram) -> String

#
Diagram::get_objects

fn Diagram::get_objects(self : Diagram) -> Array[Shape]

#
Diagram::has_layers

fn Diagram::has_layers(self : Diagram) -> Bool

#
Diagram::has_legend

fn Diagram::has_legend(self : Diagram) -> Bool

#
Diagram::has_scenarios

fn Diagram::has_scenarios(self : Diagram) -> Bool

#
Diagram::has_shape

fn Diagram::has_shape(self : Diagram, condition : (Shape) -> Bool) -> Bool

#
Diagram::has_steps

fn Diagram::has_steps(self : Diagram) -> Bool

#
Diagram::hash_id

fn Diagram::hash_id(self : Diagram, salt : String?) -> String

#
Diagram::with_render_hash_config

fn Diagram::with_render_hash_config(self : Diagram, theme_id : Int, dark_theme_id : Int?, sketch : Bool) -> Diagram

#
Diagram::without_children

fn Diagram::without_children(self : Diagram) -> Diagram

#
Shape

pub struct Shape {
id : String
semantic_id : String
label : String
shape_type :
ShapeType

style :
StyleInput

box :
Box
?
label_box :
Box
?
label_width : Double?
label_height : Double?
child_ids : Array[String]
z_index : Int
icon : String?
icon_position : String?
tooltip : String?
tooltip_position : String?
link : String?
label_position : String?
classes : Array[String]
language : String?
sql_constraints : Array[String]
grid_rows : Int?
grid_columns : Int?
grid_gap : Double?
horizontal_gap : Double?
vertical_gap : Double?
grid_column_span : Int?
grid_row_span : Int?
near : String?
} derive(
Debug
)

Renderable shape.

This is derived from @graph.ObjectInput after layout has been applied.

#
Shape::center

#
Shape::get_box

fn Shape::get_box(self : Shape) ->
Box
?

#
Shape::get_id

fn Shape::get_id(self : Shape) -> String

#
Shape::legend_icon

Build the renderable shape used by the SVG legend's scaled icon.

#
ThemeOverrides

pub struct ThemeOverrides {
n1 : String?
n2 : String?
n3 : String?
n4 : String?
n5 : String?
n6 : String?
n7 : String?
b1 : String?
b2 : String?
b3 : String?
b4 : String?
b5 : String?
b6 : String?
aa2 : String?
aa4 : String?
aa5 : String?
ab4 : String?
ab5 : String?
} derive(Eq,
Debug
)

compatibility typed theme override set.

This mirrors upstream d2target.ThemeOverrides, including fixed field coverage and stable declaration order.

#
ThemeOverrides::entries

fn ThemeOverrides::entries(self : ThemeOverrides) -> Array[(String, String)]

#
ThemeOverrides::get

fn ThemeOverrides::get(self : ThemeOverrides, code : String) -> String?

#
ThemeOverrides::is_empty

fn ThemeOverrides::is_empty(self : ThemeOverrides) -> Bool

#
ThemeOverrides::merge

#
ThemeOverrides::new

#
ThemeOverrides::with_code

fn ThemeOverrides::with_code(self : ThemeOverrides, code : String, value : String) -> ThemeOverrides

#
from_graph

fn from_graph(graph :
GraphInput
, config : Config?) -> Diagram

Convert a laid-out graph to a render-ready diagram.

This is the only conversion renderers should need.

#
merge_theme_overrides

fn merge_theme_overrides(base : ThemeOverrides?, overlay : ThemeOverrides?) -> ThemeOverrides?

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io