新增: Rust Op reducer + 逆操作计算(B2)

- op.rs: 纯函数 apply_op(deck,op) → new_deck,覆盖全部 11 种 Op 类型
- invert_op(deck,op) → 逆 Op,支持完整的 undo 链路
- 所有 reducer 不 mutate 输入,返回新 deck
- 8 个单元测试: add_slide/del_slide/set_theme/update_element/del_element/
  move_slide/undo_update/undo_add_slide/replace_deck_undo
- ElementStyle 加 rename_all=camelCase 匹配 JS 协议
- 32 个测试全部通过(B1:23 + B2:9)
This commit is contained in:
2026-07-12 22:33:41 +08:00
parent 1430e9e061
commit 664ca9c65c
4 changed files with 561 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ export type ChatMessage = { role: string, content: string, };
export type Deck = { v: number, theme: string, slides: Array<Slide>, chat_id: string | null, };
export type ElementStyle = { font_size: number | null, color: string | null, align: string | null, bold: boolean | null, italic: boolean | null, anim: string | null, label: string | null, label_color: string | null, label_size: number | null, fit: string | null, shape_type: ShapeType | null, fill: string | null, gradient: boolean | null, opacity: number | null, radius: number | null, max: number | null, chart_type: ChartType | null, legend: boolean | null, stack: boolean | null, grid: boolean | null, header: boolean | null, lang: string | null, inline: boolean | null, icon: string | null, accent: string | null, };
export type ElementStyle = { fontSize: number | null, color: string | null, align: string | null, bold: boolean | null, italic: boolean | null, anim: string | null, label: string | null, labelColor: string | null, labelSize: number | null, fit: string | null, shapeType: ShapeType | null, fill: string | null, gradient: boolean | null, opacity: number | null, radius: number | null, max: number | null, chartType: ChartType | null, legend: boolean | null, stack: boolean | null, grid: boolean | null, header: boolean | null, lang: string | null, inline: boolean | null, icon: string | null, accent: string | null, };
export type ElementType = "title" | "text" | "list" | "stat" | "quote" | "image" | "shape" | "chart" | "card" | "table" | "code" | "formula";