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

d3

Package Overview
Dependencies
Maintainers
1
Versions
273
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3 - npm Package Compare versions

Comparing version 2.9.4 to 2.9.6

.gitignore

2

package.json
{
"name": "d3",
"version": "2.9.4",
"version": "2.9.6",
"description": "A small, free JavaScript library for manipulating documents based on data.",

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

function d3_collapse(s) {
return s.replace(/(^\s+)|(\s+$)/g, "").replace(/\s+/g, " ");
return s.replace(/^\s+|\s+$/g, "").replace(/\s+/g, " ");
}

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

d3 = {version: "2.9.4"}; // semver
d3 = {version: "2.9.6"}; // semver

@@ -120,2 +120,3 @@ d3.interpolate = function(a, b) {

if (ra != rb) {
if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360; // shortest path
q.push({i: s.push(s.pop() + "rotate(", null, ")") - 2, x: d3.interpolateNumber(ra, rb)});

@@ -174,2 +175,3 @@ } else if (rb) {

l1 = b.l - l0;
if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360; // shortest path
return function(t) {

@@ -176,0 +178,0 @@ return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t).toString();

d3_selectionPrototype.classed = function(name, value) {
var names = name.split(d3_selection_classedWhitespace),
var names = d3_collapse(name).split(" "),
n = names.length,

@@ -14,4 +14,2 @@ i = -1;

var d3_selection_classedWhitespace = /\s+/g;
function d3_selection_classed(name, value) {

@@ -18,0 +16,0 @@ var re = new RegExp("(^|\\s+)" + d3.requote(name) + "(\\s+|$)", "g");

d3_selectionPrototype.each = function(callback) {
for (var j = -1, m = this.length; ++j < m;) {
for (var group = this[j], i = -1, n = group.length; ++i < n;) {
var node = group[i];
if (node) callback.call(node, node.__data__, i, j);
return d3_selection_each(this, function(node, i, j) {
callback.call(node, node.__data__, i, j);
});
};
function d3_selection_each(groups, callback) {
for (var j = 0, m = groups.length; j < m; j++) {
for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
if (node = group[i]) callback(node, i, j);
}
}
return this;
};
return groups;
}
d3_transitionPrototype.delay = function(value) {
var groups = this;
return groups.each(typeof value === "function"
? function(d, i, j) { groups[j][i].delay = value.apply(this, arguments) | 0; }
: (value = value | 0, function(d, i, j) { groups[j][i].delay = value; }));
return d3_selection_each(this, typeof value === "function"
? function(node, i, j) { node.delay = value.call(node = node.node, node.__data__, i, j) | 0; }
: (value = value | 0, function(node) { node.delay = value; }));
};
d3_transitionPrototype.duration = function(value) {
var groups = this;
return groups.each(typeof value === "function"
? function(d, i, j) { groups[j][i].duration = Math.max(1, value.apply(this, arguments) | 0); }
: (value = Math.max(1, value | 0), function(d, i, j) { groups[j][i].duration = value; }));
return d3_selection_each(this, typeof value === "function"
? function(node, i, j) { node.duration = Math.max(1, value.call(node = node.node, node.__data__, i, j) | 0); }
: (value = Math.max(1, value | 0), function(node) { node.duration = value; }));
};

@@ -9,12 +9,7 @@ function d3_transition_each(callback) {

d3_transitionEase = this.ease();
for (var j = 0, m = this.length; j < m; j++) {
for (var group = this[j], i = 0, n = group.length; i < n; i++) {
var node = group[i];
if (node) {
d3_transitionDelay = this[j][i].delay;
d3_transitionDuration = this[j][i].duration;
callback.call(node = node.node, node.__data__, i, j);
}
}
}
d3_selection_each(this, function(node, i, j) {
d3_transitionDelay = node.delay;
d3_transitionDuration = node.duration;
callback.call(node = node.node, node.__data__, i, j);
});

@@ -21,0 +16,0 @@ d3_transitionId = id;

@@ -32,8 +32,8 @@ function d3_transition(groups, id, time) {

d3.timer(function(elapsed) {
groups.each(function(d, i, j) {
return d3_selection_each(groups, function(node, i, j) {
var tweened = [],
node = this,
delay = groups[j][i].delay,
duration = groups[j][i].duration,
lock = node.__transition__ || (node.__transition__ = {active: 0, count: 0});
delay = node.delay,
duration = node.duration,
lock = (node = node.node).__transition__ || (node.__transition__ = {active: 0, count: 0}),
d = node.__data__;

@@ -84,3 +84,2 @@ ++lock.count;

});
return 1;
}, 0, time);

@@ -87,0 +86,0 @@

@@ -7,3 +7,3 @@ // TODO breakAtDateLine?

radians = degrees * d3_geo_radians,
arc = d3.geo.greatArc().target(d3_identity);
arc = d3.geo.greatArc().source(origin).target(d3_identity);

@@ -19,4 +19,4 @@ function circle() {

circle.clip = function(d) {
arc.source(typeof origin === "function" ? origin.apply(this, arguments) : origin);
return clipType(d);
if (typeof origin === "function") arc.source(origin.apply(this, arguments));
return clipType(d) || null;
};

@@ -101,5 +101,7 @@

if (p1 && clipped.length) {
d1 = arc.distance(p2 = clipped[0]);
clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
// Close the clipped polygon if necessary.
p0 = coordinates[0];
p1 = clipped[0];
if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) {
clipped.push(p1);
}

@@ -132,2 +134,3 @@

origin = x;
if (typeof origin !== "function") arc.source(origin);
return circle;

@@ -142,10 +145,3 @@ };

// Precision is specified in degrees.
circle.precision = function(x) {
if (!arguments.length) return arc.precision();
arc.precision(x);
return circle;
};
return circle;
return d3.rebind(circle, arc, "precision");
}
d3.geo.greatArc = function() {
var source = d3_geo_greatArcSource,
target = d3_geo_greatArcTarget,
precision = 6 * d3_geo_radians;
var source = d3_geo_greatArcSource, p0,
target = d3_geo_greatArcTarget, p1,
precision = 6 * d3_geo_radians,
interpolate = d3_geo_greatArcInterpolator();
function greatArc() {
var a = typeof source === "function" ? source.apply(this, arguments) : source,
b = typeof target === "function" ? target.apply(this, arguments) : target,
i = d3_geo_greatArcInterpolate(a, b),
dt = precision / i.d,
var d = greatArc.distance.apply(this, arguments), // initializes the interpolator, too
t = 0,
coordinates = [a];
while ((t += dt) < 1) coordinates.push(i(t));
coordinates.push(b);
return {
type: "LineString",
coordinates: coordinates
};
dt = precision / d,
coordinates = [p0];
while ((t += dt) < 1) coordinates.push(interpolate(t));
coordinates.push(p1);
return {type: "LineString", coordinates: coordinates};
}

@@ -23,16 +19,18 @@

greatArc.distance = function() {
var a = typeof source === "function" ? source.apply(this, arguments) : source,
b = typeof target === "function" ? target.apply(this, arguments) : target;
return d3_geo_greatArcInterpolate(a, b).d;
if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments));
if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments));
return interpolate.distance();
};
greatArc.source = function(x) {
greatArc.source = function(_) {
if (!arguments.length) return source;
source = x;
source = _;
if (typeof source !== "function") interpolate.source(p0 = source);
return greatArc;
};
greatArc.target = function(x) {
greatArc.target = function(_) {
if (!arguments.length) return target;
target = x;
target = _;
if (typeof target !== "function") interpolate.target(p1 = target);
return greatArc;

@@ -42,5 +40,5 @@ };

// Precision is specified in degrees.
greatArc.precision = function(x) {
greatArc.precision = function(_) {
if (!arguments.length) return precision / d3_geo_radians;
precision = x * d3_geo_radians;
precision = _ * d3_geo_radians;
return greatArc;

@@ -60,17 +58,14 @@ };

function d3_geo_greatArcInterpolate(a, b) {
var x0 = a[0] * d3_geo_radians, cx0 = Math.cos(x0), sx0 = Math.sin(x0),
y0 = a[1] * d3_geo_radians, cy0 = Math.cos(y0), sy0 = Math.sin(y0),
x1 = b[0] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1),
y1 = b[1] * d3_geo_radians, cy1 = Math.cos(y1), sy1 = Math.sin(y1),
d = interpolate.d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))),
sd = Math.sin(d);
function d3_geo_greatArcInterpolator() {
var x0, y0, cy0, sy0, kx0, ky0,
x1, y1, cy1, sy1, kx1, ky1,
d,
k;
// From http://williams.best.vwh.net/avform.htm#Intermediate
function interpolate(t) {
var A = Math.sin(d - (t *= d)) / sd,
B = Math.sin(t) / sd,
x = A * cy0 * cx0 + B * cy1 * cx1,
y = A * cy0 * sx0 + B * cy1 * sx1,
z = A * sy0 + B * sy1;
var B = Math.sin(t *= d) * k,
A = Math.sin(d - t) * k,
x = A * kx0 + B * kx1,
y = A * ky0 + B * ky1,
z = A * sy0 + B * sy1;
return [

@@ -82,3 +77,36 @@ Math.atan2(y, x) / d3_geo_radians,

interpolate.distance = function() {
if (d == null) k = 1 / Math.sin(d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))));
return d;
};
interpolate.source = function(_) {
var cx0 = Math.cos(x0 = _[0] * d3_geo_radians),
sx0 = Math.sin(x0);
cy0 = Math.cos(y0 = _[1] * d3_geo_radians);
sy0 = Math.sin(y0);
kx0 = cy0 * cx0;
ky0 = cy0 * sx0;
d = null;
return interpolate;
};
interpolate.target = function(_) {
var cx1 = Math.cos(x1 = _[0] * d3_geo_radians),
sx1 = Math.sin(x1);
cy1 = Math.cos(y1 = _[1] * d3_geo_radians);
sy1 = Math.sin(y1);
kx1 = cy1 * cx1;
ky1 = cy1 * sx1;
d = null;
return interpolate;
};
return interpolate;
}
function d3_geo_greatArcInterpolate(a, b) {
var i = d3_geo_greatArcInterpolator().source(a).target(b);
i.distance();
return i;
}

@@ -11,9 +11,11 @@ /**

pointCircle = d3_path_circle(pointRadius),
projection = d3.geo.albersUsa();
projection = d3.geo.albersUsa(),
buffer = [];
function path(d, i) {
if (typeof pointRadius === "function") {
pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
}
return pathType(d) || null;
if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
pathType(d);
var result = buffer.length ? buffer.join("") : null;
buffer = [];
return result;
}

@@ -28,40 +30,34 @@

FeatureCollection: function(o) {
var path = [],
features = o.features,
var features = o.features,
i = -1, // features.index
n = features.length;
while (++i < n) path.push(pathType(features[i].geometry));
return path.join("");
while (++i < n) buffer.push(pathType(features[i].geometry));
},
Feature: function(o) {
return pathType(o.geometry);
pathType(o.geometry);
},
Point: function(o) {
return "M" + project(o.coordinates) + pointCircle;
buffer.push("M", project(o.coordinates), pointCircle);
},
MultiPoint: function(o) {
var path = [],
coordinates = o.coordinates,
var coordinates = o.coordinates,
i = -1, // coordinates.index
n = coordinates.length;
while (++i < n) path.push("M", project(coordinates[i]), pointCircle);
return path.join("");
while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle);
},
LineString: function(o) {
var path = ["M"],
coordinates = o.coordinates,
var coordinates = o.coordinates,
i = -1, // coordinates.index
n = coordinates.length;
while (++i < n) path.push(project(coordinates[i]), "L");
path.pop();
return path.join("");
buffer.push("M");
while (++i < n) buffer.push(project(coordinates[i]), "L");
buffer.pop();
},
MultiLineString: function(o) {
var path = [],
coordinates = o.coordinates,
var coordinates = o.coordinates,
i = -1, // coordinates.index

@@ -76,12 +72,10 @@ n = coordinates.length,

m = subcoordinates.length;
path.push("M");
while (++j < m) path.push(project(subcoordinates[j]), "L");
path.pop();
buffer.push("M");
while (++j < m) buffer.push(project(subcoordinates[j]), "L");
buffer.pop();
}
return path.join("");
},
Polygon: function(o) {
var path = [],
coordinates = o.coordinates,
var coordinates = o.coordinates,
i = -1, // coordinates.index

@@ -96,13 +90,11 @@ n = coordinates.length,

if ((m = subcoordinates.length - 1) > 0) {
path.push("M");
while (++j < m) path.push(project(subcoordinates[j]), "L");
path[path.length - 1] = "Z";
buffer.push("M");
while (++j < m) buffer.push(project(subcoordinates[j]), "L");
buffer[buffer.length - 1] = "Z";
}
}
return path.join("");
},
MultiPolygon: function(o) {
var path = [],
coordinates = o.coordinates,
var coordinates = o.coordinates,
i = -1, // coordinates index

@@ -124,18 +116,15 @@ n = coordinates.length,

if ((p = subsubcoordinates.length - 1) > 0) {
path.push("M");
while (++k < p) path.push(project(subsubcoordinates[k]), "L");
path[path.length - 1] = "Z";
buffer.push("M");
while (++k < p) buffer.push(project(subsubcoordinates[k]), "L");
buffer[buffer.length - 1] = "Z";
}
}
}
return path.join("");
},
GeometryCollection: function(o) {
var path = [],
geometries = o.geometries,
var geometries = o.geometries,
i = -1, // geometries index
n = geometries.length;
while (++i < n) path.push(pathType(geometries[i]));
return path.join("");
while (++i < n) buffer.push(pathType(geometries[i]));
}

@@ -142,0 +131,0 @@

@@ -48,4 +48,9 @@ d3.svg.axis = function() {

tickEnter.append("text");
tickUpdate.select("text").text(tickFormat);
var lineEnter = tickEnter.select("line"),
lineUpdate = tickUpdate.select("line"),
text = tick.select("text").text(tickFormat),
textEnter = tickEnter.select("text"),
textUpdate = tickUpdate.select("text");
switch (orient) {

@@ -56,6 +61,7 @@ case "bottom": {

subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
tickEnter.select("line").attr("y2", tickMajorSize);
tickEnter.select("text").attr("y", Math.max(tickMajorSize, 0) + tickPadding);
tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize);
tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle");
lineEnter.attr("y2", tickMajorSize);
textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
text.attr("dy", ".71em").attr("text-anchor", "middle");
pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);

@@ -68,6 +74,7 @@ break;

subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
tickEnter.select("line").attr("y2", -tickMajorSize);
tickEnter.select("text").attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize);
tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle");
lineEnter.attr("y2", -tickMajorSize);
textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
text.attr("dy", "0em").attr("text-anchor", "middle");
pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);

@@ -80,6 +87,7 @@ break;

subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
tickEnter.select("line").attr("x2", -tickMajorSize);
tickEnter.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0);
tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end");
lineEnter.attr("x2", -tickMajorSize);
textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
text.attr("dy", ".32em").attr("text-anchor", "end");
pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);

@@ -92,6 +100,7 @@ break;

subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
tickEnter.select("line").attr("x2", tickMajorSize);
tickEnter.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding);
tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0);
tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start");
lineEnter.attr("x2", tickMajorSize);
textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
text.attr("dy", ".32em").attr("text-anchor", "start");
pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);

@@ -98,0 +107,0 @@ break;

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

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

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