refactor: complete three-layer serial refactoring (knowledge→schema→renderer)

Step 1 — Knowledge base: perfect all reference/*.md with type, range, default, unit
- text.md: add DataOrPathProps, path/data, bullet deprecated params
- chart.md: add deprecated section, fix 19 params with missing elements
- slide.md: add bkgd→background deprecated mapping
- output.md: add masterSlide, presLayout

Step 2 — Schema: align schema/presentation.schema.json with KB
- Add catAxisItem and valAxisItem definitions with full sub-property constraints
- Fix 7 enum constraints (barDir, displayBlanksAs, bar3DShape, etc.)
- Add 4 missing fields (verbose, autoPageCharWeight, autoPageLineWeight, notes,
  masterSlide, presLayout)

Step 3 — Translation engine: transform renderers from passthrough to validation
- index.js: add normalizePosition, normalizeColor, validateEnum shared utilities
- All renderers: position validation, color hex normalization, enum validation
- Image: graceful failure handling (catch load errors, warn, continue)
- Chart: chartType enum validation, data parity check
- Table: colspan/rowspan integer validation, border array check
- Full verification: basic.json and full.json generate valid PPTX

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 13:10:01 +08:00
co-authored by Claude Sonnet 5
parent c1a9c2fcda
commit ec7a44d6fb
12 changed files with 538 additions and 21 deletions
+74
View File
@@ -202,6 +202,9 @@
- **catAxisLabelFontSize**:轴标签字号
- 类型:`number`
- 单位:pt
- 取值范围:无特殊约束范围
- 无默认值
- **catAxisLabelFrequency**:标签频率
- 类型:`string`
@@ -211,6 +214,9 @@
- **catAxisLabelRotate**:标签旋转角度
- 类型:`number`
- 单位:度
- 取值范围:无特殊约束范围
- 无默认值
- **catAxisLineColor**:轴线颜色
- 类型:`string`
@@ -220,6 +226,9 @@
- **catAxisLineSize**:轴线粗细
- 类型:`number`
- 单位:pt
- 取值范围:无特殊约束范围
- 无默认值
- **catAxisLineStyle**:轴线样式
- 类型:`'solid' | 'dash' | 'dot'`
@@ -232,6 +241,9 @@
- **catAxisMajorUnit**:主要刻度单位
- 类型:`number`
- 单位:无单位(数值刻度)
- 取值范围:无特殊约束范围
- 无默认值
- **catAxisMaxVal**:轴最大值
- 类型:`number`
@@ -244,6 +256,9 @@
- **catAxisMinorUnit**:次要刻度单位
- 类型:`number`
- 单位:无单位(数值刻度)
- 取值范围:无特殊约束范围
- 无默认值
- **catAxisMinVal**:轴最小值
- 类型:`number`
@@ -269,6 +284,9 @@
- **catAxisTitleRotate**:轴标题旋转
- 类型:`number`
- 单位:度
- 取值范围:无特殊约束范围
- 无默认值
- **catGridLine**:分类网格线
- 类型:`OptsChartGridLine`
@@ -307,6 +325,9 @@
- **serAxisLabelFontSize**:系列轴标签字号
- 类型:`number`
- 单位:pt
- 取值范围:无特殊约束范围
- 无默认值
- **serAxisLabelFrequency**:系列轴标签频率
- 类型:`string`
@@ -399,6 +420,9 @@
- **valAxisLabelFontSize**:数值轴标签字号
- 类型:`number`
- 单位:pt
- 取值范围:无特殊约束范围
- 无默认值
- **valAxisLabelFormatCode**:数值轴标签格式代码
- 类型:`string`
@@ -408,6 +432,9 @@
- **valAxisLabelRotate**:数值轴标签旋转
- 类型:`number`
- 单位:度
- 取值范围:无特殊约束范围
- 无默认值
- **valAxisLineColor**:数值轴线颜色
- 类型:`string`
@@ -417,6 +444,9 @@
- **valAxisLineSize**:数值轴线粗细
- 类型:`number`
- 单位:pt
- 取值范围:无特殊约束范围
- 无默认值
- **valAxisLineStyle**:数值轴线样式
- 类型:`'solid' | 'dash' | 'dot'`
@@ -431,15 +461,24 @@
- **valAxisMajorUnit**:数值轴主要刻度单位
- 类型:`number`
- 单位:无单位(数值刻度)
- 取值范围:无特殊约束范围
- 无默认值
- **valAxisMaxVal**:数值轴最大值
- 类型:`number`
- 单位:无单位(数值与数据一致)
- 取值范围:无特殊约束范围
- 无默认值
- **valAxisMinorTickMark**:数值轴副刻度标记
- 类型:`ChartAxisTickMark`
- **valAxisMinVal**:数值轴最小值
- 类型:`number`
- 单位:无单位(数值与数据一致)
- 取值范围:无特殊约束范围
- 无默认值
- **valAxisOrientation**:数值轴方向
- 类型:`'minMax'`
@@ -473,13 +512,19 @@
- **bar3DShape**3D 柱形形状
- 类型:`string`
- 取值范围:`'box' | 'cylinder' | 'cone' | 'pyramid'`PowerPoint 标准值),类型声明为 string,也可接受其他值
- 默认值:`'box'`
- **barDir**:柱形方向
- 类型:`string`
- 取值范围:`'bar'`(水平)、`'col'`(垂直)
- 默认值:`'col'`
- **barGapDepthPct**3D 柱形深度间距百分比
- 类型:`number`
- 取值范围:`0``500`
- 默认值:`150`
- 单位:%
- **barGapWidthPct**:间距宽度百分比
- 类型:`number`
@@ -488,6 +533,8 @@
- **barGrouping**:分组方式
- 类型:`string`
- 取值范围:`'clustered' | 'stacked' | 'standard'`PowerPoint 标准值),类型声明为 string,也可接受其他值
- 默认值:`'clustered'`
- **barOverlapPct**:系列重叠百分比
- 类型:`number`
@@ -501,9 +548,12 @@
- **dataNoEffects**:禁用数据点效果
- 类型:`boolean`
- 默认值:`false`
- **holeSize**:中心孔大小
- 类型:`number`
- 取值范围:`0``90`(百分比)
- 默认值:`50`
---
@@ -548,6 +598,7 @@
- **dataNoEffects**:禁用数据点效果
- 类型:`boolean`
- 默认值:`false`
- **firstSliceAng**:第一扇区起始角度
- 类型:`number`
@@ -569,9 +620,12 @@
- **dataLabelBkgrdColors**:数据标签背景色
- 类型:`boolean`
- 默认值:`false`
- **dataLabelColor**:数据标签颜色
- 类型:`string`
- 取值范围:无特殊约束范围
- 无默认值
- **dataLabelFontBold**:数据标签粗体
- 类型:`boolean`
@@ -584,6 +638,9 @@
- **dataLabelFontSize**:数据标签字号
- 类型:`number`
- 单位:pt
- 取值范围:无特殊约束范围
- 无默认值
- **dataLabelFormatCode**:数据标签格式代码
- 类型:`string`
@@ -601,6 +658,9 @@
- **dataTableFontSize**:数据表字号
- 类型:`number`
- 单位:pt
- 取值范围:无特殊约束范围
- 无默认值
- **dataTableFormatCode**:数据表格式代码
- 类型:`string`
@@ -650,6 +710,8 @@
- **titleAlign**:标题对齐
- 类型:`string`
- 取值范围:`'l' | 'ctr' | 'r'`
- 默认值:`'ctr'`
- **titleBold**:标题粗体
- 类型:`boolean`
@@ -682,6 +744,9 @@
- **size**:网格线粗细
- 类型:`number`
- 单位:pt
- 取值范围:无特殊约束范围
- 无默认值
- **style**:网格线样式
- 类型:`'solid' | 'dash' | 'dot' | 'none'`
@@ -705,3 +770,12 @@
- **altText**:替代文字(无障碍)
- 类型:`string`
- 说明:PowerPoint 中右击图表 > "编辑替代文字"
---
## 已废弃参数
| 已废弃参数 | 替代参数 | 废弃版本 |
|---|---|---|
| `border` | `plotArea.border` | v3.11.0 |
| `fill` | `plotArea.fill` | v3.11.0 |