restty 0.1.23 → 0.1.25
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-mkkhfg0z.js → chunk-pab3ge3d.js} +11446 -7806
- package/dist/fonts/index.d.ts +4 -1
- package/dist/fonts/manager/classification.d.ts +13 -0
- package/dist/fonts/manager/entries.d.ts +13 -0
- package/dist/fonts/manager/picker.d.ts +6 -0
- package/dist/fonts/manager/sources.d.ts +16 -0
- package/dist/fonts/types.d.ts +20 -10
- package/dist/grid/grid.d.ts +5 -3
- package/dist/ime/ime.d.ts +13 -0
- package/dist/index.d.ts +3 -3
- package/dist/input/index.d.ts +1 -1
- package/dist/input/keymap/before-input.d.ts +4 -0
- package/dist/input/keymap/constants.d.ts +13 -0
- package/dist/input/keymap/control.d.ts +2 -0
- package/dist/input/keymap/default-mapping.d.ts +1 -0
- package/dist/input/keymap/kitty.d.ts +1 -0
- package/dist/input/keymap/normalization.d.ts +4 -0
- package/dist/input/keymap/pty-map.d.ts +4 -0
- package/dist/input/keymap.d.ts +2 -11
- package/dist/input/output/csi.d.ts +33 -0
- package/dist/input/{output.d.ts → output/index.d.ts} +6 -9
- package/dist/input/output/osc.d.ts +15 -0
- package/dist/input/output/prompt.d.ts +11 -0
- package/dist/input/types.d.ts +13 -0
- package/dist/internal.d.ts +4 -4
- package/dist/internal.js +13 -150
- package/dist/renderer/index.d.ts +7 -2
- package/dist/renderer/shaders/glyph-gl.d.ts +4 -0
- package/dist/renderer/{shaders.d.ts → shaders/glyph-wgsl.d.ts} +0 -10
- package/dist/renderer/shaders/rect.d.ts +6 -0
- package/dist/renderer/shapes/block-elements.d.ts +3 -0
- package/dist/renderer/shapes/box-drawing/dashed-lines.d.ts +3 -0
- package/dist/renderer/shapes/box-drawing/diagonal.d.ts +2 -0
- package/dist/renderer/shapes/box-drawing/draw-box-drawing.d.ts +6 -0
- package/dist/renderer/shapes/box-drawing/fallback.d.ts +2 -0
- package/dist/renderer/shapes/box-drawing/mapped.d.ts +2 -0
- package/dist/renderer/shapes/box-drawing/rounded-corner.d.ts +2 -0
- package/dist/renderer/shapes/braille.d.ts +3 -0
- package/dist/renderer/shapes/classify.d.ts +18 -0
- package/dist/renderer/shapes/geometry.d.ts +9 -0
- package/dist/renderer/shapes/glyph-box.d.ts +7 -0
- package/dist/renderer/shapes/powerline.d.ts +3 -0
- package/dist/renderer/shapes/types.d.ts +38 -0
- package/dist/renderer/shapes.d.ts +8 -81
- package/dist/renderer/webgpu/buffers.d.ts +7 -0
- package/dist/renderer/webgpu/setup.d.ts +10 -0
- package/dist/renderer/webgpu/state.d.ts +15 -0
- package/dist/renderer/webgpu/webgl.d.ts +3 -0
- package/dist/restty.js +1 -1
- package/dist/{app → runtime}/atlas-builder.d.ts +53 -18
- package/dist/runtime/codepoint-utils.d.ts +12 -0
- package/dist/runtime/create-app-io-utils.d.ts +9 -0
- package/dist/runtime/create-app-symbols.d.ts +11 -0
- package/dist/runtime/create-app-types.d.ts +72 -0
- package/dist/runtime/create-runtime/atlas-debug-utils.d.ts +5 -0
- package/dist/runtime/create-runtime/blend-utils.d.ts +11 -0
- package/dist/runtime/create-runtime/color-glyph-atlas.d.ts +11 -0
- package/dist/runtime/create-runtime/debug-tools/create-dump-glyph-render.d.ts +2 -0
- package/dist/runtime/create-runtime/debug-tools/diagnose-codepoint.d.ts +2 -0
- package/dist/runtime/create-runtime/debug-tools/dump-atlas-for-codepoint.d.ts +2 -0
- package/dist/runtime/create-runtime/debug-tools/read-texture-to-image-data.d.ts +1 -0
- package/dist/runtime/create-runtime/debug-tools/setup-debug-expose.d.ts +2 -0
- package/dist/runtime/create-runtime/debug-tools/types.d.ts +63 -0
- package/dist/runtime/create-runtime/debug-tools.d.ts +6 -0
- package/dist/runtime/create-runtime/font-runtime-grid-helpers.d.ts +39 -0
- package/dist/runtime/create-runtime/font-runtime-helpers.d.ts +20 -0
- package/dist/runtime/create-runtime/font-runtime-helpers.types.d.ts +108 -0
- package/dist/runtime/create-runtime/font-runtime-text-helpers.d.ts +21 -0
- package/dist/runtime/create-runtime/font-runtime-webgpu-atlas.d.ts +26 -0
- package/dist/runtime/create-runtime/format-utils.d.ts +2 -0
- package/dist/runtime/create-runtime/input-hooks.d.ts +12 -0
- package/dist/runtime/create-runtime/interaction-runtime/bind-ime-events.d.ts +12 -0
- package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-aux-handlers.d.ts +28 -0
- package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-events.d.ts +41 -0
- package/dist/runtime/create-runtime/interaction-runtime/bind-pointer-up-handler.d.ts +28 -0
- package/dist/runtime/create-runtime/interaction-runtime/kitty-image-cache.d.ts +18 -0
- package/dist/runtime/create-runtime/interaction-runtime/kitty-overlay-runtime.d.ts +15 -0
- package/dist/runtime/create-runtime/interaction-runtime/scrollbar-runtime.d.ts +30 -0
- package/dist/runtime/create-runtime/interaction-runtime/types.d.ts +110 -0
- package/dist/runtime/create-runtime/interaction-runtime.d.ts +3 -0
- package/dist/runtime/create-runtime/kitty-overlay-utils.d.ts +26 -0
- package/dist/runtime/create-runtime/lifecycle-theme-size-canvas.d.ts +13 -0
- package/dist/runtime/create-runtime/lifecycle-theme-size-theme.d.ts +6 -0
- package/dist/runtime/create-runtime/lifecycle-theme-size.d.ts +16 -0
- package/dist/runtime/create-runtime/lifecycle-theme-size.types.d.ts +85 -0
- package/dist/runtime/create-runtime/pty-input-runtime.d.ts +45 -0
- package/dist/runtime/create-runtime/render-tick-webgl-context.d.ts +4 -0
- package/dist/runtime/create-runtime/render-tick-webgl-glyph-pipeline.d.ts +2 -0
- package/dist/runtime/create-runtime/render-tick-webgl-overlays.d.ts +2 -0
- package/dist/runtime/create-runtime/render-tick-webgl-scene.d.ts +2 -0
- package/dist/runtime/create-runtime/render-tick-webgl.d.ts +3 -0
- package/dist/runtime/create-runtime/render-tick-webgl.types.d.ts +162 -0
- package/dist/runtime/create-runtime/render-tick-webgpu-cell-pass.d.ts +25 -0
- package/dist/runtime/create-runtime/render-tick-webgpu-draw-pass.d.ts +2 -0
- package/dist/runtime/create-runtime/render-tick-webgpu-emit-glyphs.d.ts +2 -0
- package/dist/runtime/create-runtime/render-tick-webgpu-overlays-atlas.d.ts +2 -0
- package/dist/runtime/create-runtime/render-tick-webgpu.d.ts +3 -0
- package/dist/runtime/create-runtime/render-tick-webgpu.types.d.ts +386 -0
- package/dist/runtime/create-runtime/render-ticks.d.ts +9 -0
- package/dist/runtime/create-runtime/runtime-app-api.d.ts +103 -0
- package/dist/runtime/create-runtime/runtime-logger.d.ts +17 -0
- package/dist/runtime/create-runtime/runtime-reporting.d.ts +40 -0
- package/dist/runtime/create-runtime/shader-stage-runtime.d.ts +29 -0
- package/dist/runtime/create-runtime.d.ts +7 -0
- package/dist/runtime/font-atlas-utils/bitmap-utils.d.ts +5 -0
- package/dist/runtime/font-atlas-utils/glyph-atlas-builder.d.ts +29 -0
- package/dist/runtime/font-atlas-utils/nerd-metrics-utils.d.ts +25 -0
- package/dist/runtime/font-atlas-utils/packing-utils.d.ts +13 -0
- package/dist/runtime/overlay-scrollbar.d.ts +24 -0
- package/dist/runtime/pty-output-buffer.d.ts +12 -0
- package/dist/runtime/render-color-utils.d.ts +6 -0
- package/dist/runtime/render-stage-runtime.d.ts +18 -0
- package/dist/runtime/render-stage-shaders.d.ts +6 -0
- package/dist/runtime/shader-stages.d.ts +9 -0
- package/dist/runtime/text-decoration.d.ts +4 -0
- package/dist/{app → runtime}/types.d.ts +39 -1
- package/dist/selection/clipboard.d.ts +4 -0
- package/dist/selection/{selection.d.ts → core.d.ts} +0 -11
- package/dist/selection/index.d.ts +3 -1
- package/dist/selection/text.d.ts +8 -0
- package/dist/surface/app-factory.d.ts +3 -0
- package/dist/{app → surface}/pane-app-manager.d.ts +2 -2
- package/dist/surface/panes/default-context-menu-items.d.ts +8 -0
- package/dist/surface/panes/layout.d.ts +9 -0
- package/dist/surface/panes/manager.d.ts +2 -0
- package/dist/surface/panes/pane-interactions.d.ts +11 -0
- package/dist/surface/panes/window-events.d.ts +10 -0
- package/dist/{app → surface}/panes-types.d.ts +1 -1
- package/dist/surface/restty/active-pane-api.d.ts +23 -0
- package/dist/surface/restty/manager-options.d.ts +24 -0
- package/dist/surface/restty/pane-ops.d.ts +42 -0
- package/dist/surface/restty/plugin-dispatcher.d.ts +39 -0
- package/dist/surface/restty/plugin-ops.d.ts +24 -0
- package/dist/surface/restty/shader-ops.d.ts +27 -0
- package/dist/surface/restty-pane-handle.d.ts +70 -0
- package/dist/surface/restty-plugin-runtime.d.ts +57 -0
- package/dist/surface/restty-plugin-types.d.ts +164 -0
- package/dist/surface/restty-plugin-utils.d.ts +22 -0
- package/dist/surface/restty.d.ts +93 -0
- package/dist/utils/base64.d.ts +12 -0
- package/dist/wasm/index.d.ts +2 -1
- package/dist/wasm/runtime/abi.d.ts +7 -0
- package/dist/wasm/runtime/kitty.d.ts +2 -0
- package/dist/wasm/runtime/render-state.d.ts +2 -0
- package/dist/wasm/runtime/restty-wasm.d.ts +42 -0
- package/dist/wasm/{runtime.d.ts → runtime/types.d.ts} +48 -41
- package/dist/wasm/runtime/view-cache.d.ts +4 -0
- package/dist/xterm/app-options.d.ts +2 -0
- package/dist/xterm/dimensions.d.ts +1 -0
- package/dist/xterm/listeners.d.ts +5 -0
- package/dist/xterm.d.ts +1 -6
- package/dist/xterm.js +61 -63
- package/package.json +1 -1
- package/dist/app/index.d.ts +0 -9
- package/dist/app/panes.d.ts +0 -15
- package/dist/app/restty.d.ts +0 -336
- package/dist/fonts/manager.d.ts +0 -45
- package/dist/renderer/webgpu.d.ts +0 -33
- package/dist/restty-input.d.ts +0 -1
- /package/dist/{app → runtime}/clipboard-paste.d.ts +0 -0
- /package/dist/{app → runtime}/font-sources.d.ts +0 -0
- /package/dist/{app → runtime}/session.d.ts +0 -0
- /package/dist/{app → surface}/panes-context-menu.d.ts +0 -0
- /package/dist/{app → surface}/panes-styles.d.ts +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { fontAdvanceUnits as fontAdvanceUnitsFn, fontMaxCellSpan as fontMaxCellSpanFn, fontScaleOverride as fontScaleOverrideFn, FontEntry, FontManagerState, NerdConstraint, isColorEmojiFont as isColorEmojiFontFn, isNerdSymbolCodepoint as isNerdSymbolCodepointFn, isSymbolFont as isSymbolFontFn } from "../../../fonts";
|
|
2
|
+
import type { clamp as clampFn, fontHeightUnits as fontHeightUnitsFn } from "../../../grid";
|
|
3
|
+
import type { WebGLState, WebGPUState } from "../../../renderer";
|
|
4
|
+
import type { GlyphConstraintMeta, AtlasConstraintContext } from "../../atlas-builder";
|
|
5
|
+
import type { NerdMetrics } from "../render-tick-webgpu.types";
|
|
6
|
+
export type GridState = {
|
|
7
|
+
cols: number;
|
|
8
|
+
rows: number;
|
|
9
|
+
cellW: number;
|
|
10
|
+
cellH: number;
|
|
11
|
+
fontSizePx: number;
|
|
12
|
+
yPad: number;
|
|
13
|
+
};
|
|
14
|
+
export type FontConfig = {
|
|
15
|
+
sizePx: number;
|
|
16
|
+
};
|
|
17
|
+
export type ShapeClusterResult = {
|
|
18
|
+
glyphs: Array<{
|
|
19
|
+
glyphId: number;
|
|
20
|
+
xAdvance: number;
|
|
21
|
+
xOffset: number;
|
|
22
|
+
yOffset: number;
|
|
23
|
+
}>;
|
|
24
|
+
advance: number;
|
|
25
|
+
};
|
|
26
|
+
export type BuildNerdMetricsFn = (cellW: number, cellH: number, lineHeight: number, font: FontEntry["font"] | null | undefined, primaryScale: number, nerdIconScale: number) => NerdMetrics;
|
|
27
|
+
export type EnsureAtlasForFontFn = (device: GPUDevice, state: WebGPUState, entry: FontEntry, neededGlyphIds: Set<number>, fontSizePx: number, fontIndex: number, atlasScale: number, glyphMeta?: Map<number, GlyphConstraintMeta>, constraintContext?: AtlasConstraintContext | null) => boolean;
|
|
28
|
+
export type CreateRuntimeDebugToolsOptions = {
|
|
29
|
+
debugExpose: boolean;
|
|
30
|
+
getWindow: () => (Window & typeof globalThis) | undefined;
|
|
31
|
+
getActiveState: () => WebGPUState | WebGLState | null;
|
|
32
|
+
getCanvas: () => HTMLCanvasElement;
|
|
33
|
+
atlasCanvas: HTMLCanvasElement | null;
|
|
34
|
+
atlasInfoEl: HTMLElement | null;
|
|
35
|
+
fontState: FontManagerState;
|
|
36
|
+
gridState: GridState;
|
|
37
|
+
fontConfig: FontConfig;
|
|
38
|
+
pickFontIndexForText: (text: string, expectedSpan?: number) => number;
|
|
39
|
+
ensureAtlasForFont: EnsureAtlasForFontFn;
|
|
40
|
+
formatCodepoint: (cp: number) => string;
|
|
41
|
+
isSymbolFont: typeof isSymbolFontFn;
|
|
42
|
+
isNerdSymbolCodepoint: typeof isNerdSymbolCodepointFn;
|
|
43
|
+
isSymbolCp: (cp: number) => boolean;
|
|
44
|
+
fontHasGlyph: (font: FontEntry["font"], ch: string) => boolean;
|
|
45
|
+
shapeClusterWithFont: (entry: FontEntry, text: string) => ShapeClusterResult;
|
|
46
|
+
getNerdConstraint: (cp: number) => NerdConstraint | null;
|
|
47
|
+
fontHeightUnits: typeof fontHeightUnitsFn;
|
|
48
|
+
fontScaleOverride: typeof fontScaleOverrideFn;
|
|
49
|
+
fontScaleOverrides: Array<{
|
|
50
|
+
match: RegExp;
|
|
51
|
+
scale: number;
|
|
52
|
+
}>;
|
|
53
|
+
fontAdvanceUnits: typeof fontAdvanceUnitsFn;
|
|
54
|
+
fontMaxCellSpan: typeof fontMaxCellSpanFn;
|
|
55
|
+
clamp: typeof clampFn;
|
|
56
|
+
buildNerdMetrics: BuildNerdMetricsFn;
|
|
57
|
+
nerdIconScale: number;
|
|
58
|
+
isColorEmojiFont: typeof isColorEmojiFontFn;
|
|
59
|
+
atlasPadding: number;
|
|
60
|
+
symbolAtlasPadding: number;
|
|
61
|
+
pixelModeGray: number;
|
|
62
|
+
pixelModeRgba: number;
|
|
63
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CreateRuntimeDebugToolsOptions } from "./debug-tools/types";
|
|
2
|
+
export type { CreateRuntimeDebugToolsOptions } from "./debug-tools/types";
|
|
3
|
+
export declare function createRuntimeDebugTools(options: CreateRuntimeDebugToolsOptions): {
|
|
4
|
+
dumpAtlasForCodepoint: (cp: number) => void;
|
|
5
|
+
setupDebugExpose: () => void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type FontEntry, type FontManagerState } from "../../fonts";
|
|
2
|
+
import type { WebGLState, WebGPUState } from "../../renderer";
|
|
3
|
+
import type { PtyTransport } from "../../pty";
|
|
4
|
+
import type { ResttyWasm } from "../../wasm";
|
|
5
|
+
import type { ResttyAppCallbacks } from "../types";
|
|
6
|
+
import type { CellMetrics, FontConfigRef, GridStateRef, ResizeStateRef } from "./font-runtime-helpers.types";
|
|
7
|
+
type CreateFontRuntimeGridHelpersOptions = {
|
|
8
|
+
fontState: FontManagerState;
|
|
9
|
+
fontConfig: FontConfigRef;
|
|
10
|
+
gridState: GridStateRef;
|
|
11
|
+
callbacks?: ResttyAppCallbacks;
|
|
12
|
+
gridEl: HTMLElement | null;
|
|
13
|
+
cellEl: HTMLElement | null;
|
|
14
|
+
getCanvas: () => HTMLCanvasElement;
|
|
15
|
+
getCurrentDpr: () => number;
|
|
16
|
+
getActiveState: () => WebGPUState | WebGLState | null;
|
|
17
|
+
getWasmReady: () => boolean;
|
|
18
|
+
getWasm: () => ResttyWasm | null;
|
|
19
|
+
getWasmHandle: () => number;
|
|
20
|
+
ptyTransport: PtyTransport;
|
|
21
|
+
setNeedsRender: () => void;
|
|
22
|
+
resizeState: ResizeStateRef;
|
|
23
|
+
resizeActiveMs: number;
|
|
24
|
+
resizeCommitDebounceMs: number;
|
|
25
|
+
onSyncKittyOverlaySize: () => void;
|
|
26
|
+
shapeClusterWithFont: (entry: FontEntry, text: string) => {
|
|
27
|
+
advance: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function createFontRuntimeGridHelpers(options: CreateFontRuntimeGridHelpersOptions): {
|
|
31
|
+
computeCellMetrics: () => CellMetrics | null;
|
|
32
|
+
updateGrid: () => void;
|
|
33
|
+
flushPendingTerminalResize: () => void;
|
|
34
|
+
scheduleTerminalResizeCommit: (cols: number, rows: number, options?: {
|
|
35
|
+
immediate?: boolean;
|
|
36
|
+
}) => void;
|
|
37
|
+
resetTerminalResizeScheduler: () => void;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CreateRuntimeFontRuntimeHelpersOptions } from "./font-runtime-helpers.types";
|
|
2
|
+
export type { CreateRuntimeFontRuntimeHelpersOptions } from "./font-runtime-helpers.types";
|
|
3
|
+
export declare function createRuntimeFontRuntimeHelpers(options: CreateRuntimeFontRuntimeHelpersOptions): {
|
|
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
|
+
computeCellMetrics: () => import("./font-runtime-helpers.types").CellMetrics | null;
|
|
6
|
+
updateGrid: () => void;
|
|
7
|
+
flushPendingTerminalResize: () => void;
|
|
8
|
+
scheduleTerminalResizeCommit: (cols: number, rows: number, options?: {
|
|
9
|
+
immediate?: boolean;
|
|
10
|
+
}) => void;
|
|
11
|
+
resetTerminalResizeScheduler: () => void;
|
|
12
|
+
shapeClusterWithFont: (entry: import("../../fonts").FontEntry, text: string) => import("../../fonts").ShapedCluster;
|
|
13
|
+
noteColorGlyphText: (entry: import("../../fonts").FontEntry, text: string, shaped: {
|
|
14
|
+
glyphs: Array<{
|
|
15
|
+
glyphId: number;
|
|
16
|
+
}>;
|
|
17
|
+
}) => void;
|
|
18
|
+
fontHasGlyph: (font: import("../../fonts").Font, ch: string) => boolean;
|
|
19
|
+
pickFontIndexForText: (text: string, expectedSpan?: number, stylePreference?: string) => number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Font, FontAtlas, FontEntry, FontManagerState, FontSizeMode, ShapedGlyph } from "../../fonts";
|
|
2
|
+
import type { WebGLState, WebGPUState } from "../../renderer";
|
|
3
|
+
import type { PtyTransport } from "../../pty";
|
|
4
|
+
import type { ResttyWasm } from "../../wasm";
|
|
5
|
+
import type { ResttyAppCallbacks } from "../types";
|
|
6
|
+
import type { AtlasOptions, GlyphBuffer, GlyphRasterizeOptions, Matrix2D, Matrix3x3, RasterizedGlyph, UnicodeBuffer } from "text-shaper";
|
|
7
|
+
export type GridStateRef = {
|
|
8
|
+
cols: number;
|
|
9
|
+
rows: number;
|
|
10
|
+
cellW: number;
|
|
11
|
+
cellH: number;
|
|
12
|
+
fontSizePx: number;
|
|
13
|
+
scale: number;
|
|
14
|
+
lineHeight: number;
|
|
15
|
+
baselineOffset: number;
|
|
16
|
+
yPad: number;
|
|
17
|
+
};
|
|
18
|
+
export type FontConfigRef = {
|
|
19
|
+
sizePx: number;
|
|
20
|
+
};
|
|
21
|
+
export type ResizeStateRef = {
|
|
22
|
+
lastAt: number;
|
|
23
|
+
};
|
|
24
|
+
export type ShapeClusterResult = {
|
|
25
|
+
glyphs: ShapedGlyph[];
|
|
26
|
+
advance: number;
|
|
27
|
+
};
|
|
28
|
+
export type AtlasBuilderOptions = Omit<AtlasOptions, "sizeMode"> & {
|
|
29
|
+
sizeMode?: FontSizeMode;
|
|
30
|
+
};
|
|
31
|
+
export type BuildColorEmojiAtlasWithCanvasOptions = {
|
|
32
|
+
font: Font;
|
|
33
|
+
fontEntry: FontEntry;
|
|
34
|
+
glyphIds: number[];
|
|
35
|
+
fontSize: number;
|
|
36
|
+
sizeMode: FontSizeMode;
|
|
37
|
+
padding: number;
|
|
38
|
+
maxWidth: number;
|
|
39
|
+
maxHeight: number;
|
|
40
|
+
pixelMode: number;
|
|
41
|
+
};
|
|
42
|
+
export type BuildColorEmojiAtlasWithCanvas = (options: BuildColorEmojiAtlasWithCanvasOptions) => {
|
|
43
|
+
atlas: FontAtlas;
|
|
44
|
+
constrainedGlyphWidths?: Map<number, number> | null;
|
|
45
|
+
} | null;
|
|
46
|
+
export type AtlasBitmapToRGBA = (atlas: FontAtlas) => Uint8Array | null;
|
|
47
|
+
export type PadAtlasRGBAFn = (rgba: Uint8Array, atlas: FontAtlas, padding: number) => Uint8Array;
|
|
48
|
+
export type BuildAtlasFn = (font: Font, glyphIds: number[], options: AtlasBuilderOptions) => FontAtlas;
|
|
49
|
+
export type ResolveGlyphPixelMode = (entry: FontEntry) => number;
|
|
50
|
+
export type ShapeFn = (font: Font, buffer: UnicodeBuffer) => GlyphBuffer;
|
|
51
|
+
export type GlyphBufferToShapedGlyphsFn = (glyphBuffer: GlyphBuffer) => ShapedGlyph[];
|
|
52
|
+
export type UnicodeBufferCtor = new () => UnicodeBuffer;
|
|
53
|
+
export type RasterizeGlyphFn = (font: Font, glyphId: number, fontSize: number, options?: GlyphRasterizeOptions) => RasterizedGlyph | null;
|
|
54
|
+
export type RasterizeGlyphTransformOptions = GlyphRasterizeOptions & {
|
|
55
|
+
offsetX26?: number;
|
|
56
|
+
offsetY26?: number;
|
|
57
|
+
};
|
|
58
|
+
export type GlyphTransformMatrix = Matrix2D | Matrix3x3;
|
|
59
|
+
export type RasterizeGlyphWithTransformFn = (font: Font, glyphId: number, fontSize: number, matrix: GlyphTransformMatrix, options?: RasterizeGlyphTransformOptions) => RasterizedGlyph | null;
|
|
60
|
+
export type CreateRuntimeFontRuntimeHelpersOptions = {
|
|
61
|
+
fontState: FontManagerState;
|
|
62
|
+
fontConfig: FontConfigRef;
|
|
63
|
+
gridState: GridStateRef;
|
|
64
|
+
callbacks?: ResttyAppCallbacks;
|
|
65
|
+
gridEl: HTMLElement | null;
|
|
66
|
+
cellEl: HTMLElement | null;
|
|
67
|
+
getCanvas: () => HTMLCanvasElement;
|
|
68
|
+
getCurrentDpr: () => number;
|
|
69
|
+
getActiveState: () => WebGPUState | WebGLState | null;
|
|
70
|
+
getWasmReady: () => boolean;
|
|
71
|
+
getWasm: () => ResttyWasm | null;
|
|
72
|
+
getWasmHandle: () => number;
|
|
73
|
+
ptyTransport: PtyTransport;
|
|
74
|
+
setNeedsRender: () => void;
|
|
75
|
+
resizeState: ResizeStateRef;
|
|
76
|
+
resizeActiveMs: number;
|
|
77
|
+
resizeCommitDebounceMs: number;
|
|
78
|
+
onSyncKittyOverlaySize: () => void;
|
|
79
|
+
fontScaleOverrides: Array<{
|
|
80
|
+
match: RegExp;
|
|
81
|
+
scale: number;
|
|
82
|
+
}>;
|
|
83
|
+
resolveGlyphPixelMode: ResolveGlyphPixelMode;
|
|
84
|
+
atlasBitmapToRGBA: AtlasBitmapToRGBA;
|
|
85
|
+
padAtlasRGBA: PadAtlasRGBAFn;
|
|
86
|
+
buildAtlas: BuildAtlasFn;
|
|
87
|
+
buildColorEmojiAtlasWithCanvas: BuildColorEmojiAtlasWithCanvas;
|
|
88
|
+
rasterizeGlyph: RasterizeGlyphFn;
|
|
89
|
+
rasterizeGlyphWithTransform: RasterizeGlyphWithTransformFn;
|
|
90
|
+
pixelModeRgbaValue: number;
|
|
91
|
+
atlasPadding: number;
|
|
92
|
+
symbolAtlasPadding: number;
|
|
93
|
+
symbolAtlasMaxSize: number;
|
|
94
|
+
glyphShapeCacheLimit: number;
|
|
95
|
+
fontPickCacheLimit: number;
|
|
96
|
+
UnicodeBuffer: UnicodeBufferCtor;
|
|
97
|
+
shape: ShapeFn;
|
|
98
|
+
glyphBufferToShapedGlyphs: GlyphBufferToShapedGlyphsFn;
|
|
99
|
+
};
|
|
100
|
+
export type CellMetrics = {
|
|
101
|
+
cellW: number;
|
|
102
|
+
cellH: number;
|
|
103
|
+
fontSizePx: number;
|
|
104
|
+
scale: number;
|
|
105
|
+
lineHeight: number;
|
|
106
|
+
baselineOffset: number;
|
|
107
|
+
yPad: number;
|
|
108
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Font, type FontEntry, type FontManagerState } from "../../fonts";
|
|
2
|
+
import type { GlyphBufferToShapedGlyphsFn, ShapeFn, UnicodeBufferCtor } from "./font-runtime-helpers.types";
|
|
3
|
+
type CreateFontRuntimeTextHelpersOptions = {
|
|
4
|
+
fontState: FontManagerState;
|
|
5
|
+
glyphShapeCacheLimit: number;
|
|
6
|
+
fontPickCacheLimit: number;
|
|
7
|
+
UnicodeBuffer: UnicodeBufferCtor;
|
|
8
|
+
shape: ShapeFn;
|
|
9
|
+
glyphBufferToShapedGlyphs: GlyphBufferToShapedGlyphsFn;
|
|
10
|
+
};
|
|
11
|
+
export declare function createFontRuntimeTextHelpers(options: CreateFontRuntimeTextHelpersOptions): {
|
|
12
|
+
shapeClusterWithFont: (entry: FontEntry, text: string) => import("../../fonts").ShapedCluster;
|
|
13
|
+
noteColorGlyphText: (entry: FontEntry, text: string, shaped: {
|
|
14
|
+
glyphs: Array<{
|
|
15
|
+
glyphId: number;
|
|
16
|
+
}>;
|
|
17
|
+
}) => void;
|
|
18
|
+
fontHasGlyph: (font: Font, ch: string) => boolean;
|
|
19
|
+
pickFontIndexForText: (text: string, expectedSpan?: number, stylePreference?: string) => number;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type FontEntry, type FontManagerState } from "../../fonts";
|
|
2
|
+
import type { WebGPUState } from "../../renderer";
|
|
3
|
+
import { type AtlasConstraintContext, type GlyphConstraintMeta } from "../atlas-builder";
|
|
4
|
+
import type { AtlasBitmapToRGBA, BuildAtlasFn, BuildColorEmojiAtlasWithCanvas, PadAtlasRGBAFn, RasterizeGlyphFn, RasterizeGlyphWithTransformFn, ResolveGlyphPixelMode } from "./font-runtime-helpers.types";
|
|
5
|
+
type CreateRuntimeWebGPUAtlasHelpersOptions = {
|
|
6
|
+
fontState: FontManagerState;
|
|
7
|
+
fontScaleOverrides: Array<{
|
|
8
|
+
match: RegExp;
|
|
9
|
+
scale: number;
|
|
10
|
+
}>;
|
|
11
|
+
resolveGlyphPixelMode: ResolveGlyphPixelMode;
|
|
12
|
+
atlasBitmapToRGBA: AtlasBitmapToRGBA;
|
|
13
|
+
padAtlasRGBA: PadAtlasRGBAFn;
|
|
14
|
+
buildAtlas: BuildAtlasFn;
|
|
15
|
+
buildColorEmojiAtlasWithCanvas: BuildColorEmojiAtlasWithCanvas;
|
|
16
|
+
rasterizeGlyph: RasterizeGlyphFn;
|
|
17
|
+
rasterizeGlyphWithTransform: RasterizeGlyphWithTransformFn;
|
|
18
|
+
pixelModeRgbaValue: number;
|
|
19
|
+
atlasPadding: number;
|
|
20
|
+
symbolAtlasPadding: number;
|
|
21
|
+
symbolAtlasMaxSize: number;
|
|
22
|
+
};
|
|
23
|
+
export declare function createRuntimeWebGPUAtlasHelpers(options: CreateRuntimeWebGPUAtlasHelpersOptions): {
|
|
24
|
+
ensureAtlasForFont: (device: GPUDevice, state: WebGPUState, entry: FontEntry, neededGlyphIds: Set<number>, fontSizePx: number, fontIndex: number, atlasScale: number, glyphMeta?: Map<number, GlyphConstraintMeta>, constraintContext?: AtlasConstraintContext | null) => boolean;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResttyAppInputPayload } from "../types";
|
|
2
|
+
type RuntimeInputHook = ((payload: ResttyAppInputPayload) => string | null | void) | null | undefined;
|
|
3
|
+
export type CreateRuntimeInputHooksOptions = {
|
|
4
|
+
beforeInputHook?: RuntimeInputHook;
|
|
5
|
+
beforeRenderOutputHook?: RuntimeInputHook;
|
|
6
|
+
};
|
|
7
|
+
export type RuntimeInputHooks = {
|
|
8
|
+
runBeforeInputHook: (text: string, source: string) => string | null;
|
|
9
|
+
runBeforeRenderOutputHook: (text: string, source: string) => string | null;
|
|
10
|
+
};
|
|
11
|
+
export declare function createRuntimeInputHooks(options: CreateRuntimeInputHooksOptions): RuntimeInputHooks;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BindCanvasEventsOptions, RuntimeImeState } from "./types";
|
|
2
|
+
export type BindImeEventsOptions = {
|
|
3
|
+
bindOptions: BindCanvasEventsOptions;
|
|
4
|
+
imeInput: HTMLTextAreaElement;
|
|
5
|
+
imeState: RuntimeImeState;
|
|
6
|
+
cleanupCanvasFns: Array<() => void>;
|
|
7
|
+
getWasmReady: () => boolean;
|
|
8
|
+
getWasmHandle: () => number;
|
|
9
|
+
setPreedit: (text: string, updateInput?: boolean) => void;
|
|
10
|
+
syncImeSelection: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function bindImeEvents(options: BindImeEventsOptions): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { InputHandler } from "../../../input";
|
|
2
|
+
import type { RuntimeCell, RuntimeDesktopSelectionState, RuntimeGridState, RuntimeScrollbarDragState, RuntimeSelectionState, RuntimeTouchSelectionState } from "./types";
|
|
3
|
+
type CreatePointerAuxHandlersOptions = {
|
|
4
|
+
inputHandler: InputHandler;
|
|
5
|
+
shouldRoutePointerToAppMouse: (shiftKey: boolean) => boolean;
|
|
6
|
+
scrollViewportByLines: (lines: number) => void;
|
|
7
|
+
getWasmReady: () => boolean;
|
|
8
|
+
getWasmHandle: () => number;
|
|
9
|
+
getGridState: () => RuntimeGridState;
|
|
10
|
+
updateLinkHover: (cell: RuntimeCell | null) => void;
|
|
11
|
+
clearPendingDesktopSelection: () => void;
|
|
12
|
+
clearPendingTouchSelection: () => void;
|
|
13
|
+
isTouchPointer: (event: PointerEvent) => boolean;
|
|
14
|
+
selectionState: RuntimeSelectionState;
|
|
15
|
+
touchSelectionState: RuntimeTouchSelectionState;
|
|
16
|
+
desktopSelectionState: RuntimeDesktopSelectionState;
|
|
17
|
+
scrollbarDragState: RuntimeScrollbarDragState;
|
|
18
|
+
updateCanvasCursor: () => void;
|
|
19
|
+
markNeedsRender: () => void;
|
|
20
|
+
};
|
|
21
|
+
export type PointerAuxHandlers = {
|
|
22
|
+
onPointerCancel: (event: PointerEvent) => void;
|
|
23
|
+
onWheel: (event: WheelEvent) => void;
|
|
24
|
+
onContextMenu: (event: MouseEvent) => void;
|
|
25
|
+
onPointerLeave: () => void;
|
|
26
|
+
};
|
|
27
|
+
export declare function createPointerAuxHandlers(options: CreatePointerAuxHandlersOptions): PointerAuxHandlers;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type OverlayScrollbarLayout } from "../../overlay-scrollbar";
|
|
2
|
+
import type { BindCanvasEventsOptions, RuntimeCell, RuntimeDesktopSelectionState, RuntimeGridState, RuntimeLinkState, RuntimeScrollbarDragState, RuntimeSelectionState, RuntimeTouchSelectionState } from "./types";
|
|
3
|
+
export type BindPointerEventsOptions = {
|
|
4
|
+
canvas: HTMLCanvasElement;
|
|
5
|
+
bindOptions: BindCanvasEventsOptions;
|
|
6
|
+
touchSelectionMode: "off" | "drag" | "long-press";
|
|
7
|
+
touchSelectionLongPressMs: number;
|
|
8
|
+
touchSelectionMoveThresholdPx: number;
|
|
9
|
+
selectionState: RuntimeSelectionState;
|
|
10
|
+
touchSelectionState: RuntimeTouchSelectionState;
|
|
11
|
+
desktopSelectionState: RuntimeDesktopSelectionState;
|
|
12
|
+
scrollbarDragState: RuntimeScrollbarDragState;
|
|
13
|
+
linkState: RuntimeLinkState;
|
|
14
|
+
cleanupCanvasFns: Array<() => void>;
|
|
15
|
+
isTouchPointer: (event: PointerEvent) => boolean;
|
|
16
|
+
clearPendingTouchSelection: () => void;
|
|
17
|
+
clearPendingDesktopSelection: () => void;
|
|
18
|
+
tryActivatePendingTouchSelection: (pointerId: number) => boolean;
|
|
19
|
+
beginSelectionDrag: (cell: RuntimeCell, pointerId: number) => void;
|
|
20
|
+
noteScrollActivity: () => void;
|
|
21
|
+
getOverlayScrollbarLayout: () => OverlayScrollbarLayout | null;
|
|
22
|
+
pointerToCanvasPx: (event: PointerEvent) => {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
setViewportScrollOffset: (nextOffset: number) => void;
|
|
27
|
+
normalizeSelectionCell: (cell: RuntimeCell) => RuntimeCell;
|
|
28
|
+
positionToCell: (event: {
|
|
29
|
+
clientX: number;
|
|
30
|
+
clientY: number;
|
|
31
|
+
}) => RuntimeCell;
|
|
32
|
+
scrollViewportByLines: (lines: number) => void;
|
|
33
|
+
clearSelection: () => void;
|
|
34
|
+
updateCanvasCursor: () => void;
|
|
35
|
+
markNeedsRender: () => void;
|
|
36
|
+
updateLinkHover: (cell: RuntimeCell | null) => void;
|
|
37
|
+
getGridState: () => RuntimeGridState;
|
|
38
|
+
getWasmReady: () => boolean;
|
|
39
|
+
getWasmHandle: () => number;
|
|
40
|
+
};
|
|
41
|
+
export declare function bindPointerEvents(options: BindPointerEventsOptions): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { InputHandler } from "../../../input";
|
|
2
|
+
import type { RuntimeCell, RuntimeDesktopSelectionState, RuntimeLinkState, RuntimeScrollbarDragState, RuntimeSelectionState, RuntimeTouchSelectionState } from "./types";
|
|
3
|
+
type CreatePointerUpHandlerOptions = {
|
|
4
|
+
inputHandler: InputHandler;
|
|
5
|
+
sendKeyInput: (text: string) => void;
|
|
6
|
+
openLink: (url: string) => void;
|
|
7
|
+
scrollbarDragState: RuntimeScrollbarDragState;
|
|
8
|
+
isTouchPointer: (event: PointerEvent) => boolean;
|
|
9
|
+
touchSelectionState: RuntimeTouchSelectionState;
|
|
10
|
+
selectionState: RuntimeSelectionState;
|
|
11
|
+
normalizeSelectionCell: (cell: RuntimeCell) => RuntimeCell;
|
|
12
|
+
positionToCell: (event: {
|
|
13
|
+
clientX: number;
|
|
14
|
+
clientY: number;
|
|
15
|
+
}) => RuntimeCell;
|
|
16
|
+
clearPendingTouchSelection: () => void;
|
|
17
|
+
clearPendingDesktopSelection: () => void;
|
|
18
|
+
desktopSelectionState: RuntimeDesktopSelectionState;
|
|
19
|
+
clearSelection: () => void;
|
|
20
|
+
updateCanvasCursor: () => void;
|
|
21
|
+
markNeedsRender: () => void;
|
|
22
|
+
shouldRoutePointerToAppMouse: (shiftKey: boolean) => boolean;
|
|
23
|
+
shouldPreferLocalPrimarySelection: (event: PointerEvent) => boolean;
|
|
24
|
+
linkState: RuntimeLinkState;
|
|
25
|
+
updateLinkHover: (cell: RuntimeCell | null) => void;
|
|
26
|
+
};
|
|
27
|
+
export declare function createPointerUpHandler(options: CreatePointerUpHandlerOptions): (event: PointerEvent) => void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { KittyPlacement, ResttyWasm } from "../../../wasm";
|
|
2
|
+
type KittyDecodedImage = {
|
|
3
|
+
key: string;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
source: CanvasImageSource;
|
|
7
|
+
};
|
|
8
|
+
export type KittyImageCache = {
|
|
9
|
+
resolveKittyImage: (placement: KittyPlacement) => KittyDecodedImage | null;
|
|
10
|
+
clearKittyImageCache: () => void;
|
|
11
|
+
pruneInactiveImages: (activeImageIds: Set<number>) => boolean;
|
|
12
|
+
};
|
|
13
|
+
export type CreateKittyImageCacheOptions = {
|
|
14
|
+
getWasm: () => ResttyWasm | null;
|
|
15
|
+
markNeedsRender: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function createKittyImageCache(options: CreateKittyImageCacheOptions): KittyImageCache;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { KittyPlacement } from "../../../wasm";
|
|
2
|
+
import type { KittyImageCache } from "./kitty-image-cache";
|
|
3
|
+
type CreateKittyOverlayRuntimeOptions = {
|
|
4
|
+
getCanvas: () => HTMLCanvasElement;
|
|
5
|
+
kittyOverlayDebugEnabled: boolean;
|
|
6
|
+
kittyImageCache: KittyImageCache;
|
|
7
|
+
};
|
|
8
|
+
export type KittyOverlayRuntime = {
|
|
9
|
+
syncKittyOverlaySize: () => void;
|
|
10
|
+
clearKittyOverlay: () => void;
|
|
11
|
+
drawKittyOverlay: (placements: KittyPlacement[], cellW: number, cellH: number) => void;
|
|
12
|
+
detachKittyOverlayCanvas: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function createKittyOverlayRuntime(options: CreateKittyOverlayRuntimeOptions): KittyOverlayRuntime;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type OverlayScrollbarLayout } from "../../overlay-scrollbar";
|
|
2
|
+
import type { RuntimeGridState, RuntimeLinkState, RuntimeScrollbarState, RuntimeSelectionState } from "./types";
|
|
3
|
+
import type { ResttyWasm, ResttyWasmExports } from "../../../wasm";
|
|
4
|
+
export type CreateScrollbarRuntimeOptions = {
|
|
5
|
+
showOverlayScrollbar: boolean;
|
|
6
|
+
scrollbarState: RuntimeScrollbarState;
|
|
7
|
+
selectionState: RuntimeSelectionState;
|
|
8
|
+
linkState: RuntimeLinkState;
|
|
9
|
+
getCanvas: () => HTMLCanvasElement;
|
|
10
|
+
getCurrentDpr: () => number;
|
|
11
|
+
getGridState: () => RuntimeGridState;
|
|
12
|
+
getWasmReady: () => boolean;
|
|
13
|
+
getWasm: () => ResttyWasm | null;
|
|
14
|
+
getWasmHandle: () => number;
|
|
15
|
+
getWasmExports: () => ResttyWasmExports | null;
|
|
16
|
+
updateLinkHover: (cell: null) => void;
|
|
17
|
+
markNeedsRender: () => void;
|
|
18
|
+
};
|
|
19
|
+
export type ScrollbarRuntime = {
|
|
20
|
+
noteScrollActivity: () => void;
|
|
21
|
+
scrollViewportByLines: (lines: number) => void;
|
|
22
|
+
setViewportScrollOffset: (nextOffset: number) => void;
|
|
23
|
+
pointerToCanvasPx: (event: PointerEvent) => {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
};
|
|
27
|
+
getOverlayScrollbarLayout: () => OverlayScrollbarLayout | null;
|
|
28
|
+
appendOverlayScrollbar: (overlayData: number[], total: number, offset: number, len: number) => void;
|
|
29
|
+
};
|
|
30
|
+
export declare function createScrollbarRuntime(options: CreateScrollbarRuntimeOptions): ScrollbarRuntime;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { InputHandler } from "../../../input";
|
|
2
|
+
import type { createSelectionState } from "../../../selection";
|
|
3
|
+
import type { KittyPlacement, RenderState, ResttyWasm, ResttyWasmExports } from "../../../wasm";
|
|
4
|
+
export type RuntimeCell = {
|
|
5
|
+
row: number;
|
|
6
|
+
col: number;
|
|
7
|
+
};
|
|
8
|
+
export type RuntimeGridState = {
|
|
9
|
+
cols: number;
|
|
10
|
+
rows: number;
|
|
11
|
+
cellW: number;
|
|
12
|
+
cellH: number;
|
|
13
|
+
};
|
|
14
|
+
export type RuntimeImeState = {
|
|
15
|
+
composing: boolean;
|
|
16
|
+
preedit: string;
|
|
17
|
+
selectionStart: number;
|
|
18
|
+
selectionEnd: number;
|
|
19
|
+
};
|
|
20
|
+
export type RuntimeTouchSelectionState = {
|
|
21
|
+
pendingPointerId: number | null;
|
|
22
|
+
activePointerId: number | null;
|
|
23
|
+
panPointerId: number | null;
|
|
24
|
+
pendingCell: RuntimeCell | null;
|
|
25
|
+
pendingStartedAt: number;
|
|
26
|
+
pendingStartX: number;
|
|
27
|
+
pendingStartY: number;
|
|
28
|
+
panLastY: number;
|
|
29
|
+
pendingTimer: number;
|
|
30
|
+
};
|
|
31
|
+
export type RuntimeDesktopSelectionState = {
|
|
32
|
+
pendingPointerId: number | null;
|
|
33
|
+
pendingCell: RuntimeCell | null;
|
|
34
|
+
startedWithActiveSelection: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type RuntimeLinkState = {
|
|
37
|
+
hoverId: number;
|
|
38
|
+
hoverUri: string;
|
|
39
|
+
};
|
|
40
|
+
export type RuntimeScrollbarState = {
|
|
41
|
+
lastInputAt: number;
|
|
42
|
+
lastTotal: number;
|
|
43
|
+
lastOffset: number;
|
|
44
|
+
lastLen: number;
|
|
45
|
+
};
|
|
46
|
+
export type RuntimeScrollbarDragState = {
|
|
47
|
+
pointerId: number | null;
|
|
48
|
+
thumbGrabRatio: number;
|
|
49
|
+
};
|
|
50
|
+
export type RuntimeSelectionState = ReturnType<typeof createSelectionState>;
|
|
51
|
+
export type BindCanvasEventsOptions = {
|
|
52
|
+
inputHandler: InputHandler;
|
|
53
|
+
sendKeyInput: (text: string) => void;
|
|
54
|
+
sendPasteText: (text: string) => void;
|
|
55
|
+
sendPastePayloadFromDataTransfer: (dataTransfer: DataTransfer | null | undefined) => boolean;
|
|
56
|
+
getLastKeydownSeq: () => string;
|
|
57
|
+
getLastKeydownSeqAt: () => number;
|
|
58
|
+
keydownBeforeinputDedupeMs: number;
|
|
59
|
+
openLink: (url: string) => void;
|
|
60
|
+
};
|
|
61
|
+
export type CreateRuntimeInteractionOptions = {
|
|
62
|
+
attachCanvasEvents: boolean;
|
|
63
|
+
touchSelectionMode: "off" | "drag" | "long-press";
|
|
64
|
+
touchSelectionLongPressMs: number;
|
|
65
|
+
touchSelectionMoveThresholdPx: number;
|
|
66
|
+
showOverlayScrollbar: boolean;
|
|
67
|
+
kittyOverlayDebugEnabled: boolean;
|
|
68
|
+
imeInput: HTMLTextAreaElement | null;
|
|
69
|
+
cleanupCanvasFns: Array<() => void>;
|
|
70
|
+
getCanvas: () => HTMLCanvasElement;
|
|
71
|
+
getCurrentDpr: () => number;
|
|
72
|
+
getGridState: () => RuntimeGridState;
|
|
73
|
+
getLastRenderState: () => RenderState | null;
|
|
74
|
+
getWasmReady: () => boolean;
|
|
75
|
+
getWasm: () => ResttyWasm | null;
|
|
76
|
+
getWasmHandle: () => number;
|
|
77
|
+
getWasmExports: () => ResttyWasmExports | null;
|
|
78
|
+
updateLinkHover: (cell: RuntimeCell | null) => void;
|
|
79
|
+
markNeedsRender: () => void;
|
|
80
|
+
};
|
|
81
|
+
export type RuntimeInteraction = {
|
|
82
|
+
selectionState: RuntimeSelectionState;
|
|
83
|
+
linkState: RuntimeLinkState;
|
|
84
|
+
scrollbarState: RuntimeScrollbarState;
|
|
85
|
+
imeState: RuntimeImeState;
|
|
86
|
+
updateCanvasCursor: () => void;
|
|
87
|
+
syncKittyOverlaySize: () => void;
|
|
88
|
+
clearKittyOverlay: () => void;
|
|
89
|
+
drawKittyOverlay: (placements: KittyPlacement[], cellW: number, cellH: number) => void;
|
|
90
|
+
positionToCell: (event: {
|
|
91
|
+
clientX: number;
|
|
92
|
+
clientY: number;
|
|
93
|
+
}) => RuntimeCell;
|
|
94
|
+
positionToPixel: (event: {
|
|
95
|
+
clientX: number;
|
|
96
|
+
clientY: number;
|
|
97
|
+
}) => {
|
|
98
|
+
x: number;
|
|
99
|
+
y: number;
|
|
100
|
+
};
|
|
101
|
+
clearSelection: () => void;
|
|
102
|
+
updateImePosition: (cursor: {
|
|
103
|
+
row: number;
|
|
104
|
+
col: number;
|
|
105
|
+
} | null | undefined, cellW: number, cellH: number) => void;
|
|
106
|
+
appendOverlayScrollbar: (overlayData: number[], total: number, offset: number, len: number) => void;
|
|
107
|
+
bindCanvasEvents: (bindOptions: BindCanvasEventsOptions) => void;
|
|
108
|
+
detachKittyOverlayCanvas: () => void;
|
|
109
|
+
clearKittyImageCache: () => void;
|
|
110
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CreateRuntimeInteractionOptions, RuntimeInteraction } from "./interaction-runtime/types";
|
|
2
|
+
export type { BindCanvasEventsOptions, CreateRuntimeInteractionOptions, RuntimeCell, RuntimeInteraction, } from "./interaction-runtime/types";
|
|
3
|
+
export declare function createRuntimeInteraction(options: CreateRuntimeInteractionOptions): RuntimeInteraction;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { KittyPlacement } from "../../wasm";
|
|
2
|
+
export type KittyDecodedImageLike = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export type KittySlice = {
|
|
7
|
+
sx: number;
|
|
8
|
+
sy: number;
|
|
9
|
+
sw: number;
|
|
10
|
+
sh: number;
|
|
11
|
+
rawSw: number;
|
|
12
|
+
rawSh: number;
|
|
13
|
+
dx: number;
|
|
14
|
+
dy: number;
|
|
15
|
+
dw: number;
|
|
16
|
+
dh: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function kittyHashInt(hash: number, value: number): number;
|
|
19
|
+
export declare function kittyHashString(hash: number, value: string): number;
|
|
20
|
+
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,13 @@
|
|
|
1
|
+
import type { LifecycleThemeSizeDeps } from "./lifecycle-theme-size.types";
|
|
2
|
+
export declare function createLifecycleCanvasHandlers(deps: LifecycleThemeSizeDeps): {
|
|
3
|
+
replaceCanvas: () => void;
|
|
4
|
+
updateSize: (force?: boolean) => void;
|
|
5
|
+
resize: (cols: number, rows: number) => void;
|
|
6
|
+
scheduleSizeUpdate: () => void;
|
|
7
|
+
focusTypingInput: () => void;
|
|
8
|
+
focus: () => void;
|
|
9
|
+
blur: () => void;
|
|
10
|
+
bindFocusEvents: () => void;
|
|
11
|
+
bindAutoResizeEvents: () => void;
|
|
12
|
+
cancelScheduledSizeUpdate: () => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type GhosttyTheme } from "../../theme";
|
|
2
|
+
import type { LifecycleThemeSizeDeps } from "./lifecycle-theme-size.types";
|
|
3
|
+
export declare function createLifecycleThemeHandlers(deps: LifecycleThemeSizeDeps): {
|
|
4
|
+
applyTheme: (theme: GhosttyTheme | null | undefined, sourceLabel?: string) => void;
|
|
5
|
+
resetTheme: () => void;
|
|
6
|
+
};
|