nuxt-echarts 0.0.1 → 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 (33) hide show
  1. package/README.md +37 -15
  2. package/dist/module.d.mts +31 -1
  3. package/dist/module.d.ts +31 -1
  4. package/dist/module.json +5 -2
  5. package/dist/module.mjs +105 -6
  6. package/dist/runtime/components/VChart.client.d.ts +310 -0
  7. package/dist/runtime/components/VChart.client.js +240 -0
  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 +7 -0
  14. package/dist/runtime/composables/api.js +35 -0
  15. package/dist/runtime/composables/autoresize.d.ts +0 -0
  16. package/dist/runtime/composables/autoresize.js +26 -0
  17. package/dist/runtime/composables/index.d.ts +3 -0
  18. package/dist/runtime/composables/index.js +3 -0
  19. package/dist/runtime/composables/loading.d.ts +8 -0
  20. package/dist/runtime/composables/loading.js +29 -0
  21. package/dist/runtime/{plugin.mjs → plugin.js} +0 -1
  22. package/dist/runtime/style.css +1 -0
  23. package/dist/runtime/types.d.ts +52 -0
  24. package/dist/runtime/types.js +0 -0
  25. package/dist/runtime/utils/injection.d.ts +6 -0
  26. package/dist/runtime/utils/injection.js +4 -0
  27. package/dist/runtime/utils/on.d.ts +4 -0
  28. package/dist/runtime/utils/on.js +11 -0
  29. package/dist/runtime/utils/wc.d.ts +0 -0
  30. package/dist/runtime/utils/wc.js +30 -0
  31. package/dist/types.d.mts +4 -13
  32. package/dist/types.d.ts +4 -13
  33. package/package.json +25 -13
