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.
- package/CONTRIBUTING.md +12 -12
- package/README.md +12 -12
- package/dist/billboard.css +15 -1
- package/dist/billboard.js +1146 -463
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +10 -10
- package/dist/billboard.pkgd.js +1147 -464
- package/dist/billboard.pkgd.min.js +21 -21
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +117 -26
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-stanford.js +119 -28
- package/dist/plugin/billboardjs-plugin-stanford.min.js +10 -10
- package/dist/plugin/billboardjs-plugin-tableview.js +117 -27
- package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +116 -26
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +117 -26
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +120 -29
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +117 -27
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -12
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +116 -26
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +10 -10
- package/dist/theme/dark.css +15 -1
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +15 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +15 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +15 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +15 -1
- package/dist/theme/modern.min.css +2 -2
- package/dist-esm/billboard.js +1467 -536
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +5 -4
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +94 -16
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +38 -37
- package/src/Chart/Chart.ts +1 -1
- package/src/Chart/api/chart.ts +5 -5
- package/src/Chart/api/data.ts +2 -1
- package/src/Chart/api/export.ts +1 -1
- package/src/Chart/api/flow.ts +1 -1
- package/src/Chart/api/load.ts +3 -3
- package/src/Chart/api/subchart.ts +3 -3
- package/src/Chart/api/tooltip.ts +1 -1
- package/src/Chart/api/zoom.ts +1 -1
- package/src/ChartInternal/Axis/Axis.ts +1 -1
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
- package/src/ChartInternal/ChartInternal.ts +3 -2
- package/src/ChartInternal/data/IData.ts +3 -0
- package/src/ChartInternal/data/convert.helper.ts +1 -1
- package/src/ChartInternal/data/convert.ts +9 -8
- package/src/ChartInternal/data/data.ts +135 -17
- package/src/ChartInternal/data/load.ts +8 -8
- package/src/ChartInternal/interactions/drag.ts +53 -42
- package/src/ChartInternal/interactions/eventrect.ts +15 -5
- package/src/ChartInternal/interactions/flow.ts +1 -1
- package/src/ChartInternal/interactions/interaction.ts +1 -1
- package/src/ChartInternal/interactions/zoom.ts +24 -20
- package/src/ChartInternal/internals/color.ts +27 -10
- package/src/ChartInternal/internals/domain.ts +22 -5
- package/src/ChartInternal/internals/format.ts +4 -4
- package/src/ChartInternal/internals/grid.ts +11 -11
- package/src/ChartInternal/internals/legend.ts +80 -19
- package/src/ChartInternal/internals/scale.ts +6 -6
- package/src/ChartInternal/internals/selection.ts +1 -1
- package/src/ChartInternal/internals/style.ts +3 -3
- package/src/ChartInternal/internals/text.arc.ts +304 -0
- package/src/ChartInternal/internals/text.ts +44 -14
- package/src/ChartInternal/internals/text.util.ts +19 -0
- package/src/ChartInternal/internals/title.ts +3 -3
- package/src/ChartInternal/internals/tooltip.ts +23 -15
- package/src/ChartInternal/shape/arc.ts +174 -71
- package/src/ChartInternal/shape/area.ts +2 -2
- package/src/ChartInternal/shape/bar.ts +7 -6
- package/src/ChartInternal/shape/candlestick.ts +3 -3
- package/src/ChartInternal/shape/funnel.ts +18 -18
- package/src/ChartInternal/shape/line.ts +9 -10
- package/src/ChartInternal/shape/point.common.ts +24 -6
- package/src/ChartInternal/shape/radar.ts +4 -4
- package/src/ChartInternal/shape/shape.ts +24 -6
- package/src/ChartInternal/shape/treemap.ts +19 -5
- package/src/Plugin/stanford/Options.ts +2 -2
- package/src/Plugin/tableview/Options.ts +1 -1
- package/src/config/Options/axis/axis.ts +7 -7
- package/src/config/Options/axis/x.ts +6 -6
- package/src/config/Options/axis/y.ts +4 -4
- package/src/config/Options/axis/y2.ts +16 -3
- package/src/config/Options/common/color.ts +2 -2
- package/src/config/Options/common/legend.ts +6 -5
- package/src/config/Options/common/main.ts +23 -23
- package/src/config/Options/common/point.ts +4 -3
- package/src/config/Options/common/tooltip.ts +14 -13
- package/src/config/Options/data/axis.ts +31 -6
- package/src/config/Options/data/data.ts +44 -44
- package/src/config/Options/data/selection.ts +4 -4
- package/src/config/Options/interaction/interaction.ts +2 -1
- package/src/config/Options/interaction/subchart.ts +2 -2
- package/src/config/Options/interaction/zoom.ts +4 -4
- package/src/config/Options/shape/arc.ts +4 -4
- package/src/config/Options/shape/area.ts +1 -1
- package/src/config/Options/shape/bar.ts +4 -4
- package/src/config/Options/shape/bubble.ts +2 -2
- package/src/config/Options/shape/candlestick.ts +1 -1
- package/src/config/Options/shape/donut.ts +34 -3
- package/src/config/Options/shape/gauge.ts +36 -4
- package/src/config/Options/shape/line.ts +1 -1
- package/src/config/Options/shape/pie.ts +34 -3
- package/src/config/Options/shape/polar.ts +35 -4
- package/src/config/Options/shape/radar.ts +1 -1
- package/src/config/Options/shape/scatter.ts +1 -1
- package/src/config/Options/shape/treemap.ts +31 -5
- package/src/config/Store/State.ts +11 -1
- package/src/config/classes.ts +1 -0
- package/src/core.ts +1 -1
- package/src/module/Cache.ts +29 -4
- package/src/module/generator.ts +1 -1
- package/src/module/util.ts +308 -117
- package/src/module/worker.ts +3 -3
- package/src/scss/billboard.scss +15 -0
- package/src/scss/theme/dark.scss +15 -0
- package/src/scss/theme/datalab.scss +15 -0
- package/src/scss/theme/graph.scss +15 -0
- package/src/scss/theme/insight.scss +15 -0
- package/src/scss/theme/modern.scss +15 -0
- package/types/axis.d.ts +3 -3
- package/types/chart.d.ts +4 -4
- package/types/options.d.ts +22 -9
- 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.
|
|
8
|
+
* @version 3.18.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -29166,7 +29166,83 @@ var __spreadValues = (a, b) => {
|
|
|
29166
29166
|
|
|
29167
29167
|
|
|
29168
29168
|
|
|
29169
|
-
|
|
29169
|
+
function _getRect(relativeViewport, node, forceEval = false) {
|
|
29170
|
+
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
29171
|
+
if (forceEval) {
|
|
29172
|
+
return _(node);
|
|
29173
|
+
} else {
|
|
29174
|
+
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
|
|
29175
|
+
return needEvaluate ? node.rect = _(node) : node.rect;
|
|
29176
|
+
}
|
|
29177
|
+
}
|
|
29178
|
+
function _forEachValidItem(items, callback) {
|
|
29179
|
+
for (let i = 0; i < items.length; i++) {
|
|
29180
|
+
const item = items[i];
|
|
29181
|
+
if (item) {
|
|
29182
|
+
callback(item, i);
|
|
29183
|
+
}
|
|
29184
|
+
}
|
|
29185
|
+
}
|
|
29186
|
+
const _sanitize = (() => {
|
|
29187
|
+
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
29188
|
+
const ENTITY_MAP = {
|
|
29189
|
+
quot: 34,
|
|
29190
|
+
amp: 38,
|
|
29191
|
+
apos: 39,
|
|
29192
|
+
lt: 60,
|
|
29193
|
+
gt: 62,
|
|
29194
|
+
nbsp: 160,
|
|
29195
|
+
iexcl: 161,
|
|
29196
|
+
cent: 162,
|
|
29197
|
+
pound: 163,
|
|
29198
|
+
curren: 164,
|
|
29199
|
+
yen: 165
|
|
29200
|
+
};
|
|
29201
|
+
const LT_CODE = 60;
|
|
29202
|
+
const GT_CODE = 62;
|
|
29203
|
+
const MAX_ITERATIONS = 10;
|
|
29204
|
+
const rx = {
|
|
29205
|
+
tags: new RegExp(
|
|
29206
|
+
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
29207
|
+
"gi"
|
|
29208
|
+
),
|
|
29209
|
+
htmlEntity: /&#x([0-9a-f]+);?|&#([0-9]+);?|&([a-z]+);/gi,
|
|
29210
|
+
// eslint-disable-next-line no-control-regex
|
|
29211
|
+
controlChar: /[\x00-\x1F\x7F]/g,
|
|
29212
|
+
eventHandler: /\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)|on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)/gi,
|
|
29213
|
+
dangerousUri: /(href|src|action|xlink:href)\s*=\s*(['"`]?)([^'"`>\s]*)\2/gi,
|
|
29214
|
+
dangerousProtocol: /^(javascript|data|vbscript):/
|
|
29215
|
+
};
|
|
29216
|
+
return {
|
|
29217
|
+
ENTITY_MAP,
|
|
29218
|
+
LT_CODE,
|
|
29219
|
+
GT_CODE,
|
|
29220
|
+
MAX_ITERATIONS,
|
|
29221
|
+
rx,
|
|
29222
|
+
/**
|
|
29223
|
+
* Decode HTML entities to prevent bypass attacks
|
|
29224
|
+
* @param {string} str String with potential HTML entities
|
|
29225
|
+
* @returns {string} Decoded string
|
|
29226
|
+
*/
|
|
29227
|
+
decodeEntities(str) {
|
|
29228
|
+
return str.replace(rx.htmlEntity, (match, hex, dec, named) => {
|
|
29229
|
+
const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : named ? ENTITY_MAP[named.toLowerCase()] || 0 : 0;
|
|
29230
|
+
return code && code !== LT_CODE && code !== GT_CODE ? String.fromCharCode(code) : match;
|
|
29231
|
+
});
|
|
29232
|
+
},
|
|
29233
|
+
/**
|
|
29234
|
+
* Remove dangerous URI protocols from attribute values
|
|
29235
|
+
* @param {string} str String to sanitize
|
|
29236
|
+
* @returns {string} Sanitized string
|
|
29237
|
+
*/
|
|
29238
|
+
removeDangerousUris(str) {
|
|
29239
|
+
return str.replace(rx.dangerousUri, (match, attr, quote, value) => {
|
|
29240
|
+
const normalized = value.toLowerCase().replace(/\s/g, "");
|
|
29241
|
+
return rx.dangerousProtocol.test(normalized) ? `${attr}=${quote}${quote}` : match;
|
|
29242
|
+
});
|
|
29243
|
+
}
|
|
29244
|
+
};
|
|
29245
|
+
})();
|
|
29170
29246
|
const isValue = (v) => v || v === 0;
|
|
29171
29247
|
const isFunction = (v) => typeof v === "function";
|
|
29172
29248
|
const isString = (v) => typeof v === "string";
|
|
@@ -29213,26 +29289,20 @@ function endall(transition, cb) {
|
|
|
29213
29289
|
transition.call(end);
|
|
29214
29290
|
}
|
|
29215
29291
|
}
|
|
29216
|
-
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
29217
|
-
const sanitizeRx = {
|
|
29218
|
-
tags: new RegExp(
|
|
29219
|
-
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
29220
|
-
"gi"
|
|
29221
|
-
),
|
|
29222
|
-
// Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
|
|
29223
|
-
eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
|
|
29224
|
-
// Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
|
|
29225
|
-
dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
|
|
29226
|
-
};
|
|
29227
29292
|
function sanitize(str) {
|
|
29228
29293
|
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
29229
29294
|
return str;
|
|
29230
29295
|
}
|
|
29231
29296
|
let result = str;
|
|
29232
29297
|
let prev;
|
|
29298
|
+
let iterations = 0;
|
|
29233
29299
|
do {
|
|
29234
29300
|
prev = result;
|
|
29235
|
-
result = result.replace(
|
|
29301
|
+
result = _sanitize.decodeEntities(result).replace(_sanitize.rx.controlChar, "").replace(_sanitize.rx.tags, "").replace(_sanitize.rx.eventHandler, "");
|
|
29302
|
+
result = _sanitize.removeDangerousUris(result);
|
|
29303
|
+
if (++iterations >= _sanitize.MAX_ITERATIONS) {
|
|
29304
|
+
break;
|
|
29305
|
+
}
|
|
29236
29306
|
} while (result !== prev);
|
|
29237
29307
|
return result;
|
|
29238
29308
|
}
|
|
@@ -29300,20 +29370,11 @@ function getBrushSelection(ctx) {
|
|
|
29300
29370
|
}
|
|
29301
29371
|
return selection;
|
|
29302
29372
|
}
|
|
29303
|
-
function getRect(relativeViewport, node, forceEval = false) {
|
|
29304
|
-
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
29305
|
-
if (forceEval) {
|
|
29306
|
-
return _(node);
|
|
29307
|
-
} else {
|
|
29308
|
-
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
|
|
29309
|
-
return needEvaluate ? node.rect = _(node) : node.rect;
|
|
29310
|
-
}
|
|
29311
|
-
}
|
|
29312
29373
|
function getBoundingRect(node, forceEval = false) {
|
|
29313
|
-
return
|
|
29374
|
+
return _getRect(true, node, forceEval);
|
|
29314
29375
|
}
|
|
29315
29376
|
function getBBox(node, forceEval = false) {
|
|
29316
|
-
return
|
|
29377
|
+
return _getRect(false, node, forceEval);
|
|
29317
29378
|
}
|
|
29318
29379
|
function getRandom(asStr = true, min = 0, max = 1e4) {
|
|
29319
29380
|
const crpt = win.crypto || win.msCrypto;
|
|
@@ -29625,6 +29686,35 @@ function parseShorthand(value) {
|
|
|
29625
29686
|
const [a, b = a, c = a, d = b] = values;
|
|
29626
29687
|
return { top: a, right: b, bottom: c, left: d };
|
|
29627
29688
|
}
|
|
29689
|
+
function scheduleRAFUpdate(rafState, callback) {
|
|
29690
|
+
if (rafState.pendingRaf !== null) {
|
|
29691
|
+
win.cancelAnimationFrame(rafState.pendingRaf);
|
|
29692
|
+
rafState.pendingRaf = win.requestAnimationFrame(() => {
|
|
29693
|
+
rafState.pendingRaf = null;
|
|
29694
|
+
callback();
|
|
29695
|
+
});
|
|
29696
|
+
} else {
|
|
29697
|
+
rafState.pendingRaf = win.requestAnimationFrame(() => {
|
|
29698
|
+
rafState.pendingRaf = null;
|
|
29699
|
+
});
|
|
29700
|
+
callback();
|
|
29701
|
+
}
|
|
29702
|
+
}
|
|
29703
|
+
function toSet(items, keyFn = ((item) => item)) {
|
|
29704
|
+
const set = /* @__PURE__ */ new Set();
|
|
29705
|
+
_forEachValidItem(items, (item, i) => {
|
|
29706
|
+
set.add(keyFn(item, i));
|
|
29707
|
+
});
|
|
29708
|
+
return set;
|
|
29709
|
+
}
|
|
29710
|
+
function toMap(items, keyFn, valueFn = ((item) => item)) {
|
|
29711
|
+
const map = /* @__PURE__ */ new Map();
|
|
29712
|
+
_forEachValidItem(items, (item, i) => {
|
|
29713
|
+
map.set(keyFn(item, i), valueFn(item, i));
|
|
29714
|
+
});
|
|
29715
|
+
return map;
|
|
29716
|
+
}
|
|
29717
|
+
|
|
29628
29718
|
|
|
29629
29719
|
;// ./src/config/config.ts
|
|
29630
29720
|
|
|
@@ -29706,7 +29796,7 @@ class Plugin {
|
|
|
29706
29796
|
});
|
|
29707
29797
|
}
|
|
29708
29798
|
}
|
|
29709
|
-
__publicField(Plugin, "version", "3.
|
|
29799
|
+
__publicField(Plugin, "version", "3.18.0-next.2");
|
|
29710
29800
|
|
|
29711
29801
|
;// ./src/Plugin/textoverlap/Options.ts
|
|
29712
29802
|
class Options {
|