@coding01/docsjs 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,9 +6,16 @@ Import Word/WPS/Google Docs content from paste or `.docx` while preserving struc
6
6
  [![npm version](https://img.shields.io/npm/v/@coding01/docsjs)](https://www.npmjs.com/package/@coding01/docsjs)
7
7
  [![npm downloads](https://img.shields.io/npm/dm/@coding01/docsjs)](https://www.npmjs.com/package/@coding01/docsjs)
8
8
  [![CI](https://github.com/fanly/docsjs/actions/workflows/ci.yml/badge.svg)](https://github.com/fanly/docsjs/actions/workflows/ci.yml)
9
+ [![Pages](https://github.com/fanly/docsjs/actions/workflows/pages.yml/badge.svg)](https://github.com/fanly/docsjs/actions/workflows/pages.yml)
9
10
 
10
11
  [中文文档](./README.zh-CN.md)
11
12
 
13
+ ## GitHub Pages
14
+
15
+ - Product page: [https://docsjs.coding01.cn/](https://docsjs.coding01.cn/)
16
+ - Source: `docs/index.html`
17
+ - Deploy workflow: `.github/workflows/pages.yml`
18
+
12
19
  ## What You Get
13
20
 
14
21
  - Web Component core: `docs-word-editor`
@@ -74,7 +81,7 @@ el.addEventListener("docsjs-change", (e) => {
74
81
  ### Events
75
82
 
76
83
  - `docsjs-change`
77
- - payload: `{ htmlSnapshot: string; source: "paste" | "upload" | "api" | "clear"; fileName?: string }`
84
+ - payload: `{ htmlSnapshot: string; source: "paste" | "upload" | "api" | "clear"; fileName?: string; parseReport?: DocxParseReport }`
78
85
  - `docsjs-error`
79
86
  - payload: `{ message: string }`
80
87
  - `docsjs-ready`
@@ -95,34 +102,49 @@ el.addEventListener("docsjs-change", (e) => {
95
102
 
96
103
  ## Feature Checklist
97
104
 
105
+ <!-- GENERATED:FEATURE_CHECKLIST_EN:START -->
106
+ ### Core
107
+
98
108
  - ✅ Web Component core (`docs-word-editor`)
99
- - ✅ React adapter (`@coding01/docsjs/react`)
100
- - ✅ Vue adapter (`@coding01/docsjs/vue`)
101
- - ✅ Paste import (`text/html`, `text/plain`)
102
- - ✅ Clipboard image hydration (`file:/blob:/cid:/mhtml:` to data URL)
103
- - `.docx` upload and parse
104
- - ✅ Basic paragraph semantics (alignment, headings, line break)
105
- - ✅ Basic run styles (bold/italic/underline/strike/color/highlight/super/sub)
106
- - ✅ List reconstruction (`numId` + `ilvl` + `lvlText`)
107
- - ✅ Basic table structure (`table/tr/td`)
108
- - ✅ Table merge + nested table read-only fidelity (`vMerge/gridSpan`)
109
- - ✅ Table width mapping (`tblGrid/gridCol`, `tcW`)
110
- - Embedded image relationship mapping (`rId -> media`)
111
- - ✅ Page geometry mapping (page height, margins, content width)
112
- - ✅ Runtime render fixes (`mso-*` compatibility, pagination spacer, empty paragraph normalization)
113
- - ✅ Events and public methods
114
- - ✅ React and Vue runnable demos
115
- - npm publish workflow with OIDC trusted publishing
116
- - ✅ Footnotes / endnotes / comments / track changes read-only semantics
117
- - Comment range markers (`commentRangeStart/commentRangeEnd`)
118
- - ✅ Revision metadata markers (`id/author/date`)
119
- - ✅ Floating anchors (`wp:anchor`) v1 fidelity (position ref / overlap / layer / wrap distance markers)
120
- - ✅ Word table v1 fidelity (border model / cell spacing / table-layout mapping)
121
- - ✅ OMML / charts / SmartArt semantic fallback rendering (v1)
122
- - ✅ Automated fidelity benchmark v1 (golden corpus + CI trend artifacts)
123
- - ⏳ Floating anchor text-wrap collision fidelity (pixel-level)
124
- - Word table auto layout parity with desktop Word
125
- - ⏳ OMML high-fidelity renderer (MathML/KaTeX pipeline)
109
+ - ✅ React adapter + Vue adapter
110
+ - ✅ Events and imperative public API
111
+ - ✅ Strict-only parser strategy
112
+
113
+ ### Import Pipeline
114
+
115
+ - ✅ Clipboard import (`text/html`, `text/plain`)
116
+ - ✅ `.docx` upload + relationship media mapping
117
+ - ✅ Clipboard image hydration (`file:/blob:/cid:`)
118
+ - ✅ Output as stable HTML snapshot
119
+
120
+ ### Layout Fidelity
121
+
122
+ - ✅ List reconstruction (`numId`, `ilvl`, `lvlText`)
123
+ - ✅ Table v1 (`tblGrid/tcW`, merge, border, spacing)
124
+ - ✅ Floating anchors v1 (`wp:anchor` metadata)
125
+ - Anchor collision parity (pixel-level wrap)
126
+
127
+ ### Advanced Semantics
128
+
129
+ - ✅ Footnotes / endnotes / comments
130
+ - ✅ Revision markers (`ins` / `del`) + metadata
131
+ - ✅ Page break semantic markers
132
+ - ✅ DOCX hyperlink relationship + anchor mapping
133
+
134
+ ### Semantic Fallback
135
+
136
+ - ✅ OMML fallback output
137
+ - ✅ Chart semantic extraction fallback
138
+ - ✅ SmartArt node fallback extraction
139
+ - ⏳ OMML high-fidelity render pipeline (MathML/KaTeX)
140
+
141
+ ### Engineering Quality
142
+
143
+ - ✅ 50 automated tests (regression + boundary)
144
+ - ✅ Baseline snapshot regression framework
145
+ - ✅ `verify` quality gate (lint/typecheck/test/build/size)
146
+ - ✅ Parse report API for performance tuning
147
+ <!-- GENERATED:FEATURE_CHECKLIST_EN:END -->
126
148
 
127
149
  ## What's New in v0.1.3
128
150
 
@@ -166,6 +188,13 @@ npm run build
166
188
  npm run benchmark:fidelity
167
189
  ```
168
190
 
191
+ ## Engineering Modes
192
+
193
+ - Spec and conventions: [ENGINEERING_MODES.md](./ENGINEERING_MODES.md)
194
+ - Parse API now supports:
195
+ - `parseDocxToHtmlSnapshot(file)`
196
+ - `parseDocxToHtmlSnapshotWithReport(file)`
197
+
169
198
  ## Demos
170
199
 
171
200
  ### React demo
package/README.zh-CN.md CHANGED
@@ -6,9 +6,16 @@
6
6
  [![npm version](https://img.shields.io/npm/v/@coding01/docsjs)](https://www.npmjs.com/package/@coding01/docsjs)
7
7
  [![npm downloads](https://img.shields.io/npm/dm/@coding01/docsjs)](https://www.npmjs.com/package/@coding01/docsjs)
8
8
  [![CI](https://github.com/fanly/docsjs/actions/workflows/ci.yml/badge.svg)](https://github.com/fanly/docsjs/actions/workflows/ci.yml)
9
+ [![Pages](https://github.com/fanly/docsjs/actions/workflows/pages.yml/badge.svg)](https://github.com/fanly/docsjs/actions/workflows/pages.yml)
9
10
 
10
11
  [English README](./README.md)
11
12
 
13
+ ## GitHub Pages
14
+
15
+ - 产品单页: [https://docsjs.coding01.cn/](https://docsjs.coding01.cn/)
16
+ - 页面源码: `docs/index.html`
17
+ - 自动部署: `.github/workflows/pages.yml`
18
+
12
19
  ## 核心能力
13
20
 
14
21
  - Web Component 内核:`docs-word-editor`
@@ -90,34 +97,49 @@ document.body.appendChild(el);
90
97
 
91
98
  ## 功能清单
92
99
 
100
+ <!-- GENERATED:FEATURE_CHECKLIST_ZH:START -->
101
+ ### 核心
102
+
93
103
  - ✅ Web Component 内核(`docs-word-editor`)
94
- - ✅ React 适配(`@coding01/docsjs/react`)
95
- - ✅ Vue 适配(`@coding01/docsjs/vue`)
96
- - ✅ 粘贴导入(`text/html`、`text/plain`)
97
- - ✅ 剪贴板不稳定图片源替换(`file:/blob:/cid:/mhtml:` -> data URL)
98
- - ✅ `.docx` 上传解析
99
- - ✅ 段落基础语义(对齐、标题映射、换行)
100
- - ✅ Run 基础样式(粗斜体、下划线、删除线、颜色、高亮、上下标)
101
- - ✅ 列表基础恢复(`numId` + `ilvl` + `lvlText`)
102
- - ✅ 表格基础结构(`table/tr/td`)
103
- - ✅ 表格合并与嵌套表格只读保真(`vMerge/gridSpan`)
104
- - ✅ 表格宽度映射(`tblGrid/gridCol`、`tcW`)
105
- - ✅ 图片关系映射(`rId -> media`)
106
- - ✅ 页面几何映射(页高、页边距、版心宽)
107
- - ✅ 运行时渲染修正(`mso-*` 兼容、分页 spacer、空段落修正)
108
- - ✅ 事件与公共 API
109
- - ✅ React/Vue 可运行示例
110
- - npm OIDC 自动发布流水线
111
- - ✅ 批注/脚注/修订只读语义支持
112
- - ✅ 批注区间标记(`commentRangeStart/commentRangeEnd`)
113
- - ✅ 修订元数据标记(`id/author/date`)
114
- - ✅ 浮动锚点对象 v1 保真(定位参照/层级/避让距离/重叠策略标记)
115
- - ✅ Word 表格 v1 保真(边框模型/单元格间距/布局类型映射)
116
- - ✅ OMML/图表/SmartArt 语义降级渲染(v1)
117
- - ✅ 自动化保真评分 v1(golden corpus + CI 趋势产物)
118
- - ⏳ 浮动对象文字绕排碰撞的像素级还原
119
- - ⏳ Word 表格自动布局与桌面 Word 深度一致
120
- - ⏳ OMML 高保真渲染(MathML/KaTeX 渲染链)
104
+ - ✅ React + Vue 适配层
105
+ - ✅ 事件体系与命令式公开 API
106
+ - ✅ 严格模式唯一解析策略
107
+
108
+ ### 导入链路
109
+
110
+ - ✅ 剪贴板导入(`text/html`、`text/plain`)
111
+ - ✅ `.docx` 上传与关系媒体映射
112
+ - ✅ 不稳定图片 URI 修复(`file:/blob:/cid:`)
113
+ - ✅ 输出稳定 HTML Snapshot
114
+
115
+ ### 版式保真
116
+
117
+ - ✅ 列表结构恢复(`numId`、`ilvl`、`lvlText`)
118
+ - ✅ 表格 v1(`tblGrid/tcW`、合并、边框、间距)
119
+ - ✅ 浮动锚点 v1(`wp:anchor` 元数据)
120
+ - 锚点碰撞一致性(像素级绕排)
121
+
122
+ ### 高级语义
123
+
124
+ - ✅ 脚注/尾注/批注
125
+ - ✅ 修订标记(`ins`/`del`)与元数据
126
+ - ✅ 分页语义标记
127
+ - ✅ DOCX 超链接关系与锚点映射
128
+
129
+ ### 语义降级
130
+
131
+ - ✅ OMML 语义降级输出
132
+ - ✅ 图表语义提取降级
133
+ - ✅ SmartArt 节点降级提取
134
+ - ⏳ OMML 高保真渲染链(MathML/KaTeX)
135
+
136
+ ### 工程质量
137
+
138
+ - ✅ 50 条自动化测试(回归 + 边界)
139
+ - ✅ 基准快照回归框架
140
+ - ✅ `verify` 质量门禁(lint/typecheck/test/build/size)
141
+ - ✅ 解析报告 API(性能调优)
142
+ <!-- GENERATED:FEATURE_CHECKLIST_ZH:END -->
121
143
 
122
144
  ## v0.1.3 更新内容
123
145
 
@@ -161,6 +183,13 @@ npm run build
161
183
  npm run benchmark:fidelity
162
184
  ```
163
185
 
186
+ ## 工程模式
187
+
188
+ - 规则说明: [ENGINEERING_MODES.md](./ENGINEERING_MODES.md)
189
+ - 解析 API 支持:
190
+ - `parseDocxToHtmlSnapshot(file)`
191
+ - `parseDocxToHtmlSnapshotWithReport(file)`
192
+
164
193
  ## 演示
165
194
 
166
195
  ### React demo