@webskill/sdk 0.21.0 → 0.23.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.
Files changed (135) hide show
  1. package/dist/abnfDiagram-O67JEVCF-DtYFjfqO.js +109 -0
  2. package/dist/agent.d.ts +3 -3
  3. package/dist/agent.js +1174 -169
  4. package/dist/{approval-DwN2o2QG.js → approval-7CuZS3Z4.js} +104 -18
  5. package/dist/arc-8U_6NQWm.js +130 -0
  6. package/dist/architecture-7GRP2DOG-RTw1wpAq.js +4 -0
  7. package/dist/architectureDiagram-NJMV4G6O-XmmXrJAK.js +7473 -0
  8. package/dist/array-DQfpQNY8.js +8 -0
  9. package/dist/blockDiagram-BEXU5L5S-D4yjnCD1.js +2582 -0
  10. package/dist/browser.d.ts +455 -49
  11. package/dist/browser.js +2134 -138
  12. package/dist/c4Diagram-YGBWAQC7-BLmA_JSd.js +3668 -0
  13. package/dist/channel-CZxxLrG7.js +9 -0
  14. package/dist/chunk-2Q5K7J3B-Ck03gkFR.js +21 -0
  15. package/dist/chunk-3FUC2YCW-tr6jmbQf.js +530 -0
  16. package/dist/chunk-5DYCD2WN-Bt97YGTd.js +58 -0
  17. package/dist/chunk-5VM5RSS4-BBxa48HL.js +21 -0
  18. package/dist/chunk-6AEJRKK7-JXK89I-O.js +14 -0
  19. package/dist/chunk-742MDFTN-CPmgCGwC.js +466 -0
  20. package/dist/chunk-7INBJB4K-C9jq9o66.js +6552 -0
  21. package/dist/chunk-7M6MHVWA-BrKCWcR1.js +4894 -0
  22. package/dist/chunk-7PRAP22T-BHED6GVs.js +95 -0
  23. package/dist/chunk-DUW6YSOI-DoZj78PO.js +19 -0
  24. package/dist/chunk-FOHPRMQF-Dkbp819z.js +27189 -0
  25. package/dist/chunk-GNY47TPC-Bpvq1T49.js +87 -0
  26. package/dist/chunk-GTNCS2PH-CLmh4I2c.js +686 -0
  27. package/dist/chunk-GWA4HPMP-B6vN3fkL.js +95 -0
  28. package/dist/chunk-J5ZVWO5B-Bi_Pcobw.js +26 -0
  29. package/dist/chunk-JWPE2WC7-D1rC79GS.js +12 -0
  30. package/dist/chunk-LNGE3PJU-D5OIoe3Z.js +2582 -0
  31. package/dist/chunk-MBY4JIJT-C34L7a4f.js +2276 -0
  32. package/dist/chunk-NETBCI7D-Cg84k8N8.js +321 -0
  33. package/dist/chunk-O7XYJQB3-B6K0KOSL.js +8846 -0
  34. package/dist/chunk-UA2S7LBM-DxHM29_K.js +612 -0
  35. package/dist/chunk-WEXAMYUT-Ba6jFWhB.js +33 -0
  36. package/dist/chunk-XXDRQBXY-DPbSy4kg.js +12 -0
  37. package/dist/chunk-Y2CYZVJY-U3QOMqrW.js +15 -0
  38. package/dist/chunk-Z7XXMR3K-oLg1h8F3.js +1038 -0
  39. package/dist/chunk-ZIGJFQKS-DqEFBuHR.js +2215 -0
  40. package/dist/classDiagram-v2-NBCMYWYE-BqnOWIUt.js +3845 -0
  41. package/dist/cose-bilkent-JH36ORCC-C0dTAHVK.js +4270 -0
  42. package/dist/cynefin-OW5HDTMX-B2QvgEQj.js +4 -0
  43. package/dist/cynefinDiagram-VND7K2PF-yAWc6Z3W.js +479 -0
  44. package/dist/cytoscape.esm-C64mRh9B.js +28325 -0
  45. package/dist/dagre-6A5THRUB-D0w2W27v.js +4816 -0
  46. package/dist/defaultLocale-B_EoOkSF.js +249 -0
  47. package/dist/diagram-22UHCM2B-DvgzhUzP.js +6115 -0
  48. package/dist/diagram-3UASUU5V-DWgUB-ef.js +795 -0
  49. package/dist/diagram-ATOU4E4O-P1olqwIs.js +553 -0
  50. package/dist/diagram-CDSNMT55-BUlZuLUe.js +402 -0
  51. package/dist/diagram-MLGK6HIB-6w5qmkGt.js +186 -0
  52. package/dist/diagram-MPIPVDR6-DEFiSo8o.js +289 -0
  53. package/dist/dist-UajCDt3n.js +92 -0
  54. package/dist/ebnfDiagram-ZINNZB2B-CI8liCfR.js +123 -0
  55. package/dist/elk-276RUBZZ-3SvW6OAK.js +90034 -0
  56. package/dist/erDiagram-OPXOYQCR-CPTbKhwP.js +2301 -0
  57. package/dist/eventmodeling-NTZA5JFV-BlyuqGp0.js +4 -0
  58. package/dist/flowDiagram-KWPJA3E3-CcUJ6HbV.js +18 -0
  59. package/dist/ganttDiagram-FUAMR5RP-31UjY0KK.js +3939 -0
  60. package/dist/{toolSource-C9oNuKmr.js → geometry-CRhuySKV.js} +169 -12
  61. package/dist/gitGraph-4MIJSDKK-ChdVlrk7.js +4 -0
  62. package/dist/gitGraphDiagram-X574FWY7-DKuxJymB.js +1153 -0
  63. package/dist/governance.d.ts +22 -4
  64. package/dist/governance.js +100 -10
  65. package/dist/graphlib-tk9gQYuN.js +4194 -0
  66. package/dist/{index-DHopiH_m.d.ts → index-7No55dRb.d.ts} +161 -11
  67. package/dist/{index-B8Tgmpwh.d.ts → index-ShvCB5I9.d.ts} +2 -2
  68. package/dist/{index-CYLt5u4L.d.ts → index-V76_OFj2.d.ts} +789 -21
  69. package/dist/index.d.ts +4 -4
  70. package/dist/index.js +11 -9
  71. package/dist/info-A6RAGUB7-CxRAt9S9.js +4 -0
  72. package/dist/infoDiagram-VRGFBTTK-pRspGfjZ.js +25 -0
  73. package/dist/init-CMOIWdg-.js +16 -0
  74. package/dist/ishikawaDiagram-OU5B5YK6-DKerAPAg.js +975 -0
  75. package/dist/journeyDiagram-ZHPQQLJL-C4MK-YO5.js +1227 -0
  76. package/dist/kanban-definition-PNTS6WVX-BqsZpMXx.js +1244 -0
  77. package/dist/katex-BcRRvyh_.js +26465 -0
  78. package/dist/{kind-DaKqLX2F.js → kind-Dc8x0HWz.js} +54 -7
  79. package/dist/line-LgV8iVMV.js +48 -0
  80. package/dist/linear-BWKR0Tqd.js +393 -0
  81. package/dist/linkedDocument-CZZOl9cO.js +456 -0
  82. package/dist/mcp.d.ts +2 -2
  83. package/dist/{memoryArtifactStore-D6dLeY55.js → memoryArtifactStore-Bs7glPqm.js} +14 -0
  84. package/dist/mermaid-parser.core-pYR5siSx.js +754 -0
  85. package/dist/mermaid.core-DMtwGCHy.js +1756 -0
  86. package/dist/mindmap-definition-NLK3R4M7-CXbD-myG.js +1312 -0
  87. package/dist/node.d.ts +3 -3
  88. package/dist/node.js +12 -5
  89. package/dist/{openUiLibrary-b0i7F_oZ.js → openUiLibrary-B7j3rLrm.js} +1 -1
  90. package/dist/{openUiSpecLang-CLXJEeRU.js → openUiSpecLang-BSYYnjay.js} +1 -1
  91. package/dist/ordinal-CxA6GHQS.js +84 -0
  92. package/dist/packet-AYTQ26CC-BOm08cxl.js +4 -0
  93. package/dist/path-C27Z2Bjv.js +106 -0
  94. package/dist/{pathSecurity-B1owvJAF.js → pathSecurity-CirkQwWP.js} +12 -1
  95. package/dist/pegDiagram-GJSIUBJH-BLGJOewQ.js +115 -0
  96. package/dist/pie-WAS4IAKB-Dvg7glpk.js +4 -0
  97. package/dist/pieDiagram-5QR66LMP-laoaV_PB.js +298 -0
  98. package/dist/quadrantDiagram-O4NWA36T-Db_wFBkT.js +2236 -0
  99. package/dist/radar-RG4KPBEZ-BZDaTu06.js +4 -0
  100. package/dist/railroad-74A4TZTK-C-UhjkOy.js +4 -0
  101. package/dist/railroad-abnf-HS5TGJTU-dUKVA4OS.js +4 -0
  102. package/dist/railroad-ebnf-LZEXJU2U-DzQumk18.js +4 -0
  103. package/dist/railroad-peg-WCYAUIDC-B3vvTWed.js +4 -0
  104. package/dist/railroadDiagram-XR7U4H2S-BY0sTM4X.js +89 -0
  105. package/dist/requirementDiagram-PLB6GJNP-3rkQfEhs.js +2474 -0
  106. package/dist/rough.cjs-AmDd_NQk.js +1395 -0
  107. package/dist/sankeyDiagram-IPEJSGJF-CGAJhyG2.js +3578 -0
  108. package/dist/sequenceDiagram-PO4LG4MO-9FJjFX06.js +5522 -0
  109. package/dist/sizeCapture-INFHLROL-D8PWxdOn.js +56 -0
  110. package/dist/{skill-CAJMsLod.js → skill-WSUDp6A1.js} +1 -1
  111. package/dist/{skillVersionStore-B24Jjjry-BkOk9wI_.d.ts → skillVersionStore-S4_HJ_Fl-Cvy9LqVu.d.ts} +35 -4
  112. package/dist/src-NkhI3UMl.js +2653 -0
  113. package/dist/stateDiagram-v2-GCMORJYK-B0O3wc1-.js +2715 -0
  114. package/dist/swimlanes-2SLR337P-D4EOnrpu.js +6637 -0
  115. package/dist/swimlanesDiagram-TC7HE7FX-BUx29EJ9.js +30 -0
  116. package/dist/testing.d.ts +2 -1
  117. package/dist/testing.js +1 -1
  118. package/dist/timeline-definition-EJHVYXUP-CrgiiB4C.js +1513 -0
  119. package/dist/treeView-Q6P3EWNA-C1by-Gzc.js +4 -0
  120. package/dist/treemap-WGGIJYW6-mC2NZ6ad.js +4 -0
  121. package/dist/{types-BvTV_05--BW8zDuEk.d.ts → types-CpDRZ0rA-BiZBXGm4.d.ts} +66 -8
  122. package/dist/ui-react.d.ts +3 -3
  123. package/dist/ui-react.js +3746 -96
  124. package/dist/ui-vue.d.ts +1 -1
  125. package/dist/ui.d.ts +3 -3
  126. package/dist/ui.js +2 -2
  127. package/dist/usecaseDiagram-POWQR4AR-BUt_TQOY.js +14397 -0
  128. package/dist/vennDiagram-UO4OBE2U-CwXr0wjA.js +2808 -0
  129. package/dist/wardley-WFR3VGLG-CVSYjq_S.js +4 -0
  130. package/dist/wardleyDiagram-VNRHLVJA-Cpfd47dQ.js +874 -0
  131. package/dist/{webSkillApi-Cib6G-94.js → webSkillApi-D5VMUnrv.js} +2 -2
  132. package/dist/{webskillLitCatalog-W06npwej.js → webskillLitCatalog-D5BCiMCU.js} +1 -1
  133. package/dist/xychartDiagram-PMCCYNJV-e1TeVoc6.js +2704 -0
  134. package/package.json +1 -1
  135. package/dist/linkedDocument-C0gj1sMq.js +0 -245
