@vaadin/charts 23.2.0-dev.48e5e3967 → 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.48e5e3967",
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,8 +37,8 @@
35
37
  ],
36
38
  "dependencies": {
37
39
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "23.2.0-dev.48e5e3967",
39
- "@vaadin/vaadin-themable-mixin": "23.2.0-dev.48e5e3967",
40
+ "@vaadin/component-base": "23.2.0-rc1",
41
+ "@vaadin/vaadin-themable-mixin": "23.2.0-rc1",
40
42
  "highcharts": "9.2.2"
41
43
  },
42
44
  "devDependencies": {
@@ -44,5 +46,9 @@
44
46
  "@vaadin/testing-helpers": "^0.3.2",
45
47
  "sinon": "^13.0.2"
46
48
  },
47
- "gitHead": "961bc4ae5b707c3c02f12b99819b3c12c9b478aa"
49
+ "web-types": [
50
+ "web-types.json",
51
+ "web-types.lit.json"
52
+ ],
53
+ "gitHead": "e78a1f2fe6f42d78cefa3f48085b09a3033c9588"
48
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
 
@@ -34,7 +34,7 @@ export function deepMerge(target, source) {
34
34
  const isObject = (item) => item && typeof item === 'object' && !Array.isArray(item);
35
35
 
36
36
  if (isObject(source) && isObject(target)) {
37
- for (const key in source) {
37
+ Object.keys(source).forEach((key) => {
38
38
  if (isObject(source[key])) {
39
39
  if (!target[key]) {
40
40
  Object.assign(target, { [key]: {} });
@@ -44,7 +44,7 @@ export function deepMerge(target, source) {
44
44
  } else {
45
45
  Object.assign(target, { [key]: source[key] });
46
46
  }
47
- }
47
+ });
48
48
  }
49
49
 
50
50
  return target;
@@ -164,8 +164,7 @@ Highcharts.setOptions({ lang: { noData: '' } });
164
164
  * A comprehensive list of the supported style classes can be found at
165
165
  * https://www.highcharts.com/docs/chart-design-and-style/style-by-css
166
166
  *
167
- * See also the documentation for styling Vaadin components at
168
- * 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.
169
168
  *
170
169
  * ### RTL support
171
170
  *
@@ -619,7 +618,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
619
618
  options.chart.inverted = this.__shouldInvert();
620
619
 
621
620
  if (Array.isArray(options.xAxis)) {
622
- options.xAxis.forEach((e) => (e.opposite = this.__shouldFlipOpposite()));
621
+ options.xAxis.forEach((e) => {
622
+ e.opposite = this.__shouldFlipOpposite();
623
+ });
623
624
  } else if (options.xAxis) {
624
625
  options.xAxis.opposite = this.__shouldFlipOpposite();
625
626
  }
@@ -1215,24 +1216,20 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1215
1216
 
1216
1217
  /** @private */
1217
1218
  __inflateFunctions(jsonConfiguration) {
1218
- for (const attr in jsonConfiguration) {
1219
- // eslint-disable-next-line no-prototype-builtins
1220
- if (jsonConfiguration.hasOwnProperty(attr)) {
1221
- const targetProperty = jsonConfiguration[attr];
1222
- if (attr.indexOf('_fn_') === 0 && (typeof targetProperty === 'string' || targetProperty instanceof String)) {
1223
- try {
1224
- // eslint-disable-next-line no-eval
1225
- jsonConfiguration[attr.substr(4)] = eval(`(${targetProperty})`);
1226
- } catch (e) {
1227
- // eslint-disable-next-line no-eval
1228
- jsonConfiguration[attr.substr(4)] = eval(`(function(){${targetProperty}})`);
1229
- }
1230
- delete jsonConfiguration[attr];
1231
- } else if (targetProperty instanceof Object) {
1232
- 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}})`);
1233
1227
  }
1228
+ delete jsonConfiguration[attr];
1229
+ } else if (targetProperty instanceof Object) {
1230
+ this.__inflateFunctions(targetProperty);
1234
1231
  }
1235
- }
1232
+ });
1236
1233
  }
1237
1234
 
1238
1235
  /** @private */
@@ -1351,6 +1348,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1351
1348
  this.tempBodyStyle = document.createElement('style');
1352
1349
  this.tempBodyStyle.textContent = effectiveCss;
1353
1350
  document.body.appendChild(this.tempBodyStyle);
1351
+ if (this.options.chart.styledMode) {
1352
+ document.body.setAttribute('styled-mode', '');
1353
+ }
1354
1354
  }
1355
1355
  }
1356
1356
 
@@ -1359,6 +1359,9 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1359
1359
  if (this.tempBodyStyle) {
1360
1360
  document.body.removeChild(this.tempBodyStyle);
1361
1361
  delete this.tempBodyStyle;
1362
+ if (this.options.chart.styledMode) {
1363
+ document.body.removeAttribute('styled-mode');
1364
+ }
1362
1365
  }
1363
1366
  }
1364
1367
 
@@ -1764,7 +1767,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
1764
1767
  let style = '';
1765
1768
  if (this.hasAttribute('style')) {
1766
1769
  style = this.getAttribute('style');
1767
- if (style.charAt(style.length - 1) !== ';') {
1770
+ if (!style.endsWith(';')) {
1768
1771
  style += ';';
1769
1772
  }
1770
1773
  }