billboard.js 3.17.3 → 3.17.4

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 (44) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +15 -7
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +9 -9
  5. package/dist/billboard.pkgd.js +23 -15
  6. package/dist/billboard.pkgd.min.js +20 -20
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +15 -7
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  11. package/dist/plugin/billboardjs-plugin-stanford.js +15 -7
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
  13. package/dist/plugin/billboardjs-plugin-tableview.js +15 -7
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +3 -3
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +15 -7
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +15 -7
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +8 -8
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +23 -15
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +10 -10
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +15 -7
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +10 -10
  25. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +15 -7
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +3 -3
  27. package/dist/theme/dark.css +1 -1
  28. package/dist/theme/dark.min.css +1 -1
  29. package/dist/theme/datalab.css +1 -1
  30. package/dist/theme/datalab.min.css +1 -1
  31. package/dist/theme/graph.css +1 -1
  32. package/dist/theme/graph.min.css +1 -1
  33. package/dist/theme/insight.css +1 -1
  34. package/dist/theme/insight.min.css +1 -1
  35. package/dist/theme/modern.css +1 -1
  36. package/dist/theme/modern.min.css +1 -1
  37. package/dist-esm/billboard.js +22 -12
  38. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  39. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  41. package/dist-esm/plugin/billboardjs-plugin-tableview.js +21 -11
  42. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  43. package/package.json +1 -1
  44. package/src/module/util.ts +22 -11
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.17.3
8
+ * @version 3.17.4
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - @types/d3-selection ^3.0.11
@@ -28763,20 +28763,28 @@ function endall(transition, cb) {
28763
28763
  transition.call(end);
28764
28764
  }
28765
28765
  }
28766
- const dangerousTags = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|svg|math";
28766
+ const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
28767
28767
  const sanitizeRx = {
28768
28768
  tags: new RegExp(
28769
- `<(${dangerousTags})[\\s\\S]*?>[\\s\\S]*?<\\/\\1>|<(${dangerousTags})[^>]*\\/?>`,
28769
+ `<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
28770
28770
  "gi"
28771
28771
  ),
28772
- eventHandlers: /\s*on\w+\s*=\s*["'][^"']*["']|\s*on\w+\s*=\s*[^\s>]+/gi,
28773
- dangerousUrls: /(href|src|action|formaction|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript):[^"'\s>]*/gi
28772
+ // Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
28773
+ eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
28774
+ // Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
28775
+ dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
28774
28776
  };
28775
28777
  function sanitize(str) {
28776
28778
  if (!isString(str) || !str || str.indexOf("<") === -1) {
28777
28779
  return str;
28778
28780
  }
28779
- return str.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousUrls, '$1=""');
28781
+ let result = str;
28782
+ let prev;
28783
+ do {
28784
+ prev = result;
28785
+ result = result.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousURIs, '$1=""');
28786
+ } while (result !== prev);
28787
+ return result;
28780
28788
  }
28781
28789
  function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
28782
28790
  if (!node || !isString(text)) {
@@ -33558,8 +33566,8 @@ FormatSpecifier.prototype.toString = function() {
33558
33566
  return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
33559
33567
  }
33560
33568
  function formatDecimalParts(x, p) {
33561
- if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null;
33562
- var i, coefficient = x.slice(0, i);
33569
+ if (!isFinite(x) || x === 0) return null;
33570
+ var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
33563
33571
  return [
33564
33572
  coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
33565
33573
  +x.slice(i + 1)
@@ -33626,7 +33634,7 @@ function formatDecimalParts(x, p) {
33626
33634
  var prefixExponent;
33627
33635
  /* harmony default export */ function formatPrefixAuto(x, p) {
33628
33636
  var d = formatDecimalParts(x, p);
33629
- if (!d) return x + "";
33637
+ if (!d) return prefixExponent = void 0, x.toPrecision(p);
33630
33638
  var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length;
33631
33639
  return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];
33632
33640
  }
@@ -33677,13 +33685,13 @@ var prefixExponent;
33677
33685
  var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
33678
33686
  /* harmony default export */ function src_locale(locale) {
33679
33687
  var group = locale.grouping === void 0 || locale.thousands === void 0 ? src_identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === void 0 ? "" : locale.currency[0] + "", currencySuffix = locale.currency === void 0 ? "" : locale.currency[1] + "", decimal = locale.decimal === void 0 ? "." : locale.decimal + "", numerals = locale.numerals === void 0 ? src_identity : formatNumerals(map.call(locale.numerals, String)), percent = locale.percent === void 0 ? "%" : locale.percent + "", minus = locale.minus === void 0 ? "\u2212" : locale.minus + "", nan = locale.nan === void 0 ? "NaN" : locale.nan + "";
33680
- function newFormat(specifier) {
33688
+ function newFormat(specifier, options) {
33681
33689
  specifier = formatSpecifier(specifier);
33682
33690
  var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;
33683
33691
  if (type === "n") comma = true, type = "g";
33684
33692
  else if (!formatTypes[type]) precision === void 0 && (precision = 12), trim = true, type = "g";
33685
33693
  if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "=";
33686
- var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
33694
+ var prefix = ((options == null ? void 0 : options.prefix) !== void 0 ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + ((options == null ? void 0 : options.suffix) !== void 0 ? options.suffix : "");
33687
33695
  var formatType = formatTypes[type], maybeSuffix = /[defgprs%]/.test(type);
33688
33696
  precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
33689
33697
  function format(value) {
@@ -33698,7 +33706,7 @@ var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5",
33698
33706
  if (trim) value = formatTrim(value);
33699
33707
  if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
33700
33708
  valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
33701
- valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
33709
+ valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== void 0 ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
33702
33710
  if (maybeSuffix) {
33703
33711
  i = -1, n = value.length;
33704
33712
  while (++i < n) {
@@ -33735,9 +33743,9 @@ var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5",
33735
33743
  return format;
33736
33744
  }
33737
33745
  function formatPrefix(specifier, value) {
33738
- var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];
33746
+ var e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), { suffix: prefixes[8 + e / 3] });
33739
33747
  return function(value2) {
33740
- return f(k * value2) + prefix;
33748
+ return f(k * value2);
33741
33749
  };
33742
33750
  }
33743
33751
  return {
@@ -52772,7 +52780,7 @@ const bb = {
52772
52780
  * bb.version; // "1.0.0"
52773
52781
  * @memberof bb
52774
52782
  */
52775
- version: "3.17.3",
52783
+ version: "3.17.4",
52776
52784
  /**
52777
52785
  * Generate chart
52778
52786
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: