-
Notifications
You must be signed in to change notification settings - Fork 478
/
index.js
executable file
·36 lines (25 loc) · 1.25 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import FlowTreeBuilder, {
createFlowTreeModifier as createFlowTreeModifierFromBuilder,
ABSTRACTION_LEVELS,
MODIFIER_PRESETS,
DEFINED_MODIFIERS
} from 'builder/FlowTreeBuilder';
import SVGRender, { ShapesTreeEditor } from 'render/svg/SVGRender';
import PresentationGenerator from 'presentation-generator/PresentationGenerator';
import { TOKEN_TYPES, MODIFIED_TYPES } from 'shared/constants';
export const createFlowTreeBuilder = FlowTreeBuilder;
export const createFlowTreeModifier = createFlowTreeModifierFromBuilder;
export const createSVGRender = SVGRender;
export const createShapesTreeEditor = ShapesTreeEditor;
export const createPresentationGenerator = PresentationGenerator;
export { ABSTRACTION_LEVELS, DEFINED_MODIFIERS, MODIFIER_PRESETS, TOKEN_TYPES, MODIFIED_TYPES };
export const convertCodeToSvg = (code, printConfig) => convertFlowTreeToSvg(convertCodeToFlowTree(code), printConfig);
export const convertCodeToFlowTree = (code) => {
const flowTreeBuilder = createFlowTreeBuilder();
return flowTreeBuilder.build(code);
};
export const convertFlowTreeToSvg = (flowTree, printConfig) => {
const svgRender = createSVGRender();
const shapesTree = svgRender.buildShapesTree(flowTree);
return shapesTree.print(printConfig);
};