From 7167710800db46d6192b85dbe7fad684aa584d44 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Sat, 29 Jun 2024 02:54:51 +0530 Subject: [PATCH] chore: Cleanup --- .../state/stateRenderer-v3-unified.ts | 11 ----- .../rendering-util/insertElementsForSize.js | 44 ------------------- 2 files changed, 55 deletions(-) diff --git a/packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts b/packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts index 368532ef0..9eb53c93a 100644 --- a/packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts +++ b/packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts @@ -57,17 +57,6 @@ export const draw = async function (text: string, id: string, _version: string, // Create the root SVG - the element is the div containing the SVG element const { element, svg } = getDiagramElements(id, securityLevel); - // // For some diagrams this call is not needed, but in the state diagram it is - // await insertElementsForSize(element, data4Layout); - - // console.log('data4Layout:', data4Layout); - - // // Now we have layout data with real sizes, we can perform the layout - // const data4Rendering = doLayout(data4Layout, id, _version, 'dagre-wrapper'); - - // // The performRender method provided in all supported diagrams is used to render the data - // performRender(data4Rendering); - data4Layout.type = diag.type; data4Layout.layoutAlgorithm = layout; data4Layout.direction = DIR; diff --git a/packages/mermaid/src/rendering-util/insertElementsForSize.js b/packages/mermaid/src/rendering-util/insertElementsForSize.js index 136e9e31f..c711fad81 100644 --- a/packages/mermaid/src/rendering-util/insertElementsForSize.js +++ b/packages/mermaid/src/rendering-util/insertElementsForSize.js @@ -1,8 +1,5 @@ -// import type { LayoutData } from './types'; import { select } from 'd3'; -import { insertNode } from '../dagre-wrapper/nodes.js'; -// export const getDiagramElements = (id: string, securityLevel: any) => { export const getDiagramElements = (id, securityLevel) => { let sandboxElement; if (securityLevel === 'sandbox') { @@ -21,44 +18,3 @@ export const getDiagramElements = (id, securityLevel) => { const element = root.select('#' + id + ' g'); return { svg, element }; }; - -// export function insertElementsForSize(el: SVGElement, data: LayoutData): void { -/** - * - * @param el - * @param data - */ -export function insertElementsForSize(el, data) { - const nodesElem = el.insert('g').attr('class', 'nodes'); - el.insert('g').attr('class', 'edges'); - data.nodes.forEach(async (item) => { - item.shape = 'rect'; - await insertNode(nodesElem, { - ...item, - class: 'default flowchart-label', - labelStyle: '', - x: 0, - y: 0, - width: 100, - rx: 0, - ry: 0, - height: 100, - shape: 'rect', - padding: 8, - }); - // Create a new DOM element - // const element = document.createElement('div'); - - // // Set the content of the element to the name of the item - // element.textContent = item.name; - - // // Set the size of the element to the size of the item - // element.style.width = `${item.size}px`; - // element.style.height = `${item.size}px`; - - // Append the element to the body of the document - // document.body.appendChild(element); - }); -} - -export default insertElementsForSize;