gridland
API Reference

@gridland/web

Core package API reference

TUI

The main mounting component. See TUI for full documentation.

Import
import { TUI } from "@gridland/web"

Vite Plugin

Import
import { gridlandWebPlugin } from "@gridland/web/vite-plugin"

gridlandWebPlugin()

Returns an array of Vite plugins that configure module resolution for the opentui engine. Resolves @opentui/core, @opentui/react, and @opentui/ui from peer dependencies.

Hooks

Portable hooks (useKeyboard, useTerminalDimensions) live in @gridland/utils.

Browser-only hooks

Import
import { useFileDrop, usePaste, useBrowserContext } from "@gridland/web"

Internal Modules

These modules are used internally by TUI and are not part of the public API. They may change without notice between releases.

BrowserBuffer

In-memory cell grid that stores character, foreground, background, and attribute data for each cell position.

BrowserRenderContext

Implements the RenderContext interface for the browser environment. Manages the buffer, layout, painting, and input handling.

CanvasPainter

Draws the cell grid to an HTML5 Canvas context. Handles font measurement, glyph caching, and efficient dirty-region repainting.

BrowserTextBuffer / BrowserTextBufferView

Browser-safe replacements for the native text buffer modules. Provide line-based text storage and viewport windowing.

BrowserSyntaxStyle

Stub replacement for the native syntax highlighting module. Returns no highlighting in the browser (syntax highlighting requires tree-sitter).

SelectionManager

Handles text selection on the canvas. Tracks selection start/end positions and provides methods to get selected text.