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.1 to 1.0.2

1249

build/d3-transition.js

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

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

@@ -6,770 +6,785 @@ 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')) :

(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3));
}(this, function (exports,d3Selection,d3Dispatch,d3Timer,d3Interpolate,d3Color,d3Ease) { 'use strict';
}(this, (function (exports,d3Selection,d3Dispatch,d3Timer,d3Interpolate,d3Color,d3Ease) { 'use strict';
var emptyOn = d3Dispatch.dispatch("start", "end", "interrupt");
var emptyTween = [];
var emptyOn = d3Dispatch.dispatch("start", "end", "interrupt");
var emptyTween = [];
var CREATED = 0;
var SCHEDULED = 1;
var STARTING = 2;
var STARTED = 3;
var ENDING = 4;
var ENDED = 5;
var CREATED = 0;
var SCHEDULED = 1;
var STARTING = 2;
var STARTED = 3;
var RUNNING = 4;
var ENDING = 5;
var ENDED = 6;
function schedule(node, name, id, index, group, timing) {
var schedules = node.__transition;
if (!schedules) node.__transition = {};
else if (id in schedules) return;
create(node, id, {
name: name,
index: index, // For context during callback.
group: group, // For context during callback.
on: emptyOn,
tween: emptyTween,
time: timing.time,
delay: timing.delay,
duration: timing.duration,
ease: timing.ease,
timer: null,
state: CREATED
});
}
function schedule(node, name, id, index, group, timing) {
var schedules = node.__transition;
if (!schedules) node.__transition = {};
else if (id in schedules) return;
create(node, id, {
name: name,
index: index, // For context during callback.
group: group, // For context during callback.
on: emptyOn,
tween: emptyTween,
time: timing.time,
delay: timing.delay,
duration: timing.duration,
ease: timing.ease,
timer: null,
state: CREATED
});
}
function init(node, id) {
var schedule = node.__transition;
if (!schedule || !(schedule = schedule[id]) || schedule.state > CREATED) throw new Error("too late");
return schedule;
}
function init(node, id) {
var schedule = node.__transition;
if (!schedule || !(schedule = schedule[id]) || schedule.state > CREATED) throw new Error("too late");
return schedule;
}
function set(node, id) {
var schedule = node.__transition;
if (!schedule || !(schedule = schedule[id]) || schedule.state > STARTING) throw new Error("too late");
return schedule;
}
function set(node, id) {
var schedule = node.__transition;
if (!schedule || !(schedule = schedule[id]) || schedule.state > STARTING) throw new Error("too late");
return schedule;
}
function get(node, id) {
var schedule = node.__transition;
if (!schedule || !(schedule = schedule[id])) throw new Error("too late");
return schedule;
}
function get(node, id) {
var schedule = node.__transition;
if (!schedule || !(schedule = schedule[id])) throw new Error("too late");
return schedule;
}
function create(node, id, self) {
var schedules = node.__transition,
tween;
function create(node, id, self) {
var schedules = node.__transition,
tween;
// Initialize the self timer when the transition is created.
// Note the actual delay is not known until the first callback!
schedules[id] = self;
self.timer = d3Timer.timer(schedule, 0, self.time);
// Initialize the self timer when the transition is created.
// Note the actual delay is not known until the first callback!
schedules[id] = self;
self.timer = d3Timer.timer(schedule, 0, self.time);
// If the delay is greater than this first sleep, sleep some more;
// otherwise, start immediately.
function schedule(elapsed) {
self.state = SCHEDULED;
if (self.delay <= elapsed) start(elapsed - self.delay);
else self.timer.restart(start, self.delay, self.time);
}
function schedule(elapsed) {
self.state = SCHEDULED;
self.timer.restart(start, self.delay, self.time);
function start(elapsed) {
var i, j, n, o;
// If the elapsed delay is less than our first sleep, start immediately.
if (self.delay <= elapsed) start(elapsed - self.delay);
}
for (i in schedules) {
o = schedules[i];
if (o.name !== self.name) continue;
function start(elapsed) {
var i, j, n, o;
// Interrupt the active transition, if any.
// Dispatch the interrupt event.
if (o.state === STARTED) {
o.state = ENDED;
o.timer.stop();
o.on.call("interrupt", node, node.__data__, o.index, o.group);
delete schedules[i];
}
// If the state is not SCHEDULED, then we previously errored on start.
if (self.state !== SCHEDULED) return stop();
// Cancel any pre-empted transitions. No interrupt event is dispatched
// because the cancelled transitions never started. Note that this also
// removes this transition from the pending list!
else if (+i < id) {
o.state = ENDED;
o.timer.stop();
delete schedules[i];
}
}
for (i in schedules) {
o = schedules[i];
if (o.name !== self.name) continue;
// Defer the first tick to end of the current frame; see mbostock/d3#1576.
// Note the transition may be canceled after start and before the first tick!
// Note this must be scheduled before the start event; see d3/d3-transition#16!
// Assuming this is successful, subsequent callbacks go straight to tick.
d3Timer.timeout(function() {
if (self.state === STARTED) {
self.timer.restart(tick, self.delay, self.time);
tick(elapsed);
}
});
// While this element already has a starting transition during this frame,
// defer starting an interrupting transition until that transition has a
// chance to tick (and possibly end); see d3/d3-transition#54!
if (o.state === STARTED) return d3Timer.timeout(start);
// Dispatch the start event.
// Note this must be done before the tween are initialized.
self.state = STARTING;
self.on.call("start", node, node.__data__, self.index, self.group);
if (self.state !== STARTING) return; // interrupted
self.state = STARTED;
// Interrupt the active transition, if any.
// Dispatch the interrupt event.
if (o.state === RUNNING) {
o.state = ENDED;
o.timer.stop();
o.on.call("interrupt", node, node.__data__, o.index, o.group);
delete schedules[i];
}
// Initialize the tween, deleting null tween.
tween = new Array(n = self.tween.length);
for (i = 0, j = -1; i < n; ++i) {
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
tween[++j] = o;
}
// Cancel any pre-empted transitions. No interrupt event is dispatched
// because the cancelled transitions never started. Note that this also
// removes this transition from the pending list!
else if (+i < id) {
o.state = ENDED;
o.timer.stop();
delete schedules[i];
}
tween.length = j + 1;
}
function tick(elapsed) {
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.state = ENDING, 1),
i = -1,
n = tween.length;
while (++i < n) {
tween[i].call(null, t);
// Defer the first tick to end of the current frame; see d3/d3#1576.
// Note the transition may be canceled after start and before the first tick!
// Note this must be scheduled before the start event; see d3/d3-transition#16!
// Assuming this is successful, subsequent callbacks go straight to tick.
d3Timer.timeout(function() {
if (self.state === STARTED) {
self.state = RUNNING;
self.timer.restart(tick, self.delay, self.time);
tick(elapsed);
}
});
// Dispatch the end event.
if (self.state === ENDING) {
self.state = ENDED;
self.timer.stop();
self.on.call("end", node, node.__data__, self.index, self.group);
for (i in schedules) if (+i !== id) return void delete schedules[id];
delete node.__transition;
// Dispatch the start event.
// Note this must be done before the tween are initialized.
self.state = STARTING;
self.on.call("start", node, node.__data__, self.index, self.group);
if (self.state !== STARTING) return; // interrupted
self.state = STARTED;
// Initialize the tween, deleting null tween.
tween = new Array(n = self.tween.length);
for (i = 0, j = -1; i < n; ++i) {
if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {
tween[++j] = o;
}
}
tween.length = j + 1;
}
function interrupt(node, name) {
var schedules = node.__transition,
schedule,
active,
empty = true,
i;
function tick(elapsed) {
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),
i = -1,
n = tween.length;
if (!schedules) return;
while (++i < n) {
tween[i].call(null, t);
}
name = name == null ? null : name + "";
for (i in schedules) {
if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
active = schedule.state === STARTED;
schedule.state = ENDED;
schedule.timer.stop();
if (active) schedule.on.call("interrupt", node, node.__data__, schedule.index, schedule.group);
delete schedules[i];
// Dispatch the end event.
if (self.state === ENDING) {
self.on.call("end", node, node.__data__, self.index, self.group);
stop();
}
if (empty) delete node.__transition;
}
function selection_interrupt(name) {
return this.each(function() {
interrupt(this, name);
});
function stop() {
self.state = ENDED;
self.timer.stop();
delete schedules[id];
for (var i in schedules) return; // eslint-disable-line no-unused-vars
delete node.__transition;
}
}
function tweenRemove(id, name) {
var tween0, tween1;
return function() {
var schedule = set(this, id),
tween = schedule.tween;
function interrupt(node, name) {
var schedules = node.__transition,
schedule,
active,
empty = true,
i;
// If this node shared tween with the previous node,
// just assign the updated shared tween and we’re done!
// Otherwise, copy-on-write.
if (tween !== tween0) {
tween1 = tween0 = tween;
for (var i = 0, n = tween1.length; i < n; ++i) {
if (tween1[i].name === name) {
tween1 = tween1.slice();
tween1.splice(i, 1);
break;
}
}
}
if (!schedules) return;
schedule.tween = tween1;
};
name = name == null ? null : name + "";
for (i in schedules) {
if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
active = schedule.state === STARTED;
schedule.state = ENDED;
schedule.timer.stop();
if (active) schedule.on.call("interrupt", node, node.__data__, schedule.index, schedule.group);
delete schedules[i];
}
function tweenFunction(id, name, value) {
var tween0, tween1;
if (typeof value !== "function") throw new Error;
return function() {
var schedule = set(this, id),
tween = schedule.tween;
if (empty) delete node.__transition;
}
// If this node shared tween with the previous node,
// just assign the updated shared tween and we’re done!
// Otherwise, copy-on-write.
if (tween !== tween0) {
tween1 = (tween0 = tween).slice();
for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {
if (tween1[i].name === name) {
tween1[i] = t;
break;
}
function selection_interrupt(name) {
return this.each(function() {
interrupt(this, name);
});
}
function tweenRemove(id, name) {
var tween0, tween1;
return function() {
var schedule = set(this, id),
tween = schedule.tween;
// If this node shared tween with the previous node,
// just assign the updated shared tween and we’re done!
// Otherwise, copy-on-write.
if (tween !== tween0) {
tween1 = tween0 = tween;
for (var i = 0, n = tween1.length; i < n; ++i) {
if (tween1[i].name === name) {
tween1 = tween1.slice();
tween1.splice(i, 1);
break;
}
if (i === n) tween1.push(t);
}
}
schedule.tween = tween1;
};
}
schedule.tween = tween1;
};
}
function transition_tween(name, value) {
var id = this._id;
function tweenFunction(id, name, value) {
var tween0, tween1;
if (typeof value !== "function") throw new Error;
return function() {
var schedule = set(this, id),
tween = schedule.tween;
name += "";
if (arguments.length < 2) {
var tween = get(this.node(), id).tween;
for (var i = 0, n = tween.length, t; i < n; ++i) {
if ((t = tween[i]).name === name) {
return t.value;
// If this node shared tween with the previous node,
// just assign the updated shared tween and we’re done!
// Otherwise, copy-on-write.
if (tween !== tween0) {
tween1 = (tween0 = tween).slice();
for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {
if (tween1[i].name === name) {
tween1[i] = t;
break;
}
}
return null;
if (i === n) tween1.push(t);
}
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
}
schedule.tween = tween1;
};
}
function tweenValue(transition, name, value) {
var id = transition._id;
function transition_tween(name, value) {
var id = this._id;
transition.each(function() {
var schedule = set(this, id);
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
});
name += "";
return function(node) {
return get(node, id).value[name];
};
if (arguments.length < 2) {
var tween = get(this.node(), id).tween;
for (var i = 0, n = tween.length, t; i < n; ++i) {
if ((t = tween[i]).name === name) {
return t.value;
}
}
return null;
}
function interpolate(a, b) {
var c;
return (typeof b === "number" ? d3Interpolate.interpolateNumber
: b instanceof d3Color.color ? d3Interpolate.interpolateRgb
: (c = d3Color.color(b)) ? (b = c, d3Interpolate.interpolateRgb)
: d3Interpolate.interpolateString)(a, b);
}
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
}
function attrRemove(name) {
return function() {
this.removeAttribute(name);
};
}
function tweenValue(transition, name, value) {
var id = transition._id;
function attrRemoveNS(fullname) {
return function() {
this.removeAttributeNS(fullname.space, fullname.local);
};
}
transition.each(function() {
var schedule = set(this, id);
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
});
function attrConstant(name, interpolate, value1) {
var value00,
interpolate0;
return function() {
var value0 = this.getAttribute(name);
return value0 === value1 ? null
: value0 === value00 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value1);
};
}
return function(node) {
return get(node, id).value[name];
};
}
function attrConstantNS(fullname, interpolate, value1) {
var value00,
interpolate0;
return function() {
var value0 = this.getAttributeNS(fullname.space, fullname.local);
return value0 === value1 ? null
: value0 === value00 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value1);
};
}
function interpolate(a, b) {
var c;
return (typeof b === "number" ? d3Interpolate.interpolateNumber
: b instanceof d3Color.color ? d3Interpolate.interpolateRgb
: (c = d3Color.color(b)) ? (b = c, d3Interpolate.interpolateRgb)
: d3Interpolate.interpolateString)(a, b);
}
function attrFunction(name, interpolate, value) {
var value00,
value10,
interpolate0;
return function() {
var value0, value1 = value(this);
if (value1 == null) return void this.removeAttribute(name);
value0 = this.getAttribute(name);
return value0 === value1 ? null
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
};
}
function attrRemove(name) {
return function() {
this.removeAttribute(name);
};
}
function attrFunctionNS(fullname, interpolate, value) {
var value00,
value10,
interpolate0;
return function() {
var value0, value1 = value(this);
if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
value0 = this.getAttributeNS(fullname.space, fullname.local);
return value0 === value1 ? null
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
};
}
function attrRemoveNS(fullname) {
return function() {
this.removeAttributeNS(fullname.space, fullname.local);
};
}
function transition_attr(name, value) {
var fullname = d3Selection.namespace(name), i = fullname === "transform" ? d3Interpolate.interpolateTransformSvg : interpolate;
return this.attrTween(name, typeof value === "function"
? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value))
: value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)
: (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
}
function attrConstant(name, interpolate, value1) {
var value00,
interpolate0;
return function() {
var value0 = this.getAttribute(name);
return value0 === value1 ? null
: value0 === value00 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value1);
};
}
function attrTweenNS(fullname, value) {
function tween() {
var node = this, i = value.apply(node, arguments);
return i && function(t) {
node.setAttributeNS(fullname.space, fullname.local, i(t));
};
}
tween._value = value;
return tween;
}
function attrConstantNS(fullname, interpolate, value1) {
var value00,
interpolate0;
return function() {
var value0 = this.getAttributeNS(fullname.space, fullname.local);
return value0 === value1 ? null
: value0 === value00 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value1);
};
}
function attrTween(name, value) {
function tween() {
var node = this, i = value.apply(node, arguments);
return i && function(t) {
node.setAttribute(name, i(t));
};
}
tween._value = value;
return tween;
}
function attrFunction(name, interpolate, value) {
var value00,
value10,
interpolate0;
return function() {
var value0, value1 = value(this);
if (value1 == null) return void this.removeAttribute(name);
value0 = this.getAttribute(name);
return value0 === value1 ? null
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
};
}
function transition_attrTween(name, value) {
var key = "attr." + name;
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
var fullname = d3Selection.namespace(name);
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
}
function attrFunctionNS(fullname, interpolate, value) {
var value00,
value10,
interpolate0;
return function() {
var value0, value1 = value(this);
if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
value0 = this.getAttributeNS(fullname.space, fullname.local);
return value0 === value1 ? null
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
};
}
function delayFunction(id, value) {
return function() {
init(this, id).delay = +value.apply(this, arguments);
function transition_attr(name, value) {
var fullname = d3Selection.namespace(name), i = fullname === "transform" ? d3Interpolate.interpolateTransformSvg : interpolate;
return this.attrTween(name, typeof value === "function"
? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value))
: value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)
: (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
}
function attrTweenNS(fullname, value) {
function tween() {
var node = this, i = value.apply(node, arguments);
return i && function(t) {
node.setAttributeNS(fullname.space, fullname.local, i(t));
};
}
tween._value = value;
return tween;
}
function delayConstant(id, value) {
return value = +value, function() {
init(this, id).delay = value;
function attrTween(name, value) {
function tween() {
var node = this, i = value.apply(node, arguments);
return i && function(t) {
node.setAttribute(name, i(t));
};
}
tween._value = value;
return tween;
}
function transition_delay(value) {
var id = this._id;
function transition_attrTween(name, value) {
var key = "attr." + name;
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
var fullname = d3Selection.namespace(name);
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
}
return arguments.length
? this.each((typeof value === "function"
? delayFunction
: delayConstant)(id, value))
: get(this.node(), id).delay;
}
function delayFunction(id, value) {
return function() {
init(this, id).delay = +value.apply(this, arguments);
};
}
function durationFunction(id, value) {
return function() {
set(this, id).duration = +value.apply(this, arguments);
};
}
function delayConstant(id, value) {
return value = +value, function() {
init(this, id).delay = value;
};
}
function durationConstant(id, value) {
return value = +value, function() {
set(this, id).duration = value;
};
}
function transition_delay(value) {
var id = this._id;
function transition_duration(value) {
var id = this._id;
return arguments.length
? this.each((typeof value === "function"
? delayFunction
: delayConstant)(id, value))
: get(this.node(), id).delay;
}
return arguments.length
? this.each((typeof value === "function"
? durationFunction
: durationConstant)(id, value))
: get(this.node(), id).duration;
}
function durationFunction(id, value) {
return function() {
set(this, id).duration = +value.apply(this, arguments);
};
}
function easeConstant(id, value) {
if (typeof value !== "function") throw new Error;
return function() {
set(this, id).ease = value;
};
}
function durationConstant(id, value) {
return value = +value, function() {
set(this, id).duration = value;
};
}
function transition_ease(value) {
var id = this._id;
function transition_duration(value) {
var id = this._id;
return arguments.length
? this.each(easeConstant(id, value))
: get(this.node(), id).ease;
}
return arguments.length
? this.each((typeof value === "function"
? durationFunction
: durationConstant)(id, value))
: get(this.node(), id).duration;
}
function transition_filter(match) {
if (typeof match !== "function") match = d3Selection.matcher(match);
function easeConstant(id, value) {
if (typeof value !== "function") throw new Error;
return function() {
set(this, id).ease = value;
};
}
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
subgroup.push(node);
}
function transition_ease(value) {
var id = this._id;
return arguments.length
? this.each(easeConstant(id, value))
: get(this.node(), id).ease;
}
function transition_filter(match) {
if (typeof match !== "function") match = d3Selection.matcher(match);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
if ((node = group[i]) && match.call(node, node.__data__, i, group)) {
subgroup.push(node);
}
}
return new Transition(subgroups, this._parents, this._name, this._id);
}
function transition_merge(transition) {
if (transition._id !== this._id) throw new Error;
return new Transition(subgroups, this._parents, this._name, this._id);
}
for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group0[i] || group1[i]) {
merge[i] = node;
}
function transition_merge(transition) {
if (transition._id !== this._id) throw new Error;
for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group0[i] || group1[i]) {
merge[i] = node;
}
}
for (; j < m0; ++j) {
merges[j] = groups0[j];
}
return new Transition(merges, this._parents, this._name, this._id);
}
function start(name) {
return (name + "").trim().split(/^|\s+/).every(function(t) {
var i = t.indexOf(".");
if (i >= 0) t = t.slice(0, i);
return !t || t === "start";
});
for (; j < m0; ++j) {
merges[j] = groups0[j];
}
function onFunction(id, name, listener) {
var on0, on1, sit = start(name) ? init : set;
return function() {
var schedule = sit(this, id),
on = schedule.on;
return new Transition(merges, this._parents, this._name, this._id);
}
// If this node shared a dispatch with the previous node,
// just assign the updated shared dispatch and we’re done!
// Otherwise, copy-on-write.
if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
function start(name) {
return (name + "").trim().split(/^|\s+/).every(function(t) {
var i = t.indexOf(".");
if (i >= 0) t = t.slice(0, i);
return !t || t === "start";
});
}
schedule.on = on1;
};
}
function onFunction(id, name, listener) {
var on0, on1, sit = start(name) ? init : set;
return function() {
var schedule = sit(this, id),
on = schedule.on;
function transition_on(name, listener) {
var id = this._id;
// If this node shared a dispatch with the previous node,
// just assign the updated shared dispatch and we’re done!
// Otherwise, copy-on-write.
if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
return arguments.length < 2
? get(this.node(), id).on.on(name)
: this.each(onFunction(id, name, listener));
}
schedule.on = on1;
};
}
function removeFunction(id) {
return function() {
var parent = this.parentNode;
for (var i in this.__transition) if (+i !== id) return;
if (parent) parent.removeChild(this);
};
}
function transition_on(name, listener) {
var id = this._id;
function transition_remove() {
return this.on("end.remove", removeFunction(this._id));
}
return arguments.length < 2
? get(this.node(), id).on.on(name)
: this.each(onFunction(id, name, listener));
}
function transition_select(select) {
var name = this._name,
id = this._id;
function removeFunction(id) {
return function() {
var parent = this.parentNode;
for (var i in this.__transition) if (+i !== id) return;
if (parent) parent.removeChild(this);
};
}
if (typeof select !== "function") select = d3Selection.selector(select);
function transition_remove() {
return this.on("end.remove", removeFunction(this._id));
}
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
if ("__data__" in node) subnode.__data__ = node.__data__;
subgroup[i] = subnode;
schedule(subgroup[i], name, id, i, subgroup, get(node, id));
}
function transition_select(select) {
var name = this._name,
id = this._id;
if (typeof select !== "function") select = d3Selection.selector(select);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
if ("__data__" in node) subnode.__data__ = node.__data__;
subgroup[i] = subnode;
schedule(subgroup[i], name, id, i, subgroup, get(node, id));
}
}
return new Transition(subgroups, this._parents, name, id);
}
function transition_selectAll(select) {
var name = this._name,
id = this._id;
return new Transition(subgroups, this._parents, name, id);
}
if (typeof select !== "function") select = d3Selection.selectorAll(select);
function transition_selectAll(select) {
var name = this._name,
id = this._id;
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
if (child = children[k]) {
schedule(child, name, id, k, children, inherit);
}
if (typeof select !== "function") select = d3Selection.selectorAll(select);
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
if (child = children[k]) {
schedule(child, name, id, k, children, inherit);
}
subgroups.push(children);
parents.push(node);
}
subgroups.push(children);
parents.push(node);
}
}
return new Transition(subgroups, parents, name, id);
}
var Selection = d3Selection.selection.prototype.constructor;
return new Transition(subgroups, parents, name, id);
}
function transition_selection() {
return new Selection(this._groups, this._parents);
}
var Selection = d3Selection.selection.prototype.constructor;
function styleRemove(name, interpolate) {
var value00,
value10,
interpolate0;
return function() {
var style = d3Selection.window(this).getComputedStyle(this, null),
value0 = style.getPropertyValue(name),
value1 = (this.style.removeProperty(name), style.getPropertyValue(name));
return value0 === value1 ? null
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
};
}
function transition_selection() {
return new Selection(this._groups, this._parents);
}
function styleRemoveEnd(name) {
return function() {
this.style.removeProperty(name);
};
}
function styleRemove(name, interpolate) {
var value00,
value10,
interpolate0;
return function() {
var style = d3Selection.window(this).getComputedStyle(this, null),
value0 = style.getPropertyValue(name),
value1 = (this.style.removeProperty(name), style.getPropertyValue(name));
return value0 === value1 ? null
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
};
}
function styleConstant(name, interpolate, value1) {
var value00,
interpolate0;
return function() {
var value0 = d3Selection.window(this).getComputedStyle(this, null).getPropertyValue(name);
return value0 === value1 ? null
: value0 === value00 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value1);
};
}
function styleRemoveEnd(name) {
return function() {
this.style.removeProperty(name);
};
}
function styleFunction(name, interpolate, value) {
var value00,
value10,
interpolate0;
return function() {
var style = d3Selection.window(this).getComputedStyle(this, null),
value0 = style.getPropertyValue(name),
value1 = value(this);
if (value1 == null) value1 = (this.style.removeProperty(name), style.getPropertyValue(name));
return value0 === value1 ? null
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
};
}
function styleConstant(name, interpolate, value1) {
var value00,
interpolate0;
return function() {
var value0 = d3Selection.window(this).getComputedStyle(this, null).getPropertyValue(name);
return value0 === value1 ? null
: value0 === value00 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value1);
};
}
function transition_style(name, value, priority) {
var i = (name += "") === "transform" ? d3Interpolate.interpolateTransformCss : interpolate;
return value == null ? this
.styleTween(name, styleRemove(name, i))
.on("end.style." + name, styleRemoveEnd(name))
: this.styleTween(name, typeof value === "function"
? styleFunction(name, i, tweenValue(this, "style." + name, value))
: styleConstant(name, i, value), priority);
}
function styleFunction(name, interpolate, value) {
var value00,
value10,
interpolate0;
return function() {
var style = d3Selection.window(this).getComputedStyle(this, null),
value0 = style.getPropertyValue(name),
value1 = value(this);
if (value1 == null) value1 = (this.style.removeProperty(name), style.getPropertyValue(name));
return value0 === value1 ? null
: value0 === value00 && value1 === value10 ? interpolate0
: interpolate0 = interpolate(value00 = value0, value10 = value1);
};
}
function styleTween(name, value, priority) {
function tween() {
var node = this, i = value.apply(node, arguments);
return i && function(t) {
node.style.setProperty(name, i(t), priority);
};
}
tween._value = value;
return tween;
}
function transition_style(name, value, priority) {
var i = (name += "") === "transform" ? d3Interpolate.interpolateTransformCss : interpolate;
return value == null ? this
.styleTween(name, styleRemove(name, i))
.on("end.style." + name, styleRemoveEnd(name))
: this.styleTween(name, typeof value === "function"
? styleFunction(name, i, tweenValue(this, "style." + name, value))
: styleConstant(name, i, value), priority);
}
function transition_styleTween(name, value, priority) {
var key = "style." + (name += "");
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
}
function textConstant(value) {
return function() {
this.textContent = value;
function styleTween(name, value, priority) {
function tween() {
var node = this, i = value.apply(node, arguments);
return i && function(t) {
node.style.setProperty(name, i(t), priority);
};
}
tween._value = value;
return tween;
}
function textFunction(value) {
return function() {
var value1 = value(this);
this.textContent = value1 == null ? "" : value1;
};
}
function transition_styleTween(name, value, priority) {
var key = "style." + (name += "");
if (arguments.length < 2) return (key = this.tween(key)) && key._value;
if (value == null) return this.tween(key, null);
if (typeof value !== "function") throw new Error;
return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
}
function transition_text(value) {
return this.tween("text", typeof value === "function"
? textFunction(tweenValue(this, "text", value))
: textConstant(value == null ? "" : value + ""));
}
function textConstant(value) {
return function() {
this.textContent = value;
};
}
function transition_transition() {
var name = this._name,
id0 = this._id,
id1 = newId();
function textFunction(value) {
return function() {
var value1 = value(this);
this.textContent = value1 == null ? "" : value1;
};
}
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
var inherit = get(node, id0);
schedule(node, name, id1, i, group, {
time: inherit.time + inherit.delay + inherit.duration,
delay: 0,
duration: inherit.duration,
ease: inherit.ease
});
}
function transition_text(value) {
return this.tween("text", typeof value === "function"
? textFunction(tweenValue(this, "text", value))
: textConstant(value == null ? "" : value + ""));
}
function transition_transition() {
var name = this._name,
id0 = this._id,
id1 = newId();
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
var inherit = get(node, id0);
schedule(node, name, id1, i, group, {
time: inherit.time + inherit.delay + inherit.duration,
delay: 0,
duration: inherit.duration,
ease: inherit.ease
});
}
}
return new Transition(groups, this._parents, name, id1);
}
var id = 0;
return new Transition(groups, this._parents, name, id1);
}
function Transition(groups, parents, name, id) {
this._groups = groups;
this._parents = parents;
this._name = name;
this._id = id;
}
var id = 0;
function transition(name) {
return d3Selection.selection().transition(name);
}
function Transition(groups, parents, name, id) {
this._groups = groups;
this._parents = parents;
this._name = name;
this._id = id;
}
function newId() {
return ++id;
}
function transition(name) {
return d3Selection.selection().transition(name);
}
var selection_prototype = d3Selection.selection.prototype;
function newId() {
return ++id;
}
Transition.prototype = transition.prototype = {
constructor: Transition,
select: transition_select,
selectAll: transition_selectAll,
filter: transition_filter,
merge: transition_merge,
selection: transition_selection,
transition: transition_transition,
call: selection_prototype.call,
nodes: selection_prototype.nodes,
node: selection_prototype.node,
size: selection_prototype.size,
empty: selection_prototype.empty,
each: selection_prototype.each,
on: transition_on,
attr: transition_attr,
attrTween: transition_attrTween,
style: transition_style,
styleTween: transition_styleTween,
text: transition_text,
remove: transition_remove,
tween: transition_tween,
delay: transition_delay,
duration: transition_duration,
ease: transition_ease
};
var selection_prototype = d3Selection.selection.prototype;
var defaultTiming = {
time: null, // Set on use.
delay: 0,
duration: 250,
ease: d3Ease.easeCubicInOut
};
Transition.prototype = transition.prototype = {
constructor: Transition,
select: transition_select,
selectAll: transition_selectAll,
filter: transition_filter,
merge: transition_merge,
selection: transition_selection,
transition: transition_transition,
call: selection_prototype.call,
nodes: selection_prototype.nodes,
node: selection_prototype.node,
size: selection_prototype.size,
empty: selection_prototype.empty,
each: selection_prototype.each,
on: transition_on,
attr: transition_attr,
attrTween: transition_attrTween,
style: transition_style,
styleTween: transition_styleTween,
text: transition_text,
remove: transition_remove,
tween: transition_tween,
delay: transition_delay,
duration: transition_duration,
ease: transition_ease
};
function inherit(node, id) {
var timing;
while (!(timing = node.__transition) || !(timing = timing[id])) {
if (!(node = node.parentNode)) {
return defaultTiming.time = d3Timer.now(), defaultTiming;
}
var defaultTiming = {
time: null, // Set on use.
delay: 0,
duration: 250,
ease: d3Ease.easeCubicInOut
};
function inherit(node, id) {
var timing;
while (!(timing = node.__transition) || !(timing = timing[id])) {
if (!(node = node.parentNode)) {
return defaultTiming.time = d3Timer.now(), defaultTiming;
}
return timing;
}
return timing;
}
function selection_transition(name) {
var id,
timing;
function selection_transition(name) {
var id,
timing;
if (name instanceof Transition) {
id = name._id, name = name._name;
} else {
id = newId(), (timing = defaultTiming).time = d3Timer.now(), name = name == null ? null : name + "";
}
if (name instanceof Transition) {
id = name._id, name = name._name;
} else {
id = newId(), (timing = defaultTiming).time = d3Timer.now(), name = name == null ? null : name + "";
}
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
schedule(node, name, id, i, group, timing || inherit(node, id));
}
for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
if (node = group[i]) {
schedule(node, name, id, i, group, timing || inherit(node, id));
}
}
return new Transition(groups, this._parents, name, id);
}
d3Selection.selection.prototype.interrupt = selection_interrupt;
d3Selection.selection.prototype.transition = selection_transition;
return new Transition(groups, this._parents, name, id);
}
var root = [null];
d3Selection.selection.prototype.interrupt = selection_interrupt;
d3Selection.selection.prototype.transition = selection_transition;
function active(node, name) {
var schedules = node.__transition,
schedule,
i;
var root = [null];
if (schedules) {
name = name == null ? null : name + "";
for (i in schedules) {
if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) {
return new Transition([[node]], root, name, +i);
}
function active(node, name) {
var schedules = node.__transition,
schedule,
i;
if (schedules) {
name = name == null ? null : name + "";
for (i in schedules) {
if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) {
return new Transition([[node]], root, name, +i);
}
}
return null;
}
exports.transition = transition;
exports.active = active;
exports.interrupt = interrupt;
return null;
}
Object.defineProperty(exports, '__esModule', { value: true });
exports.transition = transition;
exports.active = active;
exports.interrupt = interrupt;
}));
Object.defineProperty(exports, '__esModule', { value: true });
})));

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

