restty 0.1.16 → 0.1.18
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 +4 -9
- package/dist/app/atlas-builder.d.ts +38 -0
- package/dist/app/font-sources.d.ts +2 -0
- package/dist/app/pane-app-manager.d.ts +43 -0
- package/dist/app/panes-context-menu.d.ts +10 -0
- package/dist/app/panes-styles.d.ts +5 -0
- package/dist/app/panes-types.d.ts +89 -0
- package/dist/app/panes.d.ts +10 -0
- package/dist/app/restty.d.ts +20 -0
- package/dist/app/session.d.ts +6 -0
- package/dist/app/types.d.ts +123 -0
- package/dist/{app/index.js → chunk-53vdvhe3.js} +24014 -23787
- package/dist/fonts/manager.d.ts +24 -0
- package/dist/fonts/nerd-constraints.d.ts +4 -0
- package/dist/fonts/nerd-ranges.d.ts +2 -0
- package/dist/fonts/types.d.ts +51 -0
- package/dist/grid/grid.d.ts +22 -0
- package/dist/grid/types.d.ts +32 -0
- package/dist/ime/ime.d.ts +13 -0
- package/dist/ime/types.d.ts +8 -0
- package/dist/input/ansi.d.ts +3 -0
- package/dist/input/mouse.d.ts +10 -0
- package/dist/input/output.d.ts +11 -0
- package/dist/input/types.d.ts +7 -0
- package/dist/internal.js +105 -56213
- package/dist/pty/kitty-media.d.ts +3 -0
- package/dist/pty/pty.d.ts +11 -0
- package/dist/pty/types.d.ts +49 -0
- package/dist/renderer/box-drawing-map.d.ts +4 -0
- package/dist/renderer/shaders.d.ts +7 -0
- package/dist/renderer/shapes.d.ts +42 -1
- package/dist/renderer/types.d.ts +43 -0
- package/dist/renderer/webgpu.d.ts +11 -0
- package/dist/restty.js +20 -0
- package/dist/selection/selection.d.ts +24 -0
- package/dist/selection/types.d.ts +13 -0
- package/dist/theme/catalog.d.ts +5 -0
- package/dist/theme/ghostty.d.ts +18 -0
- package/dist/unicode/ghostty-symbol-ranges.d.ts +1 -0
- package/dist/unicode/symbols.d.ts +6 -0
- package/dist/wasm/embedded.d.ts +1 -0
- package/dist/wasm/runtime.d.ts +29 -0
- package/package.json +8 -61
- package/dist/fonts/index.js +0 -5332
- package/dist/grid/index.js +0 -71
- package/dist/ime/index.js +0 -84
- package/dist/index.js +0 -56210
- package/dist/input/index.js +0 -1047
- package/dist/pty/index.js +0 -338
- package/dist/renderer/index.js +0 -1612
- package/dist/selection/index.js +0 -226
- package/dist/theme/index.js +0 -11218
- package/dist/wasm/index.js +0 -6003
package/dist/fonts/manager.d.ts
CHANGED
|
@@ -1,20 +1,44 @@
|
|
|
1
1
|
import type { FontEntry, FontManagerState, ShapedCluster, FallbackFontSource, FontScaleOverride } from "./types";
|
|
2
|
+
/** Check whether a font entry is a symbol/icon font based on its label. */
|
|
2
3
|
export declare function isSymbolFont(entry: FontEntry | null | undefined): boolean;
|
|
4
|
+
/** Check whether a font entry is a Nerd Font symbols font. */
|
|
3
5
|
export declare function isNerdSymbolFont(entry: FontEntry | null | undefined): boolean;
|
|
6
|
+
/** Check whether a font entry is a color emoji font. */
|
|
4
7
|
export declare function isColorEmojiFont(entry: FontEntry | null | undefined): boolean;
|
|
8
|
+
/** Return the maximum cell span for a font (2 for CJK/emoji, 1 otherwise). */
|
|
5
9
|
export declare function fontMaxCellSpan(entry: FontEntry | null | undefined): number;
|
|
10
|
+
/** Return the scale multiplier for a font entry by matching its label against overrides. */
|
|
6
11
|
export declare function fontScaleOverride(entry: FontEntry | null | undefined, overrides?: FontScaleOverride[]): number;
|
|
12
|
+
/** Compute the atlas raster scale for a font, applying symbol atlas scaling for fallback symbol fonts. */
|
|
7
13
|
export declare function fontRasterScale(entry: FontEntry | null | undefined, fontIndex: number, maxSymbolAtlasScale: number, overrides?: FontScaleOverride[]): number;
|
|
14
|
+
/** Create a new FontEntry with empty caches and default metadata. */
|
|
8
15
|
export declare function createFontEntry(font: any, label: string): FontEntry;
|
|
16
|
+
/** Clear all caches and reset rendering metadata on a font entry. */
|
|
9
17
|
export declare function resetFontEntry(entry: FontEntry): void;
|
|
18
|
+
/** Create an empty FontManagerState for initialization. */
|
|
10
19
|
export declare function createFontManagerState(): FontManagerState;
|
|
20
|
+
/** Check whether a font has a non-zero glyph ID for the given character. */
|
|
11
21
|
export declare function fontHasGlyph(font: any, ch: string): boolean;
|
|
22
|
+
/** Get the horizontal advance width in font design units, computing and caching it if needed. */
|
|
12
23
|
export declare function fontAdvanceUnits(entry: FontEntry, shapeClusterWithFont: (entry: FontEntry, text: string) => ShapedCluster): number;
|
|
24
|
+
/** Get the bounding-box width of a glyph in font design units, with caching. */
|
|
13
25
|
export declare function glyphWidthUnits(entry: FontEntry, glyphId: number | undefined | null): number;
|
|
26
|
+
/**
|
|
27
|
+
* Select the best font index from the manager's font list for rendering the
|
|
28
|
+
* given text cluster, searching in fallback order similar to Ghostty.
|
|
29
|
+
*/
|
|
14
30
|
export declare function pickFontIndexForText(state: FontManagerState, text: string, expectedSpan: number, shapeClusterWithFont: (entry: FontEntry, text: string) => ShapedCluster): number;
|
|
31
|
+
/** Fetch a font file from a URL and return its ArrayBuffer, or null on failure. */
|
|
15
32
|
export declare function tryFetchFontBuffer(url: string): Promise<ArrayBuffer | null>;
|
|
33
|
+
/** Query locally installed fonts via the Local Font Access API and return the first match, or null. */
|
|
16
34
|
export declare function tryLocalFontBuffer(matchers: string[]): Promise<ArrayBuffer | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Load the primary font buffer, trying local Nerd Font matchers first,
|
|
37
|
+
* then a remote fallback URL, then broader local font matchers. Throws
|
|
38
|
+
* if all sources fail.
|
|
39
|
+
*/
|
|
17
40
|
export declare function loadPrimaryFontBuffer(localMatchers: string[], fallbackUrl: string, fallbackLocalMatchers: string[]): Promise<ArrayBuffer>;
|
|
41
|
+
/** Load fallback font buffers from a list of sources, trying remote URLs then local matchers. */
|
|
18
42
|
export declare function loadFallbackFontBuffers(sources: FallbackFontSource[]): Promise<{
|
|
19
43
|
name: string;
|
|
20
44
|
buffer: ArrayBuffer;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** Rendering constraints for Nerd Font symbols (sizing, alignment, padding). */
|
|
1
2
|
export type NerdConstraint = {
|
|
2
3
|
size?: "none" | "fit" | "cover" | "fit_cover1" | "stretch";
|
|
3
4
|
align_horizontal?: "none" | "start" | "end" | "center" | "center1";
|
|
@@ -14,10 +15,13 @@ export type NerdConstraint = {
|
|
|
14
15
|
max_xy_ratio?: number;
|
|
15
16
|
max_constraint_width?: number;
|
|
16
17
|
};
|
|
18
|
+
/** Codepoint range with associated rendering constraint. */
|
|
17
19
|
export type NerdConstraintRange = {
|
|
18
20
|
start: number;
|
|
19
21
|
end: number;
|
|
20
22
|
constraint: NerdConstraint;
|
|
21
23
|
};
|
|
24
|
+
/** Nerd Font symbol rendering constraints by codepoint range. */
|
|
22
25
|
export declare const NERD_CONSTRAINTS: NerdConstraintRange[];
|
|
26
|
+
/** Binary search for the rendering constraint matching a Nerd Font codepoint, or null if none. */
|
|
23
27
|
export declare function getNerdConstraint(cp: number): NerdConstraint | null;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/** Unicode codepoint ranges for Nerd Font symbols (start, end inclusive). */
|
|
1
2
|
export declare const NERD_SYMBOL_RANGES: Array<[number, number]>;
|
|
3
|
+
/** Check if a codepoint falls within Nerd Font symbol ranges. */
|
|
2
4
|
export declare function isNerdSymbolCodepoint(cp: number): boolean;
|
package/dist/fonts/types.d.ts
CHANGED
|
@@ -1,40 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A loaded font with its associated caches and rendering metadata.
|
|
3
|
+
*/
|
|
1
4
|
export type FontEntry = {
|
|
5
|
+
/** text-shaper Font instance. */
|
|
2
6
|
font: any;
|
|
7
|
+
/** Human-readable font name. */
|
|
3
8
|
label: string;
|
|
9
|
+
/** Cache of shaped glyph clusters keyed by input string. */
|
|
4
10
|
glyphCache: Map<string, ShapedCluster>;
|
|
11
|
+
/** Cache of glyph advance bounds keyed by glyph ID. */
|
|
5
12
|
boundsCache: Map<number, number>;
|
|
13
|
+
/** Map of glyph IDs to their original text for color emoji fallback. */
|
|
6
14
|
colorGlyphTexts: Map<number, string>;
|
|
15
|
+
/** Set of all glyph IDs available in this font. */
|
|
7
16
|
glyphIds: Set<number>;
|
|
17
|
+
/** GPU texture atlas for this font, or null if not yet built. */
|
|
8
18
|
atlas: any | null;
|
|
19
|
+
/** Font size in CSS pixels. */
|
|
9
20
|
fontSizePx: number;
|
|
21
|
+
/** Scale factor applied when rasterizing to the atlas. */
|
|
10
22
|
atlasScale: number;
|
|
23
|
+
/** Horizontal advance width in font design units. */
|
|
11
24
|
advanceUnits: number;
|
|
25
|
+
/** Signature string used to detect constraint changes for atlas invalidation. */
|
|
12
26
|
constraintSignature?: string;
|
|
13
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Result of shaping a text cluster into positioned glyphs.
|
|
30
|
+
*/
|
|
14
31
|
export type ShapedCluster = {
|
|
32
|
+
/** Ordered list of glyphs produced by the shaper. */
|
|
15
33
|
glyphs: ShapedGlyph[];
|
|
34
|
+
/** Total horizontal advance of the cluster in font units. */
|
|
16
35
|
advance: number;
|
|
17
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* A single positioned glyph within a shaped cluster.
|
|
39
|
+
*/
|
|
18
40
|
export type ShapedGlyph = {
|
|
41
|
+
/** Font-internal glyph identifier. */
|
|
19
42
|
glyphId: number;
|
|
43
|
+
/** Horizontal advance after this glyph in font units. */
|
|
20
44
|
xAdvance: number;
|
|
45
|
+
/** Vertical advance after this glyph in font units. */
|
|
21
46
|
yAdvance: number;
|
|
47
|
+
/** Horizontal offset from the current pen position. */
|
|
22
48
|
xOffset: number;
|
|
49
|
+
/** Vertical offset from the current pen position. */
|
|
23
50
|
yOffset: number;
|
|
24
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Internal state of the font manager.
|
|
54
|
+
*/
|
|
25
55
|
export type FontManagerState = {
|
|
56
|
+
/** Primary text-shaper Font instance, or null before initialization. */
|
|
26
57
|
font: any | null;
|
|
58
|
+
/** Loaded font entries in priority order (primary + fallbacks). */
|
|
27
59
|
fonts: FontEntry[];
|
|
60
|
+
/** Current font size in CSS pixels. */
|
|
28
61
|
fontSizePx: number;
|
|
62
|
+
/**
|
|
63
|
+
* How font size maps to design units.
|
|
64
|
+
* - height: size equals cell height
|
|
65
|
+
* - width: size equals cell width
|
|
66
|
+
* - upem: size equals units-per-em
|
|
67
|
+
*/
|
|
29
68
|
sizeMode: "height" | "width" | "upem";
|
|
69
|
+
/** Cache mapping text strings to the index of the font chosen to render them. */
|
|
30
70
|
fontPickCache: Map<string, number>;
|
|
31
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* Descriptor for a fallback font to load on demand.
|
|
74
|
+
*/
|
|
32
75
|
export type FallbackFontSource = {
|
|
76
|
+
/** Display name of the fallback font. */
|
|
33
77
|
name: string;
|
|
78
|
+
/** URL to fetch the font file from. */
|
|
34
79
|
url: string;
|
|
80
|
+
/** Unicode range or script patterns this font covers. */
|
|
35
81
|
matchers: string[];
|
|
36
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* Per-font scale override applied when a font's label matches the pattern.
|
|
85
|
+
*/
|
|
37
86
|
export type FontScaleOverride = {
|
|
87
|
+
/** Regex tested against the font label. */
|
|
38
88
|
match: RegExp;
|
|
89
|
+
/** Multiplier applied to the font's atlas scale. */
|
|
39
90
|
scale: number;
|
|
40
91
|
};
|
package/dist/grid/grid.d.ts
CHANGED
|
@@ -1,22 +1,44 @@
|
|
|
1
1
|
import type { CellMetrics, GridConfig, GridState } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Font metrics interface used to measure glyph dimensions and compute cell sizes.
|
|
4
|
+
*/
|
|
2
5
|
export type FontMetricsProvider = {
|
|
6
|
+
/** Return the scale factor for a given pixel size and sizing mode. */
|
|
3
7
|
scaleForSize(sizePx: number, sizeMode: string): number;
|
|
8
|
+
/** Look up the glyph ID for a character, or null/undefined if missing. */
|
|
4
9
|
glyphIdForChar(char: string): number | undefined | null;
|
|
10
|
+
/** Return the advance width of a glyph in font units. */
|
|
5
11
|
advanceWidth(glyphId: number): number;
|
|
12
|
+
/** Font ascender in font units. */
|
|
6
13
|
readonly ascender: number;
|
|
14
|
+
/** Font descender in font units (typically negative). */
|
|
7
15
|
readonly descender?: number;
|
|
16
|
+
/** Explicit font height in font units, if available. */
|
|
8
17
|
readonly height?: number;
|
|
18
|
+
/** Units per em of the font. */
|
|
9
19
|
readonly upem: number;
|
|
10
20
|
};
|
|
21
|
+
/** Result of shaping a text cluster, containing its advance width. */
|
|
11
22
|
export type ShapeResult = {
|
|
12
23
|
advance: number;
|
|
13
24
|
};
|
|
25
|
+
/** Resolve the font height in font units, falling back to ascender-descender or upem. */
|
|
14
26
|
export declare function fontHeightUnits(font: FontMetricsProvider): number;
|
|
27
|
+
/**
|
|
28
|
+
* Compute cell width, height, and baseline from font metrics, grid config,
|
|
29
|
+
* and device pixel ratio. Returns null if the font is unavailable.
|
|
30
|
+
*/
|
|
15
31
|
export declare function computeCellMetrics(font: FontMetricsProvider, config: GridConfig, dpr: number, shapeCluster: (text: string) => ShapeResult): CellMetrics | null;
|
|
32
|
+
/** Create a zeroed-out grid state with default values. */
|
|
16
33
|
export declare function createGridState(): GridState;
|
|
34
|
+
/**
|
|
35
|
+
* Recompute grid dimensions from cell metrics and canvas size.
|
|
36
|
+
* Mutates state in place and returns whether cols/rows/metrics changed.
|
|
37
|
+
*/
|
|
17
38
|
export declare function updateGridState(state: GridState, metrics: CellMetrics, canvasWidth: number, canvasHeight: number): {
|
|
18
39
|
changed: boolean;
|
|
19
40
|
cols: number;
|
|
20
41
|
rows: number;
|
|
21
42
|
};
|
|
43
|
+
/** Clamp a number to the inclusive [min, max] range. */
|
|
22
44
|
export declare function clamp(value: number, min: number, max: number): number;
|
package/dist/grid/types.d.ts
CHANGED
|
@@ -1,24 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Current grid dimensions and cell metrics.
|
|
3
|
+
*/
|
|
1
4
|
export type GridState = {
|
|
5
|
+
/** Number of columns in the terminal grid. */
|
|
2
6
|
cols: number;
|
|
7
|
+
/** Number of rows in the terminal grid. */
|
|
3
8
|
rows: number;
|
|
9
|
+
/** Cell width in CSS pixels. */
|
|
4
10
|
cellW: number;
|
|
11
|
+
/** Cell height in CSS pixels. */
|
|
5
12
|
cellH: number;
|
|
13
|
+
/** Resolved font size in CSS pixels. */
|
|
6
14
|
fontSizePx: number;
|
|
15
|
+
/** Device pixel ratio (DPR) scale factor. */
|
|
7
16
|
scale: number;
|
|
17
|
+
/** Line height multiplier applied to font metrics. */
|
|
8
18
|
lineHeight: number;
|
|
19
|
+
/** Vertical offset from cell top to text baseline in CSS pixels. */
|
|
9
20
|
baselineOffset: number;
|
|
21
|
+
/** Vertical padding added to the top of the grid in CSS pixels. */
|
|
10
22
|
yPad: number;
|
|
11
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Computed cell measurement values derived from font metrics and DPR.
|
|
26
|
+
*/
|
|
12
27
|
export type CellMetrics = {
|
|
28
|
+
/** Cell width in CSS pixels. */
|
|
13
29
|
cellW: number;
|
|
30
|
+
/** Cell height in CSS pixels. */
|
|
14
31
|
cellH: number;
|
|
32
|
+
/** Resolved font size in CSS pixels. */
|
|
15
33
|
fontSizePx: number;
|
|
34
|
+
/** Device pixel ratio (DPR) scale factor. */
|
|
16
35
|
scale: number;
|
|
36
|
+
/** Line height multiplier applied to font metrics. */
|
|
17
37
|
lineHeight: number;
|
|
38
|
+
/** Vertical offset from cell top to text baseline in CSS pixels. */
|
|
18
39
|
baselineOffset: number;
|
|
40
|
+
/** Vertical padding added to the top of the grid in CSS pixels. */
|
|
19
41
|
yPad: number;
|
|
20
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Grid configuration for font sizing.
|
|
45
|
+
*/
|
|
21
46
|
export type GridConfig = {
|
|
47
|
+
/** Base font size value interpreted according to sizeMode. */
|
|
22
48
|
fontSize: number;
|
|
49
|
+
/**
|
|
50
|
+
* How fontSize is interpreted.
|
|
51
|
+
* - height: CSS px height of glyphs
|
|
52
|
+
* - width: CSS px width of a single cell
|
|
53
|
+
* - upem: units-per-em (raw font units)
|
|
54
|
+
*/
|
|
23
55
|
sizeMode: "height" | "width" | "upem";
|
|
24
56
|
};
|
package/dist/ime/ime.d.ts
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import type { ImeState, CursorPosition } from "./types";
|
|
2
|
+
/** Create a fresh IME state with no active composition. */
|
|
2
3
|
export declare function createImeState(): ImeState;
|
|
4
|
+
/** Set the preedit string on the IME state and sync it to the hidden input element. */
|
|
3
5
|
export declare function setPreedit(state: ImeState, text: string, imeInput?: HTMLInputElement | null): void;
|
|
6
|
+
/** Clear the preedit string, reset selection offsets, and empty the hidden input. */
|
|
4
7
|
export declare function clearPreedit(state: ImeState, imeInput?: HTMLInputElement | null): void;
|
|
8
|
+
/** Begin an IME composition session, marking the state as composing and setting initial preedit. */
|
|
5
9
|
export declare function startComposition(state: ImeState, data: string, imeInput?: HTMLInputElement | null): void;
|
|
10
|
+
/** Update the preedit text during an active composition without changing composing state. */
|
|
6
11
|
export declare function updateComposition(state: ImeState, data: string, imeInput?: HTMLInputElement | null): void;
|
|
12
|
+
/** End the composition session and return the committed preedit text. */
|
|
7
13
|
export declare function endComposition(state: ImeState): string;
|
|
14
|
+
/** Read the current selection range from the hidden input and sync it into the IME state. */
|
|
8
15
|
export declare function syncImeSelection(state: ImeState, imeInput: HTMLInputElement | null): void;
|
|
16
|
+
/** Reposition the hidden IME input element to align with the terminal cursor. */
|
|
9
17
|
export declare function updateImePosition(imeInput: HTMLInputElement | null, cursor: CursorPosition | null, cellW: number, cellH: number, dpr: number, canvasRect: DOMRect): void;
|
|
18
|
+
/** Default RGBA background color for the preedit overlay. */
|
|
10
19
|
export declare const PREEDIT_BG: readonly [0.16, 0.16, 0.2, 0.9];
|
|
20
|
+
/** Default RGBA background color for the active (selected) preedit segment. */
|
|
11
21
|
export declare const PREEDIT_ACTIVE_BG: readonly [0.3, 0.32, 0.42, 0.95];
|
|
22
|
+
/** Default RGBA foreground color for preedit text. */
|
|
12
23
|
export declare const PREEDIT_FG: readonly [0.95, 0.95, 0.98, 1];
|
|
24
|
+
/** Default RGBA color for the preedit underline. */
|
|
13
25
|
export declare const PREEDIT_UL: readonly [0.7, 0.7, 0.8, 0.9];
|
|
26
|
+
/** Default RGBA color for the preedit caret. */
|
|
14
27
|
export declare const PREEDIT_CARET: readonly [0.95, 0.95, 0.98, 1];
|
package/dist/ime/types.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Current state of an active IME composition session.
|
|
3
|
+
*/
|
|
1
4
|
export type ImeState = {
|
|
5
|
+
/** Whether a composition is currently in progress. */
|
|
2
6
|
composing: boolean;
|
|
7
|
+
/** The uncommitted preedit string shown during composition. */
|
|
3
8
|
preedit: string;
|
|
9
|
+
/** Start offset of the selected range within the preedit string. */
|
|
4
10
|
selectionStart: number;
|
|
11
|
+
/** End offset of the selected range within the preedit string. */
|
|
5
12
|
selectionEnd: number;
|
|
6
13
|
};
|
|
14
|
+
/** Cursor position in terminal row/column coordinates. */
|
|
7
15
|
export type CursorPosition = {
|
|
8
16
|
row: number;
|
|
9
17
|
col: number;
|
package/dist/input/ansi.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/** Parse a DEC private mode set/reset sequence (CSI ? ... h/l) into mode codes and enabled state. */
|
|
1
2
|
export declare function parsePrivateModeSeq(seq: string): {
|
|
2
3
|
codes: number[];
|
|
3
4
|
enabled: boolean;
|
|
4
5
|
} | null;
|
|
6
|
+
/** Parse a window manipulation sequence (CSI ... t) into its numeric parameters. */
|
|
5
7
|
export declare function parseWindowOpSeq(seq: string): number[] | null;
|
|
8
|
+
/** Test whether a CSI sequence is a Device Attributes query (DA1/DA2/DA3). */
|
|
6
9
|
export declare function isDeviceAttributesQuery(seq: string): boolean;
|
package/dist/input/mouse.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import type { CellPosition, MouseMode, MouseStatus } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Construction options for MouseController.
|
|
4
|
+
*/
|
|
2
5
|
export type MouseControllerOptions = {
|
|
6
|
+
/** Sink for mouse report sequences sent back to the PTY. */
|
|
3
7
|
sendReply: (data: string) => void;
|
|
8
|
+
/** Map pointer events to 0-based cell coordinates. */
|
|
4
9
|
positionToCell: (event: MouseEvent | PointerEvent | WheelEvent) => CellPosition;
|
|
10
|
+
/** Map pointer events to 1-based pixel coordinates (for SGR-Pixels mode). */
|
|
5
11
|
positionToPixel?: (event: MouseEvent | PointerEvent | WheelEvent) => {
|
|
6
12
|
x: number;
|
|
7
13
|
y: number;
|
|
8
14
|
};
|
|
9
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Tracks mouse reporting state (mode, format, motion tracking) and encodes
|
|
18
|
+
* pointer events into terminal mouse sequences (X10, UTF-8, URxvt, SGR).
|
|
19
|
+
*/
|
|
10
20
|
export declare class MouseController {
|
|
11
21
|
private mode;
|
|
12
22
|
private enabled;
|
package/dist/input/output.d.ts
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import type { CursorPosition, WindowOp } from "./types";
|
|
2
2
|
import type { MouseController } from "./mouse";
|
|
3
|
+
/**
|
|
4
|
+
* Construction options for OutputFilter.
|
|
5
|
+
*/
|
|
3
6
|
export type OutputFilterOptions = {
|
|
7
|
+
/** Provide the current 1-based cursor position for CPR replies. */
|
|
4
8
|
getCursorPosition: () => CursorPosition;
|
|
9
|
+
/** Sink for reply sequences (CPR, DA, OSC color queries). */
|
|
5
10
|
sendReply: (data: string) => void;
|
|
11
|
+
/** MouseController instance for delegating mouse mode toggling. */
|
|
6
12
|
mouse: MouseController;
|
|
13
|
+
/** Provide default colors for OSC 10/11/12 queries (RGB 0-255). */
|
|
7
14
|
getDefaultColors?: () => {
|
|
8
15
|
fg?: [number, number, number];
|
|
9
16
|
bg?: [number, number, number];
|
|
10
17
|
cursor?: [number, number, number];
|
|
11
18
|
};
|
|
19
|
+
/** Handler for OSC 52 clipboard write requests. */
|
|
12
20
|
onClipboardWrite?: (text: string) => void | Promise<void>;
|
|
21
|
+
/** Handler for OSC 52 clipboard read requests. */
|
|
13
22
|
onClipboardRead?: () => string | null | Promise<string | null>;
|
|
23
|
+
/** Handler for window manipulation sequences (CSI ... t). */
|
|
14
24
|
onWindowOp?: (op: WindowOp) => void;
|
|
25
|
+
/** Provider for XTWINOPS report queries (CSI 14/16/18 t). */
|
|
15
26
|
getWindowMetrics?: () => {
|
|
16
27
|
rows: number;
|
|
17
28
|
cols: number;
|
package/dist/input/types.d.ts
CHANGED
|
@@ -28,11 +28,13 @@ export type InputHandlerConfig = {
|
|
|
28
28
|
*/
|
|
29
29
|
enableCtrlCombos?: boolean;
|
|
30
30
|
};
|
|
31
|
+
/** Default terminal colors for OSC 10/11/12 query responses (RGB 0-255). */
|
|
31
32
|
export type DefaultColors = {
|
|
32
33
|
fg?: [number, number, number];
|
|
33
34
|
bg?: [number, number, number];
|
|
34
35
|
cursor?: [number, number, number];
|
|
35
36
|
};
|
|
37
|
+
/** Terminal window metrics for XTWINOPS reporting (CSI 14/16/18 t). */
|
|
36
38
|
export type WindowMetrics = {
|
|
37
39
|
rows: number;
|
|
38
40
|
cols: number;
|
|
@@ -41,6 +43,11 @@ export type WindowMetrics = {
|
|
|
41
43
|
cellWidthPx: number;
|
|
42
44
|
cellHeightPx: number;
|
|
43
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Parsed window manipulation operation (CSI ... t).
|
|
48
|
+
* - resize: terminal resize request
|
|
49
|
+
* - unknown: unhandled window operation
|
|
50
|
+
*/
|
|
44
51
|
export type WindowOp = {
|
|
45
52
|
type: "resize";
|
|
46
53
|
rows: number;
|