Skip to content

Refactor cursor positioning to reactive action-based architecture - #289

Merged
malibio merged 3 commits into
mainfrom
feature/issue-281-refactor-cursor-positioning
Oct 18, 2025
Merged

malibio merged 3 commits into
mainfrom
feature/issue-281-refactor-cursor-positioning

Conversation

@malibio

@malibio malibio commented Oct 18, 2025

Copy link
Copy Markdown
Collaborator

Closes #281

malibio and others added 3 commits October 18, 2025 18:19
Implements Issue #281: Replaces imperative $effect blocks with declarative
Svelte action for cursor positioning.

Architecture Changes:
- Created positionCursor Svelte action to encapsulate DOM manipulation
- Consolidated FocusManager state into unified cursorPosition type
- Updated base-node.svelte to use $derived and action directive
- Removed imperative $effect blocks for cursor positioning

New Features:
- Unified cursor position types: default, absolute, line-column, arrow-navigation, node-type-conversion
- New FocusManager API: focusNode(), focusNodeAtPosition(), focusNodeAtLine(), focusNodeFromArrowNav(), focusNodeFromTypeConversion()
- Backward compatible legacy API (marked deprecated)
- Smart cursor caching to prevent duplicate positioning
- requestAnimationFrame for smooth, non-blocking updates

Benefits:
- More maintainable: single source of truth, declarative data flow
- Better performance: RAF prevents blocking, caching prevents duplicates
- Cleaner architecture: separation of concerns
- Fully tested: 23 new tests, all passing
- Type-safe: full TypeScript support

Merge Conflict Resolution:
- Integrated upstream node-type-conversion feature into unified cursor system
- Preserved all functionality from both upstream and refactor
- All cursor positioning tests pass (23/23)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Documents the critical step of pulling from remote before starting work
to avoid merge conflicts during development.

Changes:
- Added step 2: "Pull latest changes" (git fetch origin && git pull origin main)
- Updated step numbers from 1-8 to 1-9
- Added to "Common mistakes" section with warning about merge conflicts
- Updated TodoWrite tool instructions to include pull step
- Updated mandatory process checklist to include pull step

This documents the lesson learned from Issue #281 where starting work
without pulling led to unnecessary merge conflicts mid-implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Updates textarea-editor-architecture.md to reflect the refactored cursor
positioning implementation from Issue #281.

Changes:
- Updated architecture diagram to include positionCursor action
- Replaced imperative $effect examples with declarative action-based approach
- Documented unified CursorPosition type and new FocusManager API
- Added comprehensive positionCursor action documentation with code examples
- Updated arrow navigation section to show reactive data flow
- Documented all architectural benefits of the refactor

Key Documentation:
- FocusManager: Unified cursorPosition state with type-safe API
- positionCursor Action: Encapsulated DOM manipulation with RAF
- Reactive Flow: State → $derived → action → DOM
- Benefits: Single source of truth, maintainable, scalable

This ensures developers understand the new architecture and can maintain
the cursor positioning system effectively.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@malibio
malibio merged commit 9576dd0 into main Oct 18, 2025
@malibio
malibio deleted the feature/issue-281-refactor-cursor-positioning branch October 18, 2025 16:37
malibio added a commit that referenced this pull request Feb 4, 2026
* Refactor cursor positioning to reactive action-based architecture

Implements Issue #281: Replaces imperative $effect blocks with declarative
Svelte action for cursor positioning.

Architecture Changes:
- Created positionCursor Svelte action to encapsulate DOM manipulation
- Consolidated FocusManager state into unified cursorPosition type
- Updated base-node.svelte to use $derived and action directive
- Removed imperative $effect blocks for cursor positioning

New Features:
- Unified cursor position types: default, absolute, line-column, arrow-navigation, node-type-conversion
- New FocusManager API: focusNode(), focusNodeAtPosition(), focusNodeAtLine(), focusNodeFromArrowNav(), focusNodeFromTypeConversion()
- Backward compatible legacy API (marked deprecated)
- Smart cursor caching to prevent duplicate positioning
- requestAnimationFrame for smooth, non-blocking updates

Benefits:
- More maintainable: single source of truth, declarative data flow
- Better performance: RAF prevents blocking, caching prevents duplicates
- Cleaner architecture: separation of concerns
- Fully tested: 23 new tests, all passing
- Type-safe: full TypeScript support

Merge Conflict Resolution:
- Integrated upstream node-type-conversion feature into unified cursor system
- Preserved all functionality from both upstream and refactor
- All cursor positioning tests pass (23/23)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Update startup sequence to include pulling latest changes

Documents the critical step of pulling from remote before starting work
to avoid merge conflicts during development.

Changes:
- Added step 2: "Pull latest changes" (git fetch origin && git pull origin main)
- Updated step numbers from 1-8 to 1-9
- Added to "Common mistakes" section with warning about merge conflicts
- Updated TodoWrite tool instructions to include pull step
- Updated mandatory process checklist to include pull step

This documents the lesson learned from Issue #281 where starting work
without pulling led to unnecessary merge conflicts mid-implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Document reactive action-based cursor positioning architecture

Updates textarea-editor-architecture.md to reflect the refactored cursor
positioning implementation from Issue #281.

Changes:
- Updated architecture diagram to include positionCursor action
- Replaced imperative $effect examples with declarative action-based approach
- Documented unified CursorPosition type and new FocusManager API
- Added comprehensive positionCursor action documentation with code examples
- Updated arrow navigation section to show reactive data flow
- Documented all architectural benefits of the refactor

