Commit Graph
38 Commits
Author SHA1 Message Date
李进 330f4e96ce feat: 加入 web-to-pixso 插件源码
Chrome 扩展,用于从网页提取 DOM 树为 JSON 格式。
核心文件:capture.js(76KB,提取逻辑)
v1.0
2026-07-27 12:22:27 +08:00
李进 a10969b562 feat: jszip 后处理注入 type=custom + 画布高度限制140cm
- 用 jszip 原地修改 PPTX 的 sldSz,加 type=custom(WPS 识别自定义尺寸)
- 画布最大高度限制 140cm(WPS 上限)
- zip 命令行打包会破坏 PPTX 结构,改用 jszip 保证完整性
2026-07-27 12:20:22 +08:00
李进 f3d60360ac fix: 画布尺寸 — 多slide用容器rect,单slide用canvas
- PPT设计稿(多slide):用容器rect,每页独立尺寸
- 网页(单slide):用canvas尺寸,确保内容不溢出
2026-07-27 12:00:07 +08:00
李进 5035647c91 fix: TEXT 被 IMAGE 包含时也移除(aria-label 等隐藏文字) 2026-07-24 18:29:06 +08:00
李进 d4d86eb1da fix: IMAGE 覆盖的 TEXT 节点自动移除
当 TEXT 节点和 IMAGE 节点同坐标同尺寸时,移除 TEXT(图片替代文字)
2026-07-24 18:27:12 +08:00
李进 8ab3f479a7 feat: 图片自动下载 + 重叠去重 bug 修复
- IMG 标签自动从 src URL 下载图片并嵌入 PPT
- URL 拼接用 origin 而非完整 pageUrl(修复 404)
- collectSlideChildren 补全 backgroundImages 字段传递
- 重叠去重 key 加 type,避免不同类型节点被误删
- 三个 PPT 都验证通过
2026-07-24 18:25:01 +08:00
李进 f3853e31d4 feat: z-index排序 + 重叠去重 + overflow裁剪 + 图片支持
- z-index 排序:兄弟节点按 zIndex 排序,高层在上
- 重叠去重:同坐标完全相同的节点只保留后者
- overflow:hidden:用 clipRect 裁剪,完全在区域外的节点跳过
- 图片支持:RECTANGLE 有 backgroundImages 的也作为图片渲染
- 三个 PPT 都验证通过
2026-07-24 18:05:41 +08:00
李进 0ed04eb3ea refactor: 背景色兜底用 canvas 背景色替代硬编码 2026-07-24 17:36:07 +08:00
李进 8f507256ef fix: 合并文本框宽度用 rect.w 而非 parentW
合并节点的 parentW 继承自第一个子节点(如 strong 的窄宽度),
导致文本框太窄。改为用合并后的 rect.w。
2026-07-24 17:25:12 +08:00
李进 f4adac77c5 feat: TEXT 节点合并 — 同 y 坐标的内联文本合并为富文本
- 同 y(误差<5px)且 x 相邻或重叠的 TEXT 节点合并
- 合并后保留 bold/italic/color 等格式差异
- 用 pptxgenjs 原生富文本支持渲染
- 16个合并对象,不影响其他独立文本框
2026-07-24 17:16:07 +08:00
李进 58ee40f71a fix: slide name 正则精确匹配 — 排除 page-info/page-num
- /^(slide([- ]\w+)*|page)$/i
- slide / slide-1 / slide hero dark active 都匹配
- page-info / page-num 不匹配
- 三个 PPT 都正确识别
2026-07-24 16:47:52 +08:00
李进 aaa28f1bd8 refactor: TEXT 宽度通用化 — 去掉 depth===1 硬编码
- parentW 超过 contentW 的 80% 时视为顶层,用 contentW
- 否则用 parentW(表格单元格等嵌套容器)
- 不再依赖 _depth 字段判断层级
2026-07-24 16:44:54 +08:00
李进 dd916dcf9e feat: 补全 styles 映射 — opacity/lineHeight/letterSpacing/textDecoration/display/visibility
TEXT 新增:
- textDecorationLine → underline/strike
- letterSpacing → charSpacing
- opacity → transparency
- lineHeight → lineSpacingMultiple
- display:none / visibility:hidden → 跳过

Shape 新增:
- opacity → transparency
- display:none / visibility:hidden → 跳过

