ts-graphviz 1.8.2 → 2.0.0
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 +307 -0
- package/README.md +40 -13
- package/lib/adapter.cjs +1 -0
- package/lib/adapter.d.ts +1 -0
- package/lib/adapter.js +1 -0
- package/lib/ast.cjs +1 -0
- package/lib/ast.d.ts +1 -0
- package/lib/ast.js +1 -0
- package/lib/attribute.d.ts +2 -0
- package/lib/from-dot.d.ts +10 -0
- package/lib/model-factory-builder.d.ts +7 -0
- package/lib/model-factory.d.ts +6 -0
- package/lib/to-dot.d.ts +7 -0
- package/lib/ts-graphviz.cjs +1 -0
- package/lib/ts-graphviz.d.ts +7 -0
- package/lib/ts-graphviz.js +55 -0
- package/lib/types.d.ts +14 -0
- package/package.json +53 -96
- package/SECURITY.md +0 -5
- package/lib/adapter/browser/index.cjs +0 -12
- package/lib/adapter/browser/index.d.ts +0 -15
- package/lib/adapter/browser/index.js +0 -9
- package/lib/adapter/deno/mod.d.ts +0 -13
- package/lib/adapter/deno/mod.js +0 -36
- package/lib/adapter/node/index.cjs +0 -45
- package/lib/adapter/node/index.d.ts +0 -15
- package/lib/adapter/node/index.js +0 -42
- package/lib/adapter/types/index.cjs +0 -1
- package/lib/adapter/types/index.d.ts +0 -134
- package/lib/adapter/types/index.js +0 -0
- package/lib/adapter/utils/index.cjs +0 -58
- package/lib/adapter/utils/index.d.ts +0 -11
- package/lib/adapter/utils/index.js +0 -56
- package/lib/ast/index.cjs +0 -5775
- package/lib/ast/index.d.ts +0 -946
- package/lib/ast/index.js +0 -5770
- package/lib/common/index.cjs +0 -58
- package/lib/common/index.d.ts +0 -4981
- package/lib/common/index.js +0 -58
- package/lib/core/index.cjs +0 -359
- package/lib/core/index.d.ts +0 -347
- package/lib/core/index.js +0 -364
- package/lib/index.cjs +0 -23
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -2
- package/lib/utils/index.cjs +0 -41
- package/lib/utils/index.d.ts +0 -34
- package/lib/utils/index.js +0 -37
package/lib/common/index.cjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function isForwardRefNode(object) {
|
|
4
|
-
return typeof object === 'object' && object !== null && typeof object.id === 'string';
|
|
5
|
-
}
|
|
6
|
-
function isNodeModel(object) {
|
|
7
|
-
return typeof object === 'object' && object !== null && object.$$type === 'Node' && typeof object.id === 'string';
|
|
8
|
-
}
|
|
9
|
-
function isNodeRef(node) {
|
|
10
|
-
return isNodeModel(node) || isForwardRefNode(node);
|
|
11
|
-
}
|
|
12
|
-
function isNodeRefLike(node) {
|
|
13
|
-
return typeof node === 'string' || isNodeRef(node);
|
|
14
|
-
}
|
|
15
|
-
function isNodeRefGroupLike(target) {
|
|
16
|
-
return Array.isArray(target) && target.every(isNodeRefLike);
|
|
17
|
-
}
|
|
18
|
-
function isCompass(c) {
|
|
19
|
-
return ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'c'].includes(c);
|
|
20
|
-
}
|
|
21
|
-
function toNodeRef(target) {
|
|
22
|
-
if (isNodeRef(target)) {
|
|
23
|
-
return target;
|
|
24
|
-
}
|
|
25
|
-
const [id, port, compass] = target.split(':');
|
|
26
|
-
if (isCompass(compass)) {
|
|
27
|
-
return { id, port, compass };
|
|
28
|
-
}
|
|
29
|
-
return { id, port };
|
|
30
|
-
}
|
|
31
|
-
function toNodeRefGroup(targets) {
|
|
32
|
-
if (targets.length < 2 && (isNodeRefLike(targets[0]) && isNodeRefLike(targets[1])) === false) {
|
|
33
|
-
throw Error('EdgeTargets must have at least 2 elements.');
|
|
34
|
-
}
|
|
35
|
-
return targets.map((t) => toNodeRef(t));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const RootModelsContext = Object.seal({
|
|
39
|
-
Graph: null,
|
|
40
|
-
Digraph: null,
|
|
41
|
-
Subgraph: null,
|
|
42
|
-
Node: null,
|
|
43
|
-
Edge: null,
|
|
44
|
-
});
|
|
45
|
-
function createModelsContext(models) {
|
|
46
|
-
return Object.assign(Object.seal(Object.assign({}, RootModelsContext)), models);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
exports.RootModelsContext = RootModelsContext;
|
|
50
|
-
exports.createModelsContext = createModelsContext;
|
|
51
|
-
exports.isCompass = isCompass;
|
|
52
|
-
exports.isForwardRefNode = isForwardRefNode;
|
|
53
|
-
exports.isNodeModel = isNodeModel;
|
|
54
|
-
exports.isNodeRef = isNodeRef;
|
|
55
|
-
exports.isNodeRefGroupLike = isNodeRefGroupLike;
|
|
56
|
-
exports.isNodeRefLike = isNodeRefLike;
|
|
57
|
-
exports.toNodeRef = toNodeRef;
|
|
58
|
-
exports.toNodeRefGroup = toNodeRefGroup;
|