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.
Files changed (53) hide show
  1. package/README.md +4 -9
  2. package/dist/app/atlas-builder.d.ts +38 -0
  3. package/dist/app/font-sources.d.ts +2 -0
  4. package/dist/app/pane-app-manager.d.ts +43 -0
  5. package/dist/app/panes-context-menu.d.ts +10 -0
  6. package/dist/app/panes-styles.d.ts +5 -0
  7. package/dist/app/panes-types.d.ts +89 -0
  8. package/dist/app/panes.d.ts +10 -0
  9. package/dist/app/restty.d.ts +20 -0
  10. package/dist/app/session.d.ts +6 -0
  11. package/dist/app/types.d.ts +123 -0
  12. package/dist/{app/index.js → chunk-53vdvhe3.js} +24014 -23787
  13. package/dist/fonts/manager.d.ts +24 -0
  14. package/dist/fonts/nerd-constraints.d.ts +4 -0
  15. package/dist/fonts/nerd-ranges.d.ts +2 -0
  16. package/dist/fonts/types.d.ts +51 -0
  17. package/dist/grid/grid.d.ts +22 -0
  18. package/dist/grid/types.d.ts +32 -0
  19. package/dist/ime/ime.d.ts +13 -0
  20. package/dist/ime/types.d.ts +8 -0
  21. package/dist/input/ansi.d.ts +3 -0
  22. package/dist/input/mouse.d.ts +10 -0
  23. package/dist/input/output.d.ts +11 -0
  24. package/dist/input/types.d.ts +7 -0
  25. package/dist/internal.js +105 -56213
  26. package/dist/pty/kitty-media.d.ts +3 -0
  27. package/dist/pty/pty.d.ts +11 -0
  28. package/dist/pty/types.d.ts +49 -0
  29. package/dist/renderer/box-drawing-map.d.ts +4 -0
  30. package/dist/renderer/shaders.d.ts +7 -0
  31. package/dist/renderer/shapes.d.ts +42 -1
  32. package/dist/renderer/types.d.ts +43 -0
  33. package/dist/renderer/webgpu.d.ts +11 -0
  34. package/dist/restty.js +20 -0
  35. package/dist/selection/selection.d.ts +24 -0
  36. package/dist/selection/types.d.ts +13 -0
  37. package/dist/theme/catalog.d.ts +5 -0
  38. package/dist/theme/ghostty.d.ts +18 -0
  39. package/dist/unicode/ghostty-symbol-ranges.d.ts +1 -0
  40. package/dist/unicode/symbols.d.ts +6 -0
  41. package/dist/wasm/embedded.d.ts +1 -0
  42. package/dist/wasm/runtime.d.ts +29 -0
  43. package/package.json +8 -61
  44. package/dist/fonts/index.js +0 -5332
  45. package/dist/grid/index.js +0 -71
  46. package/dist/ime/index.js +0 -84
  47. package/dist/index.js +0 -56210
  48. package/dist/input/index.js +0 -1047
  49. package/dist/pty/index.js +0 -338
  50. package/dist/renderer/index.js +0 -1612
  51. package/dist/selection/index.js +0 -226
  52. package/dist/theme/index.js +0 -11218
  53. package/dist/wasm/index.js +0 -6003
@@ -3,86 +3,182 @@ import type { PtyTransport } from "../pty";
3
3
  import type { WebGPUCoreState } from "../renderer";
4
4
  import type { GhosttyTheme } from "../theme";
5
5
  import type { ResttyWasm } from "../wasm";
6
+ /** Callback for WASM log messages. */
6
7
  export type ResttyWasmLogListener = (message: string) => void;
8
+ /**
9
+ * Session provider that supplies shared WASM and WebGPU resources.
10
+ */
7
11
  export type ResttyAppSession = {
12
+ /** Lazily initialize and return the WASM module. */
8
13
  getWasm: () => Promise<ResttyWasm>;
14
+ /** Lazily initialize and return the WebGPU renderer core for a canvas. */
9
15
  getWebGPUCore: (canvas: HTMLCanvasElement) => Promise<WebGPUCoreState | null>;
16
+ /** Subscribe to WASM log output. */
10
17
  addWasmLogListener?: (listener: ResttyWasmLogListener) => void;
18
+ /** Unsubscribe from WASM log output. */
11
19
  removeWasmLogListener?: (listener: ResttyWasmLogListener) => void;
12
20
  };
