-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36c5fbf
commit f98ea1b
Showing
12 changed files
with
163 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<script> | ||
let isMac = navigator.userAgent.indexOf('Mac OS X') !== -1 | ||
let KeyDisplay = isMac | ||
? { | ||
ArrowUp: '↑', | ||
ArrowDown: '↓', | ||
ArrowLeft: '←', | ||
ArrowRight: '→', | ||
Home: '↖', | ||
End: '↘', | ||
Alt: '⌥', | ||
CapsLock: '⇪', | ||
Meta: '⌘', | ||
Shift: '⇧', | ||
Control: '⌃', | ||
Backspace: '⌫', | ||
Delete: '⌦', | ||
Enter: '↵', | ||
Escape: '⎋', | ||
Tab: '⇥', | ||
ShiftTab: '⇤', | ||
PageUp: '⇞', | ||
PageDown: '⇟', | ||
' ': '␣', | ||
} | ||
: { | ||
ArrowUp: '↑', | ||
ArrowDown: '↓', | ||
ArrowLeft: '←', | ||
ArrowRight: '→', | ||
Meta: 'Win', | ||
Control: 'Ctrl', | ||
Backspace: '⌫', | ||
Delete: 'Del', | ||
Escape: 'Esc', | ||
PageUp: 'PgUp', | ||
PageDown: 'PgDn', | ||
' ': '␣', | ||
} | ||
|
||
function setupKeyCasterData() { | ||
let keys = [] | ||
return { | ||
keys, | ||
onKeyDown(event) { | ||
this.keys.unshift( | ||
event.shiftKey && event.key !== 'Shift' | ||
? KeyDisplay[`Shift${event.key}`] || event.key | ||
: KeyDisplay[event.key] || event.key | ||
) | ||
setTimeout(() => this.keys.pop(), 2000) | ||
} | ||
} | ||
} | ||
</script> | ||
<template x-component:app.unwrap="key-caster" x-data="setupKeyCasterData()" @keydown.window="onKeyDown($event)"> | ||
<div class="pointer-events-none fixed right-4 bottom-68 z-50 cursor-default select-none overflow-hidden rounded-md bg-blue-800 px-4 py-2 text-2xl tracking-wide text-blue-100 shadow" | ||
x-show="keys.length > 0"> | ||
<span x-text="keys.slice().reverse().join(' ')"></span> | ||
</div> | ||
</template> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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