mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 06:49:47 +02:00
chore(split): Gantt
This commit is contained in:
@@ -1,5 +1,20 @@
|
|||||||
import type { DiagramDetector } from '../../diagram-api/types';
|
import type { DiagramDetector, ExternalDiagramDefinition } from '../../diagram-api/types';
|
||||||
|
|
||||||
export const ganttDetector: DiagramDetector = (txt) => {
|
const id = 'gantt';
|
||||||
|
|
||||||
|
const detector: DiagramDetector = (txt) => {
|
||||||
return txt.match(/^\s*gantt/) !== null;
|
return txt.match(/^\s*gantt/) !== null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const loader = async () => {
|
||||||
|
const { diagram } = await import('./ganttDiagram');
|
||||||
|
return { id, diagram };
|
||||||
|
};
|
||||||
|
|
||||||
|
const plugin: ExternalDiagramDefinition = {
|
||||||
|
id,
|
||||||
|
detector,
|
||||||
|
loader,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default plugin;
|
||||||
|
13
packages/mermaid/src/diagrams/gantt/ganttDiagram.ts
Normal file
13
packages/mermaid/src/diagrams/gantt/ganttDiagram.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// @ts-ignore: TODO Fix ts errors
|
||||||
|
import ganttParser from './parser/gantt';
|
||||||
|
import ganttDb from './ganttDb';
|
||||||
|
import ganttRenderer from './ganttRenderer';
|
||||||
|
import ganttStyles from './styles';
|
||||||
|
import { DiagramDefinition } from '../../diagram-api/types';
|
||||||
|
|
||||||
|
export const diagram: DiagramDefinition = {
|
||||||
|
parser: ganttParser,
|
||||||
|
db: ganttDb,
|
||||||
|
renderer: ganttRenderer,
|
||||||
|
styles: ganttStyles,
|
||||||
|
};
|
Reference in New Issue
Block a user