@@ -0,0 +1,298 @@
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 } from "./src-NkhI3UMl.js";
4
+ import { H as setAccDescription, U as setAccTitle, a as clear, c as configureSvgSize, f as defaultConfig_default, q as setDiagramTitle, v as getAccDescription, w as getDiagramTitle, x as getConfig2, y as getAccTitle } from "./chunk-O7XYJQB3-B6K0KOSL.js";
5
+ import { t as ordinal } from "./ordinal-CxA6GHQS.js";
6
+ import { n as constant_default } from "./path-C27Z2Bjv.js";
7
+ import { m as tau } from "./dist-UajCDt3n.js";
8
+ import { t as arc_default } from "./arc-8U_6NQWm.js";
9
+ import { t as array_default } from "./array-DQfpQNY8.js";
10
+ import { i as cleanAndMerge, p as parseFontSize } from "./chunk-ZIGJFQKS-DqEFBuHR.js";
11
+ import { t as selectSvgElement } from "./chunk-6AEJRKK7-JXK89I-O.js";
12
+ import { t as populateCommonDb } from "./chunk-JWPE2WC7-D1rC79GS.js";
13
+
14
+ //#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/descending.js
15
+ function descending_default(a, b) {
16
+ return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
17
+ }
18
+
19
+ //#endregion
20
+ //#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/identity.js
21
+ function identity_default(d) {
22
+ return d;
23
+ }
24
+
25
+ //#endregion
26
+ //#region ../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/pie.js
27
+ function pie_default() {
28
+ var value = identity_default, sortValues = descending_default, sort = null, startAngle = constant_default(0), endAngle = constant_default(tau), padAngle = constant_default(0);
29
+ function pie(data) {
30
+ var i, n = (data = array_default(data)).length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;
31
+ for (i = 0; i < n; ++i) if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) sum += v;
32
+ if (sortValues != null) index.sort(function(i, j) {
33
+ return sortValues(arcs[i], arcs[j]);
34
+ });
35
+ else if (sort != null) index.sort(function(i, j) {
36
+ return sort(data[i], data[j]);
37
+ });
38
+ for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
39
+ data: data[j],
40
+ index: i,
41
+ value: v,
42
+ startAngle: a0,
43
+ endAngle: a1,
44
+ padAngle: p
45
+ };
46
+ return arcs;
47
+ }
48
+ pie.value = function(_) {
49
+ return arguments.length ? (value = typeof _ === "function" ? _ : constant_default(+_), pie) : value;
50
+ };
51
+ pie.sortValues = function(_) {
52
+ return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
53
+ };
54
+ pie.sort = function(_) {
55
+ return arguments.length ? (sort = _, sortValues = null, pie) : sort;
56
+ };
57
+ pie.startAngle = function(_) {
58
+ return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant_default(+_), pie) : startAngle;
59
+ };
60
+ pie.endAngle = function(_) {
61
+ return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant_default(+_), pie) : endAngle;
62
+ };
63
+ pie.padAngle = function(_) {
64
+ return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant_default(+_), pie) : padAngle;
65
+ };
66
+ return pie;
67
+ }
68
+
69
+ //#endregion
70
+ //#region ../../node_modules/.pnpm/mermaid@12.0.0/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-5QR66LMP.mjs
71
+ var DEFAULT_PIE_CONFIG = defaultConfig_default.pie;
72
+ var DEFAULT_PIE_DB = {
73
+ sections: /* @__PURE__ */ new Map(),
74
+ showData: false,
75
+ config: DEFAULT_PIE_CONFIG
76
+ };
77
+ var sections = DEFAULT_PIE_DB.sections;
78
+ var showData = DEFAULT_PIE_DB.showData;
79
+ var config = structuredClone(DEFAULT_PIE_CONFIG);
80
+ var db = {
81
+ getConfig: /* @__PURE__ */ __name(() => structuredClone(config), "getConfig"),
82
+ clear: /* @__PURE__ */ __name(() => {
83
+ sections = /* @__PURE__ */ new Map();
84
+ showData = DEFAULT_PIE_DB.showData;
85
+ clear();
86
+ }, "clear"),
87
+ setDiagramTitle,
88
+ getDiagramTitle,
89
+ setAccTitle,
90
+ getAccTitle,
91
+ setAccDescription,
92
+ getAccDescription,
93
+ addSection: /* @__PURE__ */ __name(({ label, value }) => {
94
+ if (value < 0) throw new Error(`"${label}" has invalid value: ${value}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);
95
+ if (!sections.has(label)) {
96
+ sections.set(label, value);
97
+ log.debug(`added new section: ${label}, with value: ${value}`);
98
+ }
99
+ }, "addSection"),
100
+ getSections: /* @__PURE__ */ __name(() => sections, "getSections"),
101
+ setShowData: /* @__PURE__ */ __name((toggle) => {
102
+ showData = toggle;
103
+ }, "setShowData"),
104
+ getShowData: /* @__PURE__ */ __name(() => showData, "getShowData")
105
+ };
106
+ var populateDb = /* @__PURE__ */ __name((ast, db2) => {
107
+ populateCommonDb(ast, db2);
108
+ db2.setShowData(ast.showData);
109
+ ast.sections.map(db2.addSection);
110
+ }, "populateDb");
111
+ var parser = { parse: /* @__PURE__ */ __name(async (input) => {
112
+ const ast = await parse("pie", input);
113
+ log.debug(ast);
114
+ populateDb(ast, db);
115
+ }, "parse") };
116
+ var pieStyles_default = /* @__PURE__ */ __name((options) => `
117
+ .pieCircle{
118
+ stroke: ${options.pieStrokeColor};
119
+ stroke-width : ${options.pieStrokeWidth};
120
+ opacity : ${options.pieOpacity};
121
+ }
122
+ .pieCircle.highlighted{
123
+ scale: 1.05;
124
+ opacity: 1;
125
+ }
126
+ .pieCircle.highlightedOnHover:hover{
127
+ transition-duration: 250ms;
128
+ scale: 1.05;
129
+ opacity: 1;
130
+ }
131
+ .pieOuterCircle{
132
+ stroke: ${options.pieOuterStrokeColor};
133
+ stroke-width: ${options.pieOuterStrokeWidth};
134
+ fill: none;
135
+ }
136
+ .pieTitleText {
137
+ text-anchor: middle;
138
+ font-size: ${options.pieTitleTextSize};
139
+ fill: ${options.pieTitleTextColor};
140
+ font-family: ${options.fontFamily};
141
+ }
142
+ .slice {
143
+ font-family: ${options.fontFamily};
144
+ fill: ${options.pieSectionTextColor};
145
+ font-size:${options.pieSectionTextSize};
146
+ // fill: white;
147
+ }
148
+ .legend text {
149
+ fill: ${options.pieLegendTextColor};
150
+ font-family: ${options.fontFamily};
151
+ font-size: ${options.pieLegendTextSize};
152
+ }
153
+ `, "getStyles");
154
+ var createPieArcs = /* @__PURE__ */ __name((sections2) => {
155
+ const sum = [...sections2.values()].reduce((acc, val) => acc + val, 0);
156
+ const pieData = [...sections2.entries()].map(([label, value]) => ({
157
+ label,
158
+ value
159
+ })).filter((d) => d.value / sum * 100 >= 1);
160
+ return pie_default().value((d) => d.value).sort(null)(pieData);
161
+ }, "createPieArcs");
162
+ var diagram = {
163
+ parser,
164
+ db,
165
+ renderer: { draw: /* @__PURE__ */ __name((text, id, _version, diagObj) => {
166
+ log.debug("rendering pie chart\n" + text);
167
+ const db2 = diagObj.db;
168
+ const globalConfig = getConfig2();
169
+ const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
170
+ const MARGIN = 40;
171
+ const LEGEND_RECT_SIZE = 18;
172
+ const LEGEND_SPACING = 4;
173
+ const height = 450;
174
+ const pieWidth = height;
175
+ const svg = selectSvgElement(id);
176
+ const group = svg.append("g");
177
+ group.attr("transform", "translate(225,225)");
178
+ const { themeVariables } = globalConfig;
179
+ let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
180
+ outerStrokeWidth ??= 2;
181
+ const legendPosition = pieConfig.legendPosition;
182
+ const textPosition = pieConfig.textPosition;
183
+ const innerHole = pieConfig.donutHole > 0 && pieConfig.donutHole <= .9 ? pieConfig.donutHole : 0;
184
+ const radius = Math.min(pieWidth, height) / 2 - MARGIN;
185
+ const arcGenerator = arc_default().innerRadius(innerHole * radius).outerRadius(radius);
186
+ const labelArcGenerator = arc_default().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
187
+ const pie = group.append("g");
188
+ pie.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
189
+ const sections2 = db2.getSections();
190
+ const arcs = createPieArcs(sections2);
191
+ const myGeneratedColors = [
192
+ themeVariables.pie1,
193
+ themeVariables.pie2,
194
+ themeVariables.pie3,
195
+ themeVariables.pie4,
196
+ themeVariables.pie5,
197
+ themeVariables.pie6,
198
+ themeVariables.pie7,
199
+ themeVariables.pie8,
200
+ themeVariables.pie9,
201
+ themeVariables.pie10,
202
+ themeVariables.pie11,
203
+ themeVariables.pie12
204
+ ];
205
+ let sum = 0;
206
+ sections2.forEach((section) => {
207
+ sum += section;
208
+ });
209
+ const filteredArcs = arcs.filter((datum) => (datum.data.value / sum * 100).toFixed(0) !== "0");
210
+ const color = ordinal(myGeneratedColors).domain([...sections2.keys()]);
211
+ pie.selectAll("mySlices").data(filteredArcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
212
+ return color(datum.data.label);
213
+ }).attr("class", (datum) => {
214
+ let className = "pieCircle";
215
+ if (pieConfig.highlightSlice === "hover") className += " highlightedOnHover";
216
+ else if (pieConfig.highlightSlice === datum.data.label) className += " highlighted";
217
+ return className;
218
+ });
219
+ pie.selectAll("mySlices").data(filteredArcs).enter().append("text").text((datum) => {
220
+ return (datum.data.value / sum * 100).toFixed(0) + "%";
221
+ }).attr("transform", (datum) => {
222
+ return "translate(" + labelArcGenerator.centroid(datum) + ")";
223
+ }).style("text-anchor", "middle").attr("class", "slice");
224
+ const titleText = group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText");
225
+ const allSectionData = [...sections2.entries()].map(([label, value]) => ({
226
+ label,
227
+ value
228
+ }));
229
+ const legend = group.selectAll(".legend").data(allSectionData).enter().append("g").attr("class", "legend");
230
+ legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", (d) => color(d.label)).style("stroke", (d) => color(d.label));
231
+ legend.append("text").attr("x", 22).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((d) => {
232
+ if (db2.getShowData()) return `${d.label} [${d.value}]`;
233
+ return d.label;
234
+ });
235
+ const longestTextWidth = Math.max(...legend.selectAll("text").nodes().map((node) => node?.getBoundingClientRect().width ?? 0));
236
+ let chartAndLegendHeight = height;
237
+ let chartAndLegendWidth = 490;
238
+ const legendHeight = 22;
239
+ const totalLegendHeight = allSectionData.length * legendHeight;
240
+ switch (legendPosition) {
241
+ case "center":
242
+ legend.attr("transform", (_datum, index) => {
243
+ const offset = legendHeight * allSectionData.length / 2;
244
+ const horizontal = -longestTextWidth / 2 - 22;
245
+ const vertical = index * legendHeight - offset;
246
+ return "translate(" + horizontal + "," + vertical + ")";
247
+ });
248
+ break;
249
+ case "top":
250
+ chartAndLegendHeight += totalLegendHeight;
251
+ legend.attr("transform", (_datum, index) => {
252
+ const offset = radius;
253
+ return `translate(${-longestTextWidth / 2 - 22}, ${index * legendHeight - offset})`;
254
+ });
255
+ pie.attr("transform", () => {
256
+ return `translate(0, ${totalLegendHeight + legendHeight})`;
257
+ });
258
+ break;
259
+ case "bottom":
260
+ chartAndLegendHeight += totalLegendHeight;
261
+ legend.attr("transform", (_datum, index) => {
262
+ const offset = -185 - legendHeight;
263
+ const horizontal = -longestTextWidth / 2 - 22;
264
+ const vertical = index * legendHeight - offset;
265
+ return "translate(" + horizontal + "," + vertical + ")";
266
+ });
267
+ break;
268
+ case "left":
269
+ chartAndLegendWidth += 22 + longestTextWidth;
270
+ legend.attr("transform", (_datum, index) => {
271
+ const offset = legendHeight * allSectionData.length / 2;
272
+ return "translate(-207," + (index * legendHeight - offset) + ")";
273
+ });
274
+ pie.attr("transform", () => {
275
+ return `translate(${longestTextWidth + LEGEND_RECT_SIZE + LEGEND_SPACING}, 0)`;
276
+ });
277
+ break;
278
+ default:
279
+ chartAndLegendWidth += 22 + longestTextWidth;
280
+ legend.attr("transform", (_datum, index) => {
281
+ const offset = legendHeight * allSectionData.length / 2;
282
+ return "translate(216," + (index * legendHeight - offset) + ")";
283
+ });
284
+ break;
285
+ }
286
+ const titleWidth = titleText.node()?.getBoundingClientRect().width ?? 0;
287
+ const titleLeft = pieWidth / 2 - titleWidth / 2;
288
+ const titleRight = pieWidth / 2 + titleWidth / 2;
289
+ const viewBoxX = Math.min(0, titleLeft);
290
+ const totalWidth = Math.max(chartAndLegendWidth, titleRight) - viewBoxX;
291
+ svg.attr("viewBox", `${viewBoxX} 0 ${totalWidth} ${chartAndLegendHeight}`);
292
+ configureSvgSize(svg, chartAndLegendHeight, totalWidth, pieConfig.useMaxWidth);
293
+ }, "draw") },
294
+ styles: pieStyles_default
295
+ };
296
+
297
+ //#endregion
298
+ export { diagram };