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

d3-transition

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-transition - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

126

build/d3-transition.js

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

// https://d3js.org/d3-transition/ Version 1.0.2. Copyright 2016 Mike Bostock.
// https://d3js.org/d3-transition/ Version 1.0.3. Copyright 2016 Mike Bostock.
(function (global, factory) {

@@ -19,3 +19,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-selection'), require('d3-dispatch'), require('d3-timer'), require('d3-interpolate'), require('d3-color'), require('d3-ease')) :

function schedule(node, name, id, index, group, timing) {
var schedule = function(node, name, id, index, group, timing) {
var schedules = node.__transition;

@@ -37,3 +37,3 @@ if (!schedules) node.__transition = {};

});
}
};

@@ -163,3 +163,3 @@ function init(node, id) {

function interrupt(node, name) {
var interrupt = function(node, name) {
var schedules = node.__transition,

@@ -177,3 +177,3 @@ schedule,

if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
active = schedule.state === STARTED;
active = schedule.state > STARTING && schedule.state < ENDING;
schedule.state = ENDED;

@@ -186,9 +186,9 @@ schedule.timer.stop();

if (empty) delete node.__transition;
}
};
function selection_interrupt(name) {
var selection_interrupt = function(name) {
return this.each(function() {
interrupt(this, name);
});
}
};

@@ -244,3 +244,3 @@ function tweenRemove(id, name) {

function transition_tween(name, value) {
var transition_tween = function(name, value) {
var id = this._id;

@@ -261,3 +261,3 @@

return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
}
};

@@ -277,3 +277,3 @@ function tweenValue(transition, name, value) {

function interpolate(a, b) {
var interpolate = function(a, b) {
var c;

@@ -284,3 +284,3 @@ return (typeof b === "number" ? d3Interpolate.interpolateNumber

: d3Interpolate.interpolateString)(a, b);
}
};

@@ -299,3 +299,3 @@ function attrRemove(name) {

function attrConstant(name, interpolate, value1) {
function attrConstant(name, interpolate$$1, value1) {
var value00,

@@ -307,7 +307,7 @@ interpolate0;

: value0 === value00 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value1);
: interpolate0 = interpolate$$1(value00 = value0, value1);
};
}
function attrConstantNS(fullname, interpolate, value1) {
function attrConstantNS(fullname, interpolate$$1, value1) {
var value00,

@@ -319,7 +319,7 @@ interpolate0;

: value0 === value00 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value1);
: interpolate0 = interpolate$$1(value00 = value0, value1);
};
}
function attrFunction(name, interpolate, value) {
function attrFunction(name, interpolate$$1, value) {
var value00,

@@ -334,7 +334,7 @@ value10,

: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
: interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
};
}
function attrFunctionNS(fullname, interpolate, value) {
function attrFunctionNS(fullname, interpolate$$1, value) {
var value00,

@@ -349,7 +349,7 @@ value10,

: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
: interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
};
}
function transition_attr(name, value) {
var transition_attr = function(name, value) {
var fullname = d3Selection.namespace(name), i = fullname === "transform" ? d3Interpolate.interpolateTransformSvg : interpolate;

@@ -360,3 +360,3 @@ return this.attrTween(name, typeof value === "function"

: (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
}
};

@@ -385,3 +385,3 @@ function attrTweenNS(fullname, value) {

function transition_attrTween(name, value) {
var transition_attrTween = function(name, value) {
var key = "attr." + name;

@@ -393,3 +393,3 @@ if (arguments.length < 2) return (key = this.tween(key)) && key._value;

return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
}
};

@@ -408,3 +408,3 @@ function delayFunction(id, value) {

function transition_delay(value) {
var transition_delay = function(value) {
var id = this._id;

@@ -417,3 +417,3 @@

: get(this.node(), id).delay;
}
};

@@ -432,3 +432,3 @@ function durationFunction(id, value) {

function transition_duration(value) {
var transition_duration = function(value) {
var id = this._id;

@@ -441,3 +441,3 @@

: get(this.node(), id).duration;
}
};

@@ -451,3 +451,3 @@ function easeConstant(id, value) {

function transition_ease(value) {
var transition_ease = function(value) {
var id = this._id;

@@ -458,5 +458,5 @@

: get(this.node(), id).ease;
}
};
function transition_filter(match) {
var transition_filter = function(match) {
if (typeof match !== "function") match = d3Selection.matcher(match);

@@ -473,5 +473,5 @@

return new Transition(subgroups, this._parents, this._name, this._id);
}
};
function transition_merge(transition) {
var transition_merge = function(transition) {
if (transition._id !== this._id) throw new Error;

@@ -492,3 +492,3 @@

return new Transition(merges, this._parents, this._name, this._id);
}
};

@@ -518,3 +518,3 @@ function start(name) {

function transition_on(name, listener) {
var transition_on = function(name, listener) {
var id = this._id;

@@ -525,3 +525,3 @@

: this.each(onFunction(id, name, listener));
}
};

@@ -536,7 +536,7 @@ function removeFunction(id) {

function transition_remove() {
var transition_remove = function() {
return this.on("end.remove", removeFunction(this._id));
}
};
function transition_select(select) {
var transition_select = function(select) {
var name = this._name,

@@ -558,5 +558,5 @@ id = this._id;

return new Transition(subgroups, this._parents, name, id);
}
};
function transition_selectAll(select) {
var transition_selectAll = function(select) {
var name = this._name,

@@ -582,11 +582,11 @@ id = this._id;

return new Transition(subgroups, parents, name, id);
}
};
var Selection = d3Selection.selection.prototype.constructor;
function transition_selection() {
var transition_selection = function() {
return new Selection(this._groups, this._parents);
}
};
function styleRemove(name, interpolate) {
function styleRemove(name, interpolate$$1) {
var value00,

@@ -601,3 +601,3 @@ value10,

: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
: interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
};

@@ -612,3 +612,3 @@ }

function styleConstant(name, interpolate, value1) {
function styleConstant(name, interpolate$$1, value1) {
var value00,

@@ -620,7 +620,7 @@ interpolate0;

: value0 === value00 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value1);
: interpolate0 = interpolate$$1(value00 = value0, value1);
};
}
function styleFunction(name, interpolate, value) {
function styleFunction(name, interpolate$$1, value) {
var value00,

@@ -636,7 +636,7 @@ value10,

: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
: interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
};
}
function transition_style(name, value, priority) {
var transition_style = function(name, value, priority) {
var i = (name += "") === "transform" ? d3Interpolate.interpolateTransformCss : interpolate;

@@ -649,3 +649,3 @@ return value == null ? this

: styleConstant(name, i, value), priority);
}
};

@@ -663,3 +663,3 @@ function styleTween(name, value, priority) {

function transition_styleTween(name, value, priority) {
var transition_styleTween = function(name, value, priority) {
var key = "style." + (name += "");

@@ -670,3 +670,3 @@ if (arguments.length < 2) return (key = this.tween(key)) && key._value;

return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
}
};

@@ -686,9 +686,9 @@ function textConstant(value) {

function transition_text(value) {
var transition_text = function(value) {
return this.tween("text", typeof value === "function"
? textFunction(tweenValue(this, "text", value))
: textConstant(value == null ? "" : value + ""));
}
};
function transition_transition() {
var transition_transition = function() {
var name = this._name,

@@ -713,3 +713,3 @@ id0 = this._id,

return new Transition(groups, this._parents, name, id1);
}
};

@@ -779,3 +779,3 @@ var id = 0;

function selection_transition(name) {
var selection_transition = function(name) {
var id,

@@ -799,3 +799,3 @@ timing;

return new Transition(groups, this._parents, name, id);
}
};

@@ -807,3 +807,3 @@ d3Selection.selection.prototype.interrupt = selection_interrupt;

function active(node, name) {
var active = function(node, name) {
var schedules = node.__transition,

@@ -823,3 +823,3 @@ schedule,

return null;
}
};

@@ -832,2 +832,2 @@ exports.transition = transition;

})));
})));

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

// https://d3js.org/d3-transition/ Version 1.0.2. Copyright 2016 Mike Bostock.
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-dispatch"),require("d3-timer"),require("d3-interpolate"),require("d3-color"),require("d3-ease")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch","d3-timer","d3-interpolate","d3-color","d3-ease"],n):n(t.d3=t.d3||{},t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(this,function(t,n,e,r,i,o,u){"use strict";function a(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};c(t,e,{name:n,index:r,group:i,on:ft,tween:ct,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:ht})}function s(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>ht)throw new Error("too late");return e}function l(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>pt)throw new Error("too late");return e}function f(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function c(t,n,e){function i(t){e.state=dt,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)}function o(i){var f,c,h,d;if(e.state!==dt)return a();for(f in l)if(d=l[f],d.name===e.name){if(d.state===_t)return r.timeout(o);d.state===vt?(d.state=mt,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete l[f]):+f<n&&(d.state=mt,d.timer.stop(),delete l[f])}if(r.timeout(function(){e.state===_t&&(e.state=vt,e.timer.restart(u,e.delay,e.time),u(i))}),e.state=pt,e.on.call("start",t,t.__data__,e.index,e.group),e.state===pt){for(e.state=_t,s=new Array(h=e.tween.length),f=0,c=-1;f<h;++f)(d=e.tween[f].value.call(t,t.__data__,e.index,e.group))&&(s[++c]=d);s.length=c+1}}function u(n){for(var r=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(a),e.state=yt,1),i=-1,o=s.length;++i<o;)s[i].call(null,r);e.state===yt&&(e.on.call("end",t,t.__data__,e.index,e.group),a())}function a(){e.state=mt,e.timer.stop(),delete l[n];for(var r in l)return;delete t.__transition}var s,l=t.__transition;l[n]=e,e.timer=r.timer(i,0,e.time)}function h(t,n){var e,r,i,o=t.__transition,u=!0;if(o){n=null==n?null:n+"";for(i in o)(e=o[i]).name===n?(r=e.state===_t,e.state=mt,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):u=!1;u&&delete t.__transition}}function d(t){return this.each(function(){h(this,t)})}function p(t,n){var e,r;return function(){var i=l(this,t),o=i.tween;if(o!==e){r=e=o;for(var u=0,a=r.length;u<a;++u)if(r[u].name===n){r=r.slice(),r.splice(u,1);break}}i.tween=r}}function _(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=l(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},s=0,f=i.length;s<f;++s)if(i[s].name===n){i[s]=a;break}s===f&&i.push(a)}o.tween=i}}function v(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=f(this.node(),e).tween,o=0,u=i.length;o<u;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?p:_)(e,t,n))}function y(t,n,e){var r=t._id;return t.each(function(){var t=l(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return f(t,r).value[n]}}function m(t,n){var e;return("number"==typeof n?i.interpolateNumber:n instanceof o.color?i.interpolateRgb:(e=o.color(n))?(n=e,i.interpolateRgb):i.interpolateString)(t,n)}function g(t){return function(){this.removeAttribute(t)}}function w(t){return function(){this.removeAttributeNS(t.space,t.local)}}function b(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}}function A(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}function x(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttribute(t):(u=this.getAttribute(t),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function P(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttributeNS(t.space,t.local):(u=this.getAttributeNS(t.space,t.local),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function S(t,e){var r=n.namespace(t),o="transform"===r?i.interpolateTransformSvg:m;return this.attrTween(t,"function"==typeof e?(r.local?P:x)(r,o,y(this,"attr."+t,e)):null==e?(r.local?w:g)(r):(r.local?A:b)(r,o,e))}function C(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}function E(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e}function N(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var i=n.namespace(t);return this.tween(r,(i.local?C:E)(i,e))}function T(t,n){return function(){s(this,t).delay=+n.apply(this,arguments)}}function q(t,n){return n=+n,function(){s(this,t).delay=n}}function V(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?T:q)(n,t)):f(this.node(),n).delay}function O(t,n){return function(){l(this,t).duration=+n.apply(this,arguments)}}function j(t,n){return n=+n,function(){l(this,t).duration=n}}function k(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?O:j)(n,t)):f(this.node(),n).duration}function z(t,n){if("function"!=typeof n)throw new Error;return function(){l(this,t).ease=n}}function M(t){var n=this._id;return arguments.length?this.each(z(n,t)):f(this.node(),n).ease}function R(t){"function"!=typeof t&&(t=n.matcher(t));for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o)for(var u,a=e[o],s=a.length,l=i[o]=[],f=0;f<s;++f)(u=a[f])&&t.call(u,u.__data__,f,a)&&l.push(u);return new it(i,this._parents,this._name,this._id)}function I(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,l=n[a],f=e[a],c=l.length,h=u[a]=new Array(c),d=0;d<c;++d)(s=l[d]||f[d])&&(h[d]=s);for(;a<r;++a)u[a]=n[a];return new it(u,this._parents,this._name,this._id)}function B(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}function D(t,n,e){var r,i,o=B(n)?s:l;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}function F(t,n){var e=this._id;return arguments.length<2?f(this.node(),e).on.on(t):this.each(D(e,t,n))}function G(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function H(){return this.on("end.remove",G(this._id))}function J(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=n.selector(t));for(var i=this._groups,o=i.length,u=new Array(o),s=0;s<o;++s)for(var l,c,h=i[s],d=h.length,p=u[s]=new Array(d),_=0;_<d;++_)(l=h[_])&&(c=t.call(l,l.__data__,_,h))&&("__data__"in l&&(c.__data__=l.__data__),p[_]=c,a(p[_],e,r,_,p,f(l,r)));return new it(u,this._parents,e,r)}function K(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=n.selectorAll(t));for(var i=this._groups,o=i.length,u=[],s=[],l=0;l<o;++l)for(var c,h=i[l],d=h.length,p=0;p<d;++p)if(c=h[p]){for(var _,v=t.call(c,c.__data__,p,h),y=f(c,r),m=0,g=v.length;m<g;++m)(_=v[m])&&a(_,e,r,m,v,y);u.push(v),s.push(c)}return new it(u,s,e,r)}function L(){return new gt(this._groups,this._parents)}function Q(t,e){var r,i,o;return function(){var u=n.window(this).getComputedStyle(this,null),a=u.getPropertyValue(t),s=(this.style.removeProperty(t),u.getPropertyValue(t));return a===s?null:a===r&&s===i?o:o=e(r=a,i=s)}}function U(t){return function(){this.style.removeProperty(t)}}function W(t,e,r){var i,o;return function(){var u=n.window(this).getComputedStyle(this,null).getPropertyValue(t);return u===r?null:u===i?o:o=e(i=u,r)}}function X(t,e,r){var i,o,u;return function(){var a=n.window(this).getComputedStyle(this,null),s=a.getPropertyValue(t),l=r(this);return null==l&&(this.style.removeProperty(t),l=a.getPropertyValue(t)),s===l?null:s===i&&l===o?u:u=e(i=s,o=l)}}function Y(t,n,e){var r="transform"==(t+="")?i.interpolateTransformCss:m;return null==n?this.styleTween(t,Q(t,r)).on("end.style."+t,U(t)):this.styleTween(t,"function"==typeof n?X(t,r,y(this,"style."+t,n)):W(t,r,n),e)}function Z(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}function $(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,Z(t,n,null==e?"":e))}function tt(t){return function(){this.textContent=t}}function nt(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function et(t){return this.tween("text","function"==typeof t?nt(y(this,"text",t)):tt(null==t?"":t+""))}function rt(){for(var t=this._name,n=this._id,e=ut(),r=this._groups,i=r.length,o=0;o<i;++o)for(var u,s=r[o],l=s.length,c=0;c<l;++c)if(u=s[c]){var h=f(u,n);a(u,t,e,c,s,{time:h.time+h.delay+h.duration,delay:0,duration:h.duration,ease:h.ease})}return new it(r,this._parents,t,e)}function it(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function ot(t){return n.selection().transition(t)}function ut(){return++wt}function at(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return At.time=r.now(),At;return e}function st(t){var n,e;t instanceof it?(n=t._id,t=t._name):(n=ut(),(e=At).time=r.now(),t=null==t?null:t+"");for(var i=this._groups,o=i.length,u=0;u<o;++u)for(var s,l=i[u],f=l.length,c=0;c<f;++c)(s=l[c])&&a(s,t,n,c,l,e||at(s,n));return new it(i,this._parents,t,n)}function lt(t,n){var e,r,i=t.__transition;if(i){n=null==n?null:n+"";for(r in i)if((e=i[r]).state>dt&&e.name===n)return new it([[t]],xt,n,+r)}return null}var ft=e.dispatch("start","end","interrupt"),ct=[],ht=0,dt=1,pt=2,_t=3,vt=4,yt=5,mt=6,gt=n.selection.prototype.constructor,wt=0,bt=n.selection.prototype;it.prototype=ot.prototype={constructor:it,select:J,selectAll:K,filter:R,merge:I,selection:L,transition:rt,call:bt.call,nodes:bt.nodes,node:bt.node,size:bt.size,empty:bt.empty,each:bt.each,on:F,attr:S,attrTween:N,style:Y,styleTween:$,text:et,remove:H,tween:v,delay:V,duration:k,ease:M};var At={time:null,delay:0,duration:250,ease:u.easeCubicInOut};n.selection.prototype.interrupt=d,n.selection.prototype.transition=st;var xt=[null];t.transition=ot,t.active=lt,t.interrupt=h,Object.defineProperty(t,"__esModule",{value:!0})});
// https://d3js.org/d3-transition/ Version 1.0.3. Copyright 2016 Mike Bostock.
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-dispatch"),require("d3-timer"),require("d3-interpolate"),require("d3-color"),require("d3-ease")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch","d3-timer","d3-interpolate","d3-color","d3-ease"],n):n(t.d3=t.d3||{},t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(this,function(t,n,e,r,i,o,u){"use strict";function a(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>H)throw new Error("too late");return e}function s(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>K)throw new Error("too late");return e}function l(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function f(t,n,e){function i(t){e.state=J,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)}function o(i){var f,c,h,d;if(e.state!==J)return a();for(f in l)if(d=l[f],d.name===e.name){if(d.state===L)return r.timeout(o);d.state===Q?(d.state=W,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete l[f]):+f<n&&(d.state=W,d.timer.stop(),delete l[f])}if(r.timeout(function(){e.state===L&&(e.state=Q,e.timer.restart(u,e.delay,e.time),u(i))}),e.state=K,e.on.call("start",t,t.__data__,e.index,e.group),e.state===K){for(e.state=L,s=new Array(h=e.tween.length),f=0,c=-1;f<h;++f)(d=e.tween[f].value.call(t,t.__data__,e.index,e.group))&&(s[++c]=d);s.length=c+1}}function u(n){for(var r=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(a),e.state=U,1),i=-1,o=s.length;++i<o;)s[i].call(null,r);e.state===U&&(e.on.call("end",t,t.__data__,e.index,e.group),a())}function a(){e.state=W,e.timer.stop(),delete l[n];for(var r in l)return;delete t.__transition}var s,l=t.__transition;l[n]=e,e.timer=r.timer(i,0,e.time)}function c(t,n){var e,r;return function(){var i=s(this,t),o=i.tween;if(o!==e){r=e=o;for(var u=0,a=r.length;u<a;++u)if(r[u].name===n){r=r.slice(),r.splice(u,1);break}}i.tween=r}}function h(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=s(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},l=0,f=i.length;l<f;++l)if(i[l].name===n){i[l]=a;break}l===f&&i.push(a)}o.tween=i}}function d(t,n,e){var r=t._id;return t.each(function(){var t=s(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return l(t,r).value[n]}}function p(t){return function(){this.removeAttribute(t)}}function _(t){return function(){this.removeAttributeNS(t.space,t.local)}}function v(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}}function y(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}function m(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttribute(t):(u=this.getAttribute(t),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function g(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttributeNS(t.space,t.local):(u=this.getAttributeNS(t.space,t.local),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function w(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}function b(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e}function A(t,n){return function(){a(this,t).delay=+n.apply(this,arguments)}}function x(t,n){return n=+n,function(){a(this,t).delay=n}}function P(t,n){return function(){s(this,t).duration=+n.apply(this,arguments)}}function S(t,n){return n=+n,function(){s(this,t).duration=n}}function C(t,n){if("function"!=typeof n)throw new Error;return function(){s(this,t).ease=n}}function E(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}function N(t,n,e){var r,i,o=E(n)?a:s;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}function T(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function q(t,e){var r,i,o;return function(){var u=n.window(this).getComputedStyle(this,null),a=u.getPropertyValue(t),s=(this.style.removeProperty(t),u.getPropertyValue(t));return a===s?null:a===r&&s===i?o:o=e(r=a,i=s)}}function V(t){return function(){this.style.removeProperty(t)}}function O(t,e,r){var i,o;return function(){var u=n.window(this).getComputedStyle(this,null).getPropertyValue(t);return u===r?null:u===i?o:o=e(i=u,r)}}function j(t,e,r){var i,o,u;return function(){var a=n.window(this).getComputedStyle(this,null),s=a.getPropertyValue(t),l=r(this);return null==l&&(this.style.removeProperty(t),l=a.getPropertyValue(t)),s===l?null:s===i&&l===o?u:u=e(i=s,o=l)}}function k(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}function z(t){return function(){this.textContent=t}}function M(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function R(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function I(t){return n.selection().transition(t)}function B(){return++mt}function D(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return wt.time=r.now(),wt;return e}var F=e.dispatch("start","end","interrupt"),G=[],H=0,J=1,K=2,L=3,Q=4,U=5,W=6,X=function(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};f(t,e,{name:n,index:r,group:i,on:F,tween:G,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:H})},Y=function(t,n){var e,r,i,o=t.__transition,u=!0;if(o){n=null==n?null:n+"";for(i in o)(e=o[i]).name===n?(r=e.state>K&&e.state<U,e.state=W,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):u=!1;u&&delete t.__transition}},Z=function(t){return this.each(function(){Y(this,t)})},$=function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=l(this.node(),e).tween,o=0,u=i.length;o<u;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?c:h)(e,t,n))},tt=function(t,n){var e;return("number"==typeof n?i.interpolateNumber:n instanceof o.color?i.interpolateRgb:(e=o.color(n))?(n=e,i.interpolateRgb):i.interpolateString)(t,n)},nt=function(t,e){var r=n.namespace(t),o="transform"===r?i.interpolateTransformSvg:tt;return this.attrTween(t,"function"==typeof e?(r.local?g:m)(r,o,d(this,"attr."+t,e)):null==e?(r.local?_:p)(r):(r.local?y:v)(r,o,e))},et=function(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var i=n.namespace(t);return this.tween(r,(i.local?w:b)(i,e))},rt=function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?A:x)(n,t)):l(this.node(),n).delay},it=function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?P:S)(n,t)):l(this.node(),n).duration},ot=function(t){var n=this._id;return arguments.length?this.each(C(n,t)):l(this.node(),n).ease},ut=function(t){"function"!=typeof t&&(t=n.matcher(t));for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o)for(var u,a=e[o],s=a.length,l=i[o]=[],f=0;f<s;++f)(u=a[f])&&t.call(u,u.__data__,f,a)&&l.push(u);return new R(i,this._parents,this._name,this._id)},at=function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,l=n[a],f=e[a],c=l.length,h=u[a]=new Array(c),d=0;d<c;++d)(s=l[d]||f[d])&&(h[d]=s);for(;a<r;++a)u[a]=n[a];return new R(u,this._parents,this._name,this._id)},st=function(t,n){var e=this._id;return arguments.length<2?l(this.node(),e).on.on(t):this.each(N(e,t,n))},lt=function(){return this.on("end.remove",T(this._id))},ft=function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=n.selector(t));for(var i=this._groups,o=i.length,u=new Array(o),a=0;a<o;++a)for(var s,f,c=i[a],h=c.length,d=u[a]=new Array(h),p=0;p<h;++p)(s=c[p])&&(f=t.call(s,s.__data__,p,c))&&("__data__"in s&&(f.__data__=s.__data__),d[p]=f,X(d[p],e,r,p,d,l(s,r)));return new R(u,this._parents,e,r)},ct=function(t){var e=this._name,r=this._id;"function"!=typeof t&&(t=n.selectorAll(t));for(var i=this._groups,o=i.length,u=[],a=[],s=0;s<o;++s)for(var f,c=i[s],h=c.length,d=0;d<h;++d)if(f=c[d]){for(var p,_=t.call(f,f.__data__,d,c),v=l(f,r),y=0,m=_.length;y<m;++y)(p=_[y])&&X(p,e,r,y,_,v);u.push(_),a.push(f)}return new R(u,a,e,r)},ht=n.selection.prototype.constructor,dt=function(){return new ht(this._groups,this._parents)},pt=function(t,n,e){var r="transform"==(t+="")?i.interpolateTransformCss:tt;return null==n?this.styleTween(t,q(t,r)).on("end.style."+t,V(t)):this.styleTween(t,"function"==typeof n?j(t,r,d(this,"style."+t,n)):O(t,r,n),e)},_t=function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,k(t,n,null==e?"":e))},vt=function(t){return this.tween("text","function"==typeof t?M(d(this,"text",t)):z(null==t?"":t+""))},yt=function(){for(var t=this._name,n=this._id,e=B(),r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],s=a.length,f=0;f<s;++f)if(u=a[f]){var c=l(u,n);X(u,t,e,f,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new R(r,this._parents,t,e)},mt=0,gt=n.selection.prototype;R.prototype=I.prototype={constructor:R,select:ft,selectAll:ct,filter:ut,merge:at,selection:dt,transition:yt,call:gt.call,nodes:gt.nodes,node:gt.node,size:gt.size,empty:gt.empty,each:gt.each,on:st,attr:nt,attrTween:et,style:pt,styleTween:_t,text:vt,remove:lt,tween:$,delay:rt,duration:it,ease:ot};var wt={time:null,delay:0,duration:250,ease:u.easeCubicInOut},bt=function(t){var n,e;t instanceof R?(n=t._id,t=t._name):(n=B(),(e=wt).time=r.now(),t=null==t?null:t+"");for(var i=this._groups,o=i.length,u=0;u<o;++u)for(var a,s=i[u],l=s.length,f=0;f<l;++f)(a=s[f])&&X(a,t,n,f,s,e||D(a,n));return new R(i,this._parents,t,n)};n.selection.prototype.interrupt=Z,n.selection.prototype.transition=bt;var At=[null],xt=function(t,n){var e,r,i=t.__transition;if(i){n=null==n?null:n+"";for(r in i)if((e=i[r]).state>J&&e.name===n)return new R([[t]],At,n,+r)}return null};t.transition=I,t.active=xt,t.interrupt=Y,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "d3-transition",
"version": "1.0.2",
"version": "1.0.3",
"description": "Animated transitions for D3 selections.",

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

"devDependencies": {
"eslint": "2",
"eslint": "3",
"package-preamble": "0.0",
"rollup": "0.34",
"rollup": "0.36",
"jsdom": "9",

@@ -45,0 +45,0 @@ "tape": "4",

@@ -68,2 +68,4 @@ # d3-transition

If the specified *transition* is not found on a selected node or its ancestors (such as if the transition [already ended](#the-life-of-a-transition)), the default timing parameters are used; however, in a future release, this will likely be changed to throw an error. See [#59](https://github.com/d3/d3-transition/issues/59).
<a name="selection_interrupt" href="#selection_interrupt">#</a> <i>selection</i>.<b>interrupt</b>([<i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/selection/interrupt.js "Source")

@@ -201,3 +203,3 @@

For each selected element, creates an [attribute tween](#transition_attrTween) for the attribute with the specified *name* to the specified target *value*. The starting value of the tween is the attribute’s value when the transition starts. The target *value* may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element.
For each selected element, assigns the [attribute tween](#transition_attrTween) for the attribute with the specified *name* to the specified target *value*. The starting value of the tween is the attribute’s value when the transition starts. The target *value* may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element.

@@ -212,6 +214,8 @@ If the target value is null, the attribute is removed when the transition starts. Otherwise, an interpolator is chosen based on the type of the target value, using the following algorithm:

<a name="transition_attrTween" href="#transition_attrTween">#</a> <i>transition</i>.<b>attrTween</b>(<i>name</i>[, <i>value</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/attrTween.js "Source")
<a name="transition_attrTween" href="#transition_attrTween">#</a> <i>transition</i>.<b>attrTween</b>(<i>name</i>[, <i>factory</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/attrTween.js "Source")
For each selected element, creates a [tween](#transition_tween) for the attribute with the specified *name* with the specified interpolator *value*. The *value* must be specified as a function that returns an [interpolator](https://github.com/d3/d3-interpolate). When the transition starts, the *value* function is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned interpolator is then invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. If the specified *value* is null, removes the previously-assigned attribute tween of the specified *name*, if any.
If *factory* is specified and not null, assigns the attribute [tween](#transition_tween) for the attribute with the specified *name* to the specified interpolator *factory*. An interpolator factory is a function that returns an [interpolator](https://github.com/d3/d3-interpolate); when the transition starts, the *factory* is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned interpolator will then be invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the attribute value. The interpolator must return a string. (To remove an attribute at the start of a transition, use [*transition*.attr](#transition_attr); to remove an attribute at the end of a transition, use [*transition*.on](#transition_on) to listen for the *end* event.)
If the specified *factory* is null, removes the previously-assigned attribute tween of the specified *name*, if any. If *factory* is not specified, returns the current interpolator factory for attribute with the specified *name*, or undefined if no such tween exists.
For example, to interpolate the fill attribute from red to blue:

@@ -247,3 +251,3 @@

For each selected element, creates an [style tween](#transition_styleTween) for the style with the specified *name* to the specified target *value* with the specified *priority*. The starting value of the tween is the style’s computed value when the transition starts. The target *value* may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element.
For each selected element, assigns the [style tween](#transition_styleTween) for the style with the specified *name* to the specified target *value* with the specified *priority*. The starting value of the tween is the style’s computed value when the transition starts. The target *value* may be specified either as a constant or a function. If a function, it is immediately evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element.

@@ -258,6 +262,8 @@ If the target value is null, the style is removed when the transition starts. Otherwise, an interpolator is chosen based on the type of the target value, using the following algorithm:

<a name="transition_styleTween" href="#transition_styleTween">#</a> <i>transition</i>.<b>styleTween</b>(<i>name</i>[, <i>value</i>[, <i>priority</i>]])) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/styleTween.js "Source")
<a name="transition_styleTween" href="#transition_styleTween">#</a> <i>transition</i>.<b>styleTween</b>(<i>name</i>[, <i>factory</i>[, <i>priority</i>]])) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/styleTween.js "Source")
For each selected element, creates a [tween](#transition_tween) for the style with the specified *name* with the specified interpolator *value* with the specified *priority*. The *value* must be specified as a function that returns an [interpolator](https://github.com/d3/d3-interpolate). When the transition starts, the *value* function is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned interpolator is then invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. If the specified *value* is null, removes the previously-assigned style tween of the specified *name*, if any.
If *factory* is specified and not null, assigns the style [tween](#transition_tween) for the style with the specified *name* to the specified interpolator *factory*. An interpolator factory is a function that returns an [interpolator](https://github.com/d3/d3-interpolate); when the transition starts, the *factory* is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned interpolator will then be invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. Lastly, the return value of the interpolator will be used to set the style value with the specified *priority*. The interpolator must return a string. (To remove an style at the start of a transition, use [*transition*.style](#transition_style); to remove an style at the end of a transition, use [*transition*.on](#transition_on) to listen for the *end* event.)
If the specified *factory* is null, removes the previously-assigned style tween of the specified *name*, if any. If *factory* is not specified, returns the current interpolator factory for style with the specified *name*, or undefined if no such tween exists.
For example, to interpolate the fill style from red to blue:

@@ -303,3 +309,3 @@

For each selected element, creates a tween with the specified *name* with the specified *value* function. The *value* must be specified as a function that returns a function. When the transition starts, the *value* function is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned function is then invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. If the specified *value* is null, removes the previously-assigned tween of the specified *name*, if any.
For each selected element, assigns the tween with the specified *name* with the specified *value* function. The *value* must be specified as a function that returns a function. When the transition starts, the *value* function is evaluated for each selected element, in order, being passed the current datum `d` and index `i`, with the `this` context as the current DOM element. The returned function is then invoked for each frame of the transition, in order, being passed the [eased](#transition_ease) time *t*, typically in the range [0, 1]. If the specified *value* is null, removes the previously-assigned tween of the specified *name*, if any.

@@ -371,7 +377,7 @@ For example, to interpolate the fill attribute to blue, like [*transition*.attr](#transition_attr):

<a name="transition_each" href="#transition_each">#</a> <i>transition</i>.<b>each</b>(<i>function</i>)
<a name="transition_each" href="#transition_each">#</a> <i>transition</i>.<b>each</b>(<i>function</i>) [<>](https://github.com/d3/d3-selection/blob/master/src/selection/each.js "Source")
Invokes the specified *function* for each selected element, passing in the current datum `d` and index `i`, with the `this` context of the current DOM element. This method can be used to invoke arbitrary code for each selected element, and is useful for creating a context to access parent and child data simultaneously. Equivalent to [*selection*.each](https://github.com/d3/d3-selection#selection_each).
<a name="transition_call" href="#transition_call">#</a> <i>transition</i>.<b>call</b>(<i>function</i>[, <i>arguments…</i>])
<a name="transition_call" href="#transition_call">#</a> <i>transition</i>.<b>call</b>(<i>function</i>[, <i>arguments…</i>]) [<>](https://github.com/d3/d3-selection/blob/master/src/selection/call.js "Source")

@@ -402,15 +408,15 @@ Invokes the specified *function* exactly once, passing in this transition along with any optional *arguments*. Returns this transition. This is equivalent to invoking the function by hand but facilitates method chaining. For example, to set several attributes in a reusable function:

<a name="transition_empty" href="#transition_empty">#</a> <i>transition</i>.<b>empty</b>()
<a name="transition_empty" href="#transition_empty">#</a> <i>transition</i>.<b>empty</b>() [<>](https://github.com/d3/d3-selection/blob/master/src/selection/empty.js "Source")
Returns true if this transition contains no (non-null) elements. Equivalent to [*selection*.empty](https://github.com/d3/d3-selection#selection_empty).
<a name="transition_nodes" href="#transition_nodes">#</a> <i>transition</i>.<b>nodes</b>()
<a name="transition_nodes" href="#transition_nodes">#</a> <i>transition</i>.<b>nodes</b>() [<>](https://github.com/d3/d3-selection/blob/master/src/selection/nodes.js "Source")
Returns an array of all (non-null) elements in this transition. Equivalent to [*selection*.nodes](https://github.com/d3/d3-selection#selection_nodes).
<a name="transition_node" href="#transition_node">#</a> <i>transition</i>.<b>node</b>()
<a name="transition_node" href="#transition_node">#</a> <i>transition</i>.<b>node</b>() [<>](https://github.com/d3/d3-selection/blob/master/src/selection/node.js "Source")
Returns the first (non-null) element in this transition. If the transition is empty, returns null. Equivalent to [*selection*.node](https://github.com/d3/d3-selection#selection_node).
<a name="transition_size" href="#transition_size">#</a> <i>transition</i>.<b>size</b>()
<a name="transition_size" href="#transition_size">#</a> <i>transition</i>.<b>size</b>() [<>](https://github.com/d3/d3-selection/blob/master/src/selection/size.js "Source")

@@ -417,0 +423,0 @@ Returns the total number of elements in this transition. Equivalent to [*selection*.size](https://github.com/d3/d3-selection#selection_size).

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

import {STARTED, ENDED} from "./transition/schedule";
import {STARTING, ENDING, ENDED} from "./transition/schedule";

@@ -16,3 +16,3 @@ export default function(node, name) {

if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
active = schedule.state === STARTED;
active = schedule.state > STARTING && schedule.state < ENDING;
schedule.state = ENDED;

@@ -19,0 +19,0 @@ schedule.timer.stop();

Sorry, the diff of this file is not supported yet

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