@opentui/core 0.1.88 → 0.1.89
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/buffer.d.ts +5 -3
- package/{index-nkrr8a4c.js → index-e89anq5x.js} +743 -123
- package/{index-nkrr8a4c.js.map → index-e89anq5x.js.map} +13 -13
- package/{index-nyw5p3ep.js → index-rs5zwr4j.js} +272 -518
- package/{index-nyw5p3ep.js.map → index-rs5zwr4j.js.map} +4 -4
- package/index-tae5jwnc.js +188 -0
- package/index-tae5jwnc.js.map +10 -0
- package/index.js +17 -15
- package/index.js.map +1 -1
- package/lib/stdin-parser.d.ts +10 -0
- package/lib/tree-sitter/default-parsers.d.ts +1 -1
- package/lib/tree-sitter/parsers-config.d.ts +15 -0
- package/lib/tree-sitter/resolve-ft.d.ts +3 -0
- package/lib/tree-sitter/types.d.ts +1 -0
- package/package.json +7 -7
- package/parser.worker.js +52 -18
- package/parser.worker.js.map +3 -3
- package/post/effects.d.ts +147 -0
- package/post/filters.d.ts +27 -67
- package/post/matrices.d.ts +20 -0
- package/renderables/Markdown.d.ts +9 -1
- package/renderer.d.ts +12 -1
- package/runtime-plugin-support.js +3 -3
- package/runtime-plugin.js +3 -3
- package/testing/manual-clock.d.ts +1 -0
- package/testing.js +1 -1
- package/types.d.ts +5 -0
- package/zig.d.ts +3 -1
- package/index-e4hzc2j2.js +0 -113
- package/index-e4hzc2j2.js.map +0 -10
|
@@ -5093,6 +5093,12 @@ var DebugOverlayCorner;
|
|
|
5093
5093
|
DebugOverlayCorner2[DebugOverlayCorner2["bottomLeft"] = 2] = "bottomLeft";
|
|
5094
5094
|
DebugOverlayCorner2[DebugOverlayCorner2["bottomRight"] = 3] = "bottomRight";
|
|
5095
5095
|
})(DebugOverlayCorner ||= {});
|
|
5096
|
+
var TargetChannel;
|
|
5097
|
+
((TargetChannel2) => {
|
|
5098
|
+
TargetChannel2[TargetChannel2["FG"] = 1] = "FG";
|
|
5099
|
+
TargetChannel2[TargetChannel2["BG"] = 2] = "BG";
|
|
5100
|
+
TargetChannel2[TargetChannel2["Both"] = 3] = "Both";
|
|
5101
|
+
})(TargetChannel ||= {});
|
|
5096
5102
|
|
|
5097
5103
|
// src/utils.ts
|
|
5098
5104
|
function createTextAttributes({
|
|
@@ -5314,7 +5320,10 @@ function hastToStyledText(hast, syntaxStyle) {
|
|
|
5314
5320
|
// src/lib/clock.ts
|
|
5315
5321
|
class SystemClock {
|
|
5316
5322
|
now() {
|
|
5317
|
-
|
|
5323
|
+
if (!globalThis.performance || typeof globalThis.performance.now !== "function") {
|
|
5324
|
+
throw new Error("SystemClock requires globalThis.performance.now()");
|
|
5325
|
+
}
|
|
5326
|
+
return globalThis.performance.now();
|
|
5318
5327
|
}
|
|
5319
5328
|
setTimeout(fn, delayMs) {
|
|
5320
5329
|
return globalThis.setTimeout(fn, delayMs);
|
|
@@ -6411,13 +6420,7 @@ class MouseParser {
|
|
|
6411
6420
|
};
|
|
6412
6421
|
let type;
|
|
6413
6422
|
let scrollInfo;
|
|
6414
|
-
if (
|
|
6415
|
-
type = "scroll";
|
|
6416
|
-
scrollInfo = {
|
|
6417
|
-
direction: scrollDirection,
|
|
6418
|
-
delta: 1
|
|
6419
|
-
};
|
|
6420
|
-
} else if (isMotion) {
|
|
6423
|
+
if (isMotion) {
|
|
6421
6424
|
const isDragging = this.mouseButtonsPressed.size > 0;
|
|
6422
6425
|
if (button === 3) {
|
|
6423
6426
|
type = "move";
|
|
@@ -6426,6 +6429,12 @@ class MouseParser {
|
|
|
6426
6429
|
} else {
|
|
6427
6430
|
type = "move";
|
|
6428
6431
|
}
|
|
6432
|
+
} else if (isScroll && pressRelease === "M") {
|
|
6433
|
+
type = "scroll";
|
|
6434
|
+
scrollInfo = {
|
|
6435
|
+
direction: scrollDirection,
|
|
6436
|
+
delta: 1
|
|
6437
|
+
};
|
|
6429
6438
|
} else {
|
|
6430
6439
|
type = pressRelease === "M" ? "down" : "up";
|
|
6431
6440
|
if (type === "down" && button !== 3) {
|
|
@@ -6456,16 +6465,16 @@ class MouseParser {
|
|
|
6456
6465
|
let type;
|
|
6457
6466
|
let actualButton;
|
|
6458
6467
|
let scrollInfo;
|
|
6459
|
-
if (
|
|
6468
|
+
if (isMotion) {
|
|
6469
|
+
type = "move";
|
|
6470
|
+
actualButton = button === 3 ? -1 : button;
|
|
6471
|
+
} else if (isScroll) {
|
|
6460
6472
|
type = "scroll";
|
|
6461
6473
|
actualButton = 0;
|
|
6462
6474
|
scrollInfo = {
|
|
6463
6475
|
direction: scrollDirection,
|
|
6464
6476
|
delta: 1
|
|
6465
6477
|
};
|
|
6466
|
-
} else if (isMotion) {
|
|
6467
|
-
type = "move";
|
|
6468
|
-
actualButton = button === 3 ? -1 : button;
|
|
6469
6478
|
} else {
|
|
6470
6479
|
type = button === 3 ? "up" : "down";
|
|
6471
6480
|
actualButton = button === 3 ? 0 : button;
|
|
@@ -6843,6 +6852,12 @@ var BRACKETED_PASTE_START = Buffer3.from("\x1B[200~");
|
|
|
6843
6852
|
var BRACKETED_PASTE_END = Buffer3.from("\x1B[201~");
|
|
6844
6853
|
var EMPTY_BYTES = new Uint8Array(0);
|
|
6845
6854
|
var KEY_DECODER = new TextDecoder;
|
|
6855
|
+
var DEFAULT_PROTOCOL_CONTEXT = {
|
|
6856
|
+
kittyKeyboardEnabled: false,
|
|
6857
|
+
privateCapabilityRepliesActive: false,
|
|
6858
|
+
pixelResolutionQueryActive: false,
|
|
6859
|
+
explicitWidthCprActive: false
|
|
6860
|
+
};
|
|
6846
6861
|
var RXVT_DOLLAR_CSI_RE = /^\x1b\[\d+\$$/;
|
|
6847
6862
|
var SYSTEM_CLOCK = new SystemClock;
|
|
6848
6863
|
|
|
@@ -6982,6 +6997,66 @@ function isMouseSgrSequence(sequence) {
|
|
|
6982
6997
|
}
|
|
6983
6998
|
return part === 2 && hasDigit;
|
|
6984
6999
|
}
|
|
7000
|
+
function isAsciiDigit(byte) {
|
|
7001
|
+
return byte >= 48 && byte <= 57;
|
|
7002
|
+
}
|
|
7003
|
+
function parsePositiveDecimalPrefix(sequence, start, endExclusive) {
|
|
7004
|
+
if (start >= endExclusive)
|
|
7005
|
+
return null;
|
|
7006
|
+
let value = 0;
|
|
7007
|
+
let sawDigit = false;
|
|
7008
|
+
for (let index = start;index < endExclusive; index += 1) {
|
|
7009
|
+
const byte = sequence[index];
|
|
7010
|
+
if (!isAsciiDigit(byte))
|
|
7011
|
+
return null;
|
|
7012
|
+
sawDigit = true;
|
|
7013
|
+
value = value * 10 + (byte - 48);
|
|
7014
|
+
}
|
|
7015
|
+
return sawDigit ? value : null;
|
|
7016
|
+
}
|
|
7017
|
+
function canStillBeKittyU(state) {
|
|
7018
|
+
return state.semicolons >= 1;
|
|
7019
|
+
}
|
|
7020
|
+
function canStillBeKittySpecial(state) {
|
|
7021
|
+
return state.semicolons === 1 && state.segments > 1;
|
|
7022
|
+
}
|
|
7023
|
+
function canStillBeExplicitWidthCpr(state) {
|
|
7024
|
+
return state.firstParamValue === 1 && state.semicolons === 1;
|
|
7025
|
+
}
|
|
7026
|
+
function canStillBePixelResolution(state) {
|
|
7027
|
+
return state.firstParamValue === 4 && state.semicolons === 2;
|
|
7028
|
+
}
|
|
7029
|
+
function canDeferParametricCsi(state, context) {
|
|
7030
|
+
return context.kittyKeyboardEnabled && (canStillBeKittyU(state) || canStillBeKittySpecial(state)) || context.explicitWidthCprActive && canStillBeExplicitWidthCpr(state) || context.pixelResolutionQueryActive && canStillBePixelResolution(state);
|
|
7031
|
+
}
|
|
7032
|
+
function canCompleteDeferredParametricCsi(state, byte, context) {
|
|
7033
|
+
if (context.kittyKeyboardEnabled) {
|
|
7034
|
+
if (state.hasDigit && byte === 117)
|
|
7035
|
+
return true;
|
|
7036
|
+
if (state.hasDigit && state.semicolons === 1 && state.segments > 1 && (byte === 126 || byte >= 65 && byte <= 90)) {
|
|
7037
|
+
return true;
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
7040
|
+
if (context.explicitWidthCprActive && state.hasDigit && state.firstParamValue === 1 && state.semicolons === 1 && byte === 82) {
|
|
7041
|
+
return true;
|
|
7042
|
+
}
|
|
7043
|
+
if (context.pixelResolutionQueryActive && state.hasDigit && state.firstParamValue === 4 && state.semicolons === 2 && byte === 116) {
|
|
7044
|
+
return true;
|
|
7045
|
+
}
|
|
7046
|
+
return false;
|
|
7047
|
+
}
|
|
7048
|
+
function canDeferPrivateReplyCsi(context) {
|
|
7049
|
+
return context.privateCapabilityRepliesActive;
|
|
7050
|
+
}
|
|
7051
|
+
function canCompleteDeferredPrivateReplyCsi(state, byte, context) {
|
|
7052
|
+
if (!context.privateCapabilityRepliesActive)
|
|
7053
|
+
return false;
|
|
7054
|
+
if (state.sawDollar)
|
|
7055
|
+
return state.hasDigit && byte === 121;
|
|
7056
|
+
if (byte === 99)
|
|
7057
|
+
return state.hasDigit || state.semicolons > 0;
|
|
7058
|
+
return state.hasDigit && byte === 117;
|
|
7059
|
+
}
|
|
6985
7060
|
function concatBytes(left, right) {
|
|
6986
7061
|
if (left.length === 0) {
|
|
6987
7062
|
return right;
|
|
@@ -7052,6 +7127,7 @@ class StdinParser {
|
|
|
7052
7127
|
useKittyKeyboard;
|
|
7053
7128
|
mouseParser = new MouseParser;
|
|
7054
7129
|
clock;
|
|
7130
|
+
protocolContext;
|
|
7055
7131
|
timeoutId = null;
|
|
7056
7132
|
destroyed = false;
|
|
7057
7133
|
pendingSinceMs = null;
|
|
@@ -7068,10 +7144,23 @@ class StdinParser {
|
|
|
7068
7144
|
this.onTimeoutFlush = options.onTimeoutFlush ?? null;
|
|
7069
7145
|
this.useKittyKeyboard = options.useKittyKeyboard ?? true;
|
|
7070
7146
|
this.clock = options.clock ?? SYSTEM_CLOCK;
|
|
7147
|
+
this.protocolContext = {
|
|
7148
|
+
...DEFAULT_PROTOCOL_CONTEXT,
|
|
7149
|
+
kittyKeyboardEnabled: options.protocolContext?.kittyKeyboardEnabled ?? false,
|
|
7150
|
+
privateCapabilityRepliesActive: options.protocolContext?.privateCapabilityRepliesActive ?? false,
|
|
7151
|
+
pixelResolutionQueryActive: options.protocolContext?.pixelResolutionQueryActive ?? false,
|
|
7152
|
+
explicitWidthCprActive: options.protocolContext?.explicitWidthCprActive ?? false
|
|
7153
|
+
};
|
|
7071
7154
|
}
|
|
7072
7155
|
get bufferCapacity() {
|
|
7073
7156
|
return this.pending.capacity;
|
|
7074
7157
|
}
|
|
7158
|
+
updateProtocolContext(patch) {
|
|
7159
|
+
this.ensureAlive();
|
|
7160
|
+
this.protocolContext = { ...this.protocolContext, ...patch };
|
|
7161
|
+
this.reconcileDeferredStateWithProtocolContext();
|
|
7162
|
+
this.reconcileTimeoutState();
|
|
7163
|
+
}
|
|
7075
7164
|
push(data) {
|
|
7076
7165
|
this.ensureAlive();
|
|
7077
7166
|
if (data.length === 0) {
|
|
@@ -7376,10 +7465,34 @@ class StdinParser {
|
|
|
7376
7465
|
return;
|
|
7377
7466
|
}
|
|
7378
7467
|
}
|
|
7468
|
+
if (byte === 60 && this.cursor === this.unitStart + 2) {
|
|
7469
|
+
this.cursor += 1;
|
|
7470
|
+
this.state = { tag: "csi_sgr_mouse", part: 0, hasDigit: false };
|
|
7471
|
+
continue;
|
|
7472
|
+
}
|
|
7379
7473
|
if (byte === 91 && this.cursor === this.unitStart + 2) {
|
|
7380
7474
|
this.cursor += 1;
|
|
7381
7475
|
continue;
|
|
7382
7476
|
}
|
|
7477
|
+
if (byte === 63 && this.cursor === this.unitStart + 2) {
|
|
7478
|
+
this.cursor += 1;
|
|
7479
|
+
this.state = { tag: "csi_private_reply", semicolons: 0, hasDigit: false, sawDollar: false };
|
|
7480
|
+
continue;
|
|
7481
|
+
}
|
|
7482
|
+
if (byte === 59) {
|
|
7483
|
+
const firstParamValue = parsePositiveDecimalPrefix(bytes, this.unitStart + 2, this.cursor);
|
|
7484
|
+
if (firstParamValue !== null) {
|
|
7485
|
+
this.cursor += 1;
|
|
7486
|
+
this.state = {
|
|
7487
|
+
tag: "csi_parametric",
|
|
7488
|
+
semicolons: 1,
|
|
7489
|
+
segments: 1,
|
|
7490
|
+
hasDigit: false,
|
|
7491
|
+
firstParamValue
|
|
7492
|
+
};
|
|
7493
|
+
continue;
|
|
7494
|
+
}
|
|
7495
|
+
}
|
|
7383
7496
|
if (byte >= 64 && byte <= 126) {
|
|
7384
7497
|
const end = this.cursor + 1;
|
|
7385
7498
|
const rawBytes = bytes.subarray(this.unitStart, end);
|
|
@@ -7403,6 +7516,281 @@ class StdinParser {
|
|
|
7403
7516
|
this.cursor += 1;
|
|
7404
7517
|
continue;
|
|
7405
7518
|
}
|
|
7519
|
+
case "csi_sgr_mouse": {
|
|
7520
|
+
if (this.cursor >= bytes.length) {
|
|
7521
|
+
if (!this.forceFlush) {
|
|
7522
|
+
this.markPending();
|
|
7523
|
+
return;
|
|
7524
|
+
}
|
|
7525
|
+
this.state = { tag: "csi_sgr_mouse_deferred", part: this.state.part, hasDigit: this.state.hasDigit };
|
|
7526
|
+
this.pendingSinceMs = null;
|
|
7527
|
+
this.forceFlush = false;
|
|
7528
|
+
return;
|
|
7529
|
+
}
|
|
7530
|
+
if (byte === ESC) {
|
|
7531
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7532
|
+
this.state = { tag: "ground" };
|
|
7533
|
+
this.consumePrefix(this.cursor);
|
|
7534
|
+
continue;
|
|
7535
|
+
}
|
|
7536
|
+
if (isAsciiDigit(byte)) {
|
|
7537
|
+
this.cursor += 1;
|
|
7538
|
+
this.state = { tag: "csi_sgr_mouse", part: this.state.part, hasDigit: true };
|
|
7539
|
+
continue;
|
|
7540
|
+
}
|
|
7541
|
+
if (byte === 59 && this.state.hasDigit && this.state.part < 2) {
|
|
7542
|
+
this.cursor += 1;
|
|
7543
|
+
this.state = { tag: "csi_sgr_mouse", part: this.state.part + 1, hasDigit: false };
|
|
7544
|
+
continue;
|
|
7545
|
+
}
|
|
7546
|
+
if (byte >= 64 && byte <= 126) {
|
|
7547
|
+
const end = this.cursor + 1;
|
|
7548
|
+
const rawBytes = bytes.subarray(this.unitStart, end);
|
|
7549
|
+
if (isMouseSgrSequence(rawBytes)) {
|
|
7550
|
+
this.emitMouse(rawBytes, "sgr");
|
|
7551
|
+
} else {
|
|
7552
|
+
this.emitKeyOrResponse("csi", decodeUtf8(rawBytes));
|
|
7553
|
+
}
|
|
7554
|
+
this.state = { tag: "ground" };
|
|
7555
|
+
this.consumePrefix(end);
|
|
7556
|
+
continue;
|
|
7557
|
+
}
|
|
7558
|
+
this.state = { tag: "csi" };
|
|
7559
|
+
continue;
|
|
7560
|
+
}
|
|
7561
|
+
case "csi_sgr_mouse_deferred": {
|
|
7562
|
+
if (this.cursor >= bytes.length) {
|
|
7563
|
+
this.pendingSinceMs = null;
|
|
7564
|
+
this.forceFlush = false;
|
|
7565
|
+
return;
|
|
7566
|
+
}
|
|
7567
|
+
if (byte === ESC) {
|
|
7568
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7569
|
+
this.state = { tag: "ground" };
|
|
7570
|
+
this.consumePrefix(this.cursor);
|
|
7571
|
+
continue;
|
|
7572
|
+
}
|
|
7573
|
+
if (isAsciiDigit(byte) || byte === 59 || byte === 77 || byte === 109) {
|
|
7574
|
+
this.state = { tag: "csi_sgr_mouse", part: this.state.part, hasDigit: this.state.hasDigit };
|
|
7575
|
+
continue;
|
|
7576
|
+
}
|
|
7577
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7578
|
+
this.state = { tag: "ground" };
|
|
7579
|
+
this.consumePrefix(this.cursor);
|
|
7580
|
+
continue;
|
|
7581
|
+
}
|
|
7582
|
+
case "csi_parametric": {
|
|
7583
|
+
if (this.cursor >= bytes.length) {
|
|
7584
|
+
if (!this.forceFlush) {
|
|
7585
|
+
this.markPending();
|
|
7586
|
+
return;
|
|
7587
|
+
}
|
|
7588
|
+
if (canDeferParametricCsi(this.state, this.protocolContext)) {
|
|
7589
|
+
this.state = {
|
|
7590
|
+
tag: "csi_parametric_deferred",
|
|
7591
|
+
semicolons: this.state.semicolons,
|
|
7592
|
+
segments: this.state.segments,
|
|
7593
|
+
hasDigit: this.state.hasDigit,
|
|
7594
|
+
firstParamValue: this.state.firstParamValue
|
|
7595
|
+
};
|
|
7596
|
+
this.pendingSinceMs = null;
|
|
7597
|
+
this.forceFlush = false;
|
|
7598
|
+
return;
|
|
7599
|
+
}
|
|
7600
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7601
|
+
this.state = { tag: "ground" };
|
|
7602
|
+
this.consumePrefix(this.cursor);
|
|
7603
|
+
continue;
|
|
7604
|
+
}
|
|
7605
|
+
if (byte === ESC) {
|
|
7606
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7607
|
+
this.state = { tag: "ground" };
|
|
7608
|
+
this.consumePrefix(this.cursor);
|
|
7609
|
+
continue;
|
|
7610
|
+
}
|
|
7611
|
+
if (isAsciiDigit(byte)) {
|
|
7612
|
+
this.cursor += 1;
|
|
7613
|
+
this.state = {
|
|
7614
|
+
tag: "csi_parametric",
|
|
7615
|
+
semicolons: this.state.semicolons,
|
|
7616
|
+
segments: this.state.segments,
|
|
7617
|
+
hasDigit: true,
|
|
7618
|
+
firstParamValue: this.state.firstParamValue
|
|
7619
|
+
};
|
|
7620
|
+
continue;
|
|
7621
|
+
}
|
|
7622
|
+
if (byte === 58 && this.state.hasDigit && this.state.segments < 3) {
|
|
7623
|
+
this.cursor += 1;
|
|
7624
|
+
this.state = {
|
|
7625
|
+
tag: "csi_parametric",
|
|
7626
|
+
semicolons: this.state.semicolons,
|
|
7627
|
+
segments: this.state.segments + 1,
|
|
7628
|
+
hasDigit: false,
|
|
7629
|
+
firstParamValue: this.state.firstParamValue
|
|
7630
|
+
};
|
|
7631
|
+
continue;
|
|
7632
|
+
}
|
|
7633
|
+
if (byte === 59 && this.state.semicolons < 2) {
|
|
7634
|
+
this.cursor += 1;
|
|
7635
|
+
this.state = {
|
|
7636
|
+
tag: "csi_parametric",
|
|
7637
|
+
semicolons: this.state.semicolons + 1,
|
|
7638
|
+
segments: 1,
|
|
7639
|
+
hasDigit: false,
|
|
7640
|
+
firstParamValue: this.state.firstParamValue
|
|
7641
|
+
};
|
|
7642
|
+
continue;
|
|
7643
|
+
}
|
|
7644
|
+
if (byte >= 64 && byte <= 126) {
|
|
7645
|
+
const end = this.cursor + 1;
|
|
7646
|
+
this.emitKeyOrResponse("csi", decodeUtf8(bytes.subarray(this.unitStart, end)));
|
|
7647
|
+
this.state = { tag: "ground" };
|
|
7648
|
+
this.consumePrefix(end);
|
|
7649
|
+
continue;
|
|
7650
|
+
}
|
|
7651
|
+
this.state = { tag: "csi" };
|
|
7652
|
+
continue;
|
|
7653
|
+
}
|
|
7654
|
+
case "csi_parametric_deferred": {
|
|
7655
|
+
if (this.cursor >= bytes.length) {
|
|
7656
|
+
this.pendingSinceMs = null;
|
|
7657
|
+
this.forceFlush = false;
|
|
7658
|
+
return;
|
|
7659
|
+
}
|
|
7660
|
+
if (byte === ESC) {
|
|
7661
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7662
|
+
this.state = { tag: "ground" };
|
|
7663
|
+
this.consumePrefix(this.cursor);
|
|
7664
|
+
continue;
|
|
7665
|
+
}
|
|
7666
|
+
if (isAsciiDigit(byte) || byte === 58 || byte === 59) {
|
|
7667
|
+
this.state = {
|
|
7668
|
+
tag: "csi_parametric",
|
|
7669
|
+
semicolons: this.state.semicolons,
|
|
7670
|
+
segments: this.state.segments,
|
|
7671
|
+
hasDigit: this.state.hasDigit,
|
|
7672
|
+
firstParamValue: this.state.firstParamValue
|
|
7673
|
+
};
|
|
7674
|
+
continue;
|
|
7675
|
+
}
|
|
7676
|
+
if (canCompleteDeferredParametricCsi(this.state, byte, this.protocolContext)) {
|
|
7677
|
+
this.state = {
|
|
7678
|
+
tag: "csi_parametric",
|
|
7679
|
+
semicolons: this.state.semicolons,
|
|
7680
|
+
segments: this.state.segments,
|
|
7681
|
+
hasDigit: this.state.hasDigit,
|
|
7682
|
+
firstParamValue: this.state.firstParamValue
|
|
7683
|
+
};
|
|
7684
|
+
continue;
|
|
7685
|
+
}
|
|
7686
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7687
|
+
this.state = { tag: "ground" };
|
|
7688
|
+
this.consumePrefix(this.cursor);
|
|
7689
|
+
continue;
|
|
7690
|
+
}
|
|
7691
|
+
case "csi_private_reply": {
|
|
7692
|
+
if (this.cursor >= bytes.length) {
|
|
7693
|
+
if (!this.forceFlush) {
|
|
7694
|
+
this.markPending();
|
|
7695
|
+
return;
|
|
7696
|
+
}
|
|
7697
|
+
if (canDeferPrivateReplyCsi(this.protocolContext)) {
|
|
7698
|
+
this.state = {
|
|
7699
|
+
tag: "csi_private_reply_deferred",
|
|
7700
|
+
semicolons: this.state.semicolons,
|
|
7701
|
+
hasDigit: this.state.hasDigit,
|
|
7702
|
+
sawDollar: this.state.sawDollar
|
|
7703
|
+
};
|
|
7704
|
+
this.pendingSinceMs = null;
|
|
7705
|
+
this.forceFlush = false;
|
|
7706
|
+
return;
|
|
7707
|
+
}
|
|
7708
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7709
|
+
this.state = { tag: "ground" };
|
|
7710
|
+
this.consumePrefix(this.cursor);
|
|
7711
|
+
continue;
|
|
7712
|
+
}
|
|
7713
|
+
if (byte === ESC) {
|
|
7714
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7715
|
+
this.state = { tag: "ground" };
|
|
7716
|
+
this.consumePrefix(this.cursor);
|
|
7717
|
+
continue;
|
|
7718
|
+
}
|
|
7719
|
+
if (isAsciiDigit(byte)) {
|
|
7720
|
+
this.cursor += 1;
|
|
7721
|
+
this.state = {
|
|
7722
|
+
tag: "csi_private_reply",
|
|
7723
|
+
semicolons: this.state.semicolons,
|
|
7724
|
+
hasDigit: true,
|
|
7725
|
+
sawDollar: this.state.sawDollar
|
|
7726
|
+
};
|
|
7727
|
+
continue;
|
|
7728
|
+
}
|
|
7729
|
+
if (byte === 59) {
|
|
7730
|
+
this.cursor += 1;
|
|
7731
|
+
this.state = {
|
|
7732
|
+
tag: "csi_private_reply",
|
|
7733
|
+
semicolons: this.state.semicolons + 1,
|
|
7734
|
+
hasDigit: false,
|
|
7735
|
+
sawDollar: false
|
|
7736
|
+
};
|
|
7737
|
+
continue;
|
|
7738
|
+
}
|
|
7739
|
+
if (byte === 36 && this.state.hasDigit && !this.state.sawDollar) {
|
|
7740
|
+
this.cursor += 1;
|
|
7741
|
+
this.state = {
|
|
7742
|
+
tag: "csi_private_reply",
|
|
7743
|
+
semicolons: this.state.semicolons,
|
|
7744
|
+
hasDigit: true,
|
|
7745
|
+
sawDollar: true
|
|
7746
|
+
};
|
|
7747
|
+
continue;
|
|
7748
|
+
}
|
|
7749
|
+
if (byte >= 64 && byte <= 126) {
|
|
7750
|
+
const end = this.cursor + 1;
|
|
7751
|
+
this.emitKeyOrResponse("csi", decodeUtf8(bytes.subarray(this.unitStart, end)));
|
|
7752
|
+
this.state = { tag: "ground" };
|
|
7753
|
+
this.consumePrefix(end);
|
|
7754
|
+
continue;
|
|
7755
|
+
}
|
|
7756
|
+
this.state = { tag: "csi" };
|
|
7757
|
+
continue;
|
|
7758
|
+
}
|
|
7759
|
+
case "csi_private_reply_deferred": {
|
|
7760
|
+
if (this.cursor >= bytes.length) {
|
|
7761
|
+
this.pendingSinceMs = null;
|
|
7762
|
+
this.forceFlush = false;
|
|
7763
|
+
return;
|
|
7764
|
+
}
|
|
7765
|
+
if (byte === ESC) {
|
|
7766
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7767
|
+
this.state = { tag: "ground" };
|
|
7768
|
+
this.consumePrefix(this.cursor);
|
|
7769
|
+
continue;
|
|
7770
|
+
}
|
|
7771
|
+
if (isAsciiDigit(byte) || byte === 59 || byte === 36) {
|
|
7772
|
+
this.state = {
|
|
7773
|
+
tag: "csi_private_reply",
|
|
7774
|
+
semicolons: this.state.semicolons,
|
|
7775
|
+
hasDigit: this.state.hasDigit,
|
|
7776
|
+
sawDollar: this.state.sawDollar
|
|
7777
|
+
};
|
|
7778
|
+
continue;
|
|
7779
|
+
}
|
|
7780
|
+
if (canCompleteDeferredPrivateReplyCsi(this.state, byte, this.protocolContext)) {
|
|
7781
|
+
this.state = {
|
|
7782
|
+
tag: "csi_private_reply",
|
|
7783
|
+
semicolons: this.state.semicolons,
|
|
7784
|
+
hasDigit: this.state.hasDigit,
|
|
7785
|
+
sawDollar: this.state.sawDollar
|
|
7786
|
+
};
|
|
7787
|
+
continue;
|
|
7788
|
+
}
|
|
7789
|
+
this.emitOpaqueResponse("unknown", bytes.subarray(this.unitStart, this.cursor));
|
|
7790
|
+
this.state = { tag: "ground" };
|
|
7791
|
+
this.consumePrefix(this.cursor);
|
|
7792
|
+
continue;
|
|
7793
|
+
}
|
|
7406
7794
|
case "osc": {
|
|
7407
7795
|
if (this.cursor >= bytes.length) {
|
|
7408
7796
|
if (!this.forceFlush) {
|
|
@@ -7657,6 +8045,24 @@ class StdinParser {
|
|
|
7657
8045
|
this.paste.parts.push(Uint8Array.from(bytes));
|
|
7658
8046
|
this.paste.totalLength += bytes.length;
|
|
7659
8047
|
}
|
|
8048
|
+
reconcileDeferredStateWithProtocolContext() {
|
|
8049
|
+
switch (this.state.tag) {
|
|
8050
|
+
case "csi_parametric_deferred":
|
|
8051
|
+
if (!canDeferParametricCsi(this.state, this.protocolContext)) {
|
|
8052
|
+
this.emitOpaqueResponse("unknown", this.pending.view().subarray(this.unitStart, this.cursor));
|
|
8053
|
+
this.state = { tag: "ground" };
|
|
8054
|
+
this.consumePrefix(this.cursor);
|
|
8055
|
+
}
|
|
8056
|
+
return;
|
|
8057
|
+
case "csi_private_reply_deferred":
|
|
8058
|
+
if (!canDeferPrivateReplyCsi(this.protocolContext)) {
|
|
8059
|
+
this.emitOpaqueResponse("unknown", this.pending.view().subarray(this.unitStart, this.cursor));
|
|
8060
|
+
this.state = { tag: "ground" };
|
|
8061
|
+
this.consumePrefix(this.cursor);
|
|
8062
|
+
}
|
|
8063
|
+
return;
|
|
8064
|
+
}
|
|
8065
|
+
}
|
|
7660
8066
|
reconcileTimeoutState() {
|
|
7661
8067
|
if (!this.armTimeouts) {
|
|
7662
8068
|
return;
|
|
@@ -8040,6 +8446,7 @@ function getParsers() {
|
|
|
8040
8446
|
_cachedParsers = [
|
|
8041
8447
|
{
|
|
8042
8448
|
filetype: "javascript",
|
|
8449
|
+
aliases: ["javascriptreact"],
|
|
8043
8450
|
queries: {
|
|
8044
8451
|
highlights: [resolve(dirname(fileURLToPath(import.meta.url)), javascript_highlights)]
|
|
8045
8452
|
},
|
|
@@ -8047,6 +8454,7 @@ function getParsers() {
|
|
|
8047
8454
|
},
|
|
8048
8455
|
{
|
|
8049
8456
|
filetype: "typescript",
|
|
8457
|
+
aliases: ["typescriptreact"],
|
|
8050
8458
|
queries: {
|
|
8051
8459
|
highlights: [resolve(dirname(fileURLToPath(import.meta.url)), typescript_highlights)]
|
|
8052
8460
|
},
|
|
@@ -8067,8 +8475,12 @@ function getParsers() {
|
|
|
8067
8475
|
infoStringMap: {
|
|
8068
8476
|
javascript: "javascript",
|
|
8069
8477
|
js: "javascript",
|
|
8478
|
+
jsx: "javascriptreact",
|
|
8479
|
+
javascriptreact: "javascriptreact",
|
|
8070
8480
|
typescript: "typescript",
|
|
8071
8481
|
ts: "typescript",
|
|
8482
|
+
tsx: "typescriptreact",
|
|
8483
|
+
typescriptreact: "typescriptreact",
|
|
8072
8484
|
markdown: "markdown",
|
|
8073
8485
|
md: "markdown"
|
|
8074
8486
|
}
|
|
@@ -8119,12 +8531,10 @@ registerEnvVar({
|
|
|
8119
8531
|
var DEFAULT_PARSERS = getParsers();
|
|
8120
8532
|
function addDefaultParsers(parsers) {
|
|
8121
8533
|
for (const parser of parsers) {
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
DEFAULT_PARSERS.push(parser);
|
|
8127
|
-
}
|
|
8534
|
+
DEFAULT_PARSERS = [
|
|
8535
|
+
...DEFAULT_PARSERS.filter((existingParser) => existingParser.filetype !== parser.filetype),
|
|
8536
|
+
parser
|
|
8537
|
+
];
|
|
8128
8538
|
}
|
|
8129
8539
|
}
|
|
8130
8540
|
var isUrl = (path) => path.startsWith("http://") || path.startsWith("https://");
|
|
@@ -8242,6 +8652,7 @@ class TreeSitterClient extends EventEmitter2 {
|
|
|
8242
8652
|
addFiletypeParser(filetypeParser) {
|
|
8243
8653
|
const resolvedParser = {
|
|
8244
8654
|
...filetypeParser,
|
|
8655
|
+
aliases: filetypeParser.aliases ? [...new Set(filetypeParser.aliases.filter((alias) => alias !== filetypeParser.filetype))] : undefined,
|
|
8245
8656
|
wasm: this.resolvePath(filetypeParser.wasm),
|
|
8246
8657
|
queries: {
|
|
8247
8658
|
highlights: filetypeParser.queries.highlights.map((path) => this.resolvePath(path)),
|
|
@@ -8715,74 +9126,189 @@ function getDataPaths() {
|
|
|
8715
9126
|
}
|
|
8716
9127
|
|
|
8717
9128
|
// src/lib/tree-sitter/resolve-ft.ts
|
|
9129
|
+
import path2 from "path";
|
|
9130
|
+
var extensionToFiletype = new Map([
|
|
9131
|
+
["astro", "astro"],
|
|
9132
|
+
["bash", "bash"],
|
|
9133
|
+
["c", "c"],
|
|
9134
|
+
["cc", "cpp"],
|
|
9135
|
+
["cjs", "javascript"],
|
|
9136
|
+
["clj", "clojure"],
|
|
9137
|
+
["cljs", "clojure"],
|
|
9138
|
+
["cljc", "clojure"],
|
|
9139
|
+
["cpp", "cpp"],
|
|
9140
|
+
["cxx", "cpp"],
|
|
9141
|
+
["cs", "csharp"],
|
|
9142
|
+
["cts", "typescript"],
|
|
9143
|
+
["ctsx", "typescriptreact"],
|
|
9144
|
+
["dart", "dart"],
|
|
9145
|
+
["diff", "diff"],
|
|
9146
|
+
["edn", "clojure"],
|
|
9147
|
+
["go", "go"],
|
|
9148
|
+
["gemspec", "ruby"],
|
|
9149
|
+
["groovy", "groovy"],
|
|
9150
|
+
["h", "c"],
|
|
9151
|
+
["handlebars", "handlebars"],
|
|
9152
|
+
["hbs", "handlebars"],
|
|
9153
|
+
["hpp", "cpp"],
|
|
9154
|
+
["hxx", "cpp"],
|
|
9155
|
+
["h++", "cpp"],
|
|
9156
|
+
["hh", "cpp"],
|
|
9157
|
+
["hrl", "erlang"],
|
|
9158
|
+
["hs", "haskell"],
|
|
9159
|
+
["htm", "html"],
|
|
9160
|
+
["html", "html"],
|
|
9161
|
+
["ini", "ini"],
|
|
9162
|
+
["js", "javascript"],
|
|
9163
|
+
["jsx", "javascriptreact"],
|
|
9164
|
+
["jl", "julia"],
|
|
9165
|
+
["json", "json"],
|
|
9166
|
+
["ksh", "bash"],
|
|
9167
|
+
["kt", "kotlin"],
|
|
9168
|
+
["kts", "kotlin"],
|
|
9169
|
+
["latex", "latex"],
|
|
9170
|
+
["less", "less"],
|
|
9171
|
+
["lua", "lua"],
|
|
9172
|
+
["markdown", "markdown"],
|
|
9173
|
+
["md", "markdown"],
|
|
9174
|
+
["mdown", "markdown"],
|
|
9175
|
+
["mkd", "markdown"],
|
|
9176
|
+
["mjs", "javascript"],
|
|
9177
|
+
["ml", "ocaml"],
|
|
9178
|
+
["mli", "ocaml"],
|
|
9179
|
+
["mts", "typescript"],
|
|
9180
|
+
["mtsx", "typescriptreact"],
|
|
9181
|
+
["patch", "diff"],
|
|
9182
|
+
["php", "php"],
|
|
9183
|
+
["pl", "perl"],
|
|
9184
|
+
["pm", "perl"],
|
|
9185
|
+
["ps1", "powershell"],
|
|
9186
|
+
["psm1", "powershell"],
|
|
9187
|
+
["py", "python"],
|
|
9188
|
+
["pyi", "python"],
|
|
9189
|
+
["r", "r"],
|
|
9190
|
+
["rb", "ruby"],
|
|
9191
|
+
["rake", "ruby"],
|
|
9192
|
+
["rs", "rust"],
|
|
9193
|
+
["ru", "ruby"],
|
|
9194
|
+
["sass", "sass"],
|
|
9195
|
+
["sc", "scala"],
|
|
9196
|
+
["scala", "scala"],
|
|
9197
|
+
["scss", "scss"],
|
|
9198
|
+
["sh", "bash"],
|
|
9199
|
+
["sql", "sql"],
|
|
9200
|
+
["svelte", "svelte"],
|
|
9201
|
+
["swift", "swift"],
|
|
9202
|
+
["ts", "typescript"],
|
|
9203
|
+
["tsx", "typescriptreact"],
|
|
9204
|
+
["tex", "latex"],
|
|
9205
|
+
["toml", "toml"],
|
|
9206
|
+
["vue", "vue"],
|
|
9207
|
+
["vim", "vim"],
|
|
9208
|
+
["xml", "xml"],
|
|
9209
|
+
["xsl", "xsl"],
|
|
9210
|
+
["yaml", "yaml"],
|
|
9211
|
+
["yml", "yaml"],
|
|
9212
|
+
["zig", "zig"],
|
|
9213
|
+
["zon", "zig"],
|
|
9214
|
+
["zsh", "bash"],
|
|
9215
|
+
["c++", "cpp"],
|
|
9216
|
+
["erl", "erlang"],
|
|
9217
|
+
["exs", "elixir"],
|
|
9218
|
+
["ex", "elixir"],
|
|
9219
|
+
["elm", "elm"],
|
|
9220
|
+
["fsharp", "fsharp"],
|
|
9221
|
+
["fs", "fsharp"],
|
|
9222
|
+
["fsx", "fsharp"],
|
|
9223
|
+
["fsscript", "fsharp"],
|
|
9224
|
+
["fsi", "fsharp"],
|
|
9225
|
+
["java", "java"],
|
|
9226
|
+
["css", "css"]
|
|
9227
|
+
]);
|
|
9228
|
+
var basenameToFiletype = new Map([
|
|
9229
|
+
[".bash_aliases", "bash"],
|
|
9230
|
+
[".bash_logout", "bash"],
|
|
9231
|
+
[".bash_profile", "bash"],
|
|
9232
|
+
[".bashrc", "bash"],
|
|
9233
|
+
[".kshrc", "bash"],
|
|
9234
|
+
[".profile", "bash"],
|
|
9235
|
+
[".vimrc", "vim"],
|
|
9236
|
+
[".zlogin", "bash"],
|
|
9237
|
+
[".zlogout", "bash"],
|
|
9238
|
+
[".zprofile", "bash"],
|
|
9239
|
+
[".zshenv", "bash"],
|
|
9240
|
+
[".zshrc", "bash"],
|
|
9241
|
+
["appfile", "ruby"],
|
|
9242
|
+
["berksfile", "ruby"],
|
|
9243
|
+
["brewfile", "ruby"],
|
|
9244
|
+
["cheffile", "ruby"],
|
|
9245
|
+
["containerfile", "dockerfile"],
|
|
9246
|
+
["dockerfile", "dockerfile"],
|
|
9247
|
+
["fastfile", "ruby"],
|
|
9248
|
+
["gemfile", "ruby"],
|
|
9249
|
+
["gnumakefile", "make"],
|
|
9250
|
+
["gvimrc", "vim"],
|
|
9251
|
+
["guardfile", "ruby"],
|
|
9252
|
+
["makefile", "make"],
|
|
9253
|
+
["podfile", "ruby"],
|
|
9254
|
+
["rakefile", "ruby"],
|
|
9255
|
+
["thorfile", "ruby"],
|
|
9256
|
+
["vagrantfile", "ruby"]
|
|
9257
|
+
]);
|
|
9258
|
+
function normalizeFiletypeToken(value) {
|
|
9259
|
+
const normalizedValue = value.trim().replace(/^\./, "").toLowerCase();
|
|
9260
|
+
return normalizedValue || undefined;
|
|
9261
|
+
}
|
|
9262
|
+
function getBasename(value) {
|
|
9263
|
+
const normalizedValue = value.trim().replaceAll("\\", "/");
|
|
9264
|
+
if (!normalizedValue)
|
|
9265
|
+
return;
|
|
9266
|
+
const basename2 = path2.posix.basename(normalizedValue).toLowerCase();
|
|
9267
|
+
return basename2 || undefined;
|
|
9268
|
+
}
|
|
8718
9269
|
function extToFiletype(extension) {
|
|
8719
|
-
const
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
["tsx", "typescriptreact"],
|
|
8724
|
-
["md", "markdown"],
|
|
8725
|
-
["json", "json"],
|
|
8726
|
-
["py", "python"],
|
|
8727
|
-
["rb", "ruby"],
|
|
8728
|
-
["go", "go"],
|
|
8729
|
-
["rs", "rust"],
|
|
8730
|
-
["c", "c"],
|
|
8731
|
-
["cpp", "cpp"],
|
|
8732
|
-
["c++", "cpp"],
|
|
8733
|
-
["cs", "csharp"],
|
|
8734
|
-
["java", "java"],
|
|
8735
|
-
["kt", "kotlin"],
|
|
8736
|
-
["swift", "swift"],
|
|
8737
|
-
["php", "php"],
|
|
8738
|
-
["sql", "sql"],
|
|
8739
|
-
["pl", "perl"],
|
|
8740
|
-
["lua", "lua"],
|
|
8741
|
-
["erl", "erlang"],
|
|
8742
|
-
["exs", "elixir"],
|
|
8743
|
-
["ex", "elixir"],
|
|
8744
|
-
["elm", "elm"],
|
|
8745
|
-
["fsharp", "fsharp"],
|
|
8746
|
-
["fs", "fsharp"],
|
|
8747
|
-
["fsx", "fsharp"],
|
|
8748
|
-
["fsscript", "fsharp"],
|
|
8749
|
-
["fsi", "fsharp"],
|
|
8750
|
-
["h", "c"],
|
|
8751
|
-
["hpp", "cpp"],
|
|
8752
|
-
["html", "html"],
|
|
8753
|
-
["css", "css"],
|
|
8754
|
-
["scss", "scss"],
|
|
8755
|
-
["less", "less"],
|
|
8756
|
-
["sh", "shell"],
|
|
8757
|
-
["bash", "shell"],
|
|
8758
|
-
["zsh", "shell"],
|
|
8759
|
-
["vim", "vim"],
|
|
8760
|
-
["yaml", "yaml"],
|
|
8761
|
-
["yml", "yaml"],
|
|
8762
|
-
["toml", "toml"],
|
|
8763
|
-
["xml", "xml"],
|
|
8764
|
-
["zig", "zig"]
|
|
8765
|
-
]);
|
|
8766
|
-
return extensionToFiletype.get(extension);
|
|
9270
|
+
const normalizedExtension = normalizeFiletypeToken(extension);
|
|
9271
|
+
if (!normalizedExtension)
|
|
9272
|
+
return;
|
|
9273
|
+
return extensionToFiletype.get(normalizedExtension);
|
|
8767
9274
|
}
|
|
8768
|
-
function pathToFiletype(
|
|
8769
|
-
if (typeof
|
|
9275
|
+
function pathToFiletype(path3) {
|
|
9276
|
+
if (typeof path3 !== "string")
|
|
8770
9277
|
return;
|
|
8771
|
-
const
|
|
8772
|
-
if (
|
|
9278
|
+
const basename2 = getBasename(path3);
|
|
9279
|
+
if (!basename2)
|
|
8773
9280
|
return;
|
|
9281
|
+
const basenameFiletype = basenameToFiletype.get(basename2);
|
|
9282
|
+
if (basenameFiletype) {
|
|
9283
|
+
return basenameFiletype;
|
|
8774
9284
|
}
|
|
8775
|
-
const
|
|
9285
|
+
const lastDot = basename2.lastIndexOf(".");
|
|
9286
|
+
if (lastDot === -1 || lastDot === basename2.length - 1) {
|
|
9287
|
+
return;
|
|
9288
|
+
}
|
|
9289
|
+
const extension = basename2.substring(lastDot + 1);
|
|
8776
9290
|
return extToFiletype(extension);
|
|
8777
9291
|
}
|
|
9292
|
+
function infoStringToFiletype(infoString) {
|
|
9293
|
+
if (typeof infoString !== "string")
|
|
9294
|
+
return;
|
|
9295
|
+
const token = infoString.trim().split(/\s+/, 1)[0];
|
|
9296
|
+
const directBasenameMatch = basenameToFiletype.get(token.toLowerCase());
|
|
9297
|
+
if (directBasenameMatch)
|
|
9298
|
+
return directBasenameMatch;
|
|
9299
|
+
const normalizedToken = normalizeFiletypeToken(token);
|
|
9300
|
+
if (!normalizedToken)
|
|
9301
|
+
return;
|
|
9302
|
+
return basenameToFiletype.get(normalizedToken) ?? pathToFiletype(normalizedToken) ?? extToFiletype(normalizedToken) ?? normalizedToken;
|
|
9303
|
+
}
|
|
8778
9304
|
|
|
8779
9305
|
// src/lib/tree-sitter/assets/update.ts
|
|
8780
9306
|
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
8781
|
-
import * as
|
|
9307
|
+
import * as path4 from "path";
|
|
8782
9308
|
|
|
8783
9309
|
// src/lib/tree-sitter/download-utils.ts
|
|
8784
9310
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
8785
|
-
import * as
|
|
9311
|
+
import * as path3 from "path";
|
|
8786
9312
|
|
|
8787
9313
|
class DownloadUtils {
|
|
8788
9314
|
static hashUrl(url) {
|
|
@@ -8802,10 +9328,10 @@ class DownloadUtils {
|
|
|
8802
9328
|
const hash = this.hashUrl(source);
|
|
8803
9329
|
cacheFileName = filetype ? `${filetype}-${hash}${fileExtension}` : `${hash}${fileExtension}`;
|
|
8804
9330
|
} else {
|
|
8805
|
-
cacheFileName =
|
|
9331
|
+
cacheFileName = path3.basename(source);
|
|
8806
9332
|
}
|
|
8807
|
-
const cacheFile =
|
|
8808
|
-
await mkdir(
|
|
9333
|
+
const cacheFile = path3.join(cacheDir, cacheSubdir, cacheFileName);
|
|
9334
|
+
await mkdir(path3.dirname(cacheFile), { recursive: true });
|
|
8809
9335
|
try {
|
|
8810
9336
|
const cachedContent = await readFile(cacheFile);
|
|
8811
9337
|
if (cachedContent.byteLength > 0) {
|
|
@@ -8842,7 +9368,7 @@ class DownloadUtils {
|
|
|
8842
9368
|
}
|
|
8843
9369
|
static async downloadToPath(source, targetPath) {
|
|
8844
9370
|
const isUrl2 = source.startsWith("http://") || source.startsWith("https://");
|
|
8845
|
-
await mkdir(
|
|
9371
|
+
await mkdir(path3.dirname(targetPath), { recursive: true });
|
|
8846
9372
|
if (isUrl2) {
|
|
8847
9373
|
try {
|
|
8848
9374
|
console.log(`Downloading from URL: ${source}`);
|
|
@@ -8893,22 +9419,22 @@ import { readdir } from "fs/promises";
|
|
|
8893
9419
|
var __dirname = "/Users/runner/work/opentui/opentui/packages/core/src/lib/tree-sitter/assets";
|
|
8894
9420
|
function getDefaultOptions() {
|
|
8895
9421
|
return {
|
|
8896
|
-
configPath:
|
|
8897
|
-
assetsDir:
|
|
8898
|
-
outputPath:
|
|
9422
|
+
configPath: path4.resolve(__dirname, "../parsers-config"),
|
|
9423
|
+
assetsDir: path4.resolve(__dirname),
|
|
9424
|
+
outputPath: path4.resolve(__dirname, "../default-parsers.ts")
|
|
8899
9425
|
};
|
|
8900
9426
|
}
|
|
8901
9427
|
async function loadConfig(configPath) {
|
|
8902
|
-
let ext =
|
|
9428
|
+
let ext = path4.extname(configPath);
|
|
8903
9429
|
let resolvedConfigPath = configPath;
|
|
8904
9430
|
if (ext === "") {
|
|
8905
|
-
const files = await readdir(
|
|
8906
|
-
const file = files.find((file2) => file2.startsWith(
|
|
9431
|
+
const files = await readdir(path4.dirname(configPath));
|
|
9432
|
+
const file = files.find((file2) => file2.startsWith(path4.basename(configPath)) && (file2.endsWith(".json") || file2.endsWith(".ts") || file2.endsWith(".js")));
|
|
8907
9433
|
if (!file) {
|
|
8908
9434
|
throw new Error(`No config file found for ${configPath}`);
|
|
8909
9435
|
}
|
|
8910
|
-
resolvedConfigPath =
|
|
8911
|
-
ext =
|
|
9436
|
+
resolvedConfigPath = path4.join(path4.dirname(configPath), file);
|
|
9437
|
+
ext = path4.extname(resolvedConfigPath);
|
|
8912
9438
|
}
|
|
8913
9439
|
if (ext === ".json") {
|
|
8914
9440
|
const configContent = await readFile2(resolvedConfigPath, "utf-8");
|
|
@@ -8920,25 +9446,25 @@ async function loadConfig(configPath) {
|
|
|
8920
9446
|
throw new Error(`Unsupported config file extension: ${ext}`);
|
|
8921
9447
|
}
|
|
8922
9448
|
async function downloadLanguage(filetype, languageUrl, assetsDir, outputPath) {
|
|
8923
|
-
const languageDir =
|
|
8924
|
-
const languageFilename =
|
|
8925
|
-
const languagePath =
|
|
9449
|
+
const languageDir = path4.join(assetsDir, filetype);
|
|
9450
|
+
const languageFilename = path4.basename(languageUrl);
|
|
9451
|
+
const languagePath = path4.join(languageDir, languageFilename);
|
|
8926
9452
|
const result = await DownloadUtils.downloadToPath(languageUrl, languagePath);
|
|
8927
9453
|
if (result.error) {
|
|
8928
9454
|
throw new Error(`Failed to download language for ${filetype}: ${result.error}`);
|
|
8929
9455
|
}
|
|
8930
|
-
return "./" +
|
|
9456
|
+
return "./" + path4.relative(path4.dirname(outputPath), languagePath);
|
|
8931
9457
|
}
|
|
8932
9458
|
async function downloadAndCombineQueries(filetype, queryUrls, assetsDir, outputPath, queryType, configPath) {
|
|
8933
|
-
const queriesDir =
|
|
8934
|
-
const queryPath =
|
|
9459
|
+
const queriesDir = path4.join(assetsDir, filetype);
|
|
9460
|
+
const queryPath = path4.join(queriesDir, `${queryType}.scm`);
|
|
8935
9461
|
const queryContents = [];
|
|
8936
9462
|
for (let i = 0;i < queryUrls.length; i++) {
|
|
8937
9463
|
const queryUrl = queryUrls[i];
|
|
8938
9464
|
if (queryUrl.startsWith("./")) {
|
|
8939
9465
|
console.log(` Using local query ${i + 1}/${queryUrls.length}: ${queryUrl}`);
|
|
8940
9466
|
try {
|
|
8941
|
-
const localPath =
|
|
9467
|
+
const localPath = path4.resolve(path4.dirname(configPath), queryUrl);
|
|
8942
9468
|
const content = await readFile2(localPath, "utf-8");
|
|
8943
9469
|
if (content.trim()) {
|
|
8944
9470
|
queryContents.push(content);
|
|
@@ -8975,7 +9501,7 @@ ${content}`);
|
|
|
8975
9501
|
`);
|
|
8976
9502
|
await writeFile2(queryPath, combinedContent, "utf-8");
|
|
8977
9503
|
console.log(` Combined ${queryContents.length} queries into ${queryPath}`);
|
|
8978
|
-
return "./" +
|
|
9504
|
+
return "./" + path4.relative(path4.dirname(outputPath), queryPath);
|
|
8979
9505
|
}
|
|
8980
9506
|
async function generateDefaultParsersFile(parsers, outputPath) {
|
|
8981
9507
|
const imports = parsers.map((parser) => {
|
|
@@ -9000,9 +9526,11 @@ async function generateDefaultParsersFile(parsers, outputPath) {
|
|
|
9000
9526
|
queriesLines.push(` injections: [resolve(dirname(fileURLToPath(import.meta.url)), ${safeFiletype}_injections)],`);
|
|
9001
9527
|
}
|
|
9002
9528
|
const injectionMappingLine = parser.injectionMapping ? ` injectionMapping: ${JSON.stringify(parser.injectionMapping, null, 10)},` : "";
|
|
9529
|
+
const aliasesLine = parser.aliases?.length ? ` aliases: ${JSON.stringify(parser.aliases)},` : "";
|
|
9003
9530
|
return ` {
|
|
9004
9531
|
filetype: "${parser.filetype}",
|
|
9005
|
-
|
|
9532
|
+
${aliasesLine ? aliasesLine + `
|
|
9533
|
+
` : ""} queries: {
|
|
9006
9534
|
${queriesLines.join(`
|
|
9007
9535
|
`)}
|
|
9008
9536
|
},
|
|
@@ -9033,9 +9561,9 @@ ${parserDefinitions},
|
|
|
9033
9561
|
return _cachedParsers
|
|
9034
9562
|
}
|
|
9035
9563
|
`;
|
|
9036
|
-
await mkdir2(
|
|
9564
|
+
await mkdir2(path4.dirname(outputPath), { recursive: true });
|
|
9037
9565
|
await writeFile2(outputPath, fileContent, "utf-8");
|
|
9038
|
-
console.log(`Generated ${
|
|
9566
|
+
console.log(`Generated ${path4.basename(outputPath)} with ${parsers.length} parsers`);
|
|
9039
9567
|
}
|
|
9040
9568
|
async function main(options) {
|
|
9041
9569
|
const opts = { ...getDefaultOptions(), ...options };
|
|
@@ -9060,6 +9588,7 @@ async function main(options) {
|
|
|
9060
9588
|
}
|
|
9061
9589
|
generatedParsers.push({
|
|
9062
9590
|
filetype: parser.filetype,
|
|
9591
|
+
aliases: parser.aliases,
|
|
9063
9592
|
languagePath,
|
|
9064
9593
|
highlightsPath,
|
|
9065
9594
|
injectionsPath,
|
|
@@ -10334,6 +10863,21 @@ class OptimizedBuffer {
|
|
|
10334
10863
|
fillRect(x, y, width, height, bg2) {
|
|
10335
10864
|
this.lib.bufferFillRect(this.bufferPtr, x, y, width, height, bg2);
|
|
10336
10865
|
}
|
|
10866
|
+
colorMatrix(matrix, cellMask, strength = 1, target = 3 /* Both */) {
|
|
10867
|
+
this.guard();
|
|
10868
|
+
if (matrix.length !== 16)
|
|
10869
|
+
throw new RangeError(`colorMatrix matrix must have length 16, got ${matrix.length}`);
|
|
10870
|
+
const cellMaskCount = Math.floor(cellMask.length / 3);
|
|
10871
|
+
this.lib.bufferColorMatrix(this.bufferPtr, ptr(matrix), ptr(cellMask), cellMaskCount, strength, target);
|
|
10872
|
+
}
|
|
10873
|
+
colorMatrixUniform(matrix, strength = 1, target = 3 /* Both */) {
|
|
10874
|
+
this.guard();
|
|
10875
|
+
if (matrix.length !== 16)
|
|
10876
|
+
throw new RangeError(`colorMatrixUniform matrix must have length 16, got ${matrix.length}`);
|
|
10877
|
+
if (strength === 0)
|
|
10878
|
+
return;
|
|
10879
|
+
this.lib.bufferColorMatrixUniform(this.bufferPtr, ptr(matrix), strength, target);
|
|
10880
|
+
}
|
|
10337
10881
|
drawFrameBuffer(destX, destY, frameBuffer, sourceX, sourceY, sourceWidth, sourceHeight) {
|
|
10338
10882
|
this.guard();
|
|
10339
10883
|
this.lib.drawFrameBuffer(this.bufferPtr, destX, destY, frameBuffer.ptr, sourceX, sourceY, sourceWidth, sourceHeight);
|
|
@@ -11421,6 +11965,14 @@ function getOpenTUILib(libPath) {
|
|
|
11421
11965
|
args: ["ptr", "u32", "u32", "u32", "u32", "ptr"],
|
|
11422
11966
|
returns: "void"
|
|
11423
11967
|
},
|
|
11968
|
+
bufferColorMatrix: {
|
|
11969
|
+
args: ["ptr", "ptr", "ptr", "usize", "f32", "u8"],
|
|
11970
|
+
returns: "void"
|
|
11971
|
+
},
|
|
11972
|
+
bufferColorMatrixUniform: {
|
|
11973
|
+
args: ["ptr", "ptr", "f32", "u8"],
|
|
11974
|
+
returns: "void"
|
|
11975
|
+
},
|
|
11424
11976
|
bufferResize: {
|
|
11425
11977
|
args: ["ptr", "u32", "u32"],
|
|
11426
11978
|
returns: "void"
|
|
@@ -12644,6 +13196,12 @@ class FFIRenderLib {
|
|
|
12644
13196
|
const bg2 = color.buffer;
|
|
12645
13197
|
this.opentui.symbols.bufferFillRect(buffer, x, y, width, height, bg2);
|
|
12646
13198
|
}
|
|
13199
|
+
bufferColorMatrix(buffer, matrixPtr, cellMaskPtr, cellMaskCount, strength, target) {
|
|
13200
|
+
this.opentui.symbols.bufferColorMatrix(buffer, matrixPtr, cellMaskPtr, cellMaskCount, strength, target);
|
|
13201
|
+
}
|
|
13202
|
+
bufferColorMatrixUniform(buffer, matrixPtr, strength, target) {
|
|
13203
|
+
this.opentui.symbols.bufferColorMatrixUniform(buffer, matrixPtr, strength, target);
|
|
13204
|
+
}
|
|
12647
13205
|
bufferDrawSuperSampleBuffer(buffer, x, y, pixelDataPtr, pixelDataLength, format, alignedBytesPerRow) {
|
|
12648
13206
|
const formatId = format === "bgra8unorm" ? 0 : 1;
|
|
12649
13207
|
this.opentui.symbols.bufferDrawSuperSampleBuffer(buffer, x, y, pixelDataPtr, pixelDataLength, formatId, alignedBytesPerRow);
|
|
@@ -12899,8 +13457,8 @@ class FFIRenderLib {
|
|
|
12899
13457
|
textBufferAppendFromMemId(buffer, memId) {
|
|
12900
13458
|
this.opentui.symbols.textBufferAppendFromMemId(buffer, memId);
|
|
12901
13459
|
}
|
|
12902
|
-
textBufferLoadFile(buffer,
|
|
12903
|
-
const pathBytes = this.encoder.encode(
|
|
13460
|
+
textBufferLoadFile(buffer, path5) {
|
|
13461
|
+
const pathBytes = this.encoder.encode(path5);
|
|
12904
13462
|
return this.opentui.symbols.textBufferLoadFile(buffer, pathBytes, pathBytes.length);
|
|
12905
13463
|
}
|
|
12906
13464
|
textBufferSetStyledText(buffer, chunks) {
|
|
@@ -13767,11 +14325,11 @@ class TextBuffer {
|
|
|
13767
14325
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
13768
14326
|
this._lineInfo = undefined;
|
|
13769
14327
|
}
|
|
13770
|
-
loadFile(
|
|
14328
|
+
loadFile(path5) {
|
|
13771
14329
|
this.guard();
|
|
13772
|
-
const success = this.lib.textBufferLoadFile(this.bufferPtr,
|
|
14330
|
+
const success = this.lib.textBufferLoadFile(this.bufferPtr, path5);
|
|
13773
14331
|
if (!success) {
|
|
13774
|
-
throw new Error(`Failed to load file: ${
|
|
14332
|
+
throw new Error(`Failed to load file: ${path5}`);
|
|
13775
14333
|
}
|
|
13776
14334
|
this._length = this.lib.textBufferGetLength(this.bufferPtr);
|
|
13777
14335
|
this._byteSize = this.lib.textBufferGetByteSize(this.bufferPtr);
|
|
@@ -15388,7 +15946,7 @@ function delegate(mapping, vnode) {
|
|
|
15388
15946
|
import { EventEmitter as EventEmitter7 } from "events";
|
|
15389
15947
|
import { Console } from "console";
|
|
15390
15948
|
import fs from "fs";
|
|
15391
|
-
import
|
|
15949
|
+
import path5 from "path";
|
|
15392
15950
|
import util2 from "util";
|
|
15393
15951
|
|
|
15394
15952
|
// src/lib/output.capture.ts
|
|
@@ -16445,7 +17003,7 @@ class TerminalConsole extends EventEmitter7 {
|
|
|
16445
17003
|
try {
|
|
16446
17004
|
const timestamp = Date.now();
|
|
16447
17005
|
const filename = `_console_${timestamp}.log`;
|
|
16448
|
-
const filepath =
|
|
17006
|
+
const filepath = path5.join(process.cwd(), filename);
|
|
16449
17007
|
const allLogEntries = [...this._allLogEntries, ...terminalConsoleCache.cachedLogs];
|
|
16450
17008
|
const logLines = [];
|
|
16451
17009
|
for (const [date, level, args, callerInfo] of allLogEntries) {
|
|
@@ -16663,7 +17221,7 @@ registerEnvVar({
|
|
|
16663
17221
|
});
|
|
16664
17222
|
registerEnvVar({
|
|
16665
17223
|
name: "OTUI_USE_ALTERNATE_SCREEN",
|
|
16666
|
-
description: "
|
|
17224
|
+
description: "Use the terminal alternate screen buffer.",
|
|
16667
17225
|
type: "boolean",
|
|
16668
17226
|
default: true
|
|
16669
17227
|
});
|
|
@@ -16829,8 +17387,15 @@ async function createCliRenderer(config = {}) {
|
|
|
16829
17387
|
}
|
|
16830
17388
|
var CliRenderEvents;
|
|
16831
17389
|
((CliRenderEvents2) => {
|
|
17390
|
+
CliRenderEvents2["RESIZE"] = "resize";
|
|
17391
|
+
CliRenderEvents2["FOCUS"] = "focus";
|
|
17392
|
+
CliRenderEvents2["BLUR"] = "blur";
|
|
17393
|
+
CliRenderEvents2["THEME_MODE"] = "theme_mode";
|
|
17394
|
+
CliRenderEvents2["CAPABILITIES"] = "capabilities";
|
|
17395
|
+
CliRenderEvents2["SELECTION"] = "selection";
|
|
16832
17396
|
CliRenderEvents2["DEBUG_OVERLAY_TOGGLE"] = "debugOverlay:toggle";
|
|
16833
17397
|
CliRenderEvents2["DESTROY"] = "destroy";
|
|
17398
|
+
CliRenderEvents2["MEMORY_SNAPSHOT"] = "memory:snapshot";
|
|
16834
17399
|
})(CliRenderEvents ||= {});
|
|
16835
17400
|
var RendererControlState;
|
|
16836
17401
|
((RendererControlState2) => {
|
|
@@ -16954,6 +17519,7 @@ class CliRenderer extends EventEmitter8 {
|
|
|
16954
17519
|
_paletteDetectionPromise = null;
|
|
16955
17520
|
_onDestroy;
|
|
16956
17521
|
_themeMode = null;
|
|
17522
|
+
_terminalFocusState = null;
|
|
16957
17523
|
sequenceHandlers = [];
|
|
16958
17524
|
prependedInputHandlers = [];
|
|
16959
17525
|
shouldRestoreModesOnNextFocus = false;
|
|
@@ -17091,6 +17657,12 @@ Captured output:
|
|
|
17091
17657
|
this.drainStdinParser();
|
|
17092
17658
|
},
|
|
17093
17659
|
useKittyKeyboard: useKittyForParsing,
|
|
17660
|
+
protocolContext: {
|
|
17661
|
+
kittyKeyboardEnabled: useKittyForParsing,
|
|
17662
|
+
privateCapabilityRepliesActive: false,
|
|
17663
|
+
pixelResolutionQueryActive: false,
|
|
17664
|
+
explicitWidthCprActive: false
|
|
17665
|
+
},
|
|
17094
17666
|
clock: this.clock
|
|
17095
17667
|
});
|
|
17096
17668
|
this._console = new TerminalConsole(this, {
|
|
@@ -17154,6 +17726,18 @@ Captured output:
|
|
|
17154
17726
|
get currentFocusedRenderable() {
|
|
17155
17727
|
return this._currentFocusedRenderable;
|
|
17156
17728
|
}
|
|
17729
|
+
normalizeClockTime(now, fallback) {
|
|
17730
|
+
if (Number.isFinite(now)) {
|
|
17731
|
+
return now;
|
|
17732
|
+
}
|
|
17733
|
+
return Number.isFinite(fallback) ? fallback : 0;
|
|
17734
|
+
}
|
|
17735
|
+
getElapsedMs(now, then) {
|
|
17736
|
+
if (!Number.isFinite(now) || !Number.isFinite(then)) {
|
|
17737
|
+
return 0;
|
|
17738
|
+
}
|
|
17739
|
+
return Math.max(now - then, 0);
|
|
17740
|
+
}
|
|
17157
17741
|
focusRenderable(renderable) {
|
|
17158
17742
|
if (this._currentFocusedRenderable === renderable)
|
|
17159
17743
|
return;
|
|
@@ -17210,8 +17794,8 @@ Captured output:
|
|
|
17210
17794
|
}
|
|
17211
17795
|
if (!this.updateScheduled && !this.renderTimeout) {
|
|
17212
17796
|
this.updateScheduled = true;
|
|
17213
|
-
const now = this.clock.now();
|
|
17214
|
-
const elapsed = now
|
|
17797
|
+
const now = this.normalizeClockTime(this.clock.now(), this.lastTime);
|
|
17798
|
+
const elapsed = this.getElapsedMs(now, this.lastTime);
|
|
17215
17799
|
const delay = Math.max(this.minTargetFrameTime - elapsed, 0);
|
|
17216
17800
|
if (delay === 0) {
|
|
17217
17801
|
process.nextTick(() => this.activateFrame());
|
|
@@ -17357,7 +17941,7 @@ Captured output:
|
|
|
17357
17941
|
this.nextRenderBuffer = this.lib.getNextBuffer(this.rendererPtr);
|
|
17358
17942
|
this._console.resize(this.width, this.height);
|
|
17359
17943
|
this.root.resize(this.width, this.height);
|
|
17360
|
-
this.emit("resize"
|
|
17944
|
+
this.emit("resize" /* RESIZE */, this.width, this.height);
|
|
17361
17945
|
this.requestRender();
|
|
17362
17946
|
}
|
|
17363
17947
|
interceptStdoutWrite = (chunk, encoding, callback) => {
|
|
@@ -17408,9 +17992,11 @@ Captured output:
|
|
|
17408
17992
|
}
|
|
17409
17993
|
enableKittyKeyboard(flags = 3) {
|
|
17410
17994
|
this.lib.enableKittyKeyboard(this.rendererPtr, flags);
|
|
17995
|
+
this.updateStdinParserProtocolContext({ kittyKeyboardEnabled: true });
|
|
17411
17996
|
}
|
|
17412
17997
|
disableKittyKeyboard() {
|
|
17413
17998
|
this.lib.disableKittyKeyboard(this.rendererPtr);
|
|
17999
|
+
this.updateStdinParserProtocolContext({ kittyKeyboardEnabled: false }, true);
|
|
17414
18000
|
}
|
|
17415
18001
|
set useThread(useThread) {
|
|
17416
18002
|
this._useThread = useThread;
|
|
@@ -17420,6 +18006,10 @@ Captured output:
|
|
|
17420
18006
|
if (this._terminalIsSetup)
|
|
17421
18007
|
return;
|
|
17422
18008
|
this._terminalIsSetup = true;
|
|
18009
|
+
this.updateStdinParserProtocolContext({
|
|
18010
|
+
privateCapabilityRepliesActive: true,
|
|
18011
|
+
explicitWidthCprActive: true
|
|
18012
|
+
});
|
|
17423
18013
|
this.lib.setupTerminal(this.rendererPtr, this._useAlternateScreen);
|
|
17424
18014
|
this._capabilities = this.lib.getTerminalCapabilities(this.rendererPtr);
|
|
17425
18015
|
if (this.debugOverlay.enabled) {
|
|
@@ -17433,6 +18023,10 @@ Captured output:
|
|
|
17433
18023
|
this.capabilityTimeoutId = this.clock.setTimeout(() => {
|
|
17434
18024
|
this.capabilityTimeoutId = null;
|
|
17435
18025
|
this.removeInputHandler(this.capabilityHandler);
|
|
18026
|
+
this.updateStdinParserProtocolContext({
|
|
18027
|
+
privateCapabilityRepliesActive: false,
|
|
18028
|
+
explicitWidthCprActive: false
|
|
18029
|
+
}, true);
|
|
17436
18030
|
}, 5000);
|
|
17437
18031
|
if (this._useMouse) {
|
|
17438
18032
|
this.enableMouse();
|
|
@@ -17459,6 +18053,13 @@ Captured output:
|
|
|
17459
18053
|
removeInputHandler(handler) {
|
|
17460
18054
|
this.sequenceHandlers = this.sequenceHandlers.filter((candidate) => candidate !== handler);
|
|
17461
18055
|
}
|
|
18056
|
+
updateStdinParserProtocolContext(patch, drain = false) {
|
|
18057
|
+
if (!this.stdinParser)
|
|
18058
|
+
return;
|
|
18059
|
+
this.stdinParser.updateProtocolContext(patch);
|
|
18060
|
+
if (drain)
|
|
18061
|
+
this.drainStdinParser();
|
|
18062
|
+
}
|
|
17462
18063
|
subscribeOsc(handler) {
|
|
17463
18064
|
this.oscSubscribers.add(handler);
|
|
17464
18065
|
return () => {
|
|
@@ -17469,7 +18070,7 @@ Captured output:
|
|
|
17469
18070
|
if (isCapabilityResponse(sequence)) {
|
|
17470
18071
|
this.lib.processCapabilityResponse(this.rendererPtr, sequence);
|
|
17471
18072
|
this._capabilities = this.lib.getTerminalCapabilities(this.rendererPtr);
|
|
17472
|
-
this.emit("capabilities"
|
|
18073
|
+
this.emit("capabilities" /* CAPABILITIES */, this._capabilities);
|
|
17473
18074
|
return true;
|
|
17474
18075
|
}
|
|
17475
18076
|
return false;
|
|
@@ -17480,12 +18081,18 @@ Captured output:
|
|
|
17480
18081
|
this.lib.restoreTerminalModes(this.rendererPtr);
|
|
17481
18082
|
this.shouldRestoreModesOnNextFocus = false;
|
|
17482
18083
|
}
|
|
17483
|
-
this.
|
|
18084
|
+
if (this._terminalFocusState !== true) {
|
|
18085
|
+
this._terminalFocusState = true;
|
|
18086
|
+
this.emit("focus" /* FOCUS */);
|
|
18087
|
+
}
|
|
17484
18088
|
return true;
|
|
17485
18089
|
}
|
|
17486
18090
|
if (sequence === "\x1B[O") {
|
|
17487
18091
|
this.shouldRestoreModesOnNextFocus = true;
|
|
17488
|
-
this.
|
|
18092
|
+
if (this._terminalFocusState !== false) {
|
|
18093
|
+
this._terminalFocusState = false;
|
|
18094
|
+
this.emit("blur" /* BLUR */);
|
|
18095
|
+
}
|
|
17489
18096
|
return true;
|
|
17490
18097
|
}
|
|
17491
18098
|
return false;
|
|
@@ -17494,14 +18101,14 @@ Captured output:
|
|
|
17494
18101
|
if (sequence === "\x1B[?997;1n") {
|
|
17495
18102
|
if (this._themeMode !== "dark") {
|
|
17496
18103
|
this._themeMode = "dark";
|
|
17497
|
-
this.emit("theme_mode"
|
|
18104
|
+
this.emit("theme_mode" /* THEME_MODE */, "dark");
|
|
17498
18105
|
}
|
|
17499
18106
|
return true;
|
|
17500
18107
|
}
|
|
17501
18108
|
if (sequence === "\x1B[?997;2n") {
|
|
17502
18109
|
if (this._themeMode !== "light") {
|
|
17503
18110
|
this._themeMode = "light";
|
|
17504
|
-
this.emit("theme_mode"
|
|
18111
|
+
this.emit("theme_mode" /* THEME_MODE */, "light");
|
|
17505
18112
|
}
|
|
17506
18113
|
return true;
|
|
17507
18114
|
}
|
|
@@ -17577,8 +18184,9 @@ Captured output:
|
|
|
17577
18184
|
const resolution = parsePixelResolution(sequence);
|
|
17578
18185
|
if (resolution) {
|
|
17579
18186
|
this._resolution = resolution;
|
|
17580
|
-
this.waitingForPixelResolution = false;
|
|
17581
18187
|
}
|
|
18188
|
+
this.waitingForPixelResolution = false;
|
|
18189
|
+
this.updateStdinParserProtocolContext({ pixelResolutionQueryActive: false }, true);
|
|
17582
18190
|
return true;
|
|
17583
18191
|
}
|
|
17584
18192
|
return false;
|
|
@@ -17777,7 +18385,7 @@ Captured output:
|
|
|
17777
18385
|
arrayBuffers: memoryUsage.arrayBuffers
|
|
17778
18386
|
};
|
|
17779
18387
|
this.lib.updateMemoryStats(this.rendererPtr, this.lastMemorySnapshot.heapUsed, this.lastMemorySnapshot.heapTotal, this.lastMemorySnapshot.arrayBuffers);
|
|
17780
|
-
this.emit("memory:snapshot"
|
|
18388
|
+
this.emit("memory:snapshot" /* MEMORY_SNAPSHOT */, this.lastMemorySnapshot);
|
|
17781
18389
|
}
|
|
17782
18390
|
startMemorySnapshotTimer() {
|
|
17783
18391
|
this.stopMemorySnapshotTimer();
|
|
@@ -17818,6 +18426,7 @@ Captured output:
|
|
|
17818
18426
|
}
|
|
17819
18427
|
queryPixelResolution() {
|
|
17820
18428
|
this.waitingForPixelResolution = true;
|
|
18429
|
+
this.updateStdinParserProtocolContext({ pixelResolutionQueryActive: true });
|
|
17821
18430
|
this.lib.queryPixelResolution(this.rendererPtr);
|
|
17822
18431
|
}
|
|
17823
18432
|
processResize(width, height) {
|
|
@@ -17849,7 +18458,7 @@ Captured output:
|
|
|
17849
18458
|
this.currentRenderBuffer = this.lib.getCurrentBuffer(this.rendererPtr);
|
|
17850
18459
|
this._console.resize(this.width, this.height);
|
|
17851
18460
|
this.root.resize(this.width, this.height);
|
|
17852
|
-
this.emit("resize"
|
|
18461
|
+
this.emit("resize" /* RESIZE */, this.width, this.height);
|
|
17853
18462
|
this.requestRender();
|
|
17854
18463
|
}
|
|
17855
18464
|
setBackgroundColor(color) {
|
|
@@ -17991,6 +18600,12 @@ Captured output:
|
|
|
17991
18600
|
this._suspendedMouseEnabled = this._useMouse;
|
|
17992
18601
|
this.disableMouse();
|
|
17993
18602
|
this.removeExitListeners();
|
|
18603
|
+
this.waitingForPixelResolution = false;
|
|
18604
|
+
this.updateStdinParserProtocolContext({
|
|
18605
|
+
privateCapabilityRepliesActive: false,
|
|
18606
|
+
pixelResolutionQueryActive: false,
|
|
18607
|
+
explicitWidthCprActive: false
|
|
18608
|
+
});
|
|
17994
18609
|
this.stdinParser?.reset();
|
|
17995
18610
|
this.stdin.removeListener("data", this.stdinListener);
|
|
17996
18611
|
this.lib.suspendRenderer(this.rendererPtr);
|
|
@@ -18097,6 +18712,11 @@ Captured output:
|
|
|
18097
18712
|
}
|
|
18098
18713
|
this._isRunning = false;
|
|
18099
18714
|
this.waitingForPixelResolution = false;
|
|
18715
|
+
this.updateStdinParserProtocolContext({
|
|
18716
|
+
privateCapabilityRepliesActive: false,
|
|
18717
|
+
pixelResolutionQueryActive: false,
|
|
18718
|
+
explicitWidthCprActive: false
|
|
18719
|
+
}, true);
|
|
18100
18720
|
this.setCapturedRenderable(undefined);
|
|
18101
18721
|
try {
|
|
18102
18722
|
this.root.destroyRecursively();
|
|
@@ -18129,7 +18749,7 @@ Captured output:
|
|
|
18129
18749
|
startRenderLoop() {
|
|
18130
18750
|
if (!this._isRunning)
|
|
18131
18751
|
return;
|
|
18132
|
-
this.lastTime = this.clock.now();
|
|
18752
|
+
this.lastTime = this.normalizeClockTime(this.clock.now(), 0);
|
|
18133
18753
|
this.frameCount = 0;
|
|
18134
18754
|
this.lastFpsTime = this.lastTime;
|
|
18135
18755
|
this.currentFps = 0;
|
|
@@ -18145,12 +18765,12 @@ Captured output:
|
|
|
18145
18765
|
this.renderTimeout = null;
|
|
18146
18766
|
}
|
|
18147
18767
|
try {
|
|
18148
|
-
const now = this.clock.now();
|
|
18149
|
-
const elapsed = now
|
|
18768
|
+
const now = this.normalizeClockTime(this.clock.now(), this.lastTime);
|
|
18769
|
+
const elapsed = this.getElapsedMs(now, this.lastTime);
|
|
18150
18770
|
const deltaTime = elapsed;
|
|
18151
18771
|
this.lastTime = now;
|
|
18152
18772
|
this.frameCount++;
|
|
18153
|
-
if (now
|
|
18773
|
+
if (this.getElapsedMs(now, this.lastFpsTime) >= 1000) {
|
|
18154
18774
|
this.currentFps = this.frameCount;
|
|
18155
18775
|
this.frameCount = 0;
|
|
18156
18776
|
this.lastFpsTime = now;
|
|
@@ -18336,7 +18956,7 @@ Captured output:
|
|
|
18336
18956
|
finishSelection() {
|
|
18337
18957
|
if (this.currentSelection) {
|
|
18338
18958
|
this.currentSelection.isDragging = false;
|
|
18339
|
-
this.emit("selection"
|
|
18959
|
+
this.emit("selection" /* SELECTION */, this.currentSelection);
|
|
18340
18960
|
this.notifySelectablesOfSelectionChange();
|
|
18341
18961
|
}
|
|
18342
18962
|
}
|
|
@@ -18409,7 +19029,7 @@ Captured output:
|
|
|
18409
19029
|
}
|
|
18410
19030
|
}
|
|
18411
19031
|
|
|
18412
|
-
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, 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, extToFiletype, pathToFiletype, 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 };
|
|
19032
|
+
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 };
|
|
18413
19033
|
|
|
18414
|
-
//# debugId=
|
|
18415
|
-
//# sourceMappingURL=index-
|
|
19034
|
+
//# debugId=0CC64CF95771CED464756E2164756E21
|
|
19035
|
+
//# sourceMappingURL=index-e89anq5x.js.map
|