bg-editor 0.0.2 → 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.
Files changed (61) hide show
  1. package/dist/_baseUniq-DtZISqda.js +473 -0
  2. package/dist/{arc-CNm23MW7.js → arc-BpOtYBpP.js} +1 -1
  3. package/dist/{architecture-U656AL7Q-Ww8rTIvv.js → architecture-U656AL7Q-BN22wDFh.js} +1 -1
  4. package/dist/{architectureDiagram-VXUJARFQ-DH2EEb-C.js → architectureDiagram-VXUJARFQ-D90AF2uK.js} +3 -3
  5. package/dist/{blockDiagram-VD42YOAC-CPmwRP5b.js → blockDiagram-VD42YOAC-DXQNldkG.js} +5 -5
  6. package/dist/{c4Diagram-YG6GDRKO-Jsc4hIGa.js → c4Diagram-YG6GDRKO-Bl1xCfsC.js} +2 -2
  7. package/dist/{channel-BfuwZbo4.js → channel-BiQYlsVc.js} +1 -1
  8. package/dist/{chunk-4BX2VUAB-4Zvho0Ds.js → chunk-4BX2VUAB-JnvgOgeI.js} +1 -1
  9. package/dist/{chunk-55IACEB6-BmOb908D.js → chunk-55IACEB6-DvzYdqd0.js} +1 -1
  10. package/dist/{chunk-B4BG7PRW-Dx9fTyv9.js → chunk-B4BG7PRW-D2zs0pMT.js} +4 -4
  11. package/dist/{chunk-DI55MBZ5-Dwa8xe-f.js → chunk-DI55MBZ5-IhCs2q12.js} +3 -3
  12. package/dist/{chunk-FMBD7UC4-DBAEvnpB.js → chunk-FMBD7UC4-CI7_2stl.js} +1 -1
  13. package/dist/{chunk-QN33PNHL-BFK0rIbg.js → chunk-QN33PNHL-D3gdmDbi.js} +1 -1
  14. package/dist/{chunk-QZHKN3VN-B5HHmgvT.js → chunk-QZHKN3VN-BaqG_46X.js} +1 -1
  15. package/dist/{chunk-TZMSLE5B-CYLAjMP8.js → chunk-TZMSLE5B-fUTKpgTY.js} +1 -1
  16. package/dist/{classDiagram-v2-WZHVMYZB-CQOOlc6C.js → classDiagram-2ON5EDUG-BbUC7jyd.js} +2 -2
  17. package/dist/{classDiagram-2ON5EDUG-CQOOlc6C.js → classDiagram-v2-WZHVMYZB-BbUC7jyd.js} +2 -2
  18. package/dist/{clone-CF1B7msQ.js → clone-CDwfUPH_.js} +1 -1
  19. package/dist/{cose-bilkent-S5V4N54A-DZx3YOg1.js → cose-bilkent-S5V4N54A-BfRx9IMy.js} +8 -8
  20. package/dist/{dagre-6UL2VRFP-sT9qv2gP.js → dagre-6UL2VRFP-pX_n00Op.js} +116 -117
  21. package/dist/{defaultLocale-C44w2ZBZ.js → defaultLocale-DEnRyJdC.js} +3 -3
  22. package/dist/diagram-PSM6KHXK-CwWsOtmB.js +396 -0
  23. package/dist/{diagram-QEK2KX5R-g5F_w0er.js → diagram-QEK2KX5R-Dxmoi6nm.js} +3 -3
  24. package/dist/{diagram-S2PKOQOG-CRelpUZk.js → diagram-S2PKOQOG-HSYMJfV1.js} +3 -3
  25. package/dist/{erDiagram-Q2GNP2WA-CfWWAKsy.js → erDiagram-Q2GNP2WA-DQP8lHpe.js} +4 -4
  26. package/dist/{flowDiagram-NV44I4VS-DuCCJQ8z.js → flowDiagram-NV44I4VS-Cl_9jtIL.js} +5 -5
  27. package/dist/{ganttDiagram-LVOFAZNH-DKb9FhvV.js → ganttDiagram-LVOFAZNH-CPmFv-yQ.js} +2 -2
  28. package/dist/{gitGraph-F6HP7TQM-Cg_TcdDS.js → gitGraph-F6HP7TQM-80sPVnm_.js} +1 -1
  29. package/dist/{gitGraphDiagram-NY62KEGX-CjO_i2YA.js → gitGraphDiagram-NY62KEGX-B-81Admd.js} +4 -4
  30. package/dist/graph-rMBrFJ2v.js +382 -0
  31. package/dist/index-D5tpgmxE.js +164793 -0
  32. package/dist/{info-NVLQJR56-D-AxJYeF.js → info-NVLQJR56-DBCgZtPg.js} +1 -1
  33. package/dist/{infoDiagram-ER5ION4S-9EH9zF_4.js → infoDiagram-ER5ION4S-CqZmP7Ed.js} +2 -2
  34. package/dist/{journeyDiagram-XKPGCS4Q-BaCrHQBZ.js → journeyDiagram-XKPGCS4Q-Stv9y4h1.js} +4 -4
  35. package/dist/{kanban-definition-3W4ZIXB7-BK9PMHrf.js → kanban-definition-3W4ZIXB7-C5R0pumf.js} +2 -2
  36. package/dist/layout-DHK3CzAK.js +1416 -0
  37. package/dist/{linear-edUYtIiO.js → linear-CD94DoB6.js} +6 -6
  38. package/dist/{mermaid-parser.core-BMy5yPs4.js → mermaid-parser.core-D1WCqkLE.js} +6707 -5486
  39. package/dist/min-CDOTJW1A.js +39 -0
  40. package/dist/{mindmap-definition-VGOIOE7T-bSEDOEZl.js → mindmap-definition-VGOIOE7T-BONuOB6H.js} +11 -11
  41. package/dist/{packet-BFZMPI3H-DHEklZAi.js → packet-BFZMPI3H-ByqiBqYS.js} +1 -1
  42. package/dist/{pie-7BOR55EZ-DDu5Qx9i.js → pie-7BOR55EZ-Bzv7npkH.js} +1 -1
  43. package/dist/{pieDiagram-ADFJNKIX-QEkPDMva.js → pieDiagram-ADFJNKIX-CQ6y-x9k.js} +9 -9
  44. package/dist/{quadrantDiagram-AYHSOK5B-zvs9JNV-.js → quadrantDiagram-AYHSOK5B-C4hTUyLY.js} +2 -2
  45. package/dist/{radar-NHE76QYJ-DEeIs6w7.js → radar-NHE76QYJ-OVSgPUhl.js} +1 -1
  46. package/dist/{requirementDiagram-UZGBJVZJ-PLEQdkam.js → requirementDiagram-UZGBJVZJ-CM3F7AET.js} +3 -3
  47. package/dist/{sankeyDiagram-TZEHDZUN-B9FpEfLk.js → sankeyDiagram-TZEHDZUN-F2yxFEnc.js} +1 -1
  48. package/dist/{sequenceDiagram-WL72ISMW-ClWHIEm8.js → sequenceDiagram-WL72ISMW-CZgiwPgi.js} +3 -3
  49. package/dist/{stateDiagram-FKZM4ZOC-CSNc1r0e.js → stateDiagram-FKZM4ZOC-Bxzbhi-m.js} +4 -4
  50. package/dist/{stateDiagram-v2-4FDKWEC3-BbDtuFwM.js → stateDiagram-v2-4FDKWEC3-DfVPJhMD.js} +2 -2
  51. package/dist/{timeline-definition-IT6M3QCI-Ddq-6bZx.js → timeline-definition-IT6M3QCI-_z700I-W.js} +2 -2
  52. package/dist/{treemap-KMMF4GRG-D3-cXS0o.js → treemap-KMMF4GRG-D5Tr-XRi.js} +1 -1
  53. package/dist/umo-editor.js +1 -1
  54. package/dist/{xychartDiagram-PRI3JC2R-BpMDi10C.js → xychartDiagram-PRI3JC2R-yKhqmxR_.js} +2 -2
  55. package/package.json +6 -1
  56. package/dist/_basePickBy-xii7lYdk.js +0 -152
  57. package/dist/_baseUniq-ltuhkD8D.js +0 -615
  58. package/dist/diagram-PSM6KHXK-CgyZu1Ty.js +0 -533
  59. package/dist/graph-IPeEmdRy.js +0 -248
  60. package/dist/index-DfWUTVm_.js +0 -122164
  61. package/dist/layout-C1dI-ZSJ.js +0 -1336
