@opentui/core 0.1.36 → 0.1.38

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/lib/index.d.ts CHANGED
@@ -15,3 +15,4 @@ export * from "./tree-sitter-styled-text";
15
15
  export * from "./tree-sitter";
16
16
  export * from "./data-paths";
17
17
  export * from "./extmarks";
18
+ export * from "./terminal-palette";
@@ -0,0 +1,38 @@
1
+ type Hex = string | null;
2
+ export type WriteFunction = (data: string | Buffer) => boolean;
3
+ export interface TerminalColors {
4
+ palette: Hex[];
5
+ defaultForeground: Hex;
6
+ defaultBackground: Hex;
7
+ cursorColor: Hex;
8
+ mouseForeground: Hex;
9
+ mouseBackground: Hex;
10
+ tekForeground: Hex;
11
+ tekBackground: Hex;
12
+ highlightBackground: Hex;
13
+ highlightForeground: Hex;
14
+ }
15
+ export interface GetPaletteOptions {
16
+ timeout?: number;
17
+ size?: number;
18
+ }
19
+ export interface TerminalPaletteDetector {
20
+ detect(options?: GetPaletteOptions): Promise<TerminalColors>;
21
+ detectOSCSupport(timeoutMs?: number): Promise<boolean>;
22
+ cleanup(): void;
23
+ }
24
+ export declare class TerminalPalette implements TerminalPaletteDetector {
25
+ private stdin;
26
+ private stdout;
27
+ private writeFn;
28
+ private activeListeners;
29
+ private activeTimers;
30
+ constructor(stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, writeFn?: WriteFunction);
31
+ cleanup(): void;
32
+ detectOSCSupport(timeoutMs?: number): Promise<boolean>;
33
+ private queryPalette;
34
+ private querySpecialColors;
35
+ detect(options?: GetPaletteOptions): Promise<TerminalColors>;
36
+ }
37
+ export declare function createTerminalPalette(stdin: NodeJS.ReadStream, stdout: NodeJS.WriteStream, writeFn?: WriteFunction): TerminalPaletteDetector;
38
+ export {};
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.1.36",
7
+ "version": "0.1.38",
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.1.36",
59
- "@opentui/core-darwin-arm64": "0.1.36",
60
- "@opentui/core-linux-x64": "0.1.36",
61
- "@opentui/core-linux-arm64": "0.1.36",
62
- "@opentui/core-win32-x64": "0.1.36",
63
- "@opentui/core-win32-arm64": "0.1.36"
58
+ "@opentui/core-darwin-x64": "0.1.38",
59
+ "@opentui/core-darwin-arm64": "0.1.38",
60
+ "@opentui/core-linux-x64": "0.1.38",
61
+ "@opentui/core-linux-arm64": "0.1.38",
62
+ "@opentui/core-win32-x64": "0.1.38",
63
+ "@opentui/core-win32-arm64": "0.1.38"
64
64
  }
65
65
  }
@@ -12,7 +12,7 @@ declare class ContentRenderable extends BoxRenderable {
12
12
  constructor(ctx: RenderContext, viewport: BoxRenderable, viewportCulling: boolean, options: RenderableOptions<BoxRenderable>);
13
13
  get viewportCulling(): boolean;
14
14
  set viewportCulling(value: boolean);
15
- protected _getChildren(): Renderable[];
15
+ protected _getVisibleChildren(): number[];
16
16
  }
17
17
  export interface ScrollBoxOptions extends BoxOptions<ScrollBoxRenderable> {
18
18
  rootOptions?: BoxOptions;
@@ -57,6 +57,7 @@ export declare class ScrollBoxRenderable extends BoxRenderable {
57
57
  private _stickyScrollRight;
58
58
  private _stickyStart?;
59
59
  private _hasManualScroll;
60
+ private _isApplyingStickyScroll;
60
61
  private scrollAccel;
61
62
  get stickyScroll(): boolean;
62
63
  set stickyScroll(value: boolean);
@@ -80,6 +81,7 @@ export declare class ScrollBoxRenderable extends BoxRenderable {
80
81
  x: number;
81
82
  y: number;
82
83
  }): void;
84
+ private isAtStickyPosition;
83
85
  add(obj: Renderable | VNode<any, any[]>, index?: number): number;
84
86
  insertBefore(obj: Renderable | VNode<any, any[]> | unknown, anchor?: Renderable | unknown): number;
85
87
  remove(id: string): void;
package/renderer.d.ts CHANGED
@@ -9,6 +9,7 @@ import { type MouseEventType, type RawMouseEvent, type ScrollInfo } from "./lib/
9
9
  import { Selection } from "./lib/selection";
10
10
  import { EventEmitter } from "events";
11
11
  import { KeyHandler, InternalKeyHandler } from "./lib/KeyHandler";
12
+ import { type TerminalColors, type GetPaletteOptions } from "./lib/terminal-palette";
12
13
  export interface CliRendererConfig {
13
14
  stdin?: NodeJS.ReadStream;
14
15
  stdout?: NodeJS.WriteStream;
@@ -153,6 +154,9 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
153
154
  private _currentFocusedRenderable;
154
155
  private lifecyclePasses;
155
156
  private _openConsoleOnError;
157
+ private _paletteDetector;
158
+ private _cachedPalette;
159
+ private _paletteDetectionPromise;
156
160
  private handleError;
157
161
  private dumpOutputCache;
158
162
  private exitHandler;
@@ -271,4 +275,13 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
271
275
  private finishSelection;
272
276
  private notifySelectablesOfSelectionChange;
273
277
  private walkSelectableRenderables;
278
+ get paletteDetectionStatus(): "idle" | "detecting" | "cached";
279
+ clearPaletteCache(): void;
280
+ /**
281
+ * Detects the terminal's color palette
282
+ *
283
+ * @returns Promise resolving to TerminalColors object containing palette and special colors
284
+ * @throws Error if renderer is suspended
285
+ */
286
+ getPalette(options?: GetPaletteOptions): Promise<TerminalColors>;
274
287
  }
package/testing.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  CliRenderer,
5
5
  TreeSitterClient,
6
6
  resolveRenderLib
7
- } from "./index-n8nbvvhk.js";
7
+ } from "./index-7bav3fax.js";
8
8
 
9
9
  // src/testing/mock-keys.ts
10
10
  var KeyCodes = {