21
+ /**
22
+ * Optional DOM elements for debug/status displays.
23
+ */
13
24
  export type ResttyAppElements = {
25
+ /** Renderer backend name display. */
14
26
  backendEl?: HTMLElement | null;
27
+ /** Frames-per-second counter display. */
15
28
  fpsEl?: HTMLElement | null;
29
+ /** Device pixel ratio display. */
16
30
  dprEl?: HTMLElement | null;
31
+ /** Canvas pixel size display. */
17
32
  sizeEl?: HTMLElement | null;
33
+ /** Grid column/row count display. */
18
34
  gridEl?: HTMLElement | null;
35
+ /** Cell pixel dimensions display. */
19
36
  cellEl?: HTMLElement | null;
37
+ /** Terminal size (cols x rows) display. */
20
38
  termSizeEl?: HTMLElement | null;
39
+ /** Cursor position display. */
21
40
  cursorPosEl?: HTMLElement | null;
41
+ /** Input sequence debug display. */
22
42
  inputDebugEl?: HTMLElement | null;
43
+ /** General debug text display. */
23
44
  dbgEl?: HTMLElement | null;
45
+ /** PTY connection status display. */
24
46
  ptyStatusEl?: HTMLElement | null;
47
+ /** Mouse mode/status display. */
25
48
  mouseStatusEl?: HTMLElement | null;
49
+ /** Terminal internal debug display. */
26
50
  termDebugEl?: HTMLElement | null;
51
+ /** Scrollable log output display. */
27
52
  logEl?: HTMLElement | null;
53
+ /** Glyph atlas info display. */
28
54
  atlasInfoEl?: HTMLElement | null;
55
+ /** Canvas element for atlas visualization. */
29
56
  atlasCanvas?: HTMLCanvasElement | null;
30
57
  };
58
+ /**
59
+ * Callbacks fired by the app when internal state changes.
60
+ */
31
61
  export type ResttyAppCallbacks = {
62
+ /** A log line was emitted. */
32
63
  onLog?: (line: string) => void;
64
+ /** Renderer backend was determined. */
33
65
  onBackend?: (backend: string) => void;
66
+ /** Frame rate updated. */
34
67
  onFps?: (fps: number) => void;
68
+ /** Device pixel ratio changed. */
35
69
  onDpr?: (dpr: number) => void;
70
+ /** Canvas pixel dimensions changed. */
36
71
  onCanvasSize?: (width: number, height: number) => void;
72
+ /** Grid size (cols x rows) changed. */
37
73
  onGridSize?: (cols: number, rows: number) => void;
74
+ /** Cell pixel dimensions changed. */
38
75
  onCellSize?: (cellW: number, cellH: number) => void;
76
+ /** Terminal size (cols x rows) changed. */
39
77
  onTermSize?: (cols: number, rows: number) => void;
78
+ /** Cursor position changed. */
40
79
  onCursor?: (col: number, row: number) => void;
80
+ /** General debug text updated. */
41
81
  onDebug?: (text: string) => void;
82
+ /** Input sequence debug text updated. */
42
83
  onInputDebug?: (text: string) => void;
84
+ /** PTY connection status changed. */
43
85
  onPtyStatus?: (status: string) => void;
86
+ /** Mouse mode/status changed. */
44
87
  onMouseStatus?: (status: string) => void;
45
88
  };
89
+ /** Raw font data as an ArrayBuffer or typed-array view. */
46
90
  export type ResttyFontBufferData = ArrayBuffer | ArrayBufferView;
91
+ /** Font source loaded from a URL. */
47
92
  export type ResttyUrlFontSource = {
48
93
  type: "url";
94
+ /** URL to fetch the font file from. */
49
95
  url: string;
96
+ /** Human-readable label for debug/log output. */
50
97
  label?: string;
51
98
  };
99
+ /** Font source loaded from an in-memory buffer. */
52
100
  export type ResttyBufferFontSource = {
53
101
  type: "buffer";
102
+ /** Raw font file bytes. */
54
103
  data: ResttyFontBufferData;
104
+ /** Human-readable label for debug/log output. */
55
105
  label?: string;
56
106
  };
107
+ /** Font source resolved from locally installed fonts via the Local Font Access API. */
57
108
  export type ResttyLocalFontSource = {
58
109
  type: "local";
110
+ /** Font family name patterns to match against installed fonts. */
59
111
  matchers: string[];
112
+ /** Human-readable label for debug/log output. */
60
113
  label?: string;
114
+ /** If true, font loading fails when no local match is found. */
61
115
  required?: boolean;
62
116
  };
117
+ /**
118
+ * A font source specification.
119
+ * - url: fetched from a URL
120
+ * - buffer: provided as in-memory bytes
121
+ * - local: resolved from locally installed fonts
122
+ */
63
123
  export type ResttyFontSource = ResttyUrlFontSource | ResttyBufferFontSource | ResttyLocalFontSource;
124
+ /** Alias for ResttyFontSource. */
64
125
  export type FontSource = ResttyFontSource;
126
+ /**
127
+ * Built-in font preset.
128
+ * - default-cdn: load the default font from CDN
129
+ * - none: do not load any preset fonts
130
+ */
65
131
  export type ResttyFontPreset = "default-cdn" | "none";
132
+ /**
133
+ * Touch-based text selection behavior.
134
+ * - drag: immediate drag-selection on touch
135
+ * - long-press: selection starts after a long-press timeout
136
+ * - off: disable touch selection entirely
137
+ */
66
138
  export type ResttyTouchSelectionMode = "drag" | "long-press" | "off";
