@yorz/cli 0.1.4 → 0.1.5

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 (138) hide show
  1. package/dist/cli/index.js +133 -53
  2. package/dist/gui/assets/{abnfDiagram-VRR7QNED-BlILeZZA.js → abnfDiagram-VRR7QNED-BjiKWU_r.js} +1 -1
  3. package/dist/gui/assets/{arc-C-xJpbjF.js → arc--ZszoeC5.js} +1 -1
  4. package/dist/gui/assets/{architectureDiagram-ZJ3FMSHR-QdzNii0b.js → architectureDiagram-ZJ3FMSHR-D8beCiJM.js} +1 -1
  5. package/dist/gui/assets/{blockDiagram-677ZJIJ3-BQTAKTET.js → blockDiagram-677ZJIJ3-XTjBv4Yl.js} +1 -1
  6. package/dist/gui/assets/{c4Diagram-LMCZKHZV-YRh3fqeb.js → c4Diagram-LMCZKHZV-B8mRAP6M.js} +1 -1
  7. package/dist/gui/assets/channel-DSEvjkHE.js +1 -0
  8. package/dist/gui/assets/{chunk-2Q5K7J3B-Bgu-eeCS.js → chunk-2Q5K7J3B-yiwKrUMh.js} +1 -1
  9. package/dist/gui/assets/{chunk-32BRIVSS-DTLd8wsP.js → chunk-32BRIVSS-BKUpEqmm.js} +1 -1
  10. package/dist/gui/assets/{chunk-5VM5RSS4-Cct8HJoz.js → chunk-5VM5RSS4-DbsGyMz5.js} +1 -1
  11. package/dist/gui/assets/{chunk-EX3LRPZG-DBgaA_1N.js → chunk-EX3LRPZG-DTBuQkne.js} +1 -1
  12. package/dist/gui/assets/{chunk-JWPE2WC7-DELoF8bV.js → chunk-JWPE2WC7-Durur7_4.js} +1 -1
  13. package/dist/gui/assets/{chunk-MOJQB5TN-Du6uREYs.js → chunk-MOJQB5TN-DXNE2VJB.js} +1 -1
  14. package/dist/gui/assets/{chunk-RYQCIY6F-CxO6cQdM.js → chunk-RYQCIY6F-HY8qhnee.js} +1 -1
  15. package/dist/gui/assets/{chunk-V7JOEXUC-BiILBcGA.js → chunk-V7JOEXUC-BXRxPy5M.js} +1 -1
  16. package/dist/gui/assets/{chunk-VR4S4FIN-BfY2RvG4.js → chunk-VR4S4FIN-Ws4fVn18.js} +1 -1
  17. package/dist/gui/assets/{chunk-XXDRQBXY-DmsZw6tB.js → chunk-XXDRQBXY-CwHBGyO1.js} +1 -1
  18. package/dist/gui/assets/classDiagram-OUVF2IWQ-BN1qwPdD.js +1 -0
  19. package/dist/gui/assets/classDiagram-v2-EOCWNBFH-BN1qwPdD.js +1 -0
  20. package/dist/gui/assets/{cose-bilkent-JH36ORCC-gX-8DSxS.js → cose-bilkent-JH36ORCC-C3oDctXM.js} +1 -1
  21. package/dist/gui/assets/{cynefin-VYW2F7L2-vOfRo7cL.js → cynefin-VYW2F7L2-BjremdIM.js} +1 -1
  22. package/dist/gui/assets/{cynefinDiagram-TSTJHNR4-Dv66a7Rh.js → cynefinDiagram-TSTJHNR4-Cwe2fD65.js} +1 -1
  23. package/dist/gui/assets/{dagre-VKFMJZFB-Rk64dDvT.js → dagre-VKFMJZFB-Bx2kzeqs.js} +1 -1
  24. package/dist/gui/assets/{diagram-FQU43EPY-CyW3IjmQ.js → diagram-FQU43EPY-BVyLKNdq.js} +1 -1
  25. package/dist/gui/assets/{diagram-G47NLZAW-Caav47lW.js → diagram-G47NLZAW-DicBAwcf.js} +1 -1
  26. package/dist/gui/assets/{diagram-NH7WQ7WH-_X3ihqNf.js → diagram-NH7WQ7WH-BbRrvaYb.js} +1 -1
  27. package/dist/gui/assets/{diagram-OA4YK3LP-CjbverOE.js → diagram-OA4YK3LP-C2YIUXV5.js} +1 -1
  28. package/dist/gui/assets/{diagram-WEI45ONY-B93ZeTtT.js → diagram-WEI45ONY-DJHPHFaZ.js} +1 -1
  29. package/dist/gui/assets/{ebnfDiagram-CCIWWBDH-CdDt4bWx.js → ebnfDiagram-CCIWWBDH-DtDW0rR6.js} +1 -1
  30. package/dist/gui/assets/{erDiagram-Q63AITRT-Bypq-rvj.js → erDiagram-Q63AITRT-C5CAH1UZ.js} +1 -1
  31. package/dist/gui/assets/{flowDiagram-23GEKE2U-b-l8_7KP.js → flowDiagram-23GEKE2U-DA2WblHa.js} +1 -1
  32. package/dist/gui/assets/{ganttDiagram-NO4QXBWP-BeZFHLhX.js → ganttDiagram-NO4QXBWP-TMRYyAbG.js} +1 -1
  33. package/dist/gui/assets/{gitGraphDiagram-IHSO6WYX-C0siPGLA.js → gitGraphDiagram-IHSO6WYX-Ci-GVNac.js} +1 -1
  34. package/dist/gui/assets/index-Bq3A8DU2.js +21 -0
  35. package/dist/gui/assets/{infoDiagram-FWYZ7A6U-Bk8DNKgG.js → infoDiagram-FWYZ7A6U-BV4Ye9h-.js} +1 -1
  36. package/dist/gui/assets/{ishikawaDiagram-FXEZZL3T-DyS4wmJu.js → ishikawaDiagram-FXEZZL3T-CLBTOnXf.js} +1 -1
  37. package/dist/gui/assets/{journeyDiagram-5HDEW3XC-4jUY7Bzi.js → journeyDiagram-5HDEW3XC-BINYoOlq.js} +1 -1
  38. package/dist/gui/assets/{kanban-definition-HUTT4EX6-BRiI4KbM.js → kanban-definition-HUTT4EX6-Bvoywhuo.js} +1 -1
  39. package/dist/gui/assets/{linear-C5JkbjyJ.js → linear-CldLHplp.js} +1 -1
  40. package/dist/gui/assets/{mermaid.core-ImB_5gdE.js → mermaid.core-1Uynhu-S.js} +4 -4
  41. package/dist/gui/assets/{mindmap-definition-LN4V7U3C-9_Awmd2W.js → mindmap-definition-LN4V7U3C-Sv5B_zGg.js} +1 -1
  42. package/dist/gui/assets/{pegDiagram-2B236MQR-DF_vIYzp.js → pegDiagram-2B236MQR-CyYAur_9.js} +1 -1
  43. package/dist/gui/assets/{pieDiagram-ENE6RG2P-3TPwXSjQ.js → pieDiagram-ENE6RG2P-D3P7lu31.js} +1 -1
  44. package/dist/gui/assets/{quadrantDiagram-ABIIQ3AL-jzJ30mNi.js → quadrantDiagram-ABIIQ3AL-zmQrhKVf.js} +1 -1
  45. package/dist/gui/assets/{railroadDiagram-RFXS5EU6-B-29q3CI.js → railroadDiagram-RFXS5EU6-D5HlXQ4M.js} +1 -1
  46. package/dist/gui/assets/{requirementDiagram-TGXJPOKE-BanWpS6g.js → requirementDiagram-TGXJPOKE-BJcv5tpR.js} +1 -1
  47. package/dist/gui/assets/{sankeyDiagram-HTMAVEWB-B_sxc9IV.js → sankeyDiagram-HTMAVEWB-9R97Q-65.js} +1 -1
  48. package/dist/gui/assets/{sequenceDiagram-DBY2YBRQ-BNVav9DA.js → sequenceDiagram-DBY2YBRQ-D6v2e_UA.js} +1 -1
  49. package/dist/gui/assets/{sizeCapture-X5ZJPWSS-DbaiKjno.js → sizeCapture-X5ZJPWSS-5Ee75AoR.js} +1 -1
  50. package/dist/gui/assets/{stateDiagram-2N3HPSRC-jU5WBm6c.js → stateDiagram-2N3HPSRC-CiFKPVFd.js} +1 -1
  51. package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-XeM3QPuf.js +1 -0
  52. package/dist/gui/assets/{swimlanes-5IMT3BWC-Dcmb64x2.js → swimlanes-5IMT3BWC-DejeKz32.js} +2 -2
  53. package/dist/gui/assets/swimlanesDiagram-G3AALYLV-BaUP5W6u.js +8 -0
  54. package/dist/gui/assets/{timeline-definition-FHXFAJF6-COm9ow7j.js → timeline-definition-FHXFAJF6-CpW-bina.js} +1 -1
  55. package/dist/gui/assets/{vennDiagram-L72KCM5P-DliDuTVY.js → vennDiagram-L72KCM5P-DFEDh4dV.js} +1 -1
  56. package/dist/gui/assets/{wardleyDiagram-EHGQE667-C2O_2cpw.js → wardleyDiagram-EHGQE667-B4Blcc-a.js} +1 -1
  57. package/dist/gui/assets/{xychartDiagram-FW5EYKEG-Ldmt9hoc.js → xychartDiagram-FW5EYKEG-D9idxadT.js} +1 -1
  58. package/dist/gui/index.html +1 -1
  59. package/package.json +1 -1
  60. package/dist/_commonjsHelpers-DyI1JsEH.js +0 -34
  61. package/dist/abnfDiagram-VRR7QNED-UQS77aUi.js +0 -119
  62. package/dist/api-DrYc_Ds_.js +0 -129852
  63. package/dist/arc-B1cAL3U1.js +0 -132
  64. package/dist/architectureDiagram-ZJ3FMSHR-CfWOhs-q.js +0 -8816
  65. package/dist/blockDiagram-677ZJIJ3-CLOAAFZa.js +0 -3796
  66. package/dist/c4Diagram-LMCZKHZV-BGdELGkb.js +0 -2483
  67. package/dist/certs-BeimSwB3.js +0 -14071
  68. package/dist/certs-C4t5lAmJ.js +0 -14071
  69. package/dist/certs-CLLngjpY.js +0 -14071
  70. package/dist/certs-D3fTB-0_.js +0 -14071
  71. package/dist/channel-_gQD3mZ8.js +0 -8
  72. package/dist/chunk-2Q5K7J3B-DIJkMPWD.js +0 -20
  73. package/dist/chunk-32BRIVSS-CIQb7-9I.js +0 -117
  74. package/dist/chunk-5VM5RSS4-DmlAsh6o.js +0 -20
  75. package/dist/chunk-EX3LRPZG-BEXyn5R-.js +0 -1989
  76. package/dist/chunk-JWPE2WC7-XiIefccF.js +0 -17
  77. package/dist/chunk-MOJQB5TN-CC5OBDWw.js +0 -861
  78. package/dist/chunk-RYQCIY6F-DQacsGpB.js +0 -475
  79. package/dist/chunk-V7JOEXUC-TLRsIUvf.js +0 -2027
  80. package/dist/chunk-VR4S4FIN-9AfN7RDF.js +0 -25
  81. package/dist/chunk-XXDRQBXY-DhWucSRr.js +0 -14
  82. package/dist/classDiagram-OUVF2IWQ-CN55rRkB.js +0 -20
  83. package/dist/classDiagram-v2-EOCWNBFH-CN55rRkB.js +0 -20
  84. package/dist/cose-bilkent-JH36ORCC-8uGYe6_d.js +0 -4944
  85. package/dist/cynefin-VYW2F7L2-BwTeE-TI.js +0 -32061
  86. package/dist/cynefinDiagram-TSTJHNR4-DM7ixE-v.js +0 -454
  87. package/dist/cytoscape.esm-BTopYfIb.js +0 -30347
  88. package/dist/dagre-VKFMJZFB-blEDoYen.js +0 -522
  89. package/dist/defaultLocale-wHUL1xE2.js +0 -207
  90. package/dist/diagram-FQU43EPY-MEZlmmdi.js +0 -633
  91. package/dist/diagram-G47NLZAW-DZOZvHqp.js +0 -857
  92. package/dist/diagram-NH7WQ7WH-ChpmPbZz.js +0 -213
  93. package/dist/diagram-OA4YK3LP-oy4yvrnL.js +0 -489
  94. package/dist/diagram-WEI45ONY-B3nx1cYt.js +0 -305
  95. package/dist/ebnfDiagram-CCIWWBDH-BASj7BoO.js +0 -139
  96. package/dist/erDiagram-Q63AITRT-lujHq-S9.js +0 -1239
  97. package/dist/flowDiagram-23GEKE2U-BdsAVPgU.js +0 -2349
  98. package/dist/ganttDiagram-NO4QXBWP-DUUP4lsu.js +0 -3733
  99. package/dist/gitGraphDiagram-IHSO6WYX-BdIPAtb0.js +0 -1374
  100. package/dist/graph-CE8jV7cI.js +0 -2043
  101. package/dist/gui/assets/channel-DGoXAS0B.js +0 -1
  102. package/dist/gui/assets/classDiagram-OUVF2IWQ-B4zeZ0PC.js +0 -1
  103. package/dist/gui/assets/classDiagram-v2-EOCWNBFH-B4zeZ0PC.js +0 -1
  104. package/dist/gui/assets/index-DKVgyltQ.js +0 -21
  105. package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-GXq_r-DG.js +0 -1
  106. package/dist/gui/assets/swimlanesDiagram-G3AALYLV-DDE-INgq.js +0 -8
  107. package/dist/index--GoVvfUP.js +0 -5447
  108. package/dist/index-3-WDiDAh.js +0 -5466
  109. package/dist/index-CHBXZAxg.js +0 -5460
  110. package/dist/index-DeCq8xn7.js +0 -5460
  111. package/dist/infoDiagram-FWYZ7A6U-D9wo93kg.js +0 -32
  112. package/dist/init-DDGa2CQM.js +0 -17
  113. package/dist/ishikawaDiagram-FXEZZL3T-DZh3_kt2.js +0 -968
  114. package/dist/journeyDiagram-5HDEW3XC-C8RWHIn0.js +0 -1256
  115. package/dist/kanban-definition-HUTT4EX6-B7qQtB5a.js +0 -1053
  116. package/dist/katex-WjDlQEfU.js +0 -14500
  117. package/dist/layout-DQAYh_L7.js +0 -2360
  118. package/dist/linear-C_kZRZXS.js +0 -341
  119. package/dist/map-BElV7BMC.js +0 -299
  120. package/dist/mermaid.core-Dy_tFRs7.js +0 -26495
  121. package/dist/mindmap-definition-LN4V7U3C-BzHCd5Ab.js +0 -1181
  122. package/dist/ordinal-C2kkg180.js +0 -77
  123. package/dist/pegDiagram-2B236MQR-B046bQWM.js +0 -127
  124. package/dist/pieDiagram-ENE6RG2P-B5_W2CZy.js +0 -316
  125. package/dist/quadrantDiagram-ABIIQ3AL-Bbpt496h.js +0 -1342
  126. package/dist/railroadDiagram-RFXS5EU6-10XIH3X0.js +0 -93
  127. package/dist/requirementDiagram-TGXJPOKE-Dt1QyccY.js +0 -1205
  128. package/dist/sankeyDiagram-HTMAVEWB-CnqRAq7M.js +0 -1274
  129. package/dist/sequenceDiagram-DBY2YBRQ-DtJLSXoz.js +0 -4515
  130. package/dist/sizeCapture-X5ZJPWSS-DUl5ZEo3.js +0 -63
  131. package/dist/stateDiagram-2N3HPSRC-b-qzcVNj.js +0 -449
  132. package/dist/stateDiagram-v2-6OUMAXLB-KjDlRfc7.js +0 -20
  133. package/dist/swimlanes-5IMT3BWC-CAjGnQLa.js +0 -8553
  134. package/dist/swimlanesDiagram-G3AALYLV-DiOi9bzU.js +0 -16
  135. package/dist/timeline-definition-FHXFAJF6-Bme2FWbh.js +0 -1597
  136. package/dist/vennDiagram-L72KCM5P-BUQgnZDB.js +0 -2516
  137. package/dist/wardleyDiagram-EHGQE667-DHR2Avlu.js +0 -976
  138. package/dist/xychartDiagram-FW5EYKEG-V4K5eBMS.js +0 -2000
