{"version":3,"file":"styles-d461a25b.js","sources":["../src/diagrams/flowchart/flowRenderer-v2.js","../src/diagrams/flowchart/styles.ts"],"sourcesContent":["import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';\nimport { select, curveLinear, selectAll } from 'd3';\n\nimport flowDb from './flowDb';\nimport { getConfig } from '../../config';\nimport utils from '../../utils';\n\nimport { render } from '../../dagre-wrapper/index.js';\nimport { addHtmlLabel } from 'dagre-d3-es/src/dagre-js/label/add-html-label.js';\nimport { log } from '../../logger';\nimport common, { evaluate } from '../common/common';\nimport { interpolateToCurve, getStylesFromArray } from '../../utils';\nimport { setupGraphViewbox } from '../../setupGraphViewbox';\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\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, g, svgId, root, doc, diagObj) {\n const svg = root.select(`[id=\"${svgId}\"]`);\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 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) => ``\n ),\n };\n vertexNode = addHtmlLabel(svg, node).node();\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');\n tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\n tspan.setAttribute('dy', '1em');\n tspan.setAttribute('x', '1');\n tspan.textContent = row;\n svgLabel.appendChild(tspan);\n }\n vertexNode = svgLabel;\n }\n\n let radious = 0;\n let _shape = '';\n // Set the shape based parameters\n switch (vertex.type) {\n case 'round':\n radious = 5;\n _shape = 'rect';\n break;\n case 'square':\n _shape = 'rect';\n break;\n case 'diamond':\n _shape = 'question';\n break;\n case 'hexagon':\n _shape = 'hexagon';\n break;\n case 'odd':\n _shape = 'rect_left_inv_arrow';\n break;\n case 'lean_right':\n _shape = 'lean_right';\n break;\n case 'lean_left':\n _shape = 'lean_left';\n break;\n case 'trapezoid':\n _shape = 'trapezoid';\n break;\n case 'inv_trapezoid':\n _shape = 'inv_trapezoid';\n break;\n case 'odd_right':\n _shape = 'rect_left_inv_arrow';\n break;\n case 'circle':\n _shape = 'circle';\n break;\n case 'ellipse':\n _shape = 'ellipse';\n break;\n case 'stadium':\n _shape = 'stadium';\n break;\n case 'subroutine':\n _shape = 'subroutine';\n break;\n case 'cylinder':\n _shape = 'cylinder';\n break;\n case 'group':\n _shape = 'rect';\n break;\n case 'doublecircle':\n _shape = 'doublecircle';\n break;\n default:\n _shape = 'rect';\n }\n // Add the node\n g.setNode(vertex.id, {\n labelStyle: styles.labelStyle,\n shape: _shape,\n labelText: vertexText,\n rx: radious,\n ry: radious,\n class: classStr,\n style: styles.style,\n id: vertex.id,\n link: vertex.link,\n linkTarget: vertex.linkTarget,\n tooltip: diagObj.db.getTooltip(vertex.id) || '',\n domId: diagObj.db.lookUpDomId(vertex.id),\n haveCallback: vertex.haveCallback,\n width: vertex.type === 'group' ? 500 : undefined,\n dir: vertex.dir,\n type: vertex.type,\n props: vertex.props,\n padding: getConfig().flowchart.padding,\n });\n\n log.info('setNode', {\n labelStyle: styles.labelStyle,\n shape: _shape,\n labelText: vertexText,\n rx: radious,\n ry: radious,\n class: classStr,\n style: styles.style,\n id: vertex.id,\n domId: diagObj.db.lookUpDomId(vertex.id),\n width: vertex.type === 'group' ? 500 : undefined,\n type: vertex.type,\n dir: vertex.dir,\n props: vertex.props,\n padding: getConfig().flowchart.padding,\n });\n });\n};\n\n/**\n * Add edges to graph based on parsed graph definition\n *\n * @param {object} edges The edges to add to the graph\n * @param {object} g The graph object\n * @param diagObj\n */\nexport const addEdges = function (edges, g, diagObj) {\n log.info('abc78 edges = ', edges);\n let cnt = 0;\n let linkIdCnt = {};\n\n let defaultStyle;\n let defaultLabelStyle;\n\n if (edges.defaultStyle !== undefined) {\n const defaultStyles = getStylesFromArray(edges.defaultStyle);\n defaultStyle = defaultStyles.style;\n defaultLabelStyle = defaultStyles.labelStyle;\n }\n\n edges.forEach(function (edge) {\n cnt++;\n\n // Identify Link\n var linkIdBase = 'L-' + edge.start + '-' + edge.end;\n // count the links from+to the same node to give unique id\n if (linkIdCnt[linkIdBase] === undefined) {\n linkIdCnt[linkIdBase] = 0;\n log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);\n } else {\n linkIdCnt[linkIdBase]++;\n log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);\n }\n let linkId = linkIdBase + '-' + linkIdCnt[linkIdBase];\n log.info('abc78 new link id to be used is', linkIdBase, linkId, linkIdCnt[linkIdBase]);\n var linkNameStart = 'LS-' + edge.start;\n var linkNameEnd = 'LE-' + edge.end;\n\n const edgeData = { style: '', labelStyle: '' };\n edgeData.minlen = edge.length || 1;\n //edgeData.id = 'id' + cnt;\n\n // Set link type for rendering\n if (edge.type === 'arrow_open') {\n edgeData.arrowhead = 'none';\n } else {\n edgeData.arrowhead = 'normal';\n }\n\n // Check of arrow types, placed here in order not to break old rendering\n edgeData.arrowTypeStart = 'arrow_open';\n edgeData.arrowTypeEnd = 'arrow_open';\n\n /* eslint-disable no-fallthrough */\n switch (edge.type) {\n case 'double_arrow_cross':\n edgeData.arrowTypeStart = 'arrow_cross';\n case 'arrow_cross':\n edgeData.arrowTypeEnd = 'arrow_cross';\n break;\n case 'double_arrow_point':\n edgeData.arrowTypeStart = 'arrow_point';\n case 'arrow_point':\n edgeData.arrowTypeEnd = 'arrow_point';\n break;\n case 'double_arrow_circle':\n edgeData.arrowTypeStart = 'arrow_circle';\n case 'arrow_circle':\n edgeData.arrowTypeEnd = 'arrow_circle';\n break;\n }\n\n let style = '';\n let labelStyle = '';\n\n switch (edge.stroke) {\n case 'normal':\n style = 'fill:none;';\n if (defaultStyle !== undefined) {\n style = defaultStyle;\n }\n if (defaultLabelStyle !== undefined) {\n labelStyle = defaultLabelStyle;\n }\n edgeData.thickness = 'normal';\n edgeData.pattern = 'solid';\n break;\n case 'dotted':\n edgeData.thickness = 'normal';\n edgeData.pattern = 'dotted';\n edgeData.style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';\n break;\n case 'thick':\n edgeData.thickness = 'thick';\n edgeData.pattern = 'solid';\n edgeData.style = 'stroke-width: 3.5px;fill:none;';\n break;\n case 'invisible':\n edgeData.thickness = 'invisible';\n edgeData.pattern = 'solid';\n edgeData.style = 'stroke-width: 0;fill:none;';\n break;\n }\n if (edge.style !== undefined) {\n const styles = getStylesFromArray(edge.style);\n style = styles.style;\n labelStyle = styles.labelStyle;\n }\n\n edgeData.style = edgeData.style += style;\n edgeData.labelStyle = edgeData.labelStyle += labelStyle;\n\n if (edge.interpolate !== undefined) {\n edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);\n } else if (edges.defaultInterpolate !== undefined) {\n edgeData.curve = interpolateToCurve(edges.defaultInterpolate, curveLinear);\n } else {\n edgeData.curve = interpolateToCurve(conf.curve, curveLinear);\n }\n\n if (edge.text === undefined) {\n if (edge.style !== undefined) {\n edgeData.arrowheadStyle = 'fill: #333';\n }\n } else {\n edgeData.arrowheadStyle = 'fill: #333';\n edgeData.labelpos = 'c';\n }\n\n edgeData.labelType = 'text';\n edgeData.label = edge.text.replace(common.lineBreakRegex, '\\n');\n\n if (edge.style === undefined) {\n edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none;';\n }\n\n edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');\n\n edgeData.id = linkId;\n edgeData.classes = 'flowchart-link ' + linkNameStart + ' ' + linkNameEnd;\n\n // Add the edge to the graph\n g.setEdge(edge.start, edge.end, edgeData, cnt);\n });\n};\n\n/**\n * Returns the all the styles from classDef statements in the graph definition.\n *\n * @param text\n * @param diagObj\n * @returns {object} ClassDef styles\n */\nexport const getClasses = function (text, diagObj) {\n log.info('Extracting classes');\n diagObj.db.clear();\n try {\n // Parse the graph definition\n diagObj.parse(text);\n return diagObj.db.getClasses();\n } catch (e) {\n return;\n }\n};\n\n/**\n * Draws a flowchart in the tag with id: id based on the graph definition in text.\n *\n * @param text\n * @param id\n */\n\nexport const draw = function (text, id, _version, diagObj) {\n log.info('Drawing flowchart');\n diagObj.db.clear();\n flowDb.setGen('gen-2');\n // Parse the graph definition\n diagObj.parser.parse(text);\n\n // Fetch the default direction, use TD if none was found\n let dir = diagObj.db.getDirection();\n if (dir === undefined) {\n dir = 'TD';\n }\n\n const { securityLevel, flowchart: conf } = getConfig();\n const nodeSpacing = conf.nodeSpacing || 50;\n const rankSpacing = conf.rankSpacing || 50;\n\n // Handle root and document for when rendering in sandbox mode\n let sandboxElement;\n if (securityLevel === 'sandbox') {\n sandboxElement = select('#i' + id);\n }\n const root =\n securityLevel === 'sandbox'\n ? select(sandboxElement.nodes()[0].contentDocument.body)\n : select('body');\n const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;\n\n // Create the input mermaid.graph\n const g = new graphlib.Graph({\n multigraph: true,\n compound: true,\n })\n .setGraph({\n rankdir: dir,\n nodesep: nodeSpacing,\n ranksep: rankSpacing,\n marginx: 0,\n marginy: 0,\n })\n .setDefaultEdgeLabel(function () {\n return {};\n });\n\n let subG;\n const subGraphs = diagObj.db.getSubGraphs();\n log.info('Subgraphs - ', subGraphs);\n for (let i = subGraphs.length - 1; i >= 0; i--) {\n subG = subGraphs[i];\n log.info('Subgraph - ', subG);\n diagObj.db.addVertex(subG.id, subG.title, 'group', undefined, subG.classes, subG.dir);\n }\n\n // Fetch the vertices/nodes and edges/links from the parsed graph definition\n const vert = diagObj.db.getVertices();\n\n const edges = diagObj.db.getEdges();\n\n log.info('Edges', edges);\n let i = 0;\n for (i = subGraphs.length - 1; i >= 0; i--) {\n // for (let i = 0; i < subGraphs.length; i++) {\n subG = subGraphs[i];\n\n selectAll('cluster').append('text');\n\n for (let j = 0; j < subG.nodes.length; j++) {\n log.info('Setting up subgraphs', subG.nodes[j], subG.id);\n g.setParent(subG.nodes[j], subG.id);\n }\n }\n addVertices(vert, g, id, root, doc, diagObj);\n addEdges(edges, g, diagObj);\n\n // Add custom shapes\n // flowChartShapes.addToRenderV2(addShape);\n\n // Set up an SVG group so that we can translate the final graph.\n const svg = root.select(`[id=\"${id}\"]`);\n\n // Run the renderer. This is what draws the final graph.\n const element = root.select('#' + id + ' g');\n render(element, g, ['point', 'circle', 'cross'], 'flowchart', id);\n\n utils.insertTitle(svg, 'flowchartTitleText', conf.titleTopMargin, diagObj.db.getDiagramTitle());\n\n setupGraphViewbox(g, svg, conf.diagramPadding, conf.useMaxWidth);\n\n // Index nodes\n diagObj.db.indexNodes('subGraph' + i);\n\n // Add label rects for non html labels\n if (!conf.htmlLabels) {\n const labels = doc.querySelectorAll('[id=\"' + id + '\"] .edgeLabel .label');\n for (const label of labels) {\n // Get dimensions of label\n const dim = label.getBBox();\n\n const rect = doc.createElementNS('http://www.w3.org/2000/svg', 'rect');\n rect.setAttribute('rx', 0);\n rect.setAttribute('ry', 0);\n rect.setAttribute('width', dim.width);\n rect.setAttribute('height', dim.height);\n\n label.insertBefore(rect, label.firstChild);\n }\n }\n\n // If node has a link, wrap it in an anchor SVG object.\n const keys = Object.keys(vert);\n keys.forEach(function (key) {\n const vertex = vert[key];\n\n if (vertex.link) {\n const node = select('#' + id + ' [id=\"' + key + '\"]');\n if (node) {\n const link = doc.createElementNS('http://www.w3.org/2000/svg', 'a');\n link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));\n link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);\n link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');\n if (securityLevel === 'sandbox') {\n link.setAttributeNS('http://www.w3.org/2000/svg', 'target', '_top');\n } else if (vertex.linkTarget) {\n link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);\n }\n\n const linkNode = node.insert(function () {\n return link;\n }, ':first-child');\n\n const shape = node.select('.label-container');\n if (shape) {\n linkNode.append(function () {\n return shape.node();\n });\n }\n\n const label = node.select('.label');\n if (label) {\n linkNode.append(function () {\n return label.node();\n });\n }\n }\n }\n });\n};\n\nexport default {\n setConf,\n addVertices,\n addEdges,\n getClasses,\n draw,\n};\n","/** Returns the styles given options */\nexport interface FlowChartStyleOptions {\n arrowheadColor: string;\n border2: string;\n clusterBkg: string;\n clusterBorder: string;\n edgeLabelBackground: string;\n fontFamily: string;\n lineColor: string;\n mainBkg: string;\n nodeBorder: string;\n nodeTextColor: string;\n tertiaryColor: string;\n textColor: string;\n titleColor: string;\n}\n\nconst getStyles = (options: FlowChartStyleOptions) =>\n `.label {\n font-family: ${options.fontFamily};\n color: ${options.nodeTextColor || options.textColor};\n }\n .cluster-label text {\n fill: ${options.titleColor};\n }\n .cluster-label span {\n color: ${options.titleColor};\n }\n\n .label text,span {\n fill: ${options.nodeTextColor || options.textColor};\n color: ${options.nodeTextColor || options.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${options.mainBkg};\n stroke: ${options.nodeBorder};\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${options.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${options.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${options.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${options.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${options.edgeLabelBackground};\n fill: ${options.edgeLabelBackground};\n }\n text-align: center;\n }\n\n .cluster rect {\n fill: ${options.clusterBkg};\n stroke: ${options.clusterBorder};\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${options.titleColor};\n }\n\n .cluster span {\n color: ${options.titleColor};\n }\n /* .cluster div {\n color: ${options.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${options.fontFamily};\n font-size: 12px;\n background: ${options.tertiaryColor};\n border: 1px solid ${options.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${options.textColor};\n }\n`;\n\nexport default getStyles;\n"],"names":["conf","setConf","cnf","keys","key","addVertices","vert","g","svgId","root","doc","diagObj","svg","id","vertex","classStr","styles","getStylesFromArray","vertexText","vertexNode","evaluate","getConfig","node","s","addHtmlLabel","svgLabel","rows","common","row","tspan","radious","_shape","log","addEdges","edges","cnt","linkIdCnt","defaultStyle","defaultLabelStyle","defaultStyles","edge","linkIdBase","linkId","linkNameStart","linkNameEnd","edgeData","style","labelStyle","interpolateToCurve","curveLinear","getClasses","text","draw","_version","flowDb","dir","securityLevel","nodeSpacing","rankSpacing","sandboxElement","select","graphlib.Graph","subG","subGraphs","i","selectAll","j","element","render","utils","setupGraphViewbox","labels","label","dim","rect","link","linkNode","shape","flowRendererV2","getStyles","options","flowStyles"],"mappings":";;;;;;;AAcA,MA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