@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
+105
| import { type ImageHandle } from "./zig.js"; | ||
| export type ImageFormat = "png" | "raw-rgba" | "jpeg" | "webp" | "gif"; | ||
| export type ImageColorStatus = "assumed-srgb" | "explicit-srgb"; | ||
| export type ResizeKernel = "default" | "area" | "triangle" | "cubic-bspline" | "catmull-rom" | "mitchell" | "nearest"; | ||
| export type BlendMode = "source-over" | "source" | "destination-over"; | ||
| export type PixelFormat = "rgba8" | "bgra8"; | ||
| export type ImageSource = string | URL | Uint8Array | ArrayBuffer | Blob | Response; | ||
| export type ImageLoadErrorCode = "file-read" | "network" | "http-status" | "unsupported-url-scheme"; | ||
| export declare class ImageLoadError extends Error { | ||
| readonly code: ImageLoadErrorCode; | ||
| readonly source: string; | ||
| readonly status?: number; | ||
| constructor(code: ImageLoadErrorCode, source: string, message: string, options?: { | ||
| cause?: unknown; | ||
| status?: number; | ||
| }); | ||
| } | ||
| export interface ImageLoadOptions { | ||
| signal?: AbortSignal; | ||
| fetch?: (input: URL, init?: RequestInit) => Promise<Response>; | ||
| } | ||
| export interface ImageInfo { | ||
| width: number; | ||
| height: number; | ||
| sourceWidth: number; | ||
| sourceHeight: number; | ||
| format: ImageFormat; | ||
| colorStatus: ImageColorStatus; | ||
| orientation: number; | ||
| hasAlpha: boolean; | ||
| } | ||
| export interface ResizeOptions { | ||
| width?: number; | ||
| height?: number; | ||
| kernel?: ResizeKernel; | ||
| } | ||
| export interface ExtractOptions { | ||
| left: number; | ||
| top: number; | ||
| width: number; | ||
| height: number; | ||
| } | ||
| export interface ExtendOptions { | ||
| top?: number; | ||
| right?: number; | ||
| bottom?: number; | ||
| left?: number; | ||
| background?: readonly [number, number, number, number]; | ||
| } | ||
| export interface CompositeOptions { | ||
| left?: number; | ||
| top?: number; | ||
| blend?: BlendMode; | ||
| opacity?: number; | ||
| } | ||
| export interface RawImage { | ||
| data: Uint8Array; | ||
| width: number; | ||
| height: number; | ||
| stride: number; | ||
| format: PixelFormat; | ||
| colorSpace: "srgb"; | ||
| alpha: "straight"; | ||
| } | ||
| export interface OwnedRawImage extends RawImage { | ||
| dispose(): void; | ||
| } | ||
| export type ImageErrorCode = "invalid-handle" | "unsupported-format" | "unsupported-color-space" | "malformed-data" | "dimension-limit" | "memory-limit" | "invalid-argument" | "out-of-memory" | "output-too-small" | "internal-error" | "unsupported-feature"; | ||
| export declare class ImageError extends Error { | ||
| readonly code: ImageErrorCode; | ||
| readonly status: number; | ||
| constructor(status: number); | ||
| } | ||
| export declare function imageInfo(data: Uint8Array | ArrayBuffer): ImageInfo; | ||
| export declare class NativeImage { | ||
| private readonly lib; | ||
| private handle; | ||
| private imageInfo; | ||
| private constructor(); | ||
| static decode(data: Uint8Array | ArrayBuffer): NativeImage; | ||
| static load(source: ImageSource, options?: ImageLoadOptions): Promise<NativeImage>; | ||
| static fromRgba(pixels: Uint8Array, width: number, height: number, stride?: number): NativeImage; | ||
| private static fromHandle; | ||
| private guard; | ||
| get ptr(): ImageHandle; | ||
| private wrap; | ||
| info(): ImageInfo; | ||
| get width(): number; | ||
| get height(): number; | ||
| clone(): NativeImage; | ||
| resize(options: ResizeOptions): NativeImage; | ||
| extract(options: ExtractOptions): NativeImage; | ||
| extend(options?: ExtendOptions): NativeImage; | ||
| rotate(angle: 90 | 180 | 270): NativeImage; | ||
| flip(): NativeImage; | ||
| flop(): NativeImage; | ||
| composite(overlay: NativeImage, options?: CompositeOptions): NativeImage; | ||
| raw(format?: PixelFormat): RawImage; | ||
| takeRaw(): OwnedRawImage; | ||
| copyTo(destination: Uint8Array, options?: { | ||
| stride?: number; | ||
| format?: PixelFormat; | ||
| }): void; | ||
| dispose(): void; | ||
| } |
| import { Renderable, type RenderableOptions } from "../Renderable.js"; | ||
| import { NativeImage, type ImageSource } from "../image.js"; | ||
| import type { OptimizedBuffer } from "../buffer.js"; | ||
| import type { ImageRenderProtocol, RenderContext, TerminalCapabilities } from "../types.js"; | ||
| export type ImageFit = "fit" | "cover" | "fill"; | ||
| export interface ImageRenderableOptions extends RenderableOptions<ImageRenderable> { | ||
| source?: ImageSource; | ||
| fit?: ImageFit; | ||
| protocol?: ImageRenderProtocol; | ||
| onLoad?: (image: NativeImage) => void; | ||
| onError?: (error: unknown) => void; | ||
| } | ||
| export declare function resolveImageRenderProtocol(requested: ImageRenderProtocol, capabilities: TerminalCapabilities | null, hasResolution: boolean): Exclude<ImageRenderProtocol, "auto">; | ||
| export declare class ImageRenderable extends Renderable { | ||
| private _source; | ||
| private _image; | ||
| private _loadError; | ||
| private _loadController; | ||
| onLoad?: (image: NativeImage) => void; | ||
| onError?: (error: unknown) => void; | ||
| private _fit; | ||
| private _protocol; | ||
| loadPromise: Promise<void> | null; | ||
| constructor(ctx: RenderContext, options: ImageRenderableOptions); | ||
| get source(): ImageSource | undefined; | ||
| set source(source: ImageSource | undefined); | ||
| get image(): NativeImage | null; | ||
| get fit(): ImageFit; | ||
| set fit(value: ImageFit | null | undefined); | ||
| get protocol(): ImageRenderProtocol; | ||
| set protocol(value: ImageRenderProtocol | null | undefined); | ||
| get effectiveProtocol(): Exclude<ImageRenderProtocol, "auto">; | ||
| get cellAspectRatio(): number; | ||
| getFittedSize(targetWidth: number, targetHeight: number, cellAspectRatio?: number, sourceWidth?: number, sourceHeight?: number): { | ||
| width: number; | ||
| height: number; | ||
| }; | ||
| get loading(): boolean; | ||
| get loadError(): unknown; | ||
| render(buffer: OptimizedBuffer, deltaTime: number): void; | ||
| protected renderSelf(buffer: OptimizedBuffer): void; | ||
| private load; | ||
| protected destroySelf(): void; | ||
| } |
+202
-1
@@ -154,3 +154,64 @@ import { EventEmitter } from "events"; | ||
| } | ||
| export type AudioAction = "createAudioEngine" | "start" | "startMixer" | "stop" | "loadSound" | "loadSoundFile" | "unloadSound" | "group" | "play" | "stopVoice" | "setVoiceGroup" | "setGroupVolume" | "setMasterVolume" | "mixFrames" | "enableTap" | "readTapFrames" | "listPlaybackDevices" | "selectPlaybackDevice" | "clearPlaybackDeviceSelection" | "getStats"; | ||
| export interface AudioCaptureDevice { | ||
| index: number; | ||
| name: string; | ||
| isDefault: boolean; | ||
| } | ||
| export interface AudioCaptureOptions { | ||
| channels?: number; | ||
| capacityFrames?: number; | ||
| startOptions?: AudioStartOptions; | ||
| } | ||
| export interface AudioCaptureStreamOptions extends AudioCaptureOptions { | ||
| chunkFrames?: number; | ||
| signal?: AbortSignal; | ||
| } | ||
| export type AudioCaptureStreamState = "initializing" | "capturing" | "stopping" | "stopped" | "errored" | "disposed"; | ||
| export type AudioCaptureStreamAction = "start" | "read" | "stop" | "stats" | "destroy"; | ||
| export interface AudioCaptureStreamErrorContext { | ||
| action: AudioCaptureStreamAction; | ||
| status?: number; | ||
| } | ||
| export interface AudioCaptureStreamEvents { | ||
| stopped: []; | ||
| error: [error: AudioCaptureStreamError, context: AudioCaptureStreamErrorContext]; | ||
| disposed: []; | ||
| } | ||
| export interface AudioCaptureStats { | ||
| sampleRate: number; | ||
| channels: number; | ||
| capacityFrames: number; | ||
| bufferedFrames: number; | ||
| framesReceived: bigint; | ||
| framesRead: bigint; | ||
| framesDropped: bigint; | ||
| } | ||
| export interface AudioCaptureStreamStats extends AudioCaptureStats { | ||
| state: AudioCaptureStreamState; | ||
| bufferedDurationMs: number; | ||
| } | ||
| export interface AudioCaptureReadResult { | ||
| frames: Float32Array; | ||
| framesRead: number; | ||
| } | ||
| export type AudioRecordToFileOptions = AudioCaptureStreamOptions; | ||
| export type AudioRecorderState = "initializing" | "recording" | "stopping" | "stopped" | "errored" | "disposed"; | ||
| export type AudioRecorderAction = "open" | "start" | "read" | "write" | "stop" | "finalize" | "publish" | "stats" | "destroy"; | ||
| export interface AudioRecorderErrorContext { | ||
| action: AudioRecorderAction; | ||
| status?: number; | ||
| } | ||
| export interface AudioRecorderEvents { | ||
| stopped: []; | ||
| error: [error: AudioRecorderError, context: AudioRecorderErrorContext]; | ||
| disposed: []; | ||
| } | ||
| export interface AudioRecorderStats extends AudioCaptureStats { | ||
| state: AudioRecorderState; | ||
| bufferedDurationMs: number; | ||
| framesWritten: bigint; | ||
| dataBytesWritten: bigint; | ||
| durationMs: number; | ||
| } | ||
| export type AudioAction = "createAudioEngine" | "start" | "startMixer" | "stop" | "loadSound" | "loadSoundFile" | "unloadSound" | "group" | "play" | "stopVoice" | "setVoiceGroup" | "setGroupVolume" | "setMasterVolume" | "mixFrames" | "enableTap" | "readTapFrames" | "listPlaybackDevices" | "selectPlaybackDevice" | "clearPlaybackDeviceSelection" | "listCaptureDevices" | "selectCaptureDevice" | "clearCaptureDeviceSelection" | "startCapture" | "readCaptureFrames" | "getCaptureStats" | "stopCapture" | "getStats"; | ||
| export interface AudioErrorContext { | ||
@@ -164,2 +225,4 @@ action: AudioAction; | ||
| mixerStarted: []; | ||
| captureStarted: []; | ||
| captureStopped: []; | ||
| stopped: []; | ||
@@ -174,2 +237,10 @@ disposed: []; | ||
| } | ||
| export declare class AudioCaptureStreamError extends Error { | ||
| readonly context: AudioCaptureStreamErrorContext; | ||
| constructor(message: string, context: AudioCaptureStreamErrorContext, cause?: unknown); | ||
| } | ||
| export declare class AudioRecorderError extends Error { | ||
| readonly context: AudioRecorderErrorContext; | ||
| constructor(message: string, context: AudioRecorderErrorContext, cause?: unknown); | ||
| } | ||
| export declare class AudioStreamError extends Error { | ||
@@ -247,2 +318,109 @@ readonly context: AudioStreamErrorContext; | ||
| } | ||
| export declare class AudioCaptureStream extends EventEmitter<AudioCaptureStreamEvents> { | ||
| readonly readable: ReadableStream<Float32Array>; | ||
| readonly sampleRate: number; | ||
| readonly channels: number; | ||
| readonly chunkFrames: number; | ||
| readonly closed: Promise<void>; | ||
| private readonly init; | ||
| private readonly lifecycleController; | ||
| private streamController; | ||
| private nativeStats; | ||
| private currentState; | ||
| private pendingFrames; | ||
| private readonly pendingSamples; | ||
| private producerStopAttempted; | ||
| private producerStopped; | ||
| private producerMayBeRunning; | ||
| private ownerRemoved; | ||
| private exposed; | ||
| private terminal; | ||
| private discardRequested; | ||
| private discardDecisionScheduled; | ||
| private pumpPromise; | ||
| private producerCleanupPromise; | ||
| private lastCleanupFailure; | ||
| private terminalCompletionPromise; | ||
| private closedResolve; | ||
| private readonly signalAbortListener; | ||
| private constructor(); | ||
| get state(): AudioCaptureStreamState; | ||
| private open; | ||
| getStats(): AudioCaptureStreamStats; | ||
| stop(): void; | ||
| dispose(): void; | ||
| private disposeInternal; | ||
| private pull; | ||
| private pump; | ||
| private pumpSource; | ||
| private discardNativeRing; | ||
| private requestDiscardDrain; | ||
| private scheduleDiscardIfIdle; | ||
| private refreshStats; | ||
| private observeProducer; | ||
| private stopProducer; | ||
| private finishStopped; | ||
| private fail; | ||
| private operationError; | ||
| private cleanupProducer; | ||
| private retryTerminalCleanup; | ||
| private publicStats; | ||
| private refreshFinalStats; | ||
| private removeOwner; | ||
| private emitTerminal; | ||
| } | ||
| export declare class AudioRecorder extends EventEmitter<AudioRecorderEvents> { | ||
| private static readonly fileSystem; | ||
| readonly filePath: string; | ||
| readonly format: "wav"; | ||
| readonly sampleRate: number; | ||
| readonly channels: number; | ||
| readonly closed: Promise<void>; | ||
| private readonly init; | ||
| private currentState; | ||
| private capture; | ||
| private reader; | ||
| private fileHandle; | ||
| private tempPath; | ||
| private captureStats; | ||
| private framesWritten; | ||
| private dataBytesWritten; | ||
| private stopRequested; | ||
| private terminal; | ||
| private terminationRequest; | ||
| private publicationStarted; | ||
| private exposed; | ||
| private ownerRemoved; | ||
| private cleanupPromise; | ||
| private resourceCleanupPromise; | ||
| private retainedCleanupScheduled; | ||
| private lifecyclePromise; | ||
| private closedResolve; | ||
| private readonly signalAbortListener; | ||
| private readonly captureErrorListener; | ||
| private constructor(); | ||
| get state(): AudioRecorderState; | ||
| private open; | ||
| getStats(): AudioRecorderStats; | ||
| stop(): void; | ||
| dispose(): void; | ||
| private consume; | ||
| private writeSamples; | ||
| private readWithStats; | ||
| private complete; | ||
| private publish; | ||
| private fail; | ||
| private requestTermination; | ||
| private finishCleanup; | ||
| private cleanupOwnedResources; | ||
| private retryRetainedCleanup; | ||
| private scheduleRetainedCleanup; | ||
| private hasRetainedResources; | ||
| private openTemporaryFile; | ||
| private writeFully; | ||
| private ensureOpening; | ||
| private fromCaptureError; | ||
| private removeOwner; | ||
| private emitTerminal; | ||
| } | ||
| export declare class Audio extends EventEmitter<AudioEvents> { | ||
@@ -258,2 +436,9 @@ static create(options?: AudioSetupOptions): Audio; | ||
| private mixerStarted; | ||
| private captureStarted; | ||
| private captureDeviceOpen; | ||
| private captureBufferAvailable; | ||
| private captureChannels; | ||
| private captureCapacityFrames; | ||
| private captureOwner; | ||
| private captureStream; | ||
| private disposing; | ||
@@ -291,2 +476,18 @@ private constructor(); | ||
| clearPlaybackDeviceSelection(): void; | ||
| openCapture(options?: AudioCaptureStreamOptions): Promise<AudioCaptureStream>; | ||
| recordToFile(filePath: string, options?: AudioRecordToFileOptions): Promise<AudioRecorder>; | ||
| listCaptureDevices(): AudioCaptureDevice[] | null; | ||
| selectCaptureDevice(index: number): boolean; | ||
| clearCaptureDeviceSelection(): void; | ||
| startCapture(options?: AudioCaptureOptions): boolean; | ||
| isCapturing(): boolean; | ||
| private isCapturingInternal; | ||
| readCaptureFrames(frameCount: number): AudioCaptureReadResult | null; | ||
| getCaptureStats(): AudioCaptureStats | null; | ||
| stopCapture(): boolean; | ||
| private emitCaptureOwnershipError; | ||
| private startCaptureInternal; | ||
| private readCaptureInternal; | ||
| private getCaptureStatsInternal; | ||
| private stopCaptureInternal; | ||
| getStats(): AudioStats | null; | ||
@@ -293,0 +494,0 @@ dispose(): void; |
+3
-0
| import { RGBA } from "./lib/index.js"; | ||
| import { type OptimizedBufferHandle, type RenderLib } from "./zig.js"; | ||
| import { type Pointer, type PointerInput } from "./platform/ffi.js"; | ||
| import type { NativeImage } from "./image.js"; | ||
| import type { ImageRenderProtocol } from "./types.js"; | ||
| import { type BorderStyle, type BorderSides } from "./lib/index.js"; | ||
@@ -61,2 +63,3 @@ import { TargetChannel, type WidthMethod, type CapturedLine } from "./types.js"; | ||
| drawSuperSampleBuffer(x: number, y: number, pixelDataPtr: PointerInput, pixelDataLength: number, format: "bgra8unorm" | "rgba8unorm", alignedBytesPerRow: number): void; | ||
| drawImage(image: NativeImage, x: number, y: number, width: number, height: number, pixelWidth?: number, pixelHeight?: number, sourceX?: number, sourceY?: number, sourceWidth?: number, sourceHeight?: number, protocol?: ImageRenderProtocol): boolean; | ||
| drawPackedBuffer(dataPtr: PointerInput, dataLen: number, posX: number, posY: number, terminalWidthCells: number, terminalHeightCells: number): void; | ||
@@ -63,0 +66,0 @@ drawGrayscaleBuffer(posX: number, posY: number, intensities: Float32Array, srcWidth: number, srcHeight: number, fg?: RGBA | null, bg?: RGBA | null): void; |
+1
-0
@@ -24,2 +24,3 @@ export * from "./Renderable.js"; | ||
| export type { IcyStreamDemuxerOptions } from "./audio-stream/icy/demuxer.js"; | ||
| export * from "./image.js"; | ||
| export * from "./renderables/index.js"; | ||
@@ -26,0 +27,0 @@ export * from "./zig.js"; |
+1
-0
@@ -35,2 +35,3 @@ /** | ||
| default?: string | boolean | number; | ||
| required?: boolean; | ||
| type?: "string" | "boolean" | "number"; | ||
@@ -37,0 +38,0 @@ } |
@@ -55,2 +55,4 @@ import { type Clock } from "./clock.js"; | ||
| private pendingSinceMs; | ||
| private pendingTimeoutPaused; | ||
| private suspendedPixelResolutionPrefixLength; | ||
| private forceFlush; | ||
@@ -73,2 +75,5 @@ private justFlushedEsc; | ||
| reset(): void; | ||
| hasPendingPixelResolutionResponse(): boolean; | ||
| pausePendingTimeout(): void; | ||
| resumePendingTimeout(): void; | ||
| resetMouseState(): void; | ||
@@ -75,0 +80,0 @@ destroy(): void; |
+5
-2
@@ -50,3 +50,3 @@ // src/node-assets.ts | ||
| if (existing) { | ||
| if (existing.description !== config.description || existing.type !== config.type || existing.default !== config.default) { | ||
| if (existing.description !== config.description || existing.type !== config.type || existing.default !== config.default || existing.required !== config.required) { | ||
| throw new Error(`Environment variable "${config.name}" is already registered with different configuration. ` + `Existing: ${JSON.stringify(existing)}, New: ${JSON.stringify(config)}`); | ||
@@ -67,2 +67,5 @@ } | ||
| } | ||
| if (envValue === undefined && config.required === false) { | ||
| return; | ||
| } | ||
| if (envValue === undefined) { | ||
@@ -262,3 +265,3 @@ throw new Error(`Required environment variable ${config.name} is not set. ${config.description}`); | ||
| //# debugId=CA3D232D897F070364756E2164756E21 | ||
| //# debugId=2D9AF8B7C6420F5D64756E2164756E21 | ||
| //# sourceMappingURL=node-assets.js.map |
@@ -9,9 +9,9 @@ { | ||
| "const singletonCacheSymbol = Symbol.for(\"@opentui/core/singleton\")\n\n/**\n * Ensures a value is initialized once per process,\n * persists across Bun hot reloads, and is type-safe.\n */\nexport function singleton<T>(key: string, factory: () => T): T {\n // @ts-expect-error this symbol is only used in this file and is not part of the public API\n const bag = (globalThis[singletonCacheSymbol] ??= {})\n if (!(key in bag)) {\n bag[key] = factory()\n }\n return bag[key] as T\n}\n\nexport function getSingleton<T>(key: string): T | undefined {\n // @ts-expect-error this symbol is only used in this file and is not part of the public API\n const bag = globalThis[singletonCacheSymbol]\n return bag?.[key] as T | undefined\n}\n\nexport function destroySingleton(key: string): void {\n // @ts-expect-error this symbol is only used in this file and is not part of the public API\n const bag = globalThis[singletonCacheSymbol]\n if (bag && key in bag) {\n delete bag[key]\n }\n}\n\nexport function hasSingleton(key: string): boolean {\n // @ts-expect-error this symbol is only used in this file and is not part of the public API\n const bag = globalThis[singletonCacheSymbol]\n return bag && key in bag\n}\n", | ||
| "import { singleton } from \"./singleton.js\"\n\n/**\n * Environment variable registry\n *\n * Usage:\n * ```ts\n * import { registerEnvVar, env } from \"./lib/env.ts\";\n *\n * // Register environment variables\n * registerEnvVar({\n * name: \"DEBUG\",\n * description: \"Enable debug logging\",\n * type: \"boolean\",\n * default: false\n * });\n *\n * registerEnvVar({\n * name: \"PORT\",\n * description: \"Server port number\",\n * type: \"number\",\n * default: 3000\n * });\n *\n * // Access environment variables\n * if (env.DEBUG) {\n * console.log(\"Debug mode enabled\");\n * }\n *\n * const port = env.PORT; // number\n * ```\n */\n\nexport interface EnvVarConfig {\n name: string\n description: string\n default?: string | boolean | number\n type?: \"string\" | \"boolean\" | \"number\"\n}\n\nexport const envRegistry: Record<string, EnvVarConfig> = singleton(\"env-registry\", () => ({}))\n\nexport function registerEnvVar(config: EnvVarConfig): void {\n const existing = envRegistry[config.name]\n if (existing) {\n if (\n existing.description !== config.description ||\n existing.type !== config.type ||\n existing.default !== config.default\n ) {\n throw new Error(\n `Environment variable \"${config.name}\" is already registered with different configuration. ` +\n `Existing: ${JSON.stringify(existing)}, New: ${JSON.stringify(config)}`,\n )\n }\n return\n }\n envRegistry[config.name] = config\n}\n\nfunction normalizeBoolean(value: string): boolean {\n const lowerValue = value.toLowerCase()\n return [\"true\", \"1\", \"on\", \"yes\"].includes(lowerValue)\n}\n\nfunction parseEnvValue(config: EnvVarConfig): string | boolean | number {\n const envValue = process.env[config.name]\n\n if (envValue === undefined && config.default !== undefined) {\n return config.default\n }\n\n if (envValue === undefined) {\n throw new Error(`Required environment variable ${config.name} is not set. ${config.description}`)\n }\n\n switch (config.type) {\n case \"boolean\":\n return typeof envValue === \"boolean\" ? envValue : normalizeBoolean(envValue)\n case \"number\":\n const numValue = Number(envValue)\n if (isNaN(numValue)) {\n throw new Error(`Environment variable ${config.name} must be a valid number, got: ${envValue}`)\n }\n return numValue\n case \"string\":\n default:\n return envValue\n }\n}\n\nclass EnvStore {\n private parsedValues: Map<string, string | boolean | number> = new Map()\n\n get(key: string): any {\n if (this.parsedValues.has(key)) {\n return this.parsedValues.get(key)!\n }\n\n if (!(key in envRegistry)) {\n throw new Error(`Environment variable ${key} is not registered.`)\n }\n\n try {\n const value = parseEnvValue(envRegistry[key])\n this.parsedValues.set(key, value)\n return value\n } catch (error) {\n throw new Error(`Failed to parse env var ${key}: ${error instanceof Error ? error.message : String(error)}`)\n }\n }\n\n has(key: string): boolean {\n return key in envRegistry\n }\n\n clearCache(): void {\n this.parsedValues.clear()\n }\n}\n\nconst envStore = singleton(\"env-store\", () => new EnvStore())\n\nexport function clearEnvCache(): void {\n envStore.clearCache()\n}\n\nexport function generateEnvMarkdown(): string {\n const configs = Object.values(envRegistry)\n\n if (configs.length === 0) {\n return \"# Environment Variables\\n\\nNo environment variables registered.\\n\"\n }\n\n let markdown = \"# Environment Variables\\n\\n\"\n\n for (const config of configs) {\n markdown += `## ${config.name}\\n\\n`\n markdown += `${config.description}\\n\\n`\n\n markdown += `**Type:** \\`${config.type || \"string\"}\\` \\n`\n\n if (config.default !== undefined) {\n const defaultValue = typeof config.default === \"string\" ? `\"${config.default}\"` : String(config.default)\n markdown += `**Default:** \\`${defaultValue}\\`\\n`\n } else {\n markdown += \"**Default:** *Required*\\n\"\n }\n\n markdown += \"\\n\"\n }\n\n return markdown\n}\n\nexport function generateEnvColored(): string {\n const configs = Object.values(envRegistry)\n\n if (configs.length === 0) {\n return \"\\x1b[1;36mEnvironment Variables\\x1b[0m\\n\\nNo environment variables registered.\\n\"\n }\n\n let output = \"\\x1b[1;36mEnvironment Variables\\x1b[0m\\n\\n\"\n\n for (const config of configs) {\n output += `\\x1b[1;33m${config.name}\\x1b[0m\\n`\n output += `${config.description}\\n`\n output += `\\x1b[32mType:\\x1b[0m \\x1b[36m${config.type || \"string\"}\\x1b[0m\\n`\n\n if (config.default !== undefined) {\n const defaultValue = typeof config.default === \"string\" ? `\"${config.default}\"` : String(config.default)\n output += `\\x1b[32mDefault:\\x1b[0m \\x1b[35m${defaultValue}\\x1b[0m\\n`\n } else {\n output += `\\x1b[32mDefault:\\x1b[0m \\x1b[31mRequired\\x1b[0m\\n`\n }\n\n output += \"\\n\"\n }\n\n return output\n}\n\nexport const env = new Proxy({} as Record<string, any>, {\n get(target, prop: string) {\n if (typeof prop !== \"string\") {\n return undefined\n }\n return envStore.get(prop)\n },\n\n has(target, prop: string) {\n return envStore.has(prop)\n },\n\n ownKeys() {\n return Object.keys(envRegistry)\n },\n\n getOwnPropertyDescriptor(target, prop: string) {\n if (envStore.has(prop)) {\n return {\n enumerable: true,\n configurable: true,\n get: () => envStore.get(prop),\n }\n }\n return undefined\n },\n})\n", | ||
| "import { singleton } from \"./singleton.js\"\n\n/**\n * Environment variable registry\n *\n * Usage:\n * ```ts\n * import { registerEnvVar, env } from \"./lib/env.ts\";\n *\n * // Register environment variables\n * registerEnvVar({\n * name: \"DEBUG\",\n * description: \"Enable debug logging\",\n * type: \"boolean\",\n * default: false\n * });\n *\n * registerEnvVar({\n * name: \"PORT\",\n * description: \"Server port number\",\n * type: \"number\",\n * default: 3000\n * });\n *\n * // Access environment variables\n * if (env.DEBUG) {\n * console.log(\"Debug mode enabled\");\n * }\n *\n * const port = env.PORT; // number\n * ```\n */\n\nexport interface EnvVarConfig {\n name: string\n description: string\n default?: string | boolean | number\n required?: boolean\n type?: \"string\" | \"boolean\" | \"number\"\n}\n\nexport const envRegistry: Record<string, EnvVarConfig> = singleton(\"env-registry\", () => ({}))\n\nexport function registerEnvVar(config: EnvVarConfig): void {\n const existing = envRegistry[config.name]\n if (existing) {\n if (\n existing.description !== config.description ||\n existing.type !== config.type ||\n existing.default !== config.default ||\n existing.required !== config.required\n ) {\n throw new Error(\n `Environment variable \"${config.name}\" is already registered with different configuration. ` +\n `Existing: ${JSON.stringify(existing)}, New: ${JSON.stringify(config)}`,\n )\n }\n return\n }\n envRegistry[config.name] = config\n}\n\nfunction normalizeBoolean(value: string): boolean {\n const lowerValue = value.toLowerCase()\n return [\"true\", \"1\", \"on\", \"yes\"].includes(lowerValue)\n}\n\nfunction parseEnvValue(config: EnvVarConfig): string | boolean | number | undefined {\n const envValue = process.env[config.name]\n\n if (envValue === undefined && config.default !== undefined) {\n return config.default\n }\n\n if (envValue === undefined && config.required === false) {\n return undefined\n }\n\n if (envValue === undefined) {\n throw new Error(`Required environment variable ${config.name} is not set. ${config.description}`)\n }\n\n switch (config.type) {\n case \"boolean\":\n return typeof envValue === \"boolean\" ? envValue : normalizeBoolean(envValue)\n case \"number\":\n const numValue = Number(envValue)\n if (isNaN(numValue)) {\n throw new Error(`Environment variable ${config.name} must be a valid number, got: ${envValue}`)\n }\n return numValue\n case \"string\":\n default:\n return envValue\n }\n}\n\nclass EnvStore {\n private parsedValues: Map<string, string | boolean | number | undefined> = new Map()\n\n get(key: string): any {\n if (this.parsedValues.has(key)) {\n return this.parsedValues.get(key)!\n }\n\n if (!(key in envRegistry)) {\n throw new Error(`Environment variable ${key} is not registered.`)\n }\n\n try {\n const value = parseEnvValue(envRegistry[key])\n this.parsedValues.set(key, value)\n return value\n } catch (error) {\n throw new Error(`Failed to parse env var ${key}: ${error instanceof Error ? error.message : String(error)}`)\n }\n }\n\n has(key: string): boolean {\n return key in envRegistry\n }\n\n clearCache(): void {\n this.parsedValues.clear()\n }\n}\n\nconst envStore = singleton(\"env-store\", () => new EnvStore())\n\nexport function clearEnvCache(): void {\n envStore.clearCache()\n}\n\nexport function generateEnvMarkdown(): string {\n const configs = Object.values(envRegistry)\n\n if (configs.length === 0) {\n return \"# Environment Variables\\n\\nNo environment variables registered.\\n\"\n }\n\n let markdown = \"# Environment Variables\\n\\n\"\n\n for (const config of configs) {\n markdown += `## ${config.name}\\n\\n`\n markdown += `${config.description}\\n\\n`\n\n markdown += `**Type:** \\`${config.type || \"string\"}\\` \\n`\n\n if (config.default !== undefined) {\n const defaultValue = typeof config.default === \"string\" ? `\"${config.default}\"` : String(config.default)\n markdown += `**Default:** \\`${defaultValue}\\`\\n`\n } else if (config.required === false) {\n markdown += \"**Default:** *unset*\\n\"\n } else {\n markdown += \"**Default:** *Required*\\n\"\n }\n\n markdown += \"\\n\"\n }\n\n return markdown\n}\n\nexport function generateEnvColored(): string {\n const configs = Object.values(envRegistry)\n\n if (configs.length === 0) {\n return \"\\x1b[1;36mEnvironment Variables\\x1b[0m\\n\\nNo environment variables registered.\\n\"\n }\n\n let output = \"\\x1b[1;36mEnvironment Variables\\x1b[0m\\n\\n\"\n\n for (const config of configs) {\n output += `\\x1b[1;33m${config.name}\\x1b[0m\\n`\n output += `${config.description}\\n`\n output += `\\x1b[32mType:\\x1b[0m \\x1b[36m${config.type || \"string\"}\\x1b[0m\\n`\n\n if (config.default !== undefined) {\n const defaultValue = typeof config.default === \"string\" ? `\"${config.default}\"` : String(config.default)\n output += `\\x1b[32mDefault:\\x1b[0m \\x1b[35m${defaultValue}\\x1b[0m\\n`\n } else if (config.required === false) {\n output += \"\\x1b[32mDefault:\\x1b[0m \\x1b[35munset\\x1b[0m\\n\"\n } else {\n output += `\\x1b[32mDefault:\\x1b[0m \\x1b[31mRequired\\x1b[0m\\n`\n }\n\n output += \"\\n\"\n }\n\n return output\n}\n\nexport const env = new Proxy({} as Record<string, any>, {\n get(target, prop: string) {\n if (typeof prop !== \"string\") {\n return undefined\n }\n return envStore.get(prop)\n },\n\n has(target, prop: string) {\n return envStore.has(prop)\n },\n\n ownKeys() {\n return Object.keys(envRegistry)\n },\n\n getOwnPropertyDescriptor(target, prop: string) {\n if (envStore.has(prop)) {\n return {\n enumerable: true,\n configurable: true,\n get: () => envStore.get(prop),\n }\n }\n return undefined\n },\n})\n", | ||
| "import { getCurrentNodeAssetTarget, getNativeAssetDescriptor } from \"../node-asset-target.js\"\nimport { resolveAssetPath, resolveAssetRootPath } from \"./assets.js\"\n\ninterface NativePackageModule {\n readonly default: string\n}\n\nconst CORE_ASSET_PREFIX = \"@opentui/core/\"\nconst PARSER_WORKER_ASSET_KEY = `${CORE_ASSET_PREFIX}parser.worker.js`\nconst TREE_SITTER_WASM_ASSET_KEY = \"web-tree-sitter/tree-sitter.wasm\"\n\nexport function resolveDefaultParserAsset(relativePath: string, fallbackPath: URL): Promise<string> {\n return Promise.resolve(resolveAssetPath(`${CORE_ASSET_PREFIX}${relativePath}`, fallbackPath))\n}\n\nexport function resolveDefaultTreeSitterWorkerPath(fallbackPath: URL): string {\n return resolveAssetPath(PARSER_WORKER_ASSET_KEY, fallbackPath)\n}\n\nexport function resolveTreeSitterWasm(): Promise<string> {\n return Promise.resolve(\n resolveAssetPath(TREE_SITTER_WASM_ASSET_KEY, () => new URL(import.meta.resolve(TREE_SITTER_WASM_ASSET_KEY))),\n )\n}\n\nexport async function resolveNativeLibraryPath(): Promise<string> {\n const asset = getNativeAssetDescriptor(getCurrentNodeAssetTarget())\n const configuredPath = resolveAssetRootPath(asset.key)\n if (configuredPath !== undefined) {\n return configuredPath\n }\n\n const specifier: string = asset.packageName\n return ((await import(specifier)) as NativePackageModule).default\n}\n", | ||
| "// This file is generated by assets/update.ts - DO NOT EDIT MANUALLY\n// Run 'bun assets/update.ts' to regenerate this file\n\nimport { resolveDefaultParserAsset } from \"#opentui/runtime-assets\"\n\nimport type { FiletypeParserOptions, InjectionMapping } from \"./types.js\"\n\ninterface DefaultParserDescriptor {\n readonly filetype: string\n readonly aliases?: readonly string[]\n readonly queries: {\n readonly highlights: readonly string[]\n readonly injections?: readonly string[]\n }\n readonly wasm: string\n readonly injectionMapping?: InjectionMapping\n}\n\nconst defaultParserDescriptors: readonly DefaultParserDescriptor[] = [\n {\n \"filetype\": \"javascript\",\n \"aliases\": [\"javascriptreact\"],\n \"queries\": { \"highlights\": [\"assets/javascript/highlights.scm\"] },\n \"wasm\": \"assets/javascript/tree-sitter-javascript.wasm\"\n },\n {\n \"filetype\": \"typescript\",\n \"aliases\": [\"typescriptreact\"],\n \"queries\": { \"highlights\": [\"assets/typescript/highlights.scm\"] },\n \"wasm\": \"assets/typescript/tree-sitter-typescript.wasm\"\n },\n {\n \"filetype\": \"markdown\",\n \"queries\": {\n \"highlights\": [\"assets/markdown/highlights.scm\"],\n \"injections\": [\"assets/markdown/injections.scm\"]\n },\n \"wasm\": \"assets/markdown/tree-sitter-markdown.wasm\",\n \"injectionMapping\": {\n \"nodeTypes\": { \"inline\": \"markdown_inline\", \"pipe_table_cell\": \"markdown_inline\" },\n \"infoStringMap\": {\n \"javascript\": \"javascript\",\n \"js\": \"javascript\",\n \"jsx\": \"javascriptreact\",\n \"javascriptreact\": \"javascriptreact\",\n \"typescript\": \"typescript\",\n \"ts\": \"typescript\",\n \"tsx\": \"typescriptreact\",\n \"typescriptreact\": \"typescriptreact\",\n \"markdown\": \"markdown\",\n \"md\": \"markdown\"\n }\n }\n },\n {\n \"filetype\": \"markdown_inline\",\n \"queries\": { \"highlights\": [\"assets/markdown_inline/highlights.scm\"] },\n \"wasm\": \"assets/markdown_inline/tree-sitter-markdown_inline.wasm\"\n },\n {\n \"filetype\": \"zig\",\n \"queries\": { \"highlights\": [\"assets/zig/highlights.scm\"] },\n \"wasm\": \"assets/zig/tree-sitter-zig.wasm\"\n }\n]\n\nexport const defaultParserAssetPaths: readonly string[] = [\n ...new Set(\n defaultParserDescriptors.flatMap((parser) => [\n ...parser.queries.highlights,\n parser.wasm,\n ...(parser.queries.injections ?? []),\n ]),\n ),\n]\n\nlet cachedParsers: Promise<FiletypeParserOptions[]> | undefined\n\nexport function getParsers(): Promise<FiletypeParserOptions[]> {\n cachedParsers ??= Promise.all(defaultParserDescriptors.map(resolveDefaultParser))\n return cachedParsers\n}\n\nasync function resolveDefaultParser(parser: DefaultParserDescriptor): Promise<FiletypeParserOptions> {\n const queries: FiletypeParserOptions[\"queries\"] = {\n highlights: await Promise.all(parser.queries.highlights.map(resolveParserAsset)),\n }\n if (parser.queries.injections) {\n queries.injections = await Promise.all(parser.queries.injections.map(resolveParserAsset))\n }\n\n return {\n filetype: parser.filetype,\n ...(parser.aliases ? { aliases: [...parser.aliases] } : {}),\n queries,\n wasm: await resolveParserAsset(parser.wasm),\n ...(parser.injectionMapping ? { injectionMapping: parser.injectionMapping } : {}),\n }\n}\n\nfunction resolveParserAsset(relativePath: string): Promise<string> {\n return resolveDefaultParserAsset(relativePath, new URL(`./${relativePath}`, import.meta.url))\n}\n" | ||
| ], | ||
| "mappings": ";AAA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AAY,QAAQ,SAAS,CAAC;AAAA;AAGrD,SAAS,UAAU,CAAC,MAAuB;AAAA,EACzC,IAAI;AAAA,IACF,OAAO,SAAS,IAAI,EAAE,OAAO;AAAA,IAC7B,MAAM;AAAA,IACN,OAAO;AAAA;AAAA;", | ||
| "debugId": "2D9AF8B7C6420F5D64756E2164756E21", | ||
| "names": [] | ||
| } |
+10
-10
@@ -7,3 +7,3 @@ { | ||
| "type": "module", | ||
| "version": "0.4.5", | ||
| "version": "0.5.0", | ||
| "description": "OpenTUI is a TypeScript library on a native Zig core for building terminal user interfaces (TUIs)", | ||
@@ -69,3 +69,3 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "bun-ffi-structs": "0.2.4", | ||
| "bun-ffi-structs": "0.3.1", | ||
| "diff": "9.0.0", | ||
@@ -80,11 +80,11 @@ "marked": "17.0.1", | ||
| "optionalDependencies": { | ||
| "@opentui/core-darwin-x64": "0.4.5", | ||
| "@opentui/core-darwin-arm64": "0.4.5", | ||
| "@opentui/core-linux-x64": "0.4.5", | ||
| "@opentui/core-linux-arm64": "0.4.5", | ||
| "@opentui/core-win32-x64": "0.4.5", | ||
| "@opentui/core-win32-arm64": "0.4.5", | ||
| "@opentui/core-linux-x64-musl": "0.4.5", | ||
| "@opentui/core-linux-arm64-musl": "0.4.5" | ||
| "@opentui/core-darwin-x64": "0.5.0", | ||
| "@opentui/core-darwin-arm64": "0.5.0", | ||
| "@opentui/core-linux-x64": "0.5.0", | ||
| "@opentui/core-linux-arm64": "0.5.0", | ||
| "@opentui/core-win32-x64": "0.5.0", | ||
| "@opentui/core-win32-arm64": "0.5.0", | ||
| "@opentui/core-linux-x64-musl": "0.5.0", | ||
| "@opentui/core-linux-arm64-musl": "0.5.0" | ||
| } | ||
| } |
@@ -121,4 +121,6 @@ declare const pointerBrand: unique symbol; | ||
| export declare const POINTER_UNSAFE = "Pointer exceeds safe integer range"; | ||
| export declare const usesBunFFI: boolean; | ||
| export declare function toPointer(value: PointerInput): Pointer; | ||
| export declare function ffiBool(value: boolean): 0 | 1; | ||
| export declare function trimNodeFFIOutputBytes(buffer: Uint8Array, length: number): Uint8Array; | ||
| export declare function createBunBackend(bun: BunFfiBackend): FfiBackend; | ||
@@ -125,0 +127,0 @@ export declare function createNodeBackend(nodeFfi: NodeFfiBackend): FfiBackend; |
+4
-4
@@ -7,7 +7,7 @@ # OpenTUI Core | ||
| - [Getting Started](docs/getting-started.md) - API and usage guide | ||
| - [Getting Started](https://opentui.com/docs/getting-started) - API and usage guide | ||
| - [Development Guide](docs/development.md) - Building, testing, and contributing | ||
| - [Tree-Sitter](docs/tree-sitter.md) - Syntax highlighting integration | ||
| - [Renderables vs Constructs](docs/renderables-vs-constructs.md) - Understanding the component model | ||
| - [Environment Variables](docs/env-vars.md) - Configuration options | ||
| - [Tree-Sitter](https://opentui.com/docs/reference/tree-sitter) - Syntax highlighting integration | ||
| - [Renderables vs Constructs](https://opentui.com/docs/core-concepts/renderables-vs-constructs) - Understanding the component model | ||
| - [Environment Variables](https://opentui.com/docs/reference/env-vars) - Configuration options | ||
@@ -14,0 +14,0 @@ ## Install |
+3
-0
@@ -335,2 +335,3 @@ import { EventEmitter } from "events"; | ||
| private renderList; | ||
| private _currentRenderable; | ||
| private appliedLayoutGeneration; | ||
@@ -340,2 +341,4 @@ private appliedRenderListRevision; | ||
| constructor(ctx: RenderContext); | ||
| get currentRenderable(): Renderable | undefined; | ||
| takeCurrentRenderable(): Renderable | undefined; | ||
| render(buffer: OptimizedBuffer, deltaTime: number): void; | ||
@@ -342,0 +345,0 @@ protected propagateLiveCount(delta: number): void; |
@@ -11,2 +11,3 @@ export * from "./ASCIIFont.js"; | ||
| export * from "./Input.js"; | ||
| export * from "./Image.js"; | ||
| export * from "./LineNumberRenderable.js"; | ||
@@ -13,0 +14,0 @@ export * from "./Markdown.js"; |
+14
-0
@@ -75,2 +75,6 @@ import { Renderable, RootRenderable } from "./Renderable.js"; | ||
| } | ||
| export interface CliRendererErrorEvent { | ||
| error: Error; | ||
| renderable: Renderable | undefined; | ||
| } | ||
| export interface RendererSchedulerState { | ||
@@ -154,2 +158,3 @@ isRunning: boolean; | ||
| readonly target: Renderable | null; | ||
| readonly currentTarget: Renderable | null; | ||
| readonly isDragging?: boolean; | ||
@@ -167,2 +172,6 @@ private _propagationStopped; | ||
| } | ||
| export interface CliRendererHandlerErrorEvent { | ||
| error: unknown; | ||
| event: MouseEvent; | ||
| } | ||
| export declare enum MouseButton { | ||
@@ -184,2 +193,4 @@ LEFT = 0, | ||
| FRAME = "frame", | ||
| RENDER_ERROR = "render:error", | ||
| HANDLER_ERROR = "handler:error", | ||
| EXTERNAL_OUTPUT = "external_output", | ||
@@ -239,2 +250,3 @@ FOCUS = "focus", | ||
| private waitingForPixelResolution; | ||
| private pixelResolutionRequeryPending; | ||
| private readonly clock; | ||
@@ -331,2 +343,3 @@ private rendering; | ||
| private _debugModeEnabled; | ||
| private readonly stdinLogPath; | ||
| private handleError; | ||
@@ -492,2 +505,3 @@ private dumpOutputCache; | ||
| private dispatchMouseEvent; | ||
| private sendMouseEvent; | ||
| private processSingleMouseEvent; | ||
@@ -494,0 +508,0 @@ /** |
+4
-3
@@ -5,7 +5,7 @@ // @bun | ||
| CliRenderer | ||
| } from "./chunk-bun-tkm837n2.js"; | ||
| } from "./chunk-bun-v3e63tzw.js"; | ||
| import { | ||
| SystemClock, | ||
| TreeSitterClient | ||
| } from "./chunk-bun-t2myhmwd.js"; | ||
| } from "./chunk-bun-ctxxvhwz.js"; | ||
@@ -802,2 +802,3 @@ // src/testing/mock-keys.ts | ||
| multiplexer: "none", | ||
| image_protocol: "auto", | ||
| ...overrides, | ||
@@ -1006,3 +1007,3 @@ terminal: { | ||
| //# debugId=0357928BEE71C0AA64756E2164756E21 | ||
| //# debugId=4A66EEF4E0EE595664756E2164756E21 | ||
| //# sourceMappingURL=testing.bun.js.map |
+4
-3
| import { | ||
| ANSI, | ||
| CliRenderer | ||
| } from "./chunk-node-51kpf0mz.js"; | ||
| } from "./chunk-node-1j69hr31.js"; | ||
| import { | ||
| SystemClock, | ||
| TreeSitterClient | ||
| } from "./chunk-node-q0cwyvm9.js"; | ||
| } from "./chunk-node-savhj5rp.js"; | ||
@@ -800,2 +800,3 @@ // src/testing/mock-keys.ts | ||
| multiplexer: "none", | ||
| image_protocol: "auto", | ||
| ...overrides, | ||
@@ -1004,3 +1005,3 @@ terminal: { | ||
| //# debugId=08D19767EB8430A064756E2164756E21 | ||
| //# debugId=61BD210642FDD57D64756E2164756E21 | ||
| //# sourceMappingURL=testing.js.map |
| import { RGBA } from "./lib/RGBA.js"; | ||
| import { type LineInfo, type RenderLib, type TextBufferViewHandle } from "./zig.js"; | ||
| import { type LineInfo, type MeasureResult, type RenderLib, type TextBufferViewHandle } from "./zig.js"; | ||
| import type { TextBuffer } from "./text-buffer.js"; | ||
@@ -36,8 +36,5 @@ export declare class TextBufferView { | ||
| setTruncate(truncate: boolean): void; | ||
| measureForDimensions(width: number, height: number): { | ||
| lineCount: number; | ||
| widthColsMax: number; | ||
| } | null; | ||
| measureForDimensions(width: number, height: number): MeasureResult | null; | ||
| getVirtualLineCount(): number; | ||
| destroy(): void; | ||
| } |
+8
-0
@@ -48,2 +48,3 @@ import type { RGBA } from "./lib/RGBA.js"; | ||
| export type TerminalCapabilityState = "unknown" | "supported" | "unsupported"; | ||
| export type ImageRenderProtocol = "auto" | "kitty" | "sixel" | "blocks"; | ||
| export interface TerminalInfo { | ||
@@ -75,2 +76,3 @@ name: string; | ||
| multiplexer: TerminalMultiplexer; | ||
| image_protocol?: ImageRenderProtocol; | ||
| terminal: TerminalInfo; | ||
@@ -100,2 +102,8 @@ } | ||
| height: number; | ||
| terminalWidth?: number; | ||
| terminalHeight?: number; | ||
| resolution?: { | ||
| width: number; | ||
| height: number; | ||
| } | null; | ||
| /** Monotonic, bumped once per `loop()` iteration. Lets renderables dedupe per-frame work. */ | ||
@@ -102,0 +110,0 @@ frameId: number; |
+1
-1
@@ -96,3 +96,3 @@ // @bun | ||
| yoga_default | ||
| } from "./chunk-bun-t2myhmwd.js"; | ||
| } from "./chunk-bun-ctxxvhwz.js"; | ||
| export { | ||
@@ -99,0 +99,0 @@ yoga_default as default, |
+1
-1
@@ -95,3 +95,3 @@ import { | ||
| yoga_default | ||
| } from "./chunk-node-q0cwyvm9.js"; | ||
| } from "./chunk-node-savhj5rp.js"; | ||
| export { | ||
@@ -98,0 +98,0 @@ yoga_default as default, |
+45
-24
@@ -47,2 +47,7 @@ import { type Pointer } from "./platform/ffi.js"; | ||
| unknown: number; | ||
| }>], readonly ["image_protocol", import("bun-ffi-structs").EnumDef<{ | ||
| auto: number; | ||
| kitty: number; | ||
| sixel: number; | ||
| blocks: number; | ||
| }>], readonly ["term_name", "char*"], readonly ["term_name_len", "u64", { | ||
@@ -58,2 +63,14 @@ readonly lengthOf: "term_name"; | ||
| export declare const EncodedCharStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["width", "u8"], readonly ["char", "u32"]], {}>; | ||
| export interface NativeImageInfo { | ||
| width: number; | ||
| height: number; | ||
| sourceWidth: number; | ||
| sourceHeight: number; | ||
| format: number; | ||
| colorStatus: number; | ||
| orientation: number; | ||
| hasAlpha: number; | ||
| } | ||
| export declare const NativeImageInfoStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["width", "u32"], readonly ["height", "u32"], readonly ["sourceWidth", "u32"], readonly ["sourceHeight", "u32"], readonly ["format", "u32"], readonly ["colorStatus", "u32"], readonly ["orientation", "u32"], readonly ["hasAlpha", "u32"]], {}>; | ||
| export declare const ImageDrawOptionsStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["x", "i32"], readonly ["y", "i32"], readonly ["width", "u32"], readonly ["height", "u32"], readonly ["pixelWidth", "u32"], readonly ["pixelHeight", "u32"], readonly ["sourceX", "u32"], readonly ["sourceY", "u32"], readonly ["sourceWidth", "u32"], readonly ["sourceHeight", "u32"], readonly ["protocol", "u32"]], {}>; | ||
| export declare const LineInfoStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["startCols", readonly ["u32"]], readonly ["startColsLen", "u32", { | ||
@@ -151,27 +168,21 @@ readonly lengthOf: "startCols"; | ||
| export declare const NativeSpanFeedStatsStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["bytesWritten", "u64"], readonly ["spansCommitted", "u64"], readonly ["chunks", "u32"], readonly ["pendingSpans", "u32"]], {}>; | ||
| export declare const SpanInfoStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["chunkPtr", "pointer"], readonly ["offset", "u32"], readonly ["len", "u32"], readonly ["chunkIndex", "u32"], readonly ["reserved", "u32", { | ||
| readonly default: 0; | ||
| }]], { | ||
| readonly reduceValue: (value: { | ||
| chunkPtr: Pointer; | ||
| offset: number; | ||
| len: number; | ||
| chunkIndex: number; | ||
| }) => { | ||
| chunkPtr: Pointer; | ||
| offset: number; | ||
| len: number; | ||
| chunkIndex: number; | ||
| }; | ||
| export declare const SpanInfoStruct: import("bun-ffi-structs").StructDef<{ | ||
| chunkPtr: Pointer; | ||
| offset: number; | ||
| len: number; | ||
| chunkIndex: number; | ||
| }, { | ||
| offset: number; | ||
| chunkPtr: ArrayBufferLike | import("bun-ffi-structs").Pointer | ArrayBufferView<ArrayBufferLike>; | ||
| len: number; | ||
| chunkIndex: number; | ||
| reserved?: number | null | undefined; | ||
| }>; | ||
| export declare const ReserveInfoStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["ptr", "pointer"], readonly ["len", "u32"], readonly ["reserved", "u32", { | ||
| readonly default: 0; | ||
| }]], { | ||
| readonly reduceValue: (value: { | ||
| ptr: Pointer; | ||
| len: number; | ||
| }) => { | ||
| ptr: Pointer; | ||
| len: number; | ||
| }; | ||
| export declare const ReserveInfoStruct: import("bun-ffi-structs").StructDef<{ | ||
| ptr: Pointer; | ||
| len: number; | ||
| }, { | ||
| len: number; | ||
| ptr: ArrayBufferLike | import("bun-ffi-structs").Pointer | ArrayBufferView<ArrayBufferLike>; | ||
| reserved?: number | null | undefined; | ||
| }>; | ||
@@ -258,2 +269,11 @@ export type AudioCreateOptions = { | ||
| }; | ||
| export type NativeAudioCaptureStats = { | ||
| framesReceived: bigint; | ||
| framesRead: bigint; | ||
| framesDropped: bigint; | ||
| sampleRate: number; | ||
| channels: number; | ||
| bufferedFrames: number; | ||
| capacityFrames: number; | ||
| }; | ||
| export declare const AudioCreateOptionsStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["sampleRate", "u32", { | ||
@@ -306,3 +326,4 @@ readonly default: 48000; | ||
| export declare const AudioStreamStatsStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["bytesReceived", "u64"], readonly ["framesDecoded", "u64"], readonly ["framesPlayed", "u64"], readonly ["state", "u32"], readonly ["sampleRate", "u32"], readonly ["channels", "u32"], readonly ["bufferedFrames", "u32"], readonly ["capacityFrames", "u32"], readonly ["underruns", "u32"], readonly ["errorCode", "i32"], readonly ["readyGeneration", "u32"]], {}>; | ||
| export declare const AudioCaptureStatsStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["framesReceived", "u64"], readonly ["framesRead", "u64"], readonly ["framesDropped", "u64"], readonly ["sampleRate", "u32"], readonly ["channels", "u32"], readonly ["bufferedFrames", "u32"], readonly ["capacityFrames", "u32"]], {}>; | ||
| export declare const AudioStatsStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["soundsLoaded", "u32"], readonly ["voicesActive", "u32"], readonly ["framesMixed", "u64"], readonly ["lockMisses", "u32"], readonly ["lastPeak", "f32"], readonly ["lastRms", "f32"]], {}>; | ||
| export {}; |
+70
-7
| import { type FFICallbackInstance, type Pointer } from "./platform/ffi.js"; | ||
| import { type CursorStyle, type CursorStyleOptions, type TargetChannel, type DebugOverlayCorner, type WidthMethod, type TerminalCapabilities, type Highlight, type LineInfo } from "./types.js"; | ||
| export type { LineInfo, AllocatorStats, AudioStreamCreateOptions, BuildOptions, NativeAudioStreamStats, NativeRenderStats, }; | ||
| import { type CursorStyle, type CursorStyleOptions, type TargetChannel, type DebugOverlayCorner, type WidthMethod, type TerminalCapabilities, type Highlight, type LineInfo, type ImageRenderProtocol } from "./types.js"; | ||
| export type { LineInfo, AllocatorStats, AudioStreamCreateOptions, BuildOptions, NativeAudioCaptureStats, NativeAudioStreamStats, NativeRenderStats, }; | ||
| import { RGBA } from "./lib/RGBA.js"; | ||
| import { OptimizedBuffer } from "./buffer.js"; | ||
| import { TextBuffer } from "./text-buffer.js"; | ||
| import type { NativeSpanFeedOptions, NativeSpanFeedStats, ReserveInfo, AudioCreateOptions, AudioStartOptions, AudioVoiceOptions, AudioStreamCreateOptions, NativeAudioStreamCloseReason as NativeAudioStreamCloseReasonType, NativeAudioStreamFormat as NativeAudioStreamFormatType, NativeAudioStreamState as NativeAudioStreamStateType, NativeAudioStreamStats, AudioStats, BuildOptions, AllocatorStats, NativeRenderStats } from "./zig-structs.js"; | ||
| import type { NativeSpanFeedOptions, NativeSpanFeedStats, ReserveInfo, AudioCreateOptions, AudioStartOptions, AudioVoiceOptions, AudioStreamCreateOptions, NativeAudioStreamCloseReason as NativeAudioStreamCloseReasonType, NativeAudioStreamFormat as NativeAudioStreamFormatType, NativeAudioStreamState as NativeAudioStreamStateType, NativeAudioStreamStats, NativeAudioCaptureStats, AudioStats, BuildOptions, AllocatorStats, NativeRenderStats, NativeImageInfo } from "./zig-structs.js"; | ||
| export declare const NativeAudioStreamState: { | ||
@@ -42,2 +42,3 @@ readonly Initializing: 0; | ||
| export type NativeRenderableHandle = NativeHandle<"native_renderable">; | ||
| export type ImageHandle = NativeHandle<"image">; | ||
| export declare enum LogLevel { | ||
@@ -67,2 +68,6 @@ Error = 0, | ||
| } | ||
| export interface MeasureResult { | ||
| lineCount: number; | ||
| widthColsMax: number; | ||
| } | ||
| export interface CursorState { | ||
@@ -113,2 +118,19 @@ x: number; | ||
| audioClearPlaybackDeviceSelection: (engine: AudioEngineHandle) => void; | ||
| audioRefreshCaptureDevices: (engine: AudioEngineHandle) => number; | ||
| audioGetCaptureDeviceCount: (engine: AudioEngineHandle) => number; | ||
| audioGetCaptureDeviceName: (engine: AudioEngineHandle, index: number) => string; | ||
| audioIsCaptureDeviceDefault: (engine: AudioEngineHandle, index: number) => boolean; | ||
| audioSelectCaptureDevice: (engine: AudioEngineHandle, index: number) => number; | ||
| audioClearCaptureDeviceSelection: (engine: AudioEngineHandle) => void; | ||
| audioStartCapture: (engine: AudioEngineHandle, options: AudioStartOptions | undefined, channels: number, capacityFrames: number) => number; | ||
| audioStopCapture: (engine: AudioEngineHandle) => number; | ||
| audioIsCaptureRunning: (engine: AudioEngineHandle) => boolean; | ||
| audioReadCapture: (engine: AudioEngineHandle, outBuffer: Float32Array, frameCount: number) => { | ||
| status: number; | ||
| framesRead: number; | ||
| }; | ||
| audioGetCaptureStats: (engine: AudioEngineHandle) => { | ||
| status: number; | ||
| stats: NativeAudioCaptureStats | null; | ||
| }; | ||
| audioStart: (engine: AudioEngineHandle, options?: AudioStartOptions | null) => number; | ||
@@ -201,2 +223,3 @@ audioStartMixer: (engine: AudioEngineHandle) => number; | ||
| bufferDrawSuperSampleBuffer: (buffer: OptimizedBufferHandle, x: number, y: number, pixelDataPtr: Pointer, pixelDataLength: number, format: "bgra8unorm" | "rgba8unorm", alignedBytesPerRow: number) => void; | ||
| bufferDrawImage: (buffer: OptimizedBufferHandle, image: ImageHandle, x: number, y: number, width: number, height: number, pixelWidth: number, pixelHeight: number, sourceX: number, sourceY: number, sourceWidth: number, sourceHeight: number, protocol: ImageRenderProtocol) => boolean; | ||
| bufferDrawPackedBuffer: (buffer: OptimizedBufferHandle, dataPtr: Pointer, dataLen: number, posX: number, posY: number, terminalWidthCells: number, terminalHeightCells: number) => void; | ||
@@ -354,6 +377,3 @@ bufferDrawGrayscaleBuffer: (buffer: OptimizedBufferHandle, posX: number, posY: number, intensitiesPtr: Pointer, srcWidth: number, srcHeight: number, fg: RGBA | null, bg: RGBA | null) => void; | ||
| textBufferViewSetTruncate: (view: TextBufferViewHandle, truncate: boolean) => void; | ||
| textBufferViewMeasureForDimensions: (view: TextBufferViewHandle, width: number, height: number) => { | ||
| lineCount: number; | ||
| widthColsMax: number; | ||
| } | null; | ||
| textBufferViewMeasureForDimensions: (view: TextBufferViewHandle, width: number, height: number) => MeasureResult | null; | ||
| textBufferViewGetVirtualLineCount: (view: TextBufferViewHandle) => number; | ||
@@ -494,2 +514,45 @@ readonly encoder: TextEncoder; | ||
| syntaxStyleGetStyleCount: (style: SyntaxStyleHandle) => number; | ||
| imageInfo: (data: Uint8Array) => { | ||
| status: number; | ||
| info: NativeImageInfo; | ||
| }; | ||
| imageDecode: (data: Uint8Array) => { | ||
| status: number; | ||
| handle: ImageHandle | null; | ||
| }; | ||
| imageCreateFromRgba: (pixels: Uint8Array, width: number, height: number, stride: number) => { | ||
| status: number; | ||
| handle: ImageHandle | null; | ||
| }; | ||
| imageDestroy: (image: ImageHandle) => void; | ||
| imageGetInfo: (image: ImageHandle) => { | ||
| status: number; | ||
| info: NativeImageInfo; | ||
| }; | ||
| imageGetPixelsPtr: (image: ImageHandle) => Pointer | null; | ||
| imageClone: (image: ImageHandle) => { | ||
| status: number; | ||
| handle: ImageHandle | null; | ||
| }; | ||
| imageCopyPixels: (image: ImageHandle, destination: Uint8Array, stride: number, bgra: boolean) => number; | ||
| imageResize: (image: ImageHandle, width: number, height: number, filter: number) => { | ||
| status: number; | ||
| handle: ImageHandle | null; | ||
| }; | ||
| imageExtract: (image: ImageHandle, left: number, top: number, width: number, height: number) => { | ||
| status: number; | ||
| handle: ImageHandle | null; | ||
| }; | ||
| imageExtend: (image: ImageHandle, top: number, right: number, bottom: number, left: number, background: Uint8Array) => { | ||
| status: number; | ||
| handle: ImageHandle | null; | ||
| }; | ||
| imageTransform: (image: ImageHandle, operation: number) => { | ||
| status: number; | ||
| handle: ImageHandle | null; | ||
| }; | ||
| imageComposite: (base: ImageHandle, overlay: ImageHandle, left: number, top: number, blend: number, opacity: number) => { | ||
| status: number; | ||
| handle: ImageHandle | null; | ||
| }; | ||
| getTerminalCapabilities: (renderer: RendererHandle) => TerminalCapabilities; | ||
@@ -496,0 +559,0 @@ processCapabilityResponse: (renderer: RendererHandle, response: string) => void; |
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
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.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 4 instances
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 3 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.
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
13049110
5.79%180
1.12%102627
7.14%54
14.89%35
150%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated