@webskill/sdk 0.21.0 → 0.22.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/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
- package/dist/agent.d.ts +3 -3
- package/dist/agent.js +1012 -130
- package/dist/{approval-DwN2o2QG.js → approval-DWQlDPbY.js} +102 -16
- package/dist/arc-8U_6NQWm.js +130 -0
- package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
- package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
- package/dist/array-DQfpQNY8.js +8 -0
- package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
- package/dist/browser.d.ts +444 -48
- package/dist/browser.js +1771 -91
- package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
- package/dist/channel-CZxxLrG7.js +9 -0
- package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
- package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
- package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
- package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
- package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
- package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
- package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
- package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
- package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
- package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
- package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
- package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
- package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
- package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
- package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
- package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
- package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
- package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
- package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
- package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
- package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
- package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
- package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
- package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
- package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
- package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
- package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
- package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
- package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
- package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
- package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
- package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
- package/dist/defaultLocale-B_EoOkSF.js +249 -0
- package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
- package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
- package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
- package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
- package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
- package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
- package/dist/dist-UajCDt3n.js +92 -0
- package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
- package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
- package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
- package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
- package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
- package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
- package/dist/{toolSource-C9oNuKmr.js → geometry-wx5ZTYzi.js} +162 -12
- package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
- package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
- package/dist/governance.d.ts +3 -3
- package/dist/graphlib-tk9gQYuN.js +4194 -0
- package/dist/{index-B8Tgmpwh.d.ts → index-BiO9_XRk.d.ts} +2 -2
- package/dist/{index-CYLt5u4L.d.ts → index-CjwdZQOS.d.ts} +700 -12
- package/dist/{index-DHopiH_m.d.ts → index-YPd8ZSEa.d.ts} +156 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -6
- package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
- package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
- package/dist/init-CMOIWdg-.js +16 -0
- package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
- package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
- package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
- package/dist/katex-BcRRvyh_.js +26465 -0
- package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
- package/dist/line-LgV8iVMV.js +48 -0
- package/dist/linear-BWKR0Tqd.js +393 -0
- package/dist/linkedDocument-CIuh_Yp0.js +416 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
- package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
- package/dist/mermaid.core-DMtwGCHy.js +1756 -0
- package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
- package/dist/node.d.ts +3 -3
- package/dist/node.js +2 -2
- package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
- package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
- package/dist/ordinal-CxA6GHQS.js +84 -0
- package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
- package/dist/path-C27Z2Bjv.js +106 -0
- package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
- package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
- package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
- package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
- package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
- package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
- package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
- package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
- package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
- package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
- package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
- package/dist/rough.cjs-AmDd_NQk.js +1395 -0
- package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
- package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
- package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
- package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-B24Jjjry-BY1H7Krp.d.ts} +1 -1
- package/dist/src-NkhI3UMl.js +2653 -0
- package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
- package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
- package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
- package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
- package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
- package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BM5FI9oN.d.ts} +59 -8
- package/dist/ui-react.d.ts +3 -3
- package/dist/ui-react.js +3718 -77
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
- package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
- package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
- package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
- package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-Dy-Zjv0y.js} +1 -1
- package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
- package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
- package/package.json +1 -1
- package/dist/linkedDocument-C0gj1sMq.js +0 -245
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
import { n as parse } from "./mermaid-parser.core-pYR5siSx.js";
|
|
2
|
+
import { n as __name } from "./chunk-Y2CYZVJY-U3QOMqrW.js";
|
|
3
|
+
import { m as log, p as select_default } from "./src-NkhI3UMl.js";
|
|
4
|
+
import { D as getThemeVariables3, H as setAccDescription, U as setAccTitle, a as clear, b as getConfig, c as configureSvgSize, f as defaultConfig_default, q as setDiagramTitle, v as getAccDescription, w as getDiagramTitle, y as getAccTitle } from "./chunk-O7XYJQB3-B6K0KOSL.js";
|
|
5
|
+
import { t as ordinal } from "./ordinal-CxA6GHQS.js";
|
|
6
|
+
import { t as format } from "./defaultLocale-B_EoOkSF.js";
|
|
7
|
+
import { i as cleanAndMerge } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
|
|
8
|
+
import { t as selectSvgElement } from "./chunk-6AEJRKK7-JXK89I-O.js";
|
|
9
|
+
import { t as populateCommonDb } from "./chunk-JWPE2WC7-D1rC79GS.js";
|
|
10
|
+
import { i as styles2String, n as isLabelStyle } from "./chunk-7PRAP22T-BHED6GVs.js";
|
|
11
|
+
import { t as setupViewPortForSVG } from "./chunk-WEXAMYUT-Ba6jFWhB.js";
|
|
12
|
+
|
|
13
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/count.js
|
|
14
|
+
function count(node) {
|
|
15
|
+
var sum = 0, children = node.children, i = children && children.length;
|
|
16
|
+
if (!i) sum = 1;
|
|
17
|
+
else while (--i >= 0) sum += children[i].value;
|
|
18
|
+
node.value = sum;
|
|
19
|
+
}
|
|
20
|
+
function count_default() {
|
|
21
|
+
return this.eachAfter(count);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/each.js
|
|
26
|
+
function each_default(callback, that) {
|
|
27
|
+
let index = -1;
|
|
28
|
+
for (const node of this) callback.call(that, node, ++index, this);
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js
|
|
34
|
+
function eachBefore_default(callback, that) {
|
|
35
|
+
var node = this, nodes = [node], children, i, index = -1;
|
|
36
|
+
while (node = nodes.pop()) {
|
|
37
|
+
callback.call(that, node, ++index, this);
|
|
38
|
+
if (children = node.children) for (i = children.length - 1; i >= 0; --i) nodes.push(children[i]);
|
|
39
|
+
}
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js
|
|
45
|
+
function eachAfter_default(callback, that) {
|
|
46
|
+
var node = this, nodes = [node], next = [], children, i, n, index = -1;
|
|
47
|
+
while (node = nodes.pop()) {
|
|
48
|
+
next.push(node);
|
|
49
|
+
if (children = node.children) for (i = 0, n = children.length; i < n; ++i) nodes.push(children[i]);
|
|
50
|
+
}
|
|
51
|
+
while (node = next.pop()) callback.call(that, node, ++index, this);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/find.js
|
|
57
|
+
function find_default(callback, that) {
|
|
58
|
+
let index = -1;
|
|
59
|
+
for (const node of this) if (callback.call(that, node, ++index, this)) return node;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sum.js
|
|
64
|
+
function sum_default(value) {
|
|
65
|
+
return this.eachAfter(function(node) {
|
|
66
|
+
var sum = +value(node.data) || 0, children = node.children, i = children && children.length;
|
|
67
|
+
while (--i >= 0) sum += children[i].value;
|
|
68
|
+
node.value = sum;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/sort.js
|
|
74
|
+
function sort_default(compare) {
|
|
75
|
+
return this.eachBefore(function(node) {
|
|
76
|
+
if (node.children) node.children.sort(compare);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/path.js
|
|
82
|
+
function path_default(end) {
|
|
83
|
+
var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start];
|
|
84
|
+
while (start !== ancestor) {
|
|
85
|
+
start = start.parent;
|
|
86
|
+
nodes.push(start);
|
|
87
|
+
}
|
|
88
|
+
var k = nodes.length;
|
|
89
|
+
while (end !== ancestor) {
|
|
90
|
+
nodes.splice(k, 0, end);
|
|
91
|
+
end = end.parent;
|
|
92
|
+
}
|
|
93
|
+
return nodes;
|
|
94
|
+
}
|
|
95
|
+
function leastCommonAncestor(a, b) {
|
|
96
|
+
if (a === b) return a;
|
|
97
|
+
var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null;
|
|
98
|
+
a = aNodes.pop();
|
|
99
|
+
b = bNodes.pop();
|
|
100
|
+
while (a === b) {
|
|
101
|
+
c = a;
|
|
102
|
+
a = aNodes.pop();
|
|
103
|
+
b = bNodes.pop();
|
|
104
|
+
}
|
|
105
|
+
return c;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/ancestors.js
|
|
110
|
+
function ancestors_default() {
|
|
111
|
+
var node = this, nodes = [node];
|
|
112
|
+
while (node = node.parent) nodes.push(node);
|
|
113
|
+
return nodes;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/descendants.js
|
|
118
|
+
function descendants_default() {
|
|
119
|
+
return Array.from(this);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/leaves.js
|
|
124
|
+
function leaves_default() {
|
|
125
|
+
var leaves = [];
|
|
126
|
+
this.eachBefore(function(node) {
|
|
127
|
+
if (!node.children) leaves.push(node);
|
|
128
|
+
});
|
|
129
|
+
return leaves;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/links.js
|
|
134
|
+
function links_default() {
|
|
135
|
+
var root = this, links = [];
|
|
136
|
+
root.each(function(node) {
|
|
137
|
+
if (node !== root) links.push({
|
|
138
|
+
source: node.parent,
|
|
139
|
+
target: node
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
return links;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/iterator.js
|
|
147
|
+
function* iterator_default() {
|
|
148
|
+
var node = this, current, next = [node], children, i, n;
|
|
149
|
+
do {
|
|
150
|
+
current = next.reverse(), next = [];
|
|
151
|
+
while (node = current.pop()) {
|
|
152
|
+
yield node;
|
|
153
|
+
if (children = node.children) for (i = 0, n = children.length; i < n; ++i) next.push(children[i]);
|
|
154
|
+
}
|
|
155
|
+
} while (next.length);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/hierarchy/index.js
|
|
160
|
+
function hierarchy(data, children) {
|
|
161
|
+
if (data instanceof Map) {
|
|
162
|
+
data = [void 0, data];
|
|
163
|
+
if (children === void 0) children = mapChildren;
|
|
164
|
+
} else if (children === void 0) children = objectChildren;
|
|
165
|
+
var root = new Node(data), node, nodes = [root], child, childs, i, n;
|
|
166
|
+
while (node = nodes.pop()) if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {
|
|
167
|
+
node.children = childs;
|
|
168
|
+
for (i = n - 1; i >= 0; --i) {
|
|
169
|
+
nodes.push(child = childs[i] = new Node(childs[i]));
|
|
170
|
+
child.parent = node;
|
|
171
|
+
child.depth = node.depth + 1;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return root.eachBefore(computeHeight);
|
|
175
|
+
}
|
|
176
|
+
function node_copy() {
|
|
177
|
+
return hierarchy(this).eachBefore(copyData);
|
|
178
|
+
}
|
|
179
|
+
function objectChildren(d) {
|
|
180
|
+
return d.children;
|
|
181
|
+
}
|
|
182
|
+
function mapChildren(d) {
|
|
183
|
+
return Array.isArray(d) ? d[1] : null;
|
|
184
|
+
}
|
|
185
|
+
function copyData(node) {
|
|
186
|
+
if (node.data.value !== void 0) node.value = node.data.value;
|
|
187
|
+
node.data = node.data.data;
|
|
188
|
+
}
|
|
189
|
+
function computeHeight(node) {
|
|
190
|
+
var height = 0;
|
|
191
|
+
do
|
|
192
|
+
node.height = height;
|
|
193
|
+
while ((node = node.parent) && node.height < ++height);
|
|
194
|
+
}
|
|
195
|
+
function Node(data) {
|
|
196
|
+
this.data = data;
|
|
197
|
+
this.depth = this.height = 0;
|
|
198
|
+
this.parent = null;
|
|
199
|
+
}
|
|
200
|
+
Node.prototype = hierarchy.prototype = {
|
|
201
|
+
constructor: Node,
|
|
202
|
+
count: count_default,
|
|
203
|
+
each: each_default,
|
|
204
|
+
eachAfter: eachAfter_default,
|
|
205
|
+
eachBefore: eachBefore_default,
|
|
206
|
+
find: find_default,
|
|
207
|
+
sum: sum_default,
|
|
208
|
+
sort: sort_default,
|
|
209
|
+
path: path_default,
|
|
210
|
+
ancestors: ancestors_default,
|
|
211
|
+
descendants: descendants_default,
|
|
212
|
+
leaves: leaves_default,
|
|
213
|
+
links: links_default,
|
|
214
|
+
copy: node_copy,
|
|
215
|
+
[Symbol.iterator]: iterator_default
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/accessors.js
|
|
220
|
+
function required(f) {
|
|
221
|
+
if (typeof f !== "function") throw new Error();
|
|
222
|
+
return f;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/constant.js
|
|
227
|
+
function constantZero() {
|
|
228
|
+
return 0;
|
|
229
|
+
}
|
|
230
|
+
function constant_default(x) {
|
|
231
|
+
return function() {
|
|
232
|
+
return x;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/round.js
|
|
238
|
+
function round_default(node) {
|
|
239
|
+
node.x0 = Math.round(node.x0);
|
|
240
|
+
node.y0 = Math.round(node.y0);
|
|
241
|
+
node.x1 = Math.round(node.x1);
|
|
242
|
+
node.y1 = Math.round(node.y1);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/dice.js
|
|
247
|
+
function dice_default(parent, x0, y0, x1, y1) {
|
|
248
|
+
var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value;
|
|
249
|
+
while (++i < n) {
|
|
250
|
+
node = nodes[i], node.y0 = y0, node.y1 = y1;
|
|
251
|
+
node.x0 = x0, node.x1 = x0 += node.value * k;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/slice.js
|
|
257
|
+
function slice_default(parent, x0, y0, x1, y1) {
|
|
258
|
+
var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value;
|
|
259
|
+
while (++i < n) {
|
|
260
|
+
node = nodes[i], node.x0 = x0, node.x1 = x1;
|
|
261
|
+
node.y0 = y0, node.y1 = y0 += node.value * k;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/squarify.js
|
|
267
|
+
var phi = (1 + Math.sqrt(5)) / 2;
|
|
268
|
+
function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
|
|
269
|
+
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;
|
|
270
|
+
while (i0 < n) {
|
|
271
|
+
dx = x1 - x0, dy = y1 - y0;
|
|
272
|
+
do
|
|
273
|
+
sumValue = nodes[i1++].value;
|
|
274
|
+
while (!sumValue && i1 < n);
|
|
275
|
+
minValue = maxValue = sumValue;
|
|
276
|
+
alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
|
|
277
|
+
beta = sumValue * sumValue * alpha;
|
|
278
|
+
minRatio = Math.max(maxValue / beta, beta / minValue);
|
|
279
|
+
for (; i1 < n; ++i1) {
|
|
280
|
+
sumValue += nodeValue = nodes[i1].value;
|
|
281
|
+
if (nodeValue < minValue) minValue = nodeValue;
|
|
282
|
+
if (nodeValue > maxValue) maxValue = nodeValue;
|
|
283
|
+
beta = sumValue * sumValue * alpha;
|
|
284
|
+
newRatio = Math.max(maxValue / beta, beta / minValue);
|
|
285
|
+
if (newRatio > minRatio) {
|
|
286
|
+
sumValue -= nodeValue;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
minRatio = newRatio;
|
|
290
|
+
}
|
|
291
|
+
rows.push(row = {
|
|
292
|
+
value: sumValue,
|
|
293
|
+
dice: dx < dy,
|
|
294
|
+
children: nodes.slice(i0, i1)
|
|
295
|
+
});
|
|
296
|
+
if (row.dice) dice_default(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
|
|
297
|
+
else slice_default(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
|
|
298
|
+
value -= sumValue, i0 = i1;
|
|
299
|
+
}
|
|
300
|
+
return rows;
|
|
301
|
+
}
|
|
302
|
+
var squarify_default = (function custom(ratio) {
|
|
303
|
+
function squarify(parent, x0, y0, x1, y1) {
|
|
304
|
+
squarifyRatio(ratio, parent, x0, y0, x1, y1);
|
|
305
|
+
}
|
|
306
|
+
squarify.ratio = function(x) {
|
|
307
|
+
return custom((x = +x) > 1 ? x : 1);
|
|
308
|
+
};
|
|
309
|
+
return squarify;
|
|
310
|
+
})(phi);
|
|
311
|
+
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region ../../node_modules/.pnpm/d3-hierarchy@3.1.2/node_modules/d3-hierarchy/src/treemap/index.js
|
|
314
|
+
function treemap_default() {
|
|
315
|
+
var tile = squarify_default, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;
|
|
316
|
+
function treemap(root) {
|
|
317
|
+
root.x0 = root.y0 = 0;
|
|
318
|
+
root.x1 = dx;
|
|
319
|
+
root.y1 = dy;
|
|
320
|
+
root.eachBefore(positionNode);
|
|
321
|
+
paddingStack = [0];
|
|
322
|
+
if (round) root.eachBefore(round_default);
|
|
323
|
+
return root;
|
|
324
|
+
}
|
|
325
|
+
function positionNode(node) {
|
|
326
|
+
var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p;
|
|
327
|
+
if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
|
|
328
|
+
if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
|
|
329
|
+
node.x0 = x0;
|
|
330
|
+
node.y0 = y0;
|
|
331
|
+
node.x1 = x1;
|
|
332
|
+
node.y1 = y1;
|
|
333
|
+
if (node.children) {
|
|
334
|
+
p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
|
|
335
|
+
x0 += paddingLeft(node) - p;
|
|
336
|
+
y0 += paddingTop(node) - p;
|
|
337
|
+
x1 -= paddingRight(node) - p;
|
|
338
|
+
y1 -= paddingBottom(node) - p;
|
|
339
|
+
if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
|
|
340
|
+
if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
|
|
341
|
+
tile(node, x0, y0, x1, y1);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
treemap.round = function(x) {
|
|
345
|
+
return arguments.length ? (round = !!x, treemap) : round;
|
|
346
|
+
};
|
|
347
|
+
treemap.size = function(x) {
|
|
348
|
+
return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];
|
|
349
|
+
};
|
|
350
|
+
treemap.tile = function(x) {
|
|
351
|
+
return arguments.length ? (tile = required(x), treemap) : tile;
|
|
352
|
+
};
|
|
353
|
+
treemap.padding = function(x) {
|
|
354
|
+
return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
|
|
355
|
+
};
|
|
356
|
+
treemap.paddingInner = function(x) {
|
|
357
|
+
return arguments.length ? (paddingInner = typeof x === "function" ? x : constant_default(+x), treemap) : paddingInner;
|
|
358
|
+
};
|
|
359
|
+
treemap.paddingOuter = function(x) {
|
|
360
|
+
return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
|
|
361
|
+
};
|
|
362
|
+
treemap.paddingTop = function(x) {
|
|
363
|
+
return arguments.length ? (paddingTop = typeof x === "function" ? x : constant_default(+x), treemap) : paddingTop;
|
|
364
|
+
};
|
|
365
|
+
treemap.paddingRight = function(x) {
|
|
366
|
+
return arguments.length ? (paddingRight = typeof x === "function" ? x : constant_default(+x), treemap) : paddingRight;
|
|
367
|
+
};
|
|
368
|
+
treemap.paddingBottom = function(x) {
|
|
369
|
+
return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant_default(+x), treemap) : paddingBottom;
|
|
370
|
+
};
|
|
371
|
+
treemap.paddingLeft = function(x) {
|
|
372
|
+
return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant_default(+x), treemap) : paddingLeft;
|
|
373
|
+
};
|
|
374
|
+
return treemap;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/diagram-3UASUU5V.mjs
|
|
379
|
+
var TreeMapDB = class {
|
|
380
|
+
constructor() {
|
|
381
|
+
this.nodes = [];
|
|
382
|
+
this.levels = /* @__PURE__ */ new Map();
|
|
383
|
+
this.outerNodes = [];
|
|
384
|
+
this.classes = /* @__PURE__ */ new Map();
|
|
385
|
+
this.setAccTitle = setAccTitle;
|
|
386
|
+
this.getAccTitle = getAccTitle;
|
|
387
|
+
this.setDiagramTitle = setDiagramTitle;
|
|
388
|
+
this.getDiagramTitle = getDiagramTitle;
|
|
389
|
+
this.getAccDescription = getAccDescription;
|
|
390
|
+
this.setAccDescription = setAccDescription;
|
|
391
|
+
}
|
|
392
|
+
static {
|
|
393
|
+
__name(this, "TreeMapDB");
|
|
394
|
+
}
|
|
395
|
+
getNodes() {
|
|
396
|
+
return this.nodes;
|
|
397
|
+
}
|
|
398
|
+
getConfig() {
|
|
399
|
+
const defaultConfig = defaultConfig_default;
|
|
400
|
+
const userConfig = getConfig();
|
|
401
|
+
return cleanAndMerge({
|
|
402
|
+
...defaultConfig.treemap,
|
|
403
|
+
...userConfig.treemap ?? {}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
addNode(node, level) {
|
|
407
|
+
this.nodes.push(node);
|
|
408
|
+
this.levels.set(node, level);
|
|
409
|
+
if (level === 0) {
|
|
410
|
+
this.outerNodes.push(node);
|
|
411
|
+
this.root ??= node;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
getRoot() {
|
|
415
|
+
return {
|
|
416
|
+
name: "",
|
|
417
|
+
children: this.outerNodes
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
addClass(id, _style) {
|
|
421
|
+
const styleClass = this.classes.get(id) ?? {
|
|
422
|
+
id,
|
|
423
|
+
styles: [],
|
|
424
|
+
textStyles: []
|
|
425
|
+
};
|
|
426
|
+
const styles = _style.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
|
|
427
|
+
if (styles) styles.forEach((s) => {
|
|
428
|
+
if (isLabelStyle(s)) if (styleClass?.textStyles) styleClass.textStyles.push(s);
|
|
429
|
+
else styleClass.textStyles = [s];
|
|
430
|
+
if (styleClass?.styles) styleClass.styles.push(s);
|
|
431
|
+
else styleClass.styles = [s];
|
|
432
|
+
});
|
|
433
|
+
this.classes.set(id, styleClass);
|
|
434
|
+
}
|
|
435
|
+
getClasses() {
|
|
436
|
+
return this.classes;
|
|
437
|
+
}
|
|
438
|
+
getStylesForClass(classSelector) {
|
|
439
|
+
return this.classes.get(classSelector)?.styles ?? [];
|
|
440
|
+
}
|
|
441
|
+
clear() {
|
|
442
|
+
clear();
|
|
443
|
+
this.nodes = [];
|
|
444
|
+
this.levels = /* @__PURE__ */ new Map();
|
|
445
|
+
this.outerNodes = [];
|
|
446
|
+
this.classes = /* @__PURE__ */ new Map();
|
|
447
|
+
this.root = void 0;
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
function buildHierarchy(items) {
|
|
451
|
+
if (!items.length) return [];
|
|
452
|
+
const root = [];
|
|
453
|
+
const stack = [];
|
|
454
|
+
items.forEach((item) => {
|
|
455
|
+
const node = {
|
|
456
|
+
name: item.name,
|
|
457
|
+
children: item.type === "Leaf" ? void 0 : []
|
|
458
|
+
};
|
|
459
|
+
node.classSelector = item?.classSelector;
|
|
460
|
+
if (item?.cssCompiledStyles) node.cssCompiledStyles = item.cssCompiledStyles;
|
|
461
|
+
if (item.type === "Leaf" && item.value !== void 0) node.value = item.value;
|
|
462
|
+
while (stack.length > 0 && stack[stack.length - 1].level >= item.level) stack.pop();
|
|
463
|
+
if (stack.length === 0) root.push(node);
|
|
464
|
+
else {
|
|
465
|
+
const parent = stack[stack.length - 1].node;
|
|
466
|
+
if (parent.children) parent.children.push(node);
|
|
467
|
+
else parent.children = [node];
|
|
468
|
+
}
|
|
469
|
+
if (item.type !== "Leaf") stack.push({
|
|
470
|
+
node,
|
|
471
|
+
level: item.level
|
|
472
|
+
});
|
|
473
|
+
});
|
|
474
|
+
return root;
|
|
475
|
+
}
|
|
476
|
+
__name(buildHierarchy, "buildHierarchy");
|
|
477
|
+
var populate = /* @__PURE__ */ __name((ast, db) => {
|
|
478
|
+
populateCommonDb(ast, db);
|
|
479
|
+
const items = [];
|
|
480
|
+
for (const row of ast.TreemapRows ?? []) if (row.$type === "ClassDefStatement") db.addClass(row.className ?? "", row.styleText ?? "");
|
|
481
|
+
for (const row of ast.TreemapRows ?? []) {
|
|
482
|
+
const item = row.item;
|
|
483
|
+
if (!item) continue;
|
|
484
|
+
const level = row.indent ? parseInt(row.indent) : 0;
|
|
485
|
+
const name = getItemName(item);
|
|
486
|
+
const styles = item.classSelector ? db.getStylesForClass(item.classSelector) : [];
|
|
487
|
+
const cssCompiledStyles = styles.length > 0 ? styles : void 0;
|
|
488
|
+
const itemData = {
|
|
489
|
+
level,
|
|
490
|
+
name,
|
|
491
|
+
type: item.$type,
|
|
492
|
+
value: item.value,
|
|
493
|
+
classSelector: item.classSelector,
|
|
494
|
+
cssCompiledStyles
|
|
495
|
+
};
|
|
496
|
+
items.push(itemData);
|
|
497
|
+
}
|
|
498
|
+
const hierarchyNodes = buildHierarchy(items);
|
|
499
|
+
const addNodesRecursively = /* @__PURE__ */ __name((nodes, level) => {
|
|
500
|
+
for (const node of nodes) {
|
|
501
|
+
db.addNode(node, level);
|
|
502
|
+
if (node.children && node.children.length > 0) addNodesRecursively(node.children, level + 1);
|
|
503
|
+
}
|
|
504
|
+
}, "addNodesRecursively");
|
|
505
|
+
addNodesRecursively(hierarchyNodes, 0);
|
|
506
|
+
}, "populate");
|
|
507
|
+
var getItemName = /* @__PURE__ */ __name((item) => {
|
|
508
|
+
return item.name ? String(item.name) : "";
|
|
509
|
+
}, "getItemName");
|
|
510
|
+
var parser = {
|
|
511
|
+
parser: { yy: void 0 },
|
|
512
|
+
parse: /* @__PURE__ */ __name(async (text) => {
|
|
513
|
+
try {
|
|
514
|
+
const ast = await parse("treemap", text);
|
|
515
|
+
log.debug("Treemap AST:", ast);
|
|
516
|
+
const db = parser.parser?.yy;
|
|
517
|
+
if (!(db instanceof TreeMapDB)) throw new Error("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.");
|
|
518
|
+
populate(ast, db);
|
|
519
|
+
} catch (error) {
|
|
520
|
+
log.error("Error parsing treemap:", error);
|
|
521
|
+
throw error;
|
|
522
|
+
}
|
|
523
|
+
}, "parse")
|
|
524
|
+
};
|
|
525
|
+
var DEFAULT_INNER_PADDING = 10;
|
|
526
|
+
var SECTION_INNER_PADDING = 10;
|
|
527
|
+
var SECTION_HEADER_HEIGHT = 25;
|
|
528
|
+
var renderer = {
|
|
529
|
+
draw: /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
|
|
530
|
+
const treemapDb = diagram2.db;
|
|
531
|
+
const config = treemapDb.getConfig();
|
|
532
|
+
const treemapInnerPadding = config.padding ?? DEFAULT_INNER_PADDING;
|
|
533
|
+
const title = treemapDb.getDiagramTitle();
|
|
534
|
+
const root = treemapDb.getRoot();
|
|
535
|
+
const { themeVariables } = getConfig();
|
|
536
|
+
if (!root) return;
|
|
537
|
+
const titleHeight = title ? 30 : 0;
|
|
538
|
+
const svg = selectSvgElement(id);
|
|
539
|
+
const width = config.nodeWidth ? config.nodeWidth * SECTION_INNER_PADDING : 960;
|
|
540
|
+
const height = config.nodeHeight ? config.nodeHeight * SECTION_INNER_PADDING : 500;
|
|
541
|
+
const svgWidth = width;
|
|
542
|
+
const svgHeight = height + titleHeight;
|
|
543
|
+
svg.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
|
|
544
|
+
configureSvgSize(svg, svgHeight, svgWidth, config.useMaxWidth);
|
|
545
|
+
let valueFormat;
|
|
546
|
+
try {
|
|
547
|
+
const formatStr = config.valueFormat || ",";
|
|
548
|
+
if (formatStr === "$0,0") valueFormat = /* @__PURE__ */ __name((value) => "$" + format(",")(value), "valueFormat");
|
|
549
|
+
else if (formatStr.startsWith("$") && formatStr.includes(",")) {
|
|
550
|
+
const precision = /\.\d+/.exec(formatStr);
|
|
551
|
+
const precisionStr = precision ? precision[0] : "";
|
|
552
|
+
valueFormat = /* @__PURE__ */ __name((value) => "$" + format("," + precisionStr)(value), "valueFormat");
|
|
553
|
+
} else if (formatStr.startsWith("$")) {
|
|
554
|
+
const restOfFormat = formatStr.substring(1);
|
|
555
|
+
valueFormat = /* @__PURE__ */ __name((value) => "$" + format(restOfFormat || "")(value), "valueFormat");
|
|
556
|
+
} else valueFormat = format(formatStr);
|
|
557
|
+
} catch (error) {
|
|
558
|
+
log.error("Error creating format function:", error);
|
|
559
|
+
valueFormat = format(",");
|
|
560
|
+
}
|
|
561
|
+
const colorScale = ordinal().range([
|
|
562
|
+
"transparent",
|
|
563
|
+
themeVariables.cScale0,
|
|
564
|
+
themeVariables.cScale1,
|
|
565
|
+
themeVariables.cScale2,
|
|
566
|
+
themeVariables.cScale3,
|
|
567
|
+
themeVariables.cScale4,
|
|
568
|
+
themeVariables.cScale5,
|
|
569
|
+
themeVariables.cScale6,
|
|
570
|
+
themeVariables.cScale7,
|
|
571
|
+
themeVariables.cScale8,
|
|
572
|
+
themeVariables.cScale9,
|
|
573
|
+
themeVariables.cScale10,
|
|
574
|
+
themeVariables.cScale11
|
|
575
|
+
]);
|
|
576
|
+
const colorScalePeer = ordinal().range([
|
|
577
|
+
"transparent",
|
|
578
|
+
themeVariables.cScalePeer0,
|
|
579
|
+
themeVariables.cScalePeer1,
|
|
580
|
+
themeVariables.cScalePeer2,
|
|
581
|
+
themeVariables.cScalePeer3,
|
|
582
|
+
themeVariables.cScalePeer4,
|
|
583
|
+
themeVariables.cScalePeer5,
|
|
584
|
+
themeVariables.cScalePeer6,
|
|
585
|
+
themeVariables.cScalePeer7,
|
|
586
|
+
themeVariables.cScalePeer8,
|
|
587
|
+
themeVariables.cScalePeer9,
|
|
588
|
+
themeVariables.cScalePeer10,
|
|
589
|
+
themeVariables.cScalePeer11
|
|
590
|
+
]);
|
|
591
|
+
const colorScaleLabel = ordinal().range([
|
|
592
|
+
themeVariables.cScaleLabel0,
|
|
593
|
+
themeVariables.cScaleLabel1,
|
|
594
|
+
themeVariables.cScaleLabel2,
|
|
595
|
+
themeVariables.cScaleLabel3,
|
|
596
|
+
themeVariables.cScaleLabel4,
|
|
597
|
+
themeVariables.cScaleLabel5,
|
|
598
|
+
themeVariables.cScaleLabel6,
|
|
599
|
+
themeVariables.cScaleLabel7,
|
|
600
|
+
themeVariables.cScaleLabel8,
|
|
601
|
+
themeVariables.cScaleLabel9,
|
|
602
|
+
themeVariables.cScaleLabel10,
|
|
603
|
+
themeVariables.cScaleLabel11
|
|
604
|
+
]);
|
|
605
|
+
if (title) svg.append("text").attr("x", svgWidth / 2).attr("y", titleHeight / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title);
|
|
606
|
+
const g = svg.append("g").attr("transform", `translate(0, ${titleHeight})`).attr("class", "treemapContainer");
|
|
607
|
+
const hierarchyRoot = hierarchy(root).sum((d) => d.value ?? 0).sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
|
|
608
|
+
const treemapData = treemap_default().size([width, height]).paddingTop((d) => d.children && d.children.length > 0 ? SECTION_HEADER_HEIGHT + SECTION_INNER_PADDING : 0).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)(hierarchyRoot);
|
|
609
|
+
const branchNodes = treemapData.descendants().filter((d) => d.children && d.children.length > 0);
|
|
610
|
+
const sections = g.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class", "treemapSection").attr("transform", (d) => `translate(${d.x0},${d.y0})`);
|
|
611
|
+
sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", SECTION_HEADER_HEIGHT).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", .6).attr("stroke-width", .6).attr("style", (d) => {
|
|
612
|
+
if (d.depth === 0) return "display: none;";
|
|
613
|
+
return "";
|
|
614
|
+
});
|
|
615
|
+
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);
|
|
616
|
+
sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", (_d, i) => {
|
|
617
|
+
return `treemapSection section${i}`;
|
|
618
|
+
}).attr("fill", (d) => colorScale(d.data.name)).attr("fill-opacity", .6).attr("stroke", (d) => colorScalePeer(d.data.name)).attr("stroke-width", 2).attr("stroke-opacity", .4).attr("style", (d) => {
|
|
619
|
+
if (d.depth === 0) return "display: none;";
|
|
620
|
+
const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
|
|
621
|
+
return styles.nodeStyles + ";" + styles.borderStyles.join(";");
|
|
622
|
+
});
|
|
623
|
+
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) => {
|
|
624
|
+
if (d.depth === 0) return "display: none;";
|
|
625
|
+
return "dominant-baseline: middle; font-size: 12px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" + styles2String({ cssCompiledStyles: d.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:");
|
|
626
|
+
}).each(function(d) {
|
|
627
|
+
if (d.depth === 0) return;
|
|
628
|
+
const self = select_default(this);
|
|
629
|
+
const originalText = d.data.name;
|
|
630
|
+
self.text(originalText);
|
|
631
|
+
const totalHeaderWidth = d.x1 - d.x0;
|
|
632
|
+
const labelXPosition = 6;
|
|
633
|
+
let spaceForTextContent;
|
|
634
|
+
if (config.showValues !== false && d.value) spaceForTextContent = totalHeaderWidth - 10 - 30 - 10 - labelXPosition;
|
|
635
|
+
else spaceForTextContent = totalHeaderWidth - labelXPosition - 6;
|
|
636
|
+
const actualAvailableWidth = Math.max(15, spaceForTextContent);
|
|
637
|
+
const textNode = self.node();
|
|
638
|
+
if (textNode.getComputedTextLength() > actualAvailableWidth) {
|
|
639
|
+
const ellipsis = "...";
|
|
640
|
+
let currentTruncatedText = originalText;
|
|
641
|
+
while (currentTruncatedText.length > 0) {
|
|
642
|
+
currentTruncatedText = originalText.substring(0, currentTruncatedText.length - 1);
|
|
643
|
+
if (currentTruncatedText.length === 0) {
|
|
644
|
+
self.text(ellipsis);
|
|
645
|
+
if (textNode.getComputedTextLength() > actualAvailableWidth) self.text("");
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
self.text(currentTruncatedText + ellipsis);
|
|
649
|
+
if (textNode.getComputedTextLength() <= actualAvailableWidth) break;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
if (config.showValues !== false) 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) => {
|
|
654
|
+
if (d.depth === 0) return "display: none;";
|
|
655
|
+
return "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" + styles2String({ cssCompiledStyles: d.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:");
|
|
656
|
+
});
|
|
657
|
+
const leafNodes = treemapData.leaves();
|
|
658
|
+
const isComplexTreemap = leafNodes.length > 20;
|
|
659
|
+
const baseLabelFontSize = isComplexTreemap ? 16 : 38;
|
|
660
|
+
const baseValueFontSize = isComplexTreemap ? 14 : 28;
|
|
661
|
+
const minLabelFontSize = isComplexTreemap ? 4 : 8;
|
|
662
|
+
const minValueFontSize = isComplexTreemap ? 4 : 6;
|
|
663
|
+
const labelPadding = isComplexTreemap ? 2 : 4;
|
|
664
|
+
const minDisplayThreshold = isComplexTreemap ? 8 : 10;
|
|
665
|
+
const spacingBetweenLabelAndValue = isComplexTreemap ? 1 : 2;
|
|
666
|
+
const cell = g.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class", (d, i) => {
|
|
667
|
+
return `treemapNode treemapLeafGroup leaf${i}${d.data.classSelector ? ` ${d.data.classSelector}` : ""}x`;
|
|
668
|
+
}).attr("transform", (d) => `translate(${d.x0},${d.y0})`);
|
|
669
|
+
cell.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", "treemapLeaf").attr("fill", (d) => {
|
|
670
|
+
return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
|
|
671
|
+
}).attr("style", (d) => {
|
|
672
|
+
return styles2String({ cssCompiledStyles: d.data.cssCompiledStyles }).nodeStyles;
|
|
673
|
+
}).attr("fill-opacity", .3).attr("stroke", (d) => {
|
|
674
|
+
return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
|
|
675
|
+
}).attr("stroke-width", 3);
|
|
676
|
+
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));
|
|
677
|
+
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) => {
|
|
678
|
+
return `text-anchor: middle; dominant-baseline: middle; font-size: ${baseLabelFontSize}px;fill:` + colorScaleLabel(d.data.name) + ";" + styles2String({ cssCompiledStyles: d.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:");
|
|
679
|
+
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.data.name).each(function(d) {
|
|
680
|
+
const self = select_default(this);
|
|
681
|
+
const nodeWidth = d.x1 - d.x0;
|
|
682
|
+
const nodeHeight = d.y1 - d.y0;
|
|
683
|
+
const textNode = self.node();
|
|
684
|
+
const availableWidth = nodeWidth - 2 * labelPadding;
|
|
685
|
+
const availableHeight = nodeHeight - 2 * labelPadding;
|
|
686
|
+
if (availableWidth < minDisplayThreshold || availableHeight < minDisplayThreshold) {
|
|
687
|
+
self.style("display", "none");
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
let currentLabelFontSize = parseInt(self.style("font-size"), 10);
|
|
691
|
+
const valueScaleFactor = .6;
|
|
692
|
+
while (textNode.getComputedTextLength() > availableWidth && currentLabelFontSize > minLabelFontSize) {
|
|
693
|
+
currentLabelFontSize--;
|
|
694
|
+
self.style("font-size", `${currentLabelFontSize}px`);
|
|
695
|
+
}
|
|
696
|
+
let prospectiveValueFontSize = Math.max(minValueFontSize, Math.min(baseValueFontSize, Math.round(currentLabelFontSize * valueScaleFactor)));
|
|
697
|
+
let combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
|
|
698
|
+
while (combinedHeight > availableHeight && currentLabelFontSize > minLabelFontSize) {
|
|
699
|
+
currentLabelFontSize--;
|
|
700
|
+
prospectiveValueFontSize = Math.max(minValueFontSize, Math.min(baseValueFontSize, Math.round(currentLabelFontSize * valueScaleFactor)));
|
|
701
|
+
if (prospectiveValueFontSize < minValueFontSize && currentLabelFontSize === minLabelFontSize) break;
|
|
702
|
+
self.style("font-size", `${currentLabelFontSize}px`);
|
|
703
|
+
combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
|
|
704
|
+
if (prospectiveValueFontSize <= minValueFontSize && combinedHeight > availableHeight) {}
|
|
705
|
+
}
|
|
706
|
+
self.style("font-size", `${currentLabelFontSize}px`);
|
|
707
|
+
if (isComplexTreemap) {
|
|
708
|
+
if (currentLabelFontSize < minLabelFontSize || availableHeight < minLabelFontSize) self.style("display", "none");
|
|
709
|
+
} else if (textNode.getComputedTextLength() > availableWidth || currentLabelFontSize < minLabelFontSize || availableHeight < currentLabelFontSize) self.style("display", "none");
|
|
710
|
+
});
|
|
711
|
+
if (config.showValues !== false) cell.append("text").attr("class", "treemapValue").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", function(d) {
|
|
712
|
+
return (d.y1 - d.y0) / 2;
|
|
713
|
+
}).attr("style", (d) => {
|
|
714
|
+
return `text-anchor: middle; dominant-baseline: hanging; font-size: ${baseValueFontSize}px;fill:` + colorScaleLabel(d.data.name) + ";" + styles2String({ cssCompiledStyles: d.data.cssCompiledStyles }).labelStyles.replace("color:", "fill:");
|
|
715
|
+
}).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.value ? valueFormat(d.value) : "").each(function(d) {
|
|
716
|
+
const valueTextElement = select_default(this);
|
|
717
|
+
const parentCellNode = this.parentNode;
|
|
718
|
+
if (!parentCellNode) {
|
|
719
|
+
valueTextElement.style("display", "none");
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
const labelElement = select_default(parentCellNode).select(".treemapLabel");
|
|
723
|
+
if (labelElement.empty() || labelElement.style("display") === "none") {
|
|
724
|
+
valueTextElement.style("display", "none");
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
const finalLabelFontSize = parseFloat(labelElement.style("font-size"));
|
|
728
|
+
const actualValueFontSize = Math.max(minValueFontSize, Math.min(baseValueFontSize, Math.round(finalLabelFontSize * .6)));
|
|
729
|
+
valueTextElement.style("font-size", `${actualValueFontSize}px`);
|
|
730
|
+
const valueTopActualY = (d.y1 - d.y0) / 2 + finalLabelFontSize / 2 + spacingBetweenLabelAndValue;
|
|
731
|
+
valueTextElement.attr("y", valueTopActualY);
|
|
732
|
+
const nodeWidth = d.x1 - d.x0;
|
|
733
|
+
const maxValueBottomY = d.y1 - d.y0 - 4;
|
|
734
|
+
const availableWidthForValue = nodeWidth - 2 * labelPadding;
|
|
735
|
+
if (valueTextElement.node().getComputedTextLength() > availableWidthForValue || valueTopActualY + actualValueFontSize > maxValueBottomY || actualValueFontSize < minValueFontSize) valueTextElement.style("display", "none");
|
|
736
|
+
else valueTextElement.style("display", null);
|
|
737
|
+
});
|
|
738
|
+
setupViewPortForSVG(svg, config.diagramPadding ?? 8, "flowchart", config?.useMaxWidth || false);
|
|
739
|
+
}, "draw"),
|
|
740
|
+
getClasses: /* @__PURE__ */ __name(function(_text, diagramObj) {
|
|
741
|
+
return diagramObj.db.getClasses();
|
|
742
|
+
}, "getClasses")
|
|
743
|
+
};
|
|
744
|
+
var defaultTreemapStyleOptions = {
|
|
745
|
+
sectionStrokeColor: "black",
|
|
746
|
+
sectionStrokeWidth: "1",
|
|
747
|
+
sectionFillColor: "#efefef",
|
|
748
|
+
leafStrokeColor: "black",
|
|
749
|
+
leafStrokeWidth: "1",
|
|
750
|
+
leafFillColor: "#efefef",
|
|
751
|
+
labelFontSize: "12px",
|
|
752
|
+
valueFontSize: "10px",
|
|
753
|
+
titleFontSize: "14px"
|
|
754
|
+
};
|
|
755
|
+
var diagram = {
|
|
756
|
+
parser,
|
|
757
|
+
get db() {
|
|
758
|
+
return new TreeMapDB();
|
|
759
|
+
},
|
|
760
|
+
renderer,
|
|
761
|
+
styles: /* @__PURE__ */ __name(({ treemap: treemap2 } = {}) => {
|
|
762
|
+
const themeVariables = cleanAndMerge(getThemeVariables3(), getConfig().themeVariables);
|
|
763
|
+
const options = cleanAndMerge(defaultTreemapStyleOptions, treemap2);
|
|
764
|
+
const titleColor = options.titleColor ?? themeVariables.titleColor;
|
|
765
|
+
const labelColor = options.labelColor ?? themeVariables.textColor;
|
|
766
|
+
const valueColor = options.valueColor ?? themeVariables.textColor;
|
|
767
|
+
return `
|
|
768
|
+
.treemapNode.section {
|
|
769
|
+
stroke: ${options.sectionStrokeColor};
|
|
770
|
+
stroke-width: ${options.sectionStrokeWidth};
|
|
771
|
+
fill: ${options.sectionFillColor};
|
|
772
|
+
}
|
|
773
|
+
.treemapNode.leaf {
|
|
774
|
+
stroke: ${options.leafStrokeColor};
|
|
775
|
+
stroke-width: ${options.leafStrokeWidth};
|
|
776
|
+
fill: ${options.leafFillColor};
|
|
777
|
+
}
|
|
778
|
+
.treemapLabel {
|
|
779
|
+
fill: ${labelColor};
|
|
780
|
+
font-size: ${options.labelFontSize};
|
|
781
|
+
}
|
|
782
|
+
.treemapValue {
|
|
783
|
+
fill: ${valueColor};
|
|
784
|
+
font-size: ${options.valueFontSize};
|
|
785
|
+
}
|
|
786
|
+
.treemapTitle {
|
|
787
|
+
fill: ${titleColor};
|
|
788
|
+
font-size: ${options.titleFontSize};
|
|
789
|
+
}
|
|
790
|
+
`;
|
|
791
|
+
}, "getStyles")
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
//#endregion
|
|
795
|
+
export { diagram };
|