nuxt-echarts 0.2.2 → 0.2.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.
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/dist/module.d.mts CHANGED
@@ -37,6 +37,6 @@ interface ModuleOptions {
37
37
  ssr?: boolean;
38
38
  }
39
39
 
40
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
40
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
41
41
 
42
42
  export { _default as default };
package/dist/module.d.ts CHANGED
@@ -37,6 +37,6 @@ interface ModuleOptions {
37
37
  ssr?: boolean;
38
38
  }
39
39
 
40
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
40
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
41
41
 
42
42
  export { _default as default };
package/dist/module.json CHANGED
@@ -4,9 +4,9 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.2.0"
6
6
  },
7
- "version": "0.2.2",
7
+ "version": "0.2.4",
8
8
  "builder": {
9
- "@nuxt/module-builder": "0.8.1",
9
+ "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
11
11
  }
12
12
  }
@@ -2,7 +2,7 @@ import { type PropType } from 'vue';
2
2
  import type { Option, Theme, InitOptions, UpdateOptions } from '../types.js';
3
3
  import { type EChartsElement } from '../utils/wc.js';
4
4
  import '#build/echarts.mjs';
5
- declare const _default: import("vue").DefineComponent<{
5
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
6
  loading: BooleanConstructor;
7
7
  loadingOptions: PropType<import("../types").LoadingOptions>;
8
8
  autoresize: PropType<boolean | {
@@ -17,7 +17,7 @@ declare const _default: import("vue").DefineComponent<{
17
17
  updateOptions: PropType<UpdateOptions>;
18
18
  group: StringConstructor;
19
19
  manualUpdate: BooleanConstructor;
20
- }, {
20
+ }>, {
21
21
  getWidth: () => number;
22
22
  getHeight: () => number;
23
23
  getDom: () => HTMLElement;
@@ -161,14 +161,14 @@ declare const _default: import("vue").DefineComponent<{
161
161
  clear: () => void;
162
162
  isDisposed: () => boolean;
163
163
  dispose: () => void;
164
- chart: import("vue").ShallowRef<import("echarts/core").ECharts | undefined>;
165
- root: import("vue").ShallowRef<EChartsElement | undefined>;
164
+ chart: import("vue").ShallowRef<import("echarts/core").ECharts | undefined, import("echarts/core").ECharts | undefined>;
165
+ root: import("vue").ShallowRef<EChartsElement | undefined, EChartsElement | undefined>;
166
166
  setOption: (option: Option, updateOptions?: UpdateOptions) => void;
167
167
  realAttrs: import("vue").ComputedRef<{
168
168
  [x: string]: any;
169
169
  }>;
170
- nativeListeners: import("vue").Ref<Record<string, unknown>, Record<string, unknown>>;
171
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
170
+ nativeListeners: import("vue").ShallowRef<Record<string, unknown>, Record<string, unknown>>;
171
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
172
172
  click: (params: import("echarts/core").ECElementEvent) => void;
173
173
  dblclick: (params: import("echarts/core").ECElementEvent) => void;
174
174
  mouseout: (params: import("echarts/core").ECElementEvent) => void;
@@ -244,15 +244,15 @@ declare const _default: import("vue").DefineComponent<{
244
244
  updateOptions: PropType<UpdateOptions>;
245
245
  group: StringConstructor;
246
246
  manualUpdate: BooleanConstructor;
247
- }>> & {
247
+ }>> & Readonly<{
248
248
  onClick?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
249
- onContextmenu?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
250
249
  onDblclick?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
251
- onMousedown?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
252
- onMousemove?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
253
250
  onMouseout?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
254
251
  onMouseover?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
255
252
  onMouseup?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
253
+ onMousedown?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
254
+ onMousemove?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
255
+ onContextmenu?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
256
256
  onGlobalout?: ((params: import("echarts/core").ECElementEvent) => any) | undefined;
257
257
  "onZr:mousewheel"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
258
258
  "onZr:drag"?: ((params: import("echarts/core").ElementEvent) => any) | undefined;
@@ -302,8 +302,8 @@ declare const _default: import("vue").DefineComponent<{
302
302
  elapsedTime: number;
303
303
  }) => any) | undefined;
304
304
  onFinished?: (() => any) | undefined;
305
- }, {
305
+ }>, {
306
306
  manualUpdate: boolean;
307
307
  loading: boolean;
308
- }, {}>;
308
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
309
309
  export default _default;
@@ -2,7 +2,6 @@ import {
2
2
  defineComponent,
3
3
  shallowRef,
4
4
  toRefs,
5
- ref,
6
5
  unref,
7
6
  watch,
8
7
  computed,
@@ -63,20 +62,21 @@ export default defineComponent({
63
62
  const realUpdateOptions = computed(
64
63
  () => props.updateOptions || unref(defaultUpdateOptions) || {}
65
64
  );
66
- const nativeListeners = ref({});
65
+ const nativeListeners = shallowRef({});
67
66
  const realAttrs = computed(() => ({
68
67
  ...omitOn(attrs),
69
68
  ...nativeListeners.value
70
69
  }));
71
70
  const realListeners = {};
72
71
  function init(option) {
72
+ const _nativeListeners = {};
73
73
  Object.keys(attrs).filter((key) => isOn(key)).forEach((key) => {
74
74
  let event = key.charAt(2).toLowerCase() + key.slice(3);
75
75
  if (event.indexOf("native:") === 0) {
76
76
  const nativeKey = `on${event.charAt(7).toUpperCase()}${event.slice(
77
77
  8
78
78
  )}`;
79
- nativeListeners.value[nativeKey] = attrs[key];
79
+ _nativeListeners[nativeKey] = attrs[key];
80
80
  return;
81
81
  }
82
82
  if (event.substring(event.length - 4) === "Once") {
@@ -84,6 +84,7 @@ export default defineComponent({
84
84
  }
85
85
  realListeners[event] = attrs[key];
86
86
  });
87
+ nativeListeners.value = _nativeListeners;
87
88
  if (!root.value) {
88
89
  return;
89
90
  }
@@ -1,31 +1,32 @@
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
- const chart = echarts.init(null, props.theme, initOptions)
18
- chart.setOption(props.option || {})
19
- svgStr.value = chart.renderToSVGString()
20
-
21
- chart.dispose()
22
-
23
- defineSlots<{ fallback: any }>()
24
- </script>
25
-
26
- <template>
27
- <div class="vue-echarts-container">
28
- <!--eslint-disable-next-line vue/no-v-html-->
29
- <div class="vue-echarts-inner" v-html="svgStr" />
30
- </div>
31
- </template>
1
+ <script setup lang="ts">
2
+ import * as echarts from 'echarts'
3
+ import '#build/echarts.mjs'
4
+ import { ref } from 'vue'
5
+ import type { Option, InitOptions, Theme } from '../types'
6
+
7
+ const props = defineProps<{
8
+ option?: Option
9
+ initOptions?: InitOptions
10
+ theme?: Theme
11
+ }>()
12
+
13
+ const svgStr = ref('')
14
+ const initOptions: InitOptions = echarts.util.merge(
15
+ { renderer: 'svg', ssr: true } satisfies InitOptions,
16
+ props.initOptions || {},
17
+ )
18
+ const chart = echarts.init(null, props.theme, initOptions)
19
+ chart.setOption(props.option || {})
20
+ svgStr.value = chart.renderToSVGString()
21
+
22
+ chart.dispose()
23
+
24
+ defineSlots<{ fallback: any }>()
25
+ </script>
26
+
27
+ <template>
28
+ <div class="vue-echarts-container">
29
+ <!--eslint-disable-next-line vue/no-v-html-->
30
+ <div class="vue-echarts-inner" v-html="svgStr" />
31
+ </div>
32
+ </template>
@@ -24,8 +24,8 @@ export default defineComponent({
24
24
  const attrs = useAttrs();
25
25
  let container;
26
26
  function hydrateChart() {
27
- container = root.value?.$el;
28
- if (container) {
27
+ if (root.value?.$el) {
28
+ container = root.value?.$el;
29
29
  hydrate(container, {
30
30
  on: {
31
31
  click: attrs.onClick,
@@ -51,13 +51,13 @@ export default defineComponent({
51
51
  return { root };
52
52
  }
53
53
  });
54
- </script>
55
-
56
- <template>
57
- <VChartServer
58
- ref="root"
59
- :option="option"
60
- :init-options="initOptions"
61
- :theme="theme"
62
- />
63
- </template>
54
+ </script>
55
+
56
+ <template>
57
+ <VChartServer
58
+ ref="root"
59
+ :option="option"
60
+ :init-options="initOptions"
61
+ :theme="theme"
62
+ />
63
+ </template>
@@ -2,13 +2,13 @@ import { type ECSSRClientEventParams, type ECSSREvent } from 'echarts/ssr/client
2
2
  import type { InitOptions, Option, Theme } from '../types.js';
3
3
  import { nextTick, type PropType } from 'vue';
4
4
  type ECSSRHandler = (params: ECSSRClientEventParams) => string | undefined;
5
- declare const _default: import("vue").DefineComponent<{
5
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
6
  option: PropType<Option>;
7
7
  theme: {
8
8
  type: PropType<Theme>;
9
9
  };
10
10
  initOptions: PropType<InitOptions>;
11
- }, {
11
+ }>, {
12
12
  root: import("vue").Ref<({
13
13
  $: import("vue").ComponentInternalInstance;
14
14
  $data: {};
@@ -16,20 +16,8 @@ declare const _default: import("vue").DefineComponent<{
16
16
  readonly option?: Option | undefined;
17
17
  readonly initOptions?: InitOptions | undefined;
18
18
  readonly theme?: Theme | undefined;
19
- onError?: ((error: unknown) => any) | undefined;
20
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
21
- option: {
22
- type: PropType<import("echarts/core").EChartsCoreOption>;
23
- };
24
- theme: {
25
- type: PropType<Theme>;
26
- };
27
- initOptions: {
28
- type: PropType<import("echarts/core").EChartsInitOpts>;
29
- };
30
- }>> & {
31
- onError?: ((error: unknown) => any) | undefined;
32
- }, never>;
19
+ readonly onError?: ((error: unknown) => any) | undefined;
20
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
33
21
  $attrs: {
34
22
  [x: string]: unknown;
35
23
  };
@@ -41,6 +29,7 @@ declare const _default: import("vue").DefineComponent<{
41
29
  }>;
42
30
  $root: import("vue").ComponentPublicInstance | null;
43
31
  $parent: import("vue").ComponentPublicInstance | null;
32
+ $host: Element | null;
44
33
  $emit: (event: "error", error: unknown) => void;
45
34
  $el: any;
46
35
  $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
@@ -53,11 +42,11 @@ declare const _default: import("vue").DefineComponent<{
53
42
  initOptions: {
54
43
  type: PropType<import("echarts/core").EChartsInitOpts>;
55
44
  };
56
- }>> & {
45
+ }>> & Readonly<{
57
46
  onError?: ((error: unknown) => any) | undefined;
58
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
47
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
59
48
  error: (error: unknown) => void;
60
- }, string, {}, {}, string, {}> & {
49
+ }, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
61
50
  beforeCreate?: (() => void) | (() => void)[];
62
51
  created?: (() => void) | (() => void)[];
63
52
  beforeMount?: (() => void) | (() => void)[];
@@ -76,8 +65,8 @@ declare const _default: import("vue").DefineComponent<{
76
65
  };
77
66
  $forceUpdate: () => void;
78
67
  $nextTick: typeof nextTick;
79
- $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, (cleanupFn: () => void) => void]) => any : (...args: [any, any, (cleanupFn: () => void) => void]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
80
- } & Omit<Readonly<import("vue").ExtractPropTypes<{
68
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
69
+ } & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
81
70
  option: {
82
71
  type: PropType<import("echarts/core").EChartsCoreOption>;
83
72
  };
@@ -87,9 +76,9 @@ declare const _default: import("vue").DefineComponent<{
87
76
  initOptions: {
88
77
  type: PropType<import("echarts/core").EChartsInitOpts>;
89
78
  };
90
- }>> & {
79
+ }>> & Readonly<{
91
80
  onError?: ((error: unknown) => any) | undefined;
92
- }, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
81
+ }>, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
93
82
  $slots: {
94
83
  fallback?(_: {}): any;
95
84
  };
@@ -100,20 +89,8 @@ declare const _default: import("vue").DefineComponent<{
100
89
  readonly option?: Option | undefined;
101
90
  readonly initOptions?: InitOptions | undefined;
102
91
  readonly theme?: Theme | undefined;
103
- onError?: ((error: unknown) => any) | undefined;
104
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
105
- option: {
106
- type: PropType<import("echarts/core").EChartsCoreOption>;
107
- };
108
- theme: {
109
- type: PropType<Theme>;
110
- };
111
- initOptions: {
112
- type: PropType<import("echarts/core").EChartsInitOpts>;
113
- };
114
- }>> & {
115
- onError?: ((error: unknown) => any) | undefined;
116
- }, never>;
92
+ readonly onError?: ((error: unknown) => any) | undefined;
93
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
117
94
  $attrs: {
118
95
  [x: string]: unknown;
119
96
  };
@@ -125,6 +102,7 @@ declare const _default: import("vue").DefineComponent<{
125
102
  }>;
126
103
  $root: import("vue").ComponentPublicInstance | null;
127
104
  $parent: import("vue").ComponentPublicInstance | null;
105
+ $host: Element | null;
128
106
  $emit: (event: "error", error: unknown) => void;
129
107
  $el: any;
130
108
  $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
@@ -137,11 +115,11 @@ declare const _default: import("vue").DefineComponent<{
137
115
  initOptions: {
138
116
  type: PropType<import("echarts/core").EChartsInitOpts>;
139
117
  };
140
- }>> & {
118
+ }>> & Readonly<{
141
119
  onError?: ((error: unknown) => any) | undefined;
142
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
120
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
143
121
  error: (error: unknown) => void;
144
- }, string, {}, {}, string, {}> & {
122
+ }, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
145
123
  beforeCreate?: (() => void) | (() => void)[];
146
124
  created?: (() => void) | (() => void)[];
147
125
  beforeMount?: (() => void) | (() => void)[];
@@ -160,8 +138,8 @@ declare const _default: import("vue").DefineComponent<{
160
138
  };
161
139
  $forceUpdate: () => void;
162
140
  $nextTick: typeof nextTick;
163
- $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, (cleanupFn: () => void) => void]) => any : (...args: [any, any, (cleanupFn: () => void) => void]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
164
- } & Omit<Readonly<import("vue").ExtractPropTypes<{
141
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import("@vue/reactivity").OnCleanup]) => any : (...args: [any, any, import("@vue/reactivity").OnCleanup]) => any, options?: import("vue").WatchOptions): import("vue").WatchStopHandle;
142
+ } & Readonly<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
165
143
  option: {
166
144
  type: PropType<import("echarts/core").EChartsCoreOption>;
167
145
  };
@@ -171,22 +149,325 @@ declare const _default: import("vue").DefineComponent<{
171
149
  initOptions: {
172
150
  type: PropType<import("echarts/core").EChartsInitOpts>;
173
151
  };
174
- }>> & {
152
+ }>> & Readonly<{
175
153
  onError?: ((error: unknown) => any) | undefined;
176
- }, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
154
+ }>, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
177
155
  $slots: {
178
156
  fallback?(_: {}): any;
179
157
  };
180
158
  }) | null>;
181
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<ECSSREvent, ECSSRHandler>, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
159
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<ECSSREvent, ECSSRHandler>, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
182
160
  option: PropType<Option>;
183
161
  theme: {
184
162
  type: PropType<Theme>;
185
163
  };
186
164
  initOptions: PropType<InitOptions>;
187
- }>> & {
165
+ }>> & Readonly<{
188
166
  onClick?: ((params: ECSSRClientEventParams) => any) | undefined;
189
167
  onMouseout?: ((params: ECSSRClientEventParams) => any) | undefined;
190
168
  onMouseover?: ((params: ECSSRClientEventParams) => any) | undefined;
191
- }, {}, {}>;
169
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
192
170
  export default _default;
171
+ declare module 'vue' {
172
+ interface GlobalComponents {
173
+ }
174
+ interface GlobalDirectives {
175
+ }
176
+ }
177
+ declare global {
178
+ const __VLS_intrinsicElements: __VLS_IntrinsicElements;
179
+ const __VLS_directiveBindingRestFields: {
180
+ instance: null;
181
+ oldValue: null;
182
+ modifiers: any;
183
+ dir: any;
184
+ };
185
+ const __VLS_unref: typeof import('vue').unref;
186
+ const __VLS_nativeElements: {
187
+ a: HTMLAnchorElement;
188
+ abbr: HTMLElement;
189
+ address: HTMLElement;
190
+ area: HTMLAreaElement;
191
+ article: HTMLElement;
192
+ aside: HTMLElement;
193
+ audio: HTMLAudioElement;
194
+ b: HTMLElement;
195
+ base: HTMLBaseElement;
196
+ bdi: HTMLElement;
197
+ bdo: HTMLElement;
198
+ blockquote: HTMLQuoteElement;
199
+ body: HTMLBodyElement;
200
+ br: HTMLBRElement;
201
+ button: HTMLButtonElement;
202
+ canvas: HTMLCanvasElement;
203
+ caption: HTMLTableCaptionElement;
204
+ cite: HTMLElement;
205
+ code: HTMLElement;
206
+ col: HTMLTableColElement;
207
+ colgroup: HTMLTableColElement;
208
+ data: HTMLDataElement;
209
+ datalist: HTMLDataListElement;
210
+ dd: HTMLElement;
211
+ del: HTMLModElement;
212
+ details: HTMLDetailsElement;
213
+ dfn: HTMLElement;
214
+ dialog: HTMLDialogElement;
215
+ div: HTMLDivElement;
216
+ dl: HTMLDListElement;
217
+ dt: HTMLElement;
218
+ em: HTMLElement;
219
+ embed: HTMLEmbedElement;
220
+ fieldset: HTMLFieldSetElement;
221
+ figcaption: HTMLElement;
222
+ figure: HTMLElement;
223
+ footer: HTMLElement;
224
+ form: HTMLFormElement;
225
+ h1: HTMLHeadingElement;
226
+ h2: HTMLHeadingElement;
227
+ h3: HTMLHeadingElement;
228
+ h4: HTMLHeadingElement;
229
+ h5: HTMLHeadingElement;
230
+ h6: HTMLHeadingElement;
231
+ head: HTMLHeadElement;
232
+ header: HTMLElement;
233
+ hgroup: HTMLElement;
234
+ hr: HTMLHRElement;
235
+ html: HTMLHtmlElement;
236
+ i: HTMLElement;
237
+ iframe: HTMLIFrameElement;
238
+ img: HTMLImageElement;
239
+ input: HTMLInputElement;
240
+ ins: HTMLModElement;
241
+ kbd: HTMLElement;
242
+ label: HTMLLabelElement;
243
+ legend: HTMLLegendElement;
244
+ li: HTMLLIElement;
245
+ link: HTMLLinkElement;
246
+ main: HTMLElement;
247
+ map: HTMLMapElement;
248
+ mark: HTMLElement;
249
+ menu: HTMLMenuElement;
250
+ meta: HTMLMetaElement;
251
+ meter: HTMLMeterElement;
252
+ nav: HTMLElement;
253
+ noscript: HTMLElement;
254
+ object: HTMLObjectElement;
255
+ ol: HTMLOListElement;
256
+ optgroup: HTMLOptGroupElement;
257
+ option: HTMLOptionElement;
258
+ output: HTMLOutputElement;
259
+ p: HTMLParagraphElement;
260
+ picture: HTMLPictureElement;
261
+ pre: HTMLPreElement;
262
+ progress: HTMLProgressElement;
263
+ q: HTMLQuoteElement;
264
+ rp: HTMLElement;
265
+ rt: HTMLElement;
266
+ ruby: HTMLElement;
267
+ s: HTMLElement;
268
+ samp: HTMLElement;
269
+ script: HTMLScriptElement;
270
+ search: HTMLElement;
271
+ section: HTMLElement;
272
+ select: HTMLSelectElement;
273
+ slot: HTMLSlotElement;
274
+ small: HTMLElement;
275
+ source: HTMLSourceElement;
276
+ span: HTMLSpanElement;
277
+ strong: HTMLElement;
278
+ style: HTMLStyleElement;
279
+ sub: HTMLElement;
280
+ summary: HTMLElement;
281
+ sup: HTMLElement;
282
+ table: HTMLTableElement;
283
+ tbody: HTMLTableSectionElement;
284
+ td: HTMLTableCellElement;
285
+ template: HTMLTemplateElement;
286
+ textarea: HTMLTextAreaElement;
287
+ tfoot: HTMLTableSectionElement;
288
+ th: HTMLTableCellElement;
289
+ thead: HTMLTableSectionElement;
290
+ time: HTMLTimeElement;
291
+ title: HTMLTitleElement;
292
+ tr: HTMLTableRowElement;
293
+ track: HTMLTrackElement;
294
+ u: HTMLElement;
295
+ ul: HTMLUListElement;
296
+ var: HTMLElement;
297
+ video: HTMLVideoElement;
298
+ wbr: HTMLElement;
299
+ animate: SVGAnimateElement;
300
+ animateMotion: SVGAnimateMotionElement;
301
+ animateTransform: SVGAnimateTransformElement;
302
+ circle: SVGCircleElement;
303
+ clipPath: SVGClipPathElement;
304
+ defs: SVGDefsElement;
305
+ desc: SVGDescElement;
306
+ ellipse: SVGEllipseElement;
307
+ feBlend: SVGFEBlendElement;
308
+ feColorMatrix: SVGFEColorMatrixElement;
309
+ feComponentTransfer: SVGFEComponentTransferElement;
310
+ feComposite: SVGFECompositeElement;
311
+ feConvolveMatrix: SVGFEConvolveMatrixElement;
312
+ feDiffuseLighting: SVGFEDiffuseLightingElement;
313
+ feDisplacementMap: SVGFEDisplacementMapElement;
314
+ feDistantLight: SVGFEDistantLightElement;
315
+ feDropShadow: SVGFEDropShadowElement;
316
+ feFlood: SVGFEFloodElement;
317
+ feFuncA: SVGFEFuncAElement;
318
+ feFuncB: SVGFEFuncBElement;
319
+ feFuncG: SVGFEFuncGElement;
320
+ feFuncR: SVGFEFuncRElement;
321
+ feGaussianBlur: SVGFEGaussianBlurElement;
322
+ feImage: SVGFEImageElement;
323
+ feMerge: SVGFEMergeElement;
324
+ feMergeNode: SVGFEMergeNodeElement;
325
+ feMorphology: SVGFEMorphologyElement;
326
+ feOffset: SVGFEOffsetElement;
327
+ fePointLight: SVGFEPointLightElement;
328
+ feSpecularLighting: SVGFESpecularLightingElement;
329
+ feSpotLight: SVGFESpotLightElement;
330
+ feTile: SVGFETileElement;
331
+ feTurbulence: SVGFETurbulenceElement;
332
+ filter: SVGFilterElement;
333
+ foreignObject: SVGForeignObjectElement;
334
+ g: SVGGElement;
335
+ image: SVGImageElement;
336
+ line: SVGLineElement;
337
+ linearGradient: SVGLinearGradientElement;
338
+ marker: SVGMarkerElement;
339
+ mask: SVGMaskElement;
340
+ metadata: SVGMetadataElement;
341
+ mpath: SVGMPathElement;
342
+ path: SVGPathElement;
343
+ pattern: SVGPatternElement;
344
+ polygon: SVGPolygonElement;
345
+ polyline: SVGPolylineElement;
346
+ radialGradient: SVGRadialGradientElement;
347
+ rect: SVGRectElement;
348
+ set: SVGSetElement;
349
+ stop: SVGStopElement;
350
+ svg: SVGSVGElement;
351
+ switch: SVGSwitchElement;
352
+ symbol: SVGSymbolElement;
353
+ text: SVGTextElement;
354
+ textPath: SVGTextPathElement;
355
+ tspan: SVGTSpanElement;
356
+ use: SVGUseElement;
357
+ view: SVGViewElement;
358
+ };
359
+ type __VLS_IntrinsicElements = import('vue/jsx-runtime').JSX.IntrinsicElements;
360
+ type __VLS_Element = import('vue/jsx-runtime').JSX.Element;
361
+ type __VLS_GlobalComponents = import('vue').GlobalComponents & Pick<typeof import('vue'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>;
362
+ type __VLS_GlobalDirectives = import('vue').GlobalDirectives;
363
+ type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
364
+ type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
365
+ type __VLS_unknownDirective = (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
366
+ type __VLS_WithComponent<N0 extends string, LocalComponents, N1 extends string, N2 extends string, N3 extends string> = N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
367
+ [K in N0]: LocalComponents[N1];
368
+ } : N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
369
+ [K in N0]: LocalComponents[N2];
370
+ } : N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : {
371
+ [K in N0]: LocalComponents[N3];
372
+ } : N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
373
+ [K in N0]: __VLS_GlobalComponents[N1];
374
+ } : N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
375
+ [K in N0]: __VLS_GlobalComponents[N2];
376
+ } : N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : {
377
+ [K in N0]: __VLS_GlobalComponents[N3];
378
+ } : {
379
+ [K in N0]: unknown;
380
+ };
381
+ type __VLS_FunctionalComponentProps<T, K> = '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
382
+ __ctx?: {
383
+ props?: infer P;
384
+ };
385
+ } ? NonNullable<P> : never : T extends (props: infer P, ...args: any) => any ? P : {};
386
+ type __VLS_IsFunction<T, K> = K extends keyof T ? __VLS_IsAny<T[K]> extends false ? unknown extends T[K] ? false : true : false : false;
387
+ type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
388
+ type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R ? U extends T ? never : __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R) : never;
389
+ type __VLS_OverloadUnion<T> = Exclude<__VLS_OverloadUnionInner<(() => never) & T>, T extends () => never ? never : () => never>;
390
+ type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F ? F extends (event: infer E, ...args: infer A) => any ? {
391
+ [K in E & string]: (...args: A) => void;
392
+ } : never : never;
393
+ type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<__VLS_UnionToIntersection<__VLS_ConstructorOverloads<T> & {
394
+ [K in keyof T]: T[K] extends any[] ? {
395
+ (...args: T[K]): void;
396
+ } : never;
397
+ }>>;
398
+ type __VLS_PrettifyGlobal<T> = {
399
+ [K in keyof T]: T[K];
400
+ } & {};
401
+ type __VLS_PickFunctionalComponentCtx<T, K> = NonNullable<__VLS_PickNotAny<'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
402
+ __ctx?: infer Ctx;
403
+ } ? Ctx : never : any, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any>>;
404
+ type __VLS_UseTemplateRef<T> = Readonly<import('vue').ShallowRef<T | null>>;
405
+ function __VLS_getVForSourceType(source: number): [number, number, number][];
406
+ function __VLS_getVForSourceType(source: string): [string, number, number][];
407
+ function __VLS_getVForSourceType<T extends any[]>(source: T): [
408
+ item: T[number],
409
+ key: number,
410
+ index: number
411
+ ][];
412
+ function __VLS_getVForSourceType<T extends {
413
+ [Symbol.iterator](): Iterator<any>;
414
+ }>(source: T): [
415
+ item: T extends {
416
+ [Symbol.iterator](): Iterator<infer T1>;
417
+ } ? T1 : never,
418
+ key: number,
419
+ index: undefined
420
+ ][];
421
+ function __VLS_getVForSourceType<T extends number | {
422
+ [Symbol.iterator](): Iterator<any>;
423
+ }>(source: T): [
424
+ item: number | (Exclude<T, number> extends {
425
+ [Symbol.iterator](): Iterator<infer T1>;
426
+ } ? T1 : never),
427
+ key: number,
428
+ index: undefined
429
+ ][];
430
+ function __VLS_getVForSourceType<T>(source: T): [
431
+ item: T[keyof T],
432
+ key: keyof T,
433
+ index: number
434
+ ][];
435
+ function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
436
+ function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
437
+ function __VLS_asFunctionalDirective<T>(dir: T): T extends import('vue').ObjectDirective ? NonNullable<T['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']> : T extends (...args: any) => any ? T : __VLS_unknownDirective;
438
+ function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
439
+ function __VLS_makeOptional<T>(t: T): {
440
+ [K in keyof T]?: T[K];
441
+ };
442
+ function __VLS_nonNullable<T>(t: T): T extends null | undefined ? never : T;
443
+ function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K): T extends new (...args: any) => any ? (props: (K extends {
444
+ $props: infer Props;
445
+ } ? Props : any) & Record<string, unknown>, ctx?: any) => __VLS_Element & {
446
+ __ctx?: {
447
+ attrs?: any;
448
+ slots?: K extends {
449
+ $slots: infer Slots;
450
+ } ? Slots : any;
451
+ emit?: K extends {
452
+ $emit: infer Emit;
453
+ } ? Emit : any;
454
+ } & {
455
+ props?: (K extends {
456
+ $props: infer Props;
457
+ } ? Props : any) & Record<string, unknown>;
458
+ expose?(exposed: K): void;
459
+ };
460
+ } : T extends () => any ? (props: {}, ctx?: any) => ReturnType<T> : T extends (...args: any) => any ? T : (_: {} & Record<string, unknown>, ctx?: any) => {
461
+ __ctx?: {
462
+ attrs?: any;
463
+ expose?: any;
464
+ slots?: any;
465
+ emit?: any;
466
+ props?: {} & Record<string, unknown>;
467
+ };
468
+ };
469
+ function __VLS_elementAsFunction<T>(tag: T, endTag?: T): (_: T & Record<string, unknown>) => void;
470
+ function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): 2 extends Parameters<T>['length'] ? [any] : [];
471
+ function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
472
+ function __VLS_tryAsConstant<const T>(t: T): T;
473
+ }
@@ -1,48 +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
- () => props.initOptions || unref(defaultInitOptions) || {},
20
- )
21
- function onError(e: unknown) {
22
- // https://github.com/nuxt/nuxt/issues/27491
23
- if (
24
- e instanceof TypeError &&
25
- e.message === "Cannot read properties of undefined (reading 'link')"
26
- ) {
27
- root.value?.refresh()
28
- }
29
- emits('error', e)
30
- }
31
- const root = ref<InstanceType<typeof VChartIsland> | null>(null)
32
- </script>
33
-
34
- <template>
35
- <div class="vue-echarts-server">
36
- <VChartIsland
37
- ref="root"
38
- :theme="realTheme"
39
- :option="option"
40
- :init-options="realInitOptions"
41
- @error="onError"
42
- >
43
- <template #fallback>
44
- <slot name="fallback" />
45
- </template>
46
- </VChartIsland>
47
- </div>
48
- </template>
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
+ () => props.initOptions || unref(defaultInitOptions) || {},
20
+ )
21
+ function onError(e: unknown) {
22
+ // https://github.com/nuxt/nuxt/issues/27491
23
+ if (
24
+ e instanceof TypeError &&
25
+ e.message === "Cannot read properties of undefined (reading 'link')"
26
+ ) {
27
+ root.value?.refresh()
28
+ }
29
+ emits('error', e)
30
+ }
31
+ const root = ref<InstanceType<typeof VChartIsland> | null>(null)
32
+ </script>
33
+
34
+ <template>
35
+ <div class="vue-echarts-server">
36
+ <VChartIsland
37
+ ref="root"
38
+ :theme="realTheme"
39
+ :option="option"
40
+ :init-options="realInitOptions"
41
+ @error="onError"
42
+ >
43
+ <template #fallback>
44
+ <slot name="fallback" />
45
+ </template>
46
+ </VChartIsland>
47
+ </div>
48
+ </template>
@@ -3,4 +3,4 @@ import type { ThemeInjection, InitOptionsInjection, UpdateOptionsInjection } fro
3
3
  export declare const THEME_KEY: InjectionKey<ThemeInjection>;
