zombie-mermaid 5.15.0 → 5.16.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.
- package/README.md +2 -2
- package/dist/ascii-layout.cjs +1 -1
- package/dist/ascii-layout.js +2 -2
- package/dist/cli.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +1 -1
- package/dist/mcp.js +1 -1
- package/dist/shared/ascii-layout.d.ts +1 -1
- package/dist/{src-pkQWSY51.cjs → src-BPQE98KC.cjs} +1 -1
- package/dist/{src-CsMv6Ia1.js → src-CDuA-5JU.js} +1 -1
- package/dist/{src-MFjqatSR.js → src-MQzfxgx9.js} +1 -1
- package/dist/src-Qo65SnxX.cjs +1 -0
- package/package.json +16 -11
- package/dist/src-D4LsWkIk.cjs +0 -1
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ the SVG renderer at all (see [ASCII Output](#ascii-output)).
|
|
|
86
86
|
|
|
87
87
|
## Features
|
|
88
88
|
|
|
89
|
-
- **
|
|
89
|
+
- **19 diagram types** — Flowcharts (including State), Sequence, Class, ER, XY Charts (bar, line, combined), Architecture, C4, Pie, Quadrant charts, Gantt charts, Mindmaps, Timelines, Requirement diagrams, Kanban boards, User Journeys, Radar charts, Packets, Git graphs, and Sankey diagrams
|
|
90
90
|
- **Dual output** — SVG for rich UIs, ASCII/Unicode for terminals
|
|
91
91
|
- **Synchronous rendering** — No async, no flash. Works with React `useMemo()`
|
|
92
92
|
- **15 built-in themes** — And dead simple to add your own
|
|
@@ -225,7 +225,7 @@ zombie-mermaid --help # Show all options
|
|
|
225
225
|
hyperlinks — off by default, since terminal and pager support varies (see
|
|
226
226
|
[ASCII terminal hyperlinks](docs/diagrams.md#ascii-terminal-hyperlinks)).
|
|
227
227
|
`--profile markdown` (with `--ascii`) emits plain ASCII characters with no color, for pasting into issues, commits and fenced blocks (the `profile` option in the library and the MCP `render_mermaid_ascii` tool).
|
|
228
|
-
`--layout mermaid` (with `--ascii`, opt-in) draws a flowchart from mermaid's own ELK layout instead of the grid renderer; the library equivalent is `renderMermaidASCIIWithLayout` from `zombie-mermaid/ascii-layout`. It needs the optional peer `elkjs-0.
|
|
228
|
+
`--layout mermaid` (with `--ascii`, opt-in) draws a flowchart from mermaid's own ELK layout instead of the grid renderer; the library equivalent is `renderMermaidASCIIWithLayout` from `zombie-mermaid/ascii-layout`. It needs the optional peer `elkjs-0.12.0` (`pnpm add elkjs-0.12.0@npm:elkjs@0.12.0`), which is loaded only when the flag is used. Diagrams with subgraphs or unmodelled shapes, non-flowchart diagrams, layout failures, and drawings that cannot fit 120 columns (`--layout mermaid-wide` / `maxCols: Infinity` keeps the wide text) fall back to the default renderer, and stderr (or the result's `fallbackReason`) says which one ran. Merged parallel edges hide edge multiplicity; results depend on mermaid 12.1.0 and elkjs 0.12.0. Not available in the MCP tool. See [known differences](docs/known-differences.md#ascii-opt-in-layout-faithful-mode---layout-mermaid).
|
|
229
229
|
|
|
230
230
|
**Output rules.** `-o` is the destination for the run's _file_ output — SVG, HTML, or PNG when `--svg`/`--html`/`--png` is given, otherwise the ASCII rendering — and `-o -` sends it to stdout instead. A recognised extension (`.svg`, `.html`/`.htm`, `.txt`, `.png`) picks the format on its own, so the flag can be dropped; an extension that contradicts an explicit flag (`--svg -o out.txt`) is an error, while unrecognised ones are simply used as given. `--svg`/`--html`/`--png` with no `-o` writes `<input stem>.svg`/`.html`/`.png` beside the input (stdin input has no name to derive from, so it must pass `-o`). Only one of `--svg`/`--html`/`--png` can be set at a time — run the command twice for more than one. ASCII always prints to the terminal when one of them is also requested (`--ascii --svg -o out.svg`), and never carries ANSI colour codes when written to a file. **An existing output file is never overwritten unless you pass `--force`/`-f`.**
|
|
231
231
|
|
package/dist/ascii-layout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@zombie-mermaid/ascii-renderer"),t=require("@zombie-mermaid/core");async function n(n,r={}){let{layout:i,maxCols:a,...o}=r,s=t=>({text:(0,e.renderMermaidASCII)(n,o),path:`standard`,...t===void 0?{}:{fallbackReason:t}});if(i!==`mermaid`)return s();let c=(0,t.detectDiagramType)(n);if(c!==`flowchart`)return s(`not applicable to ${c} diagrams (flowcharts only)`);let l,u;try{[l,u]=await Promise.all([Promise.resolve().then(()=>require("./src-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@zombie-mermaid/ascii-renderer"),t=require("@zombie-mermaid/core");async function n(n,r={}){let{layout:i,maxCols:a,...o}=r,s=t=>({text:(0,e.renderMermaidASCII)(n,o),path:`standard`,...t===void 0?{}:{fallbackReason:t}});if(i!==`mermaid`)return s();let c=(0,t.detectDiagramType)(n);if(c!==`flowchart`)return s(`not applicable to ${c} diagrams (flowcharts only)`);let l,u;try{[l,u]=await Promise.all([Promise.resolve().then(()=>require("./src-Qo65SnxX.cjs")),Promise.resolve().then(()=>require("./src-BPQE98KC.cjs"))])}catch{return s(`elkjs 0.12.0 is not installed (pnpm add elkjs-0.12.0@npm:elkjs@0.12.0)`)}try{let e=await u.renderFlowchartAscii(n,a===void 0?void 0:{maxCols:a});return e.capped?{text:e.text,path:`layout-faithful`,note:e.note}:s(`layout-faithful output is ${e.stats.naturalCols} columns, over the ${a??u.DEFAULT_MAX_COLS}-column cap`)}catch(e){return e instanceof l.UnsupportedFlowchartError?s(`unsupported (${e.reasons.join(`; `)})`):s(`layout failed (${e instanceof Error?e.message:String(e)})`)}}exports.renderMermaidASCIIWithLayout=n;
|
package/dist/ascii-layout.js
CHANGED
|
@@ -12,9 +12,9 @@ async function n(n, r = {}) {
|
|
|
12
12
|
if (c !== "flowchart") return s(`not applicable to ${c} diagrams (flowcharts only)`);
|
|
13
13
|
let l, u;
|
|
14
14
|
try {
|
|
15
|
-
[l, u] = await Promise.all([import("./src-
|
|
15
|
+
[l, u] = await Promise.all([import("./src-CDuA-5JU.js"), import("./src-MQzfxgx9.js")]);
|
|
16
16
|
} catch {
|
|
17
|
-
return s("elkjs 0.
|
|
17
|
+
return s("elkjs 0.12.0 is not installed (pnpm add elkjs-0.12.0@npm:elkjs@0.12.0)");
|
|
18
18
|
}
|
|
19
19
|
try {
|
|
20
20
|
let e = await u.renderFlowchartAscii(n, a === void 0 ? void 0 : { maxCols: a });
|
package/dist/cli.js
CHANGED
|
@@ -338,7 +338,7 @@ var F = (e) => {
|
|
|
338
338
|
}
|
|
339
339
|
}, I = {
|
|
340
340
|
graph: (e) => F(() => {
|
|
341
|
-
let t = _(e);
|
|
341
|
+
let t = _(e, { legacyNodeSizes: !0 });
|
|
342
342
|
return P(t.nodes.map((e) => ({
|
|
343
343
|
id: e.id,
|
|
344
344
|
cx: e.x + e.width / 2,
|
|
@@ -487,7 +487,7 @@ async function Se(e, t, n, i) {
|
|
|
487
487
|
layout: "mermaid",
|
|
488
488
|
maxCols: n
|
|
489
489
|
});
|
|
490
|
-
a = o.text, s = o.path === "layout-faithful", i.write(s ? `layout-faithful: used mermaid's ELK layout (mermaid 12.
|
|
490
|
+
a = o.text, s = o.path === "layout-faithful", i.write(s ? `layout-faithful: used mermaid's ELK layout (mermaid 12.3.0 + elkjs 0.12.0). ${o.note ?? ""}`.trimEnd() + "\n" : `layout-faithful: ${o.fallbackReason ?? "unavailable"}; used standard renderer\n`);
|
|
491
491
|
} else a = m(t, r);
|
|
492
492
|
if (e.maxWidth !== void 0) {
|
|
493
493
|
let n = G(e.maxWidth), o = W(a), c = !1;
|
|
@@ -783,7 +783,7 @@ async function $() {
|
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
function Ve() {
|
|
786
|
-
console.log("zombie-mermaid — render Mermaid diagrams from the command line\n\nUsage:\n zombie-mermaid render <file> --ascii Render to ASCII in terminal\n zombie-mermaid render <file> --svg Render to <file stem>.svg\n zombie-mermaid render <file> --svg -o <out.svg> Render to a named SVG file\n zombie-mermaid render <file> -o out.svg Format inferred from the extension\n zombie-mermaid render <file> --svg -o - Write SVG to stdout\n zombie-mermaid render <file> --ascii --svg -o <out.svg> Both (ASCII to terminal)\n zombie-mermaid render <file> --html Self-contained pan/zoom HTML viewer\n zombie-mermaid render <file> --png Rasterize to <file stem>.png\n cat file.mmd | zombie-mermaid render --ascii Read from stdin\n zombie-mermaid validate [file] Parse only; exit 1 with line diagnostics if invalid\n zombie-mermaid --check <file.md>... Validate every mermaid fenced block in Markdown; exit 1 with file:line diagnostics\n zombie-mermaid themes List available themes\n zombie-mermaid web [--port <n>] Start a local web UI (default port: 3000)\n zombie-mermaid mcp Start an MCP server on stdio (render tools)\n zombie-mermaid --help Show this help\n zombie-mermaid --version Show version\n\nOptions:\n --ascii Print ASCII/Unicode diagram to terminal, or to -o <file.txt>\n when it is the only format\n --svg Render SVG to -o <path> (default: <input stem>.svg;\n stdin input must give -o)\n --resolve-colors Replace CSS var()/color-mix() in the SVG with computed\n sRGB values, for rasterizers and other non-browser SVG\n consumers (resvg, librsvg, Inkscape) that don't\n evaluate them. The default output stays a live function\n of its CSS variables. Requires --svg.\n --html Render a self-contained HTML pan/zoom viewer to -o\n <path> (default: <input stem>.html). Embeds the SVG;\n no server, no network, opens from disk. Cannot be\n combined with --svg/--png (different content, same\n slot).\n --png Rasterize to PNG at -o <path> (default: <input\n stem>.png), via the optional @resvg/resvg-js native\n dependency — install it with `pnpm add\n @resvg/resvg-js` if it's missing. Always resolves\n CSS var()/color-mix() first (as --resolve-colors\n does for --svg), since a rasterizer can't evaluate\n them. 1:1 with the SVG's own pixel size, no scaling.\n Cannot be combined with --svg/--html.\n -o, --output <path> Output file for the SVG/HTML/PNG (or for ASCII when\n none of those is given). '-' writes to stdout. A\n .svg, .html, .txt, or .png extension selects the\n format when no --svg/--html/--png/--ascii flag is\n given; one that contradicts the flags is an error.\n Existing files are never overwritten without --force.\n -f, --force Overwrite an existing output file\n --theme <name> Apply a built-in theme (see 'themes' command)\n --direction <dir> Override the diagram's layout direction: TD, TB, BT, LR, or RL\n (flowchart, state, and ER diagrams; nested subgraph\n directions still apply on top of it)\n -x, --paddingX <n> Horizontal spacing between nodes (ASCII, default: 5)\n -y, --paddingY <n> Vertical spacing between nodes (ASCII, default: 5; LR/RL sibling gap is n-1, min 1)\n -p, --borderPadding <n> Padding inside node boxes (ASCII, default: 1)\n --coords Overlay row/column index rulers (ASCII, debug layout)\n --hyperlinks Emit OSC 8 terminal hyperlinks for `click` hrefs\n (ASCII). Off by default: terminal support varies —\n iTerm2, WezTerm, kitty, Windows Terminal, and\n VTE-based terminals render them as clickable links;\n others may show the URL or nothing. Pagers need\n OSC 8 support too (`less -R`, recent versions).\n --profile <name> ASCII preset: 'markdown' = plain ASCII characters, no\n color, for pasting into issues/commits/fenced blocks\n (explicit flags like --coords still win). Requires\n --ascii.\n -w, --max-width <n|auto> Fit ASCII output within this many columns\n ('auto' detects the terminal width): applies compact\n spacing automatically when needed, and warns on\n stderr if it still doesn't fit (no label wrapping or\n direction-flip — see issue #335).\n --layout mermaid Opt in (flowcharts, --ascii): draw mermaid's own ELK layout\n instead of the grid renderer. Subgraphs, some shapes,\n other diagram types, layout failures and drawings that\n cannot fit 120 columns (or -w <n>, used as the cap)\n fall back to the default renderer; stderr says which\n one ran. --layout mermaid-wide drops the cap and always\n draws the (possibly wide) layout-faithful text. Merged\n parallel edges hide edge multiplicity. Depends on\n mermaid 12.
|
|
786
|
+
console.log("zombie-mermaid — render Mermaid diagrams from the command line\n\nUsage:\n zombie-mermaid render <file> --ascii Render to ASCII in terminal\n zombie-mermaid render <file> --svg Render to <file stem>.svg\n zombie-mermaid render <file> --svg -o <out.svg> Render to a named SVG file\n zombie-mermaid render <file> -o out.svg Format inferred from the extension\n zombie-mermaid render <file> --svg -o - Write SVG to stdout\n zombie-mermaid render <file> --ascii --svg -o <out.svg> Both (ASCII to terminal)\n zombie-mermaid render <file> --html Self-contained pan/zoom HTML viewer\n zombie-mermaid render <file> --png Rasterize to <file stem>.png\n cat file.mmd | zombie-mermaid render --ascii Read from stdin\n zombie-mermaid validate [file] Parse only; exit 1 with line diagnostics if invalid\n zombie-mermaid --check <file.md>... Validate every mermaid fenced block in Markdown; exit 1 with file:line diagnostics\n zombie-mermaid themes List available themes\n zombie-mermaid web [--port <n>] Start a local web UI (default port: 3000)\n zombie-mermaid mcp Start an MCP server on stdio (render tools)\n zombie-mermaid --help Show this help\n zombie-mermaid --version Show version\n\nOptions:\n --ascii Print ASCII/Unicode diagram to terminal, or to -o <file.txt>\n when it is the only format\n --svg Render SVG to -o <path> (default: <input stem>.svg;\n stdin input must give -o)\n --resolve-colors Replace CSS var()/color-mix() in the SVG with computed\n sRGB values, for rasterizers and other non-browser SVG\n consumers (resvg, librsvg, Inkscape) that don't\n evaluate them. The default output stays a live function\n of its CSS variables. Requires --svg.\n --html Render a self-contained HTML pan/zoom viewer to -o\n <path> (default: <input stem>.html). Embeds the SVG;\n no server, no network, opens from disk. Cannot be\n combined with --svg/--png (different content, same\n slot).\n --png Rasterize to PNG at -o <path> (default: <input\n stem>.png), via the optional @resvg/resvg-js native\n dependency — install it with `pnpm add\n @resvg/resvg-js` if it's missing. Always resolves\n CSS var()/color-mix() first (as --resolve-colors\n does for --svg), since a rasterizer can't evaluate\n them. 1:1 with the SVG's own pixel size, no scaling.\n Cannot be combined with --svg/--html.\n -o, --output <path> Output file for the SVG/HTML/PNG (or for ASCII when\n none of those is given). '-' writes to stdout. A\n .svg, .html, .txt, or .png extension selects the\n format when no --svg/--html/--png/--ascii flag is\n given; one that contradicts the flags is an error.\n Existing files are never overwritten without --force.\n -f, --force Overwrite an existing output file\n --theme <name> Apply a built-in theme (see 'themes' command)\n --direction <dir> Override the diagram's layout direction: TD, TB, BT, LR, or RL\n (flowchart, state, and ER diagrams; nested subgraph\n directions still apply on top of it)\n -x, --paddingX <n> Horizontal spacing between nodes (ASCII, default: 5)\n -y, --paddingY <n> Vertical spacing between nodes (ASCII, default: 5; LR/RL sibling gap is n-1, min 1)\n -p, --borderPadding <n> Padding inside node boxes (ASCII, default: 1)\n --coords Overlay row/column index rulers (ASCII, debug layout)\n --hyperlinks Emit OSC 8 terminal hyperlinks for `click` hrefs\n (ASCII). Off by default: terminal support varies —\n iTerm2, WezTerm, kitty, Windows Terminal, and\n VTE-based terminals render them as clickable links;\n others may show the URL or nothing. Pagers need\n OSC 8 support too (`less -R`, recent versions).\n --profile <name> ASCII preset: 'markdown' = plain ASCII characters, no\n color, for pasting into issues/commits/fenced blocks\n (explicit flags like --coords still win). Requires\n --ascii.\n -w, --max-width <n|auto> Fit ASCII output within this many columns\n ('auto' detects the terminal width): applies compact\n spacing automatically when needed, and warns on\n stderr if it still doesn't fit (no label wrapping or\n direction-flip — see issue #335).\n --layout mermaid Opt in (flowcharts, --ascii): draw mermaid's own ELK layout\n instead of the grid renderer. Subgraphs, some shapes,\n other diagram types, layout failures and drawings that\n cannot fit 120 columns (or -w <n>, used as the cap)\n fall back to the default renderer; stderr says which\n one ran. --layout mermaid-wide drops the cap and always\n draws the (possibly wide) layout-faithful text. Merged\n parallel edges hide edge multiplicity. Depends on\n mermaid 12.3.0 + elkjs 0.12.0: install the optional peer\n with `pnpm add elkjs-0.12.0@npm:elkjs@0.12.0`. -x/-y/-p\n and --coords do not apply to the layout-faithful drawing.\n --port <n> Port for the 'web' command (default: 3000)\n -h, --help Show help\n -v, --version Show version");
|
|
787
787
|
}
|
|
788
788
|
$();
|
|
789
789
|
//#endregion
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@zombie-mermaid/ascii-renderer"),t=require("@zombie-mermaid/svg-renderer"),n=require("@zombie-mermaid/core"),r=require("@zombie-mermaid/mermaid-parser");var i=.5,a=(e,t,n)=>{if(e.diamond){let[r,i,a]=n?[t.x-e.cx,e.w/2,t.y-e.cy]:[t.y-e.cy,e.h/2,t.x-e.cx];return Math.abs(r)/i>=.49?n?r<0?`L`:`R`:r<0?`T`:`B`:n?a<0?`T`:`B`:a<0?`L`:`R`}let r={T:Math.abs(t.y-(e.cy-e.h/2)),B:Math.abs(t.y-(e.cy+e.h/2)),L:Math.abs(t.x-(e.cx-e.w/2)),R:Math.abs(t.x-(e.cx+e.w/2))};return Object.keys(r).reduce((e,t)=>r[t]<r[e]?t:e)};function o(e,t,n){let r=n===`LR`||n===`RL`,o=e=>r?e.cx:e.cy,s=e=>r?e.cy:e.cx,c=e=>(r?e.w:e.h)/2,l=[...e].sort((e,t)=>o(e)-o(t)),u=new Map,d=-1,f,p=(e,t)=>Math.abs(e-t)<=20;for(let e of l)(!f||!(p(o(e),o(f))||p(o(e)-c(e),o(f)-c(f))||p(o(e)+c(e),o(f)+c(f))))&&(d++,f=e),u.set(e.id,d);let m=d,h=n===`RL`||n===`BT`,g=new Map,_=new Map;for(let t of[...e].sort((e,t)=>s(e)-s(t))){let e=u.get(t.id),n=_.get(e)??0;_.set(e,n+1),g.set(t.id,{layer:h?m-e:e,order:n,cross:s(t),size:r?t.h:t.w})}let v=new Map(e.map(e=>[e.id,e])),y=new Map,b=t.map((e,t)=>{let n=v.get(e.from),i=v.get(e.to);if(!n||!i||e.points.length<2)return;let o=e.points[0],s=e.points[e.points.length-1],c=(e,n,i)=>{let o=a(e,n,r),s={edge:t,start:i,face:o,at:o===`T`||o===`B`?n.x:n.y},c=`${e.id}|${o}`;return y.set(c,[...y.get(c)??[],s]),s};return{p:e,s:c(n,o,!0),e:c(i,s,!1)}}),x=(e,t)=>{let n=[...y.get(`${e}|${t.face}`)].map(e=>e.at);return new Set(n.filter(e=>e<t.at-i)).size},S=[];return b.forEach((e,t)=>{e&&S.push({index:t,from:e.p.from,to:e.p.to,start:{face:e.s.face,order:x(e.p.from,e.s)},end:{face:e.e.face,order:x(e.p.to,e.e)}})}),{nodes:g,edges:S}}var s=e=>{try{return e()}catch(e){if(e instanceof t.ElkNotRegisteredError)return;throw e}},c={graph:e=>s(()=>{let n=(0,t.layoutFlowchartSync)(e);return o(n.nodes.map(e=>({id:e.id,cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width,h:e.height,diamond:e.shape===`diamond`})),n.edges.map(e=>({from:e.source,to:e.target,points:e.points})),e.direction)}),er:e=>s(()=>{let n=(0,t.layoutErDiagramSync)(e);return o(n.entities.map(e=>({id:e.id,cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width,h:e.height})),n.relationships.map(e=>({from:e.entity1,to:e.entity2,points:e.points})),e.direction??`TD`)})};function l(){(0,e.registerAsciiLayout)(c)}l(),Object.defineProperty(exports,"DEFAULTS",{enumerable:!0,get:function(){return n.DEFAULTS}}),Object.defineProperty(exports,"DEFAULT_RENDER_LIMITS",{enumerable:!0,get:function(){return n.DEFAULT_RENDER_LIMITS}}),Object.defineProperty(exports,"ElkNotRegisteredError",{enumerable:!0,get:function(){return t.ElkNotRegisteredError}}),Object.defineProperty(exports,"LimitExceededError",{enumerable:!0,get:function(){return n.LimitExceededError}}),Object.defineProperty(exports,"THEMES",{enumerable:!0,get:function(){return n.THEMES}}),Object.defineProperty(exports,"createLayoutCache",{enumerable:!0,get:function(){return t.createLayoutCache}}),Object.defineProperty(exports,"fromShikiTheme",{enumerable:!0,get:function(){return n.fromShikiTheme}}),Object.defineProperty(exports,"loadEmbeddedFont",{enumerable:!0,get:function(){return t.loadEmbeddedFont}}),Object.defineProperty(exports,"parseMermaid",{enumerable:!0,get:function(){return r.parseMermaid}}),Object.defineProperty(exports,"registerElk",{enumerable:!0,get:function(){return t.registerElk}}),Object.defineProperty(exports,"renderMermaid",{enumerable:!0,get:function(){return t.renderMermaid}}),Object.defineProperty(exports,"renderMermaidASCII",{enumerable:!0,get:function(){return e.renderMermaidASCII}}),Object.defineProperty(exports,"renderMermaidAscii",{enumerable:!0,get:function(){return e.renderMermaidAscii}}),Object.defineProperty(exports,"renderMermaidSVG",{enumerable:!0,get:function(){return t.renderMermaidSVG}}),Object.defineProperty(exports,"renderMermaidSVGAsync",{enumerable:!0,get:function(){return t.renderMermaidSVGAsync}}),Object.defineProperty(exports,"renderMermaidSync",{enumerable:!0,get:function(){return t.renderMermaidSync}}),Object.defineProperty(exports,"themeCssVariables",{enumerable:!0,get:function(){return t.themeCssVariables}}),Object.defineProperty(exports,"validateMermaid",{enumerable:!0,get:function(){return t.validateMermaid}});
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@zombie-mermaid/ascii-renderer"),t=require("@zombie-mermaid/svg-renderer"),n=require("@zombie-mermaid/core"),r=require("@zombie-mermaid/mermaid-parser");var i=.5,a=(e,t,n)=>{if(e.diamond){let[r,i,a]=n?[t.x-e.cx,e.w/2,t.y-e.cy]:[t.y-e.cy,e.h/2,t.x-e.cx];return Math.abs(r)/i>=.49?n?r<0?`L`:`R`:r<0?`T`:`B`:n?a<0?`T`:`B`:a<0?`L`:`R`}let r={T:Math.abs(t.y-(e.cy-e.h/2)),B:Math.abs(t.y-(e.cy+e.h/2)),L:Math.abs(t.x-(e.cx-e.w/2)),R:Math.abs(t.x-(e.cx+e.w/2))};return Object.keys(r).reduce((e,t)=>r[t]<r[e]?t:e)};function o(e,t,n){let r=n===`LR`||n===`RL`,o=e=>r?e.cx:e.cy,s=e=>r?e.cy:e.cx,c=e=>(r?e.w:e.h)/2,l=[...e].sort((e,t)=>o(e)-o(t)),u=new Map,d=-1,f,p=(e,t)=>Math.abs(e-t)<=20;for(let e of l)(!f||!(p(o(e),o(f))||p(o(e)-c(e),o(f)-c(f))||p(o(e)+c(e),o(f)+c(f))))&&(d++,f=e),u.set(e.id,d);let m=d,h=n===`RL`||n===`BT`,g=new Map,_=new Map;for(let t of[...e].sort((e,t)=>s(e)-s(t))){let e=u.get(t.id),n=_.get(e)??0;_.set(e,n+1),g.set(t.id,{layer:h?m-e:e,order:n,cross:s(t),size:r?t.h:t.w})}let v=new Map(e.map(e=>[e.id,e])),y=new Map,b=t.map((e,t)=>{let n=v.get(e.from),i=v.get(e.to);if(!n||!i||e.points.length<2)return;let o=e.points[0],s=e.points[e.points.length-1],c=(e,n,i)=>{let o=a(e,n,r),s={edge:t,start:i,face:o,at:o===`T`||o===`B`?n.x:n.y},c=`${e.id}|${o}`;return y.set(c,[...y.get(c)??[],s]),s};return{p:e,s:c(n,o,!0),e:c(i,s,!1)}}),x=(e,t)=>{let n=[...y.get(`${e}|${t.face}`)].map(e=>e.at);return new Set(n.filter(e=>e<t.at-i)).size},S=[];return b.forEach((e,t)=>{e&&S.push({index:t,from:e.p.from,to:e.p.to,start:{face:e.s.face,order:x(e.p.from,e.s)},end:{face:e.e.face,order:x(e.p.to,e.e)}})}),{nodes:g,edges:S}}var s=e=>{try{return e()}catch(e){if(e instanceof t.ElkNotRegisteredError)return;throw e}},c={graph:e=>s(()=>{let n=(0,t.layoutFlowchartSync)(e,{legacyNodeSizes:!0});return o(n.nodes.map(e=>({id:e.id,cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width,h:e.height,diamond:e.shape===`diamond`})),n.edges.map(e=>({from:e.source,to:e.target,points:e.points})),e.direction)}),er:e=>s(()=>{let n=(0,t.layoutErDiagramSync)(e);return o(n.entities.map(e=>({id:e.id,cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width,h:e.height})),n.relationships.map(e=>({from:e.entity1,to:e.entity2,points:e.points})),e.direction??`TD`)})};function l(){(0,e.registerAsciiLayout)(c)}l(),Object.defineProperty(exports,"DEFAULTS",{enumerable:!0,get:function(){return n.DEFAULTS}}),Object.defineProperty(exports,"DEFAULT_RENDER_LIMITS",{enumerable:!0,get:function(){return n.DEFAULT_RENDER_LIMITS}}),Object.defineProperty(exports,"ElkNotRegisteredError",{enumerable:!0,get:function(){return t.ElkNotRegisteredError}}),Object.defineProperty(exports,"LimitExceededError",{enumerable:!0,get:function(){return n.LimitExceededError}}),Object.defineProperty(exports,"THEMES",{enumerable:!0,get:function(){return n.THEMES}}),Object.defineProperty(exports,"createLayoutCache",{enumerable:!0,get:function(){return t.createLayoutCache}}),Object.defineProperty(exports,"fromShikiTheme",{enumerable:!0,get:function(){return n.fromShikiTheme}}),Object.defineProperty(exports,"loadEmbeddedFont",{enumerable:!0,get:function(){return t.loadEmbeddedFont}}),Object.defineProperty(exports,"parseMermaid",{enumerable:!0,get:function(){return r.parseMermaid}}),Object.defineProperty(exports,"registerElk",{enumerable:!0,get:function(){return t.registerElk}}),Object.defineProperty(exports,"renderMermaid",{enumerable:!0,get:function(){return t.renderMermaid}}),Object.defineProperty(exports,"renderMermaidASCII",{enumerable:!0,get:function(){return e.renderMermaidASCII}}),Object.defineProperty(exports,"renderMermaidAscii",{enumerable:!0,get:function(){return e.renderMermaidAscii}}),Object.defineProperty(exports,"renderMermaidSVG",{enumerable:!0,get:function(){return t.renderMermaidSVG}}),Object.defineProperty(exports,"renderMermaidSVGAsync",{enumerable:!0,get:function(){return t.renderMermaidSVGAsync}}),Object.defineProperty(exports,"renderMermaidSync",{enumerable:!0,get:function(){return t.renderMermaidSync}}),Object.defineProperty(exports,"themeCssVariables",{enumerable:!0,get:function(){return t.themeCssVariables}}),Object.defineProperty(exports,"validateMermaid",{enumerable:!0,get:function(){return t.validateMermaid}});
|
package/dist/index.js
CHANGED
package/dist/mcp.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=require("@zombie-mermaid/ascii-renderer"),t=require("@zombie-mermaid/svg-renderer");var n=.5,r=(e,t,n)=>{if(e.diamond){let[r,i,a]=n?[t.x-e.cx,e.w/2,t.y-e.cy]:[t.y-e.cy,e.h/2,t.x-e.cx];return Math.abs(r)/i>=.49?n?r<0?`L`:`R`:r<0?`T`:`B`:n?a<0?`T`:`B`:a<0?`L`:`R`}let r={T:Math.abs(t.y-(e.cy-e.h/2)),B:Math.abs(t.y-(e.cy+e.h/2)),L:Math.abs(t.x-(e.cx-e.w/2)),R:Math.abs(t.x-(e.cx+e.w/2))};return Object.keys(r).reduce((e,t)=>r[t]<r[e]?t:e)};function i(e,t,i){let a=i===`LR`||i===`RL`,o=e=>a?e.cx:e.cy,s=e=>a?e.cy:e.cx,c=e=>(a?e.w:e.h)/2,l=[...e].sort((e,t)=>o(e)-o(t)),u=new Map,d=-1,f,p=(e,t)=>Math.abs(e-t)<=20;for(let e of l)(!f||!(p(o(e),o(f))||p(o(e)-c(e),o(f)-c(f))||p(o(e)+c(e),o(f)+c(f))))&&(d++,f=e),u.set(e.id,d);let m=d,h=i===`RL`||i===`BT`,g=new Map,_=new Map;for(let t of[...e].sort((e,t)=>s(e)-s(t))){let e=u.get(t.id),n=_.get(e)??0;_.set(e,n+1),g.set(t.id,{layer:h?m-e:e,order:n,cross:s(t),size:a?t.h:t.w})}let v=new Map(e.map(e=>[e.id,e])),y=new Map,b=t.map((e,t)=>{let n=v.get(e.from),i=v.get(e.to);if(!n||!i||e.points.length<2)return;let o=e.points[0],s=e.points[e.points.length-1],c=(e,n,i)=>{let o=r(e,n,a),s={edge:t,start:i,face:o,at:o===`T`||o===`B`?n.x:n.y},c=`${e.id}|${o}`;return y.set(c,[...y.get(c)??[],s]),s};return{p:e,s:c(n,o,!0),e:c(i,s,!1)}}),x=(e,t)=>{let r=[...y.get(`${e}|${t.face}`)].map(e=>e.at);return new Set(r.filter(e=>e<t.at-n)).size},S=[];return b.forEach((e,t)=>{e&&S.push({index:t,from:e.p.from,to:e.p.to,start:{face:e.s.face,order:x(e.p.from,e.s)},end:{face:e.e.face,order:x(e.p.to,e.e)}})}),{nodes:g,edges:S}}var a=e=>{try{return e()}catch(e){if(e instanceof t.ElkNotRegisteredError)return;throw e}},o={graph:e=>a(()=>{let n=(0,t.layoutFlowchartSync)(e);return i(n.nodes.map(e=>({id:e.id,cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width,h:e.height,diamond:e.shape===`diamond`})),n.edges.map(e=>({from:e.source,to:e.target,points:e.points})),e.direction)}),er:e=>a(()=>{let n=(0,t.layoutErDiagramSync)(e);return i(n.entities.map(e=>({id:e.id,cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width,h:e.height})),n.relationships.map(e=>({from:e.entity1,to:e.entity2,points:e.points})),e.direction??`TD`)})};function s(){(0,e.registerAsciiLayout)(o)}s();var c=require("@zombie-mermaid/mcp");Object.keys(c).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return c[e]}})});
|
|
1
|
+
let e=require("@zombie-mermaid/ascii-renderer"),t=require("@zombie-mermaid/svg-renderer");var n=.5,r=(e,t,n)=>{if(e.diamond){let[r,i,a]=n?[t.x-e.cx,e.w/2,t.y-e.cy]:[t.y-e.cy,e.h/2,t.x-e.cx];return Math.abs(r)/i>=.49?n?r<0?`L`:`R`:r<0?`T`:`B`:n?a<0?`T`:`B`:a<0?`L`:`R`}let r={T:Math.abs(t.y-(e.cy-e.h/2)),B:Math.abs(t.y-(e.cy+e.h/2)),L:Math.abs(t.x-(e.cx-e.w/2)),R:Math.abs(t.x-(e.cx+e.w/2))};return Object.keys(r).reduce((e,t)=>r[t]<r[e]?t:e)};function i(e,t,i){let a=i===`LR`||i===`RL`,o=e=>a?e.cx:e.cy,s=e=>a?e.cy:e.cx,c=e=>(a?e.w:e.h)/2,l=[...e].sort((e,t)=>o(e)-o(t)),u=new Map,d=-1,f,p=(e,t)=>Math.abs(e-t)<=20;for(let e of l)(!f||!(p(o(e),o(f))||p(o(e)-c(e),o(f)-c(f))||p(o(e)+c(e),o(f)+c(f))))&&(d++,f=e),u.set(e.id,d);let m=d,h=i===`RL`||i===`BT`,g=new Map,_=new Map;for(let t of[...e].sort((e,t)=>s(e)-s(t))){let e=u.get(t.id),n=_.get(e)??0;_.set(e,n+1),g.set(t.id,{layer:h?m-e:e,order:n,cross:s(t),size:a?t.h:t.w})}let v=new Map(e.map(e=>[e.id,e])),y=new Map,b=t.map((e,t)=>{let n=v.get(e.from),i=v.get(e.to);if(!n||!i||e.points.length<2)return;let o=e.points[0],s=e.points[e.points.length-1],c=(e,n,i)=>{let o=r(e,n,a),s={edge:t,start:i,face:o,at:o===`T`||o===`B`?n.x:n.y},c=`${e.id}|${o}`;return y.set(c,[...y.get(c)??[],s]),s};return{p:e,s:c(n,o,!0),e:c(i,s,!1)}}),x=(e,t)=>{let r=[...y.get(`${e}|${t.face}`)].map(e=>e.at);return new Set(r.filter(e=>e<t.at-n)).size},S=[];return b.forEach((e,t)=>{e&&S.push({index:t,from:e.p.from,to:e.p.to,start:{face:e.s.face,order:x(e.p.from,e.s)},end:{face:e.e.face,order:x(e.p.to,e.e)}})}),{nodes:g,edges:S}}var a=e=>{try{return e()}catch(e){if(e instanceof t.ElkNotRegisteredError)return;throw e}},o={graph:e=>a(()=>{let n=(0,t.layoutFlowchartSync)(e,{legacyNodeSizes:!0});return i(n.nodes.map(e=>({id:e.id,cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width,h:e.height,diamond:e.shape===`diamond`})),n.edges.map(e=>({from:e.source,to:e.target,points:e.points})),e.direction)}),er:e=>a(()=>{let n=(0,t.layoutErDiagramSync)(e);return i(n.entities.map(e=>({id:e.id,cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width,h:e.height})),n.relationships.map(e=>({from:e.entity1,to:e.entity2,points:e.points})),e.direction??`TD`)})};function s(){(0,e.registerAsciiLayout)(o)}s();var c=require("@zombie-mermaid/mcp");Object.keys(c).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return c[e]}})});
|
package/dist/mcp.js
CHANGED
|
@@ -17,7 +17,7 @@ export declare interface AsciiLayoutResult {
|
|
|
17
17
|
* Render ASCII, optionally from mermaid's ELK layout (`layout: 'mermaid'`).
|
|
18
18
|
*
|
|
19
19
|
* Layout-faithful covers flat flowcharts only; anything else (subgraphs, unmodelled shapes,
|
|
20
|
-
* other diagram types, a layout failure, elkjs 0.
|
|
20
|
+
* other diagram types, a layout failure, elkjs 0.12.0 not installed) falls back to the standard
|
|
21
21
|
* renderer and says so in `fallbackReason`. Layout-faithful output is plain text drawn on its
|
|
22
22
|
* own grid, so spacing/color/profile options apply only to the fallback. A drawing that cannot
|
|
23
23
|
* fit the width cap (`maxCols`, default 120) also falls back; pass `maxCols: Infinity` to get the
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./src-
|
|
1
|
+
const e=require("./src-Qo65SnxX.cjs");var t=[1,2,4,8],n=[0,1,0,-1],r=[-1,0,1,0],i=2.5,a=1.5,o=4,s=30,c=class{a=[];get size(){return this.a.length}push(e,t){let n=this.a;n.push([e,t]);let r=n.length-1;for(;r&&n[r-1>>1][0]>n[r][0];)[n[r-1>>1],n[r]]=[n[r],n[r-1>>1]],r=r-1>>1}pop(){let e=this.a,t=e[0],n=e.pop();if(e.length){e[0]=n;let t=0;for(;;){let n=t;for(let r of[2*t+1,2*t+2])r<e.length&&e[r][0]<e[n][0]&&(n=r);if(n===t)break;[e[n],e[t]]=[e[t],e[n]],t=n}}return t}};function l(e,t,n){let r=1/0;for(let i=0;i+1<e.length;i++){let[a,o]=e[i],[s,c]=e[i+1],l=s-a,u=c-o,d=l*l+u*u||1,f=Math.max(0,Math.min(1,((t+.5-a)*l+(n+.5-o)*u)/d));r=Math.min(r,Math.hypot(t+.5-a-f*l,n+.5-o-f*u))}return r}function u(e,u,d,f,p,m){let{W:h,H:g,kind:ee,owner:_,occ:v}=e,y=new Float64Array(h*g*4).fill(1/0),b=new Int32Array(h*g*4).fill(-1),x=new c,S=(u.y*h+u.x)*4+u.d;for(y[S]=0,x.push(0,S);x.size;){let[e,c]=x.pop();if(e>y[c])continue;let u=c&3,C=c>>2,w=C%h,T=C/h|0;if(w===d.x&&T===d.y&&u===d.d){let e=[];for(let t=c;t!==-1;t=b[t])e.unshift([(t>>2)%h,(t>>2)/h|0]);return e}let E=c===S;for(let S of E?[u]:[u,u+1&3,u+3&3]){if(S!==u&&v[C]!==0)continue;let E=w+n[S],D=T+r[S];if(E<0||D<0||E>=h||D>=g)continue;let O=D*h+E,k=ee[O];if(k===1||k===2&&(E!==d.x||D!==d.y||S!==d.d||_[O]!==f))continue;let A=0;if(v[O]!==0){if(E===d.x&&D===d.y)continue;if(v[O]===(S&1?t[0]|t[2]:t[1]|t[3]))A=o;else if(m)A=s;else continue}let j=e+1+a*l(p,E,D)+(S===u?0:i)+A,M=O*4+S;j<y[M]&&(y[M]=j,b[M]=c,x.push(j,M))}}return null}var d={"merge-then-grow":{mergeIdentical:!0},"grow-only":{mergeIdentical:!1}},f=120,[p,m,h,g]=t,ee=[` `,`│`,`─`,`└`,`│`,`│`,`┌`,`├`,`─`,`┘`,`─`,`┴`,`┐`,`┤`,`┬`,`┼`],_=[`▲`,`►`,`▼`,`◄`],v=[`T`,`R`,`B`,`L`],y={T:0,R:1,B:2,L:3},b=e=>e===`T`||e===`B`;function x(e,t,n,r=1){let i=[...e].sort((e,t)=>e.lo-t.lo),a=[];for(let e of i){let t=a[a.length-1];!t||e.lo>=t.hi?a.push({lo:e.lo,hi:e.hi,extra:0}):t.hi=Math.max(t.hi,e.hi)}for(let e of i){let n=a.find(t=>e.lo>=t.lo&&e.lo<t.hi),r=Math.max(0,e.need-Math.round((e.hi-e.lo)/t));n.extra=Math.max(n.extra,Math.ceil(r*(n.hi-n.lo)/(e.hi-e.lo)))}let o=e=>Math.min(1,Math.max(0,e));return e=>e/t+a.reduce((i,s,c)=>i+s.extra*o((e-s.lo)/(s.hi-s.lo))+(a[c+1]?o((e-s.hi)/(a[c+1].lo-s.hi))*(n-(1-r)*(a[c+1].lo-s.hi)/t):0),0)}var S=e=>e.slice(1).reduce((t,n,r)=>t+Math.abs(n[0]-e[r][0])+Math.abs(n[1]-e[r][1]),0),C=(e,t)=>t[0]>e[0]?1:t[0]<e[0]?3:t[1]>e[1]?2:0,w=e=>e.reduce((e,t)=>e+t,0)/e.length;function T(e,i,a,o,s,c,l,d=!1){let f=e.nodes.map(e=>({...e,l:e.x-e.w/2,r:e.x+e.w/2,t:e.y-e.h/2,b:e.y+e.h/2,lines:e.label.split(/<br\s*\/?>|\n/i)})),T=e=>({w:Math.max(3,Math.round(e.w/i)),h:Math.max(3,Math.round(e.h/a))}),E=e=>{let t={node:0,face:`T`,coord:0,d:1/0};return f.forEach((n,r)=>{if(!(e[0]>=n.l-2&&e[0]<=n.r+2&&e[1]>=n.t-2&&e[1]<=n.b+2))return;let i=[[`L`,Math.abs(e[0]-n.l),e[1]],[`R`,Math.abs(e[0]-n.r),e[1]],[`T`,Math.abs(e[1]-n.t),e[0]],[`B`,Math.abs(e[1]-n.b),e[0]]];for(let[e,n,a]of i)n<t.d&&(t={node:r,face:e,coord:a,d:n})}),t},D=e=>`${e.node}.${e.face}`,O=e.edges.map((e,t)=>{let n=E(e.pts[0]),r=E(e.pts[e.pts.length-1]),i=!!e.arrowStart,a=e.arrowEnd!==!1;return{i:t,s:n,t:r,arrowS:i,arrowT:a,guide:e.pts,sig:`${D(n)}>${D(r)}|${+i}${+a}`}}),k=new Set,A=()=>{let e=new Map;for(let t of O){let n=k.has(t.sig)?t.sig:`#${t.i}`;e.set(n,[...e.get(n)??[],t])}return[...e.values()]},j=e=>{let t=new Map;for(let n of e)for(let e of[n[0].s,n[0].t])t.set(D(e),(t.get(D(e))??0)+1);return t},M=e=>{let[t,n]=e.split(`.`),r=T(f[+t]);return(n===`T`||n===`B`?r.w:r.h)-2};if(o)for(;;){let e=[...j(A())].find(([e,t])=>t>M(e));if(!e)break;let t=new Map;for(let n of O)!k.has(n.sig)&&(D(n.s)===e[0]||D(n.t)===e[0])&&t.set(n.sig,(t.get(n.sig)??0)+1);let n=[...t].filter(([,e])=>e>1).sort((e,t)=>t[1]-e[1])[0];if(!n)break;k.add(n[0])}let te=A(),ne=j(te),N=te.map((e,t)=>{let n=e[0],r=(e,t)=>{let r=t?n.t:n.s,i=t?e.guide[e.guide.length-1]:e.guide[0];return b(r.face)?i[0]:i[1]},i=(n,i)=>({node:n.node,face:n.face,coord:w(e.map(e=>r(e,i))),lane:0,bundle:t,end:i});return{members:e.map(e=>e.i),A:i(n.s,0),B:i(n.t,1),arrowA:n.arrowS,arrowB:n.arrowT,guide:n.guide}}),re=f.map((e,t)=>Math.max(T(e).w,Math.max(...e.lines.map(e=>e.length))+4,Math.max(0,...[`T`,`B`].map(e=>ne.get(`${t}.${e}`)??0))+2)),ie=f.map((e,t)=>Math.max(T(e).h,e.lines.length+2,Math.max(0,...[`L`,`R`].map(e=>ne.get(`${t}.${e}`)??0))+2)),P=x(f.map((e,t)=>({lo:e.l,hi:e.r,need:re[t]})),i,s,l),F=x(f.map((e,t)=>({lo:e.t,hi:e.b,need:ie[t]})),a,s),ae=[...f.flatMap(e=>[P(e.l),P(e.r)+1]),...e.edges.flatMap(e=>e.pts.map(e=>P(e[0])))],oe=[...f.flatMap(e=>[F(e.t),F(e.b)+1]),...e.edges.flatMap(e=>e.pts.map(e=>F(e[1])))],se=3-Math.floor(Math.min(...ae)),ce=3-Math.floor(Math.min(...oe)),I=Math.ceil(Math.max(...ae))+se+4,L=Math.ceil(Math.max(...oe))+ce+4,R=e=>P(e)+se,z=e=>F(e)+ce,B=f.map((e,t)=>{let n=Math.round(R(e.l)),r=Math.round(z(e.t));return{c0:n,r0:r,c1:n+Math.max(re[t],Math.round(P(e.r)-P(e.l)))-1,r1:r+Math.max(ie[t],Math.round(F(e.b)-F(e.t)))-1}}),V=(e,t)=>t*I+e,H=new Int32Array(I*L),le=new Int32Array(I*L).fill(-1),U=new Int32Array(I*L),W=new Map;for(let e of B)for(let t=e.r0;t<=e.r1;t++)for(let n=e.c0;n<=e.c1;n++){H[V(n,t)]=1;let r=t===e.r0||t===e.r1,i=n===e.c0||n===e.c1;(r||i)&&W.set(V(n,t),(r?(n>e.c0?g:0)|(n<e.c1?m:0):0)|(i?(t>e.r0?p:0)|(t<e.r1?h:0):0))}for(let e of B)for(let t=e.r0-1;t<=e.r1+1;t++)for(let n=e.c0-1;n<=e.c1+1;n++)H[V(n,t)]===0&&(H[V(n,t)]=2);let ue=N.flatMap(e=>[e.A,e.B]);f.forEach((e,t)=>{for(let e of v){let n=ue.filter(n=>n.node===t&&n.face===e).sort((e,t)=>e.coord-t.coord||e.bundle-t.bundle||e.end-t.end),r=B[t],i=b(e),a=(i?r.c0:r.r0)+1,o=(i?r.c1:r.r1)-1,s=n.map(e=>Math.floor(i?R(e.coord):z(e.coord)));for(let e=0;e<s.length;e++)s[e]=Math.max(s[e],e?s[e-1]+1:a);for(let e=s.length-1;e>=0;e--)s[e]=Math.min(s[e],e<s.length-1?s[e+1]-1:o);n.forEach((e,t)=>e.lane=s[t])}});let de=e=>{let t=B[e.node];return e.face===`T`?[e.lane,t.r0-1]:e.face===`B`?[e.lane,t.r1+1]:e.face===`L`?[t.c0-1,e.lane]:[t.c1+1,e.lane]};N.forEach((e,t)=>{for(let n of[e.A,e.B]){let[e,r]=de(n);le[V(e,r)]=t*2+n.end}});let fe={W:I,H:L,kind:H,owner:le,occ:U},G=new Map,K=new Set,q=new Map,pe=N.map((e,t)=>t).sort((e,t)=>(S(N[e].guide)-S(N[t].guide))*(d?-1:1)||e-t);for(let e of pe){let i=N[e],a=i.guide.map(e=>[R(e[0]),z(e[1])]),[o,s]=de(i.A),[l,d]=de(i.B),f=y[i.A.face],p=y[i.B.face]+2&3,m=u(fe,{x:o,y:s,d:f},{x:l,y:d,d:p},e*2+1,a,c);if(!m)return null;m.forEach((n,r)=>{for(let e of[m[r-1],m[r+1]])e&&(U[V(n[0],n[1])]|=t[C(n,e)]);let i=q.get(V(n[0],n[1]))??new Set;i.add(e),q.set(V(n[0],n[1]),i)});let h=(e,t,n)=>W.set(V(e,t),(W.get(V(e,t))??0)|n);U[V(o,s)]|=t[f+2&3],i.arrowA?(G.set(V(o,s),_[f+2&3]),U[V(o,s)]=15):h(o-n[f],s-r[f],t[f]),U[V(l,d)]|=t[p],i.arrowB?(G.set(V(l,d),_[p]),U[V(l,d)]=15):h(l+n[p],d+r[p],t[p+2&3]),K.add(V(o,s)),K.add(V(l,d))}let J=Array.from({length:L},()=>Array(I).fill(` `));for(let e=0;e<I*L;e++){let t=e%I,n=e/I|0;W.has(e)?J[n][t]=ee[W.get(e)]:G.has(e)?J[n][t]=G.get(e):U[e]&&(J[n][t]=ee[U[e]])}f.forEach((e,t)=>{let n=B[t],r=n.r0+1+Math.floor((n.r1-n.r0-1-e.lines.length)/2);e.lines.forEach((e,t)=>{let i=n.c0+Math.floor((n.c1-n.c0+1-e.length)/2);for(let n=0;n<e.length;n++)J[r+t][i+n]=e[n]})});let me=new Set;for(let t of pe){let n=e.edges[N[t].members[0]].label;if(!n)continue;let r=(e,t)=>e>=0&&t>=0&&e<I&&t<L&&J[t][e]===` `&&H[V(e,t)]===0&&!me.has(V(e,t)),i=(e,n)=>q.get(V(e,n))?.size===1&&q.get(V(e,n)).has(t)&&!K.has(V(e,n)),a=e=>Array.from({length:n.length},(e,t)=>t).every(e),o=[...q].filter(([,e])=>e.has(t)).map(([e])=>[e%I,e/I|0]),s=w(o.map(e=>e[0])),c=w(o.map(e=>e[1])),l=[];for(let[e,t]of o)U[V(e,t)]===(m|g)&&a(n=>i(e+n,t)&&U[V(e+n,t)]===(m|g))&&l.push([e,t]),U[V(e,t)]===(p|h)&&i(e,t)&&a(n=>r(e+1+n,t))&&l.push([e+1,t]);l.sort((e,t)=>Math.hypot(e[0]+n.length/2-s,e[1]-c)-Math.hypot(t[0]+n.length/2-s,t[1]-c));let u=l[0];if(u)for(let e=0;e<n.length;e++)J[u[1]][u[0]+e]=n[e],me.add(V(u[0]+e,u[1]))}let Y=J.map(e=>e.join(``).trimEnd()),X=0;for(;X<Y.length&&!Y[X];)X++;let Z=Y.length;for(;Z>X&&!Y[Z-1];)Z--;let Q=Y.slice(X,Z),$=Math.min(...Q.filter(Boolean).map(e=>e.length-e.trimStart().length)),he=Q.map(e=>e.slice($)).join(`
|
|
2
2
|
`),ge=B.map((e,t)=>({id:f[t].id,c0:e.c0-$,r0:e.r0-X,c1:e.c1-$,r1:e.r1-X})),_e=0;for(let e of B)for(let t=e.r0;t<=e.r1;t++)for(let n=e.c0;n<=e.c1;n++){let r=J[t][n],i=t===e.r0,a=t===e.r1,o=n===e.c0,s=n===e.c1;(i&&o?r===`┌`:i&&s?r===`┐`:a&&o?r===`└`:a&&s?r===`┘`:i||a?`─┬┴`.includes(r):o||s?`│├┤`.includes(r):!`─│┌┐└┘├┤┬┴┼►◄▲▼`.includes(r))||_e++}let ve=0;G.forEach((e,t)=>{let i=_.indexOf(e),a=t%I+n[i],o=(t/I|0)+r[i];H[V(a,o)]===1&&W.has(V(a,o))&&ve++});let ye=0;q.forEach((e,t)=>{e.size>1&&!K.has(t)&&(ye+=e.size*(e.size-1)/2)});let be=0,xe=0;return f.forEach((e,t)=>{let n=B[t],r=Math.max(Math.abs((n.c1-n.c0+1)*i/e.w-1),Math.abs((n.r1-n.r0+1)*a/e.h-1));be=Math.max(be,r),r>.15&&xe++}),{text:he,boxes:ge,mergedGroups:N.filter(e=>e.members.length>1).map(t=>t.members.map(t=>e.edges[t].id)),capped:!0,note:e.edges.length===N.length?``:`${e.edges.length-N.length} parallel edge(s) are drawn merged into one line: merged lines hide edge multiplicity.`,stats:{rows:Q.length,cols:Math.max(...Q.map(e=>e.length-$)),naturalCols:0,gapKept:l,maxBoxError:be,boxesOver15Pct:xe,edges:e.edges.length,lines:N.length,merged:e.edges.length-N.length,crossings:ye,brokenBorderCells:_e,arrowheads:G.size,arrowheadsAdjacent:ve,gap:s,relaxed:c}}}function E(e,t={}){if(!e.nodes.length)return{text:``,boxes:[],mergedGroups:[],note:``,capped:!0,stats:{rows:0,cols:0,naturalCols:0,gapKept:1,maxBoxError:0,boxesOver15Pct:0,edges:0,lines:0,merged:0,crossings:0,brokenBorderCells:0,arrowheads:0,arrowheadsAdjacent:0,gap:0,relaxed:!1}};let{cellW:n=5,cellH:r=10,facePolicy:i=`merge-then-grow`,maxCols:a=120}=t,{mergeIdentical:o}=d[i],s=t=>{for(let i=0;i<=8;i++)for(let a of[!1,!0]){let s=T(e,n,r,o,i,!1,t,a);if(s)return s}return T(e,n,r,o,4,!0,t)},c=s(1),l=c.stats.cols;if(c.stats.naturalCols=l,l<=a)return c;let u=e=>e.stats.cols<=a&&!e.stats.relaxed,f=s(0);if(!u(f))return c.capped=!1,c;let p=f,m=0,h=1;for(let e=0;e<7;e++){let e=(m+h)/2,t=s(e);u(t)?(p=t,m=e):h=e}return p.stats.naturalCols=l,p}async function D(t,n){return E(await e.layoutFlowchart(t),n)}exports.DEFAULT_MAX_COLS=f,exports.rasterizeLayout=E,exports.renderFlowchartAscii=D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@zombie-mermaid/core"),l=require("elkjs-0.12.0/lib/elk.bundled.js");l=s(l,1);let u=require("@zombie-mermaid/mermaid-parser");var d={0:8.390625,1:8.390625,2:8.390625,3:8.390625,4:8.390625,5:8.390625,6:8.390625,7:8.390625,8:8.390625,9:8.390625," ":4.8203125,"!":5.875,'"':5.1953125,"#":8.390625,$:8.390625,"%":9.6015625,"&":11.296875,"'":2.5546875,"(":5.875,")":5.875,"*":5.875,"+":8.390625,",":5.875,"-":5.875,".":5.875,"/":8.390625,":":5.875,";":5.875,"<":8.390625,"=":8.390625,">":8.390625,"?":5.875,"@":12.328125,A:9.4375,B:9.0546875,C:9.5703125,D:9.8125,E:8.5703125,F:8.3984375,G:10.8203125,H:10.46875,I:4.453125,J:7.625,K:9.2109375,L:8.1015625,M:11.3515625,N:10.2109375,O:10.78125,P:8.921875,Q:10.8125,R:9.3125,S:7.6953125,T:9.2890625,U:10.375,V:9.3984375,W:13.6328125,X:8.90625,Y:9.125,Z:8.8046875,"[":5.875,"\\":5.6875,"]":5.875,"^":8.390625,_:8.390625,"`":8.390625,a:8.40625,b:8.9140625,c:7.921875,d:8.9140625,e:8.7265625,f:5.9140625,g:8.03125,h:8.7421875,i:4.5625,j:5.8671875,k:8.0703125,l:4.71875,m:13.28125,n:8.7421875,o:8.5859375,p:8.9140625,q:8.9140625,r:6.21875,s:6.4765625,t:6.34375,u:8.7421875,v:7.8359375,w:11.90625,x:8.015625,y:7.890625,z:7.59375,"{":5.875,"|":8.390625,"}":5.875,"~":8.390625},f=class extends Error{reasons;constructor(e){super(`unsupported flowchart for ELK layout: ${e.join(`; `)}`),this.reasons=e,this.name=`UnsupportedFlowchartError`}},p=120,m=24,h=d,g=e=>[...e].reduce((e,t)=>e+(h[t]??(0,c.measureTextWidth)(t,16,400)*.93),0);function _(e,t){let n=0,r=0;for(let i of e.split(/<br\s*\/?>|\n/i)){let e=``,a=0;for(let n of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${n}`:n;e&&g(i)>t?(r=Math.max(r,g(e)),a++,e=n):e=i}r=Math.max(r,g(e)),n+=a+1}return{w:r,lines:Math.max(1,n)}}var v={rectangle:`rect`,rounded:`round`,diamond:`diamond`,stadium:`stadium`,circle:`circle`,doublecircle:`double`,hexagon:`hex`,subroutine:`subr`,cylinder:`cyl`};function y(e){let t=(0,u.parseMermaid)(e),n=[];t.subgraphs.length&&n.push(`subgraphs`);for(let e of t.nodes.values())v[e.shape]||n.push(`shape "${e.shape}" (node ${e.id})`);if(n.length)throw new f(n);let r=t.direction===`TD`?`TB`:t.direction,i=[...t.nodes.values()].map(e=>{let{w:t,lines:n}=_(e.label,p),r=Math.max(t,p),i=n*m,a=v[e.shape],o={id:e.id,label:e.label,kind:a};switch(a){case`round`:return{...o,w:r+30,h:i+30};case`stadium`:return{...o,w:(n>1?126.3:r)+52,h:i+24};case`circle`:case`double`:{let e=Math.hypot(r,i)+(a===`double`?56:64);return{...o,w:e,h:e}}case`hex`:return{...o,w:n>1?219.4:205.7,h:i+70};case`subr`:return{...o,w:r+44,h:i+12};case`cyl`:return{...o,w:r+24,h:i+64.1};case`diamond`:return{...o,w:r+i+30,h:r+i+30};default:return{...o,w:r+32,h:i+24}}}),a=new Map;return{dir:r,nodes:i,edges:t.edges.map(e=>{let t=`${e.source}\0${e.target}`,n=a.get(t)??0;a.set(t,n+1);let r=`L_${e.source}_${e.target}_${n===0?0:n+1}`;return{id:e.id??r,from:e.source,to:e.target,label:e.label,lw:e.label?_(e.label,200).w:0,lh:e.label?m:0,arrowEnd:e.hasArrowEnd,arrowStart:e.hasArrowStart}})}}var b=(e,t,n)=>e.kind===`diamond`?Math.abs(t)/(e.w/2)+Math.abs(n)/(e.h/2)<=1:Math.abs(t)<=e.w/2&&Math.abs(n)<=e.h/2,x={TB:`DOWN`,BT:`UP`,LR:`RIGHT`,RL:`LEFT`},S=`[top=12,left=12,bottom=12,right=12]`,C=e=>({"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.algorithm":`elk.layered`,"elk.layered.nodePlacement.strategy":`BRANDES_KOEPF`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`,"elk.layered.mergeEdges":!1,"elk.direction":x[e],"spacing.baseValue":40,"elk.layered.crossingMinimization.forceNodeModelOrder":!1,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.unnecessaryBendpoints":!0,"elk.layered.cycleBreaking.strategy":`DEPTH_FIRST`,"elk.layered.layering.strategy":`NETWORK_SIMPLEX`,"elk.layered.layering.coffmanGraham.layerBound":4,"elk.layered.wrapping.multiEdge.improveCuts":!0,"elk.layered.wrapping.multiEdge.improveWrappedEdges":!0,"elk.layered.edgeRouting.selfLoopDistribution":`EQUALLY`,"elk.layered.mergeHierarchyEdges":!0,"elk.spacing.portsSurrounding":S}),w=(e,t,n=.5)=>{let r=e.x-e.w/2,i=e.x+e.w/2,a=e.y-e.h/2,o=e.y+e.h/2;return(Math.abs(t.x-r)<=n||Math.abs(t.x-i)<=n)&&t.y>=a-n&&t.y<=o+n||(Math.abs(t.y-a)<=n||Math.abs(t.y-o)<=n)&&t.x>=r-n&&t.x<=i+n},T=(e,t)=>Math.abs(t.x-e.x)>=e.w/2||Math.abs(t.y-e.y)>=e.h/2;function E(e,t,n,r){let i=r.x-n.x,a=r.y-n.y;if(i===0&&a===0||Math.abs(i)>1e-6&&Math.abs(a)>1e-6)return null;let o=Math.abs(i)>Math.abs(a),s=e=>o?{x:e,y:n.y}:{x:n.x,y:e},c=n=>b(e,n.x-t.x,n.y-t.y),l=o?t.x:t.y,u=o?n.x:n.y;if(!c(s(l)))return null;if(c(s(u)))return{...n};for(let e=0;e<20;e++){let e=(l+u)/2;c(s(e))?l=e:u=e}return s(l)}function D(e,t){let n=t.x-e.x,r=t.y-e.y,i=Math.min(n?e.w/2/Math.abs(n):1/0,r?e.h/2/Math.abs(r):1/0);return{x:e.x+n*i,y:e.y+r*i}}function O(e,t,n){let r=t===`start`?0:e.length-1;Math.abs(e[r].x-n.x)<.1&&Math.abs(e[r].y-n.y)<.1?e.splice(r,1):e[r]=n}function k(e,t,n,r,i){let a=[...i],o=a.findIndex(e=>T(n,e));o!==-1&&O(a,`start`,(a[o+1]?E(e,n,a[o],a[o+1]):null)??D(n,a[o]));let s=-1;for(let e=a.length-1;e>=0;e--)if(T(r,a[e])){s=e;break}if(s===-1&&a.length>1&&(s=a.length-2),s!==-1&&O(a,`end`,(a[s-1]?E(t,r,a[s],a[s-1]):null)??D(r,a[s])),a.length>1){let e=a[a.length-1],t=a[a.length-2];Math.hypot(e.x-t.x,e.y-t.y)<2&&a.pop()}return a}var A=e=>e.filter((t,n)=>n===0||Math.abs(t.x-e[n-1].x)>1e-6||Math.abs(t.y-e[n-1].y)>1e-6);function j(e,t,n,r,i){let a=e;if(i&&a.length>=3){let e=a[a.length-1],t=a[a.length-2];Math.hypot(e.x-t.x,e.y-t.y)<8&&w(n,t,1)&&(a=[...a.slice(0,-2),e])}if(r&&a.length>=3){let[e,n]=[a[0],a[1]];Math.hypot(n.x-e.x,n.y-e.y)<8&&w(t,n,1)&&(a=[e,...a.slice(2)])}return a}var M=(e,t)=>{let n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y);return n>.01&&r<=.01?`h`:r>.01&&n<=.01?`v`:void 0};function N(e){if(e.length<5)return null;let[t,n,r,i]=e,a=M(t,n);if(!a||M(r,i)!==a||M(n,r)!==(a===`h`?`v`:`h`)||Math.hypot(n.x-t.x,n.y-t.y)>30)return null;let o=Math.abs(a===`h`?r.y-n.y:r.x-n.x);if(o<.01||o>16||!(a===`h`?Math.sign(n.x-t.x)===Math.sign(i.x-r.x):Math.sign(n.y-t.y)===Math.sign(i.y-r.y)))return null;let s=3;for(;s+1<e.length&&M(e[s],e[s+1])===a;)s++;if(s===e.length-1)return null;let c=[...e];for(let n=2;n<=s;n++)c[n]=a===`h`?{x:e[n].x,y:t.y}:{x:t.x,y:e[n].y};return c.splice(1,2),c}var P=(e,t,n,r)=>{let i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),[a,o,s,c]=[i(n,r,e),i(n,r,t),i(e,t,n),i(e,t,r)];return(a>0&&o<0||a<0&&o>0)&&(s>0&&c<0||s<0&&c>0)},F=(e,t)=>{let n=0;for(let r=0;r<e.length-1;r++)for(let i=0;i<t.length-1;i++)n+=+P(e[r],e[r+1],t[i],t[i+1]);return n};function I(e){e.forEach((t,n)=>{if(t.length<5)return;let r=N(t)??t,i=N([...r].reverse());if(i&&(r=i.reverse()),r===t)return;let a=0,o=0;e.forEach((e,i)=>{i===n||e.length<2||(a+=F(t,e),o+=F(r,e))}),o<=a&&(e[n]=r)})}async function L(e){let t=y(e),n={id:`root`,layoutOptions:C(t.dir),children:t.nodes.map(e=>({id:e.id,width:e.w,height:e.h})),edges:t.edges.map(e=>({id:e.id,sources:[e.from],targets:[e.to],labels:[{width:e.lw,height:e.lh,text:e.label??``,layoutOptions:{"edgeLabels.inline":`true`,"edgeLabels.placement":`CENTER`}}]}))},r=await new l.default().layout(n),i=new Map;for(let e of r.children){let n=t.nodes.find(t=>t.id===e.id),[r,a,o,s]=[e.x,e.y,e.width,e.height];i.set(e.id,{n,b:{x:r+o/2,y:a+s/2,w:o,h:s}})}let a=new Map(t.edges.map(e=>[e.id,e])),o=r.edges,s=o.map(e=>{let t=a.get(e.id),n=i.get(t.from),r=i.get(t.to),o=e.sections[0],s=[o.startPoint,...o.bendPoints??[],o.endPoint];return s=[{x:n.b.x,y:n.b.y},...s,{x:r.b.x,y:r.b.y}],s=A(k(n.n,r.n,n.b,r.b,s)),j(s,n.b,r.b,t.arrowStart,t.arrowEnd)});return I(s),{dir:t.dir===`TB`?`TD`:t.dir,nodes:t.nodes.map(e=>{let{b:t}=i.get(e.id);return{id:e.id,x:t.x,y:t.y,w:t.w,h:t.h,label:e.label}}),edges:o.map((e,t)=>{let n=a.get(e.id);return{id:n.id,from:n.from,to:n.to,pts:s[t].map(e=>[e.x,e.y]),label:n.label,lw:n.lw,lh:n.lh,...n.arrowStart&&{arrowStart:!0},...!n.arrowEnd&&{arrowEnd:!1}}})}}exports.UnsupportedFlowchartError=f,exports.layoutFlowchart=L;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zombie-mermaid",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.16.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"mcpName": "io.github.dfadler/zombie-mermaid",
|
|
6
6
|
"description": "Render Mermaid diagrams as beautiful SVGs or ASCII art. Ultra-fast, fully themeable, zero DOM dependencies. Maintained fork of beautiful-mermaid.",
|
|
@@ -115,11 +115,11 @@
|
|
|
115
115
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
116
116
|
"elkjs": "^0.12.0",
|
|
117
117
|
"entities": "^7.0.1",
|
|
118
|
-
"@zombie-mermaid/ascii-renderer": "5.
|
|
119
|
-
"@zombie-mermaid/core": "5.
|
|
120
|
-
"@zombie-mermaid/
|
|
121
|
-
"@zombie-mermaid/mcp": "5.
|
|
122
|
-
"@zombie-mermaid/
|
|
118
|
+
"@zombie-mermaid/ascii-renderer": "5.16.0",
|
|
119
|
+
"@zombie-mermaid/core": "5.16.0",
|
|
120
|
+
"@zombie-mermaid/mermaid-parser": "5.16.0",
|
|
121
|
+
"@zombie-mermaid/mcp": "5.16.0",
|
|
122
|
+
"@zombie-mermaid/svg-renderer": "5.16.0"
|
|
123
123
|
},
|
|
124
124
|
"devDependencies": {
|
|
125
125
|
"@arethetypeswrong/cli": "0.18.5",
|
|
@@ -141,13 +141,13 @@
|
|
|
141
141
|
"@vitest/coverage-v8": "^4.1.12",
|
|
142
142
|
"@xterm/headless": "^6.0.0",
|
|
143
143
|
"ajv": "8.20.0",
|
|
144
|
-
"elkjs-0.
|
|
144
|
+
"elkjs-0.12.0": "npm:elkjs@0.12.0",
|
|
145
145
|
"fast-check": "4.10.2",
|
|
146
146
|
"fontkit": "^2.0.4",
|
|
147
147
|
"jsdom": "^30.0.1",
|
|
148
148
|
"lightningcss": "^1.33.0",
|
|
149
149
|
"marked": "^18.0.11",
|
|
150
|
-
"mermaid": "12.
|
|
150
|
+
"mermaid": "12.3.0",
|
|
151
151
|
"oxfmt": "0.73.0",
|
|
152
152
|
"oxlint": "1.87.0",
|
|
153
153
|
"publint": "0.3.25",
|
|
@@ -168,10 +168,10 @@
|
|
|
168
168
|
"@resvg/resvg-js": "^2.6.2"
|
|
169
169
|
},
|
|
170
170
|
"peerDependencies": {
|
|
171
|
-
"elkjs-0.
|
|
171
|
+
"elkjs-0.12.0": "0.12.0"
|
|
172
172
|
},
|
|
173
173
|
"peerDependenciesMeta": {
|
|
174
|
-
"elkjs-0.
|
|
174
|
+
"elkjs-0.12.0": {
|
|
175
175
|
"optional": true
|
|
176
176
|
}
|
|
177
177
|
},
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
"bench:mcp": "tsx scripts/bench-mcp.ts",
|
|
203
203
|
"check:changesets": "tsx scripts/check-changesets.ts",
|
|
204
204
|
"check:changeset-coverage": "tsx scripts/check-changeset-coverage.ts",
|
|
205
|
-
"check:docs": "tsx scripts/check-docs.ts",
|
|
205
|
+
"check:docs": "tsx scripts/check-docs.ts && tsx scripts/check-golden-provenance.ts",
|
|
206
206
|
"check:plugin-skill": "tsx scripts/sync-plugin-skill.ts --check",
|
|
207
207
|
"check:llms-full": "tsx scripts/check-llms-full.ts",
|
|
208
208
|
"check:plugin-lock": "tsx scripts/check-plugin-lock.ts",
|
|
@@ -250,6 +250,11 @@
|
|
|
250
250
|
"mindmap:oracle": "tsx scripts/mindmap-oracle.ts",
|
|
251
251
|
"gantt:oracle": "tsx scripts/gantt-oracle.ts",
|
|
252
252
|
"timeline:oracle": "tsx scripts/timeline-oracle.ts",
|
|
253
|
+
"gitgraph:oracle": "tsx scripts/gitgraph-oracle.ts",
|
|
254
|
+
"radar:oracle": "tsx scripts/radar-oracle.ts",
|
|
255
|
+
"radar:parser-fixture": "tsx scripts/radar-parser-fixture.ts",
|
|
256
|
+
"kanban:oracle": "tsx scripts/kanban-oracle.ts",
|
|
257
|
+
"requirement:oracle": "tsx scripts/requirement-oracle.ts",
|
|
253
258
|
"pie:oracle": "tsx scripts/pie-oracle.ts",
|
|
254
259
|
"c4:oracle": "tsx scripts/c4-oracle.ts",
|
|
255
260
|
"xychart:oracle": "tsx scripts/xychart-oracle.ts",
|
package/dist/src-D4LsWkIk.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@zombie-mermaid/core"),l=require("elkjs-0.9.3/lib/elk.bundled.js");l=s(l,1);let u=require("@zombie-mermaid/mermaid-parser");var d={0:8.390625,1:8.390625,2:8.390625,3:8.390625,4:8.390625,5:8.390625,6:8.390625,7:8.390625,8:8.390625,9:8.390625," ":4.8203125,"!":5.875,'"':5.1953125,"#":8.390625,$:8.390625,"%":9.6015625,"&":11.296875,"'":2.5546875,"(":5.875,")":5.875,"*":5.875,"+":8.390625,",":5.875,"-":5.875,".":5.875,"/":8.390625,":":5.875,";":5.875,"<":8.390625,"=":8.390625,">":8.390625,"?":5.875,"@":12.328125,A:9.4375,B:9.0546875,C:9.5703125,D:9.8125,E:8.5703125,F:8.3984375,G:10.8203125,H:10.46875,I:4.453125,J:7.625,K:9.2109375,L:8.1015625,M:11.3515625,N:10.2109375,O:10.78125,P:8.921875,Q:10.8125,R:9.3125,S:7.6953125,T:9.2890625,U:10.375,V:9.3984375,W:13.6328125,X:8.90625,Y:9.125,Z:8.8046875,"[":5.875,"\\":5.6875,"]":5.875,"^":8.390625,_:8.390625,"`":8.390625,a:8.40625,b:8.9140625,c:7.921875,d:8.9140625,e:8.7265625,f:5.9140625,g:8.03125,h:8.7421875,i:4.5625,j:5.8671875,k:8.0703125,l:4.71875,m:13.28125,n:8.7421875,o:8.5859375,p:8.9140625,q:8.9140625,r:6.21875,s:6.4765625,t:6.34375,u:8.7421875,v:7.8359375,w:11.90625,x:8.015625,y:7.890625,z:7.59375,"{":5.875,"|":8.390625,"}":5.875,"~":8.390625},f=class extends Error{reasons;constructor(e){super(`unsupported flowchart for ELK layout: ${e.join(`; `)}`),this.reasons=e,this.name=`UnsupportedFlowchartError`}},p=120,m=24,h=d,g=e=>[...e].reduce((e,t)=>e+(h[t]??(0,c.measureTextWidth)(t,16,400)*.93),0);function _(e,t){let n=0,r=0;for(let i of e.split(/<br\s*\/?>|\n/i)){let e=``,a=0;for(let n of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${n}`:n;e&&g(i)>t?(r=Math.max(r,g(e)),a++,e=n):e=i}r=Math.max(r,g(e)),n+=a+1}return{w:r,lines:Math.max(1,n)}}var v={rectangle:`rect`,rounded:`round`,diamond:`diamond`,stadium:`stadium`,circle:`circle`,doublecircle:`double`,hexagon:`hex`,subroutine:`subr`,cylinder:`cyl`};function y(e){let t=(0,u.parseMermaid)(e),n=[];t.subgraphs.length&&n.push(`subgraphs`);for(let e of t.nodes.values())v[e.shape]||n.push(`shape "${e.shape}" (node ${e.id})`);if(n.length)throw new f(n);let r=t.direction===`TD`?`TB`:t.direction,i=[...t.nodes.values()].map(e=>{let{w:t,lines:n}=_(e.label,p),r=Math.max(t,p),i=n*m,a=v[e.shape],o={id:e.id,label:e.label,kind:a};switch(a){case`round`:return{...o,w:r+30,h:i+30};case`stadium`:return{...o,w:(n>1?126.3:r)+52,h:i+24};case`circle`:case`double`:{let e=Math.hypot(r,i)+(a===`double`?56:64);return{...o,w:e,h:e}}case`hex`:return{...o,w:n>1?219.4:205.7,h:i+70};case`subr`:return{...o,w:r+44,h:i+12};case`cyl`:return{...o,w:r+24,h:i+64.1};case`diamond`:return{...o,w:r+i+30,h:r+i+30};default:return{...o,w:r+32,h:i+24}}}),a=new Map;return{dir:r,nodes:i,edges:t.edges.map(e=>{let t=`${e.source}\0${e.target}`,n=a.get(t)??0;a.set(t,n+1);let r=`L_${e.source}_${e.target}_${n===0?0:n+1}`;return{id:e.id??r,from:e.source,to:e.target,label:e.label,lw:e.label?_(e.label,200).w:0,lh:e.label?m:0,arrowEnd:e.hasArrowEnd,arrowStart:e.hasArrowStart}})}}var b=(e,t,n)=>e.kind===`diamond`?Math.abs(t)/(e.w/2)+Math.abs(n)/(e.h/2)<=1:Math.abs(t)<=e.w/2&&Math.abs(n)<=e.h/2,x={TB:`DOWN`,BT:`UP`,LR:`RIGHT`,RL:`LEFT`},S=`[top=12,left=12,bottom=12,right=12]`,C=e=>({"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.algorithm":`elk.layered`,"elk.layered.nodePlacement.strategy":`BRANDES_KOEPF`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`,"elk.layered.mergeEdges":!1,"elk.direction":x[e],"spacing.baseValue":40,"elk.layered.crossingMinimization.forceNodeModelOrder":!1,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.unnecessaryBendpoints":!0,"elk.layered.cycleBreaking.strategy":`DEPTH_FIRST`,"elk.layered.layering.strategy":`NETWORK_SIMPLEX`,"elk.layered.layering.coffmanGraham.layerBound":4,"elk.layered.wrapping.multiEdge.improveCuts":!0,"elk.layered.wrapping.multiEdge.improveWrappedEdges":!0,"elk.layered.edgeRouting.selfLoopDistribution":`EQUALLY`,"elk.layered.mergeHierarchyEdges":!0,"elk.spacing.portsSurrounding":S}),w=(e,t,n=.5)=>{let r=e.x-e.w/2,i=e.x+e.w/2,a=e.y-e.h/2,o=e.y+e.h/2;return(Math.abs(t.x-r)<=n||Math.abs(t.x-i)<=n)&&t.y>=a-n&&t.y<=o+n||(Math.abs(t.y-a)<=n||Math.abs(t.y-o)<=n)&&t.x>=r-n&&t.x<=i+n},T=(e,t)=>Math.abs(t.x-e.x)>=e.w/2||Math.abs(t.y-e.y)>=e.h/2;function E(e,t,n,r){let i=r.x-n.x,a=r.y-n.y;if(i===0&&a===0||Math.abs(i)>1e-6&&Math.abs(a)>1e-6)return null;let o=Math.abs(i)>Math.abs(a),s=e=>o?{x:e,y:n.y}:{x:n.x,y:e},c=n=>b(e,n.x-t.x,n.y-t.y),l=o?t.x:t.y,u=o?n.x:n.y;if(!c(s(l)))return null;if(c(s(u)))return{...n};for(let e=0;e<20;e++){let e=(l+u)/2;c(s(e))?l=e:u=e}return s(l)}function D(e,t){let n=t.x-e.x,r=t.y-e.y,i=Math.min(n?e.w/2/Math.abs(n):1/0,r?e.h/2/Math.abs(r):1/0);return{x:e.x+n*i,y:e.y+r*i}}function O(e,t,n){let r=t===`start`?0:e.length-1;Math.abs(e[r].x-n.x)<.1&&Math.abs(e[r].y-n.y)<.1?e.splice(r,1):e[r]=n}function k(e,t,n,r,i){let a=[...i],o=a.findIndex(e=>T(n,e));o!==-1&&O(a,`start`,(a[o+1]?E(e,n,a[o],a[o+1]):null)??D(n,a[o]));let s=-1;for(let e=a.length-1;e>=0;e--)if(T(r,a[e])){s=e;break}if(s===-1&&a.length>1&&(s=a.length-2),s!==-1&&O(a,`end`,(a[s-1]?E(t,r,a[s],a[s-1]):null)??D(r,a[s])),a.length>1){let e=a[a.length-1],t=a[a.length-2];Math.hypot(e.x-t.x,e.y-t.y)<2&&a.pop()}return a}var A=e=>e.filter((t,n)=>n===0||Math.abs(t.x-e[n-1].x)>1e-6||Math.abs(t.y-e[n-1].y)>1e-6);function j(e,t,n,r,i){let a=e;if(i&&a.length>=3){let e=a[a.length-1],t=a[a.length-2];Math.hypot(e.x-t.x,e.y-t.y)<8&&w(n,t,1)&&(a=[...a.slice(0,-2),e])}if(r&&a.length>=3){let[e,n]=[a[0],a[1]];Math.hypot(n.x-e.x,n.y-e.y)<8&&w(t,n,1)&&(a=[e,...a.slice(2)])}return a}var M=(e,t)=>{let n=Math.abs(t.x-e.x),r=Math.abs(t.y-e.y);return n>.01&&r<=.01?`h`:r>.01&&n<=.01?`v`:void 0};function N(e){if(e.length<5)return null;let[t,n,r,i]=e,a=M(t,n);if(!a||M(r,i)!==a||M(n,r)!==(a===`h`?`v`:`h`)||Math.hypot(n.x-t.x,n.y-t.y)>30)return null;let o=Math.abs(a===`h`?r.y-n.y:r.x-n.x);if(o<.01||o>16||!(a===`h`?Math.sign(n.x-t.x)===Math.sign(i.x-r.x):Math.sign(n.y-t.y)===Math.sign(i.y-r.y)))return null;let s=3;for(;s+1<e.length&&M(e[s],e[s+1])===a;)s++;if(s===e.length-1)return null;let c=[...e];for(let n=2;n<=s;n++)c[n]=a===`h`?{x:e[n].x,y:t.y}:{x:t.x,y:e[n].y};return c.splice(1,2),c}var P=(e,t,n,r)=>{let i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),[a,o,s,c]=[i(n,r,e),i(n,r,t),i(e,t,n),i(e,t,r)];return(a>0&&o<0||a<0&&o>0)&&(s>0&&c<0||s<0&&c>0)},F=(e,t)=>{let n=0;for(let r=0;r<e.length-1;r++)for(let i=0;i<t.length-1;i++)n+=+P(e[r],e[r+1],t[i],t[i+1]);return n};function I(e){e.forEach((t,n)=>{if(t.length<5)return;let r=N(t)??t,i=N([...r].reverse());if(i&&(r=i.reverse()),r===t)return;let a=0,o=0;e.forEach((e,i)=>{i===n||e.length<2||(a+=F(t,e),o+=F(r,e))}),o<=a&&(e[n]=r)})}async function L(e){let t=y(e),n={id:`root`,layoutOptions:C(t.dir),children:t.nodes.map(e=>({id:e.id,width:e.w,height:e.h})),edges:t.edges.map(e=>({id:e.id,sources:[e.from],targets:[e.to],labels:[{width:e.lw,height:e.lh,text:e.label??``,layoutOptions:{"edgeLabels.inline":`true`,"edgeLabels.placement":`CENTER`}}]}))},r=await new l.default().layout(n),i=new Map;for(let e of r.children){let n=t.nodes.find(t=>t.id===e.id),[r,a,o,s]=[e.x,e.y,e.width,e.height];i.set(e.id,{n,b:{x:r+o/2,y:a+s/2,w:o,h:s}})}let a=new Map(t.edges.map(e=>[e.id,e])),o=r.edges,s=o.map(e=>{let t=a.get(e.id),n=i.get(t.from),r=i.get(t.to),o=e.sections[0],s=[o.startPoint,...o.bendPoints??[],o.endPoint];return s=[{x:n.b.x,y:n.b.y},...s,{x:r.b.x,y:r.b.y}],s=A(k(n.n,r.n,n.b,r.b,s)),j(s,n.b,r.b,t.arrowStart,t.arrowEnd)});return I(s),{dir:t.dir===`TB`?`TD`:t.dir,nodes:t.nodes.map(e=>{let{b:t}=i.get(e.id);return{id:e.id,x:t.x,y:t.y,w:t.w,h:t.h,label:e.label}}),edges:o.map((e,t)=>{let n=a.get(e.id);return{id:n.id,from:n.from,to:n.to,pts:s[t].map(e=>[e.x,e.y]),label:n.label,lw:n.lw,lh:n.lh,...n.arrowStart&&{arrowStart:!0},...!n.arrowEnd&&{arrowEnd:!1}}})}}exports.UnsupportedFlowchartError=f,exports.layoutFlowchart=L;
|