mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 05:58:46 +02:00
N°5621 Move C3 0.4.11 to NPM
This commit is contained in:
69
node_modules/d3/src/event/dispatch.js
generated
vendored
Normal file
69
node_modules/d3/src/event/dispatch.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
import "../arrays/map";
|
||||
|
||||
d3.dispatch = function() {
|
||||
var dispatch = new d3_dispatch,
|
||||
i = -1,
|
||||
n = arguments.length;
|
||||
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
|
||||
return dispatch;
|
||||
};
|
||||
|
||||
function d3_dispatch() {}
|
||||
|
||||
d3_dispatch.prototype.on = function(type, listener) {
|
||||
var i = type.indexOf("."),
|
||||
name = "";
|
||||
|
||||
// Extract optional namespace, e.g., "click.foo"
|
||||
if (i >= 0) {
|
||||
name = type.slice(i + 1);
|
||||
type = type.slice(0, i);
|
||||
}
|
||||
|
||||
if (type) return arguments.length < 2
|
||||
? this[type].on(name)
|
||||
: this[type].on(name, listener);
|
||||
|
||||
if (arguments.length === 2) {
|
||||
if (listener == null) for (type in this) {
|
||||
if (this.hasOwnProperty(type)) this[type].on(name, null);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
function d3_dispatch_event(dispatch) {
|
||||
var listeners = [],
|
||||
listenerByName = new d3_Map;
|
||||
|
||||
function event() {
|
||||
var z = listeners, // defensive reference
|
||||
i = -1,
|
||||
n = z.length,
|
||||
l;
|
||||
while (++i < n) if (l = z[i].on) l.apply(this, arguments);
|
||||
return dispatch;
|
||||
}
|
||||
|
||||
event.on = function(name, listener) {
|
||||
var l = listenerByName.get(name),
|
||||
i;
|
||||
|
||||
// return the current listener, if any
|
||||
if (arguments.length < 2) return l && l.on;
|
||||
|
||||
// remove the old listener, if any (with copy-on-write)
|
||||
if (l) {
|
||||
l.on = null;
|
||||
listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
|
||||
listenerByName.remove(name);
|
||||
}
|
||||
|
||||
// add the new listener, if any
|
||||
if (listener) listeners.push(listenerByName.set(name, {on: listener}));
|
||||
|
||||
return dispatch;
|
||||
};
|
||||
|
||||
return event;
|
||||
}
|
||||
36
node_modules/d3/src/event/drag.js
generated
vendored
Normal file
36
node_modules/d3/src/event/drag.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import "../core/document";
|
||||
import "../core/vendor";
|
||||
import "../selection/on";
|
||||
|
||||
var d3_event_dragSelect,
|
||||
d3_event_dragId = 0;
|
||||
|
||||
function d3_event_dragSuppress(node) {
|
||||
var name = ".dragsuppress-" + ++d3_event_dragId,
|
||||
click = "click" + name,
|
||||
w = d3.select(d3_window(node))
|
||||
.on("touchmove" + name, d3_eventPreventDefault)
|
||||
.on("dragstart" + name, d3_eventPreventDefault)
|
||||
.on("selectstart" + name, d3_eventPreventDefault);
|
||||
|
||||
if (d3_event_dragSelect == null) {
|
||||
d3_event_dragSelect = "onselectstart" in node ? false
|
||||
: d3_vendorSymbol(node.style, "userSelect");
|
||||
}
|
||||
|
||||
if (d3_event_dragSelect) {
|
||||
var style = d3_documentElement(node).style,
|
||||
select = style[d3_event_dragSelect];
|
||||
style[d3_event_dragSelect] = "none";
|
||||
}
|
||||
|
||||
return function(suppressClick) {
|
||||
w.on(name, null);
|
||||
if (d3_event_dragSelect) style[d3_event_dragSelect] = select;
|
||||
if (suppressClick) { // suppress the next click, but only if it’s immediate
|
||||
var off = function() { w.on(click, null); };
|
||||
w.on(click, function() { d3_eventPreventDefault(); off(); }, true);
|
||||
setTimeout(off, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
50
node_modules/d3/src/event/event.js
generated
vendored
Normal file
50
node_modules/d3/src/event/event.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import "dispatch";
|
||||
|
||||
d3.event = null;
|
||||
|
||||
function d3_eventPreventDefault() {
|
||||
d3.event.preventDefault();
|
||||
}
|
||||
|
||||
function d3_eventSource() {
|
||||
var e = d3.event, s;
|
||||
while (s = e.sourceEvent) e = s;
|
||||
return e;
|
||||
}
|
||||
|
||||
// Like d3.dispatch, but for custom events abstracting native UI events. These
|
||||
// events have a target component (such as a brush), a target element (such as
|
||||
// the svg:g element containing the brush) and the standard arguments `d` (the
|
||||
// target element's data) and `i` (the selection index of the target element).
|
||||
function d3_eventDispatch(target) {
|
||||
var dispatch = new d3_dispatch,
|
||||
i = 0,
|
||||
n = arguments.length;
|
||||
|
||||
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
|
||||
|
||||
// Creates a dispatch context for the specified `thiz` (typically, the target
|
||||
// DOM element that received the source event) and `argumentz` (typically, the
|
||||
// data `d` and index `i` of the target element). The returned function can be
|
||||
// used to dispatch an event to any registered listeners; the function takes a
|
||||
// single argument as input, being the event to dispatch. The event must have
|
||||
// a "type" attribute which corresponds to a type registered in the
|
||||
// constructor. This context will automatically populate the "sourceEvent" and
|
||||
// "target" attributes of the event, as well as setting the `d3.event` global
|
||||
// for the duration of the notification.
|
||||
dispatch.of = function(thiz, argumentz) {
|
||||
return function(e1) {
|
||||
try {
|
||||
var e0 =
|
||||
e1.sourceEvent = d3.event;
|
||||
e1.target = target;
|
||||
d3.event = e1;
|
||||
dispatch[e1.type].apply(thiz, argumentz);
|
||||
} finally {
|
||||
d3.event = e0;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
return dispatch;
|
||||
}
|
||||
6
node_modules/d3/src/event/index.js
generated
vendored
Normal file
6
node_modules/d3/src/event/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import "dispatch";
|
||||
import "event";
|
||||
import "mouse";
|
||||
import "touch";
|
||||
import "touches";
|
||||
import "timer";
|
||||
39
node_modules/d3/src/event/mouse.js
generated
vendored
Normal file
39
node_modules/d3/src/event/mouse.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import "../core/document";
|
||||
import "event";
|
||||
|
||||
d3.mouse = function(container) {
|
||||
return d3_mousePoint(container, d3_eventSource());
|
||||
};
|
||||
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=44083
|
||||
var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0;
|
||||
|
||||
function d3_mousePoint(container, e) {
|
||||
if (e.changedTouches) e = e.changedTouches[0];
|
||||
var svg = container.ownerSVGElement || container;
|
||||
if (svg.createSVGPoint) {
|
||||
var point = svg.createSVGPoint();
|
||||
if (d3_mouse_bug44083 < 0) {
|
||||
var window = d3_window(container);
|
||||
if (window.scrollX || window.scrollY) {
|
||||
svg = d3.select("body").append("svg").style({
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
border: "none"
|
||||
}, "important");
|
||||
var ctm = svg[0][0].getScreenCTM();
|
||||
d3_mouse_bug44083 = !(ctm.f || ctm.e);
|
||||
svg.remove();
|
||||
}
|
||||
}
|
||||
if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY;
|
||||
else point.x = e.clientX, point.y = e.clientY;
|
||||
point = point.matrixTransform(container.getScreenCTM().inverse());
|
||||
return [point.x, point.y];
|
||||
}
|
||||
var rect = container.getBoundingClientRect();
|
||||
return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop];
|
||||
};
|
||||
82
node_modules/d3/src/event/timer.js
generated
vendored
Normal file
82
node_modules/d3/src/event/timer.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
import "../core/document";
|
||||
import "../core/vendor";
|
||||
|
||||
var d3_timer_queueHead,
|
||||
d3_timer_queueTail,
|
||||
d3_timer_interval, // is an interval (or frame) active?
|
||||
d3_timer_timeout, // is a timeout active?
|
||||
d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) { setTimeout(callback, 17); };
|
||||
|
||||
// The timer will continue to fire until callback returns true.
|
||||
d3.timer = function() {
|
||||
d3_timer.apply(this, arguments);
|
||||
};
|
||||
|
||||
function d3_timer(callback, delay, then) {
|
||||
var n = arguments.length;
|
||||
if (n < 2) delay = 0;
|
||||
if (n < 3) then = Date.now();
|
||||
|
||||
// Add the callback to the tail of the queue.
|
||||
var time = then + delay, timer = {c: callback, t: time, n: null};
|
||||
if (d3_timer_queueTail) d3_timer_queueTail.n = timer;
|
||||
else d3_timer_queueHead = timer;
|
||||
d3_timer_queueTail = timer;
|
||||
|
||||
// Start animatin'!
|
||||
if (!d3_timer_interval) {
|
||||
d3_timer_timeout = clearTimeout(d3_timer_timeout);
|
||||
d3_timer_interval = 1;
|
||||
d3_timer_frame(d3_timer_step);
|
||||
}
|
||||
|
||||
return timer;
|
||||
}
|
||||
|
||||
function d3_timer_step() {
|
||||
var now = d3_timer_mark(),
|
||||
delay = d3_timer_sweep() - now;
|
||||
if (delay > 24) {
|
||||
if (isFinite(delay)) {
|
||||
clearTimeout(d3_timer_timeout);
|
||||
d3_timer_timeout = setTimeout(d3_timer_step, delay);
|
||||
}
|
||||
d3_timer_interval = 0;
|
||||
} else {
|
||||
d3_timer_interval = 1;
|
||||
d3_timer_frame(d3_timer_step);
|
||||
}
|
||||
}
|
||||
|
||||
d3.timer.flush = function() {
|
||||
d3_timer_mark();
|
||||
d3_timer_sweep();
|
||||
};
|
||||
|
||||
function d3_timer_mark() {
|
||||
var now = Date.now(),
|
||||
timer = d3_timer_queueHead;
|
||||
while (timer) {
|
||||
if (now >= timer.t && timer.c(now - timer.t)) timer.c = null;
|
||||
timer = timer.n;
|
||||
}
|
||||
return now;
|
||||
}
|
||||
|
||||
// Flush after callbacks to avoid concurrent queue modification.
|
||||
// Returns the time of the earliest active timer, post-sweep.
|
||||
function d3_timer_sweep() {
|
||||
var t0,
|
||||
t1 = d3_timer_queueHead,
|
||||
time = Infinity;
|
||||
while (t1) {
|
||||
if (t1.c) {
|
||||
if (t1.t < time) time = t1.t;
|
||||
t1 = (t0 = t1).n;
|
||||
} else {
|
||||
t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
|
||||
}
|
||||
}
|
||||
d3_timer_queueTail = t0;
|
||||
return time;
|
||||
}
|
||||
11
node_modules/d3/src/event/touch.js
generated
vendored
Normal file
11
node_modules/d3/src/event/touch.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import "event";
|
||||
import "mouse";
|
||||
|
||||
d3.touch = function(container, touches, identifier) {
|
||||
if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;
|
||||
if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {
|
||||
if ((touch = touches[i]).identifier === identifier) {
|
||||
return d3_mousePoint(container, touch);
|
||||
}
|
||||
}
|
||||
};
|
||||
12
node_modules/d3/src/event/touches.js
generated
vendored
Normal file
12
node_modules/d3/src/event/touches.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import "../core/array";
|
||||
import "event";
|
||||
import "mouse";
|
||||
|
||||
d3.touches = function(container, touches) {
|
||||
if (arguments.length < 2) touches = d3_eventSource().touches;
|
||||
return touches ? d3_array(touches).map(function(touch) {
|
||||
var point = d3_mousePoint(container, touch);
|
||||
point.identifier = touch.identifier;
|
||||
return point;
|
||||
}) : [];
|
||||
};
|
||||
Reference in New Issue
Block a user