// https://d3js.org/d3-transition/ Version 1.0.1. 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.delay<=t?o(t-e.delay):e.timer.restart(o,e.delay,e.time)}function o(i){var o,l,f,c;for(o in s)c=s[o],c.name===e.name&&(c.state===_t?(c.state=yt,c.timer.stop(),c.on.call("interrupt",t,t.__data__,c.index,c.group),delete s[o]):+o<n&&(c.state=yt,c.timer.stop(),delete s[o]));if(r.timeout(function(){e.state===_t&&(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,a=new Array(f=e.tween.length),o=0,l=-1;o<f;++o)(c=e.tween[o].value.call(t,t.__data__,e.index,e.group))&&(a[++l]=c);a.length=l+1}}function u(r){for(var i=r<e.duration?e.ease.call(null,r/e.duration):(e.state=vt,1),o=-1,u=a.length;++o<u;)a[o].call(null,i);if(e.state===vt){e.state=yt,e.timer.stop(),e.on.call("end",t,t.__data__,e.index,e.group);for(o in s)if(+o!==n)return void delete s[n];delete t.__transition}}var a,s=t.__transition;s[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=yt,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 mt(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++gt}function at(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return bt.time=r.now(),bt;return e}function st(t){var n,e;t instanceof it?(n=t._id,t=t._name):(n=ut(),(e=bt).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]],At,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=n.selection.prototype.constructor,gt=0,wt=n.selection.prototype;it.prototype=ot.prototype={constructor:it,select:J,selectAll:K,filter:R,merge:I,selection:L,transition:rt,call:wt.call,nodes:wt.nodes,node:wt.node,size:wt.size,empty:wt.empty,each:wt.each,on:F,attr:S,attrTween:N,style:Y,styleTween:$,text:et,remove:H,tween:v,delay:V,duration:k,ease:M};var bt={time:null,delay:0,duration:250,ease:u.easeCubicInOut};n.selection.prototype.interrupt=d,n.selection.prototype.transition=st;var At=[null];t.transition=ot,t.active=lt,t.interrupt=h,Object.defineProperty(t,"__esModule",{value:!0})});
// 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})});
{
"name": "d3-transition",
"version": "1.0.1",
"version": "1.0.2",
"description": "Animated transitions for D3 selections.",

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

@@ -50,3 +50,3 @@ # d3-transition

<a name="selection_transition" href="#selection_transition">#</a> <i>selection</i>.<b>transition</b>([<i>name</i>])
<a name="selection_transition" href="#selection_transition">#</a> <i>selection</i>.<b>transition</b>([<i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/selection/transition.js "Source")

@@ -69,3 +69,3 @@ Returns a new transition on the given *selection* with the specified *name*. If a *name* is not specified, null is used. The new transition is only exclusive with other transitions of the same name.

<a name="selection_interrupt" href="#selection_interrupt">#</a> <i>selection</i>.<b>interrupt</b>([<i>name</i>])
<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")

@@ -86,7 +86,7 @@ Interrupts the active transition of the specified *name* on the selected elements, and cancels any pending transitions with the specified *name*, if any. If a name is not specified, null is used.

<a name="interrupt" href="#interrupt">#</a> d3.<b>interrupt</b>(<i>node</i>[, <i>name</i>])
<a name="interrupt" href="#interrupt">#</a> d3.<b>interrupt</b>(<i>node</i>[, <i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/interrupt.js "Source")
Interrupts the active transition of the specified *name* on the specified *node*, and cancels any pending transitions with the specified *name*, if any. If a name is not specified, null is used. See also [*selection*.interrupt](#selection_interrupt).
<a name="transition" href="#transition">#</a> d3.<b>transition</b>([<i>name</i>])
<a name="transition" href="#transition">#</a> d3.<b>transition</b>([<i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/index.js#L29 "Source")

@@ -102,3 +102,3 @@ Returns a new transition on the root element, `document.documentElement`, with the specified *name*. If a *name* is not specified, null is used. The new transition is only exclusive with other transitions of the same name. The *name* may also be a [transition](#transition) instance; see [*selection*.transition](#selection_transition). This method is equivalent to:

<a name="transition_select" href="#transition_select">#</a> <i>transition</i>.<b>select</b>(<i>selector</i>)
<a name="transition_select" href="#transition_select">#</a> <i>transition</i>.<b>select</b>(<i>selector</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/select.js "Source")

@@ -116,3 +116,3 @@ For each selected element, selects the first descendant element that matches the specified *selector* string, if any, and returns a transition on the resulting selection. The *selector* may be specified either as a selector string or a function. If a function, it 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 new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

<a name="transition_selectAll" href="#transition_selectAll">#</a> <i>transition</i>.<b>selectAll</b>(<i>selector</i>)
<a name="transition_selectAll" href="#transition_selectAll">#</a> <i>transition</i>.<b>selectAll</b>(<i>selector</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/selectAll.js "Source")

@@ -130,3 +130,3 @@ For each selected element, selects all descendant elements that match the specified *selector* string, if any, and returns a transition on the resulting selection. The *selector* may be specified either as a selector string or a function. If a function, it 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 new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

<a name="transition_filter" href="#transition_filter">#</a> <i>transition</i>.<b>filter</b>(<i>filter</i>)
<a name="transition_filter" href="#transition_filter">#</a> <i>transition</i>.<b>filter</b>(<i>filter</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/filter.js "Source")

@@ -144,3 +144,3 @@ For each selected element, selects only the elements that match the specified *filter*, and returns a transition on the resulting selection. The *filter* may be specified either as a selector string or a function. If a function, it 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 new transition has the same id, name and timing as this transition; however, if a transition with the same id already exists on a selected element, the existing transition is returned for that element.

<a name="transition_merge" href="#transition_merge">#</a> <i>transition</i>.<b>merge</b>(<i>other</i>)
<a name="transition_merge" href="#transition_merge">#</a> <i>transition</i>.<b>merge</b>(<i>other</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/merge.js "Source")

@@ -158,3 +158,3 @@ Returns a new transition merging this transition with the specified *other* transition, which must have the same id as this transition. The returned transition has the same number of groups, the same parents, the same name and the same id as this transition. Any missing (null) elements in this transition are filled with the corresponding element, if present (not null), from the *other* transition.

<a name="transition_transition" href="#transition_transition">#</a> <i>transition</i>.<b>transition</b>()
<a name="transition_transition" href="#transition_transition">#</a> <i>transition</i>.<b>transition</b>() [<>](https://github.com/d3/d3-transition/blob/master/src/transition/transition.js "Source")

@@ -177,7 +177,7 @@ Returns a new transition on the same selected elements as this transition, scheduled to start when this transition ends. The new transition inherits a reference time equal to this transition’s time plus its [delay](#transition_delay) and [duration](#transition_duration). The new transition also inherits this transition’s name, duration, and [easing](#transition_ease). This method can be used to schedule a sequence of chained transitions. For example:

<a name="transition_selection" href="#transition_selection">#</a> <i>transition</i>.<b>selection</b>()
<a name="transition_selection" href="#transition_selection">#</a> <i>transition</i>.<b>selection</b>() [<>](https://github.com/d3/d3-transition/blob/master/src/transition/selection.js "Source")
Returns the [selection](https://github.com/d3/d3-selection#selection) corresponding to this transition.
<a name="active" href="#active">#</a> d3.<b>active</b>(<i>node</i>[, <i>name</i>])
<a name="active" href="#active">#</a> d3.<b>active</b>(<i>node</i>[, <i>name</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/active.js "Source")

@@ -207,3 +207,3 @@ Returns the active transition on the specified *node* with the specified *name*, if any. If no *name* is specified, null is used. Returns null if there is no such active transition on the specified node. This method is useful for creating chained transitions. For example, to initiate disco mode:

<a name="transition_attr" href="#transition_attr">#</a> <i>transition</i>.<b>attr</b>(<i>name</i>, <i>value</i>)
<a name="transition_attr" href="#transition_attr">#</a> <i>transition</i>.<b>attr</b>(<i>name</i>, <i>value</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/attr.js "Source")

@@ -220,3 +220,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.

<a name="transition_attrTween" href="#transition_attrTween">#</a> <i>transition</i>.<b>attrTween</b>(<i>name</i>[, <i>value</i>])
<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")

@@ -253,3 +253,3 @@ 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.

<a name="transition_style" href="#transition_style">#</a> <i>transition</i>.<b>style</b>(<i>name</i>, <i>value</i>[, <i>priority</i>])
<a name="transition_style" href="#transition_style">#</a> <i>transition</i>.<b>style</b>(<i>name</i>, <i>value</i>[, <i>priority</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/style.js "Source")

@@ -266,3 +266,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.

<a name="transition_styleTween" href="#transition_styleTween">#</a> <i>transition</i>.<b>styleTween</b>(<i>name</i>[, <i>value</i>[, <i>priority</i>]]))
<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")

@@ -299,3 +299,3 @@ 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.

<a name="transition_text" href="#transition_text">#</a> <i>transition</i>.<b>text</b>(<i>value</i>)
<a name="transition_text" href="#transition_text">#</a> <i>transition</i>.<b>text</b>(<i>value</i>) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/text.js "Source")

@@ -306,7 +306,7 @@ For each selected element, sets the [text content](http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent) to the specified target *value* when the transition starts. The *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. The function’s return value is then used to set each element’s text content. A null value will clear the content.

<a name="transition_remove" href="#transition_remove">#</a> <i>transition</i>.<b>remove</b>()
<a name="transition_remove" href="#transition_remove">#</a> <i>transition</i>.<b>remove</b>() [<>](https://github.com/d3/d3-transition/blob/master/src/transition/remove.js "Source")
For each selected element, [removes](https://github.com/d3/d3-selection#selection_remove) the element when the transition ends, as long as the element has no other active or pending transitions. If the element has other active or pending transitions, does nothing.
<a name="transition_tween" href="#transition_tween">#</a> <i>transition</i>.<b>tween</b>(<i>name</i>[, <i>value</i>])
<a name="transition_tween" href="#transition_tween">#</a> <i>transition</i>.<b>tween</b>(<i>name</i>[, <i>value</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/tween.js "Source")

@@ -332,3 +332,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.

<a name="transition_delay" href="#transition_delay">#</a> <i>transition</i>.<b>delay</b>([<i>value</i>])
<a name="transition_delay" href="#transition_delay">#</a> <i>transition</i>.<b>delay</b>([<i>value</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/delay.js "Source")

@@ -347,3 +347,3 @@ For each selected element, sets the transition delay to the specified *value* in milliseconds. The *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. The function’s return value is then used to set each element’s transition delay. If a delay is not specified, it defaults to zero.

<a name="transition_duration" href="#transition_duration">#</a> <i>transition</i>.<b>duration</b>([<i>value</i>])
<a name="transition_duration" href="#transition_duration">#</a> <i>transition</i>.<b>duration</b>([<i>value</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/duration.js "Source")

@@ -354,3 +354,3 @@ For each selected element, sets the transition duration to the specified *value* in milliseconds. The *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. The function’s return value is then used to set each element’s transition duration. If a duration is not specified, it defaults to 250ms.

<a name="transition_ease" href="#transition_ease">#</a> <i>transition</i>.<b>ease</b>([<i>value</i>])
<a name="transition_ease" href="#transition_ease">#</a> <i>transition</i>.<b>ease</b>([<i>value</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/ease.js "Source")

@@ -365,3 +365,3 @@ Specifies the transition [easing function](https://github.com/d3/d3-ease) for all selected elements. The *value* must be specified as a function. The easing function is invoked for each frame of the animation, being passed the normalized time *t* in the range [0, 1]; it must then return the eased time *tʹ* which is typically also in the range [0, 1]. A good easing function should return 0 if *t* = 0 and 1 if *t* = 1. If an easing function is not specified, it defaults to [d3.easeCubic](https://github.com/d3/d3-ease#easeCubic).

<a name="transition_on" href="#transition_on">#</a> <i>transition</i>.<b>on</b>(<i>typenames</i>[, <i>listener</i>])
<a name="transition_on" href="#transition_on">#</a> <i>transition</i>.<b>on</b>(<i>typenames</i>[, <i>listener</i>]) [<>](https://github.com/d3/d3-transition/blob/master/src/transition/on.js "Source")

@@ -368,0 +368,0 @@ Adds or removes a *listener* to each selected element for the specified event *typenames*. The *typenames* is one of the following string event types:

@@ -11,4 +11,5 @@ import {dispatch} from "d3-dispatch";

export var STARTED = 3;
export var ENDING = 4;
export var ENDED = 5;
export var RUNNING = 4;
export var ENDING = 5;
export var ENDED = 6;

@@ -61,8 +62,8 @@ export default function(node, name, id, index, group, timing) {

// If the delay is greater than this first sleep, sleep some more;
// otherwise, start immediately.
function schedule(elapsed) {
self.state = SCHEDULED;
self.timer.restart(start, self.delay, self.time);
// If the elapsed delay is less than our first sleep, start immediately.
if (self.delay <= elapsed) start(elapsed - self.delay);
else self.timer.restart(start, self.delay, self.time);
}

@@ -73,2 +74,5 @@

// If the state is not SCHEDULED, then we previously errored on start.
if (self.state !== SCHEDULED) return stop();
for (i in schedules) {

@@ -78,5 +82,10 @@ o = schedules[i];

// While this element already has a starting transition during this frame,
// defer starting an interrupting transition until that transition has a
// chance to tick (and possibly end); see d3/d3-transition#54!
if (o.state === STARTED) return timeout(start);
// Interrupt the active transition, if any.
// Dispatch the interrupt event.
if (o.state === STARTED) {
if (o.state === RUNNING) {
o.state = ENDED;

@@ -98,3 +107,3 @@ o.timer.stop();

// Defer the first tick to end of the current frame; see mbostock/d3#1576.
// Defer the first tick to end of the current frame; see d3/d3#1576.
// Note the transition may be canceled after start and before the first tick!

@@ -105,2 +114,3 @@ // Note this must be scheduled before the start event; see d3/d3-transition#16!

if (self.state === STARTED) {
self.state = RUNNING;
self.timer.restart(tick, self.delay, self.time);

@@ -129,3 +139,3 @@ tick(elapsed);

function tick(elapsed) {
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.state = ENDING, 1),
var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),
i = -1,

@@ -140,9 +150,14 @@ n = tween.length;

if (self.state === ENDING) {
self.state = ENDED;
self.timer.stop();
self.on.call("end", node, node.__data__, self.index, self.group);
for (i in schedules) if (+i !== id) return void delete schedules[id];
delete node.__transition;
stop();
}
}
function stop() {
self.state = ENDED;
self.timer.stop();
delete schedules[id];
for (var i in schedules) return; // eslint-disable-line no-unused-vars
delete node.__transition;
}
}
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