billboard.js 4.1.0-next.2 → 4.1.0
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/dist/billboard.css +1 -1
- package/dist/billboard.js +268 -107
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +16 -16
- package/dist/billboard.pkgd.js +3198 -1755
- package/dist/billboard.pkgd.min.js +23 -23
- package/dist/billboard.react.js +28 -49
- package/dist/billboard.react.min.js +2 -2
- package/dist/billboard.worker.js +1 -1
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +14 -31
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +14 -31
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +21 -35
- package/dist/plugin/billboardjs-plugin-stanford.min.js +7 -7
- package/dist/plugin/billboardjs-plugin-tableview.js +15 -30
- package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +15 -30
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2959 -1684
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2960 -1685
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2961 -1686
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -18
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2962 -1687
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2963 -1688
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/Chart/Chart.js +1 -1
- package/dist-esm/Chart/api/axis.js +1 -1
- package/dist-esm/Chart/api/category.js +1 -1
- package/dist-esm/Chart/api/chart.js +9 -7
- package/dist-esm/Chart/api/color.js +1 -1
- package/dist-esm/Chart/api/data.js +3 -3
- package/dist-esm/Chart/api/export.js +1 -1
- package/dist-esm/Chart/api/flow.js +1 -1
- package/dist-esm/Chart/api/focus.js +1 -1
- package/dist-esm/Chart/api/grid.js +1 -1
- package/dist-esm/Chart/api/group.js +1 -1
- package/dist-esm/Chart/api/legend.js +1 -1
- package/dist-esm/Chart/api/load.js +1 -1
- package/dist-esm/Chart/api/regions.js +1 -1
- package/dist-esm/Chart/api/selection.js +1 -1
- package/dist-esm/Chart/api/show.js +1 -1
- package/dist-esm/Chart/api/stubs.js +1 -1
- package/dist-esm/Chart/api/subchart.js +1 -1
- package/dist-esm/Chart/api/tooltip.js +1 -1
- package/dist-esm/Chart/api/x.js +11 -9
- package/dist-esm/Chart/api/zoom.js +8 -7
- package/dist-esm/ChartInternal/Axis/Axis.js +7 -6
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +1 -1
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
- package/dist-esm/ChartInternal/ChartInternal.js +32 -8
- package/dist-esm/ChartInternal/data/convert.helper.js +7 -5
- package/dist-esm/ChartInternal/data/convert.js +1 -1
- package/dist-esm/ChartInternal/data/data.js +64 -33
- package/dist-esm/ChartInternal/data/load.js +1 -1
- package/dist-esm/ChartInternal/interactions/drag.js +1 -1
- package/dist-esm/ChartInternal/interactions/eventrect.js +1 -1
- package/dist-esm/ChartInternal/interactions/flow.js +17 -15
- package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
- package/dist-esm/ChartInternal/interactions/subchart.js +8 -6
- package/dist-esm/ChartInternal/interactions/zoom.js +8 -6
- package/dist-esm/ChartInternal/internals/category.js +1 -1
- package/dist-esm/ChartInternal/internals/class.js +1 -1
- package/dist-esm/ChartInternal/internals/clip.js +1 -1
- package/dist-esm/ChartInternal/internals/color.js +1 -1
- package/dist-esm/ChartInternal/internals/domain.js +13 -9
- package/dist-esm/ChartInternal/internals/format.js +5 -3
- package/dist-esm/ChartInternal/internals/grid.js +5 -4
- package/dist-esm/ChartInternal/internals/legend.js +8 -7
- package/dist-esm/ChartInternal/internals/redraw.js +2 -2
- package/dist-esm/ChartInternal/internals/region.js +1 -1
- package/dist-esm/ChartInternal/internals/scale.js +1 -1
- package/dist-esm/ChartInternal/internals/selection.js +1 -1
- package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
- package/dist-esm/ChartInternal/internals/size.js +56 -10
- package/dist-esm/ChartInternal/internals/style.js +1 -1
- package/dist-esm/ChartInternal/internals/subchart.util.js +1 -1
- package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
- package/dist-esm/ChartInternal/internals/text.js +12 -9
- package/dist-esm/ChartInternal/internals/text.util.js +4 -4
- package/dist-esm/ChartInternal/internals/title.js +3 -2
- package/dist-esm/ChartInternal/internals/tooltip.js +25 -20
- package/dist-esm/ChartInternal/internals/transform.js +1 -1
- package/dist-esm/ChartInternal/internals/type.js +1 -1
- package/dist-esm/ChartInternal/shape/arc.js +3 -2
- package/dist-esm/ChartInternal/shape/area.js +3 -2
- package/dist-esm/ChartInternal/shape/bar.js +1 -1
- package/dist-esm/ChartInternal/shape/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
- package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
- package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
- package/dist-esm/ChartInternal/shape/core/path.js +1 -1
- package/dist-esm/ChartInternal/shape/core/point.js +1 -1
- package/dist-esm/ChartInternal/shape/core/treemap.js +3 -2
- package/dist-esm/ChartInternal/shape/funnel.js +1 -1
- package/dist-esm/ChartInternal/shape/gauge.js +1 -1
- package/dist-esm/ChartInternal/shape/line.js +3 -2
- package/dist-esm/ChartInternal/shape/point.js +1 -1
- package/dist-esm/ChartInternal/shape/polar.js +1 -1
- package/dist-esm/ChartInternal/shape/radar.js +1 -1
- package/dist-esm/ChartInternal/shape/shape.js +3 -2
- package/dist-esm/ChartInternal/shape/treemap.js +1 -1
- package/dist-esm/canvas/CanvasAxisRenderer.js +27 -21
- package/dist-esm/canvas/CanvasEngine.js +1 -1
- package/dist-esm/canvas/CanvasPainter.js +1 -1
- package/dist-esm/canvas/CanvasRenderer.js +1 -1
- package/dist-esm/canvas/CanvasTheme.js +7 -8
- package/dist-esm/canvas/HitDetector.js +1 -1
- package/dist-esm/canvas/axisTicks.js +3 -2
- package/dist-esm/canvas/classes.js +1 -1
- package/dist-esm/canvas/color.js +1 -1
- package/dist-esm/canvas/geometry.js +1 -1
- package/dist-esm/canvas/labels.js +4 -4
- package/dist-esm/canvas/pointPattern.js +1 -1
- package/dist-esm/canvas/util.js +1 -1
- package/dist-esm/config/Options/Options.js +1 -1
- package/dist-esm/config/Options/axis/axis.js +1 -1
- package/dist-esm/config/Options/axis/x.js +1 -1
- package/dist-esm/config/Options/axis/y.js +1 -1
- package/dist-esm/config/Options/axis/y2.js +1 -13
- package/dist-esm/config/Options/common/boost.js +1 -1
- package/dist-esm/config/Options/common/color.js +1 -1
- package/dist-esm/config/Options/common/grid.js +1 -1
- package/dist-esm/config/Options/common/legend.js +1 -1
- package/dist-esm/config/Options/common/main.js +44 -2
- package/dist-esm/config/Options/common/point.js +1 -1
- package/dist-esm/config/Options/common/title.js +1 -1
- package/dist-esm/config/Options/common/tooltip.js +1 -1
- package/dist-esm/config/Options/data/axis.js +1 -1
- package/dist-esm/config/Options/data/data.js +1 -1
- package/dist-esm/config/Options/data/selection.js +1 -1
- package/dist-esm/config/Options/interaction/interaction.js +1 -1
- package/dist-esm/config/Options/interaction/subchart.js +1 -1
- package/dist-esm/config/Options/interaction/zoom.js +1 -1
- package/dist-esm/config/Options/shape/arc.js +1 -1
- package/dist-esm/config/Options/shape/area.js +1 -1
- package/dist-esm/config/Options/shape/bar.js +1 -1
- package/dist-esm/config/Options/shape/bubble.js +1 -1
- package/dist-esm/config/Options/shape/candlestick.js +1 -1
- package/dist-esm/config/Options/shape/donut.js +1 -1
- package/dist-esm/config/Options/shape/funnel.js +1 -1
- package/dist-esm/config/Options/shape/gauge.js +1 -1
- package/dist-esm/config/Options/shape/line.js +1 -1
- package/dist-esm/config/Options/shape/pie.js +1 -1
- package/dist-esm/config/Options/shape/polar.js +1 -1
- package/dist-esm/config/Options/shape/radar.js +1 -1
- package/dist-esm/config/Options/shape/scatter.js +1 -1
- package/dist-esm/config/Options/shape/spline.js +1 -1
- package/dist-esm/config/Options/shape/treemap.js +1 -1
- package/dist-esm/config/Store/Element.js +1 -1
- package/dist-esm/config/Store/State.js +4 -1
- package/dist-esm/config/Store/Store.js +1 -1
- package/dist-esm/config/classes.js +1 -1
- package/dist-esm/config/config.js +1 -1
- package/dist-esm/config/const.js +1 -1
- package/dist-esm/config/resolver/axis.core.js +1 -1
- package/dist-esm/config/resolver/axis.js +1 -1
- package/dist-esm/config/resolver/canvas.js +17 -12
- package/dist-esm/config/resolver/canvasShape.js +1 -1
- package/dist-esm/config/resolver/category.js +1 -1
- package/dist-esm/config/resolver/export.js +1 -1
- package/dist-esm/config/resolver/flow.js +1 -1
- package/dist-esm/config/resolver/grid.js +1 -1
- package/dist-esm/config/resolver/interaction/selection.js +1 -1
- package/dist-esm/config/resolver/interaction/subchart.js +1 -1
- package/dist-esm/config/resolver/interaction/zoom.js +1 -1
- package/dist-esm/config/resolver/regions.js +1 -1
- package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/area.js +1 -1
- package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/bar.js +1 -1
- package/dist-esm/config/resolver/shape/bubble.js +1 -1
- package/dist-esm/config/resolver/shape/candlestick.js +1 -1
- package/dist-esm/config/resolver/shape/donut.js +1 -1
- package/dist-esm/config/resolver/shape/funnel.js +1 -1
- package/dist-esm/config/resolver/shape/gauge.js +1 -1
- package/dist-esm/config/resolver/shape/line.js +1 -1
- package/dist-esm/config/resolver/shape/pie.js +1 -1
- package/dist-esm/config/resolver/shape/polar.js +1 -1
- package/dist-esm/config/resolver/shape/radar.js +1 -1
- package/dist-esm/config/resolver/shape/scatter.js +1 -1
- package/dist-esm/config/resolver/shape/treemap.js +1 -1
- package/dist-esm/core.js +5 -4
- package/dist-esm/index.canvas.js +1 -1
- package/dist-esm/index.esm.js +1 -1
- package/dist-esm/module/Cache.js +2 -2
- package/dist-esm/module/browser.js +2 -2
- package/dist-esm/module/dsv.js +1 -1
- package/dist-esm/module/error.js +1 -1
- package/dist-esm/module/generator.js +16 -3
- package/dist-esm/module/sanitize.js +1 -1
- package/dist-esm/module/util/brush.js +1 -1
- package/dist-esm/module/util/dom.js +9 -7
- package/dist-esm/module/util/object.js +1 -1
- package/dist-esm/module/util/type-checks.js +1 -1
- package/dist-esm/module/worker.js +1 -1
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -40
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -41
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist-esm/react/index.js +1 -1
- package/package.json +36 -36
- package/src/Chart/api/chart.ts +1 -0
- package/src/Chart/api/data.ts +5 -3
- package/src/ChartInternal/ChartInternal.ts +72 -25
- package/src/ChartInternal/data/data.ts +68 -34
- package/src/ChartInternal/internals/redraw.ts +8 -1
- package/src/ChartInternal/internals/size.ts +99 -2
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/config/Options/common/main.ts +43 -1
- package/src/config/Store/State.ts +4 -0
- package/src/config/const.ts +4 -0
- package/src/config/resolver/canvas.ts +3 -0
- package/src/module/Cache.ts +1 -1
- package/src/module/generator.ts +27 -2
- package/types/options.d.ts +38 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { window as win } from "../../module/browser.js";
|
|
11
11
|
import { isBoolean, isFunction } from "../../module/util/type-checks.js";
|
|
@@ -277,12 +277,13 @@ function bindCanvasHtmlLegendInteractions($$, item) {
|
|
|
277
277
|
const handleCanvasLegendToggle = function(event, id) {
|
|
278
278
|
if (!callFn(config.legend_item_onclick, api, id, !state.hiddenTargetIds.has(id))) {
|
|
279
279
|
const selected = select(this);
|
|
280
|
-
if (event.type === "dblclick" || event.altKey)
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
280
|
+
if (event.type === "dblclick" || event.altKey) {
|
|
281
|
+
if (state.hiddenTargetIds.size && !selected.classed($LEGEND.legendItemHidden)) api.show();
|
|
282
|
+
else {
|
|
283
|
+
api.hide();
|
|
284
|
+
api.show(id);
|
|
285
|
+
}
|
|
286
|
+
} else {
|
|
286
287
|
api.toggle(id);
|
|
287
288
|
selected.classed($FOCUS.legendItemFocused, false);
|
|
288
289
|
}
|
|
@@ -458,7 +459,8 @@ function getCanvasFocusData($$, d, selectedData) {
|
|
|
458
459
|
function getCanvasEventPoint($$, event) {
|
|
459
460
|
const point = getCanvasEventClientPoint(event);
|
|
460
461
|
if (!point) return null;
|
|
461
|
-
const
|
|
462
|
+
const canvas = $$.$el.canvas.node();
|
|
463
|
+
const rect = getBoundingRect(canvas, true);
|
|
462
464
|
return [point.clientX - rect.left, point.clientY - rect.top];
|
|
463
465
|
}
|
|
464
466
|
/**
|
|
@@ -1431,10 +1433,12 @@ const canvasInternal = {
|
|
|
1431
1433
|
if (!config.data_selection_enabled) return;
|
|
1432
1434
|
if (singleSelection) {
|
|
1433
1435
|
indices = indices?.length ? [indices[0]] : [0];
|
|
1434
|
-
if (!selectionGrouped)
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1436
|
+
if (!selectionGrouped) {
|
|
1437
|
+
if (targetIds) targetIds = targetIds.slice(0, 1);
|
|
1438
|
+
else {
|
|
1439
|
+
const [firstTarget] = $$.filterTargetsToShow($$.data.targets);
|
|
1440
|
+
targetIds = firstTarget ? [firstTarget.id] : [];
|
|
1441
|
+
}
|
|
1438
1442
|
}
|
|
1439
1443
|
}
|
|
1440
1444
|
eachCanvasSelectableData($$, (d) => {
|
|
@@ -2245,6 +2249,7 @@ const canvasInternal = {
|
|
|
2245
2249
|
const $$ = this;
|
|
2246
2250
|
const { config, state, $el } = $$;
|
|
2247
2251
|
const container = $el.chart.node();
|
|
2252
|
+
$$.clearResizePreview();
|
|
2248
2253
|
$el.chart.style("min-height", `${state.current.height}px`);
|
|
2249
2254
|
$$.canvasEngine?.resize(state.current.width, $$.getCanvasSurfaceHeight());
|
|
2250
2255
|
$$.canvasTheme?.reload(container, config.canvas_theme);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import point_default from "../../../ChartInternal/shape/core/point.js";
|
|
11
11
|
import line_default from "../../../ChartInternal/shape/line.js";
|
package/dist-esm/core.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isObject } from "./module/util/type-checks.js";
|
|
11
11
|
import { mergeObj } from "./module/util/object.js";
|
|
@@ -18,7 +18,7 @@ import Chart from "./Chart/Chart.js";
|
|
|
18
18
|
let defaults = Object.create(null);
|
|
19
19
|
/**
|
|
20
20
|
* @namespace bb
|
|
21
|
-
* @version 4.1.0
|
|
21
|
+
* @version 4.1.0
|
|
22
22
|
*/
|
|
23
23
|
const bb = {
|
|
24
24
|
/**
|
|
@@ -28,7 +28,7 @@ const bb = {
|
|
|
28
28
|
* bb.version; // "1.0.0"
|
|
29
29
|
* @memberof bb
|
|
30
30
|
*/
|
|
31
|
-
version: "4.1.0
|
|
31
|
+
version: "4.1.0",
|
|
32
32
|
/**
|
|
33
33
|
* Generate chart
|
|
34
34
|
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|
|
@@ -165,7 +165,8 @@ const bb = {
|
|
|
165
165
|
* // stay SVG-only because canvas mode doesn't provide meaningful benefit.
|
|
166
166
|
*/
|
|
167
167
|
generate(config) {
|
|
168
|
-
const
|
|
168
|
+
const options = mergeObj(Object.create(null), defaults, config);
|
|
169
|
+
const inst = new Chart(options);
|
|
169
170
|
inst.internal.charts = this.instance;
|
|
170
171
|
this.instance.push(inst);
|
|
171
172
|
return inst;
|
package/dist-esm/index.canvas.js
CHANGED
package/dist-esm/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import "./Chart/api/stubs.js";
|
|
11
11
|
import { area, areaLineRange, areaSpline, areaSplineRange, areaStep, areaStepRange } from "./config/resolver/shape/area.js";
|
package/dist-esm/module/Cache.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isString } from "./util/type-checks.js";
|
|
11
11
|
//#region src/module/Cache.ts
|
|
@@ -21,9 +21,9 @@ const KEY = {
|
|
|
21
21
|
dataMinMax: "$dataMinMax",
|
|
22
22
|
dataTotalSum: "$dataTotalSum",
|
|
23
23
|
dataTotalPerIndex: "$totalPerIndex",
|
|
24
|
+
visibleTotalPerIndex: "$visibleTotalPerIndex",
|
|
24
25
|
domainMinMax: "$domainMinMax",
|
|
25
26
|
filteredTargets: "$filteredTargets",
|
|
26
|
-
filteredNullish: "$filteredNullish",
|
|
27
27
|
svgLeft: "$svgLeft",
|
|
28
28
|
valuesByX: "$valuesByX",
|
|
29
29
|
legendItemTextBox: "legendItemTextBox",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
//#region src/module/browser.ts
|
|
11
11
|
/**
|
|
@@ -46,4 +46,4 @@ const win = getGlobal();
|
|
|
46
46
|
const doc = win?.document;
|
|
47
47
|
const [requestAnimationFrame, cancelAnimationFrame, requestIdleCallback, cancelIdleCallback] = getFallback(win);
|
|
48
48
|
//#endregion
|
|
49
|
-
export { cancelIdleCallback, doc as document, getFallback, requestAnimationFrame, requestIdleCallback, win as window };
|
|
49
|
+
export { cancelAnimationFrame, cancelIdleCallback, doc as document, getFallback, requestAnimationFrame, requestIdleCallback, win as window };
|
package/dist-esm/module/dsv.js
CHANGED
package/dist-esm/module/error.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { API_MODULE_NEEDED, TYPE, TYPE_METHOD_NEEDED } from "../config/const.js";
|
|
11
11
|
import { window as win } from "./browser.js";
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
|
-
import { cancelIdleCallback, requestIdleCallback, window as win } from "./browser.js";
|
|
10
|
+
import { cancelAnimationFrame, cancelIdleCallback, requestAnimationFrame, requestIdleCallback, window as win } from "./browser.js";
|
|
11
11
|
import { isArray, isNumber } from "./util/type-checks.js";
|
|
12
12
|
import { runUntil } from "./util/object.js";
|
|
13
13
|
import { isTabVisible } from "./util/dom.js";
|
|
@@ -16,14 +16,21 @@ const { setTimeout, clearTimeout } = win;
|
|
|
16
16
|
/**
|
|
17
17
|
* Generate resize queue function
|
|
18
18
|
* @param {boolean|number} option Resize option
|
|
19
|
+
* @param {()=>void} live Called on every resize event, throttled by animation frame.
|
|
20
|
+
* Used to reflect the size change before the delayed call takes place.
|
|
19
21
|
* @returns {Fucntion}
|
|
20
22
|
* @private
|
|
21
23
|
*/
|
|
22
|
-
function generateResize(option) {
|
|
24
|
+
function generateResize(option, live) {
|
|
23
25
|
const fn = [];
|
|
24
26
|
let timeout;
|
|
27
|
+
let rafId = null;
|
|
25
28
|
const callResizeFn = function() {
|
|
26
29
|
callResizeFn.clear();
|
|
30
|
+
if (live && rafId === null) rafId = requestAnimationFrame(() => {
|
|
31
|
+
rafId = null;
|
|
32
|
+
live();
|
|
33
|
+
});
|
|
27
34
|
if (option === false) timeout = requestIdleCallback(() => {
|
|
28
35
|
timeout = null;
|
|
29
36
|
fn.forEach((f) => f());
|
|
@@ -39,6 +46,12 @@ function generateResize(option) {
|
|
|
39
46
|
timeout = null;
|
|
40
47
|
}
|
|
41
48
|
};
|
|
49
|
+
callResizeFn.clearLive = () => {
|
|
50
|
+
if (rafId !== null) {
|
|
51
|
+
cancelAnimationFrame(rafId);
|
|
52
|
+
rafId = null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
42
55
|
callResizeFn.add = (f) => fn.push(f);
|
|
43
56
|
callResizeFn.remove = (f) => {
|
|
44
57
|
const index = fn.indexOf(f);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { document as doc, window as win } from "../browser.js";
|
|
11
11
|
import { isString } from "./type-checks.js";
|
|
@@ -280,12 +280,14 @@ function convertInputType(mouse, touch) {
|
|
|
280
280
|
const { DocumentTouch, matchMedia, navigator } = win;
|
|
281
281
|
const hasPointerCoarse = matchMedia?.("(pointer:coarse)").matches;
|
|
282
282
|
let hasTouch = false;
|
|
283
|
-
if (touch)
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
283
|
+
if (touch) {
|
|
284
|
+
if (navigator && "maxTouchPoints" in navigator) hasTouch = navigator.maxTouchPoints > 0;
|
|
285
|
+
else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) hasTouch = true;
|
|
286
|
+
else if (hasPointerCoarse) hasTouch = true;
|
|
287
|
+
else {
|
|
288
|
+
const UA = navigator.userAgent;
|
|
289
|
+
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
290
|
+
}
|
|
289
291
|
}
|
|
290
292
|
return mouse && !hasPointerCoarse && matchMedia?.("(pointer:fine)").matches && "mouse" || hasTouch && "touch" || "mouse";
|
|
291
293
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { requestAnimationFrame } from "../browser.js";
|
|
11
11
|
import { isArray, isDefined, isFunction, isNumber, isObject, isString, notEmpty } from "./type-checks.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -63,7 +63,7 @@ var Plugin = class {
|
|
|
63
63
|
$$;
|
|
64
64
|
options;
|
|
65
65
|
config;
|
|
66
|
-
static version = "4.1.0
|
|
66
|
+
static version = "4.1.0";
|
|
67
67
|
/**
|
|
68
68
|
* Constructor
|
|
69
69
|
* @param {Any} options config option object
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -31,20 +31,6 @@ const $COMMON = {
|
|
|
31
31
|
//#region src/module/util/type-checks.ts
|
|
32
32
|
const isDefined = (v) => typeof v !== "undefined";
|
|
33
33
|
const isObjectType = (v) => typeof v === "object";
|
|
34
|
-
/**
|
|
35
|
-
* Check if is array
|
|
36
|
-
* @param {Array} arr Data to be checked
|
|
37
|
-
* @returns {boolean}
|
|
38
|
-
* @private
|
|
39
|
-
*/
|
|
40
|
-
const isArray = (arr) => Array.isArray(arr);
|
|
41
|
-
/**
|
|
42
|
-
* Check if is object
|
|
43
|
-
* @param {object} obj Data to be checked
|
|
44
|
-
* @returns {boolean}
|
|
45
|
-
* @private
|
|
46
|
-
*/
|
|
47
|
-
const isObject = (obj) => obj && !obj?.nodeType && isObjectType(obj) && !isArray(obj);
|
|
48
34
|
//#endregion
|
|
49
35
|
//#region src/module/browser.ts
|
|
50
36
|
/**
|
|
@@ -85,30 +71,6 @@ const win = getGlobal();
|
|
|
85
71
|
const doc = win?.document;
|
|
86
72
|
const [requestAnimationFrame, cancelAnimationFrame, requestIdleCallback, cancelIdleCallback] = getFallback(win);
|
|
87
73
|
//#endregion
|
|
88
|
-
//#region src/module/util/object.ts
|
|
89
|
-
/**
|
|
90
|
-
* Merge object returning new object
|
|
91
|
-
* @param {object} target Target object
|
|
92
|
-
* @param {object} objectN Source object
|
|
93
|
-
* @returns {object} merged target object
|
|
94
|
-
* @private
|
|
95
|
-
*/
|
|
96
|
-
function mergeObj(target, ...objectN) {
|
|
97
|
-
if (!objectN.length || objectN.length === 1 && !objectN[0]) return target;
|
|
98
|
-
const source = objectN.shift();
|
|
99
|
-
if (isObject(target) && isObject(source)) Object.keys(source).forEach((key) => {
|
|
100
|
-
if (!/^(__proto__|constructor|prototype)$/i.test(key)) {
|
|
101
|
-
const value = source[key];
|
|
102
|
-
if (value instanceof Date) target[key] = new Date(value.getTime());
|
|
103
|
-
else if (isObject(value)) {
|
|
104
|
-
!target[key] && (target[key] = {});
|
|
105
|
-
target[key] = mergeObj(target[key], value);
|
|
106
|
-
} else target[key] = isArray(value) ? value.concat() : value;
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
return mergeObj(target, ...objectN);
|
|
110
|
-
}
|
|
111
|
-
//#endregion
|
|
112
74
|
//#region src/module/util/dom.ts
|
|
113
75
|
/**
|
|
114
76
|
* Get boundingClientRect or BBox with caching.
|
|
@@ -207,7 +169,7 @@ var Plugin = class {
|
|
|
207
169
|
$$;
|
|
208
170
|
options;
|
|
209
171
|
config;
|
|
210
|
-
static version = "4.1.0
|
|
172
|
+
static version = "4.1.0";
|
|
211
173
|
/**
|
|
212
174
|
* Constructor
|
|
213
175
|
* @param {Any} options config option object
|