@vmz/plugin-echarts 0.3.5 → 0.3.7

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 (3) hide show
  1. package/package.json +23 -8
  2. package/runtime.ts +0 -52
  3. package/vmz.plugin.ts +0 -46
package/package.json CHANGED
@@ -1,18 +1,30 @@
1
1
  {
2
2
  "dependencies": {
3
- "@vmz/plugin": "0.3.5"
3
+ "@vmz/plugin": "0.3.7"
4
4
  },
5
5
  "description": "VMZ ECharts chart adapter - <Echarts>",
6
+ "devDependencies": {
7
+ "@types/node": "^22.15.0",
8
+ "typescript": "^5.8.3"
9
+ },
10
+ "engines": {
11
+ "node": ">=24.12.0"
12
+ },
6
13
  "exports": {
7
14
  ".": {
8
- "default": "./vmz.plugin.ts",
9
- "types": "./vmz.plugin.ts"
15
+ "default": "./dist/vmz.plugin.js",
16
+ "types": "./dist/vmz.plugin.d.ts"
10
17
  },
11
18
  "./runtime": {
12
- "default": "./runtime.ts",
13
- "types": "./runtime.ts"
19
+ "default": "./dist/runtime.js",
20
+ "types": "./dist/runtime.d.ts"
14
21
  }
15
22
  },
23
+ "files": [
24
+ "dist",
25
+ "components",
26
+ "README.md"
27
+ ],
16
28
  "keywords": [
17
29
  "vmz",
18
30
  "plugin",
@@ -20,7 +32,7 @@
20
32
  "chart"
21
33
  ],
22
34
  "license": "MIT",
23
- "main": "./vmz.plugin.ts",
35
+ "main": "./dist/vmz.plugin.js",
24
36
  "name": "@vmz/plugin-echarts",
25
37
  "peerDependencies": {
26
38
  "echarts": ">=5"
@@ -33,7 +45,10 @@
33
45
  "type": "git",
34
46
  "url": "git+https://github.com/doki-land/vmz-framework.git"
35
47
  },
48
+ "scripts": {
49
+ "build": "tsc -p tsconfig.json"
50
+ },
36
51
  "type": "module",
37
- "types": "./vmz.plugin.ts",
38
- "version": "0.3.5"
52
+ "types": "./dist/vmz.plugin.d.ts",
53
+ "version": "0.3.7"
39
54
  }
package/runtime.ts DELETED
@@ -1,52 +0,0 @@
1
- /**
2
- * ECharts mount helper (browser). Peer: echarts.
3
- * Parallel to DaVinci (declarative track); prefer for production charts while DaVinci matures.
4
- */
5
-
6
- export type MountEchartsOptions = {
7
- option?: Record<string, unknown> | null;
8
- theme?: string | object | null;
9
- renderer?: 'canvas' | 'svg';
10
- };
11
-
12
- export async function mountEcharts(el: HTMLElement, opts: MountEchartsOptions = {}) {
13
- const echarts = await import('echarts');
14
- const chart = echarts.init(el, opts.theme ?? undefined, {
15
- renderer: opts.renderer ?? 'canvas',
16
- });
17
- if (opts.option) {
18
- chart.setOption(opts.option);
19
- }
20
- const onResize = () => {
21
- chart.resize();
22
- };
23
- if (typeof ResizeObserver !== 'undefined') {
24
- const ro = new ResizeObserver(onResize);
25
- ro.observe(el);
26
- return {
27
- chart,
28
- setOption: (option: Record<string, unknown>, notMerge?: boolean) => {
29
- chart.setOption(option, notMerge);
30
- },
31
- dispose: () => {
32
- ro.disconnect();
33
- chart.dispose();
34
- },
35
- };
36
- }
37
- if (typeof window !== 'undefined') {
38
- window.addEventListener('resize', onResize);
39
- }
40
- return {
41
- chart,
42
- setOption: (option: Record<string, unknown>, notMerge?: boolean) => {
43
- chart.setOption(option, notMerge);
44
- },
45
- dispose: () => {
46
- if (typeof window !== 'undefined') {
47
- window.removeEventListener('resize', onResize);
48
- }
49
- chart.dispose();
50
- },
51
- };
52
- }
package/vmz.plugin.ts DELETED
@@ -1,46 +0,0 @@
1
- import { definePlugin, loadPluginSource } from '@vmz/plugin';
2
-
3
- const source = loadPluginSource(import.meta.url, 'components/Echarts.vmz');
4
-
5
- export default definePlugin({
6
- name: '@vmz/plugin-echarts',
7
- version: '0.1.0',
8
- protocol: '0.1.0',
9
- stages: ['workspace_resolve', 'analyzer'],
10
- deterministic: true,
11
- async contribute(ctx) {
12
- if (ctx.stage === 'workspace_resolve') {
13
- return {
14
- stage: 'workspace_resolve',
15
- cacheKey: `@vmz/plugin-echarts:Echarts.vmz:${source.contentHash.slice(0, 12)}`,
16
- items: [
17
- {
18
- id: 'component-echarts',
19
- kind: 'source',
20
- path: 'src/components/Echarts.vmz',
21
- content: source.content,
22
- contentHash: source.contentHash,
23
- materialize: true,
24
- },
25
- ],
26
- };
27
- }
28
- if (ctx.stage === 'analyzer') {
29
- return {
30
- stage: 'analyzer',
31
- cacheKey: '@vmz/plugin-echarts:analyzer',
32
- items: [
33
- {
34
- id: 'component-echarts-online',
35
- kind: 'analyzer',
36
- path: 'src/components/Echarts.vmz',
37
- severity: 'advice',
38
- message: 'Echarts component online',
39
- code: 'vmz.plugin.echarts',
40
- },
41
- ],
42
- };
43
- }
44
- return { stage: ctx.stage, items: [] };
45
- },
46
- });