nuxt-echarts 0.0.3 → 0.0.4

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.
Files changed (37) hide show
  1. package/README.md +12 -9
  2. package/dist/module.d.mts +31 -1
  3. package/dist/module.d.ts +31 -1
  4. package/dist/module.json +3 -3
  5. package/dist/module.mjs +96 -13
  6. package/dist/runtime/{VChart.d.ts → components/VChart.client.d.ts} +91 -95
  7. package/dist/runtime/{VChart.mjs → components/VChart.client.js} +12 -10
  8. package/dist/runtime/components/VChart.server.vue +5 -0
  9. package/dist/runtime/components/VChartIsland.server.vue +34 -0
  10. package/dist/runtime/components/VChartLight.vue +78 -0
  11. package/dist/runtime/components/VChartLight.vue.d.ts +26 -0
  12. package/dist/runtime/components/VChartServer.vue +48 -0
  13. package/dist/runtime/composables/api.d.ts +1 -1
  14. package/dist/runtime/composables/autoresize.d.ts +0 -11
  15. package/dist/runtime/composables/index.d.ts +3 -3
  16. package/dist/runtime/composables/index.js +3 -0
  17. package/dist/runtime/composables/loading.d.ts +1 -1
  18. package/dist/runtime/style.css +1 -1
  19. package/dist/runtime/types.d.ts +1 -2
  20. package/dist/runtime/utils/injection.d.ts +6 -0
  21. package/dist/runtime/utils/injection.js +4 -0
  22. package/dist/runtime/utils/wc.d.ts +0 -0
  23. package/dist/types.d.mts +4 -13
  24. package/dist/types.d.ts +4 -13
  25. package/package.json +24 -13
  26. package/dist/runtime/composables/index.mjs +0 -3
  27. package/dist/runtime/index.d.ts +0 -3
  28. package/dist/runtime/index.mjs +0 -3
  29. package/dist/runtime/wc.d.ts +0 -6
  30. /package/dist/runtime/composables/{api.mjs → api.js} +0 -0
  31. /package/dist/runtime/composables/{autoresize.mjs → autoresize.js} +0 -0
  32. /package/dist/runtime/composables/{loading.mjs → loading.js} +0 -0
  33. /package/dist/runtime/{plugin.mjs → plugin.js} +0 -0
  34. /package/dist/runtime/{types.mjs → types.js} +0 -0
  35. /package/dist/runtime/{utils.d.ts → utils/on.d.ts} +0 -0
  36. /package/dist/runtime/{utils.mjs → utils/on.js} +0 -0
  37. /package/dist/runtime/{wc.mjs → utils/wc.js} +0 -0
package/README.md CHANGED
@@ -9,21 +9,24 @@
9
9
 
10
10
  Nuxt Module for Apache ECharts™
11
11
 
12
- > 🚧 **Work in Progress**
12
+ > [!IMPORTANT]
13
13
  >
14
- > Nuxt ECharts is currently in active development and not usable for production yet.
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
15
 
16
16
  - [✨ &nbsp;Release Notes](/CHANGELOG.md)
