Skip to content

Commit

Permalink
Merge pull request #5921 from mermaid-js/develop
Browse files Browse the repository at this point in the history
Pre Release
  • Loading branch information
sidharthv96 authored Oct 3, 2024
2 parents 14d9d92 + 460db0a commit 4776f97
Show file tree
Hide file tree
Showing 120 changed files with 7,804 additions and 625 deletions.
17 changes: 17 additions & 0 deletions .changeset/add-nested-namespaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@mermaid': patch
---

Fixed an issue when the mermaid classdiagram crashes when adding a . to the namespace.
Forexample

```mermaid
classDiagram
namespace Company.Project.Module {
class GenericClass~T~ {
+addItem(item: T)
+getItem() T
}
}
```
5 changes: 5 additions & 0 deletions .changeset/popular-hounds-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mermaid-js/layout-elk': patch
---

chore: Update render options
5 changes: 5 additions & 0 deletions .changeset/rude-meals-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'mermaid': minor
---

New Flowchart Shapes (with new syntax)
5 changes: 5 additions & 0 deletions .changeset/witty-rabbits-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'mermaid': patch
---

Ban DOMPurify v3.1.7 as a dependency
1 change: 1 addition & 0 deletions .cspell/code-terms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ concat
controlx
controly
CSSCLASS
curv
CYLINDEREND
CYLINDERSTART
DAGA
Expand Down
3 changes: 3 additions & 0 deletions .cspell/cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ dictionaryDefinitions:
- name: suggestions
words:
- none
- disp
- subproc
- tria
suggestWords:
- seperator:separator
- vertice:vertex
Expand Down
2 changes: 2 additions & 0 deletions .cspell/mermaid-terms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bmatrix
braintree
catmull
compositTitleSize
curv
doublecircle
elems
gantt
Expand All @@ -24,6 +25,7 @@ multigraph
nodesep
NOTEGROUP
Pinterest
procs
rankdir
ranksep
rect
Expand Down
5 changes: 4 additions & 1 deletion .github/lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ exclude = [
"https://chromewebstore.google.com",

# Drupal 403
"https://(www.)?drupal.org"
"https://(www.)?drupal.org",

# Swimm returns 404, eventhough the link is valid
"https://docs.swimm.io"
]

# Exclude all private IPs from checking.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Preview release
on:
pull_request:
branches: [develop]
types: [opened, synchronize, labeled, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
Expand Down
59 changes: 59 additions & 0 deletions cypress/integration/rendering/classDiagram-v2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,4 +581,63 @@ class C13["With Città foreign language"]
{ logLevel: 1, flowchart: { htmlLabels: false } }
);
});

it('renders a class diagram with a generic class in a namespace', () => {
const diagramDefinition = `
classDiagram-v2
namespace Company.Project.Module {
class GenericClass~T~ {
+addItem(item: T)
+getItem() T
}
}
`;

imgSnapshotTest(diagramDefinition);
});

it('renders a class diagram with nested namespaces and relationships', () => {
const diagramDefinition = `
classDiagram-v2
namespace Company.Project.Module.SubModule {
class Report {
+generatePDF(data: List)
+generateCSV(data: List)
}
}
namespace Company.Project.Module {
class Admin {
+generateReport()
}
}
Admin --> Report : generates
`;

imgSnapshotTest(diagramDefinition);
});

it('renders a class diagram with multiple classes and relationships in a namespace', () => {
const diagramDefinition = `
classDiagram-v2
namespace Company.Project.Module {
class User {
+login(username: String, password: String)
+logout()
}
class Admin {
+addUser(user: User)
+removeUser(user: User)
+generateReport()
}
class Report {
+generatePDF(reportData: List)
+generateCSV(reportData: List)
}
}
Admin --> User : manages
Admin --> Report : generates
`;

imgSnapshotTest(diagramDefinition);
});
});
142 changes: 142 additions & 0 deletions cypress/integration/rendering/flowchart-shape-alias.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import { imgSnapshotTest } from '../../helpers/util.ts';

const aliasSet1 = ['process', 'rect', 'proc', 'rectangle'] as const;

const aliasSet2 = ['event', 'rounded'] as const;

const aliasSet3 = ['stadium', 'pill', 'terminal'] as const;

const aliasSet4 = ['fr-rect', 'subproc', 'subprocess', 'framed-rectangle', 'subroutine'] as const;

const aliasSet5 = ['db', 'database', 'cylinder', 'cyl'] as const;

