From 1d8a0f1028e37f0abb67e1915d00f10edb48d22c Mon Sep 17 00:00:00 2001 From: alphainfinitus Date: Mon, 5 Jan 2026 02:58:50 +0530 Subject: [PATCH] feat: Add cursor management utilities and a `useSpeechInputWithCursor` hook with tests, updating ESLint globals and project exports. --- eslint.config.js | 3 + plans/phase3.md | 863 ++++++++++++++++++ src/__tests__/cursor.test.ts | 195 ++++ .../useSpeechInputWithCursor.test.ts | 311 +++++++ src/hooks/index.ts | 7 + src/hooks/useSpeechInputWithCursor.ts | 98 ++ src/index.ts | 18 +- src/utils/cursor.ts | 114 +++ src/utils/index.ts | 7 + 9 files changed, 1614 insertions(+), 2 deletions(-) create mode 100644 plans/phase3.md create mode 100644 src/__tests__/cursor.test.ts create mode 100644 src/__tests__/useSpeechInputWithCursor.test.ts create mode 100644 src/hooks/useSpeechInputWithCursor.ts create mode 100644 src/utils/cursor.ts create mode 100644 src/utils/index.ts diff --git a/eslint.config.js b/eslint.config.js index eb793fc..a7fd18c 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -27,11 +27,14 @@ export default [ navigator: 'readonly', setTimeout: 'readonly', clearTimeout: 'readonly', + requestAnimationFrame: 'readonly', Event: 'readonly', EventTarget: 'readonly', DOMException: 'readonly', PermissionStatus: 'readonly', PermissionName: 'readonly', + HTMLInputElement: 'readonly', + HTMLTextAreaElement: 'readonly', SpeechRecognition: 'readonly', SpeechRecognitionEvent: 'readonly', SpeechRecognitionErrorEvent: 'readonly', diff --git a/plans/phase3.md b/plans/phase3.md new file mode 100644 index 0000000..4ed4172 --- /dev/null +++ b/plans/phase3.md @@ -0,0 +1,863 @@ +# Phase 3: Cursor Insertion Utility + +> **Goal:** Enable inserting transcribed text at the cursor position in text inputs/textareas. + +**Estimated Time:** 1-2 days + +--- + +## Overview + +Phase 3 adds cursor-aware text insertion capabilities: +- Cursor position utilities for `` and `