Socket
Socket
Sign inDemoInstall

d3kit

Package Overview
Dependencies
2
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0-8 to 3.0.0-9

151

dist/d3kit-es.js

@@ -7,5 +7,118 @@ import { select } from 'd3-selection';

} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}
function AsyncGenerator(gen) {
var front, back;
function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}
function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;
if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
}
} catch (err) {
settle("throw", err);
}
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({
value: value,
done: false
});
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}
this._invoke = send;
if (typeof gen.return !== "function") {
this.return = undefined;
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};
return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
}
};
}();
var classCallCheck = function (instance, Constructor) {

@@ -809,3 +922,3 @@ if (!(instance instanceof Constructor)) {

function Fitter() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
classCallCheck(this, Fitter);

@@ -852,4 +965,4 @@

value: function fit() {
var box = arguments.length <= 0 || arguments[0] === undefined ? isRequired('box') : arguments[0];
var container = arguments.length <= 1 || arguments[1] === undefined ? isRequired('container') : arguments[1];
var box = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : isRequired('box');
var container = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isRequired('container');

@@ -892,3 +1005,3 @@ var boxDim = new Dimension(box);

function Watcher() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
classCallCheck(this, Watcher);

@@ -1020,4 +1133,4 @@

function FitWatcher() {
var box = arguments.length <= 0 || arguments[0] === undefined ? isRequired('box') : arguments[0];
var container = arguments.length <= 1 || arguments[1] === undefined ? isRequired('container') : arguments[1];
var box = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : isRequired('box');
var container = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isRequired('container');
var fitterOptions = arguments[2];

@@ -1027,3 +1140,3 @@ var watcherOptions = arguments[3];

var _this = possibleConstructorReturn(this, Object.getPrototypeOf(FitWatcher).call(this, watcherOptions));
var _this = possibleConstructorReturn(this, (FitWatcher.__proto__ || Object.getPrototypeOf(FitWatcher)).call(this, watcherOptions));

@@ -1100,3 +1213,3 @@ var fitter = new Fitter(fitterOptions);

value: function setupDispatcher() {
var customEventNames = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
var customEventNames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];

@@ -1275,3 +1388,3 @@ this._customEventNames = customEventNames;

var watchOptions = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var watchOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

@@ -1394,3 +1507,3 @@ if (fitOptions) {

function CanvasChart(selector) {
var _Object$getPrototypeO;
var _ref;

@@ -1403,3 +1516,3 @@ classCallCheck(this, CanvasChart);

var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(CanvasChart)).call.apply(_Object$getPrototypeO, [this, selector, CanvasChart.DEFAULT_OPTIONS].concat(options)));
var _this = possibleConstructorReturn(this, (_ref = CanvasChart.__proto__ || Object.getPrototypeOf(CanvasChart)).call.apply(_ref, [this, selector, CanvasChart.DEFAULT_OPTIONS].concat(options)));

@@ -1442,3 +1555,3 @@ _this.canvas = _this.container.append('canvas');

value: function _updateDimension() {
get(Object.getPrototypeOf(CanvasChart.prototype), '_updateDimension', this).call(this);
get(CanvasChart.prototype.__proto__ || Object.getPrototypeOf(CanvasChart.prototype), '_updateDimension', this).call(this);

@@ -1480,3 +1593,3 @@ var _state = this._state;

function LayerOrganizer (mainContainer) {
var defaultTag = arguments.length <= 1 || arguments[1] === undefined ? 'g' : arguments[1];
var defaultTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'g';

@@ -1486,3 +1599,3 @@ var layers = {};

function createLayerFromName(container, layerName) {
var prefix = arguments.length <= 2 || arguments[2] === undefined ? '' : arguments[2];
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';

@@ -1512,3 +1625,3 @@ var chunks = layerName.split('.');

function createLayerFromConfig(container, config) {
var prefix = arguments.length <= 2 || arguments[2] === undefined ? '' : arguments[2];
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';

@@ -1567,3 +1680,3 @@ if (Array.isArray(config)) {

function SvgChart(selector) {
var _Object$getPrototypeO;
var _ref;

@@ -1576,3 +1689,3 @@ classCallCheck(this, SvgChart);

var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SvgChart)).call.apply(_Object$getPrototypeO, [this, selector, SvgChart.DEFAULT_OPTIONS].concat(options)));
var _this = possibleConstructorReturn(this, (_ref = SvgChart.__proto__ || Object.getPrototypeOf(SvgChart)).call.apply(_ref, [this, selector, SvgChart.DEFAULT_OPTIONS].concat(options)));

@@ -1589,3 +1702,3 @@ _this.svg = _this.container.append('svg');

value: function _updateDimension() {
get(Object.getPrototypeOf(SvgChart.prototype), '_updateDimension', this).call(this);
get(SvgChart.prototype.__proto__ || Object.getPrototypeOf(SvgChart.prototype), '_updateDimension', this).call(this);

@@ -1592,0 +1705,0 @@ var _state = this._state;

@@ -10,5 +10,118 @@ (function (global, factory) {

} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}
function AsyncGenerator(gen) {
var front, back;
function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}
function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;
if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
}
} catch (err) {
settle("throw", err);
}
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({
value: value,
done: false
});
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}
this._invoke = send;
if (typeof gen.return !== "function") {
this.return = undefined;
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};
return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
}
};
}();
var classCallCheck = function (instance, Constructor) {

@@ -812,3 +925,3 @@ if (!(instance instanceof Constructor)) {

function Fitter() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
classCallCheck(this, Fitter);

@@ -855,4 +968,4 @@

value: function fit() {
var box = arguments.length <= 0 || arguments[0] === undefined ? isRequired('box') : arguments[0];
var container = arguments.length <= 1 || arguments[1] === undefined ? isRequired('container') : arguments[1];
var box = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : isRequired('box');
var container = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isRequired('container');

@@ -895,3 +1008,3 @@ var boxDim = new Dimension(box);

function Watcher() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
classCallCheck(this, Watcher);

@@ -1023,4 +1136,4 @@

function FitWatcher() {
var box = arguments.length <= 0 || arguments[0] === undefined ? isRequired('box') : arguments[0];
var container = arguments.length <= 1 || arguments[1] === undefined ? isRequired('container') : arguments[1];
var box = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : isRequired('box');
var container = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isRequired('container');
var fitterOptions = arguments[2];

@@ -1030,3 +1143,3 @@ var watcherOptions = arguments[3];

var _this = possibleConstructorReturn(this, Object.getPrototypeOf(FitWatcher).call(this, watcherOptions));
var _this = possibleConstructorReturn(this, (FitWatcher.__proto__ || Object.getPrototypeOf(FitWatcher)).call(this, watcherOptions));

@@ -1103,3 +1216,3 @@ var fitter = new Fitter(fitterOptions);

value: function setupDispatcher() {
var customEventNames = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
var customEventNames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];

@@ -1278,3 +1391,3 @@ this._customEventNames = customEventNames;

var watchOptions = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1];
var watchOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

@@ -1397,3 +1510,3 @@ if (fitOptions) {

function CanvasChart(selector) {
var _Object$getPrototypeO;
var _ref;

@@ -1406,3 +1519,3 @@ classCallCheck(this, CanvasChart);

var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(CanvasChart)).call.apply(_Object$getPrototypeO, [this, selector, CanvasChart.DEFAULT_OPTIONS].concat(options)));
var _this = possibleConstructorReturn(this, (_ref = CanvasChart.__proto__ || Object.getPrototypeOf(CanvasChart)).call.apply(_ref, [this, selector, CanvasChart.DEFAULT_OPTIONS].concat(options)));

@@ -1445,3 +1558,3 @@ _this.canvas = _this.container.append('canvas');

value: function _updateDimension() {
get(Object.getPrototypeOf(CanvasChart.prototype), '_updateDimension', this).call(this);
get(CanvasChart.prototype.__proto__ || Object.getPrototypeOf(CanvasChart.prototype), '_updateDimension', this).call(this);

@@ -1483,3 +1596,3 @@ var _state = this._state;

function LayerOrganizer (mainContainer) {
var defaultTag = arguments.length <= 1 || arguments[1] === undefined ? 'g' : arguments[1];
var defaultTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'g';

@@ -1489,3 +1602,3 @@ var layers = {};

function createLayerFromName(container, layerName) {
var prefix = arguments.length <= 2 || arguments[2] === undefined ? '' : arguments[2];
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';

@@ -1515,3 +1628,3 @@ var chunks = layerName.split('.');

function createLayerFromConfig(container, config) {
var prefix = arguments.length <= 2 || arguments[2] === undefined ? '' : arguments[2];
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';

@@ -1570,3 +1683,3 @@ if (Array.isArray(config)) {

function SvgChart(selector) {
var _Object$getPrototypeO;
var _ref;

@@ -1579,3 +1692,3 @@ classCallCheck(this, SvgChart);

var _this = possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SvgChart)).call.apply(_Object$getPrototypeO, [this, selector, SvgChart.DEFAULT_OPTIONS].concat(options)));
var _this = possibleConstructorReturn(this, (_ref = SvgChart.__proto__ || Object.getPrototypeOf(SvgChart)).call.apply(_ref, [this, selector, SvgChart.DEFAULT_OPTIONS].concat(options)));

@@ -1592,3 +1705,3 @@ _this.svg = _this.container.append('svg');

value: function _updateDimension() {
get(Object.getPrototypeOf(SvgChart.prototype), '_updateDimension', this).call(this);
get(SvgChart.prototype.__proto__ || Object.getPrototypeOf(SvgChart.prototype), '_updateDimension', this).call(this);

@@ -1595,0 +1708,0 @@ var _state = this._state;

2

dist/d3kit.min.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-selection"),require("d3-dispatch")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch"],e):e(t.d3Kit=t.d3Kit||{},t.d3,t.d3)}(this,function(t,e,n){"use strict";function i(t){var e="undefined"==typeof t?"undefined":E(t);return null!=t&&("object"==e||"function"==e)}function r(t){var e=i(t)?M.call(t):"";return e==I||e==P||e==C}function s(t){return null!=t&&"object"==("undefined"==typeof t?"undefined":E(t))}function a(t){return"symbol"==("undefined"==typeof t?"undefined":E(t))||s(t)&&G.call(t)==H}function o(t){if("number"==typeof t)return t;if(a(t))return $;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(q,"");var n=K.test(t);return n||V.test(t)?Z(t.slice(2),n?2:8):B.test(t)?$:+t}function h(t,e,n){function r(e){var n=g,i=v;return g=v=void 0,w=e,m=t.apply(i,n)}function s(t){return w=t,y=setTimeout(u,e),O?r(t):m}function a(t){var n=t-_,i=t-w,r=e-n;return b?X(r,p-i):r}function h(t){var n=t-_,i=t-w;return void 0===_||n>=e||0>n||b&&i>=p}function u(){var t=z();return h(t)?c(t):void(y=setTimeout(u,a(t)))}function c(t){return y=void 0,k&&g?r(t):(g=v=void 0,m)}function f(){void 0!==y&&clearTimeout(y),w=0,g=_=v=y=void 0}function l(){return void 0===y?m:c(z())}function d(){var t=z(),n=h(t);if(g=arguments,v=this,_=t,n){if(void 0===y)return s(_);if(b)return y=setTimeout(u,e),r(_)}return void 0===y&&(y=setTimeout(u,e)),m}var g,v,p,m,y,_,w=0,O=!1,b=!1,k=!0;if("function"!=typeof t)throw new TypeError(J);return e=o(e)||0,i(n)&&(O=!!n.leading,b="maxWait"in n,p=b?Q(o(n.maxWait)||0,e):p,k="trailing"in n?!!n.trailing:k),d.cancel=f,d.flush=l,d}function u(t,e,n){var r=!0,s=!0;if("function"!=typeof t)throw new TypeError(Y);return i(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),h(t,e,{leading:r,maxWait:e,trailing:s})}function c(t){return null==t?"":String(t).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(t){return null==t?"\\s":t.source?t.source:"["+c(t)+"]"}function l(t,e){if(null==t)return"";if(!e&&tt)return tt.call(t);var n=f(e),i=new RegExp("^"+n+"+|"+n+"+$","g");return String(t).replace(i,"")}function d(t){return l(t).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()}function g(t){t=t||{};for(var e=1;e<arguments.length;e++){var n=arguments[e];if(n)for(var s in n)if(n.hasOwnProperty(s)){var a=n[s];t[s]=!i(a)||Array.isArray(a)||r(a)?a:g(t[s],a)}}return t}function v(t){t=t||{};for(var e=1;e<arguments.length;e++)if(arguments[e])for(var n in arguments[e])arguments[e].hasOwnProperty(n)&&(t[n]=arguments[e][n]);return t}function p(t,e,n){return function(){var i=n.apply(e,arguments);return i===e?t:i}}function m(t,e){for(var n=1,i=arguments.length,r=void 0;++n<i;)t[r=arguments[n]]=p(t,e,e[r]);return t}function y(t){return r(t)?t:function(){return t}}function _(t){throw new Error("Missing parameter "+t)}function w(t){return null!==t&&void 0!==t}function O(t){return null===t||void 0===t}function b(t){return!(!t||1!==t.nodeType)}function k(t){if(O(t))return function(t,e){return Math.min(t,e)};var e=(""+t).trim().toLowerCase();if(e.indexOf("%")>-1){var n=function(){var t=+e.replace("%","")/100;return{v:function(e,n){return n*t}}}();if("object"===("undefined"==typeof n?"undefined":E(n)))return n.v}return function(){return+e.replace("px","")}}function D(t){function e(t,e){var n=arguments.length<=2||void 0===arguments[2]?"":arguments[2],i=e.split("."),r=void 0,s=void 0;i.length>1?(s=i[0].length>0?i[0]:h,r=i[1]):(s=h,r=i[0]);var a=""+n+r;if(u.hasOwnProperty(a))throw new Error("invalid or duplicate layer id: "+a);var o=d(r)+"-layer",c=t.append(s).classed(o,!0);return u[a]=c,c}function n(t,r){var s=arguments.length<=2||void 0===arguments[2]?"":arguments[2];if(Array.isArray(r))return r.map(function(e){return n(t,e,s)});if(i(r)){var a=Object.keys(r),o=N(a,1),h=o[0],u=e(t,h,s);return n(u,r[h],""+s+h+"/"),u}return e(t,r,s)}function r(e){return n(t,e)}function s(t){return Array.isArray(t)?t.map(r):r(t)}function a(t){return u[t]}function o(t){return!!u[t]}var h=arguments.length<=1||void 0===arguments[1]?"g":arguments[1],u={};return{create:s,get:a,has:o}}var E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},A=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},T=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),j=function ut(t,e,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,e);if(void 0===i){var r=Object.getPrototypeOf(t);return null===r?void 0:ut(r,e,n)}if("value"in i)return i.value;var s=i.get;return void 0===s?void 0:s.call(n)},x=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},W=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},N=function(){function t(t,e){var n=[],i=!0,r=!1,s=void 0;try{for(var a,o=t[Symbol.iterator]();!(i=(a=o.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(h){r=!0,s=h}finally{try{!i&&o["return"]&&o["return"]()}finally{if(r)throw s}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),I="[object Function]",P="[object GeneratorFunction]",C="[object Proxy]",S=Object.prototype,M=S.toString,F="object"==("undefined"==typeof global?"undefined":E(global))&&global&&global.Object===Object&&global,L="object"==("undefined"==typeof self?"undefined":E(self))&&self&&self.Object===Object&&self,R=F||L||Function("return this")(),z=function(){return R.Date.now()},H="[object Symbol]",U=Object.prototype,G=U.toString,$=0/0,q=/^\s+|\s+$/g,B=/^[-+]0x[0-9a-f]+$/i,K=/^0b[01]+$/i,V=/^0o[0-7]+$/i,Z=parseInt,J="Expected a function",Q=Math.max,X=Math.min,Y="Expected a function",tt=String.prototype.trim,et=Object.freeze({isObject:i,isFunction:r,kebabCase:d,deepExtend:g,extend:v,rebind:m,functor:y,debounce:h,throttle:u}),nt=function(){function t(){A(this,t);for(var e=arguments.length,n=Array(e),i=0;e>i;i++)n[i]=arguments[i];if(1===n.length){var s=n[0],a=r(s)?s():s;if(a instanceof t)this.width=a.width,this.height=a.height;else if(b(a))this.width=a.clientWidth,this.height=a.clientHeight;else if(Array.isArray(a))this.width=a[0],this.height=a[1];else{if(!(w(a)&&w(a.width)&&w(a.height))){var o=new Error("Unsupported input. Must be either\n DOMNode, Array or Object with field width and height,\n or a function that returns any of the above.");throw o.value=s,o}this.width=a.width,this.height=a.height}}else{var h=n[0],u=n[1];this.width=h,this.height=u}}return T(t,[{key:"isEqual",value:function(e){if(e instanceof t)return this.width===e.width&&this.height===e.height;var n=new t(e);return this.width===n.width&&this.height===n.height}},{key:"toArray",value:function(){return[this.width,this.height]}},{key:"toObject",value:function(){return{width:this.width,height:this.height}}}]),t}(),it=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];A(this,t);var n=e||{},i=n.mode,r=void 0===i?t.MODE_BASIC:i,s=n.width,a=void 0===s?"100%":s,o=n.height,h=void 0===o?null:o,u=n.ratio,c=void 0===u?1:u,f=n.maxWidth,l=void 0===f?null:f,d=n.maxHeight,g=void 0===d?null:d;r===t.MODE_ASPECT_RATIO?(this.wFn=k(l),this.hFn=k(g),this.options={mode:r,ratio:c,maxWidth:l,maxHeight:g}):(this.wFn=k(a),this.hFn=k(h),this.options={mode:r,width:a,height:h})}return T(t,[{key:"fit",value:function(){var e=arguments.length<=0||void 0===arguments[0]?_("box"):arguments[0],n=arguments.length<=1||void 0===arguments[1]?_("container"):arguments[1],i=new nt(e),r=i.width,s=i.height,a=new nt(n),o=a.width,h=a.height,u=void 0;if(this.options.mode===t.MODE_ASPECT_RATIO){var c=this.options.ratio,f=this.wFn(o,o),l=this.hFn(h,h),d=Math.floor(c*l);u=f>=d?new nt(d,l):new nt(f,Math.floor(f/c))}else u=new nt(this.wFn(r,o),this.hFn(s,h));return{dimension:u,changed:!u.isEqual(i)}}}]),t}();it.MODE_BASIC="basic",it.MODE_ASPECT_RATIO="aspectRatio";var rt=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];A(this,t);var n=e||{},i=n.mode,r=void 0===i?t.MODE_WINDOW:i,s=n.target,a=void 0===s?null:s,o=n.interval,h=void 0===o?500:o;r!==t.MODE_POLLING||a||_("options.target"),this.mode=r,this.target=a,this.interval=h,this.check=this.check.bind(this),this.throttledCheck=u(this.check,this.interval),this.isWatching=!1,this.listeners={change:[]}}return T(t,[{key:"hasTargetChanged",value:function(){if(!this.target)return!0;var t=new nt(this.target);return this.currentDim&&t.isEqual(this.currentDim)?!1:(this.currentDim=t,!0)}},{key:"check",value:function(){return this.hasTargetChanged()&&this.dispatch("change",this.currentDim),this}},{key:"dispatch",value:function(t){for(var e=this,n=arguments.length,i=Array(n>1?n-1:0),r=1;n>r;r++)i[r-1]=arguments[r];return this.listeners[t].forEach(function(t){return t.apply(e,i)}),this}},{key:"on",value:function(t,e){return-1===this.listeners[t].indexOf(e)&&this.listeners[t].push(e),this}},{key:"off",value:function(t,e){return this.listeners[t]=this.listeners[t].filter(function(t){return t!==e}),this}},{key:"start",value:function(){return this.isWatching||(this.target&&(this.currentDim=new nt(this.target)),this.mode===t.MODE_WINDOW?window.addEventListener("resize",this.throttledCheck):this.mode===t.MODE_POLLING&&(this.intervalId=window.setInterval(this.check,this.interval)),this.isWatching=!0),this}},{key:"stop",value:function(){return this.isWatching&&(this.mode===t.MODE_WINDOW?window.removeEventListener("resize",this.throttledCheck):this.mode===t.MODE_POLLING&&this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.isWatching=!1),this}},{key:"destroy",value:function(){return this.stop(),this.listeners.change=[],this}}]),t}();rt.MODE_WINDOW="window",rt.MODE_POLLING="polling";var st=function(t){function e(){var t=arguments.length<=0||void 0===arguments[0]?_("box"):arguments[0],n=arguments.length<=1||void 0===arguments[1]?_("container"):arguments[1],i=arguments[2],r=arguments[3];A(this,e);var s=W(this,Object.getPrototypeOf(e).call(this,r)),a=new it(i);return s.fit=function(){return a.fit(t,n)},s}return x(e,t),T(e,[{key:"check",value:function(){if(this.hasTargetChanged()){var t=this.fit(),e=t.changed,n=t.dimension;e&&this.dispatch("change",n)}return this}}]),e}(rt),at=function(){function t(n){A(this,t);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var a=g.apply(void 0,[{},t.DEFAULT_OPTIONS].concat(r));this._state={width:a.initialWidth,height:a.initialHeight,innerWidth:0,innerHeight:0,fitOptions:null,options:a,data:null},this.container=e.select(n),this.container.style("line-height",0);var o=this.constructor.getCustomEventNames();this.setupDispatcher(o),this._dispatchData=h(this._dispatchData.bind(this),1),this._dispatchOptions=h(this._dispatchOptions.bind(this),1),this._dispatchResize=h(this._dispatchResize.bind(this),1),this._updateDimension=h(this._updateDimension.bind(this),1)}return T(t,null,[{key:"getCustomEventNames",value:function(){return[]}}]),T(t,[{key:"setupDispatcher",value:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];this._customEventNames=e,this._eventNames=t.DEFAULT_EVENTS.concat(e),this.dispatcher=n.dispatch.apply(this,this._eventNames)}},{key:"getCustomEventNames",value:function(){return this._customEventNames}},{key:"getInnerWidth",value:function(){return this._state.innerWidth}},{key:"getInnerHeight",value:function(){return this._state.innerHeight}},{key:"width",value:function(){if(0===arguments.length)return this._state.width;var t=Math.floor(+(arguments.length<=0?void 0:arguments[0]));return t!==this._state.width&&(this._state.width=t,this._updateDimension(),this._dispatchResize()),this}},{key:"height",value:function(){if(0===arguments.length)return this._state.height;var t=Math.floor(+(arguments.length<=0?void 0:arguments[0]));return t!==this._state.height&&(this._state.height=t,this._updateDimension(),this._dispatchResize()),this}},{key:"dimension",value:function(){if(0===arguments.length)return[this._state.width,this._state.height];var t=arguments.length<=0?void 0:arguments[0],e=N(t,2),n=e[0],i=e[1];return this.width(n).height(i),this}},{key:"data",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];if(0===e.length)return this._state.data;var i=e[0];return this._state.data=i,this._dispatchData(),this}},{key:"margin",value:function(){if(0===arguments.length)return this._state.options.margin;var t=this._state.options.margin,e=v({},this._state.options.margin,arguments.length<=0?void 0:arguments[0]),n=Object.keys(t).some(function(n){return t[n]!==e[n]});return n&&(this._state.options.margin=e,this._updateDimension(),this._dispatchResize()),this}},{key:"offset",value:function(){if(0===arguments.length)return this._state.options.offset;var t=this._state.options.offset,e=v({},this._state.offset,arguments.length<=0?void 0:arguments[0]),n=Object.keys(t).some(function(n){return t[n]!==e[n]});return n&&(this._state.options.offset=e,this._updateDimension(),this._dispatchResize()),this}},{key:"options",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];if(0===e.length)return this._state.options;var i=e[0];return i.margin&&this.margin(i.margin),i.offset&&this.offset(i.offset),this._state.options=g(this._state.options,i),this._dispatchOptions(),this}},{key:"_updateDimension",value:function(){var t=this._state,e=t.width,n=t.height,i=this._state.options.margin,r=i.top,s=i.right,a=i.bottom,o=i.left;return this._state.innerWidth=e-o-s,this._state.innerHeight=n-r-a,this}},{key:"updateDimensionNow",value:function(){return this._updateDimension(),this._updateDimension.flush(),this}},{key:"hasData",value:function(){var t=this._state.data;return null!==t&&void 0!==t}},{key:"hasNonZeroArea",value:function(){var t=this._state,e=t.innerWidth,n=t.innerHeight;return e>0&&n>0}},{key:"fit",value:function(t){var e=this,n=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];t&&(this._state.fitOptions=t);var r=new it(t),s=r.fit(this.dimension(),this.container.node()),a=s.changed,o=s.dimension;a&&this.dimension([o.width,o.height]);var h=!!n;return h&&(this.fitWatcher&&this.fitWatcher.destroy(),this.fitWatcher=new st(this.dimension(),this.container.node(),this._state.fitOptions,i(n)?n:null).on("change",function(t){return e.dimension([t.width,t.height])}).start()),this}},{key:"stopFitWatcher",value:function(){return this.fitWatcher&&(this.fitWatcher.destroy(),this.fitWatcher=null),this}},{key:"_dispatchData",value:function(){return this.dispatcher.call("data",this,this._state.data),this}},{key:"_dispatchOptions",value:function(){return this.dispatcher.call("options",this,this._state.options),this}},{key:"_dispatchResize",value:function(){var t=this._state,e=t.width,n=t.height,i=t.innerWidth,r=t.innerHeight;return this.dispatcher.apply("resize",this,[e,n,i,r]),this}},{key:"on",value:function(t,e){return this.dispatcher.on(t,e),this}},{key:"off",value:function(t){return this.dispatcher.on(t,null),this}},{key:"destroy",value:function(){var t=this;this._eventNames.forEach(function(e){t.off(e)}),this.stopFitWatcher()}}]),t}();at.DEFAULT_OPTIONS={initialWidth:720,initialHeight:500,margin:{top:30,right:30,bottom:30,left:30},offset:{x:.5,y:.5}},at.DEFAULT_EVENTS=["data","options","resize"];var ot=function(t){function e(t){var n;A(this,e);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var a=W(this,(n=Object.getPrototypeOf(e)).call.apply(n,[this,t,e.DEFAULT_OPTIONS].concat(r)));return a.canvas=a.container.append("canvas"),a.updateDimensionNow(),a}return x(e,t),T(e,null,[{key:"getCustomEventNames",value:function(){return[]}}]),T(e,[{key:"getContext2d",value:function(){var t=this.options(),e=t.pixelRatio,n=t.margin,i=t.offset,r=this.canvas.node().getContext("2d");return r.setTransform(1,0,0,1,0,0),r.scale(e,e),r.translate(n.left+i.x,n.top+i.y),r}},{key:"clear",value:function(){var t=this.options(),e=t.pixelRatio,n=this.canvas.node().getContext("2d");return n.setTransform(1,0,0,1,0,0),n.scale(e,e),n.clearRect(0,0,this.width(),this.height()),this}},{key:"_updateDimension",value:function(){j(Object.getPrototypeOf(e.prototype),"_updateDimension",this).call(this);var t=this._state,n=t.width,i=t.height,r=this._state.options.pixelRatio;return this.canvas.style("width",n).style("height",i).attr("width",n*r).attr("height",i*r),this}}]),e}(at);ot.DEFAULT_OPTIONS={pixelRatio:window.devicePixelRatio};var ht=function(t){function e(t){var n;A(this,e);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var a=W(this,(n=Object.getPrototypeOf(e)).call.apply(n,[this,t,e.DEFAULT_OPTIONS].concat(r)));return a.svg=a.container.append("svg"),a.rootG=a.svg.append("g"),a.layers=new D(a.rootG),a.updateDimensionNow(),a}return x(e,t),T(e,null,[{key:"getCustomEventNames",value:function(){return[]}}]),T(e,[{key:"_updateDimension",value:function(){j(Object.getPrototypeOf(e.prototype),"_updateDimension",this).call(this);var t=this._state,n=t.width,i=t.height,r=this._state.options,s=r.offset,a=r.margin,o=a.top,h=a.left;return this.svg.attr("width",n).attr("height",i),this.rootG.attr("transform","translate("+(h+s.x)+","+(o+s.y)+")"),this}}]),e}(at);ht.DEFAULT_OPTIONS={},t.helper=et,t.AbstractChart=at,t.CanvasChart=ot,t.SvgChart=ht,t.LayerOrganizer=D,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-selection"),require("d3-dispatch")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch"],e):e(t.d3Kit=t.d3Kit||{},t.d3,t.d3)}(this,function(t,e,n){"use strict";function i(t){var e="undefined"==typeof t?"undefined":E(t);return null!=t&&("object"==e||"function"==e)}function r(t){var e=i(t)?M.call(t):"";return e==N||e==P||e==S}function s(t){return null!=t&&"object"==("undefined"==typeof t?"undefined":E(t))}function o(t){return"symbol"==("undefined"==typeof t?"undefined":E(t))||s(t)&&G.call(t)==H}function a(t){if("number"==typeof t)return t;if(o(t))return $;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(q,"");var n=K.test(t);return n||V.test(t)?Z(t.slice(2),n?2:8):B.test(t)?$:+t}function u(t,e,n){function r(e){var n=g,i=v;return g=v=void 0,w=e,m=t.apply(i,n)}function s(t){return w=t,y=setTimeout(h,e),b?r(t):m}function o(t){var n=t-_,i=t-w,r=e-n;return O?X(r,p-i):r}function u(t){var n=t-_,i=t-w;return void 0===_||n>=e||0>n||O&&i>=p}function h(){var t=z();return u(t)?c(t):void(y=setTimeout(h,o(t)))}function c(t){return y=void 0,k&&g?r(t):(g=v=void 0,m)}function f(){void 0!==y&&clearTimeout(y),w=0,g=_=v=y=void 0}function l(){return void 0===y?m:c(z())}function d(){var t=z(),n=u(t);if(g=arguments,v=this,_=t,n){if(void 0===y)return s(_);if(O)return y=setTimeout(h,e),r(_)}return void 0===y&&(y=setTimeout(h,e)),m}var g,v,p,m,y,_,w=0,b=!1,O=!1,k=!0;if("function"!=typeof t)throw new TypeError(J);return e=a(e)||0,i(n)&&(b=!!n.leading,O="maxWait"in n,p=O?Q(a(n.maxWait)||0,e):p,k="trailing"in n?!!n.trailing:k),d.cancel=f,d.flush=l,d}function h(t,e,n){var r=!0,s=!0;if("function"!=typeof t)throw new TypeError(Y);return i(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),u(t,e,{leading:r,maxWait:e,trailing:s})}function c(t){return null==t?"":String(t).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function f(t){return null==t?"\\s":t.source?t.source:"["+c(t)+"]"}function l(t,e){if(null==t)return"";if(!e&&tt)return tt.call(t);var n=f(e),i=new RegExp("^"+n+"+|"+n+"+$","g");return String(t).replace(i,"")}function d(t){return l(t).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()}function g(t){t=t||{};for(var e=1;e<arguments.length;e++){var n=arguments[e];if(n)for(var s in n)if(n.hasOwnProperty(s)){var o=n[s];t[s]=!i(o)||Array.isArray(o)||r(o)?o:g(t[s],o)}}return t}function v(t){t=t||{};for(var e=1;e<arguments.length;e++)if(arguments[e])for(var n in arguments[e])arguments[e].hasOwnProperty(n)&&(t[n]=arguments[e][n]);return t}function p(t,e,n){return function(){var i=n.apply(e,arguments);return i===e?t:i}}function m(t,e){for(var n=1,i=arguments.length,r=void 0;++n<i;)t[r=arguments[n]]=p(t,e,e[r]);return t}function y(t){return r(t)?t:function(){return t}}function _(t){throw new Error("Missing parameter "+t)}function w(t){return null!==t&&void 0!==t}function b(t){return null===t||void 0===t}function O(t){return!(!t||1!==t.nodeType)}function k(t){if(b(t))return function(t,e){return Math.min(t,e)};var e=(""+t).trim().toLowerCase();if(e.indexOf("%")>-1){var n=function(){var t=+e.replace("%","")/100;return{v:function(e,n){return n*t}}}();if("object"===("undefined"==typeof n?"undefined":E(n)))return n.v}return function(){return+e.replace("px","")}}function D(t){function e(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",i=e.split("."),r=void 0,s=void 0;i.length>1?(s=i[0].length>0?i[0]:u,r=i[1]):(s=u,r=i[0]);var o=""+n+r;if(h.hasOwnProperty(o))throw new Error("invalid or duplicate layer id: "+o);var a=d(r)+"-layer",c=t.append(s).classed(a,!0);return h[o]=c,c}function n(t,r){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";if(Array.isArray(r))return r.map(function(e){return n(t,e,s)});if(i(r)){var o=Object.keys(r),a=I(o,1),u=a[0],h=e(t,u,s);return n(h,r[u],""+s+u+"/"),h}return e(t,r,s)}function r(e){return n(t,e)}function s(t){return Array.isArray(t)?t.map(r):r(t)}function o(t){return h[t]}function a(t){return!!h[t]}var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"g",h={};return{create:s,get:o,has:a}}var E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},x=(function(){function t(t){this.value=t}function e(e){function n(t,e){return new Promise(function(n,r){var a={key:t,arg:e,resolve:n,reject:r,next:null};o?o=o.next=a:(s=o=a,i(t,e))})}function i(n,s){try{var o=e[n](s),a=o.value;a instanceof t?Promise.resolve(a.value).then(function(t){i("next",t)},function(t){i("throw",t)}):r(o.done?"return":"normal",o.value)}catch(u){r("throw",u)}}function r(t,e){switch(t){case"return":s.resolve({value:e,done:!0});break;case"throw":s.reject(e);break;default:s.resolve({value:e,done:!1})}s=s.next,s?i(s.key,s.arg):o=null}var s,o;this._invoke=n,"function"!=typeof e["return"]&&(this["return"]=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype["throw"]=function(t){return this._invoke("throw",t)},e.prototype["return"]=function(t){return this._invoke("return",t)},{wrap:function(t){return function(){return new e(t.apply(this,arguments))}},await:function(e){return new t(e)}}}(),function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}),j=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),A=function ht(t,e,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,e);if(void 0===i){var r=Object.getPrototypeOf(t);return null===r?void 0:ht(r,e,n)}if("value"in i)return i.value;var s=i.get;return void 0===s?void 0:s.call(n)},T=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},W=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},I=function(){function t(t,e){var n=[],i=!0,r=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(i=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);i=!0);}catch(u){r=!0,s=u}finally{try{!i&&a["return"]&&a["return"]()}finally{if(r)throw s}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),N="[object Function]",P="[object GeneratorFunction]",S="[object Proxy]",C=Object.prototype,M=C.toString,F="object"==("undefined"==typeof global?"undefined":E(global))&&global&&global.Object===Object&&global,L="object"==("undefined"==typeof self?"undefined":E(self))&&self&&self.Object===Object&&self,R=F||L||Function("return this")(),z=function(){return R.Date.now()},H="[object Symbol]",U=Object.prototype,G=U.toString,$=0/0,q=/^\s+|\s+$/g,B=/^[-+]0x[0-9a-f]+$/i,K=/^0b[01]+$/i,V=/^0o[0-7]+$/i,Z=parseInt,J="Expected a function",Q=Math.max,X=Math.min,Y="Expected a function",tt=String.prototype.trim,et=Object.freeze({isObject:i,isFunction:r,kebabCase:d,deepExtend:g,extend:v,rebind:m,functor:y,debounce:u,throttle:h}),nt=function(){function t(){x(this,t);for(var e=arguments.length,n=Array(e),i=0;e>i;i++)n[i]=arguments[i];if(1===n.length){var s=n[0],o=r(s)?s():s;if(o instanceof t)this.width=o.width,this.height=o.height;else if(O(o))this.width=o.clientWidth,this.height=o.clientHeight;else if(Array.isArray(o))this.width=o[0],this.height=o[1];else{if(!(w(o)&&w(o.width)&&w(o.height))){var a=new Error("Unsupported input. Must be either\n DOMNode, Array or Object with field width and height,\n or a function that returns any of the above.");throw a.value=s,a}this.width=o.width,this.height=o.height}}else{var u=n[0],h=n[1];this.width=u,this.height=h}}return j(t,[{key:"isEqual",value:function(e){if(e instanceof t)return this.width===e.width&&this.height===e.height;var n=new t(e);return this.width===n.width&&this.height===n.height}},{key:"toArray",value:function(){return[this.width,this.height]}},{key:"toObject",value:function(){return{width:this.width,height:this.height}}}]),t}(),it=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};x(this,t);var n=e||{},i=n.mode,r=void 0===i?t.MODE_BASIC:i,s=n.width,o=void 0===s?"100%":s,a=n.height,u=void 0===a?null:a,h=n.ratio,c=void 0===h?1:h,f=n.maxWidth,l=void 0===f?null:f,d=n.maxHeight,g=void 0===d?null:d;r===t.MODE_ASPECT_RATIO?(this.wFn=k(l),this.hFn=k(g),this.options={mode:r,ratio:c,maxWidth:l,maxHeight:g}):(this.wFn=k(o),this.hFn=k(u),this.options={mode:r,width:o,height:u})}return j(t,[{key:"fit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_("box"),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_("container"),i=new nt(e),r=i.width,s=i.height,o=new nt(n),a=o.width,u=o.height,h=void 0;if(this.options.mode===t.MODE_ASPECT_RATIO){var c=this.options.ratio,f=this.wFn(a,a),l=this.hFn(u,u),d=Math.floor(c*l);h=f>=d?new nt(d,l):new nt(f,Math.floor(f/c))}else h=new nt(this.wFn(r,a),this.hFn(s,u));return{dimension:h,changed:!h.isEqual(i)}}}]),t}();it.MODE_BASIC="basic",it.MODE_ASPECT_RATIO="aspectRatio";var rt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};x(this,t);var n=e||{},i=n.mode,r=void 0===i?t.MODE_WINDOW:i,s=n.target,o=void 0===s?null:s,a=n.interval,u=void 0===a?500:a;r!==t.MODE_POLLING||o||_("options.target"),this.mode=r,this.target=o,this.interval=u,this.check=this.check.bind(this),this.throttledCheck=h(this.check,this.interval),this.isWatching=!1,this.listeners={change:[]}}return j(t,[{key:"hasTargetChanged",value:function(){if(!this.target)return!0;var t=new nt(this.target);return this.currentDim&&t.isEqual(this.currentDim)?!1:(this.currentDim=t,!0)}},{key:"check",value:function(){return this.hasTargetChanged()&&this.dispatch("change",this.currentDim),this}},{key:"dispatch",value:function(t){for(var e=this,n=arguments.length,i=Array(n>1?n-1:0),r=1;n>r;r++)i[r-1]=arguments[r];return this.listeners[t].forEach(function(t){return t.apply(e,i)}),this}},{key:"on",value:function(t,e){return-1===this.listeners[t].indexOf(e)&&this.listeners[t].push(e),this}},{key:"off",value:function(t,e){return this.listeners[t]=this.listeners[t].filter(function(t){return t!==e}),this}},{key:"start",value:function(){return this.isWatching||(this.target&&(this.currentDim=new nt(this.target)),this.mode===t.MODE_WINDOW?window.addEventListener("resize",this.throttledCheck):this.mode===t.MODE_POLLING&&(this.intervalId=window.setInterval(this.check,this.interval)),this.isWatching=!0),this}},{key:"stop",value:function(){return this.isWatching&&(this.mode===t.MODE_WINDOW?window.removeEventListener("resize",this.throttledCheck):this.mode===t.MODE_POLLING&&this.intervalId&&(window.clearInterval(this.intervalId),this.intervalId=null),this.isWatching=!1),this}},{key:"destroy",value:function(){return this.stop(),this.listeners.change=[],this}}]),t}();rt.MODE_WINDOW="window",rt.MODE_POLLING="polling";var st=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_("box"),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_("container"),i=arguments[2],r=arguments[3];x(this,e);var s=W(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,r)),o=new it(i);return s.fit=function(){return o.fit(t,n)},s}return T(e,t),j(e,[{key:"check",value:function(){if(this.hasTargetChanged()){var t=this.fit(),e=t.changed,n=t.dimension;e&&this.dispatch("change",n)}return this}}]),e}(rt),ot=function(){function t(n){x(this,t);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var o=g.apply(void 0,[{},t.DEFAULT_OPTIONS].concat(r));this._state={width:o.initialWidth,height:o.initialHeight,innerWidth:0,innerHeight:0,fitOptions:null,options:o,data:null},this.container=e.select(n),this.container.style("line-height",0);var a=this.constructor.getCustomEventNames();this.setupDispatcher(a),this._dispatchData=u(this._dispatchData.bind(this),1),this._dispatchOptions=u(this._dispatchOptions.bind(this),1),this._dispatchResize=u(this._dispatchResize.bind(this),1),this._updateDimension=u(this._updateDimension.bind(this),1)}return j(t,null,[{key:"getCustomEventNames",value:function(){return[]}}]),j(t,[{key:"setupDispatcher",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._customEventNames=e,this._eventNames=t.DEFAULT_EVENTS.concat(e),this.dispatcher=n.dispatch.apply(this,this._eventNames)}},{key:"getCustomEventNames",value:function(){return this._customEventNames}},{key:"getInnerWidth",value:function(){return this._state.innerWidth}},{key:"getInnerHeight",value:function(){return this._state.innerHeight}},{key:"width",value:function(){if(0===arguments.length)return this._state.width;var t=Math.floor(+(arguments.length<=0?void 0:arguments[0]));return t!==this._state.width&&(this._state.width=t,this._updateDimension(),this._dispatchResize()),this}},{key:"height",value:function(){if(0===arguments.length)return this._state.height;var t=Math.floor(+(arguments.length<=0?void 0:arguments[0]));return t!==this._state.height&&(this._state.height=t,this._updateDimension(),this._dispatchResize()),this}},{key:"dimension",value:function(){if(0===arguments.length)return[this._state.width,this._state.height];var t=arguments.length<=0?void 0:arguments[0],e=I(t,2),n=e[0],i=e[1];return this.width(n).height(i),this}},{key:"data",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];if(0===e.length)return this._state.data;var i=e[0];return this._state.data=i,this._dispatchData(),this}},{key:"margin",value:function(){if(0===arguments.length)return this._state.options.margin;var t=this._state.options.margin,e=v({},this._state.options.margin,arguments.length<=0?void 0:arguments[0]),n=Object.keys(t).some(function(n){return t[n]!==e[n]});return n&&(this._state.options.margin=e,this._updateDimension(),this._dispatchResize()),this}},{key:"offset",value:function(){if(0===arguments.length)return this._state.options.offset;var t=this._state.options.offset,e=v({},this._state.offset,arguments.length<=0?void 0:arguments[0]),n=Object.keys(t).some(function(n){return t[n]!==e[n]});return n&&(this._state.options.offset=e,this._updateDimension(),this._dispatchResize()),this}},{key:"options",value:function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];if(0===e.length)return this._state.options;var i=e[0];return i.margin&&this.margin(i.margin),i.offset&&this.offset(i.offset),this._state.options=g(this._state.options,i),this._dispatchOptions(),this}},{key:"_updateDimension",value:function(){var t=this._state,e=t.width,n=t.height,i=this._state.options.margin,r=i.top,s=i.right,o=i.bottom,a=i.left;return this._state.innerWidth=e-a-s,this._state.innerHeight=n-r-o,this}},{key:"updateDimensionNow",value:function(){return this._updateDimension(),this._updateDimension.flush(),this}},{key:"hasData",value:function(){var t=this._state.data;return null!==t&&void 0!==t}},{key:"hasNonZeroArea",value:function(){var t=this._state,e=t.innerWidth,n=t.innerHeight;return e>0&&n>0}},{key:"fit",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:!1;t&&(this._state.fitOptions=t);var r=new it(t),s=r.fit(this.dimension(),this.container.node()),o=s.changed,a=s.dimension;o&&this.dimension([a.width,a.height]);var u=!!n;return u&&(this.fitWatcher&&this.fitWatcher.destroy(),this.fitWatcher=new st(this.dimension(),this.container.node(),this._state.fitOptions,i(n)?n:null).on("change",function(t){return e.dimension([t.width,t.height])}).start()),this}},{key:"stopFitWatcher",value:function(){return this.fitWatcher&&(this.fitWatcher.destroy(),this.fitWatcher=null),this}},{key:"_dispatchData",value:function(){return this.dispatcher.call("data",this,this._state.data),this}},{key:"_dispatchOptions",value:function(){return this.dispatcher.call("options",this,this._state.options),this}},{key:"_dispatchResize",value:function(){var t=this._state,e=t.width,n=t.height,i=t.innerWidth,r=t.innerHeight;return this.dispatcher.apply("resize",this,[e,n,i,r]),this}},{key:"on",value:function(t,e){return this.dispatcher.on(t,e),this}},{key:"off",value:function(t){return this.dispatcher.on(t,null),this}},{key:"destroy",value:function(){var t=this;this._eventNames.forEach(function(e){t.off(e)}),this.stopFitWatcher()}}]),t}();ot.DEFAULT_OPTIONS={initialWidth:720,initialHeight:500,margin:{top:30,right:30,bottom:30,left:30},offset:{x:.5,y:.5}},ot.DEFAULT_EVENTS=["data","options","resize"];var at=function(t){function e(t){var n;x(this,e);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var o=W(this,(n=e.__proto__||Object.getPrototypeOf(e)).call.apply(n,[this,t,e.DEFAULT_OPTIONS].concat(r)));return o.canvas=o.container.append("canvas"),o.updateDimensionNow(),o}return T(e,t),j(e,null,[{key:"getCustomEventNames",value:function(){return[]}}]),j(e,[{key:"getContext2d",value:function(){var t=this.options(),e=t.pixelRatio,n=t.margin,i=t.offset,r=this.canvas.node().getContext("2d");return r.setTransform(1,0,0,1,0,0),r.scale(e,e),r.translate(n.left+i.x,n.top+i.y),r}},{key:"clear",value:function(){var t=this.options(),e=t.pixelRatio,n=this.canvas.node().getContext("2d");return n.setTransform(1,0,0,1,0,0),n.scale(e,e),n.clearRect(0,0,this.width(),this.height()),this}},{key:"_updateDimension",value:function(){A(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_updateDimension",this).call(this);var t=this._state,n=t.width,i=t.height,r=this._state.options.pixelRatio;return this.canvas.style("width",n).style("height",i).attr("width",n*r).attr("height",i*r),this}}]),e}(ot);at.DEFAULT_OPTIONS={pixelRatio:window.devicePixelRatio};var ut=function(t){function e(t){var n;x(this,e);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];var o=W(this,(n=e.__proto__||Object.getPrototypeOf(e)).call.apply(n,[this,t,e.DEFAULT_OPTIONS].concat(r)));return o.svg=o.container.append("svg"),o.rootG=o.svg.append("g"),o.layers=new D(o.rootG),o.updateDimensionNow(),o}return T(e,t),j(e,null,[{key:"getCustomEventNames",value:function(){return[]}}]),j(e,[{key:"_updateDimension",value:function(){A(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_updateDimension",this).call(this);var t=this._state,n=t.width,i=t.height,r=this._state.options,s=r.offset,o=r.margin,a=o.top,u=o.left;return this.svg.attr("width",n).attr("height",i),this.rootG.attr("transform","translate("+(u+s.x)+","+(a+s.y)+")"),this}}]),e}(ot);ut.DEFAULT_OPTIONS={},t.helper=et,t.AbstractChart=ot,t.CanvasChart=at,t.SvgChart=ut,t.LayerOrganizer=D,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "d3kit",
"version": "3.0.0-8",
"version": "3.0.0-9",
"description": "A kit of tools to speed D3 related project development.",

@@ -25,3 +25,3 @@ "repository": {

],
"peerDependencies": {
"dependencies": {
"d3-dispatch": "^1.0.1",

@@ -38,4 +38,2 @@ "d3-selection": "^1.0.2"

"chai": "^3.5.0",
"d3-dispatch": "~1.0.1",
"d3-selection": "~1.0.2",
"eslint": "^2.9.0",

@@ -42,0 +40,0 @@ "eslint-config-airbnb": "^9.0.1",

@@ -19,11 +19,5 @@ # d3Kit

```bash
npm install d3-selection d3-dispatch d3kit --save
npm install d3kit --save
```
Note: d3Kit **v3** is still in beta. Latest stable release is **v2.0.0**
```bash
npm install d3kit@2.0.0 --save
```
See [getting start guide](docs/Getting-started.md) for more details.

@@ -30,0 +24,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc