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,435 +0,0 @@
1
- // ============================================================================
2
- // ASCII renderer — edge bundling for parallel links
3
- //
4
- // Analyzes edges to find parallel links (A & B --> C or A --> B & C) and
5
- // groups them into bundles. Bundled edges share a visual junction point
6
- // where they merge/split, creating cleaner diagrams.
7
- //
8
- // This module provides:
9
- // - analyzeEdgeBundles(): Finds and creates bundles from graph edges
10
- // - calculateJunctionPoint(): Computes optimal merge/split locations
11
- // - routeBundledEdges(): Routes edges through junction points
12
- // ============================================================================
13
-
14
- import type {
15
- AsciiGraph,
16
- AsciiNode,
17
- AsciiEdge,
18
- EdgeBundle,
19
- GridCoord,
20
- CardinalDirection,
21
- } from './types.ts'
22
- import {
23
- Up,
24
- Down,
25
- Left,
26
- Right,
27
- Middle,
28
- gridCoordDirection,
29
- requireCardinalDirection,
30
- } from './types.ts'
31
- import { getNodeSubgraph, requireGridCoord } from './grid.ts'
32
- import { routeEdge } from './pathfinder.ts'
33
-
34
- // ============================================================================
35
- // Bundle analysis
36
- // ============================================================================
37
-
38
- /**
39
- * Analyze graph edges and create bundles for parallel links.
40
- *
41
- * Groups edges by:
42
- * - Fan-in: Multiple edges sharing the same target (A & B --> C)
43
- * - Fan-out: Multiple edges sharing the same source (A --> B & C)
44
- *
45
- * Only creates bundles when:
46
- * - Graph direction is TD (top-down) - LR routing handles merging naturally
47
- * - 2+ edges share the endpoint
48
- * - All edges have the same style (solid/dotted/thick)
49
- * - None of the edges have labels (labels would overlap at junction)
50
- * - Edges are not self-loops
51
- *
52
- * @returns Array of bundles. Each edge can belong to at most one bundle.
53
- */
54
- export function analyzeEdgeBundles(graph: AsciiGraph): EdgeBundle[] {
55
- // Only bundle in TD direction - LR routing handles merging naturally at corners
56
- if (graph.config.graphDirection !== 'TD') {
57
- return []
58
- }
59
- const bundles: EdgeBundle[] = []
60
- const bundledEdges = new Set<AsciiEdge>()
61
-
62
- // Group edges by target (fan-in candidates)
63
- const edgesByTarget = new Map<AsciiNode, AsciiEdge[]>()
64
- for (const edge of graph.edges) {
65
- // Skip self-loops
66
- if (edge.from === edge.to) continue
67
-
68
- const existing = edgesByTarget.get(edge.to) ?? []
69
- existing.push(edge)
70
- edgesByTarget.set(edge.to, existing)
71
- }
72
-
73
- // Create fan-in bundles
74
- for (const [target, edges] of edgesByTarget) {
75
- if (edges.length < 2) continue
76
- if (!canBundle(edges, graph)) continue
77
-
78
- // Check if all edges are already bundled
79
- if (edges.some((e) => bundledEdges.has(e))) continue
80
-
81
- const bundle: EdgeBundle = {
82
- type: 'fan-in',
83
- edges: [...edges],
84
- sharedNode: target,
85
- otherNodes: edges.map((e) => e.from),
86
- junctionPoint: null,
87
- sharedPath: [],
88
- junctionDir: Middle,
89
- sharedNodeDir: Middle,
90
- }
91
-
92
- // Mark edges as bundled
93
- for (const edge of edges) {
94
- edge.bundle = bundle
95
- bundledEdges.add(edge)
96
- }
97
-
98
- bundles.push(bundle)
99
- }
100
-
101
- // Group edges by source (fan-out candidates)
102
- const edgesBySource = new Map<AsciiNode, AsciiEdge[]>()
103
- for (const edge of graph.edges) {
104
- // Skip self-loops and already bundled edges
105
- if (edge.from === edge.to) continue
106
- if (bundledEdges.has(edge)) continue
107
-
108
- const existing = edgesBySource.get(edge.from) ?? []
109
- existing.push(edge)
110
- edgesBySource.set(edge.from, existing)
111
- }
112
-
113
- // Create fan-out bundles
114
- for (const [source, edges] of edgesBySource) {
115
- if (edges.length < 2) continue
116
- if (!canBundle(edges, graph)) continue
117
-
118
- const bundle: EdgeBundle = {
119
- type: 'fan-out',
120
- edges: [...edges],
121
- sharedNode: source,
122
- otherNodes: edges.map((e) => e.to),
123
- junctionPoint: null,
124
- sharedPath: [],
125
- junctionDir: Middle,
126
- sharedNodeDir: Middle,
127
- }
128
-
129
- // Mark edges as bundled
130
- for (const edge of edges) {
131
- edge.bundle = bundle
132
- bundledEdges.add(edge)
133
- }
134
-
135
- bundles.push(bundle)
136
- }
137
-
138
- return bundles
139
- }
140
-
141
- /**
142
- * Check if a group of edges can be bundled together.
143
- * Returns false if edges have different styles, any have labels,
144
- * or if the edges span subgraph boundaries (which creates complex routing).
145
- */
146
- function canBundle(edges: AsciiEdge[], graph: AsciiGraph): boolean {
147
- if (edges.length < 2) return false
148
-
149
- const firstStyle = edges[0]!.style
150
- const firstFromSg = getNodeSubgraph(graph, edges[0]!.from)
151
- const firstToSg = getNodeSubgraph(graph, edges[0]!.to)
152
-
153
- for (const edge of edges) {
154
- // Different styles can't be bundled (would look confusing)
155
- if (edge.style !== firstStyle) return false
156
-
157
- // Edges with labels can't be bundled (labels would overlap at junction)
158
- if (edge.text.length > 0) return false
159
-
160
- // Don't bundle if edges span different subgraph boundaries
161
- // (creates complex routing that doesn't look good)
162
- const fromSg = getNodeSubgraph(graph, edge.from)
163
- const toSg = getNodeSubgraph(graph, edge.to)
164
- if (fromSg !== firstFromSg || toSg !== firstToSg) return false
165
-
166
- // Don't bundle if source and target are in different subgraphs
167
- // (cross-boundary edges have special routing needs)
168
- if (fromSg !== toSg) return false
169
- }
170
-
171
- // A group formed by shared-target (fan-in) or shared-source (fan-out)
172
- // grouping can still contain two edges that ALSO share the other
173
- // endpoint — true parallel/multi-edges (e.g. two unlabeled `A --> B`
174
- // edges), not a genuine fan-in/fan-out. Folding those into one shared
175
- // trunk+junction would visually merge them into a single line (the same
176
- // "second edge silently wins" defect this bundling feature is supposed
177
- // to avoid — see #329), rather than the distinct offset lanes
178
- // assignParallelEdgeLanes (edge-routing.ts) already gives them. Detect it
179
- // generically: the group is fan-in (shared `.to`) or fan-out (shared
180
- // `.from`) by construction (see analyzeEdgeBundles' two call sites), so
181
- // checking whichever endpoint *isn't* uniformly shared for duplicates
182
- // catches both cases without the caller having to say which one it is.
183
- const sameTarget = edges.every((e) => e.to === edges[0]!.to)
184
- const otherEndpoints = sameTarget
185
- ? edges.map((e) => e.from)
186
- : edges.map((e) => e.to)
187
- if (new Set(otherEndpoints).size !== otherEndpoints.length) return false
188
-
189
- // The duplicate check above only catches an *ordered*-pair duplicate. A
190
- // reverse-direction sibling (`B --> A` alongside `A --> B`, #629) reaches
191
- // a fan-in/fan-out group with a *distinct* other endpoint and slips past
192
- // it, even though assignParallelEdgeLanes has already committed that pair
193
- // to two distinct lanes — and a lane is a fixed offset from the pair's
194
- // own center path, not from wherever a trunk would have moved its sibling
195
- // to. So no edge assigned to a lane group ever gets bundled.
196
- //
197
- // Defensive: currently unreachable, and deliberately kept anyway. A
198
- // reverse-direction lane is only assigned when the pair sits side by side
199
- // on one grid row (edge-routing.ts's sharesHorizontalChannel), which is
200
- // exactly what the rank-ordering check below already rejects — every
201
- // source must be strictly above the shared target (or every target
202
- // strictly below the shared source). Those two conditions happen to be
203
- // complementary today; nothing structural keeps them that way.
204
- /* v8 ignore next */
205
- if (edges.some((e) => e.parallelLane)) return false
206
-
207
- // Bundling assumes every source sits strictly before the shared target
208
- // along the graph-direction axis for fan-in (TD: above it; LR: left of
209
- // it), or every target sits strictly after the shared source for
210
- // fan-out — calculateJunctionPoint places the junction on that side of
211
- // the shared node and routeBundledEdges exits/enters it accordingly. The
212
- // grid layout can violate that: a node's rank gets pinned by whichever
213
- // incoming edge's source is placed first (placeReachableChildren in
214
- // grid.ts never revisits an already-placed node), so a "diamond" like
215
- // `Queue --> Worker` plus `Queue --> Retry --> Worker` can leave Worker
216
- // at the SAME rank as Retry instead of one rank after it (#454).
217
- // Bundling that pair would route Retry's edge through the same
218
- // trunk+arrowhead as Queue's, silently swallowing Retry's own arrowhead
219
- // into a line that looks like it belongs solely to Queue. Refuse to
220
- // bundle whenever any edge doesn't actually satisfy the "before the
221
- // target" / "after the source" assumption; routed independently instead,
222
- // it gets its own distinct, visible arrowhead into/out of the shared node.
223
- // `analyzeEdgeBundles` (this function's only caller) already gates on
224
- // `graphDirection === 'TD'` before ever calling `canBundle`, so the 'LR'
225
- // arm is unreachable today — kept for whenever LR bundling support
226
- // lands, matching this comment block's own "TD: above it; LR: left of
227
- // it" framing above.
228
- /* v8 ignore next */
229
- const axis: 'x' | 'y' = graph.config.graphDirection === 'LR' ? 'x' : 'y'
230
- const sharedNode = sameTarget ? edges[0]!.to : edges[0]!.from
231
- const sharedCoord = sharedNode.gridCoord
232
- // Grid layout always runs before bundling — every node reaching this
233
- // point has a gridCoord (see `requireGridCoord`'s own use lower in this
234
- // file for the same assumption). Defensive only; not reachable from any
235
- // real diagram.
236
- /* v8 ignore next */
237
- if (!sharedCoord) return false
238
- for (const edge of edges) {
239
- const otherNode = sameTarget ? edge.from : edge.to
240
- const otherCoord = otherNode.gridCoord
241
- /* v8 ignore next */
242
- if (!otherCoord) return false
243
- if (sameTarget) {
244
- // fan-in: source must be strictly before the shared target
245
- if (otherCoord[axis] >= sharedCoord[axis]) return false
246
- } else {
247
- // fan-out: target must be strictly after the shared source. The
248
- // fan-in violation above is reachable via a plain diamond (a shared
249
- // target reached both directly and via a detour — see #454's own
250
- // repro and this file's regression test) because rank assignment
251
- // can shortchange whichever of two *competing parents* gets visited
252
- // second. The mirror-image fan-out violation would need a target's
253
- // rank to land at or before its own source's — topologically only
254
- // possible with an actual cycle, not exercised by any sample in
255
- // this repo. Kept for symmetry with the fan-in case above (and
256
- // because a cycle isn't inherently invalid mermaid syntax) rather
257
- // than assumed impossible.
258
- /* v8 ignore next */
259
- if (otherCoord[axis] <= sharedCoord[axis]) return false
260
- }
261
- }
262
-
263
- return true
264
- }
265
-
266
- // ============================================================================
267
- // Junction point calculation
268
- // ============================================================================
269
-
270
- /**
271
- * Calculate the optimal junction point for a bundle.
272
- *
273
- * For fan-in (A & B --> C):
274
- * - Junction is placed between the sources and the target
275
- * - In TD: above the target, horizontally centered between sources
276
- * - In LR: left of the target, vertically centered between sources
277
- *
278
- * For fan-out (A --> B & C):
279
- * - Junction is placed between the source and the targets
280
- * - In TD: below the source, horizontally centered between targets
281
- * - In LR: right of the source, vertically centered between targets
282
- */
283
- export function calculateJunctionPoint(
284
- graph: AsciiGraph,
285
- bundle: EdgeBundle,
286
- ): GridCoord {
287
- const dir = graph.config.graphDirection
288
- const sharedCoord = requireGridCoord(bundle.sharedNode)
289
-
290
- if (bundle.type === 'fan-in') {
291
- // Junction is BEFORE the shared target
292
- // Calculate center of sources
293
- if (dir === 'TD') {
294
- // Junction above target, centered between sources
295
- // Place it one row above the target's entry point
296
- const junctionY = sharedCoord.y - 1
297
- // X is centered between sources, but clamped to shared node's X for alignment
298
- const junctionX = sharedCoord.x + 1 // Align with target's center
299
-
300
- return { x: junctionX, y: junctionY }
301
- } else {
302
- // LR: Junction left of target, centered between sources
303
- const junctionX = sharedCoord.x - 1
304
- const junctionY = sharedCoord.y + 1 // Align with target's center
305
-
306
- return { x: junctionX, y: junctionY }
307
- }
308
- } else {
309
- // fan-out: Junction is AFTER the shared source
310
- if (dir === 'TD') {
311
- // Junction below source, will then split to targets
312
- const junctionY = sharedCoord.y + 3 // Just below source's 3x3 block
313
- const junctionX = sharedCoord.x + 1 // Align with source's center
314
-
315
- return { x: junctionX, y: junctionY }
316
- } else {
317
- // LR: Junction right of source
318
- const junctionX = sharedCoord.x + 3
319
- const junctionY = sharedCoord.y + 1
320
-
321
- return { x: junctionX, y: junctionY }
322
- }
323
- }
324
- }
325
-
326
- // ============================================================================
327
- // Bundled edge routing
328
- // ============================================================================
329
-
330
- /**
331
- * Route all edges in a bundle through the junction point.
332
- *
333
- * For fan-in bundles:
334
- * 1. Route each source → junction (stored in edge.pathToJunction)
335
- * 2. Route junction → target (stored in bundle.sharedPath)
336
- *
337
- * For fan-out bundles:
338
- * 1. Route source → junction (stored in bundle.sharedPath)
339
- * 2. Route junction → each target (stored in edge.pathToJunction)
340
- */
341
- export function routeBundledEdges(graph: AsciiGraph, bundle: EdgeBundle): void {
342
- const dir = graph.config.graphDirection
343
-
344
- // Calculate and store junction point
345
- bundle.junctionPoint = calculateJunctionPoint(graph, bundle)
346
- const junction = bundle.junctionPoint
347
-
348
- // Determine directions based on graph direction and bundle type
349
- if (bundle.type === 'fan-in') {
350
- // Sources converge to junction, then junction to target
351
- bundle.junctionDir = dir === 'TD' ? Up : Left
352
- bundle.sharedNodeDir = dir === 'TD' ? Down : Right
353
-
354
- // Route junction → target (shared path). Anchor offsets (top/left
355
- // center of target, bottom/right center of source below) are computed
356
- // via gridCoordDirection — the same per-direction offset edge-routing.ts
357
- // uses — instead of each bundling call reimplementing its own
358
- // arithmetic. routeEdge (pathfinder.ts, also used by edge-routing.ts)
359
- // tries an unobstructed direct path before falling back to A*. Note
360
- // that `targetDir` here is the *arrival* anchor at the target, not
361
- // necessarily the true departure direction from `junction` — routeEdge
362
- // handles that by trying both L-corner orientations internally (see
363
- // tryDirectPath in pathfinder.ts) rather than trusting this value as a
364
- // routing axis.
365
- const targetCoord = requireGridCoord(bundle.sharedNode)
366
- const targetDir: CardinalDirection = requireCardinalDirection(
367
- dir === 'TD' ? Up : Left,
368
- )
369
- const targetEntry = gridCoordDirection(targetCoord, targetDir)
370
-
371
- const sharedPath = routeEdge(graph, junction, targetEntry, targetDir)
372
- bundle.sharedPath = sharedPath ?? [junction, targetEntry]
373
-
374
- // Route each source → junction
375
- for (const edge of bundle.edges) {
376
- const sourceCoord = requireGridCoord(edge.from)
377
- const sourceDir: CardinalDirection = requireCardinalDirection(
378
- dir === 'TD' ? Down : Right,
379
- )
380
- const sourceExit = gridCoordDirection(sourceCoord, sourceDir)
381
-
382
- const pathToJunction = routeEdge(graph, sourceExit, junction, sourceDir)
383
- edge.pathToJunction = pathToJunction ?? [sourceExit, junction]
384
-
385
- // Set edge directions for proper drawing
386
- edge.startDir = sourceDir
387
- edge.endDir = targetDir
388
-
389
- // Build full path for grid size calculation: source → junction → target
390
- edge.path = [...edge.pathToJunction, ...bundle.sharedPath.slice(1)]
391
- }
392
- } else {
393
- // fan-out: Source to junction, then junction splits to targets
394
- bundle.junctionDir = dir === 'TD' ? Down : Right
395
- bundle.sharedNodeDir = dir === 'TD' ? Up : Left
396
-
397
- // Route source → junction (shared path)
398
- const sourceCoord = requireGridCoord(bundle.sharedNode)
399
- const sourceDir: CardinalDirection = requireCardinalDirection(
400
- dir === 'TD' ? Down : Right,
401
- )
402
- const sourceExit = gridCoordDirection(sourceCoord, sourceDir)
403
-
404
- const sharedPath = routeEdge(graph, sourceExit, junction, sourceDir)
405
- bundle.sharedPath = sharedPath ?? [sourceExit, junction]
406
-
407
- // Route junction → each target
408
- for (const edge of bundle.edges) {
409
- const targetCoord = requireGridCoord(edge.to)
410
- const targetDir: CardinalDirection = requireCardinalDirection(
411
- dir === 'TD' ? Up : Left,
412
- )
413
- const targetEntry = gridCoordDirection(targetCoord, targetDir)
414
-
415
- const pathToJunction = routeEdge(graph, junction, targetEntry, targetDir)
416
- edge.pathToJunction = pathToJunction ?? [junction, targetEntry]
417
-
418
- // Set edge directions
419
- edge.startDir = sourceDir
420
- edge.endDir = targetDir
421
-
422
- // Build full path for grid size calculation: source → junction → target
423
- edge.path = [...bundle.sharedPath, ...edge.pathToJunction.slice(1)]
424
- }
425
- }
426
- }
427
-
428
- /**
429
- * Process all bundles in a graph: calculate junction points and route edges.
430
- */
431
- export function processBundles(graph: AsciiGraph): void {
432
- for (const bundle of graph.bundles) {
433
- routeBundledEdges(graph, bundle)
434
- }
435
- }
@@ -1,81 +0,0 @@
1
- // ============================================================================
2
- // ASCII renderer — cross-style edge overlap detection
3
- //
4
- // `graph.grid` (grid-occupancy.ts) only tracks *node* occupancy, so two
5
- // unrelated edges (different source and target — no reason for
6
- // `analyzeEdgeBundles` to group them, and A* itself only avoids node cells)
7
- // can independently route through the same empty cell. When both edges have
8
- // the *same* line style that's harmless — it just looks like one clean
9
- // shared line, which `analyzeEdgeBundles`'s "LR routing handles merging
10
- // naturally at corners" comment and its own trunk-sharing tests rely on
11
- // intentionally. It's only a real defect when the styles *differ*: a solid
12
- // cell and a dotted cell can't both be drawn at the same grid position, so
13
- // one silently overwrites the other and the reader can't tell two distinct
14
- // connections are there at all.
15
- //
16
- // This module tracks, per *open, non-node* cell, which single style has
17
- // claimed it (first claim wins) so grid.ts can detect a genuine cross-style
18
- // collision after routing an edge and reroute just that edge around it —
19
- // see `rerouteAroundStyleConflicts` in grid.ts.
20
- //
21
- // Node-occupied cells are deliberately excluded from tracking: an edge's
22
- // path always includes its own source/target node's border cell (that's
23
- // how it connects to the box at all), so two edges sharing a node — one
24
- // incoming, one outgoing, as in a retry loop's `B -->|No| D; D -.-> A` —
25
- // legitimately share that exact port cell. The character actually drawn
26
- // there comes from the node's own box-drawing code, not either edge's line
27
- // style, so it was never a real conflict. Blocking it wouldn't even help:
28
- // an edge always returns to its own node's fixed attachment point
29
- // regardless of grid occupancy, so re-routing around a node-owned "conflict"
30
- // just finds the identical cell again on every retry.
31
- // ============================================================================
32
-
33
- import type { AsciiEdgeStyle, GridCoord } from './types.ts'
34
- import { gridKey } from './types.ts'
35
- import { isOccupied, pathCells, type Grid } from './grid-occupancy.ts'
36
-
37
- /** Cells already claimed by a drawn edge, keyed by "x,y", storing which
38
- * single line style is drawn there. */
39
- export type EdgeCellStyles = Map<string, AsciiEdgeStyle>
40
-
41
- export function createEdgeCellStyles(): EdgeCellStyles {
42
- return new Map()
43
- }
44
-
45
- /**
46
- * The first open (non-node-occupied) cell in `path` already claimed by a
47
- * *different* style than `style`. Same-style overlap is not reported — see
48
- * module doc.
49
- */
50
- export function findStyleConflict(
51
- grid: Grid,
52
- cellStyles: EdgeCellStyles,
53
- path: readonly GridCoord[],
54
- style: AsciiEdgeStyle,
55
- ): GridCoord | null {
56
- for (const cell of pathCells(path)) {
57
- if (isOccupied(grid, cell)) continue
58
- const existing = cellStyles.get(gridKey(cell))
59
- if (existing !== undefined && existing !== style) return cell
60
- }
61
- return null
62
- }
63
-
64
- /**
65
- * Record every open (non-node-occupied) cell in `path` as claimed by
66
- * `style`. First claim per cell wins — a later same-style edge through the
67
- * same cell is a harmless no-op, and a later different-style edge is
68
- * caught by `findStyleConflict` before this ever runs for it.
69
- */
70
- export function claimPathCells(
71
- grid: Grid,
72
- cellStyles: EdgeCellStyles,
73
- path: readonly GridCoord[],
74
- style: AsciiEdgeStyle,
75
- ): void {
76
- for (const cell of pathCells(path)) {
77
- if (isOccupied(grid, cell)) continue
78
- const key = gridKey(cell)
79
- if (!cellStyles.has(key)) cellStyles.set(key, style)
80
- }
81
- }