nuxt-echarts 0.2.2 → 0.2.3

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/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.3",
8
8
  "builder": {
9
- "@nuxt/module-builder": "0.8.1",
9
+ "@nuxt/module-builder": "0.8.3",
10
10
  "unbuild": "2.0.0"
11
11
  }
12
12
  }
@@ -167,7 +167,7 @@ declare const _default: import("vue").DefineComponent<{
167
167
  realAttrs: import("vue").ComputedRef<{
168
168
  [x: string]: any;
169
169
  }>;
170
- nativeListeners: import("vue").Ref<Record<string, unknown>, Record<string, unknown>>;
170
+ nativeListeners: import("vue").ShallowRef<Record<string, unknown>>;
171
171
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
172
172
  click: (params: import("echarts/core").ECElementEvent) => void;
173
173
  dblclick: (params: import("echarts/core").ECElementEvent) => void;
@@ -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
  }
@@ -93,90 +93,6 @@ declare const _default: import("vue").DefineComponent<{
93
93
  $slots: {
94
94
  fallback?(_: {}): any;
95
95
  };
96
- }) | null, ({
97
- $: import("vue").ComponentInternalInstance;
98
- $data: {};
99
- $props: Partial<{}> & Omit<{
100
- readonly option?: Option | undefined;
101
- readonly initOptions?: InitOptions | undefined;
102
- 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>;
117
- $attrs: {
118
- [x: string]: unknown;
119
- };
120
- $refs: {
121
- [x: string]: unknown;
122
- };
123
- $slots: Readonly<{
124
- [name: string]: import("vue").Slot<any> | undefined;
125
- }>;
126
- $root: import("vue").ComponentPublicInstance | null;
127
- $parent: import("vue").ComponentPublicInstance | null;
128
- $emit: (event: "error", error: unknown) => void;
129
- $el: any;
130
- $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
131
- option: {
132
- type: PropType<import("echarts/core").EChartsCoreOption>;
133
- };
134
- theme: {
135
- type: PropType<Theme>;
136
- };
137
- initOptions: {
138
- type: PropType<import("echarts/core").EChartsInitOpts>;
139
- };
140
- }>> & {
141
- onError?: ((error: unknown) => any) | undefined;
142
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
143
- error: (error: unknown) => void;
144
- }, string, {}, {}, string, {}> & {
145
- beforeCreate?: (() => void) | (() => void)[];
146
- created?: (() => void) | (() => void)[];
147
- beforeMount?: (() => void) | (() => void)[];
148
- mounted?: (() => void) | (() => void)[];
149
- beforeUpdate?: (() => void) | (() => void)[];
150
- updated?: (() => void) | (() => void)[];
151
- activated?: (() => void) | (() => void)[];
152
- deactivated?: (() => void) | (() => void)[];
153
- beforeDestroy?: (() => void) | (() => void)[];
154
- beforeUnmount?: (() => void) | (() => void)[];
155
- destroyed?: (() => void) | (() => void)[];
156
- unmounted?: (() => void) | (() => void)[];
157
- renderTracked?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
158
- renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[];
159
- errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void)[];
160
- };
161
- $forceUpdate: () => void;
162
- $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<{
165
- option: {
166
- type: PropType<import("echarts/core").EChartsCoreOption>;
167
- };
168
- theme: {
169
- type: PropType<Theme>;
170
- };
171
- initOptions: {
172
- type: PropType<import("echarts/core").EChartsInitOpts>;
173
- };
174
- }>> & {
175
- onError?: ((error: unknown) => any) | undefined;
176
- }, never> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties & {} & {
177
- $slots: {
178
- fallback?(_: {}): any;
179
- };
180
96
  }) | null>;
181
97
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<ECSSREvent, ECSSRHandler>, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
182
98
  option: PropType<Option>;
@@ -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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-echarts",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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.9.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.13.0",
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",
52
+ "@nuxt/devtools": "^1.4.1",
53
+ "@nuxt/eslint-config": "^0.5.3",
54
+ "@nuxt/module-builder": "^0.8.3",
55
+ "@nuxt/schema": "^3.13.0",
56
+ "@nuxt/test-utils": "^3.14.1",
57
+ "@types/node": "^20.16.1",
57
58
  "changelogen": "^0.5.5",
58
- "eslint": "^9.8.0",
59
- "nuxt": "^3.12.4",
59
+ "eslint": "^9.9.1",
60
+ "nuxt": "^3.13.0",
60
61
  "prettier": "^3.3.3",
61
- "prettier-plugin-tailwindcss": "^0.6.5",
62
+ "prettier-plugin-tailwindcss": "^0.6.6",
62
63
  "typescript": "^5.5.4",
63
- "vite": "^5.3.5",
64
+ "vite": "^5.4.2",
64
65
  "vitest": "^2.0.5",
65
66
  "vue-tsc": "^2.0.29"
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
+ }