@oxide/design-system 1.7.7--canary.fdd8ab6.0 → 1.7.7--canary.87d60df.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.
Files changed (130) hide show
  1. package/components/dist/architecture-I3QFYML2-YZWO3N3B.js +14 -0
  2. package/components/dist/architecture-I3QFYML2-YZWO3N3B.js.map +1 -0
  3. package/components/dist/architectureDiagram-UYN6MBPD-HXPGIDN7.js +8846 -0
  4. package/components/dist/architectureDiagram-UYN6MBPD-HXPGIDN7.js.map +1 -0
  5. package/components/dist/blockDiagram-ZHA2E4KO-OAYYKCLF.js +3721 -0
  6. package/components/dist/blockDiagram-ZHA2E4KO-OAYYKCLF.js.map +1 -0
  7. package/components/dist/c4Diagram-6F5ED5ID-TBHFK2XY.js +2599 -0
  8. package/components/dist/c4Diagram-6F5ED5ID-TBHFK2XY.js.map +1 -0
  9. package/components/dist/chunk-2DDKDUUO.js +439 -0
  10. package/components/dist/chunk-2DDKDUUO.js.map +1 -0
  11. package/components/dist/chunk-2NHDMTP7.js +26905 -0
  12. package/components/dist/chunk-2NHDMTP7.js.map +1 -0
  13. package/components/dist/chunk-4IJS44L3.js +22 -0
  14. package/components/dist/chunk-4IJS44L3.js.map +1 -0
  15. package/components/dist/chunk-562WOS3Z.js +1109 -0
  16. package/components/dist/chunk-562WOS3Z.js.map +1 -0
  17. package/components/dist/chunk-6UD2HOKB.js +17082 -0
  18. package/components/dist/chunk-6UD2HOKB.js.map +1 -0
  19. package/components/dist/chunk-76BOQ7BT.js +63 -0
  20. package/components/dist/chunk-76BOQ7BT.js.map +1 -0
  21. package/components/dist/chunk-7I5DT373.js +97 -0
  22. package/components/dist/chunk-7I5DT373.js.map +1 -0
  23. package/components/dist/chunk-BPREMNVP.js +1875 -0
  24. package/components/dist/chunk-BPREMNVP.js.map +1 -0
  25. package/components/dist/chunk-BVYAEHG3.js +122 -0
  26. package/components/dist/chunk-BVYAEHG3.js.map +1 -0
  27. package/components/dist/chunk-BW7DFBOS.js +152 -0
  28. package/components/dist/chunk-BW7DFBOS.js.map +1 -0
  29. package/components/dist/chunk-EZG2MNHW.js +59 -0
  30. package/components/dist/chunk-EZG2MNHW.js.map +1 -0
  31. package/components/dist/chunk-G6QWNAHJ.js +43 -0
  32. package/components/dist/chunk-G6QWNAHJ.js.map +1 -0
  33. package/components/dist/chunk-H72D3HRR.js +1244 -0
  34. package/components/dist/chunk-H72D3HRR.js.map +1 -0
  35. package/components/dist/chunk-K532NZMW.js +46 -0
  36. package/components/dist/chunk-K532NZMW.js.map +1 -0
  37. package/components/dist/chunk-LC3BX2KL.js +25 -0
  38. package/components/dist/chunk-LC3BX2KL.js.map +1 -0
  39. package/components/dist/chunk-LQ2ABR7F.js +5665 -0
  40. package/components/dist/chunk-LQ2ABR7F.js.map +1 -0
  41. package/components/dist/chunk-M6L3MM6K.js +22 -0
  42. package/components/dist/chunk-M6L3MM6K.js.map +1 -0
  43. package/components/dist/chunk-MWA4PRRW.js +122 -0
  44. package/components/dist/chunk-MWA4PRRW.js.map +1 -0
  45. package/components/dist/chunk-ND3FLKHU.js +570 -0
  46. package/components/dist/chunk-ND3FLKHU.js.map +1 -0
  47. package/components/dist/chunk-NIVHLOPB.js +2621 -0
  48. package/components/dist/chunk-NIVHLOPB.js.map +1 -0
  49. package/components/dist/chunk-R6F6FFK7.js +65 -0
  50. package/components/dist/chunk-R6F6FFK7.js.map +1 -0
  51. package/components/dist/chunk-RN5R3L7O.js +2041 -0
  52. package/components/dist/chunk-RN5R3L7O.js.map +1 -0
  53. package/components/dist/chunk-RWDBBMDN.js +10910 -0
  54. package/components/dist/chunk-RWDBBMDN.js.map +1 -0
  55. package/components/dist/chunk-T7HPDS4Z.js +573 -0
  56. package/components/dist/chunk-T7HPDS4Z.js.map +1 -0
  57. package/components/dist/chunk-TG4YEU4Q.js +23 -0
  58. package/components/dist/chunk-TG4YEU4Q.js.map +1 -0
  59. package/components/dist/chunk-U5WCXBW2.js +48 -0
  60. package/components/dist/chunk-U5WCXBW2.js.map +1 -0
  61. package/components/dist/chunk-V6PWN6OH.js +1875 -0
  62. package/components/dist/chunk-V6PWN6OH.js.map +1 -0
  63. package/components/dist/chunk-VLTHNCSD.js +48 -0
  64. package/components/dist/chunk-VLTHNCSD.js.map +1 -0
  65. package/components/dist/chunk-WDK4G4UR.js +2791 -0
  66. package/components/dist/chunk-WDK4G4UR.js.map +1 -0
  67. package/components/dist/chunk-WLVQWTC6.js +77 -0
  68. package/components/dist/chunk-WLVQWTC6.js.map +1 -0
  69. package/components/dist/chunk-YDLS5R4M.js +48 -0
  70. package/components/dist/chunk-YDLS5R4M.js.map +1 -0
  71. package/components/dist/chunk-YGFBWU2Q.js +7 -0
  72. package/components/dist/chunk-YGFBWU2Q.js.map +1 -0
  73. package/components/dist/chunk-ZBL4CWCH.js +2120 -0
  74. package/components/dist/chunk-ZBL4CWCH.js.map +1 -0
  75. package/components/dist/classDiagram-LNE6IOMH-VRQHEQWM.js +40 -0
  76. package/components/dist/classDiagram-LNE6IOMH-VRQHEQWM.js.map +1 -0
  77. package/components/dist/classDiagram-v2-MQ7JQ4JX-5GB4NXXM.js +40 -0
  78. package/components/dist/classDiagram-v2-MQ7JQ4JX-5GB4NXXM.js.map +1 -0
  79. package/components/dist/dagre-4EVJKHTY-XW45LMKR.js +734 -0
  80. package/components/dist/dagre-4EVJKHTY-XW45LMKR.js.map +1 -0
  81. package/components/dist/diagram-QW4FP2JN-J2YMUPB5.js +226 -0
  82. package/components/dist/diagram-QW4FP2JN-J2YMUPB5.js.map +1 -0
  83. package/components/dist/erDiagram-6RL3IURR-HQULDVJI.js +1381 -0
  84. package/components/dist/erDiagram-6RL3IURR-HQULDVJI.js.map +1 -0
  85. package/components/dist/flowDiagram-7ASYPVHJ-2542732I.js +2349 -0
  86. package/components/dist/flowDiagram-7ASYPVHJ-2542732I.js.map +1 -0
  87. package/components/dist/ganttDiagram-NTVNEXSI-V66YQQB3.js +2413 -0
  88. package/components/dist/ganttDiagram-NTVNEXSI-V66YQQB3.js.map +1 -0
  89. package/components/dist/gitGraph-YCYPL57B-AAXPWQN7.js +14 -0
  90. package/components/dist/gitGraph-YCYPL57B-AAXPWQN7.js.map +1 -0
  91. package/components/dist/gitGraphDiagram-NRZ2UAAF-5DU6QMYZ.js +1763 -0
  92. package/components/dist/gitGraphDiagram-NRZ2UAAF-5DU6QMYZ.js.map +1 -0
  93. package/components/dist/index.d.ts +5 -2
  94. package/components/dist/index.js +1729 -126
  95. package/components/dist/index.js.map +1 -1
  96. package/components/dist/info-46DW6VJ7-43TTIEYF.js +14 -0
  97. package/components/dist/info-46DW6VJ7-43TTIEYF.js.map +1 -0
  98. package/components/dist/infoDiagram-A4XQUW5V-UZERSQDI.js +54 -0
  99. package/components/dist/infoDiagram-A4XQUW5V-UZERSQDI.js.map +1 -0
  100. package/components/dist/journeyDiagram-G5WM74LC-RVKMRGRW.js +1244 -0
  101. package/components/dist/journeyDiagram-G5WM74LC-RVKMRGRW.js.map +1 -0
  102. package/components/dist/kanban-definition-QRCXZQQD-NWU5I3TK.js +1119 -0
  103. package/components/dist/kanban-definition-QRCXZQQD-NWU5I3TK.js.map +1 -0
  104. package/components/dist/katex-WNZY3CE5.js +14484 -0
  105. package/components/dist/katex-WNZY3CE5.js.map +1 -0
  106. package/components/dist/mindmap-definition-GWI6TPTV-MISEH6LG.js +6013 -0
  107. package/components/dist/mindmap-definition-GWI6TPTV-MISEH6LG.js.map +1 -0
  108. package/components/dist/packet-W2GHVCYJ-FBZCFIPR.js +14 -0
  109. package/components/dist/packet-W2GHVCYJ-FBZCFIPR.js.map +1 -0
  110. package/components/dist/pie-BEWT4RHE-UFFBBCXM.js +14 -0
  111. package/components/dist/pie-BEWT4RHE-UFFBBCXM.js.map +1 -0
  112. package/components/dist/pieDiagram-YF2LJOPJ-IXEVHPCM.js +223 -0
  113. package/components/dist/pieDiagram-YF2LJOPJ-IXEVHPCM.js.map +1 -0
  114. package/components/dist/quadrantDiagram-OS5C2QUG-MW26UCZV.js +1408 -0
  115. package/components/dist/quadrantDiagram-OS5C2QUG-MW26UCZV.js.map +1 -0
  116. package/components/dist/requirementDiagram-MIRIMTAZ-BX24AAHL.js +1175 -0
  117. package/components/dist/requirementDiagram-MIRIMTAZ-BX24AAHL.js.map +1 -0
  118. package/components/dist/sankeyDiagram-Y46BX6SQ-5RKUGG63.js +1278 -0
  119. package/components/dist/sankeyDiagram-Y46BX6SQ-5RKUGG63.js.map +1 -0
  120. package/components/dist/sequenceDiagram-G6AWOVSC-2T3JBUZ2.js +3529 -0
  121. package/components/dist/sequenceDiagram-G6AWOVSC-2T3JBUZ2.js.map +1 -0
  122. package/components/dist/stateDiagram-MAYHULR4-HZ5EGLPA.js +505 -0
  123. package/components/dist/stateDiagram-MAYHULR4-HZ5EGLPA.js.map +1 -0
  124. package/components/dist/stateDiagram-v2-4JROLMXI-DN2FEZV3.js +40 -0
  125. package/components/dist/stateDiagram-v2-4JROLMXI-DN2FEZV3.js.map +1 -0
  126. package/components/dist/timeline-definition-U7ZMHBDA-GB6AKKW4.js +1260 -0
  127. package/components/dist/timeline-definition-U7ZMHBDA-GB6AKKW4.js.map +1 -0
  128. package/components/dist/xychartDiagram-6QU3TZC5-BFFLEHUP.js +1877 -0
  129. package/components/dist/xychartDiagram-6QU3TZC5-BFFLEHUP.js.map +1 -0
  130. package/package.json +2 -1
