@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,63 +0,0 @@
1
- #!/usr/bin/env node
2
- import { _ as __name } from "./mermaid.core-Dy_tFRs7.js";
3
- var DDLT_SIZE_CAPTURE_VERSION = 1;
4
- function getCaptureGlobal() {
5
- if (typeof globalThis === "undefined") {
6
- return void 0;
7
- }
8
- return globalThis;
9
- }
10
- __name(getCaptureGlobal, "getCaptureGlobal");
11
- function shouldCaptureSizes() {
12
- return Boolean(getCaptureGlobal()?.mermaidCaptureSizes);
13
- }
14
- __name(shouldCaptureSizes, "shouldCaptureSizes");
15
- function capturedFromLocation() {
16
- if (typeof location === "undefined") {
17
- return "browser-dev";
18
- }
19
- return `${location.pathname}${location.search}`;
20
- }
21
- __name(capturedFromLocation, "capturedFromLocation");
22
- function emitCapturedSizes(captured, element) {
23
- const g = getCaptureGlobal();
24
- if (!g) {
25
- return;
26
- }
27
- const domNode = element.node();
28
- const ownerSvg = (domNode && "ownerSVGElement" in domNode ? domNode.ownerSVGElement : null) ?? domNode;
29
- const svgId = ownerSvg?.id ?? "(unknown)";
30
- g.mermaidCapturedSizes ??= [];
31
- const entry = { svgId, sizes: captured };
32
- g.mermaidCapturedSizes.push(entry);
33
- g.mermaidLastCapturedSizes = entry;
34
- }
35
- __name(emitCapturedSizes, "emitCapturedSizes");
36
- function captureNodeSizes(element, data4Layout) {
37
- const nodes = [];
38
- for (const node of data4Layout.nodes) {
39
- if (node.isGroup) {
40
- continue;
41
- }
42
- nodes.push({ id: node.id, width: node.width ?? 0, height: node.height ?? 0 });
43
- }
44
- if (nodes.length === 0) {
45
- return;
46
- }
47
- emitCapturedSizes(
48
- {
49
- metadata: {
50
- captureVersion: DDLT_SIZE_CAPTURE_VERSION,
51
- capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
52
- capturedFrom: capturedFromLocation()
53
- },
54
- nodes
55
- },
56
- element
57
- );
58
- }
59
- __name(captureNodeSizes, "captureNodeSizes");
60
- export {
61
- captureNodeSizes,
62
- shouldCaptureSizes
63
- };
@@ -1,449 +0,0 @@
1
- #!/usr/bin/env node
2
- import { s as styles_default, a as stateDiagram_default, S as StateDB } from "./chunk-EX3LRPZG-BEXyn5R-.js";
3
- import { _ as __name, c as getConfig2, d as select, l as log, e as configureSvgSize, k as common_default, P as line, Q as curveBasis, L as getUrl, x as utils_default } 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 drawStartState = /* @__PURE__ */ __name((g) => g.append("circle").attr("class", "start-state").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit), "drawStartState");
7
- var drawDivider = /* @__PURE__ */ __name((g) => g.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", getConfig2().state.textHeight).attr("class", "divider").attr("x2", getConfig2().state.textHeight * 2).attr("y1", 0).attr("y2", 0), "drawDivider");
8
- var drawSimpleState = /* @__PURE__ */ __name((g, stateDef) => {
9
- const state = g.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 2 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
10
- const classBox = state.node().getBBox();
11
- g.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", classBox.width + 2 * getConfig2().state.padding).attr("height", classBox.height + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius);
12
- return state;
13
- }, "drawSimpleState");
14
- var drawDescrState = /* @__PURE__ */ __name((g, stateDef) => {
15
- const addTspan = /* @__PURE__ */ __name(function(textEl, txt, isFirst2) {
16
- const tSpan = textEl.append("tspan").attr("x", 2 * getConfig2().state.padding).text(txt);
17
- if (!isFirst2) {
18
- tSpan.attr("dy", getConfig2().state.textHeight);
19
- }
20
- }, "addTspan");
21
- const title = g.append("text").attr("x", 2 * getConfig2().state.padding).attr("y", getConfig2().state.textHeight + 1.3 * getConfig2().state.padding).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.descriptions[0]);
22
- const titleBox = title.node().getBBox();
23
- const titleHeight = titleBox.height;
24
- const description = g.append("text").attr("x", getConfig2().state.padding).attr(
25
- "y",
26
- titleHeight + getConfig2().state.padding * 0.4 + getConfig2().state.dividerMargin + getConfig2().state.textHeight
27
- ).attr("class", "state-description");
28
- let isFirst = true;
29
- let isSecond = true;
30
- stateDef.descriptions.forEach(function(descr) {
31
- if (!isFirst) {
32
- addTspan(description, descr, isSecond);
33
- isSecond = false;
34
- }
35
- isFirst = false;
36
- });
37
- const descrLine = g.append("line").attr("x1", getConfig2().state.padding).attr("y1", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("y2", getConfig2().state.padding + titleHeight + getConfig2().state.dividerMargin / 2).attr("class", "descr-divider");
38
- const descrBox = description.node().getBBox();
39
- const width = Math.max(descrBox.width, titleBox.width);
40
- descrLine.attr("x2", width + 3 * getConfig2().state.padding);
41
- g.insert("rect", ":first-child").attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding).attr("width", width + 2 * getConfig2().state.padding).attr("height", descrBox.height + titleHeight + 2 * getConfig2().state.padding).attr("rx", getConfig2().state.radius);
42
- return g;
43
- }, "drawDescrState");
44
- var addTitleAndBox = /* @__PURE__ */ __name((g, stateDef, altBkg) => {
45
- const pad = getConfig2().state.padding;
46
- const dblPad = 2 * getConfig2().state.padding;
47
- const orgBox = g.node().getBBox();
48
- const orgWidth = orgBox.width;
49
- const orgX = orgBox.x;
50
- const title = g.append("text").attr("x", 0).attr("y", getConfig2().state.titleShift).attr("font-size", getConfig2().state.fontSize).attr("class", "state-title").text(stateDef.id);
51
- const titleBox = title.node().getBBox();
52
- const titleWidth = titleBox.width + dblPad;
53
- let width = Math.max(titleWidth, orgWidth);
54
- if (width === orgWidth) {
55
- width = width + dblPad;
56
- }
57
- let startX;
58
- const graphBox = g.node().getBBox();
59
- if (stateDef.doc) ;
60
- startX = orgX - pad;
61
- if (titleWidth > orgWidth) {
62
- startX = (orgWidth - width) / 2 + pad;
63
- }
64
- if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
65
- startX = orgX - (titleWidth - orgWidth) / 2;
66
- }
67
- const lineY = 1 - getConfig2().state.textHeight;
68
- g.insert("rect", ":first-child").attr("x", startX).attr("y", lineY).attr("class", altBkg ? "alt-composit" : "composit").attr("width", width).attr(
69
- "height",
70
- graphBox.height + getConfig2().state.textHeight + getConfig2().state.titleShift + 1
71
- ).attr("rx", "0");
72
- title.attr("x", startX + pad);
73
- if (titleWidth <= orgWidth) {
74
- title.attr("x", orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);
75
- }
76
- g.insert("rect", ":first-child").attr("x", startX).attr(
77
- "y",
78
- getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding
79
- ).attr("width", width).attr("height", getConfig2().state.textHeight * 3).attr("rx", getConfig2().state.radius);
80
- g.insert("rect", ":first-child").attr("x", startX).attr(
81
- "y",
82
- getConfig2().state.titleShift - getConfig2().state.textHeight - getConfig2().state.padding
83
- ).attr("width", width).attr("height", graphBox.height + 3 + 2 * getConfig2().state.textHeight).attr("rx", getConfig2().state.radius);
84
- return g;
85
- }, "addTitleAndBox");
86
- var drawEndState = /* @__PURE__ */ __name((g) => {
87
- g.append("circle").attr("class", "end-state-outer").attr("r", getConfig2().state.sizeUnit + getConfig2().state.miniPadding).attr(
88
- "cx",
89
- getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding
90
- ).attr(
91
- "cy",
92
- getConfig2().state.padding + getConfig2().state.sizeUnit + getConfig2().state.miniPadding
93
- );
94
- return g.append("circle").attr("class", "end-state-inner").attr("r", getConfig2().state.sizeUnit).attr("cx", getConfig2().state.padding + getConfig2().state.sizeUnit + 2).attr("cy", getConfig2().state.padding + getConfig2().state.sizeUnit + 2);
95
- }, "drawEndState");
96
- var drawForkJoinState = /* @__PURE__ */ __name((g, stateDef) => {
97
- let width = getConfig2().state.forkWidth;
98
- let height = getConfig2().state.forkHeight;
99
- if (stateDef.parentId) {
100
- let tmp = width;
101
- width = height;
102
- height = tmp;
103
- }
104
- return g.append("rect").style("stroke", "black").style("fill", "black").attr("width", width).attr("height", height).attr("x", getConfig2().state.padding).attr("y", getConfig2().state.padding);
105
- }, "drawForkJoinState");
106
- var _drawLongText = /* @__PURE__ */ __name((_text, x, y, g) => {
107
- let textHeight = 0;
108
- const textElem = g.append("text");
109
- textElem.style("text-anchor", "start");
110
- textElem.attr("class", "noteText");
111
- let text = _text.replace(/\r\n/g, "<br/>");
112
- text = text.replace(/\n/g, "<br/>");
113
- const lines = text.split(common_default.lineBreakRegex);
114
- let tHeight = 1.25 * getConfig2().state.noteMargin;
115
- for (const line2 of lines) {
116
- const txt = line2.trim();
117
- if (txt.length > 0) {
118
- const span = textElem.append("tspan");
119
- span.text(txt);
120
- if (tHeight === 0) {
121
- const textBounds = span.node().getBBox();
122
- tHeight += textBounds.height;
123
- }
124
- textHeight += tHeight;
125
- span.attr("x", x + getConfig2().state.noteMargin);
126
- span.attr("y", y + textHeight + 1.25 * getConfig2().state.noteMargin);
127
- }
128
- }
129
- return { textWidth: textElem.node().getBBox().width, textHeight };
130
- }, "_drawLongText");
131
- var drawNote = /* @__PURE__ */ __name((text, g) => {
132
- g.attr("class", "state-note");
133
- const note = g.append("rect").attr("x", 0).attr("y", getConfig2().state.padding);
134
- const rectElem = g.append("g");
135
- const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);
136
- note.attr("height", textHeight + 2 * getConfig2().state.noteMargin);
137
- note.attr("width", textWidth + getConfig2().state.noteMargin * 2);
138
- return note;
139
- }, "drawNote");
140
- var drawState = /* @__PURE__ */ __name(function(elem, stateDef) {
141
- const id = stateDef.id;
142
- const stateInfo = {
143
- id,
144
- label: stateDef.id,
145
- width: 0,
146
- height: 0
147
- };
148
- const g = elem.append("g").attr("id", id).attr("class", "stateGroup");
149
- if (stateDef.type === "start") {
150
- drawStartState(g);
151
- }
152
- if (stateDef.type === "end") {
153
- drawEndState(g);
154
- }
155
- if (stateDef.type === "fork" || stateDef.type === "join") {
156
- drawForkJoinState(g, stateDef);
157
- }
158
- if (stateDef.type === "note") {
159
- drawNote(stateDef.note.text, g);
160
- }
161
- if (stateDef.type === "divider") {
162
- drawDivider(g);
163
- }
164
- if (stateDef.type === "default" && stateDef.descriptions.length === 0) {
165
- drawSimpleState(g, stateDef);
166
- }
167
- if (stateDef.type === "default" && stateDef.descriptions.length > 0) {
168
- drawDescrState(g, stateDef);
169
- }
170
- const stateBox = g.node().getBBox();
171
- stateInfo.width = stateBox.width + 2 * getConfig2().state.padding;
172
- stateInfo.height = stateBox.height + 2 * getConfig2().state.padding;
173
- return stateInfo;
174
- }, "drawState");
175
- var edgeCount = 0;
176
- var drawEdge = /* @__PURE__ */ __name(function(elem, path, relation) {
177
- const getRelationType = /* @__PURE__ */ __name(function(type) {
178
- switch (type) {
179
- case StateDB.relationType.AGGREGATION:
180
- return "aggregation";
181
- case StateDB.relationType.EXTENSION:
182
- return "extension";
183
- case StateDB.relationType.COMPOSITION:
184
- return "composition";
185
- case StateDB.relationType.DEPENDENCY:
186
- return "dependency";
187
- }
188
- }, "getRelationType");
189
- path.points = path.points.filter((p) => !Number.isNaN(p.y));
190
- const lineData = path.points;
191
- const lineFunction = line().x(function(d) {
192
- return d.x;
193
- }).y(function(d) {
194
- return d.y;
195
- }).curve(curveBasis);
196
- const svgPath = elem.append("path").attr("d", lineFunction(lineData)).attr("id", "edge" + edgeCount).attr("class", "transition");
197
- let url = "";
198
- if (getConfig2().state.arrowMarkerAbsolute) {
199
- url = getUrl(true);
200
- }
201
- svgPath.attr(
202
- "marker-end",
203
- "url(" + url + "#" + getRelationType(StateDB.relationType.DEPENDENCY) + "End)"
204
- );
205
- if (relation.title !== void 0) {
206
- const label = elem.append("g").attr("class", "stateLabel");
207
- const { x, y } = utils_default.calcLabelPosition(path.points);
208
- const rows = common_default.getRows(relation.title);
209
- let titleHeight = 0;
210
- const titleRows = [];
211
- let maxWidth = 0;
212
- let minX = 0;
213
- for (let i = 0; i <= rows.length; i++) {
214
- const title = label.append("text").attr("text-anchor", "middle").text(rows[i]).attr("x", x).attr("y", y + titleHeight);
215
- const boundsTmp = title.node().getBBox();
216
- maxWidth = Math.max(maxWidth, boundsTmp.width);
217
- minX = Math.min(minX, boundsTmp.x);
218
- log.info(boundsTmp.x, x, y + titleHeight);
219
- if (titleHeight === 0) {
220
- const titleBox = title.node().getBBox();
221
- titleHeight = titleBox.height;
222
- log.info("Title height", titleHeight, y);
223
- }
224
- titleRows.push(title);
225
- }
226
- let boxHeight = titleHeight * rows.length;
227
- if (rows.length > 1) {
228
- const heightAdj = (rows.length - 1) * titleHeight * 0.5;
229
- titleRows.forEach((title, i) => title.attr("y", y + i * titleHeight - heightAdj));
230
- boxHeight = titleHeight * rows.length;
231
- }
232
- const bounds = label.node().getBBox();
233
- label.insert("rect", ":first-child").attr("class", "box").attr("x", x - maxWidth / 2 - getConfig2().state.padding / 2).attr("y", y - boxHeight / 2 - getConfig2().state.padding / 2 - 3.5).attr("width", maxWidth + getConfig2().state.padding).attr("height", boxHeight + getConfig2().state.padding);
234
- log.info(bounds);
235
- }
236
- edgeCount++;
237
- }, "drawEdge");
238
- var conf;
239
- var transformationLog = {};
240
- var setConf = /* @__PURE__ */ __name(function() {
241
- }, "setConf");
242
- var insertMarkers = /* @__PURE__ */ __name(function(elem) {
243
- elem.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
244
- }, "insertMarkers");
245
- var draw = /* @__PURE__ */ __name(function(text, id, _version, diagObj) {
246
- conf = getConfig2().state;
247
- const securityLevel = getConfig2().securityLevel;
248
- let sandboxElement;
249
- if (securityLevel === "sandbox") {
250
- sandboxElement = select("#i" + id);
251
- }
252
- const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
253
- const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
254
- log.debug("Rendering diagram " + text);
255
- const diagram2 = root.select(`[id='${id}']`);
256
- insertMarkers(diagram2);
257
- const rootDoc = diagObj.db.getRootDoc();
258
- const rootG = diagram2.append("g").attr("id", id + "-root");
259
- renderDoc(rootDoc, rootG, void 0, false, root, doc, diagObj);
260
- const padding = conf.padding;
261
- const bounds = diagram2.node().getBBox();
262
- const width = bounds.width + padding * 2;
263
- const height = bounds.height + padding * 2;
264
- const svgWidth = width * 1.75;
265
- configureSvgSize(diagram2, height, svgWidth, conf.useMaxWidth);
266
- diagram2.attr(
267
- "viewBox",
268
- `${bounds.x - conf.padding} ${bounds.y - conf.padding} ` + width + " " + height
269
- );
270
- }, "draw");
271
- var getLabelWidth = /* @__PURE__ */ __name((text) => {
272
- return text ? text.length * conf.fontSizeFactor : 1;
273
- }, "getLabelWidth");
274
- var renderDoc = /* @__PURE__ */ __name((doc, diagram2, parentId, altBkg, root, domDocument, diagObj) => {
275
- const graph = new Graph({
276
- compound: true,
277
- multigraph: true
278
- });
279
- let i;
280
- let edgeFreeDoc = true;
281
- for (i = 0; i < doc.length; i++) {
282
- if (doc[i].stmt === "relation") {
283
- edgeFreeDoc = false;
284
- break;
285
- }
286
- }
287
- if (parentId) {
288
- graph.setGraph({
289
- rankdir: "LR",
290
- multigraph: true,
291
- compound: true,
292
- // acyclicer: 'greedy',
293
- ranker: "tight-tree",
294
- ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
295
- nodeSep: edgeFreeDoc ? 1 : 50,
296
- isMultiGraph: true
297
- // ranksep: 5,
298
- // nodesep: 1
299
- });
300
- } else {
301
- graph.setGraph({
302
- rankdir: "TB",
303
- multigraph: true,
304
- compound: true,
305
- // isCompound: true,
306
- // acyclicer: 'greedy',
307
- // ranker: 'longest-path'
308
- ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
309
- nodeSep: edgeFreeDoc ? 1 : 50,
310
- ranker: "tight-tree",
311
- // ranker: 'network-simplex'
312
- isMultiGraph: true
313
- });
314
- }
315
- graph.setDefaultEdgeLabel(function() {
316
- return {};
317
- });
318
- const states = diagObj.db.getStates();
319
- const relations = diagObj.db.getRelations();
320
- const keys = Object.keys(states);
321
- for (const key of keys) {
322
- const stateDef = states[key];
323
- if (parentId) {
324
- stateDef.parentId = parentId;
325
- }
326
- let node;
327
- if (stateDef.doc) {
328
- let sub = diagram2.append("g").attr("id", stateDef.id).attr("class", "stateGroup");
329
- node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg, root, domDocument, diagObj);
330
- {
331
- sub = addTitleAndBox(sub, stateDef, altBkg);
332
- let boxBounds = sub.node().getBBox();
333
- node.width = boxBounds.width;
334
- node.height = boxBounds.height + conf.padding / 2;
335
- transformationLog[stateDef.id] = { y: conf.compositTitleSize };
336
- }
337
- } else {
338
- node = drawState(diagram2, stateDef, graph);
339
- }
340
- if (stateDef.note) {
341
- const noteDef = {
342
- descriptions: [],
343
- id: stateDef.id + "-note",
344
- note: stateDef.note,
345
- type: "note"
346
- };
347
- const note = drawState(diagram2, noteDef, graph);
348
- if (stateDef.note.position === "left of") {
349
- graph.setNode(node.id + "-note", note);
350
- graph.setNode(node.id, node);
351
- } else {
352
- graph.setNode(node.id, node);
353
- graph.setNode(node.id + "-note", note);
354
- }
355
- graph.setParent(node.id, node.id + "-group");
356
- graph.setParent(node.id + "-note", node.id + "-group");
357
- } else {
358
- graph.setNode(node.id, node);
359
- }
360
- }
361
- log.debug("Count=", graph.nodeCount(), graph);
362
- let cnt = 0;
363
- relations.forEach(function(relation) {
364
- cnt++;
365
- log.debug("Setting edge", relation);
366
- graph.setEdge(
367
- relation.id1,
368
- relation.id2,
369
- {
370
- relation,
371
- width: getLabelWidth(relation.title),
372
- height: conf.labelHeight * common_default.getRows(relation.title).length,
373
- labelpos: "c"
374
- },
375
- "id" + cnt
376
- );
377
- });
378
- layout(graph);
379
- log.debug("Graph after layout", graph.nodes());
380
- const svgElem = diagram2.node();
381
- graph.nodes().forEach(function(v) {
382
- if (v !== void 0 && graph.node(v) !== void 0) {
383
- log.warn("Node " + v + ": " + JSON.stringify(graph.node(v)));
384
- root.select("#" + svgElem.id + " #" + v).attr(
385
- "transform",
386
- "translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + " )"
387
- );
388
- root.select("#" + svgElem.id + " #" + v).attr("data-x-shift", graph.node(v).x - graph.node(v).width / 2);
389
- const dividers = domDocument.querySelectorAll("#" + svgElem.id + " #" + v + " .divider");
390
- dividers.forEach((divider) => {
391
- const parent = divider.parentElement;
392
- let pWidth = 0;
393
- let pShift = 0;
394
- if (parent) {
395
- if (parent.parentElement) {
396
- pWidth = parent.parentElement.getBBox().width;
397
- }
398
- pShift = parseInt(parent.getAttribute("data-x-shift"), 10);
399
- if (Number.isNaN(pShift)) {
400
- pShift = 0;
401
- }
402
- }
403
- divider.setAttribute("x1", 0 - pShift + 8);
404
- divider.setAttribute("x2", pWidth - pShift - 8);
405
- });
406
- } else {
407
- log.debug("No Node " + v + ": " + JSON.stringify(graph.node(v)));
408
- }
409
- });
410
- let stateBox = svgElem.getBBox();
411
- graph.edges().forEach(function(e) {
412
- if (e !== void 0 && graph.edge(e) !== void 0) {
413
- log.debug("Edge " + e.v + " -> " + e.w + ": " + JSON.stringify(graph.edge(e)));
414
- drawEdge(diagram2, graph.edge(e), graph.edge(e).relation);
415
- }
416
- });
417
- stateBox = svgElem.getBBox();
418
- const stateInfo = {
419
- id: parentId ? parentId : "root",
420
- label: parentId ? parentId : "root",
421
- width: 0,
422
- height: 0
423
- };
424
- stateInfo.width = stateBox.width + 2 * conf.padding;
425
- stateInfo.height = stateBox.height + 2 * conf.padding;
426
- log.debug("Doc rendered", stateInfo, graph);
427
- return stateInfo;
428
- }, "renderDoc");
429
- var stateRenderer_default = {
430
- setConf,
431
- draw
432
- };
433
- var diagram = {
434
- parser: stateDiagram_default,
435
- get db() {
436
- return new StateDB(1);
437
- },
438
- renderer: stateRenderer_default,
439
- styles: styles_default,
440
- init: /* @__PURE__ */ __name((cnf) => {
441
- if (!cnf.state) {
442
- cnf.state = {};
443
- }
444
- cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
445
- }, "init")
446
- };
447
- export {
448
- diagram
449
- };
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env node
2
- import { s as styles_default, b as stateRenderer_v3_unified_default, a as stateDiagram_default, S as StateDB } from "./chunk-EX3LRPZG-BEXyn5R-.js";
3
- import { _ as __name } from "./mermaid.core-Dy_tFRs7.js";
4
- var diagram = {
5
- parser: stateDiagram_default,
6
- get db() {
7
- return new StateDB(2);
8
- },
9
- renderer: stateRenderer_v3_unified_default,
10
- styles: styles_default,
11
- init: /* @__PURE__ */ __name((cnf) => {
12
- if (!cnf.state) {
13
- cnf.state = {};
14
- }
15
- cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
16
- }, "init")
17
- };
18
- export {
19
- diagram
20
- };