Sign In

@opentui/core

Package Overview
Dependencies
Maintainers
3
Versions
317
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentui/core - npm Package Compare versions

Comparing version
0.5.1
to
0.5.2
chunk-bun-26r5c5w5.js

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

+22
import type { HostClipboardBackend, HostClipboardOptions, HostClipboardService } from "./clipboard.js";
export declare const HOST_CLIPBOARD_MIME_PREFERENCE_COUNT_MAX = 64;
export declare const HOST_CLIPBOARD_MIME_ESSENCE_BYTES_MAX = 255;
export interface NormalizedHostClipboardOptions {
readonly timeoutMs: number;
readonly maxReadBytes: number;
readonly maxWriteBytes: number;
readonly maxImagePixels: number;
readonly maxConversionBytes: number;
readonly maxConcurrentOperations: number;
readonly maxProviderTransfers: number;
readonly waylandSeat?: string;
}
export type HostClipboardBackendFactory = (options: NormalizedHostClipboardOptions) => HostClipboardBackend;
export interface ActiveClipboardOperation {
readonly controller: AbortController;
readonly settled: Promise<void>;
settle(): void;
}
export declare const validateClipboardText: (text: string, maxWriteBytes: number) => void;
export declare const runTrackedOperation: <T>(active: Set<ActiveClipboardOperation>, callerSignal: AbortSignal | undefined, operation: (signal: AbortSignal) => Promise<T>) => Promise<T>;
export declare const createHostClipboardWithBackend: (options: HostClipboardOptions, createBackend: HostClipboardBackendFactory) => HostClipboardService;
import { type HostClipboardBackendFactory } from "./host-clipboard.internal.js";
export declare const createNativeHostClipboardBackend: HostClipboardBackendFactory;
+2
-0

@@ -91,2 +91,3 @@ import { type ImageHandle } from "./zig.js";

clone(): NativeImage;
retain(): NativeImage;
resize(options: ResizeOptions): NativeImage;

@@ -99,2 +100,3 @@ extract(options: ExtractOptions): NativeImage;

composite(overlay: NativeImage, options?: CompositeOptions): NativeImage;
ensureEncodedPng(): void;
raw(format?: PixelFormat): RawImage;

@@ -101,0 +103,0 @@ takeRaw(): OwnedRawImage;

