@ootc/markdown 0.0.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 (124) hide show
  1. package/README.md +71 -0
  2. package/dist/App.d.ts +3 -0
  3. package/dist/_baseUniq-CmByIh97.js +477 -0
  4. package/dist/_baseUniq-DbZnA0Zy.cjs +1 -0
  5. package/dist/arc-CqYH2gKU.cjs +1 -0
  6. package/dist/arc-P4OUqY7m.js +83 -0
  7. package/dist/architecture-U656AL7Q-6cHHHqek.js +5 -0
  8. package/dist/architecture-U656AL7Q-V6qXAFoi.cjs +1 -0
  9. package/dist/architectureDiagram-VXUJARFQ-BZDApGRZ.cjs +36 -0
  10. package/dist/architectureDiagram-VXUJARFQ-DTbq0Pgc.js +4661 -0
  11. package/dist/blockDiagram-VD42YOAC-DGutZIh_.js +2256 -0
  12. package/dist/blockDiagram-VD42YOAC-soxpFyvy.cjs +122 -0
  13. package/dist/c4Diagram-YG6GDRKO-DldTn1AC.cjs +10 -0
  14. package/dist/c4Diagram-YG6GDRKO-QpXNLRxa.js +1580 -0
  15. package/dist/channel-BoaXAqaa.cjs +1 -0
  16. package/dist/channel-DgzeL9lp.js +5 -0
  17. package/dist/chunk-4BX2VUAB-BbN1TOQE.js +8 -0
  18. package/dist/chunk-4BX2VUAB-pepnciBh.cjs +1 -0
  19. package/dist/chunk-55IACEB6-Bw-xUMSO.js +8 -0
  20. package/dist/chunk-55IACEB6-DaRz-4G1.cjs +1 -0
  21. package/dist/chunk-B4BG7PRW-BOo5HZb2.cjs +165 -0
  22. package/dist/chunk-B4BG7PRW-y555_VNf.js +1375 -0
  23. package/dist/chunk-DI55MBZ5-CC7gOAIq.js +1370 -0
  24. package/dist/chunk-DI55MBZ5-Cp80DPyI.cjs +220 -0
  25. package/dist/chunk-FMBD7UC4-CyGMxsm_.cjs +15 -0
  26. package/dist/chunk-FMBD7UC4-kBdBkFUs.js +19 -0
  27. package/dist/chunk-QN33PNHL-CDUpNm-w.js +19 -0
  28. package/dist/chunk-QN33PNHL-D9Dvl6xt.cjs +1 -0
  29. package/dist/chunk-QZHKN3VN-CXjz_O2D.js +15 -0
  30. package/dist/chunk-QZHKN3VN-D9OoJshW.cjs +1 -0
  31. package/dist/chunk-TZMSLE5B-BeHTvrKs.js +64 -0
  32. package/dist/chunk-TZMSLE5B-Fzhk5Bha.cjs +1 -0
  33. package/dist/classDiagram-2ON5EDUG-BE6HMf3I.cjs +1 -0
  34. package/dist/classDiagram-2ON5EDUG-dnFcLpDQ.js +16 -0
  35. package/dist/classDiagram-v2-WZHVMYZB-BE6HMf3I.cjs +1 -0
  36. package/dist/classDiagram-v2-WZHVMYZB-dnFcLpDQ.js +16 -0
  37. package/dist/clone-BjTy6OLd.js +8 -0
  38. package/dist/clone-Cg5gj9bz.cjs +1 -0
  39. package/dist/components/code-block/CodeBlock.d.ts +7 -0
  40. package/dist/components/markdown/MarkdownPreview.d.ts +6 -0
  41. package/dist/components/markdown-editor/MarkdownEditor.d.ts +14 -0
  42. package/dist/cose-bilkent-S5V4N54A-Dnuw2lm0.js +2608 -0
  43. package/dist/cose-bilkent-S5V4N54A-DtNtaVNw.cjs +1 -0
  44. package/dist/cytoscape.esm-CNUX3VTg.cjs +321 -0
  45. package/dist/cytoscape.esm-Cvf3sx9F.js +18704 -0
  46. package/dist/dagre-6UL2VRFP-B32dxrXp.cjs +4 -0
  47. package/dist/dagre-6UL2VRFP-LREPxcCl.js +443 -0
  48. package/dist/defaultLocale-D7EN2tov.js +171 -0
  49. package/dist/defaultLocale-DIVzfLaQ.cjs +1 -0
  50. package/dist/diagram-PSM6KHXK-Cf13EIH6.cjs +24 -0
  51. package/dist/diagram-PSM6KHXK-M_g-TqeQ.js +531 -0
  52. package/dist/diagram-QEK2KX5R-CFkmV-39.cjs +43 -0
  53. package/dist/diagram-QEK2KX5R-JLqznep2.js +217 -0
  54. package/dist/diagram-S2PKOQOG-BOaTYwMN.js +142 -0
  55. package/dist/diagram-S2PKOQOG-DpzBD9Yg.cjs +24 -0
  56. package/dist/erDiagram-Q2GNP2WA-BcW_Ecbb.js +841 -0
  57. package/dist/erDiagram-Q2GNP2WA-DTICvh6_.cjs +60 -0
  58. package/dist/flowDiagram-NV44I4VS-B9c84FVd.cjs +162 -0
  59. package/dist/flowDiagram-NV44I4VS-jT61p3lw.js +1620 -0
  60. package/dist/ganttDiagram-JELNMOA3-DuRzmL9H.js +2670 -0
  61. package/dist/ganttDiagram-JELNMOA3-mz4uZSth.cjs +267 -0
  62. package/dist/gitGraph-F6HP7TQM-CsjmvPr2.js +5 -0
  63. package/dist/gitGraph-F6HP7TQM-GY_paNbs.cjs +1 -0
  64. package/dist/gitGraphDiagram-NY62KEGX-CXHGxqGK.cjs +65 -0
  65. package/dist/gitGraphDiagram-NY62KEGX-hi4kToFw.js +699 -0
  66. package/dist/graph-BOJ0IDo-.cjs +1 -0
  67. package/dist/graph-DL6uRNBw.js +381 -0
  68. package/dist/index-CfX9mOGt.js +76553 -0
  69. package/dist/index-LcNG2fSO.cjs +4476 -0
  70. package/dist/index.cjs +1 -0
  71. package/dist/index.d.ts +4 -0
  72. package/dist/index.js +6 -0
  73. package/dist/info-NVLQJR56-Be7kg4BO.cjs +1 -0
  74. package/dist/info-NVLQJR56-DOR5vIC3.js +5 -0
  75. package/dist/infoDiagram-WHAUD3N6-C1I5XUAF.cjs +2 -0
  76. package/dist/infoDiagram-WHAUD3N6-Uqzkt-ke.js +24 -0
  77. package/dist/init-CHZsXQcr.cjs +1 -0
  78. package/dist/init-DjUOC4st.js +16 -0
  79. package/dist/journeyDiagram-XKPGCS4Q-Df75meAE.cjs +139 -0
  80. package/dist/journeyDiagram-XKPGCS4Q-fZwA-sTb.js +834 -0
  81. package/dist/kanban-definition-3W4ZIXB7-Co2aFx_7.cjs +89 -0
  82. package/dist/kanban-definition-3W4ZIXB7-UJXsSu5a.js +719 -0
  83. package/dist/layout-CVDv0xAA.cjs +1 -0
  84. package/dist/layout-DPFlBmh8.js +1441 -0
  85. package/dist/linear-CVAvFblR.js +259 -0
  86. package/dist/linear-D4iyxOBD.cjs +1 -0
  87. package/dist/main.d.ts +1 -0
  88. package/dist/markdown.css +1 -0
  89. package/dist/mermaid-parser.core-BX02_VdY.cjs +128 -0
  90. package/dist/mermaid-parser.core-Cd6mtI-m.js +14177 -0
  91. package/dist/min-CQa2qkIc.cjs +1 -0
  92. package/dist/min-Cd_KRtKa.js +38 -0
  93. package/dist/mindmap-definition-VGOIOE7T-C8nL6vkC.cjs +68 -0
  94. package/dist/mindmap-definition-VGOIOE7T-DRUWSVR5.js +784 -0
  95. package/dist/ordinal-B6-f3MAq.js +61 -0
  96. package/dist/ordinal-CagbB1m8.cjs +1 -0
  97. package/dist/packet-BFZMPI3H-C6tSs5m6.cjs +1 -0
  98. package/dist/packet-BFZMPI3H-Cx5usFnM.js +5 -0
  99. package/dist/pie-7BOR55EZ-DP4BthZG.js +5 -0
  100. package/dist/pie-7BOR55EZ-DtH8VGZc.cjs +1 -0
  101. package/dist/pieDiagram-ADFJNKIX-DY_5Mv8-.js +161 -0
  102. package/dist/pieDiagram-ADFJNKIX-Dc4t856R.cjs +30 -0
  103. package/dist/quadrantDiagram-AYHSOK5B-CBI5Wy1U.js +1022 -0
  104. package/dist/quadrantDiagram-AYHSOK5B-DaTE2tb0.cjs +7 -0
  105. package/dist/radar-NHE76QYJ-BWTKsaYZ.js +5 -0
  106. package/dist/radar-NHE76QYJ-OTg6j9Ym.cjs +1 -0
  107. package/dist/requirementDiagram-UZGBJVZJ-CG803BAU.cjs +64 -0
  108. package/dist/requirementDiagram-UZGBJVZJ-DEqbxj2n.js +850 -0
  109. package/dist/sankeyDiagram-TZEHDZUN-CFuyXQgm.js +810 -0
  110. package/dist/sankeyDiagram-TZEHDZUN-CzYHCt7i.cjs +10 -0
  111. package/dist/sequenceDiagram-WL72ISMW-BFw44mdP.cjs +145 -0
  112. package/dist/sequenceDiagram-WL72ISMW-iHSKbbMD.js +2511 -0
  113. package/dist/stateDiagram-FKZM4ZOC-6bXnATbP.js +263 -0
  114. package/dist/stateDiagram-FKZM4ZOC-xbm_OqyO.cjs +1 -0
  115. package/dist/stateDiagram-v2-4FDKWEC3-C3_4Aa2a.cjs +1 -0
  116. package/dist/stateDiagram-v2-4FDKWEC3-DaI_jMiy.js +16 -0
  117. package/dist/timeline-definition-IT6M3QCI-DIY0C5ia.cjs +61 -0
  118. package/dist/timeline-definition-IT6M3QCI-Di6lzZ5a.js +795 -0
  119. package/dist/treemap-KMMF4GRG-DCEZaQ8b.js +5 -0
  120. package/dist/treemap-KMMF4GRG-DFBRro1E.cjs +1 -0
  121. package/dist/vite.svg +1 -0
  122. package/dist/xychartDiagram-PRI3JC2R-CHOmHjlE.js +1340 -0
  123. package/dist/xychartDiagram-PRI3JC2R-D0ITDP0x.cjs +7 -0
  124. package/package.json +69 -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 = /* @__PURE__ */ 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 @@
