ts-graphviz
Advanced tools
Comparing version 0.13.1 to 0.13.2
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).graphviz={})}(this,(function(t){"use strict";var e;(e=t.attribute||(t.attribute={})).Damping="Damping",e.K="K",e.URL="URL",e._background="_background",e.area="area",e.arrowhead="arrowhead",e.arrowsize="arrowsize",e.arrowtail="arrowtail",e.bb="bb",e.bgcolor="bgcolor",e.center="center",e.charset="charset",e.clusterrank="clusterrank",e.color="color",e.colorscheme="colorscheme",e.comment="comment",e.compound="compound",e.concentrate="concentrate",e.constraint="constraint",e.decorate="decorate",e.defaultdist="defaultdist",e.dim="dim",e.dimen="dimen",e.dir="dir",e.diredgeconstraints="diredgeconstraints",e.distortion="distortion",e.dpi="dpi",e.edgeURL="edgeURL",e.edgehref="edgehref",e.edgetarget="edgetarget",e.edgetooltip="edgetooltip",e.epsilon="epsilon",e.esep="esep",e.fillcolor="fillcolor",e.fixedsize="fixedsize",e.fontcolor="fontcolor",e.fontname="fontname",e.fontnames="fontnames",e.fontpath="fontpath",e.fontsize="fontsize",e.forcelabels="forcelabels",e.gradientangle="gradientangle",e.group="group",e.headURL="headURL",e.head_lp="head_lp",e.headclip="headclip",e.headhref="headhref",e.headlabel="headlabel",e.headport="headport",e.headtarget="headtarget",e.headtooltip="headtooltip",e.height="height",e.href="href",e.id="id",e.image="image",e.imagepath="imagepath",e.imagepos="imagepos",e.imagescale="imagescale",e.inputscale="inputscale",e.label="label",e.labelURL="labelURL",e.label_scheme="label_scheme",e.labelangle="labelangle",e.labeldistance="labeldistance",e.labelfloat="labelfloat",e.labelfontcolor="labelfontcolor",e.labelfontname="labelfontname",e.labelfontsize="labelfontsize",e.labelhref="labelhref",e.labeljust="labeljust",e.labelloc="labelloc",e.labeltarget="labeltarget",e.labeltooltip="labeltooltip",e.landscape="landscape",e.layer="layer",e.layerlistsep="layerlistsep",e.layers="layers",e.layerselect="layerselect",e.layersep="layersep",e.layout="layout",e.len="len",e.levels="levels",e.levelsgap="levelsgap",e.lhead="lhead",e.lheight="lheight",e.lp="lp",e.ltail="ltail",e.lwidth="lwidth",e.margin="margin",e.maxiter="maxiter",e.mclimit="mclimit",e.mindist="mindist",e.minlen="minlen",e.mode="mode",e.model="model",e.mosek="mosek",e.newrank="newrank",e.nodesep="nodesep",e.nojustify="nojustify",e.normalize="normalize",e.notranslate="notranslate",e.nslimit="nslimit",e.nslimit1="nslimit1",e.ordering="ordering",e.orientation="orientation",e.outputorder="outputorder",e.overlap="overlap",e.overlap_scaling="overlap_scaling",e.overlap_shrink="overlap_shrink",e.pack="pack",e.packmode="packmode",e.pad="pad",e.page="page",e.pagedir="pagedir",e.pencolor="pencolor",e.penwidth="penwidth",e.peripheries="peripheries",e.pin="pin",e.pos="pos",e.quadtree="quadtree",e.quantum="quantum",e.rank="rank",e.rankdir="rankdir",e.ranksep="ranksep",e.ratio="ratio",e.rects="rects",e.regular="regular",e.remincross="remincross",e.repulsiveforce="repulsiveforce",e.resolution="resolution",e.root="root",e.rotate="rotate",e.rotation="rotation",e.samehead="samehead",e.sametail="sametail",e.samplepoints="samplepoints",e.scale="scale",e.searchsize="searchsize",e.sep="sep",e.shape="shape",e.shapefile="shapefile",e.showboxes="showboxes",e.sides="sides",e.size="size",e.skew="skew",e.smoothing="smoothing",e.sortv="sortv",e.splines="splines",e.start="start",e.style="style",e.stylesheet="stylesheet",e.tailURL="tailURL",e.tail_lp="tail_lp",e.tailclip="tailclip",e.tailhref="tailhref",e.taillabel="taillabel",e.tailport="tailport",e.tailtarget="tailtarget",e.tailtooltip="tailtooltip",e.target="target",e.tooltip="tooltip",e.truecolor="truecolor",e.vertices="vertices",e.viewport="viewport",e.voro_margin="voro_margin",e.weight="weight",e.width="width",e.xdotversion="xdotversion",e.xlabel="xlabel",e.xlp="xlp",e.z="z",function(t){t.n="n",t.ne="ne",t.e="e",t.se="se",t.s="s",t.sw="sw",t.w="w",t.nw="nw",t.c="c";var e=[t.n,t.ne,t.e,t.se,t.s,t.sw,t.w,t.nw,t.c];t.is=function(t){return e.includes(t)}}(t.Compass||(t.Compass={})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).graphviz={})}(this,(function(t){"use strict";var e;(e=t.attribute||(t.attribute={})).Damping="Damping",e.K="K",e.URL="URL",e._background="_background",e.area="area",e.arrowhead="arrowhead",e.arrowsize="arrowsize",e.arrowtail="arrowtail",e.bb="bb",e.bgcolor="bgcolor",e.center="center",e.charset="charset",e.clusterrank="clusterrank",e.color="color",e.colorscheme="colorscheme",e.comment="comment",e.compound="compound",e.concentrate="concentrate",e.constraint="constraint",e.decorate="decorate",e.defaultdist="defaultdist",e.dim="dim",e.dimen="dimen",e.dir="dir",e.diredgeconstraints="diredgeconstraints",e.distortion="distortion",e.dpi="dpi",e.edgeURL="edgeURL",e.edgehref="edgehref",e.edgetarget="edgetarget",e.edgetooltip="edgetooltip",e.epsilon="epsilon",e.esep="esep",e.fillcolor="fillcolor",e.fixedsize="fixedsize",e.fontcolor="fontcolor",e.fontname="fontname",e.fontnames="fontnames",e.fontpath="fontpath",e.fontsize="fontsize",e.forcelabels="forcelabels",e.gradientangle="gradientangle",e.group="group",e.headURL="headURL",e.head_lp="head_lp",e.headclip="headclip",e.headhref="headhref",e.headlabel="headlabel",e.headport="headport",e.headtarget="headtarget",e.headtooltip="headtooltip",e.height="height",e.href="href",e.id="id",e.image="image",e.imagepath="imagepath",e.imagepos="imagepos",e.imagescale="imagescale",e.inputscale="inputscale",e.label="label",e.labelURL="labelURL",e.label_scheme="label_scheme",e.labelangle="labelangle",e.labeldistance="labeldistance",e.labelfloat="labelfloat",e.labelfontcolor="labelfontcolor",e.labelfontname="labelfontname",e.labelfontsize="labelfontsize",e.labelhref="labelhref",e.labeljust="labeljust",e.labelloc="labelloc",e.labeltarget="labeltarget",e.labeltooltip="labeltooltip",e.landscape="landscape",e.layer="layer",e.layerlistsep="layerlistsep",e.layers="layers",e.layerselect="layerselect",e.layersep="layersep",e.layout="layout",e.len="len",e.levels="levels",e.levelsgap="levelsgap",e.lhead="lhead",e.lheight="lheight",e.lp="lp",e.ltail="ltail",e.lwidth="lwidth",e.margin="margin",e.maxiter="maxiter",e.mclimit="mclimit",e.mindist="mindist",e.minlen="minlen",e.mode="mode",e.model="model",e.mosek="mosek",e.newrank="newrank",e.nodesep="nodesep",e.nojustify="nojustify",e.normalize="normalize",e.notranslate="notranslate",e.nslimit="nslimit",e.nslimit1="nslimit1",e.ordering="ordering",e.orientation="orientation",e.outputorder="outputorder",e.overlap="overlap",e.overlap_scaling="overlap_scaling",e.overlap_shrink="overlap_shrink",e.pack="pack",e.packmode="packmode",e.pad="pad",e.page="page",e.pagedir="pagedir",e.pencolor="pencolor",e.penwidth="penwidth",e.peripheries="peripheries",e.pin="pin",e.pos="pos",e.quadtree="quadtree",e.quantum="quantum",e.rank="rank",e.rankdir="rankdir",e.ranksep="ranksep",e.ratio="ratio",e.rects="rects",e.regular="regular",e.remincross="remincross",e.repulsiveforce="repulsiveforce",e.resolution="resolution",e.root="root",e.rotate="rotate",e.rotation="rotation",e.samehead="samehead",e.sametail="sametail",e.samplepoints="samplepoints",e.scale="scale",e.searchsize="searchsize",e.sep="sep",e.shape="shape",e.shapefile="shapefile",e.showboxes="showboxes",e.sides="sides",e.size="size",e.skew="skew",e.smoothing="smoothing",e.sortv="sortv",e.splines="splines",e.start="start",e.style="style",e.stylesheet="stylesheet",e.tailURL="tailURL",e.tail_lp="tail_lp",e.tailclip="tailclip",e.tailhref="tailhref",e.taillabel="taillabel",e.tailport="tailport",e.tailtarget="tailtarget",e.tailtooltip="tailtooltip",e.target="target",e.tooltip="tooltip",e.truecolor="truecolor",e.vertices="vertices",e.viewport="viewport",e.voro_margin="voro_margin",e.weight="weight",e.width="width",e.xdotversion="xdotversion",e.xlabel="xlabel",e.xlp="xlp",e.z="z",function(t){t.n="n",t.ne="ne",t.e="e",t.se="se",t.s="s",t.sw="sw",t.w="w",t.nw="nw",t.c="c";var e=[t.n,t.ne,t.e,t.se,t.s,t.sw,t.w,t.nw,t.c];t.is=function(t){return e.includes(t)}}(t.Compass||(t.Compass={})); | ||
/*! ***************************************************************************** | ||
@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function n(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}var i=function(){},a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(i),s=function(t){function e(e){var r=t.call(this)||this;return r.attrs=new Map,void 0!==e&&r.apply(e),r}return n(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return Array.from(this.attrs.entries())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.attrs.size},enumerable:!1,configurable:!0}),e.prototype.get=function(t){return this.attrs.get(t)},e.prototype.set=function(t,e){null!=e&&this.attrs.set(t,e)},e.prototype.delete=function(t){this.attrs.delete(t)},e.prototype.apply=function(t){for(var e=0,r=Array.isArray(t)?t:Object.entries(t);e<r.length;e++){var n=r[e],o=n[0],i=n[1];this.set(o,i)}},e.prototype.clear=function(){this.attrs.clear()},e}(a),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(s),l=function(t,e){this.id=t,this.port=e},p=function(t,e){this.node=t,this.port=e},c=function(t){function e(e,r){var n=t.call(this)||this;return n.id=e,n.attributes=new u(r),n}return n(e,t),e.prototype.port=function(t){return new p(this,"string"==typeof t?{port:t}:t)},e}(a);function f(t){return t instanceof c||t instanceof p||t instanceof l}function d(t){return"string"==typeof t||f(t)}function h(t){return Array.isArray(t)&&t.every(d)}var g=function(t){function e(e,r){var n=t.call(this)||this;return n.targets=e,n.attributes=new u(r),n}return n(e,t),e}(a),b=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.objects={nodes:new Map,edges:new Set,subgraphs:new Set},t}return n(r,e),Object.defineProperty(r.prototype,"nodes",{get:function(){return Array.from(this.objects.nodes.values())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"edges",{get:function(){return Array.from(this.objects.edges.values())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"subgraphs",{get:function(){return Array.from(this.objects.subgraphs.values())},enumerable:!1,configurable:!0}),r.prototype.addNode=function(t){this.objects.nodes.set(t.id,t)},r.prototype.addEdge=function(t){this.objects.edges.add(t)},r.prototype.addSubgraph=function(t){this.objects.subgraphs.add(t)},r.prototype.existNode=function(t){return this.objects.nodes.has(t)},r.prototype.existEdge=function(t){return this.objects.edges.has(t)},r.prototype.existSubgraph=function(t){return this.objects.subgraphs.has(t)},r.prototype.createSubgraph=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.find((function(t){return"string"==typeof t})),n=t.find((function(t){return"object"==typeof t})),o=new v(r,n);return this.objects.subgraphs.add(o),o},r.prototype.removeNode=function(t){this.objects.nodes.delete("string"==typeof t?t:t.id)},r.prototype.removeEdge=function(t){this.objects.edges.delete(t)},r.prototype.removeSubgraph=function(t){this.objects.subgraphs.delete(t)},r.prototype.createNode=function(t,e){var r=new c(t,e);return this.objects.nodes.set(t,r),r},r.prototype.getSubgraph=function(t){return Array.from(this.objects.subgraphs.values()).find((function(e){return e.id===t}))},r.prototype.getNode=function(t){return this.objects.nodes.get(t)},r.prototype.createEdge=function(t,e){var r=this;if(t.length<2&&!1===(d(t[0])&&d(t[1])))throw Error("The element of Edge target is missing or not satisfied as Edge target.");var n=new g(t.map((function(t){return h(t)?r.toEdgeTargets(t):r.toEdgeTarget(t)})),e);return this.objects.edges.add(n),n},r.prototype.toEdgeTarget=function(e){if(f(e))return e;var r=e.split(":"),n=r[0],o=r[1],i=r[2],a=this.getNode(n);return void 0!==a?o&&(void 0===i||t.Compass.is(i))?a.port({port:o,compass:i}):a:t.Compass.is(i)?new l(n,{port:o,compass:i}):new l(n,{port:o})},r.prototype.toEdgeTargets=function(t){var e=this;if(t.length<2&&!1===(d(t[0])&&d(t[1])))throw Error("EdgeTargets must have at least 2 elements.");return t.map((function(t){return e.toEdgeTarget(t)}))},r.prototype.subgraph=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=e.find((function(t){return"string"==typeof t})),o=e.find((function(t){return"object"==typeof t&&null!==t})),i=e.find((function(t){return"function"==typeof t})),a=n?null!==(t=this.getSubgraph(n))&&void 0!==t?t:this.createSubgraph(n):this.createSubgraph();return void 0!==o&&this.apply(o),void 0!==i&&i(a),a},r.prototype.node=function(t){for(var e,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=r.find((function(t){return"object"==typeof t&&null!==t})),i=r.find((function(t){return"function"==typeof t})),a=null!==(e=this.getNode(t))&&void 0!==e?e:this.createNode(t);return void 0!==o&&a.attributes.apply(o),void 0!==i&&i(a),a},r.prototype.edge=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=e.find((function(t){return"object"==typeof t})),o=e.find((function(t){return"function"==typeof t})),i=this.createEdge(t,n);return void 0!==o&&o(i),i},r}(s),v=function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.call(this)||this;n.attributes={graph:new u,edge:new u,node:new u},n.id=e.find((function(t){return"string"==typeof t}));var o=e.find((function(t){return"object"==typeof t}));return void 0!==o&&n.apply(o),n}return n(e,t),e.prototype.isSubgraphCluster=function(){return"string"==typeof this.id&&this.id.startsWith("cluster")},e}(b),y=function(t){function e(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=t.call(this)||this;o.attributes={graph:new u,edge:new u,node:new u},o.id=r.find((function(t){return"string"==typeof t})),o.strict=null!==(e=r.find((function(t){return"boolean"==typeof t})))&&void 0!==e&&e;var i=r.find((function(t){return"object"==typeof t}));return void 0!==i&&o.apply(i),o}return n(e,t),e}(b),m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(y),w=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(y);function j(t,e){return void 0===e&&(e=!1),function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=r.find((function(t){return"string"==typeof t})),i=r.find((function(t){return"object"==typeof t})),a=r.find((function(t){return"function"==typeof t})),s=new t(o,i,e);return"function"==typeof a&&a(s),s}}var k=j(w),z=j(m),_={digraph:j(w,!0),graph:j(m,!0)};var E,x,S=(E='"',function(t){return function(t,e){return""+e+t+e}(t,E)}),N=(x=" ",function(t){if("string"==typeof t)return function(t,e){return""+e+t}(t,x)});function O(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.filter((function(t){return"string"==typeof t})).join(t)}}var R=O(" "),A=O(":"),C=O("\n"),L=O("");function T(t){return t.split("\n").map((function(t){return L(" ",t)})).join("\n")}function U(t){return"string"==typeof t?function(t){return t.split("\n").map((function(t){return L("// ",t).trim()})).join("\n")}(t):void 0}function P(t){return t instanceof v}function D(t){return t instanceof c}function q(t){return t instanceof m}function M(t){return t instanceof w?"digraph":q(t)?"graph":P(t)?"subgraph":void 0}function G(t){var e="string"!=typeof t,r=!1,n=!1,o="string"==typeof t?t:t.toString();if(e)r=!1;else{var i=o.trim();(r=/^<.+>$/ms.test(i))?o=i:n=!0}return e||r?o:n?S(o.replace(/\n/g,"\\n").replace(/"/g,'\\"')):o}function K(t){return function(e){var r=e[0],n=e[1];return L(r," = ",G(n),t)}}var W=K(";"),B=K(",");function F(t){return 0===t.size?"":C("[",T(C.apply(void 0,o([U(t.comment)],t.values.map(B)))),"]")}function $(t){if(D(t))return G(t.id);if(t instanceof p){var e=t.port,r=e.port,n=e.compass;return A(G(t.node.id),void 0!==r?G(r):void 0,void 0!==n?G(n):void 0)}if(function(t){return t instanceof l}(t)){var o=t.port;r=o.port,n=o.compass;return A(G(t.id),void 0!==r?G(r):void 0,void 0!==n?G(n):void 0)}}var H=function(){function t(){}return t.prototype.renderNode=function(t){var e=U(t.comment),r=$(t),n=t.attributes.size>0?N(F(t.attributes)):void 0,o=L(r,n,";");return C(e,o)},t.prototype.renderEdge=function(t){var e,r=U(t.comment),n=(e=q(this.root)?" -- ":" -> ",t.targets.map((function(t){return d(t)?$(t):(e=t,"{"+R.apply(void 0,e.map($))+"}");var e})).filter((function(t){return"string"==typeof t})).join(e)),o=t.attributes.size>0?N(F(t.attributes)):void 0,i=L(n,o,";");return C(r,i)},t.prototype.renderCluster=function(t){var e=M(t),r=void 0!==t.id?G(t.id):void 0,n=t.values.map(W),i=Object.entries(t.attributes).filter((function(t){return t[1].size>0})).map((function(t){var e=t[0],r=t[1];return L(e," ",F(r),";")})),a=t.nodes.map(this.renderNode.bind(this)),s=t.subgraphs.map(this.renderSubgraph.bind(this)),u=t.edges.map(this.renderEdge.bind(this)),l=C.apply(void 0,o(n,i,a,s,u));return C(R(e,r,"{"),l.length>0?T(l):void 0,"}")},t.prototype.renderRootCluster=function(t){var e=U(t.comment),r=this.renderCluster(t);return C(e,R(t.strict?"strict":void 0,r))},t.prototype.renderSubgraph=function(t){var e=U(t.comment),r=this.renderCluster(t);return C(e,r)},t.prototype.render=function(t){return D(t)?this.renderNode(t):function(t){return t instanceof g}(t)?this.renderEdge(t):function(t){return t instanceof u}(t)?F(t):P(t)?this.renderSubgraph(t):function(t){return t instanceof y}(t)?(this.root=t,this.renderRootCluster(t)):G(t)},t}();t.Attributes=u,t.AttributesBase=s,t.Cluster=b,t.Digraph=w,t.DotObject=a,t.Edge=g,t.ForwardRefNode=l,t.Graph=m,t.GraphvizObject=i,t.Node=c,t.NodeWithPort=p,t.RootCluster=y,t.Subgraph=v,t.digraph=k,t.graph=z,t.isEdgeTarget=f,t.isEdgeTargetLike=d,t.isEdgeTargetsLike=h,t.strict=_,t.toDot=function(t){return(new H).render(t)},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function n(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function o(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}var i=function(){},a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(i),s=function(t){function e(e){var r=t.call(this)||this;return r.attrs=new Map,void 0!==e&&r.apply(e),r}return n(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return Array.from(this.attrs.entries())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.attrs.size},enumerable:!1,configurable:!0}),e.prototype.get=function(t){return this.attrs.get(t)},e.prototype.set=function(t,e){null!=e&&this.attrs.set(t,e)},e.prototype.delete=function(t){this.attrs.delete(t)},e.prototype.apply=function(t){for(var e=0,r=Array.isArray(t)?t:Object.entries(t);e<r.length;e++){var n=r[e],o=n[0],i=n[1];this.set(o,i)}},e.prototype.clear=function(){this.attrs.clear()},e}(a),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(s),l=function(t,e){this.id=t,this.port=e},p=function(t,e){this.node=t,this.port=e},c=function(t){function e(e,r){var n=t.call(this)||this;return n.id=e,n.attributes=new u(r),n}return n(e,t),e.prototype.port=function(t){return new p(this,"string"==typeof t?{port:t}:t)},e}(a);function f(t){return t instanceof c||t instanceof p||t instanceof l}function d(t){return"string"==typeof t||f(t)}function h(t){return Array.isArray(t)&&t.every(d)}var g=function(t){function e(e,r){var n=t.call(this)||this;if(n.targets=e,e.length<2&&!1===(d(e[0])&&d(e[1])))throw Error("The element of Edge target is missing or not satisfied as Edge target.");return n.attributes=new u(r),n}return n(e,t),e}(a),b=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.objects={nodes:new Map,edges:new Set,subgraphs:new Set},t}return n(r,e),Object.defineProperty(r.prototype,"nodes",{get:function(){return Array.from(this.objects.nodes.values())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"edges",{get:function(){return Array.from(this.objects.edges.values())},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"subgraphs",{get:function(){return Array.from(this.objects.subgraphs.values())},enumerable:!1,configurable:!0}),r.prototype.addNode=function(t){this.objects.nodes.set(t.id,t)},r.prototype.addEdge=function(t){this.objects.edges.add(t)},r.prototype.addSubgraph=function(t){this.objects.subgraphs.add(t)},r.prototype.existNode=function(t){return this.objects.nodes.has(t)},r.prototype.existEdge=function(t){return this.objects.edges.has(t)},r.prototype.existSubgraph=function(t){return this.objects.subgraphs.has(t)},r.prototype.createSubgraph=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.find((function(t){return"string"==typeof t})),n=t.find((function(t){return"object"==typeof t})),o=new y(r,n);return this.objects.subgraphs.add(o),o},r.prototype.removeNode=function(t){this.objects.nodes.delete("string"==typeof t?t:t.id)},r.prototype.removeEdge=function(t){this.objects.edges.delete(t)},r.prototype.removeSubgraph=function(t){this.objects.subgraphs.delete(t)},r.prototype.createNode=function(t,e){var r=new c(t,e);return this.objects.nodes.set(t,r),r},r.prototype.getSubgraph=function(t){return Array.from(this.objects.subgraphs.values()).find((function(e){return e.id===t}))},r.prototype.getNode=function(t){return this.objects.nodes.get(t)},r.prototype.createEdge=function(t,e){var r=this,n=new g(t.map((function(t){return h(t)?r.toEdgeTargets(t):r.toEdgeTarget(t)})),e);return this.objects.edges.add(n),n},r.prototype.toEdgeTarget=function(e){if(f(e))return e;var r=e.split(":"),n=r[0],o=r[1],i=r[2],a=this.getNode(n);return void 0!==a?o&&(void 0===i||t.Compass.is(i))?a.port({port:o,compass:i}):a:t.Compass.is(i)?new l(n,{port:o,compass:i}):new l(n,{port:o})},r.prototype.toEdgeTargets=function(t){var e=this;if(t.length<2&&!1===(d(t[0])&&d(t[1])))throw Error("EdgeTargets must have at least 2 elements.");return t.map((function(t){return e.toEdgeTarget(t)}))},r.prototype.subgraph=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=e.find((function(t){return"string"==typeof t})),o=e.find((function(t){return"object"==typeof t&&null!==t})),i=e.find((function(t){return"function"==typeof t})),a=n?null!==(t=this.getSubgraph(n))&&void 0!==t?t:this.createSubgraph(n):this.createSubgraph();return void 0!==o&&this.apply(o),void 0!==i&&i(a),a},r.prototype.node=function(t){for(var e,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=r.find((function(t){return"object"==typeof t&&null!==t})),i=r.find((function(t){return"function"==typeof t})),a=null!==(e=this.getNode(t))&&void 0!==e?e:this.createNode(t);return void 0!==o&&a.attributes.apply(o),void 0!==i&&i(a),a},r.prototype.edge=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=e.find((function(t){return"object"==typeof t})),o=e.find((function(t){return"function"==typeof t})),i=this.createEdge(t,n);return void 0!==o&&o(i),i},r}(s),y=function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.call(this)||this;n.attributes={graph:new u,edge:new u,node:new u},n.id=e.find((function(t){return"string"==typeof t}));var o=e.find((function(t){return"object"==typeof t}));return void 0!==o&&n.apply(o),n}return n(e,t),e.prototype.isSubgraphCluster=function(){return"string"==typeof this.id&&this.id.startsWith("cluster")},e}(b),v=function(t){function e(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=t.call(this)||this;o.attributes={graph:new u,edge:new u,node:new u},o.id=r.find((function(t){return"string"==typeof t})),o.strict=null!==(e=r.find((function(t){return"boolean"==typeof t})))&&void 0!==e&&e;var i=r.find((function(t){return"object"==typeof t}));return void 0!==i&&o.apply(i),o}return n(e,t),e}(b),m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(v),w=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(v);function j(t,e){return void 0===e&&(e=!1),function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=r.find((function(t){return"string"==typeof t})),i=r.find((function(t){return"object"==typeof t})),a=r.find((function(t){return"function"==typeof t})),s=new t(o,i,e);return"function"==typeof a&&a(s),s}}var k=j(w),z=j(m),_={digraph:j(w,!0),graph:j(m,!0)};var E,x,S=(E='"',function(t){return function(t,e){return""+e+t+e}(t,E)}),O=(x=" ",function(t){if("string"==typeof t)return function(t,e){return""+e+t}(t,x)});function N(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.filter((function(t){return"string"==typeof t})).join(t)}}var R=N(" "),A=N(":"),C=N("\n"),L=N("");function T(t){return t.split("\n").map((function(t){return L(" ",t)})).join("\n")}function U(t){return"string"==typeof t?function(t){return t.split("\n").map((function(t){return L("// ",t).trim()})).join("\n")}(t):void 0}function P(t){return t instanceof y}function D(t){return t instanceof c}function q(t){return t instanceof m}function M(t){return t instanceof w?"digraph":q(t)?"graph":P(t)?"subgraph":void 0}function G(t){var e="string"!=typeof t,r=!1,n=!1,o="string"==typeof t?t:t.toString();if(e)r=!1;else{var i=o.trim();(r=/^<.+>$/ms.test(i))?o=i:n=!0}return e||r?o:n?S(o.replace(/\n/g,"\\n").replace(/"/g,'\\"')):o}function K(t){return function(e){var r=e[0],n=e[1];return L(r," = ",G(n),t)}}var W=K(";"),B=K(",");function F(t){return 0===t.size?"":C("[",T(C.apply(void 0,o([U(t.comment)],t.values.map(B)))),"]")}function $(t){if(D(t))return G(t.id);if(t instanceof p){var e=t.port,r=e.port,n=e.compass;return A(G(t.node.id),void 0!==r?G(r):void 0,void 0!==n?G(n):void 0)}if(function(t){return t instanceof l}(t)){var o=t.port;r=o.port,n=o.compass;return A(G(t.id),void 0!==r?G(r):void 0,void 0!==n?G(n):void 0)}}var H=function(){function t(){}return t.prototype.renderNode=function(t){var e=U(t.comment),r=$(t),n=t.attributes.size>0?O(F(t.attributes)):void 0,o=L(r,n,";");return C(e,o)},t.prototype.renderEdge=function(t){var e,r=U(t.comment),n=(e=q(this.root)?" -- ":" -> ",t.targets.map((function(t){return d(t)?$(t):(e=t,"{"+R.apply(void 0,e.map($))+"}");var e})).filter((function(t){return"string"==typeof t})).join(e)),o=t.attributes.size>0?O(F(t.attributes)):void 0,i=L(n,o,";");return C(r,i)},t.prototype.renderCluster=function(t){var e=M(t),r=void 0!==t.id?G(t.id):void 0,n=t.values.map(W),i=Object.entries(t.attributes).filter((function(t){return t[1].size>0})).map((function(t){var e=t[0],r=t[1];return L(e," ",F(r),";")})),a=t.nodes.map(this.renderNode.bind(this)),s=t.subgraphs.map(this.renderSubgraph.bind(this)),u=t.edges.map(this.renderEdge.bind(this)),l=C.apply(void 0,o(n,i,a,s,u));return C(R(e,r,"{"),l.length>0?T(l):void 0,"}")},t.prototype.renderRootCluster=function(t){var e=U(t.comment),r=this.renderCluster(t);return C(e,R(t.strict?"strict":void 0,r))},t.prototype.renderSubgraph=function(t){var e=U(t.comment),r=this.renderCluster(t);return C(e,r)},t.prototype.render=function(t){return D(t)?this.renderNode(t):function(t){return t instanceof g}(t)?this.renderEdge(t):function(t){return t instanceof u}(t)?F(t):P(t)?this.renderSubgraph(t):function(t){return t instanceof v}(t)?(this.root=t,this.renderRootCluster(t)):G(t)},t}();t.Attributes=u,t.AttributesBase=s,t.Cluster=b,t.Digraph=w,t.DotObject=a,t.Edge=g,t.ForwardRefNode=l,t.Graph=m,t.GraphvizObject=i,t.Node=c,t.NodeWithPort=p,t.RootCluster=v,t.Subgraph=y,t.digraph=k,t.graph=z,t.isEdgeTarget=f,t.isEdgeTargetLike=d,t.isEdgeTargetsLike=h,t.strict=_,t.toDot=function(t){return(new H).render(t)},Object.defineProperty(t,"__esModule",{value:!0})})); |
@@ -16,2 +16,2 @@ "use strict";var t;Object.defineProperty(exports,"__esModule",{value:!0}),(t=exports.attribute||(exports.attribute={})).Damping="Damping",t.K="K",t.URL="URL",t._background="_background",t.area="area",t.arrowhead="arrowhead",t.arrowsize="arrowsize",t.arrowtail="arrowtail",t.bb="bb",t.bgcolor="bgcolor",t.center="center",t.charset="charset",t.clusterrank="clusterrank",t.color="color",t.colorscheme="colorscheme",t.comment="comment",t.compound="compound",t.concentrate="concentrate",t.constraint="constraint",t.decorate="decorate",t.defaultdist="defaultdist",t.dim="dim",t.dimen="dimen",t.dir="dir",t.diredgeconstraints="diredgeconstraints",t.distortion="distortion",t.dpi="dpi",t.edgeURL="edgeURL",t.edgehref="edgehref",t.edgetarget="edgetarget",t.edgetooltip="edgetooltip",t.epsilon="epsilon",t.esep="esep",t.fillcolor="fillcolor",t.fixedsize="fixedsize",t.fontcolor="fontcolor",t.fontname="fontname",t.fontnames="fontnames",t.fontpath="fontpath",t.fontsize="fontsize",t.forcelabels="forcelabels",t.gradientangle="gradientangle",t.group="group",t.headURL="headURL",t.head_lp="head_lp",t.headclip="headclip",t.headhref="headhref",t.headlabel="headlabel",t.headport="headport",t.headtarget="headtarget",t.headtooltip="headtooltip",t.height="height",t.href="href",t.id="id",t.image="image",t.imagepath="imagepath",t.imagepos="imagepos",t.imagescale="imagescale",t.inputscale="inputscale",t.label="label",t.labelURL="labelURL",t.label_scheme="label_scheme",t.labelangle="labelangle",t.labeldistance="labeldistance",t.labelfloat="labelfloat",t.labelfontcolor="labelfontcolor",t.labelfontname="labelfontname",t.labelfontsize="labelfontsize",t.labelhref="labelhref",t.labeljust="labeljust",t.labelloc="labelloc",t.labeltarget="labeltarget",t.labeltooltip="labeltooltip",t.landscape="landscape",t.layer="layer",t.layerlistsep="layerlistsep",t.layers="layers",t.layerselect="layerselect",t.layersep="layersep",t.layout="layout",t.len="len",t.levels="levels",t.levelsgap="levelsgap",t.lhead="lhead",t.lheight="lheight",t.lp="lp",t.ltail="ltail",t.lwidth="lwidth",t.margin="margin",t.maxiter="maxiter",t.mclimit="mclimit",t.mindist="mindist",t.minlen="minlen",t.mode="mode",t.model="model",t.mosek="mosek",t.newrank="newrank",t.nodesep="nodesep",t.nojustify="nojustify",t.normalize="normalize",t.notranslate="notranslate",t.nslimit="nslimit",t.nslimit1="nslimit1",t.ordering="ordering",t.orientation="orientation",t.outputorder="outputorder",t.overlap="overlap",t.overlap_scaling="overlap_scaling",t.overlap_shrink="overlap_shrink",t.pack="pack",t.packmode="packmode",t.pad="pad",t.page="page",t.pagedir="pagedir",t.pencolor="pencolor",t.penwidth="penwidth",t.peripheries="peripheries",t.pin="pin",t.pos="pos",t.quadtree="quadtree",t.quantum="quantum",t.rank="rank",t.rankdir="rankdir",t.ranksep="ranksep",t.ratio="ratio",t.rects="rects",t.regular="regular",t.remincross="remincross",t.repulsiveforce="repulsiveforce",t.resolution="resolution",t.root="root",t.rotate="rotate",t.rotation="rotation",t.samehead="samehead",t.sametail="sametail",t.samplepoints="samplepoints",t.scale="scale",t.searchsize="searchsize",t.sep="sep",t.shape="shape",t.shapefile="shapefile",t.showboxes="showboxes",t.sides="sides",t.size="size",t.skew="skew",t.smoothing="smoothing",t.sortv="sortv",t.splines="splines",t.start="start",t.style="style",t.stylesheet="stylesheet",t.tailURL="tailURL",t.tail_lp="tail_lp",t.tailclip="tailclip",t.tailhref="tailhref",t.taillabel="taillabel",t.tailport="tailport",t.tailtarget="tailtarget",t.tailtooltip="tailtooltip",t.target="target",t.tooltip="tooltip",t.truecolor="truecolor",t.vertices="vertices",t.viewport="viewport",t.voro_margin="voro_margin",t.weight="weight",t.width="width",t.xdotversion="xdotversion",t.xlabel="xlabel",t.xlp="xlp",t.z="z",function(t){t.n="n",t.ne="ne",t.e="e",t.se="se",t.s="s",t.sw="sw",t.w="w",t.nw="nw",t.c="c";var e=[t.n,t.ne,t.e,t.se,t.s,t.sw,t.w,t.nw,t.c];t.is=function(t){return e.includes(t)}}(exports.Compass||(exports.Compass={})); | ||
***************************************************************************** */ | ||
var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}var o=function(){},i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(o),a=function(t){function e(e){var r=t.call(this)||this;return r.attrs=new Map,void 0!==e&&r.apply(e),r}return r(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return Array.from(this.attrs.entries())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.attrs.size},enumerable:!1,configurable:!0}),e.prototype.get=function(t){return this.attrs.get(t)},e.prototype.set=function(t,e){null!=e&&this.attrs.set(t,e)},e.prototype.delete=function(t){this.attrs.delete(t)},e.prototype.apply=function(t){for(var e=0,r=Array.isArray(t)?t:Object.entries(t);e<r.length;e++){var n=r[e],o=n[0],i=n[1];this.set(o,i)}},e.prototype.clear=function(){this.attrs.clear()},e}(i),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(a),u=function(t,e){this.id=t,this.port=e},p=function(t,e){this.node=t,this.port=e},l=function(t){function e(e,r){var n=t.call(this)||this;return n.id=e,n.attributes=new s(r),n}return r(e,t),e.prototype.port=function(t){return new p(this,"string"==typeof t?{port:t}:t)},e}(i);function c(t){return t instanceof l||t instanceof p||t instanceof u}function f(t){return"string"==typeof t||c(t)}function d(t){return Array.isArray(t)&&t.every(f)}var h=function(t){function e(e,r){var n=t.call(this)||this;return n.targets=e,n.attributes=new s(r),n}return r(e,t),e}(i),g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.objects={nodes:new Map,edges:new Set,subgraphs:new Set},e}return r(e,t),Object.defineProperty(e.prototype,"nodes",{get:function(){return Array.from(this.objects.nodes.values())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"edges",{get:function(){return Array.from(this.objects.edges.values())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subgraphs",{get:function(){return Array.from(this.objects.subgraphs.values())},enumerable:!1,configurable:!0}),e.prototype.addNode=function(t){this.objects.nodes.set(t.id,t)},e.prototype.addEdge=function(t){this.objects.edges.add(t)},e.prototype.addSubgraph=function(t){this.objects.subgraphs.add(t)},e.prototype.existNode=function(t){return this.objects.nodes.has(t)},e.prototype.existEdge=function(t){return this.objects.edges.has(t)},e.prototype.existSubgraph=function(t){return this.objects.subgraphs.has(t)},e.prototype.createSubgraph=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.find((function(t){return"string"==typeof t})),n=t.find((function(t){return"object"==typeof t})),o=new b(r,n);return this.objects.subgraphs.add(o),o},e.prototype.removeNode=function(t){this.objects.nodes.delete("string"==typeof t?t:t.id)},e.prototype.removeEdge=function(t){this.objects.edges.delete(t)},e.prototype.removeSubgraph=function(t){this.objects.subgraphs.delete(t)},e.prototype.createNode=function(t,e){var r=new l(t,e);return this.objects.nodes.set(t,r),r},e.prototype.getSubgraph=function(t){return Array.from(this.objects.subgraphs.values()).find((function(e){return e.id===t}))},e.prototype.getNode=function(t){return this.objects.nodes.get(t)},e.prototype.createEdge=function(t,e){var r=this;if(t.length<2&&!1===(f(t[0])&&f(t[1])))throw Error("The element of Edge target is missing or not satisfied as Edge target.");var n=new h(t.map((function(t){return d(t)?r.toEdgeTargets(t):r.toEdgeTarget(t)})),e);return this.objects.edges.add(n),n},e.prototype.toEdgeTarget=function(t){if(c(t))return t;var e=t.split(":"),r=e[0],n=e[1],o=e[2],i=this.getNode(r);return void 0!==i?n&&(void 0===o||exports.Compass.is(o))?i.port({port:n,compass:o}):i:exports.Compass.is(o)?new u(r,{port:n,compass:o}):new u(r,{port:n})},e.prototype.toEdgeTargets=function(t){var e=this;if(t.length<2&&!1===(f(t[0])&&f(t[1])))throw Error("EdgeTargets must have at least 2 elements.");return t.map((function(t){return e.toEdgeTarget(t)}))},e.prototype.subgraph=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=e.find((function(t){return"string"==typeof t})),o=e.find((function(t){return"object"==typeof t&&null!==t})),i=e.find((function(t){return"function"==typeof t})),a=n?null!==(t=this.getSubgraph(n))&&void 0!==t?t:this.createSubgraph(n):this.createSubgraph();return void 0!==o&&this.apply(o),void 0!==i&&i(a),a},e.prototype.node=function(t){for(var e,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=r.find((function(t){return"object"==typeof t&&null!==t})),i=r.find((function(t){return"function"==typeof t})),a=null!==(e=this.getNode(t))&&void 0!==e?e:this.createNode(t);return void 0!==o&&a.attributes.apply(o),void 0!==i&&i(a),a},e.prototype.edge=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=e.find((function(t){return"object"==typeof t})),o=e.find((function(t){return"function"==typeof t})),i=this.createEdge(t,n);return void 0!==o&&o(i),i},e}(a),b=function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.call(this)||this;n.attributes={graph:new s,edge:new s,node:new s},n.id=e.find((function(t){return"string"==typeof t}));var o=e.find((function(t){return"object"==typeof t}));return void 0!==o&&n.apply(o),n}return r(e,t),e.prototype.isSubgraphCluster=function(){return"string"==typeof this.id&&this.id.startsWith("cluster")},e}(g),v=function(t){function e(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=t.call(this)||this;o.attributes={graph:new s,edge:new s,node:new s},o.id=r.find((function(t){return"string"==typeof t})),o.strict=null!==(e=r.find((function(t){return"boolean"==typeof t})))&&void 0!==e&&e;var i=r.find((function(t){return"object"==typeof t}));return void 0!==i&&o.apply(i),o}return r(e,t),e}(g),m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(v),y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(v);function w(t,e){return void 0===e&&(e=!1),function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=r.find((function(t){return"string"==typeof t})),i=r.find((function(t){return"object"==typeof t})),a=r.find((function(t){return"function"==typeof t})),s=new t(o,i,e);return"function"==typeof a&&a(s),s}}var j=w(y),x=w(m),k={digraph:w(y,!0),graph:w(m,!0)};var _,z,E=(_='"',function(t){return function(t,e){return""+e+t+e}(t,_)}),S=(z=" ",function(t){if("string"==typeof t)return function(t,e){return""+e+t}(t,z)});function N(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.filter((function(t){return"string"==typeof t})).join(t)}}var O=N(" "),R=N(":"),A=N("\n"),C=N("");function L(t){return t.split("\n").map((function(t){return C(" ",t)})).join("\n")}function T(t){return"string"==typeof t?function(t){return t.split("\n").map((function(t){return C("// ",t).trim()})).join("\n")}(t):void 0}function U(t){return t instanceof b}function P(t){return t instanceof l}function D(t){return t instanceof m}function q(t){return t instanceof y?"digraph":D(t)?"graph":U(t)?"subgraph":void 0}function M(t){var e="string"!=typeof t,r=!1,n=!1,o="string"==typeof t?t:t.toString();if(e)r=!1;else{var i=o.trim();(r=/^<.+>$/ms.test(i))?o=i:n=!0}return e||r?o:n?E(o.replace(/\n/g,"\\n").replace(/"/g,'\\"')):o}function G(t){return function(e){var r=e[0],n=e[1];return C(r," = ",M(n),t)}}var K=G(";"),W=G(",");function B(t){return 0===t.size?"":A("[",L(A.apply(void 0,n([T(t.comment)],t.values.map(W)))),"]")}function F(t){if(P(t))return M(t.id);if(t instanceof p){var e=t.port,r=e.port,n=e.compass;return R(M(t.node.id),void 0!==r?M(r):void 0,void 0!==n?M(n):void 0)}if(function(t){return t instanceof u}(t)){var o=t.port;r=o.port,n=o.compass;return R(M(t.id),void 0!==r?M(r):void 0,void 0!==n?M(n):void 0)}}var $=function(){function t(){}return t.prototype.renderNode=function(t){var e=T(t.comment),r=F(t),n=t.attributes.size>0?S(B(t.attributes)):void 0,o=C(r,n,";");return A(e,o)},t.prototype.renderEdge=function(t){var e,r=T(t.comment),n=(e=D(this.root)?" -- ":" -> ",t.targets.map((function(t){return f(t)?F(t):(e=t,"{"+O.apply(void 0,e.map(F))+"}");var e})).filter((function(t){return"string"==typeof t})).join(e)),o=t.attributes.size>0?S(B(t.attributes)):void 0,i=C(n,o,";");return A(r,i)},t.prototype.renderCluster=function(t){var e=q(t),r=void 0!==t.id?M(t.id):void 0,o=t.values.map(K),i=Object.entries(t.attributes).filter((function(t){return t[1].size>0})).map((function(t){var e=t[0],r=t[1];return C(e," ",B(r),";")})),a=t.nodes.map(this.renderNode.bind(this)),s=t.subgraphs.map(this.renderSubgraph.bind(this)),u=t.edges.map(this.renderEdge.bind(this)),p=A.apply(void 0,n(o,i,a,s,u));return A(O(e,r,"{"),p.length>0?L(p):void 0,"}")},t.prototype.renderRootCluster=function(t){var e=T(t.comment),r=this.renderCluster(t);return A(e,O(t.strict?"strict":void 0,r))},t.prototype.renderSubgraph=function(t){var e=T(t.comment),r=this.renderCluster(t);return A(e,r)},t.prototype.render=function(t){return P(t)?this.renderNode(t):function(t){return t instanceof h}(t)?this.renderEdge(t):function(t){return t instanceof s}(t)?B(t):U(t)?this.renderSubgraph(t):function(t){return t instanceof v}(t)?(this.root=t,this.renderRootCluster(t)):M(t)},t}();exports.Attributes=s,exports.AttributesBase=a,exports.Cluster=g,exports.Digraph=y,exports.DotObject=i,exports.Edge=h,exports.ForwardRefNode=u,exports.Graph=m,exports.GraphvizObject=o,exports.Node=l,exports.NodeWithPort=p,exports.RootCluster=v,exports.Subgraph=b,exports.digraph=j,exports.graph=x,exports.isEdgeTarget=c,exports.isEdgeTargetLike=f,exports.isEdgeTargetsLike=d,exports.strict=k,exports.toDot=function(t){return(new $).render(t)}; | ||
var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}var o=function(){},i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(o),a=function(t){function e(e){var r=t.call(this)||this;return r.attrs=new Map,void 0!==e&&r.apply(e),r}return r(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return Array.from(this.attrs.entries())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.attrs.size},enumerable:!1,configurable:!0}),e.prototype.get=function(t){return this.attrs.get(t)},e.prototype.set=function(t,e){null!=e&&this.attrs.set(t,e)},e.prototype.delete=function(t){this.attrs.delete(t)},e.prototype.apply=function(t){for(var e=0,r=Array.isArray(t)?t:Object.entries(t);e<r.length;e++){var n=r[e],o=n[0],i=n[1];this.set(o,i)}},e.prototype.clear=function(){this.attrs.clear()},e}(i),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(a),u=function(t,e){this.id=t,this.port=e},p=function(t,e){this.node=t,this.port=e},l=function(t){function e(e,r){var n=t.call(this)||this;return n.id=e,n.attributes=new s(r),n}return r(e,t),e.prototype.port=function(t){return new p(this,"string"==typeof t?{port:t}:t)},e}(i);function c(t){return t instanceof l||t instanceof p||t instanceof u}function f(t){return"string"==typeof t||c(t)}function d(t){return Array.isArray(t)&&t.every(f)}var h=function(t){function e(e,r){var n=t.call(this)||this;if(n.targets=e,e.length<2&&!1===(f(e[0])&&f(e[1])))throw Error("The element of Edge target is missing or not satisfied as Edge target.");return n.attributes=new s(r),n}return r(e,t),e}(i),g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.objects={nodes:new Map,edges:new Set,subgraphs:new Set},e}return r(e,t),Object.defineProperty(e.prototype,"nodes",{get:function(){return Array.from(this.objects.nodes.values())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"edges",{get:function(){return Array.from(this.objects.edges.values())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subgraphs",{get:function(){return Array.from(this.objects.subgraphs.values())},enumerable:!1,configurable:!0}),e.prototype.addNode=function(t){this.objects.nodes.set(t.id,t)},e.prototype.addEdge=function(t){this.objects.edges.add(t)},e.prototype.addSubgraph=function(t){this.objects.subgraphs.add(t)},e.prototype.existNode=function(t){return this.objects.nodes.has(t)},e.prototype.existEdge=function(t){return this.objects.edges.has(t)},e.prototype.existSubgraph=function(t){return this.objects.subgraphs.has(t)},e.prototype.createSubgraph=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t.find((function(t){return"string"==typeof t})),n=t.find((function(t){return"object"==typeof t})),o=new b(r,n);return this.objects.subgraphs.add(o),o},e.prototype.removeNode=function(t){this.objects.nodes.delete("string"==typeof t?t:t.id)},e.prototype.removeEdge=function(t){this.objects.edges.delete(t)},e.prototype.removeSubgraph=function(t){this.objects.subgraphs.delete(t)},e.prototype.createNode=function(t,e){var r=new l(t,e);return this.objects.nodes.set(t,r),r},e.prototype.getSubgraph=function(t){return Array.from(this.objects.subgraphs.values()).find((function(e){return e.id===t}))},e.prototype.getNode=function(t){return this.objects.nodes.get(t)},e.prototype.createEdge=function(t,e){var r=this,n=new h(t.map((function(t){return d(t)?r.toEdgeTargets(t):r.toEdgeTarget(t)})),e);return this.objects.edges.add(n),n},e.prototype.toEdgeTarget=function(t){if(c(t))return t;var e=t.split(":"),r=e[0],n=e[1],o=e[2],i=this.getNode(r);return void 0!==i?n&&(void 0===o||exports.Compass.is(o))?i.port({port:n,compass:o}):i:exports.Compass.is(o)?new u(r,{port:n,compass:o}):new u(r,{port:n})},e.prototype.toEdgeTargets=function(t){var e=this;if(t.length<2&&!1===(f(t[0])&&f(t[1])))throw Error("EdgeTargets must have at least 2 elements.");return t.map((function(t){return e.toEdgeTarget(t)}))},e.prototype.subgraph=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=e.find((function(t){return"string"==typeof t})),o=e.find((function(t){return"object"==typeof t&&null!==t})),i=e.find((function(t){return"function"==typeof t})),a=n?null!==(t=this.getSubgraph(n))&&void 0!==t?t:this.createSubgraph(n):this.createSubgraph();return void 0!==o&&this.apply(o),void 0!==i&&i(a),a},e.prototype.node=function(t){for(var e,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=r.find((function(t){return"object"==typeof t&&null!==t})),i=r.find((function(t){return"function"==typeof t})),a=null!==(e=this.getNode(t))&&void 0!==e?e:this.createNode(t);return void 0!==o&&a.attributes.apply(o),void 0!==i&&i(a),a},e.prototype.edge=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=e.find((function(t){return"object"==typeof t})),o=e.find((function(t){return"function"==typeof t})),i=this.createEdge(t,n);return void 0!==o&&o(i),i},e}(a),b=function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.call(this)||this;n.attributes={graph:new s,edge:new s,node:new s},n.id=e.find((function(t){return"string"==typeof t}));var o=e.find((function(t){return"object"==typeof t}));return void 0!==o&&n.apply(o),n}return r(e,t),e.prototype.isSubgraphCluster=function(){return"string"==typeof this.id&&this.id.startsWith("cluster")},e}(g),v=function(t){function e(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=t.call(this)||this;o.attributes={graph:new s,edge:new s,node:new s},o.id=r.find((function(t){return"string"==typeof t})),o.strict=null!==(e=r.find((function(t){return"boolean"==typeof t})))&&void 0!==e&&e;var i=r.find((function(t){return"object"==typeof t}));return void 0!==i&&o.apply(i),o}return r(e,t),e}(g),y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(v),m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}(v);function w(t,e){return void 0===e&&(e=!1),function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=r.find((function(t){return"string"==typeof t})),i=r.find((function(t){return"object"==typeof t})),a=r.find((function(t){return"function"==typeof t})),s=new t(o,i,e);return"function"==typeof a&&a(s),s}}var j=w(m),x=w(y),k={digraph:w(m,!0),graph:w(y,!0)};var _,z,E=(_='"',function(t){return function(t,e){return""+e+t+e}(t,_)}),S=(z=" ",function(t){if("string"==typeof t)return function(t,e){return""+e+t}(t,z)});function O(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.filter((function(t){return"string"==typeof t})).join(t)}}var N=O(" "),R=O(":"),A=O("\n"),C=O("");function L(t){return t.split("\n").map((function(t){return C(" ",t)})).join("\n")}function T(t){return"string"==typeof t?function(t){return t.split("\n").map((function(t){return C("// ",t).trim()})).join("\n")}(t):void 0}function U(t){return t instanceof b}function P(t){return t instanceof l}function D(t){return t instanceof y}function q(t){return t instanceof m?"digraph":D(t)?"graph":U(t)?"subgraph":void 0}function M(t){var e="string"!=typeof t,r=!1,n=!1,o="string"==typeof t?t:t.toString();if(e)r=!1;else{var i=o.trim();(r=/^<.+>$/ms.test(i))?o=i:n=!0}return e||r?o:n?E(o.replace(/\n/g,"\\n").replace(/"/g,'\\"')):o}function G(t){return function(e){var r=e[0],n=e[1];return C(r," = ",M(n),t)}}var K=G(";"),W=G(",");function B(t){return 0===t.size?"":A("[",L(A.apply(void 0,n([T(t.comment)],t.values.map(W)))),"]")}function F(t){if(P(t))return M(t.id);if(t instanceof p){var e=t.port,r=e.port,n=e.compass;return R(M(t.node.id),void 0!==r?M(r):void 0,void 0!==n?M(n):void 0)}if(function(t){return t instanceof u}(t)){var o=t.port;r=o.port,n=o.compass;return R(M(t.id),void 0!==r?M(r):void 0,void 0!==n?M(n):void 0)}}var $=function(){function t(){}return t.prototype.renderNode=function(t){var e=T(t.comment),r=F(t),n=t.attributes.size>0?S(B(t.attributes)):void 0,o=C(r,n,";");return A(e,o)},t.prototype.renderEdge=function(t){var e,r=T(t.comment),n=(e=D(this.root)?" -- ":" -> ",t.targets.map((function(t){return f(t)?F(t):(e=t,"{"+N.apply(void 0,e.map(F))+"}");var e})).filter((function(t){return"string"==typeof t})).join(e)),o=t.attributes.size>0?S(B(t.attributes)):void 0,i=C(n,o,";");return A(r,i)},t.prototype.renderCluster=function(t){var e=q(t),r=void 0!==t.id?M(t.id):void 0,o=t.values.map(K),i=Object.entries(t.attributes).filter((function(t){return t[1].size>0})).map((function(t){var e=t[0],r=t[1];return C(e," ",B(r),";")})),a=t.nodes.map(this.renderNode.bind(this)),s=t.subgraphs.map(this.renderSubgraph.bind(this)),u=t.edges.map(this.renderEdge.bind(this)),p=A.apply(void 0,n(o,i,a,s,u));return A(N(e,r,"{"),p.length>0?L(p):void 0,"}")},t.prototype.renderRootCluster=function(t){var e=T(t.comment),r=this.renderCluster(t);return A(e,N(t.strict?"strict":void 0,r))},t.prototype.renderSubgraph=function(t){var e=T(t.comment),r=this.renderCluster(t);return A(e,r)},t.prototype.render=function(t){return P(t)?this.renderNode(t):function(t){return t instanceof h}(t)?this.renderEdge(t):function(t){return t instanceof s}(t)?B(t):U(t)?this.renderSubgraph(t):function(t){return t instanceof v}(t)?(this.root=t,this.renderRootCluster(t)):M(t)},t}();exports.Attributes=s,exports.AttributesBase=a,exports.Cluster=g,exports.Digraph=m,exports.DotObject=i,exports.Edge=h,exports.ForwardRefNode=u,exports.Graph=y,exports.GraphvizObject=o,exports.Node=l,exports.NodeWithPort=p,exports.RootCluster=v,exports.Subgraph=b,exports.digraph=j,exports.graph=x,exports.isEdgeTarget=c,exports.isEdgeTargetLike=f,exports.isEdgeTargetsLike=d,exports.strict=k,exports.toDot=function(t){return(new $).render(t)}; |
{ | ||
"name": "ts-graphviz", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"author": "kamiazya <yuki@kamiazya.tech>", | ||
@@ -37,3 +37,3 @@ "description": "Graphviz library for TypeScript.", | ||
"devDependencies": { | ||
"@types/jest": "^25.1.1", | ||
"@types/jest": "^26.0.10", | ||
"@typescript-eslint/eslint-plugin": "^2.31.0", | ||
@@ -50,8 +50,8 @@ "@typescript-eslint/parser": "^2.31.0", | ||
"rollup": "^2.0.6", | ||
"rollup-plugin-terser": "^5.1.3", | ||
"rollup-plugin-terser": "^7.0.0", | ||
"rollup-plugin-typescript2": "^0.27.1", | ||
"ts-jest": "^25.1.0", | ||
"typedoc": "^0.17.6", | ||
"typedoc": "^0.18.0", | ||
"typescript": "^3.7.2" | ||
} | ||
} |
[![GitHub Action](https://github.com/kamiazya/ts-graphviz/workflows/NodeCI/badge.svg)](https://github.com/kamiazya/ts-graphviz/actions?workflow=NodeCI) [![npm version](https://badge.fury.io/js/ts-graphviz.svg)](https://badge.fury.io/js/ts-graphviz) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![Maintainability](https://api.codeclimate.com/v1/badges/12a586dde710859d58c7/maintainability)](https://codeclimate.com/github/kamiazya/ts-graphviz/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/12a586dde710859d58c7/test_coverage)](https://codeclimate.com/github/kamiazya/ts-graphviz/test_coverage) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -90,15 +90,15 @@ | ||
g.edge([a, b, c], { | ||
[attribute.color]: 'red', | ||
[attribute.color]: 'red' | ||
}); | ||
g.subgraph('A', (A) => { | ||
const Aa = A.node('Aaa', { | ||
[attribute.color]: 'pink', | ||
[attribute.color]: 'pink' | ||
}); | ||
const Ab = A.node('Abb', { | ||
[attribute.color]: 'violet', | ||
[attribute.color]: 'violet' | ||
}); | ||
const Ac = A.node('Acc'); | ||
A.edge([Aa.port('a'), Ab, Ac, 'E'], { | ||
[attribute.color]: 'red', | ||
[attribute.color]: 'red' | ||
}); | ||
@@ -136,3 +136,3 @@ }); | ||
```typescript | ||
import { Digraph, Subgraph, Node, Edge, toDot } from 'ts-graphviz'; | ||
import { attribute, Digraph, Subgraph, Node, Edge, toDot } from 'ts-graphviz'; | ||
@@ -142,10 +142,10 @@ const G = new Digraph(); | ||
const node1 = new Node('node1', { | ||
[attribute.color]: 'red', | ||
[attribute.color]: 'red' | ||
}); | ||
const node2 = new Node('node2', { | ||
[attribute.color]: 'blue', | ||
[attribute.color]: 'blue' | ||
}); | ||
const edge = new Edge([node1, node2], { | ||
[attribute.label]: 'Edge Label', | ||
[attribute.color]: 'pink', | ||
[attribute.color]: 'pink' | ||
}); | ||
@@ -192,3 +192,3 @@ G.addSubgraph(A); | ||
super(`node${id}`, { | ||
[attribute.label]: `This is Custom Node ${id}`, | ||
[attribute.label]: `This is Custom Node ${id}` | ||
}); | ||
@@ -201,3 +201,3 @@ } | ||
super(targets, { | ||
[attribute.label]: 'This is Custom Edge', | ||
[attribute.label]: 'This is Custom Edge' | ||
}); | ||
@@ -253,4 +253,5 @@ } | ||
<tr> | ||
<td align="center"><a href="http://blog.kamiazya.tech/"><img src="https://avatars0.githubusercontent.com/u/35218186?v=4" width="100px;" alt=""/><br /><sub><b>Yuki Yamazaki</b></sub></a><br /><a href="https://github.com/kamiazya/ts-graphviz/commits?author=kamiazya" title="Code">💻</a> <a href="https://github.com/kamiazya/ts-graphviz/commits?author=kamiazya" title="Tests">⚠️</a> <a href="https://github.com/kamiazya/ts-graphviz/commits?author=kamiazya" title="Documentation">📖</a> <a href="#ideas-kamiazya" title="Ideas, Planning, & Feedback">🤔</a></td> | ||
<td align="center"><a href="https://laysent.com"><img src="https://avatars2.githubusercontent.com/u/1191606?v=4" width="100px;" alt=""/><br /><sub><b>LaySent</b></sub></a><br /><a href="https://github.com/kamiazya/ts-graphviz/issues?q=author%3Alaysent" title="Bug reports">🐛</a> <a href="https://github.com/kamiazya/ts-graphviz/commits?author=laysent" title="Tests">⚠️</a></td> | ||
<td align="center"><a href="http://blog.kamiazya.tech/"><img src="https://avatars0.githubusercontent.com/u/35218186?v=4" width="100px;" alt=""/><br /><sub><b>Yuki Yamazaki</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Code">💻</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Tests">⚠️</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Documentation">📖</a> <a href="#ideas-kamiazya" title="Ideas, Planning, & Feedback">🤔</a></td> | ||
<td align="center"><a href="https://laysent.com"><img src="https://avatars2.githubusercontent.com/u/1191606?v=4" width="100px;" alt=""/><br /><sub><b>LaySent</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Alaysent" title="Bug reports">🐛</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=laysent" title="Tests">⚠️</a></td> | ||
<td align="center"><a href="https://github.com/elasticdotventures"><img src="https://avatars0.githubusercontent.com/u/35611074?v=4" width="100px;" alt=""/><br /><sub><b>elasticdotventures</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=elasticdotventures" title="Documentation">📖</a></td> | ||
</tr> | ||
@@ -257,0 +258,0 @@ </table> |
Sorry, the diff of this file is not supported yet
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
214783
3314
268