Skip to content

Commit 4776f97

Browse files
authored
Merge pull request #5921 from mermaid-js/develop
Pre Release
2 parents 14d9d92 + 460db0a commit 4776f97

File tree

120 files changed

+7804
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+7804
-625
lines changed

.changeset/add-nested-namespaces.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@mermaid': patch
3+
---
4+
5+
Fixed an issue when the mermaid classdiagram crashes when adding a . to the namespace.
6+
Forexample
7+
8+
```mermaid
9+
10+
classDiagram
11+
namespace Company.Project.Module {
12+
class GenericClass~T~ {
13+
+addItem(item: T)
14+
+getItem() T
15+
}
16+
}
17+
```

.changeset/popular-hounds-smash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@mermaid-js/layout-elk': patch
3+
---
4+
5+
chore: Update render options

.changeset/rude-meals-invite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'mermaid': minor
3+
---
4+
5+
New Flowchart Shapes (with new syntax)

.changeset/witty-rabbits-hunt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'mermaid': patch
3+
---
4+
5+
Ban DOMPurify v3.1.7 as a dependency

.cspell/code-terms.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ concat
2626
controlx
2727
controly
2828
CSSCLASS
29+
curv
2930
CYLINDEREND
3031
CYLINDERSTART
3132
DAGA

.cspell/cspell.config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ dictionaryDefinitions:
2828
- name: suggestions
2929
words:
3030
- none
31+
- disp
32+
- subproc
33+
- tria
3134
suggestWords:
3235
- seperator:separator
3336
- vertice:vertex

.cspell/mermaid-terms.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ bmatrix
55
braintree
66
catmull
77
compositTitleSize
8+
curv
89
doublecircle
910
elems
1011
gantt
@@ -24,6 +25,7 @@ multigraph
2425
nodesep
2526
NOTEGROUP
2627
Pinterest
28+
procs
2729
rankdir
2830
ranksep
2931
rect

.github/lychee.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ exclude = [
4444
"https://chromewebstore.google.com",
4545

4646
# Drupal 403
47-
"https://(www.)?drupal.org"
47+
"https://(www.)?drupal.org",
48+
49+
# Swimm returns 404, eventhough the link is valid
50+
"https://docs.swimm.io"
4851
]
4952

5053
# Exclude all private IPs from checking.

.github/workflows/release-preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Preview release
33
on:
44
pull_request:
55
branches: [develop]
6+
types: [opened, synchronize, labeled, ready_for_review]
67

78
concurrency:
89
group: ${{ github.workflow }}-${{ github.event.number }}

