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
|
*/
|
|
@@ -135,7 +135,7 @@ class Plugin {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
__publicField(Plugin, "version", "3.
|
|
138
|
+
__publicField(Plugin, "version", "3.18.0-next.2");
|
|
139
139
|
|
|
140
140
|
;// ./src/Plugin/bubblecompare/index.ts
|
|
141
141
|
var bubblecompare_defProp = Object.defineProperty;
|
|
@@ -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
|
-
*/(function(n,i){typeof exports=="object"&&typeof module=="object"?module.exports=i(require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-selection"],i):typeof exports=="object"?exports.bb=i(require("d3-selection")):(n.bb=n.bb||{},n.bb.plugin=n.bb.plugin||{},n.bb.plugin.bubblecompare=i(n.d3))})(this,function(p){return(function(){"use strict";var n={747:(function(r){r.exports=p})},i={};function s(r){var e=i[r];if(e!==void 0)return e.exports;var t=i[r]={exports:{}};return n[r](t,t.exports,s),t.exports}(function(){s.d=function(r,e){for(var t in e)s.o(e,t)&&!s.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})}})(),(function(){s.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}})();var b={};s.d(b,{default:function(){return R}});var $=s(747),g=Object.defineProperty,
|
|
11
|
+
*/(function(n,i){typeof exports=="object"&&typeof module=="object"?module.exports=i(require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-selection"],i):typeof exports=="object"?exports.bb=i(require("d3-selection")):(n.bb=n.bb||{},n.bb.plugin=n.bb.plugin||{},n.bb.plugin.bubblecompare=i(n.d3))})(this,function(p){return(function(){"use strict";var n={747:(function(r){r.exports=p})},i={};function s(r){var e=i[r];if(e!==void 0)return e.exports;var t=i[r]={exports:{}};return n[r](t,t.exports,s),t.exports}(function(){s.d=function(r,e){for(var t in e)s.o(e,t)&&!s.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})}})(),(function(){s.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}})();var b={};s.d(b,{default:function(){return R}});var $=s(747),g=Object.defineProperty,x=(r,e,t)=>e in r?g(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l=(r,e,t)=>x(r,typeof e!="symbol"?e+"":e,t);class d{constructor(e={}){l(this,"$$"),l(this,"options"),this.options=e}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(e=>{this[e]=null,delete this[e]})}}l(d,"version","3.18.0-next.2");var v=Object.defineProperty,B=(r,e,t)=>e in r?v(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_=(r,e,t)=>B(r,typeof e!="symbol"?e+"":e,t);const f=class m extends d{constructor(e){return super(e),_(this,"$$"),this}$init(){const{$$:e}=this;e.findClosest=this.findClosest.bind(this),e.getBubbleR=this.getBubbleR.bind(this),e.pointExpandedR=this.pointExpandedR.bind(this)}pointExpandedR(e){const t=this.getBubbleR(e),{expandScale:a=1}=this.options;return m.raiseFocusedBubbleLayer(e),this.changeCursorPoint(),t*a}static raiseFocusedBubbleLayer(e){e.raise&&(0,$.select)(e.node().parentNode.parentNode).raise()}changeCursorPoint(){this.$$.$el.eventRect.style("cursor","pointer")}findClosest(e,t){const{$$:a}=this;return e.filter(o=>o&&!a.isBarType(o.id)).reduce((o,u)=>a.dist(u,t)<this.getBubbleR(u)?u:o,0)}getBubbleR(e){const{minR:t,maxR:a}=this.options,o=this.getZData(e);if(!o)return t;const[u,c]=this.$$.data.targets.reduce(([w,C],j)=>{const h=this.getZData(j.values[0]);return[Math.min(w,h),Math.max(C,h)]},[1e4,0]),P=u>0&&c===u?0:o/c;return Math.abs(P)*(a-t)+t}getZData(e){return this.$$.isBubbleZType(e)?this.$$.getBubbleZData(e.value,"z"):e.value}};_(f,"version","0.0.1");let R=f;return b=b.default,b})()});
|
|
@@ -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
|
*/
|
|
@@ -119,6 +119,7 @@ const $COMMON = {
|
|
|
119
119
|
const $ARC = {
|
|
120
120
|
arc: "bb-arc",
|
|
121
121
|
arcLabelLine: "bb-arc-label-line",
|
|
122
|
+
arcLabelLineText: "bb-arc-label-line-text",
|
|
122
123
|
arcRange: "bb-arc-range",
|
|
123
124
|
arcs: "bb-arcs",
|
|
124
125
|
chartArc: "bb-chart-arc",
|
|
@@ -327,7 +328,83 @@ var util_spreadValues = (a, b) => {
|
|
|
327
328
|
|
|
328
329
|
|
|
329
330
|
|
|
330
|
-
|
|
331
|
+
function _getRect(relativeViewport, node, forceEval = false) {
|
|
332
|
+
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
333
|
+
if (forceEval) {
|
|
334
|
+
return _(node);
|
|
335
|
+
} else {
|
|
336
|
+
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
|
|
337
|
+
return needEvaluate ? node.rect = _(node) : node.rect;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
function _forEachValidItem(items, callback) {
|
|
341
|
+
for (let i = 0; i < items.length; i++) {
|
|
342
|
+
const item = items[i];
|
|
343
|
+
if (item) {
|
|
344
|
+
callback(item, i);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
const _sanitize = (() => {
|
|
349
|
+
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
350
|
+
const ENTITY_MAP = {
|
|
351
|
+
quot: 34,
|
|
352
|
+
amp: 38,
|
|
353
|
+
apos: 39,
|
|
354
|
+
lt: 60,
|
|
355
|
+
gt: 62,
|
|
356
|
+
nbsp: 160,
|
|
357
|
+
iexcl: 161,
|
|
358
|
+
cent: 162,
|
|
359
|
+
pound: 163,
|
|
360
|
+
curren: 164,
|
|
361
|
+
yen: 165
|
|
362
|
+
};
|
|
363
|
+
const LT_CODE = 60;
|
|
364
|
+
const GT_CODE = 62;
|
|
365
|
+
const MAX_ITERATIONS = 10;
|
|
366
|
+
const rx = {
|
|
367
|
+
tags: new RegExp(
|
|
368
|
+
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
369
|
+
"gi"
|
|
370
|
+
),
|
|
371
|
+
htmlEntity: /&#x([0-9a-f]+);?|&#([0-9]+);?|&([a-z]+);/gi,
|
|
372
|
+
// eslint-disable-next-line no-control-regex
|
|
373
|
+
controlChar: /[\x00-\x1F\x7F]/g,
|
|
374
|
+
eventHandler: /\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)|on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)/gi,
|
|
375
|
+
dangerousUri: /(href|src|action|xlink:href)\s*=\s*(['"`]?)([^'"`>\s]*)\2/gi,
|
|
376
|
+
dangerousProtocol: /^(javascript|data|vbscript):/
|
|
377
|
+
};
|
|
378
|
+
return {
|
|
379
|
+
ENTITY_MAP,
|
|
380
|
+
LT_CODE,
|
|
381
|
+
GT_CODE,
|
|
382
|
+
MAX_ITERATIONS,
|
|
383
|
+
rx,
|
|
384
|
+
/**
|
|
385
|
+
* Decode HTML entities to prevent bypass attacks
|
|
386
|
+
* @param {string} str String with potential HTML entities
|
|
387
|
+
* @returns {string} Decoded string
|
|
388
|
+
*/
|
|
389
|
+
decodeEntities(str) {
|
|
390
|
+
return str.replace(rx.htmlEntity, (match, hex, dec, named) => {
|
|
391
|
+
const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : named ? ENTITY_MAP[named.toLowerCase()] || 0 : 0;
|
|
392
|
+
return code && code !== LT_CODE && code !== GT_CODE ? String.fromCharCode(code) : match;
|
|
393
|
+
});
|
|
394
|
+
},
|
|
395
|
+
/**
|
|
396
|
+
* Remove dangerous URI protocols from attribute values
|
|
397
|
+
* @param {string} str String to sanitize
|
|
398
|
+
* @returns {string} Sanitized string
|
|
399
|
+
*/
|
|
400
|
+
removeDangerousUris(str) {
|
|
401
|
+
return str.replace(rx.dangerousUri, (match, attr, quote, value) => {
|
|
402
|
+
const normalized = value.toLowerCase().replace(/\s/g, "");
|
|
403
|
+
return rx.dangerousProtocol.test(normalized) ? `${attr}=${quote}${quote}` : match;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
})();
|
|
331
408
|
const isValue = (v) => v || v === 0;
|
|
332
409
|
const isFunction = (v) => typeof v === "function";
|
|
333
410
|
const isString = (v) => typeof v === "string";
|
|
@@ -374,26 +451,20 @@ function endall(transition, cb) {
|
|
|
374
451
|
transition.call(end);
|
|
375
452
|
}
|
|
376
453
|
}
|
|
377
|
-
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
378
|
-
const sanitizeRx = {
|
|
379
|
-
tags: new RegExp(
|
|
380
|
-
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
381
|
-
"gi"
|
|
382
|
-
),
|
|
383
|
-
// Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
|
|
384
|
-
eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
|
|
385
|
-
// Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
|
|
386
|
-
dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
|
|
387
|
-
};
|
|
388
454
|
function sanitize(str) {
|
|
389
455
|
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
390
456
|
return str;
|
|
391
457
|
}
|
|
392
458
|
let result = str;
|
|
393
459
|
let prev;
|
|
460
|
+
let iterations = 0;
|
|
394
461
|
do {
|
|
395
462
|
prev = result;
|
|
396
|
-
result = result.replace(
|
|
463
|
+
result = _sanitize.decodeEntities(result).replace(_sanitize.rx.controlChar, "").replace(_sanitize.rx.tags, "").replace(_sanitize.rx.eventHandler, "");
|
|
464
|
+
result = _sanitize.removeDangerousUris(result);
|
|
465
|
+
if (++iterations >= _sanitize.MAX_ITERATIONS) {
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
397
468
|
} while (result !== prev);
|
|
398
469
|
return result;
|
|
399
470
|
}
|
|
@@ -461,20 +532,11 @@ function getBrushSelection(ctx) {
|
|
|
461
532
|
}
|
|
462
533
|
return selection;
|
|
463
534
|
}
|
|
464
|
-
function getRect(relativeViewport, node, forceEval = false) {
|
|
465
|
-
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
466
|
-
if (forceEval) {
|
|
467
|
-
return _(node);
|
|
468
|
-
} else {
|
|
469
|
-
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
|
|
470
|
-
return needEvaluate ? node.rect = _(node) : node.rect;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
535
|
function getBoundingRect(node, forceEval = false) {
|
|
474
|
-
return
|
|
536
|
+
return _getRect(true, node, forceEval);
|
|
475
537
|
}
|
|
476
538
|
function getBBox(node, forceEval = false) {
|
|
477
|
-
return
|
|
539
|
+
return _getRect(false, node, forceEval);
|
|
478
540
|
}
|
|
479
541
|
function getRandom(asStr = true, min = 0, max = 1e4) {
|
|
480
542
|
const crpt = win.crypto || win.msCrypto;
|
|
@@ -786,6 +848,35 @@ function parseShorthand(value) {
|
|
|
786
848
|
const [a, b = a, c = a, d = b] = values;
|
|
787
849
|
return { top: a, right: b, bottom: c, left: d };
|
|
788
850
|
}
|
|
851
|
+
function scheduleRAFUpdate(rafState, callback) {
|
|
852
|
+
if (rafState.pendingRaf !== null) {
|
|
853
|
+
win.cancelAnimationFrame(rafState.pendingRaf);
|
|
854
|
+
rafState.pendingRaf = win.requestAnimationFrame(() => {
|
|
855
|
+
rafState.pendingRaf = null;
|
|
856
|
+
callback();
|
|
857
|
+
});
|
|
858
|
+
} else {
|
|
859
|
+
rafState.pendingRaf = win.requestAnimationFrame(() => {
|
|
860
|
+
rafState.pendingRaf = null;
|
|
861
|
+
});
|
|
862
|
+
callback();
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
function toSet(items, keyFn = ((item) => item)) {
|
|
866
|
+
const set = /* @__PURE__ */ new Set();
|
|
867
|
+
_forEachValidItem(items, (item, i) => {
|
|
868
|
+
set.add(keyFn(item, i));
|
|
869
|
+
});
|
|
870
|
+
return set;
|
|
871
|
+
}
|
|
872
|
+
function toMap(items, keyFn, valueFn = ((item) => item)) {
|
|
873
|
+
const map = /* @__PURE__ */ new Map();
|
|
874
|
+
_forEachValidItem(items, (item, i) => {
|
|
875
|
+
map.set(keyFn(item, i), valueFn(item, i));
|
|
876
|
+
});
|
|
877
|
+
return map;
|
|
878
|
+
}
|
|
879
|
+
|
|
789
880
|
|
|
790
881
|
;// ./src/config/config.ts
|
|
791
882
|
|
|
@@ -867,7 +958,7 @@ class Plugin {
|
|
|
867
958
|
});
|
|
868
959
|
}
|
|
869
960
|
}
|
|
870
|
-
__publicField(Plugin, "version", "3.
|
|
961
|
+
__publicField(Plugin, "version", "3.18.0-next.2");
|
|
871
962
|
|
|
872
963
|
;// ./src/Plugin/sparkline/Options.ts
|
|
873
964
|
class Options {
|
|
@@ -5,9 +5,9 @@
|
|
|
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
|
-
*/(function(
|
|
12
|
-
`)===-1)e.text(t);else{const
|
|
13
|
-
`),o=r?i.length-1:1;e.html(""),i.forEach((l,a)=>{e.append("tspan").attr("x",0).attr("dy",`${a===0?n[0]*o:n[1]}em`).text(l)})}}}function Ae(e){const{x:t,y:n,width:r,height:s}=e.getBBox();return[{x:t,y:n+s},{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+s}]}function rt(e){const{width:t,height:n}=F(e),r=Ae(e),s=r[0].x,i=Math.min(r[0].y,r[1].y);return{x:s,y:i,width:t,height:n}}function st(e,t){var n;const r=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let s=[0,0];try{s=d3Pointer(r||e,t)}catch(i){}return s.map(i=>isNaN(i)?0:i)}function Ce(e){const{event:t,$el:n}=e,r=n.subchart.main||n.main;let s;return t&&t.type==="brush"?s=t.selection:r&&(s=r.select(".bb-brush").node())&&(s=d3BrushSelection(s)),s}function B(e,t,n=!1){const r=s=>s[e?"getBoundingClientRect":"getBBox"]();return n?r(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=r(t):t.rect}function F(e,t=!1){return B(!0,e,t)}function it(e,t=!1){return B(!1,e,t)}function ot(e=!0,t=0,n=1e4){const r=window.crypto||window.msCrypto,s=r?t+r.getRandomValues(new Uint32Array(1))[0]%(n-t+1):Math.floor(Math.random()*(n-t)+t);return e?String(s):s}function N(e,t,n,r,s){if(n>r)return-1;const i=Math.floor((n+r)/2);let{x:o,w:l=0}=e[i];return s&&(o=e[i].y,l=e[i].h),t>=o&&t<=o+l?i:t<o?N(e,t,n,i-1,s):N(e,t,i+1,r,s)}function ct(e){const t=Ce(e);return t?t[0]===t[1]:!0}function lt(...e){const t=n=>{if(g(n)&&n.constructor){const r=new n.constructor;for(const s in n)r[s]=t(n[s]);return r}return n};return e.map(n=>t(n)).reduce((n,r)=>D(D({},n),r))}function Pe(e={},t){y(t)&&t.forEach(n=>Pe(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}const at=e=>e.charAt(0).toUpperCase()+e.slice(1);function ut(e,t="-"){return e.split(t).map((n,r)=>r?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Re=e=>[].slice.call(e);function bt(e,t,n){const{rootSelector:r="",sheet:s}=e,o=`${r} ${(l=>l.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${n.join(";")}}`;return s[s.insertRule?"insertRule":"addRule"](o,s.cssRules.length)}function dt(e){let t=[];return e.forEach(n=>{var r;try{n.cssRules&&n.cssRules.length&&(t=t.concat(Re(n.cssRules)))}catch(s){(r=window.console)==null||r.warn(`Error while reading rules from ${n.href}: ${s.toString()}`)}}),t}function ft(e){var t,n,r,s,i,o;return{x:((n=(t=window.pageXOffset)!=null?t:window.scrollX)!=null?n:0)+((r=e.scrollLeft)!=null?r:0),y:((i=(s=window.pageYOffset)!=null?s:window.scrollY)!=null?i:0)+((o=e.scrollTop)!=null?o:0)}}function ht(e,t=0,n=0,r=!0){const s=new DOMPoint(t,n),i=e.getScreenCTM(),o=s.matrixTransform(r?i==null?void 0:i.inverse():i);if(r===!1){const l=F(e);o.x-=l.x,o.y-=l.y}return o}function pt(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function gt(e){const t=e[0]instanceof Date,n=(t?e.map(Number):e).filter((r,s,i)=>i.indexOf(r)===s);return t?n.map(r=>new Date(r)):n}function mt(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function w(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return g(e)&&g(n)&&Object.keys(n).forEach(r=>{if(!/^(__proto__|constructor|prototype)$/i.test(r)){const s=n[r];g(s)?(!e[r]&&(e[r]={}),e[r]=w(e[r],s)):e[r]=y(s)?s.concat():s}}),w(e,...t)}function Se(e,t=!0){let n;return e[0]instanceof Date?n=t?(r,s)=>r-s:(r,s)=>s-r:t&&!e.every(isNaN)?n=(r,s)=>r-s:t||(n=(r,s)=>r>s&&-1||r<s&&1||r===s&&0),e.concat().sort(n)}function vt(e,t){let n=t.filter(r=>Oe(r));return n.length?_(n[0])?n=Math[e](...n):n[0]instanceof Date&&(n=Se(n,e==="min")[0]):n=void 0,n}const _t=(e,t,n=1)=>{const r=[],s=Math.max(0,Math.ceil((t-e)/n))|0;for(let i=e;i<s;i++)r.push(e+i*n);return r},xt={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,r=e())=>{t.dispatchEvent(new MouseEvent(n,r))}}catch(t){return(n,r,s=e())=>{const i=me.createEvent("MouseEvent");i.initMouseEvent(r,s.bubbles,s.cancelable,v,0,s.screenX,s.screenY,s.clientX,s.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(i)}}})(),touch:(e,t,n)=>{const r=new Touch(w({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[r],targetTouches:[],changedTouches:[r]}))}};function yt(e,t){let n=e;for(const r in t)n=n.replace(new RegExp(`{=${r}}`,"g"),t[r]);return Te(n)}function $t(e){var t;let n;if(e instanceof Date)n=e;else if(h(e)){const{config:r,format:s}=this;n=(t=s.dataTime(r.data_xFormat)(e))!=null?t:new Date(e)}else _(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function wt(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function Et(e,t,n=!1){const r=!!e.node;let s=!1;for(const[i,o]of Object.entries(t))if(s=r?e.style(i)===o:e.style[i]===o,n===!1&&s)break;return s}function Ot(){var e,t;return((e=document)==null?void 0:e.hidden)===!1||((t=document)==null?void 0:t.visibilityState)==="visible"}function Tt(e,t){const{DocumentTouch:n,matchMedia:r,navigator:s}=window,i=r==null?void 0:r("(pointer:coarse)").matches;let o=!1;if(t)if(s&&"maxTouchPoints"in s)o=s.maxTouchPoints>0;else if("ontouchmove"in window||n&&document instanceof n)o=!0;else if(i)o=!0;else{const a=s.userAgent;o=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(a)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(a)}return e&&!i&&(r==null?void 0:r("(pointer:fine)").matches)&&"mouse"||o&&"touch"||"mouse"}function Ie(e,t){t()===!1?requestAnimationFrame(()=>Ie(e,t)):e()}function At(e){if(g(e)&&!h(e)){const o=e;return{top:o.top||0,right:o.right||0,bottom:o.bottom||0,left:o.left||0}}const t=(h(e)?e.trim().split(/\s+/):[e]).map(o=>+o||0),[n,r=n,s=n,i=r]=t;return{top:n,right:r,bottom:s,left:i}}function Le(e){const t=this.config;let n,r,s;const i=()=>{const o=r.shift();if(o&&n&&x(n)&&o in n)return n=n[o],i();if(!o)return n};Object.keys(t).forEach(o=>{n=e,r=o.split("_"),s=i(),M(s)&&(t[o]=s)}),this.api&&(this.state.orgConfig=e)}var De=Object.defineProperty,Me=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t,n)=>Me(e,typeof t!="symbol"?t+"":t,n);class k{constructor(t={}){E(this,"$$"),E(this,"options"),this.options=t}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(t=>{this[t]=null,delete this[t]})}}E(k,"version","3.17.4");class je{constructor(){return{selector:void 0}}}var Be=Object.defineProperty,Fe=(e,t,n)=>t in e?Be(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t,n)=>Fe(e,typeof t!="symbol"?t+"":t,n);class q extends k{constructor(t){return super(t),O(this,"config"),O(this,"element"),this.config=new je,this}$beforeInit(){Le.call(this,this.options),this.validate(),this.element=[].slice.call(document.querySelectorAll(this.config.selector)),this.overrideInternals(),this.overrideOptions(),this.overHandler=this.overHandler.bind(this),this.moveHandler=this.moveHandler.bind(this),this.outHandler=this.outHandler.bind(this)}validate(){const{$$:t,config:n}=this;let r="";if((!n.selector||!document.querySelector(n.selector))&&(r="No holder elements found from given selector option."),(t.hasType("bubble")||t.hasType("scatter")||t.hasArcType(t.data.targets))&&(r="Contains non supported chart types."),r)throw new Error(`[Sparkline plugin] ${r}`)}overrideInternals(){const{$$:t}=this,{getBarW:n,getIndices:r}=t;t.getIndices=function(s,i,o){return o==="getShapeX"?{}:r.call(this,s,i)},t.getBarW=function(s,i){return n.call(this,s,i,1)}}overrideOptions(){const{config:t}=this.$$;if(t.legend_show=!1,t.resize_auto=!1,t.axis_x_show=!1,t.padding!==!1){const n=r=>Object.keys(r||{}).length>0;n(t.axis_x_padding)&&(t.axis_x_padding={left:15,right:15,unit:"px"}),n(t.axis_y_padding)&&(t.axis_y_padding=5)}t.axis_y_show=!1,t.tooltip_position||(t.tooltip_position=function(n,r,s){const{internal:{state:{event:i}}}=this;let o=i.pageY-s*1.35,l=i.pageX-r/2;return o<0&&(o=0),l<0&&(l=0),{top:o,left:l}})}$init(){var t;const{$$:{$el:n}}=this;n.chart.style("width","0").style("height","0").style("pointer-events","none"),(t=n.tooltip)!=null&&t.node()&&document.body.appendChild(n.tooltip.node())}$afterInit(){const{$$:t}=this;t.$el.svg.attr("style",null).style("width","0").style("height","0"),this.bindEvents(!0)}bindEvents(t=!0){const{$$:{config:n}}=this;if(n.interaction_enabled&&n.tooltip_show){const r=`${t?"add":"remove"}EventListener`;this.element.forEach(s=>{const i=s.querySelector("svg");i[r]("mouseover",this.overHandler),i[r]("mousemove",this.moveHandler),i[r]("mouseout",this.outHandler)})}}overHandler(t){const{$$:n}=this,{state:{eventReceiver:r}}=n;r.rect=t.target.getBoundingClientRect()}moveHandler(t){var n,r,s,i;const{$$:o}=this,l=o.getDataIndexFromEvent(t),a=(n=o.api.data(t.target.__id))==null?void 0:n[0],u=(r=a==null?void 0:a.values)==null?void 0:r[l];u&&!u.name&&(u.name=u.id),o.state.event=t,(s=o.isPointFocusOnly)!=null&&s.call(o)&&u&&((i=o.showCircleFocus)==null||i.call(o,[u])),o.setExpand(l,a.id,!0),o.showTooltip([u],t.target)}outHandler(t){const{$$:n}=this;n.state.event=t,n.isPointFocusOnly()?n.hideCircleFocus():n.unexpandCircles(),n.hideTooltip()}$redraw(){var t;const{$$:n}=this,{$el:r}=n;let s=this.element;const i=n.api.data(),o=(t=r.chart.html().match(/<svg[^>]*>/))==null?void 0:t[0];if(s.length<i.length){const l=r.chart.node();for(let a=i.length-s.length;a>0;a--)l.parentNode.insertBefore(s[0].cloneNode(),l.nextSibling);this.element=document.querySelectorAll(this.config.selector),s=this.element}i.map(l=>l.id).forEach((l,a)=>{const u=`.${S.target}-${l}`,T=r.main.selectAll(u);let p=s[a].querySelector("svg");p||(s[a].innerHTML=`${o}</svg>`,p=s[a].querySelector("svg"),p.__id=l),p.querySelector(u)||T.style("opacity",null),T.style("fill","none").style("opacity",null),p.innerHTML="",p.appendChild(T.node())})}$willDestroy(){this.bindEvents(!1),this.element.forEach(t=>{t.innerHTML=""})}}return O(q,"version","0.0.1"),m=m.default,m})()});
|
|
11
|
+
*/(function(d,p){typeof exports=="object"&&typeof module=="object"?module.exports=p(require("d3-brush"),require("d3-selection")):typeof define=="function"&&define.amd?define("bb",["d3-brush","d3-selection"],p):typeof exports=="object"?exports.bb=p(require("d3-brush"),require("d3-selection")):(d.bb=d.bb||{},d.bb.plugin=d.bb.plugin||{},d.bb.plugin.sparkline=p(d.d3,d.d3))})(this,function(A,d){return(function(){"use strict";var p={747:(function(e){e.exports=d}),853:(function(e){e.exports=A})},C={};function f(e){var t=C[e];if(t!==void 0)return t.exports;var n=C[e]={exports:{}};return p[e](n,n.exports,f),n.exports}(function(){f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(function(){f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})();var v={};f.d(v,{default:function(){return k}});var H=Object.defineProperty,P=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,R=(e,t,n)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,l=(e,t)=>{for(var n in t||(t={}))U.call(t,n)&&R(e,n,t[n]);if(P)for(var n of P(t))X.call(t,n)&&R(e,n,t[n]);return e};const I={button:"bb-button",chart:"bb-chart",empty:"bb-empty",main:"bb-main",target:"bb-target",EXPANDED:"_expanded_",dummy:"_dummy_"},Y={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcLabelLineText:"bb-arc-label-line-text",arcRange:"bb-arc-range",arcs:"bb-arcs",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsTitle:"bb-chart-arcs-title",needle:"bb-needle"},V={area:"bb-area",areas:"bb-areas"},G={axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",axisXTooltip:"bb-axis-x-tooltip",axisYTooltip:"bb-axis-y-tooltip",axisY2Tooltip:"bb-axis-y2-tooltip",axisTooltipX:"bb-axis-tooltip-x",axisTooltipY:"bb-axis-tooltip-y"},z={bar:"bb-bar",bars:"bb-bars",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",barConnectLine:"bb-bar-connectLine"},W={candlestick:"bb-candlestick",candlesticks:"bb-candlesticks",chartCandlestick:"bb-chart-candlestick",chartCandlesticks:"bb-chart-candlesticks",valueDown:"bb-value-down",valueUp:"bb-value-up"},K={chartCircles:"bb-chart-circles",circle:"bb-circle",circles:"bb-circles"},Z={colorPattern:"bb-color-pattern",colorScale:"bb-colorscale"},J={dragarea:"bb-dragarea",INCLUDED:"_included_"},Q={funnel:"bb-funnel",chartFunnel:"bb-chart-funnel",chartFunnels:"bb-chart-funnels",funnelBackground:"bb-funnel-background"},ee={chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",gaugeValue:"bb-gauge-value"},te={legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile"},ne={chartLine:"bb-chart-line",chartLines:"bb-chart-lines",line:"bb-line",lines:"bb-lines"},re={eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single"},oe={focused:"bb-focused",defocused:"bb-defocused",legendItemFocused:"bb-legend-item-focused",xgridFocus:"bb-xgrid-focus",ygridFocus:"bb-ygrid-focus"},ie={grid:"bb-grid",gridLines:"bb-grid-lines",xgrid:"bb-xgrid",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids"},Be={level:"bb-level",levels:"bb-levels"},se={chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars"},ce={region:"bb-region",regions:"bb-regions"},le={selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",SELECTED:"_selected_"},ae={shape:"bb-shape",shapes:"bb-shapes"},ue={brush:"bb-brush",subchart:"bb-subchart"},be={chartText:"bb-chart-text",chartTexts:"bb-chart-texts",text:"bb-text",texts:"bb-texts",title:"bb-title",textBorderRect:"bb-text-border",textLabelImage:"bb-text-label-image",TextOverlapping:"text-overlapping"},de={tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name"},fe={treemap:"bb-treemap",chartTreemap:"bb-chart-treemap",chartTreemaps:"bb-chart-treemaps"},he={buttonZoomReset:"bb-zoom-reset",zoomBrush:"bb-zoom-brush"};var qe=l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l(l({},I),Y),V),G),z),W),K),Z),J),ee),te),ne),re),oe),Q),ie),se),ce),le),ae),ue),be),de),fe),he),ke=f(853),He=f(747);function pe(){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")()}function ge(e){const t=typeof(e==null?void 0:e.requestAnimationFrame)=="function"&&typeof(e==null?void 0:e.cancelAnimationFrame)=="function",n=typeof(e==null?void 0:e.requestIdleCallback)=="function"&&typeof(e==null?void 0:e.cancelIdleCallback)=="function",r=i=>setTimeout(i,1),o=i=>clearTimeout(i);return[t?e.requestAnimationFrame:r,t?e.cancelAnimationFrame:o,n?e.requestIdleCallback:r,n?e.cancelIdleCallback:o]}const x=pe(),me=x==null?void 0:x.document,[Ue,Xe,Ye,Ve]=ge(x);var _e=Object.defineProperty,S=Object.getOwnPropertySymbols,ve=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable,L=(e,t,n)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,M=(e,t)=>{for(var n in t||(t={}))ve.call(t,n)&&L(e,n,t[n]);if(S)for(var n of S(t))xe.call(t,n)&&L(e,n,t[n]);return e};function D(e,t,n=!1){const r=o=>o[e?"getBoundingClientRect":"getBBox"]();return n?r(t):!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+(t.getAttribute("width")||0)?t.rect=r(t):t.rect}function F(e,t){for(let n=0;n<e.length;n++){const r=e[n];r&&t(r,n)}}const g=(()=>{const e="script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex",t={quot:34,amp:38,apos:39,lt:60,gt:62,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165},n=60,r=62,o=10,i={tags:new RegExp(`<(${e})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${e})\\s*>)?`,"gi"),htmlEntity:/&#x([0-9a-f]+);?|&#([0-9]+);?|&([a-z]+);/gi,controlChar:/[\x00-\x1F\x7F]/g,eventHandler:/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)|on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)/gi,dangerousUri:/(href|src|action|xlink:href)\s*=\s*(['"`]?)([^'"`>\s]*)\2/gi,dangerousProtocol:/^(javascript|data|vbscript):/};return{ENTITY_MAP:t,LT_CODE:n,GT_CODE:r,MAX_ITERATIONS:o,rx:i,decodeEntities(s){return s.replace(i.htmlEntity,(c,a,u,h)=>{const b=a?parseInt(a,16):u?parseInt(u,10):h&&t[h.toLowerCase()]||0;return b&&b!==n&&b!==r?String.fromCharCode(b):c})},removeDangerousUris(s){return s.replace(i.dangerousUri,(c,a,u,h)=>{const b=h.toLowerCase().replace(/\s/g,"");return i.dangerousProtocol.test(b)?`${a}=${u}${u}`:c})}}})(),Ge=e=>e||e===0,ye=e=>typeof e=="function",m=e=>typeof e=="string",y=e=>typeof e=="number",we=e=>typeof e=="undefined",N=e=>typeof e!="undefined",ze=e=>typeof e=="boolean",We=e=>Math.ceil(e/10)*10,Ke=e=>Math.ceil(e)+.5,Ze=e=>e[1]-e[0],w=e=>typeof e=="object",$e=e=>{for(const t in e)return!1;return!0},Ee=e=>we(e)||e===null||m(e)&&e.length===0||w(e)&&!(e instanceof Date)&&$e(e)||y(e)&&isNaN(e),Oe=e=>!Ee(e),$=e=>Array.isArray(e),_=e=>e&&!(e!=null&&e.nodeType)&&w(e)&&!$(e);function Je(e,t,n){return N(e[t])?e[t]:n}function Qe(e,t){let n=!1;return Object.keys(e).forEach(r=>e[r]===t&&(n=!0)),n}function et(e,t,...n){const r=ye(e);return r&&e.call(t,...n),r}function tt(e,t){let n=0;const r=function(...o){!--n&&t.apply(this,...o)};"duration"in e?e.each(()=>++n).on("end",r):(++n,e.call(r))}function Te(e){if(!m(e)||!e||e.indexOf("<")===-1)return e;let t=e,n,r=0;do if(n=t,t=g.decodeEntities(t).replace(g.rx.controlChar,"").replace(g.rx.tags,"").replace(g.rx.eventHandler,""),t=g.removeDangerousUris(t),++r>=g.MAX_ITERATIONS)break;while(t!==n);return t}function nt(e,t,n=[-1,1],r=!1){if(!(!e||!m(t)))if(t.indexOf(`
|
|
12
|
+
`)===-1)e.text(t);else{const o=[e.text(),t].map(i=>i.replace(/[\s\n]/g,""));if(o[0]!==o[1]){const i=t.split(`
|
|
13
|
+
`),s=r?i.length-1:1;e.html(""),i.forEach((c,a)=>{e.append("tspan").attr("x",0).attr("dy",`${a===0?n[0]*s:n[1]}em`).text(c)})}}}function Ae(e){const{x:t,y:n,width:r,height:o}=e.getBBox();return[{x:t,y:n+o},{x:t,y:n},{x:t+r,y:n},{x:t+r,y:n+o}]}function rt(e){const{width:t,height:n}=j(e),r=Ae(e),o=r[0].x,i=Math.min(r[0].y,r[1].y);return{x:o,y:i,width:t,height:n}}function ot(e,t){var n;const r=e&&((n=e.touches||e.sourceEvent&&e.sourceEvent.touches)==null?void 0:n[0]);let o=[0,0];try{o=d3Pointer(r||e,t)}catch(i){}return o.map(i=>isNaN(i)?0:i)}function Ce(e){const{event:t,$el:n}=e,r=n.subchart.main||n.main;let o;return t&&t.type==="brush"?o=t.selection:r&&(o=r.select(".bb-brush").node())&&(o=d3BrushSelection(o)),o}function j(e,t=!1){return D(!0,e,t)}function it(e,t=!1){return D(!1,e,t)}function st(e=!0,t=0,n=1e4){const r=window.crypto||window.msCrypto,o=r?t+r.getRandomValues(new Uint32Array(1))[0]%(n-t+1):Math.floor(Math.random()*(n-t)+t);return e?String(o):o}function B(e,t,n,r,o){if(n>r)return-1;const i=Math.floor((n+r)/2);let{x:s,w:c=0}=e[i];return o&&(s=e[i].y,c=e[i].h),t>=s&&t<=s+c?i:t<s?B(e,t,n,i-1,o):B(e,t,i+1,r,o)}function ct(e){const t=Ce(e);return t?t[0]===t[1]:!0}function lt(...e){const t=n=>{if(_(n)&&n.constructor){const r=new n.constructor;for(const o in n)r[o]=t(n[o]);return r}return n};return e.map(n=>t(n)).reduce((n,r)=>M(M({},n),r))}function Pe(e={},t){$(t)&&t.forEach(n=>Pe(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}const at=e=>e.charAt(0).toUpperCase()+e.slice(1);function ut(e,t="-"){return e.split(t).map((n,r)=>r?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const Re=e=>[].slice.call(e);function bt(e,t,n){const{rootSelector:r="",sheet:o}=e,s=`${r} ${(c=>c.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,"."))(t)} {${n.join(";")}}`;return o[o.insertRule?"insertRule":"addRule"](s,o.cssRules.length)}function dt(e){let t=[];return e.forEach(n=>{var r;try{n.cssRules&&n.cssRules.length&&(t=t.concat(Re(n.cssRules)))}catch(o){(r=window.console)==null||r.warn(`Error while reading rules from ${n.href}: ${o.toString()}`)}}),t}function ft(e){var t,n,r,o,i,s;return{x:((n=(t=window.pageXOffset)!=null?t:window.scrollX)!=null?n:0)+((r=e.scrollLeft)!=null?r:0),y:((i=(o=window.pageYOffset)!=null?o:window.scrollY)!=null?i:0)+((s=e.scrollTop)!=null?s:0)}}function ht(e,t=0,n=0,r=!0){const o=new DOMPoint(t,n),i=e.getScreenCTM(),s=o.matrixTransform(r?i==null?void 0:i.inverse():i);if(r===!1){const c=j(e);s.x-=c.x,s.y-=c.y}return s}function pt(e){const t=e?e.transform:null,n=t&&t.baseVal;return n&&n.numberOfItems?n.getItem(0).matrix:{a:0,b:0,c:0,d:0,e:0,f:0}}function gt(e){const t=e[0]instanceof Date,n=(t?e.map(Number):e).filter((r,o,i)=>i.indexOf(r)===o);return t?n.map(r=>new Date(r)):n}function mt(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function E(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return _(e)&&_(n)&&Object.keys(n).forEach(r=>{if(!/^(__proto__|constructor|prototype)$/i.test(r)){const o=n[r];_(o)?(!e[r]&&(e[r]={}),e[r]=E(e[r],o)):e[r]=$(o)?o.concat():o}}),E(e,...t)}function Ie(e,t=!0){let n;return e[0]instanceof Date?n=t?(r,o)=>r-o:(r,o)=>o-r:t&&!e.every(isNaN)?n=(r,o)=>r-o:t||(n=(r,o)=>r>o&&-1||r<o&&1||r===o&&0),e.concat().sort(n)}function _t(e,t){let n=t.filter(r=>Oe(r));return n.length?y(n[0])?n=Math[e](...n):n[0]instanceof Date&&(n=Ie(n,e==="min")[0]):n=void 0,n}const vt=(e,t,n=1)=>{const r=[],o=Math.max(0,Math.ceil((t-e)/n))|0;for(let i=e;i<o;i++)r.push(e+i*n);return r},xt={mouse:(()=>{const e=()=>({bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});try{return new MouseEvent("t"),(t,n,r=e())=>{t.dispatchEvent(new MouseEvent(n,r))}}catch(t){return(n,r,o=e())=>{const i=me.createEvent("MouseEvent");i.initMouseEvent(r,o.bubbles,o.cancelable,x,0,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,0,null),n.dispatchEvent(i)}}})(),touch:(e,t,n)=>{const r=new Touch(E({identifier:Date.now(),target:e,radiusX:2.5,radiusY:2.5,rotationAngle:10,force:.5},n));e.dispatchEvent(new TouchEvent(t,{cancelable:!0,bubbles:!0,shiftKey:!0,touches:[r],targetTouches:[],changedTouches:[r]}))}};function yt(e,t){let n=e;for(const r in t)n=n.replace(new RegExp(`{=${r}}`,"g"),t[r]);return Te(n)}function wt(e){var t;let n;if(e instanceof Date)n=e;else if(m(e)){const{config:r,format:o}=this;n=(t=o.dataTime(r.data_xFormat)(e))!=null?t:new Date(e)}else y(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function $t(e){const t=e.attr("viewBox");return t?/(\d+(\.\d+)?){3}/.test(t):!1}function Et(e,t,n=!1){const r=!!e.node;let o=!1;for(const[i,s]of Object.entries(t))if(o=r?e.style(i)===s:e.style[i]===s,n===!1&&o)break;return o}function Ot(){var e,t;return((e=document)==null?void 0:e.hidden)===!1||((t=document)==null?void 0:t.visibilityState)==="visible"}function Tt(e,t){const{DocumentTouch:n,matchMedia:r,navigator:o}=window,i=r==null?void 0:r("(pointer:coarse)").matches;let s=!1;if(t)if(o&&"maxTouchPoints"in o)s=o.maxTouchPoints>0;else if("ontouchmove"in window||n&&document instanceof n)s=!0;else if(i)s=!0;else{const a=o.userAgent;s=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(a)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(a)}return e&&!i&&(r==null?void 0:r("(pointer:fine)").matches)&&"mouse"||s&&"touch"||"mouse"}function Se(e,t){t()===!1?requestAnimationFrame(()=>Se(e,t)):e()}function At(e){if(_(e)&&!m(e)){const s=e;return{top:s.top||0,right:s.right||0,bottom:s.bottom||0,left:s.left||0}}const t=(m(e)?e.trim().split(/\s+/):[e]).map(s=>+s||0),[n,r=n,o=n,i=r]=t;return{top:n,right:r,bottom:o,left:i}}function Ct(e,t){e.pendingRaf!==null?(window.cancelAnimationFrame(e.pendingRaf),e.pendingRaf=window.requestAnimationFrame(()=>{e.pendingRaf=null,t()})):(e.pendingRaf=window.requestAnimationFrame(()=>{e.pendingRaf=null}),t())}function Pt(e,t=(n=>n)){const n=new Set;return F(e,(r,o)=>{n.add(t(r,o))}),n}function Rt(e,t,n=(r=>r)){const r=new Map;return F(e,(o,i)=>{r.set(t(o,i),n(o,i))}),r}function Le(e){const t=this.config;let n,r,o;const i=()=>{const s=r.shift();if(s&&n&&w(n)&&s in n)return n=n[s],i();if(!s)return n};Object.keys(t).forEach(s=>{n=e,r=s.split("_"),o=i(),N(o)&&(t[s]=o)}),this.api&&(this.state.orgConfig=e)}var Me=Object.defineProperty,De=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t,n)=>De(e,typeof t!="symbol"?t+"":t,n);class q{constructor(t={}){O(this,"$$"),O(this,"options"),this.options=t}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(t=>{this[t]=null,delete this[t]})}}O(q,"version","3.18.0-next.2");class Fe{constructor(){return{selector:void 0}}}var Ne=Object.defineProperty,je=(e,t,n)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t,n)=>je(e,typeof t!="symbol"?t+"":t,n);class k extends q{constructor(t){return super(t),T(this,"config"),T(this,"element"),this.config=new Fe,this}$beforeInit(){Le.call(this,this.options),this.validate(),this.element=[].slice.call(document.querySelectorAll(this.config.selector)),this.overrideInternals(),this.overrideOptions(),this.overHandler=this.overHandler.bind(this),this.moveHandler=this.moveHandler.bind(this),this.outHandler=this.outHandler.bind(this)}validate(){const{$$:t,config:n}=this;let r="";if((!n.selector||!document.querySelector(n.selector))&&(r="No holder elements found from given selector option."),(t.hasType("bubble")||t.hasType("scatter")||t.hasArcType(t.data.targets))&&(r="Contains non supported chart types."),r)throw new Error(`[Sparkline plugin] ${r}`)}overrideInternals(){const{$$:t}=this,{getBarW:n,getIndices:r}=t;t.getIndices=function(o,i,s){return s==="getShapeX"?{}:r.call(this,o,i)},t.getBarW=function(o,i){return n.call(this,o,i,1)}}overrideOptions(){const{config:t}=this.$$;if(t.legend_show=!1,t.resize_auto=!1,t.axis_x_show=!1,t.padding!==!1){const n=r=>Object.keys(r||{}).length>0;n(t.axis_x_padding)&&(t.axis_x_padding={left:15,right:15,unit:"px"}),n(t.axis_y_padding)&&(t.axis_y_padding=5)}t.axis_y_show=!1,t.tooltip_position||(t.tooltip_position=function(n,r,o){const{internal:{state:{event:i}}}=this;let s=i.pageY-o*1.35,c=i.pageX-r/2;return s<0&&(s=0),c<0&&(c=0),{top:s,left:c}})}$init(){var t;const{$$:{$el:n}}=this;n.chart.style("width","0").style("height","0").style("pointer-events","none"),(t=n.tooltip)!=null&&t.node()&&document.body.appendChild(n.tooltip.node())}$afterInit(){const{$$:t}=this;t.$el.svg.attr("style",null).style("width","0").style("height","0"),this.bindEvents(!0)}bindEvents(t=!0){const{$$:{config:n}}=this;if(n.interaction_enabled&&n.tooltip_show){const r=`${t?"add":"remove"}EventListener`;this.element.forEach(o=>{const i=o.querySelector("svg");i[r]("mouseover",this.overHandler),i[r]("mousemove",this.moveHandler),i[r]("mouseout",this.outHandler)})}}overHandler(t){const{$$:n}=this,{state:{eventReceiver:r}}=n;r.rect=t.target.getBoundingClientRect()}moveHandler(t){var n,r,o,i;const{$$:s}=this,c=s.getDataIndexFromEvent(t),a=(n=s.api.data(t.target.__id))==null?void 0:n[0],u=(r=a==null?void 0:a.values)==null?void 0:r[c];u&&!u.name&&(u.name=u.id),s.state.event=t,(o=s.isPointFocusOnly)!=null&&o.call(s)&&u&&((i=s.showCircleFocus)==null||i.call(s,[u])),s.setExpand(c,a.id,!0),s.showTooltip([u],t.target)}outHandler(t){const{$$:n}=this;n.state.event=t,n.isPointFocusOnly()?n.hideCircleFocus():n.unexpandCircles(),n.hideTooltip()}$redraw(){var t;const{$$:n}=this,{$el:r}=n;let o=this.element;const i=n.api.data(),s=(t=r.chart.html().match(/<svg[^>]*>/))==null?void 0:t[0];if(o.length<i.length){const c=r.chart.node();for(let a=i.length-o.length;a>0;a--)c.parentNode.insertBefore(o[0].cloneNode(),c.nextSibling);this.element=document.querySelectorAll(this.config.selector),o=this.element}i.map(c=>c.id).forEach((c,a)=>{const u=`.${I.target}-${c}`,h=r.main.selectAll(u);let b=o[a].querySelector("svg");b||(o[a].innerHTML=`${s}</svg>`,b=o[a].querySelector("svg"),b.__id=c),b.querySelector(u)||h.style("opacity",null),h.style("fill","none").style("opacity",null),b.innerHTML="",b.appendChild(h.node())})}$willDestroy(){this.bindEvents(!1),this.element.forEach(t=>{t.innerHTML=""})}}return T(k,"version","0.0.1"),v=v.default,v})()});
|
|
@@ -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
|
*/
|
|
@@ -156,6 +156,7 @@ const $COMMON = {
|
|
|
156
156
|
const $ARC = {
|
|
157
157
|
arc: "bb-arc",
|
|
158
158
|
arcLabelLine: "bb-arc-label-line",
|
|
159
|
+
arcLabelLineText: "bb-arc-label-line-text",
|
|
159
160
|
arcRange: "bb-arc-range",
|
|
160
161
|
arcs: "bb-arcs",
|
|
161
162
|
chartArc: "bb-chart-arc",
|
|
@@ -364,7 +365,83 @@ var util_spreadValues = (a, b) => {
|
|
|
364
365
|
|
|
365
366
|
|
|
366
367
|
|
|
367
|
-
|
|
368
|
+
function _getRect(relativeViewport, node, forceEval = false) {
|
|
369
|
+
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
370
|
+
if (forceEval) {
|
|
371
|
+
return _(node);
|
|
372
|
+
} else {
|
|
373
|
+
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
|
|
374
|
+
return needEvaluate ? node.rect = _(node) : node.rect;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function _forEachValidItem(items, callback) {
|
|
378
|
+
for (let i = 0; i < items.length; i++) {
|
|
379
|
+
const item = items[i];
|
|
380
|
+
if (item) {
|
|
381
|
+
callback(item, i);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
const _sanitize = (() => {
|
|
386
|
+
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
387
|
+
const ENTITY_MAP = {
|
|
388
|
+
quot: 34,
|
|
389
|
+
amp: 38,
|
|
390
|
+
apos: 39,
|
|
391
|
+
lt: 60,
|
|
392
|
+
gt: 62,
|
|
393
|
+
nbsp: 160,
|
|
394
|
+
iexcl: 161,
|
|
395
|
+
cent: 162,
|
|
396
|
+
pound: 163,
|
|
397
|
+
curren: 164,
|
|
398
|
+
yen: 165
|
|
399
|
+
};
|
|
400
|
+
const LT_CODE = 60;
|
|
401
|
+
const GT_CODE = 62;
|
|
402
|
+
const MAX_ITERATIONS = 10;
|
|
403
|
+
const rx = {
|
|
404
|
+
tags: new RegExp(
|
|
405
|
+
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
406
|
+
"gi"
|
|
407
|
+
),
|
|
408
|
+
htmlEntity: /&#x([0-9a-f]+);?|&#([0-9]+);?|&([a-z]+);/gi,
|
|
409
|
+
// eslint-disable-next-line no-control-regex
|
|
410
|
+
controlChar: /[\x00-\x1F\x7F]/g,
|
|
411
|
+
eventHandler: /\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)|on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)/gi,
|
|
412
|
+
dangerousUri: /(href|src|action|xlink:href)\s*=\s*(['"`]?)([^'"`>\s]*)\2/gi,
|
|
413
|
+
dangerousProtocol: /^(javascript|data|vbscript):/
|
|
414
|
+
};
|
|
415
|
+
return {
|
|
416
|
+
ENTITY_MAP,
|
|
417
|
+
LT_CODE,
|
|
418
|
+
GT_CODE,
|
|
419
|
+
MAX_ITERATIONS,
|
|
420
|
+
rx,
|
|
421
|
+
/**
|
|
422
|
+
* Decode HTML entities to prevent bypass attacks
|
|
423
|
+
* @param {string} str String with potential HTML entities
|
|
424
|
+
* @returns {string} Decoded string
|
|
425
|
+
*/
|
|
426
|
+
decodeEntities(str) {
|
|
427
|
+
return str.replace(rx.htmlEntity, (match, hex, dec, named) => {
|
|
428
|
+
const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : named ? ENTITY_MAP[named.toLowerCase()] || 0 : 0;
|
|
429
|
+
return code && code !== LT_CODE && code !== GT_CODE ? String.fromCharCode(code) : match;
|
|
430
|
+
});
|
|
431
|
+
},
|
|
432
|
+
/**
|
|
433
|
+
* Remove dangerous URI protocols from attribute values
|
|
434
|
+
* @param {string} str String to sanitize
|
|
435
|
+
* @returns {string} Sanitized string
|
|
436
|
+
*/
|
|
437
|
+
removeDangerousUris(str) {
|
|
438
|
+
return str.replace(rx.dangerousUri, (match, attr, quote, value) => {
|
|
439
|
+
const normalized = value.toLowerCase().replace(/\s/g, "");
|
|
440
|
+
return rx.dangerousProtocol.test(normalized) ? `${attr}=${quote}${quote}` : match;
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
})();
|
|
368
445
|
const isValue = (v) => v || v === 0;
|
|
369
446
|
const isFunction = (v) => typeof v === "function";
|
|
370
447
|
const isString = (v) => typeof v === "string";
|
|
@@ -411,26 +488,20 @@ function endall(transition, cb) {
|
|
|
411
488
|
transition.call(end);
|
|
412
489
|
}
|
|
413
490
|
}
|
|
414
|
-
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
415
|
-
const sanitizeRx = {
|
|
416
|
-
tags: new RegExp(
|
|
417
|
-
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
418
|
-
"gi"
|
|
419
|
-
),
|
|
420
|
-
// Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
|
|
421
|
-
eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
|
|
422
|
-
// Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
|
|
423
|
-
dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
|
|
424
|
-
};
|
|
425
491
|
function sanitize(str) {
|
|
426
492
|
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
427
493
|
return str;
|
|
428
494
|
}
|
|
429
495
|
let result = str;
|
|
430
496
|
let prev;
|
|
497
|
+
let iterations = 0;
|
|
431
498
|
do {
|
|
432
499
|
prev = result;
|
|
433
|
-
result = result.replace(
|
|
500
|
+
result = _sanitize.decodeEntities(result).replace(_sanitize.rx.controlChar, "").replace(_sanitize.rx.tags, "").replace(_sanitize.rx.eventHandler, "");
|
|
501
|
+
result = _sanitize.removeDangerousUris(result);
|
|
502
|
+
if (++iterations >= _sanitize.MAX_ITERATIONS) {
|
|
503
|
+
break;
|
|
504
|
+
}
|
|
434
505
|
} while (result !== prev);
|
|
435
506
|
return result;
|
|
436
507
|
}
|
|
@@ -498,20 +569,11 @@ function getBrushSelection(ctx) {
|
|
|
498
569
|
}
|
|
499
570
|
return selection;
|
|
500
571
|
}
|
|
501
|
-
function getRect(relativeViewport, node, forceEval = false) {
|
|
502
|
-
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
503
|
-
if (forceEval) {
|
|
504
|
-
return _(node);
|
|
505
|
-
} else {
|
|
506
|
-
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
|
|
507
|
-
return needEvaluate ? node.rect = _(node) : node.rect;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
572
|
function getBoundingRect(node, forceEval = false) {
|
|
511
|
-
return
|
|
573
|
+
return _getRect(true, node, forceEval);
|
|
512
574
|
}
|
|
513
575
|
function getBBox(node, forceEval = false) {
|
|
514
|
-
return
|
|
576
|
+
return _getRect(false, node, forceEval);
|
|
515
577
|
}
|
|
516
578
|
function getRandom(asStr = true, min = 0, max = 1e4) {
|
|
517
579
|
const crpt = win.crypto || win.msCrypto;
|
|
@@ -823,6 +885,35 @@ function parseShorthand(value) {
|
|
|
823
885
|
const [a, b = a, c = a, d = b] = values;
|
|
824
886
|
return { top: a, right: b, bottom: c, left: d };
|
|
825
887
|
}
|
|
888
|
+
function scheduleRAFUpdate(rafState, callback) {
|
|
889
|
+
if (rafState.pendingRaf !== null) {
|
|
890
|
+
win.cancelAnimationFrame(rafState.pendingRaf);
|
|
891
|
+
rafState.pendingRaf = win.requestAnimationFrame(() => {
|
|
892
|
+
rafState.pendingRaf = null;
|
|
893
|
+
callback();
|
|
894
|
+
});
|
|
895
|
+
} else {
|
|
896
|
+
rafState.pendingRaf = win.requestAnimationFrame(() => {
|
|
897
|
+
rafState.pendingRaf = null;
|
|
898
|
+
});
|
|
899
|
+
callback();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
function toSet(items, keyFn = ((item) => item)) {
|
|
903
|
+
const set = /* @__PURE__ */ new Set();
|
|
904
|
+
_forEachValidItem(items, (item, i) => {
|
|
905
|
+
set.add(keyFn(item, i));
|
|
906
|
+
});
|
|
907
|
+
return set;
|
|
908
|
+
}
|
|
909
|
+
function toMap(items, keyFn, valueFn = ((item) => item)) {
|
|
910
|
+
const map = /* @__PURE__ */ new Map();
|
|
911
|
+
_forEachValidItem(items, (item, i) => {
|
|
912
|
+
map.set(keyFn(item, i), valueFn(item, i));
|
|
913
|
+
});
|
|
914
|
+
return map;
|
|
915
|
+
}
|
|
916
|
+
|
|
826
917
|
|
|
827
918
|
;// ./src/config/config.ts
|
|
828
919
|
|
|
@@ -904,7 +995,7 @@ class Plugin {
|
|
|
904
995
|
});
|
|
905
996
|
}
|
|
906
997
|
}
|
|
907
|
-
__publicField(Plugin, "version", "3.
|
|
998
|
+
__publicField(Plugin, "version", "3.18.0-next.2");
|
|
908
999
|
|
|
909
1000
|
// EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"}
|
|
910
1001
|
var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(8);
|
|
@@ -1134,7 +1225,7 @@ class Options {
|
|
|
1134
1225
|
* Set the color of the color scale. This function receives a value between 0 and 1, and should return a color.
|
|
1135
1226
|
* @name colors
|
|
1136
1227
|
* @memberof plugin-stanford
|
|
1137
|
-
* @type {
|
|
1228
|
+
* @type {function}
|
|
1138
1229
|
* @default undefined
|
|
1139
1230
|
* @example
|
|
1140
1231
|
* colors: d3.interpolateHslLong(
|
|
@@ -1182,7 +1273,7 @@ class Options {
|
|
|
1182
1273
|
* @property {number} [scale.min=undefined] Minimum value of the color scale. Default: lowest value in epochs
|
|
1183
1274
|
* @property {number} [scale.max=undefined] Maximum value of the color scale. Default: highest value in epochs
|
|
1184
1275
|
* @property {number} [scale.width=20] Width of the color scale
|
|
1185
|
-
* @property {string|
|
|
1276
|
+
* @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")
|
|
1186
1277
|
* @example
|
|
1187
1278
|
* scale: {
|
|
1188
1279
|
* max: 10000,
|