08-27-周三_17-09-29
This commit is contained in:
2
node_modules/dagre-d3-renderer/.ackrc
generated
vendored
Normal file
2
node_modules/dagre-d3-renderer/.ackrc
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
--ignore-file=match:/^yarn\.lock$/
|
||||
--ignore-dir=dist
|
5
node_modules/dagre-d3-renderer/.babelrc
generated
vendored
Normal file
5
node_modules/dagre-d3-renderer/.babelrc
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"presets": [
|
||||
"env"
|
||||
]
|
||||
}
|
12
node_modules/dagre-d3-renderer/.editorconfig
generated
vendored
Normal file
12
node_modules/dagre-d3-renderer/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
indent_size = 4
|
7
node_modules/dagre-d3-renderer/LICENSE
generated
vendored
Normal file
7
node_modules/dagre-d3-renderer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright 2017 Tyler Long
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
35
node_modules/dagre-d3-renderer/README.md
generated
vendored
Normal file
35
node_modules/dagre-d3-renderer/README.md
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# dagre-d3-renderer - A D3-based renderer for dagre
|
||||
|
||||
This project is an out-of-box replacement for [dagre-d3](https://github.com/cpettitt/dagre-d3) which is not being actively developed or maintained.
|
||||
|
||||
This project isn't built from scratch. It's based on the original [dagre-d3](https://github.com/cpettitt/dagre-d3) project.
|
||||
|
||||
[Dagre](https://github.com/cpettitt/dagre) is a JavaScript library that makes it easy to lay out directed graphs on the client-side. The dagre-d3 library acts as a front-end to dagre, providing actual rendering using [D3](http://d3js.org).
|
||||
|
||||
For more details, including examples and configuration options, please see our [wiki](https://github.com/cpettitt/dagre-d3/wiki).
|
||||
|
||||
|
||||
## Setup
|
||||
|
||||
```
|
||||
yarn install
|
||||
```
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
```
|
||||
yarn build
|
||||
```
|
||||
|
||||
|
||||
## Test
|
||||
|
||||
```
|
||||
yarn test
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
dagre-d3-renderer is licensed under the terms of the MIT License. See the LICENSE file for details.
|
2
node_modules/dagre-d3-renderer/dist/dagre-d3.core.js
generated
vendored
Normal file
2
node_modules/dagre-d3-renderer/dist/dagre-d3.core.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/dagre-d3-renderer/dist/dagre-d3.core.js.map
generated
vendored
Normal file
1
node_modules/dagre-d3-renderer/dist/dagre-d3.core.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/dagre-d3-renderer/dist/dagre-d3.js
generated
vendored
Normal file
2
node_modules/dagre-d3-renderer/dist/dagre-d3.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/dagre-d3-renderer/dist/dagre-d3.js.map
generated
vendored
Normal file
1
node_modules/dagre-d3-renderer/dist/dagre-d3.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
75
node_modules/dagre-d3-renderer/dist/demo/arrows.html
generated
vendored
Normal file
75
node_modules/dagre-d3-renderer/dist/demo/arrows.html
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: Arrows</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<style id="css">
|
||||
body {
|
||||
font: 300 14px 'Helvetica Neue', Helvetica;
|
||||
}
|
||||
|
||||
.node rect,
|
||||
.node circle,
|
||||
.node ellipse {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.edgePath path {
|
||||
stroke: #333;
|
||||
fill: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>Dagre D3 Demo: Arrows</h1>
|
||||
|
||||
<svg width=960 height=600><g/></svg>
|
||||
|
||||
<section>
|
||||
<p>A sample that shows the different arrows available in dagre-d3.
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create a new directed graph
|
||||
var g = new dagreD3.graphlib.Graph().setGraph({});
|
||||
|
||||
["normal", "vee", "undirected"].forEach(function(arrowhead) {
|
||||
g.setNode(arrowhead + "1", { label: " " });
|
||||
g.setNode(arrowhead + "2", { label: " " });
|
||||
g.setEdge(arrowhead + "1", arrowhead + "2", {
|
||||
arrowhead: arrowhead,
|
||||
label: arrowhead
|
||||
});
|
||||
});
|
||||
|
||||
var svg = d3.select("svg"),
|
||||
inner = svg.select("g");
|
||||
|
||||
// Set up zoom support
|
||||
var zoom = d3.behavior.zoom().on("zoom", function() {
|
||||
inner.attr("transform", "translate(" + d3.event.translate + ")" +
|
||||
"scale(" + d3.event.scale + ")");
|
||||
});
|
||||
svg.call(zoom);
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(inner, g);
|
||||
|
||||
// Center the graph
|
||||
var initialScale = 0.75;
|
||||
zoom
|
||||
.translate([(svg.attr("width") - g.graph().width * initialScale) / 2, 20])
|
||||
.scale(initialScale)
|
||||
.event(svg);
|
||||
svg.attr('height', g.graph().height * initialScale + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
101
node_modules/dagre-d3-renderer/dist/demo/clusters.html
generated
vendored
Normal file
101
node_modules/dagre-d3-renderer/dist/demo/clusters.html
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: Clusters</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<h1>Dagre D3 Demo: Clusters</h1>
|
||||
|
||||
<style id="css">
|
||||
.clusters rect {
|
||||
fill: #00ffd0;
|
||||
stroke: #999;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
text {
|
||||
font-weight: 300;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.node rect {
|
||||
stroke: #999;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.edgePath path {
|
||||
stroke: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<svg id="svg-canvas" width=960 height=600></svg>
|
||||
|
||||
<section>
|
||||
<p>An example of visualizing clusters. This example shows
|
||||
how clusters can be applied to a rendered graph.
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create the input graph
|
||||
var g = new dagreD3.graphlib.Graph({compound:true})
|
||||
.setGraph({})
|
||||
.setDefaultEdgeLabel(function() { return {}; });
|
||||
|
||||
// Here we're setting the nodes
|
||||
g.setNode('a', {label: 'A'});
|
||||
g.setNode('b', {label: 'B'});
|
||||
g.setNode('c', {label: 'C'});
|
||||
g.setNode('d', {label: 'D'});
|
||||
g.setNode('e', {label: 'E'});
|
||||
g.setNode('f', {label: 'F'});
|
||||
g.setNode('g', {label: 'G'});
|
||||
g.setNode('group', {label: 'Group', clusterLabelPos: 'top', style: 'fill: #d3d7e8'});
|
||||
g.setNode('top_group', {label: 'Top Group', clusterLabelPos: 'bottom', style: 'fill: #ffd47f'});
|
||||
g.setNode('bottom_group', {label: 'Bottom Group', style: 'fill: #5f9488'});
|
||||
|
||||
// Set the parents to define which nodes belong to which cluster
|
||||
g.setParent('top_group', 'group');
|
||||
g.setParent('bottom_group', 'group');
|
||||
g.setParent('b', 'top_group');
|
||||
g.setParent('c', 'bottom_group');
|
||||
g.setParent('d', 'bottom_group');
|
||||
g.setParent('e', 'bottom_group');
|
||||
g.setParent('f', 'bottom_group');
|
||||
|
||||
// Set up edges, no special attributes.
|
||||
g.setEdge('a', 'b');
|
||||
g.setEdge('b', 'c');
|
||||
g.setEdge('b', 'd');
|
||||
g.setEdge('b', 'e');
|
||||
g.setEdge('b', 'f');
|
||||
g.setEdge('b', 'g');
|
||||
|
||||
g.nodes().forEach(function(v) {
|
||||
var node = g.node(v);
|
||||
// Round the corners of the nodes
|
||||
node.rx = node.ry = 5;
|
||||
});
|
||||
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Set up an SVG group so that we can translate the final graph.
|
||||
var svg = d3.select("svg"),
|
||||
svgGroup = svg.append("g");
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(d3.select("svg g"), g);
|
||||
|
||||
// Center the graph
|
||||
var xCenterOffset = (svg.attr("width") - g.graph().width) / 2;
|
||||
svgGroup.attr("transform", "translate(" + xCenterOffset + ", 20)");
|
||||
svg.attr("height", g.graph().height + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
35
node_modules/dagre-d3-renderer/dist/demo/demo.css
generated
vendored
Normal file
35
node_modules/dagre-d3-renderer/dist/demo/demo.css
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
body {
|
||||
width: 960px;
|
||||
margin: 0 auto;
|
||||
color: #333;
|
||||
font-weight: 300;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3em;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
section {
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
|
||||
section p {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
svg {
|
||||
border: 1px solid #ccc;
|
||||
overflow: hidden;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
pre {
|
||||
border: 1px solid #ccc;
|
||||
}
|
26
node_modules/dagre-d3-renderer/dist/demo/demo.js
generated
vendored
Normal file
26
node_modules/dagre-d3-renderer/dist/demo/demo.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
const d3 = window.d3
|
||||
const bodyElem = d3.select('body')
|
||||
const jsElem = d3.select('#js')
|
||||
const jsPanel = bodyElem.append('div').attr('id', 'jsPanel')
|
||||
const cssElem = d3.select('#css')
|
||||
const cssPanel = bodyElem.append('div').attr('id', 'cssPanel')
|
||||
|
||||
function setupPanel (panel, elem, title) {
|
||||
panel.append('h2').text(title)
|
||||
return panel.append('pre').append('code').text(elem.html().trim())
|
||||
}
|
||||
|
||||
const jsCode = setupPanel(jsPanel, jsElem, 'JavaScript')
|
||||
const cssCode = setupPanel(cssPanel, cssElem, 'CSS')
|
||||
|
||||
const hljsRoot = 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0'
|
||||
|
||||
bodyElem.append('link')
|
||||
.attr('rel', 'stylesheet')
|
||||
.attr('href', hljsRoot + '/styles/xcode.min.css')
|
||||
bodyElem.append('script')
|
||||
.attr('src', hljsRoot + '/highlight.min.js')
|
||||
.on('load', function () {
|
||||
window.hljs.highlightBlock(jsCode.node())
|
||||
window.hljs.highlightBlock(cssCode.node())
|
||||
})
|
98
node_modules/dagre-d3-renderer/dist/demo/dom.html
generated
vendored
Normal file
98
node_modules/dagre-d3-renderer/dist/demo/dom.html
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: DOM Example</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<h1>Dagre D3 Demo: DOM Example</h1>
|
||||
|
||||
<style id="css">
|
||||
text {
|
||||
font-weight: 300;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.node rect {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.edgePath path {
|
||||
stroke: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
table td {
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
table td:first-child {
|
||||
background-color: #afa;
|
||||
border-top: 1px solid #333;
|
||||
border-left: 1px solid #333;
|
||||
border-bottom: 1px solid #333;
|
||||
border-radius: 5px 0 0 5px;
|
||||
}
|
||||
|
||||
table td:last-child {
|
||||
background-color: #faa;
|
||||
border-top: 1px solid #333;
|
||||
border-right: 1px solid #333;
|
||||
border-bottom: 1px solid #333;
|
||||
border-radius: 0 5px 5px 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<svg width=960 height=600></svg>
|
||||
|
||||
<section>
|
||||
<p>A sample showing how to use DOM nodes in a graph. Note that IE does not
|
||||
support this technique.
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create a new directed graph
|
||||
var g = new dagreD3.graphlib.Graph().setGraph({});
|
||||
|
||||
g.setNode("root", {
|
||||
label: function() {
|
||||
var table = document.createElement("table"),
|
||||
tr = d3.select(table).append("tr");
|
||||
tr.append("td").text("A");
|
||||
tr.append("td").text("B");
|
||||
return table;
|
||||
},
|
||||
padding: 0,
|
||||
rx: 5,
|
||||
ry: 5
|
||||
});
|
||||
g.setNode("A", { label: "A", fill: "#afa" });
|
||||
g.setNode("B", { label: "B", fill: "#faa" });
|
||||
g.setEdge("root", "A", {});
|
||||
g.setEdge("root", "B", {});
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Set up an SVG group so that we can translate the final graph.
|
||||
var svg = d3.select('svg'),
|
||||
svgGroup = svg.append('g');
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(svgGroup, g);
|
||||
|
||||
// Center the graph
|
||||
var xCenterOffset = (svg.attr('width') - g.graph().width) / 2;
|
||||
svgGroup.attr('transform', 'translate(' + xCenterOffset + ', 20)');
|
||||
svg.attr('height', g.graph().height + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
283
node_modules/dagre-d3-renderer/dist/demo/etl-status.html
generated
vendored
Normal file
283
node_modules/dagre-d3-renderer/dist/demo/etl-status.html
generated
vendored
Normal file
@@ -0,0 +1,283 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Renderer Demo</title>
|
||||
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
background: #333;
|
||||
}
|
||||
|
||||
|
||||
@-webkit-keyframes flash {
|
||||
0%, 50%, 100% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
25%, 75% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes flash {
|
||||
0%, 50%, 100% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
25%, 75% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
.warn {
|
||||
-webkit-animation-duration: 5s;
|
||||
animation-duration: 5s;
|
||||
-webkit-animation-fill-mode: both;
|
||||
animation-fill-mode: both;
|
||||
-webkit-animation-iteration-count: 1;
|
||||
animation-iteration-count: 1;
|
||||
}
|
||||
|
||||
.live.map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.live.map text {
|
||||
font-weight: 300;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.live.map .node rect {
|
||||
stroke-width: 1.5px;
|
||||
stroke: #bbb;
|
||||
fill: #666;
|
||||
}
|
||||
|
||||
.live.map .status {
|
||||
height: 100%;
|
||||
width: 15px;
|
||||
display: block;
|
||||
float: left;
|
||||
border-top-left-radius: 5px;
|
||||
border-bottom-left-radius: 5px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.live.map .running .status {
|
||||
background-color: #7f7;
|
||||
}
|
||||
|
||||
.live.map .running.warn .status {
|
||||
background-color: #ffed68;
|
||||
}
|
||||
|
||||
.live.map .stopped .status {
|
||||
background-color: #f77;
|
||||
}
|
||||
|
||||
.live.map .warn .queue {
|
||||
color: #f77;
|
||||
}
|
||||
|
||||
.warn {
|
||||
-webkit-animation-name: flash;
|
||||
animation-name: flash;
|
||||
}
|
||||
|
||||
.live.map .consumers {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.live.map .consumers,
|
||||
.live.map .name {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.live.map .consumers:after {
|
||||
content: "x";
|
||||
}
|
||||
|
||||
.live.map .queue {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 130px;
|
||||
height: 20px;
|
||||
font-size: 12px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.live.map .node g div {
|
||||
width: 200px;
|
||||
height: 40px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.live.map .node g div span.consumers {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
.live.map .edgeLabel text {
|
||||
width: 50px;
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.live.map .edgePath path {
|
||||
stroke: #999;
|
||||
stroke-width: 1.5px;
|
||||
fill: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="live map">
|
||||
<svg><g/></svg>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var workers = {
|
||||
"identifier": {
|
||||
"consumers": 2,
|
||||
"count": 20
|
||||
},
|
||||
"lost-and-found": {
|
||||
"consumers": 1,
|
||||
"count": 1,
|
||||
"inputQueue": "identifier",
|
||||
"inputThroughput": 50
|
||||
},
|
||||
"monitor": {
|
||||
"consumers": 1,
|
||||
"count": 0,
|
||||
"inputQueue": "identifier",
|
||||
"inputThroughput": 50
|
||||
},
|
||||
"meta-enricher": {
|
||||
"consumers": 4,
|
||||
"count": 9900,
|
||||
"inputQueue": "identifier",
|
||||
"inputThroughput": 50
|
||||
},
|
||||
"geo-enricher": {
|
||||
"consumers": 2,
|
||||
"count": 1,
|
||||
"inputQueue": "meta-enricher",
|
||||
"inputThroughput": 50
|
||||
},
|
||||
"elasticsearch-writer": {
|
||||
"consumers": 0,
|
||||
"count": 9900,
|
||||
"inputQueue": "geo-enricher",
|
||||
"inputThroughput": 50
|
||||
}
|
||||
};
|
||||
|
||||
// Set up zoom support
|
||||
var svg = d3.select("svg"),
|
||||
inner = svg.select("g"),
|
||||
zoom = d3.behavior.zoom().on("zoom", function() {
|
||||
inner.attr("transform", "translate(" + d3.event.translate + ")" +
|
||||
"scale(" + d3.event.scale + ")");
|
||||
});
|
||||
svg.call(zoom);
|
||||
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Left-to-right layout
|
||||
var g = new dagreD3.graphlib.Graph();
|
||||
g.setGraph({
|
||||
nodesep: 70,
|
||||
ranksep: 50,
|
||||
rankdir: "LR",
|
||||
marginx: 20,
|
||||
marginy: 20
|
||||
});
|
||||
|
||||
function draw(isUpdate) {
|
||||
for (var id in workers) {
|
||||
var worker = workers[id];
|
||||
var className = worker.consumers ? "running" : "stopped";
|
||||
if (worker.count > 10000) {
|
||||
className += " warn";
|
||||
}
|
||||
var html = "<div>";
|
||||
html += "<span class=status></span>";
|
||||
html += "<span class=consumers>"+worker.consumers+"</span>";
|
||||
html += "<span class=name>"+id+"</span>";
|
||||
html += "<span class=queue><span class=counter>"+worker.count+"</span></span>";
|
||||
html += "</div>";
|
||||
g.setNode(id, {
|
||||
labelType: "html",
|
||||
label: html,
|
||||
rx: 5,
|
||||
ry: 5,
|
||||
padding: 0,
|
||||
class: className
|
||||
});
|
||||
|
||||
if (worker.inputQueue) {
|
||||
g.setEdge(worker.inputQueue, id, {
|
||||
label: worker.inputThroughput + "/s",
|
||||
width: 40
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
inner.call(render, g);
|
||||
|
||||
// Zoom and scale to fit
|
||||
var graphWidth = g.graph().width + 80;
|
||||
var graphHeight = g.graph().height + 40;
|
||||
var width = parseInt(svg.style("width").replace(/px/, ""));
|
||||
var height = parseInt(svg.style("height").replace(/px/, ""));
|
||||
var zoomScale = Math.min(width / graphWidth, height / graphHeight);
|
||||
var translate = [(width/2) - ((graphWidth*zoomScale)/2), (height/2) - ((graphHeight*zoomScale)/2)];
|
||||
zoom.translate(translate);
|
||||
zoom.scale(zoomScale);
|
||||
zoom.event(isUpdate ? svg.transition().duration(500) : d3.select("svg"));
|
||||
}
|
||||
|
||||
// Do some mock queue status updates
|
||||
setInterval(function() {
|
||||
var stoppedWorker1Count = workers["elasticsearch-writer"].count;
|
||||
var stoppedWorker2Count = workers["meta-enricher"].count;
|
||||
for (var id in workers) {
|
||||
workers[id].count = Math.ceil(Math.random() * 3);
|
||||
if (workers[id].inputThroughput) workers[id].inputThroughput = Math.ceil(Math.random() * 250);
|
||||
}
|
||||
workers["elasticsearch-writer"].count = stoppedWorker1Count + Math.ceil(Math.random() * 100);
|
||||
workers["meta-enricher"].count = stoppedWorker2Count + Math.ceil(Math.random() * 100);
|
||||
draw(true);
|
||||
}, 1000);
|
||||
|
||||
// Do a mock change of worker configuration
|
||||
setInterval(function() {
|
||||
workers["elasticsearch-monitor"] = {
|
||||
"consumers": 0,
|
||||
"count": 0,
|
||||
"inputQueue": "elasticsearch-writer",
|
||||
"inputThroughput": 50
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
draw();
|
||||
</script>
|
423
node_modules/dagre-d3-renderer/dist/demo/graph-story-board.html
generated
vendored
Normal file
423
node_modules/dagre-d3-renderer/dist/demo/graph-story-board.html
generated
vendored
Normal file
@@ -0,0 +1,423 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Graph Storyboard. Add and Prune Dependencies Algorithm</title>
|
||||
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<style id="css">
|
||||
h1 {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
margin-top: 0.8em;
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
|
||||
text {
|
||||
font-weight: 300;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.node rect {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.node polygon {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.edgePath path.path {
|
||||
stroke: #333;
|
||||
fill: none;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
div#top-frame {
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
div#WBS-frame {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
div#dependencies-frame {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
div#schedule-frame {
|
||||
float: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// Polyfill for PhantomJS. This can be safely ignored if not using PhantomJS.
|
||||
// Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function(oThis) {
|
||||
if (typeof this !== 'function') {
|
||||
// closest thing possible to the ECMAScript 5
|
||||
// internal IsCallable function
|
||||
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
|
||||
}
|
||||
|
||||
var aArgs = Array.prototype.slice.call(arguments, 1),
|
||||
fToBind = this,
|
||||
fNOP = function() {},
|
||||
fBound = function() {
|
||||
return fToBind.apply(this instanceof fNOP && oThis
|
||||
? this
|
||||
: oThis,
|
||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
|
||||
fNOP.prototype = this.prototype;
|
||||
fBound.prototype = new fNOP();
|
||||
|
||||
return fBound;
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var dagred3Story = function(svgelement, graphType, interframetime) {
|
||||
this.interframetime = interframetime;
|
||||
this.lastrenderTime = null;
|
||||
this.g = new dagreD3.graphlib.Graph().setGraph({});
|
||||
//// Setup animation (if required)
|
||||
//this.g.graph().transition = function(selection) {
|
||||
// return selection.transition().duration(50);
|
||||
//}.bind(this);
|
||||
this.g.setDefaultEdgeLabel(function() { return {}; });
|
||||
this.g.graph().marginx = 10;
|
||||
this.g.graph().marginy = 10;
|
||||
switch(graphType) {
|
||||
case 'Work Breakdown Structure':
|
||||
this.WBS = true;
|
||||
this.Schedule = false;
|
||||
this.g.graph().ranksep = 30;
|
||||
this.g.graph().nodesep = 30;
|
||||
break;
|
||||
case 'Schedule Network':
|
||||
this.Schedule = true;
|
||||
this.WBS = false;
|
||||
this.g.graph().rankdir = "LR";
|
||||
this.g.graph().ranksep = 15;
|
||||
this.g.graph().nodesep = 15;
|
||||
break;
|
||||
default:
|
||||
console.log ("graphType of "+x+" is not implemented")
|
||||
}
|
||||
this.svg = d3.select(svgelement);
|
||||
this.inner = this.svg.append("g");
|
||||
this.svg.call(d3.behavior.zoom().on("zoom", (function() {
|
||||
this.inner.attr("transform", "translate(" + d3.event.translate + ")" +
|
||||
"scale(" + d3.event.scale + ")")
|
||||
}).bind(this)));
|
||||
|
||||
this.t = 0;
|
||||
|
||||
this.dagreD3render = new dagreD3.render();
|
||||
};
|
||||
|
||||
dagred3Story.prototype.animateFrame = function(RenderAfter, Frame) {
|
||||
this.t += RenderAfter
|
||||
//var that = this;
|
||||
setTimeout(function() {
|
||||
Frame.forEach(function(x) {
|
||||
if (this.Schedule) {
|
||||
switch(x[0]) {
|
||||
case 'setActivity':
|
||||
this.g.setNode(x[1],{})
|
||||
break;
|
||||
case 'removeNode':
|
||||
this.g.removeNode(x[1])
|
||||
break;
|
||||
case 'setMilestone':
|
||||
this.g.setNode(x[1],{ shape: 'diamond', style: "fill: #fff; stroke: #000" })
|
||||
break;
|
||||
case 'AddCoherenceEdge':
|
||||
this.g.setEdge(x[1], x[2], {
|
||||
lineInterpolate: 'basis'
|
||||
});
|
||||
break;
|
||||
case 'AddDependencyEdge':
|
||||
this.g.setEdge(x[1], x[2], {
|
||||
lineInterpolate: 'basis'
|
||||
,label: 'added'
|
||||
,labeloffset: 5
|
||||
,labelpos: 'l'
|
||||
});
|
||||
break;
|
||||
case 'MakeRedundantEdge':
|
||||
this.g.setEdge(x[1], x[2], {
|
||||
style: "stroke: #aaa; stroke-dasharray: 5, 10;"
|
||||
,lineInterpolate: 'basis'
|
||||
,arrowheadStyle: "fill: #aaa"
|
||||
,labelpos: 'c'
|
||||
,label: 'pruned'
|
||||
,labelStyle: 'stroke: #aaa'
|
||||
});
|
||||
break;
|
||||
case 'RemoveEdge':
|
||||
this.g.removeEdge(x[1], x[2]);
|
||||
break;
|
||||
default:
|
||||
console.log ("Schedule Network element "+x+" is not implemented")
|
||||
}
|
||||
} else if (this.WBS ) {
|
||||
switch(x[0]) {
|
||||
case 'setComponent':
|
||||
this.g.setNode(x[1],{})
|
||||
break;
|
||||
case 'AddWBSEdge':
|
||||
this.g.setEdge(x[1], x[2], {
|
||||
arrowhead: 'undirected'
|
||||
});
|
||||
break;
|
||||
default:
|
||||
console.log ("WBS element "+x+" is not implemented")
|
||||
}
|
||||
}
|
||||
}.bind(this))
|
||||
|
||||
if (this.g) {
|
||||
// Render
|
||||
this.dagreD3render(this.inner,this.g);
|
||||
}
|
||||
}.bind(this), this.t)
|
||||
};
|
||||
|
||||
dagred3Story.prototype.animateStory = function(RenderAfter, Story) {
|
||||
this.t += RenderAfter
|
||||
setTimeout(function() {
|
||||
Story.forEach(function(Frame) {
|
||||
this.animateFrame(this.interframetime, Frame);
|
||||
}.bind(this))
|
||||
}.bind(this), this.t)
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<div id="top-frame">
|
||||
<div id="WBS-frame">
|
||||
<h1>WBS</h1>
|
||||
<svg id="WBS" width=250 height=250></svg>
|
||||
</div>
|
||||
|
||||
<div id="dependencies-frame">
|
||||
<h1>Sequencing</h1>
|
||||
<svg id="dependencies" width=300 height=250></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="schedule-frame">
|
||||
<h1>Coherent Schedule Network</h1>
|
||||
<svg id="schedule" width=1150 height=500></svg>
|
||||
</div>
|
||||
|
||||
<script id="js">
|
||||
var framedelay = 2000;
|
||||
var dependenciesstory = new dagred3Story("#dependencies", "Schedule Network", framedelay);
|
||||
dependenciesstory.animateStory(0,
|
||||
[
|
||||
[
|
||||
|
||||
],[
|
||||
|
||||
],[
|
||||
|
||||
],[
|
||||
|
||||
]
|
||||
,[
|
||||
["setActivity", "A.1"]
|
||||
,
|
||||
["setMilestone", "A.2 Start"]
|
||||
,
|
||||
["AddDependencyEdge", "A.1", "A.2 Start"]
|
||||
],[
|
||||
|
||||
],[
|
||||
|
||||
],[
|
||||
|
||||
],[
|
||||
|
||||
],[
|
||||
["setActivity", "A.2.2"]
|
||||
,
|
||||
["setActivity", "A.2.3"]
|
||||
,
|
||||
["AddDependencyEdge", "A.2.2", "A.2.3"]
|
||||
],[
|
||||
|
||||
],[
|
||||
|
||||
],[
|
||||
|
||||
],[
|
||||
|
||||
],[
|
||||
["setActivity", "A.2.1"]
|
||||
,
|
||||
["setActivity", "B"]
|
||||
,
|
||||
["AddDependencyEdge", "A.2.1", "B"]
|
||||
],[
|
||||
|
||||
],[
|
||||
|
||||
]
|
||||
]);
|
||||
|
||||
var WBSstory = new dagred3Story("#WBS", "Work Breakdown Structure", framedelay);
|
||||
|
||||
WBSstory.animateStory(0,
|
||||
[
|
||||
[
|
||||
["setComponent", "Project"]
|
||||
],[
|
||||
["setComponent", "A"]
|
||||
,
|
||||
["AddWBSEdge", "Project", "A"]
|
||||
,
|
||||
["setComponent", "B"]
|
||||
,
|
||||
["AddWBSEdge", "Project", "B"]
|
||||
],[
|
||||
["setComponent", "A.1"]
|
||||
,
|
||||
["AddWBSEdge", "A", "A.1"]
|
||||
,
|
||||
["setComponent", "A.2"]
|
||||
,
|
||||
["AddWBSEdge", "A", "A.2"]
|
||||
],[
|
||||
["setComponent", "A.2.1"]
|
||||
,
|
||||
["AddWBSEdge", "A.2", "A.2.1"]
|
||||
,
|
||||
["setComponent", "A.2.2"]
|
||||
,
|
||||
["AddWBSEdge", "A.2", "A.2.2"]
|
||||
,
|
||||
["setComponent", "A.2.3"]
|
||||
,
|
||||
["AddWBSEdge", "A.2", "A.2.3"]
|
||||
]
|
||||
]);
|
||||
|
||||
var schedulestory = new dagred3Story("#schedule", "Schedule Network",framedelay);
|
||||
|
||||
// Create the input graph
|
||||
|
||||
schedulestory.animateStory(0,
|
||||
[
|
||||
[
|
||||
["setActivity", "Project"]
|
||||
],[
|
||||
["removeNode", "Project"]
|
||||
,
|
||||
["setMilestone", "Project Finish"]
|
||||
,
|
||||
["setMilestone", "Project Start"]
|
||||
,
|
||||
["setActivity", "A"]
|
||||
,
|
||||
["setActivity", "B"]
|
||||
,
|
||||
["AddCoherenceEdge", "Project Start", "A"]
|
||||
,
|
||||
["AddCoherenceEdge", "Project Start", "B"]
|
||||
,
|
||||
["AddCoherenceEdge", "A", "Project Finish"]
|
||||
,
|
||||
["AddCoherenceEdge", "B", "Project Finish"]
|
||||
],[
|
||||
["removeNode", "A"]
|
||||
,
|
||||
["setMilestone", "A Start"]
|
||||
,
|
||||
["setActivity", "A.1"]
|
||||
,
|
||||
["setActivity", "A.2"]
|
||||
,
|
||||
["setMilestone", "A Finish"]
|
||||
,
|
||||
["AddCoherenceEdge", "A Start", "A.1"]
|
||||
,
|
||||
["AddCoherenceEdge", "A Start", "A.2"]
|
||||
,
|
||||
["AddCoherenceEdge", "A.1", "A Finish"]
|
||||
,
|
||||
["AddCoherenceEdge", "A.2", "A Finish"]
|
||||
,
|
||||
["AddCoherenceEdge", "Project Start", "A Start"]
|
||||
,
|
||||
["AddCoherenceEdge", "A Finish", "Project Finish"]
|
||||
],[
|
||||
["removeNode", "A.2"]
|
||||
,
|
||||
["setMilestone", "A.2 Start"]
|
||||
,
|
||||
["setActivity", "A.2.1"]
|
||||
,
|
||||
["setActivity", "A.2.2"]
|
||||
,
|
||||
["setActivity", "A.2.3"]
|
||||
,
|
||||
["setMilestone", "A.2 Finish"]
|
||||
,
|
||||
["AddCoherenceEdge", "A.2 Start", "A.2.1"]
|
||||
,
|
||||
["AddCoherenceEdge", "A.2 Start", "A.2.2"]
|
||||
,
|
||||
["AddCoherenceEdge", "A.2 Start", "A.2.3"]
|
||||
,
|
||||
["AddCoherenceEdge", "A.2.1", "A.2 Finish"]
|
||||
,
|
||||
["AddCoherenceEdge", "A.2.2", "A.2 Finish"]
|
||||
,
|
||||
["AddCoherenceEdge", "A.2.3", "A.2 Finish"]
|
||||
,
|
||||
["AddCoherenceEdge", "A Start", "A.2 Start"]
|
||||
,
|
||||
["AddCoherenceEdge", "A.2 Finish", "A Finish"]
|
||||
]
|
||||
,[
|
||||
["AddDependencyEdge", "A.1", "A.2 Start"]
|
||||
],[
|
||||
["MakeRedundantEdge", "A Start", "A.2 Start"]
|
||||
],[
|
||||
["MakeRedundantEdge", "A.1", "A Finish"]
|
||||
],[
|
||||
["RemoveEdge", "A Start", "A.2 Start"]
|
||||
],[
|
||||
["RemoveEdge", "A.1", "A Finish"]
|
||||
],[
|
||||
["AddDependencyEdge", "A.2.2", "A.2.3"]
|
||||
],[
|
||||
["MakeRedundantEdge", "A.2 Start", "A.2.3"]
|
||||
],[
|
||||
["MakeRedundantEdge", "A.2.2", "A.2 Finish"]
|
||||
],[
|
||||
["RemoveEdge", "A.2 Start", "A.2.3"]
|
||||
],[
|
||||
["RemoveEdge", "A.2.2", "A.2 Finish"]
|
||||
],[
|
||||
["AddDependencyEdge", "A.2.1", "B"]
|
||||
],[
|
||||
["MakeRedundantEdge", "Project Start", "B"]
|
||||
],[
|
||||
["RemoveEdge", "Project Start", "B"]
|
||||
]
|
||||
]);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
10626
node_modules/dagre-d3-renderer/dist/demo/graphlib-dot.js
generated
vendored
Normal file
10626
node_modules/dagre-d3-renderer/dist/demo/graphlib-dot.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
196
node_modules/dagre-d3-renderer/dist/demo/hover.html
generated
vendored
Normal file
196
node_modules/dagre-d3-renderer/dist/demo/hover.html
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: Tooltip on Hover</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<!-- Pull in JQuery dependencies -->
|
||||
<link rel="stylesheet" href="tipsy.css">
|
||||
<script src="./jquery-1.9.1.min.js"></script>
|
||||
<script src="tipsy.js"></script>
|
||||
|
||||
<h1>Dagre D3 Demo: Tooltip on Hover</h1>
|
||||
|
||||
<style id="css">
|
||||
text {
|
||||
font-weight: 300;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.node rect {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.edgePath path {
|
||||
stroke: #333;
|
||||
fill: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.node text {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* This styles the title of the tooltip */
|
||||
.tipsy .name {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
color: #60b1fc;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* This styles the body of the tooltip */
|
||||
.tipsy .description {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<svg width=960 height=600></svg>
|
||||
|
||||
<section>
|
||||
<p>The TCP state diagram
|
||||
(<a href="http://www.rfc-editor.org/rfc/rfc793.txt">source: RFC 793</a>) with
|
||||
hover support. Uses <a href="http://bl.ocks.org/ilyabo/1373263">tipsy JS and CSS</a>
|
||||
for the tooltip.
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create a new directed graph
|
||||
var g = new dagreD3.graphlib.Graph().setGraph({});
|
||||
|
||||
// States and transitions from RFC 793
|
||||
var states = {
|
||||
CLOSED: {
|
||||
description: "represents no connection state at all.",
|
||||
style: "fill: #f77"
|
||||
},
|
||||
|
||||
LISTEN: {
|
||||
description: "represents waiting for a connection request from any " +
|
||||
"remote TCP and port."
|
||||
},
|
||||
|
||||
"SYN SENT": {
|
||||
description: "represents waiting for a matching connection " +
|
||||
"request after having sent a connection request."
|
||||
},
|
||||
|
||||
"SYN RCVD": {
|
||||
description: "represents waiting for a confirming connection " +
|
||||
"request acknowledgment after having both received and sent a " +
|
||||
"connection request."
|
||||
},
|
||||
|
||||
|
||||
ESTAB: {
|
||||
description: "represents an open connection, data received " +
|
||||
"can be delivered to the user. The normal state for the data " +
|
||||
"transfer phase of the connection.",
|
||||
style: "fill: #7f7"
|
||||
},
|
||||
|
||||
"FINWAIT-1": {
|
||||
description: "represents waiting for a connection termination " +
|
||||
"request from the remote TCP, or an acknowledgment of the " +
|
||||
"connection termination request previously sent."
|
||||
|
||||
},
|
||||
|
||||
"FINWAIT-2": {
|
||||
description: "represents waiting for a connection termination " +
|
||||
"request from the remote TCP."
|
||||
},
|
||||
|
||||
|
||||
"CLOSE WAIT": {
|
||||
description: "represents waiting for a connection termination " +
|
||||
"request from the local user."
|
||||
},
|
||||
|
||||
CLOSING: {
|
||||
description: "represents waiting for a connection termination " +
|
||||
"request acknowledgment from the remote TCP."
|
||||
},
|
||||
|
||||
"LAST-ACK": {
|
||||
description: "represents waiting for an acknowledgment of the " +
|
||||
"connection termination request previously sent to the remote " +
|
||||
"TCP (which includes an acknowledgment of its connection " +
|
||||
"termination request)."
|
||||
},
|
||||
|
||||
"TIME WAIT": {
|
||||
description: "represents waiting for enough time to pass to be " +
|
||||
"sure the remote TCP received the acknowledgment of its " +
|
||||
"connection termination request."
|
||||
}
|
||||
};
|
||||
|
||||
// Add states to the graph, set labels, and style
|
||||
Object.keys(states).forEach(function(state) {
|
||||
var value = states[state];
|
||||
value.label = state;
|
||||
value.rx = value.ry = 5;
|
||||
g.setNode(state, value);
|
||||
});
|
||||
|
||||
// Set up the edges
|
||||
g.setEdge("CLOSED", "LISTEN", { label: "open" });
|
||||
g.setEdge("LISTEN", "SYN RCVD", { label: "rcv SYN" });
|
||||
g.setEdge("LISTEN", "SYN SENT", { label: "send" });
|
||||
g.setEdge("LISTEN", "CLOSED", { label: "close" });
|
||||
g.setEdge("SYN RCVD", "FINWAIT-1", { label: "close" });
|
||||
g.setEdge("SYN RCVD", "ESTAB", { label: "rcv ACK of SYN" });
|
||||
g.setEdge("SYN SENT", "SYN RCVD", { label: "rcv SYN" });
|
||||
g.setEdge("SYN SENT", "ESTAB", { label: "rcv SYN, ACK" });
|
||||
g.setEdge("SYN SENT", "CLOSED", { label: "close" });
|
||||
g.setEdge("ESTAB", "FINWAIT-1", { label: "close" });
|
||||
g.setEdge("ESTAB", "CLOSE WAIT", { label: "rcv FIN" });
|
||||
g.setEdge("FINWAIT-1", "FINWAIT-2", { label: "rcv ACK of FIN" });
|
||||
g.setEdge("FINWAIT-1", "CLOSING", { label: "rcv FIN" });
|
||||
g.setEdge("CLOSE WAIT", "LAST-ACK", { label: "close" });
|
||||
g.setEdge("FINWAIT-2", "TIME WAIT", { label: "rcv FIN" });
|
||||
g.setEdge("CLOSING", "TIME WAIT", { label: "rcv ACK of FIN" });
|
||||
g.setEdge("LAST-ACK", "CLOSED", { label: "rcv ACK of FIN" });
|
||||
g.setEdge("TIME WAIT", "CLOSED", { label: "timeout=2MSL" });
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Set up an SVG group so that we can translate the final graph.
|
||||
var svg = d3.select("svg"),
|
||||
inner = svg.append("g");
|
||||
|
||||
// Set up zoom support
|
||||
var zoom = d3.behavior.zoom().on("zoom", function() {
|
||||
inner.attr("transform", "translate(" + d3.event.translate + ")" +
|
||||
"scale(" + d3.event.scale + ")");
|
||||
});
|
||||
svg.call(zoom);
|
||||
|
||||
// Simple function to style the tooltip for the given node.
|
||||
var styleTooltip = function(name, description) {
|
||||
return "<p class='name'>" + name + "</p><p class='description'>" + description + "</p>";
|
||||
};
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(inner, g);
|
||||
|
||||
inner.selectAll("g.node")
|
||||
.attr("title", function(v) { return styleTooltip(v, g.node(v).description) })
|
||||
.each(function(v) { $(this).tipsy({ gravity: "w", opacity: 1, html: true }); });
|
||||
|
||||
// Center the graph
|
||||
var initialScale = 0.75;
|
||||
zoom
|
||||
.translate([(svg.attr("width") - g.graph().width * initialScale) / 2, 20])
|
||||
.scale(initialScale)
|
||||
.event(svg);
|
||||
svg.attr('height', g.graph().height * initialScale + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
172
node_modules/dagre-d3-renderer/dist/demo/interactive-demo.html
generated
vendored
Normal file
172
node_modules/dagre-d3-renderer/dist/demo/interactive-demo.html
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre Interactive Demo</title>
|
||||
|
||||
<script src="./graphlib-dot.js"></script>
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<style>
|
||||
svg {
|
||||
border: 1px solid #999;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.node {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.node rect,
|
||||
.node circle,
|
||||
.node ellipse {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.cluster rect {
|
||||
stroke: #333;
|
||||
fill: #000;
|
||||
fill-opacity: 0.1;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.edgePath path.path {
|
||||
stroke: #333;
|
||||
stroke-width: 1.5px;
|
||||
fill: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
h1, h2 {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
label {
|
||||
margin-top: 1em;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body onLoad="tryDraw();">
|
||||
|
||||
<h1>Dagre Interactive Demo</h1>
|
||||
|
||||
<h2>Input</h2>
|
||||
|
||||
<form>
|
||||
<label for="inputGraph">Graphviz Definition</label>
|
||||
<textarea id="inputGraph" rows="5" style="display: block" onKeyUp="tryDraw();">
|
||||
/* Example */
|
||||
digraph {
|
||||
/* Note: HTML labels do not work in IE, which lacks support for <foreignObject> tags. */
|
||||
node [rx=5 ry=5 labelStyle="font: 300 14px 'Helvetica Neue', Helvetica"]
|
||||
edge [labelStyle="font: 300 14px 'Helvetica Neue', Helvetica"]
|
||||
A [labelType="html"
|
||||
label="A <span style='font-size:32px'>Big</span> <span style='color:red;'>HTML</span> Source!"];
|
||||
C;
|
||||
E [label="Bold Red Sink" style="fill: #f77; font-weight: bold"];
|
||||
A -> B -> C;
|
||||
B -> D [label="A blue label" labelStyle="fill: #55f; font-weight: bold;"];
|
||||
D -> E [label="A thick red edge" style="stroke: #f77; stroke-width: 2px;" arrowheadStyle="fill: #f77"];
|
||||
C -> E;
|
||||
A -> D [labelType="html" label="A multi-rank <span style='color:blue;'>HTML</span> edge!"];
|
||||
}
|
||||
</textarea>
|
||||
|
||||
<a id="graphLink">Link for this graph</a>
|
||||
</form>
|
||||
|
||||
<h2>Graph Visualization</h2>
|
||||
|
||||
<svg width=800 height=600>
|
||||
<g/>
|
||||
</svg>
|
||||
|
||||
<script>
|
||||
// Input related code goes here
|
||||
|
||||
function graphToURL() {
|
||||
var elems = [window.location.protocol, '//',
|
||||
window.location.host,
|
||||
window.location.pathname,
|
||||
'?'];
|
||||
|
||||
var queryParams = [];
|
||||
if (debugAlignment) {
|
||||
queryParams.push('alignment=' + debugAlignment);
|
||||
}
|
||||
queryParams.push('graph=' + encodeURIComponent(inputGraph.value));
|
||||
elems.push(queryParams.join('&'));
|
||||
|
||||
return elems.join('');
|
||||
}
|
||||
|
||||
var inputGraph = document.querySelector("#inputGraph");
|
||||
|
||||
var graphLink = d3.select("#graphLink");
|
||||
|
||||
var oldInputGraphValue;
|
||||
|
||||
var graphRE = /[?&]graph=([^&]+)/;
|
||||
var graphMatch = window.location.search.match(graphRE);
|
||||
if (graphMatch) {
|
||||
inputGraph.value = decodeURIComponent(graphMatch[1]);
|
||||
}
|
||||
var debugAlignmentRE = /[?&]alignment=([^&]+)/;
|
||||
var debugAlignmentMatch = window.location.search.match(debugAlignmentRE);
|
||||
var debugAlignment;
|
||||
if (debugAlignmentMatch) debugAlignment = debugAlignmentMatch[1];
|
||||
|
||||
// Set up zoom support
|
||||
var svg = d3.select("svg"),
|
||||
inner = d3.select("svg g"),
|
||||
zoom = d3.behavior.zoom().on("zoom", function() {
|
||||
inner.attr("transform", "translate(" + d3.event.translate + ")" +
|
||||
"scale(" + d3.event.scale + ")");
|
||||
});
|
||||
svg.call(zoom);
|
||||
|
||||
// Create and configure the renderer
|
||||
var render = dagreD3.render();
|
||||
|
||||
function tryDraw() {
|
||||
var g;
|
||||
if (oldInputGraphValue !== inputGraph.value) {
|
||||
inputGraph.setAttribute("class", "");
|
||||
oldInputGraphValue = inputGraph.value;
|
||||
try {
|
||||
g = graphlibDot.read(inputGraph.value);
|
||||
} catch (e) {
|
||||
inputGraph.setAttribute("class", "error");
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Save link to new graph
|
||||
graphLink.attr("href", graphToURL());
|
||||
|
||||
// Set margins, if not present
|
||||
if (!g.graph().hasOwnProperty("marginx") &&
|
||||
!g.graph().hasOwnProperty("marginy")) {
|
||||
g.graph().marginx = 20;
|
||||
g.graph().marginy = 20;
|
||||
}
|
||||
|
||||
g.graph().transition = function(selection) {
|
||||
return selection.transition().duration(500);
|
||||
};
|
||||
|
||||
// Render the graph into svg g
|
||||
d3.select("svg g").call(render, g);
|
||||
}
|
||||
}
|
||||
</script>
|
5
node_modules/dagre-d3-renderer/dist/demo/jquery-1.9.1.min.js
generated
vendored
Normal file
5
node_modules/dagre-d3-renderer/dist/demo/jquery-1.9.1.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
104
node_modules/dagre-d3-renderer/dist/demo/sentence-tokenization.html
generated
vendored
Normal file
104
node_modules/dagre-d3-renderer/dist/demo/sentence-tokenization.html
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: Sentence Tokenization</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<h1>Dagre D3 Demo: Sentence Tokenization</h1>
|
||||
|
||||
<style id="css">
|
||||
/* This sets the color for "TK" nodes to a light blue green. */
|
||||
g.type-TK > rect {
|
||||
fill: #00ffd0;
|
||||
}
|
||||
|
||||
text {
|
||||
font-weight: 300;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.node rect {
|
||||
stroke: #999;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.edgePath path {
|
||||
stroke: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<svg id="svg-canvas" width=960 height=600></svg>
|
||||
|
||||
<section>
|
||||
<p>An example of visualizing the tokenization of a sentence. This example shows
|
||||
how CSS classes can be applied to a rendered graph.
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create the input graph
|
||||
var g = new dagreD3.graphlib.Graph()
|
||||
.setGraph({})
|
||||
.setDefaultEdgeLabel(function() { return {}; });
|
||||
|
||||
// Here we"re setting nodeclass, which is used by our custom drawNodes function
|
||||
// below.
|
||||
g.setNode(0, { label: "TOP", class: "type-TOP" });
|
||||
g.setNode(1, { label: "S", class: "type-S" });
|
||||
g.setNode(2, { label: "NP", class: "type-NP" });
|
||||
g.setNode(3, { label: "DT", class: "type-DT" });
|
||||
g.setNode(4, { label: "This", class: "type-TK" });
|
||||
g.setNode(5, { label: "VP", class: "type-VP" });
|
||||
g.setNode(6, { label: "VBZ", class: "type-VBZ" });
|
||||
g.setNode(7, { label: "is", class: "type-TK" });
|
||||
g.setNode(8, { label: "NP", class: "type-NP" });
|
||||
g.setNode(9, { label: "DT", class: "type-DT" });
|
||||
g.setNode(10, { label: "an", class: "type-TK" });
|
||||
g.setNode(11, { label: "NN", class: "type-NN" });
|
||||
g.setNode(12, { label: "example", class: "type-TK" });
|
||||
g.setNode(13, { label: ".", class: "type-." });
|
||||
g.setNode(14, { label: "sentence", class: "type-TK" });
|
||||
|
||||
g.nodes().forEach(function(v) {
|
||||
var node = g.node(v);
|
||||
// Round the corners of the nodes
|
||||
node.rx = node.ry = 5;
|
||||
});
|
||||
|
||||
// Set up edges, no special attributes.
|
||||
g.setEdge(3, 4);
|
||||
g.setEdge(2, 3);
|
||||
g.setEdge(1, 2);
|
||||
g.setEdge(6, 7);
|
||||
g.setEdge(5, 6);
|
||||
g.setEdge(9, 10);
|
||||
g.setEdge(8, 9);
|
||||
g.setEdge(11,12);
|
||||
g.setEdge(8, 11);
|
||||
g.setEdge(5, 8);
|
||||
g.setEdge(1, 5);
|
||||
g.setEdge(13,14);
|
||||
g.setEdge(1, 13);
|
||||
g.setEdge(0, 1)
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Set up an SVG group so that we can translate the final graph.
|
||||
var svg = d3.select("svg"),
|
||||
svgGroup = svg.append("g");
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(d3.select("svg g"), g);
|
||||
|
||||
// Center the graph
|
||||
var xCenterOffset = (svg.attr("width") - g.graph().width) / 2;
|
||||
svgGroup.attr("transform", "translate(" + xCenterOffset + ", 20)");
|
||||
svg.attr("height", g.graph().height + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
72
node_modules/dagre-d3-renderer/dist/demo/shapes.html
generated
vendored
Normal file
72
node_modules/dagre-d3-renderer/dist/demo/shapes.html
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: Shapes</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<style id="css">
|
||||
body {
|
||||
font: 300 14px 'Helvetica Neue', Helvetica;
|
||||
}
|
||||
|
||||
.node rect,
|
||||
.node circle,
|
||||
.node ellipse,
|
||||
.node polygon {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.edgePath path {
|
||||
stroke: #333;
|
||||
fill: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>Dagre D3 Demo: Shapes</h1>
|
||||
|
||||
<svg width=960 height=600><g/></svg>
|
||||
|
||||
<section>
|
||||
<p>A sample that shows the different node shapes available in dagre-d3.
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create a new directed graph
|
||||
var g = new dagreD3.graphlib.Graph().setGraph({});
|
||||
|
||||
g.setNode("rect", { shape: "rect" });
|
||||
g.setNode("circle", { shape: "circle" });
|
||||
g.setNode("ellipse", { shape: "ellipse" });
|
||||
g.setNode("diamond", { shape: "diamond" });
|
||||
|
||||
var svg = d3.select("svg"),
|
||||
inner = svg.select("g");
|
||||
|
||||
// Set up zoom support
|
||||
var zoom = d3.behavior.zoom().on("zoom", function() {
|
||||
inner.attr("transform", "translate(" + d3.event.translate + ")" +
|
||||
"scale(" + d3.event.scale + ")");
|
||||
});
|
||||
svg.call(zoom);
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(inner, g);
|
||||
|
||||
// Center the graph
|
||||
var initialScale = 0.75;
|
||||
zoom
|
||||
.translate([(svg.attr("width") - g.graph().width * initialScale) / 2, 20])
|
||||
.scale(initialScale)
|
||||
.event(svg);
|
||||
svg.attr('height', g.graph().height * initialScale + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
105
node_modules/dagre-d3-renderer/dist/demo/style-attrs.html
generated
vendored
Normal file
105
node_modules/dagre-d3-renderer/dist/demo/style-attrs.html
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: Style Attributes</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<h1>Dagre D3 Demo: Style Attributes</h1>
|
||||
|
||||
<style id="css">
|
||||
text {
|
||||
font-weight: 300;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.node rect {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.edgePath path.path {
|
||||
stroke: #333;
|
||||
fill: none;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.arrowhead {
|
||||
stroke: blue;
|
||||
fill: blue;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<svg id="svg" width=960 height=600></svg>
|
||||
|
||||
<section>
|
||||
<p>An example showing how styles that are set in the input graph can be applied
|
||||
to nodes, node labels, edges, and edge labels in the rendered graph.
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create the input graph
|
||||
var g = new dagreD3.graphlib.Graph().setGraph({});
|
||||
|
||||
// Fill node "A" with the color green
|
||||
g.setNode("A", { style: "fill: #afa" });
|
||||
|
||||
// Make the label for node "B" bold
|
||||
g.setNode("B", { labelStyle: "font-weight: bold" });
|
||||
|
||||
// Double the size of the font for node "C"
|
||||
g.setNode("C", { labelStyle: "font-size: 2em" });
|
||||
|
||||
g.setNode("D", {});
|
||||
|
||||
g.setNode("E", {});
|
||||
|
||||
// Make the edge from "A" to "B" red, thick, and dashed
|
||||
g.setEdge("A", "B", {
|
||||
style: "stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;",
|
||||
arrowheadStyle: "fill: #f66"
|
||||
});
|
||||
|
||||
// Make the label for the edge from "C" to "B" italic and underlined
|
||||
g.setEdge("C", "B", {
|
||||
label: "A to C",
|
||||
labelStyle: "font-style: italic; text-decoration: underline;"
|
||||
});
|
||||
|
||||
// Make the edge between A and D smoother.
|
||||
// see available options for lineInterpolate here: https://github.com/mbostock/d3/wiki/SVG-Shapes#line_interpolate
|
||||
g.setEdge("A", "D", {
|
||||
label: "line interpolation different",
|
||||
lineInterpolate: 'basis'
|
||||
});
|
||||
|
||||
g.setEdge("E", "D", {});
|
||||
|
||||
// Make the arrowhead blue
|
||||
g.setEdge("A", "E", {
|
||||
label: "Arrowhead class",
|
||||
arrowheadClass: 'arrowhead'
|
||||
});
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Set up an SVG group so that we can translate the final graph.
|
||||
var svg = d3.select("svg"),
|
||||
inner = svg.append("g");
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(inner, g);
|
||||
|
||||
// Center the graph
|
||||
var xCenterOffset = (svg.attr("width") - g.graph().width) / 2;
|
||||
inner.attr("transform", "translate(" + xCenterOffset + ", 20)");
|
||||
svg.attr("height", g.graph().height + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
102
node_modules/dagre-d3-renderer/dist/demo/svg-labels.html
generated
vendored
Normal file
102
node_modules/dagre-d3-renderer/dist/demo/svg-labels.html
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: SVG Labels</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<h1>Dagre D3 Demo: SVG Labels</h1>
|
||||
|
||||
<style id="css">
|
||||
text {
|
||||
font-weight: 300;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.node rect {
|
||||
stroke: #999;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.edgePath path {
|
||||
stroke: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<svg id="svg-canvas" width=960 height=600></svg>
|
||||
|
||||
<section>
|
||||
<p>An example of adding SVG labels. This allows the user to add any svg
|
||||
elements to the label. This allows for links to works in IE.</p>
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create the input graph
|
||||
var g = new dagreD3.graphlib.Graph()
|
||||
.setGraph({})
|
||||
.setDefaultEdgeLabel(function() { return {}; });
|
||||
|
||||
// Create the SVG label to pass in
|
||||
// Must create in SVG namespace
|
||||
// http://stackoverflow.com/questions/7547117/add-a-new-line-in-svg-bug-cannot-see-the-line
|
||||
// This mimics the same way string labels get added in Dagre-D3
|
||||
svg_label = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
||||
tspan = document.createElementNS('http://www.w3.org/2000/svg','tspan');
|
||||
tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
||||
tspan.setAttribute('dy', '1em');
|
||||
tspan.setAttribute('x', '1');
|
||||
link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
|
||||
link.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', 'http://google.com/');
|
||||
link.setAttribute('target', '_blank');
|
||||
link.textContent = 'IE Capable link';
|
||||
tspan.appendChild(link);
|
||||
svg_label.appendChild(tspan);
|
||||
|
||||
g.setNode(0, { label: svg_label, labelType: 'svg' });
|
||||
g.setNode(1, { label: "A" });
|
||||
g.setNode(2, { label: "B" });
|
||||
|
||||
g.nodes().forEach(function(v) {
|
||||
var node = g.node(v);
|
||||
// Round the corners of the nodes
|
||||
node.rx = node.ry = 5;
|
||||
});
|
||||
|
||||
svg_edge_label = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
||||
edge_tspan = document.createElementNS('http://www.w3.org/2000/svg','tspan');
|
||||
edge_tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
|
||||
edge_tspan.setAttribute('dy', '1em');
|
||||
edge_tspan.setAttribute('x', '1');
|
||||
edge_link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
|
||||
edge_link.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', 'http://google.com/');
|
||||
edge_link.setAttribute('target', '_blank');
|
||||
edge_link.textContent = 'IE Capable Edge link';
|
||||
edge_tspan.appendChild(edge_link);
|
||||
svg_edge_label.appendChild(edge_tspan);
|
||||
|
||||
// Set up edges, no special attributes.
|
||||
g.setEdge(0, 1, { labelType: "svg", label: svg_edge_label });
|
||||
g.setEdge(0, 2);
|
||||
g.setEdge(1, 2);
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Set up an SVG group so that we can translate the final graph.
|
||||
var svg = d3.select("svg"),
|
||||
svgGroup = svg.append("g");
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(d3.select("svg g"), g);
|
||||
|
||||
// Center the graph
|
||||
var xCenterOffset = (svg.attr("width") - g.graph().width) / 2;
|
||||
svgGroup.attr("transform", "translate(" + xCenterOffset + ", 20)");
|
||||
svg.attr("height", g.graph().height + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
104
node_modules/dagre-d3-renderer/dist/demo/tcp-state-diagram.html
generated
vendored
Normal file
104
node_modules/dagre-d3-renderer/dist/demo/tcp-state-diagram.html
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: TCP State Diagram</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<style id="css">
|
||||
body {
|
||||
font: 300 14px 'Helvetica Neue', Helvetica;
|
||||
}
|
||||
|
||||
.node rect {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.edgePath path {
|
||||
stroke: #333;
|
||||
fill: #333;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>Dagre D3 Demo: TCP State Diagram</h1>
|
||||
|
||||
<svg width=960 height=600><g/></svg>
|
||||
|
||||
<section>
|
||||
<p>A sample rendering of a TCP state diagram
|
||||
(<a href="http://www.rfc-editor.org/rfc/rfc793.txt">RFC 793</a>). This example
|
||||
shows how to set custom styles in the input graph and how to set a custom
|
||||
initial zoom.
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create a new directed graph
|
||||
var g = new dagreD3.graphlib.Graph().setGraph({});
|
||||
|
||||
// States and transitions from RFC 793
|
||||
var states = [ "CLOSED", "LISTEN", "SYN RCVD", "SYN SENT",
|
||||
"ESTAB", "FINWAIT-1", "CLOSE WAIT", "FINWAIT-2",
|
||||
"CLOSING", "LAST-ACK", "TIME WAIT" ];
|
||||
|
||||
// Automatically label each of the nodes
|
||||
states.forEach(function(state) { g.setNode(state, { label: state }); });
|
||||
|
||||
// Set up the edges
|
||||
g.setEdge("CLOSED", "LISTEN", { label: "open" });
|
||||
g.setEdge("LISTEN", "SYN RCVD", { label: "rcv SYN" });
|
||||
g.setEdge("LISTEN", "SYN SENT", { label: "send" });
|
||||
g.setEdge("LISTEN", "CLOSED", { label: "close" });
|
||||
g.setEdge("SYN RCVD", "FINWAIT-1", { label: "close" });
|
||||
g.setEdge("SYN RCVD", "ESTAB", { label: "rcv ACK of SYN" });
|
||||
g.setEdge("SYN SENT", "SYN RCVD", { label: "rcv SYN" });
|
||||
g.setEdge("SYN SENT", "ESTAB", { label: "rcv SYN, ACK" });
|
||||
g.setEdge("SYN SENT", "CLOSED", { label: "close" });
|
||||
g.setEdge("ESTAB", "FINWAIT-1", { label: "close" });
|
||||
g.setEdge("ESTAB", "CLOSE WAIT", { label: "rcv FIN" });
|
||||
g.setEdge("FINWAIT-1", "FINWAIT-2", { label: "rcv ACK of FIN" });
|
||||
g.setEdge("FINWAIT-1", "CLOSING", { label: "rcv FIN" });
|
||||
g.setEdge("CLOSE WAIT", "LAST-ACK", { label: "close" });
|
||||
g.setEdge("FINWAIT-2", "TIME WAIT", { label: "rcv FIN" });
|
||||
g.setEdge("CLOSING", "TIME WAIT", { label: "rcv ACK of FIN" });
|
||||
g.setEdge("LAST-ACK", "CLOSED", { label: "rcv ACK of FIN" });
|
||||
g.setEdge("TIME WAIT", "CLOSED", { label: "timeout=2MSL" });
|
||||
|
||||
// Set some general styles
|
||||
g.nodes().forEach(function(v) {
|
||||
var node = g.node(v);
|
||||
node.rx = node.ry = 5;
|
||||
});
|
||||
|
||||
// Add some custom colors based on state
|
||||
g.node('CLOSED').style = "fill: #f77";
|
||||
g.node('ESTAB').style = "fill: #7f7";
|
||||
|
||||
var svg = d3.select("svg"),
|
||||
inner = svg.select("g");
|
||||
|
||||
// Set up zoom support
|
||||
var zoom = d3.behavior.zoom().on("zoom", function() {
|
||||
inner.attr("transform", "translate(" + d3.event.translate + ")" +
|
||||
"scale(" + d3.event.scale + ")");
|
||||
});
|
||||
svg.call(zoom);
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(inner, g);
|
||||
|
||||
// Center the graph
|
||||
var initialScale = 0.75;
|
||||
zoom
|
||||
.translate([(svg.attr("width") - g.graph().width * initialScale) / 2, 20])
|
||||
.scale(initialScale)
|
||||
.event(svg);
|
||||
svg.attr('height', g.graph().height * initialScale + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
25
node_modules/dagre-d3-renderer/dist/demo/tipsy.css
generated
vendored
Normal file
25
node_modules/dagre-d3-renderer/dist/demo/tipsy.css
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
.tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; }
|
||||
.tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; }
|
||||
|
||||
/* Rounded corners */
|
||||
.tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
|
||||
|
||||
/* Uncomment for shadow */
|
||||
.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }
|
||||
|
||||
.tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; }
|
||||
|
||||
/* Rules to colour arrows */
|
||||
.tipsy-arrow-n { border-bottom-color: #000; }
|
||||
.tipsy-arrow-s { border-top-color: #000; }
|
||||
.tipsy-arrow-e { border-left-color: #000; }
|
||||
.tipsy-arrow-w { border-right-color: #000; }
|
||||
|
||||
.tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
|
||||
.tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
|
||||
.tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
|
||||
.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
|
||||
.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
|
||||
.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
|
||||
.tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
|
||||
.tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; }
|
288
node_modules/dagre-d3-renderer/dist/demo/tipsy.js
generated
vendored
Normal file
288
node_modules/dagre-d3-renderer/dist/demo/tipsy.js
generated
vendored
Normal file
@@ -0,0 +1,288 @@
|
||||
// tipsy, facebook style tooltips for jquery
|
||||
// version 1.0.0a
|
||||
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
||||
// released under the MIT license
|
||||
|
||||
(function($) {
|
||||
|
||||
function maybeCall(thing, ctx) {
|
||||
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
|
||||
}
|
||||
|
||||
function Tipsy(element, options) {
|
||||
this.$element = $(element);
|
||||
this.options = options;
|
||||
this.enabled = true;
|
||||
this.fixTitle();
|
||||
}
|
||||
|
||||
Tipsy.prototype = {
|
||||
show: function() {
|
||||
var title = this.getTitle();
|
||||
if (title && this.enabled) {
|
||||
var $tip = this.tip();
|
||||
|
||||
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
|
||||
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
|
||||
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
|
||||
|
||||
var pos = $.extend({}, this.$element.offset(), {
|
||||
width: this.$element[0].offsetWidth || 0,
|
||||
height: this.$element[0].offsetHeight || 0
|
||||
});
|
||||
|
||||
if (typeof this.$element[0].nearestViewportElement == 'object') {
|
||||
// SVG
|
||||
var el = this.$element[0];
|
||||
var rect = el.getBoundingClientRect();
|
||||
pos.width = rect.width;
|
||||
pos.height = rect.height;
|
||||
}
|
||||
|
||||
|
||||
var actualWidth = $tip[0].offsetWidth,
|
||||
actualHeight = $tip[0].offsetHeight,
|
||||
gravity = maybeCall(this.options.gravity, this.$element[0]);
|
||||
|
||||
var tp;
|
||||
switch (gravity.charAt(0)) {
|
||||
case 'n':
|
||||
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 's':
|
||||
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
||||
break;
|
||||
case 'e':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
|
||||
break;
|
||||
case 'w':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
|
||||
break;
|
||||
}
|
||||
|
||||
if (gravity.length == 2) {
|
||||
if (gravity.charAt(1) == 'w') {
|
||||
tp.left = pos.left + pos.width / 2 - 15;
|
||||
} else {
|
||||
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
|
||||
}
|
||||
}
|
||||
|
||||
$tip.css(tp).addClass('tipsy-' + gravity);
|
||||
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
|
||||
if (this.options.className) {
|
||||
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
|
||||
}
|
||||
|
||||
if (this.options.fade) {
|
||||
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
|
||||
} else {
|
||||
$tip.css({visibility: 'visible', opacity: this.options.opacity});
|
||||
}
|
||||
|
||||
var t = this;
|
||||
var set_hovered = function(set_hover){
|
||||
return function(){
|
||||
t.$tip.stop();
|
||||
t.tipHovered = set_hover;
|
||||
if (!set_hover){
|
||||
if (t.options.delayOut === 0) {
|
||||
t.hide();
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
if (t.hoverState == 'out') t.hide(); }, t.options.delayOut);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
$tip.hover(set_hovered(true), set_hovered(false));
|
||||
}
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
if (this.options.fade) {
|
||||
this.tip().stop().fadeOut(function() { $(this).remove(); });
|
||||
} else {
|
||||
this.tip().remove();
|
||||
}
|
||||
},
|
||||
|
||||
fixTitle: function() {
|
||||
var $e = this.$element;
|
||||
|
||||
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
|
||||
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
|
||||
}
|
||||
if (typeof $e.context.nearestViewportElement == 'object'){
|
||||
if ($e.children('title').length){
|
||||
$e.append('<original-title>' + ($e.children('title').text() || '') + '</original-title>')
|
||||
.children('title').remove();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getTitle: function() {
|
||||
|
||||
var title, $e = this.$element, o = this.options;
|
||||
this.fixTitle();
|
||||
|
||||
if (typeof o.title == 'string') {
|
||||
var title_name = o.title == 'title' ? 'original-title' : o.title;
|
||||
if ($e.children(title_name).length){
|
||||
title = $e.children(title_name).html();
|
||||
} else{
|
||||
title = $e.attr(title_name);
|
||||
}
|
||||
|
||||
} else if (typeof o.title == 'function') {
|
||||
title = o.title.call($e[0]);
|
||||
}
|
||||
title = ('' + title).replace(/(^\s*|\s*$)/, "");
|
||||
return title || o.fallback;
|
||||
},
|
||||
|
||||
tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
|
||||
}
|
||||
return this.$tip;
|
||||
},
|
||||
|
||||
validate: function() {
|
||||
if (!this.$element[0].parentNode) {
|
||||
this.hide();
|
||||
this.$element = null;
|
||||
this.options = null;
|
||||
}
|
||||
},
|
||||
|
||||
enable: function() { this.enabled = true; },
|
||||
disable: function() { this.enabled = false; },
|
||||
toggleEnabled: function() { this.enabled = !this.enabled; }
|
||||
};
|
||||
|
||||
$.fn.tipsy = function(options) {
|
||||
|
||||
if (options === true) {
|
||||
return this.data('tipsy');
|
||||
} else if (typeof options == 'string') {
|
||||
var tipsy = this.data('tipsy');
|
||||
if (tipsy) tipsy[options]();
|
||||
return this;
|
||||
}
|
||||
|
||||
options = $.extend({}, $.fn.tipsy.defaults, options);
|
||||
|
||||
if (options.hoverlock && options.delayOut === 0) {
|
||||
options.delayOut = 100;
|
||||
}
|
||||
|
||||
function get(ele) {
|
||||
var tipsy = $.data(ele, 'tipsy');
|
||||
if (!tipsy) {
|
||||
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
|
||||
$.data(ele, 'tipsy', tipsy);
|
||||
}
|
||||
return tipsy;
|
||||
}
|
||||
|
||||
function enter() {
|
||||
var tipsy = get(this);
|
||||
tipsy.hoverState = 'in';
|
||||
if (options.delayIn === 0) {
|
||||
tipsy.show();
|
||||
} else {
|
||||
tipsy.fixTitle();
|
||||
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
|
||||
}
|
||||
}
|
||||
|
||||
function leave() {
|
||||
var tipsy = get(this);
|
||||
tipsy.hoverState = 'out';
|
||||
if (options.delayOut === 0) {
|
||||
tipsy.hide();
|
||||
} else {
|
||||
var to = function() {
|
||||
if (!tipsy.tipHovered || !options.hoverlock){
|
||||
if (tipsy.hoverState == 'out') tipsy.hide();
|
||||
}
|
||||
};
|
||||
setTimeout(to, options.delayOut);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.trigger != 'manual') {
|
||||
var binder = options.live ? 'live' : 'bind',
|
||||
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
|
||||
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
|
||||
this[binder](eventIn, enter)[binder](eventOut, leave);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
$.fn.tipsy.defaults = {
|
||||
className: null,
|
||||
delayIn: 0,
|
||||
delayOut: 0,
|
||||
fade: false,
|
||||
fallback: '',
|
||||
gravity: 'n',
|
||||
html: false,
|
||||
live: false,
|
||||
offset: 0,
|
||||
opacity: 0.8,
|
||||
title: 'title',
|
||||
trigger: 'hover',
|
||||
hoverlock: false
|
||||
};
|
||||
|
||||
// Overwrite this method to provide options on a per-element basis.
|
||||
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
||||
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
||||
// (remember - do not modify 'options' in place!)
|
||||
$.fn.tipsy.elementOptions = function(ele, options) {
|
||||
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoNS = function() {
|
||||
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
||||
};
|
||||
|
||||
$.fn.tipsy.autoWE = function() {
|
||||
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
||||
};
|
||||
|
||||
/**
|
||||
* yields a closure of the supplied parameters, producing a function that takes
|
||||
* no arguments and is suitable for use as an autogravity function like so:
|
||||
*
|
||||
* @param margin (int) - distance from the viewable region edge that an
|
||||
* element should be before setting its tooltip's gravity to be away
|
||||
* from that edge.
|
||||
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
|
||||
* if there are no viewable region edges effecting the tooltip's
|
||||
* gravity. It will try to vary from this minimally, for example,
|
||||
* if 'sw' is preferred and an element is near the right viewable
|
||||
* region edge, but not the top edge, it will set the gravity for
|
||||
* that element's tooltip to be 'se', preserving the southern
|
||||
* component.
|
||||
*/
|
||||
$.fn.tipsy.autoBounds = function(margin, prefer) {
|
||||
return function() {
|
||||
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
|
||||
boundTop = $(document).scrollTop() + margin,
|
||||
boundLeft = $(document).scrollLeft() + margin,
|
||||
$this = $(this);
|
||||
|
||||
if ($this.offset().top < boundTop) dir.ns = 'n';
|
||||
if ($this.offset().left < boundLeft) dir.ew = 'w';
|
||||
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
|
||||
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
|
||||
|
||||
return dir.ns + (dir.ew ? dir.ew : '');
|
||||
};
|
||||
};
|
||||
})(jQuery);
|
114
node_modules/dagre-d3-renderer/dist/demo/user-defined.html
generated
vendored
Normal file
114
node_modules/dagre-d3-renderer/dist/demo/user-defined.html
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<!doctype html>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<title>Dagre D3 Demo: User-defined Shapes and Arrows</title>
|
||||
|
||||
<link rel="stylesheet" href="demo.css">
|
||||
<script src="../dagre-d3.js"></script>
|
||||
|
||||
<style id="css">
|
||||
body {
|
||||
font: 300 14px 'Helvetica Neue', Helvetica;
|
||||
}
|
||||
|
||||
.node rect,
|
||||
.node circle,
|
||||
.node ellipse,
|
||||
.node polygon {
|
||||
stroke: #333;
|
||||
fill: #fff;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.edgePath path.path {
|
||||
stroke: #333;
|
||||
fill: none;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>Dagre D3 Demo: User-defined Shapes and Arrows</h1>
|
||||
|
||||
<svg width=960 height=600><g/></svg>
|
||||
|
||||
<section>
|
||||
<p>An example that shows how to create and use user-defined shapes and arrows.
|
||||
</section>
|
||||
|
||||
<script id="js">
|
||||
// Create a new directed graph
|
||||
var g = new dagreD3.graphlib.Graph().setGraph({});
|
||||
|
||||
g.setNode("house", { shape: "house", label: "house" });
|
||||
g.setNode("rect", { shape: "rect" });
|
||||
g.setEdge("house", "rect", { arrowhead: "hollowPoint" });
|
||||
|
||||
var svg = d3.select("svg"),
|
||||
inner = svg.select("g");
|
||||
|
||||
// Set up zoom support
|
||||
var zoom = d3.behavior.zoom().on("zoom", function() {
|
||||
inner.attr("transform", "translate(" + d3.event.translate + ")" +
|
||||
"scale(" + d3.event.scale + ")");
|
||||
});
|
||||
svg.call(zoom);
|
||||
|
||||
// Create the renderer
|
||||
var render = new dagreD3.render();
|
||||
|
||||
// Add our custom shape (a house)
|
||||
render.shapes().house = function(parent, bbox, node) {
|
||||
var w = bbox.width,
|
||||
h = bbox.height,
|
||||
points = [
|
||||
{ x: 0, y: 0 },
|
||||
{ x: w, y: 0 },
|
||||
{ x: w, y: -h },
|
||||
{ x: w/2, y: -h * 3/2 },
|
||||
{ x: 0, y: -h }
|
||||
];
|
||||
shapeSvg = parent.insert("polygon", ":first-child")
|
||||
.attr("points", points.map(function(d) { return d.x + "," + d.y; }).join(" "))
|
||||
.attr("transform", "translate(" + (-w/2) + "," + (h * 3/4) + ")");
|
||||
|
||||
node.intersect = function(point) {
|
||||
return dagreD3.intersect.polygon(node, points, point);
|
||||
};
|
||||
|
||||
return shapeSvg;
|
||||
};
|
||||
|
||||
// Add our custom arrow (a hollow-point)
|
||||
render.arrows().hollowPoint = function normal(parent, id, edge, type) {
|
||||
var marker = parent.append("marker")
|
||||
.attr("id", id)
|
||||
.attr("viewBox", "0 0 10 10")
|
||||
.attr("refX", 9)
|
||||
.attr("refY", 5)
|
||||
.attr("markerUnits", "strokeWidth")
|
||||
.attr("markerWidth", 8)
|
||||
.attr("markerHeight", 6)
|
||||
.attr("orient", "auto");
|
||||
|
||||
var path = marker.append("path")
|
||||
.attr("d", "M 0 0 L 10 5 L 0 10 z")
|
||||
.style("stroke-width", 1)
|
||||
.style("stroke-dasharray", "1,0")
|
||||
.style("fill", "#fff")
|
||||
.style("stroke", "#333");
|
||||
dagreD3.util.applyStyle(path, edge[type + "Style"]);
|
||||
};
|
||||
|
||||
// Run the renderer. This is what draws the final graph.
|
||||
render(inner, g);
|
||||
|
||||
// Center the graph
|
||||
var initialScale = 0.75;
|
||||
zoom
|
||||
.translate([(svg.attr("width") - g.graph().width * initialScale) / 2, 20])
|
||||
.scale(initialScale)
|
||||
.event(svg);
|
||||
svg.attr('height', g.graph().height * initialScale + 40);
|
||||
</script>
|
||||
|
||||
<script src="demo.js"></script>
|
18
node_modules/dagre-d3-renderer/index.js
generated
vendored
Normal file
18
node_modules/dagre-d3-renderer/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import d3 from 'd3'
|
||||
import graphlib from 'graphlib'
|
||||
import dagre from 'dagre-layout'
|
||||
|
||||
import intersect from './lib/intersect'
|
||||
import render from './lib/render'
|
||||
import util from './lib/util'
|
||||
import { version } from './package.json'
|
||||
|
||||
export default {
|
||||
d3,
|
||||
graphlib,
|
||||
dagre,
|
||||
intersect,
|
||||
render,
|
||||
util,
|
||||
version
|
||||
}
|
56
node_modules/dagre-d3-renderer/karma.conf.js
generated
vendored
Normal file
56
node_modules/dagre-d3-renderer/karma.conf.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
export default function (config) {
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['mocha'],
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
{ pattern: 'test/*.css', included: false },
|
||||
'node_modules/chai/chai.js',
|
||||
'node_modules/lodash/lodash.js',
|
||||
'node_modules/d3/d3.js',
|
||||
'dist/dagre-d3.js',
|
||||
'test/bundle-test.js'
|
||||
],
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
],
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress'],
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: true,
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: ['Chrome', 'Safari', 'Firefox'],
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: false
|
||||
})
|
||||
}
|
71
node_modules/dagre-d3-renderer/lib/arrows.js
generated
vendored
Normal file
71
node_modules/dagre-d3-renderer/lib/arrows.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
import util from './util'
|
||||
|
||||
function normal (parent, id, edge, type) {
|
||||
const marker = parent.append('marker')
|
||||
.attr('id', id)
|
||||
.attr('viewBox', '0 0 10 10')
|
||||
.attr('refX', 9)
|
||||
.attr('refY', 5)
|
||||
.attr('markerUnits', 'strokeWidth')
|
||||
.attr('markerWidth', 8)
|
||||
.attr('markerHeight', 6)
|
||||
.attr('orient', 'auto')
|
||||
|
||||
const path = marker.append('path')
|
||||
.attr('d', 'M 0 0 L 10 5 L 0 10 z')
|
||||
.style('stroke-width', 1)
|
||||
.style('stroke-dasharray', '1,0')
|
||||
util.applyStyle(path, edge[type + 'Style'])
|
||||
if (edge[type + 'Class']) {
|
||||
path.attr('class', edge[type + 'Class'])
|
||||
}
|
||||
}
|
||||
|
||||
function vee (parent, id, edge, type) {
|
||||
const marker = parent.append('marker')
|
||||
.attr('id', id)
|
||||
.attr('viewBox', '0 0 10 10')
|
||||
.attr('refX', 9)
|
||||
.attr('refY', 5)
|
||||
.attr('markerUnits', 'strokeWidth')
|
||||
.attr('markerWidth', 8)
|
||||
.attr('markerHeight', 6)
|
||||
.attr('orient', 'auto')
|
||||
|
||||
const path = marker.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')
|
||||
util.applyStyle(path, edge[type + 'Style'])
|
||||
if (edge[type + 'Class']) {
|
||||
path.attr('class', edge[type + 'Class'])
|
||||
}
|
||||
}
|
||||
|
||||
function undirected (parent, id, edge, type) {
|
||||
const marker = parent.append('marker')
|
||||
.attr('id', id)
|
||||
.attr('viewBox', '0 0 10 10')
|
||||
.attr('refX', 9)
|
||||
.attr('refY', 5)
|
||||
.attr('markerUnits', 'strokeWidth')
|
||||
.attr('markerWidth', 8)
|
||||
.attr('markerHeight', 6)
|
||||
.attr('orient', 'auto')
|
||||
|
||||
const path = marker.append('path')
|
||||
.attr('d', 'M 0 5 L 10 5')
|
||||
.style('stroke-width', 1)
|
||||
.style('stroke-dasharray', '1,0')
|
||||
util.applyStyle(path, edge[type + 'Style'])
|
||||
if (edge[type + 'Class']) {
|
||||
path.attr('class', edge[type + 'Class'])
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
normal,
|
||||
vee,
|
||||
undirected,
|
||||
default: normal
|
||||
}
|
45
node_modules/dagre-d3-renderer/lib/create-clusters.js
generated
vendored
Normal file
45
node_modules/dagre-d3-renderer/lib/create-clusters.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import d3 from 'd3'
|
||||
|
||||
import util from './util'
|
||||
import addLabel from './label/add-label'
|
||||
|
||||
function createClusters (selection, g) {
|
||||
const clusters = g.nodes().filter(function (v) { return util.isSubgraph(g, v) })
|
||||
const svgClusters = selection.selectAll('g.cluster')
|
||||
.data(clusters, function (v) { return v })
|
||||
|
||||
svgClusters.selectAll('*').remove()
|
||||
svgClusters.enter()
|
||||
.append('g')
|
||||
.attr('class', 'cluster')
|
||||
.attr('id', function (v) {
|
||||
const node = g.node(v)
|
||||
return node.id
|
||||
})
|
||||
.style('opacity', 0)
|
||||
|
||||
util.applyTransition(svgClusters, g)
|
||||
.style('opacity', 1)
|
||||
|
||||
svgClusters.each(function (v) {
|
||||
const node = g.node(v)
|
||||
const thisGroup = d3.select(this)
|
||||
d3.select(this).append('rect')
|
||||
const labelGroup = thisGroup.append('g').attr('class', 'label')
|
||||
addLabel(labelGroup, node, node.clusterLabelPos)
|
||||
})
|
||||
|
||||
svgClusters.selectAll('rect').each(function (c) {
|
||||
const node = g.node(c)
|
||||
const domCluster = d3.select(this)
|
||||
util.applyStyle(domCluster, node.style)
|
||||
})
|
||||
|
||||
util.applyTransition(svgClusters.exit(), g)
|
||||
.style('opacity', 0)
|
||||
.remove()
|
||||
|
||||
return svgClusters
|
||||
}
|
||||
|
||||
export default createClusters
|
34
node_modules/dagre-d3-renderer/lib/create-edge-labels.js
generated
vendored
Normal file
34
node_modules/dagre-d3-renderer/lib/create-edge-labels.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import d3 from 'd3'
|
||||
import _ from 'lodash'
|
||||
|
||||
import addLabel from './label/add-label'
|
||||
import util from './util'
|
||||
|
||||
function createEdgeLabels (selection, g) {
|
||||
const svgEdgeLabels = selection.selectAll('g.edgeLabel')
|
||||
.data(g.edges(), function (e) { return util.edgeToId(e) })
|
||||
.classed('update', true)
|
||||
|
||||
svgEdgeLabels.selectAll('*').remove()
|
||||
svgEdgeLabels.enter()
|
||||
.append('g')
|
||||
.classed('edgeLabel', true)
|
||||
.style('opacity', 0)
|
||||
svgEdgeLabels.each(function (e) {
|
||||
const edge = g.edge(e)
|
||||
const label = addLabel(d3.select(this), g.edge(e), 0, 0).classed('label', true)
|
||||
const bbox = label.node().getBBox()
|
||||
|
||||
if (edge.labelId) { label.attr('id', edge.labelId) }
|
||||
if (!_.has(edge, 'width')) { edge.width = bbox.width }
|
||||
if (!_.has(edge, 'height')) { edge.height = bbox.height }
|
||||
})
|
||||
|
||||
util.applyTransition(svgEdgeLabels.exit(), g)
|
||||
.style('opacity', 0)
|
||||
.remove()
|
||||
|
||||
return svgEdgeLabels
|
||||
}
|
||||
|
||||
export default createEdgeLabels
|
131
node_modules/dagre-d3-renderer/lib/create-edge-paths.js
generated
vendored
Normal file
131
node_modules/dagre-d3-renderer/lib/create-edge-paths.js
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
import d3 from 'd3'
|
||||
import _ from 'lodash'
|
||||
|
||||
import intersectNode from './intersect/intersect-node'
|
||||
import util from './util'
|
||||
|
||||
function createEdgePaths (selection, g, arrows) {
|
||||
const svgPaths = selection.selectAll('g.edgePath')
|
||||
.data(g.edges(), function (e) { return util.edgeToId(e) })
|
||||
.classed('update', true)
|
||||
|
||||
enter(svgPaths, g)
|
||||
exit(svgPaths, g)
|
||||
|
||||
util.applyTransition(svgPaths, g)
|
||||
.style('opacity', 1)
|
||||
|
||||
// Save DOM element in the path group, and set ID and class
|
||||
svgPaths.each(function (e) {
|
||||
const domEdge = d3.select(this)
|
||||
const edge = g.edge(e)
|
||||
edge.elem = this
|
||||
|
||||
if (edge.id) {
|
||||
domEdge.attr('id', edge.id)
|
||||
}
|
||||
|
||||
util.applyClass(domEdge, edge['class'],
|
||||
(domEdge.classed('update') ? 'update ' : '') + 'edgePath')
|
||||
})
|
||||
|
||||
svgPaths.selectAll('path.path')
|
||||
.each(function (e) {
|
||||
const edge = g.edge(e)
|
||||
edge.arrowheadId = _.uniqueId('arrowhead')
|
||||
|
||||
const domEdge = d3.select(this)
|
||||
.attr('marker-end', function () {
|
||||
return 'url(#' + edge.arrowheadId + ')'
|
||||
})
|
||||
.style('fill', 'none')
|
||||
|
||||
util.applyTransition(domEdge, g)
|
||||
.attr('d', function (e) { return calcPoints(g, e) })
|
||||
|
||||
util.applyStyle(domEdge, edge.style)
|
||||
})
|
||||
|
||||
svgPaths.selectAll('defs *').remove()
|
||||
svgPaths.selectAll('defs')
|
||||
.each(function (e) {
|
||||
const edge = g.edge(e)
|
||||
const arrowhead = arrows[edge.arrowhead]
|
||||
arrowhead(d3.select(this), edge.arrowheadId, edge, 'arrowhead')
|
||||
})
|
||||
|
||||
return svgPaths
|
||||
}
|
||||
|
||||
function calcPoints (g, e) {
|
||||
const edge = g.edge(e)
|
||||
const tail = g.node(e.v)
|
||||
const head = g.node(e.w)
|
||||
const points = edge.points.slice(1, edge.points.length - 1)
|
||||
points.unshift(intersectNode(tail, points[0]))
|
||||
points.push(intersectNode(head, points[points.length - 1]))
|
||||
|
||||
return createLine(edge, points)
|
||||
}
|
||||
|
||||
function createLine (edge, points) {
|
||||
const line = d3.svg.line()
|
||||
.x(function (d) { return d.x })
|
||||
.y(function (d) { return d.y })
|
||||
|
||||
if (_.has(edge, 'lineInterpolate')) {
|
||||
line.interpolate(edge.lineInterpolate)
|
||||
}
|
||||
|
||||
if (_.has(edge, 'lineTension')) {
|
||||
line.tension(Number(edge.lineTension))
|
||||
}
|
||||
|
||||
return line(points)
|
||||
}
|
||||
|
||||
function getCoords (elem) {
|
||||
const bbox = elem.getBBox()
|
||||
const matrix = elem.ownerSVGElement.getScreenCTM()
|
||||
.inverse()
|
||||
.multiply(elem.getScreenCTM())
|
||||
.translate(bbox.width / 2, bbox.height / 2)
|
||||
return { x: matrix.e, y: matrix.f }
|
||||
}
|
||||
|
||||
function enter (svgPaths, g) {
|
||||
const svgPathsEnter = svgPaths.enter()
|
||||
.append('g')
|
||||
.attr('class', 'edgePath')
|
||||
.style('opacity', 0)
|
||||
svgPathsEnter.append('path')
|
||||
.attr('class', 'path')
|
||||
.attr('d', function (e) {
|
||||
const edge = g.edge(e)
|
||||
const sourceElem = g.node(e.v).elem
|
||||
const points = _.range(edge.points.length).map(function () { return getCoords(sourceElem) })
|
||||
return createLine(edge, points)
|
||||
})
|
||||
svgPathsEnter.append('defs')
|
||||
}
|
||||
|
||||
function exit (svgPaths, g) {
|
||||
const svgPathExit = svgPaths.exit()
|
||||
util.applyTransition(svgPathExit, g)
|
||||
.style('opacity', 0)
|
||||
.remove()
|
||||
|
||||
util.applyTransition(svgPathExit.select('path.path'), g)
|
||||
.attr('d', function (e) {
|
||||
const source = g.node(e.v)
|
||||
|
||||
if (source) {
|
||||
const points = _.range(this.getTotalLength()).map(function () { return source })
|
||||
return createLine({}, points)
|
||||
} else {
|
||||
return d3.select(this).attr('d')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default createEdgePaths
|
57
node_modules/dagre-d3-renderer/lib/create-nodes.js
generated
vendored
Normal file
57
node_modules/dagre-d3-renderer/lib/create-nodes.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import _ from 'lodash'
|
||||
import d3 from 'd3'
|
||||
|
||||
import addLabel from './label/add-label'
|
||||
import util from './util'
|
||||
|
||||
function createNodes (selection, g, shapes) {
|
||||
const simpleNodes = g.nodes().filter(function (v) { return !util.isSubgraph(g, v) })
|
||||
const svgNodes = selection.selectAll('g.node')
|
||||
.data(simpleNodes, function (v) { return v })
|
||||
.classed('update', true)
|
||||
|
||||
svgNodes.selectAll('*').remove()
|
||||
svgNodes.enter()
|
||||
.append('g')
|
||||
.attr('class', 'node')
|
||||
.style('opacity', 0)
|
||||
svgNodes.each(function (v) {
|
||||
const node = g.node(v)
|
||||
const thisGroup = d3.select(this)
|
||||
const labelGroup = thisGroup.append('g').attr('class', 'label')
|
||||
const labelDom = addLabel(labelGroup, node)
|
||||
const shape = shapes[node.shape]
|
||||
const bbox = _.pick(labelDom.node().getBBox(), 'width', 'height')
|
||||
|
||||
node.elem = this
|
||||
|
||||
if (node.id) { thisGroup.attr('id', node.id) }
|
||||
if (node.labelId) { labelGroup.attr('id', node.labelId) }
|
||||
util.applyClass(thisGroup, node['class'],
|
||||
(thisGroup.classed('update') ? 'update ' : '') + 'node')
|
||||
|
||||
if (_.has(node, 'width')) { bbox.width = node.width }
|
||||
if (_.has(node, 'height')) { bbox.height = node.height }
|
||||
|
||||
bbox.width += node.paddingLeft + node.paddingRight
|
||||
bbox.height += node.paddingTop + node.paddingBottom
|
||||
labelGroup.attr('transform', 'translate(' +
|
||||
((node.paddingLeft - node.paddingRight) / 2) + ',' +
|
||||
((node.paddingTop - node.paddingBottom) / 2) + ')')
|
||||
|
||||
const shapeSvg = shape(d3.select(this), bbox, node)
|
||||
util.applyStyle(shapeSvg, node.style)
|
||||
|
||||
const shapeBBox = shapeSvg.node().getBBox()
|
||||
node.width = shapeBBox.width
|
||||
node.height = shapeBBox.height
|
||||
})
|
||||
|
||||
util.applyTransition(svgNodes.exit(), g)
|
||||
.style('opacity', 0)
|
||||
.remove()
|
||||
|
||||
return svgNodes
|
||||
}
|
||||
|
||||
export default createNodes
|
13
node_modules/dagre-d3-renderer/lib/intersect/index.js
generated
vendored
Normal file
13
node_modules/dagre-d3-renderer/lib/intersect/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import node from './intersect-node'
|
||||
import circle from './intersect-circle'
|
||||
import ellipse from './intersect-ellipse'
|
||||
import polygon from './intersect-polygon'
|
||||
import rect from './intersect-rect'
|
||||
|
||||
export default {
|
||||
node,
|
||||
circle,
|
||||
ellipse,
|
||||
polygon,
|
||||
rect
|
||||
}
|
7
node_modules/dagre-d3-renderer/lib/intersect/intersect-circle.js
generated
vendored
Normal file
7
node_modules/dagre-d3-renderer/lib/intersect/intersect-circle.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import intersectEllipse from './intersect-ellipse'
|
||||
|
||||
function intersectCircle (node, rx, point) {
|
||||
return intersectEllipse(node, rx, rx, point)
|
||||
}
|
||||
|
||||
export default intersectCircle
|
24
node_modules/dagre-d3-renderer/lib/intersect/intersect-ellipse.js
generated
vendored
Normal file
24
node_modules/dagre-d3-renderer/lib/intersect/intersect-ellipse.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
function intersectEllipse (node, rx, ry, point) {
|
||||
// Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html
|
||||
|
||||
const cx = node.x
|
||||
const cy = node.y
|
||||
|
||||
const px = cx - point.x
|
||||
const py = cy - point.y
|
||||
|
||||
const det = Math.sqrt(rx * rx * py * py + ry * ry * px * px)
|
||||
|
||||
let dx = Math.abs(rx * ry * px / det)
|
||||
if (point.x < cx) {
|
||||
dx = -dx
|
||||
}
|
||||
let dy = Math.abs(rx * ry * py / det)
|
||||
if (point.y < cy) {
|
||||
dy = -dy
|
||||
}
|
||||
|
||||
return {x: cx + dx, y: cy + dy}
|
||||
}
|
||||
|
||||
export default intersectEllipse
|
65
node_modules/dagre-d3-renderer/lib/intersect/intersect-line.js
generated
vendored
Normal file
65
node_modules/dagre-d3-renderer/lib/intersect/intersect-line.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Returns the point at which two lines, p and q, intersect or returns
|
||||
* undefined if they do not intersect.
|
||||
*/
|
||||
function intersectLine (p1, p2, q1, q2) {
|
||||
// Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
|
||||
// p7 and p473.
|
||||
|
||||
// Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
|
||||
// b1 y + c1 = 0.
|
||||
const a1 = p2.y - p1.y
|
||||
const b1 = p1.x - p2.x
|
||||
const c1 = (p2.x * p1.y) - (p1.x * p2.y)
|
||||
|
||||
// Compute r3 and r4.
|
||||
const r3 = ((a1 * q1.x) + (b1 * q1.y) + c1)
|
||||
const r4 = ((a1 * q2.x) + (b1 * q2.y) + c1)
|
||||
|
||||
// Check signs of r3 and r4. If both point 3 and point 4 lie on
|
||||
// same side of line 1, the line segments do not intersect.
|
||||
if ((r3 !== 0) && (r4 !== 0) && sameSign(r3, r4)) {
|
||||
return /* DONT_INTERSECT */
|
||||
}
|
||||
|
||||
// Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0
|
||||
const a2 = q2.y - q1.y
|
||||
const b2 = q1.x - q2.x
|
||||
const c2 = (q2.x * q1.y) - (q1.x * q2.y)
|
||||
|
||||
// Compute r1 and r2
|
||||
const r1 = (a2 * p1.x) + (b2 * p1.y) + c2
|
||||
const r2 = (a2 * p2.x) + (b2 * p2.y) + c2
|
||||
|
||||
// Check signs of r1 and r2. If both point 1 and point 2 lie
|
||||
// on same side of second line segment, the line segments do
|
||||
// not intersect.
|
||||
if ((r1 !== 0) && (r2 !== 0) && (sameSign(r1, r2))) {
|
||||
return /* DONT_INTERSECT */
|
||||
}
|
||||
|
||||
// Line segments intersect: compute intersection point.
|
||||
const denom = (a1 * b2) - (a2 * b1)
|
||||
if (denom === 0) {
|
||||
return /* COLLINEAR */
|
||||
}
|
||||
|
||||
const offset = Math.abs(denom / 2)
|
||||
|
||||
// The denom/2 is to get rounding instead of truncating. It
|
||||
// is added or subtracted to the numerator, depending upon the
|
||||
// sign of the numerator.
|
||||
let num = (b1 * c2) - (b2 * c1)
|
||||
const x = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom)
|
||||
|
||||
num = (a2 * c1) - (a1 * c2)
|
||||
const y = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom)
|
||||
|
||||
return { x, y }
|
||||
}
|
||||
|
||||
function sameSign (r1, r2) {
|
||||
return r1 * r2 > 0
|
||||
}
|
||||
|
||||
export default intersectLine
|
5
node_modules/dagre-d3-renderer/lib/intersect/intersect-node.js
generated
vendored
Normal file
5
node_modules/dagre-d3-renderer/lib/intersect/intersect-node.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
function intersectNode (node, point) {
|
||||
return node.intersect(point)
|
||||
}
|
||||
|
||||
export default intersectNode
|
55
node_modules/dagre-d3-renderer/lib/intersect/intersect-polygon.js
generated
vendored
Normal file
55
node_modules/dagre-d3-renderer/lib/intersect/intersect-polygon.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
import intersectLine from './intersect-line'
|
||||
|
||||
/*
|
||||
* Returns the point ({x, y}) at which the point argument intersects with the
|
||||
* node argument assuming that it has the shape specified by polygon.
|
||||
*/
|
||||
function intersectPolygon (node, polyPoints, point) {
|
||||
const x1 = node.x
|
||||
const y1 = node.y
|
||||
|
||||
const intersections = []
|
||||
|
||||
let minX = Number.POSITIVE_INFINITY
|
||||
let minY = Number.POSITIVE_INFINITY
|
||||
polyPoints.forEach(function (entry) {
|
||||
minX = Math.min(minX, entry.x)
|
||||
minY = Math.min(minY, entry.y)
|
||||
})
|
||||
|
||||
const left = x1 - node.width / 2 - minX
|
||||
const top = y1 - node.height / 2 - minY
|
||||
|
||||
for (let i = 0; i < polyPoints.length; i += 1) {
|
||||
const p1 = polyPoints[i]
|
||||
const p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0]
|
||||
const intersect = intersectLine(node, point,
|
||||
{x: left + p1.x, y: top + p1.y}, {x: left + p2.x, y: top + p2.y})
|
||||
if (intersect) {
|
||||
intersections.push(intersect)
|
||||
}
|
||||
}
|
||||
|
||||
if (!intersections.length) {
|
||||
console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node)
|
||||
return node
|
||||
}
|
||||
|
||||
if (intersections.length > 1) {
|
||||
// More intersections, find the one nearest to edge end point
|
||||
intersections.sort(function (p, q) {
|
||||
const pdx = p.x - point.x
|
||||
const pdy = p.y - point.y
|
||||
const distp = Math.sqrt(pdx * pdx + pdy * pdy)
|
||||
|
||||
const qdx = q.x - point.x
|
||||
const qdy = q.y - point.y
|
||||
const distq = Math.sqrt(qdx * qdx + qdy * qdy)
|
||||
|
||||
return (distp < distq) ? -1 : (distp === distq ? 0 : 1)
|
||||
})
|
||||
}
|
||||
return intersections[0]
|
||||
}
|
||||
|
||||
export default intersectPolygon
|
32
node_modules/dagre-d3-renderer/lib/intersect/intersect-rect.js
generated
vendored
Normal file
32
node_modules/dagre-d3-renderer/lib/intersect/intersect-rect.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
function intersectRect (node, point) {
|
||||
const x = node.x
|
||||
const y = node.y
|
||||
|
||||
// Rectangle intersection algorithm from:
|
||||
// http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
|
||||
const dx = point.x - x
|
||||
const dy = point.y - y
|
||||
let w = node.width / 2
|
||||
let h = node.height / 2
|
||||
|
||||
let sx, sy
|
||||
if (Math.abs(dy) * w > Math.abs(dx) * h) {
|
||||
// Intersection is top or bottom of rect.
|
||||
if (dy < 0) {
|
||||
h = -h
|
||||
}
|
||||
sx = dy === 0 ? 0 : h * dx / dy
|
||||
sy = h
|
||||
} else {
|
||||
// Intersection is left or right of rect.
|
||||
if (dx < 0) {
|
||||
w = -w
|
||||
}
|
||||
sx = w
|
||||
sy = dx === 0 ? 0 : w * dy / dx
|
||||
}
|
||||
|
||||
return {x: x + sx, y: y + sy}
|
||||
}
|
||||
|
||||
export default intersectRect
|
37
node_modules/dagre-d3-renderer/lib/label/add-html-label.js
generated
vendored
Normal file
37
node_modules/dagre-d3-renderer/lib/label/add-html-label.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import util from '../util'
|
||||
|
||||
function addHtmlLabel (root, node) {
|
||||
const fo = root
|
||||
.append('foreignObject')
|
||||
.attr('width', '100000')
|
||||
|
||||
const div = fo
|
||||
.append('xhtml:div')
|
||||
div.attr('xmlns', 'http://www.w3.org/1999/xhtml')
|
||||
|
||||
const label = node.label
|
||||
switch (typeof label) {
|
||||
case 'function':
|
||||
div.insert(label)
|
||||
break
|
||||
case 'object':
|
||||
// Currently we assume this is a DOM object.
|
||||
div.insert(function () { return label })
|
||||
break
|
||||
default: div.html(label)
|
||||
}
|
||||
|
||||
util.applyStyle(div, node.labelStyle)
|
||||
div.style('display', 'inline-block')
|
||||
// Fix for firefox
|
||||
div.style('white-space', 'nowrap')
|
||||
|
||||
const client = div[0][0].getBoundingClientRect()
|
||||
fo
|
||||
.attr('width', client.width)
|
||||
.attr('height', client.height)
|
||||
|
||||
return fo
|
||||
}
|
||||
|
||||
export default addHtmlLabel
|
37
node_modules/dagre-d3-renderer/lib/label/add-label.js
generated
vendored
Normal file
37
node_modules/dagre-d3-renderer/lib/label/add-label.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import addTextLabel from './add-text-label'
|
||||
import addHtmlLabel from './add-html-label'
|
||||
import addSVGLabel from './add-svg-label'
|
||||
|
||||
function addLabel (root, node, location) {
|
||||
const label = node.label
|
||||
const labelSvg = root.append('g')
|
||||
|
||||
// Allow the label to be a string, a function that returns a DOM element, or
|
||||
// a DOM element itself.
|
||||
if (node.labelType === 'svg') {
|
||||
addSVGLabel(labelSvg, node)
|
||||
} else if (typeof label !== 'string' || node.labelType === 'html') {
|
||||
addHtmlLabel(labelSvg, node)
|
||||
} else {
|
||||
addTextLabel(labelSvg, node)
|
||||
}
|
||||
|
||||
const labelBBox = labelSvg.node().getBBox()
|
||||
let y
|
||||
switch (location) {
|
||||
case 'top':
|
||||
y = (-node.height / 2)
|
||||
break
|
||||
case 'bottom':
|
||||
y = (node.height / 2) - labelBBox.height
|
||||
break
|
||||
default:
|
||||
y = (-labelBBox.height / 2)
|
||||
}
|
||||
labelSvg.attr('transform',
|
||||
'translate(' + (-labelBBox.width / 2) + ',' + y + ')')
|
||||
|
||||
return labelSvg
|
||||
}
|
||||
|
||||
export default addLabel
|
13
node_modules/dagre-d3-renderer/lib/label/add-svg-label.js
generated
vendored
Normal file
13
node_modules/dagre-d3-renderer/lib/label/add-svg-label.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import util from '../util'
|
||||
|
||||
function addSVGLabel (root, node) {
|
||||
const domNode = root
|
||||
|
||||
domNode.node().appendChild(node.label)
|
||||
|
||||
util.applyStyle(domNode, node.labelStyle)
|
||||
|
||||
return domNode
|
||||
}
|
||||
|
||||
export default addSVGLabel
|
45
node_modules/dagre-d3-renderer/lib/label/add-text-label.js
generated
vendored
Normal file
45
node_modules/dagre-d3-renderer/lib/label/add-text-label.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import util from '../util'
|
||||
|
||||
/*
|
||||
* Attaches a text label to the specified root. Handles escape sequences.
|
||||
*/
|
||||
function addTextLabel (root, node) {
|
||||
const domNode = root.append('text')
|
||||
|
||||
const lines = processEscapeSequences(node.label).split('\n')
|
||||
for (let i = 0; i < lines.length; i += 1) {
|
||||
domNode
|
||||
.append('tspan')
|
||||
.attr('xml:space', 'preserve')
|
||||
.attr('dy', '1em')
|
||||
.attr('x', '1')
|
||||
.text(lines[i])
|
||||
}
|
||||
|
||||
util.applyStyle(domNode, node.labelStyle)
|
||||
|
||||
return domNode
|
||||
}
|
||||
|
||||
function processEscapeSequences (text) {
|
||||
let newText = ''
|
||||
let escaped = false
|
||||
let ch = null
|
||||
for (let i = 0; i < text.length; i += 1) {
|
||||
ch = text[i]
|
||||
if (escaped) {
|
||||
switch (ch) {
|
||||
case 'n': newText += '\n'; break
|
||||
default: newText += ch
|
||||
}
|
||||
escaped = false
|
||||
} else if (ch === '\\') {
|
||||
escaped = true
|
||||
} else {
|
||||
newText += ch
|
||||
}
|
||||
}
|
||||
return newText
|
||||
}
|
||||
|
||||
export default addTextLabel
|
31
node_modules/dagre-d3-renderer/lib/position-clusters.js
generated
vendored
Normal file
31
node_modules/dagre-d3-renderer/lib/position-clusters.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import d3 from 'd3'
|
||||
import util from './util'
|
||||
|
||||
function positionClusters (selection, g) {
|
||||
const created = selection.filter(function () { return !d3.select(this).classed('update') })
|
||||
|
||||
function translate (v) {
|
||||
const node = g.node(v)
|
||||
return 'translate(' + node.x + ',' + node.y + ')'
|
||||
}
|
||||
|
||||
created.attr('transform', translate)
|
||||
|
||||
util.applyTransition(selection, g)
|
||||
.style('opacity', 1)
|
||||
.attr('transform', translate)
|
||||
|
||||
util.applyTransition(created.selectAll('rect'), g)
|
||||
.attr('width', function (v) { return g.node(v).width })
|
||||
.attr('height', function (v) { return g.node(v).height })
|
||||
.attr('x', function (v) {
|
||||
const node = g.node(v)
|
||||
return -node.width / 2
|
||||
})
|
||||
.attr('y', function (v) {
|
||||
const node = g.node(v)
|
||||
return -node.height / 2
|
||||
})
|
||||
}
|
||||
|
||||
export default positionClusters
|
21
node_modules/dagre-d3-renderer/lib/position-edge-labels.js
generated
vendored
Normal file
21
node_modules/dagre-d3-renderer/lib/position-edge-labels.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import d3 from 'd3'
|
||||
import _ from 'lodash'
|
||||
|
||||
import util from './util'
|
||||
|
||||
function positionEdgeLabels (selection, g) {
|
||||
const created = selection.filter(function () { return !d3.select(this).classed('update') })
|
||||
|
||||
function translate (e) {
|
||||
const edge = g.edge(e)
|
||||
return _.has(edge, 'x') ? 'translate(' + edge.x + ',' + edge.y + ')' : ''
|
||||
}
|
||||
|
||||
created.attr('transform', translate)
|
||||
|
||||
util.applyTransition(selection, g)
|
||||
.style('opacity', 1)
|
||||
.attr('transform', translate)
|
||||
}
|
||||
|
||||
export default positionEdgeLabels
|
20
node_modules/dagre-d3-renderer/lib/position-nodes.js
generated
vendored
Normal file
20
node_modules/dagre-d3-renderer/lib/position-nodes.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import d3 from 'd3'
|
||||
|
||||
import util from './util'
|
||||
|
||||
function positionNodes (selection, g) {
|
||||
const created = selection.filter(function () { return !d3.select(this).classed('update') })
|
||||
|
||||
function translate (v) {
|
||||
const node = g.node(v)
|
||||
return 'translate(' + node.x + ',' + node.y + ')'
|
||||
}
|
||||
|
||||
created.attr('transform', translate)
|
||||
|
||||
util.applyTransition(selection, g)
|
||||
.style('opacity', 1)
|
||||
.attr('transform', translate)
|
||||
}
|
||||
|
||||
export default positionNodes
|
186
node_modules/dagre-d3-renderer/lib/render.js
generated
vendored
Normal file
186
node_modules/dagre-d3-renderer/lib/render.js
generated
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
import _ from 'lodash'
|
||||
import { layout } from 'dagre-layout'
|
||||
|
||||
import positionNodes from './position-nodes'
|
||||
import positionEdgeLabels from './position-edge-labels'
|
||||
import positionClusters from './position-clusters'
|
||||
import createNodes from './create-nodes'
|
||||
import createClusters from './create-clusters'
|
||||
import createEdgeLabels from './create-edge-labels'
|
||||
import createEdgePaths from './create-edge-paths'
|
||||
import shapes from './shapes'
|
||||
import arrows from './arrows'
|
||||
|
||||
// This design is based on http://bost.ocks.org/mike/chart/.
|
||||
function render () {
|
||||
let _createNodes = createNodes
|
||||
let _createClusters = createClusters
|
||||
let _createEdgeLabels = createEdgeLabels
|
||||
let _createEdgePaths = createEdgePaths
|
||||
let _shapes = shapes
|
||||
let _arrows = arrows
|
||||
|
||||
const fn = function (svg, g) {
|
||||
preProcessGraph(g)
|
||||
|
||||
const outputGroup = createOrSelectGroup(svg, 'output')
|
||||
const clustersGroup = createOrSelectGroup(outputGroup, 'clusters')
|
||||
const edgePathsGroup = createOrSelectGroup(outputGroup, 'edgePaths')
|
||||
const edgeLabels = _createEdgeLabels(createOrSelectGroup(outputGroup, 'edgeLabels'), g)
|
||||
const nodes = _createNodes(createOrSelectGroup(outputGroup, 'nodes'), g, _shapes)
|
||||
|
||||
layout(g)
|
||||
|
||||
positionNodes(nodes, g)
|
||||
positionEdgeLabels(edgeLabels, g)
|
||||
_createEdgePaths(edgePathsGroup, g, _arrows)
|
||||
|
||||
const clusters = _createClusters(clustersGroup, g)
|
||||
positionClusters(clusters, g)
|
||||
|
||||
postProcessGraph(g)
|
||||
}
|
||||
|
||||
fn.createNodes = function (value) {
|
||||
if (!arguments.length) {
|
||||
return _createNodes
|
||||
}
|
||||
_createNodes = value
|
||||
return fn
|
||||
}
|
||||
|
||||
fn.createClusters = function (value) {
|
||||
if (!arguments.length) {
|
||||
return _createClusters
|
||||
}
|
||||
_createClusters = value
|
||||
return fn
|
||||
}
|
||||
|
||||
fn.createEdgeLabels = function (value) {
|
||||
if (!arguments.length) {
|
||||
return _createEdgeLabels
|
||||
}
|
||||
_createEdgeLabels = value
|
||||
return fn
|
||||
}
|
||||
|
||||
fn.createEdgePaths = function (value) {
|
||||
if (!arguments.length) {
|
||||
return _createEdgePaths
|
||||
}
|
||||
_createEdgePaths = value
|
||||
return fn
|
||||
}
|
||||
|
||||
fn.shapes = function (value) {
|
||||
if (!arguments.length) {
|
||||
return _shapes
|
||||
}
|
||||
_shapes = value
|
||||
return fn
|
||||
}
|
||||
|
||||
fn.arrows = function (value) {
|
||||
if (!arguments.length) {
|
||||
return _arrows
|
||||
}
|
||||
_arrows = value
|
||||
return fn
|
||||
}
|
||||
|
||||
return fn
|
||||
}
|
||||
|
||||
const NODE_DEFAULT_ATTRS = {
|
||||
paddingLeft: 10,
|
||||
paddingRight: 10,
|
||||
paddingTop: 10,
|
||||
paddingBottom: 10,
|
||||
rx: 0,
|
||||
ry: 0,
|
||||
shape: 'rect'
|
||||
}
|
||||
|
||||
const EDGE_DEFAULT_ATTRS = {
|
||||
arrowhead: 'normal',
|
||||
lineInterpolate: 'linear'
|
||||
}
|
||||
|
||||
function preProcessGraph (g) {
|
||||
g.nodes().forEach(function (v) {
|
||||
const node = g.node(v)
|
||||
if (!_.has(node, 'label') && !g.children(v).length) { node.label = v }
|
||||
|
||||
if (_.has(node, 'paddingX')) {
|
||||
_.defaults(node, {
|
||||
paddingLeft: node.paddingX,
|
||||
paddingRight: node.paddingX
|
||||
})
|
||||
}
|
||||
|
||||
if (_.has(node, 'paddingY')) {
|
||||
_.defaults(node, {
|
||||
paddingTop: node.paddingY,
|
||||
paddingBottom: node.paddingY
|
||||
})
|
||||
}
|
||||
|
||||
if (_.has(node, 'padding')) {
|
||||
_.defaults(node, {
|
||||
paddingLeft: node.padding,
|
||||
paddingRight: node.padding,
|
||||
paddingTop: node.padding,
|
||||
paddingBottom: node.padding
|
||||
})
|
||||
}
|
||||
|
||||
_.defaults(node, NODE_DEFAULT_ATTRS)
|
||||
|
||||
_.each(['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'], function (k) {
|
||||
node[k] = Number(node[k])
|
||||
})
|
||||
|
||||
// Save dimensions for restore during post-processing
|
||||
if (_.has(node, 'width')) { node._prevWidth = node.width }
|
||||
if (_.has(node, 'height')) { node._prevHeight = node.height }
|
||||
})
|
||||
|
||||
g.edges().forEach(function (e) {
|
||||
const edge = g.edge(e)
|
||||
if (!_.has(edge, 'label')) { edge.label = '' }
|
||||
_.defaults(edge, EDGE_DEFAULT_ATTRS)
|
||||
})
|
||||
}
|
||||
|
||||
function postProcessGraph (g) {
|
||||
_.each(g.nodes(), function (v) {
|
||||
const node = g.node(v)
|
||||
|
||||
// Restore original dimensions
|
||||
if (_.has(node, '_prevWidth')) {
|
||||
node.width = node._prevWidth
|
||||
} else {
|
||||
delete node.width
|
||||
}
|
||||
|
||||
if (_.has(node, '_prevHeight')) {
|
||||
node.height = node._prevHeight
|
||||
} else {
|
||||
delete node.height
|
||||
}
|
||||
|
||||
delete node._prevWidth
|
||||
delete node._prevHeight
|
||||
})
|
||||
}
|
||||
|
||||
function createOrSelectGroup (root, name) {
|
||||
let selection = root.select('g.' + name)
|
||||
if (selection.empty()) {
|
||||
selection = root.append('g').attr('class', name)
|
||||
}
|
||||
return selection
|
||||
}
|
||||
|
||||
export default render
|
79
node_modules/dagre-d3-renderer/lib/shapes.js
generated
vendored
Normal file
79
node_modules/dagre-d3-renderer/lib/shapes.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
import intersectRect from './intersect/intersect-rect'
|
||||
import intersectEllipse from './intersect/intersect-ellipse'
|
||||
import intersectCircle from './intersect/intersect-circle'
|
||||
import intersectPolygon from './intersect/intersect-polygon'
|
||||
|
||||
function rect (parent, bbox, node) {
|
||||
const shapeSvg = parent.insert('rect', ':first-child')
|
||||
.attr('rx', node.rx)
|
||||
.attr('ry', node.ry)
|
||||
.attr('x', -bbox.width / 2)
|
||||
.attr('y', -bbox.height / 2)
|
||||
.attr('width', bbox.width)
|
||||
.attr('height', bbox.height)
|
||||
|
||||
node.intersect = function (point) {
|
||||
return intersectRect(node, point)
|
||||
}
|
||||
|
||||
return shapeSvg
|
||||
}
|
||||
|
||||
function ellipse (parent, bbox, node) {
|
||||
const rx = bbox.width / 2
|
||||
const ry = bbox.height / 2
|
||||
const shapeSvg = parent.insert('ellipse', ':first-child')
|
||||
.attr('x', -bbox.width / 2)
|
||||
.attr('y', -bbox.height / 2)
|
||||
.attr('rx', rx)
|
||||
.attr('ry', ry)
|
||||
|
||||
node.intersect = function (point) {
|
||||
return intersectEllipse(node, rx, ry, point)
|
||||
}
|
||||
|
||||
return shapeSvg
|
||||
}
|
||||
|
||||
function circle (parent, bbox, node) {
|
||||
const r = Math.max(bbox.width, bbox.height) / 2
|
||||
const shapeSvg = parent.insert('circle', ':first-child')
|
||||
.attr('x', -bbox.width / 2)
|
||||
.attr('y', -bbox.height / 2)
|
||||
.attr('r', r)
|
||||
|
||||
node.intersect = function (point) {
|
||||
return intersectCircle(node, r, point)
|
||||
}
|
||||
|
||||
return shapeSvg
|
||||
}
|
||||
|
||||
// Circumscribe an ellipse for the bounding box with a diamond shape. I derived
|
||||
// the function to calculate the diamond shape from:
|
||||
// http://mathforum.org/kb/message.jspa?messageID=3750236
|
||||
function diamond (parent, bbox, node) {
|
||||
const w = (bbox.width * Math.SQRT2) / 2
|
||||
const h = (bbox.height * Math.SQRT2) / 2
|
||||
const points = [
|
||||
{ x: 0, y: -h },
|
||||
{ x: -w, y: 0 },
|
||||
{ x: 0, y: h },
|
||||
{ x: w, y: 0 }
|
||||
]
|
||||
const shapeSvg = parent.insert('polygon', ':first-child')
|
||||
.attr('points', points.map(function (p) { return p.x + ',' + p.y }).join(' '))
|
||||
|
||||
node.intersect = function (p) {
|
||||
return intersectPolygon(node, points, p)
|
||||
}
|
||||
|
||||
return shapeSvg
|
||||
}
|
||||
|
||||
export default {
|
||||
rect,
|
||||
ellipse,
|
||||
circle,
|
||||
diamond
|
||||
}
|
54
node_modules/dagre-d3-renderer/lib/util.js
generated
vendored
Normal file
54
node_modules/dagre-d3-renderer/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
import _ from 'lodash'
|
||||
|
||||
/*
|
||||
* Returns true if the specified node in the graph is a subgraph node. A
|
||||
* subgraph node is one that contains other nodes.
|
||||
*/
|
||||
function isSubgraph (g, v) {
|
||||
return !!g.children(v).length
|
||||
}
|
||||
|
||||
function edgeToId (e) {
|
||||
return escapeId(e.v) + ':' + escapeId(e.w) + ':' + escapeId(e.name)
|
||||
}
|
||||
|
||||
const ID_DELIM = /:/g
|
||||
function escapeId (str) {
|
||||
return str ? String(str).replace(ID_DELIM, '\\:') : ''
|
||||
}
|
||||
|
||||
function applyStyle (dom, styleFn) {
|
||||
if (styleFn) {
|
||||
dom.attr('style', styleFn)
|
||||
}
|
||||
}
|
||||
|
||||
function applyClass (dom, classFn, otherClasses) {
|
||||
if (classFn) {
|
||||
dom
|
||||
.attr('class', classFn)
|
||||
.attr('class', otherClasses + ' ' + dom.attr('class'))
|
||||
}
|
||||
}
|
||||
|
||||
function applyTransition (selection, g) {
|
||||
const graph = g.graph()
|
||||
|
||||
if (_.isPlainObject(graph)) {
|
||||
const transition = graph.transition
|
||||
if (_.isFunction(transition)) {
|
||||
return transition(selection)
|
||||
}
|
||||
}
|
||||
|
||||
return selection
|
||||
}
|
||||
|
||||
// Public utility functions
|
||||
export default {
|
||||
isSubgraph,
|
||||
edgeToId,
|
||||
applyStyle,
|
||||
applyClass,
|
||||
applyTransition
|
||||
}
|
47
node_modules/dagre-d3-renderer/node_modules/lodash/LICENSE
generated
vendored
Normal file
47
node_modules/dagre-d3-renderer/node_modules/lodash/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
|
||||
Based on Underscore.js, copyright Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals. For exact contribution history, see the revision history
|
||||
available at https://github.com/lodash/lodash
|
||||
|
||||
The following license applies to all parts of this software except as
|
||||
documented below:
|
||||
|
||||
====
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
====
|
||||
|
||||
Copyright and related rights for sample code are waived via CC0. Sample
|
||||
code is defined as all source code displayed within the prose of the
|
||||
documentation.
|
||||
|
||||
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
====
|
||||
|
||||
Files located in the node_modules and vendor directories are externally
|
||||
maintained libraries used by this software which have their own
|
||||
licenses; we recommend you read them, as their terms may differ from the
|
||||
terms above.
|
39
node_modules/dagre-d3-renderer/node_modules/lodash/README.md
generated
vendored
Normal file
39
node_modules/dagre-d3-renderer/node_modules/lodash/README.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# lodash v4.17.21
|
||||
|
||||
The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
```shell
|
||||
$ npm i -g npm
|
||||
$ npm i --save lodash
|
||||
```
|
||||
|
||||
In Node.js:
|
||||
```js
|
||||
// Load the full build.
|
||||
var _ = require('lodash');
|
||||
// Load the core build.
|
||||
var _ = require('lodash/core');
|
||||
// Load the FP build for immutable auto-curried iteratee-first data-last methods.
|
||||
var fp = require('lodash/fp');
|
||||
|
||||
// Load method categories.
|
||||
var array = require('lodash/array');
|
||||
var object = require('lodash/fp/object');
|
||||
|
||||
// Cherry-pick methods for smaller browserify/rollup/webpack bundles.
|
||||
var at = require('lodash/at');
|
||||
var curryN = require('lodash/fp/curryN');
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/4.17.21-npm) for more details.
|
||||
|
||||
**Note:**<br>
|
||||
Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL.
|
||||
|
||||
## Support
|
||||
|
||||
Tested in Chrome 74-75, Firefox 66-67, IE 11, Edge 18, Safari 11-12, & Node.js 8-12.<br>
|
||||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available.
|
7
node_modules/dagre-d3-renderer/node_modules/lodash/_DataView.js
generated
vendored
Normal file
7
node_modules/dagre-d3-renderer/node_modules/lodash/_DataView.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
var getNative = require('./_getNative'),
|
||||
root = require('./_root');
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var DataView = getNative(root, 'DataView');
|
||||
|
||||
module.exports = DataView;
|
32
node_modules/dagre-d3-renderer/node_modules/lodash/_Hash.js
generated
vendored
Normal file
32
node_modules/dagre-d3-renderer/node_modules/lodash/_Hash.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var hashClear = require('./_hashClear'),
|
||||
hashDelete = require('./_hashDelete'),
|
||||
hashGet = require('./_hashGet'),
|
||||
hashHas = require('./_hashHas'),
|
||||
hashSet = require('./_hashSet');
|
||||
|
||||
/**
|
||||
* Creates a hash object.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [entries] The key-value pairs to cache.
|
||||
*/
|
||||
function Hash(entries) {
|
||||
var index = -1,
|
||||
length = entries == null ? 0 : entries.length;
|
||||
|
||||
this.clear();
|
||||
while (++index < length) {
|
||||
var entry = entries[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add methods to `Hash`.
|
||||
Hash.prototype.clear = hashClear;
|
||||
Hash.prototype['delete'] = hashDelete;
|
||||
Hash.prototype.get = hashGet;
|
||||
Hash.prototype.has = hashHas;
|
||||
Hash.prototype.set = hashSet;
|
||||
|
||||
module.exports = Hash;
|
28
node_modules/dagre-d3-renderer/node_modules/lodash/_LazyWrapper.js
generated
vendored
Normal file
28
node_modules/dagre-d3-renderer/node_modules/lodash/_LazyWrapper.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
var baseCreate = require('./_baseCreate'),
|
||||
baseLodash = require('./_baseLodash');
|
||||
|
||||
/** Used as references for the maximum length and index of an array. */
|
||||
var MAX_ARRAY_LENGTH = 4294967295;
|
||||
|
||||
/**
|
||||
* Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {*} value The value to wrap.
|
||||
*/
|
||||
function LazyWrapper(value) {
|
||||
this.__wrapped__ = value;
|
||||
this.__actions__ = [];
|
||||
this.__dir__ = 1;
|
||||
this.__filtered__ = false;
|
||||
this.__iteratees__ = [];
|
||||
this.__takeCount__ = MAX_ARRAY_LENGTH;
|
||||
this.__views__ = [];
|
||||
}
|
||||
|
||||
// Ensure `LazyWrapper` is an instance of `baseLodash`.
|
||||
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
|
||||
LazyWrapper.prototype.constructor = LazyWrapper;
|
||||
|
||||
module.exports = LazyWrapper;
|
32
node_modules/dagre-d3-renderer/node_modules/lodash/_ListCache.js
generated
vendored
Normal file
32
node_modules/dagre-d3-renderer/node_modules/lodash/_ListCache.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var listCacheClear = require('./_listCacheClear'),
|
||||
listCacheDelete = require('./_listCacheDelete'),
|
||||
listCacheGet = require('./_listCacheGet'),
|
||||
listCacheHas = require('./_listCacheHas'),
|
||||
listCacheSet = require('./_listCacheSet');
|
||||
|
||||
/**
|
||||
* Creates an list cache object.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [entries] The key-value pairs to cache.
|
||||
*/
|
||||
function ListCache(entries) {
|
||||
var index = -1,
|
||||
length = entries == null ? 0 : entries.length;
|
||||
|
||||
this.clear();
|
||||
while (++index < length) {
|
||||
var entry = entries[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add methods to `ListCache`.
|
||||
ListCache.prototype.clear = listCacheClear;
|
||||
ListCache.prototype['delete'] = listCacheDelete;
|
||||
ListCache.prototype.get = listCacheGet;
|
||||
ListCache.prototype.has = listCacheHas;
|
||||
ListCache.prototype.set = listCacheSet;
|
||||
|
||||
module.exports = ListCache;
|
22
node_modules/dagre-d3-renderer/node_modules/lodash/_LodashWrapper.js
generated
vendored
Normal file
22
node_modules/dagre-d3-renderer/node_modules/lodash/_LodashWrapper.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
var baseCreate = require('./_baseCreate'),
|
||||
baseLodash = require('./_baseLodash');
|
||||
|
||||
/**
|
||||
* The base constructor for creating `lodash` wrapper objects.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to wrap.
|
||||
* @param {boolean} [chainAll] Enable explicit method chain sequences.
|
||||
*/
|
||||
function LodashWrapper(value, chainAll) {
|
||||
this.__wrapped__ = value;
|
||||
this.__actions__ = [];
|
||||
this.__chain__ = !!chainAll;
|
||||
this.__index__ = 0;
|
||||
this.__values__ = undefined;
|
||||
}
|
||||
|
||||
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
|
||||
LodashWrapper.prototype.constructor = LodashWrapper;
|
||||
|
||||
module.exports = LodashWrapper;
|
7
node_modules/dagre-d3-renderer/node_modules/lodash/_Map.js
generated
vendored
Normal file
7
node_modules/dagre-d3-renderer/node_modules/lodash/_Map.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
var getNative = require('./_getNative'),
|
||||
root = require('./_root');
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var Map = getNative(root, 'Map');
|
||||
|
||||
module.exports = Map;
|
32
node_modules/dagre-d3-renderer/node_modules/lodash/_MapCache.js
generated
vendored
Normal file
32
node_modules/dagre-d3-renderer/node_modules/lodash/_MapCache.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
var mapCacheClear = require('./_mapCacheClear'),
|
||||
mapCacheDelete = require('./_mapCacheDelete'),
|
||||
mapCacheGet = require('./_mapCacheGet'),
|
||||
mapCacheHas = require('./_mapCacheHas'),
|
||||
mapCacheSet = require('./_mapCacheSet');
|
||||
|
||||
/**
|
||||
* Creates a map cache object to store key-value pairs.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [entries] The key-value pairs to cache.
|
||||
*/
|
||||
function MapCache(entries) {
|
||||
var index = -1,
|
||||
length = entries == null ? 0 : entries.length;
|
||||
|
||||
this.clear();
|
||||
while (++index < length) {
|
||||
var entry = entries[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add methods to `MapCache`.
|
||||
MapCache.prototype.clear = mapCacheClear;
|
||||
MapCache.prototype['delete'] = mapCacheDelete;
|
||||
MapCache.prototype.get = mapCacheGet;
|
||||
MapCache.prototype.has = mapCacheHas;
|
||||
MapCache.prototype.set = mapCacheSet;
|
||||
|
||||
module.exports = MapCache;
|
7
node_modules/dagre-d3-renderer/node_modules/lodash/_Promise.js
generated
vendored
Normal file
7
node_modules/dagre-d3-renderer/node_modules/lodash/_Promise.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
var getNative = require('./_getNative'),
|
||||
root = require('./_root');
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var Promise = getNative(root, 'Promise');
|
||||
|
||||
module.exports = Promise;
|
7
node_modules/dagre-d3-renderer/node_modules/lodash/_Set.js
generated
vendored
Normal file
7
node_modules/dagre-d3-renderer/node_modules/lodash/_Set.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
var getNative = require('./_getNative'),
|
||||
root = require('./_root');
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var Set = getNative(root, 'Set');
|
||||
|
||||
module.exports = Set;
|
27
node_modules/dagre-d3-renderer/node_modules/lodash/_SetCache.js
generated
vendored
Normal file
27
node_modules/dagre-d3-renderer/node_modules/lodash/_SetCache.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
var MapCache = require('./_MapCache'),
|
||||
setCacheAdd = require('./_setCacheAdd'),
|
||||
setCacheHas = require('./_setCacheHas');
|
||||
|
||||
/**
|
||||
*
|
||||
* Creates an array cache object to store unique values.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [values] The values to cache.
|
||||
*/
|
||||
function SetCache(values) {
|
||||
var index = -1,
|
||||
length = values == null ? 0 : values.length;
|
||||
|
||||
this.__data__ = new MapCache;
|
||||
while (++index < length) {
|
||||
this.add(values[index]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add methods to `SetCache`.
|
||||
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
||||
SetCache.prototype.has = setCacheHas;
|
||||
|
||||
module.exports = SetCache;
|
27
node_modules/dagre-d3-renderer/node_modules/lodash/_Stack.js
generated
vendored
Normal file
27
node_modules/dagre-d3-renderer/node_modules/lodash/_Stack.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
var ListCache = require('./_ListCache'),
|
||||
stackClear = require('./_stackClear'),
|
||||
stackDelete = require('./_stackDelete'),
|
||||
stackGet = require('./_stackGet'),
|
||||
stackHas = require('./_stackHas'),
|
||||
stackSet = require('./_stackSet');
|
||||
|
||||
/**
|
||||
* Creates a stack cache object to store key-value pairs.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [entries] The key-value pairs to cache.
|
||||
*/
|
||||
function Stack(entries) {
|
||||
var data = this.__data__ = new ListCache(entries);
|
||||
this.size = data.size;
|
||||
}
|
||||
|
||||
// Add methods to `Stack`.
|
||||
Stack.prototype.clear = stackClear;
|
||||
Stack.prototype['delete'] = stackDelete;
|
||||
Stack.prototype.get = stackGet;
|
||||
Stack.prototype.has = stackHas;
|
||||
Stack.prototype.set = stackSet;
|
||||
|
||||
module.exports = Stack;
|
6
node_modules/dagre-d3-renderer/node_modules/lodash/_Symbol.js
generated
vendored
Normal file
6
node_modules/dagre-d3-renderer/node_modules/lodash/_Symbol.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
var root = require('./_root');
|
||||
|
||||
/** Built-in value references. */
|
||||
var Symbol = root.Symbol;
|
||||
|
||||
module.exports = Symbol;
|
6
node_modules/dagre-d3-renderer/node_modules/lodash/_Uint8Array.js
generated
vendored
Normal file
6
node_modules/dagre-d3-renderer/node_modules/lodash/_Uint8Array.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
var root = require('./_root');
|
||||
|
||||
/** Built-in value references. */
|
||||
var Uint8Array = root.Uint8Array;
|
||||
|
||||
module.exports = Uint8Array;
|
7
node_modules/dagre-d3-renderer/node_modules/lodash/_WeakMap.js
generated
vendored
Normal file
7
node_modules/dagre-d3-renderer/node_modules/lodash/_WeakMap.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
var getNative = require('./_getNative'),
|
||||
root = require('./_root');
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var WeakMap = getNative(root, 'WeakMap');
|
||||
|
||||
module.exports = WeakMap;
|
21
node_modules/dagre-d3-renderer/node_modules/lodash/_apply.js
generated
vendored
Normal file
21
node_modules/dagre-d3-renderer/node_modules/lodash/_apply.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* A faster alternative to `Function#apply`, this function invokes `func`
|
||||
* with the `this` binding of `thisArg` and the arguments of `args`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to invoke.
|
||||
* @param {*} thisArg The `this` binding of `func`.
|
||||
* @param {Array} args The arguments to invoke `func` with.
|
||||
* @returns {*} Returns the result of `func`.
|
||||
*/
|
||||
function apply(func, thisArg, args) {
|
||||
switch (args.length) {
|
||||
case 0: return func.call(thisArg);
|
||||
case 1: return func.call(thisArg, args[0]);
|
||||
case 2: return func.call(thisArg, args[0], args[1]);
|
||||
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
||||
}
|
||||
return func.apply(thisArg, args);
|
||||
}
|
||||
|
||||
module.exports = apply;
|
22
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayAggregator.js
generated
vendored
Normal file
22
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayAggregator.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* A specialized version of `baseAggregator` for arrays.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} setter The function to set `accumulator` values.
|
||||
* @param {Function} iteratee The iteratee to transform keys.
|
||||
* @param {Object} accumulator The initial aggregated object.
|
||||
* @returns {Function} Returns `accumulator`.
|
||||
*/
|
||||
function arrayAggregator(array, setter, iteratee, accumulator) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length;
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
setter(accumulator, value, iteratee(value), array);
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
module.exports = arrayAggregator;
|
22
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayEach.js
generated
vendored
Normal file
22
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayEach.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* A specialized version of `_.forEach` for arrays without support for
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array} Returns `array`.
|
||||
*/
|
||||
function arrayEach(array, iteratee) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length;
|
||||
|
||||
while (++index < length) {
|
||||
if (iteratee(array[index], index, array) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
module.exports = arrayEach;
|
21
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayEachRight.js
generated
vendored
Normal file
21
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayEachRight.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* A specialized version of `_.forEachRight` for arrays without support for
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array} Returns `array`.
|
||||
*/
|
||||
function arrayEachRight(array, iteratee) {
|
||||
var length = array == null ? 0 : array.length;
|
||||
|
||||
while (length--) {
|
||||
if (iteratee(array[length], length, array) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
module.exports = arrayEachRight;
|
23
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayEvery.js
generated
vendored
Normal file
23
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayEvery.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* A specialized version of `_.every` for arrays without support for
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
||||
* else `false`.
|
||||
*/
|
||||
function arrayEvery(array, predicate) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length;
|
||||
|
||||
while (++index < length) {
|
||||
if (!predicate(array[index], index, array)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = arrayEvery;
|
25
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayFilter.js
generated
vendored
Normal file
25
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayFilter.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* A specialized version of `_.filter` for arrays without support for
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {Array} Returns the new filtered array.
|
||||
*/
|
||||
function arrayFilter(array, predicate) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length,
|
||||
resIndex = 0,
|
||||
result = [];
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (predicate(value, index, array)) {
|
||||
result[resIndex++] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = arrayFilter;
|
17
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayIncludes.js
generated
vendored
Normal file
17
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayIncludes.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var baseIndexOf = require('./_baseIndexOf');
|
||||
|
||||
/**
|
||||
* A specialized version of `_.includes` for arrays without support for
|
||||
* specifying an index to search from.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to inspect.
|
||||
* @param {*} target The value to search for.
|
||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||
*/
|
||||
function arrayIncludes(array, value) {
|
||||
var length = array == null ? 0 : array.length;
|
||||
return !!length && baseIndexOf(array, value, 0) > -1;
|
||||
}
|
||||
|
||||
module.exports = arrayIncludes;
|
22
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayIncludesWith.js
generated
vendored
Normal file
22
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayIncludesWith.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* This function is like `arrayIncludes` except that it accepts a comparator.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to inspect.
|
||||
* @param {*} target The value to search for.
|
||||
* @param {Function} comparator The comparator invoked per element.
|
||||
* @returns {boolean} Returns `true` if `target` is found, else `false`.
|
||||
*/
|
||||
function arrayIncludesWith(array, value, comparator) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length;
|
||||
|
||||
while (++index < length) {
|
||||
if (comparator(value, array[index])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = arrayIncludesWith;
|
49
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayLikeKeys.js
generated
vendored
Normal file
49
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayLikeKeys.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
var baseTimes = require('./_baseTimes'),
|
||||
isArguments = require('./isArguments'),
|
||||
isArray = require('./isArray'),
|
||||
isBuffer = require('./isBuffer'),
|
||||
isIndex = require('./_isIndex'),
|
||||
isTypedArray = require('./isTypedArray');
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Creates an array of the enumerable property names of the array-like `value`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to query.
|
||||
* @param {boolean} inherited Specify returning inherited property names.
|
||||
* @returns {Array} Returns the array of property names.
|
||||
*/
|
||||
function arrayLikeKeys(value, inherited) {
|
||||
var isArr = isArray(value),
|
||||
isArg = !isArr && isArguments(value),
|
||||
isBuff = !isArr && !isArg && isBuffer(value),
|
||||
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
||||
skipIndexes = isArr || isArg || isBuff || isType,
|
||||
result = skipIndexes ? baseTimes(value.length, String) : [],
|
||||
length = result.length;
|
||||
|
||||
for (var key in value) {
|
||||
if ((inherited || hasOwnProperty.call(value, key)) &&
|
||||
!(skipIndexes && (
|
||||
// Safari 9 has enumerable `arguments.length` in strict mode.
|
||||
key == 'length' ||
|
||||
// Node.js 0.10 has enumerable non-index properties on buffers.
|
||||
(isBuff && (key == 'offset' || key == 'parent')) ||
|
||||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
||||
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
||||
// Skip index properties.
|
||||
isIndex(key, length)
|
||||
))) {
|
||||
result.push(key);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = arrayLikeKeys;
|
21
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayMap.js
generated
vendored
Normal file
21
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayMap.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* A specialized version of `_.map` for arrays without support for iteratee
|
||||
* shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {Array} Returns the new mapped array.
|
||||
*/
|
||||
function arrayMap(array, iteratee) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length,
|
||||
result = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
result[index] = iteratee(array[index], index, array);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = arrayMap;
|
20
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayPush.js
generated
vendored
Normal file
20
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayPush.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Appends the elements of `values` to `array`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to modify.
|
||||
* @param {Array} values The values to append.
|
||||
* @returns {Array} Returns `array`.
|
||||
*/
|
||||
function arrayPush(array, values) {
|
||||
var index = -1,
|
||||
length = values.length,
|
||||
offset = array.length;
|
||||
|
||||
while (++index < length) {
|
||||
array[offset + index] = values[index];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
module.exports = arrayPush;
|
26
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayReduce.js
generated
vendored
Normal file
26
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayReduce.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* A specialized version of `_.reduce` for arrays without support for
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @param {*} [accumulator] The initial value.
|
||||
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
||||
* the initial value.
|
||||
* @returns {*} Returns the accumulated value.
|
||||
*/
|
||||
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length;
|
||||
|
||||
if (initAccum && length) {
|
||||
accumulator = array[++index];
|
||||
}
|
||||
while (++index < length) {
|
||||
accumulator = iteratee(accumulator, array[index], index, array);
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
module.exports = arrayReduce;
|
24
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayReduceRight.js
generated
vendored
Normal file
24
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayReduceRight.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* A specialized version of `_.reduceRight` for arrays without support for
|
||||
* iteratee shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @param {*} [accumulator] The initial value.
|
||||
* @param {boolean} [initAccum] Specify using the last element of `array` as
|
||||
* the initial value.
|
||||
* @returns {*} Returns the accumulated value.
|
||||
*/
|
||||
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
||||
var length = array == null ? 0 : array.length;
|
||||
if (initAccum && length) {
|
||||
accumulator = array[--length];
|
||||
}
|
||||
while (length--) {
|
||||
accumulator = iteratee(accumulator, array[length], length, array);
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
module.exports = arrayReduceRight;
|
15
node_modules/dagre-d3-renderer/node_modules/lodash/_arraySample.js
generated
vendored
Normal file
15
node_modules/dagre-d3-renderer/node_modules/lodash/_arraySample.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var baseRandom = require('./_baseRandom');
|
||||
|
||||
/**
|
||||
* A specialized version of `_.sample` for arrays.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to sample.
|
||||
* @returns {*} Returns the random element.
|
||||
*/
|
||||
function arraySample(array) {
|
||||
var length = array.length;
|
||||
return length ? array[baseRandom(0, length - 1)] : undefined;
|
||||
}
|
||||
|
||||
module.exports = arraySample;
|
17
node_modules/dagre-d3-renderer/node_modules/lodash/_arraySampleSize.js
generated
vendored
Normal file
17
node_modules/dagre-d3-renderer/node_modules/lodash/_arraySampleSize.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var baseClamp = require('./_baseClamp'),
|
||||
copyArray = require('./_copyArray'),
|
||||
shuffleSelf = require('./_shuffleSelf');
|
||||
|
||||
/**
|
||||
* A specialized version of `_.sampleSize` for arrays.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to sample.
|
||||
* @param {number} n The number of elements to sample.
|
||||
* @returns {Array} Returns the random elements.
|
||||
*/
|
||||
function arraySampleSize(array, n) {
|
||||
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
|
||||
}
|
||||
|
||||
module.exports = arraySampleSize;
|
15
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayShuffle.js
generated
vendored
Normal file
15
node_modules/dagre-d3-renderer/node_modules/lodash/_arrayShuffle.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
var copyArray = require('./_copyArray'),
|
||||
shuffleSelf = require('./_shuffleSelf');
|
||||
|
||||
/**
|
||||
* A specialized version of `_.shuffle` for arrays.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to shuffle.
|
||||
* @returns {Array} Returns the new shuffled array.
|
||||
*/
|
||||
function arrayShuffle(array) {
|
||||
return shuffleSelf(copyArray(array));
|
||||
}
|
||||
|
||||
module.exports = arrayShuffle;
|
23
node_modules/dagre-d3-renderer/node_modules/lodash/_arraySome.js
generated
vendored
Normal file
23
node_modules/dagre-d3-renderer/node_modules/lodash/_arraySome.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* A specialized version of `_.some` for arrays without support for iteratee
|
||||
* shorthands.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} [array] The array to iterate over.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
||||
* else `false`.
|
||||
*/
|
||||
function arraySome(array, predicate) {
|
||||
var index = -1,
|
||||
length = array == null ? 0 : array.length;
|
||||
|
||||
while (++index < length) {
|
||||
if (predicate(array[index], index, array)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = arraySome;
|
12
node_modules/dagre-d3-renderer/node_modules/lodash/_asciiSize.js
generated
vendored
Normal file
12
node_modules/dagre-d3-renderer/node_modules/lodash/_asciiSize.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var baseProperty = require('./_baseProperty');
|
||||
|
||||
/**
|
||||
* Gets the size of an ASCII `string`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string inspect.
|
||||
* @returns {number} Returns the string size.
|
||||
*/
|
||||
var asciiSize = baseProperty('length');
|
||||
|
||||
module.exports = asciiSize;
|
12
node_modules/dagre-d3-renderer/node_modules/lodash/_asciiToArray.js
generated
vendored
Normal file
12
node_modules/dagre-d3-renderer/node_modules/lodash/_asciiToArray.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Converts an ASCII `string` to an array.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to convert.
|
||||
* @returns {Array} Returns the converted array.
|
||||
*/
|
||||
function asciiToArray(string) {
|
||||
return string.split('');
|
||||
}
|
||||
|
||||
module.exports = asciiToArray;
|
15
node_modules/dagre-d3-renderer/node_modules/lodash/_asciiWords.js
generated
vendored
Normal file
15
node_modules/dagre-d3-renderer/node_modules/lodash/_asciiWords.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/** Used to match words composed of alphanumeric characters. */
|
||||
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
||||
|
||||
/**
|
||||
* Splits an ASCII `string` into an array of its words.
|
||||
*
|
||||
* @private
|
||||
* @param {string} The string to inspect.
|
||||
* @returns {Array} Returns the words of `string`.
|
||||
*/
|
||||
function asciiWords(string) {
|
||||
return string.match(reAsciiWord) || [];
|
||||
}
|
||||
|
||||
module.exports = asciiWords;
|
20
node_modules/dagre-d3-renderer/node_modules/lodash/_assignMergeValue.js
generated
vendored
Normal file
20
node_modules/dagre-d3-renderer/node_modules/lodash/_assignMergeValue.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var baseAssignValue = require('./_baseAssignValue'),
|
||||
eq = require('./eq');
|
||||
|
||||
/**
|
||||
* This function is like `assignValue` except that it doesn't assign
|
||||
* `undefined` values.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {string} key The key of the property to assign.
|
||||
* @param {*} value The value to assign.
|
||||
*/
|
||||
function assignMergeValue(object, key, value) {
|
||||
if ((value !== undefined && !eq(object[key], value)) ||
|
||||
(value === undefined && !(key in object))) {
|
||||
baseAssignValue(object, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = assignMergeValue;
|
28
node_modules/dagre-d3-renderer/node_modules/lodash/_assignValue.js
generated
vendored
Normal file
28
node_modules/dagre-d3-renderer/node_modules/lodash/_assignValue.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
var baseAssignValue = require('./_baseAssignValue'),
|
||||
eq = require('./eq');
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* for equality comparisons.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {string} key The key of the property to assign.
|
||||
* @param {*} value The value to assign.
|
||||
*/
|
||||
function assignValue(object, key, value) {
|
||||
var objValue = object[key];
|
||||
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
||||
(value === undefined && !(key in object))) {
|
||||
baseAssignValue(object, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = assignValue;
|
21
node_modules/dagre-d3-renderer/node_modules/lodash/_assocIndexOf.js
generated
vendored
Normal file
21
node_modules/dagre-d3-renderer/node_modules/lodash/_assocIndexOf.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var eq = require('./eq');
|
||||
|
||||
/**
|
||||
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} key The key to search for.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
function assocIndexOf(array, key) {
|
||||
var length = array.length;
|
||||
while (length--) {
|
||||
if (eq(array[length][0], key)) {
|
||||
return length;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
module.exports = assocIndexOf;
|
21
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAggregator.js
generated
vendored
Normal file
21
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAggregator.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var baseEach = require('./_baseEach');
|
||||
|
||||
/**
|
||||
* Aggregates elements of `collection` on `accumulator` with keys transformed
|
||||
* by `iteratee` and values set by `setter`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Function} setter The function to set `accumulator` values.
|
||||
* @param {Function} iteratee The iteratee to transform keys.
|
||||
* @param {Object} accumulator The initial aggregated object.
|
||||
* @returns {Function} Returns `accumulator`.
|
||||
*/
|
||||
function baseAggregator(collection, setter, iteratee, accumulator) {
|
||||
baseEach(collection, function(value, key, collection) {
|
||||
setter(accumulator, value, iteratee(value), collection);
|
||||
});
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
module.exports = baseAggregator;
|
17
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAssign.js
generated
vendored
Normal file
17
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAssign.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var copyObject = require('./_copyObject'),
|
||||
keys = require('./keys');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.assign` without support for multiple sources
|
||||
* or `customizer` functions.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The destination object.
|
||||
* @param {Object} source The source object.
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseAssign(object, source) {
|
||||
return object && copyObject(source, keys(source), object);
|
||||
}
|
||||
|
||||
module.exports = baseAssign;
|
17
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAssignIn.js
generated
vendored
Normal file
17
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAssignIn.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var copyObject = require('./_copyObject'),
|
||||
keysIn = require('./keysIn');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.assignIn` without support for multiple sources
|
||||
* or `customizer` functions.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The destination object.
|
||||
* @param {Object} source The source object.
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function baseAssignIn(object, source) {
|
||||
return object && copyObject(source, keysIn(source), object);
|
||||
}
|
||||
|
||||
module.exports = baseAssignIn;
|
25
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAssignValue.js
generated
vendored
Normal file
25
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAssignValue.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
var defineProperty = require('./_defineProperty');
|
||||
|
||||
/**
|
||||
* The base implementation of `assignValue` and `assignMergeValue` without
|
||||
* value checks.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to modify.
|
||||
* @param {string} key The key of the property to assign.
|
||||
* @param {*} value The value to assign.
|
||||
*/
|
||||
function baseAssignValue(object, key, value) {
|
||||
if (key == '__proto__' && defineProperty) {
|
||||
defineProperty(object, key, {
|
||||
'configurable': true,
|
||||
'enumerable': true,
|
||||
'value': value,
|
||||
'writable': true
|
||||
});
|
||||
} else {
|
||||
object[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = baseAssignValue;
|
23
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAt.js
generated
vendored
Normal file
23
node_modules/dagre-d3-renderer/node_modules/lodash/_baseAt.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var get = require('./get');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.at` without support for individual paths.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {string[]} paths The property paths to pick.
|
||||
* @returns {Array} Returns the picked elements.
|
||||
*/
|
||||
function baseAt(object, paths) {
|
||||
var index = -1,
|
||||
length = paths.length,
|
||||
result = Array(length),
|
||||
skip = object == null;
|
||||
|
||||
while (++index < length) {
|
||||
result[index] = skip ? undefined : get(object, paths[index]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseAt;
|
22
node_modules/dagre-d3-renderer/node_modules/lodash/_baseClamp.js
generated
vendored
Normal file
22
node_modules/dagre-d3-renderer/node_modules/lodash/_baseClamp.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* The base implementation of `_.clamp` which doesn't coerce arguments.
|
||||
*
|
||||
* @private
|
||||
* @param {number} number The number to clamp.
|
||||
* @param {number} [lower] The lower bound.
|
||||
* @param {number} upper The upper bound.
|
||||
* @returns {number} Returns the clamped number.
|
||||
*/
|
||||
function baseClamp(number, lower, upper) {
|
||||
if (number === number) {
|
||||
if (upper !== undefined) {
|
||||
number = number <= upper ? number : upper;
|
||||
}
|
||||
if (lower !== undefined) {
|
||||
number = number >= lower ? number : lower;
|
||||
}
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
module.exports = baseClamp;
|
166
node_modules/dagre-d3-renderer/node_modules/lodash/_baseClone.js
generated
vendored
Normal file
166
node_modules/dagre-d3-renderer/node_modules/lodash/_baseClone.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
var Stack = require('./_Stack'),
|
||||
arrayEach = require('./_arrayEach'),
|
||||
assignValue = require('./_assignValue'),
|
||||
baseAssign = require('./_baseAssign'),
|
||||
baseAssignIn = require('./_baseAssignIn'),
|
||||
cloneBuffer = require('./_cloneBuffer'),
|
||||
copyArray = require('./_copyArray'),
|
||||
copySymbols = require('./_copySymbols'),
|
||||
copySymbolsIn = require('./_copySymbolsIn'),
|
||||
getAllKeys = require('./_getAllKeys'),
|
||||
getAllKeysIn = require('./_getAllKeysIn'),
|
||||
getTag = require('./_getTag'),
|
||||
initCloneArray = require('./_initCloneArray'),
|
||||
initCloneByTag = require('./_initCloneByTag'),
|
||||
initCloneObject = require('./_initCloneObject'),
|
||||
isArray = require('./isArray'),
|
||||
isBuffer = require('./isBuffer'),
|
||||
isMap = require('./isMap'),
|
||||
isObject = require('./isObject'),
|
||||
isSet = require('./isSet'),
|
||||
keys = require('./keys'),
|
||||
keysIn = require('./keysIn');
|
||||
|
||||
/** Used to compose bitmasks for cloning. */
|
||||
var CLONE_DEEP_FLAG = 1,
|
||||
CLONE_FLAT_FLAG = 2,
|
||||
CLONE_SYMBOLS_FLAG = 4;
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var argsTag = '[object Arguments]',
|
||||
arrayTag = '[object Array]',
|
||||
boolTag = '[object Boolean]',
|
||||
dateTag = '[object Date]',
|
||||
errorTag = '[object Error]',
|
||||
funcTag = '[object Function]',
|
||||
genTag = '[object GeneratorFunction]',
|
||||
mapTag = '[object Map]',
|
||||
numberTag = '[object Number]',
|
||||
objectTag = '[object Object]',
|
||||
regexpTag = '[object RegExp]',
|
||||
setTag = '[object Set]',
|
||||
stringTag = '[object String]',
|
||||
symbolTag = '[object Symbol]',
|
||||
weakMapTag = '[object WeakMap]';
|
||||
|
||||
var arrayBufferTag = '[object ArrayBuffer]',
|
||||
dataViewTag = '[object DataView]',
|
||||
float32Tag = '[object Float32Array]',
|
||||
float64Tag = '[object Float64Array]',
|
||||
int8Tag = '[object Int8Array]',
|
||||
int16Tag = '[object Int16Array]',
|
||||
int32Tag = '[object Int32Array]',
|
||||
uint8Tag = '[object Uint8Array]',
|
||||
uint8ClampedTag = '[object Uint8ClampedArray]',
|
||||
uint16Tag = '[object Uint16Array]',
|
||||
uint32Tag = '[object Uint32Array]';
|
||||
|
||||
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
||||
var cloneableTags = {};
|
||||
cloneableTags[argsTag] = cloneableTags[arrayTag] =
|
||||
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
|
||||
cloneableTags[boolTag] = cloneableTags[dateTag] =
|
||||
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
|
||||
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
|
||||
cloneableTags[int32Tag] = cloneableTags[mapTag] =
|
||||
cloneableTags[numberTag] = cloneableTags[objectTag] =
|
||||
cloneableTags[regexpTag] = cloneableTags[setTag] =
|
||||
cloneableTags[stringTag] = cloneableTags[symbolTag] =
|
||||
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
|
||||
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
||||
cloneableTags[errorTag] = cloneableTags[funcTag] =
|
||||
cloneableTags[weakMapTag] = false;
|
||||
|
||||
/**
|
||||
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
|
||||
* traversed objects.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to clone.
|
||||
* @param {boolean} bitmask The bitmask flags.
|
||||
* 1 - Deep clone
|
||||
* 2 - Flatten inherited properties
|
||||
* 4 - Clone symbols
|
||||
* @param {Function} [customizer] The function to customize cloning.
|
||||
* @param {string} [key] The key of `value`.
|
||||
* @param {Object} [object] The parent object of `value`.
|
||||
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
|
||||
* @returns {*} Returns the cloned value.
|
||||
*/
|
||||
function baseClone(value, bitmask, customizer, key, object, stack) {
|
||||
var result,
|
||||
isDeep = bitmask & CLONE_DEEP_FLAG,
|
||||
isFlat = bitmask & CLONE_FLAT_FLAG,
|
||||
isFull = bitmask & CLONE_SYMBOLS_FLAG;
|
||||
|
||||
if (customizer) {
|
||||
result = object ? customizer(value, key, object, stack) : customizer(value);
|
||||
}
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
if (!isObject(value)) {
|
||||
return value;
|
||||
}
|
||||
var isArr = isArray(value);
|
||||
if (isArr) {
|
||||
result = initCloneArray(value);
|
||||
if (!isDeep) {
|
||||
return copyArray(value, result);
|
||||
}
|
||||
} else {
|
||||
var tag = getTag(value),
|
||||
isFunc = tag == funcTag || tag == genTag;
|
||||
|
||||
if (isBuffer(value)) {
|
||||
return cloneBuffer(value, isDeep);
|
||||
}
|
||||
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
|
||||
result = (isFlat || isFunc) ? {} : initCloneObject(value);
|
||||
if (!isDeep) {
|
||||
return isFlat
|
||||
? copySymbolsIn(value, baseAssignIn(result, value))
|
||||
: copySymbols(value, baseAssign(result, value));
|
||||
}
|
||||
} else {
|
||||
if (!cloneableTags[tag]) {
|
||||
return object ? value : {};
|
||||
}
|
||||
result = initCloneByTag(value, tag, isDeep);
|
||||
}
|
||||
}
|
||||
// Check for circular references and return its corresponding clone.
|
||||
stack || (stack = new Stack);
|
||||
var stacked = stack.get(value);
|
||||
if (stacked) {
|
||||
return stacked;
|
||||
}
|
||||
stack.set(value, result);
|
||||
|
||||
if (isSet(value)) {
|
||||
value.forEach(function(subValue) {
|
||||
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
||||
});
|
||||
} else if (isMap(value)) {
|
||||
value.forEach(function(subValue, key) {
|
||||
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
||||
});
|
||||
}
|
||||
|
||||
var keysFunc = isFull
|
||||
? (isFlat ? getAllKeysIn : getAllKeys)
|
||||
: (isFlat ? keysIn : keys);
|
||||
|
||||
var props = isArr ? undefined : keysFunc(value);
|
||||
arrayEach(props || value, function(subValue, key) {
|
||||
if (props) {
|
||||
key = subValue;
|
||||
subValue = value[key];
|
||||
}
|
||||
// Recursively populate clone (susceptible to call stack limits).
|
||||
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseClone;
|
18
node_modules/dagre-d3-renderer/node_modules/lodash/_baseConforms.js
generated
vendored
Normal file
18
node_modules/dagre-d3-renderer/node_modules/lodash/_baseConforms.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var baseConformsTo = require('./_baseConformsTo'),
|
||||
keys = require('./keys');
|
||||
|
||||
/**
|
||||
* The base implementation of `_.conforms` which doesn't clone `source`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} source The object of property predicates to conform to.
|
||||
* @returns {Function} Returns the new spec function.
|
||||
*/
|
||||
function baseConforms(source) {
|
||||
var props = keys(source);
|
||||
return function(object) {
|
||||
return baseConformsTo(object, source, props);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = baseConforms;
|
27
node_modules/dagre-d3-renderer/node_modules/lodash/_baseConformsTo.js
generated
vendored
Normal file
27
node_modules/dagre-d3-renderer/node_modules/lodash/_baseConformsTo.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* The base implementation of `_.conformsTo` which accepts `props` to check.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to inspect.
|
||||
* @param {Object} source The object of property predicates to conform to.
|
||||
* @returns {boolean} Returns `true` if `object` conforms, else `false`.
|
||||
*/
|
||||
function baseConformsTo(object, source, props) {
|
||||
var length = props.length;
|
||||
if (object == null) {
|
||||
return !length;
|
||||
}
|
||||
object = Object(object);
|
||||
while (length--) {
|
||||
var key = props[length],
|
||||
predicate = source[key],
|
||||
value = object[key];
|
||||
|
||||
if ((value === undefined && !(key in object)) || !predicate(value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = baseConformsTo;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user