hexagon-editor 0.1.5 → 0.1.7

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 (117) hide show
  1. package/README.md +44 -24
  2. package/dist/MarkdownEditor.vue.d.ts +28 -26
  3. package/dist/MarkdownEditor.vue.d.ts.map +1 -1
  4. package/dist/{MarkdownEditorLinkForm-C7CGgA83.js → MarkdownEditorLinkForm-B9dEX3WT.js} +1 -1
  5. package/dist/{base-Bnv2-Te4.js → base-BPdMUtQo.js} +141 -137
  6. package/dist/components/MarkdownEditorToolbar.vue.d.ts +4 -3
  7. package/dist/components/MarkdownEditorToolbar.vue.d.ts.map +1 -1
  8. package/dist/configure.d.ts +0 -2
  9. package/dist/configure.d.ts.map +1 -1
  10. package/dist/configure.js +11 -12
  11. package/dist/core/basic-editor-markdown.d.ts.map +1 -1
  12. package/dist/core/basic-editor-renderers.d.ts +6 -4
  13. package/dist/core/basic-editor-renderers.d.ts.map +1 -1
  14. package/dist/core/basic-editor-types.d.ts +2 -0
  15. package/dist/core/basic-editor-types.d.ts.map +1 -1
  16. package/dist/core/basic-editor.d.ts +1 -1
  17. package/dist/core/basic-editor.d.ts.map +1 -1
  18. package/dist/core/index.d.ts +0 -2
  19. package/dist/core/index.d.ts.map +1 -1
  20. package/dist/core.js +28 -31
  21. package/dist/extensions.js +1 -1
  22. package/dist/forms/MarkdownEditorImageForm.vue.d.ts +2 -2
  23. package/dist/forms/MarkdownEditorImageForm.vue.d.ts.map +1 -1
  24. package/dist/forms/MarkdownEditorLinkForm.vue.d.ts +2 -2
  25. package/dist/forms/MarkdownEditorTextInput.vue.d.ts +2 -2
  26. package/dist/forms/MarkdownEditorTextInput.vue.d.ts.map +1 -1
  27. package/dist/forms.js +1 -1
  28. package/dist/{full-C-o2lPBX.js → full-Da8esvj2.js} +1 -1
  29. package/dist/{full-specs-Cl-ODShc.js → full-specs-hXKoMF-0.js} +1 -1
  30. package/dist/index-D_CMntQU.js +3173 -0
  31. package/dist/index.css +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +240 -236
  35. package/dist/{markup-commands-B2NMfYHE.js → markup-commands-BYsx8ADT.js} +1989 -1963
  36. package/dist/presets.js +2 -2
  37. package/dist/public-types.d.ts +22 -0
  38. package/dist/public-types.d.ts.map +1 -1
  39. package/dist/renderer/MarkdownRenderer.vue.d.ts +2 -0
  40. package/dist/renderer/MarkdownRenderer.vue.d.ts.map +1 -1
  41. package/dist/renderer/markdown.d.ts +2 -1
  42. package/dist/renderer/markdown.d.ts.map +1 -1
  43. package/dist/renderer.css +1 -1
  44. package/dist/renderer.js +3590 -200
  45. package/package.json +106 -108
  46. package/dist/MarkdownEditorLinkForm.css +0 -1
  47. package/dist/abnfDiagram-N423BO3Z-DCf6sPky.js +0 -87
  48. package/dist/arc-y6UeoJpJ.js +0 -83
  49. package/dist/architectureDiagram-T3A2C74G-Cc3_3-cI.js +0 -4778
  50. package/dist/base.css +0 -1
  51. package/dist/blockDiagram-VBNYF7ZC-DWVLZwXY.js +0 -2419
  52. package/dist/c4Diagram-5PPSVZJV-CaIN7qay.js +0 -1577
  53. package/dist/channel-BwXGcavV.js +0 -5
  54. package/dist/chunk-2GRJ4B5K-O75udjPr.js +0 -68
  55. package/dist/chunk-2Q5K7J3B-CySL0lOA.js +0 -15
  56. package/dist/chunk-5RXB4S5H-BKPnLCOJ.js +0 -1408
  57. package/dist/chunk-5VM5RSS4--it1VJIv.js +0 -19
  58. package/dist/chunk-6Q2QTUOP-DNiML-50.js +0 -664
  59. package/dist/chunk-GF5L2VYU-z7A-k0-V.js +0 -1533
  60. package/dist/chunk-JWPE2WC7-DAjx3Kjr.js +0 -8
  61. package/dist/chunk-KBJHAD2P-D4R1VW0r.js +0 -19
  62. package/dist/chunk-RYQCIY6F-DmJAYxq8.js +0 -313
  63. package/dist/chunk-XXDRQBXY-CK913N-t.js +0 -8
  64. package/dist/classDiagram-JCYQIIEL-Djipq_HJ.js +0 -16
  65. package/dist/classDiagram-v2-OCEON4UE-Djipq_HJ.js +0 -16
  66. package/dist/core/optional-renderers.d.ts +0 -9
  67. package/dist/core/optional-renderers.d.ts.map +0 -1
  68. package/dist/cose-bilkent-JH36ORCC-CXuKFbXy.js +0 -2608
  69. package/dist/cynefin-VYW2F7L2-Bkk-F_Js.js +0 -23766
  70. package/dist/cynefinDiagram-MW4NZA55-DwOK40hm.js +0 -299
  71. package/dist/cytoscape.esm-3W4EOjxC.js +0 -18756
  72. package/dist/dagre-VZM6K2ZE-0VsGm8Ag.js +0 -340
  73. package/dist/defaultLocale-BgPVtth8.js +0 -171
  74. package/dist/diagram-7IWD3JNH-BrApu1hz.js +0 -350
  75. package/dist/diagram-B4RE2ZJO-CVXoBg2r.js +0 -461
  76. package/dist/diagram-LBJQPF4R-Dp0eSz2L.js +0 -142
  77. package/dist/diagram-Q27KOJAE-DWIltqIH.js +0 -528
  78. package/dist/diagram-UB23O5K3-B7z2Lj3K.js +0 -219
  79. package/dist/ebnfDiagram-BXEA7PRR-CYgE6z_2.js +0 -109
  80. package/dist/erDiagram-JOGREHBK-D3QWrPo-.js +0 -910
  81. package/dist/flowDiagram-UKHOOZJN-CfjPcHNW.js +0 -1638
  82. package/dist/ganttDiagram-PKOTCBZU-ECmaWI-9.js +0 -2711
  83. package/dist/gitGraphDiagram-DS77QQ5N-DgG1RGJ8.js +0 -815
  84. package/dist/graph-DAHC4kPm.js +0 -1545
  85. package/dist/infoDiagram-6WML65LV-B1Yl3nZV.js +0 -24
  86. package/dist/init-DjUOC4st.js +0 -16
  87. package/dist/ishikawaDiagram-WSZJBQD7-4sngaB5o.js +0 -621
  88. package/dist/journeyDiagram-NVQOT4AX-B_6AmR_j.js +0 -834
  89. package/dist/kanban-definition-27J2QSJJ-B8BO9o8J.js +0 -724
  90. package/dist/katex-ByXcxnHy.js +0 -14436
  91. package/dist/katex-DoRnZ_sp.js +0 -11682
  92. package/dist/layout-DBbo_M5I.js +0 -1519
  93. package/dist/linear-BEdRfKba.js +0 -259
  94. package/dist/map-DRdzG8Ho.js +0 -224
  95. package/dist/markup-commands.css +0 -1
  96. package/dist/mermaid.core-CR0bA2Wa.js +0 -16496
  97. package/dist/mindmap-definition-FAOFIHXS-DnPz807N.js +0 -827
  98. package/dist/optional-renderers-BalvqqvY.js +0 -11
  99. package/dist/ordinal-B6-f3MAq.js +0 -61
  100. package/dist/pegDiagram-VL7TDLO6-csGWlzs8.js +0 -95
  101. package/dist/pieDiagram-7S7Q4E2Y-Bqs8j5FX.js +0 -207
  102. package/dist/quadrantDiagram-CIZ2JOQS-jzP4lRrY.js +0 -1023
  103. package/dist/railroadDiagram-AXF67PYL-BSCyR24u.js +0 -77
  104. package/dist/renderer/mermaid-runtime.d.ts +0 -4
  105. package/dist/renderer/mermaid-runtime.d.ts.map +0 -1
  106. package/dist/requirementDiagram-LRYGKXZP-DmEkLYqX.js +0 -882
  107. package/dist/sankeyDiagram-W5VNT64P-CYvRYMTh.js +0 -847
  108. package/dist/sequenceDiagram-SI44F4Z6-CyWbDtPA.js +0 -2888
  109. package/dist/sizeCapture-X5ZJPWSS-xKhYCY84.js +0 -46
  110. package/dist/stateDiagram-OKZ733FA-DP44R2Dd.js +0 -263
  111. package/dist/stateDiagram-v2-UEYNNEHI-BvlOisND.js +0 -16
  112. package/dist/swimlanes-SLNWSIFB-BKFp8twH.js +0 -5332
  113. package/dist/swimlanesDiagram-ULZ7WXOC-CTvIFuHq.js +0 -13
  114. package/dist/timeline-definition-Z64GVDOM-B4137uIl.js +0 -1055
  115. package/dist/vennDiagram-T6HMQDX7-CPs8gXjx.js +0 -1578
  116. package/dist/wardleyDiagram-T6FBY63Y-BYp13hbI.js +0 -675
  117. package/dist/xychartDiagram-ELKLHX3M-DTT37K2u.js +0 -1388
