@opentui/core 0.5.17 → 0.6.1

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 (92) hide show
  1. package/NativeScene.d.ts +185 -0
  2. package/NativeSession.d.ts +134 -0
  3. package/NativeSpanFeed.d.ts +1 -4
  4. package/README.md +5 -3
  5. package/Renderable.d.ts +162 -67
  6. package/animation/Timeline.d.ts +11 -1
  7. package/assets/typescriptreact/highlights.scm +758 -0
  8. package/assets/typescriptreact/tree-sitter-tsx.wasm +0 -0
  9. package/buffer.d.ts +76 -36
  10. package/chunk-bun-wsqkxxm5.js +12523 -0
  11. package/chunk-bun-wsqkxxm5.js.map +35 -0
  12. package/chunk-bun-ww65h9av.js +24868 -0
  13. package/chunk-bun-ww65h9av.js.map +69 -0
  14. package/chunk-node-f7c1g447.js +12503 -0
  15. package/chunk-node-f7c1g447.js.map +34 -0
  16. package/chunk-node-jh6t3wnm.js +24867 -0
  17. package/chunk-node-jh6t3wnm.js.map +69 -0
  18. package/edit-buffer.d.ts +23 -20
  19. package/editor-view.d.ts +13 -5
  20. package/image.d.ts +18 -7
  21. package/index.bun.js +2385 -2898
  22. package/index.bun.js.map +20 -22
  23. package/index.d.ts +6 -2
  24. package/index.node.js +2385 -2898
  25. package/index.node.js.map +20 -24
  26. package/lib/buffer-access.d.ts +6 -0
  27. package/lib/clipboard.d.ts +0 -9
  28. package/lib/extmarks.d.ts +4 -1
  29. package/lib/tree-sitter/parsers-config.d.ts +9 -9
  30. package/native-abi.generated.d.ts +5500 -0
  31. package/node-assets.js +6 -2
  32. package/node-assets.js.map +3 -3
  33. package/package.json +11 -12
  34. package/parser.worker.js +14 -2
  35. package/parser.worker.js.map +3 -3
  36. package/platform/runtime.d.ts +0 -1
  37. package/renderables/ASCIIFont.d.ts +5 -5
  38. package/renderables/Box.d.ts +8 -8
  39. package/renderables/Code.d.ts +6 -2
  40. package/renderables/Diff.d.ts +4 -2
  41. package/renderables/EditBufferRenderable.d.ts +8 -10
  42. package/renderables/EmbeddedTerminal.d.ts +4 -2
  43. package/renderables/FrameBuffer.d.ts +3 -1
  44. package/renderables/Image.d.ts +3 -1
  45. package/renderables/Input.d.ts +0 -5
  46. package/renderables/LineNumberRenderable.d.ts +3 -1
  47. package/renderables/Markdown.d.ts +5 -2
  48. package/renderables/ScrollBar.d.ts +7 -1
  49. package/renderables/ScrollBox.d.ts +4 -6
  50. package/renderables/Select.d.ts +2 -1
  51. package/renderables/Slider.d.ts +7 -5
  52. package/renderables/TabSelect.d.ts +2 -1
  53. package/renderables/Text.d.ts +5 -4
  54. package/renderables/TextBufferRenderable.d.ts +10 -9
  55. package/renderables/TextNode.d.ts +8 -0
  56. package/renderables/TextTable.d.ts +1 -1
  57. package/renderables/Textarea.d.ts +1 -1
  58. package/renderables/index.d.ts +1 -1
  59. package/renderer.d.ts +90 -67
  60. package/session-buffer.d.ts +4 -0
  61. package/syntax-style.d.ts +9 -7
  62. package/testing/harness.d.ts +33 -0
  63. package/testing/manual-clock.d.ts +2 -0
  64. package/testing/test-renderer.d.ts +3 -0
  65. package/testing/test-streams.d.ts +20 -2
  66. package/testing.bun.js +60 -49
  67. package/testing.bun.js.map +6 -6
  68. package/testing.js +60 -49
  69. package/testing.js.map +6 -6
  70. package/tests/native-log-worker-child.d.ts +1 -0
  71. package/tests/native-symbol-stubs.d.ts +5 -0
  72. package/tests/yoga-callback-boundary-child.d.ts +1 -0
  73. package/tests/yoga-default-config-worker-child.d.ts +1 -0
  74. package/text-buffer-view.d.ts +11 -4
  75. package/text-buffer.d.ts +24 -9
  76. package/types.d.ts +4 -4
  77. package/yoga.bun.js +6 -2
  78. package/yoga.bun.js.map +1 -1
  79. package/yoga.d.ts +91 -56
  80. package/yoga.internal.d.ts +78 -0
  81. package/yoga.js +6 -2
  82. package/yoga.js.map +1 -1
  83. package/zig-structs.d.ts +13 -98
  84. package/zig.d.ts +1305 -583
  85. package/chunk-bun-6rvkxs1v.js +0 -18862
  86. package/chunk-bun-6rvkxs1v.js.map +0 -64
  87. package/chunk-bun-h3ggawd9.js +0 -10533
  88. package/chunk-bun-h3ggawd9.js.map +0 -32
  89. package/chunk-node-kc1sqq2a.js +0 -10532
  90. package/chunk-node-kc1sqq2a.js.map +0 -32
  91. package/chunk-node-tfvyz31s.js +0 -18844
  92. package/chunk-node-tfvyz31s.js.map +0 -63
package/zig.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { type FFICallbackInstance, type Pointer } from "./platform/ffi.js";
2
- import { type CursorStyle, type CursorStyleOptions, type SelectionOccupancy, type SelectionBehavior, type TargetChannel, type DebugOverlayCorner, type WidthMethod, type TerminalCapabilities, type Highlight, type LineInfo, type ImageRenderProtocol } from "./types.js";
1
+ import { type FFICallbackInstance, type Pointer, type PointerInput } from "./platform/ffi.js";
2
+ import { type CursorStyle, type CursorStyleOptions, type SelectionOccupancy, type SelectionBehavior, type DebugOverlayCorner, type WidthMethod, type TerminalCapabilities, type Highlight, type LineInfo, type MousePointerStyle, type ImageRenderProtocol } from "./types.js";
3
3
  export type { LineInfo, AllocatorStats, AudioStreamCreateOptions, BuildOptions, NativeAudioCaptureStats, NativeAudioStreamStats, NativeRenderStats, };
4
4
  import { RGBA } from "./lib/RGBA.js";
5
- import { OptimizedBuffer } from "./buffer.js";
6
- import { TextBuffer } from "./text-buffer.js";
5
+ import { type StyledText } from "./lib/styled-text.js";
6
+ import { type MeasureFunction } from "./yoga.js";
7
+ import { YogaHost } from "./yoga.internal.js";
7
8
  import type { NativeSpanFeedOptions, NativeSpanFeedStats, ReserveInfo, AudioCreateOptions, AudioStartOptions, AudioVoiceOptions, AudioStreamCreateOptions, NativeAudioStreamCloseReason as NativeAudioStreamCloseReasonType, NativeAudioStreamFormat as NativeAudioStreamFormatType, NativeAudioStreamState as NativeAudioStreamStateType, NativeAudioStreamStats, NativeAudioCaptureStats, AudioStats, BuildOptions, AllocatorStats, NativeRenderStats, NativeImageInfo } from "./zig-structs.js";
8
9
  export declare const NativeAudioStreamState: {
9
10
  readonly Initializing: 0;
@@ -27,21 +28,648 @@ export declare const NativeAudioStreamFormat: {
27
28
  readonly Pcm: 3;
28
29
  };
29
30
  export type NativeAudioStreamFormat = NativeAudioStreamFormatType;
30
- export declare const MAX_LINK_URL_BYTES = 512;
31
31
  export type NativeHandle<T extends string> = Pointer & {
32
32
  readonly __nativeHandle: T;
33
33
  };
34
- export type RendererHandle = NativeHandle<"renderer">;
35
- export type OptimizedBufferHandle = NativeHandle<"optimized_buffer">;
36
- export type TextBufferHandle = NativeHandle<"text_buffer">;
37
- export type TextBufferViewHandle = NativeHandle<"text_buffer_view">;
38
- export type EditBufferHandle = NativeHandle<"edit_buffer">;
39
- export type EditorViewHandle = NativeHandle<"editor_view">;
40
- export type SyntaxStyleHandle = NativeHandle<"syntax_style">;
41
- export type EventSinkHandle = NativeHandle<"event_sink">;
34
+ declare const nativeContextBrand: unique symbol;
35
+ export type NativeContextHandle = {
36
+ readonly [nativeContextBrand]: true;
37
+ };
38
+ /** Native hyperlink URL slot bound. Longer URLs fail allocation. */
39
+ export declare const MAX_LINK_URL_BYTES = 512;
40
+ export interface NativeContextOptions {
41
+ objectCapacity: number;
42
+ renderCellsMax: number;
43
+ }
44
+ export interface ContextObjectHandle {
45
+ readonly context: NativeContextHandle;
46
+ readonly contextId: bigint;
47
+ readonly slot: number;
48
+ readonly generation: number;
49
+ }
50
+ declare const contextResourceBrand: unique symbol;
51
+ export type SessionHandle = ContextObjectHandle & {
52
+ readonly [contextResourceBrand]: "session";
53
+ };
54
+ export type ContextBufferHandle = ContextObjectHandle & {
55
+ readonly [contextResourceBrand]: "buffer";
56
+ };
57
+ export type SceneNodeHandle = ContextObjectHandle & {
58
+ readonly [contextResourceBrand]: "scene_node";
59
+ };
60
+ export type ContextEditBufferHandle = ContextObjectHandle & {
61
+ readonly [contextResourceBrand]: "edit_buffer";
62
+ };
63
+ export type ContextEditorViewHandle = ContextObjectHandle & {
64
+ readonly [contextResourceBrand]: "editor_view";
65
+ };
66
+ export type ContextSyntaxStyleHandle = ContextObjectHandle & {
67
+ readonly [contextResourceBrand]: "syntax_style";
68
+ };
69
+ export type ContextTextBufferHandle = ContextObjectHandle & {
70
+ readonly [contextResourceBrand]: "text_buffer";
71
+ };
72
+ export type ContextTextBufferViewHandle = ContextObjectHandle & {
73
+ readonly [contextResourceBrand]: "text_buffer_view";
74
+ };
75
+ export type ContextImageHandle = ContextObjectHandle & {
76
+ readonly [contextResourceBrand]: "image";
77
+ };
78
+ export type ContextImagePixelsHandle = ContextObjectHandle & {
79
+ readonly [contextResourceBrand]: "image_pixels";
80
+ };
81
+ export type ContextUnicodeHandle = ContextObjectHandle & {
82
+ readonly [contextResourceBrand]: "unicode";
83
+ };
84
+ export type ContextEmbeddedTerminalHandle = ContextObjectHandle & {
85
+ readonly [contextResourceBrand]: "embedded_terminal";
86
+ };
87
+ export type SessionBuffer = "current" | "next";
88
+ export interface NativeContextEditBufferOptions {
89
+ widthMethod?: WidthMethod | "no-zwj";
90
+ }
91
+ export interface NativeEditBufferInfo {
92
+ contentEpoch: bigint;
93
+ byteLength: number;
94
+ lineCount: number;
95
+ cursor: LogicalCursor;
96
+ canUndo: boolean;
97
+ canRedo: boolean;
98
+ tabWidth: number;
99
+ }
100
+ export interface NativeTextBufferInfo {
101
+ contentEpoch: bigint;
102
+ byteLength: number;
103
+ textLength: number;
104
+ lineCount: number;
105
+ highlightCount: number;
106
+ tabWidth: number;
107
+ }
108
+ export interface NativeEncodedStyledText {
109
+ bytes: Uint8Array;
110
+ records: Uint32Array;
111
+ count: number;
112
+ urlBytes: Uint8Array;
113
+ }
114
+ export declare enum NativeTextViewCommand {
115
+ WrapWidth = 0,
116
+ WrapMode = 1,
117
+ FirstLineOffset = 2,
118
+ TabIndicator = 3,
119
+ Truncate = 4,
120
+ TextAlign = 5
121
+ }
122
+ export declare enum NativeEditCommand {
123
+ DeleteForward = 0,
124
+ Backspace = 1,
125
+ NewLine = 2,
126
+ DeleteLine = 3,
127
+ MoveLeft = 4,
128
+ MoveRight = 5,
129
+ MoveUp = 6,
130
+ MoveDown = 7,
131
+ GotoLine = 8,
132
+ CursorOffset = 9,
133
+ Clear = 10,
134
+ ClearHistory = 11,
135
+ DebugRope = 12
136
+ }
137
+ export declare enum NativeEditPositionQuery {
138
+ Cursor = 0,
139
+ NextWord = 1,
140
+ PrevWord = 2,
141
+ Eol = 3,
142
+ Offset = 4,
143
+ Coords = 5,
144
+ LineStart = 6
145
+ }
146
+ export declare enum NativeEditorStyleMask {
147
+ Foreground = 1,
148
+ Background = 2,
149
+ Attributes = 4,
150
+ All = 7
151
+ }
152
+ export interface NativeEditorStyle {
153
+ fg?: RGBA | null;
154
+ bg?: RGBA | null;
155
+ attributes?: number | null;
156
+ }
157
+ export declare enum NativeEditHighlightOperation {
158
+ AddLine = 0,
159
+ AddRange = 1,
160
+ RemoveRef = 2,
161
+ ClearLine = 3,
162
+ ClearAll = 4
163
+ }
164
+ export interface NativeEditorViewport {
165
+ x: number;
166
+ y: number;
167
+ width: number;
168
+ height: number;
169
+ }
170
+ export declare enum NativeEditorCommand {
171
+ MoveUp = 0,
172
+ MoveDown = 1,
173
+ GotoLineEnd = 2,
174
+ DeleteSelection = 3,
175
+ CursorOffset = 4,
176
+ WrapMode = 5,
177
+ TabIndicator = 6
178
+ }
179
+ export declare enum NativeEditorSelectionOperation {
180
+ Set = 0,
181
+ Update = 1,
182
+ Reset = 2,
183
+ Local = 3,
184
+ LocalUpdate = 4,
185
+ LocalReset = 5,
186
+ Cell = 6,
187
+ Occupancy = 7,
188
+ Inclusive = 8,
189
+ Colors = 9
190
+ }
191
+ export interface NativeEditorSelection {
192
+ operation: NativeEditorSelectionOperation;
193
+ behavior?: number;
194
+ start?: number;
195
+ end?: number;
196
+ anchorX?: number;
197
+ anchorY?: number;
198
+ focusX?: number;
199
+ focusY?: number;
200
+ updateCursor?: boolean;
201
+ followCursor?: boolean;
202
+ fg?: RGBA | null;
203
+ bg?: RGBA | null;
204
+ }
205
+ export interface NativeEditorViewInfo {
206
+ virtualLineCount: number;
207
+ totalVirtualLineCount: number;
208
+ selection: {
209
+ start: number;
210
+ end: number;
211
+ } | null;
212
+ selectionOccupancy: SelectionOccupancy;
213
+ }
214
+ export declare enum NativeEditorPositionQuery {
215
+ Cursor = 0,
216
+ NextWord = 1,
217
+ PrevWord = 2,
218
+ Eol = 3,
219
+ VisualSol = 4,
220
+ VisualEol = 5
221
+ }
222
+ export declare enum NativeEditEvent {
223
+ CursorChanged = 1,
224
+ ContentChanged = 2,
225
+ HistoryCursorChanged = 4
226
+ }
227
+ export type NativeEditEventName = "cursor-changed" | "content-changed" | "cursorChanged";
228
+ export interface NativeSceneEditorOptions {
229
+ showCursor: boolean;
230
+ style: "block" | "line" | "underline" | "default";
231
+ blinking: boolean;
232
+ color: RGBA;
233
+ cursor?: MousePointerStyle;
234
+ }
235
+ export interface NativeEditorReplacement {
236
+ deleted: boolean;
237
+ inserted: boolean;
238
+ }
239
+ export interface NativeSceneBoxDetails {
240
+ title?: string;
241
+ bottomTitle?: string;
242
+ titleAlignment: "left" | "center" | "right";
243
+ bottomTitleAlignment: "left" | "center" | "right";
244
+ titleColor?: RGBA;
245
+ customBorderChars?: Uint32Array;
246
+ }
247
+ export interface NativeScenePaint {
248
+ zIndex: number;
249
+ opacity: number;
250
+ translateX: number;
251
+ translateY: number;
252
+ border: number;
253
+ shouldFill: boolean;
254
+ backgroundColor: RGBA;
255
+ borderColor: RGBA;
256
+ borderStyle: "single" | "double" | "rounded" | "heavy";
257
+ focusable: boolean;
258
+ focusedBorderColor: RGBA;
259
+ }
260
+ export type NativeScenePaintUpdate = Partial<NativeScenePaint> & {
261
+ resetBorderCharacters?: true;
262
+ };
263
+ export declare const NATIVE_SCENE_MUTATIONS_MAX: 4096;
264
+ export declare enum NativeStyleGroup {
265
+ Enum,
266
+ Float,
267
+ Value,
268
+ Border,
269
+ Dimension
270
+ }
271
+ export declare enum NativeStyleFlags {
272
+ None,
273
+ DisableFlexShrink
274
+ }
275
+ /** ENUM/FLOAT/DIMENSION writes occupy this unused-edge slot. */
276
+ export declare const NATIVE_EDGE_NONE: 0;
277
+ export declare enum NativeBorder {
278
+ None,
279
+ Left,
280
+ Bottom,
281
+ Right,
282
+ Top,
283
+ All
284
+ }
285
+ export interface NativeSceneLayout {
286
+ left: number;
287
+ top: number;
288
+ right: number;
289
+ bottom: number;
290
+ width: number;
291
+ height: number;
292
+ screenX: number;
293
+ screenY: number;
294
+ }
295
+ export interface NativeSceneFrameOptions {
296
+ background: RGBA;
297
+ useMouse: boolean;
298
+ excludedHitNum: number;
299
+ maxLayoutRounds: number;
300
+ maxHostRequests: number;
301
+ preserveUnwritten?: boolean;
302
+ }
303
+ export declare enum NativeSceneHook {
304
+ Update,
305
+ Resize,
306
+ LayoutChanged,
307
+ RenderBefore,
308
+ RenderAfter,
309
+ RenderSelf,
310
+ IdleUpdate
311
+ }
312
+ export declare enum NativeSceneFrame {
313
+ Done,
314
+ Update,
315
+ Resize,
316
+ LayoutChanged,
317
+ Record,
318
+ Yield
319
+ }
320
+ export declare enum NativeScenePaintPhase {
321
+ Before,
322
+ Self,
323
+ After
324
+ }
325
+ /** One node whose paint hooks a RECORD request asks the host to record, in paint order. */
326
+ export interface NativeScenePaintSlot {
327
+ readonly node: SceneNodeHandle;
328
+ readonly num: number;
329
+ /** RenderBefore, RenderSelf, and RenderAfter hook bits to record. */
330
+ readonly hooks: number;
331
+ readonly opacity: number;
332
+ readonly paintLayout: NativeSceneLayout;
333
+ readonly publicLayout?: NativeSceneLayout;
334
+ }
335
+ /** An issued request. Pass it back unchanged; geometry is observation, not acknowledgement authority. */
336
+ export interface NativeSceneFrameRequest {
337
+ readonly session: SessionHandle;
338
+ readonly root: SceneNodeHandle;
339
+ readonly node: SceneNodeHandle;
340
+ readonly frameId: bigint;
341
+ readonly requestId: bigint;
342
+ readonly layoutEpoch: bigint;
343
+ readonly hookGeneration: bigint;
344
+ readonly kind: NativeSceneFrame;
345
+ readonly num: number;
346
+ readonly width: number;
347
+ readonly height: number;
348
+ paintLayout?: NativeSceneLayout;
349
+ publicLayout?: NativeSceneLayout;
350
+ /** Host observation revision; never part of native ticket authority. */
351
+ geometryRevision?: number;
352
+ }
353
+ export interface NativeSplitSnapshot {
354
+ snapshot: ContextBufferHandle;
355
+ rowColumns: number;
356
+ startOnNewLine: boolean;
357
+ trailingNewline: boolean;
358
+ }
359
+ export type NativeSessionSplitControl = {
360
+ kind: "reset";
361
+ seedRows: number;
362
+ pinnedRenderOffset: number;
363
+ } | {
364
+ kind: "sync";
365
+ pinnedRenderOffset: number;
366
+ } | {
367
+ kind: "output-offset";
368
+ surfaceOffset: number;
369
+ } | {
370
+ kind: "render-offset";
371
+ renderOffset: number;
372
+ } | {
373
+ kind: "transition";
374
+ mode: "viewport-scroll" | "clear-stale-rows";
375
+ sourceTopLine: number;
376
+ sourceHeight: number;
377
+ targetTopLine: number;
378
+ targetHeight: number;
379
+ scrollLines?: number;
380
+ } | {
381
+ kind: "clear-transition";
382
+ };
383
+ export interface NativeSceneTextOptions {
384
+ fg: RGBA;
385
+ bg: RGBA;
386
+ attributes: number;
387
+ wrapMode: "none" | "char" | "word";
388
+ textAlign: "left" | "center" | "right";
389
+ truncate: boolean;
390
+ scrollX: number;
391
+ scrollY: number;
392
+ firstLineOffset: number;
393
+ tabIndicator?: string | number;
394
+ tabIndicatorColor?: RGBA;
395
+ }
396
+ export interface NativeBufferGrid {
397
+ borderChars: Uint32Array;
398
+ borderFg: RGBA;
399
+ borderBg: RGBA;
400
+ columnOffsets: Int32Array;
401
+ rowOffsets: Int32Array;
402
+ drawInner: boolean;
403
+ drawOuter: boolean;
404
+ }
405
+ export interface NativeBufferStack {
406
+ operation: "getOpacity" | "pushScissor" | "popScissor" | "clearScissors" | "pushOpacity" | "popOpacity" | "clearOpacity";
407
+ x?: number;
408
+ y?: number;
409
+ width?: number;
410
+ height?: number;
411
+ opacity?: number;
412
+ }
413
+ export type NativeDrawingTarget = {
414
+ readonly context: NativeContextHandle;
415
+ readonly target: ContextBufferHandle;
416
+ readonly frame: null;
417
+ } | {
418
+ readonly context: NativeContextHandle;
419
+ readonly target: SessionHandle;
420
+ readonly frame: NativeSceneFrameRequest;
421
+ };
422
+ type BufferDrawPosition = {
423
+ x?: number;
424
+ y?: number;
425
+ };
426
+ type BufferDrawColors = {
427
+ foreground?: RGBA;
428
+ background?: RGBA;
429
+ };
430
+ export type NativeBufferDraw = {
431
+ operation: "clear";
432
+ background?: RGBA;
433
+ } | (BufferDrawPosition & {
434
+ operation: "fill";
435
+ width?: number;
436
+ height?: number;
437
+ background?: RGBA;
438
+ }) | (BufferDrawPosition & BufferDrawColors & {
439
+ operation: "text";
440
+ text?: string;
441
+ attributes?: number;
442
+ }) | (BufferDrawPosition & BufferDrawColors & {
443
+ operation: "cell" | "cellBlend" | "char";
444
+ char?: number;
445
+ attributes?: number;
446
+ }) | (BufferDrawPosition & BufferDrawColors & {
447
+ operation: "box";
448
+ width?: number;
449
+ height?: number;
450
+ titleColor?: RGBA;
451
+ packedOptions?: number;
452
+ borderChars?: Uint32Array;
453
+ text?: string;
454
+ bottomTitle?: string;
455
+ }) | (BufferDrawPosition & {
456
+ operation: "compose";
457
+ source: ContextBufferHandle;
458
+ sourceX?: number;
459
+ sourceY?: number;
460
+ sourceWidth?: number;
461
+ sourceHeight?: number;
462
+ }) | {
463
+ operation: "respectAlpha";
464
+ enabled: boolean;
465
+ };
466
+ export interface NativeContextImageDraw {
467
+ x?: number;
468
+ y?: number;
469
+ width: number;
470
+ height: number;
471
+ pixelWidth?: number;
472
+ pixelHeight?: number;
473
+ sourceX?: number;
474
+ sourceY?: number;
475
+ sourceWidth?: number;
476
+ sourceHeight?: number;
477
+ protocol?: ImageRenderProtocol;
478
+ }
479
+ export interface NativeSceneTextSelectionOptions {
480
+ operation: "reset" | "set" | "update";
481
+ anchorX: number;
482
+ anchorY: number;
483
+ focusX: number;
484
+ focusY: number;
485
+ behavior: SelectionBehavior;
486
+ bg?: RGBA;
487
+ fg?: RGBA;
488
+ }
489
+ export interface NativeSceneTextMetrics {
490
+ byteLength: number;
491
+ textLength: number;
492
+ lineCount: number;
493
+ virtualLineCount: number;
494
+ widthColsMax: number;
495
+ }
496
+ export interface NativeSceneSliderOptions {
497
+ orientation: "horizontal" | "vertical";
498
+ min: number;
499
+ max: number;
500
+ value: number;
501
+ viewPortSize: number;
502
+ foregroundColor: RGBA;
503
+ backgroundColor: RGBA;
504
+ }
505
+ export interface NativeSceneArrowOptions {
506
+ direction: "up" | "down" | "left" | "right";
507
+ attributes: number;
508
+ foregroundColor: RGBA;
509
+ backgroundColor: RGBA;
510
+ text?: string;
511
+ }
512
+ export interface NativeSessionBufferLease {
513
+ handle: ContextObjectHandle;
514
+ width: number;
515
+ height: number;
516
+ generation: bigint;
517
+ char: Pointer;
518
+ fg: Pointer;
519
+ bg: Pointer;
520
+ attributes: Pointer;
521
+ }
522
+ export type NativeContextBufferLease = NativeSessionBufferLease;
523
+ export interface NativeContextBufferOptions {
524
+ width: number;
525
+ height: number;
526
+ widthMethod?: WidthMethod | "no-zwj";
527
+ respectAlpha?: boolean;
528
+ }
529
+ export declare const NATIVE_BUFFER_TEXT_BYTES_MAX: 65536;
530
+ export interface NativeSessionOptions {
531
+ chunkSize: number;
532
+ spanCapacity: number;
533
+ maxBytes: bigint;
534
+ controlCapacity?: number;
535
+ }
536
+ export interface NativeOutputTicket {
537
+ session: SessionHandle;
538
+ requestId: bigint;
539
+ byteCount: number;
540
+ }
541
+ export declare enum NativeSessionState {
542
+ Open = 0,
543
+ Closing = 1,
544
+ Closed = 2,
545
+ Failed = 3,
546
+ Cancelled = 4
547
+ }
548
+ export interface NativeSessionRendererOptions {
549
+ width: number;
550
+ height: number;
551
+ /** Omitted selects native auto detection, which ignores host hints when remote. */
552
+ remote?: boolean;
553
+ /** Initialization-only copied host hints: at most 256 entries and 65536 encoded bytes. */
554
+ environment?: Readonly<Record<string, string>>;
555
+ }
556
+ export declare enum NativeSessionRenderStatus {
557
+ Presented = 0,
558
+ Pending = 1,
559
+ Skipped = 2,
560
+ Failed = 3
561
+ }
562
+ export interface NativeSessionRendererState {
563
+ width: number;
564
+ height: number;
565
+ frameCount: bigint;
566
+ framePending: boolean;
567
+ }
568
+ export interface NativeSessionKittyImageTransportStatus {
569
+ requested: number;
570
+ effective: number;
571
+ fileState: number;
572
+ fallback: number;
573
+ pendingFiles: number;
574
+ pendingBytes: number;
575
+ }
576
+ export declare const NATIVE_SESSION_CONTROL_PACKET_BYTES: 4096;
577
+ export interface NativeSessionTerminalOptions {
578
+ useAlternateScreen?: boolean;
579
+ mouse?: boolean;
580
+ mouseMovement?: boolean;
581
+ kittyKeyboardFlags?: number;
582
+ clearOnClose?: boolean;
583
+ }
584
+ export declare enum NativeSessionTerminalPhase {
585
+ Uninitialized = 0,
586
+ SettingUp = 1,
587
+ Active = 2,
588
+ Suspending = 3,
589
+ Suspended = 4,
590
+ Resuming = 5,
591
+ Closing = 6,
592
+ Restored = 7,
593
+ Failed = 8,
594
+ Cancelled = 9
595
+ }
596
+ export declare enum NativeSessionPumpStatus {
597
+ Idle = 0,
598
+ Again = 1,
599
+ OutputPending = 2,
600
+ WaitUntil = 3,
601
+ Closed = 4
602
+ }
603
+ export interface NativeSessionPumpResult {
604
+ status: NativeSessionPumpStatus;
605
+ deadlineNs: bigint | null;
606
+ }
607
+ export type NativeSessionControl = {
608
+ kind: "capability-response";
609
+ bytes: Uint8Array;
610
+ } | {
611
+ kind: "palette-query";
612
+ bytes: Uint8Array;
613
+ } | {
614
+ kind: "title";
615
+ title: string;
616
+ } | {
617
+ kind: "mouse";
618
+ mode: "disabled" | "drag" | "motion";
619
+ } | {
620
+ kind: "kitty-keyboard-flags";
621
+ flags: number;
622
+ } | {
623
+ kind: "restore-modes" | "query-pixel-resolution" | "query-theme-colors" | "reset-background";
624
+ };
625
+ export interface NativeSessionCursorOptions extends CursorStyleOptions {
626
+ position?: {
627
+ x: number;
628
+ y: number;
629
+ visible: boolean;
630
+ };
631
+ }
632
+ export interface NativeSessionCapabilities extends TerminalCapabilities {
633
+ kittyKeyboardFlags: number;
634
+ }
635
+ export declare enum NativeStatus {
636
+ Ok = 0,
637
+ InvalidArgument = -1,
638
+ UnsupportedVersion = -2,
639
+ OutOfMemory = -3,
640
+ WrongThread = -4,
641
+ InternalError = -5,
642
+ ContextBusy = -6,
643
+ WrongContext = -7,
644
+ WrongKind = -8,
645
+ StaleHandle = -9,
646
+ WrongSession = -10,
647
+ OutputBackpressure = -11,
648
+ SessionClosed = -12,
649
+ OutputBusy = -13,
650
+ StaleOutput = -14,
651
+ OutputFailed = -15,
652
+ ObjectLimit = -16,
653
+ RendererAttached = -17,
654
+ RendererNotAttached = -18,
655
+ InvalidPhase = -19,
656
+ ControlPacketLimit = -20,
657
+ LeaseLimit = -21,
658
+ LeaseBytesLimit = -22,
659
+ StaleLease = -23,
660
+ UnsupportedResource = -24,
661
+ StaleFrame = -25,
662
+ LayoutLimit = -26,
663
+ FrameBusy = -27,
664
+ FrameRequestLimit = -28
665
+ }
666
+ export declare class NativeError extends Error {
667
+ readonly operation: string;
668
+ readonly status: NativeStatus;
669
+ constructor(operation: string, status: NativeStatus);
670
+ }
42
671
  export type AudioEngineHandle = NativeHandle<"audio_engine">;
43
- export type NativeRenderableHandle = NativeHandle<"native_renderable">;
44
- export type ImageHandle = NativeHandle<"image">;
672
+ export type ImageHandle = ContextImageHandle;
45
673
  export type ClipboardServiceHandle = number & {
46
674
  readonly __nativeHandle: "clipboard_service";
47
675
  };
@@ -49,49 +677,48 @@ export type ClipboardOperationHandle = number & {
49
677
  readonly __nativeHandle: "clipboard_operation";
50
678
  };
51
679
  export declare enum NativeClipboardOperationStatus {
52
- Pending = 0,
53
- Read = 1,
54
- Empty = 2,
55
- Written = 3,
56
- Cleared = 4,
57
- Unsupported = 5,
58
- Cancelled = 6,
59
- TimedOut = 7,
60
- LimitExceeded = 8,
61
- Failed = 9,
62
- InvalidHandle = 10
680
+ Pending,
681
+ Read,
682
+ Empty,
683
+ Written,
684
+ Cleared,
685
+ Unsupported,
686
+ Cancelled,
687
+ TimedOut,
688
+ LimitExceeded,
689
+ Failed,
690
+ InvalidHandle
63
691
  }
64
692
  export declare enum NativeClipboardStartStatus {
65
- Ok = 0,
66
- InvalidService = 1,
67
- ShuttingDown = 2,
68
- LimitExceeded = 3,
69
- InvalidArgument = 4,
70
- OutOfMemory = 5
693
+ Ok,
694
+ InvalidService,
695
+ ShuttingDown,
696
+ LimitExceeded,
697
+ InvalidArgument,
698
+ OutOfMemory
71
699
  }
72
700
  export declare enum NativeClipboardCancelStatus {
73
- Requested = 0,
74
- AlreadyTerminal = 1,
75
- InvalidHandle = 2
701
+ Requested,
702
+ AlreadyTerminal,
703
+ InvalidHandle
76
704
  }
77
705
  export declare enum NativeClipboardCopyStatus {
78
- Ok = 0,
79
- BufferTooSmall = 1,
80
- InvalidHandle = 2,
81
- InvalidState = 3,
82
- InvalidArgument = 4
706
+ Ok,
707
+ BufferTooSmall,
708
+ InvalidHandle,
709
+ InvalidState,
710
+ InvalidArgument
83
711
  }
84
712
  export declare enum NativeClipboardDestroyStatus {
85
- Destroyed = 0,
86
- NotReady = 1,
87
- InvalidHandle = 2
713
+ Destroyed,
714
+ NotReady,
715
+ InvalidHandle
88
716
  }
89
717
  export declare enum NativeClipboardShutdownStatus {
90
- Pending = 0,
91
- Ready = 1,
92
- InvalidHandle = 2
718
+ Pending,
719
+ Ready,
720
+ InvalidHandle
93
721
  }
94
- export type EmbeddedTerminalHandle = NativeHandle<"embedded_terminal">;
95
722
  export type EmbeddedTerminalCursor = {
96
723
  x: number;
97
724
  y: number;
@@ -123,6 +750,131 @@ export type EmbeddedTerminalMouse = {
123
750
  y: number;
124
751
  anyButtonPressed?: boolean;
125
752
  };
753
+ declare const SCENE_NODE_KINDS: readonly ["root", "box", "text", "slider", "arrow", "editor", "custom", "text_view", "image"];
754
+ /** One ordered property stream, stored in native wire layout. Visual writes coalesce
755
+ * at the node's latest visual record; last write wins per field. New or changed
756
+ * translations only merge into the last record so prepared coordinates observe
757
+ * preceding ancestor translations. Layout writes stay ordered because Yoga
758
+ * shorthand/edge and dimension/flex-shrink operations can overlap. There are no
759
+ * reads or callbacks between records. A successful flush ends coalescing.
760
+ *
761
+ * Records occupy their packed size, so a background-only or style batch is already
762
+ * the borrowed bytes. Merging extra visual fields grows that record and shifts later
763
+ * ones. Scratch snapshots caller getters before publication, including under reentry. */
764
+ export declare class SceneStaging {
765
+ static readonly limit: 4096;
766
+ private words;
767
+ private readonly paintBySlot;
768
+ private readonly packScratch;
769
+ private readonly styleValue;
770
+ private readonly styleValueWords;
771
+ private context?;
772
+ private readonly contextId;
773
+ private readonly contextWords;
774
+ private borrowed;
775
+ private entryCount;
776
+ private encodedWords;
777
+ private lastBase;
778
+ private runBase;
779
+ private paintScratch;
780
+ constructor(initialCapacity?: number);
781
+ get pending(): boolean;
782
+ get count(): number;
783
+ get byteLength(): number;
784
+ get full(): boolean;
785
+ static checkStyleValue(group: number, value: number): number;
786
+ private assertWritable;
787
+ /** Returns the node's staged visual record, if any. */
788
+ private checkHandle;
789
+ private bind;
790
+ private ensureWords;
791
+ /** Callers write every field word; only the trailing alignment word needs clearing. */
792
+ private reserve;
793
+ stageStyle(context: NativeContextHandle, node: SceneNodeHandle, group: number, kind: number, edge: number, unit: number, value: number, flags: number): boolean;
794
+ private writeStyle;
795
+ /**
796
+ * Whether Yoga certainly treats two staged values of one property as different. Undefined, auto
797
+ * and NaN values, and signed zeros, can compare equal under Yoga's rules, so they never qualify.
798
+ */
799
+ private stylesDiffer;
800
+ /**
801
+ * Coalesces consecutive writes to one node property. The stream keeps a run of two records only
802
+ * while Yoga certainly sees their values as different, and the newest value stays last. Yoga then
803
+ * marks the node dirty, as some write in the original run would have, and ends with the same
804
+ * value. Any write that cannot keep that guarantee is appended instead. Returns false to append.
805
+ */
806
+ private rewriteStyleRun;
807
+ stageBackground(context: NativeContextHandle, node: SceneNodeHandle, color: RGBA, owner?: {
808
+ assertMutable(): void;
809
+ }): boolean;
810
+ stagePaint(context: NativeContextHandle, node: SceneNodeHandle, paint: NativeScenePaintUpdate, owner?: {
811
+ assertMutable(): void;
812
+ }): boolean;
813
+ private publishPaint;
814
+ private packedFieldEquals;
815
+ private writePackedFields;
816
+ private mergePackedPaint;
817
+ /** @internal Borrow until consume() acknowledges the native prefix. */
818
+ _views(context: NativeContextHandle): Uint32Array;
819
+ clear(): void;
820
+ /** Never replay the accepted prefix. Remaining records stay in wire layout. An invalid
821
+ * acknowledgement still ends the borrow, so staging stays writable. */
822
+ consume(applied: number): void;
823
+ discard(node: SceneNodeHandle): void;
824
+ private reindex;
825
+ }
826
+ /** Encodes paint hooks into the ot_scene_record stream that acknowledges one RECORD request.
827
+ * Recorded commands draw when native code paints the frame, not when a hook calls them. */
828
+ export declare class NativePaintRecorder {
829
+ private buffer;
830
+ private bytes;
831
+ private words;
832
+ private signed;
833
+ private floats;
834
+ private colors;
835
+ private length;
836
+ private context;
837
+ private window;
838
+ private readonly releases;
839
+ private pendingSlot;
840
+ private pendingPhase;
841
+ private readonly opacity;
842
+ private scissors;
843
+ private textBytes?;
844
+ private bottomBytes?;
845
+ private readonly handleRecord;
846
+ begin(context: NativeContextHandle): void;
847
+ /** Stop recording. Deferred releases wait for settle(). */
848
+ end(): void;
849
+ /** Run deferred releases after the frame step that consumed the recording. */
850
+ settle(): void;
851
+ /** The encoded stream, or null when nothing was recorded. Valid until the next begin(). */
852
+ get recording(): Uint8Array | null;
853
+ /** Start one slot phase. Its SLOT record is written only if the phase draws. */
854
+ slot(slot: number, phase: NativeScenePaintPhase, opacity: number): void;
855
+ get currentOpacity(): number;
856
+ draw(options: NativeBufferDraw): void;
857
+ stack(options: NativeBufferStack): number;
858
+ grid(options: NativeBufferGrid): void;
859
+ packed(data: Uint8Array | PointerInput, byteLength: number, x: number, y: number, width: number, height: number): void;
860
+ supersample(data: Uint8Array | PointerInput, byteLength: number, x: number, y: number, format: "rgba8unorm" | "bgra8unorm", stride: number): void;
861
+ grayscale(data: Float32Array, x: number, y: number, width: number, height: number, foreground: RGBA | null, background: RGBA | null, supersampled: boolean): void;
862
+ colorMatrix(matrix: Float32Array, mask: Float32Array | null, strength: number, channel: number): void;
863
+ /** Draw a text-buffer view, editor view, or scene text node. */
864
+ view(operation: "text" | "editor" | "scene", source: ContextObjectHandle, x: number, y: number): void;
865
+ image(source: ContextImageHandle, options: NativeContextImageDraw): void;
866
+ unicode(source: ContextUnicodeHandle, index: number, x: number, y: number, foreground: RGBA, background: RGBA, attributes: number): void;
867
+ /** Runs one encoder. A call that throws leaves no partial record or slot header, so the hook can recover. */
868
+ private transaction;
869
+ private activeContext;
870
+ private encodeHandle;
871
+ /** Append one zeroed record of at most size bytes and return its offset. */
872
+ private reserve;
873
+ private append;
874
+ /** Shrink a record reserved with an upper bound to its encoded end. */
875
+ private finish;
876
+ private grow;
877
+ }
126
878
  export declare enum LogLevel {
127
879
  Error = 0,
128
880
  Warn = 1,
@@ -161,15 +913,6 @@ export interface CursorState {
161
913
  }
162
914
  export type NativeSpanFeedEventHandler = (eventId: number, arg0: Pointer, arg1: number | bigint) => void;
163
915
  export type NativeBufferedOutput = "stdout" | "memory";
164
- export interface NativeRendererCreateOptions {
165
- remote?: boolean;
166
- feedPtr?: Pointer | null;
167
- bufferedOutput?: NativeBufferedOutput;
168
- }
169
- export interface NativeRenderOperationResult {
170
- renderOffset: number;
171
- status: number;
172
- }
173
916
  export interface NativeYogaLayout {
174
917
  left: number;
175
918
  top: number;
@@ -180,595 +923,574 @@ export interface NativeYogaLayout {
180
923
  }
181
924
  export type NativeYogaMeasureCallback = (node: Pointer | null, width: number, widthMode: number, height: number, heightMode: number) => void;
182
925
  export type NativeYogaDirtiedCallback = (node: Pointer | null) => void;
183
- export declare const NativeMeasureTargetKind: {
184
- readonly None: 0;
185
- readonly TextBufferView: 1;
186
- readonly EditorView: 2;
187
- };
188
- export type NativeMeasureTargetKind = (typeof NativeMeasureTargetKind)[keyof typeof NativeMeasureTargetKind];
189
- export type NativeMeasureTargetHandle = TextBufferViewHandle | EditorViewHandle;
190
- export interface AudioEngineLib {
191
- createAudioEngine: (options?: AudioCreateOptions | null) => AudioEngineHandle | null;
192
- destroyAudioEngine: (engine: AudioEngineHandle) => void;
193
- audioRefreshPlaybackDevices: (engine: AudioEngineHandle) => number;
194
- audioGetPlaybackDeviceCount: (engine: AudioEngineHandle) => number;
195
- audioGetPlaybackDeviceName: (engine: AudioEngineHandle, index: number) => string;
196
- audioIsPlaybackDeviceDefault: (engine: AudioEngineHandle, index: number) => boolean;
197
- audioSelectPlaybackDevice: (engine: AudioEngineHandle, index: number) => number;
198
- audioClearPlaybackDeviceSelection: (engine: AudioEngineHandle) => void;
199
- audioRefreshCaptureDevices: (engine: AudioEngineHandle) => number;
200
- audioGetCaptureDeviceCount: (engine: AudioEngineHandle) => number;
201
- audioGetCaptureDeviceName: (engine: AudioEngineHandle, index: number) => string;
202
- audioIsCaptureDeviceDefault: (engine: AudioEngineHandle, index: number) => boolean;
203
- audioSelectCaptureDevice: (engine: AudioEngineHandle, index: number) => number;
204
- audioClearCaptureDeviceSelection: (engine: AudioEngineHandle) => void;
205
- audioStartCapture: (engine: AudioEngineHandle, options: AudioStartOptions | undefined, channels: number, capacityFrames: number) => number;
206
- audioStopCapture: (engine: AudioEngineHandle) => number;
207
- audioIsCaptureRunning: (engine: AudioEngineHandle) => boolean;
208
- audioReadCapture: (engine: AudioEngineHandle, outBuffer: Float32Array, frameCount: number) => {
209
- status: number;
210
- framesRead: number;
211
- };
212
- audioGetCaptureStats: (engine: AudioEngineHandle) => {
213
- status: number;
214
- stats: NativeAudioCaptureStats | null;
215
- };
216
- audioStart: (engine: AudioEngineHandle, options?: AudioStartOptions | null) => number;
217
- audioStartMixer: (engine: AudioEngineHandle) => number;
218
- audioStop: (engine: AudioEngineHandle) => number;
219
- audioCreateStream: (engine: AudioEngineHandle, options: AudioStreamCreateOptions) => {
220
- status: number;
221
- streamId: number | null;
222
- };
223
- audioWriteStream: (engine: AudioEngineHandle, streamId: number, data: Uint8Array) => number;
224
- audioEndStream: (engine: AudioEngineHandle, streamId: number) => number;
225
- audioRestartStream: (engine: AudioEngineHandle, streamId: number) => number;
226
- audioSetStreamVolume: (engine: AudioEngineHandle, streamId: number, volume: number) => number;
227
- audioSetStreamPan: (engine: AudioEngineHandle, streamId: number, pan: number) => number;
228
- audioSetStreamGroup: (engine: AudioEngineHandle, streamId: number, groupId: number) => number;
229
- audioGetStreamStats: (engine: AudioEngineHandle, streamId: number) => NativeAudioStreamStats | null;
230
- audioCloseStream: (engine: AudioEngineHandle, streamId: number, reason: NativeAudioStreamCloseReason) => {
231
- status: number;
232
- stats: NativeAudioStreamStats | null;
233
- };
234
- audioLoad: (engine: AudioEngineHandle, data: Uint8Array) => {
235
- status: number;
236
- soundId: number | null;
237
- };
238
- audioUnload: (engine: AudioEngineHandle, soundId: number) => number;
239
- audioPlay: (engine: AudioEngineHandle, soundId: number, options?: AudioVoiceOptions) => {
240
- status: number;
241
- voiceId: number | null;
926
+ export interface AudioEngineLib extends Pick<FFIRenderLib, Extract<keyof FFIRenderLib, `audio${string}` | "createAudioEngine" | "destroyAudioEngine">> {
927
+ }
928
+ export type RenderLib = Pick<FFIRenderLib, keyof FFIRenderLib>;
929
+ export declare class FFIRenderLib {
930
+ private bufferDrawRecord;
931
+ private sceneLayoutRecord;
932
+ private sceneFrameRecord;
933
+ private scenePaintSlots;
934
+ private sceneCreateRecord;
935
+ private sceneDestroyHandle;
936
+ private sceneMoveRecord;
937
+ private sceneHooksRecord;
938
+ private sceneFlushApplied;
939
+ private editorSelectionRecord;
940
+ private readonly editorViewInfoRecord;
941
+ private readonly selectionResetRecord;
942
+ private readonly localSelectionResetRecord;
943
+ private readonly selectionResetChanged;
944
+ private readonly hitTestOutput;
945
+ private readonly bufferStackInput;
946
+ private readonly bufferStackOutput;
947
+ private drawTextBytes;
948
+ private drawBottomBytes;
949
+ private opentui;
950
+ private iccCacheClient;
951
+ private readonly yogaLayout;
952
+ private readonly yogaU32;
953
+ private readonly yogaF32;
954
+ private readonly yogaU64;
955
+ private yogaHost?;
956
+ private readonly ffiStructStorage;
957
+ private disposed;
958
+ private nativeContexts;
959
+ private contextEditEvents;
960
+ private sceneMeasures;
961
+ private clipboardServices;
962
+ private clipboardOperations;
963
+ private audioEngines;
964
+ private readonly invalidStandaloneHandle;
965
+ readonly encoder: TextEncoder;
966
+ private readonly emptyBytes;
967
+ readonly decoder: TextDecoder;
968
+ private logCallbackWrapper;
969
+ private diagnosticDrain?;
970
+ private nativeSpanFeedCallbackWrapper;
971
+ private nativeSpanFeedHandlers;
972
+ createContext(options: NativeContextOptions): NativeContextHandle;
973
+ private nativeContextPointer;
974
+ destroyContext(context: NativeContextHandle): void;
975
+ private releaseContext;
976
+ /** Destroys one Context object through the native destroy symbol of its kind. */
977
+ private destroyContextObject;
978
+ contextGetLinkUrl(context: NativeContextHandle, linkId: number): string;
979
+ createContextTextBuffer(context: NativeContextHandle, options?: NativeContextEditBufferOptions): ContextTextBufferHandle;
980
+ createContextUnicode(context: NativeContextHandle, text: string, widthMethod: WidthMethod | "no-zwj"): ContextUnicodeHandle;
981
+ sceneMeasureLayout(context: NativeContextHandle, session: SessionHandle, root: SceneNodeHandle): void;
982
+ sceneFrameCopyBuffer(context: NativeContextHandle, session: SessionHandle, frame: NativeSceneFrameRequest, target: ContextBufferHandle): void;
983
+ sessionRenderSplit(context: NativeContextHandle, session: SessionHandle, frame: NativeSceneFrameRequest | null, snapshots: readonly NativeSplitSnapshot[], pinnedRenderOffset: number, force: boolean): {
984
+ status: NativeSessionRenderStatus;
242
985
  };
243
- audioStopVoice: (engine: AudioEngineHandle, voiceId: number) => number;
244
- audioSetVoiceGroup: (engine: AudioEngineHandle, voiceId: number, groupId: number) => number;
245
- audioCreateGroup: (engine: AudioEngineHandle, name: string) => {
246
- status: number;
247
- groupId: number | null;
986
+ sessionSplitControl(context: NativeContextHandle, session: SessionHandle, command: NativeSessionSplitControl): number;
987
+ sessionSetScreen(context: NativeContextHandle, session: SessionHandle, alternate: boolean, width: number, height: number, trailingOutput?: Uint8Array): void;
988
+ sessionSyncDetached(context: NativeContextHandle, session: SessionHandle, parent: SessionHandle): void;
989
+ getContextUnicode(context: NativeContextHandle, unicode: ContextUnicodeHandle): Array<{
990
+ width: number;
991
+ char: number;
992
+ }>;
993
+ destroyContextUnicode(context: NativeContextHandle, unicode: ContextUnicodeHandle): void;
994
+ contextBufferDrawUnicode({ context, target, frame }: NativeDrawingTarget, unicode: ContextUnicodeHandle, index: number, x: number, y: number, foreground: RGBA, background: RGBA, attributes: number): void;
995
+ createContextEmbeddedTerminal(context: NativeContextHandle, options: {
996
+ cols: number;
997
+ rows: number;
998
+ maxScrollback?: number;
999
+ }): ContextEmbeddedTerminalHandle;
1000
+ destroyContextEmbeddedTerminal(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle): void;
1001
+ contextEmbeddedTerminalWrite(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle, data: string | Uint8Array): void;
1002
+ contextEmbeddedTerminalResize(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle, cols: number, rows: number): void;
1003
+ private contextTerminalCommand;
1004
+ contextEmbeddedTerminalInvalidate(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle): void;
1005
+ contextEmbeddedTerminalScroll(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle, delta: number): void;
1006
+ contextEmbeddedTerminalClearSelection(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle): void;
1007
+ contextEmbeddedTerminalSetTransparentBackground(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle, transparent: boolean): void;
1008
+ contextEmbeddedTerminalSetSelection(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle, start: {
1009
+ x: number;
1010
+ y: number;
1011
+ }, end: {
1012
+ x: number;
1013
+ y: number;
1014
+ }): void;
1015
+ private contextTerminalBytes;
1016
+ contextEmbeddedTerminalGetSelectedText(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle): Uint8Array;
1017
+ contextEmbeddedTerminalCompose({ context, target, frame }: NativeDrawingTarget, terminal: ContextEmbeddedTerminalHandle, x: number, y: number): void;
1018
+ contextEmbeddedTerminalCursor(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle): EmbeddedTerminalCursor;
1019
+ contextEmbeddedTerminalEncodeKey(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle, key: EmbeddedTerminalKey): Uint8Array;
1020
+ contextEmbeddedTerminalEncodeMouse(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle, mouse: EmbeddedTerminalMouse): Uint8Array;
1021
+ contextEmbeddedTerminalEncodePaste(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle, input: Uint8Array): Uint8Array;
1022
+ contextEmbeddedTerminalEncodeFocus(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle, focused: boolean): Uint8Array;
1023
+ private embeddedTerminalResponses;
1024
+ contextEmbeddedTerminalDrainResponses(context: NativeContextHandle, terminal: ContextEmbeddedTerminalHandle): Uint8Array;
1025
+ destroyContextTextBuffer(context: NativeContextHandle, text: ContextTextBufferHandle): void;
1026
+ createContextTextBufferView(context: NativeContextHandle, text: ContextTextBufferHandle): ContextTextBufferViewHandle;
1027
+ destroyContextTextBufferView(context: NativeContextHandle, view: ContextTextBufferViewHandle): void;
1028
+ contextTextBufferSetText(context: NativeContextHandle, text: ContextTextBufferHandle, bytes: Uint8Array): void;
1029
+ contextTextBufferAppend(context: NativeContextHandle, text: ContextTextBufferHandle, bytes: Uint8Array): void;
1030
+ contextTextBufferClear(context: NativeContextHandle, text: ContextTextBufferHandle, reset?: boolean): void;
1031
+ contextTextBufferSetStyledText(context: NativeContextHandle, text: ContextTextBufferHandle, content: StyledText): void;
1032
+ encodeTextBufferStyledText(content: StyledText): NativeEncodedStyledText;
1033
+ contextTextBufferSetEncodedStyledText(context: NativeContextHandle, text: ContextTextBufferHandle, encoded: NativeEncodedStyledText): void;
1034
+ contextTextBufferReplaceStyledBatch(context: NativeContextHandle, replacements: {
1035
+ buffer: ContextTextBufferHandle;
1036
+ view: ContextTextBufferViewHandle;
1037
+ text: NativeEncodedStyledText;
1038
+ }[], beforeNative: () => void): Uint32Array | null;
1039
+ contextTextBufferSetSyntaxStyle(context: NativeContextHandle, text: ContextTextBufferHandle, style: ContextSyntaxStyleHandle | null): void;
1040
+ contextTextBufferGetInfo(context: NativeContextHandle, text: ContextTextBufferHandle): NativeTextBufferInfo;
1041
+ private readText;
1042
+ contextTextBufferGetText(context: NativeContextHandle, text: ContextTextBufferHandle): string;
1043
+ contextTextBufferGetRange(context: NativeContextHandle, text: ContextTextBufferHandle, start: number, end: number): string;
1044
+ contextTextBufferSetDefaults(context: NativeContextHandle, text: ContextTextBufferHandle, mask: NativeEditorStyleMask, style: NativeEditorStyle): void;
1045
+ contextTextBufferSetTabWidth(context: NativeContextHandle, text: ContextTextBufferHandle, width: number): void;
1046
+ contextTextBufferHighlight(context: NativeContextHandle, text: ContextTextBufferHandle, operation: NativeEditHighlightOperation, argument?: number, highlight?: Highlight): void;
1047
+ contextTextBufferGetHighlights(context: NativeContextHandle, text: ContextTextBufferHandle, line: number): Highlight[];
1048
+ contextTextBufferViewSetViewport(context: NativeContextHandle, view: ContextTextBufferViewHandle, viewport: NativeEditorViewport, sizeOnly?: boolean): void;
1049
+ contextTextBufferViewCommand(context: NativeContextHandle, view: ContextTextBufferViewHandle, command: NativeTextViewCommand, argument: number): void;
1050
+ contextTextBufferViewSetTabColor(context: NativeContextHandle, view: ContextTextBufferViewHandle, color: RGBA | null): void;
1051
+ contextTextBufferViewSelect(context: NativeContextHandle, view: ContextTextBufferViewHandle, selection: NativeEditorSelection): boolean;
1052
+ /**
1053
+ * Resets read only the operation, so each uses one prepared record. Text view selection never calls back.
1054
+ * A reset of a view with no selection changes nothing, so `clear` skips the native call after the checks.
1055
+ */
1056
+ contextTextBufferViewResetSelection(context: NativeContextHandle, view: ContextTextBufferViewHandle, local: boolean, clear?: boolean): void;
1057
+ contextTextBufferViewGetInfo(context: NativeContextHandle, view: ContextTextBufferViewHandle): NativeEditorViewInfo;
1058
+ contextTextBufferViewGetSelectedText(context: NativeContextHandle, view: ContextTextBufferViewHandle): string;
1059
+ contextTextBufferViewGetLines(context: NativeContextHandle, view: ContextTextBufferViewHandle, logical?: boolean, firstLine?: number, lineCount?: number): LineInfo;
1060
+ contextTextBufferViewMeasure(context: NativeContextHandle, view: ContextTextBufferViewHandle, width: number, height: number): MeasureResult;
1061
+ sceneSetTextView(context: NativeContextHandle, node: SceneNodeHandle, view: ContextTextBufferViewHandle | null): void;
1062
+ sceneSetTextViewPaint(context: NativeContextHandle, node: SceneNodeHandle, enabled: boolean): void;
1063
+ contextDrawTextBufferView({ context, target, frame }: NativeDrawingTarget, view: ContextTextBufferViewHandle, x: number, y: number): void;
1064
+ contextDrawEditorView({ context, target, frame }: NativeDrawingTarget, view: ContextEditorViewHandle, x: number, y: number): void;
1065
+ contextDrawSceneText({ context, target, frame }: NativeDrawingTarget, node: SceneNodeHandle, x: number, y: number): void;
1066
+ createContextEditBuffer(context: NativeContextHandle, options?: NativeContextEditBufferOptions): ContextEditBufferHandle;
1067
+ destroyContextEditBuffer(context: NativeContextHandle, editBuffer: ContextEditBufferHandle): void;
1068
+ createContextEditorView(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, width: number, height: number): ContextEditorViewHandle;
1069
+ destroyContextEditorView(context: NativeContextHandle, view: ContextEditorViewHandle): void;
1070
+ createContextSyntaxStyle(context: NativeContextHandle): ContextSyntaxStyleHandle;
1071
+ destroyContextSyntaxStyle(context: NativeContextHandle, style: ContextSyntaxStyleHandle): void;
1072
+ contextEditBufferSetSyntaxStyle(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, style: ContextSyntaxStyleHandle | null): void;
1073
+ contextEditBufferSetText(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, bytes: Uint8Array, preserveHistory?: boolean): void;
1074
+ contextEditBufferInsertText(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, bytes: Uint8Array): void;
1075
+ contextEditBufferDeleteRange(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, startRow: number, startCol: number, endRow: number, endCol: number): void;
1076
+ contextEditBufferSetCursor(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, row: number, col: number): void;
1077
+ contextEditBufferGetText(context: NativeContextHandle, editBuffer: ContextEditBufferHandle): string;
1078
+ contextEditBufferGetInfo(context: NativeContextHandle, editBuffer: ContextEditBufferHandle): NativeEditBufferInfo;
1079
+ contextEditBufferSetTabWidth(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, width: number): void;
1080
+ contextEditBufferCommand(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, command: NativeEditCommand, argument?: number): void;
1081
+ contextEditBufferHistory(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, redo: boolean): string | null;
1082
+ contextEditBufferGetPosition(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, query: NativeEditPositionQuery, a?: number, b?: number): LogicalCursor | null;
1083
+ contextEditBufferGetRange(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, byCoords: boolean, startRow: number, startCol: number, endRow: number, endCol: number): string;
1084
+ contextEditBufferMeasureText(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, bytes: Uint8Array): number;
1085
+ contextEditBufferSetDefaults(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, mask: NativeEditorStyleMask, style: NativeEditorStyle): void;
1086
+ contextSyntaxStyleRegister(context: NativeContextHandle, style: ContextSyntaxStyleHandle, name: string, definition: NativeEditorStyle): number;
1087
+ contextSyntaxStyleResolveByName(context: NativeContextHandle, style: ContextSyntaxStyleHandle, name: string): number | null;
1088
+ contextSyntaxStyleGetStyleCount(context: NativeContextHandle, style: ContextSyntaxStyleHandle): number;
1089
+ contextEditBufferHighlight(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, operation: NativeEditHighlightOperation, argument?: number, highlight?: Highlight): void;
1090
+ contextEditBufferGetHighlights(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, line: number): Highlight[];
1091
+ contextEditorViewSetViewport(context: NativeContextHandle, view: ContextEditorViewHandle, viewport: NativeEditorViewport, sizeOnly?: boolean, moveCursor?: boolean): void;
1092
+ contextEditorViewGetViewport(context: NativeContextHandle, view: ContextEditorViewHandle): NativeEditorViewport;
1093
+ contextEditorViewSetScrollMargin(context: NativeContextHandle, view: ContextEditorViewHandle, margin: number): void;
1094
+ contextEditorViewCommand(context: NativeContextHandle, view: ContextEditorViewHandle, command: NativeEditorCommand, argument?: number): void;
1095
+ contextEditorViewReplaceSelection(context: NativeContextHandle, view: ContextEditorViewHandle, bytes: Uint8Array): NativeEditorReplacement;
1096
+ contextEditorViewSetTabColor(context: NativeContextHandle, view: ContextEditorViewHandle, color: RGBA | null): void;
1097
+ contextEditorViewSelect(context: NativeContextHandle, view: ContextEditorViewHandle, selection: NativeEditorSelection): boolean;
1098
+ contextEditorViewGetInfo(context: NativeContextHandle, view: ContextEditorViewHandle, followCursor?: boolean): NativeEditorViewInfo;
1099
+ contextEditorViewGetSelection(context: NativeContextHandle, view: ContextEditorViewHandle): Pick<NativeEditorViewInfo, "selection" | "selectionOccupancy">;
1100
+ contextEditorViewGetSelectedText(context: NativeContextHandle, view: ContextEditorViewHandle): string;
1101
+ contextEditorViewGetPosition(context: NativeContextHandle, view: ContextEditorViewHandle, query: NativeEditorPositionQuery): VisualCursor;
1102
+ contextEditorViewGetLines(context: NativeContextHandle, view: ContextEditorViewHandle, logical?: boolean): LineInfo;
1103
+ contextEditorViewMeasure(context: NativeContextHandle, view: ContextEditorViewHandle, width: number, height: number): MeasureResult;
1104
+ contextEditorViewSetPlaceholder(context: NativeContextHandle, view: ContextEditorViewHandle, content: StyledText): void;
1105
+ onContextEditEvent(context: NativeContextHandle, editBuffer: ContextEditBufferHandle, handler: (event: NativeEditEventName) => void): () => void;
1106
+ sceneSetEditorView(context: NativeContextHandle, node: SceneNodeHandle, view: ContextEditorViewHandle | null): void;
1107
+ sceneSetEditorOptions(context: NativeContextHandle, node: SceneNodeHandle, options: NativeSceneEditorOptions): void;
1108
+ destroyContextImage(context: NativeContextHandle, image: ContextImageHandle): void;
1109
+ sceneSetImage(context: NativeContextHandle, node: SceneNodeHandle, image: ContextImageHandle | null, fit: "fit" | "cover" | "fill", protocol: ImageRenderProtocol, buffer: ContextBufferHandle | null): void;
1110
+ contextDrawImage({ context, target, frame }: NativeDrawingTarget, image: ContextImageHandle, options: NativeContextImageDraw): boolean;
1111
+ sessionSetImageResolution(context: NativeContextHandle, session: SessionHandle, terminalWidth: number, terminalHeight: number, pixelWidth: number, pixelHeight: number): void;
1112
+ sessionSetKittyImageTransport(context: NativeContextHandle, session: SessionHandle, mode: number): void;
1113
+ sessionGetKittyImageTransport(context: NativeContextHandle, session: SessionHandle): NativeSessionKittyImageTransportStatus;
1114
+ sessionPollKittyImageTransport(context: NativeContextHandle, session: SessionHandle, nowNs: bigint): boolean;
1115
+ sessionCancelKittyImageTransport(context: NativeContextHandle, session: SessionHandle, failed: boolean): void;
1116
+ sessionProcessKittyImageReply(context: NativeContextHandle, session: SessionHandle, bytes: Uint8Array): number;
1117
+ sessionStartKittyFileProbe(context: NativeContextHandle, session: SessionHandle): void;
1118
+ createContextBuffer(context: NativeContextHandle, options: NativeContextBufferOptions): ContextBufferHandle;
1119
+ destroyContextBuffer(context: NativeContextHandle, buffer: ContextBufferHandle): void;
1120
+ contextResizeBuffer(context: NativeContextHandle, buffer: ContextBufferHandle, width: number, height: number): void;
1121
+ contextDrawBuffer(drawing: NativeDrawingTarget, options: NativeBufferDraw): void;
1122
+ contextBufferStack({ context, target, frame }: NativeDrawingTarget, options: NativeBufferStack): number;
1123
+ contextDrawGrid({ context, target, frame }: NativeDrawingTarget, options: NativeBufferGrid): void;
1124
+ contextDrawPackedBuffer({ context, target, frame }: NativeDrawingTarget, data: Uint8Array | PointerInput, byteLength: number, x: number, y: number, width: number, height: number): void;
1125
+ contextDrawSuperSampleBuffer({ context, target, frame }: NativeDrawingTarget, data: Uint8Array | PointerInput, byteLength: number, x: number, y: number, format: "rgba8unorm" | "bgra8unorm", stride: number): void;
1126
+ contextDrawGrayscaleBuffer({ context, target, frame }: NativeDrawingTarget, data: Float32Array, x: number, y: number, width: number, height: number, foreground: RGBA | null, background: RGBA | null, supersampled: boolean): void;
1127
+ contextColorMatrixBuffer({ context, target, frame }: NativeDrawingTarget, matrix: Float32Array, mask: Float32Array | null, strength: number, channel: number): void;
1128
+ contextAcquireBufferLease(context: NativeContextHandle, buffer: ContextBufferHandle): NativeContextBufferLease;
1129
+ createSession(context: NativeContextHandle, options: NativeSessionOptions): SessionHandle;
1130
+ sessionGetWriteLimit(context: NativeContextHandle, session: SessionHandle): bigint;
1131
+ sessionWrite(context: NativeContextHandle, session: SessionHandle, bytes: Uint8Array): void;
1132
+ sessionAttachRenderer(context: NativeContextHandle, session: SessionHandle, options: NativeSessionRendererOptions): void;
1133
+ sessionResizeRenderer(context: NativeContextHandle, session: SessionHandle, width: number, height: number): void;
1134
+ sessionSetDebugOverlay(context: NativeContextHandle, session: SessionHandle, enabled: boolean, corner: DebugOverlayCorner): void;
1135
+ sessionUpdateStats(context: NativeContextHandle, session: SessionHandle, overallMs: number, fps: number, callbackMs: number): void;
1136
+ sessionUpdateMemoryStats(context: NativeContextHandle, session: SessionHandle, heapUsed: number, heapTotal: number, arrayBuffers: number): void;
1137
+ sessionDumpHitGrid(context: NativeContextHandle, session: SessionHandle): void;
1138
+ sessionGetRendererState(context: NativeContextHandle, session: SessionHandle): NativeSessionRendererState;
1139
+ sessionAcquireBufferLease(context: NativeContextHandle, session: SessionHandle, which: SessionBuffer): NativeSessionBufferLease;
1140
+ sessionGetLinkId(context: NativeContextHandle, session: SessionHandle, x: number, y: number): number;
1141
+ private acquireBufferLease;
1142
+ contextValidateBufferLease(context: NativeContextHandle, lease: ContextObjectHandle): void;
1143
+ contextReleaseBufferLease(context: NativeContextHandle, lease: ContextObjectHandle): void;
1144
+ contextBufferLeaseGetRealCharSize(context: NativeContextHandle, lease: ContextObjectHandle, addLineBreaks: boolean): number;
1145
+ contextBufferLeaseWriteResolvedChars(context: NativeContextHandle, lease: ContextObjectHandle, bytes: Uint8Array, addLineBreaks: boolean, cellLengths?: Uint8Array): number;
1146
+ sessionSetupTerminal(context: NativeContextHandle, session: SessionHandle, options?: NativeSessionTerminalOptions): void;
1147
+ sessionSuspend(context: NativeContextHandle, session: SessionHandle): void;
1148
+ sessionResume(context: NativeContextHandle, session: SessionHandle): void;
1149
+ sessionGetTerminalState(context: NativeContextHandle, session: SessionHandle): NativeSessionTerminalPhase;
1150
+ sessionPump(context: NativeContextHandle, session: SessionHandle, nowNs: bigint, workBudget: number): NativeSessionPumpResult;
1151
+ sessionPumpExit(context: NativeContextHandle, session: SessionHandle): NativeSessionPumpStatus;
1152
+ /** Discards terminal input queued on process stdin. Best effort; see `ot_terminal_flush_input`. */
1153
+ terminalFlushInput(): void;
1154
+ sessionControl(context: NativeContextHandle, session: SessionHandle, command: NativeSessionControl): void;
1155
+ sessionClipboard(context: NativeContextHandle, session: SessionHandle, target: number, bytes: Uint8Array): boolean;
1156
+ sessionNotification(context: NativeContextHandle, session: SessionHandle, message: string, title?: string): boolean;
1157
+ sessionSetPaletteState(context: NativeContextHandle, session: SessionHandle, palette: readonly RGBA[], foreground: RGBA, background: RGBA, epoch: number): void;
1158
+ sessionSetCursor(context: NativeContextHandle, session: SessionHandle, options: NativeSessionCursorOptions): void;
1159
+ sessionGetCapabilities(context: NativeContextHandle, session: SessionHandle): NativeSessionCapabilities;
1160
+ sessionReadOutput(context: NativeContextHandle, session: SessionHandle, bytes: Uint8Array): NativeOutputTicket | null;
1161
+ sessionDrainStdout(context: NativeContextHandle, session: SessionHandle, maxBytes?: number): number;
1162
+ sessionCompleteOutput(context: NativeContextHandle, session: SessionHandle, ticket: NativeOutputTicket, success: boolean): void;
1163
+ sessionClose(context: NativeContextHandle, session: SessionHandle): void;
1164
+ sessionCancel(context: NativeContextHandle, session: SessionHandle): void;
1165
+ sessionGetState(context: NativeContextHandle, session: SessionHandle): NativeSessionState;
1166
+ destroySession(context: NativeContextHandle, session: SessionHandle): void;
1167
+ sceneCreateNode(context: NativeContextHandle, session: SessionHandle, kind: (typeof SCENE_NODE_KINDS)[number], num: number): SceneNodeHandle;
1168
+ sceneDestroyNode(context: NativeContextHandle, node: SceneNodeHandle): void;
1169
+ sceneSetMeasure(context: NativeContextHandle, node: SceneNodeHandle, measure: MeasureFunction | null): void;
1170
+ sceneHasMeasure(context: NativeContextHandle, node: SceneNodeHandle): boolean;
1171
+ sceneMarkDirty(context: NativeContextHandle, node: SceneNodeHandle): void;
1172
+ sceneMoveNode(context: NativeContextHandle, node: SceneNodeHandle, parent: SceneNodeHandle | null, index: number): void;
1173
+ sceneSetViewport(context: NativeContextHandle, node: SceneNodeHandle, viewport: SceneNodeHandle | null): void;
1174
+ sceneSetFocus(context: NativeContextHandle, node: SceneNodeHandle, focused: boolean): void;
1175
+ sceneGetStyle(context: NativeContextHandle, node: SceneNodeHandle, group: number, kind: number, edge: number): {
1176
+ unit: number;
1177
+ value: number;
248
1178
  };
249
- audioSetGroupVolume: (engine: AudioEngineHandle, groupId: number, volume: number) => number;
250
- audioSetMasterVolume: (engine: AudioEngineHandle, volume: number) => number;
251
- audioMixToBuffer: (engine: AudioEngineHandle, outBuffer: Float32Array, frameCount: number, channels: number) => number;
252
- audioEnableTap: (engine: AudioEngineHandle, enabled: boolean, capacityFrames: number) => number;
253
- audioReadTap: (engine: AudioEngineHandle, outBuffer: Float32Array, frameCount: number, channels: number) => {
254
- status: number;
255
- framesRead: number;
1179
+ sceneSetBoxDetails(context: NativeContextHandle, node: SceneNodeHandle, details: NativeSceneBoxDetails): void;
1180
+ sceneSetSurface(context: NativeContextHandle, node: SceneNodeHandle, buffer: ContextBufferHandle | null): void;
1181
+ /** Consume only native's accepted prefix. Allocation or admission failures leave
1182
+ * the suffix staged so a retry cannot lose writes or replay accepted entries. A record
1183
+ * that native rejects for its node can never apply, so it is dropped and reported once;
1184
+ * paint fields the node staged since the last flush share that record and are dropped too. */
1185
+ sceneFlush(context: NativeContextHandle, staging: SceneStaging): void;
1186
+ sceneSetText(context: NativeContextHandle, node: SceneNodeHandle, bytes: Uint8Array): void;
1187
+ sceneSetStyledText(context: NativeContextHandle, node: SceneNodeHandle, content: StyledText): void;
1188
+ private encodeStyledText;
1189
+ sceneSetSlider(context: NativeContextHandle, node: SceneNodeHandle, options: NativeSceneSliderOptions): void;
1190
+ sceneGetSliderThumb(context: NativeContextHandle, node: SceneNodeHandle): {
1191
+ size: number;
1192
+ start: number;
256
1193
  };
257
- audioGetStats: (engine: AudioEngineHandle) => AudioStats | null;
258
- }
259
- export interface RenderLib extends AudioEngineLib {
260
- createRenderer: (width: number, height: number, options?: NativeRendererCreateOptions) => RendererHandle | null;
261
- setTerminalEnvVar: (renderer: RendererHandle, key: string, value: string) => boolean;
262
- destroyRenderer: (renderer: RendererHandle, flushInput?: boolean) => void;
263
- setUseThread: (renderer: RendererHandle, useThread: boolean) => void;
264
- setClearOnShutdown: (renderer: RendererHandle, clear: boolean) => void;
265
- setBackgroundColor: (renderer: RendererHandle, color: RGBA) => void;
266
- setRenderOffset: (renderer: RendererHandle, offset: number) => void;
267
- resetSplitScrollback: (renderer: RendererHandle, seedRows: number, pinnedRenderOffset: number) => number;
268
- syncSplitScrollback: (renderer: RendererHandle, pinnedRenderOffset: number) => number;
269
- getSplitOutputOffset: (renderer: RendererHandle, surfaceOffset: number) => number;
270
- setPendingSplitFooterTransition: (renderer: RendererHandle, mode: number, sourceTopLine: number, sourceHeight: number, targetTopLine: number, targetHeight: number, scrollLines: number) => void;
271
- clearPendingSplitFooterTransition: (renderer: RendererHandle) => void;
272
- updateStats: (renderer: RendererHandle, time: number, fps: number, frameCallbackTime: number) => void;
273
- updateMemoryStats: (renderer: RendererHandle, heapUsed: number, heapTotal: number, arrayBuffers: number) => void;
274
- getRenderStats: (renderer: RendererHandle) => NativeRenderStats;
275
- render: (renderer: RendererHandle, force: boolean) => number;
276
- repaintSplitFooter: (renderer: RendererHandle, pinnedRenderOffset: number, force: boolean) => NativeRenderOperationResult;
277
- commitSplitFooterSnapshot: (renderer: RendererHandle, snapshot: OptimizedBuffer, rowColumns: number, startOnNewLine: boolean, trailingNewline: boolean, pinnedRenderOffset: number, force: boolean, beginFrame?: boolean, finalizeFrame?: boolean, controlOutput?: boolean) => NativeRenderOperationResult;
278
- getNextBuffer: (renderer: RendererHandle) => OptimizedBuffer;
279
- getCurrentBuffer: (renderer: RendererHandle) => OptimizedBuffer;
280
- linkGetUrl: (linkId: number, maxLen?: number) => string;
281
- rendererSetPaletteState: (renderer: RendererHandle, palette: readonly RGBA[], defaultForeground: RGBA, defaultBackground: RGBA, paletteEpoch: number) => void;
282
- createOptimizedBuffer: (width: number, height: number, widthMethod: WidthMethod, respectAlpha?: boolean, id?: string) => OptimizedBuffer;
283
- destroyOptimizedBuffer: (bufferPtr: OptimizedBufferHandle) => void;
284
- drawFrameBuffer: (targetBufferPtr: OptimizedBufferHandle, destX: number, destY: number, bufferPtr: OptimizedBufferHandle, sourceX?: number, sourceY?: number, sourceWidth?: number, sourceHeight?: number) => void;
285
- getBufferWidth: (buffer: OptimizedBufferHandle) => number;
286
- getBufferHeight: (buffer: OptimizedBufferHandle) => number;
287
- bufferClear: (buffer: OptimizedBufferHandle, color: RGBA) => void;
288
- bufferGetCharPtr: (buffer: OptimizedBufferHandle) => Pointer;
289
- bufferGetFgPtr: (buffer: OptimizedBufferHandle) => Pointer;
290
- bufferGetBgPtr: (buffer: OptimizedBufferHandle) => Pointer;
291
- bufferGetAttributesPtr: (buffer: OptimizedBufferHandle) => Pointer;
292
- bufferGetRespectAlpha: (buffer: OptimizedBufferHandle) => boolean;
293
- bufferSetRespectAlpha: (buffer: OptimizedBufferHandle, respectAlpha: boolean) => void;
294
- bufferGetId: (buffer: OptimizedBufferHandle) => string;
295
- bufferGetRealCharSize: (buffer: OptimizedBufferHandle) => number;
296
- bufferWriteResolvedChars: (buffer: OptimizedBufferHandle, outputBuffer: Uint8Array, addLineBreaks: boolean) => number;
297
- bufferDrawText: (buffer: OptimizedBufferHandle, text: string, x: number, y: number, color: RGBA, bgColor?: RGBA, attributes?: number) => void;
298
- bufferSetCellWithAlphaBlending: (buffer: OptimizedBufferHandle, x: number, y: number, char: string, color: RGBA, bgColor: RGBA, attributes?: number) => void;
299
- bufferSetCell: (buffer: OptimizedBufferHandle, x: number, y: number, char: string, color: RGBA, bgColor: RGBA, attributes?: number) => void;
300
- bufferFillRect: (buffer: OptimizedBufferHandle, x: number, y: number, width: number, height: number, color: RGBA) => void;
301
- bufferColorMatrix: (buffer: OptimizedBufferHandle, matrix: Pointer | Float32Array, cellMask: Pointer | Float32Array, cellMaskCount: number, strength: number, target: TargetChannel) => void;
302
- bufferColorMatrixUniform: (buffer: OptimizedBufferHandle, matrix: Pointer | Float32Array, strength: number, target: TargetChannel) => void;
303
- bufferDrawSuperSampleBuffer: (buffer: OptimizedBufferHandle, x: number, y: number, pixelData: Pointer | Uint8Array, pixelDataLength: number, format: "bgra8unorm" | "rgba8unorm", alignedBytesPerRow: number) => void;
304
- bufferDrawImage: (buffer: OptimizedBufferHandle, image: ImageHandle, x: number, y: number, width: number, height: number, pixelWidth: number, pixelHeight: number, sourceX: number, sourceY: number, sourceWidth: number, sourceHeight: number, protocol: ImageRenderProtocol) => boolean;
305
- bufferDrawPackedBuffer: (buffer: OptimizedBufferHandle, data: Pointer | Uint8Array, dataLen: number, posX: number, posY: number, terminalWidthCells: number, terminalHeightCells: number) => void;
306
- bufferDrawGrayscaleBuffer: (buffer: OptimizedBufferHandle, posX: number, posY: number, intensities: Pointer | Float32Array, srcWidth: number, srcHeight: number, fg: RGBA | null, bg: RGBA | null) => void;
307
- bufferDrawGrayscaleBufferSupersampled: (buffer: OptimizedBufferHandle, posX: number, posY: number, intensities: Pointer | Float32Array, srcWidth: number, srcHeight: number, fg: RGBA | null, bg: RGBA | null) => void;
308
- bufferDrawGrid: (buffer: OptimizedBufferHandle, borderChars: Uint32Array, borderFg: RGBA, borderBg: RGBA, columnOffsets: Int32Array, columnCount: number, rowOffsets: Int32Array, rowCount: number, options: {
309
- drawInner: boolean;
310
- drawOuter: boolean;
311
- }) => void;
312
- bufferDrawBox: (buffer: OptimizedBufferHandle, x: number, y: number, width: number, height: number, borderChars: Uint32Array, packedOptions: number, borderColor: RGBA, backgroundColor: RGBA, titleColor: RGBA, title: string | null, bottomTitle: string | null) => void;
313
- bufferResize: (buffer: OptimizedBufferHandle, width: number, height: number) => void;
314
- resizeRenderer: (renderer: RendererHandle, width: number, height: number) => void;
315
- setCursorPosition: (renderer: RendererHandle, x: number, y: number, visible: boolean) => void;
316
- setCursorColor: (renderer: RendererHandle, color: RGBA) => void;
317
- getCursorState: (renderer: RendererHandle) => CursorState;
318
- setCursorStyleOptions: (renderer: RendererHandle, options: CursorStyleOptions) => void;
319
- setDebugOverlay: (renderer: RendererHandle, enabled: boolean, corner: DebugOverlayCorner) => void;
320
- clearTerminal: (renderer: RendererHandle) => void;
321
- setTerminalTitle: (renderer: RendererHandle, title: string) => void;
322
- copyToClipboardOSC52: (renderer: RendererHandle, target: number, textUtf8: Uint8Array) => boolean;
323
- clearClipboardOSC52: (renderer: RendererHandle, target: number) => boolean;
324
- clipboardServiceCreate: (maxConcurrentOperations: number, maxProviderTransfers: number, waylandSeat?: string) => ClipboardServiceHandle | null;
325
- clipboardServiceBeginShutdown: (service: ClipboardServiceHandle) => NativeClipboardShutdownStatus;
326
- clipboardServicePollShutdown: (service: ClipboardServiceHandle) => NativeClipboardShutdownStatus;
327
- clipboardServiceDestroy: (service: ClipboardServiceHandle) => NativeClipboardDestroyStatus;
328
- clipboardServiceDrain: (service: ClipboardServiceHandle) => number;
329
- clipboardReadOperationStart: (service: ClipboardServiceHandle, request: Uint8Array, selection: number, maxBytes: number, maxImagePixels: number, maxConversionBytes: number, timeoutMs: number) => {
1194
+ sceneSetArrow(context: NativeContextHandle, node: SceneNodeHandle, options: NativeSceneArrowOptions): void;
1195
+ sceneSetTextOptions(context: NativeContextHandle, node: SceneNodeHandle, options: NativeSceneTextOptions): void;
1196
+ sceneSetTextSelection(context: NativeContextHandle, node: SceneNodeHandle, options: NativeSceneTextSelectionOptions): boolean;
1197
+ sceneGetTextSelection(context: NativeContextHandle, node: SceneNodeHandle): {
1198
+ start: number;
1199
+ end: number;
1200
+ } | null;
1201
+ sceneGetSelectedText(context: NativeContextHandle, node: SceneNodeHandle): string;
1202
+ sceneGetTextMetrics(context: NativeContextHandle, node: SceneNodeHandle): NativeSceneTextMetrics;
1203
+ private sceneTextMetrics;
1204
+ sceneGetText(context: NativeContextHandle, node: SceneNodeHandle): string;
1205
+ sceneGetTextLineInfo(context: NativeContextHandle, node: SceneNodeHandle, firstLine?: number, lineCount?: number): LineInfo;
1206
+ sceneGetLayout(context: NativeContextHandle, node: SceneNodeHandle, observation?: boolean | "paint"): NativeSceneLayout;
1207
+ sceneSetHooks(context: NativeContextHandle, node: SceneNodeHandle, flags: number, generation: bigint, initialWidth: number, initialHeight: number): void;
1208
+ /** Paint options can change between steps; attempt limits remain fixed.
1209
+ * A RECORD acknowledgement passes its recording; null records nothing. */
1210
+ sceneFrameStep(context: NativeContextHandle, session: SessionHandle, previous: NativeSceneFrameRequest | null, options: NativeSceneFrameOptions, maxWorkItems?: number, recording?: Uint8Array | null): NativeSceneFrameRequest;
1211
+ private sceneFrameStepWithMeasures;
1212
+ /** Run a native release now, or after the frame step that paints the Context's open paint recording.
1213
+ * A recording names resources that native code reads only when it paints, so every resource that a
1214
+ * paint hook can draw is released through here. */
1215
+ releaseAfterPaint(context: NativeContextHandle, release: () => void): void;
1216
+ /** Slots of the exact pending RECORD request, in paint order. */
1217
+ sceneFrameGetPaintSlots(context: NativeContextHandle, session: SessionHandle, frame: NativeSceneFrameRequest): NativeScenePaintSlot[];
1218
+ sceneFrameAcquireBufferLease(context: NativeContextHandle, session: SessionHandle, frame: NativeSceneFrameRequest, which: SessionBuffer): NativeContextBufferLease;
1219
+ /** Every returned status consumes the draft; an admission exception preserves it for retry. */
1220
+ sceneFrameCommit(context: NativeContextHandle, session: SessionHandle, frame: NativeSceneFrameRequest, force: boolean): NativeSessionRenderStatus;
1221
+ sceneFrameCancel(context: NativeContextHandle, session: SessionHandle, frameId: bigint): void;
1222
+ sceneHitTest(context: NativeContextHandle, session: SessionHandle, x: number, y: number): number;
1223
+ sceneGetStats(context: NativeContextHandle, session: SessionHandle): NativeRenderStats;
1224
+ sceneGetCursorState(context: NativeContextHandle, session: SessionHandle): CursorState;
1225
+ constructor(libPath?: string);
1226
+ /** Drains queued Context diagnostics and logs the records at `maxLevel` or more severe; it drops the rest. One call
1227
+ * drains at most one full queue. Records that console handlers add meanwhile wait for the next call. */
1228
+ logContextDiagnostics(context: NativeContextHandle, maxLevel?: LogLevel): void;
1229
+ private logMessage;
1230
+ private setupLogging;
1231
+ private setLogCallback;
1232
+ /** Hands the process log callback to the newest remaining main-thread library, or clears it after the last one. */
1233
+ private releaseProcessLog;
1234
+ dispose(): void;
1235
+ private ensureNativeSpanFeedCallback;
1236
+ clipboardServiceCreate(maxConcurrentOperations: number, maxProviderTransfers: number, waylandSeat?: string): ClipboardServiceHandle | null;
1237
+ private clipboardContext;
1238
+ private clipboardOperationArgs;
1239
+ clipboardServiceBeginShutdown(service: ClipboardServiceHandle): NativeClipboardShutdownStatus;
1240
+ clipboardServicePollShutdown(service: ClipboardServiceHandle): NativeClipboardShutdownStatus;
1241
+ clipboardServiceDestroy(service: ClipboardServiceHandle): NativeClipboardDestroyStatus;
1242
+ clipboardServiceDrain(service: ClipboardServiceHandle): number;
1243
+ private clipboardStart;
1244
+ clipboardReadOperationStart(service: ClipboardServiceHandle, request: Uint8Array, selection: number, maxBytes: number, maxImagePixels: number, maxConversionBytes: number, timeoutMs: number): {
330
1245
  status: NativeClipboardStartStatus;
331
1246
  operation: ClipboardOperationHandle | null;
332
1247
  };
333
- clipboardWriteOperationStart: (service: ClipboardServiceHandle, textUtf8: Uint8Array, selection: number, timeoutMs: number) => {
1248
+ clipboardWriteOperationStart(service: ClipboardServiceHandle, textUtf8: Uint8Array, selection: number, timeoutMs: number): {
334
1249
  status: NativeClipboardStartStatus;
335
1250
  operation: ClipboardOperationHandle | null;
336
1251
  };
337
- clipboardClearOperationStart: (service: ClipboardServiceHandle, selection: number, timeoutMs: number) => {
1252
+ clipboardClearOperationStart(service: ClipboardServiceHandle, selection: number, timeoutMs: number): {
338
1253
  status: NativeClipboardStartStatus;
339
1254
  operation: ClipboardOperationHandle | null;
340
1255
  };
341
- clipboardOperationPoll: (operation: ClipboardOperationHandle) => NativeClipboardOperationStatus;
342
- clipboardOperationCancel: (operation: ClipboardOperationHandle) => NativeClipboardCancelStatus;
343
- clipboardOperationResultMimeLength: (operation: ClipboardOperationHandle) => {
1256
+ clipboardOperationPoll(operation: ClipboardOperationHandle): NativeClipboardOperationStatus;
1257
+ clipboardOperationCancel(operation: ClipboardOperationHandle): NativeClipboardCancelStatus;
1258
+ private clipboardResultLength;
1259
+ clipboardOperationResultMimeLength(operation: ClipboardOperationHandle): {
344
1260
  status: NativeClipboardCopyStatus;
345
1261
  length: number;
346
1262
  };
347
- clipboardOperationResultMimeCopy: (operation: ClipboardOperationHandle, output: Uint8Array) => NativeClipboardCopyStatus;
348
- clipboardOperationResultDataLength: (operation: ClipboardOperationHandle) => {
1263
+ clipboardOperationResultMimeCopy(operation: ClipboardOperationHandle, output: Uint8Array): NativeClipboardCopyStatus;
1264
+ clipboardOperationResultDataLength(operation: ClipboardOperationHandle): {
349
1265
  status: NativeClipboardCopyStatus;
350
1266
  length: number;
351
1267
  };
352
- clipboardOperationResultDataCopy: (operation: ClipboardOperationHandle, output: Uint8Array) => NativeClipboardCopyStatus;
353
- clipboardOperationResultErrorCode: (operation: ClipboardOperationHandle) => {
1268
+ clipboardOperationResultDataCopy(operation: ClipboardOperationHandle, output: Uint8Array): NativeClipboardCopyStatus;
1269
+ clipboardOperationResultErrorCode(operation: ClipboardOperationHandle): {
354
1270
  status: NativeClipboardCopyStatus;
355
1271
  errorCode: number;
356
1272
  };
357
- clipboardOperationResultDiagnosticLength: (operation: ClipboardOperationHandle) => {
1273
+ clipboardOperationResultDiagnosticLength(operation: ClipboardOperationHandle): {
358
1274
  status: NativeClipboardCopyStatus;
359
1275
  length: number;
360
1276
  };
361
- clipboardOperationResultDiagnosticCopy: (operation: ClipboardOperationHandle, output: Uint8Array) => NativeClipboardCopyStatus;
362
- clipboardOperationDestroy: (operation: ClipboardOperationHandle) => NativeClipboardDestroyStatus;
363
- triggerNotification: (renderer: RendererHandle, message: string, title?: string) => boolean;
364
- addToHitGrid: (renderer: RendererHandle, x: number, y: number, width: number, height: number, id: number) => void;
365
- clearCurrentHitGrid: (renderer: RendererHandle) => void;
366
- hitGridPushScissorRect: (renderer: RendererHandle, x: number, y: number, width: number, height: number) => void;
367
- hitGridPopScissorRect: (renderer: RendererHandle) => void;
368
- hitGridClearScissorRects: (renderer: RendererHandle) => void;
369
- addToCurrentHitGridClipped: (renderer: RendererHandle, x: number, y: number, width: number, height: number, id: number) => void;
370
- checkHit: (renderer: RendererHandle, x: number, y: number) => number;
371
- getHitGridDirty: (renderer: RendererHandle) => boolean;
372
- dumpHitGrid: (renderer: RendererHandle) => void;
373
- dumpBuffers: (renderer: RendererHandle, timestamp?: number) => void;
374
- dumpOutputBuffer: (renderer: RendererHandle, timestamp?: number) => void;
375
- restoreTerminalModes: (renderer: RendererHandle) => void;
376
- enableMouse: (renderer: RendererHandle, enableMovement: boolean) => void;
377
- disableMouse: (renderer: RendererHandle) => void;
378
- enableKittyKeyboard: (renderer: RendererHandle, flags: number) => void;
379
- disableKittyKeyboard: (renderer: RendererHandle) => void;
380
- setKittyKeyboardFlags: (renderer: RendererHandle, flags: number) => void;
381
- getKittyKeyboardFlags: (renderer: RendererHandle) => number;
382
- setupTerminal: (renderer: RendererHandle, useAlternateScreen: boolean) => void;
383
- suspendRenderer: (renderer: RendererHandle) => void;
384
- resumeRenderer: (renderer: RendererHandle) => void;
385
- queryPixelResolution: (renderer: RendererHandle) => void;
386
- queryThemeColors: (renderer: RendererHandle) => void;
387
- writeOut: (renderer: RendererHandle, data: string | Uint8Array) => void;
388
- yogaConfigCreate: () => Pointer;
389
- yogaConfigFree: (config: Pointer) => void;
390
- yogaConfigSetUseWebDefaults: (config: Pointer, enabled: boolean) => void;
391
- yogaConfigGetUseWebDefaults: (config: Pointer) => boolean;
392
- yogaConfigSetPointScaleFactor: (config: Pointer, pointScaleFactor: number) => void;
393
- yogaConfigGetPointScaleFactor: (config: Pointer) => number;
394
- yogaConfigSetErrata: (config: Pointer, errata: number) => void;
395
- yogaConfigGetErrata: (config: Pointer) => number;
396
- yogaConfigSetExperimentalFeatureEnabled: (config: Pointer, feature: number, enabled: boolean) => void;
397
- yogaConfigIsExperimentalFeatureEnabled: (config: Pointer, feature: number) => boolean;
398
- yogaNodeCreate: () => Pointer;
399
- yogaNodeCreateForOpenTUI: () => Pointer;
400
- yogaNodeCreateWithConfig: (config: Pointer) => Pointer;
401
- yogaNodeFree: (node: Pointer) => void;
402
- yogaNodeFreeRecursive: (node: Pointer) => void;
403
- yogaNodeReset: (node: Pointer) => void;
404
- yogaNodeCopyStyle: (dstNode: Pointer, srcNode: Pointer) => void;
405
- yogaNodeInsertChild: (node: Pointer, child: Pointer, index: number) => void;
406
- yogaNodeRemoveChild: (node: Pointer, child: Pointer) => void;
407
- yogaNodeRemoveAllChildren: (node: Pointer) => void;
408
- yogaNodeGetChild: (node: Pointer, index: number) => Pointer | null;
409
- yogaNodeGetChildCount: (node: Pointer) => number;
410
- yogaNodeGetParent: (node: Pointer) => Pointer | null;
411
- yogaNodeCalculateLayout: (node: Pointer, width: number, height: number, direction: number) => void;
412
- yogaNodeIsDirty: (node: Pointer) => boolean;
413
- yogaNodeMarkDirty: (node: Pointer) => void;
414
- yogaNodeGetHasNewLayout: (node: Pointer) => boolean;
415
- yogaNodeSetHasNewLayout: (node: Pointer, hasNewLayout: boolean) => void;
416
- yogaNodeSetIsReferenceBaseline: (node: Pointer, isReferenceBaseline: boolean) => void;
417
- yogaNodeIsReferenceBaseline: (node: Pointer) => boolean;
418
- yogaNodeSetAlwaysFormsContainingBlock: (node: Pointer, alwaysFormsContainingBlock: boolean) => void;
419
- yogaNodeGetAlwaysFormsContainingBlock: (node: Pointer) => boolean;
420
- yogaNodeGetComputedLayout: (node: Pointer) => NativeYogaLayout;
421
- yogaNodeLayoutGetEdge: (node: Pointer, kind: number, edge: number) => number;
422
- yogaNodeStyleSetEnum: (node: Pointer, kind: number, value: number) => void;
423
- yogaNodeStyleGetEnum: (node: Pointer, kind: number) => number;
424
- yogaNodeStyleSetFloat: (node: Pointer, kind: number, value: number) => void;
425
- yogaNodeStyleGetFloat: (node: Pointer, kind: number) => number;
426
- yogaNodeStyleSetBorder: (node: Pointer, edge: number, border: number) => void;
427
- yogaNodeStyleGetBorder: (node: Pointer, edge: number) => number;
428
- yogaNodeStyleSetValue: (node: Pointer, kind: number, edgeOrGutter: number, unit: number, value: number) => void;
429
- yogaNodeStyleGetValue: (node: Pointer, kind: number, edgeOrGutter: number) => number | bigint;
430
- yogaNodeSetMeasureFunc: (node: Pointer, enabled: boolean) => void;
431
- yogaNodeUnsetMeasureFunc: (node: Pointer) => void;
432
- yogaNodeHasMeasureFunc: (node: Pointer) => boolean;
433
- yogaNodeSetDirtiedFunc: (node: Pointer, enabled: boolean) => void;
434
- yogaNodeUnsetDirtiedFunc: (node: Pointer) => void;
435
- yogaStoreMeasureResult: (width: number, height: number) => void;
436
- yogaSetMeasureCallback: (callback: Pointer | null) => void;
437
- yogaSetDirtiedCallback: (callback: Pointer | null) => void;
438
- createYogaMeasureCallback: (callback: NativeYogaMeasureCallback) => FFICallbackInstance;
439
- createYogaDirtiedCallback: (callback: NativeYogaDirtiedCallback) => FFICallbackInstance;
440
- createTextBuffer: (widthMethod: WidthMethod) => TextBuffer;
441
- destroyTextBuffer: (buffer: TextBufferHandle) => void;
442
- textBufferGetLength: (buffer: TextBufferHandle) => number;
443
- textBufferGetByteSize: (buffer: TextBufferHandle) => number;
444
- textBufferReset: (buffer: TextBufferHandle) => void;
445
- textBufferClear: (buffer: TextBufferHandle) => void;
446
- textBufferRegisterMemBuffer: (buffer: TextBufferHandle, bytes: Uint8Array, owned?: boolean) => number;
447
- textBufferReplaceMemBuffer: (buffer: TextBufferHandle, memId: number, bytes: Uint8Array, owned?: boolean) => boolean;
448
- textBufferClearMemRegistry: (buffer: TextBufferHandle) => void;
449
- textBufferSetTextFromMem: (buffer: TextBufferHandle, memId: number) => void;
450
- textBufferAppend: (buffer: TextBufferHandle, bytes: Uint8Array) => void;
451
- textBufferAppendFromMemId: (buffer: TextBufferHandle, memId: number) => void;
452
- textBufferLoadFile: (buffer: TextBufferHandle, path: string) => boolean;
453
- textBufferSetStyledText: (buffer: TextBufferHandle, chunks: Array<{
454
- text: string;
455
- fg?: RGBA | null;
456
- bg?: RGBA | null;
457
- attributes?: number;
458
- link?: {
459
- url: string;
460
- };
461
- }>) => void;
462
- textBufferSetDefaultFg: (buffer: TextBufferHandle, fg: RGBA | null) => void;
463
- textBufferSetDefaultBg: (buffer: TextBufferHandle, bg: RGBA | null) => void;
464
- textBufferSetDefaultAttributes: (buffer: TextBufferHandle, attributes: number | null) => void;
465
- textBufferResetDefaults: (buffer: TextBufferHandle) => void;
466
- textBufferGetTabWidth: (buffer: TextBufferHandle) => number;
467
- textBufferSetTabWidth: (buffer: TextBufferHandle, width: number) => void;
468
- textBufferGetLineCount: (buffer: TextBufferHandle) => number;
469
- getPlainTextBytes: (buffer: TextBufferHandle, maxLength: number) => Uint8Array | null;
470
- textBufferGetTextRange: (buffer: TextBufferHandle, startOffset: number, endOffset: number, maxLength: number) => Uint8Array | null;
471
- textBufferGetTextRangeByCoords: (buffer: TextBufferHandle, startRow: number, startCol: number, endRow: number, endCol: number, maxLength: number) => Uint8Array | null;
472
- createTextBufferView: (textBuffer: TextBufferHandle) => TextBufferViewHandle;
473
- destroyTextBufferView: (view: TextBufferViewHandle) => void;
474
- textBufferViewSetSelection: (view: TextBufferViewHandle, start: number, end: number, bgColor: RGBA | null, fgColor: RGBA | null) => void;
475
- textBufferViewResetSelection: (view: TextBufferViewHandle) => void;
476
- textBufferViewGetSelection: (view: TextBufferViewHandle) => {
477
- start: number;
478
- end: number;
479
- } | null;
480
- textBufferViewSetLocalSelection: (view: TextBufferViewHandle, anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor: RGBA | null, fgColor: RGBA | null, behavior?: SelectionBehavior) => boolean;
481
- textBufferViewUpdateSelection: (view: TextBufferViewHandle, end: number, bgColor: RGBA | null, fgColor: RGBA | null) => void;
482
- textBufferViewUpdateLocalSelection: (view: TextBufferViewHandle, anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor: RGBA | null, fgColor: RGBA | null, behavior?: SelectionBehavior) => boolean;
483
- textBufferViewResetLocalSelection: (view: TextBufferViewHandle) => void;
484
- textBufferViewSetSelectionOccupancy: (view: TextBufferViewHandle, occupancy: SelectionOccupancy) => void;
485
- textBufferViewGetSelectionOccupancy: (view: TextBufferViewHandle) => SelectionOccupancy;
486
- textBufferViewSetWrapWidth: (view: TextBufferViewHandle, width: number) => void;
487
- textBufferViewSetWrapMode: (view: TextBufferViewHandle, mode: "none" | "char" | "word") => void;
488
- textBufferViewSetTextAlign: (view: TextBufferViewHandle, alignment: "left" | "center" | "right") => void;
489
- textBufferViewSetFirstLineOffset: (view: TextBufferViewHandle, offset: number) => void;
490
- textBufferViewSetViewportSize: (view: TextBufferViewHandle, width: number, height: number) => void;
491
- textBufferViewSetViewport: (view: TextBufferViewHandle, x: number, y: number, width: number, height: number) => void;
492
- textBufferViewGetLineInfo: (view: TextBufferViewHandle) => LineInfo;
493
- textBufferViewGetLogicalLineInfo: (view: TextBufferViewHandle) => LineInfo;
494
- textBufferViewGetLineSources: (view: TextBufferViewHandle, startLine: number, lineCount: number) => number[];
495
- textBufferViewGetSelectedTextBytes: (view: TextBufferViewHandle, maxLength: number) => Uint8Array | null;
496
- textBufferViewGetPlainTextBytes: (view: TextBufferViewHandle, maxLength: number) => Uint8Array | null;
497
- textBufferViewSetTabIndicator: (view: TextBufferViewHandle, indicator: number) => void;
498
- textBufferViewSetTabIndicatorColor: (view: TextBufferViewHandle, color: RGBA) => void;
499
- textBufferViewSetTruncate: (view: TextBufferViewHandle, truncate: boolean) => void;
500
- textBufferViewMeasureForDimensions: (view: TextBufferViewHandle, width: number, height: number) => MeasureResult | null;
501
- textBufferViewGetVirtualLineCount: (view: TextBufferViewHandle) => number;
502
- readonly encoder: TextEncoder;
503
- readonly decoder: TextDecoder;
504
- bufferDrawTextBufferView: (buffer: OptimizedBufferHandle, view: TextBufferViewHandle, x: number, y: number) => void;
505
- bufferDrawEditorView: (buffer: OptimizedBufferHandle, view: EditorViewHandle, x: number, y: number) => void;
506
- createEditBuffer: (widthMethod: WidthMethod) => EditBufferHandle;
507
- destroyEditBuffer: (buffer: EditBufferHandle) => void;
508
- editBufferSetText: (buffer: EditBufferHandle, textBytes: Uint8Array) => void;
509
- editBufferSetTextFromMem: (buffer: EditBufferHandle, memId: number) => void;
510
- editBufferReplaceText: (buffer: EditBufferHandle, textBytes: Uint8Array) => void;
511
- editBufferReplaceTextFromMem: (buffer: EditBufferHandle, memId: number) => void;
512
- editBufferGetText: (buffer: EditBufferHandle, maxLength: number) => Uint8Array | null;
513
- editBufferInsertChar: (buffer: EditBufferHandle, char: string) => void;
514
- editBufferInsertText: (buffer: EditBufferHandle, text: string) => void;
515
- editBufferDeleteChar: (buffer: EditBufferHandle) => void;
516
- editBufferDeleteCharBackward: (buffer: EditBufferHandle) => void;
517
- editBufferDeleteRange: (buffer: EditBufferHandle, startLine: number, startCol: number, endLine: number, endCol: number) => void;
518
- editBufferNewLine: (buffer: EditBufferHandle) => void;
519
- editBufferDeleteLine: (buffer: EditBufferHandle) => void;
520
- editBufferMoveCursorLeft: (buffer: EditBufferHandle) => void;
521
- editBufferMoveCursorRight: (buffer: EditBufferHandle) => void;
522
- editBufferMoveCursorUp: (buffer: EditBufferHandle) => void;
523
- editBufferMoveCursorDown: (buffer: EditBufferHandle) => void;
524
- editBufferGotoLine: (buffer: EditBufferHandle, line: number) => void;
525
- editBufferSetCursor: (buffer: EditBufferHandle, line: number, col: number) => void;
526
- editBufferSetCursorToLineCol: (buffer: EditBufferHandle, line: number, col: number) => void;
527
- editBufferSetCursorByOffset: (buffer: EditBufferHandle, offset: number) => void;
528
- editBufferGetCursorPosition: (buffer: EditBufferHandle) => LogicalCursor;
529
- editBufferGetId: (buffer: EditBufferHandle) => number;
530
- editBufferGetTextBuffer: (buffer: EditBufferHandle) => TextBufferHandle;
531
- editBufferSetTabWidth: (buffer: EditBufferHandle, width: number) => void;
532
- editBufferDebugLogRope: (buffer: EditBufferHandle) => void;
533
- editBufferUndo: (buffer: EditBufferHandle, maxLength: number) => Uint8Array | null;
534
- editBufferRedo: (buffer: EditBufferHandle, maxLength: number) => Uint8Array | null;
535
- editBufferCanUndo: (buffer: EditBufferHandle) => boolean;
536
- editBufferCanRedo: (buffer: EditBufferHandle) => boolean;
537
- editBufferClearHistory: (buffer: EditBufferHandle) => void;
538
- editBufferClear: (buffer: EditBufferHandle) => void;
539
- editBufferGetNextWordBoundary: (buffer: EditBufferHandle) => {
540
- row: number;
541
- col: number;
542
- offset: number;
543
- };
544
- editBufferGetPrevWordBoundary: (buffer: EditBufferHandle) => {
545
- row: number;
546
- col: number;
547
- offset: number;
548
- };
549
- editBufferGetEOL: (buffer: EditBufferHandle) => {
550
- row: number;
551
- col: number;
552
- offset: number;
553
- };
554
- editBufferOffsetToPosition: (buffer: EditBufferHandle, offset: number) => {
555
- row: number;
556
- col: number;
557
- offset: number;
558
- } | null;
559
- editBufferPositionToOffset: (buffer: EditBufferHandle, row: number, col: number) => number;
560
- editBufferGetLineStartOffset: (buffer: EditBufferHandle, row: number) => number;
561
- editBufferGetTextRange: (buffer: EditBufferHandle, startOffset: number, endOffset: number, maxLength: number) => Uint8Array | null;
562
- editBufferGetTextRangeByCoords: (buffer: EditBufferHandle, startRow: number, startCol: number, endRow: number, endCol: number, maxLength: number) => Uint8Array | null;
563
- createEditorView: (editBufferPtr: EditBufferHandle, viewportWidth: number, viewportHeight: number) => EditorViewHandle;
564
- destroyEditorView: (view: EditorViewHandle) => void;
565
- editorViewSetViewportSize: (view: EditorViewHandle, width: number, height: number) => void;
566
- editorViewSetViewport: (view: EditorViewHandle, x: number, y: number, width: number, height: number, moveCursor: boolean) => void;
567
- editorViewGetViewport: (view: EditorViewHandle) => {
568
- offsetY: number;
569
- offsetX: number;
570
- height: number;
571
- width: number;
1277
+ clipboardOperationResultDiagnosticCopy(operation: ClipboardOperationHandle, output: Uint8Array): NativeClipboardCopyStatus;
1278
+ clipboardOperationDestroy(operation: ClipboardOperationHandle): NativeClipboardDestroyStatus;
1279
+ getYogaHost(): YogaHost;
1280
+ private yogaMutation;
1281
+ private yogaChecked;
1282
+ yogaConfigCreate(): Pointer;
1283
+ yogaConfigFree(config: Pointer): void;
1284
+ yogaConfigSetCallbacks(config: Pointer, measure: Pointer, dirtied: Pointer): boolean;
1285
+ yogaConfigClearCallbacks(config: Pointer, measure: Pointer): boolean;
1286
+ yogaConfigSetUseWebDefaults(config: Pointer, enabled: boolean): void;
1287
+ yogaConfigGetUseWebDefaults(config: Pointer): boolean;
1288
+ yogaConfigSetPointScaleFactor(config: Pointer, pointScaleFactor: number): void;
1289
+ yogaConfigGetPointScaleFactor(config: Pointer): number;
1290
+ yogaConfigSetErrata(config: Pointer, errata: number): void;
1291
+ yogaConfigGetErrata(config: Pointer): number;
1292
+ yogaConfigSetExperimentalFeatureEnabled(config: Pointer, feature: number, enabled: boolean): void;
1293
+ yogaConfigIsExperimentalFeatureEnabled(config: Pointer, feature: number): boolean;
1294
+ yogaNodeCreateForOpenTUI(): Pointer;
1295
+ yogaNodeCreateWithConfig(config: Pointer): Pointer;
1296
+ yogaNodeGetConfig(node: Pointer): Pointer;
1297
+ yogaNodeFree(node: Pointer): void;
1298
+ yogaNodeFreeRecursive(node: Pointer): void;
1299
+ yogaNodeReset(node: Pointer): void;
1300
+ yogaNodeCopyStyle(dstNode: Pointer, srcNode: Pointer): void;
1301
+ yogaNodeInsertChild(node: Pointer, child: Pointer, index: number): void;
1302
+ yogaNodeRemoveChild(node: Pointer, child: Pointer): void;
1303
+ yogaNodeRemoveAllChildren(node: Pointer): void;
1304
+ yogaNodeGetChild(node: Pointer, index: number): Pointer | null;
1305
+ yogaNodeGetChildCount(node: Pointer): number;
1306
+ yogaNodeGetParent(node: Pointer): Pointer | null;
1307
+ yogaNodeCalculateLayout(node: Pointer, width: number, height: number, direction: number): void;
1308
+ yogaNodeIsDirty(node: Pointer): boolean;
1309
+ yogaNodeMarkDirty(node: Pointer): void;
1310
+ yogaNodeGetHasNewLayout(node: Pointer): boolean;
1311
+ yogaNodeSetHasNewLayout(node: Pointer, hasNewLayout: boolean): void;
1312
+ yogaNodeSetIsReferenceBaseline(node: Pointer, isReferenceBaseline: boolean): void;
1313
+ yogaNodeIsReferenceBaseline(node: Pointer): boolean;
1314
+ yogaNodeSetAlwaysFormsContainingBlock(node: Pointer, alwaysFormsContainingBlock: boolean): void;
1315
+ yogaNodeGetAlwaysFormsContainingBlock(node: Pointer): boolean;
1316
+ yogaNodeGetComputedLayout(node: Pointer): NativeYogaLayout;
1317
+ yogaNodeLayoutGetEdge(node: Pointer, kind: number, edge: number): number;
1318
+ yogaNodeStyleSetEnum(node: Pointer, kind: number, value: number): void;
1319
+ yogaNodeStyleGetEnum(node: Pointer, kind: number): number;
1320
+ yogaNodeStyleSetFloat(node: Pointer, kind: number, value: number): void;
1321
+ yogaNodeStyleGetFloat(node: Pointer, kind: number): number;
1322
+ yogaNodeStyleSetBorder(node: Pointer, edge: number, border: number): void;
1323
+ yogaNodeStyleGetBorder(node: Pointer, edge: number): number;
1324
+ yogaNodeStyleSetValue(node: Pointer, kind: number, edgeOrGutter: number, unit: number, value: number): void;
1325
+ yogaNodeStyleGetValue(node: Pointer, kind: number, edgeOrGutter: number): number | bigint;
1326
+ yogaNodeSetMeasureFunc(node: Pointer, enabled: boolean): void;
1327
+ yogaNodeUnsetMeasureFunc(node: Pointer): void;
1328
+ yogaNodeHasMeasureFunc(node: Pointer): boolean;
1329
+ yogaNodeSetDirtiedFunc(node: Pointer, enabled: boolean): void;
1330
+ yogaNodeUnsetDirtiedFunc(node: Pointer): void;
1331
+ yogaStoreMeasureResult(config: Pointer, width: number, height: number): void;
1332
+ createYogaMeasureCallback(callback: NativeYogaMeasureCallback): FFICallbackInstance;
1333
+ createYogaDirtiedCallback(callback: NativeYogaDirtiedCallback): FFICallbackInstance;
1334
+ /** Always 0: native resources no longer allocate from a process arena. */
1335
+ getArenaAllocatedBytes(): number;
1336
+ getBuildOptions(): BuildOptions;
1337
+ /** Stats of the process allocator, which backs native span feeds. Each Context has its own allocator, so Context
1338
+ * resources such as text, buffers, scenes, images, and audio engines are not counted. */
1339
+ getAllocatorStats(): AllocatorStats;
1340
+ private tryCreateStandaloneContext;
1341
+ createAudioEngine(options?: AudioCreateOptions | null): AudioEngineHandle | null;
1342
+ destroyAudioEngine(engine: AudioEngineHandle): void;
1343
+ private audioContext;
1344
+ audioRefreshPlaybackDevices(engine: AudioEngineHandle): number;
1345
+ audioGetPlaybackDeviceCount(engine: AudioEngineHandle): number;
1346
+ audioGetPlaybackDeviceName(engine: AudioEngineHandle, index: number): string;
1347
+ audioIsPlaybackDeviceDefault(engine: AudioEngineHandle, index: number): boolean;
1348
+ audioSelectPlaybackDevice(engine: AudioEngineHandle, index: number): number;
1349
+ audioClearPlaybackDeviceSelection(engine: AudioEngineHandle): void;
1350
+ audioRefreshCaptureDevices(engine: AudioEngineHandle): number;
1351
+ audioGetCaptureDeviceCount(engine: AudioEngineHandle): number;
1352
+ audioGetCaptureDeviceName(engine: AudioEngineHandle, index: number): string;
1353
+ audioIsCaptureDeviceDefault(engine: AudioEngineHandle, index: number): boolean;
1354
+ audioSelectCaptureDevice(engine: AudioEngineHandle, index: number): number;
1355
+ audioClearCaptureDeviceSelection(engine: AudioEngineHandle): void;
1356
+ audioStartCapture(engine: AudioEngineHandle, options: AudioStartOptions | undefined, channels: number, capacityFrames: number): number;
1357
+ audioStopCapture(engine: AudioEngineHandle): number;
1358
+ audioIsCaptureRunning(engine: AudioEngineHandle): boolean;
1359
+ audioReadCapture(engine: AudioEngineHandle, outBuffer: Float32Array, frameCount: number): {
1360
+ status: number;
1361
+ framesRead: number;
572
1362
  };
573
- editorViewSetScrollMargin: (view: EditorViewHandle, margin: number) => void;
574
- editorViewSetWrapMode: (view: EditorViewHandle, mode: "none" | "char" | "word") => void;
575
- editorViewGetVirtualLineCount: (view: EditorViewHandle) => number;
576
- editorViewGetTotalVirtualLineCount: (view: EditorViewHandle) => number;
577
- editorViewGetTextBufferView: (view: EditorViewHandle) => TextBufferViewHandle;
578
- editorViewSetSelection: (view: EditorViewHandle, start: number, end: number, bgColor: RGBA | null, fgColor: RGBA | null) => void;
579
- editorViewResetSelection: (view: EditorViewHandle) => void;
580
- editorViewGetSelection: (view: EditorViewHandle) => {
581
- start: number;
582
- end: number;
583
- } | null;
584
- editorViewSetLocalSelection: (view: EditorViewHandle, anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor: RGBA | null, fgColor: RGBA | null, updateCursor: boolean, followCursor: boolean, behavior?: SelectionBehavior) => boolean;
585
- editorViewUpdateSelection: (view: EditorViewHandle, end: number, bgColor: RGBA | null, fgColor: RGBA | null) => void;
586
- editorViewUpdateLocalSelection: (view: EditorViewHandle, anchorX: number, anchorY: number, focusX: number, focusY: number, bgColor: RGBA | null, fgColor: RGBA | null, updateCursor: boolean, followCursor: boolean, behavior?: SelectionBehavior) => boolean;
587
- editorViewResetLocalSelection: (view: EditorViewHandle) => void;
588
- editorViewConvertSelectionToCell: (view: EditorViewHandle) => boolean;
589
- editorViewSetSelectionOccupancy: (view: EditorViewHandle, occupancy: SelectionOccupancy) => void;
590
- editorViewSetSelectionInclusive: (view: EditorViewHandle, start: number, end: number, bgColor: RGBA | null, fgColor: RGBA | null) => void;
591
- editorViewSetSelectionColors: (view: EditorViewHandle, bgColor: RGBA | null, fgColor: RGBA | null) => void;
592
- editorViewGetSelectedTextBytes: (view: EditorViewHandle, maxLength: number) => Uint8Array | null;
593
- editorViewGetCursor: (view: EditorViewHandle) => {
594
- row: number;
595
- col: number;
596
- };
597
- editorViewGetText: (view: EditorViewHandle, maxLength: number) => Uint8Array | null;
598
- editorViewGetVisualCursor: (view: EditorViewHandle) => VisualCursor;
599
- editorViewMoveUpVisual: (view: EditorViewHandle) => void;
600
- editorViewMoveDownVisual: (view: EditorViewHandle) => void;
601
- editorViewDeleteSelectedText: (view: EditorViewHandle) => void;
602
- editorViewSetCursorByOffset: (view: EditorViewHandle, offset: number) => void;
603
- editorViewGetNextWordBoundary: (view: EditorViewHandle) => VisualCursor;
604
- editorViewGetPrevWordBoundary: (view: EditorViewHandle) => VisualCursor;
605
- editorViewGetEOL: (view: EditorViewHandle) => VisualCursor;
606
- editorViewGetVisualSOL: (view: EditorViewHandle) => VisualCursor;
607
- editorViewGetVisualEOL: (view: EditorViewHandle) => VisualCursor;
608
- editorViewGotoVisualLineEnd: (view: EditorViewHandle) => void;
609
- editorViewGetLineInfo: (view: EditorViewHandle) => LineInfo;
610
- editorViewGetLogicalLineInfo: (view: EditorViewHandle) => LineInfo;
611
- editorViewSetPlaceholderStyledText: (view: EditorViewHandle, chunks: Array<{
612
- text: string;
613
- fg?: RGBA | null;
614
- bg?: RGBA | null;
615
- attributes?: number;
616
- }>) => void;
617
- editorViewSetTabIndicator: (view: EditorViewHandle, indicator: number) => void;
618
- editorViewSetTabIndicatorColor: (view: EditorViewHandle, color: RGBA) => void;
619
- bufferPushScissorRect: (buffer: OptimizedBufferHandle, x: number, y: number, width: number, height: number) => void;
620
- bufferPopScissorRect: (buffer: OptimizedBufferHandle) => void;
621
- bufferClearScissorRects: (buffer: OptimizedBufferHandle) => void;
622
- bufferPushOpacity: (buffer: OptimizedBufferHandle, opacity: number) => void;
623
- bufferPopOpacity: (buffer: OptimizedBufferHandle) => void;
624
- bufferGetCurrentOpacity: (buffer: OptimizedBufferHandle) => number;
625
- bufferClearOpacity: (buffer: OptimizedBufferHandle) => void;
626
- textBufferAddHighlightByCharRange: (buffer: TextBufferHandle, highlight: Highlight) => void;
627
- textBufferAddHighlight: (buffer: TextBufferHandle, lineIdx: number, highlight: Highlight) => void;
628
- textBufferRemoveHighlightsByRef: (buffer: TextBufferHandle, hlRef: number) => void;
629
- textBufferClearLineHighlights: (buffer: TextBufferHandle, lineIdx: number) => void;
630
- textBufferClearAllHighlights: (buffer: TextBufferHandle) => void;
631
- textBufferSetSyntaxStyle: (buffer: TextBufferHandle, style: SyntaxStyleHandle | null) => boolean;
632
- textBufferGetLineHighlights: (buffer: TextBufferHandle, lineIdx: number) => Array<Highlight>;
633
- textBufferGetHighlightCount: (buffer: TextBufferHandle) => number;
634
- getArenaAllocatedBytes: () => number;
635
- getBuildOptions: () => BuildOptions;
636
- getAllocatorStats: () => AllocatorStats;
637
- createSyntaxStyle: () => SyntaxStyleHandle;
638
- destroySyntaxStyle: (style: SyntaxStyleHandle) => void;
639
- syntaxStyleRegister: (style: SyntaxStyleHandle, name: string, fg: RGBA | null, bg: RGBA | null, attributes: number) => number;
640
- syntaxStyleResolveByName: (style: SyntaxStyleHandle, name: string) => number | null;
641
- syntaxStyleGetStyleCount: (style: SyntaxStyleHandle) => number;
642
- imageInfo: (data: Uint8Array) => {
1363
+ audioGetCaptureStats(engine: AudioEngineHandle): {
1364
+ status: number;
1365
+ stats: NativeAudioCaptureStats | null;
1366
+ };
1367
+ audioStart(engine: AudioEngineHandle, options?: AudioStartOptions | null): number;
1368
+ audioStartMixer(engine: AudioEngineHandle): number;
1369
+ audioStop(engine: AudioEngineHandle): number;
1370
+ audioCreateStream(engine: AudioEngineHandle, options: AudioStreamCreateOptions): {
1371
+ status: number;
1372
+ streamId: number | null;
1373
+ };
1374
+ audioWriteStream(engine: AudioEngineHandle, streamId: number, data: Uint8Array): number;
1375
+ audioEndStream(engine: AudioEngineHandle, streamId: number): number;
1376
+ audioRestartStream(engine: AudioEngineHandle, streamId: number): number;
1377
+ audioSetStreamVolume(engine: AudioEngineHandle, streamId: number, volume: number): number;
1378
+ audioSetStreamPan(engine: AudioEngineHandle, streamId: number, pan: number): number;
1379
+ audioSetStreamGroup(engine: AudioEngineHandle, streamId: number, groupId: number): number;
1380
+ audioGetStreamStats(engine: AudioEngineHandle, streamId: number): NativeAudioStreamStats | null;
1381
+ audioCloseStream(engine: AudioEngineHandle, streamId: number, reason: NativeAudioStreamCloseReason): {
1382
+ status: number;
1383
+ stats: NativeAudioStreamStats | null;
1384
+ };
1385
+ audioLoad(engine: AudioEngineHandle, data: Uint8Array): {
1386
+ status: number;
1387
+ soundId: number | null;
1388
+ };
1389
+ audioUnload(engine: AudioEngineHandle, soundId: number): number;
1390
+ audioPlay(engine: AudioEngineHandle, soundId: number, options?: AudioVoiceOptions): {
1391
+ status: number;
1392
+ voiceId: number | null;
1393
+ };
1394
+ audioStopVoice(engine: AudioEngineHandle, voiceId: number): number;
1395
+ audioSetVoiceGroup(engine: AudioEngineHandle, voiceId: number, groupId: number): number;
1396
+ audioCreateGroup(engine: AudioEngineHandle, name: string): {
1397
+ status: number;
1398
+ groupId: number | null;
1399
+ };
1400
+ audioSetGroupVolume(engine: AudioEngineHandle, groupId: number, volume: number): number;
1401
+ audioSetMasterVolume(engine: AudioEngineHandle, volume: number): number;
1402
+ audioMixToBuffer(engine: AudioEngineHandle, outBuffer: Float32Array, frameCount: number, channels: number): number;
1403
+ audioEnableTap(engine: AudioEngineHandle, enabled: boolean, capacityFrames: number): number;
1404
+ audioReadTap(engine: AudioEngineHandle, outBuffer: Float32Array, frameCount: number, channels: number): {
1405
+ status: number;
1406
+ framesRead: number;
1407
+ };
1408
+ audioGetStats(engine: AudioEngineHandle): AudioStats | null;
1409
+ registerNativeSpanFeedStream(stream: Pointer, handler: NativeSpanFeedEventHandler): void;
1410
+ unregisterNativeSpanFeedStream(stream: Pointer): void;
1411
+ createNativeSpanFeed(options?: NativeSpanFeedOptions | null): Pointer;
1412
+ attachNativeSpanFeed(stream: Pointer): number;
1413
+ destroyNativeSpanFeed(stream: Pointer): number;
1414
+ streamWrite(stream: Pointer, data: Uint8Array | string): number;
1415
+ streamCommit(stream: Pointer): number;
1416
+ streamDrainSpans(stream: Pointer, outBuffer: Uint8Array, maxSpans: number): number;
1417
+ streamReleaseSpan(stream: Pointer, slotIndex: number, releaseId: bigint): number;
1418
+ streamClose(stream: Pointer): number;
1419
+ streamGetStats(stream: Pointer): NativeSpanFeedStats | null;
1420
+ streamReserve(stream: Pointer, minLen: number): {
1421
+ status: number;
1422
+ info: ReserveInfo | null;
1423
+ };
1424
+ streamCommitReserved(stream: Pointer, length: number): number;
1425
+ private imageStatus;
1426
+ private imageCall;
1427
+ private imageOutput;
1428
+ private imageInfoOutput;
1429
+ imageInfo(context: NativeContextHandle, data: Uint8Array): {
643
1430
  status: number;
644
1431
  info: NativeImageInfo;
645
1432
  };
646
- imageRetainIccCache: () => void;
647
- imageReleaseIccCache: () => void;
648
- imageTestFailIccProfileCopyAllocationOnce: () => void;
649
- imageDecode: (data: Uint8Array) => {
1433
+ imageDecode(context: NativeContextHandle, data: Uint8Array): {
650
1434
  status: number;
651
1435
  handle: ImageHandle | null;
652
1436
  };
653
- imageCreateFromRgba: (pixels: Uint8Array, width: number, height: number, stride: number) => {
1437
+ imageCreateFromRgba(context: NativeContextHandle, pixels: Uint8Array, width: number, height: number, stride: number): {
654
1438
  status: number;
655
1439
  handle: ImageHandle | null;
656
1440
  };
657
- imageCreateFromPixels: (pixels: Uint8Array, width: number, height: number, stride: number, format: number, alpha: number) => {
1441
+ imageCreateFromPixels(context: NativeContextHandle, pixels: Uint8Array, width: number, height: number, stride: number, format: number, alpha: number): {
658
1442
  status: number;
659
1443
  handle: ImageHandle | null;
660
1444
  };
661
- imageUpdatePixels: (image: ImageHandle, pixels: Uint8Array, stride: number, format: number, alpha: number) => number;
662
- imageDestroy: (image: ImageHandle) => void;
663
- imageRetain: (image: ImageHandle) => {
1445
+ imageUpdatePixels(image: ImageHandle, pixels: Uint8Array, stride: number, format: number, alpha: number): number;
1446
+ imageDestroy(image: ImageHandle): void;
1447
+ imageRetain(image: ImageHandle): {
664
1448
  status: number;
665
1449
  handle: ImageHandle | null;
666
1450
  };
667
- imageGetInfo: (image: ImageHandle) => {
1451
+ imageRetainIccCache(): void;
1452
+ imageReleaseIccCache(): void;
1453
+ imageGetInfo(image: ImageHandle): {
668
1454
  status: number;
669
1455
  info: NativeImageInfo;
670
1456
  };
671
- imageMaterialize: (image: ImageHandle) => number;
672
- imageEnsureEncodedPng: (image: ImageHandle) => number;
673
- imageGetPixelsPtr: (image: ImageHandle) => Pointer | null;
674
- imageClone: (image: ImageHandle) => {
1457
+ imageEnsureEncodedPng(image: ImageHandle): number;
1458
+ imageCopyPng(image: ImageHandle, destination: Uint8Array): {
675
1459
  status: number;
676
- handle: ImageHandle | null;
1460
+ byteCount: number;
677
1461
  };
678
- imageCopyPixels: (image: ImageHandle, destination: Uint8Array, stride: number, bgra: boolean) => number;
679
- imageResize: (image: ImageHandle, width: number, height: number, filter: number) => {
1462
+ imageTakePixels(image: ImageHandle): {
1463
+ status: number;
1464
+ lease: ContextImagePixelsHandle | null;
1465
+ pointer: Pointer | null;
1466
+ byteCount: number;
1467
+ };
1468
+ imageReleasePixels(lease: ContextImagePixelsHandle): void;
1469
+ imageClone(image: ImageHandle, context?: NativeContextHandle): {
680
1470
  status: number;
681
1471
  handle: ImageHandle | null;
682
1472
  };
683
- imageExtract: (image: ImageHandle, left: number, top: number, width: number, height: number) => {
1473
+ imageCopyPixels(image: ImageHandle, destination: Uint8Array, stride: number, bgra: boolean): number;
1474
+ imageResize(image: ImageHandle, width: number, height: number, filter: number): {
684
1475
  status: number;
685
1476
  handle: ImageHandle | null;
686
1477
  };
687
- imageExtend: (image: ImageHandle, top: number, right: number, bottom: number, left: number, background: Uint8Array) => {
1478
+ imageExtract(image: ImageHandle, left: number, top: number, width: number, height: number): {
688
1479
  status: number;
689
1480
  handle: ImageHandle | null;
690
1481
  };
691
- imageTransform: (image: ImageHandle, operation: number) => {
1482
+ imageExtend(image: ImageHandle, top: number, right: number, bottom: number, left: number, background: Uint8Array): {
692
1483
  status: number;
693
1484
  handle: ImageHandle | null;
694
1485
  };
695
- imageComposite: (base: ImageHandle, overlay: ImageHandle, left: number, top: number, blend: number, opacity: number) => {
1486
+ imageTransform(image: ImageHandle, operation: number): {
696
1487
  status: number;
697
1488
  handle: ImageHandle | null;
698
1489
  };
699
- getTerminalCapabilities: (renderer: RendererHandle) => TerminalCapabilities;
700
- processCapabilityResponse: (renderer: RendererHandle, response: string) => void;
701
- setKittyImageTransport: (renderer: RendererHandle, mode: number) => boolean;
702
- getKittyImageTransport: (renderer: RendererHandle) => Uint32Array;
703
- pollKittyImageTransport: (renderer: RendererHandle) => boolean;
704
- cancelKittyImageTransport: (renderer: RendererHandle, failed: boolean) => void;
705
- processKittyImageReply: (renderer: RendererHandle, response: string) => number;
706
- encodeUnicode: (text: string, widthMethod: WidthMethod) => {
707
- ptr: Pointer;
708
- data: Array<{
709
- width: number;
710
- char: number;
711
- }>;
712
- } | null;
713
- freeUnicode: (encoded: {
714
- ptr: Pointer;
715
- data: Array<{
716
- width: number;
717
- char: number;
718
- }>;
719
- }) => void;
720
- bufferDrawChar: (buffer: OptimizedBufferHandle, char: number, x: number, y: number, fg: RGBA, bg: RGBA, attributes?: number) => void;
721
- registerNativeSpanFeedStream: (stream: Pointer, handler: NativeSpanFeedEventHandler) => void;
722
- unregisterNativeSpanFeedStream: (stream: Pointer) => void;
723
- createNativeSpanFeed: (options?: NativeSpanFeedOptions | null) => Pointer;
724
- attachNativeSpanFeed: (stream: Pointer) => number;
725
- destroyNativeSpanFeed: (stream: Pointer) => void;
726
- streamWrite: (stream: Pointer, data: Uint8Array | string) => number;
727
- streamCommit: (stream: Pointer) => number;
728
- streamDrainSpans: (stream: Pointer, outBuffer: Uint8Array, maxSpans: number) => number;
729
- streamClose: (stream: Pointer) => number;
730
- streamSetOptions: (stream: Pointer, options: NativeSpanFeedOptions) => number;
731
- streamGetStats: (stream: Pointer) => NativeSpanFeedStats | null;
732
- streamReserve: (stream: Pointer, minLen: number) => {
1490
+ imageComposite(base: ImageHandle, overlay: ImageHandle, left: number, top: number, blend: number, opacity: number): {
733
1491
  status: number;
734
- info: ReserveInfo | null;
1492
+ handle: ImageHandle | null;
735
1493
  };
736
- streamCommitReserved: (stream: Pointer, length: number) => number;
737
- createNativeRenderable: () => NativeRenderableHandle;
738
- destroyNativeRenderable: (handle: NativeRenderableHandle) => void;
739
- nativeRenderableAttachYogaNode: (handle: NativeRenderableHandle, node: Pointer) => boolean;
740
- nativeRenderableSetMeasureTarget: (handle: NativeRenderableHandle, kind: NativeMeasureTargetKind, target: NativeMeasureTargetHandle | 0) => boolean;
741
- createEmbeddedTerminal: (options: {
742
- cols: number;
743
- rows: number;
744
- maxScrollback?: number;
745
- }) => EmbeddedTerminalHandle;
746
- destroyEmbeddedTerminal: (handle: EmbeddedTerminalHandle) => void;
747
- embeddedTerminalWrite: (handle: EmbeddedTerminalHandle, data: string | Uint8Array) => void;
748
- embeddedTerminalResize: (handle: EmbeddedTerminalHandle, cols: number, rows: number) => void;
749
- embeddedTerminalInvalidate: (handle: EmbeddedTerminalHandle) => void;
750
- embeddedTerminalSetTransparentBackground: (handle: EmbeddedTerminalHandle, transparent: boolean) => void;
751
- embeddedTerminalScroll: (handle: EmbeddedTerminalHandle, delta: number) => void;
752
- embeddedTerminalSetSelection: (handle: EmbeddedTerminalHandle, start: {
753
- x: number;
754
- y: number;
755
- }, end: {
756
- x: number;
757
- y: number;
758
- }) => void;
759
- embeddedTerminalClearSelection: (handle: EmbeddedTerminalHandle) => void;
760
- embeddedTerminalGetSelectedText: (handle: EmbeddedTerminalHandle) => Uint8Array;
761
- embeddedTerminalCompose: (handle: EmbeddedTerminalHandle, target: OptimizedBufferHandle, x: number, y: number) => void;
762
- embeddedTerminalCursor: (handle: EmbeddedTerminalHandle) => EmbeddedTerminalCursor;
763
- embeddedTerminalEncodeKey: (handle: EmbeddedTerminalHandle, key: EmbeddedTerminalKey) => Uint8Array;
764
- embeddedTerminalEncodeMouse: (handle: EmbeddedTerminalHandle, mouse: EmbeddedTerminalMouse) => Uint8Array;
765
- embeddedTerminalEncodePaste: (handle: EmbeddedTerminalHandle, input: Uint8Array) => Uint8Array;
766
- embeddedTerminalEncodeFocus: (handle: EmbeddedTerminalHandle, focused: boolean) => Uint8Array;
767
- embeddedTerminalDrainResponses: (handle: EmbeddedTerminalHandle) => Uint8Array;
768
- onNativeEvent: (name: string, handler: (data: ArrayBuffer) => void) => void;
769
- onceNativeEvent: (name: string, handler: (data: ArrayBuffer) => void) => void;
770
- offNativeEvent: (name: string, handler: (data: ArrayBuffer) => void) => void;
771
- onAnyNativeEvent: (handler: (name: string, data: ArrayBuffer) => void) => void;
772
1494
  }
773
1495
  export declare function setRenderLibPath(libPath: string): void;
774
1496
  export declare function resolveRenderLib(): RenderLib;