@vaadin/charts 23.2.0-dev.8a7678b70 → 23.2.0-rc1

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/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@vaadin/charts",
3
- "version": "23.2.0-dev.8a7678b70",
3
+ "version": "23.2.0-rc1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
7
  "description": "vaadin-charts",
8
- "license": "https://raw.githubusercontent.com/vaadin/web-components/master/packages/charts/LICENSE",
8
+ "license": "SEE LICENSE IN LICENSE",
9
9
  "cvdlName": "vaadin-chart",
10
10
  "repository": {
11
11
  "type": "git",
@@ -24,7 +24,9 @@
24
24
  "src",
25
25
  "theme",
26
26
  "vaadin-*.d.ts",
27
- "vaadin-*.js"
27
+ "vaadin-*.js",
28
+ "web-types.json",
29
+ "web-types.lit.json"
28
30
  ],
29
31
  "keywords": [
30
32
  "Vaadin",
@@ -35,9 +37,8 @@
35
37
  ],
36
38
  "dependencies": {
37
39
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "23.2.0-dev.8a7678b70",
39
- "@vaadin/vaadin-license-checker": "^2.1.0",
40
- "@vaadin/vaadin-themable-mixin": "23.2.0-dev.8a7678b70",
40
+ "@vaadin/component-base": "23.2.0-rc1",
41
+ "@vaadin/vaadin-themable-mixin": "23.2.0-rc1",
41
42
  "highcharts": "9.2.2"
42
43
  },
43
44
  "devDependencies": {
@@ -45,5 +46,9 @@
45
46
  "@vaadin/testing-helpers": "^0.3.2",
46
47
  "sinon": "^13.0.2"
47
48
  },
48
- "gitHead": "85b403f96d8282f262322b56c0ff4289f843d02a"
49
+ "web-types": [
50
+ "web-types.json",
51
+ "web-types.lit.json"
52
+ ],
53
+ "gitHead": "e78a1f2fe6f42d78cefa3f48085b09a3033c9588"
49
54
  }
@@ -3,9 +3,9 @@
3
3
  * Copyright (c) 2015 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
- import { PointOptionsObject, Series, SeriesOptionsType } from 'highcharts';
6
+ import type { PointOptionsObject, Series, SeriesOptionsType } from 'highcharts';
7
7
 
8
- export type ChartSeriesMarkers = 'shown' | 'hidden' | 'auto';
8
+ export type ChartSeriesMarkers = 'auto' | 'hidden' | 'shown';
9
9
 
