d3-transition
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -1,1 +0,1 @@ | ||
var version = "0.0.6"; export * from "../index"; export {version}; | ||
var version = "0.0.7"; export * from "../index"; export {version}; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-selection'), require('d3-timer'), require('d3-ease')) : | ||
typeof define === 'function' && define.amd ? define('d3-transition', ['exports', 'd3-selection', 'd3-timer', 'd3-ease'], factory) : | ||
factory((global.d3_transition = {}),global.d3_selection,global.d3_timer,global.d3_ease); | ||
}(this, function (exports,d3Selection,d3Timer,d3Ease) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-selection'), require('d3-ease'), require('d3-interpolate'), require('d3-timer')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-selection', 'd3-ease', 'd3-interpolate', 'd3-timer'], factory) : | ||
(factory((global.d3_transition = {}),global.d3_selection,global.d3_ease,global.d3_interpolate,global.d3_timer)); | ||
}(this, function (exports,d3Selection,d3Ease,d3Interpolate,d3Timer) { 'use strict'; | ||
function selection_interrupt(name) { | ||
function selection_interrupt(/* TODO name */) { | ||
return this.each(function() { | ||
// TODO | ||
}); | ||
}; | ||
} | ||
function transition_ease(type, a, b) { | ||
var e = typeof type === "function" ? type : d3Ease.ease(type, a, b); | ||
return this.each(function() { | ||
// TODO | ||
// TODO transform interpolation | ||
function attrRemove(name) { | ||
return function() { | ||
this.removeAttribute(name); | ||
}; | ||
} | ||
function attrRemoveNS(fullname) { | ||
return function() { | ||
this.removeAttributeNS(fullname.space, fullname.local); | ||
}; | ||
} | ||
function attrConstant(name, value1) { | ||
return value1 += "", function() { | ||
var node = this, value0 = node.getAttribute(name), i; | ||
return value0 !== value1 && (i = d3Interpolate.interpolate(value0, value1), function(t) { | ||
node.setAttribute(name, i(t)); | ||
}); | ||
}; | ||
} | ||
function attrConstantNS(fullname, value1) { | ||
return value1 += "", function() { | ||
var node = this, value0 = node.getAttributeNS(fullname.space, fullname.local), i; | ||
return value0 !== value1 && (i = d3Interpolate.interpolate(value0, value1), function(t) { | ||
node.setAttributeNS(fullname.space, fullname.local, i(t)); | ||
}); | ||
}; | ||
} | ||
function attrFunction(name, value) { | ||
return function() { | ||
var node = this, value0, value1 = value.apply(node, arguments), i; | ||
if (value1 == null) return node.removeAttribute(name); | ||
value0 = node.getAttribute(name), value1 += ""; | ||
return value0 !== value1 && (i = d3Interpolate.interpolate(value0, value1), function(t) { | ||
node.setAttribute(name, i(t)); | ||
}); | ||
}; | ||
} | ||
function attrFunctionNS(fullname, value) { | ||
return function() { | ||
var node = this, value0, value1 = value.apply(node, arguments), i; | ||
if (value1 == null) return node.removeAttributeNS(fullname.space, fullname.local); | ||
value0 = node.getAttributeNS(fullname.space, fullname.local), value1 += ""; | ||
return value0 !== value1 && (i = d3Interpolate.interpolate(value0, value1), function(t) { | ||
node.setAttributeNS(fullname.space, fullname.local, i(t)); | ||
}); | ||
}; | ||
} | ||
function transition_attr(name, value) { | ||
if (arguments.length < 2) return this.tween("attr." + name); | ||
var fullname = d3Selection.namespace(name); | ||
return this.tween("attr." + name, (value == null | ||
? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function" | ||
? (fullname.local ? attrFunctionNS : attrFunction) | ||
: (fullname.local ? attrConstantNS : attrConstant)))(fullname, value)); | ||
} | ||
function initializeScheduleEntry(node, key, id, index, group, timing) { | ||
var schedule = node[key]; | ||
if (!schedule) node[key] = schedule = {active: null, pending: []}; | ||
else if (getScheduleEntry(node, key, id)) return; | ||
addScheduleEntry(node, key, { | ||
id: id, | ||
index: index, // For restoring context during callbacks. | ||
group: group, // For restoring context during callbacks. | ||
tweens: [], | ||
time: timing.time, | ||
delay: timing.delay, | ||
duration: timing.duration, | ||
ease: timing.ease, | ||
timer: null | ||
}); | ||
}; | ||
} | ||
var maxId = 0; | ||
function getScheduleEntry(node, key, id) { | ||
var schedule = node[key], entry = schedule.active; | ||
if (entry && entry.id === id) return entry; | ||
var pending = schedule.pending, i = pending.length; | ||
while (--i >= 0) if ((entry = pending[i]).id === id) return entry; | ||
} | ||
function Transition(root, depth, key, id) { | ||
this._root = root; | ||
this._depth = depth; | ||
this._key = key || "__transition__"; | ||
this._id = id || ++maxId; | ||
this.each(initialize(this._key, this._id)); | ||
}; | ||
function addScheduleEntry(node, key, entry) { | ||
var schedule = node[key]; | ||
function transition() { | ||
return new Transition([document.documentElement], 1); | ||
// Initialize the entry timer when the transition is created. The delay is not | ||
// known until the first callback! If the delay is greater than this first | ||
// sleep, sleep again; otherwise, start immediately. | ||
schedule.pending.push(entry); | ||
entry.timer = d3Timer.timer(function(elapsed, now) { | ||
if (entry.delay <= elapsed) start(elapsed - entry.delay, now); | ||
else entry.timer.restart(start, entry.delay, entry.time); | ||
}, 0, entry.time); | ||
function start(elapsed, now) { | ||
var pending = schedule.pending, | ||
tweens = entry.tweens, | ||
i, j, n, o; | ||
// Interrupt the active transition, if any. | ||
// TODO Dispatch the interrupt event (within try-catch). | ||
if (schedule.active) { | ||
schedule.active.timer.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! | ||
// TODO Would a map or linked list be more efficient here? | ||
for (i = 0, j = -1, n = pending.length; i < n; ++i) { | ||
o = pending[i]; | ||
if (o.id < entry.id) o.timer.stop(); | ||
else if (o.id > entry.id) pending[++j] = o; | ||
} | ||
pending.length = j + 1; | ||
// Mark this transition as active. | ||
schedule.active = entry; | ||
// 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.timerOnce(function() { | ||
if (schedule.active === entry) { | ||
entry.timer.restart(tick, entry.delay, entry.time); | ||
tick(elapsed); | ||
} | ||
}, 0, now); | ||
// TODO Dispatch the start event (within try-catch). | ||
// Note this must be done before the tweens are initialized. | ||
// Initialize the tweens, deleting null tweens. | ||
for (i = 0, j = -1, n = tweens.length; i < n; ++i) { | ||
if (o = tweens[i].value.call(node, node.__data__, entry.index, entry.group)) { | ||
tweens[++j] = o; | ||
} | ||
} | ||
tweens.length = j + 1; | ||
} | ||
function tween(t) { | ||
for (var tweens = entry.tweens, i = 0, n = tweens.length; i < n; ++i) { | ||
tweens[i].call(node, t); // TODO tween could throw | ||
} | ||
} | ||
// TODO Dispatch the end event (within try-catch). | ||
function tick(elapsed) { | ||
if (elapsed >= entry.duration) { // TODO capture duration to ensure immutability? | ||
tween(1); | ||
schedule.active = null; | ||
if (!schedule.pending.length) delete node[key]; | ||
entry.timer.stop(); | ||
} else { | ||
tween(entry.ease.ease(elapsed / entry.duration)); // TODO ease could throw | ||
} | ||
} | ||
} | ||
Transition.prototype = transition.prototype = { | ||
each: d3Selection.selection.prototype.each, | ||
ease: transition_ease | ||
}; | ||
function delayFunction(key, id, value) { | ||
return function() { | ||
getScheduleEntry(this, key, id).delay = +value.apply(this, arguments); | ||
}; | ||
} | ||
function initialize(key, id) { | ||
function delayConstant(key, id, value) { | ||
return value = +value, function() { | ||
getScheduleEntry(this, key, id).delay = value; | ||
}; | ||
} | ||
function transition_delay(value) { | ||
var id = this._id, | ||
key = this._key; | ||
return arguments.length | ||
? this.each((typeof value === "function" | ||
? delayFunction | ||
: delayConstant)(key, id, value)) | ||
: getScheduleEntry(this.node(), key, id).delay; | ||
} | ||
function durationFunction(key, id, value) { | ||
return function() { | ||
var lock = this[key] || (this[key] = new Lock); | ||
if (lock.scheduled(id)) return; | ||
getScheduleEntry(this, key, id).duration = +value.apply(this, arguments); | ||
}; | ||
} | ||
function Lock() { | ||
this.active = null; | ||
this.pending = []; | ||
function durationConstant(key, id, value) { | ||
return value = +value, function() { | ||
getScheduleEntry(this, key, id).duration = value; | ||
}; | ||
} | ||
Lock.prototype = { | ||
scheduled: function(id) { | ||
if (this.active && this.active.id === id) return true; | ||
var pending = this.pending, i = pending.length; | ||
while (--i >= 0) if (pending[i].id === id) return true; | ||
return false; | ||
function transition_duration(value) { | ||
var id = this._id, | ||
key = this._key; | ||
return arguments.length | ||
? this.each((typeof value === "function" | ||
? durationFunction | ||
: durationConstant)(key, id, value)) | ||
: getScheduleEntry(this.node(), key, id).duration; | ||
} | ||
function easeFunction(key, id, value) { | ||
return function() { | ||
getScheduleEntry(this, key, id).ease = value.apply(this, arguments); | ||
}; | ||
} | ||
function easeConstant(key, id, value) { | ||
return function() { | ||
getScheduleEntry(this, key, id).ease = value; | ||
}; | ||
} | ||
function transition_ease(value) { | ||
var id = this._id, | ||
key = this._key; | ||
return arguments.length | ||
? this.each((typeof value === "function" | ||
? easeFunction | ||
: easeConstant)(key, id, value)) | ||
: getScheduleEntry(this.node(), key, 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._key, this._id); | ||
} | ||
function transition_select(select) { | ||
var id = this._id, | ||
key = this._key; | ||
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; | ||
initializeScheduleEntry(subgroup[i], key, id, i, subgroup, getScheduleEntry(node, key, id)); | ||
} | ||
} | ||
} | ||
return new Transition(subgroups, this._parents, key, id); | ||
} | ||
function transition_selectAll(select) { | ||
var id = this._id, | ||
key = this._key; | ||
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, timing = getScheduleEntry(node, key, id), k = 0, l = children.length; k < l; ++k) { | ||
if (child = children[k]) { | ||
initializeScheduleEntry(child, key, id, k, children, timing); | ||
} | ||
} | ||
subgroups.push(children); | ||
parents.push(node); | ||
} | ||
} | ||
} | ||
return new Transition(groups, parents, key, id); | ||
} | ||
// TODO export from d3-selection | ||
function defaultView(node) { | ||
return node | ||
&& ((node.ownerDocument && node.ownerDocument.defaultView) // node is a Node | ||
|| (node.document && node) // node is a Window | ||
|| node.defaultView); // node is a Document | ||
} | ||
function styleRemove(name, value, priority) { | ||
return function() { | ||
var node = this, style = defaultView(node).getComputedStyle(node, null), value0 = style.getPropertyValue(name), value1 = (node.style.removeProperty(name), style.getPropertyValue(name)), i; | ||
return value0 !== value1 && (i = d3Interpolate.interpolate(value0, value1), function(t) { | ||
if (t === 1) node.style.removeProperty(name); | ||
else node.style.setProperty(name, i(t), priority); | ||
}); | ||
}; | ||
} | ||
function styleConstant(name, value1, priority) { | ||
return value1 += "", function() { | ||
var node = this, value0 = defaultView(node).getComputedStyle(node, null).getPropertyValue(name), i; | ||
return value0 !== value1 && (i = d3Interpolate.interpolate(value0, value1), function(t) { | ||
node.style.setProperty(name, i(t), priority); | ||
}); | ||
}; | ||
} | ||
function styleFunction(name, value, priority) { | ||
return function() { | ||
var node = this, value0, value1 = value.apply(node, arguments), i; | ||
if (value1 == null) return node.style.removeProperty(name); | ||
value0 = defaultView(node).getComputedStyle(node, null).getPropertyValue(name), value1 += ""; | ||
return value0 !== value1 && (i = d3Interpolate.interpolate(value0, value1), function(t) { | ||
node.style.setProperty(name, i(t), priority); | ||
}); | ||
}; | ||
} | ||
function transition_style(name, value, priority) { | ||
return arguments.length < 2 | ||
? this.tween("style." + name) | ||
: this.tween("style." + name, (value == null | ||
? styleRemove : (typeof value === "function" | ||
? styleFunction | ||
: styleConstant))(name, value, priority == null ? "" : priority)); | ||
} | ||
function tweenFunction(key, id, name, value) { | ||
return function() { | ||
var tweens = getScheduleEntry(this, key, id).tweens; | ||
for (var i = 0, n = tweens.length, t; i < n; ++i) { | ||
if ((t = tweens[i]).name === name) { | ||
return t.value = value; | ||
} | ||
} | ||
tweens.push({name: name, value: value}); | ||
}; | ||
} | ||
function transition_tween(name, value) { | ||
var sname = name + ""; | ||
if (arguments.length < 2) { | ||
var tweens = getScheduleEntry(this.node(), this._key, this._id).tweens; | ||
for (var i = 0, n = tweens.length, t; i < n; ++i) { | ||
if ((t = tweens[i]).name === sname) { | ||
return t; | ||
} | ||
} | ||
return null; | ||
} | ||
return this.each(tweenFunction(this._key, this._id, sname, value)); | ||
} | ||
var root = [null]; | ||
function Transition(groups, parents, key, id) { | ||
this._groups = groups; | ||
this._parents = parents; | ||
this._key = key; | ||
this._id = id; | ||
} | ||
function transition(name) { | ||
return new Transition([[document.documentElement]], root, namekey(name)); | ||
} | ||
function namekey(name) { | ||
return name ? "__transition_" + name + "__" : "__transition__"; | ||
} | ||
var selection_prototype = d3Selection.selection.prototype; | ||
Transition.prototype = transition.prototype = { | ||
select: transition_select, | ||
selectAll: transition_selectAll, | ||
filter: transition_filter, | ||
// TODO 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, | ||
// TODO each("event"), or on("event")? | ||
attr: transition_attr, | ||
// TODO attrTween | ||
style: transition_style, | ||
// TODO styleTween | ||
// TODO text | ||
// TODO remove | ||
tween: transition_tween, | ||
delay: transition_delay, | ||
duration: transition_duration, | ||
ease: transition_ease | ||
}; | ||
var nextId = 0; | ||
function selection_transition(name) { | ||
return new Transition(this._root, this._depth, name && ("__transition_ " + name + "_")); | ||
}; | ||
var id = ++nextId, | ||
key = namekey(name), | ||
timing = {time: Date.now(), delay: 0, duration: 250, ease: d3Ease.easeCubicInOut}; | ||
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, i = 0; i < n; ++i) { | ||
if (node = group[i]) { | ||
initializeScheduleEntry(subgroup[i] = node, key, id, i, subgroup, timing); | ||
} | ||
} | ||
} | ||
return new Transition(subgroups, this._parents, key, id); | ||
} | ||
d3Selection.selection.prototype.interrupt = selection_interrupt; | ||
d3Selection.selection.prototype.transition = selection_transition; | ||
var version = "0.0.6"; | ||
var version = "0.0.7"; | ||
@@ -69,0 +447,0 @@ exports.version = version; |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-selection"),require("d3-timer"),require("d3-ease")):"function"==typeof define&&define.amd?define("d3-transition",["exports","d3-selection","d3-timer","d3-ease"],e):e(t.d3_transition={},t.d3_selection,t.d3_timer,t.d3_ease)}(this,function(t,e,i,n){"use strict";function o(t){return this.each(function(){})}function r(t,e,i){"function"==typeof t?t:n.ease(t,e,i);return this.each(function(){})}function s(t,e,i,n){this._root=t,this._depth=e,this._key=i||"__transition__",this._id=n||++f,this.each(u(this._key,this._id))}function c(){return new s([document.documentElement],1)}function u(t,e){return function(){var i=this[t]||(this[t]=new d);i.scheduled(e)}}function d(){this.active=null,this.pending=[]}function h(t){return new s(this._root,this._depth,t&&"__transition_ "+t+"_")}var f=0;s.prototype=c.prototype={each:e.selection.prototype.each,ease:r},d.prototype={scheduled:function(t){if(this.active&&this.active.id===t)return!0;for(var e=this.pending,i=e.length;--i>=0;)if(e[i].id===t)return!0;return!1}},e.selection.prototype.interrupt=o,e.selection.prototype.transition=h;var a="0.0.6";t.version=a,t.transition=c}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-selection"),require("d3-ease"),require("d3-interpolate"),require("d3-timer")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-ease","d3-interpolate","d3-timer"],e):e(t.d3_transition={},t.d3_selection,t.d3_ease,t.d3_interpolate,t.d3_timer)}(this,function(t,e,n,r,i){"use strict";function u(){return this.each(function(){})}function o(t){return function(){this.removeAttribute(t)}}function a(t){return function(){this.removeAttributeNS(t.space,t.local)}}function s(t,e){return e+="",function(){var n,i=this,u=i.getAttribute(t);return u!==e&&(n=r.interpolate(u,e),function(e){i.setAttribute(t,n(e))})}}function l(t,e){return e+="",function(){var n,i=this,u=i.getAttributeNS(t.space,t.local);return u!==e&&(n=r.interpolate(u,e),function(e){i.setAttributeNS(t.space,t.local,n(e))})}}function c(t,e){return function(){var n,i,u=this,o=e.apply(u,arguments);return null==o?u.removeAttribute(t):(n=u.getAttribute(t),o+="",n!==o&&(i=r.interpolate(n,o),function(e){u.setAttribute(t,i(e))}))}}function f(t,e){return function(){var n,i,u=this,o=e.apply(u,arguments);return null==o?u.removeAttributeNS(t.space,t.local):(n=u.getAttributeNS(t.space,t.local),o+="",n!==o&&(i=r.interpolate(n,o),function(e){u.setAttributeNS(t.space,t.local,i(e))}))}}function h(t,n){if(arguments.length<2)return this.tween("attr."+t);var r=e.namespace(t);return this.tween("attr."+t,(null==n?r.local?a:o:"function"==typeof n?r.local?f:c:r.local?l:s)(r,n))}function p(t,e,n,r,i,u){var o=t[e];if(o){if(d(t,e,n))return}else t[e]=o={active:null,pending:[]};y(t,e,{id:n,index:r,group:i,tweens:[],time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null})}function d(t,e,n){var r=t[e],i=r.active;if(i&&i.id===n)return i;for(var u=r.pending,o=u.length;--o>=0;)if((i=u[o]).id===n)return i}function y(t,e,n){function r(e,r){var u,s,l,c,f=a.pending,h=n.tweens;for(a.active&&a.active.timer.stop(),u=0,s=-1,l=f.length;l>u;++u)c=f[u],c.id<n.id?c.timer.stop():c.id>n.id&&(f[++s]=c);for(f.length=s+1,a.active=n,i.timerOnce(function(){a.active===n&&(n.timer.restart(o,n.delay,n.time),o(e))},0,r),u=0,s=-1,l=h.length;l>u;++u)(c=h[u].value.call(t,t.__data__,n.index,n.group))&&(h[++s]=c);h.length=s+1}function u(e){for(var r=n.tweens,i=0,u=r.length;u>i;++i)r[i].call(t,e)}function o(r){r>=n.duration?(u(1),a.active=null,a.pending.length||delete t[e],n.timer.stop()):u(n.ease.ease(r/n.duration))}var a=t[e];a.pending.push(n),n.timer=i.timer(function(t,e){n.delay<=t?r(t-n.delay,e):n.timer.restart(r,n.delay,n.time)},0,n.time)}function _(t,e,n){return function(){d(this,t,e).delay=+n.apply(this,arguments)}}function g(t,e,n){return n=+n,function(){d(this,t,e).delay=n}}function m(t){var e=this._id,n=this._key;return arguments.length?this.each(("function"==typeof t?_:g)(n,e,t)):d(this.node(),n,e).delay}function v(t,e,n){return function(){d(this,t,e).duration=+n.apply(this,arguments)}}function w(t,e,n){return n=+n,function(){d(this,t,e).duration=n}}function A(t){var e=this._id,n=this._key;return arguments.length?this.each(("function"==typeof t?v:w)(n,e,t)):d(this.node(),n,e).duration}function b(t,e,n){return function(){d(this,t,e).ease=n.apply(this,arguments)}}function P(t,e,n){return function(){d(this,t,e).ease=n}}function k(t){var e=this._id,n=this._key;return arguments.length?this.each(("function"==typeof t?b:P)(n,e,t)):d(this.node(),n,e).ease}function S(t){"function"!=typeof t&&(t=e.matcher(t));for(var n=this._groups,r=n.length,i=new Array(r),u=0;r>u;++u)for(var o,a=n[u],s=a.length,l=i[u]=[],c=0;s>c;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new E(i,this._parents,this._key,this._id)}function N(t){var n=this._id,r=this._key;"function"!=typeof t&&(t=e.selector(t));for(var i=this._groups,u=i.length,o=new Array(u),a=0;u>a;++a)for(var s,l,c=i[a],f=c.length,h=o[a]=new Array(f),y=0;f>y;++y)(s=c[y])&&(l=t.call(s,s.__data__,y,c))&&("__data__"in s&&(l.__data__=s.__data__),h[y]=l,p(h[y],r,n,y,h,d(s,r,n)));return new E(o,this._parents,r,n)}function V(t){var n=this._id,r=this._key;"function"!=typeof t&&(t=e.selectorAll(t));for(var i=this._groups,u=i.length,o=[],a=[],s=0;u>s;++s)for(var l,c=i[s],f=c.length,h=0;f>h;++h)if(l=c[h]){for(var y,_=t.call(l,l.__data__,h,c),g=d(l,r,n),m=0,v=_.length;v>m;++m)(y=_[m])&&p(y,r,n,m,_,g);o.push(_),a.push(l)}return new E(i,a,r,n)}function x(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function q(t,e,n){return function(){var e,i=this,u=x(i).getComputedStyle(i,null),o=u.getPropertyValue(t),a=(i.style.removeProperty(t),u.getPropertyValue(t));return o!==a&&(e=r.interpolate(o,a),function(r){1===r?i.style.removeProperty(t):i.style.setProperty(t,e(r),n)})}}function C(t,e,n){return e+="",function(){var i,u=this,o=x(u).getComputedStyle(u,null).getPropertyValue(t);return o!==e&&(i=r.interpolate(o,e),function(e){u.style.setProperty(t,i(e),n)})}}function D(t,e,n){return function(){var i,u,o=this,a=e.apply(o,arguments);return null==a?o.style.removeProperty(t):(i=x(o).getComputedStyle(o,null).getPropertyValue(t),a+="",i!==a&&(u=r.interpolate(i,a),function(e){o.style.setProperty(t,u(e),n)}))}}function z(t,e,n){return arguments.length<2?this.tween("style."+t):this.tween("style."+t,(null==e?q:"function"==typeof e?D:C)(t,e,null==n?"":n))}function O(t,e,n,r){return function(){for(var i,u=d(this,t,e).tweens,o=0,a=u.length;a>o;++o)if((i=u[o]).name===n)return i.value=r;u.push({name:n,value:r})}}function j(t,e){var n=t+"";if(arguments.length<2){for(var r,i=d(this.node(),this._key,this._id).tweens,u=0,o=i.length;o>u;++u)if((r=i[u]).name===n)return r;return null}return this.each(O(this._key,this._id,n,e))}function E(t,e,n,r){this._groups=t,this._parents=e,this._key=n,this._id=r}function I(t){return new E([[document.documentElement]],G,B(t))}function B(t){return t?"__transition_"+t+"__":"__transition__"}function F(t){for(var e=++J,r=B(t),i={time:Date.now(),delay:0,duration:250,ease:n.easeCubicInOut},u=this._groups,o=u.length,a=new Array(o),s=0;o>s;++s)for(var l,c=u[s],f=c.length,h=a[s]=new Array(f),d=0;f>d;++d)(l=c[d])&&p(h[d]=l,r,e,d,h,i);return new E(a,this._parents,r,e)}var G=[null],H=e.selection.prototype;E.prototype=I.prototype={select:N,selectAll:V,filter:S,call:H.call,nodes:H.nodes,node:H.node,size:H.size,empty:H.empty,each:H.each,attr:h,style:z,tween:j,delay:m,duration:A,ease:k};var J=0;e.selection.prototype.interrupt=u,e.selection.prototype.transition=F;var K="0.0.7";t.version=K,t.transition=I}); |
10
index.js
@@ -1,8 +0,2 @@ | ||
import {selection} from "d3-selection"; | ||
import selection_interrupt from "./src/selection-interrupt"; | ||
import selection_transition from "./src/selection-transition"; | ||
selection.prototype.interrupt = selection_interrupt; | ||
selection.prototype.transition = selection_transition; | ||
export {default as transition} from "./src/transition"; | ||
import "./src/selection/index"; | ||
export {default as transition} from "./src/transition/index"; |
{ | ||
"name": "d3-transition", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Animated transitions for D3 selections.", | ||
@@ -24,15 +24,17 @@ "keywords": [ | ||
"scripts": { | ||
"pretest": "mkdir -p build && node -e 'process.stdout.write(\"var version = \\\"\" + require(\"./package.json\").version + \"\\\"; export * from \\\"../index\\\"; export {version};\");' > build/bundle.js && rollup -f umd -g d3-ease:d3_ease,d3-selection:d3_selection,d3-timer:d3_timer -u d3-transition -n d3_transition -o build/d3-transition.js -- build/bundle.js", | ||
"test": "faucet `find test -name '*-test.js'`", | ||
"prepublish": "npm run test && uglifyjs build/d3-transition.js -c -m -o build/d3-transition.min.js && rm -f build/d3-transition.zip && zip -j build/d3-transition.zip -- LICENSE README.md build/d3-transition.js build/d3-transition.min.js" | ||
"pretest": "mkdir -p build && node -e 'process.stdout.write(\"var version = \\\"\" + require(\"./package.json\").version + \"\\\"; export * from \\\"../index\\\"; export {version};\");' > build/bundle.js && rollup -f umd -g d3-interpolate:d3_interpolate,d3-ease:d3_ease,d3-selection:d3_selection,d3-timer:d3_timer -n d3_transition -o build/d3-transition.js -- build/bundle.js", | ||
"test": "faucet `find test -name '*-test.js'` && eslint index.js src", | ||
"prepublish": "npm run test && uglifyjs build/d3-transition.js -c -m -o build/d3-transition.min.js && rm -f build/d3-transition.zip && zip -j build/d3-transition.zip -- LICENSE README.md build/d3-transition.js build/d3-transition.min.js", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git tag -am \"Release $VERSION.\" v${VERSION} && git push --tags && cp build/d3-transition.js ../d3.github.com/d3-transition.v0.0.js && cp build/d3-transition.min.js ../d3.github.com/d3-transition.v0.0.min.js && cd ../d3.github.com && git add d3-transition.v0.0.js d3-transition.v0.0.min.js && git commit -m \"d3-transition ${VERSION}\" && git push" | ||
}, | ||
"dependencies": { | ||
"d3-ease": "~0.1.5", | ||
"d3-selection": "~0.4.12", | ||
"d3-timer": "~0.0.6" | ||
"d3-ease": "~0.6.0", | ||
"d3-interpolate": "~0.5.0", | ||
"d3-selection": "~0.6.7", | ||
"d3-timer": "~0.1.2" | ||
}, | ||
"devDependencies": { | ||
"faucet": "0.0", | ||
"rollup": "0.20.5", | ||
"jsdom": "7", | ||
"rollup": "0.25", | ||
"jsdom": "8", | ||
"tape": "4", | ||
@@ -39,0 +41,0 @@ "uglify-js": "2" |
# d3-transition | ||
… TODO | ||
## Installing | ||
If you use NPM, `npm install d3-transition`. Otherwise, download the [latest release](https://github.com/d3/d3-transition/releases/latest). The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom build using [Rollup](https://github.com/rollup/rollup) or your preferred bundler. You can also load directly from [d3js.org](https://d3js.org): | ||
```html | ||
<script src="https://d3js.org/d3-ease.v0.6.min.js"></script> | ||
<script src="https://d3js.org/d3-color.v0.4.min.js"></script> | ||
<script src="https://d3js.org/d3-interpolate.v0.5.min.js"></script> | ||
<script src="https://d3js.org/d3-selection.v0.6.min.js"></script> | ||
<script src="https://d3js.org/d3-timer.v0.1.min.js"></script> | ||
<script src="https://d3js.org/d3-transition.v0.0.min.js"></script> | ||
``` | ||
In a vanilla environment, a `d3_transition` global is exported. [Try d3-transition in your browser.](https://tonicdev.com/npm/d3-transition) | ||
## API Reference | ||
… TODO |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
43511
23
785
24
4
+ Addedd3-interpolate@~0.5.0
+ Addedd3-color@0.4.2(transitive)
+ Addedd3-ease@0.6.0(transitive)
+ Addedd3-interpolate@0.5.2(transitive)
+ Addedd3-selection@0.6.12(transitive)
+ Addedd3-timer@0.1.2(transitive)
- Removedd3-ease@0.1.5(transitive)
- Removedd3-selection@0.4.12(transitive)
- Removedd3-timer@0.0.6(transitive)
Updatedd3-ease@~0.6.0
Updatedd3-selection@~0.6.7
Updatedd3-timer@~0.1.2