Skip to content

feat: refactor normalization and formatting for display#85

Merged
KevinVandy merged 3 commits intomainfrom
normalize
Mar 26, 2026
Merged

feat: refactor normalization and formatting for display#85
KevinVandy merged 3 commits intomainfrom
normalize

Conversation

@KevinVandy
Copy link
Member

🎯 Changes

Core (@tanstack/hotkeys)

  • Adds normalizeRegisterableHotkey, normalizeHotkeyFromParsed, and normalizeHotkeyFromEvent; replaces keyboardEventToHotkey with normalizeHotkeyFromEvent.
  • Updates normalizeHotkey behavior/docs; removes convertToModFormat.
    Consolidates modifier checks: isModifierKey for string tokens (drops KeyboardEvent overload; old isModifier naming removed).
  • Removes formatKeyForDebuggingDisplay and related types; formatForDisplay uses the new normalization path.
  • Expands display constants: WINDOWS_MODIFIER_LABELS, LINUX_MODIFIER_LABELS, MAC_MODIFIER_LABELS, PUNCTUATION_KEY_DISPLAY_LABELS, plus typing tweaks for symbols/labels.
  • Updates recorder-chord, sequence-manager, and tests.
  • Registerable hotkeys are normalized with normalizeRegisterableHotkey instead of rawHotkeyToParsedHotkey + formatHotkey.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

@coderabbitai
Copy link

coderabbitai bot commented Mar 26, 2026

Important

Review skipped

Too many files!

This PR contains 154 files, which is 4 over the limit of 150.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1b2a2169-596f-4e4a-8c40-7f7c8d6668d1

📥 Commits

