@infinilabs/ai-chat 0.0.1 → 0.0.3
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/README.md +10 -1
- package/dist/{_baseUniq-BQcAhV7E.js → _baseUniq-C6eXDRdi.js} +1 -1
- package/dist/_baseUniq-VBKGmFNZ.cjs +151 -0
- package/dist/arc-C_pZjUl4.cjs +130 -0
- package/dist/{arc-2jwvQ2TN.js → arc-D1VL3r-o.js} +1 -1
- package/dist/architecture-U656AL7Q-BF5SEVYt.cjs +5 -0
- package/dist/{architecture-U656AL7Q-WuSilpZW.js → architecture-U656AL7Q-BU8DDug4.js} +1 -1
- package/dist/{architectureDiagram-VXUJARFQ-D6SKNy5z.js → architectureDiagram-VXUJARFQ-BD3g0-L9.js} +3 -3
- package/dist/architectureDiagram-VXUJARFQ-DjBxfJaD.cjs +8681 -0
- package/dist/blockDiagram-VD42YOAC-B2f1rMqq.cjs +3606 -0
- package/dist/{blockDiagram-VD42YOAC-Ct2DD8jj.js → blockDiagram-VD42YOAC-Dco6f43O.js} +5 -5
- package/dist/c4Diagram-YG6GDRKO-DNqNYnPR.cjs +2481 -0
- package/dist/{c4Diagram-YG6GDRKO-B7wBU4mz.js → c4Diagram-YG6GDRKO-DaatwWsP.js} +2 -2
- package/dist/channel-CqaWpJup.cjs +6 -0
- package/dist/{channel-BRREX19f.js → channel-DHoS2D4-.js} +1 -1
- package/dist/{chunk-4BX2VUAB-BnghU1_v.js → chunk-4BX2VUAB-CJqHiK4X.js} +1 -1
- package/dist/chunk-4BX2VUAB-DN2yOkoW.cjs +15 -0
- package/dist/chunk-55IACEB6-BdkCWkvA.cjs +12 -0
- package/dist/{chunk-55IACEB6-Dduk-DEL.js → chunk-55IACEB6-C6ly5iWy.js} +1 -1
- package/dist/{chunk-B4BG7PRW-DeHw-z-x.js → chunk-B4BG7PRW--1XVDmjR.js} +4 -4
- package/dist/chunk-B4BG7PRW-CyVGILSL.cjs +1825 -0
- package/dist/{chunk-DI55MBZ5-GTHMAr0M.js → chunk-DI55MBZ5-CdspH0FP.js} +3 -3
- package/dist/chunk-DI55MBZ5-zfT0HzuJ.cjs +1914 -0
- package/dist/chunk-FMBD7UC4-B1XNgXxo.cjs +18 -0
- package/dist/{chunk-FMBD7UC4-Bchh4_3W.js → chunk-FMBD7UC4-DwJ0I9NE.js} +1 -1
- package/dist/chunk-QN33PNHL-BkRCfP3-.cjs +23 -0
- package/dist/{chunk-QN33PNHL-H6S-NYp0.js → chunk-QN33PNHL-ToZ1oMAx.js} +1 -1
- package/dist/chunk-QZHKN3VN-Bl6qG9aO.cjs +16 -0
- package/dist/{chunk-QZHKN3VN-DdcyNnvM.js → chunk-QZHKN3VN-D6NMZefL.js} +1 -1
- package/dist/{chunk-TZMSLE5B-C7te_j4V.js → chunk-TZMSLE5B-CX7F9bum.js} +1 -1
- package/dist/chunk-TZMSLE5B-CfLnJLL2.cjs +107 -0
- package/dist/{classDiagram-2ON5EDUG-CNkHY_Y7.js → classDiagram-2ON5EDUG-do_fcMxL.js} +2 -2
- package/dist/classDiagram-2ON5EDUG-l6iTeY9n.cjs +19 -0
- package/dist/{classDiagram-v2-WZHVMYZB-CNkHY_Y7.js → classDiagram-v2-WZHVMYZB-do_fcMxL.js} +2 -2
- package/dist/classDiagram-v2-WZHVMYZB-l6iTeY9n.cjs +19 -0
- package/dist/{clone-DnOD7gQ4.js → clone-B0NbP06l.js} +1 -1
- package/dist/clone-O_UR2EnI.cjs +7 -0
- package/dist/cose-bilkent-S5V4N54A-Bj9q8jdP.cjs +4942 -0
- package/dist/{cose-bilkent-S5V4N54A-2EKtTYth.js → cose-bilkent-S5V4N54A-Dm15CejI.js} +1 -1
- package/dist/cytoscape.esm-D8IBYQeQ.cjs +30238 -0
- package/dist/dagre-6UL2VRFP-DlrZJc7j.cjs +693 -0
- package/dist/{dagre-6UL2VRFP-oJLNDO4O.js → dagre-6UL2VRFP-DpFJxcQI.js} +5 -5
- package/dist/defaultLocale-DwYGIg9G.cjs +203 -0
- package/dist/{diagram-PSM6KHXK-DhMgmu9h.js → diagram-PSM6KHXK-BiuW3-I6.js} +4 -4
- package/dist/diagram-PSM6KHXK-J1K0HhB0.cjs +845 -0
- package/dist/{diagram-QEK2KX5R-pB1vUeno.js → diagram-QEK2KX5R-CKI4v8U1.js} +3 -3
- package/dist/diagram-QEK2KX5R-CfZyy8K3.cjs +300 -0
- package/dist/{diagram-S2PKOQOG-HTooIr24.js → diagram-S2PKOQOG-BFBmhCiH.js} +3 -3
- package/dist/diagram-S2PKOQOG-D99Ax7Ju.cjs +210 -0
- package/dist/erDiagram-Q2GNP2WA-CVkYr-Vj.cjs +1158 -0
- package/dist/{erDiagram-Q2GNP2WA-CCaN2EHf.js → erDiagram-Q2GNP2WA-qVxQAwwu.js} +4 -4
- package/dist/{flowDiagram-NV44I4VS-CG0erQtl.js → flowDiagram-NV44I4VS-5brdnMxu.js} +5 -5
- package/dist/flowDiagram-NV44I4VS-7p-zbTbS.cjs +2331 -0
- package/dist/{ganttDiagram-JELNMOA3-D3rSLJec.js → ganttDiagram-JELNMOA3-B_6E5yap.js} +2 -2
- package/dist/ganttDiagram-JELNMOA3-BqIucWob.cjs +3679 -0
- package/dist/{gitGraph-F6HP7TQM-BDWdXs6A.js → gitGraph-F6HP7TQM-5ygKEXa4.js} +1 -1
- package/dist/gitGraph-F6HP7TQM-Dqtx4v2X.cjs +5 -0
- package/dist/{gitGraphDiagram-NY62KEGX-Ip-PiLDb.js → gitGraphDiagram-NY62KEGX-8yiOWwFX.js} +4 -4
- package/dist/gitGraphDiagram-NY62KEGX-DLpTvKWJ.cjs +1203 -0
- package/dist/graph-BQ7jHivU.cjs +595 -0
- package/dist/{graph-wCViE1vL.js → graph-f7dsdfxH.js} +2 -2
- package/dist/index-BZzFD4NG.cjs +120453 -0
- package/dist/{index-BQvQI7yA.js → index-TgFTummf.js} +103814 -100678
- package/dist/index.cjs +19 -0
- package/dist/index.js +13 -1
- package/dist/info-NVLQJR56-CBEfMVO2.cjs +5 -0
- package/dist/info-NVLQJR56-CXysh6Cg.js +5 -0
- package/dist/infoDiagram-WHAUD3N6-D8UJMXYO.cjs +31 -0
- package/dist/{infoDiagram-WHAUD3N6-BbVs4x8y.js → infoDiagram-WHAUD3N6-DAhQzmYU.js} +2 -2
- package/dist/init-DevvdK2U.cjs +15 -0
- package/dist/journeyDiagram-XKPGCS4Q-BTWSe50v.cjs +1254 -0
- package/dist/{journeyDiagram-XKPGCS4Q-Cz9ox9GA.js → journeyDiagram-XKPGCS4Q-DF63luuF.js} +4 -4
- package/dist/kanban-definition-3W4ZIXB7-Bv1kpXjl.cjs +1047 -0
- package/dist/{kanban-definition-3W4ZIXB7-ChdUHO5f.js → kanban-definition-3W4ZIXB7-Byg1KrDf.js} +2 -2
- package/dist/katex-BhpYeT3b.cjs +14523 -0
- package/dist/{layout-BaZPdTGN.js → layout-Bph_0QZr.js} +4 -4
- package/dist/layout-Cbov0jB2.cjs +2182 -0
- package/dist/{linear-D_RX7hM-.js → linear-BSz-RTmc.js} +1 -1
- package/dist/linear-D36lF41G.cjs +339 -0
- package/dist/mermaid-parser.core-BjisUoZL.cjs +18703 -0
- package/dist/{mermaid-parser.core-_sn6A3wB.js → mermaid-parser.core-D51-lxGS.js} +10 -10
- package/dist/min-D_N_XAer.cjs +40 -0
- package/dist/{min-BxeM4Drj.js → min-Sni_KseC.js} +2 -2
- package/dist/mindmap-definition-VGOIOE7T-B7_dDBbb.cjs +1126 -0
- package/dist/{mindmap-definition-VGOIOE7T-BkjJibdi.js → mindmap-definition-VGOIOE7T-fbR1KpVG.js} +3 -3
- package/dist/ordinal-D7sQNqXZ.cjs +75 -0
- package/dist/{packet-BFZMPI3H-D3RtU0mc.js → packet-BFZMPI3H-B9lSQ4ue.js} +1 -1
- package/dist/packet-BFZMPI3H-DFuV40UT.cjs +5 -0
- package/dist/pie-7BOR55EZ-CfhfuSiQ.cjs +5 -0
- package/dist/pie-7BOR55EZ-DlYTWEJg.js +5 -0
- package/dist/{pieDiagram-ADFJNKIX-2Yr1gkth.js → pieDiagram-ADFJNKIX-BZ-6MLDa.js} +4 -4
- package/dist/pieDiagram-ADFJNKIX-ZykBg0LM.cjs +237 -0
- package/dist/quadrantDiagram-AYHSOK5B-BuiB_Qh3.cjs +1335 -0
- package/dist/{quadrantDiagram-AYHSOK5B-CjicpXRv.js → quadrantDiagram-AYHSOK5B-ClRDM-6s.js} +2 -2
- package/dist/{radar-NHE76QYJ-CL0tHnUP.js → radar-NHE76QYJ-Crabb2QS.js} +1 -1
- package/dist/radar-NHE76QYJ-D3rgOiIb.cjs +5 -0
- package/dist/{requirementDiagram-UZGBJVZJ-DBnhlfjR.js → requirementDiagram-UZGBJVZJ-kA_oq2PA.js} +3 -3
- package/dist/requirementDiagram-UZGBJVZJ-mm41geqc.cjs +1161 -0
- package/dist/sankeyDiagram-TZEHDZUN-C6izw8f1.cjs +1193 -0
- package/dist/{sankeyDiagram-TZEHDZUN-B2FErKCa.js → sankeyDiagram-TZEHDZUN-D-ZqnMWy.js} +1 -1
- package/dist/sequenceDiagram-WL72ISMW-CjC76RTk.cjs +3874 -0
- package/dist/{sequenceDiagram-WL72ISMW-BkNTlRlB.js → sequenceDiagram-WL72ISMW-DUEVJaIy.js} +3 -3
- package/dist/{stateDiagram-FKZM4ZOC-CAAFQtS9.js → stateDiagram-FKZM4ZOC-2IfcY2Ye.js} +4 -4
- package/dist/stateDiagram-FKZM4ZOC-DK5kcW23.cjs +447 -0
- package/dist/{stateDiagram-v2-4FDKWEC3-lF6kUebI.js → stateDiagram-v2-4FDKWEC3-DXQKznzB.js} +2 -2
- package/dist/stateDiagram-v2-4FDKWEC3-hWKPBy9I.cjs +19 -0
- package/dist/timeline-definition-IT6M3QCI-DwMBhyGj.cjs +1222 -0
- package/dist/{timeline-definition-IT6M3QCI-CQgMFEPA.js → timeline-definition-IT6M3QCI-ohrBFack.js} +2 -2
- package/dist/treemap-KMMF4GRG-Bdodyj4b.cjs +5 -0
- package/dist/{treemap-KMMF4GRG-B0Mc-u8X.js → treemap-KMMF4GRG-C4kqSdak.js} +1 -1
- package/dist/{xychartDiagram-PRI3JC2R-Cee7LdLr.js → xychartDiagram-PRI3JC2R-BBSKFQ3Z.js} +2 -2
- package/dist/xychartDiagram-PRI3JC2R-wKIvgX35.cjs +1886 -0
- package/package.json +19 -6
- package/dist/index.css +0 -3334
- package/dist/info-NVLQJR56-pJlVBPs6.js +0 -5
- package/dist/pie-7BOR55EZ-xH--CiaM.js +0 -5
package/dist/{mindmap-definition-VGOIOE7T-BkjJibdi.js → mindmap-definition-VGOIOE7T-fbR1KpVG.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _a;
|
|
2
|
-
import { g as getDiagramElement } from "./chunk-55IACEB6-
|
|
3
|
-
import { s as setupViewPortForSVG } from "./chunk-QN33PNHL-
|
|
4
|
-
import { _ as __name, l as log, o as getRegisteredLayoutAlgorithm, r as render, F as defaultConfig_default, c as getConfig2, i as sanitizeText, aC as getUserDefinedConfig, W as isDark, X as lighten, Y as darken } from "./index-
|
|
2
|
+
import { g as getDiagramElement } from "./chunk-55IACEB6-C6ly5iWy.js";
|
|
3
|
+
import { s as setupViewPortForSVG } from "./chunk-QN33PNHL-ToZ1oMAx.js";
|
|
4
|
+
import { _ as __name, l as log, o as getRegisteredLayoutAlgorithm, r as render, F as defaultConfig_default, c as getConfig2, i as sanitizeText, aC as getUserDefinedConfig, W as isDark, X as lighten, Y as darken } from "./index-TgFTummf.js";
|
|
5
5
|
const byteToHex = [];
|
|
6
6
|
for (let i = 0; i < 256; ++i) {
|
|
7
7
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const init = require("./init-DevvdK2U.cjs");
|
|
3
|
+
class InternMap extends Map {
|
|
4
|
+
constructor(entries, key = keyof) {
|
|
5
|
+
super();
|
|
6
|
+
Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } });
|
|
7
|
+
if (entries != null) for (const [key2, value] of entries) this.set(key2, value);
|
|
8
|
+
}
|
|
9
|
+
get(key) {
|
|
10
|
+
return super.get(intern_get(this, key));
|
|
11
|
+
}
|
|
12
|
+
has(key) {
|
|
13
|
+
return super.has(intern_get(this, key));
|
|
14
|
+
}
|
|
15
|
+
set(key, value) {
|
|
16
|
+
return super.set(intern_set(this, key), value);
|
|
17
|
+
}
|
|
18
|
+
delete(key) {
|
|
19
|
+
return super.delete(intern_delete(this, key));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function intern_get({ _intern, _key }, value) {
|
|
23
|
+
const key = _key(value);
|
|
24
|
+
return _intern.has(key) ? _intern.get(key) : value;
|
|
25
|
+
}
|
|
26
|
+
function intern_set({ _intern, _key }, value) {
|
|
27
|
+
const key = _key(value);
|
|
28
|
+
if (_intern.has(key)) return _intern.get(key);
|
|
29
|
+
_intern.set(key, value);
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function intern_delete({ _intern, _key }, value) {
|
|
33
|
+
const key = _key(value);
|
|
34
|
+
if (_intern.has(key)) {
|
|
35
|
+
value = _intern.get(key);
|
|
36
|
+
_intern.delete(key);
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
function keyof(value) {
|
|
41
|
+
return value !== null && typeof value === "object" ? value.valueOf() : value;
|
|
42
|
+
}
|
|
43
|
+
const implicit = /* @__PURE__ */ Symbol("implicit");
|
|
44
|
+
function ordinal() {
|
|
45
|
+
var index = new InternMap(), domain = [], range = [], unknown = implicit;
|
|
46
|
+
function scale(d) {
|
|
47
|
+
let i = index.get(d);
|
|
48
|
+
if (i === void 0) {
|
|
49
|
+
if (unknown !== implicit) return unknown;
|
|
50
|
+
index.set(d, i = domain.push(d) - 1);
|
|
51
|
+
}
|
|
52
|
+
return range[i % range.length];
|
|
53
|
+
}
|
|
54
|
+
scale.domain = function(_) {
|
|
55
|
+
if (!arguments.length) return domain.slice();
|
|
56
|
+
domain = [], index = new InternMap();
|
|
57
|
+
for (const value of _) {
|
|
58
|
+
if (index.has(value)) continue;
|
|
59
|
+
index.set(value, domain.push(value) - 1);
|
|
60
|
+
}
|
|
61
|
+
return scale;
|
|
62
|
+
};
|
|
63
|
+
scale.range = function(_) {
|
|
64
|
+
return arguments.length ? (range = Array.from(_), scale) : range.slice();
|
|
65
|
+
};
|
|
66
|
+
scale.unknown = function(_) {
|
|
67
|
+
return arguments.length ? (unknown = _, scale) : unknown;
|
|
68
|
+
};
|
|
69
|
+
scale.copy = function() {
|
|
70
|
+
return ordinal(domain, range).unknown(unknown);
|
|
71
|
+
};
|
|
72
|
+
init.initRange.apply(scale, arguments);
|
|
73
|
+
return scale;
|
|
74
|
+
}
|
|
75
|
+
exports.ordinal = ordinal;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const mermaidParser_core = require("./mermaid-parser.core-BjisUoZL.cjs");
|
|
4
|
+
exports.PacketModule = mermaidParser_core.PacketModule;
|
|
5
|
+
exports.createPacketServices = mermaidParser_core.createPacketServices;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const mermaidParser_core = require("./mermaid-parser.core-BjisUoZL.cjs");
|
|
4
|
+
exports.PieModule = mermaidParser_core.PieModule;
|
|
5
|
+
exports.createPieServices = mermaidParser_core.createPieServices;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a4 as constant, a7 as tau, aB as array, _ as __name, g as getAccDescription, s as setAccDescription, a as getAccTitle, b as setAccTitle, q as getDiagramTitle, p as setDiagramTitle, l as log, c as getConfig2$1, D as cleanAndMerge, H as selectSvgElement, N as parseFontSize, e as configureSvgSize, y as clear, F as defaultConfig_default } from "./index-
|
|
2
|
-
import { p as populateCommonDb } from "./chunk-4BX2VUAB-
|
|
3
|
-
import { p as parse } from "./mermaid-parser.core-
|
|
4
|
-
import { d as d3arc } from "./arc-
|
|
1
|
+
import { a4 as constant, a7 as tau, aB as array, _ as __name, g as getAccDescription, s as setAccDescription, a as getAccTitle, b as setAccTitle, q as getDiagramTitle, p as setDiagramTitle, l as log, c as getConfig2$1, D as cleanAndMerge, H as selectSvgElement, N as parseFontSize, e as configureSvgSize, y as clear, F as defaultConfig_default } from "./index-TgFTummf.js";
|
|
2
|
+
import { p as populateCommonDb } from "./chunk-4BX2VUAB-CJqHiK4X.js";
|
|
3
|
+
import { p as parse } from "./mermaid-parser.core-D51-lxGS.js";
|
|
4
|
+
import { d as d3arc } from "./arc-D1VL3r-o.js";
|
|
5
5
|
import { o as ordinal } from "./ordinal-CxptdPJm.js";
|
|
6
6
|
function descending(a, b) {
|
|
7
7
|
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const index = require("./index-BZzFD4NG.cjs");
|
|
4
|
+
const chunk4BX2VUAB = require("./chunk-4BX2VUAB-DN2yOkoW.cjs");
|
|
5
|
+
const mermaidParser_core = require("./mermaid-parser.core-BjisUoZL.cjs");
|
|
6
|
+
const arc = require("./arc-C_pZjUl4.cjs");
|
|
7
|
+
const ordinal = require("./ordinal-D7sQNqXZ.cjs");
|
|
8
|
+
function descending(a, b) {
|
|
9
|
+
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
|
10
|
+
}
|
|
11
|
+
function identity(d) {
|
|
12
|
+
return d;
|
|
13
|
+
}
|
|
14
|
+
function d3pie() {
|
|
15
|
+
var value = identity, sortValues = descending, sort = null, startAngle = index.constant(0), endAngle = index.constant(index.tau), padAngle = index.constant(0);
|
|
16
|
+
function pie(data) {
|
|
17
|
+
var i, n = (data = index.array(data)).length, j, k, sum = 0, index$1 = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(index.tau, Math.max(-index.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;
|
|
18
|
+
for (i = 0; i < n; ++i) {
|
|
19
|
+
if ((v = arcs[index$1[i] = i] = +value(data[i], i, data)) > 0) {
|
|
20
|
+
sum += v;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (sortValues != null) index$1.sort(function(i2, j2) {
|
|
24
|
+
return sortValues(arcs[i2], arcs[j2]);
|
|
25
|
+
});
|
|
26
|
+
else if (sort != null) index$1.sort(function(i2, j2) {
|
|
27
|
+
return sort(data[i2], data[j2]);
|
|
28
|
+
});
|
|
29
|
+
for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
|
|
30
|
+
j = index$1[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
|
|
31
|
+
data: data[j],
|
|
32
|
+
index: i,
|
|
33
|
+
value: v,
|
|
34
|
+
startAngle: a0,
|
|
35
|
+
endAngle: a1,
|
|
36
|
+
padAngle: p
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return arcs;
|
|
40
|
+
}
|
|
41
|
+
pie.value = function(_) {
|
|
42
|
+
return arguments.length ? (value = typeof _ === "function" ? _ : index.constant(+_), pie) : value;
|
|
43
|
+
};
|
|
44
|
+
pie.sortValues = function(_) {
|
|
45
|
+
return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
|
|
46
|
+
};
|
|
47
|
+
pie.sort = function(_) {
|
|
48
|
+
return arguments.length ? (sort = _, sortValues = null, pie) : sort;
|
|
49
|
+
};
|
|
50
|
+
pie.startAngle = function(_) {
|
|
51
|
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : index.constant(+_), pie) : startAngle;
|
|
52
|
+
};
|
|
53
|
+
pie.endAngle = function(_) {
|
|
54
|
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : index.constant(+_), pie) : endAngle;
|
|
55
|
+
};
|
|
56
|
+
pie.padAngle = function(_) {
|
|
57
|
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : index.constant(+_), pie) : padAngle;
|
|
58
|
+
};
|
|
59
|
+
return pie;
|
|
60
|
+
}
|
|
61
|
+
var DEFAULT_PIE_CONFIG = index.defaultConfig_default.pie;
|
|
62
|
+
var DEFAULT_PIE_DB = {
|
|
63
|
+
sections: /* @__PURE__ */ new Map(),
|
|
64
|
+
showData: false
|
|
65
|
+
};
|
|
66
|
+
var sections = DEFAULT_PIE_DB.sections;
|
|
67
|
+
var showData = DEFAULT_PIE_DB.showData;
|
|
68
|
+
var config = structuredClone(DEFAULT_PIE_CONFIG);
|
|
69
|
+
var getConfig2 = /* @__PURE__ */ index.__name(() => structuredClone(config), "getConfig");
|
|
70
|
+
var clear2 = /* @__PURE__ */ index.__name(() => {
|
|
71
|
+
sections = /* @__PURE__ */ new Map();
|
|
72
|
+
showData = DEFAULT_PIE_DB.showData;
|
|
73
|
+
index.clear();
|
|
74
|
+
}, "clear");
|
|
75
|
+
var addSection = /* @__PURE__ */ index.__name(({ label, value }) => {
|
|
76
|
+
if (value < 0) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
`"${label}" has invalid value: ${value}. Negative values are not allowed in pie charts. All slice values must be >= 0.`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
if (!sections.has(label)) {
|
|
82
|
+
sections.set(label, value);
|
|
83
|
+
index.log.debug(`added new section: ${label}, with value: ${value}`);
|
|
84
|
+
}
|
|
85
|
+
}, "addSection");
|
|
86
|
+
var getSections = /* @__PURE__ */ index.__name(() => sections, "getSections");
|
|
87
|
+
var setShowData = /* @__PURE__ */ index.__name((toggle) => {
|
|
88
|
+
showData = toggle;
|
|
89
|
+
}, "setShowData");
|
|
90
|
+
var getShowData = /* @__PURE__ */ index.__name(() => showData, "getShowData");
|
|
91
|
+
var db = {
|
|
92
|
+
getConfig: getConfig2,
|
|
93
|
+
clear: clear2,
|
|
94
|
+
setDiagramTitle: index.setDiagramTitle,
|
|
95
|
+
getDiagramTitle: index.getDiagramTitle,
|
|
96
|
+
setAccTitle: index.setAccTitle,
|
|
97
|
+
getAccTitle: index.getAccTitle,
|
|
98
|
+
setAccDescription: index.setAccDescription,
|
|
99
|
+
getAccDescription: index.getAccDescription,
|
|
100
|
+
addSection,
|
|
101
|
+
getSections,
|
|
102
|
+
setShowData,
|
|
103
|
+
getShowData
|
|
104
|
+
};
|
|
105
|
+
var populateDb = /* @__PURE__ */ index.__name((ast, db2) => {
|
|
106
|
+
chunk4BX2VUAB.populateCommonDb(ast, db2);
|
|
107
|
+
db2.setShowData(ast.showData);
|
|
108
|
+
ast.sections.map(db2.addSection);
|
|
109
|
+
}, "populateDb");
|
|
110
|
+
var parser = {
|
|
111
|
+
parse: /* @__PURE__ */ index.__name(async (input) => {
|
|
112
|
+
const ast = await mermaidParser_core.parse("pie", input);
|
|
113
|
+
index.log.debug(ast);
|
|
114
|
+
populateDb(ast, db);
|
|
115
|
+
}, "parse")
|
|
116
|
+
};
|
|
117
|
+
var getStyles = /* @__PURE__ */ index.__name((options) => `
|
|
118
|
+
.pieCircle{
|
|
119
|
+
stroke: ${options.pieStrokeColor};
|
|
120
|
+
stroke-width : ${options.pieStrokeWidth};
|
|
121
|
+
opacity : ${options.pieOpacity};
|
|
122
|
+
}
|
|
123
|
+
.pieOuterCircle{
|
|
124
|
+
stroke: ${options.pieOuterStrokeColor};
|
|
125
|
+
stroke-width: ${options.pieOuterStrokeWidth};
|
|
126
|
+
fill: none;
|
|
127
|
+
}
|
|
128
|
+
.pieTitleText {
|
|
129
|
+
text-anchor: middle;
|
|
130
|
+
font-size: ${options.pieTitleTextSize};
|
|
131
|
+
fill: ${options.pieTitleTextColor};
|
|
132
|
+
font-family: ${options.fontFamily};
|
|
133
|
+
}
|
|
134
|
+
.slice {
|
|
135
|
+
font-family: ${options.fontFamily};
|
|
136
|
+
fill: ${options.pieSectionTextColor};
|
|
137
|
+
font-size:${options.pieSectionTextSize};
|
|
138
|
+
// fill: white;
|
|
139
|
+
}
|
|
140
|
+
.legend text {
|
|
141
|
+
fill: ${options.pieLegendTextColor};
|
|
142
|
+
font-family: ${options.fontFamily};
|
|
143
|
+
font-size: ${options.pieLegendTextSize};
|
|
144
|
+
}
|
|
145
|
+
`, "getStyles");
|
|
146
|
+
var pieStyles_default = getStyles;
|
|
147
|
+
var createPieArcs = /* @__PURE__ */ index.__name((sections2) => {
|
|
148
|
+
const sum = [...sections2.values()].reduce((acc, val) => acc + val, 0);
|
|
149
|
+
const pieData = [...sections2.entries()].map(([label, value]) => ({ label, value })).filter((d) => d.value / sum * 100 >= 1).sort((a, b) => b.value - a.value);
|
|
150
|
+
const pie = d3pie().value((d) => d.value);
|
|
151
|
+
return pie(pieData);
|
|
152
|
+
}, "createPieArcs");
|
|
153
|
+
var draw = /* @__PURE__ */ index.__name((text, id, _version, diagObj) => {
|
|
154
|
+
index.log.debug("rendering pie chart\n" + text);
|
|
155
|
+
const db2 = diagObj.db;
|
|
156
|
+
const globalConfig = index.getConfig2();
|
|
157
|
+
const pieConfig = index.cleanAndMerge(db2.getConfig(), globalConfig.pie);
|
|
158
|
+
const MARGIN = 40;
|
|
159
|
+
const LEGEND_RECT_SIZE = 18;
|
|
160
|
+
const LEGEND_SPACING = 4;
|
|
161
|
+
const height = 450;
|
|
162
|
+
const pieWidth = height;
|
|
163
|
+
const svg = index.selectSvgElement(id);
|
|
164
|
+
const group = svg.append("g");
|
|
165
|
+
group.attr("transform", "translate(" + pieWidth / 2 + "," + height / 2 + ")");
|
|
166
|
+
const { themeVariables } = globalConfig;
|
|
167
|
+
let [outerStrokeWidth] = index.parseFontSize(themeVariables.pieOuterStrokeWidth);
|
|
168
|
+
outerStrokeWidth ??= 2;
|
|
169
|
+
const textPosition = pieConfig.textPosition;
|
|
170
|
+
const radius = Math.min(pieWidth, height) / 2 - MARGIN;
|
|
171
|
+
const arcGenerator = arc.d3arc().innerRadius(0).outerRadius(radius);
|
|
172
|
+
const labelArcGenerator = arc.d3arc().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
|
|
173
|
+
group.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
|
|
174
|
+
const sections2 = db2.getSections();
|
|
175
|
+
const arcs = createPieArcs(sections2);
|
|
176
|
+
const myGeneratedColors = [
|
|
177
|
+
themeVariables.pie1,
|
|
178
|
+
themeVariables.pie2,
|
|
179
|
+
themeVariables.pie3,
|
|
180
|
+
themeVariables.pie4,
|
|
181
|
+
themeVariables.pie5,
|
|
182
|
+
themeVariables.pie6,
|
|
183
|
+
themeVariables.pie7,
|
|
184
|
+
themeVariables.pie8,
|
|
185
|
+
themeVariables.pie9,
|
|
186
|
+
themeVariables.pie10,
|
|
187
|
+
themeVariables.pie11,
|
|
188
|
+
themeVariables.pie12
|
|
189
|
+
];
|
|
190
|
+
let sum = 0;
|
|
191
|
+
sections2.forEach((section) => {
|
|
192
|
+
sum += section;
|
|
193
|
+
});
|
|
194
|
+
const filteredArcs = arcs.filter((datum) => (datum.data.value / sum * 100).toFixed(0) !== "0");
|
|
195
|
+
const color = ordinal.ordinal(myGeneratedColors);
|
|
196
|
+
group.selectAll("mySlices").data(filteredArcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
|
|
197
|
+
return color(datum.data.label);
|
|
198
|
+
}).attr("class", "pieCircle");
|
|
199
|
+
group.selectAll("mySlices").data(filteredArcs).enter().append("text").text((datum) => {
|
|
200
|
+
return (datum.data.value / sum * 100).toFixed(0) + "%";
|
|
201
|
+
}).attr("transform", (datum) => {
|
|
202
|
+
return "translate(" + labelArcGenerator.centroid(datum) + ")";
|
|
203
|
+
}).style("text-anchor", "middle").attr("class", "slice");
|
|
204
|
+
group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText");
|
|
205
|
+
const allSectionData = [...sections2.entries()].map(([label, value]) => ({
|
|
206
|
+
label,
|
|
207
|
+
value
|
|
208
|
+
}));
|
|
209
|
+
const legend = group.selectAll(".legend").data(allSectionData).enter().append("g").attr("class", "legend").attr("transform", (_datum, index2) => {
|
|
210
|
+
const height2 = LEGEND_RECT_SIZE + LEGEND_SPACING;
|
|
211
|
+
const offset = height2 * allSectionData.length / 2;
|
|
212
|
+
const horizontal = 12 * LEGEND_RECT_SIZE;
|
|
213
|
+
const vertical = index2 * height2 - offset;
|
|
214
|
+
return "translate(" + horizontal + "," + vertical + ")";
|
|
215
|
+
});
|
|
216
|
+
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));
|
|
217
|
+
legend.append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((d) => {
|
|
218
|
+
if (db2.getShowData()) {
|
|
219
|
+
return `${d.label} [${d.value}]`;
|
|
220
|
+
}
|
|
221
|
+
return d.label;
|
|
222
|
+
});
|
|
223
|
+
const longestTextWidth = Math.max(
|
|
224
|
+
...legend.selectAll("text").nodes().map((node) => node?.getBoundingClientRect().width ?? 0)
|
|
225
|
+
);
|
|
226
|
+
const totalWidth = pieWidth + MARGIN + LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
|
|
227
|
+
svg.attr("viewBox", `0 0 ${totalWidth} ${height}`);
|
|
228
|
+
index.configureSvgSize(svg, height, totalWidth, pieConfig.useMaxWidth);
|
|
229
|
+
}, "draw");
|
|
230
|
+
var renderer = { draw };
|
|
231
|
+
var diagram = {
|
|
232
|
+
parser,
|
|
233
|
+
db,
|
|
234
|
+
renderer,
|
|
235
|
+
styles: pieStyles_default
|
|
236
|
+
};
|
|
237
|
+
exports.diagram = diagram;
|