]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Turn on excludeNotExported (#7121)
authorBen McCann <322311+benmccann@users.noreply.github.com>
Thu, 20 Feb 2020 17:18:21 +0000 (09:18 -0800)
committerGitHub <noreply@github.com>
Thu, 20 Feb 2020 17:18:21 +0000 (12:18 -0500)
32 files changed:
babel.config.json
karma.conf.js
src/controllers/controller.bar.js
src/controllers/controller.bubble.js
src/controllers/controller.doughnut.js
src/controllers/controller.horizontalBar.js
src/controllers/controller.line.js
src/controllers/controller.polarArea.js
src/controllers/controller.radar.js
src/core/core.adapters.js
src/core/core.animation.js
src/core/core.animator.js
src/core/core.controller.js
src/core/core.datasetController.js
src/core/core.defaults.js
src/core/core.element.js
src/core/core.plugins.js
src/core/core.scale.js
src/elements/element.arc.js
src/elements/element.line.js
src/elements/element.point.js
src/elements/element.rectangle.js
src/plugins/plugin.legend.js
src/plugins/plugin.title.js
src/plugins/plugin.tooltip.js
src/scales/scale.category.js
src/scales/scale.linear.js
src/scales/scale.linearbase.js
src/scales/scale.logarithmic.js
src/scales/scale.radialLinear.js
src/scales/scale.time.js
tsconfig.json

index 7d471fa0ba5a6e761cf5b2ffa463cfec3f926457..8f0b771ebf879c10ccb0526c1e471f3f8c9e882c 100644 (file)
@@ -1,8 +1,8 @@
 {
   "presets": ["@babel/preset-env"],
   "plugins": [
-    "@babel/plugin-transform-object-assign",
-    "@babel/plugin-proposal-class-properties"
+    "@babel/plugin-proposal-class-properties",
+    "@babel/plugin-transform-object-assign"
   ],
   "env": {
     "test": {
index 629bf2c061af56eacd031df0fc0c7874d485ad36..9a37cbf1a7ed57d8c70d8822d05b6eba77ebb42d 100644 (file)
@@ -1,9 +1,9 @@
 /* eslint-disable import/no-commonjs */
 
+const babel = require('rollup-plugin-babel');
 const commonjs = require('rollup-plugin-commonjs');
 const resolve = require('rollup-plugin-node-resolve');
 const builds = require('./rollup.config');
-const babel = require('rollup-plugin-babel');
 
 module.exports = function(karma) {
        const args = karma.args || {};
index 6edea91f0526c7b7b11a4cb811b08f2e1ebd786a..67b09bcdb46e23bfbb501cfc7c5a76704df289cf 100644 (file)
@@ -179,7 +179,7 @@ function isFloatBar(custom) {
        return custom && custom.barStart !== undefined && custom.barEnd !== undefined;
 }
 
-class BarController extends DatasetController {
+export default class BarController extends DatasetController {
 
        /**
         * Overriding primitive data parsing since we support mixed primitive/array
@@ -510,5 +510,3 @@ BarController.prototype._dataElementOptions = [
        'maxBarThickness',
        'minBarLength'
 ];
-
-export default BarController;
index 2739c40001a80d366105c353c44b7e1521315c88..4f5455c9e558420e7f8cbee167a89471fa4eb305 100644 (file)
@@ -30,7 +30,7 @@ defaults.set('bubble', {
        }
 });
 
-class BubbleController extends DatasetController {
+export default class BubbleController extends DatasetController {
 
        /**
         * Parse array of objects
@@ -186,6 +186,3 @@ BubbleController.prototype._dataElementOptions = [
        'pointStyle',
        'rotation'
 ];
-
-
-export default BubbleController;
index 1d987adbffaf17ea3ac71f06833cc02f899fb931..18474288167b7f50a09ac68c2c21ecb62d62912f 100644 (file)
@@ -128,7 +128,7 @@ function getRatioAndOffset(rotation, circumference, cutout) {
        return {ratioX, ratioY, offsetX, offsetY};
 }
 
-class DoughnutController extends DatasetController {
+export default class DoughnutController extends DatasetController {
 
        constructor(chart, datasetIndex) {
                super(chart, datasetIndex);
@@ -356,5 +356,3 @@ DoughnutController.prototype._dataElementOptions = [
        'hoverBorderColor',
        'hoverBorderWidth',
 ];
-
-export default DoughnutController;
index 52664d41103900862c9132987bb1fa74d9d2eb5e..cedffa6789a6800b574e3a3cd2f3f8c450b49ae4 100644 (file)
@@ -40,7 +40,7 @@ defaults.set('horizontalBar', {
        }
 });
 
-class HorizontalBarController extends BarController {
+export default class HorizontalBarController extends BarController {
 
        /**
         * @private
@@ -56,5 +56,3 @@ class HorizontalBarController extends BarController {
                return this._cachedMeta.yAxisID;
        }
 }
-
-export default HorizontalBarController;
index 5dd458477119b713e931fe37c3228ac71039d9ce..5a74b8b62eb66650d9e414e4c5e8672006fc39df 100644 (file)
@@ -24,7 +24,7 @@ defaults.set('line', {
        }
 });
 
-class LineController extends DatasetController {
+export default class LineController extends DatasetController {
 
        constructor(chart, datasetIndex) {
                super(chart, datasetIndex);
@@ -195,5 +195,3 @@ LineController.prototype._dataElementOptions = {
        radius: 'pointRadius',
        rotation: 'pointRotation'
 };
-
-export default LineController;
index 10a51a4796c7285ff54321462ede12b6fbe8cd09..0e1e3ad464de413dec2056bb269a6309df8c57db 100644 (file)
@@ -88,7 +88,7 @@ function getStartAngleRadians(deg) {
        return toRadians(deg) - 0.5 * Math.PI;
 }
 
-class PolarAreaController extends DatasetController {
+export default class PolarAreaController extends DatasetController {
 
        constructor(chart, datasetIndex) {
                super(chart, datasetIndex);
@@ -243,5 +243,3 @@ PolarAreaController.prototype._dataElementOptions = [
        'hoverBorderColor',
        'hoverBorderWidth'
 ];
-
-export default PolarAreaController;
index ce75db82acc4128b8e9f57cbb0a4b47afbad79c8..f53bf7567de679fa2735731b25ada70e201e2524 100644 (file)
@@ -18,7 +18,7 @@ defaults.set('radar', {
        }
 });
 
-class RadarController extends DatasetController {
+export default class RadarController extends DatasetController {
 
        /**
         * @private
@@ -147,5 +147,3 @@ RadarController.prototype._dataElementOptions = {
        radius: 'pointRadius',
        rotation: 'pointRotation'
 };
-
-export default RadarController;
index ea26870fd602b28797f5c4419febf0cce7929ec4..5a13a8304b07c892a1a61b3a97652f0f210e291f 100644 (file)
@@ -24,7 +24,7 @@ function abstract() {
  * @memberof Chart._adapters._date
  */
 
-class DateAdapter {
+export class DateAdapter {
 
        constructor(options) {
                this.options = options || {};
index 59bb03015e490ff2244219c0f6de2b0c8700ea01..8fc7c11cbee94331a144dab485d4b4d0cb92dcd8 100644 (file)
@@ -19,7 +19,7 @@ const interpolators = {
        }
 };
 
-class Animation {
+export default class Animation {
        constructor(cfg, target, prop, to) {
                const currentValue = target[prop];
 
@@ -80,5 +80,3 @@ class Animation {
                me._target[prop] = me._fn(from, to, factor);
        }
 }
-
-export default Animation;
index 1da3830391c796b7fcb47f5eb61881219be265a9..b034b7e137e56b21ba7ddb2ddabbdfa7811f5425 100644 (file)
@@ -18,7 +18,10 @@ function drawFPS(chart, count, date, lastDate) {
        ctx.restore();
 }
 
-class Animator {
+/**
+ * Please use the module's default export which provides a singleton instance
+ */
+export class Animator {
        constructor() {
                this._request = null;
                this._charts = new Map();
@@ -220,6 +223,5 @@ class Animator {
        }
 }
 
-const instance = new Animator();
-
-export default instance;
+// singleton instance
+export default new Animator();
index 33cc21495b6ed5493419df5154612a3c0f80bab5..7b684b08a2086f44bcb3efb1e6f5a2de90abc938 100644 (file)
@@ -173,9 +173,17 @@ function getCanvas(item) {
        return item;
 }
 
-class Chart {
+export default class Chart {
+
        static version = version;
 
+       /**
+        * NOTE(SB) We actually don't use this container anymore but we need to keep it
+        * for backward compatibility. Though, it can still be useful for plugins that
+        * would need to work on multiple charts?!
+        */
+       static instances = {};
+
        constructor(item, config) {
                const me = this;
 
@@ -1073,12 +1081,3 @@ class Chart {
                return changed;
        }
 }
-
-/**
- * NOTE(SB) We actually don't use this container anymore but we need to keep it
- * for backward compatibility. Though, it can still be useful for plugins that
- * would need to work on multiple charts?!
- */
-Chart.instances = {};
-
-export default Chart;
index 08bb7ea9561b939f8e4dea92294b2784e74feda5..bf14736a1d110a6255c4a19a42e5163c4af82271 100644 (file)
@@ -210,7 +210,9 @@ function getFirstScaleId(chart, axis) {
        return Object.keys(scales).filter(key => scales[key].axis === axis).shift();
 }
 
-class DatasetController {
+export default class DatasetController {
+
+       static extend = helpers.inherits;
 
        constructor(chart, datasetIndex) {
                this.chart = chart;
@@ -829,7 +831,7 @@ class DatasetController {
                const chart = me.chart;
                const datasetOpts = me._config;
                // @ts-ignore
-               const options = chart.options.elements[me.datasetElementType.prototype._type] || {};
+               const options = chart.options.elements[me.datasetElementType._type] || {};
                const elementOptions = me._datasetElementOptions;
                const values = {};
                const context = me._getContext(undefined, active);
@@ -863,7 +865,7 @@ class DatasetController {
                const chart = me.chart;
                const datasetOpts = me._config;
                // @ts-ignore
-               const options = chart.options.elements[me.dataElementType.prototype._type] || {};
+               const options = chart.options.elements[me.dataElementType._type] || {};
                const elementOptions = me._dataElementOptions;
                const values = {};
                const context = me._getContext(index, active);
@@ -1128,8 +1130,6 @@ class DatasetController {
        }
 }
 
-DatasetController.extend = helpers.inherits;
-
 /**
  * Element type used to generate a meta dataset (e.g. Chart.element.Line).
  */
@@ -1170,5 +1170,3 @@ DatasetController.prototype._dataElementOptions = [
        'borderWidth',
        'pointStyle'
 ];
-
-export default DatasetController;
index 3b60e87d34adf88e83d024caf64a47a18605ad14..33214dac874a6aa087cb2eacee4ff3b4b795f4db 100644 (file)
@@ -1,6 +1,9 @@
 import {merge} from '../helpers/helpers.core';
 
-class Defaults {
+/**
+ * Please use the module's default export which provides a singleton instance
+ */
+export class Defaults {
        constructor() {
                this.color = 'rgba(0,0,0,0.1)';
                this.elements = {};
@@ -35,7 +38,6 @@ class Defaults {
        /**
         * @param {string} scope
         * @param {*} values
-        * @private
         */
        set(scope, values) {
                return merge(this[scope] || (this[scope] = {}), values);
index 77cbc8ccb527aa6ee27755097eb3cbd7679ab20d..54f4d77e978c7255649de3cb12f4e52b4b70919a 100644 (file)
@@ -1,7 +1,9 @@
 import {inherits} from '../helpers/helpers.core';
 import {isNumber} from '../helpers/helpers.math';
 
-class Element {
+export default class Element {
+
+       static extend = inherits;
 
        /**
         * @param {object} [cfg] optional configuration
@@ -27,6 +29,3 @@ class Element {
                return isNumber(this.x) && isNumber(this.y);
        }
 }
-
-Element.extend = inherits;
-export default Element;
index f530ac9ffc5f8a89b6e19dec2e6c73eea5ab6ba1..9709fbe2e9bb9b807efcea1af17d7a596c77b977 100644 (file)
@@ -14,7 +14,7 @@ defaults.set('plugins', {});
  * @namespace Chart.plugins
  * @since 2.1.0
  */
-class PluginService {
+export class PluginService {
        constructor() {
                /**
                 * Globally registered plugins.
index 1b9d31e011dca6f856e1cbc3496f34c0dc6ac96f..63fc8973f8888a6e81efbfaa36fc288637b333c5 100644 (file)
@@ -223,7 +223,7 @@ function skip(ticks, newTicks, spacing, majorStart, majorEnd) {
        }
 }
 
-class Scale extends Element {
+export default class Scale extends Element {
 
        // eslint-disable-next-line max-statements
        constructor(cfg) {
@@ -1572,5 +1572,3 @@ class Scale extends Element {
 }
 
 Scale.prototype._draw = Scale.prototype.draw;
-
-export default Scale;
index 5860216f1524871c0f86681cbb0843da02e6f6e1..8c972b5216db986cf6d881d6c3ea38b2321f9aa4 100644 (file)
@@ -84,7 +84,9 @@ function drawBorder(ctx, vm, arc) {
        ctx.stroke();
 }
 
-class Arc extends Element {
+export default class Arc extends Element {
+
+       static _type = 'arc';
 
        constructor(cfg) {
                super();
@@ -184,7 +186,3 @@ class Arc extends Element {
                ctx.restore();
        }
 }
-
-Arc.prototype._type = 'arc';
-
-export default Arc;
index 7836b3fa112bfac96b0ef4c947a253cf4e3aa420..eacb96fbb1a6f3aaeddacec844904d31eb313af3 100644 (file)
@@ -196,7 +196,9 @@ function _getInterpolationMethod(options) {
        return _pointInLine;
 }
 
-class Line extends Element {
+export default class Line extends Element {
+
+       static _type = 'line';
 
        constructor(cfg) {
                super();
@@ -355,7 +357,3 @@ class Line extends Element {
                ctx.restore();
        }
 }
-
-Line.prototype._type = 'line';
-
-export default Line;
index e3c7c4e8ee66453ab76f283e206c7cb23cadff5f..6fc760f067a1cc57761860d5c4cffe14b93e28cd 100644 (file)
@@ -18,7 +18,9 @@ defaults.set('elements', {
        }
 });
 
-class Point extends Element {
+export default class Point extends Element {
+
+       static _type = 'point';
 
        constructor(cfg) {
                super();
@@ -89,7 +91,3 @@ class Point extends Element {
                return options.radius + options.hitRadius;
        }
 }
-
-Point.prototype._type = 'point';
-
-export default Point;
index b9bab5ac8505e495ea9dd67bb2f390c694fc6e28..57a933c2669baf71ad7f6408dcf72e855ac8df4a 100644 (file)
@@ -126,7 +126,9 @@ function inRange(bar, x, y) {
                && (skipY || y >= bounds.top && y <= bounds.bottom);
 }
 
-class Rectangle extends Element {
+export default class Rectangle extends Element {
+
+       static _type = 'rectangle';
 
        constructor(cfg) {
                super();
@@ -194,7 +196,3 @@ class Rectangle extends Element {
                return axis === 'x' ? this.width / 2 : this.height / 2;
        }
 }
-
-Rectangle.prototype._type = 'rectangle';
-
-export default Rectangle;
index 1a40e55c9b3eda88cf5c8aad3d1df1c4c71d381e..1b8a27cd4da01da9a1bbf0c9b6595c514d047037 100644 (file)
@@ -95,10 +95,7 @@ function getBoxWidth(labelOpts, fontSize) {
                labelOpts.boxWidth;
 }
 
-/**
- * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!
- */
-class Legend extends Element {
+export class Legend extends Element {
 
        constructor(config) {
                super();
index 65b9bf5ba143d8412b732bd85daceefdb12455e6..9f4ce932a6760ede2cdc6232f43df87cbffab6a0 100644 (file)
@@ -14,10 +14,7 @@ defaults.set('title', {
        weight: 2000         // by default greater than legend (1000) to be above
 });
 
-/**
- * IMPORTANT: this class is exposed publicly as Chart.Title, backward compatibility required!
- */
-class Title extends Element {
+export class Title extends Element {
        constructor(config) {
                super();
 
index 85664e721b9451d02a61454c4763e72eb8c99e42..75415ebb36d0dc4ae06de09d46d1647ea90158a7 100644 (file)
@@ -449,7 +449,7 @@ function getBeforeAfterBodyLines(callback) {
        return pushOrConcat([], splitNewlines(callback));
 }
 
-class Tooltip extends Element {
+export class Tooltip extends Element {
        constructor(config) {
                super();
 
index a30409a6a17ea8f35f8872784ebb0d1bc2c49bdd..9a2e1fb592eb669dcc086674cfb5673cddec2e22 100644 (file)
@@ -3,7 +3,10 @@ import Scale from '../core/core.scale';
 const defaultConfig = {
 };
 
-class CategoryScale extends Scale {
+export default class CategoryScale extends Scale {
+
+       // INTERNAL: static default options, registered in src/index.js
+       static _defaults = defaultConfig;
 
        constructor(cfg) {
                super(cfg);
@@ -106,7 +109,3 @@ class CategoryScale extends Scale {
                return this.bottom;
        }
 }
-
-// INTERNAL: static default options, registered in src/index.js
-CategoryScale._defaults = defaultConfig;
-export default CategoryScale;
index 8d7f0c4c359ac230163ac030551255574263fe2d..abf878dd26dcccdfcb5af370bb9be3a8bcf21c15 100644 (file)
@@ -9,7 +9,11 @@ const defaultConfig = {
        }
 };
 
-class LinearScale extends LinearScaleBase {
+export default class LinearScale extends LinearScaleBase {
+
+       // INTERNAL: static default options, registered in src/index.js
+       static _defaults = defaultConfig;
+
        determineDataLimits() {
                const me = this;
                const options = me.options;
@@ -70,7 +74,3 @@ class LinearScale extends LinearScaleBase {
                return this.getPixelForValue(ticks[index].value);
        }
 }
-
-// INTERNAL: static default options, registered in src/index.js
-LinearScale._defaults = defaultConfig;
-export default LinearScale;
index d8b2e360ac1ea62dd053676f36e196c07e7b0f18..69a2ae1a0717589ccc713b4bd74eb9011248715b 100644 (file)
@@ -106,7 +106,7 @@ function generateTicks(generationOptions, dataRange) {
        return ticks;
 }
 
-class LinearScaleBase extends Scale {
+export default class LinearScaleBase extends Scale {
 
        constructor(cfg) {
                super(cfg);
@@ -302,5 +302,3 @@ class LinearScaleBase extends Scale {
                return new Intl.NumberFormat(this.options.locale).format(value);
        }
 }
-
-export default LinearScaleBase;
index 2b21b78e5f55c885a8d0ab30e1d1744d320b816a..261174d44898e458f6a4c08ca9fb16125b2a2729 100644 (file)
@@ -57,7 +57,10 @@ const defaultConfig = {
        }
 };
 
-class LogarithmicScale extends Scale {
+export default class LogarithmicScale extends Scale {
+
+       // INTERNAL: static default options, registered in src/index.js
+       static _defaults = defaultConfig;
 
        constructor(cfg) {
                super(cfg);
@@ -194,7 +197,3 @@ class LogarithmicScale extends Scale {
                return Math.pow(10, me._startValue + decimal * me._valueRange);
        }
 }
-
-// INTERNAL: static default options, registered in src/index.js
-LogarithmicScale._defaults = defaultConfig;
-export default LogarithmicScale;
index bf74e92fc057b5361a8e2d34cd25c5d5d168abd4..0b82e5d93b1fa84986b13680fa024a7375d3f54f 100644 (file)
@@ -290,7 +290,10 @@ function numberOrZero(param) {
        return isNumber(param) ? param : 0;
 }
 
-class RadialLinearScale extends LinearScaleBase {
+export default class RadialLinearScale extends LinearScaleBase {
+
+       // INTERNAL: static default options, registered in src/index.js
+       static _defaults = defaultConfig;
 
        constructor(cfg) {
                super(cfg);
@@ -540,7 +543,3 @@ class RadialLinearScale extends LinearScaleBase {
         */
        _drawTitle() {}
 }
-
-// INTERNAL: static default options, registered in src/index.js
-RadialLinearScale._defaults = defaultConfig;
-export default RadialLinearScale;
index 7f4fcd6a77e7672f3fdfb00a8de75f723b2f2432..9b25dc5b2301d382a7c7b813f6612d78ebf721e5 100644 (file)
@@ -564,7 +564,10 @@ const defaultConfig = {
        }
 };
 
-class TimeScale extends Scale {
+export default class TimeScale extends Scale {
+
+       // INTERNAL: static default options, registered in src/index.js
+       static _defaults = defaultConfig;
 
        /**
         * @param {object} props
@@ -844,7 +847,3 @@ class TimeScale extends Scale {
                return capacity > 0 ? capacity : 1;
        }
 }
-
-// INTERNAL: static default options, registered in src/index.js
-TimeScale._defaults = defaultConfig;
-export default TimeScale;
index 67450a43dd577327febf2c35cc7ad2fd964d0eaf..0997d3393b7e6123839884b1868a1ef52e339f58 100644 (file)
@@ -13,6 +13,7 @@
   "typedocOptions": {
     "name": "Chart.js",
     "excludeExternals": true,
+    "excludeNotExported": true,
     "includeVersion": true,
     "inputFiles": ["./src"],
     "out": "./dist/docs/typedoc"