New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

d3-chord

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-chord - npm Package Compare versions

Comparing version 2.0.0-rc.2 to 2.0.0-rc.3

55

dist/d3-chord.js

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

// https://d3js.org/d3-chord/ v2.0.0-rc.2 Copyright 2019 Mike Bostock
// https://d3js.org/d3-chord/ v2.0.0-rc.3 Copyright 2019 Mike Bostock
(function (global, factory) {

@@ -31,2 +31,10 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-path')) :

function chord() {
return chord$1(false);
}
function chordDirected() {
return chord$1(true);
}
function chord$1(directed) {
var padAngle = 0,

@@ -55,3 +63,3 @@ sortGroups = null,

x = 0, j = -1; while (++j < n) {
x += matrix[i][j];
x += matrix[i][j] + directed * matrix[j][i];
}

@@ -85,3 +93,3 @@ groupSums.push(x);

dj = subgroupIndex[di][j],
v = matrix[di][dj],
v = matrix[di][dj] + directed * matrix[dj][di],
a0 = x,

@@ -110,5 +118,39 @@ a1 = x += v * k;

var source = subgroups[j * n + i],
target = subgroups[i * n + j];
if (source.value || target.value) {
chords.push(source.value < target.value
target = subgroups[i * n + j],
sourceValue = matrix[i][j],
targetValue = matrix[j][i];
if (directed) {
var t = sourceValue / (sourceValue + targetValue);
if (sourceValue) {
chords.push({
source: {
index: i,
startAngle: source.startAngle * t + source.endAngle * (1 - t),
endAngle: source.startAngle * (1 - t) + source.endAngle * t
},
target: {
index: j,
startAngle: target.startAngle * t + target.endAngle * (1 - t),
endAngle: target.startAngle * (1 - t) + target.endAngle * t
},
value: sourceValue
});
}
if (targetValue) {
chords.push({
source: {
index: j,
startAngle: target.startAngle * (1 - t) + target.endAngle * t,
endAngle: target.startAngle * t + target.endAngle * (1 - t)
},
target: {
index: i,
startAngle: source.startAngle * (1 - t) + source.endAngle * t,
endAngle: source.startAngle * t + source.endAngle * (1 - t)
},
value: targetValue
});
}
} else if (sourceValue || targetValue) {
chords.push(sourceValue < targetValue
? {source: target, target: source}

@@ -281,2 +323,3 @@ : {source: source, target: target});

exports.chord = chord;
exports.chordDirected = chordDirected;
exports.ribbon = ribbon$1;

@@ -283,0 +326,0 @@ exports.ribbonArrow = ribbonArrow;

4

dist/d3-chord.min.js

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

// https://d3js.org/d3-chord/ v2.0.0-rc.2 Copyright 2019 Mike Bostock
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-path"],t):t((n=n||self).d3=n.d3||{},n.d3)}(this,function(n,t){"use strict";var r=Math.abs,e=Math.cos,u=Math.sin,o=Math.PI,i=o/2,l=2*o,a=Math.max,f=1e-12;function c(n){return Array.from({length:n},(n,t)=>t)}function s(n){return function(t,r){return n(t.source.value+t.target.value,r.source.value+r.target.value)}}var p=Array.prototype.slice;function h(n){return function(){return n}}function g(n){return n.source}function d(n){return n.target}function y(n){return n.radius}function v(n){return n.startAngle}function A(n){return n.endAngle}function b(){return 0}function x(){return 10}function M(n){var o=g,l=d,a=y,c=y,s=v,x=A,M=b,T=null;function m(){var h,g=o.apply(this,arguments),d=l.apply(this,arguments),y=M.apply(this,arguments)/2,v=p.call(arguments),A=+a.apply(this,(v[0]=g,v)),b=s.apply(this,v)-i,m=x.apply(this,v)-i,q=+c.apply(this,(v[0]=d,v)),C=s.apply(this,v)-i,_=x.apply(this,v)-i;if(T||(T=h=t.path()),y>f&&(r(m-b)>2*y+f?m>b?(b+=y,m-=y):(b-=y,m+=y):b=m=(b+m)/2,r(_-C)>2*y+f?_>C?(C+=y,_-=y):(C-=y,_+=y):C=_=(C+_)/2),T.moveTo(A*e(b),A*u(b)),T.arc(0,0,A,b,m),b!==C||m!==_)if(n){var w=q-+n.apply(this,arguments),P=(C+_)/2;T.quadraticCurveTo(0,0,w*e(C),w*u(C)),T.lineTo(q*e(P),q*u(P)),T.lineTo(w*e(_),w*u(_))}else T.quadraticCurveTo(0,0,q*e(C),q*u(C)),T.arc(0,0,q,C,_);if(T.quadraticCurveTo(0,0,A*e(b),A*u(b)),T.closePath(),h)return T=null,h+""||null}return n&&(m.headRadius=function(t){return arguments.length?(n="function"==typeof t?t:h(+t),m):n}),m.radius=function(n){return arguments.length?(a=c="function"==typeof n?n:h(+n),m):a},m.sourceRadius=function(n){return arguments.length?(a="function"==typeof n?n:h(+n),m):a},m.targetRadius=function(n){return arguments.length?(c="function"==typeof n?n:h(+n),m):c},m.startAngle=function(n){return arguments.length?(s="function"==typeof n?n:h(+n),m):s},m.endAngle=function(n){return arguments.length?(x="function"==typeof n?n:h(+n),m):x},m.padAngle=function(n){return arguments.length?(M="function"==typeof n?n:h(+n),m):M},m.source=function(n){return arguments.length?(o=n,m):o},m.target=function(n){return arguments.length?(l=n,m):l},m.context=function(n){return arguments.length?(T=null==n?null:n,m):T},m}n.chord=function(){var n=0,t=null,r=null,e=null;function u(u){var o,i,f,s,p,h,g=u.length,d=[],y=c(g),v=[],A=[],b=A.groups=new Array(g),x=new Array(g*g);for(o=0,p=-1;++p<g;){for(i=0,h=-1;++h<g;)i+=u[p][h];d.push(i),v.push(c(g)),o+=i}for(t&&y.sort((n,r)=>{t(d[n],d[r])}),r&&v.forEach((n,t)=>{n.sort((n,e)=>r(u[t][n],u[t][e]))}),s=(o=a(0,l-n*g)/o)?n:l/g,i=0,p=-1;++p<g;){for(f=i,h=-1;++h<g;){var M=y[p],T=v[M][h],m=u[M][T],q=i,C=i+=m*o;x[T*g+M]={index:M,subindex:T,startAngle:q,endAngle:C,value:m}}b[M]={index:M,startAngle:f,endAngle:i,value:d[M]},i+=s}for(p=-1;++p<g;)for(h=p-1;++h<g;){var _=x[h*g+p],w=x[p*g+h];(_.value||w.value)&&A.push(_.value<w.value?{source:w,target:_}:{source:_,target:w})}return e?A.sort(e):A}return u.padAngle=function(t){return arguments.length?(n=a(0,t),u):n},u.sortGroups=function(n){return arguments.length?(t=n,u):t},u.sortSubgroups=function(n){return arguments.length?(r=n,u):r},u.sortChords=function(n){return arguments.length?(null==n?e=null:(e=s(n))._=n,u):e&&e._},u},n.ribbon=function(){return M()},n.ribbonArrow=function(){return M(x)},Object.defineProperty(n,"__esModule",{value:!0})});
// https://d3js.org/d3-chord/ v2.0.0-rc.3 Copyright 2019 Mike Bostock
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-path")):"function"==typeof define&&define.amd?define(["exports","d3-path"],t):t((n=n||self).d3=n.d3||{},n.d3)}(this,function(n,t){"use strict";var e=Math.abs,r=Math.cos,u=Math.sin,o=Math.PI,l=o/2,a=2*o,i=Math.max,f=1e-12;function s(n){return Array.from({length:n},(n,t)=>t)}function c(n){return function(t,e){return n(t.source.value+t.target.value,e.source.value+e.target.value)}}function g(n){var t=0,e=null,r=null,u=null;function o(o){var l,f,c,g,d,p,h=o.length,A=[],y=s(h),v=[],x=[],b=x.groups=new Array(h),M=new Array(h*h);for(l=0,d=-1;++d<h;){for(f=0,p=-1;++p<h;)f+=o[d][p]+n*o[p][d];A.push(f),v.push(s(h)),l+=f}for(e&&y.sort((n,t)=>{e(A[n],A[t])}),r&&v.forEach((n,t)=>{n.sort((n,e)=>r(o[t][n],o[t][e]))}),g=(l=i(0,a-t*h)/l)?t:a/h,f=0,d=-1;++d<h;){for(c=f,p=-1;++p<h;){var T=y[d],m=v[T][p],q=o[T][m]+n*o[m][T],C=f,_=f+=q*l;M[m*h+T]={index:T,subindex:m,startAngle:C,endAngle:_,value:q}}b[T]={index:T,startAngle:c,endAngle:f,value:A[T]},f+=g}for(d=-1;++d<h;)for(p=d-1;++p<h;){var w=M[p*h+d],P=M[d*h+p],R=o[d][p],j=o[p][d];if(n){var D=R/(R+j);R&&x.push({source:{index:d,startAngle:w.startAngle*D+w.endAngle*(1-D),endAngle:w.startAngle*(1-D)+w.endAngle*D},target:{index:p,startAngle:P.startAngle*D+P.endAngle*(1-D),endAngle:P.startAngle*(1-D)+P.endAngle*D},value:R}),j&&x.push({source:{index:p,startAngle:P.startAngle*(1-D)+P.endAngle*D,endAngle:P.startAngle*D+P.endAngle*(1-D)},target:{index:d,startAngle:w.startAngle*(1-D)+w.endAngle*D,endAngle:w.startAngle*D+w.endAngle*(1-D)},value:j})}else(R||j)&&x.push(R<j?{source:P,target:w}:{source:w,target:P})}return u?x.sort(u):x}return o.padAngle=function(n){return arguments.length?(t=i(0,n),o):t},o.sortGroups=function(n){return arguments.length?(e=n,o):e},o.sortSubgroups=function(n){return arguments.length?(r=n,o):r},o.sortChords=function(n){return arguments.length?(null==n?u=null:(u=c(n))._=n,o):u&&u._},o}var d=Array.prototype.slice;function p(n){return function(){return n}}function h(n){return n.source}function A(n){return n.target}function y(n){return n.radius}function v(n){return n.startAngle}function x(n){return n.endAngle}function b(){return 0}function M(){return 10}function T(n){var o=h,a=A,i=y,s=y,c=v,g=x,M=b,T=null;function m(){var p,h=o.apply(this,arguments),A=a.apply(this,arguments),y=M.apply(this,arguments)/2,v=d.call(arguments),x=+i.apply(this,(v[0]=h,v)),b=c.apply(this,v)-l,m=g.apply(this,v)-l,q=+s.apply(this,(v[0]=A,v)),C=c.apply(this,v)-l,_=g.apply(this,v)-l;if(T||(T=p=t.path()),y>f&&(e(m-b)>2*y+f?m>b?(b+=y,m-=y):(b-=y,m+=y):b=m=(b+m)/2,e(_-C)>2*y+f?_>C?(C+=y,_-=y):(C-=y,_+=y):C=_=(C+_)/2),T.moveTo(x*r(b),x*u(b)),T.arc(0,0,x,b,m),b!==C||m!==_)if(n){var w=q-+n.apply(this,arguments),P=(C+_)/2;T.quadraticCurveTo(0,0,w*r(C),w*u(C)),T.lineTo(q*r(P),q*u(P)),T.lineTo(w*r(_),w*u(_))}else T.quadraticCurveTo(0,0,q*r(C),q*u(C)),T.arc(0,0,q,C,_);if(T.quadraticCurveTo(0,0,x*r(b),x*u(b)),T.closePath(),p)return T=null,p+""||null}return n&&(m.headRadius=function(t){return arguments.length?(n="function"==typeof t?t:p(+t),m):n}),m.radius=function(n){return arguments.length?(i=s="function"==typeof n?n:p(+n),m):i},m.sourceRadius=function(n){return arguments.length?(i="function"==typeof n?n:p(+n),m):i},m.targetRadius=function(n){return arguments.length?(s="function"==typeof n?n:p(+n),m):s},m.startAngle=function(n){return arguments.length?(c="function"==typeof n?n:p(+n),m):c},m.endAngle=function(n){return arguments.length?(g="function"==typeof n?n:p(+n),m):g},m.padAngle=function(n){return arguments.length?(M="function"==typeof n?n:p(+n),m):M},m.source=function(n){return arguments.length?(o=n,m):o},m.target=function(n){return arguments.length?(a=n,m):a},m.context=function(n){return arguments.length?(T=null==n?null:n,m):T},m}n.chord=function(){return g(!1)},n.chordDirected=function(){return g(!0)},n.ribbon=function(){return T()},n.ribbonArrow=function(){return T(M)},Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "d3-chord",
"version": "2.0.0-rc.2",
"version": "2.0.0-rc.3",
"publishConfig": {

@@ -5,0 +5,0 @@ "tag": "next"

@@ -17,2 +17,10 @@ import {max, tau} from "./math.js";

export default function() {
return chord(false);
}
export function chordDirected() {
return chord(true);
}
function chord(directed) {
var padAngle = 0,

@@ -41,3 +49,3 @@ sortGroups = null,

x = 0, j = -1; while (++j < n) {
x += matrix[i][j];
x += matrix[i][j] + directed * matrix[j][i];
}

@@ -71,3 +79,3 @@ groupSums.push(x);

dj = subgroupIndex[di][j],
v = matrix[di][dj],
v = matrix[di][dj] + directed * matrix[dj][di],
a0 = x,

@@ -96,5 +104,39 @@ a1 = x += v * k;

var source = subgroups[j * n + i],
target = subgroups[i * n + j];
if (source.value || target.value) {
chords.push(source.value < target.value
target = subgroups[i * n + j],
sourceValue = matrix[i][j],
targetValue = matrix[j][i];
if (directed) {
var t = sourceValue / (sourceValue + targetValue);
if (sourceValue) {
chords.push({
source: {
index: i,
startAngle: source.startAngle * t + source.endAngle * (1 - t),
endAngle: source.startAngle * (1 - t) + source.endAngle * t
},
target: {
index: j,
startAngle: target.startAngle * t + target.endAngle * (1 - t),
endAngle: target.startAngle * (1 - t) + target.endAngle * t
},
value: sourceValue
});
}
if (targetValue) {
chords.push({
source: {
index: j,
startAngle: target.startAngle * (1 - t) + target.endAngle * t,
endAngle: target.startAngle * t + target.endAngle * (1 - t)
},
target: {
index: i,
startAngle: source.startAngle * (1 - t) + source.endAngle * t,
endAngle: source.startAngle * t + source.endAngle * (1 - t)
},
value: targetValue
});
}
} else if (sourceValue || targetValue) {
chords.push(sourceValue < targetValue
? {source: target, target: source}

@@ -101,0 +143,0 @@ : {source: source, target: target});

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

export {default as chord} from "./chord.js";
export {default as chord, chordDirected} from "./chord.js";
export {default as ribbon, ribbonArrow} from "./ribbon.js";
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc