Socket
Socket
Sign inDemoInstall

d3-sankey

Package Overview
Dependencies
4
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.10.3 to 0.10.4

6

dist/d3-sankey.js

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

// https://github.com/d3/d3-sankey v0.10.3 Copyright 2019 Mike Bostock
// https://github.com/d3/d3-sankey v0.10.4 Copyright 2019 Mike Bostock
(function (global, factory) {

@@ -347,3 +347,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-shape')) :

function targetTop(source, target) {
let y = source.y0;
let y = source.y0 - (source.sourceLinks.length - 1) * py / 2;
for (const {target: node, width} of source.sourceLinks) {

@@ -362,3 +362,3 @@ if (node === target) break;

function sourceTop(source, target) {
let y = target.y0;
let y = target.y0 - (target.targetLinks.length - 1) * py / 2;
for (const {source: node, width} of target.targetLinks) {

@@ -365,0 +365,0 @@ if (node === source) break;

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

// https://github.com/d3/d3-sankey v0.10.3 Copyright 2019 Mike Bostock
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-collection"),require("d3-shape")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-collection","d3-shape"],t):t((n=n||self).d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(n,t,e,r){"use strict";function o(n){return n.target.depth}function i(n,t){return n.sourceLinks.length?n.depth:t-1}function u(n){return function(){return n}}function c(n,t){return s(n.source,t.source)||n.index-t.index}function f(n,t){return s(n.target,t.target)||n.index-t.index}function s(n,t){return n.y0-t.y0}function a(n){return n.value}function h(n){return n.index}function l(n){return n.nodes}function d(n){return n.links}function y(n,t){var e=n.get(t);if(!e)throw new Error("missing: "+t);return e}function g(n){return[n.source.x1,n.y0]}function k(n){return[n.target.x0,n.y1]}n.sankey=function(){var n,r=0,o=0,g=1,k=1,p=24,E=8,L=h,v=i,x=l,w=d,m=6;function b(){var i={nodes:x.apply(null,arguments),links:w.apply(null,arguments)};return function(n){n.nodes.forEach(function(n,t){n.index=t,n.sourceLinks=[],n.targetLinks=[]});var t=e.map(n.nodes,L);n.links.forEach(function(n,e){n.index=e;var r=n.source,o=n.target;"object"!=typeof r&&(r=n.source=y(t,r)),"object"!=typeof o&&(o=n.target=y(t,o)),r.sourceLinks.push(n),o.targetLinks.push(n)})}(i),function(n){n.nodes.forEach(function(n){n.value=Math.max(t.sum(n.sourceLinks,a),t.sum(n.targetLinks,a))})}(i),function(n){var t,e,o,i=n.nodes.length;for(t=n.nodes,e=[],o=0;t.length;++o,t=e,e=[]){if(o>i)throw new Error("circular link");t.forEach(function(n){n.depth=o,n.sourceLinks.forEach(function(n){e.indexOf(n.target)<0&&e.push(n.target)})})}for(t=n.nodes,e=[],o=0;t.length;++o,t=e,e=[]){if(o>i)throw new Error("circular link");t.forEach(function(n){n.height=o,n.targetLinks.forEach(function(n){e.indexOf(n.source)<0&&e.push(n.source)})})}var u=(g-r-p)/(o-1);n.nodes.forEach(function(n){n.layer=Math.max(0,Math.min(o-1,Math.floor(v.call(null,n,o)))),n.x1=(n.x0=r+n.layer*u)+p})}(i),function(r){var i,u=e.nest().key(function(n){return n.x0}).sortKeys(t.ascending).entries(r.nodes).map(function(n){return n.values});i=t.min(u,function(n){return(k-o-(n.length-1)*E)/t.sum(n,a)}),u.forEach(function(t){null!=n&&t.sort(n);let e=o;t.forEach(function(n){n.y0=e,n.y1=e+n.value*i,e=n.y1+E})}),r.links.forEach(function(n){n.width=n.value*i});for(var h=0,l=m;h<l;++h){const n=Math.pow(.99,h),t=(h+1)/l;d(),g(n),p(t),L(t),d(),y(n),p(t),L(t)}function d(){u.forEach(function(n){n.forEach(function(n){n.sourceLinks.sort(f),n.targetLinks.sort(c)})})}function y(n){u.slice(1).forEach(function(t){t.forEach(function(t){let e=0,r=0;for(const{source:n,value:o}of t.targetLinks){let i=o*(t.layer-n.layer);e+=j(n,t)*i,r+=i}if(!(r>0))return;let o=(e/r-t.y0)*n;t.y0+=o,t.y1+=o})})}function g(n){u.slice(0,-1).reverse().forEach(function(t){t.forEach(function(t){let e=0,r=0;for(const{target:n,value:o}of t.sourceLinks){let i=o*(n.layer-t.layer);e+=q(t,n)*i,r+=i}if(!(r>0))return;let o=(e/r-t.y0)*n;t.y0+=o,t.y1+=o})})}function p(t){u.forEach(function(e){var r,i,u,c=o,f=e.length;for(void 0===n&&e.sort(s),u=0;u<f;++u)r=e[u],(i=(c-r.y0)*t)>1e-6&&(r.y0+=i,r.y1+=i),c=r.y1+E})}function L(t){u.forEach(function(e){var r,o,i,u=k,c=e.length;for(void 0===n&&e.sort(s),i=c-1;i>=0;--i)r=e[i],(o=(r.y1-u)*t)>1e-6&&(r.y0-=o,r.y1-=o),u=r.y0-E})}}(i),M(i),i}function M(n){n.nodes.forEach(function(n){n.sourceLinks.sort(f),n.targetLinks.sort(c)}),n.nodes.forEach(function(n){var t=n.y0,e=t;n.sourceLinks.forEach(function(n){n.y0=t+n.width/2,t+=n.width}),n.targetLinks.forEach(function(n){n.y1=e+n.width/2,e+=n.width})})}function j(n,t){let e=n.y0;for(const{target:r,width:o}of n.sourceLinks){if(r===t)break;e+=o+E}for(const{source:r,width:o}of t.targetLinks){if(r===n)break;e-=o}return e}function q(n,t){let e=t.y0;for(const{source:r,width:o}of t.targetLinks){if(r===n)break;e+=o+E}for(const{target:r,width:o}of n.sourceLinks){if(r===t)break;e-=o}return e}return b.update=function(n){return M(n),n},b.nodeId=function(n){return arguments.length?(L="function"==typeof n?n:u(n),b):L},b.nodeAlign=function(n){return arguments.length?(v="function"==typeof n?n:u(n),b):v},b.nodeSort=function(t){return arguments.length?(n=t,b):n},b.nodeWidth=function(n){return arguments.length?(p=+n,b):p},b.nodePadding=function(n){return arguments.length?(E=+n,b):E},b.nodes=function(n){return arguments.length?(x="function"==typeof n?n:u(n),b):x},b.links=function(n){return arguments.length?(w="function"==typeof n?n:u(n),b):w},b.size=function(n){return arguments.length?(r=o=0,g=+n[0],k=+n[1],b):[g-r,k-o]},b.extent=function(n){return arguments.length?(r=+n[0][0],g=+n[1][0],o=+n[0][1],k=+n[1][1],b):[[r,o],[g,k]]},b.iterations=function(n){return arguments.length?(m=+n,b):m},b},n.sankeyCenter=function(n){return n.targetLinks.length?n.depth:n.sourceLinks.length?t.min(n.sourceLinks,o)-1:0},n.sankeyLeft=function(n){return n.depth},n.sankeyRight=function(n,t){return t-1-n.height},n.sankeyJustify=i,n.sankeyLinkHorizontal=function(){return r.linkHorizontal().source(g).target(k)},Object.defineProperty(n,"__esModule",{value:!0})});
// https://github.com/d3/d3-sankey v0.10.4 Copyright 2019 Mike Bostock
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-collection"),require("d3-shape")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-collection","d3-shape"],t):t((n=n||self).d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(n,t,e,r){"use strict";function o(n){return n.target.depth}function i(n,t){return n.sourceLinks.length?n.depth:t-1}function u(n){return function(){return n}}function c(n,t){return s(n.source,t.source)||n.index-t.index}function f(n,t){return s(n.target,t.target)||n.index-t.index}function s(n,t){return n.y0-t.y0}function a(n){return n.value}function h(n){return n.index}function l(n){return n.nodes}function d(n){return n.links}function y(n,t){var e=n.get(t);if(!e)throw new Error("missing: "+t);return e}function g(n){return[n.source.x1,n.y0]}function k(n){return[n.target.x0,n.y1]}n.sankey=function(){var n,r=0,o=0,g=1,k=1,p=24,L=8,E=h,v=i,x=l,w=d,m=6;function b(){var i={nodes:x.apply(null,arguments),links:w.apply(null,arguments)};return function(n){n.nodes.forEach(function(n,t){n.index=t,n.sourceLinks=[],n.targetLinks=[]});var t=e.map(n.nodes,E);n.links.forEach(function(n,e){n.index=e;var r=n.source,o=n.target;"object"!=typeof r&&(r=n.source=y(t,r)),"object"!=typeof o&&(o=n.target=y(t,o)),r.sourceLinks.push(n),o.targetLinks.push(n)})}(i),function(n){n.nodes.forEach(function(n){n.value=Math.max(t.sum(n.sourceLinks,a),t.sum(n.targetLinks,a))})}(i),function(n){var t,e,o,i=n.nodes.length;for(t=n.nodes,e=[],o=0;t.length;++o,t=e,e=[]){if(o>i)throw new Error("circular link");t.forEach(function(n){n.depth=o,n.sourceLinks.forEach(function(n){e.indexOf(n.target)<0&&e.push(n.target)})})}for(t=n.nodes,e=[],o=0;t.length;++o,t=e,e=[]){if(o>i)throw new Error("circular link");t.forEach(function(n){n.height=o,n.targetLinks.forEach(function(n){e.indexOf(n.source)<0&&e.push(n.source)})})}var u=(g-r-p)/(o-1);n.nodes.forEach(function(n){n.layer=Math.max(0,Math.min(o-1,Math.floor(v.call(null,n,o)))),n.x1=(n.x0=r+n.layer*u)+p})}(i),function(r){var i,u=e.nest().key(function(n){return n.x0}).sortKeys(t.ascending).entries(r.nodes).map(function(n){return n.values});i=t.min(u,function(n){return(k-o-(n.length-1)*L)/t.sum(n,a)}),u.forEach(function(t){null!=n&&t.sort(n);let e=o;t.forEach(function(n){n.y0=e,n.y1=e+n.value*i,e=n.y1+L})}),r.links.forEach(function(n){n.width=n.value*i});for(var h=0,l=m;h<l;++h){const n=Math.pow(.99,h),t=(h+1)/l;d(),g(n),p(t),E(t),d(),y(n),p(t),E(t)}function d(){u.forEach(function(n){n.forEach(function(n){n.sourceLinks.sort(f),n.targetLinks.sort(c)})})}function y(n){u.slice(1).forEach(function(t){t.forEach(function(t){let e=0,r=0;for(const{source:n,value:o}of t.targetLinks){let i=o*(t.layer-n.layer);e+=j(n,t)*i,r+=i}if(!(r>0))return;let o=(e/r-t.y0)*n;t.y0+=o,t.y1+=o})})}function g(n){u.slice(0,-1).reverse().forEach(function(t){t.forEach(function(t){let e=0,r=0;for(const{target:n,value:o}of t.sourceLinks){let i=o*(n.layer-t.layer);e+=q(t,n)*i,r+=i}if(!(r>0))return;let o=(e/r-t.y0)*n;t.y0+=o,t.y1+=o})})}function p(t){u.forEach(function(e){var r,i,u,c=o,f=e.length;for(void 0===n&&e.sort(s),u=0;u<f;++u)r=e[u],(i=(c-r.y0)*t)>1e-6&&(r.y0+=i,r.y1+=i),c=r.y1+L})}function E(t){u.forEach(function(e){var r,o,i,u=k,c=e.length;for(void 0===n&&e.sort(s),i=c-1;i>=0;--i)r=e[i],(o=(r.y1-u)*t)>1e-6&&(r.y0-=o,r.y1-=o),u=r.y0-L})}}(i),M(i),i}function M(n){n.nodes.forEach(function(n){n.sourceLinks.sort(f),n.targetLinks.sort(c)}),n.nodes.forEach(function(n){var t=n.y0,e=t;n.sourceLinks.forEach(function(n){n.y0=t+n.width/2,t+=n.width}),n.targetLinks.forEach(function(n){n.y1=e+n.width/2,e+=n.width})})}function j(n,t){let e=n.y0-(n.sourceLinks.length-1)*L/2;for(const{target:r,width:o}of n.sourceLinks){if(r===t)break;e+=o+L}for(const{source:r,width:o}of t.targetLinks){if(r===n)break;e-=o}return e}function q(n,t){let e=t.y0-(t.targetLinks.length-1)*L/2;for(const{source:r,width:o}of t.targetLinks){if(r===n)break;e+=o+L}for(const{target:r,width:o}of n.sourceLinks){if(r===t)break;e-=o}return e}return b.update=function(n){return M(n),n},b.nodeId=function(n){return arguments.length?(E="function"==typeof n?n:u(n),b):E},b.nodeAlign=function(n){return arguments.length?(v="function"==typeof n?n:u(n),b):v},b.nodeSort=function(t){return arguments.length?(n=t,b):n},b.nodeWidth=function(n){return arguments.length?(p=+n,b):p},b.nodePadding=function(n){return arguments.length?(L=+n,b):L},b.nodes=function(n){return arguments.length?(x="function"==typeof n?n:u(n),b):x},b.links=function(n){return arguments.length?(w="function"==typeof n?n:u(n),b):w},b.size=function(n){return arguments.length?(r=o=0,g=+n[0],k=+n[1],b):[g-r,k-o]},b.extent=function(n){return arguments.length?(r=+n[0][0],g=+n[1][0],o=+n[0][1],k=+n[1][1],b):[[r,o],[g,k]]},b.iterations=function(n){return arguments.length?(m=+n,b):m},b},n.sankeyCenter=function(n){return n.targetLinks.length?n.depth:n.sourceLinks.length?t.min(n.sourceLinks,o)-1:0},n.sankeyLeft=function(n){return n.depth},n.sankeyRight=function(n,t){return t-1-n.height},n.sankeyJustify=i,n.sankeyLinkHorizontal=function(){return r.linkHorizontal().source(g).target(k)},Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "d3-sankey",
"version": "0.10.3",
"version": "0.10.4",
"description": "Visualize flow between nodes in a directed acyclic network.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -317,3 +317,3 @@ import {ascending, min, sum} from "d3-array";

function targetTop(source, target) {
let y = source.y0;
let y = source.y0 - (source.sourceLinks.length - 1) * py / 2;
for (const {target: node, width} of source.sourceLinks) {

@@ -332,3 +332,3 @@ if (node === target) break;

function sourceTop(source, target) {
let y = target.y0;
let y = target.y0 - (target.targetLinks.length - 1) * py / 2;
for (const {source: node, width} of target.targetLinks) {

@@ -335,0 +335,0 @@ if (node === source) break;

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc