@jitl/opentui-core 0.1.97 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NativeSpanFeed.d.ts +2 -2
- package/README.md +2 -1
- package/Renderable.d.ts +12 -1
- package/audio.d.ts +89 -0
- package/buffer.d.ts +6 -5
- package/console.d.ts +3 -1
- package/edit-buffer.d.ts +1 -1
- package/editor-view.d.ts +1 -1
- package/{index-yxe6e14n.js → index-46f5e8m6.js} +1388 -1721
- package/index-46f5e8m6.js.map +36 -0
- package/index-5zwezmgj.js +639 -0
- package/index-5zwezmgj.js.map +11 -0
- package/index-axv7cw60.js +44 -0
- package/index-axv7cw60.js.map +10 -0
- package/{index-rhfjv9c1.js → index-g9agybj3.js} +4626 -984
- package/index-g9agybj3.js.map +82 -0
- package/index-k18nf2r7.js +21 -0
- package/{ffi-x3zvcksd.js.map → index-k18nf2r7.js.map} +1 -1
- package/{index-tkk6cmr2.js → index-rp7vz5rh.js} +125 -23
- package/index-rp7vz5rh.js.map +10 -0
- package/{index-kcpn1hka.js → index-xwsdfq5x.js} +16 -6
- package/index-xwsdfq5x.js.map +10 -0
- package/index.d.ts +1 -0
- package/index.js +37 -17
- package/index.js.map +1 -1
- package/lib/RGBA.d.ts +22 -6
- package/lib/clipboard.d.ts +1 -1
- package/lib/{keymapping.d.ts → keybinding.internal.d.ts} +10 -2
- package/lib/objects-in-viewport.d.ts +4 -4
- package/lib/parse.keypress-kitty.d.ts +1 -0
- package/lib/parse.keypress.d.ts +1 -0
- package/lib/render-geometry.d.ts +8 -0
- package/lib/stdin-parser.d.ts +4 -1
- package/lib/terminal-capability-detection.d.ts +2 -0
- package/lib/terminal-palette.d.ts +20 -5
- package/lib/tree-sitter/assets/update.d.ts +1 -0
- package/lib/tree-sitter/client.d.ts +2 -0
- package/lib/tree-sitter/default-parsers.d.ts +1 -1
- package/lib/tree-sitter/index.d.ts +0 -2
- package/lib/tree-sitter/update-assets.d.ts +3 -0
- package/lib/tree-sitter/update-assets.js +377 -0
- package/lib/tree-sitter/update-assets.js.map +12 -0
- package/lib/tree-sitter-styled-text.d.ts +6 -4
- package/node22-bun-ffi-structs-ha8fmzzb.js +396 -0
- package/node22-bun-ffi-structs-ha8fmzzb.js.map +10 -0
- package/package.json +23 -22
- package/parser.worker.js +161 -24
- package/parser.worker.js.map +12 -5
- package/platform/bun-ffi-structs.d.ts +2 -0
- package/platform/ffi.d.ts +126 -0
- package/platform/node22-bun-ffi-structs.d.ts +33 -0
- package/platform/node22-ffi.d.ts +33 -0
- package/{compat → platform}/runtime.d.ts +6 -0
- package/platform/worker.d.ts +4 -0
- package/renderables/Code.d.ts +4 -0
- package/renderables/Markdown.d.ts +62 -0
- package/renderables/ScrollBox.d.ts +1 -0
- package/renderables/Select.d.ts +3 -1
- package/renderables/TabSelect.d.ts +3 -1
- package/renderables/TextBufferRenderable.d.ts +1 -0
- package/renderables/TextTable.d.ts +15 -1
- package/renderables/Textarea.d.ts +5 -3
- package/renderables/markdown-parser.d.ts +1 -0
- package/renderer-theme-mode.d.ts +29 -0
- package/renderer.d.ts +142 -16
- package/runtime-plugin-support-configure.d.ts +4 -0
- package/runtime-plugin-support-configure.js +20 -0
- package/{index-re3ntm60.js.map → runtime-plugin-support-configure.js.map} +1 -1
- package/runtime-plugin-support.d.ts +3 -3
- package/runtime-plugin-support.js +9 -18
- package/runtime-plugin-support.js.map +3 -3
- package/runtime-plugin.d.ts +1 -4
- package/runtime-plugin.js +5 -5
- package/syntax-style.d.ts +11 -3
- package/testing/terminal-capabilities.d.ts +7 -0
- package/testing/test-recorder.d.ts +6 -6
- package/testing/test-renderer.d.ts +34 -2
- package/testing.d.ts +2 -0
- package/testing.js +329 -23
- package/testing.js.map +7 -5
- package/text-buffer-view.d.ts +2 -1
- package/text-buffer.d.ts +1 -1
- package/types.d.ts +33 -1
- package/zig-structs.d.ts +111 -20
- package/zig.d.ts +57 -7
- package/3d/SpriteResourceManager.d.ts +0 -74
- package/3d/SpriteUtils.d.ts +0 -13
- package/3d/TextureUtils.d.ts +0 -24
- package/3d/ThreeRenderable.d.ts +0 -40
- package/3d/WGPURenderer.d.ts +0 -61
- package/3d/animation/ExplodingSpriteEffect.d.ts +0 -71
- package/3d/animation/PhysicsExplodingSpriteEffect.d.ts +0 -76
- package/3d/animation/SpriteAnimator.d.ts +0 -124
- package/3d/animation/SpriteParticleGenerator.d.ts +0 -62
- package/3d/canvas.d.ts +0 -44
- package/3d/index.d.ts +0 -12
- package/3d/physics/PlanckPhysicsAdapter.d.ts +0 -19
- package/3d/physics/RapierPhysicsAdapter.d.ts +0 -19
- package/3d/physics/physics-interface.d.ts +0 -27
- package/3d.d.ts +0 -2
- package/3d.js +0 -33843
- package/3d.js.map +0 -155
- package/Worker-vajwjk0s.js +0 -94
- package/Worker-vajwjk0s.js.map +0 -10
- package/compat/FFIType.d.ts +0 -304
- package/compat/Worker.d.ts +0 -1
- package/compat/bun-ffi-structs.d.ts +0 -2
- package/compat/ffi.d.ts +0 -86
- package/compat/nodejs/Worker.d.ts +0 -16
- package/compat/nodejs/bun-ffi-structs/index.d.ts +0 -46
- package/compat/nodejs/ffi.d.ts +0 -21
- package/compat/nodejs/registerResolveJs.d.ts +0 -1
- package/compat/nodejs/runtime.d.ts +0 -7
- package/compat/nodejs/test.d.ts +0 -4
- package/compat/nodejs/trampoline.worker.d.ts +0 -1
- package/compat/test.d.ts +0 -1
- package/compat/testHelpers.d.ts +0 -18
- package/ffi-x3zvcksd.js +0 -25
- package/index-5yqvbmcz.js +0 -220
- package/index-5yqvbmcz.js.map +0 -10
- package/index-bnfz2g63.js +0 -654
- package/index-bnfz2g63.js.map +0 -10
- package/index-cbvybypy.js +0 -43
- package/index-cbvybypy.js.map +0 -10
- package/index-kcpn1hka.js.map +0 -10
- package/index-re3ntm60.js +0 -51
- package/index-rhfjv9c1.js.map +0 -70
- package/index-tkk6cmr2.js.map +0 -10
- package/index-yxe6e14n.js.map +0 -42
- package/runtime-hdpkc6qf.js +0 -220
- package/runtime-hdpkc6qf.js.map +0 -17
- /package/{compat/nodejs/registerBun.d.ts → native-event-worker-repro.worker.d.ts} +0 -0
package/renderer.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Renderable, RootRenderable } from "./Renderable.js";
|
|
2
|
-
import { DebugOverlayCorner, type CursorStyleOptions, type MousePointerStyle, type RenderContext, type ThemeMode, type WidthMethod } from "./types.js";
|
|
2
|
+
import { DebugOverlayCorner, type CursorStyleOptions, type MousePointerStyle, type RenderContext, type TerminalCapabilities, type ThemeMode, type WidthMethod } from "./types.js";
|
|
3
3
|
import { RGBA, type ColorInput } from "./lib/RGBA.js";
|
|
4
|
-
import type { Pointer } from "./
|
|
4
|
+
import type { Pointer } from "./platform/ffi.js";
|
|
5
5
|
import { OptimizedBuffer } from "./buffer.js";
|
|
6
|
-
import { type RenderLib } from "./zig.js";
|
|
6
|
+
import { type NativeRenderStats, type RenderLib } from "./zig.js";
|
|
7
7
|
import { TerminalConsole, type ConsoleOptions } from "./console.js";
|
|
8
8
|
import { type MouseEventType, type RawMouseEvent, type ScrollInfo } from "./lib/parse.mouse.js";
|
|
9
9
|
import { Selection } from "./lib/selection.js";
|
|
@@ -20,6 +20,7 @@ export interface CliRendererConfig {
|
|
|
20
20
|
testing?: boolean;
|
|
21
21
|
exitOnCtrlC?: boolean;
|
|
22
22
|
exitSignals?: NodeJS.Signals[];
|
|
23
|
+
clearOnShutdown?: boolean;
|
|
23
24
|
forwardEnvKeys?: string[];
|
|
24
25
|
debounceDelay?: number;
|
|
25
26
|
targetFps?: number;
|
|
@@ -47,11 +48,68 @@ export interface CliRendererConfig {
|
|
|
47
48
|
}
|
|
48
49
|
export type ScreenMode = "alternate-screen" | "main-screen" | "split-footer";
|
|
49
50
|
export type ExternalOutputMode = "capture-stdout" | "passthrough";
|
|
51
|
+
export interface CliRendererExternalOutputEvent {
|
|
52
|
+
snapshot: OptimizedBuffer;
|
|
53
|
+
rowColumns: number;
|
|
54
|
+
startOnNewLine: boolean;
|
|
55
|
+
trailingNewline: boolean;
|
|
56
|
+
}
|
|
50
57
|
export type ConsoleMode = "console-overlay" | "disabled";
|
|
51
58
|
export type PixelResolution = {
|
|
52
59
|
width: number;
|
|
53
60
|
height: number;
|
|
54
61
|
};
|
|
62
|
+
export interface CliRendererStats extends NativeRenderStats {
|
|
63
|
+
fps: number;
|
|
64
|
+
frameCount: number;
|
|
65
|
+
frameTimes: number[];
|
|
66
|
+
averageFrameTime: number;
|
|
67
|
+
minFrameTime: number;
|
|
68
|
+
maxFrameTime: number;
|
|
69
|
+
frameCallbackTime: number;
|
|
70
|
+
}
|
|
71
|
+
export interface CliRendererFrameEvent {
|
|
72
|
+
frameId: number;
|
|
73
|
+
}
|
|
74
|
+
export interface RendererSchedulerState {
|
|
75
|
+
isRunning: boolean;
|
|
76
|
+
isRendering: boolean;
|
|
77
|
+
hasScheduledRender: boolean;
|
|
78
|
+
}
|
|
79
|
+
export interface ScrollbackRenderContext {
|
|
80
|
+
width: number;
|
|
81
|
+
widthMethod: WidthMethod;
|
|
82
|
+
tailColumn: number;
|
|
83
|
+
renderContext: RenderContext;
|
|
84
|
+
}
|
|
85
|
+
export interface ScrollbackSnapshot {
|
|
86
|
+
root: Renderable;
|
|
87
|
+
width?: number;
|
|
88
|
+
height?: number;
|
|
89
|
+
rowColumns?: number;
|
|
90
|
+
startOnNewLine?: boolean;
|
|
91
|
+
trailingNewline?: boolean;
|
|
92
|
+
teardown?: () => void;
|
|
93
|
+
}
|
|
94
|
+
export type ScrollbackWriter = (ctx: ScrollbackRenderContext) => ScrollbackSnapshot;
|
|
95
|
+
export interface ScrollbackSurfaceOptions {
|
|
96
|
+
startOnNewLine?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface ScrollbackSurfaceCommitOptions {
|
|
99
|
+
rowColumns?: number;
|
|
100
|
+
trailingNewline?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface ScrollbackSurface {
|
|
103
|
+
readonly renderContext: RenderContext;
|
|
104
|
+
readonly root: Renderable;
|
|
105
|
+
readonly width: number;
|
|
106
|
+
readonly height: number;
|
|
107
|
+
readonly isDestroyed: boolean;
|
|
108
|
+
render(): void;
|
|
109
|
+
settle(timeoutMs?: number): Promise<void>;
|
|
110
|
+
commitRows(startRow: number, endRowExclusive: number, options?: ScrollbackSurfaceCommitOptions): void;
|
|
111
|
+
destroy(): void;
|
|
112
|
+
}
|
|
55
113
|
/**
|
|
56
114
|
* Kitty Keyboard Protocol configuration options
|
|
57
115
|
* See: https://sw.kovidgoyal.net/kitty/keyboard-protocol/#progressive-enhancement
|
|
@@ -110,10 +168,14 @@ export declare enum MouseButton {
|
|
|
110
168
|
export declare function createCliRenderer(config?: CliRendererConfig): Promise<CliRenderer>;
|
|
111
169
|
export declare enum CliRenderEvents {
|
|
112
170
|
RESIZE = "resize",
|
|
171
|
+
FRAME = "frame",
|
|
172
|
+
EXTERNAL_OUTPUT = "external_output",
|
|
113
173
|
FOCUS = "focus",
|
|
114
174
|
BLUR = "blur",
|
|
175
|
+
FOCUSED_RENDERABLE = "focused_renderable",
|
|
115
176
|
FOCUSED_EDITOR = "focused_editor",
|
|
116
177
|
THEME_MODE = "theme_mode",
|
|
178
|
+
PALETTE = "palette",
|
|
117
179
|
CAPABILITIES = "capabilities",
|
|
118
180
|
SELECTION = "selection",
|
|
119
181
|
DEBUG_OVERLAY_TOGGLE = "debugOverlay:toggle",
|
|
@@ -166,6 +228,7 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
166
228
|
private renderTimeout;
|
|
167
229
|
private lastTime;
|
|
168
230
|
private frameCount;
|
|
231
|
+
private _frameId;
|
|
169
232
|
private lastFpsTime;
|
|
170
233
|
private currentFps;
|
|
171
234
|
private targetFrameTime;
|
|
@@ -189,6 +252,9 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
189
252
|
private animationRequest;
|
|
190
253
|
private resizeTimeoutId;
|
|
191
254
|
private capabilityTimeoutId;
|
|
255
|
+
private xtVersionWaiters;
|
|
256
|
+
private splitStartupSeedTimeoutId;
|
|
257
|
+
private pendingSplitStartupCursorSeed;
|
|
192
258
|
private resizeDebounceDelay;
|
|
193
259
|
private enableMouseMovement;
|
|
194
260
|
private _useMouse;
|
|
@@ -196,8 +262,11 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
196
262
|
private _screenMode;
|
|
197
263
|
private _footerHeight;
|
|
198
264
|
private _externalOutputMode;
|
|
265
|
+
private clearOnShutdown;
|
|
199
266
|
private _suspendedMouseEnabled;
|
|
200
267
|
private _previousControlState;
|
|
268
|
+
private pendingSuspendedTerminalSetup;
|
|
269
|
+
private suspendedNonAltSurfacePreserved;
|
|
201
270
|
private capturedRenderable?;
|
|
202
271
|
private lastOverRenderableNum;
|
|
203
272
|
private lastOverRenderable?;
|
|
@@ -206,11 +275,16 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
206
275
|
private clipboard;
|
|
207
276
|
private _splitHeight;
|
|
208
277
|
private renderOffset;
|
|
278
|
+
private splitTailColumn;
|
|
279
|
+
private pendingSplitFooterTransition;
|
|
280
|
+
private forceFullRepaintRequested;
|
|
281
|
+
private readonly maxSplitCommitsPerFrame;
|
|
209
282
|
private _terminalWidth;
|
|
210
283
|
private _terminalHeight;
|
|
211
284
|
private _terminalIsSetup;
|
|
285
|
+
private externalOutputQueue;
|
|
286
|
+
private pendingExternalOutputMode;
|
|
212
287
|
private realStdoutWrite;
|
|
213
|
-
private captureCallback;
|
|
214
288
|
private _useConsole;
|
|
215
289
|
private sigwinchHandler;
|
|
216
290
|
private _capabilities;
|
|
@@ -222,14 +296,20 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
222
296
|
private lifecyclePasses;
|
|
223
297
|
private _openConsoleOnError;
|
|
224
298
|
private _paletteDetector;
|
|
225
|
-
private
|
|
299
|
+
private _paletteCache;
|
|
226
300
|
private _paletteDetectionPromise;
|
|
301
|
+
private _paletteDetectionSize;
|
|
302
|
+
private _paletteEpoch;
|
|
303
|
+
private _nativePaletteSignature;
|
|
304
|
+
private _emittedPaletteSignature;
|
|
305
|
+
private _palettePublishGeneration;
|
|
227
306
|
private _onDestroy?;
|
|
228
|
-
private
|
|
307
|
+
private themeModeState;
|
|
229
308
|
private _terminalFocusState;
|
|
230
309
|
private sequenceHandlers;
|
|
231
310
|
private prependedInputHandlers;
|
|
232
311
|
private shouldRestoreModesOnNextFocus;
|
|
312
|
+
private themeModeHandler;
|
|
233
313
|
private idleResolvers;
|
|
234
314
|
private _debugInputs;
|
|
235
315
|
private _debugModeEnabled;
|
|
@@ -250,12 +330,14 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
250
330
|
private normalizeClockTime;
|
|
251
331
|
private getElapsedMs;
|
|
252
332
|
focusRenderable(renderable: Renderable): void;
|
|
333
|
+
blurRenderable(renderable: Renderable): void;
|
|
253
334
|
private setCapturedRenderable;
|
|
254
335
|
addToHitGrid(x: number, y: number, width: number, height: number, id: number): void;
|
|
255
336
|
pushHitGridScissorRect(x: number, y: number, width: number, height: number): void;
|
|
256
337
|
popHitGridScissorRect(): void;
|
|
257
338
|
clearHitGridScissorRects(): void;
|
|
258
339
|
get widthMethod(): WidthMethod;
|
|
340
|
+
get frameId(): number;
|
|
259
341
|
private writeOut;
|
|
260
342
|
requestRender(): void;
|
|
261
343
|
private activateFrame;
|
|
@@ -265,6 +347,7 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
265
347
|
private isIdleNow;
|
|
266
348
|
private resolveIdleIfNeeded;
|
|
267
349
|
idle(): Promise<void>;
|
|
350
|
+
getSchedulerState(): RendererSchedulerState;
|
|
268
351
|
get resolution(): PixelResolution | null;
|
|
269
352
|
get console(): TerminalConsole;
|
|
270
353
|
get keyInput(): KeyHandler;
|
|
@@ -284,17 +367,52 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
284
367
|
set footerHeight(footerHeight: number);
|
|
285
368
|
get externalOutputMode(): ExternalOutputMode;
|
|
286
369
|
set externalOutputMode(mode: ExternalOutputMode);
|
|
370
|
+
private applyExternalOutputMode;
|
|
371
|
+
private afterExternalOutputModeChanged;
|
|
372
|
+
private applyPendingExternalOutputModeIfReady;
|
|
373
|
+
private flushPendingSplitOutputBeforeLeavingSplitFooter;
|
|
287
374
|
get liveRequestCount(): number;
|
|
288
375
|
get currentControlState(): string;
|
|
289
|
-
get capabilities():
|
|
376
|
+
get capabilities(): TerminalCapabilities | null;
|
|
377
|
+
triggerNotification(message: string, title?: string): boolean;
|
|
290
378
|
get themeMode(): ThemeMode | null;
|
|
379
|
+
waitForThemeMode(timeoutMs?: number): Promise<ThemeMode | null>;
|
|
291
380
|
getDebugInputs(): Array<{
|
|
292
381
|
timestamp: string;
|
|
293
382
|
sequence: string;
|
|
294
383
|
}>;
|
|
295
384
|
get useKittyKeyboard(): boolean;
|
|
296
385
|
set useKittyKeyboard(use: boolean);
|
|
386
|
+
createScrollbackSurface(options?: ScrollbackSurfaceOptions): ScrollbackSurface;
|
|
387
|
+
writeToScrollback(write: ScrollbackWriter): void;
|
|
388
|
+
private getSnapshotWidth;
|
|
389
|
+
private getSnapshotHeight;
|
|
390
|
+
private getSnapshotRowWidths;
|
|
391
|
+
private advanceSplitTailColumn;
|
|
392
|
+
private getSplitTailColumnAfterCommit;
|
|
393
|
+
private recordSplitCommit;
|
|
394
|
+
private getPendingSplitTailColumn;
|
|
395
|
+
private enqueueRenderedScrollbackCommit;
|
|
396
|
+
private enqueueSplitCommit;
|
|
397
|
+
private createStdoutSnapshotCommit;
|
|
398
|
+
private splitStdoutRows;
|
|
399
|
+
private createStdoutSnapshotCommits;
|
|
400
|
+
private flushPendingSplitCommits;
|
|
297
401
|
private interceptStdoutWrite;
|
|
402
|
+
private getSplitPinnedRenderOffset;
|
|
403
|
+
private getSplitCursorSeedRows;
|
|
404
|
+
private isSplitCursorSeedFrameBlocked;
|
|
405
|
+
private canFlushSplitOutputBeforeTransition;
|
|
406
|
+
private clearSplitStartupCursorSeed;
|
|
407
|
+
private abortSplitStartupCursorSeed;
|
|
408
|
+
private flushPendingSplitOutputBeforeTransition;
|
|
409
|
+
private resetSplitScrollback;
|
|
410
|
+
private syncSplitScrollback;
|
|
411
|
+
private getSplitOutputOffset;
|
|
412
|
+
private clearPendingSplitFooterTransition;
|
|
413
|
+
private setPendingSplitFooterTransition;
|
|
414
|
+
private syncSplitFooterState;
|
|
415
|
+
private clearStaleSplitSurfaceRows;
|
|
298
416
|
private applyScreenMode;
|
|
299
417
|
private flushStdoutCache;
|
|
300
418
|
private enableMouse;
|
|
@@ -309,9 +427,9 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
309
427
|
removeInputHandler(handler: (sequence: string) => boolean): void;
|
|
310
428
|
private updateStdinParserProtocolContext;
|
|
311
429
|
subscribeOsc(handler: (sequence: string) => void): () => void;
|
|
430
|
+
private processCapabilitySequence;
|
|
312
431
|
private capabilityHandler;
|
|
313
432
|
private focusHandler;
|
|
314
|
-
private themeModeHandler;
|
|
315
433
|
private dispatchSequenceHandlers;
|
|
316
434
|
private drainStdinParser;
|
|
317
435
|
private handleStdinEvent;
|
|
@@ -341,6 +459,12 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
341
459
|
corner?: DebugOverlayCorner;
|
|
342
460
|
}): void;
|
|
343
461
|
setTerminalTitle(title: string): void;
|
|
462
|
+
/**
|
|
463
|
+
* Reset the terminal background color to its default via OSC 111.
|
|
464
|
+
* Called automatically by destroy() and suspend(), but exposed for
|
|
465
|
+
* consumers that need explicit control (e.g. before SIGTSTP).
|
|
466
|
+
*/
|
|
467
|
+
resetTerminalBgColor(): void;
|
|
344
468
|
copyToClipboardOSC52(text: string, target?: ClipboardTarget): boolean;
|
|
345
469
|
clearClipboardOSC52(target?: ClipboardTarget): boolean;
|
|
346
470
|
isOsc52Supported(): boolean;
|
|
@@ -380,14 +504,8 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
380
504
|
intermediateRender(): void;
|
|
381
505
|
private renderNative;
|
|
382
506
|
private collectStatSample;
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
frameCount: number;
|
|
386
|
-
frameTimes: number[];
|
|
387
|
-
averageFrameTime: number;
|
|
388
|
-
minFrameTime: number;
|
|
389
|
-
maxFrameTime: number;
|
|
390
|
-
};
|
|
507
|
+
getNativeStats(): NativeRenderStats;
|
|
508
|
+
getStats(): CliRendererStats;
|
|
391
509
|
resetStats(): void;
|
|
392
510
|
setGatherStats(enabled: boolean): void;
|
|
393
511
|
getSelection(): Selection | null;
|
|
@@ -408,6 +526,14 @@ export declare class CliRenderer extends EventEmitter implements RenderContext {
|
|
|
408
526
|
private notifySelectablesOfSelectionChange;
|
|
409
527
|
private walkSelectableRenderables;
|
|
410
528
|
get paletteDetectionStatus(): "idle" | "detecting" | "cached";
|
|
529
|
+
private getCachedPaletteBySize;
|
|
530
|
+
private ensurePaletteDetector;
|
|
531
|
+
private syncNativePaletteState;
|
|
532
|
+
private emitPaletteChange;
|
|
533
|
+
private resolveXtVersionWaiters;
|
|
534
|
+
private waitForXtVersion;
|
|
535
|
+
private shouldSyncNativePaletteState;
|
|
536
|
+
private refreshPalette;
|
|
411
537
|
clearPaletteCache(): void;
|
|
412
538
|
/**
|
|
413
539
|
* Detects the terminal's color palette
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type CreateRuntimePluginOptions } from "./runtime-plugin.js";
|
|
2
|
+
export declare function ensureRuntimePluginSupport(options?: CreateRuntimePluginOptions): boolean;
|
|
3
|
+
export { createRuntimePlugin, runtimeModuleIdForSpecifier } from "./runtime-plugin.js";
|
|
4
|
+
export type { CreateRuntimePluginOptions, RuntimeModuleEntry, RuntimeModuleExports, RuntimeModuleLoader, } from "./runtime-plugin.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
ensureRuntimePluginSupport
|
|
4
|
+
} from "./index-axv7cw60.js";
|
|
5
|
+
import {
|
|
6
|
+
createRuntimePlugin,
|
|
7
|
+
runtimeModuleIdForSpecifier
|
|
8
|
+
} from "./index-xwsdfq5x.js";
|
|
9
|
+
import"./index-46f5e8m6.js";
|
|
10
|
+
import"./index-g9agybj3.js";
|
|
11
|
+
import"./index-5zwezmgj.js";
|
|
12
|
+
import"./index-k18nf2r7.js";
|
|
13
|
+
export {
|
|
14
|
+
runtimeModuleIdForSpecifier,
|
|
15
|
+
ensureRuntimePluginSupport,
|
|
16
|
+
createRuntimePlugin
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//# debugId=E348EA16E39652E864756E2164756E21
|
|
20
|
+
//# sourceMappingURL=runtime-plugin-support-configure.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
export { createRuntimePlugin, runtimeModuleIdForSpecifier, type CreateRuntimePluginOptions, type RuntimeModuleEntry, type RuntimeModuleExports, type RuntimeModuleLoader, };
|
|
1
|
+
import { ensureRuntimePluginSupport } from "./runtime-plugin-support-configure.js";
|
|
2
|
+
export { ensureRuntimePluginSupport };
|
|
3
|
+
export { createRuntimePlugin, runtimeModuleIdForSpecifier, type CreateRuntimePluginOptions, type RuntimeModuleEntry, type RuntimeModuleExports, type RuntimeModuleLoader, } from "./runtime-plugin-support-configure.js";
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
ensureRuntimePluginSupport
|
|
4
|
+
} from "./index-axv7cw60.js";
|
|
2
5
|
import {
|
|
3
6
|
createRuntimePlugin,
|
|
4
7
|
runtimeModuleIdForSpecifier
|
|
5
|
-
} from "./index-
|
|
6
|
-
import"./index-
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
10
|
-
|
|
8
|
+
} from "./index-xwsdfq5x.js";
|
|
9
|
+
import"./index-46f5e8m6.js";
|
|
10
|
+
import"./index-g9agybj3.js";
|
|
11
|
+
import"./index-5zwezmgj.js";
|
|
12
|
+
import"./index-k18nf2r7.js";
|
|
11
13
|
// src/runtime-plugin-support.ts
|
|
12
|
-
var {plugin: registerBunPlugin } = globalThis.Bun;
|
|
13
|
-
var runtimePluginSupportInstalledKey = "__opentuiCoreRuntimePluginSupportInstalled__";
|
|
14
|
-
function ensureRuntimePluginSupport(options = {}) {
|
|
15
|
-
const state = globalThis;
|
|
16
|
-
if (state[runtimePluginSupportInstalledKey]) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
registerBunPlugin(createRuntimePlugin(options));
|
|
20
|
-
state[runtimePluginSupportInstalledKey] = true;
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
14
|
ensureRuntimePluginSupport();
|
|
24
15
|
export {
|
|
25
16
|
runtimeModuleIdForSpecifier,
|
|
@@ -27,5 +18,5 @@ export {
|
|
|
27
18
|
createRuntimePlugin
|
|
28
19
|
};
|
|
29
20
|
|
|
30
|
-
//# debugId=
|
|
21
|
+
//# debugId=6357946CF311E08864756E2164756E21
|
|
31
22
|
//# sourceMappingURL=runtime-plugin-support.js.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/runtime-plugin-support.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import {
|
|
5
|
+
"import { ensureRuntimePluginSupport } from \"./runtime-plugin-support-configure.js\"\n\nexport { ensureRuntimePluginSupport }\nexport {\n createRuntimePlugin,\n runtimeModuleIdForSpecifier,\n type CreateRuntimePluginOptions,\n type RuntimeModuleEntry,\n type RuntimeModuleExports,\n type RuntimeModuleLoader,\n} from \"./runtime-plugin-support-configure.js\"\n\nensureRuntimePluginSupport()\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;AAYA,2BAA2B;",
|
|
8
|
+
"debugId": "6357946CF311E08864756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/runtime-plugin.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type BunPlugin } from "bun";
|
|
1
2
|
export type RuntimeModuleExports = Record<string, unknown>;
|
|
2
3
|
export type RuntimeModuleLoader = () => RuntimeModuleExports | Promise<RuntimeModuleExports>;
|
|
3
4
|
export type RuntimeModuleEntry = RuntimeModuleExports | RuntimeModuleLoader;
|
|
@@ -10,10 +11,6 @@ export interface CreateRuntimePluginOptions {
|
|
|
10
11
|
additional?: Record<string, RuntimeModuleEntry>;
|
|
11
12
|
rewrite?: RuntimePluginRewriteOptions;
|
|
12
13
|
}
|
|
13
|
-
export interface BunPlugin {
|
|
14
|
-
name: string;
|
|
15
|
-
setup(build: any): void | Promise<void>;
|
|
16
|
-
}
|
|
17
14
|
export declare const isCoreRuntimeModuleSpecifier: (specifier: string) => boolean;
|
|
18
15
|
export declare const runtimeModuleIdForSpecifier: (specifier: string) => string;
|
|
19
16
|
export declare function createRuntimePlugin(input?: CreateRuntimePluginOptions): BunPlugin;
|
package/runtime-plugin.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
createRuntimePlugin,
|
|
4
4
|
isCoreRuntimeModuleSpecifier,
|
|
5
5
|
runtimeModuleIdForSpecifier
|
|
6
|
-
} from "./index-
|
|
7
|
-
import"./index-
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
10
|
-
import"./index-
|
|
6
|
+
} from "./index-xwsdfq5x.js";
|
|
7
|
+
import"./index-46f5e8m6.js";
|
|
8
|
+
import"./index-g9agybj3.js";
|
|
9
|
+
import"./index-5zwezmgj.js";
|
|
10
|
+
import"./index-k18nf2r7.js";
|
|
11
11
|
export {
|
|
12
12
|
runtimeModuleIdForSpecifier,
|
|
13
13
|
isCoreRuntimeModuleSpecifier,
|
package/syntax-style.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RGBA, type ColorInput } from "./lib/RGBA.js";
|
|
2
2
|
import { type RenderLib } from "./zig.js";
|
|
3
|
-
import { type Pointer } from "./
|
|
3
|
+
import { type Pointer } from "./platform/ffi.js";
|
|
4
4
|
export interface StyleDefinition {
|
|
5
5
|
fg?: RGBA;
|
|
6
6
|
bg?: RGBA;
|
|
@@ -9,6 +9,14 @@ export interface StyleDefinition {
|
|
|
9
9
|
underline?: boolean;
|
|
10
10
|
dim?: boolean;
|
|
11
11
|
}
|
|
12
|
+
export interface StyleDefinitionInput {
|
|
13
|
+
fg?: ColorInput;
|
|
14
|
+
bg?: ColorInput;
|
|
15
|
+
bold?: boolean;
|
|
16
|
+
italic?: boolean;
|
|
17
|
+
underline?: boolean;
|
|
18
|
+
dim?: boolean;
|
|
19
|
+
}
|
|
12
20
|
export interface MergedStyle {
|
|
13
21
|
fg?: RGBA;
|
|
14
22
|
bg?: RGBA;
|
|
@@ -36,9 +44,9 @@ export declare class SyntaxStyle {
|
|
|
36
44
|
constructor(lib: RenderLib, ptr: Pointer);
|
|
37
45
|
static create(): SyntaxStyle;
|
|
38
46
|
static fromTheme(theme: ThemeTokenStyle[]): SyntaxStyle;
|
|
39
|
-
static fromStyles(styles: Record<string,
|
|
47
|
+
static fromStyles(styles: Record<string, StyleDefinitionInput>): SyntaxStyle;
|
|
40
48
|
private guard;
|
|
41
|
-
registerStyle(name: string, style:
|
|
49
|
+
registerStyle(name: string, style: StyleDefinitionInput): number;
|
|
42
50
|
resolveStyleId(name: string): number | null;
|
|
43
51
|
getStyleId(name: string): number | null;
|
|
44
52
|
get ptr(): Pointer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CliRenderer } from "../renderer.js";
|
|
2
|
+
import type { TerminalCapabilities, TerminalInfo } from "../types.js";
|
|
3
|
+
export interface TerminalCapabilitiesOverrides extends Partial<Omit<TerminalCapabilities, "terminal">> {
|
|
4
|
+
terminal?: Partial<TerminalInfo>;
|
|
5
|
+
}
|
|
6
|
+
export declare function createTerminalCapabilities(overrides?: TerminalCapabilitiesOverrides): TerminalCapabilities;
|
|
7
|
+
export declare function setRendererCapabilities(renderer: CliRenderer, overrides?: TerminalCapabilitiesOverrides): TerminalCapabilities;
|
|
@@ -5,8 +5,8 @@ export interface RecordBuffersOptions {
|
|
|
5
5
|
attributes?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export interface RecordedBuffers {
|
|
8
|
-
fg?:
|
|
9
|
-
bg?:
|
|
8
|
+
fg?: Uint16Array;
|
|
9
|
+
bg?: Uint16Array;
|
|
10
10
|
attributes?: Uint8Array;
|
|
11
11
|
}
|
|
12
12
|
export interface RecordedFrame {
|
|
@@ -20,7 +20,7 @@ export interface TestRecorderOptions {
|
|
|
20
20
|
now?: () => number;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* TestRecorder records frames from a TestRenderer by
|
|
23
|
+
* TestRecorder records frames from a TestRenderer by listening to rendered frame events.
|
|
24
24
|
* It captures the character frame after each native render pass.
|
|
25
25
|
*/
|
|
26
26
|
export declare class TestRecorder {
|
|
@@ -29,17 +29,17 @@ export declare class TestRecorder {
|
|
|
29
29
|
private recording;
|
|
30
30
|
private frameNumber;
|
|
31
31
|
private startTime;
|
|
32
|
-
private originalRenderNative?;
|
|
33
32
|
private decoder;
|
|
34
33
|
private recordBuffers;
|
|
35
34
|
private now;
|
|
35
|
+
private readonly onFrame;
|
|
36
36
|
constructor(renderer: TestRenderer, options?: TestRecorderOptions);
|
|
37
37
|
/**
|
|
38
|
-
* Start recording frames.
|
|
38
|
+
* Start recording frames.
|
|
39
39
|
*/
|
|
40
40
|
rec(): void;
|
|
41
41
|
/**
|
|
42
|
-
* Stop recording frames
|
|
42
|
+
* Stop recording frames.
|
|
43
43
|
*/
|
|
44
44
|
stop(): void;
|
|
45
45
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CliRenderer, type CliRendererConfig } from "../renderer.js";
|
|
2
|
+
import { type NativeRenderStats } from "../zig.js";
|
|
2
3
|
import { createMockKeys } from "./mock-keys.js";
|
|
3
4
|
import { createMockMouse } from "./mock-mouse.js";
|
|
4
5
|
import type { CapturedFrame } from "../types.js";
|
|
@@ -12,12 +13,43 @@ export interface TestRenderer extends CliRenderer {
|
|
|
12
13
|
}
|
|
13
14
|
export type MockInput = ReturnType<typeof createMockKeys>;
|
|
14
15
|
export type MockMouse = ReturnType<typeof createMockMouse>;
|
|
15
|
-
export
|
|
16
|
+
export interface TestFlushOptions {
|
|
17
|
+
maxPasses?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface TestVisualIdleOptions {
|
|
20
|
+
quietFrames?: number;
|
|
21
|
+
maxFrames?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface TestWaitForOptions {
|
|
24
|
+
maxPasses?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface TestExternalOutputCommit {
|
|
27
|
+
text: string;
|
|
28
|
+
rows: string[];
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
rowColumns: number;
|
|
32
|
+
startOnNewLine: boolean;
|
|
33
|
+
trailingNewline: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface TestExternalOutput {
|
|
36
|
+
take(): TestExternalOutputCommit[];
|
|
37
|
+
takeText(): string;
|
|
38
|
+
clear(): void;
|
|
39
|
+
}
|
|
40
|
+
export interface TestRendererSetup {
|
|
16
41
|
renderer: TestRenderer;
|
|
17
42
|
mockInput: MockInput;
|
|
18
43
|
mockMouse: MockMouse;
|
|
19
44
|
renderOnce: () => Promise<void>;
|
|
45
|
+
flush: (options?: TestFlushOptions) => Promise<void>;
|
|
46
|
+
waitFor: (predicate: () => boolean | Promise<boolean>, options?: TestWaitForOptions) => Promise<void>;
|
|
47
|
+
waitForFrame: (predicate: (frame: string) => boolean | Promise<boolean>, options?: TestWaitForOptions) => Promise<string>;
|
|
48
|
+
waitForVisualIdle: (options?: TestVisualIdleOptions) => Promise<void>;
|
|
49
|
+
externalOutput: TestExternalOutput;
|
|
50
|
+
getNativeStats: () => NativeRenderStats;
|
|
20
51
|
captureCharFrame: () => string;
|
|
21
52
|
captureSpans: () => CapturedFrame;
|
|
22
53
|
resize: (width: number, height: number) => void;
|
|
23
|
-
}
|
|
54
|
+
}
|
|
55
|
+
export declare function createTestRenderer(options: TestRendererOptions): Promise<TestRendererSetup>;
|
package/testing.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ export * from "./testing/test-renderer.js";
|
|
|
2
2
|
export * from "./testing/mock-keys.js";
|
|
3
3
|
export * from "./testing/mock-mouse.js";
|
|
4
4
|
export * from "./testing/mock-tree-sitter-client.js";
|
|
5
|
+
export * from "./testing/terminal-capabilities.js";
|
|
5
6
|
export * from "./testing/spy.js";
|
|
7
|
+
export { ManualClock } from "./testing/manual-clock.js";
|
|
6
8
|
export { TestRecorder, type RecordedFrame } from "./testing/test-recorder.js";
|