cullmann.io/themes/blowfish/assets/lib/mermaid/flowchart-elk-definition-c9fc5e04.js.map

1 line
50 KiB
Plaintext
Raw Normal View History

{"version":3,"file":"flowchart-elk-definition-c9fc5e04.js","sources":["../src/diagrams/flowchart/elk/render-utils.ts","../src/diagrams/flowchart/elk/flowRenderer-elk.js","../src/diagrams/flowchart/elk/styles.ts","../src/diagrams/flowchart/elk/flowchart-elk-definition.ts"],"sourcesContent":["export interface TreeData {\n parentById: Record<string, string>;\n childrenById: Record<string, string[]>;\n}\n\nexport const findCommonAncestor = (id1: string, id2: string, treeData: TreeData) => {\n const { parentById } = treeData;\n const visited = new Set();\n let currentId = id1;\n while (currentId) {\n visited.add(currentId);\n if (currentId === id2) {\n return currentId;\n }\n currentId = parentById[currentId];\n }\n currentId = id2;\n while (currentId) {\n if (visited.has(currentId)) {\n return currentId;\n }\n currentId = parentById[currentId];\n }\n return 'root';\n};\n","import { select, line, curveLinear } from 'd3';\nimport { insertNode } from '../../../dagre-wrapper/nodes.js';\nimport insertMarkers from '../../../dagre-wrapper/markers.js';\nimport { insertEdgeLabel } from '../../../dagre-wrapper/edges.js';\nimport { findCommonAncestor } from './render-utils';\nimport { addHtmlLabel } from 'dagre-d3-es/src/dagre-js/label/add-html-label.js';\nimport { getConfig } from '../../../config';\nimport { log } from '../../../logger';\nimport { setupGraphViewbox } from '../../../setupGraphViewbox';\nimport common, { evaluate } from '../../common/common';\nimport { interpolateToCurve, getStylesFromArray } from '../../../utils';\nimport ELK from 'elkjs/lib/elk.bundled.js';\nconst elk = new ELK();\n\nconst portPos = {};\n\nconst conf = {};\nexport const setConf = function (cnf) {\n const keys = Object.keys(cnf);\n for (const key of keys) {\n conf[key] = cnf[key];\n }\n};\n\nlet nodeDb = {};\n\n// /**\n// * Function that adds the vertices found during parsing to the graph to be rendered.\n// *\n// * @param vert Object containing the vertices.\n// * @param g The graph that is to be drawn.\n// * @param svgId\n// * @param root\n// * @param doc\n// * @param diagObj\n// */\nexport const addVertices = function (vert, svgId, root, doc, diagObj, parentLookupDb, graph) {\n const svg = root.select(`[id=\"${svgId}\"]`);\n const nodes = svg.insert('g').attr('class', 'nodes');\n const keys = Object.keys(vert);\n\n // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition\n keys.forEach(function (id) {\n const vertex = vert[id];\n\n /**\n * Variable for storing the classes for the vertex\n *\n * @type {string}\n */\n let classStr = 'default';\n if (vertex.classes.length > 0) {\n classStr = vertex.classes.join(' ');\n }\n\n const styles = getStylesFromArray(vertex.styles);\n\n // Use vertex id as text in the box if no text is provided by the graph definition\n let vertexText = vertex.text !== undefined ? vertex.text : vertex.id;\n\n // We create a SVG label, either by delegating to addHtmlLabel or manually\n let vertexNode;\n const labelData = { width: 0, height: 0 };\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?\n const node = {\n label: vertexText.replace(\n /fa[blrs]?:fa-[\\w-]+/g,\n (s) => `<i class='${s.replace(':', ' ')}'></i>`\n ),\n };\n vertexNode = addHtmlLabel(svg, node).node();\n const bbox = vertexNode.getBBox();\n labelData.width = bbox.width;\n labelData.height = bbox.height;\n labelData.labelNode = vertexNode;\n vertexNode.parentNode.removeChild(vertexNode);\n } else {\n const svgLabel = doc.createElementNS('http://www.w3.org/2000/svg', 'text');\n svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));\n\n const rows = vertexText.split(common.lineBreakRegex);\n\n for (const row of rows) {\n const tspan = doc.createElementNS('http://www.w3.org/2000/svg', 'tspan')