@yorz/cli 0.1.3 → 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 (139) hide show
  1. package/README.md +5 -2
  2. package/dist/cli/index.js +385 -28
  3. package/dist/gui/assets/{abnfDiagram-VRR7QNED-DE_Lwnyj.js → abnfDiagram-VRR7QNED-BjiKWU_r.js} +1 -1
  4. package/dist/gui/assets/{arc-0XKFeKL1.js → arc--ZszoeC5.js} +1 -1
  5. package/dist/gui/assets/{architectureDiagram-ZJ3FMSHR-WVMr6CTB.js → architectureDiagram-ZJ3FMSHR-D8beCiJM.js} +1 -1
  6. package/dist/gui/assets/{blockDiagram-677ZJIJ3-JmkelTQ6.js → blockDiagram-677ZJIJ3-XTjBv4Yl.js} +1 -1
  7. package/dist/gui/assets/{c4Diagram-LMCZKHZV-BYvSE_vv.js → c4Diagram-LMCZKHZV-B8mRAP6M.js} +1 -1
  8. package/dist/gui/assets/channel-DSEvjkHE.js +1 -0
  9. package/dist/gui/assets/{chunk-2Q5K7J3B-cgJ3ifz_.js → chunk-2Q5K7J3B-yiwKrUMh.js} +1 -1
  10. package/dist/gui/assets/{chunk-32BRIVSS-DR-AYVVA.js → chunk-32BRIVSS-BKUpEqmm.js} +1 -1
  11. package/dist/gui/assets/{chunk-5VM5RSS4-Di4z9gEz.js → chunk-5VM5RSS4-DbsGyMz5.js} +1 -1
  12. package/dist/gui/assets/{chunk-EX3LRPZG-CtCaJMGG.js → chunk-EX3LRPZG-DTBuQkne.js} +1 -1
  13. package/dist/gui/assets/{chunk-JWPE2WC7-EjoKlGne.js → chunk-JWPE2WC7-Durur7_4.js} +1 -1
  14. package/dist/gui/assets/{chunk-MOJQB5TN-ndMzM7-f.js → chunk-MOJQB5TN-DXNE2VJB.js} +1 -1
  15. package/dist/gui/assets/{chunk-RYQCIY6F-CDdJsSDv.js → chunk-RYQCIY6F-HY8qhnee.js} +1 -1
  16. package/dist/gui/assets/{chunk-V7JOEXUC-BptnbB4R.js → chunk-V7JOEXUC-BXRxPy5M.js} +1 -1
  17. package/dist/gui/assets/{chunk-VR4S4FIN-CF8Dsx8K.js → chunk-VR4S4FIN-Ws4fVn18.js} +1 -1
  18. package/dist/gui/assets/{chunk-XXDRQBXY-CgGWri-V.js → chunk-XXDRQBXY-CwHBGyO1.js} +1 -1
  19. package/dist/gui/assets/classDiagram-OUVF2IWQ-BN1qwPdD.js +1 -0
  20. package/dist/gui/assets/classDiagram-v2-EOCWNBFH-BN1qwPdD.js +1 -0
  21. package/dist/gui/assets/{cose-bilkent-JH36ORCC-Bm9uE-P8.js → cose-bilkent-JH36ORCC-C3oDctXM.js} +1 -1
  22. package/dist/gui/assets/{cynefin-VYW2F7L2-Dd-Apprt.js → cynefin-VYW2F7L2-BjremdIM.js} +1 -1
  23. package/dist/gui/assets/{cynefinDiagram-TSTJHNR4-DpGBOFX2.js → cynefinDiagram-TSTJHNR4-Cwe2fD65.js} +1 -1
  24. package/dist/gui/assets/{dagre-VKFMJZFB-DmKBW-UB.js → dagre-VKFMJZFB-Bx2kzeqs.js} +1 -1
  25. package/dist/gui/assets/{diagram-FQU43EPY-CYuUGN7Z.js → diagram-FQU43EPY-BVyLKNdq.js} +1 -1
  26. package/dist/gui/assets/{diagram-G47NLZAW-BZ-zUUWn.js → diagram-G47NLZAW-DicBAwcf.js} +1 -1
  27. package/dist/gui/assets/{diagram-NH7WQ7WH-D2qb5dA_.js → diagram-NH7WQ7WH-BbRrvaYb.js} +1 -1
  28. package/dist/gui/assets/{diagram-OA4YK3LP-BSy8-VUz.js → diagram-OA4YK3LP-C2YIUXV5.js} +1 -1
  29. package/dist/gui/assets/{diagram-WEI45ONY-B-vTVzM8.js → diagram-WEI45ONY-DJHPHFaZ.js} +1 -1
  30. package/dist/gui/assets/{ebnfDiagram-CCIWWBDH-cKb33glS.js → ebnfDiagram-CCIWWBDH-DtDW0rR6.js} +1 -1
  31. package/dist/gui/assets/{erDiagram-Q63AITRT-DvWEFI1U.js → erDiagram-Q63AITRT-C5CAH1UZ.js} +1 -1
  32. package/dist/gui/assets/{flowDiagram-23GEKE2U-CfvFgLP2.js → flowDiagram-23GEKE2U-DA2WblHa.js} +1 -1
  33. package/dist/gui/assets/{ganttDiagram-NO4QXBWP-BnDujV-k.js → ganttDiagram-NO4QXBWP-TMRYyAbG.js} +1 -1
  34. package/dist/gui/assets/{gitGraphDiagram-IHSO6WYX-Sv91FaB5.js → gitGraphDiagram-IHSO6WYX-Ci-GVNac.js} +1 -1
  35. package/dist/gui/assets/index-Bq3A8DU2.js +21 -0
  36. package/dist/gui/assets/{infoDiagram-FWYZ7A6U-BE3WS_us.js → infoDiagram-FWYZ7A6U-BV4Ye9h-.js} +1 -1
  37. package/dist/gui/assets/{ishikawaDiagram-FXEZZL3T-FObQPAd_.js → ishikawaDiagram-FXEZZL3T-CLBTOnXf.js} +1 -1
  38. package/dist/gui/assets/{journeyDiagram-5HDEW3XC-D3RAFL7x.js → journeyDiagram-5HDEW3XC-BINYoOlq.js} +1 -1
  39. package/dist/gui/assets/{kanban-definition-HUTT4EX6-Bx1DS2KG.js → kanban-definition-HUTT4EX6-Bvoywhuo.js} +1 -1
  40. package/dist/gui/assets/{linear-oevdTPQK.js → linear-CldLHplp.js} +1 -1
  41. package/dist/gui/assets/{mermaid.core-jn1Xktvs.js → mermaid.core-1Uynhu-S.js} +4 -4
  42. package/dist/gui/assets/{mindmap-definition-LN4V7U3C-xLT5IJki.js → mindmap-definition-LN4V7U3C-Sv5B_zGg.js} +1 -1
  43. package/dist/gui/assets/{pegDiagram-2B236MQR-DToAMrXG.js → pegDiagram-2B236MQR-CyYAur_9.js} +1 -1
  44. package/dist/gui/assets/{pieDiagram-ENE6RG2P-Cw6tv4YJ.js → pieDiagram-ENE6RG2P-D3P7lu31.js} +1 -1
  45. package/dist/gui/assets/{quadrantDiagram-ABIIQ3AL-GW5Knopm.js → quadrantDiagram-ABIIQ3AL-zmQrhKVf.js} +1 -1
  46. package/dist/gui/assets/{railroadDiagram-RFXS5EU6-CuP1sa-2.js → railroadDiagram-RFXS5EU6-D5HlXQ4M.js} +1 -1
  47. package/dist/gui/assets/{requirementDiagram-TGXJPOKE-D8IcCo1X.js → requirementDiagram-TGXJPOKE-BJcv5tpR.js} +1 -1
  48. package/dist/gui/assets/{sankeyDiagram-HTMAVEWB-CfT_C9uh.js → sankeyDiagram-HTMAVEWB-9R97Q-65.js} +1 -1
  49. package/dist/gui/assets/{sequenceDiagram-DBY2YBRQ-BwUwWFYe.js → sequenceDiagram-DBY2YBRQ-D6v2e_UA.js} +1 -1
  50. package/dist/gui/assets/{sizeCapture-X5ZJPWSS-DyBlcl4H.js → sizeCapture-X5ZJPWSS-5Ee75AoR.js} +1 -1
  51. package/dist/gui/assets/{stateDiagram-2N3HPSRC-yv8DkbvF.js → stateDiagram-2N3HPSRC-CiFKPVFd.js} +1 -1
  52. package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-XeM3QPuf.js +1 -0
  53. package/dist/gui/assets/{swimlanes-5IMT3BWC-BnOmKdmr.js → swimlanes-5IMT3BWC-DejeKz32.js} +2 -2
  54. package/dist/gui/assets/swimlanesDiagram-G3AALYLV-BaUP5W6u.js +8 -0
  55. package/dist/gui/assets/{timeline-definition-FHXFAJF6-C6_-GVjE.js → timeline-definition-FHXFAJF6-CpW-bina.js} +1 -1
  56. package/dist/gui/assets/{vennDiagram-L72KCM5P-D_N0uLk2.js → vennDiagram-L72KCM5P-DFEDh4dV.js} +1 -1
  57. package/dist/gui/assets/{wardleyDiagram-EHGQE667-CnNoxFYY.js → wardleyDiagram-EHGQE667-B4Blcc-a.js} +1 -1
  58. package/dist/gui/assets/{xychartDiagram-FW5EYKEG-CloORw9z.js → xychartDiagram-FW5EYKEG-D9idxadT.js} +1 -1
  59. package/dist/gui/index.html +1 -1
  60. package/package.json +2 -2
  61. package/dist/_commonjsHelpers-DyI1JsEH.js +0 -34
  62. package/dist/abnfDiagram-VRR7QNED-UQS77aUi.js +0 -119
  63. package/dist/api-DrYc_Ds_.js +0 -129852
  64. package/dist/arc-B1cAL3U1.js +0 -132
  65. package/dist/architectureDiagram-ZJ3FMSHR-CfWOhs-q.js +0 -8816
  66. package/dist/blockDiagram-677ZJIJ3-CLOAAFZa.js +0 -3796
  67. package/dist/c4Diagram-LMCZKHZV-BGdELGkb.js +0 -2483
  68. package/dist/certs-BeimSwB3.js +0 -14071
  69. package/dist/certs-C4t5lAmJ.js +0 -14071
  70. package/dist/certs-CLLngjpY.js +0 -14071
  71. package/dist/certs-D3fTB-0_.js +0 -14071
  72. package/dist/channel-_gQD3mZ8.js +0 -8
  73. package/dist/chunk-2Q5K7J3B-DIJkMPWD.js +0 -20
  74. package/dist/chunk-32BRIVSS-CIQb7-9I.js +0 -117
  75. package/dist/chunk-5VM5RSS4-DmlAsh6o.js +0 -20
  76. package/dist/chunk-EX3LRPZG-BEXyn5R-.js +0 -1989
  77. package/dist/chunk-JWPE2WC7-XiIefccF.js +0 -17
  78. package/dist/chunk-MOJQB5TN-CC5OBDWw.js +0 -861
  79. package/dist/chunk-RYQCIY6F-DQacsGpB.js +0 -475
  80. package/dist/chunk-V7JOEXUC-TLRsIUvf.js +0 -2027
  81. package/dist/chunk-VR4S4FIN-9AfN7RDF.js +0 -25
  82. package/dist/chunk-XXDRQBXY-DhWucSRr.js +0 -14
  83. package/dist/classDiagram-OUVF2IWQ-CN55rRkB.js +0 -20
  84. package/dist/classDiagram-v2-EOCWNBFH-CN55rRkB.js +0 -20
  85. package/dist/cose-bilkent-JH36ORCC-8uGYe6_d.js +0 -4944
  86. package/dist/cynefin-VYW2F7L2-BwTeE-TI.js +0 -32061
  87. package/dist/cynefinDiagram-TSTJHNR4-DM7ixE-v.js +0 -454
  88. package/dist/cytoscape.esm-BTopYfIb.js +0 -30347
  89. package/dist/dagre-VKFMJZFB-blEDoYen.js +0 -522
  90. package/dist/defaultLocale-wHUL1xE2.js +0 -207
  91. package/dist/diagram-FQU43EPY-MEZlmmdi.js +0 -633
  92. package/dist/diagram-G47NLZAW-DZOZvHqp.js +0 -857
  93. package/dist/diagram-NH7WQ7WH-ChpmPbZz.js +0 -213
  94. package/dist/diagram-OA4YK3LP-oy4yvrnL.js +0 -489
  95. package/dist/diagram-WEI45ONY-B3nx1cYt.js +0 -305
  96. package/dist/ebnfDiagram-CCIWWBDH-BASj7BoO.js +0 -139
  97. package/dist/erDiagram-Q63AITRT-lujHq-S9.js +0 -1239
  98. package/dist/flowDiagram-23GEKE2U-BdsAVPgU.js +0 -2349
  99. package/dist/ganttDiagram-NO4QXBWP-DUUP4lsu.js +0 -3733
  100. package/dist/gitGraphDiagram-IHSO6WYX-BdIPAtb0.js +0 -1374
  101. package/dist/graph-CE8jV7cI.js +0 -2043
  102. package/dist/gui/assets/channel-BhMtSKKb.js +0 -1
  103. package/dist/gui/assets/classDiagram-OUVF2IWQ-DiPaZ7LY.js +0 -1
  104. package/dist/gui/assets/classDiagram-v2-EOCWNBFH-DiPaZ7LY.js +0 -1
  105. package/dist/gui/assets/index-Do-LzYBw.js +0 -21
  106. package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-BspjtPpt.js +0 -1
  107. package/dist/gui/assets/swimlanesDiagram-G3AALYLV-BgPC3dJX.js +0 -8
  108. package/dist/index--GoVvfUP.js +0 -5447
  109. package/dist/index-3-WDiDAh.js +0 -5466
  110. package/dist/index-CHBXZAxg.js +0 -5460
  111. package/dist/index-DeCq8xn7.js +0 -5460
  112. package/dist/infoDiagram-FWYZ7A6U-D9wo93kg.js +0 -32
  113. package/dist/init-DDGa2CQM.js +0 -17
  114. package/dist/ishikawaDiagram-FXEZZL3T-DZh3_kt2.js +0 -968
  115. package/dist/journeyDiagram-5HDEW3XC-C8RWHIn0.js +0 -1256
  116. package/dist/kanban-definition-HUTT4EX6-B7qQtB5a.js +0 -1053
  117. package/dist/katex-WjDlQEfU.js +0 -14500
  118. package/dist/layout-DQAYh_L7.js +0 -2360
  119. package/dist/linear-C_kZRZXS.js +0 -341
  120. package/dist/map-BElV7BMC.js +0 -299
  121. package/dist/mermaid.core-Dy_tFRs7.js +0 -26495
  122. package/dist/mindmap-definition-LN4V7U3C-BzHCd5Ab.js +0 -1181
  123. package/dist/ordinal-C2kkg180.js +0 -77
  124. package/dist/pegDiagram-2B236MQR-B046bQWM.js +0 -127
  125. package/dist/pieDiagram-ENE6RG2P-B5_W2CZy.js +0 -316
  126. package/dist/quadrantDiagram-ABIIQ3AL-Bbpt496h.js +0 -1342
  127. package/dist/railroadDiagram-RFXS5EU6-10XIH3X0.js +0 -93
  128. package/dist/requirementDiagram-TGXJPOKE-Dt1QyccY.js +0 -1205
  129. package/dist/sankeyDiagram-HTMAVEWB-CnqRAq7M.js +0 -1274
  130. package/dist/sequenceDiagram-DBY2YBRQ-DtJLSXoz.js +0 -4515
  131. package/dist/sizeCapture-X5ZJPWSS-DUl5ZEo3.js +0 -63
  132. package/dist/stateDiagram-2N3HPSRC-b-qzcVNj.js +0 -449
  133. package/dist/stateDiagram-v2-6OUMAXLB-KjDlRfc7.js +0 -20
  134. package/dist/swimlanes-5IMT3BWC-CAjGnQLa.js +0 -8553
  135. package/dist/swimlanesDiagram-G3AALYLV-DiOi9bzU.js +0 -16
  136. package/dist/timeline-definition-FHXFAJF6-Bme2FWbh.js +0 -1597
  137. package/dist/vennDiagram-L72KCM5P-BUQgnZDB.js +0 -2516
  138. package/dist/wardleyDiagram-EHGQE667-DHR2Avlu.js +0 -976
  139. 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
- };