139
+ /**
140
+ * Options for creating a ResttyApp instance.
141
+ */
67
142
  export type ResttyAppOptions = {
143
+ /** Target canvas element for terminal rendering. */
68
144
  canvas: HTMLCanvasElement;
145
+ /** Shared session for WASM/WebGPU resource reuse across panes. */
69
146
  session?: ResttyAppSession;
147
+ /** Hidden textarea for IME composition input. */
70
148
  imeInput?: HTMLTextAreaElement | null;
149
+ /** Optional DOM elements for debug/status displays. */
71
150
  elements?: ResttyAppElements;
151
+ /** Callbacks for state-change notifications. */
72
152
  callbacks?: ResttyAppCallbacks;
153
+ /** Renderer backend preference (default "auto"). */
73
154
  renderer?: "auto" | "webgpu" | "webgl2";
155
+ /** Font size in CSS pixels. */
74
156
  fontSize?: number;
157
+ /**
158
+ * Alpha blending strategy.
159
+ * - native: GPU-native premultiplied alpha
160
+ * - linear: linear-space blending
161
+ * - linear-corrected: linear-space with gamma correction
162
+ */
75
163
  alphaBlending?: "native" | "linear" | "linear-corrected";
164
+ /** Built-in font preset to load. */
76
165
  fontPreset?: ResttyFontPreset;
166
+ /** Custom font sources to load. */
77
167
  fontSources?: ResttyFontSource[];
168
+ /** Maximum scale factor for the symbol atlas texture. */
78
169
  maxSymbolAtlasScale?: number;
170
+ /** Per-glyph scale overrides matched by regex. */
79
171
  fontScaleOverrides?: {
80
172
  match: RegExp;
81
173
  scale: number;
82
174
  }[];
175
+ /** Scale factor applied to Nerd Font icons. */
83
176
  nerdIconScale?: number;
177
+ /** Automatically resize the terminal on container/window changes (default true). */
84
178
  autoResize?: boolean;
179
+ /** Attach resize/focus listeners to the window object. */
85
180
  attachWindowEvents?: boolean;
181
+ /** Attach pointer/keyboard listeners to the canvas. */
86
182
  attachCanvasEvents?: boolean;
87
183
  /**
88
184
  * Touch selection behavior on pointerType=touch:
@@ -101,30 +197,57 @@ export type ResttyAppOptions = {
101
197
  * canceled and touch pan-scroll takes priority.
102
198
  */
103
199
  touchSelectionMoveThresholdPx?: number;
200
+ /** Expose internal state on the window object for debugging. */
104
201
  debugExpose?: boolean;
202
+ /** PTY transport layer for terminal I/O. */
105
203
  ptyTransport?: PtyTransport;
106
204
  };
205
+ /**
206
+ * Public API for a terminal app instance.
207
+ */
107
208
  export type ResttyApp = {
209
+ /** Initialize the renderer, fonts, and terminal state. */
108
210
  init: () => Promise<void>;
211
+ /** Tear down all resources and event listeners. */
109
212
  destroy: () => void;
213
+ /** Switch the renderer backend at runtime. */
110
214
  setRenderer: (value: "auto" | "webgpu" | "webgl2") => void;
215
+ /** Pause or resume rendering. */
111
216
  setPaused: (value: boolean) => void;
217
+ /** Toggle the rendering pause state. */
112
218
  togglePause: () => void;
219
+ /** Update the terminal font size in CSS pixels. */
113
220
  setFontSize: (value: number) => void;
221
+ /** Replace the active font sources and reload fonts. */
114
222
  setFontSources: (sources: ResttyFontSource[]) => Promise<void>;
223
+ /** Apply a Ghostty color theme. */
115
224
  applyTheme: (theme: GhosttyTheme, sourceLabel?: string) => void;
225
+ /** Reset colors to the default theme. */
116
226
  resetTheme: () => void;
227
+ /** Write raw text to the terminal PTY. */
117
228
  sendInput: (text: string, source?: string) => void;
229
+ /** Encode and send a key sequence to the terminal PTY. */
118
230
  sendKeyInput: (text: string, source?: string) => void;
231
+ /** Clear the visible screen and scrollback. */
119
232
  clearScreen: () => void;
233
+ /** Open a PTY connection, optionally to a specific URL. */
120
234
  connectPty: (url?: string) => void;
235
+ /** Close the active PTY connection. */
121
236
  disconnectPty: () => void;
237
+ /** Check whether the PTY transport is currently connected. */
122
238
  isPtyConnected: () => boolean;
239
+ /** Override the mouse reporting mode. */
123
240
  setMouseMode: (value: MouseMode) => void;
241
+ /** Return current mouse reporting status. */
124
242
  getMouseStatus: () => ReturnType<InputHandler["getMouseStatus"]>;
243
+ /** Copy the current text selection to the clipboard. */
125
244
  copySelectionToClipboard: () => Promise<boolean>;
245
+ /** Paste clipboard contents into the terminal. */
126
246
  pasteFromClipboard: () => Promise<boolean>;
247
+ /** Dump the glyph atlas entry for a given Unicode codepoint. */
127
248
  dumpAtlasForCodepoint: (cp: number) => void;
249
+ /** Recalculate terminal dimensions from the canvas size. */
128
250
  updateSize: (force?: boolean) => void;
251
+ /** Return the name of the active renderer backend. */
129
252
  getBackend: () => string;
130
253
  };