bg-editor 0.0.7 → 0.0.8

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 (58) hide show
  1. package/dist/umo-editor.js +89809 -7
  2. package/package.json +21 -1
  3. package/dist/_baseUniq-CK68Es8H.js +0 -473
  4. package/dist/arc-cD-4ba7d.js +0 -84
  5. package/dist/architecture-U656AL7Q-jxTBuJdN.js +0 -6
  6. package/dist/architectureDiagram-VXUJARFQ-D3XlpFhb.js +0 -4660
  7. package/dist/blockDiagram-VD42YOAC-BslbvMOG.js +0 -2262
  8. package/dist/c4Diagram-YG6GDRKO-DD3uWYPM.js +0 -1581
  9. package/dist/channel-DjTSKqWx.js +0 -6
  10. package/dist/chunk-4BX2VUAB-lfhsh4gk.js +0 -9
  11. package/dist/chunk-55IACEB6-O42zw0MT.js +0 -9
  12. package/dist/chunk-B4BG7PRW-CAose2Ox.js +0 -1376
  13. package/dist/chunk-DI55MBZ5-DkOlwdzs.js +0 -1371
  14. package/dist/chunk-FMBD7UC4-XviEvZms.js +0 -20
  15. package/dist/chunk-QN33PNHL-CNGSzgpw.js +0 -20
  16. package/dist/chunk-QZHKN3VN-CRgLUJXR.js +0 -16
  17. package/dist/chunk-TZMSLE5B-BkHNUxTN.js +0 -65
  18. package/dist/classDiagram-2ON5EDUG-Cakz_SCw.js +0 -17
  19. package/dist/classDiagram-v2-WZHVMYZB-Cakz_SCw.js +0 -17
  20. package/dist/clone-CIrbb4_D.js +0 -9
  21. package/dist/cose-bilkent-S5V4N54A-EoSlB5N_.js +0 -2606
  22. package/dist/cytoscape.esm-DoU_GB5M.js +0 -18732
  23. package/dist/dagre-6UL2VRFP-BPH1NIvl.js +0 -444
  24. package/dist/defaultLocale-DEnRyJdC.js +0 -172
  25. package/dist/diagram-PSM6KHXK-DCRoLhFv.js +0 -396
  26. package/dist/diagram-QEK2KX5R-2gxFpsCA.js +0 -218
  27. package/dist/diagram-S2PKOQOG-BIPpN2G8.js +0 -143
  28. package/dist/erDiagram-Q2GNP2WA-pfb2dpnp.js +0 -842
  29. package/dist/flowDiagram-NV44I4VS-Dv631-Fh.js +0 -1621
  30. package/dist/ganttDiagram-LVOFAZNH-BOKYXijK.js +0 -2500
  31. package/dist/gitGraph-F6HP7TQM-CRerkbyh.js +0 -6
  32. package/dist/gitGraphDiagram-NY62KEGX-CgO9x7O1.js +0 -700
  33. package/dist/graph-CG-rVaun.js +0 -382
  34. package/dist/index-LPeu-5gp.js +0 -164788
  35. package/dist/info-NVLQJR56-CZcMDuD4.js +0 -6
  36. package/dist/infoDiagram-ER5ION4S-CpfjxDXT.js +0 -25
  37. package/dist/init-Dbt-6wo9.js +0 -17
  38. package/dist/journeyDiagram-XKPGCS4Q-D4m1xk_j.js +0 -837
  39. package/dist/kanban-definition-3W4ZIXB7-GUMW-GDO.js +0 -719
  40. package/dist/layout-C7pGfQvF.js +0 -1416
  41. package/dist/linear-CQdBpz9H.js +0 -260
  42. package/dist/mermaid-parser.core-C3Lk4un7.js +0 -14143
  43. package/dist/min-D7xNMq31.js +0 -39
  44. package/dist/mindmap-definition-VGOIOE7T-GfQh2q9s.js +0 -784
  45. package/dist/ordinal-mgyNSFm_.js +0 -62
  46. package/dist/packet-BFZMPI3H-DughJE3g.js +0 -6
  47. package/dist/pie-7BOR55EZ-B1py7mee.js +0 -6
  48. package/dist/pieDiagram-ADFJNKIX-DENmX4xL.js +0 -162
  49. package/dist/quadrantDiagram-AYHSOK5B-BFVycH-W.js +0 -1023
  50. package/dist/radar-NHE76QYJ-DuTW4rXt.js +0 -6
  51. package/dist/requirementDiagram-UZGBJVZJ-f8rb43Mp.js +0 -851
  52. package/dist/sankeyDiagram-TZEHDZUN-CUN0tZ5p.js +0 -811
  53. package/dist/sequenceDiagram-WL72ISMW-7X4nul9T.js +0 -2512
  54. package/dist/stateDiagram-FKZM4ZOC-CypL793K.js +0 -264
  55. package/dist/stateDiagram-v2-4FDKWEC3-D5vS5FM5.js +0 -17
  56. package/dist/timeline-definition-IT6M3QCI-B_WOoOGO.js +0 -798
  57. package/dist/treemap-KMMF4GRG-BzINyJBJ.js +0 -6
  58. package/dist/xychartDiagram-PRI3JC2R-Llw16NDY.js +0 -1341
