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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! Layout and styling constants for the treemap renderer.
// ---------------------------------------------------------------------------
// Canvas geometry
// ---------------------------------------------------------------------------
/// Canvas width (nodeWidth × 10 = 100 × 10, px).
pub const CANVAS_W: f64 = 1000.0;
/// Canvas height (nodeHeight × 10 = 40 × 10, px).
pub const CANVAS_H: f64 = 400.0;
// ---------------------------------------------------------------------------
// Padding / layout
// ---------------------------------------------------------------------------
/// Inner padding between adjacent tiles (paddingInner, px).
pub const PADDING_INNER: f64 = 10.0;
/// Height of the section header area inside branch nodes (paddingTop, px).
pub const SECTION_HEADER_HEIGHT: f64 = 25.0;
/// Side/bottom padding inside branch nodes (paddingLeft/Right/Bottom, px).
pub const SECTION_PADDING: f64 = 10.0;
/// Height reserved above the treemap for the diagram title (px).
pub const TITLE_HEIGHT: f64 = 30.0;
/// Padding added around the content bounding box for the SVG viewBox (px).
pub const DIAGRAM_PADDING: f64 = 8.0;
// ---------------------------------------------------------------------------
// Squarify layout
// ---------------------------------------------------------------------------
/// Golden-ratio constant used by the D3 squarify algorithm (φ = (1+√5)/2).
pub const PHI: f64 = 1.618_033_988_749_895;
// ---------------------------------------------------------------------------
// Font metric
// ---------------------------------------------------------------------------
/// Character-width scaling factor applied to raw font measurements.
/// Approximates an average 0.55 px/px ratio per character at any font size.
pub const CHAR_WIDTH_FACTOR: f64 = 0.55;
/// Maximum initial font size for leaf labels before shrinking (px).
pub const MAX_LABEL_FONT: f64 = 38.0;
/// Minimum available width/height for a leaf tile to render a label (px).
pub const MIN_TILE_AVAIL: f64 = 10.0;
/// Inner tile padding on each edge used to compute available label space (px).
pub const TILE_INNER_PAD: f64 = 4.0;
/// Gap between the leaf label and the value text (px).
pub const VALUE_Y_GAP: f64 = 2.0;
/// Scale factor from label font size to value font size.
pub const VALUE_FONT_SCALE: f64 = 0.6;
/// Minimum value font size (px).
pub const VALUE_FONT_MIN: u32 = 10;
// ---------------------------------------------------------------------------
// Section clip path
// ---------------------------------------------------------------------------
/// Horizontal clip margin inside section header clip paths (px).
pub const SECTION_CLIP_MARGIN: f64 = 12.0;
/// Horizontal clip margin inside leaf clip paths (px).
pub const LEAF_CLIP_MARGIN: f64 = 4.0;
/// X margin from right edge for section value text (px).
pub const SECTION_VALUE_X_MARGIN: f64 = 10.0;
// ---------------------------------------------------------------------------
// Color palettes (Mermaid default theme v11.15, double-updateColors)
// ---------------------------------------------------------------------------
/// cScale0..11 background colors from the Mermaid default theme.
pub const C_SCALE: & = &;
/// cScalePeer0..11 border/stroke colors from the Mermaid default theme.
pub const C_SCALE_PEER: & = &;
/// Label text colors (cScaleLabel): indices 0 and 3 are white, all others black.
pub