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,24 @@
|
|
|
1
|
+
import { type Color } from "../renderer";
|
|
2
|
+
export declare const OVERLAY_SCROLLBAR_WIDTH_CSS_PX = 7;
|
|
3
|
+
export declare const OVERLAY_SCROLLBAR_MARGIN_CSS_PX = 4;
|
|
4
|
+
export declare const OVERLAY_SCROLLBAR_INSET_Y_CSS_PX = 2;
|
|
5
|
+
export declare const OVERLAY_SCROLLBAR_MIN_THUMB_CSS_PX = 28;
|
|
6
|
+
export declare const OVERLAY_SCROLLBAR_CAP_SUPERSAMPLE = 8;
|
|
7
|
+
export type OverlayScrollbarLayout = {
|
|
8
|
+
total: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
len: number;
|
|
11
|
+
denom: number;
|
|
12
|
+
width: number;
|
|
13
|
+
trackX: number;
|
|
14
|
+
trackY: number;
|
|
15
|
+
trackH: number;
|
|
16
|
+
thumbY: number;
|
|
17
|
+
thumbH: number;
|
|
18
|
+
};
|
|
19
|
+
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type CreatePtyOutputBufferControllerOptions = {
|
|
2
|
+
idleMs: number;
|
|
3
|
+
maxMs: number;
|
|
4
|
+
onFlush: (text: string) => void;
|
|
5
|
+
};
|
|
6
|
+
export type PtyOutputBufferController = {
|
|
7
|
+
queue: (text: string) => void;
|
|
8
|
+
flush: () => void;
|
|
9
|
+
cancel: () => void;
|
|
10
|
+
clear: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function createPtyOutputBufferController(options: CreatePtyOutputBufferControllerOptions): PtyOutputBufferController;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Color } from "../renderer";
|
|
2
|
+
export declare function decodePackedRGBA(color: number): Color;
|
|
3
|
+
export declare function decodeRGBAWithCache(bytes: Uint8Array, index: number, cache: Map<number, Color>): Color;
|
|
4
|
+
export declare function clamp01(value: number): number;
|
|
5
|
+
export declare function brighten(color: Color, amount: number): Color;
|
|
6
|
+
export declare function fade(color: Color, factor: number): Color;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CompiledWebGPUShaderStage, WebGPUStageTargets, CompiledWebGLShaderStage, WebGLStageTargets } from "./create-app-types";
|
|
2
|
+
import type { ResttyShaderStage } from "./types";
|
|
3
|
+
export declare function compileShaderStageProgram(options: {
|
|
4
|
+
gl: WebGL2RenderingContext;
|
|
5
|
+
stage: ResttyShaderStage;
|
|
6
|
+
reportError: (stage: ResttyShaderStage, message: string) => void;
|
|
7
|
+
}): CompiledWebGLShaderStage | null;
|
|
8
|
+
export declare function createWebGLStageTexture(gl: WebGL2RenderingContext, width: number, height: number): WebGLTexture | null;
|
|
9
|
+
export declare function createWebGLStageFramebuffer(gl: WebGL2RenderingContext, texture: WebGLTexture): WebGLFramebuffer | null;
|
|
10
|
+
export declare function createWebGLStageTargets(gl: WebGL2RenderingContext, width: number, height: number): WebGLStageTargets | null;
|
|
11
|
+
export declare function compileShaderStagePipelineWebGPU(options: {
|
|
12
|
+
device: GPUDevice;
|
|
13
|
+
format: GPUTextureFormat;
|
|
14
|
+
stage: ResttyShaderStage;
|
|
15
|
+
reportError: (stage: ResttyShaderStage, message: string) => void;
|
|
16
|
+
}): CompiledWebGPUShaderStage | null;
|
|
17
|
+
export declare function createWebGPUStageTargets(device: GPUDevice, format: GPUTextureFormat, width: number, height: number): WebGPUStageTargets;
|
|
18
|
+
export declare function rebuildWebGPUStageBindGroups(device: GPUDevice, compiledStages: CompiledWebGPUShaderStage[], targets: WebGPUStageTargets): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const STAGE_UNIFORM_BUFFER_FLOATS = 12;
|
|
2
|
+
export declare const FULLSCREEN_STAGE_VERTEX_SHADER_GL = "#version 300 es\nprecision highp float;\nlayout(location = 0) in vec2 a_quad;\nout vec2 v_uv;\nvoid main() {\n v_uv = a_quad;\n vec2 clip = vec2(a_quad.x * 2.0 - 1.0, 1.0 - a_quad.y * 2.0);\n gl_Position = vec4(clip, 0.0, 1.0);\n}\n";
|
|
3
|
+
export declare const FULLSCREEN_STAGE_SHADER_GL_PREFIX = "#version 300 es\nprecision highp float;\nuniform sampler2D u_source;\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform vec4 u_params0;\nuniform vec4 u_params1;\nin vec2 v_uv;\nout vec4 fragColor;\n";
|
|
4
|
+
export declare const FULLSCREEN_STAGE_SHADER_GL_SUFFIX = "\nvoid main() {\n vec4 color = texture(u_source, v_uv);\n fragColor = resttyStage(color, v_uv, u_time, u_params0, u_params1);\n}\n";
|
|
5
|
+
export declare const FULLSCREEN_STAGE_SHADER_WGSL_PREFIX = "\nstruct StageUniforms {\n resolution: vec2f,\n time: f32,\n _pad0: f32,\n params0: vec4f,\n params1: vec4f,\n};\n\n@group(0) @binding(0) var sourceSampler: sampler;\n@group(0) @binding(1) var sourceTex: texture_2d<f32>;\n@group(0) @binding(2) var<uniform> stageUniforms: StageUniforms;\n\nstruct VSOut {\n @builtin(position) position: vec4f,\n @location(0) uv: vec2f,\n};\n\n@vertex\nfn vsMain(@location(0) quad: vec2f) -> VSOut {\n var out: VSOut;\n out.uv = quad;\n let clip = vec2f(quad.x * 2.0 - 1.0, 1.0 - quad.y * 2.0);\n out.position = vec4f(clip.x, clip.y, 0.0, 1.0);\n return out;\n}\n";
|
|
6
|
+
export declare const FULLSCREEN_STAGE_SHADER_WGSL_SUFFIX = "\n@fragment\nfn fsMain(input: VSOut) -> @location(0) vec4f {\n let color = textureSample(sourceTex, sourceSampler, input.uv);\n return resttyStage(\n color,\n input.uv,\n stageUniforms.time,\n stageUniforms.params0,\n stageUniforms.params1,\n );\n}\n";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ResttyShaderStage } from "./types";
|
|
2
|
+
export declare const RESTTY_SHADER_STAGE_UNIFORM_CAP = 8;
|
|
3
|
+
export declare function cloneShaderStage(stage: ResttyShaderStage): ResttyShaderStage;
|
|
4
|
+
export declare function cloneShaderStages(stages: ResttyShaderStage[]): ResttyShaderStage[];
|
|
5
|
+
export declare function normalizeShaderStage(stage: ResttyShaderStage): ResttyShaderStage;
|
|
6
|
+
export declare function normalizeShaderStages(stages: ResttyShaderStage[]): ResttyShaderStage[];
|
|
7
|
+
export declare function sortShaderStages(stages: ResttyShaderStage[]): ResttyShaderStage[];
|
|
8
|
+
export declare function packShaderStageUniforms(stage: ResttyShaderStage): Float32Array;
|
|
9
|
+
export declare function isShaderStageEnabledForBackend(stage: ResttyShaderStage, backend: "webgpu" | "webgl2"): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Color } from "../renderer";
|
|
2
|
+
export declare function drawUnderlineStyle(underlineData: number[], style: number, x: number, rowY: number, cellW: number, cellH: number, baseY: number, underlineOffsetPx: number, underlineThicknessPx: number, color: Color): void;
|
|
3
|
+
export declare function drawStrikethrough(underlineData: number[], x: number, rowY: number, cellW: number, cellH: number, color: Color): void;
|
|
4
|
+
export declare function drawOverline(underlineData: number[], x: number, rowY: number, cellW: number, color: Color): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InputHandler, MouseMode } from "../input";
|
|
1
|
+
import type { DesktopNotification, InputHandler, MouseMode } from "../input";
|
|
2
2
|
import type { PtyTransport } from "../pty";
|
|
3
3
|
import type { WebGPUCoreState } from "../renderer";
|
|
4
4
|
import type { GhosttyTheme } from "../theme";
|
|
@@ -85,6 +85,8 @@ export type ResttyAppCallbacks = {
|
|
|
85
85
|
onPtyStatus?: (status: string) => void;
|
|
86
86
|
/** Mouse mode/status changed. */
|
|
87
87
|
onMouseStatus?: (status: string) => void;
|
|
88
|
+
/** Terminal requested a desktop notification via OSC 9 / OSC 777. */
|
|
89
|
+
onDesktopNotification?: (notification: DesktopNotification) => void;
|
|
88
90
|
};
|
|
89
91
|
/** Raw font data as an ArrayBuffer or typed-array view. */
|
|
90
92
|
export type ResttyFontBufferData = ArrayBuffer | ArrayBufferView;
|
|
@@ -141,6 +143,36 @@ export type ResttyAppInputPayload = {
|
|
|
141
143
|
text: string;
|
|
142
144
|
source: string;
|
|
143
145
|
};
|
|
146
|
+
/** Render-stage phase ordering. */
|
|
147
|
+
export type ResttyShaderStageMode = "before-main" | "after-main" | "replace-main";
|
|
148
|
+
/** Target backend(s) for a shader stage. */
|
|
149
|
+
export type ResttyShaderStageBackend = "webgpu" | "webgl2" | "both";
|
|
150
|
+
/** Stage shader source definitions. */
|
|
151
|
+
export type ResttyShaderStageSource = {
|
|
152
|
+
/**
|
|
153
|
+
* WGSL source that defines:
|
|
154
|
+
* fn resttyStage(color: vec4f, uv: vec2f, time: f32, params0: vec4f, params1: vec4f) -> vec4f
|
|
155
|
+
*/
|
|
156
|
+
wgsl?: string;
|
|
157
|
+
/**
|
|
158
|
+
* GLSL source that defines:
|
|
159
|
+
* vec4 resttyStage(vec4 color, vec2 uv, float time, vec4 params0, vec4 params1)
|
|
160
|
+
*/
|
|
161
|
+
glsl?: string;
|
|
162
|
+
};
|
|
163
|
+
/** User-defined frame shader stage. */
|
|
164
|
+
export type ResttyShaderStage = {
|
|
165
|
+
id: string;
|
|
166
|
+
mode?: ResttyShaderStageMode;
|
|
167
|
+
backend?: ResttyShaderStageBackend;
|
|
168
|
+
priority?: number;
|
|
169
|
+
enabled?: boolean;
|
|
170
|
+
/** Optional numeric uniforms packed into params0/params1 (up to 8 values). */
|
|
171
|
+
uniforms?: number[];
|
|
172
|
+
shader: ResttyShaderStageSource;
|
|
173
|
+
/** Optional compile/runtime error callback for this stage. */
|
|
174
|
+
onError?: (message: string) => void;
|
|
175
|
+
};
|
|
144
176
|
/**
|
|
145
177
|
* Options for creating a ResttyApp instance.
|
|
146
178
|
*/
|
|
@@ -222,6 +254,8 @@ export type ResttyAppOptions = {
|
|
|
222
254
|
* queued for rendering.
|
|
223
255
|
*/
|
|
224
256
|
beforeRenderOutput?: (payload: ResttyAppInputPayload) => string | null | void;
|
|
257
|
+
/** Optional render-stage shader chain. */
|
|
258
|
+
shaderStages?: ResttyShaderStage[];
|
|
225
259
|
};
|
|
226
260
|
/**
|
|
227
261
|
* Public API for a terminal app instance.
|
|
@@ -277,4 +311,8 @@ export type ResttyApp = {
|
|
|
277
311
|
updateSize: (force?: boolean) => void;
|
|
278
312
|
/** Return the name of the active renderer backend. */
|
|
279
313
|
getBackend: () => string;
|
|
314
|
+
/** Replace the active shader stage list. */
|
|
315
|
+
setShaderStages: (stages: ResttyShaderStage[]) => void;
|
|
316
|
+
/** Get the current shader stage list. */
|
|
317
|
+
getShaderStages: () => ResttyShaderStage[];
|
|
280
318
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Copy text to the system clipboard, with a legacy execCommand fallback. */
|
|
2
|
+
export declare function copyToClipboard(text: string): Promise<boolean>;
|
|
3
|
+
/** Read text from the system clipboard, returning null on failure. */
|
|
4
|
+
export declare function pasteFromClipboard(): Promise<string | null>;
|
|
@@ -17,13 +17,6 @@ export declare function endSelection(state: SelectionState, cell: CellPosition):
|
|
|
17
17
|
* is outside the selection.
|
|
18
18
|
*/
|
|
19
19
|
export declare function selectionForRow(state: SelectionState, row: number, cols: number): SelectionRange | null;
|
|
20
|
-
/** Callback that returns the text content of a cell by flat grid index. */
|
|
21
|
-
export type CellTextGetter = (idx: number) => string;
|
|
22
|
-
/**
|
|
23
|
-
* Extract the selected text as a newline-separated string, with trailing
|
|
24
|
-
* whitespace trimmed from each line.
|
|
25
|
-
*/
|
|
26
|
-
export declare function getSelectionText(state: SelectionState, rows: number, cols: number, getCellText: CellTextGetter): string;
|
|
27
20
|
/**
|
|
28
21
|
* Clamp a cell position to the grid bounds and snap wide-character
|
|
29
22
|
* continuation cells back to the leading cell.
|
|
@@ -31,7 +24,3 @@ export declare function getSelectionText(state: SelectionState, rows: number, co
|
|
|
31
24
|
export declare function normalizeSelectionCell(cell: CellPosition | null, rows: number, cols: number, wideFlags?: Uint8Array | null): CellPosition | null;
|
|
32
25
|
/** Convert client pixel coordinates to a grid cell position. */
|
|
33
26
|
export declare function positionToCell(clientX: number, clientY: number, canvasRect: DOMRect, dpr: number, cellW: number, cellH: number, cols: number, rows: number): CellPosition;
|
|
34
|
-
/** Copy text to the system clipboard, with a legacy execCommand fallback. */
|
|
35
|
-
export declare function copyToClipboard(text: string): Promise<boolean>;
|
|
36
|
-
/** Read text from the system clipboard, returning null on failure. */
|
|
37
|
-
export declare function pasteFromClipboard(): Promise<string | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SelectionState } from "./types";
|
|
2
|
+
/** Callback that returns the text content of a cell by flat grid index. */
|
|
3
|
+
export type CellTextGetter = (idx: number) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Extract the selected text as a newline-separated string, with trailing
|
|
6
|
+
* whitespace trimmed from each line.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSelectionText(state: SelectionState, rows: number, cols: number, getCellText: CellTextGetter): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ResttyPaneStyleOptions, type ResttyPaneStylesOptions, type ResttyPaneContextMenuOptions, type ResttyPaneManager, type ResttyPaneShortcutsOptions, type ResttyPaneWithApp } from "./panes";
|
|
2
|
-
import type { ResttyAppOptions, ResttyAppSession } from "
|
|
1
|
+
import { type ResttyPaneStyleOptions, type ResttyPaneStylesOptions, type ResttyPaneContextMenuOptions, type ResttyPaneManager, type ResttyPaneShortcutsOptions, type ResttyPaneWithApp } from "./panes-types";
|
|
2
|
+
import type { ResttyAppOptions, ResttyAppSession } from "../runtime/types";
|
|
3
3
|
/**
|
|
4
4
|
* A pane created by the app pane manager, extending the base pane
|
|
5
5
|
* with DOM elements needed by the terminal app.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CreateDefaultResttyPaneContextMenuItemsOptions, ResttyPaneContextMenuItem, ResttyPaneWithApp } from "../panes-types";
|
|
2
|
+
/** Return the platform-appropriate shortcut modifier label ("Cmd" on macOS, "Ctrl" elsewhere). */
|
|
3
|
+
export declare function getResttyShortcutModifierLabel(): "Cmd" | "Ctrl";
|
|
4
|
+
/**
|
|
5
|
+
* Build the standard right-click context menu items for a pane
|
|
6
|
+
* (copy, paste, split, close, clear, PTY toggle, pause toggle).
|
|
7
|
+
*/
|
|
8
|
+
export declare function createDefaultResttyPaneContextMenuItems<TPane extends ResttyPaneWithApp>(options: CreateDefaultResttyPaneContextMenuItemsOptions<TPane>): Array<ResttyPaneContextMenuItem | "separator">;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ResttyPaneDefinition, ResttyPaneSplitDirection } from "../panes-types";
|
|
2
|
+
export declare function findClosestPaneToRect<TPane extends ResttyPaneDefinition>(sourceRect: DOMRectReadOnly | null, panes: Iterable<TPane>): TPane | null;
|
|
3
|
+
export declare function collapseSplitAncestors(start: HTMLElement | null): void;
|
|
4
|
+
export declare function createSplitDividerFactory(options: {
|
|
5
|
+
minPaneSize: number;
|
|
6
|
+
requestLayoutSync: () => void;
|
|
7
|
+
}): {
|
|
8
|
+
createSplitDivider: (direction: ResttyPaneSplitDirection) => HTMLDivElement;
|
|
9
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PaneContextMenuController } from "../panes-context-menu";
|
|
2
|
+
import type { ResttyPaneContextMenuOptions, ResttyPaneDefinition, ResttyPaneManager } from "../panes-types";
|
|
3
|
+
export declare function createPaneInteractions<TPane extends ResttyPaneDefinition>(options: {
|
|
4
|
+
contextMenu: ResttyPaneContextMenuOptions<TPane> | null | undefined;
|
|
5
|
+
contextMenuController: PaneContextMenuController<TPane> | null;
|
|
6
|
+
getManager: () => ResttyPaneManager<TPane>;
|
|
7
|
+
markPaneFocused: (id: number) => void;
|
|
8
|
+
}): {
|
|
9
|
+
bindPaneInteractions: (pane: TPane) => void;
|
|
10
|
+
cleanupPaneInteractions: (id: number) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ResttyPaneShortcutsOptions, ResttyPaneSplitDirection } from "../panes-types";
|
|
2
|
+
export declare function attachPaneManagerWindowEvents(options: {
|
|
3
|
+
contextMenuController?: {
|
|
4
|
+
isOpen: () => boolean;
|
|
5
|
+
containsTarget: (target: EventTarget | null) => boolean;
|
|
6
|
+
} | null;
|
|
7
|
+
hideContextMenu: () => void;
|
|
8
|
+
shortcutOptions: ResttyPaneShortcutsOptions;
|
|
9
|
+
splitActivePane: (direction: ResttyPaneSplitDirection) => void;
|
|
10
|
+
}): () => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { InputHandler, MouseMode } from "../../input";
|
|
2
|
+
import type { GhosttyTheme } from "../../theme";
|
|
3
|
+
import type { ResttyPaneHandle } from "../restty-pane-handle";
|
|
4
|
+
export declare abstract class ResttyActivePaneApi {
|
|
5
|
+
protected abstract requireActivePaneHandle(): ResttyPaneHandle;
|
|
6
|
+
isPtyConnected(): boolean;
|
|
7
|
+
setRenderer(value: "auto" | "webgpu" | "webgl2"): void;
|
|
8
|
+
setPaused(value: boolean): void;
|
|
9
|
+
togglePause(): void;
|
|
10
|
+
setFontSize(value: number): void;
|
|
11
|
+
applyTheme(theme: GhosttyTheme, sourceLabel?: string): void;
|
|
12
|
+
resetTheme(): void;
|
|
13
|
+
sendInput(text: string, source?: string): void;
|
|
14
|
+
sendKeyInput(text: string, source?: string): void;
|
|
15
|
+
clearScreen(): void;
|
|
16
|
+
setMouseMode(value: MouseMode): void;
|
|
17
|
+
getMouseStatus(): ReturnType<InputHandler["getMouseStatus"]>;
|
|
18
|
+
copySelectionToClipboard(): Promise<boolean>;
|
|
19
|
+
pasteFromClipboard(): Promise<boolean>;
|
|
20
|
+
dumpAtlasForCodepoint(cp: number): void;
|
|
21
|
+
updateSize(force?: boolean): void;
|
|
22
|
+
getBackend(): string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DesktopNotification } from "../../input";
|
|
2
|
+
import type { CreateResttyAppPaneManagerOptions } from "../pane-app-manager";
|
|
3
|
+
import type { ResttyPluginEvents, ResttyRenderHookPayload } from "../restty-plugin-types";
|
|
4
|
+
import type { ResttyFontSource } from "../../runtime/types";
|
|
5
|
+
import type { ResttyPluginOps } from "./plugin-ops";
|
|
6
|
+
import type { ResttyShaderOps } from "./shader-ops";
|
|
7
|
+
type PaneManagerEventHandlers = Pick<CreateResttyAppPaneManagerOptions, "onPaneCreated" | "onPaneClosed" | "onPaneSplit" | "onActivePaneChange" | "onLayoutChanged">;
|
|
8
|
+
type MergedPaneAppOptionsDeps = {
|
|
9
|
+
appOptions: CreateResttyAppPaneManagerOptions["appOptions"] | undefined;
|
|
10
|
+
getFontSources: () => ResttyFontSource[] | undefined;
|
|
11
|
+
onDesktopNotification?: (notification: DesktopNotification & {
|
|
12
|
+
paneId: number;
|
|
13
|
+
}) => void;
|
|
14
|
+
shaderOps: Pick<ResttyShaderOps, "normalizePaneShaderStages" | "setPaneBaseShaderStages" | "buildMergedShaderStages">;
|
|
15
|
+
pluginOps: Pick<ResttyPluginOps, "applyInputInterceptors" | "applyOutputInterceptors">;
|
|
16
|
+
runRenderHooks: (payload: ResttyRenderHookPayload) => void;
|
|
17
|
+
};
|
|
18
|
+
type PaneManagerCallbacksDeps = PaneManagerEventHandlers & {
|
|
19
|
+
shaderOps: Pick<ResttyShaderOps, "syncPaneShaderStages" | "removePaneBaseShaderStages">;
|
|
20
|
+
emitPluginEvent: <E extends keyof ResttyPluginEvents>(event: E, payload: ResttyPluginEvents[E]) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare function createMergedPaneAppOptions(deps: MergedPaneAppOptionsDeps): CreateResttyAppPaneManagerOptions["appOptions"];
|
|
23
|
+
export declare function createPaneManagerEventHandlers(deps: PaneManagerCallbacksDeps): PaneManagerEventHandlers;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ResttyManagedAppPane, ResttyManagedPaneStyleOptions } from "../pane-app-manager";
|
|
2
|
+
import type { ResttyPaneManager, ResttyPaneSplitDirection } from "../panes-types";
|
|
3
|
+
import { ResttyPaneHandle } from "../restty-pane-handle";
|
|
4
|
+
import type { ResttyLifecycleHookPayload, ResttyPluginEvents } from "../restty-plugin-types";
|
|
5
|
+
type ResttyPaneLookup = {
|
|
6
|
+
getPanes: () => ResttyManagedAppPane[];
|
|
7
|
+
getPaneById: (id: number) => ResttyManagedAppPane | null;
|
|
8
|
+
getActivePane: () => ResttyManagedAppPane | null;
|
|
9
|
+
getFocusedPane: () => ResttyManagedAppPane | null;
|
|
10
|
+
};
|
|
11
|
+
type ResttyLifecycleEmitter = {
|
|
12
|
+
runLifecycleHooks: (payload: ResttyLifecycleHookPayload) => void;
|
|
13
|
+
emitPluginEvent: <E extends keyof ResttyPluginEvents>(event: E, payload: ResttyPluginEvents[E]) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function requirePaneById(getPaneById: (id: number) => ResttyManagedAppPane | null, id: number): ResttyManagedAppPane;
|
|
16
|
+
export declare function makePaneHandle(getPaneById: (id: number) => ResttyManagedAppPane | null, id: number): ResttyPaneHandle;
|
|
17
|
+
export declare function requireActivePaneHandle(lookup: Pick<ResttyPaneLookup, "getActivePane" | "getPaneById">): ResttyPaneHandle;
|
|
18
|
+
export declare function panes(lookup: Pick<ResttyPaneLookup, "getPanes" | "getPaneById">): ResttyPaneHandle[];
|
|
19
|
+
export declare function pane(lookup: Pick<ResttyPaneLookup, "getPaneById">, id: number): ResttyPaneHandle | null;
|
|
20
|
+
export declare function activePane(lookup: Pick<ResttyPaneLookup, "getActivePane" | "getPaneById">): ResttyPaneHandle | null;
|
|
21
|
+
export declare function focusedPane(lookup: Pick<ResttyPaneLookup, "getFocusedPane" | "getPaneById">): ResttyPaneHandle | null;
|
|
22
|
+
export declare function forEachPane(lookup: Pick<ResttyPaneLookup, "getPanes" | "getPaneById">, visitor: (pane: ResttyPaneHandle) => void): void;
|
|
23
|
+
export declare function createInitialPane(paneManager: ResttyPaneManager<ResttyManagedAppPane>, hooks: Pick<ResttyLifecycleEmitter, "runLifecycleHooks">, options?: {
|
|
24
|
+
focus?: boolean;
|
|
25
|
+
}): ResttyManagedAppPane;
|
|
26
|
+
export declare function splitActivePane(paneManager: ResttyPaneManager<ResttyManagedAppPane>, lookup: Pick<ResttyPaneLookup, "getActivePane">, hooks: Pick<ResttyLifecycleEmitter, "runLifecycleHooks">, direction: ResttyPaneSplitDirection): ResttyManagedAppPane | null;
|
|
27
|
+
export declare function splitPane(paneManager: ResttyPaneManager<ResttyManagedAppPane>, hooks: Pick<ResttyLifecycleEmitter, "runLifecycleHooks">, id: number, direction: ResttyPaneSplitDirection): ResttyManagedAppPane | null;
|
|
28
|
+
export declare function closePane(paneManager: ResttyPaneManager<ResttyManagedAppPane>, hooks: Pick<ResttyLifecycleEmitter, "runLifecycleHooks">, id: number): boolean;
|
|
29
|
+
export declare function setActivePane(paneManager: ResttyPaneManager<ResttyManagedAppPane>, lookup: Pick<ResttyPaneLookup, "getActivePane">, hooks: Pick<ResttyLifecycleEmitter, "runLifecycleHooks">, id: number, options?: {
|
|
30
|
+
focus?: boolean;
|
|
31
|
+
}): void;
|
|
32
|
+
export declare function markPaneFocused(paneManager: ResttyPaneManager<ResttyManagedAppPane>, lookup: Pick<ResttyPaneLookup, "getFocusedPane">, hooks: Pick<ResttyLifecycleEmitter, "runLifecycleHooks">, id: number, options?: {
|
|
33
|
+
focus?: boolean;
|
|
34
|
+
}): void;
|
|
35
|
+
export declare function connectPty(lookup: Pick<ResttyPaneLookup, "getActivePane" | "getPaneById">, hooks: Pick<ResttyLifecycleEmitter, "runLifecycleHooks">, url?: string): void;
|
|
36
|
+
export declare function disconnectPty(lookup: Pick<ResttyPaneLookup, "getActivePane" | "getPaneById">, hooks: Pick<ResttyLifecycleEmitter, "runLifecycleHooks">): void;
|
|
37
|
+
export declare function resize(lookup: Pick<ResttyPaneLookup, "getActivePane" | "getPaneById">, hooks: ResttyLifecycleEmitter, cols: number, rows: number): void;
|
|
38
|
+
export declare function focus(lookup: Pick<ResttyPaneLookup, "getActivePane" | "getPaneById">, hooks: ResttyLifecycleEmitter): void;
|
|
39
|
+
export declare function blur(lookup: Pick<ResttyPaneLookup, "getActivePane" | "getPaneById">, hooks: ResttyLifecycleEmitter): void;
|
|
40
|
+
export declare function getPaneStyleOptions(paneManager: ResttyPaneManager<ResttyManagedAppPane>): Readonly<Required<ResttyManagedPaneStyleOptions>>;
|
|
41
|
+
export declare function setPaneStyleOptions(paneManager: ResttyPaneManager<ResttyManagedAppPane>, options: ResttyManagedPaneStyleOptions): void;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type ResttyLifecycleHookPayload, type ResttyPluginContext, type ResttyPluginEvents, type ResttyRenderHookPayload, type ResttyRenderStageHandle } from "../restty-plugin-types";
|
|
2
|
+
import { type ResttyPluginRuntime } from "../restty-plugin-runtime";
|
|
3
|
+
import type { ResttyShaderStage } from "../../runtime/types";
|
|
4
|
+
import type { ResttyPaneHandle } from "../restty-pane-handle";
|
|
5
|
+
import type { Restty } from "../restty";
|
|
6
|
+
export type ResttyPluginHostDeps = {
|
|
7
|
+
restty: Restty;
|
|
8
|
+
panes: () => ResttyPaneHandle[];
|
|
9
|
+
pane: (id: number) => ResttyPaneHandle | null;
|
|
10
|
+
activePane: () => ResttyPaneHandle | null;
|
|
11
|
+
focusedPane: () => ResttyPaneHandle | null;
|
|
12
|
+
addRenderStage: (stage: ResttyShaderStage, ownerPluginId: string | null) => ResttyRenderStageHandle;
|
|
13
|
+
};
|
|
14
|
+
export declare class ResttyPluginDispatcher {
|
|
15
|
+
private readonly deps;
|
|
16
|
+
private readonly pluginListeners;
|
|
17
|
+
private readonly inputInterceptors;
|
|
18
|
+
private readonly outputInterceptors;
|
|
19
|
+
private readonly lifecycleHooks;
|
|
20
|
+
private readonly renderHooks;
|
|
21
|
+
private nextInterceptorId;
|
|
22
|
+
private nextInterceptorOrder;
|
|
23
|
+
constructor(deps: ResttyPluginHostDeps);
|
|
24
|
+
createPluginContext(runtime: ResttyPluginRuntime): ResttyPluginContext;
|
|
25
|
+
applyInputInterceptors(paneId: number, text: string, source: string): string | null;
|
|
26
|
+
applyOutputInterceptors(paneId: number, text: string, source: string): string | null;
|
|
27
|
+
runLifecycleHooks(payload: ResttyLifecycleHookPayload): void;
|
|
28
|
+
runRenderHooks(payload: ResttyRenderHookPayload): void;
|
|
29
|
+
emitPluginEvent<E extends keyof ResttyPluginEvents>(event: E, payload: ResttyPluginEvents[E]): void;
|
|
30
|
+
private attachRuntimeDisposer;
|
|
31
|
+
private addInputInterceptor;
|
|
32
|
+
private addOutputInterceptor;
|
|
33
|
+
private addLifecycleHook;
|
|
34
|
+
private addRenderHook;
|
|
35
|
+
private registerInterceptor;
|
|
36
|
+
private applyInterceptors;
|
|
37
|
+
private runHooks;
|
|
38
|
+
private onPluginEvent;
|
|
39
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ResttyLifecycleHookPayload, type ResttyPlugin, type ResttyPluginEvents, type ResttyPluginInfo, type ResttyPluginLoadResult, type ResttyPluginManifestEntry, type ResttyPluginRegistry, type ResttyRenderHookPayload } from "../restty-plugin-types";
|
|
2
|
+
import { type ResttyPluginHostDeps } from "./plugin-dispatcher";
|
|
3
|
+
export declare class ResttyPluginOps {
|
|
4
|
+
private readonly pluginRuntimes;
|
|
5
|
+
private readonly pluginDiagnostics;
|
|
6
|
+
private readonly dispatcher;
|
|
7
|
+
constructor(deps: ResttyPluginHostDeps);
|
|
8
|
+
use(plugin: ResttyPlugin, options?: unknown): Promise<void>;
|
|
9
|
+
loadPlugins(manifest: ReadonlyArray<ResttyPluginManifestEntry>, registry: ResttyPluginRegistry): Promise<ResttyPluginLoadResult[]>;
|
|
10
|
+
unuse(pluginId: string): boolean;
|
|
11
|
+
plugins(): string[];
|
|
12
|
+
pluginInfo(pluginId: string): ResttyPluginInfo | null;
|
|
13
|
+
pluginInfo(): ResttyPluginInfo[];
|
|
14
|
+
destroy(): void;
|
|
15
|
+
applyInputInterceptors(paneId: number, text: string, source: string): string | null;
|
|
16
|
+
applyOutputInterceptors(paneId: number, text: string, source: string): string | null;
|
|
17
|
+
runLifecycleHooks(payload: ResttyLifecycleHookPayload): void;
|
|
18
|
+
runRenderHooks(payload: ResttyRenderHookPayload): void;
|
|
19
|
+
emitPluginEvent<E extends keyof ResttyPluginEvents>(event: E, payload: ResttyPluginEvents[E]): void;
|
|
20
|
+
private setPluginLoadError;
|
|
21
|
+
private updatePluginDiagnostic;
|
|
22
|
+
private buildPluginInfo;
|
|
23
|
+
private teardownPluginRuntime;
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ResttyManagedAppPane } from "../pane-app-manager";
|
|
2
|
+
import type { ResttyRenderStageHandle } from "../restty-plugin-types";
|
|
3
|
+
import type { ResttyShaderStage } from "../../runtime/types";
|
|
4
|
+
type ResttyShaderOpsDeps = {
|
|
5
|
+
getPanes: () => ResttyManagedAppPane[];
|
|
6
|
+
getPaneById: (id: number) => ResttyManagedAppPane | null;
|
|
7
|
+
};
|
|
8
|
+
export declare class ResttyShaderOps {
|
|
9
|
+
private readonly paneBaseShaderStages;
|
|
10
|
+
private readonly globalShaderStages;
|
|
11
|
+
private nextShaderStageOrder;
|
|
12
|
+
private readonly deps;
|
|
13
|
+
constructor(deps: ResttyShaderOpsDeps, shaderStages?: ResttyShaderStage[]);
|
|
14
|
+
setShaderStages(stages: ResttyShaderStage[]): void;
|
|
15
|
+
getShaderStages(): ResttyShaderStage[];
|
|
16
|
+
addShaderStage(stage: ResttyShaderStage): ResttyRenderStageHandle;
|
|
17
|
+
addManagedShaderStage(stage: ResttyShaderStage, ownerPluginId: string | null): ResttyRenderStageHandle;
|
|
18
|
+
removeShaderStage(id: string): boolean;
|
|
19
|
+
normalizePaneShaderStages(stages: ResttyShaderStage[] | undefined, paneId: number): ResttyShaderStage[];
|
|
20
|
+
setPaneBaseShaderStages(paneId: number, stages: ResttyShaderStage[]): void;
|
|
21
|
+
removePaneBaseShaderStages(paneId: number): void;
|
|
22
|
+
buildMergedShaderStages(baseStages: ResttyShaderStage[]): ResttyShaderStage[];
|
|
23
|
+
syncPaneShaderStages(paneId?: number): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
private listGlobalShaderStages;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { InputHandler, MouseMode } from "../input";
|
|
2
|
+
import type { GhosttyTheme } from "../theme";
|
|
3
|
+
import type { ResttyManagedAppPane } from "./pane-app-manager";
|
|
4
|
+
import type { ResttyShaderStage } from "../runtime/types";
|
|
5
|
+
/**
|
|
6
|
+
* Public API surface exposed by each pane handle.
|
|
7
|
+
*/
|
|
8
|
+
export type ResttyPaneApi = {
|
|
9
|
+
id: number;
|
|
10
|
+
setRenderer: (value: "auto" | "webgpu" | "webgl2") => void;
|
|
11
|
+
setPaused: (value: boolean) => void;
|
|
12
|
+
togglePause: () => void;
|
|
13
|
+
setFontSize: (value: number) => void;
|
|
14
|
+
applyTheme: (theme: GhosttyTheme, sourceLabel?: string) => void;
|
|
15
|
+
resetTheme: () => void;
|
|
16
|
+
sendInput: (text: string, source?: string) => void;
|
|
17
|
+
sendKeyInput: (text: string, source?: string) => void;
|
|
18
|
+
clearScreen: () => void;
|
|
19
|
+
connectPty: (url?: string) => void;
|
|
20
|
+
disconnectPty: () => void;
|
|
21
|
+
isPtyConnected: () => boolean;
|
|
22
|
+
setMouseMode: (value: MouseMode) => void;
|
|
23
|
+
getMouseStatus: () => ReturnType<InputHandler["getMouseStatus"]>;
|
|
24
|
+
copySelectionToClipboard: () => Promise<boolean>;
|
|
25
|
+
pasteFromClipboard: () => Promise<boolean>;
|
|
26
|
+
dumpAtlasForCodepoint: (cp: number) => void;
|
|
27
|
+
resize: (cols: number, rows: number) => void;
|
|
28
|
+
focus: () => void;
|
|
29
|
+
blur: () => void;
|
|
30
|
+
updateSize: (force?: boolean) => void;
|
|
31
|
+
getBackend: () => string;
|
|
32
|
+
setShaderStages: (stages: ResttyShaderStage[]) => void;
|
|
33
|
+
getShaderStages: () => ResttyShaderStage[];
|
|
34
|
+
getRawPane: () => ResttyManagedAppPane;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Thin wrapper around a managed pane that delegates calls to the
|
|
38
|
+
* underlying app. Resolves the pane lazily so it stays valid across
|
|
39
|
+
* layout changes.
|
|
40
|
+
*/
|
|
41
|
+
export declare class ResttyPaneHandle implements ResttyPaneApi {
|
|
42
|
+
private readonly resolvePane;
|
|
43
|
+
constructor(resolvePane: () => ResttyManagedAppPane);
|
|
44
|
+
get id(): number;
|
|
45
|
+
setRenderer(value: "auto" | "webgpu" | "webgl2"): void;
|
|
46
|
+
setPaused(value: boolean): void;
|
|
47
|
+
togglePause(): void;
|
|
48
|
+
setFontSize(value: number): void;
|
|
49
|
+
applyTheme(theme: GhosttyTheme, sourceLabel?: string): void;
|
|
50
|
+
resetTheme(): void;
|
|
51
|
+
sendInput(text: string, source?: string): void;
|
|
52
|
+
sendKeyInput(text: string, source?: string): void;
|
|
53
|
+
clearScreen(): void;
|
|
54
|
+
connectPty(url?: string): void;
|
|
55
|
+
disconnectPty(): void;
|
|
56
|
+
isPtyConnected(): boolean;
|
|
57
|
+
setMouseMode(value: MouseMode): void;
|
|
58
|
+
getMouseStatus(): ReturnType<InputHandler["getMouseStatus"]>;
|
|
59
|
+
copySelectionToClipboard(): Promise<boolean>;
|
|
60
|
+
pasteFromClipboard(): Promise<boolean>;
|
|
61
|
+
dumpAtlasForCodepoint(cp: number): void;
|
|
62
|
+
resize(cols: number, rows: number): void;
|
|
63
|
+
focus(): void;
|
|
64
|
+
blur(): void;
|
|
65
|
+
updateSize(force?: boolean): void;
|
|
66
|
+
getBackend(): string;
|
|
67
|
+
setShaderStages(stages: ResttyShaderStage[]): void;
|
|
68
|
+
getShaderStages(): ResttyShaderStage[];
|
|
69
|
+
getRawPane(): ResttyManagedAppPane;
|
|
70
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ResttyShaderStage } from "../runtime/types";
|
|
2
|
+
import type { ResttyInterceptorOptions, ResttyPlugin, ResttyPluginEvents, ResttyPluginInfo, ResttyPluginRequires } from "./restty-plugin-types";
|
|
3
|
+
export type ResttyPluginRuntimeDisposerKind = "event" | "input-interceptor" | "output-interceptor" | "lifecycle-hook" | "render-hook" | "render-stage";
|
|
4
|
+
export type ResttyPluginRuntimeDisposer = {
|
|
5
|
+
kind: ResttyPluginRuntimeDisposerKind;
|
|
6
|
+
active: boolean;
|
|
7
|
+
dispose: () => void;
|
|
8
|
+
};
|
|
9
|
+
export type ResttyPluginRuntime = {
|
|
10
|
+
plugin: ResttyPlugin;
|
|
11
|
+
cleanup: (() => void) | null;
|
|
12
|
+
activatedAt: number;
|
|
13
|
+
options: unknown;
|
|
14
|
+
disposers: Array<ResttyPluginRuntimeDisposer>;
|
|
15
|
+
};
|
|
16
|
+
export type ResttyPluginDiagnostic = {
|
|
17
|
+
id: string;
|
|
18
|
+
version: string | null;
|
|
19
|
+
apiVersion: number | null;
|
|
20
|
+
requires: ResttyPluginRequires | null;
|
|
21
|
+
active: boolean;
|
|
22
|
+
activatedAt: number | null;
|
|
23
|
+
lastError: string | null;
|
|
24
|
+
};
|
|
25
|
+
export type ResttyRegisteredInterceptor<T extends (payload: unknown) => unknown> = {
|
|
26
|
+
id: number;
|
|
27
|
+
pluginId: string;
|
|
28
|
+
priority: number;
|
|
29
|
+
order: number;
|
|
30
|
+
interceptor: T;
|
|
31
|
+
};
|
|
32
|
+
export type ResttyManagedShaderStage = {
|
|
33
|
+
id: string;
|
|
34
|
+
stage: ResttyShaderStage;
|
|
35
|
+
order: number;
|
|
36
|
+
ownerPluginId: string | null;
|
|
37
|
+
};
|
|
38
|
+
export type ResttyInterceptorSeq = {
|
|
39
|
+
nextId: number;
|
|
40
|
+
nextOrder: number;
|
|
41
|
+
};
|
|
42
|
+
export declare function registerPluginInterceptor<T extends (payload: unknown) => unknown>(bucket: Array<ResttyRegisteredInterceptor<T>>, pluginId: string, interceptor: T, options: ResttyInterceptorOptions | undefined, seq: ResttyInterceptorSeq): {
|
|
43
|
+
dispose: () => void;
|
|
44
|
+
nextId: number;
|
|
45
|
+
nextOrder: number;
|
|
46
|
+
};
|
|
47
|
+
export declare function applyPluginInterceptors<TPayload extends {
|
|
48
|
+
text: string;
|
|
49
|
+
}>(bucket: Array<ResttyRegisteredInterceptor<(payload: TPayload) => string | null | void>>, kind: "input" | "output", payload: TPayload): string | null;
|
|
50
|
+
export declare function runPluginHooks<TPayload>(bucket: Array<ResttyRegisteredInterceptor<(payload: TPayload) => void>>, kind: "lifecycle" | "render", payload: TPayload): void;
|
|
51
|
+
export declare function attachRuntimeDisposer(runtime: ResttyPluginRuntime, kind: ResttyPluginRuntimeDisposerKind, dispose: () => void): () => void;
|
|
52
|
+
export declare function teardownPluginRuntime(runtime: ResttyPluginRuntime): void;
|
|
53
|
+
export declare function setPluginLoadError(pluginDiagnostics: Map<string, ResttyPluginDiagnostic>, pluginId: string, message: string): void;
|
|
54
|
+
export declare function patchPluginDiagnostic(pluginDiagnostics: Map<string, ResttyPluginDiagnostic>, pluginId: string, patch: Partial<Pick<ResttyPluginDiagnostic, "active" | "activatedAt" | "lastError">>): void;
|
|
55
|
+
export declare function buildPluginInfo(pluginId: string, pluginDiagnostics: Map<string, ResttyPluginDiagnostic>, pluginRuntimes: Map<string, ResttyPluginRuntime>): ResttyPluginInfo | null;
|
|
56
|
+
export declare function onPluginEvent<E extends keyof ResttyPluginEvents>(pluginListeners: Map<keyof ResttyPluginEvents, Set<(payload: unknown) => void>>, event: E, listener: (payload: ResttyPluginEvents[E]) => void): () => void;
|
|
57
|
+
export declare function emitPluginEvent<E extends keyof ResttyPluginEvents>(pluginListeners: Map<keyof ResttyPluginEvents, Set<(payload: unknown) => void>>, event: E, payload: ResttyPluginEvents[E]): void;
|