1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//! Layout and styling constants for the ER diagram renderer.
// ---------------------------------------------------------------------------
// Typography
// ---------------------------------------------------------------------------
/// Font size for entity names and attribute text (px).
pub const FONT_SIZE: f64 = 16.0;
/// ab_glyph Arial measures ~1.117x narrower than the browser; apply this factor to match.
pub const TEXT_SCALE: f64 = 1.1172;
// ---------------------------------------------------------------------------
// Column padding
// ---------------------------------------------------------------------------
/// Padding on each side of a column's text (left and right of each column, px).
/// Measured from reference SVGs: each column = text_width + 2 × COL_PAD_X.
pub const COL_PAD_X: f64 = 12.5;
/// Padding on each side of the entity name in the header (no-attr entities, px).
/// Measured from reference SVGs: no-attr entity width = label_width + 2 × HEADER_PAD_X.
pub const HEADER_PAD_X: f64 = 20.0;
// ---------------------------------------------------------------------------
// Entity geometry
// ---------------------------------------------------------------------------
/// Height of each attribute row (px). Measured from reference SVGs: 42.75px consistently.
pub const ATTR_ROW_H: f64 = 42.75;
/// Height of the entity header row (same as attribute row height, px).
pub const HEADER_ROW_H: f64 = 42.75;
/// Height for entities with no attributes (px). Matches Mermaid reference: 84px.
pub const NO_ATTR_ENTITY_H: f64 = 84.0;
/// Minimum entity width — minEntityWidth config default (px).
pub const MIN_ENTITY_W: f64 = 100.0;
// ---------------------------------------------------------------------------
// Dagre layout parameters
// ---------------------------------------------------------------------------
/// Node separation used by dagre. Matches Mermaid erRenderer defaults (px).
pub const NODE_SEP: f64 = 140.0;
/// Edge separation used by dagre (px).
pub const EDGE_SEP: f64 = 100.0;
/// Rank separation used by dagre (px). Calibrated to match reference node spacing.
pub const RANK_SEP: f64 = 101.0;
/// Graph margin on x axis (px).
pub const MARGIN_X: f64 = 8.0;
/// Graph margin on y axis (px).
pub const MARGIN_Y: f64 = 8.0;
// ---------------------------------------------------------------------------
// Self-loop dummy nodes
// ---------------------------------------------------------------------------
/// Width of dummy waypoint nodes used for self-loop routing (px).
pub const SELF_LOOP_DUMMY_W: f64 = 84.0;
// ---------------------------------------------------------------------------
// Colours
// ---------------------------------------------------------------------------
/// Fill colour for entity boxes.
pub const ENTITY_FILL: &str = "#ECECFF";
/// Stroke colour for entity box borders.
pub const ENTITY_STROKE: &str = "#9370DB";
/// Colour of relationship lines.
pub const REL_LINE_COLOR: &str = "#333333";
/// Font colour for text inside entity boxes.
pub const FONT_COLOR: &str = "#333";
/// Fill colour for odd attribute rows.
pub const ATTR_ROW_ODD: &str = "hsl(240, 100%, 100%)";
/// Fill colour for even attribute rows.
pub const ATTR_ROW_EVEN: &str = "hsl(240, 100%, 97.2745098039%)";
// ---------------------------------------------------------------------------
// ForeignObject label geometry
// ---------------------------------------------------------------------------
/// Height of foreignObject label blocks (px).
pub const FO_HEIGHT: f64 = 24.0;
/// Height of relationship label foreignObject blocks (px).
pub const REL_LABEL_FO_H: f64 = 21.0;