@@ -1,533 +0,0 @@
1
- import "./style.css";
2
- import { _ as w, D as te, E as ae, H as he, e as ue, l as K, a$ as P, d as Y, b as pe, a as fe, p as ge, q as me, g as ye, s as Se, F as ve, b0 as xe, y as be } from "./index-DfWUTVm_.js";
3
- import { s as we } from "./chunk-QN33PNHL-BFK0rIbg.js";
4
- import { p as Ce } from "./chunk-4BX2VUAB-4Zvho0Ds.js";
5
- import { p as Te } from "./mermaid-parser.core-BMy5yPs4.js";
6
- import { b as O } from "./defaultLocale-C44w2ZBZ.js";
7
- import { o as J } from "./ordinal-mgyNSFm_.js";
8
- function Le(t) {
9
- var a = 0, l = t.children, n = l && l.length;
10
- if (!n) a = 1;
11
- else for (; --n >= 0; ) a += l[n].value;
12
- t.value = a;
13
- }
14
- function $e() {
15
- return this.eachAfter(Le);
16
- }
17
- function Ae(t, a) {
18
- let l = -1;
19
- for (const n of this)
20
- t.call(a, n, ++l, this);
21
- return this;
22
- }
23
- function Fe(t, a) {
24
- for (var l = this, n = [l], o, s, d = -1; l = n.pop(); )
25
- if (t.call(a, l, ++d, this), o = l.children)
26
- for (s = o.length - 1; s >= 0; --s)
27
- n.push(o[s]);
28
- return this;
29
- }
30
- function ke(t, a) {
31
- for (var l = this, n = [l], o = [], s, d, h, g = -1; l = n.pop(); )
32
- if (o.push(l), s = l.children)
33
- for (d = 0, h = s.length; d < h; ++d)
34
- n.push(s[d]);
35
- for (; l = o.pop(); )
36
- t.call(a, l, ++g, this);
37
- return this;
38
- }
39
- function Ne(t, a) {
40
- let l = -1;
41
- for (const n of this)
42
- if (t.call(a, n, ++l, this))
43
- return n;
44
- }
45
- function Me(t) {
46
- return this.eachAfter(function(a) {
47
- for (var l = +t(a.data) || 0, n = a.children, o = n && n.length; --o >= 0; ) l += n[o].value;
48
- a.value = l;
49
- });
50
- }
51
- function _e(t) {
52
- return this.eachBefore(function(a) {
53
- a.children && a.children.sort(t);
54
- });
55
- }
56
- function ze(t) {
57
- for (var a = this, l = Ve(a, t), n = [a]; a !== l; )
58
- a = a.parent, n.push(a);
59
- for (var o = n.length; t !== l; )
60
- n.splice(o, 0, t), t = t.parent;
61
- return n;
62
- }
63
- function Ve(t, a) {
64
- if (t === a) return t;
65
- var l = t.ancestors(), n = a.ancestors(), o = null;
66
- for (t = l.pop(), a = n.pop(); t === a; )
67
- o = t, t = l.pop(), a = n.pop();
68
- return o;
69
- }
70
- function De() {
71
- for (var t = this, a = [t]; t = t.parent; )
72
- a.push(t);
73
- return a;
74
- }
75
- function Pe() {
76
- return Array.from(this);
77
- }
78
- function Be() {
79
- var t = [];
80
- return this.eachBefore(function(a) {
81
- a.children || t.push(a);
82
- }), t;
83
- }
84
- function Ee() {
85
- var t = this, a = [];
86
- return t.each(function(l) {
87
- l !== t && a.push({ source: l.parent, target: l });
88
- }), a;
89
- }
90
- function* Re() {
91
- var t = this, a, l = [t], n, o, s;
92
- do
93
- for (a = l.reverse(), l = []; t = a.pop(); )
94
- if (yield t, n = t.children)
95
- for (o = 0, s = n.length; o < s; ++o)
96
- l.push(n[o]);
97
- while (l.length);
98
- }
99
- function Q(t, a) {
100
- t instanceof Map ? (t = [void 0, t], a === void 0 && (a = Ie)) : a === void 0 && (a = He);
101
- for (var l = new U(t), n, o = [l], s, d, h, g; n = o.pop(); )
102
- if ((d = a(n.data)) && (g = (d = Array.from(d)).length))
103
- for (n.children = d, h = g - 1; h >= 0; --h)
104
- o.push(s = d[h] = new U(d[h])), s.parent = n, s.depth = n.depth + 1;
105
- return l.eachBefore(qe);
106
- }
107
- function We() {
108
- return Q(this).eachBefore(Oe);
109
- }
110
- function He(t) {
111
- return t.children;
112
- }
113
- function Ie(t) {
114
- return Array.isArray(t) ? t[1] : null;
115
- }
116
- function Oe(t) {
117
- t.data.value !== void 0 && (t.value = t.data.value), t.data = t.data.data;
118
- }
119
- function qe(t) {
120
- var a = 0;
121
- do
122
- t.height = a;
123
- while ((t = t.parent) && t.height < ++a);
124
- }
125
- function U(t) {
126
- this.data = t, this.depth = this.height = 0, this.parent = null;
127
- }
128
- U.prototype = Q.prototype = {
129
- constructor: U,
130
- count: $e,
131
- each: Ae,
132
- eachAfter: ke,
133
- eachBefore: Fe,
134
- find: Ne,
135
- sum: Me,
136
- sort: _e,
137
- path: ze,
138
- ancestors: De,
139
- descendants: Pe,
140
- leaves: Be,
141
- links: Ee,
142
- copy: We,
143
- [Symbol.iterator]: Re
144
- };
145
- function Ge(t) {
146
- if (typeof t != "function") throw new Error();
147
- return t;
148
- }
149
- function q() {
150
- return 0;
151
- }
152
- function G(t) {
153
- return function() {
154
- return t;
155
- };
156
- }
157
- function Xe(t) {
158
- t.x0 = Math.round(t.x0), t.y0 = Math.round(t.y0), t.x1 = Math.round(t.x1), t.y1 = Math.round(t.y1);
159
- }
160
- function je(t, a, l, n, o) {
161
- for (var s = t.children, d, h = -1, g = s.length, c = t.value && (n - a) / t.value; ++h < g; )
162
- d = s[h], d.y0 = l, d.y1 = o, d.x0 = a, d.x1 = a += d.value * c;
163
- }
164
- function Ye(t, a, l, n, o) {
165
- for (var s = t.children, d, h = -1, g = s.length, c = t.value && (o - l) / t.value; ++h < g; )
166
- d = s[h], d.x0 = a, d.x1 = n, d.y0 = l, d.y1 = l += d.value * c;
167
- }
168
- var Ue = (1 + Math.sqrt(5)) / 2;
169
- function Ze(t, a, l, n, o, s) {
170
- for (var d = [], h = a.children, g, c, u = 0, b = 0, r = h.length, x, S, v = a.value, p, m, N, k, V, R, M; u < r; ) {
171
- x = o - l, S = s - n;
172
- do
173
- p = h[b++].value;
174
- while (!p && b < r);
175
- for (m = N = p, R = Math.max(S / x, x / S) / (v * t), M = p * p * R, V = Math.max(N / M, M / m); b < r; ++b) {
176
- if (p += c = h[b].value, c < m && (m = c), c > N && (N = c), M = p * p * R, k = Math.max(N / M, M / m), k > V) {
177
- p -= c;
178
- break;
179
- }
180
- V = k;
181
- }
182
- d.push(g = { value: p, dice: x < S, children: h.slice(u, b) }), g.dice ? je(g, l, n, o, v ? n += S * p / v : s) : Ye(g, l, n, v ? l += x * p / v : o, s), v -= p, u = b;
183
- }
184
- return d;
185
- }
186
- const Je = function t(a) {
187
- function l(n, o, s, d, h) {
188
- Ze(a, n, o, s, d, h);
189
- }
190
- return l.ratio = function(n) {
191
- return t((n = +n) > 1 ? n : 1);
192
- }, l;
193
- }(Ue);
194
- function Ke() {
195
- var t = Je, a = !1, l = 1, n = 1, o = [0], s = q, d = q, h = q, g = q, c = q;
196
- function u(r) {
197
- return r.x0 = r.y0 = 0, r.x1 = l, r.y1 = n, r.eachBefore(b), o = [0], a && r.eachBefore(Xe), r;
198
- }
199
- function b(r) {
200
- var x = o[r.depth], S = r.x0 + x, v = r.y0 + x, p = r.x1 - x, m = r.y1 - x;
201
- p < S && (S = p = (S + p) / 2), m < v && (v = m = (v + m) / 2), r.x0 = S, r.y0 = v, r.x1 = p, r.y1 = m, r.children && (x = o[r.depth + 1] = s(r) / 2, S += c(r) - x, v += d(r) - x, p -= h(r) - x, m -= g(r) - x, p < S && (S = p = (S + p) / 2), m < v && (v = m = (v + m) / 2), t(r, S, v, p, m));
202
- }
203
- return u.round = function(r) {
204
- return arguments.length ? (a = !!r, u) : a;
205
- }, u.size = function(r) {
206
- return arguments.length ? (l = +r[0], n = +r[1], u) : [l, n];
207
- }, u.tile = function(r) {
208
- return arguments.length ? (t = Ge(r), u) : t;
209
- }, u.padding = function(r) {
210
- return arguments.length ? u.paddingInner(r).paddingOuter(r) : u.paddingInner();
211
- }, u.paddingInner = function(r) {
212
- return arguments.length ? (s = typeof r == "function" ? r : G(+r), u) : s;
213
- }, u.paddingOuter = function(r) {
214
- return arguments.length ? u.paddingTop(r).paddingRight(r).paddingBottom(r).paddingLeft(r) : u.paddingTop();
215
- }, u.paddingTop = function(r) {
216
- return arguments.length ? (d = typeof r == "function" ? r : G(+r), u) : d;
217
- }, u.paddingRight = function(r) {
218
- return arguments.length ? (h = typeof r == "function" ? r : G(+r), u) : h;
219
- }, u.paddingBottom = function(r) {
220
- return arguments.length ? (g = typeof r == "function" ? r : G(+r), u) : g;
221
- }, u.paddingLeft = function(r) {
222
- return arguments.length ? (c = typeof r == "function" ? r : G(+r), u) : c;
223
- }, u;
224
- }
225
- var E, ne = (E = class {
226
- constructor() {
227
- this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = pe, this.getAccTitle = fe, this.setDiagramTitle = ge, this.getDiagramTitle = me, this.getAccDescription = ye, this.setAccDescription = Se;
228
- }
229
- getNodes() {
230
- return this.nodes;
231
- }
232
- getConfig() {
233
- const a = ve, l = ae();
234
- return te({
235
- ...a.treemap,
236
- ...l.treemap ?? {}
237
- });
238
- }
239
- addNode(a, l) {
240
- this.nodes.push(a), this.levels.set(a, l), l === 0 && (this.outerNodes.push(a), this.root ?? (this.root = a));
241
- }
242
- getRoot() {
243
- return { name: "", children: this.outerNodes };
244
- }
245
- addClass(a, l) {
246
- const n = this.classes.get(a) ?? { id: a, styles: [], textStyles: [] }, o = l.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
247
- o && o.forEach((s) => {
248
- xe(s) && (n?.textStyles ? n.textStyles.push(s) : n.textStyles = [s]), n?.styles ? n.styles.push(s) : n.styles = [s];
249
- }), this.classes.set(a, n);
250
- }
251
- getClasses() {
252
- return this.classes;
253
- }
254
- getStylesForClass(a) {
255
- return this.classes.get(a)?.styles ?? [];
256
- }
257
- clear() {
258
- be(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
259
- }
260
- }, w(E, "TreeMapDB"), E);
261
- function le(t) {
262
- if (!t.length)
263
- return [];
264
- const a = [], l = [];
265
- return t.forEach((n) => {
266
- const o = {
267
- name: n.name,
268
- children: n.type === "Leaf" ? void 0 : []
269
- };
270
- for (o.classSelector = n?.classSelector, n?.cssCompiledStyles && (o.cssCompiledStyles = [n.cssCompiledStyles]), n.type === "Leaf" && n.value !== void 0 && (o.value = n.value); l.length > 0 && l[l.length - 1].level >= n.level; )
271
- l.pop();
272
- if (l.length === 0)
273
- a.push(o);
274
- else {
275
- const s = l[l.length - 1].node;
276
- s.children ? s.children.push(o) : s.children = [o];
277
- }
278
- n.type !== "Leaf" && l.push({ node: o, level: n.level });
279
- }), a;
280
- }
281
- w(le, "buildHierarchy");
282
- var Qe = /* @__PURE__ */ w((t, a) => {
283
- Ce(t, a);
284
- const l = [];
285
- for (const s of t.TreemapRows ?? [])
286
- s.$type === "ClassDefStatement" && a.addClass(s.className ?? "", s.styleText ?? "");
287
- for (const s of t.TreemapRows ?? []) {
288
- const d = s.item;
289
- if (!d)
290
- continue;
291
- const h = s.indent ? parseInt(s.indent) : 0, g = et(d), c = d.classSelector ? a.getStylesForClass(d.classSelector) : [], u = c.length > 0 ? c.join(";") : void 0, b = {
292
- level: h,
293
- name: g,
294
- type: d.$type,
295
- value: d.value,
296
- classSelector: d.classSelector,
297
- cssCompiledStyles: u
298
- };
299
- l.push(b);
300
- }
301
- const n = le(l), o = /* @__PURE__ */ w((s, d) => {
302
- for (const h of s)
303
- a.addNode(h, d), h.children && h.children.length > 0 && o(h.children, d + 1);
304
- }, "addNodesRecursively");
305
- o(n, 0);
306
- }, "populate"), et = /* @__PURE__ */ w((t) => t.name ? String(t.name) : "", "getItemName"), re = {
307
- // @ts-expect-error - TreeMapDB is not assignable to DiagramDB
308
- parser: { yy: void 0 },
309
- parse: /* @__PURE__ */ w(async (t) => {
310
- try {
311
- const l = await Te("treemap", t);
312
- K.debug("Treemap AST:", l);
313
- const n = re.parser?.yy;
314
- if (!(n instanceof ne))
315
- throw new Error(
316
- "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."
317
- );
318
- Qe(l, n);
319
- } catch (a) {
320
- throw K.error("Error parsing treemap:", a), a;
321
- }
322
- }, "parse")
323
- }, tt = 10, B = 10, X = 25, at = /* @__PURE__ */ w((t, a, l, n) => {
324
- const o = n.db, s = o.getConfig(), d = s.padding ?? tt, h = o.getDiagramTitle(), g = o.getRoot(), { themeVariables: c } = ae();
325
- if (!g)
326
- return;
327
- const u = h ? 30 : 0, b = he(a), r = s.nodeWidth ? s.nodeWidth * B : 960, x = s.nodeHeight ? s.nodeHeight * B : 500, S = r, v = x + u;
328
- b.attr("viewBox", `0 0 ${S} ${v}`), ue(b, v, S, s.useMaxWidth);
329
- let p;
330
- try {
331
- const e = s.valueFormat || ",";
332
- if (e === "$0,0")
333
- p = /* @__PURE__ */ w((i) => "$" + O(",")(i), "valueFormat");
334
- else if (e.startsWith("$") && e.includes(",")) {
335
- const i = /\.\d+/.exec(e), f = i ? i[0] : "";
336
- p = /* @__PURE__ */ w((C) => "$" + O("," + f)(C), "valueFormat");
337
- } else if (e.startsWith("$")) {
338
- const i = e.substring(1);
339
- p = /* @__PURE__ */ w((f) => "$" + O(i || "")(f), "valueFormat");
340
- } else
341
- p = O(e);
342
- } catch (e) {
343
- K.error("Error creating format function:", e), p = O(",");
344
- }
345
- const m = J().range([
346
- "transparent",
347
- c.cScale0,
348
- c.cScale1,
349
- c.cScale2,
350
- c.cScale3,
351
- c.cScale4,
352
- c.cScale5,
353
- c.cScale6,
354
- c.cScale7,
355
- c.cScale8,
356
- c.cScale9,
357
- c.cScale10,
358
- c.cScale11
359
- ]), N = J().range([
360
- "transparent",
361
- c.cScalePeer0,
362
- c.cScalePeer1,
363
- c.cScalePeer2,
364
- c.cScalePeer3,
365
- c.cScalePeer4,
366
- c.cScalePeer5,
367
- c.cScalePeer6,
368
- c.cScalePeer7,
369
- c.cScalePeer8,
370
- c.cScalePeer9,
371
- c.cScalePeer10,
372
- c.cScalePeer11
373
- ]), k = J().range([
374
- c.cScaleLabel0,
375
- c.cScaleLabel1,
376
- c.cScaleLabel2,
377
- c.cScaleLabel3,
378
- c.cScaleLabel4,
379
- c.cScaleLabel5,
380
- c.cScaleLabel6,
381
- c.cScaleLabel7,
382
- c.cScaleLabel8,
383
- c.cScaleLabel9,
384
- c.cScaleLabel10,
385
- c.cScaleLabel11
386
- ]);
387
- h && b.append("text").attr("x", S / 2).attr("y", u / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(h);
388
- const V = b.append("g").attr("transform", `translate(0, ${u})`).attr("class", "treemapContainer"), R = Q(g).sum((e) => e.value ?? 0).sort((e, i) => (i.value ?? 0) - (e.value ?? 0)), ee = Ke().size([r, x]).paddingTop(
389
- (e) => e.children && e.children.length > 0 ? X + B : 0
390
- ).paddingInner(d).paddingLeft((e) => e.children && e.children.length > 0 ? B : 0).paddingRight((e) => e.children && e.children.length > 0 ? B : 0).paddingBottom((e) => e.children && e.children.length > 0 ? B : 0).round(!0)(R), se = ee.descendants().filter((e) => e.children && e.children.length > 0), W = V.selectAll(".treemapSection").data(se).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
391
- W.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;" : ""), W.append("clipPath").attr("id", (e, i) => `clip-section-${a}-${i}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 12)).attr("height", X), W.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", (e, i) => `treemapSection section${i}`).attr("fill", (e) => m(e.data.name)).attr("fill-opacity", 0.6).attr("stroke", (e) => N(e.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (e) => {
392
- if (e.depth === 0)
393
- return "display: none;";
394
- const i = P({ cssCompiledStyles: e.data.cssCompiledStyles });
395
- return i.nodeStyles + ";" + i.borderStyles.join(";");
396
- }), W.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) => {
397
- if (e.depth === 0)
398
- return "display: none;";
399
- const i = "dominant-baseline: middle; font-size: 12px; fill:" + k(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
400
- return i + f.labelStyles.replace("color:", "fill:");
401
- }).each(function(e) {
402
- if (e.depth === 0)
403
- return;
404
- const i = Y(this), f = e.data.name;
405
- i.text(f);
406
- const C = e.x1 - e.x0, $ = 6;
407
- let A;
408
- s.showValues !== !1 && e.value ? A = C - 10 - 30 - 10 - $ : A = C - $ - 6;
409
- const F = Math.max(15, A), y = i.node();
410
- if (y.getComputedTextLength() > F) {
411
- const T = "...";
412
- let L = f;
413
- for (; L.length > 0; ) {
414
- if (L = f.substring(0, L.length - 1), L.length === 0) {
415
- i.text(T), y.getComputedTextLength() > F && i.text("");
416
- break;
417
- }
418
- if (i.text(L + T), y.getComputedTextLength() <= F)
419
- break;
420
- }
421
- }
422
- }), s.showValues !== !1 && W.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 ? p(e.value) : "").attr("font-style", "italic").attr("style", (e) => {
423
- if (e.depth === 0)
424
- return "display: none;";
425
- const i = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + k(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
426
- return i + f.labelStyles.replace("color:", "fill:");
427
- });
428
- const ie = ee.leaves(), j = V.selectAll(".treemapLeafGroup").data(ie).enter().append("g").attr("class", (e, i) => `treemapNode treemapLeafGroup leaf${i}${e.data.classSelector ? ` ${e.data.classSelector}` : ""}x`).attr("transform", (e) => `translate(${e.x0},${e.y0})`);
429
- j.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) => P({ 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), j.append("clipPath").attr("id", (e, i) => `clip-${a}-${i}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 4)).attr("height", (e) => Math.max(0, e.y1 - e.y0 - 4)), j.append("text").attr("class", "treemapLabel").attr("x", (e) => (e.x1 - e.x0) / 2).attr("y", (e) => (e.y1 - e.y0) / 2).attr("style", (e) => {
430
- const i = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + k(e.data.name) + ";", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
431
- return i + f.labelStyles.replace("color:", "fill:");
432
- }).attr("clip-path", (e, i) => `url(#clip-${a}-${i})`).text((e) => e.data.name).each(function(e) {
433
- const i = Y(this), f = e.x1 - e.x0, C = e.y1 - e.y0, $ = i.node(), A = 4, D = f - 2 * A, F = C - 2 * A;
434
- if (D < 10 || F < 10) {
435
- i.style("display", "none");
436
- return;
437
- }
438
- let y = parseInt(i.style("font-size"), 10);
439
- const _ = 8, T = 28, L = 0.6, z = 6, H = 2;
440
- for (; $.getComputedTextLength() > D && y > _; )
441
- y--, i.style("font-size", `${y}px`);
442
- let I = Math.max(
443
- z,
444
- Math.min(T, Math.round(y * L))
445
- ), Z = y + H + I;
446
- for (; Z > F && y > _ && (y--, I = Math.max(
447
- z,
448
- Math.min(T, Math.round(y * L))
449
- ), !(I < z && y === _)); )
450
- i.style("font-size", `${y}px`), Z = y + H + I;
451
- i.style("font-size", `${y}px`), ($.getComputedTextLength() > D || y < _ || F < y) && i.style("display", "none");
452
- }), s.showValues !== !1 && j.append("text").attr("class", "treemapValue").attr("x", (i) => (i.x1 - i.x0) / 2).attr("y", function(i) {
453
- return (i.y1 - i.y0) / 2;
454
- }).attr("style", (i) => {
455
- const f = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + k(i.data.name) + ";", C = P({ cssCompiledStyles: i.data.cssCompiledStyles });
456
- return f + C.labelStyles.replace("color:", "fill:");
457
- }).attr("clip-path", (i, f) => `url(#clip-${a}-${f})`).text((i) => i.value ? p(i.value) : "").each(function(i) {
458
- const f = Y(this), C = this.parentNode;
459
- if (!C) {
460
- f.style("display", "none");
461
- return;
462
- }
463
- const $ = Y(C).select(".treemapLabel");
464
- if ($.empty() || $.style("display") === "none") {
465
- f.style("display", "none");
466
- return;
467
- }
468
- const A = parseFloat($.style("font-size")), D = 28, F = 0.6, y = 6, _ = 2, T = Math.max(
469
- y,
470
- Math.min(D, Math.round(A * F))
471
- );
472
- f.style("font-size", `${T}px`);
473
- const z = (i.y1 - i.y0) / 2 + A / 2 + _;
474
- f.attr("y", z);
475
- const H = i.x1 - i.x0, ce = i.y1 - i.y0 - 4, de = H - 2 * 4;
476
- f.node().getComputedTextLength() > de || z + T > ce || T < y ? f.style("display", "none") : f.style("display", null);
477
- });
478
- const oe = s.diagramPadding ?? 8;
479
- we(b, oe, "flowchart", s?.useMaxWidth || !1);
480
- }, "draw"), nt = /* @__PURE__ */ w(function(t, a) {
481
- return a.db.getClasses();
482
- }, "getClasses"), lt = { draw: at, getClasses: nt }, rt = {
483
- sectionStrokeColor: "black",
484
- sectionStrokeWidth: "1",
485
- sectionFillColor: "#efefef",
486
- leafStrokeColor: "black",
487
- leafStrokeWidth: "1",
488
- leafFillColor: "#efefef",
489
- labelColor: "black",
490
- labelFontSize: "12px",
491
- valueFontSize: "10px",
492
- valueColor: "black",
493
- titleColor: "black",
494
- titleFontSize: "14px"
495
- }, st = /* @__PURE__ */ w(({
496
- treemap: t
497
- } = {}) => {
498
- const a = te(rt, t);
499
- return `
500
- .treemapNode.section {
501
- stroke: ${a.sectionStrokeColor};
502
- stroke-width: ${a.sectionStrokeWidth};
503
- fill: ${a.sectionFillColor};
504
- }
505
- .treemapNode.leaf {
506
- stroke: ${a.leafStrokeColor};
507
- stroke-width: ${a.leafStrokeWidth};
508
- fill: ${a.leafFillColor};
509
- }
510
- .treemapLabel {
511
- fill: ${a.labelColor};
512
- font-size: ${a.labelFontSize};
513
- }
514
- .treemapValue {
515
- fill: ${a.valueColor};
516
- font-size: ${a.valueFontSize};
517
- }
518
- .treemapTitle {
519
- fill: ${a.titleColor};
520
- font-size: ${a.titleFontSize};
521
- }
522
- `;
523
- }, "getStyles"), it = st, mt = {
524
- parser: re,
525
- get db() {
526
- return new ne();
527
- },
528
- renderer: lt,
529
- styles: it
530
- };
531
- export {
532
- mt as diagram
533
- };