4
4
  export declare const INIT_OPTIONS_KEY: InjectionKey<InitOptionsInjection>;
5
5
  export declare const UPDATE_OPTIONS_KEY: InjectionKey<UpdateOptionsInjection>;
6
- export { LOADING_OPTIONS_KEY } from '../composables.js';
6
+ export { LOADING_OPTIONS_KEY } from '../composables/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-echarts",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Nuxt Module for Apache ECharts™",
5
5
  "keywords": [
6
6
  "vue",
@@ -14,13 +14,14 @@
14
14
  "repository": "kingyue737/nuxt-echarts",
15
15
  "license": "MIT",
16
16
  "type": "module",
17
- "packageManager": "pnpm@9.6.0",
17
+ "packageManager": "pnpm@9.11.0",
18
18
  "exports": {
19
19
  ".": {
20
20
  "types": "./dist/types.d.ts",
21
21
  "import": "./dist/module.mjs",
22
22
  "require": "./dist/module.cjs"
23
- }
23
+ },
24
+ "./runtime/types": "./dist/runtime/types.js"
24
25
  },
25
26
  "main": "./dist/module.cjs",
26
27
  "types": "./dist/types.d.ts",
@@ -44,40 +45,30 @@
44
45
  "test:types": "vue-tsc --noEmit && nuxi typecheck playground"
