77
88import type Base64Decoder from 'xterm-wasm-parts/lib/base64/Base64Decoder.wasm' ;
99
10- /**
11- * Kitty graphics protocol action types.
12- * See: https://sw.kovidgoyal.net/kitty/graphics-protocol/#control-data-reference under key 'a'.
13- */
10+ // Kitty graphics protocol action types.
11+ // See: https://sw.kovidgoyal.net/kitty/graphics-protocol/#control-data-reference under key 'a'.
1412export const enum KittyAction {
1513 TRANSMIT = 't' ,
1614 TRANSMIT_DISPLAY = 'T' ,
@@ -19,29 +17,23 @@ export const enum KittyAction {
1917 DELETE = 'd'
2018}
2119
22- /**
23- * Kitty graphics protocol format types.
24- * See: https://sw.kovidgoyal.net/kitty/graphics-protocol/#control-data-reference
25- */
20+ // Kitty graphics protocol format types.
21+ // See: https://sw.kovidgoyal.net/kitty/graphics-protocol/#control-data-reference
2622export const enum KittyFormat {
2723 RGB = 24 ,
2824 RGBA = 32 ,
2925 PNG = 100
3026}
3127
32- /**
33- * Kitty graphics protocol compression types.
34- * See: https://sw.kovidgoyal.net/kitty/graphics-protocol/#control-data-reference under key 'o'.
35- */
28+ // Kitty graphics protocol compression types.
29+ // See: https://sw.kovidgoyal.net/kitty/graphics-protocol/#control-data-reference under key 'o'.
3630export const enum KittyCompression {
3731 NONE = '' ,
3832 ZLIB = 'z'
3933}
4034
41- /**
42- * Kitty graphics protocol control data keys.
43- * See: https://sw.kovidgoyal.net/kitty/graphics-protocol/#control-data-reference
44- */
35+ // Kitty graphics protocol control data keys.
36+ // See: https://sw.kovidgoyal.net/kitty/graphics-protocol/#control-data-reference
4537export const enum KittyKey {
4638 // Action to perform (t=transmit, T=transmit+display, q=query, p=placement, d=delete)
4739 ACTION = 'a' ,
@@ -86,9 +78,7 @@ export const BYTES_PER_PIXEL_RGB = 3;
8678export const BYTES_PER_PIXEL_RGBA = 4 ;
8779export const ALPHA_OPAQUE = 255 ;
8880
89- /**
90- * Parsed Kitty graphics command.
91- */
81+ // Parsed Kitty graphics command.
9282export interface IKittyCommand {
9383 action ?: string ;
9484 format ?: number ;
@@ -111,37 +101,31 @@ export interface IKittyCommand {
111101 payload ?: string ;
112102}
113103
114- /**
115- * Pending chunked transmission state.
116- * Stores metadata from the first chunk while accumulating decoded payload data.
117- */
104+ // Pending chunked transmission state.
105+ // Stores metadata from the first chunk while accumulating decoded payload data.
118106export interface IPendingTransmission {
119- /** The parsed command from the first chunk (contains action, format, dimensions, etc.) */
107+ // The parsed command from the first chunk (contains action, format, dimensions, etc.)
120108 cmd : IKittyCommand ;
121- /** Decoder used across chunked payloads */
109+ // Decoder used across chunked payloads
122110 decoder : Base64Decoder ;
123- /** Total encoded (base64) bytes received across all chunks - for size limit enforcement */
111+ // Total encoded (base64) bytes received across all chunks - for size limit enforcement
124112 totalEncodedSize : number ;
125- /** Whether any chunk has failed to decode */
113+ // Whether any chunk has failed to decode
126114 decodeError : boolean ;
127115}
128116
129- /**
130- * Stored Kitty image data.
131- */
117+ // Stored Kitty image data.
132118export interface IKittyImageData {
133119 id : number ;
134- /** Decoded image data stored as Blob (off JS heap) to avoid 2GB heap limit */
120+ // Decoded image data stored as Blob (off JS heap) to avoid 2GB heap limit
135121 data : Blob ;
136122 width : number ;
137123 height : number ;
138124 format : 24 | 32 | 100 ;
139125 compression ?: string ;
140126}
141127
142- /**
143- * Parses Kitty graphics control data into a command object.
144- */
128+ // Parses Kitty graphics control data into a command object.
145129export function parseKittyCommand ( data : string ) : IKittyCommand {
146130 const cmd : IKittyCommand = { } ;
147131 const parts = data . split ( ',' ) ;
0 commit comments