d3-flame-graph
Advanced tools
Comparing version 2.1.11 to 2.1.12
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory((global.d3 = global.d3 || {}, global.d3.flamegraph = global.d3.flamegraph || {}, global.d3.flamegraph.tooltip = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dispatch'), require('d3-timer'), require('d3-interpolate'), require('d3-color'), require('d3-ease')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-dispatch', 'd3-timer', 'd3-interpolate', 'd3-color', 'd3-ease'], factory) : | ||
(global = global || self, factory((global.d3 = global.d3 || {}, global.d3.flamegraph = global.d3.flamegraph || {}, global.d3.flamegraph.tooltip = {}), global.d3Dispatch, global.d3Timer, global.d3Interpolate, global.d3Color, global.d3Ease)); | ||
}(this, (function (exports, d3Dispatch, d3Timer, d3Interpolate, d3Color, d3Ease) { 'use strict'; | ||
@@ -868,2 +868,823 @@ var xhtml = "http://www.w3.org/1999/xhtml"; | ||
var emptyOn = d3Dispatch.dispatch("start", "end", "cancel", "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 > STARTED) throw new Error("too late; already running"); | ||
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. | ||
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. | ||
else if (+i < id) { | ||
o.state = ENDED; | ||
o.timer.stop(); | ||
o.on.call("cancel", node, node.__data__, o.index, o.group); | ||
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(node, 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, | ||
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(); | ||
schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.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 = 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; | ||
}; | ||
} | ||
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 = set(this, id); | ||
(schedule.value || (schedule.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$1(name) { | ||
return function() { | ||
this.removeAttribute(name); | ||
}; | ||
} | ||
function attrRemoveNS$1(fullname) { | ||
return function() { | ||
this.removeAttributeNS(fullname.space, fullname.local); | ||
}; | ||
} | ||
function attrConstant$1(name, interpolate, value1) { | ||
var string00, | ||
string1 = value1 + "", | ||
interpolate0; | ||
return function() { | ||
var string0 = this.getAttribute(name); | ||
return string0 === string1 ? null | ||
: string0 === string00 ? interpolate0 | ||
: interpolate0 = interpolate(string00 = string0, value1); | ||
}; | ||
} | ||
function attrConstantNS$1(fullname, interpolate, value1) { | ||
var string00, | ||
string1 = value1 + "", | ||
interpolate0; | ||
return function() { | ||
var string0 = this.getAttributeNS(fullname.space, fullname.local); | ||
return string0 === string1 ? null | ||
: string0 === string00 ? interpolate0 | ||
: interpolate0 = interpolate(string00 = string0, value1); | ||
}; | ||
} | ||
function attrFunction$1(name, interpolate, value) { | ||
var string00, | ||
string10, | ||
interpolate0; | ||
return function() { | ||
var string0, value1 = value(this), string1; | ||
if (value1 == null) return void this.removeAttribute(name); | ||
string0 = this.getAttribute(name); | ||
string1 = value1 + ""; | ||
return string0 === string1 ? null | ||
: string0 === string00 && string1 === string10 ? interpolate0 | ||
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1)); | ||
}; | ||
} | ||
function attrFunctionNS$1(fullname, interpolate, value) { | ||
var string00, | ||
string10, | ||
interpolate0; | ||
return function() { | ||
var string0, value1 = value(this), string1; | ||
if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local); | ||
string0 = this.getAttributeNS(fullname.space, fullname.local); | ||
string1 = value1 + ""; | ||
return string0 === string1 ? null | ||
: string0 === string00 && string1 === string10 ? interpolate0 | ||
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1)); | ||
}; | ||
} | ||
function transition_attr(name, value) { | ||
var fullname = namespace(name), i = fullname === "transform" ? d3Interpolate.interpolateTransformSvg : interpolate; | ||
return this.attrTween(name, typeof value === "function" | ||
? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value)) | ||
: value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname) | ||
: (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value)); | ||
} | ||
function attrInterpolate(name, i) { | ||
return function(t) { | ||
this.setAttribute(name, i(t)); | ||
}; | ||
} | ||
function attrInterpolateNS(fullname, i) { | ||
return function(t) { | ||
this.setAttributeNS(fullname.space, fullname.local, i(t)); | ||
}; | ||
} | ||
function attrTweenNS(fullname, value) { | ||
var t0, i0; | ||
function tween() { | ||
var i = value.apply(this, arguments); | ||
if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i); | ||
return t0; | ||
} | ||
tween._value = value; | ||
return tween; | ||
} | ||
function attrTween(name, value) { | ||
var t0, i0; | ||
function tween() { | ||
var i = value.apply(this, arguments); | ||
if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i); | ||
return t0; | ||
} | ||
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 = 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 = matcher(match); | ||
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { | ||
for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { | ||
if ((node = group[i]) && match.call(node, node.__data__, i, group)) { | ||
subgroup.push(node); | ||
} | ||
} | ||
} | ||
return new Transition(subgroups, this._parents, this._name, this._id); | ||
} | ||
function transition_merge(transition) { | ||
if (transition._id !== this._id) throw new Error; | ||
for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { | ||
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { | ||
if (node = group0[i] || group1[i]) { | ||
merge[i] = node; | ||
} | ||
} | ||
} | ||
for (; j < m0; ++j) { | ||
merges[j] = groups0[j]; | ||
} | ||
return new Transition(merges, this._parents, this._name, this._id); | ||
} | ||
function start(name) { | ||
return (name + "").trim().split(/^|\s+/).every(function(t) { | ||
var i = t.indexOf("."); | ||
if (i >= 0) t = t.slice(0, i); | ||
return !t || t === "start"; | ||
}); | ||
} | ||
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; | ||
}; | ||
} | ||
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 = 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 = 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$1 = selection.prototype.constructor; | ||
function transition_selection() { | ||
return new Selection$1(this._groups, this._parents); | ||
} | ||
function styleNull(name, interpolate) { | ||
var string00, | ||
string10, | ||
interpolate0; | ||
return function() { | ||
var string0 = styleValue(this, name), | ||
string1 = (this.style.removeProperty(name), styleValue(this, name)); | ||
return string0 === string1 ? null | ||
: string0 === string00 && string1 === string10 ? interpolate0 | ||
: interpolate0 = interpolate(string00 = string0, string10 = string1); | ||
}; | ||
} | ||
function styleRemove$1(name) { | ||
return function() { | ||
this.style.removeProperty(name); | ||
}; | ||
} | ||
function styleConstant$1(name, interpolate, value1) { | ||
var string00, | ||
string1 = value1 + "", | ||
interpolate0; | ||
return function() { | ||
var string0 = styleValue(this, name); | ||
return string0 === string1 ? null | ||
: string0 === string00 ? interpolate0 | ||
: interpolate0 = interpolate(string00 = string0, value1); | ||
}; | ||
} | ||
function styleFunction$1(name, interpolate, value) { | ||
var string00, | ||
string10, | ||
interpolate0; | ||
return function() { | ||
var string0 = styleValue(this, name), | ||
value1 = value(this), | ||
string1 = value1 + ""; | ||
if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name)); | ||
return string0 === string1 ? null | ||
: string0 === string00 && string1 === string10 ? interpolate0 | ||
: (string10 = string1, interpolate0 = interpolate(string00 = string0, value1)); | ||
}; | ||
} | ||
function styleMaybeRemove(id, name) { | ||
var on0, on1, listener0, key = "style." + name, event = "end." + key, remove; | ||
return function() { | ||
var schedule = set(this, id), | ||
on = schedule.on, | ||
listener = schedule.value[key] == null ? remove || (remove = styleRemove$1(name)) : undefined; | ||
// 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 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener); | ||
schedule.on = on1; | ||
}; | ||
} | ||
function transition_style(name, value, priority) { | ||
var i = (name += "") === "transform" ? d3Interpolate.interpolateTransformCss : interpolate; | ||
return value == null ? this | ||
.styleTween(name, styleNull(name, i)) | ||
.on("end.style." + name, styleRemove$1(name)) | ||
: typeof value === "function" ? this | ||
.styleTween(name, styleFunction$1(name, i, tweenValue(this, "style." + name, value))) | ||
.each(styleMaybeRemove(this._id, name)) | ||
: this | ||
.styleTween(name, styleConstant$1(name, i, value), priority) | ||
.on("end.style." + name, null); | ||
} | ||
function styleInterpolate(name, i, priority) { | ||
return function(t) { | ||
this.style.setProperty(name, i(t), priority); | ||
}; | ||
} | ||
function styleTween(name, value, priority) { | ||
var t, i0; | ||
function tween() { | ||
var i = value.apply(this, arguments); | ||
if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority); | ||
return t; | ||
} | ||
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$1(value) { | ||
return function() { | ||
this.textContent = value; | ||
}; | ||
} | ||
function textFunction$1(value) { | ||
return function() { | ||
var value1 = value(this); | ||
this.textContent = value1 == null ? "" : value1; | ||
}; | ||
} | ||
function transition_text(value) { | ||
return this.tween("text", typeof value === "function" | ||
? textFunction$1(tweenValue(this, "text", value)) | ||
: textConstant$1(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); | ||
} | ||
function transition_end() { | ||
var on0, on1, that = this, id = that._id, size = that.size(); | ||
return new Promise(function(resolve, reject) { | ||
var cancel = {value: reject}, | ||
end = {value: function() { if (--size === 0) resolve(); }}; | ||
that.each(function() { | ||
var schedule = set(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(); | ||
on1._.cancel.push(cancel); | ||
on1._.interrupt.push(cancel); | ||
on1._.end.push(end); | ||
} | ||
schedule.on = on1; | ||
}); | ||
}); | ||
} | ||
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 selection().transition(name); | ||
} | ||
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, | ||
end: transition_end | ||
}; | ||
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); | ||
} | ||
selection.prototype.interrupt = selection_interrupt; | ||
selection.prototype.transition = selection_transition; | ||
function defaultLabel (d) { | ||
@@ -870,0 +1691,0 @@ return d.data.name |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((t=t||self).d3=t.d3||{},t.d3.flamegraph=t.d3.flamegraph||{},t.d3.flamegraph.tooltip={}))}(this,(function(t){"use strict";var n="http://www.w3.org/1999/xhtml",e={svg:"http://www.w3.org/2000/svg",xhtml:n,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var n=t+="",r=n.indexOf(":");return r>=0&&"xmlns"!==(n=t.slice(0,r))&&(t=t.slice(r+1)),e.hasOwnProperty(n)?{space:e[n],local:t}:t}function i(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===n&&e.documentElement.namespaceURI===n?e.createElement(t):e.createElementNS(r,t)}}function o(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function u(t){var n=r(t);return(n.local?o:i)(n)}function s(){}function a(t){return null==t?s:function(){return this.querySelector(t)}}function c(){return[]}function l(t){return new Array(t.length)}function f(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}f.prototype={constructor:f,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var h="$";function p(t,n,e,r,i,o){for(var u,s=0,a=n.length,c=o.length;s<c;++s)(u=n[s])?(u.__data__=o[s],r[s]=u):e[s]=new f(t,o[s]);for(;s<a;++s)(u=n[s])&&(i[s]=u)}function _(t,n,e,r,i,o,u){var s,a,c,l={},p=n.length,_=o.length,d=new Array(p);for(s=0;s<p;++s)(a=n[s])&&(d[s]=c=h+u.call(a,a.__data__,s,n),c in l?i[s]=a:l[c]=a);for(s=0;s<_;++s)(a=l[c=h+u.call(t,o[s],s,o)])?(r[s]=a,a.__data__=o[s],l[c]=null):e[s]=new f(t,o[s]);for(s=0;s<p;++s)(a=n[s])&&l[d[s]]===a&&(i[s]=a)}function d(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function y(t){return function(){this.removeAttribute(t)}}function v(t){return function(){this.removeAttributeNS(t.space,t.local)}}function m(t,n){return function(){this.setAttribute(t,n)}}function g(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function w(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function A(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function x(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function b(t){return function(){this.style.removeProperty(t)}}function S(t,n,e){return function(){this.style.setProperty(t,n,e)}}function N(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function E(t){return function(){delete this[t]}}function C(t,n){return function(){this[t]=n}}function P(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function L(t){return t.trim().split(/^|\s+/)}function B(t){return t.classList||new D(t)}function D(t){this._node=t,this._names=L(t.getAttribute("class")||"")}function O(t,n){for(var e=B(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function q(t,n){for(var e=B(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function M(t){return function(){O(this,t)}}function T(t){return function(){q(this,t)}}function j(t,n){return function(){(n.apply(this,arguments)?O:q)(this,t)}}function H(){this.textContent=""}function I(t){return function(){this.textContent=t}}function R(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function U(){this.innerHTML=""}function V(t){return function(){this.innerHTML=t}}function k(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function z(){this.nextSibling&&this.parentNode.appendChild(this)}function X(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Y(){return null}function $(){var t=this.parentNode;t&&t.removeChild(this)}function F(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function G(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}D.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var J={},K=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(J={mouseenter:"mouseover",mouseleave:"mouseout"}));function Q(t,n,e){return t=W(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function W(t,n,e){return function(r){var i=K;K=r;try{t.call(this,this.__data__,n,e)}finally{K=i}}}function Z(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function tt(t,n,e){var r=J.hasOwnProperty(t.type)?Q:W;return function(i,o,u){var s,a=this.__on,c=r(n,o,u);if(a)for(var l=0,f=a.length;l<f;++l)if((s=a[l]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=c,s.capture=e),void(s.value=n);this.addEventListener(t.type,c,e),s={type:t.type,name:t.name,value:n,listener:c,capture:e},a?a.push(s):this.__on=[s]}}function nt(t,n,e){var r=x(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function et(t,n){return function(){return nt(this,t,n)}}function rt(t,n){return function(){return nt(this,t,n.apply(this,arguments))}}var it=[null];function ot(t,n){this._groups=t,this._parents=n}function ut(t){return t.data.name}ot.prototype=function(){return new ot([[document.documentElement]],it)}.prototype={constructor:ot,select:function(t){"function"!=typeof t&&(t=a(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,s=n[i],c=s.length,l=r[i]=new Array(c),f=0;f<c;++f)(o=s[f])&&(u=t.call(o,o.__data__,f,s))&&("__data__"in o&&(u.__data__=o.__data__),l[f]=u);return new ot(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=function(t){return null==t?c:function(){return this.querySelectorAll(t)}}(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var u,s=n[o],a=s.length,l=0;l<a;++l)(u=s[l])&&(r.push(t.call(u,u.__data__,l,s)),i.push(u));return new ot(r,i)},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],s=u.length,a=r[i]=[],c=0;c<s;++c)(o=u[c])&&t.call(o,o.__data__,c,u)&&a.push(o);return new ot(r,this._parents)},data:function(t,n){if(!t)return y=new Array(this.size()),l=-1,this.each((function(t){y[++l]=t})),y;var e,r=n?_:p,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var u=o.length,s=new Array(u),a=new Array(u),c=new Array(u),l=0;l<u;++l){var f=i[l],h=o[l],d=h.length,y=t.call(f,f&&f.__data__,l,i),v=y.length,m=a[l]=new Array(v),g=s[l]=new Array(v);r(f,h,m,g,c[l]=new Array(d),y,n);for(var w,A,x=0,b=0;x<v;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(A=g[b])&&++b<v;);w._next=A||null}}return(s=new ot(s,i))._enter=a,s._exit=c,s},enter:function(){return new ot(this._enter||this._groups.map(l),this._parents)},exit:function(){return new ot(this._exit||this._groups.map(l),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=n&&(i=n(i)),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),s=0;s<o;++s)for(var a,c=n[s],l=e[s],f=c.length,h=u[s]=new Array(f),p=0;p<f;++p)(a=c[p]||l[p])&&(h[p]=a);for(;s<r;++s)u[s]=n[s];return new ot(u,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&4^r.compareDocumentPosition(u)&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=d);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var u,s=e[o],a=s.length,c=i[o]=new Array(a),l=0;l<a;++l)(u=s[l])&&(c[l]=u);c.sort(n)}return new ot(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each((function(){t[++n]=this})),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},size:function(){var t=0;return this.each((function(){++t})),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],u=0,s=o.length;u<s;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},attr:function(t,n){var e=r(t);if(arguments.length<2){var i=this.node();return e.local?i.getAttributeNS(e.space,e.local):i.getAttribute(e)}return this.each((null==n?e.local?v:y:"function"==typeof n?e.local?A:w:e.local?g:m)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?b:"function"==typeof n?N:S)(t,n,null==e?"":e)):function(t,n){return t.style.getPropertyValue(n)||x(t).getComputedStyle(t,null).getPropertyValue(n)}(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?E:"function"==typeof n?P:C)(t,n)):this.node()[t]},classed:function(t,n){var e=L(t+"");if(arguments.length<2){for(var r=B(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?j:n?M:T)(e,n))},text:function(t){return arguments.length?this.each(null==t?H:("function"==typeof t?R:I)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?U:("function"==typeof t?k:V)(t)):this.node().innerHTML},raise:function(){return this.each(z)},lower:function(){return this.each(X)},append:function(t){var n="function"==typeof t?t:u(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:u(t),r=null==n?Y:"function"==typeof n?n:a(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each($)},clone:function(t){return this.select(t?G:F)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),u=o.length;if(!(arguments.length<2)){for(s=n?tt:Z,null==e&&(e=!1),r=0;r<u;++r)this.each(s(o[r],n,e));return this}var s=this.node().__on;if(s)for(var a,c=0,l=s.length;c<l;++c)for(r=0,a=s[c];r<u;++r)if((i=o[r]).type===a.type&&i.name===a.name)return a.value},dispatch:function(t,n){return this.each(("function"==typeof n?rt:et)(t,n))}},t.flamegraphTooltip=function(){var t=function(t){return"string"==typeof t?new ot([[document.querySelector(t)]],[document.documentElement]):new ot([[t]],it)}("body"),n=null,e=ut;function r(){n=t.append("div").style("display","none").style("position","absolute").style("opacity",0).style("pointer-events","none").attr("class","d3-flame-graph-tip")}return r.show=function(t){return n.style("display","block").transition().duration(200).style("opacity",1).style("pointer-events","all"),n.html(e(t)).style("left",K.pageX+"px").style("top",K.pageY+"px"),r},r.hide=function(){return n.style("display","none").transition().duration(200).style("opacity",0).style("pointer-events","none"),r},r.html=function(t){return arguments.length?(e=t,r):e},r},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-dispatch"),require("d3-timer"),require("d3-interpolate"),require("d3-color"),require("d3-ease")):"function"==typeof define&&define.amd?define(["exports","d3-dispatch","d3-timer","d3-interpolate","d3-color","d3-ease"],n):n(((t=t||self).d3=t.d3||{},t.d3.flamegraph=t.d3.flamegraph||{},t.d3.flamegraph.tooltip={}),t.d3Dispatch,t.d3Timer,t.d3Interpolate,t.d3Color,t.d3Ease)}(this,(function(t,n,e,r,i,o){"use strict";var u="http://www.w3.org/1999/xhtml",a={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function s(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),a.hasOwnProperty(n)?{space:a[n],local:t}:t}function l(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===u&&n.documentElement.namespaceURI===u?n.createElement(t):n.createElementNS(e,t)}}function c(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function f(t){var n=s(t);return(n.local?c:l)(n)}function h(){}function p(t){return null==t?h:function(){return this.querySelector(t)}}function _(){return[]}function d(t){return null==t?_:function(){return this.querySelectorAll(t)}}function v(t){return function(){return this.matches(t)}}function y(t){return new Array(t.length)}function m(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}m.prototype={constructor:m,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var g="$";function w(t,n,e,r,i,o){for(var u,a=0,s=n.length,l=o.length;a<l;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new m(t,o[a]);for(;a<s;++a)(u=n[a])&&(i[a]=u)}function A(t,n,e,r,i,o,u){var a,s,l,c={},f=n.length,h=o.length,p=new Array(f);for(a=0;a<f;++a)(s=n[a])&&(p[a]=l=g+u.call(s,s.__data__,a,n),l in c?i[a]=s:c[l]=s);for(a=0;a<h;++a)(s=c[l=g+u.call(t,o[a],a,o)])?(r[a]=s,s.__data__=o[a],c[l]=null):e[a]=new m(t,o[a]);for(a=0;a<f;++a)(s=n[a])&&c[p[a]]===s&&(i[a]=s)}function x(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function b(t){return function(){this.removeAttribute(t)}}function E(t){return function(){this.removeAttributeNS(t.space,t.local)}}function N(t,n){return function(){this.setAttribute(t,n)}}function S(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function C(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function P(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function T(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function q(t){return function(){this.style.removeProperty(t)}}function L(t,n,e){return function(){this.style.setProperty(t,n,e)}}function O(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function D(t,n){return t.style.getPropertyValue(n)||T(t).getComputedStyle(t,null).getPropertyValue(n)}function B(t){return function(){delete this[t]}}function M(t,n){return function(){this[t]=n}}function z(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function I(t){return t.trim().split(/^|\s+/)}function R(t){return t.classList||new j(t)}function j(t){this._node=t,this._names=I(t.getAttribute("class")||"")}function k(t,n){for(var e=R(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function H(t,n){for(var e=R(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function U(t){return function(){k(this,t)}}function V(t){return function(){H(this,t)}}function X(t,n){return function(){(n.apply(this,arguments)?k:H)(this,t)}}function Y(){this.textContent=""}function $(t){return function(){this.textContent=t}}function F(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function G(){this.innerHTML=""}function J(t){return function(){this.innerHTML=t}}function K(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function Q(){this.nextSibling&&this.parentNode.appendChild(this)}function W(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Z(){return null}function tt(){var t=this.parentNode;t&&t.removeChild(this)}function nt(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function et(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}j.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var rt={},it=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(rt={mouseenter:"mouseover",mouseleave:"mouseout"}));function ot(t,n,e){return t=ut(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function ut(t,n,e){return function(r){var i=it;it=r;try{t.call(this,this.__data__,n,e)}finally{it=i}}}function at(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function st(t,n,e){var r=rt.hasOwnProperty(t.type)?ot:ut;return function(i,o,u){var a,s=this.__on,l=r(n,o,u);if(s)for(var c=0,f=s.length;c<f;++c)if((a=s[c]).type===t.type&&a.name===t.name)return this.removeEventListener(a.type,a.listener,a.capture),this.addEventListener(a.type,a.listener=l,a.capture=e),void(a.value=n);this.addEventListener(t.type,l,e),a={type:t.type,name:t.name,value:n,listener:l,capture:e},s?s.push(a):this.__on=[a]}}function lt(t,n,e){var r=T(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function ct(t,n){return function(){return lt(this,t,n)}}function ft(t,n){return function(){return lt(this,t,n.apply(this,arguments))}}var ht=[null];function pt(t,n){this._groups=t,this._parents=n}function _t(){return new pt([[document.documentElement]],ht)}pt.prototype=_t.prototype={constructor:pt,select:function(t){"function"!=typeof t&&(t=p(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,a=n[i],s=a.length,l=r[i]=new Array(s),c=0;c<s;++c)(o=a[c])&&(u=t.call(o,o.__data__,c,a))&&("__data__"in o&&(u.__data__=o.__data__),l[c]=u);return new pt(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=d(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var u,a=n[o],s=a.length,l=0;l<s;++l)(u=a[l])&&(r.push(t.call(u,u.__data__,l,a)),i.push(u));return new pt(r,i)},filter:function(t){"function"!=typeof t&&(t=v(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,s=r[i]=[],l=0;l<a;++l)(o=u[l])&&t.call(o,o.__data__,l,u)&&s.push(o);return new pt(r,this._parents)},data:function(t,n){if(!t)return _=new Array(this.size()),c=-1,this.each((function(t){_[++c]=t})),_;var e,r=n?A:w,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var u=o.length,a=new Array(u),s=new Array(u),l=new Array(u),c=0;c<u;++c){var f=i[c],h=o[c],p=h.length,_=t.call(f,f&&f.__data__,c,i),d=_.length,v=s[c]=new Array(d),y=a[c]=new Array(d);r(f,h,v,y,l[c]=new Array(p),_,n);for(var m,g,x=0,b=0;x<d;++x)if(m=v[x]){for(x>=b&&(b=x+1);!(g=y[b])&&++b<d;);m._next=g||null}}return(a=new pt(a,i))._enter=s,a._exit=l,a},enter:function(){return new pt(this._enter||this._groups.map(y),this._parents)},exit:function(){return new pt(this._exit||this._groups.map(y),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=n&&(i=n(i)),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,l=n[a],c=e[a],f=l.length,h=u[a]=new Array(f),p=0;p<f;++p)(s=l[p]||c[p])&&(h[p]=s);for(;a<r;++a)u[a]=n[a];return new pt(u,this._parents)},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&4^r.compareDocumentPosition(u)&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=x);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;c<s;++c)(u=a[c])&&(l[c]=u);l.sort(n)}return new pt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),n=-1;return this.each((function(){t[++n]=this})),t},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},size:function(){var t=0;return this.each((function(){++t})),t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],u=0,a=o.length;u<a;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},attr:function(t,n){var e=s(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?E:b:"function"==typeof n?e.local?P:C:e.local?S:N)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?q:"function"==typeof n?O:L)(t,n,null==e?"":e)):D(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?B:"function"==typeof n?z:M)(t,n)):this.node()[t]},classed:function(t,n){var e=I(t+"");if(arguments.length<2){for(var r=R(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?X:n?U:V)(e,n))},text:function(t){return arguments.length?this.each(null==t?Y:("function"==typeof t?F:$)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?G:("function"==typeof t?K:J)(t)):this.node().innerHTML},raise:function(){return this.each(Q)},lower:function(){return this.each(W)},append:function(t){var n="function"==typeof t?t:f(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:f(t),r=null==n?Z:"function"==typeof n?n:p(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(tt)},clone:function(t){return this.select(t?et:nt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),u=o.length;if(!(arguments.length<2)){for(a=n?st:at,null==e&&(e=!1),r=0;r<u;++r)this.each(a(o[r],n,e));return this}var a=this.node().__on;if(a)for(var s,l=0,c=a.length;l<c;++l)for(r=0,s=a[l];r<u;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?ft:ct)(t,n))}};var dt=n.dispatch("start","end","cancel","interrupt"),vt=[],yt=0,mt=1,gt=2,wt=3,At=4,xt=5,bt=6;function Et(t,n,r,i,o,u){var a=t.__transition;if(a){if(r in a)return}else t.__transition={};!function(t,n,r){var i,o=t.__transition;function u(l){var c,f,h,p;if(r.state!==mt)return s();for(c in o)if((p=o[c]).name===r.name){if(p.state===wt)return e.timeout(u);p.state===At?(p.state=bt,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete o[c]):+c<n&&(p.state=bt,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete o[c])}if(e.timeout((function(){r.state===wt&&(r.state=At,r.timer.restart(a,r.delay,r.time),a(l))})),r.state=gt,r.on.call("start",t,t.__data__,r.index,r.group),r.state===gt){for(r.state=wt,i=new Array(h=r.tween.length),c=0,f=-1;c<h;++c)(p=r.tween[c].value.call(t,t.__data__,r.index,r.group))&&(i[++f]=p);i.length=f+1}}function a(n){for(var e=n<r.duration?r.ease.call(null,n/r.duration):(r.timer.restart(s),r.state=xt,1),o=-1,u=i.length;++o<u;)i[o].call(t,e);r.state===xt&&(r.on.call("end",t,t.__data__,r.index,r.group),s())}function s(){for(var e in r.state=bt,r.timer.stop(),delete o[n],o)return;delete t.__transition}o[n]=r,r.timer=e.timer((function(t){r.state=mt,r.timer.restart(u,r.delay,r.time),r.delay<=t&&u(t-r.delay)}),0,r.time)}(t,r,{name:n,index:i,group:o,on:dt,tween:vt,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:yt})}function Nt(t,n){var e=Ct(t,n);if(e.state>yt)throw new Error("too late; already scheduled");return e}function St(t,n){var e=Ct(t,n);if(e.state>wt)throw new Error("too late; already running");return e}function Ct(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Pt(t,n){var e,r;return function(){var i=St(this,t),o=i.tween;if(o!==e)for(var u=0,a=(r=e=o).length;u<a;++u)if(r[u].name===n){(r=r.slice()).splice(u,1);break}i.tween=r}}function Tt(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=St(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},s=0,l=i.length;s<l;++s)if(i[s].name===n){i[s]=a;break}s===l&&i.push(a)}o.tween=i}}function qt(t,n,e){var r=t._id;return t.each((function(){var t=St(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return Ct(t,r).value[n]}}function Lt(t,n){var e;return("number"==typeof n?r.interpolateNumber:n instanceof i.color?r.interpolateRgb:(e=i.color(n))?(n=e,r.interpolateRgb):r.interpolateString)(t,n)}function Ot(t){return function(){this.removeAttribute(t)}}function Dt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Bt(t,n,e){var r,i,o=e+"";return function(){var u=this.getAttribute(t);return u===o?null:u===r?i:i=n(r=u,e)}}function Mt(t,n,e){var r,i,o=e+"";return function(){var u=this.getAttributeNS(t.space,t.local);return u===o?null:u===r?i:i=n(r=u,e)}}function zt(t,n,e){var r,i,o;return function(){var u,a,s=e(this);if(null!=s)return(u=this.getAttribute(t))===(a=s+"")?null:u===r&&a===i?o:(i=a,o=n(r=u,s));this.removeAttribute(t)}}function It(t,n,e){var r,i,o;return function(){var u,a,s=e(this);if(null!=s)return(u=this.getAttributeNS(t.space,t.local))===(a=s+"")?null:u===r&&a===i?o:(i=a,o=n(r=u,s));this.removeAttributeNS(t.space,t.local)}}function Rt(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n(e))}}(t,i)),e}return i._value=n,i}function jt(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n(e))}}(t,i)),e}return i._value=n,i}function kt(t,n){return function(){Nt(this,t).delay=+n.apply(this,arguments)}}function Ht(t,n){return n=+n,function(){Nt(this,t).delay=n}}function Ut(t,n){return function(){St(this,t).duration=+n.apply(this,arguments)}}function Vt(t,n){return n=+n,function(){St(this,t).duration=n}}var Xt=_t.prototype.constructor;function Yt(t){return function(){this.style.removeProperty(t)}}var $t=0;function Ft(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Gt(){return++$t}var Jt=_t.prototype;Ft.prototype=function(t){return _t().transition(t)}.prototype={constructor:Ft,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=p(t));for(var r=this._groups,i=r.length,o=new Array(i),u=0;u<i;++u)for(var a,s,l=r[u],c=l.length,f=o[u]=new Array(c),h=0;h<c;++h)(a=l[h])&&(s=t.call(a,a.__data__,h,l))&&("__data__"in a&&(s.__data__=a.__data__),f[h]=s,Et(f[h],n,e,h,f,Ct(a,e)));return new Ft(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=d(t));for(var r=this._groups,i=r.length,o=[],u=[],a=0;a<i;++a)for(var s,l=r[a],c=l.length,f=0;f<c;++f)if(s=l[f]){for(var h,p=t.call(s,s.__data__,f,l),_=Ct(s,e),v=0,y=p.length;v<y;++v)(h=p[v])&&Et(h,n,e,v,p,_);o.push(p),u.push(s)}return new Ft(o,u,n,e)},filter:function(t){"function"!=typeof t&&(t=v(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,s=r[i]=[],l=0;l<a;++l)(o=u[l])&&t.call(o,o.__data__,l,u)&&s.push(o);return new Ft(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,l=n[a],c=e[a],f=l.length,h=u[a]=new Array(f),p=0;p<f;++p)(s=l[p]||c[p])&&(h[p]=s);for(;a<r;++a)u[a]=n[a];return new Ft(u,this._parents,this._name,this._id)},selection:function(){return new Xt(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=Gt(),r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],s=a.length,l=0;l<s;++l)if(u=a[l]){var c=Ct(u,n);Et(u,t,e,l,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Ft(r,this._parents,t,e)},call:Jt.call,nodes:Jt.nodes,node:Jt.node,size:Jt.size,empty:Jt.empty,each:Jt.each,on:function(t,n){var e=this._id;return arguments.length<2?Ct(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Nt:St;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}(e,t,n))},attr:function(t,n){var e=s(t),i="transform"===e?r.interpolateTransformSvg:Lt;return this.attrTween(t,"function"==typeof n?(e.local?It:zt)(e,i,qt(this,"attr."+t,n)):null==n?(e.local?Dt:Ot)(e):(e.local?Mt:Bt)(e,i,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=s(t);return this.tween(e,(r.local?Rt:jt)(r,n))},style:function(t,n,e){var i="transform"==(t+="")?r.interpolateTransformCss:Lt;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=D(this,t),u=(this.style.removeProperty(t),D(this,t));return o===u?null:o===e&&u===r?i:i=n(e=o,r=u)}}(t,i)).on("end.style."+t,Yt(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var u=D(this,t),a=e(this),s=a+"";return null==a&&(this.style.removeProperty(t),s=a=D(this,t)),u===s?null:u===r&&s===i?o:(i=s,o=n(r=u,a))}}(t,i,qt(this,"style."+t,n))).each(function(t,n){var e,r,i,o,u="style."+n,a="end."+u;return function(){var s=St(this,t),l=s.on,c=null==s.value[u]?o||(o=Yt(n)):void 0;l===e&&i===c||(r=(e=l).copy()).on(a,i=c),s.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var u=D(this,t);return u===o?null:u===r?i:i=n(r=u,e)}}(t,i,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n(r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(qt(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Ct(this.node(),e).tween,o=0,u=i.length;o<u;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Pt:Tt)(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?kt:Ht)(n,t)):Ct(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?Ut:Vt)(n,t)):Ct(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){St(this,t).ease=n}}(n,t)):Ct(this.node(),n).ease},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise((function(o,u){var a={value:u},s={value:function(){0==--i&&o()}};e.each((function(){var e=St(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(a),n._.interrupt.push(a),n._.end.push(s)),e.on=n}))}))}};var Kt={time:null,delay:0,duration:250,ease:o.easeCubicInOut};function Qt(t,n){for(var r;!(r=t.__transition)||!(r=r[n]);)if(!(t=t.parentNode))return Kt.time=e.now(),Kt;return r}function Wt(t){return t.data.name}_t.prototype.interrupt=function(t){return this.each((function(){!function(t,n){var e,r,i,o=t.__transition,u=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>gt&&e.state<xt,e.state=bt,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):u=!1;u&&delete t.__transition}}(this,t)}))},_t.prototype.transition=function(t){var n,r;t instanceof Ft?(n=t._id,t=t._name):(n=Gt(),(r=Kt).time=e.now(),t=null==t?null:t+"");for(var i=this._groups,o=i.length,u=0;u<o;++u)for(var a,s=i[u],l=s.length,c=0;c<l;++c)(a=s[c])&&Et(a,t,n,c,s,r||Qt(a,n));return new Ft(i,this._parents,t,n)},t.flamegraphTooltip=function(){var t=function(t){return"string"==typeof t?new pt([[document.querySelector(t)]],[document.documentElement]):new pt([[t]],ht)}("body"),n=null,e=Wt;function r(){n=t.append("div").style("display","none").style("position","absolute").style("opacity",0).style("pointer-events","none").attr("class","d3-flame-graph-tip")}return r.show=function(t){return n.style("display","block").transition().duration(200).style("opacity",1).style("pointer-events","all"),n.html(e(t)).style("left",it.pageX+"px").style("top",it.pageY+"px"),r},r.hide=function(){return n.style("display","none").transition().duration(200).style("opacity",0).style("pointer-events","none"),r},r.html=function(t){return arguments.length?(e=t,r):e},r},Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "d3-flame-graph", | ||
"version": "2.1.11", | ||
"version": "2.1.12", | ||
"description": "A d3.js library to produce flame graphs.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
import { select, event } from 'd3-selection' | ||
import 'd3-transition' | ||
@@ -3,0 +4,0 @@ function defaultLabel (d) { |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
421212
6534
1