mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Merge remote-tracking branch 'MERMAID/develop' into feat/3626-aria-descBy-roledescription-mocks
# Conflicts: # cypress/integration/rendering/gantt.spec.js # cypress/integration/rendering/requirement.spec.js # docs/config/setup/modules/mermaidAPI.md # packages/mermaid/src/accessibility.js
This commit is contained in:
commit
f036d58ec3
@ -29,7 +29,8 @@
|
||||
"jsdoc",
|
||||
"json",
|
||||
"@cspell",
|
||||
"lodash"
|
||||
"lodash",
|
||||
"unicorn"
|
||||
],
|
||||
"rules": {
|
||||
"curly": "error",
|
||||
@ -63,7 +64,29 @@
|
||||
}
|
||||
],
|
||||
"no-only-tests/no-only-tests": "error",
|
||||
"lodash/import-scope": ["error", "method"]
|
||||
"lodash/import-scope": ["error", "method"],
|
||||
"unicorn/better-regex": "error",
|
||||
"unicorn/no-abusive-eslint-disable": "error",
|
||||
"unicorn/no-array-push-push": "error",
|
||||
"unicorn/no-for-loop": "error",
|
||||
"unicorn/no-instanceof-array": "error",
|
||||
"unicorn/no-typeof-undefined": "error",
|
||||
"unicorn/no-unnecessary-await": "error",
|
||||
"unicorn/no-unsafe-regex": "warn",
|
||||
"unicorn/no-useless-promise-resolve-reject": "error",
|
||||
"unicorn/prefer-array-find": "error",
|
||||
"unicorn/prefer-array-flat-map": "error",
|
||||
"unicorn/prefer-array-index-of": "error",
|
||||
"unicorn/prefer-array-some": "error",
|
||||
"unicorn/prefer-default-parameters": "error",
|
||||
"unicorn/prefer-includes": "error",
|
||||
"unicorn/prefer-negative-index": "error",
|
||||
"unicorn/prefer-object-from-entries": "error",
|
||||
"unicorn/prefer-string-starts-ends-with": "error",
|
||||
"unicorn/prefer-string-trim-start-end": "error",
|
||||
"unicorn/string-content": "error",
|
||||
"unicorn/prefer-spread": "error",
|
||||
"unicorn/no-lonely-if": "error"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
|
20
.github/workflows/release-preview-publish.yml
vendored
20
.github/workflows/release-preview-publish.yml
vendored
@ -10,22 +10,30 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache: pnpm
|
||||
node-version: 18.x
|
||||
- name: Install Yarn
|
||||
run: npm i yarn --global
|
||||
|
||||
- name: Install Packages
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
env:
|
||||
CYPRESS_CACHE_FOLDER: .cache/Cypress
|
||||
|
||||
- name: Install Json
|
||||
run: npm i json --global
|
||||
|
||||
- name: Install Packages
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Publish
|
||||
working-directory: ./packages/mermaid
|
||||
run: |
|
||||
PREVIEW_VERSION=8
|
||||
PREVIEW_VERSION=$(git log --oneline "origin/$GITHUB_REF_NAME" ^"origin/master" | wc -l)
|
||||
VERSION=$(echo ${{github.ref}} | tail -c +20)-preview.$PREVIEW_VERSION
|
||||
echo $VERSION
|
||||
npm version --no-git-tag-version --allow-same-version $VERSION
|
||||
|
@ -16,6 +16,7 @@
|
||||
"braintree",
|
||||
"brolin",
|
||||
"brotli",
|
||||
"classdef",
|
||||
"codedoc",
|
||||
"colour",
|
||||
"cpettitt",
|
||||
|
@ -328,7 +328,7 @@ describe('Git Graph diagram', () => {
|
||||
title: simple gitGraph
|
||||
---
|
||||
gitGraph
|
||||
commit
|
||||
commit id: "1-abcdefg"
|
||||
`,
|
||||
{}
|
||||
);
|
||||
|
@ -25,6 +25,7 @@ describe('themeCSS balancing, it', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: Delete/Rename this describe, keeping the inner contents.
|
||||
describe('Pie Chart', () => {
|
||||
// beforeEach(()=>{
|
||||
// cy.clock((new Date('2014-06-09')).getTime());
|
||||
|
@ -56,10 +56,11 @@
|
||||
<body>
|
||||
<div>Security check</div>
|
||||
<pre id="diagram" class="mermaid">
|
||||
flowchart TD
|
||||
A --> B
|
||||
B --> C
|
||||
A --> C
|
||||
graph LR
|
||||
subgraph external
|
||||
inside
|
||||
end
|
||||
outside --> external
|
||||
</pre>
|
||||
<pre id="diagram" class="mermaid">
|
||||
mindmap
|
||||
@ -91,9 +92,13 @@ mindmap
|
||||
<!-- <script src="http://localhost:9000/packages/mermaid-mindmap/dist/mermaid-mindmap-detector.js"></script> -->
|
||||
<!-- <script src="./mermaid-example-diagram-detector.js"></script> -->
|
||||
<!-- <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.7/dist/mermaid.min.js"></script> -->
|
||||
<script src="./mermaid.js"></script>
|
||||
<!-- <script src="./mermaid.js"></script> -->
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
import mindmap from '../../packages/mermaid-mindmap/src/detector';
|
||||
// import example from '../../packages/mermaid-example-diagram/src/detector';
|
||||
import mermaid from '../../packages/mermaid/src/mermaid';
|
||||
await mermaid.registerExternalDiagrams([mindmap]);
|
||||
mermaid.parseError = function (err, hash) {
|
||||
// console.error('Mermaid error: ', err);
|
||||
};
|
||||
|
@ -54,7 +54,7 @@ function merge(current, update) {
|
||||
if (
|
||||
current.hasOwnProperty(key) &&
|
||||
typeof current[key] === 'object' &&
|
||||
!(current[key] instanceof Array)
|
||||
!Array.isArray(current[key])
|
||||
) {
|
||||
merge(current[key], update[key]);
|
||||
|
||||
|
@ -36,7 +36,7 @@ Pushes in a directive to the configuration
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config.ts:193](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L193)
|
||||
[config.ts:191](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L191)
|
||||
|
||||
---
|
||||
|
||||
@ -60,7 +60,7 @@ The currentConfig
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config.ts:138](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L138)
|
||||
[config.ts:137](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L137)
|
||||
|
||||
---
|
||||
|
||||
@ -84,7 +84,7 @@ The siteConfig
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config.ts:97](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L97)
|
||||
[config.ts:96](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L96)
|
||||
|
||||
---
|
||||
|
||||
@ -118,7 +118,7 @@ The siteConfig
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config.ts:225](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L225)
|
||||
[config.ts:223](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L223)
|
||||
|
||||
---
|
||||
|
||||
@ -147,7 +147,7 @@ options in-place
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config.ts:153](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L153)
|
||||
[config.ts:152](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L152)
|
||||
|
||||
---
|
||||
|
||||
@ -167,7 +167,7 @@ options in-place
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config.ts:76](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L76)
|
||||
[config.ts:75](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L75)
|
||||
|
||||
---
|
||||
|
||||
@ -199,7 +199,7 @@ The currentConfig merged with the sanitized conf
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config.ts:114](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L114)
|
||||
[config.ts:113](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L113)
|
||||
|
||||
---
|
||||
|
||||
@ -232,7 +232,7 @@ The new siteConfig
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config.ts:62](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L62)
|
||||
[config.ts:61](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L61)
|
||||
|
||||
---
|
||||
|
||||
@ -273,4 +273,4 @@ The new siteConfig
|
||||
|
||||
#### Defined in
|
||||
|
||||
[config.ts:80](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L80)
|
||||
[config.ts:79](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L79)
|
||||
|
@ -90,7 +90,7 @@ mermaid.initialize(config);
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:959](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L959)
|
||||
[mermaidAPI.ts:949](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L949)
|
||||
|
||||
## Functions
|
||||
|
||||
@ -121,7 +121,7 @@ Return the last node appended
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:293](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L293)
|
||||
[mermaidAPI.ts:285](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L285)
|
||||
|
||||
---
|
||||
|
||||
@ -147,7 +147,7 @@ the cleaned up svgCode
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:244](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L244)
|
||||
[mermaidAPI.ts:236](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L236)
|
||||
|
||||
---
|
||||
|
||||
@ -173,7 +173,7 @@ the string with all the user styles
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:171](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L171)
|
||||
[mermaidAPI.ts:165](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L165)
|
||||
|
||||
---
|
||||
|
||||
@ -196,7 +196,7 @@ the string with all the user styles
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:221](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L221)
|
||||
[mermaidAPI.ts:213](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L213)
|
||||
|
||||
---
|
||||
|
||||
@ -223,7 +223,7 @@ with an enclosing block that has each of the cssClasses followed by !important;
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:155](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L155)
|
||||
[mermaidAPI.ts:149](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L149)
|
||||
|
||||
---
|
||||
|
||||
@ -289,7 +289,7 @@ Put the svgCode into an iFrame. Return the iFrame code
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:272](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L272)
|
||||
[mermaidAPI.ts:264](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L264)
|
||||
|
||||
---
|
||||
|
||||
@ -315,4 +315,4 @@ Remove any existing elements from the given document
|
||||
|
||||
#### Defined in
|
||||
|
||||
[mermaidAPI.ts:344](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L344)
|
||||
[mermaidAPI.ts:336](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L336)
|
||||
|
@ -1,179 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>
|
||||
mermaid - Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams,
|
||||
gantt charts and git graphs.
|
||||
</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs."
|
||||
/>
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
|
||||
/>
|
||||
<!-- <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css"> -->
|
||||
<link rel="stylesheet" href="theme.css" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css"
|
||||
/>
|
||||
<script
|
||||
defer
|
||||
data-domain="mermaid-js.github.io"
|
||||
src="https://plausible.io/js/plausible.js"
|
||||
></script>
|
||||
<script>
|
||||
const require = {
|
||||
paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs' },
|
||||
};
|
||||
</script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs/loader.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs/editor/editor.main.nls.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs/editor/editor.main.js"></script>
|
||||
<script>
|
||||
exports = {};
|
||||
</script>
|
||||
<script src="https://unpkg.com/monaco-mermaid/browser.js"></script>
|
||||
|
||||
<style>
|
||||
.markdown-section {
|
||||
max-width: 1200px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module">
|
||||
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
|
||||
import mindmap from 'https://unpkg.com/@mermaid-js/mermaid-mindmap@9/dist/mermaid-mindmap.esm.min.mjs';
|
||||
await mermaid.registerExternalDiagrams([mindmap]);
|
||||
|
||||
window.mermaid = mermaid;
|
||||
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
|
||||
const conf = {
|
||||
logLevel: 4,
|
||||
startOnLoad: true,
|
||||
themeCSS: '.label { font-family: Source Sans Pro,Helvetica Neue,Arial,sans-serif; }',
|
||||
};
|
||||
if (isDarkMode) conf.theme = 'dark';
|
||||
|
||||
async function loadMermaid() {
|
||||
mermaid.parseError = (e) => {
|
||||
console.log('parse error', e); // eslint-disable-line
|
||||
};
|
||||
await mermaid.registerExternalDiagrams([mindmap]);
|
||||
mermaid.initialize(conf);
|
||||
console.log('mermaid initialized'); // eslint-disable-line
|
||||
}
|
||||
|
||||
await loadMermaid();
|
||||
</script>
|
||||
<script>
|
||||
let initEditor = exports.default;
|
||||
let parser = new DOMParser();
|
||||
let currentCodeExample = 0;
|
||||
let colorize = [];
|
||||
let num = 0;
|
||||
|
||||
function colorizeEverything(html) {
|
||||
initEditor(monaco);
|
||||
return new Promise((resolve, reject) => {
|
||||
monaco.editor.setTheme('mermaid');
|
||||
const parsed = parser.parseFromString(html, 'text/html').body;
|
||||
Promise.all(
|
||||
[...parsed.querySelectorAll('pre[id*="code"]')].map((codeBlock) =>
|
||||
monaco.editor.colorize(codeBlock.innerText, 'mermaid')
|
||||
)
|
||||
).then((result) => {
|
||||
parsed
|
||||
.querySelectorAll('pre[id*="code"]')
|
||||
.forEach((codeBlock, index) => (codeBlock.innerHTML = result[index]));
|
||||
resolve(parsed.innerHTML);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function escapeHTML(html) {
|
||||
return html
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll("'", ''');
|
||||
}
|
||||
|
||||
window.$docsify = {
|
||||
search: 'auto',
|
||||
name: 'mermaid',
|
||||
repo: 'https://github.com/mermaid-js/mermaid',
|
||||
loadSidebar: true,
|
||||
mergeNavbar: true,
|
||||
maxLevel: 4,
|
||||
subMaxLevel: 2,
|
||||
markdown: {
|
||||
renderer: {
|
||||
code: function (code, lang) {
|
||||
if (lang === 'mermaid-example') {
|
||||
console.log('An example'); // eslint-disable-line
|
||||
currentCodeExample++;
|
||||
colorize.push(currentCodeExample);
|
||||
return '<pre id="code' + currentCodeExample + '">' + escapeHTML(code) + '</pre>';
|
||||
} else if (lang === 'mermaid') {
|
||||
return '<pre class="mermaid">' + code + '</pre>';
|
||||
}
|
||||
return this.origin.code.apply(this, arguments);
|
||||
},
|
||||
heading: function (text) {
|
||||
if (text.includes('THIS IS AN AUTOGENERATED FILE. DO NOT EDIT')) {
|
||||
return '';
|
||||
}
|
||||
return this.origin.heading.apply(this, arguments);
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
function (hook, vm) {
|
||||
hook.beforeEach(function (html) {
|
||||
url = 'https://github.com/mermaid-js/mermaid/blob/develop/src/docs/' + vm.route.file;
|
||||
const editHtml = '[:memo: Edit this Page](' + url + ')\n';
|
||||
return editHtml + html;
|
||||
});
|
||||
// Invoked on each page load after new HTML has been appended to the DOM
|
||||
hook.doneEach(async function () {
|
||||
await mermaid.init();
|
||||
});
|
||||
|
||||
hook.afterEach(function (html, next) {
|
||||
next(html);
|
||||
(async () => {
|
||||
while (!window.hasOwnProperty('monaco'))
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
colorizeEverything(html).then(
|
||||
(newHTML) =>
|
||||
(document.querySelector('article.markdown-section').innerHTML = newHTML)
|
||||
);
|
||||
})();
|
||||
});
|
||||
},
|
||||
],
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
window.onhashchange = function (a) {
|
||||
// if (location && ga) {
|
||||
// ga('send', 'pageview', location.hash);
|
||||
// }
|
||||
};
|
||||
</script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
|
||||
<!-- <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/ga.min.js"></script> -->
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-coffeescript.min.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -143,6 +143,10 @@ Rendering in Mermaid is initialized by `mermaid.initialize()` call. You can plac
|
||||
| ----------- | --------------------------------- | ------- | ----------- |
|
||||
| startOnLoad | Toggle for Rendering upon loading | Boolean | true, false |
|
||||
|
||||
### Adding external diagrams to mermaid
|
||||
|
||||
Please refer to the [Mindmap](./mindmap.md?id=integrating-with-your-librarywebsite) section for more information.
|
||||
|
||||
### Working Examples
|
||||
|
||||
**Here is a full working example of the mermaidAPI being called through the CDN:**
|
||||
|
@ -253,3 +253,17 @@ Root
|
||||
B
|
||||
C
|
||||
```
|
||||
|
||||
## Integrating with your library/website.
|
||||
|
||||
Mindmap uses the experimental lazy loading & async rendering features which could change in the future.
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
|
||||
import mindmap from 'https://unpkg.com/@mermaid-js/mermaid-mindmap@9/dist/mermaid-mindmap.esm.min.mjs';
|
||||
await mermaid.registerExternalDiagrams([mindmap]);
|
||||
</script>
|
||||
```
|
||||
|
||||
You can also refer the implementation in the live editor [here](https://github.com/mermaid-js/mermaid-live-editor/blob/fcf53c98c25604c90a218104268c339be53035a6/src/lib/util/mermaid.ts) to see how the async loading is done.
|
||||
|
@ -4,7 +4,7 @@
|
||||
"version": "9.2.2",
|
||||
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@7.17.0",
|
||||
"packageManager": "pnpm@7.17.1",
|
||||
"keywords": [
|
||||
"diagram",
|
||||
"markdown",
|
||||
@ -91,7 +91,6 @@
|
||||
"express": "^4.18.2",
|
||||
"globby": "^13.1.2",
|
||||
"husky": "^8.0.2",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^29.3.1",
|
||||
"jison": "^0.4.18",
|
||||
"js-yaml": "^4.1.0",
|
||||
@ -107,9 +106,6 @@
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.8.4",
|
||||
"vite": "^3.2.3",
|
||||
"vitepress": "^1.0.0-alpha.28",
|
||||
"vitepress-plugin-mermaid": "^2.0.8",
|
||||
"vitepress-plugin-search": "^1.0.4-alpha.15",
|
||||
"vitest": "^0.25.3"
|
||||
},
|
||||
"volta": {
|
||||
|
@ -1,6 +1,7 @@
|
||||
const warning = (s: string) => {
|
||||
// Todo remove debug code
|
||||
console.error('Log function was called before initialization', s); // eslint-disable-line
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Log function was called before initialization', s);
|
||||
};
|
||||
|
||||
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
||||
|
@ -1,11 +1,10 @@
|
||||
{
|
||||
"name": "mermaid",
|
||||
"version": "9.2.2",
|
||||
"version": "9.2.3-rc.1",
|
||||
"description": "Markdown-ish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
|
||||
"main": "./dist/mermaid.min.js",
|
||||
"module": "./dist/mermaid.core.mjs",
|
||||
"types": "./dist/mermaid.d.ts",
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./dist/mermaid.min.js",
|
||||
@ -57,7 +56,6 @@
|
||||
"d3": "^7.0.0",
|
||||
"dagre-d3-es": "7.0.4",
|
||||
"dompurify": "2.4.1",
|
||||
"fast-clone": "^1.5.13",
|
||||
"khroma": "^2.0.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"moment-mini": "^2.24.0",
|
||||
@ -81,7 +79,6 @@
|
||||
"coveralls": "^3.1.1",
|
||||
"cspell": "^6.14.3",
|
||||
"globby": "^13.1.2",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jison": "^0.4.18",
|
||||
"js-base64": "^3.7.2",
|
||||
"jsdom": "^20.0.2",
|
||||
@ -95,7 +92,9 @@
|
||||
"typedoc": "^0.23.18",
|
||||
"typedoc-plugin-markdown": "^3.13.6",
|
||||
"typescript": "^4.8.4",
|
||||
"unist-util-flatmap": "^1.0.0"
|
||||
"unist-util-flatmap": "^1.0.0",
|
||||
"vitepress": "^1.0.0-alpha.28",
|
||||
"vitepress-plugin-search": "^1.0.4-alpha.15"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
|
@ -32,20 +32,20 @@ const assignWithDepth = function (dst, src, config) {
|
||||
return dst;
|
||||
} else if (Array.isArray(src) && Array.isArray(dst)) {
|
||||
src.forEach((s) => {
|
||||
if (dst.indexOf(s) === -1) {
|
||||
if (!dst.includes(s)) {
|
||||
dst.push(s);
|
||||
}
|
||||
});
|
||||
return dst;
|
||||
}
|
||||
if (typeof dst === 'undefined' || depth <= 0) {
|
||||
if (dst === undefined || depth <= 0) {
|
||||
if (dst !== undefined && dst !== null && typeof dst === 'object' && typeof src === 'object') {
|
||||
return Object.assign(dst, src);
|
||||
} else {
|
||||
return src;
|
||||
}
|
||||
}
|
||||
if (typeof src !== 'undefined' && typeof dst === 'object' && typeof src === 'object') {
|
||||
if (src !== undefined && typeof dst === 'object' && typeof src === 'object') {
|
||||
Object.keys(src).forEach((key) => {
|
||||
if (
|
||||
typeof src[key] === 'object' &&
|
||||
|
@ -18,8 +18,7 @@ export const updateCurrentConfig = (siteCfg: MermaidConfig, _directives: any[])
|
||||
|
||||
// Join directives
|
||||
let sumOfDirectives: MermaidConfig = {};
|
||||
for (let i = 0; i < _directives.length; i++) {
|
||||
const d = _directives[i];
|
||||
for (const d of _directives) {
|
||||
sanitize(d);
|
||||
|
||||
// Apply the data from the directive where the the overrides the themeVariables
|
||||
@ -153,7 +152,7 @@ export const getConfig = (): MermaidConfig => {
|
||||
export const sanitize = (options: any) => {
|
||||
// Checking that options are not in the list of excluded options
|
||||
['secure', ...(siteConfig.secure ?? [])].forEach((key) => {
|
||||
if (typeof options[key] !== 'undefined') {
|
||||
if (options[key] !== undefined) {
|
||||
// DO NOT attempt to print options[key] within `${}` as a malicious script
|
||||
// can exploit the logger's attempt to stringify the value and execute arbitrary code
|
||||
log.debug(`Denied attempt to modify a secure key ${key}`, options[key]);
|
||||
@ -170,14 +169,13 @@ export const sanitize = (options: any) => {
|
||||
// Check that there no attempts of xss, there should be no tags at all in the directive
|
||||
// blocking data urls as base64 urls can contain svg's with inline script tags
|
||||
Object.keys(options).forEach((key) => {
|
||||
if (typeof options[key] === 'string') {
|
||||
if (
|
||||
options[key].indexOf('<') > -1 ||
|
||||
options[key].indexOf('>') > -1 ||
|
||||
options[key].indexOf('url(data:') > -1
|
||||
) {
|
||||
delete options[key];
|
||||
}
|
||||
if (
|
||||
typeof options[key] === 'string' &&
|
||||
(options[key].includes('<') ||
|
||||
options[key].includes('>') ||
|
||||
options[key].includes('url(data:'))
|
||||
) {
|
||||
delete options[key];
|
||||
}
|
||||
if (typeof options[key] === 'object') {
|
||||
sanitize(options[key]);
|
||||
|
@ -54,7 +54,7 @@ const createLabel = (_vertexText, style, isTitle, isNode) => {
|
||||
const node = {
|
||||
isNode,
|
||||
label: decodeEntities(vertexText).replace(
|
||||
/fa[lrsb]?:fa-[\w-]+/g,
|
||||
/fa[blrs]?:fa-[\w-]+/g,
|
||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
),
|
||||
labelStyle: style.replace('fill:', 'color:'),
|
||||
@ -74,7 +74,7 @@ const createLabel = (_vertexText, style, isTitle, isNode) => {
|
||||
rows = [];
|
||||
}
|
||||
|
||||
for (let j = 0; j < rows.length; j++) {
|
||||
for (const row of rows) {
|
||||
const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
||||
tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
||||
tspan.setAttribute('dy', '1em');
|
||||
@ -84,7 +84,7 @@ const createLabel = (_vertexText, style, isTitle, isNode) => {
|
||||
} else {
|
||||
tspan.setAttribute('class', 'row');
|
||||
}
|
||||
tspan.textContent = rows[j].trim();
|
||||
tspan.textContent = row.trim();
|
||||
svgLabel.appendChild(tspan);
|
||||
}
|
||||
return svgLabel;
|
||||
|
@ -324,7 +324,7 @@ const cutPathAtIntersect = (_points, boundryNode) => {
|
||||
pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y);
|
||||
});
|
||||
// // if (!pointPresent) {
|
||||
if (!points.find((e) => e.x === inter.x && e.y === inter.y)) {
|
||||
if (!points.some((e) => e.x === inter.x && e.y === inter.y)) {
|
||||
points.push(inter);
|
||||
} else {
|
||||
log.warn('abc88 no intersect', inter, points);
|
||||
|
@ -37,7 +37,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
|
||||
// to the abstract node and is later used by dagre for the layout
|
||||
graph.nodes().forEach(function (v) {
|
||||
const node = graph.node(v);
|
||||
if (typeof parentCluster !== 'undefined') {
|
||||
if (parentCluster !== undefined) {
|
||||
const data = JSON.parse(JSON.stringify(parentCluster.clusterData));
|
||||
// data.clusterPositioning = true;
|
||||
log.info('Setting data for cluster XXX (', v, ') ', data, parentCluster);
|
||||
|
@ -4,27 +4,20 @@ import * as graphlibJson from 'dagre-d3-es/src/graphlib/json';
|
||||
import * as graphlib from 'dagre-d3-es/src/graphlib';
|
||||
|
||||
export let clusterDb = {};
|
||||
let decendants = {};
|
||||
let descendants = {};
|
||||
let parents = {};
|
||||
|
||||
export const clear = () => {
|
||||
decendants = {};
|
||||
descendants = {};
|
||||
parents = {};
|
||||
clusterDb = {};
|
||||
};
|
||||
|
||||
const isDecendant = (id, ancenstorId) => {
|
||||
const isDescendant = (id, ancenstorId) => {
|
||||
// if (id === ancenstorId) return true;
|
||||
|
||||
log.trace(
|
||||
'In isDecendant',
|
||||
ancenstorId,
|
||||
' ',
|
||||
id,
|
||||
' = ',
|
||||
decendants[ancenstorId].indexOf(id) >= 0
|
||||
);
|
||||
if (decendants[ancenstorId].indexOf(id) >= 0) {
|
||||
log.trace('In isDecendant', ancenstorId, ' ', id, ' = ', descendants[ancenstorId].includes(id));
|
||||
if (descendants[ancenstorId].includes(id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -32,7 +25,7 @@ const isDecendant = (id, ancenstorId) => {
|
||||
};
|
||||
|
||||
const edgeInCluster = (edge, clusterId) => {
|
||||
log.info('Decendants of ', clusterId, ' is ', decendants[clusterId]);
|
||||
log.info('Decendants of ', clusterId, ' is ', descendants[clusterId]);
|
||||
log.info('Edge is ', edge);
|
||||
// Edges to/from the cluster is not in the cluster, they are in the parent
|
||||
if (edge.v === clusterId) {
|
||||
@ -42,15 +35,15 @@ const edgeInCluster = (edge, clusterId) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!decendants[clusterId]) {
|
||||
if (!descendants[clusterId]) {
|
||||
log.debug('Tilt, ', clusterId, ',not in decendants');
|
||||
return false;
|
||||
}
|
||||
return (
|
||||
decendants[clusterId].indexOf(edge.v) >= 0 ||
|
||||
isDecendant(edge.v, clusterId) ||
|
||||
isDecendant(edge.w, clusterId) ||
|
||||
decendants[clusterId].indexOf(edge.w) >= 0
|
||||
descendants[clusterId].includes(edge.v) ||
|
||||
isDescendant(edge.v, clusterId) ||
|
||||
isDescendant(edge.w, clusterId) ||
|
||||
descendants[clusterId].includes(edge.w)
|
||||
);
|
||||
};
|
||||
|
||||
@ -132,14 +125,14 @@ const copy = (clusterId, graph, newGraph, rootId) => {
|
||||
graph.removeNode(node);
|
||||
});
|
||||
};
|
||||
export const extractDecendants = (id, graph) => {
|
||||
export const extractDescendants = (id, graph) => {
|
||||
// log.debug('Extracting ', id);
|
||||
const children = graph.children(id);
|
||||
let res = [].concat(children);
|
||||
let res = [...children];
|
||||
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
parents[children[i]] = id;
|
||||
res = res.concat(extractDecendants(children[i], graph));
|
||||
for (const child of children) {
|
||||
parents[child] = id;
|
||||
res = [...res, ...extractDescendants(child, graph)];
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -154,13 +147,13 @@ export const extractDecendants = (id, graph) => {
|
||||
export const validate = (graph) => {
|
||||
const edges = graph.edges();
|
||||
log.trace('Edges: ', edges);
|
||||
for (let i = 0; i < edges.length; i++) {
|
||||
if (graph.children(edges[i].v).length > 0) {
|
||||
log.trace('The node ', edges[i].v, ' is part of and edge even though it has children');
|
||||
for (const edge of edges) {
|
||||
if (graph.children(edge.v).length > 0) {
|
||||
log.trace('The node ', edge.v, ' is part of and edge even though it has children');
|
||||
return false;
|
||||
}
|
||||
if (graph.children(edges[i].w).length > 0) {
|
||||
log.trace('The node ', edges[i].w, ' is part of and edge even though it has children');
|
||||
if (graph.children(edge.w).length > 0) {
|
||||
log.trace('The node ', edge.w, ' is part of and edge even though it has children');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -183,8 +176,8 @@ export const findNonClusterChild = (id, graph) => {
|
||||
log.trace('This is a valid node', id);
|
||||
return id;
|
||||
}
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
const _id = findNonClusterChild(children[i], graph);
|
||||
for (const child of children) {
|
||||
const _id = findNonClusterChild(child, graph);
|
||||
if (_id) {
|
||||
log.trace('Found replacement for', id, ' => ', _id);
|
||||
return _id;
|
||||
@ -226,7 +219,7 @@ export const adjustClustersAndEdges = (graph, depth) => {
|
||||
' Replacement id in edges: ',
|
||||
findNonClusterChild(id, graph)
|
||||
);
|
||||
decendants[id] = extractDecendants(id, graph);
|
||||
descendants[id] = extractDescendants(id, graph);
|
||||
clusterDb[id] = { id: findNonClusterChild(id, graph), clusterData: graph.node(id) };
|
||||
}
|
||||
});
|
||||
@ -236,7 +229,7 @@ export const adjustClustersAndEdges = (graph, depth) => {
|
||||
const children = graph.children(id);
|
||||
const edges = graph.edges();
|
||||
if (children.length > 0) {
|
||||
log.debug('Cluster identified', id, decendants);
|
||||
log.debug('Cluster identified', id, descendants);
|
||||
edges.forEach((edge) => {
|
||||
// log.debug('Edge, decendants: ', edge, decendants[id]);
|
||||
|
||||
@ -245,19 +238,19 @@ export const adjustClustersAndEdges = (graph, depth) => {
|
||||
// Any edge where either the one of the nodes is descending to the cluster but not the other
|
||||
// if (decendants[id].indexOf(edge.v) < 0 && decendants[id].indexOf(edge.w) < 0) {
|
||||
|
||||
const d1 = isDecendant(edge.v, id);
|
||||
const d2 = isDecendant(edge.w, id);
|
||||
const d1 = isDescendant(edge.v, id);
|
||||
const d2 = isDescendant(edge.w, id);
|
||||
|
||||
// d1 xor d2 - if either d1 is true and d2 is false or the other way around
|
||||
if (d1 ^ d2) {
|
||||
log.warn('Edge: ', edge, ' leaves cluster ', id);
|
||||
log.warn('Decendants of XXX ', id, ': ', decendants[id]);
|
||||
log.warn('Decendants of XXX ', id, ': ', descendants[id]);
|
||||
clusterDb[id].externalConnections = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
log.debug('Not a cluster ', id, decendants);
|
||||
log.debug('Not a cluster ', id, descendants);
|
||||
}
|
||||
});
|
||||
|
||||
@ -277,7 +270,7 @@ export const adjustClustersAndEdges = (graph, depth) => {
|
||||
'ids:',
|
||||
e.v,
|
||||
e.w,
|
||||
'Translateing: ',
|
||||
'Translating: ',
|
||||
clusterDb[e.v],
|
||||
' --- ',
|
||||
clusterDb[e.w]
|
||||
@ -347,8 +340,7 @@ export const extractor = (graph, depth) => {
|
||||
// for (let i = 0;)
|
||||
let nodes = graph.nodes();
|
||||
let hasChildren = false;
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const node = nodes[i];
|
||||
for (const node of nodes) {
|
||||
const children = graph.children(node);
|
||||
hasChildren = hasChildren || children.length > 0;
|
||||
}
|
||||
@ -360,9 +352,7 @@ export const extractor = (graph, depth) => {
|
||||
// const clusters = Object.keys(clusterDb);
|
||||
// clusters.forEach(clusterId => {
|
||||
log.debug('Nodes = ', nodes, depth);
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const node = nodes[i];
|
||||
|
||||
for (const node of nodes) {
|
||||
log.debug(
|
||||
'Extracting node',
|
||||
node,
|
||||
@ -394,11 +384,9 @@ export const extractor = (graph, depth) => {
|
||||
|
||||
const graphSettings = graph.graph();
|
||||
let dir = graphSettings.rankdir === 'TB' ? 'LR' : 'TB';
|
||||
if (clusterDb[node]) {
|
||||
if (clusterDb[node].clusterData && clusterDb[node].clusterData.dir) {
|
||||
dir = clusterDb[node].clusterData.dir;
|
||||
log.warn('Fixing dir', clusterDb[node].clusterData.dir, dir);
|
||||
}
|
||||
if (clusterDb[node] && clusterDb[node].clusterData && clusterDb[node].clusterData.dir) {
|
||||
dir = clusterDb[node].clusterData.dir;
|
||||
log.warn('Fixing dir', clusterDb[node].clusterData.dir, dir);
|
||||
}
|
||||
|
||||
const clusterGraph = new graphlib.Graph({
|
||||
@ -446,8 +434,7 @@ export const extractor = (graph, depth) => {
|
||||
|
||||
nodes = graph.nodes();
|
||||
log.warn('New list of nodes', nodes);
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
const node = nodes[i];
|
||||
for (const node of nodes) {
|
||||
const data = graph.node(node);
|
||||
log.warn(' Now next level', node, data);
|
||||
if (data.clusterNode) {
|
||||
@ -464,7 +451,7 @@ const sorter = (graph, nodes) => {
|
||||
nodes.forEach((node) => {
|
||||
const children = graph.children(node);
|
||||
const sorted = sorter(graph, children);
|
||||
result = result.concat(sorted);
|
||||
result = [...result, ...sorted];
|
||||
});
|
||||
|
||||
return result;
|
||||
|
@ -3,7 +3,7 @@ import * as graphlib from 'dagre-d3-es/src/graphlib';
|
||||
import {
|
||||
validate,
|
||||
adjustClustersAndEdges,
|
||||
extractDecendants,
|
||||
extractDescendants,
|
||||
sortNodesByHierarchy,
|
||||
} from './mermaid-graphlib';
|
||||
import { setLogLevel, log } from '../logger';
|
||||
@ -400,7 +400,7 @@ flowchart TB
|
||||
expect(aGraph.parent('B')).toBe(undefined);
|
||||
});
|
||||
});
|
||||
describe('extractDecendants', function () {
|
||||
describe('extractDescendants', function () {
|
||||
let g;
|
||||
beforeEach(function () {
|
||||
setLogLevel(1);
|
||||
@ -443,9 +443,9 @@ describe('extractDecendants', function () {
|
||||
g.setEdge('A', 'C', { data: 'link2' }, '2');
|
||||
|
||||
// log.info(g.edges())
|
||||
const d1 = extractDecendants('A', g);
|
||||
const d2 = extractDecendants('B', g);
|
||||
const d3 = extractDecendants('C', g);
|
||||
const d1 = extractDescendants('A', g);
|
||||
const d2 = extractDescendants('B', g);
|
||||
const d3 = extractDescendants('C', g);
|
||||
|
||||
expect(d1).toEqual(['a']);
|
||||
expect(d2).toEqual(['b']);
|
||||
|
@ -391,12 +391,10 @@ const labelRect = (parent, node) => {
|
||||
function applyNodePropertyBorders(rect, borders, totalWidth, totalHeight) {
|
||||
const strokeDashArray = [];
|
||||
const addBorder = (length) => {
|
||||
strokeDashArray.push(length);
|
||||
strokeDashArray.push(0);
|
||||
strokeDashArray.push(length, 0);
|
||||
};
|
||||
const skipBorder = (length) => {
|
||||
strokeDashArray.push(0);
|
||||
strokeDashArray.push(length);
|
||||
strokeDashArray.push(0, length);
|
||||
};
|
||||
if (borders.includes('t')) {
|
||||
log.debug('add top border');
|
||||
|
@ -21,7 +21,7 @@ export const labelHelper = (parent, node, _classes, isNode) => {
|
||||
|
||||
// Replace labelText with default value if undefined
|
||||
let labelText;
|
||||
if (typeof node.labelText === 'undefined') {
|
||||
if (node.labelText === undefined) {
|
||||
labelText = '';
|
||||
} else {
|
||||
labelText = typeof node.labelText === 'string' ? node.labelText : node.labelText[0];
|
||||
|
@ -3,8 +3,7 @@ import { log } from '../logger';
|
||||
import { DetectorRecord, DiagramDetector, DiagramLoader } from './types';
|
||||
import { frontMatterRegex } from './frontmatter';
|
||||
|
||||
const directive =
|
||||
/[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
||||
const directive = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
||||
const anyComment = /\s*%%.*\n/gm;
|
||||
|
||||
const detectors: Record<string, DetectorRecord> = {};
|
||||
|
@ -7,7 +7,7 @@ import * as yaml from 'js-yaml';
|
||||
// Note that JS doesn't support the "\A" anchor, which means we can't use
|
||||
// multiline mode.
|
||||
// Relevant YAML spec: https://yaml.org/spec/1.2.2/#914-explicit-documents
|
||||
export const frontMatterRegex = /^(?:---\s*[\r\n])(.*?)(?:[\r\n]---\s*[\r\n]+)/s;
|
||||
export const frontMatterRegex = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
|
||||
|
||||
type FrontMatterMetadata = {
|
||||
title?: string;
|
||||
|
@ -47,7 +47,7 @@ class Bounds {
|
||||
}
|
||||
|
||||
updateVal(obj, key, val, fun) {
|
||||
if (typeof obj[key] === 'undefined') {
|
||||
if (obj[key] === undefined) {
|
||||
obj[key] = val;
|
||||
} else {
|
||||
obj[key] = fun(val, obj[key]);
|
||||
@ -176,12 +176,12 @@ function calcC4ShapeTextWH(textType, c4Shape, c4ShapeTextWrap, textConf, textLim
|
||||
let lineHeight = 0;
|
||||
c4Shape[textType].height = 0;
|
||||
c4Shape[textType].width = 0;
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
for (const line of lines) {
|
||||
c4Shape[textType].width = Math.max(
|
||||
calculateTextWidth(lines[i], textConf),
|
||||
calculateTextWidth(line, textConf),
|
||||
c4Shape[textType].width
|
||||
);
|
||||
lineHeight = calculateTextHeight(lines[i], textConf);
|
||||
lineHeight = calculateTextHeight(line, textConf);
|
||||
c4Shape[textType].height = c4Shape[textType].height + lineHeight;
|
||||
}
|
||||
// c4Shapes[textType].height = c4Shapes[textType].textLines * textConf.fontSize;
|
||||
@ -211,9 +211,9 @@ export const drawC4ShapeArray = function (currentBounds, diagram, c4ShapeArray,
|
||||
// Upper Y is relative point
|
||||
let Y = 0;
|
||||
// Draw the c4ShapeArray
|
||||
for (let i = 0; i < c4ShapeKeys.length; i++) {
|
||||
for (const c4ShapeKey of c4ShapeKeys) {
|
||||
Y = 0;
|
||||
const c4Shape = c4ShapeArray[c4ShapeKeys[i]];
|
||||
const c4Shape = c4ShapeArray[c4ShapeKey];
|
||||
|
||||
// calc c4 shape type width and height
|
||||
|
||||
@ -460,8 +460,7 @@ function drawInsideBoundary(
|
||||
// conf.width * conf.c4ShapeInRow + conf.c4ShapeMargin * conf.c4ShapeInRow * 2,
|
||||
// parentBounds.data.widthLimit / Math.min(conf.c4BoundaryInRow, currentBoundaries.length)
|
||||
// );
|
||||
for (let i = 0; i < currentBoundaries.length; i++) {
|
||||
let currentBoundary = currentBoundaries[i];
|
||||
for (let [i, currentBoundary] of currentBoundaries.entries()) {
|
||||
let Y = 0;
|
||||
currentBoundary.image = { width: 0, height: 0, Y: 0 };
|
||||
if (currentBoundary.sprite) {
|
||||
|
@ -35,184 +35,6 @@ export const drawImage = function (elem, width, height, x, y, link) {
|
||||
imageElem.attr('xlink:href', sanitizedLink);
|
||||
};
|
||||
|
||||
export const drawEmbeddedImage = function (elem, x, y, link) {
|
||||
const imageElem = elem.append('use');
|
||||
imageElem.attr('x', x);
|
||||
imageElem.attr('y', y);
|
||||
var sanitizedLink = sanitizeUrl(link);
|
||||
imageElem.attr('xlink:href', '#' + sanitizedLink);
|
||||
};
|
||||
|
||||
export const drawText = function (elem, textData) {
|
||||
let prevTextHeight = 0,
|
||||
textHeight = 0;
|
||||
const lines = textData.text.split(common.lineBreakRegex);
|
||||
|
||||
let textElems = [];
|
||||
let dy = 0;
|
||||
let yfunc = () => textData.y;
|
||||
if (
|
||||
typeof textData.valign !== 'undefined' &&
|
||||
typeof textData.textMargin !== 'undefined' &&
|
||||
textData.textMargin > 0
|
||||
) {
|
||||
switch (textData.valign) {
|
||||
case 'top':
|
||||
case 'start':
|
||||
yfunc = () => Math.round(textData.y + textData.textMargin);
|
||||
break;
|
||||
case 'middle':
|
||||
case 'center':
|
||||
yfunc = () =>
|
||||
Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2);
|
||||
break;
|
||||
case 'bottom':
|
||||
case 'end':
|
||||
yfunc = () =>
|
||||
Math.round(
|
||||
textData.y +
|
||||
(prevTextHeight + textHeight + 2 * textData.textMargin) -
|
||||
textData.textMargin
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (
|
||||
typeof textData.anchor !== 'undefined' &&
|
||||
typeof textData.textMargin !== 'undefined' &&
|
||||
typeof textData.width !== 'undefined'
|
||||
) {
|
||||
switch (textData.anchor) {
|
||||
case 'left':
|
||||
case 'start':
|
||||
textData.x = Math.round(textData.x + textData.textMargin);
|
||||
textData.anchor = 'start';
|
||||
textData.dominantBaseline = 'text-after-edge';
|
||||
textData.alignmentBaseline = 'middle';
|
||||
break;
|
||||
case 'middle':
|
||||
case 'center':
|
||||
textData.x = Math.round(textData.x + textData.width / 2);
|
||||
textData.anchor = 'middle';
|
||||
textData.dominantBaseline = 'middle';
|
||||
textData.alignmentBaseline = 'middle';
|
||||
break;
|
||||
case 'right':
|
||||
case 'end':
|
||||
textData.x = Math.round(textData.x + textData.width - textData.textMargin);
|
||||
textData.anchor = 'end';
|
||||
textData.dominantBaseline = 'text-before-edge';
|
||||
textData.alignmentBaseline = 'middle';
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
let line = lines[i];
|
||||
if (
|
||||
typeof textData.textMargin !== 'undefined' &&
|
||||
textData.textMargin === 0 &&
|
||||
typeof textData.fontSize !== 'undefined'
|
||||
) {
|
||||
dy = i * textData.fontSize;
|
||||
}
|
||||
|
||||
const textElem = elem.append('text');
|
||||
textElem.attr('x', textData.x);
|
||||
textElem.attr('y', yfunc());
|
||||
if (typeof textData.anchor !== 'undefined') {
|
||||
textElem
|
||||
.attr('text-anchor', textData.anchor)
|
||||
.attr('dominant-baseline', textData.dominantBaseline)
|
||||
.attr('alignment-baseline', textData.alignmentBaseline);
|
||||
}
|
||||
if (typeof textData.fontFamily !== 'undefined') {
|
||||
textElem.style('font-family', textData.fontFamily);
|
||||
}
|
||||
if (typeof textData.fontSize !== 'undefined') {
|
||||
textElem.style('font-size', textData.fontSize);
|
||||
}
|
||||
if (typeof textData.fontWeight !== 'undefined') {
|
||||
textElem.style('font-weight', textData.fontWeight);
|
||||
}
|
||||
if (typeof textData.fill !== 'undefined') {
|
||||
textElem.attr('fill', textData.fill);
|
||||
}
|
||||
if (typeof textData.class !== 'undefined') {
|
||||
textElem.attr('class', textData.class);
|
||||
}
|
||||
if (typeof textData.dy !== 'undefined') {
|
||||
textElem.attr('dy', textData.dy);
|
||||
} else if (dy !== 0) {
|
||||
textElem.attr('dy', dy);
|
||||
}
|
||||
|
||||
if (textData.tspan) {
|
||||
const span = textElem.append('tspan');
|
||||
span.attr('x', textData.x);
|
||||
if (typeof textData.fill !== 'undefined') {
|
||||
span.attr('fill', textData.fill);
|
||||
}
|
||||
span.text(line);
|
||||
} else {
|
||||
textElem.text(line);
|
||||
}
|
||||
if (
|
||||
typeof textData.valign !== 'undefined' &&
|
||||
typeof textData.textMargin !== 'undefined' &&
|
||||
textData.textMargin > 0
|
||||
) {
|
||||
textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
|
||||
prevTextHeight = textHeight;
|
||||
}
|
||||
|
||||
textElems.push(textElem);
|
||||
}
|
||||
|
||||
return textElems;
|
||||
};
|
||||
|
||||
export const drawLabel = function (elem, txtObject) {
|
||||
/**
|
||||
* @param {any} x
|
||||
* @param {any} y
|
||||
* @param {any} width
|
||||
* @param {any} height
|
||||
* @param {any} cut
|
||||
* @returns {any}
|
||||
*/
|
||||
function genPoints(x, y, width, height, cut) {
|
||||
return (
|
||||
x +
|
||||
',' +
|
||||
y +
|
||||
' ' +
|
||||
(x + width) +
|
||||
',' +
|
||||
y +
|
||||
' ' +
|
||||
(x + width) +
|
||||
',' +
|
||||
(y + height - cut) +
|
||||
' ' +
|
||||
(x + width - cut * 1.2) +
|
||||
',' +
|
||||
(y + height) +
|
||||
' ' +
|
||||
x +
|
||||
',' +
|
||||
(y + height)
|
||||
);
|
||||
}
|
||||
const polygon = elem.append('polygon');
|
||||
polygon.attr('points', genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
|
||||
polygon.attr('class', 'labelBox');
|
||||
|
||||
txtObject.y = txtObject.y + txtObject.height / 2;
|
||||
|
||||
drawText(elem, txtObject);
|
||||
return polygon;
|
||||
};
|
||||
|
||||
export const drawRels = (elem, rels, conf) => {
|
||||
const relsElem = elem.append('g');
|
||||
let i = 0;
|
||||
@ -745,23 +567,6 @@ export const insertArrowCrossHead = function (elem) {
|
||||
// this is actual shape for arrowhead
|
||||
};
|
||||
|
||||
export const getTextObj = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0,
|
||||
fill: undefined,
|
||||
anchor: undefined,
|
||||
style: '#666',
|
||||
width: undefined,
|
||||
height: undefined,
|
||||
textMargin: 0,
|
||||
rx: 0,
|
||||
ry: 0,
|
||||
tspan: true,
|
||||
valign: undefined,
|
||||
};
|
||||
};
|
||||
|
||||
export const getNoteRect = function () {
|
||||
return {
|
||||
x: 0,
|
||||
@ -896,13 +701,10 @@ const _drawTextCandidateFunc = (function () {
|
||||
|
||||
export default {
|
||||
drawRect,
|
||||
drawText,
|
||||
drawLabel,
|
||||
drawBoundary,
|
||||
drawC4Shape,
|
||||
drawRels,
|
||||
drawImage,
|
||||
drawEmbeddedImage,
|
||||
insertArrowHead,
|
||||
insertArrowEnd,
|
||||
insertArrowFilledHead,
|
||||
@ -911,7 +713,6 @@ export default {
|
||||
insertDatabaseIcon,
|
||||
insertComputerIcon,
|
||||
insertClockIcon,
|
||||
getTextObj,
|
||||
getNoteRect,
|
||||
sanitizeUrl,
|
||||
sanitizeUrl, // TODO why is this exported?
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ const splitClassNameAndType = function (id) {
|
||||
export const addClass = function (id) {
|
||||
let classId = splitClassNameAndType(id);
|
||||
// Only add class if not exists
|
||||
if (typeof classes[classId.className] !== 'undefined') {
|
||||
if (classes[classId.className] !== undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -77,9 +77,9 @@ export const addClass = function (id) {
|
||||
*/
|
||||
export const lookUpDomId = function (id) {
|
||||
const classKeys = Object.keys(classes);
|
||||
for (let i = 0; i < classKeys.length; i++) {
|
||||
if (classes[classKeys[i]].id === id) {
|
||||
return classes[classKeys[i]].domId;
|
||||
for (const classKey of classKeys) {
|
||||
if (classes[classKey].id === id) {
|
||||
return classes[classKey].domId;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -207,7 +207,7 @@ export const setCssClass = function (ids, className) {
|
||||
if (_id[0].match(/\d/)) {
|
||||
id = MERMAID_DOM_ID_PREFIX + id;
|
||||
}
|
||||
if (typeof classes[id] !== 'undefined') {
|
||||
if (classes[id] !== undefined) {
|
||||
classes[id].cssClasses.push(className);
|
||||
}
|
||||
});
|
||||
@ -222,7 +222,7 @@ export const setCssClass = function (ids, className) {
|
||||
const setTooltip = function (ids, tooltip) {
|
||||
const config = configApi.getConfig();
|
||||
ids.split(',').forEach(function (id) {
|
||||
if (typeof tooltip !== 'undefined') {
|
||||
if (tooltip !== undefined) {
|
||||
classes[id].tooltip = common.sanitizeText(tooltip, config);
|
||||
}
|
||||
});
|
||||
@ -244,7 +244,7 @@ export const setLink = function (ids, linkStr, target) {
|
||||
if (_id[0].match(/\d/)) {
|
||||
id = MERMAID_DOM_ID_PREFIX + id;
|
||||
}
|
||||
if (typeof classes[id] !== 'undefined') {
|
||||
if (classes[id] !== undefined) {
|
||||
classes[id].link = utils.formatUrl(linkStr, config);
|
||||
if (config.securityLevel === 'sandbox') {
|
||||
classes[id].linkTarget = '_top';
|
||||
@ -281,10 +281,10 @@ const setClickFunc = function (domId, functionName, functionArgs) {
|
||||
if (config.securityLevel !== 'loose') {
|
||||
return;
|
||||
}
|
||||
if (typeof functionName === 'undefined') {
|
||||
if (functionName === undefined) {
|
||||
return;
|
||||
}
|
||||
if (typeof classes[id] !== 'undefined') {
|
||||
if (classes[id] !== undefined) {
|
||||
let argList = [];
|
||||
if (typeof functionArgs === 'string') {
|
||||
/* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
|
||||
|
@ -9,8 +9,6 @@ import { interpolateToCurve, getStylesFromArray } from '../../utils';
|
||||
import { setupGraphViewbox } from '../../setupGraphViewbox';
|
||||
import common from '../common/common';
|
||||
|
||||
let idCache = {};
|
||||
|
||||
const sanitizeText = (txt) => common.sanitizeText(txt, getConfig());
|
||||
|
||||
let conf = {
|
||||
@ -274,16 +272,16 @@ export const addRelations = function (relations, g) {
|
||||
let style = '';
|
||||
let labelStyle = '';
|
||||
|
||||
if (typeof edge.style !== 'undefined') {
|
||||
if (edge.style !== undefined) {
|
||||
const styles = getStylesFromArray(edge.style);
|
||||
style = styles.style;
|
||||
labelStyle = styles.labelStyle;
|
||||
} else {
|
||||
style = 'fill:none';
|
||||
if (typeof defaultStyle !== 'undefined') {
|
||||
if (defaultStyle !== undefined) {
|
||||
style = defaultStyle;
|
||||
}
|
||||
if (typeof defaultLabelStyle !== 'undefined') {
|
||||
if (defaultLabelStyle !== undefined) {
|
||||
labelStyle = defaultLabelStyle;
|
||||
}
|
||||
}
|
||||
@ -291,17 +289,17 @@ export const addRelations = function (relations, g) {
|
||||
edgeData.style = style;
|
||||
edgeData.labelStyle = labelStyle;
|
||||
|
||||
if (typeof edge.interpolate !== 'undefined') {
|
||||
if (edge.interpolate !== undefined) {
|
||||
edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);
|
||||
} else if (typeof relations.defaultInterpolate !== 'undefined') {
|
||||
} else if (relations.defaultInterpolate !== undefined) {
|
||||
edgeData.curve = interpolateToCurve(relations.defaultInterpolate, curveLinear);
|
||||
} else {
|
||||
edgeData.curve = interpolateToCurve(conf.curve, curveLinear);
|
||||
}
|
||||
|
||||
edge.text = edge.title;
|
||||
if (typeof edge.text === 'undefined') {
|
||||
if (typeof edge.style !== 'undefined') {
|
||||
if (edge.text === undefined) {
|
||||
if (edge.style !== undefined) {
|
||||
edgeData.arrowheadStyle = 'fill: #333';
|
||||
}
|
||||
} else {
|
||||
@ -315,7 +313,7 @@ export const addRelations = function (relations, g) {
|
||||
edgeData.labelType = 'text';
|
||||
edgeData.label = edge.text.replace(common.lineBreakRegex, '\n');
|
||||
|
||||
if (typeof edge.style === 'undefined') {
|
||||
if (edge.style === undefined) {
|
||||
edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
|
||||
}
|
||||
|
||||
@ -437,9 +435,7 @@ export const draw = function (text, id, _version, diagObj) {
|
||||
if (!conf.htmlLabels) {
|
||||
const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;
|
||||
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
||||
for (let k = 0; k < labels.length; k++) {
|
||||
const label = labels[k];
|
||||
|
||||
for (const label of labels) {
|
||||
// Get dimensions of label
|
||||
const dim = label.getBBox();
|
||||
|
||||
|
@ -179,8 +179,8 @@ export const draw = function (text, id, _version, diagObj) {
|
||||
const classes = diagObj.db.getClasses();
|
||||
const keys = Object.keys(classes);
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const classDef = classes[keys[i]];
|
||||
for (const key of keys) {
|
||||
const classDef = classes[key];
|
||||
const node = svgDraw.drawClass(diagram, classDef, conf, diagObj);
|
||||
idCache[node.id] = node;
|
||||
|
||||
@ -239,7 +239,7 @@ export const draw = function (text, id, _version, diagObj) {
|
||||
|
||||
dagreLayout(g);
|
||||
g.nodes().forEach(function (v) {
|
||||
if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
|
||||
if (v !== undefined && g.node(v) !== undefined) {
|
||||
log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
|
||||
root
|
||||
.select('#' + (diagObj.db.lookUpDomId(v) || v))
|
||||
@ -255,7 +255,7 @@ export const draw = function (text, id, _version, diagObj) {
|
||||
});
|
||||
|
||||
g.edges().forEach(function (e) {
|
||||
if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
|
||||
if (e !== undefined && g.edge(e) !== undefined) {
|
||||
log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
|
||||
svgDraw.drawEdge(diagram, g.edge(e), g.edge(e).relation, conf, diagObj);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ export const drawEdge = function (elem, path, relation, conf, diagObj) {
|
||||
p2_card_y = cardinality_2_point.y;
|
||||
}
|
||||
|
||||
if (typeof relation.title !== 'undefined') {
|
||||
if (relation.title !== undefined) {
|
||||
const g = elem.append('g').attr('class', 'classLabel');
|
||||
const label = g
|
||||
.append('text')
|
||||
@ -125,7 +125,7 @@ export const drawEdge = function (elem, path, relation, conf, diagObj) {
|
||||
}
|
||||
|
||||
log.info('Rendering relation ' + JSON.stringify(relation));
|
||||
if (typeof relation.relationTitle1 !== 'undefined' && relation.relationTitle1 !== 'none') {
|
||||
if (relation.relationTitle1 !== undefined && relation.relationTitle1 !== 'none') {
|
||||
const g = elem.append('g').attr('class', 'cardinality');
|
||||
g.append('text')
|
||||
.attr('class', 'type1')
|
||||
@ -135,7 +135,7 @@ export const drawEdge = function (elem, path, relation, conf, diagObj) {
|
||||
.attr('font-size', '6')
|
||||
.text(relation.relationTitle1);
|
||||
}
|
||||
if (typeof relation.relationTitle2 !== 'undefined' && relation.relationTitle2 !== 'none') {
|
||||
if (relation.relationTitle2 !== undefined && relation.relationTitle2 !== 'none') {
|
||||
const g = elem.append('g').attr('class', 'cardinality');
|
||||
g.append('text')
|
||||
.attr('class', 'type2')
|
||||
@ -355,8 +355,8 @@ export const drawNote = function (elem, note, conf, diagObj) {
|
||||
};
|
||||
|
||||
export const parseMember = function (text) {
|
||||
const fieldRegEx = /^(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+) *(\*|\$)?$/;
|
||||
const methodRegEx = /^([+|\-|~|#])?(\w+) *\( *(.*)\) *(\*|\$)? *(\w*[~|[\]]*\s*\w*~?)$/;
|
||||
const fieldRegEx = /^([#+~-])?(\w+)(~\w+~|\[])?\s+(\w+) *([$*])?$/;
|
||||
const methodRegEx = /^([#+|~-])?(\w+) *\( *(.*)\) *([$*])? *(\w*[[\]|~]*\s*\w*~?)$/;
|
||||
|
||||
let fieldMatch = text.match(fieldRegEx);
|
||||
let methodMatch = text.match(methodRegEx);
|
||||
@ -420,7 +420,6 @@ const buildLegacyDisplay = function (text) {
|
||||
// if for some reason we don't have any match, use old format to parse text
|
||||
let displayText = '';
|
||||
let cssStyle = '';
|
||||
let memberText = '';
|
||||
let returnType = '';
|
||||
let methodStart = text.indexOf('(');
|
||||
let methodEnd = text.indexOf(')');
|
||||
@ -433,7 +432,7 @@ const buildLegacyDisplay = function (text) {
|
||||
if (firstChar.match(/\w/)) {
|
||||
methodName = text.substring(0, methodStart).trim();
|
||||
} else {
|
||||
if (firstChar.match(/\+|-|~|#/)) {
|
||||
if (firstChar.match(/[#+~-]/)) {
|
||||
visibility = firstChar;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ export const evaluate = (val?: string | boolean): boolean =>
|
||||
export const parseGenericTypes = function (text: string): string {
|
||||
let cleanedText = text;
|
||||
|
||||
if (text.indexOf('~') !== -1) {
|
||||
if (text.includes('~')) {
|
||||
cleanedText = cleanedText.replace(/~([^~].*)/, '<$1');
|
||||
cleanedText = cleanedText.replace(/~([^~]*)$/, '>$1');
|
||||
|
||||
|
@ -32,7 +32,7 @@ export const parseDirective = function (statement, context, type) {
|
||||
};
|
||||
|
||||
const addEntity = function (name) {
|
||||
if (typeof entities[name] === 'undefined') {
|
||||
if (entities[name] === undefined) {
|
||||
entities[name] = { attributes: [] };
|
||||
log.info('Added new entity :', name);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import { parseGenericTypes } from '../common/common';
|
||||
import { v4 as uuid4 } from 'uuid';
|
||||
|
||||
/** Regex used to remove chars from the entity name so the result can be used in an id */
|
||||
const BAD_ID_CHARS_REGEXP = /[^A-Za-z0-9]([\W])*/g;
|
||||
const BAD_ID_CHARS_REGEXP = /[^\dA-Za-z](\W)*/g;
|
||||
|
||||
// Configuration
|
||||
let conf = {};
|
||||
@ -27,8 +27,8 @@ let entityNameIds = new Map();
|
||||
*/
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
conf[keys[i]] = cnf[keys[i]];
|
||||
for (const key of keys) {
|
||||
conf[key] = cnf[key];
|
||||
}
|
||||
};
|
||||
|
||||
@ -355,7 +355,7 @@ const drawEntities = function (svgNode, entities, graph) {
|
||||
|
||||
const adjustEntities = function (svgNode, graph) {
|
||||
graph.nodes().forEach(function (v) {
|
||||
if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
||||
if (v !== undefined && graph.node(v) !== undefined) {
|
||||
svgNode
|
||||
.select('#' + v)
|
||||
.attr(
|
||||
@ -386,7 +386,7 @@ const getEdgeName = function (rel) {
|
||||
* Add each relationship to the graph
|
||||
*
|
||||
* @param relationships The relationships to be added
|
||||
* @param {Graph} g The graph
|
||||
* @param g The graph
|
||||
* @returns {Array} The array of relationships
|
||||
*/
|
||||
const addRelationships = function (relationships, g) {
|
||||
@ -649,10 +649,8 @@ export const draw = function (text, id, _version, diagObj) {
|
||||
* Although the official XML standard for ids says that many more characters are valid in the id,
|
||||
* this keeps things simple by accepting only A-Za-z0-9.
|
||||
*
|
||||
* @param {string} [str?=''] Given string to use as the basis for the id. Default is `''`
|
||||
* @param {string} [prefix?=''] String to put at the start, followed by '-'. Default is `''`
|
||||
* @param str
|
||||
* @param prefix
|
||||
* @param {string} str Given string to use as the basis for the id. Default is `''`
|
||||
* @param {string} prefix String to put at the start, followed by '-'. Default is `''`
|
||||
* @returns {string}
|
||||
* @see https://www.w3.org/TR/xml/#NT-Name
|
||||
*/
|
||||
|
@ -46,9 +46,9 @@ export const parseDirective = function (statement, context, type) {
|
||||
*/
|
||||
export const lookUpDomId = function (id) {
|
||||
const veritceKeys = Object.keys(vertices);
|
||||
for (let i = 0; i < veritceKeys.length; i++) {
|
||||
if (vertices[veritceKeys[i]].id === id) {
|
||||
return vertices[veritceKeys[i]].domId;
|
||||
for (const veritceKey of veritceKeys) {
|
||||
if (vertices[veritceKey].id === id) {
|
||||
return vertices[veritceKey].domId;
|
||||
}
|
||||
}
|
||||
return id;
|
||||
@ -68,7 +68,7 @@ export const lookUpDomId = function (id) {
|
||||
export const addVertex = function (_id, text, type, style, classes, dir, props = {}) {
|
||||
let txt;
|
||||
let id = _id;
|
||||
if (typeof id === 'undefined') {
|
||||
if (id === undefined) {
|
||||
return;
|
||||
}
|
||||
if (id.trim().length === 0) {
|
||||
@ -77,7 +77,7 @@ export const addVertex = function (_id, text, type, style, classes, dir, props =
|
||||
|
||||
// if (id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
||||
|
||||
if (typeof vertices[id] === 'undefined') {
|
||||
if (vertices[id] === undefined) {
|
||||
vertices[id] = {
|
||||
id: id,
|
||||
domId: MERMAID_DOM_ID_PREFIX + id + '-' + vertexCounter,
|
||||
@ -86,7 +86,7 @@ export const addVertex = function (_id, text, type, style, classes, dir, props =
|
||||
};
|
||||
}
|
||||
vertexCounter++;
|
||||
if (typeof text !== 'undefined') {
|
||||
if (text !== undefined) {
|
||||
config = configApi.getConfig();
|
||||
txt = sanitizeText(text.trim());
|
||||
|
||||
@ -97,33 +97,29 @@ export const addVertex = function (_id, text, type, style, classes, dir, props =
|
||||
|
||||
vertices[id].text = txt;
|
||||
} else {
|
||||
if (typeof vertices[id].text === 'undefined') {
|
||||
if (vertices[id].text === undefined) {
|
||||
vertices[id].text = _id;
|
||||
}
|
||||
}
|
||||
if (typeof type !== 'undefined') {
|
||||
if (type !== undefined) {
|
||||
vertices[id].type = type;
|
||||
}
|
||||
if (typeof style !== 'undefined') {
|
||||
if (style !== null) {
|
||||
style.forEach(function (s) {
|
||||
vertices[id].styles.push(s);
|
||||
});
|
||||
}
|
||||
if (style !== undefined && style !== null) {
|
||||
style.forEach(function (s) {
|
||||
vertices[id].styles.push(s);
|
||||
});
|
||||
}
|
||||
if (typeof classes !== 'undefined') {
|
||||
if (classes !== null) {
|
||||
classes.forEach(function (s) {
|
||||
vertices[id].classes.push(s);
|
||||
});
|
||||
}
|
||||
if (classes !== undefined && classes !== null) {
|
||||
classes.forEach(function (s) {
|
||||
vertices[id].classes.push(s);
|
||||
});
|
||||
}
|
||||
if (typeof dir !== 'undefined') {
|
||||
if (dir !== undefined) {
|
||||
vertices[id].dir = dir;
|
||||
}
|
||||
if (typeof vertices[id].props === 'undefined') {
|
||||
if (vertices[id].props === undefined) {
|
||||
vertices[id].props = props;
|
||||
} else if (typeof props !== 'undefined') {
|
||||
} else if (props !== undefined) {
|
||||
Object.assign(vertices[id].props, props);
|
||||
}
|
||||
};
|
||||
@ -134,9 +130,9 @@ export const addVertex = function (_id, text, type, style, classes, dir, props =
|
||||
* @param _start
|
||||
* @param _end
|
||||
* @param type
|
||||
* @param linktext
|
||||
* @param linkText
|
||||
*/
|
||||
export const addSingleLink = function (_start, _end, type, linktext) {
|
||||
export const addSingleLink = function (_start, _end, type, linkText) {
|
||||
let start = _start;
|
||||
let end = _end;
|
||||
// if (start[0].match(/\d/)) start = MERMAID_DOM_ID_PREFIX + start;
|
||||
@ -144,18 +140,18 @@ export const addSingleLink = function (_start, _end, type, linktext) {
|
||||
// log.info('Got edge...', start, end);
|
||||
|
||||
const edge = { start: start, end: end, type: undefined, text: '' };
|
||||
linktext = type.text;
|
||||
linkText = type.text;
|
||||
|
||||
if (typeof linktext !== 'undefined') {
|
||||
edge.text = sanitizeText(linktext.trim());
|
||||
if (linkText !== undefined) {
|
||||
edge.text = sanitizeText(linkText.trim());
|
||||
|
||||
// strip quotes if string starts and exnds with a quote
|
||||
// strip quotes if string starts and ends with a quote
|
||||
if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') {
|
||||
edge.text = edge.text.substring(1, edge.text.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof type !== 'undefined') {
|
||||
if (type !== undefined) {
|
||||
edge.type = type.type;
|
||||
edge.stroke = type.stroke;
|
||||
edge.length = type.length;
|
||||
@ -207,21 +203,19 @@ export const updateLink = function (positions, style) {
|
||||
};
|
||||
|
||||
export const addClass = function (id, style) {
|
||||
if (typeof classes[id] === 'undefined') {
|
||||
if (classes[id] === undefined) {
|
||||
classes[id] = { id: id, styles: [], textStyles: [] };
|
||||
}
|
||||
|
||||
if (typeof style !== 'undefined') {
|
||||
if (style !== null) {
|
||||
style.forEach(function (s) {
|
||||
if (s.match('color')) {
|
||||
const newStyle1 = s.replace('fill', 'bgFill');
|
||||
const newStyle2 = newStyle1.replace('color', 'fill');
|
||||
classes[id].textStyles.push(newStyle2);
|
||||
}
|
||||
classes[id].styles.push(s);
|
||||
});
|
||||
}
|
||||
if (style !== undefined && style !== null) {
|
||||
style.forEach(function (s) {
|
||||
if (s.match('color')) {
|
||||
const newStyle1 = s.replace('fill', 'bgFill');
|
||||
const newStyle2 = newStyle1.replace('color', 'fill');
|
||||
classes[id].textStyles.push(newStyle2);
|
||||
}
|
||||
classes[id].styles.push(s);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -257,11 +251,11 @@ export const setClass = function (ids, className) {
|
||||
// let id = version === 'gen-2' ? lookUpDomId(_id) : _id;
|
||||
let id = _id;
|
||||
// if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
|
||||
if (typeof vertices[id] !== 'undefined') {
|
||||
if (vertices[id] !== undefined) {
|
||||
vertices[id].classes.push(className);
|
||||
}
|
||||
|
||||
if (typeof subGraphLookup[id] !== 'undefined') {
|
||||
if (subGraphLookup[id] !== undefined) {
|
||||
subGraphLookup[id].classes.push(className);
|
||||
}
|
||||
});
|
||||
@ -269,7 +263,7 @@ export const setClass = function (ids, className) {
|
||||
|
||||
const setTooltip = function (ids, tooltip) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
if (typeof tooltip !== 'undefined') {
|
||||
if (tooltip !== undefined) {
|
||||
tooltips[version === 'gen-1' ? lookUpDomId(id) : id] = sanitizeText(tooltip);
|
||||
}
|
||||
});
|
||||
@ -281,7 +275,7 @@ const setClickFun = function (id, functionName, functionArgs) {
|
||||
if (configApi.getConfig().securityLevel !== 'loose') {
|
||||
return;
|
||||
}
|
||||
if (typeof functionName === 'undefined') {
|
||||
if (functionName === undefined) {
|
||||
return;
|
||||
}
|
||||
let argList = [];
|
||||
@ -304,7 +298,7 @@ const setClickFun = function (id, functionName, functionArgs) {
|
||||
argList.push(id);
|
||||
}
|
||||
|
||||
if (typeof vertices[id] !== 'undefined') {
|
||||
if (vertices[id] !== undefined) {
|
||||
vertices[id].haveCallback = true;
|
||||
funs.push(function () {
|
||||
const elem = document.querySelector(`[id="${domId}"]`);
|
||||
@ -330,7 +324,7 @@ const setClickFun = function (id, functionName, functionArgs) {
|
||||
*/
|
||||
export const setLink = function (ids, linkStr, target) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
if (typeof vertices[id] !== 'undefined') {
|
||||
if (vertices[id] !== undefined) {
|
||||
vertices[id].link = utils.formatUrl(linkStr, config);
|
||||
vertices[id].linkTarget = target;
|
||||
}
|
||||
@ -484,7 +478,7 @@ export const addSubGraph = function (_id, list, _title) {
|
||||
if (type in prims) {
|
||||
return prims[type].hasOwnProperty(item) ? false : (prims[type][item] = true);
|
||||
} else {
|
||||
return objs.indexOf(item) >= 0 ? false : objs.push(item);
|
||||
return objs.includes(item) ? false : objs.push(item);
|
||||
}
|
||||
});
|
||||
return { nodeList, dir };
|
||||
@ -530,8 +524,8 @@ export const addSubGraph = function (_id, list, _title) {
|
||||
};
|
||||
|
||||
const getPosForId = function (id) {
|
||||
for (let i = 0; i < subGraphs.length; i++) {
|
||||
if (subGraphs[i].id === id) {
|
||||
for (const [i, subGraph] of subGraphs.entries()) {
|
||||
if (subGraph.id === id) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -622,11 +616,11 @@ const destructStartLink = (_str) => {
|
||||
|
||||
let stroke = 'normal';
|
||||
|
||||
if (str.indexOf('=') !== -1) {
|
||||
if (str.includes('=')) {
|
||||
stroke = 'thick';
|
||||
}
|
||||
|
||||
if (str.indexOf('.') !== -1) {
|
||||
if (str.includes('.')) {
|
||||
stroke = 'dotted';
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@ import { setupGraphViewbox } from '../../setupGraphViewbox';
|
||||
const conf = {};
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
conf[keys[i]] = cnf[keys[i]];
|
||||
for (const key of keys) {
|
||||
conf[key] = cnf[key];
|
||||
}
|
||||
};
|
||||
|
||||
@ -59,7 +59,7 @@ export const addVertices = function (vert, g, svgId, root, doc, diagObj) {
|
||||
// TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
||||
const node = {
|
||||
label: vertexText.replace(
|
||||
/fa[lrsb]?:fa-[\w-]+/g,
|
||||
/fa[blrs]?:fa-[\w-]+/g,
|
||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
),
|
||||
};
|
||||
@ -71,12 +71,12 @@ export const addVertices = function (vert, g, svgId, root, doc, diagObj) {
|
||||
|
||||
const rows = vertexText.split(common.lineBreakRegex);
|
||||
|
||||
for (let j = 0; j < rows.length; j++) {
|
||||
for (const row of rows) {
|
||||
const tspan = doc.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
||||
tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
||||
tspan.setAttribute('dy', '1em');
|
||||
tspan.setAttribute('x', '1');
|
||||
tspan.textContent = rows[j];
|
||||
tspan.textContent = row;
|
||||
svgLabel.appendChild(tspan);
|
||||
}
|
||||
vertexNode = svgLabel;
|
||||
@ -197,7 +197,7 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
let defaultStyle;
|
||||
let defaultLabelStyle;
|
||||
|
||||
if (typeof edges.defaultStyle !== 'undefined') {
|
||||
if (edges.defaultStyle !== undefined) {
|
||||
const defaultStyles = getStylesFromArray(edges.defaultStyle);
|
||||
defaultStyle = defaultStyles.style;
|
||||
defaultLabelStyle = defaultStyles.labelStyle;
|
||||
@ -209,7 +209,7 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
// Identify Link
|
||||
var linkIdBase = 'L-' + edge.start + '-' + edge.end;
|
||||
// count the links from+to the same node to give unique id
|
||||
if (typeof linkIdCnt[linkIdBase] === 'undefined') {
|
||||
if (linkIdCnt[linkIdBase] === undefined) {
|
||||
linkIdCnt[linkIdBase] = 0;
|
||||
log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);
|
||||
} else {
|
||||
@ -261,10 +261,10 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
switch (edge.stroke) {
|
||||
case 'normal':
|
||||
style = 'fill:none;';
|
||||
if (typeof defaultStyle !== 'undefined') {
|
||||
if (defaultStyle !== undefined) {
|
||||
style = defaultStyle;
|
||||
}
|
||||
if (typeof defaultLabelStyle !== 'undefined') {
|
||||
if (defaultLabelStyle !== undefined) {
|
||||
labelStyle = defaultLabelStyle;
|
||||
}
|
||||
edgeData.thickness = 'normal';
|
||||
@ -281,7 +281,7 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
edgeData.style = 'stroke-width: 3.5px;fill:none;';
|
||||
break;
|
||||
}
|
||||
if (typeof edge.style !== 'undefined') {
|
||||
if (edge.style !== undefined) {
|
||||
const styles = getStylesFromArray(edge.style);
|
||||
style = styles.style;
|
||||
labelStyle = styles.labelStyle;
|
||||
@ -290,16 +290,16 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
edgeData.style = edgeData.style += style;
|
||||
edgeData.labelStyle = edgeData.labelStyle += labelStyle;
|
||||
|
||||
if (typeof edge.interpolate !== 'undefined') {
|
||||
if (edge.interpolate !== undefined) {
|
||||
edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);
|
||||
} else if (typeof edges.defaultInterpolate !== 'undefined') {
|
||||
} else if (edges.defaultInterpolate !== undefined) {
|
||||
edgeData.curve = interpolateToCurve(edges.defaultInterpolate, curveLinear);
|
||||
} else {
|
||||
edgeData.curve = interpolateToCurve(conf.curve, curveLinear);
|
||||
}
|
||||
|
||||
if (typeof edge.text === 'undefined') {
|
||||
if (typeof edge.style !== 'undefined') {
|
||||
if (edge.text === undefined) {
|
||||
if (edge.style !== undefined) {
|
||||
edgeData.arrowheadStyle = 'fill: #333';
|
||||
}
|
||||
} else {
|
||||
@ -310,7 +310,7 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
edgeData.labelType = 'text';
|
||||
edgeData.label = edge.text.replace(common.lineBreakRegex, '\n');
|
||||
|
||||
if (typeof edge.style === 'undefined') {
|
||||
if (edge.style === undefined) {
|
||||
edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none;';
|
||||
}
|
||||
|
||||
@ -359,7 +359,7 @@ export const draw = function (text, id, _version, diagObj) {
|
||||
|
||||
// Fetch the default direction, use TD if none was found
|
||||
let dir = diagObj.db.getDirection();
|
||||
if (typeof dir === 'undefined') {
|
||||
if (dir === undefined) {
|
||||
dir = 'TD';
|
||||
}
|
||||
|
||||
@ -444,9 +444,7 @@ export const draw = function (text, id, _version, diagObj) {
|
||||
// Add label rects for non html labels
|
||||
if (!conf.htmlLabels) {
|
||||
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
||||
for (let k = 0; k < labels.length; k++) {
|
||||
const label = labels[k];
|
||||
|
||||
for (const label of labels) {
|
||||
// Get dimensions of label
|
||||
const dim = label.getBBox();
|
||||
|
||||
|
@ -13,8 +13,8 @@ import flowChartShapes from './flowChartShapes';
|
||||
const conf = {};
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
conf[keys[i]] = cnf[keys[i]];
|
||||
for (const key of keys) {
|
||||
conf[key] = cnf[key];
|
||||
}
|
||||
};
|
||||
|
||||
@ -58,7 +58,7 @@ export const addVertices = function (vert, g, svgId, root, _doc, diagObj) {
|
||||
// TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
|
||||
const node = {
|
||||
label: vertexText.replace(
|
||||
/fa[lrsb]?:fa-[\w-]+/g,
|
||||
/fa[blrs]?:fa-[\w-]+/g,
|
||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
),
|
||||
};
|
||||
@ -70,12 +70,12 @@ export const addVertices = function (vert, g, svgId, root, _doc, diagObj) {
|
||||
|
||||
const rows = vertexText.split(common.lineBreakRegex);
|
||||
|
||||
for (let j = 0; j < rows.length; j++) {
|
||||
for (const row of rows) {
|
||||
const tspan = doc.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
||||
tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
||||
tspan.setAttribute('dy', '1em');
|
||||
tspan.setAttribute('x', '1');
|
||||
tspan.textContent = rows[j];
|
||||
tspan.textContent = row;
|
||||
svgLabel.appendChild(tspan);
|
||||
}
|
||||
vertexNode = svgLabel;
|
||||
@ -166,7 +166,7 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
let defaultStyle;
|
||||
let defaultLabelStyle;
|
||||
|
||||
if (typeof edges.defaultStyle !== 'undefined') {
|
||||
if (edges.defaultStyle !== undefined) {
|
||||
const defaultStyles = getStylesFromArray(edges.defaultStyle);
|
||||
defaultStyle = defaultStyles.style;
|
||||
defaultLabelStyle = defaultStyles.labelStyle;
|
||||
@ -192,7 +192,7 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
let style = '';
|
||||
let labelStyle = '';
|
||||
|
||||
if (typeof edge.style !== 'undefined') {
|
||||
if (edge.style !== undefined) {
|
||||
const styles = getStylesFromArray(edge.style);
|
||||
style = styles.style;
|
||||
labelStyle = styles.labelStyle;
|
||||
@ -200,10 +200,10 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
switch (edge.stroke) {
|
||||
case 'normal':
|
||||
style = 'fill:none';
|
||||
if (typeof defaultStyle !== 'undefined') {
|
||||
if (defaultStyle !== undefined) {
|
||||
style = defaultStyle;
|
||||
}
|
||||
if (typeof defaultLabelStyle !== 'undefined') {
|
||||
if (defaultLabelStyle !== undefined) {
|
||||
labelStyle = defaultLabelStyle;
|
||||
}
|
||||
break;
|
||||
@ -219,16 +219,16 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
edgeData.style = style;
|
||||
edgeData.labelStyle = labelStyle;
|
||||
|
||||
if (typeof edge.interpolate !== 'undefined') {
|
||||
if (edge.interpolate !== undefined) {
|
||||
edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);
|
||||
} else if (typeof edges.defaultInterpolate !== 'undefined') {
|
||||
} else if (edges.defaultInterpolate !== undefined) {
|
||||
edgeData.curve = interpolateToCurve(edges.defaultInterpolate, curveLinear);
|
||||
} else {
|
||||
edgeData.curve = interpolateToCurve(conf.curve, curveLinear);
|
||||
}
|
||||
|
||||
if (typeof edge.text === 'undefined') {
|
||||
if (typeof edge.style !== 'undefined') {
|
||||
if (edge.text === undefined) {
|
||||
if (edge.style !== undefined) {
|
||||
edgeData.arrowheadStyle = 'fill: #333';
|
||||
}
|
||||
} else {
|
||||
@ -240,14 +240,14 @@ export const addEdges = function (edges, g, diagObj) {
|
||||
edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}" style="${
|
||||
edgeData.labelStyle
|
||||
}">${edge.text.replace(
|
||||
/fa[lrsb]?:fa-[\w-]+/g,
|
||||
/fa[blrs]?:fa-[\w-]+/g,
|
||||
(s) => `<i class='${s.replace(':', ' ')}'></i>`
|
||||
)}</span>`;
|
||||
} else {
|
||||
edgeData.labelType = 'text';
|
||||
edgeData.label = edge.text.replace(common.lineBreakRegex, '\n');
|
||||
|
||||
if (typeof edge.style === 'undefined') {
|
||||
if (edge.style === undefined) {
|
||||
edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ export const draw = function (text, id, _version, diagObj) {
|
||||
|
||||
// Fetch the default direction, use TD if none was found
|
||||
let dir = diagObj.db.getDirection();
|
||||
if (typeof dir === 'undefined') {
|
||||
if (dir === undefined) {
|
||||
dir = 'TD';
|
||||
}
|
||||
const nodeSpacing = conf.nodeSpacing || 50;
|
||||
@ -455,9 +455,7 @@ export const draw = function (text, id, _version, diagObj) {
|
||||
// Add label rects for non html labels
|
||||
if (!conf.htmlLabels) {
|
||||
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
||||
for (let k = 0; k < labels.length; k++) {
|
||||
const label = labels[k];
|
||||
|
||||
for (const label of labels) {
|
||||
// Get dimensions of label
|
||||
const dim = label.getBBox();
|
||||
|
||||
|
@ -79,8 +79,8 @@ describe('when parsing directions', function () {
|
||||
const subgraphs = flow.parser.yy.getSubGraphs();
|
||||
expect(subgraphs.length).toBe(2);
|
||||
|
||||
const subgraphA = filter(subgraphs, (o) => o.id === 'A')[0];
|
||||
const subgraphB = filter(subgraphs, (o) => o.id === 'B')[0];
|
||||
const subgraphA = subgraphs.find((o) => o.id === 'A');
|
||||
const subgraphB = subgraphs.find((o) => o.id === 'B');
|
||||
|
||||
expect(subgraphB.nodes[0]).toBe('c');
|
||||
expect(subgraphB.dir).toBe('LR');
|
||||
|
@ -254,8 +254,8 @@ describe('when parsing subgraphs', function () {
|
||||
const subgraphs = flow.parser.yy.getSubGraphs();
|
||||
expect(subgraphs.length).toBe(2);
|
||||
|
||||
const subgraphA = filter(subgraphs, (o) => o.id === 'A')[0];
|
||||
const subgraphB = filter(subgraphs, (o) => o.id === 'B')[0];
|
||||
const subgraphA = subgraphs.find((o) => o.id === 'A');
|
||||
const subgraphB = subgraphs.find((o) => o.id === 'B');
|
||||
|
||||
expect(subgraphB.nodes[0]).toBe('c');
|
||||
expect(subgraphA.nodes).toContain('B');
|
||||
@ -279,8 +279,8 @@ describe('when parsing subgraphs', function () {
|
||||
const subgraphs = flow.parser.yy.getSubGraphs();
|
||||
expect(subgraphs.length).toBe(2);
|
||||
|
||||
const subgraphA = filter(subgraphs, (o) => o.id === 'A')[0];
|
||||
const subgraphB = filter(subgraphs, (o) => o.id === 'B')[0];
|
||||
const subgraphA = subgraphs.find((o) => o.id === 'A');
|
||||
const subgraphB = subgraphs.find((o) => o.id === 'B');
|
||||
|
||||
expect(subgraphB.nodes[0]).toBe('c');
|
||||
expect(subgraphA.nodes).toContain('B');
|
||||
@ -302,8 +302,8 @@ describe('when parsing subgraphs', function () {
|
||||
const subgraphs = flow.parser.yy.getSubGraphs();
|
||||
expect(subgraphs.length).toBe(2);
|
||||
|
||||
const subgraphA = filter(subgraphs, (o) => o.id === 'A')[0];
|
||||
const subgraphB = filter(subgraphs, (o) => o.id === 'B')[0];
|
||||
const subgraphA = subgraphs.find((o) => o.id === 'A');
|
||||
const subgraphB = subgraphs.find((o) => o.id === 'B');
|
||||
expect(subgraphB.nodes[0]).toBe('c');
|
||||
expect(subgraphA.nodes).toContain('B');
|
||||
expect(subgraphA.nodes).toContain('b');
|
||||
|
@ -150,16 +150,16 @@ export const getTasks = function () {
|
||||
};
|
||||
|
||||
export const isInvalidDate = function (date, dateFormat, excludes, includes) {
|
||||
if (includes.indexOf(date.format(dateFormat.trim())) >= 0) {
|
||||
if (includes.includes(date.format(dateFormat.trim()))) {
|
||||
return false;
|
||||
}
|
||||
if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) {
|
||||
if (date.isoWeekday() >= 6 && excludes.includes('weekends')) {
|
||||
return true;
|
||||
}
|
||||
if (excludes.indexOf(date.format('dddd').toLowerCase()) >= 0) {
|
||||
if (excludes.includes(date.format('dddd').toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
return excludes.indexOf(date.format(dateFormat.trim())) >= 0;
|
||||
return excludes.includes(date.format(dateFormat.trim()));
|
||||
};
|
||||
|
||||
const checkTaskDates = function (task, dateFormat, excludes, includes) {
|
||||
@ -202,7 +202,7 @@ const getStartDate = function (prevTime, dateFormat, str) {
|
||||
let latestEndingTask = null;
|
||||
afterStatement[1].split(' ').forEach(function (id) {
|
||||
let task = findTaskById(id);
|
||||
if (typeof task !== 'undefined') {
|
||||
if (task !== undefined) {
|
||||
if (!latestEndingTask) {
|
||||
latestEndingTask = task;
|
||||
} else {
|
||||
@ -230,7 +230,7 @@ const getStartDate = function (prevTime, dateFormat, str) {
|
||||
log.debug('Invalid date:' + str);
|
||||
log.debug('With date format:' + dateFormat.trim());
|
||||
const d = new Date(str);
|
||||
if (typeof d === 'undefined' || isNaN(d.getTime())) {
|
||||
if (d === undefined || isNaN(d.getTime())) {
|
||||
throw new Error('Invalid date:' + str);
|
||||
}
|
||||
return d;
|
||||
@ -258,15 +258,14 @@ const getStartDate = function (prevTime, dateFormat, str) {
|
||||
* string.
|
||||
*/
|
||||
const parseDuration = function (str) {
|
||||
const statement = /^(\d+(?:\.\d+)?)([yMwdhms]|ms)$/.exec(str.trim());
|
||||
const statement = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(str.trim());
|
||||
if (statement !== null) {
|
||||
return moment.duration(Number.parseFloat(statement[1]), statement[2]);
|
||||
}
|
||||
return moment.duration.invalid();
|
||||
};
|
||||
|
||||
const getEndDate = function (prevTime, dateFormat, str, inclusive) {
|
||||
inclusive = inclusive || false;
|
||||
const getEndDate = function (prevTime, dateFormat, str, inclusive = false) {
|
||||
str = str.trim();
|
||||
|
||||
// Check for actual date
|
||||
@ -288,7 +287,7 @@ const getEndDate = function (prevTime, dateFormat, str, inclusive) {
|
||||
|
||||
let taskCnt = 0;
|
||||
const parseId = function (idStr) {
|
||||
if (typeof idStr === 'undefined') {
|
||||
if (idStr === undefined) {
|
||||
taskCnt = taskCnt + 1;
|
||||
return 'task' + taskCnt;
|
||||
}
|
||||
@ -510,10 +509,10 @@ const compileTasks = function () {
|
||||
};
|
||||
|
||||
let allProcessed = true;
|
||||
for (let i = 0; i < rawTasks.length; i++) {
|
||||
for (const [i, rawTask] of rawTasks.entries()) {
|
||||
compileTask(i);
|
||||
|
||||
allProcessed = allProcessed && rawTasks[i].processed;
|
||||
allProcessed = allProcessed && rawTask.processed;
|
||||
}
|
||||
return allProcessed;
|
||||
};
|
||||
@ -531,7 +530,7 @@ export const setLink = function (ids, _linkStr) {
|
||||
}
|
||||
ids.split(',').forEach(function (id) {
|
||||
let rawTask = findTaskById(id);
|
||||
if (typeof rawTask !== 'undefined') {
|
||||
if (rawTask !== undefined) {
|
||||
pushFun(id, () => {
|
||||
window.open(linkStr, '_self');
|
||||
});
|
||||
@ -550,7 +549,7 @@ export const setLink = function (ids, _linkStr) {
|
||||
export const setClass = function (ids, className) {
|
||||
ids.split(',').forEach(function (id) {
|
||||
let rawTask = findTaskById(id);
|
||||
if (typeof rawTask !== 'undefined') {
|
||||
if (rawTask !== undefined) {
|
||||
rawTask.classes.push(className);
|
||||
}
|
||||
});
|
||||
@ -560,7 +559,7 @@ const setClickFun = function (id, functionName, functionArgs) {
|
||||
if (configApi.getConfig().securityLevel !== 'loose') {
|
||||
return;
|
||||
}
|
||||
if (typeof functionName === 'undefined') {
|
||||
if (functionName === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -585,7 +584,7 @@ const setClickFun = function (id, functionName, functionArgs) {
|
||||
}
|
||||
|
||||
let rawTask = findTaskById(id);
|
||||
if (typeof rawTask !== 'undefined') {
|
||||
if (rawTask !== undefined) {
|
||||
pushFun(id, () => {
|
||||
utils.runFunc(functionName, ...argList);
|
||||
});
|
||||
@ -600,24 +599,26 @@ const setClickFun = function (id, functionName, functionArgs) {
|
||||
* @param callbackFunction A function to be executed when clicked on the task or the task's text
|
||||
*/
|
||||
const pushFun = function (id, callbackFunction) {
|
||||
funs.push(function () {
|
||||
// const elem = d3.select(element).select(`[id="${id}"]`)
|
||||
const elem = document.querySelector(`[id="${id}"]`);
|
||||
if (elem !== null) {
|
||||
elem.addEventListener('click', function () {
|
||||
callbackFunction();
|
||||
});
|
||||
funs.push(
|
||||
function () {
|
||||
// const elem = d3.select(element).select(`[id="${id}"]`)
|
||||
const elem = document.querySelector(`[id="${id}"]`);
|
||||
if (elem !== null) {
|
||||
elem.addEventListener('click', function () {
|
||||
callbackFunction();
|
||||
});
|
||||
}
|
||||
},
|
||||
function () {
|
||||
// const elem = d3.select(element).select(`[id="${id}-text"]`)
|
||||
const elem = document.querySelector(`[id="${id}-text"]`);
|
||||
if (elem !== null) {
|
||||
elem.addEventListener('click', function () {
|
||||
callbackFunction();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
funs.push(function () {
|
||||
// const elem = d3.select(element).select(`[id="${id}-text"]`)
|
||||
const elem = document.querySelector(`[id="${id}-text"]`);
|
||||
if (elem !== null) {
|
||||
elem.addEventListener('click', function () {
|
||||
callbackFunction();
|
||||
});
|
||||
}
|
||||
});
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -45,11 +45,11 @@ export const draw = function (text, id, version, diagObj) {
|
||||
const elem = doc.getElementById(id);
|
||||
w = elem.parentElement.offsetWidth;
|
||||
|
||||
if (typeof w === 'undefined') {
|
||||
if (w === undefined) {
|
||||
w = 1200;
|
||||
}
|
||||
|
||||
if (typeof conf.useWidth !== 'undefined') {
|
||||
if (conf.useWidth !== undefined) {
|
||||
w = conf.useWidth;
|
||||
}
|
||||
|
||||
@ -76,8 +76,8 @@ export const draw = function (text, id, version, diagObj) {
|
||||
|
||||
let categories = [];
|
||||
|
||||
for (let i = 0; i < taskArray.length; i++) {
|
||||
categories.push(taskArray[i].type);
|
||||
for (const element of taskArray) {
|
||||
categories.push(element.type);
|
||||
}
|
||||
|
||||
const catsUnfiltered = categories; // for vert labels
|
||||
@ -175,8 +175,8 @@ export const draw = function (text, id, version, diagObj) {
|
||||
})
|
||||
.attr('height', theGap)
|
||||
.attr('class', function (d) {
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
if (d.type === categories[i]) {
|
||||
for (const [i, category] of categories.entries()) {
|
||||
if (d.type === category) {
|
||||
return 'section section' + (i % conf.numberSectionStyles);
|
||||
}
|
||||
}
|
||||
@ -244,8 +244,8 @@ export const draw = function (text, id, version, diagObj) {
|
||||
}
|
||||
|
||||
let secNum = 0;
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
if (d.type === categories[i]) {
|
||||
for (const [i, category] of categories.entries()) {
|
||||
if (d.type === category) {
|
||||
secNum = i % conf.numberSectionStyles;
|
||||
}
|
||||
}
|
||||
@ -336,8 +336,8 @@ export const draw = function (text, id, version, diagObj) {
|
||||
}
|
||||
|
||||
let secNum = 0;
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
if (d.type === categories[i]) {
|
||||
for (const [i, category] of categories.entries()) {
|
||||
if (d.type === category) {
|
||||
secNum = i % conf.numberSectionStyles;
|
||||
}
|
||||
}
|
||||
@ -397,7 +397,7 @@ export const draw = function (text, id, version, diagObj) {
|
||||
|
||||
rectangles
|
||||
.filter(function (d) {
|
||||
return typeof links[d.id] !== 'undefined';
|
||||
return links[d.id] !== undefined;
|
||||
})
|
||||
.each(function (o) {
|
||||
var taskRect = doc.querySelector('#' + o.id);
|
||||
@ -497,7 +497,7 @@ export const draw = function (text, id, version, diagObj) {
|
||||
.tickSize(-h + theTopPad + conf.gridLineStartPadding)
|
||||
.tickFormat(timeFormat(diagObj.db.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
|
||||
|
||||
const reTickInterval = /^([1-9][0-9]*)(minute|hour|day|week|month)$/;
|
||||
const reTickInterval = /^([1-9]\d*)(minute|hour|day|week|month)$/;
|
||||
const resultTickInterval = reTickInterval.exec(
|
||||
diagObj.db.getTickInterval() || conf.tickInterval
|
||||
);
|
||||
@ -585,8 +585,8 @@ export const draw = function (text, id, version, diagObj) {
|
||||
const numOccurances = [];
|
||||
let prevGap = 0;
|
||||
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
numOccurances[i] = [categories[i], getCount(categories[i], catsUnfiltered)];
|
||||
for (const [i, category] of categories.entries()) {
|
||||
numOccurances[i] = [category, getCount(category, catsUnfiltered)];
|
||||
}
|
||||
|
||||
svg
|
||||
@ -601,14 +601,14 @@ export const draw = function (text, id, version, diagObj) {
|
||||
const svgLabel = doc.createElementNS('http://www.w3.org/2000/svg', 'text');
|
||||
svgLabel.setAttribute('dy', dy + 'em');
|
||||
|
||||
for (let j = 0; j < rows.length; j++) {
|
||||
for (const [j, row] of rows.entries()) {
|
||||
const tspan = doc.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
||||
tspan.setAttribute('alignment-baseline', 'central');
|
||||
tspan.setAttribute('x', '10');
|
||||
if (j > 0) {
|
||||
tspan.setAttribute('dy', '1em');
|
||||
}
|
||||
tspan.textContent = rows[j];
|
||||
tspan.textContent = row;
|
||||
svgLabel.appendChild(tspan);
|
||||
}
|
||||
return svgLabel;
|
||||
@ -627,8 +627,8 @@ export const draw = function (text, id, version, diagObj) {
|
||||
.attr('font-size', conf.sectionFontSize)
|
||||
.attr('font-size', conf.sectionFontSize)
|
||||
.attr('class', function (d) {
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
if (d[0] === categories[i]) {
|
||||
for (const [i, category] of categories.entries()) {
|
||||
if (d[0] === category) {
|
||||
return 'sectionTitle sectionTitle' + (i % conf.numberSectionStyles);
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ export const commit = function (msg, id, type, tag) {
|
||||
|
||||
export const branch = function (name, order) {
|
||||
name = common.sanitizeText(name, configApi.getConfig());
|
||||
if (typeof branches[name] === 'undefined') {
|
||||
if (branches[name] === undefined) {
|
||||
branches[name] = head != null ? head.id : null;
|
||||
branchesConfig[name] = { name, order: order ? parseInt(order, 10) : null };
|
||||
checkout(name);
|
||||
@ -169,7 +169,7 @@ export const merge = function (otherBranch, custom_id, override_type, custom_tag
|
||||
expected: ['branch abc'],
|
||||
};
|
||||
throw error;
|
||||
} else if (typeof currentCommit === 'undefined' || !currentCommit) {
|
||||
} else if (currentCommit === undefined || !currentCommit) {
|
||||
let error = new Error(
|
||||
'Incorrect usage of "merge". Current branch (' + curBranch + ')has no commits'
|
||||
);
|
||||
@ -181,7 +181,7 @@ export const merge = function (otherBranch, custom_id, override_type, custom_tag
|
||||
expected: ['commit'],
|
||||
};
|
||||
throw error;
|
||||
} else if (typeof branches[otherBranch] === 'undefined') {
|
||||
} else if (branches[otherBranch] === undefined) {
|
||||
let error = new Error(
|
||||
'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ') does not exist'
|
||||
);
|
||||
@ -193,7 +193,7 @@ export const merge = function (otherBranch, custom_id, override_type, custom_tag
|
||||
expected: ['branch ' + otherBranch],
|
||||
};
|
||||
throw error;
|
||||
} else if (typeof otherCommit === 'undefined' || !otherCommit) {
|
||||
} else if (otherCommit === undefined || !otherCommit) {
|
||||
let error = new Error(
|
||||
'Incorrect usage of "merge". Branch to be merged (' + otherBranch + ') has no commits'
|
||||
);
|
||||
@ -215,7 +215,7 @@ export const merge = function (otherBranch, custom_id, override_type, custom_tag
|
||||
expected: ['branch abc'],
|
||||
};
|
||||
throw error;
|
||||
} else if (custom_id && typeof commits[custom_id] !== 'undefined') {
|
||||
} else if (custom_id && commits[custom_id] !== undefined) {
|
||||
let error = new Error(
|
||||
'Incorrect usage of "merge". Commit with id:' +
|
||||
custom_id +
|
||||
@ -267,7 +267,7 @@ export const cherryPick = function (sourceId, targetId, tag) {
|
||||
targetId = common.sanitizeText(targetId, configApi.getConfig());
|
||||
tag = common.sanitizeText(tag, configApi.getConfig());
|
||||
|
||||
if (!sourceId || typeof commits[sourceId] === 'undefined') {
|
||||
if (!sourceId || commits[sourceId] === undefined) {
|
||||
let error = new Error(
|
||||
'Incorrect usage of "cherryPick". Source commit id should exist and provided'
|
||||
);
|
||||
@ -296,7 +296,7 @@ export const cherryPick = function (sourceId, targetId, tag) {
|
||||
};
|
||||
throw error;
|
||||
}
|
||||
if (!targetId || typeof commits[targetId] === 'undefined') {
|
||||
if (!targetId || commits[targetId] === undefined) {
|
||||
// cherry-pick source commit to current branch
|
||||
|
||||
if (sourceCommitBranch === curBranch) {
|
||||
@ -313,7 +313,7 @@ export const cherryPick = function (sourceId, targetId, tag) {
|
||||
throw error;
|
||||
}
|
||||
const currentCommit = commits[branches[curBranch]];
|
||||
if (typeof currentCommit === 'undefined' || !currentCommit) {
|
||||
if (currentCommit === undefined || !currentCommit) {
|
||||
let error = new Error(
|
||||
'Incorrect usage of "cherry-pick". Current branch (' + curBranch + ')has no commits'
|
||||
);
|
||||
@ -344,7 +344,7 @@ export const cherryPick = function (sourceId, targetId, tag) {
|
||||
};
|
||||
export const checkout = function (branch) {
|
||||
branch = common.sanitizeText(branch, configApi.getConfig());
|
||||
if (typeof branches[branch] === 'undefined') {
|
||||
if (branches[branch] === undefined) {
|
||||
let error = new Error(
|
||||
'Trying to checkout branch which is not yet created. (Help try using "branch ' + branch + '")'
|
||||
);
|
||||
|
@ -310,8 +310,7 @@ function renderCommitHistory(svg, commitId, branches, direction) {
|
||||
* @param direction
|
||||
* @param branchColor
|
||||
*/
|
||||
function renderLines(svg, commit, direction, branchColor) {
|
||||
branchColor = branchColor || 0;
|
||||
function renderLines(svg, commit, direction, branchColor = 0) {
|
||||
while (commit.seq > 0 && !commit.lineDrawn) {
|
||||
if (typeof commit.parent === 'string') {
|
||||
svgDrawLineForCommits(svg, commit.id, commit.parent, direction, branchColor);
|
||||
|
@ -46,13 +46,13 @@ const drawText = (txt) => {
|
||||
rows = [];
|
||||
}
|
||||
|
||||
for (let j = 0; j < rows.length; j++) {
|
||||
for (const row of rows) {
|
||||
const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
|
||||
tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
||||
tspan.setAttribute('dy', '1em');
|
||||
tspan.setAttribute('x', '0');
|
||||
tspan.setAttribute('class', 'row');
|
||||
tspan.textContent = rows[j].trim();
|
||||
tspan.textContent = row.trim();
|
||||
svgLabel.appendChild(tspan);
|
||||
}
|
||||
/**
|
||||
@ -90,7 +90,7 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
||||
if (modifyGraph) {
|
||||
let typeClass;
|
||||
let commitSymbolType =
|
||||
typeof commit.customType !== 'undefined' && commit.customType !== ''
|
||||
commit.customType !== undefined && commit.customType !== ''
|
||||
? commit.customType
|
||||
: commit.type;
|
||||
switch (commitSymbolType) {
|
||||
@ -318,23 +318,16 @@ const hasOverlappingCommits = (commit1, commit2, allCommits) => {
|
||||
*
|
||||
* @param {any} y1
|
||||
* @param {any} y2
|
||||
* @param {any} _depth
|
||||
* @param {any} depth
|
||||
* @returns {number} Y value between y1 and y2
|
||||
*/
|
||||
const findLane = (y1, y2, _depth) => {
|
||||
const depth = _depth || 0;
|
||||
|
||||
const findLane = (y1, y2, depth = 0) => {
|
||||
const candidate = y1 + Math.abs(y1 - y2) / 2;
|
||||
if (depth > 5) {
|
||||
return candidate;
|
||||
}
|
||||
|
||||
let ok = true;
|
||||
for (let i = 0; i < lanes.length; i++) {
|
||||
if (Math.abs(lanes[i] - candidate) < 10) {
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
let ok = lanes.every((lane) => Math.abs(lane - candidate) >= 10);
|
||||
if (ok) {
|
||||
lanes.push(candidate);
|
||||
return candidate;
|
||||
|
@ -5,8 +5,8 @@ export default (dir, _branches) => {
|
||||
const branches = [];
|
||||
const commits = [];
|
||||
|
||||
for (let i = 0; i < _branches.length; i++) {
|
||||
const branch = Object.assign({}, _branches[i]);
|
||||
for (const [i, _branch] of _branches.entries()) {
|
||||
const branch = Object.assign({}, _branch);
|
||||
if (dir === 'TB' || dir === 'BT') {
|
||||
branch.x = config.branchOffset * i;
|
||||
branch.y = -1;
|
||||
|
@ -21,7 +21,7 @@ export const parseDirective = function (statement, context, type) {
|
||||
|
||||
const addSection = function (id, value) {
|
||||
id = common.sanitizeText(id, configApi.getConfig());
|
||||
if (typeof sections[id] === 'undefined') {
|
||||
if (sections[id] === undefined) {
|
||||
sections[id] = value;
|
||||
log.debug('Added new section :', id);
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ export const draw = (txt, id, _version, diagObj) => {
|
||||
const elem = doc.getElementById(id);
|
||||
width = elem.parentElement.offsetWidth;
|
||||
|
||||
if (typeof width === 'undefined') {
|
||||
if (width === undefined) {
|
||||
width = 1200;
|
||||
}
|
||||
|
||||
if (typeof conf.useWidth !== 'undefined') {
|
||||
if (conf.useWidth !== undefined) {
|
||||
width = conf.useWidth;
|
||||
}
|
||||
if (typeof conf.pie.useWidth !== 'undefined') {
|
||||
if (conf.pie.useWidth !== undefined) {
|
||||
width = conf.pie.useWidth;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ export const parseDirective = function (statement, context, type) {
|
||||
};
|
||||
|
||||
const addRequirement = (name, type) => {
|
||||
if (typeof requirements[name] === 'undefined') {
|
||||
if (requirements[name] === undefined) {
|
||||
requirements[name] = {
|
||||
name,
|
||||
type,
|
||||
@ -72,31 +72,31 @@ const addRequirement = (name, type) => {
|
||||
const getRequirements = () => requirements;
|
||||
|
||||
const setNewReqId = (id) => {
|
||||
if (typeof latestRequirement != 'undefined') {
|
||||
if (latestRequirement !== undefined) {
|
||||
latestRequirement.id = id;
|
||||
}
|
||||
};
|
||||
|
||||
const setNewReqText = (text) => {
|
||||
if (typeof latestRequirement != 'undefined') {
|
||||
if (latestRequirement !== undefined) {
|
||||
latestRequirement.text = text;
|
||||
}
|
||||
};
|
||||
|
||||
const setNewReqRisk = (risk) => {
|
||||
if (typeof latestRequirement != 'undefined') {
|
||||
if (latestRequirement !== undefined) {
|
||||
latestRequirement.risk = risk;
|
||||
}
|
||||
};
|
||||
|
||||
const setNewReqVerifyMethod = (verifyMethod) => {
|
||||
if (typeof latestRequirement != 'undefined') {
|
||||
if (latestRequirement !== undefined) {
|
||||
latestRequirement.verifyMethod = verifyMethod;
|
||||
}
|
||||
};
|
||||
|
||||
const addElement = (name) => {
|
||||
if (typeof elements[name] === 'undefined') {
|
||||
if (elements[name] === undefined) {
|
||||
elements[name] = {
|
||||
name,
|
||||
|
||||
@ -113,13 +113,13 @@ const addElement = (name) => {
|
||||
const getElements = () => elements;
|
||||
|
||||
const setNewElementType = (type) => {
|
||||
if (typeof latestElement != 'undefined') {
|
||||
if (latestElement !== undefined) {
|
||||
latestElement.type = type;
|
||||
}
|
||||
};
|
||||
|
||||
const setNewElementDocRef = (docRef) => {
|
||||
if (typeof latestElement != 'undefined') {
|
||||
if (latestElement !== undefined) {
|
||||
latestElement.docRef = docRef;
|
||||
}
|
||||
};
|
||||
|
@ -283,7 +283,7 @@ const addRelationships = (relationships, g) => {
|
||||
|
||||
const adjustEntities = function (svgNode, graph) {
|
||||
graph.nodes().forEach(function (v) {
|
||||
if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
||||
if (v !== undefined && graph.node(v) !== undefined) {
|
||||
svgNode.select('#' + v);
|
||||
svgNode
|
||||
.select('#' + v)
|
||||
|
@ -60,15 +60,11 @@ const activationCount = (part) => {
|
||||
let i;
|
||||
let count = 0;
|
||||
for (i = 0; i < messages.length; i++) {
|
||||
if (messages[i].type === LINETYPE.ACTIVE_START) {
|
||||
if (messages[i].from.actor === part) {
|
||||
count++;
|
||||
}
|
||||
if (messages[i].type === LINETYPE.ACTIVE_START && messages[i].from.actor === part) {
|
||||
count++;
|
||||
}
|
||||
if (messages[i].type === LINETYPE.ACTIVE_END) {
|
||||
if (messages[i].from.actor === part) {
|
||||
count--;
|
||||
}
|
||||
if (messages[i].type === LINETYPE.ACTIVE_END && messages[i].from.actor === part) {
|
||||
count--;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
@ -143,7 +139,7 @@ export const setWrap = function (wrapSetting) {
|
||||
export const autoWrap = () => {
|
||||
// if setWrap has been called, use that value, otherwise use the value from the config
|
||||
// TODO: refactor, always use the config value let setWrap update the config value
|
||||
if (typeof wrapEnabled !== 'undefined') {
|
||||
if (wrapEnabled !== undefined) {
|
||||
return wrapEnabled;
|
||||
}
|
||||
return configApi.getConfig().sequence.wrap;
|
||||
@ -159,11 +155,11 @@ export const clear = function () {
|
||||
export const parseMessage = function (str) {
|
||||
const _str = str.trim();
|
||||
const message = {
|
||||
text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
|
||||
text: _str.replace(/^:?(?:no)?wrap:/, '').trim(),
|
||||
wrap:
|
||||
_str.match(/^[:]?wrap:/) !== null
|
||||
_str.match(/^:?wrap:/) !== null
|
||||
? true
|
||||
: _str.match(/^[:]?nowrap:/) !== null
|
||||
: _str.match(/^:?nowrap:/) !== null
|
||||
? false
|
||||
: undefined,
|
||||
};
|
||||
@ -223,6 +219,7 @@ export const addNote = function (actor, placement, message) {
|
||||
};
|
||||
|
||||
// Coerce actor into a [to, from, ...] array
|
||||
// eslint-disable-next-line unicorn/prefer-spread
|
||||
const actors = [].concat(actor, actor);
|
||||
|
||||
notes.push(note);
|
||||
@ -337,7 +334,7 @@ export const addDetails = function (actorId, text) {
|
||||
};
|
||||
|
||||
export const getActorProperty = function (actor, key) {
|
||||
if (typeof actor !== 'undefined' && typeof actor.properties !== 'undefined') {
|
||||
if (actor !== undefined && actor.properties !== undefined) {
|
||||
return actor.properties[key];
|
||||
}
|
||||
|
||||
@ -345,7 +342,7 @@ export const getActorProperty = function (actor, key) {
|
||||
};
|
||||
|
||||
export const apply = function (param) {
|
||||
if (param instanceof Array) {
|
||||
if (Array.isArray(param)) {
|
||||
param.forEach(function (item) {
|
||||
apply(item);
|
||||
});
|
||||
|
@ -90,7 +90,7 @@ export const bounds = {
|
||||
setConf(configApi.getConfig());
|
||||
},
|
||||
updateVal: function (obj, key, val, fun) {
|
||||
if (typeof obj[key] === 'undefined') {
|
||||
if (obj[key] === undefined) {
|
||||
obj[key] = val;
|
||||
} else {
|
||||
obj[key] = fun(val, obj[key]);
|
||||
@ -480,8 +480,8 @@ export const drawActors = function (
|
||||
let prevWidth = 0;
|
||||
let prevMargin = 0;
|
||||
let maxHeight = 0;
|
||||
for (let i = 0; i < actorKeys.length; i++) {
|
||||
const actor = actors[actorKeys[i]];
|
||||
for (const actorKey of actorKeys) {
|
||||
const actor = actors[actorKey];
|
||||
|
||||
// Add some rendering data to the object
|
||||
actor.width = actor.width || conf.width;
|
||||
@ -508,8 +508,8 @@ export const drawActors = function (
|
||||
export const drawActorsPopup = function (diagram, actors, actorKeys, doc) {
|
||||
let maxHeight = 0;
|
||||
let maxWidth = 0;
|
||||
for (let i = 0; i < actorKeys.length; i++) {
|
||||
const actor = actors[actorKeys[i]];
|
||||
for (const actorKey of actorKeys) {
|
||||
const actor = actors[actorKey];
|
||||
const minMenuWidth = getRequiredPopupWidth(actor);
|
||||
const menuDimensions = svgDraw.drawPopup(
|
||||
diagram,
|
||||
@ -1178,7 +1178,7 @@ const buildMessageModel = function (msg, actors, diagObj) {
|
||||
const toBounds = activationBounds(msg.to, actors);
|
||||
const fromIdx = fromBounds[0] <= toBounds[0] ? 1 : 0;
|
||||
const toIdx = fromBounds[0] < toBounds[0] ? 0 : 1;
|
||||
const allBounds = fromBounds.concat(toBounds);
|
||||
const allBounds = [...fromBounds, ...toBounds];
|
||||
const boundedWidth = Math.abs(toBounds[toIdx] - fromBounds[fromIdx]);
|
||||
if (msg.wrap && msg.message) {
|
||||
msg.message = utils.wrapLabel(
|
||||
|
@ -13,7 +13,7 @@ export const drawRect = function (elem, rectData) {
|
||||
rectElem.attr('rx', rectData.rx);
|
||||
rectElem.attr('ry', rectData.ry);
|
||||
|
||||
if (typeof rectData.class !== 'undefined') {
|
||||
if (rectData.class !== undefined) {
|
||||
rectElem.attr('class', rectData.class);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ export const drawPopup = function (elem, actor, minMenuWidth, textAttrs, forceMe
|
||||
g.attr('display', displayValue);
|
||||
addPopupInteraction('#actor' + actorCnt + '_popup', actorCnt);
|
||||
var actorClass = '';
|
||||
if (typeof rectData.class !== 'undefined') {
|
||||
if (rectData.class !== undefined) {
|
||||
actorClass = ' ' + rectData.class;
|
||||
}
|
||||
|
||||
@ -160,8 +160,8 @@ export const drawText = function (elem, textData) {
|
||||
let dy = 0;
|
||||
let yfunc = () => textData.y;
|
||||
if (
|
||||
typeof textData.valign !== 'undefined' &&
|
||||
typeof textData.textMargin !== 'undefined' &&
|
||||
textData.valign !== undefined &&
|
||||
textData.textMargin !== undefined &&
|
||||
textData.textMargin > 0
|
||||
) {
|
||||
switch (textData.valign) {
|
||||
@ -186,9 +186,9 @@ export const drawText = function (elem, textData) {
|
||||
}
|
||||
}
|
||||
if (
|
||||
typeof textData.anchor !== 'undefined' &&
|
||||
typeof textData.textMargin !== 'undefined' &&
|
||||
typeof textData.width !== 'undefined'
|
||||
textData.anchor !== undefined &&
|
||||
textData.textMargin !== undefined &&
|
||||
textData.width !== undefined
|
||||
) {
|
||||
switch (textData.anchor) {
|
||||
case 'left':
|
||||
@ -214,12 +214,11 @@ export const drawText = function (elem, textData) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
let line = lines[i];
|
||||
for (let [i, line] of lines.entries()) {
|
||||
if (
|
||||
typeof textData.textMargin !== 'undefined' &&
|
||||
textData.textMargin !== undefined &&
|
||||
textData.textMargin === 0 &&
|
||||
typeof textData.fontSize !== 'undefined'
|
||||
textData.fontSize !== undefined
|
||||
) {
|
||||
dy = i * textData.fontSize;
|
||||
}
|
||||
@ -227,28 +226,28 @@ export const drawText = function (elem, textData) {
|
||||
const textElem = elem.append('text');
|
||||
textElem.attr('x', textData.x);
|
||||
textElem.attr('y', yfunc());
|
||||
if (typeof textData.anchor !== 'undefined') {
|
||||
if (textData.anchor !== undefined) {
|
||||
textElem
|
||||
.attr('text-anchor', textData.anchor)
|
||||
.attr('dominant-baseline', textData.dominantBaseline)
|
||||
.attr('alignment-baseline', textData.alignmentBaseline);
|
||||
}
|
||||
if (typeof textData.fontFamily !== 'undefined') {
|
||||
if (textData.fontFamily !== undefined) {
|
||||
textElem.style('font-family', textData.fontFamily);
|
||||
}
|
||||
if (typeof textData.fontSize !== 'undefined') {
|
||||
if (textData.fontSize !== undefined) {
|
||||
textElem.style('font-size', textData.fontSize);
|
||||
}
|
||||
if (typeof textData.fontWeight !== 'undefined') {
|
||||
if (textData.fontWeight !== undefined) {
|
||||
textElem.style('font-weight', textData.fontWeight);
|
||||
}
|
||||
if (typeof textData.fill !== 'undefined') {
|
||||
if (textData.fill !== undefined) {
|
||||
textElem.attr('fill', textData.fill);
|
||||
}
|
||||
if (typeof textData.class !== 'undefined') {
|
||||
if (textData.class !== undefined) {
|
||||
textElem.attr('class', textData.class);
|
||||
}
|
||||
if (typeof textData.dy !== 'undefined') {
|
||||
if (textData.dy !== undefined) {
|
||||
textElem.attr('dy', textData.dy);
|
||||
} else if (dy !== 0) {
|
||||
textElem.attr('dy', dy);
|
||||
@ -257,7 +256,7 @@ export const drawText = function (elem, textData) {
|
||||
if (textData.tspan) {
|
||||
const span = textElem.append('tspan');
|
||||
span.attr('x', textData.x);
|
||||
if (typeof textData.fill !== 'undefined') {
|
||||
if (textData.fill !== undefined) {
|
||||
span.attr('fill', textData.fill);
|
||||
}
|
||||
span.text(line);
|
||||
@ -265,8 +264,8 @@ export const drawText = function (elem, textData) {
|
||||
textElem.text(line);
|
||||
}
|
||||
if (
|
||||
typeof textData.valign !== 'undefined' &&
|
||||
typeof textData.textMargin !== 'undefined' &&
|
||||
textData.valign !== undefined &&
|
||||
textData.textMargin !== undefined &&
|
||||
textData.textMargin > 0
|
||||
) {
|
||||
textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
|
||||
@ -561,7 +560,7 @@ export const drawLoop = function (elem, loopModel, labelText, conf) {
|
||||
drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
|
||||
drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
|
||||
drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
|
||||
if (typeof loopModel.sections !== 'undefined') {
|
||||
if (loopModel.sections !== undefined) {
|
||||
loopModel.sections.forEach(function (item) {
|
||||
drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style(
|
||||
'stroke-dasharray',
|
||||
@ -601,7 +600,7 @@ export const drawLoop = function (elem, loopModel, labelText, conf) {
|
||||
|
||||
let textElem = drawText(g, txt);
|
||||
|
||||
if (typeof loopModel.sectionTitles !== 'undefined') {
|
||||
if (loopModel.sectionTitles !== undefined) {
|
||||
loopModel.sectionTitles.forEach(function (item, idx) {
|
||||
if (item.message) {
|
||||
txt.text = item.message;
|
||||
|
@ -197,10 +197,8 @@ export const addTitleAndBox = (g, stateDef, altBkg) => {
|
||||
if (titleWidth > orgWidth) {
|
||||
startX = (orgWidth - width) / 2 + pad;
|
||||
}
|
||||
if (Math.abs(orgX - graphBox.x) < pad) {
|
||||
if (titleWidth > orgWidth) {
|
||||
startX = orgX - (titleWidth - orgWidth) / 2;
|
||||
}
|
||||
if (Math.abs(orgX - graphBox.x) < pad && titleWidth > orgWidth) {
|
||||
startX = orgX - (titleWidth - orgWidth) / 2;
|
||||
}
|
||||
|
||||
const lineY = 1 - getConfig().state.textHeight;
|
||||
@ -301,7 +299,7 @@ export const drawText = function (elem, textData) {
|
||||
textElem.attr('y', textData.y);
|
||||
textElem.style('text-anchor', textData.anchor);
|
||||
textElem.attr('fill', textData.fill);
|
||||
if (typeof textData.class !== 'undefined') {
|
||||
if (textData.class !== undefined) {
|
||||
textElem.attr('class', textData.class);
|
||||
}
|
||||
|
||||
@ -464,7 +462,7 @@ export const drawEdge = function (elem, path, relation) {
|
||||
'url(' + url + '#' + getRelationType(stateDb.relationType.DEPENDENCY) + 'End' + ')'
|
||||
);
|
||||
|
||||
if (typeof relation.title !== 'undefined') {
|
||||
if (relation.title !== undefined) {
|
||||
const label = elem.append('g').attr('class', 'stateLabel');
|
||||
|
||||
const { x, y } = utils.calcLabelPosition(path.points);
|
||||
|
@ -94,11 +94,9 @@ const docTranslator = (parent, node, first) => {
|
||||
docTranslator(parent, node.state1, true);
|
||||
docTranslator(parent, node.state2, false);
|
||||
} else {
|
||||
if (node.stmt === STMT_STATE) {
|
||||
if (node.id === '[*]') {
|
||||
node.id = first ? parent.id + '_start' : parent.id + '_end';
|
||||
node.start = first;
|
||||
}
|
||||
if (node.stmt === STMT_STATE && node.id === '[*]') {
|
||||
node.id = first ? parent.id + '_start' : parent.id + '_end';
|
||||
node.start = first;
|
||||
}
|
||||
|
||||
if (node.doc) {
|
||||
@ -218,7 +216,7 @@ export const addState = function (
|
||||
textStyles = null
|
||||
) {
|
||||
// add the state if needed
|
||||
if (typeof currentDocument.states[id] === 'undefined') {
|
||||
if (currentDocument.states[id] === undefined) {
|
||||
log.info('Adding state ', id, descr);
|
||||
currentDocument.states[id] = {
|
||||
id: id,
|
||||
@ -457,25 +455,23 @@ const getDividerId = () => {
|
||||
*/
|
||||
export const addStyleClass = function (id, styleAttributes = '') {
|
||||
// create a new style class object with this id
|
||||
if (typeof classes[id] === 'undefined') {
|
||||
if (classes[id] === undefined) {
|
||||
classes[id] = { id: id, styles: [], textStyles: [] }; // This is a classDef
|
||||
}
|
||||
const foundClass = classes[id];
|
||||
if (typeof styleAttributes !== 'undefined') {
|
||||
if (styleAttributes !== null) {
|
||||
styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => {
|
||||
// remove any trailing ;
|
||||
const fixedAttrib = attrib.replace(/([^;]*);/, '$1').trim();
|
||||
if (styleAttributes !== undefined && styleAttributes !== null) {
|
||||
styleAttributes.split(STYLECLASS_SEP).forEach((attrib) => {
|
||||
// remove any trailing ;
|
||||
const fixedAttrib = attrib.replace(/([^;]*);/, '$1').trim();
|
||||
|
||||
// replace some style keywords
|
||||
if (attrib.match(COLOR_KEYWORD)) {
|
||||
const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL);
|
||||
const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD);
|
||||
foundClass.textStyles.push(newStyle2);
|
||||
}
|
||||
foundClass.styles.push(fixedAttrib);
|
||||
});
|
||||
}
|
||||
// replace some style keywords
|
||||
if (attrib.match(COLOR_KEYWORD)) {
|
||||
const newStyle1 = fixedAttrib.replace(FILL_KEYWORD, BG_FILL);
|
||||
const newStyle2 = newStyle1.replace(COLOR_KEYWORD, FILL_KEYWORD);
|
||||
foundClass.textStyles.push(newStyle2);
|
||||
}
|
||||
foundClass.styles.push(fixedAttrib);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -498,7 +494,7 @@ export const getClasses = function () {
|
||||
export const setCssClass = function (itemIds, cssClassName) {
|
||||
itemIds.split(',').forEach(function (id) {
|
||||
let foundState = getState(id);
|
||||
if (typeof foundState === 'undefined') {
|
||||
if (foundState === undefined) {
|
||||
const trimmedId = id.trim();
|
||||
addState(trimmedId);
|
||||
foundState = getState(trimmedId);
|
||||
@ -519,7 +515,7 @@ export const setCssClass = function (itemIds, cssClassName) {
|
||||
*/
|
||||
export const setStyle = function (itemId, styleText) {
|
||||
const item = getState(itemId);
|
||||
if (typeof item !== 'undefined') {
|
||||
if (item !== undefined) {
|
||||
item.textStyles.push(styleText);
|
||||
}
|
||||
};
|
||||
@ -532,7 +528,7 @@ export const setStyle = function (itemId, styleText) {
|
||||
*/
|
||||
export const setTextStyle = function (itemId, cssClassName) {
|
||||
const item = getState(itemId);
|
||||
if (typeof item !== 'undefined') {
|
||||
if (item !== undefined) {
|
||||
item.textStyles.push(cssClassName);
|
||||
}
|
||||
};
|
||||
|
@ -71,8 +71,8 @@ const conf = {};
|
||||
|
||||
export const setConf = function (cnf) {
|
||||
const keys = Object.keys(cnf);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
conf[keys[i]] = cnf[keys[i]];
|
||||
for (const key of keys) {
|
||||
conf[key] = cnf[key];
|
||||
}
|
||||
};
|
||||
|
||||
@ -106,7 +106,7 @@ export const getClasses = function (text, diagramObj) {
|
||||
* @returns {string}
|
||||
*/
|
||||
function getClassesFromDbInfo(dbInfoItem) {
|
||||
if (typeof dbInfoItem === 'undefined' || dbInfoItem === null) {
|
||||
if (dbInfoItem === undefined || dbInfoItem === null) {
|
||||
return '';
|
||||
} else {
|
||||
if (dbInfoItem.classes) {
|
||||
@ -291,11 +291,9 @@ const setupNode = (g, parent, parsedItem, diagramStates, diagramDb, altFlag) =>
|
||||
}
|
||||
}
|
||||
|
||||
if (parent) {
|
||||
if (parent.id !== 'root') {
|
||||
log.trace('Setting node ', itemId, ' to be child of its parent ', parent.id);
|
||||
g.setParent(itemId, parent.id);
|
||||
}
|
||||
if (parent && parent.id !== 'root') {
|
||||
log.trace('Setting node ', itemId, ' to be child of its parent ', parent.id);
|
||||
g.setParent(itemId, parent.id);
|
||||
}
|
||||
if (parsedItem.doc) {
|
||||
log.trace('Adding nodes children ');
|
||||
@ -386,7 +384,7 @@ export const draw = function (text, id, _version, diag) {
|
||||
nodeDb = {};
|
||||
// Fetch the default direction, use TD if none was found
|
||||
let dir = diag.db.getDirection();
|
||||
if (typeof dir === 'undefined') {
|
||||
if (dir === undefined) {
|
||||
dir = DEFAULT_DIAGRAM_DIRECTION;
|
||||
}
|
||||
|
||||
@ -459,9 +457,7 @@ export const draw = function (text, id, _version, diag) {
|
||||
// Add label rects for non html labels
|
||||
// if (!evaluate(conf.htmlLabels) || true) {
|
||||
const labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
|
||||
for (let k = 0; k < labels.length; k++) {
|
||||
const label = labels[k];
|
||||
|
||||
for (const label of labels) {
|
||||
// Get dimensions of label
|
||||
const dim = label.getBBox();
|
||||
|
||||
|
@ -160,8 +160,8 @@ const renderDoc = (doc, diagram, parentId, altBkg, root, domDocument, diagObj) =
|
||||
|
||||
let first = true;
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const stateDef = states[keys[i]];
|
||||
for (const key of keys) {
|
||||
const stateDef = states[key];
|
||||
|
||||
if (parentId) {
|
||||
stateDef.parentId = parentId;
|
||||
@ -243,7 +243,7 @@ const renderDoc = (doc, diagram, parentId, altBkg, root, domDocument, diagObj) =
|
||||
const svgElem = diagram.node();
|
||||
|
||||
graph.nodes().forEach(function (v) {
|
||||
if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
|
||||
if (v !== undefined && graph.node(v) !== undefined) {
|
||||
log.warn('Node ' + v + ': ' + JSON.stringify(graph.node(v)));
|
||||
root
|
||||
.select('#' + svgElem.id + ' #' + v)
|
||||
@ -285,7 +285,7 @@ const renderDoc = (doc, diagram, parentId, altBkg, root, domDocument, diagObj) =
|
||||
let stateBox = svgElem.getBBox();
|
||||
|
||||
graph.edges().forEach(function (e) {
|
||||
if (typeof e !== 'undefined' && typeof graph.edge(e) !== 'undefined') {
|
||||
if (e !== undefined && graph.edge(e) !== undefined) {
|
||||
log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
|
||||
drawEdge(diagram, graph.edge(e), graph.edge(e).relation);
|
||||
}
|
||||
|
@ -105,10 +105,10 @@ const compileTasks = function () {
|
||||
};
|
||||
|
||||
let allProcessed = true;
|
||||
for (let i = 0; i < rawTasks.length; i++) {
|
||||
for (const [i, rawTask] of rawTasks.entries()) {
|
||||
compileTask(i);
|
||||
|
||||
allProcessed = allProcessed && rawTasks[i].processed;
|
||||
allProcessed = allProcessed && rawTask.processed;
|
||||
}
|
||||
return allProcessed;
|
||||
};
|
||||
|
@ -143,7 +143,7 @@ export const bounds = {
|
||||
this.verticalPos = 0;
|
||||
},
|
||||
updateVal: function (obj, key, val, fun) {
|
||||
if (typeof obj[key] === 'undefined') {
|
||||
if (obj[key] === undefined) {
|
||||
obj[key] = val;
|
||||
} else {
|
||||
obj[key] = fun(val, obj[key]);
|
||||
@ -218,8 +218,7 @@ export const drawTasks = function (diagram, tasks, verticalPos) {
|
||||
let num = 0;
|
||||
|
||||
// Draw the tasks
|
||||
for (let i = 0; i < tasks.length; i++) {
|
||||
const task = tasks[i];
|
||||
for (const [i, task] of tasks.entries()) {
|
||||
if (lastSection !== task.section) {
|
||||
fill = fills[sectionNumber % fills.length];
|
||||
num = sectionNumber % fills.length;
|
||||
|
@ -11,7 +11,7 @@ export const drawRect = function (elem, rectData) {
|
||||
rectElem.attr('rx', rectData.rx);
|
||||
rectElem.attr('ry', rectData.ry);
|
||||
|
||||
if (typeof rectData.class !== 'undefined') {
|
||||
if (rectData.class !== undefined) {
|
||||
rectElem.attr('class', rectData.class);
|
||||
}
|
||||
|
||||
@ -116,11 +116,11 @@ export const drawCircle = function (element, circleData) {
|
||||
circleElement.attr('stroke', circleData.stroke);
|
||||
circleElement.attr('r', circleData.r);
|
||||
|
||||
if (typeof circleElement.class !== 'undefined') {
|
||||
if (circleElement.class !== undefined) {
|
||||
circleElement.attr('class', circleElement.class);
|
||||
}
|
||||
|
||||
if (typeof circleData.title !== 'undefined') {
|
||||
if (circleData.title !== undefined) {
|
||||
circleElement.append('title').text(circleData.title);
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ export const drawText = function (elem, textData) {
|
||||
|
||||
textElem.style('text-anchor', textData.anchor);
|
||||
|
||||
if (typeof textData.class !== 'undefined') {
|
||||
if (textData.class !== undefined) {
|
||||
textElem.attr('class', textData.class);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ import { exec } from 'child_process';
|
||||
import { globby } from 'globby';
|
||||
import { JSDOM } from 'jsdom';
|
||||
import type { Code, Root } from 'mdast';
|
||||
import { posix, dirname, relative } from 'path';
|
||||
import { posix, dirname, relative, join } from 'path';
|
||||
import prettier from 'prettier';
|
||||
import { remark } from 'remark';
|
||||
import chokidar from 'chokidar';
|
||||
@ -66,8 +66,11 @@ const LOGMSG_COPIED = `, and copied to ${FINAL_DOCS_DIR}`;
|
||||
const WARN_DOCSDIR_DOESNT_MATCH = `Changed files were transformed in ${SOURCE_DOCS_DIR} but do not match the files in ${FINAL_DOCS_DIR}. Please run 'pnpm --filter mermaid run docs:build' after making changes to ${SOURCE_DOCS_DIR} to update the ${FINAL_DOCS_DIR} directory with the transformed files.`;
|
||||
|
||||
const prettierConfig = prettier.resolveConfig.sync('.') ?? {};
|
||||
// From https://github.com/vuejs/vitepress/blob/428eec3750d6b5648a77ac52d88128df0554d4d1/src/node/markdownToVue.ts#L20-L21
|
||||
const includesRE = /<!--\s*@include:\s*(.*?)\s*-->/g;
|
||||
const includedFiles: Set<string> = new Set();
|
||||
|
||||
let filesWereTransformed = false;
|
||||
const filesTransformed: Set<string> = new Set();
|
||||
|
||||
const generateHeader = (file: string): string => {
|
||||
// path from file in docs/* to repo root, e.g ../ or ../../ */
|
||||
@ -117,10 +120,10 @@ const logWasOrShouldBeTransformed = (filename: string, wasCopied: boolean) => {
|
||||
* transformed contents to the final documentation directory if the doCopy flag is true. Log
|
||||
* messages to the console.
|
||||
*
|
||||
* @param {string} filename Name of the file that will be verified
|
||||
* @param {boolean} [doCopy=false] Whether we should copy that transformedContents to the final
|
||||
* @param filename Name of the file that will be verified
|
||||
* @param doCopy?=false Whether we should copy that transformedContents to the final
|
||||
* documentation directory. Default is `false`
|
||||
* @param {string} [transformedContent] New contents for the file
|
||||
* @param transformedContent? New contents for the file
|
||||
*/
|
||||
const copyTransformedContents = (filename: string, doCopy = false, transformedContent?: string) => {
|
||||
const fileInFinalDocDir = changeToFinalDocDir(filename);
|
||||
@ -132,7 +135,7 @@ const copyTransformedContents = (filename: string, doCopy = false, transformedCo
|
||||
return; // Files are same, skip.
|
||||
}
|
||||
|
||||
filesWereTransformed = true;
|
||||
filesTransformed.add(fileInFinalDocDir);
|
||||
if (doCopy) {
|
||||
writeFileSync(fileInFinalDocDir, newBuffer);
|
||||
}
|
||||
@ -151,6 +154,19 @@ const transformToBlockQuote = (content: string, type: string) => {
|
||||
const injectPlaceholders = (text: string): string =>
|
||||
text.replace(/<MERMAID_VERSION>/g, MERMAID_MAJOR_VERSION).replace(/<CDN_URL>/g, CDN_URL);
|
||||
|
||||
const transformIncludeStatements = (file: string, text: string): string => {
|
||||
// resolve includes - src https://github.com/vuejs/vitepress/blob/428eec3750d6b5648a77ac52d88128df0554d4d1/src/node/markdownToVue.ts#L65-L76
|
||||
return text.replace(includesRE, (m, m1) => {
|
||||
try {
|
||||
const includePath = join(dirname(file), m1);
|
||||
const content = readSyncedUTF8file(includePath);
|
||||
includedFiles.add(changeToFinalDocDir(includePath));
|
||||
return content;
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to resolve include "${m1}" in "${file}": ${error}`);
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Transform a markdown file and write the transformed file to the directory for published
|
||||
* documentation
|
||||
@ -164,8 +180,7 @@ const injectPlaceholders = (text: string): string =>
|
||||
* @param file {string} name of the file that will be verified
|
||||
*/
|
||||
const transformMarkdown = (file: string) => {
|
||||
const doc = injectPlaceholders(readSyncedUTF8file(file));
|
||||
|
||||
const doc = injectPlaceholders(transformIncludeStatements(file, readSyncedUTF8file(file)));
|
||||
const ast: Root = remark.parse(doc);
|
||||
const out = flatmap(ast, (c: Code) => {
|
||||
if (c.type !== 'code' || !c.lang) {
|
||||
@ -270,6 +285,12 @@ const getFilesFromGlobs = async (globs: string[]): Promise<string[]> => {
|
||||
console.log(`${action} ${mdFiles.length} markdown files...`);
|
||||
mdFiles.forEach(transformMarkdown);
|
||||
|
||||
for (const includedFile of includedFiles) {
|
||||
rmSync(includedFile, { force: true });
|
||||
filesTransformed.delete(includedFile);
|
||||
console.log(`Removed ${includedFile} as it was used inside an @include block.`);
|
||||
}
|
||||
|
||||
const htmlFileGlobs = getGlobs([posix.join(sourceDirGlob, '*.html')]);
|
||||
const htmlFiles = await getFilesFromGlobs(htmlFileGlobs);
|
||||
console.log(`${action} ${htmlFiles.length} html files...`);
|
||||
@ -282,7 +303,7 @@ const getFilesFromGlobs = async (globs: string[]): Promise<string[]> => {
|
||||
copyTransformedContents(file, !verifyOnly); // no transformation
|
||||
});
|
||||
|
||||
if (filesWereTransformed) {
|
||||
if (filesTransformed.size > 0) {
|
||||
if (verifyOnly) {
|
||||
console.log(WARN_DOCSDIR_DOESNT_MATCH);
|
||||
process.exit(1);
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { version } from '../../../package.json';
|
||||
import MermaidExample from './mermaid-markdown-all';
|
||||
import { MermaidMarkdown } from 'vitepress-plugin-mermaid';
|
||||
import { defineConfig, MarkdownOptions } from 'vitepress';
|
||||
|
||||
const allMarkdownTransformers: MarkdownOptions = {
|
||||
@ -8,7 +7,6 @@ const allMarkdownTransformers: MarkdownOptions = {
|
||||
theme: 'github-dark',
|
||||
config: async (md) => {
|
||||
await MermaidExample(md);
|
||||
MermaidMarkdown(md);
|
||||
},
|
||||
};
|
||||
|
||||
@ -108,6 +106,7 @@ function sidebarSyntax() {
|
||||
{ text: 'Requirement Diagram', link: '/syntax/requirementDiagram' },
|
||||
{ text: 'Gitgraph (Git) Diagram 🔥', link: '/syntax/gitgraph' },
|
||||
{ text: 'C4C Diagram (Context) Diagram 🦺⚠️', link: '/syntax/c4c' },
|
||||
{ text: 'Mindmaps 🔥', link: '/syntax/mindmap' },
|
||||
{ text: 'Other Examples', link: '/syntax/examples' },
|
||||
],
|
||||
},
|
||||
|
@ -21,17 +21,30 @@ const MermaidExample = async (md: MarkdownRenderer) => {
|
||||
|
||||
// doing ```mermaid-example {line-numbers=5 highlight=14-17} is not supported
|
||||
const langAttrs = '';
|
||||
return `<h5>Code:</h5>
|
||||
<div class="language-mermaid">
|
||||
<button class="copy"></button>
|
||||
<span class="lang">mermaid</span>
|
||||
${
|
||||
// html is pre-escaped by the highlight function
|
||||
// (it also adds `v-pre` to ignore Vue template syntax)
|
||||
md.options.highlight(token.content, 'mermaid', langAttrs)
|
||||
}
|
||||
</div>
|
||||
<h5>Diagram:</h5>`;
|
||||
return `
|
||||
<h5>Code:</h5>
|
||||
<div class="language-mermaid">
|
||||
<button class="copy"></button>
|
||||
<span class="lang">mermaid</span>
|
||||
${
|
||||
// html is pre-escaped by the highlight function
|
||||
// (it also adds `v-pre` to ignore Vue template syntax)
|
||||
md.options.highlight(token.content, 'mermaid', langAttrs)
|
||||
}
|
||||
</div>`;
|
||||
} else if (token.info.trim() === 'mermaid') {
|
||||
const key = index;
|
||||
return `
|
||||
<Suspense>
|
||||
<template #default>
|
||||
<Mermaid id="mermaid-${key}" graph="${encodeURIComponent(token.content)}"></Mermaid>
|
||||
</template>
|
||||
<!-- loading state via #fallback slot -->
|
||||
<template #fallback>
|
||||
Loading...
|
||||
</template>
|
||||
</Suspense>
|
||||
`;
|
||||
}
|
||||
if (token.info.trim() === 'warning') {
|
||||
return `<div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>${token.content}}</p></div>`;
|
||||
|
66
packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue
Normal file
66
packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue
Normal file
@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<div v-html="svg"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { render } from './mermaid';
|
||||
|
||||
const props = defineProps({
|
||||
graph: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const svg = ref(null);
|
||||
let mut = null;
|
||||
|
||||
const mermaidConfig = {
|
||||
securityLevel: 'loose',
|
||||
startOnLoad: false,
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
mut = new MutationObserver(() => renderChart());
|
||||
mut.observe(document.documentElement, { attributes: true });
|
||||
await renderChart();
|
||||
|
||||
//refresh images on first render
|
||||
const hasImages = /<img([\w\W]+?)>/.exec(decodeURIComponent(props.graph))?.length > 0;
|
||||
if (hasImages)
|
||||
setTimeout(() => {
|
||||
let imgElements = document.getElementsByTagName('img');
|
||||
let imgs = Array.from(imgElements);
|
||||
if (imgs.length) {
|
||||
Promise.all(
|
||||
imgs
|
||||
.filter((img) => !img.complete)
|
||||
.map(
|
||||
(img) =>
|
||||
new Promise((resolve) => {
|
||||
img.onload = img.onerror = resolve;
|
||||
})
|
||||
)
|
||||
).then(() => {
|
||||
renderChart();
|
||||
});
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
onUnmounted(() => mut.disconnect());
|
||||
|
||||
const renderChart = async () => {
|
||||
console.log('rendering chart' + props.id + props.graph);
|
||||
const hasDarkClass = document.documentElement.classList.contains('dark');
|
||||
mermaidConfig.theme = hasDarkClass ? 'dark' : 'default';
|
||||
|
||||
console.log({ mermaidConfig });
|
||||
svg.value = await render(props.id, decodeURIComponent(props.graph), mermaidConfig);
|
||||
};
|
||||
</script>
|
@ -1,7 +1,7 @@
|
||||
import DefaultTheme from 'vitepress/theme';
|
||||
// @ts-ignore
|
||||
import Mermaid from 'vitepress-plugin-mermaid/Mermaid.vue';
|
||||
import './custom.css';
|
||||
// @ts-ignore
|
||||
import Mermaid from './Mermaid.vue';
|
||||
import { getRedirect } from './redirect';
|
||||
|
||||
export default {
|
||||
|
14
packages/mermaid/src/docs/.vitepress/theme/mermaid.ts
Normal file
14
packages/mermaid/src/docs/.vitepress/theme/mermaid.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import mermaid, { type MermaidConfig } from 'mermaid';
|
||||
import mindmap from '@mermaid-js/mermaid-mindmap';
|
||||
|
||||
try {
|
||||
await mermaid.registerExternalDiagrams([mindmap]);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
export const render = async (id: string, code: string, config: MermaidConfig): Promise<string> => {
|
||||
mermaid.initialize(config);
|
||||
const svg = await mermaid.renderAsync(id, code);
|
||||
return svg;
|
||||
};
|
@ -1,179 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>
|
||||
mermaid - Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams,
|
||||
gantt charts and git graphs.
|
||||
</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs."
|
||||
/>
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
|
||||
/>
|
||||
<!-- <link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css"> -->
|
||||
<link rel="stylesheet" href="theme.css" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css"
|
||||
/>
|
||||
<script
|
||||
defer
|
||||
data-domain="mermaid-js.github.io"
|
||||
src="https://plausible.io/js/plausible.js"
|
||||
></script>
|
||||
<script>
|
||||
const require = {
|
||||
paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs' },
|
||||
};
|
||||
</script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs/loader.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs/editor/editor.main.nls.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.29.1/min/vs/editor/editor.main.js"></script>
|
||||
<script>
|
||||
exports = {};
|
||||
</script>
|
||||
<script src="https://unpkg.com/monaco-mermaid/browser.js"></script>
|
||||
|
||||
<style>
|
||||
.markdown-section {
|
||||
max-width: 1200px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module">
|
||||
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
|
||||
import mindmap from 'https://unpkg.com/@mermaid-js/mermaid-mindmap@9/dist/mermaid-mindmap.esm.min.mjs';
|
||||
await mermaid.registerExternalDiagrams([mindmap]);
|
||||
|
||||
window.mermaid = mermaid;
|
||||
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
|
||||
const conf = {
|
||||
logLevel: 4,
|
||||
startOnLoad: true,
|
||||
themeCSS: '.label { font-family: Source Sans Pro,Helvetica Neue,Arial,sans-serif; }',
|
||||
};
|
||||
if (isDarkMode) conf.theme = 'dark';
|
||||
|
||||
async function loadMermaid() {
|
||||
mermaid.parseError = (e) => {
|
||||
console.log('parse error', e); // eslint-disable-line
|
||||
};
|
||||
await mermaid.registerExternalDiagrams([mindmap]);
|
||||
mermaid.initialize(conf);
|
||||
console.log('mermaid initialized'); // eslint-disable-line
|
||||
}
|
||||
|
||||
await loadMermaid();
|
||||
</script>
|
||||
<script>
|
||||
let initEditor = exports.default;
|
||||
let parser = new DOMParser();
|
||||
let currentCodeExample = 0;
|
||||
let colorize = [];
|
||||
let num = 0;
|
||||
|
||||
function colorizeEverything(html) {
|
||||
initEditor(monaco);
|
||||
return new Promise((resolve, reject) => {
|
||||
monaco.editor.setTheme('mermaid');
|
||||
const parsed = parser.parseFromString(html, 'text/html').body;
|
||||
Promise.all(
|
||||
[...parsed.querySelectorAll('pre[id*="code"]')].map((codeBlock) =>
|
||||
monaco.editor.colorize(codeBlock.innerText, 'mermaid')
|
||||
)
|
||||
).then((result) => {
|
||||
parsed
|
||||
.querySelectorAll('pre[id*="code"]')
|
||||
.forEach((codeBlock, index) => (codeBlock.innerHTML = result[index]));
|
||||
resolve(parsed.innerHTML);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function escapeHTML(html) {
|
||||
return html
|
||||
.replaceAll('&', '&')
|
||||
.replaceAll('<', '<')
|
||||
.replaceAll('>', '>')
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll("'", ''');
|
||||
}
|
||||
|
||||
window.$docsify = {
|
||||
search: 'auto',
|
||||
name: 'mermaid',
|
||||
repo: 'https://github.com/mermaid-js/mermaid',
|
||||
loadSidebar: true,
|
||||
mergeNavbar: true,
|
||||
maxLevel: 4,
|
||||
subMaxLevel: 2,
|
||||
markdown: {
|
||||
renderer: {
|
||||
code: function (code, lang) {
|
||||
if (lang === 'mermaid-example') {
|
||||
console.log('An example'); // eslint-disable-line
|
||||
currentCodeExample++;
|
||||
colorize.push(currentCodeExample);
|
||||
return '<pre id="code' + currentCodeExample + '">' + escapeHTML(code) + '</pre>';
|
||||
} else if (lang === 'mermaid') {
|
||||
return '<pre class="mermaid">' + code + '</pre>';
|
||||
}
|
||||
return this.origin.code.apply(this, arguments);
|
||||
},
|
||||
heading: function (text) {
|
||||
if (text.includes('THIS IS AN AUTOGENERATED FILE. DO NOT EDIT')) {
|
||||
return '';
|
||||
}
|
||||
return this.origin.heading.apply(this, arguments);
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
function (hook, vm) {
|
||||
hook.beforeEach(function (html) {
|
||||
url = 'https://github.com/mermaid-js/mermaid/blob/develop/src/docs/' + vm.route.file;
|
||||
const editHtml = '[:memo: Edit this Page](' + url + ')\n';
|
||||
return editHtml + html;
|
||||
});
|
||||
// Invoked on each page load after new HTML has been appended to the DOM
|
||||
hook.doneEach(async function () {
|
||||
await mermaid.init();
|
||||
});
|
||||
|
||||
hook.afterEach(function (html, next) {
|
||||
next(html);
|
||||
(async () => {
|
||||
while (!window.hasOwnProperty('monaco'))
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
colorizeEverything(html).then(
|
||||
(newHTML) =>
|
||||
(document.querySelector('article.markdown-section').innerHTML = newHTML)
|
||||
);
|
||||
})();
|
||||
});
|
||||
},
|
||||
],
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
window.onhashchange = function (a) {
|
||||
// if (location && ga) {
|
||||
// ga('send', 'pageview', location.hash);
|
||||
// }
|
||||
};
|
||||
</script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
|
||||
<!-- <script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/ga.min.js"></script> -->
|
||||
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-coffeescript.min.js"></script>
|
||||
</body>
|
||||
</html>
|
100
packages/mermaid/src/docs/intro/examples.md
Normal file
100
packages/mermaid/src/docs/intro/examples.md
Normal file
@ -0,0 +1,100 @@
|
||||
## Diagram Types
|
||||
|
||||
### [Flowchart](../syntax/flowchart.md?id=flowcharts-basic-syntax)
|
||||
|
||||
```mermaid-example
|
||||
graph TD;
|
||||
A-->B;
|
||||
A-->C;
|
||||
B-->D;
|
||||
C-->D;
|
||||
```
|
||||
|
||||
### [Sequence diagram](../syntax/sequenceDiagram.md)
|
||||
|
||||
```mermaid-example
|
||||
sequenceDiagram
|
||||
participant Alice
|
||||
participant Bob
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop Healthcheck
|
||||
John->>John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts <br/>prevail!
|
||||
John-->>Alice: Great!
|
||||
John->>Bob: How about you?
|
||||
Bob-->>John: Jolly good!
|
||||
```
|
||||
|
||||
### [Gantt diagram](../syntax/gantt.md)
|
||||
|
||||
```mermaid-example
|
||||
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
|
||||
Active task :active, des2, 2014-01-09, 3d
|
||||
Future task : des3, after des2, 5d
|
||||
Future task2 : des4, after des3, 5d
|
||||
```
|
||||
|
||||
### [Class diagram](../syntax/classDiagram.md)
|
||||
|
||||
```mermaid-example
|
||||
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
|
||||
```
|
||||
|
||||
### [Git graph](../syntax/gitgraph.md)
|
||||
|
||||
```mermaid-example
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
branch develop
|
||||
commit
|
||||
commit
|
||||
commit
|
||||
checkout main
|
||||
commit
|
||||
commit
|
||||
```
|
||||
|
||||
### [Entity Relationship Diagram - :exclamation: experimental](../syntax/entityRelationshipDiagram.md)
|
||||
|
||||
```mermaid-example
|
||||
erDiagram
|
||||
CUSTOMER ||--o{ ORDER : places
|
||||
ORDER ||--|{ LINE-ITEM : contains
|
||||
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
|
||||
|
||||
```
|
||||
|
||||
### [User Journey Diagram](../syntax/userJourney.md)
|
||||
|
||||
```mermaid-example
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 5: Me
|
||||
```
|
@ -44,106 +44,7 @@ In our release process we rely heavily on visual regression tests using [applito
|
||||
<svg width="170" height="32" viewBox="0 0 170 32" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" maskUnits="userSpaceOnUse" x="27" y="0" width="143" height="32"><path fill-rule="evenodd" clip-rule="evenodd" d="M27.732.227h141.391v31.19H27.733V.227z" fill="#fff"></path></mask><g mask="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M153.851 22.562l1.971-3.298c1.291 1.219 3.837 2.402 5.988 2.402 1.971 0 2.903-.753 2.903-1.829 0-2.832-10.253-.502-10.253-7.313 0-2.904 2.51-5.45 7.099-5.45 2.904 0 5.234 1.004 6.955 2.367l-1.829 3.226c-1.039-1.075-3.011-2.008-5.126-2.008-1.65 0-2.725.717-2.725 1.685 0 2.546 10.289.395 10.289 7.386 0 3.19-2.724 5.52-7.528 5.52-3.012 0-5.916-1.003-7.744-2.688zm-5.7 2.259h4.553V.908h-4.553v23.913zm-6.273-8.676c0-2.689-1.578-5.02-4.446-5.02-2.832 0-4.409 2.331-4.409 5.02 0 2.724 1.577 5.055 4.409 5.055 2.868 0 4.446-2.33 4.446-5.055zm-13.588 0c0-4.912 3.442-9.07 9.142-9.07 5.736 0 9.178 4.158 9.178 9.07 0 4.911-3.442 9.106-9.178 9.106-5.7 0-9.142-4.195-9.142-9.106zm-5.628 0c0-2.689-1.577-5.02-4.445-5.02-2.832 0-4.41 2.331-4.41 5.02 0 2.724 1.578 5.055 4.41 5.055 2.868 0 4.445-2.33 4.445-5.055zm-13.587 0c0-4.912 3.441-9.07 9.142-9.07 5.736 0 9.178 4.158 9.178 9.07 0 4.911-3.442 9.106-9.178 9.106-5.701 0-9.142-4.195-9.142-9.106zm-8.425 4.338v-8.999h-2.868v-3.98h2.868V2.773h4.553v4.733h3.514v3.979h-3.514v7.78c0 1.111.574 1.936 1.578 1.936.681 0 1.326-.251 1.577-.538l.968 3.478c-.681.609-1.9 1.11-3.8 1.11-3.191 0-4.876-1.648-4.876-4.767zm-8.962 4.338h4.553V7.505h-4.553V24.82zm-.43-21.905a2.685 2.685 0 012.688-2.69c1.506 0 2.725 1.184 2.725 2.69a2.724 2.724 0 01-2.725 2.724c-1.47 0-2.688-1.219-2.688-2.724zM84.482 24.82h4.553V.908h-4.553v23.913zm-6.165-8.676c0-2.976-1.793-5.02-4.41-5.02-1.47 0-3.119.825-3.908 1.973v6.094c.753 1.111 2.438 2.008 3.908 2.008 2.617 0 4.41-2.044 4.41-5.055zm-8.318 6.453v8.82h-4.553V7.504H70v2.187c1.327-1.685 3.227-2.618 5.342-2.618 4.446 0 7.672 3.299 7.672 9.07 0 5.773-3.226 9.107-7.672 9.107-2.043 0-3.907-.86-5.342-2.653zm-10.718-6.453c0-2.976-1.793-5.02-4.41-5.02-1.47 0-3.119.825-3.908 1.973v6.094c.753 1.111 2.438 2.008 3.908 2.008 2.617 0 4.41-2.044 4.41-5.055zm-8.318 6.453v8.82H46.41V7.504h4.553v2.187c1.327-1.685 3.227-2.618 5.342-2.618 4.446 0 7.672 3.299 7.672 9.07 0 5.773-3.226 9.107-7.672 9.107-2.043 0-3.908-.86-5.342-2.653zm-11.758-1.936V18.51c-.753-1.004-2.187-1.542-3.657-1.542-1.793 0-3.263.968-3.263 2.617 0 1.65 1.47 2.582 3.263 2.582 1.47 0 2.904-.502 3.657-1.506zm0 4.159v-1.829c-1.183 1.434-3.227 2.259-5.485 2.259-2.761 0-5.988-1.864-5.988-5.736 0-4.087 3.227-5.593 5.988-5.593 2.33 0 4.337.753 5.485 2.115V13.85c0-1.756-1.506-2.904-3.8-2.904-1.829 0-3.55.717-4.984 2.044L28.63 9.8c2.115-1.901 4.84-2.726 7.564-2.726 3.98 0 7.6 1.578 7.6 6.561v11.186h-4.588z" fill="#00A298"></path></g><path fill-rule="evenodd" clip-rule="evenodd" d="M14.934 16.177c0 1.287-.136 2.541-.391 3.752-1.666-1.039-3.87-2.288-6.777-3.752 2.907-1.465 5.11-2.714 6.777-3.753.255 1.211.39 2.466.39 3.753m4.6-7.666V4.486a78.064 78.064 0 01-4.336 3.567c-1.551-2.367-3.533-4.038-6.14-5.207C11.1 4.658 12.504 6.7 13.564 9.262 5.35 15.155 0 16.177 0 16.177s5.35 1.021 13.564 6.915c-1.06 2.563-2.463 4.603-4.507 6.415 2.607-1.169 4.589-2.84 6.14-5.207a77.978 77.978 0 014.336 3.568v-4.025s-.492-.82-2.846-2.492c.6-1.611.93-3.354.93-5.174a14.8 14.8 0 00-.93-5.174c2.354-1.673 2.846-2.492 2.846-2.492" fill="#00A298"></path></svg>
|
||||
</a>
|
||||
|
||||
## Diagram Types
|
||||
|
||||
### [Flowchart](../syntax/flowchart.md?id=flowcharts-basic-syntax)
|
||||
|
||||
```mermaid-example
|
||||
graph TD;
|
||||
A-->B;
|
||||
A-->C;
|
||||
B-->D;
|
||||
C-->D;
|
||||
```
|
||||
|
||||
### [Sequence diagram](../syntax/sequenceDiagram.md)
|
||||
|
||||
```mermaid-example
|
||||
sequenceDiagram
|
||||
participant Alice
|
||||
participant Bob
|
||||
Alice->>John: Hello John, how are you?
|
||||
loop Healthcheck
|
||||
John->>John: Fight against hypochondria
|
||||
end
|
||||
Note right of John: Rational thoughts <br/>prevail!
|
||||
John-->>Alice: Great!
|
||||
John->>Bob: How about you?
|
||||
Bob-->>John: Jolly good!
|
||||
```
|
||||
|
||||
### [Gantt diagram](../syntax/gantt.md)
|
||||
|
||||
```mermaid-example
|
||||
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
|
||||
Active task :active, des2, 2014-01-09, 3d
|
||||
Future task : des3, after des2, 5d
|
||||
Future task2 : des4, after des3, 5d
|
||||
```
|
||||
|
||||
### [Class diagram](../syntax/classDiagram.md)
|
||||
|
||||
```mermaid-example
|
||||
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
|
||||
```
|
||||
|
||||
### [Git graph](../syntax/gitgraph.md)
|
||||
|
||||
```mermaid-example
|
||||
gitGraph
|
||||
commit
|
||||
commit
|
||||
branch develop
|
||||
commit
|
||||
commit
|
||||
commit
|
||||
checkout main
|
||||
commit
|
||||
commit
|
||||
```
|
||||
|
||||
### [Entity Relationship Diagram - :exclamation: experimental](../syntax/entityRelationshipDiagram.md)
|
||||
|
||||
```mermaid-example
|
||||
erDiagram
|
||||
CUSTOMER ||--o{ ORDER : places
|
||||
ORDER ||--|{ LINE-ITEM : contains
|
||||
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
|
||||
|
||||
```
|
||||
|
||||
### [User Journey Diagram](../syntax/userJourney.md)
|
||||
|
||||
```mermaid-example
|
||||
journey
|
||||
title My working day
|
||||
section Go to work
|
||||
Make tea: 5: Me
|
||||
Go upstairs: 3: Me
|
||||
Do work: 1: Me, Cat
|
||||
section Go home
|
||||
Go downstairs: 5: Me
|
||||
Sit down: 5: Me
|
||||
```
|
||||
<!--@include: ./examples.md -->
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -126,6 +126,10 @@ Rendering in Mermaid is initialized by `mermaid.initialize()` call. You can plac
|
||||
| ----------- | --------------------------------- | ------- | ----------- |
|
||||
| startOnLoad | Toggle for Rendering upon loading | Boolean | true, false |
|
||||
|
||||
### Adding external diagrams to mermaid
|
||||
|
||||
Please refer to the [Mindmap](./mindmap.md?id=integrating-with-your-librarywebsite) section for more information.
|
||||
|
||||
### Working Examples
|
||||
|
||||
**Here is a full working example of the mermaidAPI being called through the CDN:**
|
||||
|
@ -161,3 +161,17 @@ Root
|
||||
B
|
||||
C
|
||||
```
|
||||
|
||||
## Integrating with your library/website.
|
||||
|
||||
Mindmap uses the experimental lazy loading & async rendering features which could change in the future.
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import mermaid from '<CDN_URL>/mermaid@<MERMAID_VERSION>/dist/mermaid.esm.min.mjs';
|
||||
import mindmap from '<CDN_URL>/@mermaid-js/mermaid-mindmap@<MERMAID_VERSION>/dist/mermaid-mindmap.esm.min.mjs';
|
||||
await mermaid.registerExternalDiagrams([mindmap]);
|
||||
</script>
|
||||
```
|
||||
|
||||
You can also refer the implementation in the live editor [here](https://github.com/mermaid-js/mermaid-live-editor/blob/fcf53c98c25604c90a218104268c339be53035a6/src/lib/util/mermaid.ts) to see how the async loading is done.
|
||||
|
@ -31,6 +31,11 @@ export default defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
mermaid: path.join(__dirname, '../../dist/mermaid.esm.min.mjs'), // Use this one to build
|
||||
|
||||
'@mermaid-js/mermaid-mindmap': path.join(
|
||||
__dirname,
|
||||
'../../../mermaid-mindmap/dist/mermaid-mindmap.esm.min.mjs'
|
||||
), // Use this one to build
|
||||
},
|
||||
},
|
||||
server: {
|
||||
|
@ -108,7 +108,7 @@ const initThrowsErrors = function (
|
||||
// if last argument is a function this is the callback function
|
||||
log.debug(`${!callback ? 'No ' : ''}Callback function found`);
|
||||
let nodesToProcess: ArrayLike<HTMLElement>;
|
||||
if (typeof nodes === 'undefined') {
|
||||
if (nodes === undefined) {
|
||||
nodesToProcess = document.querySelectorAll('.mermaid');
|
||||
} else if (typeof nodes === 'string') {
|
||||
nodesToProcess = document.querySelectorAll(nodes);
|
||||
@ -121,7 +121,7 @@ const initThrowsErrors = function (
|
||||
}
|
||||
|
||||
log.debug(`Found ${nodesToProcess.length} diagrams`);
|
||||
if (typeof config?.startOnLoad !== 'undefined') {
|
||||
if (config?.startOnLoad !== undefined) {
|
||||
log.debug('Start On Load: ' + config?.startOnLoad);
|
||||
mermaidAPI.updateSiteConfig({ startOnLoad: config?.startOnLoad });
|
||||
}
|
||||
@ -133,6 +133,7 @@ const initThrowsErrors = function (
|
||||
const errors: DetailedError[] = [];
|
||||
|
||||
// element is the current div with mermaid class
|
||||
// eslint-disable-next-line unicorn/prefer-spread
|
||||
for (const element of Array.from(nodesToProcess)) {
|
||||
log.info('Rendering diagram: ' + element.id);
|
||||
/*! Check if previously processed */
|
||||
@ -162,7 +163,7 @@ const initThrowsErrors = function (
|
||||
txt,
|
||||
(svgCode: string, bindFunctions?: (el: Element) => void) => {
|
||||
element.innerHTML = svgCode;
|
||||
if (typeof callback !== 'undefined') {
|
||||
if (callback !== undefined) {
|
||||
callback(id);
|
||||
}
|
||||
if (bindFunctions) {
|
||||
@ -249,7 +250,7 @@ const initThrowsErrorsAsync = async function (
|
||||
// if last argument is a function this is the callback function
|
||||
log.debug(`${!callback ? 'No ' : ''}Callback function found`);
|
||||
let nodesToProcess: ArrayLike<HTMLElement>;
|
||||
if (typeof nodes === 'undefined') {
|
||||
if (nodes === undefined) {
|
||||
nodesToProcess = document.querySelectorAll('.mermaid');
|
||||
} else if (typeof nodes === 'string') {
|
||||
nodesToProcess = document.querySelectorAll(nodes);
|
||||
@ -262,7 +263,7 @@ const initThrowsErrorsAsync = async function (
|
||||
}
|
||||
|
||||
log.debug(`Found ${nodesToProcess.length} diagrams`);
|
||||
if (typeof config?.startOnLoad !== 'undefined') {
|
||||
if (config?.startOnLoad !== undefined) {
|
||||
log.debug('Start On Load: ' + config?.startOnLoad);
|
||||
mermaidAPI.updateSiteConfig({ startOnLoad: config?.startOnLoad });
|
||||
}
|
||||
@ -274,6 +275,7 @@ const initThrowsErrorsAsync = async function (
|
||||
const errors: DetailedError[] = [];
|
||||
|
||||
// element is the current div with mermaid class
|
||||
// eslint-disable-next-line unicorn/prefer-spread
|
||||
for (const element of Array.from(nodesToProcess)) {
|
||||
log.info('Rendering diagram: ' + element.id);
|
||||
/*! Check if previously processed */
|
||||
@ -303,7 +305,7 @@ const initThrowsErrorsAsync = async function (
|
||||
txt,
|
||||
(svgCode: string, bindFunctions?: (el: Element) => void) => {
|
||||
element.innerHTML = svgCode;
|
||||
if (typeof callback !== 'undefined') {
|
||||
if (callback !== undefined) {
|
||||
callback(id);
|
||||
}
|
||||
if (bindFunctions) {
|
||||
|
@ -292,11 +292,11 @@ describe('mermaidAPI', function () {
|
||||
});
|
||||
it('gets the fontFamily from the config', () => {
|
||||
const styles = createCssStyles(mocked_config_with_htmlLabels, 'graphType', {});
|
||||
expect(styles).toMatch(/(.*)\n:root \{ --mermaid-font-family: serif(.*)/);
|
||||
expect(styles).toMatch(/(.*)\n:root { --mermaid-font-family: serif(.*)/);
|
||||
});
|
||||
it('gets the alt fontFamily from the config', () => {
|
||||
const styles = createCssStyles(mocked_config_with_htmlLabels, 'graphType', undefined);
|
||||
expect(styles).toMatch(/(.*)\n:root \{ --mermaid-alt-font-family: sans-serif(.*)/);
|
||||
expect(styles).toMatch(/(.*)\n:root { --mermaid-alt-font-family: sans-serif(.*)/);
|
||||
});
|
||||
|
||||
describe('there are some classDefs', () => {
|
||||
@ -312,7 +312,7 @@ describe('mermaidAPI', function () {
|
||||
|
||||
// prefix any special RegExp characters in the given string with a \ so we can use the literal character in a RegExp
|
||||
function escapeForRegexp(str: string) {
|
||||
const strChars = str.split(''); // split into array of every char
|
||||
const strChars = [...str]; // split into array of every char
|
||||
const strEscaped = strChars.map((char) => {
|
||||
if (REGEXP_SPECIALS.includes(char)) {
|
||||
return `\\${char}`;
|
||||
|
@ -129,15 +129,9 @@ export const encodeEntities = function (text: string): string {
|
||||
export const decodeEntities = function (text: string): string {
|
||||
let txt = text;
|
||||
|
||||
txt = txt.replace(/fl°°/g, function () {
|
||||
return '&#';
|
||||
});
|
||||
txt = txt.replace(/fl°/g, function () {
|
||||
return '&';
|
||||
});
|
||||
txt = txt.replace(/¶ß/g, function () {
|
||||
return ';';
|
||||
});
|
||||
txt = txt.replace(/fl°°/g, '&#');
|
||||
txt = txt.replace(/fl°/g, '&');
|
||||
txt = txt.replace(/¶ß/g, ';');
|
||||
|
||||
return txt;
|
||||
};
|
||||
@ -190,28 +184,26 @@ export const createCssStyles = (
|
||||
}
|
||||
|
||||
// classDefs defined in the diagram text
|
||||
if (!isEmpty(classDefs)) {
|
||||
if (CLASSDEF_DIAGRAMS.includes(graphType)) {
|
||||
const htmlLabels = config.htmlLabels || config.flowchart?.htmlLabels; // TODO why specifically check the Flowchart diagram config?
|
||||
if (!isEmpty(classDefs) && CLASSDEF_DIAGRAMS.includes(graphType)) {
|
||||
const htmlLabels = config.htmlLabels || config.flowchart?.htmlLabels; // TODO why specifically check the Flowchart diagram config?
|
||||
|
||||
const cssHtmlElements = ['> *', 'span']; // TODO make a constant
|
||||
const cssShapeElements = ['rect', 'polygon', 'ellipse', 'circle', 'path']; // TODO make a constant
|
||||
const cssHtmlElements = ['> *', 'span']; // TODO make a constant
|
||||
const cssShapeElements = ['rect', 'polygon', 'ellipse', 'circle', 'path']; // TODO make a constant
|
||||
|
||||
const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;
|
||||
const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;
|
||||
|
||||
// create the CSS styles needed for each styleClass definition and css element
|
||||
for (const classId in classDefs) {
|
||||
const styleClassDef = classDefs[classId];
|
||||
// create the css styles for each cssElement and the styles (only if there are styles)
|
||||
if (!isEmpty(styleClassDef.styles)) {
|
||||
cssElements.forEach((cssElement) => {
|
||||
cssStyles += cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles);
|
||||
});
|
||||
}
|
||||
// create the css styles for the tspan element and the text styles (only if there are textStyles)
|
||||
if (!isEmpty(styleClassDef.textStyles)) {
|
||||
cssStyles += cssImportantStyles(styleClassDef.id, 'tspan', styleClassDef.textStyles);
|
||||
}
|
||||
// create the CSS styles needed for each styleClass definition and css element
|
||||
for (const classId in classDefs) {
|
||||
const styleClassDef = classDefs[classId];
|
||||
// create the css styles for each cssElement and the styles (only if there are styles)
|
||||
if (!isEmpty(styleClassDef.styles)) {
|
||||
cssElements.forEach((cssElement) => {
|
||||
cssStyles += cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles);
|
||||
});
|
||||
}
|
||||
// create the css styles for the tspan element and the text styles (only if there are textStyles)
|
||||
if (!isEmpty(styleClassDef.textStyles)) {
|
||||
cssStyles += cssImportantStyles(styleClassDef.id, 'tspan', styleClassDef.textStyles);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -433,7 +425,7 @@ const render = function (
|
||||
// Define the root d3 node
|
||||
// In regular execution the svgContainingElement will be the element with a mermaid class
|
||||
|
||||
if (typeof svgContainingElement !== 'undefined') {
|
||||
if (svgContainingElement !== undefined) {
|
||||
if (svgContainingElement) {
|
||||
svgContainingElement.innerHTML = '';
|
||||
}
|
||||
@ -513,7 +505,7 @@ const render = function (
|
||||
|
||||
// svg is a HTML element (not a d3 node)
|
||||
const style1 = document.createElement('style');
|
||||
style1.innerHTML = `${idSelector} ` + rules;
|
||||
style1.innerHTML = rules;
|
||||
svg.insertBefore(style1, firstChild);
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
@ -555,7 +547,7 @@ const render = function (
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Do any callbacks (cb = callback)
|
||||
if (typeof cb !== 'undefined') {
|
||||
if (cb !== undefined) {
|
||||
switch (graphType) {
|
||||
case 'flowchart':
|
||||
case 'flowchart-v2':
|
||||
@ -641,7 +633,7 @@ const renderAsync = async function (
|
||||
// Define the root d3 node
|
||||
// In regular execution the svgContainingElement will be the element with a mermaid class
|
||||
|
||||
if (typeof svgContainingElement !== 'undefined') {
|
||||
if (svgContainingElement !== undefined) {
|
||||
if (svgContainingElement) {
|
||||
svgContainingElement.innerHTML = '';
|
||||
}
|
||||
@ -716,7 +708,7 @@ const renderAsync = async function (
|
||||
);
|
||||
|
||||
const style1 = document.createElement('style');
|
||||
style1.innerHTML = `${idSelector} ` + rules;
|
||||
style1.innerHTML = rules;
|
||||
svg.insertBefore(style1, firstChild);
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
@ -751,7 +743,7 @@ const renderAsync = async function (
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Do any callbacks (cb = callback)
|
||||
if (typeof cb !== 'undefined') {
|
||||
if (cb !== undefined) {
|
||||
switch (graphType) {
|
||||
case 'flowchart':
|
||||
case 'flowchart-v2':
|
||||
@ -830,7 +822,7 @@ const handleDirective = function (p: any, directive: any, type: string): void {
|
||||
case 'init':
|
||||
case 'initialize': {
|
||||
['config'].forEach((prop) => {
|
||||
if (typeof directive.args[prop] !== 'undefined') {
|
||||
if (directive.args[prop] !== undefined) {
|
||||
if (type === 'flowchart-v2') {
|
||||
type = 'flowchart';
|
||||
}
|
||||
@ -869,10 +861,8 @@ const handleDirective = function (p: any, directive: any, type: string): void {
|
||||
*/
|
||||
function initialize(options: MermaidConfig = {}) {
|
||||
// Handle legacy location of font-family configuration
|
||||
if (options?.fontFamily) {
|
||||
if (!options.themeVariables?.fontFamily) {
|
||||
options.themeVariables = { fontFamily: options.fontFamily };
|
||||
}
|
||||
if (options?.fontFamily && !options.themeVariables?.fontFamily) {
|
||||
options.themeVariables = { fontFamily: options.fontFamily };
|
||||
}
|
||||
|
||||
// Set default options
|
||||
|
@ -53,7 +53,7 @@ const getStyles = (
|
||||
} else {
|
||||
log.warn(`No theme found for ${type}`);
|
||||
}
|
||||
return ` {
|
||||
return ` & {
|
||||
font-family: ${options.fontFamily};
|
||||
font-size: ${options.fontSize};
|
||||
fill: ${options.textColor}
|
||||
@ -61,40 +61,40 @@ const getStyles = (
|
||||
|
||||
/* Classes common for multiple diagrams */
|
||||
|
||||
.error-icon {
|
||||
& .error-icon {
|
||||
fill: ${options.errorBkgColor};
|
||||
}
|
||||
.error-text {
|
||||
& .error-text {
|
||||
fill: ${options.errorTextColor};
|
||||
stroke: ${options.errorTextColor};
|
||||
}
|
||||
|
||||
.edge-thickness-normal {
|
||||
& .edge-thickness-normal {
|
||||
stroke-width: 2px;
|
||||
}
|
||||
.edge-thickness-thick {
|
||||
& .edge-thickness-thick {
|
||||
stroke-width: 3.5px
|
||||
}
|
||||
.edge-pattern-solid {
|
||||
& .edge-pattern-solid {
|
||||
stroke-dasharray: 0;
|
||||
}
|
||||
|
||||
.edge-pattern-dashed{
|
||||
& .edge-pattern-dashed{
|
||||
stroke-dasharray: 3;
|
||||
}
|
||||
.edge-pattern-dotted {
|
||||
stroke-dasharray: 2;
|
||||
}
|
||||
|
||||
.marker {
|
||||
& .marker {
|
||||
fill: ${options.lineColor};
|
||||
stroke: ${options.lineColor};
|
||||
}
|
||||
.marker.cross {
|
||||
& .marker.cross {
|
||||
stroke: ${options.lineColor};
|
||||
}
|
||||
|
||||
svg {
|
||||
& svg {
|
||||
font-family: ${options.fontFamily};
|
||||
font-size: ${options.fontSize};
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ export class MockedD3 {
|
||||
select = vi.fn().mockImplementation(({ select_str = '' }): MockedD3 => {
|
||||
// Get the id from an argument string. if it is of the form [id='some-id'], strip off the
|
||||
// surrounding id[..]
|
||||
const stripSurroundRegexp = /\[id='(.*)'\]/;
|
||||
const stripSurroundRegexp = /\[id='(.*)']/;
|
||||
const matchedSurrounds = select_str.match(stripSurroundRegexp);
|
||||
const cleanId = matchedSurrounds ? matchedSurrounds[1] : select_str;
|
||||
return new MockedD3(cleanId);
|
||||
|
@ -37,10 +37,9 @@ const d3CurveTypes = {
|
||||
curveStepAfter: curveStepAfter,
|
||||
curveStepBefore: curveStepBefore,
|
||||
};
|
||||
const directive =
|
||||
/[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
||||
const directive = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
||||
const directiveWithoutOpen =
|
||||
/\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
|
||||
/\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
|
||||
|
||||
/**
|
||||
* Detects the init config object from the text
|
||||
@ -91,7 +90,7 @@ export const detectInit = function (text: string, config?: MermaidConfig): Merma
|
||||
if (results) {
|
||||
let type = detectType(text, config);
|
||||
['config'].forEach((prop) => {
|
||||
if (typeof results[prop] !== 'undefined') {
|
||||
if (results[prop] !== undefined) {
|
||||
if (type === 'flowchart-v2') {
|
||||
type = 'flowchart';
|
||||
}
|
||||
@ -180,8 +179,8 @@ export const detectDirective = function (
|
||||
* @returns The array index containing the substring or -1 if not present
|
||||
*/
|
||||
export const isSubstringInArray = function (str: string, arr: string[]): number {
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (arr[i].match(str)) {
|
||||
for (const [i, element] of arr.entries()) {
|
||||
if (element.match(str)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -460,13 +459,13 @@ export function getStylesFromArray(arr: string[]): { style: string; labelStyle:
|
||||
let style = '';
|
||||
let labelStyle = '';
|
||||
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (typeof arr[i] !== 'undefined') {
|
||||
for (const element of arr) {
|
||||
if (element !== undefined) {
|
||||
// add text properties to label style definition
|
||||
if (arr[i].startsWith('color:') || arr[i].startsWith('text-align:')) {
|
||||
labelStyle = labelStyle + arr[i] + ';';
|
||||
if (element.startsWith('color:') || element.startsWith('text-align:')) {
|
||||
labelStyle = labelStyle + element + ';';
|
||||
} else {
|
||||
style = style + arr[i] + ';';
|
||||
style = style + element + ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -549,7 +548,7 @@ export const drawSimpleText = function (
|
||||
textElem.style('font-size', textData.fontSize);
|
||||
textElem.style('font-weight', textData.fontWeight);
|
||||
textElem.attr('fill', textData.fill);
|
||||
if (typeof textData.class !== 'undefined') {
|
||||
if (textData.class !== undefined) {
|
||||
textElem.attr('class', textData.class);
|
||||
}
|
||||
|
||||
@ -630,7 +629,7 @@ const breakString: (
|
||||
{ fontSize: 12, fontWeight: 400, fontFamily: 'Arial', margin: 0 },
|
||||
config
|
||||
);
|
||||
const characters = word.split('');
|
||||
const characters = [...word];
|
||||
const lines: string[] = [];
|
||||
let currentLine = '';
|
||||
characters.forEach((character, index) => {
|
||||
@ -822,34 +821,34 @@ export const directiveSanitizer = (args: any) => {
|
||||
// This is an object
|
||||
Object.keys(args).forEach((key) => {
|
||||
log.debug('Checking key', key);
|
||||
if (key.indexOf('__') === 0) {
|
||||
if (key.startsWith('__')) {
|
||||
log.debug('sanitize deleting __ option', key);
|
||||
delete args[key];
|
||||
}
|
||||
|
||||
if (key.indexOf('proto') >= 0) {
|
||||
if (key.includes('proto')) {
|
||||
log.debug('sanitize deleting proto option', key);
|
||||
delete args[key];
|
||||
}
|
||||
|
||||
if (key.indexOf('constr') >= 0) {
|
||||
if (key.includes('constr')) {
|
||||
log.debug('sanitize deleting constr option', key);
|
||||
delete args[key];
|
||||
}
|
||||
|
||||
if (key.indexOf('themeCSS') >= 0) {
|
||||
if (key.includes('themeCSS')) {
|
||||
log.debug('sanitizing themeCss option');
|
||||
args[key] = sanitizeCss(args[key]);
|
||||
}
|
||||
if (key.indexOf('fontFamily') >= 0) {
|
||||
if (key.includes('fontFamily')) {
|
||||
log.debug('sanitizing fontFamily option');
|
||||
args[key] = sanitizeCss(args[key]);
|
||||
}
|
||||
if (key.indexOf('altFontFamily') >= 0) {
|
||||
if (key.includes('altFontFamily')) {
|
||||
log.debug('sanitizing altFontFamily option');
|
||||
args[key] = sanitizeCss(args[key]);
|
||||
}
|
||||
if (configKeys.indexOf(key) < 0) {
|
||||
if (!configKeys.includes(key)) {
|
||||
log.debug('sanitize deleting option', key);
|
||||
delete args[key];
|
||||
} else {
|
||||
@ -863,10 +862,9 @@ export const directiveSanitizer = (args: any) => {
|
||||
}
|
||||
if (args.themeVariables) {
|
||||
const kArr = Object.keys(args.themeVariables);
|
||||
for (let i = 0; i < kArr.length; i++) {
|
||||
const k = kArr[i];
|
||||
for (const k of kArr) {
|
||||
const val = args.themeVariables[k];
|
||||
if (val && val.match && !val.match(/^[a-zA-Z0-9#,";()%. ]+$/)) {
|
||||
if (val && val.match && !val.match(/^[\d "#%(),.;A-Za-z]+$/)) {
|
||||
args.themeVariables[k] = '';
|
||||
}
|
||||
}
|
||||
@ -877,13 +875,13 @@ export const sanitizeCss = (str) => {
|
||||
let startCnt = 0;
|
||||
let endCnt = 0;
|
||||
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
for (const element of str) {
|
||||
if (startCnt < endCnt) {
|
||||
return '{ /* ERROR: Unbalanced CSS */ }';
|
||||
}
|
||||
if (str[i] === '{') {
|
||||
if (element === '{') {
|
||||
startCnt++;
|
||||
} else if (str[i] === '}') {
|
||||
} else if (element === '}') {
|
||||
endCnt++;
|
||||
}
|
||||
}
|
||||
|
484
pnpm-lock.yaml
generated
484
pnpm-lock.yaml
generated
@ -51,7 +51,7 @@ importers:
|
||||
version: 5.42.1_rmayb2veg2btbq6mbmnyivgasy
|
||||
'@vitest/coverage-c8':
|
||||
specifier: ^0.25.1
|
||||
version: 0.25.1_iyb77cyw3lw7duusvxyjdsflhu
|
||||
version: 0.25.1_oullksb5ic6y72oh2wekoaiuii
|
||||
'@vitest/ui':
|
||||
specifier: ^0.25.1
|
||||
version: 0.25.1
|
||||
@ -115,9 +115,6 @@ importers:
|
||||
husky:
|
||||
specifier: ^8.0.2
|
||||
version: 8.0.2
|
||||
identity-obj-proxy:
|
||||
specifier: ^3.0.0
|
||||
version: 3.0.0
|
||||
jest:
|
||||
specifier: ^29.3.1
|
||||
version: 29.3.1_odkjkoia5xunhxkdrka32ib6vi
|
||||
@ -150,7 +147,7 @@ importers:
|
||||
version: 3.0.2
|
||||
rollup-plugin-visualizer:
|
||||
specifier: ^5.8.3
|
||||
version: 5.8.3_rollup@2.79.1
|
||||
version: 5.8.3
|
||||
start-server-and-test:
|
||||
specifier: ^1.14.0
|
||||
version: 1.14.0
|
||||
@ -163,18 +160,9 @@ importers:
|
||||
vite:
|
||||
specifier: ^3.2.3
|
||||
version: 3.2.3_@types+node@18.11.9
|
||||
vitepress:
|
||||
specifier: ^1.0.0-alpha.28
|
||||
version: 1.0.0-alpha.28_ysryt2e75uhznkanan6iyjk4mi
|
||||
vitepress-plugin-mermaid:
|
||||
specifier: ^2.0.8
|
||||
version: 2.0.8_2q5vfj2vm6nj3r62ddjdsi7aoe
|
||||
vitepress-plugin-search:
|
||||
specifier: ^1.0.4-alpha.15
|
||||
version: 1.0.4-alpha.15_s3edpouswd4dgoi2en7bdlrp54
|
||||
vitest:
|
||||
specifier: ^0.25.3
|
||||
version: 0.25.3_iyb77cyw3lw7duusvxyjdsflhu
|
||||
version: 0.25.3_oullksb5ic6y72oh2wekoaiuii
|
||||
|
||||
packages/mermaid:
|
||||
dependencies:
|
||||
@ -190,9 +178,6 @@ importers:
|
||||
dompurify:
|
||||
specifier: 2.4.1
|
||||
version: 2.4.1
|
||||
fast-clone:
|
||||
specifier: ^1.5.13
|
||||
version: 1.5.13
|
||||
khroma:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
@ -257,9 +242,6 @@ importers:
|
||||
globby:
|
||||
specifier: ^13.1.2
|
||||
version: 13.1.2
|
||||
identity-obj-proxy:
|
||||
specifier: ^3.0.0
|
||||
version: 3.0.0
|
||||
jison:
|
||||
specifier: ^0.4.18
|
||||
version: 0.4.18
|
||||
@ -302,6 +284,12 @@ importers:
|
||||
unist-util-flatmap:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
vitepress:
|
||||
specifier: ^1.0.0-alpha.28
|
||||
version: 1.0.0-alpha.28_tbpndr44ulefs3hehwpi2mkf2y
|
||||
vitepress-plugin-search:
|
||||
specifier: ^1.0.4-alpha.15
|
||||
version: 1.0.4-alpha.15_s3edpouswd4dgoi2en7bdlrp54
|
||||
|
||||
packages/mermaid-example-diagram:
|
||||
devDependencies:
|
||||
@ -2110,14 +2098,6 @@ packages:
|
||||
resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==}
|
||||
dev: true
|
||||
|
||||
/@rollup/pluginutils/4.2.1:
|
||||
resolution: {integrity: sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ==}
|
||||
engines: {node: '>= 8.0.0'}
|
||||
dependencies:
|
||||
estree-walker: 2.0.2
|
||||
picomatch: 2.3.1
|
||||
dev: true
|
||||
|
||||
/@sideway/address/4.1.4:
|
||||
resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==}
|
||||
dependencies:
|
||||
@ -2251,12 +2231,6 @@ packages:
|
||||
resolution: {integrity: sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g==}
|
||||
dev: true
|
||||
|
||||
/@types/concat-stream/1.6.1:
|
||||
resolution: {integrity: sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.9
|
||||
dev: true
|
||||
|
||||
/@types/connect-history-api-fallback/1.3.5:
|
||||
resolution: {integrity: sha512-h8QJa8xSb1WD4fpKBDcATDNGXghFj6/3GRWG6dhmRcu0RX1Ubasur2Uvx5aeEwlf0MwblEC2bMzzMQntxnw/Cw==}
|
||||
dependencies:
|
||||
@ -2504,12 +2478,6 @@ packages:
|
||||
resolution: {integrity: sha512-HXwADeHEP4exXkCIwy2n1+i0f1ilP1ETQOH5KDOugjkTFZPntWo0Gr8stZOaebkxsdx+k0X/K6obU/+it07ocg==}
|
||||
dev: true
|
||||
|
||||
/@types/form-data/0.0.33:
|
||||
resolution: {integrity: sha512-8BSvG1kGm83cyJITQMZSulnl6QV8jqAGreJsc5tPu1Jq0vTSOiY/k24Wx82JRpWwZSqrala6sd5rWi6aNXvqcw==}
|
||||
dependencies:
|
||||
'@types/node': 18.11.9
|
||||
dev: true
|
||||
|
||||
/@types/geojson/7946.0.10:
|
||||
resolution: {integrity: sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==}
|
||||
dev: true
|
||||
@ -2624,10 +2592,6 @@ packages:
|
||||
form-data: 3.0.1
|
||||
dev: true
|
||||
|
||||
/@types/node/10.17.60:
|
||||
resolution: {integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==}
|
||||
dev: true
|
||||
|
||||
/@types/node/14.18.29:
|
||||
resolution: {integrity: sha512-LhF+9fbIX4iPzhsRLpK5H7iPdvW8L4IwGciXQIOEcuF62+9nw/VQVsOViAOOGxY3OlOKGLFv0sWwJXdwQeTn6A==}
|
||||
dev: true
|
||||
@ -2640,10 +2604,6 @@ packages:
|
||||
resolution: {integrity: sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==}
|
||||
dev: true
|
||||
|
||||
/@types/node/8.10.66:
|
||||
resolution: {integrity: sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==}
|
||||
dev: true
|
||||
|
||||
/@types/normalize-package-data/2.4.1:
|
||||
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
|
||||
dev: true
|
||||
@ -2900,15 +2860,15 @@ packages:
|
||||
vite: ^3.0.0
|
||||
vue: ^3.2.25
|
||||
dependencies:
|
||||
vite: 3.2.3_@types+node@18.11.9
|
||||
vite: 3.2.3
|
||||
vue: 3.2.41
|
||||
dev: true
|
||||
|
||||
/@vitest/coverage-c8/0.25.1_iyb77cyw3lw7duusvxyjdsflhu:
|
||||
/@vitest/coverage-c8/0.25.1_oullksb5ic6y72oh2wekoaiuii:
|
||||
resolution: {integrity: sha512-gpl5QNaNeIN0mfRiosCqBFoZcizb5GA458TDnOQXkGDc4kklazxn70u9evGfV62wiiAUfGGebgRhxlBkAa6m6g==}
|
||||
dependencies:
|
||||
c8: 7.12.0
|
||||
vitest: 0.25.1_iyb77cyw3lw7duusvxyjdsflhu
|
||||
vitest: 0.25.1_oullksb5ic6y72oh2wekoaiuii
|
||||
transitivePeerDependencies:
|
||||
- '@edge-runtime/vm'
|
||||
- '@vitest/browser'
|
||||
@ -3230,55 +3190,6 @@ packages:
|
||||
resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==}
|
||||
dev: true
|
||||
|
||||
/@yankeeinlondon/builder-api/0.4.1_dsigm6qpqe3mljd7p5w42sooza:
|
||||
resolution: {integrity: sha512-O6LS9Zg4xqLVpAgea72mNhZvdy9B2BuIgNdsRvNkmnACG8XvlZtEKryGt2ECI/z+dbQICbHDQFCNtZRBrfSMlA==}
|
||||
peerDependencies:
|
||||
fp-ts: ^2.12.1
|
||||
inferred-types: ^0.22.0
|
||||
markdown-it: ^13.0.1
|
||||
vite-plugin-md: '*'
|
||||
dependencies:
|
||||
'@yankeeinlondon/happy-wrapper': 2.6.0_iyb77cyw3lw7duusvxyjdsflhu
|
||||
fp-ts: 2.13.1
|
||||
inferred-types: 0.22.8_iyb77cyw3lw7duusvxyjdsflhu
|
||||
markdown-it: 13.0.1
|
||||
vite-plugin-md: 0.20.4_ssclijsxphu2vue5hnv6ywl23u
|
||||
transitivePeerDependencies:
|
||||
- '@edge-runtime/vm'
|
||||
- '@vitest/browser'
|
||||
- '@vitest/ui'
|
||||
- c8
|
||||
- happy-dom
|
||||
- jsdom
|
||||
- less
|
||||
- sass
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/@yankeeinlondon/happy-wrapper/2.6.0_iyb77cyw3lw7duusvxyjdsflhu:
|
||||
resolution: {integrity: sha512-az+gEjG4Jl4GbM35ID5pn4v7FwfrgeA1br/B9STXlDLvIsV8q7mCxQ1oYa8bR1iHtNQg7kgW6s9DYheaTemrHQ==}
|
||||
peerDependencies:
|
||||
happy-dom: ^6.0.4
|
||||
dependencies:
|
||||
happy-dom: 6.0.4
|
||||
native-dash: 1.23.2_iyb77cyw3lw7duusvxyjdsflhu
|
||||
transitivePeerDependencies:
|
||||
- '@edge-runtime/vm'
|
||||
- '@vitest/browser'
|
||||
- '@vitest/ui'
|
||||
- c8
|
||||
- jsdom
|
||||
- less
|
||||
- sass
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/JSONSelect/0.4.0:
|
||||
resolution: {integrity: sha512-VRLR3Su35MH+XV2lrvh9O7qWoug/TUyj9tLDjn9rtpUCNnILLrHjgd/tB0KrhugCxUpj3UqoLqfYb3fLJdIQQQ==}
|
||||
engines: {node: '>=0.4.7'}
|
||||
@ -3576,10 +3487,6 @@ packages:
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/asap/2.0.6:
|
||||
resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==}
|
||||
dev: true
|
||||
|
||||
/asn1/0.2.6:
|
||||
resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==}
|
||||
dependencies:
|
||||
@ -3631,7 +3538,7 @@ packages:
|
||||
/axios/0.21.4_debug@4.3.2:
|
||||
resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==}
|
||||
dependencies:
|
||||
follow-redirects: 1.15.2
|
||||
follow-redirects: 1.15.2_debug@4.3.2
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: true
|
||||
@ -3800,29 +3707,6 @@ packages:
|
||||
fill-range: 7.0.1
|
||||
dev: true
|
||||
|
||||
/brilliant-errors/0.6.0_iyb77cyw3lw7duusvxyjdsflhu:
|
||||
resolution: {integrity: sha512-4+Va/hdXk7tROAmnZ8Vp9D23oOMg6IBJAiZdhRCufMApH0NIFLsvtTb7sL8YuV6gWdLsiXxzR834bh05lC8r8Q==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
dependencies:
|
||||
callsites: 3.1.0
|
||||
common-types: 1.31.1
|
||||
inferred-types: 0.22.8_iyb77cyw3lw7duusvxyjdsflhu
|
||||
vitest: 0.19.1_iyb77cyw3lw7duusvxyjdsflhu
|
||||
transitivePeerDependencies:
|
||||
- '@edge-runtime/vm'
|
||||
- '@vitest/browser'
|
||||
- '@vitest/ui'
|
||||
- c8
|
||||
- happy-dom
|
||||
- jsdom
|
||||
- less
|
||||
- sass
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/browser-process-hrtime/1.0.0:
|
||||
resolution: {integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==}
|
||||
dev: true
|
||||
@ -4235,10 +4119,6 @@ packages:
|
||||
engines: {node: '>=4.0.0'}
|
||||
dev: true
|
||||
|
||||
/common-types/1.31.1:
|
||||
resolution: {integrity: sha512-eixAd22Gmek1dgsPgyqCSjzMAlp8rpSLkb44iEMfOzR9fwGFYEkH+AWOHmwSFxWmO8MvMND/m1jpZX0Wk4+yJA==}
|
||||
dev: true
|
||||
|
||||
/compare-func/2.0.0:
|
||||
resolution: {integrity: sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==}
|
||||
dependencies:
|
||||
@ -4272,16 +4152,6 @@ packages:
|
||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||
dev: true
|
||||
|
||||
/concat-stream/1.6.2:
|
||||
resolution: {integrity: sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==}
|
||||
engines: {'0': node >= 0.8}
|
||||
dependencies:
|
||||
buffer-from: 1.1.2
|
||||
inherits: 2.0.4
|
||||
readable-stream: 2.3.7
|
||||
typedarray: 0.0.6
|
||||
dev: true
|
||||
|
||||
/concurrently/7.5.0:
|
||||
resolution: {integrity: sha512-5E3mwiS+i2JYBzr5BpXkFxOnleZTMsG+WnE/dCG4/P+oiVXrbmrBwJ2ozn4SxwB2EZDrKR568X+puVohxz3/Mg==}
|
||||
engines: {node: ^12.20.0 || ^14.13.0 || >=16.0.0}
|
||||
@ -4669,10 +4539,6 @@ packages:
|
||||
source-map: 0.6.1
|
||||
dev: true
|
||||
|
||||
/css.escape/1.5.1:
|
||||
resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==}
|
||||
dev: true
|
||||
|
||||
/cssom/0.3.8:
|
||||
resolution: {integrity: sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==}
|
||||
dev: true
|
||||
@ -6135,13 +6001,6 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/extend-shallow/2.0.1:
|
||||
resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dependencies:
|
||||
is-extendable: 0.1.1
|
||||
dev: true
|
||||
|
||||
/extend/3.0.2:
|
||||
resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
|
||||
dev: true
|
||||
@ -6165,10 +6024,6 @@ packages:
|
||||
engines: {'0': node >=0.6.0}
|
||||
dev: true
|
||||
|
||||
/fast-clone/1.5.13:
|
||||
resolution: {integrity: sha512-0ez7coyFBQFjZtId+RJqJ+EQs61w9xARfqjqK0AD9vIUkSxWD4HvPt80+5evebZ1tTnv1GYKrPTipx7kOW5ipA==}
|
||||
dev: false
|
||||
|
||||
/fast-deep-equal/3.1.3:
|
||||
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
|
||||
dev: true
|
||||
@ -6316,6 +6171,18 @@ packages:
|
||||
optional: true
|
||||
dev: true
|
||||
|
||||
/follow-redirects/1.15.2_debug@4.3.2:
|
||||
resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==}
|
||||
engines: {node: '>=4.0'}
|
||||
peerDependencies:
|
||||
debug: '*'
|
||||
peerDependenciesMeta:
|
||||
debug:
|
||||
optional: true
|
||||
dependencies:
|
||||
debug: 4.3.2
|
||||
dev: true
|
||||
|
||||
/foreground-child/2.0.0:
|
||||
resolution: {integrity: sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
@ -6360,10 +6227,6 @@ packages:
|
||||
engines: {node: '>= 0.6'}
|
||||
dev: true
|
||||
|
||||
/fp-ts/2.13.1:
|
||||
resolution: {integrity: sha512-0eu5ULPS2c/jsa1lGFneEFFEdTbembJv8e4QKXeVJ3lm/5hyve06dlKZrpxmMwJt6rYen7sxmHHK2CLaXvWuWQ==}
|
||||
dev: true
|
||||
|
||||
/fresh/0.5.2:
|
||||
resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@ -6470,11 +6333,6 @@ packages:
|
||||
engines: {node: '>=8.0.0'}
|
||||
dev: true
|
||||
|
||||
/get-port/3.2.0:
|
||||
resolution: {integrity: sha512-x5UJKlgeUiNT8nyo/AcnwLnZuZNcSjSw0kogRB+Whd1fjjFq4B1hySFxSFWWSn4mIBzg3sRNUDFYc4g5gjPoLg==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/get-stdin/5.0.1:
|
||||
resolution: {integrity: sha512-jZV7n6jGE3Gt7fgSTJoz91Ak5MuTLwMwkoYdjxuJ/AmjIsE1UC03y/IWkZCQGEvVNS9qoRNwy5BCqxImv0FVeA==}
|
||||
engines: {node: '>=0.12.0'}
|
||||
@ -6660,16 +6518,6 @@ packages:
|
||||
resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==}
|
||||
dev: true
|
||||
|
||||
/gray-matter/4.0.3:
|
||||
resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==}
|
||||
engines: {node: '>=6.0'}
|
||||
dependencies:
|
||||
js-yaml: 3.14.1
|
||||
kind-of: 6.0.3
|
||||
section-matter: 1.0.0
|
||||
strip-bom-string: 1.0.0
|
||||
dev: true
|
||||
|
||||
/handle-thing/2.0.1:
|
||||
resolution: {integrity: sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==}
|
||||
dev: true
|
||||
@ -6687,20 +6535,6 @@ packages:
|
||||
uglify-js: 3.17.3
|
||||
dev: true
|
||||
|
||||
/happy-dom/6.0.4:
|
||||
resolution: {integrity: sha512-b+ID23Ms0BY08UNLymsOMG7EI2jSlwEt4cbJs938GZfeNAg+fqgkSO3TokQMgSOFoHznpjWmpVjBUL5boJ9PWw==}
|
||||
dependencies:
|
||||
css.escape: 1.5.1
|
||||
he: 1.2.0
|
||||
node-fetch: 2.6.7
|
||||
sync-request: 6.1.0
|
||||
webidl-conversions: 7.0.0
|
||||
whatwg-encoding: 2.0.0
|
||||
whatwg-mimetype: 3.0.0
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
dev: true
|
||||
|
||||
/har-schema/2.0.0:
|
||||
resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==}
|
||||
engines: {node: '>=4'}
|
||||
@ -6720,10 +6554,6 @@ packages:
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/harmony-reflect/1.6.2:
|
||||
resolution: {integrity: sha512-HIp/n38R9kQjDEziXyDTuW3vvoxxyxjxFzXLrBr18uB47GnSt+G9D29fqrpM5ZkspMcPICud3XsBJQ4Y2URg8g==}
|
||||
dev: true
|
||||
|
||||
/has-ansi/2.0.0:
|
||||
resolution: {integrity: sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -6758,11 +6588,6 @@ packages:
|
||||
function-bind: 1.1.1
|
||||
dev: true
|
||||
|
||||
/he/1.2.0:
|
||||
resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/heap/0.2.7:
|
||||
resolution: {integrity: sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==}
|
||||
dev: false
|
||||
@ -6811,16 +6636,6 @@ packages:
|
||||
entities: 4.4.0
|
||||
dev: true
|
||||
|
||||
/http-basic/8.1.3:
|
||||
resolution: {integrity: sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
dependencies:
|
||||
caseless: 0.12.0
|
||||
concat-stream: 1.6.2
|
||||
http-response-object: 3.0.2
|
||||
parse-cache-control: 1.0.1
|
||||
dev: true
|
||||
|
||||
/http-cache-semantics/4.1.0:
|
||||
resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==}
|
||||
dev: true
|
||||
@ -6906,12 +6721,6 @@ packages:
|
||||
- debug
|
||||
dev: true
|
||||
|
||||
/http-response-object/3.0.2:
|
||||
resolution: {integrity: sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==}
|
||||
dependencies:
|
||||
'@types/node': 10.17.60
|
||||
dev: true
|
||||
|
||||
/http-signature/1.2.0:
|
||||
resolution: {integrity: sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==}
|
||||
engines: {node: '>=0.8', npm: '>=1.3.7'}
|
||||
@ -6982,13 +6791,6 @@ packages:
|
||||
dependencies:
|
||||
safer-buffer: 2.1.2
|
||||
|
||||
/identity-obj-proxy/3.0.0:
|
||||
resolution: {integrity: sha512-00n6YnVHKrinT9t0d9+5yZC6UBNJANpYEQvL2LlX6Ab9lnmxzIRcEmTPuyGScvl1+jKuCICX1Z0Ab1pPKKdikA==}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
harmony-reflect: 1.6.2
|
||||
dev: true
|
||||
|
||||
/ieee754/1.2.1:
|
||||
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
|
||||
dev: true
|
||||
@ -7025,25 +6827,6 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/inferred-types/0.22.8_iyb77cyw3lw7duusvxyjdsflhu:
|
||||
resolution: {integrity: sha512-gs0zTE04eOBso5tFZPA2UoYiH9qMCqCJCUdH9K6P6cofqNkI1L5bx9QDE0XE0khJgLN7TmH+W0JhwBbnkdjzWQ==}
|
||||
dependencies:
|
||||
brilliant-errors: 0.6.0_iyb77cyw3lw7duusvxyjdsflhu
|
||||
transitivePeerDependencies:
|
||||
- '@edge-runtime/vm'
|
||||
- '@vitest/browser'
|
||||
- '@vitest/ui'
|
||||
- c8
|
||||
- happy-dom
|
||||
- jsdom
|
||||
- less
|
||||
- sass
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/inflight/1.0.6:
|
||||
resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
|
||||
dependencies:
|
||||
@ -7153,11 +6936,6 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/is-extendable/0.1.1:
|
||||
resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/is-extglob/2.1.1:
|
||||
resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -8748,26 +8526,6 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/native-dash/1.23.2_iyb77cyw3lw7duusvxyjdsflhu:
|
||||
resolution: {integrity: sha512-Ev5OPB5vDZ+HLj4MXfAwZRHJV/LJr2LHjsIr1UN7jZigMS2JRpF7Qy77t66GURhtzp7GSWLNSLeRwXOg1iwJkQ==}
|
||||
dependencies:
|
||||
brilliant-errors: 0.6.0_iyb77cyw3lw7duusvxyjdsflhu
|
||||
inferred-types: 0.22.8_iyb77cyw3lw7duusvxyjdsflhu
|
||||
transitivePeerDependencies:
|
||||
- '@edge-runtime/vm'
|
||||
- '@vitest/browser'
|
||||
- '@vitest/ui'
|
||||
- c8
|
||||
- happy-dom
|
||||
- jsdom
|
||||
- less
|
||||
- sass
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/natural-compare-lite/1.4.0:
|
||||
resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==}
|
||||
dev: true
|
||||
@ -9080,10 +8838,6 @@ packages:
|
||||
callsites: 3.1.0
|
||||
dev: true
|
||||
|
||||
/parse-cache-control/1.0.1:
|
||||
resolution: {integrity: sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==}
|
||||
dev: true
|
||||
|
||||
/parse-entities/2.0.0:
|
||||
resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==}
|
||||
dependencies:
|
||||
@ -9329,12 +9083,6 @@ packages:
|
||||
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
|
||||
dev: true
|
||||
|
||||
/promise/8.3.0:
|
||||
resolution: {integrity: sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg==}
|
||||
dependencies:
|
||||
asap: 2.0.6
|
||||
dev: true
|
||||
|
||||
/prompts/2.4.2:
|
||||
resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==}
|
||||
engines: {node: '>= 6'}
|
||||
@ -9723,7 +9471,7 @@ packages:
|
||||
resolution: {integrity: sha512-ndEIpszUHiG4HtDsQLeIuMvRsDnn8c8rYStabochtUeCvfuvNptb5TUbVD68LRAILPX7p9nqQGh4xJgn3EHS/g==}
|
||||
dev: false
|
||||
|
||||
/rollup-plugin-visualizer/5.8.3_rollup@2.79.1:
|
||||
/rollup-plugin-visualizer/5.8.3:
|
||||
resolution: {integrity: sha512-QGJk4Bqe4AOat5AjipOh8esZH1nck5X2KFpf4VytUdSUuuuSwvIQZjMGgjcxe/zXexltqaXp5Vx1V3LmnQH15Q==}
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
@ -9734,7 +9482,6 @@ packages:
|
||||
optional: true
|
||||
dependencies:
|
||||
open: 8.4.0
|
||||
rollup: 2.79.1
|
||||
source-map: 0.7.4
|
||||
yargs: 17.5.1
|
||||
dev: true
|
||||
@ -9820,14 +9567,6 @@ packages:
|
||||
ajv-keywords: 5.1.0_ajv@8.11.0
|
||||
dev: true
|
||||
|
||||
/section-matter/1.0.0:
|
||||
resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
extend-shallow: 2.0.1
|
||||
kind-of: 6.0.3
|
||||
dev: true
|
||||
|
||||
/select-hose/2.0.0:
|
||||
resolution: {integrity: sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==}
|
||||
dev: true
|
||||
@ -10305,11 +10044,6 @@ packages:
|
||||
ansi-regex: 6.0.1
|
||||
dev: true
|
||||
|
||||
/strip-bom-string/1.0.0:
|
||||
resolution: {integrity: sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/strip-bom/4.0.0:
|
||||
resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==}
|
||||
engines: {node: '>=8'}
|
||||
@ -10387,21 +10121,6 @@ packages:
|
||||
resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==}
|
||||
dev: true
|
||||
|
||||
/sync-request/6.1.0:
|
||||
resolution: {integrity: sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
dependencies:
|
||||
http-response-object: 3.0.2
|
||||
sync-rpc: 1.3.6
|
||||
then-request: 6.0.2
|
||||
dev: true
|
||||
|
||||
/sync-rpc/1.3.6:
|
||||
resolution: {integrity: sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw==}
|
||||
dependencies:
|
||||
get-port: 3.2.0
|
||||
dev: true
|
||||
|
||||
/tapable/2.2.1:
|
||||
resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==}
|
||||
engines: {node: '>=6'}
|
||||
@ -10468,23 +10187,6 @@ packages:
|
||||
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
|
||||
dev: true
|
||||
|
||||
/then-request/6.0.2:
|
||||
resolution: {integrity: sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
dependencies:
|
||||
'@types/concat-stream': 1.6.1
|
||||
'@types/form-data': 0.0.33
|
||||
'@types/node': 8.10.66
|
||||
'@types/qs': 6.9.7
|
||||
caseless: 0.12.0
|
||||
concat-stream: 1.6.2
|
||||
form-data: 2.3.3
|
||||
http-basic: 8.1.3
|
||||
http-response-object: 3.0.2
|
||||
promise: 8.3.0
|
||||
qs: 6.11.0
|
||||
dev: true
|
||||
|
||||
/throat/6.0.1:
|
||||
resolution: {integrity: sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w==}
|
||||
dev: true
|
||||
@ -10511,11 +10213,6 @@ packages:
|
||||
resolution: {integrity: sha512-hGYWYBMPr7p4g5IarQE7XhlyWveh1EKhy4wUBS1LrHXCKYgvz+4/jCqgmJqZxxldesn05vccrtME2RLLZNW7iA==}
|
||||
dev: true
|
||||
|
||||
/tinypool/0.2.4:
|
||||
resolution: {integrity: sha512-Vs3rhkUH6Qq1t5bqtb816oT+HeJTXfwt2cbPH17sWHIYKTotQIFPk3tf2fgqRrVyMDVOc1EnPgzIxfIulXVzwQ==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
dev: true
|
||||
|
||||
/tinypool/0.3.0:
|
||||
resolution: {integrity: sha512-NX5KeqHOBZU6Bc0xj9Vr5Szbb1j8tUHIeD18s41aDJaPeC5QTdEhK0SpdpUrZlj2nv5cctNcSjaKNanXlfcVEQ==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
@ -10750,10 +10447,6 @@ packages:
|
||||
is-typedarray: 1.0.0
|
||||
dev: true
|
||||
|
||||
/typedarray/0.0.6:
|
||||
resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
|
||||
dev: true
|
||||
|
||||
/typedoc-plugin-markdown/3.13.6_typedoc@0.23.18:
|
||||
resolution: {integrity: sha512-ISSc9v3BK7HkokxSBuJPttXox4tJ6hP0N9wfSIk0fmLN67+eqtAxbk97gs2nDiuha+RTO5eW9gdeAb+RPP0mgg==}
|
||||
peerDependencies:
|
||||
@ -10988,34 +10681,37 @@ packages:
|
||||
vfile-message: 3.1.2
|
||||
dev: true
|
||||
|
||||
/vite-plugin-md/0.20.4_ssclijsxphu2vue5hnv6ywl23u:
|
||||
resolution: {integrity: sha512-W3Z59/ROS2X6OIwPwV2PjE+QkfW0UVGxyf3Z2JR0OLqGJ+Iy2SGA503m/vmATJv+C3DjeU8Oy8diQx1R+IyRwQ==}
|
||||
/vite/3.2.3:
|
||||
resolution: {integrity: sha512-h8jl1TZ76eGs3o2dIBSsvXDLb1m/Ec1iej8ZMdz+PsaFUsftZeWe2CZOI3qogEsMNaywc17gu0q6cQDzh/weCQ==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@rollup/pluginutils': ^4.2.1
|
||||
rollup: ^2.77.0
|
||||
'@types/node': '>= 14'
|
||||
less: '*'
|
||||
sass: '*'
|
||||
stylus: '*'
|
||||
sugarss: '*'
|
||||
terser: ^5.4.0
|
||||
peerDependenciesMeta:
|
||||
'@types/node':
|
||||
optional: true
|
||||
less:
|
||||
optional: true
|
||||
sass:
|
||||
optional: true
|
||||
stylus:
|
||||
optional: true
|
||||
sugarss:
|
||||
optional: true
|
||||
terser:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 4.2.1
|
||||
'@yankeeinlondon/builder-api': 0.4.1_dsigm6qpqe3mljd7p5w42sooza
|
||||
'@yankeeinlondon/happy-wrapper': 2.6.0_iyb77cyw3lw7duusvxyjdsflhu
|
||||
gray-matter: 4.0.3
|
||||
markdown-it: 13.0.1
|
||||
esbuild: 0.15.13
|
||||
postcss: 8.4.18
|
||||
resolve: 1.22.1
|
||||
rollup: 2.79.1
|
||||
source-map-js: 1.0.2
|
||||
transitivePeerDependencies:
|
||||
- '@edge-runtime/vm'
|
||||
- '@vitest/browser'
|
||||
- '@vitest/ui'
|
||||
- c8
|
||||
- fp-ts
|
||||
- happy-dom
|
||||
- inferred-types
|
||||
- jsdom
|
||||
- less
|
||||
- sass
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
dev: true
|
||||
|
||||
/vite/3.2.3_@types+node@18.11.9:
|
||||
@ -11052,18 +10748,6 @@ packages:
|
||||
fsevents: 2.3.2
|
||||
dev: true
|
||||
|
||||
/vitepress-plugin-mermaid/2.0.8_2q5vfj2vm6nj3r62ddjdsi7aoe:
|
||||
resolution: {integrity: sha512-ywWxTeg9kMv7ZPf/igCBF4ZHhWZAyRtbPnA12ICQuNK2AMp7r5IHOfnuX1EJQf8gNdsh8bcvvSvm8Ll92fdOTw==}
|
||||
peerDependencies:
|
||||
mermaid: ^8.0.0 || ^9.0.0
|
||||
vite-plugin-md: ^0.20.4
|
||||
vitepress: ^0.21.6 || ^1.0.0 || ^1.0.0-alpha
|
||||
dependencies:
|
||||
mermaid: link:packages/mermaid
|
||||
vite-plugin-md: 0.20.4_ssclijsxphu2vue5hnv6ywl23u
|
||||
vitepress: 1.0.0-alpha.28_ysryt2e75uhznkanan6iyjk4mi
|
||||
dev: true
|
||||
|
||||
/vitepress-plugin-search/1.0.4-alpha.15_s3edpouswd4dgoi2en7bdlrp54:
|
||||
resolution: {integrity: sha512-Ef/VkhTVYlECVI0H9Ck6745UNPfYFppAqnlxVSMJXdxP2vjOZ5TYNczlTTQ2p9dh16MFw/IurbL1/GrG4nXdNw==}
|
||||
engines: {node: ^14.13.1 || ^16.7.0 || >=18}
|
||||
@ -11077,12 +10761,12 @@ packages:
|
||||
'@types/markdown-it': 12.2.3
|
||||
flexsearch: 0.7.31
|
||||
markdown-it: 13.0.1
|
||||
vite: 3.2.3_@types+node@18.11.9
|
||||
vitepress: 1.0.0-alpha.28_ysryt2e75uhznkanan6iyjk4mi
|
||||
vite: 3.2.3
|
||||
vitepress: 1.0.0-alpha.28_tbpndr44ulefs3hehwpi2mkf2y
|
||||
vue: 3.2.41
|
||||
dev: true
|
||||
|
||||
/vitepress/1.0.0-alpha.28_ysryt2e75uhznkanan6iyjk4mi:
|
||||
/vitepress/1.0.0-alpha.28_tbpndr44ulefs3hehwpi2mkf2y:
|
||||
resolution: {integrity: sha512-pvbLssDMgLUN1terajmPlFBxHSDGO4DqwexKbjFyr7LeELerVuwGrG6F2J1hxmwOlbpLd1kHXEDqGm9JX/kTDQ==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
@ -11093,7 +10777,7 @@ packages:
|
||||
'@vueuse/core': 9.4.0_vue@3.2.41
|
||||
body-scroll-lock: 4.0.0-beta.0
|
||||
shiki: 0.11.1
|
||||
vite: 3.2.3_@types+node@18.11.9
|
||||
vite: 3.2.3
|
||||
vue: 3.2.41
|
||||
transitivePeerDependencies:
|
||||
- '@algolia/client-search'
|
||||
@ -11109,53 +10793,7 @@ packages:
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/vitest/0.19.1_iyb77cyw3lw7duusvxyjdsflhu:
|
||||
resolution: {integrity: sha512-E/ZXpFMUahn731wzhMBNzWRp4mGgiZFT0xdHa32cbNO0CSaHpE9hTfteEU247Gi2Dula8uXo5vvrNB6dtszmQA==}
|
||||
engines: {node: '>=v14.16.0'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@edge-runtime/vm': '*'
|
||||
'@vitest/browser': '*'
|
||||
'@vitest/ui': '*'
|
||||
c8: '*'
|
||||
happy-dom: '*'
|
||||
jsdom: '*'
|
||||
peerDependenciesMeta:
|
||||
'@edge-runtime/vm':
|
||||
optional: true
|
||||
'@vitest/browser':
|
||||
optional: true
|
||||
'@vitest/ui':
|
||||
optional: true
|
||||
c8:
|
||||
optional: true
|
||||
happy-dom:
|
||||
optional: true
|
||||
jsdom:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@types/chai': 4.3.3
|
||||
'@types/chai-subset': 1.3.3
|
||||
'@types/node': 18.11.9
|
||||
'@vitest/ui': 0.25.1
|
||||
chai: 4.3.6
|
||||
debug: 4.3.4
|
||||
happy-dom: 6.0.4
|
||||
jsdom: 20.0.2
|
||||
local-pkg: 0.4.2
|
||||
tinypool: 0.2.4
|
||||
tinyspy: 1.0.2
|
||||
vite: 3.2.3_@types+node@18.11.9
|
||||
transitivePeerDependencies:
|
||||
- less
|
||||
- sass
|
||||
- stylus
|
||||
- sugarss
|
||||
- supports-color
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/vitest/0.25.1_iyb77cyw3lw7duusvxyjdsflhu:
|
||||
/vitest/0.25.1_oullksb5ic6y72oh2wekoaiuii:
|
||||
resolution: {integrity: sha512-eH74h6MkuEgsqR4mAQZeMK9O0PROiKY+i+1GMz/fBi5A3L2ml5U7JQs7LfPU7+uWUziZyLHagl+rkyfR8SLhlA==}
|
||||
engines: {node: '>=v14.16.0'}
|
||||
hasBin: true
|
||||
@ -11185,7 +10823,6 @@ packages:
|
||||
acorn-walk: 8.2.0
|
||||
chai: 4.3.6
|
||||
debug: 4.3.4
|
||||
happy-dom: 6.0.4
|
||||
jsdom: 20.0.2
|
||||
local-pkg: 0.4.2
|
||||
source-map: 0.6.1
|
||||
@ -11203,7 +10840,7 @@ packages:
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/vitest/0.25.3_iyb77cyw3lw7duusvxyjdsflhu:
|
||||
/vitest/0.25.3_oullksb5ic6y72oh2wekoaiuii:
|
||||
resolution: {integrity: sha512-/UzHfXIKsELZhL7OaM2xFlRF8HRZgAHtPctacvNK8H4vOcbJJAMEgbWNGSAK7Y9b1NBe5SeM7VTuz2RsTHFJJA==}
|
||||
engines: {node: '>=v14.16.0'}
|
||||
hasBin: true
|
||||
@ -11233,7 +10870,6 @@ packages:
|
||||
acorn-walk: 8.2.0
|
||||
chai: 4.3.6
|
||||
debug: 4.3.4
|
||||
happy-dom: 6.0.4
|
||||
jsdom: 20.0.2
|
||||
local-pkg: 0.4.2
|
||||
source-map: 0.6.1
|
||||
|
@ -28,7 +28,7 @@ const lint = async (file: string): Promise<boolean> => {
|
||||
dot: true,
|
||||
});
|
||||
const lintResults = await Promise.all(jisonFiles.map(lint));
|
||||
if (lintResults.some((result) => result === false)) {
|
||||
if (lintResults.includes(false)) {
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
|
Loading…
x
Reference in New Issue
Block a user