zombie-mermaid 2.2.3 → 2.2.6

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 (321) hide show
  1. package/README.md +4 -4
  2. package/dist/ascii.cjs +1 -11
  3. package/dist/ascii.d.cts +1 -167
  4. package/dist/ascii.d.ts +1 -167
  5. package/dist/ascii.js +1 -6591
  6. package/dist/cli.js +836 -10946
  7. package/dist/index.cjs +2 -81
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +42 -680
  10. package/dist/index.d.ts +42 -680
  11. package/dist/index.js +408 -10002
  12. package/dist/index.js.map +1 -1
  13. package/dist/mcp.cjs +1 -17909
  14. package/dist/mcp.d.cts +1 -11
  15. package/dist/mcp.d.ts +1 -11
  16. package/dist/mcp.js +1 -17884
  17. package/package.json +29 -29
  18. package/src/__tests__/workspace-package-boundaries.test.ts +15 -16
  19. package/src/__tests__/xychart-parser-categories.test.ts +78 -0
  20. package/src/ascii-entry.ts +14 -0
  21. package/src/cli/html-viewer.ts +5 -0
  22. package/src/mcp-entry.ts +21 -0
  23. package/dist/ascii.cjs.map +0 -1
  24. package/dist/ascii.js.map +0 -1
  25. package/dist/mcp.cjs.map +0 -1
  26. package/dist/mcp.js.map +0 -1
  27. package/packages/ascii-renderer/LICENSE +0 -22
  28. package/packages/ascii-renderer/src/ansi.ts +0 -490
  29. package/packages/ascii-renderer/src/canvas.ts +0 -658
  30. package/packages/ascii-renderer/src/class-diagram.ts +0 -2001
  31. package/packages/ascii-renderer/src/converter.ts +0 -446
  32. package/packages/ascii-renderer/src/coords.ts +0 -58
  33. package/packages/ascii-renderer/src/display-width.ts +0 -151
  34. package/packages/ascii-renderer/src/draw-arrows.ts +0 -549
  35. package/packages/ascii-renderer/src/draw-boxes.ts +0 -267
  36. package/packages/ascii-renderer/src/draw-bundles.ts +0 -611
  37. package/packages/ascii-renderer/src/draw-lines.ts +0 -174
  38. package/packages/ascii-renderer/src/draw-subgraphs.ts +0 -108
  39. package/packages/ascii-renderer/src/draw.ts +0 -337
  40. package/packages/ascii-renderer/src/edge-bundling.ts +0 -435
  41. package/packages/ascii-renderer/src/edge-cell-styles.ts +0 -81
  42. package/packages/ascii-renderer/src/edge-routing.ts +0 -1049
  43. package/packages/ascii-renderer/src/er-diagram.ts +0 -1488
  44. package/packages/ascii-renderer/src/flowchart.ts +0 -94
  45. package/packages/ascii-renderer/src/grid-occupancy.ts +0 -234
  46. package/packages/ascii-renderer/src/grid.ts +0 -1267
  47. package/packages/ascii-renderer/src/hyperlinks.ts +0 -248
  48. package/packages/ascii-renderer/src/index.ts +0 -163
  49. package/packages/ascii-renderer/src/lane-search.ts +0 -68
  50. package/packages/ascii-renderer/src/multiline-utils.ts +0 -82
  51. package/packages/ascii-renderer/src/pathfinder.ts +0 -448
  52. package/packages/ascii-renderer/src/registry.ts +0 -88
  53. package/packages/ascii-renderer/src/sequence.ts +0 -1318
  54. package/packages/ascii-renderer/src/shapes/circle.ts +0 -31
  55. package/packages/ascii-renderer/src/shapes/corners.ts +0 -273
  56. package/packages/ascii-renderer/src/shapes/diamond.ts +0 -31
  57. package/packages/ascii-renderer/src/shapes/hexagon.ts +0 -31
  58. package/packages/ascii-renderer/src/shapes/index.ts +0 -123
  59. package/packages/ascii-renderer/src/shapes/rectangle.ts +0 -199
  60. package/packages/ascii-renderer/src/shapes/rounded.ts +0 -31
  61. package/packages/ascii-renderer/src/shapes/special.ts +0 -352
  62. package/packages/ascii-renderer/src/shapes/stadium.ts +0 -122
  63. package/packages/ascii-renderer/src/shapes/state.ts +0 -204
  64. package/packages/ascii-renderer/src/shapes/types.ts +0 -78
  65. package/packages/ascii-renderer/src/territory.ts +0 -136
  66. package/packages/ascii-renderer/src/types.ts +0 -454
  67. package/packages/ascii-renderer/src/validate.ts +0 -189
  68. package/packages/ascii-renderer/src/xychart.ts +0 -1085
  69. package/packages/core/LICENSE +0 -22
  70. package/packages/core/src/click-directive.ts +0 -106
  71. package/packages/core/src/color-utils.ts +0 -205
  72. package/packages/core/src/diagram-type.ts +0 -35
  73. package/packages/core/src/direction-override.ts +0 -46
  74. package/packages/core/src/direction.ts +0 -56
  75. package/packages/core/src/index.ts +0 -34
  76. package/packages/core/src/init-directive.ts +0 -248
  77. package/packages/core/src/multiline-utils.ts +0 -275
  78. package/packages/core/src/statements.ts +0 -197
  79. package/packages/core/src/style-directives.ts +0 -214
  80. package/packages/core/src/text-metrics.ts +0 -498
  81. package/packages/core/src/theme.ts +0 -696
  82. package/packages/core/src/types.ts +0 -670
  83. package/packages/mcp/LICENSE +0 -22
  84. package/packages/mcp/src/index.ts +0 -17
  85. package/packages/mcp/src/server.ts +0 -135
  86. package/packages/mcp/src/tools/check-sequence-activations.ts +0 -91
  87. package/packages/mcp/src/tools/fix-sequence-activations.ts +0 -77
  88. package/packages/mcp/src/tools/render-ascii.ts +0 -99
  89. package/packages/mcp/src/tools/render-svg.ts +0 -95
  90. package/packages/mermaid-parser/LICENSE +0 -22
  91. package/packages/mermaid-parser/src/class/format.ts +0 -15
  92. package/packages/mermaid-parser/src/class/parser.ts +0 -593
  93. package/packages/mermaid-parser/src/class/types.ts +0 -166
  94. package/packages/mermaid-parser/src/er/parser.ts +0 -286
  95. package/packages/mermaid-parser/src/er/types.ts +0 -99
  96. package/packages/mermaid-parser/src/expanded-shapes.ts +0 -376
  97. package/packages/mermaid-parser/src/index.ts +0 -48
  98. package/packages/mermaid-parser/src/sequence/activation-check.ts +0 -149
  99. package/packages/mermaid-parser/src/sequence/activation-fix.ts +0 -112
  100. package/packages/mermaid-parser/src/sequence/box-color.ts +0 -85
  101. package/packages/mermaid-parser/src/sequence/parser.ts +0 -613
  102. package/packages/mermaid-parser/src/sequence/types.ts +0 -242
  103. package/packages/mermaid-parser/src/xychart/colors.ts +0 -177
  104. package/packages/mermaid-parser/src/xychart/parser.ts +0 -203
  105. package/packages/mermaid-parser/src/xychart/types.ts +0 -150
  106. package/packages/svg-renderer/LICENSE +0 -22
  107. package/packages/svg-renderer/src/class/layout.ts +0 -360
  108. package/packages/svg-renderer/src/class/renderer.ts +0 -636
  109. package/packages/svg-renderer/src/edge-curves.ts +0 -204
  110. package/packages/svg-renderer/src/elk-instance.ts +0 -292
  111. package/packages/svg-renderer/src/er/layout.ts +0 -200
  112. package/packages/svg-renderer/src/er/renderer.ts +0 -493
  113. package/packages/svg-renderer/src/index.ts +0 -58
  114. package/packages/svg-renderer/src/layout-engine/constants.ts +0 -19
  115. package/packages/svg-renderer/src/layout-engine/edge-bundling.ts +0 -379
  116. package/packages/svg-renderer/src/layout-engine/elk-adapter-utils.ts +0 -81
  117. package/packages/svg-renderer/src/layout-engine/elk-graph-builder.ts +0 -240
  118. package/packages/svg-renderer/src/layout-engine/from-elk.ts +0 -685
  119. package/packages/svg-renderer/src/layout-engine/layer-alignment.ts +0 -174
  120. package/packages/svg-renderer/src/layout-engine/to-elk.ts +0 -695
  121. package/packages/svg-renderer/src/layout-engine.ts +0 -74
  122. package/packages/svg-renderer/src/layout.ts +0 -8
  123. package/packages/svg-renderer/src/renderer.ts +0 -1485
  124. package/packages/svg-renderer/src/resolve-colors.ts +0 -339
  125. package/packages/svg-renderer/src/sequence/layout.ts +0 -698
  126. package/packages/svg-renderer/src/sequence/renderer.ts +0 -546
  127. package/packages/svg-renderer/src/shape-clipping.ts +0 -197
  128. package/packages/svg-renderer/src/styles.ts +0 -118
  129. package/packages/svg-renderer/src/xychart/layout.ts +0 -682
  130. package/packages/svg-renderer/src/xychart/renderer.ts +0 -684
  131. package/src/__tests__/ascii-canvas-write.test.ts +0 -137
  132. package/src/__tests__/ascii-charset-border-junctions.test.ts +0 -63
  133. package/src/__tests__/ascii-cjk-width.test.ts +0 -150
  134. package/src/__tests__/ascii-class-box-occupancy.test.ts +0 -462
  135. package/src/__tests__/ascii-class-column-width-488-489.test.ts +0 -639
  136. package/src/__tests__/ascii-class-cross-level-jog-corruption.test.ts +0 -187
  137. package/src/__tests__/ascii-class-detour-label-routing-487.test.ts +0 -114
  138. package/src/__tests__/ascii-class-diagram-compartments.test.ts +0 -70
  139. package/src/__tests__/ascii-class-label-box-collision.test.ts +0 -60
  140. package/src/__tests__/ascii-class-label-row-collision-531.test.ts +0 -135
  141. package/src/__tests__/ascii-class-label-territory-row-awareness.test.ts +0 -57
  142. package/src/__tests__/ascii-class-padding.test.ts +0 -104
  143. package/src/__tests__/ascii-class-parent-alignment-971.test.ts +0 -139
  144. package/src/__tests__/ascii-class-parent-alignment-972.test.ts +0 -208
  145. package/src/__tests__/ascii-class-reciprocal-relationships-448.test.ts +0 -169
  146. package/src/__tests__/ascii-combining-mark-width.test.ts +0 -70
  147. package/src/__tests__/ascii-coords-overlay.test.ts +0 -64
  148. package/src/__tests__/ascii-decision-lr-box-start.test.ts +0 -106
  149. package/src/__tests__/ascii-display-width-unit.test.ts +0 -154
  150. package/src/__tests__/ascii-draw-arrows-coverage.test.ts +0 -171
  151. package/src/__tests__/ascii-draw-arrows-single-point-path.test.ts +0 -112
  152. package/src/__tests__/ascii-edge-bundling-rank-violation-454.test.ts +0 -72
  153. package/src/__tests__/ascii-edge-ending-glyphs.test.ts +0 -206
  154. package/src/__tests__/ascii-edge-label-diagonal-fallback-418.test.ts +0 -95
  155. package/src/__tests__/ascii-edge-routing-fixes.test.ts +0 -178
  156. package/src/__tests__/ascii-edge-routing-single-point-path.test.ts +0 -107
  157. package/src/__tests__/ascii-edge-styles.test.ts +0 -149
  158. package/src/__tests__/ascii-emoji-cluster-width.test.ts +0 -101
  159. package/src/__tests__/ascii-er-box-occupancy.test.ts +0 -251
  160. package/src/__tests__/ascii-er-cardinality.test.ts +0 -40
  161. package/src/__tests__/ascii-er-corner-glyphs.test.ts +0 -249
  162. package/src/__tests__/ascii-er-jog-stray-line.test.ts +0 -111
  163. package/src/__tests__/ascii-er-label-padding.test.ts +0 -118
  164. package/src/__tests__/ascii-er-padding.test.ts +0 -114
  165. package/src/__tests__/ascii-er-relationship-label-corruption-350.test.ts +0 -458
  166. package/src/__tests__/ascii-er-relationship-overwrite.test.ts +0 -325
  167. package/src/__tests__/ascii-er-stray-connectors.test.ts +0 -347
  168. package/src/__tests__/ascii-er-unrelated-stem-separation-411.test.ts +0 -98
  169. package/src/__tests__/ascii-er-vertical-one-marker.test.ts +0 -110
  170. package/src/__tests__/ascii-label-line-terminal-fallback.test.ts +0 -172
  171. package/src/__tests__/ascii-lane-search.test.ts +0 -207
  172. package/src/__tests__/ascii-multibox-cjk-width.test.ts +0 -184
  173. package/src/__tests__/ascii-multiline.test.ts +0 -291
  174. package/src/__tests__/ascii-padding-edge-cases.test.ts +0 -154
  175. package/src/__tests__/ascii-pathfinder-route-edge.test.ts +0 -194
  176. package/src/__tests__/ascii-sequence-alt-else-label.test.ts +0 -236
  177. package/src/__tests__/ascii-sequence-block-wall-clearance.test.ts +0 -217
  178. package/src/__tests__/ascii-sequence-box-group.test.ts +0 -159
  179. package/src/__tests__/ascii-sequence-cjk-width.test.ts +0 -235
  180. package/src/__tests__/ascii-sequence-create-destroy.test.ts +0 -114
  181. package/src/__tests__/ascii-sequence-form-invariants.test.ts +0 -432
  182. package/src/__tests__/ascii-sequence-mermaid-parity.test.ts +0 -219
  183. package/src/__tests__/ascii-sequence-notes.test.ts +0 -61
  184. package/src/__tests__/ascii-sequence-padding.test.ts +0 -119
  185. package/src/__tests__/ascii-sequence-self-arrow.test.ts +0 -206
  186. package/src/__tests__/ascii-shape-diamond.test.ts +0 -38
  187. package/src/__tests__/ascii-shape-rectangle.test.ts +0 -258
  188. package/src/__tests__/ascii-shape-rounded.test.ts +0 -36
  189. package/src/__tests__/ascii-shapes-circle.test.ts +0 -41
  190. package/src/__tests__/ascii-shapes-hexagon.test.ts +0 -42
  191. package/src/__tests__/ascii-shapes-special.test.ts +0 -349
  192. package/src/__tests__/ascii-shapes-stadium.test.ts +0 -217
  193. package/src/__tests__/ascii-shapes-state.test.ts +0 -234
  194. package/src/__tests__/ascii-state-bidirectional-label-swap-530.test.ts +0 -130
  195. package/src/__tests__/ascii-subgraph-direction-honored-445.test.ts +0 -90
  196. package/src/__tests__/ascii-subgraph-label-border-clip.test.ts +0 -152
  197. package/src/__tests__/ascii-subgraph-title-padding.test.ts +0 -77
  198. package/src/__tests__/ascii-territory-unit.test.ts +0 -219
  199. package/src/__tests__/ascii-validate.test.ts +0 -220
  200. package/src/__tests__/ascii.test.ts +0 -328
  201. package/src/__tests__/box-color.test.ts +0 -80
  202. package/src/__tests__/class-arrow-directions.test.ts +0 -505
  203. package/src/__tests__/click-directive.test.ts +0 -63
  204. package/src/__tests__/color-utils.test.ts +0 -186
  205. package/src/__tests__/diagram-type.test.ts +0 -28
  206. package/src/__tests__/draw-lines.test.ts +0 -93
  207. package/src/__tests__/edge-cell-styles.test.ts +0 -180
  208. package/src/__tests__/elk-adapter-utils.test.ts +0 -166
  209. package/src/__tests__/grid-occupancy.test.ts +0 -240
  210. package/src/__tests__/helpers/ascii-form.ts +0 -142
  211. package/src/__tests__/helpers/terminal-display-width.ts +0 -74
  212. package/src/__tests__/mcp-check-sequence-activations-tool.test.ts +0 -85
  213. package/src/__tests__/mcp-fix-sequence-activations-tool.test.ts +0 -134
  214. package/src/__tests__/mcp-server.test.ts +0 -163
  215. package/src/__tests__/pathfinder.test.ts +0 -246
  216. package/src/__tests__/sequence-activation-fix.test.ts +0 -91
  217. package/src/__tests__/testdata/ascii/ampersand_lhs.txt +0 -18
  218. package/src/__tests__/testdata/ascii/ampersand_lhs_and_rhs.txt +0 -18
  219. package/src/__tests__/testdata/ascii/ampersand_rhs.txt +0 -18
  220. package/src/__tests__/testdata/ascii/ampersand_td_fanin.txt +0 -18
  221. package/src/__tests__/testdata/ascii/ampersand_td_fanout.txt +0 -18
  222. package/src/__tests__/testdata/ascii/ampersand_without_edge.txt +0 -18
  223. package/src/__tests__/testdata/ascii/back_reference_from_child.txt +0 -10
  224. package/src/__tests__/testdata/ascii/backlink_from_bottom.txt +0 -22
  225. package/src/__tests__/testdata/ascii/backlink_from_top.txt +0 -22
  226. package/src/__tests__/testdata/ascii/backlink_with_short_y_padding.txt +0 -20
  227. package/src/__tests__/testdata/ascii/cls_all_relationships.txt +0 -19
  228. package/src/__tests__/testdata/ascii/cls_annotation.txt +0 -29
  229. package/src/__tests__/testdata/ascii/cls_association.txt +0 -14
  230. package/src/__tests__/testdata/ascii/cls_basic.txt +0 -15
  231. package/src/__tests__/testdata/ascii/cls_dependency.txt +0 -14
  232. package/src/__tests__/testdata/ascii/cls_inheritance.txt +0 -20
  233. package/src/__tests__/testdata/ascii/cls_methods.txt +0 -21
  234. package/src/__tests__/testdata/ascii/comments.txt +0 -23
  235. package/src/__tests__/testdata/ascii/custom_padding.txt +0 -10
  236. package/src/__tests__/testdata/ascii/duplicate_labels.txt +0 -19
  237. package/src/__tests__/testdata/ascii/er_attributes.txt +0 -21
  238. package/src/__tests__/testdata/ascii/er_basic.txt +0 -8
  239. package/src/__tests__/testdata/ascii/er_identifying.txt +0 -18
  240. package/src/__tests__/testdata/ascii/flowchart_tb_simple.txt +0 -29
  241. package/src/__tests__/testdata/ascii/graph_bt_direction.txt +0 -28
  242. package/src/__tests__/testdata/ascii/graph_tb_direction.txt +0 -26
  243. package/src/__tests__/testdata/ascii/nested_subgraphs_with_labels.txt +0 -36
  244. package/src/__tests__/testdata/ascii/preserve_order_of_definition.txt +0 -23
  245. package/src/__tests__/testdata/ascii/self_reference.txt +0 -10
  246. package/src/__tests__/testdata/ascii/self_reference_with_edge.txt +0 -10
  247. package/src/__tests__/testdata/ascii/seq_basic.txt +0 -17
  248. package/src/__tests__/testdata/ascii/seq_multiple_messages.txt +0 -25
  249. package/src/__tests__/testdata/ascii/seq_self_message.txt +0 -18
  250. package/src/__tests__/testdata/ascii/single_node.txt +0 -8
  251. package/src/__tests__/testdata/ascii/single_node_longer_name.txt +0 -8
  252. package/src/__tests__/testdata/ascii/subgraph_complex_mixed.txt +0 -38
  253. package/src/__tests__/testdata/ascii/subgraph_complex_nested.txt +0 -49
  254. package/src/__tests__/testdata/ascii/subgraph_direction_override.txt +0 -47
  255. package/src/__tests__/testdata/ascii/subgraph_empty.txt +0 -10
  256. package/src/__tests__/testdata/ascii/subgraph_mixed_nodes.txt +0 -20
  257. package/src/__tests__/testdata/ascii/subgraph_mixed_nodes_td.txt +0 -48
  258. package/src/__tests__/testdata/ascii/subgraph_multiple_edges.txt +0 -32
  259. package/src/__tests__/testdata/ascii/subgraph_multiple_nodes.txt +0 -16
  260. package/src/__tests__/testdata/ascii/subgraph_nested.txt +0 -24
  261. package/src/__tests__/testdata/ascii/subgraph_nested_with_external.txt +0 -30
  262. package/src/__tests__/testdata/ascii/subgraph_node_outside_lr.txt +0 -17
  263. package/src/__tests__/testdata/ascii/subgraph_single_node.txt +0 -16
  264. package/src/__tests__/testdata/ascii/subgraph_td_direction.txt +0 -26
  265. package/src/__tests__/testdata/ascii/subgraph_td_multiple.txt +0 -44
  266. package/src/__tests__/testdata/ascii/subgraph_td_multiple_paddingy.txt +0 -42
  267. package/src/__tests__/testdata/ascii/subgraph_three_levels_nested.txt +0 -32
  268. package/src/__tests__/testdata/ascii/subgraph_three_separate.txt +0 -24
  269. package/src/__tests__/testdata/ascii/subgraph_two_separate.txt +0 -20
  270. package/src/__tests__/testdata/ascii/subgraph_with_labels.txt +0 -20
  271. package/src/__tests__/testdata/ascii/three_nodes.txt +0 -9
  272. package/src/__tests__/testdata/ascii/three_nodes_single_line.txt +0 -8
  273. package/src/__tests__/testdata/ascii/two_layer_single_graph.txt +0 -19
  274. package/src/__tests__/testdata/ascii/two_layer_single_graph_longer_names.txt +0 -19
  275. package/src/__tests__/testdata/ascii/two_nodes_linked.txt +0 -8
  276. package/src/__tests__/testdata/ascii/two_nodes_longer_names.txt +0 -8
  277. package/src/__tests__/testdata/ascii/two_root_nodes.txt +0 -19
  278. package/src/__tests__/testdata/ascii/two_root_nodes_longer_names.txt +0 -19
  279. package/src/__tests__/testdata/ascii/two_single_root_nodes.txt +0 -19
  280. package/src/__tests__/testdata/unicode/ampersand_lhs.txt +0 -18
  281. package/src/__tests__/testdata/unicode/ampersand_lhs_and_rhs.txt +0 -18
  282. package/src/__tests__/testdata/unicode/ampersand_rhs.txt +0 -18
  283. package/src/__tests__/testdata/unicode/ampersand_without_edge.txt +0 -18
  284. package/src/__tests__/testdata/unicode/back_reference_from_child.txt +0 -10
  285. package/src/__tests__/testdata/unicode/backlink_from_bottom.txt +0 -22
  286. package/src/__tests__/testdata/unicode/backlink_from_top.txt +0 -22
  287. package/src/__tests__/testdata/unicode/cls_all_relationships.txt +0 -19
  288. package/src/__tests__/testdata/unicode/cls_annotation.txt +0 -29
  289. package/src/__tests__/testdata/unicode/cls_association.txt +0 -14
  290. package/src/__tests__/testdata/unicode/cls_basic.txt +0 -15
  291. package/src/__tests__/testdata/unicode/cls_dependency.txt +0 -14
  292. package/src/__tests__/testdata/unicode/cls_inheritance.txt +0 -20
  293. package/src/__tests__/testdata/unicode/cls_methods.txt +0 -21
  294. package/src/__tests__/testdata/unicode/comments.txt +0 -23
  295. package/src/__tests__/testdata/unicode/duplicate_labels.txt +0 -19
  296. package/src/__tests__/testdata/unicode/er_attributes.txt +0 -21
  297. package/src/__tests__/testdata/unicode/er_basic.txt +0 -8
  298. package/src/__tests__/testdata/unicode/er_identifying.txt +0 -18
  299. package/src/__tests__/testdata/unicode/graph_bt_direction.txt +0 -28
  300. package/src/__tests__/testdata/unicode/preserve_order_of_definition.txt +0 -23
  301. package/src/__tests__/testdata/unicode/self_reference.txt +0 -10
  302. package/src/__tests__/testdata/unicode/self_reference_with_edge.txt +0 -10
  303. package/src/__tests__/testdata/unicode/seq_basic.txt +0 -17
  304. package/src/__tests__/testdata/unicode/seq_multiple_messages.txt +0 -25
  305. package/src/__tests__/testdata/unicode/seq_self_message.txt +0 -18
  306. package/src/__tests__/testdata/unicode/single_node.txt +0 -8
  307. package/src/__tests__/testdata/unicode/single_node_longer_name.txt +0 -8
  308. package/src/__tests__/testdata/unicode/three_nodes.txt +0 -9
  309. package/src/__tests__/testdata/unicode/three_nodes_single_line.txt +0 -8
  310. package/src/__tests__/testdata/unicode/two_layer_single_graph.txt +0 -19
  311. package/src/__tests__/testdata/unicode/two_layer_single_graph_longer_names.txt +0 -19
  312. package/src/__tests__/testdata/unicode/two_nodes_linked.txt +0 -8
  313. package/src/__tests__/testdata/unicode/two_nodes_longer_names.txt +0 -8
  314. package/src/__tests__/testdata/unicode/two_root_nodes.txt +0 -19
  315. package/src/__tests__/testdata/unicode/two_root_nodes_longer_names.txt +0 -19
  316. package/src/__tests__/testdata/unicode/two_single_root_nodes.txt +0 -19
  317. package/src/__tests__/text-metrics.test.ts +0 -473
  318. package/src/__tests__/theme-palette-contrast.test.ts +0 -84
  319. package/src/__tests__/theme.test.ts +0 -132
  320. package/src/__tests__/xychart-ascii.test.ts +0 -376
  321. package/src/__tests__/xychart-colors.test.ts +0 -149
