@zombie-mermaid/svg-renderer 3.0.0 → 3.2.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/dist/index.cjs +49 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +1611 -1118
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/c4-mermaid-reference.test.ts +85 -0
- package/src/__tests__/c4-svg.test.ts +337 -0
- package/src/__tests__/class-diamond-markers-1232.test.ts +59 -0
- package/src/__tests__/er-cardinality-markers-1233.test.ts +35 -0
- package/src/__tests__/fixtures/c4-mermaid-reference.json +626 -0
- package/src/__tests__/xychart-smooth-curve.test.ts +42 -0
- package/src/c4/layout.ts +490 -0
- package/src/c4/metrics.ts +235 -0
- package/src/c4/renderer.ts +366 -0
- package/src/class/renderer.ts +72 -68
- package/src/edge-curves.ts +17 -16
- package/src/er/renderer.ts +64 -50
- package/src/layout-engine/elk-graph-builder.ts +4 -0
- package/src/registry.ts +60 -0
- package/src/renderer.ts +190 -189
- package/src/sequence/renderer.ts +66 -65
- package/src/xychart/layout.ts +27 -11
- package/src/xychart/renderer.ts +33 -42
package/dist/index.js
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import { CHART_ACCENT_FALLBACK as
|
|
4
|
-
import { decodeXML as
|
|
1
|
+
import { DEFAULTS as e, applyClickStatement as t, buildStyleBlock as n, detectDiagramType as r, escapeAttr as i, escapeXml as a, extractInitConfig as o, f 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";
|
|
2
|
+
import te from "elkjs/lib/elk.bundled.js";
|
|
3
|
+
import { CHART_ACCENT_FALLBACK as ne, architectureToGraph as re, c4BoundaryTypeLine as ie, c4RelLabelLines as ae, c4TypeLine as oe, formatClassMember as se, getSeriesColor as ce, matchExpandedBlock as le, parseArchitecture as ue, parseC4Diagram as de, parseClassDiagram as fe, parseErDiagram as pe, parseExpandedMeta as me, parseSequenceDiagram as he, parseXYChart as ge, resolveShapeName as _e } from "@zombie-mermaid/mermaid-parser";
|
|
4
|
+
import { decodeXML as ve } from "entities";
|
|
5
5
|
//#region packages/svg-renderer/src/edge-curves.ts
|
|
6
|
-
function
|
|
7
|
-
return `M ${e.x} ${e.y}`;
|
|
6
|
+
function ye(e) {
|
|
7
|
+
return s`M ${e.x} ${e.y}`;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function be(e) {
|
|
10
|
+
return ye(e[0]) + e.slice(1).map((e) => s` L ${e.x} ${e.y}`).join("");
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
if (e.length < 3) return
|
|
14
|
-
let t = e[e.length - 1], n = [
|
|
15
|
-
n.push(` L ${(5 * e[0].x + e[1].x) / 6} ${(5 * e[0].y + e[1].y) / 6}`);
|
|
12
|
+
function xe(e) {
|
|
13
|
+
if (e.length < 3) return be(e);
|
|
14
|
+
let t = e[e.length - 1], n = [ye(e[0])], r = (e, t, n) => s` C ${(2 * e.x + t.x) / 3} ${(2 * e.y + t.y) / 3},` + s` ${(e.x + 2 * t.x) / 3} ${(e.y + 2 * t.y) / 3},` + s` ${(e.x + 4 * t.x + n.x) / 6} ${(e.y + 4 * t.y + n.y) / 6}`;
|
|
15
|
+
n.push(s` L ${(5 * e[0].x + e[1].x) / 6}` + s` ${(5 * e[0].y + e[1].y) / 6}`);
|
|
16
16
|
for (let t = 2; t < e.length; t++) n.push(r(e[t - 2], e[t - 1], e[t]));
|
|
17
|
-
return n.push(r(e[e.length - 2], t, t)), n.push(` L ${t.x} ${t.y}`), n.join("");
|
|
17
|
+
return n.push(r(e[e.length - 2], t, t)), n.push(s` L ${t.x} ${t.y}`), n.join("");
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
if (e.length < 3) return
|
|
21
|
-
let t = [
|
|
19
|
+
function Se(e) {
|
|
20
|
+
if (e.length < 3) return be(e);
|
|
21
|
+
let t = [ye(e[0])];
|
|
22
22
|
for (let n = 1; n < e.length - 1; n++) {
|
|
23
|
-
let r = e[n - 1], i = e[n], a = e[n + 1], o = Math.hypot(i.x - r.x, i.y - r.y),
|
|
24
|
-
if (o === 0 ||
|
|
25
|
-
t.push(` L ${i.x} ${i.y}`);
|
|
23
|
+
let r = e[n - 1], i = e[n], a = e[n + 1], o = Math.hypot(i.x - r.x, i.y - r.y), c = Math.hypot(a.x - i.x, a.y - i.y);
|
|
24
|
+
if (o === 0 || c === 0) {
|
|
25
|
+
t.push(s` L ${i.x} ${i.y}`);
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
|
-
let
|
|
29
|
-
t.push(` L ${
|
|
28
|
+
let l = Math.min(12, o / 2, c / 2), u = i.x - (i.x - r.x) / o * l, d = i.y - (i.y - r.y) / o * l, f = i.x + (a.x - i.x) / c * l, p = i.y + (a.y - i.y) / c * l;
|
|
29
|
+
t.push(s` L ${u} ${d}`), t.push(s` Q ${i.x} ${i.y}, ${f} ${p}`);
|
|
30
30
|
}
|
|
31
31
|
let n = e[e.length - 1];
|
|
32
|
-
return t.push(` L ${n.x} ${n.y}`), t.join("");
|
|
32
|
+
return t.push(s` L ${n.x} ${n.y}`), t.join("");
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
let n = [
|
|
34
|
+
function Ce(e, t) {
|
|
35
|
+
let n = [ye(e[0])], r = e.length - 1;
|
|
36
36
|
for (let i = 0; i < r; i++) {
|
|
37
37
|
let a = e[i], o = e[i + 1];
|
|
38
38
|
if (i === r - 1) {
|
|
39
|
-
n.push(` L ${o.x} ${o.y}`);
|
|
39
|
+
n.push(s` L ${o.x} ${o.y}`);
|
|
40
40
|
break;
|
|
41
41
|
}
|
|
42
|
-
if (t === "before") n.push(` L ${a.x} ${o.y} L ${o.x} ${o.y}`);
|
|
43
|
-
else if (t === "after") n.push(` L ${o.x} ${a.y} L ${o.x} ${o.y}`);
|
|
42
|
+
if (t === "before") n.push(s` L ${a.x} ${o.y} L ${o.x} ${o.y}`);
|
|
43
|
+
else if (t === "after") n.push(s` L ${o.x} ${a.y} L ${o.x} ${o.y}`);
|
|
44
44
|
else {
|
|
45
45
|
let e = (a.y + o.y) / 2;
|
|
46
|
-
n.push(` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`);
|
|
46
|
+
n.push(s` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
return n.join("");
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function we(e, t = "linear") {
|
|
52
52
|
if (e.length === 0) return "";
|
|
53
|
-
if (e.length === 1) return
|
|
53
|
+
if (e.length === 1) return ye(e[0]);
|
|
54
54
|
switch (t) {
|
|
55
|
-
case "basis": return
|
|
56
|
-
case "natural": return
|
|
57
|
-
case "step": return
|
|
58
|
-
case "stepBefore": return
|
|
59
|
-
case "stepAfter": return
|
|
60
|
-
default: return
|
|
55
|
+
case "basis": return xe(e);
|
|
56
|
+
case "natural": return Se(e);
|
|
57
|
+
case "step": return Ce(e, "mid");
|
|
58
|
+
case "stepBefore": return Ce(e, "before");
|
|
59
|
+
case "stepAfter": return Ce(e, "after");
|
|
60
|
+
default: return be(e);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
//#endregion
|
|
64
64
|
//#region packages/svg-renderer/src/elk-instance.ts
|
|
65
|
-
var
|
|
66
|
-
function
|
|
65
|
+
var Te = null, Ee = null, De = 20;
|
|
66
|
+
function Oe(e = De) {
|
|
67
67
|
if (!Number.isInteger(e) || e < 1) throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);
|
|
68
68
|
return {
|
|
69
69
|
map: /* @__PURE__ */ new Map(),
|
|
70
70
|
maxSize: e
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
if (Array.isArray(e)) return `[${e.map(
|
|
73
|
+
function ke(e) {
|
|
74
|
+
if (Array.isArray(e)) return `[${e.map(ke).join(",")}]`;
|
|
75
75
|
if (typeof e == "object" && e) {
|
|
76
76
|
let t = e;
|
|
77
|
-
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${
|
|
77
|
+
return `{${Object.keys(t).sort().map((e) => `${JSON.stringify(e)}:${ke(t[e])}`).join(",")}}`;
|
|
78
78
|
}
|
|
79
79
|
return JSON.stringify(e);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
if (
|
|
83
|
-
let
|
|
84
|
-
globalThis.setTimeout = (
|
|
85
|
-
let
|
|
86
|
-
if (
|
|
87
|
-
return
|
|
81
|
+
function Ae() {
|
|
82
|
+
if (Te && Ee) return Ee;
|
|
83
|
+
let e = [], t = globalThis.setTimeout;
|
|
84
|
+
globalThis.setTimeout = (n, r) => r === 0 ? (e.push(n), 0) : t(n, r);
|
|
85
|
+
let n = globalThis, r = "self" in n, i = n.self;
|
|
86
|
+
if (r && n.document === void 0 && delete n.self, Te = new te(), !Te) throw Error("ELKBundled construction unexpectedly produced no instance");
|
|
87
|
+
return r && (n.self = i), globalThis.setTimeout = t, e.forEach((e) => e()), Ee = Te.worker.worker, Ee;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
let n = t, r = n ?
|
|
89
|
+
function je(e, t) {
|
|
90
|
+
let n = t, r = n ? ke(e) : void 0;
|
|
91
91
|
if (n && r !== void 0) {
|
|
92
92
|
let e = n.map.get(r);
|
|
93
93
|
if (e) return n.map.delete(r), n.map.set(r, e), e;
|
|
94
94
|
}
|
|
95
|
-
let i =
|
|
95
|
+
let i = Ae(), a, o, s = i.onmessage;
|
|
96
96
|
if (i.onmessage = (e) => {
|
|
97
97
|
e.data.error ? o = e.data.error : a = e.data.data;
|
|
98
98
|
}, i.dispatcher.saveDispatch({ data: {
|
|
@@ -112,10 +112,10 @@ function we(e, t) {
|
|
|
112
112
|
function M(e, t, n) {
|
|
113
113
|
return f(e, t, n);
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function Me(e, t) {
|
|
116
116
|
return e.length * t * .6;
|
|
117
117
|
}
|
|
118
|
-
var
|
|
118
|
+
var Ne = "'JetBrains Mono'", Pe = `${Ne}, 'SF Mono', 'Fira Code', ui-monospace, monospace`, N = {
|
|
119
119
|
nodeLabel: 13,
|
|
120
120
|
edgeLabel: 11,
|
|
121
121
|
groupHeader: 12
|
|
@@ -131,7 +131,7 @@ var F = {
|
|
|
131
131
|
nodeLabel: 500,
|
|
132
132
|
edgeLabel: 400,
|
|
133
133
|
groupHeader: 600
|
|
134
|
-
},
|
|
134
|
+
}, Fe = 12, I = {
|
|
135
135
|
horizontal: 20,
|
|
136
136
|
vertical: 10,
|
|
137
137
|
diamondExtra: 24
|
|
@@ -142,7 +142,7 @@ var F = {
|
|
|
142
142
|
}, R = "0.35em", z = {
|
|
143
143
|
width: 8,
|
|
144
144
|
height: 5
|
|
145
|
-
},
|
|
145
|
+
}, Ie = {
|
|
146
146
|
font: "Inter",
|
|
147
147
|
padding: 40,
|
|
148
148
|
nodeSpacing: 28,
|
|
@@ -150,13 +150,14 @@ var F = {
|
|
|
150
150
|
mergeEdges: !0,
|
|
151
151
|
thoroughness: 3,
|
|
152
152
|
fontSizes: N
|
|
153
|
-
},
|
|
153
|
+
}, Le = {
|
|
154
154
|
flowchart: "DOWN",
|
|
155
155
|
state: "DOWN",
|
|
156
156
|
class: "DOWN",
|
|
157
|
-
er: "RIGHT"
|
|
157
|
+
er: "RIGHT",
|
|
158
|
+
c4: "DOWN"
|
|
158
159
|
};
|
|
159
|
-
function
|
|
160
|
+
function Re(e, t) {
|
|
160
161
|
switch (e) {
|
|
161
162
|
case "LR": return "RIGHT";
|
|
162
163
|
case "RL": return "LEFT";
|
|
@@ -166,7 +167,7 @@ function je(e, t) {
|
|
|
166
167
|
default: return t;
|
|
167
168
|
}
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
+
function ze(e) {
|
|
170
171
|
let t = typeof e == "number" ? {
|
|
171
172
|
top: e,
|
|
172
173
|
left: e,
|
|
@@ -175,17 +176,17 @@ function Me(e) {
|
|
|
175
176
|
} : e;
|
|
176
177
|
return `[top=${t.top},left=${t.left},bottom=${t.bottom},right=${t.right}]`;
|
|
177
178
|
}
|
|
178
|
-
function
|
|
179
|
+
function Be(e) {
|
|
179
180
|
return {
|
|
180
181
|
"elk.algorithm": "layered",
|
|
181
182
|
"elk.direction": e.direction,
|
|
182
183
|
"elk.spacing.nodeNode": String(e.nodeSpacing),
|
|
183
184
|
"elk.layered.spacing.nodeNodeBetweenLayers": String(e.layerSpacing),
|
|
184
|
-
"elk.padding":
|
|
185
|
+
"elk.padding": ze(e.padding),
|
|
185
186
|
"elk.edgeRouting": "ORTHOGONAL"
|
|
186
187
|
};
|
|
187
188
|
}
|
|
188
|
-
function
|
|
189
|
+
function Ve(e, t, n) {
|
|
189
190
|
let r = {
|
|
190
191
|
id: e,
|
|
191
192
|
width: t.width,
|
|
@@ -193,11 +194,11 @@ function B(e, t, n) {
|
|
|
193
194
|
};
|
|
194
195
|
return n !== void 0 && (r.labels = [{ text: n }]), r;
|
|
195
196
|
}
|
|
196
|
-
var
|
|
197
|
+
var He = {
|
|
197
198
|
"elk.edgeLabels.inline": "true",
|
|
198
199
|
"elk.edgeLabels.placement": "CENTER"
|
|
199
200
|
};
|
|
200
|
-
function
|
|
201
|
+
function Ue(e, t) {
|
|
201
202
|
let n = d(e, t.fontSize, F.edgeLabel), r = {
|
|
202
203
|
text: e,
|
|
203
204
|
width: n.width + 8,
|
|
@@ -205,22 +206,22 @@ function Fe(e, t) {
|
|
|
205
206
|
};
|
|
206
207
|
return t.layoutOptions && (r.layoutOptions = { ...t.layoutOptions }), r;
|
|
207
208
|
}
|
|
208
|
-
function
|
|
209
|
+
function B(e) {
|
|
209
210
|
let t = {
|
|
210
211
|
id: e.id,
|
|
211
212
|
sources: [e.source],
|
|
212
213
|
targets: [e.target]
|
|
213
214
|
};
|
|
214
|
-
return e.label && (t.labels = [
|
|
215
|
+
return e.label && (t.labels = [Ue(e.label, e.labelStyle)]), t;
|
|
215
216
|
}
|
|
216
217
|
//#endregion
|
|
217
218
|
//#region packages/svg-renderer/src/layout-engine/to-elk.ts
|
|
218
|
-
function
|
|
219
|
-
return
|
|
219
|
+
function We(e) {
|
|
220
|
+
return Re(e, Le.flowchart);
|
|
220
221
|
}
|
|
221
|
-
function
|
|
222
|
+
function Ge(e) {
|
|
222
223
|
return {
|
|
223
|
-
...
|
|
224
|
+
...Be(e),
|
|
224
225
|
"elk.spacing.edgeEdge": "12",
|
|
225
226
|
"elk.layered.spacing.edgeEdgeBetweenLayers": "12",
|
|
226
227
|
"elk.layered.spacing.edgeNodeBetweenLayers": "12",
|
|
@@ -228,13 +229,13 @@ function Le(e) {
|
|
|
228
229
|
"elk.contentAlignment": "H_CENTER V_CENTER"
|
|
229
230
|
};
|
|
230
231
|
}
|
|
231
|
-
function
|
|
232
|
+
function Ke(e) {
|
|
232
233
|
return {
|
|
233
234
|
fontSize: e.fontSizes.edgeLabel,
|
|
234
|
-
layoutOptions:
|
|
235
|
+
layoutOptions: He
|
|
235
236
|
};
|
|
236
237
|
}
|
|
237
|
-
function
|
|
238
|
+
function qe(e, t, n, r) {
|
|
238
239
|
let i = d(t, r, F.nodeLabel), a = i.width + I.horizontal * 2, o = i.height + I.vertical * 2;
|
|
239
240
|
if (n === "diamond") {
|
|
240
241
|
let e = Math.max(a, o) + I.diamondExtra;
|
|
@@ -252,22 +253,22 @@ function ze(e, t, n, r) {
|
|
|
252
253
|
height: o
|
|
253
254
|
});
|
|
254
255
|
}
|
|
255
|
-
var
|
|
256
|
-
function
|
|
257
|
-
for (let t of e) if (t.direction !== void 0 ||
|
|
256
|
+
var Je = " root";
|
|
257
|
+
function Ye(e) {
|
|
258
|
+
for (let t of e) if (t.direction !== void 0 || Ye(t.children)) return !0;
|
|
258
259
|
return !1;
|
|
259
260
|
}
|
|
260
|
-
function
|
|
261
|
+
function Xe(e, t) {
|
|
261
262
|
for (let n of e.nodeIds) t.add(n);
|
|
262
|
-
for (let n of e.children)
|
|
263
|
+
for (let n of e.children) Xe(n, t);
|
|
263
264
|
}
|
|
264
|
-
function
|
|
265
|
+
function Ze(e, t) {
|
|
265
266
|
let n = /* @__PURE__ */ new Set();
|
|
266
|
-
if (
|
|
267
|
+
if (Xe(e, n), n.size === 0) return !0;
|
|
267
268
|
let r = (t) => n.has(t) || t === e.id;
|
|
268
269
|
return !t.edges.some((e) => r(e.source) !== r(e.target));
|
|
269
270
|
}
|
|
270
|
-
function
|
|
271
|
+
function Qe(e) {
|
|
271
272
|
let t = /* @__PURE__ */ new Map();
|
|
272
273
|
function n(e, r) {
|
|
273
274
|
let i = [...r, e.id];
|
|
@@ -277,15 +278,15 @@ function We(e) {
|
|
|
277
278
|
for (let t of e) n(t, []);
|
|
278
279
|
return t;
|
|
279
280
|
}
|
|
280
|
-
function
|
|
281
|
+
function $e(e, t) {
|
|
281
282
|
let n = 0;
|
|
282
283
|
for (; n < e.length && n < t.length && e[n] === t[n];) n++;
|
|
283
284
|
return n;
|
|
284
285
|
}
|
|
285
|
-
function
|
|
286
|
+
function et(e, t) {
|
|
286
287
|
let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
287
|
-
for (let t of e.subgraphs) r.add(t.id),
|
|
288
|
-
let i =
|
|
288
|
+
for (let t of e.subgraphs) r.add(t.id), nt(t, n, r);
|
|
289
|
+
let i = rt(e.subgraphs), a = Qe(e.subgraphs), o = (e) => e ? a.get(e) ?? [] : [], s = /* @__PURE__ */ new Map();
|
|
289
290
|
s.set(null, []);
|
|
290
291
|
let c = [];
|
|
291
292
|
for (let t = 0; t < e.edges.length; t++) {
|
|
@@ -306,14 +307,14 @@ function Ke(e, t) {
|
|
|
306
307
|
tgtChain: o(a)
|
|
307
308
|
});
|
|
308
309
|
}
|
|
309
|
-
let l =
|
|
310
|
-
...
|
|
311
|
-
direction:
|
|
310
|
+
let l = Ye(e.subgraphs), u = [], d = [], f = {
|
|
311
|
+
...Ge({
|
|
312
|
+
direction: We(e.direction),
|
|
312
313
|
nodeSpacing: t.nodeSpacing,
|
|
313
314
|
layerSpacing: t.layerSpacing,
|
|
314
315
|
padding: t.padding
|
|
315
316
|
}),
|
|
316
|
-
"elk.layered.thoroughness": String(
|
|
317
|
+
"elk.layered.thoroughness": String(Ie.thoroughness),
|
|
317
318
|
"elk.layered.highDegreeNodes.treatment": "true",
|
|
318
319
|
"elk.layered.highDegreeNodes.threshold": "8",
|
|
319
320
|
"elk.layered.compaction.postCompaction.strategy": "LEFT_RIGHT_CONSTRAINT_LOCKING",
|
|
@@ -330,7 +331,7 @@ function Ke(e, t) {
|
|
|
330
331
|
m.set(e, n), n.push(t);
|
|
331
332
|
}
|
|
332
333
|
if (l) for (let { index: e, edge: n, srcChain: r, tgtChain: i } of c) {
|
|
333
|
-
let a =
|
|
334
|
+
let a = $e(r, i), o = n.source;
|
|
334
335
|
if (r.length > a) {
|
|
335
336
|
for (let t = r.length - 1; t >= a; t--) {
|
|
336
337
|
let i = r[t], a = `${i}_out_${e}`;
|
|
@@ -358,33 +359,33 @@ function Ke(e, t) {
|
|
|
358
359
|
}
|
|
359
360
|
s = `${i[a]}_in_${e}`;
|
|
360
361
|
}
|
|
361
|
-
g(a > 0 ? r[a - 1] :
|
|
362
|
+
g(a > 0 ? r[a - 1] : Je, B({
|
|
362
363
|
id: `e${e}`,
|
|
363
364
|
source: o,
|
|
364
365
|
target: s,
|
|
365
366
|
label: n.label,
|
|
366
|
-
labelStyle:
|
|
367
|
+
labelStyle: Ke(t)
|
|
367
368
|
}));
|
|
368
369
|
}
|
|
369
370
|
for (let [i, a] of e.nodes) if (!n.has(i) && !r.has(i)) {
|
|
370
|
-
let e =
|
|
371
|
-
u.push(
|
|
371
|
+
let e = qe(i, a.label, a.shape, t.fontSizes.nodeLabel);
|
|
372
|
+
u.push(Ve(i, e, a.label));
|
|
372
373
|
}
|
|
373
|
-
for (let n of [...e.subgraphs].reverse()) u.push(
|
|
374
|
-
for (let { index: e, edge: n } of s.get(null)) n.source !== n.target && d.push(
|
|
374
|
+
for (let n of [...e.subgraphs].reverse()) u.push(tt(n, e, t, s, p, m, e.direction));
|
|
375
|
+
for (let { index: e, edge: n } of s.get(null)) n.source !== n.target && d.push(B({
|
|
375
376
|
id: `e${e}`,
|
|
376
377
|
source: n.source,
|
|
377
378
|
target: n.target,
|
|
378
379
|
label: n.label,
|
|
379
|
-
labelStyle:
|
|
380
|
+
labelStyle: Ke(t)
|
|
380
381
|
}));
|
|
381
|
-
if (l) for (let e of m.get(
|
|
382
|
-
else for (let { index: e, edge: n } of c) d.push(
|
|
382
|
+
if (l) for (let e of m.get(Je) ?? []) d.push(e);
|
|
383
|
+
else for (let { index: e, edge: n } of c) d.push(B({
|
|
383
384
|
id: `e${e}`,
|
|
384
385
|
source: n.source,
|
|
385
386
|
target: n.target,
|
|
386
387
|
label: n.label,
|
|
387
|
-
labelStyle:
|
|
388
|
+
labelStyle: Ke(t)
|
|
388
389
|
}));
|
|
389
390
|
return {
|
|
390
391
|
id: "root",
|
|
@@ -393,9 +394,9 @@ function Ke(e, t) {
|
|
|
393
394
|
edges: d
|
|
394
395
|
};
|
|
395
396
|
}
|
|
396
|
-
function
|
|
397
|
-
let s = e.direction !== void 0 &&
|
|
398
|
-
direction:
|
|
397
|
+
function tt(e, t, n, r, i, a, o) {
|
|
398
|
+
let s = e.direction !== void 0 && Ze(e, t) ? e.direction : o, c = Ge({
|
|
399
|
+
direction: We(s),
|
|
399
400
|
nodeSpacing: n.nodeSpacing,
|
|
400
401
|
layerSpacing: n.layerSpacing,
|
|
401
402
|
padding: {
|
|
@@ -410,18 +411,18 @@ function qe(e, t, n, r, i, a, o) {
|
|
|
410
411
|
for (let r of e.nodeIds) {
|
|
411
412
|
let e = t.nodes.get(r);
|
|
412
413
|
if (e) {
|
|
413
|
-
let t =
|
|
414
|
-
d.push(
|
|
414
|
+
let t = qe(r, e.label, e.shape, n.fontSizes.nodeLabel);
|
|
415
|
+
d.push(Ve(r, t, e.label));
|
|
415
416
|
}
|
|
416
417
|
}
|
|
417
|
-
for (let o of [...e.children].reverse()) d.push(
|
|
418
|
+
for (let o of [...e.children].reverse()) d.push(tt(o, t, n, r, i, a, s));
|
|
418
419
|
let f = [], p = r.get(e.id) ?? [];
|
|
419
|
-
for (let { index: e, edge: t } of p) t.source !== t.target && f.push(
|
|
420
|
+
for (let { index: e, edge: t } of p) t.source !== t.target && f.push(B({
|
|
420
421
|
id: `e${e}`,
|
|
421
422
|
source: t.source,
|
|
422
423
|
target: t.target,
|
|
423
424
|
label: t.label,
|
|
424
|
-
labelStyle:
|
|
425
|
+
labelStyle: Ke(n)
|
|
425
426
|
}));
|
|
426
427
|
for (let t of a.get(e.id) ?? []) f.push(t);
|
|
427
428
|
return {
|
|
@@ -433,11 +434,11 @@ function qe(e, t, n, r, i, a, o) {
|
|
|
433
434
|
edges: f
|
|
434
435
|
};
|
|
435
436
|
}
|
|
436
|
-
function
|
|
437
|
+
function nt(e, t, n) {
|
|
437
438
|
for (let n of e.nodeIds) t.add(n);
|
|
438
|
-
for (let r of e.children) n.add(r.id),
|
|
439
|
+
for (let r of e.children) n.add(r.id), nt(r, t, n);
|
|
439
440
|
}
|
|
440
|
-
function
|
|
441
|
+
function rt(e) {
|
|
441
442
|
let t = /* @__PURE__ */ new Map();
|
|
442
443
|
function n(e) {
|
|
443
444
|
for (let n of e.nodeIds) t.set(n, e.id);
|
|
@@ -448,19 +449,19 @@ function Ye(e) {
|
|
|
448
449
|
}
|
|
449
450
|
//#endregion
|
|
450
451
|
//#region packages/svg-renderer/src/shape-clipping.ts
|
|
451
|
-
function
|
|
452
|
+
function it(e, t, n) {
|
|
452
453
|
if (e.length < 2 || t.shape === "rectangle" || t.shape === "rounded" || t.shape === "stadium") return e;
|
|
453
454
|
let r = [...e];
|
|
454
455
|
if (t.shape === "diamond") {
|
|
455
|
-
if (n) r[0] =
|
|
456
|
+
if (n) r[0] = at(e[0], e[1], t);
|
|
456
457
|
else {
|
|
457
458
|
let n = e.length - 1;
|
|
458
|
-
r[n] =
|
|
459
|
+
r[n] = at(e[n], e[n - 1], t);
|
|
459
460
|
}
|
|
460
461
|
}
|
|
461
462
|
return r;
|
|
462
463
|
}
|
|
463
|
-
function
|
|
464
|
+
function at(e, t, n) {
|
|
464
465
|
let r = n.x + n.width / 2, i = n.y + n.height / 2, a = {
|
|
465
466
|
x: r,
|
|
466
467
|
y: n.y
|
|
@@ -476,14 +477,14 @@ function Ze(e, t, n) {
|
|
|
476
477
|
}, l = e.x - t.x, u = e.y - t.y;
|
|
477
478
|
if (Math.abs(l) < Math.abs(u)) {
|
|
478
479
|
let t = e.x;
|
|
479
|
-
return u > 0 ? t <= r ?
|
|
480
|
+
return u > 0 ? t <= r ? st(t, c, a) ?? a : st(t, a, o) ?? a : t <= r ? st(t, s, c) ?? s : st(t, o, s) ?? s;
|
|
480
481
|
}
|
|
481
482
|
{
|
|
482
483
|
let t = e.y;
|
|
483
|
-
return l > 0 ? t <= i ?
|
|
484
|
+
return l > 0 ? t <= i ? ot(t, a, c) ?? c : ot(t, c, s) ?? c : t <= i ? ot(t, a, o) ?? o : ot(t, o, s) ?? o;
|
|
484
485
|
}
|
|
485
486
|
}
|
|
486
|
-
function
|
|
487
|
+
function ot(e, t, n) {
|
|
487
488
|
let r = n.y - t.y;
|
|
488
489
|
if (Math.abs(r) < .001) return null;
|
|
489
490
|
let i = (e - t.y) / r;
|
|
@@ -492,7 +493,7 @@ function Qe(e, t, n) {
|
|
|
492
493
|
y: e
|
|
493
494
|
};
|
|
494
495
|
}
|
|
495
|
-
function
|
|
496
|
+
function st(e, t, n) {
|
|
496
497
|
let r = n.x - t.x;
|
|
497
498
|
if (Math.abs(r) < .001) return null;
|
|
498
499
|
let i = (e - t.x) / r;
|
|
@@ -503,11 +504,11 @@ function $e(e, t, n) {
|
|
|
503
504
|
}
|
|
504
505
|
//#endregion
|
|
505
506
|
//#region packages/svg-renderer/src/layout-engine/layer-alignment.ts
|
|
506
|
-
function
|
|
507
|
+
function ct(e, t, n) {
|
|
507
508
|
if (e.length === 0) return;
|
|
508
509
|
let r = n === "LR" || n === "RL", i = /* @__PURE__ */ new Set();
|
|
509
510
|
for (let e of t) i.add(`${e.source}:${e.target}`), i.add(`${e.target}:${e.source}`);
|
|
510
|
-
let a =
|
|
511
|
+
let a = Ie.layerSpacing * .6, o = [...e].sort((e, t) => r ? e.x - t.x : e.y - t.y), s = [], c = [o[0]];
|
|
511
512
|
for (let e = 1; e < o.length; e++) {
|
|
512
513
|
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}`));
|
|
513
514
|
t <= a && !n ? c.push(o[e]) : (s.push(c), c = [o[e]]);
|
|
@@ -547,28 +548,28 @@ function et(e, t, n) {
|
|
|
547
548
|
}
|
|
548
549
|
//#endregion
|
|
549
550
|
//#region packages/svg-renderer/src/layout-engine/edge-bundling.ts
|
|
550
|
-
var
|
|
551
|
-
function
|
|
551
|
+
var lt = .5;
|
|
552
|
+
function ut(e, t, n) {
|
|
552
553
|
for (let r = 0; r < e.length - 1; r++) {
|
|
553
554
|
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);
|
|
554
555
|
for (let e of t) {
|
|
555
556
|
if (n.has(e.id)) continue;
|
|
556
|
-
let t = e.x +
|
|
557
|
+
let t = e.x + lt, r = e.x + e.width - lt, i = e.y + lt, a = e.y + e.height - lt;
|
|
557
558
|
if (!(t >= r || i >= a) && o < r && s > t && c < a && l > i) return !1;
|
|
558
559
|
}
|
|
559
560
|
}
|
|
560
561
|
return !0;
|
|
561
562
|
}
|
|
562
|
-
function
|
|
563
|
+
function dt(e, t, n) {
|
|
563
564
|
let r = [];
|
|
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(...
|
|
565
|
+
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(...dt(e, t, i.children)));
|
|
565
566
|
return r;
|
|
566
567
|
}
|
|
567
|
-
function
|
|
568
|
-
let a = i === "LR", o = i === "RL", s = i === "BT", c = a || o, l = new Set(
|
|
568
|
+
function ft(e, t, n, r, i) {
|
|
569
|
+
let a = i === "LR", o = i === "RL", s = i === "BT", c = a || o, l = new Set(dt(t, n, r).map((e) => e.id)), u = dt(c ? e : t, c ? n : e, r).find((e) => !l.has(e.id));
|
|
569
570
|
return u ? a ? u.x - 12 : o ? u.x + u.width + 12 : s ? u.y + u.height + 12 : u.y - 12 : e;
|
|
570
571
|
}
|
|
571
|
-
function
|
|
572
|
+
function pt(e, t, n, r) {
|
|
572
573
|
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();
|
|
573
574
|
for (let t of e) {
|
|
574
575
|
if (t.source === t.target) continue;
|
|
@@ -593,7 +594,7 @@ function at(e, t, n, r) {
|
|
|
593
594
|
let m = f.x + f.width / 2, h = f.y + f.height / 2;
|
|
594
595
|
if (l) {
|
|
595
596
|
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;
|
|
596
|
-
c =
|
|
597
|
+
c = ft(c, m, h, n, r);
|
|
597
598
|
let l = [];
|
|
598
599
|
for (let { edge: n, node: r } of p) {
|
|
599
600
|
let a = o ? r.x : r.x + r.width, u = r.y + r.height / 2, d = [
|
|
@@ -614,7 +615,7 @@ function at(e, t, n, r) {
|
|
|
614
615
|
y: u
|
|
615
616
|
}
|
|
616
617
|
];
|
|
617
|
-
|
|
618
|
+
ut(d, t, /* @__PURE__ */ new Set([e, r.id])) && l.push({
|
|
618
619
|
edge: n,
|
|
619
620
|
points: d
|
|
620
621
|
});
|
|
@@ -623,7 +624,7 @@ function at(e, t, n, r) {
|
|
|
623
624
|
for (let { edge: e, points: t } of l) e.points = t, a.add(e);
|
|
624
625
|
} else {
|
|
625
626
|
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;
|
|
626
|
-
s =
|
|
627
|
+
s = ft(s, m, h, n, r);
|
|
627
628
|
let l = [];
|
|
628
629
|
for (let { edge: n, node: r } of p) {
|
|
629
630
|
let a = r.x + r.width / 2, u = c ? r.y + r.height : r.y, d = [
|
|
@@ -644,7 +645,7 @@ function at(e, t, n, r) {
|
|
|
644
645
|
y: u
|
|
645
646
|
}
|
|
646
647
|
];
|
|
647
|
-
|
|
648
|
+
ut(d, t, /* @__PURE__ */ new Set([e, r.id])) && l.push({
|
|
648
649
|
edge: n,
|
|
649
650
|
points: d
|
|
650
651
|
});
|
|
@@ -677,7 +678,7 @@ function at(e, t, n, r) {
|
|
|
677
678
|
let p = d.x + d.width / 2, m = d.y + d.height / 2;
|
|
678
679
|
if (l) {
|
|
679
680
|
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;
|
|
680
|
-
c =
|
|
681
|
+
c = ft(c, p, m, n, r);
|
|
681
682
|
let l = [];
|
|
682
683
|
for (let { edge: n, node: r } of f) {
|
|
683
684
|
let s = o ? r.x + r.width : r.x, u = r.y + r.height / 2, d = [
|
|
@@ -698,7 +699,7 @@ function at(e, t, n, r) {
|
|
|
698
699
|
y: a
|
|
699
700
|
}
|
|
700
701
|
];
|
|
701
|
-
|
|
702
|
+
ut(d, t, /* @__PURE__ */ new Set([r.id, e])) && l.push({
|
|
702
703
|
edge: n,
|
|
703
704
|
points: d
|
|
704
705
|
});
|
|
@@ -707,7 +708,7 @@ function at(e, t, n, r) {
|
|
|
707
708
|
for (let { edge: e, points: t } of l) e.points = t;
|
|
708
709
|
} else {
|
|
709
710
|
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;
|
|
710
|
-
s =
|
|
711
|
+
s = ft(s, p, m, n, r);
|
|
711
712
|
let l = [];
|
|
712
713
|
for (let { edge: n, node: r } of f) {
|
|
713
714
|
let o = r.x + r.width / 2, u = [
|
|
@@ -728,7 +729,7 @@ function at(e, t, n, r) {
|
|
|
728
729
|
y: a
|
|
729
730
|
}
|
|
730
731
|
];
|
|
731
|
-
|
|
732
|
+
ut(u, t, /* @__PURE__ */ new Set([r.id, e])) && l.push({
|
|
732
733
|
edge: n,
|
|
733
734
|
points: u
|
|
734
735
|
});
|
|
@@ -740,7 +741,7 @@ function at(e, t, n, r) {
|
|
|
740
741
|
}
|
|
741
742
|
//#endregion
|
|
742
743
|
//#region packages/svg-renderer/src/layout-engine/elk-adapter-utils.ts
|
|
743
|
-
function
|
|
744
|
+
function mt(e, t = 0, n = 0) {
|
|
744
745
|
let r = [];
|
|
745
746
|
if (!e.sections || e.sections.length === 0) return r;
|
|
746
747
|
let i = e.sections[0];
|
|
@@ -756,7 +757,7 @@ function ot(e, t = 0, n = 0) {
|
|
|
756
757
|
y: i.endPoint.y + n
|
|
757
758
|
}), r;
|
|
758
759
|
}
|
|
759
|
-
function
|
|
760
|
+
function ht(e, t = 0, n = 0) {
|
|
760
761
|
if (!e.labels || e.labels.length === 0) return;
|
|
761
762
|
let r = e.labels[0];
|
|
762
763
|
if (r.x != null && r.y != null) return {
|
|
@@ -766,11 +767,11 @@ function st(e, t = 0, n = 0) {
|
|
|
766
767
|
}
|
|
767
768
|
//#endregion
|
|
768
769
|
//#region packages/svg-renderer/src/layout-engine/from-elk.ts
|
|
769
|
-
var
|
|
770
|
-
function
|
|
771
|
-
let n = e.x + e.width, r = e.y + e.height / 2, i = Math.min(
|
|
772
|
-
for (let e = 0; e <=
|
|
773
|
-
let t = Math.PI * e /
|
|
770
|
+
var gt = 16, _t = 28, vt = 18, yt = 28, bt = 10;
|
|
771
|
+
function xt(e, t) {
|
|
772
|
+
let n = e.x + e.width, r = e.y + e.height / 2, i = Math.min(yt, e.height * .6) / 2, a = _t + t * vt, o = [];
|
|
773
|
+
for (let e = 0; e <= gt; e++) {
|
|
774
|
+
let t = Math.PI * e / gt;
|
|
774
775
|
o.push({
|
|
775
776
|
x: n + a * Math.sin(t),
|
|
776
777
|
y: r - i * Math.cos(t)
|
|
@@ -779,12 +780,12 @@ function pt(e, t) {
|
|
|
779
780
|
return {
|
|
780
781
|
points: o,
|
|
781
782
|
labelPosition: {
|
|
782
|
-
x: n + a +
|
|
783
|
+
x: n + a + bt,
|
|
783
784
|
y: r
|
|
784
785
|
}
|
|
785
786
|
};
|
|
786
787
|
}
|
|
787
|
-
function
|
|
788
|
+
function St(e, t, n) {
|
|
788
789
|
let r = /* @__PURE__ */ new Map();
|
|
789
790
|
for (let i = 0; i < e.edges.length; i++) {
|
|
790
791
|
let a = e.edges[i];
|
|
@@ -793,7 +794,7 @@ function mt(e, t, n) {
|
|
|
793
794
|
if (!o) continue;
|
|
794
795
|
let s = r.get(o.id) ?? 0;
|
|
795
796
|
r.set(o.id, s + 1);
|
|
796
|
-
let { points: c, labelPosition: l } =
|
|
797
|
+
let { points: c, labelPosition: l } = xt(o, s);
|
|
797
798
|
n.push({
|
|
798
799
|
source: a.source,
|
|
799
800
|
target: a.target,
|
|
@@ -803,38 +804,38 @@ function mt(e, t, n) {
|
|
|
803
804
|
hasArrowEnd: a.hasArrowEnd,
|
|
804
805
|
points: c,
|
|
805
806
|
labelPosition: a.label ? l : void 0,
|
|
806
|
-
inlineStyle:
|
|
807
|
+
inlineStyle: Pt(i, e),
|
|
807
808
|
id: a.id,
|
|
808
809
|
animate: a.animate
|
|
809
810
|
});
|
|
810
811
|
}
|
|
811
812
|
}
|
|
812
|
-
function
|
|
813
|
+
function Ct(e) {
|
|
813
814
|
let t = [];
|
|
814
815
|
for (let n of e) t.push({
|
|
815
816
|
x: n.x,
|
|
816
817
|
y: n.y,
|
|
817
818
|
right: n.x + n.width,
|
|
818
819
|
bottom: n.y + n.height
|
|
819
|
-
}), t.push(...
|
|
820
|
+
}), t.push(...Ct(n.children));
|
|
820
821
|
return t;
|
|
821
822
|
}
|
|
822
|
-
function
|
|
823
|
+
function wt(e, t, n = !1) {
|
|
823
824
|
let r = [], i = [], a = [], o = /* @__PURE__ */ new Set();
|
|
824
|
-
for (let e of t.subgraphs)
|
|
825
|
-
|
|
826
|
-
let s =
|
|
827
|
-
|
|
825
|
+
for (let e of t.subgraphs) Nt(e, o);
|
|
826
|
+
Tt(e, t, o, r, a, 0, 0);
|
|
827
|
+
let s = Ct(a);
|
|
828
|
+
Ot(e, t, i, 0, 0, s.length > 0 ? {
|
|
828
829
|
leftX: Math.min(...s.map((e) => e.x)) - 20,
|
|
829
830
|
rightX: Math.max(...s.map((e) => e.right)) + 20
|
|
830
|
-
} : void 0),
|
|
831
|
+
} : void 0), ct(r, i, t.direction);
|
|
831
832
|
let c = new Map(r.map((e) => [e.id, e]));
|
|
832
|
-
|
|
833
|
+
St(t, c, i), n && pt(i, r, a, t.direction);
|
|
833
834
|
for (let e of i) {
|
|
834
835
|
let t = c.get(e.source), n = c.get(e.target);
|
|
835
|
-
t && (e.points =
|
|
836
|
+
t && (e.points = it(e.points, t, !0)), n && (e.points = it(e.points, n, !1));
|
|
836
837
|
}
|
|
837
|
-
let l = e.width ?? 800, u = e.height ?? 600, d = z.width, f =
|
|
838
|
+
let l = e.width ?? 800, u = e.height ?? 600, d = z.width, f = Ie.padding;
|
|
838
839
|
for (let e of i) {
|
|
839
840
|
for (let t of e.points) l = Math.max(l, t.x + d + f), u = Math.max(u, t.y + d + f);
|
|
840
841
|
e.labelPosition && (l = Math.max(l, e.labelPosition.x + 60 + f), u = Math.max(u, e.labelPosition.y + 20 + f));
|
|
@@ -847,13 +848,13 @@ function gt(e, t, n = !1) {
|
|
|
847
848
|
groups: a
|
|
848
849
|
};
|
|
849
850
|
}
|
|
850
|
-
function
|
|
851
|
+
function Tt(e, t, n, r, i, a, o) {
|
|
851
852
|
if (e.children) for (let s of e.children) {
|
|
852
853
|
let e = (s.x ?? 0) + a, c = (s.y ?? 0) + o, l = s.width ?? 0, u = s.height ?? 0;
|
|
853
854
|
if (n.has(s.id)) {
|
|
854
855
|
let a = [];
|
|
855
|
-
|
|
856
|
-
let o =
|
|
856
|
+
Tt(s, t, n, r, a, e, c);
|
|
857
|
+
let o = Mt(t.subgraphs, s.id);
|
|
857
858
|
i.push({
|
|
858
859
|
id: s.id,
|
|
859
860
|
label: o?.label ?? "",
|
|
@@ -880,11 +881,11 @@ function _t(e, t, n, r, i, a, o) {
|
|
|
880
881
|
interaction: t.interactions.get(s.id)
|
|
881
882
|
});
|
|
882
883
|
}
|
|
883
|
-
s.children && s.children.length > 0 &&
|
|
884
|
+
s.children && s.children.length > 0 && Tt(s, t, n, r, i, e, c);
|
|
884
885
|
}
|
|
885
886
|
}
|
|
886
887
|
}
|
|
887
|
-
function
|
|
888
|
+
function Et(e) {
|
|
888
889
|
let t = /^e(\d+)$/.exec(e);
|
|
889
890
|
if (t) return {
|
|
890
891
|
edgeIndex: parseInt(t[1], 10),
|
|
@@ -897,7 +898,7 @@ function vt(e) {
|
|
|
897
898
|
level: parseInt(n[3], 10)
|
|
898
899
|
};
|
|
899
900
|
}
|
|
900
|
-
function
|
|
901
|
+
function Dt(e) {
|
|
901
902
|
if (e.length === 0) return {
|
|
902
903
|
x: 0,
|
|
903
904
|
y: 0
|
|
@@ -922,11 +923,11 @@ function yt(e) {
|
|
|
922
923
|
}
|
|
923
924
|
return e[e.length - 1];
|
|
924
925
|
}
|
|
925
|
-
function
|
|
926
|
+
function Ot(e, t, n, r, i, a) {
|
|
926
927
|
let o = /* @__PURE__ */ new Map();
|
|
927
|
-
|
|
928
|
+
kt(e, o, 0, 0);
|
|
928
929
|
let s = /* @__PURE__ */ new Map();
|
|
929
|
-
|
|
930
|
+
jt(e, s, 0, 0, o);
|
|
930
931
|
let c = 0;
|
|
931
932
|
for (let [e, r] of s) {
|
|
932
933
|
let i = t.edges[e];
|
|
@@ -939,9 +940,9 @@ function bt(e, t, n, r, i, a) {
|
|
|
939
940
|
let u = [...r.targetHops.keys()].sort((e, t) => e - t);
|
|
940
941
|
for (let e of u) s(r.targetHops.get(e));
|
|
941
942
|
let d;
|
|
942
|
-
i.label && o.length >= 2 && (d = r.bridge?.labelPosition ??
|
|
943
|
-
let f =
|
|
944
|
-
f !== o && c++, i.label && f !== o && f.length >= 2 && (d =
|
|
943
|
+
i.label && o.length >= 2 && (d = r.bridge?.labelPosition ?? Dt(o));
|
|
944
|
+
let f = At(o, a, c);
|
|
945
|
+
f !== o && c++, i.label && f !== o && f.length >= 2 && (d = Dt(f)), n.push({
|
|
945
946
|
source: i.source,
|
|
946
947
|
target: i.target,
|
|
947
948
|
label: i.label,
|
|
@@ -950,13 +951,13 @@ function bt(e, t, n, r, i, a) {
|
|
|
950
951
|
hasArrowEnd: i.hasArrowEnd,
|
|
951
952
|
points: f,
|
|
952
953
|
labelPosition: d,
|
|
953
|
-
inlineStyle:
|
|
954
|
+
inlineStyle: Pt(e, t),
|
|
954
955
|
id: i.id,
|
|
955
956
|
animate: i.animate
|
|
956
957
|
});
|
|
957
958
|
}
|
|
958
959
|
}
|
|
959
|
-
function
|
|
960
|
+
function kt(e, t, n, r) {
|
|
960
961
|
t.set(e.id, {
|
|
961
962
|
x: n,
|
|
962
963
|
y: r
|
|
@@ -964,10 +965,10 @@ function xt(e, t, n, r) {
|
|
|
964
965
|
for (let i of e.children ?? []) {
|
|
965
966
|
/* v8 ignore next */
|
|
966
967
|
let e = i.x ?? 0, a = i.y ?? 0;
|
|
967
|
-
|
|
968
|
+
kt(i, t, n + e, r + a);
|
|
968
969
|
}
|
|
969
970
|
}
|
|
970
|
-
function
|
|
971
|
+
function At(e, t, n = 0) {
|
|
971
972
|
if (e.length < 2) return e;
|
|
972
973
|
let r = !1;
|
|
973
974
|
for (let t = 1; t < e.length; t++) {
|
|
@@ -1006,11 +1007,11 @@ function St(e, t, n = 0) {
|
|
|
1006
1007
|
}
|
|
1007
1008
|
return i;
|
|
1008
1009
|
}
|
|
1009
|
-
function
|
|
1010
|
+
function jt(e, t, n, r, i) {
|
|
1010
1011
|
if (e.edges) for (let a of e.edges) {
|
|
1011
|
-
let e =
|
|
1012
|
+
let e = Et(a.id);
|
|
1012
1013
|
if (!e) continue;
|
|
1013
|
-
let { edgeIndex: o } = e, s = a.container, c = s ? i.get(s) : void 0, l = c?.x ?? n, u = c?.y ?? r, d =
|
|
1014
|
+
let { edgeIndex: o } = e, s = a.container, c = s ? i.get(s) : void 0, l = c?.x ?? n, u = c?.y ?? r, d = mt(a, l, u), f = ht(a, l, u), p = t.get(o) ?? {
|
|
1014
1015
|
sourceHops: /* @__PURE__ */ new Map(),
|
|
1015
1016
|
targetHops: /* @__PURE__ */ new Map()
|
|
1016
1017
|
};
|
|
@@ -1022,20 +1023,20 @@ function Ct(e, t, n, r, i) {
|
|
|
1022
1023
|
};
|
|
1023
1024
|
e.role === "bridge" ? p.bridge = m : e.role === "source" ? p.sourceHops.set(e.level, m) : p.targetHops.set(e.level, m);
|
|
1024
1025
|
}
|
|
1025
|
-
if (e.children) for (let a of e.children)
|
|
1026
|
+
if (e.children) for (let a of e.children) jt(a, t, n + (a.x ?? 0), r + (a.y ?? 0), i);
|
|
1026
1027
|
}
|
|
1027
|
-
function
|
|
1028
|
+
function Mt(e, t) {
|
|
1028
1029
|
for (let n of e) {
|
|
1029
1030
|
if (n.id === t) return n;
|
|
1030
|
-
let e =
|
|
1031
|
+
let e = Mt(n.children, t);
|
|
1031
1032
|
if (e) return e;
|
|
1032
1033
|
}
|
|
1033
1034
|
}
|
|
1034
|
-
function
|
|
1035
|
+
function Nt(e, t) {
|
|
1035
1036
|
t.add(e.id);
|
|
1036
|
-
for (let n of e.children)
|
|
1037
|
+
for (let n of e.children) Nt(n, t);
|
|
1037
1038
|
}
|
|
1038
|
-
function
|
|
1039
|
+
function Pt(e, t) {
|
|
1039
1040
|
let n, r = t.linkStyles.get("default");
|
|
1040
1041
|
r && (n = { ...r });
|
|
1041
1042
|
let i = t.linkStyles.get(e);
|
|
@@ -1046,37 +1047,37 @@ function Et(e, t) {
|
|
|
1046
1047
|
}
|
|
1047
1048
|
//#endregion
|
|
1048
1049
|
//#region packages/svg-renderer/src/layout-engine.ts
|
|
1049
|
-
function
|
|
1050
|
+
function Ft(e, t = {}) {
|
|
1050
1051
|
let n = {
|
|
1051
|
-
...
|
|
1052
|
+
...Ie,
|
|
1052
1053
|
...t,
|
|
1053
1054
|
fontSizes: P(t.fontSizes)
|
|
1054
1055
|
};
|
|
1055
|
-
return
|
|
1056
|
+
return wt(je(et(e, n), t.layoutCache), e, n.mergeEdges);
|
|
1056
1057
|
}
|
|
1057
|
-
function
|
|
1058
|
-
return
|
|
1059
|
-
...
|
|
1058
|
+
function It(e, t = {}) {
|
|
1059
|
+
return et(e, {
|
|
1060
|
+
...Ie,
|
|
1060
1061
|
...t,
|
|
1061
1062
|
fontSizes: P(t.fontSizes)
|
|
1062
1063
|
});
|
|
1063
1064
|
}
|
|
1064
1065
|
//#endregion
|
|
1065
1066
|
//#region packages/svg-renderer/src/renderer.ts
|
|
1066
|
-
function
|
|
1067
|
+
function Lt(e, t, r = "Inter", i = !1, a = N, o = "linear", s, c = !0, l = !0, u, d, f = {}) {
|
|
1067
1068
|
let p = [], m = l && e.nodes.some((e) => !!b(e.interaction?.href));
|
|
1068
|
-
p.push(
|
|
1069
|
+
p.push(H(E(e.width, e.height, t, i, u, d, m, f.styleAttribute), s)), p.push(n(r, !1, f.nonce)), c && e.edges.some((e) => e.animate) && p.push(Rt(f.nonce)), p.push("<defs>"), p.push(zt());
|
|
1069
1070
|
let h = /* @__PURE__ */ new Set();
|
|
1070
1071
|
for (let t of e.edges) t.inlineStyle?.stroke && h.add(t.inlineStyle.stroke);
|
|
1071
|
-
for (let e of h) p.push(
|
|
1072
|
+
for (let e of h) p.push(Bt(e));
|
|
1072
1073
|
p.push("</defs>");
|
|
1073
|
-
for (let t of e.groups) p.push(
|
|
1074
|
-
for (let t of e.edges) p.push(
|
|
1075
|
-
for (let t of e.edges) t.label && p.push(
|
|
1076
|
-
for (let t of e.nodes) p.push(
|
|
1074
|
+
for (let t of e.groups) p.push(Ut(t, r, a));
|
|
1075
|
+
for (let t of e.edges) p.push(Wt(t, o, c));
|
|
1076
|
+
for (let t of e.edges) t.label && p.push(Kt(t, r, a));
|
|
1077
|
+
for (let t of e.nodes) p.push(Xt(t, r, a, l));
|
|
1077
1078
|
return p.push("</svg>"), p.join("\n");
|
|
1078
1079
|
}
|
|
1079
|
-
function
|
|
1080
|
+
function Rt(e) {
|
|
1080
1081
|
return [
|
|
1081
1082
|
T(e),
|
|
1082
1083
|
" @keyframes zm-edge-dash { to { stroke-dashoffset: -28; } }",
|
|
@@ -1087,67 +1088,67 @@ function At(e) {
|
|
|
1087
1088
|
"</style>"
|
|
1088
1089
|
].join("\n");
|
|
1089
1090
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return
|
|
1091
|
+
function zt() {
|
|
1092
|
+
return Vt("var(--_arrow)", "");
|
|
1092
1093
|
}
|
|
1093
|
-
function
|
|
1094
|
-
return
|
|
1094
|
+
function Bt(e) {
|
|
1095
|
+
return Vt(i(e), s`-${Ht(e)}`);
|
|
1095
1096
|
}
|
|
1096
|
-
function
|
|
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} />`,
|
|
1098
|
-
return s
|
|
1097
|
+
function Vt(e, t) {
|
|
1098
|
+
let n = z.width, r = z.height, i = n - 1, a = s`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`, o = s`<polygon points="0 0, ${n} ${r / 2}, 0 ${r}" ${a} />`, c = (e, t) => s` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${i}" refY="${r / 2}" orient="${t}">` + s`\n ${o}` + "\n </marker>";
|
|
1099
|
+
return c(s`arrowhead${t}`, "auto") + "\n" + c(s`arrowhead-start${t}`, "auto-start-reverse");
|
|
1099
1100
|
}
|
|
1100
|
-
function
|
|
1101
|
+
function Ht(e) {
|
|
1101
1102
|
return e.replace(/[^a-zA-Z0-9]/g, (e) => e.charCodeAt(0).toString(16));
|
|
1102
1103
|
}
|
|
1103
|
-
function
|
|
1104
|
-
let r = n.groupHeader + 16,
|
|
1105
|
-
|
|
1106
|
-
for (let r of e.children)
|
|
1107
|
-
return
|
|
1104
|
+
function Ut(e, t, n) {
|
|
1105
|
+
let r = n.groupHeader + 16, a = [];
|
|
1106
|
+
a.push(s`<g class="subgraph" data-id="${i(e.id)}" data-label="${i(e.label)}">`), a.push(s` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" ` + s`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), a.push(s` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" ` + s`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), a.push(" " + _(e.label, e.x + 12, e.y + r / 2, n.groupHeader, s`font-size="${n.groupHeader}" font-weight="${F.groupHeader}" fill="var(--_text-sec)"`));
|
|
1107
|
+
for (let r of e.children) a.push(Ut(r, t, n));
|
|
1108
|
+
return a.push("</g>"), a.join("\n");
|
|
1108
1109
|
}
|
|
1109
|
-
function
|
|
1110
|
+
function Wt(e, t, n = !0) {
|
|
1110
1111
|
if (e.points.length < 2) return "";
|
|
1111
|
-
let r = n && (e.animate ?? !1),
|
|
1112
|
-
o || (e.hasArrowEnd && (
|
|
1113
|
-
let
|
|
1114
|
-
`class="edge${r ? " edge-animated" : ""}"`,
|
|
1115
|
-
`data-from="${
|
|
1116
|
-
`data-to="${
|
|
1117
|
-
`data-style="${e.style}"`,
|
|
1118
|
-
`data-arrow-start="${e.hasArrowStart}"`,
|
|
1119
|
-
`data-arrow-end="${e.hasArrowEnd}"`
|
|
1112
|
+
let r = n && (e.animate ?? !1), a = t !== "linear", o = e.style === "invisible", c = e.style === "dotted" ? " stroke-dasharray=\"4 4\"" : "", l = e.style === "thick" ? L.connector * 2 : L.connector, u = o ? "none" : i(e.inlineStyle?.stroke ?? "var(--_line)"), d = i(e.inlineStyle?.["stroke-width"] ?? String(l)), f = e.inlineStyle?.stroke ? s`-${Ht(e.inlineStyle.stroke)}` : "", p = "";
|
|
1113
|
+
o || (e.hasArrowEnd && (p += s` marker-end="url(#arrowhead${f})"`), e.hasArrowStart && (p += s` marker-start="url(#arrowhead-start${f})"`));
|
|
1114
|
+
let m = [
|
|
1115
|
+
s`class="edge${r ? " edge-animated" : ""}"`,
|
|
1116
|
+
s`data-from="${i(e.source)}"`,
|
|
1117
|
+
s`data-to="${i(e.target)}"`,
|
|
1118
|
+
s`data-style="${e.style}"`,
|
|
1119
|
+
s`data-arrow-start="${e.hasArrowStart}"`,
|
|
1120
|
+
s`data-arrow-end="${e.hasArrowEnd}"`
|
|
1120
1121
|
];
|
|
1121
|
-
e.label &&
|
|
1122
|
-
let
|
|
1123
|
-
return `<${
|
|
1122
|
+
e.label && m.push(s`data-label="${i(e.label)}"`), e.id && m.push(s`data-id="${i(e.id)}"`);
|
|
1123
|
+
let h = r && !c ? " stroke-dasharray=\"8 6\"" : "", g = a ? s`d="${we(e.points, t)}"` : s`points="${Gt(e.points)}"`;
|
|
1124
|
+
return s`<${a ? "path" : "polyline"} ${m.join(" ")} ${g} ` + s`fill="none" stroke="${u}" ` + s`stroke-width="${d}"${c}${h}${p} />`;
|
|
1124
1125
|
}
|
|
1125
|
-
function
|
|
1126
|
-
return e.map((e) => `${e.x},${e.y}`).join(" ");
|
|
1126
|
+
function Gt(e) {
|
|
1127
|
+
return e.map((e) => s`${e.x},${e.y}`).join(" ");
|
|
1127
1128
|
}
|
|
1128
|
-
function
|
|
1129
|
+
function Kt(e, t, n) {
|
|
1129
1130
|
if (!e.label) return "";
|
|
1130
|
-
let r = e.label,
|
|
1131
|
-
return `<g class="edge-label" data-from="${
|
|
1131
|
+
let r = e.label, a = e.labelPosition ?? Jt(e.points), o = d(r, n.edgeLabel, F.edgeLabel), c = v(r, a.x, a.y, o.width, o.height, n.edgeLabel, 8, s`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\"");
|
|
1132
|
+
return s`<g class="edge-label" data-from="${i(e.source)}" data-to="${i(e.target)}" data-label="${i(r)}">\n` + s` ${c.replace(/\n/g, "\n ")}\n` + "</g>";
|
|
1132
1133
|
}
|
|
1133
|
-
function
|
|
1134
|
+
function qt(e, t) {
|
|
1134
1135
|
let n = e[t];
|
|
1135
1136
|
if (!n)
|
|
1136
1137
|
/* v8 ignore next */
|
|
1137
|
-
throw Error(`edgeMidpoint: missing point at index ${t}`);
|
|
1138
|
+
throw Error(s`edgeMidpoint: missing point at index ${t}`);
|
|
1138
1139
|
return n;
|
|
1139
1140
|
}
|
|
1140
|
-
function
|
|
1141
|
+
function Jt(e) {
|
|
1141
1142
|
if (e.length === 0) return {
|
|
1142
1143
|
x: 0,
|
|
1143
1144
|
y: 0
|
|
1144
1145
|
};
|
|
1145
1146
|
if (e.length === 1) return e[0];
|
|
1146
1147
|
let t = 0;
|
|
1147
|
-
for (let n = 1; n < e.length; n++) t +=
|
|
1148
|
+
for (let n = 1; n < e.length; n++) t += Yt(qt(e, n - 1), qt(e, n));
|
|
1148
1149
|
let n = t / 2;
|
|
1149
1150
|
for (let t = 1; t < e.length; t++) {
|
|
1150
|
-
let r =
|
|
1151
|
+
let r = qt(e, t - 1), i = qt(e, t), a = Yt(r, i);
|
|
1151
1152
|
if (n <= a) {
|
|
1152
1153
|
let e = n / a;
|
|
1153
1154
|
return {
|
|
@@ -1159,281 +1160,287 @@ function Bt(e) {
|
|
|
1159
1160
|
}
|
|
1160
1161
|
return e[e.length - 1];
|
|
1161
1162
|
}
|
|
1162
|
-
function
|
|
1163
|
+
function Yt(e, t) {
|
|
1163
1164
|
return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
|
|
1164
1165
|
}
|
|
1165
|
-
function
|
|
1166
|
-
let
|
|
1167
|
-
`class="${
|
|
1168
|
-
`data-id="${
|
|
1169
|
-
`data-label="${
|
|
1170
|
-
`data-shape="${e.shape}"`
|
|
1166
|
+
function Xt(e, t, n, r = !0) {
|
|
1167
|
+
let o = Zt(e), c = Mn(e, t, n), l = [], u = x(e.className), d = u ? s`node ${u}` : "node", f = e.interaction, p = [
|
|
1168
|
+
s`class="${d}"`,
|
|
1169
|
+
s`data-id="${i(e.id)}"`,
|
|
1170
|
+
s`data-label="${i(e.label)}"`,
|
|
1171
|
+
s`data-shape="${e.shape}"`
|
|
1171
1172
|
];
|
|
1172
|
-
|
|
1173
|
-
let
|
|
1174
|
-
if (
|
|
1175
|
-
let e =
|
|
1176
|
-
|
|
1173
|
+
l.push(s`<g ${p.join(" ")}>`);
|
|
1174
|
+
let m = r ? b(f?.href) : void 0, h = m ? " " : " ";
|
|
1175
|
+
if (m) {
|
|
1176
|
+
let e = f?.target ? s` target="${i(f.target)}"` : "";
|
|
1177
|
+
l.push(s` <a href="${i(m)}"${e}>`);
|
|
1177
1178
|
}
|
|
1178
|
-
return r &&
|
|
1179
|
+
return r && f?.tooltip && l.push(s`${h}<title>${a(f.tooltip)}</title>`), l.push(s`${h}${o.replace(/\n/g, s`\n${h}`)}`), c && l.push(s`${h}${c.replace(/\n/g, s`\n${h}`)}`), m && l.push(" </a>"), l.push("</g>"), l.join("\n");
|
|
1179
1180
|
}
|
|
1180
|
-
function
|
|
1181
|
-
let { x: t, y: n, width: r, height:
|
|
1181
|
+
function Zt(e) {
|
|
1182
|
+
let { x: t, y: n, width: r, height: a, shape: o, inlineStyle: s } = e, c = i(s?.fill ?? "var(--_node-fill)"), l = i(s?.stroke ?? "var(--_node-stroke)"), u = i(s?.["stroke-width"] ?? String(L.innerBox));
|
|
1182
1183
|
switch (o) {
|
|
1183
|
-
case "diamond": return
|
|
1184
|
-
case "rounded": return
|
|
1185
|
-
case "stadium": return
|
|
1186
|
-
case "circle": return
|
|
1187
|
-
case "subroutine": return
|
|
1188
|
-
case "doublecircle": return
|
|
1189
|
-
case "hexagon": return
|
|
1190
|
-
case "cylinder": return
|
|
1191
|
-
case "asymmetric": return
|
|
1192
|
-
case "trapezoid": return
|
|
1193
|
-
case "trapezoid-alt": return
|
|
1194
|
-
case "parallelogram": return
|
|
1195
|
-
case "parallelogram-alt": return
|
|
1196
|
-
case "state-start": return
|
|
1197
|
-
case "state-end": return
|
|
1198
|
-
case "document": return
|
|
1199
|
-
case "stacked-document": return
|
|
1200
|
-
case "stacked-process": return
|
|
1201
|
-
case "card": return
|
|
1202
|
-
case "lined-process": return
|
|
1203
|
-
case "divided-process": return
|
|
1204
|
-
case "window-pane": return
|
|
1205
|
-
case "triangle": return
|
|
1206
|
-
case "flipped-triangle": return
|
|
1207
|
-
case "filled-circle": return
|
|
1208
|
-
case "crossed-circle": return
|
|
1209
|
-
case "fork-join": return
|
|
1210
|
-
case "notched-pentagon": return
|
|
1211
|
-
case "sloped-rectangle": return
|
|
1212
|
-
case "flag": return
|
|
1213
|
-
case "bow-tie-rectangle": return
|
|
1214
|
-
case "half-rounded-rectangle": return
|
|
1215
|
-
case "brace": return
|
|
1216
|
-
case "brace-right": return
|
|
1217
|
-
case "braces": return
|
|
1218
|
-
case "bolt": return
|
|
1184
|
+
case "diamond": return nn(t, n, r, a, c, l, u);
|
|
1185
|
+
case "rounded": return $t(t, n, r, a, c, l, u);
|
|
1186
|
+
case "stadium": return en(t, n, r, a, c, l, u);
|
|
1187
|
+
case "circle": return tn(t, n, r, a, c, l, u);
|
|
1188
|
+
case "subroutine": return rn(t, n, r, a, c, l, u);
|
|
1189
|
+
case "doublecircle": return an(t, n, r, a, c, l, u);
|
|
1190
|
+
case "hexagon": return on(t, n, r, a, c, l, u);
|
|
1191
|
+
case "cylinder": return sn(t, n, r, a, c, l, u);
|
|
1192
|
+
case "asymmetric": return cn(t, n, r, a, c, l, u);
|
|
1193
|
+
case "trapezoid": return ln(t, n, r, a, c, l, u);
|
|
1194
|
+
case "trapezoid-alt": return un(t, n, r, a, c, l, u);
|
|
1195
|
+
case "parallelogram": return dn(t, n, r, a, c, l, u);
|
|
1196
|
+
case "parallelogram-alt": return fn(t, n, r, a, c, l, u);
|
|
1197
|
+
case "state-start": return An(t, n, r, a);
|
|
1198
|
+
case "state-end": return jn(t, n, r, a);
|
|
1199
|
+
case "document": return pn(t, n, r, a, c, l, u);
|
|
1200
|
+
case "stacked-document": return mn(t, n, r, a, c, l, u, !0);
|
|
1201
|
+
case "stacked-process": return mn(t, n, r, a, c, l, u, !1);
|
|
1202
|
+
case "card": return hn(t, n, r, a, c, l, u);
|
|
1203
|
+
case "lined-process": return gn(t, n, r, a, c, l, u);
|
|
1204
|
+
case "divided-process": return _n(t, n, r, a, c, l, u);
|
|
1205
|
+
case "window-pane": return vn(t, n, r, a, c, l, u);
|
|
1206
|
+
case "triangle": return yn(t, n, r, a, c, l, u, !1);
|
|
1207
|
+
case "flipped-triangle": return yn(t, n, r, a, c, l, u, !0);
|
|
1208
|
+
case "filled-circle": return bn(t, n, r, a, l);
|
|
1209
|
+
case "crossed-circle": return xn(t, n, r, a, c, l, u);
|
|
1210
|
+
case "fork-join": return Sn(t, n, r, a, l);
|
|
1211
|
+
case "notched-pentagon": return Cn(t, n, r, a, c, l, u);
|
|
1212
|
+
case "sloped-rectangle": return wn(t, n, r, a, c, l, u);
|
|
1213
|
+
case "flag": return Tn(t, n, r, a, c, l, u);
|
|
1214
|
+
case "bow-tie-rectangle": return En(t, n, r, a, c, l, u);
|
|
1215
|
+
case "half-rounded-rectangle": return Dn(t, n, r, a, c, l, u);
|
|
1216
|
+
case "brace": return On(t, n, r, a, c, l, u, "left");
|
|
1217
|
+
case "brace-right": return On(t, n, r, a, c, l, u, "right");
|
|
1218
|
+
case "braces": return On(t, n, r, a, c, l, u, "both");
|
|
1219
|
+
case "bolt": return kn(t, n, r, a, c, l, u);
|
|
1219
1220
|
case "text":
|
|
1220
1221
|
case "anchor": return "";
|
|
1221
|
-
default: return
|
|
1222
|
+
default: return Qt(t, n, r, a, c, l, u);
|
|
1222
1223
|
}
|
|
1223
1224
|
}
|
|
1224
|
-
function Wt(e, t, n, r, i, a, o) {
|
|
1225
|
-
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1226
|
-
}
|
|
1227
|
-
function Gt(e, t, n, r, i, a, o) {
|
|
1228
|
-
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1229
|
-
}
|
|
1230
|
-
function Kt(e, t, n, r, i, a, o) {
|
|
1231
|
-
let s = r / 2;
|
|
1232
|
-
return `<rect x="${e}" y="${t}" width="${n}" height="${r}" rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1233
|
-
}
|
|
1234
|
-
function qt(e, t, n, r, i, a, o) {
|
|
1235
|
-
return `<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${Math.min(n, r) / 2}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1236
|
-
}
|
|
1237
|
-
function Jt(e, t, n, r, i, a, o) {
|
|
1238
|
-
let s = e + n / 2, c = t + r / 2, l = n / 2, u = r / 2;
|
|
1239
|
-
return `<polygon points="${[
|
|
1240
|
-
`${s},${c - u}`,
|
|
1241
|
-
`${s + l},${c}`,
|
|
1242
|
-
`${s},${c + u}`,
|
|
1243
|
-
`${s - l},${c}`
|
|
1244
|
-
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1245
|
-
}
|
|
1246
|
-
function Yt(e, t, n, r, i, a, o) {
|
|
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}" />`;
|
|
1248
|
-
}
|
|
1249
|
-
function Xt(e, t, n, r, i, a, o) {
|
|
1250
|
-
let s = e + n / 2, c = t + r / 2, l = Math.min(n, r) / 2;
|
|
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}" />`;
|
|
1252
|
-
}
|
|
1253
|
-
function Zt(e, t, n, r, i, a, o) {
|
|
1254
|
-
let s = r / 4;
|
|
1255
|
-
return `<polygon points="${[
|
|
1256
|
-
`${e + s},${t}`,
|
|
1257
|
-
`${e + n - s},${t}`,
|
|
1258
|
-
`${e + n},${t + r / 2}`,
|
|
1259
|
-
`${e + n - s},${t + r}`,
|
|
1260
|
-
`${e + s},${t + r}`,
|
|
1261
|
-
`${e},${t + r / 2}`
|
|
1262
|
-
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1263
|
-
}
|
|
1264
1225
|
function Qt(e, t, n, r, i, a, o) {
|
|
1265
|
-
|
|
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}" />`;
|
|
1226
|
+
return s`<rect x="${e}" y="${t}" width="${n}" height="${r}" ` + s`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1267
1227
|
}
|
|
1268
1228
|
function $t(e, t, n, r, i, a, o) {
|
|
1269
|
-
return `<
|
|
1270
|
-
`${e + 12},${t}`,
|
|
1271
|
-
`${e + n},${t}`,
|
|
1272
|
-
`${e + n},${t + r}`,
|
|
1273
|
-
`${e + 12},${t + r}`,
|
|
1274
|
-
`${e},${t + r / 2}`
|
|
1275
|
-
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1229
|
+
return s`<rect x="${e}" y="${t}" width="${n}" height="${r}" ` + s`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1276
1230
|
}
|
|
1277
1231
|
function en(e, t, n, r, i, a, o) {
|
|
1278
|
-
let
|
|
1279
|
-
return `<
|
|
1280
|
-
`${e + s},${t}`,
|
|
1281
|
-
`${e + n - s},${t}`,
|
|
1282
|
-
`${e + n},${t + r}`,
|
|
1283
|
-
`${e},${t + r}`
|
|
1284
|
-
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1232
|
+
let c = r / 2;
|
|
1233
|
+
return s`<rect x="${e}" y="${t}" width="${n}" height="${r}" ` + s`rx="${c}" ry="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1285
1234
|
}
|
|
1286
1235
|
function tn(e, t, n, r, i, a, o) {
|
|
1287
|
-
let
|
|
1288
|
-
return `<
|
|
1289
|
-
`${e},${t}`,
|
|
1290
|
-
`${e + n},${t}`,
|
|
1291
|
-
`${e + n - s},${t + r}`,
|
|
1292
|
-
`${e + s},${t + r}`
|
|
1293
|
-
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1236
|
+
let c = e + n / 2, l = t + r / 2, u = Math.min(n, r) / 2;
|
|
1237
|
+
return s`<circle cx="${c}" cy="${l}" r="${u}" ` + s`fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1294
1238
|
}
|
|
1295
1239
|
function nn(e, t, n, r, i, a, o) {
|
|
1296
|
-
let
|
|
1297
|
-
|
|
1298
|
-
`${
|
|
1299
|
-
`${
|
|
1300
|
-
`${
|
|
1301
|
-
|
|
1302
|
-
|
|
1240
|
+
let c = e + n / 2, l = t + r / 2, u = n / 2, d = r / 2, f = [
|
|
1241
|
+
s`${c},${l - d}`,
|
|
1242
|
+
s`${c + u},${l}`,
|
|
1243
|
+
s`${c},${l + d}`,
|
|
1244
|
+
s`${c - u},${l}`
|
|
1245
|
+
].join(" ");
|
|
1246
|
+
return s`<polygon points="${f}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1303
1247
|
}
|
|
1304
1248
|
function rn(e, t, n, r, i, a, o) {
|
|
1305
|
-
|
|
1306
|
-
return `<polygon points="${[
|
|
1307
|
-
`${e},${t}`,
|
|
1308
|
-
`${e + n - s},${t}`,
|
|
1309
|
-
`${e + n},${t + r}`,
|
|
1310
|
-
`${e + s},${t + r}`
|
|
1311
|
-
].join(" ")}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1312
|
-
}
|
|
1313
|
-
function H(e, t, n) {
|
|
1314
|
-
return `fill="${e}" stroke="${t}" stroke-width="${n}"`;
|
|
1249
|
+
return s`<rect x="${e}" y="${t}" width="${n}" height="${r}" ` + s`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />` + s`\n<line x1="${e + 8}" y1="${t}" x2="${e + 8}" y2="${t + r}" ` + s`stroke="${a}" stroke-width="${o}" />` + s`\n<line x1="${e + n - 8}" y1="${t}" x2="${e + n - 8}" y2="${t + r}" ` + s`stroke="${a}" stroke-width="${o}" />`;
|
|
1315
1250
|
}
|
|
1316
1251
|
function an(e, t, n, r, i, a, o) {
|
|
1317
|
-
let
|
|
1318
|
-
return `<
|
|
1319
|
-
}
|
|
1320
|
-
function on(e, t, n, r, i, a, o
|
|
1321
|
-
let c =
|
|
1322
|
-
|
|
1323
|
-
|
|
1252
|
+
let c = e + n / 2, l = t + r / 2, u = Math.min(n, r) / 2, d = u - 5;
|
|
1253
|
+
return s`<circle cx="${c}" cy="${l}" r="${u}" ` + s`fill="${i}" stroke="${a}" stroke-width="${o}" />` + s`\n<circle cx="${c}" cy="${l}" r="${d}" ` + s`fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1254
|
+
}
|
|
1255
|
+
function on(e, t, n, r, i, a, o) {
|
|
1256
|
+
let c = r / 4, l = [
|
|
1257
|
+
s`${e + c},${t}`,
|
|
1258
|
+
s`${e + n - c},${t}`,
|
|
1259
|
+
s`${e + n},${t + r / 2}`,
|
|
1260
|
+
s`${e + n - c},${t + r}`,
|
|
1261
|
+
s`${e + c},${t + r}`,
|
|
1262
|
+
s`${e},${t + r / 2}`
|
|
1263
|
+
].join(" ");
|
|
1264
|
+
return s`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1324
1265
|
}
|
|
1325
1266
|
function sn(e, t, n, r, i, a, o) {
|
|
1326
|
-
let
|
|
1327
|
-
return `<
|
|
1328
|
-
`${e + s},${t}`,
|
|
1329
|
-
`${e + n},${t}`,
|
|
1330
|
-
`${e + n},${t + r}`,
|
|
1331
|
-
`${e},${t + r}`,
|
|
1332
|
-
`${e},${t + s}`
|
|
1333
|
-
].join(" ")}" ${H(i, a, o)} />`;
|
|
1267
|
+
let c = e + n / 2, l = t + 7, u = r - 14;
|
|
1268
|
+
return s`<rect x="${e}" y="${l}" width="${n}" height="${u}" ` + s`fill="${i}" stroke="none" />` + s`\n<line x1="${e}" y1="${l}" x2="${e}" y2="${l + u}" stroke="${a}" stroke-width="${o}" />` + s`\n<line x1="${e + n}" y1="${l}" x2="${e + n}" y2="${l + u}" stroke="${a}" stroke-width="${o}" />` + s`\n<ellipse cx="${c}" cy="${t + r - 7}" rx="${n / 2}" ry="${7}" ` + s`fill="${i}" stroke="${a}" stroke-width="${o}" />` + s`\n<ellipse cx="${c}" cy="${l}" rx="${n / 2}" ry="${7}" ` + s`fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1334
1269
|
}
|
|
1335
1270
|
function cn(e, t, n, r, i, a, o) {
|
|
1336
|
-
let
|
|
1337
|
-
|
|
1271
|
+
let c = [
|
|
1272
|
+
s`${e + 12},${t}`,
|
|
1273
|
+
s`${e + n},${t}`,
|
|
1274
|
+
s`${e + n},${t + r}`,
|
|
1275
|
+
s`${e + 12},${t + r}`,
|
|
1276
|
+
s`${e},${t + r / 2}`
|
|
1277
|
+
].join(" ");
|
|
1278
|
+
return s`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1338
1279
|
}
|
|
1339
1280
|
function ln(e, t, n, r, i, a, o) {
|
|
1340
|
-
let
|
|
1341
|
-
|
|
1281
|
+
let c = n * .15, l = [
|
|
1282
|
+
s`${e + c},${t}`,
|
|
1283
|
+
s`${e + n - c},${t}`,
|
|
1284
|
+
s`${e + n},${t + r}`,
|
|
1285
|
+
s`${e},${t + r}`
|
|
1286
|
+
].join(" ");
|
|
1287
|
+
return s`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1342
1288
|
}
|
|
1343
1289
|
function un(e, t, n, r, i, a, o) {
|
|
1344
|
-
let
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
`${e +
|
|
1355
|
-
`${e},${t
|
|
1356
|
-
|
|
1290
|
+
let c = n * .15, l = [
|
|
1291
|
+
s`${e},${t}`,
|
|
1292
|
+
s`${e + n},${t}`,
|
|
1293
|
+
s`${e + n - c},${t + r}`,
|
|
1294
|
+
s`${e + c},${t + r}`
|
|
1295
|
+
].join(" ");
|
|
1296
|
+
return s`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1297
|
+
}
|
|
1298
|
+
function dn(e, t, n, r, i, a, o) {
|
|
1299
|
+
let c = n * .15, l = [
|
|
1300
|
+
s`${e + c},${t}`,
|
|
1301
|
+
s`${e + n},${t}`,
|
|
1302
|
+
s`${e + n - c},${t + r}`,
|
|
1303
|
+
s`${e},${t + r}`
|
|
1304
|
+
].join(" ");
|
|
1305
|
+
return s`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1306
|
+
}
|
|
1307
|
+
function fn(e, t, n, r, i, a, o) {
|
|
1308
|
+
let c = n * .15, l = [
|
|
1309
|
+
s`${e},${t}`,
|
|
1310
|
+
s`${e + n - c},${t}`,
|
|
1311
|
+
s`${e + n},${t + r}`,
|
|
1312
|
+
s`${e + c},${t + r}`
|
|
1313
|
+
].join(" ");
|
|
1314
|
+
return s`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
1357
1315
|
}
|
|
1358
|
-
function
|
|
1359
|
-
|
|
1360
|
-
return `<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${a}" fill="${i}" stroke="${i}" />`;
|
|
1316
|
+
function V(e, t, n) {
|
|
1317
|
+
return s`fill="${e}" stroke="${t}" stroke-width="${n}"`;
|
|
1361
1318
|
}
|
|
1362
1319
|
function pn(e, t, n, r, i, a, o) {
|
|
1363
|
-
let
|
|
1364
|
-
return `<
|
|
1320
|
+
let c = Math.min(10, r * .16), l = t + r - c, u = s`M ${e} ${t} L ${e + n} ${t} L ${e + n} ${l} ` + s`C ${e + n * .75} ${l + c * 1.8} ${e + n * .25} ${l - c * .8} ${e} ${l} Z`;
|
|
1321
|
+
return s`<path d="${u}" ${V(i, a, o)} />`;
|
|
1365
1322
|
}
|
|
1366
|
-
function mn(e, t, n, r, i) {
|
|
1367
|
-
let
|
|
1368
|
-
|
|
1323
|
+
function mn(e, t, n, r, i, a, o, c) {
|
|
1324
|
+
let l = n - 10, u = r - 10, d = [];
|
|
1325
|
+
for (let n = 2; n >= 1; n--) d.push(s`<rect x="${e + 5 * n}" y="${t + 5 * (2 - n)}" width="${l}" height="${u}" ` + s`${V(i, a, o)} />`);
|
|
1326
|
+
return d.push(c ? pn(e, t + 10, l, u, i, a, o) : s`<rect x="${e}" y="${t + 10}" width="${l}" height="${u}" ${V(i, a, o)} />`), d.join("\n");
|
|
1369
1327
|
}
|
|
1370
1328
|
function hn(e, t, n, r, i, a, o) {
|
|
1371
|
-
let
|
|
1372
|
-
|
|
1373
|
-
`${e +
|
|
1374
|
-
`${e + n
|
|
1375
|
-
`${e
|
|
1376
|
-
`${e
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
].join(" ")}" ${H(i, a, o)} />`;
|
|
1329
|
+
let c = Math.min(14, n * .12, r * .3), l = [
|
|
1330
|
+
s`${e + c},${t}`,
|
|
1331
|
+
s`${e + n},${t}`,
|
|
1332
|
+
s`${e + n},${t + r}`,
|
|
1333
|
+
s`${e},${t + r}`,
|
|
1334
|
+
s`${e},${t + c}`
|
|
1335
|
+
].join(" ");
|
|
1336
|
+
return s`<polygon points="${l}" ${V(i, a, o)} />`;
|
|
1380
1337
|
}
|
|
1381
1338
|
function gn(e, t, n, r, i, a, o) {
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
`${e + n},${t}`,
|
|
1385
|
-
`${e + n},${t + r}`,
|
|
1386
|
-
`${e},${t + r}`
|
|
1387
|
-
].join(" ")}" ${H(i, a, o)} />`;
|
|
1339
|
+
let c = Math.min(12, n * .12);
|
|
1340
|
+
return s`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${V(i, a, o)} />\n` + s`<line x1="${e + c}" y1="${t}" x2="${e + c}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />`;
|
|
1388
1341
|
}
|
|
1389
1342
|
function _n(e, t, n, r, i, a, o) {
|
|
1390
|
-
let
|
|
1391
|
-
return `<
|
|
1343
|
+
let c = t + Math.min(16, r * .3);
|
|
1344
|
+
return s`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${V(i, a, o)} />\n` + s`<line x1="${e}" y1="${c}" x2="${e + n}" y2="${c}" stroke="${a}" stroke-width="${o}" />`;
|
|
1392
1345
|
}
|
|
1393
1346
|
function vn(e, t, n, r, i, a, o) {
|
|
1394
|
-
let
|
|
1395
|
-
return `<
|
|
1396
|
-
}
|
|
1397
|
-
function yn(e, t, n, r, i, a, o) {
|
|
1398
|
-
let
|
|
1399
|
-
|
|
1347
|
+
let c = e + Math.min(16, n * .16), l = t + Math.min(14, r * .28);
|
|
1348
|
+
return s`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${V(i, a, o)} />\n` + s`<line x1="${c}" y1="${t}" x2="${c}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />\n` + s`<line x1="${e}" y1="${l}" x2="${e + n}" y2="${l}" stroke="${a}" stroke-width="${o}" />`;
|
|
1349
|
+
}
|
|
1350
|
+
function yn(e, t, n, r, i, a, o, c) {
|
|
1351
|
+
let l = c ? [
|
|
1352
|
+
s`${e},${t}`,
|
|
1353
|
+
s`${e + n},${t}`,
|
|
1354
|
+
s`${e + n / 2},${t + r}`
|
|
1355
|
+
] : [
|
|
1356
|
+
s`${e + n / 2},${t}`,
|
|
1357
|
+
s`${e + n},${t + r}`,
|
|
1358
|
+
s`${e},${t + r}`
|
|
1359
|
+
];
|
|
1360
|
+
return s`<polygon points="${l.join(" ")}" ${V(i, a, o)} />`;
|
|
1400
1361
|
}
|
|
1401
|
-
function bn(e, t, n, r, i
|
|
1402
|
-
let
|
|
1403
|
-
return
|
|
1362
|
+
function bn(e, t, n, r, i) {
|
|
1363
|
+
let a = Math.min(n, r) / 2 - 2;
|
|
1364
|
+
return s`<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${a}" fill="${i}" stroke="${i}" />`;
|
|
1404
1365
|
}
|
|
1405
1366
|
function xn(e, t, n, r, i, a, o) {
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
}
|
|
1423
|
-
|
|
1367
|
+
let c = e + n / 2, l = t + r / 2, u = Math.min(n, r) / 2 - 2, d = u / Math.SQRT2;
|
|
1368
|
+
return s`<circle cx="${c}" cy="${l}" r="${u}" ${V(i, a, o)} />\n` + s`<line x1="${c - d}" y1="${l - d}" x2="${c + d}" y2="${l + d}" stroke="${a}" stroke-width="${o}" />\n` + s`<line x1="${c + d}" y1="${l - d}" x2="${c - d}" y2="${l + d}" stroke="${a}" stroke-width="${o}" />`;
|
|
1369
|
+
}
|
|
1370
|
+
function Sn(e, t, n, r, i) {
|
|
1371
|
+
let a = Math.min(8, r);
|
|
1372
|
+
return s`<rect x="${e}" y="${t + (r - a) / 2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`;
|
|
1373
|
+
}
|
|
1374
|
+
function Cn(e, t, n, r, i, a, o) {
|
|
1375
|
+
let c = Math.min(14, n * .12, r * .3), l = [
|
|
1376
|
+
s`${e + c},${t}`,
|
|
1377
|
+
s`${e + n - c},${t}`,
|
|
1378
|
+
s`${e + n},${t + c}`,
|
|
1379
|
+
s`${e + n},${t + r}`,
|
|
1380
|
+
s`${e},${t + r}`,
|
|
1381
|
+
s`${e},${t + c}`
|
|
1382
|
+
].join(" ");
|
|
1383
|
+
return s`<polygon points="${l}" ${V(i, a, o)} />`;
|
|
1384
|
+
}
|
|
1385
|
+
function wn(e, t, n, r, i, a, o) {
|
|
1386
|
+
let c = Math.min(12, r * .3), l = [
|
|
1387
|
+
s`${e},${t + c}`,
|
|
1388
|
+
s`${e + n},${t}`,
|
|
1389
|
+
s`${e + n},${t + r}`,
|
|
1390
|
+
s`${e},${t + r}`
|
|
1391
|
+
].join(" ");
|
|
1392
|
+
return s`<polygon points="${l}" ${V(i, a, o)} />`;
|
|
1393
|
+
}
|
|
1394
|
+
function Tn(e, t, n, r, i, a, o) {
|
|
1395
|
+
let c = Math.min(8, r * .14), l = s`M ${e} ${t + c} ` + s`C ${e + n * .25} ${t - c} ${e + n * .75} ${t + c * 2} ${e + n} ${t + c} ` + s`L ${e + n} ${t + r - c} ` + s`C ${e + n * .75} ${t + r + c} ${e + n * .25} ${t + r - c * 2} ${e} ${t + r - c} Z`;
|
|
1396
|
+
return s`<path d="${l}" ${V(i, a, o)} />`;
|
|
1397
|
+
}
|
|
1398
|
+
function En(e, t, n, r, i, a, o) {
|
|
1399
|
+
let c = Math.min(14, n * .12), l = s`M ${e + c} ${t} L ${e + n} ${t} ` + s`Q ${e + n - c * 1.4} ${t + r / 2} ${e + n} ${t + r} ` + s`L ${e + c} ${t + r} ` + s`Q ${e + c * 1.4} ${t + r / 2} ${e + c} ${t} Z`;
|
|
1400
|
+
return s`<path d="${l}" ${V(i, a, o)} />`;
|
|
1401
|
+
}
|
|
1402
|
+
function Dn(e, t, n, r, i, a, o) {
|
|
1403
|
+
let c = r / 2, l = Math.max(0, n - c), u = s`M ${e} ${t} L ${e + l} ${t} ` + s`A ${c} ${c} 0 0 1 ${e + l} ${t + r} ` + s`L ${e} ${t + r} Z`;
|
|
1404
|
+
return s`<path d="${u}" ${V(i, a, o)} />`;
|
|
1405
|
+
}
|
|
1406
|
+
function On(e, t, n, r, i, a, o, c) {
|
|
1407
|
+
let l = Math.min(10, n * .12), u = [s`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`], d = s`M ${e + l} ${t} Q ${e} ${t} ${e} ${t + r * .25} ` + s`Q ${e} ${t + r / 2} ${e - l * .4} ${t + r / 2} ` + s`Q ${e} ${t + r / 2} ${e} ${t + r * .75} ` + s`Q ${e} ${t + r} ${e + l} ${t + r}`, f = s`M ${e + n - l} ${t} Q ${e + n} ${t} ${e + n} ${t + r * .25} ` + s`Q ${e + n} ${t + r / 2} ${e + n + l * .4} ${t + r / 2} ` + s`Q ${e + n} ${t + r / 2} ${e + n} ${t + r * .75} ` + s`Q ${e + n} ${t + r} ${e + n - l} ${t + r}`;
|
|
1408
|
+
return (c === "left" || c === "both") && u.push(s`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`), (c === "right" || c === "both") && u.push(s`<path d="${f}" fill="none" stroke="${a}" stroke-width="${o}" />`), u.join("\n");
|
|
1409
|
+
}
|
|
1410
|
+
function kn(e, t, n, r, i, a, o) {
|
|
1411
|
+
let c = [
|
|
1412
|
+
s`${e + n * .42},${t}`,
|
|
1413
|
+
s`${e + n},${t}`,
|
|
1414
|
+
s`${e + n * .62},${t + r * .42}`,
|
|
1415
|
+
s`${e + n},${t + r * .42}`,
|
|
1416
|
+
s`${e + n * .3},${t + r}`,
|
|
1417
|
+
s`${e + n * .5},${t + r * .55}`,
|
|
1418
|
+
s`${e},${t + r * .55}`
|
|
1419
|
+
].join(" ");
|
|
1420
|
+
return s`<polygon points="${c}" ${V(i, a, o)} />`;
|
|
1421
|
+
}
|
|
1422
|
+
function An(e, t, n, r) {
|
|
1423
|
+
let i = e + n / 2, a = t + r / 2, o = Math.min(n, r) / 2 - 2;
|
|
1424
|
+
return s`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`;
|
|
1425
|
+
}
|
|
1426
|
+
function jn(e, t, n, r) {
|
|
1427
|
+
let i = e + n / 2, a = t + r / 2, o = Math.min(n, r) / 2 - 2, c = o - 4;
|
|
1428
|
+
return s`<circle cx="${i}" cy="${a}" r="${o}" ` + s`fill="none" stroke="var(--_text)" stroke-width="${L.innerBox * 2}" />` + s`\n<circle cx="${i}" cy="${a}" r="${c}" fill="var(--_text)" stroke="none" />`;
|
|
1429
|
+
}
|
|
1430
|
+
function Mn(e, t, n) {
|
|
1424
1431
|
if ((e.shape === "state-start" || e.shape === "state-end") && !e.label) return "";
|
|
1425
|
-
let r = e.x + e.width / 2,
|
|
1426
|
-
return
|
|
1432
|
+
let r = e.x + e.width / 2, a = e.y + e.height / 2, o = i(e.inlineStyle?.color ?? l(e.inlineStyle?.fill, "var(--_text)")), c = s`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${F.nodeLabel}" fill="${o}"`, u = e.inlineStyle?.["font-family"];
|
|
1433
|
+
return u && (c += s` style="font-family: ${i(u)};"`), _(e.label, r, a, n.nodeLabel, c);
|
|
1427
1434
|
}
|
|
1428
|
-
function
|
|
1429
|
-
return
|
|
1435
|
+
function Nn(e) {
|
|
1436
|
+
return i(e).replace(/\r/g, " ").replace(/\n/g, " ").replace(/\t/g, "	");
|
|
1430
1437
|
}
|
|
1431
|
-
function
|
|
1432
|
-
return t === void 0 ? e : e.replace("<svg ", `<svg data-src="${
|
|
1438
|
+
function H(e, t) {
|
|
1439
|
+
return t === void 0 ? e : e.replace("<svg ", s`<svg data-src="${Nn(t)}" `);
|
|
1433
1440
|
}
|
|
1434
1441
|
//#endregion
|
|
1435
1442
|
//#region packages/svg-renderer/src/resolve-colors.ts
|
|
1436
|
-
var
|
|
1443
|
+
var Pn = class {
|
|
1437
1444
|
raw = /* @__PURE__ */ new Map();
|
|
1438
1445
|
resolved = /* @__PURE__ */ new Map();
|
|
1439
1446
|
inProgress = /* @__PURE__ */ new Set();
|
|
@@ -1445,13 +1452,13 @@ var En = class {
|
|
|
1445
1452
|
let t = this.raw.get(e);
|
|
1446
1453
|
if (t === void 0 || this.inProgress.has(e)) return;
|
|
1447
1454
|
this.inProgress.add(e);
|
|
1448
|
-
let n =
|
|
1455
|
+
let n = Vn(t, this).trim();
|
|
1449
1456
|
this.inProgress.delete(e);
|
|
1450
1457
|
let r = !/\bvar\(|\bcolor-mix\(/.test(n);
|
|
1451
1458
|
return this.resolved.set(e, r ? n : void 0), r ? n : void 0;
|
|
1452
1459
|
}
|
|
1453
1460
|
};
|
|
1454
|
-
function
|
|
1461
|
+
function Fn(e, t) {
|
|
1455
1462
|
let n = 0;
|
|
1456
1463
|
for (let r = t; r < e.length; r++) {
|
|
1457
1464
|
let t = e[r];
|
|
@@ -1460,7 +1467,7 @@ function Dn(e, t) {
|
|
|
1460
1467
|
}
|
|
1461
1468
|
return -1;
|
|
1462
1469
|
}
|
|
1463
|
-
function
|
|
1470
|
+
function In(e) {
|
|
1464
1471
|
let t = [], n = 0, r = 0;
|
|
1465
1472
|
for (let i = 0; i < e.length; i++) {
|
|
1466
1473
|
let a = e[i];
|
|
@@ -1468,12 +1475,12 @@ function On(e) {
|
|
|
1468
1475
|
}
|
|
1469
1476
|
return t.push(e.slice(r)), t;
|
|
1470
1477
|
}
|
|
1471
|
-
var
|
|
1472
|
-
function
|
|
1473
|
-
let [n, ...r] =
|
|
1478
|
+
var Ln = "(?<![\\w-])(var|color-mix)\\(";
|
|
1479
|
+
function Rn(e, t) {
|
|
1480
|
+
let [n, ...r] = In(e), i = (n ?? "").trim(), a = t.lookup(i);
|
|
1474
1481
|
return a === void 0 ? r.length > 0 ? r.join(",").trim() : null : a;
|
|
1475
1482
|
}
|
|
1476
|
-
function
|
|
1483
|
+
function zn(e) {
|
|
1477
1484
|
let t = e.trim().split(/\s+/), n, r;
|
|
1478
1485
|
for (let e of t) if (/^[\d.]+%$/.test(e)) {
|
|
1479
1486
|
if (r !== void 0) return null;
|
|
@@ -1487,61 +1494,61 @@ function jn(e) {
|
|
|
1487
1494
|
pct: r
|
|
1488
1495
|
};
|
|
1489
1496
|
}
|
|
1490
|
-
function
|
|
1491
|
-
let t =
|
|
1497
|
+
function Bn(e) {
|
|
1498
|
+
let t = In(e);
|
|
1492
1499
|
if (t.length !== 3) return null;
|
|
1493
1500
|
let [n, r, i] = t;
|
|
1494
1501
|
if (n === void 0 || r === void 0 || i === void 0 || !/^\s*in\s+srgb\s*$/i.test(n)) return null;
|
|
1495
|
-
let a =
|
|
1502
|
+
let a = zn(r), o = zn(i);
|
|
1496
1503
|
if (!a || !o) return null;
|
|
1497
1504
|
let s = h(a.color), l = h(o.color);
|
|
1498
1505
|
if (!s || !l) return null;
|
|
1499
1506
|
let u = p(s, l, a.pct, o.pct);
|
|
1500
1507
|
return u ? c(u) : null;
|
|
1501
1508
|
}
|
|
1502
|
-
function
|
|
1503
|
-
let n = "", r = 0, i = new RegExp(
|
|
1509
|
+
function Vn(e, t) {
|
|
1510
|
+
let n = "", r = 0, i = new RegExp(Ln, "g"), a;
|
|
1504
1511
|
for (; (a = i.exec(e)) !== null;) {
|
|
1505
1512
|
let o = a[1];
|
|
1506
1513
|
if (o === void 0) continue;
|
|
1507
|
-
let s = a.index, c = s + o.length, l =
|
|
1514
|
+
let s = a.index, c = s + o.length, l = Fn(e, c);
|
|
1508
1515
|
if (l === -1) break;
|
|
1509
|
-
let u =
|
|
1516
|
+
let u = Vn(e.slice(c + 1, l), t), d = o === "var" ? Rn(u, t) : Bn(u);
|
|
1510
1517
|
n += e.slice(r, s), n += d ?? `${o}(${u})`, r = l + 1, i.lastIndex = r;
|
|
1511
1518
|
}
|
|
1512
1519
|
return n + e.slice(r);
|
|
1513
1520
|
}
|
|
1514
|
-
function
|
|
1515
|
-
let n = new
|
|
1521
|
+
function Hn(e, t) {
|
|
1522
|
+
let n = new Pn();
|
|
1516
1523
|
for (let [e, r] of Object.entries(t)) n.declare(e, r);
|
|
1517
|
-
return
|
|
1524
|
+
return Vn(e, n);
|
|
1518
1525
|
}
|
|
1519
|
-
var
|
|
1520
|
-
function
|
|
1521
|
-
|
|
1526
|
+
var Un = /(--[\w-]+)\s*:\s*([^;{}]+)/g, Wn = /(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g, Gn = /* @__PURE__ */ new Set(["data-src"]);
|
|
1527
|
+
function Kn(e, t) {
|
|
1528
|
+
Un.lastIndex = 0;
|
|
1522
1529
|
let n;
|
|
1523
|
-
for (; (n =
|
|
1530
|
+
for (; (n = Un.exec(e)) !== null;) {
|
|
1524
1531
|
let [, e, r] = n;
|
|
1525
1532
|
e !== void 0 && r !== void 0 && t.declare(e, r.trim());
|
|
1526
1533
|
}
|
|
1527
1534
|
}
|
|
1528
|
-
function
|
|
1529
|
-
return e.replace(
|
|
1530
|
-
if (
|
|
1535
|
+
function qn(e, t) {
|
|
1536
|
+
return e.replace(Wn, (e, n, r, i, a) => {
|
|
1537
|
+
if (Gn.has(r)) return e;
|
|
1531
1538
|
let o = a[0] ?? "\"";
|
|
1532
|
-
return `${n}${r}${i}${o}${
|
|
1539
|
+
return `${n}${r}${i}${o}${Vn(a.slice(1, -1), t)}${o}`;
|
|
1533
1540
|
});
|
|
1534
1541
|
}
|
|
1535
|
-
function
|
|
1536
|
-
let n = new
|
|
1542
|
+
function Jn(e, t) {
|
|
1543
|
+
let n = new Pn();
|
|
1537
1544
|
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);
|
|
1538
1545
|
for (let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)) {
|
|
1539
1546
|
let e = t[1];
|
|
1540
|
-
e !== void 0 &&
|
|
1547
|
+
e !== void 0 && Kn(e, n);
|
|
1541
1548
|
}
|
|
1542
1549
|
for (let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)) {
|
|
1543
1550
|
let e = t[1];
|
|
1544
|
-
e !== void 0 &&
|
|
1551
|
+
e !== void 0 && Kn(e.slice(1, -1), n);
|
|
1545
1552
|
}
|
|
1546
1553
|
let r = "", i = 0;
|
|
1547
1554
|
for (; i < e.length;) {
|
|
@@ -1550,7 +1557,7 @@ function Bn(e, t) {
|
|
|
1550
1557
|
if (r += e.slice(i, t), e.startsWith("<style", t)) {
|
|
1551
1558
|
let a = e.indexOf(">", t), o = e.indexOf("</style>", t);
|
|
1552
1559
|
if (a === -1 || o === -1) break;
|
|
1553
|
-
r += e.slice(t, a + 1), r +=
|
|
1560
|
+
r += e.slice(t, a + 1), r += Vn(e.slice(a + 1, o), n), r += "</style>", i = o + 8;
|
|
1554
1561
|
continue;
|
|
1555
1562
|
}
|
|
1556
1563
|
let a = -1, o = null;
|
|
@@ -1565,13 +1572,13 @@ function Bn(e, t) {
|
|
|
1565
1572
|
}
|
|
1566
1573
|
if (a === -1) break;
|
|
1567
1574
|
let s = e.slice(t, a + 1);
|
|
1568
|
-
r += s.startsWith("<!") || s.startsWith("<?") || s.startsWith("</") ? s :
|
|
1575
|
+
r += s.startsWith("<!") || s.startsWith("<?") || s.startsWith("</") ? s : qn(s, n), i = a + 1;
|
|
1569
1576
|
}
|
|
1570
1577
|
return r + e.slice(i);
|
|
1571
1578
|
}
|
|
1572
1579
|
//#endregion
|
|
1573
1580
|
//#region packages/svg-renderer/src/class/layout.ts
|
|
1574
|
-
var
|
|
1581
|
+
var U = {
|
|
1575
1582
|
padding: 40,
|
|
1576
1583
|
boxPadX: 8,
|
|
1577
1584
|
headerBaseHeight: 32,
|
|
@@ -1587,16 +1594,16 @@ var W = {
|
|
|
1587
1594
|
notePadX: 10,
|
|
1588
1595
|
notePadY: 6
|
|
1589
1596
|
};
|
|
1590
|
-
function
|
|
1597
|
+
function Yn(e) {
|
|
1591
1598
|
return `note ${e}`;
|
|
1592
1599
|
}
|
|
1593
|
-
function
|
|
1600
|
+
function Xn(e) {
|
|
1594
1601
|
return `${e} link`;
|
|
1595
1602
|
}
|
|
1596
|
-
function
|
|
1603
|
+
function Zn(e, t) {
|
|
1597
1604
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = P(t.fontSizes);
|
|
1598
1605
|
for (let t of e.classes) {
|
|
1599
|
-
let e = t.annotation ?
|
|
1606
|
+
let e = t.annotation ? U.headerBaseHeight + U.annotationHeight : U.headerBaseHeight, r = t.attributes.length > 0 ? t.attributes.length * U.memberRowHeight + U.sectionPadY : U.emptySectionHeight, a = t.methods.length > 0 ? t.methods.length * U.memberRowHeight + U.sectionPadY : U.emptySectionHeight, o = M(t.label, i.nodeLabel, F.nodeLabel), s = er(t.attributes), c = er(t.methods), l = Math.max(U.minWidth, o + U.boxPadX * 2, s + U.boxPadX * 2, c + U.boxPadX * 2), u = e + r + a;
|
|
1600
1607
|
n.set(t.id, {
|
|
1601
1608
|
width: l,
|
|
1602
1609
|
height: u,
|
|
@@ -1606,9 +1613,9 @@ function Un(e, t) {
|
|
|
1606
1613
|
});
|
|
1607
1614
|
}
|
|
1608
1615
|
let a = [];
|
|
1609
|
-
for (let [e, t] of n) a.push(
|
|
1616
|
+
for (let [e, t] of n) a.push(Ve(e, t));
|
|
1610
1617
|
let o = { fontSize: i.edgeLabel }, s = [];
|
|
1611
|
-
for (let [t, n] of e.relationships.entries()) s.push(
|
|
1618
|
+
for (let [t, n] of e.relationships.entries()) s.push(B({
|
|
1612
1619
|
id: `e${t}`,
|
|
1613
1620
|
source: n.from,
|
|
1614
1621
|
target: n.to,
|
|
@@ -1617,12 +1624,12 @@ function Un(e, t) {
|
|
|
1617
1624
|
}));
|
|
1618
1625
|
let c = new Set(n.keys());
|
|
1619
1626
|
for (let [t, n] of e.notes.entries()) {
|
|
1620
|
-
let e =
|
|
1621
|
-
width: l.width +
|
|
1622
|
-
height: l.height +
|
|
1627
|
+
let e = Yn(t), l = d(n.text, i.edgeLabel, F.edgeLabel), u = {
|
|
1628
|
+
width: l.width + U.notePadX * 2,
|
|
1629
|
+
height: l.height + U.notePadY * 2
|
|
1623
1630
|
};
|
|
1624
|
-
r.set(e, u), a.push(
|
|
1625
|
-
id:
|
|
1631
|
+
r.set(e, u), a.push(Ve(e, u)), n.forClass !== void 0 && c.has(n.forClass) && s.push(B({
|
|
1632
|
+
id: Xn(e),
|
|
1626
1633
|
source: e,
|
|
1627
1634
|
target: n.forClass,
|
|
1628
1635
|
labelStyle: o
|
|
@@ -1632,11 +1639,11 @@ function Un(e, t) {
|
|
|
1632
1639
|
elkGraph: {
|
|
1633
1640
|
id: "root",
|
|
1634
1641
|
layoutOptions: {
|
|
1635
|
-
...
|
|
1636
|
-
direction:
|
|
1637
|
-
nodeSpacing:
|
|
1638
|
-
layerSpacing:
|
|
1639
|
-
padding:
|
|
1642
|
+
...Be({
|
|
1643
|
+
direction: Re(void 0, Le.class),
|
|
1644
|
+
nodeSpacing: U.nodeSpacing,
|
|
1645
|
+
layerSpacing: U.layerSpacing,
|
|
1646
|
+
padding: U.padding
|
|
1640
1647
|
}),
|
|
1641
1648
|
"elk.edgeLabels.placement": "CENTER"
|
|
1642
1649
|
},
|
|
@@ -1647,7 +1654,7 @@ function Un(e, t) {
|
|
|
1647
1654
|
noteSizes: r
|
|
1648
1655
|
};
|
|
1649
1656
|
}
|
|
1650
|
-
function
|
|
1657
|
+
function Qn(e, t, n, r) {
|
|
1651
1658
|
let i = /* @__PURE__ */ new Map();
|
|
1652
1659
|
for (let e of t.classes) i.set(e.id, e);
|
|
1653
1660
|
let a = [];
|
|
@@ -1683,7 +1690,7 @@ function Wn(e, t, n, r) {
|
|
|
1683
1690
|
if (!t)
|
|
1684
1691
|
/* v8 ignore next */
|
|
1685
1692
|
throw Error(`Missing ELK edge for relationship ${e}`);
|
|
1686
|
-
let r =
|
|
1693
|
+
let r = mt(t), i = ht(t);
|
|
1687
1694
|
o.push({
|
|
1688
1695
|
from: n.from,
|
|
1689
1696
|
to: n.to,
|
|
@@ -1702,11 +1709,11 @@ function Wn(e, t, n, r) {
|
|
|
1702
1709
|
for (let t of e.children ?? []) l.set(t.id, t);
|
|
1703
1710
|
let u = [];
|
|
1704
1711
|
for (let [e, n] of t.notes.entries()) {
|
|
1705
|
-
let t =
|
|
1712
|
+
let t = Yn(e), i = l.get(t), a = r.get(t);
|
|
1706
1713
|
if (!i || !a)
|
|
1707
1714
|
/* v8 ignore next */
|
|
1708
1715
|
throw Error(`Missing layout for note ${e}`);
|
|
1709
|
-
let o = c.get(
|
|
1716
|
+
let o = c.get(Xn(t));
|
|
1710
1717
|
u.push({
|
|
1711
1718
|
id: t,
|
|
1712
1719
|
text: n.text,
|
|
@@ -1715,7 +1722,7 @@ function Wn(e, t, n, r) {
|
|
|
1715
1722
|
y: i.y ?? 0,
|
|
1716
1723
|
width: i.width ?? a.width,
|
|
1717
1724
|
height: i.height ?? a.height,
|
|
1718
|
-
...o ? { linkPoints:
|
|
1725
|
+
...o ? { linkPoints: mt(o) } : {}
|
|
1719
1726
|
});
|
|
1720
1727
|
}
|
|
1721
1728
|
return {
|
|
@@ -1726,7 +1733,7 @@ function Wn(e, t, n, r) {
|
|
|
1726
1733
|
notes: u
|
|
1727
1734
|
};
|
|
1728
1735
|
}
|
|
1729
|
-
function
|
|
1736
|
+
function $n(e, t = {}) {
|
|
1730
1737
|
if (e.classes.length === 0 && e.notes.length === 0) return {
|
|
1731
1738
|
width: 0,
|
|
1732
1739
|
height: 0,
|
|
@@ -1734,110 +1741,110 @@ function Gn(e, t = {}) {
|
|
|
1734
1741
|
relationships: [],
|
|
1735
1742
|
notes: []
|
|
1736
1743
|
};
|
|
1737
|
-
let { elkGraph: n, classSizes: r, noteSizes: i } =
|
|
1738
|
-
return
|
|
1744
|
+
let { elkGraph: n, classSizes: r, noteSizes: i } = Zn(e, t);
|
|
1745
|
+
return Qn(je(n, t.layoutCache), e, r, i);
|
|
1739
1746
|
}
|
|
1740
|
-
function
|
|
1747
|
+
function er(e) {
|
|
1741
1748
|
if (e.length === 0) return 0;
|
|
1742
1749
|
let t = 0;
|
|
1743
1750
|
for (let n of e) {
|
|
1744
|
-
let e =
|
|
1751
|
+
let e = Me(se(n), U.memberFontSize);
|
|
1745
1752
|
e > t && (t = e);
|
|
1746
1753
|
}
|
|
1747
1754
|
return t;
|
|
1748
1755
|
}
|
|
1749
1756
|
//#endregion
|
|
1750
1757
|
//#region packages/svg-renderer/src/class/renderer.ts
|
|
1751
|
-
var
|
|
1758
|
+
var tr = {
|
|
1752
1759
|
memberSize: 11,
|
|
1753
1760
|
memberWeight: 400,
|
|
1754
1761
|
annotationSize: 10,
|
|
1755
1762
|
annotationWeight: 500
|
|
1756
1763
|
};
|
|
1757
|
-
function
|
|
1764
|
+
function nr(e, t, r = "Inter", i = !1, a = N, o, s, c, l = !0, u = {}) {
|
|
1758
1765
|
let d = [], f = l && e.classes.some((e) => !!b(e.interaction?.href));
|
|
1759
|
-
d.push(
|
|
1760
|
-
for (let t of e.relationships) d.push(
|
|
1761
|
-
for (let t of e.notes) d.push(
|
|
1762
|
-
for (let t of e.classes) d.push(
|
|
1763
|
-
for (let t of e.notes) d.push(
|
|
1764
|
-
for (let t of e.relationships) d.push(
|
|
1766
|
+
d.push(H(E(e.width, e.height, t, i, s, c, f, u.styleAttribute), o)), d.push(n(r, !0, u.nonce)), d.push("<defs>"), d.push(rr()), d.push("</defs>");
|
|
1767
|
+
for (let t of e.relationships) d.push(lr(t));
|
|
1768
|
+
for (let t of e.notes) d.push(cr(t));
|
|
1769
|
+
for (let t of e.classes) d.push(ir(t, a, l));
|
|
1770
|
+
for (let t of e.notes) d.push(sr(t, a));
|
|
1771
|
+
for (let t of e.relationships) d.push(fr(t, a));
|
|
1765
1772
|
return d.push("</svg>"), d.join("\n");
|
|
1766
1773
|
}
|
|
1767
|
-
function
|
|
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=\"
|
|
1774
|
+
function rr() {
|
|
1775
|
+
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=\"18\" markerHeight=\"14\" refX=\"16.5\" refY=\"7\" orient=\"auto-start-reverse\">\n <polygon points=\"9 1.5, 16.5 7, 9 12.5, 1.5 7\" fill=\"var(--_arrow)\" stroke=\"var(--_arrow)\" stroke-width=\"1\" />\n </marker>\n <marker id=\"cls-aggregation\" markerWidth=\"18\" markerHeight=\"14\" refX=\"16.5\" refY=\"7\" orient=\"auto-start-reverse\">\n <polygon points=\"9 1.5, 16.5 7, 9 12.5, 1.5 7\" 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>";
|
|
1769
1776
|
}
|
|
1770
|
-
function
|
|
1771
|
-
let { x: r, y:
|
|
1772
|
-
`class="${
|
|
1773
|
-
`data-id="${
|
|
1774
|
-
`data-label="${
|
|
1777
|
+
function ir(e, t, n = !0) {
|
|
1778
|
+
let { x: r, y: a, width: o, height: c, headerHeight: u, attrHeight: d, inlineStyle: f } = e, p = [], m = e.interaction, h = i(f?.fill ?? "var(--_node-fill)"), g = i(f?.stroke ?? "var(--_node-stroke)"), v = i(f?.["stroke-width"] ?? String(L.outerBox)), y = f?.fill ? h : "var(--_group-hdr)", S = f?.color ? i(f.color) : f?.fill ? i(l(f.fill, "var(--_text)")) : void 0, C = e.annotation ? s` data-annotation="${i(e.annotation)}"` : "", w = x(e.className), T = [
|
|
1779
|
+
s`class="${w ? s`class-node ${w}` : "class-node"}"`,
|
|
1780
|
+
s`data-id="${i(e.id)}"`,
|
|
1781
|
+
s`data-label="${i(e.label)}"`
|
|
1775
1782
|
];
|
|
1776
|
-
|
|
1777
|
-
let
|
|
1778
|
-
if (
|
|
1779
|
-
let e =
|
|
1780
|
-
|
|
1781
|
-
}
|
|
1782
|
-
n &&
|
|
1783
|
-
let
|
|
1783
|
+
p.push(s`<g ${T.join(" ")}${C}>`);
|
|
1784
|
+
let E = n ? b(m?.href) : void 0;
|
|
1785
|
+
if (E) {
|
|
1786
|
+
let e = m?.target ? s` target="${i(m.target)}"` : "";
|
|
1787
|
+
p.push(s` <a href="${i(E)}"${e}>`);
|
|
1788
|
+
}
|
|
1789
|
+
n && m?.tooltip && p.push(s` <title>${hr(m.tooltip)}</title>`), p.push(s` <rect x="${r}" y="${a}" width="${o}" height="${c}" ` + s`rx="0" ry="0" fill="${h}" stroke="${g}" stroke-width="${v}" />`), p.push(s` <rect x="${r}" y="${a}" width="${o}" height="${u}" ` + s`rx="0" ry="0" fill="${y}" stroke="${g}" stroke-width="${v}" />`);
|
|
1790
|
+
let D = a + u / 2;
|
|
1784
1791
|
if (e.annotation) {
|
|
1785
|
-
let t =
|
|
1786
|
-
|
|
1792
|
+
let t = a + 12;
|
|
1793
|
+
p.push(s` <text x="${r + o / 2}" y="${t}" text-anchor="middle" dy="${R}" ` + s`font-size="${tr.annotationSize}" font-weight="${tr.annotationWeight}" ` + s`font-style="italic" fill="${S ?? "var(--_text-muted)"}"><<${hr(e.annotation)}>></text>`), D = a + u / 2 + 6;
|
|
1787
1794
|
}
|
|
1788
|
-
|
|
1789
|
-
let
|
|
1790
|
-
|
|
1795
|
+
p.push(" " + _(e.label, r + o / 2, D, t.nodeLabel, s`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${S ?? "var(--_text)"}"`));
|
|
1796
|
+
let O = a + u;
|
|
1797
|
+
p.push(s` <line x1="${r}" y1="${O}" x2="${r + o}" y2="${O}" ` + s`stroke="${g}" stroke-width="${L.innerBox}" />`);
|
|
1791
1798
|
for (let t = 0; t < e.attributes.length; t++) {
|
|
1792
|
-
let n = e.attributes[t], i =
|
|
1793
|
-
|
|
1799
|
+
let n = e.attributes[t], i = O + 4 + t * 20 + 10;
|
|
1800
|
+
p.push(" " + ar(n, r + U.boxPadX, i, S));
|
|
1794
1801
|
}
|
|
1795
|
-
let
|
|
1796
|
-
|
|
1802
|
+
let k = O + d;
|
|
1803
|
+
p.push(s` <line x1="${r}" y1="${k}" x2="${r + o}" y2="${k}" ` + s`stroke="${g}" stroke-width="${L.innerBox}" />`);
|
|
1797
1804
|
for (let t = 0; t < e.methods.length; t++) {
|
|
1798
|
-
let n = e.methods[t], i =
|
|
1799
|
-
|
|
1800
|
-
}
|
|
1801
|
-
return
|
|
1802
|
-
}
|
|
1803
|
-
function
|
|
1804
|
-
let i = e.isAbstract ? " font-style=\"italic\"" : "", a = e.isStatic ? " text-decoration=\"underline\"" : "", o = r ?? "var(--_text-faint)",
|
|
1805
|
-
e.visibility &&
|
|
1806
|
-
let
|
|
1807
|
-
return
|
|
1808
|
-
}
|
|
1809
|
-
var
|
|
1810
|
-
function
|
|
1811
|
-
let { x: n, y: r, width:
|
|
1812
|
-
`${n},${r}`,
|
|
1813
|
-
`${n +
|
|
1814
|
-
`${n +
|
|
1815
|
-
`${n +
|
|
1816
|
-
`${n},${r + o}`
|
|
1817
|
-
].join(" "),
|
|
1818
|
-
return `<g class="class-note"${s
|
|
1819
|
-
}
|
|
1820
|
-
function
|
|
1805
|
+
let n = e.methods[t], i = k + 4 + t * 20 + 10;
|
|
1806
|
+
p.push(" " + ar(n, r + U.boxPadX, i, S));
|
|
1807
|
+
}
|
|
1808
|
+
return E && p.push(" </a>"), p.push("</g>"), p.join("\n");
|
|
1809
|
+
}
|
|
1810
|
+
function ar(e, t, n, r) {
|
|
1811
|
+
let i = e.isAbstract ? " font-style=\"italic\"" : "", a = e.isStatic ? " text-decoration=\"underline\"" : "", o = r ?? "var(--_text-faint)", c = r ?? "var(--_text-sec)", l = r ?? "var(--_text-muted)", u = [];
|
|
1812
|
+
e.visibility && u.push(s`<tspan fill="${o}">${hr(e.visibility)} </tspan>`);
|
|
1813
|
+
let d = e.isMethod ? s`${e.name}(${e.params || ""})` : e.name;
|
|
1814
|
+
return u.push(s`<tspan fill="${c}">${hr(d)}</tspan>`), e.type && (u.push(s`<tspan fill="${o}">: </tspan>`), u.push(s`<tspan fill="${l}">${hr(e.type)}</tspan>`)), s`<text x="${t}" y="${n}" class="mono" dy="${R}" ` + s`font-size="${tr.memberSize}" font-weight="${tr.memberWeight}"${i}${a}>` + s`${u.join("")}</text>`;
|
|
1815
|
+
}
|
|
1816
|
+
var or = 6;
|
|
1817
|
+
function sr(e, t) {
|
|
1818
|
+
let { x: n, y: r, width: a, height: o } = e, c = e.forClass === void 0 ? "" : s` data-for="${i(e.forClass)}"`, l = [
|
|
1819
|
+
s`${n},${r}`,
|
|
1820
|
+
s`${n + a - or},${r}`,
|
|
1821
|
+
s`${n + a},${r + or}`,
|
|
1822
|
+
s`${n + a},${r + o}`,
|
|
1823
|
+
s`${n},${r + o}`
|
|
1824
|
+
].join(" "), u = s`${n + a - or},${r} ${n + a},${r + or} ` + s`${n + a - or},${r + or}`;
|
|
1825
|
+
return s`<g class="class-note"${c}>` + s`\n <polygon points="${l}" ` + s`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />` + s`\n <polygon points="${u}" ` + s`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />` + s`\n ${_(e.text, n + a / 2, r + o / 2, t.edgeLabel, s`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`)}` + "\n</g>";
|
|
1826
|
+
}
|
|
1827
|
+
function cr(e) {
|
|
1821
1828
|
if (!e.linkPoints || e.linkPoints.length < 2) return "";
|
|
1822
|
-
let t = e.linkPoints.map((e) => `${e.x},${e.y}`).join(" ")
|
|
1823
|
-
return `<polyline class="class-note-link"${
|
|
1829
|
+
let t = e.linkPoints.map((e) => s`${e.x},${e.y}`).join(" "), n = e.forClass === void 0 ? "" : s` data-for="${i(e.forClass)}"`;
|
|
1830
|
+
return s`<polyline class="class-note-link"${n} points="${t}" ` + s`fill="none" stroke="var(--_line)" stroke-width="${L.connector}" stroke-dasharray="2 3" />`;
|
|
1824
1831
|
}
|
|
1825
|
-
function
|
|
1832
|
+
function lr(e) {
|
|
1826
1833
|
if (e.points.length < 2) return "";
|
|
1827
|
-
let t = e.points.map((e) => `${e.x},${e.y}`).join(" "), n = e.type === "dependency" || e.type === "realization" ? " stroke-dasharray=\"6 4\"" : "", r =
|
|
1834
|
+
let t = e.points.map((e) => s`${e.x},${e.y}`).join(" "), n = e.type === "dependency" || e.type === "realization" ? " stroke-dasharray=\"6 4\"" : "", r = ur(e.type, e.markerAt), a = [
|
|
1828
1835
|
"class=\"class-relationship\"",
|
|
1829
|
-
`data-from="${
|
|
1830
|
-
`data-to="${
|
|
1831
|
-
`data-type="${e.type}"`,
|
|
1832
|
-
`data-marker-at="${e.markerAt}"`
|
|
1836
|
+
s`data-from="${i(e.from)}"`,
|
|
1837
|
+
s`data-to="${i(e.to)}"`,
|
|
1838
|
+
s`data-type="${e.type}"`,
|
|
1839
|
+
s`data-marker-at="${e.markerAt}"`
|
|
1833
1840
|
];
|
|
1834
|
-
return e.label &&
|
|
1841
|
+
return e.label && a.push(s`data-label="${i(e.label)}"`), e.fromCardinality && a.push(s`data-from-cardinality="${i(e.fromCardinality)}"`), e.toCardinality && a.push(s`data-to-cardinality="${i(e.toCardinality)}"`), s`<polyline ${a.join(" ")} points="${t}" fill="none" stroke="var(--_line)" ` + s`stroke-width="${L.connector}"${n}${r} />`;
|
|
1835
1842
|
}
|
|
1836
|
-
function
|
|
1837
|
-
let n =
|
|
1838
|
-
return n ? t === "from" ? ` marker-start="url(#${n})"` : ` marker-end="url(#${n})"` : "";
|
|
1843
|
+
function ur(e, t) {
|
|
1844
|
+
let n = dr(e);
|
|
1845
|
+
return n ? t === "from" ? s` marker-start="url(#${n})"` : s` marker-end="url(#${n})"` : "";
|
|
1839
1846
|
}
|
|
1840
|
-
function
|
|
1847
|
+
function dr(e) {
|
|
1841
1848
|
switch (e) {
|
|
1842
1849
|
case "inheritance":
|
|
1843
1850
|
case "realization": return "cls-inherit";
|
|
@@ -1848,30 +1855,30 @@ function nr(e) {
|
|
|
1848
1855
|
default: return null;
|
|
1849
1856
|
}
|
|
1850
1857
|
}
|
|
1851
|
-
function
|
|
1858
|
+
function fr(e, t) {
|
|
1852
1859
|
if (!e.label && !e.fromCardinality && !e.toCardinality || e.points.length < 2) return "";
|
|
1853
1860
|
let n = [];
|
|
1854
1861
|
if (e.label) {
|
|
1855
|
-
let r = e.labelPosition ??
|
|
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)"`));
|
|
1862
|
+
let r = e.labelPosition ?? pr(e.points);
|
|
1863
|
+
n.push(_(e.label, r.x, r.y - 8, t.edgeLabel, s`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
1857
1864
|
}
|
|
1858
1865
|
if (e.fromCardinality && e.points.length >= 2) {
|
|
1859
|
-
let r = e.points[0], i = e.points[1], a =
|
|
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)"`));
|
|
1866
|
+
let r = e.points[0], i = e.points[1], a = mr(r, i);
|
|
1867
|
+
n.push(_(e.fromCardinality, r.x + a.x, r.y + a.y, t.edgeLabel, s`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
1861
1868
|
}
|
|
1862
1869
|
if (e.toCardinality && e.points.length >= 2) {
|
|
1863
|
-
let r = e.points[e.points.length - 1], i = e.points[e.points.length - 2], a =
|
|
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)"`));
|
|
1870
|
+
let r = e.points[e.points.length - 1], i = e.points[e.points.length - 2], a = mr(r, i);
|
|
1871
|
+
n.push(_(e.toCardinality, r.x + a.x, r.y + a.y, t.edgeLabel, s`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
1865
1872
|
}
|
|
1866
1873
|
return n.join("\n");
|
|
1867
1874
|
}
|
|
1868
|
-
function
|
|
1875
|
+
function pr(e) {
|
|
1869
1876
|
return e.length === 0 ? {
|
|
1870
1877
|
x: 0,
|
|
1871
1878
|
y: 0
|
|
1872
1879
|
} : e[Math.floor(e.length / 2)];
|
|
1873
1880
|
}
|
|
1874
|
-
function
|
|
1881
|
+
function mr(e, t) {
|
|
1875
1882
|
let n = t.x - e.x, r = t.y - e.y;
|
|
1876
1883
|
return Math.abs(n) > Math.abs(r) ? {
|
|
1877
1884
|
x: n > 0 ? 14 : -14,
|
|
@@ -1881,7 +1888,7 @@ function ar(e, t) {
|
|
|
1881
1888
|
y: r > 0 ? 14 : -14
|
|
1882
1889
|
};
|
|
1883
1890
|
}
|
|
1884
|
-
var
|
|
1891
|
+
var hr = a, W = {
|
|
1885
1892
|
padding: 40,
|
|
1886
1893
|
boxPadX: 14,
|
|
1887
1894
|
headerHeight: 34,
|
|
@@ -1892,24 +1899,24 @@ var or = o, K = {
|
|
|
1892
1899
|
nodeSpacing: 70,
|
|
1893
1900
|
layerSpacing: 90
|
|
1894
1901
|
};
|
|
1895
|
-
function
|
|
1902
|
+
function gr(e, t) {
|
|
1896
1903
|
let n = /* @__PURE__ */ new Map(), r = P(t.fontSizes);
|
|
1897
1904
|
for (let t of e.entities) {
|
|
1898
1905
|
let e = M(t.label, r.nodeLabel, F.nodeLabel), i = 0;
|
|
1899
1906
|
for (let e of t.attributes) {
|
|
1900
|
-
let t =
|
|
1907
|
+
let t = Me(`${e.type} ${e.name}${e.keys.length > 0 ? " " + e.keys.join(",") : ""}`, W.attrFontSize);
|
|
1901
1908
|
t > i && (i = t);
|
|
1902
1909
|
}
|
|
1903
|
-
let a = Math.max(
|
|
1910
|
+
let a = Math.max(W.minWidth, e + W.boxPadX * 2, i + W.boxPadX * 2), o = W.headerHeight + Math.max(t.attributes.length, 1) * W.rowHeight;
|
|
1904
1911
|
n.set(t.id, {
|
|
1905
1912
|
width: a,
|
|
1906
1913
|
height: o
|
|
1907
1914
|
});
|
|
1908
1915
|
}
|
|
1909
1916
|
let i = [];
|
|
1910
|
-
for (let [e, t] of n) i.push(
|
|
1917
|
+
for (let [e, t] of n) i.push(Ve(e, t));
|
|
1911
1918
|
let a = { fontSize: r.edgeLabel }, o = [];
|
|
1912
|
-
for (let [t, n] of e.relationships.entries()) o.push(
|
|
1919
|
+
for (let [t, n] of e.relationships.entries()) o.push(B({
|
|
1913
1920
|
id: `e${t}`,
|
|
1914
1921
|
source: n.entity1,
|
|
1915
1922
|
target: n.entity2,
|
|
@@ -1920,11 +1927,11 @@ function sr(e, t) {
|
|
|
1920
1927
|
elkGraph: {
|
|
1921
1928
|
id: "root",
|
|
1922
1929
|
layoutOptions: {
|
|
1923
|
-
...
|
|
1924
|
-
direction:
|
|
1925
|
-
nodeSpacing:
|
|
1926
|
-
layerSpacing:
|
|
1927
|
-
padding:
|
|
1930
|
+
...Be({
|
|
1931
|
+
direction: Re(e.direction, Le.er),
|
|
1932
|
+
nodeSpacing: W.nodeSpacing,
|
|
1933
|
+
layerSpacing: W.layerSpacing,
|
|
1934
|
+
padding: W.padding
|
|
1928
1935
|
}),
|
|
1929
1936
|
"elk.edgeLabels.placement": "CENTER"
|
|
1930
1937
|
},
|
|
@@ -1934,7 +1941,7 @@ function sr(e, t) {
|
|
|
1934
1941
|
entitySizes: n
|
|
1935
1942
|
};
|
|
1936
1943
|
}
|
|
1937
|
-
function
|
|
1944
|
+
function _r(e, t, n) {
|
|
1938
1945
|
let r = /* @__PURE__ */ new Map();
|
|
1939
1946
|
for (let e of t.entities) r.set(e.id, e);
|
|
1940
1947
|
let i = [];
|
|
@@ -1953,14 +1960,14 @@ function cr(e, t, n) {
|
|
|
1953
1960
|
y: t.y ?? 0,
|
|
1954
1961
|
width: t.width ?? r.width,
|
|
1955
1962
|
height: t.height ?? r.height,
|
|
1956
|
-
headerHeight:
|
|
1957
|
-
rowHeight:
|
|
1963
|
+
headerHeight: W.headerHeight,
|
|
1964
|
+
rowHeight: W.rowHeight
|
|
1958
1965
|
});
|
|
1959
1966
|
}
|
|
1960
1967
|
}
|
|
1961
1968
|
let a = [];
|
|
1962
1969
|
for (let [n, r] of (e.edges ?? []).entries()) {
|
|
1963
|
-
let e = t.relationships[n], i =
|
|
1970
|
+
let e = t.relationships[n], i = mt(r);
|
|
1964
1971
|
a.push({
|
|
1965
1972
|
entity1: e.entity1,
|
|
1966
1973
|
entity2: e.entity2,
|
|
@@ -1978,101 +1985,105 @@ function cr(e, t, n) {
|
|
|
1978
1985
|
relationships: a
|
|
1979
1986
|
};
|
|
1980
1987
|
}
|
|
1981
|
-
function
|
|
1988
|
+
function vr(e, t = {}) {
|
|
1982
1989
|
if (e.entities.length === 0) return {
|
|
1983
1990
|
width: 0,
|
|
1984
1991
|
height: 0,
|
|
1985
1992
|
entities: [],
|
|
1986
1993
|
relationships: []
|
|
1987
1994
|
};
|
|
1988
|
-
let { elkGraph: n, entitySizes: r } =
|
|
1989
|
-
return
|
|
1995
|
+
let { elkGraph: n, entitySizes: r } = gr(e, t);
|
|
1996
|
+
return _r(je(n, t.layoutCache), e, r);
|
|
1990
1997
|
}
|
|
1991
1998
|
//#endregion
|
|
1992
1999
|
//#region packages/svg-renderer/src/er/renderer.ts
|
|
1993
|
-
var
|
|
2000
|
+
var G = {
|
|
1994
2001
|
attrSize: 11,
|
|
1995
2002
|
attrWeight: 400,
|
|
1996
2003
|
keySize: 9,
|
|
1997
2004
|
keyWeight: 600
|
|
1998
2005
|
};
|
|
1999
|
-
function
|
|
2006
|
+
function yr(e, t, r = "Inter", i = !1, a = N, o, s, c, l = {}) {
|
|
2000
2007
|
let u = [];
|
|
2001
|
-
u.push(
|
|
2002
|
-
for (let t of e.relationships) u.push(
|
|
2003
|
-
for (let t of e.entities) u.push(
|
|
2004
|
-
for (let t of e.relationships) u.push(
|
|
2005
|
-
for (let t of e.relationships) u.push(
|
|
2008
|
+
u.push(H(E(e.width, e.height, t, i, s, c, void 0, l.styleAttribute), o)), u.push(n(r, !0, l.nonce)), u.push("<defs>"), u.push("</defs>");
|
|
2009
|
+
for (let t of e.relationships) u.push(Sr(t));
|
|
2010
|
+
for (let t of e.entities) u.push(br(t, a));
|
|
2011
|
+
for (let t of e.relationships) u.push(wr(t));
|
|
2012
|
+
for (let t of e.relationships) u.push(Cr(t, a));
|
|
2006
2013
|
return u.push("</svg>"), u.join("\n");
|
|
2007
2014
|
}
|
|
2008
|
-
function
|
|
2009
|
-
let { id: n, x: r, y:
|
|
2010
|
-
|
|
2011
|
-
let
|
|
2012
|
-
|
|
2013
|
-
for (let e = 0; e <
|
|
2014
|
-
let t =
|
|
2015
|
-
|
|
2015
|
+
function br(e, t) {
|
|
2016
|
+
let { id: n, x: r, y: a, width: o, height: c, headerHeight: l, rowHeight: u, label: d, attributes: f } = e, p = [];
|
|
2017
|
+
p.push(s`<g class="entity" data-id="${i(n)}" data-label="${i(d)}">`), p.push(s` <rect x="${r}" y="${a}" width="${o}" height="${c}" ` + s`rx="0" ry="0" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), p.push(s` <rect x="${r}" y="${a}" width="${o}" height="${l}" ` + s`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), p.push(" " + _(d, r + o / 2, a + l / 2, t.nodeLabel, s`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="var(--_text)"`));
|
|
2018
|
+
let m = a + l;
|
|
2019
|
+
p.push(s` <line x1="${r}" y1="${m}" x2="${r + o}" y2="${m}" ` + s`stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`);
|
|
2020
|
+
for (let e = 0; e < f.length; e++) {
|
|
2021
|
+
let t = f[e], n = m + e * u + u / 2;
|
|
2022
|
+
p.push(" " + xr(t, r, n, o).replace(/\n/g, "\n "));
|
|
2016
2023
|
}
|
|
2017
|
-
return
|
|
2024
|
+
return f.length === 0 && p.push(s` <text x="${r + o / 2}" y="${m + u / 2}" text-anchor="middle" dy="${R}" ` + s`font-size="${G.attrSize}" fill="var(--_text-faint)" font-style="italic">(no attributes)</text>`), p.push("</g>"), p.join("\n");
|
|
2018
2025
|
}
|
|
2019
|
-
function
|
|
2026
|
+
function xr(e, t, n, r) {
|
|
2020
2027
|
let i = [], a = e.comment && e.comment.length > 0;
|
|
2021
2028
|
if (e.comment && e.comment.length > 0) {
|
|
2022
2029
|
let t = e.comment.replace(/<br\s*\/?>/gi, "\n");
|
|
2023
|
-
i.push(`<g><title>${
|
|
2030
|
+
i.push(s`<g><title>${Dr(t)}</title>`);
|
|
2024
2031
|
}
|
|
2025
2032
|
let o = 0;
|
|
2026
|
-
e.keys.length > 0 && (o = M(e.keys.join(","),
|
|
2027
|
-
let
|
|
2028
|
-
i.push(`<text x="${
|
|
2029
|
-
let
|
|
2030
|
-
return i.push(`<text x="${
|
|
2033
|
+
e.keys.length > 0 && (o = M(e.keys.join(","), G.keySize, G.keyWeight) + 8, i.push(s`<rect x="${t + 6}" y="${n - 7}" width="${o}" height="14" rx="2" ry="2" ` + "fill=\"var(--_key-badge)\" />"), i.push(s`<text x="${t + 6 + o / 2}" y="${n}" text-anchor="middle" dy="${R}" ` + s`font-size="${G.keySize}" font-weight="${G.keyWeight}" fill="var(--_text-sec)">${e.keys.join(",")}</text>`));
|
|
2034
|
+
let c = t + 8 + (o > 0 ? o + 6 : 0);
|
|
2035
|
+
i.push(s`<text x="${c}" y="${n}" class="mono" dy="${R}" ` + s`font-size="${G.attrSize}" font-weight="${G.attrWeight}">` + s`<tspan fill="var(--_text-muted)">${Dr(e.type)}</tspan></text>`);
|
|
2036
|
+
let l = t + r - 8;
|
|
2037
|
+
return i.push(s`<text x="${l}" y="${n}" class="mono" text-anchor="end" dy="${R}" ` + s`font-size="${G.attrSize}" font-weight="${G.attrWeight}">` + s`<tspan fill="var(--_text-sec)">${Dr(e.name)}</tspan></text>`), a && i.push("</g>"), i.join("\n");
|
|
2031
2038
|
}
|
|
2032
|
-
function
|
|
2039
|
+
function Sr(e) {
|
|
2033
2040
|
if (e.points.length < 2) return "";
|
|
2034
|
-
let t = e.points.map((e) => `${e.x},${e.y}`).join(" "), n = e.identifying ? "" : " stroke-dasharray=\"6 4\"", r = e.label ? ` data-label="${
|
|
2035
|
-
return `<polyline ${[
|
|
2041
|
+
let t = e.points.map((e) => s`${e.x},${e.y}`).join(" "), n = e.identifying ? "" : " stroke-dasharray=\"6 4\"", r = e.label ? s` data-label="${i(e.label)}"` : "", a = [
|
|
2036
2042
|
"class=\"er-relationship\"",
|
|
2037
|
-
`data-entity1="${
|
|
2038
|
-
`data-entity2="${
|
|
2039
|
-
`data-cardinality1="${e.cardinality1}"`,
|
|
2040
|
-
`data-cardinality2="${e.cardinality2}"`,
|
|
2041
|
-
`data-identifying="${e.identifying}"`
|
|
2042
|
-
]
|
|
2043
|
+
s`data-entity1="${i(e.entity1)}"`,
|
|
2044
|
+
s`data-entity2="${i(e.entity2)}"`,
|
|
2045
|
+
s`data-cardinality1="${e.cardinality1}"`,
|
|
2046
|
+
s`data-cardinality2="${e.cardinality2}"`,
|
|
2047
|
+
s`data-identifying="${e.identifying}"`
|
|
2048
|
+
];
|
|
2049
|
+
return s`<polyline ${a.join(" ")}${r} points="${t}" fill="none" stroke="var(--_line)" ` + s`stroke-width="${L.connector}"${n} />`;
|
|
2043
2050
|
}
|
|
2044
|
-
function
|
|
2051
|
+
function Cr(e, t) {
|
|
2045
2052
|
if (!e.label || e.points.length < 2) return "";
|
|
2046
|
-
let n =
|
|
2047
|
-
return `<rect x="${n.x - i / 2}" y="${n.y - a / 2}" width="${i}" height="${a}" rx="2" ry="2" fill
|
|
2053
|
+
let n = Er(e.points), r = d(e.label, t.edgeLabel, F.edgeLabel), i = r.width + 8, a = r.height + 6;
|
|
2054
|
+
return s`<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\" />" + s`\n${_(e.label, n.x, n.y, t.edgeLabel, s`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`)}`;
|
|
2048
2055
|
}
|
|
2049
|
-
function
|
|
2056
|
+
function wr(e) {
|
|
2050
2057
|
if (e.points.length < 2) return "";
|
|
2051
2058
|
let t = [], n = e.points[0], r = e.points[1];
|
|
2052
|
-
t.push(
|
|
2059
|
+
t.push(Tr(n, r, e.cardinality1));
|
|
2053
2060
|
let i = e.points[e.points.length - 1], a = e.points[e.points.length - 2];
|
|
2054
|
-
return t.push(
|
|
2061
|
+
return t.push(Tr(i, a, e.cardinality2)), t.join("\n");
|
|
2055
2062
|
}
|
|
2056
|
-
function
|
|
2057
|
-
let r = [], i = L.connector + .25, a = e.x - t.x, o = e.y - t.y,
|
|
2058
|
-
if (
|
|
2059
|
-
let
|
|
2060
|
-
if (g) {
|
|
2061
|
-
r.push(`<line x1="${f + u * 6}" y1="${p + d * 6}" x2="${f - u * 6}" y2="${p - d * 6}" stroke="var(--_line)" stroke-width="${i}" />`);
|
|
2062
|
-
let e = f - c * 4, t = p - l * 4;
|
|
2063
|
-
r.push(`<line x1="${e + u * 6}" y1="${t + d * 6}" x2="${e - u * 6}" y2="${t - d * 6}" stroke="var(--_line)" stroke-width="${i}" />`);
|
|
2064
|
-
}
|
|
2063
|
+
function Tr(e, t, n) {
|
|
2064
|
+
let r = [], i = L.connector + .25, a = e.x - t.x, o = e.y - t.y, c = Math.sqrt(a * a + o * o);
|
|
2065
|
+
if (c === 0) return "";
|
|
2066
|
+
let l = a / c, u = o / c, d = -u, f = l, p = e.x - l * 4, m = e.y - u * 4, h = e.x - l * 16, g = e.y - u * 16, _ = n === "one" || n === "zero-one", v = n === "many" || n === "zero-many", y = n === "zero-one" || n === "zero-many";
|
|
2065
2067
|
if (_) {
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
+
r.push(s`<line x1="${p + d * 6}" y1="${m + f * 6}" ` + s`x2="${p - d * 6}" y2="${m - f * 6}" ` + s`stroke="var(--_line)" stroke-width="${i}" />`);
|
|
2069
|
+
let e = p - l * 4, t = m - u * 4;
|
|
2070
|
+
r.push(s`<line x1="${e + d * 6}" y1="${t + f * 6}" ` + s`x2="${e - d * 6}" y2="${t - f * 6}" ` + s`stroke="var(--_line)" stroke-width="${i}" />`);
|
|
2068
2071
|
}
|
|
2069
2072
|
if (v) {
|
|
2070
|
-
let
|
|
2071
|
-
r.push(`<
|
|
2073
|
+
let e = p, t = m;
|
|
2074
|
+
r.push(s`<line x1="${e + d * 7}" y1="${t + f * 7}" ` + s`x2="${h}" y2="${g}" ` + s`stroke="var(--_line)" stroke-width="${i}" />`), r.push(s`<line x1="${e}" y1="${t}" ` + s`x2="${h}" y2="${g}" ` + s`stroke="var(--_line)" stroke-width="${i}" />`), r.push(s`<line x1="${e - d * 7}" y1="${t - f * 7}" ` + s`x2="${h}" y2="${g}" ` + s`stroke="var(--_line)" stroke-width="${i}" />`);
|
|
2075
|
+
}
|
|
2076
|
+
if (n === "many") {
|
|
2077
|
+
let t = e.x - l * 20, n = e.y - u * 20;
|
|
2078
|
+
r.push(s`<line x1="${t + d * 6}" y1="${n + f * 6}" ` + s`x2="${t - d * 6}" y2="${n - f * 6}" ` + s`stroke="var(--_line)" stroke-width="${i}" />`);
|
|
2079
|
+
}
|
|
2080
|
+
if (y) {
|
|
2081
|
+
let t = v ? 20 : 12, n = e.x - l * t, a = e.y - u * t;
|
|
2082
|
+
r.push(s`<circle cx="${n}" cy="${a}" r="4" ` + s`fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`);
|
|
2072
2083
|
}
|
|
2073
2084
|
return r.join("\n");
|
|
2074
2085
|
}
|
|
2075
|
-
function
|
|
2086
|
+
function Er(e) {
|
|
2076
2087
|
if (e.length === 0) return {
|
|
2077
2088
|
x: 0,
|
|
2078
2089
|
y: 0
|
|
@@ -2098,7 +2109,7 @@ function _r(e) {
|
|
|
2098
2109
|
}
|
|
2099
2110
|
return e[e.length - 1];
|
|
2100
2111
|
}
|
|
2101
|
-
var
|
|
2112
|
+
var Dr = a, Or = {
|
|
2102
2113
|
padding: 30,
|
|
2103
2114
|
actorGap: 140,
|
|
2104
2115
|
actorHeight: 40,
|
|
@@ -2120,20 +2131,20 @@ var vr = o, J = {
|
|
|
2120
2131
|
noteStackGap: 4,
|
|
2121
2132
|
boxPad: 10
|
|
2122
2133
|
};
|
|
2123
|
-
function
|
|
2134
|
+
function kr(e) {
|
|
2124
2135
|
return e + 8;
|
|
2125
2136
|
}
|
|
2126
|
-
function
|
|
2137
|
+
function Ar(e) {
|
|
2127
2138
|
return {
|
|
2128
|
-
...
|
|
2129
|
-
actorHeight: e?.actorHeight ??
|
|
2130
|
-
headerGap: e?.headerGap ??
|
|
2131
|
-
messageRowHeight: e?.messageRowHeight ??
|
|
2132
|
-
noteOffsetAfterMessage: e?.noteOffsetAfterMessage ??
|
|
2133
|
-
noteStackGap: e?.noteStackGap ??
|
|
2139
|
+
...Or,
|
|
2140
|
+
actorHeight: e?.actorHeight ?? Or.actorHeight,
|
|
2141
|
+
headerGap: e?.headerGap ?? Or.headerGap,
|
|
2142
|
+
messageRowHeight: e?.messageRowHeight ?? Or.messageRowHeight,
|
|
2143
|
+
noteOffsetAfterMessage: e?.noteOffsetAfterMessage ?? Or.noteOffsetAfterMessage,
|
|
2144
|
+
noteStackGap: e?.noteStackGap ?? Or.noteStackGap
|
|
2134
2145
|
};
|
|
2135
2146
|
}
|
|
2136
|
-
function
|
|
2147
|
+
function jr(e, t = {}) {
|
|
2137
2148
|
if (e.actors.length === 0) return {
|
|
2138
2149
|
width: 0,
|
|
2139
2150
|
height: 0,
|
|
@@ -2145,7 +2156,7 @@ function xr(e, t = {}) {
|
|
|
2145
2156
|
notes: [],
|
|
2146
2157
|
boxes: []
|
|
2147
2158
|
};
|
|
2148
|
-
let n =
|
|
2159
|
+
let n = Ar(t.sequence), r = P(t.fontSizes), i = e.actors.map((e) => {
|
|
2149
2160
|
let t = M(e.label, r.nodeLabel, F.nodeLabel);
|
|
2150
2161
|
return Math.max(t + n.actorPadX * 2, 80);
|
|
2151
2162
|
}), a = [], o = n.padding + i[0] / 2;
|
|
@@ -2158,7 +2169,7 @@ function xr(e, t = {}) {
|
|
|
2158
2169
|
}
|
|
2159
2170
|
let s = /* @__PURE__ */ new Map();
|
|
2160
2171
|
for (let t = 0; t < e.actors.length; t++) s.set(e.actors[t].id, t);
|
|
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 ?
|
|
2172
|
+
let c = e.boxes.filter((e) => e.actorIds.length > 0), l = c.some((e) => e.label !== ""), u = c.length === 0 ? 0 : n.boxPad + (l ? kr(r.edgeLabel) : 0), d = n.padding + u, f = e.actors.map((e, t) => ({
|
|
2162
2173
|
id: e.id,
|
|
2163
2174
|
label: e.label,
|
|
2164
2175
|
type: e.type,
|
|
@@ -2373,83 +2384,83 @@ function xr(e, t = {}) {
|
|
|
2373
2384
|
}
|
|
2374
2385
|
//#endregion
|
|
2375
2386
|
//#region packages/svg-renderer/src/sequence/renderer.ts
|
|
2376
|
-
function
|
|
2387
|
+
function Mr(e, t, r = "Inter", i = !1, a = N, o, s, c, l = {}) {
|
|
2377
2388
|
let u = [];
|
|
2378
|
-
u.push(
|
|
2379
|
-
for (let t of e.boxes) u.push(
|
|
2380
|
-
for (let t of e.blocks) u.push(
|
|
2381
|
-
for (let t of e.lifelines) u.push(
|
|
2382
|
-
for (let t of e.activations) u.push(
|
|
2383
|
-
for (let t of e.messages) u.push(
|
|
2384
|
-
for (let t of e.notes) u.push(
|
|
2385
|
-
for (let t of e.actors) u.push(
|
|
2389
|
+
u.push(H(E(e.width, e.height, t, i, s, c, void 0, l.styleAttribute), o)), u.push(n(r, !1, l.nonce)), u.push("<defs>"), u.push(Nr()), u.push("</defs>");
|
|
2390
|
+
for (let t of e.boxes) u.push(Vr(t, a));
|
|
2391
|
+
for (let t of e.blocks) u.push(Hr(t, a));
|
|
2392
|
+
for (let t of e.lifelines) u.push(Fr(t));
|
|
2393
|
+
for (let t of e.activations) u.push(Lr(t));
|
|
2394
|
+
for (let t of e.messages) u.push(Rr(t, a));
|
|
2395
|
+
for (let t of e.notes) u.push(Ur(t, a));
|
|
2396
|
+
for (let t of e.actors) u.push(Pr(t, a));
|
|
2386
2397
|
return u.push("</svg>"), u.join("\n");
|
|
2387
2398
|
}
|
|
2388
|
-
function
|
|
2399
|
+
function Nr() {
|
|
2389
2400
|
let e = z.width, t = z.height;
|
|
2390
|
-
return ` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t / 2}" orient="auto-start-reverse"
|
|
2401
|
+
return s` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t / 2}" orient="auto-start-reverse">` + s`\n <polygon points="0 0, ${e} ${t / 2}, 0 ${t}" fill="var(--_arrow)" />` + "\n </marker>" + s`\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t / 2}" orient="auto-start-reverse">` + s`\n <polyline points="0 0, ${e} ${t / 2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />` + "\n </marker>";
|
|
2391
2402
|
}
|
|
2392
|
-
function
|
|
2393
|
-
let { id: n, x: r, y:
|
|
2394
|
-
if (
|
|
2395
|
-
let e =
|
|
2396
|
-
|
|
2403
|
+
function Pr(e, t) {
|
|
2404
|
+
let { id: n, x: r, y: a, width: o, height: c, label: l, type: u } = e, d = [];
|
|
2405
|
+
if (d.push(s`<g class="actor" data-id="${i(n)}" data-label="${i(l)}" data-type="${u}">`), u === "actor") {
|
|
2406
|
+
let e = c / 24 * .9, n = r - 12 * e, i = a + (c - 24 * e) / 2, o = L.outerBox / e, u = "var(--_line)";
|
|
2407
|
+
d.push(s` <g transform="translate(${n},${i}) scale(${e})">` + s`\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="${u}" stroke-width="${o}" />` + s`\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="${u}" stroke-width="${o}" />` + s`\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="${u}" stroke-width="${o}" />` + "\n </g>"), d.push(" " + _(l, r, a + c + 14, t.nodeLabel, s`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${F.nodeLabel}" fill="var(--_text)"`));
|
|
2397
2408
|
} else {
|
|
2398
2409
|
let e = r - o / 2;
|
|
2399
|
-
|
|
2410
|
+
d.push(s` <rect x="${e}" y="${a}" width="${o}" height="${c}" rx="4" ry="4" ` + s`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), d.push(" " + _(l, r, a + c / 2, t.nodeLabel, s`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${F.nodeLabel}" fill="var(--_text)"`));
|
|
2400
2411
|
}
|
|
2401
|
-
return
|
|
2412
|
+
return d.push("</g>"), d.join("\n");
|
|
2402
2413
|
}
|
|
2403
|
-
function
|
|
2404
|
-
let t = `<line class="lifeline" data-actor="${
|
|
2414
|
+
function Fr(e) {
|
|
2415
|
+
let t = s`<line class="lifeline" data-actor="${i(e.actorId)}" ` + s`x1="${e.x}" y1="${e.topY}" x2="${e.x}" y2="${e.bottomY}" ` + "stroke=\"var(--_line)\" stroke-width=\"0.75\" stroke-dasharray=\"6 4\" />";
|
|
2405
2416
|
if (!e.destroyed) return t;
|
|
2406
|
-
let { x: n, bottomY: r } = e,
|
|
2407
|
-
return t + `\n<path class="destroy" data-actor="${
|
|
2417
|
+
let { x: n, bottomY: r } = e, a = Ir;
|
|
2418
|
+
return t + s`\n<path class="destroy" data-actor="${i(e.actorId)}" ` + s`d="M${n - a} ${r - a} L${n + a} ${r + a} M${n + a} ${r - a} L${n - a} ${r + a}" ` + s`fill="none" stroke="var(--_line)" stroke-width="${L.outerBox}" stroke-linecap="round" />`;
|
|
2408
2419
|
}
|
|
2409
|
-
var
|
|
2410
|
-
function
|
|
2411
|
-
return `<rect class="activation" data-actor="${
|
|
2420
|
+
var Ir = 8;
|
|
2421
|
+
function Lr(e) {
|
|
2422
|
+
return s`<rect class="activation" data-actor="${i(e.actorId)}" ` + s`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY - e.topY}" ` + s`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`;
|
|
2412
2423
|
}
|
|
2413
|
-
function
|
|
2414
|
-
let n = [], r = e.lineStyle === "dashed" ? " stroke-dasharray=\"6 4\"" : "",
|
|
2415
|
-
if (n.push(`<g class="message" data-from="${
|
|
2424
|
+
function Rr(e, t) {
|
|
2425
|
+
let n = [], r = e.lineStyle === "dashed" ? " stroke-dasharray=\"6 4\"" : "", a = e.arrowHead === "filled" ? "seq-arrow" : "seq-arrow-open", o = e.bidirectional ? s` marker-start="url(#${a})"` : "";
|
|
2426
|
+
if (n.push(s`<g class="message" data-from="${i(e.from)}" data-to="${i(e.to)}" ` + s`data-label="${i(e.label)}" data-line-style="${e.lineStyle}" ` + s`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`), e.isSelf) n.push(s` <polyline points="${e.x1},${e.y} ${e.x1 + 30},${e.y} ${e.x1 + 30},${e.y + 20} ${e.x2},${e.y + 20}" ` + s`fill="none" stroke="var(--_line)" stroke-width="${L.connector}"${r} marker-end="url(#${a})"${o} />`), n.push(" " + _(e.label, e.x1 + 30 + 8, e.y + 10, t.edgeLabel, s`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
2416
2427
|
else {
|
|
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(#${
|
|
2418
|
-
let
|
|
2419
|
-
n.push(" " + _(e.label,
|
|
2428
|
+
n.push(s` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" ` + s`stroke="var(--_line)" stroke-width="${L.connector}"${r} marker-end="url(#${a})"${o} />`);
|
|
2429
|
+
let i = (e.x1 + e.x2) / 2;
|
|
2430
|
+
n.push(" " + _(e.label, i, e.y - 10, t.edgeLabel, s`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
2420
2431
|
}
|
|
2421
|
-
return e.seqNumber !== void 0 && n.push(" " +
|
|
2432
|
+
return e.seqNumber !== void 0 && n.push(" " + zr(e, t)), n.push("</g>"), n.join("\n");
|
|
2422
2433
|
}
|
|
2423
|
-
function
|
|
2434
|
+
function zr(e, t) {
|
|
2424
2435
|
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
|
|
2426
|
-
}
|
|
2427
|
-
var
|
|
2428
|
-
function
|
|
2429
|
-
let n = e.label ? ` data-label="${
|
|
2430
|
-
return e.label && o.push(" " + _(e.label, e.x + e.width / 2, e.y +
|
|
2431
|
-
}
|
|
2432
|
-
function
|
|
2433
|
-
let n = [], r = e.label ? ` data-label="${
|
|
2434
|
-
n.push(`<g class="block" data-type="${
|
|
2435
|
-
let
|
|
2436
|
-
n.push(` <rect x="${e.x}" y="${e.y}" width="${
|
|
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
|
|
2436
|
+
return "<g class=\"seq-number\">" + s`<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, s`font-size="${n}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_arrow)"`) + "</g>";
|
|
2437
|
+
}
|
|
2438
|
+
var Br = 35;
|
|
2439
|
+
function Vr(e, t) {
|
|
2440
|
+
let n = e.label ? s` data-label="${i(e.label)}"` : "", r = e.color === void 0 ? "" : s` data-color="${i(e.color)}"`, a = e.color === void 0 ? "none" : s`color-mix(in srgb, ${i(e.color)} ${Br}%, var(--bg))`, o = [s`<g class="participant-box"${n}${r}>`, s` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" ` + s`fill="${a}" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`];
|
|
2441
|
+
return e.label && o.push(" " + _(e.label, e.x + e.width / 2, e.y + kr(t.edgeLabel) / 2, t.edgeLabel, s`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.groupHeader}" fill="var(--_text-sec)"`)), o.push("</g>"), o.join("\n");
|
|
2442
|
+
}
|
|
2443
|
+
function Hr(e, t) {
|
|
2444
|
+
let n = [], r = e.label ? s` data-label="${i(e.label)}"` : "";
|
|
2445
|
+
n.push(s`<g class="block" data-type="${i(e.type)}"${r}>`), n.push(s` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" ` + s`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`);
|
|
2446
|
+
let a = s`${e.type}${e.label ? s` [${e.label}]` : ""}`, o = a.split("\n")[0], c = M(o, t.edgeLabel, F.groupHeader) + 16;
|
|
2447
|
+
n.push(s` <rect x="${e.x}" y="${e.y}" width="${c}" height="${18}" ` + s`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`), n.push(" " + _(a, e.x + 6, e.y + 9, t.edgeLabel, s`font-size="${t.edgeLabel}" font-weight="${F.groupHeader}" fill="var(--_text-sec)"`));
|
|
2448
|
+
for (let r of e.dividers) n.push(s` <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(" " + _(s`[${r.label}]`, e.x + 8, r.y + 14, t.edgeLabel, s`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`));
|
|
2438
2449
|
return n.push("</g>"), n.join("\n");
|
|
2439
2450
|
}
|
|
2440
|
-
function
|
|
2441
|
-
let { x: n, y: r, width:
|
|
2442
|
-
|
|
2443
|
-
`${n},${r}`,
|
|
2444
|
-
`${n +
|
|
2445
|
-
`${n +
|
|
2446
|
-
`${n
|
|
2447
|
-
|
|
2448
|
-
|
|
2451
|
+
function Ur(e, t) {
|
|
2452
|
+
let { x: n, y: r, width: a, height: o } = e, c = e.actors && e.actors.length > 0 ? s` data-actors="${e.actors.map(i).join(",")}"` : "", l = e.position ? s` data-position="${i(e.position)}"` : "", u = [
|
|
2453
|
+
s`${n},${r}`,
|
|
2454
|
+
s`${n + a - 6},${r}`,
|
|
2455
|
+
s`${n + a},${r + 6}`,
|
|
2456
|
+
s`${n + a},${r + o}`,
|
|
2457
|
+
s`${n},${r + o}`
|
|
2458
|
+
].join(" ");
|
|
2459
|
+
return s`<g class="note"${l}${c}>` + s`\n <polygon points="${u}" ` + s`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />` + s`\n <polygon points="${n + a - 6},${r} ${n + a},${r + 6} ${n + a - 6},${r + 6}" ` + s`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />` + s`\n ${_(e.text, n + a / 2, r + o / 2, t.edgeLabel, s`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${F.edgeLabel}" fill="var(--_text-muted)"`)}` + "\n</g>";
|
|
2449
2460
|
}
|
|
2450
2461
|
//#endregion
|
|
2451
2462
|
//#region packages/svg-renderer/src/xychart/layout.ts
|
|
2452
|
-
var
|
|
2463
|
+
var K = {
|
|
2453
2464
|
plotWidth: 600,
|
|
2454
2465
|
plotHeight: 340,
|
|
2455
2466
|
padding: 22,
|
|
@@ -2476,241 +2487,241 @@ var Y = {
|
|
|
2476
2487
|
legendGap: 6,
|
|
2477
2488
|
legendItemGap: 16
|
|
2478
2489
|
};
|
|
2479
|
-
function
|
|
2480
|
-
return e.horizontal ?
|
|
2490
|
+
function Wr(e, t = {}) {
|
|
2491
|
+
return e.horizontal ? Kr(e) : Gr(e);
|
|
2481
2492
|
}
|
|
2482
|
-
function
|
|
2493
|
+
function Gr(e) {
|
|
2483
2494
|
let t = !!e.title, n = !!e.xAxis.title, r = !!e.yAxis.title, i = e.series.length > 1, a = e.yAxis.range;
|
|
2484
2495
|
if (!a)
|
|
2485
2496
|
/* v8 ignore next */
|
|
2486
2497
|
throw Error("XY chart: y-axis range was not set by the parser");
|
|
2487
|
-
let o =
|
|
2488
|
-
x:
|
|
2489
|
-
y:
|
|
2490
|
-
width:
|
|
2491
|
-
height:
|
|
2492
|
-
},
|
|
2498
|
+
let o = Qr(a.min, a.max), s = $r(o), c = Math.max(...s.map((e) => M(e, K.axisLabelFontSize, K.axisLabelFontWeight)), K.yLabelWidth), l = K.padding + (t ? K.titleHeight : 0) + (i ? K.legendHeight : 0), u = K.padding + K.xLabelHeight + (n ? K.axisTitlePad : 0), d = K.padding + c + K.yLabelGap + (r ? K.axisTitlePad : 0), f = K.padding, p = K.plotWidth, m = K.plotHeight, h = d + p + f, g = l + m + u, _ = {
|
|
2499
|
+
x: d,
|
|
2500
|
+
y: l,
|
|
2501
|
+
width: p,
|
|
2502
|
+
height: m
|
|
2503
|
+
}, v = qr(e), y = (e) => d + (e + .5) * (p / v), b = p / v, x = (e) => {
|
|
2493
2504
|
let t = (e - a.min) / (a.max - a.min || 1);
|
|
2494
|
-
return
|
|
2495
|
-
},
|
|
2496
|
-
label:
|
|
2497
|
-
x:
|
|
2498
|
-
y:
|
|
2499
|
-
tx:
|
|
2500
|
-
ty:
|
|
2501
|
-
labelX:
|
|
2502
|
-
labelY:
|
|
2505
|
+
return l + m - t * m;
|
|
2506
|
+
}, S = Yr(e, y, l + m, b), C = o.map((e, t) => ({
|
|
2507
|
+
label: s[t],
|
|
2508
|
+
x: d,
|
|
2509
|
+
y: x(e),
|
|
2510
|
+
tx: d - K.tickLength,
|
|
2511
|
+
ty: x(e),
|
|
2512
|
+
labelX: d - K.yLabelGap,
|
|
2513
|
+
labelY: x(e),
|
|
2503
2514
|
textAnchor: "end"
|
|
2504
|
-
})),
|
|
2505
|
-
x1:
|
|
2506
|
-
y1:
|
|
2507
|
-
x2:
|
|
2508
|
-
y2:
|
|
2509
|
-
})),
|
|
2510
|
-
x1:
|
|
2511
|
-
y1:
|
|
2512
|
-
x2:
|
|
2513
|
-
y2:
|
|
2514
|
-
}, j = {
|
|
2515
|
-
x1: u,
|
|
2516
|
-
y1: c,
|
|
2517
|
-
x2: u,
|
|
2518
|
-
y2: c + p
|
|
2515
|
+
})), w = o.map((e) => ({
|
|
2516
|
+
x1: d,
|
|
2517
|
+
y1: x(e),
|
|
2518
|
+
x2: d + p,
|
|
2519
|
+
y2: x(e)
|
|
2520
|
+
})), T = Jr(e, v), E = e.series.map((e, t) => t), D = Xr(e, y, x, b, a.min, T, E), O = Zr(e, y, x, T, E), k = K.padding + (t ? K.titleHeight : 0) + K.legendHeight / 2, A = i ? ti(e, h / 2, k, E) : [], j = {
|
|
2521
|
+
x1: d,
|
|
2522
|
+
y1: l + m,
|
|
2523
|
+
x2: d + p,
|
|
2524
|
+
y2: l + m
|
|
2519
2525
|
}, ee = {
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
x: u + f / 2,
|
|
2525
|
-
y: h - Y.padding
|
|
2526
|
-
} } : {}
|
|
2526
|
+
x1: d,
|
|
2527
|
+
y1: l,
|
|
2528
|
+
x2: d,
|
|
2529
|
+
y2: l + m
|
|
2527
2530
|
}, te = {
|
|
2528
2531
|
ticks: S,
|
|
2529
2532
|
line: j,
|
|
2533
|
+
...e.xAxis.title ? { title: {
|
|
2534
|
+
text: e.xAxis.title,
|
|
2535
|
+
x: d + p / 2,
|
|
2536
|
+
y: g - K.padding
|
|
2537
|
+
} } : {}
|
|
2538
|
+
}, ne = {
|
|
2539
|
+
ticks: C,
|
|
2540
|
+
line: ee,
|
|
2530
2541
|
...e.yAxis.title ? { title: {
|
|
2531
2542
|
text: e.yAxis.title,
|
|
2532
|
-
x:
|
|
2533
|
-
y:
|
|
2543
|
+
x: K.padding + 4,
|
|
2544
|
+
y: l + m / 2,
|
|
2534
2545
|
rotate: -90
|
|
2535
2546
|
} } : {}
|
|
2536
2547
|
};
|
|
2537
2548
|
return {
|
|
2538
|
-
width:
|
|
2539
|
-
height:
|
|
2549
|
+
width: h,
|
|
2550
|
+
height: g,
|
|
2540
2551
|
title: e.title ? {
|
|
2541
2552
|
text: e.title,
|
|
2542
|
-
x:
|
|
2543
|
-
y:
|
|
2553
|
+
x: h / 2,
|
|
2554
|
+
y: K.padding + K.titleFontSize
|
|
2544
2555
|
} : void 0,
|
|
2545
|
-
xAxis:
|
|
2546
|
-
yAxis:
|
|
2547
|
-
plotArea:
|
|
2548
|
-
bars:
|
|
2549
|
-
lines:
|
|
2550
|
-
gridLines:
|
|
2551
|
-
legend:
|
|
2556
|
+
xAxis: te,
|
|
2557
|
+
yAxis: ne,
|
|
2558
|
+
plotArea: _,
|
|
2559
|
+
bars: D,
|
|
2560
|
+
lines: O,
|
|
2561
|
+
gridLines: w,
|
|
2562
|
+
legend: A
|
|
2552
2563
|
};
|
|
2553
2564
|
}
|
|
2554
|
-
function
|
|
2565
|
+
function Kr(e) {
|
|
2555
2566
|
let t = !!e.title, n = !!e.xAxis.title, r = !!e.yAxis.title, i = e.series.length > 1, a = e.yAxis.range;
|
|
2556
2567
|
if (!a)
|
|
2557
2568
|
/* v8 ignore next */
|
|
2558
2569
|
throw Error("XY chart: y-axis range was not set by the parser");
|
|
2559
|
-
let o =
|
|
2560
|
-
x:
|
|
2561
|
-
y:
|
|
2562
|
-
width:
|
|
2563
|
-
height:
|
|
2564
|
-
},
|
|
2570
|
+
let o = Qr(a.min, a.max), s = $r(o), c = qr(e), l = Jr(e, c), u = Math.max(...l.map((e) => M(e, K.axisLabelFontSize, K.axisLabelFontWeight)), 40), d = K.padding + (t ? K.titleHeight : 0) + (i ? K.legendHeight : 0), f = K.padding + K.xLabelHeight + (r ? K.axisTitlePad : 0), p = K.padding + u + K.yLabelGap + (n ? K.axisTitlePad : 0), m = K.padding, h = K.plotWidth, g = K.plotHeight, _ = p + h + m, v = d + g + f, y = {
|
|
2571
|
+
x: p,
|
|
2572
|
+
y: d,
|
|
2573
|
+
width: h,
|
|
2574
|
+
height: g
|
|
2575
|
+
}, b = (e) => {
|
|
2565
2576
|
let t = (e - a.min) / (a.max - a.min || 1);
|
|
2566
|
-
return
|
|
2567
|
-
},
|
|
2568
|
-
label:
|
|
2569
|
-
x:
|
|
2570
|
-
y:
|
|
2571
|
-
tx:
|
|
2572
|
-
ty:
|
|
2573
|
-
labelX:
|
|
2574
|
-
labelY:
|
|
2577
|
+
return p + t * h;
|
|
2578
|
+
}, x = g / c, S = (e) => d + (e + .5) * x, C = o.map((e, t) => ({
|
|
2579
|
+
label: s[t],
|
|
2580
|
+
x: b(e),
|
|
2581
|
+
y: d + g,
|
|
2582
|
+
tx: b(e),
|
|
2583
|
+
ty: d + g + K.tickLength,
|
|
2584
|
+
labelX: b(e),
|
|
2585
|
+
labelY: d + g + 18,
|
|
2575
2586
|
textAnchor: "middle"
|
|
2576
|
-
})),
|
|
2587
|
+
})), w = l.map((e, t) => ({
|
|
2577
2588
|
label: e,
|
|
2578
|
-
x:
|
|
2579
|
-
y:
|
|
2580
|
-
tx:
|
|
2581
|
-
ty:
|
|
2582
|
-
labelX:
|
|
2583
|
-
labelY:
|
|
2589
|
+
x: p,
|
|
2590
|
+
y: S(t),
|
|
2591
|
+
tx: p - K.tickLength,
|
|
2592
|
+
ty: S(t),
|
|
2593
|
+
labelX: p - K.yLabelGap,
|
|
2594
|
+
labelY: S(t),
|
|
2584
2595
|
textAnchor: "end"
|
|
2585
|
-
})),
|
|
2586
|
-
x1:
|
|
2587
|
-
y1:
|
|
2588
|
-
x2:
|
|
2589
|
-
y2:
|
|
2590
|
-
})),
|
|
2591
|
-
if (
|
|
2592
|
-
let t =
|
|
2596
|
+
})), T = o.map((e) => ({
|
|
2597
|
+
x1: b(e),
|
|
2598
|
+
y1: d,
|
|
2599
|
+
x2: b(e),
|
|
2600
|
+
y2: d + g
|
|
2601
|
+
})), E = e.series.map((e, t) => t), D = e.series.filter((e) => e.type === "bar").length, O = [];
|
|
2602
|
+
if (D > 0) {
|
|
2603
|
+
let t = x * (1 - K.barPadRatio), n = D > 1 ? (t - (D - 1) * K.barGroupGap) / D : t, r = Math.min(n, K.maxBarWidth), i = D > 1 ? r * D + K.barGroupGap * (D - 1) : r, o = 0, s = 0;
|
|
2593
2604
|
for (let t of e.series) {
|
|
2594
2605
|
if (t.type !== "bar") {
|
|
2595
2606
|
s++;
|
|
2596
2607
|
continue;
|
|
2597
2608
|
}
|
|
2598
2609
|
for (let e = 0; e < t.data.length; e++) {
|
|
2599
|
-
let n =
|
|
2600
|
-
|
|
2601
|
-
x: Math.min(u,
|
|
2610
|
+
let n = S(e) - i / 2 + o * (r + K.barGroupGap), c = b(Math.max(t.data[e], a.min)), u = b(Math.max(0, a.min));
|
|
2611
|
+
O.push({
|
|
2612
|
+
x: Math.min(u, c),
|
|
2602
2613
|
y: n,
|
|
2603
|
-
width: Math.abs(
|
|
2614
|
+
width: Math.abs(c - u),
|
|
2604
2615
|
height: r,
|
|
2605
2616
|
value: t.data[e],
|
|
2606
|
-
label:
|
|
2617
|
+
label: l[e],
|
|
2607
2618
|
seriesIndex: o,
|
|
2608
|
-
colorIndex:
|
|
2619
|
+
colorIndex: E[s]
|
|
2609
2620
|
});
|
|
2610
2621
|
}
|
|
2611
2622
|
o++, s++;
|
|
2612
2623
|
}
|
|
2613
2624
|
}
|
|
2614
|
-
let
|
|
2625
|
+
let k = [], A = 0, j = 0;
|
|
2615
2626
|
for (let t of e.series) {
|
|
2616
2627
|
if (t.type !== "line") {
|
|
2617
|
-
|
|
2628
|
+
j++;
|
|
2618
2629
|
continue;
|
|
2619
2630
|
}
|
|
2620
2631
|
let e = t.data.map((e, t) => ({
|
|
2621
|
-
x:
|
|
2622
|
-
y:
|
|
2632
|
+
x: b(e),
|
|
2633
|
+
y: S(t),
|
|
2623
2634
|
value: e,
|
|
2624
|
-
label:
|
|
2635
|
+
label: l[t]
|
|
2625
2636
|
}));
|
|
2626
|
-
|
|
2637
|
+
k.push({
|
|
2627
2638
|
points: e,
|
|
2628
|
-
seriesIndex:
|
|
2629
|
-
colorIndex:
|
|
2630
|
-
}),
|
|
2631
|
-
}
|
|
2632
|
-
let
|
|
2633
|
-
x1:
|
|
2634
|
-
y1:
|
|
2635
|
-
x2:
|
|
2636
|
-
y2:
|
|
2637
|
-
}, ee = {
|
|
2638
|
-
x1: f,
|
|
2639
|
-
y1: u,
|
|
2640
|
-
x2: f,
|
|
2641
|
-
y2: u + h
|
|
2639
|
+
seriesIndex: A,
|
|
2640
|
+
colorIndex: E[j]
|
|
2641
|
+
}), A++, j++;
|
|
2642
|
+
}
|
|
2643
|
+
let ee = {
|
|
2644
|
+
x1: p,
|
|
2645
|
+
y1: d + g,
|
|
2646
|
+
x2: p + h,
|
|
2647
|
+
y2: d + g
|
|
2642
2648
|
}, te = {
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
x: f + m / 2,
|
|
2648
|
-
y: _ - Y.padding
|
|
2649
|
-
} } : {}
|
|
2649
|
+
x1: p,
|
|
2650
|
+
y1: d,
|
|
2651
|
+
x2: p,
|
|
2652
|
+
y2: d + g
|
|
2650
2653
|
}, ne = {
|
|
2651
2654
|
ticks: C,
|
|
2652
2655
|
line: ee,
|
|
2656
|
+
...e.yAxis.title ? { title: {
|
|
2657
|
+
text: e.yAxis.title,
|
|
2658
|
+
x: p + h / 2,
|
|
2659
|
+
y: v - K.padding
|
|
2660
|
+
} } : {}
|
|
2661
|
+
}, re = {
|
|
2662
|
+
ticks: w,
|
|
2663
|
+
line: te,
|
|
2653
2664
|
...e.xAxis.title ? { title: {
|
|
2654
2665
|
text: e.xAxis.title,
|
|
2655
|
-
x:
|
|
2656
|
-
y:
|
|
2666
|
+
x: K.padding + 4,
|
|
2667
|
+
y: d + g / 2,
|
|
2657
2668
|
rotate: -90
|
|
2658
2669
|
} } : {}
|
|
2659
|
-
},
|
|
2670
|
+
}, ie = e.title ? {
|
|
2660
2671
|
text: e.title,
|
|
2661
|
-
x:
|
|
2662
|
-
y:
|
|
2663
|
-
} : void 0,
|
|
2672
|
+
x: _ / 2,
|
|
2673
|
+
y: K.padding + K.titleFontSize
|
|
2674
|
+
} : void 0, ae = K.padding + (t ? K.titleHeight : 0) + K.legendHeight / 2;
|
|
2664
2675
|
return {
|
|
2665
|
-
width:
|
|
2666
|
-
height:
|
|
2676
|
+
width: _,
|
|
2677
|
+
height: v,
|
|
2667
2678
|
horizontal: !0,
|
|
2668
|
-
title:
|
|
2669
|
-
xAxis:
|
|
2670
|
-
yAxis:
|
|
2671
|
-
plotArea:
|
|
2672
|
-
bars:
|
|
2673
|
-
lines:
|
|
2674
|
-
gridLines:
|
|
2675
|
-
legend: i ?
|
|
2679
|
+
title: ie,
|
|
2680
|
+
xAxis: ne,
|
|
2681
|
+
yAxis: re,
|
|
2682
|
+
plotArea: y,
|
|
2683
|
+
bars: O,
|
|
2684
|
+
lines: k,
|
|
2685
|
+
gridLines: T,
|
|
2686
|
+
legend: i ? ti(e, _ / 2, ae, E) : []
|
|
2676
2687
|
};
|
|
2677
2688
|
}
|
|
2678
|
-
function
|
|
2689
|
+
function qr(e) {
|
|
2679
2690
|
if (e.xAxis.categories) return e.xAxis.categories.length;
|
|
2680
2691
|
for (let t of e.series) if (t.data.length > 0) return t.data.length;
|
|
2681
2692
|
return 1;
|
|
2682
2693
|
}
|
|
2683
|
-
function
|
|
2694
|
+
function Jr(e, t) {
|
|
2684
2695
|
if (e.xAxis.categories) return e.xAxis.categories;
|
|
2685
2696
|
if (e.xAxis.range) {
|
|
2686
2697
|
let { min: n, max: r } = e.xAxis.range, i = t > 1 ? (r - n) / (t - 1) : 0;
|
|
2687
|
-
return Array.from({ length: t }, (e, t) =>
|
|
2698
|
+
return Array.from({ length: t }, (e, t) => ei(n + i * t));
|
|
2688
2699
|
}
|
|
2689
2700
|
return Array.from({ length: t }, (e, t) => String(t + 1));
|
|
2690
2701
|
}
|
|
2691
|
-
function
|
|
2692
|
-
return
|
|
2702
|
+
function Yr(e, t, n, r) {
|
|
2703
|
+
return Jr(e, qr(e)).map((e, r) => ({
|
|
2693
2704
|
label: e,
|
|
2694
2705
|
x: t(r),
|
|
2695
2706
|
y: n,
|
|
2696
2707
|
tx: t(r),
|
|
2697
|
-
ty: n +
|
|
2708
|
+
ty: n + K.tickLength,
|
|
2698
2709
|
labelX: t(r),
|
|
2699
2710
|
labelY: n + 18,
|
|
2700
2711
|
textAnchor: "middle"
|
|
2701
2712
|
}));
|
|
2702
2713
|
}
|
|
2703
|
-
function
|
|
2714
|
+
function Xr(e, t, n, r, i, a, o) {
|
|
2704
2715
|
let s = e.series.filter((e) => e.type === "bar").length;
|
|
2705
2716
|
if (s === 0) return [];
|
|
2706
|
-
let c = r * (1 -
|
|
2717
|
+
let c = r * (1 - K.barPadRatio), l = s > 1 ? (c - (s - 1) * K.barGroupGap) / s : c, u = Math.min(l, K.maxBarWidth), d = s > 1 ? u * s + K.barGroupGap * (s - 1) : u, f = [], p = 0, m = 0;
|
|
2707
2718
|
for (let r of e.series) {
|
|
2708
2719
|
if (r.type !== "bar") {
|
|
2709
2720
|
m++;
|
|
2710
2721
|
continue;
|
|
2711
2722
|
}
|
|
2712
2723
|
for (let e = 0; e < r.data.length; e++) {
|
|
2713
|
-
let s = t(e) - d / 2 + p * (u +
|
|
2724
|
+
let s = t(e) - d / 2 + p * (u + K.barGroupGap), c = n(r.data[e]), l = n(Math.max(0, i));
|
|
2714
2725
|
f.push({
|
|
2715
2726
|
x: s,
|
|
2716
2727
|
y: Math.min(c, l),
|
|
@@ -2726,7 +2737,7 @@ function Br(e, t, n, r, i, a, o) {
|
|
|
2726
2737
|
}
|
|
2727
2738
|
return f;
|
|
2728
2739
|
}
|
|
2729
|
-
function
|
|
2740
|
+
function Zr(e, t, n, r, i) {
|
|
2730
2741
|
let a = [], o = 0, s = 0;
|
|
2731
2742
|
for (let c of e.series) {
|
|
2732
2743
|
if (c.type !== "line") {
|
|
@@ -2747,7 +2758,7 @@ function Vr(e, t, n, r, i) {
|
|
|
2747
2758
|
}
|
|
2748
2759
|
return a;
|
|
2749
2760
|
}
|
|
2750
|
-
function
|
|
2761
|
+
function Qr(e, t) {
|
|
2751
2762
|
let n = t - e;
|
|
2752
2763
|
if (n <= 0) return [e];
|
|
2753
2764
|
let r = n / 6, i = 10 ** Math.floor(Math.log10(r)), a = r / i, o;
|
|
@@ -2756,10 +2767,14 @@ function Hr(e, t) {
|
|
|
2756
2767
|
for (let e = s; e <= t + o * .001; e += o) c.push(Math.round(e * 1e10) / 1e10);
|
|
2757
2768
|
return c;
|
|
2758
2769
|
}
|
|
2759
|
-
function
|
|
2770
|
+
function $r(e) {
|
|
2771
|
+
let t = e.length > 1 ? Math.abs(e[1] - e[0]) : 0, n = t > 0 && t < 1 ? Math.ceil(-Math.log10(t) - 1e-9) : 0;
|
|
2772
|
+
return e.map((e) => String(Number.isInteger(e) && n === 0 ? e : Number(e.toFixed(n))));
|
|
2773
|
+
}
|
|
2774
|
+
function ei(e) {
|
|
2760
2775
|
return Number.isInteger(e) ? String(e) : e.toFixed(+(Math.abs(e) < 10));
|
|
2761
2776
|
}
|
|
2762
|
-
function
|
|
2777
|
+
function ti(e, t, n, r) {
|
|
2763
2778
|
let i = [], a = 0, o = 0;
|
|
2764
2779
|
for (let t = 0; t < e.series.length; t++) {
|
|
2765
2780
|
let s = e.series[t], c = s.type === "bar" ? `Bar ${a + 1}` : `Line ${o + 1}`;
|
|
@@ -2773,15 +2788,15 @@ function Wr(e, t, n, r) {
|
|
|
2773
2788
|
}), s.type === "bar" ? a++ : o++;
|
|
2774
2789
|
}
|
|
2775
2790
|
let s = i.map((e) => {
|
|
2776
|
-
let t = M(e.label,
|
|
2777
|
-
return
|
|
2778
|
-
}), c = t - (s.reduce((e, t) => e + t, 0) + (i.length - 1) *
|
|
2779
|
-
for (let e = 0; e < i.length; e++) i[e].x = c, c += s[e] +
|
|
2791
|
+
let t = M(e.label, K.legendFontSize, K.legendFontWeight);
|
|
2792
|
+
return K.legendSwatchW + K.legendGap + t;
|
|
2793
|
+
}), c = t - (s.reduce((e, t) => e + t, 0) + (i.length - 1) * K.legendItemGap) / 2;
|
|
2794
|
+
for (let e = 0; e < i.length; e++) i[e].x = c, c += s[e] + K.legendItemGap;
|
|
2780
2795
|
return i;
|
|
2781
2796
|
}
|
|
2782
2797
|
//#endregion
|
|
2783
2798
|
//#region packages/svg-renderer/src/xychart/renderer.ts
|
|
2784
|
-
var
|
|
2799
|
+
var q = {
|
|
2785
2800
|
titleSize: 18,
|
|
2786
2801
|
titleWeight: 600,
|
|
2787
2802
|
axisTitleSize: 15,
|
|
@@ -2793,7 +2808,7 @@ var X = {
|
|
|
2793
2808
|
dotRadius: 5,
|
|
2794
2809
|
lineWidth: 2.5,
|
|
2795
2810
|
barRadius: 8
|
|
2796
|
-
},
|
|
2811
|
+
}, J = {
|
|
2797
2812
|
fontSize: 15,
|
|
2798
2813
|
fontWeight: 500,
|
|
2799
2814
|
height: 32,
|
|
@@ -2803,24 +2818,24 @@ var X = {
|
|
|
2803
2818
|
minY: 4,
|
|
2804
2819
|
pointerSize: 6
|
|
2805
2820
|
};
|
|
2806
|
-
function
|
|
2807
|
-
let u = [], d = Math.max(0, ...e.bars.map((e) => e.colorIndex), ...e.lines.map((e) => e.colorIndex)), f =
|
|
2808
|
-
u.push(f), u.push(r
|
|
2809
|
-
let p = Math.max(...e.lines.map((e) => e.points.length), 0), m = p > 0 && p <= 12, { style: h, defs: g } =
|
|
2821
|
+
function ni(e, t, r = "Inter", i = !1, a = !1, o, s, c, l = {}) {
|
|
2822
|
+
let u = [], d = Math.max(0, ...e.bars.map((e) => e.colorIndex), ...e.lines.map((e) => e.colorIndex)), f = H(E(e.width, e.height, t, i, s, c, void 0, l.styleAttribute).replace("<svg ", `<svg data-xychart-colors="${d}" `), o);
|
|
2823
|
+
u.push(f), u.push(n(r, !1, l.nonce));
|
|
2824
|
+
let p = Math.max(...e.lines.map((e) => e.points.length), 0), m = p > 0 && p <= 12, { style: h, defs: g } = ri(e, a, m, t.accent, t.bg, l.nonce);
|
|
2810
2825
|
u.push(h), g && u.push(g);
|
|
2811
2826
|
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="${
|
|
2827
|
+
for (let e = O; e <= _.y + _.height + .5; e += C) for (let t = D; t <= _.x + _.width + .5; t += S) u.push(`<circle cx="${Y(t)}" cy="${Y(e)}" r="1.5" class="xychart-grid"/>`);
|
|
2813
2828
|
let k = [];
|
|
2814
2829
|
for (let t of e.bars) {
|
|
2815
|
-
let n = ` data-value="${t.value}"${t.label ? ` data-label="${
|
|
2830
|
+
let n = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`, r = e.horizontal ? ai(t.x, t.y, t.width, t.height, q.barRadius) : ii(t.x, t.y, t.width, t.height, q.barRadius);
|
|
2816
2831
|
if (u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`), a) {
|
|
2817
|
-
let e =
|
|
2818
|
-
k.push(`<g class="xychart-bar-group"><rect x="${
|
|
2832
|
+
let e = li(t.value), n = t.label ? `${t.label}: ${e}` : e, r = ci(t.x + t.width / 2, t.y, e);
|
|
2833
|
+
k.push(`<g class="xychart-bar-group"><rect x="${Y(t.x)}" y="${Y(t.y)}" width="${Y(t.width)}" height="${Y(t.height)}" fill="transparent"/><title>${X(n)}</title>` + r + "</g>");
|
|
2819
2834
|
}
|
|
2820
2835
|
}
|
|
2821
2836
|
for (let t of e.lines) {
|
|
2822
2837
|
if (t.points.length === 0) continue;
|
|
2823
|
-
let e =
|
|
2838
|
+
let e = oi(t.points);
|
|
2824
2839
|
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}"/>`);
|
|
2825
2840
|
}
|
|
2826
2841
|
let A = [];
|
|
@@ -2829,7 +2844,7 @@ function Gr(e, t, n = "Inter", i = !1, a = !1, o, s, c, l = {}) {
|
|
|
2829
2844
|
for (let n of e.legend) n.type === "line" && t.set(n.seriesIndex, n.label);
|
|
2830
2845
|
let n = /* @__PURE__ */ new Map();
|
|
2831
2846
|
for (let t of e.lines) for (let e of t.points) {
|
|
2832
|
-
let r =
|
|
2847
|
+
let r = Y(e.x), i = n.get(r) ?? [];
|
|
2833
2848
|
n.set(r, i), i.push({
|
|
2834
2849
|
x: e.x,
|
|
2835
2850
|
y: e.y,
|
|
@@ -2842,54 +2857,54 @@ function Gr(e, t, n = "Inter", i = !1, a = !1, o, s, c, l = {}) {
|
|
|
2842
2857
|
for (let e of n.values()) {
|
|
2843
2858
|
let n = e[0].x, r = e[0].label || "";
|
|
2844
2859
|
if (a && e.length > 1) {
|
|
2845
|
-
let i = Math.min(...e.map((e) => e.y)), a = Math.max(...e.map((e) => e.y)), o =
|
|
2846
|
-
text:
|
|
2860
|
+
let i = Math.min(...e.map((e) => e.y)), a = Math.max(...e.map((e) => e.y)), o = q.dotRadius * 3, s = `<rect x="${Y(n - o)}" y="${Y(i - o)}" width="${Y(o * 2)}" height="${Y(a - i + o * 2)}" fill="transparent" class="xychart-hit"/>`, c = e.map((e) => ({
|
|
2861
|
+
text: li(e.value),
|
|
2847
2862
|
legendLabel: t.get(e.seriesIndex) || `Line ${e.seriesIndex + 1}`
|
|
2848
|
-
})), l =
|
|
2863
|
+
})), l = si(n, i - q.dotRadius, r, c), u = c.map((e) => e.text), d = r ? `${r}: ${u.join(" · ")}` : u.join(" · "), f = `<g class="xychart-dot-group">${s}`;
|
|
2849
2864
|
for (let t of e) {
|
|
2850
|
-
let e = ` data-value="${t.value}"${t.label ? ` data-label="${
|
|
2851
|
-
f += `<circle cx="${
|
|
2865
|
+
let e = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`;
|
|
2866
|
+
f += `<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`;
|
|
2852
2867
|
}
|
|
2853
|
-
f += `<title>${
|
|
2868
|
+
f += `<title>${X(d)}</title>${l}</g>`, A.push(f);
|
|
2854
2869
|
} else if (a) {
|
|
2855
|
-
let t = e[0], r = ` data-value="${t.value}"${t.label ? ` data-label="${
|
|
2856
|
-
A.push(`<g class="xychart-dot-group">${s}<circle cx="${
|
|
2870
|
+
let t = e[0], r = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`, i = li(t.value), a = t.label ? `${t.label}: ${i}` : i, o = ci(n, t.y - q.dotRadius, i), s = m ? `<circle cx="${Y(n)}" cy="${Y(t.y)}" r="${q.dotRadius * 3}" fill="transparent" class="xychart-hit"/>` : "";
|
|
2871
|
+
A.push(`<g class="xychart-dot-group">${s}<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${X(a)}</title>${o}</g>`);
|
|
2857
2872
|
} else for (let t of e) {
|
|
2858
|
-
let e = ` data-value="${t.value}"${t.label ? ` data-label="${
|
|
2859
|
-
u.push(`<circle cx="${
|
|
2873
|
+
let e = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`;
|
|
2874
|
+
u.push(`<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`);
|
|
2860
2875
|
}
|
|
2861
2876
|
}
|
|
2862
2877
|
}
|
|
2863
|
-
for (let t of e.xAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${
|
|
2864
|
-
for (let t of e.yAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${
|
|
2878
|
+
for (let t of e.xAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${R}" class="xychart-label">${X(t.label)}</text>`);
|
|
2879
|
+
for (let t of e.yAxis.ticks) u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${R}" class="xychart-label">${X(t.label)}</text>`);
|
|
2865
2880
|
if (e.xAxis.title) {
|
|
2866
2881
|
let t = e.xAxis.title, n = t.rotate ? ` transform="rotate(${t.rotate},${t.x},${t.y})"` : "";
|
|
2867
|
-
u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${
|
|
2882
|
+
u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${R}" class="xychart-axis-title">${X(t.text)}</text>`);
|
|
2868
2883
|
}
|
|
2869
2884
|
if (e.yAxis.title) {
|
|
2870
2885
|
let t = e.yAxis.title, n = t.rotate ? ` transform="rotate(${t.rotate},${t.x},${t.y})"` : "";
|
|
2871
|
-
u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${
|
|
2886
|
+
u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${q.axisTitleSize}" font-weight="${q.axisTitleWeight}" dy="${R}" class="xychart-axis-title">${X(t.text)}</text>`);
|
|
2872
2887
|
}
|
|
2873
|
-
e.title && u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${
|
|
2888
|
+
e.title && u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${q.titleSize}" font-weight="${q.titleWeight}" dy="${R}" class="xychart-title">${X(e.title.text)}</text>`);
|
|
2874
2889
|
for (let t of e.legend) {
|
|
2875
2890
|
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}"/>`);
|
|
2876
2891
|
else {
|
|
2877
2892
|
let e = t.y;
|
|
2878
|
-
u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x + 14}" y2="${e}" stroke-width="${
|
|
2893
|
+
u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x + 14}" y2="${e}" stroke-width="${q.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`);
|
|
2879
2894
|
}
|
|
2880
|
-
u.push(`<text x="${t.x + 14 + 6}" y="${t.y}" text-anchor="start" font-size="${
|
|
2895
|
+
u.push(`<text x="${t.x + 14 + 6}" y="${t.y}" text-anchor="start" font-size="${q.legendSize}" font-weight="${q.legendWeight}" dy="${R}" class="xychart-label">${X(t.label)}</text>`);
|
|
2881
2896
|
}
|
|
2882
2897
|
for (let e of k) u.push(e);
|
|
2883
2898
|
for (let e of A) u.push(e);
|
|
2884
2899
|
return u.push("</svg>"), u.join("\n");
|
|
2885
2900
|
}
|
|
2886
|
-
function
|
|
2887
|
-
let o = r ??
|
|
2901
|
+
function ri(e, t, n, r, i, a) {
|
|
2902
|
+
let o = r ?? ne, s = /* @__PURE__ */ new Set();
|
|
2888
2903
|
for (let t of e.bars) s.add(t.colorIndex);
|
|
2889
2904
|
for (let t of e.lines) s.add(t.colorIndex);
|
|
2890
2905
|
let c = [];
|
|
2891
2906
|
for (let e of [...s].sort((e, t) => e - t)) {
|
|
2892
|
-
let t = e === 0 ? `var(--accent, ${
|
|
2907
|
+
let t = e === 0 ? `var(--accent, ${ne})` : ce(e, o, i);
|
|
2893
2908
|
c.push(` --xychart-color-${e}: ${t};`), c.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`);
|
|
2894
2909
|
}
|
|
2895
2910
|
let l = [];
|
|
@@ -2900,7 +2915,7 @@ function Kr(e, t, n, r, i, a) {
|
|
|
2900
2915
|
let u = t ? `
|
|
2901
2916
|
.xychart-tip { opacity: 0; pointer-events: none; }
|
|
2902
2917
|
.xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
|
|
2903
|
-
.xychart-tip-text { fill: var(--bg); font-size: ${
|
|
2918
|
+
.xychart-tip-text { fill: var(--bg); font-size: ${J.fontSize}px; font-weight: ${J.fontWeight}; }
|
|
2904
2919
|
.xychart-tip-ptr { fill: var(--_text); }
|
|
2905
2920
|
.xychart-bar-group:hover .xychart-tip,
|
|
2906
2921
|
.xychart-dot-group:hover .xychart-tip { opacity: 1; }` : "", d = c.length > 0 ? `\n svg {\n${c.join("\n")}\n }` : "";
|
|
@@ -2908,7 +2923,7 @@ function Kr(e, t, n, r, i, a) {
|
|
|
2908
2923
|
style: `${T(a)}
|
|
2909
2924
|
.xychart-grid { fill: var(--_inner-stroke); stroke: none; opacity: 0.65; }
|
|
2910
2925
|
.xychart-bar { stroke-width: 1.5; }
|
|
2911
|
-
.xychart-line { fill: none; stroke-width: ${
|
|
2926
|
+
.xychart-line { fill: none; stroke-width: ${q.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
|
|
2912
2927
|
.xychart-line-shadow { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.12; }
|
|
2913
2928
|
.xychart-dot { stroke: var(--bg); stroke-width: 2; }
|
|
2914
2929
|
.xychart-label { fill: var(--_text-muted); }
|
|
@@ -2919,97 +2934,545 @@ ${l.join("\n")}${u}
|
|
|
2919
2934
|
defs: ""
|
|
2920
2935
|
};
|
|
2921
2936
|
}
|
|
2922
|
-
function
|
|
2937
|
+
function ii(e, t, n, r, i) {
|
|
2923
2938
|
let a = Math.min(i, n / 2, r / 2);
|
|
2924
|
-
return a <= 0 ? `M${
|
|
2925
|
-
`M${
|
|
2926
|
-
`Q${
|
|
2927
|
-
`L${
|
|
2928
|
-
`Q${
|
|
2929
|
-
`L${
|
|
2930
|
-
`Q${
|
|
2931
|
-
`L${
|
|
2932
|
-
`Q${
|
|
2939
|
+
return a <= 0 ? `M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z` : [
|
|
2940
|
+
`M${Y(e)},${Y(t + a)}`,
|
|
2941
|
+
`Q${Y(e)},${Y(t)} ${Y(e + a)},${Y(t)}`,
|
|
2942
|
+
`L${Y(e + n - a)},${Y(t)}`,
|
|
2943
|
+
`Q${Y(e + n)},${Y(t)} ${Y(e + n)},${Y(t + a)}`,
|
|
2944
|
+
`L${Y(e + n)},${Y(t + r - a)}`,
|
|
2945
|
+
`Q${Y(e + n)},${Y(t + r)} ${Y(e + n - a)},${Y(t + r)}`,
|
|
2946
|
+
`L${Y(e + a)},${Y(t + r)}`,
|
|
2947
|
+
`Q${Y(e)},${Y(t + r)} ${Y(e)},${Y(t + r - a)}`,
|
|
2933
2948
|
"Z"
|
|
2934
2949
|
].join(" ");
|
|
2935
2950
|
}
|
|
2936
|
-
function
|
|
2951
|
+
function ai(e, t, n, r, i) {
|
|
2937
2952
|
let a = Math.min(i, n / 2, r / 2);
|
|
2938
|
-
return a <= 0 ? `M${
|
|
2939
|
-
`M${
|
|
2940
|
-
`L${
|
|
2941
|
-
`Q${
|
|
2942
|
-
`L${
|
|
2943
|
-
`Q${
|
|
2944
|
-
`L${
|
|
2945
|
-
`Q${
|
|
2946
|
-
`L${
|
|
2947
|
-
`Q${
|
|
2953
|
+
return a <= 0 ? `M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z` : [
|
|
2954
|
+
`M${Y(e + a)},${Y(t)}`,
|
|
2955
|
+
`L${Y(e + n - a)},${Y(t)}`,
|
|
2956
|
+
`Q${Y(e + n)},${Y(t)} ${Y(e + n)},${Y(t + a)}`,
|
|
2957
|
+
`L${Y(e + n)},${Y(t + r - a)}`,
|
|
2958
|
+
`Q${Y(e + n)},${Y(t + r)} ${Y(e + n - a)},${Y(t + r)}`,
|
|
2959
|
+
`L${Y(e + a)},${Y(t + r)}`,
|
|
2960
|
+
`Q${Y(e)},${Y(t + r)} ${Y(e)},${Y(t + r - a)}`,
|
|
2961
|
+
`L${Y(e)},${Y(t + a)}`,
|
|
2962
|
+
`Q${Y(e)},${Y(t)} ${Y(e + a)},${Y(t)}`,
|
|
2948
2963
|
"Z"
|
|
2949
2964
|
].join(" ");
|
|
2950
2965
|
}
|
|
2951
|
-
function
|
|
2966
|
+
function oi(e) {
|
|
2952
2967
|
if (e.length === 0) return "";
|
|
2953
|
-
if (e.length === 1) return `M${
|
|
2954
|
-
if (e.length === 2) return `M${
|
|
2968
|
+
if (e.length === 1) return `M${Y(e[0].x)},${Y(e[0].y)}`;
|
|
2969
|
+
if (e.length === 2) return `M${Y(e[0].x)},${Y(e[0].y)} L${Y(e[1].x)},${Y(e[1].y)}`;
|
|
2955
2970
|
let t = e.length, n = [], r = [];
|
|
2956
2971
|
for (let i = 0; i < t - 1; i++) n.push(e[i + 1].x - e[i].x), r.push(n[i] === 0 ? 0 : (e[i + 1].y - e[i].y) / n[i]);
|
|
2957
2972
|
let i = Array(t).fill(0);
|
|
2958
|
-
|
|
2959
|
-
let
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
}
|
|
2970
|
-
let a = Array(t).fill(0);
|
|
2971
|
-
for (let e = 0; e < t - 1; e++) a[e] = r[e] - n[e] * (2 * i[e] + i[e + 1]) / 3;
|
|
2972
|
-
a[t - 1] = r[t - 2] + n[t - 2] * i[t - 2] / 3;
|
|
2973
|
-
let o = `M${Q(e[0].x)},${Q(e[0].y)}`;
|
|
2973
|
+
for (let e = 1; e < t - 1; e++) {
|
|
2974
|
+
let t = r[e - 1], a = r[e];
|
|
2975
|
+
if (t * a <= 0) continue;
|
|
2976
|
+
let o = 2 * n[e] + n[e - 1], s = n[e] + 2 * n[e - 1];
|
|
2977
|
+
i[e] = (o + s) / (o / t + s / a);
|
|
2978
|
+
}
|
|
2979
|
+
let a = (e, t, n, r) => {
|
|
2980
|
+
let i = ((2 * e + t) * n - e * r) / (e + t);
|
|
2981
|
+
return i * n <= 0 ? i = 0 : n * r <= 0 && Math.abs(i) > 3 * Math.abs(n) && (i = 3 * n), i;
|
|
2982
|
+
};
|
|
2983
|
+
i[0] = a(n[0], n[1], r[0], r[1]), i[t - 1] = a(n[t - 2], n[t - 3], r[t - 2], r[t - 3]);
|
|
2984
|
+
let o = `M${Y(e[0].x)},${Y(e[0].y)}`;
|
|
2974
2985
|
for (let r = 0; r < t - 1; r++) {
|
|
2975
|
-
let t = n[r] / 3,
|
|
2976
|
-
o += ` C${
|
|
2986
|
+
let t = n[r] / 3, a = e[r].x + t, s = e[r].y + i[r] * t, c = e[r + 1].x - t, l = e[r + 1].y - i[r + 1] * t;
|
|
2987
|
+
o += ` C${Y(a)},${Y(s)} ${Y(c)},${Y(l)} ${Y(e[r + 1].x)},${Y(e[r + 1].y)}`;
|
|
2977
2988
|
}
|
|
2978
2989
|
return o;
|
|
2979
2990
|
}
|
|
2980
|
-
function
|
|
2981
|
-
let i = M(n,
|
|
2982
|
-
let t = M(e.legendLabel,
|
|
2991
|
+
function si(e, t, n, r) {
|
|
2992
|
+
let i = M(n, J.fontSize, 600), a = Math.max(...r.map((e) => {
|
|
2993
|
+
let t = M(e.legendLabel, J.fontSize, J.fontWeight), n = M(e.text, J.fontSize, J.fontWeight);
|
|
2983
2994
|
return t + 10 + n;
|
|
2984
|
-
})), o = Math.max(i, a) +
|
|
2995
|
+
})), o = Math.max(i, a) + J.padX * 2, s = 26 + r.length * 20 + 6, c = Math.max(J.minY, t - J.offsetY - s - J.pointerSize), l = e - o / 2, u = e, d = c + s, f = J.pointerSize, p = `<polygon points="${Y(u - f)},${Y(d)} ${Y(u + f)},${Y(d)} ${Y(u)},${Y(d + f)}" class="xychart-tip xychart-tip-ptr"/>`, m = `<rect x="${Y(l)}" y="${Y(c)}" width="${Y(o)}" height="${s}" rx="${J.rx}" class="xychart-tip xychart-tip-bg"/>`;
|
|
2985
2996
|
m += p;
|
|
2986
2997
|
let h = c + 6 + 10;
|
|
2987
|
-
m += `<text x="${
|
|
2988
|
-
let g = l +
|
|
2989
|
-
for (let e of r) h += 20, m += `<text x="${
|
|
2998
|
+
m += `<text x="${Y(e)}" y="${Y(h)}" text-anchor="middle" font-weight="600" font-size="${J.fontSize}" dy="${R}" class="xychart-tip xychart-tip-text">${X(n)}</text>`;
|
|
2999
|
+
let g = l + J.padX, _ = l + o - J.padX;
|
|
3000
|
+
for (let e of r) h += 20, m += `<text x="${Y(g)}" y="${Y(h)}" text-anchor="start" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${R}" class="xychart-tip xychart-tip-text">${X(e.legendLabel)}</text>`, m += `<text x="${Y(_)}" y="${Y(h)}" text-anchor="end" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${R}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;
|
|
2990
3001
|
return m;
|
|
2991
3002
|
}
|
|
2992
|
-
function
|
|
2993
|
-
let r = M(n,
|
|
2994
|
-
return `<rect x="${
|
|
3003
|
+
function ci(e, t, n) {
|
|
3004
|
+
let r = M(n, J.fontSize, J.fontWeight) + J.padX * 2, i = J.height, a = Math.max(J.minY, t - J.offsetY - i - J.pointerSize), o = e - r / 2, s = e, c = a + i / 2, l = e, u = a + i, d = J.pointerSize, f = `<polygon points="${Y(l - d)},${Y(u)} ${Y(l + d)},${Y(u)} ${Y(l)},${Y(u + d)}" class="xychart-tip xychart-tip-ptr"/>`;
|
|
3005
|
+
return `<rect x="${Y(o)}" y="${Y(a)}" width="${Y(r)}" height="${i}" rx="${J.rx}" class="xychart-tip xychart-tip-bg"/>` + f + `<text x="${Y(s)}" y="${Y(c)}" text-anchor="middle" dy="${R}" class="xychart-tip xychart-tip-text">${X(n)}</text>`;
|
|
2995
3006
|
}
|
|
2996
|
-
function
|
|
3007
|
+
function li(e) {
|
|
2997
3008
|
return Number.isInteger(e) ? e.toLocaleString("en-US") : e.toFixed(+(Math.abs(e) < 10));
|
|
2998
3009
|
}
|
|
2999
|
-
function
|
|
3010
|
+
function Y(e) {
|
|
3000
3011
|
return String(Math.round(e * 10) / 10);
|
|
3001
3012
|
}
|
|
3002
|
-
function
|
|
3013
|
+
function X(e) {
|
|
3003
3014
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3004
3015
|
}
|
|
3005
3016
|
//#endregion
|
|
3017
|
+
//#region packages/svg-renderer/src/c4/metrics.ts
|
|
3018
|
+
var Z = {
|
|
3019
|
+
width: 216,
|
|
3020
|
+
diagramMarginX: 50,
|
|
3021
|
+
diagramMarginY: 10,
|
|
3022
|
+
shapeMargin: 50,
|
|
3023
|
+
shapePadding: 20,
|
|
3024
|
+
shapeInRow: 4,
|
|
3025
|
+
boundaryInRow: 2,
|
|
3026
|
+
nextLinePaddingX: 0,
|
|
3027
|
+
screenWidth: 1440,
|
|
3028
|
+
nameSize: 14,
|
|
3029
|
+
typeSize: 10.5,
|
|
3030
|
+
descrSize: 11.5,
|
|
3031
|
+
messageSize: 12,
|
|
3032
|
+
boundarySize: 14,
|
|
3033
|
+
nameLine: 15.35,
|
|
3034
|
+
typeLine: 15.72,
|
|
3035
|
+
descrLine: 17.1,
|
|
3036
|
+
descrExtraLine: 12.48,
|
|
3037
|
+
textScale: .922,
|
|
3038
|
+
boundaryLabelHeight: 18,
|
|
3039
|
+
boundaryTypeHeight: 16.1,
|
|
3040
|
+
boundaryDescrHeight: 14.4,
|
|
3041
|
+
rootHeadingHeight: 47,
|
|
3042
|
+
titleExtra: 60,
|
|
3043
|
+
cornerRadius: 12,
|
|
3044
|
+
strokeWidth: 2,
|
|
3045
|
+
personRx: 38.232,
|
|
3046
|
+
personHeadRadius: 49.68,
|
|
3047
|
+
personPillTop: 85.946,
|
|
3048
|
+
personPillTopPerExtraWidth: .4,
|
|
3049
|
+
dbTrim: 3.91,
|
|
3050
|
+
queueExtra: 10
|
|
3051
|
+
}, ui = Z.width - Z.shapePadding;
|
|
3052
|
+
function di(e, t, n, r) {
|
|
3053
|
+
let i = [];
|
|
3054
|
+
for (let a of e.split("\n")) {
|
|
3055
|
+
let e = "";
|
|
3056
|
+
for (let o of a.split(/\s+/).filter(Boolean)) {
|
|
3057
|
+
let a = e ? `${e} ${o}` : o;
|
|
3058
|
+
e && M(a, n, r) * Z.textScale > t ? (i.push(e), e = o) : e = a;
|
|
3059
|
+
}
|
|
3060
|
+
i.push(e);
|
|
3061
|
+
}
|
|
3062
|
+
return i;
|
|
3063
|
+
}
|
|
3064
|
+
function fi(e) {
|
|
3065
|
+
let t = e / Z.width;
|
|
3066
|
+
return {
|
|
3067
|
+
rx: Z.personRx * t,
|
|
3068
|
+
headRadius: Z.personHeadRadius * t,
|
|
3069
|
+
pillTop: Z.personPillTop + Z.personPillTopPerExtraWidth * (e - Z.width)
|
|
3070
|
+
};
|
|
3071
|
+
}
|
|
3072
|
+
function pi(e, t) {
|
|
3073
|
+
return e * Z.nameLine + Z.typeLine + mi(t);
|
|
3074
|
+
}
|
|
3075
|
+
function mi(e) {
|
|
3076
|
+
return e === 0 ? 0 : Z.descrLine + (e - 1) * Z.descrExtraLine;
|
|
3077
|
+
}
|
|
3078
|
+
function hi(e) {
|
|
3079
|
+
let t = e / 2;
|
|
3080
|
+
return {
|
|
3081
|
+
rx: t,
|
|
3082
|
+
ry: t / (2.5 + e / 50)
|
|
3083
|
+
};
|
|
3084
|
+
}
|
|
3085
|
+
function gi(e) {
|
|
3086
|
+
let t = e / 2;
|
|
3087
|
+
return {
|
|
3088
|
+
rx: t / (2.5 + e / 50),
|
|
3089
|
+
ry: t
|
|
3090
|
+
};
|
|
3091
|
+
}
|
|
3092
|
+
function _i(e, t, n) {
|
|
3093
|
+
return M(e, t, n) * Z.textScale;
|
|
3094
|
+
}
|
|
3095
|
+
function vi(e, t, n, r) {
|
|
3096
|
+
let i = pi(t, n), a = i + 2 * Z.shapePadding, o = Math.max(Z.width, r + 2 * Z.shapePadding);
|
|
3097
|
+
if (e.kind === "person") return {
|
|
3098
|
+
width: o,
|
|
3099
|
+
height: fi(o).pillTop + a,
|
|
3100
|
+
textHeight: i
|
|
3101
|
+
};
|
|
3102
|
+
if (e.shape === "db") {
|
|
3103
|
+
let { ry: e } = hi(o);
|
|
3104
|
+
return {
|
|
3105
|
+
width: o,
|
|
3106
|
+
height: a + 2 * e - Z.dbTrim,
|
|
3107
|
+
textHeight: i
|
|
3108
|
+
};
|
|
3109
|
+
}
|
|
3110
|
+
if (e.shape === "queue") {
|
|
3111
|
+
let e = i + Z.queueExtra, { rx: t } = gi(e);
|
|
3112
|
+
return {
|
|
3113
|
+
width: o + 3 * t,
|
|
3114
|
+
height: e,
|
|
3115
|
+
textHeight: i
|
|
3116
|
+
};
|
|
3117
|
+
}
|
|
3118
|
+
return {
|
|
3119
|
+
width: o,
|
|
3120
|
+
height: a,
|
|
3121
|
+
textHeight: i
|
|
3122
|
+
};
|
|
3123
|
+
}
|
|
3124
|
+
function yi(e) {
|
|
3125
|
+
let t = "#ffffff";
|
|
3126
|
+
if (e.external) switch (e.kind) {
|
|
3127
|
+
case "person": return {
|
|
3128
|
+
fill: "#686868",
|
|
3129
|
+
stroke: "#8a8a8a",
|
|
3130
|
+
text: t
|
|
3131
|
+
};
|
|
3132
|
+
case "system": return {
|
|
3133
|
+
fill: "#999999",
|
|
3134
|
+
stroke: "#8a8a8a",
|
|
3135
|
+
text: t
|
|
3136
|
+
};
|
|
3137
|
+
case "container": return {
|
|
3138
|
+
fill: "#b3b3b3",
|
|
3139
|
+
stroke: "#a6a6a6",
|
|
3140
|
+
text: t
|
|
3141
|
+
};
|
|
3142
|
+
case "component": return {
|
|
3143
|
+
fill: "#cccccc",
|
|
3144
|
+
stroke: "#bfbfbf",
|
|
3145
|
+
text: t
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
switch (e.kind) {
|
|
3149
|
+
case "person": return {
|
|
3150
|
+
fill: "#08427b",
|
|
3151
|
+
stroke: "#073b6f",
|
|
3152
|
+
text: t
|
|
3153
|
+
};
|
|
3154
|
+
case "system": return {
|
|
3155
|
+
fill: "#1168bd",
|
|
3156
|
+
stroke: "#3c7fc0",
|
|
3157
|
+
text: t
|
|
3158
|
+
};
|
|
3159
|
+
case "container": return {
|
|
3160
|
+
fill: "#438dd5",
|
|
3161
|
+
stroke: "#3c7fc0",
|
|
3162
|
+
text: t
|
|
3163
|
+
};
|
|
3164
|
+
case "component": return {
|
|
3165
|
+
fill: "#85bbf0",
|
|
3166
|
+
stroke: "#78a8d8",
|
|
3167
|
+
text: t
|
|
3168
|
+
};
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
//#endregion
|
|
3172
|
+
//#region packages/svg-renderer/src/c4/layout.ts
|
|
3173
|
+
function bi() {
|
|
3174
|
+
return { next: { cnt: 0 } };
|
|
3175
|
+
}
|
|
3176
|
+
function xi(e, t, n, r, i) {
|
|
3177
|
+
e.next.startx = e.startx = t, e.next.stopx = e.stopx = n, e.next.starty = e.starty = r, e.next.stopy = e.stopy = i;
|
|
3178
|
+
}
|
|
3179
|
+
function Q(e, t, n, r) {
|
|
3180
|
+
let i = e[t];
|
|
3181
|
+
e[t] = i === void 0 ? n : r(n, i);
|
|
3182
|
+
}
|
|
3183
|
+
function Si(e, t) {
|
|
3184
|
+
e.next.cnt += 1;
|
|
3185
|
+
let n = Z.shapeMargin, r = e.next.startx === e.next.stopx ? e.next.stopx + n : e.next.stopx + n * 2, i = r + t.width, a = e.next.starty + n * 2, o = a + t.height;
|
|
3186
|
+
(r >= e.widthLimit || i >= e.widthLimit || e.next.cnt > Z.shapeInRow) && (r = e.next.startx + n + Z.nextLinePaddingX, a = e.next.stopy + n * 2, e.next.stopx = i = r + t.width, e.next.starty = e.next.stopy, e.next.stopy = o = a + t.height, e.next.cnt = 1), t.x = r, t.y = a, Q(e, "startx", r, Math.min), Q(e, "starty", a, Math.min), Q(e, "stopx", i, Math.max), Q(e, "stopy", o, Math.max), Q(e.next, "startx", r, Math.min), Q(e.next, "starty", a, Math.min), Q(e.next, "stopx", i, Math.max), Q(e.next, "stopy", o, Math.max);
|
|
3187
|
+
}
|
|
3188
|
+
function Ci(e) {
|
|
3189
|
+
let t = di(e.label, ui, Z.nameSize, 700), n = e.description ? di(e.description, ui, Z.descrSize, 400) : [], r = Math.max(...t.map((e) => _i(e, Z.nameSize, 700)), _i(oe(e), Z.typeSize, 400), ...n.map((e) => _i(e, Z.descrSize, 400)));
|
|
3190
|
+
return {
|
|
3191
|
+
el: e,
|
|
3192
|
+
nameLines: t,
|
|
3193
|
+
descriptionLines: n,
|
|
3194
|
+
x: 0,
|
|
3195
|
+
y: 0,
|
|
3196
|
+
...vi(e, t.length, n.length, r)
|
|
3197
|
+
};
|
|
3198
|
+
}
|
|
3199
|
+
function wi(e) {
|
|
3200
|
+
let t = /* @__PURE__ */ new Set(), n = new Map(e.elements.map((e) => [e.alias, e])), r = (e) => {
|
|
3201
|
+
let i = e.elementAliases.flatMap((e) => {
|
|
3202
|
+
t.add(e);
|
|
3203
|
+
let r = n.get(e);
|
|
3204
|
+
return r ? [r] : [];
|
|
3205
|
+
});
|
|
3206
|
+
return {
|
|
3207
|
+
alias: e.alias,
|
|
3208
|
+
boundary: e,
|
|
3209
|
+
elements: i,
|
|
3210
|
+
children: e.children.map(r)
|
|
3211
|
+
};
|
|
3212
|
+
}, i = e.boundaries.map(r);
|
|
3213
|
+
return {
|
|
3214
|
+
alias: "global",
|
|
3215
|
+
elements: e.elements.filter((e) => !t.has(e.alias)),
|
|
3216
|
+
children: i
|
|
3217
|
+
};
|
|
3218
|
+
}
|
|
3219
|
+
function Ti(e) {
|
|
3220
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = Z.diagramMarginX, i = Z.diagramMarginY, a = (e, n) => {
|
|
3221
|
+
for (let r of n) {
|
|
3222
|
+
let n = Ci(r);
|
|
3223
|
+
t.set(r.alias, n), Si(e, n);
|
|
3224
|
+
}
|
|
3225
|
+
e.stopx += Z.shapeMargin, e.stopy += Z.shapeMargin;
|
|
3226
|
+
}, o = (e, t, s) => {
|
|
3227
|
+
let c = bi();
|
|
3228
|
+
c.widthLimit = e.widthLimit / Math.min(Z.boundaryInRow, t.length);
|
|
3229
|
+
for (let [l, u] of t.entries()) {
|
|
3230
|
+
let t = u.boundary, d = 0, f = d + 8;
|
|
3231
|
+
d = f + Z.boundaryLabelHeight;
|
|
3232
|
+
let p;
|
|
3233
|
+
t && ie(t) && (p = d + 5, d = p + Z.boundaryTypeHeight);
|
|
3234
|
+
let m;
|
|
3235
|
+
if (t?.description && (m = d + 20, d = m + Z.boundaryDescrHeight), t || (d = Z.rootHeadingHeight), l === 0 || l % Z.boundaryInRow === 0) {
|
|
3236
|
+
let t = e.startx + Z.diagramMarginX, n = e.stopy + Z.diagramMarginY + d;
|
|
3237
|
+
xi(c, t, t, n, n);
|
|
3238
|
+
} else {
|
|
3239
|
+
let e = c.stopx === c.startx ? c.startx : c.stopx + Z.diagramMarginX;
|
|
3240
|
+
xi(c, e, e, c.starty, c.starty);
|
|
3241
|
+
}
|
|
3242
|
+
if (u.elements.length > 0 && a(c, u.elements), u.children.length > 0 && o(c, u.children, s + 1), t) {
|
|
3243
|
+
let e = c.stopx - c.startx, r = c.stopy - c.starty;
|
|
3244
|
+
e === 0 && (e = Z.width), r === 0 && (r = d + Z.shapeMargin), n.push({
|
|
3245
|
+
alias: t.alias,
|
|
3246
|
+
label: t.label,
|
|
3247
|
+
...t.type ? { type: t.type } : {},
|
|
3248
|
+
...t.description ? { description: t.description } : {},
|
|
3249
|
+
x: c.startx,
|
|
3250
|
+
y: c.starty,
|
|
3251
|
+
width: e,
|
|
3252
|
+
height: r,
|
|
3253
|
+
depth: s,
|
|
3254
|
+
labelY: f,
|
|
3255
|
+
...p === void 0 ? {} : { typeY: p },
|
|
3256
|
+
...m === void 0 ? {} : { descrY: m }
|
|
3257
|
+
});
|
|
3258
|
+
}
|
|
3259
|
+
e.stopy = Math.max(c.stopy + Z.shapeMargin, e.stopy), e.stopx = Math.max(c.stopx + Z.shapeMargin, e.stopx), r = Math.max(r, e.stopx), i = Math.max(i, e.stopy);
|
|
3260
|
+
}
|
|
3261
|
+
}, s = bi();
|
|
3262
|
+
return xi(s, Z.diagramMarginX, Z.diagramMarginX, Z.diagramMarginY, Z.diagramMarginY), s.widthLimit = Z.screenWidth, o(s, [e], -1), {
|
|
3263
|
+
elements: t,
|
|
3264
|
+
boundaries: n,
|
|
3265
|
+
maxX: r,
|
|
3266
|
+
maxY: i
|
|
3267
|
+
};
|
|
3268
|
+
}
|
|
3269
|
+
function Ei(e, t) {
|
|
3270
|
+
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = t.x - n, a = t.y - r, o = e.width / 2, s = e.height / 2;
|
|
3271
|
+
if (i === 0 && a === 0) return {
|
|
3272
|
+
x: n,
|
|
3273
|
+
y: r
|
|
3274
|
+
};
|
|
3275
|
+
let c, l;
|
|
3276
|
+
if (Math.abs(a) * o > Math.abs(i) * s) {
|
|
3277
|
+
let e = a < 0 ? -s : s;
|
|
3278
|
+
c = e * i / a, l = e;
|
|
3279
|
+
} else {
|
|
3280
|
+
let e = i < 0 ? -o : o;
|
|
3281
|
+
c = e, l = e * a / i;
|
|
3282
|
+
}
|
|
3283
|
+
return {
|
|
3284
|
+
x: n + c,
|
|
3285
|
+
y: r + l
|
|
3286
|
+
};
|
|
3287
|
+
}
|
|
3288
|
+
function Di(e, t) {
|
|
3289
|
+
let n = fi(e.width), r = e.x + e.width / 2, i = e.y + e.height / 2, a = e.y + n.headRadius, o = e.y + n.pillTop, s = e.y + e.height, c = (t, i) => {
|
|
3290
|
+
if (Math.hypot(t - r, i - a) <= n.headRadius) return !0;
|
|
3291
|
+
if (i < o || i > s) return !1;
|
|
3292
|
+
let c = Math.min(n.rx, (s - o) / 2), l = e.x + c, u = e.x + e.width - c, d = Math.min(Math.max(i, o + c), s - c), f = Math.min(Math.max(t, l), u);
|
|
3293
|
+
return t >= e.x && t <= e.x + e.width && Math.hypot(t - f, i - d) <= c;
|
|
3294
|
+
}, l = Math.hypot(t.x - r, t.y - i);
|
|
3295
|
+
if (l === 0 || !c(r, i)) return Ei(e, t);
|
|
3296
|
+
let u = (t.x - r) / l, d = (t.y - i) / l, f = (e) => c(r + u * e, i + d * e), p = 0, m = .5;
|
|
3297
|
+
for (; f(m) && m < e.width + e.height;) p = m, m += .5;
|
|
3298
|
+
for (let e = 0; e < 30; e++) {
|
|
3299
|
+
let e = (p + m) / 2;
|
|
3300
|
+
f(e) ? p = e : m = e;
|
|
3301
|
+
}
|
|
3302
|
+
return {
|
|
3303
|
+
x: r + u * p,
|
|
3304
|
+
y: i + d * p
|
|
3305
|
+
};
|
|
3306
|
+
}
|
|
3307
|
+
function Oi(e, t) {
|
|
3308
|
+
return e.el?.kind === "person" ? Di(e, t) : Ei(e, t);
|
|
3309
|
+
}
|
|
3310
|
+
var ki = (e) => ({
|
|
3311
|
+
x: e.x + e.width / 2,
|
|
3312
|
+
y: e.y + e.height / 2
|
|
3313
|
+
});
|
|
3314
|
+
function Ai(e, t, n, r) {
|
|
3315
|
+
let i = n.get(e.from), a = n.get(e.to), o = Oi(i, ki(a)), s = Oi(a, ki(i)), c = s.x - o.x, l = s.y - o.y, u = (e) => ({
|
|
3316
|
+
x: e.x,
|
|
3317
|
+
y: e.y + r
|
|
3318
|
+
}), d = {
|
|
3319
|
+
...e,
|
|
3320
|
+
points: [u(o), u(s)]
|
|
3321
|
+
};
|
|
3322
|
+
if (t > 0 && (d.curve = u({
|
|
3323
|
+
x: o.x + c / 2 - c / 4,
|
|
3324
|
+
y: o.y + l / 2
|
|
3325
|
+
})), ae(e).length > 0) {
|
|
3326
|
+
let t = {
|
|
3327
|
+
x: Math.min(o.x, s.x) + Math.abs(c) / 2,
|
|
3328
|
+
y: Math.min(o.y, s.y) + Math.abs(l) / 2
|
|
3329
|
+
}, n = ae(e)[0], r = e.label !== "" || e.index !== void 0 ? _i(n ?? "", Z.messageSize, 400) : 0;
|
|
3330
|
+
if (d.labelPosition = u({
|
|
3331
|
+
x: t.x + r / 2,
|
|
3332
|
+
y: t.y
|
|
3333
|
+
}), e.technology) {
|
|
3334
|
+
let n = _i(`[${e.technology}]`, Z.messageSize, 400);
|
|
3335
|
+
d.technologyX = t.x + Math.max(r, n) / 2;
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
return d;
|
|
3339
|
+
}
|
|
3340
|
+
function ji(e, t = {}) {
|
|
3341
|
+
if (e.elements.length === 0 && e.boundaries.length === 0) {
|
|
3342
|
+
let t = {
|
|
3343
|
+
variant: e.variant,
|
|
3344
|
+
width: 0,
|
|
3345
|
+
height: 0,
|
|
3346
|
+
elements: [],
|
|
3347
|
+
boundaries: [],
|
|
3348
|
+
relationships: []
|
|
3349
|
+
};
|
|
3350
|
+
return e.title && (t.title = e.title), t;
|
|
3351
|
+
}
|
|
3352
|
+
let n = Ti(wi(e)), r = e.title ? Z.titleExtra : 0, i = Z.diagramMarginY + r, a = e.elements.flatMap((e) => {
|
|
3353
|
+
let t = n.elements.get(e.alias);
|
|
3354
|
+
return t ? [{
|
|
3355
|
+
...e,
|
|
3356
|
+
x: t.x,
|
|
3357
|
+
y: t.y + i,
|
|
3358
|
+
width: t.width,
|
|
3359
|
+
height: t.height,
|
|
3360
|
+
nameLines: t.nameLines,
|
|
3361
|
+
descriptionLines: t.descriptionLines
|
|
3362
|
+
}] : [];
|
|
3363
|
+
}), o = [...n.boundaries].sort((e, t) => e.depth - t.depth).map((e) => ({
|
|
3364
|
+
...e,
|
|
3365
|
+
y: e.y + i
|
|
3366
|
+
})), s = /* @__PURE__ */ new Map();
|
|
3367
|
+
for (let e of n.elements.values()) s.set(e.el.alias, e);
|
|
3368
|
+
for (let e of n.boundaries) s.set(e.alias, e);
|
|
3369
|
+
let c = e.relationships.map((e, t) => Ai(e, t, s, i)), l = n.maxX + Z.diagramMarginX, u = n.maxY + Z.diagramMarginY + r, d = {
|
|
3370
|
+
variant: e.variant,
|
|
3371
|
+
width: l,
|
|
3372
|
+
height: u,
|
|
3373
|
+
elements: a,
|
|
3374
|
+
boundaries: o,
|
|
3375
|
+
relationships: c
|
|
3376
|
+
};
|
|
3377
|
+
return e.title && (d.title = e.title, d.titlePosition = {
|
|
3378
|
+
x: (n.maxX - Z.diagramMarginX) / 2 - 4 * Z.diagramMarginX,
|
|
3379
|
+
y: Z.diagramMarginY + Z.diagramMarginY + i
|
|
3380
|
+
}), d;
|
|
3381
|
+
}
|
|
3382
|
+
//#endregion
|
|
3383
|
+
//#region packages/svg-renderer/src/c4/renderer.ts
|
|
3384
|
+
function Mi(e, t, r = "Inter", i = !1, o = N, c, l, u, d = {}) {
|
|
3385
|
+
let f = [];
|
|
3386
|
+
f.push(H(E(e.width, e.height, t, i, l ?? e.title, u, void 0, d.styleAttribute), c)), f.push(n(r, !1, d.nonce)), e.title && e.titlePosition && f.push(s`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${R}" ` + s`font-size="16" fill="var(--_text)">${a(e.title)}</text>`);
|
|
3387
|
+
for (let t of e.boundaries) f.push(Ni(t));
|
|
3388
|
+
for (let t of e.elements) f.push(Pi(t));
|
|
3389
|
+
for (let t of e.relationships) f.push(zi(t)), f.push(Bi(t));
|
|
3390
|
+
return f.push("</svg>"), f.filter(Boolean).join("\n");
|
|
3391
|
+
}
|
|
3392
|
+
function $(e, t, n, r, i) {
|
|
3393
|
+
return s` <text x="${t}" y="${n}" text-anchor="middle" dy="${R}" font-size="${r}" ` + s`${i}>${a(e)}</text>`;
|
|
3394
|
+
}
|
|
3395
|
+
function Ni(e) {
|
|
3396
|
+
let t = [];
|
|
3397
|
+
t.push(s`<g class="c4-boundary" data-id="${i(e.alias)}" data-label="${i(e.label)}" data-depth="${e.depth}">`), t.push(s` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="2.5" ry="2.5" ` + "fill=\"none\" stroke=\"var(--_text)\" stroke-width=\"1\" stroke-dasharray=\"7,7\" />");
|
|
3398
|
+
let n = e.x + e.width / 2;
|
|
3399
|
+
t.push($(e.label, n, e.y + (e.labelY ?? 8), Z.boundarySize + 2, "font-weight=\"700\" fill=\"var(--_text)\""));
|
|
3400
|
+
let r = ie({
|
|
3401
|
+
alias: e.alias,
|
|
3402
|
+
label: e.label,
|
|
3403
|
+
...e.type ? { type: e.type } : {},
|
|
3404
|
+
elementAliases: [],
|
|
3405
|
+
children: []
|
|
3406
|
+
});
|
|
3407
|
+
return r && e.typeY !== void 0 && t.push($(r, n, e.y + e.typeY, Z.boundarySize, "fill=\"var(--_text)\"")), e.description && e.descrY !== void 0 && t.push($(e.description, n, e.y + e.descrY, Z.boundarySize - 2, "fill=\"var(--_text)\"")), t.push("</g>"), t.join("\n");
|
|
3408
|
+
}
|
|
3409
|
+
function Pi(e) {
|
|
3410
|
+
let t = yi(e), { x: n, y: r, width: a, height: o } = e, c = n + a / 2, l = pi(e.nameLines.length, e.descriptionLines.length), u = [];
|
|
3411
|
+
u.push(s`<g class="c4-element" data-id="${i(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" ` + s`data-external="${e.external}" data-label="${i(e.label)}">`);
|
|
3412
|
+
let d, f = c;
|
|
3413
|
+
if (e.kind === "person") u.push(...Fi(e, t)), d = r + fi(a).pillTop + Z.shapePadding;
|
|
3414
|
+
else if (e.shape === "db") {
|
|
3415
|
+
u.push(...Ii(e, t));
|
|
3416
|
+
let { ry: n } = hi(a);
|
|
3417
|
+
d = r + (2 * n + o) / 2 - l / 2;
|
|
3418
|
+
} else if (e.shape === "queue") {
|
|
3419
|
+
u.push(...Li(e, t));
|
|
3420
|
+
let { rx: n } = gi(o);
|
|
3421
|
+
f = c - n, d = r + o / 2 - l / 2;
|
|
3422
|
+
} else u.push(s` <rect x="${n}" y="${r}" width="${a}" height="${o}" rx="${Z.cornerRadius}" ry="${Z.cornerRadius}" ` + s`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${Z.strokeWidth}" />`), d = r + Z.shapePadding;
|
|
3423
|
+
let p = d;
|
|
3424
|
+
for (let n of e.nameLines) u.push($(n, f, p + Z.nameLine / 2, Z.nameSize, s`font-weight="700" fill="${t.text}"`)), p += Z.nameLine;
|
|
3425
|
+
return u.push($(oe(e), f, p + Z.typeLine / 2, Z.typeSize, s`fill="${t.text}"`)), p += Z.typeLine, e.descriptionLines.forEach((e, n) => {
|
|
3426
|
+
u.push($(e, f, p + Z.descrLine / 2 + n * Z.descrExtraLine, Z.descrSize, s`fill="${t.text}"`));
|
|
3427
|
+
}), p += mi(e.descriptionLines.length), u.push("</g>"), u.join("\n");
|
|
3428
|
+
}
|
|
3429
|
+
function Fi(e, t) {
|
|
3430
|
+
let { x: n, width: r } = e, { rx: i, headRadius: a, pillTop: o } = fi(r), c = e.y, l = n + r / 2, u = c + o, d = e.y + e.height - u, f = s`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${Z.strokeWidth}"`;
|
|
3431
|
+
return [s` <rect x="${n}" y="${u}" width="${r}" height="${d}" rx="${i}" ry="${i}" ${f} />`, s` <circle cx="${l}" cy="${c + a}" r="${a}" ${f} />`];
|
|
3432
|
+
}
|
|
3433
|
+
function Ii(e, t) {
|
|
3434
|
+
let { x: n, y: r, width: i, height: a } = e, { rx: o, ry: c } = hi(i), l = s`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${Z.strokeWidth}"`;
|
|
3435
|
+
return [s` <path d="M ${n} ${r + c} L ${n} ${r + a - c} A ${o} ${c} 0 0 0 ${n + i} ${r + a - c} L ${n + i} ${r + c} Z" ${l} />`, s` <ellipse cx="${n + o}" cy="${r + c}" rx="${o}" ry="${c}" ${l} />`];
|
|
3436
|
+
}
|
|
3437
|
+
function Li(e, t) {
|
|
3438
|
+
let { x: n, y: r, width: i, height: a } = e, { rx: o, ry: c } = gi(a), l = s`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${Z.strokeWidth}"`;
|
|
3439
|
+
return [s` <path d="M ${n + i - o} ${r} H ${n + o} A ${o} ${c} 0 0 0 ${n + o} ${r + a} H ${n + i - o} Z" ${l} />`, s` <ellipse cx="${n + i - o}" cy="${r + c}" rx="${o}" ry="${c}" ${l} />`];
|
|
3440
|
+
}
|
|
3441
|
+
function Ri(e, t) {
|
|
3442
|
+
let n = e.x - t.x, r = e.y - t.y, i = Math.hypot(n, r);
|
|
3443
|
+
if (i === 0) return "";
|
|
3444
|
+
let a = n / i, o = r / i, c = e.x - a * 10, l = e.y - o * 10;
|
|
3445
|
+
return s`<polygon class="c4-arrowhead" points="${e.x},${e.y} ${c - o * 5},${l + a * 5} ${c + o * 5},${l - a * 5}" ` + "fill=\"var(--_text)\" />";
|
|
3446
|
+
}
|
|
3447
|
+
function zi(e) {
|
|
3448
|
+
let [t, n] = [e.points[0], e.points[e.points.length - 1]];
|
|
3449
|
+
if (!t || !n || t === n) return "";
|
|
3450
|
+
let r = [
|
|
3451
|
+
"class=\"c4-relationship\"",
|
|
3452
|
+
s`data-from="${i(e.from)}"`,
|
|
3453
|
+
s`data-to="${i(e.to)}"`
|
|
3454
|
+
];
|
|
3455
|
+
e.label && r.push(s`data-label="${i(e.label)}"`), e.technology && r.push(s`data-technology="${i(e.technology)}"`);
|
|
3456
|
+
let a = e.curve ? s`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}` : s`M ${t.x},${t.y} L ${n.x},${n.y}`, o = s`<path ${r.join(" ")} d="${a}" fill="none" stroke="var(--_text)" stroke-width="1" />`, c = e.curve ?? t, l = e.curve ?? n, u = Ri(n, c), d = Ri(t, l);
|
|
3457
|
+
return [o, ...e.bidirectional ? [u, d] : [e.reversed ? d : u]].filter(Boolean).join("\n");
|
|
3458
|
+
}
|
|
3459
|
+
function Bi(e) {
|
|
3460
|
+
let t = ae(e);
|
|
3461
|
+
if (t.length === 0 || !e.labelPosition) return "";
|
|
3462
|
+
let { x: n, y: r } = e.labelPosition, a = [s`<g class="c4-relationship-label" data-from="${i(e.from)}" data-to="${i(e.to)}">`];
|
|
3463
|
+
return t.forEach((i, o) => {
|
|
3464
|
+
let s = e.technology !== void 0 && o === t.length - 1, c = r + (o === 0 ? 0 : Z.messageSize + 5);
|
|
3465
|
+
a.push($(i, s && e.technologyX !== void 0 ? e.technologyX : n, c, Z.messageSize, s ? "font-style=\"italic\" fill=\"var(--_text)\"" : "fill=\"var(--_text)\""));
|
|
3466
|
+
}), a.push("</g>"), a.join("\n");
|
|
3467
|
+
}
|
|
3468
|
+
//#endregion
|
|
3006
3469
|
//#region src/parser.ts
|
|
3007
|
-
function
|
|
3470
|
+
function Vi(e) {
|
|
3008
3471
|
let t = e.trim();
|
|
3009
3472
|
return t.length >= 2 && (t[0] === "\"" && t[t.length - 1] === "\"" || t[0] === "'" && t[t.length - 1] === "'") ? t.slice(1, -1) : t;
|
|
3010
3473
|
}
|
|
3011
|
-
var
|
|
3012
|
-
function
|
|
3474
|
+
var Hi = "\"graph <dir>\"/\"flowchart <dir>\" (dir: TD, TB, LR, BT, RL), \"stateDiagram-v2\", \"sequenceDiagram\", \"classDiagram\", \"erDiagram\", \"xychart-beta\", \"C4Context\"/\"C4Container\"/\"C4Component\"/\"C4Dynamic\"/\"C4Deployment\", \"architecture-beta\"";
|
|
3475
|
+
function Ui(e) {
|
|
3013
3476
|
let t = e.trim().toLowerCase();
|
|
3014
3477
|
if (/^sequence/.test(t)) return "sequenceDiagram";
|
|
3015
3478
|
if (/^class/.test(t)) return "classDiagram";
|
|
@@ -3017,11 +3480,11 @@ function ti(e) {
|
|
|
3017
3480
|
if (/^xychart/.test(t)) return "xychart-beta";
|
|
3018
3481
|
if (/^state/.test(t)) return "stateDiagram-v2";
|
|
3019
3482
|
}
|
|
3020
|
-
var
|
|
3021
|
-
function
|
|
3483
|
+
var Wi = /^(?:[\w-]+@)?<?(?:-{2,}|={2,}|-\.+-?|~{3,})/;
|
|
3484
|
+
function Gi(e) {
|
|
3022
3485
|
let t = [];
|
|
3023
3486
|
for (let n of e) n.forEach((e, n) => {
|
|
3024
|
-
if (n === 0 && t.length > 0 &&
|
|
3487
|
+
if (n === 0 && t.length > 0 && Wi.test(e.text)) {
|
|
3025
3488
|
let n = t[t.length - 1];
|
|
3026
3489
|
t[t.length - 1] = {
|
|
3027
3490
|
text: `${n.text} ${e.text}`,
|
|
@@ -3031,13 +3494,13 @@ function ri(e) {
|
|
|
3031
3494
|
});
|
|
3032
3495
|
return t;
|
|
3033
3496
|
}
|
|
3034
|
-
function
|
|
3035
|
-
let t =
|
|
3497
|
+
function Ki(e) {
|
|
3498
|
+
let t = o(e.split("\n").map((e) => e.trim())), n = Gi(w(e));
|
|
3036
3499
|
if (n.length === 0) throw Error("Empty mermaid diagram");
|
|
3037
|
-
let r = n[0], i = /^stateDiagram(-v2)?\s*$/i.test(r.text) ?
|
|
3500
|
+
let r = n[0], i = /^stateDiagram(-v2)?\s*$/i.test(r.text) ? Ji(n) : qi(n);
|
|
3038
3501
|
return i.initConfig = t, i;
|
|
3039
3502
|
}
|
|
3040
|
-
function
|
|
3503
|
+
function qi(e) {
|
|
3041
3504
|
let t = e[0];
|
|
3042
3505
|
if (t === void 0)
|
|
3043
3506
|
/* v8 ignore next */
|
|
@@ -3049,8 +3512,8 @@ function ai(e) {
|
|
|
3049
3512
|
let r = e[1].trim();
|
|
3050
3513
|
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
3514
|
}
|
|
3052
|
-
let r =
|
|
3053
|
-
throw Error(`Line ${t.line}: Invalid mermaid header: "${n}".${i} Supported headers: ${
|
|
3515
|
+
let r = Ui(n), i = r && r.toLowerCase() !== n.trim().toLowerCase() ? ` Did you mean "${r}"?` : "";
|
|
3516
|
+
throw Error(`Line ${t.line}: Invalid mermaid header: "${n}".${i} Supported headers: ${Hi}.`);
|
|
3054
3517
|
}
|
|
3055
3518
|
let i = {
|
|
3056
3519
|
direction: O(r[1]),
|
|
@@ -3067,10 +3530,10 @@ function ai(e) {
|
|
|
3067
3530
|
let n = e[t].text;
|
|
3068
3531
|
if (A(n, i) || k(n, i) || j(n, i)) continue;
|
|
3069
3532
|
if (/^click\s+/i.test(n)) {
|
|
3070
|
-
|
|
3533
|
+
sa(n, i);
|
|
3071
3534
|
continue;
|
|
3072
3535
|
}
|
|
3073
|
-
if (
|
|
3536
|
+
if (la(n, i)) continue;
|
|
3074
3537
|
let r = n.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);
|
|
3075
3538
|
if (r) {
|
|
3076
3539
|
let e = r[1].trim(), t = g(r[2]);
|
|
@@ -3095,7 +3558,7 @@ function ai(e) {
|
|
|
3095
3558
|
let s = n.match(/^subgraph\s+(.+)$/);
|
|
3096
3559
|
if (s) {
|
|
3097
3560
|
let e = s[1].trim(), t = e.match(/^([^\s[]+)\s*\[(.+)\]$/), n, r;
|
|
3098
|
-
t ? (n = t[1], r = m(
|
|
3561
|
+
t ? (n = t[1], r = m(Vi(t[2]))) : (r = m(Vi(e)), n = r.replace(/\s+/g, "_").replace(/[^\p{L}\p{N}_-]/gu, ""));
|
|
3099
3562
|
let i = {
|
|
3100
3563
|
id: n,
|
|
3101
3564
|
label: r,
|
|
@@ -3110,11 +3573,11 @@ function ai(e) {
|
|
|
3110
3573
|
e && (a.length > 0 ? a[a.length - 1].children.push(e) : i.subgraphs.push(e));
|
|
3111
3574
|
continue;
|
|
3112
3575
|
}
|
|
3113
|
-
|
|
3576
|
+
pa(n, i, a);
|
|
3114
3577
|
}
|
|
3115
3578
|
return i;
|
|
3116
3579
|
}
|
|
3117
|
-
function
|
|
3580
|
+
function Ji(e) {
|
|
3118
3581
|
let t = {
|
|
3119
3582
|
direction: "TD",
|
|
3120
3583
|
nodes: /* @__PURE__ */ new Map(),
|
|
@@ -3127,7 +3590,9 @@ function oi(e) {
|
|
|
3127
3590
|
interactions: /* @__PURE__ */ new Map()
|
|
3128
3591
|
}, n = [], r = /* @__PURE__ */ new Set(), i = 0, a = 0;
|
|
3129
3592
|
for (let o = 1; o < e.length; o++) {
|
|
3130
|
-
let s = e[o].text
|
|
3593
|
+
let s = e[o].text;
|
|
3594
|
+
if (A(s, t) || k(s, t) || j(s, t)) continue;
|
|
3595
|
+
let c = s.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);
|
|
3131
3596
|
if (c) {
|
|
3132
3597
|
n.length > 0 ? n[n.length - 1].direction = O(c[1]) : t.direction = O(c[1]);
|
|
3133
3598
|
continue;
|
|
@@ -3148,7 +3613,7 @@ function oi(e) {
|
|
|
3148
3613
|
}
|
|
3149
3614
|
continue;
|
|
3150
3615
|
}
|
|
3151
|
-
if (
|
|
3616
|
+
if (la(s, t)) continue;
|
|
3152
3617
|
let u = s.match(/^state\s+(?:"([^"]+)"\s+as\s+)?([\w\p{L}]+)\s*\{$/u);
|
|
3153
3618
|
if (u) {
|
|
3154
3619
|
let e = u[1] ?? u[2], i = u[2], a = {
|
|
@@ -3168,56 +3633,63 @@ function oi(e) {
|
|
|
3168
3633
|
let d = s.match(/^state\s+"([^"]+)"\s+as\s+([\w\p{L}]+)\s*$/u);
|
|
3169
3634
|
if (d) {
|
|
3170
3635
|
let e = m(d[1]), r = d[2];
|
|
3171
|
-
|
|
3172
|
-
id: r,
|
|
3173
|
-
label: e,
|
|
3174
|
-
shape: "rounded"
|
|
3175
|
-
});
|
|
3636
|
+
Yi(t, n, r, e);
|
|
3176
3637
|
continue;
|
|
3177
3638
|
}
|
|
3178
|
-
let f = s.match(/^(\[\*\]|[\w\p{L}-]+)\s*(?:([\w-]+)@)?-->\s*(\[\*\]|[\w\p{L}-]+)(?:\s*:\s*(.+))?$/u);
|
|
3639
|
+
let f = s.match(/^(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?\s*(?:([\w-]+)@)?-->\s*(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?(?:\s*:\s*(.+))?$/u);
|
|
3179
3640
|
if (f) {
|
|
3180
|
-
let e = f[1], o = f[2], s = f[3], c = f[4]?.trim(),
|
|
3181
|
-
e === "[*]" ? (i++, e = `_start${i > 1 ? i : ""}`,
|
|
3641
|
+
let e = f[1], o = f[2], s = f[3], c = f[4], l = f[5], u = f[6]?.trim(), d = u ? m(u) : void 0;
|
|
3642
|
+
e === "[*]" ? (i++, e = `_start${i > 1 ? i : ""}`, Xi(t, n, {
|
|
3182
3643
|
id: e,
|
|
3183
3644
|
label: "",
|
|
3184
3645
|
shape: "state-start"
|
|
3185
|
-
})) : r.has(e) ||
|
|
3186
|
-
id:
|
|
3646
|
+
})) : r.has(e) || Zi(t, n, e), c === "[*]" ? (a++, c = `_end${a > 1 ? a : ""}`, Xi(t, n, {
|
|
3647
|
+
id: c,
|
|
3187
3648
|
label: "",
|
|
3188
3649
|
shape: "state-end"
|
|
3189
|
-
})) : r.has(
|
|
3650
|
+
})) : r.has(c) || Zi(t, n, c), o !== void 0 && t.classAssignments.set(e, o), l !== void 0 && t.classAssignments.set(c, l), t.edges.push({
|
|
3190
3651
|
source: e,
|
|
3191
|
-
target:
|
|
3192
|
-
label:
|
|
3652
|
+
target: c,
|
|
3653
|
+
label: d,
|
|
3193
3654
|
style: "solid",
|
|
3194
3655
|
hasArrowStart: !1,
|
|
3195
3656
|
hasArrowEnd: !0,
|
|
3196
|
-
...
|
|
3657
|
+
...s === void 0 ? {} : { id: s }
|
|
3197
3658
|
});
|
|
3198
3659
|
continue;
|
|
3199
3660
|
}
|
|
3200
|
-
let p = s.match(/^([\w\p{L}-]+)\
|
|
3661
|
+
let p = s.match(/^([\w\p{L}-]+):::([\w][\w-]*)\s*$/u);
|
|
3201
3662
|
if (p) {
|
|
3202
3663
|
let e = p[1];
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3664
|
+
r.has(e) || Zi(t, n, e), t.classAssignments.set(e, p[2]);
|
|
3665
|
+
continue;
|
|
3666
|
+
}
|
|
3667
|
+
let h = s.match(/^([\w\p{L}-]+)\s*:\s*(.+)$/u);
|
|
3668
|
+
if (h) {
|
|
3669
|
+
let e = h[1];
|
|
3670
|
+
Yi(t, n, e, m(h[2].trim()));
|
|
3208
3671
|
continue;
|
|
3209
3672
|
}
|
|
3210
3673
|
}
|
|
3674
|
+
for (let e of t.classAssignments.keys()) !t.nodes.has(e) && !r.has(e) && Zi(t, [], e);
|
|
3211
3675
|
return t;
|
|
3212
3676
|
}
|
|
3213
|
-
function
|
|
3677
|
+
function Yi(e, t, n, r) {
|
|
3678
|
+
let i = e.nodes.get(n);
|
|
3679
|
+
i && (i.label = r), Xi(e, t, {
|
|
3680
|
+
id: n,
|
|
3681
|
+
label: r,
|
|
3682
|
+
shape: "rounded"
|
|
3683
|
+
});
|
|
3684
|
+
}
|
|
3685
|
+
function Xi(e, t, n) {
|
|
3214
3686
|
if (e.nodes.has(n.id) || e.nodes.set(n.id, n), t.length > 0) {
|
|
3215
3687
|
let e = t[t.length - 1];
|
|
3216
3688
|
e.nodeIds.includes(n.id) || e.nodeIds.push(n.id);
|
|
3217
3689
|
}
|
|
3218
3690
|
}
|
|
3219
|
-
function
|
|
3220
|
-
if (!e.nodes.has(n))
|
|
3691
|
+
function Zi(e, t, n) {
|
|
3692
|
+
if (!e.nodes.has(n)) Xi(e, t, {
|
|
3221
3693
|
id: n,
|
|
3222
3694
|
label: n,
|
|
3223
3695
|
shape: "rounded"
|
|
@@ -3227,12 +3699,12 @@ function ci(e, t, n) {
|
|
|
3227
3699
|
e.nodeIds.includes(n) || e.nodeIds.push(n);
|
|
3228
3700
|
}
|
|
3229
3701
|
}
|
|
3230
|
-
var
|
|
3231
|
-
function
|
|
3702
|
+
var Qi = /^(<|o|x)?(-{2,}|={2,}|-\.+-|~{3,})(>|o|x)?(?:\|([^|]*)\|)?/, $i = /* @__PURE__ */ new Set(["--", "=="]);
|
|
3703
|
+
function ea(e) {
|
|
3232
3704
|
if (e === "o") return "circle";
|
|
3233
3705
|
if (e === "x") return "cross";
|
|
3234
3706
|
}
|
|
3235
|
-
var
|
|
3707
|
+
var ta = /^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|={3,}|-\.+-)/, na = [
|
|
3236
3708
|
{
|
|
3237
3709
|
regex: /^([\w\p{L}-]+)\(\(\(((?:"[^"]*"|(?!\)\)\)).)+)\)\)\)/u,
|
|
3238
3710
|
shape: "doublecircle"
|
|
@@ -3281,9 +3753,9 @@ var fi = /^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|
|
|
|
3281
3753
|
regex: /^([\w\p{L}-]+)\{((?:"[^"]*"|(?!\}).)+)\}/u,
|
|
3282
3754
|
shape: "diamond"
|
|
3283
3755
|
}
|
|
3284
|
-
],
|
|
3285
|
-
function
|
|
3286
|
-
if (e.shape) return
|
|
3756
|
+
], ra = /^([\w\p{L}]+(?:-[\w\p{L}]+)*)/u, ia = /^([\w\p{L}-]+)(?=@\{)/u;
|
|
3757
|
+
function aa(e) {
|
|
3758
|
+
if (e.shape) return _e(e.shape) ?? "rectangle";
|
|
3287
3759
|
if (e.icon !== void 0 || e.img !== void 0) switch (e.form?.toLowerCase()) {
|
|
3288
3760
|
case "circle": return "circle";
|
|
3289
3761
|
case "rounded": return "rounded";
|
|
@@ -3291,46 +3763,46 @@ function gi(e) {
|
|
|
3291
3763
|
}
|
|
3292
3764
|
return "rectangle";
|
|
3293
3765
|
}
|
|
3294
|
-
function
|
|
3766
|
+
function oa(e, t) {
|
|
3295
3767
|
return t.label !== void 0 && t.label.length > 0 ? t.label : t.icon ? t.icon : t.img ? t.img : e;
|
|
3296
3768
|
}
|
|
3297
|
-
function
|
|
3298
|
-
|
|
3769
|
+
function sa(e, n) {
|
|
3770
|
+
t(e, n.interactions);
|
|
3299
3771
|
}
|
|
3300
|
-
var
|
|
3301
|
-
function
|
|
3302
|
-
let n = e.match(
|
|
3772
|
+
var ca = /^([\w-]+)(?=@\{)/;
|
|
3773
|
+
function la(e, t) {
|
|
3774
|
+
let n = e.match(ca);
|
|
3303
3775
|
if (!n || !t.edges.some((e) => e.id === n[1])) return !1;
|
|
3304
|
-
let r =
|
|
3305
|
-
return r ? (
|
|
3776
|
+
let r = le(e.slice(n[1].length));
|
|
3777
|
+
return r ? (ua(t, n[1], me(r.body)), !0) : !1;
|
|
3306
3778
|
}
|
|
3307
|
-
function
|
|
3779
|
+
function ua(e, t, n) {
|
|
3308
3780
|
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
3781
|
}
|
|
3310
|
-
var
|
|
3311
|
-
function
|
|
3312
|
-
let r = e.trim(), i =
|
|
3782
|
+
var da = /^:::([\w][\w-]*)/, fa = /^([\w\p{L}-]+):::([\w][\w-]*)/u;
|
|
3783
|
+
function pa(e, t, n) {
|
|
3784
|
+
let r = e.trim(), i = ma(r, t, n);
|
|
3313
3785
|
if (!i || i.ids.length === 0) return;
|
|
3314
3786
|
r = i.remaining.trim();
|
|
3315
3787
|
let a = i.ids;
|
|
3316
3788
|
for (; r.length > 0;) {
|
|
3317
3789
|
let e, i, o, s, c, l, u, d = r.match(/^([\w-]+)@(?=[-=<~ox])/);
|
|
3318
3790
|
d && (u = d[1], r = r.slice(d[0].length));
|
|
3319
|
-
let f = r.match(
|
|
3320
|
-
if (f && p !== void 0 && !(h === void 0 && g === void 0 &&
|
|
3321
|
-
e = h !== void 0, c =
|
|
3791
|
+
let f = r.match(Qi), p = f?.[2], h = f?.[1], g = f?.[3];
|
|
3792
|
+
if (f && p !== void 0 && !(h === void 0 && g === void 0 && $i.has(p))) {
|
|
3793
|
+
e = h !== void 0, c = ea(h);
|
|
3322
3794
|
let t = f[4]?.trim();
|
|
3323
|
-
s = t ? m(t) : void 0, r = r.slice(f[0].length).trim(), i =
|
|
3795
|
+
s = t ? m(t) : void 0, r = r.slice(f[0].length).trim(), i = va(p), o = g !== void 0, l = ea(g);
|
|
3324
3796
|
} else {
|
|
3325
|
-
let t = r.match(
|
|
3797
|
+
let t = r.match(ta);
|
|
3326
3798
|
if (!t) break;
|
|
3327
|
-
e = !!t[1], c =
|
|
3799
|
+
e = !!t[1], c = ea(t[1]);
|
|
3328
3800
|
let n = t[3].trim();
|
|
3329
3801
|
s = n ? m(n) : void 0;
|
|
3330
3802
|
let a = t[2], u = t[4];
|
|
3331
|
-
r = r.slice(t[0].length).trim(), i =
|
|
3803
|
+
r = r.slice(t[0].length).trim(), i = ya(a, u), l = ea(u.slice(-1)), o = u.endsWith(">") || l !== void 0;
|
|
3332
3804
|
}
|
|
3333
|
-
let _ =
|
|
3805
|
+
let _ = ma(r, t, n);
|
|
3334
3806
|
if (!_ || _.ids.length === 0) break;
|
|
3335
3807
|
r = _.remaining.trim();
|
|
3336
3808
|
for (let n of a) for (let r of _.ids) t.edges.push({
|
|
@@ -3347,13 +3819,13 @@ function wi(e, t, n) {
|
|
|
3347
3819
|
a = _.ids;
|
|
3348
3820
|
}
|
|
3349
3821
|
}
|
|
3350
|
-
function
|
|
3351
|
-
let r =
|
|
3822
|
+
function ma(e, t, n) {
|
|
3823
|
+
let r = ha(e, t, n);
|
|
3352
3824
|
if (!r) return null;
|
|
3353
3825
|
let i = [r.id], a = r.remaining.trim();
|
|
3354
3826
|
for (; a.startsWith("&");) {
|
|
3355
3827
|
a = a.slice(1).trim();
|
|
3356
|
-
let e =
|
|
3828
|
+
let e = ha(a, t, n);
|
|
3357
3829
|
if (!e) break;
|
|
3358
3830
|
i.push(e.id), a = e.remaining.trim();
|
|
3359
3831
|
}
|
|
@@ -3362,27 +3834,27 @@ function Ti(e, t, n) {
|
|
|
3362
3834
|
remaining: a
|
|
3363
3835
|
};
|
|
3364
3836
|
}
|
|
3365
|
-
function
|
|
3366
|
-
let r = null, i = e, a, o = i.match(
|
|
3837
|
+
function ha(e, t, n) {
|
|
3838
|
+
let r = null, i = e, a, o = i.match(fa);
|
|
3367
3839
|
o && (a = o[2], i = o[1] + i.slice(o[0].length));
|
|
3368
|
-
let s = i.match(
|
|
3840
|
+
let s = i.match(ia);
|
|
3369
3841
|
if (s) {
|
|
3370
|
-
let e = s[1], a =
|
|
3842
|
+
let e = s[1], a = le(i.slice(e.length));
|
|
3371
3843
|
if (a) {
|
|
3372
|
-
let o =
|
|
3373
|
-
|
|
3844
|
+
let o = me(a.body);
|
|
3845
|
+
ga(t, n, {
|
|
3374
3846
|
id: e,
|
|
3375
|
-
label: m(
|
|
3376
|
-
shape:
|
|
3847
|
+
label: m(oa(e, o)),
|
|
3848
|
+
shape: aa(o)
|
|
3377
3849
|
}), r = e, i = i.slice(e.length + a.length);
|
|
3378
3850
|
}
|
|
3379
3851
|
}
|
|
3380
|
-
if (r === null) for (let { regex: e, shape: a } of
|
|
3852
|
+
if (r === null) for (let { regex: e, shape: a } of na) {
|
|
3381
3853
|
let o = i.match(e);
|
|
3382
3854
|
if (o) {
|
|
3383
3855
|
r = o[1];
|
|
3384
3856
|
let e = m(o[2]), s = typeof a == "function" ? a(o[3] ?? "") : a;
|
|
3385
|
-
|
|
3857
|
+
ga(t, n, {
|
|
3386
3858
|
id: r,
|
|
3387
3859
|
label: e,
|
|
3388
3860
|
shape: s
|
|
@@ -3391,8 +3863,8 @@ function Ei(e, t, n) {
|
|
|
3391
3863
|
}
|
|
3392
3864
|
}
|
|
3393
3865
|
if (r === null) {
|
|
3394
|
-
let e = i.match(
|
|
3395
|
-
e && (r = e[1], t.nodes.has(r) ||
|
|
3866
|
+
let e = i.match(ra);
|
|
3867
|
+
e && (r = e[1], t.nodes.has(r) || ga(t, n, {
|
|
3396
3868
|
id: r,
|
|
3397
3869
|
label: r,
|
|
3398
3870
|
shape: "rectangle"
|
|
@@ -3400,117 +3872,138 @@ function Ei(e, t, n) {
|
|
|
3400
3872
|
}
|
|
3401
3873
|
if (r === null) return null;
|
|
3402
3874
|
a && t.classAssignments.set(r, a);
|
|
3403
|
-
let c = i.match(
|
|
3875
|
+
let c = i.match(da);
|
|
3404
3876
|
return c && (t.classAssignments.set(r, c[1]), i = i.slice(c[0].length)), {
|
|
3405
3877
|
id: r,
|
|
3406
3878
|
remaining: i
|
|
3407
3879
|
};
|
|
3408
3880
|
}
|
|
3409
|
-
function
|
|
3410
|
-
e.nodes.has(n.id) || e.nodes.set(n.id, n),
|
|
3881
|
+
function ga(e, t, n) {
|
|
3882
|
+
e.nodes.has(n.id) || e.nodes.set(n.id, n), _a(t, n.id);
|
|
3411
3883
|
}
|
|
3412
|
-
function
|
|
3884
|
+
function _a(e, t) {
|
|
3413
3885
|
if (e.length > 0) {
|
|
3414
3886
|
let n = e[e.length - 1];
|
|
3415
3887
|
n.nodeIds.includes(t) || n.nodeIds.push(t);
|
|
3416
3888
|
}
|
|
3417
3889
|
}
|
|
3418
|
-
function
|
|
3890
|
+
function va(e) {
|
|
3419
3891
|
return e.startsWith("~") ? "invisible" : e.includes(".") ? "dotted" : e.startsWith("=") ? "thick" : "solid";
|
|
3420
3892
|
}
|
|
3421
|
-
function
|
|
3893
|
+
function ya(e, t) {
|
|
3422
3894
|
return e.includes(".") || t.includes(".") ? "dotted" : e.startsWith("=") || t.startsWith("=") ? "thick" : "solid";
|
|
3423
3895
|
}
|
|
3424
3896
|
//#endregion
|
|
3425
3897
|
//#region packages/svg-renderer/src/registry.ts
|
|
3426
|
-
var
|
|
3898
|
+
var ba = {
|
|
3427
3899
|
type: "xychart",
|
|
3428
|
-
parse:
|
|
3429
|
-
layoutForSvg:
|
|
3900
|
+
parse: ge,
|
|
3901
|
+
layoutForSvg: Wr,
|
|
3430
3902
|
renderSvg(e, t, n) {
|
|
3431
3903
|
let r = n.interactivity === void 0 ? n.interactive ?? !1 : n.interactivity === "full";
|
|
3432
|
-
return
|
|
3904
|
+
return ni(e, t.colors, t.font, t.transparent, r, t.embedSource, t.title, t.decorative, t.emit);
|
|
3433
3905
|
}
|
|
3434
|
-
},
|
|
3906
|
+
}, xa = {
|
|
3435
3907
|
type: "sequence",
|
|
3436
|
-
parse:
|
|
3437
|
-
layoutForSvg:
|
|
3908
|
+
parse: he,
|
|
3909
|
+
layoutForSvg: jr,
|
|
3438
3910
|
renderSvg(e, t) {
|
|
3439
|
-
return
|
|
3911
|
+
return Mr(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
3440
3912
|
}
|
|
3441
3913
|
};
|
|
3442
|
-
function
|
|
3914
|
+
function Sa(e) {
|
|
3443
3915
|
return (e.interactivity ?? "static") !== "none";
|
|
3444
3916
|
}
|
|
3445
|
-
function
|
|
3917
|
+
function Ca(e) {
|
|
3446
3918
|
return (e.interactivity ?? "static") === "full";
|
|
3447
3919
|
}
|
|
3448
|
-
var
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3920
|
+
var wa = {
|
|
3921
|
+
type: "class",
|
|
3922
|
+
parse: fe,
|
|
3923
|
+
layoutForSvg: $n,
|
|
3924
|
+
renderSvg(e, t, n) {
|
|
3925
|
+
return nr(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, Sa(n), t.emit);
|
|
3926
|
+
}
|
|
3927
|
+
}, Ta = {
|
|
3928
|
+
type: "er",
|
|
3929
|
+
parse: pe,
|
|
3930
|
+
layoutForSvg(e, t) {
|
|
3931
|
+
return vr(ee(e, t.direction), t);
|
|
3459
3932
|
},
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3933
|
+
renderSvg(e, t) {
|
|
3934
|
+
return yr(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
3935
|
+
}
|
|
3936
|
+
}, Ea = {
|
|
3937
|
+
type: "flowchart",
|
|
3938
|
+
parse: (e, t) => Ki(t),
|
|
3939
|
+
layoutForSvg(e, t) {
|
|
3940
|
+
return {
|
|
3941
|
+
graph: Ft(ee(e, t.direction), t),
|
|
3942
|
+
curve: t.curve ?? e.initConfig?.curve ?? "linear"
|
|
3943
|
+
};
|
|
3944
|
+
},
|
|
3945
|
+
renderSvg(e, t, n) {
|
|
3946
|
+
return Lt(e.graph, t.colors, t.font, t.transparent, t.fontSizes, e.curve, t.embedSource, Ca(n), Sa(n), t.title, t.decorative, t.emit);
|
|
3947
|
+
}
|
|
3948
|
+
}, Da = {
|
|
3949
|
+
type: "c4",
|
|
3950
|
+
parse: de,
|
|
3951
|
+
layoutForSvg(e, t) {
|
|
3952
|
+
return ji(e, t);
|
|
3468
3953
|
},
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3954
|
+
renderSvg(e, t) {
|
|
3955
|
+
return Mi(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
3956
|
+
}
|
|
3957
|
+
}, Oa = {
|
|
3958
|
+
xychart: ba,
|
|
3959
|
+
er: Ta,
|
|
3960
|
+
sequence: xa,
|
|
3961
|
+
class: wa,
|
|
3962
|
+
flowchart: Ea,
|
|
3963
|
+
architecture: {
|
|
3964
|
+
type: "architecture",
|
|
3965
|
+
parse: ue,
|
|
3472
3966
|
layoutForSvg(e, t) {
|
|
3473
3967
|
return {
|
|
3474
|
-
graph:
|
|
3475
|
-
curve: t.curve ??
|
|
3968
|
+
graph: Ft(ee(re(e), t.direction), t),
|
|
3969
|
+
curve: t.curve ?? "linear"
|
|
3476
3970
|
};
|
|
3477
3971
|
},
|
|
3478
|
-
renderSvg
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
}
|
|
3972
|
+
renderSvg: Ea.renderSvg
|
|
3973
|
+
},
|
|
3974
|
+
c4: Da
|
|
3482
3975
|
};
|
|
3483
3976
|
//#endregion
|
|
3484
3977
|
//#region packages/svg-renderer/src/index.ts
|
|
3485
|
-
function
|
|
3978
|
+
function ka(t) {
|
|
3486
3979
|
return {
|
|
3487
|
-
bg:
|
|
3488
|
-
fg:
|
|
3489
|
-
line:
|
|
3490
|
-
accent:
|
|
3491
|
-
muted:
|
|
3492
|
-
surface:
|
|
3493
|
-
border:
|
|
3980
|
+
bg: t.bg ?? e.bg,
|
|
3981
|
+
fg: t.fg ?? e.fg,
|
|
3982
|
+
line: t.line,
|
|
3983
|
+
accent: t.accent,
|
|
3984
|
+
muted: t.muted,
|
|
3985
|
+
surface: t.surface,
|
|
3986
|
+
border: t.border
|
|
3494
3987
|
};
|
|
3495
3988
|
}
|
|
3496
|
-
function
|
|
3497
|
-
return D(
|
|
3989
|
+
function Aa(e = {}) {
|
|
3990
|
+
return D(ka(e), e.transparent);
|
|
3498
3991
|
}
|
|
3499
|
-
function
|
|
3992
|
+
function ja(e) {
|
|
3500
3993
|
return {
|
|
3501
3994
|
nonce: e.nonce,
|
|
3502
3995
|
styleAttribute: e.styleAttribute
|
|
3503
3996
|
};
|
|
3504
3997
|
}
|
|
3505
|
-
function
|
|
3506
|
-
let n =
|
|
3507
|
-
return t.resolveColors ?
|
|
3998
|
+
function Ma(e, t = {}) {
|
|
3999
|
+
let n = Na(e, t);
|
|
4000
|
+
return t.resolveColors ? Jn(n, ka(t)) : n;
|
|
3508
4001
|
}
|
|
3509
|
-
function
|
|
3510
|
-
let n =
|
|
4002
|
+
function Na(e, t) {
|
|
4003
|
+
let n = ve(e), i = ka(t), a = t.font ?? "Inter";
|
|
3511
4004
|
S(u(a));
|
|
3512
|
-
let o = t.transparent ?? !1, s = P(t.fontSizes), c =
|
|
3513
|
-
colors:
|
|
4005
|
+
let o = t.transparent ?? !1, s = P(t.fontSizes), c = r(n), l = t.embedSource ? e : void 0, d = t.title, f = t.decorative, p = ja(t), m = C(n), h = Oa[c], g = h.parse(m, n), _ = h.layoutForSvg(g, t), v = {
|
|
4006
|
+
colors: i,
|
|
3514
4007
|
font: a,
|
|
3515
4008
|
transparent: o,
|
|
3516
4009
|
fontSizes: s,
|
|
@@ -3521,11 +4014,11 @@ function Bi(e, t) {
|
|
|
3521
4014
|
};
|
|
3522
4015
|
return h.renderSvg(_, v, t);
|
|
3523
4016
|
}
|
|
3524
|
-
async function
|
|
3525
|
-
return
|
|
4017
|
+
async function Pa(e, t = {}) {
|
|
4018
|
+
return Ma(e, t);
|
|
3526
4019
|
}
|
|
3527
|
-
var
|
|
4020
|
+
var Fa = Ma, Ia = Pa;
|
|
3528
4021
|
//#endregion
|
|
3529
|
-
export { z as ARROW_HEAD,
|
|
4022
|
+
export { z as ARROW_HEAD, U as CLS, Le as ELK_DIRECTION_FALLBACK, N as FONT_SIZES, F as FONT_WEIGHTS, Fe as GROUP_HEADER_CONTENT_PAD, He as INLINE_CENTERED_EDGE_LABEL, Ne as MONO_FONT, Pe as MONO_FONT_STACK, I as NODE_PADDING, L as STROKE_WIDTHS, R as TEXT_BASELINE_SHIFT, Be as baseElkLayoutOptions, kr as boxLabelHeight, B as buildElkEdge, Ue as buildElkEdgeLabel, Ve as buildElkLeafNode, Yn as classNoteId, it as clipEdgeToShape, It as convertToElkFormat, Oe as createLayoutCache, Re as directionToElk, je as elkLayoutSync, ze as elkPadding, Me as estimateMonoTextWidth, M as estimateTextWidth, Hn as evaluateCssColorValue, ht as extractEdgeLabelPosition, mt as extractEdgePoints, $r as formatTickLabels, $n as layoutClassDiagramSync, vr as layoutErDiagramSync, Ft as layoutGraphSync, jr as layoutSequenceDiagram, Wr as layoutXYChart, Qr as niceTickValues, we as pointsToPath, nr as renderClassSvg, yr as renderErSvg, Ia as renderMermaid, Ma as renderMermaidSVG, Pa as renderMermaidSVGAsync, Fa as renderMermaidSync, Mr as renderSequenceSvg, Lt as renderSvg, ni as renderXYChartSvg, Jn as resolveCssColors, P as resolveFontSizes, oi as smoothCurvePath, Aa as themeCssVariables, H as withDataSrc };
|
|
3530
4023
|
|
|
3531
4024
|
//# sourceMappingURL=index.js.map
|