const aliasSet6 = ['diam', 'decision', 'diamond'] as const;

const aliasSet7 = ['hex', 'hexagon', 'prepare'] as const;

const aliasSet8 = ['lean-r', 'lean-right', 'in-out'] as const;

const aliasSet9 = ['lean-l', 'lean-left', 'out-in'] as const;

const aliasSet10 = ['trap-b', 'trapezoid-bottom', 'priority'] as const;

const aliasSet11 = ['trap-t', 'trapezoid-top', 'manual'] as const;

const aliasSet12 = ['dbl-circ', 'double-circle'] as const;

const aliasSet13 = ['notched-rectangle', 'card', 'notch-rect'] as const;

const aliasSet14 = [
'lin-rect',
'lined-rectangle',
'lin-proc',
'lined-process',
'shaded-process',
] as const;

const aliasSet15 = ['sm-circ', 'small-circle', 'start'] as const;

const aliasSet16 = ['fr-circ', 'framed-circle', 'stop'] as const;

const aliasSet17 = ['fork', 'join'] as const;
// brace-r', 'braces'
const aliasSet18 = ['comment', 'brace-l'] as const;

const aliasSet19 = ['bolt', 'com-link', 'lightning-bolt'] as const;

const aliasSet20 = ['doc', 'document'] as const;

const aliasSet21 = ['delay', 'half-rounded-rectangle'] as const;

const aliasSet22 = ['h-cyl', 'das', 'horizontal-cylinder'] as const;

const aliasSet23 = ['lin-cyl', 'disk', 'lined-cylinder'] as const;

const aliasSet24 = ['curv-trap', 'display', 'curved-trapezoid'] as const;

const aliasSet25 = ['div-rect', 'div-proc', 'divided-rectangle', 'divided-process'] as const;

const aliasSet26 = ['extract', 'tri', 'triangle'] as const;

const aliasSet27 = ['win-pane', 'internal-storage', 'window-pane'] as const;

const aliasSet28 = ['f-circ', 'junction', 'filled-circle'] as const;

const aliasSet29 = ['lin-doc', 'lined-document'] as const;

const aliasSet30 = ['notch-pent', 'loop-limit', 'notched-pentagon'] as const;

const aliasSet31 = ['flip-tri', 'manual-file', 'flipped-triangle'] as const;

const aliasSet32 = ['sl-rect', 'manual-input', 'sloped-rectangle'] as const;

const aliasSet33 = ['docs', 'documents', 'st-doc', 'stacked-document'] as const;

const aliasSet34 = ['procs', 'processes', 'st-rect', 'stacked-rectangle'] as const;

const aliasSet35 = ['flag', 'paper-tape'] as const;

const aliasSet36 = ['bow-rect', 'stored-data', 'bow-tie-rectangle'] as const;

const aliasSet37 = ['cross-circ', 'summary', 'crossed-circle'] as const;

const aliasSet38 = ['tag-doc', 'tagged-document'] as const;

const aliasSet39 = ['tag-rect', 'tag-proc', 'tagged-rectangle', 'tagged-process'] as const;

const aliasSet40 = ['collate', 'hourglass'] as const;

// Aggregate all alias sets into a single array
const aliasSets = [
aliasSet1,
aliasSet2,
aliasSet3,
aliasSet4,
aliasSet5,
aliasSet6,
aliasSet7,
aliasSet8,
aliasSet9,
aliasSet10,
aliasSet11,
aliasSet12,
aliasSet13,
aliasSet14,
aliasSet15,
aliasSet16,
aliasSet17,
aliasSet18,
aliasSet19,
aliasSet20,
aliasSet21,
aliasSet22,
aliasSet23,
aliasSet24,
aliasSet25,
aliasSet26,
aliasSet27,
aliasSet28,
aliasSet29,
aliasSet30,
aliasSet31,
aliasSet32,
aliasSet33,
aliasSet34,
aliasSet35,
aliasSet36,
aliasSet37,
aliasSet38,
aliasSet39,
] as const;

aliasSets.forEach((aliasSet) => {
describe(`Test ${aliasSet.join(',')} `, () => {
it(`All ${aliasSet.join(',')} should render same shape`, () => {
let flowchartCode = `flowchart \n`;
aliasSet.forEach((alias, index) => {
flowchartCode += ` n${index}@{ shape: ${alias}, label: "${alias}" }\n`;
});
imgSnapshotTest(flowchartCode);
});
});
});
Loading

0 comments on commit 4776f97

Please sign in to comment.