Skip to content

@jsvision/ui / ApplicationOptions

Interface: ApplicationOptions

Defined in: ui/src/app/application.ts:35

Options for createApplication. Everything is optional — an app starts with no arguments.

Properties

adaptAmbiguousWidth?

optional adaptAmbiguousWidth?: boolean

Defined in: ui/src/app/application.ts:128

On a real terminal, automatically switch to ASCII-safe frame chrome if the startup probe finds the ambiguous-width glyphs render double-width. Default true; pass false to skip the probe.


caps?

optional caps?: "auto" | CapabilityProfile

Defined in: ui/src/app/application.ts:53

Terminal capability profile that drives color-depth encoding for every painted frame. Defaults to 'auto', which detects the running terminal's capabilities via resolveCapabilities(). Pass an explicit profile to override the detection (used verbatim, no re-resolution).


clipboardKeys?

optional clipboardKeys?: ClipboardKeys

Defined in: ui/src/app/application.ts:68

Which clipboard key set the framework binds by default (default 'both' — modern Ctrl+A/C/X/V plus the classic Ctrl+Insert/Shift+Insert/Shift+Delete aliases). Any keymap you supply merges on top and wins on a conflicting chord. Use 'none' to bind no clipboard chords (e.g. an app hosting a WordStar-mode Editor) and supply your own keymap instead.


content?

optional content?: View

Defined in: ui/src/app/application.ts:47

The app body: the single view that fills the middle of the shell (below the menu bar, above the status line). Defaults to a Desktop window manager — the classic overlapping-windows shape. Pass any view (e.g. a router) for a full-screen, non-windowed app; when you do, the app exposes no desktop and does not register the window-management commands.


functionKeyFallback?

optional functionKeyFallback?: FunctionKeyFallback

Defined in: ui/src/app/application.ts:103

Portable F-key fallback for terminals or browsers that reserve physical function keys. Defaults to 'number-row', mapping Alt+1…9,0,-,= to F1–F12. Pass 'none' to preserve those Alt chords literally.


i18n?

readonly optional i18n?: I18n

Defined in: ui/src/app/application.ts:40

Translation service shared by framework-owned UI. The exact supplied instance is exposed on the returned application. Omit it to create an isolated English service for this application.


input?

optional input?: ReadStream

Defined in: ui/src/app/application.ts:116

Input stream to read from; defaults to process.stdin. Inject a fake TTY stream to run headlessly.


keymap?

optional keymap?: Keymap

Defined in: ui/src/app/application.ts:61

Key-chord → command map (from core's createKeymap) applied across the whole app.


logger?

optional logger?: Logger

Defined in: ui/src/app/application.ts:59

Logger that receives errors thrown from a view's draw()/onEvent(); defaults to a no-op logger.


optional menuBar?: MenuBar

Defined in: ui/src/app/application.ts:105

Optional menu bar shown as the top row. Build one with menuBar(...).


output?

optional output?: WriteStream

Defined in: ui/src/app/application.ts:118

Output stream to write to; defaults to process.stdout.


readClipboardText?

readonly optional readClipboardText?: ClipboardTextReader

Defined in: ui/src/app/application.ts:81

Read exact raw text from the host clipboard for otherwise-unhandled paste commands.

The loop serializes calls, bounds successful text, and discards results whose original focus destination is no longer continuously valid.


requireTty?

optional requireTty?: boolean

Defined in: ui/src/app/application.ts:146

Require an interactive TTY at startup. When true (the default), run() asserts the terminal essentials before taking over the screen and throws EssentialsNotMetError when there is no interactive terminal at all — a cron/CI job, a container with no tty, or stdin and stdout both redirected with no controlling terminal — instead of silently starting a keyboard-less app. (Piping output while a controlling terminal exists still works: the host binds /dev/tty.) Set false for headless/automated runs that drive the loop without a real terminal.

Example

ts
import { createApplication } from '@jsvision/ui';
import { resolveCapabilities } from '@jsvision/core';

// A headless integration test drives run() without a terminal:
const caps = resolveCapabilities().profile;
const app = createApplication({ caps, requireTty: false });
const exit = app.run(); // starts against injected streams; no EssentialsNotMetError

revealKey?

optional revealKey?: string | null

Defined in: ui/src/app/application.ts:112

The key that toggles accelerator mode (default 'f12'): while on, every ~X~ hotkey is underlined and a bare letter fires the matching accelerator. Pass null to disable the feature.


runtime?

optional runtime?: RuntimeAdapter

Defined in: ui/src/app/application.ts:114

OS boundary the host runs against; defaults to the real Node runtime. Inject a fake in tests.


statusLine?

optional statusLine?: StatusLine

Defined in: ui/src/app/application.ts:107

Optional status line shown as the bottom row. Build one with statusLine(...).


systemClipboard?

readonly optional systemClipboard?: boolean

Defined in: ui/src/app/application.ts:97

Enable automatic operating-system text clipboard integration when Application.run starts and no custom clipboard callbacks were supplied.

Defaults to true. Pass false when an application must stay isolated from the desktop clipboard; app-local copy/paste, terminal bracketed paste, and capability-gated OSC 52 output remain available.

Example

ts
import { createApplication } from '@jsvision/ui';

const app = createApplication({ systemClipboard: false });

theme?

optional theme?: Theme

Defined in: ui/src/app/application.ts:57

Color/style theme applied to every view; defaults to the built-in defaultTheme.


viewport?

optional viewport?: Size2D

Defined in: ui/src/app/application.ts:55

Initial viewport size in cells. Defaults to the output terminal's size, or 80×24 if unknown.


warnAmbiguousWidth?

optional warnAmbiguousWidth?: boolean

Defined in: ui/src/app/application.ts:123

On a real terminal, warn once at startup if the terminal renders the ambiguous-width frame glyphs double-width (which shifts alignment). Default true; pass false to skip the probe in tests.


writeClipboardText?

readonly optional writeClipboardText?: ClipboardTextWriter

Defined in: ui/src/app/application.ts:74

Write exact raw text to the host clipboard after a copy or cut commits it locally.

Host failures are reported without payload details and never roll back canonical state.