@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,213 +0,0 @@
1
- #!/usr/bin/env node
2
- import { p as populateCommonDb } from "./chunk-JWPE2WC7-XiIefccF.js";
3
- import { _ as __name, A as cleanAndMerge, D as selectSvgElement, e as configureSvgSize, l as log, b as setAccTitle, a as getAccTitle, n as setDiagramTitle, o as getDiagramTitle, g as getAccDescription, s as setAccDescription, y as getConfig, B as defaultConfig_default, p as clear } from "./mermaid.core-Dy_tFRs7.js";
4
- import { p as parse } from "./cynefin-VYW2F7L2-BwTeE-TI.js";
5
- var DEFAULT_PACKET_CONFIG = defaultConfig_default.packet;
6
- var PacketDB = class {
7
- constructor() {
8
- this.packet = [];
9
- this.setAccTitle = setAccTitle;
10
- this.getAccTitle = getAccTitle;
11
- this.setDiagramTitle = setDiagramTitle;
12
- this.getDiagramTitle = getDiagramTitle;
13
- this.getAccDescription = getAccDescription;
14
- this.setAccDescription = setAccDescription;
15
- }
16
- static {
17
- __name(this, "PacketDB");
18
- }
19
- getConfig() {
20
- const config = cleanAndMerge({
21
- ...DEFAULT_PACKET_CONFIG,
22
- ...getConfig().packet
23
- });
24
- if (config.showBits) {
25
- config.paddingY += 10;
26
- }
27
- return config;
28
- }
29
- getPacket() {
30
- return this.packet;
31
- }
32
- pushWord(word) {
33
- if (word.length > 0) {
34
- this.packet.push(word);
35
- }
36
- }
37
- clear() {
38
- clear();
39
- this.packet = [];
40
- }
41
- };
42
- var maxPacketSize = 1e4;
43
- var populate = /* @__PURE__ */ __name((ast, db) => {
44
- populateCommonDb(ast, db);
45
- let lastBit = -1;
46
- let word = [];
47
- let row = 1;
48
- const { bitsPerRow } = db.getConfig();
49
- for (let { start, end, bits, label } of ast.blocks) {
50
- if (start !== void 0 && end !== void 0 && end < start) {
51
- throw new Error(`Packet block ${start} - ${end} is invalid. End must be greater than start.`);
52
- }
53
- start ??= lastBit + 1;
54
- if (start !== lastBit + 1) {
55
- throw new Error(
56
- `Packet block ${start} - ${end ?? start} is not contiguous. It should start from ${lastBit + 1}.`
57
- );
58
- }
59
- if (bits === 0) {
60
- throw new Error(`Packet block ${start} is invalid. Cannot have a zero bit field.`);
61
- }
62
- end ??= start + (bits ?? 1) - 1;
63
- bits ??= end - start + 1;
64
- lastBit = end;
65
- log.debug(`Packet block ${start} - ${lastBit} with label ${label}`);
66
- while (word.length <= bitsPerRow + 1 && db.getPacket().length < maxPacketSize) {
67
- const [block, nextBlock] = getNextFittingBlock({ start, end, bits, label }, row, bitsPerRow);
68
- word.push(block);
69
- if (block.end + 1 === row * bitsPerRow) {
70
- db.pushWord(word);
71
- word = [];
72
- row++;
73
- }
74
- if (!nextBlock) {
75
- break;
76
- }
77
- ({ start, end, bits, label } = nextBlock);
78
- }
79
- }
80
- db.pushWord(word);
81
- }, "populate");
82
- var getNextFittingBlock = /* @__PURE__ */ __name((block, row, bitsPerRow) => {
83
- if (block.start === void 0) {
84
- throw new Error("start should have been set during first phase");
85
- }
86
- if (block.end === void 0) {
87
- throw new Error("end should have been set during first phase");
88
- }
89
- if (block.start > block.end) {
90
- throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);
91
- }
92
- if (block.end + 1 <= row * bitsPerRow) {
93
- return [block, void 0];
94
- }
95
- const rowEnd = row * bitsPerRow - 1;
96
- const rowStart = row * bitsPerRow;
97
- return [
98
- {
99
- start: block.start,
100
- end: rowEnd,
101
- label: block.label,
102
- bits: rowEnd - block.start
103
- },
104
- {
105
- start: rowStart,
106
- end: block.end,
107
- label: block.label,
108
- bits: block.end - rowStart
109
- }
110
- ];
111
- }, "getNextFittingBlock");
112
- var parser = {
113
- // @ts-expect-error - PacketDB is not assignable to DiagramDB
114
- parser: { yy: void 0 },
115
- parse: /* @__PURE__ */ __name(async (input) => {
116
- const ast = await parse("packet", input);
117
- const db = parser.parser?.yy;
118
- if (!(db instanceof PacketDB)) {
119
- throw new Error(
120
- "parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
121
- );
122
- }
123
- log.debug(ast);
124
- populate(ast, db);
125
- }, "parse")
126
- };
127
- var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
128
- const db = diagram2.db;
129
- const config = db.getConfig();
130
- const { rowHeight, paddingY, bitWidth, bitsPerRow } = config;
131
- const words = db.getPacket();
132
- const title = db.getDiagramTitle();
133
- const totalRowHeight = rowHeight + paddingY;
134
- const svgHeight = totalRowHeight * (words.length + 1) - (title ? 0 : rowHeight);
135
- const svgWidth = bitWidth * bitsPerRow + 2;
136
- const svg = selectSvgElement(id);
137
- svg.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
138
- configureSvgSize(svg, svgHeight, svgWidth, config.useMaxWidth);
139
- for (const [word, packet] of words.entries()) {
140
- drawWord(svg, packet, word, config);
141
- }
142
- svg.append("text").text(title).attr("x", svgWidth / 2).attr("y", svgHeight - totalRowHeight / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle");
143
- }, "draw");
144
- var drawWord = /* @__PURE__ */ __name((svg, word, rowNumber, { rowHeight, paddingX, paddingY, bitWidth, bitsPerRow, showBits }) => {
145
- const group = svg.append("g");
146
- const wordY = rowNumber * (rowHeight + paddingY) + paddingY;
147
- for (const block of word) {
148
- const blockX = block.start % bitsPerRow * bitWidth + 1;
149
- const width = (block.end - block.start + 1) * bitWidth - paddingX;
150
- group.append("rect").attr("x", blockX).attr("y", wordY).attr("width", width).attr("height", rowHeight).attr("class", "packetBlock");
151
- group.append("text").attr("x", blockX + width / 2).attr("y", wordY + rowHeight / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(block.label);
152
- if (!showBits) {
153
- continue;
154
- }
155
- const isSingleBlock = block.end === block.start;
156
- const bitNumberY = wordY - 2;
157
- group.append("text").attr("x", blockX + (isSingleBlock ? width / 2 : 0)).attr("y", bitNumberY).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", isSingleBlock ? "middle" : "start").text(block.start);
158
- if (!isSingleBlock) {
159
- group.append("text").attr("x", blockX + width).attr("y", bitNumberY).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(block.end);
160
- }
161
- }
162
- }, "drawWord");
163
- var renderer = { draw };
164
- var defaultPacketStyleOptions = {
165
- byteFontSize: "10px",
166
- startByteColor: "black",
167
- endByteColor: "black",
168
- labelColor: "black",
169
- labelFontSize: "12px",
170
- titleColor: "black",
171
- titleFontSize: "14px",
172
- blockStrokeColor: "black",
173
- blockStrokeWidth: "1",
174
- blockFillColor: "#efefef"
175
- };
176
- var styles = /* @__PURE__ */ __name(({ packet } = {}) => {
177
- const options = cleanAndMerge(defaultPacketStyleOptions, packet);
178
- return `
179
- .packetByte {
180
- font-size: ${options.byteFontSize};
181
- }
182
- .packetByte.start {
183
- fill: ${options.startByteColor};
184
- }
185
- .packetByte.end {
186
- fill: ${options.endByteColor};
187
- }
188
- .packetLabel {
189
- fill: ${options.labelColor};
190
- font-size: ${options.labelFontSize};
191
- }
192
- .packetTitle {
193
- fill: ${options.titleColor};
194
- font-size: ${options.titleFontSize};
195
- }
196
- .packetBlock {
197
- stroke: ${options.blockStrokeColor};
198
- stroke-width: ${options.blockStrokeWidth};
199
- fill: ${options.blockFillColor};
200
- }
201
- `;
202
- }, "styles");
203
- var diagram = {
204
- parser,
205
- get db() {
206
- return new PacketDB();
207
- },
208
- renderer,
209
- styles
210
- };
211
- export {
212
- diagram
213
- };
@@ -1,489 +0,0 @@
1
- #!/usr/bin/env node
2
- import { I as ImperativeState } from "./chunk-2Q5K7J3B-DIJkMPWD.js";
3
- import { p as populateCommonDb } from "./chunk-JWPE2WC7-XiIefccF.js";
4
- import { n as setDiagramTitle, b as setAccTitle, s as setAccDescription, o as getDiagramTitle, g as getAccDescription, a as getAccTitle, _ as __name, A as cleanAndMerge, l as log, D as selectSvgElement, e as configureSvgSize, y as getConfig, p as clear, i as sanitizeText, ai as getIconSVG, B as defaultConfig_default, aj as registerIconPacks } from "./mermaid.core-Dy_tFRs7.js";
5
- import { p as parse } from "./cynefin-VYW2F7L2-BwTeE-TI.js";
6
- var ALL_BOX_CHARS = /[─━│┃└┗├┣]/;
7
- var BRANCH_CHAR = /[└┗├┣]/;
8
- var DASH_CHAR = /[─━]/;
9
- var DECORATION_ONLY = /^[\s│┃]+$/;
10
- var METADATA_LINE = /^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/;
11
- var COMMENT_LINE = /^\s*%%/;
12
- var INDENT_UNIT = " ";
13
- function isBoxDrawingFormat(lines) {
14
- return lines.some((line) => ALL_BOX_CHARS.test(line));
15
- }
16
- __name(isBoxDrawingFormat, "isBoxDrawingFormat");
17
- function inferSegmentWidth(contentLines) {
18
- for (const line of contentLines) {
19
- const match = BRANCH_CHAR.exec(line);
20
- if (match?.index && match.index > 0) {
21
- return match.index;
22
- }
23
- }
24
- return 4;
25
- }
26
- __name(inferSegmentWidth, "inferSegmentWidth");
27
- function remapErrorLines(message, lineMap) {
28
- return message.replace(/\bline\s+(\d+)\b/gi, (match, lineStr) => {
29
- const line = parseInt(lineStr, 10);
30
- const original = lineMap.get(line);
31
- return original ? `line ${original}` : match;
32
- });
33
- }
34
- __name(remapErrorLines, "remapErrorLines");
35
- function preprocessBoxDrawing(input) {
36
- const lines = input.split("\n");
37
- const lineMap = /* @__PURE__ */ new Map();
38
- let keywordIdx = -1;
39
- for (const [i, line] of lines.entries()) {
40
- if (line.trim() === "treeView-beta") {
41
- keywordIdx = i;
42
- break;
43
- }
44
- }
45
- if (keywordIdx === -1) {
46
- return { text: input, lineMap };
47
- }
48
- const contentLineTexts = [];
49
- for (let i = keywordIdx + 1; i < lines.length; i++) {
50
- const line = lines[i];
51
- const trimmed = line.trim();
52
- if (trimmed === "" || COMMENT_LINE.test(line) || METADATA_LINE.test(line)) {
53
- continue;
54
- }
55
- if (DECORATION_ONLY.test(line)) {
56
- continue;
57
- }
58
- contentLineTexts.push(line.replace(/\t/g, " "));
59
- }
60
- if (!isBoxDrawingFormat(contentLineTexts)) {
61
- return { text: input, lineMap };
62
- }
63
- const segmentWidth = inferSegmentWidth(contentLineTexts);
64
- const outputLines = [];
65
- let outLineNo = 0;
66
- for (let i = 0; i <= keywordIdx; i++) {
67
- outputLines.push(lines[i]);
68
- outLineNo++;
69
- lineMap.set(outLineNo, i + 1);
70
- }
71
- for (let i = keywordIdx + 1; i < lines.length; i++) {
72
- const line = lines[i];
73
- const trimmed = line.trim();
74
- const origLineNo = i + 1;
75
- if (trimmed === "") {
76
- outputLines.push(line);
77
- outLineNo++;
78
- lineMap.set(outLineNo, origLineNo);
79
- continue;
80
- }
81
- if (COMMENT_LINE.test(line)) {
82
- outputLines.push(line);
83
- outLineNo++;
84
- lineMap.set(outLineNo, origLineNo);
85
- continue;
86
- }
87
- if (METADATA_LINE.test(line)) {
88
- outputLines.push(line);
89
- outLineNo++;
90
- lineMap.set(outLineNo, origLineNo);
91
- continue;
92
- }
93
- if (DECORATION_ONLY.test(line)) {
94
- continue;
95
- }
96
- const normalized = line.replace(/\t/g, " ");
97
- const branchMatch = BRANCH_CHAR.exec(normalized);
98
- if (branchMatch?.index !== void 0) {
99
- const branchCol = branchMatch.index;
100
- const depth = Math.round(branchCol / segmentWidth) + 1;
101
- let pos = branchCol + 1;
102
- while (pos < normalized.length && DASH_CHAR.test(normalized[pos])) {
103
- pos++;
104
- }
105
- while (pos < normalized.length && normalized[pos] === " ") {
106
- pos++;
107
- }
108
- const content = normalized.slice(pos).trimEnd();
109
- if (!content) {
110
- throw new Error(
111
- `Line ${origLineNo}: Empty node — expected a filename or directory name after the box-drawing prefix`
112
- );
113
- }
114
- const indent = INDENT_UNIT.repeat(depth);
115
- outputLines.push(indent + content);
116
- outLineNo++;
117
- lineMap.set(outLineNo, origLineNo);
118
- } else if (/^[\s─━│┃└┗├┣]+$/.test(normalized)) {
119
- continue;
120
- } else if (ALL_BOX_CHARS.test(normalized)) {
121
- outputLines.push(line);
122
- outLineNo++;
123
- lineMap.set(outLineNo, origLineNo);
124
- } else if (/^\s+/.test(normalized)) {
125
- throw new Error(
126
- `Line ${origLineNo}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`
127
- );
128
- } else {
129
- outputLines.push(line);
130
- outLineNo++;
131
- lineMap.set(outLineNo, origLineNo);
132
- }
133
- }
134
- return { text: outputLines.join("\n"), lineMap };
135
- }
136
- __name(preprocessBoxDrawing, "preprocessBoxDrawing");
137
- var state = new ImperativeState(() => ({
138
- cnt: 1,
139
- stack: [
140
- {
141
- id: 0,
142
- level: -1,
143
- name: "/",
144
- nodeType: "directory",
145
- children: []
146
- }
147
- ]
148
- }));
149
- var clear2 = /* @__PURE__ */ __name(() => {
150
- state.reset();
151
- clear();
152
- }, "clear");
153
- var getRoot = /* @__PURE__ */ __name(() => {
154
- return state.records.stack[0];
155
- }, "getRoot");
156
- var getCount = /* @__PURE__ */ __name(() => state.records.cnt, "getCount");
157
- var defaultConfig = defaultConfig_default.treeView;
158
- var getConfig2 = /* @__PURE__ */ __name(() => {
159
- return cleanAndMerge(defaultConfig, getConfig().treeView);
160
- }, "getConfig");
161
- var addNode = /* @__PURE__ */ __name((level, name, nodeType, cssClass, icon, description) => {
162
- while (level <= state.records.stack[state.records.stack.length - 1].level) {
163
- state.records.stack.pop();
164
- }
165
- const node = {
166
- id: state.records.cnt++,
167
- level,
168
- name,
169
- nodeType,
170
- icon,
171
- cssClass,
172
- description,
173
- children: []
174
- };
175
- state.records.stack[state.records.stack.length - 1].children.push(node);
176
- state.records.stack.push(node);
177
- }, "addNode");
178
- var db = {
179
- clear: clear2,
180
- addNode,
181
- getRoot,
182
- getCount,
183
- getConfig: getConfig2,
184
- getAccTitle,
185
- getAccDescription,
186
- getDiagramTitle,
187
- setAccDescription,
188
- setAccTitle,
189
- setDiagramTitle
190
- };
191
- var db_default = db;
192
- var populate = /* @__PURE__ */ __name((ast) => {
193
- populateCommonDb(ast, db_default);
194
- for (const node of ast.nodes) {
195
- const level = typeof node.indent === "number" ? node.indent : 0;
196
- let name = node.name;
197
- const isDirectory = name.endsWith("/");
198
- if (isDirectory) {
199
- name = name.slice(0, -1);
200
- }
201
- const nodeType = isDirectory ? "directory" : "file";
202
- const cssClass = node.classAnnotation || void 0;
203
- const rawIcon = node.iconAnnotation;
204
- const icon = rawIcon !== void 0 ? rawIcon || "none" : void 0;
205
- const rawDesc = node.descAnnotation || void 0;
206
- const description = rawDesc ? sanitizeText(rawDesc, getConfig()) : void 0;
207
- db_default.addNode(level, name, nodeType, cssClass, icon, description);
208
- }
209
- }, "populate");
210
- var parser = {
211
- parse: /* @__PURE__ */ __name(async (input) => {
212
- const { text, lineMap } = preprocessBoxDrawing(input);
213
- try {
214
- const ast = await parse("treeView", text);
215
- log.debug(ast);
216
- populate(ast);
217
- } catch (error) {
218
- if (lineMap.size > 0 && error instanceof Error) {
219
- error.message = remapErrorLines(error.message, lineMap);
220
- }
221
- throw error;
222
- }
223
- }, "parse")
224
- };
225
- var treeViewIcons = {
226
- prefix: "mermaid-treeview",
227
- height: 24,
228
- width: 24,
229
- icons: {
230
- folder: {
231
- body: '<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'
232
- },
233
- file: {
234
- body: '<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'
235
- }
236
- }
237
- };
238
- function detectIcon(name, config) {
239
- const filenameIcon = config?.filenameIcons?.[name];
240
- if (filenameIcon) {
241
- return filenameIcon;
242
- }
243
- const dotIdx = name.lastIndexOf(".");
244
- if (dotIdx > 0) {
245
- const ext = name.substring(dotIdx).toLowerCase();
246
- const extensionIcons = config?.extensionIcons;
247
- return extensionIcons?.[ext] ?? extensionIcons?.[ext.slice(1)];
248
- }
249
- return void 0;
250
- }
251
- __name(detectIcon, "detectIcon");
252
- function qualifyIcon(icon, defaultIconPack) {
253
- if (icon.includes(":")) {
254
- return icon;
255
- }
256
- if (icon in treeViewIcons.icons || !defaultIconPack) {
257
- return `${treeViewIcons.prefix}:${icon}`;
258
- }
259
- return `${defaultIconPack}:${icon}`;
260
- }
261
- __name(qualifyIcon, "qualifyIcon");
262
- function getNodeIcon(node, config) {
263
- if (node.icon === "none") {
264
- return void 0;
265
- }
266
- if (node.icon) {
267
- return qualifyIcon(node.icon, config.defaultIconPack);
268
- }
269
- if (!config.showIcons) {
270
- return void 0;
271
- }
272
- if (node.nodeType === "file") {
273
- const detected = detectIcon(node.name, config);
274
- if (detected === "none") {
275
- return void 0;
276
- }
277
- if (detected) {
278
- return qualifyIcon(detected, config.defaultIconPack);
279
- }
280
- }
281
- return `${treeViewIcons.prefix}:${node.nodeType === "directory" ? "folder" : "file"}`;
282
- }
283
- __name(getNodeIcon, "getNodeIcon");
284
- registerIconPacks([
285
- {
286
- name: treeViewIcons.prefix,
287
- icons: treeViewIcons
288
- }
289
- ]);
290
- var ICON_SIZE = 14;
291
- var ICON_GAP = 4;
292
- var DESC_GAP = 16;
293
- var iconSymbolId = /* @__PURE__ */ __name((diagramId, icon) => `tv-icon-${diagramId}-${icon.replace(/[^\w-]/g, "-")}`, "iconSymbolId");
294
- var injectIconDefs = /* @__PURE__ */ __name(async (svg, root, config, diagramId) => {
295
- const usedIcons = /* @__PURE__ */ new Set();
296
- const collect = /* @__PURE__ */ __name((node) => {
297
- const icon = getNodeIcon(node, config);
298
- if (icon) {
299
- usedIcons.add(icon);
300
- }
301
- node.children.forEach(collect);
302
- }, "collect");
303
- collect(root);
304
- if (usedIcons.size === 0) {
305
- return;
306
- }
307
- const iconSVGs = await Promise.all(
308
- [...usedIcons].map(async (icon) => ({
309
- icon,
310
- svg: await getIconSVG(icon, {
311
- height: ICON_SIZE,
312
- width: ICON_SIZE
313
- })
314
- }))
315
- );
316
- const defs = svg.append("defs");
317
- for (const { icon, svg: iconSVG } of iconSVGs) {
318
- defs.append("g").attr("id", iconSymbolId(diagramId, icon)).html(iconSVG);
319
- }
320
- }, "injectIconDefs");
321
- var positionLabel = /* @__PURE__ */ __name((x, y, node, domElem, config, diagramId) => {
322
- const nodeGroup = domElem.append("g");
323
- let cssClasses = "treeView-node-label";
324
- if (node.nodeType === "directory") {
325
- cssClasses += " treeView-node-dir";
326
- }
327
- if (node.cssClass) {
328
- cssClasses += ` ${node.cssClass}`;
329
- }
330
- const iconOffset = ICON_SIZE + ICON_GAP;
331
- const icon = getNodeIcon(node, config);
332
- const showIcon = icon !== void 0;
333
- if (icon) {
334
- nodeGroup.append("use").attr("xlink:href", `#${iconSymbolId(diagramId, icon)}`).attr("x", x + config.paddingX).attr("y", y + config.paddingY).attr("class", "treeView-node-icon");
335
- }
336
- const label = nodeGroup.append("text").text(node.name).attr("dominant-baseline", "middle").attr("class", cssClasses);
337
- const { height: labelHeight, width: labelWidth } = label.node().getBBox();
338
- const height = labelHeight + config.paddingY * 2;
339
- const labelX = x + config.paddingX + (showIcon ? iconOffset : 0);
340
- label.attr("x", labelX);
341
- label.attr("y", y + height / 2);
342
- const labelRightEdge = labelX + labelWidth;
343
- const width = labelWidth + config.paddingX * 2 + (showIcon ? iconOffset : 0);
344
- node.BBox = { x, y, width, height };
345
- if (node.cssClass?.split(/\s+/).includes("highlight")) {
346
- nodeGroup.insert("rect", ":first-child").attr("x", x).attr("y", y + 1).attr("width", 0).attr("height", height - 2).attr("rx", 3).attr("class", "treeView-highlight-bg");
347
- }
348
- return { node, nodeGroup, labelRightEdge, centerY: y + height / 2 };
349
- }, "positionLabel");
350
- var positionLine = /* @__PURE__ */ __name((domElem, x1, y1, x2, y2, lineThickness) => {
351
- return domElem.append("line").attr("x1", x1).attr("y1", y1).attr("x2", x2).attr("y2", y2).attr("stroke-width", lineThickness).attr("class", "treeView-node-line");
352
- }, "positionLine");
353
- var drawTree = /* @__PURE__ */ __name((elem, root, config, diagramId) => {
354
- let totalHeight = 0;
355
- let totalWidth = 0;
356
- const renderInfos = [];
357
- const drawNode = /* @__PURE__ */ __name((elem2, node, config2, depth) => {
358
- const indent = depth * (config2.rowIndent + config2.paddingX);
359
- const info = positionLabel(indent, totalHeight, node, elem2, config2, diagramId);
360
- renderInfos.push(info);
361
- const { height, width } = node.BBox;
362
- positionLine(
363
- elem2,
364
- indent - config2.rowIndent,
365
- totalHeight + height / 2,
366
- indent,
367
- totalHeight + height / 2,
368
- config2.lineThickness
369
- );
370
- totalWidth = Math.max(totalWidth, indent + width);
371
- totalHeight += height;
372
- }, "drawNode");
373
- const processNode = /* @__PURE__ */ __name((node, depth = 0) => {
374
- drawNode(elem, node, config, depth);
375
- node.children.forEach((child) => {
376
- processNode(child, depth + 1);
377
- });
378
- const { x, y, height } = node.BBox;
379
- if (node.children.length) {
380
- const { y: endY, height: endHeight } = node.children[node.children.length - 1].BBox;
381
- positionLine(
382
- elem,
383
- x + config.paddingX,
384
- y + height,
385
- x + config.paddingX,
386
- endY + endHeight / 2 + config.lineThickness / 2,
387
- config.lineThickness
388
- );
389
- }
390
- }, "processNode");
391
- processNode(root);
392
- const nodesWithDesc = renderInfos.filter((ri) => ri.node.description);
393
- if (nodesWithDesc.length > 0) {
394
- const maxLabelRight = Math.max(...renderInfos.map((ri) => ri.labelRightEdge));
395
- const descX = maxLabelRight + DESC_GAP;
396
- for (const ri of nodesWithDesc) {
397
- const desc = ri.nodeGroup.append("text").text(ri.node.description).attr("dominant-baseline", "middle").attr("class", "treeView-node-description").attr("x", descX).attr("y", ri.centerY);
398
- const descBBox = desc.node().getBBox();
399
- totalWidth = Math.max(totalWidth, descX + descBBox.width + config.paddingX);
400
- }
401
- }
402
- for (const ri of renderInfos) {
403
- if (ri.node.cssClass?.split(/\s+/).includes("highlight")) {
404
- const rect = ri.nodeGroup.select(".treeView-highlight-bg");
405
- if (!rect.empty()) {
406
- const rectWidth = totalWidth - ri.node.BBox.x + 8;
407
- rect.attr("width", rectWidth);
408
- totalWidth = Math.max(totalWidth, ri.node.BBox.x + rectWidth + 2);
409
- }
410
- }
411
- }
412
- return { totalHeight, totalWidth };
413
- }, "drawTree");
414
- var draw = /* @__PURE__ */ __name(async (text, id, _ver, diagObj) => {
415
- log.debug("Rendering treeView diagram\n" + text);
416
- const db2 = diagObj.db;
417
- const root = db2.getRoot();
418
- const config = db2.getConfig();
419
- const svg = selectSvgElement(id);
420
- await injectIconDefs(svg, root, config, id);
421
- const treeElem = svg.append("g");
422
- treeElem.attr("class", "tree-view");
423
- const { totalHeight, totalWidth } = drawTree(treeElem, root, config, id);
424
- svg.attr("viewBox", `-${config.lineThickness / 2} 0 ${totalWidth} ${totalHeight}`);
425
- configureSvgSize(svg, totalHeight, totalWidth, config.useMaxWidth);
426
- }, "draw");
427
- var renderer = {
428
- draw
429
- };
430
- var renderer_default = renderer;
431
- var defaultTreeViewDiagramStyles = {
432
- labelFontSize: "16px",
433
- labelColor: "black",
434
- lineColor: "black",
435
- iconColor: "#546e7a",
436
- descriptionColor: "#6a9955",
437
- highlightBg: "rgba(255, 193, 7, 0.15)",
438
- highlightStroke: "#ffc107"
439
- };
440
- var styles = /* @__PURE__ */ __name(({
441
- treeView
442
- }) => {
443
- const {
444
- labelFontSize,
445
- labelColor,
446
- lineColor,
447
- iconColor,
448
- descriptionColor,
449
- highlightBg,
450
- highlightStroke
451
- } = cleanAndMerge(defaultTreeViewDiagramStyles, treeView);
452
- return `
453
- .treeView-node-label {
454
- font-size: ${labelFontSize};
455
- fill: ${labelColor};
456
- white-space: pre;
457
- }
458
- .treeView-node-dir {
459
- font-weight: bold;
460
- }
461
- .treeView-node-line {
462
- stroke: ${lineColor};
463
- }
464
- .treeView-node-icon {
465
- color: ${iconColor};
466
- }
467
- .treeView-node-description {
468
- font-size: ${labelFontSize};
469
- fill: ${descriptionColor};
470
- font-style: italic;
471
- white-space: pre;
472
- }
473
- .treeView-highlight-bg {
474
- fill: ${highlightBg};
475
- stroke: ${highlightStroke};
476
- stroke-width: 1;
477
- }
478
- `;
479
- }, "styles");
480
- var styles_default = styles;
481
- var diagram = {
482
- db: db_default,
483
- renderer: renderer_default,
484
- parser,
485
- styles: styles_default
486
- };
487
- export {
488
- diagram
489
- };