@zombie-mermaid/svg-renderer 2.2.6 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -8
- package/dist/index.cjs +29 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +1238 -701
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/render-mermaid-svg.test.ts +64 -0
- package/src/index.ts +222 -5
- package/src/layout-engine/from-elk.ts +80 -5
- package/src/registry.ts +351 -0
- package/src/layout.ts +0 -8
package/dist/index.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import e from "elkjs/lib/elk.bundled.js";
|
|
2
|
-
import {
|
|
3
|
-
import { CHART_ACCENT_FALLBACK as
|
|
2
|
+
import { DEFAULTS as t, applyClickStatement as n, buildStyleBlock as r, detectDiagramType as i, escapeAttr as a, escapeXml as o, extractInitConfig as s, formatCssColor as c, getReadableTextColor as l, isMonospaceFont as u, measureMultilineText as d, measureTextWidth as f, mixSrgb as p, normalizeBrTags as m, parseCssColor as h, parseStyleProps as g, renderMultilineText as _, renderMultilineTextWithBackground as v, resolveNodeStyle as y, safeHref as b, sanitizeClassName as x, setMonospaceMetrics as S, splitStatements as C, splitStatementsByLine as w, styleOpenTag as T, svgOpenTag as E, themeStyleDeclarations as D, toDirection as O, tryApplyClassAssignment as k, tryApplyClassDef as A, tryApplyStyleStatement as j, withDirectionOverride as ee } from "@zombie-mermaid/core";
|
|
3
|
+
import { CHART_ACCENT_FALLBACK as te, formatClassMember as ne, getSeriesColor as re, matchExpandedBlock as ie, parseClassDiagram as ae, parseErDiagram as oe, parseExpandedMeta as se, parseSequenceDiagram as ce, parseXYChart as le, resolveShapeName as ue } from "@zombie-mermaid/mermaid-parser";
|
|
4
|
+
import { decodeXML as de } from "entities";
|
|
4
5
|
//#region packages/svg-renderer/src/edge-curves.ts
|
|
5
|
-
function
|
|
6
|
+
function fe(e) {
|
|
6
7
|
return `M ${e.x} ${e.y}`;
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
9
|
+
function pe(e) {
|
|
10
|
+
return fe(e[0]) + e.slice(1).map((e) => ` L ${e.x} ${e.y}`).join("");
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
if (e.length < 3) return
|
|
13
|
-
let t = e[e.length - 1], n = [
|
|
12
|
+
function me(e) {
|
|
13
|
+
if (e.length < 3) return pe(e);
|
|
14
|
+
let t = e[e.length - 1], n = [fe(e[0])], r = (e, t, n) => ` C ${(2 * e.x + t.x) / 3} ${(2 * e.y + t.y) / 3}, ${(e.x + 2 * t.x) / 3} ${(e.y + 2 * t.y) / 3}, ${(e.x + 4 * t.x + n.x) / 6} ${(e.y + 4 * t.y + n.y) / 6}`;
|
|
14
15
|
n.push(` L ${(5 * e[0].x + e[1].x) / 6} ${(5 * e[0].y + e[1].y) / 6}`);
|
|
15
16
|
for (let t = 2; t < e.length; t++) n.push(r(e[t - 2], e[t - 1], e[t]));
|
|
16
17
|
return n.push(r(e[e.length - 2], t, t)), n.push(` L ${t.x} ${t.y}`), n.join("");
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
-
if (e.length < 3) return
|
|
20
|
-
let t = [
|
|
19
|
+
function he(e) {
|
|
20
|
+
if (e.length < 3) return pe(e);
|
|
21
|
+
let t = [fe(e[0])];
|
|
21
22
|
for (let n = 1; n < e.length - 1; n++) {
|
|
22
23
|
let r = e[n - 1], i = e[n], a = e[n + 1], o = Math.hypot(i.x - r.x, i.y - r.y), s = Math.hypot(a.x - i.x, a.y - i.y);
|
|
23
24
|
if (o === 0 || s === 0) {
|
|
@@ -30,8 +31,8 @@ function C(e) {
|
|
|
30
31
|
let n = e[e.length - 1];
|
|
31
32
|
return t.push(` L ${n.x} ${n.y}`), t.join("");
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
let n = [
|
|
34
|
+
function ge(e, t) {
|
|
35
|
+
let n = [fe(e[0])], r = e.length - 1;
|
|
35
36
|
for (let i = 0; i < r; i++) {
|
|
36
37
|
let a = e[i], o = e[i + 1];
|
|
37
38
|
if (i === r - 1) {
|
|
@@ -47,51 +48,51 @@ function w(e, t) {
|
|
|
47
48
|
}
|
|
48
49
|
return n.join("");
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function _e(e, t = "linear") {
|
|
51
52
|
if (e.length === 0) return "";
|
|
52
|
-
if (e.length === 1) return
|
|
53
|
+
if (e.length === 1) return fe(e[0]);
|
|
53
54
|
switch (t) {
|
|
54
|
-
case "basis": return
|
|
55
|
-
case "natural": return
|
|
56
|
-
case "step": return
|
|
57
|
-
case "stepBefore": return
|
|
58
|
-
case "stepAfter": return
|
|
59
|
-
default: return
|
|
55
|
+
case "basis": return me(e);
|
|
56
|
+
case "natural": return he(e);
|
|
57
|
+
case "step": return ge(e, "mid");
|
|
58
|
+
case "stepBefore": return ge(e, "before");
|
|
59
|
+
case "stepAfter": return ge(e, "after");
|
|
60
|
+
default: return pe(e);
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
//#endregion
|
|
63
64
|
//#region packages/svg-renderer/src/elk-instance.ts
|
|
64
|
-
var
|
|
65
|
-
function
|
|
65
|
+
var ve = null, ye = null, be = 20;
|
|
66
|
+
function xe(e = be) {
|
|
66
67
|
if (!Number.isInteger(e) || e < 1) throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);
|
|
67
68
|
return {
|
|
68
69
|
map: /* @__PURE__ */ new Map(),
|
|
69
70
|
maxSize: e
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
-
if (Array.isArray(e)) return `[${e.map(
|
|
73
|
+
function Se(e) {
|
|
74
|
+
if (Array.isArray(e)) return `[${e.map(Se).join(",")}]`;
|
|
74
75
|
if (typeof e == "object" && e) {
|
|
75
76
|
let t = e;
|
|
76
|
-
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${
|
|
77
|
+
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${Se(t[e])}`).join(",")}}`;
|
|
77
78
|
}
|
|
78
79
|
return JSON.stringify(e);
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
-
if (
|
|
81
|
+
function Ce() {
|
|
82
|
+
if (ve && ye) return ye;
|
|
82
83
|
let t = [], n = globalThis.setTimeout;
|
|
83
84
|
globalThis.setTimeout = (e, r) => r === 0 ? (t.push(e), 0) : n(e, r);
|
|
84
85
|
let r = globalThis, i = "self" in r, a = r.self;
|
|
85
|
-
if (i && r.document === void 0 && delete r.self,
|
|
86
|
-
return i && (r.self = a), globalThis.setTimeout = n, t.forEach((e) => e()),
|
|
86
|
+
if (i && r.document === void 0 && delete r.self, ve = new e(), !ve) throw Error("ELKBundled construction unexpectedly produced no instance");
|
|
87
|
+
return i && (r.self = a), globalThis.setTimeout = n, t.forEach((e) => e()), ye = ve.worker.worker, ye;
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
-
let n = t, r = n ?
|
|
89
|
+
function we(e, t) {
|
|
90
|
+
let n = t, r = n ? Se(e) : void 0;
|
|
90
91
|
if (n && r !== void 0) {
|
|
91
92
|
let e = n.map.get(r);
|
|
92
93
|
if (e) return n.map.delete(r), n.map.set(r, e), e;
|
|
93
94
|
}
|
|
94
|
-
let i =
|
|
95
|
+
let i = Ce(), a, o, s = i.onmessage;
|
|
95
96
|
if (i.onmessage = (e) => {
|
|
96
97
|
e.data.error ? o = e.data.error : a = e.data.data;
|
|
97
98
|
}, i.dispatcher.saveDispatch({ data: {
|
|
@@ -108,54 +109,54 @@ function M(e, t) {
|
|
|
108
109
|
}
|
|
109
110
|
//#endregion
|
|
110
111
|
//#region packages/svg-renderer/src/styles.ts
|
|
111
|
-
function
|
|
112
|
-
return
|
|
112
|
+
function M(e, t, n) {
|
|
113
|
+
return f(e, t, n);
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
+
function Te(e, t) {
|
|
115
116
|
return e.length * t * .6;
|
|
116
117
|
}
|
|
117
|
-
var
|
|
118
|
+
var Ee = "'JetBrains Mono'", De = `${Ee}, 'SF Mono', 'Fira Code', ui-monospace, monospace`, N = {
|
|
118
119
|
nodeLabel: 13,
|
|
119
120
|
edgeLabel: 11,
|
|
120
121
|
groupHeader: 12
|
|
121
122
|
};
|
|
122
|
-
function
|
|
123
|
+
function P(e) {
|
|
123
124
|
return {
|
|
124
|
-
nodeLabel: e?.nodeLabel ??
|
|
125
|
-
edgeLabel: e?.edgeLabel ??
|
|
126
|
-
groupHeader: e?.groupHeader ??
|
|
125
|
+
nodeLabel: e?.nodeLabel ?? N.nodeLabel,
|
|
126
|
+
edgeLabel: e?.edgeLabel ?? N.edgeLabel,
|
|
127
|
+
groupHeader: e?.groupHeader ?? N.groupHeader
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
|
-
var
|
|
130
|
+
var F = {
|
|
130
131
|
nodeLabel: 500,
|
|
131
132
|
edgeLabel: 400,
|
|
132
133
|
groupHeader: 600
|
|
133
|
-
},
|
|
134
|
+
}, Oe = 12, I = {
|
|
134
135
|
horizontal: 20,
|
|
135
136
|
vertical: 10,
|
|
136
137
|
diamondExtra: 24
|
|
137
|
-
},
|
|
138
|
+
}, L = {
|
|
138
139
|
outerBox: 1,
|
|
139
140
|
innerBox: .75,
|
|
140
141
|
connector: 1
|
|
141
|
-
},
|
|
142
|
+
}, R = "0.35em", z = {
|
|
142
143
|
width: 8,
|
|
143
144
|
height: 5
|
|
144
|
-
},
|
|
145
|
+
}, ke = {
|
|
145
146
|
font: "Inter",
|
|
146
147
|
padding: 40,
|
|
147
148
|
nodeSpacing: 28,
|
|
148
149
|
layerSpacing: 48,
|
|
149
150
|
mergeEdges: !0,
|
|
150
151
|
thoroughness: 3,
|
|
151
|
-
fontSizes:
|
|
152
|
-
},
|
|
152
|
+
fontSizes: N
|
|
153
|
+
}, Ae = {
|
|
153
154
|
flowchart: "DOWN",
|
|
154
155
|
state: "DOWN",
|
|
155
156
|
class: "DOWN",
|
|
156
157
|
er: "RIGHT"
|
|
157
158
|
};
|
|
158
|
-
function
|
|
159
|
+
function je(e, t) {
|
|
159
160
|
switch (e) {
|
|
160
161
|
case "LR": return "RIGHT";
|
|
161
162
|
case "RL": return "LEFT";
|
|
@@ -165,7 +166,7 @@ function ae(e, t) {
|
|
|
165
166
|
default: return t;
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
function Me(e) {
|
|
169
170
|
let t = typeof e == "number" ? {
|
|
170
171
|
top: e,
|
|
171
172
|
left: e,
|
|
@@ -174,17 +175,17 @@ function oe(e) {
|
|
|
174
175
|
} : e;
|
|
175
176
|
return `[top=${t.top},left=${t.left},bottom=${t.bottom},right=${t.right}]`;
|
|
176
177
|
}
|
|
177
|
-
function
|
|
178
|
+
function Ne(e) {
|
|
178
179
|
return {
|
|
179
180
|
"elk.algorithm": "layered",
|
|
180
181
|
"elk.direction": e.direction,
|
|
181
182
|
"elk.spacing.nodeNode": String(e.nodeSpacing),
|
|
182
183
|
"elk.layered.spacing.nodeNodeBetweenLayers": String(e.layerSpacing),
|
|
183
|
-
"elk.padding":
|
|
184
|
+
"elk.padding": Me(e.padding),
|
|
184
185
|
"elk.edgeRouting": "ORTHOGONAL"
|
|
185
186
|
};
|
|
186
187
|
}
|
|
187
|
-
function
|
|
188
|
+
function B(e, t, n) {
|
|
188
189
|
let r = {
|
|
189
190
|
id: e,
|
|
190
191
|
width: t.width,
|
|
@@ -192,34 +193,34 @@ function H(e, t, n) {
|
|
|
192
193
|
};
|
|
193
194
|
return n !== void 0 && (r.labels = [{ text: n }]), r;
|
|
194
195
|
}
|
|
195
|
-
var
|
|
196
|
+
var Pe = {
|
|
196
197
|
"elk.edgeLabels.inline": "true",
|
|
197
198
|
"elk.edgeLabels.placement": "CENTER"
|
|
198
199
|
};
|
|
199
|
-
function
|
|
200
|
-
let n =
|
|
200
|
+
function Fe(e, t) {
|
|
201
|
+
let n = d(e, t.fontSize, F.edgeLabel), r = {
|
|
201
202
|
text: e,
|
|
202
203
|
width: n.width + 8,
|
|
203
204
|
height: n.height + 6
|
|
204
205
|
};
|
|
205
206
|
return t.layoutOptions && (r.layoutOptions = { ...t.layoutOptions }), r;
|
|
206
207
|
}
|
|
207
|
-
function
|
|
208
|
+
function V(e) {
|
|
208
209
|
let t = {
|
|
209
210
|
id: e.id,
|
|
210
211
|
sources: [e.source],
|
|
211
212
|
targets: [e.target]
|
|
212
213
|
};
|
|
213
|
-
return e.label && (t.labels = [
|
|
214
|
+
return e.label && (t.labels = [Fe(e.label, e.labelStyle)]), t;
|
|
214
215
|
}
|
|
215
216
|
//#endregion
|
|
216
217
|
//#region packages/svg-renderer/src/layout-engine/to-elk.ts
|
|
217
|
-
function
|
|
218
|
-
return
|
|
218
|
+
function Ie(e) {
|
|
219
|
+
return je(e, Ae.flowchart);
|
|
219
220
|
}
|
|
220
|
-
function
|
|
221
|
+
function Le(e) {
|
|
221
222
|
return {
|
|
222
|
-
...
|
|
223
|
+
...Ne(e),
|
|
223
224
|
"elk.spacing.edgeEdge": "12",
|
|
224
225
|
"elk.layered.spacing.edgeEdgeBetweenLayers": "12",
|
|
225
226
|
"elk.layered.spacing.edgeNodeBetweenLayers": "12",
|
|
@@ -227,46 +228,46 @@ function de(e) {
|
|
|
227
228
|
"elk.contentAlignment": "H_CENTER V_CENTER"
|
|
228
229
|
};
|
|
229
230
|
}
|
|
230
|
-
function
|
|
231
|
+
function Re(e) {
|
|
231
232
|
return {
|
|
232
233
|
fontSize: e.fontSizes.edgeLabel,
|
|
233
|
-
layoutOptions:
|
|
234
|
+
layoutOptions: Pe
|
|
234
235
|
};
|
|
235
236
|
}
|
|
236
|
-
function
|
|
237
|
-
let i =
|
|
237
|
+
function ze(e, t, n, r) {
|
|
238
|
+
let i = d(t, r, F.nodeLabel), a = i.width + I.horizontal * 2, o = i.height + I.vertical * 2;
|
|
238
239
|
if (n === "diamond") {
|
|
239
|
-
let e = Math.max(a,
|
|
240
|
-
a = e,
|
|
240
|
+
let e = Math.max(a, o) + I.diamondExtra;
|
|
241
|
+
a = e, o = e;
|
|
241
242
|
}
|
|
242
243
|
if (n === "circle" || n === "doublecircle") {
|
|
243
|
-
let e = Math.ceil(Math.sqrt(a * a +
|
|
244
|
-
a = n === "doublecircle" ? e + 12 : e,
|
|
244
|
+
let e = Math.ceil(Math.sqrt(a * a + o * o)) + 8;
|
|
245
|
+
a = n === "doublecircle" ? e + 12 : e, o = a;
|
|
245
246
|
}
|
|
246
|
-
return n === "hexagon" && (a +=
|
|
247
|
+
return n === "hexagon" && (a += I.horizontal), (n === "trapezoid" || n === "trapezoid-alt" || n === "parallelogram" || n === "parallelogram-alt") && (a += I.horizontal), n === "asymmetric" && (a += 12), n === "cylinder" && (o += 14), n === "state-start" || n === "state-end" ? {
|
|
247
248
|
width: 28,
|
|
248
249
|
height: 28
|
|
249
|
-
} : (a = Math.max(a, 60),
|
|
250
|
+
} : (a = Math.max(a, 60), o = Math.max(o, 36), {
|
|
250
251
|
width: a,
|
|
251
|
-
height:
|
|
252
|
+
height: o
|
|
252
253
|
});
|
|
253
254
|
}
|
|
254
|
-
var
|
|
255
|
-
function
|
|
256
|
-
for (let t of e) if (t.direction !== void 0 ||
|
|
255
|
+
var Be = " root";
|
|
256
|
+
function Ve(e) {
|
|
257
|
+
for (let t of e) if (t.direction !== void 0 || Ve(t.children)) return !0;
|
|
257
258
|
return !1;
|
|
258
259
|
}
|
|
259
|
-
function
|
|
260
|
+
function He(e, t) {
|
|
260
261
|
for (let n of e.nodeIds) t.add(n);
|
|
261
|
-
for (let n of e.children)
|
|
262
|
+
for (let n of e.children) He(n, t);
|
|
262
263
|
}
|
|
263
|
-
function
|
|
264
|
+
function Ue(e, t) {
|
|
264
265
|
let n = /* @__PURE__ */ new Set();
|
|
265
|
-
if (
|
|
266
|
+
if (He(e, n), n.size === 0) return !0;
|
|
266
267
|
let r = (t) => n.has(t) || t === e.id;
|
|
267
268
|
return !t.edges.some((e) => r(e.source) !== r(e.target));
|
|
268
269
|
}
|
|
269
|
-
function
|
|
270
|
+
function We(e) {
|
|
270
271
|
let t = /* @__PURE__ */ new Map();
|
|
271
272
|
function n(e, r) {
|
|
272
273
|
let i = [...r, e.id];
|
|
@@ -276,15 +277,15 @@ function ve(e) {
|
|
|
276
277
|
for (let t of e) n(t, []);
|
|
277
278
|
return t;
|
|
278
279
|
}
|
|
279
|
-
function
|
|
280
|
+
function Ge(e, t) {
|
|
280
281
|
let n = 0;
|
|
281
282
|
for (; n < e.length && n < t.length && e[n] === t[n];) n++;
|
|
282
283
|
return n;
|
|
283
284
|
}
|
|
284
|
-
function
|
|
285
|
+
function Ke(e, t) {
|
|
285
286
|
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
286
|
-
for (let t of e.subgraphs) r.add(t.id),
|
|
287
|
-
let i =
|
|
287
|
+
for (let t of e.subgraphs) r.add(t.id), Je(t, n, r);
|
|
288
|
+
let i = Ye(e.subgraphs), a = We(e.subgraphs), o = (e) => e ? a.get(e) ?? [] : [], s = /* @__PURE__ */ new Map();
|
|
288
289
|
s.set(null, []);
|
|
289
290
|
let c = [];
|
|
290
291
|
for (let t = 0; t < e.edges.length; t++) {
|
|
@@ -305,14 +306,14 @@ function be(e, t) {
|
|
|
305
306
|
tgtChain: o(a)
|
|
306
307
|
});
|
|
307
308
|
}
|
|
308
|
-
let l =
|
|
309
|
-
...
|
|
310
|
-
direction:
|
|
309
|
+
let l = Ve(e.subgraphs), u = [], d = [], f = {
|
|
310
|
+
...Le({
|
|
311
|
+
direction: Ie(e.direction),
|
|
311
312
|
nodeSpacing: t.nodeSpacing,
|
|
312
313
|
layerSpacing: t.layerSpacing,
|
|
313
314
|
padding: t.padding
|
|
314
315
|
}),
|
|
315
|
-
"elk.layered.thoroughness": String(
|
|
316
|
+
"elk.layered.thoroughness": String(ke.thoroughness),
|
|
316
317
|
"elk.layered.highDegreeNodes.treatment": "true",
|
|
317
318
|
"elk.layered.highDegreeNodes.threshold": "8",
|
|
318
319
|
"elk.layered.compaction.postCompaction.strategy": "LEFT_RIGHT_CONSTRAINT_LOCKING",
|
|
@@ -329,7 +330,7 @@ function be(e, t) {
|
|
|
329
330
|
m.set(e, n), n.push(t);
|
|
330
331
|
}
|
|
331
332
|
if (l) for (let { index: e, edge: n, srcChain: r, tgtChain: i } of c) {
|
|
332
|
-
let a =
|
|
333
|
+
let a = Ge(r, i), o = n.source;
|
|
333
334
|
if (r.length > a) {
|
|
334
335
|
for (let t = r.length - 1; t >= a; t--) {
|
|
335
336
|
let i = r[t], a = `${i}_out_${e}`;
|
|
@@ -357,33 +358,33 @@ function be(e, t) {
|
|
|
357
358
|
}
|
|
358
359
|
s = `${i[a]}_in_${e}`;
|
|
359
360
|
}
|
|
360
|
-
g(a > 0 ? r[a - 1] :
|
|
361
|
+
g(a > 0 ? r[a - 1] : Be, V({
|
|
361
362
|
id: `e${e}`,
|
|
362
363
|
source: o,
|
|
363
364
|
target: s,
|
|
364
365
|
label: n.label,
|
|
365
|
-
labelStyle:
|
|
366
|
+
labelStyle: Re(t)
|
|
366
367
|
}));
|
|
367
368
|
}
|
|
368
369
|
for (let [i, a] of e.nodes) if (!n.has(i) && !r.has(i)) {
|
|
369
|
-
let e =
|
|
370
|
-
u.push(
|
|
370
|
+
let e = ze(i, a.label, a.shape, t.fontSizes.nodeLabel);
|
|
371
|
+
u.push(B(i, e, a.label));
|
|
371
372
|
}
|
|
372
|
-
for (let n of [...e.subgraphs].reverse()) u.push(
|
|
373
|
-
for (let { index: e, edge: n } of s.get(null)) n.source !== n.target && d.push(
|
|
373
|
+
for (let n of [...e.subgraphs].reverse()) u.push(qe(n, e, t, s, p, m, e.direction));
|
|
374
|
+
for (let { index: e, edge: n } of s.get(null)) n.source !== n.target && d.push(V({
|
|
374
375
|
id: `e${e}`,
|
|
375
376
|
source: n.source,
|
|
376
377
|
target: n.target,
|
|
377
378
|
label: n.label,
|
|
378
|
-
labelStyle:
|
|
379
|
+
labelStyle: Re(t)
|
|
379
380
|
}));
|
|
380
|
-
if (l) for (let e of m.get(
|
|
381
|
-
else for (let { index: e, edge: n } of c) d.push(
|
|
381
|
+
if (l) for (let e of m.get(Be) ?? []) d.push(e);
|
|
382
|
+
else for (let { index: e, edge: n } of c) d.push(V({
|
|
382
383
|
id: `e${e}`,
|
|
383
384
|
source: n.source,
|
|
384
385
|
target: n.target,
|
|
385
386
|
label: n.label,
|
|
386
|
-
labelStyle:
|
|
387
|
+
labelStyle: Re(t)
|
|
387
388
|
}));
|
|
388
389
|
return {
|
|
389
390
|
id: "root",
|
|
@@ -392,9 +393,9 @@ function be(e, t) {
|
|
|
392
393
|
edges: d
|
|
393
394
|
};
|
|
394
395
|
}
|
|
395
|
-
function
|
|
396
|
-
let s = e.direction !== void 0 &&
|
|
397
|
-
direction:
|
|
396
|
+
function qe(e, t, n, r, i, a, o) {
|
|
397
|
+
let s = e.direction !== void 0 && Ue(e, t) ? e.direction : o, c = Le({
|
|
398
|
+
direction: Ie(s),
|
|
398
399
|
nodeSpacing: n.nodeSpacing,
|
|
399
400
|
layerSpacing: n.layerSpacing,
|
|
400
401
|
padding: {
|
|
@@ -409,18 +410,18 @@ function xe(e, t, n, r, i, a, o) {
|
|
|
409
410
|
for (let r of e.nodeIds) {
|
|
410
411
|
let e = t.nodes.get(r);
|
|
411
412
|
if (e) {
|
|
412
|
-
let t =
|
|
413
|
-
d.push(
|
|
413
|
+
let t = ze(r, e.label, e.shape, n.fontSizes.nodeLabel);
|
|
414
|
+
d.push(B(r, t, e.label));
|
|
414
415
|
}
|
|
415
416
|
}
|
|
416
|
-
for (let o of [...e.children].reverse()) d.push(
|
|
417
|
+
for (let o of [...e.children].reverse()) d.push(qe(o, t, n, r, i, a, s));
|
|
417
418
|
let f = [], p = r.get(e.id) ?? [];
|
|
418
|
-
for (let { index: e, edge: t } of p) t.source !== t.target && f.push(
|
|
419
|
+
for (let { index: e, edge: t } of p) t.source !== t.target && f.push(V({
|
|
419
420
|
id: `e${e}`,
|
|
420
421
|
source: t.source,
|
|
421
422
|
target: t.target,
|
|
422
423
|
label: t.label,
|
|
423
|
-
labelStyle:
|
|
424
|
+
labelStyle: Re(n)
|
|
424
425
|
}));
|
|
425
426
|
for (let t of a.get(e.id) ?? []) f.push(t);
|
|
426
427
|
return {
|
|
@@ -432,11 +433,11 @@ function xe(e, t, n, r, i, a, o) {
|
|
|
432
433
|
edges: f
|
|
433
434
|
};
|
|
434
435
|
}
|
|
435
|
-
function
|
|
436
|
+
function Je(e, t, n) {
|
|
436
437
|
for (let n of e.nodeIds) t.add(n);
|
|
437
|
-
for (let r of e.children) n.add(r.id),
|
|
438
|
+
for (let r of e.children) n.add(r.id), Je(r, t, n);
|
|
438
439
|
}
|
|
439
|
-
function
|
|
440
|
+
function Ye(e) {
|
|
440
441
|
let t = /* @__PURE__ */ new Map();
|
|
441
442
|
function n(e) {
|
|
442
443
|
for (let n of e.nodeIds) t.set(n, e.id);
|
|
@@ -447,19 +448,19 @@ function Ce(e) {
|
|
|
447
448
|
}
|
|
448
449
|
//#endregion
|
|
449
450
|
//#region packages/svg-renderer/src/shape-clipping.ts
|
|
450
|
-
function
|
|
451
|
+
function Xe(e, t, n) {
|
|
451
452
|
if (e.length < 2 || t.shape === "rectangle" || t.shape === "rounded" || t.shape === "stadium") return e;
|
|
452
453
|
let r = [...e];
|
|
453
454
|
if (t.shape === "diamond") {
|
|
454
|
-
if (n) r[0] =
|
|
455
|
+
if (n) r[0] = Ze(e[0], e[1], t);
|
|
455
456
|
else {
|
|
456
457
|
let n = e.length - 1;
|
|
457
|
-
r[n] =
|
|
458
|
+
r[n] = Ze(e[n], e[n - 1], t);
|
|
458
459
|
}
|
|
459
460
|
}
|
|
460
461
|
return r;
|
|
461
462
|
}
|
|
462
|
-
function
|
|
463
|
+
function Ze(e, t, n) {
|
|
463
464
|
let r = n.x + n.width / 2, i = n.y + n.height / 2, a = {
|
|
464
465
|
x: r,
|
|
465
466
|
y: n.y
|
|
@@ -475,14 +476,14 @@ function Te(e, t, n) {
|
|
|
475
476
|
}, l = e.x - t.x, u = e.y - t.y;
|
|
476
477
|
if (Math.abs(l) < Math.abs(u)) {
|
|
477
478
|
let t = e.x;
|
|
478
|
-
return u > 0 ? t <= r ?
|
|
479
|
+
return u > 0 ? t <= r ? $e(t, c, a) ?? a : $e(t, a, o) ?? a : t <= r ? $e(t, s, c) ?? s : $e(t, o, s) ?? s;
|
|
479
480
|
}
|
|
480
481
|
{
|
|
481
482
|
let t = e.y;
|
|
482
|
-
return l > 0 ? t <= i ?
|
|
483
|
+
return l > 0 ? t <= i ? Qe(t, a, c) ?? c : Qe(t, c, s) ?? c : t <= i ? Qe(t, a, o) ?? o : Qe(t, o, s) ?? o;
|
|
483
484
|
}
|
|
484
485
|
}
|
|
485
|
-
function
|
|
486
|
+
function Qe(e, t, n) {
|
|
486
487
|
let r = n.y - t.y;
|
|
487
488
|
if (Math.abs(r) < .001) return null;
|
|
488
489
|
let i = (e - t.y) / r;
|
|
@@ -491,7 +492,7 @@ function Ee(e, t, n) {
|
|
|
491
492
|
y: e
|
|
492
493
|
};
|
|
493
494
|
}
|
|
494
|
-
function
|
|
495
|
+
function $e(e, t, n) {
|
|
495
496
|
let r = n.x - t.x;
|
|
496
497
|
if (Math.abs(r) < .001) return null;
|
|
497
498
|
let i = (e - t.x) / r;
|
|
@@ -502,11 +503,11 @@ function De(e, t, n) {
|
|
|
502
503
|
}
|
|
503
504
|
//#endregion
|
|
504
505
|
//#region packages/svg-renderer/src/layout-engine/layer-alignment.ts
|
|
505
|
-
function
|
|
506
|
+
function et(e, t, n) {
|
|
506
507
|
if (e.length === 0) return;
|
|
507
508
|
let r = n === "LR" || n === "RL", i = /* @__PURE__ */ new Set();
|
|
508
509
|
for (let e of t) i.add(`${e.source}:${e.target}`), i.add(`${e.target}:${e.source}`);
|
|
509
|
-
let a =
|
|
510
|
+
let a = ke.layerSpacing * .6, o = [...e].sort((e, t) => r ? e.x - t.x : e.y - t.y), s = [], c = [o[0]];
|
|
510
511
|
for (let e = 1; e < o.length; e++) {
|
|
511
512
|
let t = (r ? o[e].x : o[e].y) - (r ? o[e - 1].x : o[e - 1].y), n = c.some((t) => i.has(`${t.id}:${o[e].id}`));
|
|
512
513
|
t <= a && !n ? c.push(o[e]) : (s.push(c), c = [o[e]]);
|
|
@@ -546,28 +547,28 @@ function Oe(e, t, n) {
|
|
|
546
547
|
}
|
|
547
548
|
//#endregion
|
|
548
549
|
//#region packages/svg-renderer/src/layout-engine/edge-bundling.ts
|
|
549
|
-
var
|
|
550
|
-
function
|
|
550
|
+
var tt = .5;
|
|
551
|
+
function nt(e, t, n) {
|
|
551
552
|
for (let r = 0; r < e.length - 1; r++) {
|
|
552
553
|
let i = e[r], a = e[r + 1], o = Math.min(i.x, a.x), s = Math.max(i.x, a.x), c = Math.min(i.y, a.y), l = Math.max(i.y, a.y);
|
|
553
554
|
for (let e of t) {
|
|
554
555
|
if (n.has(e.id)) continue;
|
|
555
|
-
let t = e.x +
|
|
556
|
+
let t = e.x + tt, r = e.x + e.width - tt, i = e.y + tt, a = e.y + e.height - tt;
|
|
556
557
|
if (!(t >= r || i >= a) && o < r && s > t && c < a && l > i) return !1;
|
|
557
558
|
}
|
|
558
559
|
}
|
|
559
560
|
return !0;
|
|
560
561
|
}
|
|
561
|
-
function
|
|
562
|
+
function rt(e, t, n) {
|
|
562
563
|
let r = [];
|
|
563
|
-
for (let i of n) e >= i.x && e <= i.x + i.width && t >= i.y && t <= i.y + i.height && (r.push(i), r.push(...
|
|
564
|
+
for (let i of n) e >= i.x && e <= i.x + i.width && t >= i.y && t <= i.y + i.height && (r.push(i), r.push(...rt(e, t, i.children)));
|
|
564
565
|
return r;
|
|
565
566
|
}
|
|
566
|
-
function
|
|
567
|
-
let a = i === "LR", o = i === "RL", s = i === "BT", c = a || o, l = new Set(
|
|
567
|
+
function it(e, t, n, r, i) {
|
|
568
|
+
let a = i === "LR", o = i === "RL", s = i === "BT", c = a || o, l = new Set(rt(t, n, r).map((e) => e.id)), u = rt(c ? e : t, c ? n : e, r).find((e) => !l.has(e.id));
|
|
568
569
|
return u ? a ? u.x - 12 : o ? u.x + u.width + 12 : s ? u.y + u.height + 12 : u.y - 12 : e;
|
|
569
570
|
}
|
|
570
|
-
function
|
|
571
|
+
function at(e, t, n, r) {
|
|
571
572
|
let i = new Map(t.map((e) => [e.id, e])), a = /* @__PURE__ */ new Set(), o = r === "LR", s = r === "RL", c = r === "BT", l = o || s, u = /* @__PURE__ */ new Map();
|
|
572
573
|
for (let t of e) {
|
|
573
574
|
if (t.source === t.target) continue;
|
|
@@ -592,7 +593,7 @@ function Ne(e, t, n, r) {
|
|
|
592
593
|
let m = f.x + f.width / 2, h = f.y + f.height / 2;
|
|
593
594
|
if (l) {
|
|
594
595
|
let i = o ? f.x + f.width : f.x, s = h, c = i + ((o ? Math.min(...p.map((e) => e.node.x)) : Math.max(...p.map((e) => e.node.x + e.node.width))) - i) / 2;
|
|
595
|
-
c =
|
|
596
|
+
c = it(c, m, h, n, r);
|
|
596
597
|
let l = [];
|
|
597
598
|
for (let { edge: n, node: r } of p) {
|
|
598
599
|
let a = o ? r.x : r.x + r.width, u = r.y + r.height / 2, d = [
|
|
@@ -613,7 +614,7 @@ function Ne(e, t, n, r) {
|
|
|
613
614
|
y: u
|
|
614
615
|
}
|
|
615
616
|
];
|
|
616
|
-
|
|
617
|
+
nt(d, t, /* @__PURE__ */ new Set([e, r.id])) && l.push({
|
|
617
618
|
edge: n,
|
|
618
619
|
points: d
|
|
619
620
|
});
|
|
@@ -622,7 +623,7 @@ function Ne(e, t, n, r) {
|
|
|
622
623
|
for (let { edge: e, points: t } of l) e.points = t, a.add(e);
|
|
623
624
|
} else {
|
|
624
625
|
let i = m, o = c ? f.y : f.y + f.height, s = o + ((c ? Math.max(...p.map((e) => e.node.y + e.node.height)) : Math.min(...p.map((e) => e.node.y))) - o) / 2;
|
|
625
|
-
s =
|
|
626
|
+
s = it(s, m, h, n, r);
|
|
626
627
|
let l = [];
|
|
627
628
|
for (let { edge: n, node: r } of p) {
|
|
628
629
|
let a = r.x + r.width / 2, u = c ? r.y + r.height : r.y, d = [
|
|
@@ -643,7 +644,7 @@ function Ne(e, t, n, r) {
|
|
|
643
644
|
y: u
|
|
644
645
|
}
|
|
645
646
|
];
|
|
646
|
-
|
|
647
|
+
nt(d, t, /* @__PURE__ */ new Set([e, r.id])) && l.push({
|
|
647
648
|
edge: n,
|
|
648
649
|
points: d
|
|
649
650
|
});
|
|
@@ -676,7 +677,7 @@ function Ne(e, t, n, r) {
|
|
|
676
677
|
let p = d.x + d.width / 2, m = d.y + d.height / 2;
|
|
677
678
|
if (l) {
|
|
678
679
|
let i = o ? d.x : d.x + d.width, a = m, s = o ? Math.max(...f.map((e) => e.node.x + e.node.width)) : Math.min(...f.map((e) => e.node.x)), c = s + (i - s) / 2;
|
|
679
|
-
c =
|
|
680
|
+
c = it(c, p, m, n, r);
|
|
680
681
|
let l = [];
|
|
681
682
|
for (let { edge: n, node: r } of f) {
|
|
682
683
|
let s = o ? r.x + r.width : r.x, u = r.y + r.height / 2, d = [
|
|
@@ -697,7 +698,7 @@ function Ne(e, t, n, r) {
|
|
|
697
698
|
y: a
|
|
698
699
|
}
|
|
699
700
|
];
|
|
700
|
-
|
|
701
|
+
nt(d, t, /* @__PURE__ */ new Set([r.id, e])) && l.push({
|
|
701
702
|
edge: n,
|
|
702
703
|
points: d
|
|
703
704
|
});
|
|
@@ -706,7 +707,7 @@ function Ne(e, t, n, r) {
|
|
|
706
707
|
for (let { edge: e, points: t } of l) e.points = t;
|
|
707
708
|
} else {
|
|
708
709
|
let i = p, a = c ? d.y + d.height : d.y, o = c ? Math.min(...f.map((e) => e.node.y)) : Math.max(...f.map((e) => e.node.y + e.node.height)), s = o + (a - o) / 2;
|
|
709
|
-
s =
|
|
710
|
+
s = it(s, p, m, n, r);
|
|
710
711
|
let l = [];
|
|
711
712
|
for (let { edge: n, node: r } of f) {
|
|
712
713
|
let o = r.x + r.width / 2, u = [
|
|
@@ -727,7 +728,7 @@ function Ne(e, t, n, r) {
|
|
|
727
728
|
y: a
|
|
728
729
|
}
|
|
729
730
|
];
|
|
730
|
-
|
|
731
|
+
nt(u, t, /* @__PURE__ */ new Set([r.id, e])) && l.push({
|
|
731
732
|
edge: n,
|
|
732
733
|
points: u
|
|
733
734
|
});
|
|
@@ -739,7 +740,7 @@ function Ne(e, t, n, r) {
|
|
|
739
740
|
}
|
|
740
741
|
//#endregion
|
|
741
742
|
//#region packages/svg-renderer/src/layout-engine/elk-adapter-utils.ts
|
|
742
|
-
function
|
|
743
|
+
function ot(e, t = 0, n = 0) {
|
|
743
744
|
let r = [];
|
|
744
745
|
if (!e.sections || e.sections.length === 0) return r;
|
|
745
746
|
let i = e.sections[0];
|
|
@@ -755,7 +756,7 @@ function Pe(e, t = 0, n = 0) {
|
|
|
755
756
|
y: i.endPoint.y + n
|
|
756
757
|
}), r;
|
|
757
758
|
}
|
|
758
|
-
function
|
|
759
|
+
function st(e, t = 0, n = 0) {
|
|
759
760
|
if (!e.labels || e.labels.length === 0) return;
|
|
760
761
|
let r = e.labels[0];
|
|
761
762
|
if (r.x != null && r.y != null) return {
|
|
@@ -765,11 +766,11 @@ function Fe(e, t = 0, n = 0) {
|
|
|
765
766
|
}
|
|
766
767
|
//#endregion
|
|
767
768
|
//#region packages/svg-renderer/src/layout-engine/from-elk.ts
|
|
768
|
-
var
|
|
769
|
-
function
|
|
770
|
-
let n = e.x + e.width, r = e.y + e.height / 2, i = Math.min(
|
|
771
|
-
for (let e = 0; e <=
|
|
772
|
-
let t = Math.PI * e /
|
|
769
|
+
var ct = 16, lt = 28, ut = 18, dt = 28, ft = 10;
|
|
770
|
+
function pt(e, t) {
|
|
771
|
+
let n = e.x + e.width, r = e.y + e.height / 2, i = Math.min(dt, e.height * .6) / 2, a = lt + t * ut, o = [];
|
|
772
|
+
for (let e = 0; e <= ct; e++) {
|
|
773
|
+
let t = Math.PI * e / ct;
|
|
773
774
|
o.push({
|
|
774
775
|
x: n + a * Math.sin(t),
|
|
775
776
|
y: r - i * Math.cos(t)
|
|
@@ -778,12 +779,12 @@ function Ve(e, t) {
|
|
|
778
779
|
return {
|
|
779
780
|
points: o,
|
|
780
781
|
labelPosition: {
|
|
781
|
-
x: n + a +
|
|
782
|
+
x: n + a + ft,
|
|
782
783
|
y: r
|
|
783
784
|
}
|
|
784
785
|
};
|
|
785
786
|
}
|
|
786
|
-
function
|
|
787
|
+
function mt(e, t, n) {
|
|
787
788
|
let r = /* @__PURE__ */ new Map();
|
|
788
789
|
for (let i = 0; i < e.edges.length; i++) {
|
|
789
790
|
let a = e.edges[i];
|
|
@@ -792,7 +793,7 @@ function He(e, t, n) {
|
|
|
792
793
|
if (!o) continue;
|
|
793
794
|
let s = r.get(o.id) ?? 0;
|
|
794
795
|
r.set(o.id, s + 1);
|
|
795
|
-
let { points: c, labelPosition: l } =
|
|
796
|
+
let { points: c, labelPosition: l } = pt(o, s);
|
|
796
797
|
n.push({
|
|
797
798
|
source: a.source,
|
|
798
799
|
target: a.target,
|
|
@@ -802,38 +803,38 @@ function He(e, t, n) {
|
|
|
802
803
|
hasArrowEnd: a.hasArrowEnd,
|
|
803
804
|
points: c,
|
|
804
805
|
labelPosition: a.label ? l : void 0,
|
|
805
|
-
inlineStyle:
|
|
806
|
+
inlineStyle: Et(i, e),
|
|
806
807
|
id: a.id,
|
|
807
808
|
animate: a.animate
|
|
808
809
|
});
|
|
809
810
|
}
|
|
810
811
|
}
|
|
811
|
-
function
|
|
812
|
+
function ht(e) {
|
|
812
813
|
let t = [];
|
|
813
814
|
for (let n of e) t.push({
|
|
814
815
|
x: n.x,
|
|
815
816
|
y: n.y,
|
|
816
817
|
right: n.x + n.width,
|
|
817
818
|
bottom: n.y + n.height
|
|
818
|
-
}), t.push(...
|
|
819
|
+
}), t.push(...ht(n.children));
|
|
819
820
|
return t;
|
|
820
821
|
}
|
|
821
|
-
function
|
|
822
|
+
function gt(e, t, n = !1) {
|
|
822
823
|
let r = [], i = [], a = [], o = /* @__PURE__ */ new Set();
|
|
823
|
-
for (let e of t.subgraphs)
|
|
824
|
-
|
|
825
|
-
let s =
|
|
826
|
-
|
|
824
|
+
for (let e of t.subgraphs) Tt(e, o);
|
|
825
|
+
_t(e, t, o, r, a, 0, 0);
|
|
826
|
+
let s = ht(a);
|
|
827
|
+
bt(e, t, i, 0, 0, s.length > 0 ? {
|
|
827
828
|
leftX: Math.min(...s.map((e) => e.x)) - 20,
|
|
828
829
|
rightX: Math.max(...s.map((e) => e.right)) + 20
|
|
829
|
-
} : void 0),
|
|
830
|
+
} : void 0), et(r, i, t.direction);
|
|
830
831
|
let c = new Map(r.map((e) => [e.id, e]));
|
|
831
|
-
|
|
832
|
+
mt(t, c, i), n && at(i, r, a, t.direction);
|
|
832
833
|
for (let e of i) {
|
|
833
834
|
let t = c.get(e.source), n = c.get(e.target);
|
|
834
|
-
t && (e.points =
|
|
835
|
+
t && (e.points = Xe(e.points, t, !0)), n && (e.points = Xe(e.points, n, !1));
|
|
835
836
|
}
|
|
836
|
-
let l = e.width ?? 800, u = e.height ?? 600, d =
|
|
837
|
+
let l = e.width ?? 800, u = e.height ?? 600, d = z.width, f = ke.padding;
|
|
837
838
|
for (let e of i) {
|
|
838
839
|
for (let t of e.points) l = Math.max(l, t.x + d + f), u = Math.max(u, t.y + d + f);
|
|
839
840
|
e.labelPosition && (l = Math.max(l, e.labelPosition.x + 60 + f), u = Math.max(u, e.labelPosition.y + 20 + f));
|
|
@@ -846,13 +847,13 @@ function We(e, t, n = !1) {
|
|
|
846
847
|
groups: a
|
|
847
848
|
};
|
|
848
849
|
}
|
|
849
|
-
function
|
|
850
|
+
function _t(e, t, n, r, i, a, o) {
|
|
850
851
|
if (e.children) for (let s of e.children) {
|
|
851
852
|
let e = (s.x ?? 0) + a, c = (s.y ?? 0) + o, l = s.width ?? 0, u = s.height ?? 0;
|
|
852
853
|
if (n.has(s.id)) {
|
|
853
854
|
let a = [];
|
|
854
|
-
|
|
855
|
-
let o =
|
|
855
|
+
_t(s, t, n, r, a, e, c);
|
|
856
|
+
let o = wt(t.subgraphs, s.id);
|
|
856
857
|
i.push({
|
|
857
858
|
id: s.id,
|
|
858
859
|
label: o?.label ?? "",
|
|
@@ -865,7 +866,7 @@ function Ge(e, t, n, r, i, a, o) {
|
|
|
865
866
|
} else {
|
|
866
867
|
let a = t.nodes.get(s.id);
|
|
867
868
|
if (a) {
|
|
868
|
-
let n =
|
|
869
|
+
let n = y(s.id, t), i = t.classAssignments.get(s.id);
|
|
869
870
|
r.push({
|
|
870
871
|
id: s.id,
|
|
871
872
|
label: a.label,
|
|
@@ -879,11 +880,11 @@ function Ge(e, t, n, r, i, a, o) {
|
|
|
879
880
|
interaction: t.interactions.get(s.id)
|
|
880
881
|
});
|
|
881
882
|
}
|
|
882
|
-
s.children && s.children.length > 0 &&
|
|
883
|
+
s.children && s.children.length > 0 && _t(s, t, n, r, i, e, c);
|
|
883
884
|
}
|
|
884
885
|
}
|
|
885
886
|
}
|
|
886
|
-
function
|
|
887
|
+
function vt(e) {
|
|
887
888
|
let t = /^e(\d+)$/.exec(e);
|
|
888
889
|
if (t) return {
|
|
889
890
|
edgeIndex: parseInt(t[1], 10),
|
|
@@ -896,7 +897,7 @@ function Ke(e) {
|
|
|
896
897
|
level: parseInt(n[3], 10)
|
|
897
898
|
};
|
|
898
899
|
}
|
|
899
|
-
function
|
|
900
|
+
function yt(e) {
|
|
900
901
|
if (e.length === 0) return {
|
|
901
902
|
x: 0,
|
|
902
903
|
y: 0
|
|
@@ -921,24 +922,26 @@ function qe(e) {
|
|
|
921
922
|
}
|
|
922
923
|
return e[e.length - 1];
|
|
923
924
|
}
|
|
924
|
-
function
|
|
925
|
+
function bt(e, t, n, r, i, a) {
|
|
925
926
|
let o = /* @__PURE__ */ new Map();
|
|
926
|
-
|
|
927
|
-
let s =
|
|
928
|
-
|
|
927
|
+
xt(e, o, 0, 0);
|
|
928
|
+
let s = /* @__PURE__ */ new Map();
|
|
929
|
+
Ct(e, s, 0, 0, o);
|
|
930
|
+
let c = 0;
|
|
931
|
+
for (let [e, r] of s) {
|
|
929
932
|
let i = t.edges[e];
|
|
930
933
|
if (!i) continue;
|
|
931
|
-
let o = [],
|
|
934
|
+
let o = [], s = (e) => {
|
|
932
935
|
!e || e.points.length === 0 || (o.length > 0 ? o.push(...e.points.slice(1)) : o.push(...e.points));
|
|
933
936
|
}, l = [...r.sourceHops.keys()].sort((e, t) => t - e);
|
|
934
|
-
for (let e of l)
|
|
935
|
-
|
|
937
|
+
for (let e of l) s(r.sourceHops.get(e));
|
|
938
|
+
s(r.bridge);
|
|
936
939
|
let u = [...r.targetHops.keys()].sort((e, t) => e - t);
|
|
937
|
-
for (let e of u)
|
|
940
|
+
for (let e of u) s(r.targetHops.get(e));
|
|
938
941
|
let d;
|
|
939
|
-
i.label && o.length >= 2 && (d = r.bridge?.labelPosition ??
|
|
940
|
-
let f =
|
|
941
|
-
f !== o &&
|
|
942
|
+
i.label && o.length >= 2 && (d = r.bridge?.labelPosition ?? yt(o));
|
|
943
|
+
let f = St(o, a, c);
|
|
944
|
+
f !== o && c++, i.label && f !== o && f.length >= 2 && (d = yt(f)), n.push({
|
|
942
945
|
source: i.source,
|
|
943
946
|
target: i.target,
|
|
944
947
|
label: i.label,
|
|
@@ -947,13 +950,24 @@ function Je(e, t, n, r, i, a) {
|
|
|
947
950
|
hasArrowEnd: i.hasArrowEnd,
|
|
948
951
|
points: f,
|
|
949
952
|
labelPosition: d,
|
|
950
|
-
inlineStyle:
|
|
953
|
+
inlineStyle: Et(e, t),
|
|
951
954
|
id: i.id,
|
|
952
955
|
animate: i.animate
|
|
953
956
|
});
|
|
954
957
|
}
|
|
955
958
|
}
|
|
956
|
-
function
|
|
959
|
+
function xt(e, t, n, r) {
|
|
960
|
+
t.set(e.id, {
|
|
961
|
+
x: n,
|
|
962
|
+
y: r
|
|
963
|
+
});
|
|
964
|
+
for (let i of e.children ?? []) {
|
|
965
|
+
/* v8 ignore next */
|
|
966
|
+
let e = i.x ?? 0, a = i.y ?? 0;
|
|
967
|
+
xt(i, t, n + e, r + a);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
function St(e, t, n = 0) {
|
|
957
971
|
if (e.length < 2) return e;
|
|
958
972
|
let r = !1;
|
|
959
973
|
for (let t = 1; t < e.length; t++) {
|
|
@@ -992,36 +1006,36 @@ function Ye(e, t, n = 0) {
|
|
|
992
1006
|
}
|
|
993
1007
|
return i;
|
|
994
1008
|
}
|
|
995
|
-
function
|
|
996
|
-
if (e.edges) for (let
|
|
997
|
-
let e =
|
|
1009
|
+
function Ct(e, t, n, r, i) {
|
|
1010
|
+
if (e.edges) for (let a of e.edges) {
|
|
1011
|
+
let e = vt(a.id);
|
|
998
1012
|
if (!e) continue;
|
|
999
|
-
let { edgeIndex:
|
|
1013
|
+
let { edgeIndex: o } = e, s = a.container, c = s ? i.get(s) : void 0, l = c?.x ?? n, u = c?.y ?? r, d = ot(a, l, u), f = st(a, l, u), p = t.get(o) ?? {
|
|
1000
1014
|
sourceHops: /* @__PURE__ */ new Map(),
|
|
1001
1015
|
targetHops: /* @__PURE__ */ new Map()
|
|
1002
1016
|
};
|
|
1003
|
-
t.set(
|
|
1004
|
-
let
|
|
1005
|
-
edgeIndex:
|
|
1006
|
-
points:
|
|
1007
|
-
labelPosition:
|
|
1017
|
+
t.set(o, p);
|
|
1018
|
+
let m = {
|
|
1019
|
+
edgeIndex: o,
|
|
1020
|
+
points: d,
|
|
1021
|
+
labelPosition: f
|
|
1008
1022
|
};
|
|
1009
|
-
e.role === "bridge" ?
|
|
1023
|
+
e.role === "bridge" ? p.bridge = m : e.role === "source" ? p.sourceHops.set(e.level, m) : p.targetHops.set(e.level, m);
|
|
1010
1024
|
}
|
|
1011
|
-
if (e.children) for (let
|
|
1025
|
+
if (e.children) for (let a of e.children) Ct(a, t, n + (a.x ?? 0), r + (a.y ?? 0), i);
|
|
1012
1026
|
}
|
|
1013
|
-
function
|
|
1027
|
+
function wt(e, t) {
|
|
1014
1028
|
for (let n of e) {
|
|
1015
1029
|
if (n.id === t) return n;
|
|
1016
|
-
let e =
|
|
1030
|
+
let e = wt(n.children, t);
|
|
1017
1031
|
if (e) return e;
|
|
1018
1032
|
}
|
|
1019
1033
|
}
|
|
1020
|
-
function
|
|
1034
|
+
function Tt(e, t) {
|
|
1021
1035
|
t.add(e.id);
|
|
1022
|
-
for (let n of e.children)
|
|
1036
|
+
for (let n of e.children) Tt(n, t);
|
|
1023
1037
|
}
|
|
1024
|
-
function
|
|
1038
|
+
function Et(e, t) {
|
|
1025
1039
|
let n, r = t.linkStyles.get("default");
|
|
1026
1040
|
r && (n = { ...r });
|
|
1027
1041
|
let i = t.linkStyles.get(e);
|
|
@@ -1032,39 +1046,39 @@ function $e(e, t) {
|
|
|
1032
1046
|
}
|
|
1033
1047
|
//#endregion
|
|
1034
1048
|
//#region packages/svg-renderer/src/layout-engine.ts
|
|
1035
|
-
function
|
|
1049
|
+
function Dt(e, t = {}) {
|
|
1036
1050
|
let n = {
|
|
1037
|
-
...
|
|
1051
|
+
...ke,
|
|
1038
1052
|
...t,
|
|
1039
|
-
fontSizes:
|
|
1053
|
+
fontSizes: P(t.fontSizes)
|
|
1040
1054
|
};
|
|
1041
|
-
return
|
|
1055
|
+
return gt(we(Ke(e, n), t.layoutCache), e, n.mergeEdges);
|
|
1042
1056
|
}
|
|
1043
|
-
function
|
|
1044
|
-
return
|
|
1045
|
-
...
|
|
1057
|
+
function Ot(e, t = {}) {
|
|
1058
|
+
return Ke(e, {
|
|
1059
|
+
...ke,
|
|
1046
1060
|
...t,
|
|
1047
|
-
fontSizes:
|
|
1061
|
+
fontSizes: P(t.fontSizes)
|
|
1048
1062
|
});
|
|
1049
1063
|
}
|
|
1050
1064
|
//#endregion
|
|
1051
1065
|
//#region packages/svg-renderer/src/renderer.ts
|
|
1052
|
-
function
|
|
1053
|
-
let
|
|
1054
|
-
|
|
1055
|
-
let
|
|
1056
|
-
for (let t of e.edges) t.inlineStyle?.stroke &&
|
|
1057
|
-
for (let e of
|
|
1058
|
-
|
|
1059
|
-
for (let t of e.groups)
|
|
1060
|
-
for (let t of e.edges)
|
|
1061
|
-
for (let t of e.edges) t.label &&
|
|
1062
|
-
for (let t of e.nodes)
|
|
1063
|
-
return
|
|
1064
|
-
}
|
|
1065
|
-
function
|
|
1066
|
+
function kt(e, t, n = "Inter", i = !1, a = N, o = "linear", s, c = !0, l = !0, u, d, f = {}) {
|
|
1067
|
+
let p = [], m = l && e.nodes.some((e) => !!b(e.interaction?.href));
|
|
1068
|
+
p.push(U(E(e.width, e.height, t, i, u, d, m, f.styleAttribute), s)), p.push(r(n, !1, f.nonce)), c && e.edges.some((e) => e.animate) && p.push(At(f.nonce)), p.push("<defs>"), p.push(jt());
|
|
1069
|
+
let h = /* @__PURE__ */ new Set();
|
|
1070
|
+
for (let t of e.edges) t.inlineStyle?.stroke && h.add(t.inlineStyle.stroke);
|
|
1071
|
+
for (let e of h) p.push(Mt(e));
|
|
1072
|
+
p.push("</defs>");
|
|
1073
|
+
for (let t of e.groups) p.push(Ft(t, n, a));
|
|
1074
|
+
for (let t of e.edges) p.push(It(t, o, c));
|
|
1075
|
+
for (let t of e.edges) t.label && p.push(Rt(t, n, a));
|
|
1076
|
+
for (let t of e.nodes) p.push(Ht(t, n, a, l));
|
|
1077
|
+
return p.push("</svg>"), p.join("\n");
|
|
1078
|
+
}
|
|
1079
|
+
function At(e) {
|
|
1066
1080
|
return [
|
|
1067
|
-
|
|
1081
|
+
T(e),
|
|
1068
1082
|
" @keyframes zm-edge-dash { to { stroke-dashoffset: -28; } }",
|
|
1069
1083
|
" .edge-animated { animation: zm-edge-dash 1s linear infinite; }",
|
|
1070
1084
|
" @media (prefers-reduced-motion: reduce) {",
|
|
@@ -1073,67 +1087,67 @@ function rt(e) {
|
|
|
1073
1087
|
"</style>"
|
|
1074
1088
|
].join("\n");
|
|
1075
1089
|
}
|
|
1076
|
-
function
|
|
1077
|
-
return
|
|
1090
|
+
function jt() {
|
|
1091
|
+
return Nt("var(--_arrow)", "");
|
|
1078
1092
|
}
|
|
1079
|
-
function
|
|
1080
|
-
return
|
|
1093
|
+
function Mt(e) {
|
|
1094
|
+
return Nt(a(e), `-${Pt(e)}`);
|
|
1081
1095
|
}
|
|
1082
|
-
function
|
|
1083
|
-
let n =
|
|
1096
|
+
function Nt(e, t) {
|
|
1097
|
+
let n = z.width, r = z.height, i = n - 1, a = `fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`, o = `<polygon points="0 0, ${n} ${r / 2}, 0 ${r}" ${a} />`, s = (e, t) => ` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${i}" refY="${r / 2}" orient="${t}">\n ${o}\n </marker>`;
|
|
1084
1098
|
return s(`arrowhead${t}`, "auto") + "\n" + s(`arrowhead-start${t}`, "auto-start-reverse");
|
|
1085
1099
|
}
|
|
1086
|
-
function
|
|
1100
|
+
function Pt(e) {
|
|
1087
1101
|
return e.replace(/[^a-zA-Z0-9]/g, (e) => e.charCodeAt(0).toString(16));
|
|
1088
1102
|
}
|
|
1089
|
-
function
|
|
1090
|
-
let
|
|
1091
|
-
|
|
1092
|
-
for (let
|
|
1093
|
-
return
|
|
1103
|
+
function Ft(e, t, n) {
|
|
1104
|
+
let r = n.groupHeader + 16, i = [];
|
|
1105
|
+
i.push(`<g class="subgraph" data-id="${a(e.id)}" data-label="${a(e.label)}">`), i.push(` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), i.push(` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), i.push(" " + _(e.label, e.x + 12, e.y + r / 2, n.groupHeader, `font-size="${n.groupHeader}" font-weight="${F.groupHeader}" fill="var(--_text-sec)"`));
|
|
1106
|
+
for (let r of e.children) i.push(Ft(r, t, n));
|
|
1107
|
+
return i.push("</g>"), i.join("\n");
|
|
1094
1108
|
}
|
|
1095
|
-
function
|
|
1109
|
+
function It(e, t, n = !0) {
|
|
1096
1110
|
if (e.points.length < 2) return "";
|
|
1097
|
-
let
|
|
1111
|
+
let r = n && (e.animate ?? !1), i = t !== "linear", o = e.style === "invisible", s = e.style === "dotted" ? " stroke-dasharray=\"4 4\"" : "", c = e.style === "thick" ? L.connector * 2 : L.connector, l = o ? "none" : a(e.inlineStyle?.stroke ?? "var(--_line)"), u = a(e.inlineStyle?.["stroke-width"] ?? String(c)), d = e.inlineStyle?.stroke ? `-${Pt(e.inlineStyle.stroke)}` : "", f = "";
|
|
1098
1112
|
o || (e.hasArrowEnd && (f += ` marker-end="url(#arrowhead${d})"`), e.hasArrowStart && (f += ` marker-start="url(#arrowhead-start${d})"`));
|
|
1099
1113
|
let p = [
|
|
1100
|
-
`class="edge${
|
|
1101
|
-
`data-from="${
|
|
1102
|
-
`data-to="${
|
|
1114
|
+
`class="edge${r ? " edge-animated" : ""}"`,
|
|
1115
|
+
`data-from="${a(e.source)}"`,
|
|
1116
|
+
`data-to="${a(e.target)}"`,
|
|
1103
1117
|
`data-style="${e.style}"`,
|
|
1104
1118
|
`data-arrow-start="${e.hasArrowStart}"`,
|
|
1105
1119
|
`data-arrow-end="${e.hasArrowEnd}"`
|
|
1106
1120
|
];
|
|
1107
|
-
e.label && p.push(`data-label="${
|
|
1108
|
-
let m =
|
|
1109
|
-
return `<${
|
|
1121
|
+
e.label && p.push(`data-label="${a(e.label)}"`), e.id && p.push(`data-id="${a(e.id)}"`);
|
|
1122
|
+
let m = r && !s ? " stroke-dasharray=\"8 6\"" : "", h = i ? `d="${_e(e.points, t)}"` : `points="${Lt(e.points)}"`;
|
|
1123
|
+
return `<${i ? "path" : "polyline"} ${p.join(" ")} ${h} fill="none" stroke="${l}" stroke-width="${u}"${s}${m}${f} />`;
|
|
1110
1124
|
}
|
|
1111
|
-
function
|
|
1125
|
+
function Lt(e) {
|
|
1112
1126
|
return e.map((e) => `${e.x},${e.y}`).join(" ");
|
|
1113
1127
|
}
|
|
1114
|
-
function
|
|
1128
|
+
function Rt(e, t, n) {
|
|
1115
1129
|
if (!e.label) return "";
|
|
1116
|
-
let
|
|
1117
|
-
return `<g class="edge-label" data-from="${
|
|
1130
|
+
let r = e.label, i = e.labelPosition ?? Bt(e.points), o = d(r, n.edgeLabel, F.edgeLabel), s = v(r, i.x, i.y, o.width, o.height, n.edgeLabel, 8, `text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${F.edgeLabel}" fill="var(--_text-sec)"`, "rx=\"2\" ry=\"2\" fill=\"var(--bg)\" stroke=\"var(--_inner-stroke)\" stroke-width=\"1\"");
|
|
1131
|
+
return `<g class="edge-label" data-from="${a(e.source)}" data-to="${a(e.target)}" data-label="${a(r)}">\n ${s.replace(/\n/g, "\n ")}\n</g>`;
|
|
1118
1132
|
}
|
|
1119
|
-
function
|
|
1133
|
+
function zt(e, t) {
|
|
1120
1134
|
let n = e[t];
|
|
1121
1135
|
if (!n)
|
|
1122
1136
|
/* v8 ignore next */
|
|
1123
1137
|
throw Error(`edgeMidpoint: missing point at index ${t}`);
|
|
1124
1138
|
return n;
|
|
1125
1139
|
}
|
|
1126
|
-
function
|
|
1140
|
+
function Bt(e) {
|
|
1127
1141
|
if (e.length === 0) return {
|
|
1128
1142
|
x: 0,
|
|
1129
1143
|
y: 0
|
|
1130
1144
|
};
|
|
1131
1145
|
if (e.length === 1) return e[0];
|
|
1132
1146
|
let t = 0;
|
|
1133
|
-
for (let n = 1; n < e.length; n++) t +=
|
|
1147
|
+
for (let n = 1; n < e.length; n++) t += Vt(zt(e, n - 1), zt(e, n));
|
|
1134
1148
|
let n = t / 2;
|
|
1135
1149
|
for (let t = 1; t < e.length; t++) {
|
|
1136
|
-
let r =
|
|
1150
|
+
let r = zt(e, t - 1), i = zt(e, t), a = Vt(r, i);
|
|
1137
1151
|
if (n <= a) {
|
|
1138
1152
|
let e = n / a;
|
|
1139
1153
|
return {
|
|
@@ -1145,82 +1159,82 @@ function pt(e) {
|
|
|
1145
1159
|
}
|
|
1146
1160
|
return e[e.length - 1];
|
|
1147
1161
|
}
|
|
1148
|
-
function
|
|
1162
|
+
function Vt(e, t) {
|
|
1149
1163
|
return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
|
|
1150
1164
|
}
|
|
1151
|
-
function
|
|
1152
|
-
let
|
|
1165
|
+
function Ht(e, t, n, r = !0) {
|
|
1166
|
+
let i = Ut(e), s = wn(e, t, n), c = [], l = x(e.className), u = l ? `node ${l}` : "node", d = e.interaction, f = [
|
|
1153
1167
|
`class="${u}"`,
|
|
1154
|
-
`data-id="${
|
|
1155
|
-
`data-label="${
|
|
1168
|
+
`data-id="${a(e.id)}"`,
|
|
1169
|
+
`data-label="${a(e.label)}"`,
|
|
1156
1170
|
`data-shape="${e.shape}"`
|
|
1157
1171
|
];
|
|
1158
1172
|
c.push(`<g ${f.join(" ")}>`);
|
|
1159
|
-
let
|
|
1160
|
-
if (
|
|
1161
|
-
let e = d?.target ? ` target="${
|
|
1162
|
-
c.push(` <a href="${
|
|
1173
|
+
let p = r ? b(d?.href) : void 0, m = p ? " " : " ";
|
|
1174
|
+
if (p) {
|
|
1175
|
+
let e = d?.target ? ` target="${a(d.target)}"` : "";
|
|
1176
|
+
c.push(` <a href="${a(p)}"${e}>`);
|
|
1163
1177
|
}
|
|
1164
|
-
return
|
|
1178
|
+
return r && d?.tooltip && c.push(`${m}<title>${o(d.tooltip)}</title>`), c.push(`${m}${i.replace(/\n/g, `\n${m}`)}`), s && c.push(`${m}${s.replace(/\n/g, `\n${m}`)}`), p && c.push(" </a>"), c.push("</g>"), c.join("\n");
|
|
1165
1179
|
}
|
|
1166
|
-
function
|
|
1167
|
-
let { x: t, y:
|
|
1180
|
+
function Ut(e) {
|
|
1181
|
+
let { x: t, y: n, width: r, height: i, shape: o, inlineStyle: s } = e, c = a(s?.fill ?? "var(--_node-fill)"), l = a(s?.stroke ?? "var(--_node-stroke)"), u = a(s?.["stroke-width"] ?? String(L.innerBox));
|
|
1168
1182
|
switch (o) {
|
|
1169
|
-
case "diamond": return
|
|
1170
|
-
case "rounded": return
|
|
1171
|
-
case "stadium": return
|
|
1172
|
-
case "circle": return
|
|
1173
|
-
case "subroutine": return
|
|
1174
|
-
case "doublecircle": return
|
|
1175
|
-
case "hexagon": return
|
|
1176
|
-
case "cylinder": return
|
|
1177
|
-
case "asymmetric": return
|
|
1178
|
-
case "trapezoid": return
|
|
1179
|
-
case "trapezoid-alt": return
|
|
1180
|
-
case "parallelogram": return
|
|
1181
|
-
case "parallelogram-alt": return
|
|
1182
|
-
case "state-start": return
|
|
1183
|
-
case "state-end": return
|
|
1184
|
-
case "document": return
|
|
1185
|
-
case "stacked-document": return
|
|
1186
|
-
case "stacked-process": return
|
|
1187
|
-
case "card": return
|
|
1188
|
-
case "lined-process": return
|
|
1189
|
-
case "divided-process": return
|
|
1190
|
-
case "window-pane": return
|
|
1191
|
-
case "triangle": return
|
|
1192
|
-
case "flipped-triangle": return
|
|
1193
|
-
case "filled-circle": return
|
|
1194
|
-
case "crossed-circle": return
|
|
1195
|
-
case "fork-join": return
|
|
1196
|
-
case "notched-pentagon": return
|
|
1197
|
-
case "sloped-rectangle": return
|
|
1198
|
-
case "flag": return
|
|
1199
|
-
case "bow-tie-rectangle": return
|
|
1200
|
-
case "half-rounded-rectangle": return
|
|
1201
|
-
case "brace": return
|
|
1202
|
-
case "brace-right": return
|
|
1203
|
-
case "braces": return
|
|
1204
|
-
case "bolt": return
|
|
1183
|
+
case "diamond": return Jt(t, n, r, i, c, l, u);
|
|
1184
|
+
case "rounded": return Gt(t, n, r, i, c, l, u);
|
|
1185
|
+
case "stadium": return Kt(t, n, r, i, c, l, u);
|
|
1186
|
+
case "circle": return qt(t, n, r, i, c, l, u);
|
|
1187
|
+
case "subroutine": return Yt(t, n, r, i, c, l, u);
|
|
1188
|
+
case "doublecircle": return Xt(t, n, r, i, c, l, u);
|
|
1189
|
+
case "hexagon": return Zt(t, n, r, i, c, l, u);
|
|
1190
|
+
case "cylinder": return Qt(t, n, r, i, c, l, u);
|
|
1191
|
+
case "asymmetric": return $t(t, n, r, i, c, l, u);
|
|
1192
|
+
case "trapezoid": return en(t, n, r, i, c, l, u);
|
|
1193
|
+
case "trapezoid-alt": return tn(t, n, r, i, c, l, u);
|
|
1194
|
+
case "parallelogram": return nn(t, n, r, i, c, l, u);
|
|
1195
|
+
case "parallelogram-alt": return rn(t, n, r, i, c, l, u);
|
|
1196
|
+
case "state-start": return Sn(t, n, r, i);
|
|
1197
|
+
case "state-end": return Cn(t, n, r, i);
|
|
1198
|
+
case "document": return an(t, n, r, i, c, l, u);
|
|
1199
|
+
case "stacked-document": return on(t, n, r, i, c, l, u, !0);
|
|
1200
|
+
case "stacked-process": return on(t, n, r, i, c, l, u, !1);
|
|
1201
|
+
case "card": return sn(t, n, r, i, c, l, u);
|
|
1202
|
+
case "lined-process": return cn(t, n, r, i, c, l, u);
|
|
1203
|
+
case "divided-process": return ln(t, n, r, i, c, l, u);
|
|
1204
|
+
case "window-pane": return un(t, n, r, i, c, l, u);
|
|
1205
|
+
case "triangle": return dn(t, n, r, i, c, l, u, !1);
|
|
1206
|
+
case "flipped-triangle": return dn(t, n, r, i, c, l, u, !0);
|
|
1207
|
+
case "filled-circle": return fn(t, n, r, i, l);
|
|
1208
|
+
case "crossed-circle": return pn(t, n, r, i, c, l, u);
|
|
1209
|
+
case "fork-join": return mn(t, n, r, i, l);
|
|
1210
|
+
case "notched-pentagon": return hn(t, n, r, i, c, l, u);
|
|
1211
|
+
case "sloped-rectangle": return gn(t, n, r, i, c, l, u);
|
|
1212
|
+
case "flag": return _n(t, n, r, i, c, l, u);
|
|
1213
|
+
case "bow-tie-rectangle": return vn(t, n, r, i, c, l, u);
|
|
1214
|
+
case "half-rounded-rectangle": return yn(t, n, r, i, c, l, u);
|
|
1215
|
+
case "brace": return bn(t, n, r, i, c, l, u, "left");
|
|
1216
|
+
case "brace-right": return bn(t, n, r, i, c, l, u, "right");
|
|
1217
|
+
case "braces": return bn(t, n, r, i, c, l, u, "both");
|
|
1218
|
+
case "bolt": return xn(t, n, r, i, c, l, u);
|
|
1205
1219
|
case "text":
|
|
1206
1220
|
case "anchor": return "";
|
|
1207
|
-
default: return
|
|
1221
|
+
default: return Wt(t, n, r, i, c, l, u);
|
|
1208
1222
|
}
|
|
1209
1223
|
}
|
|
1210
|
-
function
|
|
1224
|
+
function Wt(e, t, n, r, i, a, o) {
|
|
1211
1225
|
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1212
1226
|
}
|
|
1213
|
-
function
|
|
1227
|
+
function Gt(e, t, n, r, i, a, o) {
|
|
1214
1228
|
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1215
1229
|
}
|
|
1216
|
-
function
|
|
1230
|
+
function Kt(e, t, n, r, i, a, o) {
|
|
1217
1231
|
let s = r / 2;
|
|
1218
1232
|
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1219
1233
|
}
|
|
1220
|
-
function
|
|
1234
|
+
function qt(e, t, n, r, i, a, o) {
|
|
1221
1235
|
return `<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${Math.min(n, r) / 2}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1222
1236
|
}
|
|
1223
|
-
function
|
|
1237
|
+
function Jt(e, t, n, r, i, a, o) {
|
|
1224
1238
|
let s = e + n / 2, c = t + r / 2, l = n / 2, u = r / 2;
|
|
1225
1239
|
return `<polygon points="${[
|
|
1226
1240
|
`${s},${c - u}`,
|
|
@@ -1229,14 +1243,14 @@ function xt(e, t, n, r, i, a, o) {
|
|
|
1229
1243
|
`${s - l},${c}`
|
|
1230
1244
|
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1231
1245
|
}
|
|
1232
|
-
function
|
|
1246
|
+
function Yt(e, t, n, r, i, a, o) {
|
|
1233
1247
|
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />\n<line x1="${e + 8}" y1="${t}" x2="${e + 8}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />\n<line x1="${e + n - 8}" y1="${t}" x2="${e + n - 8}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />`;
|
|
1234
1248
|
}
|
|
1235
|
-
function
|
|
1249
|
+
function Xt(e, t, n, r, i, a, o) {
|
|
1236
1250
|
let s = e + n / 2, c = t + r / 2, l = Math.min(n, r) / 2;
|
|
1237
1251
|
return `<circle cx="${s}" cy="${c}" r="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />\n<circle cx="${s}" cy="${c}" r="${l - 5}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1238
1252
|
}
|
|
1239
|
-
function
|
|
1253
|
+
function Zt(e, t, n, r, i, a, o) {
|
|
1240
1254
|
let s = r / 4;
|
|
1241
1255
|
return `<polygon points="${[
|
|
1242
1256
|
`${e + s},${t}`,
|
|
@@ -1247,11 +1261,11 @@ function wt(e, t, n, r, i, a, o) {
|
|
|
1247
1261
|
`${e},${t + r / 2}`
|
|
1248
1262
|
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1249
1263
|
}
|
|
1250
|
-
function
|
|
1264
|
+
function Qt(e, t, n, r, i, a, o) {
|
|
1251
1265
|
let s = e + n / 2, c = t + 7, l = r - 14;
|
|
1252
1266
|
return `<rect x="${e}" y="${c}" width="${n}" height="${l}" fill="${i}" stroke="none" />\n<line x1="${e}" y1="${c}" x2="${e}" y2="${c + l}" stroke="${a}" stroke-width="${o}" />\n<line x1="${e + n}" y1="${c}" x2="${e + n}" y2="${c + l}" stroke="${a}" stroke-width="${o}" />\n<ellipse cx="${s}" cy="${t + r - 7}" rx="${n / 2}" ry="7" fill="${i}" stroke="${a}" stroke-width="${o}" />\n<ellipse cx="${s}" cy="${c}" rx="${n / 2}" ry="7" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1253
1267
|
}
|
|
1254
|
-
function
|
|
1268
|
+
function $t(e, t, n, r, i, a, o) {
|
|
1255
1269
|
return `<polygon points="${[
|
|
1256
1270
|
`${e + 12},${t}`,
|
|
1257
1271
|
`${e + n},${t}`,
|
|
@@ -1260,7 +1274,7 @@ function Et(e, t, n, r, i, a, o) {
|
|
|
1260
1274
|
`${e},${t + r / 2}`
|
|
1261
1275
|
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1262
1276
|
}
|
|
1263
|
-
function
|
|
1277
|
+
function en(e, t, n, r, i, a, o) {
|
|
1264
1278
|
let s = n * .15;
|
|
1265
1279
|
return `<polygon points="${[
|
|
1266
1280
|
`${e + s},${t}`,
|
|
@@ -1269,7 +1283,7 @@ function Dt(e, t, n, r, i, a, o) {
|
|
|
1269
1283
|
`${e},${t + r}`
|
|
1270
1284
|
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1271
1285
|
}
|
|
1272
|
-
function
|
|
1286
|
+
function tn(e, t, n, r, i, a, o) {
|
|
1273
1287
|
let s = n * .15;
|
|
1274
1288
|
return `<polygon points="${[
|
|
1275
1289
|
`${e},${t}`,
|
|
@@ -1278,7 +1292,7 @@ function Ot(e, t, n, r, i, a, o) {
|
|
|
1278
1292
|
`${e + s},${t + r}`
|
|
1279
1293
|
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1280
1294
|
}
|
|
1281
|
-
function
|
|
1295
|
+
function nn(e, t, n, r, i, a, o) {
|
|
1282
1296
|
let s = n * .15;
|
|
1283
1297
|
return `<polygon points="${[
|
|
1284
1298
|
`${e + s},${t}`,
|
|
@@ -1287,7 +1301,7 @@ function kt(e, t, n, r, i, a, o) {
|
|
|
1287
1301
|
`${e},${t + r}`
|
|
1288
1302
|
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1289
1303
|
}
|
|
1290
|
-
function
|
|
1304
|
+
function rn(e, t, n, r, i, a, o) {
|
|
1291
1305
|
let s = n * .15;
|
|
1292
1306
|
return `<polygon points="${[
|
|
1293
1307
|
`${e},${t}`,
|
|
@@ -1296,19 +1310,19 @@ function At(e, t, n, r, i, a, o) {
|
|
|
1296
1310
|
`${e + s},${t + r}`
|
|
1297
1311
|
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1298
1312
|
}
|
|
1299
|
-
function
|
|
1313
|
+
function H(e, t, n) {
|
|
1300
1314
|
return `fill="${e}" stroke="${t}" stroke-width="${n}"`;
|
|
1301
1315
|
}
|
|
1302
|
-
function
|
|
1316
|
+
function an(e, t, n, r, i, a, o) {
|
|
1303
1317
|
let s = Math.min(10, r * .16), c = t + r - s;
|
|
1304
|
-
return `<path d="${`M ${e} ${t} L ${e + n} ${t} L ${e + n} ${c} C ${e + n * .75} ${c + s * 1.8} ${e + n * .25} ${c - s * .8} ${e} ${c} Z`}" ${
|
|
1318
|
+
return `<path d="${`M ${e} ${t} L ${e + n} ${t} L ${e + n} ${c} C ${e + n * .75} ${c + s * 1.8} ${e + n * .25} ${c - s * .8} ${e} ${c} Z`}" ${H(i, a, o)} />`;
|
|
1305
1319
|
}
|
|
1306
|
-
function
|
|
1320
|
+
function on(e, t, n, r, i, a, o, s) {
|
|
1307
1321
|
let c = n - 10, l = r - 10, u = [];
|
|
1308
|
-
for (let n = 2; n >= 1; n--) u.push(`<rect x="${e + 5 * n}" y="${t + 5 * (2 - n)}" width="${c}" height="${l}" ${
|
|
1309
|
-
return u.push(s ?
|
|
1322
|
+
for (let n = 2; n >= 1; n--) u.push(`<rect x="${e + 5 * n}" y="${t + 5 * (2 - n)}" width="${c}" height="${l}" ${H(i, a, o)} />`);
|
|
1323
|
+
return u.push(s ? an(e, t + 10, c, l, i, a, o) : `<rect x="${e}" y="${t + 10}" width="${c}" height="${l}" ${H(i, a, o)} />`), u.join("\n");
|
|
1310
1324
|
}
|
|
1311
|
-
function
|
|
1325
|
+
function sn(e, t, n, r, i, a, o) {
|
|
1312
1326
|
let s = Math.min(14, n * .12, r * .3);
|
|
1313
1327
|
return `<polygon points="${[
|
|
1314
1328
|
`${e + s},${t}`,
|
|
@@ -1316,21 +1330,21 @@ function Nt(e, t, n, r, i, a, o) {
|
|
|
1316
1330
|
`${e + n},${t + r}`,
|
|
1317
1331
|
`${e},${t + r}`,
|
|
1318
1332
|
`${e},${t + s}`
|
|
1319
|
-
].join(" ")}" ${
|
|
1333
|
+
].join(" ")}" ${H(i, a, o)} />`;
|
|
1320
1334
|
}
|
|
1321
|
-
function
|
|
1335
|
+
function cn(e, t, n, r, i, a, o) {
|
|
1322
1336
|
let s = Math.min(12, n * .12);
|
|
1323
|
-
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" ${
|
|
1337
|
+
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" ${H(i, a, o)} />\n<line x1="${e + s}" y1="${t}" x2="${e + s}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />`;
|
|
1324
1338
|
}
|
|
1325
|
-
function
|
|
1339
|
+
function ln(e, t, n, r, i, a, o) {
|
|
1326
1340
|
let s = t + Math.min(16, r * .3);
|
|
1327
|
-
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" ${
|
|
1341
|
+
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" ${H(i, a, o)} />\n<line x1="${e}" y1="${s}" x2="${e + n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`;
|
|
1328
1342
|
}
|
|
1329
|
-
function
|
|
1343
|
+
function un(e, t, n, r, i, a, o) {
|
|
1330
1344
|
let s = e + Math.min(16, n * .16), c = t + Math.min(14, r * .28);
|
|
1331
|
-
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" ${
|
|
1345
|
+
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" ${H(i, a, o)} />\n<line x1="${s}" y1="${t}" x2="${s}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />\n<line x1="${e}" y1="${c}" x2="${e + n}" y2="${c}" stroke="${a}" stroke-width="${o}" />`;
|
|
1332
1346
|
}
|
|
1333
|
-
function
|
|
1347
|
+
function dn(e, t, n, r, i, a, o, s) {
|
|
1334
1348
|
return `<polygon points="${(s ? [
|
|
1335
1349
|
`${e},${t}`,
|
|
1336
1350
|
`${e + n},${t}`,
|
|
@@ -1339,21 +1353,21 @@ function Lt(e, t, n, r, i, a, o, s) {
|
|
|
1339
1353
|
`${e + n / 2},${t}`,
|
|
1340
1354
|
`${e + n},${t + r}`,
|
|
1341
1355
|
`${e},${t + r}`
|
|
1342
|
-
]).join(" ")}" ${
|
|
1356
|
+
]).join(" ")}" ${H(i, a, o)} />`;
|
|
1343
1357
|
}
|
|
1344
|
-
function
|
|
1358
|
+
function fn(e, t, n, r, i) {
|
|
1345
1359
|
let a = Math.min(n, r) / 2 - 2;
|
|
1346
1360
|
return `<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${a}" fill="${i}" stroke="${i}" />`;
|
|
1347
1361
|
}
|
|
1348
|
-
function
|
|
1362
|
+
function pn(e, t, n, r, i, a, o) {
|
|
1349
1363
|
let s = e + n / 2, c = t + r / 2, l = Math.min(n, r) / 2 - 2, u = l / Math.SQRT2;
|
|
1350
|
-
return `<circle cx="${s}" cy="${c}" r="${l}" ${
|
|
1364
|
+
return `<circle cx="${s}" cy="${c}" r="${l}" ${H(i, a, o)} />\n<line x1="${s - u}" y1="${c - u}" x2="${s + u}" y2="${c + u}" stroke="${a}" stroke-width="${o}" />\n<line x1="${s + u}" y1="${c - u}" x2="${s - u}" y2="${c + u}" stroke="${a}" stroke-width="${o}" />`;
|
|
1351
1365
|
}
|
|
1352
|
-
function
|
|
1366
|
+
function mn(e, t, n, r, i) {
|
|
1353
1367
|
let a = Math.min(8, r);
|
|
1354
1368
|
return `<rect x="${e}" y="${t + (r - a) / 2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`;
|
|
1355
1369
|
}
|
|
1356
|
-
function
|
|
1370
|
+
function hn(e, t, n, r, i, a, o) {
|
|
1357
1371
|
let s = Math.min(14, n * .12, r * .3);
|
|
1358
1372
|
return `<polygon points="${[
|
|
1359
1373
|
`${e + s},${t}`,
|
|
@@ -1362,33 +1376,33 @@ function Vt(e, t, n, r, i, a, o) {
|
|
|
1362
1376
|
`${e + n},${t + r}`,
|
|
1363
1377
|
`${e},${t + r}`,
|
|
1364
1378
|
`${e},${t + s}`
|
|
1365
|
-
].join(" ")}" ${
|
|
1379
|
+
].join(" ")}" ${H(i, a, o)} />`;
|
|
1366
1380
|
}
|
|
1367
|
-
function
|
|
1381
|
+
function gn(e, t, n, r, i, a, o) {
|
|
1368
1382
|
return `<polygon points="${[
|
|
1369
1383
|
`${e},${t + Math.min(12, r * .3)}`,
|
|
1370
1384
|
`${e + n},${t}`,
|
|
1371
1385
|
`${e + n},${t + r}`,
|
|
1372
1386
|
`${e},${t + r}`
|
|
1373
|
-
].join(" ")}" ${
|
|
1387
|
+
].join(" ")}" ${H(i, a, o)} />`;
|
|
1374
1388
|
}
|
|
1375
|
-
function
|
|
1389
|
+
function _n(e, t, n, r, i, a, o) {
|
|
1376
1390
|
let s = Math.min(8, r * .14);
|
|
1377
|
-
return `<path d="${`M ${e} ${t + s} C ${e + n * .25} ${t - s} ${e + n * .75} ${t + s * 2} ${e + n} ${t + s} L ${e + n} ${t + r - s} C ${e + n * .75} ${t + r + s} ${e + n * .25} ${t + r - s * 2} ${e} ${t + r - s} Z`}" ${
|
|
1391
|
+
return `<path d="${`M ${e} ${t + s} C ${e + n * .25} ${t - s} ${e + n * .75} ${t + s * 2} ${e + n} ${t + s} L ${e + n} ${t + r - s} C ${e + n * .75} ${t + r + s} ${e + n * .25} ${t + r - s * 2} ${e} ${t + r - s} Z`}" ${H(i, a, o)} />`;
|
|
1378
1392
|
}
|
|
1379
|
-
function
|
|
1393
|
+
function vn(e, t, n, r, i, a, o) {
|
|
1380
1394
|
let s = Math.min(14, n * .12);
|
|
1381
|
-
return `<path d="${`M ${e + s} ${t} L ${e + n} ${t} Q ${e + n - s * 1.4} ${t + r / 2} ${e + n} ${t + r} L ${e + s} ${t + r} Q ${e + s * 1.4} ${t + r / 2} ${e + s} ${t} Z`}" ${
|
|
1395
|
+
return `<path d="${`M ${e + s} ${t} L ${e + n} ${t} Q ${e + n - s * 1.4} ${t + r / 2} ${e + n} ${t + r} L ${e + s} ${t + r} Q ${e + s * 1.4} ${t + r / 2} ${e + s} ${t} Z`}" ${H(i, a, o)} />`;
|
|
1382
1396
|
}
|
|
1383
|
-
function
|
|
1397
|
+
function yn(e, t, n, r, i, a, o) {
|
|
1384
1398
|
let s = r / 2, c = Math.max(0, n - s);
|
|
1385
|
-
return `<path d="${`M ${e} ${t} L ${e + c} ${t} A ${s} ${s} 0 0 1 ${e + c} ${t + r} L ${e} ${t + r} Z`}" ${
|
|
1399
|
+
return `<path d="${`M ${e} ${t} L ${e + c} ${t} A ${s} ${s} 0 0 1 ${e + c} ${t + r} L ${e} ${t + r} Z`}" ${H(i, a, o)} />`;
|
|
1386
1400
|
}
|
|
1387
|
-
function
|
|
1401
|
+
function bn(e, t, n, r, i, a, o, s) {
|
|
1388
1402
|
let c = Math.min(10, n * .12), l = [`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`], u = `M ${e + c} ${t} Q ${e} ${t} ${e} ${t + r * .25} Q ${e} ${t + r / 2} ${e - c * .4} ${t + r / 2} Q ${e} ${t + r / 2} ${e} ${t + r * .75} Q ${e} ${t + r} ${e + c} ${t + r}`, d = `M ${e + n - c} ${t} Q ${e + n} ${t} ${e + n} ${t + r * .25} Q ${e + n} ${t + r / 2} ${e + n + c * .4} ${t + r / 2} Q ${e + n} ${t + r / 2} ${e + n} ${t + r * .75} Q ${e + n} ${t + r} ${e + n - c} ${t + r}`;
|
|
1389
1403
|
return (s === "left" || s === "both") && l.push(`<path d="${u}" fill="none" stroke="${a}" stroke-width="${o}" />`), (s === "right" || s === "both") && l.push(`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`), l.join("\n");
|
|
1390
1404
|
}
|
|
1391
|
-
function
|
|
1405
|
+
function xn(e, t, n, r, i, a, o) {
|
|
1392
1406
|
return `<polygon points="${[
|
|
1393
1407
|
`${e + n * .42},${t}`,
|
|
1394
1408
|
`${e + n},${t}`,
|
|
@@ -1397,29 +1411,29 @@ function qt(e, t, n, r, i, a, o) {
|
|
|
1397
1411
|
`${e + n * .3},${t + r}`,
|
|
1398
1412
|
`${e + n * .5},${t + r * .55}`,
|
|
1399
1413
|
`${e},${t + r * .55}`
|
|
1400
|
-
].join(" ")}" ${
|
|
1414
|
+
].join(" ")}" ${H(i, a, o)} />`;
|
|
1401
1415
|
}
|
|
1402
|
-
function
|
|
1416
|
+
function Sn(e, t, n, r) {
|
|
1403
1417
|
return `<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${Math.min(n, r) / 2 - 2}" fill="var(--_text)" stroke="none" />`;
|
|
1404
1418
|
}
|
|
1405
|
-
function
|
|
1419
|
+
function Cn(e, t, n, r) {
|
|
1406
1420
|
let i = e + n / 2, a = t + r / 2, o = Math.min(n, r) / 2 - 2, s = o - 4;
|
|
1407
|
-
return `<circle cx="${i}" cy="${a}" r="${o}" fill="none" stroke="var(--_text)" stroke-width="${
|
|
1421
|
+
return `<circle cx="${i}" cy="${a}" r="${o}" fill="none" stroke="var(--_text)" stroke-width="${L.innerBox * 2}" />\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`;
|
|
1408
1422
|
}
|
|
1409
|
-
function
|
|
1423
|
+
function wn(e, t, n) {
|
|
1410
1424
|
if ((e.shape === "state-start" || e.shape === "state-end") && !e.label) return "";
|
|
1411
|
-
let
|
|
1412
|
-
return
|
|
1425
|
+
let r = e.x + e.width / 2, i = e.y + e.height / 2, o = a(e.inlineStyle?.color ?? l(e.inlineStyle?.fill, "var(--_text)")), s = `text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${F.nodeLabel}" fill="${o}"`, c = e.inlineStyle?.["font-family"];
|
|
1426
|
+
return c && (s += ` style="font-family: ${a(c)};"`), _(e.label, r, i, n.nodeLabel, s);
|
|
1413
1427
|
}
|
|
1414
|
-
function
|
|
1415
|
-
return
|
|
1428
|
+
function Tn(e) {
|
|
1429
|
+
return a(e).replace(/\r/g, " ").replace(/\n/g, " ").replace(/\t/g, "	");
|
|
1416
1430
|
}
|
|
1417
|
-
function
|
|
1418
|
-
return t === void 0 ? e : e.replace("<svg ", `<svg data-src="${
|
|
1431
|
+
function U(e, t) {
|
|
1432
|
+
return t === void 0 ? e : e.replace("<svg ", `<svg data-src="${Tn(t)}" `);
|
|
1419
1433
|
}
|
|
1420
1434
|
//#endregion
|
|
1421
1435
|
//#region packages/svg-renderer/src/resolve-colors.ts
|
|
1422
|
-
var
|
|
1436
|
+
var En = class {
|
|
1423
1437
|
raw = /* @__PURE__ */ new Map();
|
|
1424
1438
|
resolved = /* @__PURE__ */ new Map();
|
|
1425
1439
|
inProgress = /* @__PURE__ */ new Set();
|
|
@@ -1431,13 +1445,13 @@ var Qt = class {
|
|
|
1431
1445
|
let t = this.raw.get(e);
|
|
1432
1446
|
if (t === void 0 || this.inProgress.has(e)) return;
|
|
1433
1447
|
this.inProgress.add(e);
|
|
1434
|
-
let n =
|
|
1448
|
+
let n = Nn(t, this).trim();
|
|
1435
1449
|
this.inProgress.delete(e);
|
|
1436
1450
|
let r = !/\bvar\(|\bcolor-mix\(/.test(n);
|
|
1437
1451
|
return this.resolved.set(e, r ? n : void 0), r ? n : void 0;
|
|
1438
1452
|
}
|
|
1439
1453
|
};
|
|
1440
|
-
function
|
|
1454
|
+
function Dn(e, t) {
|
|
1441
1455
|
let n = 0;
|
|
1442
1456
|
for (let r = t; r < e.length; r++) {
|
|
1443
1457
|
let t = e[r];
|
|
@@ -1446,7 +1460,7 @@ function $t(e, t) {
|
|
|
1446
1460
|
}
|
|
1447
1461
|
return -1;
|
|
1448
1462
|
}
|
|
1449
|
-
function
|
|
1463
|
+
function On(e) {
|
|
1450
1464
|
let t = [], n = 0, r = 0;
|
|
1451
1465
|
for (let i = 0; i < e.length; i++) {
|
|
1452
1466
|
let a = e[i];
|
|
@@ -1454,12 +1468,12 @@ function en(e) {
|
|
|
1454
1468
|
}
|
|
1455
1469
|
return t.push(e.slice(r)), t;
|
|
1456
1470
|
}
|
|
1457
|
-
var
|
|
1458
|
-
function
|
|
1459
|
-
let [n, ...r] =
|
|
1471
|
+
var kn = "(?<![\\w-])(var|color-mix)\\(";
|
|
1472
|
+
function An(e, t) {
|
|
1473
|
+
let [n, ...r] = On(e), i = (n ?? "").trim(), a = t.lookup(i);
|
|
1460
1474
|
return a === void 0 ? r.length > 0 ? r.join(",").trim() : null : a;
|
|
1461
1475
|
}
|
|
1462
|
-
function
|
|
1476
|
+
function jn(e) {
|
|
1463
1477
|
let t = e.trim().split(/\s+/), n, r;
|
|
1464
1478
|
for (let e of t) if (/^[\d.]+%$/.test(e)) {
|
|
1465
1479
|
if (r !== void 0) return null;
|
|
@@ -1473,61 +1487,61 @@ function rn(e) {
|
|
|
1473
1487
|
pct: r
|
|
1474
1488
|
};
|
|
1475
1489
|
}
|
|
1476
|
-
function
|
|
1477
|
-
let t =
|
|
1490
|
+
function Mn(e) {
|
|
1491
|
+
let t = On(e);
|
|
1478
1492
|
if (t.length !== 3) return null;
|
|
1479
|
-
let [n, r,
|
|
1480
|
-
if (n === void 0 || r === void 0 ||
|
|
1481
|
-
let
|
|
1482
|
-
if (!
|
|
1483
|
-
let
|
|
1484
|
-
if (!
|
|
1485
|
-
let
|
|
1486
|
-
return
|
|
1487
|
-
}
|
|
1488
|
-
function
|
|
1489
|
-
let n = "", r = 0, i = new RegExp(
|
|
1493
|
+
let [n, r, i] = t;
|
|
1494
|
+
if (n === void 0 || r === void 0 || i === void 0 || !/^\s*in\s+srgb\s*$/i.test(n)) return null;
|
|
1495
|
+
let a = jn(r), o = jn(i);
|
|
1496
|
+
if (!a || !o) return null;
|
|
1497
|
+
let s = h(a.color), l = h(o.color);
|
|
1498
|
+
if (!s || !l) return null;
|
|
1499
|
+
let u = p(s, l, a.pct, o.pct);
|
|
1500
|
+
return u ? c(u) : null;
|
|
1501
|
+
}
|
|
1502
|
+
function Nn(e, t) {
|
|
1503
|
+
let n = "", r = 0, i = new RegExp(kn, "g"), a;
|
|
1490
1504
|
for (; (a = i.exec(e)) !== null;) {
|
|
1491
1505
|
let o = a[1];
|
|
1492
1506
|
if (o === void 0) continue;
|
|
1493
|
-
let s = a.index, c = s + o.length, l =
|
|
1507
|
+
let s = a.index, c = s + o.length, l = Dn(e, c);
|
|
1494
1508
|
if (l === -1) break;
|
|
1495
|
-
let u =
|
|
1509
|
+
let u = Nn(e.slice(c + 1, l), t), d = o === "var" ? An(u, t) : Mn(u);
|
|
1496
1510
|
n += e.slice(r, s), n += d ?? `${o}(${u})`, r = l + 1, i.lastIndex = r;
|
|
1497
1511
|
}
|
|
1498
1512
|
return n + e.slice(r);
|
|
1499
1513
|
}
|
|
1500
|
-
function
|
|
1501
|
-
let n = new
|
|
1514
|
+
function Pn(e, t) {
|
|
1515
|
+
let n = new En();
|
|
1502
1516
|
for (let [e, r] of Object.entries(t)) n.declare(e, r);
|
|
1503
|
-
return
|
|
1517
|
+
return Nn(e, n);
|
|
1504
1518
|
}
|
|
1505
|
-
var
|
|
1506
|
-
function
|
|
1507
|
-
|
|
1519
|
+
var Fn = /(--[\w-]+)\s*:\s*([^;{}]+)/g, In = /(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g, Ln = /* @__PURE__ */ new Set(["data-src"]);
|
|
1520
|
+
function Rn(e, t) {
|
|
1521
|
+
Fn.lastIndex = 0;
|
|
1508
1522
|
let n;
|
|
1509
|
-
for (; (n =
|
|
1523
|
+
for (; (n = Fn.exec(e)) !== null;) {
|
|
1510
1524
|
let [, e, r] = n;
|
|
1511
1525
|
e !== void 0 && r !== void 0 && t.declare(e, r.trim());
|
|
1512
1526
|
}
|
|
1513
1527
|
}
|
|
1514
|
-
function
|
|
1515
|
-
return e.replace(
|
|
1516
|
-
if (
|
|
1528
|
+
function zn(e, t) {
|
|
1529
|
+
return e.replace(In, (e, n, r, i, a) => {
|
|
1530
|
+
if (Ln.has(r)) return e;
|
|
1517
1531
|
let o = a[0] ?? "\"";
|
|
1518
|
-
return `${n}${r}${i}${o}${
|
|
1532
|
+
return `${n}${r}${i}${o}${Nn(a.slice(1, -1), t)}${o}`;
|
|
1519
1533
|
});
|
|
1520
1534
|
}
|
|
1521
|
-
function
|
|
1522
|
-
let n = new
|
|
1535
|
+
function Bn(e, t) {
|
|
1536
|
+
let n = new En();
|
|
1523
1537
|
n.declare("--bg", t.bg), n.declare("--fg", t.fg), t.line && n.declare("--line", t.line), t.accent && n.declare("--accent", t.accent), t.muted && n.declare("--muted", t.muted), t.surface && n.declare("--surface", t.surface), t.border && n.declare("--border", t.border);
|
|
1524
1538
|
for (let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)) {
|
|
1525
1539
|
let e = t[1];
|
|
1526
|
-
e !== void 0 &&
|
|
1540
|
+
e !== void 0 && Rn(e, n);
|
|
1527
1541
|
}
|
|
1528
1542
|
for (let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)) {
|
|
1529
1543
|
let e = t[1];
|
|
1530
|
-
e !== void 0 &&
|
|
1544
|
+
e !== void 0 && Rn(e.slice(1, -1), n);
|
|
1531
1545
|
}
|
|
1532
1546
|
let r = "", i = 0;
|
|
1533
1547
|
for (; i < e.length;) {
|
|
@@ -1536,7 +1550,7 @@ function pn(e, t) {
|
|
|
1536
1550
|
if (r += e.slice(i, t), e.startsWith("<style", t)) {
|
|
1537
1551
|
let a = e.indexOf(">", t), o = e.indexOf("</style>", t);
|
|
1538
1552
|
if (a === -1 || o === -1) break;
|
|
1539
|
-
r += e.slice(t, a + 1), r +=
|
|
1553
|
+
r += e.slice(t, a + 1), r += Nn(e.slice(a + 1, o), n), r += "</style>", i = o + 8;
|
|
1540
1554
|
continue;
|
|
1541
1555
|
}
|
|
1542
1556
|
let a = -1, o = null;
|
|
@@ -1551,13 +1565,13 @@ function pn(e, t) {
|
|
|
1551
1565
|
}
|
|
1552
1566
|
if (a === -1) break;
|
|
1553
1567
|
let s = e.slice(t, a + 1);
|
|
1554
|
-
r += s.startsWith("<!") || s.startsWith("<?") || s.startsWith("</") ? s :
|
|
1568
|
+
r += s.startsWith("<!") || s.startsWith("<?") || s.startsWith("</") ? s : zn(s, n), i = a + 1;
|
|
1555
1569
|
}
|
|
1556
1570
|
return r + e.slice(i);
|
|
1557
1571
|
}
|
|
1558
1572
|
//#endregion
|
|
1559
1573
|
//#region packages/svg-renderer/src/class/layout.ts
|
|
1560
|
-
var
|
|
1574
|
+
var W = {
|
|
1561
1575
|
padding: 40,
|
|
1562
1576
|
boxPadX: 8,
|
|
1563
1577
|
headerBaseHeight: 32,
|
|
@@ -1573,16 +1587,16 @@ var K = {
|
|
|
1573
1587
|
notePadX: 10,
|
|
1574
1588
|
notePadY: 6
|
|
1575
1589
|
};
|
|
1576
|
-
function
|
|
1590
|
+
function Vn(e) {
|
|
1577
1591
|
return `note ${e}`;
|
|
1578
1592
|
}
|
|
1579
|
-
function
|
|
1593
|
+
function Hn(e) {
|
|
1580
1594
|
return `${e} link`;
|
|
1581
1595
|
}
|
|
1582
|
-
function
|
|
1583
|
-
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i =
|
|
1596
|
+
function Un(e, t) {
|
|
1597
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = P(t.fontSizes);
|
|
1584
1598
|
for (let t of e.classes) {
|
|
1585
|
-
let e = t.annotation ?
|
|
1599
|
+
let e = t.annotation ? W.headerBaseHeight + W.annotationHeight : W.headerBaseHeight, r = t.attributes.length > 0 ? t.attributes.length * W.memberRowHeight + W.sectionPadY : W.emptySectionHeight, a = t.methods.length > 0 ? t.methods.length * W.memberRowHeight + W.sectionPadY : W.emptySectionHeight, o = M(t.label, i.nodeLabel, F.nodeLabel), s = Kn(t.attributes), c = Kn(t.methods), l = Math.max(W.minWidth, o + W.boxPadX * 2, s + W.boxPadX * 2, c + W.boxPadX * 2), u = e + r + a;
|
|
1586
1600
|
n.set(t.id, {
|
|
1587
1601
|
width: l,
|
|
1588
1602
|
height: u,
|
|
@@ -1592,48 +1606,48 @@ function gn(e, t) {
|
|
|
1592
1606
|
});
|
|
1593
1607
|
}
|
|
1594
1608
|
let a = [];
|
|
1595
|
-
for (let [e, t] of n) a.push(
|
|
1596
|
-
let
|
|
1597
|
-
for (let [t, n] of e.relationships.entries())
|
|
1609
|
+
for (let [e, t] of n) a.push(B(e, t));
|
|
1610
|
+
let o = { fontSize: i.edgeLabel }, s = [];
|
|
1611
|
+
for (let [t, n] of e.relationships.entries()) s.push(V({
|
|
1598
1612
|
id: `e${t}`,
|
|
1599
1613
|
source: n.from,
|
|
1600
1614
|
target: n.to,
|
|
1601
1615
|
label: n.label,
|
|
1602
|
-
labelStyle:
|
|
1616
|
+
labelStyle: o
|
|
1603
1617
|
}));
|
|
1604
|
-
let
|
|
1618
|
+
let c = new Set(n.keys());
|
|
1605
1619
|
for (let [t, n] of e.notes.entries()) {
|
|
1606
|
-
let e =
|
|
1607
|
-
width:
|
|
1608
|
-
height:
|
|
1620
|
+
let e = Vn(t), l = d(n.text, i.edgeLabel, F.edgeLabel), u = {
|
|
1621
|
+
width: l.width + W.notePadX * 2,
|
|
1622
|
+
height: l.height + W.notePadY * 2
|
|
1609
1623
|
};
|
|
1610
|
-
r.set(e,
|
|
1611
|
-
id:
|
|
1624
|
+
r.set(e, u), a.push(B(e, u)), n.forClass !== void 0 && c.has(n.forClass) && s.push(V({
|
|
1625
|
+
id: Hn(e),
|
|
1612
1626
|
source: e,
|
|
1613
1627
|
target: n.forClass,
|
|
1614
|
-
labelStyle:
|
|
1628
|
+
labelStyle: o
|
|
1615
1629
|
}));
|
|
1616
1630
|
}
|
|
1617
1631
|
return {
|
|
1618
1632
|
elkGraph: {
|
|
1619
1633
|
id: "root",
|
|
1620
1634
|
layoutOptions: {
|
|
1621
|
-
...
|
|
1622
|
-
direction:
|
|
1623
|
-
nodeSpacing:
|
|
1624
|
-
layerSpacing:
|
|
1625
|
-
padding:
|
|
1635
|
+
...Ne({
|
|
1636
|
+
direction: je(void 0, Ae.class),
|
|
1637
|
+
nodeSpacing: W.nodeSpacing,
|
|
1638
|
+
layerSpacing: W.layerSpacing,
|
|
1639
|
+
padding: W.padding
|
|
1626
1640
|
}),
|
|
1627
1641
|
"elk.edgeLabels.placement": "CENTER"
|
|
1628
1642
|
},
|
|
1629
1643
|
children: a,
|
|
1630
|
-
edges:
|
|
1644
|
+
edges: s
|
|
1631
1645
|
},
|
|
1632
1646
|
classSizes: n,
|
|
1633
1647
|
noteSizes: r
|
|
1634
1648
|
};
|
|
1635
1649
|
}
|
|
1636
|
-
function
|
|
1650
|
+
function Wn(e, t, n, r) {
|
|
1637
1651
|
let i = /* @__PURE__ */ new Map();
|
|
1638
1652
|
for (let e of t.classes) i.set(e.id, e);
|
|
1639
1653
|
let a = [];
|
|
@@ -1658,7 +1672,7 @@ function _n(e, t, n, r) {
|
|
|
1658
1672
|
attrHeight: i.attrHeight,
|
|
1659
1673
|
methodHeight: i.methodHeight,
|
|
1660
1674
|
interaction: t.interactions.get(e.id),
|
|
1661
|
-
inlineStyle:
|
|
1675
|
+
inlineStyle: y(e.id, t),
|
|
1662
1676
|
className: t.classAssignments.get(e.id)
|
|
1663
1677
|
});
|
|
1664
1678
|
}
|
|
@@ -1669,7 +1683,7 @@ function _n(e, t, n, r) {
|
|
|
1669
1683
|
if (!t)
|
|
1670
1684
|
/* v8 ignore next */
|
|
1671
1685
|
throw Error(`Missing ELK edge for relationship ${e}`);
|
|
1672
|
-
let r =
|
|
1686
|
+
let r = ot(t), i = st(t);
|
|
1673
1687
|
o.push({
|
|
1674
1688
|
from: n.from,
|
|
1675
1689
|
to: n.to,
|
|
@@ -1688,11 +1702,11 @@ function _n(e, t, n, r) {
|
|
|
1688
1702
|
for (let t of e.children ?? []) l.set(t.id, t);
|
|
1689
1703
|
let u = [];
|
|
1690
1704
|
for (let [e, n] of t.notes.entries()) {
|
|
1691
|
-
let t =
|
|
1705
|
+
let t = Vn(e), i = l.get(t), a = r.get(t);
|
|
1692
1706
|
if (!i || !a)
|
|
1693
1707
|
/* v8 ignore next */
|
|
1694
1708
|
throw Error(`Missing layout for note ${e}`);
|
|
1695
|
-
let o = c.get(
|
|
1709
|
+
let o = c.get(Hn(t));
|
|
1696
1710
|
u.push({
|
|
1697
1711
|
id: t,
|
|
1698
1712
|
text: n.text,
|
|
@@ -1701,7 +1715,7 @@ function _n(e, t, n, r) {
|
|
|
1701
1715
|
y: i.y ?? 0,
|
|
1702
1716
|
width: i.width ?? a.width,
|
|
1703
1717
|
height: i.height ?? a.height,
|
|
1704
|
-
...o ? { linkPoints:
|
|
1718
|
+
...o ? { linkPoints: ot(o) } : {}
|
|
1705
1719
|
});
|
|
1706
1720
|
}
|
|
1707
1721
|
return {
|
|
@@ -1712,7 +1726,7 @@ function _n(e, t, n, r) {
|
|
|
1712
1726
|
notes: u
|
|
1713
1727
|
};
|
|
1714
1728
|
}
|
|
1715
|
-
function
|
|
1729
|
+
function Gn(e, t = {}) {
|
|
1716
1730
|
if (e.classes.length === 0 && e.notes.length === 0) return {
|
|
1717
1731
|
width: 0,
|
|
1718
1732
|
height: 0,
|
|
@@ -1720,110 +1734,110 @@ function vn(e, t = {}) {
|
|
|
1720
1734
|
relationships: [],
|
|
1721
1735
|
notes: []
|
|
1722
1736
|
};
|
|
1723
|
-
let { elkGraph: n, classSizes: r, noteSizes: i } =
|
|
1724
|
-
return
|
|
1737
|
+
let { elkGraph: n, classSizes: r, noteSizes: i } = Un(e, t);
|
|
1738
|
+
return Wn(we(n, t.layoutCache), e, r, i);
|
|
1725
1739
|
}
|
|
1726
|
-
function
|
|
1740
|
+
function Kn(e) {
|
|
1727
1741
|
if (e.length === 0) return 0;
|
|
1728
1742
|
let t = 0;
|
|
1729
1743
|
for (let n of e) {
|
|
1730
|
-
let e =
|
|
1744
|
+
let e = Te(ne(n), W.memberFontSize);
|
|
1731
1745
|
e > t && (t = e);
|
|
1732
1746
|
}
|
|
1733
1747
|
return t;
|
|
1734
1748
|
}
|
|
1735
1749
|
//#endregion
|
|
1736
1750
|
//#region packages/svg-renderer/src/class/renderer.ts
|
|
1737
|
-
var
|
|
1751
|
+
var qn = {
|
|
1738
1752
|
memberSize: 11,
|
|
1739
1753
|
memberWeight: 400,
|
|
1740
1754
|
annotationSize: 10,
|
|
1741
1755
|
annotationWeight: 500
|
|
1742
1756
|
};
|
|
1743
|
-
function
|
|
1744
|
-
let d = [], f = l && e.classes.some((e) => !!
|
|
1745
|
-
d.push(
|
|
1746
|
-
for (let t of e.relationships) d.push(
|
|
1747
|
-
for (let t of e.notes) d.push(
|
|
1748
|
-
for (let t of e.classes) d.push(
|
|
1749
|
-
for (let t of e.notes) d.push(
|
|
1750
|
-
for (let t of e.relationships) d.push(
|
|
1757
|
+
function Jn(e, t, n = "Inter", i = !1, a = N, o, s, c, l = !0, u = {}) {
|
|
1758
|
+
let d = [], f = l && e.classes.some((e) => !!b(e.interaction?.href));
|
|
1759
|
+
d.push(U(E(e.width, e.height, t, i, s, c, f, u.styleAttribute), o)), d.push(r(n, !0, u.nonce)), d.push("<defs>"), d.push(Yn()), d.push("</defs>");
|
|
1760
|
+
for (let t of e.relationships) d.push(er(t));
|
|
1761
|
+
for (let t of e.notes) d.push($n(t));
|
|
1762
|
+
for (let t of e.classes) d.push(Xn(t, a, l));
|
|
1763
|
+
for (let t of e.notes) d.push(Qn(t, a));
|
|
1764
|
+
for (let t of e.relationships) d.push(rr(t, a));
|
|
1751
1765
|
return d.push("</svg>"), d.join("\n");
|
|
1752
1766
|
}
|
|
1753
|
-
function
|
|
1767
|
+
function Yn() {
|
|
1754
1768
|
return " <marker id=\"cls-inherit\" markerWidth=\"12\" markerHeight=\"10\" refX=\"12\" refY=\"5\" orient=\"auto-start-reverse\">\n <polygon points=\"0 0, 12 5, 0 10\" fill=\"var(--bg)\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>\n <marker id=\"cls-composition\" markerWidth=\"12\" markerHeight=\"10\" refX=\"0\" refY=\"5\" orient=\"auto-start-reverse\">\n <polygon points=\"6 0, 12 5, 6 10, 0 5\" fill=\"var(--_arrow)\" stroke=\"var(--_arrow)\" stroke-width=\"1\" />\n </marker>\n <marker id=\"cls-aggregation\" markerWidth=\"12\" markerHeight=\"10\" refX=\"0\" refY=\"5\" orient=\"auto-start-reverse\">\n <polygon points=\"6 0, 12 5, 6 10, 0 5\" fill=\"var(--bg)\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>\n <marker id=\"cls-arrow\" markerWidth=\"8\" markerHeight=\"6\" refX=\"8\" refY=\"3\" orient=\"auto-start-reverse\">\n <polyline points=\"0 0, 8 3, 0 6\" fill=\"none\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>";
|
|
1755
1769
|
}
|
|
1756
|
-
function
|
|
1757
|
-
let { x:
|
|
1770
|
+
function Xn(e, t, n = !0) {
|
|
1771
|
+
let { x: r, y: i, width: o, height: s, headerHeight: c, attrHeight: u, inlineStyle: d } = e, f = [], p = e.interaction, m = a(d?.fill ?? "var(--_node-fill)"), h = a(d?.stroke ?? "var(--_node-stroke)"), g = a(d?.["stroke-width"] ?? String(L.outerBox)), v = d?.fill ? m : "var(--_group-hdr)", y = d?.color ? a(d.color) : d?.fill ? a(l(d.fill, "var(--_text)")) : void 0, S = e.annotation ? ` data-annotation="${a(e.annotation)}"` : "", C = x(e.className), w = [
|
|
1758
1772
|
`class="${C ? `class-node ${C}` : "class-node"}"`,
|
|
1759
|
-
`data-id="${
|
|
1760
|
-
`data-label="${
|
|
1773
|
+
`data-id="${a(e.id)}"`,
|
|
1774
|
+
`data-label="${a(e.label)}"`
|
|
1761
1775
|
];
|
|
1762
|
-
|
|
1763
|
-
let T =
|
|
1776
|
+
f.push(`<g ${w.join(" ")}${S}>`);
|
|
1777
|
+
let T = n ? b(p?.href) : void 0;
|
|
1764
1778
|
if (T) {
|
|
1765
|
-
let e =
|
|
1766
|
-
|
|
1779
|
+
let e = p?.target ? ` target="${a(p.target)}"` : "";
|
|
1780
|
+
f.push(` <a href="${a(T)}"${e}>`);
|
|
1767
1781
|
}
|
|
1768
|
-
|
|
1769
|
-
let E =
|
|
1782
|
+
n && p?.tooltip && f.push(` <title>${or(p.tooltip)}</title>`), f.push(` <rect x="${r}" y="${i}" width="${o}" height="${s}" rx="0" ry="0" fill="${m}" stroke="${h}" stroke-width="${g}" />`), f.push(` <rect x="${r}" y="${i}" width="${o}" height="${c}" rx="0" ry="0" fill="${v}" stroke="${h}" stroke-width="${g}" />`);
|
|
1783
|
+
let E = i + c / 2;
|
|
1770
1784
|
if (e.annotation) {
|
|
1771
|
-
let t =
|
|
1772
|
-
|
|
1785
|
+
let t = i + 12;
|
|
1786
|
+
f.push(` <text x="${r + o / 2}" y="${t}" text-anchor="middle" dy="${R}" font-size="${qn.annotationSize}" font-weight="${qn.annotationWeight}" font-style="italic" fill="${y ?? "var(--_text-muted)"}"><<${or(e.annotation)}>></text>`), E = i + c / 2 + 6;
|
|
1773
1787
|
}
|
|
1774
|
-
|
|
1775
|
-
let D =
|
|
1776
|
-
|
|
1788
|
+
f.push(" " + _(e.label, r + o / 2, E, t.nodeLabel, `text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${y ?? "var(--_text)"}"`));
|
|
1789
|
+
let D = i + c;
|
|
1790
|
+
f.push(` <line x1="${r}" y1="${D}" x2="${r + o}" y2="${D}" stroke="${h}" stroke-width="${L.innerBox}" />`);
|
|
1777
1791
|
for (let t = 0; t < e.attributes.length; t++) {
|
|
1778
|
-
let n = e.attributes[t],
|
|
1779
|
-
|
|
1792
|
+
let n = e.attributes[t], i = D + 4 + t * 20 + 10;
|
|
1793
|
+
f.push(" " + Zn(n, r + W.boxPadX, i, y));
|
|
1780
1794
|
}
|
|
1781
|
-
let O = D +
|
|
1782
|
-
|
|
1795
|
+
let O = D + u;
|
|
1796
|
+
f.push(` <line x1="${r}" y1="${O}" x2="${r + o}" y2="${O}" stroke="${h}" stroke-width="${L.innerBox}" />`);
|
|
1783
1797
|
for (let t = 0; t < e.methods.length; t++) {
|
|
1784
|
-
let n = e.methods[t],
|
|
1785
|
-
|
|
1798
|
+
let n = e.methods[t], i = O + 4 + t * 20 + 10;
|
|
1799
|
+
f.push(" " + Zn(n, r + W.boxPadX, i, y));
|
|
1786
1800
|
}
|
|
1787
|
-
return T &&
|
|
1801
|
+
return T && f.push(" </a>"), f.push("</g>"), f.join("\n");
|
|
1788
1802
|
}
|
|
1789
|
-
function
|
|
1803
|
+
function Zn(e, t, n, r) {
|
|
1790
1804
|
let i = e.isAbstract ? " font-style=\"italic\"" : "", a = e.isStatic ? " text-decoration=\"underline\"" : "", o = r ?? "var(--_text-faint)", s = r ?? "var(--_text-sec)", c = r ?? "var(--_text-muted)", l = [];
|
|
1791
|
-
e.visibility && l.push(`<tspan fill="${o}">${
|
|
1805
|
+
e.visibility && l.push(`<tspan fill="${o}">${or(e.visibility)} </tspan>`);
|
|
1792
1806
|
let u = e.isMethod ? `${e.name}(${e.params || ""})` : e.name;
|
|
1793
|
-
return l.push(`<tspan fill="${s}">${
|
|
1794
|
-
}
|
|
1795
|
-
var
|
|
1796
|
-
function
|
|
1797
|
-
let { x:
|
|
1798
|
-
`${
|
|
1799
|
-
`${
|
|
1800
|
-
`${
|
|
1801
|
-
`${
|
|
1802
|
-
`${
|
|
1803
|
-
].join(" "), l = `${
|
|
1804
|
-
return `<g class="class-note"${s}>\n <polygon points="${c}" fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${
|
|
1805
|
-
}
|
|
1806
|
-
function
|
|
1807
|
+
return l.push(`<tspan fill="${s}">${or(u)}</tspan>`), e.type && (l.push(`<tspan fill="${o}">: </tspan>`), l.push(`<tspan fill="${c}">${or(e.type)}</tspan>`)), `<text x="${t}" y="${n}" class="mono" dy="${R}" font-size="${qn.memberSize}" font-weight="${qn.memberWeight}"${i}${a}>${l.join("")}</text>`;
|
|
1808
|
+
}
|
|
1809
|
+
var G = 6;
|
|
1810
|
+
function Qn(e, t) {
|
|
1811
|
+
let { x: n, y: r, width: i, height: o } = e, s = e.forClass === void 0 ? "" : ` data-for="${a(e.forClass)}"`, c = [
|
|
1812
|
+
`${n},${r}`,
|
|
1813
|
+
`${n + i - G},${r}`,
|
|
1814
|
+
`${n + i},${r + G}`,
|
|
1815
|
+
`${n + i},${r + o}`,
|
|
1816
|
+
`${n},${r + o}`
|
|
1817
|
+
].join(" "), l = `${n + i - G},${r} ${n + i},${r + G} ${n + i - G},${r + G}`;
|
|
1818
|
+
return `<g class="class-note"${s}>\n <polygon points="${c}" fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />\n <polygon points="${l}" fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />\n ${_(e.text, n + i / 2, r + o / 2, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`)}\n</g>`;
|
|
1819
|
+
}
|
|
1820
|
+
function $n(e) {
|
|
1807
1821
|
if (!e.linkPoints || e.linkPoints.length < 2) return "";
|
|
1808
1822
|
let t = e.linkPoints.map((e) => `${e.x},${e.y}`).join(" ");
|
|
1809
|
-
return `<polyline class="class-note-link"${e.forClass === void 0 ? "" : ` data-for="${
|
|
1823
|
+
return `<polyline class="class-note-link"${e.forClass === void 0 ? "" : ` data-for="${a(e.forClass)}"`} points="${t}" fill="none" stroke="var(--_line)" stroke-width="${L.connector}" stroke-dasharray="2 3" />`;
|
|
1810
1824
|
}
|
|
1811
|
-
function
|
|
1825
|
+
function er(e) {
|
|
1812
1826
|
if (e.points.length < 2) return "";
|
|
1813
|
-
let t = e.points.map((e) => `${e.x},${e.y}`).join(" "),
|
|
1827
|
+
let t = e.points.map((e) => `${e.x},${e.y}`).join(" "), n = e.type === "dependency" || e.type === "realization" ? " stroke-dasharray=\"6 4\"" : "", r = tr(e.type, e.markerAt), i = [
|
|
1814
1828
|
"class=\"class-relationship\"",
|
|
1815
|
-
`data-from="${
|
|
1816
|
-
`data-to="${
|
|
1829
|
+
`data-from="${a(e.from)}"`,
|
|
1830
|
+
`data-to="${a(e.to)}"`,
|
|
1817
1831
|
`data-type="${e.type}"`,
|
|
1818
1832
|
`data-marker-at="${e.markerAt}"`
|
|
1819
1833
|
];
|
|
1820
|
-
return e.label &&
|
|
1834
|
+
return e.label && i.push(`data-label="${a(e.label)}"`), e.fromCardinality && i.push(`data-from-cardinality="${a(e.fromCardinality)}"`), e.toCardinality && i.push(`data-to-cardinality="${a(e.toCardinality)}"`), `<polyline ${i.join(" ")} points="${t}" fill="none" stroke="var(--_line)" stroke-width="${L.connector}"${n}${r} />`;
|
|
1821
1835
|
}
|
|
1822
|
-
function
|
|
1823
|
-
let n =
|
|
1836
|
+
function tr(e, t) {
|
|
1837
|
+
let n = nr(e);
|
|
1824
1838
|
return n ? t === "from" ? ` marker-start="url(#${n})"` : ` marker-end="url(#${n})"` : "";
|
|
1825
1839
|
}
|
|
1826
|
-
function
|
|
1840
|
+
function nr(e) {
|
|
1827
1841
|
switch (e) {
|
|
1828
1842
|
case "inheritance":
|
|
1829
1843
|
case "realization": return "cls-inherit";
|
|
@@ -1834,30 +1848,30 @@ function An(e) {
|
|
|
1834
1848
|
default: return null;
|
|
1835
1849
|
}
|
|
1836
1850
|
}
|
|
1837
|
-
function
|
|
1851
|
+
function rr(e, t) {
|
|
1838
1852
|
if (!e.label && !e.fromCardinality && !e.toCardinality || e.points.length < 2) return "";
|
|
1839
1853
|
let n = [];
|
|
1840
1854
|
if (e.label) {
|
|
1841
|
-
let r = e.labelPosition ??
|
|
1842
|
-
n.push(
|
|
1855
|
+
let r = e.labelPosition ?? ir(e.points);
|
|
1856
|
+
n.push(_(e.label, r.x, r.y - 8, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
1843
1857
|
}
|
|
1844
1858
|
if (e.fromCardinality && e.points.length >= 2) {
|
|
1845
|
-
let r = e.points[0], i = e.points[1], a =
|
|
1846
|
-
n.push(
|
|
1859
|
+
let r = e.points[0], i = e.points[1], a = ar(r, i);
|
|
1860
|
+
n.push(_(e.fromCardinality, r.x + a.x, r.y + a.y, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
1847
1861
|
}
|
|
1848
1862
|
if (e.toCardinality && e.points.length >= 2) {
|
|
1849
|
-
let r = e.points[e.points.length - 1], i = e.points[e.points.length - 2], a =
|
|
1850
|
-
n.push(
|
|
1863
|
+
let r = e.points[e.points.length - 1], i = e.points[e.points.length - 2], a = ar(r, i);
|
|
1864
|
+
n.push(_(e.toCardinality, r.x + a.x, r.y + a.y, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
1851
1865
|
}
|
|
1852
1866
|
return n.join("\n");
|
|
1853
1867
|
}
|
|
1854
|
-
function
|
|
1868
|
+
function ir(e) {
|
|
1855
1869
|
return e.length === 0 ? {
|
|
1856
1870
|
x: 0,
|
|
1857
1871
|
y: 0
|
|
1858
1872
|
} : e[Math.floor(e.length / 2)];
|
|
1859
1873
|
}
|
|
1860
|
-
function
|
|
1874
|
+
function ar(e, t) {
|
|
1861
1875
|
let n = t.x - e.x, r = t.y - e.y;
|
|
1862
1876
|
return Math.abs(n) > Math.abs(r) ? {
|
|
1863
1877
|
x: n > 0 ? 14 : -14,
|
|
@@ -1867,7 +1881,7 @@ function Nn(e, t) {
|
|
|
1867
1881
|
y: r > 0 ? 14 : -14
|
|
1868
1882
|
};
|
|
1869
1883
|
}
|
|
1870
|
-
var
|
|
1884
|
+
var or = o, K = {
|
|
1871
1885
|
padding: 40,
|
|
1872
1886
|
boxPadX: 14,
|
|
1873
1887
|
headerHeight: 34,
|
|
@@ -1878,24 +1892,24 @@ var Pn = r, q = {
|
|
|
1878
1892
|
nodeSpacing: 70,
|
|
1879
1893
|
layerSpacing: 90
|
|
1880
1894
|
};
|
|
1881
|
-
function
|
|
1882
|
-
let n = /* @__PURE__ */ new Map(), r =
|
|
1895
|
+
function sr(e, t) {
|
|
1896
|
+
let n = /* @__PURE__ */ new Map(), r = P(t.fontSizes);
|
|
1883
1897
|
for (let t of e.entities) {
|
|
1884
|
-
let e =
|
|
1898
|
+
let e = M(t.label, r.nodeLabel, F.nodeLabel), i = 0;
|
|
1885
1899
|
for (let e of t.attributes) {
|
|
1886
|
-
let t =
|
|
1900
|
+
let t = Te(`${e.type} ${e.name}${e.keys.length > 0 ? " " + e.keys.join(",") : ""}`, K.attrFontSize);
|
|
1887
1901
|
t > i && (i = t);
|
|
1888
1902
|
}
|
|
1889
|
-
let a = Math.max(
|
|
1903
|
+
let a = Math.max(K.minWidth, e + K.boxPadX * 2, i + K.boxPadX * 2), o = K.headerHeight + Math.max(t.attributes.length, 1) * K.rowHeight;
|
|
1890
1904
|
n.set(t.id, {
|
|
1891
1905
|
width: a,
|
|
1892
1906
|
height: o
|
|
1893
1907
|
});
|
|
1894
1908
|
}
|
|
1895
1909
|
let i = [];
|
|
1896
|
-
for (let [e, t] of n) i.push(
|
|
1910
|
+
for (let [e, t] of n) i.push(B(e, t));
|
|
1897
1911
|
let a = { fontSize: r.edgeLabel }, o = [];
|
|
1898
|
-
for (let [t, n] of e.relationships.entries()) o.push(
|
|
1912
|
+
for (let [t, n] of e.relationships.entries()) o.push(V({
|
|
1899
1913
|
id: `e${t}`,
|
|
1900
1914
|
source: n.entity1,
|
|
1901
1915
|
target: n.entity2,
|
|
@@ -1906,11 +1920,11 @@ function Fn(e, t) {
|
|
|
1906
1920
|
elkGraph: {
|
|
1907
1921
|
id: "root",
|
|
1908
1922
|
layoutOptions: {
|
|
1909
|
-
...
|
|
1910
|
-
direction:
|
|
1911
|
-
nodeSpacing:
|
|
1912
|
-
layerSpacing:
|
|
1913
|
-
padding:
|
|
1923
|
+
...Ne({
|
|
1924
|
+
direction: je(e.direction, Ae.er),
|
|
1925
|
+
nodeSpacing: K.nodeSpacing,
|
|
1926
|
+
layerSpacing: K.layerSpacing,
|
|
1927
|
+
padding: K.padding
|
|
1914
1928
|
}),
|
|
1915
1929
|
"elk.edgeLabels.placement": "CENTER"
|
|
1916
1930
|
},
|
|
@@ -1920,7 +1934,7 @@ function Fn(e, t) {
|
|
|
1920
1934
|
entitySizes: n
|
|
1921
1935
|
};
|
|
1922
1936
|
}
|
|
1923
|
-
function
|
|
1937
|
+
function cr(e, t, n) {
|
|
1924
1938
|
let r = /* @__PURE__ */ new Map();
|
|
1925
1939
|
for (let e of t.entities) r.set(e.id, e);
|
|
1926
1940
|
let i = [];
|
|
@@ -1939,14 +1953,14 @@ function In(e, t, n) {
|
|
|
1939
1953
|
y: t.y ?? 0,
|
|
1940
1954
|
width: t.width ?? r.width,
|
|
1941
1955
|
height: t.height ?? r.height,
|
|
1942
|
-
headerHeight:
|
|
1943
|
-
rowHeight:
|
|
1956
|
+
headerHeight: K.headerHeight,
|
|
1957
|
+
rowHeight: K.rowHeight
|
|
1944
1958
|
});
|
|
1945
1959
|
}
|
|
1946
1960
|
}
|
|
1947
1961
|
let a = [];
|
|
1948
1962
|
for (let [n, r] of (e.edges ?? []).entries()) {
|
|
1949
|
-
let e = t.relationships[n], i =
|
|
1963
|
+
let e = t.relationships[n], i = ot(r);
|
|
1950
1964
|
a.push({
|
|
1951
1965
|
entity1: e.entity1,
|
|
1952
1966
|
entity2: e.entity2,
|
|
@@ -1964,83 +1978,83 @@ function In(e, t, n) {
|
|
|
1964
1978
|
relationships: a
|
|
1965
1979
|
};
|
|
1966
1980
|
}
|
|
1967
|
-
function
|
|
1981
|
+
function lr(e, t = {}) {
|
|
1968
1982
|
if (e.entities.length === 0) return {
|
|
1969
1983
|
width: 0,
|
|
1970
1984
|
height: 0,
|
|
1971
1985
|
entities: [],
|
|
1972
1986
|
relationships: []
|
|
1973
1987
|
};
|
|
1974
|
-
let { elkGraph: n, entitySizes: r } =
|
|
1975
|
-
return
|
|
1988
|
+
let { elkGraph: n, entitySizes: r } = sr(e, t);
|
|
1989
|
+
return cr(we(n, t.layoutCache), e, r);
|
|
1976
1990
|
}
|
|
1977
1991
|
//#endregion
|
|
1978
1992
|
//#region packages/svg-renderer/src/er/renderer.ts
|
|
1979
|
-
var
|
|
1993
|
+
var q = {
|
|
1980
1994
|
attrSize: 11,
|
|
1981
1995
|
attrWeight: 400,
|
|
1982
1996
|
keySize: 9,
|
|
1983
1997
|
keyWeight: 600
|
|
1984
1998
|
};
|
|
1985
|
-
function
|
|
1999
|
+
function ur(e, t, n = "Inter", i = !1, a = N, o, s, c, l = {}) {
|
|
1986
2000
|
let u = [];
|
|
1987
|
-
u.push(
|
|
1988
|
-
for (let t of e.relationships) u.push(
|
|
1989
|
-
for (let t of e.entities) u.push(
|
|
1990
|
-
for (let t of e.relationships) u.push(
|
|
1991
|
-
for (let t of e.relationships) u.push(
|
|
2001
|
+
u.push(U(E(e.width, e.height, t, i, s, c, void 0, l.styleAttribute), o)), u.push(r(n, !0, l.nonce)), u.push("<defs>"), u.push("</defs>");
|
|
2002
|
+
for (let t of e.relationships) u.push(pr(t));
|
|
2003
|
+
for (let t of e.entities) u.push(dr(t, a));
|
|
2004
|
+
for (let t of e.relationships) u.push(hr(t));
|
|
2005
|
+
for (let t of e.relationships) u.push(mr(t, a));
|
|
1992
2006
|
return u.push("</svg>"), u.join("\n");
|
|
1993
2007
|
}
|
|
1994
|
-
function
|
|
1995
|
-
let { id:
|
|
1996
|
-
|
|
1997
|
-
let
|
|
1998
|
-
|
|
1999
|
-
for (let e = 0; e <
|
|
2000
|
-
let t =
|
|
2001
|
-
|
|
2008
|
+
function dr(e, t) {
|
|
2009
|
+
let { id: n, x: r, y: i, width: o, height: s, headerHeight: c, rowHeight: l, label: u, attributes: d } = e, f = [];
|
|
2010
|
+
f.push(`<g class="entity" data-id="${a(n)}" data-label="${a(u)}">`), f.push(` <rect x="${r}" y="${i}" width="${o}" height="${s}" rx="0" ry="0" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), f.push(` <rect x="${r}" y="${i}" width="${o}" height="${c}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), f.push(" " + _(u, r + o / 2, i + c / 2, t.nodeLabel, `text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="var(--_text)"`));
|
|
2011
|
+
let p = i + c;
|
|
2012
|
+
f.push(` <line x1="${r}" y1="${p}" x2="${r + o}" y2="${p}" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`);
|
|
2013
|
+
for (let e = 0; e < d.length; e++) {
|
|
2014
|
+
let t = d[e], n = p + e * l + l / 2;
|
|
2015
|
+
f.push(" " + fr(t, r, n, o).replace(/\n/g, "\n "));
|
|
2002
2016
|
}
|
|
2003
|
-
return
|
|
2017
|
+
return d.length === 0 && f.push(` <text x="${r + o / 2}" y="${p + l / 2}" text-anchor="middle" dy="${R}" font-size="${q.attrSize}" fill="var(--_text-faint)" font-style="italic">(no attributes)</text>`), f.push("</g>"), f.join("\n");
|
|
2004
2018
|
}
|
|
2005
|
-
function
|
|
2019
|
+
function fr(e, t, n, r) {
|
|
2006
2020
|
let i = [], a = e.comment && e.comment.length > 0;
|
|
2007
2021
|
if (e.comment && e.comment.length > 0) {
|
|
2008
2022
|
let t = e.comment.replace(/<br\s*\/?>/gi, "\n");
|
|
2009
|
-
i.push(`<g><title>${
|
|
2023
|
+
i.push(`<g><title>${vr(t)}</title>`);
|
|
2010
2024
|
}
|
|
2011
2025
|
let o = 0;
|
|
2012
|
-
e.keys.length > 0 && (o =
|
|
2026
|
+
e.keys.length > 0 && (o = M(e.keys.join(","), q.keySize, q.keyWeight) + 8, i.push(`<rect x="${t + 6}" y="${n - 7}" width="${o}" height="14" rx="2" ry="2" fill="var(--_key-badge)" />`), i.push(`<text x="${t + 6 + o / 2}" y="${n}" text-anchor="middle" dy="${R}" font-size="${q.keySize}" font-weight="${q.keyWeight}" fill="var(--_text-sec)">${e.keys.join(",")}</text>`));
|
|
2013
2027
|
let s = t + 8 + (o > 0 ? o + 6 : 0);
|
|
2014
|
-
i.push(`<text x="${s}" y="${n}" class="mono" dy="${
|
|
2028
|
+
i.push(`<text x="${s}" y="${n}" class="mono" dy="${R}" font-size="${q.attrSize}" font-weight="${q.attrWeight}"><tspan fill="var(--_text-muted)">${vr(e.type)}</tspan></text>`);
|
|
2015
2029
|
let c = t + r - 8;
|
|
2016
|
-
return i.push(`<text x="${c}" y="${n}" class="mono" text-anchor="end" dy="${
|
|
2030
|
+
return i.push(`<text x="${c}" y="${n}" class="mono" text-anchor="end" dy="${R}" font-size="${q.attrSize}" font-weight="${q.attrWeight}"><tspan fill="var(--_text-sec)">${vr(e.name)}</tspan></text>`), a && i.push("</g>"), i.join("\n");
|
|
2017
2031
|
}
|
|
2018
|
-
function
|
|
2032
|
+
function pr(e) {
|
|
2019
2033
|
if (e.points.length < 2) return "";
|
|
2020
|
-
let t = e.points.map((e) => `${e.x},${e.y}`).join(" "),
|
|
2034
|
+
let t = e.points.map((e) => `${e.x},${e.y}`).join(" "), n = e.identifying ? "" : " stroke-dasharray=\"6 4\"", r = e.label ? ` data-label="${a(e.label)}"` : "";
|
|
2021
2035
|
return `<polyline ${[
|
|
2022
2036
|
"class=\"er-relationship\"",
|
|
2023
|
-
`data-entity1="${
|
|
2024
|
-
`data-entity2="${
|
|
2037
|
+
`data-entity1="${a(e.entity1)}"`,
|
|
2038
|
+
`data-entity2="${a(e.entity2)}"`,
|
|
2025
2039
|
`data-cardinality1="${e.cardinality1}"`,
|
|
2026
2040
|
`data-cardinality2="${e.cardinality2}"`,
|
|
2027
2041
|
`data-identifying="${e.identifying}"`
|
|
2028
|
-
].join(" ")}${
|
|
2042
|
+
].join(" ")}${r} points="${t}" fill="none" stroke="var(--_line)" stroke-width="${L.connector}"${n} />`;
|
|
2029
2043
|
}
|
|
2030
|
-
function
|
|
2044
|
+
function mr(e, t) {
|
|
2031
2045
|
if (!e.label || e.points.length < 2) return "";
|
|
2032
|
-
let n =
|
|
2033
|
-
return `<rect x="${n.x - i / 2}" y="${n.y - a / 2}" width="${i}" height="${a}" rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />\n${
|
|
2046
|
+
let n = _r(e.points), r = d(e.label, t.edgeLabel, F.edgeLabel), i = r.width + 8, a = r.height + 6;
|
|
2047
|
+
return `<rect x="${n.x - i / 2}" y="${n.y - a / 2}" width="${i}" height="${a}" rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />\n${_(e.label, n.x, n.y, t.edgeLabel, `text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`)}`;
|
|
2034
2048
|
}
|
|
2035
|
-
function
|
|
2049
|
+
function hr(e) {
|
|
2036
2050
|
if (e.points.length < 2) return "";
|
|
2037
2051
|
let t = [], n = e.points[0], r = e.points[1];
|
|
2038
|
-
t.push(
|
|
2052
|
+
t.push(gr(n, r, e.cardinality1));
|
|
2039
2053
|
let i = e.points[e.points.length - 1], a = e.points[e.points.length - 2];
|
|
2040
|
-
return t.push(
|
|
2054
|
+
return t.push(gr(i, a, e.cardinality2)), t.join("\n");
|
|
2041
2055
|
}
|
|
2042
|
-
function
|
|
2043
|
-
let r = [], i =
|
|
2056
|
+
function gr(e, t, n) {
|
|
2057
|
+
let r = [], i = L.connector + .25, a = e.x - t.x, o = e.y - t.y, s = Math.sqrt(a * a + o * o);
|
|
2044
2058
|
if (s === 0) return "";
|
|
2045
2059
|
let c = a / s, l = o / s, u = -l, d = c, f = e.x - c * 4, p = e.y - l * 4, m = e.x - c * 16, h = e.y - l * 16, g = n === "one" || n === "zero-one", _ = n === "many" || n === "zero-many", v = n === "zero-one" || n === "zero-many";
|
|
2046
2060
|
if (g) {
|
|
@@ -2058,7 +2072,7 @@ function Wn(e, t, n) {
|
|
|
2058
2072
|
}
|
|
2059
2073
|
return r.join("\n");
|
|
2060
2074
|
}
|
|
2061
|
-
function
|
|
2075
|
+
function _r(e) {
|
|
2062
2076
|
if (e.length === 0) return {
|
|
2063
2077
|
x: 0,
|
|
2064
2078
|
y: 0
|
|
@@ -2084,7 +2098,7 @@ function Gn(e) {
|
|
|
2084
2098
|
}
|
|
2085
2099
|
return e[e.length - 1];
|
|
2086
2100
|
}
|
|
2087
|
-
var
|
|
2101
|
+
var vr = o, J = {
|
|
2088
2102
|
padding: 30,
|
|
2089
2103
|
actorGap: 140,
|
|
2090
2104
|
actorHeight: 40,
|
|
@@ -2106,20 +2120,20 @@ var Kn = r, qn = {
|
|
|
2106
2120
|
noteStackGap: 4,
|
|
2107
2121
|
boxPad: 10
|
|
2108
2122
|
};
|
|
2109
|
-
function
|
|
2123
|
+
function yr(e) {
|
|
2110
2124
|
return e + 8;
|
|
2111
2125
|
}
|
|
2112
|
-
function
|
|
2126
|
+
function br(e) {
|
|
2113
2127
|
return {
|
|
2114
|
-
...
|
|
2115
|
-
actorHeight: e?.actorHeight ??
|
|
2116
|
-
headerGap: e?.headerGap ??
|
|
2117
|
-
messageRowHeight: e?.messageRowHeight ??
|
|
2118
|
-
noteOffsetAfterMessage: e?.noteOffsetAfterMessage ??
|
|
2119
|
-
noteStackGap: e?.noteStackGap ??
|
|
2128
|
+
...J,
|
|
2129
|
+
actorHeight: e?.actorHeight ?? J.actorHeight,
|
|
2130
|
+
headerGap: e?.headerGap ?? J.headerGap,
|
|
2131
|
+
messageRowHeight: e?.messageRowHeight ?? J.messageRowHeight,
|
|
2132
|
+
noteOffsetAfterMessage: e?.noteOffsetAfterMessage ?? J.noteOffsetAfterMessage,
|
|
2133
|
+
noteStackGap: e?.noteStackGap ?? J.noteStackGap
|
|
2120
2134
|
};
|
|
2121
2135
|
}
|
|
2122
|
-
function
|
|
2136
|
+
function xr(e, t = {}) {
|
|
2123
2137
|
if (e.actors.length === 0) return {
|
|
2124
2138
|
width: 0,
|
|
2125
2139
|
height: 0,
|
|
@@ -2131,8 +2145,8 @@ function Xn(e, t = {}) {
|
|
|
2131
2145
|
notes: [],
|
|
2132
2146
|
boxes: []
|
|
2133
2147
|
};
|
|
2134
|
-
let n =
|
|
2135
|
-
let t =
|
|
2148
|
+
let n = br(t.sequence), r = P(t.fontSizes), i = e.actors.map((e) => {
|
|
2149
|
+
let t = M(e.label, r.nodeLabel, F.nodeLabel);
|
|
2136
2150
|
return Math.max(t + n.actorPadX * 2, 80);
|
|
2137
2151
|
}), a = [], o = n.padding + i[0] / 2;
|
|
2138
2152
|
for (let t = 0; t < e.actors.length; t++) {
|
|
@@ -2144,7 +2158,7 @@ function Xn(e, t = {}) {
|
|
|
2144
2158
|
}
|
|
2145
2159
|
let s = /* @__PURE__ */ new Map();
|
|
2146
2160
|
for (let t = 0; t < e.actors.length; t++) s.set(e.actors[t].id, t);
|
|
2147
|
-
let c = e.boxes.filter((e) => e.actorIds.length > 0), l = c.some((e) => e.label !== ""), u = c.length === 0 ? 0 : n.boxPad + (l ?
|
|
2161
|
+
let c = e.boxes.filter((e) => e.actorIds.length > 0), l = c.some((e) => e.label !== ""), u = c.length === 0 ? 0 : n.boxPad + (l ? yr(r.edgeLabel) : 0), d = n.padding + u, f = e.actors.map((e, t) => ({
|
|
2148
2162
|
id: e.id,
|
|
2149
2163
|
label: e.label,
|
|
2150
2164
|
type: e.type,
|
|
@@ -2179,7 +2193,7 @@ function Xn(e, t = {}) {
|
|
|
2179
2193
|
if (y && y.length > 0) {
|
|
2180
2194
|
let e = m;
|
|
2181
2195
|
for (let t of y) {
|
|
2182
|
-
let o = Math.max(n.noteWidth,
|
|
2196
|
+
let o = Math.max(n.noteWidth, M(t.text, r.edgeLabel, F.edgeLabel) + n.notePadX * 2), c = r.edgeLabel + n.notePadY * 2, l = s.get(t.actorIds[0] ?? "") ?? 0, u;
|
|
2183
2197
|
if (t.position === "left") u = a[l] - i[l] / 2 - o - n.noteGap;
|
|
2184
2198
|
else if (t.position === "right") u = a[l] + i[l] / 2 + n.noteGap;
|
|
2185
2199
|
else if (t.actorIds.length > 1) {
|
|
@@ -2254,7 +2268,7 @@ function Xn(e, t = {}) {
|
|
|
2254
2268
|
if (b && b.length > 0) {
|
|
2255
2269
|
let e = u ? n.selfMessageHeight : 0, o = h[t].y + e + n.noteOffsetAfterMessage;
|
|
2256
2270
|
for (let e of b) {
|
|
2257
|
-
let t = Math.max(n.noteWidth,
|
|
2271
|
+
let t = Math.max(n.noteWidth, M(e.text, r.edgeLabel, F.edgeLabel) + n.notePadX * 2), c = r.edgeLabel + n.notePadY * 2, l = s.get(e.actorIds[0] ?? "") ?? 0, u;
|
|
2258
2272
|
if (e.position === "left") u = a[l] - i[l] / 2 - t - n.noteGap;
|
|
2259
2273
|
else if (e.position === "right") u = a[l] + i[l] / 2 + n.noteGap;
|
|
2260
2274
|
else if (e.actorIds.length > 1) {
|
|
@@ -2294,7 +2308,7 @@ function Xn(e, t = {}) {
|
|
|
2294
2308
|
let f = Math.min(...d), p = Math.max(...d), g = a[f] - i[f] / 2 - n.blockPadX, _ = a[p] + i[p] / 2 + n.blockPadX, v = t.dividers.map((e) => {
|
|
2295
2309
|
let t = h[e.index], n = t?.y ?? m, i = 28;
|
|
2296
2310
|
if (e.label && t?.label) {
|
|
2297
|
-
let n =
|
|
2311
|
+
let n = M(`[${e.label}]`, r.edgeLabel, F.edgeLabel), a = g + 8, o = a + n, s = M(t.label, r.edgeLabel, F.edgeLabel), c = t.isSelf ? t.x1 + 36 : (t.x1 + t.x2) / 2 - s / 2, l = c + s;
|
|
2298
2312
|
o > c && a < l && (i = 36);
|
|
2299
2313
|
}
|
|
2300
2314
|
return {
|
|
@@ -2317,7 +2331,7 @@ function Xn(e, t = {}) {
|
|
|
2317
2331
|
for (let e of D) k = Math.min(k, e.x), A = Math.max(A, e.x + e.width);
|
|
2318
2332
|
for (let e of p) k = Math.min(k, e.x), A = Math.max(A, e.x + e.width);
|
|
2319
2333
|
for (let e of h) if (e.isSelf && e.label) {
|
|
2320
|
-
let t = e.x1 + 30 + 8, n =
|
|
2334
|
+
let t = e.x1 + 30 + 8, n = M(e.label, r.edgeLabel, F.edgeLabel);
|
|
2321
2335
|
A = Math.max(A, t + n + 8);
|
|
2322
2336
|
}
|
|
2323
2337
|
let j = k < n.padding ? n.padding - k : 0;
|
|
@@ -2334,7 +2348,7 @@ function Xn(e, t = {}) {
|
|
|
2334
2348
|
let r = e.actors[t].createdAt;
|
|
2335
2349
|
r !== void 0 && (f[t].y = (h[r]?.y ?? m) - n.actorHeight / 2);
|
|
2336
2350
|
}
|
|
2337
|
-
let
|
|
2351
|
+
let ee = e.actors.map((e, t) => {
|
|
2338
2352
|
let r = e.destroyedAt, i = {
|
|
2339
2353
|
actorId: e.id,
|
|
2340
2354
|
x: a[t],
|
|
@@ -2344,12 +2358,12 @@ function Xn(e, t = {}) {
|
|
|
2344
2358
|
return r !== void 0 && (i.destroyed = !0), i;
|
|
2345
2359
|
});
|
|
2346
2360
|
for (let e of p) e.height = O - n.padding + n.boxPad - e.y;
|
|
2347
|
-
let
|
|
2361
|
+
let te = A + j + n.padding;
|
|
2348
2362
|
return {
|
|
2349
|
-
width: Math.max(
|
|
2363
|
+
width: Math.max(te, 200),
|
|
2350
2364
|
height: Math.max(O, 100),
|
|
2351
2365
|
actors: f,
|
|
2352
|
-
lifelines:
|
|
2366
|
+
lifelines: ee,
|
|
2353
2367
|
messages: h,
|
|
2354
2368
|
activations: x,
|
|
2355
2369
|
blocks: E,
|
|
@@ -2359,79 +2373,79 @@ function Xn(e, t = {}) {
|
|
|
2359
2373
|
}
|
|
2360
2374
|
//#endregion
|
|
2361
2375
|
//#region packages/svg-renderer/src/sequence/renderer.ts
|
|
2362
|
-
function
|
|
2376
|
+
function Sr(e, t, n = "Inter", i = !1, a = N, o, s, c, l = {}) {
|
|
2363
2377
|
let u = [];
|
|
2364
|
-
u.push(
|
|
2365
|
-
for (let t of e.boxes) u.push(
|
|
2366
|
-
for (let t of e.blocks) u.push(
|
|
2367
|
-
for (let t of e.lifelines) u.push(
|
|
2368
|
-
for (let t of e.activations) u.push(
|
|
2369
|
-
for (let t of e.messages) u.push(
|
|
2370
|
-
for (let t of e.notes) u.push(
|
|
2371
|
-
for (let t of e.actors) u.push(
|
|
2378
|
+
u.push(U(E(e.width, e.height, t, i, s, c, void 0, l.styleAttribute), o)), u.push(r(n, !1, l.nonce)), u.push("<defs>"), u.push(Cr()), u.push("</defs>");
|
|
2379
|
+
for (let t of e.boxes) u.push(jr(t, a));
|
|
2380
|
+
for (let t of e.blocks) u.push(Mr(t, a));
|
|
2381
|
+
for (let t of e.lifelines) u.push(Tr(t));
|
|
2382
|
+
for (let t of e.activations) u.push(Dr(t));
|
|
2383
|
+
for (let t of e.messages) u.push(Or(t, a));
|
|
2384
|
+
for (let t of e.notes) u.push(Nr(t, a));
|
|
2385
|
+
for (let t of e.actors) u.push(wr(t, a));
|
|
2372
2386
|
return u.push("</svg>"), u.join("\n");
|
|
2373
2387
|
}
|
|
2374
|
-
function
|
|
2375
|
-
let e =
|
|
2388
|
+
function Cr() {
|
|
2389
|
+
let e = z.width, t = z.height;
|
|
2376
2390
|
return ` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t / 2}" orient="auto-start-reverse">\n <polygon points="0 0, ${e} ${t / 2}, 0 ${t}" fill="var(--_arrow)" />\n </marker>\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t / 2}" orient="auto-start-reverse">\n <polyline points="0 0, ${e} ${t / 2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />\n </marker>`;
|
|
2377
2391
|
}
|
|
2378
|
-
function
|
|
2379
|
-
let { id:
|
|
2380
|
-
if (
|
|
2381
|
-
let e = s / 24 * .9, n =
|
|
2382
|
-
|
|
2392
|
+
function wr(e, t) {
|
|
2393
|
+
let { id: n, x: r, y: i, width: o, height: s, label: c, type: l } = e, u = [];
|
|
2394
|
+
if (u.push(`<g class="actor" data-id="${a(n)}" data-label="${a(c)}" data-type="${l}">`), l === "actor") {
|
|
2395
|
+
let e = s / 24 * .9, n = r - 12 * e, a = i + (s - 24 * e) / 2, o = L.outerBox / e, l = "var(--_line)";
|
|
2396
|
+
u.push(` <g transform="translate(${n},${a}) scale(${e})">\n <path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" fill="none" stroke="${l}" stroke-width="${o}" />\n <path d="M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z" fill="none" stroke="${l}" stroke-width="${o}" />\n <path d="M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563" fill="none" stroke="${l}" stroke-width="${o}" />\n </g>`), u.push(" " + _(c, r, i + s + 14, t.nodeLabel, `font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${F.nodeLabel}" fill="var(--_text)"`));
|
|
2383
2397
|
} else {
|
|
2384
|
-
let e =
|
|
2385
|
-
|
|
2398
|
+
let e = r - o / 2;
|
|
2399
|
+
u.push(` <rect x="${e}" y="${i}" width="${o}" height="${s}" rx="4" ry="4" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), u.push(" " + _(c, r, i + s / 2, t.nodeLabel, `font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${F.nodeLabel}" fill="var(--_text)"`));
|
|
2386
2400
|
}
|
|
2387
|
-
return
|
|
2401
|
+
return u.push("</g>"), u.join("\n");
|
|
2388
2402
|
}
|
|
2389
|
-
function
|
|
2390
|
-
let t = `<line class="lifeline" data-actor="${
|
|
2403
|
+
function Tr(e) {
|
|
2404
|
+
let t = `<line class="lifeline" data-actor="${a(e.actorId)}" x1="${e.x}" y1="${e.topY}" x2="${e.x}" y2="${e.bottomY}" stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`;
|
|
2391
2405
|
if (!e.destroyed) return t;
|
|
2392
|
-
let { x:
|
|
2393
|
-
return t + `\n<path class="destroy" data-actor="${
|
|
2406
|
+
let { x: n, bottomY: r } = e, i = Er;
|
|
2407
|
+
return t + `\n<path class="destroy" data-actor="${a(e.actorId)}" d="M${n - i} ${r - i} L${n + i} ${r + i} M${n + i} ${r - i} L${n - i} ${r + i}" fill="none" stroke="var(--_line)" stroke-width="${L.outerBox}" stroke-linecap="round" />`;
|
|
2394
2408
|
}
|
|
2395
|
-
var
|
|
2396
|
-
function
|
|
2397
|
-
return `<rect class="activation" data-actor="${
|
|
2409
|
+
var Er = 8;
|
|
2410
|
+
function Dr(e) {
|
|
2411
|
+
return `<rect class="activation" data-actor="${a(e.actorId)}" x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY - e.topY}" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`;
|
|
2398
2412
|
}
|
|
2399
|
-
function
|
|
2400
|
-
let
|
|
2401
|
-
if (
|
|
2413
|
+
function Or(e, t) {
|
|
2414
|
+
let n = [], r = e.lineStyle === "dashed" ? " stroke-dasharray=\"6 4\"" : "", i = e.arrowHead === "filled" ? "seq-arrow" : "seq-arrow-open", o = e.bidirectional ? ` marker-start="url(#${i})"` : "";
|
|
2415
|
+
if (n.push(`<g class="message" data-from="${a(e.from)}" data-to="${a(e.to)}" data-label="${a(e.label)}" data-line-style="${e.lineStyle}" data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`), e.isSelf) n.push(` <polyline points="${e.x1},${e.y} ${e.x1 + 30},${e.y} ${e.x1 + 30},${e.y + 20} ${e.x2},${e.y + 20}" fill="none" stroke="var(--_line)" stroke-width="${L.connector}"${r} marker-end="url(#${i})"${o} />`), n.push(" " + _(e.label, e.x1 + 30 + 8, e.y + 10, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="start" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
2402
2416
|
else {
|
|
2403
|
-
|
|
2404
|
-
let
|
|
2405
|
-
|
|
2406
|
-
}
|
|
2407
|
-
return e.seqNumber !== void 0 &&
|
|
2408
|
-
}
|
|
2409
|
-
function
|
|
2410
|
-
let n = Math.max(t.edgeLabel - 2, 8), r = e.bidirectional ? e.x1 + Math.sign(e.x2 - e.x1) * (8 +
|
|
2411
|
-
return `<g class="seq-number"><circle cx="${r}" cy="${e.y}" r="8" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${
|
|
2412
|
-
}
|
|
2413
|
-
var
|
|
2414
|
-
function
|
|
2415
|
-
let
|
|
2416
|
-
return e.label && o.push(" " +
|
|
2417
|
-
}
|
|
2418
|
-
function
|
|
2419
|
-
let
|
|
2420
|
-
|
|
2421
|
-
let
|
|
2422
|
-
|
|
2423
|
-
for (let
|
|
2424
|
-
return
|
|
2425
|
-
}
|
|
2426
|
-
function
|
|
2427
|
-
let { x:
|
|
2428
|
-
return `<g class="note"${e.position ? ` data-position="${
|
|
2429
|
-
`${
|
|
2430
|
-
`${
|
|
2431
|
-
`${
|
|
2432
|
-
`${
|
|
2433
|
-
`${
|
|
2434
|
-
].join(" ")}" fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${
|
|
2417
|
+
n.push(` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" stroke="var(--_line)" stroke-width="${L.connector}"${r} marker-end="url(#${i})"${o} />`);
|
|
2418
|
+
let a = (e.x1 + e.x2) / 2;
|
|
2419
|
+
n.push(" " + _(e.label, a, e.y - 10, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
2420
|
+
}
|
|
2421
|
+
return e.seqNumber !== void 0 && n.push(" " + kr(e, t)), n.push("</g>"), n.join("\n");
|
|
2422
|
+
}
|
|
2423
|
+
function kr(e, t) {
|
|
2424
|
+
let n = Math.max(t.edgeLabel - 2, 8), r = e.bidirectional ? e.x1 + Math.sign(e.x2 - e.x1) * (8 + z.width) : e.x1;
|
|
2425
|
+
return `<g class="seq-number"><circle cx="${r}" cy="${e.y}" r="8" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${L.innerBox}" />` + _(String(e.seqNumber), r, e.y, n, `font-size="${n}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_arrow)"`) + "</g>";
|
|
2426
|
+
}
|
|
2427
|
+
var Ar = 35;
|
|
2428
|
+
function jr(e, t) {
|
|
2429
|
+
let n = e.label ? ` data-label="${a(e.label)}"` : "", r = e.color === void 0 ? "" : ` data-color="${a(e.color)}"`, i = e.color === void 0 ? "none" : `color-mix(in srgb, ${a(e.color)} ${Ar}%, var(--bg))`, o = [`<g class="participant-box"${n}${r}>`, ` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" fill="${i}" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`];
|
|
2430
|
+
return e.label && o.push(" " + _(e.label, e.x + e.width / 2, e.y + yr(t.edgeLabel) / 2, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.groupHeader}" fill="var(--_text-sec)"`)), o.push("</g>"), o.join("\n");
|
|
2431
|
+
}
|
|
2432
|
+
function Mr(e, t) {
|
|
2433
|
+
let n = [], r = e.label ? ` data-label="${a(e.label)}"` : "";
|
|
2434
|
+
n.push(`<g class="block" data-type="${a(e.type)}"${r}>`), n.push(` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`);
|
|
2435
|
+
let i = `${e.type}${e.label ? ` [${e.label}]` : ""}`, o = i.split("\n")[0], s = M(o, t.edgeLabel, F.groupHeader) + 16;
|
|
2436
|
+
n.push(` <rect x="${e.x}" y="${e.y}" width="${s}" height="18" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), n.push(" " + _(i, e.x + 6, e.y + 9, t.edgeLabel, `font-size="${t.edgeLabel}" font-weight="${F.groupHeader}" fill="var(--_text-sec)"`));
|
|
2437
|
+
for (let r of e.dividers) n.push(` <line x1="${e.x}" y1="${r.y}" x2="${e.x + e.width}" y2="${r.y}" stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`), r.label && n.push(" " + _(`[${r.label}]`, e.x + 8, r.y + 14, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="start" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
2438
|
+
return n.push("</g>"), n.join("\n");
|
|
2439
|
+
}
|
|
2440
|
+
function Nr(e, t) {
|
|
2441
|
+
let { x: n, y: r, width: i, height: o } = e, s = e.actors && e.actors.length > 0 ? ` data-actors="${e.actors.map(a).join(",")}"` : "";
|
|
2442
|
+
return `<g class="note"${e.position ? ` data-position="${a(e.position)}"` : ""}${s}>\n <polygon points="${[
|
|
2443
|
+
`${n},${r}`,
|
|
2444
|
+
`${n + i - 6},${r}`,
|
|
2445
|
+
`${n + i},${r + 6}`,
|
|
2446
|
+
`${n + i},${r + o}`,
|
|
2447
|
+
`${n},${r + o}`
|
|
2448
|
+
].join(" ")}" fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />\n <polygon points="${n + i - 6},${r} ${n + i},${r + 6} ${n + i - 6},${r + 6}" fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />\n ${_(e.text, n + i / 2, r + o / 2, t.edgeLabel, `font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`)}\n</g>`;
|
|
2435
2449
|
}
|
|
2436
2450
|
//#endregion
|
|
2437
2451
|
//#region packages/svg-renderer/src/xychart/layout.ts
|
|
@@ -2462,24 +2476,24 @@ var Y = {
|
|
|
2462
2476
|
legendGap: 6,
|
|
2463
2477
|
legendItemGap: 16
|
|
2464
2478
|
};
|
|
2465
|
-
function
|
|
2466
|
-
return e.horizontal ?
|
|
2479
|
+
function Pr(e, t = {}) {
|
|
2480
|
+
return e.horizontal ? Ir(e) : Fr(e);
|
|
2467
2481
|
}
|
|
2468
|
-
function
|
|
2482
|
+
function Fr(e) {
|
|
2469
2483
|
let t = !!e.title, n = !!e.xAxis.title, r = !!e.yAxis.title, i = e.series.length > 1, a = e.yAxis.range;
|
|
2470
2484
|
if (!a)
|
|
2471
2485
|
/* v8 ignore next */
|
|
2472
2486
|
throw Error("XY chart: y-axis range was not set by the parser");
|
|
2473
|
-
let o =
|
|
2487
|
+
let o = Hr(a.min, a.max), s = Math.max(...o.map((e) => M(Ur(e), Y.axisLabelFontSize, Y.axisLabelFontWeight)), Y.yLabelWidth), c = Y.padding + (t ? Y.titleHeight : 0) + (i ? Y.legendHeight : 0), l = Y.padding + Y.xLabelHeight + (n ? Y.axisTitlePad : 0), u = Y.padding + s + Y.yLabelGap + (r ? Y.axisTitlePad : 0), d = Y.padding, f = Y.plotWidth, p = Y.plotHeight, m = u + f + d, h = c + p + l, g = {
|
|
2474
2488
|
x: u,
|
|
2475
2489
|
y: c,
|
|
2476
2490
|
width: f,
|
|
2477
2491
|
height: p
|
|
2478
|
-
}, _ =
|
|
2492
|
+
}, _ = Lr(e), v = (e) => u + (e + .5) * (f / _), y = f / _, b = (e) => {
|
|
2479
2493
|
let t = (e - a.min) / (a.max - a.min || 1);
|
|
2480
2494
|
return c + p - t * p;
|
|
2481
|
-
}, x =
|
|
2482
|
-
label:
|
|
2495
|
+
}, x = zr(e, v, c + p, y), S = o.map((e) => ({
|
|
2496
|
+
label: Ur(e),
|
|
2483
2497
|
x: u,
|
|
2484
2498
|
y: b(e),
|
|
2485
2499
|
tx: u - Y.tickLength,
|
|
@@ -2492,7 +2506,7 @@ function ur(e) {
|
|
|
2492
2506
|
y1: b(e),
|
|
2493
2507
|
x2: u + f,
|
|
2494
2508
|
y2: b(e)
|
|
2495
|
-
})), w =
|
|
2509
|
+
})), w = Rr(e, _), T = e.series.map((e, t) => t), E = Br(e, v, b, y, a.min, w, T), D = Vr(e, v, b, w, T), O = Y.padding + (t ? Y.titleHeight : 0) + Y.legendHeight / 2, k = i ? Wr(e, m / 2, O, T) : [], A = {
|
|
2496
2510
|
x1: u,
|
|
2497
2511
|
y1: c + p,
|
|
2498
2512
|
x2: u + f,
|
|
@@ -2502,7 +2516,7 @@ function ur(e) {
|
|
|
2502
2516
|
y1: c,
|
|
2503
2517
|
x2: u,
|
|
2504
2518
|
y2: c + p
|
|
2505
|
-
},
|
|
2519
|
+
}, ee = {
|
|
2506
2520
|
ticks: x,
|
|
2507
2521
|
line: A,
|
|
2508
2522
|
...e.xAxis.title ? { title: {
|
|
@@ -2510,7 +2524,7 @@ function ur(e) {
|
|
|
2510
2524
|
x: u + f / 2,
|
|
2511
2525
|
y: h - Y.padding
|
|
2512
2526
|
} } : {}
|
|
2513
|
-
},
|
|
2527
|
+
}, te = {
|
|
2514
2528
|
ticks: S,
|
|
2515
2529
|
line: j,
|
|
2516
2530
|
...e.yAxis.title ? { title: {
|
|
@@ -2528,8 +2542,8 @@ function ur(e) {
|
|
|
2528
2542
|
x: m / 2,
|
|
2529
2543
|
y: Y.padding + Y.titleFontSize
|
|
2530
2544
|
} : void 0,
|
|
2531
|
-
xAxis:
|
|
2532
|
-
yAxis:
|
|
2545
|
+
xAxis: ee,
|
|
2546
|
+
yAxis: te,
|
|
2533
2547
|
plotArea: g,
|
|
2534
2548
|
bars: E,
|
|
2535
2549
|
lines: D,
|
|
@@ -2537,12 +2551,12 @@ function ur(e) {
|
|
|
2537
2551
|
legend: k
|
|
2538
2552
|
};
|
|
2539
2553
|
}
|
|
2540
|
-
function
|
|
2554
|
+
function Ir(e) {
|
|
2541
2555
|
let t = !!e.title, n = !!e.xAxis.title, r = !!e.yAxis.title, i = e.series.length > 1, a = e.yAxis.range;
|
|
2542
2556
|
if (!a)
|
|
2543
2557
|
/* v8 ignore next */
|
|
2544
2558
|
throw Error("XY chart: y-axis range was not set by the parser");
|
|
2545
|
-
let o =
|
|
2559
|
+
let o = Hr(a.min, a.max), s = Lr(e), c = Rr(e, s), l = Math.max(...c.map((e) => M(e, Y.axisLabelFontSize, Y.axisLabelFontWeight)), 40), u = Y.padding + (t ? Y.titleHeight : 0) + (i ? Y.legendHeight : 0), d = Y.padding + Y.xLabelHeight + (r ? Y.axisTitlePad : 0), f = Y.padding + l + Y.yLabelGap + (n ? Y.axisTitlePad : 0), p = Y.padding, m = Y.plotWidth, h = Y.plotHeight, g = f + m + p, _ = u + h + d, v = {
|
|
2546
2560
|
x: f,
|
|
2547
2561
|
y: u,
|
|
2548
2562
|
width: m,
|
|
@@ -2551,7 +2565,7 @@ function dr(e) {
|
|
|
2551
2565
|
let t = (e - a.min) / (a.max - a.min || 1);
|
|
2552
2566
|
return f + t * m;
|
|
2553
2567
|
}, b = h / s, x = (e) => u + (e + .5) * b, S = o.map((e) => ({
|
|
2554
|
-
label:
|
|
2568
|
+
label: Ur(e),
|
|
2555
2569
|
x: y(e),
|
|
2556
2570
|
y: u + h,
|
|
2557
2571
|
tx: y(e),
|
|
@@ -2620,12 +2634,12 @@ function dr(e) {
|
|
|
2620
2634
|
y1: u + h,
|
|
2621
2635
|
x2: f + m,
|
|
2622
2636
|
y2: u + h
|
|
2623
|
-
},
|
|
2637
|
+
}, ee = {
|
|
2624
2638
|
x1: f,
|
|
2625
2639
|
y1: u,
|
|
2626
2640
|
x2: f,
|
|
2627
2641
|
y2: u + h
|
|
2628
|
-
},
|
|
2642
|
+
}, te = {
|
|
2629
2643
|
ticks: S,
|
|
2630
2644
|
line: j,
|
|
2631
2645
|
...e.yAxis.title ? { title: {
|
|
@@ -2633,49 +2647,49 @@ function dr(e) {
|
|
|
2633
2647
|
x: f + m / 2,
|
|
2634
2648
|
y: _ - Y.padding
|
|
2635
2649
|
} } : {}
|
|
2636
|
-
},
|
|
2650
|
+
}, ne = {
|
|
2637
2651
|
ticks: C,
|
|
2638
|
-
line:
|
|
2652
|
+
line: ee,
|
|
2639
2653
|
...e.xAxis.title ? { title: {
|
|
2640
2654
|
text: e.xAxis.title,
|
|
2641
2655
|
x: Y.padding + 4,
|
|
2642
2656
|
y: u + h / 2,
|
|
2643
2657
|
rotate: -90
|
|
2644
2658
|
} } : {}
|
|
2645
|
-
},
|
|
2659
|
+
}, re = e.title ? {
|
|
2646
2660
|
text: e.title,
|
|
2647
2661
|
x: g / 2,
|
|
2648
2662
|
y: Y.padding + Y.titleFontSize
|
|
2649
|
-
} : void 0,
|
|
2663
|
+
} : void 0, ie = Y.padding + (t ? Y.titleHeight : 0) + Y.legendHeight / 2;
|
|
2650
2664
|
return {
|
|
2651
2665
|
width: g,
|
|
2652
2666
|
height: _,
|
|
2653
2667
|
horizontal: !0,
|
|
2654
|
-
title:
|
|
2655
|
-
xAxis:
|
|
2656
|
-
yAxis:
|
|
2668
|
+
title: re,
|
|
2669
|
+
xAxis: te,
|
|
2670
|
+
yAxis: ne,
|
|
2657
2671
|
plotArea: v,
|
|
2658
2672
|
bars: D,
|
|
2659
2673
|
lines: O,
|
|
2660
2674
|
gridLines: w,
|
|
2661
|
-
legend: i ?
|
|
2675
|
+
legend: i ? Wr(e, g / 2, ie, T) : []
|
|
2662
2676
|
};
|
|
2663
2677
|
}
|
|
2664
|
-
function
|
|
2678
|
+
function Lr(e) {
|
|
2665
2679
|
if (e.xAxis.categories) return e.xAxis.categories.length;
|
|
2666
2680
|
for (let t of e.series) if (t.data.length > 0) return t.data.length;
|
|
2667
2681
|
return 1;
|
|
2668
2682
|
}
|
|
2669
|
-
function
|
|
2683
|
+
function Rr(e, t) {
|
|
2670
2684
|
if (e.xAxis.categories) return e.xAxis.categories;
|
|
2671
2685
|
if (e.xAxis.range) {
|
|
2672
2686
|
let { min: n, max: r } = e.xAxis.range, i = t > 1 ? (r - n) / (t - 1) : 0;
|
|
2673
|
-
return Array.from({ length: t }, (e, t) =>
|
|
2687
|
+
return Array.from({ length: t }, (e, t) => Ur(n + i * t));
|
|
2674
2688
|
}
|
|
2675
2689
|
return Array.from({ length: t }, (e, t) => String(t + 1));
|
|
2676
2690
|
}
|
|
2677
|
-
function
|
|
2678
|
-
return
|
|
2691
|
+
function zr(e, t, n, r) {
|
|
2692
|
+
return Rr(e, Lr(e)).map((e, r) => ({
|
|
2679
2693
|
label: e,
|
|
2680
2694
|
x: t(r),
|
|
2681
2695
|
y: n,
|
|
@@ -2686,7 +2700,7 @@ function mr(e, t, n, r) {
|
|
|
2686
2700
|
textAnchor: "middle"
|
|
2687
2701
|
}));
|
|
2688
2702
|
}
|
|
2689
|
-
function
|
|
2703
|
+
function Br(e, t, n, r, i, a, o) {
|
|
2690
2704
|
let s = e.series.filter((e) => e.type === "bar").length;
|
|
2691
2705
|
if (s === 0) return [];
|
|
2692
2706
|
let c = r * (1 - Y.barPadRatio), l = s > 1 ? (c - (s - 1) * Y.barGroupGap) / s : c, u = Math.min(l, Y.maxBarWidth), d = s > 1 ? u * s + Y.barGroupGap * (s - 1) : u, f = [], p = 0, m = 0;
|
|
@@ -2712,7 +2726,7 @@ function hr(e, t, n, r, i, a, o) {
|
|
|
2712
2726
|
}
|
|
2713
2727
|
return f;
|
|
2714
2728
|
}
|
|
2715
|
-
function
|
|
2729
|
+
function Vr(e, t, n, r, i) {
|
|
2716
2730
|
let a = [], o = 0, s = 0;
|
|
2717
2731
|
for (let c of e.series) {
|
|
2718
2732
|
if (c.type !== "line") {
|
|
@@ -2733,7 +2747,7 @@ function gr(e, t, n, r, i) {
|
|
|
2733
2747
|
}
|
|
2734
2748
|
return a;
|
|
2735
2749
|
}
|
|
2736
|
-
function
|
|
2750
|
+
function Hr(e, t) {
|
|
2737
2751
|
let n = t - e;
|
|
2738
2752
|
if (n <= 0) return [e];
|
|
2739
2753
|
let r = n / 6, i = 10 ** Math.floor(Math.log10(r)), a = r / i, o;
|
|
@@ -2742,10 +2756,10 @@ function _r(e, t) {
|
|
|
2742
2756
|
for (let e = s; e <= t + o * .001; e += o) c.push(Math.round(e * 1e10) / 1e10);
|
|
2743
2757
|
return c;
|
|
2744
2758
|
}
|
|
2745
|
-
function
|
|
2759
|
+
function Ur(e) {
|
|
2746
2760
|
return Number.isInteger(e) ? String(e) : e.toFixed(+(Math.abs(e) < 10));
|
|
2747
2761
|
}
|
|
2748
|
-
function
|
|
2762
|
+
function Wr(e, t, n, r) {
|
|
2749
2763
|
let i = [], a = 0, o = 0;
|
|
2750
2764
|
for (let t = 0; t < e.series.length; t++) {
|
|
2751
2765
|
let s = e.series[t], c = s.type === "bar" ? `Bar ${a + 1}` : `Line ${o + 1}`;
|
|
@@ -2759,7 +2773,7 @@ function yr(e, t, n, r) {
|
|
|
2759
2773
|
}), s.type === "bar" ? a++ : o++;
|
|
2760
2774
|
}
|
|
2761
2775
|
let s = i.map((e) => {
|
|
2762
|
-
let t =
|
|
2776
|
+
let t = M(e.label, Y.legendFontSize, Y.legendFontWeight);
|
|
2763
2777
|
return Y.legendSwatchW + Y.legendGap + t;
|
|
2764
2778
|
}), c = t - (s.reduce((e, t) => e + t, 0) + (i.length - 1) * Y.legendItemGap) / 2;
|
|
2765
2779
|
for (let e = 0; e < i.length; e++) i[e].x = c, c += s[e] + Y.legendItemGap;
|
|
@@ -2789,24 +2803,24 @@ var X = {
|
|
|
2789
2803
|
minY: 4,
|
|
2790
2804
|
pointerSize: 6
|
|
2791
2805
|
};
|
|
2792
|
-
function
|
|
2793
|
-
let u = [], d = Math.max(0, ...e.bars.map((e) => e.colorIndex), ...e.lines.map((e) => e.colorIndex)), f =
|
|
2794
|
-
u.push(f), u.push(
|
|
2795
|
-
let p = Math.max(...e.lines.map((e) => e.points.length), 0), m = p > 0 && p <= 12, { style: h, defs:
|
|
2796
|
-
u.push(h),
|
|
2797
|
-
let { plotArea:
|
|
2798
|
-
for (let e = O; e <=
|
|
2806
|
+
function Gr(e, t, n = "Inter", i = !1, a = !1, o, s, c, l = {}) {
|
|
2807
|
+
let u = [], d = Math.max(0, ...e.bars.map((e) => e.colorIndex), ...e.lines.map((e) => e.colorIndex)), f = U(E(e.width, e.height, t, i, s, c, void 0, l.styleAttribute).replace("<svg ", `<svg data-xychart-colors="${d}" `), o);
|
|
2808
|
+
u.push(f), u.push(r(n, !1, l.nonce));
|
|
2809
|
+
let p = Math.max(...e.lines.map((e) => e.points.length), 0), m = p > 0 && p <= 12, { style: h, defs: g } = Kr(e, a, m, t.accent, t.bg, l.nonce);
|
|
2810
|
+
u.push(h), g && u.push(g);
|
|
2811
|
+
let { plotArea: _ } = e, v = e.xAxis.ticks.map((e) => e.x), y = e.horizontal ? e.yAxis.ticks.map((e) => e.y) : e.gridLines.map((e) => e.y1), b = v.length > 1 ? Math.abs(v[1] - v[0]) : _.width / 6, x = y.length > 1 ? Math.abs(y[1] - y[0]) : _.height / 6, S = b / Math.max(1, Math.round(b / 20)), C = x / Math.max(1, Math.round(x / 20)), w = v[0] ?? _.x, T = y[0] ?? _.y, D = w - Math.ceil((w - _.x) / S) * S, O = T - Math.ceil((T - _.y) / C) * C;
|
|
2812
|
+
for (let e = O; e <= _.y + _.height + .5; e += C) for (let t = D; t <= _.x + _.width + .5; t += S) u.push(`<circle cx="${Q(t)}" cy="${Q(e)}" r="1.5" class="xychart-grid"/>`);
|
|
2799
2813
|
let k = [];
|
|
2800
2814
|
for (let t of e.bars) {
|
|
2801
|
-
let n = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`, r = e.horizontal ?
|
|
2815
|
+
let n = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`, r = e.horizontal ? Jr(t.x, t.y, t.width, t.height, X.barRadius) : qr(t.x, t.y, t.width, t.height, X.barRadius);
|
|
2802
2816
|
if (u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`), a) {
|
|
2803
|
-
let e =
|
|
2817
|
+
let e = Qr(t.value), n = t.label ? `${t.label}: ${e}` : e, r = Zr(t.x + t.width / 2, t.y, e);
|
|
2804
2818
|
k.push(`<g class="xychart-bar-group"><rect x="${Q(t.x)}" y="${Q(t.y)}" width="${Q(t.width)}" height="${Q(t.height)}" fill="transparent"/><title>${$(n)}</title>` + r + "</g>");
|
|
2805
2819
|
}
|
|
2806
2820
|
}
|
|
2807
2821
|
for (let t of e.lines) {
|
|
2808
2822
|
if (t.points.length === 0) continue;
|
|
2809
|
-
let e =
|
|
2823
|
+
let e = Yr(t.points);
|
|
2810
2824
|
u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`), u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`);
|
|
2811
2825
|
}
|
|
2812
2826
|
let A = [];
|
|
@@ -2829,16 +2843,16 @@ function br(e, n, r = "Inter", i = !1, a = !1, o, s, c, l = {}) {
|
|
|
2829
2843
|
let n = e[0].x, r = e[0].label || "";
|
|
2830
2844
|
if (a && e.length > 1) {
|
|
2831
2845
|
let i = Math.min(...e.map((e) => e.y)), a = Math.max(...e.map((e) => e.y)), o = X.dotRadius * 3, s = `<rect x="${Q(n - o)}" y="${Q(i - o)}" width="${Q(o * 2)}" height="${Q(a - i + o * 2)}" fill="transparent" class="xychart-hit"/>`, c = e.map((e) => ({
|
|
2832
|
-
text:
|
|
2846
|
+
text: Qr(e.value),
|
|
2833
2847
|
legendLabel: t.get(e.seriesIndex) || `Line ${e.seriesIndex + 1}`
|
|
2834
|
-
})), l =
|
|
2848
|
+
})), l = Xr(n, i - X.dotRadius, r, c), u = c.map((e) => e.text), d = r ? `${r}: ${u.join(" · ")}` : u.join(" · "), f = `<g class="xychart-dot-group">${s}`;
|
|
2835
2849
|
for (let t of e) {
|
|
2836
2850
|
let e = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`;
|
|
2837
2851
|
f += `<circle cx="${Q(t.x)}" cy="${Q(t.y)}" r="${X.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`;
|
|
2838
2852
|
}
|
|
2839
2853
|
f += `<title>${$(d)}</title>${l}</g>`, A.push(f);
|
|
2840
2854
|
} else if (a) {
|
|
2841
|
-
let t = e[0], r = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`, i =
|
|
2855
|
+
let t = e[0], r = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`, i = Qr(t.value), a = t.label ? `${t.label}: ${i}` : i, o = Zr(n, t.y - X.dotRadius, i), s = m ? `<circle cx="${Q(n)}" cy="${Q(t.y)}" r="${X.dotRadius * 3}" fill="transparent" class="xychart-hit"/>` : "";
|
|
2842
2856
|
A.push(`<g class="xychart-dot-group">${s}<circle cx="${Q(t.x)}" cy="${Q(t.y)}" r="${X.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${$(a)}</title>${o}</g>`);
|
|
2843
2857
|
} else for (let t of e) {
|
|
2844
2858
|
let e = ` data-value="${t.value}"${t.label ? ` data-label="${$(t.label)}"` : ""}`;
|
|
@@ -2846,36 +2860,36 @@ function br(e, n, r = "Inter", i = !1, a = !1, o, s, c, l = {}) {
|
|
|
2846
2860
|
}
|
|
2847
2861
|
}
|
|
2848
2862
|
}
|
|
2849
|
-
for (let t of e.xAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${X.labelSize}" font-weight="${X.labelWeight}" dy="${
|
|
2850
|
-
for (let t of e.yAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${X.labelSize}" font-weight="${X.labelWeight}" dy="${
|
|
2863
|
+
for (let t of e.xAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${X.labelSize}" font-weight="${X.labelWeight}" dy="${R}" class="xychart-label">${$(t.label)}</text>`);
|
|
2864
|
+
for (let t of e.yAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${X.labelSize}" font-weight="${X.labelWeight}" dy="${R}" class="xychart-label">${$(t.label)}</text>`);
|
|
2851
2865
|
if (e.xAxis.title) {
|
|
2852
2866
|
let t = e.xAxis.title, n = t.rotate ? ` transform="rotate(${t.rotate},${t.x},${t.y})"` : "";
|
|
2853
|
-
u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${X.axisTitleSize}" font-weight="${X.axisTitleWeight}" dy="${
|
|
2867
|
+
u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${X.axisTitleSize}" font-weight="${X.axisTitleWeight}" dy="${R}" class="xychart-axis-title">${$(t.text)}</text>`);
|
|
2854
2868
|
}
|
|
2855
2869
|
if (e.yAxis.title) {
|
|
2856
2870
|
let t = e.yAxis.title, n = t.rotate ? ` transform="rotate(${t.rotate},${t.x},${t.y})"` : "";
|
|
2857
|
-
u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${X.axisTitleSize}" font-weight="${X.axisTitleWeight}" dy="${
|
|
2871
|
+
u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${X.axisTitleSize}" font-weight="${X.axisTitleWeight}" dy="${R}" class="xychart-axis-title">${$(t.text)}</text>`);
|
|
2858
2872
|
}
|
|
2859
|
-
e.title && u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${X.titleSize}" font-weight="${X.titleWeight}" dy="${
|
|
2873
|
+
e.title && u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${X.titleSize}" font-weight="${X.titleWeight}" dy="${R}" class="xychart-title">${$(e.title.text)}</text>`);
|
|
2860
2874
|
for (let t of e.legend) {
|
|
2861
2875
|
if (t.type === "bar") u.push(`<rect x="${t.x}" y="${t.y - 7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${t.colorIndex}"/>`);
|
|
2862
2876
|
else {
|
|
2863
2877
|
let e = t.y;
|
|
2864
2878
|
u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x + 14}" y2="${e}" stroke-width="${X.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`);
|
|
2865
2879
|
}
|
|
2866
|
-
u.push(`<text x="${t.x + 14 + 6}" y="${t.y}" text-anchor="start" font-size="${X.legendSize}" font-weight="${X.legendWeight}" dy="${
|
|
2880
|
+
u.push(`<text x="${t.x + 14 + 6}" y="${t.y}" text-anchor="start" font-size="${X.legendSize}" font-weight="${X.legendWeight}" dy="${R}" class="xychart-label">${$(t.label)}</text>`);
|
|
2867
2881
|
}
|
|
2868
2882
|
for (let e of k) u.push(e);
|
|
2869
2883
|
for (let e of A) u.push(e);
|
|
2870
2884
|
return u.push("</svg>"), u.join("\n");
|
|
2871
2885
|
}
|
|
2872
|
-
function
|
|
2873
|
-
let o = r ??
|
|
2886
|
+
function Kr(e, t, n, r, i, a) {
|
|
2887
|
+
let o = r ?? te, s = /* @__PURE__ */ new Set();
|
|
2874
2888
|
for (let t of e.bars) s.add(t.colorIndex);
|
|
2875
2889
|
for (let t of e.lines) s.add(t.colorIndex);
|
|
2876
2890
|
let c = [];
|
|
2877
2891
|
for (let e of [...s].sort((e, t) => e - t)) {
|
|
2878
|
-
let t = e === 0 ? `var(--accent, ${
|
|
2892
|
+
let t = e === 0 ? `var(--accent, ${te})` : re(e, o, i);
|
|
2879
2893
|
c.push(` --xychart-color-${e}: ${t};`), c.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`);
|
|
2880
2894
|
}
|
|
2881
2895
|
let l = [];
|
|
@@ -2891,7 +2905,7 @@ function xr(e, t, n, r, i, a) {
|
|
|
2891
2905
|
.xychart-bar-group:hover .xychart-tip,
|
|
2892
2906
|
.xychart-dot-group:hover .xychart-tip { opacity: 1; }` : "", d = c.length > 0 ? `\n svg {\n${c.join("\n")}\n }` : "";
|
|
2893
2907
|
return {
|
|
2894
|
-
style: `${
|
|
2908
|
+
style: `${T(a)}
|
|
2895
2909
|
.xychart-grid { fill: var(--_inner-stroke); stroke: none; opacity: 0.65; }
|
|
2896
2910
|
.xychart-bar { stroke-width: 1.5; }
|
|
2897
2911
|
.xychart-line { fill: none; stroke-width: ${X.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
|
|
@@ -2905,7 +2919,7 @@ ${l.join("\n")}${u}
|
|
|
2905
2919
|
defs: ""
|
|
2906
2920
|
};
|
|
2907
2921
|
}
|
|
2908
|
-
function
|
|
2922
|
+
function qr(e, t, n, r, i) {
|
|
2909
2923
|
let a = Math.min(i, n / 2, r / 2);
|
|
2910
2924
|
return a <= 0 ? `M${Q(e)},${Q(t)} h${Q(n)} v${Q(r)} h${Q(-n)} Z` : [
|
|
2911
2925
|
`M${Q(e)},${Q(t + a)}`,
|
|
@@ -2919,7 +2933,7 @@ function Sr(e, t, n, r, i) {
|
|
|
2919
2933
|
"Z"
|
|
2920
2934
|
].join(" ");
|
|
2921
2935
|
}
|
|
2922
|
-
function
|
|
2936
|
+
function Jr(e, t, n, r, i) {
|
|
2923
2937
|
let a = Math.min(i, n / 2, r / 2);
|
|
2924
2938
|
return a <= 0 ? `M${Q(e)},${Q(t)} h${Q(n)} v${Q(r)} h${Q(-n)} Z` : [
|
|
2925
2939
|
`M${Q(e + a)},${Q(t)}`,
|
|
@@ -2934,7 +2948,7 @@ function Cr(e, t, n, r, i) {
|
|
|
2934
2948
|
"Z"
|
|
2935
2949
|
].join(" ");
|
|
2936
2950
|
}
|
|
2937
|
-
function
|
|
2951
|
+
function Yr(e) {
|
|
2938
2952
|
if (e.length === 0) return "";
|
|
2939
2953
|
if (e.length === 1) return `M${Q(e[0].x)},${Q(e[0].y)}`;
|
|
2940
2954
|
if (e.length === 2) return `M${Q(e[0].x)},${Q(e[0].y)} L${Q(e[1].x)},${Q(e[1].y)}`;
|
|
@@ -2963,23 +2977,23 @@ function wr(e) {
|
|
|
2963
2977
|
}
|
|
2964
2978
|
return o;
|
|
2965
2979
|
}
|
|
2966
|
-
function
|
|
2967
|
-
let i =
|
|
2968
|
-
let t =
|
|
2980
|
+
function Xr(e, t, n, r) {
|
|
2981
|
+
let i = M(n, Z.fontSize, 600), a = Math.max(...r.map((e) => {
|
|
2982
|
+
let t = M(e.legendLabel, Z.fontSize, Z.fontWeight), n = M(e.text, Z.fontSize, Z.fontWeight);
|
|
2969
2983
|
return t + 10 + n;
|
|
2970
2984
|
})), o = Math.max(i, a) + Z.padX * 2, s = 26 + r.length * 20 + 6, c = Math.max(Z.minY, t - Z.offsetY - s - Z.pointerSize), l = e - o / 2, u = e, d = c + s, f = Z.pointerSize, p = `<polygon points="${Q(u - f)},${Q(d)} ${Q(u + f)},${Q(d)} ${Q(u)},${Q(d + f)}" class="xychart-tip xychart-tip-ptr"/>`, m = `<rect x="${Q(l)}" y="${Q(c)}" width="${Q(o)}" height="${s}" rx="${Z.rx}" class="xychart-tip xychart-tip-bg"/>`;
|
|
2971
2985
|
m += p;
|
|
2972
2986
|
let h = c + 6 + 10;
|
|
2973
|
-
m += `<text x="${Q(e)}" y="${Q(h)}" text-anchor="middle" font-weight="600" font-size="${Z.fontSize}" dy="${
|
|
2987
|
+
m += `<text x="${Q(e)}" y="${Q(h)}" text-anchor="middle" font-weight="600" font-size="${Z.fontSize}" dy="${R}" class="xychart-tip xychart-tip-text">${$(n)}</text>`;
|
|
2974
2988
|
let g = l + Z.padX, _ = l + o - Z.padX;
|
|
2975
|
-
for (let e of r) h += 20, m += `<text x="${Q(g)}" y="${Q(h)}" text-anchor="start" font-size="${Z.fontSize}" font-weight="${Z.fontWeight}" dy="${
|
|
2989
|
+
for (let e of r) h += 20, m += `<text x="${Q(g)}" y="${Q(h)}" text-anchor="start" font-size="${Z.fontSize}" font-weight="${Z.fontWeight}" dy="${R}" class="xychart-tip xychart-tip-text">${$(e.legendLabel)}</text>`, m += `<text x="${Q(_)}" y="${Q(h)}" text-anchor="end" font-size="${Z.fontSize}" font-weight="${Z.fontWeight}" dy="${R}" class="xychart-tip xychart-tip-text">${$(e.text)}</text>`;
|
|
2976
2990
|
return m;
|
|
2977
2991
|
}
|
|
2978
|
-
function
|
|
2979
|
-
let r =
|
|
2980
|
-
return `<rect x="${Q(o)}" y="${Q(a)}" width="${Q(r)}" height="${i}" rx="${Z.rx}" class="xychart-tip xychart-tip-bg"/>` + f + `<text x="${Q(s)}" y="${Q(c)}" text-anchor="middle" dy="${
|
|
2992
|
+
function Zr(e, t, n) {
|
|
2993
|
+
let r = M(n, Z.fontSize, Z.fontWeight) + Z.padX * 2, i = Z.height, a = Math.max(Z.minY, t - Z.offsetY - i - Z.pointerSize), o = e - r / 2, s = e, c = a + i / 2, l = e, u = a + i, d = Z.pointerSize, f = `<polygon points="${Q(l - d)},${Q(u)} ${Q(l + d)},${Q(u)} ${Q(l)},${Q(u + d)}" class="xychart-tip xychart-tip-ptr"/>`;
|
|
2994
|
+
return `<rect x="${Q(o)}" y="${Q(a)}" width="${Q(r)}" height="${i}" rx="${Z.rx}" class="xychart-tip xychart-tip-bg"/>` + f + `<text x="${Q(s)}" y="${Q(c)}" text-anchor="middle" dy="${R}" class="xychart-tip xychart-tip-text">${$(n)}</text>`;
|
|
2981
2995
|
}
|
|
2982
|
-
function
|
|
2996
|
+
function Qr(e) {
|
|
2983
2997
|
return Number.isInteger(e) ? e.toLocaleString("en-US") : e.toFixed(+(Math.abs(e) < 10));
|
|
2984
2998
|
}
|
|
2985
2999
|
function Q(e) {
|
|
@@ -2989,6 +3003,529 @@ function $(e) {
|
|
|
2989
3003
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
2990
3004
|
}
|
|
2991
3005
|
//#endregion
|
|
2992
|
-
|
|
3006
|
+
//#region src/parser.ts
|
|
3007
|
+
function $r(e) {
|
|
3008
|
+
let t = e.trim();
|
|
3009
|
+
return t.length >= 2 && (t[0] === "\"" && t[t.length - 1] === "\"" || t[0] === "'" && t[t.length - 1] === "'") ? t.slice(1, -1) : t;
|
|
3010
|
+
}
|
|
3011
|
+
var ei = "\"graph <dir>\"/\"flowchart <dir>\" (dir: TD, TB, LR, BT, RL), \"stateDiagram-v2\", \"sequenceDiagram\", \"classDiagram\", \"erDiagram\", \"xychart-beta\"";
|
|
3012
|
+
function ti(e) {
|
|
3013
|
+
let t = e.trim().toLowerCase();
|
|
3014
|
+
if (/^sequence/.test(t)) return "sequenceDiagram";
|
|
3015
|
+
if (/^class/.test(t)) return "classDiagram";
|
|
3016
|
+
if (/^er/.test(t)) return "erDiagram";
|
|
3017
|
+
if (/^xychart/.test(t)) return "xychart-beta";
|
|
3018
|
+
if (/^state/.test(t)) return "stateDiagram-v2";
|
|
3019
|
+
}
|
|
3020
|
+
var ni = /^(?:[\w-]+@)?<?(?:-{2,}|={2,}|-\.+-?|~{3,})/;
|
|
3021
|
+
function ri(e) {
|
|
3022
|
+
let t = [];
|
|
3023
|
+
for (let n of e) n.forEach((e, n) => {
|
|
3024
|
+
if (n === 0 && t.length > 0 && ni.test(e.text)) {
|
|
3025
|
+
let n = t[t.length - 1];
|
|
3026
|
+
t[t.length - 1] = {
|
|
3027
|
+
text: `${n.text} ${e.text}`,
|
|
3028
|
+
line: n.line
|
|
3029
|
+
};
|
|
3030
|
+
} else t.push(e);
|
|
3031
|
+
});
|
|
3032
|
+
return t;
|
|
3033
|
+
}
|
|
3034
|
+
function ii(e) {
|
|
3035
|
+
let t = s(e.split("\n").map((e) => e.trim())), n = ri(w(e));
|
|
3036
|
+
if (n.length === 0) throw Error("Empty mermaid diagram");
|
|
3037
|
+
let r = n[0], i = /^stateDiagram(-v2)?\s*$/i.test(r.text) ? oi(n) : ai(n);
|
|
3038
|
+
return i.initConfig = t, i;
|
|
3039
|
+
}
|
|
3040
|
+
function ai(e) {
|
|
3041
|
+
let t = e[0];
|
|
3042
|
+
if (t === void 0)
|
|
3043
|
+
/* v8 ignore next */
|
|
3044
|
+
throw Error("parseFlowchart called with no lines");
|
|
3045
|
+
let n = t.text, r = n.match(/^(?:graph|flowchart)\s+(TD|TB|LR|BT|RL)\s*$/i);
|
|
3046
|
+
if (!r) {
|
|
3047
|
+
let e = n.match(/^(?:graph|flowchart)\b\s*(.*)$/i);
|
|
3048
|
+
if (e) {
|
|
3049
|
+
let r = e[1].trim();
|
|
3050
|
+
throw Error(r.length > 0 ? `Line ${t.line}: Invalid direction "${r}" in header "${n}". Expected one of: TD, TB, LR, BT, RL.` : `Line ${t.line}: Missing direction in header "${n}". Expected e.g. "graph TD" or "flowchart LR" — one of: TD, TB, LR, BT, RL.`);
|
|
3051
|
+
}
|
|
3052
|
+
let r = ti(n), i = r && r.toLowerCase() !== n.trim().toLowerCase() ? ` Did you mean "${r}"?` : "";
|
|
3053
|
+
throw Error(`Line ${t.line}: Invalid mermaid header: "${n}".${i} Supported headers: ${ei}.`);
|
|
3054
|
+
}
|
|
3055
|
+
let i = {
|
|
3056
|
+
direction: O(r[1]),
|
|
3057
|
+
nodes: /* @__PURE__ */ new Map(),
|
|
3058
|
+
edges: [],
|
|
3059
|
+
subgraphs: [],
|
|
3060
|
+
classDefs: /* @__PURE__ */ new Map(),
|
|
3061
|
+
classAssignments: /* @__PURE__ */ new Map(),
|
|
3062
|
+
nodeStyles: /* @__PURE__ */ new Map(),
|
|
3063
|
+
linkStyles: /* @__PURE__ */ new Map(),
|
|
3064
|
+
interactions: /* @__PURE__ */ new Map()
|
|
3065
|
+
}, a = [];
|
|
3066
|
+
for (let t = 1; t < e.length; t++) {
|
|
3067
|
+
let n = e[t].text;
|
|
3068
|
+
if (A(n, i) || k(n, i) || j(n, i)) continue;
|
|
3069
|
+
if (/^click\s+/i.test(n)) {
|
|
3070
|
+
vi(n, i);
|
|
3071
|
+
continue;
|
|
3072
|
+
}
|
|
3073
|
+
if (bi(n, i)) continue;
|
|
3074
|
+
let r = n.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);
|
|
3075
|
+
if (r) {
|
|
3076
|
+
let e = r[1].trim(), t = g(r[2]);
|
|
3077
|
+
if (e === "default") i.linkStyles.set("default", {
|
|
3078
|
+
...i.linkStyles.get("default"),
|
|
3079
|
+
...t
|
|
3080
|
+
});
|
|
3081
|
+
else {
|
|
3082
|
+
let n = e.split(",").map((e) => parseInt(e.trim(), 10));
|
|
3083
|
+
for (let e of n) isNaN(e) || i.linkStyles.set(e, {
|
|
3084
|
+
...i.linkStyles.get(e),
|
|
3085
|
+
...t
|
|
3086
|
+
});
|
|
3087
|
+
}
|
|
3088
|
+
continue;
|
|
3089
|
+
}
|
|
3090
|
+
let o = n.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);
|
|
3091
|
+
if (o && a.length > 0) {
|
|
3092
|
+
a[a.length - 1].direction = O(o[1]);
|
|
3093
|
+
continue;
|
|
3094
|
+
}
|
|
3095
|
+
let s = n.match(/^subgraph\s+(.+)$/);
|
|
3096
|
+
if (s) {
|
|
3097
|
+
let e = s[1].trim(), t = e.match(/^([^\s[]+)\s*\[(.+)\]$/), n, r;
|
|
3098
|
+
t ? (n = t[1], r = m($r(t[2]))) : (r = m($r(e)), n = r.replace(/\s+/g, "_").replace(/[^\p{L}\p{N}_-]/gu, ""));
|
|
3099
|
+
let i = {
|
|
3100
|
+
id: n,
|
|
3101
|
+
label: r,
|
|
3102
|
+
nodeIds: [],
|
|
3103
|
+
children: []
|
|
3104
|
+
};
|
|
3105
|
+
a.push(i);
|
|
3106
|
+
continue;
|
|
3107
|
+
}
|
|
3108
|
+
if (n === "end") {
|
|
3109
|
+
let e = a.pop();
|
|
3110
|
+
e && (a.length > 0 ? a[a.length - 1].children.push(e) : i.subgraphs.push(e));
|
|
3111
|
+
continue;
|
|
3112
|
+
}
|
|
3113
|
+
wi(n, i, a);
|
|
3114
|
+
}
|
|
3115
|
+
return i;
|
|
3116
|
+
}
|
|
3117
|
+
function oi(e) {
|
|
3118
|
+
let t = {
|
|
3119
|
+
direction: "TD",
|
|
3120
|
+
nodes: /* @__PURE__ */ new Map(),
|
|
3121
|
+
edges: [],
|
|
3122
|
+
subgraphs: [],
|
|
3123
|
+
classDefs: /* @__PURE__ */ new Map(),
|
|
3124
|
+
classAssignments: /* @__PURE__ */ new Map(),
|
|
3125
|
+
nodeStyles: /* @__PURE__ */ new Map(),
|
|
3126
|
+
linkStyles: /* @__PURE__ */ new Map(),
|
|
3127
|
+
interactions: /* @__PURE__ */ new Map()
|
|
3128
|
+
}, n = [], r = /* @__PURE__ */ new Set(), i = 0, a = 0;
|
|
3129
|
+
for (let o = 1; o < e.length; o++) {
|
|
3130
|
+
let s = e[o].text, c = s.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);
|
|
3131
|
+
if (c) {
|
|
3132
|
+
n.length > 0 ? n[n.length - 1].direction = O(c[1]) : t.direction = O(c[1]);
|
|
3133
|
+
continue;
|
|
3134
|
+
}
|
|
3135
|
+
let l = s.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);
|
|
3136
|
+
if (l) {
|
|
3137
|
+
let e = l[1].trim(), n = g(l[2]);
|
|
3138
|
+
if (e === "default") t.linkStyles.set("default", {
|
|
3139
|
+
...t.linkStyles.get("default"),
|
|
3140
|
+
...n
|
|
3141
|
+
});
|
|
3142
|
+
else {
|
|
3143
|
+
let r = e.split(",").map((e) => parseInt(e.trim(), 10));
|
|
3144
|
+
for (let e of r) isNaN(e) || t.linkStyles.set(e, {
|
|
3145
|
+
...t.linkStyles.get(e),
|
|
3146
|
+
...n
|
|
3147
|
+
});
|
|
3148
|
+
}
|
|
3149
|
+
continue;
|
|
3150
|
+
}
|
|
3151
|
+
if (bi(s, t)) continue;
|
|
3152
|
+
let u = s.match(/^state\s+(?:"([^"]+)"\s+as\s+)?([\w\p{L}]+)\s*\{$/u);
|
|
3153
|
+
if (u) {
|
|
3154
|
+
let e = u[1] ?? u[2], i = u[2], a = {
|
|
3155
|
+
id: i,
|
|
3156
|
+
label: e,
|
|
3157
|
+
nodeIds: [],
|
|
3158
|
+
children: []
|
|
3159
|
+
};
|
|
3160
|
+
n.push(a), r.add(i), t.nodes.delete(i);
|
|
3161
|
+
continue;
|
|
3162
|
+
}
|
|
3163
|
+
if (s === "}") {
|
|
3164
|
+
let e = n.pop();
|
|
3165
|
+
e && (n.length > 0 ? n[n.length - 1].children.push(e) : t.subgraphs.push(e));
|
|
3166
|
+
continue;
|
|
3167
|
+
}
|
|
3168
|
+
let d = s.match(/^state\s+"([^"]+)"\s+as\s+([\w\p{L}]+)\s*$/u);
|
|
3169
|
+
if (d) {
|
|
3170
|
+
let e = m(d[1]), r = d[2];
|
|
3171
|
+
si(t, n, {
|
|
3172
|
+
id: r,
|
|
3173
|
+
label: e,
|
|
3174
|
+
shape: "rounded"
|
|
3175
|
+
});
|
|
3176
|
+
continue;
|
|
3177
|
+
}
|
|
3178
|
+
let f = s.match(/^(\[\*\]|[\w\p{L}-]+)\s*(?:([\w-]+)@)?-->\s*(\[\*\]|[\w\p{L}-]+)(?:\s*:\s*(.+))?$/u);
|
|
3179
|
+
if (f) {
|
|
3180
|
+
let e = f[1], o = f[2], s = f[3], c = f[4]?.trim(), l = c ? m(c) : void 0;
|
|
3181
|
+
e === "[*]" ? (i++, e = `_start${i > 1 ? i : ""}`, si(t, n, {
|
|
3182
|
+
id: e,
|
|
3183
|
+
label: "",
|
|
3184
|
+
shape: "state-start"
|
|
3185
|
+
})) : r.has(e) || ci(t, n, e), s === "[*]" ? (a++, s = `_end${a > 1 ? a : ""}`, si(t, n, {
|
|
3186
|
+
id: s,
|
|
3187
|
+
label: "",
|
|
3188
|
+
shape: "state-end"
|
|
3189
|
+
})) : r.has(s) || ci(t, n, s), t.edges.push({
|
|
3190
|
+
source: e,
|
|
3191
|
+
target: s,
|
|
3192
|
+
label: l,
|
|
3193
|
+
style: "solid",
|
|
3194
|
+
hasArrowStart: !1,
|
|
3195
|
+
hasArrowEnd: !0,
|
|
3196
|
+
...o === void 0 ? {} : { id: o }
|
|
3197
|
+
});
|
|
3198
|
+
continue;
|
|
3199
|
+
}
|
|
3200
|
+
let p = s.match(/^([\w\p{L}-]+)\s*:\s*(.+)$/u);
|
|
3201
|
+
if (p) {
|
|
3202
|
+
let e = p[1];
|
|
3203
|
+
si(t, n, {
|
|
3204
|
+
id: e,
|
|
3205
|
+
label: m(p[2].trim()),
|
|
3206
|
+
shape: "rounded"
|
|
3207
|
+
});
|
|
3208
|
+
continue;
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
return t;
|
|
3212
|
+
}
|
|
3213
|
+
function si(e, t, n) {
|
|
3214
|
+
if (e.nodes.has(n.id) || e.nodes.set(n.id, n), t.length > 0) {
|
|
3215
|
+
let e = t[t.length - 1];
|
|
3216
|
+
e.nodeIds.includes(n.id) || e.nodeIds.push(n.id);
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
function ci(e, t, n) {
|
|
3220
|
+
if (!e.nodes.has(n)) si(e, t, {
|
|
3221
|
+
id: n,
|
|
3222
|
+
label: n,
|
|
3223
|
+
shape: "rounded"
|
|
3224
|
+
});
|
|
3225
|
+
else if (t.length > 0) {
|
|
3226
|
+
let e = t[t.length - 1];
|
|
3227
|
+
e.nodeIds.includes(n) || e.nodeIds.push(n);
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
var li = /^(<|o|x)?(-{2,}|={2,}|-\.+-|~{3,})(>|o|x)?(?:\|([^|]*)\|)?/, ui = /* @__PURE__ */ new Set(["--", "=="]);
|
|
3231
|
+
function di(e) {
|
|
3232
|
+
if (e === "o") return "circle";
|
|
3233
|
+
if (e === "x") return "cross";
|
|
3234
|
+
}
|
|
3235
|
+
var fi = /^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|={3,}|-\.+-)/, pi = [
|
|
3236
|
+
{
|
|
3237
|
+
regex: /^([\w\p{L}-]+)\(\(\(((?:"[^"]*"|(?!\)\)\)).)+)\)\)\)/u,
|
|
3238
|
+
shape: "doublecircle"
|
|
3239
|
+
},
|
|
3240
|
+
{
|
|
3241
|
+
regex: /^([\w\p{L}-]+)\(\[((?:"[^"]*"|(?!\]\)).)+)\]\)/u,
|
|
3242
|
+
shape: "stadium"
|
|
3243
|
+
},
|
|
3244
|
+
{
|
|
3245
|
+
regex: /^([\w\p{L}-]+)\(\(((?:"[^"]*"|(?!\)\)).)+)\)\)/u,
|
|
3246
|
+
shape: "circle"
|
|
3247
|
+
},
|
|
3248
|
+
{
|
|
3249
|
+
regex: /^([\w\p{L}-]+)\[\[((?:"[^"]*"|(?!\]\]).)+)\]\]/u,
|
|
3250
|
+
shape: "subroutine"
|
|
3251
|
+
},
|
|
3252
|
+
{
|
|
3253
|
+
regex: /^([\w\p{L}-]+)\[\(((?:"[^"]*"|(?!\)\]).)+)\)\]/u,
|
|
3254
|
+
shape: "cylinder"
|
|
3255
|
+
},
|
|
3256
|
+
{
|
|
3257
|
+
regex: /^([\w\p{L}-]+)\[\/((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,
|
|
3258
|
+
shape: (e) => e === "\\" ? "trapezoid" : "parallelogram"
|
|
3259
|
+
},
|
|
3260
|
+
{
|
|
3261
|
+
regex: /^([\w\p{L}-]+)\[\\((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,
|
|
3262
|
+
shape: (e) => e === "/" ? "trapezoid-alt" : "parallelogram-alt"
|
|
3263
|
+
},
|
|
3264
|
+
{
|
|
3265
|
+
regex: /^([\w\p{L}-]+)>((?:"[^"]*"|(?!\]).)+)\]/u,
|
|
3266
|
+
shape: "asymmetric"
|
|
3267
|
+
},
|
|
3268
|
+
{
|
|
3269
|
+
regex: /^([\w\p{L}-]+)\{\{((?:"[^"]*"|(?!\}\}).)+)\}\}/u,
|
|
3270
|
+
shape: "hexagon"
|
|
3271
|
+
},
|
|
3272
|
+
{
|
|
3273
|
+
regex: /^([\w\p{L}-]+)\[((?:"[^"]*"|(?!\]).)+)\]/u,
|
|
3274
|
+
shape: "rectangle"
|
|
3275
|
+
},
|
|
3276
|
+
{
|
|
3277
|
+
regex: /^([\w\p{L}-]+)\(((?:"[^"]*"|(?!\)).)+)\)/u,
|
|
3278
|
+
shape: "rounded"
|
|
3279
|
+
},
|
|
3280
|
+
{
|
|
3281
|
+
regex: /^([\w\p{L}-]+)\{((?:"[^"]*"|(?!\}).)+)\}/u,
|
|
3282
|
+
shape: "diamond"
|
|
3283
|
+
}
|
|
3284
|
+
], mi = /^([\w\p{L}]+(?:-[\w\p{L}]+)*)/u, hi = /^([\w\p{L}-]+)(?=@\{)/u;
|
|
3285
|
+
function gi(e) {
|
|
3286
|
+
if (e.shape) return ue(e.shape) ?? "rectangle";
|
|
3287
|
+
if (e.icon !== void 0 || e.img !== void 0) switch (e.form?.toLowerCase()) {
|
|
3288
|
+
case "circle": return "circle";
|
|
3289
|
+
case "rounded": return "rounded";
|
|
3290
|
+
default: return "rectangle";
|
|
3291
|
+
}
|
|
3292
|
+
return "rectangle";
|
|
3293
|
+
}
|
|
3294
|
+
function _i(e, t) {
|
|
3295
|
+
return t.label !== void 0 && t.label.length > 0 ? t.label : t.icon ? t.icon : t.img ? t.img : e;
|
|
3296
|
+
}
|
|
3297
|
+
function vi(e, t) {
|
|
3298
|
+
n(e, t.interactions);
|
|
3299
|
+
}
|
|
3300
|
+
var yi = /^([\w-]+)(?=@\{)/;
|
|
3301
|
+
function bi(e, t) {
|
|
3302
|
+
let n = e.match(yi);
|
|
3303
|
+
if (!n || !t.edges.some((e) => e.id === n[1])) return !1;
|
|
3304
|
+
let r = ie(e.slice(n[1].length));
|
|
3305
|
+
return r ? (xi(t, n[1], se(r.body)), !0) : !1;
|
|
3306
|
+
}
|
|
3307
|
+
function xi(e, t, n) {
|
|
3308
|
+
for (let r of e.edges) r.id === t && (n.animate !== void 0 && (r.animate = n.animate.toLowerCase() !== "false"), n.animation !== void 0 && (r.animate = !0));
|
|
3309
|
+
}
|
|
3310
|
+
var Si = /^:::([\w][\w-]*)/, Ci = /^([\w\p{L}-]+):::([\w][\w-]*)/u;
|
|
3311
|
+
function wi(e, t, n) {
|
|
3312
|
+
let r = e.trim(), i = Ti(r, t, n);
|
|
3313
|
+
if (!i || i.ids.length === 0) return;
|
|
3314
|
+
r = i.remaining.trim();
|
|
3315
|
+
let a = i.ids;
|
|
3316
|
+
for (; r.length > 0;) {
|
|
3317
|
+
let e, i, o, s, c, l, u, d = r.match(/^([\w-]+)@(?=[-=<~ox])/);
|
|
3318
|
+
d && (u = d[1], r = r.slice(d[0].length));
|
|
3319
|
+
let f = r.match(li), p = f?.[2], h = f?.[1], g = f?.[3];
|
|
3320
|
+
if (f && p !== void 0 && !(h === void 0 && g === void 0 && ui.has(p))) {
|
|
3321
|
+
e = h !== void 0, c = di(h);
|
|
3322
|
+
let t = f[4]?.trim();
|
|
3323
|
+
s = t ? m(t) : void 0, r = r.slice(f[0].length).trim(), i = ki(p), o = g !== void 0, l = di(g);
|
|
3324
|
+
} else {
|
|
3325
|
+
let t = r.match(fi);
|
|
3326
|
+
if (!t) break;
|
|
3327
|
+
e = !!t[1], c = di(t[1]);
|
|
3328
|
+
let n = t[3].trim();
|
|
3329
|
+
s = n ? m(n) : void 0;
|
|
3330
|
+
let a = t[2], u = t[4];
|
|
3331
|
+
r = r.slice(t[0].length).trim(), i = Ai(a, u), l = di(u.slice(-1)), o = u.endsWith(">") || l !== void 0;
|
|
3332
|
+
}
|
|
3333
|
+
let _ = Ti(r, t, n);
|
|
3334
|
+
if (!_ || _.ids.length === 0) break;
|
|
3335
|
+
r = _.remaining.trim();
|
|
3336
|
+
for (let n of a) for (let r of _.ids) t.edges.push({
|
|
3337
|
+
source: n,
|
|
3338
|
+
target: r,
|
|
3339
|
+
label: s,
|
|
3340
|
+
style: i,
|
|
3341
|
+
hasArrowStart: e,
|
|
3342
|
+
hasArrowEnd: o,
|
|
3343
|
+
...c === void 0 ? {} : { startMarker: c },
|
|
3344
|
+
...l === void 0 ? {} : { endMarker: l },
|
|
3345
|
+
...u === void 0 ? {} : { id: u }
|
|
3346
|
+
});
|
|
3347
|
+
a = _.ids;
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
function Ti(e, t, n) {
|
|
3351
|
+
let r = Ei(e, t, n);
|
|
3352
|
+
if (!r) return null;
|
|
3353
|
+
let i = [r.id], a = r.remaining.trim();
|
|
3354
|
+
for (; a.startsWith("&");) {
|
|
3355
|
+
a = a.slice(1).trim();
|
|
3356
|
+
let e = Ei(a, t, n);
|
|
3357
|
+
if (!e) break;
|
|
3358
|
+
i.push(e.id), a = e.remaining.trim();
|
|
3359
|
+
}
|
|
3360
|
+
return {
|
|
3361
|
+
ids: i,
|
|
3362
|
+
remaining: a
|
|
3363
|
+
};
|
|
3364
|
+
}
|
|
3365
|
+
function Ei(e, t, n) {
|
|
3366
|
+
let r = null, i = e, a, o = i.match(Ci);
|
|
3367
|
+
o && (a = o[2], i = o[1] + i.slice(o[0].length));
|
|
3368
|
+
let s = i.match(hi);
|
|
3369
|
+
if (s) {
|
|
3370
|
+
let e = s[1], a = ie(i.slice(e.length));
|
|
3371
|
+
if (a) {
|
|
3372
|
+
let o = se(a.body);
|
|
3373
|
+
Di(t, n, {
|
|
3374
|
+
id: e,
|
|
3375
|
+
label: m(_i(e, o)),
|
|
3376
|
+
shape: gi(o)
|
|
3377
|
+
}), r = e, i = i.slice(e.length + a.length);
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
if (r === null) for (let { regex: e, shape: a } of pi) {
|
|
3381
|
+
let o = i.match(e);
|
|
3382
|
+
if (o) {
|
|
3383
|
+
r = o[1];
|
|
3384
|
+
let e = m(o[2]), s = typeof a == "function" ? a(o[3] ?? "") : a;
|
|
3385
|
+
Di(t, n, {
|
|
3386
|
+
id: r,
|
|
3387
|
+
label: e,
|
|
3388
|
+
shape: s
|
|
3389
|
+
}), i = i.slice(o[0].length);
|
|
3390
|
+
break;
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
if (r === null) {
|
|
3394
|
+
let e = i.match(mi);
|
|
3395
|
+
e && (r = e[1], t.nodes.has(r) || Di(t, n, {
|
|
3396
|
+
id: r,
|
|
3397
|
+
label: r,
|
|
3398
|
+
shape: "rectangle"
|
|
3399
|
+
}), i = i.slice(e[0].length));
|
|
3400
|
+
}
|
|
3401
|
+
if (r === null) return null;
|
|
3402
|
+
a && t.classAssignments.set(r, a);
|
|
3403
|
+
let c = i.match(Si);
|
|
3404
|
+
return c && (t.classAssignments.set(r, c[1]), i = i.slice(c[0].length)), {
|
|
3405
|
+
id: r,
|
|
3406
|
+
remaining: i
|
|
3407
|
+
};
|
|
3408
|
+
}
|
|
3409
|
+
function Di(e, t, n) {
|
|
3410
|
+
e.nodes.has(n.id) || e.nodes.set(n.id, n), Oi(t, n.id);
|
|
3411
|
+
}
|
|
3412
|
+
function Oi(e, t) {
|
|
3413
|
+
if (e.length > 0) {
|
|
3414
|
+
let n = e[e.length - 1];
|
|
3415
|
+
n.nodeIds.includes(t) || n.nodeIds.push(t);
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
function ki(e) {
|
|
3419
|
+
return e.startsWith("~") ? "invisible" : e.includes(".") ? "dotted" : e.startsWith("=") ? "thick" : "solid";
|
|
3420
|
+
}
|
|
3421
|
+
function Ai(e, t) {
|
|
3422
|
+
return e.includes(".") || t.includes(".") ? "dotted" : e.startsWith("=") || t.startsWith("=") ? "thick" : "solid";
|
|
3423
|
+
}
|
|
3424
|
+
//#endregion
|
|
3425
|
+
//#region packages/svg-renderer/src/registry.ts
|
|
3426
|
+
var ji = {
|
|
3427
|
+
type: "xychart",
|
|
3428
|
+
parse: le,
|
|
3429
|
+
layoutForSvg: Pr,
|
|
3430
|
+
renderSvg(e, t, n) {
|
|
3431
|
+
let r = n.interactivity === void 0 ? n.interactive ?? !1 : n.interactivity === "full";
|
|
3432
|
+
return Gr(e, t.colors, t.font, t.transparent, r, t.embedSource, t.title, t.decorative, t.emit);
|
|
3433
|
+
}
|
|
3434
|
+
}, Mi = {
|
|
3435
|
+
type: "sequence",
|
|
3436
|
+
parse: ce,
|
|
3437
|
+
layoutForSvg: xr,
|
|
3438
|
+
renderSvg(e, t) {
|
|
3439
|
+
return Sr(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
3440
|
+
}
|
|
3441
|
+
};
|
|
3442
|
+
function Ni(e) {
|
|
3443
|
+
return (e.interactivity ?? "static") !== "none";
|
|
3444
|
+
}
|
|
3445
|
+
function Pi(e) {
|
|
3446
|
+
return (e.interactivity ?? "static") === "full";
|
|
3447
|
+
}
|
|
3448
|
+
var Fi = {
|
|
3449
|
+
xychart: ji,
|
|
3450
|
+
er: {
|
|
3451
|
+
type: "er",
|
|
3452
|
+
parse: oe,
|
|
3453
|
+
layoutForSvg(e, t) {
|
|
3454
|
+
return lr(ee(e, t.direction), t);
|
|
3455
|
+
},
|
|
3456
|
+
renderSvg(e, t) {
|
|
3457
|
+
return ur(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
3458
|
+
}
|
|
3459
|
+
},
|
|
3460
|
+
sequence: Mi,
|
|
3461
|
+
class: {
|
|
3462
|
+
type: "class",
|
|
3463
|
+
parse: ae,
|
|
3464
|
+
layoutForSvg: Gn,
|
|
3465
|
+
renderSvg(e, t, n) {
|
|
3466
|
+
return Jn(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, Ni(n), t.emit);
|
|
3467
|
+
}
|
|
3468
|
+
},
|
|
3469
|
+
flowchart: {
|
|
3470
|
+
type: "flowchart",
|
|
3471
|
+
parse: (e, t) => ii(t),
|
|
3472
|
+
layoutForSvg(e, t) {
|
|
3473
|
+
return {
|
|
3474
|
+
graph: Dt(ee(e, t.direction), t),
|
|
3475
|
+
curve: t.curve ?? e.initConfig?.curve ?? "linear"
|
|
3476
|
+
};
|
|
3477
|
+
},
|
|
3478
|
+
renderSvg(e, t, n) {
|
|
3479
|
+
return kt(e.graph, t.colors, t.font, t.transparent, t.fontSizes, e.curve, t.embedSource, Pi(n), Ni(n), t.title, t.decorative, t.emit);
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
};
|
|
3483
|
+
//#endregion
|
|
3484
|
+
//#region packages/svg-renderer/src/index.ts
|
|
3485
|
+
function Ii(e) {
|
|
3486
|
+
return {
|
|
3487
|
+
bg: e.bg ?? t.bg,
|
|
3488
|
+
fg: e.fg ?? t.fg,
|
|
3489
|
+
line: e.line,
|
|
3490
|
+
accent: e.accent,
|
|
3491
|
+
muted: e.muted,
|
|
3492
|
+
surface: e.surface,
|
|
3493
|
+
border: e.border
|
|
3494
|
+
};
|
|
3495
|
+
}
|
|
3496
|
+
function Li(e = {}) {
|
|
3497
|
+
return D(Ii(e), e.transparent);
|
|
3498
|
+
}
|
|
3499
|
+
function Ri(e) {
|
|
3500
|
+
return {
|
|
3501
|
+
nonce: e.nonce,
|
|
3502
|
+
styleAttribute: e.styleAttribute
|
|
3503
|
+
};
|
|
3504
|
+
}
|
|
3505
|
+
function zi(e, t = {}) {
|
|
3506
|
+
let n = Bi(e, t);
|
|
3507
|
+
return t.resolveColors ? Bn(n, Ii(t)) : n;
|
|
3508
|
+
}
|
|
3509
|
+
function Bi(e, t) {
|
|
3510
|
+
let n = de(e), r = Ii(t), a = t.font ?? "Inter";
|
|
3511
|
+
S(u(a));
|
|
3512
|
+
let o = t.transparent ?? !1, s = P(t.fontSizes), c = i(n), l = t.embedSource ? e : void 0, d = t.title, f = t.decorative, p = Ri(t), m = C(n), h = Fi[c], g = h.parse(m, n), _ = h.layoutForSvg(g, t), v = {
|
|
3513
|
+
colors: r,
|
|
3514
|
+
font: a,
|
|
3515
|
+
transparent: o,
|
|
3516
|
+
fontSizes: s,
|
|
3517
|
+
embedSource: l,
|
|
3518
|
+
title: d,
|
|
3519
|
+
decorative: f,
|
|
3520
|
+
emit: p
|
|
3521
|
+
};
|
|
3522
|
+
return h.renderSvg(_, v, t);
|
|
3523
|
+
}
|
|
3524
|
+
async function Vi(e, t = {}) {
|
|
3525
|
+
return zi(e, t);
|
|
3526
|
+
}
|
|
3527
|
+
var Hi = zi, Ui = Vi;
|
|
3528
|
+
//#endregion
|
|
3529
|
+
export { z as ARROW_HEAD, W as CLS, Ae as ELK_DIRECTION_FALLBACK, N as FONT_SIZES, F as FONT_WEIGHTS, Oe as GROUP_HEADER_CONTENT_PAD, Pe as INLINE_CENTERED_EDGE_LABEL, Ee as MONO_FONT, De as MONO_FONT_STACK, I as NODE_PADDING, L as STROKE_WIDTHS, R as TEXT_BASELINE_SHIFT, Ne as baseElkLayoutOptions, yr as boxLabelHeight, V as buildElkEdge, Fe as buildElkEdgeLabel, B as buildElkLeafNode, Vn as classNoteId, Xe as clipEdgeToShape, Ot as convertToElkFormat, xe as createLayoutCache, je as directionToElk, we as elkLayoutSync, Me as elkPadding, Te as estimateMonoTextWidth, M as estimateTextWidth, Pn as evaluateCssColorValue, st as extractEdgeLabelPosition, ot as extractEdgePoints, Gn as layoutClassDiagramSync, lr as layoutErDiagramSync, Dt as layoutGraphSync, xr as layoutSequenceDiagram, Pr as layoutXYChart, _e as pointsToPath, Jn as renderClassSvg, ur as renderErSvg, Ui as renderMermaid, zi as renderMermaidSVG, Vi as renderMermaidSVGAsync, Hi as renderMermaidSync, Sr as renderSequenceSvg, kt as renderSvg, Gr as renderXYChartSvg, Bn as resolveCssColors, P as resolveFontSizes, Li as themeCssVariables, U as withDataSrc };
|
|
2993
3530
|
|
|
2994
3531
|
//# sourceMappingURL=index.js.map
|