billboard.js 3.17.4 → 3.18.0-next.2

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 (137) hide show
  1. package/CONTRIBUTING.md +12 -12
  2. package/README.md +12 -12
  3. package/dist/billboard.css +15 -1
  4. package/dist/billboard.js +1146 -463
  5. package/dist/billboard.min.css +2 -2
  6. package/dist/billboard.min.js +10 -10
  7. package/dist/billboard.pkgd.js +1147 -464
  8. package/dist/billboard.pkgd.min.js +21 -21
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-sparkline.js +117 -26
  12. package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
  13. package/dist/plugin/billboardjs-plugin-stanford.js +119 -28
  14. package/dist/plugin/billboardjs-plugin-stanford.min.js +10 -10
  15. package/dist/plugin/billboardjs-plugin-tableview.js +117 -27
  16. package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
  17. package/dist/plugin/billboardjs-plugin-textoverlap.js +116 -26
  18. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +117 -26
  22. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +120 -29
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +117 -27
  26. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -12
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +116 -26
  28. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +10 -10
  29. package/dist/theme/dark.css +15 -1
  30. package/dist/theme/dark.min.css +2 -2
  31. package/dist/theme/datalab.css +15 -1
  32. package/dist/theme/datalab.min.css +2 -2
  33. package/dist/theme/graph.css +15 -1
  34. package/dist/theme/graph.min.css +2 -2
  35. package/dist/theme/insight.css +15 -1
  36. package/dist/theme/insight.min.css +2 -2
  37. package/dist/theme/modern.css +15 -1
  38. package/dist/theme/modern.min.css +2 -2
  39. package/dist-esm/billboard.js +1467 -536
  40. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  41. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -2
  42. package/dist-esm/plugin/billboardjs-plugin-stanford.js +5 -4
  43. package/dist-esm/plugin/billboardjs-plugin-tableview.js +94 -16
  44. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  45. package/package.json +38 -37
  46. package/src/Chart/Chart.ts +1 -1
  47. package/src/Chart/api/chart.ts +5 -5
  48. package/src/Chart/api/data.ts +2 -1
  49. package/src/Chart/api/export.ts +1 -1
  50. package/src/Chart/api/flow.ts +1 -1
  51. package/src/Chart/api/load.ts +3 -3
  52. package/src/Chart/api/subchart.ts +3 -3
  53. package/src/Chart/api/tooltip.ts +1 -1
  54. package/src/Chart/api/zoom.ts +1 -1
  55. package/src/ChartInternal/Axis/Axis.ts +1 -1
  56. package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
  57. package/src/ChartInternal/ChartInternal.ts +3 -2
  58. package/src/ChartInternal/data/IData.ts +3 -0
  59. package/src/ChartInternal/data/convert.helper.ts +1 -1
  60. package/src/ChartInternal/data/convert.ts +9 -8
  61. package/src/ChartInternal/data/data.ts +135 -17
  62. package/src/ChartInternal/data/load.ts +8 -8
  63. package/src/ChartInternal/interactions/drag.ts +53 -42
  64. package/src/ChartInternal/interactions/eventrect.ts +15 -5
  65. package/src/ChartInternal/interactions/flow.ts +1 -1
  66. package/src/ChartInternal/interactions/interaction.ts +1 -1
  67. package/src/ChartInternal/interactions/zoom.ts +24 -20
  68. package/src/ChartInternal/internals/color.ts +27 -10
  69. package/src/ChartInternal/internals/domain.ts +22 -5
  70. package/src/ChartInternal/internals/format.ts +4 -4
  71. package/src/ChartInternal/internals/grid.ts +11 -11
  72. package/src/ChartInternal/internals/legend.ts +80 -19
  73. package/src/ChartInternal/internals/scale.ts +6 -6
  74. package/src/ChartInternal/internals/selection.ts +1 -1
  75. package/src/ChartInternal/internals/style.ts +3 -3
  76. package/src/ChartInternal/internals/text.arc.ts +304 -0
  77. package/src/ChartInternal/internals/text.ts +44 -14
  78. package/src/ChartInternal/internals/text.util.ts +19 -0
  79. package/src/ChartInternal/internals/title.ts +3 -3
  80. package/src/ChartInternal/internals/tooltip.ts +23 -15
  81. package/src/ChartInternal/shape/arc.ts +174 -71
  82. package/src/ChartInternal/shape/area.ts +2 -2
  83. package/src/ChartInternal/shape/bar.ts +7 -6
  84. package/src/ChartInternal/shape/candlestick.ts +3 -3
  85. package/src/ChartInternal/shape/funnel.ts +18 -18
  86. package/src/ChartInternal/shape/line.ts +9 -10
  87. package/src/ChartInternal/shape/point.common.ts +24 -6
  88. package/src/ChartInternal/shape/radar.ts +4 -4
  89. package/src/ChartInternal/shape/shape.ts +24 -6
  90. package/src/ChartInternal/shape/treemap.ts +19 -5
  91. package/src/Plugin/stanford/Options.ts +2 -2
  92. package/src/Plugin/tableview/Options.ts +1 -1
  93. package/src/config/Options/axis/axis.ts +7 -7
  94. package/src/config/Options/axis/x.ts +6 -6
  95. package/src/config/Options/axis/y.ts +4 -4
  96. package/src/config/Options/axis/y2.ts +16 -3
  97. package/src/config/Options/common/color.ts +2 -2
  98. package/src/config/Options/common/legend.ts +6 -5
  99. package/src/config/Options/common/main.ts +23 -23
  100. package/src/config/Options/common/point.ts +4 -3
  101. package/src/config/Options/common/tooltip.ts +14 -13
  102. package/src/config/Options/data/axis.ts +31 -6
  103. package/src/config/Options/data/data.ts +44 -44
  104. package/src/config/Options/data/selection.ts +4 -4
  105. package/src/config/Options/interaction/interaction.ts +2 -1
  106. package/src/config/Options/interaction/subchart.ts +2 -2
  107. package/src/config/Options/interaction/zoom.ts +4 -4
  108. package/src/config/Options/shape/arc.ts +4 -4
  109. package/src/config/Options/shape/area.ts +1 -1
  110. package/src/config/Options/shape/bar.ts +4 -4
  111. package/src/config/Options/shape/bubble.ts +2 -2
  112. package/src/config/Options/shape/candlestick.ts +1 -1
  113. package/src/config/Options/shape/donut.ts +34 -3
  114. package/src/config/Options/shape/gauge.ts +36 -4
  115. package/src/config/Options/shape/line.ts +1 -1
  116. package/src/config/Options/shape/pie.ts +34 -3
  117. package/src/config/Options/shape/polar.ts +35 -4
  118. package/src/config/Options/shape/radar.ts +1 -1
  119. package/src/config/Options/shape/scatter.ts +1 -1
  120. package/src/config/Options/shape/treemap.ts +31 -5
  121. package/src/config/Store/State.ts +11 -1
  122. package/src/config/classes.ts +1 -0
  123. package/src/core.ts +1 -1
  124. package/src/module/Cache.ts +29 -4
  125. package/src/module/generator.ts +1 -1
  126. package/src/module/util.ts +308 -117
  127. package/src/module/worker.ts +3 -3
  128. package/src/scss/billboard.scss +15 -0
  129. package/src/scss/theme/dark.scss +15 -0
  130. package/src/scss/theme/datalab.scss +15 -0
  131. package/src/scss/theme/graph.scss +15 -0
  132. package/src/scss/theme/insight.scss +15 -0
  133. package/src/scss/theme/modern.scss +15 -0
  134. package/types/axis.d.ts +3 -3
  135. package/types/chart.d.ts +4 -4
  136. package/types/options.d.ts +22 -9
  137. package/types/options.shape.d.ts +59 -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.17.4