10
10
  export interface ChartSeriesConfig {
11
11
  data?: ChartSeriesValues;
@@ -22,7 +22,7 @@ export interface ChartSeriesConfig {
22
22
 
23
23
  export type ChartSeriesOptions = ChartSeriesConfig & SeriesOptionsType;
24
24
 
25
- export type ChartSeriesValues = Array<number | number[] | PointOptionsObject>;
25
+ export type ChartSeriesValues = Array<number[] | PointOptionsObject | number>;
26
26
 
27
27
  /**
28
28
  * `<vaadin-chart-series>` is a custom element for creating series for Vaadin Charts.
@@ -3,14 +3,14 @@
3
3
  * Copyright (c) 2015 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
- import { Axis, Chart as HighchartsChart, ExtremesObject, Options, Point, Series } from 'highcharts';
6
+ import type { Axis, Chart as HighchartsChart, ExtremesObject, Options, Point, Series } from 'highcharts';
7
7
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
8
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
9
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
10
 
11
11
  export type ChartCategories = string[] | { [key: number]: string };
12
12
 
13
- export type ChartCategoryPosition = 'left' | 'right' | 'top' | 'bottom';
13
+ export type ChartCategoryPosition = 'bottom' | 'left' | 'right' | 'top';
14
14
 
15
15
  export type ChartStacking = 'normal' | 'percent' | null;
16
16
 
@@ -245,7 +245,7 @@ export interface ChartCustomEventMap {
245
245
  'yaxes-extremes-set': ChartYaxesExtremesSetEvent;
246
246
  }
247
247
 
248
- export type ChartEventMap = HTMLElementEventMap & ChartCustomEventMap;
248
+ export type ChartEventMap = ChartCustomEventMap & HTMLElementEventMap;
249
249
 
250
250
  /**
251
251
  * `<vaadin-chart>` is a Web Component for creating high quality charts.
@@ -346,8 +346,7 @@ export type ChartEventMap = HTMLElementEventMap & ChartCustomEventMap;
346
346
  * A comprehensive list of the supported style classes can be found at
347
347
  * https://www.highcharts.com/docs/chart-design-and-style/style-by-css
348
348
  *
349
- * See also the documentation for styling Vaadin components at
350
- * https://vaadin.com/docs/v14/themes/themes-and-styling-overview.html
349
+ * See also the [Chart Styling](https://vaadin.com/docs/latest/components/charts/css-styling) documentation.
351
350
  *
352
351
  * ### RTL support
353
352
  *
@@ -582,13 +581,13 @@ declare class Chart extends ResizeMixin(ThemableMixin(ElementMixin(HTMLElement))
582
581
  addEventListener<K extends keyof ChartEventMap>(
583
582
  type: K,
584
583
  listener: (this: Chart, ev: ChartEventMap[K]) => void,
585
- options?: boolean | AddEventListenerOptions,
584
+ options?: AddEventListenerOptions | boolean,
586
585
  ): void;
587
586
 
588
587
  removeEventListener<K extends keyof ChartEventMap>(
589
588
  type: K,
590
589
  listener: (this: Chart, ev: ChartEventMap[K]) => void,
591
- options?: boolean | EventListenerOptions,
590
+ options?: EventListenerOptions | boolean,
592
591
  ): void;
593
592
  }
594
593
 
@@ -3,7 +3,6 @@
3
3
  * Copyright (c) 2015 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
- import '@vaadin/vaadin-license-checker/vaadin-license-checker.js';
7
6
  import 'highcharts/es-modules/masters/highstock.src.js';
8
7
  import 'highcharts/es-modules/masters/modules/accessibility.src.js';
9
8
  import 'highcharts/es-modules/masters/highcharts-more.src.js';
@@ -35,7 +34,7 @@ export function deepMerge(target, source) {
35
34
  const isObject = (item) => item && typeof item === 'object' && !Array.isArray(item);
36
35
 
37
36
  if (isObject(source) && isObject(target)) {
38
- for (const key in source) {
37
+ Object.keys(source).forEach((key) => {
39
38
  if (isObject(source[key])) {
40
39
  if (!target[key]) {
41
40
  Object.assign(target, { [key]: {} });
@@ -45,7 +44,7 @@ export function deepMerge(target, source) {
45
44
  } else {
46
45
  Object.assign(target, { [key]: source[key] });
47
46
  }
48
- }
47
+ });
49
48
  }
50
49
 
51
50
  return target;
@@ -165,8 +164,7 @@ Highcharts.setOptions({ lang: { noData: '' } });
165
164
  * A comprehensive list of the supported style classes can be found at
166
165
  * https://www.highcharts.com/docs/chart-design-and-style/style-by-css
167
166
  *
168
- * See also the documentation for styling Vaadin components at
169
- * https://vaadin.com/docs/v14/themes/themes-and-styling-overview.html
167
+ * See also the [Chart Styling](https://vaadin.com/docs/latest/components/charts/css-styling) documentation.
170
168
  *
171
169
  * ### RTL support
172
170
  *
@@ -478,20 +476,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
478
476
  ];
479
477
  }
480
478
 
481
- /**
482
- * @protected
483
- */
484
- static _finalizeClass() {
485
- super._finalizeClass();
486
-
487
- const devModeCallback = window.Vaadin.developmentModeCallback;
488
- const licenseChecker = devModeCallback && devModeCallback['vaadin-license-checker'];
489
- /* c8 ignore next 3 */
490
- if (typeof licenseChecker === 'function') {
491
- licenseChecker(Chart);
492
- }
493
- }
494
-
495
479
  constructor() {
496
480
  super();
497
481
 
@@ -634,7 +618,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
634
618
  options.chart.inverted = this.__shouldInvert();
635
619
 
636
620
  if (Array.isArray(options.xAxis)) {
637
- options.xAxis.forEach((e) => (e.opposite = this.__shouldFlipOpposite()));
621
+ options.xAxis.forEach((e) => {
622
+ e.opposite = this.__shouldFlipOpposite();
623
+ });
638
624
  } else if (options.xAxis) {
639
625
  options.xAxis.opposite = this.__shouldFlipOpposite();
640
626
  }
@@ -1230,24 +1216,20 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1230
1216
 
1231
1217
  /** @private */
1232
1218
  __inflateFunctions(jsonConfiguration) {
1233
- for (const attr in jsonConfiguration) {
1234
- // eslint-disable-next-line no-prototype-builtins
1235
- if (jsonConfiguration.hasOwnProperty(attr)) {
1236
- const targetProperty = jsonConfiguration[attr];
1237
- if (attr.indexOf('_fn_') === 0 && (typeof targetProperty === 'string' || targetProperty instanceof String)) {
1238
- try {
1239
- // eslint-disable-next-line no-eval
1240
- jsonConfiguration[attr.substr(4)] = eval(`(${targetProperty})`);
1241
- } catch (e) {
1242
- // eslint-disable-next-line no-eval
1243
- jsonConfiguration[attr.substr(4)] = eval(`(function(){${targetProperty}})`);
1244
- }
1245
- delete jsonConfiguration[attr];
1246
- } else if (targetProperty instanceof Object) {
1247
- this.__inflateFunctions(targetProperty);
1219
+ Object.entries(jsonConfiguration).forEach(([attr, targetProperty]) => {
1220
+ if (attr.startsWith('_fn_') && (typeof targetProperty === 'string' || targetProperty instanceof String)) {
1221
+ try {
1222
+ // eslint-disable-next-line no-eval
1223
+ jsonConfiguration[attr.substr(4)] = eval(`(${targetProperty})`);
1224
+ } catch (e) {
1225
+ // eslint-disable-next-line no-eval
1226
+ jsonConfiguration[attr.substr(4)] = eval(`(function(){${targetProperty}})`);
1248
1227
  }
1228
+ delete jsonConfiguration[attr];
1229
+ } else if (targetProperty instanceof Object) {
1230
+ this.__inflateFunctions(targetProperty);
1249
1231
  }
1250
- }
1232
+ });
1251
1233
  }
1252
1234
 
1253
1235
  /** @private */
@@ -1366,6 +1348,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1366
1348
  this.tempBodyStyle = document.createElement('style');
1367
1349
  this.tempBodyStyle.textContent = effectiveCss;
1368
1350
  document.body.appendChild(this.tempBodyStyle);
1351
+ if (this.options.chart.styledMode) {
1352
+ document.body.setAttribute('styled-mode', '');
1353
+ }
1369
1354
  }
1370
1355
  }
1371
1356
 
@@ -1374,6 +1359,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1374
1359
  if (this.tempBodyStyle) {
1375
1360
  document.body.removeChild(this.tempBodyStyle);
1376
1361
  delete this.tempBodyStyle;
1362
+ if (this.options.chart.styledMode) {
1363
+ document.body.removeAttribute('styled-mode');
1364
+ }
1377
1365
  }
1378
1366
  }
1379
1367
 
@@ -1779,7 +1767,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1779
1767
  let style = '';
1780
1768
  if (this.hasAttribute('style')) {
1781
1769
  style = this.getAttribute('style');
1782
- if (style.charAt(style.length - 1) !== ';') {
1770
+ if (!style.endsWith(';')) {
1783
1771
  style += ';';
1784
1772
  }
1785
1773
  }