@opentui/core 0.1.92 → 0.1.94
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/3d.js +1 -1
- package/{index-jdn8a604.js → index-t2rqapaa.js} +48 -5
- package/{index-jdn8a604.js.map → index-t2rqapaa.js.map} +4 -4
- package/{index-j5fb4966.js → index-t7fkn9sh.js} +3 -3
- package/{index-mdxq0qtt.js → index-wv534m5j.js} +254 -117
- package/{index-mdxq0qtt.js.map → index-wv534m5j.js.map} +6 -6
- package/index.js +2 -2
- package/lib/stdin-parser.d.ts +1 -0
- package/package.json +7 -7
- package/renderables/LineNumberRenderable.d.ts +4 -0
- package/renderer.d.ts +28 -11
- package/runtime-plugin-support.js +3 -3
- package/runtime-plugin.js +3 -3
- package/testing.js +28 -11
- package/testing.js.map +3 -3
- /package/{index-j5fb4966.js.map → index-t7fkn9sh.js.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
exports_src
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-t2rqapaa.js";
|
|
5
5
|
import {
|
|
6
6
|
__require
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-wv534m5j.js";
|
|
8
8
|
|
|
9
9
|
// src/runtime-plugin.ts
|
|
10
10
|
var CORE_RUNTIME_SPECIFIER = "@opentui/core";
|
|
@@ -185,4 +185,4 @@ function createRuntimePlugin(input = {}) {
|
|
|
185
185
|
export { isCoreRuntimeModuleSpecifier, runtimeModuleIdForSpecifier, createRuntimePlugin };
|
|
186
186
|
|
|
187
187
|
//# debugId=320B34A5E2C7118F64756E2164756E21
|
|
188
|
-
//# sourceMappingURL=index-
|
|
188
|
+
//# sourceMappingURL=index-t7fkn9sh.js.map
|
|
@@ -6843,7 +6843,7 @@ var env = new Proxy({}, {
|
|
|
6843
6843
|
|
|
6844
6844
|
// src/lib/stdin-parser.ts
|
|
6845
6845
|
import { Buffer as Buffer3 } from "buffer";
|
|
6846
|
-
var DEFAULT_TIMEOUT_MS =
|
|
6846
|
+
var DEFAULT_TIMEOUT_MS = 20;
|
|
6847
6847
|
var DEFAULT_MAX_PENDING_BYTES = 64 * 1024;
|
|
6848
6848
|
var INITIAL_PENDING_CAPACITY = 256;
|
|
6849
6849
|
var ESC = 27;
|
|
@@ -7014,6 +7014,28 @@ function parsePositiveDecimalPrefix(sequence, start, endExclusive) {
|
|
|
7014
7014
|
}
|
|
7015
7015
|
return sawDigit ? value : null;
|
|
7016
7016
|
}
|
|
7017
|
+
function parseKittyFirstFieldCodepoint(sequence, start, endExclusive) {
|
|
7018
|
+
if (start >= endExclusive)
|
|
7019
|
+
return null;
|
|
7020
|
+
let firstColon = -1;
|
|
7021
|
+
for (let index = start;index < endExclusive; index += 1) {
|
|
7022
|
+
if (sequence[index] === 58) {
|
|
7023
|
+
firstColon = index;
|
|
7024
|
+
break;
|
|
7025
|
+
}
|
|
7026
|
+
}
|
|
7027
|
+
if (firstColon === -1)
|
|
7028
|
+
return null;
|
|
7029
|
+
const codepoint = parsePositiveDecimalPrefix(sequence, start, firstColon);
|
|
7030
|
+
if (codepoint === null)
|
|
7031
|
+
return null;
|
|
7032
|
+
for (let index = firstColon + 1;index < endExclusive; index += 1) {
|
|
7033
|
+
const byte = sequence[index];
|
|
7034
|
+
if (byte !== 58 && !isAsciiDigit(byte))
|
|
7035
|
+
return null;
|
|
7036
|
+
}
|
|
7037
|
+
return codepoint;
|
|
7038
|
+
}
|
|
7017
7039
|
function canStillBeKittyU(state) {
|
|
7018
7040
|
return state.semicolons >= 1;
|
|
7019
7041
|
}
|
|
@@ -7215,10 +7237,13 @@ class StdinParser {
|
|
|
7215
7237
|
}
|
|
7216
7238
|
flushTimeout(nowMsValue = this.clock.now()) {
|
|
7217
7239
|
this.ensureAlive();
|
|
7218
|
-
if (this.
|
|
7240
|
+
if (this.pendingSinceMs !== null && (nowMsValue < this.pendingSinceMs || nowMsValue - this.pendingSinceMs < this.timeoutMs)) {
|
|
7219
7241
|
return;
|
|
7220
7242
|
}
|
|
7221
|
-
|
|
7243
|
+
this.tryForceFlush();
|
|
7244
|
+
}
|
|
7245
|
+
tryForceFlush() {
|
|
7246
|
+
if (this.paste || this.pendingSinceMs === null || this.pending.length === 0) {
|
|
7222
7247
|
return;
|
|
7223
7248
|
}
|
|
7224
7249
|
this.forceFlush = true;
|
|
@@ -7480,7 +7505,12 @@ class StdinParser {
|
|
|
7480
7505
|
continue;
|
|
7481
7506
|
}
|
|
7482
7507
|
if (byte === 59) {
|
|
7483
|
-
const
|
|
7508
|
+
const firstParamStart = this.unitStart + 2;
|
|
7509
|
+
const firstParamEnd = this.cursor;
|
|
7510
|
+
let firstParamValue = parsePositiveDecimalPrefix(bytes, firstParamStart, firstParamEnd);
|
|
7511
|
+
if (firstParamValue === null && this.protocolContext.kittyKeyboardEnabled) {
|
|
7512
|
+
firstParamValue = parseKittyFirstFieldCodepoint(bytes, firstParamStart, firstParamEnd);
|
|
7513
|
+
}
|
|
7484
7514
|
if (firstParamValue !== null) {
|
|
7485
7515
|
this.cursor += 1;
|
|
7486
7516
|
this.state = {
|
|
@@ -8078,7 +8108,7 @@ class StdinParser {
|
|
|
8078
8108
|
return;
|
|
8079
8109
|
}
|
|
8080
8110
|
try {
|
|
8081
|
-
this.
|
|
8111
|
+
this.tryForceFlush();
|
|
8082
8112
|
this.onTimeoutFlush?.();
|
|
8083
8113
|
} catch (error) {
|
|
8084
8114
|
console.error("stdin parser timeout flush failed", error);
|
|
@@ -14900,29 +14930,31 @@ class Renderable extends BaseRenderable {
|
|
|
14900
14930
|
return this._widthValue;
|
|
14901
14931
|
}
|
|
14902
14932
|
set width(value) {
|
|
14903
|
-
if (isDimensionType(value)) {
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14910
|
-
this.
|
|
14933
|
+
if (!isDimensionType(value) || this._width === value) {
|
|
14934
|
+
return;
|
|
14935
|
+
}
|
|
14936
|
+
this._width = value;
|
|
14937
|
+
this.yogaNode.setWidth(value);
|
|
14938
|
+
if (typeof value === "number" && this._flexShrink === 1) {
|
|
14939
|
+
this._flexShrink = 0;
|
|
14940
|
+
this.yogaNode.setFlexShrink(0);
|
|
14911
14941
|
}
|
|
14942
|
+
this.requestRender();
|
|
14912
14943
|
}
|
|
14913
14944
|
get height() {
|
|
14914
14945
|
return this._heightValue;
|
|
14915
14946
|
}
|
|
14916
14947
|
set height(value) {
|
|
14917
|
-
if (isDimensionType(value)) {
|
|
14918
|
-
|
|
14919
|
-
|
|
14920
|
-
|
|
14921
|
-
|
|
14922
|
-
|
|
14923
|
-
|
|
14924
|
-
this.
|
|
14948
|
+
if (!isDimensionType(value) || this._height === value) {
|
|
14949
|
+
return;
|
|
14950
|
+
}
|
|
14951
|
+
this._height = value;
|
|
14952
|
+
this.yogaNode.setHeight(value);
|
|
14953
|
+
if (typeof value === "number" && this._flexShrink === 1) {
|
|
14954
|
+
this._flexShrink = 0;
|
|
14955
|
+
this.yogaNode.setFlexShrink(0);
|
|
14925
14956
|
}
|
|
14957
|
+
this.requestRender();
|
|
14926
14958
|
}
|
|
14927
14959
|
get zIndex() {
|
|
14928
14960
|
return this._zIndex;
|
|
@@ -16150,7 +16182,6 @@ class TerminalConsoleCache extends EventEmitter7 {
|
|
|
16150
16182
|
if (this._originalConsole) {
|
|
16151
16183
|
global.console = this._originalConsole;
|
|
16152
16184
|
}
|
|
16153
|
-
this.setupConsoleCapture();
|
|
16154
16185
|
}
|
|
16155
16186
|
addLogEntry(level, ...args) {
|
|
16156
16187
|
const callerInfo = this._collectCallerInfo ? getCallerInfo() : null;
|
|
@@ -17209,25 +17240,25 @@ function parsePixelResolution(sequence) {
|
|
|
17209
17240
|
// src/renderer.ts
|
|
17210
17241
|
registerEnvVar({
|
|
17211
17242
|
name: "OTUI_DUMP_CAPTURES",
|
|
17212
|
-
description: "Dump captured
|
|
17243
|
+
description: "Dump captured stdout and console caches when the renderer exit handler runs.",
|
|
17213
17244
|
type: "boolean",
|
|
17214
17245
|
default: false
|
|
17215
17246
|
});
|
|
17216
17247
|
registerEnvVar({
|
|
17217
17248
|
name: "OTUI_NO_NATIVE_RENDER",
|
|
17218
|
-
description: "
|
|
17249
|
+
description: "Skip the Zig/native frame renderer. Useful for debugging the render loop; split-footer stdout flushing may still write ANSI.",
|
|
17219
17250
|
type: "boolean",
|
|
17220
17251
|
default: false
|
|
17221
17252
|
});
|
|
17222
17253
|
registerEnvVar({
|
|
17223
17254
|
name: "OTUI_USE_ALTERNATE_SCREEN",
|
|
17224
|
-
description: "
|
|
17255
|
+
description: "When explicitly set, force screen mode selection: true=alternate-screen, false=main-screen.",
|
|
17225
17256
|
type: "boolean",
|
|
17226
17257
|
default: true
|
|
17227
17258
|
});
|
|
17228
17259
|
registerEnvVar({
|
|
17229
17260
|
name: "OTUI_OVERRIDE_STDOUT",
|
|
17230
|
-
description: "
|
|
17261
|
+
description: "When explicitly set, force stdout routing: false=passthrough, true=capture in split-footer mode.",
|
|
17231
17262
|
type: "boolean",
|
|
17232
17263
|
default: true
|
|
17233
17264
|
});
|
|
@@ -17243,6 +17274,39 @@ registerEnvVar({
|
|
|
17243
17274
|
type: "boolean",
|
|
17244
17275
|
default: false
|
|
17245
17276
|
});
|
|
17277
|
+
var DEFAULT_FOOTER_HEIGHT = 12;
|
|
17278
|
+
function normalizeFooterHeight(footerHeight) {
|
|
17279
|
+
if (footerHeight === undefined) {
|
|
17280
|
+
return DEFAULT_FOOTER_HEIGHT;
|
|
17281
|
+
}
|
|
17282
|
+
if (!Number.isFinite(footerHeight)) {
|
|
17283
|
+
throw new Error("footerHeight must be a finite number");
|
|
17284
|
+
}
|
|
17285
|
+
const normalizedFooterHeight = Math.trunc(footerHeight);
|
|
17286
|
+
if (normalizedFooterHeight <= 0) {
|
|
17287
|
+
throw new Error("footerHeight must be greater than 0");
|
|
17288
|
+
}
|
|
17289
|
+
return normalizedFooterHeight;
|
|
17290
|
+
}
|
|
17291
|
+
function resolveModes(config) {
|
|
17292
|
+
let screenMode = config.screenMode ?? "alternate-screen";
|
|
17293
|
+
if (process.env.OTUI_USE_ALTERNATE_SCREEN !== undefined) {
|
|
17294
|
+
screenMode = env.OTUI_USE_ALTERNATE_SCREEN ? "alternate-screen" : "main-screen";
|
|
17295
|
+
}
|
|
17296
|
+
const footerHeight = screenMode === "split-footer" ? normalizeFooterHeight(config.footerHeight) : DEFAULT_FOOTER_HEIGHT;
|
|
17297
|
+
let externalOutputMode = config.externalOutputMode ?? (screenMode === "split-footer" ? "capture-stdout" : "passthrough");
|
|
17298
|
+
if (process.env.OTUI_OVERRIDE_STDOUT !== undefined) {
|
|
17299
|
+
externalOutputMode = env.OTUI_OVERRIDE_STDOUT && screenMode === "split-footer" ? "capture-stdout" : "passthrough";
|
|
17300
|
+
}
|
|
17301
|
+
if (externalOutputMode === "capture-stdout" && screenMode !== "split-footer") {
|
|
17302
|
+
throw new Error('externalOutputMode "capture-stdout" requires screenMode "split-footer"');
|
|
17303
|
+
}
|
|
17304
|
+
return {
|
|
17305
|
+
screenMode,
|
|
17306
|
+
footerHeight,
|
|
17307
|
+
externalOutputMode
|
|
17308
|
+
};
|
|
17309
|
+
}
|
|
17246
17310
|
var DEFAULT_FORWARDED_ENV_KEYS = [
|
|
17247
17311
|
"TMUX",
|
|
17248
17312
|
"TERM",
|
|
@@ -17360,9 +17424,10 @@ async function createCliRenderer(config = {}) {
|
|
|
17360
17424
|
}
|
|
17361
17425
|
const stdin = config.stdin || process.stdin;
|
|
17362
17426
|
const stdout = config.stdout || process.stdout;
|
|
17427
|
+
const { screenMode, footerHeight } = resolveModes(config);
|
|
17363
17428
|
const width = stdout.columns || 80;
|
|
17364
17429
|
const height = stdout.rows || 24;
|
|
17365
|
-
const renderHeight =
|
|
17430
|
+
const renderHeight = screenMode === "split-footer" ? footerHeight : height;
|
|
17366
17431
|
const ziglib = resolveRenderLib();
|
|
17367
17432
|
const rendererPtr = ziglib.createRenderer(width, renderHeight, {
|
|
17368
17433
|
remote: config.remote ?? false,
|
|
@@ -17421,11 +17486,12 @@ class CliRenderer extends EventEmitter8 {
|
|
|
17421
17486
|
_isDestroyed = false;
|
|
17422
17487
|
_destroyPending = false;
|
|
17423
17488
|
_destroyFinalized = false;
|
|
17489
|
+
_destroyCleanupPrepared = false;
|
|
17424
17490
|
nextRenderBuffer;
|
|
17425
17491
|
currentRenderBuffer;
|
|
17426
17492
|
_isRunning = false;
|
|
17427
|
-
|
|
17428
|
-
|
|
17493
|
+
_targetFps = 30;
|
|
17494
|
+
_maxFps = 60;
|
|
17429
17495
|
automaticMemorySnapshot = false;
|
|
17430
17496
|
memorySnapshotInterval;
|
|
17431
17497
|
memorySnapshotTimer = null;
|
|
@@ -17452,8 +17518,8 @@ class CliRenderer extends EventEmitter8 {
|
|
|
17452
17518
|
frameCount = 0;
|
|
17453
17519
|
lastFpsTime = 0;
|
|
17454
17520
|
currentFps = 0;
|
|
17455
|
-
targetFrameTime = 1000 / this.
|
|
17456
|
-
minTargetFrameTime = 1000 / this.
|
|
17521
|
+
targetFrameTime = 1000 / this._targetFps;
|
|
17522
|
+
minTargetFrameTime = 1000 / this._maxFps;
|
|
17457
17523
|
immediateRerenderRequested = false;
|
|
17458
17524
|
updateScheduled = false;
|
|
17459
17525
|
liveRequestCounter = 0;
|
|
@@ -17482,7 +17548,9 @@ class CliRenderer extends EventEmitter8 {
|
|
|
17482
17548
|
enableMouseMovement = false;
|
|
17483
17549
|
_useMouse = true;
|
|
17484
17550
|
autoFocus = true;
|
|
17485
|
-
|
|
17551
|
+
_screenMode = "alternate-screen";
|
|
17552
|
+
_footerHeight = DEFAULT_FOOTER_HEIGHT;
|
|
17553
|
+
_externalOutputMode = "passthrough";
|
|
17486
17554
|
_suspendedMouseEnabled = false;
|
|
17487
17555
|
_previousControlState = "idle" /* IDLE */;
|
|
17488
17556
|
capturedRenderable;
|
|
@@ -17581,13 +17649,9 @@ Captured output:
|
|
|
17581
17649
|
this.width = width;
|
|
17582
17650
|
this.height = height;
|
|
17583
17651
|
this._useThread = config.useThread === undefined ? false : config.useThread;
|
|
17584
|
-
|
|
17585
|
-
|
|
17586
|
-
|
|
17587
|
-
this.renderOffset = height - this._splitHeight;
|
|
17588
|
-
this.height = this._splitHeight;
|
|
17589
|
-
lib.setRenderOffset(rendererPtr, this.renderOffset);
|
|
17590
|
-
}
|
|
17652
|
+
const { screenMode, footerHeight, externalOutputMode } = resolveModes(config);
|
|
17653
|
+
this._footerHeight = footerHeight;
|
|
17654
|
+
this._screenMode = screenMode;
|
|
17591
17655
|
this.rendererPtr = rendererPtr;
|
|
17592
17656
|
const forwardEnvKeys = config.forwardEnvKeys ?? [...DEFAULT_FORWARDED_ENV_KEYS];
|
|
17593
17657
|
for (const key of forwardEnvKeys) {
|
|
@@ -17612,8 +17676,6 @@ Captured output:
|
|
|
17612
17676
|
this.resizeDebounceDelay = config.debounceDelay || 100;
|
|
17613
17677
|
this.targetFps = config.targetFps || 30;
|
|
17614
17678
|
this.maxFps = config.maxFps || 60;
|
|
17615
|
-
this.targetFrameTime = 1000 / this.targetFps;
|
|
17616
|
-
this.minTargetFrameTime = 1000 / this.maxFps;
|
|
17617
17679
|
this.clock = config.clock ?? new SystemClock;
|
|
17618
17680
|
this.memorySnapshotInterval = config.memorySnapshotInterval ?? 0;
|
|
17619
17681
|
this.gatherStats = config.gatherStats || false;
|
|
@@ -17621,7 +17683,6 @@ Captured output:
|
|
|
17621
17683
|
this.enableMouseMovement = config.enableMouseMovement ?? true;
|
|
17622
17684
|
this._useMouse = config.useMouse ?? true;
|
|
17623
17685
|
this.autoFocus = config.autoFocus ?? true;
|
|
17624
|
-
this._useAlternateScreen = config.useAlternateScreen ?? env.OTUI_USE_ALTERNATE_SCREEN;
|
|
17625
17686
|
this.nextRenderBuffer = this.lib.getNextBuffer(this.rendererPtr);
|
|
17626
17687
|
this.currentRenderBuffer = this.lib.getCurrentBuffer(this.rendererPtr);
|
|
17627
17688
|
this.postProcessFns = config.postProcessFns || [];
|
|
@@ -17630,9 +17691,6 @@ Captured output:
|
|
|
17630
17691
|
if (this.memorySnapshotInterval > 0) {
|
|
17631
17692
|
this.startMemorySnapshotTimer();
|
|
17632
17693
|
}
|
|
17633
|
-
if (env.OTUI_OVERRIDE_STDOUT) {
|
|
17634
|
-
this.stdout.write = this.interceptStdoutWrite.bind(this);
|
|
17635
|
-
}
|
|
17636
17694
|
process.on("SIGWINCH", this.sigwinchHandler);
|
|
17637
17695
|
process.on("warning", this.warningHandler);
|
|
17638
17696
|
process.on("uncaughtException", this.handleError);
|
|
@@ -17652,7 +17710,7 @@ Captured output:
|
|
|
17652
17710
|
this.addExitListeners();
|
|
17653
17711
|
const stdinParserMaxBufferBytes = config.stdinParserMaxBufferBytes ?? DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES;
|
|
17654
17712
|
this.stdinParser = new StdinParser({
|
|
17655
|
-
timeoutMs:
|
|
17713
|
+
timeoutMs: 20,
|
|
17656
17714
|
maxPendingBytes: stdinParserMaxBufferBytes,
|
|
17657
17715
|
armTimeouts: true,
|
|
17658
17716
|
onTimeoutFlush: () => {
|
|
@@ -17671,7 +17729,9 @@ Captured output:
|
|
|
17671
17729
|
...config.consoleOptions ?? {},
|
|
17672
17730
|
clock: this.clock
|
|
17673
17731
|
});
|
|
17674
|
-
this.
|
|
17732
|
+
this.consoleMode = config.consoleMode ?? "console-overlay";
|
|
17733
|
+
this.applyScreenMode(screenMode, false, false);
|
|
17734
|
+
this.externalOutputMode = externalOutputMode;
|
|
17675
17735
|
this._openConsoleOnError = config.openConsoleOnError ?? true;
|
|
17676
17736
|
this._onDestroy = config.onDestroy;
|
|
17677
17737
|
global.requestAnimationFrame = (callback) => {
|
|
@@ -17807,16 +17867,23 @@ Captured output:
|
|
|
17807
17867
|
}
|
|
17808
17868
|
}
|
|
17809
17869
|
async activateFrame() {
|
|
17810
|
-
|
|
17811
|
-
|
|
17812
|
-
|
|
17870
|
+
if (!this.updateScheduled) {
|
|
17871
|
+
this.resolveIdleIfNeeded();
|
|
17872
|
+
return;
|
|
17873
|
+
}
|
|
17874
|
+
try {
|
|
17875
|
+
await this.loop();
|
|
17876
|
+
} finally {
|
|
17877
|
+
this.updateScheduled = false;
|
|
17878
|
+
this.resolveIdleIfNeeded();
|
|
17879
|
+
}
|
|
17813
17880
|
}
|
|
17814
|
-
get
|
|
17815
|
-
return this._useConsole;
|
|
17881
|
+
get consoleMode() {
|
|
17882
|
+
return this._useConsole ? "console-overlay" : "disabled";
|
|
17816
17883
|
}
|
|
17817
|
-
set
|
|
17818
|
-
this._useConsole =
|
|
17819
|
-
if (
|
|
17884
|
+
set consoleMode(mode) {
|
|
17885
|
+
this._useConsole = mode === "console-overlay";
|
|
17886
|
+
if (this._useConsole) {
|
|
17820
17887
|
this.console.activate();
|
|
17821
17888
|
} else {
|
|
17822
17889
|
this.console.deactivate();
|
|
@@ -17866,6 +17933,20 @@ Captured output:
|
|
|
17866
17933
|
get useThread() {
|
|
17867
17934
|
return this._useThread;
|
|
17868
17935
|
}
|
|
17936
|
+
get targetFps() {
|
|
17937
|
+
return this._targetFps;
|
|
17938
|
+
}
|
|
17939
|
+
set targetFps(targetFps) {
|
|
17940
|
+
this._targetFps = targetFps;
|
|
17941
|
+
this.targetFrameTime = 1000 / this._targetFps;
|
|
17942
|
+
}
|
|
17943
|
+
get maxFps() {
|
|
17944
|
+
return this._maxFps;
|
|
17945
|
+
}
|
|
17946
|
+
set maxFps(maxFps) {
|
|
17947
|
+
this._maxFps = maxFps;
|
|
17948
|
+
this.minTargetFrameTime = 1000 / this._maxFps;
|
|
17949
|
+
}
|
|
17869
17950
|
get useMouse() {
|
|
17870
17951
|
return this._useMouse;
|
|
17871
17952
|
}
|
|
@@ -17879,8 +17960,37 @@ Captured output:
|
|
|
17879
17960
|
this.disableMouse();
|
|
17880
17961
|
}
|
|
17881
17962
|
}
|
|
17882
|
-
get
|
|
17883
|
-
return this.
|
|
17963
|
+
get screenMode() {
|
|
17964
|
+
return this._screenMode;
|
|
17965
|
+
}
|
|
17966
|
+
set screenMode(mode) {
|
|
17967
|
+
if (this.externalOutputMode === "capture-stdout" && mode !== "split-footer") {
|
|
17968
|
+
throw new Error('externalOutputMode "capture-stdout" requires screenMode "split-footer"');
|
|
17969
|
+
}
|
|
17970
|
+
this.applyScreenMode(mode);
|
|
17971
|
+
}
|
|
17972
|
+
get footerHeight() {
|
|
17973
|
+
return this._footerHeight;
|
|
17974
|
+
}
|
|
17975
|
+
set footerHeight(footerHeight) {
|
|
17976
|
+
const normalizedFooterHeight = normalizeFooterHeight(footerHeight);
|
|
17977
|
+
if (normalizedFooterHeight === this._footerHeight) {
|
|
17978
|
+
return;
|
|
17979
|
+
}
|
|
17980
|
+
this._footerHeight = normalizedFooterHeight;
|
|
17981
|
+
if (this.screenMode === "split-footer") {
|
|
17982
|
+
this.applyScreenMode("split-footer");
|
|
17983
|
+
}
|
|
17984
|
+
}
|
|
17985
|
+
get externalOutputMode() {
|
|
17986
|
+
return this._externalOutputMode;
|
|
17987
|
+
}
|
|
17988
|
+
set externalOutputMode(mode) {
|
|
17989
|
+
if (mode === "capture-stdout" && this.screenMode !== "split-footer") {
|
|
17990
|
+
throw new Error('externalOutputMode "capture-stdout" requires screenMode "split-footer"');
|
|
17991
|
+
}
|
|
17992
|
+
this._externalOutputMode = mode;
|
|
17993
|
+
this.stdout.write = mode === "capture-stdout" ? this.interceptStdoutWrite : this.realStdoutWrite;
|
|
17884
17994
|
}
|
|
17885
17995
|
get liveRequestCount() {
|
|
17886
17996
|
return this.liveRequestCounter;
|
|
@@ -17904,61 +18014,75 @@ Captured output:
|
|
|
17904
18014
|
const flags = use ? KITTY_FLAG_DISAMBIGUATE | KITTY_FLAG_ALTERNATE_KEYS : 0;
|
|
17905
18015
|
this.lib.setKittyKeyboardFlags(this.rendererPtr, flags);
|
|
17906
18016
|
}
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
|
|
18017
|
+
interceptStdoutWrite = (chunk, encoding, callback) => {
|
|
18018
|
+
const text = chunk.toString();
|
|
18019
|
+
capture.write("stdout", text);
|
|
18020
|
+
if (this._splitHeight > 0) {
|
|
18021
|
+
this.requestRender();
|
|
18022
|
+
}
|
|
18023
|
+
if (typeof callback === "function") {
|
|
18024
|
+
process.nextTick(callback);
|
|
18025
|
+
}
|
|
18026
|
+
return true;
|
|
18027
|
+
};
|
|
18028
|
+
applyScreenMode(screenMode, emitResize = true, requestRender = true) {
|
|
18029
|
+
const prevScreenMode = this._screenMode;
|
|
17910
18030
|
const prevSplitHeight = this._splitHeight;
|
|
17911
|
-
|
|
17912
|
-
|
|
17913
|
-
|
|
17914
|
-
|
|
17915
|
-
|
|
17916
|
-
|
|
17917
|
-
|
|
17918
|
-
|
|
18031
|
+
const nextSplitHeight = screenMode === "split-footer" ? this._footerHeight : 0;
|
|
18032
|
+
if (prevScreenMode === screenMode && prevSplitHeight === nextSplitHeight) {
|
|
18033
|
+
return;
|
|
18034
|
+
}
|
|
18035
|
+
const prevUseAlternateScreen = prevScreenMode === "alternate-screen";
|
|
18036
|
+
const nextUseAlternateScreen = screenMode === "alternate-screen";
|
|
18037
|
+
const terminalScreenModeChanged = this._terminalIsSetup && prevUseAlternateScreen !== nextUseAlternateScreen;
|
|
18038
|
+
const leavingSplitFooter = prevSplitHeight > 0 && nextSplitHeight === 0;
|
|
18039
|
+
if (this._terminalIsSetup && leavingSplitFooter) {
|
|
18040
|
+
this.flushStdoutCache(this._terminalHeight, true);
|
|
18041
|
+
}
|
|
18042
|
+
if (this._terminalIsSetup && !terminalScreenModeChanged) {
|
|
18043
|
+
if (prevSplitHeight === 0 && nextSplitHeight > 0) {
|
|
18044
|
+
const freedLines = this._terminalHeight - nextSplitHeight;
|
|
17919
18045
|
const scrollDown = ANSI.scrollDown(freedLines);
|
|
17920
18046
|
this.writeOut(scrollDown);
|
|
17921
|
-
} else if (prevSplitHeight >
|
|
17922
|
-
const freedLines = prevSplitHeight -
|
|
18047
|
+
} else if (prevSplitHeight > nextSplitHeight && nextSplitHeight > 0) {
|
|
18048
|
+
const freedLines = prevSplitHeight - nextSplitHeight;
|
|
17923
18049
|
const scrollDown = ANSI.scrollDown(freedLines);
|
|
17924
18050
|
this.writeOut(scrollDown);
|
|
17925
|
-
} else if (prevSplitHeight <
|
|
17926
|
-
const additionalLines =
|
|
18051
|
+
} else if (prevSplitHeight < nextSplitHeight && prevSplitHeight > 0) {
|
|
18052
|
+
const additionalLines = nextSplitHeight - prevSplitHeight;
|
|
17927
18053
|
const scrollUp = ANSI.scrollUp(additionalLines);
|
|
17928
18054
|
this.writeOut(scrollUp);
|
|
17929
18055
|
}
|
|
17930
|
-
} else {
|
|
17931
|
-
if (prevSplitHeight > 0) {
|
|
17932
|
-
this.flushStdoutCache(this._terminalHeight, true);
|
|
17933
|
-
capture.off("write", this.captureCallback);
|
|
17934
|
-
this.useConsole = true;
|
|
17935
|
-
}
|
|
17936
|
-
this._splitHeight = 0;
|
|
17937
|
-
this.renderOffset = 0;
|
|
17938
|
-
this.height = this._terminalHeight;
|
|
17939
18056
|
}
|
|
18057
|
+
if (prevSplitHeight === 0 && nextSplitHeight > 0) {
|
|
18058
|
+
capture.on("write", this.captureCallback);
|
|
18059
|
+
} else if (prevSplitHeight > 0 && nextSplitHeight === 0) {
|
|
18060
|
+
capture.off("write", this.captureCallback);
|
|
18061
|
+
}
|
|
18062
|
+
this._screenMode = screenMode;
|
|
18063
|
+
this._splitHeight = nextSplitHeight;
|
|
18064
|
+
this.renderOffset = nextSplitHeight > 0 ? this._terminalHeight - nextSplitHeight : 0;
|
|
17940
18065
|
this.width = this._terminalWidth;
|
|
18066
|
+
this.height = nextSplitHeight > 0 ? nextSplitHeight : this._terminalHeight;
|
|
17941
18067
|
this.lib.setRenderOffset(this.rendererPtr, this.renderOffset);
|
|
17942
18068
|
this.lib.resizeRenderer(this.rendererPtr, this.width, this.height);
|
|
17943
18069
|
this.nextRenderBuffer = this.lib.getNextBuffer(this.rendererPtr);
|
|
18070
|
+
this.currentRenderBuffer = this.lib.getCurrentBuffer(this.rendererPtr);
|
|
17944
18071
|
this._console.resize(this.width, this.height);
|
|
17945
18072
|
this.root.resize(this.width, this.height);
|
|
17946
|
-
|
|
17947
|
-
|
|
17948
|
-
|
|
17949
|
-
|
|
17950
|
-
|
|
17951
|
-
|
|
17952
|
-
if (this._splitHeight > 0) {
|
|
17953
|
-
this.requestRender();
|
|
18073
|
+
if (terminalScreenModeChanged) {
|
|
18074
|
+
this.lib.suspendRenderer(this.rendererPtr);
|
|
18075
|
+
this.lib.setupTerminal(this.rendererPtr, nextUseAlternateScreen);
|
|
18076
|
+
if (this._useMouse) {
|
|
18077
|
+
this.enableMouse();
|
|
18078
|
+
}
|
|
17954
18079
|
}
|
|
17955
|
-
if (
|
|
17956
|
-
|
|
18080
|
+
if (emitResize) {
|
|
18081
|
+
this.emit("resize" /* RESIZE */, this.width, this.height);
|
|
18082
|
+
}
|
|
18083
|
+
if (requestRender) {
|
|
18084
|
+
this.requestRender();
|
|
17957
18085
|
}
|
|
17958
|
-
return true;
|
|
17959
|
-
};
|
|
17960
|
-
disableStdoutInterception() {
|
|
17961
|
-
this.stdout.write = this.realStdoutWrite;
|
|
17962
18086
|
}
|
|
17963
18087
|
flushStdoutCache(space, force = false) {
|
|
17964
18088
|
if (capture.size === 0 && !force)
|
|
@@ -18012,7 +18136,7 @@ Captured output:
|
|
|
18012
18136
|
privateCapabilityRepliesActive: true,
|
|
18013
18137
|
explicitWidthCprActive: true
|
|
18014
18138
|
});
|
|
18015
|
-
this.lib.setupTerminal(this.rendererPtr, this.
|
|
18139
|
+
this.lib.setupTerminal(this.rendererPtr, this._screenMode === "alternate-screen");
|
|
18016
18140
|
this._capabilities = this.lib.getTerminalCapabilities(this.rendererPtr);
|
|
18017
18141
|
if (this.debugOverlay.enabled) {
|
|
18018
18142
|
this.lib.setDebugOverlay(this.rendererPtr, true, this.debugOverlay.corner);
|
|
@@ -18585,6 +18709,7 @@ Captured output:
|
|
|
18585
18709
|
internalStart() {
|
|
18586
18710
|
if (!this._isRunning && !this._isDestroyed) {
|
|
18587
18711
|
this._isRunning = true;
|
|
18712
|
+
this.updateScheduled = false;
|
|
18588
18713
|
if (this.memorySnapshotInterval > 0) {
|
|
18589
18714
|
this.startMemorySnapshotTimer();
|
|
18590
18715
|
}
|
|
@@ -18672,15 +18797,15 @@ Captured output:
|
|
|
18672
18797
|
this._isDestroyed = true;
|
|
18673
18798
|
this._destroyPending = true;
|
|
18674
18799
|
if (this.rendering) {
|
|
18800
|
+
this.prepareDestroyDuringRender();
|
|
18675
18801
|
return;
|
|
18676
18802
|
}
|
|
18677
18803
|
this.finalizeDestroy();
|
|
18678
18804
|
}
|
|
18679
|
-
|
|
18680
|
-
if (this.
|
|
18805
|
+
cleanupBeforeDestroy() {
|
|
18806
|
+
if (this._destroyCleanupPrepared)
|
|
18681
18807
|
return;
|
|
18682
|
-
this.
|
|
18683
|
-
this._destroyPending = false;
|
|
18808
|
+
this._destroyCleanupPrepared = true;
|
|
18684
18809
|
process.removeListener("SIGWINCH", this.sigwinchHandler);
|
|
18685
18810
|
process.removeListener("uncaughtException", this.handleError);
|
|
18686
18811
|
process.removeListener("unhandledRejection", this.handleError);
|
|
@@ -18698,14 +18823,8 @@ Captured output:
|
|
|
18698
18823
|
}
|
|
18699
18824
|
if (this.memorySnapshotTimer) {
|
|
18700
18825
|
this.clock.clearInterval(this.memorySnapshotTimer);
|
|
18826
|
+
this.memorySnapshotTimer = null;
|
|
18701
18827
|
}
|
|
18702
|
-
if (this._paletteDetector) {
|
|
18703
|
-
this._paletteDetector.cleanup();
|
|
18704
|
-
this._paletteDetector = null;
|
|
18705
|
-
}
|
|
18706
|
-
this._paletteDetectionPromise = null;
|
|
18707
|
-
this._cachedPalette = null;
|
|
18708
|
-
this.emit("destroy" /* DESTROY */);
|
|
18709
18828
|
if (this.renderTimeout) {
|
|
18710
18829
|
this.clock.clearTimeout(this.renderTimeout);
|
|
18711
18830
|
this.renderTimeout = null;
|
|
@@ -18718,23 +18837,41 @@ Captured output:
|
|
|
18718
18837
|
explicitWidthCprActive: false
|
|
18719
18838
|
}, true);
|
|
18720
18839
|
this.setCapturedRenderable(undefined);
|
|
18840
|
+
this.stdin.removeListener("data", this.stdinListener);
|
|
18841
|
+
if (this.stdin.setRawMode) {
|
|
18842
|
+
this.stdin.setRawMode(false);
|
|
18843
|
+
}
|
|
18844
|
+
this.externalOutputMode = "passthrough";
|
|
18845
|
+
if (this._splitHeight > 0) {
|
|
18846
|
+
this.flushStdoutCache(this._splitHeight, true);
|
|
18847
|
+
}
|
|
18848
|
+
}
|
|
18849
|
+
prepareDestroyDuringRender() {
|
|
18850
|
+
this.cleanupBeforeDestroy();
|
|
18851
|
+
this.lib.suspendRenderer(this.rendererPtr);
|
|
18852
|
+
}
|
|
18853
|
+
finalizeDestroy() {
|
|
18854
|
+
if (this._destroyFinalized)
|
|
18855
|
+
return;
|
|
18856
|
+
this._destroyFinalized = true;
|
|
18857
|
+
this._destroyPending = false;
|
|
18858
|
+
this.cleanupBeforeDestroy();
|
|
18859
|
+
if (this._paletteDetector) {
|
|
18860
|
+
this._paletteDetector.cleanup();
|
|
18861
|
+
this._paletteDetector = null;
|
|
18862
|
+
}
|
|
18863
|
+
this._paletteDetectionPromise = null;
|
|
18864
|
+
this._cachedPalette = null;
|
|
18865
|
+
this.emit("destroy" /* DESTROY */);
|
|
18721
18866
|
try {
|
|
18722
18867
|
this.root.destroyRecursively();
|
|
18723
18868
|
} catch (e) {
|
|
18724
18869
|
console.error("Error destroying root renderable:", e instanceof Error ? e.stack : String(e));
|
|
18725
18870
|
}
|
|
18726
|
-
this.stdin.removeListener("data", this.stdinListener);
|
|
18727
|
-
if (this.stdin.setRawMode) {
|
|
18728
|
-
this.stdin.setRawMode(false);
|
|
18729
|
-
}
|
|
18730
18871
|
this.stdinParser?.destroy();
|
|
18731
18872
|
this.stdinParser = null;
|
|
18732
18873
|
this.oscSubscribers.clear();
|
|
18733
18874
|
this._console.destroy();
|
|
18734
|
-
this.disableStdoutInterception();
|
|
18735
|
-
if (this._splitHeight > 0) {
|
|
18736
|
-
this.flushStdoutCache(this._splitHeight, true);
|
|
18737
|
-
}
|
|
18738
18875
|
this.lib.destroyRenderer(this.rendererPtr);
|
|
18739
18876
|
rendererTracker.removeRenderer(this);
|
|
18740
18877
|
if (this._onDestroy) {
|
|
@@ -19031,5 +19168,5 @@ Captured output:
|
|
|
19031
19168
|
|
|
19032
19169
|
export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, decodePasteBytes, stripAnsiSequences, detectLinks, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingKey, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
19033
19170
|
|
|
19034
|
-
//# debugId=
|
|
19035
|
-
//# sourceMappingURL=index-
|
|
19171
|
+
//# debugId=AAC1AF32CFE7F73F64756E2164756E21
|
|
19172
|
+
//# sourceMappingURL=index-wv534m5j.js.map
|