fix(runtime): keep text-measure helpers internal, matching Ink (#68)

Ink keeps its `measure-text` module internal and never re-exports it. vue-tui
exported `measureText` / `measureTextNatural` from the public index under the
mistaken belief — stated verbatim in commit 0e7d775's own message — that doing
so "matched Ink's public API". It does not; Ink keeps that module internal. A
later design doc then rationalized the leak post-hoc as an intentional
divergence. It was neither intentional nor a divergence — it was a mistake.

Align with Ink:
- Drop both from the public index. `measureTextNatural` stays as an internal
  helper (yoga.ts uses it). `measureText` had zero production callers (yoga uses
  `wrapText` + `measureTextNatural`, never `measureText`) and is removed.
- Integration tests that used `measureText(stripAnsi(x), 9999).width` as a
  line-width helper now use `stringWidth(stripAnsi(x))` directly.
- public-api.test.ts gains a regression test asserting neither is exported.
- Remove the now-obsolete entry from .agents/docs/ink-divergences.md.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-05-30 18:53:34 +08:00
committed by GitHub
parent 936f2ee1ee
commit 688da13872
7 changed files with 21 additions and 26 deletions
-6
View File
@@ -40,12 +40,6 @@ deliberate. Divergences fall into a few kinds:
- **Why:** intentionally minimal, single-purpose composables. `waitUntilRenderFlush` is
deliberately **not** exposed.
### Exported text-measurement helpers
- **Ink:** does not export its internal `measure-text` module.
- **vue-tui:** exports `measureText` / `measureTextNatural` from the public index.
- **Why:** a deliberately public utility surface for consumers who need to size text.
### No named type / prop re-exports
- **Ink:** re-exports `BoxProps`, `TextProps`, `StaticProps`, `TransformProps`,