billboard.js 3.11.2 → 3.12.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/README.md +2 -6
  2. package/dist/billboard.css +5 -1
  3. package/dist/billboard.js +19431 -24292
  4. package/dist/billboard.min.css +2 -2
  5. package/dist/billboard.min.js +26 -3
  6. package/dist/billboard.pkgd.js +22301 -29057
  7. package/dist/billboard.pkgd.min.js +33 -3
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +77 -175
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -3
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +423 -1134
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.js +660 -1524
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +15 -3
  14. package/dist/plugin/billboardjs-plugin-tableview.js +503 -1175
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +30 -3
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +351 -1055
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -3
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +339 -1324
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -3
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +1701 -3424
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -3
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2385 -4462
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -3
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1783 -3467
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +33 -3
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2031 -3979
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -3
  28. package/dist/theme/dark.css +5 -1
  29. package/dist/theme/dark.min.css +2 -2
  30. package/dist/theme/datalab.css +5 -1
  31. package/dist/theme/datalab.min.css +2 -2
  32. package/dist/theme/graph.css +5 -1
  33. package/dist/theme/graph.min.css +2 -2
  34. package/dist/theme/insight.css +5 -1
  35. package/dist/theme/insight.min.css +2 -2
  36. package/dist/theme/modern.css +5 -1
  37. package/dist/theme/modern.min.css +3 -4
  38. package/dist-esm/billboard.js +9051 -8666
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +19 -25
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +149 -148
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +295 -286
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +235 -234
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +40 -41
  44. package/package.json +26 -46
  45. package/src/Chart/api/axis.ts +6 -13
  46. package/src/Chart/api/chart.ts +12 -11
  47. package/src/Chart/api/data.ts +8 -7
  48. package/src/Chart/api/export.ts +28 -21
  49. package/src/Chart/api/flow.ts +4 -2
  50. package/src/Chart/api/grid.ts +1 -5
  51. package/src/Chart/api/load.ts +2 -2
  52. package/src/Chart/api/regions.ts +29 -5
  53. package/src/Chart/api/selection.ts +2 -2
  54. package/src/Chart/api/show.ts +2 -3
  55. package/src/Chart/api/subchart.ts +2 -2
  56. package/src/Chart/api/tooltip.ts +5 -7
  57. package/src/Chart/api/x.ts +2 -2
  58. package/src/Chart/api/zoom.ts +2 -2
  59. package/src/ChartInternal/Axis/Axis.ts +119 -44
  60. package/src/ChartInternal/Axis/AxisRenderer.ts +53 -38
  61. package/src/ChartInternal/Axis/AxisRendererHelper.ts +2 -2
  62. package/src/ChartInternal/ChartInternal.ts +79 -51
  63. package/src/ChartInternal/data/IData.ts +22 -29
  64. package/src/ChartInternal/data/convert.helper.ts +66 -68
  65. package/src/ChartInternal/data/convert.ts +11 -11
  66. package/src/ChartInternal/data/data.ts +40 -23
  67. package/src/ChartInternal/data/load.ts +7 -6
  68. package/src/ChartInternal/interactions/drag.ts +2 -1
  69. package/src/ChartInternal/interactions/eventrect.ts +54 -25
  70. package/src/ChartInternal/interactions/flow.ts +14 -4
  71. package/src/ChartInternal/interactions/interaction.ts +34 -12
  72. package/src/ChartInternal/interactions/subchart.ts +27 -25
  73. package/src/ChartInternal/interactions/zoom.ts +29 -18
  74. package/src/ChartInternal/internals/category.ts +1 -1
  75. package/src/ChartInternal/internals/class.ts +5 -5
  76. package/src/ChartInternal/internals/clip.ts +9 -10
  77. package/src/ChartInternal/internals/color.ts +70 -42
  78. package/src/ChartInternal/internals/domain.ts +59 -28
  79. package/src/ChartInternal/internals/format.ts +5 -5
  80. package/src/ChartInternal/internals/grid.ts +130 -47
  81. package/src/ChartInternal/internals/legend.ts +99 -66
  82. package/src/ChartInternal/internals/redraw.ts +3 -2
  83. package/src/ChartInternal/internals/region.ts +5 -3
  84. package/src/ChartInternal/internals/scale.ts +28 -15
  85. package/src/ChartInternal/internals/selection.ts +14 -13
  86. package/src/ChartInternal/internals/size.axis.ts +18 -10
  87. package/src/ChartInternal/internals/size.ts +97 -66
  88. package/src/ChartInternal/internals/style.ts +21 -19
  89. package/src/ChartInternal/internals/text.ts +64 -39
  90. package/src/ChartInternal/internals/title.ts +2 -2
  91. package/src/ChartInternal/internals/tooltip.ts +83 -34
  92. package/src/ChartInternal/internals/transform.ts +2 -2
  93. package/src/ChartInternal/internals/type.ts +12 -12
  94. package/src/ChartInternal/shape/arc.ts +78 -44
  95. package/src/ChartInternal/shape/area.ts +19 -22
  96. package/src/ChartInternal/shape/bar.ts +41 -31
  97. package/src/ChartInternal/shape/bubble.ts +5 -5
  98. package/src/ChartInternal/shape/candlestick.ts +15 -13
  99. package/src/ChartInternal/shape/gauge.ts +16 -9
  100. package/src/ChartInternal/shape/line.ts +62 -46
  101. package/src/ChartInternal/shape/point.common.ts +1 -4
  102. package/src/ChartInternal/shape/point.ts +52 -32
  103. package/src/ChartInternal/shape/polar.ts +4 -2
  104. package/src/ChartInternal/shape/radar.ts +40 -22
  105. package/src/ChartInternal/shape/shape.ts +84 -58
  106. package/src/ChartInternal/shape/treemap.ts +29 -20
  107. package/src/Plugin/bubblecompare/index.ts +1 -3
  108. package/src/Plugin/sparkline/index.ts +3 -4
  109. package/src/Plugin/stanford/ColorScale.ts +3 -2
  110. package/src/Plugin/stanford/Elements.ts +15 -6
  111. package/src/Plugin/stanford/Options.ts +5 -5
  112. package/src/Plugin/stanford/index.ts +13 -9
  113. package/src/Plugin/tableview/Options.ts +1 -1
  114. package/src/Plugin/tableview/const.ts +1 -4
  115. package/src/Plugin/tableview/index.ts +11 -9
  116. package/src/Plugin/textoverlap/index.ts +4 -6
  117. package/src/config/Options/Options.ts +3 -3
  118. package/src/config/Options/axis/axis.ts +36 -0
  119. package/src/config/Options/axis/x.ts +12 -13
  120. package/src/config/Options/axis/y.ts +13 -13
  121. package/src/config/Options/axis/y2.ts +23 -10
  122. package/src/config/Options/common/color.ts +4 -4
  123. package/src/config/Options/common/grid.ts +4 -4
  124. package/src/config/Options/common/legend.ts +13 -14
  125. package/src/config/Options/common/main.ts +23 -23
  126. package/src/config/Options/common/point.ts +17 -18
  127. package/src/config/Options/common/title.ts +2 -2
  128. package/src/config/Options/common/tooltip.ts +13 -11
  129. package/src/config/Options/data/axis.ts +2 -2
  130. package/src/config/Options/data/data.ts +45 -45
  131. package/src/config/Options/interaction/interaction.ts +1 -1
  132. package/src/config/Options/interaction/subchart.ts +2 -2
  133. package/src/config/Options/interaction/zoom.ts +9 -9
  134. package/src/config/Options/shape/arc.ts +10 -13
  135. package/src/config/Options/shape/area.ts +5 -7
  136. package/src/config/Options/shape/bar.ts +8 -10
  137. package/src/config/Options/shape/bubble.ts +1 -1
  138. package/src/config/Options/shape/candlestick.ts +2 -2
  139. package/src/config/Options/shape/donut.ts +4 -4
  140. package/src/config/Options/shape/gauge.ts +6 -6
  141. package/src/config/Options/shape/line.ts +3 -3
  142. package/src/config/Options/shape/pie.ts +5 -5
  143. package/src/config/Options/shape/polar.ts +3 -3
  144. package/src/config/Options/shape/radar.ts +2 -2
  145. package/src/config/Options/shape/scatter.ts +1 -1
  146. package/src/config/Options/shape/treemap.ts +1 -1
  147. package/src/config/Store/Element.ts +8 -5
  148. package/src/config/Store/State.ts +19 -13
  149. package/src/config/classes.ts +6 -4
  150. package/src/config/config.ts +1 -1
  151. package/src/config/resolver/axis.ts +4 -4
  152. package/src/config/resolver/interaction.ts +3 -7
  153. package/src/config/resolver/shape.ts +11 -12
  154. package/src/core.ts +2 -3
  155. package/src/index.esm.ts +2 -6
  156. package/src/index.ts +2 -2
  157. package/src/module/Cache.ts +2 -3
  158. package/src/module/browser.ts +15 -10
  159. package/src/module/error.ts +9 -8
  160. package/src/module/generator.ts +3 -5
  161. package/src/module/util.ts +60 -37
  162. package/src/module/worker.ts +14 -11
  163. package/src/scss/billboard.scss +6 -0
  164. package/src/scss/theme/dark.scss +6 -0
  165. package/src/scss/theme/datalab.scss +6 -0
  166. package/src/scss/theme/graph.scss +6 -0
  167. package/src/scss/theme/insight.scss +6 -0
  168. package/src/scss/theme/modern.scss +6 -0
  169. package/types/axis.d.ts +7 -0
  170. package/types/options.d.ts +7 -0
  171. package/types/options.shape.d.ts +7 -0
