Skip to content

refactor: extract core features and controllers from React package#124

Merged
Nowely merged 52 commits intonextfrom
step-to-extract-to-core
Mar 1, 2026
Merged

refactor: extract core features and controllers from React package#124
Nowely merged 52 commits intonextfrom
step-to-extract-to-core

Conversation

@Nowely
Copy link
Owner

@Nowely Nowely commented Mar 1, 2026

Summary

Major refactoring to extract framework-agnostic features from React package into the core package, improving separation of concerns and reusability.

Key Changes

Core Package Enhancements

  • New Controllers: SystemListenerController, FocusController, KeyDownController, OverlayController, TextSelectionController
  • State Management: Added defineState and defineEvents utilities for reactive state management
  • Lifecycle Feature: New Lifecycle class for parsing synchronization and event subscription
  • Parsing Utilities: Extracted valueParser and findToken from React package
  • Navigation & Selection: Moved navigation logic and text selection utilities to core

React Package Simplification

  • Removed Deprecated Components: StoreProvider, Whisper, Featurer
  • Removed Hooks: useKeyDown, useSystemListeners, useCloseOverlayByEsc, useCloseOverlayByOutsideClick, useFocusRecovery, useTextSelection, useValueParser, useMarkedInputHandler, useListener
  • Simplified MarkedInput: Integrated core features directly, removed inner component
  • New Utilities: createUseHook, useCoreFeatures, OverlayRenderer

Architecture Improvements

  • Framework-agnostic core with clear separation of concerns
  • Reactive state management with getter/setter pattern
  • Better event handling through centralized controllers
  • Cleaner component hierarchy

Breaking Changes

  • Removed deprecated MarkedInputHandler interface (replaced with MarkputHandler)
  • Removed deprecated useListener hook
  • Simplified store initialization and prop handling

…rmalizeProps utility function for improved prop handling and remove redundant code.
…er, and related components to replace prop access with state access for improved consistency in state management.
…cross components, including Store, MarkedInput, and Container. Introduce new types for improved type safety and clarity in the codebase.
…methods, enhancing consistency and clarity in state management across the codebase.
… with MarkputState, enhancing type safety and clarity in state management. Update related documentation to reflect changes in prop structure.
Nowely added 20 commits March 1, 2026 12:33
…andling. Consolidate destructuring in MarkedInput for clarity and update normalizeProps to return a more structured object, enhancing type safety and reducing redundancy.
…grating its functionality directly into the component. Update prop destructuring for clarity and enhance default options handling. Adjust documentation links to reflect changes in line numbers.
…nsolidating state setup into a single line. Update useCoreFeatures hook to rename isMounted to isInitialized for improved clarity in component lifecycle management.
…eateUseHook for improved clarity and maintainability. Remove unused imports and streamline state initialization. Introduce createUseHook utility for better signal management.
…gement. Introduce StateObject type for better type safety and simplify state updates in MarkedInput by using a single set method. Update documentation links and improve clarity in prop descriptions.
…enhancing usability and ensuring consistent behavior. Adjust prop destructuring for clarity.
…orrect emitter and state management behavior. Cover scenarios including emitter creation, subscription handling, and state updates with various payloads.
…event management. Update useCoreFeatures hook to utilize disableClose, ensuring proper cleanup of event listeners. Add unit test for reopening overlay after closing in Overlay.spec.tsx to verify functionality.
… files for defineEvents and defineState to include necessary vitest imports for improved test structure and functionality.
…s for value, Mark, and options. This change enhances performance and ensures consistent behavior when options are provided.
…s and properties, enhancing performance and consistency across Container, EditableSpan, TextSpan, and MarkRenderer. Update resolveSlot and resolveSlotProps functions to accept reactive state inputs, improving overall code clarity and maintainability.
… during recovery state. Update useOverlay hook to utilize useMemo for ref management, improving performance. Add new unit tests in Overlay.spec.tsx to verify token conversion and focus restoration after overlay selection.
…Index in recovery state, improving focus restoration logic. Update Recovery type to include childIndex for better state management. Add verifyCaretPosition utility for testing caret position after overlay selection in Overlay.spec.tsx.
…is NaN. Add unit test for MarkedInput to ensure no empty marks are created when pressing Enter without selection in overlay.
…r options, slots, and slotProps. Improve clarity in prop descriptions to aid user understanding.
…proved overlay management. Add new OverlayRenderer component to handle overlay rendering logic and state management.
…te related documentation and remove deprecated MarkedInputHandler interface.
…ation into Store. Update useCoreFeatures hook to utilize Lifecycle for improved state management and parsing synchronization.
…ggestions component to handle keyboard events directly. Remove deprecated useListener hook and related functionality for cleaner event management.
@vercel
Copy link

vercel bot commented Mar 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marked-input Ready Ready Preview, Comment Mar 1, 2026 9:38pm
markput-website Ready Ready Preview, Comment Mar 1, 2026 9:38pm

…te documentation for MarkedInput and MarkputHandler interfaces, including examples and corrected line references. Remove deprecated useListener documentation.
@Nowely Nowely merged commit c0ad3d7 into next Mar 1, 2026
7 of 9 checks passed
@Nowely Nowely deleted the step-to-extract-to-core branch March 1, 2026 21:28
Nowely pushed a commit that referenced this pull request Mar 3, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.2.0](root-0.1.0...root-0.2.0)
(2026-03-03)


### Features

* **vue:** add initial Vue support
([#125](#125))
([c479853](c479853))


### Bug Fixes

* **storybook:** prevent caret reset in TextSpan and fix Storybook
issues ([#122](#122))
([3472085](3472085))


### Refactoring

* extract core features and controllers from React package
([#124](#124))
([c0ad3d7](c0ad3d7))


### Miscellaneous

* add release-please config for unified versioning
([db07f5e](db07f5e))
* upgrade to React 19
([#121](#121))
([d9c9531](d9c9531))


### CI

* add automated release workflow and PR validation
([#120](#120))
([85b6fc4](85b6fc4))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

1 participant