import type { RendererHandle, RenderLib } from "../zig.js";
export interface ClipboardRepresentation {
readonly mimeType: string;
readonly bytes: Uint8Array;
}
export type ClipboardSelection = "clipboard" | "primary";
export interface ClipboardReadOptions {
readonly preferredTypes: readonly [string, ...string[]];
readonly selection?: ClipboardSelection;
readonly signal?: AbortSignal;
}
export type ClipboardReadResult = {
readonly status: "read";
readonly representation: ClipboardRepresentation;
} | {
readonly status: "empty" | "unsupported" | "cancelled" | "timed-out" | "limit-exceeded";
} | {
readonly status: "failed";
readonly error: Error;
};
export interface HostClipboardReadOptions {
readonly preferredTypes: readonly [string, ...string[]];
readonly selection: ClipboardSelection;
readonly maxBytes: number;
readonly timeoutMs: number;
readonly signal: AbortSignal;
}
export interface HostClipboardWriteOptions {
readonly selection: ClipboardSelection;
readonly timeoutMs: number;
readonly signal: AbortSignal;
}
export type HostClipboardWriteResult = {
readonly status: "written" | "unsupported" | "cancelled" | "timed-out";
} | {
readonly status: "failed";
readonly error: Error;
};
export type HostClipboardClearResult = {
readonly status: "cleared" | "unsupported" | "cancelled" | "timed-out";
} | {
readonly status: "failed";
readonly error: Error;
};
export interface HostClipboardBackend {
read(options: HostClipboardReadOptions): Promise<ClipboardReadResult>;
writeText(text: string, options: HostClipboardWriteOptions): Promise<HostClipboardWriteResult>;
clear(options: HostClipboardWriteOptions): Promise<HostClipboardClearResult>;
dispose(): Promise<void>;
}
export type ClipboardWriteDestination = "terminal-only" | "host-only" | "best-available" | "all-available";
export interface ClipboardWriteOptions {
readonly destination: ClipboardWriteDestination;
readonly selection?: ClipboardSelection;
readonly allowRemoteHost?: boolean;
readonly signal?: AbortSignal;
}
export interface TerminalClipboardOperationResult {
readonly status: "attempted" | "local-failure" | "not-attempted";
readonly capability: "supported" | "unsupported" | "unknown";
}
export interface ClipboardWriteResult {
readonly host: HostClipboardWriteResult | {
readonly status: "not-attempted";
};
readonly terminal: TerminalClipboardOperationResult;
}
export interface ClipboardClearResult {
readonly host: HostClipboardClearResult | {
readonly status: "not-attempted";
};
readonly terminal: TerminalClipboardOperationResult;
}
export interface ClipboardService {
read(options: ClipboardReadOptions): Promise<ClipboardReadResult>;
writeText(text: string, options: ClipboardWriteOptions): Promise<ClipboardWriteResult>;
clear(options: ClipboardWriteOptions): Promise<ClipboardClearResult>;
dispose(): Promise<void>;
}
export interface HostClipboardOperationOptions {
readonly selection?: ClipboardSelection;
readonly signal?: AbortSignal;
}
export interface HostClipboardService {
readonly maxWriteBytes: number;
read(options: ClipboardReadOptions): Promise<ClipboardReadResult>;
writeText(text: string, options?: HostClipboardOperationOptions): Promise<HostClipboardWriteResult>;
clear(options?: HostClipboardOperationOptions): Promise<HostClipboardClearResult>;
dispose(): Promise<void>;
}
export interface HostClipboardOptions {
readonly timeoutMs?: number;
readonly maxReadBytes?: number;
readonly maxWriteBytes?: number;
readonly maxImagePixels?: number;
readonly maxConversionBytes?: number;
readonly maxConcurrentOperations?: number;
readonly maxProviderTransfers?: number;
readonly waylandSeat?: string;
}
export interface TerminalClipboardAdapter {
readonly remote: boolean;
writeText(text: string, selection: ClipboardSelection): TerminalClipboardOperationResult;
clear(selection: ClipboardSelection): TerminalClipboardOperationResult;
}
export interface ClipboardOptions {
readonly host: HostClipboardService;
readonly terminal: TerminalClipboardAdapter;
}
export declare const createHostClipboard: (options?: HostClipboardOptions) => HostClipboardService;
export declare const createClipboard: ({ host, terminal }: ClipboardOptions) => ClipboardService;
export declare enum ClipboardTarget {

@@ -8,2 +118,11 @@ Clipboard = 0,

}
export interface RendererClipboardBoundary {
readonly capabilities: {
readonly remote: boolean;
readonly osc52_support: "supported" | "unsupported" | "unknown";
} | null;
copyToClipboardOSC52(text: string, target?: ClipboardTarget): boolean;
clearClipboardOSC52(target?: ClipboardTarget): boolean;
}
export declare const createRendererClipboardAdapter: (renderer: RendererClipboardBoundary) => TerminalClipboardAdapter;
export declare class Clipboard {

@@ -10,0 +129,0 @@ private lib;

@@ -145,2 +145,3 @@ export interface HighlightRange {

bufferId?: number;
messageId?: string;
error: string;

@@ -147,0 +148,0 @@ } | {

+9
-9

@@ -7,3 +7,3 @@ {

"type": "module",
"version": "0.5.1",
"version": "0.5.2",
"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.1",
"@opentui/core-darwin-arm64": "0.5.1",
"@opentui/core-linux-x64": "0.5.1",
"@opentui/core-linux-arm64": "0.5.1",
"@opentui/core-win32-x64": "0.5.1",
"@opentui/core-win32-arm64": "0.5.1",
"@opentui/core-linux-x64-musl": "0.5.1",
"@opentui/core-linux-arm64-musl": "0.5.1"
"@opentui/core-darwin-x64": "0.5.2",
"@opentui/core-darwin-arm64": "0.5.2",
"@opentui/core-linux-x64": "0.5.2",
"@opentui/core-linux-arm64": "0.5.2",
"@opentui/core-win32-x64": "0.5.2",
"@opentui/core-win32-arm64": "0.5.2",
"@opentui/core-linux-x64-musl": "0.5.2",
"@opentui/core-linux-arm64-musl": "0.5.2"
}
}

@@ -40,2 +40,5 @@ import { type LineInfo, type RenderContext } from "../types.js";

private _highlightSnapshotId;
private _highlightLoopActive;
private _highlightPromise?;
private _highlightRerun;
private _conceal;

@@ -62,2 +65,3 @@ private _drawUnstyledText;

get content(): string;
private invalidateHighlights;
set content(value: string);

@@ -93,2 +97,4 @@ get lineInfo(): LineInfo;

private startHighlight;
private runHighlights;
private clearPendingHighlight;
private setRenderedLineSources;

@@ -100,2 +106,3 @@ private static isIdentityLineSources;

protected renderSelf(buffer: OptimizedBuffer): void;
destroy(): void;
}

