@code-yeongyu/senpi-tui 2026.9.13 → 2026.9.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mouse-input.d.ts +37 -0
- package/dist/mouse-input.d.ts.map +1 -0
- package/dist/mouse-input.js +97 -0
- package/dist/mouse-input.js.map +1 -0
- package/dist/stdin-buffer.d.ts +2 -0
- package/dist/stdin-buffer.d.ts.map +1 -1
- package/dist/stdin-buffer.js +38 -0
- package/dist/stdin-buffer.js.map +1 -1
- package/dist/terminal.d.ts +29 -1
- package/dist/terminal.d.ts.map +1 -1
- package/dist/terminal.js +129 -4
- package/dist/terminal.js.map +1 -1
- package/dist/tmux-cursor-query.d.ts +5 -0
- package/dist/tmux-cursor-query.d.ts.map +1 -0
- package/dist/tmux-cursor-query.js +39 -0
- package/dist/tmux-cursor-query.js.map +1 -0
- package/dist/tui-alt-screen.d.ts.map +1 -1
- package/dist/tui-alt-screen.js +5 -50
- package/dist/tui-alt-screen.js.map +1 -1
- package/dist/tui-main-screen.d.ts +12 -0
- package/dist/tui-main-screen.d.ts.map +1 -1
- package/dist/tui-main-screen.js +129 -3
- package/dist/tui-main-screen.js.map +1 -1
- package/dist/tui.d.ts +28 -0
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +160 -0
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
package/dist/tui-alt-screen.js
CHANGED
|
@@ -6,6 +6,7 @@ import { getKeybindings } from "./keybindings.js";
|
|
|
6
6
|
import { isKeyRelease } from "./keys.js";
|
|
7
7
|
import { getLayoutBoxesAt, getScrollbarGeometry, getScrollViewBox, getScrollViewsAt, renderLayoutFrame, } from "./layout.js";
|
|
8
8
|
import { getLayoutNode } from "./layout-node.js";
|
|
9
|
+
import { decodeMouseButton, isMouseSequence, parseSgrMouseEvent, parseWheelEvent } from "./mouse-input.js";
|
|
9
10
|
import { deleteAllKittyImages, deleteAllKittyPlacements, deleteKittyImage, getCapabilities, getKittyImagePlacement, isImageLine, setCapabilities, } from "./terminal-image.js";
|
|
10
11
|
import { Container, CURSOR_MARKER, compositeTuiLine, dispatchMouseEvent, retargetMouseEvent, TuiBase, VIEWPORT_TUI, } from "./tui.js";
|
|
11
12
|
import { extractAnsiCode, getGraphemeCellRange, getOsc8LinkAtColumn, getWordSegmenter, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, } from "./utils.js";
|
|
@@ -561,16 +562,7 @@ export class TuiAltScreen extends TuiBase {
|
|
|
561
562
|
return undefined;
|
|
562
563
|
}
|
|
563
564
|
decodeMouseButton(button) {
|
|
564
|
-
|
|
565
|
-
case 0:
|
|
566
|
-
return "left";
|
|
567
|
-
case 1:
|
|
568
|
-
return "middle";
|
|
569
|
-
case 2:
|
|
570
|
-
return "right";
|
|
571
|
-
default:
|
|
572
|
-
return "none";
|
|
573
|
-
}
|
|
565
|
+
return decodeMouseButton(button);
|
|
574
566
|
}
|
|
575
567
|
createMouseEvent(type, button, x, y, extra = {}) {
|
|
576
568
|
return {
|
|
@@ -720,36 +712,7 @@ export class TuiAltScreen extends TuiBase {
|
|
|
720
712
|
this.handleSelectionMouseEvent(raw);
|
|
721
713
|
}
|
|
722
714
|
parseWheelEvent(data) {
|
|
723
|
-
|
|
724
|
-
if (sgr) {
|
|
725
|
-
const button = Number.parseInt(sgr[1], 10);
|
|
726
|
-
if ((button & 64) === 0)
|
|
727
|
-
return undefined;
|
|
728
|
-
const direction = button & 3;
|
|
729
|
-
if (direction !== 0 && direction !== 1)
|
|
730
|
-
return undefined;
|
|
731
|
-
return {
|
|
732
|
-
direction: direction === 0 ? -1 : 1,
|
|
733
|
-
x: Number.parseInt(sgr[2], 10) - 1,
|
|
734
|
-
y: Number.parseInt(sgr[3], 10) - 1,
|
|
735
|
-
button,
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
|
-
if (data.length === 6 && data.startsWith("\x1b[M")) {
|
|
739
|
-
const button = data.charCodeAt(3) - 32;
|
|
740
|
-
if ((button & 64) === 0)
|
|
741
|
-
return undefined;
|
|
742
|
-
const direction = button & 3;
|
|
743
|
-
if (direction !== 0 && direction !== 1)
|
|
744
|
-
return undefined;
|
|
745
|
-
return {
|
|
746
|
-
direction: direction === 0 ? -1 : 1,
|
|
747
|
-
x: data.charCodeAt(4) - 33,
|
|
748
|
-
y: data.charCodeAt(5) - 33,
|
|
749
|
-
button,
|
|
750
|
-
};
|
|
751
|
-
}
|
|
752
|
-
return undefined;
|
|
715
|
+
return parseWheelEvent(data);
|
|
753
716
|
}
|
|
754
717
|
getWheelScrollLines(button) {
|
|
755
718
|
// SGR mouse button codes use bit 3 (value 8) for the Alt modifier.
|
|
@@ -771,15 +734,7 @@ export class TuiAltScreen extends TuiBase {
|
|
|
771
734
|
this.requestRender();
|
|
772
735
|
}
|
|
773
736
|
parseSgrMouseEvent(data) {
|
|
774
|
-
|
|
775
|
-
if (!match)
|
|
776
|
-
return undefined;
|
|
777
|
-
return {
|
|
778
|
-
button: Number.parseInt(match[1], 10),
|
|
779
|
-
x: Number.parseInt(match[2], 10) - 1,
|
|
780
|
-
y: Number.parseInt(match[3], 10) - 1,
|
|
781
|
-
release: match[4] === "m",
|
|
782
|
-
};
|
|
737
|
+
return parseSgrMouseEvent(data);
|
|
783
738
|
}
|
|
784
739
|
handleRightClickPaste(event) {
|
|
785
740
|
if (!this.onRightClickPaste ||
|
|
@@ -1352,7 +1307,7 @@ export class TuiAltScreen extends TuiBase {
|
|
|
1352
1307
|
});
|
|
1353
1308
|
}
|
|
1354
1309
|
isMouseSequence(data) {
|
|
1355
|
-
return
|
|
1310
|
+
return isMouseSequence(data);
|
|
1356
1311
|
}
|
|
1357
1312
|
compositeScrollToEndIndicator(screen, layout, width) {
|
|
1358
1313
|
this.scrollToEndIndicatorRect = undefined;
|