Reviewing files that changed from the base of the PR and between 5c6f939 and 46caf9d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (154)
  • .changeset/normalize-format-minor.md
  • README.md
  • docs/config.json
  • docs/framework/angular/guides/formatting-display.md
  • docs/framework/angular/guides/key-state-tracking.md
  • docs/framework/angular/reference/functions/injectHotkey.md
  • docs/framework/angular/reference/functions/injectHotkeys.md
  • docs/framework/angular/reference/interfaces/InjectHotkeyDefinition.md
  • docs/framework/angular/reference/interfaces/InjectHotkeyOptions.md
  • docs/framework/preact/guides/formatting-display.md
  • docs/framework/preact/guides/key-state-tracking.md
  • docs/framework/preact/reference/functions/useHotkey.md
  • docs/framework/preact/reference/functions/useHotkeys.md
  • docs/framework/preact/reference/interfaces/UseHotkeyDefinition.md
  • docs/framework/preact/reference/interfaces/UseHotkeyOptions.md
  • docs/framework/react/guides/formatting-display.md
  • docs/framework/react/guides/key-state-tracking.md
  • docs/framework/react/reference/functions/useHotkey.md
  • docs/framework/react/reference/functions/useHotkeys.md
  • docs/framework/react/reference/interfaces/UseHotkeyDefinition.md
  • docs/framework/react/reference/interfaces/UseHotkeyOptions.md
  • docs/framework/solid/guides/formatting-display.md
  • docs/framework/solid/guides/key-state-tracking.md
  • docs/framework/solid/reference/functions/createHotkey.md
  • docs/framework/solid/reference/functions/createHotkeys.md
  • docs/framework/solid/reference/interfaces/CreateHotkeyDefinition.md
  • docs/framework/solid/reference/interfaces/CreateHotkeyOptions.md
  • docs/framework/svelte/guides/formatting-display.md
  • docs/framework/svelte/guides/key-state-tracking.md
  • docs/framework/svelte/reference/functions/createHotkey.md
  • docs/framework/svelte/reference/functions/createHotkeyAttachment.md
  • docs/framework/svelte/reference/functions/createHotkeys.md
  • docs/framework/svelte/reference/functions/createHotkeysAttachment.md
  • docs/framework/svelte/reference/interfaces/CreateHotkeyDefinition.md
  • docs/framework/svelte/reference/interfaces/CreateHotkeyOptions.md
  • docs/framework/vue/guides/formatting-display.md
  • docs/framework/vue/guides/key-state-tracking.md
  • docs/framework/vue/reference/functions/useHotkey.md
  • docs/framework/vue/reference/functions/useHotkeys.md
  • docs/framework/vue/reference/interfaces/UseHotkeyDefinition.md
  • docs/framework/vue/reference/interfaces/UseHotkeyOptions.md
  • docs/reference/functions/convertToModFormat.md
  • docs/reference/functions/detectPlatform.md
  • docs/reference/functions/formatForDisplay.md
  • docs/reference/functions/formatHotkey.md
  • docs/reference/functions/formatHotkeySequence.md
  • docs/reference/functions/formatKeyForDebuggingDisplay.md
  • docs/reference/functions/formatWithLabels.md
  • docs/reference/functions/hasNonModifierKey.md
  • docs/reference/functions/isModifier.md
  • docs/reference/functions/isModifierKey.md
  • docs/reference/functions/isSingleLetterKey.md
  • docs/reference/functions/keyboardEventToHotkey.md
  • docs/reference/functions/normalizeHotkey.md
  • docs/reference/functions/normalizeHotkeyFromEvent.md
  • docs/reference/functions/normalizeHotkeyFromParsed.md
  • docs/reference/functions/normalizeKeyName.md
  • docs/reference/functions/normalizeRegisterableHotkey.md
  • docs/reference/functions/parseHotkey.md
  • docs/reference/functions/parseKeyboardEvent.md
  • docs/reference/functions/rawHotkeyToParsedHotkey.md
  • docs/reference/functions/resolveModifier.md
  • docs/reference/index.md
  • docs/reference/interfaces/FormatDisplayOptions.md
  • docs/reference/interfaces/FormatKeyDebuggingOptions.md
  • docs/reference/interfaces/HotkeyCallbackContext.md
  • docs/reference/interfaces/ValidationResult.md
  • docs/reference/type-aliases/HotkeyCallback.md
  • docs/reference/variables/ALL_KEYS.md
  • docs/reference/variables/EDITING_KEYS.md
  • docs/reference/variables/FUNCTION_KEYS.md
  • docs/reference/variables/KEY_DISPLAY_SYMBOLS.md
  • docs/reference/variables/LETTER_KEYS.md
  • docs/reference/variables/LINUX_MODIFIER_LABELS.md
  • docs/reference/variables/MAC_MODIFIER_LABELS.md
  • docs/reference/variables/MAC_MODIFIER_SYMBOLS.md
  • docs/reference/variables/MODIFIER_ALIASES.md
  • docs/reference/variables/MODIFIER_KEYS.md
  • docs/reference/variables/MODIFIER_ORDER.md
  • docs/reference/variables/NAVIGATION_KEYS.md
  • docs/reference/variables/NUMBER_KEYS.md
  • docs/reference/variables/PUNCTUATION_CODE_MAP.md
  • docs/reference/variables/PUNCTUATION_KEYS.md
  • docs/reference/variables/PUNCTUATION_KEY_DISPLAY_LABELS.md
  • docs/reference/variables/WINDOWS_MODIFIER_LABELS.md
  • examples/angular/injectHeldKeys/src/app/app.component.html
  • examples/angular/injectHeldKeys/src/app/app.component.ts
  • examples/angular/injectHotkeyRecorder/src/app/shortcut-list-item.component.html
  • examples/angular/injectHotkeyRecorder/src/app/shortcut-list-item.component.ts
  • examples/angular/injectHotkeySequenceRecorder/src/app/shortcut-list-item.component.html
  • examples/angular/injectHotkeySequenceRecorder/src/app/shortcut-list-item.component.ts
  • examples/preact/useHeldKeys/src/index.tsx
  • examples/react/useHeldKeys/src/index.tsx
  • examples/solid/createHeldKeys/src/index.tsx
  • examples/svelte/get-held-keys/src/App.svelte
  • examples/vanilla/formatForDisplay/eslint.config.js
  • examples/vanilla/formatForDisplay/index.html
  • examples/vanilla/formatForDisplay/package.json
  • examples/vanilla/formatForDisplay/src/main.ts
  • examples/vanilla/formatForDisplay/src/styles.css
  • examples/vanilla/formatForDisplay/tsconfig.json
  • examples/vanilla/formatForDisplay/vite.config.ts
  • examples/vue/useHeldKeys/eslint.config.js
  • examples/vue/useHeldKeys/package.json
  • examples/vue/useHeldKeys/src/App.vue
  • examples/vue/useHotkey/eslint.config.js
  • examples/vue/useHotkey/package.json
  • examples/vue/useHotkeyRecorder/eslint.config.js
  • examples/vue/useHotkeyRecorder/package.json
  • examples/vue/useHotkeySequence/eslint.config.js
  • examples/vue/useHotkeySequence/package.json
  • examples/vue/useHotkeySequenceRecorder/eslint.config.js
  • examples/vue/useHotkeySequenceRecorder/package.json
  • examples/vue/useHotkeySequences/eslint.config.js
  • examples/vue/useHotkeySequences/package.json
  • examples/vue/useHotkeys/eslint.config.js
  • examples/vue/useHotkeys/package.json
  • examples/vue/useKeyhold/eslint.config.js
  • examples/vue/useKeyhold/package.json
  • packages/angular-hotkeys/README.md
  • packages/angular-hotkeys/src/injectHotkey.ts
  • packages/angular-hotkeys/src/injectHotkeys.ts
  • packages/hotkeys-devtools/README.md
  • packages/hotkeys-devtools/src/components/DetailsPanel.tsx
  • packages/hotkeys-devtools/src/components/HeldKeysTopbar.tsx
  • packages/hotkeys-devtools/src/styles/use-styles.ts
  • packages/hotkeys/README.md
  • packages/hotkeys/src/constants.ts
  • packages/hotkeys/src/format.ts
  • packages/hotkeys/src/hotkey.ts
  • packages/hotkeys/src/parse.ts
  • packages/hotkeys/src/recorder-chord.ts
  • packages/hotkeys/src/sequence-manager.ts
  • packages/hotkeys/tests/format.test.ts
  • packages/hotkeys/tests/parse.test.ts
  • packages/preact-hotkeys-devtools/README.md
  • packages/preact-hotkeys/README.md
  • packages/preact-hotkeys/src/useHotkey.ts
  • packages/preact-hotkeys/src/useHotkeys.ts
  • packages/react-hotkeys-devtools/README.md
  • packages/react-hotkeys/README.md
  • packages/react-hotkeys/src/useHotkey.ts
  • packages/react-hotkeys/src/useHotkeys.ts
  • packages/solid-hotkeys-devtools/README.md
  • packages/solid-hotkeys/README.md
  • packages/solid-hotkeys/src/createHotkey.ts
  • packages/solid-hotkeys/src/createHotkeys.ts
  • packages/svelte-hotkeys/README.md
  • packages/svelte-hotkeys/src/createHotkey.svelte.ts
  • packages/svelte-hotkeys/src/createHotkeys.svelte.ts
  • packages/vue-hotkeys-devtools/README.md
  • packages/vue-hotkeys/README.md
  • packages/vue-hotkeys/src/useHotkey.ts
  • packages/vue-hotkeys/src/useHotkeys.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch normalize

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 26, 2026

