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