@thi.ng/dot 2.1.76 → 2.1.77

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-05-08T18:24:31Z
3
+ - **Last updated**: 2024-06-21T19:34:38Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [2.1.77](https://github.com/thi-ng/umbrella/tree/@thi.ng/dot@2.1.77) (2024-06-21)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
17
+
12
18
  ### [2.1.69](https://github.com/thi-ng/umbrella/tree/@thi.ng/dot@2.1.69) (2024-03-18)
13
19
 
14
20
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 192 standalone projects, maintained as part
10
+ > This is one of 193 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/dot",
3
- "version": "2.1.76",
3
+ "version": "2.1.77",
4
4
  "description": "Graphviz document abstraction & serialization to DOT format",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
12
12
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/dot#readme",
13
+ "homepage": "https://thi.ng/dot",
14
14
  "funding": [
15
15
  {
16
16
  "type": "github",
@@ -36,14 +36,14 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.11.2",
40
- "@thi.ng/checks": "^3.6.4"
39
+ "@thi.ng/api": "^8.11.3",
40
+ "@thi.ng/checks": "^3.6.5"
41
41
  },
42
42
  "devDependencies": {
43
- "@microsoft/api-extractor": "^7.43.2",
44
- "esbuild": "^0.21.1",
43
+ "@microsoft/api-extractor": "^7.47.0",
44
+ "esbuild": "^0.21.5",
45
45
  "typedoc": "^0.25.13",
46
- "typescript": "^5.4.5"
46
+ "typescript": "^5.5.2"
47
47
  },
48
48
  "keywords": [
49
49
  "2d",
@@ -84,5 +84,5 @@
84
84
  "status": "beta",
85
85
  "year": 2018
86
86
  },
87
- "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
87
+ "gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
88
88
  }
package/serialize.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { isArray } from "@thi.ng/checks/is-array";
2
- let nextID = 0;
3
- const nextSubgraphID = () => "cluster" + nextID++;
4
- const wrapQ = (x) => `"${x}"`;
5
- const escape = (x) => String(x).replace(/"/g, `\\"`).replace(/\n/g, "\\n");
6
- const formatGraphAttribs = (attribs, acc) => {
2
+ let __nextID = 0;
3
+ const __nextSubgraphID = () => "cluster" + __nextID++;
4
+ const __wrapQ = (x) => `"${x}"`;
5
+ const __escape = (x) => String(x).replace(/"/g, `\\"`).replace(/\n/g, "\\n");
6
+ const __formatGraphAttribs = (attribs, acc) => {
7
7
  for (let a in attribs) {
8
8
  let v = attribs[a];
9
9
  switch (a) {
@@ -14,19 +14,19 @@ const formatGraphAttribs = (attribs, acc) => {
14
14
  isArray(v) && (v = v.join(","));
15
15
  break;
16
16
  case "edge":
17
- acc.push(`edge[${formatAttribs(v)}];`);
17
+ acc.push(`edge[${__formatAttribs(v)}];`);
18
18
  continue;
19
19
  case "node":
20
- acc.push(`node[${formatAttribs(v)}];`);
20
+ acc.push(`node[${__formatAttribs(v)}];`);
21
21
  continue;
22
22
  default:
23
23
  break;
24
24
  }
25
- acc.push(`${a}="${escape(v)}";`);
25
+ acc.push(`${a}="${__escape(v)}";`);
26
26
  }
27
27
  return acc;
28
28
  };
29
- const formatAttribs = (attribs) => {
29
+ const __formatAttribs = (attribs) => {
30
30
  const acc = [];
31
31
  for (let a in attribs) {
32
32
  let v = attribs[a];
@@ -38,7 +38,7 @@ const formatAttribs = (attribs) => {
38
38
  break;
39
39
  case "label":
40
40
  if (attribs.ins || attribs.outs) {
41
- v = formatPortLabel(attribs, v);
41
+ v = __formatPortLabel(attribs, v);
42
42
  }
43
43
  break;
44
44
  case "url":
@@ -53,47 +53,47 @@ const formatAttribs = (attribs) => {
53
53
  continue;
54
54
  default:
55
55
  }
56
- acc.push(`${a}="${escape(v)}"`);
56
+ acc.push(`${a}="${__escape(v)}"`);
57
57
  }
58
58
  return acc.join(", ");
59
59
  };
60
- const formatPorts = (ports) => {
60
+ const __formatPorts = (ports) => {
61
61
  const acc = [];
62
62
  for (let i in ports) {
63
- acc.push(`<${i}> ${escape(ports[i])}`);
63
+ acc.push(`<${i}> ${__escape(ports[i])}`);
64
64
  }
65
65
  return `{ ${acc.join(" | ")} }`;
66
66
  };
67
- const formatPortLabel = (node, label) => {
67
+ const __formatPortLabel = (node, label) => {
68
68
  const acc = [];
69
- node.ins && acc.push(formatPorts(node.ins));
70
- acc.push(escape(label));
71
- node.outs && acc.push(formatPorts(node.outs));
69
+ node.ins && acc.push(__formatPorts(node.ins));
70
+ acc.push(__escape(label));
71
+ node.outs && acc.push(__formatPorts(node.outs));
72
72
  return acc.join(" | ");
73
73
  };
74
74
  const serializeNode = (id, n) => {
75
- const attribs = formatAttribs(n);
75
+ const attribs = __formatAttribs(n);
76
76
  return attribs.length ? `"${id}"[${attribs}];` : `"${id}";`;
77
77
  };
78
78
  const serializeEdge = (e, directed = true) => {
79
- const acc = [wrapQ(e.src)];
80
- e.srcPort != null && acc.push(":", wrapQ(e.srcPort));
79
+ const acc = [__wrapQ(e.src)];
80
+ e.srcPort != null && acc.push(":", __wrapQ(e.srcPort));
81
81
  acc.push(directed ? " -> " : " -- ");
82
- acc.push(wrapQ(e.dest));
83
- e.destPort != null && acc.push(":", wrapQ(e.destPort));
84
- const attribs = formatAttribs(e);
82
+ acc.push(__wrapQ(e.dest));
83
+ e.destPort != null && acc.push(":", __wrapQ(e.destPort));
84
+ const attribs = __formatAttribs(e);
85
85
  attribs.length && acc.push("[", attribs, "]");
86
86
  acc.push(";");
87
87
  return acc.join("");
88
88
  };
89
89
  const serializeGraph = (graph, isSub = false) => {
90
90
  const directed = graph.directed !== false;
91
- const acc = isSub ? [`subgraph ${graph.id || nextSubgraphID()} {`] : [`${directed ? "di" : ""}graph ${graph.id || "g"} {`];
91
+ const acc = isSub ? [`subgraph ${graph.id || __nextSubgraphID()} {`] : [`${directed ? "di" : ""}graph ${graph.id || "g"} {`];
92
92
  if (graph.include) {
93
93
  acc.push(graph.include);
94
94
  }
95
95
  if (graph.attribs) {
96
- formatGraphAttribs(graph.attribs, acc);
96
+ __formatGraphAttribs(graph.attribs, acc);
97
97
  }
98
98
  for (let id in graph.nodes) {
99
99
  acc.push(serializeNode(id, graph.nodes[id]));