@opentui/core
Advanced tools
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
+9
-9
@@ -7,3 +7,3 @@ { | ||
| "type": "module", | ||
| "version": "0.5.7", | ||
| "version": "0.5.8", | ||
| "description": "OpenTUI is a TypeScript library on a native Zig core for building terminal user interfaces (TUIs)", | ||
@@ -79,11 +79,11 @@ "license": "MIT", | ||
| "optionalDependencies": { | ||
| "@opentui/core-darwin-x64": "0.5.7", | ||
| "@opentui/core-darwin-arm64": "0.5.7", | ||
| "@opentui/core-linux-x64": "0.5.7", | ||
| "@opentui/core-linux-arm64": "0.5.7", | ||
| "@opentui/core-win32-x64": "0.5.7", | ||
| "@opentui/core-win32-arm64": "0.5.7", | ||
| "@opentui/core-linux-x64-musl": "0.5.7", | ||
| "@opentui/core-linux-arm64-musl": "0.5.7" | ||
| "@opentui/core-darwin-x64": "0.5.8", | ||
| "@opentui/core-darwin-arm64": "0.5.8", | ||
| "@opentui/core-linux-x64": "0.5.8", | ||
| "@opentui/core-linux-arm64": "0.5.8", | ||
| "@opentui/core-win32-x64": "0.5.8", | ||
| "@opentui/core-win32-arm64": "0.5.8", | ||
| "@opentui/core-linux-x64-musl": "0.5.8", | ||
| "@opentui/core-linux-arm64-musl": "0.5.8" | ||
| } | ||
| } |
+44
-37
@@ -1,63 +0,70 @@ | ||
| # OpenTUI Core | ||
| <!-- Keep the project introduction aligned with the repository README and opentui.com. --> | ||
| OpenTUI is a native terminal UI core written in Zig with TypeScript bindings. The native core exposes a C ABI and can be used from any language. OpenTUI powers OpenCode in production today and will also power terminal.shop. It is an extensible core with a focus on correctness, stability, and high performance. It provides a component-based architecture with flexible layout capabilities, allowing you to create complex terminal applications. | ||
| <p align="center"> | ||
| <a href="https://opentui.com"> | ||
| <img alt="OpenTUI logo" src="https://opentui.com/opentui-logo-auto.svg" width="270" /> | ||
| </a> | ||
| </p> | ||
| ## Documentation | ||
| <div align="center"> | ||
| <a href="https://www.npmjs.com/package/@opentui/core"><img alt="npm version" src="https://img.shields.io/npm/v/@opentui/core?style=flat-square" /></a> | ||
| <a href="https://github.com/anomalyco/opentui/actions/workflows/build-core.yml"><img alt="Core build status" src="https://img.shields.io/github/actions/workflow/status/anomalyco/opentui/build-core.yml?style=flat-square&branch=main" /></a> | ||
| </div> | ||
| - [Getting Started](https://opentui.com/docs/getting-started) - API and usage guide | ||
| - [Development Guide](docs/development.md) - Building, testing, and contributing | ||
| - [Tree-Sitter](https://opentui.com/docs/reference/tree-sitter) - Syntax highlighting integration | ||
| - [Renderables](https://opentui.com/docs/core-concepts/renderables) - Understanding the component model | ||
| - [Environment Variables](https://opentui.com/docs/reference/env-vars) - Configuration options | ||
| OpenTUI is a library to build terminal user interfaces. | ||
| ## Install | ||
| - It is written in Zig. | ||
| - You write TypeScript directly or through React and Solid. | ||
| - You arrange boxes and text with flexbox. | ||
| - You add selects, inputs, and scroll boxes with keyboard and mouse controls. | ||
| - You can play sounds, show images, and render 3D graphics. | ||
| ```bash | ||
| bun install @opentui/core | ||
| ``` | ||
| OpenCode uses OpenTUI in production for millions of users. | ||
| ## Build | ||
| [Website](https://opentui.com) | [Documentation](https://opentui.com/docs) | [Packages](https://opentui.com/packages) | ||
| ```bash | ||
| bun run build | ||
| ``` | ||
| ## OpenTUI Core | ||
| This creates platform-specific libraries that are automatically loaded by the TypeScript layer. | ||
| `@opentui/core` supplies the renderer and TypeScript API. You use imperative renderables and events directly. The | ||
| TypeScript packages call native Zig through an internal foreign function interface (FFI) boundary. | ||
| ## Examples | ||
| ```typescript | ||
| import { TextRenderable, createCliRenderer } from "@opentui/core" | ||
| ```bash | ||
| bun install | ||
| cd ../examples | ||
| bun run dev | ||
| const renderer = await createCliRenderer({ exitOnCtrlC: true }) | ||
| renderer.root.add(new TextRenderable(renderer, { content: "Hello, OpenTUI!" })) | ||
| ``` | ||
| ## Benchmarks | ||
| `exitOnCtrlC: true` calls `renderer.destroy()` when the user presses Ctrl+C. The code that creates the renderer must | ||
| call `renderer.destroy()` on every other shutdown path. | ||
| Run native performance benchmarks: | ||
| Install the package: | ||
| ```bash | ||
| bun run bench:native | ||
| bun add @opentui/core | ||
| ``` | ||
| See [the native benchmark runner](../native/src/bench.zig) for options such as `--filter` and `--mem`. | ||
| Then build your first app with the [quickstart](https://opentui.com/docs/getting-started/quickstart). | ||
| NativeSpanFeed TypeScript benchmarks: | ||
| ## Runtime and platform support | ||
| - [src/benchmark/native-span-feed-benchmark.md](src/benchmark/native-span-feed-benchmark.md) | ||
| `@opentui/core` runs on Bun 1.3.0 or later, or on Node.js 26.4.0 or later with ECMAScript modules (ESM) and | ||
| `--experimental-ffi`. | ||
| ## CLI Renderer | ||
| The native ABI and the generated platform packages, such as `@opentui/core-linux-x64`, are internal distribution | ||
| surfaces, not application APIs. | ||
| ### Renderables | ||
| ## AI agent skill | ||
| Renderables are hierarchical objects that can be positioned, nested, styled and rendered to the terminal: | ||
| Install the OpenTUI documentation as a skill for your AI coding assistant with [`npx skills`](https://skills.sh): | ||
| ```typescript | ||
| import { createCliRenderer, TextRenderable } from "@opentui/core" | ||
| ```bash | ||
| npx skills add anomalyco/opentui --skill opentui | ||
| ``` | ||
| const renderer = await createCliRenderer() | ||
| Add `-g` to install the skill globally. | ||
| const obj = new TextRenderable(renderer, { id: "my-obj", content: "Hello, world!" }) | ||
| ## License | ||
| renderer.root.add(obj) | ||
| ``` | ||
| OpenTUI is licensed under the [MIT License](https://github.com/anomalyco/opentui/blob/main/LICENSE). |
+2
-2
@@ -5,7 +5,7 @@ // @bun | ||
| CliRenderer | ||
| } from "./chunk-bun-z4gs6jzg.js"; | ||
| } from "./chunk-bun-b3exa82d.js"; | ||
| import { | ||
| SystemClock, | ||
| TreeSitterClient | ||
| } from "./chunk-bun-xmsp0nqq.js"; | ||
| } from "./chunk-bun-2956gvaq.js"; | ||
@@ -12,0 +12,0 @@ // src/testing/mock-keys.ts |
+2
-2
| import { | ||
| ANSI, | ||
| CliRenderer | ||
| } from "./chunk-node-591ssncm.js"; | ||
| } from "./chunk-node-kr27pp2p.js"; | ||
| import { | ||
| SystemClock, | ||
| TreeSitterClient | ||
| } from "./chunk-node-267dafd8.js"; | ||
| } from "./chunk-node-mfda59vq.js"; | ||
@@ -10,0 +10,0 @@ // src/testing/mock-keys.ts |
+1
-1
@@ -54,3 +54,3 @@ import type { RGBA } from "./lib/RGBA.js"; | ||
| } | ||
| export type WidthMethod = "wcwidth" | "unicode"; | ||
| export type WidthMethod = "wcwidth" | "unicode" | "unicode-wide"; | ||
| export type TerminalMultiplexer = "none" | "tmux" | "zellij" | "screen" | "unknown"; | ||
@@ -57,0 +57,0 @@ export type TerminalCapabilityState = "unknown" | "supported" | "unsupported"; |
+1
-1
@@ -96,3 +96,3 @@ // @bun | ||
| yoga_default | ||
| } from "./chunk-bun-xmsp0nqq.js"; | ||
| } from "./chunk-bun-2956gvaq.js"; | ||
| export { | ||
@@ -99,0 +99,0 @@ yoga_default as default, |
+1
-1
@@ -95,3 +95,3 @@ import { | ||
| yoga_default | ||
| } from "./chunk-node-267dafd8.js"; | ||
| } from "./chunk-node-mfda59vq.js"; | ||
| export { | ||
@@ -98,0 +98,0 @@ yoga_default as default, |
+1
-0
@@ -41,2 +41,3 @@ import { type Pointer } from "./platform/ffi.js"; | ||
| unicode: number; | ||
| "unicode-wide": number; | ||
| }>], readonly ["sgr_pixels", "bool_u8"], readonly ["color_scheme_updates", "bool_u8"], readonly ["explicit_width", "bool_u8"], readonly ["scaled_text", "bool_u8"], readonly ["sixel", "bool_u8"], readonly ["focus_tracking", "bool_u8"], readonly ["sync", "bool_u8"], readonly ["bracketed_paste", "bool_u8"], readonly ["hyperlinks", "bool_u8"], readonly ["osc52", "bool_u8"], readonly ["notifications", "bool_u8"], readonly ["explicit_cursor_positioning", "bool_u8"], readonly ["remote", "bool_u8"], readonly ["multiplexer", import("bun-ffi-structs").EnumDef<{ | ||
@@ -43,0 +44,0 @@ none: number; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
13500123
0.02%106648
0.02%71
10.94%