@@ -6,4 +6,5 @@ import { Renderable, type RenderableOptions } from "../Renderable.js";

export type ImageFit = "fit" | "cover" | "fill";
export type ImageRenderableSource = ImageSource | NativeImage;
export interface ImageRenderableOptions extends RenderableOptions<ImageRenderable> {
source?: ImageSource;
source?: ImageRenderableSource;
fit?: ImageFit;

@@ -18,2 +19,3 @@ protocol?: ImageRenderProtocol;

private _image;
private _pendingImage;
private _loadError;

@@ -27,4 +29,4 @@ private _loadController;

constructor(ctx: RenderContext, options: ImageRenderableOptions);
get source(): ImageSource | undefined;
set source(source: ImageSource | undefined);
get source(): ImageRenderableSource | undefined;
set source(source: ImageRenderableSource | undefined);
get image(): NativeImage | null;

@@ -31,0 +33,0 @@ get fit(): ImageFit;

@@ -277,2 +277,3 @@ import { Renderable, RootRenderable } from "./Renderable.js";

private capabilityTimeoutId;
private terminalKeepAliveTimer;
private xtVersionWaiters;

@@ -366,4 +367,4 @@ private splitStartupSeedTimeoutId;

* - Adds `process.on(...)` listeners for SIGWINCH (process.stdout only),
* "warning", "uncaughtException", "unhandledRejection", "beforeExit",
* plus the configured `exitSignals`
* "warning", "uncaughtException", "unhandledRejection", plus the
* configured `exitSignals`
* - Replaces `global.requestAnimationFrame` with the renderer's impl

@@ -379,2 +380,4 @@ * - When `setupTerminal()` is called, it will put `stdin` in raw mode and

private addExitListeners;
private startTerminalKeepAlive;
private stopTerminalKeepAlive;
private removeExitListeners;

@@ -381,0 +384,0 @@ get isDestroyed(): boolean;

@@ -5,7 +5,7 @@ // @bun

CliRenderer
} from "./chunk-bun-8fkgaxc6.js";
} from "./chunk-bun-t68f2fmr.js";
import {
SystemClock,
TreeSitterClient
} from "./chunk-bun-83ry0rzt.js";
} from "./chunk-bun-26r5c5w5.js";

@@ -12,0 +12,0 @@ // src/testing/mock-keys.ts

import {
ANSI,
CliRenderer
} from "./chunk-node-0yw3x5m7.js";
} from "./chunk-node-kq7as74d.js";
import {
SystemClock,
TreeSitterClient
} from "./chunk-node-m23dbcww.js";
} from "./chunk-node-aj3n20gq.js";

@@ -10,0 +10,0 @@ // src/testing/mock-keys.ts

@@ -96,3 +96,3 @@ // @bun

