@opentuah/core 0.1.95 → 0.1.96
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/README.md +1 -2
- package/buffer.d.ts +9 -0
- package/{index-2fr3e57d.js → index-yc0yx782.js} +392 -211
- package/{index-2fr3e57d.js.map → index-yc0yx782.js.map} +9 -9
- package/index.js +937 -57
- package/index.js.map +10 -9
- package/lib/parse.mouse.d.ts +7 -0
- package/package.json +11 -11
- package/renderables/Diff.d.ts +7 -0
- package/renderables/LineNumberRenderable.d.ts +2 -0
- package/renderables/TextTable.d.ts +126 -0
- package/renderables/Textarea.d.ts +1 -1
- package/renderables/index.d.ts +1 -0
- package/renderer.d.ts +7 -3
- package/testing.js +1 -1
- package/types.d.ts +7 -3
- package/zig-structs.d.ts +16 -0
- package/zig.d.ts +7 -2
|
@@ -6077,8 +6077,23 @@ function extractCompleteSequences(buffer) {
|
|
|
6077
6077
|
return { sequences, remainder: remaining };
|
|
6078
6078
|
}
|
|
6079
6079
|
} else {
|
|
6080
|
-
|
|
6081
|
-
|
|
6080
|
+
const code = remaining.charCodeAt(0);
|
|
6081
|
+
if (code >= 55296 && code <= 56319) {
|
|
6082
|
+
if (remaining.length === 1) {
|
|
6083
|
+
return { sequences, remainder: remaining };
|
|
6084
|
+
}
|
|
6085
|
+
const next = remaining.charCodeAt(1);
|
|
6086
|
+
if (next >= 56320 && next <= 57343) {
|
|
6087
|
+
sequences.push(remaining.slice(0, 2));
|
|
6088
|
+
pos += 2;
|
|
6089
|
+
} else {
|
|
6090
|
+
sequences.push(remaining[0]);
|
|
6091
|
+
pos++;
|
|
6092
|
+
}
|
|
6093
|
+
} else {
|
|
6094
|
+
sequences.push(remaining[0]);
|
|
6095
|
+
pos++;
|
|
6096
|
+
}
|
|
6082
6097
|
}
|
|
6083
6098
|
}
|
|
6084
6099
|
return { sequences, remainder: "" };
|
|
@@ -6502,95 +6517,168 @@ class MouseParser {
|
|
|
6502
6517
|
reset() {
|
|
6503
6518
|
this.mouseButtonsPressed.clear();
|
|
6504
6519
|
}
|
|
6520
|
+
decodeInput(data) {
|
|
6521
|
+
return data.toString();
|
|
6522
|
+
}
|
|
6505
6523
|
parseMouseEvent(data) {
|
|
6506
|
-
const str =
|
|
6507
|
-
const
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
const
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6524
|
+
const str = this.decodeInput(data);
|
|
6525
|
+
const parsed = this.parseMouseSequenceAt(str, 0);
|
|
6526
|
+
return parsed?.event ?? null;
|
|
6527
|
+
}
|
|
6528
|
+
parseAllMouseEvents(data) {
|
|
6529
|
+
const str = this.decodeInput(data);
|
|
6530
|
+
const events = [];
|
|
6531
|
+
let offset = 0;
|
|
6532
|
+
while (offset < str.length) {
|
|
6533
|
+
const parsed = this.parseMouseSequenceAt(str, offset);
|
|
6534
|
+
if (!parsed) {
|
|
6535
|
+
break;
|
|
6536
|
+
}
|
|
6537
|
+
events.push(parsed.event);
|
|
6538
|
+
offset += parsed.consumed;
|
|
6539
|
+
}
|
|
6540
|
+
return events;
|
|
6541
|
+
}
|
|
6542
|
+
parseMouseSequenceAt(str, offset) {
|
|
6543
|
+
if (!str.startsWith("\x1B[", offset))
|
|
6544
|
+
return null;
|
|
6545
|
+
const introducer = str[offset + 2];
|
|
6546
|
+
if (introducer === "<") {
|
|
6547
|
+
return this.parseSgrSequence(str, offset);
|
|
6548
|
+
}
|
|
6549
|
+
if (introducer === "M") {
|
|
6550
|
+
return this.parseBasicSequence(str, offset);
|
|
6551
|
+
}
|
|
6552
|
+
return null;
|
|
6553
|
+
}
|
|
6554
|
+
parseSgrSequence(str, offset) {
|
|
6555
|
+
let index = offset + 3;
|
|
6556
|
+
const values = [0, 0, 0];
|
|
6557
|
+
let part = 0;
|
|
6558
|
+
let hasDigit = false;
|
|
6559
|
+
while (index < str.length) {
|
|
6560
|
+
const char = str[index];
|
|
6561
|
+
const charCode = str.charCodeAt(index);
|
|
6562
|
+
if (charCode >= 48 && charCode <= 57) {
|
|
6563
|
+
hasDigit = true;
|
|
6564
|
+
values[part] = values[part] * 10 + (charCode - 48);
|
|
6565
|
+
index++;
|
|
6566
|
+
continue;
|
|
6567
|
+
}
|
|
6568
|
+
switch (char) {
|
|
6569
|
+
case ";": {
|
|
6570
|
+
if (!hasDigit || part >= 2)
|
|
6571
|
+
return null;
|
|
6572
|
+
part++;
|
|
6573
|
+
hasDigit = false;
|
|
6574
|
+
index++;
|
|
6575
|
+
break;
|
|
6536
6576
|
}
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6577
|
+
case "M":
|
|
6578
|
+
case "m": {
|
|
6579
|
+
if (!hasDigit || part !== 2)
|
|
6580
|
+
return null;
|
|
6581
|
+
return {
|
|
6582
|
+
event: this.decodeSgrEvent(values[0], values[1], values[2], char),
|
|
6583
|
+
consumed: index - offset + 1
|
|
6584
|
+
};
|
|
6543
6585
|
}
|
|
6586
|
+
default:
|
|
6587
|
+
return null;
|
|
6544
6588
|
}
|
|
6545
|
-
return {
|
|
6546
|
-
type,
|
|
6547
|
-
button: button === 3 ? 0 : button,
|
|
6548
|
-
x: parseInt(x) - 1,
|
|
6549
|
-
y: parseInt(y) - 1,
|
|
6550
|
-
modifiers,
|
|
6551
|
-
scroll: scrollInfo
|
|
6552
|
-
};
|
|
6553
6589
|
}
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6590
|
+
return null;
|
|
6591
|
+
}
|
|
6592
|
+
parseBasicSequence(str, offset) {
|
|
6593
|
+
if (offset + 6 > str.length)
|
|
6594
|
+
return null;
|
|
6595
|
+
const buttonByte = str.charCodeAt(offset + 3) - 32;
|
|
6596
|
+
const x = str.charCodeAt(offset + 4) - 33;
|
|
6597
|
+
const y = str.charCodeAt(offset + 5) - 33;
|
|
6598
|
+
return {
|
|
6599
|
+
event: this.decodeBasicEvent(buttonByte, x, y),
|
|
6600
|
+
consumed: 6
|
|
6601
|
+
};
|
|
6602
|
+
}
|
|
6603
|
+
decodeSgrEvent(rawButtonCode, wireX, wireY, pressRelease) {
|
|
6604
|
+
const button = rawButtonCode & 3;
|
|
6605
|
+
const isScroll = (rawButtonCode & 64) !== 0;
|
|
6606
|
+
const scrollDirection = !isScroll ? undefined : MouseParser.SCROLL_DIRECTIONS[button];
|
|
6607
|
+
const isMotion = (rawButtonCode & 32) !== 0;
|
|
6608
|
+
const modifiers = {
|
|
6609
|
+
shift: (rawButtonCode & 4) !== 0,
|
|
6610
|
+
alt: (rawButtonCode & 8) !== 0,
|
|
6611
|
+
ctrl: (rawButtonCode & 16) !== 0
|
|
6612
|
+
};
|
|
6613
|
+
let type;
|
|
6614
|
+
let scrollInfo;
|
|
6615
|
+
if (isScroll && pressRelease === "M") {
|
|
6616
|
+
type = "scroll";
|
|
6617
|
+
scrollInfo = {
|
|
6618
|
+
direction: scrollDirection,
|
|
6619
|
+
delta: 1
|
|
6566
6620
|
};
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
if (isScroll) {
|
|
6571
|
-
type = "scroll";
|
|
6572
|
-
actualButton = 0;
|
|
6573
|
-
scrollInfo = {
|
|
6574
|
-
direction: scrollDirection,
|
|
6575
|
-
delta: 1
|
|
6576
|
-
};
|
|
6577
|
-
} else if (isMotion) {
|
|
6621
|
+
} else if (isMotion) {
|
|
6622
|
+
const isDragging = this.mouseButtonsPressed.size > 0;
|
|
6623
|
+
if (button === 3) {
|
|
6578
6624
|
type = "move";
|
|
6579
|
-
|
|
6625
|
+
} else if (isDragging) {
|
|
6626
|
+
type = "drag";
|
|
6580
6627
|
} else {
|
|
6581
|
-
type =
|
|
6582
|
-
actualButton = button === 3 ? 0 : button;
|
|
6628
|
+
type = "move";
|
|
6583
6629
|
}
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6630
|
+
} else {
|
|
6631
|
+
type = pressRelease === "M" ? "down" : "up";
|
|
6632
|
+
if (type === "down" && button !== 3) {
|
|
6633
|
+
this.mouseButtonsPressed.add(button);
|
|
6634
|
+
} else if (type === "up") {
|
|
6635
|
+
this.mouseButtonsPressed.clear();
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
return {
|
|
6639
|
+
type,
|
|
6640
|
+
button: button === 3 ? 0 : button,
|
|
6641
|
+
x: wireX - 1,
|
|
6642
|
+
y: wireY - 1,
|
|
6643
|
+
modifiers,
|
|
6644
|
+
scroll: scrollInfo
|
|
6645
|
+
};
|
|
6646
|
+
}
|
|
6647
|
+
decodeBasicEvent(buttonByte, x, y) {
|
|
6648
|
+
const button = buttonByte & 3;
|
|
6649
|
+
const isScroll = (buttonByte & 64) !== 0;
|
|
6650
|
+
const isMotion = (buttonByte & 32) !== 0;
|
|
6651
|
+
const scrollDirection = !isScroll ? undefined : MouseParser.SCROLL_DIRECTIONS[button];
|
|
6652
|
+
const modifiers = {
|
|
6653
|
+
shift: (buttonByte & 4) !== 0,
|
|
6654
|
+
alt: (buttonByte & 8) !== 0,
|
|
6655
|
+
ctrl: (buttonByte & 16) !== 0
|
|
6656
|
+
};
|
|
6657
|
+
let type;
|
|
6658
|
+
let actualButton;
|
|
6659
|
+
let scrollInfo;
|
|
6660
|
+
if (isScroll) {
|
|
6661
|
+
type = "scroll";
|
|
6662
|
+
actualButton = 0;
|
|
6663
|
+
scrollInfo = {
|
|
6664
|
+
direction: scrollDirection,
|
|
6665
|
+
delta: 1
|
|
6591
6666
|
};
|
|
6667
|
+
} else if (isMotion) {
|
|
6668
|
+
type = "move";
|
|
6669
|
+
actualButton = button === 3 ? -1 : button;
|
|
6670
|
+
} else {
|
|
6671
|
+
type = button === 3 ? "up" : "down";
|
|
6672
|
+
actualButton = button === 3 ? 0 : button;
|
|
6592
6673
|
}
|
|
6593
|
-
return
|
|
6674
|
+
return {
|
|
6675
|
+
type,
|
|
6676
|
+
button: actualButton,
|
|
6677
|
+
x,
|
|
6678
|
+
y,
|
|
6679
|
+
modifiers,
|
|
6680
|
+
scroll: scrollInfo
|
|
6681
|
+
};
|
|
6594
6682
|
}
|
|
6595
6683
|
}
|
|
6596
6684
|
|
|
@@ -9649,6 +9737,15 @@ class OptimizedBuffer {
|
|
|
9649
9737
|
this.guard();
|
|
9650
9738
|
this.lib.freeUnicode(encoded);
|
|
9651
9739
|
}
|
|
9740
|
+
drawGrid(options) {
|
|
9741
|
+
this.guard();
|
|
9742
|
+
const columnCount = Math.max(0, options.columnOffsets.length - 1);
|
|
9743
|
+
const rowCount = Math.max(0, options.rowOffsets.length - 1);
|
|
9744
|
+
this.lib.bufferDrawGrid(this.bufferPtr, options.borderChars, options.borderFg, options.borderBg, options.columnOffsets, columnCount, options.rowOffsets, rowCount, {
|
|
9745
|
+
drawInner: options.drawInner,
|
|
9746
|
+
drawOuter: options.drawOuter
|
|
9747
|
+
});
|
|
9748
|
+
}
|
|
9652
9749
|
drawChar(char, x, y, fg2, bg2, attributes = 0) {
|
|
9653
9750
|
this.guard();
|
|
9654
9751
|
this.lib.bufferDrawChar(this.bufferPtr, char, x, y, fg2, bg2, attributes);
|
|
@@ -10362,6 +10459,24 @@ var CursorStateStruct = defineStruct([
|
|
|
10362
10459
|
["b", "f32"],
|
|
10363
10460
|
["a", "f32"]
|
|
10364
10461
|
]);
|
|
10462
|
+
var CursorStyleOptionsStruct = defineStruct([
|
|
10463
|
+
["style", "u8", { default: 255 }],
|
|
10464
|
+
["blinking", "u8", { default: 255 }],
|
|
10465
|
+
[
|
|
10466
|
+
"color",
|
|
10467
|
+
"pointer",
|
|
10468
|
+
{
|
|
10469
|
+
optional: true,
|
|
10470
|
+
packTransform: rgbaPackTransform,
|
|
10471
|
+
unpackTransform: rgbaUnpackTransform
|
|
10472
|
+
}
|
|
10473
|
+
],
|
|
10474
|
+
["cursor", "u8", { default: 255 }]
|
|
10475
|
+
]);
|
|
10476
|
+
var GridDrawOptionsStruct = defineStruct([
|
|
10477
|
+
["drawInner", "bool_u8", { default: true }],
|
|
10478
|
+
["drawOuter", "bool_u8", { default: true }]
|
|
10479
|
+
]);
|
|
10365
10480
|
var GrowthPolicyEnum = defineEnum({ grow: 0, block: 1 }, "u8");
|
|
10366
10481
|
var NativeSpanFeedOptionsStruct = defineStruct([
|
|
10367
10482
|
["chunkSize", "u32", { default: 64 * 1024 }],
|
|
@@ -10449,10 +10564,10 @@ registerEnvVar({
|
|
|
10449
10564
|
default: false
|
|
10450
10565
|
});
|
|
10451
10566
|
registerEnvVar({
|
|
10452
|
-
name: "
|
|
10453
|
-
description: "
|
|
10567
|
+
name: "OPENTUI_GRAPHICS",
|
|
10568
|
+
description: "Enable Kitty graphics protocol detection",
|
|
10454
10569
|
type: "boolean",
|
|
10455
|
-
default:
|
|
10570
|
+
default: true
|
|
10456
10571
|
});
|
|
10457
10572
|
registerEnvVar({
|
|
10458
10573
|
name: "OPENTUI_FORCE_NOZWJ",
|
|
@@ -10460,6 +10575,9 @@ registerEnvVar({
|
|
|
10460
10575
|
type: "boolean",
|
|
10461
10576
|
default: false
|
|
10462
10577
|
});
|
|
10578
|
+
var CURSOR_STYLE_TO_ID = { block: 0, line: 1, underline: 2 };
|
|
10579
|
+
var CURSOR_ID_TO_STYLE = ["block", "line", "underline"];
|
|
10580
|
+
var MOUSE_STYLE_TO_ID = { default: 0, pointer: 1, text: 2, crosshair: 3, move: 4, "not-allowed": 5 };
|
|
10463
10581
|
var globalTraceSymbols = null;
|
|
10464
10582
|
var globalFFILogWriter = null;
|
|
10465
10583
|
var exitHandlerRegistered = false;
|
|
@@ -10490,6 +10608,10 @@ function getOpenTUILib(libPath) {
|
|
|
10490
10608
|
args: ["u32", "u32", "bool", "bool"],
|
|
10491
10609
|
returns: "ptr"
|
|
10492
10610
|
},
|
|
10611
|
+
setTerminalEnvVar: {
|
|
10612
|
+
args: ["ptr", "ptr", "usize", "ptr", "usize"],
|
|
10613
|
+
returns: "bool"
|
|
10614
|
+
},
|
|
10493
10615
|
destroyRenderer: {
|
|
10494
10616
|
args: ["ptr"],
|
|
10495
10617
|
returns: "void"
|
|
@@ -10634,10 +10756,6 @@ function getOpenTUILib(libPath) {
|
|
|
10634
10756
|
args: ["ptr", "i32", "i32", "bool"],
|
|
10635
10757
|
returns: "void"
|
|
10636
10758
|
},
|
|
10637
|
-
setCursorStyle: {
|
|
10638
|
-
args: ["ptr", "ptr", "u32", "bool"],
|
|
10639
|
-
returns: "void"
|
|
10640
|
-
},
|
|
10641
10759
|
setCursorColor: {
|
|
10642
10760
|
args: ["ptr", "ptr"],
|
|
10643
10761
|
returns: "void"
|
|
@@ -10646,6 +10764,10 @@ function getOpenTUILib(libPath) {
|
|
|
10646
10764
|
args: ["ptr", "ptr"],
|
|
10647
10765
|
returns: "void"
|
|
10648
10766
|
},
|
|
10767
|
+
setCursorStyleOptions: {
|
|
10768
|
+
args: ["ptr", "ptr"],
|
|
10769
|
+
returns: "void"
|
|
10770
|
+
},
|
|
10649
10771
|
setDebugOverlay: {
|
|
10650
10772
|
args: ["ptr", "bool", "u8"],
|
|
10651
10773
|
returns: "void"
|
|
@@ -10682,6 +10804,10 @@ function getOpenTUILib(libPath) {
|
|
|
10682
10804
|
args: ["ptr", "i32", "i32", "ptr", "u32", "u32", "ptr", "ptr"],
|
|
10683
10805
|
returns: "void"
|
|
10684
10806
|
},
|
|
10807
|
+
bufferDrawGrid: {
|
|
10808
|
+
args: ["ptr", "ptr", "ptr", "ptr", "ptr", "u32", "ptr", "u32", "ptr"],
|
|
10809
|
+
returns: "void"
|
|
10810
|
+
},
|
|
10685
10811
|
bufferDrawBox: {
|
|
10686
10812
|
args: ["ptr", "i32", "i32", "u32", "u32", "ptr", "u32", "ptr", "ptr", "ptr", "u32"],
|
|
10687
10813
|
returns: "void"
|
|
@@ -11721,6 +11847,11 @@ class FFIRenderLib {
|
|
|
11721
11847
|
const remote = options.remote ?? false;
|
|
11722
11848
|
return this.opentui.symbols.createRenderer(width, height, testing, remote);
|
|
11723
11849
|
}
|
|
11850
|
+
setTerminalEnvVar(renderer, key, value) {
|
|
11851
|
+
const keyBytes = this.encoder.encode(key);
|
|
11852
|
+
const valueBytes = this.encoder.encode(value);
|
|
11853
|
+
return this.opentui.symbols.setTerminalEnvVar(renderer, keyBytes, keyBytes.length, valueBytes, valueBytes.length);
|
|
11854
|
+
}
|
|
11724
11855
|
destroyRenderer(renderer) {
|
|
11725
11856
|
this.opentui.symbols.destroyRenderer(renderer);
|
|
11726
11857
|
}
|
|
@@ -11850,6 +11981,13 @@ class FFIRenderLib {
|
|
|
11850
11981
|
bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2, bg2) {
|
|
11851
11982
|
this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2?.buffer ?? null, bg2?.buffer ?? null);
|
|
11852
11983
|
}
|
|
11984
|
+
bufferDrawGrid(buffer, borderChars, borderFg, borderBg, columnOffsets, columnCount, rowOffsets, rowCount, options) {
|
|
11985
|
+
const optionsBuffer = GridDrawOptionsStruct.pack({
|
|
11986
|
+
drawInner: options.drawInner,
|
|
11987
|
+
drawOuter: options.drawOuter
|
|
11988
|
+
});
|
|
11989
|
+
this.opentui.symbols.bufferDrawGrid(buffer, borderChars, borderFg.buffer, borderBg.buffer, columnOffsets, columnCount, rowOffsets, rowCount, ptr4(optionsBuffer));
|
|
11990
|
+
}
|
|
11853
11991
|
bufferDrawBox(buffer, x, y, width, height, borderChars, packedOptions, borderColor, backgroundColor, title) {
|
|
11854
11992
|
const titleBytes = title ? this.encoder.encode(title) : null;
|
|
11855
11993
|
const titleLen = title ? titleBytes.length : 0;
|
|
@@ -11880,10 +12018,6 @@ class FFIRenderLib {
|
|
|
11880
12018
|
setCursorPosition(renderer, x, y, visible) {
|
|
11881
12019
|
this.opentui.symbols.setCursorPosition(renderer, x, y, visible);
|
|
11882
12020
|
}
|
|
11883
|
-
setCursorStyle(renderer, style, blinking) {
|
|
11884
|
-
const stylePtr = this.encoder.encode(style);
|
|
11885
|
-
this.opentui.symbols.setCursorStyle(renderer, stylePtr, style.length, blinking);
|
|
11886
|
-
}
|
|
11887
12021
|
setCursorColor(renderer, color) {
|
|
11888
12022
|
this.opentui.symbols.setCursorColor(renderer, color.buffer);
|
|
11889
12023
|
}
|
|
@@ -11891,20 +12025,22 @@ class FFIRenderLib {
|
|
|
11891
12025
|
const cursorBuffer = new ArrayBuffer(CursorStateStruct.size);
|
|
11892
12026
|
this.opentui.symbols.getCursorState(renderer, ptr4(cursorBuffer));
|
|
11893
12027
|
const struct = CursorStateStruct.unpack(cursorBuffer);
|
|
11894
|
-
const styleMap = {
|
|
11895
|
-
0: "block",
|
|
11896
|
-
1: "line",
|
|
11897
|
-
2: "underline"
|
|
11898
|
-
};
|
|
11899
12028
|
return {
|
|
11900
12029
|
x: struct.x,
|
|
11901
12030
|
y: struct.y,
|
|
11902
12031
|
visible: struct.visible,
|
|
11903
|
-
style:
|
|
12032
|
+
style: CURSOR_ID_TO_STYLE[struct.style] ?? "block",
|
|
11904
12033
|
blinking: struct.blinking,
|
|
11905
12034
|
color: RGBA.fromValues(struct.r, struct.g, struct.b, struct.a)
|
|
11906
12035
|
};
|
|
11907
12036
|
}
|
|
12037
|
+
setCursorStyleOptions(renderer, options) {
|
|
12038
|
+
const style = options.style != null ? CURSOR_STYLE_TO_ID[options.style] : 255;
|
|
12039
|
+
const blinking = options.blinking != null ? options.blinking ? 1 : 0 : 255;
|
|
12040
|
+
const cursor = options.cursor != null ? MOUSE_STYLE_TO_ID[options.cursor] : 255;
|
|
12041
|
+
const buffer = CursorStyleOptionsStruct.pack({ style, blinking, color: options.color, cursor });
|
|
12042
|
+
this.opentui.symbols.setCursorStyleOptions(renderer, ptr4(buffer));
|
|
12043
|
+
}
|
|
11908
12044
|
render(renderer, force) {
|
|
11909
12045
|
this.opentui.symbols.render(renderer, force);
|
|
11910
12046
|
}
|
|
@@ -15918,6 +16054,24 @@ registerEnvVar({
|
|
|
15918
16054
|
type: "boolean",
|
|
15919
16055
|
default: false
|
|
15920
16056
|
});
|
|
16057
|
+
var DEFAULT_FORWARDED_ENV_KEYS = [
|
|
16058
|
+
"TMUX",
|
|
16059
|
+
"TERM",
|
|
16060
|
+
"OPENTUI_GRAPHICS",
|
|
16061
|
+
"TERM_PROGRAM",
|
|
16062
|
+
"TERM_PROGRAM_VERSION",
|
|
16063
|
+
"ALACRITTY_SOCKET",
|
|
16064
|
+
"ALACRITTY_LOG",
|
|
16065
|
+
"COLORTERM",
|
|
16066
|
+
"TERMUX_VERSION",
|
|
16067
|
+
"VHS_RECORD",
|
|
16068
|
+
"OPENTUI_FORCE_WCWIDTH",
|
|
16069
|
+
"OPENTUI_FORCE_UNICODE",
|
|
16070
|
+
"OPENTUI_FORCE_NOZWJ",
|
|
16071
|
+
"OPENTUI_FORCE_EXPLICIT_WIDTH",
|
|
16072
|
+
"WT_SESSION",
|
|
16073
|
+
"STY"
|
|
16074
|
+
];
|
|
15921
16075
|
var KITTY_FLAG_DISAMBIGUATE = 1;
|
|
15922
16076
|
var KITTY_FLAG_EVENT_TYPES = 2;
|
|
15923
16077
|
var KITTY_FLAG_ALTERNATE_KEYS = 4;
|
|
@@ -16152,6 +16306,7 @@ class CliRenderer extends EventEmitter9 {
|
|
|
16152
16306
|
_latestPointer = { x: 0, y: 0 };
|
|
16153
16307
|
_hasPointer = false;
|
|
16154
16308
|
_lastPointerModifiers = { shift: false, alt: false, ctrl: false };
|
|
16309
|
+
_currentMousePointerStyle = undefined;
|
|
16155
16310
|
_currentFocusedRenderable = null;
|
|
16156
16311
|
lifecyclePasses = new Set;
|
|
16157
16312
|
_openConsoleOnError = true;
|
|
@@ -16226,6 +16381,13 @@ Captured output:
|
|
|
16226
16381
|
lib.setRenderOffset(rendererPtr, this.renderOffset);
|
|
16227
16382
|
}
|
|
16228
16383
|
this.rendererPtr = rendererPtr;
|
|
16384
|
+
const forwardEnvKeys = config.forwardEnvKeys ?? [...DEFAULT_FORWARDED_ENV_KEYS];
|
|
16385
|
+
for (const key of forwardEnvKeys) {
|
|
16386
|
+
const value = process.env[key];
|
|
16387
|
+
if (value === undefined)
|
|
16388
|
+
continue;
|
|
16389
|
+
this.lib.setTerminalEnvVar(this.rendererPtr, key, value);
|
|
16390
|
+
}
|
|
16229
16391
|
this.exitOnCtrlC = config.exitOnCtrlC === undefined ? true : config.exitOnCtrlC;
|
|
16230
16392
|
this.exitSignals = config.exitSignals || [
|
|
16231
16393
|
"SIGINT",
|
|
@@ -16736,127 +16898,135 @@ Captured output:
|
|
|
16736
16898
|
return event;
|
|
16737
16899
|
}
|
|
16738
16900
|
handleMouseData(data) {
|
|
16739
|
-
const
|
|
16740
|
-
if (
|
|
16741
|
-
|
|
16742
|
-
|
|
16743
|
-
|
|
16744
|
-
|
|
16745
|
-
|
|
16746
|
-
}
|
|
16747
|
-
this._latestPointer.x = mouseEvent.x;
|
|
16748
|
-
this._latestPointer.y = mouseEvent.y;
|
|
16749
|
-
this._hasPointer = true;
|
|
16750
|
-
this._lastPointerModifiers = mouseEvent.modifiers;
|
|
16751
|
-
if (this._console.visible) {
|
|
16752
|
-
const consoleBounds = this._console.bounds;
|
|
16753
|
-
if (mouseEvent.x >= consoleBounds.x && mouseEvent.x < consoleBounds.x + consoleBounds.width && mouseEvent.y >= consoleBounds.y && mouseEvent.y < consoleBounds.y + consoleBounds.height) {
|
|
16754
|
-
const event2 = new MouseEvent(null, mouseEvent);
|
|
16755
|
-
const handled = this._console.handleMouse(event2);
|
|
16756
|
-
if (handled)
|
|
16757
|
-
return true;
|
|
16758
|
-
}
|
|
16901
|
+
const mouseEvents = this.mouseParser.parseAllMouseEvents(data);
|
|
16902
|
+
if (mouseEvents.length === 0)
|
|
16903
|
+
return false;
|
|
16904
|
+
let anyHandled = false;
|
|
16905
|
+
for (const mouseEvent of mouseEvents) {
|
|
16906
|
+
if (this.processSingleMouseEvent(mouseEvent)) {
|
|
16907
|
+
anyHandled = true;
|
|
16759
16908
|
}
|
|
16760
|
-
|
|
16761
|
-
|
|
16762
|
-
|
|
16763
|
-
|
|
16764
|
-
|
|
16765
|
-
|
|
16766
|
-
|
|
16767
|
-
scrollTarget.processMouseEvent(event2);
|
|
16768
|
-
}
|
|
16769
|
-
return true;
|
|
16909
|
+
}
|
|
16910
|
+
return anyHandled;
|
|
16911
|
+
}
|
|
16912
|
+
processSingleMouseEvent(mouseEvent) {
|
|
16913
|
+
if (this._splitHeight > 0) {
|
|
16914
|
+
if (mouseEvent.y < this.renderOffset) {
|
|
16915
|
+
return false;
|
|
16770
16916
|
}
|
|
16771
|
-
|
|
16772
|
-
|
|
16773
|
-
|
|
16774
|
-
|
|
16775
|
-
|
|
16776
|
-
|
|
16777
|
-
|
|
16778
|
-
|
|
16917
|
+
mouseEvent.y -= this.renderOffset;
|
|
16918
|
+
}
|
|
16919
|
+
this._latestPointer.x = mouseEvent.x;
|
|
16920
|
+
this._latestPointer.y = mouseEvent.y;
|
|
16921
|
+
this._hasPointer = true;
|
|
16922
|
+
this._lastPointerModifiers = mouseEvent.modifiers;
|
|
16923
|
+
if (this._console.visible) {
|
|
16924
|
+
const consoleBounds = this._console.bounds;
|
|
16925
|
+
if (mouseEvent.x >= consoleBounds.x && mouseEvent.x < consoleBounds.x + consoleBounds.width && mouseEvent.y >= consoleBounds.y && mouseEvent.y < consoleBounds.y + consoleBounds.height) {
|
|
16926
|
+
const event2 = new MouseEvent(null, mouseEvent);
|
|
16927
|
+
const handled = this._console.handleMouse(event2);
|
|
16928
|
+
if (handled)
|
|
16779
16929
|
return true;
|
|
16780
|
-
}
|
|
16781
16930
|
}
|
|
16782
|
-
|
|
16783
|
-
|
|
16784
|
-
|
|
16785
|
-
|
|
16786
|
-
|
|
16787
|
-
|
|
16788
|
-
|
|
16931
|
+
}
|
|
16932
|
+
if (mouseEvent.type === "scroll") {
|
|
16933
|
+
const maybeRenderableId2 = this.hitTest(mouseEvent.x, mouseEvent.y);
|
|
16934
|
+
const maybeRenderable2 = Renderable.renderablesByNumber.get(maybeRenderableId2);
|
|
16935
|
+
const fallbackTarget = this._currentFocusedRenderable && !this._currentFocusedRenderable.isDestroyed && this._currentFocusedRenderable.focused ? this._currentFocusedRenderable : null;
|
|
16936
|
+
const scrollTarget = maybeRenderable2 ?? fallbackTarget;
|
|
16937
|
+
if (scrollTarget) {
|
|
16938
|
+
const event2 = new MouseEvent(scrollTarget, mouseEvent);
|
|
16939
|
+
scrollTarget.processMouseEvent(event2);
|
|
16789
16940
|
}
|
|
16790
|
-
|
|
16791
|
-
|
|
16792
|
-
|
|
16793
|
-
|
|
16794
|
-
|
|
16795
|
-
|
|
16941
|
+
return true;
|
|
16942
|
+
}
|
|
16943
|
+
const maybeRenderableId = this.hitTest(mouseEvent.x, mouseEvent.y);
|
|
16944
|
+
const sameElement = maybeRenderableId === this.lastOverRenderableNum;
|
|
16945
|
+
this.lastOverRenderableNum = maybeRenderableId;
|
|
16946
|
+
const maybeRenderable = Renderable.renderablesByNumber.get(maybeRenderableId);
|
|
16947
|
+
if (mouseEvent.type === "down" && mouseEvent.button === 0 /* LEFT */ && !this.currentSelection?.isDragging && !mouseEvent.modifiers.ctrl) {
|
|
16948
|
+
if (maybeRenderable && maybeRenderable.selectable && !maybeRenderable.isDestroyed && maybeRenderable.shouldStartSelection(mouseEvent.x, mouseEvent.y)) {
|
|
16949
|
+
this.startSelection(maybeRenderable, mouseEvent.x, mouseEvent.y);
|
|
16950
|
+
this.dispatchMouseEvent(maybeRenderable, mouseEvent);
|
|
16796
16951
|
return true;
|
|
16797
16952
|
}
|
|
16798
|
-
|
|
16799
|
-
|
|
16800
|
-
|
|
16801
|
-
|
|
16802
|
-
|
|
16803
|
-
|
|
16953
|
+
}
|
|
16954
|
+
if (mouseEvent.type === "drag" && this.currentSelection?.isDragging) {
|
|
16955
|
+
this.updateSelection(maybeRenderable, mouseEvent.x, mouseEvent.y);
|
|
16956
|
+
if (maybeRenderable) {
|
|
16957
|
+
const event2 = new MouseEvent(maybeRenderable, { ...mouseEvent, isDragging: true });
|
|
16958
|
+
maybeRenderable.processMouseEvent(event2);
|
|
16804
16959
|
}
|
|
16805
|
-
|
|
16806
|
-
|
|
16807
|
-
|
|
16808
|
-
|
|
16809
|
-
}
|
|
16810
|
-
|
|
16811
|
-
if (maybeRenderable) {
|
|
16812
|
-
const event2 = new MouseEvent(maybeRenderable, {
|
|
16813
|
-
...mouseEvent,
|
|
16814
|
-
type: "over",
|
|
16815
|
-
source: this.capturedRenderable
|
|
16816
|
-
});
|
|
16817
|
-
maybeRenderable.processMouseEvent(event2);
|
|
16818
|
-
}
|
|
16960
|
+
return true;
|
|
16961
|
+
}
|
|
16962
|
+
if (mouseEvent.type === "up" && this.currentSelection?.isDragging) {
|
|
16963
|
+
if (maybeRenderable) {
|
|
16964
|
+
const event2 = new MouseEvent(maybeRenderable, { ...mouseEvent, isDragging: true });
|
|
16965
|
+
maybeRenderable.processMouseEvent(event2);
|
|
16819
16966
|
}
|
|
16820
|
-
|
|
16821
|
-
|
|
16822
|
-
|
|
16967
|
+
this.finishSelection();
|
|
16968
|
+
return true;
|
|
16969
|
+
}
|
|
16970
|
+
if (mouseEvent.type === "down" && mouseEvent.button === 0 /* LEFT */ && this.currentSelection) {
|
|
16971
|
+
if (mouseEvent.modifiers.ctrl) {
|
|
16972
|
+
this.currentSelection.isDragging = true;
|
|
16973
|
+
this.updateSelection(maybeRenderable, mouseEvent.x, mouseEvent.y);
|
|
16823
16974
|
return true;
|
|
16824
16975
|
}
|
|
16825
|
-
|
|
16826
|
-
|
|
16827
|
-
|
|
16828
|
-
|
|
16829
|
-
|
|
16830
|
-
const event3 = new MouseEvent(maybeRenderable, {
|
|
16831
|
-
...mouseEvent,
|
|
16832
|
-
type: "drop",
|
|
16833
|
-
source: this.capturedRenderable
|
|
16834
|
-
});
|
|
16835
|
-
maybeRenderable.processMouseEvent(event3);
|
|
16836
|
-
}
|
|
16837
|
-
this.lastOverRenderable = this.capturedRenderable;
|
|
16838
|
-
this.lastOverRenderableNum = this.capturedRenderable.num;
|
|
16839
|
-
this.setCapturedRenderable(undefined);
|
|
16840
|
-
this.requestRender();
|
|
16976
|
+
}
|
|
16977
|
+
if (!sameElement && (mouseEvent.type === "drag" || mouseEvent.type === "move")) {
|
|
16978
|
+
if (this.lastOverRenderable && this.lastOverRenderable !== this.capturedRenderable) {
|
|
16979
|
+
const event2 = new MouseEvent(this.lastOverRenderable, { ...mouseEvent, type: "out" });
|
|
16980
|
+
this.lastOverRenderable.processMouseEvent(event2);
|
|
16841
16981
|
}
|
|
16842
|
-
|
|
16982
|
+
this.lastOverRenderable = maybeRenderable;
|
|
16843
16983
|
if (maybeRenderable) {
|
|
16844
|
-
|
|
16845
|
-
|
|
16846
|
-
|
|
16847
|
-
this.
|
|
16848
|
-
}
|
|
16849
|
-
|
|
16984
|
+
const event2 = new MouseEvent(maybeRenderable, {
|
|
16985
|
+
...mouseEvent,
|
|
16986
|
+
type: "over",
|
|
16987
|
+
source: this.capturedRenderable
|
|
16988
|
+
});
|
|
16989
|
+
maybeRenderable.processMouseEvent(event2);
|
|
16990
|
+
}
|
|
16991
|
+
}
|
|
16992
|
+
if (this.capturedRenderable && mouseEvent.type !== "up") {
|
|
16993
|
+
const event2 = new MouseEvent(this.capturedRenderable, mouseEvent);
|
|
16994
|
+
this.capturedRenderable.processMouseEvent(event2);
|
|
16995
|
+
return true;
|
|
16996
|
+
}
|
|
16997
|
+
if (this.capturedRenderable && mouseEvent.type === "up") {
|
|
16998
|
+
const event2 = new MouseEvent(this.capturedRenderable, { ...mouseEvent, type: "drag-end" });
|
|
16999
|
+
this.capturedRenderable.processMouseEvent(event2);
|
|
17000
|
+
this.capturedRenderable.processMouseEvent(new MouseEvent(this.capturedRenderable, mouseEvent));
|
|
17001
|
+
if (maybeRenderable) {
|
|
17002
|
+
const event3 = new MouseEvent(maybeRenderable, {
|
|
17003
|
+
...mouseEvent,
|
|
17004
|
+
type: "drop",
|
|
17005
|
+
source: this.capturedRenderable
|
|
17006
|
+
});
|
|
17007
|
+
maybeRenderable.processMouseEvent(event3);
|
|
17008
|
+
}
|
|
17009
|
+
this.lastOverRenderable = this.capturedRenderable;
|
|
17010
|
+
this.lastOverRenderableNum = this.capturedRenderable.num;
|
|
17011
|
+
this.setCapturedRenderable(undefined);
|
|
17012
|
+
this.requestRender();
|
|
17013
|
+
}
|
|
17014
|
+
let event;
|
|
17015
|
+
if (maybeRenderable) {
|
|
17016
|
+
if (mouseEvent.type === "drag" && mouseEvent.button === 0 /* LEFT */) {
|
|
17017
|
+
this.setCapturedRenderable(maybeRenderable);
|
|
16850
17018
|
} else {
|
|
16851
17019
|
this.setCapturedRenderable(undefined);
|
|
16852
|
-
this.lastOverRenderable = undefined;
|
|
16853
|
-
}
|
|
16854
|
-
if (!event?.defaultPrevented && mouseEvent.type === "down" && this.currentSelection) {
|
|
16855
|
-
this.clearSelection();
|
|
16856
17020
|
}
|
|
16857
|
-
|
|
17021
|
+
event = this.dispatchMouseEvent(maybeRenderable, mouseEvent);
|
|
17022
|
+
} else {
|
|
17023
|
+
this.setCapturedRenderable(undefined);
|
|
17024
|
+
this.lastOverRenderable = undefined;
|
|
16858
17025
|
}
|
|
16859
|
-
|
|
17026
|
+
if (!event?.defaultPrevented && mouseEvent.type === "down" && this.currentSelection) {
|
|
17027
|
+
this.clearSelection();
|
|
17028
|
+
}
|
|
17029
|
+
return true;
|
|
16860
17030
|
}
|
|
16861
17031
|
recheckHoverState() {
|
|
16862
17032
|
if (this._isDestroyed || !this._hasPointer)
|
|
@@ -16891,6 +17061,10 @@ Captured output:
|
|
|
16891
17061
|
hitRenderable.processMouseEvent(event);
|
|
16892
17062
|
}
|
|
16893
17063
|
}
|
|
17064
|
+
setMousePointer(style) {
|
|
17065
|
+
this._currentMousePointerStyle = style;
|
|
17066
|
+
this.lib.setCursorStyleOptions(this.rendererPtr, { cursor: style });
|
|
17067
|
+
}
|
|
16894
17068
|
hitTest(x, y) {
|
|
16895
17069
|
return this.lib.checkHit(this.rendererPtr, x, y);
|
|
16896
17070
|
}
|
|
@@ -17033,11 +17207,11 @@ Captured output:
|
|
|
17033
17207
|
const lib = resolveRenderLib();
|
|
17034
17208
|
lib.setCursorPosition(renderer.rendererPtr, x, y, visible);
|
|
17035
17209
|
}
|
|
17036
|
-
static setCursorStyle(renderer,
|
|
17210
|
+
static setCursorStyle(renderer, options) {
|
|
17037
17211
|
const lib = resolveRenderLib();
|
|
17038
|
-
lib.
|
|
17039
|
-
if (
|
|
17040
|
-
|
|
17212
|
+
lib.setCursorStyleOptions(renderer.rendererPtr, options);
|
|
17213
|
+
if (options.cursor !== undefined) {
|
|
17214
|
+
renderer._currentMousePointerStyle = options.cursor;
|
|
17041
17215
|
}
|
|
17042
17216
|
}
|
|
17043
17217
|
static setCursorColor(renderer, color) {
|
|
@@ -17047,10 +17221,10 @@ Captured output:
|
|
|
17047
17221
|
setCursorPosition(x, y, visible = true) {
|
|
17048
17222
|
this.lib.setCursorPosition(this.rendererPtr, x, y, visible);
|
|
17049
17223
|
}
|
|
17050
|
-
setCursorStyle(
|
|
17051
|
-
this.lib.
|
|
17052
|
-
if (
|
|
17053
|
-
this.
|
|
17224
|
+
setCursorStyle(options) {
|
|
17225
|
+
this.lib.setCursorStyleOptions(this.rendererPtr, options);
|
|
17226
|
+
if (options.cursor !== undefined) {
|
|
17227
|
+
this._currentMousePointerStyle = options.cursor;
|
|
17054
17228
|
}
|
|
17055
17229
|
}
|
|
17056
17230
|
setCursorColor(color) {
|
|
@@ -17150,6 +17324,13 @@ Captured output:
|
|
|
17150
17324
|
}
|
|
17151
17325
|
internalPause() {
|
|
17152
17326
|
this._isRunning = false;
|
|
17327
|
+
if (this.renderTimeout) {
|
|
17328
|
+
clearTimeout(this.renderTimeout);
|
|
17329
|
+
this.renderTimeout = null;
|
|
17330
|
+
}
|
|
17331
|
+
if (!this.rendering) {
|
|
17332
|
+
this.resolveIdleIfNeeded();
|
|
17333
|
+
}
|
|
17153
17334
|
}
|
|
17154
17335
|
stop() {
|
|
17155
17336
|
this._controlState = "explicit_stopped" /* EXPLICIT_STOPPED */;
|
|
@@ -17527,5 +17708,5 @@ Captured output:
|
|
|
17527
17708
|
|
|
17528
17709
|
export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, nonAlphanumericKeys, parseKeypress, 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, LinearScrollAccel, MacOSScrollAccel, StdinBuffer, 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, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extToFiletype, pathToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, VTermStyleFlags, vtermDataToStyledText, 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 };
|
|
17529
17710
|
|
|
17530
|
-
//# debugId=
|
|
17531
|
-
//# sourceMappingURL=index-
|
|
17711
|
+
//# debugId=C1193A584E7CA83964756E2164756E21
|
|
17712
|
+
//# sourceMappingURL=index-yc0yx782.js.map
|