tinky-mouse 0.1.0

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.
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ var __values = (this && this.__values) || function(o) {
3
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
+ if (m) return m.call(o);
5
+ if (o && typeof o.length === "number") return {
6
+ next: function () {
7
+ if (o && i >= o.length) o = void 0;
8
+ return { value: o && o[i++], done: !o };
9
+ }
10
+ };
11
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.MouseContext = void 0;
15
+ exports.enableMouseEvents = enableMouseEvents;
16
+ exports.disableMouseEvents = disableMouseEvents;
17
+ exports.MouseProvider = MouseProvider;
18
+ var jsx_runtime_1 = require("react/jsx-runtime");
19
+ var tinky_1 = require("tinky");
20
+ var react_1 = require("react");
21
+ var sequences_js_1 = require("../utils/sequences.js");
22
+ var mouse_js_1 = require("../utils/mouse.js");
23
+ var MAX_MOUSE_BUFFER_SIZE = 4096;
24
+ // ANSI escape sequences for mouse event control
25
+ var ENABLE_MOUSE_SEQUENCES = [
26
+ "\x1b[?1000h", // Enable basic mouse mode (button press/release)
27
+ "\x1b[?1002h", // Enable button event tracking (motion while button down)
28
+ "\x1b[?1003h", // Enable any event tracking (all motion) - optional
29
+ "\x1b[?1006h", // Enable SGR extended mode (better coordinate reporting)
30
+ ];
31
+ var DISABLE_MOUSE_SEQUENCES = [
32
+ "\x1b[?1006l", // Disable SGR extended mode
33
+ "\x1b[?1003l", // Disable any event tracking
34
+ "\x1b[?1002l", // Disable button event tracking
35
+ "\x1b[?1000l", // Disable basic mouse mode
36
+ ];
37
+ /**
38
+ * Enable mouse event reporting in the terminal.
39
+ */
40
+ function enableMouseEvents() {
41
+ var e_1, _a;
42
+ try {
43
+ for (var ENABLE_MOUSE_SEQUENCES_1 = __values(ENABLE_MOUSE_SEQUENCES), ENABLE_MOUSE_SEQUENCES_1_1 = ENABLE_MOUSE_SEQUENCES_1.next(); !ENABLE_MOUSE_SEQUENCES_1_1.done; ENABLE_MOUSE_SEQUENCES_1_1 = ENABLE_MOUSE_SEQUENCES_1.next()) {
44
+ var seq = ENABLE_MOUSE_SEQUENCES_1_1.value;
45
+ process.stdout.write(seq);
46
+ }
47
+ }
48
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
49
+ finally {
50
+ try {
51
+ if (ENABLE_MOUSE_SEQUENCES_1_1 && !ENABLE_MOUSE_SEQUENCES_1_1.done && (_a = ENABLE_MOUSE_SEQUENCES_1.return)) _a.call(ENABLE_MOUSE_SEQUENCES_1);
52
+ }
53
+ finally { if (e_1) throw e_1.error; }
54
+ }
55
+ }
56
+ /**
57
+ * Disable mouse event reporting in the terminal.
58
+ */
59
+ function disableMouseEvents() {
60
+ var e_2, _a;
61
+ try {
62
+ for (var DISABLE_MOUSE_SEQUENCES_1 = __values(DISABLE_MOUSE_SEQUENCES), DISABLE_MOUSE_SEQUENCES_1_1 = DISABLE_MOUSE_SEQUENCES_1.next(); !DISABLE_MOUSE_SEQUENCES_1_1.done; DISABLE_MOUSE_SEQUENCES_1_1 = DISABLE_MOUSE_SEQUENCES_1.next()) {
63
+ var seq = DISABLE_MOUSE_SEQUENCES_1_1.value;
64
+ process.stdout.write(seq);
65
+ }
66
+ }
67
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
68
+ finally {
69
+ try {
70
+ if (DISABLE_MOUSE_SEQUENCES_1_1 && !DISABLE_MOUSE_SEQUENCES_1_1.done && (_a = DISABLE_MOUSE_SEQUENCES_1.return)) _a.call(DISABLE_MOUSE_SEQUENCES_1);
71
+ }
72
+ finally { if (e_2) throw e_2.error; }
73
+ }
74
+ }
75
+ /**
76
+ * Context for managing mouse events.
77
+ */
78
+ exports.MouseContext = (0, react_1.createContext)(undefined);
79
+ /**
80
+ * Provider component that sets up mouse event listening and distribution.
81
+ *
82
+ * It enables mouse reporting on mount (if enabled) and disables it on unmount.
83
+ * It uses the `tinky` `useStdin` hook to read from the input stream.
84
+ *
85
+ * @example
86
+ * ```tsx
87
+ * <MouseProvider mouseEventsEnabled={true}>
88
+ * <App />
89
+ * </MouseProvider>
90
+ * ```
91
+ *
92
+ * @param props - The component props.
93
+ * @param props.children - The child components.
94
+ * @param props.mouseEventsEnabled - Whether to enable mouse event reporting. Defaults to `false` (implicit).
95
+ */
96
+ function MouseProvider(_a) {
97
+ var children = _a.children, mouseEventsEnabled = _a.mouseEventsEnabled;
98
+ var stdin = (0, tinky_1.useStdin)().stdin;
99
+ var subscribers = (0, react_1.useRef)(new Set()).current;
100
+ var subscribe = (0, react_1.useCallback)(function (handler) {
101
+ subscribers.add(handler);
102
+ }, [subscribers]);
103
+ var unsubscribe = (0, react_1.useCallback)(function (handler) {
104
+ subscribers.delete(handler);
105
+ }, [subscribers]);
106
+ (0, react_1.useEffect)(function () {
107
+ if (!mouseEventsEnabled) {
108
+ return;
109
+ }
110
+ // Enable mouse event reporting in terminal
111
+ enableMouseEvents();
112
+ var mouseBuffer = "";
113
+ var broadcast = function (event) {
114
+ var e_3, _a;
115
+ try {
116
+ for (var subscribers_1 = __values(subscribers), subscribers_1_1 = subscribers_1.next(); !subscribers_1_1.done; subscribers_1_1 = subscribers_1.next()) {
117
+ var handler = subscribers_1_1.value;
118
+ handler(event);
119
+ }
120
+ }
121
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
122
+ finally {
123
+ try {
124
+ if (subscribers_1_1 && !subscribers_1_1.done && (_a = subscribers_1.return)) _a.call(subscribers_1);
125
+ }
126
+ finally { if (e_3) throw e_3.error; }
127
+ }
128
+ };
129
+ var handleData = function (data) {
130
+ mouseBuffer += typeof data === "string" ? data : data.toString("utf-8");
131
+ // Safety cap to prevent infinite buffer growth on garbage
132
+ if (mouseBuffer.length > MAX_MOUSE_BUFFER_SIZE) {
133
+ mouseBuffer = mouseBuffer.slice(-MAX_MOUSE_BUFFER_SIZE);
134
+ }
135
+ while (mouseBuffer.length > 0) {
136
+ var parsed = (0, mouse_js_1.parseMouseEvent)(mouseBuffer);
137
+ if (parsed) {
138
+ broadcast(parsed.event);
139
+ mouseBuffer = mouseBuffer.slice(parsed.length);
140
+ continue;
141
+ }
142
+ if ((0, mouse_js_1.isIncompleteMouseSequence)(mouseBuffer)) {
143
+ break; // Wait for more data
144
+ }
145
+ // Not a valid sequence at start, and not waiting for more data.
146
+ // Discard garbage until next possible sequence start.
147
+ var nextEsc = mouseBuffer.indexOf(sequences_js_1.ESC, 1);
148
+ if (nextEsc !== -1) {
149
+ mouseBuffer = mouseBuffer.slice(nextEsc);
150
+ // Loop continues to try parsing at new location
151
+ }
152
+ else {
153
+ mouseBuffer = "";
154
+ break;
155
+ }
156
+ }
157
+ };
158
+ if (!stdin)
159
+ return;
160
+ var stdinStream = stdin;
161
+ stdinStream.on("data", handleData);
162
+ return function () {
163
+ stdinStream.removeListener("data", handleData);
164
+ // Disable mouse event reporting when unmounting
165
+ disableMouseEvents();
166
+ };
167
+ }, [stdin, mouseEventsEnabled, subscribers]);
168
+ return ((0, jsx_runtime_1.jsx)(exports.MouseContext.Provider, { value: { subscribe: subscribe, unsubscribe: unsubscribe }, children: children }));
169
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Hook to access the MouseContext.
3
+ *
4
+ * Must be used within a `MouseProvider`.
5
+ *
6
+ * @returns The mouse context value containing `subscribe` and `unsubscribe` methods.
7
+ * @throws Error if used outside of a `MouseProvider`.
8
+ */
9
+ export declare function useMouseContext(): import("../contexts/MouseContext.js").MouseContextValue;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMouseContext = useMouseContext;
4
+ var react_1 = require("react");
5
+ var MouseContext_js_1 = require("../contexts/MouseContext.js");
6
+ /**
7
+ * Hook to access the MouseContext.
8
+ *
9
+ * Must be used within a `MouseProvider`.
10
+ *
11
+ * @returns The mouse context value containing `subscribe` and `unsubscribe` methods.
12
+ * @throws Error if used outside of a `MouseProvider`.
13
+ */
14
+ function useMouseContext() {
15
+ var context = (0, react_1.useContext)(MouseContext_js_1.MouseContext);
16
+ if (!context) {
17
+ throw new Error("useMouseContext must be used within a MouseProvider");
18
+ }
19
+ return context;
20
+ }
@@ -0,0 +1,20 @@
1
+ import type { MouseHandler } from "../utils/mouse.js";
2
+ /**
3
+ * Hook to subscribe to mouse events.
4
+ *
5
+ * @param handler - The function to call when a mouse event occurs.
6
+ * @param options - Configuration options.
7
+ * @param options.isActive - Whether the subscription is active. Defaults to `true`.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * useMouse((event) => {
12
+ * if (event.name === 'left-press') {
13
+ * console.log('Clicked at', event.col, event.row);
14
+ * }
15
+ * });
16
+ * ```
17
+ */
18
+ export declare function useMouse(handler: MouseHandler, { isActive }?: {
19
+ isActive?: boolean | undefined;
20
+ }): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMouse = useMouse;
4
+ var react_1 = require("react");
5
+ var use_mouse_context_js_1 = require("./use-mouse-context.js");
6
+ /**
7
+ * Hook to subscribe to mouse events.
8
+ *
9
+ * @param handler - The function to call when a mouse event occurs.
10
+ * @param options - Configuration options.
11
+ * @param options.isActive - Whether the subscription is active. Defaults to `true`.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * useMouse((event) => {
16
+ * if (event.name === 'left-press') {
17
+ * console.log('Clicked at', event.col, event.row);
18
+ * }
19
+ * });
20
+ * ```
21
+ */
22
+ function useMouse(handler, _a) {
23
+ var _b = _a === void 0 ? {} : _a, _c = _b.isActive, isActive = _c === void 0 ? true : _c;
24
+ var _d = (0, use_mouse_context_js_1.useMouseContext)(), subscribe = _d.subscribe, unsubscribe = _d.unsubscribe;
25
+ (0, react_1.useEffect)(function () {
26
+ if (!isActive) {
27
+ return;
28
+ }
29
+ subscribe(handler);
30
+ return function () { return unsubscribe(handler); };
31
+ }, [isActive, handler, subscribe, unsubscribe]);
32
+ }
@@ -0,0 +1,4 @@
1
+ import type { MouseHandler } from "../utils/mouse.js";
2
+ export declare function useMouse(handler: MouseHandler, { isActive }?: {
3
+ isActive?: boolean | undefined;
4
+ }): void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMouse = useMouse;
4
+ var react_1 = require("react");
5
+ var useMouseContext_js_1 = require("./useMouseContext.js");
6
+ function useMouse(handler, _a) {
7
+ var _b = _a === void 0 ? {} : _a, _c = _b.isActive, isActive = _c === void 0 ? true : _c;
8
+ var _d = (0, useMouseContext_js_1.useMouseContext)(), subscribe = _d.subscribe, unsubscribe = _d.unsubscribe;
9
+ (0, react_1.useEffect)(function () {
10
+ if (!isActive) {
11
+ return;
12
+ }
13
+ subscribe(handler);
14
+ return function () { return unsubscribe(handler); };
15
+ }, [isActive, handler, subscribe, unsubscribe]);
16
+ }
@@ -0,0 +1 @@
1
+ export declare function useMouseContext(): import("../contexts/MouseContext.js").MouseContextValue;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMouseContext = useMouseContext;
4
+ var react_1 = require("react");
5
+ var MouseContext_js_1 = require("../contexts/MouseContext.js");
6
+ function useMouseContext() {
7
+ var context = (0, react_1.useContext)(MouseContext_js_1.MouseContext);
8
+ if (!context) {
9
+ throw new Error("useMouseContext must be used within a MouseProvider");
10
+ }
11
+ return context;
12
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { MouseProvider, enableMouseEvents, disableMouseEvents, type MouseEvent, type MouseEventName, type MouseHandler, type MouseContextValue, } from "./contexts/MouseContext.js";
2
+ export { useMouseContext } from "./hooks/use-mouse-context.js";
3
+ export { useMouse } from "./hooks/use-mouse.js";
package/lib/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMouse = exports.useMouseContext = exports.disableMouseEvents = exports.enableMouseEvents = exports.MouseProvider = void 0;
4
+ var MouseContext_js_1 = require("./contexts/MouseContext.js");
5
+ Object.defineProperty(exports, "MouseProvider", { enumerable: true, get: function () { return MouseContext_js_1.MouseProvider; } });
6
+ Object.defineProperty(exports, "enableMouseEvents", { enumerable: true, get: function () { return MouseContext_js_1.enableMouseEvents; } });
7
+ Object.defineProperty(exports, "disableMouseEvents", { enumerable: true, get: function () { return MouseContext_js_1.disableMouseEvents; } });
8
+ var use_mouse_context_js_1 = require("./hooks/use-mouse-context.js");
9
+ Object.defineProperty(exports, "useMouseContext", { enumerable: true, get: function () { return use_mouse_context_js_1.useMouseContext; } });
10
+ var use_mouse_js_1 = require("./hooks/use-mouse.js");
11
+ Object.defineProperty(exports, "useMouse", { enumerable: true, get: function () { return use_mouse_js_1.useMouse; } });
@@ -0,0 +1,17 @@
1
+ import { EventEmitter } from "node:events";
2
+ export declare enum AppEvent {
3
+ OpenDebugConsole = "open-debug-console",
4
+ OauthDisplayMessage = "oauth-display-message",
5
+ Flicker = "flicker",
6
+ McpClientUpdate = "mcp-client-update",
7
+ SelectionWarning = "selection-warning",
8
+ PasteTimeout = "paste-timeout"
9
+ }
10
+ export interface AppEvents {
11
+ [AppEvent.OpenDebugConsole]: never[];
12
+ [AppEvent.OauthDisplayMessage]: string[];
13
+ [AppEvent.Flicker]: never[];
14
+ [AppEvent.SelectionWarning]: never[];
15
+ [AppEvent.PasteTimeout]: never[];
16
+ }
17
+ export declare const appEvents: EventEmitter<AppEvents>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appEvents = exports.AppEvent = void 0;
4
+ var node_events_1 = require("node:events");
5
+ var AppEvent;
6
+ (function (AppEvent) {
7
+ AppEvent["OpenDebugConsole"] = "open-debug-console";
8
+ AppEvent["OauthDisplayMessage"] = "oauth-display-message";
9
+ AppEvent["Flicker"] = "flicker";
10
+ AppEvent["McpClientUpdate"] = "mcp-client-update";
11
+ AppEvent["SelectionWarning"] = "selection-warning";
12
+ AppEvent["PasteTimeout"] = "paste-timeout";
13
+ })(AppEvent || (exports.AppEvent = AppEvent = {}));
14
+ exports.appEvents = new node_events_1.EventEmitter();
@@ -0,0 +1,12 @@
1
+ export declare const ESC = "\u001B";
2
+ export declare const SGR_EVENT_PREFIX = "\u001B[<";
3
+ export declare const X11_EVENT_PREFIX = "\u001B[M";
4
+ export declare const SGR_MOUSE_REGEX: RegExp;
5
+ export declare const X11_MOUSE_REGEX: RegExp;
6
+ export declare function couldBeSGRMouseSequence(buffer: string): boolean;
7
+ export declare function couldBeMouseSequence(buffer: string): boolean;
8
+ /**
9
+ * Checks if the buffer *starts* with a complete mouse sequence.
10
+ * Returns the length of the sequence if matched, or 0 if not.
11
+ */
12
+ export declare function getMouseSequenceLength(buffer: string): number;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.X11_MOUSE_REGEX = exports.SGR_MOUSE_REGEX = exports.X11_EVENT_PREFIX = exports.SGR_EVENT_PREFIX = exports.ESC = void 0;
4
+ exports.couldBeSGRMouseSequence = couldBeSGRMouseSequence;
5
+ exports.couldBeMouseSequence = couldBeMouseSequence;
6
+ exports.getMouseSequenceLength = getMouseSequenceLength;
7
+ exports.ESC = "\u001B";
8
+ exports.SGR_EVENT_PREFIX = "".concat(exports.ESC, "[<");
9
+ exports.X11_EVENT_PREFIX = "".concat(exports.ESC, "[M");
10
+ // eslint-disable-next-line no-control-regex
11
+ exports.SGR_MOUSE_REGEX = /^\x1b\[<(\d+);(\d+);(\d+)([mM])/; // SGR mouse events
12
+ // X11 is ESC [ M followed by 3 bytes.
13
+ // eslint-disable-next-line no-control-regex
14
+ exports.X11_MOUSE_REGEX = /^\x1b\[M([\s\S]{3})/;
15
+ function couldBeSGRMouseSequence(buffer) {
16
+ if (buffer.length === 0)
17
+ return true;
18
+ // Check if buffer is a prefix of a mouse sequence starter
19
+ if (exports.SGR_EVENT_PREFIX.startsWith(buffer))
20
+ return true;
21
+ // Check if buffer is a mouse sequence prefix
22
+ if (buffer.startsWith(exports.SGR_EVENT_PREFIX))
23
+ return true;
24
+ return false;
25
+ }
26
+ function couldBeMouseSequence(buffer) {
27
+ if (buffer.length === 0)
28
+ return true;
29
+ // Check SGR prefix
30
+ if (exports.SGR_EVENT_PREFIX.startsWith(buffer) ||
31
+ buffer.startsWith(exports.SGR_EVENT_PREFIX))
32
+ return true;
33
+ // Check X11 prefix
34
+ if (exports.X11_EVENT_PREFIX.startsWith(buffer) ||
35
+ buffer.startsWith(exports.X11_EVENT_PREFIX))
36
+ return true;
37
+ return false;
38
+ }
39
+ /**
40
+ * Checks if the buffer *starts* with a complete mouse sequence.
41
+ * Returns the length of the sequence if matched, or 0 if not.
42
+ */
43
+ function getMouseSequenceLength(buffer) {
44
+ var sgrMatch = buffer.match(exports.SGR_MOUSE_REGEX);
45
+ if (sgrMatch)
46
+ return sgrMatch[0].length;
47
+ var x11Match = buffer.match(exports.X11_MOUSE_REGEX);
48
+ if (x11Match)
49
+ return x11Match[0].length;
50
+ return 0;
51
+ }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Represents the type of mouse event.
3
+ *
4
+ * - `*-press`: Mouse button pressed.
5
+ * - `*-release`: Mouse button released.
6
+ * - `scroll-*`: Scroll wheel action.
7
+ * - `move`: Mouse movement (requires tracking enabled).
8
+ */
9
+ export type MouseEventName = "left-press" | "left-release" | "right-press" | "right-release" | "middle-press" | "middle-release" | "scroll-up" | "scroll-down" | "scroll-left" | "scroll-right" | "move";
10
+ /**
11
+ * Structure representing a parsed mouse event.
12
+ */
13
+ export interface MouseEvent {
14
+ /** The name/type of the event. */
15
+ name: MouseEventName;
16
+ /** zero-based column/x-coordinate. */
17
+ col: number;
18
+ /** zero-based row/y-coordinate. */
19
+ row: number;
20
+ /** Whether the Shift key was held. */
21
+ shift: boolean;
22
+ /** Whether the Meta/Alt key was held. */
23
+ meta: boolean;
24
+ /** Whether the Ctrl key was held. */
25
+ ctrl: boolean;
26
+ /** The specific button involved in the event. */
27
+ button: "left" | "middle" | "right" | "none";
28
+ }
29
+ /**
30
+ * Function signature for handling mouse events.
31
+ * @param event - The parsed mouse event.
32
+ * @returns `boolean` or `undefined`. If it returns `true`, it might indicate the event was handled (depending on consumer logic), but commonly used for side effects.
33
+ */
34
+ export type MouseHandler = (event: MouseEvent) => boolean | undefined;
35
+ /**
36
+ * Derives the `MouseEventName` from the SGR button code and release state.
37
+ *
38
+ * @param buttonCode - The numerical code from the SGR sequence.
39
+ * @param isRelease - Whether the event is a release event (last char is 'm').
40
+ * @returns The `MouseEventName` or `null` if unknown.
41
+ */
42
+ export declare function getMouseEventName(buttonCode: number, isRelease: boolean): MouseEventName | null;
43
+ /**
44
+ * Parses an SGR (1006) mouse sequence.
45
+ *
46
+ * @param buffer - The input string containing the sequence.
47
+ * @returns An object containing the parsed event and the length of the matched sequence, or `null` if not an SGR sequence.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * parseSGRMouseEvent("\x1b[<0;10;10M"); // Left press at 10,10
52
+ * ```
53
+ */
54
+ export declare function parseSGRMouseEvent(buffer: string): {
55
+ event: MouseEvent;
56
+ length: number;
57
+ } | null;
58
+ /**
59
+ * Parses an X11 mouse sequence.
60
+ *
61
+ * @param buffer - The input string containing the sequence.
62
+ * @returns An object containing the parsed event and the length of the matched sequence, or `null` if not an X11 sequence.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * parseX11MouseEvent("\x1b[M..."); // Parsed X11 event
67
+ * ```
68
+ */
69
+ export declare function parseX11MouseEvent(buffer: string): {
70
+ event: MouseEvent;
71
+ length: number;
72
+ } | null;
73
+ /**
74
+ * Attempts to parse a mouse event from the buffer, trying both SGR and X11 formats.
75
+ *
76
+ * @param buffer - The input string.
77
+ * @returns The parsed event and length, or `null`.
78
+ */
79
+ export declare function parseMouseEvent(buffer: string): {
80
+ event: MouseEvent;
81
+ length: number;
82
+ } | null;
83
+ /**
84
+ * Checks if the buffer contains an incomplete mouse sequence.
85
+ * This is useful for knowing if we should wait for more data before processing.
86
+ *
87
+ * @param buffer - The input string.
88
+ * @returns `true` if the buffer looks like the start of a mouse sequence but is incomplete.
89
+ */
90
+ export declare function isIncompleteMouseSequence(buffer: string): boolean;