@bettertui/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +57 -0
- package/bettertui_engine.node +0 -0
- package/index.d.mts +4541 -0
- package/index.d.ts +461 -0
- package/index.mjs +15737 -0
- package/index.mjs.map +1 -0
- package/package.json +51 -0
- package/rolldown-runtime-BmKbMBvF.mjs +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Localfirstai Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @bettertui/core
|
|
2
|
+
|
|
3
|
+
**Framework-agnostic command protocol, tree manipulation, reconciler wrapper, and runtime.** Framework package for vanilla / native TypeScript. No React dependency.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`@bettertui/core` is the public entry point for building terminal UIs without React. It provides:
|
|
8
|
+
|
|
9
|
+
- **Command protocol** — typed `Command` union and `CommandBuffer` for batching
|
|
10
|
+
- **Reconciler** — `createReconciler(buffer)` wraps tree ops with command emission
|
|
11
|
+
- **Runtime** — `CommandRuntime` owns the buffer, frame loop, and subscriber dispatch
|
|
12
|
+
- **Native bridge** — loads `bettertui_engine.node` addon, exposes engine factories
|
|
13
|
+
- **DevTools** — in-core debug tooling (`createDevTools`, debug overlay)
|
|
14
|
+
- **Testing utilities** — `createTestRenderer`, `createMockKeys`, mock streams, spies
|
|
15
|
+
- **Keymap** — framework-agnostic input binding engine
|
|
16
|
+
- **Widgets** — TypeScript widget option types
|
|
17
|
+
- **Validation** — `validate`, `warnIfInvalid`, layout/style validation
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @bettertui/core
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Requires building the native Rust addon for native bridge features:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm --filter @bettertui/core build:native
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick start
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { createEngine, detectCapabilities, CliRenderer } from "@bettertui/core";
|
|
35
|
+
|
|
36
|
+
const engine = createEngine();
|
|
37
|
+
const caps = detectCapabilities();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Re-exports
|
|
41
|
+
|
|
42
|
+
Re-exports all types from `@bettertui/shared` (internal — don't install separately).
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
- Framework-agnostic (no React dependency)
|
|
47
|
+
- Native Rust engine via napi-rs FFI
|
|
48
|
+
- Command-batched rendering (one FFI call per frame)
|
|
49
|
+
- In-core DevTools with debug overlay
|
|
50
|
+
- Testing utilities for headless rendering
|
|
51
|
+
- Keymap with layered bindings, chord sequences, and modes
|
|
52
|
+
|
|
53
|
+
## Related Documentation
|
|
54
|
+
|
|
55
|
+
- [Architecture overview](../../docs/architecture/overview.md)
|
|
56
|
+
- [API reference](../../docs/api/packages/core.md)
|
|
57
|
+
- [Guides](../../docs/guides/getting-started.md)
|
|
Binary file
|