@@ -0,0 +1,734 @@
1
+ import {
2
+ clear as clear3,
3
+ insertEdge,
4
+ insertEdgeLabel,
5
+ markers_default,
6
+ positionEdgeLabel
7
+ } from "./chunk-ND3FLKHU.js";
8
+ import {
9
+ clear,
10
+ clear2,
11
+ insertCluster,
12
+ insertNode,
13
+ positionNode,
14
+ setNodeElem,
15
+ updateNodeBounds
16
+ } from "./chunk-LQ2ABR7F.js";
17
+ import "./chunk-BW7DFBOS.js";
18
+ import {
19
+ getSubGraphTitleMargins
20
+ } from "./chunk-M6L3MM6K.js";
21
+ import "./chunk-H72D3HRR.js";
22
+ import "./chunk-NIVHLOPB.js";
23
+ import {
24
+ layout
25
+ } from "./chunk-RN5R3L7O.js";
26
+ import {
27
+ Graph
28
+ } from "./chunk-2DDKDUUO.js";
29
+ import "./chunk-T7HPDS4Z.js";
30
+ import "./chunk-7I5DT373.js";
31
+ import {
32
+ __name,
33
+ getConfig2,
34
+ log
35
+ } from "./chunk-RWDBBMDN.js";
36
+ import {
37
+ clone_default,
38
+ isUndefined_default,
39
+ map_default
40
+ } from "./chunk-ZBL4CWCH.js";
41
+ import "./chunk-BVYAEHG3.js";
42
+ import "./chunk-562WOS3Z.js";
43
+ import "./chunk-K532NZMW.js";
44
+
45
+ // node_modules/dagre-d3-es/src/graphlib/json.js
46
+ function write(g) {
47
+ var json = {
48
+ options: {
49
+ directed: g.isDirected(),
50
+ multigraph: g.isMultigraph(),
51
+ compound: g.isCompound()
52
+ },
53
+ nodes: writeNodes(g),
54
+ edges: writeEdges(g)
55
+ };
56
+ if (!isUndefined_default(g.graph())) {
57
+ json.value = clone_default(g.graph());
58
+ }
59
+ return json;
60
+ }
61
+ function writeNodes(g) {
62
+ return map_default(g.nodes(), function(v) {
63
+ var nodeValue = g.node(v);
64
+ var parent = g.parent(v);
65
+ var node = { v };
66
+ if (!isUndefined_default(nodeValue)) {
67
+ node.value = nodeValue;
68
+ }
69
+ if (!isUndefined_default(parent)) {
70
+ node.parent = parent;
71
+ }
72
+ return node;
73
+ });
74
+ }
75
+ function writeEdges(g) {
76
+ return map_default(g.edges(), function(e) {
77
+ var edgeValue = g.edge(e);
78
+ var edge = { v: e.v, w: e.w };
79
+ if (!isUndefined_default(e.name)) {
80
+ edge.name = e.name;
81
+ }
82
+ if (!isUndefined_default(edgeValue)) {
83
+ edge.value = edgeValue;
84
+ }
85
+ return edge;
86
+ });
87
+ }
88
+
89
+ // node_modules/mermaid/dist/chunks/mermaid.core/dagre-4EVJKHTY.mjs
90
+ var clusterDb = /* @__PURE__ */ new Map();
91
+ var descendants = /* @__PURE__ */ new Map();
92
+ var parents = /* @__PURE__ */ new Map();
93
+ var clear4 = /* @__PURE__ */ __name(() => {
94
+ descendants.clear();
95
+ parents.clear();
96
+ clusterDb.clear();
97
+ }, "clear");
98
+ var isDescendant = /* @__PURE__ */ __name((id, ancestorId) => {
99
+ const ancestorDescendants = descendants.get(ancestorId) || [];
100
+ log.trace("In isDescendant", ancestorId, " ", id, " = ", ancestorDescendants.includes(id));
101
+ return ancestorDescendants.includes(id);
102
+ }, "isDescendant");
103
+ var edgeInCluster = /* @__PURE__ */ __name((edge, clusterId) => {
104
+ const clusterDescendants = descendants.get(clusterId) || [];
105
+ log.info("Descendants of ", clusterId, " is ", clusterDescendants);
106
+ log.info("Edge is ", edge);
107
+ if (edge.v === clusterId || edge.w === clusterId) {
108
+ return false;
109
+ }
110
+ if (!clusterDescendants) {
111
+ log.debug("Tilt, ", clusterId, ",not in descendants");
112
+ return false;
113
+ }
114
+ return clusterDescendants.includes(edge.v) || isDescendant(edge.v, clusterId) || isDescendant(edge.w, clusterId) || clusterDescendants.includes(edge.w);
115
+ }, "edgeInCluster");
116
+ var copy = /* @__PURE__ */ __name((clusterId, graph, newGraph, rootId) => {
117
+ log.warn(
118
+ "Copying children of ",
119
+ clusterId,
120
+ "root",
121
+ rootId,
122
+ "data",
123
+ graph.node(clusterId),
124
+ rootId
125
+ );
126
+ const nodes = graph.children(clusterId) || [];
127
+ if (clusterId !== rootId) {
128
+ nodes.push(clusterId);
129
+ }
130
+ log.warn("Copying (nodes) clusterId", clusterId, "nodes", nodes);
131
+ nodes.forEach((node) => {
132
+ if (graph.children(node).length > 0) {
133
+ copy(node, graph, newGraph, rootId);
134
+ } else {
135
+ const data = graph.node(node);
136
+ log.info("cp ", node, " to ", rootId, " with parent ", clusterId);
137
+ newGraph.setNode(node, data);
138
+ if (rootId !== graph.parent(node)) {
139
+ log.warn("Setting parent", node, graph.parent(node));
140
+ newGraph.setParent(node, graph.parent(node));
141
+ }
142
+ if (clusterId !== rootId && node !== clusterId) {
143
+ log.debug("Setting parent", node, clusterId);
144
+ newGraph.setParent(node, clusterId);
145
+ } else {
146
+ log.info("In copy ", clusterId, "root", rootId, "data", graph.node(clusterId), rootId);
147
+ log.debug(
148
+ "Not Setting parent for node=",
149
+ node,
150
+ "cluster!==rootId",
151
+ clusterId !== rootId,
152
+ "node!==clusterId",
153
+ node !== clusterId
154
+ );
155
+ }
156
+ const edges = graph.edges(node);
157
+ log.debug("Copying Edges", edges);
158
+ edges.forEach((edge) => {
159
+ log.info("Edge", edge);
160
+ const data2 = graph.edge(edge.v, edge.w, edge.name);
161
+ log.info("Edge data", data2, rootId);
162
+ try {
163
+ if (edgeInCluster(edge, rootId)) {
164
+ log.info("Copying as ", edge.v, edge.w, data2, edge.name);
165
+ newGraph.setEdge(edge.v, edge.w, data2, edge.name);
166
+ log.info("newGraph edges ", newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
167
+ } else {
168
+ log.info(
169
+ "Skipping copy of edge ",
170
+ edge.v,
171
+ "-->",
172
+ edge.w,
173
+ " rootId: ",
174
+ rootId,
175
+ " clusterId:",
176
+ clusterId
177
+ );
178
+ }
179
+ } catch (e) {
180
+ log.error(e);
181
+ }
182
+ });
183
+ }
184
+ log.debug("Removing node", node);
185
+ graph.removeNode(node);
186
+ });
187
+ }, "copy");
188
+ var extractDescendants = /* @__PURE__ */ __name((id, graph) => {
189
+ const children = graph.children(id);
190
+ let res = [...children];
191
+ for (const child of children) {
192
+ parents.set(child, id);
193
+ res = [...res, ...extractDescendants(child, graph)];
194
+ }
195
+ return res;
196
+ }, "extractDescendants");
197
+ var findCommonEdges = /* @__PURE__ */ __name((graph, id1, id2) => {
198
+ const edges1 = graph.edges().filter((edge) => edge.v === id1 || edge.w === id1);
199
+ const edges2 = graph.edges().filter((edge) => edge.v === id2 || edge.w === id2);
200
+ const edges1Prim = edges1.map((edge) => {
201
+ return { v: edge.v === id1 ? id2 : edge.v, w: edge.w === id1 ? id1 : edge.w };
202
+ });
203
+ const edges2Prim = edges2.map((edge) => {
204
+ return { v: edge.v, w: edge.w };
205
+ });
206
+ const result = edges1Prim.filter((edgeIn1) => {
207
+ return edges2Prim.some((edge) => edgeIn1.v === edge.v && edgeIn1.w === edge.w);
208
+ });
209
+ return result;
210
+ }, "findCommonEdges");
211
+ var findNonClusterChild = /* @__PURE__ */ __name((id, graph, clusterId) => {
212
+ const children = graph.children(id);
213
+ log.trace("Searching children of id ", id, children);
214
+ if (children.length < 1) {
215
+ return id;
216
+ }
217
+ let reserve;
218
+ for (const child of children) {
219
+ const _id = findNonClusterChild(child, graph, clusterId);
220
+ const commonEdges = findCommonEdges(graph, clusterId, _id);
221
+ if (_id) {
222
+ if (commonEdges.length > 0) {
223
+ reserve = _id;
224
+ } else {
225
+ return _id;
226
+ }
227
+ }
228
+ }
229
+ return reserve;
230
+ }, "findNonClusterChild");
231
+ var getAnchorId = /* @__PURE__ */ __name((id) => {
232
+ if (!clusterDb.has(id)) {
233
+ return id;
234
+ }
235
+ if (!clusterDb.get(id).externalConnections) {
236
+ return id;
237
+ }
238
+ if (clusterDb.has(id)) {
239
+ return clusterDb.get(id).id;
240
+ }
241
+ return id;
242
+ }, "getAnchorId");
243
+ var adjustClustersAndEdges = /* @__PURE__ */ __name((graph, depth) => {
244
+ if (!graph || depth > 10) {
245
+ log.debug("Opting out, no graph ");
246
+ return;
247
+ } else {
248
+ log.debug("Opting in, graph ");
249
+ }
250
+ graph.nodes().forEach(function(id) {
251
+ const children = graph.children(id);
252
+ if (children.length > 0) {
253
+ log.warn(
254
+ "Cluster identified",
255
+ id,
256
+ " Replacement id in edges: ",
257
+ findNonClusterChild(id, graph, id)
258
+ );
259
+ descendants.set(id, extractDescendants(id, graph));
260
+ clusterDb.set(id, { id: findNonClusterChild(id, graph, id), clusterData: graph.node(id) });
261
+ }
262
+ });
263
+ graph.nodes().forEach(function(id) {
264
+ const children = graph.children(id);
265
+ const edges = graph.edges();
266
+ if (children.length > 0) {
267
+ log.debug("Cluster identified", id, descendants);
268
+ edges.forEach((edge) => {
269
+ const d1 = isDescendant(edge.v, id);
270
+ const d2 = isDescendant(edge.w, id);
271
+ if (d1 ^ d2) {
272
+ log.warn("Edge: ", edge, " leaves cluster ", id);
273
+ log.warn("Descendants of XXX ", id, ": ", descendants.get(id));
274
+ clusterDb.get(id).externalConnections = true;
275
+ }
276
+ });
277
+ } else {
278
+ log.debug("Not a cluster ", id, descendants);
279
+ }
280
+ });
281
+ for (let id of clusterDb.keys()) {
282
+ const nonClusterChild = clusterDb.get(id).id;
283
+ const parent = graph.parent(nonClusterChild);
284
+ if (parent !== id && clusterDb.has(parent) && !clusterDb.get(parent).externalConnections) {
285
+ clusterDb.get(id).id = parent;
286
+ }
287
+ }
288
+ graph.edges().forEach(function(e) {
289
+ const edge = graph.edge(e);
290
+ log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
291
+ log.warn("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
292
+ let v = e.v;
293
+ let w = e.w;
294
+ log.warn(
295
+ "Fix XXX",
296
+ clusterDb,
297
+ "ids:",
298
+ e.v,
299
+ e.w,
300
+ "Translating: ",
301
+ clusterDb.get(e.v),
302
+ " --- ",
303
+ clusterDb.get(e.w)
304
+ );
305
+ if (clusterDb.get(e.v) || clusterDb.get(e.w)) {
306
+ log.warn("Fixing and trying - removing XXX", e.v, e.w, e.name);
307
+ v = getAnchorId(e.v);
308
+ w = getAnchorId(e.w);
309
+ graph.removeEdge(e.v, e.w, e.name);
310
+ if (v !== e.v) {
311
+ const parent = graph.parent(v);
312
+ clusterDb.get(parent).externalConnections = true;
313
+ edge.fromCluster = e.v;
314
+ }
315
+ if (w !== e.w) {
316
+ const parent = graph.parent(w);
317
+ clusterDb.get(parent).externalConnections = true;
318
+ edge.toCluster = e.w;
319
+ }
320
+ log.warn("Fix Replacing with XXX", v, w, e.name);
321
+ graph.setEdge(v, w, edge, e.name);
322
+ }
323
+ });
324
+ log.warn("Adjusted Graph", write(graph));
325
+ extractor(graph, 0);
326
+ log.trace(clusterDb);
327
+ }, "adjustClustersAndEdges");
328
+ var extractor = /* @__PURE__ */ __name((graph, depth) => {
329
+ log.warn("extractor - ", depth, write(graph), graph.children("D"));
330
+ if (depth > 10) {
331
+ log.error("Bailing out");
332
+ return;
333
+ }
334
+ let nodes = graph.nodes();
335
+ let hasChildren = false;
336
+ for (const node of nodes) {
337
+ const children = graph.children(node);
338
+ hasChildren = hasChildren || children.length > 0;
339
+ }
340
+ if (!hasChildren) {
341
+ log.debug("Done, no node has children", graph.nodes());
342
+ return;
343
+ }
344
+ log.debug("Nodes = ", nodes, depth);
345
+ for (const node of nodes) {
346
+ log.debug(
347
+ "Extracting node",
348
+ node,
349
+ clusterDb,
350
+ clusterDb.has(node) && !clusterDb.get(node).externalConnections,
351
+ !graph.parent(node),
352
+ graph.node(node),
353
+ graph.children("D"),
354
+ " Depth ",
355
+ depth
356
+ );
357
+ if (!clusterDb.has(node)) {
358
+ log.debug("Not a cluster", node, depth);
359
+ } else if (!clusterDb.get(node).externalConnections && graph.children(node) && graph.children(node).length > 0) {
360
+ log.warn(
361
+ "Cluster without external connections, without a parent and with children",
362
+ node,
363
+ depth
364
+ );
365
+ const graphSettings = graph.graph();
366
+ let dir = graphSettings.rankdir === "TB" ? "LR" : "TB";
367
+ if (clusterDb.get(node)?.clusterData?.dir) {
368
+ dir = clusterDb.get(node).clusterData.dir;
369
+ log.warn("Fixing dir", clusterDb.get(node).clusterData.dir, dir);
370
+ }
371
+ const clusterGraph = new Graph({
372
+ multigraph: true,
373
+ compound: true
374
+ }).setGraph({
375
+ rankdir: dir,
376
+ nodesep: 50,
377
+ ranksep: 50,
378
+ marginx: 8,
379
+ marginy: 8
380
+ }).setDefaultEdgeLabel(function() {
381
+ return {};
382
+ });
383
+ log.warn("Old graph before copy", write(graph));
384
+ copy(node, graph, clusterGraph, node);
385
+ graph.setNode(node, {
386
+ clusterNode: true,
387
+ id: node,
388
+ clusterData: clusterDb.get(node).clusterData,
389
+ label: clusterDb.get(node).label,
390
+ graph: clusterGraph
391
+ });
392
+ log.warn("New graph after copy node: (", node, ")", write(clusterGraph));
393
+ log.debug("Old graph after copy", write(graph));
394
+ } else {
395
+ log.warn(
396
+ "Cluster ** ",
397
+ node,
398
+ " **not meeting the criteria !externalConnections:",
399
+ !clusterDb.get(node).externalConnections,
400
+ " no parent: ",
401
+ !graph.parent(node),
402
+ " children ",
403
+ graph.children(node) && graph.children(node).length > 0,
404
+ graph.children("D"),
405
+ depth
406
+ );
407
+ log.debug(clusterDb);
408
+ }
409
+ }
410
+ nodes = graph.nodes();
411
+ log.warn("New list of nodes", nodes);
412
+ for (const node of nodes) {
413
+ const data = graph.node(node);
414
+ log.warn(" Now next level", node, data);
415
+ if (data?.clusterNode) {
416
+ extractor(data.graph, depth + 1);
417
+ }
418
+ }
419
+ }, "extractor");
420
+ var sorter = /* @__PURE__ */ __name((graph, nodes) => {
421
+ if (nodes.length === 0) {
422
+ return [];
423
+ }
424
+ let result = Object.assign([], nodes);
425
+ nodes.forEach((node) => {
426
+ const children = graph.children(node);
427
+ const sorted = sorter(graph, children);
428
+ result = [...result, ...sorted];
429
+ });
430
+ return result;
431
+ }, "sorter");
432
+ var sortNodesByHierarchy = /* @__PURE__ */ __name((graph) => sorter(graph, graph.children()), "sortNodesByHierarchy");
433
+ var recursiveRender = /* @__PURE__ */ __name(async (_elem, graph, diagramType, id, parentCluster, siteConfig) => {
434
+ log.warn("Graph in recursive render:XAX", write(graph), parentCluster);
435
+ const dir = graph.graph().rankdir;
436
+ log.trace("Dir in recursive render - dir:", dir);
437
+ const elem = _elem.insert("g").attr("class", "root");
438
+ if (!graph.nodes()) {
439
+ log.info("No nodes found for", graph);
440
+ } else {
441
+ log.info("Recursive render XXX", graph.nodes());
442
+ }
443
+ if (graph.edges().length > 0) {
444
+ log.info("Recursive edges", graph.edge(graph.edges()[0]));
445
+ }
446
+ const clusters = elem.insert("g").attr("class", "clusters");
447
+ const edgePaths = elem.insert("g").attr("class", "edgePaths");
448
+ const edgeLabels = elem.insert("g").attr("class", "edgeLabels");
449
+ const nodes = elem.insert("g").attr("class", "nodes");
450
+ await Promise.all(
451
+ graph.nodes().map(async function(v) {
452
+ const node = graph.node(v);
453
+ if (parentCluster !== void 0) {
454
+ const data = JSON.parse(JSON.stringify(parentCluster.clusterData));
455
+ log.trace(
456
+ "Setting data for parent cluster XXX\n Node.id = ",
457
+ v,
458
+ "\n data=",
459
+ data.height,
460
+ "\nParent cluster",
461
+ parentCluster.height
462
+ );
463
+ graph.setNode(parentCluster.id, data);
464
+ if (!graph.parent(v)) {
465
+ log.trace("Setting parent", v, parentCluster.id);
466
+ graph.setParent(v, parentCluster.id, data);
467
+ }
468
+ }
469
+ log.info("(Insert) Node XXX" + v + ": " + JSON.stringify(graph.node(v)));
470
+ if (node?.clusterNode) {
471
+ log.info("Cluster identified XBX", v, node.width, graph.node(v));
472
+ const { ranksep, nodesep } = graph.graph();
473
+ node.graph.setGraph({
474
+ ...node.graph.graph(),
475
+ ranksep: ranksep + 25,
476
+ nodesep
477
+ });
478
+ const o = await recursiveRender(
479
+ nodes,
480
+ node.graph,
481
+ diagramType,
482
+ id,
483
+ graph.node(v),
484
+ siteConfig
485
+ );
486
+ const newEl = o.elem;
487
+ updateNodeBounds(node, newEl);
488
+ node.diff = o.diff || 0;
489
+ log.info(
490
+ "New compound node after recursive render XAX",
491
+ v,
492
+ "width",
493
+ // node,
494
+ node.width,
495
+ "height",
496
+ node.height
497
+ // node.x,
498
+ // node.y
499
+ );
500
+ setNodeElem(newEl, node);
501
+ } else {
502
+ if (graph.children(v).length > 0) {
503
+ log.trace(
504
+ "Cluster - the non recursive path XBX",
505
+ v,
506
+ node.id,
507
+ node,
508
+ node.width,
509
+ "Graph:",
510
+ graph
511
+ );
512
+ log.trace(findNonClusterChild(node.id, graph));
513
+ clusterDb.set(node.id, { id: findNonClusterChild(node.id, graph), node });
514
+ } else {
515
+ log.trace("Node - the non recursive path XAX", v, nodes, graph.node(v), dir);
516
+ await insertNode(nodes, graph.node(v), { config: siteConfig, dir });
517
+ }
518
+ }
519
+ })
520
+ );
521
+ const processEdges = /* @__PURE__ */ __name(async () => {
522
+ const edgePromises = graph.edges().map(async function(e) {
523
+ const edge = graph.edge(e.v, e.w, e.name);
524
+ log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
525
+ log.info("Edge " + e.v + " -> " + e.w + ": ", e, " ", JSON.stringify(graph.edge(e)));
526
+ log.info(
527
+ "Fix",
528
+ clusterDb,
529
+ "ids:",
530
+ e.v,
531
+ e.w,
532
+ "Translating: ",
533
+ clusterDb.get(e.v),
534
+ clusterDb.get(e.w)
535
+ );
536
+ await insertEdgeLabel(edgeLabels, edge);
537
+ });
538
+ await Promise.all(edgePromises);
539
+ }, "processEdges");
540
+ await processEdges();
541
+ log.info("Graph before layout:", JSON.stringify(write(graph)));
542
+ log.info("############################################# XXX");
543
+ log.info("### Layout ### XXX");
544
+ log.info("############################################# XXX");
545
+ layout(graph);
546
+ log.info("Graph after layout:", JSON.stringify(write(graph)));
547
+ let diff = 0;
548
+ let { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
549
+ await Promise.all(
550
+ sortNodesByHierarchy(graph).map(async function(v) {
551
+ const node = graph.node(v);
552
+ log.info(
553
+ "Position XBX => " + v + ": (" + node.x,
554
+ "," + node.y,
555
+ ") width: ",
556
+ node.width,
557
+ " height: ",
558
+ node.height
559
+ );
560
+ if (node?.clusterNode) {
561
+ node.y += subGraphTitleTotalMargin;
562
+ log.info(
563
+ "A tainted cluster node XBX1",
564
+ v,
565
+ node.id,
566
+ node.width,
567
+ node.height,
568
+ node.x,
569
+ node.y,
570
+ graph.parent(v)
571
+ );
572
+ clusterDb.get(node.id).node = node;
573
+ positionNode(node);
574
+ } else {
575
+ if (graph.children(v).length > 0) {
576
+ log.info(
577
+ "A pure cluster node XBX1",
578
+ v,
579
+ node.id,
580
+ node.x,
581
+ node.y,
582
+ node.width,
583
+ node.height,
584
+ graph.parent(v)
585
+ );
586
+ node.height += subGraphTitleTotalMargin;
587
+ graph.node(node.parentId);
588
+ const halfPadding = node?.padding / 2 || 0;
589
+ const labelHeight = node?.labelBBox?.height || 0;
590
+ const offsetY = labelHeight - halfPadding || 0;
591
+ log.debug("OffsetY", offsetY, "labelHeight", labelHeight, "halfPadding", halfPadding);
592
+ await insertCluster(clusters, node);
593
+ clusterDb.get(node.id).node = node;
594
+ } else {
595
+ const parent = graph.node(node.parentId);
596
+ node.y += subGraphTitleTotalMargin / 2;
597
+ log.info(
598
+ "A regular node XBX1 - using the padding",
599
+ node.id,
600
+ "parent",
601
+ node.parentId,
602
+ node.width,
603
+ node.height,
604
+ node.x,
605
+ node.y,
606
+ "offsetY",
607
+ node.offsetY,
608
+ "parent",
609
+ parent,
610
+ parent?.offsetY,
611
+ node
612
+ );
613
+ positionNode(node);
614
+ }
615
+ }
616
+ })
617
+ );
618
+ graph.edges().forEach(function(e) {
619
+ const edge = graph.edge(e);
620
+ log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(edge), edge);
621
+ edge.points.forEach((point) => point.y += subGraphTitleTotalMargin / 2);
622
+ const startNode = graph.node(e.v);
623
+ var endNode = graph.node(e.w);
624
+ const paths = insertEdge(edgePaths, edge, clusterDb, diagramType, startNode, endNode, id);
625
+ positionEdgeLabel(edge, paths);
626
+ });
627
+ graph.nodes().forEach(function(v) {
628
+ const n = graph.node(v);
629
+ log.info(v, n.type, n.diff);
630
+ if (n.isGroup) {
631
+ diff = n.diff;
632
+ }
633
+ });
634
+ log.warn("Returning from recursive render XAX", elem, diff);
635
+ return { elem, diff };
636
+ }, "recursiveRender");
637
+ var render = /* @__PURE__ */ __name(async (data4Layout, svg) => {
638
+ const graph = new Graph({
639
+ multigraph: true,
640
+ compound: true
641
+ }).setGraph({
642
+ rankdir: data4Layout.direction,
643
+ nodesep: data4Layout.config?.nodeSpacing || data4Layout.config?.flowchart?.nodeSpacing || data4Layout.nodeSpacing,
644
+ ranksep: data4Layout.config?.rankSpacing || data4Layout.config?.flowchart?.rankSpacing || data4Layout.rankSpacing,
645
+ marginx: 8,
646
+ marginy: 8
647
+ }).setDefaultEdgeLabel(function() {
648
+ return {};
649
+ });
650
+ const element = svg.select("g");
651
+ markers_default(element, data4Layout.markers, data4Layout.type, data4Layout.diagramId);
652
+ clear2();
653
+ clear3();
654
+ clear();
655
+ clear4();
656
+ data4Layout.nodes.forEach((node) => {
657
+ graph.setNode(node.id, { ...node });
658
+ if (node.parentId) {
659
+ graph.setParent(node.id, node.parentId);
660
+ }
661
+ });
662
+ log.debug("Edges:", data4Layout.edges);
663
+ data4Layout.edges.forEach((edge) => {
664
+ if (edge.start === edge.end) {
665
+ const nodeId = edge.start;
666
+ const specialId1 = nodeId + "---" + nodeId + "---1";
667
+ const specialId2 = nodeId + "---" + nodeId + "---2";
668
+ const node = graph.node(nodeId);
669
+ graph.setNode(specialId1, {
670
+ domId: specialId1,
671
+ id: specialId1,
672
+ parentId: node.parentId,
673
+ labelStyle: "",
674
+ label: "",
675
+ padding: 0,
676
+ shape: "labelRect",
677
+ // shape: 'rect',
678
+ style: "",
679
+ width: 10,
680
+ height: 10
681
+ });
682
+ graph.setParent(specialId1, node.parentId);
683
+ graph.setNode(specialId2, {
684
+ domId: specialId2,
685
+ id: specialId2,
686
+ parentId: node.parentId,
687
+ labelStyle: "",
688
+ padding: 0,
689
+ // shape: 'rect',
690
+ shape: "labelRect",
691
+ label: "",
692
+ style: "",
693
+ width: 10,
694
+ height: 10
695
+ });
696
+ graph.setParent(specialId2, node.parentId);
697
+ const edge1 = structuredClone(edge);
698
+ const edgeMid = structuredClone(edge);
699
+ const edge2 = structuredClone(edge);
700
+ edge1.label = "";
701
+ edge1.arrowTypeEnd = "none";
702
+ edge1.id = nodeId + "-cyclic-special-1";
703
+ edgeMid.arrowTypeEnd = "none";
704
+ edgeMid.id = nodeId + "-cyclic-special-mid";
705
+ edge2.label = "";
706
+ if (node.isGroup) {
707
+ edge1.fromCluster = nodeId;
708
+ edge2.toCluster = nodeId;
709
+ }
710
+ edge2.id = nodeId + "-cyclic-special-2";
711
+ graph.setEdge(nodeId, specialId1, edge1, nodeId + "-cyclic-special-0");
712
+ graph.setEdge(specialId1, specialId2, edgeMid, nodeId + "-cyclic-special-1");
713
+ graph.setEdge(specialId2, nodeId, edge2, nodeId + "-cyc<lic-special-2");
714
+ } else {
715
+ graph.setEdge(edge.start, edge.end, { ...edge }, edge.id);
716
+ }
717
+ });
718
+ log.warn("Graph at first:", JSON.stringify(write(graph)));
719
+ adjustClustersAndEdges(graph);
720
+ log.warn("Graph after XAX:", JSON.stringify(write(graph)));
721
+ const siteConfig = getConfig2();
722
+ await recursiveRender(
723
+ element,
724
+ graph,
725
+ data4Layout.type,
726
+ data4Layout.diagramId,
727
+ void 0,
728
+ siteConfig
729
+ );
730
+ }, "render");
731
+ export {
732
+ render
733
+ };
734
+ //# sourceMappingURL=dagre-4EVJKHTY-XW45LMKR.js.map