v0.0.3#9
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR releases v0.0.3 and refactors the keyboard’s shift/caps behavior into a reusable useKeyboard() hook so consumers can read and share the uppercase state (shifted vs caps-lock) outside of the Keyboard component.
Changes:
- Introduces
useKeyboard()and aKeyboardControllerAPI to centralize uppercase state transitions and exposeisUppercase/isShifted/isCapsLocked. - Updates
Keyboard,KeyboardKey, and render context types to use the new uppercase-state model (replacing the priorisShiftModeconcept). - Updates examples, docs, and tests to demonstrate and verify shared controller behavior.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/useKeyboard.ts | Adds useKeyboard() hook and KeyboardController for uppercase state + handlers. |
| src/lib/types.ts | Replaces isShiftMode with isUppercase / isShifted / isCapsLocked in render context. |
| src/lib/KeyboardKey.tsx | Threads new uppercase-state flags through and uses them for label/value resolution. |
| src/lib/Keyboard.tsx | Switches internal state handling to useKeyboard() and adds keyboardController prop. |
| src/lib/index.ts | Exports useKeyboard() and related types from the public entrypoint. |
| src/lib/getKeyValue.ts | Renames “shift” parameter to “uppercase” and uses isUppercase semantics. |
| src/lib/getKeyLabel.ts | Renames “shift” parameter to “uppercase” and uses isUppercase semantics. |
| src/example/App.tsx | Demonstrates shared controller usage and displays current keyboard mode. |
| src/tests/KeyboardKey.test.ts | Updates props to match new uppercase-state flags. |
| src/tests/Keyboard.test.tsx | Adds coverage for uppercase-exit behavior and shared controller state exposure. |
| README.md | Updates docs to describe the new uppercase-state model and useKeyboard() sharing. |
| package.json | Bumps version to 0.0.3 and adds package metadata (description/keywords/license/etc.). |
| package-lock.json | Updates lock metadata for new package name/version/license. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This update refactors the
Keyboardwith auseKeyboard()hook that allows for accessing the internal shift/caps lock uppercase state of theKeyboard.