nuxt-echarts 0.0.5 → 0.0.6

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2024 - present, Yue JIN
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 - present, Yue JIN
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,98 +1,98 @@
1
- ![nuxt-echarts](./docs/public/social-card.png)
2
-
3
- # Nuxt ECharts
4
-
5
- [![npm version][npm-version-src]][npm-version-href]
6
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
7
- [![License][license-src]][license-href]
8
- [![Nuxt][nuxt-src]][nuxt-href]
9
-
10
- Nuxt Module for Apache ECharts™
11
-
12
- > [!IMPORTANT]
13
- >
14
- > Nuxt ECharts is currently in active development and based on [experimental `<NuxtIsland>`](https://nuxt.com/docs/api/components/nuxt-island). If you found any issue, design flaw, or have ideas to improve it, please open an [issue](https://github.com/kingyue737/nuxt-echarts/issues) or a [Discussion](https://github.com/kingyue737/nuxt-echarts/discussions).
15
-
16
- - [📖 &nbsp;Documentation (WIP)](https://echarts.nuxt.dev)
17
-
18
- - [✨ &nbsp;Release Notes](/CHANGELOG.md)
19
- - [🎞️ &nbsp;Online Demo](https://nuxt-echarts.nuxt.dev/)
20
- - [🏀 &nbsp;Online Playground](https://stackblitz.com/github/kingyue737/nuxt-echarts?file=playground%2Fapp.vue)
21
-
22
- ## Features
23
-
24
- - ⛰&nbsp;**SSR**: Server-side SVG Rendering with [Nuxt server components](https://nuxt.com/docs/guide/directory-structure/components#server-components)
25
-
26
- - ♾️&nbsp;**Client Hydration**: lazy-loading full ECharts or [lightweight client runtime](https://echarts.apache.org/handbook/en/how-to/cross-platform/server#using-lightweight-runtime)
27
- - 🛠️&nbsp;**Configurable**: import only [necessary functionality](https://echarts.apache.org/handbook/en/basics/import#shrinking-bundle-size) for shrinking bundle size
28
- - 🦾&nbsp;**Type Strong**: auto-import [ECharts option type](https://echarts.apache.org/handbook/en/basics/import#creating-an-option-type-in-typescript) based on your config
29
- - 🌲&nbsp;**Tree-shaking**: Components and ECharts are only included if you use them
30
-
31
- ## Quick Setup
32
-
33
- Install the module to your Nuxt application with one command:
34
-
35
- ```bash
36
- npx nuxi module add nuxt-echarts
37
- ```
38
-
39
- That's it! You can now use Nuxt ECharts in your Nuxt app ✨
40
-
41
- ## Contribution
42
-
43
- <details>
44
- <summary>Local development</summary>
45
-
46
- ```bash
47
- # Install dependencies
48
- pnpm install
49
-
50
- # Generate type stubs
51
- pnpm run dev:prepare
52
-
53
- # Develop with the playground
54
- pnpm run dev
55
-
56
- # Build the playground
57
- pnpm run dev:build
58
-
59
- # Run ESLint
60
- pnpm run lint
61
-
62
- # Format with Prettier
63
- pnpm run format
64
-
65
- # Run Vitest
66
- pnpm run test
67
- pnpm run test:watch
68
-
69
- # Release new version
70
- pnpm run release
71
- ```
72
-
73
- </details>
74
-
75
- ## Credits
76
-
77
- The Nuxt ECharts module is heavily inspired by [vue-echarts](https://github.com/ecomfe/vue-echarts), created by [@Justineo](https://github.com/Justineo).
78
-
79
- ## License
80
-
81
- This project is licensed under the [MIT License](./LICENSE).
82
-
83
- This project also partially contains code derived or copied from [vue-echarts(MIT)](https://github.com/ecomfe/vue-echarts/blob/main/LICENSE).
84
-
85
- ## Notice
86
-
87
- The Apache Software Foundation [Apache ECharts, ECharts](https://echarts.apache.org/), Apache, the Apache feather, and the Apache ECharts project logo are either registered trademarks or trademarks of the [Apache Software Foundation](https://www.apache.org/).
88
-
89
- <!-- Badges -->
90
-
91
- [npm-version-src]: https://img.shields.io/npm/v/nuxt-echarts/latest.svg?style=flat&colorA=020420&colorB=00DC82
92
- [npm-version-href]: https://npmjs.com/package/nuxt-echarts
93
- [npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-echarts.svg?style=flat&colorA=020420&colorB=00DC82
94
- [npm-downloads-href]: https://npmjs.com/package/nuxt-echarts
95
- [license-src]: https://img.shields.io/npm/l/nuxt-echarts.svg?style=flat&colorA=020420&colorB=00DC82
96
- [license-href]: https://npmjs.com/package/nuxt-echarts
97
- [nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
98
- [nuxt-href]: https://nuxt.com
1
+ ![nuxt-echarts](./docs/public/social-card.png)
2
+
3
+ # Nuxt ECharts
4
+
5
+ [![npm version][npm-version-src]][npm-version-href]
6
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
7
+ [![License][license-src]][license-href]
8
+ [![Nuxt][nuxt-src]][nuxt-href]
9
+
10
+ Nuxt Module for Apache ECharts™
11
+
12
+ > [!IMPORTANT]
13
+ >
14
+ > Nuxt ECharts is currently in active development and based on [experimental `<NuxtIsland>`](https://nuxt.com/docs/api/components/nuxt-island). If you found any issue, design flaw, or have ideas to improve it, please open an [issue](https://github.com/kingyue737/nuxt-echarts/issues) or a [Discussion](https://github.com/kingyue737/nuxt-echarts/discussions).
15
+
16
+ - [📖 &nbsp;Documentation (WIP)](https://echarts.nuxt.dev)
17
+
18
+ - [✨ &nbsp;Release Notes](/CHANGELOG.md)
19
+ - [🎞️ &nbsp;Online Demo](https://nuxt-echarts.nuxt.dev/)
20
+ - [🏀 &nbsp;Online Playground](https://stackblitz.com/github/kingyue737/nuxt-echarts?file=playground%2Fapp.vue)
21
+
22
+ ## Features
23
+
24
+ - ⛰&nbsp;**SSR**: Server-side SVG Rendering with [Nuxt server components](https://nuxt.com/docs/guide/directory-structure/components#server-components)
25
+
26
+ - ♾️&nbsp;**Client Hydration**: lazy-loading full ECharts or [lightweight client runtime](https://echarts.apache.org/handbook/en/how-to/cross-platform/server#using-lightweight-runtime)
27
+ - 🛠️&nbsp;**Configurable**: import only [necessary functionality](https://echarts.apache.org/handbook/en/basics/import#shrinking-bundle-size) for shrinking bundle size
28
+ - 🦾&nbsp;**Type Strong**: auto-import [ECharts option type](https://echarts.apache.org/handbook/en/basics/import#creating-an-option-type-in-typescript) based on your config
29
+ - 🌲&nbsp;**Tree-shaking**: Components and ECharts are only included if you use them
30
+
31
+ ## Quick Setup
32
+
33
+ Install the module to your Nuxt application with one command:
34
+
35
+ ```bash
36
+ npx nuxi module add nuxt-echarts
37
+ ```
38
+
39
+ That's it! You can now use Nuxt ECharts in your Nuxt app ✨
40
+
41
+ ## Contribution
42
+
43
+ <details>
44
+ <summary>Local development</summary>
45
+
46
+ ```bash
47
+ # Install dependencies
48
+ pnpm install
49
+
50
+ # Generate type stubs
51
+ pnpm run dev:prepare
52
+
53
+ # Develop with the playground
54
+ pnpm run dev
55
+
56
+ # Build the playground
57
+ pnpm run dev:build
58
+
59
+ # Run ESLint
60
+ pnpm run lint
61
+
62
+ # Format with Prettier
63
+ pnpm run format
64
+
65
+ # Run Vitest
66
+ pnpm run test
67
+ pnpm run test:watch
68
+
69
+ # Release new version
70
+ pnpm run release
71
+ ```
72
+
73
+ </details>
74
+
75
+ ## Credits
76
+
77
+ The Nuxt ECharts module is heavily inspired by [vue-echarts](https://github.com/ecomfe/vue-echarts), created by [@Justineo](https://github.com/Justineo).
78
+
79
+ ## License
80
+
81
+ This project is licensed under the [MIT License](./LICENSE).
82
+
83
+ This project also partially contains code derived or copied from [vue-echarts(MIT)](https://github.com/ecomfe/vue-echarts/blob/main/LICENSE).
84
+
85
+ ## Notice
86
+
87
+ The Apache Software Foundation [Apache ECharts, ECharts](https://echarts.apache.org/), Apache, the Apache feather, and the Apache ECharts project logo are either registered trademarks or trademarks of the [Apache Software Foundation](https://www.apache.org/).
88
+
89
+ <!-- Badges -->
90
+
91
+ [npm-version-src]: https://img.shields.io/npm/v/nuxt-echarts/latest.svg?style=flat&colorA=020420&colorB=00DC82
92
+ [npm-version-href]: https://npmjs.com/package/nuxt-echarts
93
+ [npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-echarts.svg?style=flat&colorA=020420&colorB=00DC82
94
+ [npm-downloads-href]: https://npmjs.com/package/nuxt-echarts
95
+ [license-src]: https://img.shields.io/npm/l/nuxt-echarts.svg?style=flat&colorA=020420&colorB=00DC82
96
+ [license-href]: https://npmjs.com/package/nuxt-echarts
97
+ [nuxt-src]: https://img.shields.io/badge/Nuxt-020420?logo=nuxt.js
98
+ [nuxt-href]: https://nuxt.com
package/dist/module.d.mts CHANGED
@@ -13,19 +13,23 @@ interface ModuleOptions {
13
13
  */
14
14
  renderer?: RendererName | RendererName[];
15
15
  /**
16
- * Register the required charts globally
16
+ * Register the required charts on client side
17
+ * (imported only if `VChart` is used)
17
18
  */
18
19
  charts?: ChartName[];
19
20
  /**
20
- * Register the required components globally
21
+ * Register the required components on client side
22
+ * (imported only if `VChart` is used)
21
23
  */
22
24
  components?: ComponentName[];
23
25
  /**
24
- * Register the required components globally
26
+ * Register the required components on client side
27
+ * (imported only if `VChart` is used)
25
28
  */
26
29
  features?: FeaturesName[];
27
30
  /**
28
- * WIP
31
+ * This options indicates if `VChart` should also render on server.
32
+ * By default, it only render on client.
29
33
  *
30
34
  * @default false
31
35
  */
package/dist/module.d.ts CHANGED
@@ -13,19 +13,23 @@ interface ModuleOptions {
13
13
  */
14
14
  renderer?: RendererName | RendererName[];
15
15
  /**
16
- * Register the required charts globally
16
+ * Register the required charts on client side
17
+ * (imported only if `VChart` is used)
17
18
  */
18
19
  charts?: ChartName[];
19
20
  /**
20
- * Register the required components globally
21
+ * Register the required components on client side
22
+ * (imported only if `VChart` is used)
21
23
  */
22
24
  components?: ComponentName[];
23
25
  /**
24
- * Register the required components globally
26
+ * Register the required components on client side
27
+ * (imported only if `VChart` is used)
25
28
  */
26
29
  features?: FeaturesName[];
27
30
  /**
28
- * WIP
31
+ * This options indicates if `VChart` should also render on server.
32
+ * By default, it only render on client.
29
33
  *
30
34
  * @default false
31
35
  */
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.2.0"
6
6
  },
7
- "version": "0.0.5",
7
+ "version": "0.0.6",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.0",
10
10
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, createResolver, addPlugin, addComponentsDir, addTemplate, addTypeTemplate, addImports } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addPlugin, addComponentsDir, addComponent, addTemplate, addTypeTemplate, addImports } from '@nuxt/kit';
2
2
 
3
3
  const module = defineNuxtModule({
4
4
  meta: {
@@ -16,7 +16,15 @@ const module = defineNuxtModule({
16
16
  setup(options, nuxt) {
17
17
  const { resolve } = createResolver(import.meta.url);
18
18
  addPlugin(resolve("./runtime/plugin"));
19
- addComponentsDir({ path: resolve("runtime/components") });
19
+ addComponentsDir({
20
+ path: resolve("runtime/components"),
21
+ ignore: ["VChart.server.vue", "VChart.client.ts"]
22
+ });
23
+ addComponent({
24
+ filePath: resolve("./runtime/components/VChart.client.ts"),
25
+ name: "VChart",
26
+ mode: options.ssr ? "all" : "client"
27
+ });
20
28
  nuxt.options.css.unshift(resolve("./runtime/style.css"));
21
29
  function join(arr) {
22
30
  return arr?.map((name) => ` ${name},`).join("\n") || "";
@@ -105,10 +113,6 @@ const module = defineNuxtModule({
105
113
  ].forEach(
106
114
  (name) => addImports({ name, from: resolve("./runtime/utils/injection") })
107
115
  );
108
- if (options.ssr) {
109
- nuxt.options.experimental ||= {};
110
- nuxt.options.experimental.componentIslands = true;
111
- }
112
116
  }
113
117
  });
114
118
 
@@ -29,44 +29,44 @@ declare const _default: import("vue").DefineComponent<{
29
29
  } | undefined) => void;
30
30
  convertToPixel: {
31
31
  (finder: string | {
32
- seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
32
+ seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
33
33
  seriesId?: ((string | number) | (string | number)[]) | undefined;
34
34
  seriesName?: ((string | number) | (string | number)[]) | undefined;
35
- geoIndex?: (number | false | number[] | "none" | "all") | undefined;
35
+ geoIndex?: (number | false | number[] | "all" | "none") | undefined;
36
36
  geoId?: ((string | number) | (string | number)[]) | undefined;
37
37
  geoName?: ((string | number) | (string | number)[]) | undefined;
38
- bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
38
+ bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
39
39
  bmapId?: ((string | number) | (string | number)[]) | undefined;
40
40
  bmapName?: ((string | number) | (string | number)[]) | undefined;
41
- xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
41
+ xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
42
42
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
43
43
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
44
- yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
44
+ yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
45
45
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
46
46
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
47
- gridIndex?: (number | false | number[] | "none" | "all") | undefined;
47
+ gridIndex?: (number | false | number[] | "all" | "none") | undefined;
48
48
  gridId?: ((string | number) | (string | number)[]) | undefined;
49
49
  gridName?: ((string | number) | (string | number)[]) | undefined;
50
50
  dataIndex?: number | undefined;
51
51
  dataIndexInside?: number | undefined;
52
52
  }, value: (string | number) | Date): number;
53
53
  (finder: string | {
54
- seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
54
+ seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
55
55
  seriesId?: ((string | number) | (string | number)[]) | undefined;
56
56
  seriesName?: ((string | number) | (string | number)[]) | undefined;
57
- geoIndex?: (number | false | number[] | "none" | "all") | undefined;
57
+ geoIndex?: (number | false | number[] | "all" | "none") | undefined;
58
58
  geoId?: ((string | number) | (string | number)[]) | undefined;
59
59
  geoName?: ((string | number) | (string | number)[]) | undefined;
60
- bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
60
+ bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
61
61
  bmapId?: ((string | number) | (string | number)[]) | undefined;
62
62
  bmapName?: ((string | number) | (string | number)[]) | undefined;
63
- xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
63
+ xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
64
64
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
65
65
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
66
- yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
66
+ yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
67
67
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
68
68
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
69
- gridIndex?: (number | false | number[] | "none" | "all") | undefined;
69
+ gridIndex?: (number | false | number[] | "all" | "none") | undefined;
70
70
  gridId?: ((string | number) | (string | number)[]) | undefined;
71
71
  gridName?: ((string | number) | (string | number)[]) | undefined;
72
72
  dataIndex?: number | undefined;
@@ -75,44 +75,44 @@ declare const _default: import("vue").DefineComponent<{
75
75
  };
76
76
  convertFromPixel: {
77
77
  (finder: string | {
78
- seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
78
+ seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
79
79
  seriesId?: ((string | number) | (string | number)[]) | undefined;
80
80
  seriesName?: ((string | number) | (string | number)[]) | undefined;
81
- geoIndex?: (number | false | number[] | "none" | "all") | undefined;
81
+ geoIndex?: (number | false | number[] | "all" | "none") | undefined;
82
82
  geoId?: ((string | number) | (string | number)[]) | undefined;
83
83
  geoName?: ((string | number) | (string | number)[]) | undefined;
84
- bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
84
+ bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
85
85
  bmapId?: ((string | number) | (string | number)[]) | undefined;
86
86
  bmapName?: ((string | number) | (string | number)[]) | undefined;
87
- xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
87
+ xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
88
88
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
89
89
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
90
- yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
90
+ yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
91
91
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
92
92
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
93
- gridIndex?: (number | false | number[] | "none" | "all") | undefined;
93
+ gridIndex?: (number | false | number[] | "all" | "none") | undefined;
94
94
  gridId?: ((string | number) | (string | number)[]) | undefined;
95
95
  gridName?: ((string | number) | (string | number)[]) | undefined;
96
96
  dataIndex?: number | undefined;
97
97
  dataIndexInside?: number | undefined;
98
98
  }, value: number): number;
99
99
  (finder: string | {
100
- seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
100
+ seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
101
101
  seriesId?: ((string | number) | (string | number)[]) | undefined;
102
102
  seriesName?: ((string | number) | (string | number)[]) | undefined;
103
- geoIndex?: (number | false | number[] | "none" | "all") | undefined;
103
+ geoIndex?: (number | false | number[] | "all" | "none") | undefined;
104
104
  geoId?: ((string | number) | (string | number)[]) | undefined;
105
105
  geoName?: ((string | number) | (string | number)[]) | undefined;
106
- bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
106
+ bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
107
107
  bmapId?: ((string | number) | (string | number)[]) | undefined;
108
108
  bmapName?: ((string | number) | (string | number)[]) | undefined;
109
- xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
109
+ xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
110
110
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
111
111
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
112
- yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
112
+ yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
113
113
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
114
114
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
115
- gridIndex?: (number | false | number[] | "none" | "all") | undefined;
115
+ gridIndex?: (number | false | number[] | "all" | "none") | undefined;
116
116
  gridId?: ((string | number) | (string | number)[]) | undefined;
117
117
  gridName?: ((string | number) | (string | number)[]) | undefined;
118
118
  dataIndex?: number | undefined;
@@ -120,22 +120,22 @@ declare const _default: import("vue").DefineComponent<{
120
120
  }, value: number[]): number[];
121
121
  };
122
122
  containPixel: (finder: string | {
123
- seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
123
+ seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
124
124
  seriesId?: ((string | number) | (string | number)[]) | undefined;
125
125
  seriesName?: ((string | number) | (string | number)[]) | undefined;
126
- geoIndex?: (number | false | number[] | "none" | "all") | undefined;
126
+ geoIndex?: (number | false | number[] | "all" | "none") | undefined;
127
127
  geoId?: ((string | number) | (string | number)[]) | undefined;
128
128
  geoName?: ((string | number) | (string | number)[]) | undefined;
129
- bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
129
+ bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
130
130
  bmapId?: ((string | number) | (string | number)[]) | undefined;
131
131
  bmapName?: ((string | number) | (string | number)[]) | undefined;
132
- xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
132
+ xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
133
133
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
134
134
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
135
- yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
135
+ yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
136
136
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
137
137
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
138
- gridIndex?: (number | false | number[] | "none" | "all") | undefined;
138
+ gridIndex?: (number | false | number[] | "all" | "none") | undefined;
139
139
  gridId?: ((string | number) | (string | number)[]) | undefined;
140
140
  gridName?: ((string | number) | (string | number)[]) | undefined;
141
141
  dataIndex?: number | undefined;
@@ -1,5 +1,5 @@
1
- <script setup lang="ts"></script>
2
-
3
- <template>
4
- <VChartServer v-bind="$attrs" />
5
- </template>
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <VChartServer v-bind="$attrs" />
5
+ </template>
@@ -1,34 +1,34 @@
1
- <script setup lang="ts">
2
- import * as echarts from 'echarts'
3
- import { ref } from 'vue'
4
- import type { Option, InitOptions, Theme } from '../types'
5
-
6
- const props = defineProps<{
7
- option?: Option
8
- initOptions?: InitOptions
9
- theme?: Theme
10
- }>()
11
-
12
- const svgStr = ref('')
13
- const initOptions: InitOptions = echarts.util.merge(
14
- { renderer: 'svg', ssr: true } satisfies InitOptions,
15
- props.initOptions || {},
16
- )
17
- let chart = echarts.init(null, props.theme, initOptions)
18
- chart.setOption(props.option || {})
19
- svgStr.value = chart.renderToSVGString()
20
-
21
- chart.dispose()
22
-
23
- // @ts-expect-error release memory
24
- chart = null
25
-
26
- defineSlots<{ fallback: any }>()
27
- </script>
28
-
29
- <template>
30
- <div class="vue-echarts-container">
31
- <!--eslint-disable-next-line vue/no-v-html-->
32
- <div class="vue-echarts-inner" v-html="svgStr" />
33
- </div>
34
- </template>
1
+ <script setup lang="ts">
2
+ import * as echarts from 'echarts'
3
+ import { ref } from 'vue'
4
+ import type { Option, InitOptions, Theme } from '../types'
5
+
6
+ const props = defineProps<{
7
+ option?: Option
8
+ initOptions?: InitOptions
9
+ theme?: Theme
10
+ }>()
11
+
12
+ const svgStr = ref('')
13
+ const initOptions: InitOptions = echarts.util.merge(
14
+ { renderer: 'svg', ssr: true } satisfies InitOptions,
15
+ props.initOptions || {},
16
+ )
17
+ let chart = echarts.init(null, props.theme, initOptions)
18
+ chart.setOption(props.option || {})
19
+ svgStr.value = chart.renderToSVGString()
20
+
21
+ chart.dispose()
22
+
23
+ // @ts-expect-error release memory
24
+ chart = null
25
+
26
+ defineSlots<{ fallback: any }>()
27
+ </script>
28
+
29
+ <template>
30
+ <div class="vue-echarts-container">
31
+ <!--eslint-disable-next-line vue/no-v-html-->
32
+ <div class="vue-echarts-inner" v-html="svgStr" />
33
+ </div>
34
+ </template>
@@ -12,16 +12,15 @@ defineProps<{
12
12
  theme?: Theme
13
13
  initOptions?: InitOptions
14
14
  }>()
15
- defineOptions({ inheritAttrs: false })
16
15
 
17
16
  type ECSSRHandler = (params: ECSSRClientEventParams) => string | undefined
18
17
  type ECSSREventOn = `on${Capitalize<ECSSREvent>}`
19
18
 
20
- const root = ref<HTMLElement | null>(null)
19
+ const root = ref<InstanceType<typeof VChartServer> | null>(null)
21
20
  const attrs = useAttrs() as Partial<Record<ECSSREventOn, ECSSRHandler>>
22
21
  let container: HTMLElement
23
22
  function hydrateChart() {
24
- container = root.value?.querySelector?.('.vue-echarts-inner') as HTMLElement
23
+ container = root.value?.$el
25
24
  if (container) {
26
25
  // Use the lightweight runtime to give the chart interactive capabilities
27
26
  hydrate(container, {
@@ -44,7 +43,7 @@ onMounted(async () => {
44
43
 
45
44
  // call 'observe' on that MutationObserver instance,
46
45
  // passing it the element to observe, and the options object
47
- observer.observe(root.value!.querySelector('.vue-echarts-server')!, {
46
+ observer.observe(root.value!.$el, {
48
47
  characterData: false,
49
48
  childList: true,
50
49
  attributes: false,
@@ -53,7 +52,10 @@ onMounted(async () => {
53
52
  </script>
54
53
 
55
54
  <template>
56
- <div ref="root">
57
- <VChartServer :option="option" :init-options="initOptions" :theme="theme" />
58
- </div>
55
+ <VChartServer
56
+ ref="root"
57
+ :option="option"
58
+ :init-options="initOptions"
59
+ :theme="theme"
60
+ />
59
61
  </template>
@@ -1,26 +0,0 @@
1
- import { type ECSSRClientEventParams, type ECSSREvent } from 'echarts/ssr/client/index';
2
- import type { Theme } from '../types.js';
3
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
4
- option?: import("echarts/core").EChartsCoreOption | undefined;
5
- theme?: Theme | undefined;
6
- initOptions?: import("echarts/core").EChartsInitOpts | undefined;
7
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<ECSSREvent, (params: ECSSRClientEventParams) => string | undefined>, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
8
- option?: import("echarts/core").EChartsCoreOption | undefined;
9
- theme?: Theme | undefined;
10
- initOptions?: import("echarts/core").EChartsInitOpts | undefined;
11
- }>>> & {
12
- onClick?: ((params: ECSSRClientEventParams) => any) | undefined;
13
- onMouseout?: ((params: ECSSRClientEventParams) => any) | undefined;
14
- onMouseover?: ((params: ECSSRClientEventParams) => any) | undefined;
15
- }, {}, {}>;
16
- export default _default;
17
-
18
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
19
- type __VLS_TypePropsToOption<T> = {
20
- [K in keyof T]-?: {} extends Pick<T, K> ? {
21
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
22
- } : {
23
- type: import('vue').PropType<T[K]>;
24
- required: true;
25
- };
26
- };
@@ -2,7 +2,7 @@
2
2
  import { computed, unref, inject, ref } from 'vue'
3
3
  import type { InitOptions, Option, Theme } from '../types'
4
4
  import { THEME_KEY, INIT_OPTIONS_KEY } from '../utils/injection'
5
- import type { VChartIsland } from '#components'
5
+ import type VChartIsland from './VChartLight.vue'
6
6
 
7
7
  const defaultTheme = inject(THEME_KEY, null)
8
8
  const defaultInitOptions = inject(INIT_OPTIONS_KEY, null)
@@ -7,7 +7,7 @@ export function useAutoresize(chart, autoresize, root) {
7
7
  const autoresizeOptions = autoresize2 === true ? {} : autoresize2;
8
8
  const { throttle: wait = 100, onResize } = autoresizeOptions;
9
9
  const callback = () => {
10
- chart2.resize();
10
+ chart2.resize({ width: "auto", height: "auto" });
11
11
  onResize?.();
12
12
  };
13
13
  observer = new ResizeObserver(wait ? throttle(callback, wait) : callback);
@@ -3,6 +3,6 @@ import type { EChartsType, LoadingOptions } from '../types.js';
3
3
  export declare const LOADING_OPTIONS_KEY: InjectionKey<LoadingOptions | Ref<LoadingOptions>>;
4
4
  export declare function useLoading(chart: Ref<EChartsType | undefined>, loading: Ref<boolean>, loadingOptions: Ref<LoadingOptions | undefined>): void;
5
5
  export declare const loadingProps: {
6
- loading: BooleanConstructor;
6
+ loading: any;
7
7
  loadingOptions: PropType<LoadingOptions>;
8
8
  };
@@ -1,6 +1,6 @@
1
1
  import type { InjectionKey } from 'vue';
2
- import type { ThemeInjection, InitOptionsInjection, UpdateOptionsInjection } from '../types.js';
3
- export declare const THEME_KEY: InjectionKey<ThemeInjection>;
4
- export declare const INIT_OPTIONS_KEY: InjectionKey<InitOptionsInjection>;
2
+ import type { UpdateOptionsInjection } from '../types.js';
3
+ export declare const THEME_KEY: InjectionKey<any>;
4
+ export declare const INIT_OPTIONS_KEY: InjectionKey<any>;
5
5
  export declare const UPDATE_OPTIONS_KEY: InjectionKey<UpdateOptionsInjection>;
6
6
  export { LOADING_OPTIONS_KEY } from '../composables.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-echarts",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Nuxt Module for Apache ECharts™",
5
5
  "keywords": [
6
6
  "vue",
@@ -34,30 +34,32 @@
34
34
  "release": "pnpm run lint && pnpm run test && pnpm run prepack && changelogen --release && npm publish --registry=\"https://registry.npmjs.org/\" && git push --follow-tags",
35
35
  "docs:dev": "nuxi dev docs",
36
36
  "docs:build": "nuxi generate docs",
37
+ "docs:types": "nuxi typecheck docs",
37
38
  "lint": "eslint . --fix",
38
39
  "format": "prettier . --write",
39
40
  "test": "vitest run",
40
41
  "test:watch": "vitest watch",
41
- "test:types": "vue-tsc --noEmit && nuxi typecheck docs && cd playground && vue-tsc --noEmit"
42
+ "test:types": "nuxi typecheck && nuxi typecheck playground"
42
43
  },
43
44
  "dependencies": {
44
45
  "@nuxt/kit": "^3.12.2",
45
46
  "echarts": "^5.5.0"
46
47
  },
47
48
  "devDependencies": {
48
- "@nuxt/devtools": "^1.3.3",
49
+ "@nuxt/devtools": "^1.3.6",
49
50
  "@nuxt/eslint-config": "^0.3.13",
50
51
  "@nuxt/module-builder": "^0.8.0",
51
52
  "@nuxt/schema": "^3.12.2",
52
53
  "@nuxt/test-utils": "^3.13.1",
53
- "@types/node": "^20.14.5",
54
+ "@types/node": "^20.14.8",
54
55
  "changelogen": "^0.5.5",
55
56
  "eslint": "^9.5.0",
56
57
  "nuxt": "^3.12.2",
57
58
  "prettier": "^3.3.2",
58
- "typescript": "latest",
59
+ "typescript": "~5.4.5",
60
+ "vite": "^5.3.1",
59
61
  "vitest": "^1.6.0",
60
- "vue-tsc": "^2.0.21"
62
+ "vue-tsc": "^2.0.22"
61
63
  },
62
64
  "pnpm": {
63
65
  "peerDependencyRules": {
@@ -76,4 +78,4 @@
76
78
  "stackblitz": {
77
79
  "startCommand": "pnpm run dev:prepare && pnpm run dev"
78
80
  }
79
- }
81
+ }