@ai-gui/plugin-chart 0.4.4 → 0.5.0
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/index.cjs +5 -4
- package/dist/index.js +5 -4
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -101,7 +101,8 @@ function chart(opts = {}) {
|
|
|
101
101
|
const height = opts.height ?? 400;
|
|
102
102
|
const gl = opts.gl ?? false;
|
|
103
103
|
const interactive = gl || (opts.interactive ?? false);
|
|
104
|
-
const render = (node) => {
|
|
104
|
+
const render = (node, context) => {
|
|
105
|
+
const chartTheme = context?.theme === "dark" ? "dark" : void 0;
|
|
105
106
|
const { data: option, complete } = (0, __ai_gui_core.parsePartialJSON)(node.content ?? "");
|
|
106
107
|
if (!complete || option == null || typeof option !== "object") return {
|
|
107
108
|
kind: "html",
|
|
@@ -116,7 +117,7 @@ function chart(opts = {}) {
|
|
|
116
117
|
let disposed = false;
|
|
117
118
|
loadGl().then(() => {
|
|
118
119
|
if (disposed) return;
|
|
119
|
-
inst$1 = (0, echarts_core.init)(el,
|
|
120
|
+
inst$1 = (0, echarts_core.init)(el, chartTheme, {
|
|
120
121
|
width,
|
|
121
122
|
height
|
|
122
123
|
});
|
|
@@ -137,7 +138,7 @@ function chart(opts = {}) {
|
|
|
137
138
|
return {
|
|
138
139
|
kind: "mount",
|
|
139
140
|
mount: (el) => {
|
|
140
|
-
const inst$1 = (0, echarts_core.init)(el,
|
|
141
|
+
const inst$1 = (0, echarts_core.init)(el, chartTheme, {
|
|
141
142
|
renderer: "svg",
|
|
142
143
|
width,
|
|
143
144
|
height
|
|
@@ -154,7 +155,7 @@ function chart(opts = {}) {
|
|
|
154
155
|
}
|
|
155
156
|
let inst;
|
|
156
157
|
try {
|
|
157
|
-
inst = (0, echarts_core.init)(null, null, {
|
|
158
|
+
inst = (0, echarts_core.init)(null, chartTheme ?? null, {
|
|
158
159
|
renderer: "svg",
|
|
159
160
|
ssr: true,
|
|
160
161
|
width,
|
package/dist/index.js
CHANGED
|
@@ -77,7 +77,8 @@ function chart(opts = {}) {
|
|
|
77
77
|
const height = opts.height ?? 400;
|
|
78
78
|
const gl = opts.gl ?? false;
|
|
79
79
|
const interactive = gl || (opts.interactive ?? false);
|
|
80
|
-
const render = (node) => {
|
|
80
|
+
const render = (node, context) => {
|
|
81
|
+
const chartTheme = context?.theme === "dark" ? "dark" : void 0;
|
|
81
82
|
const { data: option, complete } = parsePartialJSON(node.content ?? "");
|
|
82
83
|
if (!complete || option == null || typeof option !== "object") return {
|
|
83
84
|
kind: "html",
|
|
@@ -92,7 +93,7 @@ function chart(opts = {}) {
|
|
|
92
93
|
let disposed = false;
|
|
93
94
|
loadGl().then(() => {
|
|
94
95
|
if (disposed) return;
|
|
95
|
-
inst$1 = init(el,
|
|
96
|
+
inst$1 = init(el, chartTheme, {
|
|
96
97
|
width,
|
|
97
98
|
height
|
|
98
99
|
});
|
|
@@ -113,7 +114,7 @@ function chart(opts = {}) {
|
|
|
113
114
|
return {
|
|
114
115
|
kind: "mount",
|
|
115
116
|
mount: (el) => {
|
|
116
|
-
const inst$1 = init(el,
|
|
117
|
+
const inst$1 = init(el, chartTheme, {
|
|
117
118
|
renderer: "svg",
|
|
118
119
|
width,
|
|
119
120
|
height
|
|
@@ -130,7 +131,7 @@ function chart(opts = {}) {
|
|
|
130
131
|
}
|
|
131
132
|
let inst;
|
|
132
133
|
try {
|
|
133
|
-
inst = init(null, null, {
|
|
134
|
+
inst = init(null, chartTheme ?? null, {
|
|
134
135
|
renderer: "svg",
|
|
135
136
|
ssr: true,
|
|
136
137
|
width,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-gui/plugin-chart",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "ECharts chart plugin for AIGUI — static SVG, interactive, and 3D (echarts-gl).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"llm",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"echarts": "^5.5.1",
|
|
56
|
-
"@ai-gui/core": "0.
|
|
56
|
+
"@ai-gui/core": "0.5.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"echarts-gl": "^2.0.9"
|