@@ -5,20 +5,20 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.11.2
8
+ * @version 3.12.0-next.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
12
12
  (function webpackUniversalModuleDefinition(root, factory) {
13
13
  if(typeof exports === 'object' && typeof module === 'object')
14
- module.exports = factory(require("d3-selection"), require("d3-brush"));
14
+ module.exports = factory(require("d3-brush"), require("d3-selection"));
15
15
  else if(typeof define === 'function' && define.amd)
16
- define("bb", ["d3-selection", "d3-brush"], factory);
16
+ define("bb", ["d3-brush", "d3-selection"], factory);
17
17
  else if(typeof exports === 'object')
18
- exports["bb"] = factory(require("d3-selection"), require("d3-brush"));
18
+ exports["bb"] = factory(require("d3-brush"), require("d3-selection"));
19
19
  else
20
20
  root["bb"] = root["bb"] || {}, root["bb"]["plugin"] = root["bb"]["plugin"] || {}, root["bb"]["plugin"]["sparkline"] = factory(root["d3"], root["d3"]);
21
- })(this, function(__WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__3__) {
21
+ })(this, function(__WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__1__) {
22
22
  return /******/ (function() { // webpackBootstrap
23
23
  /******/ "use strict";
24
24
  /******/ var __webpack_modules__ = ([
@@ -90,91 +90,23 @@ __webpack_require__.d(__webpack_exports__, {
90
90
  "default": function() { return /* binding */ Sparkline; }
91
91
  });
92
92
 
93
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
94
- function _newArrowCheck(innerThis, boundThis) {
95
- if (innerThis !== boundThis) {
96
- throw new TypeError("Cannot instantiate an arrow function");
97
- }
98
- }
99
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
100
- function _assertThisInitialized(self) {
101
- if (self === void 0) {
102
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
103
- }
104
- return self;
105
- }
106
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
107
- function _setPrototypeOf(o, p) {
108
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
109
- o.__proto__ = p;
110
- return o;
111
- };
112
- return _setPrototypeOf(o, p);
113
- }
114
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
115
-
116
- function _inheritsLoose(subClass, superClass) {
117
- subClass.prototype = Object.create(superClass.prototype);
118
- subClass.prototype.constructor = subClass;
119
- _setPrototypeOf(subClass, superClass);
120
- }
121
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
122
- function _typeof(o) {
123
- "@babel/helpers - typeof";
124
-
125
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
126
- return typeof o;
127
- } : function (o) {
128
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
129
- }, _typeof(o);
130
- }
131
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
132
-
133
- function toPrimitive(t, r) {
134
- if ("object" != _typeof(t) || !t) return t;
135
- var e = t[Symbol.toPrimitive];
136
- if (void 0 !== e) {
137
- var i = e.call(t, r || "default");
138
- if ("object" != _typeof(i)) return i;
139
- throw new TypeError("@@toPrimitive must return a primitive value.");
140
- }
141
- return ("string" === r ? String : Number)(t);
142
- }
143
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
144
-
145
-
146
- function toPropertyKey(t) {
147
- var i = toPrimitive(t, "string");
148
- return "symbol" == _typeof(i) ? i : String(i);
149
- }
150
- ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
151
-
152
- function _defineProperty(obj, key, value) {
153
- key = toPropertyKey(key);
154
- if (key in obj) {
155
- Object.defineProperty(obj, key, {
156
- value: value,
157
- enumerable: true,
158
- configurable: true,
159
- writable: true
160
- });
161
- } else {
162
- obj[key] = value;
163
- }
164
- return obj;
165
- }
166
93
  ;// CONCATENATED MODULE: ./src/config/classes.ts
167
-
168
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
169
- function _objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
170
- /**
171
- * Copyright (c) 2017 ~ present NAVER Corp.
172
- * billboard.js project is licensed under the MIT license
173
- */
174
- /**
175
- * CSS class names definition
176
- * @private
177
- */
94
+ var __defProp = Object.defineProperty;
95
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
96
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
97
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
98
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
99
+ var __spreadValues = (a, b) => {
100
+ for (var prop in b || (b = {}))
101
+ if (__hasOwnProp.call(b, prop))
102
+ __defNormalProp(a, prop, b[prop]);
103
+ if (__getOwnPropSymbols)
104
+ for (var prop of __getOwnPropSymbols(b)) {
105
+ if (__propIsEnum.call(b, prop))
106
+ __defNormalProp(a, prop, b[prop]);
107
+ }
108
+ return a;
109
+ };
178
110
  const $COMMON = {
179
111
  button: "bb-button",
180
112
  chart: "bb-chart",
@@ -205,7 +137,10 @@ const $AXIS = {
205
137
  axisY: "bb-axis-y",
206
138
  axisY2: "bb-axis-y2",
207
139
  axisY2Label: "bb-axis-y2-label",
208
- axisYLabel: "bb-axis-y-label"
140
+ axisYLabel: "bb-axis-y-label",
141
+ axisXTooltip: "bb-axis-x-tooltip",
142
+ axisYTooltip: "bb-axis-y-tooltip",
143
+ axisY2Tooltip: "bb-axis-y2-tooltip"
209
144
  };
210
145
  const $BAR = {
211
146
  bar: "bb-bar",
@@ -328,534 +263,181 @@ const $ZOOM = {
328
263
  buttonZoomReset: "bb-zoom-reset",
329
264
  zoomBrush: "bb-zoom-brush"
330
265
  };
331
- /* harmony default export */ var classes = (_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $TREEMAP), $ZOOM));
332
- ;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
333
-
334
- /**
335
- * Copyright (c) 2017 ~ present NAVER Corp.
336
- * billboard.js project is licensed under the MIT license
337
- */
338
- /**
339
- * Base class to generate billboard.js plugin
340
- * @class Plugin
341
- */
342
- /**
343
- * Version info string for plugin
344
- * @name version
345
- * @static
346
- * @memberof Plugin
347
- * @type {string}
348
- * @example
349
- * bb.plugin.stanford.version; // ex) 1.9.0
350
- */
351
- let Plugin = /*#__PURE__*/function () {
352
- /**
353
- * Constructor
354
- * @param {Any} options config option object
355
- * @private
356
- */
357
- function Plugin(options) {
358
- if (options === void 0) {
359
- options = {};
360
- }
361
- this.$$ = void 0;
362
- this.options = void 0;
363
- this.options = options;
364
- }
365
-
366
- /**
367
- * Lifecycle hook for 'beforeInit' phase.
368
- * @private
369
- */
370
- var _proto = Plugin.prototype;
371
- _proto.$beforeInit = function $beforeInit() {}
372
-
373
- /**
374
- * Lifecycle hook for 'init' phase.
375
- * @private
376
- */;
377
- _proto.$init = function $init() {}
378
-
379
- /**
380
- * Lifecycle hook for 'afterInit' phase.
381
- * @private
382
- */;
383
- _proto.$afterInit = function $afterInit() {}
384
-
385
- /**
386
- * Lifecycle hook for 'redraw' phase.
387
- * @private
388
- */;
389
- _proto.$redraw = function $redraw() {}
390
-
391
- /**
392
- * Lifecycle hook for 'willDestroy' phase.
393
- * @private
394
- */;
395
- _proto.$willDestroy = function $willDestroy() {
396
- var _this = this;
397
- Object.keys(this).forEach(function (key) {
398
- _newArrowCheck(this, _this);
399
- this[key] = null;
400
- delete this[key];
401
- }.bind(this));
402
- };
403
- return Plugin;
404
- }();
405
- Plugin.version = "3.11.2";
406
-
407
- ;// CONCATENATED MODULE: ./src/Plugin/sparkline/Options.ts
408
- /**
409
- * Copyright (c) 2021 ~ present NAVER Corp.
410
- * billboard.js project is licensed under the MIT license
411
- */
412
- /**
413
- * Sparkline plugin option class
414
- * @class SparklineOptions
415
- * @param {Options} options Sparkline plugin options
416
- * @augments Plugin
417
- * @returns {TableviewOptions}
418
- * @private
419
- */
420
- let Options = function () {
421
- return {
422
- /**
423
- * Specify sparkline charts holder selector.
424
- * - **NOTE:** The amount of holder should match with the amount of data. If has less, will append necessaray amount nodes as sibling of main chart.
425
- * @name selector
426
- * @memberof plugin-sparkline
427
- * @type {string}
428
- * @default undefined
429
- * @example
430
- * selector: ".sparkline"
431
- */
432
- selector: undefined
433
- };
434
- };
266
+ /* harmony default export */ var classes = (__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $TREEMAP), $ZOOM));
435
267
 
436
- // EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
437
- var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
438
268
  // EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
439
269
  var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
270
+ // EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
271
+ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
440
272
  ;// CONCATENATED MODULE: ./src/module/browser.ts
441
-
442
- /**
443
- * Copyright (c) 2017 ~ present NAVER Corp.
444
- * billboard.js project is licensed under the MIT license
445
- */
446
- /**
447
- * Window object
448
- * @private
449
- */
450
- /* eslint-disable no-new-func, no-undef */
451
-
452
-
453
- /**
454
- * Get global object
455
- * @returns {object} window object
456
- * @private
457
- */
458
273
  function getGlobal() {
459
274
  return typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self || Function("return this")();
460
275
  }
461
-
462
- /**
463
- * Get fallback object
464
- * @param {object} w global object
465
- * @returns {Array} fallback object array
466
- * @private
467
- */
468
276
  function getFallback(w) {
469
- var _this = this;
470
- const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function" && typeof (w == null ? void 0 : w.cancelAnimationFrame) === "function",
471
- hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function" && typeof (w == null ? void 0 : w.cancelIdleCallback) === "function",
472
- request = function (cb) {
473
- _newArrowCheck(this, _this);
474
- return setTimeout(cb, 1);
475
- }.bind(this),
476
- cancel = function (id) {
477
- _newArrowCheck(this, _this);
478
- return clearTimeout(id);
479
- }.bind(this);
480
- return [hasRAF ? w.requestAnimationFrame : request, hasRAF ? w.cancelAnimationFrame : cancel, hasRIC ? w.requestIdleCallback : request, hasRIC ? w.cancelIdleCallback : cancel];
277
+ const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function" && typeof (w == null ? void 0 : w.cancelAnimationFrame) === "function";
278
+ const hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function" && typeof (w == null ? void 0 : w.cancelIdleCallback) === "function";
279
+ const request = (cb) => setTimeout(cb, 1);
280
+ const cancel = (id) => clearTimeout(id);
281
+ return [
282
+ hasRAF ? w.requestAnimationFrame : request,
283
+ hasRAF ? w.cancelAnimationFrame : cancel,
284
+ hasRIC ? w.requestIdleCallback : request,
285
+ hasRIC ? w.cancelIdleCallback : cancel
286
+ ];
481
287
  }
482
- const win = getGlobal(),
483
- doc = win == null ? void 0 : win.document,
484
- _getFallback = getFallback(win),
485
- requestAnimationFrame = _getFallback[0],
486
- cancelAnimationFrame = _getFallback[1],
487
- requestIdleCallback = _getFallback[2],
488
- cancelIdleCallback = _getFallback[3];
489
- ;// CONCATENATED MODULE: ./src/module/util.ts
288
+ const win = getGlobal();
289
+ const doc = win == null ? void 0 : win.document;
290
+ const [
291
+ requestAnimationFrame,
292
+ cancelAnimationFrame,
293
+ requestIdleCallback,
294
+ cancelIdleCallback
295
+ ] = getFallback(win);
490
296
 
491
297
 
492
- var _this = undefined;
493
- function util_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
494
- function util_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? util_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : util_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
495
- /**
496
- * Copyright (c) 2017 ~ present NAVER Corp.
497
- * billboard.js project is licensed under the MIT license
498
- * @ignore
499
- */
298
+ ;// CONCATENATED MODULE: ./src/module/util.ts
299
+ var util_defProp = Object.defineProperty;
300
+ var util_getOwnPropSymbols = Object.getOwnPropertySymbols;
301
+ var util_hasOwnProp = Object.prototype.hasOwnProperty;
302
+ var util_propIsEnum = Object.prototype.propertyIsEnumerable;
303
+ var util_defNormalProp = (obj, key, value) => key in obj ? util_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
304
+ var util_spreadValues = (a, b) => {
305
+ for (var prop in b || (b = {}))
306
+ if (util_hasOwnProp.call(b, prop))
307
+ util_defNormalProp(a, prop, b[prop]);
308
+ if (util_getOwnPropSymbols)
309
+ for (var prop of util_getOwnPropSymbols(b)) {
310
+ if (util_propIsEnum.call(b, prop))
311
+ util_defNormalProp(a, prop, b[prop]);
312
+ }
313
+ return a;
314
+ };
500
315
 
501
316
 
502
317
 
503
318
 
504
- const isValue = function (v) {
505
- _newArrowCheck(this, _this);
506
- return v || v === 0;
507
- }.bind(undefined),
508
- isFunction = function (v) {
509
- _newArrowCheck(this, _this);
510
- return typeof v === "function";
511
- }.bind(undefined),
512
- isString = function (v) {
513
- _newArrowCheck(this, _this);
514
- return typeof v === "string";
515
- }.bind(undefined),
516
- isNumber = function (v) {
517
- _newArrowCheck(this, _this);
518
- return typeof v === "number";
519
- }.bind(undefined),
520
- isUndefined = function (v) {
521
- _newArrowCheck(this, _this);
522
- return typeof v === "undefined";
523
- }.bind(undefined),
524
- isDefined = function (v) {
525
- _newArrowCheck(this, _this);
526
- return typeof v !== "undefined";
527
- }.bind(undefined),
528
- isboolean = function (v) {
529
- _newArrowCheck(this, _this);
530
- return typeof v === "boolean";
531
- }.bind(undefined),
532
- ceil10 = function (v) {
533
- _newArrowCheck(this, _this);
534
- return Math.ceil(v / 10) * 10;
535
- }.bind(undefined),
536
- asHalfPixel = function (n) {
537
- _newArrowCheck(this, _this);
538
- return Math.ceil(n) + .5;
539
- }.bind(undefined),
540
- diffDomain = function (d) {
541
- _newArrowCheck(this, _this);
542
- return d[1] - d[0];
543
- }.bind(undefined),
544
- isObjectType = function (v) {
545
- _newArrowCheck(this, _this);
546
- return typeof v === "object";
547
- }.bind(undefined),
548
- isEmpty = function (o) {
549
- _newArrowCheck(this, _this);
550
- return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
551
- }.bind(undefined),
552
- notEmpty = function (o) {
553
- _newArrowCheck(this, _this);
554
- return !isEmpty(o);
555
- }.bind(undefined),
556
- isArray = function (arr) {
557
- _newArrowCheck(this, _this);
558
- return Array.isArray(arr);
559
- }.bind(undefined),
560
- isObject = function (obj) {
561
- _newArrowCheck(this, _this);
562
- return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
563
- }.bind(undefined);
564
- /**
565
- * Check if is array
566
- * @param {Array} arr Data to be checked
567
- * @returns {boolean}
568
- * @private
569
- */
570
- /**
571
- * Check if is object
572
- * @param {object} obj Data to be checked
573
- * @returns {boolean}
574
- * @private
575
- */
576
- /**
577
- * Get specified key value from object
578
- * If default value is given, will return if given key value not found
579
- * @param {object} options Source object
580
- * @param {string} key Key value
581
- * @param {*} defaultValue Default value
582
- * @returns {*}
583
- * @private
584
- */
319
+ const isValue = (v) => v || v === 0;
320
+ const isFunction = (v) => typeof v === "function";
321
+ const isString = (v) => typeof v === "string";
322
+ const isNumber = (v) => typeof v === "number";
323
+ const isUndefined = (v) => typeof v === "undefined";
324
+ const isDefined = (v) => typeof v !== "undefined";
325
+ const isboolean = (v) => typeof v === "boolean";
326
+ const ceil10 = (v) => Math.ceil(v / 10) * 10;
327
+ const asHalfPixel = (n) => Math.ceil(n) + 0.5;
328
+ const diffDomain = (d) => d[1] - d[0];
329
+ const isObjectType = (v) => typeof v === "object";
330
+ const isEmpty = (o) => isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
331
+ const notEmpty = (o) => !isEmpty(o);
332
+ const isArray = (arr) => Array.isArray(arr);
333
+ const isObject = (obj) => obj && !(obj == null ? void 0 : obj.nodeType) && isObjectType(obj) && !isArray(obj);
585
334
  function getOption(options, key, defaultValue) {
586
335
  return isDefined(options[key]) ? options[key] : defaultValue;
587
336
  }
588
-
589
- /**
590
- * Check if value exist in the given object
591
- * @param {object} dict Target object to be checked
592
- * @param {*} value Value to be checked
593
- * @returns {boolean}
594
- * @private
595
- */
596
337
  function hasValue(dict, value) {
597
- var _this2 = this;
598
- let found = !1;
599
- Object.keys(dict).forEach(function (key) {
600
- _newArrowCheck(this, _this2);
601
- return dict[key] === value && (found = !0);
602
- }.bind(this));
338
+ let found = false;
339
+ Object.keys(dict).forEach((key) => dict[key] === value && (found = true));
603
340
  return found;
604
341
  }
605
-
606
- /**
607
- * Call function with arguments
608
- * @param {Function} fn Function to be called
609
- * @param {*} thisArg "this" value for fn
610
- * @param {*} args Arguments for fn
611
- * @returns {boolean} true: fn is function, false: fn is not function
612
- * @private
613
- */
614
- function callFn(fn, thisArg) {
342
+ function callFn(fn, thisArg, ...args) {
615
343
  const isFn = isFunction(fn);
616
- for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
617
- args[_key - 2] = arguments[_key];
618
- }
619
- isFn && fn.call.apply(fn, [thisArg].concat(args));
344
+ isFn && fn.call(thisArg, ...args);
620
345
  return isFn;
621
346
  }
622
-
623
- /**
624
- * Call function after all transitions ends
625
- * @param {d3.transition} transition Transition
626
- * @param {Fucntion} cb Callback function
627
- * @private
628
- */
629
347
  function endall(transition, cb) {
630
- var _this3 = this;
631
348
  let n = 0;
632
- const end = function () {
633
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
634
- args[_key2] = arguments[_key2];
635
- }
636
- --n || cb.apply.apply(cb, [this].concat(args));
349
+ const end = function(...args) {
350
+ !--n && cb.apply(this, ...args);
637
351
  };
638
-
639
- // if is transition selection
640
352
  if ("duration" in transition) {
641
- transition.each(function () {
642
- _newArrowCheck(this, _this3);
643
- return ++n;
644
- }.bind(this)).on("end", end);
353
+ transition.each(() => ++n).on("end", end);
645
354
  } else {
646
355
  ++n;
647
356
  transition.call(end);
648
357
  }
649
358
  }
650
-
651
- /**
652
- * Replace tag sign to html entity
653
- * @param {string} str Target string value
654
- * @returns {string}
655
- * @private
656
- */
657
359
  function sanitize(str) {
658
360
  return isString(str) ? str.replace(/<(script|img)?/ig, "&lt;").replace(/(script)?>/ig, "&gt;") : str;
659
361
  }
660
-
661
- /**
662
- * Set text value. If there's multiline add nodes.
663
- * @param {d3Selection} node Text node
664
- * @param {string} text Text value string
665
- * @param {Array} dy dy value for multilined text
666
- * @param {boolean} toMiddle To be alingned vertically middle
667
- * @private
668
- */
669
- function setTextValue(node, text, dy, toMiddle) {
670
- var _this4 = this;
671
- if (dy === void 0) {
672
- dy = [-1, 1];
673
- }
674
- if (toMiddle === void 0) {
675
- toMiddle = !1;
676
- }
362
+ function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
677
363
  if (!node || !isString(text)) {
678
364
  return;
679
365
  }
680
366
  if (text.indexOf("\n") === -1) {
681
367
  node.text(text);
682
368
  } else {
683
- const diff = [node.text(), text].map(function (v) {
684
- _newArrowCheck(this, _this4);
685
- return v.replace(/[\s\n]/g, "");
686
- }.bind(this));
369
+ const diff = [node.text(), text].map((v) => v.replace(/[\s\n]/g, ""));
687
370
  if (diff[0] !== diff[1]) {
688
- const multiline = text.split("\n"),
689
- len = toMiddle ? multiline.length - 1 : 1;
690
- // reset possible text
371
+ const multiline = text.split("\n");
372
+ const len = toMiddle ? multiline.length - 1 : 1;
691
373
  node.html("");
692
- multiline.forEach(function (v, i) {
693
- _newArrowCheck(this, _this4);
694
- node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
695
- }.bind(this));
374
+ multiline.forEach((v, i) => {
375
+ node.append("tspan").attr("x", 0).attr("dy", `${i === 0 ? dy[0] * len : dy[1]}em`).text(v);
376
+ });
696
377
  }
697
378
  }
698
379
  }
699
-
700
- /**
701
- * Substitution of SVGPathSeg API polyfill
702
- * @param {SVGGraphicsElement} path Target svg element
703
- * @returns {Array}
704
- * @private
705
- */
706
380
  function getRectSegList(path) {
707
- /*
708
- * seg1 ---------- seg2
709
- * | |
710
- * | |
711
- * | |
712
- * seg0 ---------- seg3
713
- * */
714
- const _path$getBBox = path.getBBox(),
715
- x = _path$getBBox.x,
716
- y = _path$getBBox.y,
717
- width = _path$getBBox.width,
718
- height = _path$getBBox.height;
719
- return [{
720
- x: x,
721
- y: y + height
722
- },
723
- // seg0
724
- {
725
- x: x,
726
- y: y
727
- },
728
- // seg1
729
- {
730
- x: x + width,
731
- y: y
732
- },
733
- // seg2
734
- {
735
- x: x + width,
736
- y: y + height
737
- } // seg3
381
+ const { x, y, width, height } = path.getBBox();
382
+ return [
383
+ { x, y: y + height },
384
+ // seg0
385
+ { x, y },
386
+ // seg1
387
+ { x: x + width, y },
388
+ // seg2
389
+ { x: x + width, y: y + height }
390
+ // seg3
738
391
  ];
739
392
  }
740
-
741
- /**
742
- * Get svg bounding path box dimension
743
- * @param {SVGGraphicsElement} path Target svg element
744
- * @returns {object}
745
- * @private
746
- */
747
393
  function getPathBox(path) {
748
- const _path$getBoundingClie = path.getBoundingClientRect(),
749
- width = _path$getBoundingClie.width,
750
- height = _path$getBoundingClie.height,
751
- items = getRectSegList(path),
752
- x = items[0].x,
753
- y = Math.min(items[0].y, items[1].y);
394
+ const { width, height } = path.getBoundingClientRect();
395
+ const items = getRectSegList(path);
396
+ const x = items[0].x;
397
+ const y = Math.min(items[0].y, items[1].y);
754
398
  return {
755
- x: x,
756
- y: y,
757
- width: width,
758
- height: height
399
+ x,
400
+ y,
401
+ width,
402
+ height
759
403
  };
760
404
  }
761
-
762
- /**
763
- * Get event's current position coordinates
764
- * @param {object} event Event object
765
- * @param {SVGElement|HTMLElement} element Target element
766
- * @returns {Array} [x, y] Coordinates x, y array
767
- * @private
768
- */
769
405
  function getPointer(event, element) {
770
- var _ref,
771
- _this5 = this;
772
- const touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]);
406
+ var _a;
407
+ const touches = event && ((_a = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _a[0]);
773
408
  let pointer = [0, 0];
774
409
  try {
775
410
  pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
776
- } catch (e) {}
777
- return pointer.map(function (v) {
778
- _newArrowCheck(this, _this5);
779
- return isNaN(v) ? 0 : v;
780
- }.bind(this));
411
+ } catch (e) {
412
+ }
413
+ return pointer.map((v) => isNaN(v) ? 0 : v);
781
414
  }
782
-
783
- /**
784
- * Return brush selection array
785
- * @param {object} ctx Current instance
786
- * @returns {d3.brushSelection}
787
- * @private
788
- */
789
415
  function getBrushSelection(ctx) {
790
- const event = ctx.event,
791
- $el = ctx.$el,
792
- main = $el.subchart.main || $el.main;
416
+ const { event, $el } = ctx;
417
+ const main = $el.subchart.main || $el.main;
793
418
  let selection;
794
-
795
- // check from event
796
419
  if (event && event.type === "brush") {
797
420
  selection = event.selection;
798
- // check from brush area selection
799
421
  } else if (main && (selection = main.select(".bb-brush").node())) {
800
422
  selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
801
423
  }
802
424
  return selection;
803
425
  }
804
-
805
- /**
806
- * Get boundingClientRect.
807
- * Cache the evaluated value once it was called.
808
- * @param {HTMLElement} node Target element
809
- * @returns {object}
810
- * @private
811
- */
812
426
  function getBoundingRect(node) {
813
427
  const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
814
428
  return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
815
429
  }
816
-
817
- /**
818
- * Retrun random number
819
- * @param {boolean} asStr Convert returned value as string
820
- * @param {number} min Minimum value
821
- * @param {number} max Maximum value
822
- * @returns {number|string}
823
- * @private
824
- */
825
- function getRandom(asStr, min, max) {
826
- if (asStr === void 0) {
827
- asStr = !0;
828
- }
829
- if (min === void 0) {
830
- min = 0;
831
- }
832
- if (max === void 0) {
833
- max = 1e4;
834
- }
835
- const crpt = win.crypto || win.msCrypto,
836
- rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
837
- return asStr ? rand + "" : rand;
430
+ function getRandom(asStr = true, min = 0, max = 1e4) {
431
+ const crpt = win.crypto || win.msCrypto;
432
+ const rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
433
+ return asStr ? String(rand) : rand;
838
434
  }
839
-
840
- /**
841
- * Find index based on binary search
842
- * @param {Array} arr Data array
843
- * @param {number} v Target number to find
844
- * @param {number} start Start index of data array
845
- * @param {number} end End index of data arr
846
- * @param {boolean} isRotated Weather is roted axis
847
- * @returns {number} Index number
848
- * @private
849
- */
850
435
  function findIndex(arr, v, start, end, isRotated) {
851
436
  if (start > end) {
852
437
  return -1;
853
438
  }
854
439
  const mid = Math.floor((start + end) / 2);
855
- let _arr$mid = arr[mid],
856
- x = _arr$mid.x,
857
- _arr$mid$w = _arr$mid.w,
858
- w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
440
+ let { x, w = 0 } = arr[mid];
859
441
  if (isRotated) {
860
442
  x = arr[mid].y;
861
443
  w = arr[mid].h;
@@ -865,75 +447,30 @@ function findIndex(arr, v, start, end, isRotated) {
865
447
  }
866
448
  return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
867
449
  }
868
-
869
- /**
870
- * Check if brush is empty
871
- * @param {object} ctx Bursh context
872
- * @returns {boolean}
873
- * @private
874
- */
875
450
  function brushEmpty(ctx) {
876
451
  const selection = getBrushSelection(ctx);
877
452
  if (selection) {
878
- // brush selected area
879
- // two-dimensional: [[x0, y0], [x1, y1]]
880
- // one-dimensional: [x0, x1] or [y0, y1]
881
453
  return selection[0] === selection[1];
882
454
  }
883
- return !0;
455
+ return true;
884
456
  }
885
-
886
- /**
887
- * Deep copy object
888
- * @param {object} objectN Source object
889
- * @returns {object} Cloned object
890
- * @private
891
- */
892
- function deepClone() {
893
- var _this6 = this;
894
- const _clone = function clone(v) {
895
- _newArrowCheck(this, _this6);
457
+ function deepClone(...objectN) {
458
+ const clone = (v) => {
896
459
  if (isObject(v) && v.constructor) {
897
460
  const r = new v.constructor();
898
461
  for (const k in v) {
899
- r[k] = _clone(v[k]);
462
+ r[k] = clone(v[k]);
900
463
  }
901
464
  return r;
902
465
  }
903
466
  return v;
904
- }.bind(this);
905
- for (var _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
906
- objectN[_key3] = arguments[_key3];
907
- }
908
- return objectN.map(function (v) {
909
- _newArrowCheck(this, _this6);
910
- return _clone(v);
911
- }.bind(this)).reduce(function (a, c) {
912
- _newArrowCheck(this, _this6);
913
- return util_objectSpread(util_objectSpread({}, a), c);
914
- }.bind(this));
467
+ };
468
+ return objectN.map((v) => clone(v)).reduce((a, c) => util_spreadValues(util_spreadValues({}, a), c));
915
469
  }
916
-
917
- /**
918
- * Extend target from source object
919
- * @param {object} target Target object
920
- * @param {object|Array} source Source object
921
- * @returns {object}
922
- * @private
923
- */
924
- function extend(target, source) {
925
- var _this7 = this;
926
- if (target === void 0) {
927
- target = {};
928
- }
470
+ function extend(target = {}, source) {
929
471
  if (isArray(source)) {
930
- source.forEach(function (v) {
931
- _newArrowCheck(this, _this7);
932
- return extend(target, v);
933
- }.bind(this));
472
+ source.forEach((v) => extend(target, v));
934
473
  }
935
-
936
- // exclude name with only numbers
937
474
  for (const p in source) {
938
475
  if (/^\d+$/.test(p) || p in target) {
939
476
  continue;
@@ -942,575 +479,355 @@ function extend(target, source) {
942
479
  }
943
480
  return target;
944
481
  }
945
-
946
- /**
947
- * Return first letter capitalized
948
- * @param {string} str Target string
949
- * @returns {string} capitalized string
950
- * @private
951
- */
952
- const capitalize = function (str) {
953
- _newArrowCheck(this, _this);
954
- return str.charAt(0).toUpperCase() + str.slice(1);
955
- }.bind(undefined);
956
-
957
- /**
958
- * Camelize from kebob style string
959
- * @param {string} str Target string
960
- * @param {string} separator Separator string
961
- * @returns {string} camelized string
962
- * @private
963
- */
964
- function camelize(str, separator) {
965
- var _this8 = this;
966
- if (separator === void 0) {
967
- separator = "-";
968
- }
969
- return str.split(separator).map(function (v, i) {
970
- _newArrowCheck(this, _this8);
971
- return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
972
- }.bind(this)).join("");
482
+ const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
483
+ function camelize(str, separator = "-") {
484
+ return str.split(separator).map((v, i) => i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase()).join("");
973
485
  }
974
-
975
- /**
976
- * Convert to array
977
- * @param {object} v Target to be converted
978
- * @returns {Array}
979
- * @private
980
- */
981
- const toArray = function (v) {
982
- _newArrowCheck(this, _this);
983
- return [].slice.call(v);
984
- }.bind(undefined);
985
-
986
- /**
987
- * Add CSS rules
988
- * @param {object} style Style object
989
- * @param {string} selector Selector string
990
- * @param {Array} prop Prps arrary
991
- * @returns {number} Newely added rule index
992
- * @private
993
- */
486
+ const toArray = (v) => [].slice.call(v);
994
487
  function addCssRules(style, selector, prop) {
995
- var _this9 = this;
996
- const _style$rootSelector = style.rootSelector,
997
- rootSelector = _style$rootSelector === void 0 ? "" : _style$rootSelector,
998
- sheet = style.sheet,
999
- getSelector = function (s) {
1000
- _newArrowCheck(this, _this9);
1001
- return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
1002
- }.bind(this),
1003
- rule = rootSelector + " " + getSelector(selector) + " {" + prop.join(";") + "}";
1004
- return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
488
+ const { rootSelector = "", sheet } = style;
489
+ const getSelector = (s) => s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
490
+ const rule = `${rootSelector} ${getSelector(selector)} {${prop.join(";")}}`;
491
+ return sheet[sheet.insertRule ? "insertRule" : "addRule"](
492
+ rule,
493
+ sheet.cssRules.length
494
+ );
1005
495
  }
1006
-
1007
- /**
1008
- * Get css rules for specified stylesheets
1009
- * @param {Array} styleSheets The stylesheets to get the rules from
1010
- * @returns {Array}
1011
- * @private
1012
- */
1013
496
  function getCssRules(styleSheets) {
1014
- var _this10 = this;
1015
497
  let rules = [];
1016
- styleSheets.forEach(function (sheet) {
1017
- _newArrowCheck(this, _this10);
498
+ styleSheets.forEach((sheet) => {
499
+ var _a;
1018
500
  try {
1019
501
  if (sheet.cssRules && sheet.cssRules.length) {
1020
502
  rules = rules.concat(toArray(sheet.cssRules));
1021
503
  }
1022
504
  } catch (e) {
1023
- var _window$console;
1024
- (_window$console = win.console) == null || _window$console.warn("Error while reading rules from " + sheet.href + ": " + e.toString());
505
+ (_a = win.console) == null ? void 0 : _a.warn(`Error while reading rules from ${sheet.href}: ${e.toString()}`);
1025
506
  }
1026
- }.bind(this));
507
+ });
1027
508
  return rules;
1028
509
  }
1029
-
1030
- /**
1031
- * Get current window and container scroll position
1032
- * @param {HTMLElement} node Target element
1033
- * @returns {object} window scroll position
1034
- * @private
1035
- */
1036
510
  function getScrollPosition(node) {
1037
- var _ref2, _ref3, _window$pageXOffset, _ref4, _ref5, _window$pageYOffset;
511
+ var _a, _b, _c, _d;
1038
512
  return {
1039
- x: (_ref2 = ((_ref3 = (_window$pageXOffset = win.pageXOffset) != null ? _window$pageXOffset : win.scrollX) != null ? _ref3 : 0) + node.scrollLeft) != null ? _ref2 : 0,
1040
- y: (_ref4 = ((_ref5 = (_window$pageYOffset = win.pageYOffset) != null ? _window$pageYOffset : win.scrollY) != null ? _ref5 : 0) + node.scrollTop) != null ? _ref4 : 0
513
+ x: ((_b = (_a = win.pageXOffset) != null ? _a : win.scrollX) != null ? _b : 0) + node.scrollLeft,
514
+ y: ((_d = (_c = win.pageYOffset) != null ? _c : win.scrollY) != null ? _d : 0) + node.scrollTop
1041
515
  };
1042
516
  }
1043
-
1044
- /**
1045
- * Gets the SVGMatrix of an SVGGElement
1046
- * @param {SVGElement} node Node element
1047
- * @returns {SVGMatrix} matrix
1048
- * @private
1049
- */
1050
517
  function getTranslation(node) {
1051
- const transform = node ? node.transform : null,
1052
- baseVal = transform && transform.baseVal;
1053
- return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
1054
- a: 0,
1055
- b: 0,
1056
- c: 0,
1057
- d: 0,
1058
- e: 0,
1059
- f: 0
1060
- };
518
+ const transform = node ? node.transform : null;
519
+ const baseVal = transform && transform.baseVal;
520
+ return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : { a: 0, b: 0, c: 0, d: 0, e: 0, f: 0 };
1061
521
  }
1062
-
1063
- /**
1064
- * Get unique value from array
1065
- * @param {Array} data Source data
1066
- * @returns {Array} Unique array value
1067
- * @private
1068
- */
1069
522
  function getUnique(data) {
1070
- var _this11 = this;
1071
- const isDate = data[0] instanceof Date,
1072
- d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
1073
- _newArrowCheck(this, _this11);
1074
- return self.indexOf(v) === i;
1075
- }.bind(this));
1076
- return isDate ? d.map(function (v) {
1077
- _newArrowCheck(this, _this11);
1078
- return new Date(v);
1079
- }.bind(this)) : d;
523
+ const isDate = data[0] instanceof Date;
524
+ const d = (isDate ? data.map(Number) : data).filter((v, i, self) => self.indexOf(v) === i);
525
+ return isDate ? d.map((v) => new Date(v)) : d;
1080
526
  }
1081
-
1082
- /**
1083
- * Merge array
1084
- * @param {Array} arr Source array
1085
- * @returns {Array}
1086
- * @private
1087
- */
1088
527
  function mergeArray(arr) {
1089
- var _this12 = this;
1090
- return arr && arr.length ? arr.reduce(function (p, c) {
1091
- _newArrowCheck(this, _this12);
1092
- return p.concat(c);
1093
- }.bind(this)) : [];
528
+ return arr && arr.length ? arr.reduce((p, c) => p.concat(c)) : [];
1094
529
  }
1095
-
1096
- /**
1097
- * Merge object returning new object
1098
- * @param {object} target Target object
1099
- * @param {object} objectN Source object
1100
- * @returns {object} merged target object
1101
- * @private
1102
- */
1103
- function mergeObj(target) {
1104
- for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
1105
- objectN[_key4 - 1] = arguments[_key4];
1106
- }
530
+ function mergeObj(target, ...objectN) {
1107
531
  if (!objectN.length || objectN.length === 1 && !objectN[0]) {
1108
532
  return target;
1109
533
  }
1110
534
  const source = objectN.shift();
1111
535
  if (isObject(target) && isObject(source)) {
1112
- Object.keys(source).forEach(function (key) {
1113
- _newArrowCheck(this, _this13);
536
+ Object.keys(source).forEach((key) => {
1114
537
  const value = source[key];
1115
538
  if (isObject(value)) {
1116
- target[key] || (target[key] = {});
539
+ !target[key] && (target[key] = {});
1117
540
  target[key] = mergeObj(target[key], value);
1118
541
  } else {
1119
542
  target[key] = isArray(value) ? value.concat() : value;
1120
543
  }
1121
- }.bind(this));
544
+ });
1122
545
  }
1123
- return mergeObj.apply(void 0, [target].concat(objectN));
546
+ return mergeObj(target, ...objectN);
1124
547
  }
1125
-
1126
- /**
1127
- * Sort value
1128
- * @param {Array} data value to be sorted
1129
- * @param {boolean} isAsc true: asc, false: desc
1130
- * @returns {number|string|Date} sorted date
1131
- * @private
1132
- */
1133
- function sortValue(data, isAsc) {
1134
- var _this14 = this;
1135
- if (isAsc === void 0) {
1136
- isAsc = !0;
1137
- }
548
+ function sortValue(data, isAsc = true) {
1138
549
  let fn;
1139
550
  if (data[0] instanceof Date) {
1140
- fn = isAsc ? function (a, b) {
1141
- _newArrowCheck(this, _this14);
1142
- return a - b;
1143
- }.bind(this) : function (a, b) {
1144
- _newArrowCheck(this, _this14);
1145
- return b - a;
1146
- }.bind(this);
551
+ fn = isAsc ? (a, b) => a - b : (a, b) => b - a;
1147
552
  } else {
1148
553
  if (isAsc && !data.every(isNaN)) {
1149
- fn = function (a, b) {
1150
- _newArrowCheck(this, _this14);
1151
- return a - b;
1152
- }.bind(this);
554
+ fn = (a, b) => a - b;
1153
555
  } else if (!isAsc) {
1154
- fn = function (a, b) {
1155
- _newArrowCheck(this, _this14);
1156
- return a > b && -1 || a < b && 1 || a === b && 0;
1157
- }.bind(this);
556
+ fn = (a, b) => a > b && -1 || a < b && 1 || a === b && 0;
1158
557
  }
1159
558
  }
1160
559
  return data.concat().sort(fn);
1161
560
  }
1162
-
1163
- /**
1164
- * Get min/max value
1165
- * @param {string} type 'min' or 'max'
1166
- * @param {Array} data Array data value
1167
- * @returns {number|Date|undefined}
1168
- * @private
1169
- */
1170
561
  function getMinMax(type, data) {
1171
- var _this15 = this;
1172
- let res = data.filter(function (v) {
1173
- _newArrowCheck(this, _this15);
1174
- return notEmpty(v);
1175
- }.bind(this));
562
+ let res = data.filter((v) => notEmpty(v));
1176
563
  if (res.length) {
1177
564
  if (isNumber(res[0])) {
1178
- res = Math[type].apply(Math, res);
565
+ res = Math[type](...res);
1179
566
  } else if (res[0] instanceof Date) {
1180
567
  res = sortValue(res, type === "min")[0];
1181
568
  }
1182
569
  } else {
1183
- res = undefined;
570
+ res = void 0;
1184
571
  }
1185
572
  return res;
1186
573
  }
1187
-
1188
- /**
1189
- * Get range
1190
- * @param {number} start Start number
1191
- * @param {number} end End number
1192
- * @param {number} step Step number
1193
- * @returns {Array}
1194
- * @private
1195
- */
1196
- const getRange = function (start, end, step) {
1197
- if (step === void 0) {
1198
- step = 1;
1199
- }
1200
- _newArrowCheck(this, _this);
1201
- const res = [],
1202
- n = Math.max(0, Math.ceil((end - start) / step)) | 0;
1203
- for (let i = start; i < n; i++) {
1204
- res.push(start + i * step);
1205
- }
1206
- return res;
1207
- }.bind(undefined),
1208
- emulateEvent = {
1209
- mouse: function () {
1210
- var _this16 = this;
1211
- _newArrowCheck(this, _this);
1212
- const getParams = function () {
1213
- _newArrowCheck(this, _this16);
1214
- return {
1215
- bubbles: !1,
1216
- cancelable: !1,
1217
- screenX: 0,
1218
- screenY: 0,
1219
- clientX: 0,
1220
- clientY: 0
1221
- };
1222
- }.bind(this);
1223
- try {
1224
- // eslint-disable-next-line no-new
1225
- new MouseEvent("t");
1226
- return function (el, eventType, params) {
1227
- if (params === void 0) {
1228
- params = getParams();
1229
- }
1230
- _newArrowCheck(this, _this16);
1231
- el.dispatchEvent(new MouseEvent(eventType, params));
1232
- }.bind(this);
1233
- } catch (e) {
1234
- // Polyfills DOM4 MouseEvent
1235
- return function (el, eventType, params) {
1236
- if (params === void 0) {
1237
- params = getParams();
1238
- }
1239
- _newArrowCheck(this, _this16);
1240
- const mouseEvent = doc.createEvent("MouseEvent");
1241
-
1242
- // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
1243
- mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
574
+ const getRange = (start, end, step = 1) => {
575
+ const res = [];
576
+ const n = Math.max(0, Math.ceil((end - start) / step)) | 0;
577
+ for (let i = start; i < n; i++) {
578
+ res.push(start + i * step);
579
+ }
580
+ return res;
581
+ };
582
+ const emulateEvent = {
583
+ mouse: (() => {
584
+ const getParams = () => ({
585
+ bubbles: false,
586
+ cancelable: false,
587
+ screenX: 0,
588
+ screenY: 0,
589
+ clientX: 0,
590
+ clientY: 0
591
+ });
592
+ try {
593
+ new MouseEvent("t");
594
+ return (el, eventType, params = getParams()) => {
595
+ el.dispatchEvent(new MouseEvent(eventType, params));
596
+ };
597
+ } catch (e) {
598
+ return (el, eventType, params = getParams()) => {
599
+ const mouseEvent = doc.createEvent("MouseEvent");
600
+ mouseEvent.initMouseEvent(
601
+ eventType,
602
+ params.bubbles,
603
+ params.cancelable,
604
+ win,
605
+ 0,
1244
606
  // the event's mouse click count
1245
- params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
1246
- el.dispatchEvent(mouseEvent);
1247
- }.bind(this);
1248
- }
1249
- }.bind(undefined)(),
1250
- touch: function touch(el, eventType, params) {
1251
- _newArrowCheck(this, _this);
1252
- const touchObj = new Touch(mergeObj({
1253
- identifier: Date.now(),
1254
- target: el,
1255
- radiusX: 2.5,
1256
- radiusY: 2.5,
1257
- rotationAngle: 10,
1258
- force: .5
1259
- }, params));
1260
- el.dispatchEvent(new TouchEvent(eventType, {
1261
- cancelable: !0,
1262
- bubbles: !0,
1263
- shiftKey: !0,
1264
- touches: [touchObj],
1265
- targetTouches: [],
1266
- changedTouches: [touchObj]
1267
- }));
1268
- }.bind(undefined)
1269
- }; // emulate event
1270
- /**
1271
- * Process the template & return bound string
1272
- * @param {string} tpl Template string
1273
- * @param {object} data Data value to be replaced
1274
- * @returns {string}
1275
- * @private
1276
- */
607
+ params.screenX,
608
+ params.screenY,
609
+ params.clientX,
610
+ params.clientY,
611
+ false,
612
+ false,
613
+ false,
614
+ false,
615
+ 0,
616
+ null
617
+ );
618
+ el.dispatchEvent(mouseEvent);
619
+ };
620
+ }
621
+ })(),
622
+ touch: (el, eventType, params) => {
623
+ const touchObj = new Touch(mergeObj({
624
+ identifier: Date.now(),
625
+ target: el,
626
+ radiusX: 2.5,
627
+ radiusY: 2.5,
628
+ rotationAngle: 10,
629
+ force: 0.5
630
+ }, params));
631
+ el.dispatchEvent(new TouchEvent(eventType, {
632
+ cancelable: true,
633
+ bubbles: true,
634
+ shiftKey: true,
635
+ touches: [touchObj],
636
+ targetTouches: [],
637
+ changedTouches: [touchObj]
638
+ }));
639
+ }
640
+ };
1277
641
  function tplProcess(tpl, data) {
1278
642
  let res = tpl;
1279
643
  for (const x in data) {
1280
- res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
644
+ res = res.replace(new RegExp(`{=${x}}`, "g"), data[x]);
1281
645
  }
1282
646
  return res;
1283
647
  }
1284
-
1285
- /**
1286
- * Get parsed date value
1287
- * (It must be called in 'ChartInternal' context)
1288
- * @param {Date|string|number} date Value of date to be parsed
1289
- * @returns {Date}
1290
- * @private
1291
- */
1292
648
  function parseDate(date) {
649
+ var _a;
1293
650
  let parsedDate;
1294
651
  if (date instanceof Date) {
1295
652
  parsedDate = date;
1296
653
  } else if (isString(date)) {
1297
- var _format$dataTime;
1298
- const config = this.config,
1299
- format = this.format;
1300
-
1301
- // if fails to parse, try by new Date()
1302
- // https://github.com/naver/billboard.js/issues/1714
1303
- parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
654
+ const { config, format } = this;
655
+ parsedDate = (_a = format.dataTime(config.data_xFormat)(date)) != null ? _a : new Date(date);
1304
656
  } else if (isNumber(date) && !isNaN(date)) {
1305
- parsedDate = new Date(+date);
657
+ parsedDate = /* @__PURE__ */ new Date(+date);
1306
658
  }
1307
659
  if (!parsedDate || isNaN(+parsedDate)) {
1308
- console && console.error && console.error("Failed to parse x '" + date + "' to Date object");
660
+ console && console.error && console.error(`Failed to parse x '${date}' to Date object`);
1309
661
  }
1310
662
  return parsedDate;
1311
663
  }
1312
-
1313
- /**
1314
- * Return if the current doc is visible or not
1315
- * @returns {boolean}
1316
- * @private
1317
- */
1318
664
  function isTabVisible() {
1319
- return (doc == null ? void 0 : doc.hidden) === !1 || (doc == null ? void 0 : doc.visibilityState) === "visible";
665
+ var _a, _b;
666
+ return ((_a = doc) == null ? void 0 : _a.hidden) === false || ((_b = doc) == null ? void 0 : _b.visibilityState) === "visible";
1320
667
  }
1321
-
1322
- /**
1323
- * Get the current input type
1324
- * @param {boolean} mouse Config value: interaction.inputType.mouse
1325
- * @param {boolean} touch Config value: interaction.inputType.touch
1326
- * @returns {string} "mouse" | "touch" | null
1327
- * @private
1328
- */
1329
668
  function convertInputType(mouse, touch) {
1330
- var _this17 = this;
1331
- const DocumentTouch = win.DocumentTouch,
1332
- matchMedia = win.matchMedia,
1333
- navigator = win.navigator;
1334
- let hasTouch = !1;
669
+ const { DocumentTouch, matchMedia, navigator } = win;
670
+ let hasTouch = false;
1335
671
  if (touch) {
1336
- // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
1337
672
  if (navigator && "maxTouchPoints" in navigator) {
1338
673
  hasTouch = navigator.maxTouchPoints > 0;
1339
-
1340
- // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1341
- // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
1342
674
  } else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) {
1343
- hasTouch = !0;
675
+ hasTouch = true;
1344
676
  } else {
1345
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
1346
- if (matchMedia != null && matchMedia("(pointer:coarse)").matches) {
1347
- hasTouch = !0;
677
+ if (matchMedia == null ? void 0 : matchMedia("(pointer:coarse)").matches) {
678
+ hasTouch = true;
1348
679
  } else {
1349
- // Only as a last resort, fall back to user agent sniffing
1350
680
  const UA = navigator.userAgent;
1351
681
  hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
1352
682
  }
1353
683
  }
1354
684
  }
1355
-
1356
- // Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected
1357
- // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
1358
- // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
1359
- const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
1360
- _newArrowCheck(this, _this17);
1361
- return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
1362
- }.bind(this));
1363
-
1364
- // fallback to 'mouse' if no input type is detected.
685
+ const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some((v) => matchMedia == null ? void 0 : matchMedia(`(${v})`).matches);
1365
686
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
1366
687
  }
1367
-
1368
- /**
1369
- * Run function until given condition function return true
1370
- * @param {Function} fn Function to be executed when condition is true
1371
- * @param {Function} conditionFn Condition function to check if condition is true
1372
- * @private
1373
- */
1374
688
  function runUntil(fn, conditionFn) {
1375
- var _this18 = this;
1376
- if (conditionFn() === !1) {
1377
- requestAnimationFrame(function () {
1378
- _newArrowCheck(this, _this18);
1379
- return runUntil(fn, conditionFn);
1380
- }.bind(this));
689
+ if (conditionFn() === false) {
690
+ requestAnimationFrame(() => runUntil(fn, conditionFn));
1381
691
  } else {
1382
692
  fn();
1383
693
  }
1384
694
  }
1385
- ;// CONCATENATED MODULE: ./src/config/config.ts
1386
695
 
1387
- /**
1388
- * Copyright (c) 2017 ~ present NAVER Corp.
1389
- * billboard.js project is licensed under the MIT license
1390
- */
696
+ ;// CONCATENATED MODULE: ./src/config/config.ts
1391
697
 
1392
- /**
1393
- * Load configuration option
1394
- * @param {object} config User's generation config value
1395
- * @private
1396
- */
1397
698
  function loadConfig(config) {
1398
- var _this = this;
1399
699
  const thisConfig = this.config;
1400
- let target, keys, read;
1401
- const _find = function find() {
1402
- _newArrowCheck(this, _this);
700
+ let target;
701
+ let keys;
702
+ let read;
703
+ const find = () => {
1403
704
  const key = keys.shift();
1404
705
  if (key && target && isObjectType(target) && key in target) {
1405
706
  target = target[key];
1406
- return _find();
707
+ return find();
1407
708
  } else if (!key) {
1408
709
  return target;
1409
710
  }
1410
- return undefined;
1411
- }.bind(this);
1412
- Object.keys(thisConfig).forEach(function (key) {
1413
- _newArrowCheck(this, _this);
711
+ return void 0;
712
+ };
713
+ Object.keys(thisConfig).forEach((key) => {
1414
714
  target = config;
1415
715
  keys = key.split("_");
1416
- read = _find();
716
+ read = find();
1417
717
  if (isDefined(read)) {
1418
718
  thisConfig[key] = read;
1419
719
  }
1420
- }.bind(this));
1421
-
1422
- // only should run in the ChartInternal context
720
+ });
1423
721
  if (this.api) {
1424
722
  this.state.orgConfig = config;
1425
723
  }
1426
724
  }
1427
- ;// CONCATENATED MODULE: ./src/Plugin/sparkline/index.ts
1428
-
1429
725
 
726
+ ;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
727
+ var Plugin_defProp = Object.defineProperty;
728
+ var Plugin_defNormalProp = (obj, key, value) => key in obj ? Plugin_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
729
+ var __publicField = (obj, key, value) => {
730
+ Plugin_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
731
+ return value;
732
+ };
733
+ class Plugin {
734
+ /**
735
+ * Constructor
736
+ * @param {Any} options config option object
737
+ * @private
738
+ */
739
+ constructor(options = {}) {
740
+ __publicField(this, "$$");
741
+ __publicField(this, "options");
742
+ this.options = options;
743
+ }
744
+ /**
745
+ * Lifecycle hook for 'beforeInit' phase.
746
+ * @private
747
+ */
748
+ $beforeInit() {
749
+ }
750
+ /**
751
+ * Lifecycle hook for 'init' phase.
752
+ * @private
753
+ */
754
+ $init() {
755
+ }
756
+ /**
757
+ * Lifecycle hook for 'afterInit' phase.
758
+ * @private
759
+ */
760
+ $afterInit() {
761
+ }
762
+ /**
763
+ * Lifecycle hook for 'redraw' phase.
764
+ * @private
765
+ */
766
+ $redraw() {
767
+ }
768
+ /**
769
+ * Lifecycle hook for 'willDestroy' phase.
770
+ * @private
771
+ */
772
+ $willDestroy() {
773
+ Object.keys(this).forEach((key) => {
774
+ this[key] = null;
775
+ delete this[key];
776
+ });
777
+ }
778
+ }
779
+ __publicField(Plugin, "version", "3.12.0-next.1");
1430
780
 
1431
- /**
1432
- * Copyright (c) 2021 ~ present NAVER Corp.
1433
- * billboard.js project is licensed under the MIT license
1434
- */
781
+ ;// CONCATENATED MODULE: ./src/Plugin/sparkline/Options.ts
782
+ class Options {
783
+ constructor() {
784
+ return {
785
+ /**
786
+ * Specify sparkline charts holder selector.
787
+ * - **NOTE:** The amount of holder should match with the amount of data. If has less, will append necessaray amount nodes as sibling of main chart.
788
+ * @name selector
789
+ * @memberof plugin-sparkline
790
+ * @type {string}
791
+ * @default undefined
792
+ * @example
793
+ * selector: ".sparkline"
794
+ */
795
+ selector: void 0
796
+ };
797
+ }
798
+ }
1435
799
 
800
+ ;// CONCATENATED MODULE: ./src/Plugin/sparkline/index.ts
801
+ var sparkline_defProp = Object.defineProperty;
802
+ var sparkline_defNormalProp = (obj, key, value) => key in obj ? sparkline_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
803
+ var sparkline_publicField = (obj, key, value) => {
804
+ sparkline_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
805
+ return value;
806
+ };
1436
807
 
1437
808
 
1438
809
 
1439
810
 
1440
- /**
1441
- * Sparkline plugin.<br>
1442
- * Generates sparkline charts
1443
- * - **NOTE:**
1444
- * - Plugins aren't built-in. Need to be loaded or imported to be used.
1445
- * - Non required modules from billboard.js core, need to be installed separately.
1446
- *
1447
- * - **Bear in mind:**
1448
- * - Use this plugin to visualize multiple tiny chart only and chart APIs won't work properly.
1449
- * - Sparkline chart size will be based on the main chart element size. To control spakrline charts, is highly recommended to set `size` option.
1450
- * - Bubble, scatter and Arc(pie, donut, ratdar) types aren't supported.
1451
- * - Some options will be stricted to be:
1452
- * - `resize.auto = false`
1453
- * - `axis.x.show = false`
1454
- * - `axis.y.show = false`
1455
- * - `axis.y.padding = 10`
1456
- * - `legend.show = false`
1457
- *
1458
- * @class plugin-sparkline
1459
- * @param {object} options sparkline plugin options
1460
- * @augments Plugin
1461
- * @returns {Sparkline}
1462
- * @example
1463
- * // Plugin must be loaded before the use.
1464
- * <script src="$YOUR_PATH/plugin/billboardjs-plugin-sparkline.js"></script>
1465
- *
1466
- * var chart = bb.generate({
1467
- * ...
1468
- * plugins: [
1469
- * new bb.plugin.sparkline({
1470
- * selector: ".sparkline"
1471
- * }),
1472
- * ]
1473
- * });
1474
- * @example
1475
- * import {bb} from "billboard.js";
1476
- * import Sparkline from "billboard.js/dist/billboardjs-plugin-sparkline";
1477
- *
1478
- * bb.generate({
1479
- * ...
1480
- * plugins: [
1481
- * new Sparkline({ ... })
1482
- * ]
1483
- * })
1484
- */
1485
- let Sparkline = /*#__PURE__*/function (_Plugin) {
1486
- _inheritsLoose(Sparkline, _Plugin);
1487
- function Sparkline(options) {
1488
- var _this = _Plugin.call(this, options) || this;
1489
- _this.config = void 0;
1490
- _this.element = void 0;
1491
- _this.config = new Options();
1492
- return _assertThisInitialized(_this) || _assertThisInitialized(_this);
811
+ class Sparkline extends Plugin {
812
+ constructor(options) {
813
+ super(options);
814
+ sparkline_publicField(this, "config");
815
+ sparkline_publicField(this, "element");
816
+ this.config = new Options();
817
+ return this;
1493
818
  }
1494
- var _proto = Sparkline.prototype;
1495
- _proto.$beforeInit = function $beforeInit() {
819
+ $beforeInit() {
1496
820
  loadConfig.call(this, this.options);
1497
821
  this.validate();
1498
822
  this.element = [].slice.call(document.querySelectorAll(this.config.selector));
1499
-
1500
- // override internal methods
1501
823
  this.overrideInternals();
1502
-
1503
- // override options
1504
824
  this.overrideOptions();
1505
-
1506
- // bind event handlers's context
1507
825
  this.overHandler = this.overHandler.bind(this);
1508
826
  this.moveHandler = this.moveHandler.bind(this);
1509
827
  this.outHandler = this.outHandler.bind(this);
1510
- };
1511
- _proto.validate = function validate() {
1512
- const $$ = this.$$,
1513
- config = this.config;
828
+ }
829
+ validate() {
830
+ const { $$, config } = this;
1514
831
  let msg = "";
1515
832
  if (!config.selector || !document.querySelector(config.selector)) {
1516
833
  msg = "No holder elements found from given selector option.";
@@ -1519,34 +836,26 @@ let Sparkline = /*#__PURE__*/function (_Plugin) {
1519
836
  msg = "Contains non supported chart types.";
1520
837
  }
1521
838
  if (msg) {
1522
- throw new Error("[Sparkline plugin] " + msg);
839
+ throw new Error(`[Sparkline plugin] ${msg}`);
1523
840
  }
1524
- };
1525
- _proto.overrideInternals = function overrideInternals() {
1526
- const $$ = this.$$,
1527
- getBarW = $$.getBarW,
1528
- getIndices = $$.getIndices;
1529
- // override internal methods to positioning bars
1530
- $$.getIndices = function (indices, d, caller) {
841
+ }
842
+ overrideInternals() {
843
+ const { $$ } = this;
844
+ const { getBarW, getIndices } = $$;
845
+ $$.getIndices = function(indices, d, caller) {
1531
846
  return caller === "getShapeX" ? {} : getIndices.call(this, indices, d);
1532
847
  };
1533
- $$.getBarW = function (type, axis) {
848
+ $$.getBarW = function(type, axis) {
1534
849
  return getBarW.call(this, type, axis, 1);
1535
850
  };
1536
- };
1537
- _proto.overrideOptions = function overrideOptions() {
1538
- var _this2 = this;
1539
- const config = this.$$.config;
1540
- config.legend_show = !1;
1541
- config.resize_auto = !1;
1542
- config.axis_x_show = !1;
1543
-
1544
- // set default axes padding
1545
- if (config.padding !== !1) {
1546
- const hasOption = function (o) {
1547
- _newArrowCheck(this, _this2);
1548
- return Object.keys(o || {}).length > 0;
1549
- }.bind(this);
851
+ }
852
+ overrideOptions() {
853
+ const { config } = this.$$;
854
+ config.legend_show = false;
855
+ config.resize_auto = false;
856
+ config.axis_x_show = false;
857
+ if (config.padding !== false) {
858
+ const hasOption = (o) => Object.keys(o || {}).length > 0;
1550
859
  if (hasOption(config.axis_x_padding)) {
1551
860
  config.axis_x_padding = {
1552
861
  left: 15,
@@ -1558,97 +867,84 @@ let Sparkline = /*#__PURE__*/function (_Plugin) {
1558
867
  config.axis_y_padding = 5;
1559
868
  }
1560
869
  }
1561
- config.axis_y_show = !1;
870
+ config.axis_y_show = false;
1562
871
  if (!config.tooltip_position) {
1563
- config.tooltip_position = function (data, width, height) {
1564
- const event = this.internal.state.event;
1565
- let top = event.pageY - height * 1.35,
1566
- left = event.pageX - width / 2;
872
+ config.tooltip_position = function(data, width, height) {
873
+ const { internal: { state: { event } } } = this;
874
+ let top = event.pageY - height * 1.35;
875
+ let left = event.pageX - width / 2;
1567
876
  if (top < 0) {
1568
877
  top = 0;
1569
878
  }
1570
879
  if (left < 0) {
1571
880
  left = 0;
1572
881
  }
1573
- return {
1574
- top: top,
1575
- left: left
1576
- };
882
+ return { top, left };
1577
883
  };
1578
884
  }
1579
- };
1580
- _proto.$init = function $init() {
1581
- var _$el$tooltip;
1582
- const $el = this.$$.$el;
1583
-
1584
- // make disable-ish main chart element
885
+ }
886
+ $init() {
887
+ var _a;
888
+ const { $$: { $el } } = this;
1585
889
  $el.chart.style("width", "0").style("height", "0").style("pointer-events", "none");
1586
- ((_$el$tooltip = $el.tooltip) == null ? void 0 : _$el$tooltip.node()) && document.body.appendChild($el.tooltip.node());
1587
- };
1588
- _proto.$afterInit = function $afterInit() {
1589
- const $$ = this.$$;
890
+ ((_a = $el.tooltip) == null ? void 0 : _a.node()) && document.body.appendChild($el.tooltip.node());
891
+ }
892
+ $afterInit() {
893
+ const { $$ } = this;
1590
894
  $$.$el.svg.attr("style", null).style("width", "0").style("height", "0");
1591
- this.bindEvents(!0);
895
+ this.bindEvents(true);
1592
896
  }
1593
-
1594
897
  /**
1595
898
  * Bind tooltip event handlers for each sparkline elements.
1596
899
  * @param {boolean} bind or unbind
1597
900
  * @private
1598
- */;
1599
- _proto.bindEvents = function bindEvents(bind) {
1600
- var _this3 = this;
1601
- if (bind === void 0) {
1602
- bind = !0;
1603
- }
1604
- const config = this.$$.config;
901
+ */
902
+ bindEvents(bind = true) {
903
+ const { $$: { config } } = this;
1605
904
  if (config.interaction_enabled && config.tooltip_show) {
1606
- const method = (bind ? "add" : "remove") + "EventListener";
1607
- this.element.forEach(function (el) {
1608
- _newArrowCheck(this, _this3);
905
+ const method = `${bind ? "add" : "remove"}EventListener`;
906
+ this.element.forEach((el) => {
1609
907
  const svg = el.querySelector("svg");
1610
908
  svg[method]("mouseover", this.overHandler);
1611
909
  svg[method]("mousemove", this.moveHandler);
1612
910
  svg[method]("mouseout", this.outHandler);
1613
- }.bind(this));
911
+ });
1614
912
  }
1615
- };
1616
- _proto.overHandler = function overHandler(e) {
1617
- const $$ = this.$$,
1618
- eventReceiver = $$.state.eventReceiver;
913
+ }
914
+ overHandler(e) {
915
+ const { $$ } = this;
916
+ const { state: { eventReceiver } } = $$;
1619
917
  eventReceiver.rect = e.target.getBoundingClientRect();
1620
- };
1621
- _proto.moveHandler = function moveHandler(e) {
1622
- var _$$$api$data, _data$values;
1623
- const $$ = this.$$,
1624
- index = $$.getDataIndexFromEvent(e),
1625
- data = (_$$$api$data = $$.api.data(e.target.__id)) == null ? void 0 : _$$$api$data[0],
1626
- d = data == null || (_data$values = data.values) == null ? void 0 : _data$values[index];
918
+ }
919
+ moveHandler(e) {
920
+ var _a, _b, _c, _d;
921
+ const { $$ } = this;
922
+ const index = $$.getDataIndexFromEvent(e);
923
+ const data = (_a = $$.api.data(e.target.__id)) == null ? void 0 : _a[0];
924
+ const d = (_b = data == null ? void 0 : data.values) == null ? void 0 : _b[index];
1627
925
  if (d && !d.name) {
1628
926
  d.name = d.id;
1629
927
  }
1630
928
  $$.state.event = e;
1631
- if ($$.isPointFocusOnly != null && $$.isPointFocusOnly() && d) {
1632
- $$.showCircleFocus == null || $$.showCircleFocus([d]);
929
+ if (((_c = $$.isPointFocusOnly) == null ? void 0 : _c.call($$)) && d) {
930
+ (_d = $$.showCircleFocus) == null ? void 0 : _d.call($$, [d]);
1633
931
  }
1634
- $$.setExpand(index, data.id, !0);
932
+ $$.setExpand(index, data.id, true);
1635
933
  $$.showTooltip([d], e.target);
1636
- };
1637
- _proto.outHandler = function outHandler(e) {
1638
- const $$ = this.$$;
934
+ }
935
+ outHandler(e) {
936
+ const { $$ } = this;
1639
937
  $$.state.event = e;
1640
938
  $$.isPointFocusOnly() ? $$.hideCircleFocus() : $$.unexpandCircles();
1641
939
  $$.hideTooltip();
1642
- };
1643
- _proto.$redraw = function $redraw() {
1644
- var _$el$chart$html$match,
1645
- _this4 = this;
1646
- const $$ = this.$$,
1647
- $el = $$.$el;
940
+ }
941
+ $redraw() {
942
+ var _a;
943
+ const { $$ } = this;
944
+ const { $el } = $$;
1648
945
  let el = this.element;
1649
- const data = $$.api.data(),
1650
- svgWrapper = (_$el$chart$html$match = $el.chart.html().match(/<svg[^>]*>/)) == null ? void 0 : _$el$chart$html$match[0];
1651
- // append sparkline holder if is less than the data length
946
+ const data = $$.api.data();
947
+ const svgWrapper = (_a = $el.chart.html().match(/<svg[^>]*>/)) == null ? void 0 : _a[0];
1652
948
  if (el.length < data.length) {
1653
949
  const chart = $el.chart.node();
1654
950
  for (let i = data.length - el.length; i > 0; i--) {
@@ -1657,16 +953,12 @@ let Sparkline = /*#__PURE__*/function (_Plugin) {
1657
953
  this.element = document.querySelectorAll(this.config.selector);
1658
954
  el = this.element;
1659
955
  }
1660
- data.map(function (v) {
1661
- _newArrowCheck(this, _this4);
1662
- return v.id;
1663
- }.bind(this)).forEach(function (id, i) {
1664
- _newArrowCheck(this, _this4);
1665
- const selector = "." + $COMMON.target + "-" + id,
1666
- shape = $el.main.selectAll(selector);
956
+ data.map((v) => v.id).forEach((id, i) => {
957
+ const selector = `.${$COMMON.target}-${id}`;
958
+ const shape = $el.main.selectAll(selector);
1667
959
  let svg = el[i].querySelector("svg");
1668
960
  if (!svg) {
1669
- el[i].innerHTML = svgWrapper + "</svg>";
961
+ el[i].innerHTML = `${svgWrapper}</svg>`;
1670
962
  svg = el[i].querySelector("svg");
1671
963
  svg.__id = id;
1672
964
  }
@@ -1676,19 +968,16 @@ let Sparkline = /*#__PURE__*/function (_Plugin) {
1676
968
  shape.style("fill", "none").style("opacity", null);
1677
969
  svg.innerHTML = "";
1678
970
  svg.appendChild(shape.node());
1679
- }.bind(this));
1680
- };
1681
- _proto.$willDestroy = function $willDestroy() {
1682
- var _this5 = this;
1683
- this.bindEvents(!1);
1684
- this.element.forEach(function (el) {
1685
- _newArrowCheck(this, _this5);
971
+ });
972
+ }
973
+ $willDestroy() {
974
+ this.bindEvents(false);
975
+ this.element.forEach((el) => {
1686
976
  el.innerHTML = "";
1687
- }.bind(this));
1688
- };
1689
- return Sparkline;
1690
- }(Plugin);
1691
- Sparkline.version = "0.0.1";
977
+ });
978
+ }
979
+ }
980
+ sparkline_publicField(Sparkline, "version", `0.0.1`);
1692
981
 
1693
982
  }();
1694
983
  __webpack_exports__ = __webpack_exports__["default"];