restty 0.1.33 → 0.1.35
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 +26 -1
- package/dist/chunk-zqscavsh.js +70316 -0
- package/dist/ime/ime.d.ts +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/internal.d.ts +2 -1
- package/dist/internal.esm.js +22285 -0
- package/dist/internal.js +1 -1
- package/dist/restty.esm.js +22285 -0
- package/dist/restty.js +1 -1
- package/dist/runtime/create-runtime/font-runtime-grid-helpers.d.ts +1 -0
- package/dist/runtime/create-runtime/font-runtime-helpers.types.d.ts +1 -0
- package/dist/runtime/create-runtime/highlight-terminal-color-utils.d.ts +13 -0
- package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-aux-handlers.d.ts +2 -3
- package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-events.d.ts +4 -10
- package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-up-handler.d.ts +3 -2
- package/dist/runtime/create-runtime/interaction-runtime/desktop-word-selection.d.ts +8 -0
- package/dist/runtime/create-runtime/interaction-runtime/scrollbar-runtime.d.ts +4 -10
- package/dist/runtime/create-runtime/interaction-runtime/types.d.ts +6 -6
- package/dist/runtime/create-runtime/lifecycle-theme-size.types.d.ts +13 -2
- package/dist/runtime/create-runtime/ligature-runs.d.ts +52 -0
- package/dist/runtime/create-runtime/native-scrollbar-host.d.ts +15 -0
- package/dist/runtime/create-runtime/render-tick-webgpu.types.d.ts +11 -3
- package/dist/runtime/create-runtime/runtime-app-api.d.ts +8 -0
- package/dist/runtime/create-runtime/search-highlight-utils.d.ts +21 -0
- package/dist/runtime/create-runtime/search-runtime.d.ts +22 -0
- package/dist/runtime/overlay-scrollbar.d.ts +0 -7
- package/dist/runtime/types.d.ts +28 -0
- package/dist/selection/core.d.ts +1 -1
- package/dist/surface/pane-app-manager.d.ts +16 -1
- package/dist/surface/pane-search-ui.d.ts +87 -0
- package/dist/surface/restty/active-pane-api.d.ts +8 -0
- package/dist/surface/restty/pane-ops.d.ts +17 -8
- package/dist/surface/restty-pane-handle.d.ts +38 -3
- package/dist/surface/restty.d.ts +5 -3
- package/dist/theme/ghostty.d.ts +13 -2
- package/dist/wasm/index.d.ts +1 -1
- package/dist/wasm/runtime/restty-wasm.d.ts +15 -1
- package/dist/wasm/runtime/types.d.ts +24 -0
- package/dist/xterm.esm.js +12210 -0
- package/dist/xterm.js +1 -1
- package/package.json +19 -3
- package/dist/chunk-p8wzkwjt.js +0 -66857
package/dist/restty.js
CHANGED
|
@@ -69,6 +69,7 @@ export type CreateRuntimeFontRuntimeHelpersOptions = {
|
|
|
69
69
|
getWasmHandle: () => number;
|
|
70
70
|
ptyTransport: PtyTransport;
|
|
71
71
|
setNeedsRender: () => void;
|
|
72
|
+
markSearchDirty?: () => void;
|
|
72
73
|
getFontHinting: () => boolean;
|
|
73
74
|
getFontHintTarget: () => ResttyFontHintTarget;
|
|
74
75
|
fontScaleOverrides: Array<{
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ThemeTerminalColor } from "../../theme";
|
|
2
|
+
import type { Color } from "../../renderer";
|
|
3
|
+
export type RuntimeTerminalColor = {
|
|
4
|
+
kind: "color";
|
|
5
|
+
color: Color;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "cell-foreground";
|
|
8
|
+
} | {
|
|
9
|
+
kind: "cell-background";
|
|
10
|
+
};
|
|
11
|
+
export declare function runtimeTerminalColorFromTheme(value: ThemeTerminalColor): RuntimeTerminalColor;
|
|
12
|
+
export declare function resolveHighlightBackgroundColor(value: RuntimeTerminalColor, cellFg: Color, cellBg: Color, inverse: boolean): Color;
|
|
13
|
+
export declare function resolveHighlightForegroundColor(value: RuntimeTerminalColor, cellFg: Color, cellBg: Color, inverse: boolean): Color;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { InputHandler } from "../../../input";
|
|
2
|
-
import type { RuntimeCell, RuntimeDesktopSelectionState, RuntimeGridState,
|
|
2
|
+
import type { RuntimeCell, RuntimeDesktopSelectionState, RuntimeGridState, RuntimeSelectionState, RuntimeTouchSelectionState } from "./types";
|
|
3
3
|
type CreatePointerAuxHandlersOptions = {
|
|
4
4
|
inputHandler: InputHandler;
|
|
5
5
|
shouldRoutePointerToAppMouse: (shiftKey: boolean) => boolean;
|
|
6
|
-
|
|
6
|
+
scrollViewportByWheel?: (event: WheelEvent) => void;
|
|
7
7
|
getWasmReady: () => boolean;
|
|
8
8
|
getWasmHandle: () => number;
|
|
9
9
|
getGridState: () => RuntimeGridState;
|
|
@@ -14,7 +14,6 @@ type CreatePointerAuxHandlersOptions = {
|
|
|
14
14
|
selectionState: RuntimeSelectionState;
|
|
15
15
|
touchSelectionState: RuntimeTouchSelectionState;
|
|
16
16
|
desktopSelectionState: RuntimeDesktopSelectionState;
|
|
17
|
-
scrollbarDragState: RuntimeScrollbarDragState;
|
|
18
17
|
updateCanvasCursor: () => void;
|
|
19
18
|
markNeedsRender: () => void;
|
|
20
19
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { BindCanvasEventsOptions, RuntimeCell, RuntimeDesktopSelectionState, RuntimeGridState, RuntimeLinkState, RuntimeScrollbarDragState, RuntimeSelectionState, RuntimeTouchSelectionState } from "./types";
|
|
1
|
+
import type { BindCanvasEventsOptions, RuntimeCell, RuntimeDesktopSelectionState, RuntimeGridState, RuntimeLinkState, RuntimeSelectionState, RuntimeTouchSelectionState } from "./types";
|
|
3
2
|
export type BindPointerEventsOptions = {
|
|
4
3
|
canvas: HTMLCanvasElement;
|
|
5
4
|
bindOptions: BindCanvasEventsOptions;
|
|
@@ -9,7 +8,6 @@ export type BindPointerEventsOptions = {
|
|
|
9
8
|
selectionState: RuntimeSelectionState;
|
|
10
9
|
touchSelectionState: RuntimeTouchSelectionState;
|
|
11
10
|
desktopSelectionState: RuntimeDesktopSelectionState;
|
|
12
|
-
scrollbarDragState: RuntimeScrollbarDragState;
|
|
13
11
|
linkState: RuntimeLinkState;
|
|
14
12
|
cleanupCanvasFns: Array<() => void>;
|
|
15
13
|
isTouchPointer: (event: PointerEvent) => boolean;
|
|
@@ -17,13 +15,9 @@ export type BindPointerEventsOptions = {
|
|
|
17
15
|
clearPendingDesktopSelection: () => void;
|
|
18
16
|
tryActivatePendingTouchSelection: (pointerId: number) => boolean;
|
|
19
17
|
beginSelectionDrag: (cell: RuntimeCell, pointerId: number) => void;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
};
|
|
26
|
-
setViewportScrollOffset: (nextOffset: number) => void;
|
|
18
|
+
selectWordAtCell?: (cell: RuntimeCell) => boolean;
|
|
19
|
+
selectLineAtCell?: (cell: RuntimeCell) => boolean;
|
|
20
|
+
scrollViewportByWheel?: (event: WheelEvent) => void;
|
|
27
21
|
normalizeSelectionCell: (cell: RuntimeCell) => RuntimeCell;
|
|
28
22
|
positionToCell: (event: {
|
|
29
23
|
clientX: number;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { InputHandler } from "../../../input";
|
|
2
|
-
import type { RuntimeCell, RuntimeDesktopSelectionState, RuntimeLinkState,
|
|
2
|
+
import type { RuntimeCell, RuntimeDesktopSelectionState, RuntimeLinkState, RuntimeSelectionState, RuntimeTouchSelectionState } from "./types";
|
|
3
3
|
type CreatePointerUpHandlerOptions = {
|
|
4
4
|
inputHandler: InputHandler;
|
|
5
5
|
sendKeyInput: (text: string) => void;
|
|
6
6
|
openLink: (url: string) => void;
|
|
7
|
-
scrollbarDragState: RuntimeScrollbarDragState;
|
|
8
7
|
isTouchPointer: (event: PointerEvent) => boolean;
|
|
9
8
|
touchSelectionState: RuntimeTouchSelectionState;
|
|
10
9
|
selectionState: RuntimeSelectionState;
|
|
@@ -17,6 +16,8 @@ type CreatePointerUpHandlerOptions = {
|
|
|
17
16
|
clearPendingDesktopSelection: () => void;
|
|
18
17
|
desktopSelectionState: RuntimeDesktopSelectionState;
|
|
19
18
|
clearSelection: () => void;
|
|
19
|
+
selectWordAtCell?: (cell: RuntimeCell) => boolean;
|
|
20
|
+
selectLineAtCell?: (cell: RuntimeCell) => boolean;
|
|
20
21
|
updateCanvasCursor: () => void;
|
|
21
22
|
markNeedsRender: () => void;
|
|
22
23
|
shouldRoutePointerToAppMouse: (shiftKey: boolean) => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RenderState } from "../../../wasm";
|
|
2
|
+
import type { RuntimeCell } from "./types";
|
|
3
|
+
type DesktopWordSelectionRange = {
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function resolveDesktopWordSelectionRange(render: RenderState | null, cell: RuntimeCell): DesktopWordSelectionRange | null;
|
|
8
|
+
export {};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { type OverlayScrollbarLayout } from "../../overlay-scrollbar";
|
|
2
1
|
import type { RuntimeGridState, RuntimeLinkState, RuntimeScrollbarState, RuntimeSelectionState } from "./types";
|
|
3
2
|
import type { ResttyWasm, ResttyWasmExports } from "../../../wasm";
|
|
4
3
|
export type CreateScrollbarRuntimeOptions = {
|
|
5
|
-
showOverlayScrollbar: boolean;
|
|
6
4
|
scrollbarState: RuntimeScrollbarState;
|
|
7
5
|
selectionState: RuntimeSelectionState;
|
|
8
6
|
linkState: RuntimeLinkState;
|
|
9
7
|
getCanvas: () => HTMLCanvasElement;
|
|
10
|
-
getCurrentDpr: () => number;
|
|
11
8
|
getGridState: () => RuntimeGridState;
|
|
12
9
|
getWasmReady: () => boolean;
|
|
13
10
|
getWasm: () => ResttyWasm | null;
|
|
@@ -15,16 +12,13 @@ export type CreateScrollbarRuntimeOptions = {
|
|
|
15
12
|
getWasmExports: () => ResttyWasmExports | null;
|
|
16
13
|
updateLinkHover: (cell: null) => void;
|
|
17
14
|
markNeedsRender: () => void;
|
|
15
|
+
markSearchDirty?: () => void;
|
|
18
16
|
};
|
|
19
17
|
export type ScrollbarRuntime = {
|
|
18
|
+
destroy: () => void;
|
|
20
19
|
noteScrollActivity: () => void;
|
|
21
20
|
scrollViewportByLines: (lines: number) => void;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
};
|
|
27
|
-
getOverlayScrollbarLayout: () => OverlayScrollbarLayout | null;
|
|
28
|
-
appendOverlayScrollbar: (overlayData: number[], total: number, offset: number, len: number) => void;
|
|
21
|
+
scrollViewportByWheel: (event: WheelEvent) => void;
|
|
22
|
+
syncScrollbar: (total: number, offset: number, len: number) => void;
|
|
29
23
|
};
|
|
30
24
|
export declare function createScrollbarRuntime(options: CreateScrollbarRuntimeOptions): ScrollbarRuntime;
|
|
@@ -32,6 +32,9 @@ export type RuntimeDesktopSelectionState = {
|
|
|
32
32
|
pendingPointerId: number | null;
|
|
33
33
|
pendingCell: RuntimeCell | null;
|
|
34
34
|
startedWithActiveSelection: boolean;
|
|
35
|
+
lastPrimaryClickAt: number;
|
|
36
|
+
lastPrimaryClickCell: RuntimeCell | null;
|
|
37
|
+
lastPrimaryClickCount: number;
|
|
35
38
|
};
|
|
36
39
|
export type RuntimeLinkState = {
|
|
37
40
|
hoverId: number;
|
|
@@ -43,10 +46,6 @@ export type RuntimeScrollbarState = {
|
|
|
43
46
|
lastOffset: number;
|
|
44
47
|
lastLen: number;
|
|
45
48
|
};
|
|
46
|
-
export type RuntimeScrollbarDragState = {
|
|
47
|
-
pointerId: number | null;
|
|
48
|
-
thumbGrabRatio: number;
|
|
49
|
-
};
|
|
50
49
|
export type RuntimeSelectionState = ReturnType<typeof createSelectionState>;
|
|
51
50
|
export type BindCanvasEventsOptions = {
|
|
52
51
|
inputHandler: InputHandler;
|
|
@@ -63,7 +62,6 @@ export type CreateRuntimeInteractionOptions = {
|
|
|
63
62
|
touchSelectionMode: "off" | "drag" | "long-press";
|
|
64
63
|
touchSelectionLongPressMs: number;
|
|
65
64
|
touchSelectionMoveThresholdPx: number;
|
|
66
|
-
showOverlayScrollbar: boolean;
|
|
67
65
|
imeInput: HTMLTextAreaElement | null;
|
|
68
66
|
cleanupCanvasFns: Array<() => void>;
|
|
69
67
|
getCanvas: () => HTMLCanvasElement;
|
|
@@ -76,6 +74,7 @@ export type CreateRuntimeInteractionOptions = {
|
|
|
76
74
|
getWasmExports: () => ResttyWasmExports | null;
|
|
77
75
|
updateLinkHover: (cell: RuntimeCell | null) => void;
|
|
78
76
|
markNeedsRender: () => void;
|
|
77
|
+
markSearchDirty?: () => void;
|
|
79
78
|
};
|
|
80
79
|
export type RuntimeInteraction = {
|
|
81
80
|
selectionState: RuntimeSelectionState;
|
|
@@ -95,11 +94,12 @@ export type RuntimeInteraction = {
|
|
|
95
94
|
x: number;
|
|
96
95
|
y: number;
|
|
97
96
|
};
|
|
97
|
+
selectWordAtClientPoint: (clientX: number, clientY: number) => boolean;
|
|
98
98
|
clearSelection: () => void;
|
|
99
99
|
updateImePosition: (cursor: {
|
|
100
100
|
row: number;
|
|
101
101
|
col: number;
|
|
102
102
|
} | null | undefined, cellW: number, cellH: number) => void;
|
|
103
|
-
|
|
103
|
+
syncScrollbar: (total: number, offset: number, len: number) => void;
|
|
104
104
|
bindCanvasEvents: (bindOptions: BindCanvasEventsOptions) => void;
|
|
105
105
|
};
|
|
@@ -2,6 +2,7 @@ import type { InputHandler } from "../../input";
|
|
|
2
2
|
import type { FontManagerState } from "../../fonts";
|
|
3
3
|
import type { Color, WebGLState, WebGPUState } from "../../renderer";
|
|
4
4
|
import type { GhosttyTheme } from "../../theme";
|
|
5
|
+
import type { RuntimeTerminalColor } from "./highlight-terminal-color-utils";
|
|
5
6
|
import type { ResttyWasm } from "../../wasm";
|
|
6
7
|
import type { ResttyAppCallbacks } from "../types";
|
|
7
8
|
export type ActiveState = WebGPUState | WebGLState | null;
|
|
@@ -44,7 +45,12 @@ export type LifecycleThemeSizeDeps = {
|
|
|
44
45
|
fontState: FontManagerState;
|
|
45
46
|
defaultBgBase: Color;
|
|
46
47
|
defaultFgBase: Color;
|
|
47
|
-
|
|
48
|
+
selectionBackgroundBase: RuntimeTerminalColor;
|
|
49
|
+
selectionForegroundBase: RuntimeTerminalColor | null;
|
|
50
|
+
searchMatchBackgroundBase: RuntimeTerminalColor;
|
|
51
|
+
searchCurrentMatchBackgroundBase: RuntimeTerminalColor;
|
|
52
|
+
searchMatchTextBase: RuntimeTerminalColor;
|
|
53
|
+
searchCurrentMatchTextBase: RuntimeTerminalColor;
|
|
48
54
|
cursorBase: Color;
|
|
49
55
|
getCanvas: () => HTMLCanvasElement;
|
|
50
56
|
setCanvas: (canvas: HTMLCanvasElement) => void;
|
|
@@ -58,7 +64,12 @@ export type LifecycleThemeSizeDeps = {
|
|
|
58
64
|
setActiveTheme: (theme: GhosttyTheme | null) => void;
|
|
59
65
|
setDefaultBg: (value: Color) => void;
|
|
60
66
|
setDefaultFg: (value: Color) => void;
|
|
61
|
-
|
|
67
|
+
setSelectionBackgroundColor: (value: RuntimeTerminalColor) => void;
|
|
68
|
+
setSelectionForegroundColor: (value: RuntimeTerminalColor | null) => void;
|
|
69
|
+
setSearchMatchBackgroundColor: (value: RuntimeTerminalColor) => void;
|
|
70
|
+
setSearchCurrentMatchBackgroundColor: (value: RuntimeTerminalColor) => void;
|
|
71
|
+
setSearchMatchTextColor: (value: RuntimeTerminalColor) => void;
|
|
72
|
+
setSearchCurrentMatchTextColor: (value: RuntimeTerminalColor) => void;
|
|
62
73
|
setCursorFallback: (value: Color) => void;
|
|
63
74
|
getWasmReady: () => boolean;
|
|
64
75
|
getWasm: () => ResttyWasm | null;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
type CellCluster = {
|
|
2
|
+
cp: number;
|
|
3
|
+
text: string;
|
|
4
|
+
span: number;
|
|
5
|
+
};
|
|
6
|
+
type CursorCell = {
|
|
7
|
+
row: number;
|
|
8
|
+
col: number;
|
|
9
|
+
wide: boolean;
|
|
10
|
+
};
|
|
11
|
+
type ResolveLigatureRunOptions = {
|
|
12
|
+
idx: number;
|
|
13
|
+
row: number;
|
|
14
|
+
col: number;
|
|
15
|
+
cols: number;
|
|
16
|
+
contentTags: Uint8Array | null;
|
|
17
|
+
styleFlags: Uint16Array | null;
|
|
18
|
+
linkIds: Uint32Array | null;
|
|
19
|
+
fgBytes: Uint8Array;
|
|
20
|
+
bgBytes: Uint8Array | null;
|
|
21
|
+
ulBytes: Uint8Array | null;
|
|
22
|
+
ulStyle: Uint8Array | null;
|
|
23
|
+
cursorBlock: boolean;
|
|
24
|
+
cursorCell: CursorCell | null;
|
|
25
|
+
readCellCluster: (cellIndex: number) => CellCluster | null;
|
|
26
|
+
};
|
|
27
|
+
type LigatureRun = {
|
|
28
|
+
text: string;
|
|
29
|
+
span: number;
|
|
30
|
+
indices: number[];
|
|
31
|
+
};
|
|
32
|
+
type ShapedGlyphLike = {
|
|
33
|
+
glyphId: number;
|
|
34
|
+
xAdvance: number;
|
|
35
|
+
xOffset: number;
|
|
36
|
+
};
|
|
37
|
+
type ShapedClusterLike = {
|
|
38
|
+
glyphs: ShapedGlyphLike[];
|
|
39
|
+
advance: number;
|
|
40
|
+
};
|
|
41
|
+
type ResolveRenderableLigatureRunOptions<FontEntry> = {
|
|
42
|
+
ligatureRun: LigatureRun;
|
|
43
|
+
stylePreference: string;
|
|
44
|
+
fonts: FontEntry[];
|
|
45
|
+
pickFontIndexForText: (text: string, expectedSpan?: number, stylePreference?: string) => number;
|
|
46
|
+
shapeClusterWithFont: (entry: FontEntry, text: string) => ShapedClusterLike;
|
|
47
|
+
readCellCluster: (cellIndex: number) => CellCluster | null;
|
|
48
|
+
};
|
|
49
|
+
export declare function resolveLigatureRun(options: ResolveLigatureRunOptions): LigatureRun | null;
|
|
50
|
+
export declare function shouldUseLigatureShape(combined: ShapedClusterLike, singles: ShapedClusterLike[]): boolean;
|
|
51
|
+
export declare function resolveRenderableLigatureRun<FontEntry>(options: ResolveRenderableLigatureRunOptions<FontEntry>): LigatureRun | null;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type CreateNativeScrollbarHostOptions = {
|
|
2
|
+
canvas: HTMLCanvasElement;
|
|
3
|
+
getGridState: () => {
|
|
4
|
+
cellH: number;
|
|
5
|
+
};
|
|
6
|
+
noteScrollActivity: () => void;
|
|
7
|
+
setViewportScrollOffset: (nextOffset: number) => void;
|
|
8
|
+
};
|
|
9
|
+
export type NativeScrollbarHost = {
|
|
10
|
+
flash: () => void;
|
|
11
|
+
sync: (total: number, offset: number, len: number) => void;
|
|
12
|
+
destroy: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function createNativeScrollbarHost(options: CreateNativeScrollbarHostOptions): NativeScrollbarHost;
|
|
15
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { FontEntry, FontManagerState } from "../../fonts";
|
|
2
2
|
import type { NerdConstraint } from "../../fonts/nerd-constraints";
|
|
3
3
|
import type { Color, WebGPUState } from "../../renderer";
|
|
4
|
+
import type { RuntimeTerminalColor } from "./highlight-terminal-color-utils";
|
|
4
5
|
import type { CompiledWebGPUShaderStage, WebGPUStageTargets } from "../create-app-types";
|
|
5
6
|
import type { GlyphConstraintMeta } from "../atlas-builder";
|
|
6
|
-
import type { KittyPlacement, RenderState, ResttyWasm, ResttyWasmExports } from "../../wasm";
|
|
7
|
+
import type { KittyPlacement, RenderState, ResttyWasm, ResttyWasmExports, SearchViewportMatch } from "../../wasm";
|
|
7
8
|
import type { KittyDrawPlan, KittyDrawSlice } from "./kitty-render-runtime";
|
|
8
9
|
import type { ResttyFontHintTarget } from "../types";
|
|
9
10
|
export type CursorPosition = {
|
|
@@ -99,6 +100,7 @@ export type SharedTickDeps = {
|
|
|
99
100
|
match: RegExp;
|
|
100
101
|
scale: number;
|
|
101
102
|
}>;
|
|
103
|
+
getLigatures: () => boolean;
|
|
102
104
|
getFontHinting: () => boolean;
|
|
103
105
|
getFontHintTarget: () => ResttyFontHintTarget;
|
|
104
106
|
isSymbolFont: (entry: FontEntry) => boolean;
|
|
@@ -117,9 +119,15 @@ export type SharedTickDeps = {
|
|
|
117
119
|
start: number;
|
|
118
120
|
end: number;
|
|
119
121
|
} | null;
|
|
122
|
+
getSearchViewportMatches: () => readonly SearchViewportMatch[];
|
|
120
123
|
pushRect: (target: number[], x: number, y: number, width: number, height: number, color: Color) => void;
|
|
121
124
|
pushRectBox: (target: number[], x: number, y: number, width: number, height: number, color: Color) => void;
|
|
122
|
-
|
|
125
|
+
selectionBackgroundColor: RuntimeTerminalColor;
|
|
126
|
+
selectionForegroundColor: RuntimeTerminalColor | null;
|
|
127
|
+
searchMatchBackgroundColor: RuntimeTerminalColor;
|
|
128
|
+
searchCurrentMatchBackgroundColor: RuntimeTerminalColor;
|
|
129
|
+
searchMatchTextColor: RuntimeTerminalColor;
|
|
130
|
+
searchCurrentMatchTextColor: RuntimeTerminalColor;
|
|
123
131
|
STYLE_BOLD: number;
|
|
124
132
|
STYLE_ITALIC: number;
|
|
125
133
|
STYLE_FAINT: number;
|
|
@@ -197,7 +205,7 @@ export type SharedTickDeps = {
|
|
|
197
205
|
lastOffset: number;
|
|
198
206
|
lastLen: number;
|
|
199
207
|
};
|
|
200
|
-
|
|
208
|
+
syncScrollbar: (total: number, offset: number, len: number) => void;
|
|
201
209
|
webgpuUniforms: Float32Array;
|
|
202
210
|
ensureInstanceBuffer: (state: WebGPUState, kind: "rect" | "glyph", minBytes: number) => void;
|
|
203
211
|
GLYPH_INSTANCE_FLOATS: number;
|
|
@@ -25,10 +25,16 @@ type RuntimeSendInput = (text: string, source?: string, options?: {
|
|
|
25
25
|
}) => void;
|
|
26
26
|
type RuntimePublicApiOptions = {
|
|
27
27
|
setFontSize: ResttyApp["setFontSize"];
|
|
28
|
+
setLigatures: ResttyApp["setLigatures"];
|
|
28
29
|
setFontHinting: ResttyApp["setFontHinting"];
|
|
29
30
|
setFontHintTarget: ResttyApp["setFontHintTarget"];
|
|
30
31
|
setFontSources: ResttyApp["setFontSources"];
|
|
31
32
|
resetTheme: ResttyApp["resetTheme"];
|
|
33
|
+
setSearchQuery: ResttyApp["setSearchQuery"];
|
|
34
|
+
clearSearch: ResttyApp["clearSearch"];
|
|
35
|
+
searchNext: ResttyApp["searchNext"];
|
|
36
|
+
searchPrevious: ResttyApp["searchPrevious"];
|
|
37
|
+
getSearchState: ResttyApp["getSearchState"];
|
|
32
38
|
dumpAtlasForCodepoint: ResttyApp["dumpAtlasForCodepoint"];
|
|
33
39
|
resize: ResttyApp["resize"];
|
|
34
40
|
focus: ResttyApp["focus"];
|
|
@@ -100,6 +106,8 @@ type CreateRuntimeAppApiOptions = {
|
|
|
100
106
|
destroyWebGPUStageTargets: () => void;
|
|
101
107
|
clearWebGLShaderStages: (state?: WebGLState) => void;
|
|
102
108
|
destroyWebGLStageTargets: (state?: WebGLState) => void;
|
|
109
|
+
markSearchDirty: () => void;
|
|
110
|
+
handleSearchWasmReset: () => void;
|
|
103
111
|
};
|
|
104
112
|
export declare function createRuntimeAppApi(options: CreateRuntimeAppApiOptions): RuntimeAppApiRuntime;
|
|
105
113
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Color } from "../../renderer";
|
|
2
|
+
import type { ResttySearchViewportMatch } from "../types";
|
|
3
|
+
export type SearchCellHighlightKind = 0 | 1 | 2;
|
|
4
|
+
type AppendSearchHighlightsOptions = {
|
|
5
|
+
target: number[];
|
|
6
|
+
matches: ResttySearchViewportMatch[];
|
|
7
|
+
rows: number;
|
|
8
|
+
cols: number;
|
|
9
|
+
cellW: number;
|
|
10
|
+
cellH: number;
|
|
11
|
+
inactiveColor: Color;
|
|
12
|
+
activeColor: Color;
|
|
13
|
+
pushRect: (target: number[], x: number, y: number, width: number, height: number, color: Color) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function appendSearchHighlightsForRow(target: number[], matches: readonly ResttySearchViewportMatch[], startIndex: number, row: number, rowY: number, cols: number, cellW: number, cellH: number, inactiveColor: Color, activeColor: Color, pushRect: (target: number[], x: number, y: number, width: number, height: number, color: Color) => void): number;
|
|
16
|
+
export declare function appendSearchHighlights(options: AppendSearchHighlightsOptions): void;
|
|
17
|
+
export declare function searchHighlightForColumn(matches: readonly ResttySearchViewportMatch[], startIndex: number, endIndex: number, col: number, cols: number): {
|
|
18
|
+
nextIndex: number;
|
|
19
|
+
kind: SearchCellHighlightKind;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ResttyWasm, SearchViewportMatch } from "../../wasm";
|
|
2
|
+
import type { ResttyAppCallbacks, ResttySearchState } from "../types";
|
|
3
|
+
type CreateRuntimeSearchOptions = {
|
|
4
|
+
callbacks?: ResttyAppCallbacks;
|
|
5
|
+
cleanupFns: Array<() => void>;
|
|
6
|
+
getWasmReady: () => boolean;
|
|
7
|
+
getWasm: () => ResttyWasm | null;
|
|
8
|
+
getWasmHandle: () => number;
|
|
9
|
+
markNeedsRender: () => void;
|
|
10
|
+
};
|
|
11
|
+
type RuntimeSearch = {
|
|
12
|
+
setQuery: (query: string) => void;
|
|
13
|
+
clear: () => void;
|
|
14
|
+
next: () => void;
|
|
15
|
+
previous: () => void;
|
|
16
|
+
getState: () => ResttySearchState;
|
|
17
|
+
getViewportMatches: () => SearchViewportMatch[];
|
|
18
|
+
markDirty: () => void;
|
|
19
|
+
handleWasmReset: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare function createRuntimeSearch(options: CreateRuntimeSearchOptions): RuntimeSearch;
|
|
22
|
+
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { type Color } from "../renderer";
|
|
2
1
|
export declare const OVERLAY_SCROLLBAR_WIDTH_CSS_PX = 7;
|
|
3
2
|
export declare const OVERLAY_SCROLLBAR_MARGIN_CSS_PX = 4;
|
|
4
3
|
export declare const OVERLAY_SCROLLBAR_INSET_Y_CSS_PX = 2;
|
|
5
4
|
export declare const OVERLAY_SCROLLBAR_MIN_THUMB_CSS_PX = 28;
|
|
6
|
-
export declare const OVERLAY_SCROLLBAR_CAP_SUPERSAMPLE = 8;
|
|
7
5
|
export type OverlayScrollbarLayout = {
|
|
8
6
|
total: number;
|
|
9
7
|
offset: number;
|
|
@@ -17,8 +15,3 @@ export type OverlayScrollbarLayout = {
|
|
|
17
15
|
thumbH: number;
|
|
18
16
|
};
|
|
19
17
|
export declare function computeOverlayScrollbarLayout(total: number, offset: number, len: number, canvasWidth: number, canvasHeight: number, currentDpr: number): OverlayScrollbarLayout | null;
|
|
20
|
-
export declare function isPointInScrollbarHitArea(layout: OverlayScrollbarLayout, x: number, y: number): boolean;
|
|
21
|
-
export declare function isPointInScrollbarThumb(layout: OverlayScrollbarLayout, x: number, y: number): boolean;
|
|
22
|
-
export declare function scrollbarOffsetForPointerY(layout: OverlayScrollbarLayout, pointerY: number, thumbGrabRatio: number): number;
|
|
23
|
-
export declare function pushRoundedVerticalBar(out: number[], x: number, y: number, w: number, h: number, color: Color, capSupersample?: number): void;
|
|
24
|
-
export declare function resolveOverlayScrollbarAlpha(now: number, lastInputAt: number): number;
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -3,9 +3,19 @@ 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 { SearchViewportMatch } from "../wasm";
|
|
6
7
|
import type { Font as TextShaperFont } from "text-shaper";
|
|
7
8
|
/** Callback for WASM log messages. */
|
|
8
9
|
export type ResttyWasmLogListener = (message: string) => void;
|
|
10
|
+
export type ResttySearchState = {
|
|
11
|
+
query: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
pending: boolean;
|
|
14
|
+
complete: boolean;
|
|
15
|
+
total: number;
|
|
16
|
+
selectedIndex: number | null;
|
|
17
|
+
};
|
|
18
|
+
export type ResttySearchViewportMatch = SearchViewportMatch;
|
|
9
19
|
/** Shared parsed font face reused across panes within a session. */
|
|
10
20
|
export type ResttyFontResourceFace = {
|
|
11
21
|
/** Human-readable label for debug/log output. */
|
|
@@ -109,6 +119,8 @@ export type ResttyAppCallbacks = {
|
|
|
109
119
|
onMouseStatus?: (status: string) => void;
|
|
110
120
|
/** Terminal requested a desktop notification via OSC 9 / OSC 777. */
|
|
111
121
|
onDesktopNotification?: (notification: DesktopNotification) => void;
|
|
122
|
+
/** Terminal search state changed. */
|
|
123
|
+
onSearchState?: (state: ResttySearchState) => void;
|
|
112
124
|
};
|
|
113
125
|
/** Raw font data as an ArrayBuffer or typed-array view. */
|
|
114
126
|
export type ResttyFontBufferData = ArrayBuffer | ArrayBufferView;
|
|
@@ -215,6 +227,8 @@ export type ResttyAppOptions = {
|
|
|
215
227
|
renderer?: "auto" | "webgpu" | "webgl2";
|
|
216
228
|
/** Font size in CSS pixels. */
|
|
217
229
|
fontSize?: number;
|
|
230
|
+
/** Enable programming ligature shaping across adjacent operator cells (default true). */
|
|
231
|
+
ligatures?: boolean;
|
|
218
232
|
/** Enable TrueType hinting during atlas rasterization (default false). */
|
|
219
233
|
fontHinting?: boolean;
|
|
220
234
|
/**
|
|
@@ -316,6 +330,8 @@ export type ResttyApp = {
|
|
|
316
330
|
togglePause: () => void;
|
|
317
331
|
/** Update the terminal font size in CSS pixels. */
|
|
318
332
|
setFontSize: (value: number) => void;
|
|
333
|
+
/** Enable or disable programming ligature shaping. */
|
|
334
|
+
setLigatures: (value: boolean) => void;
|
|
319
335
|
/** Enable or disable TrueType hinting for atlas glyph rasterization. */
|
|
320
336
|
setFontHinting: (value: boolean) => void;
|
|
321
337
|
/** Update hinting target mode used when hinting is enabled. */
|
|
@@ -346,6 +362,18 @@ export type ResttyApp = {
|
|
|
346
362
|
copySelectionToClipboard: () => Promise<boolean>;
|
|
347
363
|
/** Paste clipboard contents into the terminal. */
|
|
348
364
|
pasteFromClipboard: () => Promise<boolean>;
|
|
365
|
+
/** Select the word at a viewport client coordinate. */
|
|
366
|
+
selectWordAtClientPoint: (clientX: number, clientY: number) => boolean;
|
|
367
|
+
/** Update the active terminal search query. */
|
|
368
|
+
setSearchQuery: (query: string) => void;
|
|
369
|
+
/** Clear terminal search state and visible highlights. */
|
|
370
|
+
clearSearch: () => void;
|
|
371
|
+
/** Navigate to the next terminal search match. */
|
|
372
|
+
searchNext: () => void;
|
|
373
|
+
/** Navigate to the previous terminal search match. */
|
|
374
|
+
searchPrevious: () => void;
|
|
375
|
+
/** Get the current terminal search state. */
|
|
376
|
+
getSearchState: () => ResttySearchState;
|
|
349
377
|
/** Dump the glyph atlas entry for a given Unicode codepoint. */
|
|
350
378
|
dumpAtlasForCodepoint: (cp: number) => void;
|
|
351
379
|
/** Resize terminal grid to explicit columns/rows. */
|
package/dist/selection/core.d.ts
CHANGED
|
@@ -23,4 +23,4 @@ export declare function selectionForRow(state: SelectionState, row: number, cols
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function normalizeSelectionCell(cell: CellPosition | null, rows: number, cols: number, wideFlags?: Uint8Array | null): CellPosition | null;
|
|
25
25
|
/** Convert client pixel coordinates to a grid cell position. */
|
|
26
|
-
export declare function positionToCell(clientX: number, clientY: number, canvasRect: DOMRect, dpr: number, cellW: number, cellH: number, cols: number, rows: number): CellPosition;
|
|
26
|
+
export declare function positionToCell(clientX: number, clientY: number, canvasRect: DOMRect, dpr: number, cellW: number, cellH: number, cols: number, rows: number, canvasWidth?: number, canvasHeight?: number): CellPosition;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ResttyPaneStyleOptions, type ResttyPaneStylesOptions, type ResttyPaneContextMenuOptions, type ResttyPaneManager, type ResttyPaneShortcutsOptions, type ResttyPaneWithApp } from "./panes-types";
|
|
2
2
|
import type { ResttyAppOptions, ResttyAppSession } from "../runtime/types";
|
|
3
|
+
import { type ResttyPaneSearchUiCloseOptions, type ResttyPaneSearchUiOpenOptions, type ResttyPaneSearchUiOptions, type ResttyPaneSearchUiStyleOptions } from "./pane-search-ui";
|
|
3
4
|
/**
|
|
4
5
|
* A pane created by the app pane manager, extending the base pane
|
|
5
6
|
* with DOM elements needed by the terminal app.
|
|
@@ -25,8 +26,20 @@ export type ResttyPaneDomDefaults = {
|
|
|
25
26
|
export type ResttyManagedPaneStyleOptions = ResttyPaneStyleOptions;
|
|
26
27
|
/** Style configuration including enabled flag (alias for ResttyPaneStylesOptions). */
|
|
27
28
|
export type ResttyManagedPaneStylesOptions = ResttyPaneStylesOptions;
|
|
29
|
+
/** Style configuration for the built-in pane search UI. */
|
|
30
|
+
export type ResttyManagedPaneSearchUiStyleOptions = ResttyPaneSearchUiStyleOptions;
|
|
31
|
+
/** Built-in pane search UI configuration. */
|
|
32
|
+
export type ResttyManagedPaneSearchUiOptions = ResttyPaneSearchUiOptions;
|
|
28
33
|
/** App options minus the DOM/session fields that the pane manager provides. */
|
|
29
34
|
export type ResttyPaneAppOptionsInput = Omit<ResttyAppOptions, "canvas" | "imeInput" | "session">;
|
|
35
|
+
export type ResttyAppPaneManager = ResttyPaneManager<ResttyManagedAppPane> & {
|
|
36
|
+
openPaneSearch: (id: number, options?: ResttyPaneSearchUiOpenOptions) => void;
|
|
37
|
+
closePaneSearch: (id: number, options?: ResttyPaneSearchUiCloseOptions) => void;
|
|
38
|
+
togglePaneSearch: (id: number, options?: ResttyPaneSearchUiOpenOptions & ResttyPaneSearchUiCloseOptions) => void;
|
|
39
|
+
isPaneSearchOpen: (id: number) => boolean;
|
|
40
|
+
getSearchUiStyleOptions: () => Readonly<Required<ResttyPaneSearchUiStyleOptions>>;
|
|
41
|
+
setSearchUiStyleOptions: (options: ResttyPaneSearchUiStyleOptions) => void;
|
|
42
|
+
};
|
|
30
43
|
/**
|
|
31
44
|
* Configuration for the built-in default context menu.
|
|
32
45
|
*/
|
|
@@ -65,6 +78,8 @@ export type CreateResttyAppPaneManagerOptions = {
|
|
|
65
78
|
minPaneSize?: number;
|
|
66
79
|
/** Enable or configure built-in pane CSS styles. */
|
|
67
80
|
paneStyles?: boolean | ResttyManagedPaneStylesOptions;
|
|
81
|
+
/** Enable or configure the built-in pane search UI. */
|
|
82
|
+
searchUi?: boolean | ResttyManagedPaneSearchUiOptions;
|
|
68
83
|
/** Enable or configure keyboard shortcuts for splitting. */
|
|
69
84
|
shortcuts?: boolean | ResttyPaneShortcutsOptions;
|
|
70
85
|
/** Custom context menu implementation (overrides defaultContextMenu). */
|
|
@@ -86,4 +101,4 @@ export type CreateResttyAppPaneManagerOptions = {
|
|
|
86
101
|
* Create an app-aware pane manager that automatically constructs
|
|
87
102
|
* canvas, IME input, and terminal app instances for each pane.
|
|
88
103
|
*/
|
|
89
|
-
export declare function createResttyAppPaneManager(options: CreateResttyAppPaneManagerOptions):
|
|
104
|
+
export declare function createResttyAppPaneManager(options: CreateResttyAppPaneManagerOptions): ResttyAppPaneManager;
|