17
- <!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/nuxt-echarts?file=playground%2Fapp.vue) -->
17
+ - 🏀 &nbsp;Online playground (WIP)
18
+ - 📖 &nbsp;Documentation (WIP)
19
+ <!-- - [🏀 Online playground](https://stackblitz.com/github/kingyue737/nuxt-echarts?file=playground%2Fapp.vue) -->
18
20
  <!-- - [📖 &nbsp;Documentation](https://example.com) -->
19
21
 
20
- ## Features (WIP)
22
+ ## Features
21
23
 
22
- <!-- Highlight some of the features your module provide here -->
24
+ - ⛰&nbsp;**SSR**: Server-side SVG Rendering with [Nuxt server components](https://nuxt.com/docs/guide/directory-structure/components#server-components)
23
25
 
24
- - **SSR**: experimental server-only component, lightweight client runtime
25
- - 🛠️ **Configurable**: import only necessary components and charts for smaller bundle size
26
- - 🦾 **Type Strong**: generate ECharts option type based on your config
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
27
30
 
28
31
  ## Quick Setup
29
32
 
@@ -71,7 +74,7 @@ That's it! You can now use Nuxt ECharts in your Nuxt app ✨
71
74
 
72
75
  ## Credits
73
76
 
74
- The Nuxt ECharts module is heavily inspired by [vue-echarts](https://github.com/ecomfe/vue-echarts), created by[@Justineo](https://github.com/Justineo).
77
+ The Nuxt ECharts module is heavily inspired by [vue-echarts](https://github.com/ecomfe/vue-echarts), created by [@Justineo](https://github.com/Justineo).
75
78
 
76
79
  ## License
77
80
 
package/dist/module.d.mts CHANGED
@@ -1,7 +1,37 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ import * as echartsComponents from 'echarts/components';
3
+ import * as echartsCharts from 'echarts/charts';
4
+ import * as echartsFeatures from 'echarts/features';
2
5
 
6
+ type ComponentName = keyof typeof echartsComponents;
7
+ type ChartName = keyof typeof echartsCharts;
8
+ type FeaturesName = keyof typeof echartsFeatures;
9
+ type RendererName = 'canvas' | 'svg';
3
10
  interface ModuleOptions {
11
+ /**
12
+ * @default 'canvas'
13
+ */
14
+ renderer?: RendererName | RendererName[];
15
+ /**
16
+ * Register the required charts globally
17
+ */
18
+ charts?: ChartName[];
19
+ /**
20
+ * Register the required components globally
21
+ */
22
+ components?: ComponentName[];
23
+ /**
24
+ * Register the required components globally
25
+ */
26
+ features?: FeaturesName[];
27
+ /**
28
+ * WIP
29
+ *
30
+ * @default false
31
+ */
32
+ ssr?: boolean;
4
33
  }
34
+
5
35
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
6
36
 
7
- export { type ModuleOptions, _default as default };
37
+ export { _default as default };
package/dist/module.d.ts CHANGED
@@ -1,7 +1,37 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
+ import * as echartsComponents from 'echarts/components';
3
+ import * as echartsCharts from 'echarts/charts';
4
+ import * as echartsFeatures from 'echarts/features';
2
5
 
6
+ type ComponentName = keyof typeof echartsComponents;
7
+ type ChartName = keyof typeof echartsCharts;
8
+ type FeaturesName = keyof typeof echartsFeatures;
9
+ type RendererName = 'canvas' | 'svg';
3
10
  interface ModuleOptions {
11
+ /**
12
+ * @default 'canvas'
13
+ */
14
+ renderer?: RendererName | RendererName[];
15
+ /**
16
+ * Register the required charts globally
17
+ */
18
+ charts?: ChartName[];
19
+ /**
20
+ * Register the required components globally
21
+ */
22
+ components?: ComponentName[];
23
+ /**
24
+ * Register the required components globally
25
+ */
26
+ features?: FeaturesName[];
27
+ /**
28
+ * WIP
29
+ *
30
+ * @default false
31
+ */
32
+ ssr?: boolean;
4
33
  }
34
+
5
35
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
6
36
 
7
- export { type ModuleOptions, _default as default };
37
+ export { _default as default };
package/dist/module.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "name": "nuxt-echarts",
3
3
  "configKey": "echarts",
4
4
  "compatibility": {
5
- "nuxt": "^3.0.0"
5
+ "nuxt": ">=3.2.0"
6
6
  },
7
- "version": "0.0.3",
7
+ "version": "0.0.4",
8
8
  "builder": {
9
- "@nuxt/module-builder": "0.6.0",
9
+ "@nuxt/module-builder": "0.8.0",
10
10
  "unbuild": "2.0.0"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, createResolver, addPlugin, addComponent, addImports } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addPlugin, addComponentsDir, addTemplate, addTypeTemplate, addImports } from '@nuxt/kit';
2
2
 
3
3
  const module = defineNuxtModule({
4
4
  meta: {
@@ -6,26 +6,109 @@ const module = defineNuxtModule({
6
6
  configKey: "echarts",
7
7
  compatibility: {
8
8
  // Semver version of supported nuxt versions
9
- nuxt: "^3.0.0"
9
+ nuxt: ">=3.2.0"
10
10
  }
11
11
  },
12
12
  // Default configuration options of the Nuxt module
13
- defaults: {},
14
- setup(_options, _nuxt) {
15
- const resolver = createResolver(import.meta.url);
16
- addPlugin(resolver.resolve("./runtime/plugin"));
17
- const entry = resolver.resolve("./runtime/VChart.ts");
18
- addComponent({
19
- name: "VChart",
20
- filePath: entry
13
+ defaults: {
14
+ renderer: "canvas"
15
+ },
16
+ setup(options, nuxt) {
17
+ const { resolve } = createResolver(import.meta.url);
18
+ addPlugin(resolve("./runtime/plugin"));
19
+ addComponentsDir({ path: resolve("runtime/components") });
20
+ nuxt.options.css.unshift(resolve("./runtime/style.css"));
21
+ function join(arr) {
22
+ return arr?.map((name) => ` ${name},`).join("\n") || "";
23
+ }
24
+ let renderers = [];
25
+ if (typeof options.renderer === "string" || options.renderer instanceof String) {
26
+ renderers.push(options.renderer);
27
+ } else {
28
+ renderers = options.renderer;
29
+ }
30
+ const rendererNames = [];
31
+ renderers.forEach((v) => {
32
+ if (v === "canvas")
33
+ rendererNames.push("CanvasRenderer");
34
+ else if (v === "svg")
35
+ rendererNames.push("SVGRenderer");
21
36
  });
22
- const injectionKeys = [
37
+ const joinedRendererNames = join(rendererNames);
38
+ const joinedChartNames = join(options.charts);
39
+ const joinedComponentNames = join(options.components);
40
+ const joinedFeatureNames = join(options.features);
41
+ addTemplate({
42
+ filename: "echarts.mjs",
43
+ write: true,
44
+ getContents: () => [
45
+ "// Generated by nuxt-echarts",
46
+ "",
47
+ "import { use } from 'echarts/core'",
48
+ "import {",
49
+ joinedRendererNames,
50
+ "} from 'echarts/renderers'",
51
+ "import {",
52
+ joinedChartNames,
53
+ "} from 'echarts/charts'",
54
+ "import {",
55
+ joinedComponentNames,
56
+ "} from 'echarts/components'",
57
+ "import {",
58
+ joinedFeatureNames,
59
+ "} from 'echarts/features'",
60
+ "",
61
+ "use([",
62
+ joinedRendererNames,
63
+ joinedChartNames,
64
+ joinedComponentNames,
65
+ joinedFeatureNames,
66
+ "])"
67
+ ].join("\n")
68
+ });
69
+ if (options.charts || options.components) {
70
+ const chartOptionNames = options.charts?.map(
71
+ (name) => `${name.slice(0, -5)}SeriesOption`
72
+ );
73
+ const componentOptionNames = options.components?.map(
74
+ (name) => `${name}Option`
75
+ );
76
+ addTypeTemplate({
77
+ filename: "types/nuxt-echarts.d.ts",
78
+ getContents: () => [
79
+ `// Generated by nuxt-echarts`,
80
+ "",
81
+ "import type { ComposeOption } from 'echarts/core'",
82
+ "import type {",
83
+ join(chartOptionNames),
84
+ "} from 'echarts/charts'",
85
+ "import type {",
86
+ join(componentOptionNames),
87
+ "} from 'echarts/components'",
88
+ "",
89
+ "declare global {",
90
+ " export type ECOption = ComposeOption<",
91
+ `${chartOptionNames?.map((name) => ` | ${name}`).join("\n")}`,
92
+ `${componentOptionNames?.map((name) => ` | ${name}`).join("\n")}`,
93
+ " >",
94
+ "}",
95
+ "",
96
+ "export {}"
97
+ ].join("\n")
98
+ });
99
+ }
100
+ [
23
101
  "THEME_KEY",
24
102
  "INIT_OPTIONS_KEY",
25
103
  "UPDATE_OPTIONS_KEY",
26
104
  "LOADING_OPTIONS_KEY"
27
- ];
28
- injectionKeys.forEach((name) => addImports({ name, from: entry }));
105
+ ].forEach(
106
+ (name) => addImports({ name, from: resolve("./runtime/utils/injection") })
107
+ );
108
+ if (options.ssr) {
109
+ nuxt.options.experimental ||= {};
110
+ nuxt.options.experimental.componentIslands = true;
111
+ }
29
112
  }
30
113
  });
31
114
 
@@ -1,14 +1,10 @@
1
- import { type PropType, type InjectionKey } from 'vue';
2
- import type { Option, Theme, ThemeInjection, InitOptionsInjection, UpdateOptions, UpdateOptionsInjection } from './types';
3
- import { type EChartsElement } from './wc';
4
- import './style.css';
5
- export declare const THEME_KEY: InjectionKey<ThemeInjection>;
6
- export declare const INIT_OPTIONS_KEY: InjectionKey<InitOptionsInjection>;
7
- export declare const UPDATE_OPTIONS_KEY: InjectionKey<UpdateOptionsInjection>;
8
- export { LOADING_OPTIONS_KEY } from './composables';
1
+ import { type PropType } from 'vue';
2
+ import type { Option, Theme, UpdateOptions } from '../types.js';
3
+ import { type EChartsElement } from '../utils/wc.js';
4
+ import '#build/echarts.mjs';
9
5
  declare const _default: import("vue").DefineComponent<{
10
6
  loading: BooleanConstructor;
11
- loadingOptions: PropType<import("./types").LoadingOptions>;
7
+ loadingOptions: PropType<import("../types").LoadingOptions>;
12
8
  autoresize: PropType<boolean | {
13
9
  throttle?: number | undefined;
14
10
  onResize?: (() => void) | undefined;
@@ -18,7 +14,7 @@ declare const _default: import("vue").DefineComponent<{
18
14
  type: PropType<Theme>;
19
15
  };
20
16
  initOptions: PropType<import("echarts/core").EChartsInitOpts>;
21
- updateOptions: PropType<import("echarts").SetOptionOpts>;
17
+ updateOptions: PropType<import("echarts/core").SetOptionOpts>;
22
18
  group: StringConstructor;
23
19
  manualUpdate: BooleanConstructor;
24
20
  }, {
@@ -33,44 +29,44 @@ declare const _default: import("vue").DefineComponent<{
33
29
  } | undefined) => void;
34
30
  convertToPixel: {
35
31
  (finder: string | {
36
- seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
32
+ seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
37
33
  seriesId?: ((string | number) | (string | number)[]) | undefined;
38
34
  seriesName?: ((string | number) | (string | number)[]) | undefined;
39
- geoIndex?: (number | false | number[] | "all" | "none") | undefined;
35
+ geoIndex?: (number | false | number[] | "none" | "all") | undefined;
40
36
  geoId?: ((string | number) | (string | number)[]) | undefined;
41
37
  geoName?: ((string | number) | (string | number)[]) | undefined;
42
- bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
38
+ bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
43
39
  bmapId?: ((string | number) | (string | number)[]) | undefined;
44
40
  bmapName?: ((string | number) | (string | number)[]) | undefined;
45
- xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
41
+ xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
46
42
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
47
43
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
48
- yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
44
+ yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
49
45
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
50
46
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
51
- gridIndex?: (number | false | number[] | "all" | "none") | undefined;
47
+ gridIndex?: (number | false | number[] | "none" | "all") | undefined;
52
48
  gridId?: ((string | number) | (string | number)[]) | undefined;
53
49
  gridName?: ((string | number) | (string | number)[]) | undefined;
54
50
  dataIndex?: number | undefined;
55
51
  dataIndexInside?: number | undefined;
56
52
  }, value: (string | number) | Date): number;
57
53
  (finder: string | {
58
- seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
54
+ seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
59
55
  seriesId?: ((string | number) | (string | number)[]) | undefined;
60
56
  seriesName?: ((string | number) | (string | number)[]) | undefined;
61
- geoIndex?: (number | false | number[] | "all" | "none") | undefined;
57
+ geoIndex?: (number | false | number[] | "none" | "all") | undefined;
62
58
  geoId?: ((string | number) | (string | number)[]) | undefined;
63
59
  geoName?: ((string | number) | (string | number)[]) | undefined;
64
- bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
60
+ bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
65
61
  bmapId?: ((string | number) | (string | number)[]) | undefined;
66
62
  bmapName?: ((string | number) | (string | number)[]) | undefined;
67
- xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
63
+ xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
68
64
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
69
65
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
70
- yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
66
+ yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
71
67
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
72
68
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
73
- gridIndex?: (number | false | number[] | "all" | "none") | undefined;
69
+ gridIndex?: (number | false | number[] | "none" | "all") | undefined;
74
70
  gridId?: ((string | number) | (string | number)[]) | undefined;
75
71
  gridName?: ((string | number) | (string | number)[]) | undefined;
76
72
  dataIndex?: number | undefined;
@@ -79,44 +75,44 @@ declare const _default: import("vue").DefineComponent<{
79
75
  };
80
76
  convertFromPixel: {
81
77
  (finder: string | {
82
- seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
78
+ seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
83
79
  seriesId?: ((string | number) | (string | number)[]) | undefined;
84
80
  seriesName?: ((string | number) | (string | number)[]) | undefined;
85
- geoIndex?: (number | false | number[] | "all" | "none") | undefined;
81
+ geoIndex?: (number | false | number[] | "none" | "all") | undefined;
86
82
  geoId?: ((string | number) | (string | number)[]) | undefined;
87
83
  geoName?: ((string | number) | (string | number)[]) | undefined;
88
- bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
84
+ bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
89
85
  bmapId?: ((string | number) | (string | number)[]) | undefined;
90
86
  bmapName?: ((string | number) | (string | number)[]) | undefined;
91
- xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
87
+ xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
92
88
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
93
89
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
94
- yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
90
+ yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
95
91
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
96
92
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
97
- gridIndex?: (number | false | number[] | "all" | "none") | undefined;
93
+ gridIndex?: (number | false | number[] | "none" | "all") | undefined;
98
94
  gridId?: ((string | number) | (string | number)[]) | undefined;
99
95
  gridName?: ((string | number) | (string | number)[]) | undefined;
100
96
  dataIndex?: number | undefined;
101
97
  dataIndexInside?: number | undefined;
102
98
  }, value: number): number;
103
99
  (finder: string | {
104
- seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
100
+ seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
105
101
  seriesId?: ((string | number) | (string | number)[]) | undefined;
106
102
  seriesName?: ((string | number) | (string | number)[]) | undefined;
107
- geoIndex?: (number | false | number[] | "all" | "none") | undefined;
103
+ geoIndex?: (number | false | number[] | "none" | "all") | undefined;
108
104
  geoId?: ((string | number) | (string | number)[]) | undefined;
109
105
  geoName?: ((string | number) | (string | number)[]) | undefined;
110
- bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
106
+ bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
111
107
  bmapId?: ((string | number) | (string | number)[]) | undefined;
112
108
  bmapName?: ((string | number) | (string | number)[]) | undefined;
113
- xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
109
+ xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
114
110
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
115
111
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
116
- yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
112
+ yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
117
113
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
118
114
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
119
- gridIndex?: (number | false | number[] | "all" | "none") | undefined;
115
+ gridIndex?: (number | false | number[] | "none" | "all") | undefined;
120
116
  gridId?: ((string | number) | (string | number)[]) | undefined;
121
117
  gridName?: ((string | number) | (string | number)[]) | undefined;
122
118
  dataIndex?: number | undefined;
@@ -124,22 +120,22 @@ declare const _default: import("vue").DefineComponent<{
124
120
  }, value: number[]): number[];
125
121
  };
126
122
  containPixel: (finder: string | {
127
- seriesIndex?: (number | false | number[] | "all" | "none") | undefined;
123
+ seriesIndex?: (number | false | number[] | "none" | "all") | undefined;
128
124
  seriesId?: ((string | number) | (string | number)[]) | undefined;
129
125
  seriesName?: ((string | number) | (string | number)[]) | undefined;
130
- geoIndex?: (number | false | number[] | "all" | "none") | undefined;
126
+ geoIndex?: (number | false | number[] | "none" | "all") | undefined;
131
127
  geoId?: ((string | number) | (string | number)[]) | undefined;
132
128
  geoName?: ((string | number) | (string | number)[]) | undefined;
133
- bmapIndex?: (number | false | number[] | "all" | "none") | undefined;
129
+ bmapIndex?: (number | false | number[] | "none" | "all") | undefined;
134
130
  bmapId?: ((string | number) | (string | number)[]) | undefined;
135
131
  bmapName?: ((string | number) | (string | number)[]) | undefined;
136
- xAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
132
+ xAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
137
133
  xAxisId?: ((string | number) | (string | number)[]) | undefined;
138
134
  xAxisName?: ((string | number) | (string | number)[]) | undefined;
139
- yAxisIndex?: (number | false | number[] | "all" | "none") | undefined;
135
+ yAxisIndex?: (number | false | number[] | "none" | "all") | undefined;
140
136
  yAxisId?: ((string | number) | (string | number)[]) | undefined;
141
137
  yAxisName?: ((string | number) | (string | number)[]) | undefined;
142
- gridIndex?: (number | false | number[] | "all" | "none") | undefined;
138
+ gridIndex?: (number | false | number[] | "none" | "all") | undefined;
143
139
  gridId?: ((string | number) | (string | number)[]) | undefined;
144
140
  gridName?: ((string | number) | (string | number)[]) | undefined;
145
141
  dataIndex?: number | undefined;
@@ -167,22 +163,22 @@ declare const _default: import("vue").DefineComponent<{
167
163
  dispose: () => void;
168
164
  chart: import("vue").ShallowRef<import("echarts/core").ECharts | undefined>;
169
165
  root: import("vue").ShallowRef<EChartsElement | undefined>;
170
- inner: import("vue").ShallowRef<HTMLElement | undefined>;
166
+ inner: import("vue").ShallowRef<any>;
171
167
  setOption: (option: Option, updateOptions?: UpdateOptions) => void;
172
168
  nonEventAttrs: import("vue").ComputedRef<{
173
169
  [x: string]: any;
174
170
  }>;
175
171
  nativeListeners: Record<string, unknown>;
176
172
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
177
- click: (params: import("echarts").ECElementEvent) => boolean;
178
- dblclick: (params: import("echarts").ECElementEvent) => boolean;
179
- mouseout: (params: import("echarts").ECElementEvent) => boolean;
180
- mouseover: (params: import("echarts").ECElementEvent) => boolean;
181
- mouseup: (params: import("echarts").ECElementEvent) => boolean;
182
- mousedown: (params: import("echarts").ECElementEvent) => boolean;
183
- mousemove: (params: import("echarts").ECElementEvent) => boolean;
184
- contextmenu: (params: import("echarts").ECElementEvent) => boolean;
185
- globalout: (params: import("echarts").ECElementEvent) => boolean;
173
+ click: (params: import("echarts/core").ECElementEvent) => boolean;
174
+ dblclick: (params: import("echarts/core").ECElementEvent) => boolean;
175
+ mouseout: (params: import("echarts/core").ECElementEvent) => boolean;
176
+ mouseover: (params: import("echarts/core").ECElementEvent) => boolean;
177
+ mouseup: (params: import("echarts/core").ECElementEvent) => boolean;
178
+ mousedown: (params: import("echarts/core").ECElementEvent) => boolean;
179
+ mousemove: (params: import("echarts/core").ECElementEvent) => boolean;
180
+ contextmenu: (params: import("echarts/core").ECElementEvent) => boolean;
181
+ globalout: (params: import("echarts/core").ECElementEvent) => boolean;
186
182
  } & {
187
183
  highlight: null;
188
184
  downplay: null;
@@ -217,26 +213,26 @@ declare const _default: import("vue").DefineComponent<{
217
213
  }) => boolean;
218
214
  finished: () => boolean;
219
215
  } & {
220
- "zr:mousewheel": (params: import("echarts").ElementEvent) => boolean;
221
- "zr:drag": (params: import("echarts").ElementEvent) => boolean;
222
- "zr:dragstart": (params: import("echarts").ElementEvent) => boolean;
223
- "zr:dragend": (params: import("echarts").ElementEvent) => boolean;
224
- "zr:dragenter": (params: import("echarts").ElementEvent) => boolean;
225
- "zr:dragleave": (params: import("echarts").ElementEvent) => boolean;
226
- "zr:dragover": (params: import("echarts").ElementEvent) => boolean;
227
- "zr:drop": (params: import("echarts").ElementEvent) => boolean;
228
- "zr:click": (params: import("echarts").ElementEvent) => boolean;
229
- "zr:dblclick": (params: import("echarts").ElementEvent) => boolean;
230
- "zr:mouseout": (params: import("echarts").ElementEvent) => boolean;
231
- "zr:mouseover": (params: import("echarts").ElementEvent) => boolean;
232
- "zr:mouseup": (params: import("echarts").ElementEvent) => boolean;
233
- "zr:mousedown": (params: import("echarts").ElementEvent) => boolean;
234
- "zr:mousemove": (params: import("echarts").ElementEvent) => boolean;
235
- "zr:contextmenu": (params: import("echarts").ElementEvent) => boolean;
236
- "zr:globalout": (params: import("echarts").ElementEvent) => boolean;
216
+ "zr:mousewheel": (params: import("echarts/core").ElementEvent) => boolean;
217
+ "zr:drag": (params: import("echarts/core").ElementEvent) => boolean;
218
+ "zr:dragstart": (params: import("echarts/core").ElementEvent) => boolean;
219
+ "zr:dragend": (params: import("echarts/core").ElementEvent) => boolean;
220
+ "zr:dragenter": (params: import("echarts/core").ElementEvent) => boolean;
221
+ "zr:dragleave": (params: import("echarts/core").ElementEvent) => boolean;
222
+ "zr:dragover": (params: import("echarts/core").ElementEvent) => boolean;
223
+ "zr:drop": (params: import("echarts/core").ElementEvent) => boolean;
224
+ "zr:click": (params: import("echarts/core").ElementEvent) => boolean;
225
+ "zr:dblclick": (params: import("echarts/core").ElementEvent) => boolean;
226
+ "zr:mouseout": (params: import("echarts/core").ElementEvent) => boolean;
227
+ "zr:mouseover": (params: import("echarts/core").ElementEvent) => boolean;
228
+ "zr:mouseup": (params: import("echarts/core").ElementEvent) => boolean;
229
+ "zr:mousedown": (params: import("echarts/core").ElementEvent) => boolean;
230
+ "zr:mousemove": (params: import("echarts/core").ElementEvent) => boolean;
231
+ "zr:contextmenu": (params: import("echarts/core").ElementEvent) => boolean;
232
+ "zr:globalout": (params: import("echarts/core").ElementEvent) => boolean;
237
233
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
238
234
  loading: BooleanConstructor;
239
- loadingOptions: PropType<import("./types").LoadingOptions>;
235
+ loadingOptions: PropType<import("../types").LoadingOptions>;
240
236
  autoresize: PropType<boolean | {
241
237
  throttle?: number | undefined;
242
238
  onResize?: (() => void) | undefined;
@@ -246,36 +242,36 @@ declare const _default: import("vue").DefineComponent<{
246
242
  type: PropType<Theme>;
247
243
  };
248
244
  initOptions: PropType<import("echarts/core").EChartsInitOpts>;
249
- updateOptions: PropType<import("echarts").SetOptionOpts>;
245
+ updateOptions: PropType<import("echarts/core").SetOptionOpts>;
250
246
  group: StringConstructor;
251
247
  manualUpdate: BooleanConstructor;
252
248
  }>> & {
253
- onClick?: ((params: import("echarts").ECElementEvent) => any) | undefined;
254
- onDblclick?: ((params: import("echarts").ECElementEvent) => any) | undefined;
255
- onMouseout?: ((params: import("echarts").ECElementEvent) => any) | undefined;
256
- onMouseover?: ((params: import("echarts").ECElementEvent) => any) | undefined;
257
- onMouseup?: ((params: import("echarts").ECElementEvent) => any) | undefined;
258
- onMousedown?: ((params: import("echarts").ECElementEvent) => any) | undefined;
259
- onMousemove?: ((params: import("echarts").ECElementEvent) => any) | undefined;
260
- onContextmenu?: ((params: import("echarts").ECElementEvent) => any) | undefined;
261
- onGlobalout?: ((params: import("echarts").ECElementEvent) => any) | undefined;
262
- "onZr:mousewheel"?: ((params: import("echarts").ElementEvent) => any) | undefined;
263
- "onZr:drag"?: ((params: import("echarts").ElementEvent) => any) | undefined;
264
- "onZr:dragstart"?: ((params: import("echarts").ElementEvent) => any) | undefined;
265
- "onZr:dragend"?: ((params: import("echarts").ElementEvent) => any) | undefined;
266
- "onZr:dragenter"?: ((params: import("echarts").ElementEvent) => any) | undefined;
267
- "onZr:dragleave"?: ((params: import("echarts").ElementEvent) => any) | undefined;
268
- "onZr:dragover"?: ((params: import("echarts").ElementEvent) => any) | undefined;
269
- "onZr:drop"?: ((params: import("echarts").ElementEvent) => any) | undefined;
270
- "onZr:click"?: ((params: import("echarts").ElementEvent) => any) | undefined;
271
- "onZr:dblclick"?: ((params: import("echarts").ElementEvent) => any) | undefined;
272
- "onZr:mouseout"?: ((params: import("echarts").ElementEvent) => any) | undefined;
273
- "onZr:mouseover"?: ((params: import("echarts").ElementEvent) => any) | undefined;
274
- "onZr:mouseup"?: ((params: import("echarts").ElementEvent) => any) | undefined;
275
- "onZr:mousedown"?: ((params: import("echarts").ElementEvent) => any) | undefined;
276
- "onZr:mousemove"?: ((params: import("echarts").ElementEvent) => any) | undefined;
277
- "onZr:contextmenu"?: ((params: import("echarts").ElementEvent) => any) | undefined;
278
- "onZr:globalout"?: ((params: import("echarts").ElementEvent) => any) | undefined;
249
+ onClick?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
250
+ onDblclick?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
251
+ onMouseout?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
252
+ onMouseover?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
253
+ onMouseup?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
254
+ onMousedown?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
255
+ onMousemove?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
256
+ onContextmenu?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
257
+ onGlobalout?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
258
+ "onZr:mousewheel"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
259
+ "onZr:drag"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
260
+ "onZr:dragstart"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
261
+ "onZr:dragend"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
262
+ "onZr:dragenter"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
263
+ "onZr:dragleave"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
264
+ "onZr:dragover"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
265
+ "onZr:drop"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
266
+ "onZr:click"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
267
+ "onZr:dblclick"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
268
+ "onZr:mouseout"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
269
+ "onZr:mouseover"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
270
+ "onZr:mouseup"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
271
+ "onZr:mousedown"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
272
+ "onZr:mousemove"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
273
+ "onZr:contextmenu"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
274
+ "onZr:globalout"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
279
275
  onHighlight?: ((...args: any[]) => any) | undefined;
280
276
  onDownplay?: ((...args: any[]) => any) | undefined;
281
277
  onSelectchanged?: ((...args: any[]) => any) | undefined;
@@ -19,17 +19,18 @@ import {
19
19
  autoresizeProps,
20
20
  useLoading,
21
21
  loadingProps
22
- } from "./composables/index.mjs";
23
- import { isOn, omitOn } from "./utils.mjs";
24
- import { register, TAG_NAME } from "./wc.mjs";
25
- import "./style.css";
22
+ } from "../composables/index.js";
23
+ import { isOn, omitOn } from "../utils/on.js";
24
+ import { register, TAG_NAME } from "../utils/wc.js";
25
+ import "#build/echarts.mjs";
26
+ import {
27
+ THEME_KEY,
28
+ INIT_OPTIONS_KEY,
29
+ UPDATE_OPTIONS_KEY
30
+ } from "../utils/injection.js";
26
31
  const wcRegistered = register();
27
- export const THEME_KEY = "ecTheme";
28
- export const INIT_OPTIONS_KEY = "ecInitOptions";
29
- export const UPDATE_OPTIONS_KEY = "ecUpdateOptions";
30
- export { LOADING_OPTIONS_KEY } from "./composables/index.mjs";
31
32
  export default defineComponent({
32
- name: "echarts",
33
+ name: "VChart",
33
34
  props: {
34
35
  option: Object,
35
36
  theme: {
@@ -207,7 +208,8 @@ export default defineComponent({
207
208
  const publicApi = usePublicAPI(chart);
208
209
  useLoading(chart, loading, loadingOptions);
209
210
  useAutoresize(chart, autoresize, inner);
210
- onMounted(() => {
211
+ onMounted(async () => {
212
+ await nextTick();
211
213
  init();
212
214
  });
213
215
  onBeforeUnmount(() => {
@@ -0,0 +1,5 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <VChartServer v-bind="$attrs" />
5
+ </template>
@@ -0,0 +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>
@@ -0,0 +1,78 @@
1
+ <script>
2
+ import { defineComponent } from "vue";
3
+ export default defineComponent({
4
+ inheritAttrs: false,
5
+ emits: {}
6
+ });
7
+ </script>
8
+
9
+ <script setup lang="ts">
10
+ defineProps<{
11
+ option?: Option
12
+ theme?: Theme
13
+ initOptions?: InitOptions
14
+ }>()
15
+ defineOptions({ inheritAttrs: false })
16
+
17
+ type ECSSRHandler = (params: ECSSRClientEventParams) => string | undefined
18
+ type ECSSREventOn = `on${Capitalize<ECSSREvent>}`
19
+
20
+ const root = ref<HTMLElement | null>(null)
21
+ const attrs = useAttrs() as Partial<Record<ECSSREventOn, ECSSRHandler>>
22
+ let container: HTMLElement
23
+ function hydrateChart() {
24
+ container = root.value?.querySelector?.('.vue-echarts-inner') as HTMLElement
25
+ if (container) {
26
+ // Use the lightweight runtime to give the chart interactive capabilities
27
+ hydrate(container, {
28
+ on: {
29
+ click: attrs.onClick
30
+ ? (params) => {
31
+ const svg = attrs.onClick!(params)
32
+ svg && setInnerHTML(svg)
33
+ }
34
+ : undefined,
35
+ mouseout: attrs.onMouseout
36
+ ? (params) => {
37
+ const svg = attrs.onMouseout!(params)
38
+ svg && setInnerHTML(svg)
39
+ }
40
+ : undefined,
41
+ mouseover: attrs.onMouseover
42
+ ? (params) => {
43
+ const svg = attrs.onMouseover!(params)
44
+ svg && setInnerHTML(svg)
45
+ }
46
+ : undefined,
47
+ },
48
+ })
49
+ }
50
+ }
51
+
52
+ function setInnerHTML(svgStr?: string) {
53
+ if (container && svgStr) container.innerHTML = svgStr
54
+ }
55
+
56
+ let observer: MutationObserver
57
+ onMounted(async () => {
58
+ await nextTick()
59
+ hydrateChart()
60
+ observer = new MutationObserver(async () => {
61
+ hydrateChart()
62
+ })
63
+
64
+ // call 'observe' on that MutationObserver instance,
65
+ // passing it the element to observe, and the options object
66
+ observer.observe(root.value!, {
67
+ characterData: false,
68
+ childList: true,
69
+ attributes: false,
70
+ })
71
+ })
72
+ </script>
73
+
74
+ <template>
75
+ <div ref="root">
76
+ <VChartServer :option="option" :init-options="initOptions" :theme="theme" />
77
+ </div>
78
+ </template>
@@ -0,0 +1,26 @@
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
+ };
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ import { computed, unref, inject, ref } from 'vue'
3
+ import type { InitOptions, Option, Theme } from '../types'
4
+ import { THEME_KEY, INIT_OPTIONS_KEY } from '../utils/injection'
5
+ import type { VChartIsland } from '#components'
6
+
7
+ const defaultTheme = inject(THEME_KEY, null)
8
+ const defaultInitOptions = inject(INIT_OPTIONS_KEY, null)
9
+
10
+ const props = defineProps<{
11
+ option?: Option
12
+ theme?: Theme
13
+ initOptions?: InitOptions
14
+ }>()
15
+ const emits = defineEmits<{ (event: 'error', error: unknown): void }>()
16
+
17
+ const realTheme = computed(() => props.theme || unref(defaultTheme) || {})
18
+ const realInitOptions = computed(
19
+ // @ts-expect-error unknown computed type error
20
+ () => props.initOptions || unref(defaultInitOptions) || {},
21
+ )
22
+ function onError(e: unknown) {
23
+ // https://github.com/nuxt/nuxt/issues/27491
24
+ if (
25
+ e instanceof TypeError &&
26
+ e.message === "Cannot read properties of undefined (reading 'link')"
27
+ ) {
28
+ // @ts-expect-error NuxtIsland.refresh in not defined
29
+ root.value.refresh()
30
+ }
31
+ emits('error', e)
32
+ }
33
+ const root = ref<InstanceType<typeof VChartIsland> | null>(null)
34
+ </script>
35
+
36
+ <template>
37
+ <VChartIsland
38
+ ref="root"
39
+ :theme="realTheme"
40
+ :option="option"
41
+ :init-options="realInitOptions"
42
+ @error="onError"
43
+ >
44
+ <template #fallback>
45
+ <slot name="fallback" />
46
+ </template>
47
+ </VChartIsland>
48
+ </template>
@@ -1,5 +1,5 @@
1
1
  import type { Ref } from 'vue';
2
- import type { EChartsType } from '../types';
2
+ import type { EChartsType } from '../types.js';
3
3
  declare const METHOD_NAMES: readonly ["getWidth", "getHeight", "getDom", "getOption", "resize", "dispatchAction", "convertToPixel", "convertFromPixel", "containPixel", "getDataURL", "getConnectedDataURL", "appendData", "clear", "isDisposed", "dispose"];
4
4
  type MethodName = (typeof METHOD_NAMES)[number];
5
5
  type PublicMethods = Pick<EChartsType, MethodName>;
@@ -1,11 +0,0 @@
1
- import { type Ref, type PropType } from 'vue';
2
- import { type EChartsType } from '../types';
3
- type AutoresizeProp = boolean | {
4
- throttle?: number;
5
- onResize?: () => void;
6
- };
7
- export declare function useAutoresize(chart: Ref<EChartsType | undefined>, autoresize: Ref<AutoresizeProp | undefined>, root: Ref<HTMLElement | undefined>): void;
8
- export declare const autoresizeProps: {
9
- autoresize: PropType<AutoresizeProp>;
10
- };
11
- export {};
@@ -1,3 +1,3 @@
1
- export * from './api';
2
- export * from './autoresize';
3
- export * from './loading';
1
+ export * from './api.js';
2
+ export * from './autoresize.js';
3
+ export * from './loading.js';
@@ -0,0 +1,3 @@
1
+ export * from "./api.js";
2
+ export * from "./autoresize.js";
3
+ export * from "./loading.js";
@@ -1,5 +1,5 @@
1
1
  import { type Ref, type InjectionKey, type PropType } from 'vue';
2
- import type { EChartsType, LoadingOptions } from '../types';
2
+ 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: {
@@ -1 +1 @@
1
- x-vue-echarts{display:block;height:100%;min-width:0;position:relative;width:100%}.vue-echarts-inner{bottom:0;left:0;position:absolute;right:0;top:0}
1
+ .vue-echarts-container,x-vue-echarts{display:flex;flex-direction:column;height:100%;min-width:0;width:100%}.vue-echarts-inner{flex-grow:1;height:auto!important;min-width:0;width:auto!important}
@@ -1,5 +1,4 @@
1
- import type { init } from 'echarts/core';
2
- import type { SetOptionOpts, ECElementEvent, ElementEvent } from 'echarts';
1
+ import type { init, SetOptionOpts, ECElementEvent, ElementEvent } from 'echarts/core';
3
2
  import type { Ref } from 'vue';
4
3
  export type Injection<T> = T | null | Ref<T | null> | {
5
4
  value: T | null;
@@ -0,0 +1,6 @@
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>;
5
+ export declare const UPDATE_OPTIONS_KEY: InjectionKey<UpdateOptionsInjection>;
6
+ export { LOADING_OPTIONS_KEY } from '../composables.js';
@@ -0,0 +1,4 @@
1
+ export const THEME_KEY = "ecTheme";
2
+ export const INIT_OPTIONS_KEY = "ecInitOptions";
3
+ export const UPDATE_OPTIONS_KEY = "ecUpdateOptions";
4
+ export { LOADING_OPTIONS_KEY } from "../composables/index.js";
File without changes
package/dist/types.d.mts CHANGED
@@ -1,16 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
1
2
 
2
- import type { ModuleOptions } from './module.js'
3
+ import type { default as Module } from './module.js'
3
4
 
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
4
6
 
5
- declare module '@nuxt/schema' {
6
- interface NuxtConfig { ['echarts']?: Partial<ModuleOptions> }
7
- interface NuxtOptions { ['echarts']?: ModuleOptions }
8
- }
9
-
10
- declare module 'nuxt/schema' {
11
- interface NuxtConfig { ['echarts']?: Partial<ModuleOptions> }
12
- interface NuxtOptions { ['echarts']?: ModuleOptions }
13
- }
14
-
15
-
16
- export type { ModuleOptions, default } from './module.js'
7
+ export { default } from './module.js'
package/dist/types.d.ts CHANGED
@@ -1,16 +1,7 @@
1
+ import type { NuxtModule } from '@nuxt/schema'
1
2
 
2
- import type { ModuleOptions } from './module'
3
+ import type { default as Module } from './module'
3
4
 
5
+ export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
4
6
 
5
- declare module '@nuxt/schema' {
6
- interface NuxtConfig { ['echarts']?: Partial<ModuleOptions> }
7
- interface NuxtOptions { ['echarts']?: ModuleOptions }
8
- }
9
-
10
- declare module 'nuxt/schema' {
11
- interface NuxtConfig { ['echarts']?: Partial<ModuleOptions> }
12
- interface NuxtOptions { ['echarts']?: ModuleOptions }
13
- }
14
-
15
-
16
- export type { ModuleOptions, default } from './module'
7
+ export { default } from './module'
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "nuxt-echarts",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Nuxt Module for Apache ECharts™",
5
+ "keywords": [
6
+ "vue",
7
+ "nuxt",
8
+ "echarts",
9
+ "data-visualization",
10
+ "charts"
11
+ ],
5
12
  "author": "Yue JIN <yuejin13@fudan.edu.cn>",
6
13
  "repository": "kingyue737/nuxt-echarts",
7
14
  "license": "MIT",
8
15
  "type": "module",
9
- "packageManager": "pnpm@9.1.4",
16
+ "packageManager": "pnpm@9.4.0",
10
17
  "exports": {
11
18
  ".": {
12
19
  "types": "./dist/types.d.ts",
@@ -32,23 +39,23 @@
32
39
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
33
40
  },
34
41
  "dependencies": {
35
- "@nuxt/kit": "^3.11.2",
42
+ "@nuxt/kit": "^3.12.2",
36
43
  "echarts": "^5.5.0"
37
44
  },
38
45
  "devDependencies": {
39
- "@nuxt/devtools": "^1.3.2",
46
+ "@nuxt/devtools": "^1.3.3",
40
47
  "@nuxt/eslint-config": "^0.3.13",
41
- "@nuxt/module-builder": "^0.6.0",
42
- "@nuxt/schema": "^3.11.2",
48
+ "@nuxt/module-builder": "^0.8.0",
49
+ "@nuxt/schema": "^3.12.2",
43
50
  "@nuxt/test-utils": "^3.13.1",
44
- "@types/node": "^20.12.13",
51
+ "@types/node": "^20.14.5",
45
52
  "changelogen": "^0.5.5",
46
- "eslint": "^9.3.0",
47
- "nuxt": "^3.11.2",
48
- "prettier": "^3.2.5",
53
+ "eslint": "^9.5.0",
54
+ "nuxt": "^3.12.2",
55
+ "prettier": "^3.3.2",
49
56
  "typescript": "latest",
50
57
  "vitest": "^1.6.0",
51
- "vue-tsc": "^2.0.19"
58
+ "vue-tsc": "^2.0.21"
52
59
  },
53
60
  "pnpm": {
54
61
  "peerDependencyRules": {
@@ -56,8 +63,12 @@
56
63
  "@typescript-eslint/eslint-plugin>eslint": "^9.0.0",
57
64
  "@typescript-eslint/parser>eslint": "^9.0.0",
58
65
  "@typescript-eslint/type-utils>eslint": "^9.0.0",
59
- "@typescript-eslint/utils>eslint": "^9.0.0"
60
- }
66
+ "@typescript-eslint/utils>eslint": "^9.0.0",
67
+ "@opentelemetry/api": "^1.9.0"
68
+ },
69
+ "ignoreMissing": [
70
+ "webpack"
71
+ ]
61
72
  }
62
73
  }
63
74
  }
@@ -1,3 +0,0 @@
1
- export * from "./api.mjs";
2
- export * from "./autoresize.mjs";
3
- export * from "./loading.mjs";
@@ -1,3 +0,0 @@
1
- import VChart from './VChart';
2
- export default VChart;
3
- export * from './VChart';
@@ -1,3 +0,0 @@
1
- import VChart from "./VChart.mjs";
2
- export default VChart;
3
- export * from "./VChart.mjs";
@@ -1,6 +0,0 @@
1
- export declare const TAG_NAME = "x-vue-echarts";
2
- export declare class EChartsElement extends HTMLElement {
3
- __dispose: (() => void) | null;
4
- disconnectedCallback(): void;
5
- }
6
- export declare function register(): boolean;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes