billboard.js 3.5.0 → 3.5.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 (67) hide show
  1. package/README.md +1 -1
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +105 -73
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +134 -85
  7. package/dist/billboard.pkgd.min.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -71
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +2 -71
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +2 -71
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -71
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +31 -14
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +31 -83
  20. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +31 -83
  21. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +31 -83
  22. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +31 -83
  23. package/dist/theme/datalab.css +1 -1
  24. package/dist/theme/datalab.min.css +1 -1
  25. package/dist/theme/graph.css +1 -1
  26. package/dist/theme/graph.min.css +1 -1
  27. package/dist/theme/insight.css +1 -1
  28. package/dist/theme/insight.min.css +1 -1
  29. package/dist-esm/billboard.js +97 -72
  30. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  32. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  34. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  35. package/package.json +10 -10
  36. package/src/Chart/api/data.ts +2 -2
  37. package/src/Chart/api/selection.ts +1 -1
  38. package/src/ChartInternal/Axis/AxisRenderer.ts +1 -1
  39. package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
  40. package/src/ChartInternal/ChartInternal.ts +1 -1
  41. package/src/ChartInternal/data/convert.ts +3 -2
  42. package/src/ChartInternal/data/data.ts +1 -1
  43. package/src/ChartInternal/interactions/drag.ts +1 -1
  44. package/src/ChartInternal/internals/color.ts +1 -1
  45. package/src/ChartInternal/internals/domain.ts +1 -1
  46. package/src/ChartInternal/internals/format.ts +1 -1
  47. package/src/ChartInternal/internals/region.ts +1 -1
  48. package/src/ChartInternal/internals/scale.ts +1 -1
  49. package/src/ChartInternal/internals/size.axis.ts +1 -1
  50. package/src/ChartInternal/internals/style.ts +2 -2
  51. package/src/ChartInternal/internals/text.ts +2 -2
  52. package/src/ChartInternal/internals/tooltip.ts +1 -1
  53. package/src/ChartInternal/shape/arc.ts +2 -2
  54. package/src/ChartInternal/shape/area.ts +3 -2
  55. package/src/ChartInternal/shape/bar.ts +2 -2
  56. package/src/ChartInternal/shape/point.ts +1 -1
  57. package/src/ChartInternal/shape/polar.ts +1 -1
  58. package/src/ChartInternal/shape/shape.ts +2 -2
  59. package/src/Plugin/sparkline/index.ts +1 -1
  60. package/src/Plugin/textoverlap/index.ts +1 -1
  61. package/src/config/Options/data/data.ts +1 -1
  62. package/src/config/Store/Element.ts +1 -1
  63. package/src/module/Cache.ts +1 -1
  64. package/src/module/generator.ts +1 -1
  65. package/src/module/util.ts +1 -74
  66. package/src/module/worker.ts +101 -0
  67. package/types/axis.d.ts +2 -2
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.5.0
8
+ * @version 3.5.1
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - d3-axis ^3.0.0
@@ -1126,10 +1126,10 @@ var store = __webpack_require__(35);
1126
1126
  (module.exports = function (key, value) {
1127
1127
  return store[key] || (store[key] = value !== undefined ? value : {});
1128
1128
  })('versions', []).push({
1129
- version: '3.23.3',
1129
+ version: '3.23.4',
1130
1130
  mode: IS_PURE ? 'pure' : 'global',
1131
1131
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
1132
- license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
1132
+ license: 'https://github.com/zloirock/core-js/blob/v3.23.4/LICENSE',
1133
1133
  source: 'https://github.com/zloirock/core-js'
1134
1134
  });
1135
1135
 
@@ -3285,6 +3285,7 @@ var ResultPrototype = Result.prototype;
3285
3285
  module.exports = function (iterable, unboundFunction, options) {
3286
3286
  var that = options && options.that;
3287
3287
  var AS_ENTRIES = !!(options && options.AS_ENTRIES);
3288
+ var IS_RECORD = !!(options && options.IS_RECORD);
3288
3289
  var IS_ITERATOR = !!(options && options.IS_ITERATOR);
3289
3290
  var INTERRUPTED = !!(options && options.INTERRUPTED);
3290
3291
  var fn = bind(unboundFunction, that);
@@ -3302,7 +3303,9 @@ module.exports = function (iterable, unboundFunction, options) {
3302
3303
  } return INTERRUPTED ? fn(value, stop) : fn(value);
3303
3304
  };
3304
3305
 
