Files
mindfulness/spec_kit/Text Wrap/modules/integration/spec.md
2026-02-10 11:39:33 +08:00

53 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# integration子模块规范
## 子模块名称
integrationHome / Widget 接入)
## 目标描述
`wrapText()` 模块以一致参数口径接入到两端渲染链路中,并定义 UI 侧对 meta 的处理规则,确保:
- Home 与 Widget 使用同一套配置/词库/版本号(`configVersion`
- 同场景下输出一致;不同测量能力导致差异时“可解释且可治理”
- SYSTEM_DEFAULT 的语义不被 UI 误用
## 输入/输出定义
### 输入
- HomeAPP侧输入
- `text/lang/availableWidth/maxLines/fontSpec/context='APP'`
- 可选:`constraints/overflowMode/lineMode/configVersion/debug`
- WidgetWIDGET侧输入
- `text/lang/availableWidth(profile)/maxLines/context='WIDGET'`
- 可选:`constraints/overflowMode/configVersion/debug`
### 输出
- UI 渲染消费:
- `lines[]`:逐行渲染或插入 `\n`
- `wrappedText`:用于一次性渲染或日志/缓存
- `meta`:用于调试、打点、兜底策略选择
## 验收标准(可验证)
- **参数映射一致**
- 两端对 `lang/context/availableWidth/maxLines/overflowMode/lineMode` 的默认值与映射一致
- `configVersion` 必须随结果一起回传到 meta 或打点
- **UI 兜底语义正确**
-`meta.fallback_type=SYSTEM_DEFAULT` 时:
- UI 允许选择“交给系统排版”(例如不插入 `\n` 或忽略 `lines[]`
- 但不改变算法层返回值
- **缓存与复用**
- Home 可对同文案同参数缓存 `wrappedText/lines/breaks`
- Widget 可对固定 profile 文案缓存结果(避免频繁计算)
- **回归可对齐**
- Golden Cases 在 Home 与 Widget固定 profile下可跑通并对齐预期
## 依赖与关联
- **依赖**:全部核心模块(`core-contract``breakpoint-candidates``search-engine-*``scoring-tiebreak``overflow-fallback``golden-tests`
- **被依赖**:无(最终落地层)