@bettertui/core
v0.1.1
Published
High-performance terminal UI framework powered by a Rust engine - framework-agnostic core (CommandBuffer, Runtime, tree reconciliation)
Maintainers
Readme
@bettertui/core
Website: bettertui.dev | Docs: bettertui.dev/docs | npm: npmjs.com/package/@bettertui/core
Framework-agnostic command protocol, tree manipulation, reconciler wrapper, and runtime. Framework package for vanilla / native TypeScript. No React dependency.
Overview
@bettertui/core is the public entry point for building terminal UIs without React. It provides:
- Command protocol — typed
Commandunion andCommandBufferfor batching - Reconciler —
createReconciler(buffer)wraps tree ops with command emission - Runtime —
CommandRuntimeowns the buffer, frame loop, and subscriber dispatch - Native bridge — loads
bettertui_engine.nodeaddon, exposes engine factories - DevTools — in-core debug tooling (
createDevTools, debug overlay) - Testing utilities —
createTestRenderer,createMockKeys, mock streams, spies - Keymap — framework-agnostic input binding engine
- Widgets — TypeScript widget option types
- Validation —
validate,warnIfInvalid, layout/style validation
Installation
npm install @bettertui/coreRequires building the native Rust addon for native bridge features:
pnpm --filter @bettertui/core build:nativeQuick start
import { createEngine, detectCapabilities, CliRenderer } from "@bettertui/core";
const engine = createEngine();
const caps = detectCapabilities();Re-exports
Re-exports all types from @bettertui/shared (internal — don't install separately).
Features
- Framework-agnostic (no React dependency)
- Native Rust engine via napi-rs FFI
- Command-batched rendering (one FFI call per frame)
- In-core DevTools with debug overlay
- Testing utilities for headless rendering
- Keymap with layered bindings, chord sequences, and modes