PPTX 渲染端同步传递所有新属性
2026-07-24 16:44:19 +08:00
李进 0e60f7525b refactor: 通用化背景色逻辑
- 去掉 dark/light 关键词硬编码
- 优先级:styles.backgroundColor → 文字颜色反推 → canvas.backgroundColor
- 文字颜色反推:亮度>128用深色背景,否则用浅色背景
- 两个 PPT 都正确识别背景色
2026-07-24 16:40:50 +08:00
李进 a2c7f23107 refactor: 通用化 slide 识别和游离节点收集
- findSlides(): 不靠命名,靠结构识别(面积/children/已知模式)
- collectOrphans(): 用 slide 子树 id 集合判断,不靠名字前缀
- 先递归子节点,子节点有 slide 则父节点是容器
- 7月汇报(6 slide) 和 A2A(7 slide) 都正确识别
2026-07-24 16:36:51 +08:00
李进 d079a4b4cc fix: 文本框宽度/阴影/边框/背景/去重 — 通用化前稳定版
- 文本框宽度:contentW 从 slide 子节点推算,排除游离节点
- TEXT 宽度:顶层用 contentW,嵌套用 parentW,最小1.5in,x+w≤slideW
- collectSlideChildren 新增 _depth 参数标记层级
- boxShadow 正确传给 pptxgenjs(之前 addShape 只传了 fill)
- 单边 border 不加 shape line,由四周边框线逻辑单独处理
- shape 默认 line: { type: 'none' } 去掉 pptxgenjs 默认边框
- 背景色:从 slide name 推断 dark/light 兜底
- findSlides 支持 'slide ' 前缀
- collectOrphans 跳过 'slide ' 子树(修复文字重复)
- 新增 docs/ 目录:映射分析和通用架构文档
2026-07-24 16:30:24 +08:00
李进 56daab6b67 fix: frame before text for proper z-order, remove 1.2x width multiplier 2026-07-24 14:05:14 +08:00
李进 8802b00bdc feat: complete web-to-pixso JSON mapping - border sides, image assets, orphan nodes, slide container borders 2026-07-24 13:22:28 +08:00
李进 7735bb75de feat: extract all 4 border sides, border-radius, box-shadow from web-to-pixso nodes 2026-07-24 12:33:33 +08:00
李进 46ecb17956 fix: traverse all nodes, use slide container size for canvas, extract slide bg color 2026-07-24 10:07:00 +08:00
oldliandClaude Sonnet 5 eec8c8c215 feat: add web-to-pixpo JSON to Schema JSON converter
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 20:03:24 +08:00
李进 cff5b12975 docs: update README and REQUIREMENTS to reflect current architecture (knowledge base + schema + renderer) 2026-07-23 19:07:47 +08:00
李进 37839c1e86 clean: remove experimental scripts, keep only knowledge base + schema + renderer 2026-07-23 19:04:31 +08:00
oldliandClaude Sonnet 5 0d05e9f0a8 feat: add advanced UI dashboard schema example with fine-grained style params
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 14:56:39 +08:00
oldliandClaude Sonnet 5 15575b37d6 feat: add data dashboard ui schema example
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 14:49:15 +08:00
oldliandClaude Sonnet 5 ec7a44d6fb 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>
2026-07-23 13:10:01 +08:00
oldliandClaude Sonnet 5 c1a9c2fcda feat: add presentation JSON Schema with basic and full examples
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 12:37:09 +08:00
oldliandClaude Sonnet 5 17d232dcef feat: add reference docs for shape, table, image, chart, slide, master, output, coordinate
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 12:36:09 +08:00
oldliandClaude Sonnet 5 768ac12740 feat: add pptxgenjs translation engine (mechanical mapping)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 12:34:45 +08:00
李进 ba8d17ba62 add: pptxgenjs v4.0.1 full API reference 2026-07-23 12:00:19 +08:00
oldliandClaude Sonnet 5 355b01b9dc PM: html2pptx v4 - add .imported-theme-root slide detection
DashiAI real HTML uses .imported-theme-root > .slide.imported-theme-slide,
not .ppt-deck > .ppt-slide. Added as first priority selector,
. ppt-deck kept as fallback for backward compatibility.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 11:27:38 +08:00
oldliandClaude Sonnet 5 0f8a797b7a PM: html2pptx v3 - add rich text preservation + PPTX adapt
- extractRuns(): recursive DOM walker to extract inline formatting
  (bold, italic, color, fontSize, fontFamily) from strong/em/span
- Element data now includes 'runs' array alongside flat text
- PPTX generation: rich text uses pptxgenjs run array format,
  plain text keeps original single-style logic
- Added bounds constraints to prevent textbox overflow
- Verified: 14 slides from dashi-deck, 10 from simple,
  54 rich text elements detected

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 20:20:22 +08:00
oldliandClaude Sonnet 5 ca1e4dfa72 PM: html2pptx v3 - fix slide detection to direct children only
- deck.querySelectorAll('.ppt-slide') -> deck.querySelectorAll(':scope > .ppt-slide')
  prevents nested .ppt-slide elements from being counted as separate slides
- Enhanced visibility filter: check opacity, display, visibility in addition to rect size
- Tested: dashi-deck.html now returns 14 slides (was 20), simple.html returns 10

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 20:17:39 +08:00
oldli 34d0460130 fix: 修复slide分割/文字聚合/字号计算三个缺陷 2026-07-22 19:29:02 +08:00
oldliandClaude Sonnet 5 dc1320aada feat: core html2pptx implementation
Rewrite with element-based DOM extraction (replacing TreeWalker text node
approach), proper CSS-to-PPTX attribute mapping, robust CLI flag parsing
(-o/-p), auto port selection, 30s timeout guard, and graceful cleanup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 18:46:35 +08:00
oldli d2bc6b3623 chore: init deps and test fixture 2026-07-22 18:03:49 +08:00
李进 39ef403842 add: requirements doc for HTML-to-PPTX export engine 2026-07-22 17:54:46 +08:00
李进 9744adbd52 init: html2pptx project scaffold + requirements doc 2026-07-22 17:54:42 +08:00