mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-27 03:09:43 +02:00
Merge pull request #5405 from mermaid-js/sidv/cleanup3
Update all dependencies
This commit is contained in:
@@ -38,14 +38,14 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "^6.0.1",
|
||||
"d3": "^7.0.0",
|
||||
"khroma": "^2.0.0"
|
||||
"@braintree/sanitize-url": "^6.0.4",
|
||||
"d3": "^7.9.0",
|
||||
"khroma": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "^8.0.0",
|
||||
"rimraf": "^5.0.0",
|
||||
"mermaid": "workspace:*"
|
||||
"concurrently": "^8.2.2",
|
||||
"mermaid": "workspace:*",
|
||||
"rimraf": "^5.0.5"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
|
@@ -29,15 +29,15 @@
|
||||
"author": "Knut Sveidqvist",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"d3": "^7.4.0",
|
||||
"d3": "^7.9.0",
|
||||
"dagre-d3-es": "7.0.10",
|
||||
"khroma": "^2.0.0",
|
||||
"elkjs": "^0.9.0"
|
||||
"elkjs": "^0.9.2",
|
||||
"khroma": "^2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "^8.0.0",
|
||||
"rimraf": "^5.0.0",
|
||||
"mermaid": "workspace:^"
|
||||
"concurrently": "^8.2.2",
|
||||
"mermaid": "workspace:^",
|
||||
"rimraf": "^5.0.5"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
|
@@ -34,7 +34,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@zenuml/core": "^3.17.2"
|
||||
"@zenuml/core": "^3.19.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mermaid": "workspace:^"
|
||||
|
@@ -68,69 +68,69 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "^6.0.1",
|
||||
"@braintree/sanitize-url": "^7.0.1",
|
||||
"@mermaid-js/parser": "workspace:^",
|
||||
"cytoscape": "^3.28.1",
|
||||
"cytoscape-cose-bilkent": "^4.1.0",
|
||||
"d3": "^7.4.0",
|
||||
"d3": "^7.9.0",
|
||||
"d3-sankey": "^0.12.3",
|
||||
"dagre-d3-es": "7.0.10",
|
||||
"dayjs": "^1.11.7",
|
||||
"dompurify": "^3.0.5",
|
||||
"elkjs": "^0.9.0",
|
||||
"dayjs": "^1.11.10",
|
||||
"dompurify": "^3.0.11",
|
||||
"elkjs": "^0.9.2",
|
||||
"katex": "^0.16.9",
|
||||
"khroma": "^2.0.0",
|
||||
"khroma": "^2.1.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"mdast-util-from-markdown": "^1.3.0",
|
||||
"stylis": "^4.1.3",
|
||||
"mdast-util-from-markdown": "^2.0.0",
|
||||
"stylis": "^4.3.1",
|
||||
"ts-dedent": "^2.2.0",
|
||||
"uuid": "^9.0.0"
|
||||
"uuid": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@adobe/jsonschema2md": "^7.1.4",
|
||||
"@types/cytoscape": "^3.19.9",
|
||||
"@types/d3": "^7.4.0",
|
||||
"@types/d3-sankey": "^0.12.1",
|
||||
"@types/d3-scale": "^4.0.3",
|
||||
"@types/d3-scale-chromatic": "^3.0.0",
|
||||
"@types/d3-selection": "^3.0.5",
|
||||
"@types/d3-shape": "^3.1.1",
|
||||
"@types/dompurify": "^3.0.2",
|
||||
"@types/jsdom": "^21.1.1",
|
||||
"@adobe/jsonschema2md": "^7.1.5",
|
||||
"@types/cytoscape": "^3.19.16",
|
||||
"@types/d3": "^7.4.3",
|
||||
"@types/d3-sankey": "^0.12.4",
|
||||
"@types/d3-scale": "^4.0.8",
|
||||
"@types/d3-scale-chromatic": "^3.0.3",
|
||||
"@types/d3-selection": "^3.0.10",
|
||||
"@types/d3-shape": "^3.1.6",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/katex": "^0.16.7",
|
||||
"@types/lodash-es": "^4.17.7",
|
||||
"@types/micromatch": "^4.0.2",
|
||||
"@types/prettier": "^2.7.2",
|
||||
"@types/stylis": "^4.0.2",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
||||
"@typescript-eslint/parser": "^5.59.0",
|
||||
"ajv": "^8.11.2",
|
||||
"chokidar": "^3.5.3",
|
||||
"concurrently": "^8.0.1",
|
||||
"cpy-cli": "^4.2.0",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/micromatch": "^4.0.6",
|
||||
"@types/prettier": "^3.0.0",
|
||||
"@types/stylis": "^4.2.5",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||
"@typescript-eslint/parser": "^7.3.1",
|
||||
"ajv": "^8.12.0",
|
||||
"chokidar": "^3.6.0",
|
||||
"concurrently": "^8.2.2",
|
||||
"cpy-cli": "^5.0.0",
|
||||
"csstree-validator": "^3.0.0",
|
||||
"globby": "^13.1.4",
|
||||
"globby": "^14.0.1",
|
||||
"jison": "^0.4.18",
|
||||
"js-base64": "^3.7.5",
|
||||
"jsdom": "^22.0.0",
|
||||
"json-schema-to-typescript": "^11.0.3",
|
||||
"js-base64": "^3.7.7",
|
||||
"jsdom": "^24.0.0",
|
||||
"json-schema-to-typescript": "^13.1.2",
|
||||
"micromatch": "^4.0.5",
|
||||
"path-browserify": "^1.0.1",
|
||||
"prettier": "^2.8.8",
|
||||
"remark": "^14.0.2",
|
||||
"remark-frontmatter": "^4.0.1",
|
||||
"remark-gfm": "^3.0.1",
|
||||
"rimraf": "^5.0.0",
|
||||
"start-server-and-test": "^2.0.0",
|
||||
"type-fest": "^4.1.0",
|
||||
"typedoc": "^0.25.0",
|
||||
"typedoc-plugin-markdown": "^3.15.2",
|
||||
"typescript": "^5.0.4",
|
||||
"prettier": "^3.2.5",
|
||||
"remark": "^15.0.1",
|
||||
"remark-frontmatter": "^5.0.0",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"rimraf": "^5.0.5",
|
||||
"start-server-and-test": "^2.0.3",
|
||||
"type-fest": "^4.13.1",
|
||||
"typedoc": "^0.25.12",
|
||||
"typedoc-plugin-markdown": "^3.17.1",
|
||||
"typescript": "^5.4.3",
|
||||
"unist-util-flatmap": "^1.0.0",
|
||||
"unist-util-visit": "^4.1.2",
|
||||
"vitepress": "^1.0.0-rc.40",
|
||||
"vitepress-plugin-search": "^1.0.4-alpha.22"
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"vitepress": "^1.0.1",
|
||||
"vitepress-plugin-search": "1.0.4-alpha.22"
|
||||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
|
@@ -85,7 +85,7 @@ const LOGMSG_COPIED = `, and copied to ${FINAL_DOCS_DIR}`;
|
||||
|
||||
const WARN_DOCSDIR_DOESNT_MATCH = `Changed files were transformed in ${SOURCE_DOCS_DIR} but do not match the files in ${FINAL_DOCS_DIR}. Please run 'pnpm --filter mermaid run docs:build' after making changes to ${SOURCE_DOCS_DIR} to update the ${FINAL_DOCS_DIR} directory with the transformed files.`;
|
||||
|
||||
const prettierConfig = prettier.resolveConfig.sync('.') ?? {};
|
||||
const prettierConfig = (await prettier.resolveConfig('.')) ?? {};
|
||||
// From https://github.com/vuejs/vitepress/blob/428eec3750d6b5648a77ac52d88128df0554d4d1/src/node/markdownToVue.ts#L20-L21
|
||||
const includesRE = /<!--\s*@include:\s*(.*?)\s*-->/g;
|
||||
const includedFiles: Set<string> = new Set();
|
||||
@@ -326,7 +326,7 @@ export function transformMarkdownAst({
|
||||
*
|
||||
* @param file {string} name of the file that will be verified
|
||||
*/
|
||||
const transformMarkdown = (file: string) => {
|
||||
const transformMarkdown = async (file: string) => {
|
||||
const doc = injectPlaceholders(transformIncludeStatements(file, readSyncedUTF8file(file)));
|
||||
|
||||
let transformed = remark()
|
||||
@@ -347,7 +347,7 @@ const transformMarkdown = (file: string) => {
|
||||
transformed = doc;
|
||||
}
|
||||
|
||||
const formatted = prettier.format(transformed, {
|
||||
const formatted = await prettier.format(transformed, {
|
||||
parser: 'markdown',
|
||||
...prettierConfig,
|
||||
});
|
||||
@@ -454,7 +454,7 @@ async function transformJsonSchema(file: string) {
|
||||
|
||||
const transformed = transformer.stringify(await transformer.run(markdownAst as Root));
|
||||
|
||||
const formatted = prettier.format(transformed, {
|
||||
const formatted = await prettier.format(transformed, {
|
||||
parser: 'markdown',
|
||||
...prettierConfig,
|
||||
});
|
||||
@@ -472,7 +472,7 @@ async function transformJsonSchema(file: string) {
|
||||
*
|
||||
* @param filename {string} name of the HTML file to transform
|
||||
*/
|
||||
const transformHtml = (filename: string) => {
|
||||
const transformHtml = async (filename: string) => {
|
||||
/**
|
||||
* Insert the '...auto generated...' comment into an HTML file after the<html> element
|
||||
*
|
||||
@@ -496,7 +496,7 @@ const transformHtml = (filename: string) => {
|
||||
};
|
||||
|
||||
const transformedHTML = insertAutoGeneratedComment(filename);
|
||||
const formattedHTML = prettier.format(transformedHTML, {
|
||||
const formattedHTML = await prettier.format(transformedHTML, {
|
||||
parser: 'html',
|
||||
...prettierConfig,
|
||||
});
|
||||
@@ -541,7 +541,7 @@ export const processDocs = async () => {
|
||||
const mdFileGlobs = getGlobs([posix.join(sourceDirGlob, '*.md')]);
|
||||
const mdFiles = await getFilesFromGlobs(mdFileGlobs);
|
||||
console.log(`${action} ${mdFiles.length} markdown files...`);
|
||||
mdFiles.forEach(transformMarkdown);
|
||||
await Promise.all(mdFiles.map(transformMarkdown));
|
||||
|
||||
for (const includedFile of includedFiles) {
|
||||
rmSync(includedFile, { force: true });
|
||||
@@ -552,7 +552,7 @@ export const processDocs = async () => {
|
||||
const htmlFileGlobs = getGlobs([posix.join(sourceDirGlob, '*.html')]);
|
||||
const htmlFiles = await getFilesFromGlobs(htmlFileGlobs);
|
||||
console.log(`${action} ${htmlFiles.length} html files...`);
|
||||
htmlFiles.forEach(transformHtml);
|
||||
await Promise.all(htmlFiles.map(transformHtml));
|
||||
|
||||
const otherFileGlobs = getGlobs([sourceDirGlob, '!**/*.md', '!**/*.html']);
|
||||
const otherFiles = await getFilesFromGlobs(otherFileGlobs);
|
||||
@@ -591,9 +591,9 @@ export const processDocs = async () => {
|
||||
return;
|
||||
}
|
||||
if (isMd(path)) {
|
||||
transformMarkdown(path);
|
||||
void transformMarkdown(path);
|
||||
} else if (isHtml(path)) {
|
||||
transformHtml(path);
|
||||
void transformHtml(path);
|
||||
} else if (isOther(path)) {
|
||||
copyTransformedContents(path, true);
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ describe('diagram-orchestration', () => {
|
||||
expect(() =>
|
||||
detectType('flowchart TD; A-->B', { flowchart: { defaultRenderer: 'dagre-d3' } })
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: flowchart TD; A-->B"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: flowchart TD; A-->B]`
|
||||
);
|
||||
|
||||
// graph & dagre-wrapper => flowchart-v2
|
||||
|
@@ -17,16 +17,16 @@ describe('DiagramAPI', () => {
|
||||
|
||||
it('should throw error if diagram is not defined', () => {
|
||||
expect(() => getDiagram('loki')).toThrowErrorMatchingInlineSnapshot(
|
||||
'"Diagram loki not found."'
|
||||
`[Error: Diagram loki not found.]`
|
||||
);
|
||||
});
|
||||
|
||||
it('should handle diagram registrations', () => {
|
||||
expect(() => getDiagram('loki')).toThrowErrorMatchingInlineSnapshot(
|
||||
'"Diagram loki not found."'
|
||||
`[Error: Diagram loki not found.]`
|
||||
);
|
||||
expect(() => detectType('loki diagram')).toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: loki diagram"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: loki diagram]`
|
||||
);
|
||||
const detector: DiagramDetector = (str: string) => {
|
||||
return str.match('loki') !== null;
|
||||
|
@@ -65,23 +65,23 @@ describe('diagram detection', () => {
|
||||
|
||||
test('should throw the right error for incorrect diagram', async () => {
|
||||
await expect(Diagram.fromText('graph TD; A-->')).rejects.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Parse error on line 2:
|
||||
[Error: Parse error on line 2:
|
||||
graph TD; A-->
|
||||
--------------^
|
||||
Expecting 'AMP', 'COLON', 'PIPE', 'TESTSTR', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'NODE_STRING', 'BRKT', 'MINUS', 'MULT', 'UNICODE_TEXT', got 'EOF'"
|
||||
Expecting 'AMP', 'COLON', 'PIPE', 'TESTSTR', 'DOWN', 'DEFAULT', 'NUM', 'COMMA', 'NODE_STRING', 'BRKT', 'MINUS', 'MULT', 'UNICODE_TEXT', got 'EOF']
|
||||
`);
|
||||
await expect(Diagram.fromText('sequenceDiagram; A-->B')).rejects
|
||||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Parse error on line 1:
|
||||
...quenceDiagram; A-->B
|
||||
-----------------------^
|
||||
Expecting 'TXT', got 'NEWLINE'"
|
||||
`);
|
||||
[Error: Parse error on line 1:
|
||||
...quenceDiagram; A-->B
|
||||
-----------------------^
|
||||
Expecting 'TXT', got 'NEWLINE']
|
||||
`);
|
||||
});
|
||||
|
||||
test('should throw the right error for unregistered diagrams', async () => {
|
||||
await expect(Diagram.fromText('thor TD; A-->B')).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: thor TD; A-->B"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: thor TD; A-->B]`
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -67,49 +67,49 @@ describe('the flowchart renderer', function () {
|
||||
});
|
||||
});
|
||||
|
||||
['Multi<br>Line', 'Multi<br/>Line', 'Multi<br />Line', 'Multi<br\t/>Line'].forEach(function (
|
||||
labelText
|
||||
) {
|
||||
it('should handle multiline texts with different line breaks', async function () {
|
||||
const addedNodes = [];
|
||||
const fakeDiag = {
|
||||
db: {
|
||||
lookUpDomId: () => {
|
||||
return 'my-node-id';
|
||||
['Multi<br>Line', 'Multi<br/>Line', 'Multi<br />Line', 'Multi<br\t/>Line'].forEach(
|
||||
function (labelText) {
|
||||
it('should handle multiline texts with different line breaks', async function () {
|
||||
const addedNodes = [];
|
||||
const fakeDiag = {
|
||||
db: {
|
||||
lookUpDomId: () => {
|
||||
return 'my-node-id';
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const mockG = {
|
||||
setNode: function (id, object) {
|
||||
addedNodes.push([id, object]);
|
||||
},
|
||||
};
|
||||
await addVertices(
|
||||
{
|
||||
v1: {
|
||||
type: 'rect',
|
||||
id: 'my-node-id',
|
||||
classes: [],
|
||||
styles: [],
|
||||
text: 'Multi<br>Line',
|
||||
};
|
||||
const mockG = {
|
||||
setNode: function (id, object) {
|
||||
addedNodes.push([id, object]);
|
||||
},
|
||||
},
|
||||
mockG,
|
||||
'svg-id',
|
||||
false,
|
||||
document,
|
||||
fakeDiag
|
||||
);
|
||||
expect(addedNodes).toHaveLength(1);
|
||||
expect(addedNodes[0][0]).toEqual('my-node-id');
|
||||
expect(addedNodes[0][1]).toHaveProperty('id', 'my-node-id');
|
||||
expect(addedNodes[0][1]).toHaveProperty('labelType', 'svg');
|
||||
expect(addedNodes[0][1].label).toBeDefined();
|
||||
expect(addedNodes[0][1].label).toBeDefined(); // <text> node
|
||||
expect(addedNodes[0][1].label.firstChild.innerHTML).toEqual('Multi'); // <tspan> node, line 1
|
||||
expect(addedNodes[0][1].label.lastChild.innerHTML).toEqual('Line'); // <tspan> node, line 2
|
||||
});
|
||||
});
|
||||
};
|
||||
await addVertices(
|
||||
{
|
||||
v1: {
|
||||
type: 'rect',
|
||||
id: 'my-node-id',
|
||||
classes: [],
|
||||
styles: [],
|
||||
text: 'Multi<br>Line',
|
||||
},
|
||||
},
|
||||
mockG,
|
||||
'svg-id',
|
||||
false,
|
||||
document,
|
||||
fakeDiag
|
||||
);
|
||||
expect(addedNodes).toHaveLength(1);
|
||||
expect(addedNodes[0][0]).toEqual('my-node-id');
|
||||
expect(addedNodes[0][1]).toHaveProperty('id', 'my-node-id');
|
||||
expect(addedNodes[0][1]).toHaveProperty('labelType', 'svg');
|
||||
expect(addedNodes[0][1].label).toBeDefined();
|
||||
expect(addedNodes[0][1].label).toBeDefined(); // <text> node
|
||||
expect(addedNodes[0][1].label.firstChild.innerHTML).toEqual('Multi'); // <tspan> node, line 1
|
||||
expect(addedNodes[0][1].label.lastChild.innerHTML).toEqual('Line'); // <tspan> node, line 2
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
[
|
||||
[['fill:#fff'], 'fill:#fff;', ''],
|
||||
|
@@ -138,7 +138,7 @@ describe('packet diagrams', () => {
|
||||
18-20: "error"
|
||||
`;
|
||||
await expect(parser.parse(str)).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"Packet block 18 - 20 is not contiguous. It should start from 17."'
|
||||
`[Error: Packet block 18 - 20 is not contiguous. It should start from 17.]`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -148,7 +148,7 @@ describe('packet diagrams', () => {
|
||||
18: "error"
|
||||
`;
|
||||
await expect(parser.parse(str)).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"Packet block 18 - 18 is not contiguous. It should start from 17."'
|
||||
`[Error: Packet block 18 - 18 is not contiguous. It should start from 17.]`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('packet diagrams', () => {
|
||||
19: "error"
|
||||
`;
|
||||
await expect(parser.parse(str)).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"Packet block 19 - 19 is not contiguous. It should start from 18."'
|
||||
`[Error: Packet block 19 - 19 is not contiguous. It should start from 18.]`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -169,7 +169,7 @@ describe('packet diagrams', () => {
|
||||
25-20: "error"
|
||||
`;
|
||||
await expect(parser.parse(str)).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"Packet block 25 - 20 is invalid. End must be greater than start."'
|
||||
`[Error: Packet block 25 - 20 is invalid. End must be greater than start.]`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -98,7 +98,10 @@ describe('Testing quadrantChart jison file', () => {
|
||||
str =
|
||||
'quadrantChart\n Y-AxIs "Urgent(* +=[❤" --> "Not Urgent (* +=[❤"\n ';
|
||||
expect(parserFnConstructor(str)).not.toThrow();
|
||||
expect(mockDB.setYAxisBottomText).toHaveBeenCalledWith({ text: 'Urgent(* +=[❤', type: 'text' });
|
||||
expect(mockDB.setYAxisBottomText).toHaveBeenCalledWith({
|
||||
text: 'Urgent(* +=[❤',
|
||||
type: 'text',
|
||||
});
|
||||
expect(mockDB.setYAxisTopText).toHaveBeenCalledWith({
|
||||
text: 'Not Urgent (* +=[❤',
|
||||
type: 'text',
|
||||
@@ -107,7 +110,10 @@ describe('Testing quadrantChart jison file', () => {
|
||||
clearMocks();
|
||||
str = 'quadrantChart\n y-AxIs "Urgent(* +=[❤"';
|
||||
expect(parserFnConstructor(str)).not.toThrow();
|
||||
expect(mockDB.setYAxisBottomText).toHaveBeenCalledWith({ text: 'Urgent(* +=[❤', type: 'text' });
|
||||
expect(mockDB.setYAxisBottomText).toHaveBeenCalledWith({
|
||||
text: 'Urgent(* +=[❤',
|
||||
type: 'text',
|
||||
});
|
||||
expect(mockDB.setYAxisTopText).not.toHaveBeenCalled();
|
||||
|
||||
clearMocks();
|
||||
@@ -165,7 +171,10 @@ describe('Testing quadrantChart jison file', () => {
|
||||
clearMocks();
|
||||
str = 'QuadRantChart \n QuaDrant-3 "Deligate(* +=[❤"';
|
||||
expect(parserFnConstructor(str)).not.toThrow();
|
||||
expect(mockDB.setQuadrant3Text).toHaveBeenCalledWith({ text: 'Deligate(* +=[❤', type: 'text' });
|
||||
expect(mockDB.setQuadrant3Text).toHaveBeenCalledWith({
|
||||
text: 'Deligate(* +=[❤',
|
||||
type: 'text',
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to parse quadrant4 text', () => {
|
||||
|
@@ -25,7 +25,11 @@ const clear = (): void => {
|
||||
};
|
||||
|
||||
class SankeyLink {
|
||||
constructor(public source: SankeyNode, public target: SankeyNode, public value: number = 0) {}
|
||||
constructor(
|
||||
public source: SankeyNode,
|
||||
public target: SankeyNode,
|
||||
public value: number = 0
|
||||
) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -221,8 +221,8 @@ export const parseMessage = function (str) {
|
||||
_str.match(/^:?wrap:/) !== null
|
||||
? true
|
||||
: _str.match(/^:?nowrap:/) !== null
|
||||
? false
|
||||
: undefined,
|
||||
? false
|
||||
: undefined,
|
||||
};
|
||||
log.debug('parseMessage:', message);
|
||||
return message;
|
||||
@@ -262,8 +262,8 @@ export const parseBoxData = function (str) {
|
||||
? title.match(/^:?wrap:/) !== null
|
||||
? true
|
||||
: title.match(/^:?nowrap:/) !== null
|
||||
? false
|
||||
: undefined
|
||||
? false
|
||||
: undefined
|
||||
: undefined,
|
||||
};
|
||||
};
|
||||
|
@@ -627,12 +627,18 @@ const activationBounds = function (actor, actors) {
|
||||
const actorObj = actors[actor];
|
||||
const activations = actorActivations(actor);
|
||||
|
||||
const left = activations.reduce(function (acc, activation) {
|
||||
return common.getMin(acc, activation.startx);
|
||||
}, actorObj.x + actorObj.width / 2 - 1);
|
||||
const right = activations.reduce(function (acc, activation) {
|
||||
return common.getMax(acc, activation.stopx);
|
||||
}, actorObj.x + actorObj.width / 2 + 1);
|
||||
const left = activations.reduce(
|
||||
function (acc, activation) {
|
||||
return common.getMin(acc, activation.startx);
|
||||
},
|
||||
actorObj.x + actorObj.width / 2 - 1
|
||||
);
|
||||
const right = activations.reduce(
|
||||
function (acc, activation) {
|
||||
return common.getMax(acc, activation.stopx);
|
||||
},
|
||||
actorObj.x + actorObj.width / 2 + 1
|
||||
);
|
||||
return [left, right];
|
||||
};
|
||||
|
||||
|
@@ -37,7 +37,7 @@ By default, MathML is used for rendering mathematical expressions. If you have u
|
||||
Example with legacy mode enabled (the latest version of KaTeX's stylesheet can be found on their [docs](https://katex.org/docs/browser.html)):
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<!-- KaTeX requires the use of the HTML5 doctype. Without it, KaTeX may not render properly -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
@@ -67,7 +67,7 @@ Example:
|
||||
## Simple full example:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<body>
|
||||
<pre class="mermaid">
|
||||
|
@@ -33,7 +33,7 @@ One should **beware the use of some words or symbols** that can break diagrams.
|
||||
| Diagram Breakers | Reason | Solution |
|
||||
| ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | ------------------------------------------------- |
|
||||
| **Comments** | | |
|
||||
| [` %%{``}%% `](https://github.com/mermaid-js/mermaid/issues/1968) | Similar to [Directives](../config/directives.md) confuses the renderer. | In comments using `%%`, avoid using "{}". |
|
||||
| [`%%{``}%%`](https://github.com/mermaid-js/mermaid/issues/1968) | Similar to [Directives](../config/directives.md) confuses the renderer. | In comments using `%%`, avoid using "{}". |
|
||||
| **Flow-Charts** | | |
|
||||
| 'end' | The word "End" can cause Flowcharts and Sequence diagrams to break | Wrap them in quotation marks to prevent breakage. |
|
||||
| [Nodes inside Nodes](../syntax/flowchart.md?id=special-characters-that-break-syntax) | Mermaid gets confused with nested shapes | wrap them in quotation marks to prevent breaking |
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
|
@@ -16,24 +16,24 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "^6.9.96",
|
||||
"@vueuse/core": "^10.1.0",
|
||||
"@vueuse/core": "^10.9.0",
|
||||
"font-awesome": "^4.7.0",
|
||||
"jiti": "^1.18.2",
|
||||
"vue": "^3.3",
|
||||
"mermaid": "workspace:^"
|
||||
"jiti": "^1.21.0",
|
||||
"mermaid": "workspace:^",
|
||||
"vue": "^3.4.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify-json/carbon": "^1.1.16",
|
||||
"@unocss/reset": "^0.58.0",
|
||||
"@iconify-json/carbon": "^1.1.31",
|
||||
"@unocss/reset": "^0.58.6",
|
||||
"@vite-pwa/vitepress": "^0.4.0",
|
||||
"@vitejs/plugin-vue": "^4.2.1",
|
||||
"fast-glob": "^3.2.12",
|
||||
"@vitejs/plugin-vue": "^4.6.2",
|
||||
"fast-glob": "^3.3.2",
|
||||
"https-localhost": "^4.7.1",
|
||||
"pathe": "^1.1.0",
|
||||
"unocss": "^0.58.0",
|
||||
"pathe": "^1.1.2",
|
||||
"unocss": "^0.58.6",
|
||||
"unplugin-vue-components": "^0.26.0",
|
||||
"vite": "^4.5.2",
|
||||
"vite-plugin-pwa": "^0.19.0",
|
||||
"vite-plugin-pwa": "^0.19.7",
|
||||
"vitepress": "1.0.0-rc.45",
|
||||
"workbox-window": "^7.0.0"
|
||||
}
|
||||
|
@@ -160,7 +160,7 @@ describe('when using mermaid and ', () => {
|
||||
await expect(
|
||||
mermaid.parse('this is not a mermaid diagram definition')
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: this is not a mermaid diagram definition"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: this is not a mermaid diagram definition]`
|
||||
);
|
||||
});
|
||||
|
||||
@@ -172,9 +172,9 @@ describe('when using mermaid and ', () => {
|
||||
it('should throw for an invalid flow definition', async () => {
|
||||
await expect(mermaid.parse('graph TQ;A--x|text including URL space|B;')).rejects
|
||||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Lexical error on line 1. Unrecognized text.
|
||||
[Error: Lexical error on line 1. Unrecognized text.
|
||||
graph TQ;A--x|text includ
|
||||
-----^"
|
||||
-----^]
|
||||
`);
|
||||
});
|
||||
|
||||
@@ -204,10 +204,10 @@ describe('when using mermaid and ', () => {
|
||||
'Bob-->Alice: Feel sick...\n' +
|
||||
'end';
|
||||
await expect(mermaid.parse(text)).rejects.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Parse error on line 2:
|
||||
[Error: Parse error on line 2:
|
||||
...equenceDiagramAlice:->Bob: Hello Bob, h...
|
||||
----------------------^
|
||||
Expecting 'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', 'SOLID_ARROW', 'DOTTED_ARROW', 'SOLID_CROSS', 'DOTTED_CROSS', 'SOLID_POINT', 'DOTTED_POINT', got 'TXT'"
|
||||
Expecting 'SOLID_OPEN_ARROW', 'DOTTED_OPEN_ARROW', 'SOLID_ARROW', 'DOTTED_ARROW', 'SOLID_CROSS', 'DOTTED_CROSS', 'SOLID_POINT', 'DOTTED_POINT', got 'TXT']
|
||||
`);
|
||||
});
|
||||
|
||||
@@ -219,7 +219,7 @@ describe('when using mermaid and ', () => {
|
||||
await expect(
|
||||
mermaid.parse('this is not a mermaid diagram definition')
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: this is not a mermaid diagram definition"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: this is not a mermaid diagram definition]`
|
||||
);
|
||||
expect(parseErrorWasCalled).toEqual(true);
|
||||
});
|
||||
|
@@ -680,7 +680,7 @@ describe('mermaidAPI', () => {
|
||||
await expect(
|
||||
mermaidAPI.parse('this is not a mermaid diagram definition')
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
'"No diagram type detected matching given configuration for text: this is not a mermaid diagram definition"'
|
||||
`[UnknownDiagramError: No diagram type detected matching given configuration for text: this is not a mermaid diagram definition]`
|
||||
);
|
||||
});
|
||||
it('returns false for invalid definition with silent option', async () => {
|
||||
|
@@ -121,7 +121,7 @@ it('should handle strings with newlines', () => {
|
||||
expect(() =>
|
||||
splitLineToFitWidth(getLineFromString(str), checkFn)
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
'"splitLineToFitWidth does not support newlines in the line"'
|
||||
`[Error: splitLineToFitWidth does not support newlines in the line]`
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -39,14 +39,16 @@ export class MockedD3 {
|
||||
return this.select(select_str);
|
||||
});
|
||||
|
||||
append = vi
|
||||
.fn()
|
||||
.mockImplementation(function (this: MockedD3, type: string, id = '' + '-appended'): MockedD3 {
|
||||
const newMock = new MockedD3(id);
|
||||
newMock.attribs.set('type', type);
|
||||
this._children.push(newMock);
|
||||
return newMock;
|
||||
});
|
||||
append = vi.fn().mockImplementation(function (
|
||||
this: MockedD3,
|
||||
type: string,
|
||||
id = '' + '-appended'
|
||||
): MockedD3 {
|
||||
const newMock = new MockedD3(id);
|
||||
newMock.attribs.set('type', type);
|
||||
this._children.push(newMock);
|
||||
return newMock;
|
||||
});
|
||||
|
||||
// NOTE: The d3 implementation allows for a selector ('beforeSelector' arg below).
|
||||
// With this mocked implementation, we assume it will always refer to an node id
|
||||
|
Reference in New Issue
Block a user