Skip to content

v0.0.3#9

Merged
ty2k merged 10 commits into
mainfrom
feature/usekeyboard-hook
Jun 1, 2026
Merged

v0.0.3#9
ty2k merged 10 commits into
mainfrom
feature/usekeyboard-hook

Conversation

@ty2k

@ty2k ty2k commented Jun 1, 2026

Copy link
Copy Markdown
Owner

This update refactors the Keyboard with a useKeyboard() hook that allows for accessing the internal shift/caps lock uppercase state of the Keyboard.

@ty2k ty2k requested a review from Copilot June 1, 2026 18:15
@ty2k ty2k self-assigned this Jun 1, 2026
@ty2k ty2k added the enhancement New feature or request label Jun 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a KeyboardController API to centralize uppercase state transitions and expose isUppercase / isShifted / isCapsLocked.
  • Updates Keyboard, KeyboardKey, and render context types to use the new uppercase-state model (replacing the prior isShiftMode concept).
  • 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.

Comment thread src/lib/Keyboard.tsx Outdated
Comment thread src/example/App.tsx Outdated
Comment thread README.md
@ty2k ty2k merged commit fa6cc28 into main Jun 1, 2026
1 check passed
@ty2k ty2k deleted the feature/usekeyboard-hook branch June 1, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants