refactor(runtime)!: rename useAppContext() to useApp() (full Ink alignment) (#73)
#69 added `useAppContext()` as a Vue-native rename of Ink's `useApp()`, qualified to avoid reading as the Vue application instance. On reflection the "Context" suffix borrowed the name of an internal grab-bag context and slightly mislabels the hook — it returns app lifecycle controls, not that context. The collision worry doesn't hold up: Vue has no `useApp()`, the returned `{ exit, waitUntilRenderFlush }` is clearly not the Vue app instance, and "App" in vue-tui already means the `TuiApp` from `createApp()`. Rename to `useApp()` for full Ink fidelity (same name + same shape), and drop the now-defunct "App composable" entry from ink-divergences.md — it ceases to be a divergence. Internal context cleanup (the grab-bag `AppContext` + the `StdinContext` duplication) is intentionally out of scope here, tracked separately. BREAKING CHANGE: `useAppContext()` is renamed to `useApp()`. Replace `const { exit } = useAppContext()` with `const { exit } = useApp()`. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -31,16 +31,6 @@ deliberate. Divergences fall into a few kinds:
|
||||
- **Why:** mirrors Vue's own `createApp` mental model — a Vue developer expects an app
|
||||
object they mount, not a one-shot render call.
|
||||
|
||||
### App composable — `useAppContext()` instead of `useApp()`
|
||||
|
||||
- **Ink:** `useApp()` returns `{ exit, waitUntilRenderFlush }` — stdin/stdout/stderr are
|
||||
separate hooks (`useStdin`/`useStdout`/`useStderr`), not part of it.
|
||||
- **vue-tui:** `useAppContext()` returns the same `{ exit, waitUntilRenderFlush }`, with
|
||||
streams on those same peer composables.
|
||||
- **Why:** only the name differs — `useApp` reads as "the Vue application instance"
|
||||
(`createApp`, `app.mount`), so vue-tui qualifies it as `useAppContext`. The shape is
|
||||
identical to Ink; a naming divergence, not a surface one.
|
||||
|
||||
### Named type / prop re-exports
|
||||
|
||||
- **Ink:** re-exports its component prop types plus a few data/handle types:
|
||||
|
||||
Reference in New Issue
Block a user