@opentui/core 0.5.1 → 0.5.2
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/{chunk-bun-83ry0rzt.js → chunk-bun-26r5c5w5.js} +833 -3
- package/{chunk-bun-83ry0rzt.js.map → chunk-bun-26r5c5w5.js.map} +8 -6
- package/{chunk-bun-8fkgaxc6.js → chunk-bun-t68f2fmr.js} +98 -26
- package/{chunk-bun-8fkgaxc6.js.map → chunk-bun-t68f2fmr.js.map} +4 -4
- package/{chunk-node-m23dbcww.js → chunk-node-aj3n20gq.js} +833 -3
- package/{chunk-node-m23dbcww.js.map → chunk-node-aj3n20gq.js.map} +8 -6
- package/{chunk-node-0yw3x5m7.js → chunk-node-kq7as74d.js} +98 -26
- package/{chunk-node-0yw3x5m7.js.map → chunk-node-kq7as74d.js.map} +4 -4
- package/image.d.ts +2 -0
- package/index.bun.js +49 -6
- package/index.bun.js.map +4 -4
- package/index.node.js +49 -6
- package/index.node.js.map +4 -4
- package/lib/clipboard.d.ts +119 -0
- package/lib/host-clipboard.internal.d.ts +22 -0
- package/lib/host-clipboard.native.d.ts +2 -0
- package/lib/tree-sitter/types.d.ts +1 -0
- package/package.json +9 -9
- package/parser.worker.js +6 -4
- package/parser.worker.js.map +3 -3
- package/renderables/Code.d.ts +7 -0
- package/renderables/Image.d.ts +5 -3
- package/renderer.d.ts +5 -2
- package/testing.bun.js +2 -2
- package/testing.js +2 -2
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig.d.ts +93 -0
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
toArrayBuffer,
|
|
41
41
|
treeSitterToTextChunks,
|
|
42
42
|
yoga_default
|
|
43
|
-
} from "./chunk-node-
|
|
43
|
+
} from "./chunk-node-aj3n20gq.js";
|
|
44
44
|
|
|
45
45
|
// src/Renderable.ts
|
|
46
46
|
import { EventEmitter } from "events";
|
|
@@ -3115,6 +3115,9 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3115
3115
|
_treeSitterClient;
|
|
3116
3116
|
_highlightsDirty = false;
|
|
3117
3117
|
_highlightSnapshotId = 0;
|
|
3118
|
+
_highlightLoopActive = false;
|
|
3119
|
+
_highlightPromise;
|
|
3120
|
+
_highlightRerun = false;
|
|
3118
3121
|
_conceal;
|
|
3119
3122
|
_drawUnstyledText;
|
|
3120
3123
|
_shouldRenderTextBuffer = true;
|
|
@@ -3161,11 +3164,14 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3161
3164
|
get content() {
|
|
3162
3165
|
return this._content;
|
|
3163
3166
|
}
|
|
3167
|
+
invalidateHighlights() {
|
|
3168
|
+
this._highlightsDirty = true;
|
|
3169
|
+
this._highlightSnapshotId++;
|
|
3170
|
+
}
|
|
3164
3171
|
set content(value) {
|
|
3165
3172
|
if (this._content !== value) {
|
|
3166
3173
|
this._content = value;
|
|
3167
|
-
this.
|
|
3168
|
-
this._highlightSnapshotId++;
|
|
3174
|
+
this.invalidateHighlights();
|
|
3169
3175
|
if (this._streaming && this._filetype && !this._drawUnstyledText) {
|
|
3170
3176
|
this.requestRender();
|
|
3171
3177
|
return;
|
|
@@ -3215,7 +3221,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3215
3221
|
set filetype(value) {
|
|
3216
3222
|
if (this._filetype !== value) {
|
|
3217
3223
|
this._filetype = value;
|
|
3218
|
-
this.
|
|
3224
|
+
this.invalidateHighlights();
|
|
3219
3225
|
}
|
|
3220
3226
|
}
|
|
3221
3227
|
get syntaxStyle() {
|
|
@@ -3224,7 +3230,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3224
3230
|
set syntaxStyle(value) {
|
|
3225
3231
|
if (this._syntaxStyle !== value) {
|
|
3226
3232
|
this._syntaxStyle = value;
|
|
3227
|
-
this.
|
|
3233
|
+
this.invalidateHighlights();
|
|
3228
3234
|
}
|
|
3229
3235
|
}
|
|
3230
3236
|
get conceal() {
|
|
@@ -3233,7 +3239,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3233
3239
|
set conceal(value) {
|
|
3234
3240
|
if (this._conceal !== value) {
|
|
3235
3241
|
this._conceal = value;
|
|
3236
|
-
this.
|
|
3242
|
+
this.invalidateHighlights();
|
|
3237
3243
|
}
|
|
3238
3244
|
}
|
|
3239
3245
|
get drawUnstyledText() {
|
|
@@ -3242,7 +3248,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3242
3248
|
set drawUnstyledText(value) {
|
|
3243
3249
|
if (this._drawUnstyledText !== value) {
|
|
3244
3250
|
this._drawUnstyledText = value;
|
|
3245
|
-
this.
|
|
3251
|
+
this.invalidateHighlights();
|
|
3246
3252
|
}
|
|
3247
3253
|
}
|
|
3248
3254
|
get streaming() {
|
|
@@ -3251,7 +3257,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3251
3257
|
set initialStyledText(value) {
|
|
3252
3258
|
if (this._initialStyledText !== value) {
|
|
3253
3259
|
this._initialStyledText = value;
|
|
3254
|
-
this.
|
|
3260
|
+
this.invalidateHighlights();
|
|
3255
3261
|
}
|
|
3256
3262
|
}
|
|
3257
3263
|
set streaming(value) {
|
|
@@ -3259,7 +3265,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3259
3265
|
this._streaming = value;
|
|
3260
3266
|
this._hadInitialContent = false;
|
|
3261
3267
|
this._lastHighlights = [];
|
|
3262
|
-
this.
|
|
3268
|
+
this.invalidateHighlights();
|
|
3263
3269
|
}
|
|
3264
3270
|
}
|
|
3265
3271
|
get treeSitterClient() {
|
|
@@ -3268,7 +3274,7 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3268
3274
|
set treeSitterClient(value) {
|
|
3269
3275
|
if (this._treeSitterClient !== value) {
|
|
3270
3276
|
this._treeSitterClient = value;
|
|
3271
|
-
this.
|
|
3277
|
+
this.invalidateHighlights();
|
|
3272
3278
|
}
|
|
3273
3279
|
}
|
|
3274
3280
|
get onHighlight() {
|
|
@@ -3280,13 +3286,13 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3280
3286
|
set baseHighlight(value) {
|
|
3281
3287
|
if (this._baseHighlight !== value) {
|
|
3282
3288
|
this._baseHighlight = value;
|
|
3283
|
-
this.
|
|
3289
|
+
this.invalidateHighlights();
|
|
3284
3290
|
}
|
|
3285
3291
|
}
|
|
3286
3292
|
set onHighlight(value) {
|
|
3287
3293
|
if (this._onHighlight !== value) {
|
|
3288
3294
|
this._onHighlight = value;
|
|
3289
|
-
this.
|
|
3295
|
+
this.invalidateHighlights();
|
|
3290
3296
|
}
|
|
3291
3297
|
}
|
|
3292
3298
|
get onChunks() {
|
|
@@ -3295,11 +3301,11 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3295
3301
|
set onChunks(value) {
|
|
3296
3302
|
if (this._onChunks !== value) {
|
|
3297
3303
|
this._onChunks = value;
|
|
3298
|
-
this.
|
|
3304
|
+
this.invalidateHighlights();
|
|
3299
3305
|
}
|
|
3300
3306
|
}
|
|
3301
3307
|
get isHighlighting() {
|
|
3302
|
-
return this._isHighlighting;
|
|
3308
|
+
return this._isHighlighting || this._highlightRerun;
|
|
3303
3309
|
}
|
|
3304
3310
|
get highlightingDone() {
|
|
3305
3311
|
return this._highlightingPromise;
|
|
@@ -3424,6 +3430,23 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3424
3430
|
this.requestRender();
|
|
3425
3431
|
}
|
|
3426
3432
|
}
|
|
3433
|
+
async runHighlights() {
|
|
3434
|
+
try {
|
|
3435
|
+
do {
|
|
3436
|
+
this._highlightRerun = false;
|
|
3437
|
+
await this.startHighlight();
|
|
3438
|
+
} while (this._highlightRerun && !this.isDestroyed && this._content.length > 0 && this._filetype);
|
|
3439
|
+
} finally {
|
|
3440
|
+
this._highlightLoopActive = false;
|
|
3441
|
+
this._highlightRerun = false;
|
|
3442
|
+
}
|
|
3443
|
+
}
|
|
3444
|
+
clearPendingHighlight() {
|
|
3445
|
+
this._highlightSnapshotId++;
|
|
3446
|
+
this._isHighlighting = false;
|
|
3447
|
+
this._highlightRerun = false;
|
|
3448
|
+
this._highlightingPromise = Promise.resolve();
|
|
3449
|
+
}
|
|
3427
3450
|
setRenderedLineSources(lineSources) {
|
|
3428
3451
|
this._renderedLineSources = lineSources;
|
|
3429
3452
|
this._mappedLineInfo = undefined;
|
|
@@ -3520,22 +3543,53 @@ class CodeRenderable extends TextBufferRenderable {
|
|
|
3520
3543
|
if (this._highlightsDirty) {
|
|
3521
3544
|
if (this.isDestroyed)
|
|
3522
3545
|
return;
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
this.
|
|
3526
|
-
} else if (!this._filetype) {
|
|
3527
|
-
this._shouldRenderTextBuffer = true;
|
|
3546
|
+
const hasContent = this._content.length > 0;
|
|
3547
|
+
if (!hasContent || !this._filetype) {
|
|
3548
|
+
this._shouldRenderTextBuffer = hasContent;
|
|
3528
3549
|
this._highlightsDirty = false;
|
|
3550
|
+
this.clearPendingHighlight();
|
|
3551
|
+
if (hasContent) {
|
|
3552
|
+
this.textBuffer.setText(this._content);
|
|
3553
|
+
this.setRenderedLineSources(undefined);
|
|
3554
|
+
this.updateTextInfo();
|
|
3555
|
+
}
|
|
3529
3556
|
} else {
|
|
3530
3557
|
this.ensureVisibleTextBeforeHighlight();
|
|
3531
3558
|
this._highlightsDirty = false;
|
|
3532
|
-
|
|
3559
|
+
if (this._highlightLoopActive) {
|
|
3560
|
+
this._isHighlighting = true;
|
|
3561
|
+
this._highlightRerun = true;
|
|
3562
|
+
this._highlightingPromise = this._highlightPromise;
|
|
3563
|
+
} else {
|
|
3564
|
+
const { promise: highlightingPromise, resolve, reject } = Promise.withResolvers();
|
|
3565
|
+
this._highlightLoopActive = true;
|
|
3566
|
+
this._highlightPromise = highlightingPromise;
|
|
3567
|
+
this._highlightingPromise = highlightingPromise;
|
|
3568
|
+
const clearHighlight = () => {
|
|
3569
|
+
if (this._highlightPromise === highlightingPromise) {
|
|
3570
|
+
this._highlightPromise = undefined;
|
|
3571
|
+
}
|
|
3572
|
+
};
|
|
3573
|
+
this.runHighlights().then(() => {
|
|
3574
|
+
clearHighlight();
|
|
3575
|
+
resolve();
|
|
3576
|
+
}, (error) => {
|
|
3577
|
+
clearHighlight();
|
|
3578
|
+
reject(error);
|
|
3579
|
+
});
|
|
3580
|
+
}
|
|
3533
3581
|
}
|
|
3534
3582
|
}
|
|
3535
3583
|
if (!this._shouldRenderTextBuffer)
|
|
3536
3584
|
return;
|
|
3537
3585
|
super.renderSelf(buffer);
|
|
3538
3586
|
}
|
|
3587
|
+
destroy() {
|
|
3588
|
+
if (this.isDestroyed)
|
|
3589
|
+
return;
|
|
3590
|
+
this.clearPendingHighlight();
|
|
3591
|
+
super.destroy();
|
|
3592
|
+
}
|
|
3539
3593
|
}
|
|
3540
3594
|
|
|
3541
3595
|
// src/renderables/TextNode.ts
|
|
@@ -6805,6 +6859,10 @@ class ScrollbackSnapshotRenderContext extends EventEmitter5 {
|
|
|
6805
6859
|
updateSelection(_currentRenderable, _x, _y, _options) {}
|
|
6806
6860
|
}
|
|
6807
6861
|
var DEFAULT_FORWARDED_ENV_KEYS = [
|
|
6862
|
+
"SSH_CONNECTION",
|
|
6863
|
+
"SSH_CLIENT",
|
|
6864
|
+
"SSH_TTY",
|
|
6865
|
+
"MOSH_CONNECTION",
|
|
6808
6866
|
"TMUX",
|
|
6809
6867
|
"ZELLIJ",
|
|
6810
6868
|
"ZELLIJ_SESSION_NAME",
|
|
@@ -7035,6 +7093,7 @@ class CliRenderer extends EventEmitter5 {
|
|
|
7035
7093
|
animationRequest = new Map;
|
|
7036
7094
|
resizeTimeoutId = null;
|
|
7037
7095
|
capabilityTimeoutId = null;
|
|
7096
|
+
terminalKeepAliveTimer = null;
|
|
7038
7097
|
xtVersionWaiters = new Set;
|
|
7039
7098
|
splitStartupSeedTimeoutId = null;
|
|
7040
7099
|
pendingSplitStartupCursorSeed = false;
|
|
@@ -7240,7 +7299,7 @@ Captured external output:
|
|
|
7240
7299
|
this.rendererPtr = rendererPtr;
|
|
7241
7300
|
this.clearOnShutdown = config.clearOnShutdown ?? true;
|
|
7242
7301
|
this.lib.setClearOnShutdown(this.rendererPtr, this.clearOnShutdown);
|
|
7243
|
-
const forwardEnvKeys = config.forwardEnvKeys ?? (
|
|
7302
|
+
const forwardEnvKeys = config.forwardEnvKeys ?? (remoteMode === true ? [] : [...DEFAULT_FORWARDED_ENV_KEYS]);
|
|
7244
7303
|
for (const key of forwardEnvKeys) {
|
|
7245
7304
|
const value = process.env[key];
|
|
7246
7305
|
if (value === undefined)
|
|
@@ -7254,8 +7313,8 @@ Captured external output:
|
|
|
7254
7313
|
"SIGQUIT",
|
|
7255
7314
|
"SIGABRT",
|
|
7256
7315
|
"SIGHUP",
|
|
7257
|
-
"SIGBREAK",
|
|
7258
7316
|
"SIGPIPE",
|
|
7317
|
+
"SIGBREAK",
|
|
7259
7318
|
"SIGBUS"
|
|
7260
7319
|
];
|
|
7261
7320
|
this.clipboard = new Clipboard(this.lib, this.rendererPtr);
|
|
@@ -7299,7 +7358,6 @@ Captured external output:
|
|
|
7299
7358
|
process.on("warning", this.warningHandler);
|
|
7300
7359
|
process.on("uncaughtException", this.handleError);
|
|
7301
7360
|
process.on("unhandledRejection", this.handleError);
|
|
7302
|
-
process.on("beforeExit", this.exitHandler);
|
|
7303
7361
|
const useKittyForParsing = kittyConfig !== null;
|
|
7304
7362
|
this._keyHandler = new InternalKeyHandler;
|
|
7305
7363
|
this._keyHandler.on("keypress", (event) => {
|
|
@@ -7383,6 +7441,17 @@ Captured external output:
|
|
|
7383
7441
|
});
|
|
7384
7442
|
this._exitListenersAdded = true;
|
|
7385
7443
|
}
|
|
7444
|
+
startTerminalKeepAlive() {
|
|
7445
|
+
if (this.stdin !== process.stdin || this.terminalKeepAliveTimer !== null)
|
|
7446
|
+
return;
|
|
7447
|
+
this.terminalKeepAliveTimer = setInterval(() => {}, 60000);
|
|
7448
|
+
}
|
|
7449
|
+
stopTerminalKeepAlive() {
|
|
7450
|
+
if (this.terminalKeepAliveTimer === null)
|
|
7451
|
+
return;
|
|
7452
|
+
clearInterval(this.terminalKeepAliveTimer);
|
|
7453
|
+
this.terminalKeepAliveTimer = null;
|
|
7454
|
+
}
|
|
7386
7455
|
removeExitListeners() {
|
|
7387
7456
|
if (!this._exitListenersAdded || this.exitSignals.length === 0)
|
|
7388
7457
|
return;
|
|
@@ -8953,6 +9022,7 @@ Captured external output:
|
|
|
8953
9022
|
}
|
|
8954
9023
|
this.stdin.on("data", this.stdinListener);
|
|
8955
9024
|
this.stdin.resume();
|
|
9025
|
+
this.startTerminalKeepAlive();
|
|
8956
9026
|
}
|
|
8957
9027
|
dispatchMouseEvent(target, attributes) {
|
|
8958
9028
|
const event = new MouseEvent(target, attributes);
|
|
@@ -9425,6 +9495,7 @@ Captured external output:
|
|
|
9425
9495
|
else
|
|
9426
9496
|
this.stdinParser?.reset();
|
|
9427
9497
|
this.stdin.removeListener("data", this.stdinListener);
|
|
9498
|
+
this.stopTerminalKeepAlive();
|
|
9428
9499
|
this.themeModeState.cancelRefresh();
|
|
9429
9500
|
this.lib.suspendRenderer(this.rendererPtr);
|
|
9430
9501
|
if (this.stdin.setRawMode) {
|
|
@@ -9445,6 +9516,7 @@ Captured external output:
|
|
|
9445
9516
|
this.stdinParser?.reset();
|
|
9446
9517
|
this.stdin.on("data", this.stdinListener);
|
|
9447
9518
|
this.stdin.resume();
|
|
9519
|
+
this.startTerminalKeepAlive();
|
|
9448
9520
|
this.addExitListeners();
|
|
9449
9521
|
const resumePreservedNonAltSurface = this.pendingSuspendedTerminalSetup && this._screenMode !== "alternate-screen" && this.suspendedNonAltSurfacePreserved && this.renderOffset > 0;
|
|
9450
9522
|
if (this.pendingSuspendedTerminalSetup) {
|
|
@@ -9528,7 +9600,6 @@ Captured external output:
|
|
|
9528
9600
|
process.removeListener("uncaughtException", this.handleError);
|
|
9529
9601
|
process.removeListener("unhandledRejection", this.handleError);
|
|
9530
9602
|
process.removeListener("warning", this.warningHandler);
|
|
9531
|
-
process.removeListener("beforeExit", this.exitHandler);
|
|
9532
9603
|
this.removeExitListeners();
|
|
9533
9604
|
if (this.resizeTimeoutId !== null) {
|
|
9534
9605
|
this.clock.clearTimeout(this.resizeTimeoutId);
|
|
@@ -9560,6 +9631,7 @@ Captured external output:
|
|
|
9560
9631
|
this._useMouse = false;
|
|
9561
9632
|
this.setCapturedRenderable(undefined);
|
|
9562
9633
|
this.stdin.removeListener("data", this.stdinListener);
|
|
9634
|
+
this.stopTerminalKeepAlive();
|
|
9563
9635
|
if (this.stdin.setRawMode) {
|
|
9564
9636
|
try {
|
|
9565
9637
|
this.stdin.setRawMode(false);
|
|
@@ -10152,5 +10224,5 @@ Captured external output:
|
|
|
10152
10224
|
|
|
10153
10225
|
export { h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, TextBufferView, EditBuffer, EditorView, convertThemeToStyles, SyntaxStyle, ANSI, BoxRenderable, TextBufferRenderable, CodeRenderable, isTextNodeRenderable, TextNodeRenderable, RootTextNodeRenderable, TextRenderable, NativeSpanFeed, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingAction, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, EditBufferRenderableEvents, isEditBufferRenderable, EditBufferRenderable, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
|
|
10154
10226
|
|
|
10155
|
-
//# debugId=
|
|
10156
|
-
//# sourceMappingURL=chunk-node-
|
|
10227
|
+
//# debugId=58E1FA06080F555B64756E2164756E21
|
|
10228
|
+
//# sourceMappingURL=chunk-node-kq7as74d.js.map
|