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
+16 -2
View File
@@ -1,6 +1,6 @@
# 文字参数 (Text Props)
文字参数来自 `TextPropsOptions`(继承 `TextBaseProps``PositionProps``ObjectNameProps`)和 `TextGlowProps`,用于 `slide.addText()` 方法。
文字参数来自 `TextPropsOptions`(继承 `TextBaseProps``PositionProps``DataOrPathProps``ObjectNameProps`)和 `TextGlowProps`,用于 `slide.addText()` 方法。
---
@@ -131,6 +131,16 @@
## 文字专有属性 (TextPropsOptions 特有)
继承 `DataOrPathProps`,支持以下嵌入图片的属性:
- **path**:图片路径
- 类型:`string`
- 说明:URL 或本地路径,可在文本框中嵌入图片
- **data**:图片 Base64 数据
- 类型:`string`
- 说明:Base64 编码的图片数据,替代 `path`
- **baseline**:基线偏移
- 类型:`number`
@@ -231,7 +241,7 @@
- **lineSpacingMultiple**:行间距(倍数)
- 类型:`number`
- 取值范围:`0.0``9.99`
- 单位:百分比倍数
- 单位:倍数(非百分比
- 说明:PowerPoint 段落 > 缩进和间距 > 行距 > "多倍行距"
- 示例:`1.5`1.5 倍行距)
- 始于:v3.5.0
@@ -385,6 +395,10 @@
| `autoFit` | `fit` | v3.3.0 |
| `shrinkText` | `fit` | v3.3.0 |
| `inset` | `margin` | v3.10.0 |
| `bullet.code` | `bullet.characterCode` | v3.3.0 |
| `bullet.marginPt` | `bullet.indent` | v3.3.0 |
| `bullet.startAt` | `bullet.numberStartAt` | v3.3.0 |
| `bullet.style` | `bullet.numberType` | v3.3.0 |
| `lineDash` | `line.dashType` | v3.3.0 |
| `lineHead` | `line.beginArrowType` | v3.3.0 |
| `lineSize` | `line.width` | v3.3.0 |