@opentui/core 0.1.1 → 0.1.3
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 +807 -274
- package/README.md +4 -4
- package/Renderable.d.ts +52 -28
- package/index.d.ts +1 -0
- package/index.js +627 -325
- package/lib/TrackedNode.d.ts +0 -1
- package/lib/yoga.options.d.ts +31 -0
- package/package.json +8 -8
- package/renderables/ASCIIFont.d.ts +1 -1
- package/renderables/Box.d.ts +4 -4
- package/renderables/Input.d.ts +23 -20
- package/renderables/Select.d.ts +37 -25
- package/renderables/TabSelect.d.ts +1 -1
- package/renderables/Text.d.ts +1 -1
- package/LICENSE +0 -21
package/lib/TrackedNode.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ declare class TrackedNode<T extends NodeMetadata = NodeMetadata> extends EventEm
|
|
|
9
9
|
metadata: T;
|
|
10
10
|
parent: TrackedNode<any> | null;
|
|
11
11
|
children: TrackedNode<any>[];
|
|
12
|
-
zIndex: number;
|
|
13
12
|
protected _destroyed: boolean;
|
|
14
13
|
protected _width: number | "auto" | `${number}%`;
|
|
15
14
|
protected _height: number | "auto" | `${number}%`;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BoxSizing, Align, Dimension, Direction, Display, Edge, FlexDirection, Gutter, Justify, LogLevel, MeasureMode, Overflow, PositionType, Unit, Wrap } from "yoga-layout";
|
|
2
|
+
export type AlignString = "auto" | "flex-start" | "center" | "flex-end" | "stretch" | "baseline" | "space-between" | "space-around" | "space-evenly";
|
|
3
|
+
export type BoxSizingString = "border-box" | "content-box";
|
|
4
|
+
export type DimensionString = "width" | "height";
|
|
5
|
+
export type DirectionString = "inherit" | "ltr" | "rtl";
|
|
6
|
+
export type DisplayString = "flex" | "none" | "contents";
|
|
7
|
+
export type EdgeString = "left" | "top" | "right" | "bottom" | "start" | "end" | "horizontal" | "vertical" | "all";
|
|
8
|
+
export type FlexDirectionString = "column" | "column-reverse" | "row" | "row-reverse";
|
|
9
|
+
export type GutterString = "column" | "row" | "all";
|
|
10
|
+
export type JustifyString = "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
11
|
+
export type LogLevelString = "error" | "warn" | "info" | "debug" | "verbose" | "fatal";
|
|
12
|
+
export type MeasureModeString = "undefined" | "exactly" | "at-most";
|
|
13
|
+
export type OverflowString = "visible" | "hidden" | "scroll";
|
|
14
|
+
export type PositionTypeString = "static" | "relative" | "absolute";
|
|
15
|
+
export type UnitString = "undefined" | "point" | "percent" | "auto";
|
|
16
|
+
export type WrapString = "no-wrap" | "wrap" | "wrap-reverse";
|
|
17
|
+
export declare function parseAlign(value: string): Align;
|
|
18
|
+
export declare function parseBoxSizing(value: string): BoxSizing;
|
|
19
|
+
export declare function parseDimension(value: string): Dimension;
|
|
20
|
+
export declare function parseDirection(value: string): Direction;
|
|
21
|
+
export declare function parseDisplay(value: string): Display;
|
|
22
|
+
export declare function parseEdge(value: string): Edge;
|
|
23
|
+
export declare function parseFlexDirection(value: string): FlexDirection;
|
|
24
|
+
export declare function parseGutter(value: string): Gutter;
|
|
25
|
+
export declare function parseJustify(value: string): Justify;
|
|
26
|
+
export declare function parseLogLevel(value: string): LogLevel;
|
|
27
|
+
export declare function parseMeasureMode(value: string): MeasureMode;
|
|
28
|
+
export declare function parseOverflow(value: string): Overflow;
|
|
29
|
+
export declare function parsePositionType(value: string): PositionType;
|
|
30
|
+
export declare function parseUnit(value: string): Unit;
|
|
31
|
+
export declare function parseWrap(value: string): Wrap;
|
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.3",
|
|
8
8
|
"description": "OpenTUI is a TypeScript library for building terminal user interfaces (TUIs)",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
31
|
"@dimforge/rapier2d-simd-compat": "^0.17.3",
|
|
32
|
-
"bun-webgpu": "0.1.
|
|
32
|
+
"bun-webgpu": "0.1.3",
|
|
33
33
|
"planck": "^1.4.2",
|
|
34
34
|
"three": "0.177.0",
|
|
35
|
-
"@opentui/core-darwin-x64": "
|
|
36
|
-
"@opentui/core-darwin-arm64": "
|
|
37
|
-
"@opentui/core-linux-x64": "
|
|
38
|
-
"@opentui/core-linux-arm64": "
|
|
39
|
-
"@opentui/core-win32-x64": "
|
|
40
|
-
"@opentui/core-win32-arm64": "
|
|
35
|
+
"@opentui/core-darwin-x64": "0.1.3",
|
|
36
|
+
"@opentui/core-darwin-arm64": "0.1.3",
|
|
37
|
+
"@opentui/core-linux-x64": "0.1.3",
|
|
38
|
+
"@opentui/core-linux-arm64": "0.1.3",
|
|
39
|
+
"@opentui/core-win32-x64": "0.1.3",
|
|
40
|
+
"@opentui/core-win32-arm64": "0.1.3"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -3,7 +3,7 @@ import { RGBA, type SelectionState } from "../types";
|
|
|
3
3
|
import { type fonts } from "../lib/ascii.font";
|
|
4
4
|
import { FrameBufferRenderable } from "./FrameBuffer";
|
|
5
5
|
export interface ASCIIFontOptions extends RenderableOptions {
|
|
6
|
-
text
|
|
6
|
+
text?: string;
|
|
7
7
|
font?: "tiny" | "block" | "shade" | "slick";
|
|
8
8
|
fg?: RGBA | RGBA[];
|
|
9
9
|
bg?: RGBA;
|
package/renderables/Box.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { RGBA } from "../types";
|
|
|
4
4
|
import { type BorderStyle, type BorderSides, type BorderCharacters, type BorderSidesConfig } from "../lib";
|
|
5
5
|
import type { ColorInput } from "../types";
|
|
6
6
|
export interface BoxOptions extends RenderableOptions {
|
|
7
|
-
|
|
7
|
+
backgroundColor?: string | RGBA;
|
|
8
8
|
borderStyle?: BorderStyle;
|
|
9
9
|
border?: boolean | BorderSides[];
|
|
10
10
|
borderColor?: string | RGBA;
|
|
@@ -15,7 +15,7 @@ export interface BoxOptions extends RenderableOptions {
|
|
|
15
15
|
focusedBorderColor?: ColorInput;
|
|
16
16
|
}
|
|
17
17
|
export declare class BoxRenderable extends Renderable {
|
|
18
|
-
protected
|
|
18
|
+
protected _backgroundColor: RGBA;
|
|
19
19
|
protected _border: boolean | BorderSides[];
|
|
20
20
|
protected _borderStyle: BorderStyle;
|
|
21
21
|
protected _borderColor: RGBA;
|
|
@@ -26,8 +26,8 @@ export declare class BoxRenderable extends Renderable {
|
|
|
26
26
|
protected _title?: string;
|
|
27
27
|
protected _titleAlignment: "left" | "center" | "right";
|
|
28
28
|
constructor(id: string, options: BoxOptions);
|
|
29
|
-
get
|
|
30
|
-
set
|
|
29
|
+
get backgroundColor(): RGBA;
|
|
30
|
+
set backgroundColor(value: RGBA | string | undefined);
|
|
31
31
|
get border(): boolean | BorderSides[];
|
|
32
32
|
set border(value: boolean | BorderSides[]);
|
|
33
33
|
get borderStyle(): BorderStyle;
|
package/renderables/Input.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Renderable, type RenderableOptions } from "../Renderable";
|
|
2
2
|
import { OptimizedBuffer } from "../buffer";
|
|
3
|
-
import type { ColorInput } from "../types";
|
|
4
3
|
import type { ParsedKey } from "../lib/parse.keypress";
|
|
4
|
+
import type { ColorInput } from "../types";
|
|
5
5
|
export interface InputRenderableOptions extends RenderableOptions {
|
|
6
6
|
backgroundColor?: ColorInput;
|
|
7
7
|
textColor?: ColorInput;
|
|
@@ -20,33 +20,36 @@ export declare enum InputRenderableEvents {
|
|
|
20
20
|
}
|
|
21
21
|
export declare class InputRenderable extends Renderable {
|
|
22
22
|
protected focusable: boolean;
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
private
|
|
28
|
-
private
|
|
29
|
-
private
|
|
30
|
-
private
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
private
|
|
23
|
+
private _value;
|
|
24
|
+
private _cursorPosition;
|
|
25
|
+
private _placeholder;
|
|
26
|
+
private _backgroundColor;
|
|
27
|
+
private _textColor;
|
|
28
|
+
private _focusedBackgroundColor;
|
|
29
|
+
private _focusedTextColor;
|
|
30
|
+
private _placeholderColor;
|
|
31
|
+
private _cursorColor;
|
|
32
|
+
private _maxLength;
|
|
33
|
+
private _lastCommittedValue;
|
|
34
34
|
constructor(id: string, options: InputRenderableOptions);
|
|
35
35
|
private updateCursorPosition;
|
|
36
36
|
focus(): void;
|
|
37
37
|
blur(): void;
|
|
38
38
|
protected renderSelf(buffer: OptimizedBuffer, deltaTime: number): void;
|
|
39
39
|
private refreshFrameBuffer;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
getCursorPosition(): number;
|
|
45
|
-
setCursorPosition(position: number): void;
|
|
40
|
+
get value(): string;
|
|
41
|
+
set value(value: string);
|
|
42
|
+
set placeholder(placeholder: string);
|
|
43
|
+
set cursorPosition(position: number);
|
|
46
44
|
private insertText;
|
|
47
45
|
private deleteCharacter;
|
|
48
46
|
handleKeyPress(key: ParsedKey | string): boolean;
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
set maxLength(maxLength: number);
|
|
48
|
+
set backgroundColor(color: ColorInput);
|
|
49
|
+
set textColor(color: ColorInput);
|
|
50
|
+
set focusedBackgroundColor(color: ColorInput);
|
|
51
|
+
set focusedTextColor(color: ColorInput);
|
|
52
|
+
set placeholderColor(color: ColorInput);
|
|
53
|
+
set cursorColor(color: ColorInput);
|
|
51
54
|
protected destroySelf(): void;
|
|
52
55
|
}
|
package/renderables/Select.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Renderable, type RenderableOptions } from "../Renderable";
|
|
2
2
|
import { OptimizedBuffer } from "../buffer";
|
|
3
|
-
import type { ColorInput } from "../types";
|
|
4
|
-
import type { ParsedKey } from "../lib/parse.keypress";
|
|
5
3
|
import { fonts } from "../lib/ascii.font";
|
|
4
|
+
import type { ParsedKey } from "../lib/parse.keypress";
|
|
5
|
+
import type { ColorInput } from "../types";
|
|
6
6
|
export interface SelectOption {
|
|
7
7
|
name: string;
|
|
8
8
|
description: string;
|
|
@@ -13,7 +13,7 @@ export interface SelectRenderableOptions extends RenderableOptions {
|
|
|
13
13
|
textColor?: ColorInput;
|
|
14
14
|
focusedBackgroundColor?: ColorInput;
|
|
15
15
|
focusedTextColor?: ColorInput;
|
|
16
|
-
options
|
|
16
|
+
options?: SelectOption[];
|
|
17
17
|
selectedBackgroundColor?: ColorInput;
|
|
18
18
|
selectedTextColor?: ColorInput;
|
|
19
19
|
descriptionColor?: ColorInput;
|
|
@@ -31,31 +31,32 @@ export declare enum SelectRenderableEvents {
|
|
|
31
31
|
}
|
|
32
32
|
export declare class SelectRenderable extends Renderable {
|
|
33
33
|
protected focusable: boolean;
|
|
34
|
-
private
|
|
34
|
+
private _options;
|
|
35
35
|
private selectedIndex;
|
|
36
36
|
private scrollOffset;
|
|
37
37
|
private maxVisibleItems;
|
|
38
|
-
private
|
|
39
|
-
private
|
|
40
|
-
private
|
|
41
|
-
private
|
|
42
|
-
private
|
|
43
|
-
private
|
|
44
|
-
private
|
|
45
|
-
private
|
|
46
|
-
private
|
|
47
|
-
private
|
|
48
|
-
private
|
|
49
|
-
private
|
|
50
|
-
private
|
|
38
|
+
private _backgroundColor;
|
|
39
|
+
private _textColor;
|
|
40
|
+
private _focusedBackgroundColor;
|
|
41
|
+
private _focusedTextColor;
|
|
42
|
+
private _selectedBackgroundColor;
|
|
43
|
+
private _selectedTextColor;
|
|
44
|
+
private _descriptionColor;
|
|
45
|
+
private _selectedDescriptionColor;
|
|
46
|
+
private _showScrollIndicator;
|
|
47
|
+
private _wrapSelection;
|
|
48
|
+
private _showDescription;
|
|
49
|
+
private _font?;
|
|
50
|
+
private _itemSpacing;
|
|
51
51
|
private linesPerItem;
|
|
52
52
|
private fontHeight;
|
|
53
|
-
private
|
|
53
|
+
private _fastScrollStep;
|
|
54
54
|
constructor(id: string, options: SelectRenderableOptions);
|
|
55
55
|
protected renderSelf(buffer: OptimizedBuffer, deltaTime: number): void;
|
|
56
56
|
private refreshFrameBuffer;
|
|
57
57
|
private renderScrollIndicatorToFrameBuffer;
|
|
58
|
-
|
|
58
|
+
get options(): SelectOption[];
|
|
59
|
+
set options(options: SelectOption[]);
|
|
59
60
|
getSelectedOption(): SelectOption | null;
|
|
60
61
|
getSelectedIndex(): number;
|
|
61
62
|
moveUp(steps?: number): void;
|
|
@@ -65,10 +66,21 @@ export declare class SelectRenderable extends Renderable {
|
|
|
65
66
|
private updateScrollOffset;
|
|
66
67
|
protected onResize(width: number, height: number): void;
|
|
67
68
|
handleKeyPress(key: ParsedKey | string): boolean;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
get showScrollIndicator(): boolean;
|
|
70
|
+
set showScrollIndicator(show: boolean);
|
|
71
|
+
get showDescription(): boolean;
|
|
72
|
+
set showDescription(show: boolean);
|
|
73
|
+
get wrapSelection(): boolean;
|
|
74
|
+
set wrapSelection(wrap: boolean);
|
|
75
|
+
set backgroundColor(color: ColorInput);
|
|
76
|
+
set textColor(color: ColorInput);
|
|
77
|
+
set focusedBackgroundColor(color: ColorInput);
|
|
78
|
+
set focusedTextColor(color: ColorInput);
|
|
79
|
+
set selectedBackgroundColor(color: ColorInput);
|
|
80
|
+
set selectedTextColor(color: ColorInput);
|
|
81
|
+
set descriptionColor(color: ColorInput);
|
|
82
|
+
set selectedDescriptionColor(color: ColorInput);
|
|
83
|
+
set font(font: keyof typeof fonts);
|
|
84
|
+
set itemSpacing(spacing: number);
|
|
85
|
+
set fastScrollStep(step: number);
|
|
74
86
|
}
|
|
@@ -9,7 +9,7 @@ export interface TabSelectOption {
|
|
|
9
9
|
}
|
|
10
10
|
export interface TabSelectRenderableOptions extends Omit<RenderableOptions, "height"> {
|
|
11
11
|
height?: number;
|
|
12
|
-
options
|
|
12
|
+
options?: TabSelectOption[];
|
|
13
13
|
tabWidth?: number;
|
|
14
14
|
backgroundColor?: ColorInput;
|
|
15
15
|
textColor?: ColorInput;
|
package/renderables/Text.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { StyledText } from "../lib/styled-text";
|
|
|
3
3
|
import { RGBA, type SelectionState } from "../types";
|
|
4
4
|
import type { OptimizedBuffer } from "../buffer";
|
|
5
5
|
export interface TextOptions extends RenderableOptions {
|
|
6
|
-
content
|
|
6
|
+
content?: StyledText | string;
|
|
7
7
|
fg?: string | RGBA;
|
|
8
8
|
bg?: string | RGBA;
|
|
9
9
|
selectionBg?: string | RGBA;
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 opentui
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|