nuxt-echarts 0.3.0 → 0.3.2

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.json CHANGED
@@ -4,9 +4,9 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.2.0"
6
6
  },
7
- "version": "0.3.0",
7
+ "version": "0.3.2",
8
8
  "builder": {
9
- "@nuxt/module-builder": "1.0.0",
9
+ "@nuxt/module-builder": "1.0.1",
10
10
  "unbuild": "3.5.0"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -23,7 +23,10 @@ const module = defineNuxtModule({
23
23
  if (!nuxt.options.vite.optimizeDeps.exclude.includes("echarts")) {
24
24
  nuxt.options.vite.optimizeDeps.exclude.push("echarts");
25
25
  }
26
- addPlugin(resolve("./runtime/plugin"));
26
+ addPlugin({
27
+ src: resolve("./runtime/server-plugin"),
28
+ mode: "server"
29
+ });
27
30
  addComponentsDir({
28
31
  path: resolve("./runtime/components"),
29
32
  ignore: ["VChart.*"]
@@ -18,11 +18,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
18
18
  group: StringConstructor;
19
19
  manualUpdate: BooleanConstructor;
20
20
  }>, {
21
+ resize: (opts?: import("echarts/core").ResizeOpts) => void;
21
22
  getWidth: () => number;
22
23
  getHeight: () => number;
23
24
  getDom: () => HTMLElement;
24
25
  getOption: () => import("echarts/core").EChartsCoreOption;
25
- resize: (opts?: import("echarts/core").ResizeOpts) => void;
26
26
  dispatchAction: (payload: import("echarts/core").Payload, opt?: boolean | {
27
27
  silent?: boolean;
28
28
  flush?: boolean | undefined;
@@ -2,7 +2,7 @@ import {
2
2
  defineComponent,
3
3
  shallowRef,
4
4
  toRefs,
5
- unref,
5
+ toValue,
6
6
  watch,
7
7
  computed,
8
8
  inject,
@@ -55,36 +55,43 @@ export default defineComponent({
55
55
  const realOption = computed(
56
56
  () => manualOption.value || props.option || null
57
57
  );
58
- const realTheme = computed(() => props.theme || unref(defaultTheme) || {});
58
+ const realTheme = computed(() => props.theme || toValue(defaultTheme) || {});
59
59
  const realInitOptions = computed(
60
- () => props.initOptions || unref(defaultInitOptions) || {}
60
+ () => props.initOptions || toValue(defaultInitOptions) || {}
61
61
  );
62
62
  const realUpdateOptions = computed(
63
- () => props.updateOptions || unref(defaultUpdateOptions) || {}
63
+ () => props.updateOptions || toValue(defaultUpdateOptions) || {}
64
64
  );
65
65
  const nativeListeners = shallowRef({});
66
66
  const realAttrs = computed(() => ({
67
67
  ...omitOn(attrs),
68
68
  ...nativeListeners.value
69
69
  }));
70
- const realListeners = {};
71
- function init(option) {
70
+ const listeners = /* @__PURE__ */ new Map();
71
+ function collectListeners() {
72
72
  const _nativeListeners = {};
73
73
  Object.keys(attrs).filter((key) => isOn(key)).forEach((key) => {
74
- let event = key.charAt(2).toLowerCase() + key.slice(3);
75
- if (event.indexOf("native:") === 0) {
76
- const nativeKey = `on${event.charAt(7).toUpperCase()}${event.slice(
77
- 8
78
- )}`;
74
+ if (key.indexOf("Native:") === 2) {
75
+ const nativeKey = `on${key.charAt(9).toUpperCase()}${key.slice(10)}`;
79
76
  _nativeListeners[nativeKey] = attrs[key];
80
77
  return;
81
78
  }
79
+ let event = key.charAt(2).toLowerCase() + key.slice(3);
80
+ let zr;
81
+ if (event.indexOf("zr:") === 0) {
82
+ zr = true;
83
+ event = event.substring(3);
84
+ }
85
+ let once;
82
86
  if (event.substring(event.length - 4) === "Once") {
83
- event = `~${event.substring(0, event.length - 4)}`;
87
+ once = true;
88
+ event = event.substring(0, event.length - 4);
84
89
  }
85
- realListeners[event] = attrs[key];
90
+ listeners.set({ event, zr, once }, attrs[key]);
86
91
  });
87
92
  nativeListeners.value = _nativeListeners;
93
+ }
94
+ function init(option) {
88
95
  if (!root.value) {
89
96
  return;
90
97
  }
@@ -96,23 +103,12 @@ export default defineComponent({
96
103
  if (props.group) {
97
104
  instance.group = props.group;
98
105
  }
99
- Object.keys(realListeners).forEach((key) => {
100
- let handler = realListeners[key];
106
+ listeners.forEach((handler, { zr, once, event }) => {
101
107
  if (!handler) {
102
108
  return;
103
109
  }
104
- let event = key.toLowerCase();
105
- if (event.charAt(0) === "~") {
106
- event = event.substring(1);
107
- handler.__once__ = true;
108
- }
109
- let target = instance;
110
- if (event.indexOf("zr:") === 0) {
111
- target = instance.getZr();
112
- event = event.substring(3);
113
- }
114
- if (handler.__once__) {
115
- delete handler.__once__;
110
+ const target = zr ? instance.getZr() : instance;
111
+ if (once) {
116
112
  const raw = handler;
117
113
  handler = (...args) => {
118
114
  raw(...args);
@@ -210,6 +206,7 @@ export default defineComponent({
210
206
  useLoading(chart, loading, loadingOptions);
211
207
  useAutoresize(chart, autoresize, root);
212
208
  onMounted(async () => {
209
+ collectListeners();
213
210
  if (!root.value) await nextTick();
214
211
  init();
215
212
  });
@@ -230,9 +227,10 @@ export default defineComponent({
230
227
  };
231
228
  },
232
229
  render() {
233
- const attrs = this.realAttrs;
234
- attrs.ref = "root";
235
- attrs.class = attrs.class ? ["echarts"].concat(attrs.class) : "echarts";
236
- return h(TAG_NAME, attrs);
230
+ return h(TAG_NAME, {
231
+ ...this.realAttrs,
232
+ ref: "root",
233
+ class: ["echarts", ...this.realAttrs.class || []]
234
+ });
237
235
  }
238
236
  });
@@ -1,20 +1,10 @@
1
1
  <script setup>
2
2
  import * as echarts from "echarts";
3
- import "#build/echarts.mjs";
4
3
  import { ref } from "vue";
5
4
  const props = defineProps({
6
- option: {
7
- type: null,
8
- required: false
9
- },
10
- initOptions: {
11
- type: null,
12
- required: false
13
- },
14
- theme: {
15
- type: null,
16
- required: false
17
- }
5
+ option: { type: null, required: false },
6
+ initOptions: { type: null, required: false },
7
+ theme: { type: null, required: false }
18
8
  });
19
9
  const svgStr = ref("");
20
10
  const initOptions = echarts.util.merge(
@@ -29,8 +19,8 @@ defineSlots();
29
19
  </script>
30
20
 
31
21
  <template>
32
- <div class="vue-echarts-container">
33
- <!--eslint-disable-next-line vue/no-v-html-->
34
- <div class="vue-echarts-inner" v-html="svgStr" />
35
- </div>
22
+ <div class="vue-echarts-container">
23
+ <!--eslint-disable-next-line vue/no-v-html-->
24
+ <div class="vue-echarts-inner" v-html="svgStr" />
25
+ </div>
36
26
  </template>
@@ -1,4 +1,3 @@
1
- import '#build/echarts.mjs';
2
1
  import type { Option, InitOptions, Theme } from '../types.js';
3
2
  type __VLS_Props = {
4
3
  option?: Option;
@@ -54,10 +54,10 @@ export default defineComponent({
54
54
  </script>
55
55
 
56
56
  <template>
57
- <VChartServer
58
- ref="root"
59
- :option="option"
60
- :init-options="initOptions"
61
- :theme="theme"
62
- />
57
+ <VChartServer
58
+ ref="root"
59
+ :option="option"
60
+ :init-options="initOptions"
61
+ :theme="theme"
62
+ />
63
63
  </template>
@@ -68,7 +68,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
68
68
  onError?: ((error: unknown) => any) | undefined;
69
69
  }>, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
70
70
  $slots: {
71
- fallback?: ((props: {}) => any) | undefined;
71
+ fallback?: (props: {}) => any;
72
72
  };
73
73
  }) | null, ({
74
74
  $: import("vue").ComponentInternalInstance;
@@ -129,7 +129,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
129
129
  onError?: ((error: unknown) => any) | undefined;
130
130
  }>, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
131
131
  $slots: {
132
- fallback?: ((props: {}) => any) | undefined;
132
+ fallback?: (props: {}) => any;
133
133
  };
134
134
  }) | null>;
135
135
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<ECSSREvent, ECSSRHandler>, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -1,26 +1,17 @@
1
1
  <script setup>
2
- import { computed, unref, inject, ref } from "vue";
2
+ import { computed, inject, ref, toValue } from "vue";
3
3
  import { THEME_KEY, INIT_OPTIONS_KEY } from "../utils/injection";
4
4
  const defaultTheme = inject(THEME_KEY, null);
5
5
  const defaultInitOptions = inject(INIT_OPTIONS_KEY, null);
6
6
  const props = defineProps({
7
- option: {
8
- type: null,
9
- required: false
10
- },
11
- theme: {
12
- type: null,
13
- required: false
14
- },
15
- initOptions: {
16
- type: null,
17
- required: false
18
- }
7
+ option: { type: null, required: false },
8
+ theme: { type: null, required: false },
9
+ initOptions: { type: null, required: false }
19
10
  });
20
11
  const emits = defineEmits(["error"]);
21
- const realTheme = computed(() => props.theme || unref(defaultTheme) || {});
12
+ const realTheme = computed(() => props.theme || toValue(defaultTheme) || {});
22
13
  const realInitOptions = computed(
23
- () => props.initOptions || unref(defaultInitOptions) || {}
14
+ () => props.initOptions || toValue(defaultInitOptions) || {}
24
15
  );
25
16
  function onError(e) {
26
17
  if (e instanceof TypeError && e.message === "Cannot read properties of undefined (reading 'link')") {
@@ -32,17 +23,17 @@ const root = ref(null);
32
23
  </script>
33
24
 
34
25
  <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>
26
+ <div class="vue-echarts-server">
27
+ <VChartIsland
28
+ ref="root"
29
+ :theme="realTheme"
30
+ :option="option"
31
+ :init-options="realInitOptions"
32
+ @error="onError"
33
+ >
34
+ <template #fallback>
35
+ <slot name="fallback" />
36
+ </template>
37
+ </VChartIsland>
38
+ </div>
48
39
  </template>
@@ -4,229 +4,10 @@ type __VLS_Props = {
4
4
  theme?: Theme;
5
5
  initOptions?: InitOptions;
6
6
  };
7
- declare const realTheme: import("vue").ComputedRef<Theme>;
8
- declare const realInitOptions: import("vue").ComputedRef<import("echarts/core").EChartsInitOpts>;
9
- declare function onError(e: unknown): void;
10
- declare const root: import("vue").Ref<({
11
- $: import("vue").ComponentInternalInstance;
12
- $data: {};
13
- $props: {
14
- readonly option?: Option | undefined;
15
- readonly initOptions?: InitOptions | undefined;
16
- readonly theme?: Theme | undefined;
17
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
18
- $attrs: {
19
- [x: string]: unknown;
20
- };
21
- $refs: {
22
- [x: string]: unknown;
23
- };
24
- $slots: Readonly<{
25
- [name: string]: import("vue").Slot<any> | undefined;
26
- }>;
27
- $root: import("vue").ComponentPublicInstance | null;
28
- $parent: import("vue").ComponentPublicInstance | null;
29
- $host: Element | null;
30
- $emit: (event: string, ...args: any[]) => void;
31
- $el: any;
32
- $options: import("vue").ComponentOptionsBase<Readonly<{
33
- option?: Option;
34
- initOptions?: InitOptions;
35
- theme?: Theme;
36
- }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
37
- beforeCreate?: (() => void) | (() => void)[];
38
- created?: (() => void) | (() => void)[];
39
- beforeMount?: (() => void) | (() => void)[];
40
- mounted?: (() => void) | (() => void)[];
41
- beforeUpdate?: (() => void) | (() => void)[];
42
- updated?: (() => void) | (() => void)[];
43
- activated?: (() => void) | (() => void)[];
44
- deactivated?: (() => void) | (() => void)[];
45
- beforeDestroy?: (() => void) | (() => void)[];
46
- beforeUnmount?: (() => void) | (() => void)[];
47
- destroyed?: (() => void) | (() => void)[];
48
- unmounted?: (() => void) | (() => void)[];
49
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
50
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
51
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
52
- };
53
- $forceUpdate: () => void;
54
- $nextTick: typeof import("vue").nextTick;
55
- $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;
56
- } & Readonly<{}> & Omit<Readonly<{
57
- option?: Option;
58
- initOptions?: InitOptions;
59
- theme?: Theme;
60
- }> & Readonly<{}>, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
61
- $slots: {
62
- fallback: any;
63
- };
64
- } & {
65
- $: import("vue").ComponentInternalInstance;
66
- $data: {};
67
- $props: Partial<{}> & Omit<{}, never>;
68
- $attrs: {
69
- [x: string]: unknown;
70
- };
71
- $refs: {
72
- [x: string]: unknown;
73
- };
74
- $slots: Readonly<{
75
- fallback: import("vue").Slot<{
76
- error: unknown;
77
- }>;
78
- }>;
79
- $root: import("vue").ComponentPublicInstance | null;
80
- $parent: import("vue").ComponentPublicInstance | null;
81
- $host: Element | null;
82
- $emit: (event: string, ...args: any[]) => void;
83
- $el: any;
84
- $options: import("vue").ComponentOptionsBase<{}, {
85
- refresh: () => Promise<void>;
86
- }, {}, {}, {}, {}, {}, {}, string, {}, {}, string, import("vue").SlotsType<{
87
- fallback: {
88
- error: unknown;
89
- };
90
- }>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
91
- beforeCreate?: (() => void) | (() => void)[];
92
- created?: (() => void) | (() => void)[];
93
- beforeMount?: (() => void) | (() => void)[];
94
- mounted?: (() => void) | (() => void)[];
95
- beforeUpdate?: (() => void) | (() => void)[];
96
- updated?: (() => void) | (() => void)[];
97
- activated?: (() => void) | (() => void)[];
98
- deactivated?: (() => void) | (() => void)[];
99
- beforeDestroy?: (() => void) | (() => void)[];
100
- beforeUnmount?: (() => void) | (() => void)[];
101
- destroyed?: (() => void) | (() => void)[];
102
- unmounted?: (() => void) | (() => void)[];
103
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
104
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
105
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
106
- };
107
- $forceUpdate: () => void;
108
- $nextTick: typeof import("vue").nextTick;
109
- $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;
110
- } & Readonly<{}> & Omit<{}, "refresh"> & import("vue").ShallowUnwrapRef<{
111
- refresh: () => Promise<void>;
112
- }>) | null, ({
113
- $: import("vue").ComponentInternalInstance;
114
- $data: {};
115
- $props: {
116
- readonly option?: Option | undefined;
117
- readonly initOptions?: InitOptions | undefined;
118
- readonly theme?: Theme | undefined;
119
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
120
- $attrs: {
121
- [x: string]: unknown;
122
- };
123
- $refs: {
124
- [x: string]: unknown;
125
- };
126
- $slots: Readonly<{
127
- [name: string]: import("vue").Slot<any> | undefined;
128
- }>;
129
- $root: import("vue").ComponentPublicInstance | null;
130
- $parent: import("vue").ComponentPublicInstance | null;
131
- $host: Element | null;
132
- $emit: (event: string, ...args: any[]) => void;
133
- $el: any;
134
- $options: import("vue").ComponentOptionsBase<Readonly<{
135
- option?: Option;
136
- initOptions?: InitOptions;
137
- theme?: Theme;
138
- }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
139
- beforeCreate?: (() => void) | (() => void)[];
140
- created?: (() => void) | (() => void)[];
141
- beforeMount?: (() => void) | (() => void)[];
142
- mounted?: (() => void) | (() => void)[];
143
- beforeUpdate?: (() => void) | (() => void)[];
144
- updated?: (() => void) | (() => void)[];
145
- activated?: (() => void) | (() => void)[];
146
- deactivated?: (() => void) | (() => void)[];
147
- beforeDestroy?: (() => void) | (() => void)[];
148
- beforeUnmount?: (() => void) | (() => void)[];
149
- destroyed?: (() => void) | (() => void)[];
150
- unmounted?: (() => void) | (() => void)[];
151
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
152
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
153
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
154
- };
155
- $forceUpdate: () => void;
156
- $nextTick: typeof import("vue").nextTick;
157
- $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;
158
- } & Readonly<{}> & Omit<Readonly<{
159
- option?: Option;
160
- initOptions?: InitOptions;
161
- theme?: Theme;
162
- }> & Readonly<{}>, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
163
- $slots: {
164
- fallback: any;
165
- };
166
- } & {
167
- $: import("vue").ComponentInternalInstance;
168
- $data: {};
169
- $props: Partial<{}> & Omit<{}, never>;
170
- $attrs: {
171
- [x: string]: unknown;
172
- };
173
- $refs: {
174
- [x: string]: unknown;
175
- };
176
- $slots: Readonly<{
177
- fallback: import("vue").Slot<{
178
- error: unknown;
179
- }>;
180
- }>;
181
- $root: import("vue").ComponentPublicInstance | null;
182
- $parent: import("vue").ComponentPublicInstance | null;
183
- $host: Element | null;
184
- $emit: (event: string, ...args: any[]) => void;
185
- $el: any;
186
- $options: import("vue").ComponentOptionsBase<{}, {
187
- refresh: () => Promise<void>;
188
- }, {}, {}, {}, {}, {}, {}, string, {}, {}, string, import("vue").SlotsType<{
189
- fallback: {
190
- error: unknown;
191
- };
192
- }>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & {
193
- beforeCreate?: (() => void) | (() => void)[];
194
- created?: (() => void) | (() => void)[];
195
- beforeMount?: (() => void) | (() => void)[];
196
- mounted?: (() => void) | (() => void)[];
197
- beforeUpdate?: (() => void) | (() => void)[];
198
- updated?: (() => void) | (() => void)[];
199
- activated?: (() => void) | (() => void)[];
200
- deactivated?: (() => void) | (() => void)[];
201
- beforeDestroy?: (() => void) | (() => void)[];
202
- beforeUnmount?: (() => void) | (() => void)[];
203
- destroyed?: (() => void) | (() => void)[];
204
- unmounted?: (() => void) | (() => void)[];
205
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
206
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
207
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
208
- };
209
- $forceUpdate: () => void;
210
- $nextTick: typeof import("vue").nextTick;
211
- $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;
212
- } & Readonly<{}> & Omit<{}, "refresh"> & import("vue").ShallowUnwrapRef<{
213
- refresh: () => Promise<void>;
214
- }>) | null>;
215
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
216
7
  declare var __VLS_11: {};
217
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
8
+ type __VLS_Slots = {} & {
218
9
  fallback?: (props: typeof __VLS_11) => any;
219
- }>;
220
- declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
221
- realTheme: typeof realTheme;
222
- realInitOptions: typeof realInitOptions;
223
- onError: typeof onError;
224
- root: typeof root;
225
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
226
- error: (error: unknown) => any;
227
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
228
- onError?: ((error: unknown) => any) | undefined;
229
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ };
230
11
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
231
12
  error: (error: unknown) => any;
232
13
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
@@ -25,6 +25,9 @@ export function useAutoresize(chart, autoresize, root) {
25
25
  return;
26
26
  }
27
27
  }
28
+ if (root2.offsetWidth === 0 || root2.offsetHeight === 0) {
29
+ return;
30
+ }
28
31
  resizeCallback(entry, observer);
29
32
  });
30
33
  ro.observe(root2);
@@ -1,5 +1,5 @@
1
1
  import {
2
- unref,
2
+ toValue,
3
3
  inject,
4
4
  computed,
5
5
  watchEffect
@@ -8,7 +8,7 @@ export const LOADING_OPTIONS_KEY = "ecLoadingOptions";
8
8
  export function useLoading(chart, loading, loadingOptions) {
9
9
  const defaultLoadingOptions = inject(LOADING_OPTIONS_KEY, {});
10
10
  const realLoadingOptions = computed(() => ({
11
- ...unref(defaultLoadingOptions) || {},
11
+ ...toValue(defaultLoadingOptions) || {},
12
12
  ...loadingOptions?.value
13
13
  }));
14
14
  watchEffect(() => {
@@ -0,0 +1,2 @@
1
+ declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { defineNuxtPlugin } from "#app";
2
+ export default defineNuxtPlugin(async (_nuxtApp) => {
3
+ await import("#build/echarts.mjs");
4
+ });
@@ -1,6 +1,6 @@
1
1
  import type { init, SetOptionOpts, ECElementEvent, ElementEvent } from 'echarts/core';
2
- import type { MaybeRef } from 'vue';
3
- export type Injection<T> = MaybeRef<T | null>;
2
+ import type { MaybeRefOrGetter } from 'vue';
3
+ export type Injection<T> = MaybeRefOrGetter<T | null>;
4
4
  type InitType = typeof init;
5
5
  export type InitParameters = Parameters<InitType>;
6
6
  export type Theme = NonNullable<InitParameters[1]>;
@@ -10,8 +10,6 @@ export type InitOptionsInjection = Injection<InitOptions>;
10
10
  export type UpdateOptions = SetOptionOpts;
11
11
  export type UpdateOptionsInjection = Injection<UpdateOptions>;
12
12
  export type EChartsType = ReturnType<InitType>;
13
- type ZRenderType = ReturnType<EChartsType['getZr']>;
14
- export type EventTarget = EChartsType | ZRenderType;
15
13
  type SetOptionType = EChartsType['setOption'];
16
14
  export type Option = Parameters<SetOptionType>[0];
17
15
  export type LoadingOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-echarts",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Nuxt Module for Apache ECharts™",
5
5
  "keywords": [
6
6
  "vue",
@@ -14,7 +14,7 @@
14
14
  "repository": "kingyue737/nuxt-echarts",
15
15
  "license": "MIT",
16
16
  "type": "module",
17
- "packageManager": "pnpm@10.7.1",
17
+ "packageManager": "pnpm@10.11.0",
18
18
  "exports": {
19
19
  ".": {
20
20
  "types": "./dist/types.d.mts",
@@ -43,24 +43,25 @@
43
43
  "test:types": "vue-tsc --noEmit && nuxi typecheck playground"
44
44
  },
45
45
  "dependencies": {
46
- "@nuxt/kit": "^3.16.2",
47
- "echarts": "^5.6.0"
46
+ "@nuxt/kit": "^3.17.4"
48
47
  },
49
48
  "devDependencies": {
50
- "@nuxt/eslint-config": "^1.3.0",
51
- "@nuxt/module-builder": "^1.0.0",
52
- "@nuxt/schema": "^3.16.2",
53
- "@nuxt/test-utils": "^3.17.2",
54
- "@types/node": "^22.14.0",
49
+ "@nuxt/eslint-config": "^1.4.1",
50
+ "@nuxt/module-builder": "^1.0.1",
51
+ "@nuxt/schema": "^3.17.4",
52
+ "@nuxt/test-utils": "^3.19.1",
53
+ "@types/node": "^22.15.21",
55
54
  "changelogen": "^0.6.1",
56
- "eslint": "^9.24.0",
57
- "nuxt": "^3.16.2",
55
+ "echarts": "^5.6.0",
56
+ "echarts-gl": "^2.0.9",
57
+ "eslint": "^9.27.0",
58
+ "nuxt": "^3.17.4",
58
59
  "prettier": "^3.5.3",
59
60
  "prettier-plugin-tailwindcss": "^0.6.11",
60
61
  "typescript": "^5.8.3",
61
- "vite": "^6.2.5",
62
- "vitest": "^3.1.1",
63
- "vue-tsc": "^2.2.8"
62
+ "vite": "^6.3.5",
63
+ "vitest": "^3.1.4",
64
+ "vue-tsc": "^2.2.10"
64
65
  },
65
66
  "peerDependencies": {
66
67
  "echarts": "^5.5.1"
@@ -68,4 +69,4 @@
68
69
  "stackblitz": {
69
70
  "startCommand": "pnpm run dev:prepare && pnpm run dev"
70
71
  }
71
- }
72
+ }
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
@@ -1,3 +0,0 @@
1
- import { defineNuxtPlugin } from "#app";
2
- export default defineNuxtPlugin((_nuxtApp) => {
3
- });