@yiyi_zhang/reactflow-ui 0.3.0 → 0.5.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -22
- package/dist/AiWorkflowIDE.d.ts +217 -0
- package/dist/WorkflowIDE.d.ts +22 -3
- package/dist/ai-BJwQZcGK.js +15168 -0
- package/dist/ai.d.ts +30 -0
- package/dist/arc-BUGZGgtu.js +83 -0
- package/dist/architectureDiagram-3BPJPVTR-ZcgvTwSO.js +4692 -0
- package/dist/blockDiagram-GPEHLZMM-DtVtOBbH.js +2418 -0
- package/dist/c4Diagram-AAUBKEIU-tBS5Rcvm.js +1577 -0
- package/dist/channel-CURI9jmI.js +5 -0
- package/dist/chunk-2J33WTMH-D7gashNz.js +19 -0
- package/dist/chunk-4BX2VUAB-DE3VjyiZ.js +8 -0
- package/dist/chunk-55IACEB6-GYZ_m2MY.js +8 -0
- package/dist/chunk-727SXJPM-D4WVyvOg.js +1528 -0
- package/dist/chunk-AQP2D5EJ-Os2Uwqya.js +1387 -0
- package/dist/chunk-FMBD7UC4-B3CSVzS4.js +19 -0
- package/dist/chunk-ND2GUHAM-CNj_s1aK.js +68 -0
- package/dist/chunk-QZHKN3VN-DoV8iUKo.js +15 -0
- package/dist/classDiagram-4FO5ZUOK-Dr9C18x4.js +16 -0
- package/dist/classDiagram-v2-Q7XG4LA2-Dr9C18x4.js +16 -0
- package/dist/components/AiNative/AgentTimeline.d.ts +18 -0
- package/dist/components/AiNative/AiCommandCenter.d.ts +40 -0
- package/dist/components/AiNative/AiConfigPanel.d.ts +9 -0
- package/dist/components/AiNative/BusinessCanvas.d.ts +15 -0
- package/dist/components/AiNative/CanvasPreview.d.ts +16 -0
- package/dist/components/AiNative/ClarificationCard.d.ts +9 -0
- package/dist/components/AiNative/FailureSummaryCard.d.ts +20 -0
- package/dist/components/AiNative/LibraryPanel.d.ts +9 -0
- package/dist/components/AiNative/MermaidBlock.d.ts +6 -0
- package/dist/components/AiNative/PlanCard.d.ts +15 -0
- package/dist/components/AiNative/ProposalPreviewCard.d.ts +21 -0
- package/dist/components/AiNative/RecommendationCard.d.ts +10 -0
- package/dist/components/AiNative/RepairCard.d.ts +17 -0
- package/dist/components/AiNative/ReviewBar.d.ts +21 -0
- package/dist/components/AiNative/WorkflowRunCard.d.ts +14 -0
- package/dist/components/Controls/ModeSlider.d.ts +2 -0
- package/dist/components/ExecutionSummaryPanel.d.ts +4 -0
- package/dist/components/WorkflowRunPanel.d.ts +12 -0
- package/dist/components/nodes/NodeWrapper.d.ts +2 -1
- package/dist/cose-bilkent-S5V4N54A-CgQlI-io.js +2609 -0
- package/dist/cytoscape.esm-kVAWcYoG.js +18755 -0
- package/dist/dagre-BM42HDAG-CFMIuOmS.js +445 -0
- package/dist/defaultLocale-BgPVtth8.js +171 -0
- package/dist/diagram-2AECGRRQ-C5jZp2YX.js +217 -0
- package/dist/diagram-5GNKFQAL-DRUVcHpp.js +123 -0
- package/dist/diagram-KO2AKTUF-BOl4aaej.js +461 -0
- package/dist/diagram-LMA3HP47-ZeckPR2Q.js +142 -0
- package/dist/diagram-OG6HWLK6-qUWeLfa-.js +528 -0
- package/dist/erDiagram-TEJ5UH35-Bw_CWS13.js +899 -0
- package/dist/flowDiagram-I6XJVG4X-D3xEvQA-.js +1628 -0
- package/dist/ganttDiagram-6RSMTGT7-D8GvenY3.js +2707 -0
- package/dist/gitGraphDiagram-PVQCEYII-BWrN_HOm.js +815 -0
- package/dist/graph-BRoPeNF3.js +1545 -0
- package/dist/hooks/useNodeExecution.d.ts +1 -1
- package/dist/hooks/useNodeLayout.d.ts +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/infoDiagram-5YYISTIA-Da8FG5tB.js +24 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/ishikawaDiagram-YF4QCWOH-Bg2_mKEc.js +621 -0
- package/dist/journeyDiagram-JHISSGLW-sFIxGfua.js +834 -0
- package/dist/kanban-definition-UN3LZRKU-CGmopzHd.js +724 -0
- package/dist/katex-DoRnZ_sp.js +11682 -0
- package/dist/layout-D9EpM4Fg.js +1728 -0
- package/dist/linear-BA49eco4.js +259 -0
- package/dist/mermaid.core-XSpZEAKP.js +16137 -0
- package/dist/mindmap-definition-RKZ34NQL-Bqf76QGB.js +827 -0
- package/dist/ordinal-B6-f3MAq.js +61 -0
- package/dist/pieDiagram-4H26LBE5-hHiP8HzL.js +163 -0
- package/dist/quadrantDiagram-W4KKPZXB-DSccwH8B.js +1024 -0
- package/dist/reactflow-ui-ai.es.js +12 -0
- package/dist/reactflow-ui.css +1 -1
- package/dist/reactflow-ui.es.js +8198 -7039
- package/dist/reactflow-ui.umd.js +52 -17
- package/dist/requirementDiagram-4Y6WPE33-DIpyoYZ_.js +882 -0
- package/dist/sankeyDiagram-5OEKKPKP-DsaPqq8D.js +847 -0
- package/dist/sequenceDiagram-3UESZ5HK-BNg7orie.js +2891 -0
- package/dist/services/ai/agentRunner.d.ts +51 -0
- package/dist/services/ai/contextEngine.d.ts +83 -0
- package/dist/services/ai/draftPersistence.d.ts +22 -0
- package/dist/services/ai/errorMessages.d.ts +16 -0
- package/dist/services/ai/intentClassifier.d.ts +17 -0
- package/dist/services/ai/protocolAdapter.d.ts +114 -0
- package/dist/services/ai/ruleEngine.d.ts +57 -0
- package/dist/services/ai/schemaRegistry.d.ts +51 -0
- package/dist/services/ai/systemPrompt.d.ts +30 -0
- package/dist/services/ai/toolDefs.d.ts +9 -0
- package/dist/services/ai/toolExecutor.d.ts +83 -0
- package/dist/services/ai/toolRegistry.d.ts +38 -0
- package/dist/services/ai/transport.d.ts +58 -0
- package/dist/services/aiService.d.ts +27 -5
- package/dist/stateDiagram-AJRCARHV-Rv1mSmnJ.js +263 -0
- package/dist/stateDiagram-v2-BHNVJYJU-BME16k02.js +16 -0
- package/dist/store/aiStore.d.ts +199 -0
- package/dist/store/ideStoresContext.d.ts +39 -0
- package/dist/store/libraryStore.d.ts +25 -0
- package/dist/timeline-definition-PNZ67QCA-CmmzdVk-.js +1055 -0
- package/dist/types/aiEvents.d.ts +38 -0
- package/dist/types/conductor.d.ts +23 -2
- package/dist/types/workflow.d.ts +36 -0
- package/dist/types/workflowLibrary.d.ts +27 -0
- package/dist/utils/executionAnalyzer.d.ts +32 -0
- package/dist/utils/nodeMeta.d.ts +6 -0
- package/dist/utils/proposalPreview.d.ts +19 -0
- package/dist/utils/taskTypeMeta.d.ts +18 -0
- package/dist/utils/workflowToMermaid.d.ts +7 -0
- package/dist/vennDiagram-CIIHVFJN-BQt00w9Q.js +1557 -0
- package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
- package/dist/wardleyDiagram-YWT4CUSO-LZpiODGN.js +675 -0
- package/dist/xychartDiagram-2RQKCTM6-BpJlv_mc.js +1342 -0
- package/package.json +14 -4
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import { _ as w, K as he, D as ee, F as J, I as ue, e as pe, l as Q, bc as P, d as j, b as fe, a as me, p as ge, q as ye, g as Se, s as ve, G as xe, bd as be, z as we } from "./mermaid.core-XSpZEAKP.js";
|
|
2
|
+
import { s as Ce } from "./chunk-2J33WTMH-D7gashNz.js";
|
|
3
|
+
import { p as Te } from "./chunk-4BX2VUAB-DE3VjyiZ.js";
|
|
4
|
+
import { p as Le } from "./wardley-L42UT6IY-D7b2ujEZ.js";
|
|
5
|
+
import { b as O } from "./defaultLocale-BgPVtth8.js";
|
|
6
|
+
import { o as Z } 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 Ae() {
|
|
14
|
+
return this.eachAfter($e);
|
|
15
|
+
}
|
|
16
|
+
function Fe(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 Ne(t, a) {
|
|
23
|
+
for (var l = this, n = [l], r, i, d = -1; l = n.pop(); )
|
|
24
|
+
if (t.call(a, l, ++d, this), r = l.children)
|
|
25
|
+
for (i = r.length - 1; i >= 0; --i)
|
|
26
|
+
n.push(r[i]);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
function Me(t, a) {
|
|
30
|
+
for (var l = this, n = [l], r = [], i, d, h, m = -1; l = n.pop(); )
|
|
31
|
+
if (r.push(l), i = l.children)
|
|
32
|
+
for (d = 0, h = i.length; d < h; ++d)
|
|
33
|
+
n.push(i[d]);
|
|
34
|
+
for (; l = r.pop(); )
|
|
35
|
+
t.call(a, l, ++m, this);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
function Ve(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 _e(t) {
|
|
45
|
+
return this.eachAfter(function(a) {
|
|
46
|
+
for (var l = +t(a.data) || 0, n = a.children, r = n && n.length; --r >= 0; ) l += n[r].value;
|
|
47
|
+
a.value = l;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function ke(t) {
|
|
51
|
+
return this.eachBefore(function(a) {
|
|
52
|
+
a.children && a.children.sort(t);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function ze(t) {
|
|
56
|
+
for (var a = this, l = De(a, t), n = [a]; a !== l; )
|
|
57
|
+
a = a.parent, n.push(a);
|
|
58
|
+
for (var r = n.length; t !== l; )
|
|
59
|
+
n.splice(r, 0, t), t = t.parent;
|
|
60
|
+
return n;
|
|
61
|
+
}
|
|
62
|
+
function De(t, a) {
|
|
63
|
+
if (t === a) return t;
|
|
64
|
+
var l = t.ancestors(), n = a.ancestors(), r = null;
|
|
65
|
+
for (t = l.pop(), a = n.pop(); t === a; )
|
|
66
|
+
r = t, t = l.pop(), a = n.pop();
|
|
67
|
+
return r;
|
|
68
|
+
}
|
|
69
|
+
function Pe() {
|
|
70
|
+
for (var t = this, a = [t]; t = t.parent; )
|
|
71
|
+
a.push(t);
|
|
72
|
+
return a;
|
|
73
|
+
}
|
|
74
|
+
function Be() {
|
|
75
|
+
return Array.from(this);
|
|
76
|
+
}
|
|
77
|
+
function Re() {
|
|
78
|
+
var t = [];
|
|
79
|
+
return this.eachBefore(function(a) {
|
|
80
|
+
a.children || t.push(a);
|
|
81
|
+
}), t;
|
|
82
|
+
}
|
|
83
|
+
function Ee() {
|
|
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* We() {
|
|
90
|
+
var t = this, a, l = [t], n, r, i;
|
|
91
|
+
do
|
|
92
|
+
for (a = l.reverse(), l = []; t = a.pop(); )
|
|
93
|
+
if (yield t, n = t.children)
|
|
94
|
+
for (r = 0, i = n.length; r < i; ++r)
|
|
95
|
+
l.push(n[r]);
|
|
96
|
+
while (l.length);
|
|
97
|
+
}
|
|
98
|
+
function te(t, a) {
|
|
99
|
+
t instanceof Map ? (t = [void 0, t], a === void 0 && (a = Oe)) : a === void 0 && (a = He);
|
|
100
|
+
for (var l = new K(t), n, r = [l], i, d, h, m; n = r.pop(); )
|
|
101
|
+
if ((d = a(n.data)) && (m = (d = Array.from(d)).length))
|
|
102
|
+
for (n.children = d, h = m - 1; h >= 0; --h)
|
|
103
|
+
r.push(i = d[h] = new K(d[h])), i.parent = n, i.depth = n.depth + 1;
|
|
104
|
+
return l.eachBefore(qe);
|
|
105
|
+
}
|
|
106
|
+
function Ie() {
|
|
107
|
+
return te(this).eachBefore(Ge);
|
|
108
|
+
}
|
|
109
|
+
function He(t) {
|
|
110
|
+
return t.children;
|
|
111
|
+
}
|
|
112
|
+
function Oe(t) {
|
|
113
|
+
return Array.isArray(t) ? t[1] : null;
|
|
114
|
+
}
|
|
115
|
+
function Ge(t) {
|
|
116
|
+
t.data.value !== void 0 && (t.value = t.data.value), t.data = t.data.data;
|
|
117
|
+
}
|
|
118
|
+
function qe(t) {
|
|
119
|
+
var a = 0;
|
|
120
|
+
do
|
|
121
|
+
t.height = a;
|
|
122
|
+
while ((t = t.parent) && t.height < ++a);
|
|
123
|
+
}
|
|
124
|
+
function K(t) {
|
|
125
|
+
this.data = t, this.depth = this.height = 0, this.parent = null;
|
|
126
|
+
}
|
|
127
|
+
K.prototype = te.prototype = {
|
|
128
|
+
constructor: K,
|
|
129
|
+
count: Ae,
|
|
130
|
+
each: Fe,
|
|
131
|
+
eachAfter: Me,
|
|
132
|
+
eachBefore: Ne,
|
|
133
|
+
find: Ve,
|
|
134
|
+
sum: _e,
|
|
135
|
+
sort: ke,
|
|
136
|
+
path: ze,
|
|
137
|
+
ancestors: Pe,
|
|
138
|
+
descendants: Be,
|
|
139
|
+
leaves: Re,
|
|
140
|
+
links: Ee,
|
|
141
|
+
copy: Ie,
|
|
142
|
+
[Symbol.iterator]: We
|
|
143
|
+
};
|
|
144
|
+
function Xe(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 Ye(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 je(t, a, l, n, r) {
|
|
160
|
+
for (var i = t.children, d, h = -1, m = i.length, c = t.value && (n - a) / t.value; ++h < m; )
|
|
161
|
+
d = i[h], d.y0 = l, d.y1 = r, d.x0 = a, d.x1 = a += d.value * c;
|
|
162
|
+
}
|
|
163
|
+
function Ke(t, a, l, n, r) {
|
|
164
|
+
for (var i = t.children, d, h = -1, m = i.length, c = t.value && (r - l) / t.value; ++h < m; )
|
|
165
|
+
d = i[h], d.x0 = a, d.x1 = n, d.y0 = l, d.y1 = l += d.value * c;
|
|
166
|
+
}
|
|
167
|
+
var Ue = (1 + Math.sqrt(5)) / 2;
|
|
168
|
+
function Ze(t, a, l, n, r, i) {
|
|
169
|
+
for (var d = [], h = a.children, m, c, u = 0, b = 0, s = h.length, x, S, v = a.value, p, g, M, N, z, E, V; u < s; ) {
|
|
170
|
+
x = r - l, S = i - n;
|
|
171
|
+
do
|
|
172
|
+
p = h[b++].value;
|
|
173
|
+
while (!p && b < s);
|
|
174
|
+
for (g = M = p, E = Math.max(S / x, x / S) / (v * t), V = p * p * E, z = Math.max(M / V, V / g); b < s; ++b) {
|
|
175
|
+
if (p += c = h[b].value, c < g && (g = c), c > M && (M = c), V = p * p * E, N = Math.max(M / V, V / g), N > z) {
|
|
176
|
+
p -= c;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
z = N;
|
|
180
|
+
}
|
|
181
|
+
d.push(m = { value: p, dice: x < S, children: h.slice(u, b) }), m.dice ? je(m, l, n, r, v ? n += S * p / v : i) : Ke(m, l, n, v ? l += x * p / v : r, i), v -= p, u = b;
|
|
182
|
+
}
|
|
183
|
+
return d;
|
|
184
|
+
}
|
|
185
|
+
const Je = (function t(a) {
|
|
186
|
+
function l(n, r, i, d, h) {
|
|
187
|
+
Ze(a, n, r, i, d, h);
|
|
188
|
+
}
|
|
189
|
+
return l.ratio = function(n) {
|
|
190
|
+
return t((n = +n) > 1 ? n : 1);
|
|
191
|
+
}, l;
|
|
192
|
+
})(Ue);
|
|
193
|
+
function Qe() {
|
|
194
|
+
var t = Je, a = !1, l = 1, n = 1, r = [0], i = G, d = G, h = G, m = G, c = G;
|
|
195
|
+
function u(s) {
|
|
196
|
+
return s.x0 = s.y0 = 0, s.x1 = l, s.y1 = n, s.eachBefore(b), r = [0], a && s.eachBefore(Ye), s;
|
|
197
|
+
}
|
|
198
|
+
function b(s) {
|
|
199
|
+
var x = r[s.depth], S = s.x0 + x, v = s.y0 + x, p = s.x1 - x, g = s.y1 - x;
|
|
200
|
+
p < S && (S = p = (S + p) / 2), g < v && (v = g = (v + g) / 2), s.x0 = S, s.y0 = v, s.x1 = p, s.y1 = g, s.children && (x = r[s.depth + 1] = i(s) / 2, S += c(s) - x, v += d(s) - x, p -= h(s) - x, g -= m(s) - x, p < S && (S = p = (S + p) / 2), g < v && (v = g = (v + g) / 2), t(s, S, v, p, g));
|
|
201
|
+
}
|
|
202
|
+
return u.round = function(s) {
|
|
203
|
+
return arguments.length ? (a = !!s, u) : a;
|
|
204
|
+
}, u.size = function(s) {
|
|
205
|
+
return arguments.length ? (l = +s[0], n = +s[1], u) : [l, n];
|
|
206
|
+
}, u.tile = function(s) {
|
|
207
|
+
return arguments.length ? (t = Xe(s), u) : t;
|
|
208
|
+
}, u.padding = function(s) {
|
|
209
|
+
return arguments.length ? u.paddingInner(s).paddingOuter(s) : u.paddingInner();
|
|
210
|
+
}, u.paddingInner = function(s) {
|
|
211
|
+
return arguments.length ? (i = typeof s == "function" ? s : q(+s), u) : i;
|
|
212
|
+
}, u.paddingOuter = function(s) {
|
|
213
|
+
return arguments.length ? u.paddingTop(s).paddingRight(s).paddingBottom(s).paddingLeft(s) : u.paddingTop();
|
|
214
|
+
}, u.paddingTop = function(s) {
|
|
215
|
+
return arguments.length ? (d = typeof s == "function" ? s : q(+s), u) : d;
|
|
216
|
+
}, u.paddingRight = function(s) {
|
|
217
|
+
return arguments.length ? (h = typeof s == "function" ? s : q(+s), u) : h;
|
|
218
|
+
}, u.paddingBottom = function(s) {
|
|
219
|
+
return arguments.length ? (m = typeof s == "function" ? s : q(+s), u) : m;
|
|
220
|
+
}, u.paddingLeft = function(s) {
|
|
221
|
+
return arguments.length ? (c = typeof s == "function" ? s : q(+s), u) : c;
|
|
222
|
+
}, u;
|
|
223
|
+
}
|
|
224
|
+
var R, ne = (R = class {
|
|
225
|
+
constructor() {
|
|
226
|
+
this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = fe, this.getAccTitle = me, this.setDiagramTitle = ge, this.getDiagramTitle = ye, this.getAccDescription = Se, this.setAccDescription = ve;
|
|
227
|
+
}
|
|
228
|
+
getNodes() {
|
|
229
|
+
return this.nodes;
|
|
230
|
+
}
|
|
231
|
+
getConfig() {
|
|
232
|
+
const a = xe, l = ee();
|
|
233
|
+
return J({
|
|
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: [] }, r = l.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
|
|
246
|
+
r && r.forEach((i) => {
|
|
247
|
+
be(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
|
+
we(), 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 le(t) {
|
|
261
|
+
if (!t.length)
|
|
262
|
+
return [];
|
|
263
|
+
const a = [], l = [];
|
|
264
|
+
return t.forEach((n) => {
|
|
265
|
+
const r = {
|
|
266
|
+
name: n.name,
|
|
267
|
+
children: n.type === "Leaf" ? void 0 : []
|
|
268
|
+
};
|
|
269
|
+
for (r.classSelector = n?.classSelector, n?.cssCompiledStyles && (r.cssCompiledStyles = n.cssCompiledStyles), n.type === "Leaf" && n.value !== void 0 && (r.value = n.value); l.length > 0 && l[l.length - 1].level >= n.level; )
|
|
270
|
+
l.pop();
|
|
271
|
+
if (l.length === 0)
|
|
272
|
+
a.push(r);
|
|
273
|
+
else {
|
|
274
|
+
const i = l[l.length - 1].node;
|
|
275
|
+
i.children ? i.children.push(r) : i.children = [r];
|
|
276
|
+
}
|
|
277
|
+
n.type !== "Leaf" && l.push({ node: r, level: n.level });
|
|
278
|
+
}), a;
|
|
279
|
+
}
|
|
280
|
+
w(le, "buildHierarchy");
|
|
281
|
+
var et = /* @__PURE__ */ w((t, a) => {
|
|
282
|
+
Te(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 d = i.item;
|
|
288
|
+
if (!d)
|
|
289
|
+
continue;
|
|
290
|
+
const h = i.indent ? parseInt(i.indent) : 0, m = tt(d), c = d.classSelector ? a.getStylesForClass(d.classSelector) : [], u = c.length > 0 ? c : void 0, b = {
|
|
291
|
+
level: h,
|
|
292
|
+
name: m,
|
|
293
|
+
type: d.$type,
|
|
294
|
+
value: d.value,
|
|
295
|
+
classSelector: d.classSelector,
|
|
296
|
+
cssCompiledStyles: u
|
|
297
|
+
};
|
|
298
|
+
l.push(b);
|
|
299
|
+
}
|
|
300
|
+
const n = le(l), r = /* @__PURE__ */ w((i, d) => {
|
|
301
|
+
for (const h of i)
|
|
302
|
+
a.addNode(h, d), h.children && h.children.length > 0 && r(h.children, d + 1);
|
|
303
|
+
}, "addNodesRecursively");
|
|
304
|
+
r(n, 0);
|
|
305
|
+
}, "populate"), tt = /* @__PURE__ */ w((t) => t.name ? String(t.name) : "", "getItemName"), re = {
|
|
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 Le("treemap", t);
|
|
311
|
+
Q.debug("Treemap AST:", l);
|
|
312
|
+
const n = re.parser?.yy;
|
|
313
|
+
if (!(n instanceof ne))
|
|
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
|
+
et(l, n);
|
|
318
|
+
} catch (a) {
|
|
319
|
+
throw Q.error("Error parsing treemap:", a), a;
|
|
320
|
+
}
|
|
321
|
+
}, "parse")
|
|
322
|
+
}, at = 10, B = 10, X = 25, nt = /* @__PURE__ */ w((t, a, l, n) => {
|
|
323
|
+
const r = n.db, i = r.getConfig(), d = i.padding ?? at, h = r.getDiagramTitle(), m = r.getRoot(), { themeVariables: c } = ee();
|
|
324
|
+
if (!m)
|
|
325
|
+
return;
|
|
326
|
+
const u = h ? 30 : 0, b = ue(a), s = i.nodeWidth ? i.nodeWidth * B : 960, x = i.nodeHeight ? i.nodeHeight * B : 500, S = s, v = x + u;
|
|
327
|
+
b.attr("viewBox", `0 0 ${S} ${v}`), pe(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
|
+
Q.error("Error creating format function:", e), p = O(",");
|
|
343
|
+
}
|
|
344
|
+
const g = Z().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
|
+
]), M = Z().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
|
+
]), N = Z().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
|
+
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);
|
|
387
|
+
const z = b.append("g").attr("transform", `translate(0, ${u})`).attr("class", "treemapContainer"), E = te(m).sum((e) => e.value ?? 0).sort((e, o) => (o.value ?? 0) - (e.value ?? 0)), ae = Qe().size([s, x]).paddingTop(
|
|
388
|
+
(e) => e.children && e.children.length > 0 ? X + B : 0
|
|
389
|
+
).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)(E), se = ae.descendants().filter((e) => e.children && e.children.length > 0), W = z.selectAll(".treemapSection").data(se).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
|
|
390
|
+
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, o) => `clip-section-${a}-${o}`).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, o) => `treemapSection section${o}`).attr("fill", (e) => g(e.data.name)).attr("fill-opacity", 0.6).attr("stroke", (e) => M(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 = P({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
394
|
+
return o.nodeStyles + ";" + o.borderStyles.join(";");
|
|
395
|
+
}), 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) => {
|
|
396
|
+
if (e.depth === 0)
|
|
397
|
+
return "display: none;";
|
|
398
|
+
const o = "dominant-baseline: middle; font-size: 12px; fill:" + N(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = P({ 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 = j(this), f = e.data.name;
|
|
404
|
+
o.text(f);
|
|
405
|
+
const C = e.x1 - e.x0, L = 6;
|
|
406
|
+
let $;
|
|
407
|
+
i.showValues !== !1 && e.value ? $ = C - 10 - 30 - 10 - L : $ = C - L - 6;
|
|
408
|
+
const A = Math.max(15, $), y = o.node();
|
|
409
|
+
if (y.getComputedTextLength() > A) {
|
|
410
|
+
let T = f;
|
|
411
|
+
for (; T.length > 0; ) {
|
|
412
|
+
if (T = f.substring(0, T.length - 1), T.length === 0) {
|
|
413
|
+
o.text("..."), y.getComputedTextLength() > A && o.text("");
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
if (o.text(T + "..."), y.getComputedTextLength() <= A)
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}), i.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) => {
|
|
421
|
+
if (e.depth === 0)
|
|
422
|
+
return "display: none;";
|
|
423
|
+
const o = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + N(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
424
|
+
return o + f.labelStyles.replace("color:", "fill:");
|
|
425
|
+
});
|
|
426
|
+
const ie = ae.leaves(), Y = z.selectAll(".treemapLeafGroup").data(ie).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
|
+
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 ? g(e.parent.data.name) : g(e.data.name)).attr("style", (e) => P({ cssCompiledStyles: e.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", 0.3).attr("stroke", (e) => e.parent ? g(e.parent.data.name) : g(e.data.name)).attr("stroke-width", 3), Y.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)), 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) => {
|
|
428
|
+
const o = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + N(e.data.name) + ";", f = P({ 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 = j(this), f = e.x1 - e.x0, C = e.y1 - e.y0, L = o.node(), $ = 4, D = f - 2 * $, A = C - 2 * $;
|
|
432
|
+
if (D < 10 || A < 10) {
|
|
433
|
+
o.style("display", "none");
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
let y = parseInt(o.style("font-size"), 10);
|
|
437
|
+
const _ = 8, F = 28, T = 0.6, k = 6, I = 2;
|
|
438
|
+
for (; L.getComputedTextLength() > D && y > _; )
|
|
439
|
+
y--, o.style("font-size", `${y}px`);
|
|
440
|
+
let H = Math.max(
|
|
441
|
+
k,
|
|
442
|
+
Math.min(F, Math.round(y * T))
|
|
443
|
+
), U = y + I + H;
|
|
444
|
+
for (; U > A && y > _ && (y--, H = Math.max(
|
|
445
|
+
k,
|
|
446
|
+
Math.min(F, Math.round(y * T))
|
|
447
|
+
), !(H < k && y === _)); )
|
|
448
|
+
o.style("font-size", `${y}px`), U = y + I + H;
|
|
449
|
+
o.style("font-size", `${y}px`), (L.getComputedTextLength() > D || y < _ || A < y) && o.style("display", "none");
|
|
450
|
+
}), i.showValues !== !1 && Y.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: 28px;fill:" + N(o.data.name) + ";", C = P({ 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 = j(this), C = this.parentNode;
|
|
457
|
+
if (!C) {
|
|
458
|
+
f.style("display", "none");
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
const L = j(C).select(".treemapLabel");
|
|
462
|
+
if (L.empty() || L.style("display") === "none") {
|
|
463
|
+
f.style("display", "none");
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
const $ = parseFloat(L.style("font-size")), D = 28, A = 0.6, y = 6, _ = 2, F = Math.max(
|
|
467
|
+
y,
|
|
468
|
+
Math.min(D, Math.round($ * A))
|
|
469
|
+
);
|
|
470
|
+
f.style("font-size", `${F}px`);
|
|
471
|
+
const k = (o.y1 - o.y0) / 2 + $ / 2 + _;
|
|
472
|
+
f.attr("y", k);
|
|
473
|
+
const I = o.x1 - o.x0, ce = o.y1 - o.y0 - 4, de = I - 8;
|
|
474
|
+
f.node().getComputedTextLength() > de || k + F > ce || F < y ? f.style("display", "none") : f.style("display", null);
|
|
475
|
+
});
|
|
476
|
+
const oe = i.diagramPadding ?? 8;
|
|
477
|
+
Ce(b, oe, "flowchart", i?.useMaxWidth || !1);
|
|
478
|
+
}, "draw"), lt = /* @__PURE__ */ w(function(t, a) {
|
|
479
|
+
return a.db.getClasses();
|
|
480
|
+
}, "getClasses"), rt = { draw: nt, getClasses: lt }, st = {
|
|
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
|
+
}, it = /* @__PURE__ */ w(({
|
|
491
|
+
treemap: t
|
|
492
|
+
} = {}) => {
|
|
493
|
+
const a = he(), l = ee(), n = J(a, l.themeVariables), r = J(st, t), i = r.titleColor ?? n.titleColor, d = r.labelColor ?? n.textColor, h = r.valueColor ?? n.textColor;
|
|
494
|
+
return `
|
|
495
|
+
.treemapNode.section {
|
|
496
|
+
stroke: ${r.sectionStrokeColor};
|
|
497
|
+
stroke-width: ${r.sectionStrokeWidth};
|
|
498
|
+
fill: ${r.sectionFillColor};
|
|
499
|
+
}
|
|
500
|
+
.treemapNode.leaf {
|
|
501
|
+
stroke: ${r.leafStrokeColor};
|
|
502
|
+
stroke-width: ${r.leafStrokeWidth};
|
|
503
|
+
fill: ${r.leafFillColor};
|
|
504
|
+
}
|
|
505
|
+
.treemapLabel {
|
|
506
|
+
fill: ${d};
|
|
507
|
+
font-size: ${r.labelFontSize};
|
|
508
|
+
}
|
|
509
|
+
.treemapValue {
|
|
510
|
+
fill: ${h};
|
|
511
|
+
font-size: ${r.valueFontSize};
|
|
512
|
+
}
|
|
513
|
+
.treemapTitle {
|
|
514
|
+
fill: ${i};
|
|
515
|
+
font-size: ${r.titleFontSize};
|
|
516
|
+
}
|
|
517
|
+
`;
|
|
518
|
+
}, "getStyles"), ot = it, gt = {
|
|
519
|
+
parser: re,
|
|
520
|
+
get db() {
|
|
521
|
+
return new ne();
|
|
522
|
+
},
|
|
523
|
+
renderer: rt,
|
|
524
|
+
styles: ot
|
|
525
|
+
};
|
|
526
|
+
export {
|
|
527
|
+
gt as diagram
|
|
528
|
+
};
|