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

Zenuml support #8

Open
wants to merge 66 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
013a3bb
Added README for mermaid-zenuml.
MrCoder Oct 26, 2022
48441f7
feat(zenuml): :construction: create the mermaid-zenuml package
Oct 26, 2022
d2f5369
Merge branch 'feature/porting-zenuml-to-mermaid' into zenuml-support
Oct 26, 2022
3994f79
created new build script
Oct 31, 2022
581d10c
Dynamically link zenuml.css
Oct 31, 2022
47ce250
Imported vue-sequence.css
Nov 1, 2022
23ad765
Wrapped the sequence-diagram with the svg
Nov 2, 2022
ab23715
Make sure initial vue-sequence rendering is not visible
Nov 2, 2022
e838d14
Added ZenUML to demos/index.html and moved zenuml.html to demos folder.
MrCoder Nov 3, 2022
7c6b194
Fixed the link to ZenUML core.
MrCoder Nov 3, 2022
0c4ed69
Refactor zenumlRenderer
Nov 6, 2022
d38e885
Extracted db and parser.
MrCoder Nov 11, 2022
c3f224a
Merged from 'develop' branch.
MrCoder Nov 11, 2022
3840359
Merge branch 'develop' into zenuml-support
MrCoder Nov 11, 2022
5d41285
Fixed pnpm-lock.yaml
MrCoder Nov 11, 2022
192615d
merged from origin develop.
MrCoder Nov 18, 2022
de9c178
Replaced setTimeout with await call (new version of the renderer).
MrCoder Nov 18, 2022
07b2458
Avoid load the same CSS multiple times
Nov 19, 2022
db69cd9
Remove unnecessary dependencies and scripts
Nov 19, 2022
11e0566
Fix package.json and build script
Nov 20, 2022
3763ea0
Fixed typings
Nov 20, 2022
d6d3216
Add zenuml test cases
Nov 20, 2022
48ff9c4
Updating documentation for ZenUML.
MrCoder Nov 30, 2022
d777942
Merged from origin develop branch.
MrCoder Nov 30, 2022
31d05e7
Updated zenuml document.
MrCoder Nov 30, 2022
5ebb0d9
Merge branch 'develop' into zenuml-support
MrCoder Nov 30, 2022
2a451d1
Fixed a lint error.
MrCoder Dec 1, 2022
72ad4a9
Change id from a generic name "app" to "zenUMLApp"
MrCoder Dec 1, 2022
fe6c09a
Update .eslintrc.json as we will be using cSpell.json
MrCoder Dec 1, 2022
70d131d
Moved Antlr4 to cSpell.json.
MrCoder Dec 1, 2022
c3fa1a6
Fixed issues in doc for ZenUML; cleaned up zenumlRender.
MrCoder Dec 1, 2022
c5365e3
Removed types/index.d.ts from mermaid-zenuml
MrCoder Dec 1, 2022
ff4ee85
Updated description for ZenUML.
MrCoder Dec 1, 2022
53a4b4c
Removed one cypress test that does not apply anymore.
MrCoder Dec 1, 2022
97e585b
Update description for ZenUML
MrCoder Dec 2, 2022
0350a1c
Updated the instruction on rendering ZenUML.
MrCoder Dec 2, 2022
b9449da
Simplified ZenUML diagram rendering.
MrCoder Dec 2, 2022
42c7ef7
Removed mermaid-example-diagram from .vite/build.ts.
MrCoder Dec 2, 2022
360e291
Merge branch 'develop' into zenuml-support
MrCoder Dec 7, 2022
bdbbc36
Hide the footer (tips, zoom panel and zenuml.com link).
MrCoder Dec 7, 2022
65f8b38
Merged from develop branch
MrCoder Dec 16, 2022
929b891
Added zenuml core code
MrCoder Dec 16, 2022
4b506c8
Switched to pnpm package management for zenuml/core.
MrCoder Dec 16, 2022
8bd0ea8
It can import with a simple `export default {a:1}` in core.common.js.
MrCoder Dec 17, 2022
4b35609
Able to render the demo.
MrCoder Dec 27, 2022
18a67c6
Merge pull request #9 from ZenUml/fix-zenuml-core-import-error
MrCoder Dec 27, 2022
cebb1ed
Upgraded core to vite and fixed many related issue.
MrCoder Dec 27, 2022
06a5492
merged from 'develop' branch.
MrCoder Dec 27, 2022
6b45304
Updated version for 'marked' and 'color-string'.
MrCoder Dec 27, 2022
157fd0d
Removed `import { describe ... } from 'vitest'` because mermaid uses …
MrCoder Dec 28, 2022
bed3e81
Ignored `packages/mermaid-zenuml/zenuml/core/reports` for `pnpm run l…
MrCoder Dec 28, 2022
090ae9b
Updated pos.cal3.spec.ts to disable an eslint error. (workaround)
MrCoder Dec 28, 2022
90215a5
Ignored generated parser to disable an eslint error. (workaround)
MrCoder Dec 28, 2022
46b7e1f
Removed unused variable to disable an eslint error.
MrCoder Dec 28, 2022
7b7f017
Fixed codestyle with 'lint:fix'.
MrCoder Dec 28, 2022
65ee75f
Added back files that are mistakenly ignored.
MrCoder Dec 28, 2022
797432e
Build zenuml core in build:vite.
MrCoder Dec 31, 2022
2cecc4e
Build zenuml/core in pnpm run build and pnpm run dev.
MrCoder Jan 1, 2023
924e38b
Merge pull request #10 from ZenUml/build-zenuml-in-pnpm-run-build
MrCoder Jan 1, 2023
656be98
Synced from zenuml/core to disallow remote github css whose url does …
MrCoder Jan 1, 2023
5ad3b4a
Fixed a lint issue
MrCoder Jan 1, 2023
17cea16
Fixed "Incomplete URL substring sanitization".
MrCoder Jan 1, 2023
b233af7
Removed an unused spec file.
MrCoder Jan 1, 2023
882c799
Fixed an issue the render function resolves before block is mounted.
MrCoder Jan 1, 2023
6e28972
Fixed component path in core.ts
MrCoder Jan 1, 2023
799f0da
Merge pull request #11 from ZenUml/fix-zenuml-build-2
MrCoder Jan 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ dist/**
docs/Setup.md
cypress.config.js
cypress/plugins/index.js
coverage
coverage
# temporarily ignore this folder.
packages/mermaid-zenuml/zenuml/core/**
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ tsconfig.tsbuildinfo
knsv*.html
local*.html
stats/

packages/mermaid-zenuml/zenuml/core/reports
packages/mermaid-zenuml/zenuml/core/src/generated-parser
117 changes: 112 additions & 5 deletions .vite/build.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { build, InlineConfig, type PluginOption } from 'vite';
import { createVuePlugin as vue } from 'vite-plugin-vue2';

import { resolve } from 'path';
import { fileURLToPath } from 'url';
import jisonPlugin from './jisonPlugin.js';
import { readFileSync } from 'fs';
import { visualizer } from 'rollup-plugin-visualizer';
import type { TemplateType } from 'rollup-plugin-visualizer/dist/plugin/template-types.js';
import autoprefixer from 'autoprefixer';
import tailwindcss from 'tailwindcss';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';

const visualize = process.argv.includes('--visualize');
const watch = process.argv.includes('--watch');
Expand Down Expand Up @@ -41,11 +46,16 @@ const packageOptions = {
packageName: 'mermaid-mindmap',
file: 'detector.ts',
},
// 'mermaid-example-diagram-detector': {
// name: 'mermaid-example-diagram-detector',
// packageName: 'mermaid-example-diagram',
// file: 'detector.ts',
// },
'mermaid-zenuml/zenuml/core': {
name: 'zenuml',
packageName: 'mermaid-zenuml/zenuml/core',
file: 'core.ts',
},
'mermaid-zenuml': {
name: 'mermaid-zenuml',
packageName: 'mermaid-zenuml',
file: 'detector.ts',
},
};

interface BuildOptions {
Expand Down Expand Up @@ -120,13 +130,108 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
if (watch && config.build) {
config.build.watch = {
include: [
'packages/mermaid-zenuml/zenuml/core/src/**',
'packages/mermaid-zenuml/src/**',
'packages/mermaid-mindmap/src/**',
'packages/mermaid/src/**',
// 'packages/mermaid-example-diagram/src/**',
],
};
}

if (entryName === 'mermaid-zenuml/zenuml/core') {
config.plugins.push(vue());
config.plugins.push(cssInjectedByJsPlugin());
config.css = {
postcss: {
plugins: [
tailwindcss({
important: '.zenuml',
content: [
'./packages/mermaid-zenuml/zenuml/core/**/*.html',
'./packages/mermaid-zenuml/zenuml/core/src/**/*.vue',
],
theme: {
extend: {
textColor: {
skin: {
title:
'var(--color-text-title, var(--color-text-message, var(--color-text-base, #000)))',
participant:
'var(--color-text-participant, var(--color-text-message, var(--color-text-base, #000)))',
message: 'var(--color-text-message, var(--color-text-base, #000))',
'message-arrow':
'var(--color-message-arrow, var(--color-border-frame, var(--color-border-base, #000)))', // message arrow head
'message-hover': 'var(--color-text-message-hover, var(--color-bg-base, #fff))',
comment:
'var(--color-text-comment, var(--color-text-secondary, var(--color-text-base, #000)))',
'fragment-header':
'var(--color-text-fragment-header, var(--color-text-message, #000))',
fragment: 'var(--color-text-fragment, var(--color-text-message, #000))',
base: 'var(--color-text-base)',
header: 'var(--color-text-header)',
secondary: 'var(--color-text-secondary)',
control:
'var(--color-text-control, var(--color-text-secondary, var(--color-text-base, #000)))',
muted: 'var(--color-text-muted)',
hover: 'var(--color-text-hover)',
link: `var(--color-text-link, var(--color-text-secondary, var(--color-text-base, #000)))`,
fill: `var(--color-text-fill)`,
},
},
backgroundColor: {
skin: {
canvas: 'var(--color-bg-canvas, var(--color-bg-base, #fff))',
frame:
'var(--color-bg-frame, var(--color-bg-canvas, var(--color-bg-base, #fff)))',
title:
'var(--color-bg-title, var(--color-bg-frame, var(--color-bg-canvas, var(--color-bg-base, #fff))))',
participant:
'var(--color-bg-participant, var(--color-bg-frame, var(--color-bg-canvas, var(--color-bg-base, #fff))))',
lifeline:
'var(--color-border-participant, var(--color-border-participant, var(--color-border-frame, var(--color-border-base, #000))))',
divider:
'var(--color-border-participant, var(--color-border-frame, var(--color-border-base, #000)))',
'message-hover': 'var(--color-bg-message-hover, var(--color-text-base, #000))',
'fragment-header': 'var(--color-bg-fragment-header, transparent)',
occurrence:
'var(--color-bg-occurrence, var(--color-bg-participant, var(--color-bg-frame, var(--color-bg-canvas, var(--color-bg-base, #fff)))))',
base: 'var(--color-bg-base)',
secondary: 'var(--color-bg-secondary)',
hover: 'var(--color-bg-hover)',
fill: 'var(--color-bg-fill)',
},
},
borderColor: {
skin: {
frame: 'var(--color-border-frame, var(--color-border-base, #000))',
participant:
'var(--color-border-participant, var(--color-border-frame, var(--color-border-base, #000)))',
'message-arrow':
'var(--color-message-arrow, var(--color-border-frame, var(--color-border-base, #000)))', // message arrow line
fragment:
'var(--color-border-fragment, var(--color-border-frame, var(--color-border-base, #000)))',
occurrence:
'var(--color-border-occurrence, var(--color-border-frame, var(--color-border-base, #000)))',
base: 'var(--color-border-base)',
secondary: 'var(--color-border-secondary)',
},
},
gradientColorStops: {
skin: {
base: 'var(--color-bg-base)',
secondary: 'var(--color-bg-secondary)',
},
},
},
},
plugins: [],
}),
autoprefixer,
],
},
};
}
return config;
};

