UNPKG

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