8
+ * @version 3.18.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -100,7 +100,7 @@ var Plugin = /** @class */ (function () {
100
100
  delete _this[key];
101
101
  });
102
102
  };
103
- Plugin.version = "3.17.4";
103
+ Plugin.version = "3.18.0-next.2";
104
104
  return Plugin;
105
105
  }());
106
106
 
@@ -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.4
8
+ * @version 3.18.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -71,6 +71,7 @@ var $COMMON = {
71
71
  var $ARC = {
72
72
  arc: "bb-arc",
73
73
  arcLabelLine: "bb-arc-label-line",
74
+ arcLabelLineText: "bb-arc-label-line-text",
74
75
  arcRange: "bb-arc-range",
75
76
  arcs: "bb-arcs",
76
77
  chartArc: "bb-chart-arc",
@@ -376,7 +377,7 @@ var Plugin = /** @class */ (function () {
376
377
  delete _this[key];
377
378
  });
378
379
  };
379
- Plugin.version = "3.17.4";
380
+ Plugin.version = "3.18.0-next.2";
380
381
  return Plugin;
381
382
  }());
382
383
 
@@ -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.4
8
+ * @version 3.18.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -77,6 +77,7 @@ var $COMMON = {
77
77
  var $ARC = {
78
78
  arc: "bb-arc",
79
79
  arcLabelLine: "bb-arc-label-line",
80
+ arcLabelLineText: "bb-arc-label-line-text",
80
81
  arcRange: "bb-arc-range",
81
82
  arcs: "bb-arcs",
82
83
  chartArc: "bb-chart-arc",
@@ -440,7 +441,7 @@ var Plugin = /** @class */ (function () {
440
441
  delete _this[key];
441
442
  });
442
443
  };
443
- Plugin.version = "3.17.4";
444
+ Plugin.version = "3.18.0-next.2";
444
445
  return Plugin;
445
446
  }());
