@carbon/charts-svelte 1.3.2 → 1.5.1
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/CHANGELOG.md +27 -0
- package/README.md +22 -74
- package/package.json +2 -2
- package/src/BaseChart.svelte +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.5.1](https://github.com/carbon-design-system/carbon-charts/compare/v1.5.0...v1.5.1) (2022-08-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @carbon/charts-svelte
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.5.0](https://github.com/carbon-design-system/carbon-charts/compare/v1.4.0...v1.5.0) (2022-07-22)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @carbon/charts-svelte
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [1.4.0](https://github.com/carbon-design-system/carbon-charts/compare/v1.3.2...v1.4.0) (2022-07-21)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **core:** allow theme to be set via options prop ([#1412](https://github.com/carbon-design-system/carbon-charts/issues/1412)) ([6288548](https://github.com/carbon-design-system/carbon-charts/commit/62885487a700e2222d51f70aea790eddd5d6d086)), closes [#1411](https://github.com/carbon-design-system/carbon-charts/issues/1411)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [1.3.2](https://github.com/carbon-design-system/carbon-charts/compare/v1.3.1...v1.3.2) (2022-06-30)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @carbon/charts-svelte
|
package/README.md
CHANGED
|
@@ -41,78 +41,46 @@ This is an overview of using Carbon Charts with common Svelte set-ups.
|
|
|
41
41
|
|
|
42
42
|
- [SvelteKit](#sveltekit)
|
|
43
43
|
- [Vite](#vite)
|
|
44
|
-
- [Sapper](#sapper)
|
|
45
44
|
- [Rollup](#rollup)
|
|
46
45
|
- [Webpack](#webpack)
|
|
47
|
-
- [Snowpack](#snowpack)
|
|
48
46
|
|
|
49
47
|
### SvelteKit
|
|
50
48
|
|
|
51
|
-
[SvelteKit](https://github.com/sveltejs/kit) is
|
|
52
|
-
|
|
53
|
-
(
|
|
49
|
+
[SvelteKit](https://github.com/sveltejs/kit) is the official framework for
|
|
50
|
+
building apps that support client-side rendering (CSR) and server-side rendering
|
|
51
|
+
(SSR). SvelteKit is powered by [Vite](https://github.com/vitest-dev/vitest).
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
If using a [SvelteKit adapter](https://kit.svelte.dev/docs#adapters), instruct
|
|
59
|
-
`vite` to avoid externalizing `@carbon/charts` when building for production.
|
|
53
|
+
In your `vite.config.js`, add `@carbon/charts` and `carbon-components` to
|
|
54
|
+
`ssr.noExternal` to avoid externalizing the dependencies for SSR.
|
|
60
55
|
|
|
61
56
|
```js
|
|
62
|
-
//
|
|
63
|
-
import
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
adapter: adapter(),
|
|
71
|
-
vite: {
|
|
72
|
-
optimizeDeps: {
|
|
73
|
-
include: ['@carbon/charts'],
|
|
74
|
-
},
|
|
75
|
-
ssr: {
|
|
76
|
-
noExternal: [production && '@carbon/charts'].filter(Boolean),
|
|
77
|
-
},
|
|
78
|
-
},
|
|
57
|
+
// vite.config.js
|
|
58
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
59
|
+
|
|
60
|
+
/** @type {import('vite').UserConfig} */
|
|
61
|
+
export default {
|
|
62
|
+
plugins: [sveltekit()],
|
|
63
|
+
ssr: {
|
|
64
|
+
noExternal: ['@carbon/charts', 'carbon-components'],
|
|
79
65
|
},
|
|
80
66
|
};
|
|
81
|
-
|
|
82
|
-
export default config;
|
|
83
67
|
```
|
|
84
68
|
|
|
85
69
|
### Vite
|
|
86
70
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
`@carbon/charts` in vite.config.js.
|
|
90
|
-
|
|
91
|
-
Note that `@sveltejs/vite-plugin-svelte` is the official vite/svelte integration
|
|
92
|
-
not to be confused with [svite](https://github.com/svitejs/svite).
|
|
71
|
+
You can also use Vite without SvelteKit. Instruct `vite` to optimize
|
|
72
|
+
`@carbon/charts` in `vite.config.js`.
|
|
93
73
|
|
|
94
74
|
```js
|
|
95
75
|
// vite.config.js
|
|
96
76
|
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
97
|
-
import { defineConfig } from 'vite';
|
|
98
|
-
|
|
99
|
-
export default defineConfig(({ mode }) => {
|
|
100
|
-
return {
|
|
101
|
-
plugins: [svelte()],
|
|
102
|
-
build: { minify: mode === 'production' },
|
|
103
|
-
optimizeDeps: { include: ['@carbon/charts'] },
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Sapper
|
|
109
|
-
|
|
110
|
-
[sapper](https://github.com/sveltejs/sapper) is another official Svelte
|
|
111
|
-
framework that supports server-side rendering (SSR).
|
|
112
77
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
78
|
+
/** @type {import('vite').UserConfig} */
|
|
79
|
+
export default {
|
|
80
|
+
plugins: [svelte()],
|
|
81
|
+
optimizeDeps: { include: ['@carbon/charts'] },
|
|
82
|
+
};
|
|
83
|
+
```
|
|
116
84
|
|
|
117
85
|
### Rollup
|
|
118
86
|
|
|
@@ -197,31 +165,11 @@ export default {
|
|
|
197
165
|
|
|
198
166
|
### Webpack
|
|
199
167
|
|
|
200
|
-
[
|
|
168
|
+
[Webpack](https://github.com/webpack/webpack) is another popular application
|
|
201
169
|
bundler used to build Svelte apps.
|
|
202
170
|
|
|
203
171
|
No additional configuration should be necessary.
|
|
204
172
|
|
|
205
|
-
### Snowpack
|
|
206
|
-
|
|
207
|
-
[snowpack](https://github.com/snowpackjs/snowpack) is an ESM-powered frontend
|
|
208
|
-
build tool.
|
|
209
|
-
|
|
210
|
-
Ensure you have
|
|
211
|
-
[@snowpack/plugin-svelte](https://yarnpkg.com/package/@snowpack/plugin-svelte)
|
|
212
|
-
added as a plugin in `snowpack.config.js`.
|
|
213
|
-
|
|
214
|
-
No additional configuration should be necessary.
|
|
215
|
-
|
|
216
|
-
```js
|
|
217
|
-
// snowpack.config.js
|
|
218
|
-
|
|
219
|
-
/** @type {import("snowpack").SnowpackUserConfig } */
|
|
220
|
-
module.exports = {
|
|
221
|
-
plugins: ['@snowpack/plugin-svelte'],
|
|
222
|
-
};
|
|
223
|
-
```
|
|
224
|
-
|
|
225
173
|
## Usage
|
|
226
174
|
|
|
227
175
|
Styles must be imported from both `@carbon/charts` and `@carbon/styles`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/charts-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Carbon charting components for Svelte",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://github.com/carbon-design-system/carbon-charts#readme",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@carbon/charts": "^1.
|
|
53
|
+
"@carbon/charts": "^1.5.1",
|
|
54
54
|
"@carbon/telemetry": "0.1.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
package/src/BaseChart.svelte
CHANGED
|
@@ -24,9 +24,10 @@
|
|
|
24
24
|
*/
|
|
25
25
|
export let options = {};
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
28
|
* Specify the Carbon theme
|
|
29
29
|
* @type {"white" | "g10" | "g90" | "g100"}
|
|
30
|
+
* @deprecated as of v1, pass theme into options
|
|
30
31
|
*/
|
|
31
32
|
export let theme = "white";
|
|
32
33
|
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
|
|
72
73
|
$: if (chart) {
|
|
73
74
|
chart.model.setData(data);
|
|
74
|
-
chart.model.setOptions(options);
|
|
75
|
+
chart.model.setOptions({theme, ...options });
|
|
75
76
|
dispatch("update", { data, options });
|
|
76
77
|
}
|
|
77
78
|
</script>
|