Open in StackBlitz

@tanstack/angular-hotkeys

npm i https://pkg.pr.new/@tanstack/angular-hotkeys@85

@tanstack/hotkeys

npm i https://pkg.pr.new/@tanstack/hotkeys@85

@tanstack/hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/hotkeys-devtools@85

@tanstack/preact-hotkeys

npm i https://pkg.pr.new/@tanstack/preact-hotkeys@85

@tanstack/preact-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/preact-hotkeys-devtools@85

@tanstack/react-hotkeys

npm i https://pkg.pr.new/@tanstack/react-hotkeys@85

@tanstack/react-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/react-hotkeys-devtools@85

@tanstack/solid-hotkeys

npm i https://pkg.pr.new/@tanstack/solid-hotkeys@85

@tanstack/solid-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/solid-hotkeys-devtools@85

@tanstack/svelte-hotkeys

npm i https://pkg.pr.new/@tanstack/svelte-hotkeys@85

@tanstack/vue-hotkeys

npm i https://pkg.pr.new/@tanstack/vue-hotkeys@85

@tanstack/vue-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/vue-hotkeys-devtools@85

commit: 46caf9d

@github-actions
Copy link
Contributor

github-actions bot commented Mar 26, 2026

🚀 Changeset Version Preview

12 package(s) bumped directly, 0 bumped as dependents.

🟥 Major bumps

Package Version Reason
@tanstack/hotkeys-devtools 0.5.0 → 1.0.0 Changeset

🟨 Minor bumps

Package Version Reason
@tanstack/angular-hotkeys 0.7.0 → 0.8.0 Changeset
@tanstack/hotkeys 0.5.0 → 0.6.0 Changeset
@tanstack/preact-hotkeys 0.7.0 → 0.8.0 Changeset
@tanstack/preact-hotkeys-devtools 0.5.0 → 0.6.0 Changeset
@tanstack/react-hotkeys 0.7.0 → 0.8.0 Changeset
@tanstack/react-hotkeys-devtools 0.5.0 → 0.6.0 Changeset
@tanstack/solid-hotkeys 0.7.0 → 0.8.0 Changeset
@tanstack/solid-hotkeys-devtools 0.5.0 → 0.6.0 Changeset
@tanstack/svelte-hotkeys 0.7.0 → 0.8.0 Changeset
@tanstack/vue-hotkeys 0.7.0 → 0.8.0 Changeset
@tanstack/vue-hotkeys-devtools 0.5.0 → 0.6.0 Changeset

@KevinVandy KevinVandy merged commit 74b474d into main Mar 26, 2026
6 checks passed
@KevinVandy KevinVandy deleted the normalize branch March 26, 2026 13:21
@github-actions github-actions bot mentioned this pull request Mar 26, 2026
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