feat: implement edit mode state machine (i and Escape)

Added mode state machine with visual feedback:

Mode State:
- CursorMode type: 'normal' | 'edit'
- Tracked in useCursor with useState
- Starts in 'normal' mode

Key Bindings:
- Press 'i' in normal mode → Enter edit mode
- Press 'Escape' in edit mode → Return to normal mode
- All vim motions (hjkl, anchors, etc.) only work in normal mode
- Edit mode blocks all movement keys

Visual Feedback:
- Normal mode: Blue outline (rgb(59, 130, 246))
- Edit mode: Green pulsing outline (rgb(34, 197, 94))
- Smooth pulse animation (1.5s ease-in-out infinite)
- cursor-edit CSS class applied in edit mode

Flow:
1. Game starts in normal mode (blue cursor)
2. Press 'i' → Green pulsing cursor (edit mode)
3. Press 'Escape' → Blue cursor (normal mode)

No digit entry yet - just state machine and visual indicators.
Phase 40.3.1 complete.
This commit is contained in:
2025-10-22 19:22:15 +01:00
parent 8ac008aeac
commit 0ce1d7fe65
6 changed files with 49 additions and 9 deletions
+2 -1
View File
@@ -18,8 +18,9 @@ export function useGame(options: GameOptions = {}, platformHook?: unknown): Game
const cursor = useCursor(gameStatusManager, containerRef);
const cursorPosition = cursor.position();
const cursorMode = cursor.mode();
useCursorRender(containerRef, cursorPosition, gameStatus, boardRendered);
useCursorRender(containerRef, cursorPosition, cursorMode, gameStatus, boardRendered);
useEffect(() => {
renderBoard();