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

1 line
24 KiB
Plaintext
Raw Normal View History

{"version":3,"file":"stateDiagram-v2-78805701.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