1
+ "use strict";const l=require("./init-CHZsXQcr.cjs");class o extends Map{constructor(n,t=p){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),n!=null)for(const[r,s]of n)this.set(r,s)}get(n){return super.get(c(this,n))}has(n){return super.has(c(this,n))}set(n,t){return super.set(g(this,n),t)}delete(n){return super.delete(h(this,n))}}function c({_intern:e,_key:n},t){const r=n(t);return e.has(r)?e.get(r):t}function g({_intern:e,_key:n},t){const r=n(t);return e.has(r)?e.get(r):(e.set(r,t),t)}function h({_intern:e,_key:n},t){const r=n(t);return e.has(r)&&(t=e.get(r),e.delete(r)),t}function p(e){return e!==null&&typeof e=="object"?e.valueOf():e}const f=Symbol("implicit");function a(){var e=new o,n=[],t=[],r=f;function s(i){let u=e.get(i);if(u===void 0){if(r!==f)return r;e.set(i,u=n.push(i)-1)}return t[u%t.length]}return s.domain=function(i){if(!arguments.length)return n.slice();n=[],e=new o;for(const u of i)e.has(u)||e.set(u,n.push(u)-1);return s},s.range=function(i){return arguments.length?(t=Array.from(i),s):t.slice()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return a(n,t).unknown(r)},l.initRange.apply(s,arguments),s}exports.ordinal=a;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./mermaid-parser.core-BX02_VdY.cjs");exports.PacketModule=e.PacketModule;exports.createPacketServices=e.createPacketServices;
@@ -0,0 +1,5 @@
1
+ import { P as c, a as r } from "./mermaid-parser.core-Cd6mtI-m.js";
2
+ export {
3
+ c as PacketModule,
4
+ r as createPacketServices
5
+ };
@@ -0,0 +1,5 @@
1
+ import { b as a, d as i } from "./mermaid-parser.core-Cd6mtI-m.js";
2
+ export {
3
+ a as PieModule,
4
+ i as createPieServices
5
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./mermaid-parser.core-BX02_VdY.cjs");exports.PieModule=e.PieModule;exports.createPieServices=e.createPieServices;
@@ -0,0 +1,161 @@
1
+ import { a4 as S, a7 as F, aB as j, _ as p, g as q, s as H, a as Z, b as J, q as K, p as Q, l as z, c as X, D as Y, H as ee, N as te, e as ae, y as re, F as ne } from "./index-CfX9mOGt.js";
2
+ import { p as ie } from "./chunk-4BX2VUAB-BbN1TOQE.js";
3
+ import { p as se } from "./mermaid-parser.core-Cd6mtI-m.js";
4
+ import { d as I } from "./arc-P4OUqY7m.js";
5
+ import { o as le } from "./ordinal-B6-f3MAq.js";
6
+ function oe(e, a) {
7
+ return a < e ? -1 : a > e ? 1 : a >= e ? 0 : NaN;
8
+ }
9
+ function ce(e) {
10
+ return e;
11
+ }
12
+ function ue() {
13
+ var e = ce, a = oe, f = null, y = S(0), s = S(F), o = S(0);
14
+ function l(t) {
15
+ var n, c = (t = j(t)).length, d, x, m = 0, u = new Array(c), i = new Array(c), v = +y.apply(this, arguments), w = Math.min(F, Math.max(-F, s.apply(this, arguments) - v)), h, C = Math.min(Math.abs(w) / c, o.apply(this, arguments)), $ = C * (w < 0 ? -1 : 1), g;
16
+ for (n = 0; n < c; ++n)
17
+ (g = i[u[n] = n] = +e(t[n], n, t)) > 0 && (m += g);
18
+ for (a != null ? u.sort(function(A, D) {
19
+ return a(i[A], i[D]);
20
+ }) : f != null && u.sort(function(A, D) {
21
+ return f(t[A], t[D]);
22
+ }), n = 0, x = m ? (w - c * $) / m : 0; n < c; ++n, v = h)
23
+ d = u[n], g = i[d], h = v + (g > 0 ? g * x : 0) + $, i[d] = {
24
+ data: t[d],
25
+ index: n,
26
+ value: g,
27
+ startAngle: v,
28
+ endAngle: h,
29
+ padAngle: C
30
+ };
31
+ return i;
32
+ }
33
+ return l.value = function(t) {
34
+ return arguments.length ? (e = typeof t == "function" ? t : S(+t), l) : e;
35
+ }, l.sortValues = function(t) {
36
+ return arguments.length ? (a = t, f = null, l) : a;
37
+ }, l.sort = function(t) {
38
+ return arguments.length ? (f = t, a = null, l) : f;
39
+ }, l.startAngle = function(t) {
40
+ return arguments.length ? (y = typeof t == "function" ? t : S(+t), l) : y;
41
+ }, l.endAngle = function(t) {
42
+ return arguments.length ? (s = typeof t == "function" ? t : S(+t), l) : s;
43
+ }, l.padAngle = function(t) {
44
+ return arguments.length ? (o = typeof t == "function" ? t : S(+t), l) : o;
45
+ }, l;
46
+ }
47
+ var pe = ne.pie, N = {
48
+ sections: /* @__PURE__ */ new Map(),
49
+ showData: !1
50
+ }, T = N.sections, G = N.showData, de = structuredClone(pe), ge = /* @__PURE__ */ p(() => structuredClone(de), "getConfig"), fe = /* @__PURE__ */ p(() => {
51
+ T = /* @__PURE__ */ new Map(), G = N.showData, re();
52
+ }, "clear"), he = /* @__PURE__ */ p(({ label: e, value: a }) => {
53
+ if (a < 0)
54
+ throw new Error(
55
+ `"${e}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`
56
+ );
57
+ T.has(e) || (T.set(e, a), z.debug(`added new section: ${e}, with value: ${a}`));
58
+ }, "addSection"), me = /* @__PURE__ */ p(() => T, "getSections"), ve = /* @__PURE__ */ p((e) => {
59
+ G = e;
60
+ }, "setShowData"), Se = /* @__PURE__ */ p(() => G, "getShowData"), L = {
61
+ getConfig: ge,
62
+ clear: fe,
63
+ setDiagramTitle: Q,
64
+ getDiagramTitle: K,
65
+ setAccTitle: J,
66
+ getAccTitle: Z,
67
+ setAccDescription: H,
68
+ getAccDescription: q,
69
+ addSection: he,
70
+ getSections: me,
71
+ setShowData: ve,
72
+ getShowData: Se
73
+ }, ye = /* @__PURE__ */ p((e, a) => {
74
+ ie(e, a), a.setShowData(e.showData), e.sections.map(a.addSection);
75
+ }, "populateDb"), xe = {
76
+ parse: /* @__PURE__ */ p(async (e) => {
77
+ const a = await se("pie", e);
78
+ z.debug(a), ye(a, L);
79
+ }, "parse")
80
+ }, we = /* @__PURE__ */ p((e) => `
81
+ .pieCircle{
82
+ stroke: ${e.pieStrokeColor};
83
+ stroke-width : ${e.pieStrokeWidth};
84
+ opacity : ${e.pieOpacity};
85
+ }
86
+ .pieOuterCircle{
87
+ stroke: ${e.pieOuterStrokeColor};
88
+ stroke-width: ${e.pieOuterStrokeWidth};
89
+ fill: none;
90
+ }
91
+ .pieTitleText {
92
+ text-anchor: middle;
93
+ font-size: ${e.pieTitleTextSize};
94
+ fill: ${e.pieTitleTextColor};
95
+ font-family: ${e.fontFamily};
96
+ }
97
+ .slice {
98
+ font-family: ${e.fontFamily};
99
+ fill: ${e.pieSectionTextColor};
100
+ font-size:${e.pieSectionTextSize};
101
+ // fill: white;
102
+ }
103
+ .legend text {
104
+ fill: ${e.pieLegendTextColor};
105
+ font-family: ${e.fontFamily};
106
+ font-size: ${e.pieLegendTextSize};
107
+ }
108
+ `, "getStyles"), Ae = we, De = /* @__PURE__ */ p((e) => {
109
+ const a = [...e.values()].reduce((s, o) => s + o, 0), f = [...e.entries()].map(([s, o]) => ({ label: s, value: o })).filter((s) => s.value / a * 100 >= 1).sort((s, o) => o.value - s.value);
110
+ return ue().value((s) => s.value)(f);
111
+ }, "createPieArcs"), Ce = /* @__PURE__ */ p((e, a, f, y) => {
112
+ z.debug(`rendering pie chart
113
+ ` + e);
114
+ const s = y.db, o = X(), l = Y(s.getConfig(), o.pie), t = 40, n = 18, c = 4, d = 450, x = d, m = ee(a), u = m.append("g");
115
+ u.attr("transform", "translate(" + x / 2 + "," + d / 2 + ")");
116
+ const { themeVariables: i } = o;
117
+ let [v] = te(i.pieOuterStrokeWidth);
118
+ v ??= 2;
119
+ const w = l.textPosition, h = Math.min(x, d) / 2 - t, C = I().innerRadius(0).outerRadius(h), $ = I().innerRadius(h * w).outerRadius(h * w);
120
+ u.append("circle").attr("cx", 0).attr("cy", 0).attr("r", h + v / 2).attr("class", "pieOuterCircle");
121
+ const g = s.getSections(), A = De(g), D = [
122
+ i.pie1,
123
+ i.pie2,
124
+ i.pie3,
125
+ i.pie4,
126
+ i.pie5,
127
+ i.pie6,
128
+ i.pie7,
129
+ i.pie8,
130
+ i.pie9,
131
+ i.pie10,
132
+ i.pie11,
133
+ i.pie12
134
+ ];
135
+ let b = 0;
136
+ g.forEach((r) => {
137
+ b += r;
138
+ });
139
+ const W = A.filter((r) => (r.data.value / b * 100).toFixed(0) !== "0"), E = le(D);
140
+ u.selectAll("mySlices").data(W).enter().append("path").attr("d", C).attr("fill", (r) => E(r.data.label)).attr("class", "pieCircle"), u.selectAll("mySlices").data(W).enter().append("text").text((r) => (r.data.value / b * 100).toFixed(0) + "%").attr("transform", (r) => "translate(" + $.centroid(r) + ")").style("text-anchor", "middle").attr("class", "slice"), u.append("text").text(s.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText");
141
+ const O = [...g.entries()].map(([r, M]) => ({
142
+ label: r,
143
+ value: M
144
+ })), k = u.selectAll(".legend").data(O).enter().append("g").attr("class", "legend").attr("transform", (r, M) => {
145
+ const R = n + c, B = R * O.length / 2, V = 12 * n, U = M * R - B;
146
+ return "translate(" + V + "," + U + ")";
147
+ });
148
+ k.append("rect").attr("width", n).attr("height", n).style("fill", (r) => E(r.label)).style("stroke", (r) => E(r.label)), k.append("text").attr("x", n + c).attr("y", n - c).text((r) => s.getShowData() ? `${r.label} [${r.value}]` : r.label);
149
+ const _ = Math.max(
150
+ ...k.selectAll("text").nodes().map((r) => r?.getBoundingClientRect().width ?? 0)
151
+ ), P = x + t + n + c + _;
152
+ m.attr("viewBox", `0 0 ${P} ${d}`), ae(m, d, P, l.useMaxWidth);
153
+ }, "draw"), $e = { draw: Ce }, Fe = {
154
+ parser: xe,
155
+ db: L,
156
+ renderer: $e,
157
+ styles: Ae
158
+ };
159
+ export {
160
+ Fe as diagram
161
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-LcNG2fSO.cjs"),q=require("./chunk-4BX2VUAB-pepnciBh.cjs"),B=require("./mermaid-parser.core-BX02_VdY.cjs"),N=require("./arc-CqYH2gKU.cjs"),V=require("./ordinal-CagbB1m8.cjs");function U(e,n){return n<e?-1:n>e?1:n>=e?0:NaN}function j(e){return e}function X(){var e=j,n=U,f=null,S=t.constant(0),s=t.constant(t.tau),c=t.constant(0);function o(a){var i,u=(a=t.array(a)).length,d,y,h=0,g=new Array(u),l=new Array(u),v=+S.apply(this,arguments),A=Math.min(t.tau,Math.max(-t.tau,s.apply(this,arguments)-v)),m,w=Math.min(Math.abs(A)/u,c.apply(this,arguments)),T=w*(A<0?-1:1),p;for(i=0;i<u;++i)(p=l[g[i]=i]=+e(a[i],i,a))>0&&(h+=p);for(n!=null?g.sort(function(x,D){return n(l[x],l[D])}):f!=null&&g.sort(function(x,D){return f(a[x],a[D])}),i=0,y=h?(A-u*T)/h:0;i<u;++i,v=m)d=g[i],p=l[d],m=v+(p>0?p*y:0)+T,l[d]={data:a[d],index:i,value:p,startAngle:v,endAngle:m,padAngle:w};return l}return o.value=function(a){return arguments.length?(e=typeof a=="function"?a:t.constant(+a),o):e},o.sortValues=function(a){return arguments.length?(n=a,f=null,o):n},o.sort=function(a){return arguments.length?(f=a,n=null,o):f},o.startAngle=function(a){return arguments.length?(S=typeof a=="function"?a:t.constant(+a),o):S},o.endAngle=function(a){return arguments.length?(s=typeof a=="function"?a:t.constant(+a),o):s},o.padAngle=function(a){return arguments.length?(c=typeof a=="function"?a:t.constant(+a),o):c},o}var Z=t.defaultConfig_default.pie,E={sections:new Map,showData:!1},_=E.sections,M=E.showData,H=structuredClone(Z),J=t.__name(()=>structuredClone(H),"getConfig"),K=t.__name(()=>{_=new Map,M=E.showData,t.clear()},"clear"),Q=t.__name(({label:e,value:n})=>{if(n<0)throw new Error(`"${e}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);_.has(e)||(_.set(e,n),t.log.debug(`added new section: ${e}, with value: ${n}`))},"addSection"),Y=t.__name(()=>_,"getSections"),ee=t.__name(e=>{M=e},"setShowData"),te=t.__name(()=>M,"getShowData"),O={getConfig:J,clear:K,setDiagramTitle:t.setDiagramTitle,getDiagramTitle:t.getDiagramTitle,setAccTitle:t.setAccTitle,getAccTitle:t.getAccTitle,setAccDescription:t.setAccDescription,getAccDescription:t.getAccDescription,addSection:Q,getSections:Y,setShowData:ee,getShowData:te},ae=t.__name((e,n)=>{q.populateCommonDb(e,n),n.setShowData(e.showData),e.sections.map(n.addSection)},"populateDb"),ne={parse:t.__name(async e=>{const n=await B.parse("pie",e);t.log.debug(n),ae(n,O)},"parse")},re=t.__name(e=>`
2
+ .pieCircle{
3
+ stroke: ${e.pieStrokeColor};
4
+ stroke-width : ${e.pieStrokeWidth};
5
+ opacity : ${e.pieOpacity};
6
+ }
7
+ .pieOuterCircle{
8
+ stroke: ${e.pieOuterStrokeColor};
9
+ stroke-width: ${e.pieOuterStrokeWidth};
10
+ fill: none;
11
+ }
12
+ .pieTitleText {
13
+ text-anchor: middle;
14
+ font-size: ${e.pieTitleTextSize};
15
+ fill: ${e.pieTitleTextColor};
16
+ font-family: ${e.fontFamily};
17
+ }
18
+ .slice {
19
+ font-family: ${e.fontFamily};
20
+ fill: ${e.pieSectionTextColor};
21
+ font-size:${e.pieSectionTextSize};
22
+ // fill: white;
23
+ }
24
+ .legend text {
25
+ fill: ${e.pieLegendTextColor};
26
+ font-family: ${e.fontFamily};
27
+ font-size: ${e.pieLegendTextSize};
28
+ }
29
+ `,"getStyles"),ie=re,le=t.__name(e=>{const n=[...e.values()].reduce((s,c)=>s+c,0),f=[...e.entries()].map(([s,c])=>({label:s,value:c})).filter(s=>s.value/n*100>=1).sort((s,c)=>c.value-s.value);return X().value(s=>s.value)(f)},"createPieArcs"),se=t.__name((e,n,f,S)=>{t.log.debug(`rendering pie chart
30
+ `+e);const s=S.db,c=t.getConfig2(),o=t.cleanAndMerge(s.getConfig(),c.pie),a=40,i=18,u=4,d=450,y=d,h=t.selectSvgElement(n),g=h.append("g");g.attr("transform","translate("+y/2+","+d/2+")");const{themeVariables:l}=c;let[v]=t.parseFontSize(l.pieOuterStrokeWidth);v??=2;const A=o.textPosition,m=Math.min(y,d)/2-a,w=N.d3arc().innerRadius(0).outerRadius(m),T=N.d3arc().innerRadius(m*A).outerRadius(m*A);g.append("circle").attr("cx",0).attr("cy",0).attr("r",m+v/2).attr("class","pieOuterCircle");const p=s.getSections(),x=le(p),D=[l.pie1,l.pie2,l.pie3,l.pie4,l.pie5,l.pie6,l.pie7,l.pie8,l.pie9,l.pie10,l.pie11,l.pie12];let C=0;p.forEach(r=>{C+=r});const z=x.filter(r=>(r.data.value/C*100).toFixed(0)!=="0"),$=V.ordinal(D);g.selectAll("mySlices").data(z).enter().append("path").attr("d",w).attr("fill",r=>$(r.data.label)).attr("class","pieCircle"),g.selectAll("mySlices").data(z).enter().append("text").text(r=>(r.data.value/C*100).toFixed(0)+"%").attr("transform",r=>"translate("+T.centroid(r)+")").style("text-anchor","middle").attr("class","slice"),g.append("text").text(s.getDiagramTitle()).attr("x",0).attr("y",-400/2).attr("class","pieTitleText");const F=[...p.entries()].map(([r,k])=>({label:r,value:k})),b=g.selectAll(".legend").data(F).enter().append("g").attr("class","legend").attr("transform",(r,k)=>{const G=i+u,R=G*F.length/2,I=12*i,L=k*G-R;return"translate("+I+","+L+")"});b.append("rect").attr("width",i).attr("height",i).style("fill",r=>$(r.label)).style("stroke",r=>$(r.label)),b.append("text").attr("x",i+u).attr("y",i-u).text(r=>s.getShowData()?`${r.label} [${r.value}]`:r.label);const W=Math.max(...b.selectAll("text").nodes().map(r=>r?.getBoundingClientRect().width??0)),P=y+a+i+u+W;h.attr("viewBox",`0 0 ${P} ${d}`),t.configureSvgSize(h,d,P,o.useMaxWidth)},"draw"),oe={draw:se},ce={parser:ne,db:O,renderer:oe,styles:ie};exports.diagram=ce;