refactor: complete architectural inversion with extended elements, degrade pipeline, and multi-format exporters - #4
Closed
InitialXKO wants to merge 2 commits into
Closed
Conversation
…grade pipeline and multi-format exporters Co-authored-by: InitialXKO <45725592+InitialXKO@users.noreply.github.com>
…146412230337 Architecture Inversion Refactor: Extended Elements, Degradation & Exporters
Owner
|
感谢提交这个 PR。我们评估后认为其中“可编辑表格/扩展图表”和统一降级策略有价值,但当前 PR 同时引入了 form/embed、公式、动画及多格式导出,超出了 CreatPPT 当前 Agent-first、Web-first 的核心边界,暂不适合直接合并。 当前实现还有几个需要先解决的阻塞问题:
为保持项目边界并降低维护风险,建议后续拆成小 PR:
因此我们先关闭这个 PR,但这不是否定方向;如果你愿意按上述范围拆分,欢迎重新提交后续 PR。 |
Owner
|
按上面的拆分建议先关闭此 PR,后续可通过范围更小的新 PR 继续推进。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本次 PR 实现了 CreatPPT 的架构反转改造(Architectural Inversion),遵循核心原则:
数据模型层 — 意图优先,不设上限:DeckSpec 仅表达用户与 Agent 的真实意图,解耦导出物理能力的限制。
Web 渲染层 — 权威渲染,完整表达:Web 端作为权威富交互呈现媒介。
PPTX 导出层 — 保真投影,有损降级:通过明确的降级矩阵(DegradeStrategy)实现尽力而为的原生 PPTX 导出与 OpenXML 动画注入。
交付多样化:补齐 web | pptx | pdf | png 4 种交付格式的完整支持。
🚀 Key Changes / 核心变更
数据模型与 Zod 校验层 (Data Model & Schema):
SLIDE_ELEMENT_TYPES 扩展支持 table、chart、form、embed、animation、action 6 种新元素类型。
新增 TableSpec、ChartSpec (扩展支持 pie/line/scatter/area)、FormSpec、EmbedSpec、AnimationSpec、ActionSpec 接口与 Schema。
slideElementSchema 开启 .passthrough(),支持非破坏性扩展。
Web 渲染与交互引擎 (Web Render & Interactions):
新建 FormulaEngine(src/utils/formula.ts):支持 =SUM, =AVERAGE, =MIN, =MAX 及 A1:B5 单元格引用的轻量计算。
新建 Vue 组件:EditableTable.vue(可编辑单元格与公式求值)、EditableChart.vue(响应式 SVG 图表与 Tooltip)、EditableForm.vue(表单控件与持久化)、EmbedView.vue(沙盒 iframe)。
交互升级:在 SlideElementView 中支持路由/URL 动作跳转,在 SlideSurface 中集成 IntersectionObserver 动画触发,在 editor state 中增加 formData 状态持久化。
PPTX 导出降级与动画后处理 (PPTX Degrade & XML Post-processing):
新建 DegradeStrategy 矩阵,实现表格公式已计算值导出、5 种图表类型映射、表单/嵌入/动作策略降级。
实现 injectAnimations() ZIP XML 后处理,向 slideN.xml 注入 OpenXML <p:timing> 动画节点,并在 inspectPptxBlob 中增加校验。
多格式交付导出器 (Multi-Format Exporters):
新建 exportDeckToHtml()(独立交互 HTML 打包)、exportDeckToPdf()(打印/PDF 导出)、exportDeckToPng()(逐页 PNG 图包导出),与 DeliveryFormat 对齐。
智能化管道 (Pipeline Intelligence):
规划器 planner.ts 增加 table 与 form 布局评分候选。
content-plan.ts 增加 Markdown Pipe 表格数据感知,自动转化为 table 元素。
pipeline.ts 增加内容密度 inferAnimations 自动动画推断阶段。
📊 Capability & Degrade Comparison / 能力与降级对比表
元素类型 / 功能 Web 工作区 (权威) PPTX 导出 (降级投影) PDF 导出 PNG 导出
文本 (text) 完整编辑与样式 原生 PPTX 文本框 ✅ ✅
图片 (image) 自由变换与 Object Fit 原生 PPTX 图片 ✅ ✅
形状 (rect/ellipse/line/arrow) 矢量图形与边框 原生 PPTX 矢量 Shape ✅ ✅
表格 (table) 单元格编辑、公式求值与合并 原生 PPTX 表格 (已计算数值) ✅ ✅
图表 (chart) 5 种 SVG 图表与 Tooltip 原生 PPTX 图表对象 ✅ ✅
表单 (form) 交互控件与数据收集 静态标签 + [___] 占位 ✅ ✅
嵌套 (embed) 沙盒 iframe 嵌入 降级图片 / 超链接文本 ✅ ✅
动画 (animation) IntersectionObserver / CSS 触发 注入 <p:timing> XML 节点 静态快照 静态快照
动作 (action) Slide 跳转与 URL 路由 原生 PPTX Hyperlink 超链接 ✅ 静态快照
✅ Verification & Tests / 测试验证
类型检查:npm run typecheck(vue-tsc --noEmit)通过(0 错误)。
单元与集成测试:npm test(vitest run)23 个测试套件,105 项测试全数通过(包含新增的 degrade.test.ts 降级行为矩阵测试)。
构建打包:npm run build 打包无异常。
What changed
Completed the 43-item architectural inversion for CreatPPT ("Intent First, No Ceiling" & "Fidelity Projection, Graceful Degradation"):
Data Model & Zod Schema Layer:
SLIDE_ELEMENT_TYPESwithtable,chart,form,embed,animation, andaction.TableSpec(with formula support & merge cells),ChartSpec(extended withpie,line,scatter,area),FormSpec,EmbedSpec,AnimationSpec, andActionSpec..passthrough()onslideElementSchemafor non-breaking schema evolution.Web Rendering Layer & Interactions:
FormulaEngine(src/utils/formula.ts) for spreadsheet formula evaluation (=SUM,=AVERAGE,=MIN,=MAX, and cell references).EditableTable.vue,EditableChart.vue(interactive SVG charts with tooltips),EditableForm.vue(with persistentformDatastate), andEmbedView.vue(sandboxed iframe + fallback).SlideSurface.vueandSlideElementView.vue.PPTX Export & Degrade Pipeline:
DegradeStrategymap (src/export/degrade.ts) to gracefully degrade tables (evaluated formulas), 5 chart types, forms, embeds, and hyperlinks/actions into native PPTX objects.<p:timing>XML node injection (injectAnimations) in PPTX post-processing, and added structural inspection rules ininspectPptxBlob.Multi-Format Delivery Exporters:
exportDeckToHtml(),exportDeckToPdf(), andexportDeckToPng()aligned withDeliveryFormat(web | pptx | pdf | png).Pipeline & Intelligence:
tableandformcandidate scoring inplanner.ts.content-plan.ts.inferAnimations) inpipeline.ts.Testing & Documentation:
tests/degrade.test.ts(12 element types x 4 exporters matrix test).README.mdandREADME.zh-CN.mdwith Web capability vs PPTX degradation comparison matrices.Validation
npm run checknpm run audit:releasenpm run package:smokeRelease and safety