8 lines
42 KiB
Plaintext
8 lines
42 KiB
Plaintext
|
|
{
|
||
|
|
"version": 3,
|
||
|
|
"sources": ["../../../../../node_modules/.pnpm/dagre-d3-es@7.0.11/node_modules/dagre-d3-es/src/graphlib/json.js", "../../../src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js", "../../../src/rendering-util/layout-algorithms/dagre/index.js"],
|
||
|
|
"sourcesContent": ["import * as _ from 'lodash-es';\nimport { Graph } from './graph.js';\n\nexport { write, read };\n\nfunction write(g) {\n var json = {\n options: {\n directed: g.isDirected(),\n multigraph: g.isMultigraph(),\n compound: g.isCompound(),\n },\n nodes: writeNodes(g),\n edges: writeEdges(g),\n };\n if (!_.isUndefined(g.graph())) {\n json.value = _.clone(g.graph());\n }\n return json;\n}\n\nfunction writeNodes(g) {\n return _.map(g.nodes(), function (v) {\n var nodeValue = g.node(v);\n var parent = g.parent(v);\n var node = { v: v };\n if (!_.isUndefined(nodeValue)) {\n node.value = nodeValue;\n }\n if (!_.isUndefined(parent)) {\n node.parent = parent;\n }\n return node;\n });\n}\n\nfunction writeEdges(g) {\n return _.map(g.edges(), function (e) {\n var edgeValue = g.edge(e);\n var edge = { v: e.v, w: e.w };\n if (!_.isUndefined(e.name)) {\n edge.name = e.name;\n }\n if (!_.isUndefined(edgeValue)) {\n edge.value = edgeValue;\n }\n return edge;\n });\n}\n\nfunction read(json) {\n var g = new Graph(json.options).setGraph(json.value);\n _.each(json.nodes, function (entry) {\n g.setNode(entry.v, entry.value);\n if (entry.parent) {\n g.setParent(entry.v, entry.parent);\n }\n });\n _.each(json.edges, function (entry) {\n g.setEdge({ v: entry.v, w: entry.w, name: entry.name }, entry.value);\n });\n return g;\n}\n", "/** Decorates with functions required by mermaids dagre-wrapper. */\nimport { log } from '../../../logger.js';\nimport * as graphlib from 'dagre-d3-es/src/graphlib/index.js';\nimport * as graphlibJson from 'dagre-d3-es/src/graphlib/json.js';\n\nexport let clusterDb = new Map();\nlet descendants = new Map();\nlet parents = new Map();\n\nexport const clear = () => {\n descendants.clear();\n parents.clear();\n clusterDb.clear();\n};\n\nconst isDescendant = (id, ancestorId) => {\n const ancestorDescendants = descendants.get(ancestorId) || [];\n log.trace('In isDescendant', ancestorId, ' ', id, ' = ', ancestorDescendants.includes(id));\n return ancestorDescendants.includes(id);\n};\n\nconst edgeInCluster = (edge, clusterId) => {\n const clusterDescendants = descendants.get(clusterId) || [];\n log.info('Descendants of ', clusterId, ' is ', clusterDescendants);\n log.info('Edge is ', edge);\n if (edge.v === clusterId || edge.w === clusterId) {\n return false;\n }\n\n if (!clusterDescendants) {\n log.debug('Tilt, ', clusterId, ',not in descendants');\n return false;\n }\n\n return (\n clusterDescendants.includes(edge.v) ||\n isDescendant(edge.v, clusterId) ||\n isDescendant(edge.w, clusterId) ||\n clusterDescendants.includes(edge.w)\n );\n};\n\nconst copy = (clusterId, graph, newGraph, rootId) => {\n log.warn(\n 'Copying children of ',\n clusterId,\n 'root',\n rootId,\n 'data',\n graph.node(clusterId),\n rootId\n );\n const nodes = graph.children(clusterId) || [];\n\n if (clusterId !== rootId) {\n nodes.push(clusterId);\n }\n\n log.warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes);\n\n nodes.forEach((node) => {\n if (graph.children(node).length > 0) {\n copy(node, graph, newGraph, rootId);\n } else {\n const data = graph.node(node);\n log.info('cp ', node, ' to ', rootId, ' with parent ', clusterId);\n newGraph.setNode(node, data);\n if (rootId !== graph.parent(node)) {\n log.warn('Setting parent', node, graph.parent(node));\n newGraph.setParent(node, graph.parent(node));\n }\n\n if (clusterId !== rootId && node !== clusterId) {\n log.debug('Setting parent', node, clusterId);\n newGraph.setParent(node, clusterId);\n } else {\n log.info('In copy ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);\n log.debug(\n 'Not Setting parent for node=',\n node,\n 'cluster!==rootId',\n clusterId !== rootId,\n 'node!==clusterId',\n node !== clusterId\n );\
|
||
|
|
"mappings": "gpBAKA,SAASA,EAAMC,EAAG,CAChB,I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AVkC,sBA4BlC,IAAME,GAAkBC,EAAA,CAACC,EAAOC,EAAKC,IAAQ,CAC3C,IAAMC,EAASH,EAAM,MAAM,EAAE,OAAQI,GAASA,EAAK,IAAMH,GAAOG,EAAK,IAAMH,CAAG,EACxEI,EAASL,EAAM,MAAM,EAAE,OAAQI,GAASA,EAAK,IAAMF,GAAOE,EAAK,IAAMF,CAAG,EACxEI,EAAaH,EAAO,IAAKC,IACtB,CAAE,EAAGA,EAAK,IAAMH,EAAMC,EAAME,EAAK,EAAG,EAAGA,EAAK,IAAMH,EAAMA,EAAMG,EAAK,CAAE,EAC7E,EACKG,EAAaF,EAAO,IAAKD,IACtB,CAAE,EAAGA,EAAK,EAAG,EAAGA,EAAK,CAAE,EAC/B,EAKD,OAJeE,EAAW,OAAQE,GACzBD,EAAW,KAAMH,GAASI,EAAQ,IAAMJ,EAAK,GAAKI,EAAQ,IAAMJ,EAAK,CAAC,CAC9E,CAGH,EAdwB,mBAgBXK,EAAsBV,EAAA,CAACW,EAAIV,EAAOW,IAAc,CAC3D,IAAMC,EAAWZ,EAAM,SAASU,CAAE,EAElC,GADAG,EAAI,MAAM,4BAA6BH,EAAIE,CAAQ,EAC/CA,EAAS,OAAS,EACpB,OAAOF,EAET,IAAII,EACJ,QAAWC,KAASH,EAAU,CAC5B,IAAMI,EAAMP,EAAoBM,EAAOf,EAAOW,CAAS,EAEjDM,EAAcnB,GAAgBE,EAAOW,EAAWK,CAAG,EAEzD,GAAIA,EACF,GAAIC,EAAY,OAAS,EACvBH,EAAUE,MAEV,QAAOA,CAGb,CACA,OAAOF,CACT,EArBmC,uBAuB7BI,EAAcnB,EAACW,GACf,CAA
|
||
|
|
"names": ["write", "g", "json", "writeNodes", "writeEdges", "isUndefined_default", "clone_default", "__name", "map_default", "v", "nodeValue", "parent", "node", "e", "edgeValue", "edge", "clusterDb", "descendants", "parents", "clear", "__name", "isDescendant", "id", "ancestorId", "ancestorDescendants", "log", "edgeInCluster", "edge", "clusterId", "clusterDescendants", "copy", "graph", "newGraph", "rootId", "nodes", "node", "data", "edges", "e", "extractDescendants", "children", "res", "child", "findCommonEdges", "__name", "graph", "id1", "id2", "edges1", "edge", "edges2", "edges1Prim", "edges2Prim", "edgeIn1", "findNonClusterChild", "id", "clusterId", "children", "log", "reserve", "child", "_id", "commonEdges", "getAnchorId", "clusterDb", "adjustClustersAndEdges", "depth", "descendants", "extractDescendants", "edges", "d1", "isDescendant", "d2", "nonClusterChild", "parent", "e", "v", "w", "write", "extractor", "nodes", "hasChildren", "node", "dir", "clusterGraph", "Graph", "copy", "data", "sorter", "result", "sorted", "sortNodesByHierarchy", "recursiveRender", "__name", "_elem", "graph", "diagramType", "id", "parentCluster", "siteConfig", "log", "write", "dir", "elem", "clusters", "edgePaths", "edgeLabels", "nodes", "v", "node", "data", "ranksep", "nodesep", "o", "newEl", "updateNodeBounds", "setNodeElem", "findNonClusterChild", "clusterDb", "insertNode", "edgePromises", "e", "edge", "insertEdgeLabel", "layout", "diff", "subGraphTitleTotalMargin", "getSubGraphTitleMargins", "sortNodesByHierarchy", "positionNode", "halfPadding", "labelHeight", "offsetY", "insertCluster", "parent", "point", "startNode", "endNode", "paths", "insertEdge", "positionEdgeLabel", "n", "render", "data4Layout", "svg", "Graph", "element", "markers_default", "clear", "nodeId", "specialId1", "specialId2", "edge1", "edgeMid", "edge2", "adjustClustersAndEdges", "getConfig"]
|
||
|
|
}
|