-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sidv/splitELK' into sidv/diagramPriority
* sidv/splitELK: 5043 Move ELK to standalone package
- Loading branch information
Showing
18 changed files
with
246 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<title>Mermaid Flowchart ELK Test Page</title> | ||
</head> | ||
|
||
<body> | ||
<h1>Flowchart ELK</h1> | ||
<pre class="mermaid"> | ||
flowchart-elk TD | ||
A([Start]) ==> B[Step 1] | ||
B ==> C{Flow 1} | ||
C -- Choice 1.1 --> D[Step 2.1] | ||
C -- Choice 1.3 --> I[Step 2.3] | ||
C == Choice 1.2 ==> E[Step 2.2] | ||
D --> F{Flow 2} | ||
E ==> F{Flow 2} | ||
F{Flow 2} == Choice 2.1 ==> H[Feedback node] | ||
H[Feedback node] ==> B[Step 1] | ||
F{Flow 2} == Choice 2.2 ==> G((Finish)) | ||
|
||
</pre> | ||
|
||
<script type="module"> | ||
import mermaid from './mermaid.esm.mjs'; | ||
import flowchartELK from './mermaid-flowchart-elk.esm.mjs'; | ||
await mermaid.registerExternalDiagrams([flowchartELK]); | ||
mermaid.initialize({ | ||
logLevel: 3, | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,55 @@ | ||
{ | ||
"name": "@mermaid-js/flowchart-elk", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"description": "Flowchart plugin for mermaid with ELK layout", | ||
"module": "dist/mermaid-flowchart-elk.core.mjs", | ||
"types": "dist/packages/mermaid-flowchart-elk/src/detector.d.ts", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"import": "./dist/mermaid-flowchart-elk.core.mjs", | ||
"types": "./dist/packages/mermaid-flowchart-elk/src/detector.d.ts" | ||
}, | ||
"./*": "./*" | ||
}, | ||
"keywords": [ | ||
"diagram", | ||
"markdown", | ||
"flowchart", | ||
"elk", | ||
"mermaid" | ||
], | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"prepublishOnly": "pnpm -w run build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/mermaid-js/mermaid" | ||
}, | ||
"author": "Knut Sveidqvist", | ||
"license": "MIT", | ||
"standard": { | ||
"ignore": [ | ||
"**/parser/*.js", | ||
"dist/**/*.js", | ||
"cypress/**/*.js" | ||
], | ||
"globals": [ | ||
"page" | ||
] | ||
}, | ||
"dependencies": { | ||
"d3": "^7.4.0", | ||
"dagre-d3-es": "7.0.10", | ||
"khroma": "^2.0.0", | ||
"elkjs": "^0.8.2" | ||
}, | ||
"devDependencies": { | ||
"concurrently": "^8.0.0", | ||
"rimraf": "^5.0.0", | ||
"mermaid": "workspace:*" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT" | ||
"files": [ | ||
"dist" | ||
] | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { | ||
ExternalDiagramDefinition, | ||
DiagramDetector, | ||
DiagramLoader, | ||
} from '../../mermaid/src/diagram-api/types.js'; | ||
|
||
const id = 'flowchart-elk'; | ||
|
||
const detector: DiagramDetector = (txt, config): boolean => { | ||
if ( | ||
// If diagram explicitly states flowchart-elk | ||
/^\s*flowchart-elk/.test(txt) || | ||
// If a flowchart/graph diagram has their default renderer set to elk | ||
(/^\s*flowchart|graph/.test(txt) && config?.flowchart?.defaultRenderer === 'elk') | ||
) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
|
||
const loader: DiagramLoader = async () => { | ||
const { diagram } = await import('./diagram-definition.js'); | ||
return { id, diagram }; | ||
}; | ||
|
||
const plugin: ExternalDiagramDefinition = { | ||
id, | ||
detector, | ||
loader, | ||
}; | ||
|
||
export default plugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// @ts-ignore: JISON typing missing | ||
import parser from '../../mermaid/src/diagrams/flowchart/parser/flow.jison'; | ||
import * as db from '../../mermaid/src/diagrams/flowchart/flowDb.js'; | ||
import styles from '../../mermaid/src/diagrams/flowchart/styles.js'; | ||
import renderer from './flowRenderer-elk.js'; | ||
|
||
export const diagram = { | ||
db, | ||
renderer, | ||
parser, | ||
styles, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "../..", | ||
"outDir": "./dist" | ||
}, | ||
"include": ["./src/**/*.ts"], | ||
"typeRoots": ["./src/types"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
packages/mermaid/src/diagrams/flowchart/elk/flowchart-elk-definition.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.