446
447
 
@@ -802,7 +803,7 @@ var Options = /** @class */ (function () {
802
803
  * Set the color of the color scale. This function receives a value between 0 and 1, and should return a color.
803
804
  * @name colors
804
805
  * @memberof plugin-stanford
805
- * @type {Function}
806
+ * @type {function}
806
807
  * @default undefined
807
808
  * @example
808
809
  * colors: d3.interpolateHslLong(
@@ -850,7 +851,7 @@ var Options = /** @class */ (function () {
850
851
  * @property {number} [scale.min=undefined] Minimum value of the color scale. Default: lowest value in epochs
851
852
  * @property {number} [scale.max=undefined] Maximum value of the color scale. Default: highest value in epochs
852
853
  * @property {number} [scale.width=20] Width of the color scale
853
- * @property {string|Function} [scale.format=undefined] Format of the axis of the color scale. Use 'pow10' to format as powers of 10 or a custom function. Example: d3.format("d")
854
+ * @property {string|function} [scale.format=undefined] Format of the axis of the color scale. Use 'pow10' to format as powers of 10 or a custom function. Example: d3.format("d")
854
855
  * @example
855
856
  * scale: {
856
857
  * max: 10000,
@@ -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.4
8
+ * @version 3.18.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -75,39 +75,117 @@ function getGlobal() {
75
75
  var win = getGlobal();
76
76
  var doc = win === null || win === void 0 ? void 0 : win.document;
77
77
 
78
+ /**
79
+ * Private sanitization utilities
80
+ * Encapsulates all XSS prevention patterns and helper functions
81
+ * @private
82
+ */
83
+ var _sanitize = (function () {
84
+ var DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
85
+ // HTML entity character code map (for decoding)
86
+ var ENTITY_MAP = {
87
+ quot: 34,
88
+ amp: 38,
89
+ apos: 39,
90
+ lt: 60,
91
+ gt: 62,
92
+ nbsp: 160,
93
+ iexcl: 161,
94
+ cent: 162,
95
+ pound: 163,
96
+ curren: 164,
97
+ yen: 165
98
+ };
99
+ // Angle bracket codes (< and >) - never decode these to prevent tag bypass
100
+ var LT_CODE = 60;
101
+ var GT_CODE = 62;
102
+ // Maximum sanitization iterations to prevent infinite loops
103
+ var MAX_ITERATIONS = 10;
104
+ // Regular expressions (compiled once for performance)
105
+ var rx = {
106
+ tags: new RegExp("<(".concat(DANGEROUS_TAGS, ")\\b[\\s\\S]*?>([\\s\\S]*?<\\/(").concat(DANGEROUS_TAGS, ")\\s*>)?"), "gi"),
107
+ htmlEntity: /&#x([0-9a-f]+);?|&#([0-9]+);?|&([a-z]+);/gi,
108
+ // eslint-disable-next-line no-control-regex
109
+ controlChar: /[\x00-\x1F\x7F]/g,
110
+ eventHandler: /\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)|on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)/gi,
111
+ dangerousUri: /(href|src|action|xlink:href)\s*=\s*(['"`]?)([^'"`>\s]*)\2/gi,
112
+ dangerousProtocol: /^(javascript|data|vbscript):/
113
+ };
114
+ return {
115
+ ENTITY_MAP: ENTITY_MAP,
116
+ LT_CODE: LT_CODE,
117
+ GT_CODE: GT_CODE,
118
+ MAX_ITERATIONS: MAX_ITERATIONS,
119
+ rx: rx,
120
+ /**
121
+ * Decode HTML entities to prevent bypass attacks
122
+ * @param {string} str String with potential HTML entities
123
+ * @returns {string} Decoded string
124
+ */
125
+ decodeEntities: function (str) {
126
+ return str.replace(rx.htmlEntity, function (match, hex, dec, named) {
127
+ var code = hex ?
128
+ parseInt(hex, 16) :
129
+ dec ?
130
+ parseInt(dec, 10) :
131
+ named ?
132
+ ENTITY_MAP[named.toLowerCase()] || 0 :
133
+ 0;
134
+ // Never decode angle brackets to prevent tag bypass
135
+ return code && code !== LT_CODE && code !== GT_CODE ?
136
+ String.fromCharCode(code) :
137
+ match;
138
+ });
139
+ },
140
+ /**
141
+ * Remove dangerous URI protocols from attribute values
142
+ * @param {string} str String to sanitize
143
+ * @returns {string} Sanitized string
144
+ */
145
+ removeDangerousUris: function (str) {
146
+ return str.replace(rx.dangerousUri, function (match, attr, quote, value) {
147
+ var normalized = value.toLowerCase().replace(/\s/g, "");
148
+ return rx.dangerousProtocol.test(normalized) ? "".concat(attr, "=").concat(quote).concat(quote) : match;
149
+ });
150
+ }
151
+ };
152
+ })();
78
153
  var isString = function (v) { return typeof v === "string"; };
79
154
  var isNumber = function (v) { return typeof v === "number"; };
80
155
  var isDefined = function (v) { return typeof v !== "undefined"; };
81
156
  var isObjectType = function (v) { return typeof v === "object"; };
82
- // Sanitize patterns (blacklist approach with repeated application)
83
- var DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
84
- var sanitizeRx = {
85
- tags: new RegExp("<(".concat(DANGEROUS_TAGS, ")\\b[\\s\\S]*?>([\\s\\S]*?<\\/(").concat(DANGEROUS_TAGS, ")\\s*>)?"), "gi"),
86
- // Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
87
- eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
88
- // Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
89
- dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
90
- };
91
157
  /**
92
158
  * Sanitize HTML string to prevent XSS attacks
93
159
  * Uses blacklist approach with repeated application to prevent nested tag bypass
160
+ * Handles encoded characters (HTML entities, Unicode escapes) to prevent bypass attacks
94
161
  * @param {string} str Target string value
95
162
  * @returns {string} Sanitized string with dangerous elements removed
96
163
  * @private
97
164
  */
98
165
  function sanitize(str) {
166
+ // Early return for non-string, empty string, or string without HTML
99
167
  if (!isString(str) || !str || str.indexOf("<") === -1) {
100
168
  return str;
101
169
  }
102
170
  var result = str;
103
171
  var prev;
172
+ var iterations = 0;
104
173
  // Repeat until no more changes (prevents nested tag attacks like <scri<script>pt>)
105
174
  do {
106
175
  prev = result;
107
- result = result
108
- .replace(sanitizeRx.tags, "")
109
- .replace(sanitizeRx.eventHandlers, "")
110
- .replace(sanitizeRx.dangerousURIs, "$1=\"\"");
176
+ // 1. Decode HTML entities to prevent bypass (e.g., jav&#x0A;ascript:)
177
+ // 2. Remove control characters (NULL, tab, newline, etc.)
178
+ // 3. Remove dangerous tags (script, iframe, etc.)
179
+ result = _sanitize.decodeEntities(result)
180
+ .replace(_sanitize.rx.controlChar, "")
181
+ .replace(_sanitize.rx.tags, "")
182
+ .replace(_sanitize.rx.eventHandler, ""); // 4. Remove event handlers
183
+ // 5. Remove dangerous URIs (javascript:, data:, vbscript:)
184
+ result = _sanitize.removeDangerousUris(result);
185
+ // Safety check to prevent infinite loops
186
+ if (++iterations >= _sanitize.MAX_ITERATIONS) {
187
+ break;
188
+ }
111
189
  } while (result !== prev);
112
190
  return result;
113
191
  }
@@ -250,7 +328,7 @@ var Plugin = /** @class */ (function () {
250
328
  delete _this[key];
251
329
  });
252
330
  };
253
- Plugin.version = "3.17.4";
331
+ Plugin.version = "3.18.0-next.2";
254
332
  return Plugin;
255
333
  }());
256
334
 
@@ -315,7 +393,7 @@ var Options = /** @class */ (function () {
315
393
  * Set category text format function.
316
394
  * @name categoryFormat
317
395
  * @memberof plugin-tableview
318
- * @type {Function}
396
+ * @type {function}
319
397
  * @returns {string}
320
398
  * @default function(v) { // will return formatted value according x Axis type }}
321
399
  * @example
@@ -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.4
8
+ * @version 3.18.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -204,7 +204,7 @@ var Plugin = /** @class */ (function () {
204
204
  delete _this[key];
205
205
  });
206
206
  };
207
- Plugin.version = "3.17.4";
207
+ Plugin.version = "3.18.0-next.2";
208
208
  return Plugin;
209
209
  }());
210
210
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.17.4",
3
+ "version": "3.18.0-next.2",
4
4
  "description": "Re-usable easy interface JavaScript chart library, based on D3 v4+",
5
5
  "homepage": "https://naver.github.io/billboard.js/",
6
6
  "main": "dist/billboard.js",
@@ -102,67 +102,68 @@
102
102
  "d3-zoom": "^3.0.0"
103
103
  },
104
104
  "devDependencies": {
105
- "@commitlint/cli": "^19.8.1",
106
- "@commitlint/config-conventional": "^19.8.1",
107
- "@eslint/js": "^9.35.0",
108
- "@rollup/plugin-node-resolve": "^16.0.1",
109
- "@rollup/plugin-replace": "^6.0.2",
110
- "@rollup/plugin-typescript": "^12.1.4",
105
+ "@commitlint/cli": "^20.3.1",
106
+ "@commitlint/config-conventional": "^20.3.1",
107
+ "@eslint/js": "^9.39.2",
108
+ "@rollup/plugin-node-resolve": "^16.0.3",
109
+ "@rollup/plugin-replace": "^6.0.3",
110
+ "@rollup/plugin-typescript": "^12.3.0",
111
111
  "@semantic-release/changelog": "^6.0.3",
112
112
  "@semantic-release/commit-analyzer": "^13.0.1",
113
113
  "@semantic-release/exec": "^7.1.0",
114
114
  "@semantic-release/git": "^10.0.1",
115
- "@semantic-release/npm": "^12.0.2",
115
+ "@semantic-release/npm": "^13.1.3",
116
116
  "@semantic-release/release-notes-generator": "^14.1.0",
117
117
  "@testing-library/dom": "^10.4.1",
118
- "@testing-library/react": "^16.3.0",
118
+ "@testing-library/react": "^16.3.1",
119
119
  "@types/d3": "^7.4.3",
120
- "@types/sinon": "^17.0.4",
121
- "@vitest/browser": "^3.2.4",
122
- "@vitest/coverage-istanbul": "^3.2.4",
123
- "@vitest/ui": "^3.2.4",
120
+ "@types/sinon": "^21.0.0",
121
+ "@vitest/browser": "^4.0.17",
122
+ "@vitest/browser-playwright": "^4.0.17",
123
+ "@vitest/coverage-istanbul": "^4.0.17",
124
+ "@vitest/ui": "^4.0.17",
124
125
  "better-docs": "^2.7.3",
125
126
  "clean-webpack-plugin": "^4.0.0",
126
127
  "cloc": "2.6.0-cloc",
127
- "core-js": "^3.45.1",
128
+ "core-js": "^3.47.0",
128
129
  "coveralls": "^3.1.1",
129
- "cross-env": "^10.0.0",
130
+ "cross-env": "^10.1.0",
130
131
  "css-loader": "^7.1.2",
131
132
  "d3-color": "^3.1.0",
132
133
  "d3-delaunay": "^6.0.4",
133
- "d3-format": "^3.1.0",
134
+ "d3-format": "^3.1.2",
134
135
  "d3-polygon": "^3.0.1",
135
136
  "docdash": "^2.0.2",
136
- "dprint": "^0.50.1",
137
- "esbuild-loader": "^4.3.0",
138
- "eslint": "^9.35.0",
137
+ "dprint": "^0.51.1",
138
+ "esbuild-loader": "^4.4.2",
139
+ "eslint": "^9.39.2",
139
140
  "eslint-plugin-import": "^2.32.0",
140
- "eslint-plugin-jsdoc": "^54.5.0",
141
+ "eslint-plugin-jsdoc": "^62.1.0",
141
142
  "husky": "^9.1.7",
142
- "jsdoc": "^4.0.4",
143
- "lint-staged": "^16.1.6",
144
- "mini-css-extract-plugin": "^2.9.4",
145
- "playwright": "^1.55.0",
143
+ "jsdoc": "^4.0.5",
144
+ "lint-staged": "^16.2.7",
145
+ "mini-css-extract-plugin": "^2.10.0",
146
+ "playwright": "^1.57.0",
146
147
  "regenerator-runtime": "^0.14.1",
147
- "rollup": "^4.50.1",
148
- "rollup-plugin-delete": "^3.0.1",
149
- "sass": "^1.92.1",
150
- "sass-loader": "^16.0.5",
151
- "semantic-release": "^24.2.7",
148
+ "rollup": "^4.55.1",
149
+ "rollup-plugin-delete": "^3.0.2",
150
+ "sass": "^1.97.2",
151
+ "sass-loader": "^16.0.6",
152
+ "semantic-release": "^25.0.2",
152
153
  "simulant": "^0.2.2",
153
- "sinon": "^21.0.0",
154
- "string-replace-loader": "^3.2.0",
154
+ "sinon": "^21.0.1",
155
+ "string-replace-loader": "^3.3.0",
155
156
  "style-loader": "^4.0.0",
156
157
  "tslib": "^2.8.1",
157
- "typescript": "^5.9.2",
158
- "typescript-eslint": "^8.42.0",
159
- "vitest": "^3.2.4",
160
- "webpack": "^5.101.3",
161
- "webpack-bundle-analyzer": "^4.10.2",
158
+ "typescript": "^5.9.3",
159
+ "typescript-eslint": "^8.53.0",
160
+ "vitest": "^4.0.17",
161
+ "webpack": "^5.104.1",
162
+ "webpack-bundle-analyzer": "^5.1.1",
162
163
  "webpack-clean": "^1.2.5",
163
164
  "webpack-cli": "^6.0.1",
164
165
  "webpack-common-shake": "^2.1.0",
165
- "webpack-dev-server": "^5.2.2",
166
+ "webpack-dev-server": "^5.2.3",
166
167
  "webpack-merge": "^6.0.1",
167
168
  "webpackbar": "^7.0.0",
168
169
  "write-file-webpack-plugin": "^4.5.1"
@@ -42,7 +42,7 @@ import apiTooltip from "./api/tooltip";
42
42
  * @property {d3.selection} $.needle Needle element
43
43
  * - **NOTE:**
44
44
  * - The element will have `bb-needle` as class name.
45
- * - Will provide speical helper `.updateHelper(value: number, updateConfig: boolean)` method to facilitate needle position update.
45
+ * - Will provide special helper `.updateHelper(value: number, updateConfig: boolean)` method to facilitate needle position update.
46
46
  * @property {d3.selection} $.tooltip Tooltip element
47
47
  * @property {d3.selection} $.legend Legend element
48
48
  * @property {d3.selection} $.title Title element
@@ -38,7 +38,7 @@ export default {
38
38
 
39
39
  /**
40
40
  * Force to redraw.
41
- * - **NOTE:** When zoom/subchart is used, the zoomed state will be resetted.
41
+ * - **NOTE:** When zoom/subchart is used, the zoomed state will be reset.
42
42
  * @function flush
43
43
  * @instance
44
44
  * @memberof Chart
@@ -160,15 +160,15 @@ export default {
160
160
  * Get or set config option value.
161
161
  * - **NOTE**
162
162
  * - The option key name must be specified as the last level.
163
- * - when no argument is given, will return all specified generation options object only. (will exclude any other options not specified at the initialization)
163
+ * - When no argument is given, it will return all specified generation options object only. (will exclude any other options not specified at the initialization)
164
164
  * @function config
165
165
  * @instance
166
166
  * @memberof Chart
167
167
  * @param {string} name The option key name.
168
- * @param {*} [value] The value accepted for indicated option.
168
+ * @param {string|number|boolean|object|Array} [value] The value accepted for indicated option.
169
169
  * @param {boolean} [redraw] Set to redraw with the new option changes.
170
- * - **NOTE:** Doesn't guarantee work in all circumstances. It can be applied for limited options only.
171
- * @returns {*}
170
+ * - **NOTE:** Doesn't guarantee to work in all circumstances. It can be applied for limited options only.
171
+ * @returns {string|number|boolean|object|Array} The option value or all options object
172
172
  * @example
173
173
  *
174
174
  * // Getter
@@ -64,7 +64,7 @@ extend(data, {
64
64
  * @function data․values
65
65
  * @instance
66
66
  * @memberof Chart
67
- * @param {string|Array|null} targetIds This API returns the values of specified target. If this argument is not given, null will be retruned
67
+ * @param {string|Array|null} targetIds This API returns the values of specified target. If this argument is not given, null will be returned
68
68
  * @param {boolean} [flat=true] Get flatten values
69
69
  * @returns {Array} Data values
70
70
  * @example
@@ -119,6 +119,7 @@ extend(data, {
119
119
 
120
120
  /**
121
121
  * Get and set colors of the data loaded in the chart.
122
+ * - **NOTE:** If gradient option is set, the color update will affect only gradient stops have the same color.
122
123
  * @function data․colors
123
124
  * @instance
124
125
  * @memberof Chart
@@ -231,7 +231,7 @@ export default {
231
231
  * - Text element's position(especially "transformed") can't be preserved correctly according the page's layout condition.
232
232
  * - If need to preserve accurate text position, embed the web font data within to the page and set `preserveFontStyle=false`.
233
233
  * - Checkout the embed example: <a href="https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html">https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html</a>
234
- * @param {Function} [callback] The callback to be invoked when export is ready.
234
+ * @param {function(string): void} [callback] The callback to be invoked when export is ready.
235
235
  * @returns {string} dataURI
236
236
  * @example
237
237
  * chart.export();
@@ -30,7 +30,7 @@ export default {
30
30
  * - If json specified, keys is required as well as data.json.
31
31
  * - If tab isn't visible(by evaluating `document.hidden`), will not be executed to prevent unnecessary work.
32
32
  * @example
33
- * // 2 data points will be apprended to the tail and popped from the head.
33
+ * // 2 data points will be appended to the tail and popped from the head.
34
34
  * // After that, 4 data points will be appended and no data points will be poppoed.
35
35
  * chart.flow({
36
36
  * columns: [
@@ -32,7 +32,7 @@ export default {
32
32
  * | categories | Array | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. |
33
33
  * | classes | Object | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. |
34
34
  * | colors | Object | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. |
35
- * | data | Obejct | Data objects to be loaded. Checkout the example. |
35
+ * | data | Object | Data objects to be loaded. Checkout the example. |
36
36
  * | done | Function | The specified function will be called after data loaded.|
37
37
  * | headers | string | Set request header if loading via `data.url`.<br>@see [data․headers](Options.html#.data%25E2%2580%25A4headers) |
38
38
  * | keys | Object | Choose which JSON objects keys correspond to desired data.<br>**NOTE:** Only for JSON object given as array.<br>@see [data․keys](Options.html#.data%25E2%2580%25A4keys) |
@@ -91,7 +91,7 @@ export default {
91
91
  *
92
92
  * chart.load({
93
93
  * columns: [
94
- * // when existing chart has `x` value, should provide correponding 'x' value.
94
+ * // when existing chart has `x` value, should provide corresponding 'x' value.
95
95
  * // with 'append' option, the 'data1' will have `[36,30,24,37]`.
96
96
  * ["x", "2021-02-01T08:00:00"],
97
97
  * ["data1", 37]
@@ -199,7 +199,7 @@ export default {
199
199
  * | key | Type | Description |
200
200
  * | --- | --- | --- |
201
201
  * | ids | String &vert; Array | Target id data to be unloaded. If not given, all data will be unloaded. |
202
- * | done | Fuction | Callback after data is unloaded. |
202
+ * | done | Function | Callback after data is unloaded. |
203
203
  * | resizeAfter | boolean | Resize after the unload. Default value is `false`.<br>- This option won't call `onresize` neither `onresized`.<br>- When set to 'true', will call `.flush(true)` at the end of unload. |
204
204
  * @example
205
205
  * // Unload data2 and data3
@@ -13,7 +13,7 @@ import {extend, parseDate} from "../../module/util";
13
13
  * @function subchart
14
14
  * @instance
15
15
  * @memberof Chart
16
- * @param {Array} domainValue If domain range is given, the subchart will be seleted to the given domain. If no argument is given, the current subchart selection domain will be returned.
16
+ * @param {Array} domainValue If domain range is given, the subchart will be selected to the given domain. If no argument is given, the current subchart selection domain will be returned.
17
17
  * @returns {Array} domain value in array
18
18
  * @example
19
19
  * // Specify domain for subchart selection
@@ -23,7 +23,7 @@ import {extend, parseDate} from "../../module/util";
23
23
  * // Domain value may not be exact returning approximately values.
24
24
  * chart.subchart();
25
25
  */
26
- // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
26
+ // NOTE: declared function assigning to variable to prevent duplicated method generation in JSDoc.
27
27
  const subchart = function<T = TDomain[]>(domainValue?: T): T | undefined {
28
28
  const $$ = this.internal;
29
29
  const {axis, brush, config, scale: {x, subX}, state} = $$;
@@ -134,7 +134,7 @@ extend(subchart, {
134
134
  },
135
135
 
136
136
  /**
137
- * Toggle the visiblity of subchart
137
+ * Toggle the visibility of subchart
138
138
  * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
139
139
  * @function subchart․toggle
140
140
  * @instance
@@ -26,7 +26,7 @@ const tooltip = {
26
26
  *
27
27
  * @example
28
28
  * // show the 2nd x Axis coordinate tooltip
29
- * // for Arc(gauge, donut & pie) and radar type, approch showing tooltip by using "index" number.
29
+ * // for Arc(gauge, donut & pie) and radar type, approach showing tooltip by using "index" number.
30
30
  * chart.tooltip.show({
31
31
  * index: 1
32
32
  * });
@@ -32,7 +32,7 @@ import {extend, getMinMax, isDefined, isObject, parseDate} from "../../module/ut
32
32
  * // Domain value may not be exact returning approximately values.
33
33
  * chart.zoom();
34
34
  */
35
- // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
35
+ // NOTE: declared function assigning to variable to prevent duplicated method generation in JSDoc.
36
36
  const zoom = function<T = TDomainRange>(domainValue?: T): T | undefined {
37
37
  const $$ = this.internal;
38
38
  const {axis, config, org, scale, state} = $$;
@@ -356,7 +356,7 @@ class Axis {
356
356
  // Set tick
357
357
  axis.tickFormat(
358
358
  tickFormat || (
359
- !isX && ($$.isStackNormalized() && (x => `${x}%`))
359
+ !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(id) && (x => `${x}%`))
360
360
  )
361
361
  );
362
362
 
@@ -72,7 +72,7 @@ export default class AxisRendererHelper {
72
72
  /**
73
73
  * Get tick transform setter function
74
74
  * @param {string} id Axis id
75
- * @returns {Function} transfrom setter function
75
+ * @returns {(selection: d3Selection, scale) => void} transfrom setter function
76
76
  * @private
77
77
  */
78
78
  getTickTransformSetter(id: string): (selection: d3Selection, scale) => void {
@@ -423,7 +423,8 @@ export default class ChartInternal {
423
423
 
424
424
  $el.svg
425
425
  .on("click", onclick?.bind($$.api) || null)
426
- .on(isTouch ? "touchstart" : "mouseenter", onover?.bind($$.api) || null)
426
+ .on(isTouch ? "touchstart" : "mouseenter", onover?.bind($$.api) || null,
427
+ isTouch ? {passive: true} : undefined)
427
428
  .on(isTouch ? "touchend" : "mouseleave", onout?.bind($$.api) || null);
428
429
  }
429
430
 
@@ -439,7 +440,7 @@ export default class ChartInternal {
439
440
  $el.defs = $el.svg.append("defs");
440
441
 
441
442
  if (hasAxis) {
442
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach(v => {
443
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(v => {
443
444
  $$.appendClip($el.defs, state.clip[v]);
444
445
  });
445
446
  }
@@ -48,6 +48,9 @@ export interface IArcData {
48
48
  startAngle: number;
49
49
  endAngle: number;
50
50
  value: number | null;
51
+
52
+ /** Temporary cache for arc label optimization (used between textForArcLabel and redrawArcLabelLines) */
53
+ _cache?: {updated: IArcData, ratio: number, meetsThreshold: boolean};
51
54
  }
52
55
 
53
56
  export interface IBarData extends IDataRow {
@@ -152,7 +152,7 @@ function json(json, keysParam) {
152
152
  * @param {string} mimeType MIME type string: json | csv | tsv
153
153
  * @param {object} headers Header object
154
154
  * @param {object} keys Key object
155
- * @param {Function} done Callback function
155
+ * @param {function} done Callback function
156
156
  * @private
157
157
  */
158
158
  function url(url: string, mimeType = "csv", headers: object, keys: object, done: Function): void {