mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-26 02:39:41 +02:00
chore: Cleanup state renderer v3
This commit is contained in:
@@ -1,34 +1,12 @@
|
|||||||
import { log } from '../../logger.js';
|
|
||||||
import type { DiagramStyleClassDef } from '../../diagram-api/types.js';
|
|
||||||
import type { LayoutData, LayoutMethod } from '../../rendering-util/types.js';
|
|
||||||
import { getConfig } from '../../diagram-api/diagramAPI.js';
|
import { getConfig } from '../../diagram-api/diagramAPI.js';
|
||||||
import doLayout from '../../rendering-util/doLayout.js';
|
import type { DiagramStyleClassDef } from '../../diagram-api/types.js';
|
||||||
import performRender from '../../rendering-util/performRender.js';
|
import { log } from '../../logger.js';
|
||||||
|
import { getDiagramElements } from '../../rendering-util/inserElementsForSize.js';
|
||||||
import { render } from '../../rendering-util/render.js';
|
import { render } from '../../rendering-util/render.js';
|
||||||
import insertElementsForSize, {
|
|
||||||
getDiagramElements,
|
|
||||||
} from '../../rendering-util/inserElementsForSize.js';
|
|
||||||
import { setupViewPortForSVG } from '../../rendering-util/setupViewPortForSVG.js';
|
import { setupViewPortForSVG } from '../../rendering-util/setupViewPortForSVG.js';
|
||||||
import {
|
import type { LayoutData } from '../../rendering-util/types.js';
|
||||||
DEFAULT_DIAGRAM_DIRECTION,
|
|
||||||
DEFAULT_NESTED_DOC_DIR,
|
|
||||||
STMT_STATE,
|
|
||||||
STMT_RELATION,
|
|
||||||
DEFAULT_STATE_TYPE,
|
|
||||||
DIVIDER_TYPE,
|
|
||||||
CSS_DIAGRAM,
|
|
||||||
} from './stateCommon.js';
|
|
||||||
import utils from '../../utils.js';
|
import utils from '../../utils.js';
|
||||||
|
import { CSS_DIAGRAM, DEFAULT_NESTED_DOC_DIR } from './stateCommon.js';
|
||||||
// Configuration
|
|
||||||
const conf: Record<string, any> = {};
|
|
||||||
|
|
||||||
export const setConf = function (cnf: Record<string, any>) {
|
|
||||||
const keys = Object.keys(cnf);
|
|
||||||
for (const key of keys) {
|
|
||||||
conf[key] = cnf[key];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the direction from the statement items.
|
* Get the direction from the statement items.
|
||||||
@@ -54,7 +32,7 @@ const getDir = (parsedItem: any, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
|
|||||||
export const getClasses = function (
|
export const getClasses = function (
|
||||||
text: string,
|
text: string,
|
||||||
diagramObj: any
|
diagramObj: any
|
||||||
): Record<string, DiagramStyleClassDef> {
|
): Map<string, DiagramStyleClassDef> {
|
||||||
diagramObj.db.extract(diagramObj.db.getRootDocV2());
|
diagramObj.db.extract(diagramObj.db.getRootDocV2());
|
||||||
return diagramObj.db.getClasses();
|
return diagramObj.db.getClasses();
|
||||||
};
|
};
|
||||||
@@ -108,7 +86,6 @@ export const draw = async function (text: string, id: string, _version: string,
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setConf,
|
|
||||||
getClasses,
|
getClasses,
|
||||||
draw,
|
draw,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user