@opentui/core 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "type": "module",
7
- "version": "0.4.3",
7
+ "version": "0.4.4",
8
8
  "description": "OpenTUI is a TypeScript library on a native Zig core for building terminal user interfaces (TUIs)",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -65,13 +65,13 @@
65
65
  "web-tree-sitter": "0.25.10"
66
66
  },
67
67
  "optionalDependencies": {
68
- "@opentui/core-darwin-x64": "0.4.3",
69
- "@opentui/core-darwin-arm64": "0.4.3",
70
- "@opentui/core-linux-x64": "0.4.3",
71
- "@opentui/core-linux-arm64": "0.4.3",
72
- "@opentui/core-win32-x64": "0.4.3",
73
- "@opentui/core-win32-arm64": "0.4.3",
74
- "@opentui/core-linux-x64-musl": "0.4.3",
75
- "@opentui/core-linux-arm64-musl": "0.4.3"
68
+ "@opentui/core-darwin-x64": "0.4.4",
69
+ "@opentui/core-darwin-arm64": "0.4.4",
70
+ "@opentui/core-linux-x64": "0.4.4",
71
+ "@opentui/core-linux-arm64": "0.4.4",
72
+ "@opentui/core-win32-x64": "0.4.4",
73
+ "@opentui/core-win32-arm64": "0.4.4",
74
+ "@opentui/core-linux-x64-musl": "0.4.4",
75
+ "@opentui/core-linux-arm64-musl": "0.4.4"
76
76
  }
77
77
  }
@@ -0,0 +1 @@
1
+ export declare function allocateProportionalColumnWidths(widths: number[], targetWidth: number, minWidth: number): number[];
@@ -27,6 +27,7 @@ declare class AsyncExpectation<T> {
27
27
  toBeNull(): Promise<void>;
28
28
  toBeUndefined(): Promise<void>;
29
29
  toContain(expected: unknown): Promise<void>;
30
+ toHaveProperty(property: PropertyKey, expectedValue?: unknown): Promise<void>;
30
31
  toMatchSnapshot(snapshotName?: string): Promise<void>;
31
32
  toMatchInlineSnapshot(snapshot: string): Promise<void>;
32
33
  toThrow(expected?: ThrowMatcher): Promise<void>;
package/testing.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ANSI,
3
3
  CliRenderer
4
- } from "./index-xt9f071j.js";
4
+ } from "./index-7z5n7k9m.js";
5
5
  import {
6
6
  SystemClock,
7
7
  TreeSitterClient
8
- } from "./index-d5xqskty.js";
8
+ } from "./index-za1krqsf.js";
9
9
 
10
10
  // src/testing/mock-keys.ts
11
11
  import { Buffer as Buffer2 } from "node:buffer";
package/yoga.js CHANGED
@@ -92,7 +92,7 @@ import {
92
92
  WRAP_WRAP_REVERSE,
93
93
  Wrap,
94
94
  yoga_default
95
- } from "./index-d5xqskty.js";
95
+ } from "./index-za1krqsf.js";
96
96
  export {
97
97
  yoga_default as default,
98
98
  Wrap,
package/zig-structs.d.ts CHANGED
@@ -199,6 +199,51 @@ export type AudioVoiceOptions = {
199
199
  loop?: boolean;
200
200
  groupId?: number;
201
201
  };
202
+ export declare const NativeAudioStreamFormat: {
203
+ readonly Mp3: 1;
204
+ readonly Flac: 2;
205
+ };
206
+ export type NativeAudioStreamFormat = (typeof NativeAudioStreamFormat)[keyof typeof NativeAudioStreamFormat];
207
+ export type AudioStreamCreateOptions = {
208
+ capacityMs: number;
209
+ startupMs: number;
210
+ resumeMs: number;
211
+ volume: number;
212
+ pan: number;
213
+ groupId: number;
214
+ maxProbeBytes: number;
215
+ format: NativeAudioStreamFormat;
216
+ };
217
+ export type NativeAudioStreamStats = {
218
+ bytesReceived: bigint;
219
+ framesDecoded: bigint;
220
+ framesPlayed: bigint;
221
+ state: number;
222
+ sampleRate: number;
223
+ channels: number;
224
+ bufferedFrames: number;
225
+ capacityFrames: number;
226
+ underruns: number;
227
+ errorCode: number;
228
+ readyGeneration: number;
229
+ };
230
+ export declare const NativeAudioStreamState: {
231
+ readonly Initializing: 0;
232
+ readonly Buffering: 1;
233
+ readonly Playing: 2;
234
+ readonly Ended: 3;
235
+ readonly Failed: 4;
236
+ readonly Cancelled: 5;
237
+ readonly Reconnecting: 6;
238
+ };
239
+ export type NativeAudioStreamState = (typeof NativeAudioStreamState)[keyof typeof NativeAudioStreamState];
240
+ export declare const NativeAudioStreamStateNames: readonly ["initializing", "buffering", "playing", "ended", "errored", "disposed", "reconnecting"];
241
+ export declare const NativeAudioStreamCloseReason: {
242
+ readonly PreserveNativeTerminal: 0;
243
+ readonly TransportError: 1;
244
+ readonly Disposed: 2;
245
+ };
246
+ export type NativeAudioStreamCloseReason = (typeof NativeAudioStreamCloseReason)[keyof typeof NativeAudioStreamCloseReason];
202
247
  export type AudioStats = {
203
248
  soundsLoaded: number;
204
249
  voicesActive: number;
@@ -252,5 +297,7 @@ export declare const AudioVoiceOptionsStruct: import("bun-ffi-structs").DefineSt
252
297
  }], readonly ["groupId", "u32", {
253
298
  readonly default: 0;
254
299
  }]], {}>;
