Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @mermaid-js/mermaid-zenuml package for zenuml Integration #4334

Merged
merged 25 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
12ed818
Add zenuml
sidharthv96 Apr 22, 2023
b9e7ba0
Update ZenUML
sidharthv96 Apr 25, 2023
ec62c2b
Merge branch 'develop' into sidv/zenuml
sidharthv96 Apr 25, 2023
8b18fd9
Add test
sidharthv96 Apr 25, 2023
8cd48bf
Add docs
sidharthv96 Apr 25, 2023
88f9233
Merge branch 'develop' into sidv/zenuml
sidharthv96 Apr 27, 2023
a01343b
Fix lockfile
sidharthv96 Apr 27, 2023
cce5505
Address mermaid-zenuml PR comments
May 16, 2023
c889ef0
update pnpm-lock.yaml
May 16, 2023
82eccb7
fixed typo and update peerDependencies version
May 16, 2023
c7affbe
Merge pull request #4405 from ZenUml/dongc/zenuml
sidharthv96 May 16, 2023
97be498
Merge branch 'develop' into sidv/zenuml
sidharthv96 May 16, 2023
6a89ef9
Cleanup
sidharthv96 May 17, 2023
bb400d5
Address mermaid-zenuml PR comments
dontry May 16, 2023
507e24c
update pnpm-lock.yaml
dontry May 16, 2023
27e59e5
fixed typo and update peerDependencies version
dontry May 16, 2023
c255d95
Merge pull request #4405 from ZenUml/dongc/zenuml
sidharthv96 May 16, 2023
e984b34
Merge branch 'develop' into sidv/zenuml
aloisklink May 17, 2023
49c97da
ignore ZenUML types
dontry May 17, 2023
a006168
Add contributors profile url
dontry May 17, 2023
6cce1b2
Update docs
aloisklink May 17, 2023
acc19db
Merge branch 'develop' into sidv/zenuml
aloisklink May 17, 2023
9cec5ae
Merge branch 'sidv/zenuml' of https://github.com/mermaid-js/mermaid i…
sidharthv96 May 23, 2023
102b9bc
Merge branch 'develop' into sidv/zenuml
sidharthv96 May 23, 2023
d148a65
Merge branch 'develop' into sidv/zenuml
sidharthv96 Jun 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ docs/Setup.md
cypress.config.js
cypress/plugins/index.js
coverage
*.json
*.json
node_modules
6 changes: 6 additions & 0 deletions .vite/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ const packageOptions = {
packageName: 'mermaid-example-diagram',
file: 'detector.ts',
},
'mermaid-zenuml': {
name: 'mermaid-zenuml',
packageName: 'mermaid-zenuml',
file: 'detector.ts',
},
};

interface BuildOptions {
Expand Down Expand Up @@ -146,6 +151,7 @@ if (watch) {
build(getBuildConfig({ minify: false, watch, core: false, entryName: 'mermaid' }));
if (!mermaidOnly) {
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' }));
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-zenuml' }));
}
} else if (visualize) {
await build(getBuildConfig({ minify: false, core: true, entryName: 'mermaid' }));
Expand Down
1 change: 1 addition & 0 deletions .vite/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ async function createServer() {

app.use(cors());
app.use(express.static('./packages/mermaid/dist'));
app.use(express.static('./packages/mermaid-zenuml/dist'));
app.use(express.static('./packages/mermaid-example-diagram/dist'));
app.use(vite.middlewares);
app.use(express.static('demos'));
Expand Down
4 changes: 3 additions & 1 deletion cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"alois",
"aloisklink",
"antiscript",
"antlr",
"appli",
"applitools",
"asciidoctor",
Expand Down Expand Up @@ -134,7 +135,8 @@
"vitepress",
"vueuse",
"xlink",
"yash"
"yash",
"zenuml"
],
"patterns": [
{ "name": "Markdown links", "pattern": "\\((.*)\\)", "description": "" },
Expand Down
19 changes: 19 additions & 0 deletions cypress/integration/rendering/zenuml.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { imgSnapshotTest } from '../../helpers/util.js';

describe('Zen UML', () => {
it('Basic Zen UML diagram', () => {
imgSnapshotTest(
`
zenuml
A.method() {
if(x) {
B.method() {
selfCall() { return X }
}
}
}
`,
{}
);
});
});
3 changes: 2 additions & 1 deletion cypress/platform/viewer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import mermaid2 from './mermaid.esm.mjs';
import externalExample from '../../packages/mermaid-example-diagram/dist/mermaid-example-diagram.core.mjs';
import zenUml from '../../packages/mermaid-zenuml/dist/mermaid-zenuml.core.mjs';

function b64ToUtf8(str) {
return decodeURIComponent(escape(window.atob(str)));
Expand Down Expand Up @@ -44,7 +45,7 @@ const contentLoaded = async function () {
document.getElementsByTagName('body')[0].appendChild(div);
}

await mermaid2.registerExternalDiagrams([externalExample]);
await mermaid2.registerExternalDiagrams([externalExample, zenUml]);
mermaid2.initialize(graphObj.mermaid);
await mermaid2.run();
}
Expand Down
3 changes: 3 additions & 0 deletions demos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ <h2><a href="./sequence.html">Sequence</a></h2>
<li>
<h2><a href="./state.html">State</a></h2>
</li>
<li>
<h2><a href="./zenuml.html">ZenUML</a></h2>
</li>
</ul>
</body>
</html>
53 changes: 53 additions & 0 deletions demos/zenuml.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Mermaid Zenuml Test Page</title>
</head>

<body>
<h1>Zenuml demos</h1>
<pre class="mermaid">
zenuml
title Sync Messages (Design Pattern: Adapter)
@Starter(Client)
Adapter.interfaceMethod() {
translateParameter(parameter)

result = Implementation.implementationMethod()

translateResult()
return translatedResult
}
</pre>
<pre class="mermaid">
zenuml
title Async Messages (SPA Authentication)
// ```
// GET https://${account.namespace}/authorize/?
// response_type=token
// &client_id=${account.clientId}
// &redirect_url=YOUR_CALLBACK_URL
// &state=VALUE_THAT_SURVIVES_REDIRECTS
// &scope=openid
// ```
Browser->Auth0: 1. initiate the authentication
Auth0->"Identity Provider": 2. OAuth2 / SAML, etc
"Identity Provider"->"Identity Provider": 3. user gets authenticated
Auth0->Browser: 4. redirect to ${YOUR_CALLBACK_URL}/#id_token=e68...
Browser->Auth0: 5. validate id_token and get user profile
Browser->"Your API": 6. call API sending JWT in Authorization header
"Your API"->"Your API": 7. validate token
</pre>

<script type="module">
import mermaid from './mermaid.esm.mjs';
import zenuml from './mermaid-zenuml.esm.mjs';
await mermaid.registerExternalDiagrams([zenuml]);
mermaid.initialize({
logLevel: 3,
});
</script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading