@zombie-mermaid/ascii-renderer 2.2.1 → 3.0.0

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 (33) hide show
  1. package/README.md +46 -0
  2. package/dist/index.cjs +7 -7
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +1245 -1203
  5. package/dist/index.js.map +1 -1
  6. package/package.json +9 -4
  7. package/src/__tests__/ascii-decision-lr-box-start.test.ts +1 -1
  8. package/src/__tests__/ascii-er-attribute-column-order-1134.test.ts +69 -0
  9. package/src/__tests__/ascii-er-corner-glyphs.test.ts +27 -4
  10. package/src/__tests__/ascii-er-relationship-label-corruption-350.test.ts +13 -3
  11. package/src/__tests__/ascii-er-relationship-overwrite.test.ts +107 -0
  12. package/src/__tests__/ascii-er-stray-connectors.test.ts +15 -9
  13. package/src/__tests__/ascii-sequence-activation.test.ts +171 -0
  14. package/src/__tests__/ascii-shape-diamond.test.ts +1 -1
  15. package/src/__tests__/ascii-shape-rounded.test.ts +1 -1
  16. package/src/__tests__/ascii-shapes-circle.test.ts +1 -1
  17. package/src/__tests__/ascii-shapes-hexagon.test.ts +1 -1
  18. package/src/__tests__/ascii-shapes-special.test.ts +35 -0
  19. package/src/__tests__/ascii-validate.test.ts +1 -42
  20. package/src/__tests__/ascii.test.ts +1 -1
  21. package/src/__tests__/testdata/ascii/er_attributes.txt +9 -9
  22. package/src/__tests__/testdata/ascii/er_identifying.txt +8 -8
  23. package/src/__tests__/testdata/unicode/er_attributes.txt +9 -9
  24. package/src/__tests__/testdata/unicode/er_identifying.txt +8 -8
  25. package/src/{validate.ts → __tests__/validate.ts} +3 -40
  26. package/src/draw-boxes.ts +14 -0
  27. package/src/er-diagram.ts +134 -31
  28. package/src/sequence.ts +87 -1
  29. package/src/shapes/index.ts +47 -5
  30. package/src/shapes/circle.ts +0 -31
  31. package/src/shapes/diamond.ts +0 -31
  32. package/src/shapes/hexagon.ts +0 -35
  33. package/src/shapes/rounded.ts +0 -31
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @zombie-mermaid/ascii-renderer
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@zombie-mermaid/ascii-renderer.svg)](https://www.npmjs.com/package/@zombie-mermaid/ascii-renderer)
4
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+
6
+ Render [Mermaid](https://mermaid.js.org/) diagrams to ASCII or Unicode box-drawing art — the standalone renderer behind [`zombie-mermaid`](https://www.npmjs.com/package/zombie-mermaid)'s `zombie-mermaid/ascii` entry point. Pure TypeScript, no DOM, no `elkjs`/SVG layout dependency — pull this in on its own when all you need is terminal output.
7
+
8
+ Supports flowcharts, state diagrams, sequence diagrams, class diagrams, ER diagrams, and XY charts.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @zombie-mermaid/ascii-renderer
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ import { renderMermaidASCII } from '@zombie-mermaid/ascii-renderer'
20
+
21
+ const ascii = renderMermaidASCII('graph LR\n A --> B')
22
+ console.log(ascii)
23
+ ```
24
+
25
+ ```ts
26
+ const text = 'graph LR\n A --> B'
27
+
28
+ renderMermaidASCII(text, {
29
+ useAscii: false, // true = plain ASCII (+,-,|,>), false = Unicode box-drawing (┌,─,│,►)
30
+ paddingX: 5,
31
+ paddingY: 5,
32
+ boxBorderPadding: 1,
33
+ colorMode: 'auto', // 'none' | 'auto' | 'ansi16' | 'ansi256' | 'truecolor' | 'html'
34
+ theme: {/* partial AsciiTheme override */},
35
+ })
36
+ ```
37
+
38
+ See `AsciiRenderOptions` in [`src/index.ts`](src/index.ts) for the full option set (color mode, theme, hyperlinks, direction override, coordinate overlay).
39
+
40
+ ## Relationship to `zombie-mermaid`
41
+
42
+ This package is one of the internal pieces `zombie-mermaid` is built from (alongside `@zombie-mermaid/core` and `@zombie-mermaid/mermaid-parser`, which stay internal-only). Installing `zombie-mermaid` and using `zombie-mermaid/ascii` pulls in the exact same renderer — reach for this package directly only when you specifically don't want the SVG-rendering half of the umbrella package.
43
+
44
+ ## License
45
+
46
+ MIT — see [LICENSE](LICENSE).