@@ -0,0 +1,240 @@
1
+ import {
2
+ defineComponent,
3
+ shallowRef,
4
+ toRefs,
5
+ unref,
6
+ watch,
7
+ computed,
8
+ inject,
9
+ onMounted,
10
+ onBeforeUnmount,
11
+ h,
12
+ nextTick,
13
+ watchEffect
14
+ } from "vue";
15
+ import { init as initChart } from "echarts/core";
16
+ import {
17
+ usePublicAPI,
18
+ useAutoresize,
19
+ autoresizeProps,
20
+ useLoading,
21
+ loadingProps
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";
31
+ const wcRegistered = register();
32
+ export default defineComponent({
33
+ name: "VChart",
34
+ props: {
35
+ option: Object,
36
+ theme: {
37
+ type: [Object, String]
38
+ },
39
+ initOptions: Object,
40
+ updateOptions: Object,
41
+ group: String,
42
+ manualUpdate: Boolean,
43
+ ...autoresizeProps,
44
+ ...loadingProps
45
+ },
46
+ emits: {},
47
+ inheritAttrs: false,
48
+ setup(props, { attrs }) {
49
+ const root = shallowRef();
50
+ const inner = shallowRef();
51
+ const chart = shallowRef();
52
+ const manualOption = shallowRef();
53
+ const defaultTheme = inject(THEME_KEY, null);
54
+ const defaultInitOptions = inject(INIT_OPTIONS_KEY, null);
55
+ const defaultUpdateOptions = inject(UPDATE_OPTIONS_KEY, null);
56
+ const { autoresize, manualUpdate, loading, loadingOptions } = toRefs(props);
57
+ const realOption = computed(
58
+ () => manualOption.value || props.option || null
59
+ );
60
+ const realTheme = computed(() => props.theme || unref(defaultTheme) || {});
61
+ const realInitOptions = computed(
62
+ // @ts-expect-error unknown computed type error
63
+ () => props.initOptions || unref(defaultInitOptions) || {}
64
+ );
65
+ const realUpdateOptions = computed(
66
+ // @ts-expect-error unknown computed type error
67
+ () => props.updateOptions || unref(defaultUpdateOptions) || {}
68
+ );
69
+ const nonEventAttrs = computed(() => omitOn(attrs));
70
+ const nativeListeners = {};
71
+ const realListeners = {};
72
+ Object.keys(attrs).filter((key) => isOn(key)).forEach((key) => {
73
+ let event = key.charAt(2).toLowerCase() + key.slice(3);
74
+ if (event.indexOf("native:") === 0) {
75
+ const nativeKey = `on${event.charAt(7).toUpperCase()}${event.slice(
76
+ 8
77
+ )}`;
78
+ nativeListeners[nativeKey] = attrs[key];
79
+ return;
80
+ }
81
+ if (event.substring(event.length - 4) === "Once") {
82
+ event = `~${event.substring(0, event.length - 4)}`;
83
+ }
84
+ realListeners[event] = attrs[key];
85
+ });
86
+ function init(option) {
87
+ if (!inner.value) {
88
+ return;
89
+ }
90
+ const instance = chart.value = initChart(
91
+ inner.value,
92
+ realTheme.value,
93
+ realInitOptions.value
94
+ );
95
+ if (props.group) {
96
+ instance.group = props.group;
97
+ }
98
+ Object.keys(realListeners).forEach((key) => {
99
+ let handler = realListeners[key];
100
+ if (!handler) {
101
+ return;
102
+ }
103
+ let event = key.toLowerCase();
104
+ if (event.charAt(0) === "~") {
105
+ event = event.substring(1);
106
+ handler.__once__ = true;
107
+ }
108
+ let target = instance;
109
+ if (event.indexOf("zr:") === 0) {
110
+ target = instance.getZr();
111
+ event = event.substring(3);
112
+ }
113
+ if (handler.__once__) {
114
+ delete handler.__once__;
115
+ const raw = handler;
116
+ handler = (...args) => {
117
+ raw(...args);
118
+ target.off(event, handler);
119
+ };
120
+ }
121
+ target.on(event, handler);
122
+ });
123
+ function resize() {
124
+ if (instance && !instance.isDisposed()) {
125
+ instance.resize();
126
+ }
127
+ }
128
+ function commit() {
129
+ const opt = option || realOption.value;
130
+ if (opt) {
131
+ instance.setOption(opt, realUpdateOptions.value);
132
+ }
133
+ }
134
+ if (autoresize.value) {
135
+ nextTick(() => {
136
+ resize();
137
+ commit();
138
+ });
139
+ } else {
140
+ commit();
141
+ }
142
+ }
143
+ function setOption(option, updateOptions) {
144
+ if (props.manualUpdate) {
145
+ manualOption.value = option;
146
+ }
147
+ if (!chart.value) {
148
+ init(option);
149
+ } else {
150
+ chart.value.setOption(option, updateOptions || {});
151
+ }
152
+ }
153
+ function cleanup() {
154
+ if (chart.value) {
155
+ chart.value.dispose();
156
+ chart.value = void 0;
157
+ }
158
+ }
159
+ let unwatchOption = null;
160
+ watch(
161
+ manualUpdate,
162
+ (manualUpdate2) => {
163
+ if (typeof unwatchOption === "function") {
164
+ unwatchOption();
165
+ unwatchOption = null;
166
+ }
167
+ if (!manualUpdate2) {
168
+ unwatchOption = watch(
169
+ () => props.option,
170
+ (option, oldOption) => {
171
+ if (!option) {
172
+ return;
173
+ }
174
+ if (!chart.value) {
175
+ init();
176
+ } else {
177
+ chart.value.setOption(option, {
178
+ // mutating `option` will lead to `notMerge: false` and
179
+ // replacing it with new reference will lead to `notMerge: true`
180
+ notMerge: option !== oldOption,
181
+ ...realUpdateOptions.value
182
+ });
183
+ }
184
+ },
185
+ { deep: true }
186
+ );
187
+ }
188
+ },
189
+ {
190
+ immediate: true
191
+ }
192
+ );
193
+ watch(
194
+ [realTheme, realInitOptions],
195
+ () => {
196
+ cleanup();
197
+ init();
198
+ },
199
+ {
200
+ deep: true
201
+ }
202
+ );
203
+ watchEffect(() => {
204
+ if (props.group && chart.value) {
205
+ chart.value.group = props.group;
206
+ }
207
+ });
208
+ const publicApi = usePublicAPI(chart);
209
+ useLoading(chart, loading, loadingOptions);
210
+ useAutoresize(chart, autoresize, inner);
211
+ onMounted(async () => {
212
+ await nextTick();
213
+ init();
214
+ });
215
+ onBeforeUnmount(() => {
216
+ if (wcRegistered && root.value) {
217
+ root.value.__dispose = cleanup;
218
+ } else {
219
+ cleanup();
220
+ }
221
+ });
222
+ return {
223
+ chart,
224
+ root,
225
+ inner,
226
+ setOption,
227
+ nonEventAttrs,
228
+ nativeListeners,
229
+ ...publicApi
230
+ };
231
+ },
232
+ render() {
233
+ const attrs = { ...this.nonEventAttrs, ...this.nativeListeners };
234
+ attrs.ref = "root";
235
+ attrs.class = attrs.class ? ["echarts"].concat(attrs.class) : "echarts";
236
+ return h(TAG_NAME, attrs, [
237
+ h("div", { ref: "inner", class: "vue-echarts-inner" })
238
+ ]);
239
+ }
240
+ });
@@ -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>
@@ -0,0 +1,7 @@
1
+ import type { Ref } from 'vue';
2
+ import type { EChartsType } from '../types.js';
3
+ declare const METHOD_NAMES: readonly ["getWidth", "getHeight", "getDom", "getOption", "resize", "dispatchAction", "convertToPixel", "convertFromPixel", "containPixel", "getDataURL", "getConnectedDataURL", "appendData", "clear", "isDisposed", "dispose"];
4
+ type MethodName = (typeof METHOD_NAMES)[number];
5
+ type PublicMethods = Pick<EChartsType, MethodName>;
6
+ export declare function usePublicAPI(chart: Ref<EChartsType | undefined>): PublicMethods;
7
+ export {};
@@ -0,0 +1,35 @@
1
+ const METHOD_NAMES = [
2
+ "getWidth",
3
+ "getHeight",
4
+ "getDom",
5
+ "getOption",
6
+ "resize",
7
+ "dispatchAction",
8
+ "convertToPixel",
9
+ "convertFromPixel",
10
+ "containPixel",
11
+ "getDataURL",
12
+ "getConnectedDataURL",
13
+ "appendData",
14
+ "clear",
15
+ "isDisposed",
16
+ "dispose"
17
+ ];
18
+ export function usePublicAPI(chart) {
19
+ function makePublicMethod(name) {
20
+ return (...args) => {
21
+ if (!chart.value) {
22
+ throw new Error("ECharts is not initialized yet.");
23
+ }
24
+ return chart.value[name].apply(chart.value, args);
25
+ };
26
+ }
27
+ function makePublicMethods() {
28
+ const methods = /* @__PURE__ */ Object.create(null);
29
+ METHOD_NAMES.forEach((name) => {
30
+ methods[name] = makePublicMethod(name);
31
+ });
32
+ return methods;
33
+ }
34
+ return makePublicMethods();
35
+ }
File without changes
@@ -0,0 +1,26 @@
1
+ import { watch } from "vue";
2
+ import { throttle } from "echarts/core";
3
+ export function useAutoresize(chart, autoresize, root) {
4
+ let observer;
5
+ watch([root, chart, autoresize], ([root2, chart2, autoresize2], _, cleanup) => {
6
+ if (root2 && chart2 && autoresize2) {
7
+ const autoresizeOptions = autoresize2 === true ? {} : autoresize2;
8
+ const { throttle: wait = 100, onResize } = autoresizeOptions;
9
+ const callback = () => {
10
+ chart2.resize();
11
+ onResize?.();
12
+ };
13
+ observer = new ResizeObserver(wait ? throttle(callback, wait) : callback);
14
+ observer.observe(root2);
15
+ }
16
+ cleanup(() => {
17
+ if (root2 && observer) {
18
+ observer.disconnect();
19
+ observer = void 0;
20
+ }
21
+ });
22
+ });
23
+ }
24
+ export const autoresizeProps = {
25
+ autoresize: [Boolean, Object]
26
+ };
@@ -0,0 +1,3 @@
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";
@@ -0,0 +1,8 @@
1
+ import { type Ref, type InjectionKey, type PropType } from 'vue';
2
+ import type { EChartsType, LoadingOptions } from '../types.js';
3
+ export declare const LOADING_OPTIONS_KEY: InjectionKey<LoadingOptions | Ref<LoadingOptions>>;
4
+ export declare function useLoading(chart: Ref<EChartsType | undefined>, loading: Ref<boolean>, loadingOptions: Ref<LoadingOptions | undefined>): void;
5
+ export declare const loadingProps: {
6
+ loading: BooleanConstructor;
7
+ loadingOptions: PropType<LoadingOptions>;
8
+ };
@@ -0,0 +1,29 @@
1
+ import {
2
+ unref,
3
+ inject,
4
+ computed,
5
+ watchEffect
6
+ } from "vue";
7
+ export const LOADING_OPTIONS_KEY = "ecLoadingOptions";
8
+ export function useLoading(chart, loading, loadingOptions) {
9
+ const defaultLoadingOptions = inject(LOADING_OPTIONS_KEY, {});
10
+ const realLoadingOptions = computed(() => ({
11
+ ...unref(defaultLoadingOptions) || {},
12
+ ...loadingOptions?.value
13
+ }));
14
+ watchEffect(() => {
15
+ const instance = chart.value;
16
+ if (!instance) {
17
+ return;
18
+ }
19
+ if (loading.value) {
20
+ instance.showLoading(realLoadingOptions.value);
21
+ } else {
22
+ instance.hideLoading();
23
+ }
24
+ });
25
+ }
26
+ export const loadingProps = {
27
+ loading: Boolean,
28
+ loadingOptions: Object
29
+ };
@@ -1,4 +1,3 @@
1
1
  import { defineNuxtPlugin } from "#app";
2
2
  export default defineNuxtPlugin((_nuxtApp) => {
3
- console.log("Plugin injected by nuxt-echarts!");
4
3
  });
@@ -0,0 +1 @@
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}
@@ -0,0 +1,52 @@
1
+ import type { init, SetOptionOpts, ECElementEvent, ElementEvent } from 'echarts/core';
2
+ import type { Ref } from 'vue';
3
+ export type Injection<T> = T | null | Ref<T | null> | {
4
+ value: T | null;
5
+ };
6
+ type InitType = typeof init;
7
+ export type InitParameters = Parameters<InitType>;
8
+ export type Theme = NonNullable<InitParameters[1]>;
9
+ export type ThemeInjection = Injection<Theme>;
10
+ export type InitOptions = NonNullable<InitParameters[2]>;
11
+ export type InitOptionsInjection = Injection<InitOptions>;
12
+ export type UpdateOptions = SetOptionOpts;
13
+ export type UpdateOptionsInjection = Injection<UpdateOptions>;
14
+ export type EChartsType = ReturnType<InitType>;
15
+ type ZRenderType = ReturnType<EChartsType['getZr']>;
16
+ export type EventTarget = EChartsType | ZRenderType;
17
+ type SetOptionType = EChartsType['setOption'];
18
+ export type Option = Parameters<SetOptionType>[0];
19
+ export type LoadingOptions = {
20
+ text?: string;
21
+ textColor?: string;
22
+ fontSize?: number | string;
23
+ fontWeight?: number | string;
24
+ fontStyle?: string;
25
+ fontFamily?: string;
26
+ maskColor?: string;
27
+ showSpinner?: boolean;
28
+ color?: string;
29
+ spinnerRadius?: number;
30
+ lineWidth?: number;
31
+ zlevel?: number;
32
+ };
33
+ type MouseEventName = 'click' | 'dblclick' | 'mouseout' | 'mouseover' | 'mouseup' | 'mousedown' | 'mousemove' | 'contextmenu' | 'globalout';
34
+ type ElementEventName = MouseEventName | 'mousewheel' | 'drag' | 'dragstart' | 'dragend' | 'dragenter' | 'dragleave' | 'dragover' | 'drop';
35
+ type ZRenderEventName = `zr:${ElementEventName}`;
36
+ type OtherEventName = 'highlight' | 'downplay' | 'selectchanged' | 'legendselectchanged' | 'legendselected' | 'legendunselected' | 'legendselectall' | 'legendinverseselect' | 'legendscroll' | 'datazoom' | 'datarangeselected' | 'graphroam' | 'georoam' | 'treeroam' | 'timelinechanged' | 'timelineplaychanged' | 'restore' | 'dataviewchanged' | 'magictypechanged' | 'geoselectchanged' | 'geoselected' | 'geounselected' | 'axisareaselected' | 'brush' | 'brushEnd' | 'brushselected' | 'globalcursortaken';
37
+ type MouseEmits = {
38
+ [key in MouseEventName]: (params: ECElementEvent) => boolean;
39
+ };
40
+ type ZRenderEmits = {
41
+ [key in ZRenderEventName]: (params: ElementEvent) => boolean;
42
+ };
43
+ type OtherEmits = {
44
+ [key in OtherEventName]: null;
45
+ };
46
+ export type Emits = MouseEmits & OtherEmits & {
47
+ rendered: (params: {
48
+ elapsedTime: number;
49
+ }) => boolean;
50
+ finished: () => boolean;
51
+ } & ZRenderEmits;
52
+ export {};
File without changes
@@ -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";
@@ -0,0 +1,4 @@
1
+ export declare const isOn: (key: string) => boolean;
2
+ type Attrs = Record<string, any>;
3
+ export declare function omitOn(attrs: Attrs): Attrs;
4
+ export {};
@@ -0,0 +1,11 @@
1
+ const onRE = /^on[^a-z]/;
2
+ export const isOn = (key) => onRE.test(key);
3
+ export function omitOn(attrs) {
4
+ const result = {};
5
+ for (const key in attrs) {
6
+ if (!isOn(key)) {
7
+ result[key] = attrs[key];
8
+ }
9
+ }
10
+ return result;
11
+ }
File without changes