restty 0.1.0 → 0.1.2
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/README.md +17 -3
- package/dist/app/index.d.ts +1 -1
- package/dist/app/types.d.ts +0 -41
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23881 -491
- package/package.json +13 -2
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# restty
|
|
2
2
|
|
|
3
|
-
](https://github.com/wiedymi)
|
|
4
|
+
[](https://x.com/wiedymi)
|
|
5
|
+
[](mailto:contact@wiedymi.com)
|
|
6
|
+
[](https://discord.gg/zemMZtrkSb)
|
|
7
|
+
[](https://github.com/sponsors/vivy-company)
|
|
6
8
|
|
|
7
9
|
Experimental project: browser terminal rendering with a WASM terminal core, GPU rendering (WebGPU + WebGL2 fallback), and TypeScript text shaping.
|
|
8
10
|
|
|
@@ -31,6 +33,18 @@ restty combines a Zig/WASM VT engine, modern browser rendering pipelines, and a
|
|
|
31
33
|
- Integration and usage: `docs/usage.md`
|
|
32
34
|
- Internal architecture notes: `docs/internals/`
|
|
33
35
|
|
|
36
|
+
## App integration
|
|
37
|
+
|
|
38
|
+
Simple usage (built-in `text-shaper` is used automatically):
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createResttyApp } from "restty";
|
|
42
|
+
|
|
43
|
+
const app = createResttyApp({
|
|
44
|
+
canvas: document.getElementById("screen") as HTMLCanvasElement,
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
34
48
|
## Repository layout
|
|
35
49
|
|
|
36
50
|
- `src/` - Main library/runtime code (renderer, input, PTY bridge, app integration).
|
package/dist/app/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ResttyApp, ResttyAppOptions } from "./types";
|
|
2
|
-
export type {
|
|
2
|
+
export type { ResttyAppElements, ResttyAppCallbacks, FontSource, ResttyAppOptions, ResttyApp, } from "./types";
|
|
3
3
|
export declare function createResttyApp(options: ResttyAppOptions): ResttyApp;
|
package/dist/app/types.d.ts
CHANGED
|
@@ -1,45 +1,5 @@
|
|
|
1
1
|
import type { InputHandler } from "../input";
|
|
2
2
|
import type { GhosttyTheme } from "../theme";
|
|
3
|
-
export type TextShaper = {
|
|
4
|
-
Font: {
|
|
5
|
-
loadAsync: (buffer: ArrayBuffer) => Promise<any>;
|
|
6
|
-
collection?: (buffer: ArrayBuffer) => {
|
|
7
|
-
names: () => Array<{
|
|
8
|
-
index: number;
|
|
9
|
-
fullName?: string;
|
|
10
|
-
family?: string;
|
|
11
|
-
postScriptName?: string;
|
|
12
|
-
}>;
|
|
13
|
-
get: (index: number) => any;
|
|
14
|
-
} | null;
|
|
15
|
-
};
|
|
16
|
-
UnicodeBuffer: new () => {
|
|
17
|
-
addStr: (text: string) => void;
|
|
18
|
-
};
|
|
19
|
-
shape: (font: any, buffer: any) => any;
|
|
20
|
-
glyphBufferToShapedGlyphs: (glyphBuffer: any) => Array<{
|
|
21
|
-
glyphId: number;
|
|
22
|
-
xAdvance: number;
|
|
23
|
-
xOffset: number;
|
|
24
|
-
yOffset: number;
|
|
25
|
-
}>;
|
|
26
|
-
buildAtlas: (font: any, glyphIds: number[], options: any) => any;
|
|
27
|
-
atlasToRGBA: (atlas: any) => Uint8Array | null;
|
|
28
|
-
rasterizeGlyph?: (font: any, glyphId: number, fontSize: number, options?: any) => {
|
|
29
|
-
bitmap: any;
|
|
30
|
-
bearingX: number;
|
|
31
|
-
bearingY: number;
|
|
32
|
-
} | null;
|
|
33
|
-
rasterizeGlyphWithTransform?: (font: any, glyphId: number, fontSize: number, matrix: number[] | number[][], options?: any) => {
|
|
34
|
-
bitmap: any;
|
|
35
|
-
bearingX: number;
|
|
36
|
-
bearingY: number;
|
|
37
|
-
} | null;
|
|
38
|
-
PixelMode: {
|
|
39
|
-
Gray: any;
|
|
40
|
-
RGBA?: any;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
3
|
export type ResttyAppElements = {
|
|
44
4
|
backendEl?: HTMLElement | null;
|
|
45
5
|
fpsEl?: HTMLElement | null;
|
|
@@ -82,7 +42,6 @@ export type FontSource = {
|
|
|
82
42
|
export type ResttyAppOptions = {
|
|
83
43
|
canvas: HTMLCanvasElement;
|
|
84
44
|
imeInput?: HTMLTextAreaElement | null;
|
|
85
|
-
textShaper: TextShaper;
|
|
86
45
|
elements?: ResttyAppElements;
|
|
87
46
|
callbacks?: ResttyAppCallbacks;
|
|
88
47
|
renderer?: "auto" | "webgpu" | "webgl2";
|
package/dist/index.d.ts
CHANGED
|
@@ -13,4 +13,4 @@ export type { WasmAbi, WasmAbiKind, CursorInfo, RenderState, ResttyWasmExports,
|
|
|
13
13
|
export { parseGhosttyTheme, parseGhosttyColor, colorToFloats, colorToRgbU32, listBuiltinThemeNames, isBuiltinThemeName, getBuiltinThemeSource, getBuiltinTheme, } from "./theme";
|
|
14
14
|
export type { GhosttyTheme, ThemeColor, ResttyBuiltinThemeName } from "./theme";
|
|
15
15
|
export { createResttyApp } from "./app";
|
|
16
|
-
export type { ResttyApp, ResttyAppOptions, ResttyAppElements, ResttyAppCallbacks
|
|
16
|
+
export type { ResttyApp, ResttyAppOptions, ResttyAppElements, ResttyAppCallbacks } from "./app";
|