@damoqiongqiu/ice-chart-dsl 0.2.0 → 0.2.2

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 (2) hide show
  1. package/README.md +23 -0
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -124,6 +124,29 @@ if (!result.valid) console.log(result.errors.map((e) => e.message).join('\n'));
124
124
  区间宽度为 0(`annotation-empty-area`)是**警告**。
125
125
  - 逃生舱照常:`options.annotation` 能整体覆盖顶层 `annotation`。
126
126
 
127
+ ## 主题:一条链路贯通图表与引擎
128
+
129
+ DSL 里的主题走图表的 `options.theme`(`'light'` / `'dark'` / `'auto'` / 部分主题片段),
130
+ **图表层再把它映射到引擎主题**(引擎 2.4 起):图表实例里那些「引擎自己画的东西」
131
+ (引擎默认样式、选中框 / 手柄 / 插槽这些交互外壳、应用后加的自定义图元)会跟着一起换。
132
+
133
+ ```json
134
+ {
135
+ "kind": "line",
136
+ "data": { "columns": ["月份", "销量"], "rows": [["1月", 120], ["2月", 132]] },
137
+ "encoding": { "x": "月份", "y": "销量" },
138
+ "options": {
139
+ "theme": "dark"
140
+ }
141
+ }
142
+ ```
143
+
144
+ - `theme: 'auto'` = 跟随**引擎实例主题**(按引擎主题背景色的亮度判定明暗)——
145
+ 图表渲染在别人的暗色画布上时,写 `auto` 即可,不用自己判断。
146
+ - 需要品牌色就传片段:`"theme": { "colorPalette": ["#0d6efd", "#10b981"], "textColor": "#212529" }`
147
+ (浅合并到亮色主题),映射到引擎的那一份会自动跟着算。
148
+ - 完整的映射表见 `ice-chart` 仓库的 `src/theme/chartEngineBridge.ts`。
149
+
127
150
  ## 诊断:给 agent 的自修复反馈
128
151
 
129
152
  `validateChartDsl()` **不抛异常**,返回结构化诊断(`{ severity, code, message, path }`):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@damoqiongqiu/ice-chart-dsl",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "license": "MIT",
5
5
  "author": "大漠穷秋",
6
6
  "description": "A JSON-first DSL layer for AI agents to build charts with ice-chart.",
@@ -51,7 +51,7 @@
51
51
  "@babel/core": "7.28.5",
52
52
  "@babel/preset-env": "7.28.5",
53
53
  "@babel/preset-typescript": "7.28.5",
54
- "@damoqiongqiu/ice-chart": "^0.20.0",
54
+ "@damoqiongqiu/ice-chart": "^0.21.0",
55
55
  "@rollup/plugin-babel": "6.1.0",
56
56
  "@rollup/plugin-commonjs": "28.0.1",
57
57
  "@rollup/plugin-json": "6.1.0",
@@ -59,7 +59,7 @@
59
59
  "@rollup/plugin-terser": "0.4.4",
60
60
  "@types/jest": "29.5.14",
61
61
  "babel-jest": "29.7.0",
62
- "ice-render": "^2.3.0",
62
+ "ice-render": "^2.4.0",
63
63
  "jest": "29.7.0",
64
64
  "rimraf": "5.0.10",
65
65
  "rollup": "3.29.5",