@opentui/core 0.0.0-20251031-fc297165 → 0.0.0-20251102-23e7b561

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.
@@ -10,6 +10,7 @@ export declare class KeyEvent implements ParsedKey {
10
10
  number: boolean;
11
11
  raw: string;
12
12
  eventType: KeyEventType;
13
+ source: "raw" | "kitty";
13
14
  code?: string;
14
15
  super?: boolean;
15
16
  hyper?: boolean;
@@ -37,11 +38,13 @@ export type KeyHandlerEventMap = {
37
38
  export declare class KeyHandler extends EventEmitter<KeyHandlerEventMap> {
38
39
  protected stdin: NodeJS.ReadStream;
39
40
  protected useKittyKeyboard: boolean;
40
- protected listener: (key: Buffer) => void;
41
41
  protected pasteMode: boolean;
42
42
  protected pasteBuffer: string[];
43
43
  private suspended;
44
+ private stdinBuffer;
45
+ private dataListener;
44
46
  constructor(stdin?: NodeJS.ReadStream, useKittyKeyboard?: boolean);
47
+ private processSequence;
45
48
  destroy(): void;
46
49
  suspend(): void;
47
50
  resume(): void;
package/lib/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./hast-styled-text";
5
5
  export * from "./RGBA";
6
6
  export * from "./parse.keypress";
7
7
  export * from "./scroll-acceleration";
8
+ export * from "./stdin-buffer";
8
9
  export * from "./styled-text";
9
10
  export * from "./yoga.options";
10
11
  export * from "./parse.mouse";
@@ -11,6 +11,7 @@ export interface ParsedKey {
11
11
  number: boolean;
12
12
  raw: string;
13
13
  eventType: KeyEventType;
14
+ source: "raw" | "kitty";
14
15
  code?: string;
15
16
  super?: boolean;
16
17
  hyper?: boolean;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * StdinBuffer wraps a stdin stream and emits complete sequences.
3
+ *
4
+ * This is necessary because stdin data events can arrive in partial chunks,
5
+ * especially for escape sequences like mouse events. Without buffering,
6
+ * partial sequences can be misinterpreted as regular keypresses.
7
+ *
8
+ * For example, the mouse SGR sequence `\x1b[<35;20;5m` might arrive as:
9
+ * - Event 1: `\x1b`
10
+ * - Event 2: `[<35`
11
+ * - Event 3: `;20;5m`
12
+ *
13
+ * The buffer accumulates these until a complete sequence is detected.
14
+ */
15
+ import { EventEmitter } from "events";
16
+ export type StdinBufferOptions = {
17
+ /**
18
+ * Maximum time to wait for sequence completion (default: 10ms)
19
+ * After this time, the buffer is flushed even if incomplete
20
+ */
21
+ timeout?: number;
22
+ };
23
+ export type StdinBufferEventMap = {
24
+ data: [string];
25
+ };
26
+ /**
27
+ * Wraps a stdin stream and emits complete sequences via the 'data' event.
28
+ * Handles partial escape sequences that arrive across multiple chunks.
29
+ */
30
+ export declare class StdinBuffer extends EventEmitter<StdinBufferEventMap> {
31
+ private buffer;
32
+ private timeout;
33
+ private readonly timeoutMs;
34
+ private readonly stdin;
35
+ private readonly stdinListener;
36
+ constructor(stdin: NodeJS.ReadStream, options?: StdinBufferOptions);
37
+ private handleData;
38
+ flush(): string[];
39
+ clear(): void;
40
+ getBuffer(): string;
41
+ destroy(): void;
42
+ }
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.0.0-20251031-fc297165",
7
+ "version": "0.0.0-20251102-23e7b561",
8
8
  "description": "OpenTUI is a TypeScript library for building terminal user interfaces (TUIs)",
9
9
  "license": "MIT",
10
10
  "repository": {
@@ -55,11 +55,11 @@
55
55
  "bun-webgpu": "0.1.3",
56
56
  "planck": "^1.4.2",
57
57
  "three": "0.177.0",
58
- "@opentui/core-darwin-x64": "0.0.0-20251031-fc297165",
59
- "@opentui/core-darwin-arm64": "0.0.0-20251031-fc297165",
60
- "@opentui/core-linux-x64": "0.0.0-20251031-fc297165",
61
- "@opentui/core-linux-arm64": "0.0.0-20251031-fc297165",
62
- "@opentui/core-win32-x64": "0.0.0-20251031-fc297165",
63
- "@opentui/core-win32-arm64": "0.0.0-20251031-fc297165"
58
+ "@opentui/core-darwin-x64": "0.0.0-20251102-23e7b561",
59
+ "@opentui/core-darwin-arm64": "0.0.0-20251102-23e7b561",
60
+ "@opentui/core-linux-x64": "0.0.0-20251102-23e7b561",
61
+ "@opentui/core-linux-arm64": "0.0.0-20251102-23e7b561",
62
+ "@opentui/core-win32-x64": "0.0.0-20251102-23e7b561",
63
+ "@opentui/core-win32-arm64": "0.0.0-20251102-23e7b561"
64
64
  }
65
65
  }
@@ -39,6 +39,7 @@ export declare class BoxRenderable extends Renderable {
39
39
  focusedBorderColor: string;
40
40
  };
41
41
  constructor(ctx: RenderContext, options: BoxOptions);
42
+ private initializeBorder;
42
43
  get customBorderChars(): BorderCharacters | undefined;
43
44
  set customBorderChars(value: BorderCharacters | undefined);
44
45
  get backgroundColor(): RGBA;
package/testing.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  ANSI,
4
4
  CliRenderer,
5
5
  resolveRenderLib
6
- } from "./index-vr8t68wb.js";
6
+ } from "./index-rzgaxyf4.js";
7
7
 
8
8
  // src/testing/mock-keys.ts
9
9
  var KeyCodes = {