@diagrampilot/export-mermaid 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,2BAA2B,iCAAiC,CAAC;AA8C1E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CA4BpE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,oBAAoB,CAAC;AAE5B,eAAO,MAAM,2BAA2B,iCAAiC,CAAC;AA0D1E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAiBpE"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createDiagramSpecTopology, walkDiagramSpecTopology, } from "@diagrampilot/core";
1
+ import { createDiagramSpecTopology, formatDiagramSpecTopologyLines, } from "@diagrampilot/core";
2
2
  export const EXPORT_MERMAID_PACKAGE_NAME = "@diagrampilot/export-mermaid";
3
3
  const mermaidDirections = {
4
4
  right: "LR",
@@ -34,24 +34,24 @@ function edgeDefinition(edge) {
34
34
  }
35
35
  return `${edge.from} ${connector}|${escapeMermaidEdgeLabel(edge.label)}| ${edge.to}`;
36
36
  }
37
+ function mermaidNodeLine(node, depth) {
38
+ return `${indent(depth)}${nodeDefinition(node)}`;
39
+ }
40
+ function mermaidGroupStart(group, depth) {
41
+ return [`${indent(depth)}${groupDefinition(group)}`];
42
+ }
43
+ function mermaidGroupEnd(_group, depth) {
44
+ return `${indent(depth)}end`;
45
+ }
37
46
  export function exportDiagramSpecToMermaid(spec) {
38
47
  const lines = [`flowchart ${mermaidDirection(spec.direction)}`];
39
48
  const topology = createDiagramSpecTopology(spec);
40
- function emitNode(node, depth) {
41
- lines.push(`${indent(depth)}${nodeDefinition(node)}`);
42
- }
43
- function enterGroup(group, depth) {
44
- lines.push(`${indent(depth)}${groupDefinition(group)}`);
45
- }
46
- function exitGroup(_group, depth) {
47
- lines.push(`${indent(depth)}end`);
48
- }
49
- walkDiagramSpecTopology(topology, {
49
+ lines.push(...formatDiagramSpecTopologyLines(topology, {
50
50
  rootDepth: 1,
51
- node: emitNode,
52
- enterGroup,
53
- exitGroup,
54
- });
51
+ node: mermaidNodeLine,
52
+ enterGroup: mermaidGroupStart,
53
+ exitGroup: mermaidGroupEnd,
54
+ }));
55
55
  for (const edge of spec.edges ?? []) {
56
56
  lines.push(`${indent(1)}${edgeDefinition(edge)}`);
57
57
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAS5B,MAAM,CAAC,MAAM,2BAA2B,GAAG,8BAA8B,CAAC;AAE1E,MAAM,iBAAiB,GAAyC;IAC9D,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,EAAE,EAAE,IAAI;CACT,CAAC;AAEF,SAAS,gBAAgB,CAAC,SAA2C;IACnE,OAAO,iBAAiB,CAAC,SAAS,IAAI,OAAO,CAAC,CAAC;AACjD,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAa;IAC5C,OAAO,KAAK;SACT,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAa;IAC3C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,OAA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CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,eAAe,CAAC,MAAwB,EAAE,KAAa;IAC9D,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,IAAiB;IAC1D,MAAM,KAAK,GAAG,CAAC,aAAa,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;IACjD,KAAK,CAAC,IAAI,CACR,GAAG,8BAA8B,CAAC,QAAQ,EAAE;QAC1C,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,eAAe;QACrB,UAAU,EAAE,iBAAiB;QAC7B,SAAS,EAAE,eAAe;KAC3B,CAAC,CACH,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagrampilot/export-mermaid",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Mermaid export adapter for DiagramPilot.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,6 +43,6 @@
43
43
  "build": "tsc -b"
44
44
  },
45
45
  "dependencies": {
46
- "@diagrampilot/core": "0.2.11"
46
+ "@diagrampilot/core": "0.2.12"
47
47
  }
48
48
  }