@life-exe/wiki-engine 0.1.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/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/analytics/index.d.ts +10 -0
- package/dist/chunks/abnfDiagram-VCTEODGH-DyAP6Aua.js +87 -0
- package/dist/chunks/arc-OroUeRL_.js +83 -0
- package/dist/chunks/architectureDiagram-5GKGNRK7-FjmrDCl4.js +4784 -0
- package/dist/chunks/blockDiagram-I7D4REHJ-BF3oIDlI.js +1416 -0
- package/dist/chunks/c4Diagram-7LVT6UL2-Cmdq0LZr.js +1511 -0
- package/dist/chunks/channel-Bdy1QZHo.js +5 -0
- package/dist/chunks/chunk-2Q5K7J3B-BwxRSEKd.js +15 -0
- package/dist/chunks/chunk-5VM5RSS4-BtHwUU4T.js +19 -0
- package/dist/chunks/chunk-F27PBJKO-DF4TGftR.js +68 -0
- package/dist/chunks/chunk-IMKFNOWR-DkBQ-1aV.js +1421 -0
- package/dist/chunks/chunk-JWPE2WC7-BIokdAUW.js +9 -0
- package/dist/chunks/chunk-POPQ4Y6H-CcjOsf9X.js +20 -0
- package/dist/chunks/chunk-SHT3W25Y-lYp5BdEg.js +1695 -0
- package/dist/chunks/chunk-SVP7TREG-DN-ravNt.js +664 -0
- package/dist/chunks/chunk-TICWLB2K-CtTJ0xaY.js +1534 -0
- package/dist/chunks/chunk-XXDRQBXY-BovkWFC0.js +8 -0
- package/dist/chunks/classDiagram-ZZMXUADV-CMYS0pHw.js +16 -0
- package/dist/chunks/classDiagram-v2-VYDZK3BY-CMYS0pHw.js +16 -0
- package/dist/chunks/common-BJ4q25wy.js +12633 -0
- package/dist/chunks/cose-bilkent-JH36ORCC-CaMqpJY7.js +2608 -0
- package/dist/chunks/cynefin-OW5HDTMX-Bzjecpt-.js +23853 -0
- package/dist/chunks/cynefinDiagram-5FMLGOSQ-C0NuKLt0.js +299 -0
- package/dist/chunks/cytoscape.esm-DmPrb1GM.js +18787 -0
- package/dist/chunks/dagre-GXQ25YYZ-Ds09_NdN.js +461 -0
- package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
- package/dist/chunks/diagram-S7CK7UJ4-IvSazk1O.js +349 -0
- package/dist/chunks/diagram-UQ7AKVKN-58epdx5V.js +223 -0
- package/dist/chunks/diagram-VSXAHHWV-BrzRGMeV.js +466 -0
- package/dist/chunks/diagram-VX7I27RA-DPL0Nw6d.js +530 -0
- package/dist/chunks/diagram-Z3DM3KII-8VWVu0I5.js +143 -0
- package/dist/chunks/ebnfDiagram-PWID7BFC-DeByR_ze.js +109 -0
- package/dist/chunks/erDiagram-RLTQ6QDP-C9uo9iE1.js +1060 -0
- package/dist/chunks/flowDiagram-HODETNUW-BpoY3OMp.js +7 -0
- package/dist/chunks/ganttDiagram-EL5Y4UJY-psdwnC-T.js +2711 -0
- package/dist/chunks/gitGraphDiagram-WWUBYQGX-vsDfkn_Q.js +828 -0
- package/dist/chunks/index-f7Uzykhj.js +38262 -0
- package/dist/chunks/infoDiagram-27XIBGKW-8K-eQZiU.js +24 -0
- package/dist/chunks/init-DjUOC4st.js +16 -0
- package/dist/chunks/ishikawaDiagram-5VMMS53U-CuqR1k5i.js +622 -0
- package/dist/chunks/journeyDiagram-3NMN7TZE-BPW1nmwZ.js +834 -0
- package/dist/chunks/kanban-definition-UXKFOSKX-iY6-d6jO.js +726 -0
- package/dist/chunks/katex-jHfnQmlp.js +11682 -0
- package/dist/chunks/layout-CgV9vOdp.js +1704 -0
- package/dist/chunks/linear-BzcaSMTS.js +259 -0
- package/dist/chunks/mindmap-definition-YA3MSWOX-CaLfHyv0.js +831 -0
- package/dist/chunks/ordinal-DfAQgscy.js +61 -0
- package/dist/chunks/pegDiagram-XKGWAZYB-6Y28VvVh.js +95 -0
- package/dist/chunks/pieDiagram-E7YTZNPT-OrjeRxhs.js +209 -0
- package/dist/chunks/quadrantDiagram-AXDQQJYC-rgw2lV2J.js +1025 -0
- package/dist/chunks/railroadDiagram-O6MQD6OU-D6QNO5r1.js +77 -0
- package/dist/chunks/requirementDiagram-BXWQKSXE-a8tNRSuE.js +884 -0
- package/dist/chunks/sankeyDiagram-P5KCCOFB-CdaC8rLw.js +847 -0
- package/dist/chunks/sequenceDiagram-WJ2MYXX4-CGLi38Hj.js +2898 -0
- package/dist/chunks/sizeCapture-INFHLROL-g5RJXnik.js +47 -0
- package/dist/chunks/stateDiagram-D77RDMKH-Cou0eVl1.js +262 -0
- package/dist/chunks/stateDiagram-v2-MP3YSRHH-BHQspnUg.js +16 -0
- package/dist/chunks/swimlanes-42K2YHIH-BU7S1WgJ.js +5239 -0
- package/dist/chunks/swimlanesDiagram-VR7AAH4N-BsEplbno.js +13 -0
- package/dist/chunks/timeline-definition-24CTP7MA-BB-IyxWL.js +1066 -0
- package/dist/chunks/vennDiagram-4TSXK5OY-BToYolPI.js +1585 -0
- package/dist/chunks/wardleyDiagram-VM6X3IG4-BgoueOw_.js +684 -0
- package/dist/chunks/xychartDiagram-S5SC5T6Z-CF0fWv-W.js +1492 -0
- package/dist/components/CodeBlock.d.ts +5 -0
- package/dist/components/CommunityLinks.d.ts +21 -0
- package/dist/components/CookieConsent.d.ts +2 -0
- package/dist/components/DocLinkCard.d.ts +6 -0
- package/dist/components/LecturePageView.d.ts +3 -0
- package/dist/components/MermaidDiagram.d.ts +3 -0
- package/dist/components/SearchPopup.d.ts +6 -0
- package/dist/components/WikiApp.d.ts +9 -0
- package/dist/components/WikiLayout.d.ts +2 -0
- package/dist/components/WikiPageView.d.ts +6 -0
- package/dist/components/ZoomableImage.d.ts +2 -0
- package/dist/context/LangContext.d.ts +2 -0
- package/dist/context/WikiContext.d.ts +18 -0
- package/dist/data.d.ts +8 -0
- package/dist/hooks/useLanguage.d.ts +4 -0
- package/dist/hooks/useTheme.d.ts +5 -0
- package/dist/hooks/useWiki.d.ts +2 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +45 -0
- package/dist/languages/ue-cpp.d.ts +7 -0
- package/dist/languages/ue-cpp.js +21 -0
- package/dist/types.d.ts +119 -0
- package/dist/wiki-engine.css +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { i as a } from "./init-DjUOC4st.js";
|
|
2
|
+
class o extends Map {
|
|
3
|
+
constructor(n, t = g) {
|
|
4
|
+
if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: t } }), n != null) for (const [r, s] of n) this.set(r, s);
|
|
5
|
+
}
|
|
6
|
+
get(n) {
|
|
7
|
+
return super.get(c(this, n));
|
|
8
|
+
}
|
|
9
|
+
has(n) {
|
|
10
|
+
return super.has(c(this, n));
|
|
11
|
+
}
|
|
12
|
+
set(n, t) {
|
|
13
|
+
return super.set(l(this, n), t);
|
|
14
|
+
}
|
|
15
|
+
delete(n) {
|
|
16
|
+
return super.delete(p(this, n));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function c({ _intern: e, _key: n }, t) {
|
|
20
|
+
const r = n(t);
|
|
21
|
+
return e.has(r) ? e.get(r) : t;
|
|
22
|
+
}
|
|
23
|
+
function l({ _intern: e, _key: n }, t) {
|
|
24
|
+
const r = n(t);
|
|
25
|
+
return e.has(r) ? e.get(r) : (e.set(r, t), t);
|
|
26
|
+
}
|
|
27
|
+
function p({ _intern: e, _key: n }, t) {
|
|
28
|
+
const r = n(t);
|
|
29
|
+
return e.has(r) && (t = e.get(r), e.delete(r)), t;
|
|
30
|
+
}
|
|
31
|
+
function g(e) {
|
|
32
|
+
return e !== null && typeof e == "object" ? e.valueOf() : e;
|
|
33
|
+
}
|
|
34
|
+
const f = Symbol("implicit");
|
|
35
|
+
function h() {
|
|
36
|
+
var e = new o(), n = [], t = [], r = f;
|
|
37
|
+
function s(u) {
|
|
38
|
+
let i = e.get(u);
|
|
39
|
+
if (i === void 0) {
|
|
40
|
+
if (r !== f) return r;
|
|
41
|
+
e.set(u, i = n.push(u) - 1);
|
|
42
|
+
}
|
|
43
|
+
return t[i % t.length];
|
|
44
|
+
}
|
|
45
|
+
return s.domain = function(u) {
|
|
46
|
+
if (!arguments.length) return n.slice();
|
|
47
|
+
n = [], e = new o();
|
|
48
|
+
for (const i of u)
|
|
49
|
+
e.has(i) || e.set(i, n.push(i) - 1);
|
|
50
|
+
return s;
|
|
51
|
+
}, s.range = function(u) {
|
|
52
|
+
return arguments.length ? (t = Array.from(u), s) : t.slice();
|
|
53
|
+
}, s.unknown = function(u) {
|
|
54
|
+
return arguments.length ? (r = u, s) : r;
|
|
55
|
+
}, s.copy = function() {
|
|
56
|
+
return h(n, t).unknown(r);
|
|
57
|
+
}, a.apply(s, arguments), s;
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
h as o
|
|
61
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { g as l, r as m, d as a } from "./chunk-SVP7TREG-DN-ravNt.js";
|
|
2
|
+
import { p } from "./chunk-JWPE2WC7-BIokdAUW.js";
|
|
3
|
+
import { _ as t, l as o } from "./index-f7Uzykhj.js";
|
|
4
|
+
import { M as u, d as c } from "./cynefin-OW5HDTMX-Bzjecpt-.js";
|
|
5
|
+
var f = c().RailroadPeg.parser.LangiumParser, i = /* @__PURE__ */ t((e) => {
|
|
6
|
+
const r = e.alternatives.map(d);
|
|
7
|
+
return r.length === 1 ? r[0] : {
|
|
8
|
+
type: "choice",
|
|
9
|
+
alternatives: r
|
|
10
|
+
};
|
|
11
|
+
}, "transformOrderedChoice"), d = /* @__PURE__ */ t((e) => {
|
|
12
|
+
const r = e.elements.map(P);
|
|
13
|
+
return r.length === 1 ? r[0] : {
|
|
14
|
+
type: "sequence",
|
|
15
|
+
elements: r
|
|
16
|
+
};
|
|
17
|
+
}, "transformSequence"), P = /* @__PURE__ */ t((e) => {
|
|
18
|
+
const r = g(e.suffix);
|
|
19
|
+
return e.operator ? {
|
|
20
|
+
type: "special",
|
|
21
|
+
text: e.operator === "&" ? `&${s(r)}` : `!${s(r)}`
|
|
22
|
+
} : r;
|
|
23
|
+
}, "transformPrefix"), s = /* @__PURE__ */ t((e) => {
|
|
24
|
+
switch (e.type) {
|
|
25
|
+
case "terminal":
|
|
26
|
+
return `"${e.value}"`;
|
|
27
|
+
case "nonterminal":
|
|
28
|
+
return e.name;
|
|
29
|
+
case "special":
|
|
30
|
+
return e.text;
|
|
31
|
+
default:
|
|
32
|
+
return "(...)";
|
|
33
|
+
}
|
|
34
|
+
}, "nodeToLabel"), g = /* @__PURE__ */ t((e) => {
|
|
35
|
+
const r = v(e.primary);
|
|
36
|
+
if (!e.operator)
|
|
37
|
+
return r;
|
|
38
|
+
switch (e.operator) {
|
|
39
|
+
case "?":
|
|
40
|
+
return { type: "optional", element: r };
|
|
41
|
+
case "*":
|
|
42
|
+
return { type: "repetition", element: r, min: 0, max: 1 / 0 };
|
|
43
|
+
case "+":
|
|
44
|
+
return { type: "repetition", element: r, min: 1, max: 1 / 0 };
|
|
45
|
+
default:
|
|
46
|
+
throw new Error(`Unsupported PEG suffix operator: ${e.operator}`);
|
|
47
|
+
}
|
|
48
|
+
}, "transformSuffix"), v = /* @__PURE__ */ t((e) => {
|
|
49
|
+
switch (e.$type) {
|
|
50
|
+
case "PegLiteral":
|
|
51
|
+
return {
|
|
52
|
+
type: "terminal",
|
|
53
|
+
value: e.value
|
|
54
|
+
};
|
|
55
|
+
case "PegIdentifier":
|
|
56
|
+
return {
|
|
57
|
+
type: "nonterminal",
|
|
58
|
+
name: e.name
|
|
59
|
+
};
|
|
60
|
+
case "PegGroup":
|
|
61
|
+
return i(e.element);
|
|
62
|
+
case "PegAny":
|
|
63
|
+
return {
|
|
64
|
+
type: "special",
|
|
65
|
+
text: e.dot
|
|
66
|
+
};
|
|
67
|
+
default:
|
|
68
|
+
throw new Error(`Unsupported PEG primary node: ${e.$type}`);
|
|
69
|
+
}
|
|
70
|
+
}, "transformPrimary"), y = /* @__PURE__ */ t((e) => ({
|
|
71
|
+
name: e.name,
|
|
72
|
+
definition: i(e.definition)
|
|
73
|
+
}), "transformRule"), h = /* @__PURE__ */ t((e) => {
|
|
74
|
+
p(e, a), e.title && a.setTitle(e.title), e.rules.map((r) => a.addRule(y(r)));
|
|
75
|
+
}, "populateDb"), b = {
|
|
76
|
+
parse: /* @__PURE__ */ t((e) => {
|
|
77
|
+
a.clear(), o.debug("[PEG Parser] Starting Langium parse");
|
|
78
|
+
const r = f.parse(e);
|
|
79
|
+
if (r.lexerErrors.length > 0 || r.parserErrors.length > 0)
|
|
80
|
+
throw new u(r);
|
|
81
|
+
const n = r.value;
|
|
82
|
+
o.debug("[PEG Parser] Parsed rules:", n.rules.length), h(n), o.debug("[PEG Parser] Parse complete");
|
|
83
|
+
}, "parse"),
|
|
84
|
+
parser: {
|
|
85
|
+
yy: a
|
|
86
|
+
}
|
|
87
|
+
}, $ = {
|
|
88
|
+
parser: b,
|
|
89
|
+
db: a,
|
|
90
|
+
renderer: m,
|
|
91
|
+
styles: l
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
$ as diagram
|
|
95
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { p as rt } from "./chunk-JWPE2WC7-BIokdAUW.js";
|
|
2
|
+
import { ae as T, a6 as O, b6 as nt, g as it, s as st, a as ot, b as lt, t as ct, q as ut, _ as d, l as B, c as gt, G as dt, K as pt, P as ht, d as ft, A as mt, H as vt } from "./index-f7Uzykhj.js";
|
|
3
|
+
import { p as xt } from "./cynefin-OW5HDTMX-Bzjecpt-.js";
|
|
4
|
+
import { d as Z } from "./arc-OroUeRL_.js";
|
|
5
|
+
import { o as St } from "./ordinal-DfAQgscy.js";
|
|
6
|
+
function yt(t, n) {
|
|
7
|
+
return n < t ? -1 : n > t ? 1 : n >= t ? 0 : NaN;
|
|
8
|
+
}
|
|
9
|
+
function wt(t) {
|
|
10
|
+
return t;
|
|
11
|
+
}
|
|
12
|
+
function At() {
|
|
13
|
+
var t = wt, n = yt, y = null, b = T(0), l = T(O), p = T(0);
|
|
14
|
+
function i(e) {
|
|
15
|
+
var r, o = (e = nt(e)).length, h, w, $ = 0, f = new Array(o), s = new Array(o), D = +b.apply(this, arguments), E = Math.min(O, Math.max(-O, l.apply(this, arguments) - D)), k, H = Math.min(Math.abs(E) / o, p.apply(this, arguments)), u = H * (E < 0 ? -1 : 1), A;
|
|
16
|
+
for (r = 0; r < o; ++r)
|
|
17
|
+
(A = s[f[r] = r] = +t(e[r], r, e)) > 0 && ($ += A);
|
|
18
|
+
for (n != null ? f.sort(function(M, m) {
|
|
19
|
+
return n(s[M], s[m]);
|
|
20
|
+
}) : y != null && f.sort(function(M, m) {
|
|
21
|
+
return y(e[M], e[m]);
|
|
22
|
+
}), r = 0, w = $ ? (E - o * u) / $ : 0; r < o; ++r, D = k)
|
|
23
|
+
h = f[r], A = s[h], k = D + (A > 0 ? A * w : 0) + u, s[h] = {
|
|
24
|
+
data: e[h],
|
|
25
|
+
index: r,
|
|
26
|
+
value: A,
|
|
27
|
+
startAngle: D,
|
|
28
|
+
endAngle: k,
|
|
29
|
+
padAngle: H
|
|
30
|
+
};
|
|
31
|
+
return s;
|
|
32
|
+
}
|
|
33
|
+
return i.value = function(e) {
|
|
34
|
+
return arguments.length ? (t = typeof e == "function" ? e : T(+e), i) : t;
|
|
35
|
+
}, i.sortValues = function(e) {
|
|
36
|
+
return arguments.length ? (n = e, y = null, i) : n;
|
|
37
|
+
}, i.sort = function(e) {
|
|
38
|
+
return arguments.length ? (y = e, n = null, i) : y;
|
|
39
|
+
}, i.startAngle = function(e) {
|
|
40
|
+
return arguments.length ? (b = typeof e == "function" ? e : T(+e), i) : b;
|
|
41
|
+
}, i.endAngle = function(e) {
|
|
42
|
+
return arguments.length ? (l = typeof e == "function" ? e : T(+e), i) : l;
|
|
43
|
+
}, i.padAngle = function(e) {
|
|
44
|
+
return arguments.length ? (p = typeof e == "function" ? e : T(+e), i) : p;
|
|
45
|
+
}, i;
|
|
46
|
+
}
|
|
47
|
+
var Ct = vt.pie, I = {
|
|
48
|
+
sections: /* @__PURE__ */ new Map(),
|
|
49
|
+
showData: !1
|
|
50
|
+
}, W = I.sections, V = I.showData, $t = structuredClone(Ct), Dt = /* @__PURE__ */ d(() => structuredClone($t), "getConfig"), Tt = /* @__PURE__ */ d(() => {
|
|
51
|
+
W = /* @__PURE__ */ new Map(), V = I.showData, mt();
|
|
52
|
+
}, "clear"), bt = /* @__PURE__ */ d(({ label: t, value: n }) => {
|
|
53
|
+
if (n < 0)
|
|
54
|
+
throw new Error(
|
|
55
|
+
`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`
|
|
56
|
+
);
|
|
57
|
+
W.has(t) || (W.set(t, n), B.debug(`added new section: ${t}, with value: ${n}`));
|
|
58
|
+
}, "addSection"), kt = /* @__PURE__ */ d(() => W, "getSections"), zt = /* @__PURE__ */ d((t) => {
|
|
59
|
+
V = t;
|
|
60
|
+
}, "setShowData"), Et = /* @__PURE__ */ d(() => V, "getShowData"), J = {
|
|
61
|
+
getConfig: Dt,
|
|
62
|
+
clear: Tt,
|
|
63
|
+
setDiagramTitle: ut,
|
|
64
|
+
getDiagramTitle: ct,
|
|
65
|
+
setAccTitle: lt,
|
|
66
|
+
getAccTitle: ot,
|
|
67
|
+
setAccDescription: st,
|
|
68
|
+
getAccDescription: it,
|
|
69
|
+
addSection: bt,
|
|
70
|
+
getSections: kt,
|
|
71
|
+
setShowData: zt,
|
|
72
|
+
getShowData: Et
|
|
73
|
+
}, Mt = /* @__PURE__ */ d((t, n) => {
|
|
74
|
+
rt(t, n), n.setShowData(t.showData), t.sections.map(n.addSection);
|
|
75
|
+
}, "populateDb"), Rt = {
|
|
76
|
+
parse: /* @__PURE__ */ d(async (t) => {
|
|
77
|
+
const n = await xt("pie", t);
|
|
78
|
+
B.debug(n), Mt(n, J);
|
|
79
|
+
}, "parse")
|
|
80
|
+
}, Ht = /* @__PURE__ */ d((t) => `
|
|
81
|
+
.pieCircle{
|
|
82
|
+
stroke: ${t.pieStrokeColor};
|
|
83
|
+
stroke-width : ${t.pieStrokeWidth};
|
|
84
|
+
opacity : ${t.pieOpacity};
|
|
85
|
+
}
|
|
86
|
+
.pieCircle.highlighted{
|
|
87
|
+
scale: 1.05;
|
|
88
|
+
opacity: 1;
|
|
89
|
+
}
|
|
90
|
+
.pieCircle.highlightedOnHover:hover{
|
|
91
|
+
transition-duration: 250ms;
|
|
92
|
+
scale: 1.05;
|
|
93
|
+
opacity: 1;
|
|
94
|
+
}
|
|
95
|
+
.pieOuterCircle{
|
|
96
|
+
stroke: ${t.pieOuterStrokeColor};
|
|
97
|
+
stroke-width: ${t.pieOuterStrokeWidth};
|
|
98
|
+
fill: none;
|
|
99
|
+
}
|
|
100
|
+
.pieTitleText {
|
|
101
|
+
text-anchor: middle;
|
|
102
|
+
font-size: ${t.pieTitleTextSize};
|
|
103
|
+
fill: ${t.pieTitleTextColor};
|
|
104
|
+
font-family: ${t.fontFamily};
|
|
105
|
+
}
|
|
106
|
+
.slice {
|
|
107
|
+
font-family: ${t.fontFamily};
|
|
108
|
+
fill: ${t.pieSectionTextColor};
|
|
109
|
+
font-size:${t.pieSectionTextSize};
|
|
110
|
+
// fill: white;
|
|
111
|
+
}
|
|
112
|
+
.legend text {
|
|
113
|
+
fill: ${t.pieLegendTextColor};
|
|
114
|
+
font-family: ${t.fontFamily};
|
|
115
|
+
font-size: ${t.pieLegendTextSize};
|
|
116
|
+
}
|
|
117
|
+
`, "getStyles"), Lt = Ht, Pt = /* @__PURE__ */ d((t) => {
|
|
118
|
+
const n = [...t.values()].reduce((l, p) => l + p, 0), y = [...t.entries()].map(([l, p]) => ({ label: l, value: p })).filter((l) => l.value / n * 100 >= 1);
|
|
119
|
+
return At().value((l) => l.value).sort(null)(y);
|
|
120
|
+
}, "createPieArcs"), Wt = /* @__PURE__ */ d((t, n, y, b) => {
|
|
121
|
+
var X;
|
|
122
|
+
B.debug(`rendering pie chart
|
|
123
|
+
` + t);
|
|
124
|
+
const l = b.db, p = gt(), i = dt(l.getConfig(), p.pie), e = 40, r = 18, o = 4, h = 450, w = h, $ = pt(n), f = $.append("g");
|
|
125
|
+
f.attr("transform", "translate(" + w / 2 + "," + h / 2 + ")");
|
|
126
|
+
const { themeVariables: s } = p;
|
|
127
|
+
let [D] = ht(s.pieOuterStrokeWidth);
|
|
128
|
+
D ?? (D = 2);
|
|
129
|
+
const E = i.legendPosition, k = i.textPosition, H = i.donutHole > 0 && i.donutHole <= 0.9 ? i.donutHole : 0, u = Math.min(w, h) / 2 - e, A = Z().innerRadius(H * u).outerRadius(u), M = Z().innerRadius(u * k).outerRadius(u * k), m = f.append("g");
|
|
130
|
+
m.append("circle").attr("cx", 0).attr("cy", 0).attr("r", u + D / 2).attr("class", "pieOuterCircle");
|
|
131
|
+
const L = l.getSections(), Q = Pt(L), Y = [
|
|
132
|
+
s.pie1,
|
|
133
|
+
s.pie2,
|
|
134
|
+
s.pie3,
|
|
135
|
+
s.pie4,
|
|
136
|
+
s.pie5,
|
|
137
|
+
s.pie6,
|
|
138
|
+
s.pie7,
|
|
139
|
+
s.pie8,
|
|
140
|
+
s.pie9,
|
|
141
|
+
s.pie10,
|
|
142
|
+
s.pie11,
|
|
143
|
+
s.pie12
|
|
144
|
+
];
|
|
145
|
+
let _ = 0;
|
|
146
|
+
L.forEach((a) => {
|
|
147
|
+
_ += a;
|
|
148
|
+
});
|
|
149
|
+
const U = Q.filter((a) => (a.data.value / _ * 100).toFixed(0) !== "0"), F = St(Y).domain([
|
|
150
|
+
...L.keys()
|
|
151
|
+
]);
|
|
152
|
+
m.selectAll("mySlices").data(U).enter().append("path").attr("d", A).attr("fill", (a) => F(a.data.label)).attr("class", (a) => {
|
|
153
|
+
let c = "pieCircle";
|
|
154
|
+
return i.highlightSlice === "hover" ? c += " highlightedOnHover" : i.highlightSlice === a.data.label && (c += " highlighted"), c;
|
|
155
|
+
}), m.selectAll("mySlices").data(U).enter().append("text").text((a) => (a.data.value / _ * 100).toFixed(0) + "%").attr("transform", (a) => "translate(" + M.centroid(a) + ")").style("text-anchor", "middle").attr("class", "slice");
|
|
156
|
+
const tt = f.append("text").text(l.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText"), R = [...L.entries()].map(([a, c]) => ({
|
|
157
|
+
label: a,
|
|
158
|
+
value: c
|
|
159
|
+
})), C = f.selectAll(".legend").data(R).enter().append("g").attr("class", "legend");
|
|
160
|
+
C.append("rect").attr("width", r).attr("height", r).style("fill", (a) => F(a.label)).style("stroke", (a) => F(a.label)), C.append("text").attr("x", r + o).attr("y", r - o).text((a) => l.getShowData() ? `${a.label} [${a.value}]` : a.label);
|
|
161
|
+
const z = Math.max(
|
|
162
|
+
...C.selectAll("text").nodes().map((a) => (a == null ? void 0 : a.getBoundingClientRect().width) ?? 0)
|
|
163
|
+
);
|
|
164
|
+
let P = h, G = w + e;
|
|
165
|
+
const g = r + o, N = R.length * g;
|
|
166
|
+
switch (E) {
|
|
167
|
+
case "center":
|
|
168
|
+
C.attr("transform", (a, c) => {
|
|
169
|
+
const v = g * R.length / 2, x = -z / 2 - (r + o), S = c * g - v;
|
|
170
|
+
return "translate(" + x + "," + S + ")";
|
|
171
|
+
});
|
|
172
|
+
break;
|
|
173
|
+
case "top":
|
|
174
|
+
P += N, C.attr("transform", (a, c) => {
|
|
175
|
+
const v = u, x = -z / 2 - (r + o), S = c * g - v;
|
|
176
|
+
return `translate(${x}, ${S})`;
|
|
177
|
+
}), m.attr("transform", () => `translate(0, ${N + g})`);
|
|
178
|
+
break;
|
|
179
|
+
case "bottom":
|
|
180
|
+
P += N, C.attr("transform", (a, c) => {
|
|
181
|
+
const v = -u - g, x = -z / 2 - (r + o), S = c * g - v;
|
|
182
|
+
return "translate(" + x + "," + S + ")";
|
|
183
|
+
});
|
|
184
|
+
break;
|
|
185
|
+
case "left":
|
|
186
|
+
G += r + o + z, C.attr("transform", (a, c) => {
|
|
187
|
+
const v = g * R.length / 2, x = -u - (r + o), S = c * g - v;
|
|
188
|
+
return "translate(" + x + "," + S + ")";
|
|
189
|
+
}), m.attr("transform", () => `translate(${z + r + o}, 0)`);
|
|
190
|
+
break;
|
|
191
|
+
case "right":
|
|
192
|
+
default:
|
|
193
|
+
G += r + o + z, C.attr("transform", (a, c) => {
|
|
194
|
+
const v = g * R.length / 2, x = 12 * r, S = c * g - v;
|
|
195
|
+
return "translate(" + x + "," + S + ")";
|
|
196
|
+
});
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
const j = ((X = tt.node()) == null ? void 0 : X.getBoundingClientRect().width) ?? 0, et = w / 2 - j / 2, at = w / 2 + j / 2, q = Math.min(0, et), K = Math.max(G, at) - q;
|
|
200
|
+
$.attr("viewBox", `${q} 0 ${K} ${P}`), ft($, P, K, i.useMaxWidth);
|
|
201
|
+
}, "draw"), _t = { draw: Wt }, Vt = {
|
|
202
|
+
parser: Rt,
|
|
203
|
+
db: J,
|
|
204
|
+
renderer: _t,
|
|
205
|
+
styles: Lt
|
|
206
|
+
};
|
|
207
|
+
export {
|
|
208
|
+
Vt as diagram
|
|
209
|
+
};
|