yoga_default
} from "./chunk-bun-83ry0rzt.js";
} from "./chunk-bun-26r5c5w5.js";
export {

@@ -99,0 +99,0 @@ yoga_default as default,

@@ -95,3 +95,3 @@ import {

yoga_default
} from "./chunk-node-m23dbcww.js";
} from "./chunk-node-aj3n20gq.js";
export {

@@ -98,0 +98,0 @@ yoga_default as default,

@@ -43,2 +43,51 @@ import { type FFICallbackInstance, type Pointer } from "./platform/ffi.js";

export type ImageHandle = NativeHandle<"image">;
export type ClipboardServiceHandle = number & {
readonly __nativeHandle: "clipboard_service";
};
export type ClipboardOperationHandle = number & {
readonly __nativeHandle: "clipboard_operation";
};
export declare enum NativeClipboardOperationStatus {
Pending = 0,
Read = 1,
Empty = 2,
Written = 3,
Cleared = 4,
Unsupported = 5,
Cancelled = 6,
TimedOut = 7,
LimitExceeded = 8,
Failed = 9,
InvalidHandle = 10
}
export declare enum NativeClipboardStartStatus {
Ok = 0,
InvalidService = 1,
ShuttingDown = 2,
LimitExceeded = 3,
InvalidArgument = 4,
OutOfMemory = 5
}
export declare enum NativeClipboardCancelStatus {
Requested = 0,
AlreadyTerminal = 1,
InvalidHandle = 2
}
export declare enum NativeClipboardCopyStatus {
Ok = 0,
BufferTooSmall = 1,
InvalidHandle = 2,
InvalidState = 3,
InvalidArgument = 4
}
export declare enum NativeClipboardDestroyStatus {
Destroyed = 0,
NotReady = 1,
InvalidHandle = 2
}
export declare enum NativeClipboardShutdownStatus {
Pending = 0,
Ready = 1,
InvalidHandle = 2
}
export declare enum LogLevel {

@@ -241,2 +290,41 @@ Error = 0,

clearClipboardOSC52: (renderer: RendererHandle, target: number) => boolean;
clipboardServiceCreate: (maxConcurrentOperations: number, maxProviderTransfers: number, waylandSeat?: string) => ClipboardServiceHandle | null;
clipboardServiceBeginShutdown: (service: ClipboardServiceHandle) => NativeClipboardShutdownStatus;
clipboardServicePollShutdown: (service: ClipboardServiceHandle) => NativeClipboardShutdownStatus;
clipboardServiceDestroy: (service: ClipboardServiceHandle) => NativeClipboardDestroyStatus;
clipboardServiceDrain: (service: ClipboardServiceHandle) => number;
clipboardReadOperationStart: (service: ClipboardServiceHandle, request: Uint8Array, selection: number, maxBytes: number, maxImagePixels: number, maxConversionBytes: number, timeoutMs: number) => {
status: NativeClipboardStartStatus;
operation: ClipboardOperationHandle | null;
};
clipboardWriteOperationStart: (service: ClipboardServiceHandle, textUtf8: Uint8Array, selection: number, timeoutMs: number) => {
status: NativeClipboardStartStatus;
operation: ClipboardOperationHandle | null;
};
clipboardClearOperationStart: (service: ClipboardServiceHandle, selection: number, timeoutMs: number) => {
status: NativeClipboardStartStatus;
operation: ClipboardOperationHandle | null;
};
clipboardOperationPoll: (operation: ClipboardOperationHandle) => NativeClipboardOperationStatus;
clipboardOperationCancel: (operation: ClipboardOperationHandle) => NativeClipboardCancelStatus;
clipboardOperationResultMimeLength: (operation: ClipboardOperationHandle) => {
status: NativeClipboardCopyStatus;
length: number;
};
clipboardOperationResultMimeCopy: (operation: ClipboardOperationHandle, output: Uint8Array) => NativeClipboardCopyStatus;
clipboardOperationResultDataLength: (operation: ClipboardOperationHandle) => {
status: NativeClipboardCopyStatus;
length: number;
};
clipboardOperationResultDataCopy: (operation: ClipboardOperationHandle, output: Uint8Array) => NativeClipboardCopyStatus;
clipboardOperationResultErrorCode: (operation: ClipboardOperationHandle) => {
status: NativeClipboardCopyStatus;
errorCode: number;
};
clipboardOperationResultDiagnosticLength: (operation: ClipboardOperationHandle) => {
status: NativeClipboardCopyStatus;
length: number;
};
clipboardOperationResultDiagnosticCopy: (operation: ClipboardOperationHandle, output: Uint8Array) => NativeClipboardCopyStatus;
clipboardOperationDestroy: (operation: ClipboardOperationHandle) => NativeClipboardDestroyStatus;
triggerNotification: (renderer: RendererHandle, message: string, title?: string) => boolean;

@@ -527,2 +615,6 @@ addToHitGrid: (renderer: RendererHandle, x: number, y: number, width: number, height: number, id: number) => void;

imageDestroy: (image: ImageHandle) => void;
imageRetain: (image: ImageHandle) => {
status: number;
handle: ImageHandle | null;
};
imageGetInfo: (image: ImageHandle) => {

@@ -533,2 +625,3 @@ status: number;

imageMaterialize: (image: ImageHandle) => number;
imageEnsureEncodedPng: (image: ImageHandle) => number;
imageGetPixelsPtr: (image: ImageHandle) => Pointer | null;

@@ -535,0 +628,0 @@ imageClone: (image: ImageHandle) => {

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

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