@aiderdesk/aiderdesk 0.88.0 → 0.89.0
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/out/renderer/assets/2DXBBFLN-DhlZjS3f.js +666 -0
- package/out/renderer/assets/46IJ22JX-C1e8pvI2.js +853 -0
- package/out/renderer/assets/4TTDE5I4-Bea_IXhu.js +501 -0
- package/out/renderer/assets/4UF3HTLV-CVqcE2iq.js +29 -0
- package/out/renderer/assets/5THPTBWS-2mBFupjU.js +21 -0
- package/out/renderer/assets/7WLXJQOR-C8MM6Bra.js +23 -0
- package/out/renderer/assets/AAXQQPKT-BVbjBycX.js +1130 -0
- package/out/renderer/assets/AKE5O7KZ-Dr4O6i9X.js +184 -0
- package/out/renderer/assets/{AgentSettings-DffQ3g7i.js → AgentSettings-ByYnHHTv.js} +710 -255
- package/out/renderer/assets/BNMLP6AG-CHDGj3j_.js +804 -0
- package/out/renderer/assets/DKTLEL5E-Dj3316cp.js +42 -0
- package/out/renderer/assets/DR6PKOQU-C6a3Tq7K.js +301 -0
- package/out/renderer/assets/E4RJ7UJB-BQWgl9gv.js +441 -0
- package/out/renderer/assets/ELSXBIJH-CVPK3kX4.js +39 -0
- package/out/renderer/assets/ERTIBQVS-71_Ru0iJ.js +182 -0
- package/out/renderer/assets/F653G4FO-Dj2Ang6n.js +1497 -0
- package/out/renderer/assets/FKCDD66M-DCrQTwBi.js +205 -0
- package/out/renderer/assets/FP7KDXVC-DKVnH-En.js +221 -0
- package/out/renderer/assets/FT5I3RHX-hlTJy7Nw.js +243 -0
- package/out/renderer/assets/FTXIJQGB-BX14b7pN.js +13 -0
- package/out/renderer/assets/G3MDBVQH-qZ3yfAIw.js +25 -0
- package/out/renderer/assets/GY35JXOZ-cSi0MdIc.js +168 -0
- package/out/renderer/assets/H5EEJPP2-bpYW0xE8.js +353 -0
- package/out/renderer/assets/HWDLEDTA-uLGgs5fE.js +982 -0
- package/out/renderer/assets/{InfoIcon-CMLVIQF3.js → InfoIcon-DI4teJbi.js} +1 -1
- package/out/renderer/assets/JZWSX6AR-B0pkfB2b.js +67 -0
- package/out/renderer/assets/KQOEJWJY-EQFQbIDt.js +84 -0
- package/out/renderer/assets/KS3BB3KE-DclWHpbY.js +138 -0
- package/out/renderer/assets/KXJRRZHI-CHoCRoQ4.js +502 -0
- package/out/renderer/assets/MFVI5XKI-TmPyVySZ.js +10 -0
- package/out/renderer/assets/MWY2J62P-BlVjis68.js +1102 -0
- package/out/renderer/assets/MXGNCBL2-HvKcixVr.js +216 -0
- package/out/renderer/assets/N6DAJLIZ-B0JHSPS3.js +120 -0
- package/out/renderer/assets/NU5M23IW-CWgVJ5o_.js +116 -0
- package/out/renderer/assets/NV4XNBIS-uOSoaYKk.js +1221 -0
- package/out/renderer/assets/OGLU4SIR-CiNpshB1.js +289 -0
- package/out/renderer/assets/OUNS5N76-C6p0zhvm.js +1064 -0
- package/out/renderer/assets/{Onboarding-699qRMTN.js → Onboarding-Ct6-CF4Z.js} +4 -4
- package/out/renderer/assets/PU4ISKXV-BQc-2oYa.js +515 -0
- package/out/renderer/assets/PUZGS23X-Bf89SCAj.js +21 -0
- package/out/renderer/assets/{ProviderHeader-BnuGEmze.js → ProviderHeader-Buje398H.js} +2 -2
- package/out/renderer/assets/Q3IYVLG5-DbP4qs2C.js +500 -0
- package/out/renderer/assets/QYHQDLKZ-dANs6SeT.js +983 -0
- package/out/renderer/assets/RVARI57O-DMrXgtoB.js +10 -0
- package/out/renderer/assets/RZSVICHU-CeuX_9H4.js +263 -0
- package/out/renderer/assets/{SettingsPage-CLTNRnQI.js → SettingsPage-CLpPKXG1.js} +975 -845
- package/out/renderer/assets/UEXXS2NB-Bmbum3yG.js +25 -0
- package/out/renderer/assets/UHTQJXKL-C2OuiQBx.js +134 -0
- package/out/renderer/assets/URA2L2QI-DJ2BF8fn.js +201 -0
- package/out/renderer/assets/UXCHDUKG-B6wMZRAn.js +173 -0
- package/out/renderer/assets/{UsageDashboard-DRihVOqx.js → UsageDashboard-ORnsHGxF.js} +9130 -6449
- package/out/renderer/assets/VKNV3BUX-BMK4lviM.js +277 -0
- package/out/renderer/assets/VMV7XPHP-CzHnUaWh.js +127 -0
- package/out/renderer/assets/WEVWDWVA-BYWYeLxq.js +57 -0
- package/out/renderer/assets/XRRJ35LF-DaeQ2kbN.js +119 -0
- package/out/renderer/assets/YFKBLVVN-DsXlM7HO.js +990 -0
- package/out/renderer/assets/YHRE5QGZ-nB9z3NP1.js +697 -0
- package/out/renderer/assets/ZF3OVT4B-Ctn5OOBd.js +420 -0
- package/out/renderer/assets/{index-CC_7dh5L.js → index-BCaQe4ny.js} +2 -2
- package/out/renderer/assets/{index-HjbPyDJm.js → index-BD-JYQGT.js} +5 -5
- package/out/renderer/assets/{index-CBVmxCYX.js → index-BGR4ZXWZ.js} +2 -2
- package/out/renderer/assets/{index-D1Him45L.js → index-BZBhErKV.js} +2 -2
- package/out/renderer/assets/{index-DUOs3uZb.js → index-BcWszklu.js} +1 -1
- package/out/renderer/assets/{index-D1jY29Az.js → index-BpNNugm2.js} +4 -4
- package/out/renderer/assets/{index-3hl2j-_p.js → index-BrgyIQaN.js} +2 -2
- package/out/renderer/assets/{index-BJ-vdpjD.js → index-Bt1dN7k_.js} +1 -1
- package/out/renderer/assets/{index-B41U46QG.js → index-Bxu6rqm3.js} +1 -1
- package/out/renderer/assets/{index-TTgmBk0H.js → index-C6mXHxX3.js} +1 -1
- package/out/renderer/assets/{index-CNGDTtBW.js → index-CCbq90uE.js} +1 -1
- package/out/renderer/assets/{index-4IKrE3Ch.js → index-CCm3UXZP.js} +2 -2
- package/out/renderer/assets/{index-CY4zeK5l.js → index-CNkiGtsK.js} +3 -3
- package/out/renderer/assets/{index-ly0cB32v.css → index-CWfnJXNI.css} +116 -0
- package/out/renderer/assets/{index-DZ8Tuuit.js → index-Cc-He418.js} +29267 -54630
- package/out/renderer/assets/{index-Otcl72On.js → index-Crdzxx6k.js} +19 -15
- package/out/renderer/assets/{index-Z7VaFhjR.js → index-D30k3y98.js} +1 -1
- package/out/renderer/assets/{index-Bv8Yvnki.js → index-DAWoHfjM.js} +2 -2
- package/out/renderer/assets/{index-tkTKXqGX.js → index-DG5AIC6J.js} +3 -3
- package/out/renderer/assets/{index-DHZvdQmh.js → index-DSBgCNMv.js} +2 -2
- package/out/renderer/assets/{index-D2Y9BB9n.js → index-DeRKeskE.js} +5 -5
- package/out/renderer/assets/{index-Dq8m0XiD.js → index-DgQEgdew.js} +2 -2
- package/out/renderer/assets/{index-BeF6VrSe.js → index-Dgdp4i2K.js} +1 -1
- package/out/renderer/assets/{index--DpoC2Fa.js → index-DnNK6R2g.js} +2 -2
- package/out/renderer/assets/{index-vBiBurKH.js → index-DrNutodm.js} +2 -2
- package/out/renderer/assets/{index-DTwId9nn.js → index-FS3mY8Ct.js} +1 -1
- package/out/renderer/assets/{index-DBHj35Nq.js → index-KId2jLzt.js} +2 -2
- package/out/renderer/assets/{index-BFLm6WFt.js → index-PyRCX6hq.js} +5 -5
- package/out/renderer/assets/{index-8-JzmzqC.js → index-U8nE80jx.js} +2 -2
- package/out/renderer/assets/{index-BhXi7Le_.js → index-Vw8jKJU_.js} +5 -5
- package/out/renderer/assets/{index-CnxPOcjf.js → index-_a6zbU-0.js} +1 -1
- package/out/renderer/assets/{index-BSh2X31_.js → index-dsqlqRSG.js} +5 -5
- package/out/renderer/assets/{index-C-WEDvyw.js → index-rQL1hwaP.js} +5 -5
- package/out/renderer/assets/{jsx-dev-runtime-DshTpFeb.js → jsx-dev-runtime-Bwt8d4vP.js} +1 -1
- package/out/renderer/index.html +2 -2
- package/out/resources/prompts/system-prompt.hbs +11 -0
- package/out/resources/skills/extension-creator/SKILL.md +20 -1
- package/out/resources/skills/extension-creator/references/event-types.md +3 -3
- package/out/resources/skills/extension-creator/references/extension-interface.md +52 -0
- package/out/resources/skills/extension-creator/references/external-agent-providers.md +90 -0
- package/out/runner.js +1456 -182
- package/package.json +2 -2
- package/out/renderer/assets/abnfDiagram-N423BO3Z-D0STbTTF.js +0 -118
- package/out/renderer/assets/arc-DeFSKBzy.js +0 -131
- package/out/renderer/assets/architectureDiagram-T3A2C74G-BDrfxwK6.js +0 -8829
- package/out/renderer/assets/band-zXq5o_Ib.js +0 -77
- package/out/renderer/assets/blockDiagram-VBNYF7ZC-x_YF9Yme.js +0 -3824
- package/out/renderer/assets/c4Diagram-5PPSVZJV-C7kuvNRf.js +0 -2482
- package/out/renderer/assets/channel-T97-CMvj.js +0 -7
- package/out/renderer/assets/chunk-2GRJ4B5K-C7nbnxgH.js +0 -116
- package/out/renderer/assets/chunk-2Q5K7J3B-D5IUyzX4.js +0 -19
- package/out/renderer/assets/chunk-5RXB4S5H-DkL2I1-Q.js +0 -1988
- package/out/renderer/assets/chunk-5VM5RSS4-qszW8EYL.js +0 -19
- package/out/renderer/assets/chunk-6Q2QTUOP-CbtMo4y_.js +0 -860
- package/out/renderer/assets/chunk-GF5L2VYU-C6qdgHXJ.js +0 -2026
- package/out/renderer/assets/chunk-JWPE2WC7-DxAg7bLn.js +0 -16
- package/out/renderer/assets/chunk-KBJHAD2P-Cqd2HDdS.js +0 -24
- package/out/renderer/assets/chunk-RYQCIY6F-DVzbqgRf.js +0 -474
- package/out/renderer/assets/chunk-XXDRQBXY-DF_8pbWI.js +0 -13
- package/out/renderer/assets/classDiagram-JCYQIIEL-MfTsDS5w.js +0 -23
- package/out/renderer/assets/classDiagram-v2-OCEON4UE-MfTsDS5w.js +0 -23
- package/out/renderer/assets/cose-bilkent-JH36ORCC-BvzyW9fn.js +0 -4942
- package/out/renderer/assets/cynefin-VYW2F7L2-BmRenSSB.js +0 -32093
- package/out/renderer/assets/cynefinDiagram-MW4NZA55-DmybMaTR.js +0 -453
- package/out/renderer/assets/cytoscape.esm-Bx_1tVW-.js +0 -30332
- package/out/renderer/assets/dagre-VZM6K2ZE-b6plu1_t.js +0 -522
- package/out/renderer/assets/defaultLocale-B2RvLBDe.js +0 -206
- package/out/renderer/assets/diagram-7IWD3JNH-B0LyLNK-.js +0 -488
- package/out/renderer/assets/diagram-B4RE2ZJO-BtJGLH72.js +0 -632
- package/out/renderer/assets/diagram-LBJQPF4R-BpSykW90.js +0 -212
- package/out/renderer/assets/diagram-Q27KOJAE-_vw0jdNl.js +0 -857
- package/out/renderer/assets/diagram-UB23O5K3-rE12zYQ8.js +0 -311
- package/out/renderer/assets/ebnfDiagram-BXEA7PRR-BXR1_d_o.js +0 -138
- package/out/renderer/assets/erDiagram-JOGREHBK-B1QCAGl4.js +0 -1238
- package/out/renderer/assets/flowDiagram-UKHOOZJN-wRfN63to.js +0 -2348
- package/out/renderer/assets/ganttDiagram-PKOTCBZU-DsXpzatp.js +0 -2782
- package/out/renderer/assets/gitGraphDiagram-DS77QQ5N-CsYsZ42q.js +0 -1373
- package/out/renderer/assets/graph-CfUL5tFv.js +0 -1308
- package/out/renderer/assets/infoDiagram-6WML65LV-BXT6TYnf.js +0 -31
- package/out/renderer/assets/init-CTO7spbL.js +0 -35
- package/out/renderer/assets/ishikawaDiagram-WSZJBQD7-6BJ687Ec.js +0 -967
- package/out/renderer/assets/journeyDiagram-NVQOT4AX-HgkRlCT0.js +0 -1255
- package/out/renderer/assets/kanban-definition-27J2QSJJ-COYri25f.js +0 -1052
- package/out/renderer/assets/layout-BBVpFPy1.js +0 -2326
- package/out/renderer/assets/linear-DuNIFrPi.js +0 -361
- package/out/renderer/assets/map-toxJVbdU.js +0 -299
- package/out/renderer/assets/mindmap-definition-FAOFIHXS-DhCEcxPL.js +0 -1153
- package/out/renderer/assets/ordinal-BD3Y6v77.js +0 -77
- package/out/renderer/assets/pegDiagram-VL7TDLO6-DZ8w3ViJ.js +0 -126
- package/out/renderer/assets/pieDiagram-7S7Q4E2Y-JcEYE_Dn.js +0 -316
- package/out/renderer/assets/quadrantDiagram-CIZ2JOQS-De59Sk4l.js +0 -1343
- package/out/renderer/assets/railroadDiagram-AXF67PYL-D7nWbE5S.js +0 -92
- package/out/renderer/assets/requirementDiagram-LRYGKXZP-DKWcKu7I.js +0 -1204
- package/out/renderer/assets/sankeyDiagram-W5VNT64P-Bj8jLitx.js +0 -1274
- package/out/renderer/assets/sequenceDiagram-SI44F4Z6-D9Jp65xC.js +0 -4514
- package/out/renderer/assets/sizeCapture-X5ZJPWSS-mY9H2lE6.js +0 -62
- package/out/renderer/assets/stateDiagram-OKZ733FA-BEn9ud4k.js +0 -452
- package/out/renderer/assets/stateDiagram-v2-UEYNNEHI-D_psrMs3.js +0 -22
- package/out/renderer/assets/swimlanes-SLNWSIFB-BMcpfWEi.js +0 -8557
- package/out/renderer/assets/swimlanesDiagram-ULZ7WXOC-OwdbT2xV.js +0 -20
- package/out/renderer/assets/time-DMe8nTku.js +0 -985
- package/out/renderer/assets/timeline-definition-Z64GVDOM-BTi-OvtJ.js +0 -1596
- package/out/renderer/assets/vennDiagram-T6HMQDX7-CoxSnB7W.js +0 -2515
- package/out/renderer/assets/wardleyDiagram-T6FBY63Y-Dj0FNpwr.js +0 -975
- package/out/renderer/assets/xychartDiagram-ELKLHX3M-jVSDR4Ov.js +0 -1943
|
@@ -1,857 +0,0 @@
|
|
|
1
|
-
import { p as populateCommonDb } from "./chunk-JWPE2WC7-DxAg7bLn.js";
|
|
2
|
-
import { _ as __name, ao as getThemeVariables3, a3 as getConfig, a5 as cleanAndMerge, a8 as selectSvgElement, B as configureSvgSize, A as log, dd as styles2String, z as select, x as setAccTitle, w as getAccTitle, V as setDiagramTitle, W as getDiagramTitle, v as getAccDescription, u as setAccDescription, a6 as defaultConfig_default, de as isLabelStyle, X as clear } from "./index-DZ8Tuuit.js";
|
|
3
|
-
import { s as setupViewPortForSVG } from "./chunk-KBJHAD2P-Cqd2HDdS.js";
|
|
4
|
-
import { p as parse } from "./cynefin-VYW2F7L2-BmRenSSB.js";
|
|
5
|
-
import { b as format } from "./defaultLocale-B2RvLBDe.js";
|
|
6
|
-
import { o as ordinal } from "./ordinal-BD3Y6v77.js";
|
|
7
|
-
import "./init-CTO7spbL.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
|
-
};
|