@@ -1,522 +0,0 @@
1
- #!/usr/bin/env node
2
- import { c as clear$2, w as write, a as adjustClustersAndEdges, f as findNonClusterChild, b as clusterDb, s as sortNodesByHierarchy } from "./chunk-RYQCIY6F-DQacsGpB.js";
3
- import { _ as __name, am as markers_default, an as clear2, ao as clear, ap as clear$1, l as log, c as getConfig2, aq as updateNodeBounds, ar as setNodeElem, ae as insertNode, as as getSubGraphTitleMargins, af as positionNode, ad as insertCluster, at as insertEdge, au as positionEdgeLabel, av as insertEdgeLabel } from "./mermaid.core-Dy_tFRs7.js";
4
- import { G as Graph } from "./graph-CE8jV7cI.js";
5
- import { l as layout } from "./layout-DQAYh_L7.js";
6
- var clamp = /* @__PURE__ */ __name((value, min, max) => Math.max(min, Math.min(max, value)), "clamp");
7
- var getDefaultSelfLoopSide = /* @__PURE__ */ __name((rankdir = "TB") => {
8
- switch (rankdir) {
9
- case "BT":
10
- return "bottom";
11
- case "LR":
12
- return "right";
13
- case "RL":
14
- return "left";
15
- case "TB":
16
- default:
17
- return "top";
18
- }
19
- }, "getDefaultSelfLoopSide");
20
- var shouldMergeSelfLoopSegments = /* @__PURE__ */ __name((diagramType) => diagramType === "flowchart" || diagramType === "flowchart-v2" || diagramType === "stateDiagram", "shouldMergeSelfLoopSegments");
21
- var getSelfLoopSide = /* @__PURE__ */ __name((graph, node, segments, originalNodeId, rankdir) => {
22
- const layoutHints = [];
23
- const dummyNodeIds = /* @__PURE__ */ new Set();
24
- segments.forEach(({ start, end }) => {
25
- if (start !== originalNodeId) {
26
- dummyNodeIds.add(start);
27
- }
28
- if (end !== originalNodeId) {
29
- dummyNodeIds.add(end);
30
- }
31
- });
32
- dummyNodeIds.forEach((id) => {
33
- const dummyNode = graph.node(id);
34
- if (typeof dummyNode?.x === "number" && typeof dummyNode?.y === "number") {
35
- layoutHints.push(dummyNode);
36
- }
37
- });
38
- if (layoutHints.length === 0) {
39
- segments.forEach(({ edge }) => {
40
- (edge.points ?? []).forEach((point) => {
41
- if (typeof point?.x === "number" && typeof point?.y === "number") {
42
- layoutHints.push(point);
43
- }
44
- });
45
- });
46
- }
47
- if (layoutHints.length === 0) {
48
- return getDefaultSelfLoopSide(rankdir);
49
- }
50
- const center = layoutHints.reduce(
51
- (acc, point) => ({
52
- x: acc.x + point.x / layoutHints.length,
53
- y: acc.y + point.y / layoutHints.length
54
- }),
55
- { x: 0, y: 0 }
56
- );
57
- const dx = center.x - node.x;
58
- const dy = center.y - node.y;
59
- if (Math.abs(dx) > Math.abs(dy)) {
60
- return dx > 0 ? "right" : "left";
61
- }
62
- if (Math.abs(dy) > 0) {
63
- return dy > 0 ? "bottom" : "top";
64
- }
65
- return getDefaultSelfLoopSide(rankdir);
66
- }, "getSelfLoopSide");
67
- var getSelfLoopPoints = /* @__PURE__ */ __name((node, side = "top", yOffset = 0, labelWidth = 0) => {
68
- const x = node.x;
69
- const y = node.y - yOffset;
70
- const halfWidth = node.width / 2;
71
- const halfHeight = node.height / 2;
72
- const maxSpan = Math.max(36, Math.min(100, node.width * 0.8));
73
- const span = clamp(Math.max(labelWidth, node.width * 0.35), 36, maxSpan);
74
- const depth = clamp(Math.min(node.width, node.height) * 0.45, 24, 48);
75
- switch (side) {
76
- case "bottom": {
77
- const bottom = y + halfHeight;
78
- return [
79
- { x: x - span / 2, y: bottom },
80
- { x: x - span / 2, y: bottom + depth },
81
- { x: x + span / 2, y: bottom + depth },
82
- { x: x + span / 2, y: bottom }
83
- ];
84
- }
85
- case "right": {
86
- const right = x + halfWidth;
87
- return [
88
- { x: right, y: y - span / 2 },
89
- { x: right + depth, y: y - span / 2 },
90
- { x: right + depth, y: y + span / 2 },
91
- { x: right, y: y + span / 2 }
92
- ];
93
- }
94
- case "left": {
95
- const left = x - halfWidth;
96
- return [
97
- { x: left, y: y - span / 2 },
98
- { x: left - depth, y: y - span / 2 },
99
- { x: left - depth, y: y + span / 2 },
100
- { x: left, y: y + span / 2 }
101
- ];
102
- }
103
- case "top":
104
- default: {
105
- const top = y - halfHeight;
106
- return [
107
- { x: x - span / 2, y: top },
108
- { x: x - span / 2, y: top - depth },
109
- { x: x + span / 2, y: top - depth },
110
- { x: x + span / 2, y: top }
111
- ];
112
- }
113
- }
114
- }, "getSelfLoopPoints");
115
- var getSelfLoopLabelPosition = /* @__PURE__ */ __name((node, points, side = "top", yOffset = 0, label = {}) => {
116
- const gap = 4;
117
- const x = node.x;
118
- const y = node.y - yOffset;
119
- const labelWidth = label.width ?? 0;
120
- const labelHeight = label.height ?? 0;
121
- switch (side) {
122
- case "bottom":
123
- return { x, y: Math.max(...points.map((point) => point.y)) + labelHeight / 2 + gap };
124
- case "right":
125
- return { x: Math.max(...points.map((point) => point.x)) + labelWidth / 2 + gap, y };
126
- case "left":
127
- return { x: Math.min(...points.map((point) => point.x)) - labelWidth / 2 - gap, y };
128
- case "top":
129
- default:
130
- return { x, y: Math.min(...points.map((point) => point.y)) - labelHeight / 2 - gap };
131
- }
132
- }, "getSelfLoopLabelPosition");
133
- var getEdgesToRender = /* @__PURE__ */ __name((graph, yOffset = 0, { mergeSelfLoops = true } = {}) => {
134
- const selfLoopEdgeGroups = /* @__PURE__ */ new Map();
135
- const edgesToRender = [];
136
- const rankdir = graph.graph()?.rankdir;
137
- graph.edges().forEach((e) => {
138
- const edge = graph.edge(e);
139
- if (mergeSelfLoops && edge.selfLoop) {
140
- const key = edge.selfLoop.id;
141
- if (!selfLoopEdgeGroups.has(key)) {
142
- selfLoopEdgeGroups.set(key, []);
143
- }
144
- selfLoopEdgeGroups.get(key).push({ edge, start: e.v, end: e.w });
145
- } else {
146
- edgesToRender.push({ edge, start: e.v, end: e.w });
147
- }
148
- });
149
- selfLoopEdgeGroups.forEach((segments) => {
150
- if (segments.length !== 3) {
151
- segments.forEach((segment) => edgesToRender.push(segment));
152
- return;
153
- }
154
- segments.sort((a, b) => a.edge.selfLoop.order - b.edge.selfLoop.order);
155
- const [firstSegment, middleSegment, lastSegment] = segments;
156
- const originalEdge = firstSegment.edge.originalEdge ?? middleSegment.edge.originalEdge ?? lastSegment.edge.originalEdge ?? middleSegment.edge;
157
- const node = graph.node(originalEdge.start);
158
- if (!node) {
159
- segments.forEach((segment) => edgesToRender.push(segment));
160
- return;
161
- }
162
- const label = {
163
- width: middleSegment.edge.width,
164
- height: middleSegment.edge.height
165
- };
166
- const side = getSelfLoopSide(graph, node, segments, originalEdge.start, rankdir);
167
- const points = getSelfLoopPoints(node, side, yOffset, label.width ?? 0);
168
- const labelPosition = getSelfLoopLabelPosition(node, points, side, yOffset, label);
169
- const mergedEdge = {
170
- ...middleSegment.edge,
171
- ...originalEdge,
172
- id: originalEdge.id,
173
- points,
174
- start: originalEdge.start,
175
- end: originalEdge.end,
176
- x: labelPosition.x,
177
- y: labelPosition.y,
178
- width: label.width,
179
- height: label.height,
180
- labelStyle: middleSegment.edge.labelStyle,
181
- fromCluster: firstSegment.edge.fromCluster ?? middleSegment.edge.fromCluster ?? lastSegment.edge.fromCluster,
182
- toCluster: firstSegment.edge.toCluster ?? middleSegment.edge.toCluster ?? lastSegment.edge.toCluster
183
- };
184
- delete mergedEdge.selfLoop;
185
- delete mergedEdge.originalEdge;
186
- edgesToRender.push({ edge: mergedEdge, start: mergedEdge.start, end: mergedEdge.end });
187
- });
188
- return edgesToRender;
189
- }, "getEdgesToRender");
190
- var recursiveRender = /* @__PURE__ */ __name(async (_elem, graph, diagramType, id, parentCluster, siteConfig) => {
191
- log.warn("Graph in recursive render:XAX", write(graph), parentCluster);
192
- const dir = graph.graph().rankdir;
193
- log.trace("Dir in recursive render - dir:", dir);
194
- const elem = _elem.insert("g").attr("class", "root");
195
- if (!graph.nodes()) {
196
- log.info("No nodes found for", graph);
197
- } else {
198
- log.info("Recursive render XXX", graph.nodes());
199
- }
200
- if (graph.edges().length > 0) {
201
- log.info("Recursive edges", graph.edge(graph.edges()[0]));
202
- }
203
- const clusters = elem.insert("g").attr("class", "clusters");
204
- const edgePaths = elem.insert("g").attr("class", "edgePaths");
205
- const edgeLabels = elem.insert("g").attr("class", "edgeLabels");
206
- const nodes = elem.insert("g").attr("class", "nodes");
207
- const mergeSelfLoops = shouldMergeSelfLoopSegments(diagramType);
208
- await Promise.all(
209
- graph.nodes().map(async function(v) {
210
- const node = graph.node(v);
211
- if (parentCluster !== void 0) {
212
- const data = JSON.parse(JSON.stringify(parentCluster.clusterData));
213
- log.trace(
214
- "Setting data for parent cluster XXX\n Node.id = ",
215
- v,
216
- "\n data=",
217
- data.height,
218
- "\nParent cluster",
219
- parentCluster.height
220
- );
221
- graph.setNode(parentCluster.id, data);
222
- if (!graph.parent(v)) {
223
- log.trace("Setting parent", v, parentCluster.id);
224
- graph.setParent(v, parentCluster.id, data);
225
- }
226
- }
227
- log.info("(Insert) Node XXX" + v + ": " + JSON.stringify(graph.node(v)));
228
- if (node?.clusterNode) {
229
- log.info("Cluster identified XBX", v, node.width, graph.node(v));
230
- const { ranksep, nodesep } = graph.graph();
231
- node.graph.setGraph({
232
- ...node.graph.graph(),
233
- ranksep: ranksep + 25,
234
- nodesep
235
- });
236
- const o = await recursiveRender(
237
- nodes,
238
- node.graph,
239
- diagramType,
240
- id,
241
- graph.node(v),
242
- siteConfig
243
- );
244
- const newEl = o.elem;
245
- updateNodeBounds(node, newEl);
246
- node.diff = o.diff || 0;
247
- log.info(
248
- "New compound node after recursive render XAX",
249
- v,
250
- "width",
251
- // node,
252
- node.width,
253
- "height",
254
- node.height
255
- // node.x,
256
- // node.y
257
- );
258
- setNodeElem(newEl, node);
259
- } else {
260
- if (graph.children(v).length > 0) {
261
- log.trace(
262
- "Cluster - the non recursive path XBX",
263
- v,
264
- node.id,
265
- node,
266
- node.width,
267
- "Graph:",
268
- graph
269
- );
270
- log.trace(findNonClusterChild(node.id, graph));
271
- clusterDb.set(node.id, { id: findNonClusterChild(node.id, graph), node });
272
- } else {
273
- log.trace("Node - the non recursive path XAX", v, nodes, graph.node(v), dir);
274
- await insertNode(nodes, graph.node(v), { config: siteConfig, dir });
275
- }
276
- }
277
- })
278
- );
279
- const processEdges = /* @__PURE__ */ __name(async () => {
280
- const edgePromises = graph.edges().map(async function(e) {
281
- const edge = graph.edge(e.v, e.w, e.name);
282
- log.info("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(e));
283
- log.info("Edge " + e.v + " -> " + e.w + ": ", e, " ", JSON.stringify(graph.edge(e)));
284
- log.info(
285
- "Fix",
286
- clusterDb,
287
- "ids:",
288
- e.v,
289
- e.w,
290
- "Translating: ",
291
- clusterDb.get(e.v),
292
- clusterDb.get(e.w)
293
- );
294
- if (mergeSelfLoops && edge.selfLoop) {
295
- if (edge.selfLoop.order !== 1) {
296
- return;
297
- }
298
- const segmentId = edge.id;
299
- edge.id = edge.selfLoop.id;
300
- await insertEdgeLabel(edgeLabels, edge);
301
- edge.id = segmentId;
302
- return;
303
- }
304
- await insertEdgeLabel(edgeLabels, edge);
305
- });
306
- await Promise.all(edgePromises);
307
- }, "processEdges");
308
- await processEdges();
309
- log.info("Graph before layout:", JSON.stringify(write(graph)));
310
- log.info("############################################# XXX");
311
- log.info("### Layout ### XXX");
312
- log.info("############################################# XXX");
313
- layout(graph);
314
- log.info("Graph after layout:", JSON.stringify(write(graph)));
315
- let diff = 0;
316
- let { subGraphTitleTotalMargin } = getSubGraphTitleMargins(siteConfig);
317
- await Promise.all(
318
- sortNodesByHierarchy(graph).map(async function(v) {
319
- const node = graph.node(v);
320
- log.info(
321
- "Position XBX => " + v + ": (" + node.x,
322
- "," + node.y,
323
- ") width: ",
324
- node.width,
325
- " height: ",
326
- node.height
327
- );
328
- if (node?.clusterNode) {
329
- node.y += subGraphTitleTotalMargin;
330
- log.info(
331
- "A tainted cluster node XBX1",
332
- v,
333
- node.id,
334
- node.width,
335
- node.height,
336
- node.x,
337
- node.y,
338
- graph.parent(v)
339
- );
340
- clusterDb.get(node.id).node = node;
341
- positionNode(node);
342
- } else {
343
- if (graph.children(v).length > 0) {
344
- log.info(
345
- "A pure cluster node XBX1",
346
- v,
347
- node.id,
348
- node.x,
349
- node.y,
350
- node.width,
351
- node.height,
352
- graph.parent(v)
353
- );
354
- node.height += subGraphTitleTotalMargin;
355
- graph.node(node.parentId);
356
- const halfPadding = node?.padding / 2 || 0;
357
- const labelHeight = node?.labelBBox?.height || 0;
358
- const offsetY = labelHeight - halfPadding || 0;
359
- log.debug("OffsetY", offsetY, "labelHeight", labelHeight, "halfPadding", halfPadding);
360
- await insertCluster(clusters, node);
361
- clusterDb.get(node.id).node = node;
362
- } else {
363
- const parent = graph.node(node.parentId);
364
- node.y += subGraphTitleTotalMargin / 2;
365
- log.info(
366
- "A regular node XBX1 - using the padding",
367
- node.id,
368
- "parent",
369
- node.parentId,
370
- node.width,
371
- node.height,
372
- node.x,
373
- node.y,
374
- "offsetY",
375
- node.offsetY,
376
- "parent",
377
- parent,
378
- parent?.offsetY,
379
- node
380
- );
381
- positionNode(node);
382
- }
383
- }
384
- })
385
- );
386
- const edgeOffsetY = subGraphTitleTotalMargin / 2;
387
- const edgesToRender = getEdgesToRender(graph, edgeOffsetY, { mergeSelfLoops });
388
- edgesToRender.forEach(function({ edge, start, end }) {
389
- log.info("Edge " + start + " -> " + end + ": " + JSON.stringify(edge), edge);
390
- edge.points.forEach((point) => point.y += edgeOffsetY);
391
- const startNode = graph.node(start);
392
- const endNode = graph.node(end);
393
- const paths = insertEdge(edgePaths, edge, clusterDb, diagramType, startNode, endNode, id);
394
- positionEdgeLabel(edge, paths);
395
- });
396
- graph.nodes().forEach(function(v) {
397
- const n = graph.node(v);
398
- log.info(v, n.type, n.diff);
399
- if (n.isGroup) {
400
- diff = n.diff;
401
- }
402
- });
403
- log.warn("Returning from recursive render XAX", elem, diff);
404
- return { elem, diff };
405
- }, "recursiveRender");
406
- var render = /* @__PURE__ */ __name(async (data4Layout, svg) => {
407
- const graph = new Graph({
408
- multigraph: true,
409
- compound: true
410
- }).setGraph({
411
- rankdir: data4Layout.direction,
412
- nodesep: data4Layout.config?.nodeSpacing || data4Layout.config?.flowchart?.nodeSpacing || data4Layout.nodeSpacing,
413
- ranksep: data4Layout.config?.rankSpacing || data4Layout.config?.flowchart?.rankSpacing || data4Layout.rankSpacing,
414
- marginx: 8,
415
- marginy: 8
416
- }).setDefaultEdgeLabel(function() {
417
- return {};
418
- });
419
- const element = svg.select("g");
420
- markers_default(element, data4Layout.markers, data4Layout.type, data4Layout.diagramId);
421
- clear2();
422
- clear();
423
- clear$1();
424
- clear$2();
425
- data4Layout.nodes.forEach((node) => {
426
- graph.setNode(node.id, { ...node });
427
- if (node.parentId) {
428
- graph.setParent(node.id, node.parentId);
429
- }
430
- });
431
- log.debug("Edges:", data4Layout.edges);
432
- data4Layout.edges.forEach((edge) => {
433
- if (edge.start === edge.end) {
434
- const nodeId = edge.start;
435
- const specialId1 = nodeId + "---" + nodeId + "---1";
436
- const specialId2 = nodeId + "---" + nodeId + "---2";
437
- const node = graph.node(nodeId);
438
- graph.setNode(specialId1, {
439
- domId: specialId1,
440
- id: specialId1,
441
- parentId: node.parentId,
442
- labelStyle: "",
443
- label: "",
444
- padding: 0,
445
- shape: "labelRect",
446
- // shape: 'rect',
447
- style: "",
448
- width: 10,
449
- height: 10
450
- });
451
- graph.setParent(specialId1, node.parentId);
452
- graph.setNode(specialId2, {
453
- domId: specialId2,
454
- id: specialId2,
455
- parentId: node.parentId,
456
- labelStyle: "",
457
- padding: 0,
458
- // shape: 'rect',
459
- shape: "labelRect",
460
- label: "",
461
- style: "",
462
- width: 10,
463
- height: 10
464
- });
465
- graph.setParent(specialId2, node.parentId);
466
- const originalEdge = structuredClone(edge);
467
- const edge1 = structuredClone(edge);
468
- const edgeMid = structuredClone(edge);
469
- const edge2 = structuredClone(edge);
470
- edge1.originalEdge = originalEdge;
471
- edge1.selfLoop = { id: originalEdge.id, order: 0 };
472
- edgeMid.originalEdge = originalEdge;
473
- edgeMid.selfLoop = { id: originalEdge.id, order: 1 };
474
- edge2.originalEdge = originalEdge;
475
- edge2.selfLoop = { id: originalEdge.id, order: 2 };
476
- edge1.label = "";
477
- edge1.arrowTypeEnd = "none";
478
- edge1.endLabelLeft = "";
479
- edge1.endLabelRight = "";
480
- edge1.startLabelLeft = "";
481
- edge1.id = nodeId + "-cyclic-special-1";
482
- edgeMid.startLabelRight = "";
483
- edgeMid.startLabelLeft = "";
484
- edgeMid.endLabelLeft = "";
485
- edgeMid.endLabelRight = "";
486
- edgeMid.arrowTypeStart = "none";
487
- edgeMid.arrowTypeEnd = "none";
488
- edgeMid.id = nodeId + "-cyclic-special-mid";
489
- edge2.label = "";
490
- edge2.startLabelRight = "";
491
- edge2.startLabelLeft = "";
492
- edge2.arrowTypeStart = "none";
493
- if (node.isGroup) {
494
- edge1.fromCluster = nodeId;
495
- edge2.toCluster = nodeId;
496
- }
497
- edge2.id = nodeId + "-cyclic-special-2";
498
- edge2.arrowTypeStart = "none";
499
- graph.setEdge(nodeId, specialId1, edge1, nodeId + "-cyclic-special-0");
500
- graph.setEdge(specialId1, specialId2, edgeMid, nodeId + "-cyclic-special-1");
501
- graph.setEdge(specialId2, nodeId, edge2, nodeId + "-cyclic-special-2");
502
- } else {
503
- graph.setEdge(edge.start, edge.end, { ...edge }, edge.id);
504
- }
505
- });
506
- log.warn("Graph at first:", JSON.stringify(write(graph)));
507
- adjustClustersAndEdges(graph);
508
- log.warn("Graph after XAX:", JSON.stringify(write(graph)));
509
- const siteConfig = getConfig2();
510
- await recursiveRender(
511
- element,
512
- graph,
513
- data4Layout.type,
514
- data4Layout.diagramId,
515
- void 0,
516
- siteConfig
517
- );
518
- }, "render");
519
- export {
520
- getEdgesToRender,
521
- render
522
- };