300
+ export declare const AudioStreamCreateOptionsStruct: import("bun-ffi-structs").DefineStructReturnType<[readonly ["capacityMs", "u32"], readonly ["startupMs", "u32"], readonly ["resumeMs", "u32"], readonly ["volume", "f32"], readonly ["pan", "f32"], readonly ["groupId", "u32"], readonly ["maxProbeBytes", "u32"], readonly ["format", "u32"]], {}>;
301
+ 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"]], {}>;
255
302
  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"]], {}>;
256
303
  export {};
package/zig.d.ts CHANGED
@@ -1,10 +1,31 @@
1
1
  import { type FFICallbackInstance, type Pointer } from "./platform/ffi.js";
2
2
  import { type CursorStyle, type CursorStyleOptions, type TargetChannel, type DebugOverlayCorner, type WidthMethod, type TerminalCapabilities, type Highlight, type LineInfo } from "./types.js";
3
- export type { LineInfo, AllocatorStats, BuildOptions, NativeRenderStats };
3
+ export type { LineInfo, AllocatorStats, AudioStreamCreateOptions, BuildOptions, NativeAudioStreamStats, NativeRenderStats, };
4
4
  import { RGBA } from "./lib/RGBA.js";
5
5
  import { OptimizedBuffer } from "./buffer.js";
6
6
  import { TextBuffer } from "./text-buffer.js";
7
- import type { NativeSpanFeedOptions, NativeSpanFeedStats, ReserveInfo, AudioCreateOptions, AudioStartOptions, AudioVoiceOptions, AudioStats, BuildOptions, AllocatorStats, NativeRenderStats } from "./zig-structs.js";
7
+ 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";
8
+ export declare const NativeAudioStreamState: {
9
+ readonly Initializing: 0;
10
+ readonly Buffering: 1;
11
+ readonly Playing: 2;
12
+ readonly Ended: 3;
13
+ readonly Failed: 4;
14
+ readonly Cancelled: 5;
15
+ readonly Reconnecting: 6;
16
+ };
17
+ export type NativeAudioStreamState = NativeAudioStreamStateType;
18
+ export declare const NativeAudioStreamCloseReason: {
19
+ readonly PreserveNativeTerminal: 0;
20
+ readonly TransportError: 1;
21
+ readonly Disposed: 2;
22
+ };
23
+ export type NativeAudioStreamCloseReason = NativeAudioStreamCloseReasonType;
24
+ export declare const NativeAudioStreamFormat: {
25
+ readonly Mp3: 1;
26
+ readonly Flac: 2;
27
+ };
28
+ export type NativeAudioStreamFormat = NativeAudioStreamFormatType;
8
29
  export type NativeHandle<T extends string> = Pointer & {
9
30
  readonly __nativeHandle: T;
10
31
  };
@@ -90,6 +111,21 @@ export interface AudioEngineLib {
90
111
  audioStart: (engine: AudioEngineHandle, options?: AudioStartOptions | null) => number;
91
112
  audioStartMixer: (engine: AudioEngineHandle) => number;
92
113
  audioStop: (engine: AudioEngineHandle) => number;
114
+ audioCreateStream: (engine: AudioEngineHandle, options: AudioStreamCreateOptions) => {
115
+ status: number;
116
+ streamId: number | null;
117
+ };
118
+ audioWriteStream: (engine: AudioEngineHandle, streamId: number, data: Uint8Array) => number;
119
+ audioEndStream: (engine: AudioEngineHandle, streamId: number) => number;
120
+ audioRestartStream: (engine: AudioEngineHandle, streamId: number) => number;
121
+ audioSetStreamVolume: (engine: AudioEngineHandle, streamId: number, volume: number) => number;
122
+ audioSetStreamPan: (engine: AudioEngineHandle, streamId: number, pan: number) => number;
123
+ audioSetStreamGroup: (engine: AudioEngineHandle, streamId: number, groupId: number) => number;
124
+ audioGetStreamStats: (engine: AudioEngineHandle, streamId: number) => NativeAudioStreamStats | null;
125
+ audioCloseStream: (engine: AudioEngineHandle, streamId: number, reason: NativeAudioStreamCloseReason) => {
126
+ status: number;
127
+ stats: NativeAudioStreamStats | null;
128
+ };
93
129
  audioLoad: (engine: AudioEngineHandle, data: Uint8Array) => {
94
130
  status: number;
95
131
  soundId: number | null;