Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dagre-d3

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dagre-d3 - npm Package Compare versions

Comparing version 0.4.5 to 0.4.6

2

bower.json
{
"name": "dagre-d3",
"version": "0.4.5",
"version": "0.4.6",
"main": [

@@ -5,0 +5,0 @@ "dist/dagre-d3.core.js"

@@ -23,3 +23,3 @@ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.dagreD3=t()}}(function(){return function t(e,r,n){function a(l,s){if(!r[l]){if(!e[l]){var o="function"==typeof require&&require;if(!s&&o)return o(l,!0);if(i)return i(l,!0);var d=new Error("Cannot find module '"+l+"'");throw d.code="MODULE_NOT_FOUND",d}var c=r[l]={exports:{}};e[l][0].call(c.exports,function(t){var r=e[l][1][t];return a(r?r:t)},c,c.exports,t,e,r,n)}return r[l].exports}for(var i="function"==typeof require&&require,l=0;l<n.length;l++)a(n[l]);return a}({1:[function(t,e,r){/**

*/
e.exports={graphlib:t("./lib/graphlib"),dagre:t("./lib/dagre"),intersect:t("./lib/intersect"),render:t("./lib/render"),util:t("./lib/util"),version:t("./lib/version")}},{"./lib/dagre":8,"./lib/graphlib":9,"./lib/intersect":10,"./lib/render":25,"./lib/util":27,"./lib/version":28}],2:[function(t,e,r){function n(t,e,r,n){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),i=a.append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.applyStyle(i,r[n+"Style"])}function a(t,e,r,n){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),i=a.append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.applyStyle(i,r[n+"Style"])}function i(t,e,r,n){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),i=a.append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");l.applyStyle(i,r[n+"Style"])}var l=t("./util");e.exports={"default":n,normal:n,vee:a,undirected:i}},{"./util":27}],3:[function(t,e,r){function n(t,e){var r=e.nodes().filter(function(t){return a.isSubgraph(e,t)}),n=t.selectAll("g.cluster").data(r,function(t){return t});n.selectAll("*").remove(),n.enter().append("g").attr("class","cluster").style("opacity",0).append("rect"),a.applyTransition(n.exit(),e).style("opacity",0).remove(),a.applyTransition(n,e).style("opacity",1),n.each(function(t){var r=e.node(t),n=d3.select(this),a=n.append("g").attr("class","label");i(a,r,r.clusterLabelPos)}),n.selectAll("rect").each(function(t){var r=e.node(t),n=d3.select(this);a.applyStyle(n,r.style)})}var a=t("./util"),i=t("./label/add-label");e.exports=n},{"./label/add-label":18,"./util":27}],4:[function(t,e,r){"use strict";function n(t,e){var r=t.selectAll("g.edgeLabel").data(e.edges(),function(t){return l.edgeToId(t)}).classed("update",!0);return r.selectAll("*").remove(),r.enter().append("g").classed("edgeLabel",!0).style("opacity",0),r.each(function(t){var r=e.edge(t),n=i(s.select(this),e.edge(t),0,0).classed("label",!0),l=n.node().getBBox();r.labelId&&n.attr("id",r.labelId),a.has(r,"width")||(r.width=l.width),a.has(r,"height")||(r.height=l.height)}),l.applyTransition(r.exit(),e).style("opacity",0).remove(),r}var a=t("./lodash"),i=t("./label/add-label"),l=t("./util"),s=t("./d3");e.exports=n},{"./d3":7,"./label/add-label":18,"./lodash":21,"./util":27}],5:[function(t,e,r){"use strict";function n(t,e,r){var n=t.selectAll("g.edgePath").data(e.edges(),function(t){return u.edgeToId(t)}).classed("update",!0);return s(n,e),o(n,e),u.applyTransition(n,e).style("opacity",1),n.each(function(t){var r=p.select(this),n=e.edge(t);n.elem=this,n.id&&r.attr("id",n.id),u.applyClass(r,n["class"],(r.classed("update")?"update ":"")+"edgePath")}),n.selectAll("path.path").each(function(t){var r=e.edge(t);r.arrowheadId=d.uniqueId("arrowhead");var n=p.select(this).attr("marker-end",function(){return"url(#"+r.arrowheadId+")"}).style("fill","none");u.applyTransition(n,e).attr("d",function(t){return a(e,t)}),u.applyStyle(n,r.style)}),n.selectAll("defs *").remove(),n.selectAll("defs").each(function(t){var n=e.edge(t),a=r[n.arrowhead];a(p.select(this),n.arrowheadId,n,"arrowhead")}),n}function a(t,e){var r=t.edge(e),n=t.node(e.v),a=t.node(e.w),l=r.points.slice(1,r.points.length-1);return l.unshift(c(n,l[0])),l.push(c(a,l[l.length-1])),i(r,l)}function i(t,e){var r=p.svg.line().x(function(t){return t.x}).y(function(t){return t.y});return d.has(t,"lineInterpolate")&&r.interpolate(t.lineInterpolate),d.has(t,"lineTension")&&r.tension(Number(t.lineTension)),r(e)}function l(t){var e=t.getBBox(),r=t.getTransformToElement(t.ownerSVGElement).translate(e.width/2,e.height/2);return{x:r.e,y:r.f}}function s(t,e){var r=t.enter().append("g").attr("class","edgePath").style("opacity",0);r.append("path").attr("class","path").attr("d",function(t){var r=e.edge(t),n=e.node(t.v).elem,a=d.range(r.points.length).map(function(){return l(n)});return i(r,a)}),r.append("defs")}function o(t,e){var r=t.exit();u.applyTransition(r,e).style("opacity",0).remove(),u.applyTransition(r.select("path.path"),e).attr("d",function(t){var r=e.node(t.v);if(r){var n=d.range(this.pathSegList.length).map(function(){return r});return i({},n)}return p.select(this).attr("d")})}var d=t("./lodash"),c=t("./intersect/intersect-node"),u=t("./util"),p=t("./d3");e.exports=n},{"./d3":7,"./intersect/intersect-node":14,"./lodash":21,"./util":27}],6:[function(t,e,r){"use strict";function n(t,e,r){var n=e.nodes().filter(function(t){return!l.isSubgraph(e,t)}),o=t.selectAll("g.node").data(n,function(t){return t}).classed("update",!0);return o.selectAll("*").remove(),o.enter().append("g").attr("class","node").style("opacity",0),o.each(function(t){var n=e.node(t),o=s.select(this),d=o.append("g").attr("class","label"),c=i(d,n),u=r[n.shape],p=a.pick(c.node().getBBox(),"width","height");n.elem=this,n.id&&o.attr("id",n.id),n.labelId&&d.attr("id",n.labelId),l.applyClass(o,n["class"],(o.classed("update")?"update ":"")+"node"),a.has(n,"width")&&(p.width=n.width),a.has(n,"height")&&(p.height=n.height),p.width+=n.paddingLeft+n.paddingRight,p.height+=n.paddingTop+n.paddingBottom,d.attr("transform","translate("+(n.paddingLeft-n.paddingRight)/2+","+(n.paddingTop-n.paddingBottom)/2+")");var h=u(s.select(this),p,n);l.applyStyle(h,n.style);var f=h.node().getBBox();n.width=f.width,n.height=f.height}),l.applyTransition(o.exit(),e).style("opacity",0).remove(),o}var a=t("./lodash"),i=t("./label/add-label"),l=t("./util"),s=t("./d3");e.exports=n},{"./d3":7,"./label/add-label":18,"./lodash":21,"./util":27}],7:[function(t,e,r){e.exports=window.d3},{}],8:[function(t,e,r){var n;if(t)try{n=t("dagre")}catch(a){}n||(n=window.dagre),e.exports=n},{dagre:void 0}],9:[function(t,e,r){var n;if(t)try{n=t("graphlib")}catch(a){}n||(n=window.graphlib),e.exports=n},{graphlib:void 0}],10:[function(t,e,r){e.exports={node:t("./intersect-node"),circle:t("./intersect-circle"),ellipse:t("./intersect-ellipse"),polygon:t("./intersect-polygon"),rect:t("./intersect-rect")}},{"./intersect-circle":11,"./intersect-ellipse":12,"./intersect-node":14,"./intersect-polygon":15,"./intersect-rect":16}],11:[function(t,e,r){function n(t,e,r){return a(t,e,e,r)}var a=t("./intersect-ellipse");e.exports=n},{"./intersect-ellipse":12}],12:[function(t,e,r){function n(t,e,r,n){var a=t.x,i=t.y,l=a-n.x,s=i-n.y,o=Math.sqrt(e*e*s*s+r*r*l*l),d=Math.abs(e*r*l/o);n.x<a&&(d=-d);var c=Math.abs(e*r*s/o);return n.y<i&&(c=-c),{x:a+d,y:i+c}}e.exports=n},{}],13:[function(t,e,r){function n(t,e,r,n){var i,l,s,o,d,c,u,p,h,f,g,y,v,x,b;return i=e.y-t.y,s=t.x-e.x,d=e.x*t.y-t.x*e.y,h=i*r.x+s*r.y+d,f=i*n.x+s*n.y+d,0!==h&&0!==f&&a(h,f)||(l=n.y-r.y,o=r.x-n.x,c=n.x*r.y-r.x*n.y,u=l*t.x+o*t.yy+c,p=l*e.x+o*e.y+c,0!==u&&0!==p&&a(u,p)||(g=i*o-l*s,0===g))?void 0:(y=Math.abs(g/2),v=s*c-o*d,x=0>v?(v-y)/g:(v+y)/g,v=l*d-i*c,b=0>v?(v-y)/g:(v+y)/g,{x:x,y:b})}function a(t,e){return t*e>0}e.exports=n},{}],14:[function(t,e,r){function n(t,e){return t.intersect(e)}e.exports=n},{}],15:[function(t,e,r){function n(t,e,r){var n=t.x,i=t.y,l=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;e.forEach(function(t){s=Math.min(s,t.x),o=Math.min(o,t.y)});for(var d=n-t.width/2-s,c=i-t.height/2-o,u=0;u<e.length;u++){var p=e[u],h=e[u<e.length-1?u+1:0],f=a(t,r,{x:d+p.x,y:c+p.y},{x:d+h.x,y:c+h.y});f&&l.push(f)}return l.length?(l.length>1&&l.sort(function(t,e){var n=t.x-r.x,a=t.y-r.y,i=Math.sqrt(n*n+a*a),l=e.x-r.x,s=e.y-r.y,o=Math.sqrt(l*l+s*s);return o>i?-1:i===o?0:1}),l[0]):(console.log("NO INTERSECTION FOUND, RETURN NODE CENTER",t),t)}var a=t("./intersect-line");e.exports=n},{"./intersect-line":13}],16:[function(t,e,r){function n(t,e){var r,n,a=t.x,i=t.y,l=e.x-a,s=e.y-i,o=t.width/2,d=t.height/2;return Math.abs(s)*o>Math.abs(l)*d?(0>s&&(d=-d),r=0===s?0:d*l/s,n=d):(0>l&&(o=-o),r=o,n=0===l?0:o*s/l),{x:a+r,y:i+n}}e.exports=n},{}],17:[function(t,e,r){function n(t,e){var r=t.append("foreignObject").attr("width","100000"),n=r.append("xhtml:div"),i=e.label;switch(typeof i){case"function":n.insert(i);break;case"object":n.insert(function(){return i});break;default:n.html(i)}a.applyStyle(n,e.labelStyle),n.style("display","inline-block"),n.style("white-space","nowrap");var l,s;return n.each(function(){l=this.clientWidth,s=this.clientHeight}),r.attr("width",l).attr("height",s),r}var a=t("../util");e.exports=n},{"../util":27}],18:[function(t,e,r){function n(t,e,r){var n=e.label,s=t.append("g");"svg"===e.labelType?l(s,e):"string"!=typeof n||"html"===e.labelType?i(s,e):a(s,e);var o=s.node().getBBox();switch(r){case"top":y=-e.height/2;break;case"bottom":y=e.height/2-o.height;break;default:y=-o.height/2}return s.attr("transform","translate("+-o.width/2+","+y+")"),s}var a=t("./add-text-label"),i=t("./add-html-label"),l=t("./add-svg-label");e.exports=n},{"./add-html-label":17,"./add-svg-label":19,"./add-text-label":20}],19:[function(t,e,r){function n(t,e){var r=t;return r.node().appendChild(e.label),a.applyStyle(r,e.labelStyle),r}var a=t("../util");e.exports=n},{"../util":27}],20:[function(t,e,r){function n(t,e){for(var r=t.append("text"),n=a(e.label).split("\n"),l=0;l<n.length;l++)r.append("tspan").attr("xml:space","preserve").attr("dy","1em").attr("x","1").text(n[l]);return i.applyStyle(r,e.labelStyle),r}function a(t){for(var e,r="",n=!1,a=0;a<t.length;++a)if(e=t[a],n){switch(e){case"n":r+="\n";break;default:r+=e}n=!1}else"\\"===e?n=!0:r+=e;return r}var i=t("../util");e.exports=n},{"../util":27}],21:[function(t,e,r){var n;if(t)try{n=t("lodash")}catch(a){}n||(n=window._),e.exports=n},{lodash:void 0}],22:[function(t,e,r){"use strict";function n(t,e){function r(t){var r=e.node(t);return"translate("+r.x+","+r.y+")"}var n=t.filter(function(){return!i.select(this).classed("update")});n.attr("transform",r),a.applyTransition(t,e).style("opacity",1).attr("transform",r),a.applyTransition(n.selectAll("rect"),e).attr("width",function(t){return e.node(t).width}).attr("height",function(t){return e.node(t).height}).attr("x",function(t){var r=e.node(t);return-r.width/2}).attr("y",function(t){var r=e.node(t);return-r.height/2})}var a=t("./util"),i=t("./d3");e.exports=n},{"./d3":7,"./util":27}],23:[function(t,e,r){"use strict";function n(t,e){function r(t){var r=e.edge(t);return l.has(r,"x")?"translate("+r.x+","+r.y+")":""}var n=t.filter(function(){return!i.select(this).classed("update")});n.attr("transform",r),a.applyTransition(t,e).style("opacity",1).attr("transform",r)}var a=t("./util"),i=t("./d3"),l=t("./lodash");e.exports=n},{"./d3":7,"./lodash":21,"./util":27}],24:[function(t,e,r){"use strict";function n(t,e){function r(t){var r=e.node(t);return"translate("+r.x+","+r.y+")"}var n=t.filter(function(){return!i.select(this).classed("update")});n.attr("transform",r),a.applyTransition(t,e).style("opacity",1).attr("transform",r)}var a=t("./util"),i=t("./d3");e.exports=n},{"./d3":7,"./util":27}],25:[function(t,e,r){function n(){var e=t("./create-nodes"),r=t("./create-clusters"),n=t("./create-edge-labels"),s=t("./create-edge-paths"),d=t("./position-nodes"),c=t("./position-edge-labels"),u=t("./position-clusters"),p=t("./shapes"),h=t("./arrows"),f=function(t,f){a(f);var g=l(t,"output"),y=l(g,"clusters"),v=l(g,"edgePaths"),x=n(l(g,"edgeLabels"),f),b=e(l(g,"nodes"),f,p);o(f),d(b,f),c(x,f),s(v,f,h),r(y,f),u(y.selectAll("g.cluster"),f),i(f)};return f.createNodes=function(t){return arguments.length?(e=t,f):e},f.createClusters=function(t){return arguments.length?(r=t,f):r},f.createEdgeLabels=function(t){return arguments.length?(n=t,f):n},f.createEdgePaths=function(t){return arguments.length?(s=t,f):s},f.shapes=function(t){return arguments.length?(p=t,f):p},f.arrows=function(t){return arguments.length?(h=t,f):h},f}function a(t){t.nodes().forEach(function(e){var r=t.node(e);s.has(r,"label")||(r.label=e),s.has(r,"paddingX")&&s.defaults(r,{paddingLeft:r.paddingX,paddingRight:r.paddingX}),s.has(r,"paddingY")&&s.defaults(r,{paddingTop:r.paddingY,paddingBottom:r.paddingY}),s.has(r,"padding")&&s.defaults(r,{paddingLeft:r.padding,paddingRight:r.padding,paddingTop:r.padding,paddingBottom:r.padding}),s.defaults(r,d),s.each(["paddingLeft","paddingRight","paddingTop","paddingBottom"],function(t){r[t]=Number(r[t])}),s.has(r,"width")&&(r._prevWidth=r.width),s.has(r,"height")&&(r._prevHeight=r.height)}),t.edges().forEach(function(e){var r=t.edge(e);s.has(r,"label")||(r.label=""),s.defaults(r,c)})}function i(t){s.each(t.nodes(),function(e){var r=t.node(e);s.has(r,"_prevWidth")?r.width=r._prevWidth:delete r.width,s.has(r,"_prevHeight")?r.height=r._prevHeight:delete r.height,delete r._prevWidth,delete r._prevHeight})}function l(t,e){var r=t.select("g."+e);return r.empty()&&(r=t.append("g").attr("class",e)),r}var s=t("./lodash"),o=t("./dagre").layout;e.exports=n;var d={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},c={arrowhead:"normal",lineInterpolate:"linear"}},{"./arrows":2,"./create-clusters":3,"./create-edge-labels":4,"./create-edge-paths":5,"./create-nodes":6,"./dagre":8,"./lodash":21,"./position-clusters":22,"./position-edge-labels":23,"./position-nodes":24,"./shapes":26}],26:[function(t,e,r){"use strict";function n(t,e,r){var n=t.insert("rect",":first-child").attr("rx",r.rx).attr("ry",r.ry).attr("x",-e.width/2).attr("y",-e.height/2).attr("width",e.width).attr("height",e.height);return r.intersect=function(t){return s(r,t)},n}function a(t,e,r){var n=e.width/2,a=e.height/2,i=t.insert("ellipse",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("rx",n).attr("ry",a);return r.intersect=function(t){return o(r,n,a,t)},i}function i(t,e,r){var n=Math.max(e.width,e.height)/2,a=t.insert("circle",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("r",n);return r.intersect=function(t){return d(r,n,t)},a}function l(t,e,r){var n=e.width*Math.SQRT2/2,a=e.height*Math.SQRT2/2,i=[{x:0,y:-a},{x:-n,y:0},{x:0,y:a},{x:n,y:0}],l=t.insert("polygon",":first-child").attr("points",i.map(function(t){return t.x+","+t.y}).join(" "));return r.intersect=function(t){return c(r,i,t)},l}var s=t("./intersect/intersect-rect"),o=t("./intersect/intersect-ellipse"),d=t("./intersect/intersect-circle"),c=t("./intersect/intersect-polygon");e.exports={rect:n,ellipse:a,circle:i,diamond:l}},{"./intersect/intersect-circle":11,"./intersect/intersect-ellipse":12,"./intersect/intersect-polygon":15,"./intersect/intersect-rect":16}],27:[function(t,e,r){function n(t,e){return!!t.children(e).length}function a(t){return i(t.v)+":"+i(t.w)+":"+i(t.name)}function i(t){return t?String(t).replace(c,"\\:"):""}function l(t,e){e&&t.attr("style",e)}function s(t,e,r){e&&t.attr("class",e).attr("class",r+" "+t.attr("class"))}function o(t,e){var r=e.graph();if(d.isPlainObject(r)){var n=r.transition;if(d.isFunction(n))return n(t)}return t}var d=t("./lodash");e.exports={isSubgraph:n,edgeToId:a,applyStyle:l,applyClass:s,applyTransition:o};var c=/:/g},{"./lodash":21}],28:[function(t,e,r){e.exports="0.4.5"},{}]},{},[1])(1)});
e.exports={graphlib:t("./lib/graphlib"),dagre:t("./lib/dagre"),intersect:t("./lib/intersect"),render:t("./lib/render"),util:t("./lib/util"),version:t("./lib/version")}},{"./lib/dagre":8,"./lib/graphlib":9,"./lib/intersect":10,"./lib/render":25,"./lib/util":27,"./lib/version":28}],2:[function(t,e,r){function n(t,e,r,n){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),i=a.append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.applyStyle(i,r[n+"Style"])}function a(t,e,r,n){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),i=a.append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.applyStyle(i,r[n+"Style"])}function i(t,e,r,n){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),i=a.append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");l.applyStyle(i,r[n+"Style"])}var l=t("./util");e.exports={"default":n,normal:n,vee:a,undirected:i}},{"./util":27}],3:[function(t,e,r){function n(t,e){var r=e.nodes().filter(function(t){return a.isSubgraph(e,t)}),n=t.selectAll("g.cluster").data(r,function(t){return t});return n.selectAll("*").remove(),n.enter().append("g").attr("class","cluster").style("opacity",0),a.applyTransition(n,e).style("opacity",1),n.each(function(t){var r=e.node(t),n=d3.select(this),a=n.append("g").attr("class","label");d3.select(this).append("rect"),i(a,r,r.clusterLabelPos)}),n.selectAll("rect").each(function(t){var r=e.node(t),n=d3.select(this);a.applyStyle(n,r.style)}),a.applyTransition(n.exit(),e).style("opacity",0).remove(),n}var a=t("./util"),i=t("./label/add-label");e.exports=n},{"./label/add-label":18,"./util":27}],4:[function(t,e,r){"use strict";function n(t,e){var r=t.selectAll("g.edgeLabel").data(e.edges(),function(t){return l.edgeToId(t)}).classed("update",!0);return r.selectAll("*").remove(),r.enter().append("g").classed("edgeLabel",!0).style("opacity",0),r.each(function(t){var r=e.edge(t),n=i(s.select(this),e.edge(t),0,0).classed("label",!0),l=n.node().getBBox();r.labelId&&n.attr("id",r.labelId),a.has(r,"width")||(r.width=l.width),a.has(r,"height")||(r.height=l.height)}),l.applyTransition(r.exit(),e).style("opacity",0).remove(),r}var a=t("./lodash"),i=t("./label/add-label"),l=t("./util"),s=t("./d3");e.exports=n},{"./d3":7,"./label/add-label":18,"./lodash":21,"./util":27}],5:[function(t,e,r){"use strict";function n(t,e,r){var n=t.selectAll("g.edgePath").data(e.edges(),function(t){return u.edgeToId(t)}).classed("update",!0);return s(n,e),o(n,e),u.applyTransition(n,e).style("opacity",1),n.each(function(t){var r=p.select(this),n=e.edge(t);n.elem=this,n.id&&r.attr("id",n.id),u.applyClass(r,n["class"],(r.classed("update")?"update ":"")+"edgePath")}),n.selectAll("path.path").each(function(t){var r=e.edge(t);r.arrowheadId=d.uniqueId("arrowhead");var n=p.select(this).attr("marker-end",function(){return"url(#"+r.arrowheadId+")"}).style("fill","none");u.applyTransition(n,e).attr("d",function(t){return a(e,t)}),u.applyStyle(n,r.style)}),n.selectAll("defs *").remove(),n.selectAll("defs").each(function(t){var n=e.edge(t),a=r[n.arrowhead];a(p.select(this),n.arrowheadId,n,"arrowhead")}),n}function a(t,e){var r=t.edge(e),n=t.node(e.v),a=t.node(e.w),l=r.points.slice(1,r.points.length-1);return l.unshift(c(n,l[0])),l.push(c(a,l[l.length-1])),i(r,l)}function i(t,e){var r=p.svg.line().x(function(t){return t.x}).y(function(t){return t.y});return d.has(t,"lineInterpolate")&&r.interpolate(t.lineInterpolate),d.has(t,"lineTension")&&r.tension(Number(t.lineTension)),r(e)}function l(t){var e=t.getBBox(),r=t.getTransformToElement(t.ownerSVGElement).translate(e.width/2,e.height/2);return{x:r.e,y:r.f}}function s(t,e){var r=t.enter().append("g").attr("class","edgePath").style("opacity",0);r.append("path").attr("class","path").attr("d",function(t){var r=e.edge(t),n=e.node(t.v).elem,a=d.range(r.points.length).map(function(){return l(n)});return i(r,a)}),r.append("defs")}function o(t,e){var r=t.exit();u.applyTransition(r,e).style("opacity",0).remove(),u.applyTransition(r.select("path.path"),e).attr("d",function(t){var r=e.node(t.v);if(r){var n=d.range(this.pathSegList.length).map(function(){return r});return i({},n)}return p.select(this).attr("d")})}var d=t("./lodash"),c=t("./intersect/intersect-node"),u=t("./util"),p=t("./d3");e.exports=n},{"./d3":7,"./intersect/intersect-node":14,"./lodash":21,"./util":27}],6:[function(t,e,r){"use strict";function n(t,e,r){var n=e.nodes().filter(function(t){return!l.isSubgraph(e,t)}),o=t.selectAll("g.node").data(n,function(t){return t}).classed("update",!0);return o.selectAll("*").remove(),o.enter().append("g").attr("class","node").style("opacity",0),o.each(function(t){var n=e.node(t),o=s.select(this),d=o.append("g").attr("class","label"),c=i(d,n),u=r[n.shape],p=a.pick(c.node().getBBox(),"width","height");n.elem=this,n.id&&o.attr("id",n.id),n.labelId&&d.attr("id",n.labelId),l.applyClass(o,n["class"],(o.classed("update")?"update ":"")+"node"),a.has(n,"width")&&(p.width=n.width),a.has(n,"height")&&(p.height=n.height),p.width+=n.paddingLeft+n.paddingRight,p.height+=n.paddingTop+n.paddingBottom,d.attr("transform","translate("+(n.paddingLeft-n.paddingRight)/2+","+(n.paddingTop-n.paddingBottom)/2+")");var h=u(s.select(this),p,n);l.applyStyle(h,n.style);var f=h.node().getBBox();n.width=f.width,n.height=f.height}),l.applyTransition(o.exit(),e).style("opacity",0).remove(),o}var a=t("./lodash"),i=t("./label/add-label"),l=t("./util"),s=t("./d3");e.exports=n},{"./d3":7,"./label/add-label":18,"./lodash":21,"./util":27}],7:[function(t,e,r){e.exports=window.d3},{}],8:[function(t,e,r){var n;if(t)try{n=t("dagre")}catch(a){}n||(n=window.dagre),e.exports=n},{dagre:void 0}],9:[function(t,e,r){var n;if(t)try{n=t("graphlib")}catch(a){}n||(n=window.graphlib),e.exports=n},{graphlib:void 0}],10:[function(t,e,r){e.exports={node:t("./intersect-node"),circle:t("./intersect-circle"),ellipse:t("./intersect-ellipse"),polygon:t("./intersect-polygon"),rect:t("./intersect-rect")}},{"./intersect-circle":11,"./intersect-ellipse":12,"./intersect-node":14,"./intersect-polygon":15,"./intersect-rect":16}],11:[function(t,e,r){function n(t,e,r){return a(t,e,e,r)}var a=t("./intersect-ellipse");e.exports=n},{"./intersect-ellipse":12}],12:[function(t,e,r){function n(t,e,r,n){var a=t.x,i=t.y,l=a-n.x,s=i-n.y,o=Math.sqrt(e*e*s*s+r*r*l*l),d=Math.abs(e*r*l/o);n.x<a&&(d=-d);var c=Math.abs(e*r*s/o);return n.y<i&&(c=-c),{x:a+d,y:i+c}}e.exports=n},{}],13:[function(t,e,r){function n(t,e,r,n){var i,l,s,o,d,c,u,p,h,f,g,y,v,x,b;return i=e.y-t.y,s=t.x-e.x,d=e.x*t.y-t.x*e.y,h=i*r.x+s*r.y+d,f=i*n.x+s*n.y+d,0!==h&&0!==f&&a(h,f)||(l=n.y-r.y,o=r.x-n.x,c=n.x*r.y-r.x*n.y,u=l*t.x+o*t.yy+c,p=l*e.x+o*e.y+c,0!==u&&0!==p&&a(u,p)||(g=i*o-l*s,0===g))?void 0:(y=Math.abs(g/2),v=s*c-o*d,x=0>v?(v-y)/g:(v+y)/g,v=l*d-i*c,b=0>v?(v-y)/g:(v+y)/g,{x:x,y:b})}function a(t,e){return t*e>0}e.exports=n},{}],14:[function(t,e,r){function n(t,e){return t.intersect(e)}e.exports=n},{}],15:[function(t,e,r){function n(t,e,r){var n=t.x,i=t.y,l=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;e.forEach(function(t){s=Math.min(s,t.x),o=Math.min(o,t.y)});for(var d=n-t.width/2-s,c=i-t.height/2-o,u=0;u<e.length;u++){var p=e[u],h=e[u<e.length-1?u+1:0],f=a(t,r,{x:d+p.x,y:c+p.y},{x:d+h.x,y:c+h.y});f&&l.push(f)}return l.length?(l.length>1&&l.sort(function(t,e){var n=t.x-r.x,a=t.y-r.y,i=Math.sqrt(n*n+a*a),l=e.x-r.x,s=e.y-r.y,o=Math.sqrt(l*l+s*s);return o>i?-1:i===o?0:1}),l[0]):(console.log("NO INTERSECTION FOUND, RETURN NODE CENTER",t),t)}var a=t("./intersect-line");e.exports=n},{"./intersect-line":13}],16:[function(t,e,r){function n(t,e){var r,n,a=t.x,i=t.y,l=e.x-a,s=e.y-i,o=t.width/2,d=t.height/2;return Math.abs(s)*o>Math.abs(l)*d?(0>s&&(d=-d),r=0===s?0:d*l/s,n=d):(0>l&&(o=-o),r=o,n=0===l?0:o*s/l),{x:a+r,y:i+n}}e.exports=n},{}],17:[function(t,e,r){function n(t,e){var r=t.append("foreignObject").attr("width","100000"),n=r.append("xhtml:div"),i=e.label;switch(typeof i){case"function":n.insert(i);break;case"object":n.insert(function(){return i});break;default:n.html(i)}a.applyStyle(n,e.labelStyle),n.style("display","inline-block"),n.style("white-space","nowrap");var l,s;return n.each(function(){l=this.clientWidth,s=this.clientHeight}),r.attr("width",l).attr("height",s),r}var a=t("../util");e.exports=n},{"../util":27}],18:[function(t,e,r){function n(t,e,r){var n=e.label,s=t.append("g");"svg"===e.labelType?l(s,e):"string"!=typeof n||"html"===e.labelType?i(s,e):a(s,e);var o=s.node().getBBox();switch(r){case"top":y=-e.height/2;break;case"bottom":y=e.height/2-o.height;break;default:y=-o.height/2}return s.attr("transform","translate("+-o.width/2+","+y+")"),s}var a=t("./add-text-label"),i=t("./add-html-label"),l=t("./add-svg-label");e.exports=n},{"./add-html-label":17,"./add-svg-label":19,"./add-text-label":20}],19:[function(t,e,r){function n(t,e){var r=t;return r.node().appendChild(e.label),a.applyStyle(r,e.labelStyle),r}var a=t("../util");e.exports=n},{"../util":27}],20:[function(t,e,r){function n(t,e){for(var r=t.append("text"),n=a(e.label).split("\n"),l=0;l<n.length;l++)r.append("tspan").attr("xml:space","preserve").attr("dy","1em").attr("x","1").text(n[l]);return i.applyStyle(r,e.labelStyle),r}function a(t){for(var e,r="",n=!1,a=0;a<t.length;++a)if(e=t[a],n){switch(e){case"n":r+="\n";break;default:r+=e}n=!1}else"\\"===e?n=!0:r+=e;return r}var i=t("../util");e.exports=n},{"../util":27}],21:[function(t,e,r){var n;if(t)try{n=t("lodash")}catch(a){}n||(n=window._),e.exports=n},{lodash:void 0}],22:[function(t,e,r){"use strict";function n(t,e){function r(t){var r=e.node(t);return"translate("+r.x+","+r.y+")"}var n=t.filter(function(){return!i.select(this).classed("update")});n.attr("transform",r),a.applyTransition(t,e).style("opacity",1).attr("transform",r),a.applyTransition(n.selectAll("rect"),e).attr("width",function(t){return e.node(t).width}).attr("height",function(t){return e.node(t).height}).attr("x",function(t){var r=e.node(t);return-r.width/2}).attr("y",function(t){var r=e.node(t);return-r.height/2})}var a=t("./util"),i=t("./d3");e.exports=n},{"./d3":7,"./util":27}],23:[function(t,e,r){"use strict";function n(t,e){function r(t){var r=e.edge(t);return l.has(r,"x")?"translate("+r.x+","+r.y+")":""}var n=t.filter(function(){return!i.select(this).classed("update")});n.attr("transform",r),a.applyTransition(t,e).style("opacity",1).attr("transform",r)}var a=t("./util"),i=t("./d3"),l=t("./lodash");e.exports=n},{"./d3":7,"./lodash":21,"./util":27}],24:[function(t,e,r){"use strict";function n(t,e){function r(t){var r=e.node(t);return"translate("+r.x+","+r.y+")"}var n=t.filter(function(){return!i.select(this).classed("update")});n.attr("transform",r),a.applyTransition(t,e).style("opacity",1).attr("transform",r)}var a=t("./util"),i=t("./d3");e.exports=n},{"./d3":7,"./util":27}],25:[function(t,e,r){function n(){var e=t("./create-nodes"),r=t("./create-clusters"),n=t("./create-edge-labels"),s=t("./create-edge-paths"),d=t("./position-nodes"),c=t("./position-edge-labels"),u=t("./position-clusters"),p=t("./shapes"),h=t("./arrows"),f=function(t,f){a(f);var g=l(t,"output"),y=l(g,"clusters"),v=l(g,"edgePaths"),x=n(l(g,"edgeLabels"),f),b=e(l(g,"nodes"),f,p);o(f),d(b,f),c(x,f),s(v,f,h);var m=r(y,f);u(m,f),i(f)};return f.createNodes=function(t){return arguments.length?(e=t,f):e},f.createClusters=function(t){return arguments.length?(r=t,f):r},f.createEdgeLabels=function(t){return arguments.length?(n=t,f):n},f.createEdgePaths=function(t){return arguments.length?(s=t,f):s},f.shapes=function(t){return arguments.length?(p=t,f):p},f.arrows=function(t){return arguments.length?(h=t,f):h},f}function a(t){t.nodes().forEach(function(e){var r=t.node(e);s.has(r,"label")||t.children(e).length||(r.label=e),s.has(r,"paddingX")&&s.defaults(r,{paddingLeft:r.paddingX,paddingRight:r.paddingX}),s.has(r,"paddingY")&&s.defaults(r,{paddingTop:r.paddingY,paddingBottom:r.paddingY}),s.has(r,"padding")&&s.defaults(r,{paddingLeft:r.padding,paddingRight:r.padding,paddingTop:r.padding,paddingBottom:r.padding}),s.defaults(r,d),s.each(["paddingLeft","paddingRight","paddingTop","paddingBottom"],function(t){r[t]=Number(r[t])}),s.has(r,"width")&&(r._prevWidth=r.width),s.has(r,"height")&&(r._prevHeight=r.height)}),t.edges().forEach(function(e){var r=t.edge(e);s.has(r,"label")||(r.label=""),s.defaults(r,c)})}function i(t){s.each(t.nodes(),function(e){var r=t.node(e);s.has(r,"_prevWidth")?r.width=r._prevWidth:delete r.width,s.has(r,"_prevHeight")?r.height=r._prevHeight:delete r.height,delete r._prevWidth,delete r._prevHeight})}function l(t,e){var r=t.select("g."+e);return r.empty()&&(r=t.append("g").attr("class",e)),r}var s=t("./lodash"),o=t("./dagre").layout;e.exports=n;var d={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},c={arrowhead:"normal",lineInterpolate:"linear"}},{"./arrows":2,"./create-clusters":3,"./create-edge-labels":4,"./create-edge-paths":5,"./create-nodes":6,"./dagre":8,"./lodash":21,"./position-clusters":22,"./position-edge-labels":23,"./position-nodes":24,"./shapes":26}],26:[function(t,e,r){"use strict";function n(t,e,r){var n=t.insert("rect",":first-child").attr("rx",r.rx).attr("ry",r.ry).attr("x",-e.width/2).attr("y",-e.height/2).attr("width",e.width).attr("height",e.height);return r.intersect=function(t){return s(r,t)},n}function a(t,e,r){var n=e.width/2,a=e.height/2,i=t.insert("ellipse",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("rx",n).attr("ry",a);return r.intersect=function(t){return o(r,n,a,t)},i}function i(t,e,r){var n=Math.max(e.width,e.height)/2,a=t.insert("circle",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("r",n);return r.intersect=function(t){return d(r,n,t)},a}function l(t,e,r){var n=e.width*Math.SQRT2/2,a=e.height*Math.SQRT2/2,i=[{x:0,y:-a},{x:-n,y:0},{x:0,y:a},{x:n,y:0}],l=t.insert("polygon",":first-child").attr("points",i.map(function(t){return t.x+","+t.y}).join(" "));return r.intersect=function(t){return c(r,i,t)},l}var s=t("./intersect/intersect-rect"),o=t("./intersect/intersect-ellipse"),d=t("./intersect/intersect-circle"),c=t("./intersect/intersect-polygon");e.exports={rect:n,ellipse:a,circle:i,diamond:l}},{"./intersect/intersect-circle":11,"./intersect/intersect-ellipse":12,"./intersect/intersect-polygon":15,"./intersect/intersect-rect":16}],27:[function(t,e,r){function n(t,e){return!!t.children(e).length}function a(t){return i(t.v)+":"+i(t.w)+":"+i(t.name)}function i(t){return t?String(t).replace(c,"\\:"):""}function l(t,e){e&&t.attr("style",e)}function s(t,e,r){e&&t.attr("class",e).attr("class",r+" "+t.attr("class"))}function o(t,e){var r=e.graph();if(d.isPlainObject(r)){var n=r.transition;if(d.isFunction(n))return n(t)}return t}var d=t("./lodash");e.exports={isSubgraph:n,edgeToId:a,applyStyle:l,applyClass:s,applyTransition:o};var c=/:/g},{"./lodash":21}],28:[function(t,e,r){e.exports="0.4.6"},{}]},{},[1])(1)});
//# sourceMappingURL=dagre-d3.core.min.js.map

@@ -15,7 +15,3 @@ var util = require("./util"),

.attr("class", "cluster")
.style("opacity", 0)
.append("rect");
util.applyTransition(svgClusters.exit(), g)
.style("opacity", 0)
.remove();
.style("opacity", 0);

@@ -29,2 +25,3 @@ util.applyTransition(svgClusters, g)

labelGroup = thisGroup.append("g").attr("class", "label");
d3.select(this).append("rect");
addLabel(labelGroup, node, node.clusterLabelPos);

@@ -38,2 +35,8 @@ });

});
util.applyTransition(svgClusters.exit(), g)
.style("opacity", 0)
.remove();
return svgClusters;
}

@@ -32,5 +32,6 @@ var _ = require("./lodash"),

createEdgePaths(edgePathsGroup, g, arrows);
createClusters(clustersGroup, g);
positionClusters(clustersGroup.selectAll("g.cluster"), g);
var clusters = createClusters(clustersGroup, g);
positionClusters(clusters, g);
postProcessGraph(g);

@@ -96,3 +97,3 @@ };

var node = g.node(v);
if (!_.has(node, "label")) { node.label = v; }
if (!_.has(node, "label") && !g.children(v).length) { node.label = v; }

@@ -99,0 +100,0 @@ if (_.has(node, "paddingX")) {

@@ -1,1 +0,1 @@

module.exports = "0.4.5";
module.exports = "0.4.6";
{
"name": "dagre-d3",
"version": "0.4.5",
"version": "0.4.6",
"description": "A D3-based renderer for Dagre",

@@ -5,0 +5,0 @@ "author": "Chris Pettitt <chris@samsarin.com>",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc