restty 0.1.30 → 0.1.32
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/dist/chunk-8bv82tek.js +66702 -0
- package/dist/fonts/types.d.ts +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/input/keymap/pty-map.d.ts +1 -0
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/pty/pty.d.ts +2 -2
- package/dist/pty/types.d.ts +9 -3
- package/dist/restty.js +1 -1
- package/dist/runtime/atlas-builder.d.ts +3 -0
- package/dist/runtime/create-runtime/font-runtime-grid-helpers.d.ts +1 -10
- package/dist/runtime/create-runtime/font-runtime-helpers.d.ts +0 -5
- package/dist/runtime/create-runtime/font-runtime-helpers.types.d.ts +3 -8
- package/dist/runtime/create-runtime/font-runtime-webgpu-atlas.d.ts +3 -0
- package/dist/runtime/create-runtime/interaction-runtime/kitty-image-cache.d.ts +2 -2
- package/dist/runtime/create-runtime/interaction-runtime/types.d.ts +2 -7
- package/dist/runtime/create-runtime/kitty-overlay-utils.d.ts +0 -10
- package/dist/runtime/create-runtime/kitty-render-runtime.d.ts +36 -0
- package/dist/runtime/create-runtime/lifecycle-theme-size.types.d.ts +1 -5
- package/dist/runtime/create-runtime/pty-input-runtime.d.ts +2 -1
- package/dist/runtime/create-runtime/render-tick-webgl.types.d.ts +0 -1
- package/dist/runtime/create-runtime/render-tick-webgpu.types.d.ts +7 -2
- package/dist/runtime/create-runtime/runtime-app-api.d.ts +2 -2
- package/dist/runtime/create-runtime.d.ts +1 -1
- package/dist/runtime/font-atlas-utils/glyph-atlas-builder.d.ts +1 -0
- package/dist/runtime/font-resource-store.d.ts +21 -0
- package/dist/runtime/types.d.ts +37 -0
- package/dist/wasm/embedded.d.ts +1 -1
- package/dist/wasm/runtime/types.d.ts +2 -0
- package/dist/xterm.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-w0c4b651.js +0 -117196
- package/dist/runtime/create-runtime/interaction-runtime/kitty-overlay-runtime.d.ts +0 -15
package/dist/fonts/types.d.ts
CHANGED
|
@@ -39,6 +39,10 @@ export type FontEntry = {
|
|
|
39
39
|
advanceUnits: number;
|
|
40
40
|
/** Signature string used to detect constraint changes for atlas invalidation. */
|
|
41
41
|
constraintSignature?: string;
|
|
42
|
+
/** Last atlas build hinting mode for invalidation checks. */
|
|
43
|
+
atlasHinting?: boolean;
|
|
44
|
+
/** Last atlas build hint target for invalidation checks. */
|
|
45
|
+
atlasHintTarget?: "auto" | "light" | "normal";
|
|
42
46
|
};
|
|
43
47
|
/**
|
|
44
48
|
* Result of shaping a text cluster into positioned glyphs.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { RESTTY_PLUGIN_API_VERSION, Restty, ResttyPaneHandle, createRestty, } fr
|
|
|
2
2
|
export type { ResttyOptions, ResttyPaneApi, ResttyPluginApiRange, ResttyPlugin, ResttyPluginCleanup, ResttyPluginContext, ResttyPluginDisposable, ResttyPluginEvents, ResttyPluginInfo, ResttyPluginRequires, ResttyInputInterceptor, ResttyInputInterceptorPayload, ResttyInterceptorOptions, ResttyLifecycleHook, ResttyLifecycleHookPayload, ResttyPluginLoadResult, ResttyPluginLoadStatus, ResttyPluginManifestEntry, ResttyPluginRegistry, ResttyPluginRegistryEntry, ResttyRenderHook, ResttyRenderHookPayload, ResttyOutputInterceptor, ResttyOutputInterceptorPayload, ResttyRenderStageHandle, } from "./surface/restty";
|
|
3
3
|
export { getBuiltinTheme, getBuiltinThemeSource, isBuiltinThemeName, listBuiltinThemeNames, parseGhosttyTheme, } from "./theme";
|
|
4
4
|
export type { GhosttyTheme, ResttyBuiltinThemeName } from "./theme";
|
|
5
|
-
export type { ResttyFontSource, ResttyUrlFontSource, ResttyBufferFontSource, ResttyLocalFontSource, ResttyFontPreset, ResttyShaderStage, ResttyShaderStageMode, ResttyShaderStageBackend, ResttyShaderStageSource, } from "./runtime/types";
|
|
5
|
+
export type { ResttyFontHintTarget, ResttyFontSource, ResttyUrlFontSource, ResttyBufferFontSource, ResttyLocalFontSource, ResttyFontPreset, ResttyShaderStage, ResttyShaderStageMode, ResttyShaderStageBackend, ResttyShaderStageSource, } from "./runtime/types";
|
package/dist/internal.d.ts
CHANGED
|
@@ -15,4 +15,4 @@ export type { GhosttyTheme, ThemeColor, ResttyBuiltinThemeName } from "./theme";
|
|
|
15
15
|
export { Restty } from "./surface/restty";
|
|
16
16
|
export type { ResttyOptions } from "./surface/restty";
|
|
17
17
|
export type { ResttyManagedAppPane, ResttyPaneDomDefaults, ResttyManagedPaneStyleOptions, ResttyManagedPaneStylesOptions, ResttyPaneAppOptionsInput, } from "./surface/pane-app-manager";
|
|
18
|
-
export type { ResttyFontSource, ResttyUrlFontSource, ResttyBufferFontSource, ResttyLocalFontSource, ResttyShaderStage, ResttyShaderStageMode, ResttyShaderStageBackend, ResttyShaderStageSource, } from "./runtime/types";
|
|
18
|
+
export type { ResttyFontHintTarget, ResttyFontSource, ResttyUrlFontSource, ResttyBufferFontSource, ResttyLocalFontSource, ResttyShaderStage, ResttyShaderStageMode, ResttyShaderStageBackend, ResttyShaderStageSource, } from "./runtime/types";
|
package/dist/internal.js
CHANGED
package/dist/pty/pty.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PtyCallbacks, PtyConnectionState, PtyConnectOptions, PtyTransport } from "./types";
|
|
1
|
+
import type { PtyCallbacks, PtyConnectionState, PtyConnectOptions, PtyResizeMeta, PtyTransport } from "./types";
|
|
2
2
|
/** Decode a binary WebSocket frame into a UTF-8 string using a streaming TextDecoder. */
|
|
3
3
|
export declare function decodePtyBinary(decoder: TextDecoder, payload: ArrayBuffer | Uint8Array, stream?: boolean): string;
|
|
4
4
|
/** Create a fresh idle PTY connection state. */
|
|
@@ -13,7 +13,7 @@ export declare function disconnectPty(state: PtyConnectionState): void;
|
|
|
13
13
|
/** Send terminal input data to the PTY server. Returns false if the socket is not open. */
|
|
14
14
|
export declare function sendPtyInput(state: PtyConnectionState, data: string): boolean;
|
|
15
15
|
/** Send a resize notification to the PTY server. Returns false if the socket is not open. */
|
|
16
|
-
export declare function sendPtyResize(state: PtyConnectionState, cols: number, rows: number): boolean;
|
|
16
|
+
export declare function sendPtyResize(state: PtyConnectionState, cols: number, rows: number, meta?: PtyResizeMeta): boolean;
|
|
17
17
|
/** Check whether the PTY WebSocket is currently open and connected. */
|
|
18
18
|
export declare function isPtyConnected(state: PtyConnectionState): boolean;
|
|
19
19
|
/** Create a PtyTransport backed by a WebSocket connection. */
|
package/dist/pty/types.d.ts
CHANGED
|
@@ -3,14 +3,20 @@
|
|
|
3
3
|
* - input: terminal keystrokes or pasted text
|
|
4
4
|
* - resize: window size change notification
|
|
5
5
|
*/
|
|
6
|
+
export type PtyResizeMeta = {
|
|
7
|
+
widthPx?: number;
|
|
8
|
+
heightPx?: number;
|
|
9
|
+
cellW?: number;
|
|
10
|
+
cellH?: number;
|
|
11
|
+
};
|
|
6
12
|
export type PtyMessage = {
|
|
7
13
|
type: "input";
|
|
8
14
|
data: string;
|
|
9
|
-
} | {
|
|
15
|
+
} | ({
|
|
10
16
|
type: "resize";
|
|
11
17
|
cols: number;
|
|
12
18
|
rows: number;
|
|
13
|
-
};
|
|
19
|
+
} & PtyResizeMeta);
|
|
14
20
|
/** Server notification that the PTY session is ready, with the active shell name. */
|
|
15
21
|
export type PtyStatusMessage = {
|
|
16
22
|
type: "status";
|
|
@@ -93,7 +99,7 @@ export type PtyTransport = {
|
|
|
93
99
|
/** Send terminal input data; returns true if the data was sent. */
|
|
94
100
|
sendInput: (data: string) => boolean;
|
|
95
101
|
/** Notify the PTY of a terminal resize; returns true if the message was sent. */
|
|
96
|
-
resize: (cols: number, rows: number) => boolean;
|
|
102
|
+
resize: (cols: number, rows: number, meta?: PtyResizeMeta) => boolean;
|
|
97
103
|
/** Whether the transport currently has an active connection. */
|
|
98
104
|
isConnected: () => boolean;
|
|
99
105
|
/** Release all resources held by the transport. */
|
package/dist/restty.js
CHANGED
|
@@ -58,6 +58,7 @@ type BuildGlyphAtlasWithConstraintsOptions = {
|
|
|
58
58
|
maxHeight: number;
|
|
59
59
|
pixelMode: number;
|
|
60
60
|
hinting: boolean;
|
|
61
|
+
hintTarget?: AtlasOptions["hintTarget"];
|
|
61
62
|
rasterizeGlyph?: RasterizeGlyphFn;
|
|
62
63
|
rasterizeGlyphWithTransform?: RasterizeGlyphWithTransformFn;
|
|
63
64
|
glyphMeta?: Map<number, GlyphConstraintMeta>;
|
|
@@ -99,6 +100,8 @@ type BuildAtlasDeps = {
|
|
|
99
100
|
} | null;
|
|
100
101
|
rasterizeGlyph?: RasterizeGlyphFn;
|
|
101
102
|
rasterizeGlyphWithTransform?: RasterizeGlyphWithTransformFn;
|
|
103
|
+
hinting: boolean;
|
|
104
|
+
hintTarget?: AtlasOptions["hintTarget"];
|
|
102
105
|
nerdConstraintSignature: (glyphMeta: Map<number, GlyphConstraintMeta> | undefined, constraintContext: AtlasConstraintContext | null | undefined) => string;
|
|
103
106
|
constants: {
|
|
104
107
|
atlasPadding: number;
|
|
@@ -3,7 +3,7 @@ import type { WebGLState, WebGPUState } from "../../renderer";
|
|
|
3
3
|
import type { PtyTransport } from "../../pty";
|
|
4
4
|
import type { ResttyWasm } from "../../wasm";
|
|
5
5
|
import type { ResttyAppCallbacks } from "../types";
|
|
6
|
-
import type { CellMetrics, FontConfigRef, GridStateRef
|
|
6
|
+
import type { CellMetrics, FontConfigRef, GridStateRef } from "./font-runtime-helpers.types";
|
|
7
7
|
type CreateFontRuntimeGridHelpersOptions = {
|
|
8
8
|
fontState: FontManagerState;
|
|
9
9
|
fontConfig: FontConfigRef;
|
|
@@ -19,10 +19,6 @@ type CreateFontRuntimeGridHelpersOptions = {
|
|
|
19
19
|
getWasmHandle: () => number;
|
|
20
20
|
ptyTransport: PtyTransport;
|
|
21
21
|
setNeedsRender: () => void;
|
|
22
|
-
resizeState: ResizeStateRef;
|
|
23
|
-
resizeActiveMs: number;
|
|
24
|
-
resizeCommitDebounceMs: number;
|
|
25
|
-
onSyncKittyOverlaySize: () => void;
|
|
26
22
|
shapeClusterWithFont: (entry: FontEntry, text: string) => {
|
|
27
23
|
advance: number;
|
|
28
24
|
};
|
|
@@ -30,10 +26,5 @@ type CreateFontRuntimeGridHelpersOptions = {
|
|
|
30
26
|
export declare function createFontRuntimeGridHelpers(options: CreateFontRuntimeGridHelpersOptions): {
|
|
31
27
|
computeCellMetrics: () => CellMetrics | null;
|
|
32
28
|
updateGrid: () => void;
|
|
33
|
-
flushPendingTerminalResize: () => void;
|
|
34
|
-
scheduleTerminalResizeCommit: (cols: number, rows: number, options?: {
|
|
35
|
-
immediate?: boolean;
|
|
36
|
-
}) => void;
|
|
37
|
-
resetTerminalResizeScheduler: () => void;
|
|
38
29
|
};
|
|
39
30
|
export {};
|
|
@@ -4,11 +4,6 @@ export declare function createRuntimeFontRuntimeHelpers(options: CreateRuntimeFo
|
|
|
4
4
|
ensureAtlasForFont: (device: GPUDevice, state: import("../../renderer").WebGPUState, entry: import("../../fonts").FontEntry, neededGlyphIds: Set<number>, fontSizePx: number, fontIndex: number, atlasScale: number, glyphMeta?: Map<number, import("../atlas-builder").GlyphConstraintMeta>, constraintContext?: import("../atlas-builder").AtlasConstraintContext | null) => boolean;
|
|
5
5
|
computeCellMetrics: () => import("./font-runtime-helpers.types").CellMetrics | null;
|
|
6
6
|
updateGrid: () => void;
|
|
7
|
-
flushPendingTerminalResize: () => void;
|
|
8
|
-
scheduleTerminalResizeCommit: (cols: number, rows: number, options?: {
|
|
9
|
-
immediate?: boolean;
|
|
10
|
-
}) => void;
|
|
11
|
-
resetTerminalResizeScheduler: () => void;
|
|
12
7
|
shapeClusterWithFont: (entry: import("../../fonts").FontEntry, text: string) => import("../../fonts").ShapedCluster;
|
|
13
8
|
noteColorGlyphText: (entry: import("../../fonts").FontEntry, text: string, shaped: {
|
|
14
9
|
glyphs: Array<{
|
|
@@ -2,7 +2,7 @@ import type { Font, FontAtlas, FontEntry, FontManagerState, FontSizeMode, Shaped
|
|
|
2
2
|
import type { WebGLState, WebGPUState } from "../../renderer";
|
|
3
3
|
import type { PtyTransport } from "../../pty";
|
|
4
4
|
import type { ResttyWasm } from "../../wasm";
|
|
5
|
-
import type { ResttyAppCallbacks } from "../types";
|
|
5
|
+
import type { ResttyAppCallbacks, ResttyFontHintTarget } from "../types";
|
|
6
6
|
import type { AtlasOptions, GlyphBuffer, GlyphRasterizeOptions, Matrix2D, Matrix3x3, RasterizedGlyph, UnicodeBuffer } from "text-shaper";
|
|
7
7
|
export type GridStateRef = {
|
|
8
8
|
cols: number;
|
|
@@ -18,9 +18,6 @@ export type GridStateRef = {
|
|
|
18
18
|
export type FontConfigRef = {
|
|
19
19
|
sizePx: number;
|
|
20
20
|
};
|
|
21
|
-
export type ResizeStateRef = {
|
|
22
|
-
lastAt: number;
|
|
23
|
-
};
|
|
24
21
|
export type ShapeClusterResult = {
|
|
25
22
|
glyphs: ShapedGlyph[];
|
|
26
23
|
advance: number;
|
|
@@ -72,10 +69,8 @@ export type CreateRuntimeFontRuntimeHelpersOptions = {
|
|
|
72
69
|
getWasmHandle: () => number;
|
|
73
70
|
ptyTransport: PtyTransport;
|
|
74
71
|
setNeedsRender: () => void;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
resizeCommitDebounceMs: number;
|
|
78
|
-
onSyncKittyOverlaySize: () => void;
|
|
72
|
+
getFontHinting: () => boolean;
|
|
73
|
+
getFontHintTarget: () => ResttyFontHintTarget;
|
|
79
74
|
fontScaleOverrides: Array<{
|
|
80
75
|
match: RegExp;
|
|
81
76
|
scale: number;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { type FontEntry, type FontManagerState } from "../../fonts";
|
|
2
2
|
import type { WebGPUState } from "../../renderer";
|
|
3
3
|
import { type AtlasConstraintContext, type GlyphConstraintMeta } from "../atlas-builder";
|
|
4
|
+
import type { ResttyFontHintTarget } from "../types";
|
|
4
5
|
import type { AtlasBitmapToRGBA, BuildAtlasFn, BuildColorEmojiAtlasWithCanvas, PadAtlasRGBAFn, RasterizeGlyphFn, RasterizeGlyphWithTransformFn, ResolveGlyphPixelMode } from "./font-runtime-helpers.types";
|
|
5
6
|
type CreateRuntimeWebGPUAtlasHelpersOptions = {
|
|
6
7
|
fontState: FontManagerState;
|
|
8
|
+
getFontHinting: () => boolean;
|
|
9
|
+
getFontHintTarget: () => ResttyFontHintTarget;
|
|
7
10
|
fontScaleOverrides: Array<{
|
|
8
11
|
match: RegExp;
|
|
9
12
|
scale: number;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { KittyPlacement, ResttyWasm } from "../../../wasm";
|
|
2
|
-
type KittyDecodedImage = {
|
|
2
|
+
export type KittyDecodedImage = {
|
|
3
3
|
key: string;
|
|
4
4
|
width: number;
|
|
5
5
|
height: number;
|
|
6
6
|
source: CanvasImageSource;
|
|
7
|
+
pixels?: Uint8Array;
|
|
7
8
|
};
|
|
8
9
|
export type KittyImageCache = {
|
|
9
10
|
resolveKittyImage: (placement: KittyPlacement) => KittyDecodedImage | null;
|
|
@@ -15,4 +16,3 @@ export type CreateKittyImageCacheOptions = {
|
|
|
15
16
|
markNeedsRender: () => void;
|
|
16
17
|
};
|
|
17
18
|
export declare function createKittyImageCache(options: CreateKittyImageCacheOptions): KittyImageCache;
|
|
18
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InputHandler } from "../../../input";
|
|
2
2
|
import type { createSelectionState } from "../../../selection";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RenderState, ResttyWasm, ResttyWasmExports } from "../../../wasm";
|
|
4
4
|
export type RuntimeCell = {
|
|
5
5
|
row: number;
|
|
6
6
|
col: number;
|
|
@@ -64,7 +64,6 @@ export type CreateRuntimeInteractionOptions = {
|
|
|
64
64
|
touchSelectionLongPressMs: number;
|
|
65
65
|
touchSelectionMoveThresholdPx: number;
|
|
66
66
|
showOverlayScrollbar: boolean;
|
|
67
|
-
kittyOverlayDebugEnabled: boolean;
|
|
68
67
|
imeInput: HTMLTextAreaElement | null;
|
|
69
68
|
cleanupCanvasFns: Array<() => void>;
|
|
70
69
|
getCanvas: () => HTMLCanvasElement;
|
|
@@ -84,9 +83,7 @@ export type RuntimeInteraction = {
|
|
|
84
83
|
scrollbarState: RuntimeScrollbarState;
|
|
85
84
|
imeState: RuntimeImeState;
|
|
86
85
|
updateCanvasCursor: () => void;
|
|
87
|
-
|
|
88
|
-
clearKittyOverlay: () => void;
|
|
89
|
-
drawKittyOverlay: (placements: KittyPlacement[], cellW: number, cellH: number) => void;
|
|
86
|
+
updateLinkHover: (cell: RuntimeCell | null) => void;
|
|
90
87
|
positionToCell: (event: {
|
|
91
88
|
clientX: number;
|
|
92
89
|
clientY: number;
|
|
@@ -105,6 +102,4 @@ export type RuntimeInteraction = {
|
|
|
105
102
|
} | null | undefined, cellW: number, cellH: number) => void;
|
|
106
103
|
appendOverlayScrollbar: (overlayData: number[], total: number, offset: number, len: number) => void;
|
|
107
104
|
bindCanvasEvents: (bindOptions: BindCanvasEventsOptions) => void;
|
|
108
|
-
detachKittyOverlayCanvas: () => void;
|
|
109
|
-
clearKittyImageCache: () => void;
|
|
110
105
|
};
|
|
@@ -8,19 +8,9 @@ export type KittySlice = {
|
|
|
8
8
|
sy: number;
|
|
9
9
|
sw: number;
|
|
10
10
|
sh: number;
|
|
11
|
-
rawSw: number;
|
|
12
|
-
rawSh: number;
|
|
13
11
|
dx: number;
|
|
14
12
|
dy: number;
|
|
15
13
|
dw: number;
|
|
16
14
|
dh: number;
|
|
17
15
|
};
|
|
18
|
-
export declare function kittyHashInt(hash: number, value: number): number;
|
|
19
|
-
export declare function kittyHashString(hash: number, value: string): number;
|
|
20
16
|
export declare function toKittySlice(placement: KittyPlacement, decoded: KittyDecodedImageLike, cellW: number, cellH: number): KittySlice | null;
|
|
21
|
-
export declare function computeKittyPartialVirtualFallback(placements: KittyPlacement[], slices: KittySlice[], decoded: KittyDecodedImageLike, cellW: number, cellH: number): {
|
|
22
|
-
dx: number;
|
|
23
|
-
dy: number;
|
|
24
|
-
dw: number;
|
|
25
|
-
dh: number;
|
|
26
|
-
} | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { WebGPUState } from "../../renderer";
|
|
2
|
+
import type { KittyPlacement, ResttyWasm } from "../../wasm";
|
|
3
|
+
export type KittyDrawSlice = {
|
|
4
|
+
imageId: number;
|
|
5
|
+
key: string;
|
|
6
|
+
source: CanvasImageSource;
|
|
7
|
+
pixels?: Uint8Array;
|
|
8
|
+
imageWidth: number;
|
|
9
|
+
imageHeight: number;
|
|
10
|
+
sx: number;
|
|
11
|
+
sy: number;
|
|
12
|
+
sw: number;
|
|
13
|
+
sh: number;
|
|
14
|
+
dx: number;
|
|
15
|
+
dy: number;
|
|
16
|
+
dw: number;
|
|
17
|
+
dh: number;
|
|
18
|
+
z: number;
|
|
19
|
+
};
|
|
20
|
+
export type KittyDrawPlan = {
|
|
21
|
+
underlay: KittyDrawSlice[];
|
|
22
|
+
overlay: KittyDrawSlice[];
|
|
23
|
+
};
|
|
24
|
+
type CreateKittyRenderRuntimeOptions = {
|
|
25
|
+
getWasm: () => ResttyWasm | null;
|
|
26
|
+
markNeedsRender: () => void;
|
|
27
|
+
};
|
|
28
|
+
export declare function createKittyRenderRuntime(options: CreateKittyRenderRuntimeOptions): {
|
|
29
|
+
collectKittyDrawPlan: (placements: KittyPlacement[], cellW: number, cellH: number) => KittyDrawPlan;
|
|
30
|
+
resolveKittyWebGLTexture: (gl: WebGL2RenderingContext, slice: KittyDrawSlice) => WebGLTexture | null;
|
|
31
|
+
resolveKittyWebGPUBindGroup: (state: WebGPUState, slice: KittyDrawSlice, nearest?: boolean) => GPUBindGroup | null;
|
|
32
|
+
clearWebGLKittyTextures: () => void;
|
|
33
|
+
clearWebGPUKittyTextures: () => void;
|
|
34
|
+
clearKittyRenderCaches: () => void;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -70,15 +70,11 @@ export type LifecycleThemeSizeDeps = {
|
|
|
70
70
|
cellH: number;
|
|
71
71
|
} | null;
|
|
72
72
|
updateGrid: () => void;
|
|
73
|
-
|
|
74
|
-
scheduleTerminalResizeCommit: (cols: number, rows: number, options?: {
|
|
75
|
-
immediate?: boolean;
|
|
76
|
-
}) => void;
|
|
73
|
+
clearKittyRenderCaches: () => void;
|
|
77
74
|
sendKeyInput: (text: string, source?: string) => void;
|
|
78
75
|
clearWebGLShaderStages: (state?: WebGLState) => void;
|
|
79
76
|
destroyWebGLStageTargets: (state?: WebGLState) => void;
|
|
80
77
|
destroyWebGPUStageTargets: () => void;
|
|
81
|
-
detachKittyOverlayCanvas: () => void;
|
|
82
78
|
setShaderStagesDirty: (value: boolean) => void;
|
|
83
79
|
markNeedsRender: () => void;
|
|
84
80
|
resetLastRenderTime: () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InputHandler } from "../../input";
|
|
2
|
-
import type { PtyTransport } from "../../pty";
|
|
2
|
+
import type { PtyResizeMeta, PtyTransport } from "../../pty";
|
|
3
3
|
import type { PtyOutputBufferController } from "../pty-output-buffer";
|
|
4
4
|
type CursorPosition = {
|
|
5
5
|
row: number;
|
|
@@ -21,6 +21,7 @@ export type CreatePtyInputRuntimeOptions = {
|
|
|
21
21
|
cols: number;
|
|
22
22
|
rows: number;
|
|
23
23
|
};
|
|
24
|
+
getResizeMeta?: () => PtyResizeMeta | null;
|
|
24
25
|
getCursorForCpr: () => CursorPosition;
|
|
25
26
|
sendInput: SendInput;
|
|
26
27
|
runBeforeInputHook: (text: string, source: string) => string | null;
|
|
@@ -17,7 +17,6 @@ export type WebGLTickDeps = SharedTickDeps & {
|
|
|
17
17
|
reportDebugText: (text: string) => void;
|
|
18
18
|
updateGrid: () => void;
|
|
19
19
|
getRenderState: () => RenderState | null;
|
|
20
|
-
clearKittyOverlay: () => void;
|
|
21
20
|
resolveBlendFlags: (alphaMode: AlphaBlendingMode, backend: "webgl2") => {
|
|
22
21
|
useLinearBlending: boolean;
|
|
23
22
|
useLinearCorrection: boolean;
|
|
@@ -4,6 +4,8 @@ import type { Color, WebGPUState } from "../../renderer";
|
|
|
4
4
|
import type { CompiledWebGPUShaderStage, WebGPUStageTargets } from "../create-app-types";
|
|
5
5
|
import type { GlyphConstraintMeta } from "../atlas-builder";
|
|
6
6
|
import type { KittyPlacement, RenderState, ResttyWasm, ResttyWasmExports } from "../../wasm";
|
|
7
|
+
import type { KittyDrawPlan, KittyDrawSlice } from "./kitty-render-runtime";
|
|
8
|
+
import type { ResttyFontHintTarget } from "../types";
|
|
7
9
|
export type CursorPosition = {
|
|
8
10
|
col: number;
|
|
9
11
|
row: number;
|
|
@@ -97,6 +99,8 @@ export type SharedTickDeps = {
|
|
|
97
99
|
match: RegExp;
|
|
98
100
|
scale: number;
|
|
99
101
|
}>;
|
|
102
|
+
getFontHinting: () => boolean;
|
|
103
|
+
getFontHintTarget: () => ResttyFontHintTarget;
|
|
100
104
|
isSymbolFont: (entry: FontEntry) => boolean;
|
|
101
105
|
isColorEmojiFont: (entry: FontEntry) => boolean;
|
|
102
106
|
fontAdvanceUnits: (entry: FontEntry, shapeClusterWithFont: (entry: FontEntry, text: string) => ShapedCluster) => number;
|
|
@@ -198,7 +202,9 @@ export type SharedTickDeps = {
|
|
|
198
202
|
ensureInstanceBuffer: (state: WebGPUState, kind: "rect" | "glyph", minBytes: number) => void;
|
|
199
203
|
GLYPH_INSTANCE_FLOATS: number;
|
|
200
204
|
wasm: ResttyWasm | null;
|
|
201
|
-
|
|
205
|
+
collectKittyDrawPlan: (placements: KittyPlacement[], cellW: number, cellH: number) => KittyDrawPlan;
|
|
206
|
+
resolveKittyWebGLTexture: (gl: WebGL2RenderingContext, slice: KittyDrawSlice) => WebGLTexture | null;
|
|
207
|
+
resolveKittyWebGPUBindGroup: (state: WebGPUState, slice: KittyDrawSlice, nearest?: boolean) => GPUBindGroup | null;
|
|
202
208
|
isAppleSymbolsFont: (entry: FontEntry) => boolean;
|
|
203
209
|
DEFAULT_APPLE_SYMBOLS_CONSTRAINT: NerdConstraint;
|
|
204
210
|
DEFAULT_SYMBOL_CONSTRAINT: NerdConstraint;
|
|
@@ -243,7 +249,6 @@ export type RuntimeTickDeps = SharedTickDeps & {
|
|
|
243
249
|
reportDebugText: (text: string) => void;
|
|
244
250
|
updateGrid: () => void;
|
|
245
251
|
getRenderState: () => RenderState | null;
|
|
246
|
-
clearKittyOverlay: () => void;
|
|
247
252
|
resolveBlendFlags: (alphaMode: string, backend: "webgpu", state: WebGPUState) => {
|
|
248
253
|
useLinearBlending: boolean;
|
|
249
254
|
useLinearCorrection: boolean;
|
|
@@ -25,6 +25,8 @@ type RuntimeSendInput = (text: string, source?: string, options?: {
|
|
|
25
25
|
}) => void;
|
|
26
26
|
type RuntimePublicApiOptions = {
|
|
27
27
|
setFontSize: ResttyApp["setFontSize"];
|
|
28
|
+
setFontHinting: ResttyApp["setFontHinting"];
|
|
29
|
+
setFontHintTarget: ResttyApp["setFontHintTarget"];
|
|
28
30
|
setFontSources: ResttyApp["setFontSources"];
|
|
29
31
|
resetTheme: ResttyApp["resetTheme"];
|
|
30
32
|
dumpAtlasForCodepoint: ResttyApp["dumpAtlasForCodepoint"];
|
|
@@ -78,7 +80,6 @@ type CreateRuntimeAppApiOptions = {
|
|
|
78
80
|
resizeState: {
|
|
79
81
|
lastAt: number;
|
|
80
82
|
};
|
|
81
|
-
flushPendingTerminalResize: () => void;
|
|
82
83
|
tickWebGPU: (state: WebGPUState) => void;
|
|
83
84
|
tickWebGL: (state: WebGLState) => void;
|
|
84
85
|
updateGrid: () => void;
|
|
@@ -99,7 +100,6 @@ type CreateRuntimeAppApiOptions = {
|
|
|
99
100
|
destroyWebGPUStageTargets: () => void;
|
|
100
101
|
clearWebGLShaderStages: (state?: WebGLState) => void;
|
|
101
102
|
destroyWebGLStageTargets: (state?: WebGLState) => void;
|
|
102
|
-
resetTerminalResizeScheduler: () => void;
|
|
103
103
|
};
|
|
104
104
|
export declare function createRuntimeAppApi(options: CreateRuntimeAppApiOptions): RuntimeAppApiRuntime;
|
|
105
105
|
export {};
|
|
@@ -2,6 +2,6 @@ import type { ResttyApp, ResttyAppOptions } from "./types";
|
|
|
2
2
|
export { createResttyAppSession, getDefaultResttyAppSession } from "./session";
|
|
3
3
|
export { createResttyPaneManager } from "../surface/panes/manager";
|
|
4
4
|
export { createDefaultResttyPaneContextMenuItems, getResttyShortcutModifierLabel, } from "../surface/panes/default-context-menu-items";
|
|
5
|
-
export type { ResttyAppElements, ResttyAppCallbacks, FontSource, ResttyFontSource, ResttyTouchSelectionMode, ResttyUrlFontSource, ResttyBufferFontSource, ResttyLocalFontSource, ResttyWasmLogListener, ResttyAppSession, ResttyAppInputPayload, ResttyShaderStage, ResttyShaderStageMode, ResttyShaderStageBackend, ResttyShaderStageSource, ResttyAppOptions, ResttyApp, } from "./types";
|
|
5
|
+
export type { ResttyAppElements, ResttyAppCallbacks, FontSource, ResttyFontHintTarget, ResttyFontSource, ResttyTouchSelectionMode, ResttyUrlFontSource, ResttyBufferFontSource, ResttyLocalFontSource, ResttyWasmLogListener, ResttyAppSession, ResttyAppInputPayload, ResttyShaderStage, ResttyShaderStageMode, ResttyShaderStageBackend, ResttyShaderStageSource, ResttyAppOptions, ResttyApp, } from "./types";
|
|
6
6
|
export type { ResttyPaneSplitDirection, ResttyPaneContextMenuItem, ResttyPaneDefinition, ResttyPaneStyleOptions, ResttyPaneStylesOptions, ResttyPaneShortcutsOptions, ResttyPaneContextMenuOptions, CreateResttyPaneManagerOptions, ResttyPaneManager, ResttyPaneWithApp, CreateDefaultResttyPaneContextMenuItemsOptions, } from "../surface/panes-types";
|
|
7
7
|
export declare function createResttyApp(options: ResttyAppOptions): ResttyApp;
|
|
@@ -17,6 +17,7 @@ export type BuildGlyphAtlasWithConstraintsOptions = {
|
|
|
17
17
|
maxHeight: number;
|
|
18
18
|
pixelMode: number;
|
|
19
19
|
hinting: boolean;
|
|
20
|
+
hintTarget?: GlyphRasterizeOptions["hintTarget"];
|
|
20
21
|
rasterizeGlyph?: RasterizeGlyphFn;
|
|
21
22
|
rasterizeGlyphWithTransform?: RasterizeGlyphWithTransformFn;
|
|
22
23
|
glyphMeta?: Map<number, GlyphConstraintMeta>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ResttyFontResourceFace, ResttyFontResourceStore, ResttyFontSource } from "./types";
|
|
2
|
+
type ParsedFontFace = {
|
|
3
|
+
font: ResttyFontResourceFace["font"];
|
|
4
|
+
metadataLabel?: string;
|
|
5
|
+
index?: number;
|
|
6
|
+
};
|
|
7
|
+
export type CreateResttyFontResourceStoreOptions = {
|
|
8
|
+
now?: () => number;
|
|
9
|
+
/** Max in-memory source-byte cache budget across unleased and leased entries. */
|
|
10
|
+
maxSourceCacheBytes?: number;
|
|
11
|
+
/** TTL for persistent URL-byte cache records. */
|
|
12
|
+
urlCacheTtlMs?: number;
|
|
13
|
+
/** Toggle persistent URL-byte cache (IndexedDB). */
|
|
14
|
+
usePersistentUrlCache?: boolean;
|
|
15
|
+
/** Override source loading (used by tests/mocks). */
|
|
16
|
+
loadSourceBuffer?: (source: ResttyFontSource, sourceKey: string) => Promise<ArrayBuffer | null>;
|
|
17
|
+
/** Override parse step (used by tests/mocks). */
|
|
18
|
+
parseBuffer?: (buffer: ArrayBuffer, sourceKey: string) => Promise<ParsedFontFace[]>;
|
|
19
|
+
};
|
|
20
|
+
export declare function createResttyFontResourceStore(options?: CreateResttyFontResourceStoreOptions): ResttyFontResourceStore;
|
|
21
|
+
export {};
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -3,8 +3,28 @@ import type { PtyTransport } from "../pty";
|
|
|
3
3
|
import type { WebGPUCoreState } from "../renderer";
|
|
4
4
|
import type { GhosttyTheme } from "../theme";
|
|
5
5
|
import type { ResttyWasm } from "../wasm";
|
|
6
|
+
import type { Font as TextShaperFont } from "text-shaper";
|
|
6
7
|
/** Callback for WASM log messages. */
|
|
7
8
|
export type ResttyWasmLogListener = (message: string) => void;
|
|
9
|
+
/** Shared parsed font face reused across panes within a session. */
|
|
10
|
+
export type ResttyFontResourceFace = {
|
|
11
|
+
/** Human-readable label for debug/log output. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Parsed text-shaper font instance. */
|
|
14
|
+
font: TextShaperFont;
|
|
15
|
+
};
|
|
16
|
+
/** Lease handle returned by the shared font resource store. */
|
|
17
|
+
export type ResttyFontResourceLease = {
|
|
18
|
+
/** Ordered parsed faces (primary + fallbacks). */
|
|
19
|
+
faces: ResttyFontResourceFace[];
|
|
20
|
+
/** Release the lease when pane/runtime no longer needs the faces. */
|
|
21
|
+
release: () => void;
|
|
22
|
+
};
|
|
23
|
+
/** Session-level font resource store for deduped loading/parsing and caching. */
|
|
24
|
+
export type ResttyFontResourceStore = {
|
|
25
|
+
/** Acquire parsed faces for a source list. */
|
|
26
|
+
acquire: (sources: ResttyFontSource[]) => Promise<ResttyFontResourceLease>;
|
|
27
|
+
};
|
|
8
28
|
/**
|
|
9
29
|
* Session provider that supplies shared WASM and WebGPU resources.
|
|
10
30
|
*/
|
|
@@ -13,6 +33,8 @@ export type ResttyAppSession = {
|
|
|
13
33
|
getWasm: () => Promise<ResttyWasm>;
|
|
14
34
|
/** Lazily initialize and return the WebGPU renderer core for a canvas. */
|
|
15
35
|
getWebGPUCore: (canvas: HTMLCanvasElement) => Promise<WebGPUCoreState | null>;
|
|
36
|
+
/** Return the shared font resource store for this session/tab. */
|
|
37
|
+
getFontResourceStore?: () => ResttyFontResourceStore;
|
|
16
38
|
/** Subscribe to WASM log output. */
|
|
17
39
|
addWasmLogListener?: (listener: ResttyWasmLogListener) => void;
|
|
18
40
|
/** Unsubscribe from WASM log output. */
|
|
@@ -138,6 +160,8 @@ export type ResttyFontPreset = "default-cdn" | "none";
|
|
|
138
160
|
* - off: disable touch selection entirely
|
|
139
161
|
*/
|
|
140
162
|
export type ResttyTouchSelectionMode = "drag" | "long-press" | "off";
|
|
163
|
+
/** Hinting target mode used when TrueType hinting is enabled. */
|
|
164
|
+
export type ResttyFontHintTarget = "auto" | "light" | "normal";
|
|
141
165
|
/** Input payload passed to ResttyApp before-input hooks. */
|
|
142
166
|
export type ResttyAppInputPayload = {
|
|
143
167
|
text: string;
|
|
@@ -191,6 +215,15 @@ export type ResttyAppOptions = {
|
|
|
191
215
|
renderer?: "auto" | "webgpu" | "webgl2";
|
|
192
216
|
/** Font size in CSS pixels. */
|
|
193
217
|
fontSize?: number;
|
|
218
|
+
/** Enable TrueType hinting during atlas rasterization (default false). */
|
|
219
|
+
fontHinting?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Hinting target mode passed to text-shaper when hinting is enabled.
|
|
222
|
+
* - auto: infer from pixel mode
|
|
223
|
+
* - light: prefer light/subpixel-like vertical hinting
|
|
224
|
+
* - normal: prefer full hinting
|
|
225
|
+
*/
|
|
226
|
+
fontHintTarget?: ResttyFontHintTarget;
|
|
194
227
|
/**
|
|
195
228
|
* Font sizing mode used by text-shaper scale resolution.
|
|
196
229
|
* - em: interpret fontSize as EM size
|
|
@@ -283,6 +316,10 @@ export type ResttyApp = {
|
|
|
283
316
|
togglePause: () => void;
|
|
284
317
|
/** Update the terminal font size in CSS pixels. */
|
|
285
318
|
setFontSize: (value: number) => void;
|
|
319
|
+
/** Enable or disable TrueType hinting for atlas glyph rasterization. */
|
|
320
|
+
setFontHinting: (value: boolean) => void;
|
|
321
|
+
/** Update hinting target mode used when hinting is enabled. */
|
|
322
|
+
setFontHintTarget: (value: ResttyFontHintTarget) => void;
|
|
286
323
|
/** Replace the active font sources and reload fonts. */
|
|
287
324
|
setFontSources: (sources: ResttyFontSource[]) => Promise<void>;
|
|
288
325
|
/** Apply a Ghostty color theme. */
|