@opentui/core 0.1.5 → 0.1.6
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 +93 -33
- package/LICENSE +21 -0
- package/Renderable.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +481 -327
- package/lib/hast-styled-text.d.ts +38 -0
- package/lib/index.d.ts +1 -0
- package/lib/styled-text.d.ts +5 -3
- package/package.json +15 -8
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { RGBA } from "../types";
|
|
2
|
+
import { StyledText } from "./styled-text";
|
|
3
|
+
export interface HASTText {
|
|
4
|
+
type: "text";
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export interface HASTElement {
|
|
8
|
+
type: "element";
|
|
9
|
+
tagName: string;
|
|
10
|
+
properties?: {
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
children: HASTNode[];
|
|
14
|
+
}
|
|
15
|
+
export type HASTNode = HASTText | HASTElement;
|
|
16
|
+
export interface StyleDefinition {
|
|
17
|
+
fg?: RGBA;
|
|
18
|
+
bg?: RGBA;
|
|
19
|
+
bold?: boolean;
|
|
20
|
+
italic?: boolean;
|
|
21
|
+
underline?: boolean;
|
|
22
|
+
dim?: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface MergedStyle {
|
|
25
|
+
fg?: RGBA;
|
|
26
|
+
bg?: RGBA;
|
|
27
|
+
attributes: number;
|
|
28
|
+
}
|
|
29
|
+
export declare class SyntaxStyle {
|
|
30
|
+
private styles;
|
|
31
|
+
private mergedStyleCache;
|
|
32
|
+
constructor(styles: Record<string, StyleDefinition>);
|
|
33
|
+
mergeStyles(...styleNames: string[]): MergedStyle;
|
|
34
|
+
clearCache(): void;
|
|
35
|
+
getCacheSize(): number;
|
|
36
|
+
}
|
|
37
|
+
export declare function hastToStyledText(hast: HASTNode, syntaxStyle: SyntaxStyle): StyledText;
|
|
38
|
+
export {};
|
package/lib/index.d.ts
CHANGED
package/lib/styled-text.d.ts
CHANGED
|
@@ -14,11 +14,13 @@ export interface StyleAttrs {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class StyledText {
|
|
16
16
|
readonly chunks: TextChunk[];
|
|
17
|
-
private _length;
|
|
18
17
|
private _plainText;
|
|
19
|
-
constructor(chunks: TextChunk[]
|
|
18
|
+
constructor(chunks: TextChunk[]);
|
|
20
19
|
toString(): string;
|
|
21
|
-
|
|
20
|
+
private _chunksToPlainText;
|
|
21
|
+
insert(chunk: TextChunk, index?: number): void;
|
|
22
|
+
remove(chunk: TextChunk): void;
|
|
23
|
+
replace(chunk: TextChunk, oldChunk: TextChunk): void;
|
|
22
24
|
}
|
|
23
25
|
export declare function stringToStyledText(content: string): StyledText;
|
|
24
26
|
export type StylableInput = string | number | boolean | TextChunk;
|
package/package.json
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.6",
|
|
8
8
|
"description": "OpenTUI is a TypeScript library for building terminal user interfaces (TUIs)",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/sst/opentui"
|
|
12
|
+
"url": "https://github.com/sst/opentui",
|
|
13
|
+
"directory": "packages/core"
|
|
13
14
|
},
|
|
14
15
|
"exports": {
|
|
15
16
|
".": {
|
|
@@ -27,16 +28,22 @@
|
|
|
27
28
|
"jimp": "1.6.0",
|
|
28
29
|
"yoga-layout": "3.2.1"
|
|
29
30
|
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/bun": "latest",
|
|
33
|
+
"@types/three": "^0.177.0",
|
|
34
|
+
"commander": "^13.1.0",
|
|
35
|
+
"prettier": "3.6.2"
|
|
36
|
+
},
|
|
30
37
|
"optionalDependencies": {
|
|
31
38
|
"@dimforge/rapier2d-simd-compat": "^0.17.3",
|
|
32
39
|
"bun-webgpu": "0.1.3",
|
|
33
40
|
"planck": "^1.4.2",
|
|
34
41
|
"three": "0.177.0",
|
|
35
|
-
"@opentui/core-darwin-x64": "0.1.
|
|
36
|
-
"@opentui/core-darwin-arm64": "0.1.
|
|
37
|
-
"@opentui/core-linux-x64": "0.1.
|
|
38
|
-
"@opentui/core-linux-arm64": "0.1.
|
|
39
|
-
"@opentui/core-win32-x64": "0.1.
|
|
40
|
-
"@opentui/core-win32-arm64": "0.1.
|
|
42
|
+
"@opentui/core-darwin-x64": "0.1.6",
|
|
43
|
+
"@opentui/core-darwin-arm64": "0.1.6",
|
|
44
|
+
"@opentui/core-linux-x64": "0.1.6",
|
|
45
|
+
"@opentui/core-linux-arm64": "0.1.6",
|
|
46
|
+
"@opentui/core-win32-x64": "0.1.6",
|
|
47
|
+
"@opentui/core-win32-arm64": "0.1.6"
|
|
41
48
|
}
|
|
42
49
|
}
|