feat: Add signals_nocterm package for Nocterm TUI framework integration#443
Draft
Norbert515 wants to merge 2 commits intorodydavis:mainfrom
Draft
feat: Add signals_nocterm package for Nocterm TUI framework integration#443Norbert515 wants to merge 2 commits intorodydavis:mainfrom
Norbert515 wants to merge 2 commits intorodydavis:mainfrom
Conversation
This adds a new package that integrates the signals reactive state management library with the Nocterm terminal UI framework. Features: - SignalsMixin: Mixin for State classes to automatically manage signal lifecycle - Watch: Component for fine-grained rebuilds when signals change - WatchBuilder: Builder pattern for watching a single signal - watchSignal: Extension and function to watch signals in build methods The implementation follows the same patterns as signals_flutter to provide a familiar API for users of both libraries. Closes rodydavis#442
Critical fixes: - Reimplement Watch/WatchBuilder to match signals_flutter API exactly - Watch now delegates to WatchBuilder using SignalsMixin with createComputed - WatchBuilder signature matches Flutter: builder(context, child) - Add Watch.builder named constructor for drop-in replacement - Add debugLabel and dependencies parameters to Watch/WatchBuilder - Add reassemble() method for hot reload support - Add didChangeDependencies() support for inherited widget changes High priority fixes: - ElementWatcher.dispose() now snapshots maps before iterating to prevent ConcurrentModificationError when cleanup callbacks trigger signal updates Test improvements: - Add tests for Watch.builder constructor - Add tests for dependencies parameter - Add tests for nested Watch components - Add tests for watch/unwatch/watch cycles - Add tests for rapid signal updates - Add tests for multiple signals - Add tests for effects - Add tests for component disposal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new
signals_noctermpackage that integrates the signals reactive state management library with the Nocterm terminal UI framework.Closes #442
Features
Stateclasses to automatically manage signal lifecycle (create signals, computed values, and effects that are automatically disposed)Implementation Details
The implementation follows the same patterns as
signals_flutterto provide a familiar API for users of both libraries. Key adaptations for Nocterm:SchedulerBindinginstead of Flutter's for frame schedulingElementandBuildContextinstead of Flutter'sState<T>,StatefulComponent, etc.)Example Usage
Test plan
dart testin the signals_nocterm packageNotes
This is a draft PR - happy to iterate on the API based on feedback from @rodydavis and the community.