mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-12 11:59:39 +02:00
Compare commits
2 Commits
6638-seque
...
antler_lar
Author | SHA1 | Date | |
---|---|---|---|
![]() |
baf491fde9 | ||
![]() |
dc7eaa925f |
@@ -33,11 +33,6 @@ export const packageOptions = {
|
|||||||
packageName: 'mermaid-layout-elk',
|
packageName: 'mermaid-layout-elk',
|
||||||
file: 'layouts.ts',
|
file: 'layouts.ts',
|
||||||
},
|
},
|
||||||
'mermaid-layout-tidy-tree': {
|
|
||||||
name: 'mermaid-layout-tidy-tree',
|
|
||||||
packageName: 'mermaid-layout-tidy-tree',
|
|
||||||
file: 'index.ts',
|
|
||||||
},
|
|
||||||
examples: {
|
examples: {
|
||||||
name: 'mermaid-examples',
|
name: 'mermaid-examples',
|
||||||
packageName: 'examples',
|
packageName: 'examples',
|
||||||
|
5
.changeset/beige-peas-shave.md
Normal file
5
.changeset/beige-peas-shave.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'@mermaid-js/mermaid-zenuml': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed a critical bug that the ZenUML diagram is not rendered.
|
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fix: Render newlines as spaces in class diagrams
|
|
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fix: Handle arrows correctly when auto number is enabled
|
|
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
Add IDs in architecture diagrams
|
|
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fix: Ensure edge label color is applied when using classDef with edge IDs
|
|
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
feat: Added support for new participant types (`actor`, `boundary`, `control`, `entity`, `database`, `collections`, `queue`) in `sequenceDiagram`.
|
|
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': minor
|
|
||||||
'@mermaid-js/layout-tidy-tree': minor
|
|
||||||
'@mermaid-js/layout-elk': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
feat: Update mindmap rendering to support multiple layouts, improved edge intersections, and new shapes
|
|
5
.changeset/large-mirrors-cheer.md
Normal file
5
.changeset/large-mirrors-cheer.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: Update casing of ID in requirement diagram
|
5
.changeset/lemon-masks-unite.md
Normal file
5
.changeset/lemon-masks-unite.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
feat: Added support for per link curve styling in flowchart diagram using edge ids
|
5
.changeset/light-flowers-judge.md
Normal file
5
.changeset/light-flowers-judge.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: Make flowchart elk detector regex match less greedy
|
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
feat: Add half-arrowheads (solid & stick) and central connection support
|
|
8
.changeset/lovely-queens-own.md
Normal file
8
.changeset/lovely-queens-own.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(block): overflowing blocks no longer affect later lines
|
||||||
|
|
||||||
|
This may change the layout of block diagrams that have overflowing lines
|
||||||
|
(i.e. block diagrams that use up more columns that the `columns` specifier).
|
7
.changeset/ninety-roses-turn.md
Normal file
7
.changeset/ninety-roses-turn.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: log warning for blocks exceeding column width
|
||||||
|
|
||||||
|
This update adds a validation check that logs a warning message when a block's width exceeds the defined column layout.
|
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': minor
|
|
||||||
---
|
|
||||||
|
|
||||||
feat: Add IDs in architecture diagrams
|
|
@@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
'mermaid': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
chore: revert marked dependency from ^15.0.7 to ^16.0.0
|
|
||||||
|
|
||||||
- Reverted marked package version to ^16.0.0 for better compatibility
|
|
||||||
- This is a dependency update that maintains API compatibility
|
|
||||||
- All tests pass with the updated version
|
|
5
.changeset/silver-eyes-build.md
Normal file
5
.changeset/silver-eyes-build.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore: migrate to class-based ArchitectureDB implementation
|
5
.changeset/smart-humans-cover.md
Normal file
5
.changeset/smart-humans-cover.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: Update flowchart direction TD's behavior to be the same as TB
|
5
.changeset/vast-buses-see.md
Normal file
5
.changeset/vast-buses-see.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'mermaid': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore: Update packet diagram to use new class-based database structure
|
@@ -2,7 +2,6 @@
|
|||||||
Ashish Jain
|
Ashish Jain
|
||||||
cpettitt
|
cpettitt
|
||||||
Dong Cai
|
Dong Cai
|
||||||
fourcube
|
|
||||||
knsv
|
knsv
|
||||||
Knut Sveidqvist
|
Knut Sveidqvist
|
||||||
Nikolay Rozhkov
|
Nikolay Rozhkov
|
||||||
|
@@ -5,10 +5,8 @@ bmatrix
|
|||||||
braintree
|
braintree
|
||||||
catmull
|
catmull
|
||||||
compositTitleSize
|
compositTitleSize
|
||||||
cose
|
|
||||||
curv
|
curv
|
||||||
doublecircle
|
doublecircle
|
||||||
elem
|
|
||||||
elems
|
elems
|
||||||
gantt
|
gantt
|
||||||
gitgraph
|
gitgraph
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
BRANDES
|
BRANDES
|
||||||
Buzan
|
|
||||||
circo
|
circo
|
||||||
handDrawn
|
handDrawn
|
||||||
KOEPF
|
KOEPF
|
||||||
|
@@ -37,6 +37,17 @@ const buildOptions = (override: BuildOptions): BuildOptions => {
|
|||||||
outdir: 'dist',
|
outdir: 'dist',
|
||||||
plugins: [jisonPlugin, jsonSchemaPlugin],
|
plugins: [jisonPlugin, jsonSchemaPlugin],
|
||||||
sourcemap: 'external',
|
sourcemap: 'external',
|
||||||
|
// Add Node.js polyfills for ANTLR4TS
|
||||||
|
define: {
|
||||||
|
'process.env.NODE_ENV': '"production"',
|
||||||
|
global: 'globalThis',
|
||||||
|
},
|
||||||
|
inject: [],
|
||||||
|
// Polyfill Node.js modules for browser
|
||||||
|
alias: {
|
||||||
|
assert: 'assert',
|
||||||
|
util: 'util',
|
||||||
|
},
|
||||||
...override,
|
...override,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
1
.github/lychee.toml
vendored
1
.github/lychee.toml
vendored
@@ -59,7 +59,6 @@ exclude = [
|
|||||||
"https://huehive.co",
|
"https://huehive.co",
|
||||||
"https://foswiki.org",
|
"https://foswiki.org",
|
||||||
"https://www.gnu.org",
|
"https://www.gnu.org",
|
||||||
"https://redmine.org",
|
|
||||||
"https://mermaid-preview.com"
|
"https://mermaid-preview.com"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
3
.github/workflows/e2e-applitools.yml
vendored
3
.github/workflows/e2e-applitools.yml
vendored
@@ -23,6 +23,9 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
e2e-applitools:
|
e2e-applitools:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: cypress/browsers:node-20.11.0-chrome-121.0.6167.85-1-ff-120.0-edge-121.0.2277.83-1
|
||||||
|
options: --user 1001
|
||||||
steps:
|
steps:
|
||||||
- if: ${{ ! env.USE_APPLI }}
|
- if: ${{ ! env.USE_APPLI }}
|
||||||
name: Warn if not using Applitools
|
name: Warn if not using Applitools
|
||||||
|
2
.github/workflows/e2e-timings.yml
vendored
2
.github/workflows/e2e-timings.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
|||||||
echo "EOF" >> $GITHUB_OUTPUT
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Commit and create pull request
|
- name: Commit and create pull request
|
||||||
uses: peter-evans/create-pull-request@18e469570b1cf0dfc11d60ec121099f8ff3e617a
|
uses: peter-evans/create-pull-request@07cbaebb4bfc9c5d7db426ea5a5f585df29dd0a0
|
||||||
with:
|
with:
|
||||||
add-paths: |
|
add-paths: |
|
||||||
cypress/timings.json
|
cypress/timings.json
|
||||||
|
2
.github/workflows/validate-lockfile.yml
vendored
2
.github/workflows/validate-lockfile.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
|||||||
|
|
||||||
# 2) No unwanted vitepress paths
|
# 2) No unwanted vitepress paths
|
||||||
if grep -qF 'packages/mermaid/src/vitepress' pnpm-lock.yaml; then
|
if grep -qF 'packages/mermaid/src/vitepress' pnpm-lock.yaml; then
|
||||||
issues+=("• Disallowed path 'packages/mermaid/src/vitepress' present. Run \`rm -rf packages/mermaid/src/vitepress && pnpm install\` to regenerate.")
|
issues+=("• Disallowed path 'packages/mermaid/src/vitepress' present. Run `rm -rf packages/mermaid/src/vitepress && pnpm install` to regenerate.")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 3) Lockfile only changes when package.json changes
|
# 3) Lockfile only changes when package.json changes
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,7 +4,6 @@ node_modules/
|
|||||||
coverage/
|
coverage/
|
||||||
.idea/
|
.idea/
|
||||||
.pnpm-store/
|
.pnpm-store/
|
||||||
.instructions/
|
|
||||||
|
|
||||||
dist
|
dist
|
||||||
v8-compile-cache-0
|
v8-compile-cache-0
|
||||||
|
@@ -14,7 +14,7 @@ interface CodeObject {
|
|||||||
mermaid: CypressMermaidConfig;
|
mermaid: CypressMermaidConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const utf8ToB64 = (str: string): string => {
|
const utf8ToB64 = (str: string): string => {
|
||||||
return Buffer.from(decodeURIComponent(encodeURIComponent(str))).toString('base64');
|
return Buffer.from(decodeURIComponent(encodeURIComponent(str))).toString('base64');
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ const batchId: string =
|
|||||||
'mermaid-batch-' +
|
'mermaid-batch-' +
|
||||||
(Cypress.env('useAppli')
|
(Cypress.env('useAppli')
|
||||||
? Date.now().toString()
|
? Date.now().toString()
|
||||||
: (Cypress.env('CYPRESS_COMMIT') ?? Date.now().toString()));
|
: Cypress.env('CYPRESS_COMMIT') || Date.now().toString());
|
||||||
|
|
||||||
export const mermaidUrl = (
|
export const mermaidUrl = (
|
||||||
graphStr: string | string[],
|
graphStr: string | string[],
|
||||||
@@ -61,7 +61,9 @@ export const imgSnapshotTest = (
|
|||||||
sequence: {
|
sequence: {
|
||||||
...(_options.sequence ?? {}),
|
...(_options.sequence ?? {}),
|
||||||
actorFontFamily: 'courier',
|
actorFontFamily: 'courier',
|
||||||
noteFontFamily: _options.sequence?.noteFontFamily ?? 'courier',
|
noteFontFamily: _options.sequence?.noteFontFamily
|
||||||
|
? _options.sequence.noteFontFamily
|
||||||
|
: 'courier',
|
||||||
messageFontFamily: 'courier',
|
messageFontFamily: 'courier',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -98,12 +98,12 @@ describe('Configuration', () => {
|
|||||||
it('should handle arrowMarkerAbsolute set to true', () => {
|
it('should handle arrowMarkerAbsolute set to true', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`flowchart TD
|
`flowchart TD
|
||||||
A[Christmas] -->|Get money| B(Go shopping)
|
A[Christmas] -->|Get money| B(Go shopping)
|
||||||
B --> C{Let me think}
|
B --> C{Let me think}
|
||||||
C -->|One| D[Laptop]
|
C -->|One| D[Laptop]
|
||||||
C -->|Two| E[iPhone]
|
C -->|Two| E[iPhone]
|
||||||
C -->|Three| F[fa:fa-car Car]
|
C -->|Three| F[fa:fa-car Car]
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
arrowMarkerAbsolute: true,
|
arrowMarkerAbsolute: true,
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,8 @@ describe('Configuration', () => {
|
|||||||
cy.get('path')
|
cy.get('path')
|
||||||
.first()
|
.first()
|
||||||
.should('have.attr', 'marker-end')
|
.should('have.attr', 'marker-end')
|
||||||
.and('include', 'url(http://localhost');
|
.should('exist')
|
||||||
|
.and('include', 'url(http\\:\\/\\/localhost');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should not taint the initial configuration when using multiple directives', () => {
|
it('should not taint the initial configuration when using multiple directives', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, mermaidUrl, utf8ToB64 } from '../../helpers/util.ts';
|
import { mermaidUrl } from '../../helpers/util.ts';
|
||||||
describe('XSS', () => {
|
describe('XSS', () => {
|
||||||
it('should handle xss in tags', () => {
|
it('should handle xss in tags', () => {
|
||||||
const str =
|
const str =
|
||||||
@@ -141,37 +141,4 @@ describe('XSS', () => {
|
|||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
cy.get('#the-malware').should('not.exist');
|
cy.get('#the-malware').should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should sanitize icon labels in architecture diagrams', () => {
|
|
||||||
const str = JSON.stringify({
|
|
||||||
code: `architecture-beta
|
|
||||||
group api(cloud)[API]
|
|
||||||
service db "<img src=x onerror=\\"xssAttack()\\">" [Database] in api`,
|
|
||||||
});
|
|
||||||
imgSnapshotTest(utf8ToB64(str), {}, true);
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.get('#the-malware').should('not.exist');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should sanitize katex blocks', () => {
|
|
||||||
const str = JSON.stringify({
|
|
||||||
code: `sequenceDiagram
|
|
||||||
participant A as Alice<img src="x" onerror="xssAttack()">$$\\text{Alice}$$
|
|
||||||
A->>John: Hello John, how are you?`,
|
|
||||||
});
|
|
||||||
imgSnapshotTest(utf8ToB64(str), {}, true);
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.get('#the-malware').should('not.exist');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should sanitize labels', () => {
|
|
||||||
const str = JSON.stringify({
|
|
||||||
code: `erDiagram
|
|
||||||
"<img src=x onerror=xssAttack()>" ||--|| ENTITY2 : "<img src=x onerror=xssAttack()>"
|
|
||||||
`,
|
|
||||||
});
|
|
||||||
imgSnapshotTest(utf8ToB64(str), {}, true);
|
|
||||||
cy.wait(1000);
|
|
||||||
cy.get('#the-malware').should('not.exist');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -16,7 +16,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL2: should handle columns statement in sub-blocks', () => {
|
it('BL2: should handle columns statement in sub-blocks', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
id1["Hello"]
|
id1["Hello"]
|
||||||
block
|
block
|
||||||
columns 3
|
columns 3
|
||||||
@@ -32,7 +32,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL3: should align block widths and handle columns statement in sub-blocks', () => {
|
it('BL3: should align block widths and handle columns statement in sub-blocks', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
block
|
block
|
||||||
columns 1
|
columns 1
|
||||||
id1
|
id1
|
||||||
@@ -48,7 +48,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL4: should align block widths and handle columns statements in deeper sub-blocks then 1 level', () => {
|
it('BL4: should align block widths and handle columns statements in deeper sub-blocks then 1 level', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 1
|
columns 1
|
||||||
block
|
block
|
||||||
columns 1
|
columns 1
|
||||||
@@ -68,7 +68,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL5: should align block widths and handle columns statements in deeper sub-blocks then 1 level (alt)', () => {
|
it('BL5: should align block widths and handle columns statements in deeper sub-blocks then 1 level (alt)', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 1
|
columns 1
|
||||||
block
|
block
|
||||||
id1
|
id1
|
||||||
@@ -87,7 +87,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL6: should handle block arrows and spece statements', () => {
|
it('BL6: should handle block arrows and spece statements', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
space:3
|
space:3
|
||||||
ida idb idc
|
ida idb idc
|
||||||
@@ -106,7 +106,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL7: should handle different types of edges', () => {
|
it('BL7: should handle different types of edges', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
A space:5
|
A space:5
|
||||||
A --o B
|
A --o B
|
||||||
@@ -119,7 +119,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL8: should handle sub-blocks without columns statements', () => {
|
it('BL8: should handle sub-blocks without columns statements', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 2
|
columns 2
|
||||||
C A B
|
C A B
|
||||||
block
|
block
|
||||||
@@ -133,7 +133,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL9: should handle edges from blocks in sub blocks to other blocks', () => {
|
it('BL9: should handle edges from blocks in sub blocks to other blocks', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
B space
|
B space
|
||||||
block
|
block
|
||||||
@@ -147,7 +147,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL10: should handle edges from composite blocks', () => {
|
it('BL10: should handle edges from composite blocks', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
B space
|
B space
|
||||||
block BL
|
block BL
|
||||||
@@ -161,7 +161,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL11: should handle edges to composite blocks', () => {
|
it('BL11: should handle edges to composite blocks', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
B space
|
B space
|
||||||
block BL
|
block BL
|
||||||
@@ -175,7 +175,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL12: edges should handle labels', () => {
|
it('BL12: edges should handle labels', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
A
|
A
|
||||||
space
|
space
|
||||||
A -- "apa" --> E
|
A -- "apa" --> E
|
||||||
@@ -186,7 +186,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL13: should handle block arrows in different directions', () => {
|
it('BL13: should handle block arrows in different directions', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
space blockArrowId1<["down"]>(down) space
|
space blockArrowId1<["down"]>(down) space
|
||||||
blockArrowId2<["right"]>(right) blockArrowId3<["Sync"]>(x, y) blockArrowId4<["left"]>(left)
|
blockArrowId2<["right"]>(right) blockArrowId3<["Sync"]>(x, y) blockArrowId4<["left"]>(left)
|
||||||
@@ -199,7 +199,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL14: should style statements and class statements', () => {
|
it('BL14: should style statements and class statements', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
A
|
A
|
||||||
B
|
B
|
||||||
classDef blue fill:#66f,stroke:#333,stroke-width:2px;
|
classDef blue fill:#66f,stroke:#333,stroke-width:2px;
|
||||||
@@ -212,7 +212,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL15: width alignment - D and E should share available space', () => {
|
it('BL15: width alignment - D and E should share available space', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
block
|
block
|
||||||
D
|
D
|
||||||
E
|
E
|
||||||
@@ -225,7 +225,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL16: width alignment - C should be as wide as the composite block', () => {
|
it('BL16: width alignment - C should be as wide as the composite block', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
block
|
block
|
||||||
A("This is the text")
|
A("This is the text")
|
||||||
B
|
B
|
||||||
@@ -238,7 +238,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL17: width alignment - blocks should be equal in width', () => {
|
it('BL17: width alignment - blocks should be equal in width', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
A("This is the text")
|
A("This is the text")
|
||||||
B
|
B
|
||||||
C
|
C
|
||||||
@@ -249,7 +249,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL18: block types 1 - square, rounded and circle', () => {
|
it('BL18: block types 1 - square, rounded and circle', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
A["square"]
|
A["square"]
|
||||||
B("rounded")
|
B("rounded")
|
||||||
C(("circle"))
|
C(("circle"))
|
||||||
@@ -260,7 +260,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL19: block types 2 - odd, diamond and hexagon', () => {
|
it('BL19: block types 2 - odd, diamond and hexagon', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
A>"rect_left_inv_arrow"]
|
A>"rect_left_inv_arrow"]
|
||||||
B{"diamond"}
|
B{"diamond"}
|
||||||
C{{"hexagon"}}
|
C{{"hexagon"}}
|
||||||
@@ -271,7 +271,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL20: block types 3 - stadium', () => {
|
it('BL20: block types 3 - stadium', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
A(["stadium"])
|
A(["stadium"])
|
||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
@@ -280,7 +280,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL21: block types 4 - lean right, lean left, trapezoid and inv trapezoid', () => {
|
it('BL21: block types 4 - lean right, lean left, trapezoid and inv trapezoid', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
A[/"lean right"/]
|
A[/"lean right"/]
|
||||||
B[\"lean left"\]
|
B[\"lean left"\]
|
||||||
C[/"trapezoid"\]
|
C[/"trapezoid"\]
|
||||||
@@ -292,7 +292,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL22: block types 1 - square, rounded and circle', () => {
|
it('BL22: block types 1 - square, rounded and circle', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
A["square"]
|
A["square"]
|
||||||
B("rounded")
|
B("rounded")
|
||||||
C(("circle"))
|
C(("circle"))
|
||||||
@@ -303,7 +303,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL23: sizing - it should be possible to make a block wider', () => {
|
it('BL23: sizing - it should be possible to make a block wider', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
A("rounded"):2
|
A("rounded"):2
|
||||||
B:2
|
B:2
|
||||||
C
|
C
|
||||||
@@ -314,7 +314,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL24: sizing - it should be possible to make a composite block wider', () => {
|
it('BL24: sizing - it should be possible to make a composite block wider', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
block:2
|
block:2
|
||||||
A
|
A
|
||||||
end
|
end
|
||||||
@@ -326,7 +326,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL25: block in the middle with space on each side', () => {
|
it('BL25: block in the middle with space on each side', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
space
|
space
|
||||||
middle["In the middle"]
|
middle["In the middle"]
|
||||||
@@ -337,7 +337,7 @@ describe('Block diagram', () => {
|
|||||||
});
|
});
|
||||||
it('BL26: space and an edge', () => {
|
it('BL26: space and an edge', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 5
|
columns 5
|
||||||
A space B
|
A space B
|
||||||
A --x B
|
A --x B
|
||||||
@@ -347,7 +347,7 @@ describe('Block diagram', () => {
|
|||||||
});
|
});
|
||||||
it('BL27: block sizes for regular blocks', () => {
|
it('BL27: block sizes for regular blocks', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a["A wide one"] b:2 c:2 d
|
a["A wide one"] b:2 c:2 d
|
||||||
`,
|
`,
|
||||||
@@ -356,7 +356,7 @@ describe('Block diagram', () => {
|
|||||||
});
|
});
|
||||||
it('BL28: composite block with a set width - f should use the available space', () => {
|
it('BL28: composite block with a set width - f should use the available space', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a:3
|
a:3
|
||||||
block:e:3
|
block:e:3
|
||||||
@@ -370,7 +370,7 @@ describe('Block diagram', () => {
|
|||||||
|
|
||||||
it('BL29: composite block with a set width - f and g should split the available space', () => {
|
it('BL29: composite block with a set width - f and g should split the available space', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`block
|
`block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a:3
|
a:3
|
||||||
block:e:3
|
block:e:3
|
||||||
@@ -393,17 +393,6 @@ describe('Block diagram', () => {
|
|||||||
overflow:3
|
overflow:3
|
||||||
short:1
|
short:1
|
||||||
also_overflow:2
|
also_overflow:2
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('BL31: edge without arrow syntax should render with no arrowheads', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`block-beta
|
|
||||||
a
|
|
||||||
b
|
|
||||||
a --- b
|
|
||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
@@ -512,30 +512,4 @@ describe('Class diagram', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle backticks for namespace and class names', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
classDiagram
|
|
||||||
namespace \`A::B\` {
|
|
||||||
class \`IPC::Sender\`
|
|
||||||
}
|
|
||||||
RenderProcessHost --|> \`IPC::Sender\`
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
it('should handle an empty class body with empty braces', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
` classDiagram
|
|
||||||
class FooBase~T~ {}
|
|
||||||
class Bar {
|
|
||||||
+Zip
|
|
||||||
+Zap()
|
|
||||||
}
|
|
||||||
FooBase <|-- Ba
|
|
||||||
`,
|
|
||||||
{ flowchart: { defaultRenderer: 'elk' } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -109,7 +109,7 @@ describe('Flowchart ELK', () => {
|
|||||||
const style = svg.attr('style');
|
const style = svg.attr('style');
|
||||||
expect(style).to.match(/^max-width: [\d.]+px;$/);
|
expect(style).to.match(/^max-width: [\d.]+px;$/);
|
||||||
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
|
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
|
||||||
verifyNumber(maxWidthValue, 380, 15);
|
verifyNumber(maxWidthValue, 380);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('8-elk: should render a flowchart when useMaxWidth is false', () => {
|
it('8-elk: should render a flowchart when useMaxWidth is false', () => {
|
||||||
@@ -128,7 +128,7 @@ describe('Flowchart ELK', () => {
|
|||||||
const width = parseFloat(svg.attr('width'));
|
const width = parseFloat(svg.attr('width'));
|
||||||
// use within because the absolute value can be slightly different depending on the environment ±5%
|
// use within because the absolute value can be slightly different depending on the environment ±5%
|
||||||
// expect(height).to.be.within(446 * 0.95, 446 * 1.05);
|
// expect(height).to.be.within(446 * 0.95, 446 * 1.05);
|
||||||
verifyNumber(width, 380, 15);
|
verifyNumber(width, 380);
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -1053,21 +1053,6 @@ flowchart LR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('6647-elk: should keep node order when using elk layout unless it would add crossings', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
flowchart TB
|
|
||||||
a --> a1 & a2 & a3 & a4
|
|
||||||
b --> b1 & b2
|
|
||||||
b2 --> b3
|
|
||||||
b1 --> b4
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Title and arrow styling #4813', () => {
|
describe('Title and arrow styling #4813', () => {
|
||||||
|
@@ -1113,37 +1113,6 @@ end
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Flowchart Node Shape Rendering', () => {
|
|
||||||
it('should render a stadium-shaped node', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`flowchart TB
|
|
||||||
A(["Start"]) --> n1["Untitled Node"]
|
|
||||||
A --> n2["Untitled Node"]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should render a diamond-shaped node using shape config', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`flowchart BT
|
|
||||||
n2["Untitled Node"] --> n1["Diamond"]
|
|
||||||
n1@{ shape: diam}
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should render a rounded rectangle and a normal rectangle', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`flowchart BT
|
|
||||||
n2["Untitled Node"] --> n1["Rounded Rectangle"]
|
|
||||||
n3["Untitled Node"] --> n1
|
|
||||||
n1@{ shape: rounded}
|
|
||||||
n3@{ shape: rect}
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('6617: Per Link Curve Styling using edge Ids', () => {
|
it('6617: Per Link Curve Styling using edge Ids', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -1164,39 +1133,4 @@ end
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when rendering unsuported markdown', () => {
|
|
||||||
const graph = `flowchart TB
|
|
||||||
mermaid{"What is\nyourmermaid version?"} --> v10["<11"] --"\`<**1**1\`"--> fine["No bug"]
|
|
||||||
mermaid --> v11[">= v11"] -- ">= v11" --> broken["Affected by https://github.com/mermaid-js/mermaid/issues/5824"]
|
|
||||||
subgraph subgraph1["\`How to fix **fix**\`"]
|
|
||||||
broken --> B["B"]
|
|
||||||
end
|
|
||||||
githost["Github, Gitlab, BitBucket, etc."]
|
|
||||||
githost2["\`Github, Gitlab, BitBucket, etc.\`"]
|
|
||||||
a["1."]
|
|
||||||
b["- x"]
|
|
||||||
`;
|
|
||||||
|
|
||||||
it('should render raw strings', () => {
|
|
||||||
imgSnapshotTest(graph);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render raw strings with htmlLabels: false', () => {
|
|
||||||
imgSnapshotTest(graph, { htmlLabels: false });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('V2 - 17: should apply class def colour to edge label', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
` graph LR
|
|
||||||
id1(Start) link@-- "Label" -->id2(Stop)
|
|
||||||
style id1 fill:#f9f,stroke:#333,stroke-width:4px
|
|
||||||
|
|
||||||
class id2 myClass
|
|
||||||
classDef myClass fill:#bbf,stroke:#f66,stroke-width:2px,color:white,stroke-dasharray: 5 5
|
|
||||||
class link myClass
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -565,18 +565,6 @@ describe('Gantt diagram', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render only the day when using dateFormat D', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gantt
|
|
||||||
title Test
|
|
||||||
dateFormat D
|
|
||||||
A :a, 1, 1d
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO: fix it
|
// TODO: fix it
|
||||||
//
|
//
|
||||||
// This test is skipped deliberately
|
// This test is skipped deliberately
|
||||||
@@ -659,49 +647,6 @@ describe('Gantt diagram', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a gantt diagram excluding a specific date in YYYY-MM-DD HH:mm:ss format', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gantt
|
|
||||||
dateFormat YYYY-MM-DD HH:mm:ss
|
|
||||||
excludes 2025-07-07
|
|
||||||
section Section
|
|
||||||
A task :a1, 2025-07-04 20:30:30, 2025-07-08 10:30:30
|
|
||||||
Another task:after a1, 20h
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render a gantt diagram excluding saturday and sunday in YYYY-MM-DD HH:mm:ss format', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gantt
|
|
||||||
dateFormat YYYY-MM-DD HH:mm:ss
|
|
||||||
excludes weekends
|
|
||||||
weekend saturday
|
|
||||||
section Section
|
|
||||||
A task :a1, 2025-07-04 20:30:30, 2025-07-08 10:30:30
|
|
||||||
Another task:after a1, 20h
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should render a gantt diagram excluding friday and saturday in YYYY-MM-DD HH:mm:ss format', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
gantt
|
|
||||||
dateFormat YYYY-MM-DD HH:mm:ss
|
|
||||||
excludes weekends
|
|
||||||
weekend friday
|
|
||||||
section Section
|
|
||||||
A task :a1, 2025-07-04 20:30:30, 2025-07-08 10:30:30
|
|
||||||
Another task:after a1, 20h
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should render when there's a semicolon in the title", () => {
|
it("should render when there's a semicolon in the title", () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
@@ -1,79 +0,0 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
|
||||||
|
|
||||||
describe('Mindmap Tidy Tree', () => {
|
|
||||||
it('1-tidy-tree: should render a simple mindmap without children', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
` ---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('2-tidy-tree: should render a simple mindmap', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
` ---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap is a long thing))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
C
|
|
||||||
D
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('3-tidy-tree: should render a mindmap with different shapes', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
` ---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
Origins
|
|
||||||
Long history
|
|
||||||
::icon(fa fa-book)
|
|
||||||
Popularisation
|
|
||||||
British popular psychology author Tony Buzan
|
|
||||||
Research
|
|
||||||
On effectiveness<br/>and features
|
|
||||||
On Automatic creation
|
|
||||||
Uses
|
|
||||||
Creative techniques
|
|
||||||
Strategic planning
|
|
||||||
Argument mapping
|
|
||||||
Tools
|
|
||||||
id)I am a cloud(
|
|
||||||
id))I am a bang((
|
|
||||||
Tools
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('4-tidy-tree: should render a mindmap with children', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
` ---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
((This is a mindmap))
|
|
||||||
child1
|
|
||||||
grandchild 1
|
|
||||||
grandchild 2
|
|
||||||
child2
|
|
||||||
grandchild 3
|
|
||||||
grandchild 4
|
|
||||||
child3
|
|
||||||
grandchild 5
|
|
||||||
grandchild 6
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
@@ -159,10 +159,12 @@ root
|
|||||||
});
|
});
|
||||||
it('square shape', () => {
|
it('square shape', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`mindmap
|
`
|
||||||
|
mindmap
|
||||||
root[
|
root[
|
||||||
The root
|
The root
|
||||||
]`,
|
]
|
||||||
|
`,
|
||||||
{},
|
{},
|
||||||
undefined,
|
undefined,
|
||||||
shouldHaveRoot
|
shouldHaveRoot
|
||||||
@@ -170,10 +172,12 @@ root
|
|||||||
});
|
});
|
||||||
it('rounded rect shape', () => {
|
it('rounded rect shape', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`mindmap
|
`
|
||||||
|
mindmap
|
||||||
root((
|
root((
|
||||||
The root
|
The root
|
||||||
))`,
|
))
|
||||||
|
`,
|
||||||
{},
|
{},
|
||||||
undefined,
|
undefined,
|
||||||
shouldHaveRoot
|
shouldHaveRoot
|
||||||
@@ -181,10 +185,12 @@ root
|
|||||||
});
|
});
|
||||||
it('circle shape', () => {
|
it('circle shape', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`mindmap
|
`
|
||||||
|
mindmap
|
||||||
root(
|
root(
|
||||||
The root
|
The root
|
||||||
)`,
|
)
|
||||||
|
`,
|
||||||
{},
|
{},
|
||||||
undefined,
|
undefined,
|
||||||
shouldHaveRoot
|
shouldHaveRoot
|
||||||
@@ -192,8 +198,10 @@ root
|
|||||||
});
|
});
|
||||||
it('default shape', () => {
|
it('default shape', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`mindmap
|
`
|
||||||
The root`,
|
mindmap
|
||||||
|
The root
|
||||||
|
`,
|
||||||
{},
|
{},
|
||||||
undefined,
|
undefined,
|
||||||
shouldHaveRoot
|
shouldHaveRoot
|
||||||
@@ -201,10 +209,12 @@ root
|
|||||||
});
|
});
|
||||||
it('adding children', () => {
|
it('adding children', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`mindmap
|
`
|
||||||
|
mindmap
|
||||||
The root
|
The root
|
||||||
child1
|
child1
|
||||||
child2`,
|
child2
|
||||||
|
`,
|
||||||
{},
|
{},
|
||||||
undefined,
|
undefined,
|
||||||
shouldHaveRoot
|
shouldHaveRoot
|
||||||
@@ -212,11 +222,13 @@ root
|
|||||||
});
|
});
|
||||||
it('adding grand children', () => {
|
it('adding grand children', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`mindmap
|
`
|
||||||
|
mindmap
|
||||||
The root
|
The root
|
||||||
child1
|
child1
|
||||||
child2
|
child2
|
||||||
child3`,
|
child3
|
||||||
|
`,
|
||||||
{},
|
{},
|
||||||
undefined,
|
undefined,
|
||||||
shouldHaveRoot
|
shouldHaveRoot
|
||||||
@@ -228,21 +240,25 @@ root
|
|||||||
`mindmap
|
`mindmap
|
||||||
id1[\`**Start** with
|
id1[\`**Start** with
|
||||||
a second line 😎\`]
|
a second line 😎\`]
|
||||||
id2[\`The dog in **the** hog... a *very long text* about it Word!\`]`
|
id2[\`The dog in **the** hog... a *very long text* about it
|
||||||
|
Word!\`]
|
||||||
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('Include char sequence "graph" in text (#6795)', () => {
|
describe('Include char sequence "graph" in text (#6795)', () => {
|
||||||
it('has a label with char sequence "graph"', () => {
|
it('has a label with char sequence "graph"', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
` mindmap
|
`
|
||||||
|
mindmap
|
||||||
root
|
root
|
||||||
Photograph
|
Photograph
|
||||||
Waterfall
|
Waterfall
|
||||||
Landscape
|
Landscape
|
||||||
Geography
|
Geography
|
||||||
Mountains
|
Mountains
|
||||||
Rocks`,
|
Rocks
|
||||||
|
`,
|
||||||
{ flowchart: { defaultRenderer: 'elk' } }
|
{ flowchart: { defaultRenderer: 'elk' } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -82,13 +82,4 @@ describe('pie chart', () => {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render pie slices only for non-zero values but shows all legends', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
` pie title Pets adopted by volunteers
|
|
||||||
"Dogs" : 386
|
|
||||||
"Cats" : 85
|
|
||||||
"Rats" : 1
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -15,7 +15,7 @@ describe('Sankey Diagram', () => {
|
|||||||
describe('when given a linkColor', function () {
|
describe('when given a linkColor', function () {
|
||||||
this.beforeAll(() => {
|
this.beforeAll(() => {
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
`sankey
|
`sankey-beta
|
||||||
a,b,10
|
a,b,10
|
||||||
`
|
`
|
||||||
).as('graph');
|
).as('graph');
|
||||||
@@ -62,7 +62,7 @@ describe('Sankey Diagram', () => {
|
|||||||
this.beforeAll(() => {
|
this.beforeAll(() => {
|
||||||
cy.wrap(
|
cy.wrap(
|
||||||
`
|
`
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
a,b,8
|
a,b,8
|
||||||
b,c,8
|
b,c,8
|
||||||
|
@@ -1,780 +0,0 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
|
||||||
|
|
||||||
const looks = ['classic'];
|
|
||||||
const participantTypes = [
|
|
||||||
{ type: 'participant', display: 'participant' },
|
|
||||||
{ type: 'actor', display: 'actor' },
|
|
||||||
{ type: 'boundary', display: 'boundary' },
|
|
||||||
{ type: 'control', display: 'control' },
|
|
||||||
{ type: 'entity', display: 'entity' },
|
|
||||||
{ type: 'database', display: 'database' },
|
|
||||||
{ type: 'collections', display: 'collections' },
|
|
||||||
{ type: 'queue', display: 'queue' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const restrictedTypes = ['boundary', 'control', 'entity', 'database', 'collections', 'queue'];
|
|
||||||
|
|
||||||
const interactionTypes = ['->>', '-->>', '->', '-->', '-x', '--x', '->>+', '-->>+'];
|
|
||||||
|
|
||||||
const notePositions = ['left of', 'right of', 'over'];
|
|
||||||
|
|
||||||
function getParticipantLine(name, type, alias) {
|
|
||||||
if (restrictedTypes.includes(type)) {
|
|
||||||
return ` participant ${name}@{ "type" : "${type}" }\n`;
|
|
||||||
} else if (alias) {
|
|
||||||
return ` participant ${name}@{ "type" : "${type}" } \n`;
|
|
||||||
} else {
|
|
||||||
return ` participant ${name}@{ "type" : "${type}" }\n`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
looks.forEach((look) => {
|
|
||||||
describe(`Sequence Diagram Tests - ${look} look`, () => {
|
|
||||||
it('should render all participant types', () => {
|
|
||||||
let diagramCode = `sequenceDiagram\n`;
|
|
||||||
participantTypes.forEach((pt, index) => {
|
|
||||||
const name = `${pt.display}${index}`;
|
|
||||||
diagramCode += getParticipantLine(name, pt.type);
|
|
||||||
});
|
|
||||||
for (let i = 0; i < participantTypes.length - 1; i++) {
|
|
||||||
diagramCode += ` ${participantTypes[i].display}${i} ->> ${participantTypes[i + 1].display}${i + 1}: Message ${i}\n`;
|
|
||||||
}
|
|
||||||
imgSnapshotTest(diagramCode, { look, sequence: { diagramMarginX: 50, diagramMarginY: 10 } });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render all interaction types', () => {
|
|
||||||
let diagramCode = `sequenceDiagram\n`;
|
|
||||||
diagramCode += getParticipantLine('A', 'actor');
|
|
||||||
diagramCode += getParticipantLine('B', 'boundary');
|
|
||||||
interactionTypes.forEach((interaction, index) => {
|
|
||||||
diagramCode += ` A ${interaction} B: ${interaction} message ${index}\n`;
|
|
||||||
});
|
|
||||||
imgSnapshotTest(diagramCode, { look });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render participant creation and destruction', () => {
|
|
||||||
let diagramCode = `sequenceDiagram\n`;
|
|
||||||
participantTypes.forEach((pt, index) => {
|
|
||||||
const name = `${pt.display}${index}`;
|
|
||||||
diagramCode += getParticipantLine('A', pt.type);
|
|
||||||
diagramCode += getParticipantLine('B', pt.type);
|
|
||||||
diagramCode += ` create participant ${name}@{ "type" : "${pt.type}" }\n`;
|
|
||||||
diagramCode += ` A ->> ${name}: Hello ${pt.display}\n`;
|
|
||||||
if (index % 2 === 0) {
|
|
||||||
diagramCode += ` destroy ${name}\n`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
imgSnapshotTest(diagramCode, { look });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render notes in all positions', () => {
|
|
||||||
let diagramCode = `sequenceDiagram\n`;
|
|
||||||
diagramCode += getParticipantLine('A', 'actor');
|
|
||||||
diagramCode += getParticipantLine('B', 'boundary');
|
|
||||||
notePositions.forEach((position, index) => {
|
|
||||||
diagramCode += ` Note ${position} A: Note ${position} ${index}\n`;
|
|
||||||
});
|
|
||||||
diagramCode += ` A ->> B: Message with notes\n`;
|
|
||||||
imgSnapshotTest(diagramCode, { look });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render parallel interactions', () => {
|
|
||||||
let diagramCode = `sequenceDiagram\n`;
|
|
||||||
participantTypes.slice(0, 4).forEach((pt, index) => {
|
|
||||||
diagramCode += getParticipantLine(`${pt.display}${index}`, pt.type);
|
|
||||||
});
|
|
||||||
diagramCode += ` par Parallel actions\n`;
|
|
||||||
for (let i = 0; i < 3; i += 2) {
|
|
||||||
diagramCode += ` ${participantTypes[i].display}${i} ->> ${participantTypes[i + 1].display}${i + 1}: Message ${i}\n`;
|
|
||||||
if (i < participantTypes.length - 2) {
|
|
||||||
diagramCode += ` and\n`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diagramCode += ` end\n`;
|
|
||||||
imgSnapshotTest(diagramCode, { look });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render alternative flows', () => {
|
|
||||||
let diagramCode = `sequenceDiagram\n`;
|
|
||||||
diagramCode += getParticipantLine('A', 'actor');
|
|
||||||
diagramCode += getParticipantLine('B', 'boundary');
|
|
||||||
diagramCode += ` alt Successful case\n`;
|
|
||||||
diagramCode += ` A ->> B: Request\n`;
|
|
||||||
diagramCode += ` B -->> A: Success\n`;
|
|
||||||
diagramCode += ` else Failure case\n`;
|
|
||||||
diagramCode += ` A ->> B: Request\n`;
|
|
||||||
diagramCode += ` B --x A: Failure\n`;
|
|
||||||
diagramCode += ` end\n`;
|
|
||||||
imgSnapshotTest(diagramCode, { look });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render loops', () => {
|
|
||||||
let diagramCode = `sequenceDiagram\n`;
|
|
||||||
participantTypes.slice(0, 3).forEach((pt, index) => {
|
|
||||||
diagramCode += getParticipantLine(`${pt.display}${index}`, pt.type);
|
|
||||||
});
|
|
||||||
diagramCode += ` loop For each participant\n`;
|
|
||||||
for (let i = 0; i < 3; i++) {
|
|
||||||
diagramCode += ` ${participantTypes[0].display}0 ->> ${participantTypes[1].display}1: Message ${i}\n`;
|
|
||||||
}
|
|
||||||
diagramCode += ` end\n`;
|
|
||||||
imgSnapshotTest(diagramCode, { look });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render boxes around groups', () => {
|
|
||||||
let diagramCode = `sequenceDiagram\n`;
|
|
||||||
diagramCode += ` box Group 1\n`;
|
|
||||||
participantTypes.slice(0, 3).forEach((pt, index) => {
|
|
||||||
diagramCode += ` ${getParticipantLine(`${pt.display}${index}`, pt.type)}`;
|
|
||||||
});
|
|
||||||
diagramCode += ` end\n`;
|
|
||||||
diagramCode += ` box rgb(200,220,255) Group 2\n`;
|
|
||||||
participantTypes.slice(3, 6).forEach((pt, index) => {
|
|
||||||
diagramCode += ` ${getParticipantLine(`${pt.display}${index}`, pt.type)}`;
|
|
||||||
});
|
|
||||||
diagramCode += ` end\n`;
|
|
||||||
diagramCode += ` ${participantTypes[0].display}0 ->> ${participantTypes[3].display}0: Cross-group message\n`;
|
|
||||||
imgSnapshotTest(diagramCode, { look });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render with different font settings', () => {
|
|
||||||
let diagramCode = `sequenceDiagram\n`;
|
|
||||||
participantTypes.slice(0, 3).forEach((pt, index) => {
|
|
||||||
diagramCode += getParticipantLine(`${pt.display}${index}`, pt.type);
|
|
||||||
});
|
|
||||||
diagramCode += ` ${participantTypes[0].display}0 ->> ${participantTypes[1].display}1: Regular message\n`;
|
|
||||||
diagramCode += ` Note right of ${participantTypes[1].display}1: Regular note\n`;
|
|
||||||
imgSnapshotTest(diagramCode, {
|
|
||||||
look,
|
|
||||||
sequence: {
|
|
||||||
actorFontFamily: 'courier',
|
|
||||||
actorFontSize: 14,
|
|
||||||
messageFontFamily: 'Arial',
|
|
||||||
messageFontSize: 12,
|
|
||||||
noteFontFamily: 'times',
|
|
||||||
noteFontSize: 16,
|
|
||||||
noteAlign: 'left',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Additional tests for specific combinations
|
|
||||||
describe('Sequence Diagram Special Cases', () => {
|
|
||||||
it('should render complex sequence with all features', () => {
|
|
||||||
const diagramCode = `
|
|
||||||
sequenceDiagram
|
|
||||||
box rgb(200,220,255) Authentication
|
|
||||||
actor User
|
|
||||||
participant LoginUI@{ "type": "boundary" }
|
|
||||||
participant AuthService@{ "type": "control" }
|
|
||||||
participant UserDB@{ "type": "database" }
|
|
||||||
end
|
|
||||||
|
|
||||||
box rgb(200,255,220) Order Processing
|
|
||||||
participant Order@{ "type": "entity" }
|
|
||||||
participant OrderQueue@{ "type": "queue" }
|
|
||||||
participant AuditLogs@{ "type": "collections" }
|
|
||||||
end
|
|
||||||
|
|
||||||
User ->> LoginUI: Enter credentials
|
|
||||||
LoginUI ->> AuthService: Validate
|
|
||||||
AuthService ->> UserDB: Query user
|
|
||||||
UserDB -->> AuthService: User data
|
|
||||||
alt Valid credentials
|
|
||||||
AuthService -->> LoginUI: Success
|
|
||||||
LoginUI -->> User: Welcome
|
|
||||||
|
|
||||||
par Place order
|
|
||||||
User ->> Order: New order
|
|
||||||
Order ->> OrderQueue: Process
|
|
||||||
and
|
|
||||||
Order ->> AuditLogs: Record
|
|
||||||
end
|
|
||||||
|
|
||||||
loop Until confirmed
|
|
||||||
OrderQueue ->> Order: Update status
|
|
||||||
Order -->> User: Notification
|
|
||||||
end
|
|
||||||
else Invalid credentials
|
|
||||||
AuthService --x LoginUI: Failure
|
|
||||||
LoginUI --x User: Retry
|
|
||||||
end
|
|
||||||
`;
|
|
||||||
imgSnapshotTest(diagramCode, {});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render with wrapped messages and notes', () => {
|
|
||||||
const diagramCode = `
|
|
||||||
sequenceDiagram
|
|
||||||
participant A
|
|
||||||
participant B
|
|
||||||
|
|
||||||
A ->> B: This is a very long message that should wrap properly in the diagram rendering
|
|
||||||
Note over A,B: This is a very long note that should also wrap properly when rendered in the diagram
|
|
||||||
|
|
||||||
par Wrapped parallel
|
|
||||||
A ->> B: Parallel message 1<br>with explicit line break
|
|
||||||
and
|
|
||||||
B ->> A: Parallel message 2<br>with explicit line break
|
|
||||||
end
|
|
||||||
|
|
||||||
loop Wrapped loop
|
|
||||||
Note right of B: This is a long note<br>in a loop
|
|
||||||
A ->> B: Message in loop
|
|
||||||
end
|
|
||||||
`;
|
|
||||||
imgSnapshotTest(diagramCode, { sequence: { wrap: true } });
|
|
||||||
});
|
|
||||||
describe('Sequence Diagram Rendering with Different Participant Types', () => {
|
|
||||||
it('should render a sequence diagram with various participant types', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant User@{ "type": "actor" }
|
|
||||||
participant AuthService@{ "type": "control" }
|
|
||||||
participant UI@{ "type": "boundary" }
|
|
||||||
participant OrderController@{ "type": "control" }
|
|
||||||
participant Product@{ "type": "entity" }
|
|
||||||
participant MongoDB@{ "type": "database" }
|
|
||||||
participant Products@{ "type": "collections" }
|
|
||||||
participant OrderQueue@{ "type": "queue" }
|
|
||||||
User ->> UI: Login request
|
|
||||||
UI ->> AuthService: Validate credentials
|
|
||||||
AuthService -->> UI: Authentication token
|
|
||||||
UI ->> OrderController: Place order
|
|
||||||
OrderController ->> Product: Check availability
|
|
||||||
Product -->> OrderController: Available
|
|
||||||
OrderController ->> MongoDB: Save order
|
|
||||||
MongoDB -->> OrderController: Order saved
|
|
||||||
OrderController ->> OrderQueue: Process payment
|
|
||||||
OrderQueue -->> User: Order confirmation
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render participant creation and destruction with different types', () => {
|
|
||||||
imgSnapshotTest(`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "boundary" }
|
|
||||||
Alice->>Bob: Hello Bob, how are you ?
|
|
||||||
Bob->>Alice: Fine, thank you. And you?
|
|
||||||
create participant Carl@{ "type" : "control" }
|
|
||||||
Alice->>Carl: Hi Carl!
|
|
||||||
create actor D as Donald
|
|
||||||
Carl->>D: Hi!
|
|
||||||
destroy Carl
|
|
||||||
Alice-xCarl: We are too many
|
|
||||||
destroy Bob
|
|
||||||
Bob->>Alice: I agree
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle complex interactions between different participant types', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
box rgb(200,220,255) Authentication
|
|
||||||
participant User@{ "type": "actor" }
|
|
||||||
participant LoginUI@{ "type": "boundary" }
|
|
||||||
participant AuthService@{ "type": "control" }
|
|
||||||
participant UserDB@{ "type": "database" }
|
|
||||||
end
|
|
||||||
|
|
||||||
box rgb(200,255,220) Order Processing
|
|
||||||
participant Order@{ "type": "entity" }
|
|
||||||
participant OrderQueue@{ "type": "queue" }
|
|
||||||
participant AuditLogs@{ "type": "collections" }
|
|
||||||
end
|
|
||||||
|
|
||||||
User ->> LoginUI: Enter credentials
|
|
||||||
LoginUI ->> AuthService: Validate
|
|
||||||
AuthService ->> UserDB: Query user
|
|
||||||
UserDB -->> AuthService: User data
|
|
||||||
|
|
||||||
alt Valid credentials
|
|
||||||
AuthService -->> LoginUI: Success
|
|
||||||
LoginUI -->> User: Welcome
|
|
||||||
|
|
||||||
par Place order
|
|
||||||
User ->> Order: New order
|
|
||||||
Order ->> OrderQueue: Process
|
|
||||||
and
|
|
||||||
Order ->> AuditLogs: Record
|
|
||||||
end
|
|
||||||
|
|
||||||
loop Until confirmed
|
|
||||||
OrderQueue ->> Order: Update status
|
|
||||||
Order -->> User: Notification
|
|
||||||
end
|
|
||||||
else Invalid credentials
|
|
||||||
AuthService --x LoginUI: Failure
|
|
||||||
LoginUI --x User: Retry
|
|
||||||
end
|
|
||||||
`,
|
|
||||||
{ sequence: { useMaxWidth: false } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render parallel processes with different participant types', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Customer@{ "type": "actor" }
|
|
||||||
participant Frontend@{ "type": "participant" }
|
|
||||||
participant PaymentService@{ "type": "boundary" }
|
|
||||||
participant InventoryManager@{ "type": "control" }
|
|
||||||
participant Order@{ "type": "entity" }
|
|
||||||
participant OrdersDB@{ "type": "database" }
|
|
||||||
participant NotificationQueue@{ "type": "queue" }
|
|
||||||
|
|
||||||
Customer ->> Frontend: Place order
|
|
||||||
Frontend ->> Order: Create order
|
|
||||||
par Parallel Processing
|
|
||||||
Order ->> PaymentService: Process payment
|
|
||||||
and
|
|
||||||
Order ->> InventoryManager: Reserve items
|
|
||||||
end
|
|
||||||
PaymentService -->> Order: Payment confirmed
|
|
||||||
InventoryManager -->> Order: Items reserved
|
|
||||||
Order ->> OrdersDB: Save finalized order
|
|
||||||
OrdersDB -->> Order: Order saved
|
|
||||||
Order ->> NotificationQueue: Send confirmation
|
|
||||||
NotificationQueue -->> Customer: Order confirmation
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('should render different participant types with notes and loops', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
actor Admin
|
|
||||||
participant Dashboard
|
|
||||||
participant AuthService@{ "type" : "boundary" }
|
|
||||||
participant UserManager@{ "type" : "control" }
|
|
||||||
participant UserProfile@{ "type" : "entity" }
|
|
||||||
participant UserDB@{ "type" : "database" }
|
|
||||||
participant Logs@{ "type" : "database" }
|
|
||||||
|
|
||||||
Admin ->> Dashboard: Open user management
|
|
||||||
loop Authentication check
|
|
||||||
Dashboard ->> AuthService: Verify admin rights
|
|
||||||
AuthService ->> Dashboard: Access granted
|
|
||||||
end
|
|
||||||
Dashboard ->> UserManager: List users
|
|
||||||
UserManager ->> UserDB: Query users
|
|
||||||
UserDB ->> UserManager: Return user data
|
|
||||||
Note right of UserDB: Encrypted data<br/>requires decryption
|
|
||||||
UserManager ->> UserProfile: Format profiles
|
|
||||||
UserProfile ->> UserManager: Formatted data
|
|
||||||
UserManager ->> Dashboard: Display users
|
|
||||||
Dashboard ->> Logs: Record access
|
|
||||||
Logs ->> Admin: Audit trail
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render different participant types with alternative flows', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
actor Client
|
|
||||||
participant MobileApp
|
|
||||||
participant CloudService@{ "type" : "boundary" }
|
|
||||||
participant DataProcessor@{ "type" : "control" }
|
|
||||||
participant Transaction@{ "type" : "entity" }
|
|
||||||
participant TransactionsDB@{ "type" : "database" }
|
|
||||||
participant EventBus@{ "type" : "queue" }
|
|
||||||
|
|
||||||
Client ->> MobileApp: Initiate transaction
|
|
||||||
MobileApp ->> CloudService: Authenticate
|
|
||||||
alt Authentication successful
|
|
||||||
CloudService -->> MobileApp: Auth token
|
|
||||||
MobileApp ->> DataProcessor: Process data
|
|
||||||
DataProcessor ->> Transaction: Create transaction
|
|
||||||
Transaction ->> TransactionsDB: Save record
|
|
||||||
TransactionsDB -->> Transaction: Confirmation
|
|
||||||
Transaction ->> EventBus: Publish event
|
|
||||||
EventBus -->> Client: Notification
|
|
||||||
else Authentication failed
|
|
||||||
CloudService -->> MobileApp: Error
|
|
||||||
MobileApp -->> Client: Show error
|
|
||||||
end
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render different participant types with wrapping text', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant B@{ "type" : "boundary" }
|
|
||||||
participant C@{ "type" : "control" }
|
|
||||||
participant E@{ "type" : "entity" }
|
|
||||||
participant DB@{ "type" : "database" }
|
|
||||||
participant COL@{ "type" : "collections" }
|
|
||||||
participant Q@{ "type" : "queue" }
|
|
||||||
|
|
||||||
FE ->> B: Another long message<br/>with explicit<br/>line breaks
|
|
||||||
B -->> FE: Response message that is also quite long and needs to wrap
|
|
||||||
FE ->> C: Process data
|
|
||||||
C ->> E: Validate
|
|
||||||
E -->> C: Validation result
|
|
||||||
C ->> DB: Save
|
|
||||||
DB -->> C: Save result
|
|
||||||
C ->> COL: Log
|
|
||||||
COL -->> Q: Forward
|
|
||||||
Q -->> LongNameUser: Final response with confirmation of all actions taken
|
|
||||||
`,
|
|
||||||
{ sequence: { wrap: true } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Sequence Diagram - New Participant Types with Long Notes and Messages', () => {
|
|
||||||
it('should render long notes left of boundary', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "boundary" }
|
|
||||||
actor Bob
|
|
||||||
Alice->>Bob: Hola
|
|
||||||
Note left of Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
Bob->>Alice: I'm short though
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render wrapped long notes left of control', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "control" }
|
|
||||||
actor Bob
|
|
||||||
Alice->>Bob: Hola
|
|
||||||
Note left of Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
Bob->>Alice: I'm short though
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render long notes right of entity', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "entity" }
|
|
||||||
actor Bob
|
|
||||||
Alice->>Bob: Hola
|
|
||||||
Note right of Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
Bob->>Alice: I'm short though
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render wrapped long notes right of database', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "database" }
|
|
||||||
actor Bob
|
|
||||||
Alice->>Bob: Hola
|
|
||||||
Note right of Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
Bob->>Alice: I'm short though
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render long notes over collections', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "collections" }
|
|
||||||
actor Bob
|
|
||||||
Alice->>Bob: Hola
|
|
||||||
Note over Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
Bob->>Alice: I'm short though
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render wrapped long notes over queue', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "queue" }
|
|
||||||
actor Bob
|
|
||||||
Alice->>Bob: Hola
|
|
||||||
Note over Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
Bob->>Alice: I'm short though
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render notes over actor and boundary', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
actor Alice
|
|
||||||
participant Charlie@{ "type" : "boundary" }
|
|
||||||
note over Alice: Some note
|
|
||||||
note over Charlie: Other note
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render long messages from database to collections', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "database" }
|
|
||||||
participant Bob@{ "type" : "collections" }
|
|
||||||
Alice->>Bob: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
Bob->>Alice: I'm short though
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render wrapped long messages from control to entity', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "control" }
|
|
||||||
participant Bob@{ "type" : "entity" }
|
|
||||||
Alice->>Bob:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
Bob->>Alice: I'm short though
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render long messages from queue to boundary', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "queue" }
|
|
||||||
participant Bob@{ "type" : "boundary" }
|
|
||||||
Alice->>Bob: I'm short
|
|
||||||
Bob->>Alice: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render wrapped long messages from actor to database', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
actor Alice
|
|
||||||
participant Bob@{ "type" : "database" }
|
|
||||||
Alice->>Bob: I'm short
|
|
||||||
Bob->>Alice:wrap: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('svg size', () => {
|
|
||||||
it('should render a sequence diagram when useMaxWidth is true (default)', () => {
|
|
||||||
renderGraph(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
actor Alice
|
|
||||||
participant Bob@{ "type" : "boundary" }
|
|
||||||
participant John@{ "type" : "control" }
|
|
||||||
Alice ->> Bob: Hello Bob, how are you?
|
|
||||||
Bob-->>John: How about you John?
|
|
||||||
Bob--x Alice: I am good thanks!
|
|
||||||
Bob-x John: I am good thanks!
|
|
||||||
Note right of John: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit on a row.
|
|
||||||
Bob-->Alice: Checking with John...
|
|
||||||
alt either this
|
|
||||||
Alice->>John: Yes
|
|
||||||
else or this
|
|
||||||
Alice->>John: No
|
|
||||||
else or this will happen
|
|
||||||
Alice->John: Maybe
|
|
||||||
end
|
|
||||||
par this happens in parallel
|
|
||||||
Alice -->> Bob: Parallel message 1
|
|
||||||
and
|
|
||||||
Alice -->> John: Parallel message 2
|
|
||||||
end
|
|
||||||
`,
|
|
||||||
{ sequence: { useMaxWidth: true } }
|
|
||||||
);
|
|
||||||
cy.get('svg').should((svg) => {
|
|
||||||
expect(svg).to.have.attr('width', '100%');
|
|
||||||
const style = svg.attr('style');
|
|
||||||
expect(style).to.match(/^max-width: [\d.]+px;$/);
|
|
||||||
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
|
|
||||||
expect(maxWidthValue).to.be.within(820 * 0.95, 820 * 1.05);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render a sequence diagram when useMaxWidth is false', () => {
|
|
||||||
renderGraph(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
actor Alice
|
|
||||||
participant Bob@{ "type" : "boundary" }
|
|
||||||
participant John@{ "type" : "control" }
|
|
||||||
Alice ->> Bob: Hello Bob, how are you?
|
|
||||||
Bob-->>John: How about you John?
|
|
||||||
Bob--x Alice: I am good thanks!
|
|
||||||
Bob-x John: I am good thanks!
|
|
||||||
Note right of John: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit on a row.
|
|
||||||
Bob-->Alice: Checking with John...
|
|
||||||
alt either this
|
|
||||||
Alice->>John: Yes
|
|
||||||
else or this
|
|
||||||
Alice->>John: No
|
|
||||||
else or this will happen
|
|
||||||
Alice->John: Maybe
|
|
||||||
end
|
|
||||||
par this happens in parallel
|
|
||||||
Alice -->> Bob: Parallel message 1
|
|
||||||
and
|
|
||||||
Alice -->> John: Parallel message 2
|
|
||||||
end
|
|
||||||
`,
|
|
||||||
{ sequence: { useMaxWidth: false } }
|
|
||||||
);
|
|
||||||
cy.get('svg').should((svg) => {
|
|
||||||
const width = parseFloat(svg.attr('width'));
|
|
||||||
expect(width).to.be.within(820 * 0.95, 820 * 1.05);
|
|
||||||
expect(svg).to.not.have.attr('style');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Central Connection Rendering Tests', () => {
|
|
||||||
it('should render central connection circles on actor vertical lines', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
participant Bob
|
|
||||||
participant Charlie
|
|
||||||
Alice ()->>() Bob: Central connection
|
|
||||||
Bob ()-->> Charlie: Reverse central connection
|
|
||||||
Charlie ()<<-->>() Alice: Dual central connection`,
|
|
||||||
{ look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render central connections with different arrow types', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
participant Bob
|
|
||||||
Alice ()->>() Bob: Solid open arrow
|
|
||||||
Alice ()-->>() Bob: Dotted open arrow
|
|
||||||
Alice ()-x() Bob: Solid cross
|
|
||||||
Alice ()--x() Bob: Dotted cross
|
|
||||||
Alice ()->() Bob: Solid arrow`,
|
|
||||||
{ look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render central connections with bidirectional arrows', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
participant Bob
|
|
||||||
Alice ()<<->>() Bob: Bidirectional solid
|
|
||||||
Alice ()<<-->>() Bob: Bidirectional dotted`,
|
|
||||||
{ look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render central connections with activations', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
participant Bob
|
|
||||||
participant Charlie
|
|
||||||
Alice ()->>() Bob: Activate Bob
|
|
||||||
activate Bob
|
|
||||||
Bob ()-->> Charlie: Message to Charlie
|
|
||||||
Bob ()->>() Alice: Response to Alice
|
|
||||||
deactivate Bob`,
|
|
||||||
{ look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render central connections mixed with normal messages', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
participant Bob
|
|
||||||
participant Charlie
|
|
||||||
Alice ->> Bob: Normal message
|
|
||||||
Bob ()->>() Charlie: Central connection
|
|
||||||
Charlie -->> Alice: Normal dotted message
|
|
||||||
Alice ()<<-->>() Bob: Dual central connection
|
|
||||||
Bob -x Charlie: Normal cross message`,
|
|
||||||
{ look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render central connections with notes', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
participant Bob
|
|
||||||
participant Charlie
|
|
||||||
Alice ()->>() Bob: Central connection
|
|
||||||
Note over Alice,Bob: Central connection note
|
|
||||||
Bob ()-->> Charlie: Reverse central connection
|
|
||||||
Note right of Charlie: Response note
|
|
||||||
Charlie ()<<-->>() Alice: Dual central connection`,
|
|
||||||
{ look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render central connections with loops and alternatives', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
participant Bob
|
|
||||||
participant Charlie
|
|
||||||
loop Every minute
|
|
||||||
Alice ()->>() Bob: Central heartbeat
|
|
||||||
Bob ()-->> Charlie: Forward heartbeat
|
|
||||||
end
|
|
||||||
alt Success
|
|
||||||
Charlie ()<<-->>() Alice: Success response
|
|
||||||
else Failure
|
|
||||||
Charlie ()-x() Alice: Failure response
|
|
||||||
end`,
|
|
||||||
{ look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render central connections with different participant types', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
actor Bob
|
|
||||||
participant Charlie@{"type":"boundary"}
|
|
||||||
participant David@{"type":"control"}
|
|
||||||
participant Eve@{"type":"entity"}
|
|
||||||
Alice ()->>() Bob: To actor
|
|
||||||
Bob ()-->> Charlie: To boundary
|
|
||||||
Charlie ()->>() David: To control
|
|
||||||
David ()<<-->>() Eve: To entity
|
|
||||||
Eve ()-x() Alice: Back to participant`,
|
|
||||||
{ look: 'classic', sequence: { diagramMarginX: 50, diagramMarginY: 10 } }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@@ -893,17 +893,6 @@ describe('Sequence diagram', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle bidirectional arrows with autonumber', () => {
|
|
||||||
imgSnapshotTest(`
|
|
||||||
sequenceDiagram
|
|
||||||
autonumber
|
|
||||||
participant A
|
|
||||||
participant B
|
|
||||||
A<<->>B: This is a bidirectional message
|
|
||||||
A->B: This is a normal message`);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should support actor links and properties when not mirrored EXPERIMENTAL: USE WITH CAUTION', () => {
|
it('should support actor links and properties when not mirrored EXPERIMENTAL: USE WITH CAUTION', () => {
|
||||||
//Be aware that the syntax for "properties" is likely to be changed.
|
//Be aware that the syntax for "properties" is likely to be changed.
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -1053,167 +1042,4 @@ describe('Sequence diagram', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('render new arrow type', () => {
|
|
||||||
it('should render Solid half arrow top', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice -|\\ John: Hello John, how are you?
|
|
||||||
Alice-|\\ John: Hi Alice, I can hear you!
|
|
||||||
Alice -|\\ John: Test
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should render Solid half arrow bottom', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice-|/John: Hello John, how are you?
|
|
||||||
Alice-|/John: Hi Alice, I can hear you!
|
|
||||||
Alice-|/John: Test
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Stick half arrow top ', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice-\\\\John: Hello John, how are you?
|
|
||||||
Alice-\\\\John: Hi Alice, I can hear you!
|
|
||||||
Alice-\\\\John: Test
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should render Stick half arrow bottom ', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice-//John: Hello John, how are you?
|
|
||||||
Alice-//John: Hi Alice, I can hear you!
|
|
||||||
Alice-//John: Test
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should render Solid half arrow top reverse ', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice/|-John: Hello Alice, how are you?
|
|
||||||
Alice/|-John: Hi Alice, I can hear you!
|
|
||||||
Alice/|-John: Test
|
|
||||||
|
|
||||||
`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Solid half arrow bottom reverse ', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`sequenceDiagram
|
|
||||||
Alice \\|- John: Hello Alice, how are you?
|
|
||||||
Alice \\|- John: Hi Alice, I can hear you!
|
|
||||||
Alice \\|- John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Stick half arrow top reverse ', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice //-John: Hello Alice, how are you?
|
|
||||||
Alice //-John: Hi Alice, I can hear you!
|
|
||||||
Alice //-John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Stick half arrow bottom reverse ', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice \\\\-John: Hello Alice, how are you?
|
|
||||||
Alice \\\\-John: Hi Alice, I can hear you!
|
|
||||||
Alice \\\\-John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Solid half arrow top dotted', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice --|\\John: Hello John, how are you?
|
|
||||||
Alice --|\\John: Hi Alice, I can hear you!
|
|
||||||
Alice --|\\John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Solid half arrow bottom dotted', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice --|/John: Hello John, how are you?
|
|
||||||
Alice --|/John: Hi Alice, I can hear you!
|
|
||||||
Alice --|/John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Stick half arrow top dotted', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice--\\\\John: Hello John, how are you?
|
|
||||||
Alice--\\\\John: Hi Alice, I can hear you!
|
|
||||||
Alice--\\\\John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Stick half arrow bottom dotted', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice--//John: Hello John, how are you?
|
|
||||||
Alice--//John: Hi Alice, I can hear you!
|
|
||||||
Alice--//John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Solid half arrow top reverse dotted', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice/|--John: Hello Alice, how are you?
|
|
||||||
Alice/|--John: Hi Alice, I can hear you!
|
|
||||||
Alice/|--John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Solid half arrow bottom reverse dotted', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice\\|--John: Hello Alice, how are you?
|
|
||||||
Alice\\|--John: Hi Alice, I can hear you!
|
|
||||||
Alice\\|--John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Stick half arrow top reverse dotted ', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice//--John: Hello Alice, how are you?
|
|
||||||
Alice//--John: Hi Alice, I can hear you!
|
|
||||||
Alice//--John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render Stick half arrow bottom reverse dotted ', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
sequenceDiagram
|
|
||||||
Alice\\\\--John: Hello Alice, how are you?
|
|
||||||
Alice\\\\--John: Hi Alice, I can hear you!
|
|
||||||
Alice\\\\--John: Test`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -602,231 +602,6 @@ State1 --> [*]
|
|||||||
--
|
--
|
||||||
55
|
55
|
||||||
}
|
}
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should render edge labels correctly', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`---
|
|
||||||
title: On The Way To Something Something DarkSide
|
|
||||||
config:
|
|
||||||
look: default
|
|
||||||
theme: default
|
|
||||||
---
|
|
||||||
|
|
||||||
stateDiagram-v2
|
|
||||||
|
|
||||||
state State1_____________
|
|
||||||
{
|
|
||||||
c0
|
|
||||||
}
|
|
||||||
|
|
||||||
state State2_____________
|
|
||||||
{
|
|
||||||
c1
|
|
||||||
}
|
|
||||||
|
|
||||||
state State3_____________
|
|
||||||
{
|
|
||||||
c7
|
|
||||||
}
|
|
||||||
|
|
||||||
state State4_____________
|
|
||||||
{
|
|
||||||
c2
|
|
||||||
}
|
|
||||||
|
|
||||||
state State5_____________
|
|
||||||
{
|
|
||||||
c3
|
|
||||||
}
|
|
||||||
|
|
||||||
state State6_____________
|
|
||||||
{
|
|
||||||
c4
|
|
||||||
}
|
|
||||||
|
|
||||||
state State7_____________
|
|
||||||
{
|
|
||||||
c5
|
|
||||||
}
|
|
||||||
|
|
||||||
state State8_____________
|
|
||||||
{
|
|
||||||
c6
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[*] --> State1_____________
|
|
||||||
State1_____________ --> State2_____________ : Transition1_____
|
|
||||||
State2_____________ --> State4_____________ : Transition2_____
|
|
||||||
State2_____________ --> State3_____________ : Transition3_____
|
|
||||||
State3_____________ --> State2_____________
|
|
||||||
State4_____________ --> State2_____________ : Transition5_____
|
|
||||||
State4_____________ --> State5_____________ : Transition6_____
|
|
||||||
State5_____________ --> State6_____________ : Transition7_____
|
|
||||||
State6_____________ --> State4_____________ : Transition8_____
|
|
||||||
State2_____________ --> State7_____________ : Transition4_____
|
|
||||||
State4_____________ --> State7_____________ : Transition4_____
|
|
||||||
State5_____________ --> State7_____________ : Transition4_____
|
|
||||||
State6_____________ --> State7_____________ : Transition4_____
|
|
||||||
State7_____________ --> State1_____________ : Transition9_____
|
|
||||||
State5_____________ --> State8_____________ : Transition10____
|
|
||||||
State8_____________ --> State5_____________ : Transition11____
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should render edge labels correctly with multiple transitions', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`---
|
|
||||||
title: Multiple Transitions
|
|
||||||
config:
|
|
||||||
look: default
|
|
||||||
theme: default
|
|
||||||
---
|
|
||||||
|
|
||||||
stateDiagram-v2
|
|
||||||
|
|
||||||
state State1_____________
|
|
||||||
{
|
|
||||||
c0
|
|
||||||
}
|
|
||||||
|
|
||||||
state State2_____________
|
|
||||||
{
|
|
||||||
c1
|
|
||||||
}
|
|
||||||
|
|
||||||
state State3_____________
|
|
||||||
{
|
|
||||||
c7
|
|
||||||
}
|
|
||||||
|
|
||||||
state State4_____________
|
|
||||||
{
|
|
||||||
c2
|
|
||||||
}
|
|
||||||
|
|
||||||
state State5_____________
|
|
||||||
{
|
|
||||||
c3
|
|
||||||
}
|
|
||||||
|
|
||||||
state State6_____________
|
|
||||||
{
|
|
||||||
c4
|
|
||||||
}
|
|
||||||
|
|
||||||
state State7_____________
|
|
||||||
{
|
|
||||||
c5
|
|
||||||
}
|
|
||||||
|
|
||||||
state State8_____________
|
|
||||||
{
|
|
||||||
c6
|
|
||||||
}
|
|
||||||
|
|
||||||
state State9_____________
|
|
||||||
{
|
|
||||||
c9
|
|
||||||
}
|
|
||||||
|
|
||||||
[*] --> State1_____________
|
|
||||||
State1_____________ --> State2_____________ : Transition1_____
|
|
||||||
State2_____________ --> State4_____________ : Transition2_____
|
|
||||||
State2_____________ --> State3_____________ : Transition3_____
|
|
||||||
State3_____________ --> State2_____________
|
|
||||||
State4_____________ --> State2_____________ : Transition5_____
|
|
||||||
State4_____________ --> State5_____________ : Transition6_____
|
|
||||||
State5_____________ --> State6_____________ : Transition7_____
|
|
||||||
State6_____________ --> State4_____________ : Transition8_____
|
|
||||||
State2_____________ --> State7_____________ : Transition4_____
|
|
||||||
State4_____________ --> State7_____________ : Transition4_____
|
|
||||||
State5_____________ --> State7_____________ : Transition4_____
|
|
||||||
State6_____________ --> State7_____________ : Transition4_____
|
|
||||||
State7_____________ --> State1_____________ : Transition9_____
|
|
||||||
State5_____________ --> State8_____________ : Transition10____
|
|
||||||
State8_____________ --> State5_____________ : Transition11____
|
|
||||||
State9_____________ --> State8_____________ : Transition12____
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render edge labels correctly with multiple states', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`---
|
|
||||||
title: Multiple States
|
|
||||||
config:
|
|
||||||
look: default
|
|
||||||
theme: default
|
|
||||||
---
|
|
||||||
|
|
||||||
stateDiagram-v2
|
|
||||||
|
|
||||||
state State1_____________
|
|
||||||
{
|
|
||||||
c0
|
|
||||||
}
|
|
||||||
|
|
||||||
state State2_____________
|
|
||||||
{
|
|
||||||
c1
|
|
||||||
}
|
|
||||||
|
|
||||||
state State3_____________
|
|
||||||
{
|
|
||||||
c7
|
|
||||||
}
|
|
||||||
|
|
||||||
state State4_____________
|
|
||||||
{
|
|
||||||
c2
|
|
||||||
}
|
|
||||||
|
|
||||||
state State5_____________
|
|
||||||
{
|
|
||||||
c3
|
|
||||||
}
|
|
||||||
|
|
||||||
state State6_____________
|
|
||||||
{
|
|
||||||
c4
|
|
||||||
}
|
|
||||||
|
|
||||||
state State7_____________
|
|
||||||
{
|
|
||||||
c5
|
|
||||||
}
|
|
||||||
|
|
||||||
state State8_____________
|
|
||||||
{
|
|
||||||
c6
|
|
||||||
}
|
|
||||||
|
|
||||||
state State9_____________
|
|
||||||
{
|
|
||||||
c9
|
|
||||||
}
|
|
||||||
|
|
||||||
state State10_____________
|
|
||||||
{
|
|
||||||
c10
|
|
||||||
}
|
|
||||||
|
|
||||||
[*] --> State1_____________
|
|
||||||
State1_____________ --> State2_____________ : Transition1_____
|
|
||||||
State2_____________ --> State3_____________ : Transition2_____
|
|
||||||
State3_____________ --> State4_____________ : Transition3_____
|
|
||||||
State4_____________ --> State5_____________ : Transition4_____
|
|
||||||
State5_____________ --> State6_____________ : Transition5_____
|
|
||||||
State6_____________ --> State7_____________ : Transition6_____
|
|
||||||
State7_____________ --> State8_____________ : Transition7_____
|
|
||||||
State8_____________ --> State9_____________ : Transition8_____
|
|
||||||
State9_____________ --> State10_____________ : Transition9_____
|
|
||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('XY Chart', () => {
|
describe('XY Chart', () => {
|
||||||
it('should render the simplest possible xy-beta chart', () => {
|
it('should render the simplest possible chart', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart-beta
|
xychart-beta
|
||||||
@@ -10,19 +10,10 @@ describe('XY Chart', () => {
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should render the simplest possible xy chart', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`
|
|
||||||
xychart
|
|
||||||
line [10, 30, 20]
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('Should render a complete chart', () => {
|
it('Should render a complete chart', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -35,7 +26,7 @@ describe('XY Chart', () => {
|
|||||||
it('Should render a chart without title', () => {
|
it('Should render a chart without title', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart
|
xychart-beta
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
||||||
@@ -47,7 +38,7 @@ describe('XY Chart', () => {
|
|||||||
it('y-axis title not required', () => {
|
it('y-axis title not required', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart
|
xychart-beta
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis 4000 --> 11000
|
y-axis 4000 --> 11000
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
|
||||||
@@ -59,7 +50,7 @@ describe('XY Chart', () => {
|
|||||||
it('Should render a chart without y-axis with different range', () => {
|
it('Should render a chart without y-axis with different range', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart
|
xychart-beta
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 14000, 3200, 9200, 9900, 3400, 6000]
|
bar [5000, 6000, 7500, 8200, 9500, 10500, 14000, 3200, 9200, 9900, 3400, 6000]
|
||||||
line [2000, 7000, 6500, 9200, 9500, 7500, 11000, 10200, 3200, 8500, 7000, 8800]
|
line [2000, 7000, 6500, 9200, 9500, 7500, 11000, 10200, 3200, 8500, 7000, 8800]
|
||||||
@@ -70,7 +61,7 @@ describe('XY Chart', () => {
|
|||||||
it('x axis title not required', () => {
|
it('x axis title not required', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart
|
xychart-beta
|
||||||
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
bar [5000, 6000, 7500, 8200, 9500, 10500, 14000, 3200, 9200, 9900, 3400, 6000]
|
bar [5000, 6000, 7500, 8200, 9500, 10500, 14000, 3200, 9200, 9900, 3400, 6000]
|
||||||
line [2000, 7000, 6500, 9200, 9500, 7500, 11000, 10200, 3200, 8500, 7000, 8800]
|
line [2000, 7000, 6500, 9200, 9500, 7500, 11000, 10200, 3200, 8500, 7000, 8800]
|
||||||
@@ -81,7 +72,7 @@ describe('XY Chart', () => {
|
|||||||
it('Multiple plots can be rendered', () => {
|
it('Multiple plots can be rendered', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart
|
xychart-beta
|
||||||
line [23, 46, 77, 34]
|
line [23, 46, 77, 34]
|
||||||
line [45, 32, 33, 12]
|
line [45, 32, 33, 12]
|
||||||
bar [87, 54, 99, 85]
|
bar [87, 54, 99, 85]
|
||||||
@@ -95,7 +86,7 @@ describe('XY Chart', () => {
|
|||||||
it('Decimals and negative numbers are supported', () => {
|
it('Decimals and negative numbers are supported', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart
|
xychart-beta
|
||||||
y-axis -2.4 --> 3.5
|
y-axis -2.4 --> 3.5
|
||||||
line [+1.3, .6, 2.4, -.34]
|
line [+1.3, .6, 2.4, -.34]
|
||||||
`,
|
`,
|
||||||
@@ -113,7 +104,7 @@ describe('XY Chart', () => {
|
|||||||
height: 20
|
height: 20
|
||||||
plotReservedSpacePercent: 100
|
plotReservedSpacePercent: 100
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
line [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
line [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
@@ -139,7 +130,7 @@ describe('XY Chart', () => {
|
|||||||
showTick: false
|
showTick: false
|
||||||
showAxisLine: false
|
showAxisLine: false
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
bar [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
bar [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
@@ -149,7 +140,7 @@ describe('XY Chart', () => {
|
|||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
%%{init: {"xyChart": {"width": 1000, "height": 600, "titlePadding": 5, "titleFontSize": 10, "xAxis": {"labelFontSize": "20", "labelPadding": 10, "titleFontSize": 30, "titlePadding": 20, "tickLength": 10, "tickWidth": 5}, "yAxis": {"labelFontSize": "20", "labelPadding": 10, "titleFontSize": 30, "titlePadding": 20, "tickLength": 10, "tickWidth": 5}, "plotBorderWidth": 5, "chartOrientation": "horizontal", "plotReservedSpacePercent": 60 }}}%%
|
%%{init: {"xyChart": {"width": 1000, "height": 600, "titlePadding": 5, "titleFontSize": 10, "xAxis": {"labelFontSize": "20", "labelPadding": 10, "titleFontSize": 30, "titlePadding": 20, "tickLength": 10, "tickWidth": 5}, "yAxis": {"labelFontSize": "20", "labelPadding": 10, "titleFontSize": 30, "titlePadding": 20, "tickLength": 10, "tickWidth": 5}, "plotBorderWidth": 5, "chartOrientation": "horizontal", "plotReservedSpacePercent": 60 }}}%%
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -190,7 +181,7 @@ describe('XY Chart', () => {
|
|||||||
plotReservedSpacePercent: 60
|
plotReservedSpacePercent: 60
|
||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -211,7 +202,7 @@ describe('XY Chart', () => {
|
|||||||
yAxis:
|
yAxis:
|
||||||
showTitle: false
|
showTitle: false
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -232,7 +223,7 @@ describe('XY Chart', () => {
|
|||||||
yAxis:
|
yAxis:
|
||||||
showLabel: false
|
showLabel: false
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -253,7 +244,7 @@ describe('XY Chart', () => {
|
|||||||
yAxis:
|
yAxis:
|
||||||
showTick: false
|
showTick: false
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -274,7 +265,7 @@ describe('XY Chart', () => {
|
|||||||
yAxis:
|
yAxis:
|
||||||
showAxisLine: false
|
showAxisLine: false
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -303,7 +294,7 @@ describe('XY Chart', () => {
|
|||||||
xAxisLineColor: "#87ceeb"
|
xAxisLineColor: "#87ceeb"
|
||||||
plotColorPalette: "#008000, #faba63"
|
plotColorPalette: "#008000, #faba63"
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -316,7 +307,7 @@ describe('XY Chart', () => {
|
|||||||
it('should use the correct distances between data points', () => {
|
it('should use the correct distances between data points', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart
|
xychart-beta
|
||||||
x-axis 0 --> 2
|
x-axis 0 --> 2
|
||||||
line [0, 1, 0, 1]
|
line [0, 1, 0, 1]
|
||||||
bar [1, 0, 1, 0]
|
bar [1, 0, 1, 0]
|
||||||
@@ -334,7 +325,7 @@ describe('XY Chart', () => {
|
|||||||
xyChart:
|
xyChart:
|
||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -353,7 +344,7 @@ describe('XY Chart', () => {
|
|||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
chartOrientation: horizontal
|
chartOrientation: horizontal
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -366,7 +357,7 @@ describe('XY Chart', () => {
|
|||||||
it('should render vertical bar chart without labels by default', () => {
|
it('should render vertical bar chart without labels by default', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -384,7 +375,7 @@ describe('XY Chart', () => {
|
|||||||
xyChart:
|
xyChart:
|
||||||
chartOrientation: horizontal
|
chartOrientation: horizontal
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -402,7 +393,7 @@ describe('XY Chart', () => {
|
|||||||
xyChart:
|
xyChart:
|
||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Multiple Bar Plots"
|
title "Multiple Bar Plots"
|
||||||
x-axis Categories [A, B, C]
|
x-axis Categories [A, B, C]
|
||||||
y-axis "Values" 0 --> 100
|
y-axis "Values" 0 --> 100
|
||||||
@@ -421,7 +412,7 @@ describe('XY Chart', () => {
|
|||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
chartOrientation: horizontal
|
chartOrientation: horizontal
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Multiple Bar Plots"
|
title "Multiple Bar Plots"
|
||||||
x-axis Categories [A, B, C]
|
x-axis Categories [A, B, C]
|
||||||
y-axis "Values" 0 --> 100
|
y-axis "Values" 0 --> 100
|
||||||
@@ -439,7 +430,7 @@ describe('XY Chart', () => {
|
|||||||
xyChart:
|
xyChart:
|
||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Single Bar Chart"
|
title "Single Bar Chart"
|
||||||
x-axis Categories [A]
|
x-axis Categories [A]
|
||||||
y-axis "Value" 0 --> 100
|
y-axis "Value" 0 --> 100
|
||||||
@@ -458,7 +449,7 @@ describe('XY Chart', () => {
|
|||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
chartOrientation: horizontal
|
chartOrientation: horizontal
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Single Bar Chart"
|
title "Single Bar Chart"
|
||||||
x-axis Categories [A]
|
x-axis Categories [A]
|
||||||
y-axis "Value" 0 --> 100
|
y-axis "Value" 0 --> 100
|
||||||
@@ -476,7 +467,7 @@ describe('XY Chart', () => {
|
|||||||
xyChart:
|
xyChart:
|
||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Decimal and Negative Values"
|
title "Decimal and Negative Values"
|
||||||
x-axis Categories [A, B, C]
|
x-axis Categories [A, B, C]
|
||||||
y-axis -10 --> 10
|
y-axis -10 --> 10
|
||||||
@@ -495,7 +486,7 @@ describe('XY Chart', () => {
|
|||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
chartOrientation: horizontal
|
chartOrientation: horizontal
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Decimal and Negative Values"
|
title "Decimal and Negative Values"
|
||||||
x-axis Categories [A, B, C]
|
x-axis Categories [A, B, C]
|
||||||
y-axis -10 --> 10
|
y-axis -10 --> 10
|
||||||
@@ -513,7 +504,7 @@ describe('XY Chart', () => {
|
|||||||
xyChart:
|
xyChart:
|
||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan,b,c]
|
x-axis Months [jan,b,c]
|
||||||
y-axis "Revenue (in $)" 4000 --> 12000
|
y-axis "Revenue (in $)" 4000 --> 12000
|
||||||
@@ -570,7 +561,7 @@ describe('XY Chart', () => {
|
|||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
chartOrientation: horizontal
|
chartOrientation: horizontal
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan,b,c]
|
x-axis Months [jan,b,c]
|
||||||
y-axis "Revenue (in $)" 4000 --> 12000
|
y-axis "Revenue (in $)" 4000 --> 12000
|
||||||
@@ -624,7 +615,7 @@ describe('XY Chart', () => {
|
|||||||
xyChart:
|
xyChart:
|
||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
|
x-axis Months [jan,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
|
||||||
y-axis "Revenue (in $)" 4000 --> 12000
|
y-axis "Revenue (in $)" 4000 --> 12000
|
||||||
@@ -681,7 +672,7 @@ describe('XY Chart', () => {
|
|||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
chartOrientation: horizontal
|
chartOrientation: horizontal
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
|
x-axis Months [jan,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
|
||||||
y-axis "Revenue (in $)" 4000 --> 12000
|
y-axis "Revenue (in $)" 4000 --> 12000
|
||||||
@@ -735,7 +726,7 @@ describe('XY Chart', () => {
|
|||||||
xyChart:
|
xyChart:
|
||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan]
|
x-axis Months [jan]
|
||||||
y-axis "Revenue (in $)" 3000 --> 12000
|
y-axis "Revenue (in $)" 3000 --> 12000
|
||||||
@@ -792,7 +783,7 @@ describe('XY Chart', () => {
|
|||||||
showDataLabel: true
|
showDataLabel: true
|
||||||
chartOrientation: horizontal
|
chartOrientation: horizontal
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan]
|
x-axis Months [jan]
|
||||||
y-axis "Revenue (in $)" 3000 --> 12000
|
y-axis "Revenue (in $)" 3000 --> 12000
|
||||||
|
@@ -1,35 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<title>Mermaid Quick Test Page</title>
|
|
||||||
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
|
||||||
<style>
|
|
||||||
div.mermaid {
|
|
||||||
font-family: 'Courier New', Courier, monospace !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1>Pie chart demos</h1>
|
|
||||||
<pre class="mermaid">
|
|
||||||
pie title Default text position: Animal adoption
|
|
||||||
accTitle: simple pie char demo
|
|
||||||
accDescr: pie chart with 3 sections: dogs, cats, rats. Most are dogs.
|
|
||||||
"dogs" : -60.67
|
|
||||||
"rats" : 40.12
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
<script type="module">
|
|
||||||
import mermaid from '/mermaid.esm.mjs';
|
|
||||||
mermaid.initialize({
|
|
||||||
theme: 'forest',
|
|
||||||
logLevel: 3,
|
|
||||||
securityLevel: 'loose',
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -32,8 +32,26 @@
|
|||||||
href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap"
|
href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap"
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
/>
|
/>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Recursive:wght@300..1000&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.recursive-mermaid {
|
||||||
|
font-family: 'Recursive', sans-serif;
|
||||||
|
font-optical-sizing: auto;
|
||||||
|
font-weight: 500;
|
||||||
|
font-style: normal;
|
||||||
|
font-variation-settings:
|
||||||
|
'slnt' 0,
|
||||||
|
'CASL' 0,
|
||||||
|
'CRSV' 0.5,
|
||||||
|
'MONO' 0;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
/* background: rgb(221, 208, 208); */
|
/* background: rgb(221, 208, 208); */
|
||||||
/* background: #333; */
|
/* background: #333; */
|
||||||
@@ -45,7 +63,9 @@
|
|||||||
h1 {
|
h1 {
|
||||||
color: grey;
|
color: grey;
|
||||||
}
|
}
|
||||||
|
.mermaid {
|
||||||
|
border: 1px solid red;
|
||||||
|
}
|
||||||
.mermaid2 {
|
.mermaid2 {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -83,6 +103,11 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.class2 {
|
||||||
|
fill: red;
|
||||||
|
fill-opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* tspan {
|
/* tspan {
|
||||||
font-size: 6px !important;
|
font-size: 6px !important;
|
||||||
} */
|
} */
|
||||||
@@ -106,210 +131,6 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid">
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
flowchart-elk TB
|
|
||||||
c1-->a2
|
|
||||||
subgraph one
|
|
||||||
a1-->a2
|
|
||||||
end
|
|
||||||
subgraph two
|
|
||||||
b1-->b2
|
|
||||||
end
|
|
||||||
subgraph three
|
|
||||||
c1-->c2
|
|
||||||
end
|
|
||||||
one --> two
|
|
||||||
three --> two
|
|
||||||
two --> c2
|
|
||||||
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
flowchart TB
|
|
||||||
|
|
||||||
process_C
|
|
||||||
subgraph container_Alpha
|
|
||||||
subgraph process_B
|
|
||||||
pppB
|
|
||||||
end
|
|
||||||
subgraph process_A
|
|
||||||
pppA
|
|
||||||
end
|
|
||||||
process_B-->|via_AWSBatch|container_Beta
|
|
||||||
process_A-->|messages|container_Beta
|
|
||||||
end
|
|
||||||
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
flowchart TB
|
|
||||||
subgraph container_Beta
|
|
||||||
process_C
|
|
||||||
end
|
|
||||||
subgraph container_Alpha
|
|
||||||
subgraph process_B
|
|
||||||
pppB
|
|
||||||
end
|
|
||||||
subgraph process_A
|
|
||||||
pppA
|
|
||||||
end
|
|
||||||
process_B-->|via_AWSBatch|container_Beta
|
|
||||||
process_A-->|messages|container_Beta
|
|
||||||
end
|
|
||||||
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
flowchart TB
|
|
||||||
subgraph container_Beta
|
|
||||||
process_C
|
|
||||||
end
|
|
||||||
|
|
||||||
process_B-->|via_AWSBatch|container_Beta
|
|
||||||
|
|
||||||
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
classDiagram
|
|
||||||
note "I love this diagram!\nDo you love it?"
|
|
||||||
Class01 <|-- AveryLongClass : Cool
|
|
||||||
<<interface>> Class01
|
|
||||||
Class03 "1" *-- "*" Class04
|
|
||||||
Class05 "1" o-- "many" Class06
|
|
||||||
Class07 "1" .. "*" Class08
|
|
||||||
Class09 "1" --> "*" C2 : Where am i?
|
|
||||||
Class09 "*" --* "*" C3
|
|
||||||
Class09 "1" --|> "1" Class07
|
|
||||||
Class12 <|.. Class08
|
|
||||||
Class11 ..>Class12
|
|
||||||
Class07 : equals()
|
|
||||||
Class07 : Object[] elementData
|
|
||||||
Class01 : size()
|
|
||||||
Class01 : int chimp
|
|
||||||
Class01 : int gorilla
|
|
||||||
Class01 : -int privateChimp
|
|
||||||
Class01 : +int publicGorilla
|
|
||||||
Class01 : #int protectedMarmoset
|
|
||||||
Class08 <--> C2: Cool label
|
|
||||||
class Class10 {
|
|
||||||
<<service>>
|
|
||||||
int id
|
|
||||||
test()
|
|
||||||
}
|
|
||||||
note for Class10 "Cool class\nI said it's very cool class!"
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
requirementDiagram
|
|
||||||
requirement test_req {
|
|
||||||
id: 1
|
|
||||||
text: the test text.
|
|
||||||
risk: high
|
|
||||||
verifymethod: test
|
|
||||||
}
|
|
||||||
|
|
||||||
element test_entity {
|
|
||||||
type: simulation
|
|
||||||
}
|
|
||||||
|
|
||||||
test_entity - satisfies -> test_req
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
flowchart-elk TB
|
|
||||||
internet
|
|
||||||
nat
|
|
||||||
router
|
|
||||||
compute1
|
|
||||||
|
|
||||||
subgraph project
|
|
||||||
router
|
|
||||||
nat
|
|
||||||
subgraph subnet1
|
|
||||||
compute1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
%% router --> subnet1
|
|
||||||
subnet1 --> nat
|
|
||||||
%% nat --> internet
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
flowchart-elk TB
|
|
||||||
internet
|
|
||||||
nat
|
|
||||||
router
|
|
||||||
lb1
|
|
||||||
lb2
|
|
||||||
compute1
|
|
||||||
compute2
|
|
||||||
subgraph project
|
|
||||||
router
|
|
||||||
nat
|
|
||||||
subgraph subnet1
|
|
||||||
compute1
|
|
||||||
lb1
|
|
||||||
end
|
|
||||||
subgraph subnet2
|
|
||||||
compute2
|
|
||||||
lb2
|
|
||||||
end
|
|
||||||
end
|
|
||||||
internet --> router
|
|
||||||
router --> subnet1 & subnet2
|
|
||||||
subnet1 & subnet2 --> nat --> internet
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
elk:
|
|
||||||
mergeEdges: false
|
|
||||||
forceNodeModelOrder: false
|
|
||||||
considerModelOrder: NONE
|
|
||||||
|
|
||||||
---
|
|
||||||
flowchart TB
|
|
||||||
a --> a1 & a2 & a3 & a4
|
|
||||||
b --> b1 & b2
|
|
||||||
b2 --> b3
|
|
||||||
b1 --> b4</pre
|
|
||||||
>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
treemap
|
treemap
|
||||||
"Section 1"
|
"Section 1"
|
||||||
"Leaf 1.1": 12
|
"Leaf 1.1": 12
|
||||||
@@ -320,149 +141,84 @@ treemap
|
|||||||
"Leaf 2.2": 25
|
"Leaf 2.2": 25
|
||||||
"Leaf 2.3": 12
|
"Leaf 2.3": 12
|
||||||
|
|
||||||
</pre>
|
classDef class1 fill:red,color:blue,stroke:#FFD600;
|
||||||
<pre id="diagram5" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
flowchart:
|
|
||||||
curve: rounded
|
|
||||||
---
|
|
||||||
flowchart LR
|
|
||||||
I["fa:fa-code Text"] -- Mermaid js --> D["Use<br/>the<br/>editor!"]
|
|
||||||
I --> D & D
|
|
||||||
D@{ shape: question}
|
|
||||||
I@{ shape: question}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
Origins
|
|
||||||
Long history
|
|
||||||
::icon(fa fa-book)
|
|
||||||
Popularisation
|
|
||||||
British popular psychology author Tony Buzan
|
|
||||||
Research
|
|
||||||
On effectiveness<br/>and features
|
|
||||||
On Automatic creation
|
|
||||||
Uses
|
|
||||||
Creative techniques
|
|
||||||
Strategic planning
|
|
||||||
Argument mapping
|
|
||||||
Tools
|
|
||||||
Pen and paper
|
|
||||||
Mermaid
|
|
||||||
|
|
||||||
</pre>
|
</pre
|
||||||
<pre id="diagram4" class="mermaid">
|
>
|
||||||
---
|
<pre id="diagram4" class="mermaid2">
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
flowchart:
|
|
||||||
curve: linear
|
|
||||||
---
|
|
||||||
flowchart LR
|
|
||||||
A[A] --> B[B]
|
|
||||||
A[A] --- B([C])
|
|
||||||
A@{ shape: diamond}
|
|
||||||
%%B@{ shape: diamond}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
flowchart:
|
|
||||||
curve: linear
|
|
||||||
---
|
|
||||||
flowchart LR
|
|
||||||
A[A] -- Mermaid js --> B[B]
|
|
||||||
A[A] -- Mermaid js --- B[B]
|
|
||||||
A@{ shape: diamond}
|
|
||||||
B@{ shape: diamond}
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
flowchart:
|
|
||||||
curve: rounded
|
|
||||||
---
|
|
||||||
flowchart LR
|
|
||||||
D["Use the editor"] -- Mermaid js --> I["fa:fa-code Text"]
|
|
||||||
I --> D & D
|
|
||||||
D@{ shape: question}
|
|
||||||
I@{ shape: question}
|
|
||||||
</pre>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
flowchart:
|
|
||||||
curve: rounded
|
|
||||||
elk:
|
|
||||||
nodePlacementStrategy: NETWORK_SIMPLEX
|
|
||||||
---
|
|
||||||
flowchart LR
|
|
||||||
D["Use the editor"] -- Mermaid js --> I["fa:fa-code Text"]
|
|
||||||
D --> I & I
|
|
||||||
a["a"]
|
|
||||||
D@{ shape: trap-b}
|
|
||||||
I@{ shape: lean-l}
|
|
||||||
</pre>
|
|
||||||
<pre id="diagram4" class="mermaid">
|
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
layout: elk
|
treemap:
|
||||||
|
valueFormat: '$0,0'
|
||||||
---
|
---
|
||||||
flowchart LR
|
treemap
|
||||||
%% subgraph s1["Untitled subgraph"]
|
"Budget"
|
||||||
C["Evaluate"]
|
"Operations"
|
||||||
%% end
|
"Salaries": 7000
|
||||||
|
"Equipment": 2000
|
||||||
|
"Supplies": 1000
|
||||||
|
"Marketing"
|
||||||
|
"Advertising": 4000
|
||||||
|
"Events": 1000
|
||||||
|
|
||||||
B --> C
|
</pre
|
||||||
</pre>
|
>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid">
|
||||||
---
|
treemap
|
||||||
config:
|
title Accessible Treemap Title
|
||||||
layout: elk
|
"Category A"
|
||||||
flowchart:
|
"Item A1": 10
|
||||||
//curve: linear
|
"Item A2": 20
|
||||||
---
|
"Category B"
|
||||||
flowchart LR
|
"Item B1": 15
|
||||||
%% A ==> B
|
"Item B2": 25
|
||||||
%% A2 --> B2
|
|
||||||
A{A} --> B((Bo boo)) & B & B & B
|
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
theme: default
|
|
||||||
look: classic
|
|
||||||
---
|
|
||||||
flowchart LR
|
flowchart LR
|
||||||
subgraph s1["APA"]
|
AB["apa@apa@"] --> B(("`apa@apa`"))
|
||||||
D{"Use the editor"}
|
|
||||||
end
|
|
||||||
subgraph S2["S2"]
|
|
||||||
s1
|
|
||||||
I>"fa:fa-code Text"]
|
|
||||||
E["E"]
|
|
||||||
end
|
|
||||||
D -- Mermaid js --> I
|
|
||||||
D --> I & E
|
|
||||||
E --> I
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
|
flowchart
|
||||||
|
D(("for D"))
|
||||||
|
</pre>
|
||||||
|
<pre id="diagram4" class="mermaid2">
|
||||||
|
flowchart LR
|
||||||
|
A e1@==> B
|
||||||
|
e1@{ animate: true}
|
||||||
|
</pre>
|
||||||
|
<pre id="diagram4" class="mermaid2">
|
||||||
|
flowchart LR
|
||||||
|
A e1@--> B
|
||||||
|
classDef animate stroke-width:2,stroke-dasharray:10\,8,stroke-dashoffset:-180,animation: edge-animation-frame 6s linear infinite, stroke-linecap: round
|
||||||
|
class e1 animate
|
||||||
|
</pre>
|
||||||
|
<h2>infinite</h2>
|
||||||
|
<pre id="diagram4" class="mermaid2">
|
||||||
|
flowchart LR
|
||||||
|
A e1@--> B
|
||||||
|
classDef animate stroke-dasharray: 9\,5,stroke-dashoffset: 900,animation: dash 25s linear infinite;
|
||||||
|
class e1 animate
|
||||||
|
</pre>
|
||||||
|
<h2>Mermaid - edge-animation-slow</h2>
|
||||||
|
<pre id="diagram4" class="mermaid2">
|
||||||
|
flowchart LR
|
||||||
|
A e1@--> B
|
||||||
|
e1@{ animation: fast}
|
||||||
|
</pre>
|
||||||
|
<h2>Mermaid - edge-animation-fast</h2>
|
||||||
|
<pre id="diagram4" class="mermaid2">
|
||||||
|
flowchart LR
|
||||||
|
A e1@--> B
|
||||||
|
classDef animate stroke-dasharray: 1000,stroke-dashoffset: 1000,animation: dash 10s linear;
|
||||||
|
class e1 edge-animation-fast
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<pre id="diagram4" class="mermaid2">
|
||||||
|
|
||||||
|
info </pre
|
||||||
|
>
|
||||||
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
layout: elk
|
layout: elk
|
||||||
@@ -487,7 +243,7 @@ config:
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
layout: elk
|
layout: elk
|
||||||
@@ -500,7 +256,7 @@ config:
|
|||||||
D-->I
|
D-->I
|
||||||
D-->I
|
D-->I
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
layout: elk
|
layout: elk
|
||||||
@@ -539,7 +295,7 @@ flowchart LR
|
|||||||
n8@{ shape: rect}
|
n8@{ shape: rect}
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
layout: elk
|
layout: elk
|
||||||
@@ -555,7 +311,7 @@ flowchart LR
|
|||||||
|
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
layout: elk
|
layout: elk
|
||||||
@@ -564,7 +320,7 @@ flowchart LR
|
|||||||
A{A} --> B & C
|
A{A} --> B & C
|
||||||
</pre
|
</pre
|
||||||
>
|
>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
layout: elk
|
layout: elk
|
||||||
@@ -576,7 +332,7 @@ flowchart LR
|
|||||||
end
|
end
|
||||||
</pre
|
</pre
|
||||||
>
|
>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
layout: elk
|
layout: elk
|
||||||
@@ -594,7 +350,7 @@ flowchart LR
|
|||||||
|
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
kanban:
|
kanban:
|
||||||
@@ -613,81 +369,81 @@ kanban
|
|||||||
task3[💻 Develop login feature]@{ ticket: 103 }
|
task3[💻 Develop login feature]@{ ticket: 103 }
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Default] --> A@{ icon: 'fa:bell', form: 'rounded' }
|
nA[Default] --> A@{ icon: 'fa:bell', form: 'rounded' }
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Style] --> A@{ icon: 'fa:bell', form: 'rounded' }
|
nA[Style] --> A@{ icon: 'fa:bell', form: 'rounded' }
|
||||||
style A fill:#f9f,stroke:#333,stroke-width:4px
|
style A fill:#f9f,stroke:#333,stroke-width:4px
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Class] --> A@{ icon: 'fa:bell', form: 'rounded' }
|
nA[Class] --> A@{ icon: 'fa:bell', form: 'rounded' }
|
||||||
A:::AClass
|
A:::AClass
|
||||||
classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
|
classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Class] --> A@{ icon: 'logos:aws', form: 'rounded' }
|
nA[Class] --> A@{ icon: 'logos:aws', form: 'rounded' }
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Default] --> A@{ icon: 'fa:bell', form: 'square' }
|
nA[Default] --> A@{ icon: 'fa:bell', form: 'square' }
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Style] --> A@{ icon: 'fa:bell', form: 'square' }
|
nA[Style] --> A@{ icon: 'fa:bell', form: 'square' }
|
||||||
style A fill:#f9f,stroke:#333,stroke-width:4px
|
style A fill:#f9f,stroke:#333,stroke-width:4px
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Class] --> A@{ icon: 'fa:bell', form: 'square' }
|
nA[Class] --> A@{ icon: 'fa:bell', form: 'square' }
|
||||||
A:::AClass
|
A:::AClass
|
||||||
classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
|
classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Class] --> A@{ icon: 'logos:aws', form: 'square' }
|
nA[Class] --> A@{ icon: 'logos:aws', form: 'square' }
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Default] --> A@{ icon: 'fa:bell', form: 'circle' }
|
nA[Default] --> A@{ icon: 'fa:bell', form: 'circle' }
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Style] --> A@{ icon: 'fa:bell', form: 'circle' }
|
nA[Style] --> A@{ icon: 'fa:bell', form: 'circle' }
|
||||||
style A fill:#f9f,stroke:#333,stroke-width:4px
|
style A fill:#f9f,stroke:#333,stroke-width:4px
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Class] --> A@{ icon: 'fa:bell', form: 'circle' }
|
nA[Class] --> A@{ icon: 'fa:bell', form: 'circle' }
|
||||||
A:::AClass
|
A:::AClass
|
||||||
classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
|
classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Class] --> A@{ icon: 'logos:aws', form: 'circle' }
|
nA[Class] --> A@{ icon: 'logos:aws', form: 'circle' }
|
||||||
A:::AClass
|
A:::AClass
|
||||||
classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
|
classDef AClass fill:#f9f,stroke:#333,stroke-width:4px
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
nA[Style] --> A@{ icon: 'logos:aws', form: 'circle' }
|
nA[Style] --> A@{ icon: 'logos:aws', form: 'circle' }
|
||||||
style A fill:#f9f,stroke:#333,stroke-width:4px
|
style A fill:#f9f,stroke:#333,stroke-width:4px
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
kanban
|
kanban
|
||||||
id2[In progress]
|
id2[In progress]
|
||||||
docs[Create Blog about the new diagram]@{ priority: 'Very Low', ticket: MC-2037, assigned: 'knsv' }
|
docs[Create Blog about the new diagram]@{ priority: 'Very Low', ticket: MC-2037, assigned: 'knsv' }
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram4" class="mermaid">
|
<pre id="diagram4" class="mermaid2">
|
||||||
---
|
---
|
||||||
config:
|
config:
|
||||||
kanban:
|
kanban:
|
||||||
@@ -751,22 +507,18 @@ kanban
|
|||||||
alert('It worked');
|
alert('It worked');
|
||||||
}
|
}
|
||||||
await mermaid.initialize({
|
await mermaid.initialize({
|
||||||
// theme: 'base',
|
// theme: 'forest',
|
||||||
// theme: 'default',
|
// theme: 'default',
|
||||||
// theme: 'forest',
|
// theme: 'forest',
|
||||||
// handDrawnSeed: 12,
|
// handDrawnSeed: 12,
|
||||||
// look: 'handDrawn',
|
// look: 'handDrawn',
|
||||||
// 'elk.nodePlacement.strategy': 'NETWORK_SIMPLEX',
|
// 'elk.nodePlacement.strategy': 'NETWORK_SIMPLEX',
|
||||||
// layout: 'dagre',
|
// layout: 'dagre',
|
||||||
layout: 'elk',
|
// layout: 'elk',
|
||||||
// layout: 'fixed',
|
// layout: 'fixed',
|
||||||
// htmlLabels: false,
|
// htmlLabels: false,
|
||||||
flowchart: { titleTopMargin: 10 },
|
flowchart: { titleTopMargin: 10 },
|
||||||
|
fontFamily: "'Recursive', sans-serif",
|
||||||
// fontFamily: 'Caveat',
|
|
||||||
// fontFamily: 'Kalam',
|
|
||||||
// fontFamily: 'courier',
|
|
||||||
fontFamily: 'arial',
|
|
||||||
sequence: {
|
sequence: {
|
||||||
actorFontFamily: 'courier',
|
actorFontFamily: 'courier',
|
||||||
noteFontFamily: 'courier',
|
noteFontFamily: 'courier',
|
||||||
|
@@ -1,376 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<title>Mermaid Quick Test Page</title>
|
|
||||||
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
|
||||||
<style>
|
|
||||||
div.mermaid {
|
|
||||||
font-family: 'Courier New', Courier, monospace !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: dagre
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: cose-bilkent
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap is a long thing))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
C
|
|
||||||
D
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: dagre
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap is a long thing))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
C
|
|
||||||
D
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap is a long thing))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
C
|
|
||||||
D
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: cose-bilkent
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap is a long thing))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
C
|
|
||||||
D
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
Origins
|
|
||||||
Long history
|
|
||||||
::icon(fa fa-book)
|
|
||||||
Popularisation
|
|
||||||
British popular psychology author Tony Buzan
|
|
||||||
Research
|
|
||||||
On effectiveness<br/>and features
|
|
||||||
On Automatic creation
|
|
||||||
Uses
|
|
||||||
Creative techniques
|
|
||||||
Strategic planning
|
|
||||||
Argument mapping
|
|
||||||
Tools
|
|
||||||
id)I am a cloud(
|
|
||||||
id))I am a bang((
|
|
||||||
Tools
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: dagre
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
Origins
|
|
||||||
Long history
|
|
||||||
::icon(fa fa-book)
|
|
||||||
Popularisation
|
|
||||||
British popular psychology author Tony Buzan
|
|
||||||
Research
|
|
||||||
On effectiveness<br/>and features
|
|
||||||
On Automatic creation
|
|
||||||
Uses
|
|
||||||
Creative techniques
|
|
||||||
Strategic planning
|
|
||||||
Argument mapping
|
|
||||||
Tools
|
|
||||||
id)I am a cloud(
|
|
||||||
id))I am a bang((
|
|
||||||
Tools
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
Origins
|
|
||||||
Long history
|
|
||||||
::icon(fa fa-book)
|
|
||||||
Popularisation
|
|
||||||
British popular psychology author Tony Buzan
|
|
||||||
Research
|
|
||||||
On effectiveness<br/>and features
|
|
||||||
On Automatic creation
|
|
||||||
Uses
|
|
||||||
Creative techniques
|
|
||||||
Strategic planning
|
|
||||||
Argument mapping
|
|
||||||
Tools
|
|
||||||
id)I am a cloud(
|
|
||||||
id))I am a bang((
|
|
||||||
Tools
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: cose-bilkent
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
Origins
|
|
||||||
Long history
|
|
||||||
::icon(fa fa-book)
|
|
||||||
Popularisation
|
|
||||||
British popular psychology author Tony Buzan
|
|
||||||
Research
|
|
||||||
On effectiveness<br/>and features
|
|
||||||
On Automatic creation
|
|
||||||
Uses
|
|
||||||
Creative techniques
|
|
||||||
Strategic planning
|
|
||||||
Argument mapping
|
|
||||||
Tools
|
|
||||||
id)I am a cloud(
|
|
||||||
id))I am a bang((
|
|
||||||
Tools
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
a
|
|
||||||
apa[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
apa2[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
b
|
|
||||||
c
|
|
||||||
d
|
|
||||||
B
|
|
||||||
apa3[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
D
|
|
||||||
apa5[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
apa4[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: dagre
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
a
|
|
||||||
apa[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
apa2[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
b
|
|
||||||
c
|
|
||||||
d
|
|
||||||
B
|
|
||||||
apa3[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
D
|
|
||||||
apa5[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
apa4[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
a
|
|
||||||
apa[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
apa2[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
b
|
|
||||||
c
|
|
||||||
d
|
|
||||||
B
|
|
||||||
apa3[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
D
|
|
||||||
apa5[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
apa4[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: cose-bilkent
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
a
|
|
||||||
apa[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
apa2[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
b
|
|
||||||
c
|
|
||||||
d
|
|
||||||
B
|
|
||||||
apa3[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
D
|
|
||||||
apa5[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
apa4[I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on. I am a long long multline string passing several levels of text. Lorum ipsum and so on]
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
((This is a mindmap))
|
|
||||||
child1
|
|
||||||
grandchild 1
|
|
||||||
grandchild 2
|
|
||||||
child2
|
|
||||||
grandchild 3
|
|
||||||
grandchild 4
|
|
||||||
child3
|
|
||||||
grandchild 5
|
|
||||||
grandchild 6
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: dagre
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
((This is a mindmap))
|
|
||||||
child1
|
|
||||||
grandchild 1
|
|
||||||
grandchild 2
|
|
||||||
child2
|
|
||||||
grandchild 3
|
|
||||||
grandchild 4
|
|
||||||
child3
|
|
||||||
grandchild 5
|
|
||||||
grandchild 6
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
((This is a mindmap))
|
|
||||||
child1
|
|
||||||
grandchild 1
|
|
||||||
grandchild 2
|
|
||||||
child2
|
|
||||||
grandchild 3
|
|
||||||
grandchild 4
|
|
||||||
child3
|
|
||||||
grandchild 5
|
|
||||||
grandchild 6
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<pre class="mermaid">
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: cose-bilkent
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
((This is a mindmap))
|
|
||||||
child1
|
|
||||||
grandchild 1
|
|
||||||
grandchild 2
|
|
||||||
child2
|
|
||||||
grandchild 3
|
|
||||||
grandchild 4
|
|
||||||
child3
|
|
||||||
grandchild 5
|
|
||||||
grandchild 6
|
|
||||||
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
<script type="module">
|
|
||||||
import mermaid from '/mermaid.esm.mjs';
|
|
||||||
import tidytree from '/mermaid-layout-tidy-tree.esm.mjs';
|
|
||||||
import layouts from './mermaid-layout-elk.esm.mjs';
|
|
||||||
mermaid.registerLayoutLoaders(layouts);
|
|
||||||
mermaid.registerLayoutLoaders(tidytree);
|
|
||||||
mermaid.initialize({
|
|
||||||
theme: 'default',
|
|
||||||
logLevel: 3,
|
|
||||||
securityLevel: 'loose',
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -41,6 +41,10 @@ graph TB
|
|||||||
const { svg } = await mermaid.render('d22', value);
|
const { svg } = await mermaid.render('d22', value);
|
||||||
console.log(svg);
|
console.log(svg);
|
||||||
el.innerHTML = svg;
|
el.innerHTML = svg;
|
||||||
|
// mermaid.test1('first_slow', 1200).then((r) => console.info(r));
|
||||||
|
// mermaid.test1('second_fast', 200).then((r) => console.info(r));
|
||||||
|
// mermaid.test1('third_fast', 200).then((r) => console.info(r));
|
||||||
|
// mermaid.test1('forth_slow', 1200).then((r) => console.info(r));
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import externalExample from './mermaid-example-diagram.esm.mjs';
|
import externalExample from './mermaid-example-diagram.esm.mjs';
|
||||||
import layouts from './mermaid-layout-elk.esm.mjs';
|
import layouts from './mermaid-layout-elk.esm.mjs';
|
||||||
import tidyTree from './mermaid-layout-tidy-tree.esm.mjs';
|
|
||||||
import zenUml from './mermaid-zenuml.esm.mjs';
|
import zenUml from './mermaid-zenuml.esm.mjs';
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
|
|
||||||
@@ -66,7 +65,6 @@ const contentLoaded = async function () {
|
|||||||
await mermaid.registerExternalDiagrams([externalExample, zenUml]);
|
await mermaid.registerExternalDiagrams([externalExample, zenUml]);
|
||||||
|
|
||||||
mermaid.registerLayoutLoaders(layouts);
|
mermaid.registerLayoutLoaders(layouts);
|
||||||
mermaid.registerLayoutLoaders(tidyTree);
|
|
||||||
mermaid.initialize(graphObj.mermaid);
|
mermaid.initialize(graphObj.mermaid);
|
||||||
/**
|
/**
|
||||||
* CC-BY-4.0
|
* CC-BY-4.0
|
||||||
@@ -184,7 +182,7 @@ const contentLoadedApi = async function () {
|
|||||||
for (let i = 0; i < numCodes; i++) {
|
for (let i = 0; i < numCodes; i++) {
|
||||||
const { svg, bindFunctions } = await mermaid.render('newid' + i, graphObj.code[i], divs[i]);
|
const { svg, bindFunctions } = await mermaid.render('newid' + i, graphObj.code[i], divs[i]);
|
||||||
div.innerHTML = svg;
|
div.innerHTML = svg;
|
||||||
bindFunctions?.(div);
|
bindFunctions(div);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
@@ -196,7 +194,7 @@ const contentLoadedApi = async function () {
|
|||||||
const { svg, bindFunctions } = await mermaid.render('newid', graphObj.code, div);
|
const { svg, bindFunctions } = await mermaid.render('newid', graphObj.code, div);
|
||||||
div.innerHTML = svg;
|
div.innerHTML = svg;
|
||||||
console.log(div.innerHTML);
|
console.log(div.innerHTML);
|
||||||
bindFunctions?.(div);
|
bindFunctions(div);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -2,227 +2,219 @@
|
|||||||
"durations": [
|
"durations": [
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/other/configuration.spec.js",
|
"spec": "cypress/integration/other/configuration.spec.js",
|
||||||
"duration": 5841
|
"duration": 5672
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/other/external-diagrams.spec.js",
|
"spec": "cypress/integration/other/external-diagrams.spec.js",
|
||||||
"duration": 2138
|
"duration": 1990
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/other/ghsa.spec.js",
|
"spec": "cypress/integration/other/ghsa.spec.js",
|
||||||
"duration": 3370
|
"duration": 3186
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/other/iife.spec.js",
|
"spec": "cypress/integration/other/iife.spec.js",
|
||||||
"duration": 2052
|
"duration": 1948
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/other/interaction.spec.js",
|
"spec": "cypress/integration/other/interaction.spec.js",
|
||||||
"duration": 12243
|
"duration": 11938
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/other/rerender.spec.js",
|
"spec": "cypress/integration/other/rerender.spec.js",
|
||||||
"duration": 2065
|
"duration": 1932
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/other/xss.spec.js",
|
"spec": "cypress/integration/other/xss.spec.js",
|
||||||
"duration": 31288
|
"duration": 27237
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/appli.spec.js",
|
"spec": "cypress/integration/rendering/appli.spec.js",
|
||||||
"duration": 3421
|
"duration": 3170
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/architecture.spec.ts",
|
"spec": "cypress/integration/rendering/architecture.spec.ts",
|
||||||
"duration": 97
|
"duration": 104
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/block.spec.js",
|
"spec": "cypress/integration/rendering/block.spec.js",
|
||||||
"duration": 18500
|
"duration": 17390
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/c4.spec.js",
|
"spec": "cypress/integration/rendering/c4.spec.js",
|
||||||
"duration": 5793
|
"duration": 5296
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/classDiagram-elk-v3.spec.js",
|
"spec": "cypress/integration/rendering/classDiagram-elk-v3.spec.js",
|
||||||
"duration": 40966
|
"duration": 39004
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/classDiagram-handDrawn-v3.spec.js",
|
"spec": "cypress/integration/rendering/classDiagram-handDrawn-v3.spec.js",
|
||||||
"duration": 39176
|
"duration": 37653
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/classDiagram-v2.spec.js",
|
"spec": "cypress/integration/rendering/classDiagram-v2.spec.js",
|
||||||
"duration": 23468
|
"duration": 23278
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/classDiagram-v3.spec.js",
|
"spec": "cypress/integration/rendering/classDiagram-v3.spec.js",
|
||||||
"duration": 38291
|
"duration": 36645
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/classDiagram.spec.js",
|
"spec": "cypress/integration/rendering/classDiagram.spec.js",
|
||||||
"duration": 16949
|
"duration": 15418
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/conf-and-directives.spec.js",
|
"spec": "cypress/integration/rendering/conf-and-directives.spec.js",
|
||||||
"duration": 9480
|
"duration": 9684
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/current.spec.js",
|
"spec": "cypress/integration/rendering/current.spec.js",
|
||||||
"duration": 2753
|
"duration": 2570
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/erDiagram-unified.spec.js",
|
"spec": "cypress/integration/rendering/erDiagram-unified.spec.js",
|
||||||
"duration": 88028
|
"duration": 84687
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/erDiagram.spec.js",
|
"spec": "cypress/integration/rendering/erDiagram.spec.js",
|
||||||
"duration": 15615
|
"duration": 14819
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/errorDiagram.spec.js",
|
"spec": "cypress/integration/rendering/errorDiagram.spec.js",
|
||||||
"duration": 3706
|
"duration": 3371
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/flowchart-elk.spec.js",
|
"spec": "cypress/integration/rendering/flowchart-elk.spec.js",
|
||||||
"duration": 43905
|
"duration": 39925
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/flowchart-handDrawn.spec.js",
|
"spec": "cypress/integration/rendering/flowchart-handDrawn.spec.js",
|
||||||
"duration": 31217
|
"duration": 34694
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/flowchart-icon.spec.js",
|
"spec": "cypress/integration/rendering/flowchart-icon.spec.js",
|
||||||
"duration": 7531
|
"duration": 7137
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/flowchart-shape-alias.spec.ts",
|
"spec": "cypress/integration/rendering/flowchart-shape-alias.spec.ts",
|
||||||
"duration": 25423
|
"duration": 24740
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/flowchart-v2.spec.js",
|
"spec": "cypress/integration/rendering/flowchart-v2.spec.js",
|
||||||
"duration": 49664
|
"duration": 42077
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/flowchart.spec.js",
|
"spec": "cypress/integration/rendering/flowchart.spec.js",
|
||||||
"duration": 32525
|
"duration": 30642
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/gantt.spec.js",
|
"spec": "cypress/integration/rendering/gantt.spec.js",
|
||||||
"duration": 20915
|
"duration": 18085
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/gitGraph.spec.js",
|
"spec": "cypress/integration/rendering/gitGraph.spec.js",
|
||||||
"duration": 53556
|
"duration": 50107
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/iconShape.spec.ts",
|
"spec": "cypress/integration/rendering/iconShape.spec.ts",
|
||||||
"duration": 283038
|
"duration": 276279
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/imageShape.spec.ts",
|
"spec": "cypress/integration/rendering/imageShape.spec.ts",
|
||||||
"duration": 59434
|
"duration": 56505
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/info.spec.ts",
|
"spec": "cypress/integration/rendering/info.spec.ts",
|
||||||
"duration": 3101
|
"duration": 3036
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/journey.spec.js",
|
"spec": "cypress/integration/rendering/journey.spec.js",
|
||||||
"duration": 7099
|
"duration": 6889
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/kanban.spec.ts",
|
"spec": "cypress/integration/rendering/kanban.spec.ts",
|
||||||
"duration": 7567
|
"duration": 7353
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/katex.spec.js",
|
"spec": "cypress/integration/rendering/katex.spec.js",
|
||||||
"duration": 3817
|
"duration": 3580
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/marker_unique_id.spec.js",
|
"spec": "cypress/integration/rendering/marker_unique_id.spec.js",
|
||||||
"duration": 2624
|
"duration": 2508
|
||||||
},
|
|
||||||
{
|
|
||||||
"spec": "cypress/integration/rendering/mindmap-tidy-tree.spec.js",
|
|
||||||
"duration": 4246
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/mindmap.spec.ts",
|
"spec": "cypress/integration/rendering/mindmap.spec.ts",
|
||||||
"duration": 11967
|
"duration": 10939
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/newShapes.spec.ts",
|
"spec": "cypress/integration/rendering/newShapes.spec.ts",
|
||||||
"duration": 151914
|
"duration": 149102
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/oldShapes.spec.ts",
|
"spec": "cypress/integration/rendering/oldShapes.spec.ts",
|
||||||
"duration": 116698
|
"duration": 113987
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/packet.spec.ts",
|
"spec": "cypress/integration/rendering/packet.spec.ts",
|
||||||
"duration": 4967
|
"duration": 4060
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/pie.spec.ts",
|
"spec": "cypress/integration/rendering/pie.spec.ts",
|
||||||
"duration": 6700
|
"duration": 5715
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/quadrantChart.spec.js",
|
"spec": "cypress/integration/rendering/quadrantChart.spec.js",
|
||||||
"duration": 8963
|
"duration": 8945
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/radar.spec.js",
|
"spec": "cypress/integration/rendering/radar.spec.js",
|
||||||
"duration": 5540
|
"duration": 5337
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/requirement.spec.js",
|
"spec": "cypress/integration/rendering/requirement.spec.js",
|
||||||
"duration": 2782
|
"duration": 2643
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/requirementDiagram-unified.spec.js",
|
"spec": "cypress/integration/rendering/requirementDiagram-unified.spec.js",
|
||||||
"duration": 54797
|
"duration": 52072
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/sankey.spec.ts",
|
"spec": "cypress/integration/rendering/sankey.spec.ts",
|
||||||
"duration": 6914
|
"duration": 6692
|
||||||
},
|
|
||||||
{
|
|
||||||
"spec": "cypress/integration/rendering/sequencediagram-v2.spec.js",
|
|
||||||
"duration": 20481
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/sequencediagram.spec.js",
|
"spec": "cypress/integration/rendering/sequencediagram.spec.js",
|
||||||
"duration": 38490
|
"duration": 35721
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/stateDiagram-v2.spec.js",
|
"spec": "cypress/integration/rendering/stateDiagram-v2.spec.js",
|
||||||
"duration": 30766
|
"duration": 26030
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/stateDiagram.spec.js",
|
"spec": "cypress/integration/rendering/stateDiagram.spec.js",
|
||||||
"duration": 16705
|
"duration": 16333
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/theme.spec.js",
|
"spec": "cypress/integration/rendering/theme.spec.js",
|
||||||
"duration": 30928
|
"duration": 29287
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/timeline.spec.ts",
|
"spec": "cypress/integration/rendering/timeline.spec.ts",
|
||||||
"duration": 8424
|
"duration": 8491
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/treemap.spec.ts",
|
"spec": "cypress/integration/rendering/treemap.spec.ts",
|
||||||
"duration": 12533
|
"duration": 12291
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/xyChart.spec.js",
|
"spec": "cypress/integration/rendering/xyChart.spec.js",
|
||||||
"duration": 21197
|
"duration": 20651
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"spec": "cypress/integration/rendering/zenuml.spec.js",
|
"spec": "cypress/integration/rendering/zenuml.spec.js",
|
||||||
"duration": 3455
|
"duration": 3218
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1>Block diagram demos</h1>
|
<h1>Block diagram demos</h1>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
columns 1
|
columns 1
|
||||||
db(("DB"))
|
db(("DB"))
|
||||||
blockArrowId6<[" "]>(down)
|
blockArrowId6<[" "]>(down)
|
||||||
@@ -26,7 +26,7 @@ columns 1
|
|||||||
style B fill:#f9F,stroke:#333,stroke-width:4px
|
style B fill:#f9F,stroke:#333,stroke-width:4px
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
A1["square"]
|
A1["square"]
|
||||||
B1("rounded")
|
B1("rounded")
|
||||||
C1(("circle"))
|
C1(("circle"))
|
||||||
@@ -36,7 +36,7 @@ block
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
A1(["stadium"])
|
A1(["stadium"])
|
||||||
A2[["subroutine"]]
|
A2[["subroutine"]]
|
||||||
B1[("cylinder")]
|
B1[("cylinder")]
|
||||||
@@ -48,7 +48,7 @@ block
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
block:e:4
|
block:e:4
|
||||||
columns 2
|
columns 2
|
||||||
f
|
f
|
||||||
@@ -57,7 +57,7 @@ block
|
|||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
block:e:4
|
block:e:4
|
||||||
columns 2
|
columns 2
|
||||||
f
|
f
|
||||||
@@ -67,7 +67,7 @@ block
|
|||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a:3
|
a:3
|
||||||
block:e:3
|
block:e:3
|
||||||
@@ -80,7 +80,7 @@ block
|
|||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
columns 4
|
columns 4
|
||||||
a b c d
|
a b c d
|
||||||
block:e:4
|
block:e:4
|
||||||
@@ -97,19 +97,19 @@ flowchart LR
|
|||||||
X-- "a label" -->z
|
X-- "a label" -->z
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
columns 5
|
columns 5
|
||||||
A space B
|
A space B
|
||||||
A --x B
|
A --x B
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a["A wide one"] b:2 c:2 d
|
a["A wide one"] b:2 c:2 d
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a b c
|
a b c
|
||||||
e:3
|
e:3
|
||||||
@@ -117,7 +117,7 @@ columns 3
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
block
|
block-beta
|
||||||
|
|
||||||
A1:3
|
A1:3
|
||||||
A2:1
|
A2:1
|
||||||
|
@@ -20,14 +20,12 @@
|
|||||||
width: 800
|
width: 800
|
||||||
nodeAlignment: left
|
nodeAlignment: left
|
||||||
---
|
---
|
||||||
sankey
|
sankey-beta
|
||||||
a,b,8
|
Revenue,Expenses,10
|
||||||
b,c,8
|
Revenue,Profit,10
|
||||||
c,d,8
|
Expenses,Manufacturing,5
|
||||||
d,e,8
|
Expenses,Tax,3
|
||||||
|
Expenses,Research,2
|
||||||
x,c,4
|
|
||||||
c,y,4
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h2>Energy flow</h2>
|
<h2>Energy flow</h2>
|
||||||
@@ -42,7 +40,7 @@
|
|||||||
linkColor: gradient
|
linkColor: gradient
|
||||||
nodeAlignment: justify
|
nodeAlignment: justify
|
||||||
---
|
---
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
Agricultural 'waste',Bio-conversion,124.729
|
Agricultural 'waste',Bio-conversion,124.729
|
||||||
Bio-conversion,Liquid,0.597
|
Bio-conversion,Liquid,0.597
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1>XY Charts demos</h1>
|
<h1>XY Charts demos</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue (in $)"
|
title "Sales Revenue (in $)"
|
||||||
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<h1>XY Charts horizontal</h1>
|
<h1>XY Charts horizontal</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
xychart horizontal
|
xychart-beta horizontal
|
||||||
title "Basic xychart"
|
title "Basic xychart"
|
||||||
x-axis "this is x axis" [category1, "category 2", category3, category4]
|
x-axis "this is x axis" [category1, "category 2", category3, category4]
|
||||||
y-axis yaxisText 10 --> 150
|
y-axis yaxisText 10 --> 150
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<h1>XY Charts only lines and bar</h1>
|
<h1>XY Charts only lines and bar</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
xychart
|
xychart-beta
|
||||||
line [23, 46, 77, 34]
|
line [23, 46, 77, 34]
|
||||||
line [45, 32, 33, 12]
|
line [45, 32, 33, 12]
|
||||||
line [87, 54, 99, 85]
|
line [87, 54, 99, 85]
|
||||||
@@ -48,13 +48,13 @@
|
|||||||
<hr />
|
<hr />
|
||||||
<h1>XY Charts with +ve and -ve numbers</h1>
|
<h1>XY Charts with +ve and -ve numbers</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
xychart
|
xychart-beta
|
||||||
line [+1.3, .6, 2.4, -.34]
|
line [+1.3, .6, 2.4, -.34]
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h1>XY Charts Bar with multiple category</h1>
|
<h1>XY Charts Bar with multiple category</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
xychart
|
xychart-beta
|
||||||
title "Basic xychart with many categories"
|
title "Basic xychart with many categories"
|
||||||
x-axis "this is x axis" [category1, "category 2", category3, category4, category5, category6, category7]
|
x-axis "this is x axis" [category1, "category 2", category3, category4, category5, category6, category7]
|
||||||
y-axis yaxisText 10 --> 150
|
y-axis yaxisText 10 --> 150
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
|
|
||||||
<h1>XY Charts line with multiple category</h1>
|
<h1>XY Charts line with multiple category</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
xychart
|
xychart-beta
|
||||||
title "Line chart with many category"
|
title "Line chart with many category"
|
||||||
x-axis "this is x axis" [category1, "category 2", category3, category4, category5, category6, category7]
|
x-axis "this is x axis" [category1, "category 2", category3, category4, category5, category6, category7]
|
||||||
y-axis yaxisText 10 --> 150
|
y-axis yaxisText 10 --> 150
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
<h1>XY Charts category with large text</h1>
|
<h1>XY Charts category with large text</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
xychart
|
xychart-beta
|
||||||
title "Basic xychart with many categories with category overlap"
|
title "Basic xychart with many categories with category overlap"
|
||||||
x-axis "this is x axis" [category1, "Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.", category3, category4, category5, category6, category7]
|
x-axis "this is x axis" [category1, "Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint consectetur cupidatat.", category3, category4, category5, category6, category7]
|
||||||
y-axis yaxisText 10 --> 150
|
y-axis yaxisText 10 --> 150
|
||||||
@@ -89,7 +89,7 @@ config:
|
|||||||
height: 20
|
height: 20
|
||||||
plotReservedSpacePercent: 100
|
plotReservedSpacePercent: 100
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
line [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
line [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ config:
|
|||||||
height: 20
|
height: 20
|
||||||
plotReservedSpacePercent: 100
|
plotReservedSpacePercent: 100
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
bar [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
bar [5000, 9000, 7500, 6200, 9500, 5500, 11000, 8200, 9200, 9500, 7000, 8800]
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ config:
|
|||||||
chartOrientation: horizontal
|
chartOrientation: horizontal
|
||||||
plotReservedSpacePercent: 60
|
plotReservedSpacePercent: 60
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -162,7 +162,7 @@ config:
|
|||||||
xAxisLineColor: "#87ceeb"
|
xAxisLineColor: "#87ceeb"
|
||||||
plotColorPalette: "#008000, #faba63"
|
plotColorPalette: "#008000, #faba63"
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis Months [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
# Frequently Asked Questions
|
# Frequently Asked Questions
|
||||||
|
|
||||||
1. [How to add title to flowchart?](https://github.com/mermaid-js/mermaid/issues/1433#issuecomment-1991554712)
|
1. [How to add title to flowchart?](https://github.com/mermaid-js/mermaid/issues/556#issuecomment-363182217)
|
||||||
2. [How to specify custom CSS file?](https://github.com/mermaidjs/mermaid.cli/pull/24#issuecomment-373402785)
|
2. [How to specify custom CSS file?](https://github.com/mermaidjs/mermaid.cli/pull/24#issuecomment-373402785)
|
||||||
3. [How to fix tooltip misplacement issue?](https://github.com/mermaid-js/mermaid/issues/542#issuecomment-3343564621)
|
3. [How to fix tooltip misplacement issue?](https://github.com/mermaid-js/mermaid/issues/542#issuecomment-3343564621)
|
||||||
4. [How to specify gantt diagram xAxis format?](https://github.com/mermaid-js/mermaid/issues/269#issuecomment-373229136)
|
4. [How to specify gantt diagram xAxis format?](https://github.com/mermaid-js/mermaid/issues/269#issuecomment-373229136)
|
||||||
|
@@ -1,40 +0,0 @@
|
|||||||
> **Warning**
|
|
||||||
>
|
|
||||||
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
|
|
||||||
>
|
|
||||||
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/layouts.md](../../packages/mermaid/src/docs/config/layouts.md).
|
|
||||||
|
|
||||||
# Layouts
|
|
||||||
|
|
||||||
This page lists the available layout algorithms supported in Mermaid diagrams.
|
|
||||||
|
|
||||||
## Supported Layouts
|
|
||||||
|
|
||||||
- **elk**: [ELK (Eclipse Layout Kernel)](https://www.eclipse.org/elk/)
|
|
||||||
- **tidy-tree**: Tidy tree layout for hierarchical diagrams [Tidy Tree Configuration](/config/tidy-tree)
|
|
||||||
- **cose-bilkent**: Cose Bilkent layout for force-directed graphs
|
|
||||||
- **dagre**: Dagre layout for layered graphs
|
|
||||||
|
|
||||||
## How to Use
|
|
||||||
|
|
||||||
You can specify the layout in your diagram's YAML config or initialization options. For example:
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
graph TD;
|
|
||||||
A-->B;
|
|
||||||
B-->C;
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: elk
|
|
||||||
---
|
|
||||||
graph TD;
|
|
||||||
A-->B;
|
|
||||||
B-->C;
|
|
||||||
```
|
|
@@ -19,7 +19,6 @@
|
|||||||
- [addDirective](functions/addDirective.md)
|
- [addDirective](functions/addDirective.md)
|
||||||
- [getConfig](functions/getConfig.md)
|
- [getConfig](functions/getConfig.md)
|
||||||
- [getSiteConfig](functions/getSiteConfig.md)
|
- [getSiteConfig](functions/getSiteConfig.md)
|
||||||
- [getUserDefinedConfig](functions/getUserDefinedConfig.md)
|
|
||||||
- [reset](functions/reset.md)
|
- [reset](functions/reset.md)
|
||||||
- [sanitize](functions/sanitize.md)
|
- [sanitize](functions/sanitize.md)
|
||||||
- [saveConfigFromInitialize](functions/saveConfigFromInitialize.md)
|
- [saveConfigFromInitialize](functions/saveConfigFromInitialize.md)
|
||||||
|
@@ -1,19 +0,0 @@
|
|||||||
> **Warning**
|
|
||||||
>
|
|
||||||
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
|
|
||||||
>
|
|
||||||
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/getUserDefinedConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/getUserDefinedConfig.md).
|
|
||||||
|
|
||||||
[**mermaid**](../../README.md)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Function: getUserDefinedConfig()
|
|
||||||
|
|
||||||
> **getUserDefinedConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
|
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.ts:252](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L252)
|
|
||||||
|
|
||||||
## Returns
|
|
||||||
|
|
||||||
[`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
|
|
@@ -12,4 +12,4 @@
|
|||||||
|
|
||||||
> `const` **configKeys**: `Set`<`string`>
|
> `const` **configKeys**: `Set`<`string`>
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/defaultConfig.ts:292](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L292)
|
Defined in: [packages/mermaid/src/defaultConfig.ts:290](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/defaultConfig.ts#L290)
|
||||||
|
@@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
# mermaid
|
# mermaid
|
||||||
|
|
||||||
|
## Classes
|
||||||
|
|
||||||
|
- [UnknownDiagramError](classes/UnknownDiagramError.md)
|
||||||
|
|
||||||
## Interfaces
|
## Interfaces
|
||||||
|
|
||||||
- [DetailedError](interfaces/DetailedError.md)
|
- [DetailedError](interfaces/DetailedError.md)
|
||||||
@@ -23,7 +27,6 @@
|
|||||||
- [RenderOptions](interfaces/RenderOptions.md)
|
- [RenderOptions](interfaces/RenderOptions.md)
|
||||||
- [RenderResult](interfaces/RenderResult.md)
|
- [RenderResult](interfaces/RenderResult.md)
|
||||||
- [RunOptions](interfaces/RunOptions.md)
|
- [RunOptions](interfaces/RunOptions.md)
|
||||||
- [UnknownDiagramError](interfaces/UnknownDiagramError.md)
|
|
||||||
|
|
||||||
## Type Aliases
|
## Type Aliases
|
||||||
|
|
||||||
|
159
docs/config/setup/mermaid/classes/UnknownDiagramError.md
Normal file
159
docs/config/setup/mermaid/classes/UnknownDiagramError.md
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
|
||||||
|
>
|
||||||
|
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/classes/UnknownDiagramError.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/classes/UnknownDiagramError.md).
|
||||||
|
|
||||||
|
[**mermaid**](../../README.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Class: UnknownDiagramError
|
||||||
|
|
||||||
|
Defined in: [packages/mermaid/src/errors.ts:1](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/errors.ts#L1)
|
||||||
|
|
||||||
|
## Extends
|
||||||
|
|
||||||
|
- `Error`
|
||||||
|
|
||||||
|
## Constructors
|
||||||
|
|
||||||
|
### new UnknownDiagramError()
|
||||||
|
|
||||||
|
> **new UnknownDiagramError**(`message`): [`UnknownDiagramError`](UnknownDiagramError.md)
|
||||||
|
|
||||||
|
Defined in: [packages/mermaid/src/errors.ts:2](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/errors.ts#L2)
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
##### message
|
||||||
|
|
||||||
|
`string`
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
|
||||||
|
[`UnknownDiagramError`](UnknownDiagramError.md)
|
||||||
|
|
||||||
|
#### Overrides
|
||||||
|
|
||||||
|
`Error.constructor`
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
### cause?
|
||||||
|
|
||||||
|
> `optional` **cause**: `unknown`
|
||||||
|
|
||||||
|
Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
|
||||||
|
|
||||||
|
#### Inherited from
|
||||||
|
|
||||||
|
`Error.cause`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### message
|
||||||
|
|
||||||
|
> **message**: `string`
|
||||||
|
|
||||||
|
Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es5.d.ts:1077
|
||||||
|
|
||||||
|
#### Inherited from
|
||||||
|
|
||||||
|
`Error.message`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### name
|
||||||
|
|
||||||
|
> **name**: `string`
|
||||||
|
|
||||||
|
Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es5.d.ts:1076
|
||||||
|
|
||||||
|
#### Inherited from
|
||||||
|
|
||||||
|
`Error.name`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### stack?
|
||||||
|
|
||||||
|
> `optional` **stack**: `string`
|
||||||
|
|
||||||
|
Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es5.d.ts:1078
|
||||||
|
|
||||||
|
#### Inherited from
|
||||||
|
|
||||||
|
`Error.stack`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### prepareStackTrace()?
|
||||||
|
|
||||||
|
> `static` `optional` **prepareStackTrace**: (`err`, `stackTraces`) => `any`
|
||||||
|
|
||||||
|
Defined in: node_modules/.pnpm/@types+node\@22.13.5/node_modules/@types/node/globals.d.ts:143
|
||||||
|
|
||||||
|
Optional override for formatting stack traces
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
##### err
|
||||||
|
|
||||||
|
`Error`
|
||||||
|
|
||||||
|
##### stackTraces
|
||||||
|
|
||||||
|
`CallSite`\[]
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
|
||||||
|
`any`
|
||||||
|
|
||||||
|
#### See
|
||||||
|
|
||||||
|
<https://v8.dev/docs/stack-trace-api#customizing-stack-traces>
|
||||||
|
|
||||||
|
#### Inherited from
|
||||||
|
|
||||||
|
`Error.prepareStackTrace`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### stackTraceLimit
|
||||||
|
|
||||||
|
> `static` **stackTraceLimit**: `number`
|
||||||
|
|
||||||
|
Defined in: node_modules/.pnpm/@types+node\@22.13.5/node_modules/@types/node/globals.d.ts:145
|
||||||
|
|
||||||
|
#### Inherited from
|
||||||
|
|
||||||
|
`Error.stackTraceLimit`
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
### captureStackTrace()
|
||||||
|
|
||||||
|
> `static` **captureStackTrace**(`targetObject`, `constructorOpt`?): `void`
|
||||||
|
|
||||||
|
Defined in: node_modules/.pnpm/@types+node\@22.13.5/node_modules/@types/node/globals.d.ts:136
|
||||||
|
|
||||||
|
Create .stack property on a target object
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
##### targetObject
|
||||||
|
|
||||||
|
`object`
|
||||||
|
|
||||||
|
##### constructorOpt?
|
||||||
|
|
||||||
|
`Function`
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
|
||||||
|
`void`
|
||||||
|
|
||||||
|
#### Inherited from
|
||||||
|
|
||||||
|
`Error.captureStackTrace`
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# Interface: ExternalDiagramDefinition
|
# Interface: ExternalDiagramDefinition
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/diagram-api/types.ts:96](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L96)
|
Defined in: [packages/mermaid/src/diagram-api/types.ts:94](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L94)
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ Defined in: [packages/mermaid/src/diagram-api/types.ts:96](https://github.com/me
|
|||||||
|
|
||||||
> **detector**: `DiagramDetector`
|
> **detector**: `DiagramDetector`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/diagram-api/types.ts:98](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L98)
|
Defined in: [packages/mermaid/src/diagram-api/types.ts:96](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L96)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ Defined in: [packages/mermaid/src/diagram-api/types.ts:98](https://github.com/me
|
|||||||
|
|
||||||
> **id**: `string`
|
> **id**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/diagram-api/types.ts:97](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L97)
|
Defined in: [packages/mermaid/src/diagram-api/types.ts:95](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L95)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -34,4 +34,4 @@ Defined in: [packages/mermaid/src/diagram-api/types.ts:97](https://github.com/me
|
|||||||
|
|
||||||
> **loader**: `DiagramLoader`
|
> **loader**: `DiagramLoader`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/diagram-api/types.ts:99](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L99)
|
Defined in: [packages/mermaid/src/diagram-api/types.ts:97](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L97)
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# Interface: LayoutData
|
# Interface: LayoutData
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/types.ts:168](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L168)
|
Defined in: [packages/mermaid/src/rendering-util/types.ts:145](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L145)
|
||||||
|
|
||||||
## Indexable
|
## Indexable
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ Defined in: [packages/mermaid/src/rendering-util/types.ts:168](https://github.co
|
|||||||
|
|
||||||
> **config**: [`MermaidConfig`](MermaidConfig.md)
|
> **config**: [`MermaidConfig`](MermaidConfig.md)
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/types.ts:171](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L171)
|
Defined in: [packages/mermaid/src/rendering-util/types.ts:148](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L148)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ Defined in: [packages/mermaid/src/rendering-util/types.ts:171](https://github.co
|
|||||||
|
|
||||||
> **edges**: `Edge`\[]
|
> **edges**: `Edge`\[]
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/types.ts:170](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L170)
|
Defined in: [packages/mermaid/src/rendering-util/types.ts:147](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L147)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -38,4 +38,4 @@ Defined in: [packages/mermaid/src/rendering-util/types.ts:170](https://github.co
|
|||||||
|
|
||||||
> **nodes**: `Node`\[]
|
> **nodes**: `Node`\[]
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/types.ts:169](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L169)
|
Defined in: [packages/mermaid/src/rendering-util/types.ts:146](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/types.ts#L146)
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# Interface: LayoutLoaderDefinition
|
# Interface: LayoutLoaderDefinition
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/render.ts:24](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L24)
|
Defined in: [packages/mermaid/src/rendering-util/render.ts:21](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L21)
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ Defined in: [packages/mermaid/src/rendering-util/render.ts:24](https://github.co
|
|||||||
|
|
||||||
> `optional` **algorithm**: `string`
|
> `optional` **algorithm**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/render.ts:27](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L27)
|
Defined in: [packages/mermaid/src/rendering-util/render.ts:24](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L24)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ Defined in: [packages/mermaid/src/rendering-util/render.ts:27](https://github.co
|
|||||||
|
|
||||||
> **loader**: `LayoutLoader`
|
> **loader**: `LayoutLoader`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/render.ts:26](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L26)
|
Defined in: [packages/mermaid/src/rendering-util/render.ts:23](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L23)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -34,4 +34,4 @@ Defined in: [packages/mermaid/src/rendering-util/render.ts:26](https://github.co
|
|||||||
|
|
||||||
> **name**: `string`
|
> **name**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/render.ts:25](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L25)
|
Defined in: [packages/mermaid/src/rendering-util/render.ts:22](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L22)
|
||||||
|
@@ -32,7 +32,7 @@ page.
|
|||||||
|
|
||||||
### detectType()
|
### detectType()
|
||||||
|
|
||||||
> **detectType**: (`text`, `config?`) => `string`
|
> **detectType**: (`text`, `config`?) => `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/mermaid.ts:449](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L449)
|
Defined in: [packages/mermaid/src/mermaid.ts:449](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L449)
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ An array of objects with the id of the diagram.
|
|||||||
|
|
||||||
### ~~init()~~
|
### ~~init()~~
|
||||||
|
|
||||||
> **init**: (`config?`, `nodes?`, `callback?`) => `Promise`<`void`>
|
> **init**: (`config`?, `nodes`?, `callback`?) => `Promise`<`void`>
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/mermaid.ts:442](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L442)
|
Defined in: [packages/mermaid/src/mermaid.ts:442](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L442)
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ Defined in: [packages/mermaid/src/mermaid.ts:442](https://github.com/mermaid-js/
|
|||||||
|
|
||||||
[`MermaidConfig`](MermaidConfig.md)
|
[`MermaidConfig`](MermaidConfig.md)
|
||||||
|
|
||||||
**Deprecated**, please set configuration in [initialize](#initialize).
|
**Deprecated**, please set configuration in [initialize](Mermaid.md#initialize).
|
||||||
|
|
||||||
##### nodes?
|
##### nodes?
|
||||||
|
|
||||||
@@ -141,13 +141,13 @@ Called once for each rendered diagram's id.
|
|||||||
|
|
||||||
#### Deprecated
|
#### Deprecated
|
||||||
|
|
||||||
Use [initialize](#initialize) and [run](#run) instead.
|
Use [initialize](Mermaid.md#initialize) and [run](Mermaid.md#run) instead.
|
||||||
|
|
||||||
Renders the mermaid diagrams
|
Renders the mermaid diagrams
|
||||||
|
|
||||||
#### Deprecated
|
#### Deprecated
|
||||||
|
|
||||||
Use [initialize](#initialize) and [run](#run) instead.
|
Use [initialize](Mermaid.md#initialize) and [run](Mermaid.md#run) instead.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ Configuration object for mermaid.
|
|||||||
|
|
||||||
### ~~mermaidAPI~~
|
### ~~mermaidAPI~~
|
||||||
|
|
||||||
> **mermaidAPI**: `Readonly`<{ `defaultConfig`: [`MermaidConfig`](MermaidConfig.md); `getConfig`: () => [`MermaidConfig`](MermaidConfig.md); `getDiagramFromText`: (`text`, `metadata`) => `Promise`<`Diagram`>; `getSiteConfig`: () => [`MermaidConfig`](MermaidConfig.md); `globalReset`: () => `void`; `initialize`: (`userOptions`) => `void`; `parse`: {(`text`, `parseOptions`): `Promise`<`false` | [`ParseResult`](ParseResult.md)>; (`text`, `parseOptions?`): `Promise`<[`ParseResult`](ParseResult.md)>; }; `render`: (`id`, `text`, `svgContainingElement?`) => `Promise`<[`RenderResult`](RenderResult.md)>; `reset`: () => `void`; `setConfig`: (`conf`) => [`MermaidConfig`](MermaidConfig.md); `updateSiteConfig`: (`conf`) => [`MermaidConfig`](MermaidConfig.md); }>
|
> **mermaidAPI**: `Readonly`<{ `defaultConfig`: [`MermaidConfig`](MermaidConfig.md); `getConfig`: () => [`MermaidConfig`](MermaidConfig.md); `getDiagramFromText`: (`text`, `metadata`) => `Promise`<`Diagram`>; `getSiteConfig`: () => [`MermaidConfig`](MermaidConfig.md); `globalReset`: () => `void`; `initialize`: (`userOptions`) => `void`; `parse`: (`text`, `parseOptions`) => `Promise`<`false` | [`ParseResult`](ParseResult.md)>(`text`, `parseOptions`?) => `Promise`<[`ParseResult`](ParseResult.md)>; `render`: (`id`, `text`, `svgContainingElement`?) => `Promise`<[`RenderResult`](RenderResult.md)>; `reset`: () => `void`; `setConfig`: (`conf`) => [`MermaidConfig`](MermaidConfig.md); `updateSiteConfig`: (`conf`) => [`MermaidConfig`](MermaidConfig.md); }>
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/mermaid.ts:436](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L436)
|
Defined in: [packages/mermaid/src/mermaid.ts:436](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L436)
|
||||||
|
|
||||||
@@ -184,81 +184,73 @@ Defined in: [packages/mermaid/src/mermaid.ts:436](https://github.com/mermaid-js/
|
|||||||
|
|
||||||
#### Deprecated
|
#### Deprecated
|
||||||
|
|
||||||
Use [parse](#parse) and [render](#render) instead. Please [open a discussion](https://github.com/mermaid-js/mermaid/discussions) if your use case does not fit the new API.
|
Use [parse](Mermaid.md#parse) and [render](Mermaid.md#render) instead. Please [open a discussion](https://github.com/mermaid-js/mermaid/discussions) if your use case does not fit the new API.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### parse()
|
### parse()
|
||||||
|
|
||||||
> **parse**: {(`text`, `parseOptions`): `Promise`<`false` | [`ParseResult`](ParseResult.md)>; (`text`, `parseOptions?`): `Promise`<[`ParseResult`](ParseResult.md)>; }
|
> **parse**: (`text`, `parseOptions`) => `Promise`<`false` | [`ParseResult`](ParseResult.md)>(`text`, `parseOptions`?) => `Promise`<[`ParseResult`](ParseResult.md)>
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/mermaid.ts:437](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L437)
|
Defined in: [packages/mermaid/src/mermaid.ts:437](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L437)
|
||||||
|
|
||||||
#### Call Signature
|
|
||||||
|
|
||||||
> (`text`, `parseOptions`): `Promise`<`false` | [`ParseResult`](ParseResult.md)>
|
|
||||||
|
|
||||||
Parse the text and validate the syntax.
|
Parse the text and validate the syntax.
|
||||||
|
|
||||||
##### Parameters
|
#### Parameters
|
||||||
|
|
||||||
###### text
|
##### text
|
||||||
|
|
||||||
`string`
|
`string`
|
||||||
|
|
||||||
The mermaid diagram definition.
|
The mermaid diagram definition.
|
||||||
|
|
||||||
###### parseOptions
|
##### parseOptions
|
||||||
|
|
||||||
[`ParseOptions`](ParseOptions.md) & `object`
|
[`ParseOptions`](ParseOptions.md) & `object`
|
||||||
|
|
||||||
Options for parsing.
|
Options for parsing.
|
||||||
|
|
||||||
##### Returns
|
#### Returns
|
||||||
|
|
||||||
`Promise`<`false` | [`ParseResult`](ParseResult.md)>
|
`Promise`<`false` | [`ParseResult`](ParseResult.md)>
|
||||||
|
|
||||||
An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.
|
An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.
|
||||||
|
|
||||||
##### See
|
#### See
|
||||||
|
|
||||||
[ParseOptions](ParseOptions.md)
|
[ParseOptions](ParseOptions.md)
|
||||||
|
|
||||||
##### Throws
|
#### Throws
|
||||||
|
|
||||||
Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.
|
Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.
|
||||||
|
|
||||||
#### Call Signature
|
|
||||||
|
|
||||||
> (`text`, `parseOptions?`): `Promise`<[`ParseResult`](ParseResult.md)>
|
|
||||||
|
|
||||||
Parse the text and validate the syntax.
|
Parse the text and validate the syntax.
|
||||||
|
|
||||||
##### Parameters
|
#### Parameters
|
||||||
|
|
||||||
###### text
|
##### text
|
||||||
|
|
||||||
`string`
|
`string`
|
||||||
|
|
||||||
The mermaid diagram definition.
|
The mermaid diagram definition.
|
||||||
|
|
||||||
###### parseOptions?
|
##### parseOptions?
|
||||||
|
|
||||||
[`ParseOptions`](ParseOptions.md)
|
[`ParseOptions`](ParseOptions.md)
|
||||||
|
|
||||||
Options for parsing.
|
Options for parsing.
|
||||||
|
|
||||||
##### Returns
|
#### Returns
|
||||||
|
|
||||||
`Promise`<[`ParseResult`](ParseResult.md)>
|
`Promise`<[`ParseResult`](ParseResult.md)>
|
||||||
|
|
||||||
An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.
|
An object with the `diagramType` set to type of the diagram if valid. Otherwise `false` if parseOptions.suppressErrors is `true`.
|
||||||
|
|
||||||
##### See
|
#### See
|
||||||
|
|
||||||
[ParseOptions](ParseOptions.md)
|
[ParseOptions](ParseOptions.md)
|
||||||
|
|
||||||
##### Throws
|
#### Throws
|
||||||
|
|
||||||
Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.
|
Error if the diagram is invalid and parseOptions.suppressErrors is false or not set.
|
||||||
|
|
||||||
@@ -340,7 +332,7 @@ Defined in: [packages/mermaid/src/mermaid.ts:444](https://github.com/mermaid-js/
|
|||||||
|
|
||||||
### render()
|
### render()
|
||||||
|
|
||||||
> **render**: (`id`, `text`, `svgContainingElement?`) => `Promise`<[`RenderResult`](RenderResult.md)>
|
> **render**: (`id`, `text`, `svgContainingElement`?) => `Promise`<[`RenderResult`](RenderResult.md)>
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/mermaid.ts:438](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L438)
|
Defined in: [packages/mermaid/src/mermaid.ts:438](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaid.ts#L438)
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ Defined in: [packages/mermaid/src/config.type.ts:58](https://github.com/mermaid-
|
|||||||
|
|
||||||
> `optional` **altFontFamily**: `string`
|
> `optional` **altFontFamily**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:132](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L132)
|
Defined in: [packages/mermaid/src/config.type.ts:122](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L122)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ Defined in: [packages/mermaid/src/config.type.ts:132](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **architecture**: `ArchitectureDiagramConfig`
|
> `optional` **architecture**: `ArchitectureDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:204](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L204)
|
Defined in: [packages/mermaid/src/config.type.ts:194](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L194)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ Defined in: [packages/mermaid/src/config.type.ts:204](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **arrowMarkerAbsolute**: `boolean`
|
> `optional` **arrowMarkerAbsolute**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:151](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L151)
|
Defined in: [packages/mermaid/src/config.type.ts:141](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L141)
|
||||||
|
|
||||||
Controls whether or arrow markers in html code are absolute paths or anchors.
|
Controls whether or arrow markers in html code are absolute paths or anchors.
|
||||||
This matters if you are using base tag settings.
|
This matters if you are using base tag settings.
|
||||||
@@ -45,7 +45,7 @@ This matters if you are using base tag settings.
|
|||||||
|
|
||||||
> `optional` **block**: `BlockDiagramConfig`
|
> `optional` **block**: `BlockDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:211](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L211)
|
Defined in: [packages/mermaid/src/config.type.ts:201](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L201)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ Defined in: [packages/mermaid/src/config.type.ts:211](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **c4**: `C4DiagramConfig`
|
> `optional` **c4**: `C4DiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:208](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L208)
|
Defined in: [packages/mermaid/src/config.type.ts:198](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L198)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ Defined in: [packages/mermaid/src/config.type.ts:208](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **class**: `ClassDiagramConfig`
|
> `optional` **class**: `ClassDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:197](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L197)
|
Defined in: [packages/mermaid/src/config.type.ts:187](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L187)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ Defined in: [packages/mermaid/src/config.type.ts:197](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **darkMode**: `boolean`
|
> `optional` **darkMode**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:123](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L123)
|
Defined in: [packages/mermaid/src/config.type.ts:113](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L113)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ Defined in: [packages/mermaid/src/config.type.ts:123](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **deterministicIds**: `boolean`
|
> `optional` **deterministicIds**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:184](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L184)
|
Defined in: [packages/mermaid/src/config.type.ts:174](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L174)
|
||||||
|
|
||||||
This option controls if the generated ids of nodes in the SVG are
|
This option controls if the generated ids of nodes in the SVG are
|
||||||
generated randomly or based on a seed.
|
generated randomly or based on a seed.
|
||||||
@@ -93,7 +93,7 @@ should not change unless content is changed.
|
|||||||
|
|
||||||
> `optional` **deterministicIDSeed**: `string`
|
> `optional` **deterministicIDSeed**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:191](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L191)
|
Defined in: [packages/mermaid/src/config.type.ts:181](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L181)
|
||||||
|
|
||||||
This option is the optional seed for deterministic ids.
|
This option is the optional seed for deterministic ids.
|
||||||
If set to `undefined` but deterministicIds is `true`, a simple number iterator is used.
|
If set to `undefined` but deterministicIds is `true`, a simple number iterator is used.
|
||||||
@@ -105,7 +105,7 @@ You can set this attribute to base the seed on a static string.
|
|||||||
|
|
||||||
> `optional` **dompurifyConfig**: `Config`
|
> `optional` **dompurifyConfig**: `Config`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:213](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L213)
|
Defined in: [packages/mermaid/src/config.type.ts:203](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L203)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -115,24 +115,12 @@ Defined in: [packages/mermaid/src/config.type.ts:213](https://github.com/mermaid
|
|||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:91](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L91)
|
Defined in: [packages/mermaid/src/config.type.ts:91](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L91)
|
||||||
|
|
||||||
#### considerModelOrder?
|
|
||||||
|
|
||||||
> `optional` **considerModelOrder**: `"NONE"` | `"NODES_AND_EDGES"` | `"PREFER_EDGES"` | `"PREFER_NODES"`
|
|
||||||
|
|
||||||
Preserves the order of nodes and edges in the model file if this does not lead to additional edge crossings. Depending on the strategy this is not always possible since the node and edge order might be conflicting.
|
|
||||||
|
|
||||||
#### cycleBreakingStrategy?
|
#### cycleBreakingStrategy?
|
||||||
|
|
||||||
> `optional` **cycleBreakingStrategy**: `"GREEDY"` | `"DEPTH_FIRST"` | `"INTERACTIVE"` | `"MODEL_ORDER"` | `"GREEDY_MODEL_ORDER"`
|
> `optional` **cycleBreakingStrategy**: `"GREEDY"` | `"DEPTH_FIRST"` | `"INTERACTIVE"` | `"MODEL_ORDER"` | `"GREEDY_MODEL_ORDER"`
|
||||||
|
|
||||||
This strategy decides how to find cycles in the graph and deciding which edges need adjustment to break loops.
|
This strategy decides how to find cycles in the graph and deciding which edges need adjustment to break loops.
|
||||||
|
|
||||||
#### forceNodeModelOrder?
|
|
||||||
|
|
||||||
> `optional` **forceNodeModelOrder**: `boolean`
|
|
||||||
|
|
||||||
The node order given by the model does not change to produce a better layout. E.g. if node A is before node B in the model this is not changed during crossing minimization. This assumes that the node model order is already respected before crossing minimization. This can be achieved by setting considerModelOrder.strategy to NODES_AND_EDGES.
|
|
||||||
|
|
||||||
#### mergeEdges?
|
#### mergeEdges?
|
||||||
|
|
||||||
> `optional` **mergeEdges**: `boolean`
|
> `optional` **mergeEdges**: `boolean`
|
||||||
@@ -151,7 +139,7 @@ Elk specific option affecting how nodes are placed.
|
|||||||
|
|
||||||
> `optional` **er**: `ErDiagramConfig`
|
> `optional` **er**: `ErDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:199](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L199)
|
Defined in: [packages/mermaid/src/config.type.ts:189](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L189)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -159,7 +147,7 @@ Defined in: [packages/mermaid/src/config.type.ts:199](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **flowchart**: `FlowchartDiagramConfig`
|
> `optional` **flowchart**: `FlowchartDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:192](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L192)
|
Defined in: [packages/mermaid/src/config.type.ts:182](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L182)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -167,7 +155,7 @@ Defined in: [packages/mermaid/src/config.type.ts:192](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **fontFamily**: `string`
|
> `optional` **fontFamily**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:131](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L131)
|
Defined in: [packages/mermaid/src/config.type.ts:121](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L121)
|
||||||
|
|
||||||
Specifies the font to be used in the rendered diagrams.
|
Specifies the font to be used in the rendered diagrams.
|
||||||
Can be any possible CSS `font-family`.
|
Can be any possible CSS `font-family`.
|
||||||
@@ -179,7 +167,7 @@ See <https://developer.mozilla.org/en-US/docs/Web/CSS/font-family>
|
|||||||
|
|
||||||
> `optional` **fontSize**: `number`
|
> `optional` **fontSize**: `number`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:215](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L215)
|
Defined in: [packages/mermaid/src/config.type.ts:205](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L205)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -187,7 +175,7 @@ Defined in: [packages/mermaid/src/config.type.ts:215](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **forceLegacyMathML**: `boolean`
|
> `optional` **forceLegacyMathML**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:173](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L173)
|
Defined in: [packages/mermaid/src/config.type.ts:163](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L163)
|
||||||
|
|
||||||
This option forces Mermaid to rely on KaTeX's own stylesheet for rendering MathML. Due to differences between OS
|
This option forces Mermaid to rely on KaTeX's own stylesheet for rendering MathML. Due to differences between OS
|
||||||
fonts and browser's MathML implementation, this option is recommended if consistent rendering is important.
|
fonts and browser's MathML implementation, this option is recommended if consistent rendering is important.
|
||||||
@@ -199,7 +187,7 @@ If set to true, ignores legacyMathML.
|
|||||||
|
|
||||||
> `optional` **gantt**: `GanttDiagramConfig`
|
> `optional` **gantt**: `GanttDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:194](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L194)
|
Defined in: [packages/mermaid/src/config.type.ts:184](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L184)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -207,7 +195,7 @@ Defined in: [packages/mermaid/src/config.type.ts:194](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **gitGraph**: `GitGraphDiagramConfig`
|
> `optional` **gitGraph**: `GitGraphDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:207](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L207)
|
Defined in: [packages/mermaid/src/config.type.ts:197](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L197)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -225,7 +213,7 @@ Defines the seed to be used when using handDrawn look. This is important for the
|
|||||||
|
|
||||||
> `optional` **htmlLabels**: `boolean`
|
> `optional` **htmlLabels**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:124](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L124)
|
Defined in: [packages/mermaid/src/config.type.ts:114](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L114)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -233,7 +221,7 @@ Defined in: [packages/mermaid/src/config.type.ts:124](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **journey**: `JourneyDiagramConfig`
|
> `optional` **journey**: `JourneyDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:195](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L195)
|
Defined in: [packages/mermaid/src/config.type.ts:185](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L185)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -241,7 +229,7 @@ Defined in: [packages/mermaid/src/config.type.ts:195](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **kanban**: `KanbanDiagramConfig`
|
> `optional` **kanban**: `KanbanDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:206](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L206)
|
Defined in: [packages/mermaid/src/config.type.ts:196](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L196)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -259,7 +247,7 @@ Defines which layout algorithm to use for rendering the diagram.
|
|||||||
|
|
||||||
> `optional` **legacyMathML**: `boolean`
|
> `optional` **legacyMathML**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:166](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L166)
|
Defined in: [packages/mermaid/src/config.type.ts:156](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L156)
|
||||||
|
|
||||||
This option specifies if Mermaid can expect the dependent to include KaTeX stylesheets for browsers
|
This option specifies if Mermaid can expect the dependent to include KaTeX stylesheets for browsers
|
||||||
without their own MathML implementation. If this option is disabled and MathML is not supported, the math
|
without their own MathML implementation. If this option is disabled and MathML is not supported, the math
|
||||||
@@ -272,7 +260,7 @@ fall back to legacy rendering for KaTeX.
|
|||||||
|
|
||||||
> `optional` **logLevel**: `0` | `2` | `1` | `"trace"` | `"debug"` | `"info"` | `"warn"` | `"error"` | `"fatal"` | `3` | `4` | `5`
|
> `optional` **logLevel**: `0` | `2` | `1` | `"trace"` | `"debug"` | `"info"` | `"warn"` | `"error"` | `"fatal"` | `3` | `4` | `5`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:137](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L137)
|
Defined in: [packages/mermaid/src/config.type.ts:127](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L127)
|
||||||
|
|
||||||
This option decides the amount of logging to be used by mermaid.
|
This option decides the amount of logging to be used by mermaid.
|
||||||
|
|
||||||
@@ -292,7 +280,7 @@ Defines which main look to use for the diagram.
|
|||||||
|
|
||||||
> `optional` **markdownAutoWrap**: `boolean`
|
> `optional` **markdownAutoWrap**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:216](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L216)
|
Defined in: [packages/mermaid/src/config.type.ts:206](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L206)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -320,7 +308,7 @@ The maximum allowed size of the users text diagram
|
|||||||
|
|
||||||
> `optional` **mindmap**: `MindmapDiagramConfig`
|
> `optional` **mindmap**: `MindmapDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:205](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L205)
|
Defined in: [packages/mermaid/src/config.type.ts:195](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L195)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -328,7 +316,7 @@ Defined in: [packages/mermaid/src/config.type.ts:205](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **packet**: `PacketDiagramConfig`
|
> `optional` **packet**: `PacketDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:210](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L210)
|
Defined in: [packages/mermaid/src/config.type.ts:200](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L200)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -336,7 +324,7 @@ Defined in: [packages/mermaid/src/config.type.ts:210](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **pie**: `PieDiagramConfig`
|
> `optional` **pie**: `PieDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:200](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L200)
|
Defined in: [packages/mermaid/src/config.type.ts:190](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L190)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -344,7 +332,7 @@ Defined in: [packages/mermaid/src/config.type.ts:200](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **quadrantChart**: `QuadrantChartConfig`
|
> `optional` **quadrantChart**: `QuadrantChartConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:201](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L201)
|
Defined in: [packages/mermaid/src/config.type.ts:191](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L191)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -352,7 +340,7 @@ Defined in: [packages/mermaid/src/config.type.ts:201](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **radar**: `RadarDiagramConfig`
|
> `optional` **radar**: `RadarDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:212](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L212)
|
Defined in: [packages/mermaid/src/config.type.ts:202](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L202)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -360,7 +348,7 @@ Defined in: [packages/mermaid/src/config.type.ts:212](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **requirement**: `RequirementDiagramConfig`
|
> `optional` **requirement**: `RequirementDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:203](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L203)
|
Defined in: [packages/mermaid/src/config.type.ts:193](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L193)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -368,7 +356,7 @@ Defined in: [packages/mermaid/src/config.type.ts:203](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **sankey**: `SankeyDiagramConfig`
|
> `optional` **sankey**: `SankeyDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:209](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L209)
|
Defined in: [packages/mermaid/src/config.type.ts:199](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L199)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -376,7 +364,7 @@ Defined in: [packages/mermaid/src/config.type.ts:209](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **secure**: `string`\[]
|
> `optional` **secure**: `string`\[]
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:158](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L158)
|
Defined in: [packages/mermaid/src/config.type.ts:148](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L148)
|
||||||
|
|
||||||
This option controls which `currentConfig` keys are considered secure and
|
This option controls which `currentConfig` keys are considered secure and
|
||||||
can only be changed via call to `mermaid.initialize`.
|
can only be changed via call to `mermaid.initialize`.
|
||||||
@@ -388,7 +376,7 @@ This prevents malicious graph directives from overriding a site's default securi
|
|||||||
|
|
||||||
> `optional` **securityLevel**: `"strict"` | `"loose"` | `"antiscript"` | `"sandbox"`
|
> `optional` **securityLevel**: `"strict"` | `"loose"` | `"antiscript"` | `"sandbox"`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:141](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L141)
|
Defined in: [packages/mermaid/src/config.type.ts:131](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L131)
|
||||||
|
|
||||||
Level of trust for parsed diagram
|
Level of trust for parsed diagram
|
||||||
|
|
||||||
@@ -398,7 +386,7 @@ Level of trust for parsed diagram
|
|||||||
|
|
||||||
> `optional` **sequence**: `SequenceDiagramConfig`
|
> `optional` **sequence**: `SequenceDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:193](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L193)
|
Defined in: [packages/mermaid/src/config.type.ts:183](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L183)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -406,7 +394,7 @@ Defined in: [packages/mermaid/src/config.type.ts:193](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **startOnLoad**: `boolean`
|
> `optional` **startOnLoad**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:145](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L145)
|
Defined in: [packages/mermaid/src/config.type.ts:135](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L135)
|
||||||
|
|
||||||
Dictates whether mermaid starts on Page load
|
Dictates whether mermaid starts on Page load
|
||||||
|
|
||||||
@@ -416,7 +404,7 @@ Dictates whether mermaid starts on Page load
|
|||||||
|
|
||||||
> `optional` **state**: `StateDiagramConfig`
|
> `optional` **state**: `StateDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:198](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L198)
|
Defined in: [packages/mermaid/src/config.type.ts:188](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L188)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -424,7 +412,7 @@ Defined in: [packages/mermaid/src/config.type.ts:198](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **suppressErrorRendering**: `boolean`
|
> `optional` **suppressErrorRendering**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:222](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L222)
|
Defined in: [packages/mermaid/src/config.type.ts:212](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L212)
|
||||||
|
|
||||||
Suppresses inserting 'Syntax error' diagram in the DOM.
|
Suppresses inserting 'Syntax error' diagram in the DOM.
|
||||||
This is useful when you want to control how to handle syntax errors in your application.
|
This is useful when you want to control how to handle syntax errors in your application.
|
||||||
@@ -462,7 +450,7 @@ Defined in: [packages/mermaid/src/config.type.ts:65](https://github.com/mermaid-
|
|||||||
|
|
||||||
> `optional` **timeline**: `TimelineDiagramConfig`
|
> `optional` **timeline**: `TimelineDiagramConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:196](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L196)
|
Defined in: [packages/mermaid/src/config.type.ts:186](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L186)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -470,7 +458,7 @@ Defined in: [packages/mermaid/src/config.type.ts:196](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **wrap**: `boolean`
|
> `optional` **wrap**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:214](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L214)
|
Defined in: [packages/mermaid/src/config.type.ts:204](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L204)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -478,4 +466,4 @@ Defined in: [packages/mermaid/src/config.type.ts:214](https://github.com/mermaid
|
|||||||
|
|
||||||
> `optional` **xyChart**: `XYChartConfig`
|
> `optional` **xyChart**: `XYChartConfig`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/config.type.ts:202](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L202)
|
Defined in: [packages/mermaid/src/config.type.ts:192](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.type.ts#L192)
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# Interface: ParseOptions
|
# Interface: ParseOptions
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/types.ts:88](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L88)
|
Defined in: [packages/mermaid/src/types.ts:72](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L72)
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ Defined in: [packages/mermaid/src/types.ts:88](https://github.com/mermaid-js/mer
|
|||||||
|
|
||||||
> `optional` **suppressErrors**: `boolean`
|
> `optional` **suppressErrors**: `boolean`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/types.ts:93](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L93)
|
Defined in: [packages/mermaid/src/types.ts:77](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L77)
|
||||||
|
|
||||||
If `true`, parse will return `false` instead of throwing error when the diagram is invalid.
|
If `true`, parse will return `false` instead of throwing error when the diagram is invalid.
|
||||||
The `parseError` function will not be called.
|
The `parseError` function will not be called.
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# Interface: ParseResult
|
# Interface: ParseResult
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/types.ts:96](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L96)
|
Defined in: [packages/mermaid/src/types.ts:80](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L80)
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ Defined in: [packages/mermaid/src/types.ts:96](https://github.com/mermaid-js/mer
|
|||||||
|
|
||||||
> **config**: [`MermaidConfig`](MermaidConfig.md)
|
> **config**: [`MermaidConfig`](MermaidConfig.md)
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/types.ts:104](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L104)
|
Defined in: [packages/mermaid/src/types.ts:88](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L88)
|
||||||
|
|
||||||
The config passed as YAML frontmatter or directives
|
The config passed as YAML frontmatter or directives
|
||||||
|
|
||||||
@@ -28,6 +28,6 @@ The config passed as YAML frontmatter or directives
|
|||||||
|
|
||||||
> **diagramType**: `string`
|
> **diagramType**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/types.ts:100](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L100)
|
Defined in: [packages/mermaid/src/types.ts:84](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L84)
|
||||||
|
|
||||||
The diagram type, e.g. 'flowchart', 'sequence', etc.
|
The diagram type, e.g. 'flowchart', 'sequence', etc.
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# Interface: RenderOptions
|
# Interface: RenderOptions
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/render.ts:10](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L10)
|
Defined in: [packages/mermaid/src/rendering-util/render.ts:7](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L7)
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
@@ -18,4 +18,4 @@ Defined in: [packages/mermaid/src/rendering-util/render.ts:10](https://github.co
|
|||||||
|
|
||||||
> `optional` **algorithm**: `string`
|
> `optional` **algorithm**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/rendering-util/render.ts:11](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L11)
|
Defined in: [packages/mermaid/src/rendering-util/render.ts:8](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/rendering-util/render.ts#L8)
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# Interface: RenderResult
|
# Interface: RenderResult
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/types.ts:114](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L114)
|
Defined in: [packages/mermaid/src/types.ts:98](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L98)
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ Defined in: [packages/mermaid/src/types.ts:114](https://github.com/mermaid-js/me
|
|||||||
|
|
||||||
> `optional` **bindFunctions**: (`element`) => `void`
|
> `optional` **bindFunctions**: (`element`) => `void`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/types.ts:132](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L132)
|
Defined in: [packages/mermaid/src/types.ts:116](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L116)
|
||||||
|
|
||||||
Bind function to be called after the svg has been inserted into the DOM.
|
Bind function to be called after the svg has been inserted into the DOM.
|
||||||
This is necessary for adding event listeners to the elements in the svg.
|
This is necessary for adding event listeners to the elements in the svg.
|
||||||
@@ -45,7 +45,7 @@ bindFunctions?.(div); // To call bindFunctions only if it's present.
|
|||||||
|
|
||||||
> **diagramType**: `string`
|
> **diagramType**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/types.ts:122](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L122)
|
Defined in: [packages/mermaid/src/types.ts:106](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L106)
|
||||||
|
|
||||||
The diagram type, e.g. 'flowchart', 'sequence', etc.
|
The diagram type, e.g. 'flowchart', 'sequence', etc.
|
||||||
|
|
||||||
@@ -55,6 +55,6 @@ The diagram type, e.g. 'flowchart', 'sequence', etc.
|
|||||||
|
|
||||||
> **svg**: `string`
|
> **svg**: `string`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/types.ts:118](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L118)
|
Defined in: [packages/mermaid/src/types.ts:102](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L102)
|
||||||
|
|
||||||
The svg code for the rendered graph.
|
The svg code for the rendered graph.
|
||||||
|
@@ -1,65 +0,0 @@
|
|||||||
> **Warning**
|
|
||||||
>
|
|
||||||
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
|
|
||||||
>
|
|
||||||
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/mermaid/interfaces/UnknownDiagramError.md](../../../../../packages/mermaid/src/docs/config/setup/mermaid/interfaces/UnknownDiagramError.md).
|
|
||||||
|
|
||||||
[**mermaid**](../../README.md)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Interface: UnknownDiagramError
|
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/errors.ts:1](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/errors.ts#L1)
|
|
||||||
|
|
||||||
## Extends
|
|
||||||
|
|
||||||
- `Error`
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
### cause?
|
|
||||||
|
|
||||||
> `optional` **cause**: `unknown`
|
|
||||||
|
|
||||||
Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
|
|
||||||
|
|
||||||
#### Inherited from
|
|
||||||
|
|
||||||
`Error.cause`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### message
|
|
||||||
|
|
||||||
> **message**: `string`
|
|
||||||
|
|
||||||
Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es5.d.ts:1077
|
|
||||||
|
|
||||||
#### Inherited from
|
|
||||||
|
|
||||||
`Error.message`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### name
|
|
||||||
|
|
||||||
> **name**: `string`
|
|
||||||
|
|
||||||
Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es5.d.ts:1076
|
|
||||||
|
|
||||||
#### Inherited from
|
|
||||||
|
|
||||||
`Error.name`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### stack?
|
|
||||||
|
|
||||||
> `optional` **stack**: `string`
|
|
||||||
|
|
||||||
Defined in: node_modules/.pnpm/typescript\@5.7.3/node_modules/typescript/lib/lib.es5.d.ts:1078
|
|
||||||
|
|
||||||
#### Inherited from
|
|
||||||
|
|
||||||
`Error.stack`
|
|
@@ -10,6 +10,6 @@
|
|||||||
|
|
||||||
# Type Alias: InternalHelpers
|
# Type Alias: InternalHelpers
|
||||||
|
|
||||||
> **InternalHelpers** = _typeof_ `internalHelpers`
|
> **InternalHelpers**: _typeof_ `internalHelpers`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/internals.ts:33](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/internals.ts#L33)
|
Defined in: [packages/mermaid/src/internals.ts:33](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/internals.ts#L33)
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# Type Alias: ParseErrorFunction()
|
# Type Alias: ParseErrorFunction()
|
||||||
|
|
||||||
> **ParseErrorFunction** = (`err`, `hash?`) => `void`
|
> **ParseErrorFunction**: (`err`, `hash`?) => `void`
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/Diagram.ts:10](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/Diagram.ts#L10)
|
Defined in: [packages/mermaid/src/Diagram.ts:10](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/Diagram.ts#L10)
|
||||||
|
|
||||||
|
@@ -10,6 +10,6 @@
|
|||||||
|
|
||||||
# Type Alias: SVG
|
# Type Alias: SVG
|
||||||
|
|
||||||
> **SVG** = `d3.Selection`<`SVGSVGElement`, `unknown`, `Element` | `null`, `unknown`>
|
> **SVG**: `d3.Selection`<`SVGSVGElement`, `unknown`, `Element` | `null`, `unknown`>
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/diagram-api/types.ts:128](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L128)
|
Defined in: [packages/mermaid/src/diagram-api/types.ts:126](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L126)
|
||||||
|
@@ -10,6 +10,6 @@
|
|||||||
|
|
||||||
# Type Alias: SVGGroup
|
# Type Alias: SVGGroup
|
||||||
|
|
||||||
> **SVGGroup** = `d3.Selection`<`SVGGElement`, `unknown`, `Element` | `null`, `unknown`>
|
> **SVGGroup**: `d3.Selection`<`SVGGElement`, `unknown`, `Element` | `null`, `unknown`>
|
||||||
|
|
||||||
Defined in: [packages/mermaid/src/diagram-api/types.ts:130](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L130)
|
Defined in: [packages/mermaid/src/diagram-api/types.ts:128](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/diagram-api/types.ts#L128)
|
||||||
|
@@ -1,89 +0,0 @@
|
|||||||
> **Warning**
|
|
||||||
>
|
|
||||||
> ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
|
|
||||||
>
|
|
||||||
> ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/tidy-tree.md](../../packages/mermaid/src/docs/config/tidy-tree.md).
|
|
||||||
|
|
||||||
# Tidy-tree Layout
|
|
||||||
|
|
||||||
The **tidy-tree** layout arranges nodes in a hierarchical, tree-like structure. It is especially useful for diagrams where parent-child relationships are important, such as mindmaps.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- Organizes nodes in a tidy, non-overlapping tree
|
|
||||||
- Ideal for mindmaps and hierarchical data
|
|
||||||
- Automatically adjusts spacing for readability
|
|
||||||
|
|
||||||
## Example Usage
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap is a long thing))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
C
|
|
||||||
D
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap is a long thing))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
C
|
|
||||||
D
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
Origins
|
|
||||||
Long history
|
|
||||||
::icon(fa fa-book)
|
|
||||||
Popularisation
|
|
||||||
British popular psychology author Tony Buzan
|
|
||||||
Research
|
|
||||||
On effectiveness<br/>and features
|
|
||||||
On Automatic creation
|
|
||||||
Uses
|
|
||||||
Creative techniques
|
|
||||||
Strategic planning
|
|
||||||
Argument mapping
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
Origins
|
|
||||||
Long history
|
|
||||||
::icon(fa fa-book)
|
|
||||||
Popularisation
|
|
||||||
British popular psychology author Tony Buzan
|
|
||||||
Research
|
|
||||||
On effectiveness<br/>and features
|
|
||||||
On Automatic creation
|
|
||||||
Uses
|
|
||||||
Creative techniques
|
|
||||||
Strategic planning
|
|
||||||
Argument mapping
|
|
||||||
```
|
|
||||||
|
|
||||||
## Note
|
|
||||||
|
|
||||||
- Currently, tidy-tree is primarily supported for mindmap diagrams.
|
|
@@ -73,7 +73,7 @@ To add an integration to this list, see the [Integrations - create page](./integ
|
|||||||
- [Obsidian](https://help.obsidian.md/Editing+and+formatting/Advanced+formatting+syntax#Diagram) ✅
|
- [Obsidian](https://help.obsidian.md/Editing+and+formatting/Advanced+formatting+syntax#Diagram) ✅
|
||||||
- [Outline](https://docs.getoutline.com/s/guide/doc/diagrams-KQiKoT4wzK) ✅
|
- [Outline](https://docs.getoutline.com/s/guide/doc/diagrams-KQiKoT4wzK) ✅
|
||||||
- [Redmine](https://redmine.org)
|
- [Redmine](https://redmine.org)
|
||||||
- [Mermaid Macro](https://redmine.org/plugins/redmine_mermaid_macro)
|
- [Mermaid Macro](https://www.redmine.org/plugins/redmine_mermaid_macro)
|
||||||
- [Markdown for mermaid plugin](https://github.com/jamieh-mongolian/markdown-for-mermaid-plugin)
|
- [Markdown for mermaid plugin](https://github.com/jamieh-mongolian/markdown-for-mermaid-plugin)
|
||||||
- [redmine-mermaid](https://github.com/styz/redmine_mermaid)
|
- [redmine-mermaid](https://github.com/styz/redmine_mermaid)
|
||||||
- Visual Studio Code [Polyglot Interactive Notebooks](https://github.com/dotnet/interactive#net-interactive)
|
- Visual Studio Code [Polyglot Interactive Notebooks](https://github.com/dotnet/interactive#net-interactive)
|
||||||
@@ -117,7 +117,7 @@ Content Management Systems/Enterprise Content Management
|
|||||||
- [Grav CMS](https://getgrav.org/)
|
- [Grav CMS](https://getgrav.org/)
|
||||||
- [Mermaid Diagrams Plugin](https://github.com/DanielFlaum/grav-plugin-mermaid-diagrams)
|
- [Mermaid Diagrams Plugin](https://github.com/DanielFlaum/grav-plugin-mermaid-diagrams)
|
||||||
- [GitLab Markdown Adapter](https://github.com/Goutte/grav-plugin-gitlab-markdown-adapter)
|
- [GitLab Markdown Adapter](https://github.com/Goutte/grav-plugin-gitlab-markdown-adapter)
|
||||||
- [Tiki Wiki CMS Groupware](https://tiki.org)
|
- [Tiki](https://tiki.org)
|
||||||
- [Tracker Entity Relationship Diagram](https://doc.tiki.org/Tracker-Entity-Relationship-Diagram)
|
- [Tracker Entity Relationship Diagram](https://doc.tiki.org/Tracker-Entity-Relationship-Diagram)
|
||||||
- [VitePress](https://vitepress.vuejs.org/)
|
- [VitePress](https://vitepress.vuejs.org/)
|
||||||
- [Plugin for Mermaid.js](https://emersonbottero.github.io/vitepress-plugin-mermaid/)
|
- [Plugin for Mermaid.js](https://emersonbottero.github.io/vitepress-plugin-mermaid/)
|
||||||
|
@@ -6,66 +6,6 @@
|
|||||||
|
|
||||||
# Blog
|
# Blog
|
||||||
|
|
||||||
## [Mermaid introduces the Visual Editor for Entity Relationship diagrams](https://docs.mermaidchart.com/blog/posts/mermaid-introduces-the-visual-editor-for-entity-relationship-diagrams)
|
|
||||||
|
|
||||||
7/15/2025 • 7 mins
|
|
||||||
|
|
||||||
Mermaid just introduced a Visual Editor for Entity Relationship diagrams, letting anyone map database structures through a simple point-and-click interface instead of code. This no-code ER builder now sits alongside Mermaid’s editors for flowcharts, sequence, and class diagrams, enabling teams to craft and share polished data models for apps, AI, and business processes.
|
|
||||||
|
|
||||||
## [Mermaid supports Treemap Diagrams now!!!](https://docs.mermaidchart.com/blog/posts/mermaid-have-treemap-diagrams-now)
|
|
||||||
|
|
||||||
7/3/2025 • 4 mins
|
|
||||||
|
|
||||||
Mermaid has introduced Treemap diagrams, currently in beta, enhancing hierarchical data visualization. Treemap diagrams use nested rectangles to represent data relationships, focusing on size and proportions. They offer various applications, including budget visualization and market analysis. With simple syntax and customization options, users can effectively present complex data hierarchies.
|
|
||||||
|
|
||||||
## [AI Diagram Generators and Data Visualization: Best Practices](https://docs.mermaidchart.com/blog/posts/ai-diagram-generators-and-data-visualization-best-practices)
|
|
||||||
|
|
||||||
7/2/2025 • 6 mins
|
|
||||||
|
|
||||||
AI diagram generators transform complex data into clear, interactive visuals – enabling faster analysis, better decisions, and stronger collaboration across teams. By combining automation with manual refinement, these tools empower anyone to communicate insights effectively, regardless of technical skill level.
|
|
||||||
|
|
||||||
## [How to Choose the Best AI Diagram Generator for Your Needs (2025)](https://docs.mermaidchart.com/blog/posts/how-to-choose-the-best-ai-diagram-generator-for-your-needs-2025)
|
|
||||||
|
|
||||||
6/26/2025 • 14 mins
|
|
||||||
|
|
||||||
AI diagram generators are transforming how developers visualize and communicate complex systems, reducing hours of manual work into minutes. With tools like Mermaid AI, users benefit from both code-based and visual editing, enabling seamless collaboration and precision. Whether you’re diagramming workflows, software architecture, or data relationships, the right AI tool can significantly boost productivity and streamline communication.
|
|
||||||
|
|
||||||
## [5 Time-Saving Tips for Using Mermaid’s AI Diagram Generator Effectively](https://docs.mermaidchart.com/blog/posts/5-time-saving-tips-for-using-mermaids-ai-diagram-generator-effectively)
|
|
||||||
|
|
||||||
6/11/2025 • 10 mins
|
|
||||||
|
|
||||||
See how developers can save time and boost productivity using Mermaid Chart’s AI diagram generator. Learn five practical tips that help turn plain language into powerful, professional diagrams.
|
|
||||||
|
|
||||||
## [Enhancing Team Collaboration with AI-Powered Diagrams](https://docs.mermaidchart.com/blog/posts/enhancing-team-collaboration-with-ai-powered-diagrams)
|
|
||||||
|
|
||||||
5/27/2025 • 6 mins
|
|
||||||
|
|
||||||
Software teams move fast, but old-school diagramming tools can’t keep up. Mermaid Chart replaces static slides and whiteboards with real-time, AI-generated visuals that evolve with your code and ideas. Just describe a process in plain English, and watch it come to life.
|
|
||||||
|
|
||||||
## [What is an AI Diagram Generator? Benefits and Use Cases](https://docs.mermaidchart.com/blog/posts/what-is-an-ai-diagram-generator-benefits-and-use-cases)
|
|
||||||
|
|
||||||
5/22/2025 • 6 mins
|
|
||||||
|
|
||||||
Discover how AI diagram generators like Mermaid Chart transform developer workflows. Instantly turn text into flowcharts, ERDs, and system diagrams, no manual drag-and-drop needed. Learn how it works, key benefits, and real-world use cases.
|
|
||||||
|
|
||||||
## [How to Use Mermaid Chart as an AI Diagram Generator for Developers](https://docs.mermaidchart.com/blog/posts/how-to-use-mermaid-chart-as-an-ai-diagram-generator)
|
|
||||||
|
|
||||||
5/21/2025 • 9 mins
|
|
||||||
|
|
||||||
Would an AI diagram generator make your life easier? We think it would!
|
|
||||||
|
|
||||||
## [Mermaid Chart VS Code Plugin: Create and Edit Mermaid.js Diagrams in Visual Studio Code](https://docs.mermaidchart.com/blog/posts/mermaid-chart-vs-code-plugin-create-and-edit-mermaid-js-diagrams-in-visual-studio-code)
|
|
||||||
|
|
||||||
3/21/2025 • 5 mins
|
|
||||||
|
|
||||||
The Mermaid Chart VS Code Plugin is a powerful developer diagramming tool that brings Mermaid.js diagramming directly into your Visual Studio Code environment. Whether you’re visualizing software architecture, documenting API flows, fixing bad documentation, or managing flowcharts and sequence diagrams, this plugin integrates seamlessly into your workflow. Key Features of the Mermaid Chart VS Code \[…]
|
|
||||||
|
|
||||||
## [Mermaid Chart: The Evolution of Mermaid](https://docs.mermaidchart.com/blog/posts/mermaid-chart-the-evolution-of-mermaid)
|
|
||||||
|
|
||||||
1/30/2025 • 3 mins
|
|
||||||
|
|
||||||
Mermaid revolutionized diagramming with its simple, markdown-style syntax, empowering millions of developers worldwide. Now, Mermaid Chart takes it further with AI-powered visuals, a GUI for seamless editing, real-time collaboration, and advanced design tools. Experience the next generation of diagramming—faster, smarter, and built for modern teams. Try Mermaid Chart today!
|
|
||||||
|
|
||||||
## [GUI for editing Mermaid Class Diagrams](https://docs.mermaidchart.com/blog/posts/gui-for-editing-mermaid-class-diagrams)
|
## [GUI for editing Mermaid Class Diagrams](https://docs.mermaidchart.com/blog/posts/gui-for-editing-mermaid-class-diagrams)
|
||||||
|
|
||||||
1/17/2025 • 5 mins
|
1/17/2025 • 5 mins
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
## Introduction to Block Diagrams
|
## Introduction to Block Diagrams
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
columns 1
|
columns 1
|
||||||
db(("DB"))
|
db(("DB"))
|
||||||
blockArrowId6<[" "]>(down)
|
blockArrowId6<[" "]>(down)
|
||||||
@@ -26,7 +26,7 @@ columns 1
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
columns 1
|
columns 1
|
||||||
db(("DB"))
|
db(("DB"))
|
||||||
blockArrowId6<[" "]>(down)
|
blockArrowId6<[" "]>(down)
|
||||||
@@ -80,12 +80,12 @@ At its core, a block diagram consists of blocks representing different entities
|
|||||||
To create a simple block diagram with three blocks labeled 'a', 'b', and 'c', the syntax is as follows:
|
To create a simple block diagram with three blocks labeled 'a', 'b', and 'c', the syntax is as follows:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
a b c
|
a b c
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
a b c
|
a b c
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -101,13 +101,13 @@ While simple block diagrams are linear and straightforward, more complex systems
|
|||||||
In scenarios where you need to distribute blocks across multiple columns, you can specify the number of columns and arrange the blocks accordingly. Here's how to create a block diagram with three columns and four blocks, where the fourth block appears in a second row:
|
In scenarios where you need to distribute blocks across multiple columns, you can specify the number of columns and arrange the blocks accordingly. Here's how to create a block diagram with three columns and four blocks, where the fourth block appears in a second row:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a b c d
|
a b c d
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a b c d
|
a b c d
|
||||||
```
|
```
|
||||||
@@ -130,13 +130,13 @@ In more complex diagrams, you may need blocks that span multiple columns to emph
|
|||||||
To create a block diagram where one block spans across two columns, you can specify the desired width for each block:
|
To create a block diagram where one block spans across two columns, you can specify the desired width for each block:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a["A label"] b:2 c:2 d
|
a["A label"] b:2 c:2 d
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a["A label"] b:2 c:2 d
|
a["A label"] b:2 c:2 d
|
||||||
```
|
```
|
||||||
@@ -153,7 +153,7 @@ Composite blocks, or blocks within blocks, are an advanced feature in Mermaid's
|
|||||||
Creating a composite block involves defining a parent block and then nesting other blocks within it. Here's how to define a composite block with nested elements:
|
Creating a composite block involves defining a parent block and then nesting other blocks within it. Here's how to define a composite block with nested elements:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
block
|
block
|
||||||
D
|
D
|
||||||
end
|
end
|
||||||
@@ -161,7 +161,7 @@ block
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
block
|
block
|
||||||
D
|
D
|
||||||
end
|
end
|
||||||
@@ -180,7 +180,7 @@ Mermaid also allows for dynamic adjustment of column widths based on the content
|
|||||||
In diagrams with varying block sizes, Mermaid automatically adjusts the column widths to fit the largest block in each column. Here's an example:
|
In diagrams with varying block sizes, Mermaid automatically adjusts the column widths to fit the largest block in each column. Here's an example:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a:3
|
a:3
|
||||||
block:group1:2
|
block:group1:2
|
||||||
@@ -195,7 +195,7 @@ block
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a:3
|
a:3
|
||||||
block:group1:2
|
block:group1:2
|
||||||
@@ -215,7 +215,7 @@ This example demonstrates how Mermaid dynamically adjusts the width of the colum
|
|||||||
In scenarios where you need to stack blocks horizontally, you can use column width to accomplish the task. Blocks can be arranged vertically by putting them in a single column. Here is how you can create a block diagram in which 4 blocks are stacked on top of each other:
|
In scenarios where you need to stack blocks horizontally, you can use column width to accomplish the task. Blocks can be arranged vertically by putting them in a single column. Here is how you can create a block diagram in which 4 blocks are stacked on top of each other:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
block
|
block
|
||||||
columns 1
|
columns 1
|
||||||
a["A label"] b c d
|
a["A label"] b c d
|
||||||
@@ -223,7 +223,7 @@ block
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
block
|
block
|
||||||
columns 1
|
columns 1
|
||||||
a["A label"] b c d
|
a["A label"] b c d
|
||||||
@@ -247,12 +247,12 @@ Mermaid supports a range of block shapes to suit different diagramming needs, fr
|
|||||||
To create a block with round edges, which can be used to represent a softer or more flexible component:
|
To create a block with round edges, which can be used to represent a softer or more flexible component:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1("This is the text in the box")
|
id1("This is the text in the box")
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1("This is the text in the box")
|
id1("This is the text in the box")
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -261,12 +261,12 @@ block
|
|||||||
A stadium-shaped block, resembling an elongated circle, can be used for components that are process-oriented:
|
A stadium-shaped block, resembling an elongated circle, can be used for components that are process-oriented:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1(["This is the text in the box"])
|
id1(["This is the text in the box"])
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1(["This is the text in the box"])
|
id1(["This is the text in the box"])
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -275,12 +275,12 @@ block
|
|||||||
For representing subroutines or contained processes, a block with double vertical lines is useful:
|
For representing subroutines or contained processes, a block with double vertical lines is useful:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1[["This is the text in the box"]]
|
id1[["This is the text in the box"]]
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1[["This is the text in the box"]]
|
id1[["This is the text in the box"]]
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -289,12 +289,12 @@ block
|
|||||||
The cylindrical shape is ideal for representing databases or storage components:
|
The cylindrical shape is ideal for representing databases or storage components:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1[("Database")]
|
id1[("Database")]
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1[("Database")]
|
id1[("Database")]
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -303,12 +303,12 @@ block
|
|||||||
A circle can be used for centralized or pivotal components:
|
A circle can be used for centralized or pivotal components:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1(("This is the text in the circle"))
|
id1(("This is the text in the circle"))
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1(("This is the text in the circle"))
|
id1(("This is the text in the circle"))
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -319,36 +319,36 @@ For decision points, use a rhombus, and for unique or specialized processes, asy
|
|||||||
**Asymmetric**
|
**Asymmetric**
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1>"This is the text in the box"]
|
id1>"This is the text in the box"]
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1>"This is the text in the box"]
|
id1>"This is the text in the box"]
|
||||||
```
|
```
|
||||||
|
|
||||||
**Rhombus**
|
**Rhombus**
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1{"This is the text in the box"}
|
id1{"This is the text in the box"}
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1{"This is the text in the box"}
|
id1{"This is the text in the box"}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Hexagon**
|
**Hexagon**
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1{{"This is the text in the box"}}
|
id1{{"This is the text in the box"}}
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1{{"This is the text in the box"}}
|
id1{{"This is the text in the box"}}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -357,7 +357,7 @@ block
|
|||||||
Parallelogram and trapezoid shapes are perfect for inputs/outputs and transitional processes:
|
Parallelogram and trapezoid shapes are perfect for inputs/outputs and transitional processes:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1[/"This is the text in the box"/]
|
id1[/"This is the text in the box"/]
|
||||||
id2[\"This is the text in the box"\]
|
id2[\"This is the text in the box"\]
|
||||||
A[/"Christmas"\]
|
A[/"Christmas"\]
|
||||||
@@ -365,7 +365,7 @@ block
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1[/"This is the text in the box"/]
|
id1[/"This is the text in the box"/]
|
||||||
id2[\"This is the text in the box"\]
|
id2[\"This is the text in the box"\]
|
||||||
A[/"Christmas"\]
|
A[/"Christmas"\]
|
||||||
@@ -377,12 +377,12 @@ block
|
|||||||
For highlighting critical or high-priority components, a double circle can be effective:
|
For highlighting critical or high-priority components, a double circle can be effective:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1((("This is the text in the circle")))
|
id1((("This is the text in the circle")))
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1((("This is the text in the circle")))
|
id1((("This is the text in the circle")))
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ Mermaid also offers unique shapes like block arrows and space blocks for directi
|
|||||||
Block arrows can visually indicate direction or flow within a process:
|
Block arrows can visually indicate direction or flow within a process:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
blockArrowId<["Label"]>(right)
|
blockArrowId<["Label"]>(right)
|
||||||
blockArrowId2<["Label"]>(left)
|
blockArrowId2<["Label"]>(left)
|
||||||
blockArrowId3<["Label"]>(up)
|
blockArrowId3<["Label"]>(up)
|
||||||
@@ -406,7 +406,7 @@ block
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
blockArrowId<["Label"]>(right)
|
blockArrowId<["Label"]>(right)
|
||||||
blockArrowId2<["Label"]>(left)
|
blockArrowId2<["Label"]>(left)
|
||||||
blockArrowId3<["Label"]>(up)
|
blockArrowId3<["Label"]>(up)
|
||||||
@@ -421,14 +421,14 @@ block
|
|||||||
Space blocks can be used to create intentional empty spaces in the diagram, which is useful for layout and readability:
|
Space blocks can be used to create intentional empty spaces in the diagram, which is useful for layout and readability:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a space b
|
a space b
|
||||||
c d e
|
c d e
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
a space b
|
a space b
|
||||||
c d e
|
c d e
|
||||||
@@ -437,12 +437,12 @@ block
|
|||||||
or
|
or
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
ida space:3 idb idc
|
ida space:3 idb idc
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
ida space:3 idb idc
|
ida space:3 idb idc
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -467,13 +467,13 @@ The most fundamental aspect of connecting blocks is the use of arrows or links.
|
|||||||
A simple link with an arrow can be created to show direction or flow from one block to another:
|
A simple link with an arrow can be created to show direction or flow from one block to another:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
A space B
|
A space B
|
||||||
A-->B
|
A-->B
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
A space B
|
A space B
|
||||||
A-->B
|
A-->B
|
||||||
```
|
```
|
||||||
@@ -490,13 +490,13 @@ Example - Text with Links
|
|||||||
To add text to a link, the syntax includes the text within the link definition:
|
To add text to a link, the syntax includes the text within the link definition:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
A space:2 B
|
A space:2 B
|
||||||
A-- "X" -->B
|
A-- "X" -->B
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
A space:2 B
|
A space:2 B
|
||||||
A-- "X" -->B
|
A-- "X" -->B
|
||||||
```
|
```
|
||||||
@@ -506,7 +506,7 @@ This example show how to add descriptive text to the links, enhancing the inform
|
|||||||
Example - Edges and Styles:
|
Example - Edges and Styles:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
columns 1
|
columns 1
|
||||||
db(("DB"))
|
db(("DB"))
|
||||||
blockArrowId6<[" "]>(down)
|
blockArrowId6<[" "]>(down)
|
||||||
@@ -523,7 +523,7 @@ columns 1
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
columns 1
|
columns 1
|
||||||
db(("DB"))
|
db(("DB"))
|
||||||
blockArrowId6<[" "]>(down)
|
blockArrowId6<[" "]>(down)
|
||||||
@@ -552,7 +552,7 @@ Mermaid enables detailed styling of individual blocks, allowing you to apply var
|
|||||||
To apply custom styles to a block, you can use the `style` keyword followed by the block identifier and the desired CSS properties:
|
To apply custom styles to a block, you can use the `style` keyword followed by the block identifier and the desired CSS properties:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
id1 space id2
|
id1 space id2
|
||||||
id1("Start")-->id2("Stop")
|
id1("Start")-->id2("Stop")
|
||||||
style id1 fill:#636,stroke:#333,stroke-width:4px
|
style id1 fill:#636,stroke:#333,stroke-width:4px
|
||||||
@@ -560,7 +560,7 @@ block
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
id1 space id2
|
id1 space id2
|
||||||
id1("Start")-->id2("Stop")
|
id1("Start")-->id2("Stop")
|
||||||
style id1 fill:#636,stroke:#333,stroke-width:4px
|
style id1 fill:#636,stroke:#333,stroke-width:4px
|
||||||
@@ -574,7 +574,7 @@ Mermaid enables applying styling to classes, which could make styling easier if
|
|||||||
#### Example - Styling a Single Class
|
#### Example - Styling a Single Class
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
A space B
|
A space B
|
||||||
A-->B
|
A-->B
|
||||||
classDef blue fill:#6e6ce6,stroke:#333,stroke-width:4px;
|
classDef blue fill:#6e6ce6,stroke:#333,stroke-width:4px;
|
||||||
@@ -583,7 +583,7 @@ block
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
A space B
|
A space B
|
||||||
A-->B
|
A-->B
|
||||||
classDef blue fill:#6e6ce6,stroke:#333,stroke-width:4px;
|
classDef blue fill:#6e6ce6,stroke:#333,stroke-width:4px;
|
||||||
@@ -608,7 +608,7 @@ Combining the elements of structure, linking, and styling, we can create compreh
|
|||||||
Illustrating a simple software system architecture with interconnected components:
|
Illustrating a simple software system architecture with interconnected components:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
Frontend blockArrowId6<[" "]>(right) Backend
|
Frontend blockArrowId6<[" "]>(right) Backend
|
||||||
space:2 down<[" "]>(down)
|
space:2 down<[" "]>(down)
|
||||||
@@ -621,7 +621,7 @@ block
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
Frontend blockArrowId6<[" "]>(right) Backend
|
Frontend blockArrowId6<[" "]>(right) Backend
|
||||||
space:2 down<[" "]>(down)
|
space:2 down<[" "]>(down)
|
||||||
@@ -640,7 +640,7 @@ This example shows a basic architecture with a frontend, backend, and database.
|
|||||||
Representing a business process flow with decision points and multiple stages:
|
Representing a business process flow with decision points and multiple stages:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
Start(("Start")) space:2
|
Start(("Start")) space:2
|
||||||
down<[" "]>(down) space:2
|
down<[" "]>(down) space:2
|
||||||
@@ -653,7 +653,7 @@ block
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
columns 3
|
columns 3
|
||||||
Start(("Start")) space:2
|
Start(("Start")) space:2
|
||||||
down<[" "]>(down) space:2
|
down<[" "]>(down) space:2
|
||||||
@@ -682,7 +682,7 @@ Understanding and avoiding common syntax errors is key to a smooth experience wi
|
|||||||
A common mistake is incorrect linking syntax, which can lead to unexpected results or broken diagrams:
|
A common mistake is incorrect linking syntax, which can lead to unexpected results or broken diagrams:
|
||||||
|
|
||||||
```
|
```
|
||||||
block
|
block-beta
|
||||||
A - B
|
A - B
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -690,13 +690,13 @@ block
|
|||||||
Ensure that links between blocks are correctly specified with arrows (--> or ---) to define the direction and type of connection. Also remember that one of the fundamentals for block diagram is to give the author full control of where the boxes are positioned so in the example you need to add a space between the boxes:
|
Ensure that links between blocks are correctly specified with arrows (--> or ---) to define the direction and type of connection. Also remember that one of the fundamentals for block diagram is to give the author full control of where the boxes are positioned so in the example you need to add a space between the boxes:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
A space B
|
A space B
|
||||||
A --> B
|
A --> B
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
A space B
|
A space B
|
||||||
A --> B
|
A --> B
|
||||||
```
|
```
|
||||||
@@ -706,13 +706,13 @@ block
|
|||||||
Applying styles in the wrong context or with incorrect syntax can lead to blocks not being styled as intended:
|
Applying styles in the wrong context or with incorrect syntax can lead to blocks not being styled as intended:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
A
|
A
|
||||||
style A fill#969;
|
style A fill#969;
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
A
|
A
|
||||||
style A fill#969;
|
style A fill#969;
|
||||||
```
|
```
|
||||||
@@ -721,14 +721,14 @@ Applying styles in the wrong context or with incorrect syntax can lead to blocks
|
|||||||
Correct the syntax by ensuring proper separation of style properties with commas and using the correct CSS property format:
|
Correct the syntax by ensuring proper separation of style properties with commas and using the correct CSS property format:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
block
|
block-beta
|
||||||
A
|
A
|
||||||
style A fill:#969,stroke:#333;
|
style A fill:#969,stroke:#333;
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
block
|
block-beta
|
||||||
A
|
A
|
||||||
style A fill:#969,stroke:#333;
|
style A fill:#969,stroke:#333;
|
||||||
|
|
||||||
|
@@ -326,9 +326,7 @@ Below is a comprehensive list of the newly introduced shapes and their correspon
|
|||||||
|
|
||||||
| **Semantic Name** | **Shape Name** | **Short Name** | **Description** | **Alias Supported** |
|
| **Semantic Name** | **Shape Name** | **Short Name** | **Description** | **Alias Supported** |
|
||||||
| --------------------------------- | ---------------------- | -------------- | ------------------------------ | ---------------------------------------------------------------- |
|
| --------------------------------- | ---------------------- | -------------- | ------------------------------ | ---------------------------------------------------------------- |
|
||||||
| Bang | Bang | `bang` | Bang | `bang` |
|
|
||||||
| Card | Notched Rectangle | `notch-rect` | Represents a card | `card`, `notched-rectangle` |
|
| Card | Notched Rectangle | `notch-rect` | Represents a card | `card`, `notched-rectangle` |
|
||||||
| Cloud | Cloud | `cloud` | cloud | `cloud` |
|
|
||||||
| Collate | Hourglass | `hourglass` | Represents a collate operation | `collate`, `hourglass` |
|
| Collate | Hourglass | `hourglass` | Represents a collate operation | `collate`, `hourglass` |
|
||||||
| Com Link | Lightning Bolt | `bolt` | Communication link | `com-link`, `lightning-bolt` |
|
| Com Link | Lightning Bolt | `bolt` | Communication link | `com-link`, `lightning-bolt` |
|
||||||
| Comment | Curly Brace | `brace` | Adds a comment | `brace-l`, `comment` |
|
| Comment | Curly Brace | `brace` | Adds a comment | `brace-l`, `comment` |
|
||||||
@@ -985,23 +983,11 @@ flowchart TD
|
|||||||
- `b`
|
- `b`
|
||||||
- **w**: The width of the image. If not defined, this will default to the natural width of the image.
|
- **w**: The width of the image. If not defined, this will default to the natural width of the image.
|
||||||
- **h**: The height of the image. If not defined, this will default to the natural height of the image.
|
- **h**: The height of the image. If not defined, this will default to the natural height of the image.
|
||||||
- **constraint**: Determines if the image should constrain the node size. This setting also ensures the image maintains its original aspect ratio, adjusting the width (`w`) accordingly to the height (`h`). If not defined, this will default to `off` Possible values are:
|
- **constraint**: Determines if the image should constrain the node size. This setting also ensures the image maintains its original aspect ratio, adjusting the height (`h`) accordingly to the width (`w`). If not defined, this will default to `off` Possible values are:
|
||||||
- `on`
|
- `on`
|
||||||
- `off`
|
- `off`
|
||||||
|
|
||||||
If you want to resize an image, but keep the same aspect ratio, set `h`, and set `constraint: on` to constrain the aspect ratio. E.g.
|
These new shapes provide additional flexibility and visual appeal to your flowcharts, making them more informative and engaging.
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
flowchart TD
|
|
||||||
%% My image with a constrained aspect ratio
|
|
||||||
A@{ img: "https://mermaid.js.org/favicon.svg", label: "My example image label", pos: "t", h: 60, constraint: "on" }
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
flowchart TD
|
|
||||||
%% My image with a constrained aspect ratio
|
|
||||||
A@{ img: "https://mermaid.js.org/favicon.svg", label: "My example image label", pos: "t", h: 60, constraint: "on" }
|
|
||||||
```
|
|
||||||
|
|
||||||
## Links between nodes
|
## Links between nodes
|
||||||
|
|
||||||
@@ -1830,7 +1816,7 @@ config:
|
|||||||
graph LR
|
graph LR
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Edge level curve style using Edge IDs (v11.10.0+)
|
#### Edge level curve style using Edge IDs (v\<MERMAID_RELEASE_VERSION>+)
|
||||||
|
|
||||||
You can assign IDs to [edges](#attaching-an-id-to-edges). After assigning an ID you can modify the line style by modifying the edge's `curve` property using the following syntax:
|
You can assign IDs to [edges](#attaching-an-id-to-edges). After assigning an ID you can modify the line style by modifying the edge's `curve` property using the following syntax:
|
||||||
|
|
||||||
|
@@ -314,22 +314,3 @@ You can also refer the [implementation in the live editor](https://github.com/me
|
|||||||
cspell:locale en,en-gb
|
cspell:locale en,en-gb
|
||||||
cspell:ignore Buzan
|
cspell:ignore Buzan
|
||||||
--->
|
--->
|
||||||
|
|
||||||
## Layouts
|
|
||||||
|
|
||||||
Mermaid also supports a Tidy Tree layout for mindmaps.
|
|
||||||
|
|
||||||
```
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap is a long thing))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
C
|
|
||||||
D
|
|
||||||
```
|
|
||||||
|
|
||||||
Instructions to add and register tidy-tree layout are present in [Tidy Tree Configuration](/config/tidy-tree)
|
|
||||||
|
@@ -37,11 +37,6 @@ Drawing a pie chart is really simple in mermaid.
|
|||||||
- Followed by `:` colon as separator
|
- Followed by `:` colon as separator
|
||||||
- Followed by `positive numeric value` (supported up to two decimal places)
|
- Followed by `positive numeric value` (supported up to two decimal places)
|
||||||
|
|
||||||
**Note:**
|
|
||||||
|
|
||||||
> Pie chart values must be **positive numbers greater than zero**.
|
|
||||||
> **Negative values are not allowed** and will result in an error.
|
|
||||||
|
|
||||||
\[pie] \[showData] (OPTIONAL)
|
\[pie] \[showData] (OPTIONAL)
|
||||||
\[title] \[titlevalue] (OPTIONAL)
|
\[title] \[titlevalue] (OPTIONAL)
|
||||||
"\[datakey1]" : \[dataValue1]
|
"\[datakey1]" : \[dataValue1]
|
||||||
|
@@ -23,7 +23,7 @@ config:
|
|||||||
sankey:
|
sankey:
|
||||||
showValues: false
|
showValues: false
|
||||||
---
|
---
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
Agricultural 'waste',Bio-conversion,124.729
|
Agricultural 'waste',Bio-conversion,124.729
|
||||||
Bio-conversion,Liquid,0.597
|
Bio-conversion,Liquid,0.597
|
||||||
@@ -101,7 +101,7 @@ config:
|
|||||||
sankey:
|
sankey:
|
||||||
showValues: false
|
showValues: false
|
||||||
---
|
---
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
Agricultural 'waste',Bio-conversion,124.729
|
Agricultural 'waste',Bio-conversion,124.729
|
||||||
Bio-conversion,Liquid,0.597
|
Bio-conversion,Liquid,0.597
|
||||||
@@ -175,7 +175,7 @@ Wind,Electricity grid,289.366
|
|||||||
|
|
||||||
## Syntax
|
## Syntax
|
||||||
|
|
||||||
The idea behind syntax is that a user types `sankey` keyword first, then pastes raw CSV below and get the result.
|
The idea behind syntax is that a user types `sankey-beta` keyword first, then pastes raw CSV below and get the result.
|
||||||
|
|
||||||
It implements CSV standard as [described here](https://www.ietf.org/rfc/rfc4180.txt) with subtle **differences**:
|
It implements CSV standard as [described here](https://www.ietf.org/rfc/rfc4180.txt) with subtle **differences**:
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ It implements CSV standard as [described here](https://www.ietf.org/rfc/rfc4180.
|
|||||||
It is implied that 3 columns inside CSV should represent `source`, `target` and `value` accordingly:
|
It is implied that 3 columns inside CSV should represent `source`, `target` and `value` accordingly:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
%% source,target,value
|
%% source,target,value
|
||||||
Electricity grid,Over generation / exports,104.453
|
Electricity grid,Over generation / exports,104.453
|
||||||
@@ -196,7 +196,7 @@ Electricity grid,H2 conversion,27.14
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
%% source,target,value
|
%% source,target,value
|
||||||
Electricity grid,Over generation / exports,104.453
|
Electricity grid,Over generation / exports,104.453
|
||||||
@@ -209,7 +209,7 @@ Electricity grid,H2 conversion,27.14
|
|||||||
CSV does not support empty lines without comma delimiters by default. But you can add them if needed:
|
CSV does not support empty lines without comma delimiters by default. But you can add them if needed:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
Bio-conversion,Losses,26.862
|
Bio-conversion,Losses,26.862
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ Bio-conversion,Gas,81.144
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
Bio-conversion,Losses,26.862
|
Bio-conversion,Losses,26.862
|
||||||
|
|
||||||
@@ -233,14 +233,14 @@ Bio-conversion,Gas,81.144
|
|||||||
If you need to have a comma, wrap it in double quotes:
|
If you need to have a comma, wrap it in double quotes:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
Pumped heat,"Heating and cooling, homes",193.026
|
Pumped heat,"Heating and cooling, homes",193.026
|
||||||
Pumped heat,"Heating and cooling, commercial",70.672
|
Pumped heat,"Heating and cooling, commercial",70.672
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
Pumped heat,"Heating and cooling, homes",193.026
|
Pumped heat,"Heating and cooling, homes",193.026
|
||||||
Pumped heat,"Heating and cooling, commercial",70.672
|
Pumped heat,"Heating and cooling, commercial",70.672
|
||||||
@@ -251,14 +251,14 @@ Pumped heat,"Heating and cooling, commercial",70.672
|
|||||||
If you need to have double quote, put a pair of them inside quoted string:
|
If you need to have double quote, put a pair of them inside quoted string:
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
Pumped heat,"Heating and cooling, ""homes""",193.026
|
Pumped heat,"Heating and cooling, ""homes""",193.026
|
||||||
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
sankey
|
sankey-beta
|
||||||
|
|
||||||
Pumped heat,"Heating and cooling, ""homes""",193.026
|
Pumped heat,"Heating and cooling, ""homes""",193.026
|
||||||
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
Pumped heat,"Heating and cooling, ""commercial""",70.672
|
||||||
|
@@ -74,126 +74,6 @@ sequenceDiagram
|
|||||||
Bob->>Alice: Hi Alice
|
Bob->>Alice: Hi Alice
|
||||||
```
|
```
|
||||||
|
|
||||||
### Boundary
|
|
||||||
|
|
||||||
If you want to use the boundary symbol for a participant, use the JSON configuration syntax as shown below.
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "boundary" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Request from boundary
|
|
||||||
Bob->>Alice: Response to boundary
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "boundary" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Request from boundary
|
|
||||||
Bob->>Alice: Response to boundary
|
|
||||||
```
|
|
||||||
|
|
||||||
### Control
|
|
||||||
|
|
||||||
If you want to use the control symbol for a participant, use the JSON configuration syntax as shown below.
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "control" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Control request
|
|
||||||
Bob->>Alice: Control response
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "control" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Control request
|
|
||||||
Bob->>Alice: Control response
|
|
||||||
```
|
|
||||||
|
|
||||||
### Entity
|
|
||||||
|
|
||||||
If you want to use the entity symbol for a participant, use the JSON configuration syntax as shown below.
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "entity" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Entity request
|
|
||||||
Bob->>Alice: Entity response
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "entity" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Entity request
|
|
||||||
Bob->>Alice: Entity response
|
|
||||||
```
|
|
||||||
|
|
||||||
### Database
|
|
||||||
|
|
||||||
If you want to use the database symbol for a participant, use the JSON configuration syntax as shown below.
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "database" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: DB query
|
|
||||||
Bob->>Alice: DB result
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "database" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: DB query
|
|
||||||
Bob->>Alice: DB result
|
|
||||||
```
|
|
||||||
|
|
||||||
### Collections
|
|
||||||
|
|
||||||
If you want to use the collections symbol for a participant, use the JSON configuration syntax as shown below.
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "collections" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Collections request
|
|
||||||
Bob->>Alice: Collections response
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "collections" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Collections request
|
|
||||||
Bob->>Alice: Collections response
|
|
||||||
```
|
|
||||||
|
|
||||||
### Queue
|
|
||||||
|
|
||||||
If you want to use the queue symbol for a participant, use the JSON configuration syntax as shown below.
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "queue" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Queue message
|
|
||||||
Bob->>Alice: Queue response
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice@{ "type" : "queue" }
|
|
||||||
participant Bob
|
|
||||||
Alice->>Bob: Queue message
|
|
||||||
Bob->>Alice: Queue response
|
|
||||||
```
|
|
||||||
|
|
||||||
### Aliases
|
### Aliases
|
||||||
|
|
||||||
The actor can have a convenient identifier and a descriptive label.
|
The actor can have a convenient identifier and a descriptive label.
|
||||||
@@ -329,11 +209,7 @@ Messages can be of two displayed either solid or with a dotted line.
|
|||||||
[Actor][Arrow][Actor]:Message text
|
[Actor][Arrow][Actor]:Message text
|
||||||
```
|
```
|
||||||
|
|
||||||
Lines can be solid or dotted, and can end with various types of arrowheads, crosses, or open arrows.
|
There are ten types of arrows currently supported:
|
||||||
|
|
||||||
#### Supported Arrow Types
|
|
||||||
|
|
||||||
**Standard Arrow Types**
|
|
||||||
|
|
||||||
| Type | Description |
|
| Type | Description |
|
||||||
| -------- | ---------------------------------------------------- |
|
| -------- | ---------------------------------------------------- |
|
||||||
@@ -348,58 +224,6 @@ Lines can be solid or dotted, and can end with various types of arrowheads, cros
|
|||||||
| `-)` | Solid line with an open arrow at the end (async) |
|
| `-)` | Solid line with an open arrow at the end (async) |
|
||||||
| `--)` | Dotted line with a open arrow at the end (async) |
|
| `--)` | Dotted line with a open arrow at the end (async) |
|
||||||
|
|
||||||
**Half-Arrows (v\<MERMAID_RELEASE_VERSION>+)**
|
|
||||||
|
|
||||||
The following half-arrow types are supported for more expressive sequence diagrams. Both solid and dotted variants are available by increasing the number of dashes (`-` → `--`).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
| Type | Description |
|
|
||||||
| ------- | ---------------------------------------------------- |
|
|
||||||
| `-\|\` | Solid line with top half arrowhead |
|
|
||||||
| `--\|\` | Dotted line with top half arrowhead |
|
|
||||||
| `-\|/` | Solid line with bottom half arrowhead |
|
|
||||||
| `--\|/` | Dotted line with bottom half arrowhead |
|
|
||||||
| `/\|-` | Solid line with reverse top half arrowhead |
|
|
||||||
| `/\|--` | Dotted line with reverse top half arrowhead |
|
|
||||||
| `\\-` | Solid line with reverse bottom half arrowhead |
|
|
||||||
| `\\--` | Dotted line with reverse bottom half arrowhead |
|
|
||||||
| `-\\` | Solid line with top stick half arrowhead |
|
|
||||||
| `--\\` | Dotted line with top stick half arrowhead |
|
|
||||||
| `-//` | Solid line with bottom stick half arrowhead |
|
|
||||||
| `--//` | Dotted line with bottom stick half arrowhead |
|
|
||||||
| `//-` | Solid line with reverse top stick half arrowhead |
|
|
||||||
| `//--` | Dotted line with reverse top stick half arrowhead |
|
|
||||||
| `\\-` | Solid line with reverse bottom stick half arrowhead |
|
|
||||||
| `\\--` | Dotted line with reverse bottom stick half arrowhead |
|
|
||||||
|
|
||||||
## Central Connections (v\<MERMAID_RELEASE_VERSION>+)
|
|
||||||
|
|
||||||
Mermaid sequence diagrams support **central lifeline connections** using a `()`.
|
|
||||||
This is useful to represent messages or signals that connect to a central point, rather than from one actor directly to another.
|
|
||||||
|
|
||||||
To indicate a central connection, append `()` to the arrow syntax.
|
|
||||||
|
|
||||||
#### Basic Syntax
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
participant John
|
|
||||||
Alice->>()John: Hello John
|
|
||||||
Alice()->>John: How are you?
|
|
||||||
John()->>()Alice: Great!
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant Alice
|
|
||||||
participant John
|
|
||||||
Alice->>()John: Hello John
|
|
||||||
Alice()->>John: How are you?
|
|
||||||
John()->>()Alice: Great!
|
|
||||||
```
|
|
||||||
|
|
||||||
## Activations
|
## Activations
|
||||||
|
|
||||||
It is possible to activate and deactivate an actor. (de)activation can be dedicated declarations:
|
It is possible to activate and deactivate an actor. (de)activation can be dedicated declarations:
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
## Example
|
## Example
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -22,7 +22,7 @@ xychart
|
|||||||
```
|
```
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -40,7 +40,7 @@ xychart
|
|||||||
The chart can be drawn horizontal or vertical, default value is vertical.
|
The chart can be drawn horizontal or vertical, default value is vertical.
|
||||||
|
|
||||||
```
|
```
|
||||||
xychart horizontal
|
xychart-beta horizontal
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ The title is a short description of the chart and it will always render on top o
|
|||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
```
|
```
|
||||||
xychart
|
xychart-beta
|
||||||
title "This is a simple example"
|
title "This is a simple example"
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
@@ -98,10 +98,10 @@ A bar chart offers the capability to graphically depict bars.
|
|||||||
|
|
||||||
#### Simplest example
|
#### Simplest example
|
||||||
|
|
||||||
The only two things required are the chart name (`xychart`) and one data set. So you will be able to draw a chart with a simple config like
|
The only two things required are the chart name (`xychart-beta`) and one data set. So you will be able to draw a chart with a simple config like
|
||||||
|
|
||||||
```
|
```
|
||||||
xychart
|
xychart-beta
|
||||||
line [+1.3, .6, 2.4, -.34]
|
line [+1.3, .6, 2.4, -.34]
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ xychart
|
|||||||
|
|
||||||
## Chart Theme Variables
|
## Chart Theme Variables
|
||||||
|
|
||||||
Themes for xychart reside inside the `xychart` attribute, allowing customization through the following syntax:
|
Themes for xychart resides inside xychart attribute so to set the variables use this syntax:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
@@ -163,52 +163,6 @@ config:
|
|||||||
| yAxisLineColor | Color of the y-axis line |
|
| yAxisLineColor | Color of the y-axis line |
|
||||||
| plotColorPalette | String of colors separated by comma e.g. "#f3456, #43445" |
|
| plotColorPalette | String of colors separated by comma e.g. "#f3456, #43445" |
|
||||||
|
|
||||||
### Setting Colors for Lines and Bars
|
|
||||||
|
|
||||||
To set the color for lines and bars, use the `plotColorPalette` parameter. Colors in the palette will correspond sequentially to the elements in your chart (e.g., first bar/line will use the first color specified in the palette).
|
|
||||||
|
|
||||||
```mermaid-example
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
themeVariables:
|
|
||||||
xyChart:
|
|
||||||
plotColorPalette: '#000000, #0000FF, #00FF00, #FF0000'
|
|
||||||
---
|
|
||||||
xychart
|
|
||||||
title "Different Colors in xyChart"
|
|
||||||
x-axis "categoriesX" ["Category 1", "Category 2", "Category 3", "Category 4"]
|
|
||||||
y-axis "valuesY" 0 --> 50
|
|
||||||
%% Black line
|
|
||||||
line [10,20,30,40]
|
|
||||||
%% Blue bar
|
|
||||||
bar [20,30,25,35]
|
|
||||||
%% Green bar
|
|
||||||
bar [15,25,20,30]
|
|
||||||
%% Red line
|
|
||||||
line [5,15,25,35]
|
|
||||||
```
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
themeVariables:
|
|
||||||
xyChart:
|
|
||||||
plotColorPalette: '#000000, #0000FF, #00FF00, #FF0000'
|
|
||||||
---
|
|
||||||
xychart
|
|
||||||
title "Different Colors in xyChart"
|
|
||||||
x-axis "categoriesX" ["Category 1", "Category 2", "Category 3", "Category 4"]
|
|
||||||
y-axis "valuesY" 0 --> 50
|
|
||||||
%% Black line
|
|
||||||
line [10,20,30,40]
|
|
||||||
%% Blue bar
|
|
||||||
bar [20,30,25,35]
|
|
||||||
%% Green bar
|
|
||||||
bar [15,25,20,30]
|
|
||||||
%% Red line
|
|
||||||
line [5,15,25,35]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Example on config and theme
|
## Example on config and theme
|
||||||
|
|
||||||
```mermaid-example
|
```mermaid-example
|
||||||
@@ -222,7 +176,7 @@ config:
|
|||||||
xyChart:
|
xyChart:
|
||||||
titleColor: "#ff0000"
|
titleColor: "#ff0000"
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
@@ -241,7 +195,7 @@ config:
|
|||||||
xyChart:
|
xyChart:
|
||||||
titleColor: "#ff0000"
|
titleColor: "#ff0000"
|
||||||
---
|
---
|
||||||
xychart
|
xychart-beta
|
||||||
title "Sales Revenue"
|
title "Sales Revenue"
|
||||||
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
|
||||||
y-axis "Revenue (in $)" 4000 --> 11000
|
y-axis "Revenue (in $)" 4000 --> 11000
|
||||||
|
@@ -17,7 +17,6 @@ export default tseslint.config(
|
|||||||
...tseslint.configs.stylisticTypeChecked,
|
...tseslint.configs.stylisticTypeChecked,
|
||||||
{
|
{
|
||||||
ignores: [
|
ignores: [
|
||||||
'**/*.d.ts',
|
|
||||||
'**/dist/',
|
'**/dist/',
|
||||||
'**/node_modules/',
|
'**/node_modules/',
|
||||||
'.git/',
|
'.git/',
|
||||||
|
@@ -27,6 +27,9 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mermaid": "workspace:*"
|
"mermaid": "workspace:*"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"mermaid": "workspace:~"
|
||||||
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,5 @@
|
|||||||
# @mermaid-js/layout-elk
|
# @mermaid-js/layout-elk
|
||||||
|
|
||||||
## 0.1.9
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#6857](https://github.com/mermaid-js/mermaid/pull/6857) [`b9ef683`](https://github.com/mermaid-js/mermaid/commit/b9ef683fb67b8959abc455d6cc5266c37ba435f6) Thanks [@knsv](https://github.com/knsv)! - feat: Exposing elk configuration forceNodeModelOrder and considerModelOrder to the mermaid configuration
|
|
||||||
|
|
||||||
- [#6849](https://github.com/mermaid-js/mermaid/pull/6849) [`2260948`](https://github.com/mermaid-js/mermaid/commit/2260948b7bda08f00616c2ce678bed1da69eb96c) Thanks [@anderium](https://github.com/anderium)! - Make elk not force node model order, but strongly consider it instead
|
|
||||||
|
|
||||||
- Updated dependencies [[`b9ef683`](https://github.com/mermaid-js/mermaid/commit/b9ef683fb67b8959abc455d6cc5266c37ba435f6), [`2c0931d`](https://github.com/mermaid-js/mermaid/commit/2c0931da46794b49d2523211e25f782900c34e94), [`33e08da`](https://github.com/mermaid-js/mermaid/commit/33e08daf175125295a06b1b80279437004a4e865), [`814b68b`](https://github.com/mermaid-js/mermaid/commit/814b68b4a94813f7c6b3d7fb4559532a7bab2652), [`fce7cab`](https://github.com/mermaid-js/mermaid/commit/fce7cabb71d68a20a66246fe23d066512126a412), [`fc07f0d`](https://github.com/mermaid-js/mermaid/commit/fc07f0d8abca49e4f887d7457b7b94fb07d1e3da), [`12e01bd`](https://github.com/mermaid-js/mermaid/commit/12e01bdb5cacf3569133979a5a4f1d8973e9aec1), [`01aaef3`](https://github.com/mermaid-js/mermaid/commit/01aaef39b4a1ec8bc5a0c6bfa3a20b712d67f4dc), [`daf8d8d`](https://github.com/mermaid-js/mermaid/commit/daf8d8d3befcd600618a629977b76463b38d0ad9), [`c36cd05`](https://github.com/mermaid-js/mermaid/commit/c36cd05c45ac3090181152b4dae41f8d7b569bd6), [`8bb29fc`](https://github.com/mermaid-js/mermaid/commit/8bb29fc879329ad109898e4025b4f4eba2ab0649), [`71b04f9`](https://github.com/mermaid-js/mermaid/commit/71b04f93b07f876df2b30656ef36036c1d0e4e4f), [`c99bce6`](https://github.com/mermaid-js/mermaid/commit/c99bce6bab4c7ce0b81b66d44f44853ce4aeb1c3), [`6cc1926`](https://github.com/mermaid-js/mermaid/commit/6cc192680a2531cab28f87a8061a53b786e010f3), [`9da6fb3`](https://github.com/mermaid-js/mermaid/commit/9da6fb39ae278401771943ac85d6d1b875f78cf1), [`e48b0ba`](https://github.com/mermaid-js/mermaid/commit/e48b0ba61dab7f95aa02da603b5b7d383b894932), [`4d62d59`](https://github.com/mermaid-js/mermaid/commit/4d62d5963238400270e9314c6e4d506f48147074), [`e9ce8cf`](https://github.com/mermaid-js/mermaid/commit/e9ce8cf4da9062d85098042044822100889bb0dd), [`9258b29`](https://github.com/mermaid-js/mermaid/commit/9258b2933bbe1ef41087345ffea3731673671c49), [`da90f67`](https://github.com/mermaid-js/mermaid/commit/da90f6760b6efb0da998bcb63b75eecc29e06c08), [`0133f1c`](https://github.com/mermaid-js/mermaid/commit/0133f1c0c5cff4fc4c8e0b99e9cf0b3d49dcbe71), [`895f9d4`](https://github.com/mermaid-js/mermaid/commit/895f9d43ff98ca05ebfba530789f677f31a011ff)]:
|
|
||||||
- mermaid@11.10.0
|
|
||||||
|
|
||||||
## 0.1.8
|
## 0.1.8
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
@@ -69,4 +69,4 @@ mermaid.registerLayoutLoaders(elkLayouts);
|
|||||||
- `elk.mrtree`: Multi-root tree layout
|
- `elk.mrtree`: Multi-root tree layout
|
||||||
- `elk.sporeOverlap`: Spore overlap layout
|
- `elk.sporeOverlap`: Spore overlap layout
|
||||||
|
|
||||||
<!-- TODO: Add images for these layouts, as GitHub doesn't support natively. -->
|
<!-- TODO: Add images for these layouts, as GitHub doesn't support natively -->
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mermaid-js/layout-elk",
|
"name": "@mermaid-js/layout-elk",
|
||||||
"version": "0.1.9",
|
"version": "0.1.8",
|
||||||
"description": "ELK layout engine for mermaid",
|
"description": "ELK layout engine for mermaid",
|
||||||
"module": "dist/mermaid-layout-elk.core.mjs",
|
"module": "dist/mermaid-layout-elk.core.mjs",
|
||||||
"types": "dist/layouts.d.ts",
|
"types": "dist/layouts.d.ts",
|
||||||
|
@@ -1,67 +0,0 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
|
||||||
import {
|
|
||||||
intersection,
|
|
||||||
ensureTrulyOutside,
|
|
||||||
makeInsidePoint,
|
|
||||||
tryNodeIntersect,
|
|
||||||
replaceEndpoint,
|
|
||||||
type RectLike,
|
|
||||||
type P,
|
|
||||||
} from '../geometry.js';
|
|
||||||
|
|
||||||
const approx = (a: number, b: number, eps = 1e-6) => Math.abs(a - b) < eps;
|
|
||||||
|
|
||||||
describe('geometry helpers', () => {
|
|
||||||
it('intersection: vertical approach hits bottom border', () => {
|
|
||||||
const rect: RectLike = { x: 0, y: 0, width: 100, height: 50 };
|
|
||||||
const h = rect.height / 2; // 25
|
|
||||||
const outside: P = { x: 0, y: 100 };
|
|
||||||
const inside: P = { x: 0, y: 0 };
|
|
||||||
const res = intersection(rect, outside, inside);
|
|
||||||
expect(approx(res.x, 0)).toBe(true);
|
|
||||||
expect(approx(res.y, h)).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('ensureTrulyOutside nudges near-boundary point outward', () => {
|
|
||||||
const rect: RectLike = { x: 0, y: 0, width: 100, height: 50 };
|
|
||||||
// near bottom boundary (y ~ h)
|
|
||||||
const near: P = { x: 0, y: rect.height / 2 - 0.2 };
|
|
||||||
const out = ensureTrulyOutside(rect, near, 10);
|
|
||||||
expect(out.y).toBeGreaterThan(rect.height / 2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('makeInsidePoint keeps x for vertical and y from center', () => {
|
|
||||||
const rect: RectLike = { x: 10, y: 5, width: 100, height: 50 };
|
|
||||||
const outside: P = { x: 10, y: 40 };
|
|
||||||
const center: P = { x: 99, y: -123 }; // center y should be used
|
|
||||||
const inside = makeInsidePoint(rect, outside, center);
|
|
||||||
expect(inside.x).toBe(outside.x);
|
|
||||||
expect(inside.y).toBe(center.y);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('tryNodeIntersect returns null for wrong-side intersections', () => {
|
|
||||||
const rect: RectLike = { x: 0, y: 0, width: 100, height: 50 };
|
|
||||||
const outside: P = { x: -50, y: 0 };
|
|
||||||
const node = { intersect: () => ({ x: 10, y: 0 }) } as any; // right side of center
|
|
||||||
const res = tryNodeIntersect(node, rect, outside);
|
|
||||||
expect(res).toBeNull();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('replaceEndpoint dedup removes end/start appropriately', () => {
|
|
||||||
const pts: P[] = [
|
|
||||||
{ x: 0, y: 0 },
|
|
||||||
{ x: 1, y: 1 },
|
|
||||||
];
|
|
||||||
// remove duplicate end
|
|
||||||
replaceEndpoint(pts, 'end', { x: 1, y: 1 });
|
|
||||||
expect(pts.length).toBe(1);
|
|
||||||
|
|
||||||
const pts2: P[] = [
|
|
||||||
{ x: 0, y: 0 },
|
|
||||||
{ x: 1, y: 1 },
|
|
||||||
];
|
|
||||||
// remove duplicate start
|
|
||||||
replaceEndpoint(pts2, 'start', { x: 0, y: 0 });
|
|
||||||
expect(pts2.length).toBe(1);
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,9 +0,0 @@
|
|||||||
export interface TreeData {
|
|
||||||
parentById: Record<string, string>;
|
|
||||||
childrenById: Record<string, string[]>;
|
|
||||||
}
|
|
||||||
export declare const findCommonAncestor: (
|
|
||||||
id1: string,
|
|
||||||
id2: string,
|
|
||||||
{ parentById }: TreeData
|
|
||||||
) => string;
|
|
@@ -1,209 +0,0 @@
|
|||||||
/* Geometry utilities extracted from render.ts for reuse and testing */
|
|
||||||
|
|
||||||
export interface P {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RectLike {
|
|
||||||
x: number; // center x
|
|
||||||
y: number; // center y
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
padding?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface NodeLike {
|
|
||||||
intersect?: (p: P) => P | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const EPS = 1;
|
|
||||||
export const PUSH_OUT = 10;
|
|
||||||
|
|
||||||
export const onBorder = (bounds: RectLike, p: P, tol = 0.5): boolean => {
|
|
||||||
const halfW = bounds.width / 2;
|
|
||||||
const halfH = bounds.height / 2;
|
|
||||||
const left = bounds.x - halfW;
|
|
||||||
const right = bounds.x + halfW;
|
|
||||||
const top = bounds.y - halfH;
|
|
||||||
const bottom = bounds.y + halfH;
|
|
||||||
|
|
||||||
const onLeft = Math.abs(p.x - left) <= tol && p.y >= top - tol && p.y <= bottom + tol;
|
|
||||||
const onRight = Math.abs(p.x - right) <= tol && p.y >= top - tol && p.y <= bottom + tol;
|
|
||||||
const onTop = Math.abs(p.y - top) <= tol && p.x >= left - tol && p.x <= right + tol;
|
|
||||||
const onBottom = Math.abs(p.y - bottom) <= tol && p.x >= left - tol && p.x <= right + tol;
|
|
||||||
return onLeft || onRight || onTop || onBottom;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compute intersection between a rectangle (center x/y, width/height) and the line
|
|
||||||
* segment from insidePoint -\> outsidePoint. Returns the point on the rectangle border.
|
|
||||||
*
|
|
||||||
* This version avoids snapping to outsidePoint when certain variables evaluate to 0
|
|
||||||
* (previously caused vertical top/bottom cases to miss the border). It only enforces
|
|
||||||
* axis-constant behavior for purely vertical/horizontal approaches.
|
|
||||||
*/
|
|
||||||
export const intersection = (node: RectLike, outsidePoint: P, insidePoint: P): P => {
|
|
||||||
const x = node.x;
|
|
||||||
const y = node.y;
|
|
||||||
|
|
||||||
const dx = Math.abs(x - insidePoint.x);
|
|
||||||
const w = node.width / 2;
|
|
||||||
let r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
|
|
||||||
const h = node.height / 2;
|
|
||||||
|
|
||||||
const Q = Math.abs(outsidePoint.y - insidePoint.y);
|
|
||||||
const R = Math.abs(outsidePoint.x - insidePoint.x);
|
|
||||||
|
|
||||||
if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
|
|
||||||
// Intersection is top or bottom of rect.
|
|
||||||
const q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
|
|
||||||
r = (R * q) / Q;
|
|
||||||
const res = {
|
|
||||||
x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
|
|
||||||
y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Keep axis-constant special-cases only
|
|
||||||
if (R === 0) {
|
|
||||||
res.x = outsidePoint.x;
|
|
||||||
}
|
|
||||||
if (Q === 0) {
|
|
||||||
res.y = outsidePoint.y;
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
} else {
|
|
||||||
// Intersection on sides of rect
|
|
||||||
if (insidePoint.x < outsidePoint.x) {
|
|
||||||
r = outsidePoint.x - w - x;
|
|
||||||
} else {
|
|
||||||
r = x - w - outsidePoint.x;
|
|
||||||
}
|
|
||||||
const q = (Q * r) / R;
|
|
||||||
let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r;
|
|
||||||
let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q : insidePoint.y - q;
|
|
||||||
|
|
||||||
// Only handle axis-constant cases
|
|
||||||
if (R === 0) {
|
|
||||||
_x = outsidePoint.x;
|
|
||||||
}
|
|
||||||
if (Q === 0) {
|
|
||||||
_y = outsidePoint.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return { x: _x, y: _y };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const outsideNode = (node: RectLike, point: P): boolean => {
|
|
||||||
const x = node.x;
|
|
||||||
const y = node.y;
|
|
||||||
const dx = Math.abs(point.x - x);
|
|
||||||
const dy = Math.abs(point.y - y);
|
|
||||||
const w = node.width / 2;
|
|
||||||
const h = node.height / 2;
|
|
||||||
return dx >= w || dy >= h;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ensureTrulyOutside = (bounds: RectLike, p: P, push = PUSH_OUT): P => {
|
|
||||||
const dx = Math.abs(p.x - bounds.x);
|
|
||||||
const dy = Math.abs(p.y - bounds.y);
|
|
||||||
const w = bounds.width / 2;
|
|
||||||
const h = bounds.height / 2;
|
|
||||||
if (Math.abs(dx - w) < EPS || Math.abs(dy - h) < EPS) {
|
|
||||||
const dirX = p.x - bounds.x;
|
|
||||||
const dirY = p.y - bounds.y;
|
|
||||||
const len = Math.sqrt(dirX * dirX + dirY * dirY);
|
|
||||||
if (len > 0) {
|
|
||||||
return {
|
|
||||||
x: bounds.x + (dirX / len) * (len + push),
|
|
||||||
y: bounds.y + (dirY / len) * (len + push),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return p;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const makeInsidePoint = (bounds: RectLike, outside: P, center: P): P => {
|
|
||||||
const isVertical = Math.abs(outside.x - bounds.x) < EPS;
|
|
||||||
const isHorizontal = Math.abs(outside.y - bounds.y) < EPS;
|
|
||||||
return {
|
|
||||||
x: isVertical
|
|
||||||
? outside.x
|
|
||||||
: outside.x < bounds.x
|
|
||||||
? bounds.x - bounds.width / 4
|
|
||||||
: bounds.x + bounds.width / 4,
|
|
||||||
y: isHorizontal ? outside.y : center.y,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const tryNodeIntersect = (node: NodeLike, bounds: RectLike, outside: P): P | null => {
|
|
||||||
if (!node?.intersect) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const res = node.intersect(outside);
|
|
||||||
if (!res) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const wrongSide =
|
|
||||||
(outside.x < bounds.x && res.x > bounds.x) || (outside.x > bounds.x && res.x < bounds.x);
|
|
||||||
if (wrongSide) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const dist = Math.hypot(outside.x - res.x, outside.y - res.y);
|
|
||||||
if (dist <= EPS) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const fallbackIntersection = (bounds: RectLike, outside: P, center: P): P => {
|
|
||||||
const inside = makeInsidePoint(bounds, outside, center);
|
|
||||||
return intersection(bounds, outside, inside);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const computeNodeIntersection = (
|
|
||||||
node: NodeLike,
|
|
||||||
bounds: RectLike,
|
|
||||||
outside: P,
|
|
||||||
center: P
|
|
||||||
): P => {
|
|
||||||
const outside2 = ensureTrulyOutside(bounds, outside);
|
|
||||||
return tryNodeIntersect(node, bounds, outside2) ?? fallbackIntersection(bounds, outside2, center);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const replaceEndpoint = (
|
|
||||||
points: P[],
|
|
||||||
which: 'start' | 'end',
|
|
||||||
value: P | null | undefined,
|
|
||||||
tol = 0.1
|
|
||||||
) => {
|
|
||||||
if (!value || points.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (which === 'start') {
|
|
||||||
if (
|
|
||||||
points.length > 0 &&
|
|
||||||
Math.abs(points[0].x - value.x) < tol &&
|
|
||||||
Math.abs(points[0].y - value.y) < tol
|
|
||||||
) {
|
|
||||||
// duplicate start remove it
|
|
||||||
points.shift();
|
|
||||||
} else {
|
|
||||||
points[0] = value;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const last = points.length - 1;
|
|
||||||
if (
|
|
||||||
points.length > 0 &&
|
|
||||||
Math.abs(points[last].x - value.x) < tol &&
|
|
||||||
Math.abs(points[last].y - value.y) < tol
|
|
||||||
) {
|
|
||||||
// duplicate end remove it
|
|
||||||
points.pop();
|
|
||||||
} else {
|
|
||||||
points[last] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,6 @@
|
|||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"types": ["vitest/importMeta", "vitest/globals"]
|
"types": ["vitest/importMeta", "vitest/globals"]
|
||||||
},
|
},
|
||||||
"include": ["./src/**/*.ts", "./src/**/*.d.ts"],
|
"include": ["./src/**/*.ts"],
|
||||||
"typeRoots": ["./src/types"]
|
"typeRoots": ["./src/types"]
|
||||||
}
|
}
|
||||||
|
@@ -1,59 +0,0 @@
|
|||||||
# @mermaid-js/layout-tidy-tree
|
|
||||||
|
|
||||||
This package provides a bidirectional tidy tree layout engine for Mermaid based on the non-layered-tidy-tree-layout algorithm.
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> The Tidy Tree Layout engine will not be available in all providers that support mermaid by default.
|
|
||||||
> The websites will have to install the @mermaid-js/layout-tidy-tree package to use the Tidy Tree layout engine.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```
|
|
||||||
---
|
|
||||||
config:
|
|
||||||
layout: tidy-tree
|
|
||||||
---
|
|
||||||
mindmap
|
|
||||||
root((mindmap))
|
|
||||||
A
|
|
||||||
B
|
|
||||||
```
|
|
||||||
|
|
||||||
### With bundlers
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install @mermaid-js/layout-tidy-tree
|
|
||||||
```
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import mermaid from 'mermaid';
|
|
||||||
import tidyTreeLayouts from '@mermaid-js/layout-tidy-tree';
|
|
||||||
|
|
||||||
mermaid.registerLayoutLoaders(tidyTreeLayouts);
|
|
||||||
```
|
|
||||||
|
|
||||||
### With CDN
|
|
||||||
|
|
||||||
```html
|
|
||||||
<script type="module">
|
|
||||||
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
|
|
||||||
import tidyTreeLayouts from 'https://cdn.jsdelivr.net/npm/@mermaid-js/layout-tidy-tree@0/dist/mermaid-layout-tidy-tree.esm.min.mjs';
|
|
||||||
|
|
||||||
mermaid.registerLayoutLoaders(tidyTreeLayouts);
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Tidy Tree Layout Overview
|
|
||||||
|
|
||||||
tidy-tree: The bidirectional tidy tree layout
|
|
||||||
|
|
||||||
The bidirectional tidy tree layout algorithm creates two separate trees that grow horizontally in opposite directions from a central root node:
|
|
||||||
Left tree: grows horizontally to the left (children alternate: 1st, 3rd, 5th...)
|
|
||||||
Right tree: grows horizontally to the right (children alternate: 2nd, 4th, 6th...)
|
|
||||||
|
|
||||||
This creates a balanced, symmetric layout that is ideal for mindmaps, organizational charts, and other tree-based diagrams.
|
|
||||||
|
|
||||||
Layout Structure:
|
|
||||||
[Child 3] ← [Child 1] ← [Root] → [Child 2] → [Child 4]
|
|
||||||
↓ ↓ ↓ ↓
|
|
||||||
[GrandChild] [GrandChild] [GrandChild] [GrandChild]
|
|
@@ -1,46 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@mermaid-js/layout-tidy-tree",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Tidy-tree layout engine for mermaid",
|
|
||||||
"module": "dist/mermaid-layout-tidy-tree.core.mjs",
|
|
||||||
"types": "dist/layouts.d.ts",
|
|
||||||
"type": "module",
|
|
||||||
"exports": {
|
|
||||||
".": {
|
|
||||||
"import": "./dist/mermaid-layout-tidy-tree.core.mjs",
|
|
||||||
"types": "./dist/layouts.d.ts"
|
|
||||||
},
|
|
||||||
"./": "./"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"diagram",
|
|
||||||
"markdown",
|
|
||||||
"tidy-tree",
|
|
||||||
"mermaid",
|
|
||||||
"layout"
|
|
||||||
],
|
|
||||||
"scripts": {},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/mermaid-js/mermaid"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
"Knut Sveidqvist",
|
|
||||||
"Sidharth Vinod"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"d3": "^7.9.0",
|
|
||||||
"non-layered-tidy-tree-layout": "^2.0.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/d3": "^7.4.3",
|
|
||||||
"mermaid": "workspace:^"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"mermaid": "^11.0.2"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
|
@@ -1,50 +0,0 @@
|
|||||||
/**
|
|
||||||
* Bidirectional Tidy-Tree Layout Algorithm for Generic Diagrams
|
|
||||||
*
|
|
||||||
* This module provides a layout algorithm implementation using the
|
|
||||||
* non-layered-tidy-tree-layout algorithm for positioning nodes and edges
|
|
||||||
* in tree structures with a bidirectional approach.
|
|
||||||
*
|
|
||||||
* The algorithm creates two separate trees that grow horizontally in opposite
|
|
||||||
* directions from a central root node:
|
|
||||||
* - Left tree: grows horizontally to the left (children alternate: 1st, 3rd, 5th...)
|
|
||||||
* - Right tree: grows horizontally to the right (children alternate: 2nd, 4th, 6th...)
|
|
||||||
*
|
|
||||||
* This creates a balanced, symmetric layout that is ideal for mindmaps,
|
|
||||||
* organizational charts, and other tree-based diagrams.
|
|
||||||
*
|
|
||||||
* The algorithm follows the unified rendering pattern and can be used
|
|
||||||
* by any diagram type that provides compatible LayoutData.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render function for the bidirectional tidy-tree layout algorithm
|
|
||||||
*
|
|
||||||
* This function follows the unified rendering pattern used by all layout algorithms.
|
|
||||||
* It takes LayoutData, inserts nodes into DOM, runs the bidirectional tidy-tree layout algorithm,
|
|
||||||
* and renders the positioned elements to the SVG.
|
|
||||||
*
|
|
||||||
* Features:
|
|
||||||
* - Alternates root children between left and right trees
|
|
||||||
* - Left tree grows horizontally to the left (rotated 90° counterclockwise)
|
|
||||||
* - Right tree grows horizontally to the right (rotated 90° clockwise)
|
|
||||||
* - Uses tidy-tree algorithm for optimal spacing within each tree
|
|
||||||
* - Creates symmetric, balanced layouts
|
|
||||||
* - Maintains proper edge connections between all nodes
|
|
||||||
*
|
|
||||||
* Layout Structure:
|
|
||||||
* ```
|
|
||||||
* [Child 3] ← [Child 1] ← [Root] → [Child 2] → [Child 4]
|
|
||||||
* ↓ ↓ ↓ ↓
|
|
||||||
* [GrandChild] [GrandChild] [GrandChild] [GrandChild]
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param layoutData - Layout data containing nodes, edges, and configuration
|
|
||||||
* @param svg - SVG element to render to
|
|
||||||
* @param helpers - Internal helper functions for rendering
|
|
||||||
* @param options - Rendering options
|
|
||||||
*/
|
|
||||||
export { default } from './layouts.js';
|
|
||||||
export * from './types.js';
|
|
||||||
export * from './layout.js';
|
|
||||||
export { render } from './render.js';
|
|
@@ -1,409 +0,0 @@
|
|||||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
||||||
import { executeTidyTreeLayout, validateLayoutData } from './layout.js';
|
|
||||||
import type { LayoutResult } from './types.js';
|
|
||||||
import type { LayoutData, MermaidConfig } from 'mermaid';
|
|
||||||
|
|
||||||
// Mock non-layered-tidy-tree-layout
|
|
||||||
vi.mock('non-layered-tidy-tree-layout', () => ({
|
|
||||||
BoundingBox: vi.fn().mockImplementation(() => ({})),
|
|
||||||
Layout: vi.fn().mockImplementation(() => ({
|
|
||||||
layout: vi.fn().mockImplementation((treeData) => {
|
|
||||||
const result = { ...treeData };
|
|
||||||
|
|
||||||
if (result.id?.toString().startsWith('virtual-root')) {
|
|
||||||
result.x = 0;
|
|
||||||
result.y = 0;
|
|
||||||
} else {
|
|
||||||
result.x = 100;
|
|
||||||
result.y = 50;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.children) {
|
|
||||||
result.children.forEach((child: any, index: number) => {
|
|
||||||
child.x = 50 + index * 100;
|
|
||||||
child.y = 100;
|
|
||||||
|
|
||||||
if (child.children) {
|
|
||||||
child.children.forEach((grandchild: any, gIndex: number) => {
|
|
||||||
grandchild.x = 25 + gIndex * 50;
|
|
||||||
grandchild.y = 200;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
result,
|
|
||||||
boundingBox: {
|
|
||||||
left: 0,
|
|
||||||
right: 200,
|
|
||||||
top: 0,
|
|
||||||
bottom: 250,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
})),
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('Tidy-Tree Layout Algorithm', () => {
|
|
||||||
let mockConfig: MermaidConfig;
|
|
||||||
let mockLayoutData: LayoutData;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
mockConfig = {
|
|
||||||
theme: 'default',
|
|
||||||
} as MermaidConfig;
|
|
||||||
|
|
||||||
mockLayoutData = {
|
|
||||||
nodes: [
|
|
||||||
{
|
|
||||||
id: 'root',
|
|
||||||
label: 'Root',
|
|
||||||
isGroup: false,
|
|
||||||
shape: 'rect',
|
|
||||||
width: 100,
|
|
||||||
height: 50,
|
|
||||||
padding: 10,
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
cssClasses: '',
|
|
||||||
cssStyles: [],
|
|
||||||
look: 'default',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'child1',
|
|
||||||
label: 'Child 1',
|
|
||||||
isGroup: false,
|
|
||||||
shape: 'rect',
|
|
||||||
width: 80,
|
|
||||||
height: 40,
|
|
||||||
padding: 10,
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
cssClasses: '',
|
|
||||||
cssStyles: [],
|
|
||||||
look: 'default',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'child2',
|
|
||||||
label: 'Child 2',
|
|
||||||
isGroup: false,
|
|
||||||
shape: 'rect',
|
|
||||||
width: 80,
|
|
||||||
height: 40,
|
|
||||||
padding: 10,
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
cssClasses: '',
|
|
||||||
cssStyles: [],
|
|
||||||
look: 'default',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'child3',
|
|
||||||
label: 'Child 3',
|
|
||||||
isGroup: false,
|
|
||||||
shape: 'rect',
|
|
||||||
width: 80,
|
|
||||||
height: 40,
|
|
||||||
padding: 10,
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
cssClasses: '',
|
|
||||||
cssStyles: [],
|
|
||||||
look: 'default',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'child4',
|
|
||||||
label: 'Child 4',
|
|
||||||
isGroup: false,
|
|
||||||
shape: 'rect',
|
|
||||||
width: 80,
|
|
||||||
height: 40,
|
|
||||||
padding: 10,
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
cssClasses: '',
|
|
||||||
cssStyles: [],
|
|
||||||
look: 'default',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
edges: [
|
|
||||||
{
|
|
||||||
id: 'root_child1',
|
|
||||||
start: 'root',
|
|
||||||
end: 'child1',
|
|
||||||
type: 'edge',
|
|
||||||
classes: '',
|
|
||||||
style: [],
|
|
||||||
animate: false,
|
|
||||||
arrowTypeEnd: 'arrow_point',
|
|
||||||
arrowTypeStart: 'none',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'root_child2',
|
|
||||||
start: 'root',
|
|
||||||
end: 'child2',
|
|
||||||
type: 'edge',
|
|
||||||
classes: '',
|
|
||||||
style: [],
|
|
||||||
animate: false,
|
|
||||||
arrowTypeEnd: 'arrow_point',
|
|
||||||
arrowTypeStart: 'none',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'root_child3',
|
|
||||||
start: 'root',
|
|
||||||
end: 'child3',
|
|
||||||
type: 'edge',
|
|
||||||
classes: '',
|
|
||||||
style: [],
|
|
||||||
animate: false,
|
|
||||||
arrowTypeEnd: 'arrow_point',
|
|
||||||
arrowTypeStart: 'none',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'root_child4',
|
|
||||||
start: 'root',
|
|
||||||
end: 'child4',
|
|
||||||
type: 'edge',
|
|
||||||
classes: '',
|
|
||||||
style: [],
|
|
||||||
animate: false,
|
|
||||||
arrowTypeEnd: 'arrow_point',
|
|
||||||
arrowTypeStart: 'none',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
config: mockConfig,
|
|
||||||
direction: 'TB',
|
|
||||||
type: 'test',
|
|
||||||
diagramId: 'test-diagram',
|
|
||||||
markers: [],
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('validateLayoutData', () => {
|
|
||||||
it('should validate correct layout data', () => {
|
|
||||||
expect(() => validateLayoutData(mockLayoutData)).not.toThrow();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw error for missing data', () => {
|
|
||||||
expect(() => validateLayoutData(null as any)).toThrow('Layout data is required');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw error for missing config', () => {
|
|
||||||
const invalidData = { ...mockLayoutData, config: null as any };
|
|
||||||
expect(() => validateLayoutData(invalidData)).toThrow('Configuration is required');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw error for invalid nodes array', () => {
|
|
||||||
const invalidData = { ...mockLayoutData, nodes: null as any };
|
|
||||||
expect(() => validateLayoutData(invalidData)).toThrow('Nodes array is required');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw error for invalid edges array', () => {
|
|
||||||
const invalidData = { ...mockLayoutData, edges: null as any };
|
|
||||||
expect(() => validateLayoutData(invalidData)).toThrow('Edges array is required');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('executeTidyTreeLayout function', () => {
|
|
||||||
it('should execute layout algorithm successfully', async () => {
|
|
||||||
const result: LayoutResult = await executeTidyTreeLayout(mockLayoutData);
|
|
||||||
|
|
||||||
expect(result).toBeDefined();
|
|
||||||
expect(result.nodes).toBeDefined();
|
|
||||||
expect(result.edges).toBeDefined();
|
|
||||||
expect(Array.isArray(result.nodes)).toBe(true);
|
|
||||||
expect(Array.isArray(result.edges)).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return positioned nodes with coordinates', async () => {
|
|
||||||
const result: LayoutResult = await executeTidyTreeLayout(mockLayoutData);
|
|
||||||
|
|
||||||
expect(result.nodes.length).toBeGreaterThan(0);
|
|
||||||
result.nodes.forEach((node) => {
|
|
||||||
expect(node.x).toBeDefined();
|
|
||||||
expect(node.y).toBeDefined();
|
|
||||||
expect(typeof node.x).toBe('number');
|
|
||||||
expect(typeof node.y).toBe('number');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return positioned edges with coordinates', async () => {
|
|
||||||
const result: LayoutResult = await executeTidyTreeLayout(mockLayoutData);
|
|
||||||
|
|
||||||
expect(result.edges.length).toBeGreaterThan(0);
|
|
||||||
result.edges.forEach((edge) => {
|
|
||||||
expect(edge.startX).toBeDefined();
|
|
||||||
expect(edge.startY).toBeDefined();
|
|
||||||
expect(edge.midX).toBeDefined();
|
|
||||||
expect(edge.midY).toBeDefined();
|
|
||||||
expect(edge.endX).toBeDefined();
|
|
||||||
expect(edge.endY).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle empty layout data gracefully', async () => {
|
|
||||||
const emptyData: LayoutData = {
|
|
||||||
...mockLayoutData,
|
|
||||||
nodes: [],
|
|
||||||
edges: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
await expect(executeTidyTreeLayout(emptyData)).rejects.toThrow(
|
|
||||||
'No nodes found in layout data'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw error for missing nodes', async () => {
|
|
||||||
const invalidData = { ...mockLayoutData, nodes: [] };
|
|
||||||
|
|
||||||
await expect(executeTidyTreeLayout(invalidData)).rejects.toThrow(
|
|
||||||
'No nodes found in layout data'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle empty edges (single node tree)', async () => {
|
|
||||||
const singleNodeData = {
|
|
||||||
...mockLayoutData,
|
|
||||||
edges: [],
|
|
||||||
nodes: [mockLayoutData.nodes[0]],
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = await executeTidyTreeLayout(singleNodeData);
|
|
||||||
expect(result).toBeDefined();
|
|
||||||
expect(result.nodes).toHaveLength(1);
|
|
||||||
expect(result.edges).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create bidirectional dual-tree layout with alternating left/right children', async () => {
|
|
||||||
const result = await executeTidyTreeLayout(mockLayoutData);
|
|
||||||
|
|
||||||
expect(result).toBeDefined();
|
|
||||||
expect(result.nodes).toHaveLength(5);
|
|
||||||
|
|
||||||
const rootNode = result.nodes.find((node) => node.id === 'root');
|
|
||||||
expect(rootNode).toBeDefined();
|
|
||||||
expect(rootNode!.x).toBe(0);
|
|
||||||
expect(rootNode!.y).toBe(20);
|
|
||||||
|
|
||||||
const child1 = result.nodes.find((node) => node.id === 'child1');
|
|
||||||
const child2 = result.nodes.find((node) => node.id === 'child2');
|
|
||||||
const child3 = result.nodes.find((node) => node.id === 'child3');
|
|
||||||
const child4 = result.nodes.find((node) => node.id === 'child4');
|
|
||||||
|
|
||||||
expect(child1).toBeDefined();
|
|
||||||
expect(child2).toBeDefined();
|
|
||||||
expect(child3).toBeDefined();
|
|
||||||
expect(child4).toBeDefined();
|
|
||||||
|
|
||||||
expect(child1!.x).toBeLessThan(rootNode!.x);
|
|
||||||
expect(child2!.x).toBeGreaterThan(rootNode!.x);
|
|
||||||
expect(child3!.x).toBeLessThan(rootNode!.x);
|
|
||||||
expect(child4!.x).toBeGreaterThan(rootNode!.x);
|
|
||||||
|
|
||||||
expect(child1!.x).toBeLessThan(-100);
|
|
||||||
expect(child3!.x).toBeLessThan(-100);
|
|
||||||
|
|
||||||
expect(child2!.x).toBeGreaterThan(100);
|
|
||||||
expect(child4!.x).toBeGreaterThan(100);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should correctly transpose coordinates to prevent high nodes from covering nodes above them', async () => {
|
|
||||||
const testData = {
|
|
||||||
...mockLayoutData,
|
|
||||||
nodes: [
|
|
||||||
{
|
|
||||||
id: 'root',
|
|
||||||
label: 'Root',
|
|
||||||
isGroup: false,
|
|
||||||
shape: 'rect' as const,
|
|
||||||
width: 100,
|
|
||||||
height: 50,
|
|
||||||
padding: 10,
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
cssClasses: '',
|
|
||||||
cssStyles: [],
|
|
||||||
look: 'default',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'tall-child',
|
|
||||||
label: 'Tall Child',
|
|
||||||
isGroup: false,
|
|
||||||
shape: 'rect' as const,
|
|
||||||
width: 80,
|
|
||||||
height: 120,
|
|
||||||
padding: 10,
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
cssClasses: '',
|
|
||||||
cssStyles: [],
|
|
||||||
look: 'default',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'short-child',
|
|
||||||
label: 'Short Child',
|
|
||||||
isGroup: false,
|
|
||||||
shape: 'rect' as const,
|
|
||||||
width: 80,
|
|
||||||
height: 30,
|
|
||||||
padding: 10,
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
cssClasses: '',
|
|
||||||
cssStyles: [],
|
|
||||||
look: 'default',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
edges: [
|
|
||||||
{
|
|
||||||
id: 'root_tall',
|
|
||||||
start: 'root',
|
|
||||||
end: 'tall-child',
|
|
||||||
type: 'edge',
|
|
||||||
classes: '',
|
|
||||||
style: [],
|
|
||||||
animate: false,
|
|
||||||
arrowTypeEnd: 'arrow_point',
|
|
||||||
arrowTypeStart: 'none',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'root_short',
|
|
||||||
start: 'root',
|
|
||||||
end: 'short-child',
|
|
||||||
type: 'edge',
|
|
||||||
classes: '',
|
|
||||||
style: [],
|
|
||||||
animate: false,
|
|
||||||
arrowTypeEnd: 'arrow_point',
|
|
||||||
arrowTypeStart: 'none',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
const result = await executeTidyTreeLayout(testData);
|
|
||||||
|
|
||||||
expect(result).toBeDefined();
|
|
||||||
expect(result.nodes).toHaveLength(3);
|
|
||||||
|
|
||||||
const rootNode = result.nodes.find((node) => node.id === 'root');
|
|
||||||
const tallChild = result.nodes.find((node) => node.id === 'tall-child');
|
|
||||||
const shortChild = result.nodes.find((node) => node.id === 'short-child');
|
|
||||||
|
|
||||||
expect(rootNode).toBeDefined();
|
|
||||||
expect(tallChild).toBeDefined();
|
|
||||||
expect(shortChild).toBeDefined();
|
|
||||||
|
|
||||||
expect(tallChild!.x).not.toBe(shortChild!.x);
|
|
||||||
|
|
||||||
expect(tallChild!.width).toBe(80);
|
|
||||||
expect(tallChild!.height).toBe(120);
|
|
||||||
expect(shortChild!.width).toBe(80);
|
|
||||||
expect(shortChild!.height).toBe(30);
|
|
||||||
|
|
||||||
const yDifference = Math.abs(tallChild!.y - shortChild!.y);
|
|
||||||
expect(yDifference).toBeGreaterThanOrEqual(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,629 +0,0 @@
|
|||||||
import type { LayoutData } from 'mermaid';
|
|
||||||
import type { Bounds, Point } from 'mermaid/src/types.js';
|
|
||||||
import { BoundingBox, Layout } from 'non-layered-tidy-tree-layout';
|
|
||||||
import type {
|
|
||||||
Edge,
|
|
||||||
LayoutResult,
|
|
||||||
Node,
|
|
||||||
PositionedEdge,
|
|
||||||
PositionedNode,
|
|
||||||
TidyTreeNode,
|
|
||||||
} from './types.js';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the tidy-tree layout algorithm on generic layout data
|
|
||||||
*
|
|
||||||
* This function takes layout data and uses the non-layered-tidy-tree-layout
|
|
||||||
* algorithm to calculate optimal node positions for tree structures.
|
|
||||||
*
|
|
||||||
* @param data - The layout data containing nodes, edges, and configuration
|
|
||||||
* @param config - Mermaid configuration object
|
|
||||||
* @returns Promise resolving to layout result with positioned nodes and edges
|
|
||||||
*/
|
|
||||||
export function executeTidyTreeLayout(data: LayoutData): Promise<LayoutResult> {
|
|
||||||
let intersectionShift = 50;
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
if (!data.nodes || !Array.isArray(data.nodes) || data.nodes.length === 0) {
|
|
||||||
throw new Error('No nodes found in layout data');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!data.edges || !Array.isArray(data.edges)) {
|
|
||||||
data.edges = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const { leftTree, rightTree, rootNode } = convertToDualTreeFormat(data);
|
|
||||||
|
|
||||||
const gap = 20;
|
|
||||||
const bottomPadding = 40;
|
|
||||||
intersectionShift = 30;
|
|
||||||
|
|
||||||
const bb = new BoundingBox(gap, bottomPadding);
|
|
||||||
const layout = new Layout(bb);
|
|
||||||
|
|
||||||
let leftResult = null;
|
|
||||||
let rightResult = null;
|
|
||||||
|
|
||||||
if (leftTree) {
|
|
||||||
const leftLayoutResult = layout.layout(leftTree);
|
|
||||||
leftResult = leftLayoutResult.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rightTree) {
|
|
||||||
const rightLayoutResult = layout.layout(rightTree);
|
|
||||||
rightResult = rightLayoutResult.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
const positionedNodes = combineAndPositionTrees(rootNode, leftResult, rightResult);
|
|
||||||
const positionedEdges = calculateEdgePositions(
|
|
||||||
data.edges,
|
|
||||||
positionedNodes,
|
|
||||||
intersectionShift
|
|
||||||
);
|
|
||||||
resolve({
|
|
||||||
nodes: positionedNodes,
|
|
||||||
edges: positionedEdges,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert LayoutData to dual-tree format (left and right trees)
|
|
||||||
*
|
|
||||||
* This function builds two separate tree structures from the nodes and edges,
|
|
||||||
* alternating children between left and right trees.
|
|
||||||
*/
|
|
||||||
function convertToDualTreeFormat(data: LayoutData): {
|
|
||||||
leftTree: TidyTreeNode | null;
|
|
||||||
rightTree: TidyTreeNode | null;
|
|
||||||
rootNode: TidyTreeNode;
|
|
||||||
} {
|
|
||||||
const { nodes, edges } = data;
|
|
||||||
|
|
||||||
const nodeMap = new Map<string, Node>();
|
|
||||||
nodes.forEach((node) => nodeMap.set(node.id, node));
|
|
||||||
|
|
||||||
const children = new Map<string, string[]>();
|
|
||||||
const parents = new Map<string, string>();
|
|
||||||
|
|
||||||
edges.forEach((edge) => {
|
|
||||||
const parentId = edge.start;
|
|
||||||
const childId = edge.end;
|
|
||||||
|
|
||||||
if (parentId && childId) {
|
|
||||||
if (!children.has(parentId)) {
|
|
||||||
children.set(parentId, []);
|
|
||||||
}
|
|
||||||
children.get(parentId)!.push(childId);
|
|
||||||
parents.set(childId, parentId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const rootNodeData = nodes.find((node) => !parents.has(node.id));
|
|
||||||
if (!rootNodeData && nodes.length === 0) {
|
|
||||||
throw new Error('No nodes available to create tree');
|
|
||||||
}
|
|
||||||
|
|
||||||
const actualRoot = rootNodeData ?? nodes[0];
|
|
||||||
|
|
||||||
const rootNode: TidyTreeNode = {
|
|
||||||
id: actualRoot.id,
|
|
||||||
width: actualRoot.width ?? 100,
|
|
||||||
height: actualRoot.height ?? 50,
|
|
||||||
_originalNode: actualRoot,
|
|
||||||
};
|
|
||||||
|
|
||||||
const rootChildren = children.get(actualRoot.id) ?? [];
|
|
||||||
const leftChildren: string[] = [];
|
|
||||||
const rightChildren: string[] = [];
|
|
||||||
|
|
||||||
rootChildren.forEach((childId, index) => {
|
|
||||||
if (index % 2 === 0) {
|
|
||||||
leftChildren.push(childId);
|
|
||||||
} else {
|
|
||||||
rightChildren.push(childId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const leftTree = leftChildren.length > 0 ? buildSubTree(leftChildren, children, nodeMap) : null;
|
|
||||||
|
|
||||||
const rightTree =
|
|
||||||
rightChildren.length > 0 ? buildSubTree(rightChildren, children, nodeMap) : null;
|
|
||||||
|
|
||||||
return { leftTree, rightTree, rootNode };
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build a subtree from a list of root children
|
|
||||||
* For horizontal trees, we need to transpose width/height since the tree will be rotated 90°
|
|
||||||
*/
|
|
||||||
function buildSubTree(
|
|
||||||
rootChildren: string[],
|
|
||||||
children: Map<string, string[]>,
|
|
||||||
nodeMap: Map<string, Node>
|
|
||||||
): TidyTreeNode {
|
|
||||||
const virtualRoot: TidyTreeNode = {
|
|
||||||
id: `virtual-root-${Math.random()}`,
|
|
||||||
width: 1,
|
|
||||||
height: 1,
|
|
||||||
children: rootChildren
|
|
||||||
.map((childId) => nodeMap.get(childId))
|
|
||||||
.filter((child): child is Node => child !== undefined)
|
|
||||||
.map((child) => convertNodeToTidyTreeTransposed(child, children, nodeMap)),
|
|
||||||
};
|
|
||||||
|
|
||||||
return virtualRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursively convert a node and its children to tidy-tree format
|
|
||||||
* This version transposes width/height for horizontal tree layout
|
|
||||||
*/
|
|
||||||
function convertNodeToTidyTreeTransposed(
|
|
||||||
node: Node,
|
|
||||||
children: Map<string, string[]>,
|
|
||||||
nodeMap: Map<string, Node>
|
|
||||||
): TidyTreeNode {
|
|
||||||
const childIds = children.get(node.id) ?? [];
|
|
||||||
const childNodes = childIds
|
|
||||||
.map((childId) => nodeMap.get(childId))
|
|
||||||
.filter((child): child is Node => child !== undefined)
|
|
||||||
.map((child) => convertNodeToTidyTreeTransposed(child, children, nodeMap));
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: node.id,
|
|
||||||
width: node.height ?? 50,
|
|
||||||
height: node.width ?? 100,
|
|
||||||
children: childNodes.length > 0 ? childNodes : undefined,
|
|
||||||
_originalNode: node,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Combine and position the left and right trees around the root node
|
|
||||||
* Creates a bidirectional layout where left tree grows left and right tree grows right
|
|
||||||
*/
|
|
||||||
function combineAndPositionTrees(
|
|
||||||
rootNode: TidyTreeNode,
|
|
||||||
leftResult: TidyTreeNode | null,
|
|
||||||
rightResult: TidyTreeNode | null
|
|
||||||
): PositionedNode[] {
|
|
||||||
const positionedNodes: PositionedNode[] = [];
|
|
||||||
|
|
||||||
const rootX = 0;
|
|
||||||
const rootY = 0;
|
|
||||||
|
|
||||||
const treeSpacing = rootNode.width / 2 + 30;
|
|
||||||
const leftTreeNodes: PositionedNode[] = [];
|
|
||||||
const rightTreeNodes: PositionedNode[] = [];
|
|
||||||
|
|
||||||
if (leftResult?.children) {
|
|
||||||
positionLeftTreeBidirectional(leftResult.children, leftTreeNodes, rootX - treeSpacing, rootY);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rightResult?.children) {
|
|
||||||
positionRightTreeBidirectional(
|
|
||||||
rightResult.children,
|
|
||||||
rightTreeNodes,
|
|
||||||
rootX + treeSpacing,
|
|
||||||
rootY
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let leftTreeCenterY = 0;
|
|
||||||
let rightTreeCenterY = 0;
|
|
||||||
|
|
||||||
if (leftTreeNodes.length > 0) {
|
|
||||||
const leftTreeXPositions = [...new Set(leftTreeNodes.map((node) => node.x))].sort(
|
|
||||||
(a, b) => b - a
|
|
||||||
);
|
|
||||||
const firstLevelLeftX = leftTreeXPositions[0];
|
|
||||||
const firstLevelLeftNodes = leftTreeNodes.filter((node) => node.x === firstLevelLeftX);
|
|
||||||
|
|
||||||
if (firstLevelLeftNodes.length > 0) {
|
|
||||||
const leftMinY = Math.min(
|
|
||||||
...firstLevelLeftNodes.map((node) => node.y - (node.height ?? 50) / 2)
|
|
||||||
);
|
|
||||||
const leftMaxY = Math.max(
|
|
||||||
...firstLevelLeftNodes.map((node) => node.y + (node.height ?? 50) / 2)
|
|
||||||
);
|
|
||||||
leftTreeCenterY = (leftMinY + leftMaxY) / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rightTreeNodes.length > 0) {
|
|
||||||
const rightTreeXPositions = [...new Set(rightTreeNodes.map((node) => node.x))].sort(
|
|
||||||
(a, b) => a - b
|
|
||||||
);
|
|
||||||
const firstLevelRightX = rightTreeXPositions[0];
|
|
||||||
const firstLevelRightNodes = rightTreeNodes.filter((node) => node.x === firstLevelRightX);
|
|
||||||
|
|
||||||
if (firstLevelRightNodes.length > 0) {
|
|
||||||
const rightMinY = Math.min(
|
|
||||||
...firstLevelRightNodes.map((node) => node.y - (node.height ?? 50) / 2)
|
|
||||||
);
|
|
||||||
const rightMaxY = Math.max(
|
|
||||||
...firstLevelRightNodes.map((node) => node.y + (node.height ?? 50) / 2)
|
|
||||||
);
|
|
||||||
rightTreeCenterY = (rightMinY + rightMaxY) / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const leftTreeOffset = -leftTreeCenterY;
|
|
||||||
const rightTreeOffset = -rightTreeCenterY;
|
|
||||||
|
|
||||||
positionedNodes.push({
|
|
||||||
id: String(rootNode.id),
|
|
||||||
x: rootX,
|
|
||||||
y: rootY + 20,
|
|
||||||
section: 'root',
|
|
||||||
width: rootNode._originalNode?.width ?? rootNode.width,
|
|
||||||
height: rootNode._originalNode?.height ?? rootNode.height,
|
|
||||||
originalNode: rootNode._originalNode,
|
|
||||||
});
|
|
||||||
|
|
||||||
const leftTreeNodesWithOffset = leftTreeNodes.map((node) => ({
|
|
||||||
id: node.id,
|
|
||||||
x: node.x - (node.width ?? 0) / 2,
|
|
||||||
y: node.y + leftTreeOffset + (node.height ?? 0) / 2,
|
|
||||||
section: 'left' as const,
|
|
||||||
width: node.width,
|
|
||||||
height: node.height,
|
|
||||||
originalNode: node.originalNode,
|
|
||||||
}));
|
|
||||||
|
|
||||||
const rightTreeNodesWithOffset = rightTreeNodes.map((node) => ({
|
|
||||||
id: node.id,
|
|
||||||
x: node.x + (node.width ?? 0) / 2,
|
|
||||||
y: node.y + rightTreeOffset + (node.height ?? 0) / 2,
|
|
||||||
section: 'right' as const,
|
|
||||||
width: node.width,
|
|
||||||
height: node.height,
|
|
||||||
originalNode: node.originalNode,
|
|
||||||
}));
|
|
||||||
|
|
||||||
positionedNodes.push(...leftTreeNodesWithOffset);
|
|
||||||
positionedNodes.push(...rightTreeNodesWithOffset);
|
|
||||||
|
|
||||||
return positionedNodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Position nodes from the left tree in a bidirectional layout (grows to the left)
|
|
||||||
* Rotates the tree 90 degrees counterclockwise so it grows horizontally to the left
|
|
||||||
*/
|
|
||||||
function positionLeftTreeBidirectional(
|
|
||||||
nodes: TidyTreeNode[],
|
|
||||||
positionedNodes: PositionedNode[],
|
|
||||||
offsetX: number,
|
|
||||||
offsetY: number
|
|
||||||
): void {
|
|
||||||
nodes.forEach((node) => {
|
|
||||||
const distanceFromRoot = node.y ?? 0;
|
|
||||||
const verticalPosition = node.x ?? 0;
|
|
||||||
|
|
||||||
const originalWidth = node._originalNode?.width ?? 100;
|
|
||||||
const originalHeight = node._originalNode?.height ?? 50;
|
|
||||||
|
|
||||||
const adjustedY = offsetY + verticalPosition;
|
|
||||||
|
|
||||||
positionedNodes.push({
|
|
||||||
id: String(node.id),
|
|
||||||
x: offsetX - distanceFromRoot,
|
|
||||||
y: adjustedY,
|
|
||||||
width: originalWidth,
|
|
||||||
height: originalHeight,
|
|
||||||
originalNode: node._originalNode,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (node.children) {
|
|
||||||
positionLeftTreeBidirectional(node.children, positionedNodes, offsetX, offsetY);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Position nodes from the right tree in a bidirectional layout (grows to the right)
|
|
||||||
* Rotates the tree 90 degrees clockwise so it grows horizontally to the right
|
|
||||||
*/
|
|
||||||
function positionRightTreeBidirectional(
|
|
||||||
nodes: TidyTreeNode[],
|
|
||||||
positionedNodes: PositionedNode[],
|
|
||||||
offsetX: number,
|
|
||||||
offsetY: number
|
|
||||||
): void {
|
|
||||||
nodes.forEach((node) => {
|
|
||||||
const distanceFromRoot = node.y ?? 0;
|
|
||||||
const verticalPosition = node.x ?? 0;
|
|
||||||
|
|
||||||
const originalWidth = node._originalNode?.width ?? 100;
|
|
||||||
const originalHeight = node._originalNode?.height ?? 50;
|
|
||||||
|
|
||||||
const adjustedY = offsetY + verticalPosition;
|
|
||||||
|
|
||||||
positionedNodes.push({
|
|
||||||
id: String(node.id),
|
|
||||||
x: offsetX + distanceFromRoot,
|
|
||||||
y: adjustedY,
|
|
||||||
width: originalWidth,
|
|
||||||
height: originalHeight,
|
|
||||||
originalNode: node._originalNode,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (node.children) {
|
|
||||||
positionRightTreeBidirectional(node.children, positionedNodes, offsetX, offsetY);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate the intersection point of a line with a circle
|
|
||||||
* @param circle - Circle coordinates and radius
|
|
||||||
* @param lineStart - Starting point of the line
|
|
||||||
* @param lineEnd - Ending point of the line
|
|
||||||
* @returns The intersection point
|
|
||||||
*/
|
|
||||||
function computeCircleEdgeIntersection(circle: Bounds, lineStart: Point, lineEnd: Point): Point {
|
|
||||||
const radius = Math.min(circle.width, circle.height) / 2;
|
|
||||||
|
|
||||||
const dx = lineEnd.x - lineStart.x;
|
|
||||||
const dy = lineEnd.y - lineStart.y;
|
|
||||||
const length = Math.sqrt(dx * dx + dy * dy);
|
|
||||||
|
|
||||||
if (length === 0) {
|
|
||||||
return lineStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nx = dx / length;
|
|
||||||
const ny = dy / length;
|
|
||||||
|
|
||||||
return {
|
|
||||||
x: circle.x - nx * radius,
|
|
||||||
y: circle.y - ny * radius,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function intersection(node: PositionedNode, outsidePoint: Point, insidePoint: Point): Point {
|
|
||||||
const x = node.x;
|
|
||||||
const y = node.y;
|
|
||||||
|
|
||||||
if (!node.width || !node.height) {
|
|
||||||
return { x: outsidePoint.x, y: outsidePoint.y };
|
|
||||||
}
|
|
||||||
const dx = Math.abs(x - insidePoint.x);
|
|
||||||
const w = node?.width / 2;
|
|
||||||
let r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
|
|
||||||
const h = node.height / 2;
|
|
||||||
|
|
||||||
const Q = Math.abs(outsidePoint.y - insidePoint.y);
|
|
||||||
const R = Math.abs(outsidePoint.x - insidePoint.x);
|
|
||||||
|
|
||||||
if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
|
|
||||||
// Intersection is top or bottom of rect.
|
|
||||||
const q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
|
|
||||||
r = (R * q) / Q;
|
|
||||||
const res = {
|
|
||||||
x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
|
|
||||||
y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (r === 0) {
|
|
||||||
res.x = outsidePoint.x;
|
|
||||||
res.y = outsidePoint.y;
|
|
||||||
}
|
|
||||||
if (R === 0) {
|
|
||||||
res.x = outsidePoint.x;
|
|
||||||
}
|
|
||||||
if (Q === 0) {
|
|
||||||
res.y = outsidePoint.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
} else {
|
|
||||||
if (insidePoint.x < outsidePoint.x) {
|
|
||||||
r = outsidePoint.x - w - x;
|
|
||||||
} else {
|
|
||||||
r = x - w - outsidePoint.x;
|
|
||||||
}
|
|
||||||
const q = (Q * r) / R;
|
|
||||||
let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r;
|
|
||||||
let _y = insidePoint.y < outsidePoint.y ? insidePoint.y + q : insidePoint.y - q;
|
|
||||||
|
|
||||||
if (r === 0) {
|
|
||||||
_x = outsidePoint.x;
|
|
||||||
_y = outsidePoint.y;
|
|
||||||
}
|
|
||||||
if (R === 0) {
|
|
||||||
_x = outsidePoint.x;
|
|
||||||
}
|
|
||||||
if (Q === 0) {
|
|
||||||
_y = outsidePoint.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return { x: _x, y: _y };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate edge positions based on positioned nodes
|
|
||||||
* Now includes tree membership and node dimensions for precise edge calculations
|
|
||||||
* Edges now stop at shape boundaries instead of extending to centers
|
|
||||||
*/
|
|
||||||
function calculateEdgePositions(
|
|
||||||
edges: Edge[],
|
|
||||||
positionedNodes: PositionedNode[],
|
|
||||||
intersectionShift: number
|
|
||||||
): PositionedEdge[] {
|
|
||||||
const nodeInfo = new Map<string, PositionedNode>();
|
|
||||||
positionedNodes.forEach((node) => {
|
|
||||||
nodeInfo.set(node.id, node);
|
|
||||||
});
|
|
||||||
|
|
||||||
return edges.map((edge) => {
|
|
||||||
const sourceNode = nodeInfo.get(edge.start ?? '');
|
|
||||||
const targetNode = nodeInfo.get(edge.end ?? '');
|
|
||||||
|
|
||||||
if (!sourceNode || !targetNode) {
|
|
||||||
return {
|
|
||||||
id: edge.id,
|
|
||||||
source: edge.start ?? '',
|
|
||||||
target: edge.end ?? '',
|
|
||||||
startX: 0,
|
|
||||||
startY: 0,
|
|
||||||
midX: 0,
|
|
||||||
midY: 0,
|
|
||||||
endX: 0,
|
|
||||||
endY: 0,
|
|
||||||
points: [{ x: 0, y: 0 }],
|
|
||||||
sourceSection: undefined,
|
|
||||||
targetSection: undefined,
|
|
||||||
sourceWidth: undefined,
|
|
||||||
sourceHeight: undefined,
|
|
||||||
targetWidth: undefined,
|
|
||||||
targetHeight: undefined,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const sourceCenter = { x: sourceNode.x, y: sourceNode.y };
|
|
||||||
const targetCenter = { x: targetNode.x, y: targetNode.y };
|
|
||||||
|
|
||||||
const isSourceRound = ['circle', 'cloud', 'bang'].includes(
|
|
||||||
sourceNode.originalNode?.shape ?? ''
|
|
||||||
);
|
|
||||||
const isTargetRound = ['circle', 'cloud', 'bang'].includes(
|
|
||||||
targetNode.originalNode?.shape ?? ''
|
|
||||||
);
|
|
||||||
|
|
||||||
let startPos = isSourceRound
|
|
||||||
? computeCircleEdgeIntersection(
|
|
||||||
{
|
|
||||||
x: sourceNode.x,
|
|
||||||
y: sourceNode.y,
|
|
||||||
width: sourceNode.width ?? 100,
|
|
||||||
height: sourceNode.height ?? 100,
|
|
||||||
},
|
|
||||||
targetCenter,
|
|
||||||
sourceCenter
|
|
||||||
)
|
|
||||||
: intersection(sourceNode, sourceCenter, targetCenter);
|
|
||||||
|
|
||||||
let endPos = isTargetRound
|
|
||||||
? computeCircleEdgeIntersection(
|
|
||||||
{
|
|
||||||
x: targetNode.x,
|
|
||||||
y: targetNode.y,
|
|
||||||
width: targetNode.width ?? 100,
|
|
||||||
height: targetNode.height ?? 100,
|
|
||||||
},
|
|
||||||
sourceCenter,
|
|
||||||
targetCenter
|
|
||||||
)
|
|
||||||
: intersection(targetNode, targetCenter, sourceCenter);
|
|
||||||
|
|
||||||
const midX = (startPos.x + endPos.x) / 2;
|
|
||||||
const midY = (startPos.y + endPos.y) / 2;
|
|
||||||
|
|
||||||
const points = [startPos];
|
|
||||||
if (sourceNode.section === 'left') {
|
|
||||||
points.push({
|
|
||||||
x: sourceNode.x - (sourceNode.width ?? 0) / 2 - intersectionShift,
|
|
||||||
y: sourceNode.y,
|
|
||||||
});
|
|
||||||
} else if (sourceNode.section === 'right') {
|
|
||||||
points.push({
|
|
||||||
x: sourceNode.x + (sourceNode.width ?? 0) / 2 + intersectionShift,
|
|
||||||
y: sourceNode.y,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (targetNode.section === 'left') {
|
|
||||||
points.push({
|
|
||||||
x: targetNode.x + (targetNode.width ?? 0) / 2 + intersectionShift,
|
|
||||||
y: targetNode.y,
|
|
||||||
});
|
|
||||||
} else if (targetNode.section === 'right') {
|
|
||||||
points.push({
|
|
||||||
x: targetNode.x - (targetNode.width ?? 0) / 2 - intersectionShift,
|
|
||||||
y: targetNode.y,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
points.push(endPos);
|
|
||||||
|
|
||||||
const secondPoint = points.length > 1 ? points[1] : targetCenter;
|
|
||||||
startPos = isSourceRound
|
|
||||||
? computeCircleEdgeIntersection(
|
|
||||||
{
|
|
||||||
x: sourceNode.x,
|
|
||||||
y: sourceNode.y,
|
|
||||||
width: sourceNode.width ?? 100,
|
|
||||||
height: sourceNode.height ?? 100,
|
|
||||||
},
|
|
||||||
secondPoint,
|
|
||||||
sourceCenter
|
|
||||||
)
|
|
||||||
: intersection(sourceNode, secondPoint, sourceCenter);
|
|
||||||
points[0] = startPos;
|
|
||||||
|
|
||||||
const secondLastPoint = points.length > 1 ? points[points.length - 2] : sourceCenter;
|
|
||||||
endPos = isTargetRound
|
|
||||||
? computeCircleEdgeIntersection(
|
|
||||||
{
|
|
||||||
x: targetNode.x,
|
|
||||||
y: targetNode.y,
|
|
||||||
width: targetNode.width ?? 100,
|
|
||||||
height: targetNode.height ?? 100,
|
|
||||||
},
|
|
||||||
secondLastPoint,
|
|
||||||
targetCenter
|
|
||||||
)
|
|
||||||
: intersection(targetNode, secondLastPoint, targetCenter);
|
|
||||||
points[points.length - 1] = endPos;
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: edge.id,
|
|
||||||
source: edge.start ?? '',
|
|
||||||
target: edge.end ?? '',
|
|
||||||
startX: startPos.x,
|
|
||||||
startY: startPos.y,
|
|
||||||
midX,
|
|
||||||
midY,
|
|
||||||
endX: endPos.x,
|
|
||||||
endY: endPos.y,
|
|
||||||
points,
|
|
||||||
sourceSection: sourceNode?.section,
|
|
||||||
targetSection: targetNode?.section,
|
|
||||||
sourceWidth: sourceNode?.width,
|
|
||||||
sourceHeight: sourceNode?.height,
|
|
||||||
targetWidth: targetNode?.width,
|
|
||||||
targetHeight: targetNode?.height,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate layout data structure
|
|
||||||
* @param data - The data to validate
|
|
||||||
* @returns True if data is valid, throws error otherwise
|
|
||||||
*/
|
|
||||||
export function validateLayoutData(data: LayoutData): boolean {
|
|
||||||
if (!data) {
|
|
||||||
throw new Error('Layout data is required');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!data.config) {
|
|
||||||
throw new Error('Configuration is required in layout data');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Array.isArray(data.nodes)) {
|
|
||||||
throw new Error('Nodes array is required in layout data');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Array.isArray(data.edges)) {
|
|
||||||
throw new Error('Edges array is required in layout data');
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@@ -1,13 +0,0 @@
|
|||||||
import type { LayoutLoaderDefinition } from 'mermaid';
|
|
||||||
|
|
||||||
const loader = async () => await import(`./render.js`);
|
|
||||||
|
|
||||||
const tidyTreeLayout: LayoutLoaderDefinition[] = [
|
|
||||||
{
|
|
||||||
name: 'tidy-tree',
|
|
||||||
loader,
|
|
||||||
algorithm: 'tidy-tree',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default tidyTreeLayout;
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user