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.4.7 to 0.4.8

399

build/d3.js
if (typeof Map === "undefined") {
Map = function() {};
Map = function() { this.clear(); };
Map.prototype = {
set: function(k, v) { this["$" + k] = v; return this; },
get: function(k) { return this["$" + k]; },
has: function(k) { return "$" + k in this; }
set: function(k, v) { this._[k] = v; return this; },
get: function(k) { return this._[k]; },
has: function(k) { return k in this._; },
delete: function(k) { return k in this._ && delete this._[k]; },
clear: function() { this._ = Object.create(null); },
get size() { var n = 0; for (var k in this._) ++n; return n; },
forEach: function(c) { for (var k in this._) c(this._[k], k, this); }
};
}
} else (function() {
var m = new Map;
if (m.set(0, 0) !== m) {
m = m.set;
Map.prototype.set = function() { m.apply(this, arguments); return this; };
}
})();

@@ -16,13 +26,3 @@ (function (global, factory) {

var bug44083 = typeof navigator !== "undefined" && /WebKit/.test(navigator.userAgent) ? -1 : 0; // https://bugs.webkit.org/show_bug.cgi?id=44083// When depth = 1, root = [Node, …].
// When depth = 2, root = [[Node, …], …].
// When depth = 3, root = [[[Node, …], …], …]. etc.
// Note that [Node, …] and NodeList are used interchangeably; see arrayify.
function Selection(root, depth) {
this._root = root;
this._depth = depth;
this._enter = this._update = this._exit = null;
}
var defaultView = function(node) {
function _defaultView(node) {
return node

@@ -34,4 +34,17 @@ && ((node.ownerDocument && node.ownerDocument.defaultView) // node is a Node

function selection_dispatch(type, params) {
function dispatchConstant() {
return dispatchEvent(this, type, params);
}
function dispatchFunction() {
return dispatchEvent(this, type, params.apply(this, arguments));
}
return this.each(typeof params === "function" ? dispatchFunction : dispatchConstant);
}
function dispatchEvent(node, type, params) {
var window = defaultView(node),
var window = _defaultView(node),
event = window.CustomEvent;

@@ -50,49 +63,20 @@

var selection_dispatch = function(type, params) {
function dispatchConstant() {
return dispatchEvent(this, type, params);
}
function dispatchFunction() {
return dispatchEvent(this, type, params.apply(this, arguments));
}
return this.each(typeof params === "function" ? dispatchFunction : dispatchConstant);
}
function noop() {}
var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
var requote = function(string) {
function requote(string) {
return string.replace(requoteRe, "\\$&");
}
function filterListenerOf(listener) {
return function(event) {
var related = event.relatedTarget;
if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
listener(event);
}
};
}
var filterEvents = new Map;
var event = null;
function listenerOf(listener, ancestors, args) {
return function(event1) {
var i = ancestors.length, event0 = event; // Events can be reentrant (e.g., focus).
while (--i >= 0) args[i << 1] = ancestors[i].__data__;
event = event1;
try {
listener.apply(ancestors[0], args);
} finally {
event = event0;
}
};
if (typeof document !== "undefined") {
var _element = document.documentElement;
if (!("onmouseenter" in _element)) {
filterEvents.set("mouseenter", "mouseover").set("mouseleave", "mouseout");
}
}
var filterEvents = new Map;
var selection_event = function(type, listener, capture) {
function selection_event(type, listener, capture) {
var n = arguments.length,

@@ -142,6 +126,32 @@ key = "__on" + type,

}
var selection_datum = function(value) {
function listenerOf(listener, ancestors, args) {
return function(event1) {
var i = ancestors.length, event0 = event; // Events can be reentrant (e.g., focus).
while (--i >= 0) args[i << 1] = ancestors[i].__data__;
event = event1;
try {
listener.apply(ancestors[0], args);
} finally {
event = event0;
}
};
}
function filterListenerOf(listener) {
return function(event) {
var related = event.relatedTarget;
if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {
listener(event);
}
};
}
function noop() {}
function selection_datum(value) {
return arguments.length ? this.property("__data__", value) : this.node().__data__;
}
var selection_remove = function() {
function selection_remove() {
return this.each(function() {

@@ -152,3 +162,4 @@ var parent = this.parentNode;

}
var selectorOf = function(selector) {
function selectorOf(selector) {
return function() {

@@ -158,2 +169,3 @@ return this.querySelector(selector);

}
var namespaces = (new Map)

@@ -166,3 +178,3 @@ .set("svg", "http://www.w3.org/2000/svg")

var namespace = function(name) {
function namespace(name) {
var i = name.indexOf(":"), prefix = name;

@@ -173,2 +185,18 @@ if (i >= 0) prefix = name.slice(0, i), name = name.slice(i + 1);

function selection_append(creator, selector) {
if (typeof creator !== "function") creator = creatorOf(creator);
function append() {
return this.appendChild(creator.apply(this, arguments));
}
function insert() {
return this.insertBefore(creator.apply(this, arguments), selector.apply(this, arguments) || null);
}
return this.select(arguments.length < 2
? append
: (typeof selector !== "function" && (selector = selectorOf(selector)), insert));
}
function creatorOf(name) {

@@ -192,18 +220,3 @@ name = namespace(name);

var selection_append = function(creator, selector) {
if (typeof creator !== "function") creator = creatorOf(creator);
function append() {
return this.appendChild(creator.apply(this, arguments));
}
function insert() {
return this.insertBefore(creator.apply(this, arguments), selector.apply(this, arguments) || null);
}
return this.select(arguments.length < 2
? append
: (typeof selector !== "function" && (selector = selectorOf(selector)), insert));
}
var selection_html = function(value) {
function selection_html(value) {
if (!arguments.length) return this.node().innerHTML;

@@ -224,3 +237,4 @@

}
var selection_text = function(value) {
function selection_text(value) {
if (!arguments.length) return this.node().textContent;

@@ -242,22 +256,3 @@

function collapse(string) {
return string.trim().replace(/\s+/g, " ");
}
function classerOf(name) {
var re;
return function(node, value) {
if (c = node.classList) return value ? c.add(name) : c.remove(name);
if (!re) re = new RegExp("(?:^|\\s+)" + requote(name) + "(?:\\s+|$)", "g");
var c = node.getAttribute("class") || "";
if (value) {
re.lastIndex = 0;
if (!re.test(c)) node.setAttribute("class", collapse(c + " " + name));
} else {
node.setAttribute("class", collapse(c.replace(re, " ")));
}
};
}
var selection_class = function(name, value) {
function selection_class(name, value) {
name = (name + "").trim().split(/^|\s+/);

@@ -291,3 +286,27 @@ var n = name.length;

}
var selection_property = function(name, value) {
function classerOf(name) {
var re;
return function(node, value) {
if (c = node.classList) return value ? c.add(name) : c.remove(name);
if (!re) re = classedRe(name);
var c = node.getAttribute("class") || "";
if (value) {
re.lastIndex = 0;
if (!re.test(c)) node.setAttribute("class", collapse(c + " " + name));
} else {
node.setAttribute("class", collapse(c.replace(re, " ")));
}
};
}
function collapse(string) {
return string.trim().replace(/\s+/g, " ");
}
function classedRe(name) {
return new RegExp("(?:^|\\s+)" + requote(name) + "(?:\\s+|$)", "g");
}
function selection_property(name, value) {
if (arguments.length < 2) return this.node()[name];

@@ -312,6 +331,6 @@

var selection_style = function(name, value, priority) {
function selection_style(name, value, priority) {
var n = arguments.length;
if (n < 2) return defaultView(n = this.node()).getComputedStyle(n, null).getPropertyValue(name);
if (n < 2) return _defaultView(n = this.node()).getComputedStyle(n, null).getPropertyValue(name);

@@ -337,3 +356,3 @@ if (n < 3) priority = "";

var selection_attr = function(name, value) {
function selection_attr(name, value) {
name = namespace(name);

@@ -382,3 +401,4 @@

}
var selection_each = function(callback) {
function selection_each(callback) {
var depth = this._depth,

@@ -416,6 +436,8 @@ stack = new Array(depth);

}
var selection_empty = function() {
function selection_empty() {
return !this.node();
}
var selection_size = function() {
function selection_size() {
var size = 0;

@@ -426,2 +448,6 @@ this.each(function() { ++size; });

function selection_node() {
return firstNode(this._root, this._depth);
}
function firstNode(nodes, depth) {

@@ -450,6 +476,4 @@ var i = -1,

}
var selection_node = function() {
return firstNode(this._root, this._depth);
}
var selection_nodes = function() {
function selection_nodes() {
var nodes = new Array(this.size()), i = -1;

@@ -459,3 +483,4 @@ this.each(function() { nodes[++i] = this; });

}
var selection_call = function() {
function selection_call() {
var callback = arguments[0];

@@ -466,2 +491,9 @@ callback.apply(arguments[0] = this, arguments);

// The leaf groups of the selection hierarchy are initially NodeList,
// and then lazily converted to arrays when mutation is required.
function arrayify(selection) {
return selection._root = arrayifyNode(selection._root, selection._depth);
}
function arrayifyNode(nodes, depth) {

@@ -488,13 +520,5 @@ var i = -1,

return nodes;
}// The leaf groups of the selection hierarchy are initially NodeList,
// and then lazily converted to arrays when mutation is required.
var arrayify = function(selection) {
return selection._root = arrayifyNode(selection._root, selection._depth);
}
function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
var selection_sort = function(comparator) {
function selection_sort(comparator) {
if (!comparator) comparator = ascending;

@@ -527,2 +551,11 @@

function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
function selection_order() {
orderNode(this._root, this._depth);
return this;
}
function orderNode(nodes, depth) {

@@ -551,5 +584,5 @@ var i = nodes.length,

}
var selection_order = function() {
orderNode(this._root, this._depth);
return this;
function emptyOf(selection) {
return new Selection(emptyNode(arrayify(selection), selection._depth), selection._depth);
}

@@ -575,13 +608,13 @@

var emptyOf = function(selection) {
return new Selection(emptyNode(arrayify(selection), selection._depth), selection._depth);
}// Lazily constructs the exit selection for this (update) selection.
// Lazily constructs the exit selection for this (update) selection.
// Until this selection is joined to data, the exit selection will be empty.
function selection_exit() {
return this._exit || (this._exit = emptyOf(this));
}
var selection_exit = function() {
return this._exit || (this._exit = emptyOf(this));
}// Lazily constructs the enter selection for this (update) selection.
// Lazily constructs the enter selection for this (update) selection.
// Until this selection is joined to data, the enter selection will be empty.
var selection_enter = function() {
function selection_enter() {
if (!this._enter) {

@@ -594,24 +627,8 @@ this._enter = emptyOf(this);

function EnterNode(parent, datum) {
this.ownerDocument = parent.ownerDocument;
this.namespaceURI = parent.namespaceURI;
this._next = null;
this._parent = parent;
this.__data__ = datum;
}
EnterNode.prototype = {
appendChild: function(child) { return this._parent.insertBefore(child, this._next); },
insertBefore: function(child, next) { return this._parent.insertBefore(child, next || this._next); }
};
function valueOf_(value) { // XXX https://github.com/rollup/rollup/issues/12
return function() {
return value;
};
}// The value may either be an array or a function that returns an array.
// The value may either be an array or a function that returns an array.
// An optional key function may be specified to control how data is bound;
// if no key function is specified, data is bound to nodes by index.
// Or, if no arguments are specified, this method returns all bound data.
var selection_data = function(value, key) {
function selection_data(value, key) {
if (!value) {

@@ -776,18 +793,25 @@ var data = new Array(this.size()), i = -1;

var filterOf = function(selector) {
function EnterNode(parent, datum) {
this.ownerDocument = parent.ownerDocument;
this.namespaceURI = parent.namespaceURI;
this._next = null;
this._parent = parent;
this.__data__ = datum;
}
EnterNode.prototype = {
appendChild: function(child) { return this._parent.insertBefore(child, this._next); },
insertBefore: function(child, next) { return this._parent.insertBefore(child, next || this._next); }
};
function valueOf_(value) { // XXX https://github.com/rollup/rollup/issues/12
return function() {
return this.matches(selector);
return value;
};
};
}
if (typeof document !== "undefined") {
var element = document.documentElement;
if (!element.matches) {
var vendorMatches = element.webkitMatchesSelector || element.msMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector;
filterOf = function(selector) { return function() { return vendorMatches.call(this, selector); }; };
}
}// The filter may either be a selector string (e.g., ".foo")
// The filter may either be a selector string (e.g., ".foo")
// or a function that returns a boolean.
var selection_filter = function(filter) {
function selection_filter(filter) {
var depth = this._depth,

@@ -837,11 +861,21 @@ stack = new Array(depth * 2);

function selectorAllOf(selector) {
var filterOf = function(selector) {
return function() {
return this.querySelectorAll(selector);
return this.matches(selector);
};
}// The selector may either be a selector string (e.g., ".foo")
};
if (typeof document !== "undefined") {
var element = document.documentElement;
if (!element.matches) {
var vendorMatches = element.webkitMatchesSelector || element.msMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector;
filterOf = function(selector) { return function() { return vendorMatches.call(this, selector); }; };
}
}
// The selector may either be a selector string (e.g., ".foo")
// or a function that optionally returns an array of nodes to select.
// This is the only operation that increases the depth of a selection.
var selection_selectAll = function(selector) {
function selection_selectAll(selector) {
var depth = this._depth,

@@ -887,6 +921,14 @@ stack = new Array(depth * 2);

return new Selection(visit(this._root, depth), depth + 1);
}// The selector may either be a selector string (e.g., ".foo")
}
function selectorAllOf(selector) {
return function() {
return this.querySelectorAll(selector);
};
}
// The selector may either be a selector string (e.g., ".foo")
// or a function that optionally returns the node to select.
var selection_select = function(selector) {
function selection_select(selector) {
var depth = this._depth,

@@ -939,2 +981,13 @@ stack = new Array(depth * 2);

// When depth = 1, root = [Node, …].
// When depth = 2, root = [[Node, …], …].
// When depth = 3, root = [[[Node, …], …], …]. etc.
// Note that [Node, …] and NodeList are used interchangeably; see arrayify.
function Selection(root, depth) {
this._root = root;
this._depth = depth;
this._enter = this._update = this._exit = null;
}
function selection() {

@@ -975,7 +1028,9 @@ return new Selection([document.documentElement], 1);

var select = function(selector) {
function select(selector) {
return new Selection([typeof selector === "string" ? document.querySelector(selector) : selector], 1);
}
var point = function(node, event) {
var bug44083 = typeof navigator !== "undefined" && /WebKit/.test(navigator.userAgent) ? -1 : 0; // https://bugs.webkit.org/show_bug.cgi?id=44083
function point(node, event) {
var svg = node.ownerSVGElement || node;

@@ -1002,3 +1057,3 @@ if (svg.createSVGPoint) {

var sourceEvent = function() {
function sourceEvent() {
var current = event, source;

@@ -1009,3 +1064,3 @@ while (source = current.sourceEvent) current = source;

var touches = function(node, touches) {
function touches(node, touches) {
if (arguments.length < 2) touches = sourceEvent().touches;

@@ -1018,3 +1073,3 @@ for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {

var touch = function(node, touches, identifier) {
function touch(node, touches, identifier) {
if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;

@@ -1029,7 +1084,7 @@ for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {

var selectAll = function(selector) {
function selectAll(selector) {
return new Selection(typeof selector === "string" ? document.querySelectorAll(selector) : selector, 1);
}
var mouse = function(node, event) {
function mouse(node, event) {
if (arguments.length < 2) event = sourceEvent();

@@ -1036,0 +1091,0 @@ if (event.changedTouches) event = event.changedTouches[0];

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

"undefined"==typeof Map&&(Map=function(){},Map.prototype={set:function(t,e){return this["$"+t]=e,this},get:function(t){return this["$"+t]},has:function(t){return"$"+t in this}}),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.d3=e()}(this,function(){"use strict";function t(t,e){this._root=t,this._depth=e,this._enter=this._update=this._exit=null}function e(t,e,n){var r=v(t),i=r.CustomEvent;i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function n(){}function r(t){return function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t(e)}}function i(t,e,n){return function(r){for(var i=e.length,o=x;--i>=0;)n[i<<1]=e[i].__data__;x=r;try{t.apply(e[0],n)}finally{x=o}}}function o(t){function e(){var e=this.ownerDocument,n=this.namespaceURI;return n?e.createElementNS(n,t):e.createElement(t)}function n(){return this.ownerDocument.createElementNS(t.space,t.local)}return t=L(t),t.local?n:e}function a(t){return t.trim().replace(/\s+/g," ")}function u(t){var e;return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);e||(e=new RegExp("(?:^|\\s+)"+A(t)+"(?:\\s+|$)","g"));var i=n.getAttribute("class")||"";r?(e.lastIndex=0,e.test(i)||n.setAttribute("class",a(i+" "+t))):n.setAttribute("class",a(i.replace(e," ")))}}function s(t,e){var n,r=-1,i=t.length;if(--e){for(;++r<i;)if((n=t[r])&&(n=s(n,e)))return n}else for(;++r<i;)if(n=t[r])return n}function c(t,e){var n,r=-1,i=t.length;if(--e)for(;++r<i;)(n=t[r])&&(t[r]=c(n,e));else if(!Array.isArray(t)){for(var o=new Array(i);++r<i;)o[r]=t[r];o._parent=t._parent,t=o}return t}function h(t,e){return e>t?-1:t>e?1:t>=e?0:0/0}function l(t,e){var n,r,i=t.length;if(--e)for(;--i>=0;)(n=t[i])&&l(n,e);else for(r=t[--i];--i>=0;)(n=t[i])&&(r&&r!==n.nextSibling&&r.parentNode.insertBefore(n,r),r=n)}function f(t,e){var n,r=-1,i=t.length,o=new Array(i);if(--e)for(;++r<i;)(n=t[r])&&(o[r]=f(n,e));return o._parent=t._parent,o}function p(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function _(t){return function(){return t}}function d(t){return function(){return this.querySelectorAll(t)}}function g(){return new t([document.documentElement],1)}var m="undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,v=function(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)},y=function(t,n){function r(){return e(this,t,n)}function i(){return e(this,t,n.apply(this,arguments))}return this.each("function"==typeof n?i:r)},w=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,A=function(t){return t.replace(w,"\\$&")},x=null,b=new Map,S=function(t,e,o){function a(){for(var n=f,a=arguments.length>>1,s=new Array(a);--a>=0;)n=n[arguments[(a<<1)+1]],s[a]=a?n._parent:n;var h=i(e,s,arguments);c&&(h=r(h)),u.call(this),this.addEventListener(t,this[l]=h,h._capture=o),h._listener=e}function u(){var e=this[l];e&&(this.removeEventListener(t,e,e._capture),delete this[l])}function s(){var e,n=new RegExp("^__on([^.]+)"+A(t)+"$");for(var r in this)if(e=r.match(n)){var i=this[r];this.removeEventListener(e[1],i,i._capture),delete this[r]}}var c,h=arguments.length,l="__on"+t,f=this._root;return 2>h?(h=this.node()[l])&&h._listener:(3>h&&(o=!1),(h=t.indexOf("."))>0&&(t=t.slice(0,h)),(c=b.has(t))&&(t=b.get(t)),this.each(e?h?a:n:h?u:s))},E=function(t){return arguments.length?this.property("__data__",t):this.node().__data__},M=function(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})},C=function(t){return function(){return this.querySelector(t)}},T=(new Map).set("svg","http://www.w3.org/2000/svg").set("xhtml","http://www.w3.org/1999/xhtml").set("xlink","http://www.w3.org/1999/xlink").set("xml","http://www.w3.org/XML/1998/namespace").set("xmlns","http://www.w3.org/2000/xmlns/"),L=function(t){var e=t.indexOf(":"),n=t;return e>=0&&(n=t.slice(0,e),t=t.slice(e+1)),T.has(n)?{space:T.get(n),local:t}:t},N=function(t,e){function n(){return this.appendChild(t.apply(this,arguments))}function r(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)}return"function"!=typeof t&&(t=o(t)),this.select(arguments.length<2?n:("function"!=typeof e&&(e=C(e)),r))},P=function(t){function e(){this.innerHTML=t}function n(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().innerHTML},D=function(t){function e(){this.textContent=t}function n(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().textContent},R=function(t,e){function n(){for(var n=-1;++n<i;)t[n](this,e)}function r(){for(var n=-1,r=e.apply(this,arguments);++n<i;)t[n](this,r)}t=(t+"").trim().split(/^|\s+/);var i=t.length;if(arguments.length<2){var o=this.node(),a=-1;if(e=o.classList){for(;++a<i;)if(!e.contains(t[a]))return!1}else for(e=o.getAttribute("class");++a<i;)if(!classedRe(t[a]).test(e))return!1;return!0}return t=t.map(u),this.each("function"==typeof e?r:n)},$=function(t,e){function n(){delete this[t]}function r(){this[t]=e}function i(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}return arguments.length<2?this.node()[t]:this.each(null==e?n:"function"==typeof e?i:r)},B=function(t,e,n){function r(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,e,n)}function o(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}var a=arguments.length;return 2>a?v(a=this.node()).getComputedStyle(a,null).getPropertyValue(t):(3>a&&(n=""),this.each(null==e?r:"function"==typeof e?o:i))},V=function(t,e){function n(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function a(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}function u(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}if(t=L(t),arguments.length<2){var s=this.node();return t.local?s.getAttributeNS(t.space,t.local):s.getAttribute(t)}return this.each(null==e?t.local?r:n:"function"==typeof e?t.local?u:a:t.local?o:i)},q=function(t){function e(n,i){var o,a=-1,u=n.length;if(--i)for(var s=2*i,c=s+1;++a<u;)(o=n[a])&&(r[s]=o._parent.__data__,r[c]=a,e(o,i));else for(;++a<u;)(o=n[a])&&(r[0]=o.__data__,r[1]=a,t.apply(o,r))}var n=this._depth,r=new Array(n);return e(this._root,n),this},X=function(){return!this.node()},z=function(){var t=0;return this.each(function(){++t}),t},I=function(){return s(this._root,this._depth)},Y=function(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t},j=function(){var t=arguments[0];return t.apply(arguments[0]=this,arguments),this},k=function(t){return t._root=c(t._root,t._depth)},G=function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}function n(t,r){if(--r)for(var i,o=-1,a=t.length;++o<a;)(i=t[o])&&n(i,r);else t.sort(e)}return t||(t=h),n(k(this),this._depth),this.order()},H=function(){return l(this._root,this._depth),this},O=function(e){return new t(f(k(e),e._depth),e._depth)},U=function(){return this._exit||(this._exit=O(this))},K=function(){return this._enter||(this._enter=O(this),this._enter._update=this),this._enter};p.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e||this._next)}};var W=function(t,e){function n(e,r,i,o){var a,u,h=-1;if(o--){var l=2*o,f=l+1;for(a=e.length;++h<a;)(u=e[h])&&(s[l]=u._parent.__data__,s[f]=h,n(u,r[h],i[h],o))}else{var p,_=0;for(c(e,r,i,t.apply(e._parent,s)),a=e.length;++h<a;)if(p=r[h]){for(h>=_&&(_=h+1);!(u=e[_])&&++_<a;);p._next=u||null}}}function r(t,e,n,r){var i,o=0,a=t.length,u=r.length,s=Math.min(a,u);for(e.length=0,e.length=u,n.length=0,n.length=a;s>o;++o)(i=t[o])?i.__data__=r[o]:e[o]=new p(t._parent,r[o]);for(;u>o;++o)e[o]=new p(t._parent,r[o]);for(;a>o;++o)(i=t[o])&&(n[o]=t[o]);t.length=u}function i(t,n,r,i){var o,a,u,c=i.length,h=t.length,l=new Map,f=new Array(2).concat(s),_=new Array(h);for(n.length=0,n.length=c,r.length=0,r.length=h,o=0;h>o;++o)(a=t[o])&&(f[0]=a.__data__,f[1]=o,_[o]=u=e.apply(a,f),l.has(u)?r[o]=a:l.set(u,a));for(t.length=0,t.length=c,o=0;c>o;++o)f[0]=i[o],f[1]=o,u=e.apply(t._parent,f),(a=l.get(u))?a!==!0&&(t[o]=a,a.__data__=i[o]):n[o]=new p(t._parent,i[o]),l.set(u,!0);for(o=0;h>o;++o)(a=l.get(_[o]))!==!0&&(r[o]=a)}if(!t){var o=new Array(this.size()),a=-1;return this.each(function(t){o[++a]=t}),o}var u=this._depth-1,s=new Array(2*u),c=e?i:r;return"function"!=typeof t&&(t=_(t)),n(this._root,this.enter()._root,this.exit()._root,u),this},F=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var J=document.documentElement;if(!J.matches){var Q=J.webkitMatchesSelector||J.msMatchesSelector||J.mozMatchesSelector||J.oMatchesSelector;F=function(t){return function(){return Q.call(this,t)}}}}var Z=function(e){function n(t,r){var o,a,u=-1,s=t.length;if(--r){var c=2*r,h=c+1;for(a=new Array(s);++u<s;)(o=t[u])&&(i[c]=o._parent.__data__,i[h]=u,a[u]=n(o,r))}else for(a=[];++u<s;)(o=t[u])&&(i[0]=o.__data__,i[1]=u,e.apply(o,i)&&a.push(o));return a._parent=t._parent,a}var r=this._depth,i=new Array(2*r);return"function"!=typeof e&&(e=F(e)),new t(n(this._root,r),r)},tt=function(e){function n(t,r){var o,a,u=-1,s=t.length,c=new Array(s);if(--r)for(var h=2*r,l=h+1;++u<s;)(o=t[u])&&(i[h]=o._parent.__data__,i[l]=u,c[u]=n(o,r));else for(;++u<s;)(o=t[u])&&(i[0]=o.__data__,i[1]=u,c[u]=a=e.apply(o,i),a._parent=o);return c._parent=t._parent,c}var r=this._depth,i=new Array(2*r);return"function"!=typeof e&&(e=d(e)),new t(n(this._root,r),r+1)},et=function(e){function n(t,r,o){var a,u,s=-1,c=t.length,h=new Array(c);if(--o)for(var l=2*o,f=l+1;++s<c;)(a=t[s])&&(i[l]=a._parent.__data__,i[f]=s,h[s]=n(a,r&&r[s],o));else for(;++s<c;)(a=t[s])&&(i[0]=a.__data__,i[1]=s,(u=e.apply(a,i))&&("__data__"in a&&(u.__data__=a.__data__),r&&(r[s]=u,delete t[s]),h[s]=u));return h._parent=t._parent,h}var r=this._depth,i=new Array(2*r);return"function"!=typeof e&&(e=C(e)),new t(n(this._root,this._update&&this._update._root,r),r)};t.prototype=g.prototype={select:et,selectAll:tt,filter:Z,data:W,enter:K,exit:U,order:H,sort:G,call:j,nodes:Y,node:I,size:z,empty:X,each:q,attr:V,style:B,property:$,"class":R,classed:R,text:D,html:P,append:N,insert:N,remove:M,datum:E,event:S,on:S,dispatch:y};var nt=function(e){return new t(["string"==typeof e?document.querySelector(e):e],1)},rt=function(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();if(0>m){var i=v(t);if(i.scrollX||i.scrollY){n=nt(i.document.body).append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=n.node().getScreenCTM();m=!(o.f||o.e),n.remove()}}return m?(r.x=e.pageX,r.y=e.pageY):(r.x=e.clientX,r.y=e.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]},it=function(){for(var t,e=x;t=e.sourceEvent;)e=t;return e},ot=function(t,e){arguments.length<2&&(e=it().touches);for(var n=0,r=e?e.length:0,i=new Array(r);r>n;++n)i[n]=rt(t,e[n]);return i},at=function(t,e,n){arguments.length<3&&(n=e,e=it().changedTouches);for(var r,i=0,o=e?e.length:0;o>i;++i)if((r=e[i]).identifier===n)return rt(t,r);return null},ut=function(e){return new t("string"==typeof e?document.querySelectorAll(e):e,1)},st=function(t,e){return arguments.length<2&&(e=it()),e.changedTouches&&(e=e.changedTouches[0]),rt(t,e)},ct={get event(){return x},mouse:st,namespace:L,namespaces:T,requote:A,select:nt,selectAll:ut,selection:g,touch:at,touches:ot};return ct});
"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(t,e){return this._[t]=e,this},get:function(t){return this._[t]},has:function(t){return t in this._},"delete":function(t){return t in this._&&delete this._[t]},clear:function(){this._=Object.create(null)},get size(){var t=0;for(var e in this._)++t;return t},forEach:function(t){for(var e in this._)t(this._[e],e,this)}}):function(){var t=new Map;t.set(0,0)!==t&&(t=t.set,Map.prototype.set=function(){return t.apply(this,arguments),this})}(),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.d3=e()}(this,function(){"use strict";function t(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function e(t,e){function r(){return n(this,t,e)}function i(){return n(this,t,e.apply(this,arguments))}return this.each("function"==typeof e?i:r)}function n(e,n,r){var i=t(e),o=i.CustomEvent;o?o=new o(n,r):(o=i.document.createEvent("Event"),r?(o.initEvent(n,r.bubbles,r.cancelable),o.detail=r.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function r(t){return t.replace(nt,"\\$&")}function i(t,e,n){function i(){for(var r=p,i=arguments.length>>1,u=new Array(i);--i>=0;)r=r[arguments[(i<<1)+1]],u[i]=i?r._parent:r;var c=o(e,u,arguments);h&&(c=a(c)),s.call(this),this.addEventListener(t,this[l]=c,c._capture=n),c._listener=e}function s(){var e=this[l];e&&(this.removeEventListener(t,e,e._capture),delete this[l])}function c(){var e,n=new RegExp("^__on([^.]+)"+r(t)+"$");for(var i in this)if(e=i.match(n)){var o=this[i];this.removeEventListener(e[1],o,o._capture),delete this[i]}}var h,f=arguments.length,l="__on"+t,p=this._root;return 2>f?(f=this.node()[l])&&f._listener:(3>f&&(n=!1),(f=t.indexOf("."))>0&&(t=t.slice(0,f)),(h=rt.has(t))&&(t=rt.get(t)),this.each(e?f?i:u:f?s:c))}function o(t,e,n){return function(r){for(var i=e.length,o=it;--i>=0;)n[i<<1]=e[i].__data__;it=r;try{t.apply(e[0],n)}finally{it=o}}}function a(t){return function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t(e)}}function u(){}function s(t){return arguments.length?this.property("__data__",t):this.node().__data__}function c(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})}function h(t){return function(){return this.querySelector(t)}}function f(t){var e=t.indexOf(":"),n=t;return e>=0&&(n=t.slice(0,e),t=t.slice(e+1)),at.has(n)?{space:at.get(n),local:t}:t}function l(t,e){function n(){return this.appendChild(t.apply(this,arguments))}function r(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)}return"function"!=typeof t&&(t=p(t)),this.select(arguments.length<2?n:("function"!=typeof e&&(e=h(e)),r))}function p(t){function e(){var e=this.ownerDocument,n=this.namespaceURI;return n?e.createElementNS(n,t):e.createElement(t)}function n(){return this.ownerDocument.createElementNS(t.space,t.local)}return t=f(t),t.local?n:e}function _(t){function e(){this.innerHTML=t}function n(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().innerHTML}function d(t){function e(){this.textContent=t}function n(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().textContent}function g(t,e){function n(){for(var n=-1;++n<i;)t[n](this,e)}function r(){for(var n=-1,r=e.apply(this,arguments);++n<i;)t[n](this,r)}t=(t+"").trim().split(/^|\s+/);var i=t.length;if(arguments.length<2){var o=this.node(),a=-1;if(e=o.classList){for(;++a<i;)if(!e.contains(t[a]))return!1}else for(e=o.getAttribute("class");++a<i;)if(!y(t[a]).test(e))return!1;return!0}return t=t.map(m),this.each("function"==typeof e?r:n)}function m(t){var e;return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);e||(e=y(t));var i=n.getAttribute("class")||"";r?(e.lastIndex=0,e.test(i)||n.setAttribute("class",v(i+" "+t))):n.setAttribute("class",v(i.replace(e," ")))}}function v(t){return t.trim().replace(/\s+/g," ")}function y(t){return new RegExp("(?:^|\\s+)"+r(t)+"(?:\\s+|$)","g")}function w(t,e){function n(){delete this[t]}function r(){this[t]=e}function i(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}return arguments.length<2?this.node()[t]:this.each(null==e?n:"function"==typeof e?i:r)}function A(e,n,r){function i(){this.style.removeProperty(e)}function o(){this.style.setProperty(e,n,r)}function a(){var t=n.apply(this,arguments);null==t?this.style.removeProperty(e):this.style.setProperty(e,t,r)}var u=arguments.length;return 2>u?t(u=this.node()).getComputedStyle(u,null).getPropertyValue(e):(3>u&&(r=""),this.each(null==n?i:"function"==typeof n?a:o))}function x(t,e){function n(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function a(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}function u(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}if(t=f(t),arguments.length<2){var s=this.node();return t.local?s.getAttributeNS(t.space,t.local):s.getAttribute(t)}return this.each(null==e?t.local?r:n:"function"==typeof e?t.local?u:a:t.local?o:i)}function b(t){function e(n,i){var o,a=-1,u=n.length;if(--i)for(var s=2*i,c=s+1;++a<u;)(o=n[a])&&(r[s]=o._parent.__data__,r[c]=a,e(o,i));else for(;++a<u;)(o=n[a])&&(r[0]=o.__data__,r[1]=a,t.apply(o,r))}var n=this._depth,r=new Array(n);return e(this._root,n),this}function S(){return!this.node()}function E(){var t=0;return this.each(function(){++t}),t}function M(){return C(this._root,this._depth)}function C(t,e){var n,r=-1,i=t.length;if(--e){for(;++r<i;)if((n=t[r])&&(n=C(n,e)))return n}else for(;++r<i;)if(n=t[r])return n}function N(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t}function T(){var t=arguments[0];return t.apply(arguments[0]=this,arguments),this}function L(t){return t._root=P(t._root,t._depth)}function P(t,e){var n,r=-1,i=t.length;if(--e)for(;++r<i;)(n=t[r])&&(t[r]=P(n,e));else if(!Array.isArray(t)){for(var o=new Array(i);++r<i;)o[r]=t[r];o._parent=t._parent,t=o}return t}function D(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}function n(t,r){if(--r)for(var i,o=-1,a=t.length;++o<a;)(i=t[o])&&n(i,r);else t.sort(e)}return t||(t=V),n(L(this),this._depth),this.order()}function V(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function j(){return B(this._root,this._depth),this}function B(t,e){var n,r,i=t.length;if(--e)for(;--i>=0;)(n=t[i])&&B(n,e);else for(r=t[--i];--i>=0;)(n=t[i])&&(r&&r!==n.nextSibling&&r.parentNode.insertBefore(n,r),r=n)}function R(t){return new U(q(L(t),t._depth),t._depth)}function q(t,e){var n,r=-1,i=t.length,o=new Array(i);if(--e)for(;++r<i;)(n=t[r])&&(o[r]=q(n,e));return o._parent=t._parent,o}function O(){return this._exit||(this._exit=R(this))}function X(){return this._enter||(this._enter=R(this),this._enter._update=this),this._enter}function z(t,e){function n(e,r,i,o){var a,u,h=-1;if(o--){var f=2*o,l=f+1;for(a=e.length;++h<a;)(u=e[h])&&(s[f]=u._parent.__data__,s[l]=h,n(u,r[h],i[h],o))}else{var p,_=0;for(c(e,r,i,t.apply(e._parent,s)),a=e.length;++h<a;)if(p=r[h]){for(h>=_&&(_=h+1);!(u=e[_])&&++_<a;);p._next=u||null}}}function r(t,e,n,r){var i,o=0,a=t.length,u=r.length,s=Math.min(a,u);for(e.length=0,e.length=u,n.length=0,n.length=a;s>o;++o)(i=t[o])?i.__data__=r[o]:e[o]=new I(t._parent,r[o]);for(;u>o;++o)e[o]=new I(t._parent,r[o]);for(;a>o;++o)(i=t[o])&&(n[o]=t[o]);t.length=u}function i(t,n,r,i){var o,a,u,c=i.length,h=t.length,f=new Map,l=new Array(2).concat(s),p=new Array(h);for(n.length=0,n.length=c,r.length=0,r.length=h,o=0;h>o;++o)(a=t[o])&&(l[0]=a.__data__,l[1]=o,p[o]=u=e.apply(a,l),f.has(u)?r[o]=a:f.set(u,a));for(t.length=0,t.length=c,o=0;c>o;++o)l[0]=i[o],l[1]=o,u=e.apply(t._parent,l),(a=f.get(u))?a!==!0&&(t[o]=a,a.__data__=i[o]):n[o]=new I(t._parent,i[o]),f.set(u,!0);for(o=0;h>o;++o)(a=f.get(p[o]))!==!0&&(r[o]=a)}if(!t){var o=new Array(this.size()),a=-1;return this.each(function(t){o[++a]=t}),o}var u=this._depth-1,s=new Array(2*u),c=e?i:r;return"function"!=typeof t&&(t=Y(t)),n(this._root,this.enter()._root,this.exit()._root,u),this}function I(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function Y(t){return function(){return t}}function $(t){function e(n,i){var o,a,u=-1,s=n.length;if(--i){var c=2*i,h=c+1;for(a=new Array(s);++u<s;)(o=n[u])&&(r[c]=o._parent.__data__,r[h]=u,a[u]=e(o,i))}else for(a=[];++u<s;)(o=n[u])&&(r[0]=o.__data__,r[1]=u,t.apply(o,r)&&a.push(o));return a._parent=n._parent,a}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=ut(t)),new U(e(this._root,n),n)}function k(t){function e(n,i){var o,a,u=-1,s=n.length,c=new Array(s);if(--i)for(var h=2*i,f=h+1;++u<s;)(o=n[u])&&(r[h]=o._parent.__data__,r[f]=u,c[u]=e(o,i));else for(;++u<s;)(o=n[u])&&(r[0]=o.__data__,r[1]=u,c[u]=a=t.apply(o,r),a._parent=o);return c._parent=n._parent,c}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=G(t)),new U(e(this._root,n),n+1)}function G(t){return function(){return this.querySelectorAll(t)}}function H(t){function e(n,i,o){var a,u,s=-1,c=n.length,h=new Array(c);if(--o)for(var f=2*o,l=f+1;++s<c;)(a=n[s])&&(r[f]=a._parent.__data__,r[l]=s,h[s]=e(a,i&&i[s],o));else for(;++s<c;)(a=n[s])&&(r[0]=a.__data__,r[1]=s,(u=t.apply(a,r))&&("__data__"in a&&(u.__data__=a.__data__),i&&(i[s]=u,delete n[s]),h[s]=u));return h._parent=n._parent,h}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=h(t)),new U(e(this._root,this._update&&this._update._root,n),n)}function U(t,e){this._root=t,this._depth=e,this._enter=this._update=this._exit=null}function K(){return new U([document.documentElement],1)}function W(t){return new U(["string"==typeof t?document.querySelector(t):t],1)}function F(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();if(0>ht){var i=defaultView(t);if(i.scrollX||i.scrollY){n=W(i.document.body).append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=n.node().getScreenCTM();ht=!(o.f||o.e),n.remove()}}return ht?(r.x=e.pageX,r.y=e.pageY):(r.x=e.clientX,r.y=e.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}function J(){for(var t,e=it;t=e.sourceEvent;)e=t;return e}function Q(t,e){arguments.length<2&&(e=J().touches);for(var n=0,r=e?e.length:0,i=new Array(r);r>n;++n)i[n]=F(t,e[n]);return i}function Z(t,e,n){arguments.length<3&&(n=e,e=J().changedTouches);for(var r,i=0,o=e?e.length:0;o>i;++i)if((r=e[i]).identifier===n)return F(t,r);return null}function tt(t){return new U("string"==typeof t?document.querySelectorAll(t):t,1)}function et(t,e){return arguments.length<2&&(e=J()),e.changedTouches&&(e=e.changedTouches[0]),F(t,e)}var nt=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,rt=new Map,it=null;if("undefined"!=typeof document){var ot=document.documentElement;"onmouseenter"in ot||rt.set("mouseenter","mouseover").set("mouseleave","mouseout")}var at=(new Map).set("svg","http://www.w3.org/2000/svg").set("xhtml","http://www.w3.org/1999/xhtml").set("xlink","http://www.w3.org/1999/xlink").set("xml","http://www.w3.org/XML/1998/namespace").set("xmlns","http://www.w3.org/2000/xmlns/");I.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e||this._next)}};var ut=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var st=document.documentElement;if(!st.matches){var ct=st.webkitMatchesSelector||st.msMatchesSelector||st.mozMatchesSelector||st.oMatchesSelector;ut=function(t){return function(){return ct.call(this,t)}}}}U.prototype=K.prototype={select:H,selectAll:k,filter:$,data:z,enter:X,exit:O,order:j,sort:D,call:T,nodes:N,node:M,size:E,empty:S,each:b,attr:x,style:A,property:w,"class":g,classed:g,text:d,html:_,append:l,insert:l,remove:c,datum:s,event:i,on:i,dispatch:e};var ht="undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,ft={get event(){return it},mouse:et,namespace:f,namespaces:at,requote:r,select:W,selectAll:tt,selection:K,touch:Z,touches:Q};return ft});
{
"name": "d3-selection",
"version": "0.4.7",
"version": "0.4.8",
"description": "Data-driven DOM manipulation: select elements and join them to data.",

@@ -33,4 +33,4 @@ "keywords": [

"tape": "4",
"uglifyjs": "2"
"uglify-js": "2"
}
}

@@ -37,3 +37,3 @@ import requote from "./requote";

if (c = node.classList) return value ? c.add(name) : c.remove(name);
if (!re) re = new RegExp("(?:^|\\s+)" + requote(name) + "(?:\\s+|$)", "g");
if (!re) re = classedRe(name);
var c = node.getAttribute("class") || "";

@@ -52,1 +52,5 @@ if (value) {

}
function classedRe(name) {
return new RegExp("(?:^|\\s+)" + requote(name) + "(?:\\s+|$)", "g");
}
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