@opentui/core 0.4.5 → 0.5.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.
- package/README.md +4 -4
- package/Renderable.d.ts +3 -0
- package/audio.d.ts +202 -1
- package/buffer.d.ts +3 -0
- package/{chunk-bun-t2myhmwd.js → chunk-bun-83ry0rzt.js} +1212 -152
- package/chunk-bun-83ry0rzt.js.map +62 -0
- package/{chunk-bun-tkm837n2.js → chunk-bun-8fkgaxc6.js} +147 -37
- package/chunk-bun-8fkgaxc6.js.map +32 -0
- package/{chunk-node-51kpf0mz.js → chunk-node-0yw3x5m7.js} +147 -37
- package/chunk-node-0yw3x5m7.js.map +32 -0
- package/{chunk-node-q0cwyvm9.js → chunk-node-m23dbcww.js} +1212 -152
- package/chunk-node-m23dbcww.js.map +61 -0
- package/image.d.ts +105 -0
- package/index.bun.js +2137 -89
- package/index.bun.js.map +6 -4
- package/index.d.ts +1 -0
- package/index.node.js +2137 -89
- package/index.node.js.map +7 -3
- package/lib/env.d.ts +1 -0
- package/lib/stdin-parser.d.ts +5 -0
- package/node-assets.js +5 -2
- package/node-assets.js.map +3 -3
- package/package.json +10 -10
- package/parser.worker.js +5 -2
- package/parser.worker.js.map +3 -3
- package/platform/ffi.d.ts +2 -0
- package/renderables/Image.d.ts +44 -0
- package/renderables/index.d.ts +1 -0
- package/renderer.d.ts +14 -0
- package/testing.bun.js +4 -3
- package/testing.bun.js.map +3 -3
- package/testing.js +4 -3
- package/testing.js.map +3 -3
- package/tests/image-icc-allocation-child.d.ts +1 -0
- package/text-buffer-view.d.ts +2 -5
- package/types.d.ts +8 -0
- package/yoga.bun.js +1 -1
- package/yoga.js +1 -1
- package/zig-structs.d.ts +45 -24
- package/zig.d.ts +74 -7
- package/chunk-bun-t2myhmwd.js.map +0 -62
- package/chunk-bun-tkm837n2.js.map +0 -32
- package/chunk-node-51kpf0mz.js.map +0 -32
- package/chunk-node-q0cwyvm9.js.map +0 -61
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
toArrayBuffer,
|
|
41
41
|
treeSitterToTextChunks,
|
|
42
42
|
yoga_default
|
|
43
|
-
} from "./chunk-node-
|
|
43
|
+
} from "./chunk-node-m23dbcww.js";
|
|
44
44
|
|
|
45
45
|
// src/Renderable.ts
|
|
46
46
|
import { EventEmitter } from "events";
|
|
@@ -1256,6 +1256,7 @@ class Renderable extends BaseRenderable {
|
|
|
1256
1256
|
}
|
|
1257
1257
|
destroySelf() {}
|
|
1258
1258
|
processMouseEvent(event) {
|
|
1259
|
+
event.currentTarget = this;
|
|
1259
1260
|
this._mouseListener?.call(this, event);
|
|
1260
1261
|
this._mouseListeners[event.type]?.call(this, event);
|
|
1261
1262
|
this.onMouseEvent(event);
|
|
@@ -1364,6 +1365,7 @@ class Renderable extends BaseRenderable {
|
|
|
1364
1365
|
|
|
1365
1366
|
class RootRenderable extends Renderable {
|
|
1366
1367
|
renderList = [];
|
|
1368
|
+
_currentRenderable;
|
|
1367
1369
|
appliedLayoutGeneration = -1;
|
|
1368
1370
|
appliedRenderListRevision = -1;
|
|
1369
1371
|
renderListReusable = false;
|
|
@@ -1385,7 +1387,16 @@ class RootRenderable extends Renderable {
|
|
|
1385
1387
|
this.yogaNode.setFlexDirection(0 /* Column */);
|
|
1386
1388
|
this.calculateLayout();
|
|
1387
1389
|
}
|
|
1390
|
+
get currentRenderable() {
|
|
1391
|
+
return this._currentRenderable;
|
|
1392
|
+
}
|
|
1393
|
+
takeCurrentRenderable() {
|
|
1394
|
+
const renderable = this._currentRenderable;
|
|
1395
|
+
this._currentRenderable = undefined;
|
|
1396
|
+
return renderable;
|
|
1397
|
+
}
|
|
1388
1398
|
render(buffer, deltaTime) {
|
|
1399
|
+
this._currentRenderable = undefined;
|
|
1389
1400
|
if (!this.visible)
|
|
1390
1401
|
return;
|
|
1391
1402
|
for (const renderable of this._ctx.getLifecyclePasses()) {
|
|
@@ -1414,7 +1425,9 @@ class RootRenderable extends Renderable {
|
|
|
1414
1425
|
switch (command.action) {
|
|
1415
1426
|
case "render":
|
|
1416
1427
|
if (!command.renderable.isDestroyed) {
|
|
1428
|
+
this._currentRenderable = command.renderable;
|
|
1417
1429
|
command.renderable.render(buffer, deltaTime);
|
|
1430
|
+
this._currentRenderable = undefined;
|
|
1418
1431
|
}
|
|
1419
1432
|
break;
|
|
1420
1433
|
case "pushScissorRect":
|
|
@@ -6267,6 +6280,9 @@ class EditBufferRenderable extends Renderable {
|
|
|
6267
6280
|
}
|
|
6268
6281
|
}
|
|
6269
6282
|
|
|
6283
|
+
// src/renderer.ts
|
|
6284
|
+
import { appendFileSync, writeFileSync } from "node:fs";
|
|
6285
|
+
|
|
6270
6286
|
// src/ansi.ts
|
|
6271
6287
|
var ANSI = {
|
|
6272
6288
|
switchToAlternateScreen: "\x1B[?1049h",
|
|
@@ -6444,10 +6460,11 @@ function isPixelResolutionResponse(sequence) {
|
|
|
6444
6460
|
function parsePixelResolution(sequence) {
|
|
6445
6461
|
const match = sequence.match(/\x1b\[4;(\d+);(\d+)t/);
|
|
6446
6462
|
if (match) {
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6463
|
+
const width = Number(match[2]);
|
|
6464
|
+
const height = Number(match[1]);
|
|
6465
|
+
if (!Number.isSafeInteger(width) || !Number.isSafeInteger(height) || width > 2147483647 || height > 2147483647)
|
|
6466
|
+
return null;
|
|
6467
|
+
return { width, height };
|
|
6451
6468
|
}
|
|
6452
6469
|
return null;
|
|
6453
6470
|
}
|
|
@@ -6631,6 +6648,12 @@ registerEnvVar({
|
|
|
6631
6648
|
type: "boolean",
|
|
6632
6649
|
default: false
|
|
6633
6650
|
});
|
|
6651
|
+
registerEnvVar({
|
|
6652
|
+
name: "OTUI_STDIN_LOG",
|
|
6653
|
+
description: "Write the raw stdin byte stream to this file for debugging.",
|
|
6654
|
+
type: "string",
|
|
6655
|
+
default: ""
|
|
6656
|
+
});
|
|
6634
6657
|
registerEnvVar({
|
|
6635
6658
|
name: "OTUI_SHOW_STATS",
|
|
6636
6659
|
description: "Show the debug overlay at startup.",
|
|
@@ -6715,18 +6738,25 @@ var CHAR_FLAG_MASK = 3221225472 >>> 0;
|
|
|
6715
6738
|
class ScrollbackSnapshotRenderContext extends EventEmitter5 {
|
|
6716
6739
|
width;
|
|
6717
6740
|
height;
|
|
6741
|
+
terminalWidth;
|
|
6742
|
+
terminalHeight;
|
|
6743
|
+
resolution;
|
|
6718
6744
|
frameId = 0;
|
|
6719
6745
|
widthMethod;
|
|
6720
|
-
capabilities
|
|
6746
|
+
capabilities;
|
|
6721
6747
|
hasSelection = false;
|
|
6722
6748
|
currentFocusedRenderable = null;
|
|
6723
6749
|
keyInput;
|
|
6724
6750
|
_internalKeyInput;
|
|
6725
6751
|
lifecyclePasses = new Set;
|
|
6726
|
-
constructor(width, height, widthMethod) {
|
|
6752
|
+
constructor(width, height, widthMethod, terminalWidth = width, terminalHeight = height, resolution = null, capabilities = null) {
|
|
6727
6753
|
super();
|
|
6728
6754
|
this.width = width;
|
|
6729
6755
|
this.height = height;
|
|
6756
|
+
this.terminalWidth = terminalWidth;
|
|
6757
|
+
this.terminalHeight = terminalHeight;
|
|
6758
|
+
this.resolution = resolution;
|
|
6759
|
+
this.capabilities = capabilities;
|
|
6730
6760
|
this.widthMethod = widthMethod;
|
|
6731
6761
|
this.keyInput = new KeyHandler;
|
|
6732
6762
|
this._internalKeyInput = new InternalKeyHandler;
|
|
@@ -6781,6 +6811,7 @@ var DEFAULT_FORWARDED_ENV_KEYS = [
|
|
|
6781
6811
|
"ZELLIJ_PANE_ID",
|
|
6782
6812
|
"TERM",
|
|
6783
6813
|
"OPENTUI_GRAPHICS",
|
|
6814
|
+
"OPENTUI_IMAGE_PROTOCOL",
|
|
6784
6815
|
"TERM_PROGRAM",
|
|
6785
6816
|
"TERM_PROGRAM_VERSION",
|
|
6786
6817
|
"TERM_FEATURES",
|
|
@@ -6841,6 +6872,7 @@ class MouseEvent {
|
|
|
6841
6872
|
modifiers;
|
|
6842
6873
|
scroll;
|
|
6843
6874
|
target;
|
|
6875
|
+
currentTarget = null;
|
|
6844
6876
|
isDragging;
|
|
6845
6877
|
_propagationStopped = false;
|
|
6846
6878
|
_defaultPrevented = false;
|
|
@@ -6905,6 +6937,8 @@ var CliRenderEvents;
|
|
|
6905
6937
|
((CliRenderEvents2) => {
|
|
6906
6938
|
CliRenderEvents2["RESIZE"] = "resize";
|
|
6907
6939
|
CliRenderEvents2["FRAME"] = "frame";
|
|
6940
|
+
CliRenderEvents2["RENDER_ERROR"] = "render:error";
|
|
6941
|
+
CliRenderEvents2["HANDLER_ERROR"] = "handler:error";
|
|
6908
6942
|
CliRenderEvents2["EXTERNAL_OUTPUT"] = "external_output";
|
|
6909
6943
|
CliRenderEvents2["FOCUS"] = "focus";
|
|
6910
6944
|
CliRenderEvents2["BLUR"] = "blur";
|
|
@@ -6965,6 +6999,7 @@ class CliRenderer extends EventEmitter5 {
|
|
|
6965
6999
|
postProcessFns = [];
|
|
6966
7000
|
backgroundColor = RGBA.fromInts(0, 0, 0, 0);
|
|
6967
7001
|
waitingForPixelResolution = false;
|
|
7002
|
+
pixelResolutionRequeryPending = false;
|
|
6968
7003
|
clock;
|
|
6969
7004
|
rendering = false;
|
|
6970
7005
|
renderingNative = false;
|
|
@@ -7069,6 +7104,7 @@ class CliRenderer extends EventEmitter5 {
|
|
|
7069
7104
|
idleResolvers = [];
|
|
7070
7105
|
_debugInputs = [];
|
|
7071
7106
|
_debugModeEnabled = env.OTUI_DEBUG;
|
|
7107
|
+
stdinLogPath = env.OTUI_STDIN_LOG;
|
|
7072
7108
|
handleError = ((error) => {
|
|
7073
7109
|
console.error(error);
|
|
7074
7110
|
if (this._openConsoleOnError) {
|
|
@@ -7802,7 +7838,7 @@ Captured external output:
|
|
|
7802
7838
|
const startOnNewLine = options.startOnNewLine ?? true;
|
|
7803
7839
|
const tailColumn = renderer.getPendingSplitTailColumn();
|
|
7804
7840
|
const firstLineOffset = !startOnNewLine && tailColumn > 0 && tailColumn < renderer.width ? tailColumn : 0;
|
|
7805
|
-
const snapshotContext = new ScrollbackSnapshotRenderContext(renderer.width, 1, renderer.widthMethod);
|
|
7841
|
+
const snapshotContext = new ScrollbackSnapshotRenderContext(renderer.width, 1, renderer.widthMethod, renderer._terminalWidth, renderer._terminalHeight, renderer.resolution, renderer.capabilities);
|
|
7806
7842
|
let firstLineOffsetOwner = null;
|
|
7807
7843
|
const renderContext = Object.create(snapshotContext);
|
|
7808
7844
|
Object.defineProperty(renderContext, "claimFirstLineOffset", {
|
|
@@ -7836,6 +7872,10 @@ Captured external output:
|
|
|
7836
7872
|
let surfaceWidth = renderer.width;
|
|
7837
7873
|
let surfaceHeight = 1;
|
|
7838
7874
|
let surfaceWidthMethod = renderer.widthMethod;
|
|
7875
|
+
let surfaceTerminalWidth = renderer._terminalWidth;
|
|
7876
|
+
let surfaceTerminalHeight = renderer._terminalHeight;
|
|
7877
|
+
let surfaceResolutionWidth = renderer.resolution?.width ?? null;
|
|
7878
|
+
let surfaceResolutionHeight = renderer.resolution?.height ?? null;
|
|
7839
7879
|
let surfaceDestroyed = false;
|
|
7840
7880
|
let hasRendered = false;
|
|
7841
7881
|
let nextCommitStartOnNewLine = startOnNewLine;
|
|
@@ -7856,7 +7896,7 @@ Captured external output:
|
|
|
7856
7896
|
}
|
|
7857
7897
|
};
|
|
7858
7898
|
const assertGeometryStillCurrent = () => {
|
|
7859
|
-
if (renderer.width !== surfaceWidth || renderer.widthMethod !== surfaceWidthMethod) {
|
|
7899
|
+
if (renderer.width !== surfaceWidth || renderer.widthMethod !== surfaceWidthMethod || renderer._terminalWidth !== surfaceTerminalWidth || renderer._terminalHeight !== surfaceTerminalHeight || (renderer.resolution?.width ?? null) !== surfaceResolutionWidth || (renderer.resolution?.height ?? null) !== surfaceResolutionHeight) {
|
|
7860
7900
|
throw new Error("ScrollbackSurface.commitRows requires render() after renderer geometry changes");
|
|
7861
7901
|
}
|
|
7862
7902
|
};
|
|
@@ -7917,6 +7957,10 @@ Captured external output:
|
|
|
7917
7957
|
const widthMethod = renderer.widthMethod;
|
|
7918
7958
|
snapshotContext.width = width;
|
|
7919
7959
|
snapshotContext.widthMethod = widthMethod;
|
|
7960
|
+
snapshotContext.terminalWidth = renderer._terminalWidth;
|
|
7961
|
+
snapshotContext.terminalHeight = renderer._terminalHeight;
|
|
7962
|
+
snapshotContext.resolution = renderer.resolution;
|
|
7963
|
+
snapshotContext.capabilities = renderer.capabilities;
|
|
7920
7964
|
publicRoot.width = width;
|
|
7921
7965
|
const renderPass = (height) => {
|
|
7922
7966
|
snapshotContext.height = height;
|
|
@@ -7942,6 +7986,10 @@ Captured external output:
|
|
|
7942
7986
|
surfaceWidth = width;
|
|
7943
7987
|
surfaceHeight = measuredHeight;
|
|
7944
7988
|
surfaceWidthMethod = widthMethod;
|
|
7989
|
+
surfaceTerminalWidth = renderer._terminalWidth;
|
|
7990
|
+
surfaceTerminalHeight = renderer._terminalHeight;
|
|
7991
|
+
surfaceResolutionWidth = renderer.resolution?.width ?? null;
|
|
7992
|
+
surfaceResolutionHeight = renderer.resolution?.height ?? null;
|
|
7945
7993
|
hasRendered = true;
|
|
7946
7994
|
return;
|
|
7947
7995
|
}
|
|
@@ -7951,6 +7999,10 @@ Captured external output:
|
|
|
7951
7999
|
surfaceWidth = width;
|
|
7952
8000
|
surfaceHeight = targetHeight;
|
|
7953
8001
|
surfaceWidthMethod = widthMethod;
|
|
8002
|
+
surfaceTerminalWidth = renderer._terminalWidth;
|
|
8003
|
+
surfaceTerminalHeight = renderer._terminalHeight;
|
|
8004
|
+
surfaceResolutionWidth = renderer.resolution?.width ?? null;
|
|
8005
|
+
surfaceResolutionHeight = renderer.resolution?.height ?? null;
|
|
7954
8006
|
hasRendered = true;
|
|
7955
8007
|
};
|
|
7956
8008
|
const settleSurface = async (timeoutMs = 2000) => {
|
|
@@ -8050,7 +8102,7 @@ Captured external output:
|
|
|
8050
8102
|
if (this._screenMode !== "split-footer" || this._externalOutputMode !== "capture-stdout") {
|
|
8051
8103
|
throw new Error('writeToScrollback requires screenMode "split-footer" and externalOutputMode "capture-stdout"');
|
|
8052
8104
|
}
|
|
8053
|
-
const snapshotContext = new ScrollbackSnapshotRenderContext(this.width, this.height, this.widthMethod);
|
|
8105
|
+
const snapshotContext = new ScrollbackSnapshotRenderContext(this.width, this.height, this.widthMethod, this._terminalWidth, this._terminalHeight, this.resolution, this.capabilities);
|
|
8054
8106
|
const snapshot = write({
|
|
8055
8107
|
width: this.width,
|
|
8056
8108
|
widthMethod: this.widthMethod,
|
|
@@ -8225,7 +8277,7 @@ Captured external output:
|
|
|
8225
8277
|
}
|
|
8226
8278
|
}
|
|
8227
8279
|
createStdoutSnapshotCommit(line, trailingNewline) {
|
|
8228
|
-
const snapshotContext = new ScrollbackSnapshotRenderContext(this.width, 1, this.widthMethod);
|
|
8280
|
+
const snapshotContext = new ScrollbackSnapshotRenderContext(this.width, 1, this.widthMethod, this._terminalWidth, this._terminalHeight, this.resolution, this.capabilities);
|
|
8229
8281
|
const maxWidth = Math.max(1, this.width);
|
|
8230
8282
|
const lineCells = [...line];
|
|
8231
8283
|
const rowColumns = Math.min(lineCells.length, maxWidth);
|
|
@@ -8309,6 +8361,7 @@ Captured external output:
|
|
|
8309
8361
|
let acceptedCommits = 0;
|
|
8310
8362
|
let nativeBackpressured = false;
|
|
8311
8363
|
let nativeFailed = false;
|
|
8364
|
+
let nextRenderOffset = this.renderOffset;
|
|
8312
8365
|
for (const [index, commit] of commits.entries()) {
|
|
8313
8366
|
const forceCommit = forceFooterRepaint && index === lastCommitIndex;
|
|
8314
8367
|
const beginFrame = index === 0;
|
|
@@ -8322,14 +8375,10 @@ Captured external output:
|
|
|
8322
8375
|
nativeFailed = true;
|
|
8323
8376
|
break;
|
|
8324
8377
|
}
|
|
8325
|
-
|
|
8326
|
-
this.recordSplitCommit(commit);
|
|
8378
|
+
nextRenderOffset = nativeResult.renderOffset;
|
|
8327
8379
|
hasCommittedOutput = true;
|
|
8328
8380
|
acceptedCommits++;
|
|
8329
8381
|
}
|
|
8330
|
-
if (acceptedCommits > 0) {
|
|
8331
|
-
this.externalOutputQueue.drop(acceptedCommits);
|
|
8332
|
-
}
|
|
8333
8382
|
if (nativeFailed) {
|
|
8334
8383
|
return this.reportNativeRenderFailure();
|
|
8335
8384
|
}
|
|
@@ -8337,6 +8386,12 @@ Captured external output:
|
|
|
8337
8386
|
this.scheduleRenderAfterFeedIdle();
|
|
8338
8387
|
return "backpressured";
|
|
8339
8388
|
}
|
|
8389
|
+
if (acceptedCommits > 0) {
|
|
8390
|
+
this.renderOffset = nextRenderOffset;
|
|
8391
|
+
for (const commit of commits.slice(0, acceptedCommits))
|
|
8392
|
+
this.recordSplitCommit(commit);
|
|
8393
|
+
this.externalOutputQueue.drop(acceptedCommits);
|
|
8394
|
+
}
|
|
8340
8395
|
if (!hasCommittedOutput) {
|
|
8341
8396
|
const nativeResult = this.lib.repaintSplitFooter(this.rendererPtr, this.getSplitPinnedRenderOffset(), forceFooterRepaint);
|
|
8342
8397
|
if (nativeResult.status === NATIVE_RENDER_STATUS_SKIPPED) {
|
|
@@ -8708,6 +8763,9 @@ Captured external output:
|
|
|
8708
8763
|
const data = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
8709
8764
|
if (!this.stdinParser)
|
|
8710
8765
|
return;
|
|
8766
|
+
if (this.stdinLogPath) {
|
|
8767
|
+
appendFileSync(this.stdinLogPath, data);
|
|
8768
|
+
}
|
|
8711
8769
|
try {
|
|
8712
8770
|
this.stdinParser.push(data);
|
|
8713
8771
|
this.drainStdinParser();
|
|
@@ -8814,6 +8872,12 @@ Captured external output:
|
|
|
8814
8872
|
});
|
|
8815
8873
|
}
|
|
8816
8874
|
handleStdinEvent(event) {
|
|
8875
|
+
if (this._controlState === "explicit_suspended" /* EXPLICIT_SUSPENDED */) {
|
|
8876
|
+
if (event.type === "response" && isPixelResolutionResponse(event.sequence)) {
|
|
8877
|
+
this.dispatchSequenceHandlers(event.sequence);
|
|
8878
|
+
}
|
|
8879
|
+
return;
|
|
8880
|
+
}
|
|
8817
8881
|
switch (event.type) {
|
|
8818
8882
|
case "key":
|
|
8819
8883
|
if (this.dispatchSequenceHandlers(event.raw)) {
|
|
@@ -8857,16 +8921,25 @@ Captured external output:
|
|
|
8857
8921
|
}
|
|
8858
8922
|
}
|
|
8859
8923
|
setupInput() {
|
|
8924
|
+
if (this.stdinLogPath) {
|
|
8925
|
+
writeFileSync(this.stdinLogPath, Buffer.alloc(0), { mode: 384 });
|
|
8926
|
+
}
|
|
8860
8927
|
for (const handler of this.prependedInputHandlers) {
|
|
8861
8928
|
this.addInputHandler(handler);
|
|
8862
8929
|
}
|
|
8863
8930
|
this.addInputHandler((sequence) => {
|
|
8864
8931
|
if (isPixelResolutionResponse(sequence) && this.waitingForPixelResolution) {
|
|
8932
|
+
this.waitingForPixelResolution = false;
|
|
8933
|
+
if (this.pixelResolutionRequeryPending) {
|
|
8934
|
+
this.updateStdinParserProtocolContext({ pixelResolutionQueryActive: false });
|
|
8935
|
+
this.queryPixelResolution();
|
|
8936
|
+
return true;
|
|
8937
|
+
}
|
|
8865
8938
|
const resolution = parsePixelResolution(sequence);
|
|
8866
8939
|
if (resolution) {
|
|
8867
8940
|
this._resolution = resolution;
|
|
8941
|
+
this.requestRender();
|
|
8868
8942
|
}
|
|
8869
|
-
this.waitingForPixelResolution = false;
|
|
8870
8943
|
this.updateStdinParserProtocolContext({ pixelResolutionQueryActive: false }, true);
|
|
8871
8944
|
return true;
|
|
8872
8945
|
}
|
|
@@ -8883,7 +8956,7 @@ Captured external output:
|
|
|
8883
8956
|
}
|
|
8884
8957
|
dispatchMouseEvent(target, attributes) {
|
|
8885
8958
|
const event = new MouseEvent(target, attributes);
|
|
8886
|
-
|
|
8959
|
+
this.sendMouseEvent(target, event);
|
|
8887
8960
|
if (this.autoFocus && event.type === "down" && event.button === 0 /* LEFT */ && !event.defaultPrevented) {
|
|
8888
8961
|
let current = target;
|
|
8889
8962
|
while (current) {
|
|
@@ -8896,6 +8969,15 @@ Captured external output:
|
|
|
8896
8969
|
}
|
|
8897
8970
|
return event;
|
|
8898
8971
|
}
|
|
8972
|
+
sendMouseEvent(target, event) {
|
|
8973
|
+
try {
|
|
8974
|
+
target.processMouseEvent(event);
|
|
8975
|
+
} catch (error) {
|
|
8976
|
+
const handled = this.emit("handler:error" /* HANDLER_ERROR */, { error, event });
|
|
8977
|
+
if (!handled)
|
|
8978
|
+
console.error("Error in mouse handler:", error);
|
|
8979
|
+
}
|
|
8980
|
+
}
|
|
8899
8981
|
processSingleMouseEvent(mouseEvent) {
|
|
8900
8982
|
if (this._splitHeight > 0) {
|
|
8901
8983
|
if (mouseEvent.y < this.renderOffset) {
|
|
@@ -8923,7 +9005,7 @@ Captured external output:
|
|
|
8923
9005
|
const scrollTarget = maybeRenderable2 ?? fallbackTarget;
|
|
8924
9006
|
if (scrollTarget) {
|
|
8925
9007
|
const event2 = new MouseEvent(scrollTarget, mouseEvent);
|
|
8926
|
-
|
|
9008
|
+
this.sendMouseEvent(scrollTarget, event2);
|
|
8927
9009
|
}
|
|
8928
9010
|
return true;
|
|
8929
9011
|
}
|
|
@@ -8946,7 +9028,7 @@ Captured external output:
|
|
|
8946
9028
|
...mouseEvent,
|
|
8947
9029
|
isDragging: true
|
|
8948
9030
|
});
|
|
8949
|
-
|
|
9031
|
+
this.sendMouseEvent(maybeRenderable, event2);
|
|
8950
9032
|
}
|
|
8951
9033
|
return true;
|
|
8952
9034
|
}
|
|
@@ -8956,7 +9038,7 @@ Captured external output:
|
|
|
8956
9038
|
...mouseEvent,
|
|
8957
9039
|
isDragging: true
|
|
8958
9040
|
});
|
|
8959
|
-
|
|
9041
|
+
this.sendMouseEvent(maybeRenderable, event2);
|
|
8960
9042
|
}
|
|
8961
9043
|
this.finishSelection();
|
|
8962
9044
|
return true;
|
|
@@ -8974,7 +9056,7 @@ Captured external output:
|
|
|
8974
9056
|
...mouseEvent,
|
|
8975
9057
|
type: "out"
|
|
8976
9058
|
});
|
|
8977
|
-
this.lastOverRenderable
|
|
9059
|
+
this.sendMouseEvent(this.lastOverRenderable, event2);
|
|
8978
9060
|
}
|
|
8979
9061
|
this.lastOverRenderable = maybeRenderable;
|
|
8980
9062
|
if (maybeRenderable) {
|
|
@@ -8983,12 +9065,12 @@ Captured external output:
|
|
|
8983
9065
|
type: "over",
|
|
8984
9066
|
source: this.capturedRenderable
|
|
8985
9067
|
});
|
|
8986
|
-
|
|
9068
|
+
this.sendMouseEvent(maybeRenderable, event2);
|
|
8987
9069
|
}
|
|
8988
9070
|
}
|
|
8989
9071
|
if (this.capturedRenderable && mouseEvent.type !== "up") {
|
|
8990
9072
|
const event2 = new MouseEvent(this.capturedRenderable, mouseEvent);
|
|
8991
|
-
this.capturedRenderable
|
|
9073
|
+
this.sendMouseEvent(this.capturedRenderable, event2);
|
|
8992
9074
|
return true;
|
|
8993
9075
|
}
|
|
8994
9076
|
if (this.capturedRenderable && mouseEvent.type === "up") {
|
|
@@ -8996,15 +9078,15 @@ Captured external output:
|
|
|
8996
9078
|
...mouseEvent,
|
|
8997
9079
|
type: "drag-end"
|
|
8998
9080
|
});
|
|
8999
|
-
this.capturedRenderable
|
|
9000
|
-
this.capturedRenderable
|
|
9081
|
+
this.sendMouseEvent(this.capturedRenderable, event2);
|
|
9082
|
+
this.sendMouseEvent(this.capturedRenderable, new MouseEvent(this.capturedRenderable, mouseEvent));
|
|
9001
9083
|
if (maybeRenderable) {
|
|
9002
9084
|
const event3 = new MouseEvent(maybeRenderable, {
|
|
9003
9085
|
...mouseEvent,
|
|
9004
9086
|
type: "drop",
|
|
9005
9087
|
source: this.capturedRenderable
|
|
9006
9088
|
});
|
|
9007
|
-
|
|
9089
|
+
this.sendMouseEvent(maybeRenderable, event3);
|
|
9008
9090
|
}
|
|
9009
9091
|
this.lastOverRenderable = this.capturedRenderable;
|
|
9010
9092
|
this.lastOverRenderableNum = this.capturedRenderable.num;
|
|
@@ -9049,7 +9131,7 @@ Captured external output:
|
|
|
9049
9131
|
};
|
|
9050
9132
|
if (lastOver && !lastOver.isDestroyed) {
|
|
9051
9133
|
const event = new MouseEvent(lastOver, { ...baseEvent, type: "out" });
|
|
9052
|
-
|
|
9134
|
+
this.sendMouseEvent(lastOver, event);
|
|
9053
9135
|
}
|
|
9054
9136
|
this.lastOverRenderable = hitRenderable;
|
|
9055
9137
|
this.lastOverRenderableNum = hitId;
|
|
@@ -9058,7 +9140,7 @@ Captured external output:
|
|
|
9058
9140
|
...baseEvent,
|
|
9059
9141
|
type: "over"
|
|
9060
9142
|
});
|
|
9061
|
-
|
|
9143
|
+
this.sendMouseEvent(hitRenderable, event);
|
|
9062
9144
|
}
|
|
9063
9145
|
}
|
|
9064
9146
|
setMousePointer(style) {
|
|
@@ -9118,6 +9200,10 @@ Captured external output:
|
|
|
9118
9200
|
}, this.resizeDebounceDelay);
|
|
9119
9201
|
}
|
|
9120
9202
|
queryPixelResolution() {
|
|
9203
|
+
this.pixelResolutionRequeryPending = true;
|
|
9204
|
+
if (this._controlState === "explicit_suspended" /* EXPLICIT_SUSPENDED */ || this.waitingForPixelResolution)
|
|
9205
|
+
return;
|
|
9206
|
+
this.pixelResolutionRequeryPending = false;
|
|
9121
9207
|
this.waitingForPixelResolution = true;
|
|
9122
9208
|
this.updateStdinParserProtocolContext({ pixelResolutionQueryActive: true });
|
|
9123
9209
|
this.lib.queryPixelResolution(this.rendererPtr);
|
|
@@ -9135,6 +9221,7 @@ Captured external output:
|
|
|
9135
9221
|
const visiblePreviousSplitHeight = pendingSplitFooterTransition?.sourceHeight ?? previousGeometry.effectiveFooterHeight;
|
|
9136
9222
|
this._terminalWidth = width;
|
|
9137
9223
|
this._terminalHeight = height;
|
|
9224
|
+
this._resolution = null;
|
|
9138
9225
|
this.queryPixelResolution();
|
|
9139
9226
|
this.setCapturedRenderable(undefined);
|
|
9140
9227
|
this.stdinParser?.resetMouseState();
|
|
@@ -9327,14 +9414,16 @@ Captured external output:
|
|
|
9327
9414
|
this._suspendedMouseEnabled = this._useMouse;
|
|
9328
9415
|
this.disableMouse();
|
|
9329
9416
|
this.removeExitListeners();
|
|
9330
|
-
this.waitingForPixelResolution = false;
|
|
9331
9417
|
this.updateStdinParserProtocolContext({
|
|
9332
9418
|
privateCapabilityRepliesActive: false,
|
|
9333
|
-
pixelResolutionQueryActive:
|
|
9419
|
+
pixelResolutionQueryActive: this.waitingForPixelResolution,
|
|
9334
9420
|
explicitWidthCprActive: false,
|
|
9335
9421
|
startupCursorCprActive: false
|
|
9336
9422
|
});
|
|
9337
|
-
this.stdinParser?.
|
|
9423
|
+
if (this.stdinParser?.hasPendingPixelResolutionResponse())
|
|
9424
|
+
this.stdinParser.pausePendingTimeout();
|
|
9425
|
+
else
|
|
9426
|
+
this.stdinParser?.reset();
|
|
9338
9427
|
this.stdin.removeListener("data", this.stdinListener);
|
|
9339
9428
|
this.themeModeState.cancelRefresh();
|
|
9340
9429
|
this.lib.suspendRenderer(this.rendererPtr);
|
|
@@ -9347,7 +9436,13 @@ Captured external output:
|
|
|
9347
9436
|
if (this.stdin.setRawMode) {
|
|
9348
9437
|
this.stdin.setRawMode(true);
|
|
9349
9438
|
}
|
|
9350
|
-
|
|
9439
|
+
let drained;
|
|
9440
|
+
while ((drained = this.stdin.read()) !== null)
|
|
9441
|
+
this.stdinListener(drained);
|
|
9442
|
+
if (this.stdinParser?.hasPendingPixelResolutionResponse())
|
|
9443
|
+
this.stdinParser.pausePendingTimeout();
|
|
9444
|
+
else
|
|
9445
|
+
this.stdinParser?.reset();
|
|
9351
9446
|
this.stdin.on("data", this.stdinListener);
|
|
9352
9447
|
this.stdin.resume();
|
|
9353
9448
|
this.addExitListeners();
|
|
@@ -9372,6 +9467,9 @@ Captured external output:
|
|
|
9372
9467
|
}
|
|
9373
9468
|
this.forceFullRepaintRequested = true;
|
|
9374
9469
|
this._controlState = this._previousControlState;
|
|
9470
|
+
if (this.pixelResolutionRequeryPending)
|
|
9471
|
+
this.queryPixelResolution();
|
|
9472
|
+
this.stdinParser?.resumePendingTimeout();
|
|
9375
9473
|
if (this._previousControlState === "auto_started" /* AUTO_STARTED */ || this._previousControlState === "explicit_started" /* EXPLICIT_STARTED */) {
|
|
9376
9474
|
this.internalStart();
|
|
9377
9475
|
} else {
|
|
@@ -9452,6 +9550,7 @@ Captured external output:
|
|
|
9452
9550
|
this.themeModeState.cancelRefresh();
|
|
9453
9551
|
this._isRunning = false;
|
|
9454
9552
|
this.waitingForPixelResolution = false;
|
|
9553
|
+
this.pixelResolutionRequeryPending = false;
|
|
9455
9554
|
this.updateStdinParserProtocolContext({
|
|
9456
9555
|
privateCapabilityRepliesActive: false,
|
|
9457
9556
|
pixelResolutionQueryActive: false,
|
|
@@ -9586,12 +9685,12 @@ Captured external output:
|
|
|
9586
9685
|
async loop() {
|
|
9587
9686
|
if (this.rendering || this._isDestroyed)
|
|
9588
9687
|
return;
|
|
9589
|
-
this.renderTimeout = null;
|
|
9590
|
-
this.rendering = true;
|
|
9591
9688
|
if (this.renderTimeout) {
|
|
9592
9689
|
this.clock.clearTimeout(this.renderTimeout);
|
|
9593
9690
|
this.renderTimeout = null;
|
|
9594
9691
|
}
|
|
9692
|
+
this.rendering = true;
|
|
9693
|
+
let renderFailed = false;
|
|
9595
9694
|
try {
|
|
9596
9695
|
this._frameId++;
|
|
9597
9696
|
const now = this.normalizeClockTime(this.clock.now(), this.lastTime);
|
|
@@ -9684,11 +9783,22 @@ Captured external output:
|
|
|
9684
9783
|
this.renderTimeout = null;
|
|
9685
9784
|
}
|
|
9686
9785
|
}
|
|
9786
|
+
} catch (error) {
|
|
9787
|
+
renderFailed = true;
|
|
9788
|
+
const renderError = error instanceof Error ? error : new Error(String(error));
|
|
9789
|
+
const event = { error: renderError, renderable: this.root.takeCurrentRenderable() };
|
|
9790
|
+
const handled = this.emit("render:error" /* RENDER_ERROR */, event);
|
|
9791
|
+
if (!handled)
|
|
9792
|
+
this.handleError(renderError);
|
|
9687
9793
|
} finally {
|
|
9688
9794
|
this.rendering = false;
|
|
9689
9795
|
if (this._destroyPending) {
|
|
9690
9796
|
this.finalizeDestroy();
|
|
9691
9797
|
}
|
|
9798
|
+
if (renderFailed && (this._isRunning || this.immediateRerenderRequested) && !this._isDestroyed) {
|
|
9799
|
+
this.immediateRerenderRequested = false;
|
|
9800
|
+
this.scheduleRenderTimer();
|
|
9801
|
+
}
|
|
9692
9802
|
this.resolveIdleIfNeeded();
|
|
9693
9803
|
}
|
|
9694
9804
|
}
|
|
@@ -10042,5 +10152,5 @@ Captured external output:
|
|
|
10042
10152
|
|
|
10043
10153
|
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 };
|
|
10044
10154
|
|
|
10045
|
-
//# debugId=
|
|
10046
|
-
//# sourceMappingURL=chunk-node-
|
|
10155
|
+
//# debugId=19BC632C369BDFA064756E2164756E21
|
|
10156
|
+
//# sourceMappingURL=chunk-node-0yw3x5m7.js.map
|