@umami/shiso 1.12.0 → 1.13.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/chunks/App.js +76 -49
- package/dist/chunks/abnfDiagram-VCTEODGH.js +109 -0
- package/dist/chunks/arc.js +130 -0
- package/dist/chunks/architecture-7GRP2DOG.js +4 -0
- package/dist/chunks/architectureDiagram-5GKGNRK7.js +7466 -0
- package/dist/chunks/array.js +8 -0
- package/dist/chunks/blockDiagram-I7D4REHJ.js +2546 -0
- package/dist/chunks/c4Diagram-7LVT6UL2.js +3654 -0
- package/dist/chunks/channel.js +9 -0
- package/dist/chunks/chunk-2Q5K7J3B.js +21 -0
- package/dist/chunks/chunk-4HAMMTFA.js +6106 -0
- package/dist/chunks/chunk-5VM5RSS4.js +21 -0
- package/dist/chunks/chunk-75Z2AOVW.js +2185 -0
- package/dist/chunks/chunk-DU6HZSFF.js +8729 -0
- package/dist/chunks/chunk-F27PBJKO.js +95 -0
- package/dist/chunks/chunk-FOHPRMQF.js +27162 -0
- package/dist/chunks/chunk-GMAD6QVW.js +2369 -0
- package/dist/chunks/chunk-GVQU2GXP.js +58 -0
- package/dist/chunks/chunk-IMKFNOWR.js +2593 -0
- package/dist/chunks/chunk-JWPE2WC7.js +12 -0
- package/dist/chunks/chunk-L3NEJ4N5.js +420 -0
- package/dist/chunks/chunk-OSK3NFVY.js +1029 -0
- package/dist/chunks/chunk-P2QGCYS3.js +95 -0
- package/dist/chunks/chunk-POPQ4Y6H.js +33 -0
- package/dist/chunks/chunk-PWAF6VOD.js +467 -0
- package/dist/chunks/chunk-SHT3W25Y.js +4813 -0
- package/dist/chunks/chunk-SVP7TREG.js +686 -0
- package/dist/chunks/chunk-TICWLB2K.js +3800 -0
- package/dist/chunks/chunk-XXDRQBXY.js +12 -0
- package/dist/chunks/chunk-Y2CYZVJY.js +15 -0
- package/dist/chunks/classDiagram-ZZMXUADV.js +33 -0
- package/dist/chunks/classDiagram-v2-VYDZK3BY.js +33 -0
- package/dist/chunks/cose-bilkent-JH36ORCC.js +4268 -0
- package/dist/chunks/cynefin-OW5HDTMX.js +4 -0
- package/dist/chunks/cynefinDiagram-5FMLGOSQ.js +482 -0
- package/dist/chunks/cytoscape.esm.js +28282 -0
- package/dist/chunks/dagre-GXQ25YYZ.js +583 -0
- package/dist/chunks/dagre.js +4235 -0
- package/dist/chunks/defaultLocale.js +246 -0
- package/dist/chunks/diagram-S7CK7UJ4.js +402 -0
- package/dist/chunks/diagram-UQ7AKVKN.js +291 -0
- package/dist/chunks/diagram-VSXAHHWV.js +553 -0
- package/dist/chunks/diagram-VX7I27RA.js +798 -0
- package/dist/chunks/diagram-Z3DM3KII.js +186 -0
- package/dist/chunks/dist.js +92 -0
- package/dist/chunks/docs.js +987 -91
- package/dist/chunks/ebnfDiagram-PWID7BFC.js +123 -0
- package/dist/chunks/erDiagram-RLTQ6QDP.js +2295 -0
- package/dist/chunks/eventmodeling-NTZA5JFV.js +4 -0
- package/dist/chunks/flowDiagram-HODETNUW.js +17 -0
- package/dist/chunks/ganttDiagram-EL5Y4UJY.js +3928 -0
- package/dist/chunks/gitGraph-4MIJSDKK.js +4 -0
- package/dist/chunks/gitGraphDiagram-WWUBYQGX.js +1153 -0
- package/dist/chunks/graphlib.js +4194 -0
- package/dist/chunks/info-A6RAGUB7.js +4 -0
- package/dist/chunks/infoDiagram-27XIBGKW.js +25 -0
- package/dist/chunks/init.js +14 -0
- package/dist/chunks/ishikawaDiagram-5VMMS53U.js +971 -0
- package/dist/chunks/journeyDiagram-3NMN7TZE.js +1226 -0
- package/dist/chunks/kanban-definition-UXKFOSKX.js +1241 -0
- package/dist/chunks/katex.js +26463 -0
- package/dist/chunks/line.js +48 -0
- package/dist/chunks/linear.js +391 -0
- package/dist/chunks/mermaid-parser.core.js +754 -0
- package/dist/chunks/mermaid.core.js +4898 -0
- package/dist/chunks/mindmap-definition-YA3MSWOX.js +1309 -0
- package/dist/chunks/ordinal.js +84 -0
- package/dist/chunks/packet-AYTQ26CC.js +4 -0
- package/dist/chunks/path.js +106 -0
- package/dist/chunks/pegDiagram-XKGWAZYB.js +115 -0
- package/dist/chunks/pie-WAS4IAKB.js +4 -0
- package/dist/chunks/pieDiagram-E7YTZNPT.js +297 -0
- package/dist/chunks/quadrantDiagram-AXDQQJYC.js +2234 -0
- package/dist/chunks/radar-RG4KPBEZ.js +4 -0
- package/dist/chunks/railroad-74A4TZTK.js +4 -0
- package/dist/chunks/railroad-abnf-HS5TGJTU.js +4 -0
- package/dist/chunks/railroad-ebnf-LZEXJU2U.js +4 -0
- package/dist/chunks/railroad-peg-WCYAUIDC.js +4 -0
- package/dist/chunks/railroadDiagram-O6MQD6OU.js +89 -0
- package/dist/chunks/requirementDiagram-BXWQKSXE.js +2464 -0
- package/dist/chunks/rough.esm.js +1396 -0
- package/dist/chunks/sankeyDiagram-P5KCCOFB.js +1308 -0
- package/dist/chunks/sequenceDiagram-WJ2MYXX4.js +5445 -0
- package/dist/chunks/sizeCapture-INFHLROL.js +56 -0
- package/dist/chunks/src.js +2653 -0
- package/dist/chunks/stateDiagram-D77RDMKH.js +368 -0
- package/dist/chunks/stateDiagram-v2-MP3YSRHH.js +33 -0
- package/dist/chunks/swimlanes-42K2YHIH.js +6925 -0
- package/dist/chunks/swimlanesDiagram-VR7AAH4N.js +32 -0
- package/dist/chunks/timeline-definition-24CTP7MA.js +1507 -0
- package/dist/chunks/treeView-Q6P3EWNA.js +4 -0
- package/dist/chunks/treemap-WGGIJYW6.js +4 -0
- package/dist/chunks/vennDiagram-4TSXK5OY.js +2803 -0
- package/dist/chunks/wardley-WFR3VGLG.js +4 -0
- package/dist/chunks/wardleyDiagram-VM6X3IG4.js +877 -0
- package/dist/chunks/xychartDiagram-S5SC5T6Z.js +2698 -0
- package/dist/components.js +2 -2
- package/dist/entry-client.js +1 -1
- package/dist/entry-server.js +1 -1
- package/docs.schema.json +1 -1
- package/package.json +2 -1
- package/scripts/expand-navigation-globs.mjs +77 -8
- package/src/components/CodeBlock.tsx +36 -0
- package/src/components/Docs.tsx +44 -21
- package/src/components/OpenApiOperation.tsx +28 -20
- package/src/components/SideNav.tsx +8 -3
- package/src/components/docs/Changelog.tsx +163 -0
- package/src/components/docs/Mermaid.tsx +164 -0
- package/src/components/docs/Panel.tsx +23 -0
- package/src/components/docs/ParamField.tsx +17 -5
- package/src/components/docs/PropertiesTable.tsx +2 -2
- package/src/components/docs/ResponseField.tsx +17 -5
- package/src/components/docs/Tiles.tsx +59 -0
- package/src/components/docs/Tree.tsx +359 -0
- package/src/components/docs/Update.tsx +72 -0
- package/src/components/docs/index.ts +7 -0
- package/src/components/docs/panel-context.tsx +25 -0
- package/src/components/docs/styles.ts +49 -0
- package/src/components/icons/index.ts +4 -0
- package/src/lib/rehype-shiki.ts +18 -1
- package/types/components.d.ts +79 -0
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
import { n as __name } from "./chunk-Y2CYZVJY.js";
|
|
2
|
+
import { m as log } from "./src.js";
|
|
3
|
+
import { x as getConfig2 } from "./chunk-DU6HZSFF.js";
|
|
4
|
+
import "./chunk-75Z2AOVW.js";
|
|
5
|
+
import "./chunk-PWAF6VOD.js";
|
|
6
|
+
import "./chunk-GMAD6QVW.js";
|
|
7
|
+
import "./chunk-P2QGCYS3.js";
|
|
8
|
+
import { s as updateNodeBounds } from "./chunk-4HAMMTFA.js";
|
|
9
|
+
import { a as setNodeElem, i as positionNode, n as getSubGraphTitleMargins } from "./chunk-GVQU2GXP.js";
|
|
10
|
+
import { a as insertEdgeLabel, c as positionEdgeLabel, i as insertEdge } from "./chunk-OSK3NFVY.js";
|
|
11
|
+
import { t as Graph } from "./graphlib.js";
|
|
12
|
+
import { t as layout } from "./dagre.js";
|
|
13
|
+
import { n as insertCluster } from "./chunk-L3NEJ4N5.js";
|
|
14
|
+
import { a as createCommonLayoutRenderer, c as insertMeasuredNode, i as clusterDb, l as sortNodesByHierarchy, o as createLayoutElementGroups, r as adjustClustersAndEdges, s as findNonClusterChild } from "./mermaid.core.js";
|
|
15
|
+
|
|
16
|
+
//#region ../../node_modules/.pnpm/mermaid@11.17.2/node_modules/mermaid/dist/chunks/mermaid.core/dagre-GXQ25YYZ.mjs
|
|
17
|
+
var clamp = /* @__PURE__ */ __name((value, min, max) => Math.max(min, Math.min(max, value)), "clamp");
|
|
18
|
+
var getDefaultSelfLoopSide = /* @__PURE__ */ __name((rankdir = "TB") => {
|
|
19
|
+
switch (rankdir) {
|
|
20
|
+
case "BT": return "bottom";
|
|
21
|
+
case "LR": return "right";
|
|
22
|
+
case "RL": return "left";
|
|
23
|
+
default: return "top";
|
|
24
|
+
}
|
|
25
|
+
}, "getDefaultSelfLoopSide");
|
|
26
|
+
var shouldMergeSelfLoopSegments = /* @__PURE__ */ __name((diagramType) => diagramType === "flowchart" || diagramType === "flowchart-v2" || diagramType === "stateDiagram" || diagramType === "er" || diagramType === "classDiagram", "shouldMergeSelfLoopSegments");
|
|
27
|
+
var DAGRE_NODE_LAYOUT_PROPERTIES = [
|
|
28
|
+
"x",
|
|
29
|
+
"y",
|
|
30
|
+
"width",
|
|
31
|
+
"height",
|
|
32
|
+
"labelBBox",
|
|
33
|
+
"intersect",
|
|
34
|
+
"calcIntersect",
|
|
35
|
+
"diff",
|
|
36
|
+
"clusterNode"
|
|
37
|
+
];
|
|
38
|
+
var getSelfLoopSide = /* @__PURE__ */ __name((graph, node, segments, originalNodeId, rankdir) => {
|
|
39
|
+
const layoutHints = [];
|
|
40
|
+
const dummyNodeIds = /* @__PURE__ */ new Set();
|
|
41
|
+
segments.forEach(({ start, end }) => {
|
|
42
|
+
if (start !== originalNodeId) dummyNodeIds.add(start);
|
|
43
|
+
if (end !== originalNodeId) dummyNodeIds.add(end);
|
|
44
|
+
});
|
|
45
|
+
dummyNodeIds.forEach((id) => {
|
|
46
|
+
const dummyNode = graph.node(id);
|
|
47
|
+
if (typeof dummyNode?.x === "number" && typeof dummyNode?.y === "number") layoutHints.push(dummyNode);
|
|
48
|
+
});
|
|
49
|
+
if (layoutHints.length === 0) segments.forEach(({ edge }) => {
|
|
50
|
+
(edge.points ?? []).forEach((point) => {
|
|
51
|
+
if (typeof point?.x === "number" && typeof point?.y === "number") layoutHints.push(point);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
if (layoutHints.length === 0) return getDefaultSelfLoopSide(rankdir);
|
|
55
|
+
const center = layoutHints.reduce((acc, point) => ({
|
|
56
|
+
x: acc.x + point.x / layoutHints.length,
|
|
57
|
+
y: acc.y + point.y / layoutHints.length
|
|
58
|
+
}), {
|
|
59
|
+
x: 0,
|
|
60
|
+
y: 0
|
|
61
|
+
});
|
|
62
|
+
const dx = center.x - node.x;
|
|
63
|
+
const dy = center.y - node.y;
|
|
64
|
+
if (Math.abs(dx) > Math.abs(dy)) return dx > 0 ? "right" : "left";
|
|
65
|
+
if (Math.abs(dy) > 0) return dy > 0 ? "bottom" : "top";
|
|
66
|
+
return getDefaultSelfLoopSide(rankdir);
|
|
67
|
+
}, "getSelfLoopSide");
|
|
68
|
+
var getSelfLoopPoints = /* @__PURE__ */ __name((node, side = "top", yOffset = 0, labelWidth = 0) => {
|
|
69
|
+
const x = node.x;
|
|
70
|
+
const y = node.y - yOffset;
|
|
71
|
+
const halfWidth = node.width / 2;
|
|
72
|
+
const halfHeight = node.height / 2;
|
|
73
|
+
const maxSpan = Math.max(36, Math.min(100, node.width * .8));
|
|
74
|
+
const span = clamp(Math.max(labelWidth, node.width * .35), 36, maxSpan);
|
|
75
|
+
const depth = clamp(Math.min(node.width, node.height) * .45, 24, 48);
|
|
76
|
+
switch (side) {
|
|
77
|
+
case "bottom": {
|
|
78
|
+
const bottom = y + halfHeight;
|
|
79
|
+
return [
|
|
80
|
+
{
|
|
81
|
+
x: x - span / 2,
|
|
82
|
+
y: bottom
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
x: x - span / 2,
|
|
86
|
+
y: bottom + depth
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
x: x + span / 2,
|
|
90
|
+
y: bottom + depth
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
x: x + span / 2,
|
|
94
|
+
y: bottom
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
case "right": {
|
|
99
|
+
const right = x + halfWidth;
|
|
100
|
+
return [
|
|
101
|
+
{
|
|
102
|
+
x: right,
|
|
103
|
+
y: y - span / 2
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
x: right + depth,
|
|
107
|
+
y: y - span / 2
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
x: right + depth,
|
|
111
|
+
y: y + span / 2
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
x: right,
|
|
115
|
+
y: y + span / 2
|
|
116
|
+
}
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
case "left": {
|
|
120
|
+
const left = x - halfWidth;
|
|
121
|
+
return [
|
|
122
|
+
{
|
|
123
|
+
x: left,
|
|
124
|
+
y: y - span / 2
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
x: left - depth,
|
|
128
|
+
y: y - span / 2
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
x: left - depth,
|
|
132
|
+
y: y + span / 2
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
x: left,
|
|
136
|
+
y: y + span / 2
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
default: {
|
|
141
|
+
const top = y - halfHeight;
|
|
142
|
+
return [
|
|
143
|
+
{
|
|
144
|
+
x: x - span / 2,
|
|
145
|
+
y: top
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
x: x - span / 2,
|
|
149
|
+
y: top - depth
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
x: x + span / 2,
|
|
153
|
+
y: top - depth
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
x: x + span / 2,
|
|
157
|
+
y: top
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}, "getSelfLoopPoints");
|
|
163
|
+
var getSelfLoopLabelPosition = /* @__PURE__ */ __name((node, points, side = "top", yOffset = 0, label = {}) => {
|
|
164
|
+
const gap = 4;
|
|
165
|
+
const x = node.x;
|
|
166
|
+
const y = node.y - yOffset;
|
|
167
|
+
const labelWidth = label.width ?? 0;
|
|
168
|
+
const labelHeight = label.height ?? 0;
|
|
169
|
+
switch (side) {
|
|
170
|
+
case "bottom": return {
|
|
171
|
+
x,
|
|
172
|
+
y: Math.max(...points.map((point) => point.y)) + labelHeight / 2 + gap
|
|
173
|
+
};
|
|
174
|
+
case "right": return {
|
|
175
|
+
x: Math.max(...points.map((point) => point.x)) + labelWidth / 2 + gap,
|
|
176
|
+
y
|
|
177
|
+
};
|
|
178
|
+
case "left": return {
|
|
179
|
+
x: Math.min(...points.map((point) => point.x)) - labelWidth / 2 - gap,
|
|
180
|
+
y
|
|
181
|
+
};
|
|
182
|
+
default: return {
|
|
183
|
+
x,
|
|
184
|
+
y: Math.min(...points.map((point) => point.y)) - labelHeight / 2 - gap
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}, "getSelfLoopLabelPosition");
|
|
188
|
+
var getEdgesToRender = /* @__PURE__ */ __name((graph, yOffset = 0, { mergeSelfLoops = true } = {}) => {
|
|
189
|
+
const selfLoopEdgeGroups = /* @__PURE__ */ new Map();
|
|
190
|
+
const edgesToRender = [];
|
|
191
|
+
const rankdir = graph.graph()?.rankdir;
|
|
192
|
+
graph.edges().forEach((e) => {
|
|
193
|
+
const edge = graph.edge(e);
|
|
194
|
+
if (mergeSelfLoops && edge.selfLoop) {
|
|
195
|
+
const key = edge.selfLoop.id;
|
|
196
|
+
if (!selfLoopEdgeGroups.has(key)) selfLoopEdgeGroups.set(key, []);
|
|
197
|
+
selfLoopEdgeGroups.get(key).push({
|
|
198
|
+
edge,
|
|
199
|
+
start: e.v,
|
|
200
|
+
end: e.w
|
|
201
|
+
});
|
|
202
|
+
} else edgesToRender.push({
|
|
203
|
+
edge,
|
|
204
|
+
start: e.v,
|
|
205
|
+
end: e.w
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
selfLoopEdgeGroups.forEach((segments) => {
|
|
209
|
+
if (segments.length !== 3) {
|
|
210
|
+
segments.forEach((segment) => edgesToRender.push(segment));
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
segments.sort((a, b) => a.edge.selfLoop.order - b.edge.selfLoop.order);
|
|
214
|
+
const [firstSegment, middleSegment, lastSegment] = segments;
|
|
215
|
+
const originalEdge = firstSegment.edge.originalEdge ?? middleSegment.edge.originalEdge ?? lastSegment.edge.originalEdge ?? middleSegment.edge;
|
|
216
|
+
const node = graph.node(originalEdge.start);
|
|
217
|
+
if (!node) {
|
|
218
|
+
segments.forEach((segment) => edgesToRender.push(segment));
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const label = {
|
|
222
|
+
width: middleSegment.edge.width,
|
|
223
|
+
height: middleSegment.edge.height
|
|
224
|
+
};
|
|
225
|
+
const side = getSelfLoopSide(graph, node, segments, originalEdge.start, rankdir);
|
|
226
|
+
const points = getSelfLoopPoints(node, side, yOffset, label.width ?? 0);
|
|
227
|
+
const labelPosition = getSelfLoopLabelPosition(node, points, side, yOffset, label);
|
|
228
|
+
const mergedEdge = {
|
|
229
|
+
...middleSegment.edge,
|
|
230
|
+
...originalEdge,
|
|
231
|
+
id: originalEdge.id,
|
|
232
|
+
points,
|
|
233
|
+
start: originalEdge.start,
|
|
234
|
+
end: originalEdge.end,
|
|
235
|
+
x: labelPosition.x,
|
|
236
|
+
y: labelPosition.y,
|
|
237
|
+
width: label.width,
|
|
238
|
+
height: label.height,
|
|
239
|
+
labelStyle: middleSegment.edge.labelStyle,
|
|
240
|
+
fromCluster: firstSegment.edge.fromCluster ?? middleSegment.edge.fromCluster ?? lastSegment.edge.fromCluster,
|
|
241
|
+
toCluster: firstSegment.edge.toCluster ?? middleSegment.edge.toCluster ?? lastSegment.edge.toCluster
|
|
242
|
+
};
|
|
243
|
+
delete mergedEdge.selfLoop;
|
|
244
|
+
delete mergedEdge.originalEdge;
|
|
245
|
+
edgesToRender.push({
|
|
246
|
+
edge: mergedEdge,
|
|
247
|
+
start: mergedEdge.start,
|
|
248
|
+
end: mergedEdge.end
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
return edgesToRender;
|
|
252
|
+
}, "getEdgesToRender");
|
|
253
|
+
var measureDagreGraph = /* @__PURE__ */ __name(async ({ element: _elem, graph, diagramType, id, parentCluster, siteConfig }) => {
|
|
254
|
+
const dir = graph.graph().rankdir;
|
|
255
|
+
log.trace("Dir in recursive render - dir:", dir);
|
|
256
|
+
const { clusters, edgePaths, edgeLabels, nodes, rootGroups: elem } = createLayoutElementGroups(_elem, { edgePathsClass: "edgePaths" });
|
|
257
|
+
if (!graph.nodes()) log.info("No nodes found for", graph);
|
|
258
|
+
else log.info("Recursive render XXX", graph.nodes());
|
|
259
|
+
if (graph.edges().length > 0) log.info("Recursive edges", graph.edge(graph.edges()[0]));
|
|
260
|
+
const mergeSelfLoops = shouldMergeSelfLoopSegments(diagramType);
|
|
261
|
+
await Promise.all(graph.nodes().map(async function(v) {
|
|
262
|
+
const node = graph.node(v);
|
|
263
|
+
if (parentCluster !== void 0) {
|
|
264
|
+
const data = JSON.parse(JSON.stringify(parentCluster.clusterData));
|
|
265
|
+
log.trace("Setting data for parent cluster XXX\n Node.id = ", v, "\n data=", data.height, "\nParent cluster", parentCluster.height);
|
|
266
|
+
graph.setNode(parentCluster.id, data);
|
|
267
|
+
if (!graph.parent(v)) {
|
|
268
|
+
log.trace("Setting parent", v, parentCluster.id);
|
|
269
|
+
graph.setParent(v, parentCluster.id, data);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
log.info("(Insert) Node XXX" + v + ": " + JSON.stringify(graph.node(v)));
|
|
273
|
+
if (node?.clusterNode) {
|
|
274
|
+
log.info("Cluster identified XBX", v, node.width, graph.node(v));
|
|
275
|
+
const { ranksep, nodesep } = graph.graph();
|
|
276
|
+
node.graph.setGraph({
|
|
277
|
+
...node.graph.graph(),
|
|
278
|
+
ranksep: ranksep + 25,
|
|
279
|
+
nodesep
|
|
280
|
+
});
|
|
281
|
+
const o = await renderDagreSubgraph({
|
|
282
|
+
element: nodes,
|
|
283
|
+
graph: node.graph,
|
|
284
|
+
diagramType,
|
|
285
|
+
id,
|
|
286
|
+
parentCluster: graph.node(v),
|
|
287
|
+
siteConfig
|
|
288
|
+
});
|
|
289
|
+
const newEl = o.elem;
|
|
290
|
+
updateNodeBounds(node, newEl);
|
|
291
|
+
node.diff = o.diff || 0;
|
|
292
|
+
log.info("New compound node after recursive render XAX", v, "width", node.width, "height", node.height);
|
|
293
|
+
setNodeElem(newEl, node);
|
|
294
|
+
} else if (graph.children(v).length > 0) {
|
|
295
|
+
log.trace("Cluster - the non recursive path XBX", v, node.id, node, node.width, "Graph:", graph);
|
|
296
|
+
log.trace(findNonClusterChild(node.id, graph));
|
|
297
|
+
clusterDb.set(node.id, {
|
|
298
|
+
id: findNonClusterChild(node.id, graph),
|
|
299
|
+
node
|
|
300
|
+
});
|
|
301
|
+
} else {
|
|
302
|
+
log.trace("Node - the non recursive path XAX", v, nodes, graph.node(v), dir);
|
|
303
|
+
await insertMeasuredNode(nodes, graph.node(v), {
|
|
304
|
+
config: siteConfig,
|
|
305
|
+
dir
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}));
|
|
309
|
+
await (/* @__PURE__ */ __name(async () => {
|
|
310
|
+
const edgePromises = graph.edges().map(async function(e) {
|
|
311
|
+
const edge = graph.edge(e.v, e.w, e.name);
|
|
312
|
+
log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
|
|
313
|
+
log.info("Edge " + e.v + " -> " + e.w + ": ", e, " ", JSON.stringify(graph.edge(e)));
|
|
314
|
+
log.info("Fix", clusterDb, "ids:", e.v, e.w, "Translating: ", clusterDb.get(e.v), clusterDb.get(e.w));
|
|
315
|
+
if (mergeSelfLoops && edge.selfLoop) {
|
|
316
|
+
if (edge.selfLoop.order !== 1) return;
|
|
317
|
+
const labelEdge = {
|
|
318
|
+
...edge.originalEdge,
|
|
319
|
+
...edge,
|
|
320
|
+
id: edge.selfLoop.id,
|
|
321
|
+
startLabelLeft: edge.originalEdge?.startLabelLeft ?? edge.startLabelLeft,
|
|
322
|
+
startLabelRight: edge.originalEdge?.startLabelRight ?? edge.startLabelRight,
|
|
323
|
+
endLabelLeft: edge.originalEdge?.endLabelLeft ?? edge.endLabelLeft,
|
|
324
|
+
endLabelRight: edge.originalEdge?.endLabelRight ?? edge.endLabelRight
|
|
325
|
+
};
|
|
326
|
+
await insertEdgeLabel(edgeLabels, labelEdge);
|
|
327
|
+
edge.width = labelEdge.width;
|
|
328
|
+
edge.height = labelEdge.height;
|
|
329
|
+
edge.labelStyle = labelEdge.labelStyle;
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
await insertEdgeLabel(edgeLabels, edge);
|
|
333
|
+
});
|
|
334
|
+
await Promise.all(edgePromises);
|
|
335
|
+
}, "processEdges"))();
|
|
336
|
+
const { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
|
|
337
|
+
return {
|
|
338
|
+
elem,
|
|
339
|
+
graph,
|
|
340
|
+
groups: {
|
|
341
|
+
clusters,
|
|
342
|
+
edgePaths,
|
|
343
|
+
edgeLabels,
|
|
344
|
+
nodes,
|
|
345
|
+
rootGroups: elem
|
|
346
|
+
},
|
|
347
|
+
diagramType,
|
|
348
|
+
id,
|
|
349
|
+
mergeSelfLoops,
|
|
350
|
+
subGraphTitleTotalMargin
|
|
351
|
+
};
|
|
352
|
+
}, "measureDagreGraph");
|
|
353
|
+
var runDagreGraphLayout = /* @__PURE__ */ __name((graph) => {
|
|
354
|
+
log.info("############################################# XXX");
|
|
355
|
+
log.info("### Layout ### XXX");
|
|
356
|
+
log.info("############################################# XXX");
|
|
357
|
+
layout(graph);
|
|
358
|
+
}, "runDagreGraphLayout");
|
|
359
|
+
var normalizeDagreNode = /* @__PURE__ */ __name((graph, nodeId, subGraphTitleTotalMargin) => {
|
|
360
|
+
const node = graph.node(nodeId);
|
|
361
|
+
if (!node) return;
|
|
362
|
+
const normalizedNode = { ...node };
|
|
363
|
+
if (node?.clusterNode) normalizedNode.y = (node.y ?? 0) + subGraphTitleTotalMargin;
|
|
364
|
+
else if (graph.children(nodeId).length > 0) normalizedNode.height = (node.height ?? 0) + subGraphTitleTotalMargin;
|
|
365
|
+
else normalizedNode.y = (node.y ?? 0) + subGraphTitleTotalMargin / 2;
|
|
366
|
+
return normalizedNode;
|
|
367
|
+
}, "normalizeDagreNode");
|
|
368
|
+
var applyDagreNodeLayout = /* @__PURE__ */ __name((targetNode, dagreNode) => {
|
|
369
|
+
DAGRE_NODE_LAYOUT_PROPERTIES.forEach((property) => {
|
|
370
|
+
if (dagreNode[property] !== void 0) targetNode[property] = dagreNode[property];
|
|
371
|
+
});
|
|
372
|
+
}, "applyDagreNodeLayout");
|
|
373
|
+
var normalizeDagreEdge = /* @__PURE__ */ __name((edge, start, end, edgeOffsetY) => ({
|
|
374
|
+
...edge,
|
|
375
|
+
start: edge.start ?? start,
|
|
376
|
+
end: edge.end ?? end,
|
|
377
|
+
points: (edge.points ?? []).map((point) => ({
|
|
378
|
+
...point,
|
|
379
|
+
y: typeof point.y === "number" ? point.y + edgeOffsetY : point.y
|
|
380
|
+
}))
|
|
381
|
+
}), "normalizeDagreEdge");
|
|
382
|
+
var applyDagreLayoutResult = /* @__PURE__ */ __name((data4Layout, measuredLayout) => {
|
|
383
|
+
const { graph, mergeSelfLoops, subGraphTitleTotalMargin = 0 } = measuredLayout;
|
|
384
|
+
const nodeById = new Map(data4Layout.nodes.map((node) => [node.id, node]));
|
|
385
|
+
sortNodesByHierarchy(graph).forEach((nodeId) => {
|
|
386
|
+
const dagreNode = normalizeDagreNode(graph, nodeId, subGraphTitleTotalMargin);
|
|
387
|
+
if (!dagreNode) return;
|
|
388
|
+
applyDagreNodeLayout(graph.node(nodeId), dagreNode);
|
|
389
|
+
const targetNode = nodeById.get(nodeId);
|
|
390
|
+
if (targetNode) applyDagreNodeLayout(targetNode, dagreNode);
|
|
391
|
+
});
|
|
392
|
+
const edgeOffsetY = subGraphTitleTotalMargin / 2;
|
|
393
|
+
data4Layout.edges = getEdgesToRender(graph, edgeOffsetY, { mergeSelfLoops }).map(({ edge, start, end }) => normalizeDagreEdge(edge, start, end, edgeOffsetY));
|
|
394
|
+
return data4Layout;
|
|
395
|
+
}, "applyDagreLayoutResult");
|
|
396
|
+
var paintDagreLayoutCore = /* @__PURE__ */ __name(async ({ elem, graph, groups: { clusters, edgePaths }, diagramType, id, mergeSelfLoops, subGraphTitleTotalMargin }) => {
|
|
397
|
+
let diff = 0;
|
|
398
|
+
await Promise.all(sortNodesByHierarchy(graph).map(async function(v) {
|
|
399
|
+
const node = graph.node(v);
|
|
400
|
+
log.info("Position XBX => " + v + ": (" + node.x, "," + node.y, ") width: ", node.width, " height: ", node.height);
|
|
401
|
+
if (node?.clusterNode) {
|
|
402
|
+
node.y += subGraphTitleTotalMargin;
|
|
403
|
+
log.info("A tainted cluster node XBX1", v, node.id, node.width, node.height, node.x, node.y, graph.parent(v));
|
|
404
|
+
clusterDb.get(node.id).node = node;
|
|
405
|
+
positionNode(node);
|
|
406
|
+
} else if (graph.children(v).length > 0) {
|
|
407
|
+
log.info("A pure cluster node XBX1", v, node.id, node.x, node.y, node.width, node.height, graph.parent(v));
|
|
408
|
+
node.height += subGraphTitleTotalMargin;
|
|
409
|
+
graph.node(node.parentId);
|
|
410
|
+
const halfPadding = node?.padding / 2 || 0;
|
|
411
|
+
const labelHeight = node?.labelBBox?.height || 0;
|
|
412
|
+
const offsetY = labelHeight - halfPadding || 0;
|
|
413
|
+
log.debug("OffsetY", offsetY, "labelHeight", labelHeight, "halfPadding", halfPadding);
|
|
414
|
+
await insertCluster(clusters, node);
|
|
415
|
+
clusterDb.get(node.id).node = node;
|
|
416
|
+
} else {
|
|
417
|
+
const parent = graph.node(node.parentId);
|
|
418
|
+
node.y += subGraphTitleTotalMargin / 2;
|
|
419
|
+
log.info("A regular node XBX1 - using the padding", node.id, "parent", node.parentId, node.width, node.height, node.x, node.y, "offsetY", node.offsetY, "parent", parent, parent?.offsetY, node);
|
|
420
|
+
positionNode(node);
|
|
421
|
+
}
|
|
422
|
+
}));
|
|
423
|
+
const edgeOffsetY = subGraphTitleTotalMargin / 2;
|
|
424
|
+
getEdgesToRender(graph, edgeOffsetY, { mergeSelfLoops }).forEach(function({ edge, start, end }) {
|
|
425
|
+
log.info("Edge " + start + " -> " + end + ": " + JSON.stringify(edge), edge);
|
|
426
|
+
edge.points.forEach((point) => point.y += edgeOffsetY);
|
|
427
|
+
const startNode = graph.node(start);
|
|
428
|
+
const endNode = graph.node(end);
|
|
429
|
+
const paths = insertEdge(edgePaths, edge, clusterDb, diagramType, startNode, endNode, id);
|
|
430
|
+
positionEdgeLabel(edge, paths);
|
|
431
|
+
});
|
|
432
|
+
graph.nodes().forEach(function(v) {
|
|
433
|
+
const n = graph.node(v);
|
|
434
|
+
log.info(v, n.type, n.diff);
|
|
435
|
+
if (n.isGroup) diff = n.diff;
|
|
436
|
+
});
|
|
437
|
+
log.warn("Returning from recursive render XAX", elem, diff);
|
|
438
|
+
return {
|
|
439
|
+
elem,
|
|
440
|
+
diff
|
|
441
|
+
};
|
|
442
|
+
}, "paintDagreLayoutCore");
|
|
443
|
+
var renderDagreSubgraph = /* @__PURE__ */ __name(async (options) => {
|
|
444
|
+
const measuredLayout = await measureDagreGraph(options);
|
|
445
|
+
runDagreGraphLayout(measuredLayout.graph);
|
|
446
|
+
return await paintDagreLayoutCore(measuredLayout);
|
|
447
|
+
}, "renderDagreSubgraph");
|
|
448
|
+
var prepareLayoutForDagre = /* @__PURE__ */ __name((data4Layout) => {
|
|
449
|
+
const graph = new Graph({
|
|
450
|
+
multigraph: true,
|
|
451
|
+
compound: true
|
|
452
|
+
}).setGraph({
|
|
453
|
+
rankdir: data4Layout.direction,
|
|
454
|
+
nodesep: data4Layout.config?.nodeSpacing || data4Layout.nodeSpacing || data4Layout.config?.flowchart?.nodeSpacing,
|
|
455
|
+
ranksep: data4Layout.config?.rankSpacing || data4Layout.rankSpacing || data4Layout.config?.flowchart?.rankSpacing,
|
|
456
|
+
marginx: 8,
|
|
457
|
+
marginy: 8
|
|
458
|
+
}).setDefaultEdgeLabel(function() {
|
|
459
|
+
return {};
|
|
460
|
+
});
|
|
461
|
+
data4Layout.nodes.forEach((node) => {
|
|
462
|
+
graph.setNode(node.id, { ...node });
|
|
463
|
+
if (node.parentId) graph.setParent(node.id, node.parentId);
|
|
464
|
+
});
|
|
465
|
+
log.debug("Edges:", data4Layout.edges);
|
|
466
|
+
data4Layout.edges.forEach((edge) => {
|
|
467
|
+
if (edge.start === edge.end) {
|
|
468
|
+
const nodeId = edge.start;
|
|
469
|
+
const specialId1 = nodeId + "---" + nodeId + "---1";
|
|
470
|
+
const specialId2 = nodeId + "---" + nodeId + "---2";
|
|
471
|
+
const node = graph.node(nodeId);
|
|
472
|
+
graph.setNode(specialId1, {
|
|
473
|
+
domId: specialId1,
|
|
474
|
+
id: specialId1,
|
|
475
|
+
parentId: node.parentId,
|
|
476
|
+
labelStyle: "",
|
|
477
|
+
label: "",
|
|
478
|
+
padding: 0,
|
|
479
|
+
shape: "labelRect",
|
|
480
|
+
style: "",
|
|
481
|
+
width: 10,
|
|
482
|
+
height: 10
|
|
483
|
+
});
|
|
484
|
+
graph.setParent(specialId1, node.parentId);
|
|
485
|
+
graph.setNode(specialId2, {
|
|
486
|
+
domId: specialId2,
|
|
487
|
+
id: specialId2,
|
|
488
|
+
parentId: node.parentId,
|
|
489
|
+
labelStyle: "",
|
|
490
|
+
padding: 0,
|
|
491
|
+
shape: "labelRect",
|
|
492
|
+
label: "",
|
|
493
|
+
style: "",
|
|
494
|
+
width: 10,
|
|
495
|
+
height: 10
|
|
496
|
+
});
|
|
497
|
+
graph.setParent(specialId2, node.parentId);
|
|
498
|
+
const originalEdge = structuredClone(edge);
|
|
499
|
+
const edge1 = structuredClone(edge);
|
|
500
|
+
const edgeMid = structuredClone(edge);
|
|
501
|
+
const edge2 = structuredClone(edge);
|
|
502
|
+
edge1.originalEdge = originalEdge;
|
|
503
|
+
edge1.selfLoop = {
|
|
504
|
+
id: originalEdge.id,
|
|
505
|
+
order: 0
|
|
506
|
+
};
|
|
507
|
+
edgeMid.originalEdge = originalEdge;
|
|
508
|
+
edgeMid.selfLoop = {
|
|
509
|
+
id: originalEdge.id,
|
|
510
|
+
order: 1
|
|
511
|
+
};
|
|
512
|
+
edge2.originalEdge = originalEdge;
|
|
513
|
+
edge2.selfLoop = {
|
|
514
|
+
id: originalEdge.id,
|
|
515
|
+
order: 2
|
|
516
|
+
};
|
|
517
|
+
edge1.label = "";
|
|
518
|
+
edge1.arrowTypeEnd = "none";
|
|
519
|
+
edge1.endLabelLeft = "";
|
|
520
|
+
edge1.endLabelRight = "";
|
|
521
|
+
edge1.startLabelLeft = "";
|
|
522
|
+
edge1.id = nodeId + "-cyclic-special-1";
|
|
523
|
+
edgeMid.startLabelRight = "";
|
|
524
|
+
edgeMid.startLabelLeft = "";
|
|
525
|
+
edgeMid.endLabelLeft = "";
|
|
526
|
+
edgeMid.endLabelRight = "";
|
|
527
|
+
edgeMid.arrowTypeStart = "none";
|
|
528
|
+
edgeMid.arrowTypeEnd = "none";
|
|
529
|
+
edgeMid.id = nodeId + "-cyclic-special-mid";
|
|
530
|
+
edge2.label = "";
|
|
531
|
+
edge2.startLabelRight = "";
|
|
532
|
+
edge2.startLabelLeft = "";
|
|
533
|
+
edge2.arrowTypeStart = "none";
|
|
534
|
+
if (node.isGroup) {
|
|
535
|
+
edge1.fromCluster = nodeId;
|
|
536
|
+
edge2.toCluster = nodeId;
|
|
537
|
+
}
|
|
538
|
+
edge2.id = nodeId + "-cyclic-special-2";
|
|
539
|
+
edge2.arrowTypeStart = "none";
|
|
540
|
+
graph.setEdge(nodeId, specialId1, edge1, nodeId + "-cyclic-special-0");
|
|
541
|
+
graph.setEdge(specialId1, specialId2, edgeMid, nodeId + "-cyclic-special-1");
|
|
542
|
+
graph.setEdge(specialId2, nodeId, edge2, nodeId + "-cyclic-special-2");
|
|
543
|
+
} else graph.setEdge(edge.start, edge.end, { ...edge }, edge.id);
|
|
544
|
+
});
|
|
545
|
+
adjustClustersAndEdges(graph);
|
|
546
|
+
return { graph };
|
|
547
|
+
}, "prepareLayoutForDagre");
|
|
548
|
+
var measureDagreLayout = /* @__PURE__ */ __name(async (data4Layout, { element, preparedLayout }) => {
|
|
549
|
+
const prepared = preparedLayout ?? prepareLayoutForDagre(data4Layout);
|
|
550
|
+
const siteConfig = getConfig2();
|
|
551
|
+
const measuredLayout = await measureDagreGraph({
|
|
552
|
+
element,
|
|
553
|
+
graph: prepared.graph,
|
|
554
|
+
diagramType: data4Layout.type,
|
|
555
|
+
id: data4Layout.diagramId,
|
|
556
|
+
parentCluster: void 0,
|
|
557
|
+
siteConfig
|
|
558
|
+
});
|
|
559
|
+
prepared.measuredLayout = measuredLayout;
|
|
560
|
+
return measuredLayout;
|
|
561
|
+
}, "measureDagreLayout");
|
|
562
|
+
var runDagreLayoutCore = /* @__PURE__ */ __name((data4Layout, context) => {
|
|
563
|
+
const measuredLayout = context.preparedLayout?.measuredLayout;
|
|
564
|
+
if (!measuredLayout) throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");
|
|
565
|
+
runDagreGraphLayout(measuredLayout.graph);
|
|
566
|
+
applyDagreLayoutResult(data4Layout, measuredLayout);
|
|
567
|
+
return measuredLayout;
|
|
568
|
+
}, "runDagreLayoutCore");
|
|
569
|
+
var render = createCommonLayoutRenderer({
|
|
570
|
+
prepareLayout: prepareLayoutForDagre,
|
|
571
|
+
measureLayout: measureDagreLayout,
|
|
572
|
+
runLayoutCore: runDagreLayoutCore,
|
|
573
|
+
paintOptions: {
|
|
574
|
+
clusterDb,
|
|
575
|
+
getNodes: /* @__PURE__ */ __name((_data4Layout, { measure }) => sortNodesByHierarchy(measure.graph).map((nodeId) => measure.graph.node(nodeId)).filter(Boolean), "getDagrePaintNodes"),
|
|
576
|
+
getEdgeNode: /* @__PURE__ */ __name((nodeId, _edge, { measure }) => nodeId ? measure.graph.node(nodeId) : void 0, "getDagreEdgeNode"),
|
|
577
|
+
skipNode: /* @__PURE__ */ __name((node, { measure }) => !measure.graph.hasNode(node.id), "skipNode"),
|
|
578
|
+
isCluster: /* @__PURE__ */ __name((node, { measure }) => measure.graph.hasNode(node.id) && (measure.graph.children(node.id) ?? []).length > 0, "isCluster")
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
//#endregion
|
|
583
|
+
export { applyDagreLayoutResult, getEdgesToRender, measureDagreLayout, prepareLayoutForDagre, render, runDagreLayoutCore };
|