nuxt-echarts 0.0.4 → 0.0.5
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/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
# Nuxt ECharts
|
|
4
4
|
|
|
@@ -13,17 +13,17 @@ Nuxt Module for Apache ECharts™
|
|
|
13
13
|
>
|
|
14
14
|
> Nuxt ECharts is currently in active development and based on [experimental `<NuxtIsland>`](https://nuxt.com/docs/api/components/nuxt-island). If you found any issue, design flaw, or have ideas to improve it, please open an [issue](https://github.com/kingyue737/nuxt-echarts/issues) or a [Discussion](https://github.com/kingyue737/nuxt-echarts/discussions).
|
|
15
15
|
|
|
16
|
+
- [📖 Documentation (WIP)](https://echarts.nuxt.dev)
|
|
17
|
+
|
|
16
18
|
- [✨ Release Notes](/CHANGELOG.md)
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
<!-- - [🏀 Online playground](https://stackblitz.com/github/kingyue737/nuxt-echarts?file=playground%2Fapp.vue) -->
|
|
20
|
-
<!-- - [📖 Documentation](https://example.com) -->
|
|
19
|
+
- [🎞️ Online Demo](https://nuxt-echarts.nuxt.dev/)
|
|
20
|
+
- [🏀 Online Playground](https://stackblitz.com/github/kingyue737/nuxt-echarts?file=playground%2Fapp.vue)
|
|
21
21
|
|
|
22
22
|
## Features
|
|
23
23
|
|
|
24
24
|
- ⛰ **SSR**: Server-side SVG Rendering with [Nuxt server components](https://nuxt.com/docs/guide/directory-structure/components#server-components)
|
|
25
25
|
|
|
26
|
-
- ♾️ **Client Hydration**: lazy-loading
|
|
26
|
+
- ♾️ **Client Hydration**: lazy-loading full ECharts or [lightweight client runtime](https://echarts.apache.org/handbook/en/how-to/cross-platform/server#using-lightweight-runtime)
|
|
27
27
|
- 🛠️ **Configurable**: import only [necessary functionality](https://echarts.apache.org/handbook/en/basics/import#shrinking-bundle-size) for shrinking bundle size
|
|
28
28
|
- 🦾 **Type Strong**: auto-import [ECharts option type](https://echarts.apache.org/handbook/en/basics/import#creating-an-option-type-in-typescript) based on your config
|
|
29
29
|
- 🌲 **Tree-shaking**: Components and ECharts are only included if you use them
|
package/dist/module.json
CHANGED
|
@@ -26,33 +26,14 @@ function hydrateChart() {
|
|
|
26
26
|
// Use the lightweight runtime to give the chart interactive capabilities
|
|
27
27
|
hydrate(container, {
|
|
28
28
|
on: {
|
|
29
|
-
click: attrs.onClick
|
|
30
|
-
|
|
31
|
-
|
|
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,
|
|
29
|
+
click: attrs.onClick,
|
|
30
|
+
mouseout: attrs.onMouseout,
|
|
31
|
+
mouseover: attrs.onMouseover,
|
|
47
32
|
},
|
|
48
33
|
})
|
|
49
34
|
}
|
|
50
35
|
}
|
|
51
36
|
|
|
52
|
-
function setInnerHTML(svgStr?: string) {
|
|
53
|
-
if (container && svgStr) container.innerHTML = svgStr
|
|
54
|
-
}
|
|
55
|
-
|
|
56
37
|
let observer: MutationObserver
|
|
57
38
|
onMounted(async () => {
|
|
58
39
|
await nextTick()
|
|
@@ -63,7 +44,7 @@ onMounted(async () => {
|
|
|
63
44
|
|
|
64
45
|
// call 'observe' on that MutationObserver instance,
|
|
65
46
|
// passing it the element to observe, and the options object
|
|
66
|
-
observer.observe(root.value!, {
|
|
47
|
+
observer.observe(root.value!.querySelector('.vue-echarts-server')!, {
|
|
67
48
|
characterData: false,
|
|
68
49
|
childList: true,
|
|
69
50
|
attributes: false,
|
|
@@ -25,7 +25,7 @@ function onError(e: unknown) {
|
|
|
25
25
|
e instanceof TypeError &&
|
|
26
26
|
e.message === "Cannot read properties of undefined (reading 'link')"
|
|
27
27
|
) {
|
|
28
|
-
// @ts-expect-error
|
|
28
|
+
// @ts-expect-error https://github.com/nuxt/nuxt/issues/27730
|
|
29
29
|
root.value.refresh()
|
|
30
30
|
}
|
|
31
31
|
emits('error', e)
|
|
@@ -34,15 +34,17 @@ const root = ref<InstanceType<typeof VChartIsland> | null>(null)
|
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
36
|
<template>
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
<div class="vue-echarts-server">
|
|
38
|
+
<VChartIsland
|
|
39
|
+
ref="root"
|
|
40
|
+
:theme="realTheme"
|
|
41
|
+
:option="option"
|
|
42
|
+
:init-options="realInitOptions"
|
|
43
|
+
@error="onError"
|
|
44
|
+
>
|
|
45
|
+
<template #fallback>
|
|
46
|
+
<slot name="fallback" />
|
|
47
|
+
</template>
|
|
48
|
+
</VChartIsland>
|
|
49
|
+
</div>
|
|
48
50
|
</template>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-echarts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Nuxt Module for Apache ECharts™",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -32,11 +32,13 @@
|
|
|
32
32
|
"dev:build": "nuxi build playground",
|
|
33
33
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
34
34
|
"release": "pnpm run lint && pnpm run test && pnpm run prepack && changelogen --release && npm publish --registry=\"https://registry.npmjs.org/\" && git push --follow-tags",
|
|
35
|
+
"docs:dev": "nuxi dev docs",
|
|
36
|
+
"docs:build": "nuxi generate docs",
|
|
35
37
|
"lint": "eslint . --fix",
|
|
36
38
|
"format": "prettier . --write",
|
|
37
39
|
"test": "vitest run",
|
|
38
40
|
"test:watch": "vitest watch",
|
|
39
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
41
|
+
"test:types": "vue-tsc --noEmit && nuxi typecheck docs && cd playground && vue-tsc --noEmit"
|
|
40
42
|
},
|
|
41
43
|
"dependencies": {
|
|
42
44
|
"@nuxt/kit": "^3.12.2",
|
|
@@ -70,5 +72,8 @@
|
|
|
70
72
|
"webpack"
|
|
71
73
|
]
|
|
72
74
|
}
|
|
75
|
+
},
|
|
76
|
+
"stackblitz": {
|
|
77
|
+
"startCommand": "pnpm run dev:prepare && pnpm run dev"
|
|
73
78
|
}
|
|
74
|
-
}
|
|
79
|
+
}
|