chore(split): Gantt

This commit is contained in:
Sidharth Vinod
2022-11-18 16:09:56 +05:30
parent 43aa831dd2
commit 38e5c3a81e
2 changed files with 30 additions and 2 deletions

View File

@@ -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;
};
const loader = async () => {
const { diagram } = await import('./ganttDiagram');
return { id, diagram };
};
const plugin: ExternalDiagramDefinition = {
id,
detector,
loader,
};
export default plugin;

View 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,
};