@@ -1,234 +0,0 @@
1
- import { describe, it, expect } from 'vitest'
2
- import { renderMermaidASCII } from '@zombie-mermaid/ascii-renderer'
3
- import {
4
- stateStartRenderer,
5
- stateEndRenderer,
6
- } from '../../packages/ascii-renderer/src/shapes/state.ts'
7
- import { canvasToString } from '../../packages/ascii-renderer/src/canvas.ts'
8
- import {
9
- Up,
10
- Down,
11
- Left,
12
- Right,
13
- Middle,
14
- UpperLeft,
15
- } from '../../packages/ascii-renderer/src/types.ts'
16
- import type { ShapeRenderOptions } from '../../packages/ascii-renderer/src/shapes/types.ts'
17
-
18
- const unicodeOptions: ShapeRenderOptions = { useAscii: false, padding: 1 }
19
- const asciiOptions: ShapeRenderOptions = { useAscii: true, padding: 1 }
20
-
21
- describe('stateStartRenderer (direct unit tests)', () => {
22
- it('reports fixed 5x3 dimensions regardless of label', () => {
23
- const dims = stateStartRenderer.getDimensions('', unicodeOptions)
24
- expect(dims.width).toBe(5)
25
- expect(dims.height).toBe(3)
26
- expect(dims.labelArea).toEqual({ x: 2, y: 1, width: 1, height: 1 })
27
- expect(dims.gridColumns).toEqual([1, 3, 1])
28
- expect(dims.gridRows).toEqual([1, 1, 1])
29
- })
30
-
31
- it('renders a rounded box with a filled circle in Unicode mode', () => {
32
- const dims = stateStartRenderer.getDimensions('', unicodeOptions)
33
- const canvas = stateStartRenderer.render('', dims, unicodeOptions)
34
- expect(canvasToString(canvas)).toBe('╭───╮\n│ ● │\n╰───╯')
35
- })
36
-
37
- it('renders a rounded box with an asterisk in ASCII mode', () => {
38
- const dims = stateStartRenderer.getDimensions('', asciiOptions)
39
- const canvas = stateStartRenderer.render('', dims, asciiOptions)
40
- expect(canvasToString(canvas)).toBe(".---.\n| * |\n'---'")
41
- })
42
-
43
- it('computes attachment points on each cardinal border', () => {
44
- const dims = stateStartRenderer.getDimensions('', unicodeOptions)
45
- const base = { x: 10, y: 20 }
46
-
47
- expect(stateStartRenderer.getAttachmentPoint(Up, dims, base)).toEqual({
48
- x: 12,
49
- y: 20,
50
- })
51
- expect(stateStartRenderer.getAttachmentPoint(Down, dims, base)).toEqual({
52
- x: 12,
53
- y: 22,
54
- })
55
- expect(stateStartRenderer.getAttachmentPoint(Left, dims, base)).toEqual({
56
- x: 10,
57
- y: 21,
58
- })
59
- expect(stateStartRenderer.getAttachmentPoint(Right, dims, base)).toEqual({
60
- x: 14,
61
- y: 21,
62
- })
63
- })
64
-
65
- it('falls back to the center point for diagonal/middle directions', () => {
66
- const dims = stateStartRenderer.getDimensions('', unicodeOptions)
67
- const base = { x: 10, y: 20 }
68
-
69
- expect(
70
- stateStartRenderer.getAttachmentPoint(UpperLeft, dims, base),
71
- ).toEqual({ x: 12, y: 21 })
72
- expect(stateStartRenderer.getAttachmentPoint(Middle, dims, base)).toEqual({
73
- x: 12,
74
- y: 21,
75
- })
76
- })
77
- })
78
-
79
- describe('stateEndRenderer (direct unit tests)', () => {
80
- it('reports fixed 5x3 dimensions regardless of label', () => {
81
- const dims = stateEndRenderer.getDimensions('', unicodeOptions)
82
- expect(dims.width).toBe(5)
83
- expect(dims.height).toBe(3)
84
- expect(dims.labelArea).toEqual({ x: 2, y: 1, width: 1, height: 1 })
85
- expect(dims.gridColumns).toEqual([1, 3, 1])
86
- expect(dims.gridRows).toEqual([1, 1, 1])
87
- })
88
-
89
- it('renders a double-bordered box with a bullseye in Unicode mode', () => {
90
- const dims = stateEndRenderer.getDimensions('', unicodeOptions)
91
- const canvas = stateEndRenderer.render('', dims, unicodeOptions)
92
- expect(canvasToString(canvas)).toBe('╔═══╗\n║ ◎ ║\n╚═══╝')
93
- })
94
-
95
- it('renders a double-bordered box with an asterisk in ASCII mode', () => {
96
- const dims = stateEndRenderer.getDimensions('', asciiOptions)
97
- const canvas = stateEndRenderer.render('', dims, asciiOptions)
98
- expect(canvasToString(canvas)).toBe('#===#\n# * #\n#===#')
99
- })
100
-
101
- it('computes attachment points on each cardinal border', () => {
102
- const dims = stateEndRenderer.getDimensions('', unicodeOptions)
103
- const base = { x: 10, y: 20 }
104
-
105
- expect(stateEndRenderer.getAttachmentPoint(Up, dims, base)).toEqual({
106
- x: 12,
107
- y: 20,
108
- })
109
- expect(stateEndRenderer.getAttachmentPoint(Down, dims, base)).toEqual({
110
- x: 12,
111
- y: 22,
112
- })
113
- expect(stateEndRenderer.getAttachmentPoint(Left, dims, base)).toEqual({
114
- x: 10,
115
- y: 21,
116
- })
117
- expect(stateEndRenderer.getAttachmentPoint(Right, dims, base)).toEqual({
118
- x: 14,
119
- y: 21,
120
- })
121
- })
122
-
123
- it('falls back to the center point for diagonal/middle directions', () => {
124
- const dims = stateEndRenderer.getDimensions('', unicodeOptions)
125
- const base = { x: 10, y: 20 }
126
-
127
- expect(stateEndRenderer.getAttachmentPoint(UpperLeft, dims, base)).toEqual({
128
- x: 12,
129
- y: 21,
130
- })
131
- expect(stateEndRenderer.getAttachmentPoint(Middle, dims, base)).toEqual({
132
- x: 12,
133
- y: 21,
134
- })
135
- })
136
- })
137
-
138
- describe('stateDiagram-v2 rendering (integration)', () => {
139
- it('renders a single regular state with start and end pseudostates (Unicode)', () => {
140
- const out = renderMermaidASCII(
141
- `stateDiagram-v2
142
- [*] --> Idle
143
- Idle --> [*]`,
144
- { colorMode: 'none' },
145
- )
146
- expect(out).toContain('●')
147
- expect(out).toContain('Idle')
148
- expect(out).toContain('╔')
149
- expect(out).toContain('╝')
150
- })
151
-
152
- it('renders a single regular state with start and end pseudostates (ASCII)', () => {
153
- const out = renderMermaidASCII(
154
- `stateDiagram-v2
155
- [*] --> Idle
156
- Idle --> [*]`,
157
- { colorMode: 'none', useAscii: true },
158
- )
159
- expect(out).toContain('*')
160
- expect(out).toContain('Idle')
161
- expect(out).toContain('#')
162
- })
163
-
164
- it('renders a multi-state chain with labeled transitions', () => {
165
- const out = renderMermaidASCII(
166
- `stateDiagram-v2
167
- [*] --> Idle
168
- Idle --> Processing: start
169
- Processing --> Complete: done
170
- Complete --> [*]`,
171
- { colorMode: 'none' },
172
- )
173
- expect(out).toContain('Idle')
174
- expect(out).toContain('Processing')
175
- expect(out).toContain('Complete')
176
- expect(out).toContain('start')
177
- expect(out).toContain('done')
178
- })
179
-
180
- it('renders a longer state label at a larger box size without breaking the pseudostate glyphs', () => {
181
- const out = renderMermaidASCII(
182
- `stateDiagram-v2
183
- [*] --> AwaitingConfirmationFromUser
184
- AwaitingConfirmationFromUser --> [*]`,
185
- { colorMode: 'none' },
186
- )
187
- expect(out).toContain('AwaitingConfirmationFromUser')
188
- expect(out).toContain('●')
189
- expect(out).toContain('╔')
190
- expect(out).toContain('╝')
191
- })
192
-
193
- it('renders fan-out from the start pseudostate to multiple states', () => {
194
- const out = renderMermaidASCII(
195
- `stateDiagram-v2
196
- [*] --> Idle
197
- [*] --> Error`,
198
- { colorMode: 'none' },
199
- )
200
- expect(out).toContain('Idle')
201
- expect(out).toContain('Error')
202
- expect(out).toContain('●')
203
- })
204
-
205
- it('renders fan-in from multiple states into the end pseudostate', () => {
206
- const out = renderMermaidASCII(
207
- `stateDiagram-v2
208
- Idle --> [*]
209
- Error --> [*]`,
210
- { colorMode: 'none' },
211
- )
212
- expect(out).toContain('Idle')
213
- expect(out).toContain('Error')
214
- expect(out).toContain('╔')
215
- expect(out).toContain('╝')
216
- })
217
-
218
- it('renders multiple distinct start/end pseudostates with unique ids', () => {
219
- const out = renderMermaidASCII(
220
- `stateDiagram-v2
221
- [*] --> A
222
- A --> [*]
223
- [*] --> B
224
- B --> [*]`,
225
- { colorMode: 'none' },
226
- )
227
- expect(out).toContain('A')
228
- expect(out).toContain('B')
229
- const startGlyphCount = (out.match(/●/g) ?? []).length
230
- const endBorderCount = (out.match(/[╔╚╝╗]/g) ?? []).length
231
- expect(startGlyphCount).toBeGreaterThan(0)
232
- expect(endBorderCount).toBeGreaterThan(0)
233
- })
234
- })
@@ -1,130 +0,0 @@
1
- /**
2
- * Regression test for #530 — "State: transition labels between a
3
- * bidirectional state pair are swapped relative to their arrows."
4
- *
5
- * Root cause: `drawTextOnLine` (src/ascii/draw-arrows.ts) offsets a vertical
6
- * edge label away from the segment's midpoint to keep a same-pair
7
- * bidirectional edge's two labels from overlapping (they share the same
8
- * vertical channel). The offset was applied toward each edge's *source*
9
- * end (upward edge -> lower portion, i.e. near its own source; downward
10
- * edge -> upper portion, i.e. near its own source). For a reciprocal pair
11
- * of edges between the same two nodes, one edge's source is the other
12
- * edge's target, so pulling a label toward its own source pulls it right
13
- * next to the *other* edge's arrowhead instead — the visual effect
14
- * described in #530 as the two labels being "swapped" relative to the
15
- * arrows they sit beside.
16
- *
17
- * The fix pulls each label toward its own target (arrowhead) instead, so
18
- * the label next to a given arrowhead always belongs to that arrow.
19
- *
20
- * Uses the exact "Basic State Diagram" and "State: Connection Lifecycle"
21
- * samples from samples-data.ts (indices 29 and 31 in the sample list) that
22
- * the issue was filed against.
23
- */
24
-
25
- import { describe, it, expect } from 'vitest'
26
- import { renderMermaidASCII } from '@zombie-mermaid/ascii-renderer'
27
-
28
- const BASIC_STATE_DIAGRAM = `stateDiagram-v2
29
- [*] --> Idle
30
- Idle --> Active : start
31
- Active --> Idle : cancel
32
- Active --> Done : complete
33
- Done --> [*]`
34
-
35
- const CONNECTION_LIFECYCLE = `stateDiagram-v2
36
- [*] --> Closed
37
- Closed --> Connecting : connect
38
- Connecting --> Connected : success
39
- Connecting --> Closed : timeout
40
- Connected --> Disconnecting : close
41
- Connected --> Reconnecting : error
42
- Reconnecting --> Connected : success
43
- Reconnecting --> Closed : max_retries
44
- Disconnecting --> Closed : done
45
- Closed --> [*]`
46
-
47
- describe('ASCII state diagram — bidirectional pair label placement (issue #530)', () => {
48
- it('places "cancel" next to the arrow arriving at Idle and "start" next to the arrow arriving at Active', () => {
49
- const ascii = renderMermaidASCII(BASIC_STATE_DIAGRAM, { colorMode: 'none' })
50
- const lines = ascii.split('\n')
51
-
52
- // The Idle<->Active channel is the only place an upward arrowhead (▲)
53
- // appears in this diagram — every other edge routes downward.
54
- const upArrowIdx = lines.findIndex((l) => l.includes('▲'))
55
- const cancelIdx = lines.findIndex((l) => l.includes('cancel'))
56
- const startIdx = lines.findIndex((l) => l.includes('start'))
57
- // The next downward arrowhead (▼) after the "start" label is the one
58
- // arriving at Active.
59
- const downArrowIdx = lines.findIndex(
60
- (l, i) => i > startIdx && l.includes('▼'),
61
- )
62
-
63
- expect(upArrowIdx).toBeGreaterThan(-1)
64
- expect(cancelIdx).toBeGreaterThan(-1)
65
- expect(startIdx).toBeGreaterThan(-1)
66
- expect(downArrowIdx).toBeGreaterThan(-1)
67
-
68
- // "cancel" (Active --> Idle) sits immediately below the up-arrow that
69
- // arrives at Idle — i.e. next to its own arrowhead.
70
- expect(cancelIdx).toBe(upArrowIdx + 1)
71
- // "start" (Idle --> Active) sits immediately above the down-arrow that
72
- // arrives at Active — i.e. next to its own arrowhead.
73
- expect(startIdx).toBe(downArrowIdx - 1)
74
-
75
- // Reading top to bottom: Idle's border, ▲, cancel, ..., start, ▼,
76
- // Active's border — cancel precedes start.
77
- expect(cancelIdx).toBeLessThan(startIdx)
78
- })
79
-
80
- it('places "timeout" next to the arrow arriving at Closed and "connect" next to the arrow arriving at Connecting', () => {
81
- const ascii = renderMermaidASCII(CONNECTION_LIFECYCLE, {
82
- colorMode: 'none',
83
- })
84
- const lines = ascii.split('\n')
85
-
86
- // Scope the search to the Closed/Connecting channel: from the box that
87
- // renders "Closed" down to the box that renders "Connecting" (the
88
- // diagram has several other bidirectional pairs further down that
89
- // reuse the same glyphs/labels, e.g. Connected<->Reconnecting's
90
- // "success"/"error").
91
- const closedBoxIdx = lines.findIndex((l) => l.includes('Closed'))
92
- const connectingBoxIdx = lines.findIndex((l) => l.includes('Connecting'))
93
- expect(closedBoxIdx).toBeGreaterThan(-1)
94
- expect(connectingBoxIdx).toBeGreaterThan(closedBoxIdx)
95
-
96
- const channel = lines.slice(closedBoxIdx, connectingBoxIdx)
97
- const upArrowIdx = channel.findIndex((l) => l.includes('▲'))
98
- const timeoutIdx = channel.findIndex((l) => l.includes('timeout'))
99
- const connectIdx = channel.findIndex((l) => l.includes('connect'))
100
- const downArrowIdx = channel.findIndex(
101
- (l, i) => i > connectIdx && l.includes('▼'),
102
- )
103
-
104
- expect(upArrowIdx).toBeGreaterThan(-1)
105
- expect(timeoutIdx).toBeGreaterThan(-1)
106
- expect(connectIdx).toBeGreaterThan(-1)
107
- expect(downArrowIdx).toBeGreaterThan(-1)
108
-
109
- // "timeout" (Connecting --> Closed) sits next to the up-arrow arriving
110
- // at Closed; "connect" (Closed --> Connecting) sits next to the
111
- // down-arrow arriving at Connecting.
112
- expect(timeoutIdx).toBe(upArrowIdx + 1)
113
- expect(connectIdx).toBe(downArrowIdx - 1)
114
- expect(timeoutIdx).toBeLessThan(connectIdx)
115
- })
116
-
117
- it('still places a single (non-reciprocal) edge label before its own arrowhead', () => {
118
- const ascii = renderMermaidASCII(BASIC_STATE_DIAGRAM, { colorMode: 'none' })
119
- const lines = ascii.split('\n')
120
-
121
- // "complete" (Active --> Done) has no reverse counterpart, so it
122
- // should simply precede the arrowhead that arrives at Done.
123
- const completeIdx = lines.findIndex((l) => l.includes('complete'))
124
- const arrowIdx = lines.findIndex(
125
- (l, i) => i > completeIdx && l.includes('▼'),
126
- )
127
- expect(completeIdx).toBeGreaterThan(-1)
128
- expect(arrowIdx).toBeGreaterThan(completeIdx)
129
- })
130
- })
@@ -1,90 +0,0 @@
1
- /**
2
- * Regression test for #445 — "Flowchart: `direction LR` override inside a
3
- * subgraph renders wrong."
4
- *
5
- * The fix (src/ascii/converter.ts's `subgraphDirectionIsHonored`) only
6
- * *drops* a subgraph's own `direction` override when a member node has an
7
- * edge crossing the subgraph's boundary. This test covers the other side of
8
- * that branch — a subgraph with a `direction` override and NO boundary-
9
- * crossing edges must still have the override applied, exactly as before
10
- * this fix. Without this case, a regression that made
11
- * `subgraphDirectionIsHonored` always return `false` (dropping every
12
- * override, honored or not) would go undetected.
13
- */
14
-
15
- import { describe, it, expect } from 'vitest'
16
- import { renderMermaidASCII } from '@zombie-mermaid/ascii-renderer'
17
-
18
- describe('ASCII subgraph direction override — honored case (issue #445)', () => {
19
- it.each(['LR', 'RL'] as const)(
20
- 'applies direction %s when no member node has a boundary-crossing edge',
21
- (direction) => {
22
- const ascii = renderMermaidASCII(
23
- `graph TD
24
- subgraph Group
25
- direction ${direction}
26
- A --> B --> C
27
- end`,
28
- { colorMode: 'none' },
29
- )
30
-
31
- const lines = ascii.split('\n')
32
- const rowA = lines.findIndex((l) => l.includes('A'))
33
- const rowB = lines.findIndex((l) => l.includes('B'))
34
- const rowC = lines.findIndex((l) => l.includes('C'))
35
-
36
- // Honored `direction LR`/`RL` (both normalize to LR) places A, B, C on
37
- // the same row (left-to-right), not stacked one per row as the outer
38
- // `TD` would.
39
- expect(rowA).toBe(rowB)
40
- expect(rowB).toBe(rowC)
41
-
42
- const colA = lines[rowA]!.indexOf('A')
43
- const colB = lines[rowB]!.indexOf('B')
44
- const colC = lines[rowC]!.indexOf('C')
45
- expect(colA).toBeLessThan(colB)
46
- expect(colB).toBeLessThan(colC)
47
- },
48
- )
49
-
50
- it('normalizes direction BT to TD (vertical stacking), same as the outer graph', () => {
51
- // Exercises the ternary's final `: 'TD'` fallback arm — BT is neither
52
- // 'LR' nor 'RL', so it normalizes to 'TD' just like an unset direction
53
- // would default to matching the outer graph's own TD flow.
54
- const ascii = renderMermaidASCII(
55
- `graph TD
56
- subgraph Group
57
- direction BT
58
- A --> B --> C
59
- end`,
60
- { colorMode: 'none' },
61
- )
62
-
63
- const lines = ascii.split('\n')
64
- const rowA = lines.findIndex((l) => l.includes('A'))
65
- const rowB = lines.findIndex((l) => l.includes('B'))
66
- const rowC = lines.findIndex((l) => l.includes('C'))
67
-
68
- expect(rowA).toBeLessThan(rowB)
69
- expect(rowB).toBeLessThan(rowC)
70
- })
71
-
72
- it('does not crash on a subgraph with a direction override and zero member nodes', () => {
73
- // Exercises subgraphDirectionIsHonored's `memberIds.size === 0` early
74
- // return: an edge-case subgraph declaring only `direction`, no nodes.
75
- // There's no member node to check for a boundary-crossing edge, so it
76
- // trivially counts as "honored" (nothing to un-honor) rather than
77
- // throwing or mis-rendering the rest of the diagram.
78
- const ascii = renderMermaidASCII(
79
- `graph TD
80
- subgraph Empty
81
- direction LR
82
- end
83
- A --> B`,
84
- { colorMode: 'none' },
85
- )
86
-
87
- expect(ascii).toContain('A')
88
- expect(ascii).toContain('B')
89
- })
90
- })
@@ -1,152 +0,0 @@
1
- /**
2
- * Regression test for a border-corruption bug introduced while migrating
3
- * `drawSubgraphLabel` (src/ascii/draw-subgraphs.ts) to the shared
4
- * `write()` primitive (src/ascii/canvas.ts).
5
- *
6
- * The deleted guard here was `labelX + j < width && labelY < height`.
7
- * `mkCanvas(width, height)` is inclusive (valid indices `0..width` /
8
- * `0..height`), so that guard deliberately clipped *before* the border
9
- * column/row. `write()`'s own clip is `x > maxX` / `y > maxY` with
10
- * `maxX === width` / `maxY === height` — correct for `drawSubgraphBox`'s
11
- * border-drawing calls (which legitimately write the border itself at
12
- * `x === width` / `y === height`), but too permissive for the label: it
13
- * allowed writing exactly on the border, so any subgraph title wider than
14
- * its interior, or taller than its box, silently overwrote its own frame.
15
- *
16
- * The fix keeps the original, tighter exclusive bound at this call site
17
- * specifically rather than changing `write()`'s bounds (every other
18
- * migrated call site relies on `write()`'s inclusive bounds).
19
- */
20
- import { describe, it, expect } from 'vitest'
21
- import { renderMermaidASCII } from '@zombie-mermaid/ascii-renderer'
22
-
23
- describe('ASCII subgraph label does not overwrite its own border', () => {
24
- it('leaves the right border intact when the title is wider than the interior', () => {
25
- const mermaid = `flowchart TD
26
- subgraph ONE["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"]
27
- A1["a"] --> A2["b"]
28
- end`
29
- const output = renderMermaidASCII(mermaid)
30
- const titleLine = output.split('\n').find((l) => l.includes('AAAAAAA'))
31
- expect(titleLine).toBeDefined()
32
-
33
- // The box is now widened to fit the title in full (issue #632 — a
34
- // subgraph label used to be truncated to whatever width the child
35
- // nodes happened to need, dropping trailing characters), so the title
36
- // is no longer clipped at all — but the row must still open and close
37
- // with the border — never spill onto/through it.
38
- expect(titleLine).toBe('│AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA│')
39
- expect(titleLine?.startsWith('│')).toBe(true)
40
- expect(titleLine?.endsWith('│')).toBe(true)
41
- })
42
-
43
- it('leaves the bottom border intact when the title has more lines than the box has rows', () => {
44
- const labelLines = Array.from({ length: 15 }, (_, i) =>
45
- String.fromCharCode(65 + i),
46
- ).join('<br/>')
47
- const mermaid = `flowchart TD
48
- subgraph ONE["${labelLines}"]
49
- A1["a"]
50
- end`
51
- const output = renderMermaidASCII(mermaid)
52
- const rows = output.split('\n')
53
- const bottomBorder = rows[rows.length - 1]!
54
-
55
- // The bottom border row must be all border characters — no label
56
- // character should have punched through it.
57
- expect(bottomBorder).toBe('└───────┘')
58
- })
59
-
60
- it('matches known-good output captured from a real renderMermaidASCII run (locks in the exact fix)', () => {
61
- const mermaid = `flowchart TD
62
- subgraph ONE["AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"]
63
- A1["a"] --> A2["b"]
64
- end`
65
- const output = renderMermaidASCII(mermaid)
66
- expect(output).toBe(
67
- [
68
- '┌──────────────────────────────────┐',
69
- '│AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA│',
70
- '│ │',
71
- '│ │',
72
- '│ ┌───┐ │',
73
- '│ │ │ │',
74
- '│ │ a │ │',
75
- '│ │ │ │',
76
- '│ └─┬─┘ │',
77
- '│ │ │',
78
- '│ │ │',
79
- '│ │ │',
80
- '│ │ │',
81
- '│ ▼ │',
82
- '│ ┌───┐ │',
83
- '│ │ │ │',
84
- '│ │ b │ │',
85
- '│ │ │ │',
86
- '│ └───┘ │',
87
- '│ │',
88
- '└──────────────────────────────────┘',
89
- ].join('\n'),
90
- )
91
- })
92
- })
93
-
94
- /**
95
- * Regression test for issue #632 — a weekly form-judge audit comparing this
96
- * repo's ASCII output against real mermaid.js SVG flagged the "Subgraph
97
- * Direction Override" sample (samples-data.ts): the cluster label
98
- * "Processing Pipeline" was truncated mid-word to "Processing Pipe" even
99
- * though the source SVG's cluster rect is wide enough to fit the full label
100
- * untruncated.
101
- *
102
- * Root cause: `calculateSubgraphBoundingBox` (src/ascii/grid.ts) sized a
103
- * subgraph's box purely from its child nodes' positions — it never
104
- * considered the width of the subgraph's own label — so a label longer
105
- * than the widest child node's contribution to the box got silently
106
- * clipped by `drawSubgraphLabel`'s own border-safety guard (the fix
107
- * verified by the tests above, which correctly stops a label from spilling
108
- * onto the border, but does nothing to stop it needing to spill in the
109
- * first place). The fix widens the box, symmetrically, whenever the
110
- * label's own display width would otherwise exceed the interior the child
111
- * nodes alone would have produced.
112
- */
113
- describe('ASCII subgraph label does not truncate a label wider than its child nodes (issue #632)', () => {
114
- it('renders "Processing Pipeline" in full instead of truncating it to "Processing Pipe"', () => {
115
- const mermaid = `graph TD
116
- subgraph pipeline [Processing Pipeline]
117
- direction LR
118
- A[Input] --> B[Parse] --> C[Transform] --> D[Output]
119
- end
120
- E[Source] --> A
121
- D --> F[Sink]`
122
- const output = renderMermaidASCII(mermaid)
123
-
124
- expect(output).toContain('Processing Pipeline')
125
- expect(output).not.toContain('Processing Pipe│')
126
- expect(output).not.toContain('Processing Pipe\n')
127
-
128
- const titleLine = output
129
- .split('\n')
130
- .find((l) => l.includes('Processing Pipeline'))
131
- expect(titleLine).toBeDefined()
132
- // The label sits fully inside the border on both sides, not clipped
133
- // against (or spilling onto) either one.
134
- expect(titleLine?.startsWith('│')).toBe(true)
135
- expect(titleLine?.endsWith('│')).toBe(true)
136
- })
137
-
138
- it('still truncates a title far wider than any reasonable box only via the border-safety clip, never mid-word from box sizing alone', () => {
139
- // A label wider than the box has room for, on a subgraph with only a
140
- // single tiny child node — the box widens to fit the label (this
141
- // issue's fix), so nothing is truncated by width sizing; the only
142
- // remaining clip source is `drawSubgraphLabel`'s own border guard
143
- // (covered by the tests above), which only fires for pathological
144
- // cases (e.g. a taller-than-tall label) that this fix does not touch.
145
- const mermaid = `flowchart TD
146
- subgraph ONE["A Rather Long Subgraph Title Here"]
147
- A1["a"]
148
- end`
149
- const output = renderMermaidASCII(mermaid)
150
- expect(output).toContain('A Rather Long Subgraph Title Here')
151
- })
152
- })
@@ -1,77 +0,0 @@
1
- /**
2
- * Regression test for a cosmetic centering bug noticed as an aside while
3
- * investigating issue #65 (edges between subgraph ids). When a subgraph's
4
- * label length and the box's interior width have opposite parity, the
5
- * leftover column can't be split evenly between the two sides of the
6
- * centered title. The old centering formula
7
- * (`floor(width/2) - floor(label/2)`) always gave the leftover column to
8
- * the right side, which could zero out the *left* padding entirely and
9
- * make the title glue directly to the left border — e.g. `│Second │`
10
- * instead of a title that, like every other row in the box, never touches
11
- * the border.
12
- *
13
- * `drawSubgraphLabel` (src/ascii/draw-subgraphs.ts) now biases the leftover
14
- * column to the right side's padding instead, guaranteeing at least one
15
- * space of left padding whenever the box has any slack at all.
16
- */
17
- import { describe, it, expect } from 'vitest'
18
- import { renderMermaidASCII } from '@zombie-mermaid/ascii-renderer'
19
-
20
- /** Find the line containing a subgraph's rendered title text. */
21
- function findTitleLine(output: string, title: string): string {
22
- const line = output.split('\n').find((l) => l.includes(title))
23
- if (line === undefined) {
24
- throw new Error(`title "${title}" not found in output:\n${output}`)
25
- }
26
- return line
27
- }
28
-
29
- describe('ASCII subgraph title padding (aside from issue #65)', () => {
30
- const mermaid = `flowchart TD
31
- subgraph ONE["First"]
32
- A1["a"] --> A2["b"]
33
- end
34
- subgraph TWO["Second"]
35
- B1["c"] --> B2["d"]
36
- end
37
- ONE --> TWO`
38
-
39
- it('never glues a subgraph title to its left border, even when a connector column runs through the title row', () => {
40
- const output = renderMermaidASCII(mermaid)
41
-
42
- const firstLine = findTitleLine(output, 'First')
43
- const secondLine = findTitleLine(output, 'Second')
44
-
45
- // Both title rows must start with a border char followed by at least
46
- // one space before the label text — never `│First` or `│Second`.
47
- expect(firstLine).toMatch(/^│ First/)
48
- expect(secondLine).toMatch(/^│ Second/)
49
-
50
- // Exact known-good output (captured from a real renderMermaidASCII run;
51
- // not fabricated) — locks in the fix precisely.
52
- expect(firstLine).toBe('│ First │')
53
- expect(secondLine).toBe('│ Second│')
54
- })
55
-
56
- it('still centers a title symmetrically when the label/width parity allows it', () => {
57
- // "First" (5 chars) fits its box's interior (7 cols) with one space of
58
- // padding on both sides — this must remain unaffected by the fix.
59
- const output = renderMermaidASCII(mermaid)
60
- const firstLine = findTitleLine(output, 'First')
61
- expect(firstLine).toBe('│ First │')
62
- })
63
-
64
- it('does not require a subgraph-to-subgraph connector to reproduce — it is a general centering parity issue', () => {
65
- const mermaidNoEdge = `flowchart TD
66
- subgraph ONE["First"]
67
- A1["a"] --> A2["b"]
68
- end
69
- subgraph TWO["Second"]
70
- B1["c"] --> B2["d"]
71
- end`
72
-
73
- const output = renderMermaidASCII(mermaidNoEdge)
74
- const secondLine = findTitleLine(output, 'Second')
75
- expect(secondLine).toMatch(/│ Second/)
76
- })
77
- })