3305
- if (IS_ITERATOR) {
3306
+ if (IS_RECORD) {
3307
+ iterator = iterable.iterator;
3308
+ } else if (IS_ITERATOR) {
3306
3309
  iterator = iterable;
3307
3310
  } else {
3308
3311
  iterFn = getIteratorMethod(iterable);
@@ -3317,7 +3320,7 @@ module.exports = function (iterable, unboundFunction, options) {
3317
3320
  iterator = getIterator(iterable, iterFn);
3318
3321
  }
3319
3322
 
3320
- next = iterator.next;
3323
+ next = IS_RECORD ? iterable.next : iterator.next;
3321
3324
  while (!(step = call(next, iterator)).done) {
3322
3325
  try {
3323
3326
  result = callFn(step.value);
@@ -10313,7 +10316,7 @@ var charAt = uncurryThis(''.charAt);
10313
10316
  var replace = uncurryThis(''.replace);
10314
10317
  var stringIndexOf = uncurryThis(''.indexOf);
10315
10318
  var stringSlice = uncurryThis(''.slice);
10316
- // TODO: Use only propper RegExpIdentifierName
10319
+ // TODO: Use only proper RegExpIdentifierName
10317
10320
  var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
10318
10321
  var re1 = /a/g;
10319
10322
  var re2 = /a/g;
@@ -10766,7 +10769,7 @@ if (PATCH) {
10766
10769
  }
10767
10770
  if (NPCG_INCLUDED && match && match.length > 1) {
10768
10771
  // Fix browsers whose `exec` methods don't consistently return `undefined`
10769
- // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
10772
+ // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
10770
10773
  call(nativeReplace, match[0], reCopy, function () {
10771
10774
  for (i = 1; i < arguments.length - 2; i++) {
10772
10775
  if (arguments[i] === undefined) match[i] = undefined;
@@ -13597,7 +13600,7 @@ var $reduceRight = (__webpack_require__(173).right);
13597
13600
  var aTypedArray = ArrayBufferViewCore.aTypedArray;
13598
13601
  var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
13599
13602
 
13600
- // `%TypedArray%.prototype.reduceRicht` method
13603
+ // `%TypedArray%.prototype.reduceRight` method
13601
13604
  // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright
13602
13605
  exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */) {
13603
13606
  var length = arguments.length;
@@ -14661,6 +14664,7 @@ module.exports = {
14661
14664
  "use strict";
14662
14665
 
14663
14666
  var $ = __webpack_require__(3);
14667
+ var global = __webpack_require__(4);
14664
14668
  var getBuiltIn = __webpack_require__(22);
14665
14669
  var createPropertyDescriptor = __webpack_require__(11);
14666
14670
  var defineProperty = (__webpack_require__(43).f);
@@ -14670,6 +14674,7 @@ var inheritIfRequired = __webpack_require__(114);
14670
14674
  var normalizeStringArgument = __webpack_require__(115);
14671
14675
  var DOMExceptionConstants = __webpack_require__(474);
14672
14676
  var clearErrorStack = __webpack_require__(117);
14677
+ var DESCRIPTORS = __webpack_require__(6);
14673
14678
  var IS_PURE = __webpack_require__(34);
14674
14679
 
14675
14680
  var DOM_EXCEPTION = 'DOMException';
@@ -14693,7 +14698,15 @@ var DOMExceptionPrototype = $DOMException.prototype = NativeDOMException.prototy
14693
14698
 
14694
14699
  var ERROR_HAS_STACK = 'stack' in Error(DOM_EXCEPTION);
14695
14700
  var DOM_EXCEPTION_HAS_STACK = 'stack' in new NativeDOMException(1, 2);
14696
- var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !DOM_EXCEPTION_HAS_STACK;
14701
+
14702
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
14703
+ var descriptor = NativeDOMException && DESCRIPTORS && Object.getOwnPropertyDescriptor(global, DOM_EXCEPTION);
14704
+
14705
+ // Bun ~ 0.1.1 DOMException have incorrect descriptor and we can't redefine it
14706
+ // https://github.com/Jarred-Sumner/bun/issues/399
14707
+ var BUGGY_DESCRIPTOR = !!descriptor && !(descriptor.writable && descriptor.configurable);
14708
+
14709
+ var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !BUGGY_DESCRIPTOR && !DOM_EXCEPTION_HAS_STACK;
14697
14710
 
14698
14711
  // `DOMException` constructor patch for `.stack` where it's required
14699
14712
  // https://webidl.spec.whatwg.org/#es-DOMException-specialness
@@ -14870,7 +14883,7 @@ var checkErrorsCloning = function (structuredCloneImplementation, $Error) {
14870
14883
  return !fails(function () {
14871
14884
  var error = new $Error();
14872
14885
  var test = structuredCloneImplementation({ a: error, b: error });
14873
- return !(test && test.a === test.b && test.a instanceof $Error);
14886
+ return !(test && test.a === test.b && test.a instanceof $Error && test.stack === error.stack);
14874
14887
  });
14875
14888
  };
14876
14889
 
@@ -14883,13 +14896,17 @@ var checkNewErrorsCloningSemantic = function (structuredCloneImplementation) {
14883
14896
  };
14884
14897
 
14885
14898
  // FF94+, Safari 15.4+, Chrome 98+, NodeJS 17.0+, Deno 1.13+
14886
- // FF and Safari implementations can't clone errors
14899
+ // FF<103 and Safari implementations can't clone errors
14887
14900
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1556604
14901
+ // FF103 can clone errors, but `.stack` of clone is an empty string
14902
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1778762
14903
+ // FF104+ fixed it on usual errors, but not on DOMExceptions
14904
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1777321
14888
14905
  // Chrome <102 returns `null` if cloned object contains multiple references to one error
14889
14906
  // https://bugs.chromium.org/p/v8/issues/detail?id=12542
14890
14907
  // NodeJS implementation can't clone DOMExceptions
14891
14908
  // https://github.com/nodejs/node/issues/41038
14892
- // no one of current implementations supports new (html/5749) error cloning semantic
14909
+ // only FF103+ supports new (html/5749) error cloning semantic
14893
14910
  var nativeStructuredClone = global.structuredClone;
14894
14911
 
14895
14912
  var FORCED_REPLACEMENT = IS_PURE
@@ -14907,7 +14924,7 @@ var FORCED_REPLACEMENT = IS_PURE
14907
14924
  // NodeJS <17.2 structured cloning implementation from `performance.mark` is too naive
14908
14925
  // and can't clone, for example, `RegExp` or some boxed primitives
14909
14926
  // https://github.com/nodejs/node/issues/40840
14910
- // no one of current implementations supports new (html/5749) error cloning semantic
14927
+ // no one of those implementations supports new (html/5749) error cloning semantic
14911
14928
  var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {
14912
14929
  return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;
14913
14930
  });
@@ -22998,75 +23015,6 @@ function convertInputType(mouse, touch) {
22998
23015
 
22999
23016
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
23000
23017
  }
23001
- /**
23002
- * Create and run on Web Worker
23003
- * @param {boolean} useWorker Use Web Worker
23004
- * @param {Function} fn Function to be executed in worker
23005
- * @param {Function} callback Callback function to receive result from worker
23006
- * @param {Array} depsFn Dependency functions to run given function(fn).
23007
- * @returns {object}
23008
- * @example
23009
- * const worker = runWorker(function(arg) {
23010
- * // do some tasks...
23011
- * console.log("param:", A(arg));
23012
- *
23013
- * return 1234;
23014
- * }, function(data) {
23015
- * // callback after worker is done
23016
- * console.log("result:", data);
23017
- * },
23018
- * [function A(){}]
23019
- * );
23020
- *
23021
- * worker(11111);
23022
- * @private
23023
- */
23024
-
23025
-
23026
- function runWorker(useWorker, fn, callback, depsFn) {
23027
- if (useWorker === void 0) {
23028
- useWorker = !0;
23029
- }
23030
-
23031
- var runFn;
23032
-
23033
- if (win.Worker && useWorker) {
23034
- var _depsFn$map$join,
23035
- blob = new Blob([((_depsFn$map$join = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _depsFn$map$join : "") + "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (" + fn.toString() + ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};"], {
23036
- type: "text/javascript"
23037
- }),
23038
- worker = new Worker(URL.createObjectURL(blob));
23039
-
23040
- runFn = function () {
23041
- for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
23042
- args[_key5] = arguments[_key5];
23043
- }
23044
-
23045
- // trigger worker
23046
- worker.postMessage(args); // listen worker
23047
-
23048
- worker.onmessage = function (e) {
23049
- return callback(e.data);
23050
- }; // handle error
23051
-
23052
-
23053
- worker.onerror = function (e) {
23054
- console.error(e);
23055
- }; // return new Promise((resolve, reject) => {
23056
- // worker.onmessage = ({data}) => resolve(data);
23057
- // worker.onerror = reject;
23058
- // });
23059
-
23060
- };
23061
- } else {
23062
- runFn = function () {
23063
- var res = fn.apply(void 0, arguments);
23064
- callback(res);
23065
- };
23066
- }
23067
-
23068
- return runFn;
23069
- }
23070
23018
  /**
23071
23019
  * Run function until given condition function return true
23072
23020
  * @param {Function} fn Function to be executed when condition is true
@@ -25732,6 +25680,105 @@ function generateWait() {
25732
25680
 
25733
25681
  return f;
25734
25682
  }
25683
+ ;// CONCATENATED MODULE: ./src/module/worker.ts
25684
+ /**
25685
+ * Copyright (c) 2017 ~ present NAVER Corp.
25686
+ * billboard.js project is licensed under the MIT license
25687
+ */
25688
+ // Store blob in memory
25689
+
25690
+ var blob = {};
25691
+ /**
25692
+ * Get Object URL
25693
+ * @param {Function} fn Function to be executed in worker
25694
+ * @param {Array} depsFn Dependency functions to run given function(fn).
25695
+ * @returns {string}
25696
+ * @private
25697
+ */
25698
+
25699
+ function getObjectURL(fn, depsFn) {
25700
+ var fnString = fn.toString(),
25701
+ key = fnString.replace(/(function|[\s\W\n])/g, "").substring(0, 15);
25702
+
25703
+ if (!(key in blob)) {
25704
+ var _depsFn$map$join;
25705
+
25706
+ // Web Worker body
25707
+ blob[key] = new win.Blob([((_depsFn$map$join = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _depsFn$map$join : "") + "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (" + fnString + ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};"], {
25708
+ type: "text/javascript"
25709
+ });
25710
+ }
25711
+
25712
+ return win.URL.createObjectURL(blob[key]);
25713
+ }
25714
+ /**
25715
+ * Create and run on Web Worker
25716
+ * @param {boolean} useWorker Use Web Worker
25717
+ * @param {Function} fn Function to be executed in worker
25718
+ * @param {Function} callback Callback function to receive result from worker
25719
+ * @param {Array} depsFn Dependency functions to run given function(fn).
25720
+ * @returns {object}
25721
+ * @example
25722
+ * const worker = runWorker(function(arg) {
25723
+ * // do some tasks...
25724
+ * console.log("param:", A(arg));
25725
+ *
25726
+ * return 1234;
25727
+ * }, function(data) {
25728
+ * // callback after worker is done
25729
+ * console.log("result:", data);
25730
+ * },
25731
+ * [function A(){}]
25732
+ * );
25733
+ *
25734
+ * worker(11111);
25735
+ * @private
25736
+ */
25737
+
25738
+
25739
+ function runWorker(useWorker, fn, callback, depsFn) {
25740
+ if (useWorker === void 0) {
25741
+ useWorker = !0;
25742
+ }
25743
+
25744
+ var runFn;
25745
+
25746
+ if (win.Worker && useWorker) {
25747
+ var src = getObjectURL(fn, depsFn),
25748
+ worker = new win.Worker(src);
25749
+
25750
+ runFn = function () {
25751
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
25752
+ args[_key] = arguments[_key];
25753
+ }
25754
+
25755
+ // trigger worker
25756
+ worker.postMessage(args); // listen worker
25757
+
25758
+ worker.onmessage = function (e) {
25759
+ // release object URL from memory
25760
+ win.URL.revokeObjectURL(src);
25761
+ return callback(e.data);
25762
+ }; // handle error
25763
+
25764
+
25765
+ worker.onerror = function (e) {
25766
+ console.error(e);
25767
+ }; // return new Promise((resolve, reject) => {
25768
+ // worker.onmessage = ({data}) => resolve(data);
25769
+ // worker.onerror = reject;
25770
+ // });
25771
+
25772
+ };
25773
+ } else {
25774
+ runFn = function () {
25775
+ var res = fn.apply(void 0, arguments);
25776
+ callback(res);
25777
+ };
25778
+ }
25779
+
25780
+ return runFn;
25781
+ }
25735
25782
  ;// CONCATENATED MODULE: ./node_modules/d3-dsv/src/dsv.js
25736
25783
  var EOL = {},
25737
25784
  EOF = {},
@@ -26140,6 +26187,7 @@ function convert_helper_tsv(tsv) {
26140
26187
 
26141
26188
 
26142
26189
 
26190
+
26143
26191
  /**
26144
26192
  * Get data key for JSON
26145
26193
  * @param {string|object} keysParam Key params
@@ -46243,10 +46291,11 @@ function point_y(p) {
46243
46291
  var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
46244
46292
  offset = areaOffset(d, i) || y0,
46245
46293
  posX = x(d),
46294
+ value = d.value,
46246
46295
  posY = y(d);
46247
46296
 
46248
46297
  // fix posY not to overflow opposite quadrant
46249
- if (config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY)) {
46298
+ if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
46250
46299
  posY = y0;
46251
46300
  } // 1 point that marks the area position
46252
46301
 
@@ -52339,7 +52388,7 @@ var _defaults = {},
52339
52388
  * bb.version; // "1.0.0"
52340
52389
  * @memberof bb
52341
52390
  */
52342
- version: "3.5.0",
52391
+ version: "3.5.1",
52343
52392
 
52344
52393
  /**
52345
52394
  * Generate chart
@@ -52474,7 +52523,7 @@ var _defaults = {},
52474
52523
  };
52475
52524
  /**
52476
52525
  * @namespace bb
52477
- * @version 3.5.0
52526
+ * @version 3.5.1
52478
52527
  */
52479
52528
  ;// CONCATENATED MODULE: ./src/index.ts
52480
52529