chore: Update imports in layout-elk

This commit is contained in:
Sidharth Vinod 2024-05-15 19:00:45 +05:30
parent 64f1d2f005
commit 745ec0daae
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD

View File

@ -1,23 +1,23 @@
import insertMarkers from '../../rendering-elements/markers.js'; // @ts-nocheck File not ready to check types
import { findCommonAncestor } from './find-common-ancestor.js';
import { getConfig } from '$root/diagram-api/diagramAPI.js';
import { insertNode, clear as clearNodes } from '../../rendering-elements/nodes.js';
import { insertCluster, clear as clearClusters } from '../../rendering-elements/clusters.js';
import {
insertEdgeLabel,
positionEdgeLabel,
insertEdge,
clear as clearEdges,
} from '../../rendering-elements/edges.js';
import { labelHelper } from '$root/rendering-util/rendering-elements/shapes/util.js';
import common from '$root/diagrams/common/common.js';
import { log } from '$root/logger.js';
import ELK from 'elkjs/lib/elk.bundled.js'; import ELK from 'elkjs/lib/elk.bundled.js';
import { getConfig } from '../../mermaid/src/config.js';
import common from '../../mermaid/src/diagrams/common/common.js';
import { log } from '../../mermaid/src/logger.js';
import { insertCluster } from '../../mermaid/src/rendering-util/rendering-elements/clusters.js';
import {
insertEdge,
insertEdgeLabel,
positionEdgeLabel,
} from '../../mermaid/src/rendering-util/rendering-elements/edges.js';
import insertMarkers from '../../mermaid/src/rendering-util/rendering-elements/markers.js';
import { insertNode } from '../../mermaid/src/rendering-util/rendering-elements/nodes.js';
import { labelHelper } from '../../mermaid/src/rendering-util/rendering-elements/shapes/util.js';
import { findCommonAncestor } from './find-common-ancestor.js';
const nodeDb = {}; const nodeDb = {};
let portPos = {}; const portPos = {};
let clusterDb = {}; const clusterDb = {};
export const addVertex = async (nodeEl, graph, nodeArr, node) => { export const addVertex = async (nodeEl, graph, nodeArr, node) => {
const labelData = { width: 0, height: 0 }; const labelData = { width: 0, height: 0 };
@ -283,8 +283,8 @@ export const addEdges = function (dataForLayout, graph, svg) {
log.info('abc78 DAGA edges = ', dataForLayout); log.info('abc78 DAGA edges = ', dataForLayout);
const edges = dataForLayout.edges; const edges = dataForLayout.edges;
const labelsEl = svg.insert('g').attr('class', 'edgeLabels'); const labelsEl = svg.insert('g').attr('class', 'edgeLabels');
let linkIdCnt = {}; const linkIdCnt = {};
let dir = dataForLayout.direction || 'DOWN'; const dir = dataForLayout.direction || 'DOWN';
let defaultStyle; let defaultStyle;
let defaultLabelStyle; let defaultLabelStyle;
@ -299,7 +299,7 @@ export const addEdges = function (dataForLayout, graph, svg) {
linkIdCnt[linkIdBase]++; linkIdCnt[linkIdBase]++;
log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]); log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);
} }
let linkId = linkIdBase + '-' + linkIdCnt[linkIdBase]; const linkId = linkIdBase + '-' + linkIdCnt[linkIdBase];
edge.id = linkId; edge.id = linkId;
log.info('abc78 new link id to be used is', linkIdBase, linkId, linkIdCnt[linkIdBase]); log.info('abc78 new link id to be used is', linkIdBase, linkId, linkIdCnt[linkIdBase]);
const linkNameStart = 'LS-' + edge.start; const linkNameStart = 'LS-' + edge.start;
@ -457,7 +457,7 @@ export const render = async (data4Layout, svg, element) => {
log.info('Drawing flowchart using v4 renderer', elk); log.info('Drawing flowchart using v4 renderer', elk);
// Set the direction of the graph based on the parsed information // Set the direction of the graph based on the parsed information
let dir = data4Layout.direction || 'DOWN'; const dir = data4Layout.direction || 'DOWN';
switch (dir) { switch (dir) {
case 'BT': case 'BT':
elkGraph.layoutOptions['elk.direction'] = 'UP'; elkGraph.layoutOptions['elk.direction'] = 'UP';