@zjlab-frontier/markdown 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -0
- package/dist/Tableau10-D7jGxypv.mjs +8 -0
- package/dist/arc-BkFOiLi7.mjs +84 -0
- package/dist/array-CqVTtuYm.mjs +6 -0
- package/dist/blockDiagram-c4efeb88-CngVNufX.mjs +1221 -0
- package/dist/c4Diagram-c83219d4-CvSWXhSV.mjs +1579 -0
- package/dist/channel-BCTzeqLo.mjs +5 -0
- package/dist/classDiagram-beda092f-8UkpWDgI.mjs +218 -0
- package/dist/classDiagram-v2-2358418a-D3LsBhTm.mjs +200 -0
- package/dist/clone-DZgGXtyK.mjs +8 -0
- package/dist/createText-1719965b-DMv-Bu7A.mjs +155 -0
- package/dist/edges-96097737-BeVwLt3S.mjs +1088 -0
- package/dist/erDiagram-0228fc6a-GXXkRZ8r.mjs +929 -0
- package/dist/flowDb-c6c81e3f-CrOg5i55.mjs +1126 -0
- package/dist/flowDiagram-50d868cf-sXe_oFAW.mjs +788 -0
- package/dist/flowDiagram-v2-4f6560a1-CoKYvZkH.mjs +17 -0
- package/dist/flowchart-elk-definition-6af322e1-SuvGsuBl.mjs +48146 -0
- package/dist/ganttDiagram-a2739b55-BbWq9bqY.mjs +2477 -0
- package/dist/gitGraphDiagram-82fe8481-C6-e4UmK.mjs +1264 -0
- package/dist/graph-CoIGCRFf.mjs +847 -0
- package/dist/index-5325376f-BENBY8aO.mjs +373 -0
- package/dist/index-5_ujiRGo.mjs +46276 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +8 -0
- package/dist/index.umd.js +2421 -0
- package/dist/infoDiagram-8eee0895-BEAb2pCD.mjs +319 -0
- package/dist/init-DjUOC4st.mjs +16 -0
- package/dist/journeyDiagram-c64418c1-CERjyYnA.mjs +801 -0
- package/dist/layout-aCAVHR2T.mjs +1472 -0
- package/dist/line-BGunMwE-.mjs +33 -0
- package/dist/linear-DciWi0hE.mjs +423 -0
- package/dist/markdown.d.ts +25 -0
- package/dist/mindmap-definition-8da855dc-Cc8_U7zD.mjs +21936 -0
- package/dist/ordinal-C0oynhte.mjs +61 -0
- package/dist/path-DLwuMfdd.mjs +84 -0
- package/dist/pieDiagram-a8764435-B00hy7Ez.mjs +500 -0
- package/dist/quadrantDiagram-1e28029f-DR7IGAoM.mjs +903 -0
- package/dist/requirementDiagram-08caed73-o6N3X3-m.mjs +767 -0
- package/dist/sankeyDiagram-a04cb91d-CYF9Ro1W.mjs +802 -0
- package/dist/sequenceDiagram-c5b8d532-vz_R7xBU.mjs +2234 -0
- package/dist/stateDiagram-1ecb1508-B0YUHnuE.mjs +266 -0
- package/dist/stateDiagram-v2-c2b004d7-CDTm1Jfb.mjs +184 -0
- package/dist/styles/highlight.scss +115 -0
- package/dist/styles/markdown.scss +1163 -0
- package/dist/styles-b4e223ce-C_-huVuQ.mjs +1089 -0
- package/dist/styles-ca3715f6-soe07Bnw.mjs +960 -0
- package/dist/styles-d45a18b0-0ZXwJp5P.mjs +436 -0
- package/dist/svgDrawCommon-b86b1483-UCLksviB.mjs +64 -0
- package/dist/timeline-definition-faaaa080-Dt5unv7p.mjs +792 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/xychartDiagram-f5964ef8-BZWS0E_9.mjs +1282 -0
- package/package.json +66 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { i as N, G as A } from "./graph-CoIGCRFf.mjs";
|
|
2
|
+
import { m as $, l as H } from "./layout-aCAVHR2T.mjs";
|
|
3
|
+
import { c as V } from "./clone-DZgGXtyK.mjs";
|
|
4
|
+
import { i as U, u as W, s as _, a as q, b as z, g as D, p as O, c as K, d as Q, e as p, f as J, h as Y, j as Z } from "./edges-96097737-BeVwLt3S.mjs";
|
|
5
|
+
import { l as s, g as T, r as S, d as L } from "./index-5_ujiRGo.mjs";
|
|
6
|
+
import { a as I } from "./createText-1719965b-DMv-Bu7A.mjs";
|
|
7
|
+
function m(e) {
|
|
8
|
+
var t = {
|
|
9
|
+
options: {
|
|
10
|
+
directed: e.isDirected(),
|
|
11
|
+
multigraph: e.isMultigraph(),
|
|
12
|
+
compound: e.isCompound()
|
|
13
|
+
},
|
|
14
|
+
nodes: tt(e),
|
|
15
|
+
edges: et(e)
|
|
16
|
+
};
|
|
17
|
+
return N(e.graph()) || (t.value = V(e.graph())), t;
|
|
18
|
+
}
|
|
19
|
+
function tt(e) {
|
|
20
|
+
return $(e.nodes(), function(t) {
|
|
21
|
+
var n = e.node(t), r = e.parent(t), i = { v: t };
|
|
22
|
+
return N(n) || (i.value = n), N(r) || (i.parent = r), i;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function et(e) {
|
|
26
|
+
return $(e.edges(), function(t) {
|
|
27
|
+
var n = e.edge(t), r = { v: t.v, w: t.w };
|
|
28
|
+
return N(t.name) || (r.name = t.name), N(n) || (r.value = n), r;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
let l = {}, g = {}, R = {};
|
|
32
|
+
const nt = () => {
|
|
33
|
+
g = {}, R = {}, l = {};
|
|
34
|
+
}, B = (e, t) => (s.trace("In isDescendant", t, " ", e, " = ", g[t].includes(e)), !!g[t].includes(e)), it = (e, t) => (s.info("Descendants of ", t, " is ", g[t]), s.info("Edge is ", e), e.v === t || e.w === t ? !1 : g[t] ? g[t].includes(e.v) || B(e.v, t) || B(e.w, t) || g[t].includes(e.w) : (s.debug("Tilt, ", t, ",not in descendants"), !1)), P = (e, t, n, r) => {
|
|
35
|
+
s.warn(
|
|
36
|
+
"Copying children of ",
|
|
37
|
+
e,
|
|
38
|
+
"root",
|
|
39
|
+
r,
|
|
40
|
+
"data",
|
|
41
|
+
t.node(e),
|
|
42
|
+
r
|
|
43
|
+
);
|
|
44
|
+
const i = t.children(e) || [];
|
|
45
|
+
e !== r && i.push(e), s.warn("Copying (nodes) clusterId", e, "nodes", i), i.forEach((a) => {
|
|
46
|
+
if (t.children(a).length > 0)
|
|
47
|
+
P(a, t, n, r);
|
|
48
|
+
else {
|
|
49
|
+
const d = t.node(a);
|
|
50
|
+
s.info("cp ", a, " to ", r, " with parent ", e), n.setNode(a, d), r !== t.parent(a) && (s.warn("Setting parent", a, t.parent(a)), n.setParent(a, t.parent(a))), e !== r && a !== e ? (s.debug("Setting parent", a, e), n.setParent(a, e)) : (s.info("In copy ", e, "root", r, "data", t.node(e), r), s.debug(
|
|
51
|
+
"Not Setting parent for node=",
|
|
52
|
+
a,
|
|
53
|
+
"cluster!==rootId",
|
|
54
|
+
e !== r,
|
|
55
|
+
"node!==clusterId",
|
|
56
|
+
a !== e
|
|
57
|
+
));
|
|
58
|
+
const u = t.edges(a);
|
|
59
|
+
s.debug("Copying Edges", u), u.forEach((f) => {
|
|
60
|
+
s.info("Edge", f);
|
|
61
|
+
const h = t.edge(f.v, f.w, f.name);
|
|
62
|
+
s.info("Edge data", h, r);
|
|
63
|
+
try {
|
|
64
|
+
it(f, r) ? (s.info("Copying as ", f.v, f.w, h, f.name), n.setEdge(f.v, f.w, h, f.name), s.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : s.info(
|
|
65
|
+
"Skipping copy of edge ",
|
|
66
|
+
f.v,
|
|
67
|
+
"-->",
|
|
68
|
+
f.w,
|
|
69
|
+
" rootId: ",
|
|
70
|
+
r,
|
|
71
|
+
" clusterId:",
|
|
72
|
+
e
|
|
73
|
+
);
|
|
74
|
+
} catch (w) {
|
|
75
|
+
s.error(w);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
s.debug("Removing node", a), t.removeNode(a);
|
|
80
|
+
});
|
|
81
|
+
}, k = (e, t) => {
|
|
82
|
+
const n = t.children(e);
|
|
83
|
+
let r = [...n];
|
|
84
|
+
for (const i of n)
|
|
85
|
+
R[i] = e, r = [...r, ...k(i, t)];
|
|
86
|
+
return r;
|
|
87
|
+
}, C = (e, t) => {
|
|
88
|
+
s.trace("Searching", e);
|
|
89
|
+
const n = t.children(e);
|
|
90
|
+
if (s.trace("Searching children of id ", e, n), n.length < 1)
|
|
91
|
+
return s.trace("This is a valid node", e), e;
|
|
92
|
+
for (const r of n) {
|
|
93
|
+
const i = C(r, t);
|
|
94
|
+
if (i)
|
|
95
|
+
return s.trace("Found replacement for", e, " => ", i), i;
|
|
96
|
+
}
|
|
97
|
+
}, X = (e) => !l[e] || !l[e].externalConnections ? e : l[e] ? l[e].id : e, st = (e, t) => {
|
|
98
|
+
if (!e || t > 10) {
|
|
99
|
+
s.debug("Opting out, no graph ");
|
|
100
|
+
return;
|
|
101
|
+
} else
|
|
102
|
+
s.debug("Opting in, graph ");
|
|
103
|
+
e.nodes().forEach(function(n) {
|
|
104
|
+
e.children(n).length > 0 && (s.warn(
|
|
105
|
+
"Cluster identified",
|
|
106
|
+
n,
|
|
107
|
+
" Replacement id in edges: ",
|
|
108
|
+
C(n, e)
|
|
109
|
+
), g[n] = k(n, e), l[n] = { id: C(n, e), clusterData: e.node(n) });
|
|
110
|
+
}), e.nodes().forEach(function(n) {
|
|
111
|
+
const r = e.children(n), i = e.edges();
|
|
112
|
+
r.length > 0 ? (s.debug("Cluster identified", n, g), i.forEach((a) => {
|
|
113
|
+
if (a.v !== n && a.w !== n) {
|
|
114
|
+
const d = B(a.v, n), u = B(a.w, n);
|
|
115
|
+
d ^ u && (s.warn("Edge: ", a, " leaves cluster ", n), s.warn("Descendants of XXX ", n, ": ", g[n]), l[n].externalConnections = !0);
|
|
116
|
+
}
|
|
117
|
+
})) : s.debug("Not a cluster ", n, g);
|
|
118
|
+
});
|
|
119
|
+
for (let n of Object.keys(l)) {
|
|
120
|
+
const r = l[n].id, i = e.parent(r);
|
|
121
|
+
i !== n && l[i] && !l[i].externalConnections && (l[n].id = i);
|
|
122
|
+
}
|
|
123
|
+
e.edges().forEach(function(n) {
|
|
124
|
+
const r = e.edge(n);
|
|
125
|
+
s.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), s.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
|
|
126
|
+
let i = n.v, a = n.w;
|
|
127
|
+
if (s.warn(
|
|
128
|
+
"Fix XXX",
|
|
129
|
+
l,
|
|
130
|
+
"ids:",
|
|
131
|
+
n.v,
|
|
132
|
+
n.w,
|
|
133
|
+
"Translating: ",
|
|
134
|
+
l[n.v],
|
|
135
|
+
" --- ",
|
|
136
|
+
l[n.w]
|
|
137
|
+
), l[n.v] && l[n.w] && l[n.v] === l[n.w]) {
|
|
138
|
+
s.warn("Fixing and trixing link to self - removing XXX", n.v, n.w, n.name), s.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), i = X(n.v), a = X(n.w), e.removeEdge(n.v, n.w, n.name);
|
|
139
|
+
const d = n.w + "---" + n.v;
|
|
140
|
+
e.setNode(d, {
|
|
141
|
+
domId: d,
|
|
142
|
+
id: d,
|
|
143
|
+
labelStyle: "",
|
|
144
|
+
labelText: r.label,
|
|
145
|
+
padding: 0,
|
|
146
|
+
shape: "labelRect",
|
|
147
|
+
style: ""
|
|
148
|
+
});
|
|
149
|
+
const u = structuredClone(r), f = structuredClone(r);
|
|
150
|
+
u.label = "", u.arrowTypeEnd = "none", f.label = "", u.fromCluster = n.v, f.toCluster = n.v, e.setEdge(i, d, u, n.name + "-cyclic-special"), e.setEdge(d, a, f, n.name + "-cyclic-special");
|
|
151
|
+
} else if (l[n.v] || l[n.w]) {
|
|
152
|
+
if (s.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), i = X(n.v), a = X(n.w), e.removeEdge(n.v, n.w, n.name), i !== n.v) {
|
|
153
|
+
const d = e.parent(i);
|
|
154
|
+
l[d].externalConnections = !0, r.fromCluster = n.v;
|
|
155
|
+
}
|
|
156
|
+
if (a !== n.w) {
|
|
157
|
+
const d = e.parent(a);
|
|
158
|
+
l[d].externalConnections = !0, r.toCluster = n.w;
|
|
159
|
+
}
|
|
160
|
+
s.warn("Fix Replacing with XXX", i, a, n.name), e.setEdge(i, a, r, n.name);
|
|
161
|
+
}
|
|
162
|
+
}), s.warn("Adjusted Graph", m(e)), F(e, 0), s.trace(l);
|
|
163
|
+
}, F = (e, t) => {
|
|
164
|
+
if (s.warn("extractor - ", t, m(e), e.children("D")), t > 10) {
|
|
165
|
+
s.error("Bailing out");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
let n = e.nodes(), r = !1;
|
|
169
|
+
for (const i of n) {
|
|
170
|
+
const a = e.children(i);
|
|
171
|
+
r = r || a.length > 0;
|
|
172
|
+
}
|
|
173
|
+
if (!r) {
|
|
174
|
+
s.debug("Done, no node has children", e.nodes());
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
s.debug("Nodes = ", n, t);
|
|
178
|
+
for (const i of n)
|
|
179
|
+
if (s.debug(
|
|
180
|
+
"Extracting node",
|
|
181
|
+
i,
|
|
182
|
+
l,
|
|
183
|
+
l[i] && !l[i].externalConnections,
|
|
184
|
+
!e.parent(i),
|
|
185
|
+
e.node(i),
|
|
186
|
+
e.children("D"),
|
|
187
|
+
" Depth ",
|
|
188
|
+
t
|
|
189
|
+
), !l[i])
|
|
190
|
+
s.debug("Not a cluster", i, t);
|
|
191
|
+
else if (!l[i].externalConnections && // !graph.parent(node) &&
|
|
192
|
+
e.children(i) && e.children(i).length > 0) {
|
|
193
|
+
s.warn(
|
|
194
|
+
"Cluster without external connections, without a parent and with children",
|
|
195
|
+
i,
|
|
196
|
+
t
|
|
197
|
+
);
|
|
198
|
+
let d = e.graph().rankdir === "TB" ? "LR" : "TB";
|
|
199
|
+
l[i] && l[i].clusterData && l[i].clusterData.dir && (d = l[i].clusterData.dir, s.warn("Fixing dir", l[i].clusterData.dir, d));
|
|
200
|
+
const u = new A({
|
|
201
|
+
multigraph: !0,
|
|
202
|
+
compound: !0
|
|
203
|
+
}).setGraph({
|
|
204
|
+
rankdir: d,
|
|
205
|
+
// Todo: set proper spacing
|
|
206
|
+
nodesep: 50,
|
|
207
|
+
ranksep: 50,
|
|
208
|
+
marginx: 8,
|
|
209
|
+
marginy: 8
|
|
210
|
+
}).setDefaultEdgeLabel(function() {
|
|
211
|
+
return {};
|
|
212
|
+
});
|
|
213
|
+
s.warn("Old graph before copy", m(e)), P(i, e, u, i), e.setNode(i, {
|
|
214
|
+
clusterNode: !0,
|
|
215
|
+
id: i,
|
|
216
|
+
clusterData: l[i].clusterData,
|
|
217
|
+
labelText: l[i].labelText,
|
|
218
|
+
graph: u
|
|
219
|
+
}), s.warn("New graph after copy node: (", i, ")", m(u)), s.debug("Old graph after copy", m(e));
|
|
220
|
+
} else
|
|
221
|
+
s.warn(
|
|
222
|
+
"Cluster ** ",
|
|
223
|
+
i,
|
|
224
|
+
" **not meeting the criteria !externalConnections:",
|
|
225
|
+
!l[i].externalConnections,
|
|
226
|
+
" no parent: ",
|
|
227
|
+
!e.parent(i),
|
|
228
|
+
" children ",
|
|
229
|
+
e.children(i) && e.children(i).length > 0,
|
|
230
|
+
e.children("D"),
|
|
231
|
+
t
|
|
232
|
+
), s.debug(l);
|
|
233
|
+
n = e.nodes(), s.warn("New list of nodes", n);
|
|
234
|
+
for (const i of n) {
|
|
235
|
+
const a = e.node(i);
|
|
236
|
+
s.warn(" Now next level", i, a), a.clusterNode && F(a.graph, t + 1);
|
|
237
|
+
}
|
|
238
|
+
}, G = (e, t) => {
|
|
239
|
+
if (t.length === 0)
|
|
240
|
+
return [];
|
|
241
|
+
let n = Object.assign(t);
|
|
242
|
+
return t.forEach((r) => {
|
|
243
|
+
const i = e.children(r), a = G(e, i);
|
|
244
|
+
n = [...n, ...a];
|
|
245
|
+
}), n;
|
|
246
|
+
}, rt = (e) => G(e, e.children()), at = (e, t) => {
|
|
247
|
+
s.info("Creating subgraph rect for ", t.id, t);
|
|
248
|
+
const n = T(), r = e.insert("g").attr("class", "cluster" + (t.class ? " " + t.class : "")).attr("id", t.id), i = r.insert("rect", ":first-child"), a = S(n.flowchart.htmlLabels), d = r.insert("g").attr("class", "cluster-label"), u = t.labelType === "markdown" ? I(d, t.labelText, { style: t.labelStyle, useHtmlLabels: a }) : d.node().appendChild(J(t.labelText, t.labelStyle, void 0, !0));
|
|
249
|
+
let f = u.getBBox();
|
|
250
|
+
if (S(n.flowchart.htmlLabels)) {
|
|
251
|
+
const c = u.children[0], o = L(u);
|
|
252
|
+
f = c.getBoundingClientRect(), o.attr("width", f.width), o.attr("height", f.height);
|
|
253
|
+
}
|
|
254
|
+
const h = 0 * t.padding, w = h / 2, x = t.width <= f.width + h ? f.width + h : t.width;
|
|
255
|
+
t.width <= f.width + h ? t.diff = (f.width - t.width) / 2 - t.padding / 2 : t.diff = -t.padding / 2, s.trace("Data ", t, JSON.stringify(t)), i.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - x / 2).attr("y", t.y - t.height / 2 - w).attr("width", x).attr("height", t.height + h);
|
|
256
|
+
const { subGraphTitleTopMargin: v } = D(n);
|
|
257
|
+
a ? d.attr(
|
|
258
|
+
"transform",
|
|
259
|
+
// This puts the label on top of the box instead of inside it
|
|
260
|
+
`translate(${t.x - f.width / 2}, ${t.y - t.height / 2 + v})`
|
|
261
|
+
) : d.attr(
|
|
262
|
+
"transform",
|
|
263
|
+
// This puts the label on top of the box instead of inside it
|
|
264
|
+
`translate(${t.x}, ${t.y - t.height / 2 + v})`
|
|
265
|
+
);
|
|
266
|
+
const y = i.node().getBBox();
|
|
267
|
+
return t.width = y.width, t.height = y.height, t.intersect = function(c) {
|
|
268
|
+
return p(t, c);
|
|
269
|
+
}, r;
|
|
270
|
+
}, ct = (e, t) => {
|
|
271
|
+
const n = e.insert("g").attr("class", "note-cluster").attr("id", t.id), r = n.insert("rect", ":first-child"), i = 0 * t.padding, a = i / 2;
|
|
272
|
+
r.attr("rx", t.rx).attr("ry", t.ry).attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2 - a).attr("width", t.width + i).attr("height", t.height + i).attr("fill", "none");
|
|
273
|
+
const d = r.node().getBBox();
|
|
274
|
+
return t.width = d.width, t.height = d.height, t.intersect = function(u) {
|
|
275
|
+
return p(t, u);
|
|
276
|
+
}, n;
|
|
277
|
+
}, ot = (e, t) => {
|
|
278
|
+
const n = T(), r = e.insert("g").attr("class", t.classes).attr("id", t.id), i = r.insert("rect", ":first-child"), a = r.insert("g").attr("class", "cluster-label"), d = r.append("rect"), u = a.node().appendChild(J(t.labelText, t.labelStyle, void 0, !0));
|
|
279
|
+
let f = u.getBBox();
|
|
280
|
+
if (S(n.flowchart.htmlLabels)) {
|
|
281
|
+
const c = u.children[0], o = L(u);
|
|
282
|
+
f = c.getBoundingClientRect(), o.attr("width", f.width), o.attr("height", f.height);
|
|
283
|
+
}
|
|
284
|
+
f = u.getBBox();
|
|
285
|
+
const h = 0 * t.padding, w = h / 2, x = t.width <= f.width + t.padding ? f.width + t.padding : t.width;
|
|
286
|
+
t.width <= f.width + t.padding ? t.diff = (f.width + t.padding * 0 - t.width) / 2 : t.diff = -t.padding / 2, i.attr("class", "outer").attr("x", t.x - x / 2 - w).attr("y", t.y - t.height / 2 - w).attr("width", x + h).attr("height", t.height + h), d.attr("class", "inner").attr("x", t.x - x / 2 - w).attr("y", t.y - t.height / 2 - w + f.height - 1).attr("width", x + h).attr("height", t.height + h - f.height - 3);
|
|
287
|
+
const { subGraphTitleTopMargin: v } = D(n);
|
|
288
|
+
a.attr(
|
|
289
|
+
"transform",
|
|
290
|
+
`translate(${t.x - f.width / 2}, ${t.y - t.height / 2 - t.padding / 3 + (S(n.flowchart.htmlLabels) ? 5 : 3) + v})`
|
|
291
|
+
);
|
|
292
|
+
const y = i.node().getBBox();
|
|
293
|
+
return t.height = y.height, t.intersect = function(c) {
|
|
294
|
+
return p(t, c);
|
|
295
|
+
}, r;
|
|
296
|
+
}, lt = (e, t) => {
|
|
297
|
+
const n = e.insert("g").attr("class", t.classes).attr("id", t.id), r = n.insert("rect", ":first-child"), i = 0 * t.padding, a = i / 2;
|
|
298
|
+
r.attr("class", "divider").attr("x", t.x - t.width / 2 - a).attr("y", t.y - t.height / 2).attr("width", t.width + i).attr("height", t.height + i);
|
|
299
|
+
const d = r.node().getBBox();
|
|
300
|
+
return t.width = d.width, t.height = d.height, t.diff = -t.padding / 2, t.intersect = function(u) {
|
|
301
|
+
return p(t, u);
|
|
302
|
+
}, n;
|
|
303
|
+
}, ft = { rect: at, roundedWithTitle: ot, noteGroup: ct, divider: lt };
|
|
304
|
+
let j = {};
|
|
305
|
+
const dt = (e, t) => {
|
|
306
|
+
s.trace("Inserting cluster");
|
|
307
|
+
const n = t.shape || "rect";
|
|
308
|
+
j[t.id] = ft[n](e, t);
|
|
309
|
+
}, ut = () => {
|
|
310
|
+
j = {};
|
|
311
|
+
}, M = async (e, t, n, r, i, a) => {
|
|
312
|
+
s.info("Graph in recursive render: XXX", m(t), i);
|
|
313
|
+
const d = t.graph().rankdir;
|
|
314
|
+
s.trace("Dir in recursive render - dir:", d);
|
|
315
|
+
const u = e.insert("g").attr("class", "root");
|
|
316
|
+
t.nodes() ? s.info("Recursive render XXX", t.nodes()) : s.info("No nodes found for", t), t.edges().length > 0 && s.trace("Recursive edges", t.edge(t.edges()[0]));
|
|
317
|
+
const f = u.insert("g").attr("class", "clusters"), h = u.insert("g").attr("class", "edgePaths"), w = u.insert("g").attr("class", "edgeLabels"), x = u.insert("g").attr("class", "nodes");
|
|
318
|
+
await Promise.all(
|
|
319
|
+
t.nodes().map(async function(c) {
|
|
320
|
+
const o = t.node(c);
|
|
321
|
+
if (i !== void 0) {
|
|
322
|
+
const b = JSON.parse(JSON.stringify(i.clusterData));
|
|
323
|
+
s.info("Setting data for cluster XXX (", c, ") ", b, i), t.setNode(i.id, b), t.parent(c) || (s.trace("Setting parent", c, i.id), t.setParent(c, i.id, b));
|
|
324
|
+
}
|
|
325
|
+
if (s.info("(Insert) Node XXX" + c + ": " + JSON.stringify(t.node(c))), o && o.clusterNode) {
|
|
326
|
+
s.info("Cluster identified", c, o.width, t.node(c));
|
|
327
|
+
const b = await M(
|
|
328
|
+
x,
|
|
329
|
+
o.graph,
|
|
330
|
+
n,
|
|
331
|
+
r,
|
|
332
|
+
t.node(c),
|
|
333
|
+
a
|
|
334
|
+
), E = b.elem;
|
|
335
|
+
W(o, E), o.diff = b.diff || 0, s.info("Node bounds (abc123)", c, o, o.width, o.x, o.y), _(E, o), s.warn("Recursive render complete ", E, o);
|
|
336
|
+
} else
|
|
337
|
+
t.children(c).length > 0 ? (s.info("Cluster - the non recursive path XXX", c, o.id, o, t), s.info(C(o.id, t)), l[o.id] = { id: C(o.id, t), node: o }) : (s.info("Node - the non recursive path", c, o.id, o), await q(x, t.node(c), d));
|
|
338
|
+
})
|
|
339
|
+
), t.edges().forEach(function(c) {
|
|
340
|
+
const o = t.edge(c.v, c.w, c.name);
|
|
341
|
+
s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c)), s.info("Edge " + c.v + " -> " + c.w + ": ", c, " ", JSON.stringify(t.edge(c))), s.info("Fix", l, "ids:", c.v, c.w, "Translating: ", l[c.v], l[c.w]), z(w, o);
|
|
342
|
+
}), t.edges().forEach(function(c) {
|
|
343
|
+
s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(c));
|
|
344
|
+
}), s.info("#############################################"), s.info("### Layout ###"), s.info("#############################################"), s.info(t), H(t), s.info("Graph after layout:", m(t));
|
|
345
|
+
let v = 0;
|
|
346
|
+
const { subGraphTitleTotalMargin: y } = D(a);
|
|
347
|
+
return rt(t).forEach(function(c) {
|
|
348
|
+
const o = t.node(c);
|
|
349
|
+
s.info("Position " + c + ": " + JSON.stringify(t.node(c))), s.info(
|
|
350
|
+
"Position " + c + ": (" + o.x,
|
|
351
|
+
"," + o.y,
|
|
352
|
+
") width: ",
|
|
353
|
+
o.width,
|
|
354
|
+
" height: ",
|
|
355
|
+
o.height
|
|
356
|
+
), o && o.clusterNode ? (o.y += y, O(o)) : t.children(c).length > 0 ? (o.height += y, dt(f, o), l[o.id].node = o) : (o.y += y / 2, O(o));
|
|
357
|
+
}), t.edges().forEach(function(c) {
|
|
358
|
+
const o = t.edge(c);
|
|
359
|
+
s.info("Edge " + c.v + " -> " + c.w + ": " + JSON.stringify(o), o), o.points.forEach((E) => E.y += y / 2);
|
|
360
|
+
const b = K(h, c, o, l, n, t, r);
|
|
361
|
+
Q(o, b);
|
|
362
|
+
}), t.nodes().forEach(function(c) {
|
|
363
|
+
const o = t.node(c);
|
|
364
|
+
s.info(c, o.type, o.diff), o.type === "group" && (v = o.diff);
|
|
365
|
+
}), { elem: u, diff: v };
|
|
366
|
+
}, bt = async (e, t, n, r, i) => {
|
|
367
|
+
U(e, n, r, i), Y(), Z(), ut(), nt(), s.warn("Graph at first:", JSON.stringify(m(t))), st(t), s.warn("Graph after:", JSON.stringify(m(t)));
|
|
368
|
+
const a = T();
|
|
369
|
+
await M(e, t, r, i, void 0, a);
|
|
370
|
+
};
|
|
371
|
+
export {
|
|
372
|
+
bt as r
|
|
373
|
+
};
|