@zombie-mermaid/core 3.1.0 → 3.2.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/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/diagram-type.test.ts +38 -0
- package/src/diagram-type.ts +9 -0
- package/src/style-directives.ts +6 -1
package/dist/index.d.cts
CHANGED
|
@@ -125,7 +125,7 @@ export declare function detectDiagramType(text: string): DiagramType;
|
|
|
125
125
|
* need to enumerate the types (e.g. the MCP `list_diagram_types` tool) never
|
|
126
126
|
* keep a duplicate list that could drift.
|
|
127
127
|
*/
|
|
128
|
-
export declare const DIAGRAM_TYPES: readonly ["flowchart", "sequence", "class", "er", "xychart"];
|
|
128
|
+
export declare const DIAGRAM_TYPES: readonly ["flowchart", "sequence", "class", "er", "xychart", "architecture", "c4"];
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Diagram color configuration.
|
|
@@ -1183,6 +1183,9 @@ export declare function toDirection(raw: string | undefined): Direction;
|
|
|
1183
1183
|
/**
|
|
1184
1184
|
* `class A,B className` — attach a style class to one or more nodes.
|
|
1185
1185
|
*
|
|
1186
|
+
* Whitespace around commas is allowed (`class A, B foo`) — the state-diagram
|
|
1187
|
+
* docs show that form (`class Moving, Crash movement`).
|
|
1188
|
+
*
|
|
1186
1189
|
* Allows an optional trailing semicolon (`class A,B foo;`) — Mermaid treats
|
|
1187
1190
|
* it as valid/optional, and `classDef`/`style` already tolerate it via their
|
|
1188
1191
|
* `(.+)$` capture. Without this, the semicolon form fails to match here and
|
package/dist/index.d.ts
CHANGED
|
@@ -125,7 +125,7 @@ export declare function detectDiagramType(text: string): DiagramType;
|
|
|
125
125
|
* need to enumerate the types (e.g. the MCP `list_diagram_types` tool) never
|
|
126
126
|
* keep a duplicate list that could drift.
|
|
127
127
|
*/
|
|
128
|
-
export declare const DIAGRAM_TYPES: readonly ["flowchart", "sequence", "class", "er", "xychart"];
|
|
128
|
+
export declare const DIAGRAM_TYPES: readonly ["flowchart", "sequence", "class", "er", "xychart", "architecture", "c4"];
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Diagram color configuration.
|
|
@@ -1183,6 +1183,9 @@ export declare function toDirection(raw: string | undefined): Direction;
|
|
|
1183
1183
|
/**
|
|
1184
1184
|
* `class A,B className` — attach a style class to one or more nodes.
|
|
1185
1185
|
*
|
|
1186
|
+
* Whitespace around commas is allowed (`class A, B foo`) — the state-diagram
|
|
1187
|
+
* docs show that form (`class Moving, Crash movement`).
|
|
1188
|
+
*
|
|
1186
1189
|
* Allows an optional trailing semicolon (`class A,B foo;`) — Mermaid treats
|
|
1187
1190
|
* it as valid/optional, and `classDef`/`style` already tolerate it via their
|
|
1188
1191
|
* `(.+)$` capture. Without this, the semicolon form fails to match here and
|
package/dist/index.js
CHANGED
|
@@ -190,11 +190,13 @@ var v = [
|
|
|
190
190
|
"sequence",
|
|
191
191
|
"class",
|
|
192
192
|
"er",
|
|
193
|
-
"xychart"
|
|
193
|
+
"xychart",
|
|
194
|
+
"architecture",
|
|
195
|
+
"c4"
|
|
194
196
|
];
|
|
195
197
|
function te(e) {
|
|
196
198
|
let t = _(e)[0]?.text.toLowerCase() ?? "";
|
|
197
|
-
return /^xychart(?:-beta)?(?:\s|$)/.test(t) ? "xychart" : /^sequencediagram\s*$/.test(t) ? "sequence" : /^classdiagram\s*$/.test(t) ? "class" : /^erdiagram\s*$/.test(t) ? "er" : "flowchart";
|
|
199
|
+
return /^xychart(?:-beta)?(?:\s|$)/.test(t) ? "xychart" : /^architecture(?:-beta)?\s*$/.test(t) ? "architecture" : /^c4(?:context|container|component|dynamic|deployment)\s*$/.test(t) ? "c4" : /^sequencediagram\s*$/.test(t) ? "sequence" : /^classdiagram\s*$/.test(t) ? "class" : /^erdiagram\s*$/.test(t) ? "er" : "flowchart";
|
|
198
200
|
}
|
|
199
201
|
//#endregion
|
|
200
202
|
//#region packages/core/src/direction.ts
|
|
@@ -622,7 +624,7 @@ function be(e, t) {
|
|
|
622
624
|
return !0;
|
|
623
625
|
}
|
|
624
626
|
function xe(e, t) {
|
|
625
|
-
let n = e.match(/^class\s+([\w
|
|
627
|
+
let n = e.match(/^class\s+([\w-]+(?:\s*,\s*[\w-]+)*)\s+([\w-]+)\s*;?\s*$/);
|
|
626
628
|
if (!n) return !1;
|
|
627
629
|
let r = n[2];
|
|
628
630
|
for (let e of n[1].split(",")) t.classAssignments.set(e.trim(), r);
|