Key Documentation:
- FocusManager: Unified cursorPosition state with type-safe API
- positionCursor Action: Encapsulated DOM manipulation with RAF
- Reactive Flow: State → $derived → action → DOM
- Benefits: Single source of truth, maintainable, scalable

This ensures developers understand the new architecture and can maintain
the cursor positioning system effectively.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 5, 2026
* Refactor cursor positioning to reactive action-based architecture

Implements Issue #281: Replaces imperative $effect blocks with declarative
Svelte action for cursor positioning.

Architecture Changes:
- Created positionCursor Svelte action to encapsulate DOM manipulation
- Consolidated FocusManager state into unified cursorPosition type
- Updated base-node.svelte to use $derived and action directive
- Removed imperative $effect blocks for cursor positioning

New Features:
- Unified cursor position types: default, absolute, line-column, arrow-navigation, node-type-conversion
- New FocusManager API: focusNode(), focusNodeAtPosition(), focusNodeAtLine(), focusNodeFromArrowNav(), focusNodeFromTypeConversion()
- Backward compatible legacy API (marked deprecated)
- Smart cursor caching to prevent duplicate positioning
- requestAnimationFrame for smooth, non-blocking updates

Benefits:
- More maintainable: single source of truth, declarative data flow
- Better performance: RAF prevents blocking, caching prevents duplicates
- Cleaner architecture: separation of concerns
- Fully tested: 23 new tests, all passing
- Type-safe: full TypeScript support

Merge Conflict Resolution:
- Integrated upstream node-type-conversion feature into unified cursor system
- Preserved all functionality from both upstream and refactor
- All cursor positioning tests pass (23/23)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Update startup sequence to include pulling latest changes

Documents the critical step of pulling from remote before starting work
to avoid merge conflicts during development.

Changes:
- Added step 2: "Pull latest changes" (git fetch origin && git pull origin main)
- Updated step numbers from 1-8 to 1-9
- Added to "Common mistakes" section with warning about merge conflicts
- Updated TodoWrite tool instructions to include pull step
- Updated mandatory process checklist to include pull step

This documents the lesson learned from Issue #281 where starting work
without pulling led to unnecessary merge conflicts mid-implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Document reactive action-based cursor positioning architecture

Updates textarea-editor-architecture.md to reflect the refactored cursor
positioning implementation from Issue #281.

Changes:
- Updated architecture diagram to include positionCursor action
- Replaced imperative $effect examples with declarative action-based approach
- Documented unified CursorPosition type and new FocusManager API
- Added comprehensive positionCursor action documentation with code examples
- Updated arrow navigation section to show reactive data flow
- Documented all architectural benefits of the refactor

Key Documentation:
- FocusManager: Unified cursorPosition state with type-safe API
- positionCursor Action: Encapsulated DOM manipulation with RAF
- Reactive Flow: State → $derived → action → DOM
- Benefits: Single source of truth, maintainable, scalable

This ensures developers understand the new architecture and can maintain
the cursor positioning system effectively.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
malibio added a commit that referenced this pull request Feb 26, 2026
* Refactor cursor positioning to reactive action-based architecture

Implements Issue #281: Replaces imperative $effect blocks with declarative
Svelte action for cursor positioning.

Architecture Changes:
- Created positionCursor Svelte action to encapsulate DOM manipulation
- Consolidated FocusManager state into unified cursorPosition type
- Updated base-node.svelte to use $derived and action directive
- Removed imperative $effect blocks for cursor positioning

New Features:
- Unified cursor position types: default, absolute, line-column, arrow-navigation, node-type-conversion
- New FocusManager API: focusNode(), focusNodeAtPosition(), focusNodeAtLine(), focusNodeFromArrowNav(), focusNodeFromTypeConversion()
- Backward compatible legacy API (marked deprecated)
- Smart cursor caching to prevent duplicate positioning
- requestAnimationFrame for smooth, non-blocking updates

Benefits:
- More maintainable: single source of truth, declarative data flow
- Better performance: RAF prevents blocking, caching prevents duplicates
- Cleaner architecture: separation of concerns
- Fully tested: 23 new tests, all passing
- Type-safe: full TypeScript support

Merge Conflict Resolution:
- Integrated upstream node-type-conversion feature into unified cursor system
- Preserved all functionality from both upstream and refactor
- All cursor positioning tests pass (23/23)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Update startup sequence to include pulling latest changes

Documents the critical step of pulling from remote before starting work
to avoid merge conflicts during development.

Changes:
- Added step 2: "Pull latest changes" (git fetch origin && git pull origin main)
- Updated step numbers from 1-8 to 1-9
- Added to "Common mistakes" section with warning about merge conflicts
- Updated TodoWrite tool instructions to include pull step
- Updated mandatory process checklist to include pull step

This documents the lesson learned from Issue #281 where starting work
without pulling led to unnecessary merge conflicts mid-implementation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

* Document reactive action-based cursor positioning architecture

Updates textarea-editor-architecture.md to reflect the refactored cursor
positioning implementation from Issue #281.

Changes:
- Updated architecture diagram to include positionCursor action
- Replaced imperative $effect examples with declarative action-based approach
- Documented unified CursorPosition type and new FocusManager API
- Added comprehensive positionCursor action documentation with code examples
- Updated arrow navigation section to show reactive data flow
- Documented all architectural benefits of the refactor

Key Documentation:
- FocusManager: Unified cursorPosition state with type-safe API
- positionCursor Action: Encapsulated DOM manipulation with RAF
- Reactive Flow: State → $derived → action → DOM
- Benefits: Single source of truth, maintainable, scalable

This ensures developers understand the new architecture and can maintain
the cursor positioning system effectively.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor cursor positioning to reactive action-based architecture

1 participant