ts-graphviz
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -7,2 +7,3 @@ import { DotBase } from '../common'; | ||
export declare class Attributes extends DotBase { | ||
comment?: string; | ||
protected attrs: Map<string, Literal>; | ||
@@ -9,0 +10,0 @@ get size(): number; |
@@ -58,10 +58,8 @@ "use strict"; | ||
} | ||
return __spreadArrays([ | ||
'[' | ||
], Array.from(this.attrs.entries()).map(function (_a) { | ||
var comment = this.comment ? dot_rendering_1.indent(dot_rendering_1.commentOut(this.comment)) : undefined; | ||
return dot_rendering_1.joinLines.apply(void 0, __spreadArrays(['[', | ||
comment], Array.from(this.attrs.entries()).map(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
return dot_rendering_1.indent(key + " = " + value.toDot() + ","); | ||
}), [ | ||
']', | ||
]).join('\n'); | ||
}), [']'])); | ||
}; | ||
@@ -68,0 +66,0 @@ return Attributes; |
@@ -20,2 +20,3 @@ import { DotBase } from '../../common'; | ||
export declare abstract class Cluster extends DotBase { | ||
comment?: string; | ||
get id(): string | undefined; | ||
@@ -22,0 +23,0 @@ set id(idValue: string | undefined); |
@@ -163,2 +163,3 @@ "use strict"; | ||
var _a; | ||
var comment = this.comment ? dot_rendering_1.commentOut(this.comment) : undefined; | ||
var type = this.type; | ||
@@ -181,4 +182,4 @@ var id = (_a = this.idLiteral) === null || _a === void 0 ? void 0 : _a.toDot(); | ||
var clusterContents = dot_rendering_1.joinLines.apply(void 0, __spreadArrays(commonAttributes, nodes, subgraphs, edges)); | ||
var src = dot_rendering_1.joinLines(dot_rendering_1.concatWords(type, id, '{'), clusterContents ? dot_rendering_1.indent(clusterContents) : undefined, '}'); | ||
return src; | ||
var dot = dot_rendering_1.joinLines(comment, dot_rendering_1.concatWords(type, id, '{'), clusterContents ? dot_rendering_1.indent(clusterContents) : undefined, '}'); | ||
return dot; | ||
}; | ||
@@ -185,0 +186,0 @@ Cluster.prototype.toNodeLikeObject = function (node) { |
@@ -10,2 +10,3 @@ import { DotBase } from '../common'; | ||
private context; | ||
comment?: string; | ||
readonly attributes: Attributes; | ||
@@ -12,0 +13,0 @@ readonly targets: IEdgeTarget[]; |
@@ -24,2 +24,3 @@ "use strict"; | ||
var common_1 = require("../common"); | ||
var dot_rendering_1 = require("../utils/dot-rendering"); | ||
var Attributes_1 = require("./Attributes"); | ||
@@ -44,7 +45,8 @@ var Node_1 = require("./Node"); | ||
Edge.prototype.toDot = function () { | ||
var comment = this.comment ? dot_rendering_1.commentOut(this.comment) : undefined; | ||
var arrow = this.context.graphType === 'digraph' ? '->' : '--'; | ||
var target = this.targets.map(function (n) { return n.toEdgeTargetDot(); }).join(" " + arrow + " "); | ||
var attrs = this.attributes.size > 0 ? " " + this.attributes.toDot() : ''; | ||
var src = "" + target + attrs + ";"; | ||
return src; | ||
var dot = "" + target + attrs + ";"; | ||
return dot_rendering_1.joinLines(comment, dot); | ||
}; | ||
@@ -51,0 +53,0 @@ return Edge; |
@@ -39,3 +39,3 @@ "use strict"; | ||
else { | ||
_this.isQuoteRequired = /[#\s"]/g.test(stringValue); | ||
_this.isQuoteRequired = /[#\s":;=\-']/g.test(stringValue); | ||
} | ||
@@ -42,0 +42,0 @@ } |
@@ -10,2 +10,3 @@ import { DotBase } from '../common'; | ||
readonly id: string; | ||
comment?: string; | ||
readonly idLiteral: Literal; | ||
@@ -12,0 +13,0 @@ readonly attributes: Attributes; |
@@ -17,2 +17,3 @@ "use strict"; | ||
var common_1 = require("../common"); | ||
var dot_rendering_1 = require("../utils/dot-rendering"); | ||
var Attributes_1 = require("./Attributes"); | ||
@@ -33,5 +34,7 @@ var Literal_1 = require("./Literal"); | ||
Node.prototype.toDot = function () { | ||
var comment = this.comment ? dot_rendering_1.commentOut(this.comment) : undefined; | ||
var target = this.idLiteral.toDot(); | ||
var attrs = this.attributes.size > 0 ? " " + this.attributes.toDot() : ''; | ||
return "" + target + attrs + ";"; | ||
var dot = "" + target + attrs + ";"; | ||
return dot_rendering_1.joinLines(comment, dot); | ||
}; | ||
@@ -38,0 +41,0 @@ Node.prototype.toEdgeTargetDot = function () { |
@@ -21,1 +21,5 @@ /** | ||
export declare function indent(src: string, depth?: number): string; | ||
/** | ||
* @hidden | ||
*/ | ||
export declare function commentOut(src: string): string; |
@@ -51,1 +51,11 @@ "use strict"; | ||
exports.indent = indent; | ||
/** | ||
* @hidden | ||
*/ | ||
function commentOut(src) { | ||
return src | ||
.split('\n') | ||
.map(function (l) { return ("// " + l).trim(); }) | ||
.join('\n'); | ||
} | ||
exports.commentOut = commentOut; |
{ | ||
"name": "ts-graphviz", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"author": "kamiazya <yuki@kamiazya.tech>", | ||
@@ -5,0 +5,0 @@ "description": "Graphviz library for TypeScript.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
36289
943
0