@zombie-mermaid/mermaid-parser 3.2.0 → 4.1.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 +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +684 -254
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/xychart-colors.test.ts +34 -0
- package/src/class/parser.ts +8 -13
- package/src/class/types.ts +13 -0
- package/src/flowchart-parser.ts +1324 -0
- package/src/index.ts +4 -2
- package/src/sequence/types.ts +2 -0
- package/src/xychart/colors.ts +10 -4
package/dist/index.d.cts
CHANGED
|
@@ -5,6 +5,7 @@ import { NodeShape } from '@zombie-mermaid/core';
|
|
|
5
5
|
import { Point } from '@zombie-mermaid/core';
|
|
6
6
|
import { Statement } from '@zombie-mermaid/core';
|
|
7
7
|
import { StyleDirectives } from '@zombie-mermaid/core';
|
|
8
|
+
import { toDirection } from '@zombie-mermaid/core';
|
|
8
9
|
|
|
9
10
|
/** Narrow rectangle on a lifeline showing active processing */
|
|
10
11
|
export declare interface Activation {
|
|
@@ -13,6 +14,8 @@ export declare interface Activation {
|
|
|
13
14
|
topY: number;
|
|
14
15
|
bottomY: number;
|
|
15
16
|
width: number;
|
|
17
|
+
/** Nesting level on this actor's lifeline: 0 for the outermost bar, 1 for a bar opened while one is already active, and so on */
|
|
18
|
+
depth: number;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
export declare interface ActivationCheckResult {
|
|
@@ -471,7 +474,7 @@ export declare function formatClassMember(m: ClassMember): string;
|
|
|
471
474
|
* Get the hex color for a series index.
|
|
472
475
|
* Index 0 returns the accent color as-is.
|
|
473
476
|
* Index 1+ alternate between darker and lighter shades of the same hue
|
|
474
|
-
* with subtle hue drift (
|
|
477
|
+
* with subtle hue drift (-8° per tier for darker, -12° for lighter) to stay in the same family.
|
|
475
478
|
*
|
|
476
479
|
* When `bgColor` is provided, shade direction adapts to the background:
|
|
477
480
|
* - Light bg: odd = darker, even = lighter (default)
|
|
@@ -653,6 +656,13 @@ export declare function parseExpandedMeta(body: string): ExpandedNodeMeta;
|
|
|
653
656
|
*/
|
|
654
657
|
export declare function parseGenericTypes(input: string): string;
|
|
655
658
|
|
|
659
|
+
/**
|
|
660
|
+
* Parse Mermaid text into a logical graph structure.
|
|
661
|
+
* Auto-detects diagram type (flowchart or state diagram).
|
|
662
|
+
* Throws on invalid/unsupported input.
|
|
663
|
+
*/
|
|
664
|
+
export declare function parseMermaid(text: string): MermaidGraph;
|
|
665
|
+
|
|
656
666
|
/**
|
|
657
667
|
* Parse a Mermaid sequence diagram.
|
|
658
668
|
* Expects the first line to be "sequenceDiagram".
|
|
@@ -808,6 +818,19 @@ export declare interface PositionedClassDiagram {
|
|
|
808
818
|
classes: PositionedClassNode[];
|
|
809
819
|
relationships: PositionedClassRelationship[];
|
|
810
820
|
notes: PositionedClassNote[];
|
|
821
|
+
/** Namespace frames, drawn behind their member classes */
|
|
822
|
+
namespaces: PositionedClassNamespace[];
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/** A `namespace Name { ... }` block's frame, in diagram coordinates */
|
|
826
|
+
export declare interface PositionedClassNamespace {
|
|
827
|
+
name: string;
|
|
828
|
+
/** Ids of the member classes the frame encloses */
|
|
829
|
+
classIds: string[];
|
|
830
|
+
x: number;
|
|
831
|
+
y: number;
|
|
832
|
+
width: number;
|
|
833
|
+
height: number;
|
|
811
834
|
}
|
|
812
835
|
|
|
813
836
|
export declare interface PositionedClassNode {
|
|
@@ -1056,6 +1079,8 @@ export declare interface SequenceDiagram {
|
|
|
1056
1079
|
*/
|
|
1057
1080
|
export declare function toBlockType(value: string): Block['type'];
|
|
1058
1081
|
|
|
1082
|
+
export { toDirection }
|
|
1083
|
+
|
|
1059
1084
|
/** Greedy word wrap; a word longer than `width` stays on its own line. */
|
|
1060
1085
|
export declare function wrapC4Text(text: string, width: number): string[];
|
|
1061
1086
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { NodeShape } from '@zombie-mermaid/core';
|
|
|
5
5
|
import { Point } from '@zombie-mermaid/core';
|
|
6
6
|
import { Statement } from '@zombie-mermaid/core';
|
|
7
7
|
import { StyleDirectives } from '@zombie-mermaid/core';
|
|
8
|
+
import { toDirection } from '@zombie-mermaid/core';
|
|
8
9
|
|
|
9
10
|
/** Narrow rectangle on a lifeline showing active processing */
|
|
10
11
|
export declare interface Activation {
|
|
@@ -13,6 +14,8 @@ export declare interface Activation {
|
|
|
13
14
|
topY: number;
|
|
14
15
|
bottomY: number;
|
|
15
16
|
width: number;
|
|
17
|
+
/** Nesting level on this actor's lifeline: 0 for the outermost bar, 1 for a bar opened while one is already active, and so on */
|
|
18
|
+
depth: number;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
export declare interface ActivationCheckResult {
|
|
@@ -471,7 +474,7 @@ export declare function formatClassMember(m: ClassMember): string;
|
|
|
471
474
|
* Get the hex color for a series index.
|
|
472
475
|
* Index 0 returns the accent color as-is.
|
|
473
476
|
* Index 1+ alternate between darker and lighter shades of the same hue
|
|
474
|
-
* with subtle hue drift (
|
|
477
|
+
* with subtle hue drift (-8° per tier for darker, -12° for lighter) to stay in the same family.
|
|
475
478
|
*
|
|
476
479
|
* When `bgColor` is provided, shade direction adapts to the background:
|
|
477
480
|
* - Light bg: odd = darker, even = lighter (default)
|
|
@@ -653,6 +656,13 @@ export declare function parseExpandedMeta(body: string): ExpandedNodeMeta;
|
|
|
653
656
|
*/
|
|
654
657
|
export declare function parseGenericTypes(input: string): string;
|
|
655
658
|
|
|
659
|
+
/**
|
|
660
|
+
* Parse Mermaid text into a logical graph structure.
|
|
661
|
+
* Auto-detects diagram type (flowchart or state diagram).
|
|
662
|
+
* Throws on invalid/unsupported input.
|
|
663
|
+
*/
|
|
664
|
+
export declare function parseMermaid(text: string): MermaidGraph;
|
|
665
|
+
|
|
656
666
|
/**
|
|
657
667
|
* Parse a Mermaid sequence diagram.
|
|
658
668
|
* Expects the first line to be "sequenceDiagram".
|
|
@@ -808,6 +818,19 @@ export declare interface PositionedClassDiagram {
|
|
|
808
818
|
classes: PositionedClassNode[];
|
|
809
819
|
relationships: PositionedClassRelationship[];
|
|
810
820
|
notes: PositionedClassNote[];
|
|
821
|
+
/** Namespace frames, drawn behind their member classes */
|
|
822
|
+
namespaces: PositionedClassNamespace[];
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/** A `namespace Name { ... }` block's frame, in diagram coordinates */
|
|
826
|
+
export declare interface PositionedClassNamespace {
|
|
827
|
+
name: string;
|
|
828
|
+
/** Ids of the member classes the frame encloses */
|
|
829
|
+
classIds: string[];
|
|
830
|
+
x: number;
|
|
831
|
+
y: number;
|
|
832
|
+
width: number;
|
|
833
|
+
height: number;
|
|
811
834
|
}
|
|
812
835
|
|
|
813
836
|
export declare interface PositionedClassNode {
|
|
@@ -1056,6 +1079,8 @@ export declare interface SequenceDiagram {
|
|
|
1056
1079
|
*/
|
|
1057
1080
|
export declare function toBlockType(value: string): Block['type'];
|
|
1058
1081
|
|
|
1082
|
+
export { toDirection }
|
|
1083
|
+
|
|
1059
1084
|
/** Greedy word wrap; a word longer than `width` stays on its own line. */
|
|
1060
1085
|
export declare function wrapC4Text(text: string, width: number): string[];
|
|
1061
1086
|
|