Initial commit
This commit is contained in:
15
node_modules/d3-transition/.eslintrc.json
generated
vendored
Normal file
15
node_modules/d3-transition/.eslintrc.json
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
"ecmaVersion": 8
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true,
|
||||
"browser": true
|
||||
},
|
||||
"rules": {
|
||||
"no-cond-assign": 0
|
||||
}
|
||||
}
|
||||
58
node_modules/d3-transition/LICENSE
generated
vendored
Normal file
58
node_modules/d3-transition/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
Copyright (c) 2010-2015, Michael Bostock
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* The name Michael Bostock may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
TERMS OF USE - EASING EQUATIONS
|
||||
|
||||
Open source under the BSD License.
|
||||
|
||||
Copyright 2001 Robert Penner
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the author nor the names of contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
787
node_modules/d3-transition/dist/d3-transition.js
generated
vendored
Normal file
787
node_modules/d3-transition/dist/d3-transition.js
generated
vendored
Normal file
@@ -0,0 +1,787 @@
|
||||
// https://d3js.org/d3-transition/ v1.1.3 Copyright 2018 Mike Bostock
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dispatch'), require('d3-timer'), require('d3-color'), require('d3-interpolate'), require('d3-selection'), require('d3-ease')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'd3-dispatch', 'd3-timer', 'd3-color', 'd3-interpolate', 'd3-selection', 'd3-ease'], factory) :
|
||||
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3));
|
||||
}(this, (function (exports,d3Dispatch,d3Timer,d3Color,d3Interpolate,d3Selection,d3Ease) { 'use strict';
|
||||
|
||||
var emptyOn = d3Dispatch.dispatch("start", "end", "interrupt");
|
||||
var emptyTween = [];
|
||||
|
||||
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 init(node, id) {
|
||||
var schedule = get(node, id);
|
||||
if (schedule.state > CREATED) throw new Error("too late; already scheduled");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
function set(node, id) {
|
||||
var schedule = get(node, id);
|
||||
if (schedule.state > STARTING) throw new Error("too late; already started");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
function get(node, id) {
|
||||
var schedule = node.__transition;
|
||||
if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
function start(elapsed) {
|
||||
var i, j, n, o;
|
||||
|
||||
// If the state is not SCHEDULED, then we previously errored on start.
|
||||
if (self.state !== SCHEDULED) return stop();
|
||||
|
||||
for (i in schedules) {
|
||||
o = schedules[i];
|
||||
if (o.name !== self.name) continue;
|
||||
|
||||
// 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);
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
|
||||
// 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 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 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;
|
||||
|
||||
while (++i < n) {
|
||||
tween[i].call(null, t);
|
||||
}
|
||||
|
||||
// Dispatch the end event.
|
||||
if (self.state === ENDING) {
|
||||
self.on.call("end", node, node.__data__, self.index, self.group);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
function interrupt(node, name) {
|
||||
var schedules = node.__transition,
|
||||
schedule$$1,
|
||||
active,
|
||||
empty = true,
|
||||
i;
|
||||
|
||||
if (!schedules) return;
|
||||
|
||||
name = name == null ? null : name + "";
|
||||
|
||||
for (i in schedules) {
|
||||
if ((schedule$$1 = schedules[i]).name !== name) { empty = false; continue; }
|
||||
active = schedule$$1.state > STARTING && schedule$$1.state < ENDING;
|
||||
schedule$$1.state = ENDED;
|
||||
schedule$$1.timer.stop();
|
||||
if (active) schedule$$1.on.call("interrupt", node, node.__data__, schedule$$1.index, schedule$$1.group);
|
||||
delete schedules[i];
|
||||
}
|
||||
|
||||
if (empty) delete node.__transition;
|
||||
}
|
||||
|
||||
function selection_interrupt(name) {
|
||||
return this.each(function() {
|
||||
interrupt(this, name);
|
||||
});
|
||||
}
|
||||
|
||||
function tweenRemove(id, name) {
|
||||
var tween0, tween1;
|
||||
return function() {
|
||||
var schedule$$1 = set(this, id),
|
||||
tween = schedule$$1.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
schedule$$1.tween = tween1;
|
||||
};
|
||||
}
|
||||
|
||||
function tweenFunction(id, name, value) {
|
||||
var tween0, tween1;
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return function() {
|
||||
var schedule$$1 = set(this, id),
|
||||
tween = schedule$$1.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).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;
|
||||
}
|
||||
}
|
||||
if (i === n) tween1.push(t);
|
||||
}
|
||||
|
||||
schedule$$1.tween = tween1;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_tween(name, value) {
|
||||
var id = this._id;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
|
||||
}
|
||||
|
||||
function tweenValue(transition, name, value) {
|
||||
var id = transition._id;
|
||||
|
||||
transition.each(function() {
|
||||
var schedule$$1 = set(this, id);
|
||||
(schedule$$1.value || (schedule$$1.value = {}))[name] = value.apply(this, arguments);
|
||||
});
|
||||
|
||||
return function(node) {
|
||||
return get(node, id).value[name];
|
||||
};
|
||||
}
|
||||
|
||||
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 attrRemove(name) {
|
||||
return function() {
|
||||
this.removeAttribute(name);
|
||||
};
|
||||
}
|
||||
|
||||
function attrRemoveNS(fullname) {
|
||||
return function() {
|
||||
this.removeAttributeNS(fullname.space, fullname.local);
|
||||
};
|
||||
}
|
||||
|
||||
function attrConstant(name, interpolate$$1, value1) {
|
||||
var value00,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var value0 = this.getAttribute(name);
|
||||
return value0 === value1 ? null
|
||||
: value0 === value00 ? interpolate0
|
||||
: interpolate0 = interpolate$$1(value00 = value0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function attrConstantNS(fullname, interpolate$$1, value1) {
|
||||
var value00,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var value0 = this.getAttributeNS(fullname.space, fullname.local);
|
||||
return value0 === value1 ? null
|
||||
: value0 === value00 ? interpolate0
|
||||
: interpolate0 = interpolate$$1(value00 = value0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function attrFunction(name, interpolate$$1, 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$$1(value00 = value0, value10 = value1);
|
||||
};
|
||||
}
|
||||
|
||||
function attrFunctionNS(fullname, interpolate$$1, 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$$1(value00 = value0, value10 = value1);
|
||||
};
|
||||
}
|
||||
|
||||
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 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_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 delayFunction(id, value) {
|
||||
return function() {
|
||||
init(this, id).delay = +value.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function delayConstant(id, value) {
|
||||
return value = +value, function() {
|
||||
init(this, id).delay = value;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_delay(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each((typeof value === "function"
|
||||
? delayFunction
|
||||
: delayConstant)(id, value))
|
||||
: get(this.node(), id).delay;
|
||||
}
|
||||
|
||||
function durationFunction(id, value) {
|
||||
return function() {
|
||||
set(this, id).duration = +value.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function durationConstant(id, value) {
|
||||
return value = +value, function() {
|
||||
set(this, id).duration = value;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_duration(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each((typeof value === "function"
|
||||
? durationFunction
|
||||
: durationConstant)(id, value))
|
||||
: get(this.node(), id).duration;
|
||||
}
|
||||
|
||||
function easeConstant(id, value) {
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return function() {
|
||||
set(this, id).ease = value;
|
||||
};
|
||||
}
|
||||
|
||||
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$$1) {
|
||||
if (transition$$1._id !== this._id) throw new Error;
|
||||
|
||||
for (var groups0 = this._groups, groups1 = transition$$1._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";
|
||||
});
|
||||
}
|
||||
|
||||
function onFunction(id, name, listener) {
|
||||
var on0, on1, sit = start(name) ? init : set;
|
||||
return function() {
|
||||
var schedule$$1 = sit(this, id),
|
||||
on = schedule$$1.on;
|
||||
|
||||
// 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);
|
||||
|
||||
schedule$$1.on = on1;
|
||||
};
|
||||
}
|
||||
|
||||
function transition_on(name, listener) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length < 2
|
||||
? get(this.node(), id).on.on(name)
|
||||
: this.each(onFunction(id, name, listener));
|
||||
}
|
||||
|
||||
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_remove() {
|
||||
return this.on("end.remove", removeFunction(this._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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(subgroups, parents, name, id);
|
||||
}
|
||||
|
||||
var Selection = d3Selection.selection.prototype.constructor;
|
||||
|
||||
function transition_selection() {
|
||||
return new Selection(this._groups, this._parents);
|
||||
}
|
||||
|
||||
function styleRemove(name, interpolate$$1) {
|
||||
var value00,
|
||||
value10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var value0 = d3Selection.style(this, name),
|
||||
value1 = (this.style.removeProperty(name), d3Selection.style(this, name));
|
||||
return value0 === value1 ? null
|
||||
: value0 === value00 && value1 === value10 ? interpolate0
|
||||
: interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
|
||||
};
|
||||
}
|
||||
|
||||
function styleRemoveEnd(name) {
|
||||
return function() {
|
||||
this.style.removeProperty(name);
|
||||
};
|
||||
}
|
||||
|
||||
function styleConstant(name, interpolate$$1, value1) {
|
||||
var value00,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var value0 = d3Selection.style(this, name);
|
||||
return value0 === value1 ? null
|
||||
: value0 === value00 ? interpolate0
|
||||
: interpolate0 = interpolate$$1(value00 = value0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function styleFunction(name, interpolate$$1, value) {
|
||||
var value00,
|
||||
value10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var value0 = d3Selection.style(this, name),
|
||||
value1 = value(this);
|
||||
if (value1 == null) value1 = (this.style.removeProperty(name), d3Selection.style(this, name));
|
||||
return value0 === value1 ? null
|
||||
: value0 === value00 && value1 === value10 ? interpolate0
|
||||
: interpolate0 = interpolate$$1(value00 = value0, value10 = 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 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_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 textFunction(value) {
|
||||
return function() {
|
||||
var value1 = value(this);
|
||||
this.textContent = value1 == null ? "" : value1;
|
||||
};
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
function Transition(groups, parents, name, id) {
|
||||
this._groups = groups;
|
||||
this._parents = parents;
|
||||
this._name = name;
|
||||
this._id = id;
|
||||
}
|
||||
|
||||
function transition(name) {
|
||||
return d3Selection.selection().transition(name);
|
||||
}
|
||||
|
||||
function newId() {
|
||||
return ++id;
|
||||
}
|
||||
|
||||
var selection_prototype = d3Selection.selection.prototype;
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
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 + "";
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
var root = [null];
|
||||
|
||||
function active(node, name) {
|
||||
var schedules = node.__transition,
|
||||
schedule$$1,
|
||||
i;
|
||||
|
||||
if (schedules) {
|
||||
name = name == null ? null : name + "";
|
||||
for (i in schedules) {
|
||||
if ((schedule$$1 = schedules[i]).state > SCHEDULED && schedule$$1.name === name) {
|
||||
return new Transition([[node]], root, name, +i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
exports.transition = transition;
|
||||
exports.active = active;
|
||||
exports.interrupt = interrupt;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
2
node_modules/d3-transition/dist/d3-transition.min.js
generated
vendored
Normal file
2
node_modules/d3-transition/dist/d3-transition.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
34
node_modules/d3-transition/package.json
generated
vendored
Normal file
34
node_modules/d3-transition/package.json
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "d3-transition",
|
||||
"version": "1.1.3",
|
||||
"description": "Animated transitions for D3 selections.",
|
||||
"homepage": "https://d3js.org/d3-transition/",
|
||||
"license": "BSD-3-Clause",
|
||||
"author": {
|
||||
"name": "Mike Bostock",
|
||||
"url": "http://bost.ocks.org/mike"
|
||||
},
|
||||
"main": "dist/d3-transition.js",
|
||||
"unpkg": "dist/d3-transition.min.js",
|
||||
"jsdelivr": "dist/d3-transition.min.js",
|
||||
"module": "src/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/d3/d3-transition.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"d3-color": "1",
|
||||
"d3-dispatch": "1",
|
||||
"d3-ease": "1",
|
||||
"d3-interpolate": "1",
|
||||
"d3-selection": "^1.1.0",
|
||||
"d3-timer": "1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "5",
|
||||
"jsdom": "12",
|
||||
"rollup": "0.64",
|
||||
"rollup-plugin-terser": "1",
|
||||
"tape": "4"
|
||||
}
|
||||
}
|
||||
36
node_modules/d3-transition/rollup.config.js
generated
vendored
Normal file
36
node_modules/d3-transition/rollup.config.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import {terser} from "rollup-plugin-terser";
|
||||
import * as meta from "./package.json";
|
||||
|
||||
const config = {
|
||||
input: "src/index.js",
|
||||
external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)),
|
||||
output: {
|
||||
file: `dist/${meta.name}.js`,
|
||||
name: "d3",
|
||||
format: "umd",
|
||||
indent: false,
|
||||
extend: true,
|
||||
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`,
|
||||
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"})))
|
||||
},
|
||||
plugins: []
|
||||
};
|
||||
|
||||
export default [
|
||||
config,
|
||||
{
|
||||
...config,
|
||||
output: {
|
||||
...config.output,
|
||||
file: `dist/${meta.name}.min.js`
|
||||
},
|
||||
plugins: [
|
||||
...config.plugins,
|
||||
terser({
|
||||
output: {
|
||||
preamble: config.output.banner
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
];
|
||||
21
node_modules/d3-transition/src/active.js
generated
vendored
Normal file
21
node_modules/d3-transition/src/active.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import {Transition} from "./transition/index";
|
||||
import {SCHEDULED} from "./transition/schedule";
|
||||
|
||||
var root = [null];
|
||||
|
||||
export default function(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;
|
||||
}
|
||||
4
node_modules/d3-transition/src/index.js
generated
vendored
Normal file
4
node_modules/d3-transition/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import "./selection/index";
|
||||
export {default as transition} from "./transition/index";
|
||||
export {default as active} from "./active";
|
||||
export {default as interrupt} from "./interrupt";
|
||||
24
node_modules/d3-transition/src/interrupt.js
generated
vendored
Normal file
24
node_modules/d3-transition/src/interrupt.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import {STARTING, ENDING, ENDED} from "./transition/schedule";
|
||||
|
||||
export default function(node, name) {
|
||||
var schedules = node.__transition,
|
||||
schedule,
|
||||
active,
|
||||
empty = true,
|
||||
i;
|
||||
|
||||
if (!schedules) return;
|
||||
|
||||
name = name == null ? null : name + "";
|
||||
|
||||
for (i in schedules) {
|
||||
if ((schedule = schedules[i]).name !== name) { empty = false; continue; }
|
||||
active = schedule.state > STARTING && schedule.state < ENDING;
|
||||
schedule.state = ENDED;
|
||||
schedule.timer.stop();
|
||||
if (active) schedule.on.call("interrupt", node, node.__data__, schedule.index, schedule.group);
|
||||
delete schedules[i];
|
||||
}
|
||||
|
||||
if (empty) delete node.__transition;
|
||||
}
|
||||
6
node_modules/d3-transition/src/selection/index.js
generated
vendored
Normal file
6
node_modules/d3-transition/src/selection/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import {selection} from "d3-selection";
|
||||
import selection_interrupt from "./interrupt";
|
||||
import selection_transition from "./transition";
|
||||
|
||||
selection.prototype.interrupt = selection_interrupt;
|
||||
selection.prototype.transition = selection_transition;
|
||||
7
node_modules/d3-transition/src/selection/interrupt.js
generated
vendored
Normal file
7
node_modules/d3-transition/src/selection/interrupt.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import interrupt from "../interrupt";
|
||||
|
||||
export default function(name) {
|
||||
return this.each(function() {
|
||||
interrupt(this, name);
|
||||
});
|
||||
}
|
||||
42
node_modules/d3-transition/src/selection/transition.js
generated
vendored
Normal file
42
node_modules/d3-transition/src/selection/transition.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
import {Transition, newId} from "../transition/index";
|
||||
import schedule from "../transition/schedule";
|
||||
import {easeCubicInOut} from "d3-ease";
|
||||
import {now} from "d3-timer";
|
||||
|
||||
var defaultTiming = {
|
||||
time: null, // Set on use.
|
||||
delay: 0,
|
||||
duration: 250,
|
||||
ease: easeCubicInOut
|
||||
};
|
||||
|
||||
function inherit(node, id) {
|
||||
var timing;
|
||||
while (!(timing = node.__transition) || !(timing = timing[id])) {
|
||||
if (!(node = node.parentNode)) {
|
||||
return defaultTiming.time = now(), defaultTiming;
|
||||
}
|
||||
}
|
||||
return timing;
|
||||
}
|
||||
|
||||
export default function(name) {
|
||||
var id,
|
||||
timing;
|
||||
|
||||
if (name instanceof Transition) {
|
||||
id = name._id, name = name._name;
|
||||
} else {
|
||||
id = newId(), (timing = defaultTiming).time = 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(groups, this._parents, name, id);
|
||||
}
|
||||
74
node_modules/d3-transition/src/transition/attr.js
generated
vendored
Normal file
74
node_modules/d3-transition/src/transition/attr.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
import {interpolateTransformSvg as interpolateTransform} from "d3-interpolate";
|
||||
import {namespace} from "d3-selection";
|
||||
import {tweenValue} from "./tween";
|
||||
import interpolate from "./interpolate";
|
||||
|
||||
function attrRemove(name) {
|
||||
return function() {
|
||||
this.removeAttribute(name);
|
||||
};
|
||||
}
|
||||
|
||||
function attrRemoveNS(fullname) {
|
||||
return function() {
|
||||
this.removeAttributeNS(fullname.space, fullname.local);
|
||||
};
|
||||
}
|
||||
|
||||
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 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 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 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);
|
||||
};
|
||||
}
|
||||
|
||||
export default function(name, value) {
|
||||
var fullname = namespace(name), i = fullname === "transform" ? interpolateTransform : 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 + ""));
|
||||
}
|
||||
32
node_modules/d3-transition/src/transition/attrTween.js
generated
vendored
Normal file
32
node_modules/d3-transition/src/transition/attrTween.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import {namespace} from "d3-selection";
|
||||
|
||||
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 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;
|
||||
}
|
||||
|
||||
export default function(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 = namespace(name);
|
||||
return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
|
||||
}
|
||||
23
node_modules/d3-transition/src/transition/delay.js
generated
vendored
Normal file
23
node_modules/d3-transition/src/transition/delay.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import {get, init} from "./schedule";
|
||||
|
||||
function delayFunction(id, value) {
|
||||
return function() {
|
||||
init(this, id).delay = +value.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function delayConstant(id, value) {
|
||||
return value = +value, function() {
|
||||
init(this, id).delay = value;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each((typeof value === "function"
|
||||
? delayFunction
|
||||
: delayConstant)(id, value))
|
||||
: get(this.node(), id).delay;
|
||||
}
|
||||
23
node_modules/d3-transition/src/transition/duration.js
generated
vendored
Normal file
23
node_modules/d3-transition/src/transition/duration.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import {get, set} from "./schedule";
|
||||
|
||||
function durationFunction(id, value) {
|
||||
return function() {
|
||||
set(this, id).duration = +value.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function durationConstant(id, value) {
|
||||
return value = +value, function() {
|
||||
set(this, id).duration = value;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each((typeof value === "function"
|
||||
? durationFunction
|
||||
: durationConstant)(id, value))
|
||||
: get(this.node(), id).duration;
|
||||
}
|
||||
16
node_modules/d3-transition/src/transition/ease.js
generated
vendored
Normal file
16
node_modules/d3-transition/src/transition/ease.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import {get, set} from "./schedule";
|
||||
|
||||
function easeConstant(id, value) {
|
||||
if (typeof value !== "function") throw new Error;
|
||||
return function() {
|
||||
set(this, id).ease = value;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(value) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length
|
||||
? this.each(easeConstant(id, value))
|
||||
: get(this.node(), id).ease;
|
||||
}
|
||||
16
node_modules/d3-transition/src/transition/filter.js
generated
vendored
Normal file
16
node_modules/d3-transition/src/transition/filter.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import {matcher} from "d3-selection";
|
||||
import {Transition} from "./index";
|
||||
|
||||
export default function(match) {
|
||||
if (typeof match !== "function") match = 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);
|
||||
}
|
||||
64
node_modules/d3-transition/src/transition/index.js
generated
vendored
Normal file
64
node_modules/d3-transition/src/transition/index.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import {selection} from "d3-selection";
|
||||
import transition_attr from "./attr";
|
||||
import transition_attrTween from "./attrTween";
|
||||
import transition_delay from "./delay";
|
||||
import transition_duration from "./duration";
|
||||
import transition_ease from "./ease";
|
||||
import transition_filter from "./filter";
|
||||
import transition_merge from "./merge";
|
||||
import transition_on from "./on";
|
||||
import transition_remove from "./remove";
|
||||
import transition_select from "./select";
|
||||
import transition_selectAll from "./selectAll";
|
||||
import transition_selection from "./selection";
|
||||
import transition_style from "./style";
|
||||
import transition_styleTween from "./styleTween";
|
||||
import transition_text from "./text";
|
||||
import transition_transition from "./transition";
|
||||
import transition_tween from "./tween";
|
||||
|
||||
var id = 0;
|
||||
|
||||
export function Transition(groups, parents, name, id) {
|
||||
this._groups = groups;
|
||||
this._parents = parents;
|
||||
this._name = name;
|
||||
this._id = id;
|
||||
}
|
||||
|
||||
export default function transition(name) {
|
||||
return selection().transition(name);
|
||||
}
|
||||
|
||||
export function newId() {
|
||||
return ++id;
|
||||
}
|
||||
|
||||
var selection_prototype = selection.prototype;
|
||||
|
||||
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
|
||||
};
|
||||
10
node_modules/d3-transition/src/transition/interpolate.js
generated
vendored
Normal file
10
node_modules/d3-transition/src/transition/interpolate.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import {color} from "d3-color";
|
||||
import {interpolateNumber, interpolateRgb, interpolateString} from "d3-interpolate";
|
||||
|
||||
export default function(a, b) {
|
||||
var c;
|
||||
return (typeof b === "number" ? interpolateNumber
|
||||
: b instanceof color ? interpolateRgb
|
||||
: (c = color(b)) ? (b = c, interpolateRgb)
|
||||
: interpolateString)(a, b);
|
||||
}
|
||||
19
node_modules/d3-transition/src/transition/merge.js
generated
vendored
Normal file
19
node_modules/d3-transition/src/transition/merge.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import {Transition} from "./index";
|
||||
|
||||
export default function(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);
|
||||
}
|
||||
32
node_modules/d3-transition/src/transition/on.js
generated
vendored
Normal file
32
node_modules/d3-transition/src/transition/on.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import {get, set, init} from "./schedule";
|
||||
|
||||
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";
|
||||
});
|
||||
}
|
||||
|
||||
function onFunction(id, name, listener) {
|
||||
var on0, on1, sit = start(name) ? init : set;
|
||||
return function() {
|
||||
var schedule = sit(this, id),
|
||||
on = schedule.on;
|
||||
|
||||
// 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);
|
||||
|
||||
schedule.on = on1;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(name, listener) {
|
||||
var id = this._id;
|
||||
|
||||
return arguments.length < 2
|
||||
? get(this.node(), id).on.on(name)
|
||||
: this.each(onFunction(id, name, listener));
|
||||
}
|
||||
11
node_modules/d3-transition/src/transition/remove.js
generated
vendored
Normal file
11
node_modules/d3-transition/src/transition/remove.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
function removeFunction(id) {
|
||||
return function() {
|
||||
var parent = this.parentNode;
|
||||
for (var i in this.__transition) if (+i !== id) return;
|
||||
if (parent) parent.removeChild(this);
|
||||
};
|
||||
}
|
||||
|
||||
export default function() {
|
||||
return this.on("end.remove", removeFunction(this._id));
|
||||
}
|
||||
155
node_modules/d3-transition/src/transition/schedule.js
generated
vendored
Normal file
155
node_modules/d3-transition/src/transition/schedule.js
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
import {dispatch} from "d3-dispatch";
|
||||
import {timer, timeout} from "d3-timer";
|
||||
|
||||
var emptyOn = dispatch("start", "end", "interrupt");
|
||||
var emptyTween = [];
|
||||
|
||||
export var CREATED = 0;
|
||||
export var SCHEDULED = 1;
|
||||
export var STARTING = 2;
|
||||
export var STARTED = 3;
|
||||
export var RUNNING = 4;
|
||||
export var ENDING = 5;
|
||||
export var ENDED = 6;
|
||||
|
||||
export default function(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
|
||||
});
|
||||
}
|
||||
|
||||
export function init(node, id) {
|
||||
var schedule = get(node, id);
|
||||
if (schedule.state > CREATED) throw new Error("too late; already scheduled");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
export function set(node, id) {
|
||||
var schedule = get(node, id);
|
||||
if (schedule.state > STARTING) throw new Error("too late; already started");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
export function get(node, id) {
|
||||
var schedule = node.__transition;
|
||||
if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
|
||||
return schedule;
|
||||
}
|
||||
|
||||
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 = timer(schedule, 0, self.time);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
function start(elapsed) {
|
||||
var i, j, n, o;
|
||||
|
||||
// If the state is not SCHEDULED, then we previously errored on start.
|
||||
if (self.state !== SCHEDULED) return stop();
|
||||
|
||||
for (i in schedules) {
|
||||
o = schedules[i];
|
||||
if (o.name !== self.name) continue;
|
||||
|
||||
// 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 === RUNNING) {
|
||||
o.state = ENDED;
|
||||
o.timer.stop();
|
||||
o.on.call("interrupt", node, node.__data__, o.index, o.group);
|
||||
delete schedules[i];
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
timeout(function() {
|
||||
if (self.state === STARTED) {
|
||||
self.state = RUNNING;
|
||||
self.timer.restart(tick, self.delay, self.time);
|
||||
tick(elapsed);
|
||||
}
|
||||
});
|
||||
|
||||
// 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 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;
|
||||
|
||||
while (++i < n) {
|
||||
tween[i].call(null, t);
|
||||
}
|
||||
|
||||
// Dispatch the end event.
|
||||
if (self.state === ENDING) {
|
||||
self.on.call("end", node, node.__data__, self.index, self.group);
|
||||
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;
|
||||
}
|
||||
}
|
||||
22
node_modules/d3-transition/src/transition/select.js
generated
vendored
Normal file
22
node_modules/d3-transition/src/transition/select.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import {selector} from "d3-selection";
|
||||
import {Transition} from "./index";
|
||||
import schedule, {get} from "./schedule";
|
||||
|
||||
export default function(select) {
|
||||
var name = this._name,
|
||||
id = this._id;
|
||||
|
||||
if (typeof select !== "function") select = 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);
|
||||
}
|
||||
26
node_modules/d3-transition/src/transition/selectAll.js
generated
vendored
Normal file
26
node_modules/d3-transition/src/transition/selectAll.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import {selectorAll} from "d3-selection";
|
||||
import {Transition} from "./index";
|
||||
import schedule, {get} from "./schedule";
|
||||
|
||||
export default function(select) {
|
||||
var name = this._name,
|
||||
id = this._id;
|
||||
|
||||
if (typeof select !== "function") select = 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Transition(subgroups, parents, name, id);
|
||||
}
|
||||
7
node_modules/d3-transition/src/transition/selection.js
generated
vendored
Normal file
7
node_modules/d3-transition/src/transition/selection.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import {selection} from "d3-selection";
|
||||
|
||||
var Selection = selection.prototype.constructor;
|
||||
|
||||
export default function() {
|
||||
return new Selection(this._groups, this._parents);
|
||||
}
|
||||
58
node_modules/d3-transition/src/transition/style.js
generated
vendored
Normal file
58
node_modules/d3-transition/src/transition/style.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import {interpolateTransformCss as interpolateTransform} from "d3-interpolate";
|
||||
import {style} from "d3-selection";
|
||||
import {tweenValue} from "./tween";
|
||||
import interpolate from "./interpolate";
|
||||
|
||||
function styleRemove(name, interpolate) {
|
||||
var value00,
|
||||
value10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var value0 = style(this, name),
|
||||
value1 = (this.style.removeProperty(name), style(this, name));
|
||||
return value0 === value1 ? null
|
||||
: value0 === value00 && value1 === value10 ? interpolate0
|
||||
: interpolate0 = interpolate(value00 = value0, value10 = value1);
|
||||
};
|
||||
}
|
||||
|
||||
function styleRemoveEnd(name) {
|
||||
return function() {
|
||||
this.style.removeProperty(name);
|
||||
};
|
||||
}
|
||||
|
||||
function styleConstant(name, interpolate, value1) {
|
||||
var value00,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var value0 = style(this, name);
|
||||
return value0 === value1 ? null
|
||||
: value0 === value00 ? interpolate0
|
||||
: interpolate0 = interpolate(value00 = value0, value1);
|
||||
};
|
||||
}
|
||||
|
||||
function styleFunction(name, interpolate, value) {
|
||||
var value00,
|
||||
value10,
|
||||
interpolate0;
|
||||
return function() {
|
||||
var value0 = style(this, name),
|
||||
value1 = value(this);
|
||||
if (value1 == null) value1 = (this.style.removeProperty(name), style(this, name));
|
||||
return value0 === value1 ? null
|
||||
: value0 === value00 && value1 === value10 ? interpolate0
|
||||
: interpolate0 = interpolate(value00 = value0, value10 = value1);
|
||||
};
|
||||
}
|
||||
|
||||
export default function(name, value, priority) {
|
||||
var i = (name += "") === "transform" ? interpolateTransform : 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);
|
||||
}
|
||||
18
node_modules/d3-transition/src/transition/styleTween.js
generated
vendored
Normal file
18
node_modules/d3-transition/src/transition/styleTween.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
}
|
||||
|
||||
export default function(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));
|
||||
}
|
||||
20
node_modules/d3-transition/src/transition/text.js
generated
vendored
Normal file
20
node_modules/d3-transition/src/transition/text.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import {tweenValue} from "./tween";
|
||||
|
||||
function textConstant(value) {
|
||||
return function() {
|
||||
this.textContent = value;
|
||||
};
|
||||
}
|
||||
|
||||
function textFunction(value) {
|
||||
return function() {
|
||||
var value1 = value(this);
|
||||
this.textContent = value1 == null ? "" : value1;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(value) {
|
||||
return this.tween("text", typeof value === "function"
|
||||
? textFunction(tweenValue(this, "text", value))
|
||||
: textConstant(value == null ? "" : value + ""));
|
||||
}
|
||||
24
node_modules/d3-transition/src/transition/transition.js
generated
vendored
Normal file
24
node_modules/d3-transition/src/transition/transition.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import {Transition, newId} from "./index";
|
||||
import schedule, {get} from "./schedule";
|
||||
|
||||
export default function() {
|
||||
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);
|
||||
}
|
||||
81
node_modules/d3-transition/src/transition/tween.js
generated
vendored
Normal file
81
node_modules/d3-transition/src/transition/tween.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
import {get, set} from "./schedule";
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
schedule.tween = tween1;
|
||||
};
|
||||
}
|
||||
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
if (i === n) tween1.push(t);
|
||||
}
|
||||
|
||||
schedule.tween = tween1;
|
||||
};
|
||||
}
|
||||
|
||||
export default function(name, value) {
|
||||
var id = this._id;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));
|
||||
}
|
||||
|
||||
export function tweenValue(transition, name, value) {
|
||||
var id = transition._id;
|
||||
|
||||
transition.each(function() {
|
||||
var schedule = set(this, id);
|
||||
(schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
|
||||
});
|
||||
|
||||
return function(node) {
|
||||
return get(node, id).value[name];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user