-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed class diagram hopefuly no conflict
- Loading branch information
Showing
68 changed files
with
3,380 additions
and
650 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"typescript.format.enable": false, | ||
"typescript.reportStyleChecksAsWarnings": false, | ||
"typescript.validate.enable": false, | ||
"javascript.validate.enable": false, | ||
"editor.formatOnSave": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,23 @@ Ever wanted to simplify documentation and avoid heavy tools like Visio when expl | |
|
||
This is why mermaid was born, a simple markdown-like script language for generating charts from text via javascript. | ||
|
||
**Mermaid was nomiated and won the JS Open Source Awards (2019) in the catory The most existing use of technology!!! Thanks to all involved, people committing pull requests, people answering questions and special thanks to Tyler Long who is helping me maintin the project.** | ||
|
||
### Are you someone who wants to take an active role in improving mermaid? | ||
|
||
Look at the list of areas we need help with: | ||
|
||
* Development - help solving issues | ||
* Development - work with the build environment, with JS we keep updating the tools we use | ||
* Development - new diagram types | ||
* Development - Handling Pull Requests | ||
* Test - testing in connection with realeases, regression testing | ||
* Test - verification of fixed issues | ||
* Test - test of pull requests and verification testing | ||
* Release management - more of a PL role, make roadmap for the project, coordinating the work | ||
* Release management - classification and monitoring of incoming issues | ||
|
||
If you think lending a hand to one or more of these areas would be fun, please send an email tp [email protected]! | ||
|
||
### Flowchart | ||
|
||
|
@@ -49,6 +66,7 @@ sequenceDiagram | |
gantt | ||
dateFormat YYYY-MM-DD | ||
title Adding GANTT diagram to mermaid | ||
excludes weekdays 2014-01-10 | ||
section A section | ||
Completed task :done, des1, 2014-01-06,2014-01-08 | ||
|
@@ -147,7 +165,7 @@ As part of this team you would get write access to the repository and would | |
represent the project when answering questions and issues. | ||
|
||
Together we could continue the work with things like: | ||
* adding more typers of diagrams like mindmaps, ert digrams etc | ||
* adding more types of diagrams like mindmaps, ert diagrams etc | ||
* improving existing diagrams | ||
|
||
Don't hesitate to contact me if you want to get involved. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const curveBasis = 'basis' | ||
export const curveLinear = 'linear' | ||
export const curveCardinal = 'cardinal' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
node: 'current' | ||
} | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# End to end tests | ||
|
||
These tests are end to end tests in the sense that they actually render a full diagram in the browser. The purpose of these tests is to simplify handling of merge requests and releases by highlighting possible unexpected side-effects. | ||
|
||
Apart from beeing rendered in a browser the tests perform image snapshots of the diagrams. The tests is handled in the same way as regular jest snapshots tests with the difference that an image comparison is performed instead of a comparison of the generated code. | ||
|
||
## To run the tests | ||
1. Start the dev server by running **yarn dev** | ||
2. Run yarn e2e to run the tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-env jest */ | ||
import { Base64 } from 'js-base64' | ||
|
||
export const mermaidUrl = (graphStr, options) => { | ||
const obj = { | ||
code: graphStr, | ||
mermaid: options | ||
} | ||
const objStr = JSON.stringify(obj) | ||
// console.log(Base64) | ||
return 'http://localhost:9000/e2e.html?graph=' + Base64.encodeURI(objStr) | ||
} | ||
|
||
export const imgSnapshotTest = async (page, graphStr, options) => { | ||
return new Promise(async resolve => { | ||
const url = mermaidUrl(graphStr, options) | ||
|
||
await page.goto(url) | ||
|
||
const image = await page.screenshot() | ||
|
||
expect(image).toMatchImageSnapshot() | ||
resolve() | ||
}) | ||
// page.close() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// jest.config.js | ||
module.exports = { | ||
// verbose: true, | ||
transform: { | ||
'^.+\\.jsx?$': '../transformer.js' | ||
}, | ||
preset: 'jest-puppeteer', | ||
'globalSetup': 'jest-environment-puppeteer/setup', | ||
'globalTeardown': 'jest-environment-puppeteer/teardown', | ||
'testEnvironment': 'jest-environment-puppeteer' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import mermaid from '../../dist/mermaid.core' | ||
|
||
mermaid.initialize({ | ||
theme: 'forest', | ||
gantt: { axisFormatter: [ | ||
['%Y-%m-%d', (d) => { | ||
return d.getDay() === 1 | ||
}] | ||
] } | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<html> | ||
<head> | ||
<script src="/e2e.js"></script> | ||
<link | ||
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<style></style> | ||
</head> | ||
<body> | ||
<script src="./mermaid.js"></script> | ||
<script> | ||
mermaid.initialize({ | ||
startOnLoad: false, | ||
useMaxWidth: true, | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Base64 } from 'js-base64' | ||
|
||
/** | ||
* ##contentLoaded | ||
* Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and | ||
* calls init for rendering the mermaid diagrams on the page. | ||
*/ | ||
const contentLoaded = function () { | ||
let pos = document.location.href.indexOf('?graph=') | ||
if (pos > 0) { | ||
pos = pos + 7 | ||
const graphBase64 = document.location.href.substr(pos) | ||
const graphObj = JSON.parse(Base64.decode(graphBase64)) | ||
// const graph = 'hello' | ||
console.log(graphObj) | ||
const div = document.createElement('div') | ||
div.id = 'block' | ||
div.className = 'mermaid' | ||
div.innerHTML = graphObj.code | ||
document.getElementsByTagName('body')[0].appendChild(div) | ||
global.mermaid.initialize(graphObj.mermaid) | ||
global.mermaid.init() | ||
} | ||
} | ||
|
||
if (typeof document !== 'undefined') { | ||
/*! | ||
* Wait for document loaded before starting the execution | ||
*/ | ||
window.addEventListener( | ||
'load', | ||
function () { | ||
contentLoaded() | ||
}, | ||
false | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<body> | ||
<div class="mermaid"> | ||
graph LR | ||
A-->B | ||
</div> | ||
<div class="mermaid"> | ||
gantt | ||
title A Gantt Diagram | ||
dateFormat YYYY-MM-DD | ||
section Section | ||
A task :a1, 2014-01-01, 30d | ||
Another task :after a1 , 20d | ||
section Another | ||
Task in sec :2014-01-12 , 12d | ||
another task : 24d | ||
</div> | ||
<script src="./bundle-test.js" charset="utf-8"></script> | ||
</body> | ||
|
||
</html> |
Binary file added
BIN
+35.6 KB
...iagram-spec-js-sequencediagram-should-render-a-simple-class-diagrams-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.5 KB
...flowchart-spec-js-flowcart-should-render-a-flowchart-full-of-circles-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.6 KB
..._/flowchart-spec-js-flowcart-should-render-a-flowchart-full-of-icons-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+24.5 KB
...cart-should-render-a-flowchart-with-ling-sames-and-class-definitoins-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.1 KB
...pshots__/flowchart-spec-js-flowcart-should-render-a-simple-flowchart-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.1 KB
...ts__/flowchart-spec-js-flowcart-should-render-a-simple-flowchart-old-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.7 KB
...t-spec-js-flowcart-should-render-a-simple-flowchart-with-line-breaks-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+24.5 KB
...t-spec-js-flowcart-should-render-a-simple-flowchart-with-long-labels-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.7 KB
...napshots__/flowchart-spec-js-flowcart-should-render-styled-subgraphs-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.65 KB
...image_snapshots__/flowchart-spec-js-flowcart-should-render-subgraphs-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.1 KB
e2e/spec/__image_snapshots__/flowchart-spec-js-google-should-apa-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.8 KB
...napshots__/gantt-spec-js-sequencediagram-should-render-a-gantt-chart-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.17 KB
..._/git-graph-spec-js-sequencediagram-should-render-a-simple-git-graph-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.3 KB
...ram-spec-js-sequencediagram-should-render-a-simple-sequence-diagrams-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.7 KB
...age-spec-js-sequencediagram-should-render-a-simple-sequence-diagrams-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* eslint-env jest */ | ||
import { imgSnapshotTest } from '../helpers/util.js' | ||
const { toMatchImageSnapshot } = require('jest-image-snapshot') | ||
|
||
expect.extend({ toMatchImageSnapshot }) | ||
|
||
describe('Sequencediagram', () => { | ||
it('should render a simple class diagrams', async () => { | ||
await imgSnapshotTest(page, ` | ||
classDiagram | ||
Class01 <|-- AveryLongClass : Cool | ||
Class03 *-- Class04 | ||
Class05 o-- Class06 | ||
Class07 .. Class08 | ||
Class09 --> C2 : Where am i? | ||
Class09 --* C3 | ||
Class09 --|> Class07 | ||
Class07 : equals() | ||
Class07 : Object[] elementData | ||
Class01 : size() | ||
Class01 : int chimp | ||
Class01 : int gorilla | ||
Class08 <--> C2: Cool label | ||
`, | ||
{}) | ||
}) | ||
}) |
Oops, something went wrong.