@@ -1,396 +0,0 @@
1
- import "./style.css";
2
- import { _ as w, D as Q, E as ee, H as ce, e as de, l as J, aM as pe, aN as E, d as j, b as ue, a as he, p as fe, q as me, g as ge, s as ye, F as Se, aO as xe, y as ve } from "./index-LPeu-5gp.js";
3
- import { s as be } from "./chunk-QN33PNHL-CNGSzgpw.js";
4
- import { p as we } from "./chunk-4BX2VUAB-lfhsh4gk.js";
5
- import { p as Ce } from "./mermaid-parser.core-C3Lk4un7.js";
6
- import { f as O } from "./defaultLocale-DEnRyJdC.js";
7
- import { o as Z } from "./ordinal-mgyNSFm_.js";
8
- function Te(r) {
9
- if (typeof r != "function") throw new Error();
10
- return r;
11
- }
12
- function q() {
13
- return 0;
14
- }
15
- function G(r) {
16
- return function() {
17
- return r;
18
- };
19
- }
20
- function Le(r) {
21
- r.x0 = Math.round(r.x0), r.y0 = Math.round(r.y0), r.x1 = Math.round(r.x1), r.y1 = Math.round(r.y1);
22
- }
23
- function $e(r, l, o, i, p) {
24
- for (var s = r.children, c, h = -1, v = s.length, n = r.value && (i - l) / r.value; ++h < v; )
25
- c = s[h], c.y0 = o, c.y1 = p, c.x0 = l, c.x1 = l += c.value * n;
26
- }
27
- function Fe(r, l, o, i, p) {
28
- for (var s = r.children, c, h = -1, v = s.length, n = r.value && (p - o) / r.value; ++h < v; )
29
- c = s[h], c.x0 = l, c.x1 = i, c.y0 = o, c.y1 = o += c.value * n;
30
- }
31
- var Me = (1 + Math.sqrt(5)) / 2;
32
- function Ne(r, l, o, i, p, s) {
33
- for (var c = [], h = l.children, v, n, d = 0, b = 0, t = h.length, x, y, S = l.value, u, m, k, N, D, B, z; d < t; ) {
34
- x = p - o, y = s - i;
35
- do
36
- u = h[b++].value;
37
- while (!u && b < t);
38
- for (m = k = u, B = Math.max(y / x, x / y) / (S * r), z = u * u * B, D = Math.max(k / z, z / m); b < t; ++b) {
39
- if (u += n = h[b].value, n < m && (m = n), n > k && (k = n), z = u * u * B, N = Math.max(k / z, z / m), N > D) {
40
- u -= n;
41
- break;
42
- }
43
- D = N;
44
- }
45
- c.push(v = { value: u, dice: x < y, children: h.slice(d, b) }), v.dice ? $e(v, o, i, p, S ? i += y * u / S : s) : Fe(v, o, i, S ? o += x * u / S : p, s), S -= u, d = b;
46
- }
47
- return c;
48
- }
49
- const ke = function r(l) {
50
- function o(i, p, s, c, h) {
51
- Ne(l, i, p, s, c, h);
52
- }
53
- return o.ratio = function(i) {
54
- return r((i = +i) > 1 ? i : 1);
55
- }, o;
56
- }(Me);
57
- function ze() {
58
- var r = ke, l = !1, o = 1, i = 1, p = [0], s = q, c = q, h = q, v = q, n = q;
59
- function d(t) {
60
- return t.x0 = t.y0 = 0, t.x1 = o, t.y1 = i, t.eachBefore(b), p = [0], l && t.eachBefore(Le), t;
61
- }
62
- function b(t) {
63
- var x = p[t.depth], y = t.x0 + x, S = t.y0 + x, u = t.x1 - x, m = t.y1 - x;
64
- u < y && (y = u = (y + u) / 2), m < S && (S = m = (S + m) / 2), t.x0 = y, t.y0 = S, t.x1 = u, t.y1 = m, t.children && (x = p[t.depth + 1] = s(t) / 2, y += n(t) - x, S += c(t) - x, u -= h(t) - x, m -= v(t) - x, u < y && (y = u = (y + u) / 2), m < S && (S = m = (S + m) / 2), r(t, y, S, u, m));
65
- }
66
- return d.round = function(t) {
67
- return arguments.length ? (l = !!t, d) : l;
68
- }, d.size = function(t) {
69
- return arguments.length ? (o = +t[0], i = +t[1], d) : [o, i];
70
- }, d.tile = function(t) {
71
- return arguments.length ? (r = Te(t), d) : r;
72
- }, d.padding = function(t) {
73
- return arguments.length ? d.paddingInner(t).paddingOuter(t) : d.paddingInner();
74
- }, d.paddingInner = function(t) {
75
- return arguments.length ? (s = typeof t == "function" ? t : G(+t), d) : s;
76
- }, d.paddingOuter = function(t) {
77
- return arguments.length ? d.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t) : d.paddingTop();
78
- }, d.paddingTop = function(t) {
79
- return arguments.length ? (c = typeof t == "function" ? t : G(+t), d) : c;
80
- }, d.paddingRight = function(t) {
81
- return arguments.length ? (h = typeof t == "function" ? t : G(+t), d) : h;
82
- }, d.paddingBottom = function(t) {
83
- return arguments.length ? (v = typeof t == "function" ? t : G(+t), d) : v;
84
- }, d.paddingLeft = function(t) {
85
- return arguments.length ? (n = typeof t == "function" ? t : G(+t), d) : n;
86
- }, d;
87
- }
88
- var W, te = (W = class {
89
- constructor() {
90
- this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = ue, this.getAccTitle = he, this.setDiagramTitle = fe, this.getDiagramTitle = me, this.getAccDescription = ge, this.setAccDescription = ye;
91
- }
92
- getNodes() {
93
- return this.nodes;
94
- }
95
- getConfig() {
96
- const l = Se, o = ee();
97
- return Q({
98
- ...l.treemap,
99
- ...o.treemap ?? {}
100
- });
101
- }
102
- addNode(l, o) {
103
- this.nodes.push(l), this.levels.set(l, o), o === 0 && (this.outerNodes.push(l), this.root ?? (this.root = l));
104
- }
105
- getRoot() {
106
- return { name: "", children: this.outerNodes };
107
- }
108
- addClass(l, o) {
109
- const i = this.classes.get(l) ?? { id: l, styles: [], textStyles: [] }, p = o.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
110
- p && p.forEach((s) => {
111
- xe(s) && (i?.textStyles ? i.textStyles.push(s) : i.textStyles = [s]), i?.styles ? i.styles.push(s) : i.styles = [s];
112
- }), this.classes.set(l, i);
113
- }
114
- getClasses() {
115
- return this.classes;
116
- }
117
- getStylesForClass(l) {
118
- return this.classes.get(l)?.styles ?? [];
119
- }
120
- clear() {
121
- ve(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
122
- }
123
- }, w(W, "TreeMapDB"), W);
124
- function ae(r) {
125
- if (!r.length)
126
- return [];
127
- const l = [], o = [];
128
- return r.forEach((i) => {
129
- const p = {
130
- name: i.name,
131
- children: i.type === "Leaf" ? void 0 : []
132
- };
133
- for (p.classSelector = i?.classSelector, i?.cssCompiledStyles && (p.cssCompiledStyles = [i.cssCompiledStyles]), i.type === "Leaf" && i.value !== void 0 && (p.value = i.value); o.length > 0 && o[o.length - 1].level >= i.level; )
134
- o.pop();
135
- if (o.length === 0)
136
- l.push(p);
137
- else {
138
- const s = o[o.length - 1].node;
139
- s.children ? s.children.push(p) : s.children = [p];
140
- }
141
- i.type !== "Leaf" && o.push({ node: p, level: i.level });
142
- }), l;
143
- }
144
- w(ae, "buildHierarchy");
145
- var Ae = /* @__PURE__ */ w((r, l) => {
146
- we(r, l);
147
- const o = [];
148
- for (const s of r.TreemapRows ?? [])
149
- s.$type === "ClassDefStatement" && l.addClass(s.className ?? "", s.styleText ?? "");
150
- for (const s of r.TreemapRows ?? []) {
151
- const c = s.item;
152
- if (!c)
153
- continue;
154
- const h = s.indent ? parseInt(s.indent) : 0, v = Ve(c), n = c.classSelector ? l.getStylesForClass(c.classSelector) : [], d = n.length > 0 ? n.join(";") : void 0, b = {
155
- level: h,
156
- name: v,
157
- type: c.$type,
158
- value: c.value,
159
- classSelector: c.classSelector,
160
- cssCompiledStyles: d
161
- };
162
- o.push(b);
163
- }
164
- const i = ae(o), p = /* @__PURE__ */ w((s, c) => {
165
- for (const h of s)
166
- l.addNode(h, c), h.children && h.children.length > 0 && p(h.children, c + 1);
167
- }, "addNodesRecursively");
168
- p(i, 0);
169
- }, "populate"), Ve = /* @__PURE__ */ w((r) => r.name ? String(r.name) : "", "getItemName"), le = {
170
- // @ts-expect-error - TreeMapDB is not assignable to DiagramDB
171
- parser: { yy: void 0 },
172
- parse: /* @__PURE__ */ w(async (r) => {
173
- try {
174
- const o = await Ce("treemap", r);
175
- J.debug("Treemap AST:", o);
176
- const i = le.parser?.yy;
177
- if (!(i instanceof te))
178
- throw new Error(
179
- "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."
180
- );
181
- Ae(o, i);
182
- } catch (l) {
183
- throw J.error("Error parsing treemap:", l), l;
184
- }
185
- }, "parse")
186
- }, De = 10, R = 10, X = 25, Pe = /* @__PURE__ */ w((r, l, o, i) => {
187
- const p = i.db, s = p.getConfig(), c = s.padding ?? De, h = p.getDiagramTitle(), v = p.getRoot(), { themeVariables: n } = ee();
188
- if (!v)
189
- return;
190
- const d = h ? 30 : 0, b = ce(l), t = s.nodeWidth ? s.nodeWidth * R : 960, x = s.nodeHeight ? s.nodeHeight * R : 500, y = t, S = x + d;
191
- b.attr("viewBox", `0 0 ${y} ${S}`), de(b, S, y, s.useMaxWidth);
192
- let u;
193
- try {
194
- const e = s.valueFormat || ",";
195
- if (e === "$0,0")
196
- u = /* @__PURE__ */ w((a) => "$" + O(",")(a), "valueFormat");
197
- else if (e.startsWith("$") && e.includes(",")) {
198
- const a = /\.\d+/.exec(e), f = a ? a[0] : "";
199
- u = /* @__PURE__ */ w((C) => "$" + O("," + f)(C), "valueFormat");
200
- } else if (e.startsWith("$")) {
201
- const a = e.substring(1);
202
- u = /* @__PURE__ */ w((f) => "$" + O(a || "")(f), "valueFormat");
203
- } else
204
- u = O(e);
205
- } catch (e) {
206
- J.error("Error creating format function:", e), u = O(",");
207
- }
208
- const m = Z().range([
209
- "transparent",
210
- n.cScale0,
211
- n.cScale1,
212
- n.cScale2,
213
- n.cScale3,
214
- n.cScale4,
215
- n.cScale5,
216
- n.cScale6,
217
- n.cScale7,
218
- n.cScale8,
219
- n.cScale9,
220
- n.cScale10,
221
- n.cScale11
222
- ]), k = Z().range([
223
- "transparent",
224
- n.cScalePeer0,
225
- n.cScalePeer1,
226
- n.cScalePeer2,
227
- n.cScalePeer3,
228
- n.cScalePeer4,
229
- n.cScalePeer5,
230
- n.cScalePeer6,
231
- n.cScalePeer7,
232
- n.cScalePeer8,
233
- n.cScalePeer9,
234
- n.cScalePeer10,
235
- n.cScalePeer11
236
- ]), N = Z().range([
237
- n.cScaleLabel0,
238
- n.cScaleLabel1,
239
- n.cScaleLabel2,
240
- n.cScaleLabel3,
241
- n.cScaleLabel4,
242
- n.cScaleLabel5,
243
- n.cScaleLabel6,
244
- n.cScaleLabel7,
245
- n.cScaleLabel8,
246
- n.cScaleLabel9,
247
- n.cScaleLabel10,
248
- n.cScaleLabel11
249
- ]);
250
- h && b.append("text").attr("x", y / 2).attr("y", d / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(h);
251
- const D = b.append("g").attr("transform", `translate(0, ${d})`).attr("class", "treemapContainer"), B = pe(v).sum((e) => e.value ?? 0).sort((e, a) => (a.value ?? 0) - (e.value ?? 0)), K = ze().size([t, x]).paddingTop(
252
- (e) => e.children && e.children.length > 0 ? X + R : 0
253
- ).paddingInner(c).paddingLeft((e) => e.children && e.children.length > 0 ? R : 0).paddingRight((e) => e.children && e.children.length > 0 ? R : 0).paddingBottom((e) => e.children && e.children.length > 0 ? R : 0).round(!0)(B), ne = K.descendants().filter((e) => e.children && e.children.length > 0), _ = D.selectAll(".treemapSection").data(ne).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
254
- _.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", X).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (e) => e.depth === 0 ? "display: none;" : ""), _.append("clipPath").attr("id", (e, a) => `clip-section-${l}-${a}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 12)).attr("height", X), _.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", (e, a) => `treemapSection section${a}`).attr("fill", (e) => m(e.data.name)).attr("fill-opacity", 0.6).attr("stroke", (e) => k(e.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (e) => {
255
- if (e.depth === 0)
256
- return "display: none;";
257
- const a = E({ cssCompiledStyles: e.data.cssCompiledStyles });
258
- return a.nodeStyles + ";" + a.borderStyles.join(";");
259
- }), _.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", X / 2).attr("dominant-baseline", "middle").text((e) => e.depth === 0 ? "" : e.data.name).attr("font-weight", "bold").attr("style", (e) => {
260
- if (e.depth === 0)
261
- return "display: none;";
262
- const a = "dominant-baseline: middle; font-size: 12px; fill:" + N(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = E({ cssCompiledStyles: e.data.cssCompiledStyles });
263
- return a + f.labelStyles.replace("color:", "fill:");
264
- }).each(function(e) {
265
- if (e.depth === 0)
266
- return;
267
- const a = j(this), f = e.data.name;
268
- a.text(f);
269
- const C = e.x1 - e.x0, $ = 6;
270
- let F;
271
- s.showValues !== !1 && e.value ? F = C - 10 - 30 - 10 - $ : F = C - $ - 6;
272
- const M = Math.max(15, F), g = a.node();
273
- if (g.getComputedTextLength() > M) {
274
- const T = "...";
275
- let L = f;
276
- for (; L.length > 0; ) {
277
- if (L = f.substring(0, L.length - 1), L.length === 0) {
278
- a.text(T), g.getComputedTextLength() > M && a.text("");
279
- break;
280
- }
281
- if (a.text(L + T), g.getComputedTextLength() <= M)
282
- break;
283
- }
284
- }
285
- }), s.showValues !== !1 && _.append("text").attr("class", "treemapSectionValue").attr("x", (e) => e.x1 - e.x0 - 10).attr("y", X / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((e) => e.value ? u(e.value) : "").attr("font-style", "italic").attr("style", (e) => {
286
- if (e.depth === 0)
287
- return "display: none;";
288
- const a = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + N(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = E({ cssCompiledStyles: e.data.cssCompiledStyles });
289
- return a + f.labelStyles.replace("color:", "fill:");
290
- });
291
- const se = K.leaves(), Y = D.selectAll(".treemapLeafGroup").data(se).enter().append("g").attr("class", (e, a) => `treemapNode treemapLeafGroup leaf${a}${e.data.classSelector ? ` ${e.data.classSelector}` : ""}x`).attr("transform", (e) => `translate(${e.x0},${e.y0})`);
292
- Y.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", "treemapLeaf").attr("fill", (e) => e.parent ? m(e.parent.data.name) : m(e.data.name)).attr("style", (e) => E({ cssCompiledStyles: e.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", 0.3).attr("stroke", (e) => e.parent ? m(e.parent.data.name) : m(e.data.name)).attr("stroke-width", 3), Y.append("clipPath").attr("id", (e, a) => `clip-${l}-${a}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 4)).attr("height", (e) => Math.max(0, e.y1 - e.y0 - 4)), Y.append("text").attr("class", "treemapLabel").attr("x", (e) => (e.x1 - e.x0) / 2).attr("y", (e) => (e.y1 - e.y0) / 2).attr("style", (e) => {
293
- const a = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + N(e.data.name) + ";", f = E({ cssCompiledStyles: e.data.cssCompiledStyles });
294
- return a + f.labelStyles.replace("color:", "fill:");
295
- }).attr("clip-path", (e, a) => `url(#clip-${l}-${a})`).text((e) => e.data.name).each(function(e) {
296
- const a = j(this), f = e.x1 - e.x0, C = e.y1 - e.y0, $ = a.node(), F = 4, P = f - 2 * F, M = C - 2 * F;
297
- if (P < 10 || M < 10) {
298
- a.style("display", "none");
299
- return;
300
- }
301
- let g = parseInt(a.style("font-size"), 10);
302
- const A = 8, T = 28, L = 0.6, V = 6, H = 2;
303
- for (; $.getComputedTextLength() > P && g > A; )
304
- g--, a.style("font-size", `${g}px`);
305
- let I = Math.max(
306
- V,
307
- Math.min(T, Math.round(g * L))
308
- ), U = g + H + I;
309
- for (; U > M && g > A && (g--, I = Math.max(
310
- V,
311
- Math.min(T, Math.round(g * L))
312
- ), !(I < V && g === A)); )
313
- a.style("font-size", `${g}px`), U = g + H + I;
314
- a.style("font-size", `${g}px`), ($.getComputedTextLength() > P || g < A || M < g) && a.style("display", "none");
315
- }), s.showValues !== !1 && Y.append("text").attr("class", "treemapValue").attr("x", (a) => (a.x1 - a.x0) / 2).attr("y", function(a) {
316
- return (a.y1 - a.y0) / 2;
317
- }).attr("style", (a) => {
318
- const f = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + N(a.data.name) + ";", C = E({ cssCompiledStyles: a.data.cssCompiledStyles });
319
- return f + C.labelStyles.replace("color:", "fill:");
320
- }).attr("clip-path", (a, f) => `url(#clip-${l}-${f})`).text((a) => a.value ? u(a.value) : "").each(function(a) {
321
- const f = j(this), C = this.parentNode;
322
- if (!C) {
323
- f.style("display", "none");
324
- return;
325
- }
326
- const $ = j(C).select(".treemapLabel");
327
- if ($.empty() || $.style("display") === "none") {
328
- f.style("display", "none");
329
- return;
330
- }
331
- const F = parseFloat($.style("font-size")), P = 28, M = 0.6, g = 6, A = 2, T = Math.max(
332
- g,
333
- Math.min(P, Math.round(F * M))
334
- );
335
- f.style("font-size", `${T}px`);
336
- const V = (a.y1 - a.y0) / 2 + F / 2 + A;
337
- f.attr("y", V);
338
- const H = a.x1 - a.x0, ie = a.y1 - a.y0 - 4, oe = H - 2 * 4;
339
- f.node().getComputedTextLength() > oe || V + T > ie || T < g ? f.style("display", "none") : f.style("display", null);
340
- });
341
- const re = s.diagramPadding ?? 8;
342
- be(b, re, "flowchart", s?.useMaxWidth || !1);
343
- }, "draw"), Ee = /* @__PURE__ */ w(function(r, l) {
344
- return l.db.getClasses();
345
- }, "getClasses"), Re = { draw: Pe, getClasses: Ee }, We = {
346
- sectionStrokeColor: "black",
347
- sectionStrokeWidth: "1",
348
- sectionFillColor: "#efefef",
349
- leafStrokeColor: "black",
350
- leafStrokeWidth: "1",
351
- leafFillColor: "#efefef",
352
- labelColor: "black",
353
- labelFontSize: "12px",
354
- valueFontSize: "10px",
355
- valueColor: "black",
356
- titleColor: "black",
357
- titleFontSize: "14px"
358
- }, Be = /* @__PURE__ */ w(({
359
- treemap: r
360
- } = {}) => {
361
- const l = Q(We, r);
362
- return `
363
- .treemapNode.section {
364
- stroke: ${l.sectionStrokeColor};
365
- stroke-width: ${l.sectionStrokeWidth};
366
- fill: ${l.sectionFillColor};
367
- }
368
- .treemapNode.leaf {
369
- stroke: ${l.leafStrokeColor};
370
- stroke-width: ${l.leafStrokeWidth};
371
- fill: ${l.leafFillColor};
372
- }
373
- .treemapLabel {
374
- fill: ${l.labelColor};
375
- font-size: ${l.labelFontSize};
376
- }
377
- .treemapValue {
378
- fill: ${l.valueColor};
379
- font-size: ${l.valueFontSize};
380
- }
381
- .treemapTitle {
382
- fill: ${l.titleColor};
383
- font-size: ${l.titleFontSize};
384
- }
385
- `;
386
- }, "getStyles"), _e = Be, Ue = {
387
- parser: le,
388
- get db() {
389
- return new te();
390
- },
391
- renderer: Re,
392
- styles: _e
393
- };
394
- export {
395
- Ue as diagram
396
- };
@@ -1,218 +0,0 @@
1
- import "./style.css";
2
- import { _ as l, s as k, g as R, q as E, p as F, a as I, b as _, H as D, y as G, D as f, E as C, F as P, l as z, K as H } from "./index-LPeu-5gp.js";
3
- import { p as V } from "./chunk-4BX2VUAB-lfhsh4gk.js";
4
- import { p as W } from "./mermaid-parser.core-C3Lk4un7.js";
5
- var m = {
6
- showLegend: !0,
7
- ticks: 5,
8
- max: null,
9
- min: 0,
10
- graticule: "circle"
11
- }, w = {
12
- axes: [],
13
- curves: [],
14
- options: m
15
- }, h = structuredClone(w), B = P.radar, j = /* @__PURE__ */ l(() => f({
16
- ...B,
17
- ...C().radar
18
- }), "getConfig"), b = /* @__PURE__ */ l(() => h.axes, "getAxes"), q = /* @__PURE__ */ l(() => h.curves, "getCurves"), K = /* @__PURE__ */ l(() => h.options, "getOptions"), N = /* @__PURE__ */ l((a) => {
19
- h.axes = a.map((t) => ({
20
- name: t.name,
21
- label: t.label ?? t.name
22
- }));
23
- }, "setAxes"), U = /* @__PURE__ */ l((a) => {
24
- h.curves = a.map((t) => ({
25
- name: t.name,
26
- label: t.label ?? t.name,
27
- entries: X(t.entries)
28
- }));
29
- }, "setCurves"), X = /* @__PURE__ */ l((a) => {
30
- if (a[0].axis == null)
31
- return a.map((e) => e.value);
32
- const t = b();
33
- if (t.length === 0)
34
- throw new Error("Axes must be populated before curves for reference entries");
35
- return t.map((e) => {
36
- const r = a.find((s) => s.axis?.$refText === e.name);
37
- if (r === void 0)
38
- throw new Error("Missing entry for axis " + e.label);
39
- return r.value;
40
- });
41
- }, "computeCurveEntries"), Y = /* @__PURE__ */ l((a) => {
42
- const t = a.reduce(
43
- (e, r) => (e[r.name] = r, e),
44
- {}
45
- );
46
- h.options = {
47
- showLegend: t.showLegend?.value ?? m.showLegend,
48
- ticks: t.ticks?.value ?? m.ticks,
49
- max: t.max?.value ?? m.max,
50
- min: t.min?.value ?? m.min,
51
- graticule: t.graticule?.value ?? m.graticule
52
- };
53
- }, "setOptions"), Z = /* @__PURE__ */ l(() => {
54
- G(), h = structuredClone(w);
55
- }, "clear"), $ = {
56
- getAxes: b,
57
- getCurves: q,
58
- getOptions: K,
59
- setAxes: N,
60
- setCurves: U,
61
- setOptions: Y,
62
- getConfig: j,
63
- clear: Z,
64
- setAccTitle: _,
65
- getAccTitle: I,
66
- setDiagramTitle: F,
67
- getDiagramTitle: E,
68
- getAccDescription: R,
69
- setAccDescription: k
70
- }, J = /* @__PURE__ */ l((a) => {
71
- V(a, $);
72
- const { axes: t, curves: e, options: r } = a;
73
- $.setAxes(t), $.setCurves(e), $.setOptions(r);
74
- }, "populate"), Q = {
75
- parse: /* @__PURE__ */ l(async (a) => {
76
- const t = await W("radar", a);
77
- z.debug(t), J(t);
78
- }, "parse")
79
- }, tt = /* @__PURE__ */ l((a, t, e, r) => {
80
- const s = r.db, o = s.getAxes(), i = s.getCurves(), n = s.getOptions(), c = s.getConfig(), d = s.getDiagramTitle(), u = D(t), p = et(u, c), g = n.max ?? Math.max(...i.map((y) => Math.max(...y.entries))), x = n.min, v = Math.min(c.width, c.height) / 2;
81
- at(p, o, v, n.ticks, n.graticule), rt(p, o, v, c), M(p, o, i, x, g, n.graticule, c), T(p, i, n.showLegend, c), p.append("text").attr("class", "radarTitle").text(d).attr("x", 0).attr("y", -c.height / 2 - c.marginTop);
82
- }, "draw"), et = /* @__PURE__ */ l((a, t) => {
83
- const e = t.width + t.marginLeft + t.marginRight, r = t.height + t.marginTop + t.marginBottom, s = {
84
- x: t.marginLeft + t.width / 2,
85
- y: t.marginTop + t.height / 2
86
- };
87
- return a.attr("viewbox", `0 0 ${e} ${r}`).attr("width", e).attr("height", r), a.append("g").attr("transform", `translate(${s.x}, ${s.y})`);
88
- }, "drawFrame"), at = /* @__PURE__ */ l((a, t, e, r, s) => {
89
- if (s === "circle")
90
- for (let o = 0; o < r; o++) {
91
- const i = e * (o + 1) / r;
92
- a.append("circle").attr("r", i).attr("class", "radarGraticule");
93
- }
94
- else if (s === "polygon") {
95
- const o = t.length;
96
- for (let i = 0; i < r; i++) {
97
- const n = e * (i + 1) / r, c = t.map((d, u) => {
98
- const p = 2 * u * Math.PI / o - Math.PI / 2, g = n * Math.cos(p), x = n * Math.sin(p);
99
- return `${g},${x}`;
100
- }).join(" ");
101
- a.append("polygon").attr("points", c).attr("class", "radarGraticule");
102
- }
103
- }
104
- }, "drawGraticule"), rt = /* @__PURE__ */ l((a, t, e, r) => {
105
- const s = t.length;
106
- for (let o = 0; o < s; o++) {
107
- const i = t[o].label, n = 2 * o * Math.PI / s - Math.PI / 2;
108
- a.append("line").attr("x1", 0).attr("y1", 0).attr("x2", e * r.axisScaleFactor * Math.cos(n)).attr("y2", e * r.axisScaleFactor * Math.sin(n)).attr("class", "radarAxisLine"), a.append("text").text(i).attr("x", e * r.axisLabelFactor * Math.cos(n)).attr("y", e * r.axisLabelFactor * Math.sin(n)).attr("class", "radarAxisLabel");
109
- }
110
- }, "drawAxes");
111
- function M(a, t, e, r, s, o, i) {
112
- const n = t.length, c = Math.min(i.width, i.height) / 2;
113
- e.forEach((d, u) => {
114
- if (d.entries.length !== n)
115
- return;
116
- const p = d.entries.map((g, x) => {
117
- const v = 2 * Math.PI * x / n - Math.PI / 2, y = A(g, r, s, c), O = y * Math.cos(v), S = y * Math.sin(v);
118
- return { x: O, y: S };
119
- });
120
- o === "circle" ? a.append("path").attr("d", L(p, i.curveTension)).attr("class", `radarCurve-${u}`) : o === "polygon" && a.append("polygon").attr("points", p.map((g) => `${g.x},${g.y}`).join(" ")).attr("class", `radarCurve-${u}`);
121
- });
122
- }
123
- l(M, "drawCurves");
124
- function A(a, t, e, r) {
125
- const s = Math.min(Math.max(a, t), e);
126
- return r * (s - t) / (e - t);
127
- }
128
- l(A, "relativeRadius");
129
- function L(a, t) {
130
- const e = a.length;
131
- let r = `M${a[0].x},${a[0].y}`;
132
- for (let s = 0; s < e; s++) {
133
- const o = a[(s - 1 + e) % e], i = a[s], n = a[(s + 1) % e], c = a[(s + 2) % e], d = {
134
- x: i.x + (n.x - o.x) * t,
135
- y: i.y + (n.y - o.y) * t
136
- }, u = {
137
- x: n.x - (c.x - i.x) * t,
138
- y: n.y - (c.y - i.y) * t
139
- };
140
- r += ` C${d.x},${d.y} ${u.x},${u.y} ${n.x},${n.y}`;
141
- }
142
- return `${r} Z`;
143
- }
144
- l(L, "closedRoundCurve");
145
- function T(a, t, e, r) {
146
- if (!e)
147
- return;
148
- const s = (r.width / 2 + r.marginRight) * 3 / 4, o = -(r.height / 2 + r.marginTop) * 3 / 4, i = 20;
149
- t.forEach((n, c) => {
150
- const d = a.append("g").attr("transform", `translate(${s}, ${o + c * i})`);
151
- d.append("rect").attr("width", 12).attr("height", 12).attr("class", `radarLegendBox-${c}`), d.append("text").attr("x", 16).attr("y", 0).attr("class", "radarLegendText").text(n.label);
152
- });
153
- }
154
- l(T, "drawLegend");
155
- var st = { draw: tt }, nt = /* @__PURE__ */ l((a, t) => {
156
- let e = "";
157
- for (let r = 0; r < a.THEME_COLOR_LIMIT; r++) {
158
- const s = a[`cScale${r}`];
159
- e += `
160
- .radarCurve-${r} {
161
- color: ${s};
162
- fill: ${s};
163
- fill-opacity: ${t.curveOpacity};
164
- stroke: ${s};
165
- stroke-width: ${t.curveStrokeWidth};
166
- }
167
- .radarLegendBox-${r} {
168
- fill: ${s};
169
- fill-opacity: ${t.curveOpacity};
170
- stroke: ${s};
171
- }
172
- `;
173
- }
174
- return e;
175
- }, "genIndexStyles"), ot = /* @__PURE__ */ l((a) => {
176
- const t = H(), e = C(), r = f(t, e.themeVariables), s = f(r.radar, a);
177
- return { themeVariables: r, radarOptions: s };
178
- }, "buildRadarStyleOptions"), it = /* @__PURE__ */ l(({ radar: a } = {}) => {
179
- const { themeVariables: t, radarOptions: e } = ot(a);
180
- return `
181
- .radarTitle {
182
- font-size: ${t.fontSize};
183
- color: ${t.titleColor};
184
- dominant-baseline: hanging;
185
- text-anchor: middle;
186
- }
187
- .radarAxisLine {
188
- stroke: ${e.axisColor};
189
- stroke-width: ${e.axisStrokeWidth};
190
- }
191
- .radarAxisLabel {
192
- dominant-baseline: middle;
193
- text-anchor: middle;
194
- font-size: ${e.axisLabelFontSize}px;
195
- color: ${e.axisColor};
196
- }
197
- .radarGraticule {
198
- fill: ${e.graticuleColor};
199
- fill-opacity: ${e.graticuleOpacity};
200
- stroke: ${e.graticuleColor};
201
- stroke-width: ${e.graticuleStrokeWidth};
202
- }
203
- .radarLegendText {
204
- text-anchor: start;
205
- font-size: ${e.legendFontSize}px;
206
- dominant-baseline: hanging;
207
- }
208
- ${nt(t, e)}
209
- `;
210
- }, "styles"), ut = {
211
- parser: Q,
212
- db: $,
213
- renderer: st,
214
- styles: it
215
- };
216
- export {
217
- ut as diagram
218
- };