Release v0.4.0: Add React Hook support and enhance event blocking#4
Merged
knowledgecode merged 9 commits intomainfrom Jan 29, 2026
Merged
Release v0.4.0: Add React Hook support and enhance event blocking#4knowledgecode merged 9 commits intomainfrom
knowledgecode merged 9 commits intomainfrom
Conversation
- Add dynamic event listener activation/deactivation (_activate() and _deactivate() methods) - Expand blocked event types from 6 to 13 events - Added: click, dragstart, mouseup, pointerdown, pointermove, pointerup, selectstart - Optimize performance by removing listeners when no filters are registered - Improve JSDoc comments for better developer experience
- Add comprehensive JSDoc comments for private properties and factory function - Improve timer ID type from number to ReturnType<typeof setTimeout> for cross-platform compatibility - Simplify timer calls from globalThis.setTimeout to setTimeout - Add type exports to src/index.ts (export type * from './blokr.ts')
- Implement useBlokr Hook for element-scoped or global user interaction blocking - Provide target ref, lock(), unlock(), and isLocked() methods - Support allowGlobal parameter for global lock mode - Enable event blocking at element scope or global scope
- Add comprehensive test suite for useBlokr Hook (834 lines, ~60 test cases) - Cover basic behavior, ref assignment, function memoization, integration tests, and edge cases - Ensure full test coverage for React Hook implementation
- Remove afterEach cleanup logic (unnecessary with Vitest browser mode auto-reset) - Remove redundant test cases and improve test names in blokr.test.ts - Change event-blocking.test.ts from mousedown to click event tests - Reflect core improvements from previous commits
- Change to multi-entry configuration (index and react entry points) - Remove UMD format (ES modules only) - Configure React as external dependency - Change exports from 'default' to 'auto' - Add @vitejs/plugin-react plugin for React support
- Add eslint-plugin-react-hooks for React Hook linting - Remove unused TypeScript rules - Add new rule: @typescript-eslint/no-empty-function: 'off'
- Bump version from 0.3.0 to 0.4.0 - Add "sideEffects": false for tree-shaking support - Add ./react entry point to exports field - Add React 18/19 as optional peer dependencies - Add clean command to build scripts - Add new dev dependencies for React support - Update multiple package versions
- Add v0.4.0 new features section (React Hook support) - Update Breaking Changes section (UMD format removal) - Expand "Why Blokr?" section with comparison table of alternative solutions - Add React Hook section with usage examples, API, and allowGlobal parameter - Remove CDN UMD examples - Simplify "Limitations" section
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 introduces v0.4.0 with significant new features and improvements:
useBlokrHook for element-scoped or global user interaction blocking in React applicationsblokr(core) andblokr/reactentry pointsKey Changes by Commit
useBlokr)Test Plan
dist/index.jsanddist/react.js)Breaking Changes