@yorz/cli 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +133 -53
- package/dist/gui/assets/{abnfDiagram-VRR7QNED-BlILeZZA.js → abnfDiagram-VRR7QNED-Dk823f-p.js} +1 -1
- package/dist/gui/assets/{arc-C-xJpbjF.js → arc-CsAcQvy9.js} +1 -1
- package/dist/gui/assets/{architectureDiagram-ZJ3FMSHR-QdzNii0b.js → architectureDiagram-ZJ3FMSHR-9d29EB_v.js} +1 -1
- package/dist/gui/assets/{blockDiagram-677ZJIJ3-BQTAKTET.js → blockDiagram-677ZJIJ3-C_BdniYG.js} +1 -1
- package/dist/gui/assets/{c4Diagram-LMCZKHZV-YRh3fqeb.js → c4Diagram-LMCZKHZV-COHS5O60.js} +1 -1
- package/dist/gui/assets/channel-Cdj31qNd.js +1 -0
- package/dist/gui/assets/{chunk-2Q5K7J3B-Bgu-eeCS.js → chunk-2Q5K7J3B-CdpNMJAI.js} +1 -1
- package/dist/gui/assets/{chunk-32BRIVSS-DTLd8wsP.js → chunk-32BRIVSS-C-5zZ7Xl.js} +1 -1
- package/dist/gui/assets/{chunk-5VM5RSS4-Cct8HJoz.js → chunk-5VM5RSS4-DNMuZJaP.js} +1 -1
- package/dist/gui/assets/{chunk-EX3LRPZG-DBgaA_1N.js → chunk-EX3LRPZG-BGPzkMUB.js} +1 -1
- package/dist/gui/assets/{chunk-JWPE2WC7-DELoF8bV.js → chunk-JWPE2WC7-DKHh8QvM.js} +1 -1
- package/dist/gui/assets/{chunk-MOJQB5TN-Du6uREYs.js → chunk-MOJQB5TN-DjfrUCo1.js} +1 -1
- package/dist/gui/assets/{chunk-RYQCIY6F-CxO6cQdM.js → chunk-RYQCIY6F-CAOzG_fF.js} +1 -1
- package/dist/gui/assets/{chunk-V7JOEXUC-BiILBcGA.js → chunk-V7JOEXUC-CiYl0Zr6.js} +1 -1
- package/dist/gui/assets/{chunk-VR4S4FIN-BfY2RvG4.js → chunk-VR4S4FIN-C9R15N13.js} +1 -1
- package/dist/gui/assets/{chunk-XXDRQBXY-DmsZw6tB.js → chunk-XXDRQBXY-D08V--b4.js} +1 -1
- package/dist/gui/assets/classDiagram-OUVF2IWQ-BiCCYKL9.js +1 -0
- package/dist/gui/assets/classDiagram-v2-EOCWNBFH-BiCCYKL9.js +1 -0
- package/dist/gui/assets/{cose-bilkent-JH36ORCC-gX-8DSxS.js → cose-bilkent-JH36ORCC-h3WvWy31.js} +1 -1
- package/dist/gui/assets/{cynefin-VYW2F7L2-vOfRo7cL.js → cynefin-VYW2F7L2-BJJROAhw.js} +1 -1
- package/dist/gui/assets/{cynefinDiagram-TSTJHNR4-Dv66a7Rh.js → cynefinDiagram-TSTJHNR4-Cowr6YON.js} +1 -1
- package/dist/gui/assets/{dagre-VKFMJZFB-Rk64dDvT.js → dagre-VKFMJZFB-CHQSayFl.js} +1 -1
- package/dist/gui/assets/{diagram-FQU43EPY-CyW3IjmQ.js → diagram-FQU43EPY-Dkjm-gpD.js} +1 -1
- package/dist/gui/assets/{diagram-G47NLZAW-Caav47lW.js → diagram-G47NLZAW-CWzLjtMq.js} +1 -1
- package/dist/gui/assets/{diagram-NH7WQ7WH-_X3ihqNf.js → diagram-NH7WQ7WH-CJEfCmpn.js} +1 -1
- package/dist/gui/assets/{diagram-OA4YK3LP-CjbverOE.js → diagram-OA4YK3LP-DKXL4ZCg.js} +1 -1
- package/dist/gui/assets/{diagram-WEI45ONY-B93ZeTtT.js → diagram-WEI45ONY-CLvc8CSB.js} +1 -1
- package/dist/gui/assets/{ebnfDiagram-CCIWWBDH-CdDt4bWx.js → ebnfDiagram-CCIWWBDH-D6NViEZ2.js} +1 -1
- package/dist/gui/assets/{erDiagram-Q63AITRT-Bypq-rvj.js → erDiagram-Q63AITRT-B2mRc5jq.js} +1 -1
- package/dist/gui/assets/{flowDiagram-23GEKE2U-b-l8_7KP.js → flowDiagram-23GEKE2U-Bu2CgXeG.js} +1 -1
- package/dist/gui/assets/{ganttDiagram-NO4QXBWP-BeZFHLhX.js → ganttDiagram-NO4QXBWP-CLqVFiRj.js} +1 -1
- package/dist/gui/assets/{gitGraphDiagram-IHSO6WYX-C0siPGLA.js → gitGraphDiagram-IHSO6WYX-BCeVlEhg.js} +1 -1
- package/dist/gui/assets/index-BCf1jTQa.css +1 -0
- package/dist/gui/assets/index-BYq7_4Z-.js +663 -0
- package/dist/gui/assets/{infoDiagram-FWYZ7A6U-Bk8DNKgG.js → infoDiagram-FWYZ7A6U-CaGDhrD8.js} +1 -1
- package/dist/gui/assets/{ishikawaDiagram-FXEZZL3T-DyS4wmJu.js → ishikawaDiagram-FXEZZL3T-D-IBVo_N.js} +1 -1
- package/dist/gui/assets/{journeyDiagram-5HDEW3XC-4jUY7Bzi.js → journeyDiagram-5HDEW3XC-lxFR0Z8q.js} +1 -1
- package/dist/gui/assets/{kanban-definition-HUTT4EX6-BRiI4KbM.js → kanban-definition-HUTT4EX6-C1Quf86J.js} +1 -1
- package/dist/gui/assets/{linear-C5JkbjyJ.js → linear-BmiZLs2L.js} +1 -1
- package/dist/gui/assets/{mermaid.core-ImB_5gdE.js → mermaid.core-Qqp0pI8e.js} +4 -4
- package/dist/gui/assets/{mindmap-definition-LN4V7U3C-9_Awmd2W.js → mindmap-definition-LN4V7U3C-CiuAQSSr.js} +1 -1
- package/dist/gui/assets/{pegDiagram-2B236MQR-DF_vIYzp.js → pegDiagram-2B236MQR-BWjeZxVp.js} +1 -1
- package/dist/gui/assets/{pieDiagram-ENE6RG2P-3TPwXSjQ.js → pieDiagram-ENE6RG2P-C2aubU3s.js} +1 -1
- package/dist/gui/assets/{quadrantDiagram-ABIIQ3AL-jzJ30mNi.js → quadrantDiagram-ABIIQ3AL-l-nU_0aa.js} +1 -1
- package/dist/gui/assets/{railroadDiagram-RFXS5EU6-B-29q3CI.js → railroadDiagram-RFXS5EU6-CLs3ePNd.js} +1 -1
- package/dist/gui/assets/{requirementDiagram-TGXJPOKE-BanWpS6g.js → requirementDiagram-TGXJPOKE-noC5_aOI.js} +1 -1
- package/dist/gui/assets/{sankeyDiagram-HTMAVEWB-B_sxc9IV.js → sankeyDiagram-HTMAVEWB-CrVWROCY.js} +1 -1
- package/dist/gui/assets/{sequenceDiagram-DBY2YBRQ-BNVav9DA.js → sequenceDiagram-DBY2YBRQ-rrdT6eIu.js} +1 -1
- package/dist/gui/assets/{sizeCapture-X5ZJPWSS-DbaiKjno.js → sizeCapture-X5ZJPWSS-DvpoOhEJ.js} +1 -1
- package/dist/gui/assets/{stateDiagram-2N3HPSRC-jU5WBm6c.js → stateDiagram-2N3HPSRC-B2ui4ZZN.js} +1 -1
- package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-B_Wcpq2b.js +1 -0
- package/dist/gui/assets/{swimlanes-5IMT3BWC-Dcmb64x2.js → swimlanes-5IMT3BWC-DRhf5jKL.js} +2 -2
- package/dist/gui/assets/swimlanesDiagram-G3AALYLV-C2fsQgny.js +8 -0
- package/dist/gui/assets/{timeline-definition-FHXFAJF6-COm9ow7j.js → timeline-definition-FHXFAJF6-rm68zqM2.js} +1 -1
- package/dist/gui/assets/{vennDiagram-L72KCM5P-DliDuTVY.js → vennDiagram-L72KCM5P-BKVMfPvL.js} +1 -1
- package/dist/gui/assets/{wardleyDiagram-EHGQE667-C2O_2cpw.js → wardleyDiagram-EHGQE667-eXN3NRZ7.js} +1 -1
- package/dist/gui/assets/{xychartDiagram-FW5EYKEG-Ldmt9hoc.js → xychartDiagram-FW5EYKEG-3VtYytF2.js} +1 -1
- package/dist/gui/index.html +2 -2
- package/package.json +13 -1
- package/dist/_commonjsHelpers-DyI1JsEH.js +0 -34
- package/dist/abnfDiagram-VRR7QNED-UQS77aUi.js +0 -119
- package/dist/api-DrYc_Ds_.js +0 -129852
- package/dist/arc-B1cAL3U1.js +0 -132
- package/dist/architectureDiagram-ZJ3FMSHR-CfWOhs-q.js +0 -8816
- package/dist/blockDiagram-677ZJIJ3-CLOAAFZa.js +0 -3796
- package/dist/c4Diagram-LMCZKHZV-BGdELGkb.js +0 -2483
- package/dist/certs-BeimSwB3.js +0 -14071
- package/dist/certs-C4t5lAmJ.js +0 -14071
- package/dist/certs-CLLngjpY.js +0 -14071
- package/dist/certs-D3fTB-0_.js +0 -14071
- package/dist/channel-_gQD3mZ8.js +0 -8
- package/dist/chunk-2Q5K7J3B-DIJkMPWD.js +0 -20
- package/dist/chunk-32BRIVSS-CIQb7-9I.js +0 -117
- package/dist/chunk-5VM5RSS4-DmlAsh6o.js +0 -20
- package/dist/chunk-EX3LRPZG-BEXyn5R-.js +0 -1989
- package/dist/chunk-JWPE2WC7-XiIefccF.js +0 -17
- package/dist/chunk-MOJQB5TN-CC5OBDWw.js +0 -861
- package/dist/chunk-RYQCIY6F-DQacsGpB.js +0 -475
- package/dist/chunk-V7JOEXUC-TLRsIUvf.js +0 -2027
- package/dist/chunk-VR4S4FIN-9AfN7RDF.js +0 -25
- package/dist/chunk-XXDRQBXY-DhWucSRr.js +0 -14
- package/dist/classDiagram-OUVF2IWQ-CN55rRkB.js +0 -20
- package/dist/classDiagram-v2-EOCWNBFH-CN55rRkB.js +0 -20
- package/dist/cose-bilkent-JH36ORCC-8uGYe6_d.js +0 -4944
- package/dist/cynefin-VYW2F7L2-BwTeE-TI.js +0 -32061
- package/dist/cynefinDiagram-TSTJHNR4-DM7ixE-v.js +0 -454
- package/dist/cytoscape.esm-BTopYfIb.js +0 -30347
- package/dist/dagre-VKFMJZFB-blEDoYen.js +0 -522
- package/dist/defaultLocale-wHUL1xE2.js +0 -207
- package/dist/diagram-FQU43EPY-MEZlmmdi.js +0 -633
- package/dist/diagram-G47NLZAW-DZOZvHqp.js +0 -857
- package/dist/diagram-NH7WQ7WH-ChpmPbZz.js +0 -213
- package/dist/diagram-OA4YK3LP-oy4yvrnL.js +0 -489
- package/dist/diagram-WEI45ONY-B3nx1cYt.js +0 -305
- package/dist/ebnfDiagram-CCIWWBDH-BASj7BoO.js +0 -139
- package/dist/erDiagram-Q63AITRT-lujHq-S9.js +0 -1239
- package/dist/flowDiagram-23GEKE2U-BdsAVPgU.js +0 -2349
- package/dist/ganttDiagram-NO4QXBWP-DUUP4lsu.js +0 -3733
- package/dist/gitGraphDiagram-IHSO6WYX-BdIPAtb0.js +0 -1374
- package/dist/graph-CE8jV7cI.js +0 -2043
- package/dist/gui/assets/channel-DGoXAS0B.js +0 -1
- package/dist/gui/assets/classDiagram-OUVF2IWQ-B4zeZ0PC.js +0 -1
- package/dist/gui/assets/classDiagram-v2-EOCWNBFH-B4zeZ0PC.js +0 -1
- package/dist/gui/assets/index-Bp9JnkhK.css +0 -1
- package/dist/gui/assets/index-DKVgyltQ.js +0 -21
- package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-GXq_r-DG.js +0 -1
- package/dist/gui/assets/swimlanesDiagram-G3AALYLV-DDE-INgq.js +0 -8
- package/dist/index--GoVvfUP.js +0 -5447
- package/dist/index-3-WDiDAh.js +0 -5466
- package/dist/index-CHBXZAxg.js +0 -5460
- package/dist/index-DeCq8xn7.js +0 -5460
- package/dist/infoDiagram-FWYZ7A6U-D9wo93kg.js +0 -32
- package/dist/init-DDGa2CQM.js +0 -17
- package/dist/ishikawaDiagram-FXEZZL3T-DZh3_kt2.js +0 -968
- package/dist/journeyDiagram-5HDEW3XC-C8RWHIn0.js +0 -1256
- package/dist/kanban-definition-HUTT4EX6-B7qQtB5a.js +0 -1053
- package/dist/katex-WjDlQEfU.js +0 -14500
- package/dist/layout-DQAYh_L7.js +0 -2360
- package/dist/linear-C_kZRZXS.js +0 -341
- package/dist/map-BElV7BMC.js +0 -299
- package/dist/mermaid.core-Dy_tFRs7.js +0 -26495
- package/dist/mindmap-definition-LN4V7U3C-BzHCd5Ab.js +0 -1181
- package/dist/ordinal-C2kkg180.js +0 -77
- package/dist/pegDiagram-2B236MQR-B046bQWM.js +0 -127
- package/dist/pieDiagram-ENE6RG2P-B5_W2CZy.js +0 -316
- package/dist/quadrantDiagram-ABIIQ3AL-Bbpt496h.js +0 -1342
- package/dist/railroadDiagram-RFXS5EU6-10XIH3X0.js +0 -93
- package/dist/requirementDiagram-TGXJPOKE-Dt1QyccY.js +0 -1205
- package/dist/sankeyDiagram-HTMAVEWB-CnqRAq7M.js +0 -1274
- package/dist/sequenceDiagram-DBY2YBRQ-DtJLSXoz.js +0 -4515
- package/dist/sizeCapture-X5ZJPWSS-DUl5ZEo3.js +0 -63
- package/dist/stateDiagram-2N3HPSRC-b-qzcVNj.js +0 -449
- package/dist/stateDiagram-v2-6OUMAXLB-KjDlRfc7.js +0 -20
- package/dist/swimlanes-5IMT3BWC-CAjGnQLa.js +0 -8553
- package/dist/swimlanesDiagram-G3AALYLV-DiOi9bzU.js +0 -16
- package/dist/timeline-definition-FHXFAJF6-Bme2FWbh.js +0 -1597
- package/dist/vennDiagram-L72KCM5P-BUQgnZDB.js +0 -2516
- package/dist/wardleyDiagram-EHGQE667-DHR2Avlu.js +0 -976
- package/dist/xychartDiagram-FW5EYKEG-V4K5eBMS.js +0 -2000
|
@@ -1,857 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { p as populateCommonDb } from "./chunk-JWPE2WC7-XiIefccF.js";
|
|
3
|
-
import { _ as __name, E as getThemeVariables3, y as getConfig, A as cleanAndMerge, D as selectSvgElement, e as configureSvgSize, l as log, be as styles2String, d as select, b as setAccTitle, a as getAccTitle, n as setDiagramTitle, o as getDiagramTitle, g as getAccDescription, s as setAccDescription, B as defaultConfig_default, bf as isLabelStyle, p as clear } from "./mermaid.core-Dy_tFRs7.js";
|
|
4
|
-
import { s as setupViewPortForSVG } from "./chunk-VR4S4FIN-9AfN7RDF.js";
|
|
5
|
-
import { p as parse } from "./cynefin-VYW2F7L2-BwTeE-TI.js";
|
|
6
|
-
import { b as format } from "./defaultLocale-wHUL1xE2.js";
|
|
7
|
-
import { o as ordinal } from "./ordinal-C2kkg180.js";
|
|
8
|
-
function count(node) {
|
|
9
|
-
var sum = 0, children = node.children, i = children && children.length;
|
|
10
|
-
if (!i) sum = 1;
|
|
11
|
-
else while (--i >= 0) sum += children[i].value;
|
|
12
|
-
node.value = sum;
|
|
13
|
-
}
|
|
14
|
-
function node_count() {
|
|
15
|
-
return this.eachAfter(count);
|
|
16
|
-
}
|
|
17
|
-
function node_each(callback, that) {
|
|
18
|
-
let index = -1;
|
|
19
|
-
for (const node of this) {
|
|
20
|
-
callback.call(that, node, ++index, this);
|
|
21
|
-
}
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
function node_eachBefore(callback, that) {
|
|
25
|
-
var node = this, nodes = [node], children, i, index = -1;
|
|
26
|
-
while (node = nodes.pop()) {
|
|
27
|
-
callback.call(that, node, ++index, this);
|
|
28
|
-
if (children = node.children) {
|
|
29
|
-
for (i = children.length - 1; i >= 0; --i) {
|
|
30
|
-
nodes.push(children[i]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
function node_eachAfter(callback, that) {
|
|
37
|
-
var node = this, nodes = [node], next = [], children, i, n, index = -1;
|
|
38
|
-
while (node = nodes.pop()) {
|
|
39
|
-
next.push(node);
|
|
40
|
-
if (children = node.children) {
|
|
41
|
-
for (i = 0, n = children.length; i < n; ++i) {
|
|
42
|
-
nodes.push(children[i]);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
while (node = next.pop()) {
|
|
47
|
-
callback.call(that, node, ++index, this);
|
|
48
|
-
}
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
function node_find(callback, that) {
|
|
52
|
-
let index = -1;
|
|
53
|
-
for (const node of this) {
|
|
54
|
-
if (callback.call(that, node, ++index, this)) {
|
|
55
|
-
return node;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function node_sum(value) {
|
|
60
|
-
return this.eachAfter(function(node) {
|
|
61
|
-
var sum = +value(node.data) || 0, children = node.children, i = children && children.length;
|
|
62
|
-
while (--i >= 0) sum += children[i].value;
|
|
63
|
-
node.value = sum;
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function node_sort(compare) {
|
|
67
|
-
return this.eachBefore(function(node) {
|
|
68
|
-
if (node.children) {
|
|
69
|
-
node.children.sort(compare);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function node_path(end) {
|
|
74
|
-
var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start];
|
|
75
|
-
while (start !== ancestor) {
|
|
76
|
-
start = start.parent;
|
|
77
|
-
nodes.push(start);
|
|
78
|
-
}
|
|
79
|
-
var k = nodes.length;
|
|
80
|
-
while (end !== ancestor) {
|
|
81
|
-
nodes.splice(k, 0, end);
|
|
82
|
-
end = end.parent;
|
|
83
|
-
}
|
|
84
|
-
return nodes;
|
|
85
|
-
}
|
|
86
|
-
function leastCommonAncestor(a, b) {
|
|
87
|
-
if (a === b) return a;
|
|
88
|
-
var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null;
|
|
89
|
-
a = aNodes.pop();
|
|
90
|
-
b = bNodes.pop();
|
|
91
|
-
while (a === b) {
|
|
92
|
-
c = a;
|
|
93
|
-
a = aNodes.pop();
|
|
94
|
-
b = bNodes.pop();
|
|
95
|
-
}
|
|
96
|
-
return c;
|
|
97
|
-
}
|
|
98
|
-
function node_ancestors() {
|
|
99
|
-
var node = this, nodes = [node];
|
|
100
|
-
while (node = node.parent) {
|
|
101
|
-
nodes.push(node);
|
|
102
|
-
}
|
|
103
|
-
return nodes;
|
|
104
|
-
}
|
|
105
|
-
function node_descendants() {
|
|
106
|
-
return Array.from(this);
|
|
107
|
-
}
|
|
108
|
-
function node_leaves() {
|
|
109
|
-
var leaves = [];
|
|
110
|
-
this.eachBefore(function(node) {
|
|
111
|
-
if (!node.children) {
|
|
112
|
-
leaves.push(node);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
return leaves;
|
|
116
|
-
}
|
|
117
|
-
function node_links() {
|
|
118
|
-
var root = this, links = [];
|
|
119
|
-
root.each(function(node) {
|
|
120
|
-
if (node !== root) {
|
|
121
|
-
links.push({ source: node.parent, target: node });
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
return links;
|
|
125
|
-
}
|
|
126
|
-
function* node_iterator() {
|
|
127
|
-
var node = this, current, next = [node], children, i, n;
|
|
128
|
-
do {
|
|
129
|
-
current = next.reverse(), next = [];
|
|
130
|
-
while (node = current.pop()) {
|
|
131
|
-
yield node;
|
|
132
|
-
if (children = node.children) {
|
|
133
|
-
for (i = 0, n = children.length; i < n; ++i) {
|
|
134
|
-
next.push(children[i]);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
} while (next.length);
|
|
139
|
-
}
|
|
140
|
-
function hierarchy(data, children) {
|
|
141
|
-
if (data instanceof Map) {
|
|
142
|
-
data = [void 0, data];
|
|
143
|
-
if (children === void 0) children = mapChildren;
|
|
144
|
-
} else if (children === void 0) {
|
|
145
|
-
children = objectChildren;
|
|
146
|
-
}
|
|
147
|
-
var root = new Node(data), node, nodes = [root], child, childs, i, n;
|
|
148
|
-
while (node = nodes.pop()) {
|
|
149
|
-
if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {
|
|
150
|
-
node.children = childs;
|
|
151
|
-
for (i = n - 1; i >= 0; --i) {
|
|
152
|
-
nodes.push(child = childs[i] = new Node(childs[i]));
|
|
153
|
-
child.parent = node;
|
|
154
|
-
child.depth = node.depth + 1;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return root.eachBefore(computeHeight);
|
|
159
|
-
}
|
|
160
|
-
function node_copy() {
|
|
161
|
-
return hierarchy(this).eachBefore(copyData);
|
|
162
|
-
}
|
|
163
|
-
function objectChildren(d) {
|
|
164
|
-
return d.children;
|
|
165
|
-
}
|
|
166
|
-
function mapChildren(d) {
|
|
167
|
-
return Array.isArray(d) ? d[1] : null;
|
|
168
|
-
}
|
|
169
|
-
function copyData(node) {
|
|
170
|
-
if (node.data.value !== void 0) node.value = node.data.value;
|
|
171
|
-
node.data = node.data.data;
|
|
172
|
-
}
|
|
173
|
-
function computeHeight(node) {
|
|
174
|
-
var height = 0;
|
|
175
|
-
do
|
|
176
|
-
node.height = height;
|
|
177
|
-
while ((node = node.parent) && node.height < ++height);
|
|
178
|
-
}
|
|
179
|
-
function Node(data) {
|
|
180
|
-
this.data = data;
|
|
181
|
-
this.depth = this.height = 0;
|
|
182
|
-
this.parent = null;
|
|
183
|
-
}
|
|
184
|
-
Node.prototype = hierarchy.prototype = {
|
|
185
|
-
constructor: Node,
|
|
186
|
-
count: node_count,
|
|
187
|
-
each: node_each,
|
|
188
|
-
eachAfter: node_eachAfter,
|
|
189
|
-
eachBefore: node_eachBefore,
|
|
190
|
-
find: node_find,
|
|
191
|
-
sum: node_sum,
|
|
192
|
-
sort: node_sort,
|
|
193
|
-
path: node_path,
|
|
194
|
-
ancestors: node_ancestors,
|
|
195
|
-
descendants: node_descendants,
|
|
196
|
-
leaves: node_leaves,
|
|
197
|
-
links: node_links,
|
|
198
|
-
copy: node_copy,
|
|
199
|
-
[Symbol.iterator]: node_iterator
|
|
200
|
-
};
|
|
201
|
-
function required(f) {
|
|
202
|
-
if (typeof f !== "function") throw new Error();
|
|
203
|
-
return f;
|
|
204
|
-
}
|
|
205
|
-
function constantZero() {
|
|
206
|
-
return 0;
|
|
207
|
-
}
|
|
208
|
-
function constant(x) {
|
|
209
|
-
return function() {
|
|
210
|
-
return x;
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
function roundNode(node) {
|
|
214
|
-
node.x0 = Math.round(node.x0);
|
|
215
|
-
node.y0 = Math.round(node.y0);
|
|
216
|
-
node.x1 = Math.round(node.x1);
|
|
217
|
-
node.y1 = Math.round(node.y1);
|
|
218
|
-
}
|
|
219
|
-
function treemapDice(parent, x0, y0, x1, y1) {
|
|
220
|
-
var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value;
|
|
221
|
-
while (++i < n) {
|
|
222
|
-
node = nodes[i], node.y0 = y0, node.y1 = y1;
|
|
223
|
-
node.x0 = x0, node.x1 = x0 += node.value * k;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
function treemapSlice(parent, x0, y0, x1, y1) {
|
|
227
|
-
var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value;
|
|
228
|
-
while (++i < n) {
|
|
229
|
-
node = nodes[i], node.x0 = x0, node.x1 = x1;
|
|
230
|
-
node.y0 = y0, node.y1 = y0 += node.value * k;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
var phi = (1 + Math.sqrt(5)) / 2;
|
|
234
|
-
function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
|
|
235
|
-
var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta;
|
|
236
|
-
while (i0 < n) {
|
|
237
|
-
dx = x1 - x0, dy = y1 - y0;
|
|
238
|
-
do
|
|
239
|
-
sumValue = nodes[i1++].value;
|
|
240
|
-
while (!sumValue && i1 < n);
|
|
241
|
-
minValue = maxValue = sumValue;
|
|
242
|
-
alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
|
|
243
|
-
beta = sumValue * sumValue * alpha;
|
|
244
|
-
minRatio = Math.max(maxValue / beta, beta / minValue);
|
|
245
|
-
for (; i1 < n; ++i1) {
|
|
246
|
-
sumValue += nodeValue = nodes[i1].value;
|
|
247
|
-
if (nodeValue < minValue) minValue = nodeValue;
|
|
248
|
-
if (nodeValue > maxValue) maxValue = nodeValue;
|
|
249
|
-
beta = sumValue * sumValue * alpha;
|
|
250
|
-
newRatio = Math.max(maxValue / beta, beta / minValue);
|
|
251
|
-
if (newRatio > minRatio) {
|
|
252
|
-
sumValue -= nodeValue;
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
minRatio = newRatio;
|
|
256
|
-
}
|
|
257
|
-
rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) });
|
|
258
|
-
if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
|
|
259
|
-
else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
|
|
260
|
-
value -= sumValue, i0 = i1;
|
|
261
|
-
}
|
|
262
|
-
return rows;
|
|
263
|
-
}
|
|
264
|
-
const squarify = (function custom(ratio) {
|
|
265
|
-
function squarify2(parent, x0, y0, x1, y1) {
|
|
266
|
-
squarifyRatio(ratio, parent, x0, y0, x1, y1);
|
|
267
|
-
}
|
|
268
|
-
squarify2.ratio = function(x) {
|
|
269
|
-
return custom((x = +x) > 1 ? x : 1);
|
|
270
|
-
};
|
|
271
|
-
return squarify2;
|
|
272
|
-
})(phi);
|
|
273
|
-
function treemap() {
|
|
274
|
-
var tile = squarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;
|
|
275
|
-
function treemap2(root) {
|
|
276
|
-
root.x0 = root.y0 = 0;
|
|
277
|
-
root.x1 = dx;
|
|
278
|
-
root.y1 = dy;
|
|
279
|
-
root.eachBefore(positionNode);
|
|
280
|
-
paddingStack = [0];
|
|
281
|
-
if (round) root.eachBefore(roundNode);
|
|
282
|
-
return root;
|
|
283
|
-
}
|
|
284
|
-
function positionNode(node) {
|
|
285
|
-
var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p;
|
|
286
|
-
if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
|
|
287
|
-
if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
|
|
288
|
-
node.x0 = x0;
|
|
289
|
-
node.y0 = y0;
|
|
290
|
-
node.x1 = x1;
|
|
291
|
-
node.y1 = y1;
|
|
292
|
-
if (node.children) {
|
|
293
|
-
p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
|
|
294
|
-
x0 += paddingLeft(node) - p;
|
|
295
|
-
y0 += paddingTop(node) - p;
|
|
296
|
-
x1 -= paddingRight(node) - p;
|
|
297
|
-
y1 -= paddingBottom(node) - p;
|
|
298
|
-
if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
|
|
299
|
-
if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
|
|
300
|
-
tile(node, x0, y0, x1, y1);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
treemap2.round = function(x) {
|
|
304
|
-
return arguments.length ? (round = !!x, treemap2) : round;
|
|
305
|
-
};
|
|
306
|
-
treemap2.size = function(x) {
|
|
307
|
-
return arguments.length ? (dx = +x[0], dy = +x[1], treemap2) : [dx, dy];
|
|
308
|
-
};
|
|
309
|
-
treemap2.tile = function(x) {
|
|
310
|
-
return arguments.length ? (tile = required(x), treemap2) : tile;
|
|
311
|
-
};
|
|
312
|
-
treemap2.padding = function(x) {
|
|
313
|
-
return arguments.length ? treemap2.paddingInner(x).paddingOuter(x) : treemap2.paddingInner();
|
|
314
|
-
};
|
|
315
|
-
treemap2.paddingInner = function(x) {
|
|
316
|
-
return arguments.length ? (paddingInner = typeof x === "function" ? x : constant(+x), treemap2) : paddingInner;
|
|
317
|
-
};
|
|
318
|
-
treemap2.paddingOuter = function(x) {
|
|
319
|
-
return arguments.length ? treemap2.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap2.paddingTop();
|
|
320
|
-
};
|
|
321
|
-
treemap2.paddingTop = function(x) {
|
|
322
|
-
return arguments.length ? (paddingTop = typeof x === "function" ? x : constant(+x), treemap2) : paddingTop;
|
|
323
|
-
};
|
|
324
|
-
treemap2.paddingRight = function(x) {
|
|
325
|
-
return arguments.length ? (paddingRight = typeof x === "function" ? x : constant(+x), treemap2) : paddingRight;
|
|
326
|
-
};
|
|
327
|
-
treemap2.paddingBottom = function(x) {
|
|
328
|
-
return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant(+x), treemap2) : paddingBottom;
|
|
329
|
-
};
|
|
330
|
-
treemap2.paddingLeft = function(x) {
|
|
331
|
-
return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant(+x), treemap2) : paddingLeft;
|
|
332
|
-
};
|
|
333
|
-
return treemap2;
|
|
334
|
-
}
|
|
335
|
-
var TreeMapDB = class {
|
|
336
|
-
constructor() {
|
|
337
|
-
this.nodes = [];
|
|
338
|
-
this.levels = /* @__PURE__ */ new Map();
|
|
339
|
-
this.outerNodes = [];
|
|
340
|
-
this.classes = /* @__PURE__ */ new Map();
|
|
341
|
-
this.setAccTitle = setAccTitle;
|
|
342
|
-
this.getAccTitle = getAccTitle;
|
|
343
|
-
this.setDiagramTitle = setDiagramTitle;
|
|
344
|
-
this.getDiagramTitle = getDiagramTitle;
|
|
345
|
-
this.getAccDescription = getAccDescription;
|
|
346
|
-
this.setAccDescription = setAccDescription;
|
|
347
|
-
}
|
|
348
|
-
static {
|
|
349
|
-
__name(this, "TreeMapDB");
|
|
350
|
-
}
|
|
351
|
-
getNodes() {
|
|
352
|
-
return this.nodes;
|
|
353
|
-
}
|
|
354
|
-
getConfig() {
|
|
355
|
-
const defaultConfig = defaultConfig_default;
|
|
356
|
-
const userConfig = getConfig();
|
|
357
|
-
return cleanAndMerge({
|
|
358
|
-
...defaultConfig.treemap,
|
|
359
|
-
...userConfig.treemap ?? {}
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
addNode(node, level) {
|
|
363
|
-
this.nodes.push(node);
|
|
364
|
-
this.levels.set(node, level);
|
|
365
|
-
if (level === 0) {
|
|
366
|
-
this.outerNodes.push(node);
|
|
367
|
-
this.root ??= node;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
getRoot() {
|
|
371
|
-
return { name: "", children: this.outerNodes };
|
|
372
|
-
}
|
|
373
|
-
addClass(id, _style) {
|
|
374
|
-
const styleClass = this.classes.get(id) ?? { id, styles: [], textStyles: [] };
|
|
375
|
-
const styles = _style.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
|
|
376
|
-
if (styles) {
|
|
377
|
-
styles.forEach((s) => {
|
|
378
|
-
if (isLabelStyle(s)) {
|
|
379
|
-
if (styleClass?.textStyles) {
|
|
380
|
-
styleClass.textStyles.push(s);
|
|
381
|
-
} else {
|
|
382
|
-
styleClass.textStyles = [s];
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
if (styleClass?.styles) {
|
|
386
|
-
styleClass.styles.push(s);
|
|
387
|
-
} else {
|
|
388
|
-
styleClass.styles = [s];
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
this.classes.set(id, styleClass);
|
|
393
|
-
}
|
|
394
|
-
getClasses() {
|
|
395
|
-
return this.classes;
|
|
396
|
-
}
|
|
397
|
-
getStylesForClass(classSelector) {
|
|
398
|
-
return this.classes.get(classSelector)?.styles ?? [];
|
|
399
|
-
}
|
|
400
|
-
clear() {
|
|
401
|
-
clear();
|
|
402
|
-
this.nodes = [];
|
|
403
|
-
this.levels = /* @__PURE__ */ new Map();
|
|
404
|
-
this.outerNodes = [];
|
|
405
|
-
this.classes = /* @__PURE__ */ new Map();
|
|
406
|
-
this.root = void 0;
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
function buildHierarchy(items) {
|
|
410
|
-
if (!items.length) {
|
|
411
|
-
return [];
|
|
412
|
-
}
|
|
413
|
-
const root = [];
|
|
414
|
-
const stack = [];
|
|
415
|
-
items.forEach((item) => {
|
|
416
|
-
const node = {
|
|
417
|
-
name: item.name,
|
|
418
|
-
children: item.type === "Leaf" ? void 0 : []
|
|
419
|
-
};
|
|
420
|
-
node.classSelector = item?.classSelector;
|
|
421
|
-
if (item?.cssCompiledStyles) {
|
|
422
|
-
node.cssCompiledStyles = item.cssCompiledStyles;
|
|
423
|
-
}
|
|
424
|
-
if (item.type === "Leaf" && item.value !== void 0) {
|
|
425
|
-
node.value = item.value;
|
|
426
|
-
}
|
|
427
|
-
while (stack.length > 0 && stack[stack.length - 1].level >= item.level) {
|
|
428
|
-
stack.pop();
|
|
429
|
-
}
|
|
430
|
-
if (stack.length === 0) {
|
|
431
|
-
root.push(node);
|
|
432
|
-
} else {
|
|
433
|
-
const parent = stack[stack.length - 1].node;
|
|
434
|
-
if (parent.children) {
|
|
435
|
-
parent.children.push(node);
|
|
436
|
-
} else {
|
|
437
|
-
parent.children = [node];
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
if (item.type !== "Leaf") {
|
|
441
|
-
stack.push({ node, level: item.level });
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
return root;
|
|
445
|
-
}
|
|
446
|
-
__name(buildHierarchy, "buildHierarchy");
|
|
447
|
-
var populate = /* @__PURE__ */ __name((ast, db) => {
|
|
448
|
-
populateCommonDb(ast, db);
|
|
449
|
-
const items = [];
|
|
450
|
-
for (const row of ast.TreemapRows ?? []) {
|
|
451
|
-
if (row.$type === "ClassDefStatement") {
|
|
452
|
-
db.addClass(row.className ?? "", row.styleText ?? "");
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
for (const row of ast.TreemapRows ?? []) {
|
|
456
|
-
const item = row.item;
|
|
457
|
-
if (!item) {
|
|
458
|
-
continue;
|
|
459
|
-
}
|
|
460
|
-
const level = row.indent ? parseInt(row.indent) : 0;
|
|
461
|
-
const name = getItemName(item);
|
|
462
|
-
const styles = item.classSelector ? db.getStylesForClass(item.classSelector) : [];
|
|
463
|
-
const cssCompiledStyles = styles.length > 0 ? styles : void 0;
|
|
464
|
-
const itemData = {
|
|
465
|
-
level,
|
|
466
|
-
name,
|
|
467
|
-
type: item.$type,
|
|
468
|
-
value: item.value,
|
|
469
|
-
classSelector: item.classSelector,
|
|
470
|
-
cssCompiledStyles
|
|
471
|
-
};
|
|
472
|
-
items.push(itemData);
|
|
473
|
-
}
|
|
474
|
-
const hierarchyNodes = buildHierarchy(items);
|
|
475
|
-
const addNodesRecursively = /* @__PURE__ */ __name((nodes, level) => {
|
|
476
|
-
for (const node of nodes) {
|
|
477
|
-
db.addNode(node, level);
|
|
478
|
-
if (node.children && node.children.length > 0) {
|
|
479
|
-
addNodesRecursively(node.children, level + 1);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}, "addNodesRecursively");
|
|
483
|
-
addNodesRecursively(hierarchyNodes, 0);
|
|
484
|
-
}, "populate");
|
|
485
|
-
var getItemName = /* @__PURE__ */ __name((item) => {
|
|
486
|
-
return item.name ? String(item.name) : "";
|
|
487
|
-
}, "getItemName");
|
|
488
|
-
var parser = {
|
|
489
|
-
// @ts-expect-error - TreeMapDB is not assignable to DiagramDB
|
|
490
|
-
parser: { yy: void 0 },
|
|
491
|
-
parse: /* @__PURE__ */ __name(async (text) => {
|
|
492
|
-
try {
|
|
493
|
-
const parseFunc = parse;
|
|
494
|
-
const ast = await parseFunc("treemap", text);
|
|
495
|
-
log.debug("Treemap AST:", ast);
|
|
496
|
-
const db = parser.parser?.yy;
|
|
497
|
-
if (!(db instanceof TreeMapDB)) {
|
|
498
|
-
throw new Error(
|
|
499
|
-
"parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
|
|
500
|
-
);
|
|
501
|
-
}
|
|
502
|
-
populate(ast, db);
|
|
503
|
-
} catch (error) {
|
|
504
|
-
log.error("Error parsing treemap:", error);
|
|
505
|
-
throw error;
|
|
506
|
-
}
|
|
507
|
-
}, "parse")
|
|
508
|
-
};
|
|
509
|
-
var DEFAULT_INNER_PADDING = 10;
|
|
510
|
-
var SECTION_INNER_PADDING = 10;
|
|
511
|
-
var SECTION_HEADER_HEIGHT = 25;
|
|
512
|
-
var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
513
|
-
const treemapDb = diagram2.db;
|
|
514
|
-
const config = treemapDb.getConfig();
|
|
515
|
-
const treemapInnerPadding = config.padding ?? DEFAULT_INNER_PADDING;
|
|
516
|
-
const title = treemapDb.getDiagramTitle();
|
|
517
|
-
const root = treemapDb.getRoot();
|
|
518
|
-
const { themeVariables } = getConfig();
|
|
519
|
-
if (!root) {
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
const titleHeight = title ? 30 : 0;
|
|
523
|
-
const svg = selectSvgElement(id);
|
|
524
|
-
const width = config.nodeWidth ? config.nodeWidth * SECTION_INNER_PADDING : 960;
|
|
525
|
-
const height = config.nodeHeight ? config.nodeHeight * SECTION_INNER_PADDING : 500;
|
|
526
|
-
const svgWidth = width;
|
|
527
|
-
const svgHeight = height + titleHeight;
|
|
528
|
-
svg.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
|
|
529
|
-
configureSvgSize(svg, svgHeight, svgWidth, config.useMaxWidth);
|
|
530
|
-
let valueFormat;
|
|
531
|
-
try {
|
|
532
|
-
const formatStr = config.valueFormat || ",";
|
|
533
|
-
if (formatStr === "$0,0") {
|
|
534
|
-
valueFormat = /* @__PURE__ */ __name((value) => "$" + format(",")(value), "valueFormat");
|
|
535
|
-
} else if (formatStr.startsWith("$") && formatStr.includes(",")) {
|
|
536
|
-
const precision = /\.\d+/.exec(formatStr);
|
|
537
|
-
const precisionStr = precision ? precision[0] : "";
|
|
538
|
-
valueFormat = /* @__PURE__ */ __name((value) => "$" + format("," + precisionStr)(value), "valueFormat");
|
|
539
|
-
} else if (formatStr.startsWith("$")) {
|
|
540
|
-
const restOfFormat = formatStr.substring(1);
|
|
541
|
-
valueFormat = /* @__PURE__ */ __name((value) => "$" + format(restOfFormat || "")(value), "valueFormat");
|
|
542
|
-
} else {
|
|
543
|
-
valueFormat = format(formatStr);
|
|
544
|
-
}
|
|
545
|
-
} catch (error) {
|
|
546
|
-
log.error("Error creating format function:", error);
|
|
547
|
-
valueFormat = format(",");
|
|
548
|
-
}
|
|
549
|
-
const colorScale = ordinal().range([
|
|
550
|
-
"transparent",
|
|
551
|
-
themeVariables.cScale0,
|
|
552
|
-
themeVariables.cScale1,
|
|
553
|
-
themeVariables.cScale2,
|
|
554
|
-
themeVariables.cScale3,
|
|
555
|
-
themeVariables.cScale4,
|
|
556
|
-
themeVariables.cScale5,
|
|
557
|
-
themeVariables.cScale6,
|
|
558
|
-
themeVariables.cScale7,
|
|
559
|
-
themeVariables.cScale8,
|
|
560
|
-
themeVariables.cScale9,
|
|
561
|
-
themeVariables.cScale10,
|
|
562
|
-
themeVariables.cScale11
|
|
563
|
-
]);
|
|
564
|
-
const colorScalePeer = ordinal().range([
|
|
565
|
-
"transparent",
|
|
566
|
-
themeVariables.cScalePeer0,
|
|
567
|
-
themeVariables.cScalePeer1,
|
|
568
|
-
themeVariables.cScalePeer2,
|
|
569
|
-
themeVariables.cScalePeer3,
|
|
570
|
-
themeVariables.cScalePeer4,
|
|
571
|
-
themeVariables.cScalePeer5,
|
|
572
|
-
themeVariables.cScalePeer6,
|
|
573
|
-
themeVariables.cScalePeer7,
|
|
574
|
-
themeVariables.cScalePeer8,
|
|
575
|
-
themeVariables.cScalePeer9,
|
|
576
|
-
themeVariables.cScalePeer10,
|
|
577
|
-
themeVariables.cScalePeer11
|
|
578
|
-
]);
|
|
579
|
-
const colorScaleLabel = ordinal().range([
|
|
580
|
-
themeVariables.cScaleLabel0,
|
|
581
|
-
themeVariables.cScaleLabel1,
|
|
582
|
-
themeVariables.cScaleLabel2,
|
|
583
|
-
themeVariables.cScaleLabel3,
|
|
584
|
-
themeVariables.cScaleLabel4,
|
|
585
|
-
themeVariables.cScaleLabel5,
|
|
586
|
-
themeVariables.cScaleLabel6,
|
|
587
|
-
themeVariables.cScaleLabel7,
|
|
588
|
-
themeVariables.cScaleLabel8,
|
|
589
|
-
themeVariables.cScaleLabel9,
|
|
590
|
-
themeVariables.cScaleLabel10,
|
|
591
|
-
themeVariables.cScaleLabel11
|
|
592
|
-
]);
|
|
593
|
-
if (title) {
|
|
594
|
-
svg.append("text").attr("x", svgWidth / 2).attr("y", titleHeight / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title);
|
|
595
|
-
}
|
|
596
|
-
const g = svg.append("g").attr("transform", `translate(0, ${titleHeight})`).attr("class", "treemapContainer");
|
|
597
|
-
const hierarchyRoot = hierarchy(root).sum((d) => d.value ?? 0).sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
|
|
598
|
-
const treemapLayout = treemap().size([width, height]).paddingTop(
|
|
599
|
-
(d) => d.children && d.children.length > 0 ? SECTION_HEADER_HEIGHT + SECTION_INNER_PADDING : 0
|
|
600
|
-
).paddingInner(treemapInnerPadding).paddingLeft((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingRight((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingBottom((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).round(true);
|
|
601
|
-
const treemapData = treemapLayout(hierarchyRoot);
|
|
602
|
-
const branchNodes = treemapData.descendants().filter((d) => d.children && d.children.length > 0);
|
|
603
|
-
const sections = g.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class", "treemapSection").attr("transform", (d) => `translate(${d.x0},${d.y0})`);
|
|
604
|
-
sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", SECTION_HEADER_HEIGHT).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (d) => {
|
|
605
|
-
if (d.depth === 0) {
|
|
606
|
-
return "display: none;";
|
|
607
|
-
}
|
|
608
|
-
return "";
|
|
609
|
-
});
|
|
610
|
-
sections.append("clipPath").attr("id", (_d, i) => `clip-section-${id}-${i}`).append("rect").attr("width", (d) => Math.max(0, d.x1 - d.x0 - 12)).attr("height", SECTION_HEADER_HEIGHT);
|
|
611
|
-
sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", (_d, i) => {
|
|
612
|
-
return `treemapSection section${i}`;
|
|
613
|
-
}).attr("fill", (d) => colorScale(d.data.name)).attr("fill-opacity", 0.6).attr("stroke", (d) => colorScalePeer(d.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (d) => {
|
|
614
|
-
if (d.depth === 0) {
|
|
615
|
-
return "display: none;";
|
|
616
|
-
}
|
|
617
|
-
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
618
|
-
return styles.nodeStyles + ";" + styles.borderStyles.join(";");
|
|
619
|
-
});
|
|
620
|
-
sections.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", SECTION_HEADER_HEIGHT / 2).attr("dominant-baseline", "middle").text((d) => d.depth === 0 ? "" : d.data.name).attr("font-weight", "bold").attr("clip-path", (_d, i) => `url(#clip-section-${id}-${i})`).attr("style", (d) => {
|
|
621
|
-
if (d.depth === 0) {
|
|
622
|
-
return "display: none;";
|
|
623
|
-
}
|
|
624
|
-
const labelStyles = "dominant-baseline: middle; font-size: 12px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
|
|
625
|
-
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
626
|
-
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
|
627
|
-
}).each(function(d) {
|
|
628
|
-
if (d.depth === 0) {
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
const self = select(this);
|
|
632
|
-
const originalText = d.data.name;
|
|
633
|
-
self.text(originalText);
|
|
634
|
-
const totalHeaderWidth = d.x1 - d.x0;
|
|
635
|
-
const labelXPosition = 6;
|
|
636
|
-
let spaceForTextContent;
|
|
637
|
-
if (config.showValues !== false && d.value) {
|
|
638
|
-
const valueEndsAtXRelative = totalHeaderWidth - 10;
|
|
639
|
-
const estimatedValueTextActualWidth = 30;
|
|
640
|
-
const gapBetweenLabelAndValue = 10;
|
|
641
|
-
const labelMustEndBeforeX = valueEndsAtXRelative - estimatedValueTextActualWidth - gapBetweenLabelAndValue;
|
|
642
|
-
spaceForTextContent = labelMustEndBeforeX - labelXPosition;
|
|
643
|
-
} else {
|
|
644
|
-
const labelOwnRightPadding = 6;
|
|
645
|
-
spaceForTextContent = totalHeaderWidth - labelXPosition - labelOwnRightPadding;
|
|
646
|
-
}
|
|
647
|
-
const minimumWidthToDisplay = 15;
|
|
648
|
-
const actualAvailableWidth = Math.max(minimumWidthToDisplay, spaceForTextContent);
|
|
649
|
-
const textNode = self.node();
|
|
650
|
-
const currentTextContentLength = textNode.getComputedTextLength();
|
|
651
|
-
if (currentTextContentLength > actualAvailableWidth) {
|
|
652
|
-
const ellipsis = "...";
|
|
653
|
-
let currentTruncatedText = originalText;
|
|
654
|
-
while (currentTruncatedText.length > 0) {
|
|
655
|
-
currentTruncatedText = originalText.substring(0, currentTruncatedText.length - 1);
|
|
656
|
-
if (currentTruncatedText.length === 0) {
|
|
657
|
-
self.text(ellipsis);
|
|
658
|
-
if (textNode.getComputedTextLength() > actualAvailableWidth) {
|
|
659
|
-
self.text("");
|
|
660
|
-
}
|
|
661
|
-
break;
|
|
662
|
-
}
|
|
663
|
-
self.text(currentTruncatedText + ellipsis);
|
|
664
|
-
if (textNode.getComputedTextLength() <= actualAvailableWidth) {
|
|
665
|
-
break;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
if (config.showValues !== false) {
|
|
671
|
-
sections.append("text").attr("class", "treemapSectionValue").attr("x", (d) => d.x1 - d.x0 - 10).attr("y", SECTION_HEADER_HEIGHT / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((d) => d.value ? valueFormat(d.value) : "").attr("font-style", "italic").attr("style", (d) => {
|
|
672
|
-
if (d.depth === 0) {
|
|
673
|
-
return "display: none;";
|
|
674
|
-
}
|
|
675
|
-
const labelStyles = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
|
|
676
|
-
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
677
|
-
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
const leafNodes = treemapData.leaves();
|
|
681
|
-
const isComplexTreemap = leafNodes.length > 20;
|
|
682
|
-
const baseLabelFontSize = isComplexTreemap ? 16 : 38;
|
|
683
|
-
const baseValueFontSize = isComplexTreemap ? 14 : 28;
|
|
684
|
-
const minLabelFontSize = isComplexTreemap ? 4 : 8;
|
|
685
|
-
const minValueFontSize = isComplexTreemap ? 4 : 6;
|
|
686
|
-
const labelPadding = isComplexTreemap ? 2 : 4;
|
|
687
|
-
const minDisplayThreshold = isComplexTreemap ? 8 : 10;
|
|
688
|
-
const spacingBetweenLabelAndValue = isComplexTreemap ? 1 : 2;
|
|
689
|
-
const cell = g.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class", (d, i) => {
|
|
690
|
-
return `treemapNode treemapLeafGroup leaf${i}${d.data.classSelector ? ` ${d.data.classSelector}` : ""}x`;
|
|
691
|
-
}).attr("transform", (d) => `translate(${d.x0},${d.y0})`);
|
|
692
|
-
cell.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", "treemapLeaf").attr("fill", (d) => {
|
|
693
|
-
return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
|
|
694
|
-
}).attr("style", (d) => {
|
|
695
|
-
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
696
|
-
return styles.nodeStyles;
|
|
697
|
-
}).attr("fill-opacity", 0.3).attr("stroke", (d) => {
|
|
698
|
-
return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
|
|
699
|
-
}).attr("stroke-width", 3);
|
|
700
|
-
cell.append("clipPath").attr("id", (_d, i) => `clip-${id}-${i}`).append("rect").attr("width", (d) => Math.max(0, d.x1 - d.x0 - 4)).attr("height", (d) => Math.max(0, d.y1 - d.y0 - 4));
|
|
701
|
-
const leafLabels = cell.append("text").attr("class", "treemapLabel").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", (d) => (d.y1 - d.y0) / 2).attr("style", (d) => {
|
|
702
|
-
const labelStyles = `text-anchor: middle; dominant-baseline: middle; font-size: ${baseLabelFontSize}px;fill:` + colorScaleLabel(d.data.name) + ";";
|
|
703
|
-
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
704
|
-
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
|
705
|
-
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.data.name);
|
|
706
|
-
leafLabels.each(function(d) {
|
|
707
|
-
const self = select(this);
|
|
708
|
-
const nodeWidth = d.x1 - d.x0;
|
|
709
|
-
const nodeHeight = d.y1 - d.y0;
|
|
710
|
-
const textNode = self.node();
|
|
711
|
-
const availableWidth = nodeWidth - 2 * labelPadding;
|
|
712
|
-
const availableHeight = nodeHeight - 2 * labelPadding;
|
|
713
|
-
if (availableWidth < minDisplayThreshold || availableHeight < minDisplayThreshold) {
|
|
714
|
-
self.style("display", "none");
|
|
715
|
-
return;
|
|
716
|
-
}
|
|
717
|
-
let currentLabelFontSize = parseInt(self.style("font-size"), 10);
|
|
718
|
-
const valueScaleFactor = 0.6;
|
|
719
|
-
while (textNode.getComputedTextLength() > availableWidth && currentLabelFontSize > minLabelFontSize) {
|
|
720
|
-
currentLabelFontSize--;
|
|
721
|
-
self.style("font-size", `${currentLabelFontSize}px`);
|
|
722
|
-
}
|
|
723
|
-
let prospectiveValueFontSize = Math.max(
|
|
724
|
-
minValueFontSize,
|
|
725
|
-
Math.min(baseValueFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
|
|
726
|
-
);
|
|
727
|
-
let combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
|
|
728
|
-
while (combinedHeight > availableHeight && currentLabelFontSize > minLabelFontSize) {
|
|
729
|
-
currentLabelFontSize--;
|
|
730
|
-
prospectiveValueFontSize = Math.max(
|
|
731
|
-
minValueFontSize,
|
|
732
|
-
Math.min(baseValueFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
|
|
733
|
-
);
|
|
734
|
-
if (prospectiveValueFontSize < minValueFontSize && currentLabelFontSize === minLabelFontSize) {
|
|
735
|
-
break;
|
|
736
|
-
}
|
|
737
|
-
self.style("font-size", `${currentLabelFontSize}px`);
|
|
738
|
-
combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
|
|
739
|
-
}
|
|
740
|
-
self.style("font-size", `${currentLabelFontSize}px`);
|
|
741
|
-
if (isComplexTreemap) {
|
|
742
|
-
if (currentLabelFontSize < minLabelFontSize || availableHeight < minLabelFontSize) {
|
|
743
|
-
self.style("display", "none");
|
|
744
|
-
}
|
|
745
|
-
} else {
|
|
746
|
-
if (textNode.getComputedTextLength() > availableWidth || currentLabelFontSize < minLabelFontSize || availableHeight < currentLabelFontSize) {
|
|
747
|
-
self.style("display", "none");
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
if (config.showValues !== false) {
|
|
752
|
-
const leafValues = cell.append("text").attr("class", "treemapValue").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", function(d) {
|
|
753
|
-
return (d.y1 - d.y0) / 2;
|
|
754
|
-
}).attr("style", (d) => {
|
|
755
|
-
const labelStyles = `text-anchor: middle; dominant-baseline: hanging; font-size: ${baseValueFontSize}px;fill:` + colorScaleLabel(d.data.name) + ";";
|
|
756
|
-
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
757
|
-
return labelStyles + styles.labelStyles.replace("color:", "fill:");
|
|
758
|
-
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.value ? valueFormat(d.value) : "");
|
|
759
|
-
leafValues.each(function(d) {
|
|
760
|
-
const valueTextElement = select(this);
|
|
761
|
-
const parentCellNode = this.parentNode;
|
|
762
|
-
if (!parentCellNode) {
|
|
763
|
-
valueTextElement.style("display", "none");
|
|
764
|
-
return;
|
|
765
|
-
}
|
|
766
|
-
const labelElement = select(parentCellNode).select(".treemapLabel");
|
|
767
|
-
if (labelElement.empty() || labelElement.style("display") === "none") {
|
|
768
|
-
valueTextElement.style("display", "none");
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
const finalLabelFontSize = parseFloat(labelElement.style("font-size"));
|
|
772
|
-
const valueScaleFactor = 0.6;
|
|
773
|
-
const actualValueFontSize = Math.max(
|
|
774
|
-
minValueFontSize,
|
|
775
|
-
Math.min(baseValueFontSize, Math.round(finalLabelFontSize * valueScaleFactor))
|
|
776
|
-
);
|
|
777
|
-
valueTextElement.style("font-size", `${actualValueFontSize}px`);
|
|
778
|
-
const labelCenterY = (d.y1 - d.y0) / 2;
|
|
779
|
-
const valueTopActualY = labelCenterY + finalLabelFontSize / 2 + spacingBetweenLabelAndValue;
|
|
780
|
-
valueTextElement.attr("y", valueTopActualY);
|
|
781
|
-
const nodeWidth = d.x1 - d.x0;
|
|
782
|
-
const nodeTotalHeight = d.y1 - d.y0;
|
|
783
|
-
const cellBottomPadding = 4;
|
|
784
|
-
const maxValueBottomY = nodeTotalHeight - cellBottomPadding;
|
|
785
|
-
const availableWidthForValue = nodeWidth - 2 * labelPadding;
|
|
786
|
-
if (valueTextElement.node().getComputedTextLength() > availableWidthForValue || valueTopActualY + actualValueFontSize > maxValueBottomY || actualValueFontSize < minValueFontSize) {
|
|
787
|
-
valueTextElement.style("display", "none");
|
|
788
|
-
} else {
|
|
789
|
-
valueTextElement.style("display", null);
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
|
-
const diagramPadding = config.diagramPadding ?? 8;
|
|
794
|
-
setupViewPortForSVG(svg, diagramPadding, "flowchart", config?.useMaxWidth || false);
|
|
795
|
-
}, "draw");
|
|
796
|
-
var getClasses = /* @__PURE__ */ __name(function(_text, diagramObj) {
|
|
797
|
-
return diagramObj.db.getClasses();
|
|
798
|
-
}, "getClasses");
|
|
799
|
-
var renderer = { draw, getClasses };
|
|
800
|
-
var defaultTreemapStyleOptions = {
|
|
801
|
-
sectionStrokeColor: "black",
|
|
802
|
-
sectionStrokeWidth: "1",
|
|
803
|
-
sectionFillColor: "#efefef",
|
|
804
|
-
leafStrokeColor: "black",
|
|
805
|
-
leafStrokeWidth: "1",
|
|
806
|
-
leafFillColor: "#efefef",
|
|
807
|
-
labelFontSize: "12px",
|
|
808
|
-
valueFontSize: "10px",
|
|
809
|
-
titleFontSize: "14px"
|
|
810
|
-
};
|
|
811
|
-
var getStyles = /* @__PURE__ */ __name(({
|
|
812
|
-
treemap: treemap2
|
|
813
|
-
} = {}) => {
|
|
814
|
-
const defaultThemeVariables = getThemeVariables3();
|
|
815
|
-
const currentConfig = getConfig();
|
|
816
|
-
const themeVariables = cleanAndMerge(defaultThemeVariables, currentConfig.themeVariables);
|
|
817
|
-
const options = cleanAndMerge(defaultTreemapStyleOptions, treemap2);
|
|
818
|
-
const titleColor = options.titleColor ?? themeVariables.titleColor;
|
|
819
|
-
const labelColor = options.labelColor ?? themeVariables.textColor;
|
|
820
|
-
const valueColor = options.valueColor ?? themeVariables.textColor;
|
|
821
|
-
return `
|
|
822
|
-
.treemapNode.section {
|
|
823
|
-
stroke: ${options.sectionStrokeColor};
|
|
824
|
-
stroke-width: ${options.sectionStrokeWidth};
|
|
825
|
-
fill: ${options.sectionFillColor};
|
|
826
|
-
}
|
|
827
|
-
.treemapNode.leaf {
|
|
828
|
-
stroke: ${options.leafStrokeColor};
|
|
829
|
-
stroke-width: ${options.leafStrokeWidth};
|
|
830
|
-
fill: ${options.leafFillColor};
|
|
831
|
-
}
|
|
832
|
-
.treemapLabel {
|
|
833
|
-
fill: ${labelColor};
|
|
834
|
-
font-size: ${options.labelFontSize};
|
|
835
|
-
}
|
|
836
|
-
.treemapValue {
|
|
837
|
-
fill: ${valueColor};
|
|
838
|
-
font-size: ${options.valueFontSize};
|
|
839
|
-
}
|
|
840
|
-
.treemapTitle {
|
|
841
|
-
fill: ${titleColor};
|
|
842
|
-
font-size: ${options.titleFontSize};
|
|
843
|
-
}
|
|
844
|
-
`;
|
|
845
|
-
}, "getStyles");
|
|
846
|
-
var styles_default = getStyles;
|
|
847
|
-
var diagram = {
|
|
848
|
-
parser,
|
|
849
|
-
get db() {
|
|
850
|
-
return new TreeMapDB();
|
|
851
|
-
},
|
|
852
|
-
renderer,
|
|
853
|
-
styles: styles_default
|
|
854
|
-
};
|
|
855
|
-
export {
|
|
856
|
-
diagram
|
|
857
|
-
};
|