64 lines
2.2 KiB
Markdown
64 lines
2.2 KiB
Markdown
# integration(任务清单)
|
||
|
||
> 目标:实现 `wrapText()` 统一入口并串联所有子模块,供 Home/Widget 使用。
|
||
|
||
## 0. 对齐与准备
|
||
|
||
- [x] 阅读并对齐口径
|
||
- [x] 阅读 `spec_kit/Text Wrap/modules/integration/spec.md`
|
||
- [x] 阅读 `spec_kit/Text Wrap/modules/integration/plan.md`
|
||
- [x] 阅读 `spec_kit/Text Wrap/spec.md` 的对外接口定义
|
||
|
||
## 1. 对外类型定义
|
||
|
||
- [x] 新建 `client/src/features/textWrap/types.ts`
|
||
- [x] 定义 `WrapTextInput`(与大 spec 对齐)
|
||
- [x] 定义 `WrapTextMeta`(包含 configVersion/fallback_type/overflow_type/reason/breaks/scoreTopTerms)
|
||
- [x] 定义 `WrapTextOutput`
|
||
|
||
## 2. 实现 wrapText() 入口
|
||
|
||
- [x] 新建 `client/src/features/textWrap/wrapText.ts`
|
||
- [x] normalizeWhitespace(固定策略 NORMALIZE)
|
||
- [x] tokenize:
|
||
- [x] EN:tokenizeEN
|
||
- [x] TC:segmentGraphemes → Token[]
|
||
- [x] generateBreakpoints(接入 forbiddenBreakRanges)
|
||
- [x] 组装 scoring 的 lexicons:
|
||
- [x] protectedPhrases 来自 constraints.protectedPhrases(若有)
|
||
- [x] 搜索:
|
||
- [x] APP:searchBestLayoutApp(测量 mockable;fontSpec 缺字段报错由 width-measurement 保证)
|
||
- [x] WIDGET:searchBestLayoutWidget(默认 APPROX;可选 MEASURE)
|
||
- [x] 搜索失败/未覆盖 N:
|
||
- [x] 调用 applyOverflowFallback(overflowMode 默认:APP=CLIP,WIDGET=ELLIPSIS)
|
||
- [x] 汇总输出 meta:
|
||
- [x] configVersion
|
||
- [x] breaks(若可得)
|
||
- [x] scoreTopTerms(debug=true)
|
||
- [x] fallback_type/overflow_type/reason
|
||
|
||
## 3. 导出
|
||
|
||
- [x] 新建 `client/src/features/textWrap/index.ts`
|
||
- [x] 导出 types 与 `wrapText`
|
||
|
||
## 4. 调整 Golden Tests 入口
|
||
|
||
- [x] 将 `client/src/features/textWrap/golden/__tests__/golden.test.ts` 从测试 harness 切换为 `wrapText()`
|
||
- [x] 保持现有 fixtures 期望不变
|
||
|
||
## 5. 单测补充(最小)
|
||
|
||
- [x] 新建 `client/src/features/textWrap/__tests__/wrapText.integration.test.ts`
|
||
- [x] SYSTEM_DEFAULT:meta.fallback_type=SYSTEM_DEFAULT 且仍返回 lines/wrappedText
|
||
|
||
## 6. 收尾
|
||
|
||
- [x] `npm test`
|
||
- [x] `npx tsc --noEmit`
|
||
- [x] 将本 `tasks.md` 全部勾选完成
|
||
- [x] 更新 `spec_kit/overview.md`
|
||
- [x] 标记 `integration` 已完成(阶段性)
|
||
- [x] 写入变更文件清单
|
||
|