cypress/integration/rendering/classDiagram-v2.spec.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,4 +581,63 @@ class C13["With Città foreign language"]
581581
{ logLevel: 1, flowchart: { htmlLabels: false } }
582582
);
583583
});
584+
585+
it('renders a class diagram with a generic class in a namespace', () => {
586+
const diagramDefinition = `
587+
classDiagram-v2
588+
namespace Company.Project.Module {
589+
class GenericClass~T~ {
590+
+addItem(item: T)
591+
+getItem() T
592+
}
593+
}
594+
`;
595+
596+
imgSnapshotTest(diagramDefinition);
597+
});
598+
599+
it('renders a class diagram with nested namespaces and relationships', () => {
600+
const diagramDefinition = `
601+
classDiagram-v2
602+
namespace Company.Project.Module.SubModule {
603+
class Report {
604+
+generatePDF(data: List)
605+
+generateCSV(data: List)
606+
}
607+
}
608+
namespace Company.Project.Module {
609+
class Admin {
610+
+generateReport()
611+
}
612+
}
613+
Admin --> Report : generates
614+
`;
615+
616+
imgSnapshotTest(diagramDefinition);
617+
});
618+
619+
it('renders a class diagram with multiple classes and relationships in a namespace', () => {
620+
const diagramDefinition = `
621+
classDiagram-v2
622+
namespace Company.Project.Module {
623+
class User {
624+
+login(username: String, password: String)
625+
+logout()
626+
}
627+
class Admin {
628+
+addUser(user: User)
629+
+removeUser(user: User)
630+
+generateReport()
631+
}
632+
class Report {
633+
+generatePDF(reportData: List)
634+
+generateCSV(reportData: List)
635+
}
636+
}
637+
Admin --> User : manages
638+
Admin --> Report : generates
639+
`;
640+
641+
imgSnapshotTest(diagramDefinition);
642+
});
584643
});
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
import { imgSnapshotTest } from '../../helpers/util.ts';
2+
3+
const aliasSet1 = ['process', 'rect', 'proc', 'rectangle'] as const;
4+
5+
const aliasSet2 = ['event', 'rounded'] as const;
6+
7+
const aliasSet3 = ['stadium', 'pill', 'terminal'] as const;
8+
9+
const aliasSet4 = ['fr-rect', 'subproc', 'subprocess', 'framed-rectangle', 'subroutine'] as const;
10+
11+
const aliasSet5 = ['db', 'database', 'cylinder', 'cyl'] as const;
12+
13+
const aliasSet6 = ['diam', 'decision', 'diamond'] as const;
14+
15+
const aliasSet7 = ['hex', 'hexagon', 'prepare'] as const;
16+
17+
const aliasSet8 = ['lean-r', 'lean-right', 'in-out'] as const;
18+
19+
const aliasSet9 = ['lean-l', 'lean-left', 'out-in'] as const;
20+
21+
const aliasSet10 = ['trap-b', 'trapezoid-bottom', 'priority'] as const;
22+
23+
const aliasSet11 = ['trap-t', 'trapezoid-top', 'manual'] as const;
24+
25+
const aliasSet12 = ['dbl-circ', 'double-circle'] as const;
26+
27+
const aliasSet13 = ['notched-rectangle', 'card', 'notch-rect'] as const;
28+
29+
const aliasSet14 = [
30+
'lin-rect',
31+
'lined-rectangle',
32+
'lin-proc',
33+
'lined-process',
34+
'shaded-process',
35+
] as const;
36+
37+
const aliasSet15 = ['sm-circ', 'small-circle', 'start'] as const;
38+
39+
const aliasSet16 = ['fr-circ', 'framed-circle', 'stop'] as const;
40+
41+
const aliasSet17 = ['fork', 'join'] as const;
42+
// brace-r', 'braces'
43+
const aliasSet18 = ['comment', 'brace-l'] as const;
44+
45+
const aliasSet19 = ['bolt', 'com-link', 'lightning-bolt'] as const;
46+
47+
const aliasSet20 = ['doc', 'document'] as const;
48+
49+
const aliasSet21 = ['delay', 'half-rounded-rectangle'] as const;
50+
51+
const aliasSet22 = ['h-cyl', 'das', 'horizontal-cylinder'] as const;
52+
53+
const aliasSet23 = ['lin-cyl', 'disk', 'lined-cylinder'] as const;
54+
55+
const aliasSet24 = ['curv-trap', 'display', 'curved-trapezoid'] as const;
56+
57+
const aliasSet25 = ['div-rect', 'div-proc', 'divided-rectangle', 'divided-process'] as const;
58+
59+
const aliasSet26 = ['extract', 'tri', 'triangle'] as const;
60+
61+
const aliasSet27 = ['win-pane', 'internal-storage', 'window-pane'] as const;
62+
63+
const aliasSet28 = ['f-circ', 'junction', 'filled-circle'] as const;
64+
65+
const aliasSet29 = ['lin-doc', 'lined-document'] as const;
66+
67+
const aliasSet30 = ['notch-pent', 'loop-limit', 'notched-pentagon'] as const;
68+
69+
const aliasSet31 = ['flip-tri', 'manual-file', 'flipped-triangle'] as const;
70+
71+
const aliasSet32 = ['sl-rect', 'manual-input', 'sloped-rectangle'] as const;
72+
73+
const aliasSet33 = ['docs', 'documents', 'st-doc', 'stacked-document'] as const;
74+
75+
const aliasSet34 = ['procs', 'processes', 'st-rect', 'stacked-rectangle'] as const;
76+
77+
const aliasSet35 = ['flag', 'paper-tape'] as const;
78+
79+
const aliasSet36 = ['bow-rect', 'stored-data', 'bow-tie-rectangle'] as const;
80+
81+
const aliasSet37 = ['cross-circ', 'summary', 'crossed-circle'] as const;
82+
83+
const aliasSet38 = ['tag-doc', 'tagged-document'] as const;
84+
85+
const aliasSet39 = ['tag-rect', 'tag-proc', 'tagged-rectangle', 'tagged-process'] as const;
86+
87+
const aliasSet40 = ['collate', 'hourglass'] as const;
88+
89+
// Aggregate all alias sets into a single array
90+
const aliasSets = [
91+
aliasSet1,
92+
aliasSet2,
93+
aliasSet3,
94+
aliasSet4,
95+
aliasSet5,
96+
aliasSet6,
97+
aliasSet7,
98+
aliasSet8,
99+
aliasSet9,
100+
aliasSet10,
101+
aliasSet11,
102+
aliasSet12,
103+
aliasSet13,
104+
aliasSet14,
105+
aliasSet15,
106+
aliasSet16,
107+
aliasSet17,
108+
aliasSet18,
109+
aliasSet19,
110+
aliasSet20,
111+
aliasSet21,
112+
aliasSet22,
113+
aliasSet23,
114+
aliasSet24,
115+
aliasSet25,
116+
aliasSet26,
117+
aliasSet27,
118+
aliasSet28,
119+
aliasSet29,
120+
aliasSet30,
121+
aliasSet31,
122+
aliasSet32,
123+
aliasSet33,
124+
aliasSet34,
125+
aliasSet35,
126+
aliasSet36,
127+
aliasSet37,
128+
aliasSet38,
129+
aliasSet39,
130+
] as const;
131+
132+
aliasSets.forEach((aliasSet) => {
133+
describe(`Test ${aliasSet.join(',')} `, () => {
134+
it(`All ${aliasSet.join(',')} should render same shape`, () => {
135+
let flowchartCode = `flowchart \n`;
136+
aliasSet.forEach((alias, index) => {
137+
flowchartCode += ` n${index}@{ shape: ${alias}, label: "${alias}" }\n`;
138+
});
139+
imgSnapshotTest(flowchartCode);
140+
});
141+
});
142+
});

0 commit comments

Comments
 (0)