@@ -1,528 +0,0 @@
1
- import { p as ge } from "./chunk-JWPE2WC7-DAjx3Kjr.js";
2
- import { _ as w, E as ye, y as ae, A as ee, D as Se, e as ve, l as te, bf as B, d as U, b as xe, a as be, n as we, o as Ce, g as Te, s as Le, B as $e, bg as Ae, p as Fe } from "./mermaid.core-CR0bA2Wa.js";
3
- import { s as Ne } from "./chunk-KBJHAD2P-D4R1VW0r.js";
4
- import { p as Me } from "./cynefin-VYW2F7L2-Bkk-F_Js.js";
5
- import { b as O } from "./defaultLocale-BgPVtth8.js";
6
- import { o as Q } from "./ordinal-B6-f3MAq.js";
7
- function _e(t) {
8
- var a = 0, l = t.children, n = l && l.length;
9
- if (!n) a = 1;
10
- else for (; --n >= 0; ) a += l[n].value;
11
- t.value = a;
12
- }
13
- function ke() {
14
- return this.eachAfter(_e);
15
- }
16
- function ze(t, a) {
17
- let l = -1;
18
- for (const n of this)
19
- t.call(a, n, ++l, this);
20
- return this;
21
- }
22
- function Ve(t, a) {
23
- for (var l = this, n = [l], s, i, h = -1; l = n.pop(); )
24
- if (t.call(a, l, ++h, this), s = l.children)
25
- for (i = s.length - 1; i >= 0; --i)
26
- n.push(s[i]);
27
- return this;
28
- }
29
- function De(t, a) {
30
- for (var l = this, n = [l], s = [], i, h, d, g = -1; l = n.pop(); )
31
- if (s.push(l), i = l.children)
32
- for (h = 0, d = i.length; h < d; ++h)
33
- n.push(i[h]);
34
- for (; l = s.pop(); )
35
- t.call(a, l, ++g, this);
36
- return this;
37
- }
38
- function Pe(t, a) {
39
- let l = -1;
40
- for (const n of this)
41
- if (t.call(a, n, ++l, this))
42
- return n;
43
- }
44
- function Be(t) {
45
- return this.eachAfter(function(a) {
46
- for (var l = +t(a.data) || 0, n = a.children, s = n && n.length; --s >= 0; ) l += n[s].value;
47
- a.value = l;
48
- });
49
- }
50
- function Ee(t) {
51
- return this.eachBefore(function(a) {
52
- a.children && a.children.sort(t);
53
- });
54
- }
55
- function Re(t) {
56
- for (var a = this, l = We(a, t), n = [a]; a !== l; )
57
- a = a.parent, n.push(a);
58
- for (var s = n.length; t !== l; )
59
- n.splice(s, 0, t), t = t.parent;
60
- return n;
61
- }
62
- function We(t, a) {
63
- if (t === a) return t;
64
- var l = t.ancestors(), n = a.ancestors(), s = null;
65
- for (t = l.pop(), a = n.pop(); t === a; )
66
- s = t, t = l.pop(), a = n.pop();
67
- return s;
68
- }
69
- function He() {
70
- for (var t = this, a = [t]; t = t.parent; )
71
- a.push(t);
72
- return a;
73
- }
74
- function Ie() {
75
- return Array.from(this);
76
- }
77
- function Oe() {
78
- var t = [];
79
- return this.eachBefore(function(a) {
80
- a.children || t.push(a);
81
- }), t;
82
- }
83
- function Ge() {
84
- var t = this, a = [];
85
- return t.each(function(l) {
86
- l !== t && a.push({ source: l.parent, target: l });
87
- }), a;
88
- }
89
- function* qe() {
90
- var t = this, a, l = [t], n, s, i;
91
- do
92
- for (a = l.reverse(), l = []; t = a.pop(); )
93
- if (yield t, n = t.children)
94
- for (s = 0, i = n.length; s < i; ++s)
95
- l.push(n[s]);
96
- while (l.length);
97
- }
98
- function ne(t, a) {
99
- t instanceof Map ? (t = [void 0, t], a === void 0 && (a = je)) : a === void 0 && (a = Ye);
100
- for (var l = new Z(t), n, s = [l], i, h, d, g; n = s.pop(); )
101
- if ((h = a(n.data)) && (g = (h = Array.from(h)).length))
102
- for (n.children = h, d = g - 1; d >= 0; --d)
103
- s.push(i = h[d] = new Z(h[d])), i.parent = n, i.depth = n.depth + 1;
104
- return l.eachBefore(Ze);
105
- }
106
- function Xe() {
107
- return ne(this).eachBefore(Ue);
108
- }
109
- function Ye(t) {
110
- return t.children;
111
- }
112
- function je(t) {
113
- return Array.isArray(t) ? t[1] : null;
114
- }
115
- function Ue(t) {
116
- t.data.value !== void 0 && (t.value = t.data.value), t.data = t.data.data;
117
- }
118
- function Ze(t) {
119
- var a = 0;
120
- do
121
- t.height = a;
122
- while ((t = t.parent) && t.height < ++a);
123
- }
124
- function Z(t) {
125
- this.data = t, this.depth = this.height = 0, this.parent = null;
126
- }
127
- Z.prototype = ne.prototype = {
128
- constructor: Z,
129
- count: ke,
130
- each: ze,
131
- eachAfter: De,
132
- eachBefore: Ve,
133
- find: Pe,
134
- sum: Be,
135
- sort: Ee,
136
- path: Re,
137
- ancestors: He,
138
- descendants: Ie,
139
- leaves: Oe,
140
- links: Ge,
141
- copy: Xe,
142
- [Symbol.iterator]: qe
143
- };
144
- function Je(t) {
145
- if (typeof t != "function") throw new Error();
146
- return t;
147
- }
148
- function G() {
149
- return 0;
150
- }
151
- function q(t) {
152
- return function() {
153
- return t;
154
- };
155
- }
156
- function Ke(t) {
157
- t.x0 = Math.round(t.x0), t.y0 = Math.round(t.y0), t.x1 = Math.round(t.x1), t.y1 = Math.round(t.y1);
158
- }
159
- function Qe(t, a, l, n, s) {
160
- for (var i = t.children, h, d = -1, g = i.length, c = t.value && (n - a) / t.value; ++d < g; )
161
- h = i[d], h.y0 = l, h.y1 = s, h.x0 = a, h.x1 = a += h.value * c;
162
- }
163
- function et(t, a, l, n, s) {
164
- for (var i = t.children, h, d = -1, g = i.length, c = t.value && (s - l) / t.value; ++d < g; )
165
- h = i[d], h.x0 = a, h.x1 = n, h.y0 = l, h.y1 = l += h.value * c;
166
- }
167
- var tt = (1 + Math.sqrt(5)) / 2;
168
- function at(t, a, l, n, s, i) {
169
- for (var h = [], d = a.children, g, c, u = 0, b = 0, r = d.length, x, S, v = a.value, p, y, N, $, V, W, M; u < r; ) {
170
- x = s - l, S = i - n;
171
- do
172
- p = d[b++].value;
173
- while (!p && b < r);
174
- for (y = N = p, W = Math.max(S / x, x / S) / (v * t), M = p * p * W, V = Math.max(N / M, M / y); b < r; ++b) {
175
- if (p += c = d[b].value, c < y && (y = c), c > N && (N = c), M = p * p * W, $ = Math.max(N / M, M / y), $ > V) {
176
- p -= c;
177
- break;
178
- }
179
- V = $;
180
- }
181
- h.push(g = { value: p, dice: x < S, children: d.slice(u, b) }), g.dice ? Qe(g, l, n, s, v ? n += S * p / v : i) : et(g, l, n, v ? l += x * p / v : s, i), v -= p, u = b;
182
- }
183
- return h;
184
- }
185
- const nt = (function t(a) {
186
- function l(n, s, i, h, d) {
187
- at(a, n, s, i, h, d);
188
- }
189
- return l.ratio = function(n) {
190
- return t((n = +n) > 1 ? n : 1);
191
- }, l;
192
- })(tt);
193
- function lt() {
194
- var t = nt, a = !1, l = 1, n = 1, s = [0], i = G, h = G, d = G, g = G, c = G;
195
- function u(r) {
196
- return r.x0 = r.y0 = 0, r.x1 = l, r.y1 = n, r.eachBefore(b), s = [0], a && r.eachBefore(Ke), r;
197
- }
198
- function b(r) {
199
- var x = s[r.depth], S = r.x0 + x, v = r.y0 + x, p = r.x1 - x, y = r.y1 - x;
200
- p < S && (S = p = (S + p) / 2), y < v && (v = y = (v + y) / 2), r.x0 = S, r.y0 = v, r.x1 = p, r.y1 = y, r.children && (x = s[r.depth + 1] = i(r) / 2, S += c(r) - x, v += h(r) - x, p -= d(r) - x, y -= g(r) - x, p < S && (S = p = (S + p) / 2), y < v && (v = y = (v + y) / 2), t(r, S, v, p, y));
201
- }
202
- return u.round = function(r) {
203
- return arguments.length ? (a = !!r, u) : a;
204
- }, u.size = function(r) {
205
- return arguments.length ? (l = +r[0], n = +r[1], u) : [l, n];
206
- }, u.tile = function(r) {
207
- return arguments.length ? (t = Je(r), u) : t;
208
- }, u.padding = function(r) {
209
- return arguments.length ? u.paddingInner(r).paddingOuter(r) : u.paddingInner();
210
- }, u.paddingInner = function(r) {
211
- return arguments.length ? (i = typeof r == "function" ? r : q(+r), u) : i;
212
- }, u.paddingOuter = function(r) {
213
- return arguments.length ? u.paddingTop(r).paddingRight(r).paddingBottom(r).paddingLeft(r) : u.paddingTop();
214
- }, u.paddingTop = function(r) {
215
- return arguments.length ? (h = typeof r == "function" ? r : q(+r), u) : h;
216
- }, u.paddingRight = function(r) {
217
- return arguments.length ? (d = typeof r == "function" ? r : q(+r), u) : d;
218
- }, u.paddingBottom = function(r) {
219
- return arguments.length ? (g = typeof r == "function" ? r : q(+r), u) : g;
220
- }, u.paddingLeft = function(r) {
221
- return arguments.length ? (c = typeof r == "function" ? r : q(+r), u) : c;
222
- }, u;
223
- }
224
- var R, oe = (R = class {
225
- constructor() {
226
- this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = xe, this.getAccTitle = be, this.setDiagramTitle = we, this.getDiagramTitle = Ce, this.getAccDescription = Te, this.setAccDescription = Le;
227
- }
228
- getNodes() {
229
- return this.nodes;
230
- }
231
- getConfig() {
232
- const a = $e, l = ae();
233
- return ee({
234
- ...a.treemap,
235
- ...l.treemap ?? {}
236
- });
237
- }
238
- addNode(a, l) {
239
- this.nodes.push(a), this.levels.set(a, l), l === 0 && (this.outerNodes.push(a), this.root ??= a);
240
- }
241
- getRoot() {
242
- return { name: "", children: this.outerNodes };
243
- }
244
- addClass(a, l) {
245
- const n = this.classes.get(a) ?? { id: a, styles: [], textStyles: [] }, s = l.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
246
- s && s.forEach((i) => {
247
- Ae(i) && (n?.textStyles ? n.textStyles.push(i) : n.textStyles = [i]), n?.styles ? n.styles.push(i) : n.styles = [i];
248
- }), this.classes.set(a, n);
249
- }
250
- getClasses() {
251
- return this.classes;
252
- }
253
- getStylesForClass(a) {
254
- return this.classes.get(a)?.styles ?? [];
255
- }
256
- clear() {
257
- Fe(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
258
- }
259
- }, w(R, "TreeMapDB"), R);
260
- function ce(t) {
261
- if (!t.length)
262
- return [];
263
- const a = [], l = [];
264
- return t.forEach((n) => {
265
- const s = {
266
- name: n.name,
267
- children: n.type === "Leaf" ? void 0 : []
268
- };
269
- for (s.classSelector = n?.classSelector, n?.cssCompiledStyles && (s.cssCompiledStyles = n.cssCompiledStyles), n.type === "Leaf" && n.value !== void 0 && (s.value = n.value); l.length > 0 && l[l.length - 1].level >= n.level; )
270
- l.pop();
271
- if (l.length === 0)
272
- a.push(s);
273
- else {
274
- const i = l[l.length - 1].node;
275
- i.children ? i.children.push(s) : i.children = [s];
276
- }
277
- n.type !== "Leaf" && l.push({ node: s, level: n.level });
278
- }), a;
279
- }
280
- w(ce, "buildHierarchy");
281
- var st = /* @__PURE__ */ w((t, a) => {
282
- ge(t, a);
283
- const l = [];
284
- for (const i of t.TreemapRows ?? [])
285
- i.$type === "ClassDefStatement" && a.addClass(i.className ?? "", i.styleText ?? "");
286
- for (const i of t.TreemapRows ?? []) {
287
- const h = i.item;
288
- if (!h)
289
- continue;
290
- const d = i.indent ? parseInt(i.indent) : 0, g = rt(h), c = h.classSelector ? a.getStylesForClass(h.classSelector) : [], u = c.length > 0 ? c : void 0, b = {
291
- level: d,
292
- name: g,
293
- type: h.$type,
294
- value: h.value,
295
- classSelector: h.classSelector,
296
- cssCompiledStyles: u
297
- };
298
- l.push(b);
299
- }
300
- const n = ce(l), s = /* @__PURE__ */ w((i, h) => {
301
- for (const d of i)
302
- a.addNode(d, h), d.children && d.children.length > 0 && s(d.children, h + 1);
303
- }, "addNodesRecursively");
304
- s(n, 0);
305
- }, "populate"), rt = /* @__PURE__ */ w((t) => t.name ? String(t.name) : "", "getItemName"), he = {
306
- // @ts-expect-error - TreeMapDB is not assignable to DiagramDB
307
- parser: { yy: void 0 },
308
- parse: /* @__PURE__ */ w(async (t) => {
309
- try {
310
- const l = await Me("treemap", t);
311
- te.debug("Treemap AST:", l);
312
- const n = he.parser?.yy;
313
- if (!(n instanceof oe))
314
- throw new Error(
315
- "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."
316
- );
317
- st(l, n);
318
- } catch (a) {
319
- throw te.error("Error parsing treemap:", a), a;
320
- }
321
- }, "parse")
322
- }, it = 10, E = 10, X = 25, ot = /* @__PURE__ */ w((t, a, l, n) => {
323
- const s = n.db, i = s.getConfig(), h = i.padding ?? it, d = s.getDiagramTitle(), g = s.getRoot(), { themeVariables: c } = ae();
324
- if (!g)
325
- return;
326
- const u = d ? 30 : 0, b = Se(a), r = i.nodeWidth ? i.nodeWidth * E : 960, x = i.nodeHeight ? i.nodeHeight * E : 500, S = r, v = x + u;
327
- b.attr("viewBox", `0 0 ${S} ${v}`), ve(b, v, S, i.useMaxWidth);
328
- let p;
329
- try {
330
- const e = i.valueFormat || ",";
331
- if (e === "$0,0")
332
- p = /* @__PURE__ */ w((o) => "$" + O(",")(o), "valueFormat");
333
- else if (e.startsWith("$") && e.includes(",")) {
334
- const o = /\.\d+/.exec(e), f = o ? o[0] : "";
335
- p = /* @__PURE__ */ w((C) => "$" + O("," + f)(C), "valueFormat");
336
- } else if (e.startsWith("$")) {
337
- const o = e.substring(1);
338
- p = /* @__PURE__ */ w((f) => "$" + O(o || "")(f), "valueFormat");
339
- } else
340
- p = O(e);
341
- } catch (e) {
342
- te.error("Error creating format function:", e), p = O(",");
343
- }
344
- const y = Q().range([
345
- "transparent",
346
- c.cScale0,
347
- c.cScale1,
348
- c.cScale2,
349
- c.cScale3,
350
- c.cScale4,
351
- c.cScale5,
352
- c.cScale6,
353
- c.cScale7,
354
- c.cScale8,
355
- c.cScale9,
356
- c.cScale10,
357
- c.cScale11
358
- ]), N = Q().range([
359
- "transparent",
360
- c.cScalePeer0,
361
- c.cScalePeer1,
362
- c.cScalePeer2,
363
- c.cScalePeer3,
364
- c.cScalePeer4,
365
- c.cScalePeer5,
366
- c.cScalePeer6,
367
- c.cScalePeer7,
368
- c.cScalePeer8,
369
- c.cScalePeer9,
370
- c.cScalePeer10,
371
- c.cScalePeer11
372
- ]), $ = Q().range([
373
- c.cScaleLabel0,
374
- c.cScaleLabel1,
375
- c.cScaleLabel2,
376
- c.cScaleLabel3,
377
- c.cScaleLabel4,
378
- c.cScaleLabel5,
379
- c.cScaleLabel6,
380
- c.cScaleLabel7,
381
- c.cScaleLabel8,
382
- c.cScaleLabel9,
383
- c.cScaleLabel10,
384
- c.cScaleLabel11
385
- ]);
386
- d && b.append("text").attr("x", S / 2).attr("y", u / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(d);
387
- const V = b.append("g").attr("transform", `translate(0, ${u})`).attr("class", "treemapContainer"), W = ne(g).sum((e) => e.value ?? 0).sort((e, o) => (o.value ?? 0) - (e.value ?? 0)), le = lt().size([r, x]).paddingTop(
388
- (e) => e.children && e.children.length > 0 ? X + E : 0
389
- ).paddingInner(h).paddingLeft((e) => e.children && e.children.length > 0 ? E : 0).paddingRight((e) => e.children && e.children.length > 0 ? E : 0).paddingBottom((e) => e.children && e.children.length > 0 ? E : 0).round(!0)(W), de = le.descendants().filter((e) => e.children && e.children.length > 0), H = V.selectAll(".treemapSection").data(de).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
390
- H.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;" : ""), H.append("clipPath").attr("id", (e, o) => `clip-section-${a}-${o}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 12)).attr("height", X), H.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", (e, o) => `treemapSection section${o}`).attr("fill", (e) => y(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) => {
391
- if (e.depth === 0)
392
- return "display: none;";
393
- const o = B({ cssCompiledStyles: e.data.cssCompiledStyles });
394
- return o.nodeStyles + ";" + o.borderStyles.join(";");
395
- }), H.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("clip-path", (e, o) => `url(#clip-section-${a}-${o})`).attr("style", (e) => {
396
- if (e.depth === 0)
397
- return "display: none;";
398
- const o = "dominant-baseline: middle; font-size: 12px; fill:" + $(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = B({ cssCompiledStyles: e.data.cssCompiledStyles });
399
- return o + f.labelStyles.replace("color:", "fill:");
400
- }).each(function(e) {
401
- if (e.depth === 0)
402
- return;
403
- const o = U(this), f = e.data.name;
404
- o.text(f);
405
- const C = e.x1 - e.x0, L = 6;
406
- let T;
407
- i.showValues !== !1 && e.value ? T = C - 10 - 30 - 10 - L : T = C - L - 6;
408
- const m = Math.max(15, T), _ = o.node();
409
- if (_.getComputedTextLength() > m) {
410
- let z = f;
411
- for (; z.length > 0; ) {
412
- if (z = f.substring(0, z.length - 1), z.length === 0) {
413
- o.text("..."), _.getComputedTextLength() > m && o.text("");
414
- break;
415
- }
416
- if (o.text(z + "..."), _.getComputedTextLength() <= m)
417
- break;
418
- }
419
- }
420
- }), i.showValues !== !1 && H.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) => {
421
- if (e.depth === 0)
422
- return "display: none;";
423
- const o = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + $(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = B({ cssCompiledStyles: e.data.cssCompiledStyles });
424
- return o + f.labelStyles.replace("color:", "fill:");
425
- });
426
- const se = le.leaves(), A = se.length > 20, ue = A ? 16 : 38, Y = A ? 14 : 28, D = A ? 4 : 8, I = A ? 4 : 6, J = A ? 2 : 4, re = A ? 8 : 10, K = A ? 1 : 2, j = V.selectAll(".treemapLeafGroup").data(se).enter().append("g").attr("class", (e, o) => `treemapNode treemapLeafGroup leaf${o}${e.data.classSelector ? ` ${e.data.classSelector}` : ""}x`).attr("transform", (e) => `translate(${e.x0},${e.y0})`);
427
- 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 ? y(e.parent.data.name) : y(e.data.name)).attr("style", (e) => B({ cssCompiledStyles: e.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", 0.3).attr("stroke", (e) => e.parent ? y(e.parent.data.name) : y(e.data.name)).attr("stroke-width", 3), j.append("clipPath").attr("id", (e, o) => `clip-${a}-${o}`).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) => {
428
- const o = `text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:` + $(e.data.name) + ";", f = B({ cssCompiledStyles: e.data.cssCompiledStyles });
429
- return o + f.labelStyles.replace("color:", "fill:");
430
- }).attr("clip-path", (e, o) => `url(#clip-${a}-${o})`).text((e) => e.data.name).each(function(e) {
431
- const o = U(this), f = e.x1 - e.x0, C = e.y1 - e.y0, L = o.node(), T = f - 2 * J, P = C - 2 * J;
432
- if (T < re || P < re) {
433
- o.style("display", "none");
434
- return;
435
- }
436
- let m = parseInt(o.style("font-size"), 10);
437
- const _ = 0.6;
438
- for (; L.getComputedTextLength() > T && m > D; )
439
- m--, o.style("font-size", `${m}px`);
440
- let F = Math.max(
441
- I,
442
- Math.min(Y, Math.round(m * _))
443
- ), k = m + K + F;
444
- for (; k > P && m > D && (m--, F = Math.max(
445
- I,
446
- Math.min(Y, Math.round(m * _))
447
- ), !(F < I && m === D)); )
448
- o.style("font-size", `${m}px`), k = m + K + F;
449
- o.style("font-size", `${m}px`), A ? (m < D || P < D) && o.style("display", "none") : (L.getComputedTextLength() > T || m < D || P < m) && o.style("display", "none");
450
- }), i.showValues !== !1 && j.append("text").attr("class", "treemapValue").attr("x", (o) => (o.x1 - o.x0) / 2).attr("y", function(o) {
451
- return (o.y1 - o.y0) / 2;
452
- }).attr("style", (o) => {
453
- const f = `text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:` + $(o.data.name) + ";", C = B({ cssCompiledStyles: o.data.cssCompiledStyles });
454
- return f + C.labelStyles.replace("color:", "fill:");
455
- }).attr("clip-path", (o, f) => `url(#clip-${a}-${f})`).text((o) => o.value ? p(o.value) : "").each(function(o) {
456
- const f = U(this), C = this.parentNode;
457
- if (!C) {
458
- f.style("display", "none");
459
- return;
460
- }
461
- const L = U(C).select(".treemapLabel");
462
- if (L.empty() || L.style("display") === "none") {
463
- f.style("display", "none");
464
- return;
465
- }
466
- const T = parseFloat(L.style("font-size")), m = Math.max(
467
- I,
468
- Math.min(Y, Math.round(T * 0.6))
469
- );
470
- f.style("font-size", `${m}px`);
471
- const F = (o.y1 - o.y0) / 2 + T / 2 + K;
472
- f.attr("y", F);
473
- const k = o.x1 - o.x0, ie = o.y1 - o.y0 - 4, me = k - 2 * J;
474
- f.node().getComputedTextLength() > me || F + m > ie || m < I ? f.style("display", "none") : f.style("display", null);
475
- });
476
- const pe = i.diagramPadding ?? 8;
477
- Ne(b, pe, "flowchart", i?.useMaxWidth || !1);
478
- }, "draw"), ct = /* @__PURE__ */ w(function(t, a) {
479
- return a.db.getClasses();
480
- }, "getClasses"), ht = { draw: ot, getClasses: ct }, dt = {
481
- sectionStrokeColor: "black",
482
- sectionStrokeWidth: "1",
483
- sectionFillColor: "#efefef",
484
- leafStrokeColor: "black",
485
- leafStrokeWidth: "1",
486
- leafFillColor: "#efefef",
487
- labelFontSize: "12px",
488
- valueFontSize: "10px",
489
- titleFontSize: "14px"
490
- }, ut = /* @__PURE__ */ w(({
491
- treemap: t
492
- } = {}) => {
493
- const a = ye(), l = ae(), n = ee(a, l.themeVariables), s = ee(dt, t), i = s.titleColor ?? n.titleColor, h = s.labelColor ?? n.textColor, d = s.valueColor ?? n.textColor;
494
- return `
495
- .treemapNode.section {
496
- stroke: ${s.sectionStrokeColor};
497
- stroke-width: ${s.sectionStrokeWidth};
498
- fill: ${s.sectionFillColor};
499
- }
500
- .treemapNode.leaf {
501
- stroke: ${s.leafStrokeColor};
502
- stroke-width: ${s.leafStrokeWidth};
503
- fill: ${s.leafFillColor};
504
- }
505
- .treemapLabel {
506
- fill: ${h};
507
- font-size: ${s.labelFontSize};
508
- }
509
- .treemapValue {
510
- fill: ${d};
511
- font-size: ${s.valueFontSize};
512
- }
513
- .treemapTitle {
514
- fill: ${i};
515
- font-size: ${s.titleFontSize};
516
- }
517
- `;
518
- }, "getStyles"), pt = ut, bt = {
519
- parser: he,
520
- get db() {
521
- return new oe();
522
- },
523
- renderer: ht,
524
- styles: pt
525
- };
526
- export {
527
- bt as diagram
528
- };