Expand All @@ -149,6 +254,8 @@ if (watch) {
build(getBuildConfig({ minify: false, watch, core: false, entryName: 'mermaid' }));
if (!mermaidOnly) {
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-mindmap' }));
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-zenuml' }));
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-zenuml/zenuml/core' }));
// build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' }));
}
} else if (visualize) {
Expand Down
1 change: 1 addition & 0 deletions .vite/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ async function createServer() {
app.use(express.static('./packages/mermaid/dist'));
app.use(express.static('./packages/mermaid-example-diagram/dist'));
app.use(express.static('./packages/mermaid-mindmap/dist'));
app.use(express.static('./packages/mermaid-zenuml/dist'));
app.use(vite.middlewares);
app.use(express.static('demos'));
app.use(express.static('cypress/platform'));
Expand Down
4 changes: 3 additions & 1 deletion cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"adamiecki",
"alois",
"antiscript",
"antlr4",
"applitools",
"asciidoctor",
"ashish",
Expand Down Expand Up @@ -97,7 +98,8 @@
"visio",
"vitepress",
"xlink",
"yash"
"yash",
"zenuml"
],
"patterns": [
{ "name": "Markdown links", "pattern": "\\((.*)\\)", "description": "" },
Expand Down
1 change: 1 addition & 0 deletions custom-word-list.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Antlr4
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 '../../packages/mermaid/src/mermaid';
import mindmap from '../../packages/mermaid-mindmap/src/detector';
import zenUml from '../../packages/mermaid-zenuml/src/detector';

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

await mermaid2.registerExternalDiagrams([mindmap]);
await mermaid2.registerExternalDiagrams([mindmap, zenUml]);
mermaid2.initialize(graphObj.mermaid);
mermaid2.init();
}
Expand Down
3 changes: 3 additions & 0 deletions demos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,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>
58 changes: 58 additions & 0 deletions demos/zenuml.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Mermaid Quick Test Page</title>
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
<!-- <link rel="stylesheet" href="https://unpkg.com/vue-sequence/dist/vue-sequence.css" /> -->
<style>
div.mermaid {
/* font-family: 'trebuchet ms', verdana, arial; */
font-family: 'Courier New', Courier, monospace !important;
}
</style>
</head>

<body>
<h1>Zen UML 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 zenUml from '../../packages/mermaid-zenuml/src/detector';
import mermaid from '../../packages/mermaid/src/mermaid';
await mermaid.registerExternalDiagrams([zenUml]);
await mermaid.initialize({ logLevel: 0 });
</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