@opentui/core 0.1.41 → 0.1.43
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/3d.js +1 -1
- package/console.d.ts +2 -0
- package/{index-kj9k00yt.js → index-23t1sg60.js} +125 -87
- package/{index-kj9k00yt.js.map → index-23t1sg60.js.map} +6 -6
- package/index.js +34 -28
- package/index.js.map +4 -4
- package/lib/ascii.font.d.ts +4 -4
- package/lib/extmarks.d.ts +1 -1
- package/package.json +8 -8
- package/renderables/ASCIIFont.d.ts +28 -19
- package/renderer.d.ts +2 -0
- package/testing.js +1 -1
package/lib/ascii.font.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OptimizedBuffer } from "../buffer";
|
|
2
|
-
import {
|
|
2
|
+
import { type ColorInput } from "./RGBA";
|
|
3
3
|
export type ASCIIFontName = "tiny" | "block" | "shade" | "slick";
|
|
4
4
|
export declare const fonts: {
|
|
5
5
|
tiny: {
|
|
@@ -288,12 +288,12 @@ export declare function measureText({ text, font }: {
|
|
|
288
288
|
};
|
|
289
289
|
export declare function getCharacterPositions(text: string, font?: keyof typeof fonts): number[];
|
|
290
290
|
export declare function coordinateToCharacterIndex(x: number, text: string, font?: keyof typeof fonts): number;
|
|
291
|
-
export declare function renderFontToFrameBuffer(buffer: OptimizedBuffer, { text, x, y,
|
|
291
|
+
export declare function renderFontToFrameBuffer(buffer: OptimizedBuffer, { text, x, y, color, backgroundColor, font, }: {
|
|
292
292
|
text: string;
|
|
293
293
|
x?: number;
|
|
294
294
|
y?: number;
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
color?: ColorInput | ColorInput[];
|
|
296
|
+
backgroundColor?: ColorInput;
|
|
297
297
|
font?: keyof typeof fonts;
|
|
298
298
|
}): {
|
|
299
299
|
width: number;
|
package/lib/extmarks.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export declare class ExtmarksController {
|
|
|
67
67
|
private offsetToPosition;
|
|
68
68
|
private positionToOffset;
|
|
69
69
|
private updateHighlights;
|
|
70
|
-
private
|
|
70
|
+
private offsetExcludingNewlines;
|
|
71
71
|
create(options: ExtmarkOptions): number;
|
|
72
72
|
delete(id: number): boolean;
|
|
73
73
|
get(id: number): Extmark | null;
|
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.
|
|
7
|
+
"version": "0.1.43",
|
|
8
8
|
"description": "OpenTUI is a TypeScript library for building terminal user interfaces (TUIs)",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
},
|
|
53
53
|
"optionalDependencies": {
|
|
54
54
|
"@dimforge/rapier2d-simd-compat": "^0.17.3",
|
|
55
|
-
"bun-webgpu": "0.1.
|
|
55
|
+
"bun-webgpu": "0.1.4",
|
|
56
56
|
"planck": "^1.4.2",
|
|
57
57
|
"three": "0.177.0",
|
|
58
|
-
"@opentui/core-darwin-x64": "0.1.
|
|
59
|
-
"@opentui/core-darwin-arm64": "0.1.
|
|
60
|
-
"@opentui/core-linux-x64": "0.1.
|
|
61
|
-
"@opentui/core-linux-arm64": "0.1.
|
|
62
|
-
"@opentui/core-win32-x64": "0.1.
|
|
63
|
-
"@opentui/core-win32-arm64": "0.1.
|
|
58
|
+
"@opentui/core-darwin-x64": "0.1.43",
|
|
59
|
+
"@opentui/core-darwin-arm64": "0.1.43",
|
|
60
|
+
"@opentui/core-linux-x64": "0.1.43",
|
|
61
|
+
"@opentui/core-linux-arm64": "0.1.43",
|
|
62
|
+
"@opentui/core-win32-x64": "0.1.43",
|
|
63
|
+
"@opentui/core-win32-arm64": "0.1.43"
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -1,37 +1,46 @@
|
|
|
1
|
+
import { type ASCIIFontName, type fonts } from "../lib/ascii.font";
|
|
2
|
+
import { type ColorInput } from "../lib/RGBA";
|
|
3
|
+
import { Selection, type LocalSelectionBounds } from "../lib/selection";
|
|
1
4
|
import type { RenderableOptions } from "../Renderable";
|
|
2
|
-
import { Selection } from "../lib/selection";
|
|
3
|
-
import { type fonts, type ASCIIFontName } from "../lib/ascii.font";
|
|
4
|
-
import { RGBA } from "../lib/RGBA";
|
|
5
|
-
import { FrameBufferRenderable } from "./FrameBuffer";
|
|
6
5
|
import type { RenderContext } from "../types";
|
|
6
|
+
import { FrameBufferRenderable } from "./FrameBuffer";
|
|
7
7
|
export interface ASCIIFontOptions extends Omit<RenderableOptions<ASCIIFontRenderable>, "width" | "height"> {
|
|
8
8
|
text?: string;
|
|
9
9
|
font?: ASCIIFontName;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
selectionBg?:
|
|
13
|
-
selectionFg?:
|
|
10
|
+
color?: ColorInput | ColorInput[];
|
|
11
|
+
backgroundColor?: ColorInput;
|
|
12
|
+
selectionBg?: ColorInput;
|
|
13
|
+
selectionFg?: ColorInput;
|
|
14
14
|
selectable?: boolean;
|
|
15
15
|
}
|
|
16
16
|
export declare class ASCIIFontRenderable extends FrameBufferRenderable {
|
|
17
17
|
selectable: boolean;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
protected static readonly _defaultOptions: {
|
|
19
|
+
text: string;
|
|
20
|
+
font: "tiny";
|
|
21
|
+
color: string;
|
|
22
|
+
backgroundColor: string;
|
|
23
|
+
selectionBg: undefined;
|
|
24
|
+
selectionFg: undefined;
|
|
25
|
+
selectable: true;
|
|
26
|
+
};
|
|
27
|
+
protected _text: string;
|
|
28
|
+
protected _font: keyof typeof fonts;
|
|
29
|
+
protected _color: ColorInput | ColorInput[];
|
|
30
|
+
protected _backgroundColor: ColorInput;
|
|
31
|
+
protected _selectionBg: ColorInput | undefined;
|
|
32
|
+
protected _selectionFg: ColorInput | undefined;
|
|
33
|
+
protected lastLocalSelection: LocalSelectionBounds | null;
|
|
25
34
|
private selectionHelper;
|
|
26
35
|
constructor(ctx: RenderContext, options: ASCIIFontOptions);
|
|
27
36
|
get text(): string;
|
|
28
37
|
set text(value: string);
|
|
29
38
|
get font(): keyof typeof fonts;
|
|
30
39
|
set font(value: keyof typeof fonts);
|
|
31
|
-
get
|
|
32
|
-
set
|
|
33
|
-
get
|
|
34
|
-
set
|
|
40
|
+
get color(): ColorInput | ColorInput[];
|
|
41
|
+
set color(value: ColorInput | ColorInput[]);
|
|
42
|
+
get backgroundColor(): ColorInput;
|
|
43
|
+
set backgroundColor(value: ColorInput);
|
|
35
44
|
private updateDimensions;
|
|
36
45
|
shouldStartSelection(x: number, y: number): boolean;
|
|
37
46
|
onSelectionChanged(selection: Selection | null): boolean;
|
package/renderer.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export interface CliRendererConfig {
|
|
|
31
31
|
backgroundColor?: ColorInput;
|
|
32
32
|
openConsoleOnError?: boolean;
|
|
33
33
|
prependInputHandlers?: ((sequence: string) => boolean)[];
|
|
34
|
+
onDestroy?: () => void;
|
|
34
35
|
}
|
|
35
36
|
export type PixelResolution = {
|
|
36
37
|
width: number;
|
|
@@ -159,6 +160,7 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
159
160
|
private _paletteDetector;
|
|
160
161
|
private _cachedPalette;
|
|
161
162
|
private _paletteDetectionPromise;
|
|
163
|
+
private _onDestroy?;
|
|
162
164
|
private inputHandlers;
|
|
163
165
|
private prependedInputHandlers;
|
|
164
166
|
private handleError;
|