cullmann.io/themes/blowfish/assets/lib/mermaid/stateDiagram-v2-a936b277.js.map

1 line
24 KiB
Plaintext

{"version":3,"file":"stateDiagram-v2-a936b277.js","sources":["../src/diagrams/state/stateRenderer-v2.js","../src/diagrams/state/stateDiagram-v2.ts"],"sourcesContent":["import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';\nimport { select } from 'd3';\nimport { getConfig } from '../../config';\nimport { render } from '../../dagre-wrapper/index.js';\nimport { log } from '../../logger';\nimport { configureSvgSize } from '../../setupGraphViewbox';\nimport common from '../common/common';\nimport utils from '../../utils';\n\nimport {\n DEFAULT_DIAGRAM_DIRECTION,\n DEFAULT_NESTED_DOC_DIR,\n STMT_STATE,\n STMT_RELATION,\n DEFAULT_STATE_TYPE,\n DIVIDER_TYPE,\n} from './stateCommon';\n\n// --------------------------------------\n// Shapes\nconst SHAPE_STATE = 'rect';\nconst SHAPE_STATE_WITH_DESC = 'rectWithTitle';\nconst SHAPE_START = 'start';\nconst SHAPE_END = 'end';\nconst SHAPE_DIVIDER = 'divider';\nconst SHAPE_GROUP = 'roundedWithTitle';\nconst SHAPE_NOTE = 'note';\nconst SHAPE_NOTEGROUP = 'noteGroup';\n\n// --------------------------------------\n// CSS classes\nconst CSS_DIAGRAM = 'statediagram';\nconst CSS_STATE = 'state';\nconst CSS_DIAGRAM_STATE = `${CSS_DIAGRAM}-${CSS_STATE}`;\nconst CSS_EDGE = 'transition';\nconst CSS_NOTE = 'note';\nconst CSS_NOTE_EDGE = 'note-edge';\nconst CSS_EDGE_NOTE_EDGE = `${CSS_EDGE} ${CSS_NOTE_EDGE}`;\nconst CSS_DIAGRAM_NOTE = `${CSS_DIAGRAM}-${CSS_NOTE}`;\nconst CSS_CLUSTER = 'cluster';\nconst CSS_DIAGRAM_CLUSTER = `${CSS_DIAGRAM}-${CSS_CLUSTER}`;\nconst CSS_CLUSTER_ALT = 'cluster-alt';\nconst CSS_DIAGRAM_CLUSTER_ALT = `${CSS_DIAGRAM}-${CSS_CLUSTER_ALT}`;\n\n// --------------------------------------\n// DOM and element IDs\nconst PARENT = 'parent';\nconst NOTE = 'note';\nconst DOMID_STATE = 'state';\nconst DOMID_TYPE_SPACER = '----';\nconst NOTE_ID = `${DOMID_TYPE_SPACER}${NOTE}`;\nconst PARENT_ID = `${DOMID_TYPE_SPACER}${PARENT}`;\n// --------------------------------------\n// Graph edge settings\nconst G_EDGE_STYLE = 'fill:none';\nconst G_EDGE_ARROWHEADSTYLE = 'fill: #333';\nconst G_EDGE_LABELPOS = 'c';\nconst G_EDGE_LABELTYPE = 'text';\nconst G_EDGE_THICKNESS = 'normal';\n\n// --------------------------------------\n// List of nodes created from the parsed diagram statement items\nlet nodeDb = {};\n\nlet graphItemCount = 0; // used to construct ids, etc.\n\n// Configuration\nconst conf = {};\n\n// -----------------------------------------------------------------------\n\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 * Returns the all the classdef styles (a.k.a. classes) from classDef statements in the graph definition.\n *\n * @param {string} text - the diagram text to be parsed\n * @param diagramObj\n * @returns {object} ClassDef styles (a Map with keys = strings, values = )\n */\nexport const getClasses = function (text, diagramObj) {\n log.trace('Extracting classes');\n diagramObj.db.clear();\n try {\n // Parse the graph definition\n diagramObj.parser.parse(text);\n // must run extract() to turn the parsed statements into states, relationships, classes, etc.\n diagramObj.db.extract(diagramObj.db.getRootDocV2());\n return diagramObj.db.getClasses();\n } catch (e) {\n return e;\n }\n};\n\n/**\n * Get classes from the db for the info item.\n * If there aren't any or if dbInfoItem isn't defined, return an empty string.\n * Else create 1 string from the list of classes found\n *\n * @param {undefined | null | object} dbInfoItem\n * @returns {string}\n */\nfunction getClassesFromDbInfo(dbInfoItem) {\n if (dbInfoItem === undefined || dbInfoItem === null) {\n return '';\n } else {\n if (dbInfoItem.classes) {\n return dbInfoItem.classes.join(' ');\n } else {\n return '';\n }\n }\n}\n\n/**\n * Create a standard string for the dom ID of an item.\n * If a type is given, insert that before the counter, preceded by the type spacer\n *\n * @param itemId\n * @param counter\n * @param {string | null} type\n * @param typeSpacer\n * @returns {string}\n */\nexport function stateDomId(itemId = '', counter = 0, type = '', typeSpacer = DOMID_TYPE_SPACER) {\n const typeStr = type !== null && type.length > 0 ? `${typeSpacer}${type}` : '';\n return `${DOMID_STATE}-${itemId}${typeStr}-${counter}`;\n}\n\n/**\n * Create a graph node based on the statement information\n *\n * @param g - graph\n * @param {object} parent\n * @param {object} parsedItem - parsed statement item\n * @param {object[]} diagramStates - the list of all known states for the diagram\n * @param {object} diagramDb\n * @param {boolean} altFlag - for clusters, add the \"statediagram-cluster-alt\" CSS class\n */\nconst setupNode = (g, parent, parsedItem, diagramStates, diagramDb, altFlag) => {\n const itemId = parsedItem.id;\n const classStr = getClassesFromDbInfo(diagramStates[itemId]);\n\n if (itemId !== 'root') {\n let shape = SHAPE_STATE;\n if (parsedItem.start === true) {\n shape = SHAPE_START;\n }\n if (parsedItem.start === false) {\n shape = SHAPE_END;\n }\n if (parsedItem.type !== DEFAULT_STATE_TYPE) {\n shape = parsedItem.type;\n }\n\n // Add the node to our list (nodeDb)\n if (!nodeDb[itemId]) {\n nodeDb[itemId] = {\n id: itemId,\n shape,\n description: common.sanitizeText(itemId, getConfig()),\n classes: `${classStr} ${CSS_DIAGRAM_STATE}`,\n };\n }\n\n const newNode = nodeDb[itemId];\n\n // Save data for description and group so that for instance a statement without description overwrites\n // one with description @todo TODO What does this mean? If important, add a test for it\n\n // Build of the array of description strings\n if (parsedItem.description) {\n if (Array.isArray(newNode.description)) {\n // There already is an array of strings,add to it\n newNode.shape = SHAPE_STATE_WITH_DESC;\n newNode.description.push(parsedItem.description);\n } else {\n if (newNode.description.length > 0) {\n // if there is a description already transform it to an array\n newNode.shape = SHAPE_STATE_WITH_DESC;\n if (newNode.description === itemId) {\n // If the previous description was this, remove it\n newNode.description = [parsedItem.description];\n } else {\n newNode.description = [newNode.description, parsedItem.description];\n }\n } else {\n newNode.shape = SHAPE_STATE;\n newNode.description = parsedItem.description;\n }\n }\n newNode.description = common.sanitizeTextOrArray(newNode.description, getConfig());\n }\n\n // If there's only 1 description entry, just use a regular state shape\n if (newNode.description.length === 1 && newNode.shape === SHAPE_STATE_WITH_DESC) {\n newNode.shape = SHAPE_STATE;\n }\n\n // group\n if (!newNode.type && parsedItem.doc) {\n log.info('Setting cluster for ', itemId, getDir(parsedItem));\n newNode.type = 'group';\n newNode.dir = getDir(parsedItem);\n newNode.shape = parsedItem.type === DIVIDER_TYPE ? SHAPE_DIVIDER : SHAPE_GROUP;\n newNode.classes =\n newNode.classes +\n ' ' +\n CSS_DIAGRAM_CLUSTER +\n ' ' +\n (altFlag ? CSS_DIAGRAM_CLUSTER_ALT : '');\n }\n\n // This is what will be added to the graph\n const nodeData = {\n labelStyle: '',\n shape: newNode.shape,\n labelText: newNode.description,\n // typeof newNode.description === 'object'\n // ? newNode.description[0]\n // : newNode.description,\n classes: newNode.classes,\n style: '', //styles.style,\n id: itemId,\n dir: newNode.dir,\n domId: stateDomId(itemId, graphItemCount),\n type: newNode.type,\n padding: 15, //getConfig().flowchart.padding\n };\n\n if (parsedItem.note) {\n // Todo: set random id\n const noteData = {\n labelStyle: '',\n shape: SHAPE_NOTE,\n labelText: parsedItem.note.text,\n classes: CSS_DIAGRAM_NOTE,\n style: '', // styles.style,\n id: itemId + NOTE_ID + '-' + graphItemCount,\n domId: stateDomId(itemId, graphItemCount, NOTE),\n type: newNode.type,\n padding: 15, //getConfig().flowchart.padding\n };\n const groupData = {\n labelStyle: '',\n shape: SHAPE_NOTEGROUP,\n labelText: parsedItem.note.text,\n classes: newNode.classes,\n style: '', // styles.style,\n id: itemId + PARENT_ID,\n domId: stateDomId(itemId, graphItemCount, PARENT),\n type: 'group',\n padding: 0, //getConfig().flowchart.padding\n };\n graphItemCount++;\n\n const parentNodeId = itemId + PARENT_ID;\n g.setNode(parentNodeId, groupData);\n\n g.setNode(noteData.id, noteData);\n g.setNode(itemId, nodeData);\n\n g.setParent(itemId, parentNodeId);\n g.setParent(noteData.id, parentNodeId);\n\n let from = itemId;\n let to = noteData.id;\n\n if (parsedItem.note.position === 'left of') {\n from = noteData.id;\n to = itemId;\n }\n g.setEdge(from, to, {\n arrowhead: 'none',\n arrowType: '',\n style: G_EDGE_STYLE,\n labelStyle: '',\n classes: CSS_EDGE_NOTE_EDGE,\n arrowheadStyle: G_EDGE_ARROWHEADSTYLE,\n labelpos: G_EDGE_LABELPOS,\n labelType: G_EDGE_LABELTYPE,\n thickness: G_EDGE_THICKNESS,\n });\n } else {\n g.setNode(itemId, nodeData);\n }\n }\n\n if (parent && parent.id !== 'root') {\n log.trace('Setting node ', itemId, ' to be child of its parent ', parent.id);\n g.setParent(itemId, parent.id);\n }\n if (parsedItem.doc) {\n log.trace('Adding nodes children ');\n setupDoc(g, parsedItem, parsedItem.doc, diagramStates, diagramDb, !altFlag);\n }\n};\n\n/**\n * Turn parsed statements (item.stmt) into nodes, relationships, etc. for a document.\n * (A document may be nested within others.)\n *\n * @param g\n * @param parentParsedItem - parsed Item that is the parent of this document (doc)\n * @param doc - the document to set up; it is a list of parsed statements\n * @param {object[]} diagramStates - the list of all known states for the diagram\n * @param diagramDb\n * @param {boolean} altFlag\n * @todo This duplicates some of what is done in stateDb.js extract method\n */\nconst setupDoc = (g, parentParsedItem, doc, diagramStates, diagramDb, altFlag) => {\n // graphItemCount = 0;\n log.trace('items', doc);\n doc.forEach((item) => {\n switch (item.stmt) {\n case STMT_STATE:\n setupNode(g, parentParsedItem, item, diagramStates, diagramDb, altFlag);\n break;\n case DEFAULT_STATE_TYPE:\n setupNode(g, parentParsedItem, item, diagramStates, diagramDb, altFlag);\n break;\n case STMT_RELATION:\n {\n setupNode(g, parentParsedItem, item.state1, diagramStates, diagramDb, altFlag);\n setupNode(g, parentParsedItem, item.state2, diagramStates, diagramDb, altFlag);\n const edgeData = {\n id: 'edge' + graphItemCount,\n arrowhead: 'normal',\n arrowTypeEnd: 'arrow_barb',\n style: G_EDGE_STYLE,\n labelStyle: '',\n label: common.sanitizeText(item.description, getConfig()),\n arrowheadStyle: G_EDGE_ARROWHEADSTYLE,\n labelpos: G_EDGE_LABELPOS,\n labelType: G_EDGE_LABELTYPE,\n thickness: G_EDGE_THICKNESS,\n classes: CSS_EDGE,\n };\n g.setEdge(item.state1.id, item.state2.id, edgeData, graphItemCount);\n graphItemCount++;\n }\n break;\n }\n });\n};\n\n/**\n * Get the direction from the statement items.\n * Look through all of the documents (docs) in the parsedItems\n * Because is a _document_ direction, the default direction is not necessarily the same as the overall default _diagram_ direction.\n * @param {object[]} parsedItem - the parsed statement item to look through\n * @param [defaultDir=DEFAULT_NESTED_DOC_DIR] - the direction to use if none is found\n * @returns {string}\n */\nconst getDir = (parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {\n let dir = defaultDir;\n if (parsedItem.doc) {\n for (let i = 0; i < parsedItem.doc.length; i++) {\n const parsedItemDoc = parsedItem.doc[i];\n if (parsedItemDoc.stmt === 'dir') {\n dir = parsedItemDoc.value;\n }\n }\n }\n return dir;\n};\n\n/**\n * Draws a state diagram in the tag with id: id based on the graph definition in text.\n *\n * @param {any} text\n * @param {any} id\n * @param _version\n * @param diag\n */\nexport const draw = function (text, id, _version, diag) {\n log.info('Drawing state diagram (v2)', id);\n // diag.sb.clear();\n nodeDb = {};\n // Fetch the default direction, use TD if none was found\n let dir = diag.db.getDirection();\n if (dir === undefined) {\n dir = DEFAULT_DIAGRAM_DIRECTION;\n }\n\n const { securityLevel, state: conf } = getConfig();\n const nodeSpacing = conf.nodeSpacing || 50;\n const rankSpacing = conf.rankSpacing || 50;\n\n log.info(diag.db.getRootDocV2());\n\n // This parses the diagram text and sets the classes, relations, styles, classDefs, etc.\n diag.db.extract(diag.db.getRootDocV2());\n log.info(diag.db.getRootDocV2());\n\n const diagramStates = diag.db.getStates();\n\n // Create the input mermaid.graph\n const g = new graphlib.Graph({\n multigraph: true,\n compound: true,\n })\n .setGraph({\n rankdir: getDir(diag.db.getRootDocV2()),\n nodesep: nodeSpacing,\n ranksep: rankSpacing,\n marginx: 8,\n marginy: 8,\n })\n .setDefaultEdgeLabel(function () {\n return {};\n });\n\n setupNode(g, undefined, diag.db.getRootDocV2(), diagramStates, diag.db, true);\n\n // Set up an SVG group so that we can translate the final graph.\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 svg = root.select(`[id=\"${id}\"]`);\n\n // Run the renderer. This is what draws the final graph.\n\n const element = root.select('#' + id + ' g');\n render(element, g, ['barb'], CSS_DIAGRAM, id);\n\n const padding = 8;\n\n utils.insertTitle(svg, 'statediagramTitleText', conf.titleTopMargin, diag.db.getDiagramTitle());\n\n const bounds = svg.node().getBBox();\n const width = bounds.width + padding * 2;\n const height = bounds.height + padding * 2;\n\n // Zoom in a bit\n svg.attr('class', CSS_DIAGRAM);\n\n const svgBounds = svg.node().getBBox();\n\n configureSvgSize(svg, height, width, conf.useMaxWidth);\n\n // Ensure the viewBox includes the whole svgBounds area with extra space for padding\n const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`;\n log.debug(`viewBox ${vBox}`);\n svg.attr('viewBox', vBox);\n\n // Add label rects for non html labels\n // if (!evaluate(conf.htmlLabels) || true) {\n const labels = document.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 = document.createElementNS('http://www.w3.org/2000/svg', SHAPE_STATE);\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\nexport default {\n setConf,\n getClasses,\n draw,\n};\n","import { DiagramDefinition } from '../../diagram-api/types';\n// @ts-ignore: TODO Fix ts errors\nimport parser from './parser/stateDiagram';\nimport db from './stateDb';\nimport styles from './styles';\nimport renderer from './stateRenderer-v2';\n\nexport const diagram: DiagramDefinition = {\n parser,\n db,\n renderer,\n styles,\n init: (cnf) => {\n if (!cnf.state) {\n cnf.state = {};\n }\n cnf.state.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;\n db.clear();\n },\n};\n"],"names":["SHAPE_STATE","SHAPE_STATE_WITH_DESC","SHAPE_START","SHAPE_END","SHAPE_DIVIDER","SHAPE_GROUP","SHAPE_NOTE","SHAPE_NOTEGROUP","CSS_DIAGRAM","CSS_STATE","CSS_DIAGRAM_STATE","CSS_EDGE","CSS_NOTE","CSS_NOTE_EDGE","CSS_EDGE_NOTE_EDGE","CSS_DIAGRAM_NOTE","CSS_CLUSTER","CSS_DIAGRAM_CLUSTER","CSS_CLUSTER_ALT","CSS_DIAGRAM_CLUSTER_ALT","PARENT","NOTE","DOMID_STATE","DOMID_TYPE_SPACER","NOTE_ID","PARENT_ID","G_EDGE_STYLE","G_EDGE_ARROWHEADSTYLE","G_EDGE_LABELPOS","G_EDGE_LABELTYPE","G_EDGE_THICKNESS","nodeDb","graphItemCount","setConf","cnf","keys","key","getClasses","text","diagramObj","log","e","getClassesFromDbInfo","dbInfoItem","stateDomId","itemId","counter","type","typeSpacer","typeStr","setupNode","g","parent","parsedItem","diagramStates","diagramDb","altFlag","classStr","shape","DEFAULT_STATE_TYPE","common","getConfig","newNode","getDir","DIVIDER_TYPE","nodeData","noteData","groupData","parentNodeId","from","to","setupDoc","parentParsedItem","doc","item","STMT_STATE","STMT_RELATION","edgeData","defaultDir","DEFAULT_NESTED_DOC_DIR","dir","i","parsedItemDoc","draw","id","_version","diag","DEFAULT_DIAGRAM_DIRECTION","securityLevel","conf","nodeSpacing","rankSpacing","graphlib.Graph","sandboxElement","select","root","svg","element","render","padding","utils","bounds","width","height","svgBounds","configureSvgSize","vBox","labels","label","dim","rect","renderer","diagram","parser","db","styles"],"mappings":";;;;;;;;;;;;;;AAoBA,MAAMA,IAAc,QAC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