{"id":17344401,"url":"https://github.com/ivteplo/animated-keyboard-shortcuts","last_synced_at":"2026-05-03T19:33:06.233Z","repository":{"id":57700680,"uuid":"504268300","full_name":"ivteplo/animated-keyboard-shortcuts","owner":"ivteplo","description":"Make keyboard shortcut keys look pressed on a corresponding user input","archived":false,"fork":false,"pushed_at":"2022-06-17T16:14:14.000Z","size":241,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T09:49:29.928Z","etag":null,"topics":["animation","animations","html5","subtle-animations","ui","ui-ux","ux"],"latest_commit_sha":null,"homepage":"https://ivteplo.github.io/animated-keyboard-shortcuts","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivteplo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-16T18:41:45.000Z","updated_at":"2023-07-22T15:28:10.000Z","dependencies_parsed_at":"2022-09-26T21:11:49.208Z","dependency_job_id":null,"html_url":"https://github.com/ivteplo/animated-keyboard-shortcuts","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ivteplo/animated-keyboard-shortcuts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivteplo%2Fanimated-keyboard-shortcuts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivteplo%2Fanimated-keyboard-shortcuts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivteplo%2Fanimated-keyboard-shortcuts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivteplo%2Fanimated-keyboard-shortcuts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivteplo","download_url":"https://codeload.github.com/ivteplo/animated-keyboard-shortcuts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivteplo%2Fanimated-keyboard-shortcuts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32582693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","animations","html5","subtle-animations","ui","ui-ux","ux"],"created_at":"2024-10-15T16:25:10.559Z","updated_at":"2026-05-03T19:33:06.202Z","avatar_url":"https://github.com/ivteplo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Animated keyboard shortcuts\nMake keyboard shortcut keys look pressed when a user presses a corresponding key.\n\n![Preview of the result](preview.gif)\n\n## Installation\n\n```bash\nnpm install animated-keyboard-shortcuts --save\n# or:\nyarn add animated-keyboard-shortcuts\n```\n\n## Usage\n\n### Basic example\n\n```html\n\u003ckbd\u003e\n  \u003ckbd\u003eCtrl\u003c/kbd\u003e\n  +\n  \u003ckbd\u003eShift\u003c/kbd\u003e\n  +\n  \u003ckbd\u003eF\u003c/kbd\u003e\n\u003c/kbd\u003e\n```\n\n```javascript\nimport { registerElement } from \"animated-keyboard-shortcuts\"\n\nconst keys = document.querySelectorAll(\"kbd \u003e kbd\")\n\nfor (const key of keys) {\n  registerElement(key)\n}\n```\n\n```css\n/* Styles for a pressed key */\nkbd \u003e kbd.pressed {\n  /* ... */\n}\n```\n\n## API\n\n- `registerElement(element: HTMLElement): void`\n\n  Specify that the element should get a CSS class `pressed` when a certain key is pressed.\n\n  If the passed element has an attribute `data-key-name`, then its value will be used as the key name.\n\n  Else if the element has some text inside, then that text will be used as a key name.\n\n  Else `RegistrationError` will be thrown.\n\n- `RegistrationError extends Error`\n\n  This is the error, thrown by `registerElement`.\n\n  Properties:\n  - same properties as in the `Error` class\n  - `element: HTMLElement` - the element that caused the error\n\n- `addEventListeners(): void`\n\n  This is a function that sets up event listeners for `keydown` and `keyup` events.\n\n  You don't have to call it manually, because `registerElement` calls it when needed.\n\n- `removeEventListeners(): void`\n\n  This is a function to remove event listeners for `keydown` and `keyup` events.\n\n## Development\n\n### Prerequisites\n\nThis project works directly in the browser without any additional build steps.\n\n### Setup\n\n1. Clone the repository\n\n```bash\ngit clone https://github.com/ivteplo/animated-keyboard-shortcuts\n```\n\n2. Navigate into the cloned folder\n\n```bash\ncd animated-keyboard-shortcuts\n```\n\n3. Open `index.html` in the browser\n\n4. Happy hacking! 🎉\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivteplo%2Fanimated-keyboard-shortcuts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivteplo%2Fanimated-keyboard-shortcuts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivteplo%2Fanimated-keyboard-shortcuts/lists"}