45
46
  },
46
47
  "dependencies": {
47
- "@nuxt/kit": "^3.12.4",
48
+ "@nuxt/kit": "^3.14.159",
48
49
  "echarts": "^5.5.1"
49
50
  },
50
51
  "devDependencies": {
51
- "@nuxt/devtools": "^1.3.9",
52
- "@nuxt/eslint-config": "^0.5.0",
53
- "@nuxt/module-builder": "^0.8.1",
54
- "@nuxt/schema": "^3.12.4",
55
- "@nuxt/test-utils": "^3.14.0",
56
- "@types/node": "^20.14.14",
57
- "changelogen": "^0.5.5",
58
- "eslint": "^9.8.0",
59
- "nuxt": "^3.12.4",
52
+ "@nuxt/devtools": "^1.6.0",
53
+ "@nuxt/eslint-config": "^0.6.1",
54
+ "@nuxt/module-builder": "^0.8.4",
55
+ "@nuxt/schema": "^3.14.159",
56
+ "@nuxt/test-utils": "^3.14.4",
57
+ "@types/node": "^22.9.0",
58
+ "changelogen": "^0.5.7",
59
+ "eslint": "^9.14.0",
60
+ "nuxt": "^3.14.159",
60
61
  "prettier": "^3.3.3",
61
- "prettier-plugin-tailwindcss": "^0.6.5",
62
- "typescript": "^5.5.4",
63
- "vite": "^5.3.5",
64
- "vitest": "^2.0.5",
65
- "vue-tsc": "^2.0.29"
62
+ "prettier-plugin-tailwindcss": "^0.6.8",
63
+ "typescript": "^5.6.3",
64
+ "vite": "^5.4.10",
65
+ "vitest": "^2.1.4",
66
+ "vue-tsc": "^2.1.10"
66
67
  },
67
68
  "peerDependencies": {
68
69
  "echarts": "^5.5.1"
69
70
  },
70
- "pnpm": {
71
- "peerDependencyRules": {
72
- "allowedVersions": {
73
- "@typescript-eslint/utils>eslint": "^9.0.0"
74
- },
75
- "ignoreMissing": [
76
- "webpack"
77
- ]
78
- }
79
- },
80
71
  "stackblitz": {
81
72
  "startCommand": "pnpm run dev:prepare && pnpm run dev"
82
73
  }
83
- }
74
+ }