Socket
Socket
Sign inDemoInstall

d3-selection

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-selection - npm Package Compare versions

Comparing version 0.6.9 to 0.6.10

2

build/bundle.js

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

var version = "0.6.9"; export * from "../index"; export {version};
var version = "0.6.10"; export * from "../index"; export {version};

@@ -233,15 +233,2 @@ (function (global, factory) {

function arrayify(selection) {
for (var groups = selection._groups, j = 0, m = groups.length; j < m; ++j) {
if (!Array.isArray(group = groups[j])) {
for (var n = group.length, array = groups[j] = new Array(n), group, i = 0; i < n; ++i) {
array[i] = group[i];
}
}
}
return groups;
}
function constant(x) {

@@ -255,16 +242,15 @@ return function() {

function bindIndex(parent, update, enter, exit, data) {
function bindIndex(parent, group, enter, update, exit, data) {
var i = 0,
node,
nodeLength = update.length,
dataLength = data.length,
minLength = Math.min(nodeLength, dataLength);
groupLength = group.length,
dataLength = data.length;
// Clear the enter and exit arrays, and then initialize to the new length.
enter.length = 0, enter.length = dataLength;
exit.length = 0, exit.length = nodeLength;
for (; i < minLength; ++i) {
if (node = update[i]) {
// Put any non-null nodes that fit into update.
// Put any null nodes into enter.
// Put any remaining data into enter.
for (; i < dataLength; ++i) {
if (node = group[i]) {
node.__data__ = data[i];
update[i] = node;
} else {

@@ -275,45 +261,25 @@ enter[i] = new EnterNode(parent, data[i]);

// Note: we don’t need to delete update[i] here because this loop only
// runs when the data length is greater than the node length.
for (; i < dataLength; ++i) {
enter[i] = new EnterNode(parent, data[i]);
}
// Note: and, we don’t need to delete update[i] here because immediately
// following this loop we set the update length to data length.
for (; i < nodeLength; ++i) {
if (node = update[i]) {
exit[i] = update[i];
// Put any non-null nodes that don’t fit into exit.
for (; i < groupLength; ++i) {
if (node = group[i]) {
exit[i] = node;
}
}
update.length = dataLength;
}
function bindKey(parent, update, enter, exit, data, key) {
function bindKey(parent, group, enter, update, exit, data, key) {
var i,
node,
nodeByKeyValue = {},
groupLength = group.length,
dataLength = data.length,
nodeLength = update.length,
nodeByKeyValue = {},
keyValues = new Array(nodeLength),
keyValues = new Array(groupLength),
keyValue;
// Clear the enter and exit arrays, and then initialize to the new length.
enter.length = 0, enter.length = dataLength;
exit.length = 0, exit.length = nodeLength;
// Compute the keys for each node.
for (i = 0; i < nodeLength; ++i) {
if (node = update[i]) {
keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, update);
// Is this a duplicate of a key we’ve previously seen?
// If so, this node is moved to the exit selection.
if (nodeByKeyValue[keyValue]) {
exit[i] = node;
}
// Otherwise, record the mapping from key to node.
else {
// Compute the key for each node.
// If multiple nodes have the same key, only the first one counts.
for (i = 0; i < groupLength; ++i) {
if (node = group[i]) {
keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);
if (!nodeByKeyValue[keyValue]) {
nodeByKeyValue[keyValue] = node;

@@ -324,6 +290,4 @@ }

// Now clear the update array and initialize to the new length.
update.length = 0, update.length = dataLength;
// Compute the keys for each datum.
// Compute the key for each datum.
// If multiple data have the same key, only the first one counts.
for (i = 0; i < dataLength; ++i) {

@@ -352,4 +316,4 @@ keyValue = keyPrefix + key.call(parent, data[i], i, data);

// and place them in the exit selection.
for (i = 0; i < nodeLength; ++i) {
if ((node = nodeByKeyValue[keyValues[i]]) !== true) {
for (i = 0; i < groupLength; ++i) {
if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] !== true)) {
exit[i] = node;

@@ -362,4 +326,4 @@ }

if (!value) {
var data = new Array(this.size()), i = -1;
this.each(function(d) { data[++i] = d; });
data = new Array(this.size()), j = -1;
this.each(function(d) { data[++j] = d; });
return data;

@@ -370,13 +334,17 @@ }

parents = this._parents,
update = arrayify(this),
enter = (this._enter = this.enter())._groups,
exit = (this._exit = this.exit())._groups;
groups = this._groups;
if (typeof value !== "function") value = constant(value);
for (var m = update.length, j = 0; j < m; ++j) {
var group = update[j],
parent = parents[j];
for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
var parent = parents[j],
group = groups[j],
groupLength = group.length,
data = value.call(parent, parent && parent.__data__, j, parents),
dataLength = data.length,
enterGroup = enter[j] = new Array(dataLength),
updateGroup = update[j] = new Array(dataLength),
exitGroup = exit[j] = new Array(groupLength);
bind(parent, group, enter[j], exit[j], value.call(parent, parent && parent.__data__, j, parents), key);
bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);

@@ -386,6 +354,6 @@ // Now connect the enter nodes to their following update node, such that

// rather than at the end of the parent node.
for (var n = group.length, i0 = 0, i1 = 0, previous, next; i0 < n; ++i0) {
if (previous = enter[j][i0]) {
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
if (previous = enterGroup[i0]) {
if (i0 >= i1) i1 = i0 + 1;
while (!(next = group[i1]) && ++i1 < n);
while (!(next = updateGroup[i1]) && ++i1 < dataLength);
previous._next = next || null;

@@ -396,2 +364,5 @@ }

this._groups = update;
(this._enter = new Selection(enter, parents))._update = this;
this._exit = new Selection(exit, parents);
return this;

@@ -454,4 +425,9 @@ }

for (var groups = arrayify(this), j = 0, m = groups.length; j < m; ++j) {
groups[j].sort(compareNode);
for (var groups = this._groups, m = groups.length, sortgroups = this._groups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group[i]) {
sortgroup[i] = node;
}
}
sortgroup.sort(compareNode);
}

@@ -957,3 +933,3 @@

var version = "0.6.9";
var version = "0.6.10";

@@ -960,0 +936,0 @@ exports.version = version;

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_selection={})}(this,function(t){"use strict";function n(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Rt.hasOwnProperty(n)?{space:Rt[n],local:t}:t}function e(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e&&e!==n.documentElement.namespaceURI?n.createElementNS(e,t):n.createElement(t)}}function r(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function i(t){var i=n(t);return(i.local?r:e)(i)}function u(t,n,e){return t=o(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function o(n,e,r){return function(i){var u=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=u}}}function s(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function a(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,u=n.length;u>r;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function c(t,n,e){var r=Ut.hasOwnProperty(t.type)?u:o;return function(i,u,o){var s,a=this.__on,c=r(n,u,o);if(a)for(var l=0,f=a.length;f>l;++l)if((s=a[l]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=c,s.capture=e),void(s.value=n);this.addEventListener(t.type,c,e),s={type:t.type,name:t.name,value:n,listener:c,capture:e},a?a.push(s):this.__on=[s]}}function l(t,n,e){var r,i,u=s(t+""),o=u.length;{if(!(arguments.length<2)){for(l=n?c:a,null==e&&(e=!1),r=0;o>r;++r)this.each(l(u[r],n,e));return this}var l=this.node().__on;if(l)for(var f,h=0,p=l.length;p>h;++h)for(r=0,f=l[h];o>r;++r)if((i=u[r]).type===f.type&&i.name===f.name)return f.value}}function f(){for(var n,e=t.event;n=e.sourceEvent;)e=n;return e}function h(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function p(t){return function(){return this.querySelector(t)}}function m(t){"function"!=typeof t&&(t=p(t));for(var n=this._groups,e=this._update,r=n.length,i=new Array(r),u=0;r>u;++u)for(var o,s,a=n[u],c=a.length,l=i[u]=new Array(c),f=0;c>f;++f)(o=a[f])&&(s=t.call(o,o.__data__,f,a))&&("__data__"in o&&(s.__data__=o.__data__),e&&(e._groups[u][f]=s),l[f]=s);return new Tt(i,this._parents)}function _(t){return function(){return this.querySelectorAll(t)}}function d(t){"function"!=typeof t&&(t=_(t));for(var n=this._groups,e=n.length,r=[],i=[],u=0;e>u;++u)for(var o,s=n[u],a=s.length,c=0;a>c;++c)(o=s[c])&&(r.push(t.call(o,o.__data__,c,s)),i.push(o));return new Tt(r,i)}function g(t){"function"!=typeof t&&(t=It(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;e>i;++i)for(var u,o=n[i],s=o.length,a=r[i]=[],c=0;s>c;++c)(u=o[c])&&t.call(u,u.__data__,c,o)&&a.push(u);return new Tt(r,this._parents)}function v(t){for(var n=t._groups,e=0,r=n.length;r>e;++e)if(!Array.isArray(i=n[e]))for(var i,u=i.length,o=n[e]=new Array(u),s=0;u>s;++s)o[s]=i[s];return n}function y(t){return function(){return t}}function w(t,n,e,r,i){var u,o=0,s=n.length,a=i.length,c=Math.min(s,a);for(e.length=0,e.length=a,r.length=0,r.length=s;c>o;++o)(u=n[o])?u.__data__=i[o]:e[o]=new S(t,i[o]);for(;a>o;++o)e[o]=new S(t,i[o]);for(;s>o;++o)(u=n[o])&&(r[o]=n[o]);n.length=a}function x(t,n,e,r,i,u){var o,s,a,c=i.length,l=n.length,f={},h=new Array(l);for(e.length=0,e.length=c,r.length=0,r.length=l,o=0;l>o;++o)(s=n[o])&&(h[o]=a=jt+u.call(s,s.__data__,o,n),f[a]?r[o]=s:f[a]=s);for(n.length=0,n.length=c,o=0;c>o;++o)a=jt+u.call(t,i[o],o,i),(s=f[a])?s!==!0&&(n[o]=s,s.__data__=i[o]):e[o]=new S(t,i[o]),f[a]=!0;for(o=0;l>o;++o)(s=f[h[o]])!==!0&&(r[o]=s)}function A(t,n){if(!t){var e=new Array(this.size()),r=-1;return this.each(function(t){e[++r]=t}),e}var i=n?x:w,u=this._parents,o=v(this),s=(this._enter=this.enter())._groups,a=(this._exit=this.exit())._groups;"function"!=typeof t&&(t=y(t));for(var c=o.length,l=0;c>l;++l){var f=o[l],h=u[l];i(h,f,s[l],a[l],t.call(h,h&&h.__data__,l,u),n);for(var p,m,_=f.length,d=0,g=0;_>d;++d)if(p=s[l][d]){for(d>=g&&(g=d+1);!(m=f[g])&&++g<_;);p._next=m||null}}return this}function S(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function b(t){return new Array(t.length)}function E(){var t=this._enter;return t?(this._enter=null,t):(t=new Tt(this._groups.map(b),this._parents),t._update=this,t)}function C(){var t=this._exit;return t?(this._exit=null,t):new Tt(this._groups.map(b),this._parents)}function N(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],u=i.length-1,o=i[u];--u>=0;)(r=i[u])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this}function M(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=T);for(var e=v(this),r=0,i=e.length;i>r;++r)e[r].sort(n);return this.order()}function T(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function L(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function P(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t}function q(){for(var t=this._groups,n=0,e=t.length;e>n;++n)for(var r=t[n],i=0,u=r.length;u>i;++i){var o=r[i];if(o)return o}return null}function B(){var t=0;return this.each(function(){++t}),t}function D(){return!this.node()}function O(t){for(var n=this._groups,e=0,r=n.length;r>e;++e)for(var i,u=n[e],o=0,s=u.length;s>o;++o)(i=u[o])&&t.call(i,i.__data__,o,u);return this}function V(t){return function(){this.removeAttribute(t)}}function R(t){return function(){this.removeAttributeNS(t.space,t.local)}}function X(t,n){return function(){this.setAttribute(t,n)}}function z(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function H(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function U(t,e){var r=n(t);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((null==e?r.local?R:V:"function"==typeof e?r.local?I:H:r.local?z:X)(r,e))}function Y(t){return function(){this.style.removeProperty(t)}}function j(t,n,e){return function(){this.style.setProperty(t,n,e)}}function k(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function G(t,n,e){var r;return arguments.length>1?this.each((null==n?Y:"function"==typeof n?k:j)(t,n,null==e?"":e)):h(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)}function K(t){return function(){delete this[t]}}function W(t,n){return function(){this[t]=n}}function $(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function F(t,n){return arguments.length>1?this.each((null==n?K:"function"==typeof n?$:W)(t,n)):this.node()[t]}function J(t){return t.trim().split(/^|\s+/)}function Q(t){return t.classList||new Z(t)}function Z(t){this._node=t,this._names=J(t.getAttribute("class")||"")}function tt(t,n){for(var e=Q(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function nt(t,n){for(var e=Q(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function et(t){return function(){tt(this,t)}}function rt(t){return function(){nt(this,t)}}function it(t,n){return function(){(n.apply(this,arguments)?tt:nt)(this,t)}}function ut(t,n){var e=J(t+"");if(arguments.length<2){for(var r=Q(this.node()),i=-1,u=e.length;++i<u;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?it:n?et:rt)(e,n))}function ot(){this.textContent=""}function st(t){return function(){this.textContent=t}}function at(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function ct(t){return arguments.length?this.each(null==t?ot:("function"==typeof t?at:st)(t)):this.node().textContent}function lt(){this.innerHTML=""}function ft(t){return function(){this.innerHTML=t}}function ht(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function pt(t){return arguments.length?this.each(null==t?lt:("function"==typeof t?ht:ft)(t)):this.node().innerHTML}function mt(){this.parentNode.appendChild(this)}function _t(){return this.each(mt)}function dt(){this.parentNode.insertBefore(this,this.parentNode.firstChild)}function gt(){return this.each(dt)}function vt(t){return function(){return this.appendChild(t.apply(this,arguments))}}function yt(t,n){return function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}}function wt(){return null}function xt(t,n){var e="function"==typeof t?t:i(t);return this.select(arguments.length<2?vt(e):yt(e,null==n?wt:"function"==typeof n?n:p(n)))}function At(){var t=this.parentNode;t&&t.removeChild(this)}function St(){return this.each(At)}function bt(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Et(t,n,e){var r=h(t),i=r.CustomEvent;i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function Ct(t,n){return function(){return Et(this,t,n)}}function Nt(t,n){return function(){return Et(this,t,n.apply(this,arguments))}}function Mt(t,n){return this.each(("function"==typeof n?Nt:Ct)(t,n))}function Tt(t,n){this._groups=t,this._parents=n}function Lt(){return new Tt([[document.documentElement]],kt)}function Pt(t){return"string"==typeof t?new Tt([[document.querySelector(t)]],[document.documentElement]):new Tt([[t]],kt)}function qt(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>Gt){var i=h(t);if(i.scrollX||i.scrollY){e=Pt(i.document.body).append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e.node().getScreenCTM();Gt=!(u.f||u.e),e.remove()}}return Gt?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var o=t.getBoundingClientRect();return[n.clientX-o.left-t.clientLeft,n.clientY-o.top-t.clientTop]}function Bt(t,n){return null==n&&(n=f()),n.changedTouches&&(n=n.changedTouches[0]),qt(t,n)}function Dt(t){return"string"==typeof t?new Tt([document.querySelectorAll(t)],[document.documentElement]):new Tt([t],kt)}function Ot(t,n,e){arguments.length<3&&(e=n,n=f().changedTouches);for(var r,i=0,u=n?n.length:0;u>i;++i)if((r=n[i]).identifier===e)return qt(t,r);return null}function Vt(t,n){null==n&&(n=f().touches);for(var e=0,r=n?n.length:0,i=new Array(r);r>e;++e)i[e]=qt(t,n[e]);return i}var Rt={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Xt=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var zt=document.documentElement;if(!zt.matches){var Ht=zt.webkitMatchesSelector||zt.msMatchesSelector||zt.mozMatchesSelector||zt.oMatchesSelector;Xt=function(t){return function(){return Ht.call(this,t)}}}}var It=Xt,Ut={};if(t.event=null,"undefined"!=typeof document){var Yt=document.documentElement;"onmouseenter"in Yt||(Ut={mouseenter:"mouseover",mouseleave:"mouseout"})}var jt="$";S.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Z.prototype={add:function(t){var n=this._names.indexOf(t);0>n&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var kt=[null];Tt.prototype=Lt.prototype={select:m,selectAll:d,filter:g,data:A,enter:E,exit:C,order:N,sort:M,call:L,nodes:P,node:q,size:B,empty:D,each:O,attr:U,style:G,property:F,classed:ut,text:ct,html:pt,raise:_t,lower:gt,append:xt,remove:St,datum:bt,on:l,dispatch:Mt};var Gt="undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,Kt="0.6.9";t.version=Kt,t.creator=i,t.matcher=It,t.mouse=Bt,t.namespace=n,t.namespaces=Rt,t.select=Pt,t.selectAll=Dt,t.selection=Lt,t.selector=p,t.selectorAll=_,t.touch=Ot,t.touches=Vt,t.window=h});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_selection={})}(this,function(t){"use strict";function n(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Vt.hasOwnProperty(n)?{space:Vt[n],local:t}:t}function e(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e&&e!==n.documentElement.namespaceURI?n.createElementNS(e,t):n.createElement(t)}}function r(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function i(t){var i=n(t);return(i.local?r:e)(i)}function u(t,n,e){return t=o(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function o(n,e,r){return function(i){var u=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=u}}}function s(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function a(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,u=n.length;u>r;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function c(t,n,e){var r=It.hasOwnProperty(t.type)?u:o;return function(i,u,o){var s,a=this.__on,c=r(n,u,o);if(a)for(var l=0,f=a.length;f>l;++l)if((s=a[l]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=c,s.capture=e),void(s.value=n);this.addEventListener(t.type,c,e),s={type:t.type,name:t.name,value:n,listener:c,capture:e},a?a.push(s):this.__on=[s]}}function l(t,n,e){var r,i,u=s(t+""),o=u.length;{if(!(arguments.length<2)){for(l=n?c:a,null==e&&(e=!1),r=0;o>r;++r)this.each(l(u[r],n,e));return this}var l=this.node().__on;if(l)for(var f,h=0,p=l.length;p>h;++h)for(r=0,f=l[h];o>r;++r)if((i=u[r]).type===f.type&&i.name===f.name)return f.value}}function f(){for(var n,e=t.event;n=e.sourceEvent;)e=n;return e}function h(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function p(t){return function(){return this.querySelector(t)}}function m(t){"function"!=typeof t&&(t=p(t));for(var n=this._groups,e=this._update,r=n.length,i=new Array(r),u=0;r>u;++u)for(var o,s,a=n[u],c=a.length,l=i[u]=new Array(c),f=0;c>f;++f)(o=a[f])&&(s=t.call(o,o.__data__,f,a))&&("__data__"in o&&(s.__data__=o.__data__),e&&(e._groups[u][f]=s),l[f]=s);return new Tt(i,this._parents)}function _(t){return function(){return this.querySelectorAll(t)}}function d(t){"function"!=typeof t&&(t=_(t));for(var n=this._groups,e=n.length,r=[],i=[],u=0;e>u;++u)for(var o,s=n[u],a=s.length,c=0;a>c;++c)(o=s[c])&&(r.push(t.call(o,o.__data__,c,s)),i.push(o));return new Tt(r,i)}function v(t){"function"!=typeof t&&(t=Ht(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;e>i;++i)for(var u,o=n[i],s=o.length,a=r[i]=[],c=0;s>c;++c)(u=o[c])&&t.call(u,u.__data__,c,o)&&a.push(u);return new Tt(r,this._parents)}function g(t){return function(){return t}}function y(t,n,e,r,i,u){for(var o,s=0,a=n.length,c=u.length;c>s;++s)(o=n[s])?(o.__data__=u[s],r[s]=o):e[s]=new x(t,u[s]);for(;a>s;++s)(o=n[s])&&(i[s]=o)}function w(t,n,e,r,i,u,o){var s,a,c,l={},f=n.length,h=u.length,p=new Array(f);for(s=0;f>s;++s)(a=n[s])&&(p[s]=c=Yt+o.call(a,a.__data__,s,n),l[c]||(l[c]=a));for(s=0;h>s;++s)c=Yt+o.call(t,u[s],s,u),(a=l[c])?a!==!0&&(r[s]=a,a.__data__=u[s]):e[s]=new x(t,u[s]),l[c]=!0;for(s=0;f>s;++s)(a=n[s])&&l[p[s]]!==!0&&(i[s]=a)}function A(t,n){if(!t)return p=new Array(this.size()),c=-1,this.each(function(t){p[++c]=t}),p;var e=n?w:y,r=this._parents,i=this._groups;"function"!=typeof t&&(t=g(t));for(var u=i.length,o=new Array(u),s=new Array(u),a=new Array(u),c=0;u>c;++c){var l=r[c],f=i[c],h=f.length,p=t.call(l,l&&l.__data__,c,r),m=p.length,_=s[c]=new Array(m),d=o[c]=new Array(m),v=a[c]=new Array(h);e(l,f,_,d,v,p,n);for(var A,x,S=0,b=0;m>S;++S)if(A=_[S]){for(S>=b&&(b=S+1);!(x=d[b])&&++b<m;);A._next=x||null}}return this._groups=o,(this._enter=new Tt(s,r))._update=this,this._exit=new Tt(a,r),this}function x(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function S(t){return new Array(t.length)}function b(){var t=this._enter;return t?(this._enter=null,t):(t=new Tt(this._groups.map(S),this._parents),t._update=this,t)}function E(){var t=this._exit;return t?(this._exit=null,t):new Tt(this._groups.map(S),this._parents)}function C(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],u=i.length-1,o=i[u];--u>=0;)(r=i[u])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this}function N(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=T);for(var e=this._groups,r=e.length,i=this._groups=new Array(r),u=0;r>u;++u){for(var o,s=e[u],a=s.length,c=i[u]=new Array(a),l=0;a>l;++l)(o=s[l])&&(c[l]=o);c.sort(n)}return this.order()}function T(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function L(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function M(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t}function P(){for(var t=this._groups,n=0,e=t.length;e>n;++n)for(var r=t[n],i=0,u=r.length;u>i;++i){var o=r[i];if(o)return o}return null}function q(){var t=0;return this.each(function(){++t}),t}function B(){return!this.node()}function D(t){for(var n=this._groups,e=0,r=n.length;r>e;++e)for(var i,u=n[e],o=0,s=u.length;s>o;++o)(i=u[o])&&t.call(i,i.__data__,o,u);return this}function O(t){return function(){this.removeAttribute(t)}}function V(t){return function(){this.removeAttributeNS(t.space,t.local)}}function R(t,n){return function(){this.setAttribute(t,n)}}function X(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function z(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function H(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function I(t,e){var r=n(t);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((null==e?r.local?V:O:"function"==typeof e?r.local?H:z:r.local?X:R)(r,e))}function U(t){return function(){this.style.removeProperty(t)}}function Y(t,n,e){return function(){this.style.setProperty(t,n,e)}}function j(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function k(t,n,e){var r;return arguments.length>1?this.each((null==n?U:"function"==typeof n?j:Y)(t,n,null==e?"":e)):h(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)}function G(t){return function(){delete this[t]}}function K(t,n){return function(){this[t]=n}}function W(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function $(t,n){return arguments.length>1?this.each((null==n?G:"function"==typeof n?W:K)(t,n)):this.node()[t]}function F(t){return t.trim().split(/^|\s+/)}function J(t){return t.classList||new Q(t)}function Q(t){this._node=t,this._names=F(t.getAttribute("class")||"")}function Z(t,n){for(var e=J(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function tt(t,n){for(var e=J(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function nt(t){return function(){Z(this,t)}}function et(t){return function(){tt(this,t)}}function rt(t,n){return function(){(n.apply(this,arguments)?Z:tt)(this,t)}}function it(t,n){var e=F(t+"");if(arguments.length<2){for(var r=J(this.node()),i=-1,u=e.length;++i<u;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?rt:n?nt:et)(e,n))}function ut(){this.textContent=""}function ot(t){return function(){this.textContent=t}}function st(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function at(t){return arguments.length?this.each(null==t?ut:("function"==typeof t?st:ot)(t)):this.node().textContent}function ct(){this.innerHTML=""}function lt(t){return function(){this.innerHTML=t}}function ft(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function ht(t){return arguments.length?this.each(null==t?ct:("function"==typeof t?ft:lt)(t)):this.node().innerHTML}function pt(){this.parentNode.appendChild(this)}function mt(){return this.each(pt)}function _t(){this.parentNode.insertBefore(this,this.parentNode.firstChild)}function dt(){return this.each(_t)}function vt(t){return function(){return this.appendChild(t.apply(this,arguments))}}function gt(t,n){return function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}}function yt(){return null}function wt(t,n){var e="function"==typeof t?t:i(t);return this.select(arguments.length<2?vt(e):gt(e,null==n?yt:"function"==typeof n?n:p(n)))}function At(){var t=this.parentNode;t&&t.removeChild(this)}function xt(){return this.each(At)}function St(t){return arguments.length?this.property("__data__",t):this.node().__data__}function bt(t,n,e){var r=h(t),i=r.CustomEvent;i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function Et(t,n){return function(){return bt(this,t,n)}}function Ct(t,n){return function(){return bt(this,t,n.apply(this,arguments))}}function Nt(t,n){return this.each(("function"==typeof n?Ct:Et)(t,n))}function Tt(t,n){this._groups=t,this._parents=n}function Lt(){return new Tt([[document.documentElement]],jt)}function Mt(t){return"string"==typeof t?new Tt([[document.querySelector(t)]],[document.documentElement]):new Tt([[t]],jt)}function Pt(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>kt){var i=h(t);if(i.scrollX||i.scrollY){e=Mt(i.document.body).append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e.node().getScreenCTM();kt=!(u.f||u.e),e.remove()}}return kt?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var o=t.getBoundingClientRect();return[n.clientX-o.left-t.clientLeft,n.clientY-o.top-t.clientTop]}function qt(t,n){return null==n&&(n=f()),n.changedTouches&&(n=n.changedTouches[0]),Pt(t,n)}function Bt(t){return"string"==typeof t?new Tt([document.querySelectorAll(t)],[document.documentElement]):new Tt([t],jt)}function Dt(t,n,e){arguments.length<3&&(e=n,n=f().changedTouches);for(var r,i=0,u=n?n.length:0;u>i;++i)if((r=n[i]).identifier===e)return Pt(t,r);return null}function Ot(t,n){null==n&&(n=f().touches);for(var e=0,r=n?n.length:0,i=new Array(r);r>e;++e)i[e]=Pt(t,n[e]);return i}var Vt={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Rt=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var Xt=document.documentElement;if(!Xt.matches){var zt=Xt.webkitMatchesSelector||Xt.msMatchesSelector||Xt.mozMatchesSelector||Xt.oMatchesSelector;Rt=function(t){return function(){return zt.call(this,t)}}}}var Ht=Rt,It={};if(t.event=null,"undefined"!=typeof document){var Ut=document.documentElement;"onmouseenter"in Ut||(It={mouseenter:"mouseover",mouseleave:"mouseout"})}var Yt="$";x.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},Q.prototype={add:function(t){var n=this._names.indexOf(t);0>n&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var jt=[null];Tt.prototype=Lt.prototype={select:m,selectAll:d,filter:v,data:A,enter:b,exit:E,order:C,sort:N,call:L,nodes:M,node:P,size:q,empty:B,each:D,attr:I,style:k,property:$,classed:it,text:at,html:ht,raise:mt,lower:dt,append:wt,remove:xt,datum:St,on:l,dispatch:Nt};var kt="undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,Gt="0.6.10";t.version=Gt,t.creator=i,t.matcher=Ht,t.mouse=qt,t.namespace=n,t.namespaces=Vt,t.select=Mt,t.selectAll=Bt,t.selection=Lt,t.selector=p,t.selectorAll=_,t.touch=Dt,t.touches=Ot,t.window=h});
{
"name": "d3-selection",
"version": "0.6.9",
"version": "0.6.10",
"description": "Data-driven DOM manipulation: select elements and join them to data.",

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

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

import arrayify from "./arrayify";
import {Selection} from "./index";
import constant from "../constant";

@@ -6,16 +6,15 @@

function bindIndex(parent, update, enter, exit, data) {
function bindIndex(parent, group, enter, update, exit, data) {
var i = 0,
node,
nodeLength = update.length,
dataLength = data.length,
minLength = Math.min(nodeLength, dataLength);
groupLength = group.length,
dataLength = data.length;
// Clear the enter and exit arrays, and then initialize to the new length.
enter.length = 0, enter.length = dataLength;
exit.length = 0, exit.length = nodeLength;
for (; i < minLength; ++i) {
if (node = update[i]) {
// Put any non-null nodes that fit into update.
// Put any null nodes into enter.
// Put any remaining data into enter.
for (; i < dataLength; ++i) {
if (node = group[i]) {
node.__data__ = data[i];
update[i] = node;
} else {

@@ -26,45 +25,25 @@ enter[i] = new EnterNode(parent, data[i]);

// Note: we don’t need to delete update[i] here because this loop only
// runs when the data length is greater than the node length.
for (; i < dataLength; ++i) {
enter[i] = new EnterNode(parent, data[i]);
}
// Note: and, we don’t need to delete update[i] here because immediately
// following this loop we set the update length to data length.
for (; i < nodeLength; ++i) {
if (node = update[i]) {
exit[i] = update[i];
// Put any non-null nodes that don’t fit into exit.
for (; i < groupLength; ++i) {
if (node = group[i]) {
exit[i] = node;
}
}
update.length = dataLength;
}
function bindKey(parent, update, enter, exit, data, key) {
function bindKey(parent, group, enter, update, exit, data, key) {
var i,
node,
nodeByKeyValue = {},
groupLength = group.length,
dataLength = data.length,
nodeLength = update.length,
nodeByKeyValue = {},
keyValues = new Array(nodeLength),
keyValues = new Array(groupLength),
keyValue;
// Clear the enter and exit arrays, and then initialize to the new length.
enter.length = 0, enter.length = dataLength;
exit.length = 0, exit.length = nodeLength;
// Compute the keys for each node.
for (i = 0; i < nodeLength; ++i) {
if (node = update[i]) {
keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, update);
// Is this a duplicate of a key we’ve previously seen?
// If so, this node is moved to the exit selection.
if (nodeByKeyValue[keyValue]) {
exit[i] = node;
}
// Otherwise, record the mapping from key to node.
else {
// Compute the key for each node.
// If multiple nodes have the same key, only the first one counts.
for (i = 0; i < groupLength; ++i) {
if (node = group[i]) {
keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);
if (!nodeByKeyValue[keyValue]) {
nodeByKeyValue[keyValue] = node;

@@ -75,6 +54,4 @@ }

// Now clear the update array and initialize to the new length.
update.length = 0, update.length = dataLength;
// Compute the keys for each datum.
// Compute the key for each datum.
// If multiple data have the same key, only the first one counts.
for (i = 0; i < dataLength; ++i) {

@@ -103,4 +80,4 @@ keyValue = keyPrefix + key.call(parent, data[i], i, data);

// and place them in the exit selection.
for (i = 0; i < nodeLength; ++i) {
if ((node = nodeByKeyValue[keyValues[i]]) !== true) {
for (i = 0; i < groupLength; ++i) {
if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] !== true)) {
exit[i] = node;

@@ -113,4 +90,4 @@ }

if (!value) {
var data = new Array(this.size()), i = -1;
this.each(function(d) { data[++i] = d; });
data = new Array(this.size()), j = -1;
this.each(function(d) { data[++j] = d; });
return data;

@@ -121,13 +98,17 @@ }

parents = this._parents,
update = arrayify(this),
enter = (this._enter = this.enter())._groups,
exit = (this._exit = this.exit())._groups;
groups = this._groups;
if (typeof value !== "function") value = constant(value);
for (var m = update.length, j = 0; j < m; ++j) {
var group = update[j],
parent = parents[j];
for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
var parent = parents[j],
group = groups[j],
groupLength = group.length,
data = value.call(parent, parent && parent.__data__, j, parents),
dataLength = data.length,
enterGroup = enter[j] = new Array(dataLength),
updateGroup = update[j] = new Array(dataLength),
exitGroup = exit[j] = new Array(groupLength);
bind(parent, group, enter[j], exit[j], value.call(parent, parent && parent.__data__, j, parents), key);
bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);

@@ -137,6 +118,6 @@ // Now connect the enter nodes to their following update node, such that

// rather than at the end of the parent node.
for (var n = group.length, i0 = 0, i1 = 0, previous, next; i0 < n; ++i0) {
if (previous = enter[j][i0]) {
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
if (previous = enterGroup[i0]) {
if (i0 >= i1) i1 = i0 + 1;
while (!(next = group[i1]) && ++i1 < n);
while (!(next = updateGroup[i1]) && ++i1 < dataLength);
previous._next = next || null;

@@ -147,2 +128,5 @@ }

this._groups = update;
(this._enter = new Selection(enter, parents))._update = this;
this._exit = new Selection(exit, parents);
return this;

@@ -149,0 +133,0 @@ }

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

import arrayify from "./arrayify";
export default function(compare) {

@@ -10,4 +8,9 @@ if (!compare) compare = ascending;

for (var groups = arrayify(this), j = 0, m = groups.length; j < m; ++j) {
groups[j].sort(compareNode);
for (var groups = this._groups, m = groups.length, sortgroups = this._groups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group[i]) {
sortgroup[i] = node;
}
}
sortgroup.sort(compareNode);
}

@@ -14,0 +17,0 @@

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