@vaadin/charts 25.0.0-alpha8 → 25.0.0-beta1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/charts",
3
- "version": "25.0.0-alpha8",
3
+ "version": "25.0.0-beta1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "theme",
25
24
  "vaadin-*.d.ts",
26
25
  "vaadin-*.js",
27
26
  "web-types.json",
@@ -35,22 +34,22 @@
35
34
  ],
36
35
  "dependencies": {
37
36
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/component-base": "25.0.0-alpha8",
39
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha8",
40
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha8",
41
- "highcharts": "9.2.2",
37
+ "@vaadin/component-base": "25.0.0-beta1",
38
+ "@vaadin/vaadin-themable-mixin": "25.0.0-beta1",
39
+ "highcharts": "12.2.0",
42
40
  "lit": "^3.0.0"
43
41
  },
44
42
  "devDependencies": {
45
- "@vaadin/chai-plugins": "25.0.0-alpha8",
46
- "@vaadin/test-runner-commands": "25.0.0-alpha8",
43
+ "@vaadin/chai-plugins": "25.0.0-beta1",
44
+ "@vaadin/test-runner-commands": "25.0.0-beta1",
47
45
  "@vaadin/testing-helpers": "^2.0.0",
48
- "sinon": "^18.0.0"
46
+ "@vaadin/vaadin-lumo-styles": "25.0.0-beta1",
47
+ "sinon": "^21.0.0"
49
48
  },
50
49
  "cvdlName": "vaadin-chart",
51
50
  "web-types": [
52
51
  "web-types.json",
53
52
  "web-types.lit.json"
54
53
  ],
55
- "gitHead": "ebf53673d5f639d2b1b6f2b31f640f530643ee2f"
54
+ "gitHead": "1d20cf54e582d1f2e209126d4586f8b4c01c50e0"
56
55
  }
package/src/helpers.js CHANGED
@@ -57,3 +57,49 @@ export function deepMerge(target, source) {
57
57
 
58
58
  return target;
59
59
  }
60
+
61
+ export function prepareExport(chart) {
62
+ // Guard against another print 'before print' event coming before
63
+ // the 'after print' event.
64
+ if (!chart.tempBodyStyle) {
65
+ let effectiveCss = '';
66
+
67
+ // LitElement uses `adoptedStyleSheets` for adding styles
68
+ if (chart.shadowRoot.adoptedStyleSheets) {
69
+ chart.shadowRoot.adoptedStyleSheets.forEach((sheet) => {
70
+ effectiveCss += `${[...sheet.cssRules].map((rule) => rule.cssText).join('\n')}\n`;
71
+ });
72
+ }
73
+
74
+ // Strip off host selectors that target individual instances
75
+ effectiveCss = effectiveCss.replace(/:host\(.+?\)/gu, (match) => {
76
+ const selector = match.substr(6, match.length - 7);
77
+ return chart.matches(selector) ? '' : match;
78
+ });
79
+
80
+ // Zoom out a bit to avoid clipping the chart's edge on paper
81
+ effectiveCss =
82
+ `${effectiveCss}body {` +
83
+ ` -moz-transform: scale(0.9, 0.9);` + // Mozilla
84
+ ` zoom: 0.9;` + // Others
85
+ ` zoom: 90%;` + // Webkit
86
+ `}`;
87
+
88
+ chart.tempBodyStyle = document.createElement('style');
89
+ chart.tempBodyStyle.textContent = effectiveCss;
90
+ document.body.appendChild(chart.tempBodyStyle);
91
+ if (chart.options.chart.styledMode) {
92
+ document.body.setAttribute('styled-mode', '');
93
+ }
94
+ }
95
+ }
96
+
97
+ export function cleanupExport(chart) {
98
+ if (chart.tempBodyStyle) {
99
+ document.body.removeChild(chart.tempBodyStyle);
100
+ delete chart.tempBodyStyle;
101
+ if (chart.options.chart.styledMode) {
102
+ document.body.removeAttribute('styled-mode');
103
+ }
104
+ }
105
+ }