{"id":18376844,"url":"https://github.com/bbc/lrud","last_synced_at":"2025-04-06T13:09:59.498Z","repository":{"id":32951348,"uuid":"142445449","full_name":"bbc/lrud","owner":"bbc","description":"Left, Right, Up, Down. A spatial navigation library for devices with input via directional controls.","archived":false,"fork":false,"pushed_at":"2023-07-19T03:00:09.000Z","size":8734,"stargazers_count":97,"open_issues_count":19,"forks_count":23,"subscribers_count":55,"default_branch":"master","last_synced_at":"2025-03-30T10:09:36.142Z","etag":null,"topics":["bbc","lrud","remote-control","spatial-navigation-library","tv","tv-navigation","tv-remote-control"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/bbc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-26T13:33:47.000Z","updated_at":"2025-03-17T10:38:47.000Z","dependencies_parsed_at":"2024-06-18T21:32:03.753Z","dependency_job_id":"6568e5ac-152f-46b7-ab56-20400fe510f7","html_url":"https://github.com/bbc/lrud","commit_stats":{"total_commits":459,"total_committers":22,"mean_commits":"20.863636363636363","dds":0.6318082788671024,"last_synced_commit":"cee46d51983adbb27b32c4935aef7af8c4e202e1"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Flrud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Flrud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Flrud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Flrud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbc","download_url":"https://codeload.github.com/bbc/lrud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247485287,"owners_count":20946398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bbc","lrud","remote-control","spatial-navigation-library","tv","tv-navigation","tv-remote-control"],"created_at":"2024-11-06T00:25:04.257Z","updated_at":"2025-04-06T13:09:59.477Z","avatar_url":"https://github.com/bbc.png","language":"JavaScript","readme":"# LRUD ![Build Status](https://github.com/bbc/lrud/actions/workflows/github-actions.yml/badge.svg?branch=master)\n\nA spatial navigation library for devices with input via directional controls\n\n## :nut_and_bolt: Maintenance Mode :nut_and_bolt:\nLRUD is now in maintenance mode; existing bugs will be fixed, but new features will not be added. A new library called [LRUD Spatial](https://github.com/bbc/lrud-spatial) is now available to the Open Source community. \n\n## Upgrading from V2\n\n**v3 is a major rewrite, covering many new features. However, it unfortunately breaks some backwards compatibility.**\n\nWe are currently in the process of writing more detailed docs for an upgrade process. However, the main things to note at the minute at;\n\n- changes in events, which ones are emitted and what they are emitted with\n- removal of `grid` in favour of `isIndexAligned` behaviour\n\n## Getting Started\n\n```bash\ngit clone git@github.com:bbc/lrud.git lrud\ncd lrud\nnpm install\n```\n\nLrud is written in [Typescript](https://www.typescriptlang.org/) and makes use of [mitt](https://github.com/developit/mitt).\n\n## Usage\n\n```bash\nnpm install lrud\n```\n\n```js\nconst { Lrud } = require('Lrud')\n\n// create an instance, register some nodes and assign a default focus\nvar navigation = new Lrud()\nnavigation\n  .registerNode('root', { orientation: 'vertical' })\n  .registerNode('item-a', { parent: 'root', isFocusable: true })\n  .registerNode('item-b', { parent: 'root', isFocusable: true })\n  .assignFocus('item-a')\n\n// handle a key event\ndocument.addEventListener('keypress', (event) =\u003e {\n  navigation.handleKeyEvent(event)\n});\n\n// Lrud will output an event when it handles a move\nnavigation.on('move', (moveEvent) =\u003e {\n  myApp.doSomethingOnNodeFocus(moveEvent.enter)\n})\n```\n\nSee [usage docs](./docs/usage.md) for details full API details.\n\nFor more \"full\" examples, covering common use cases, check [the recipes](./docs/recipes.md)\n\n## Running the tests\n\nAll code is written in Typescript, so we make use of a `tsconfig.json` and `jest.config.js` to ensure tests run correctly.\n\nTest files are split up fairly arbitrarily, aiming to have larger sets of tests broken into their own file. \n\n```bash\nnpm test\n```\n\nTo run a specific test file, use `npx jest` from the project root.\n\n```bash\nnpx jest src/lrud.test.js\n```\n\nYou can also run all the tests with verbose output. This is useful for listing out test scenarios to ensure that behaviour is covered.\n\n```bash\nnpm run test:verbose\n```\n\nYou can also run all the tests with coverage output\n\n```bash\nnpm run test:coverage\n```\n\nSeveral of the tests have associated diagrams, in order to better explain what is being tested. These can be found in `./docs/test-diagrams`.\n\nWe also have a specific test file (`src/build.test.js`) in order to ensure that we haven't broken the Typescript/rollup.js build.\n\n## Versioning\n\n```bash\nnpm version \u003cpatch:minor:major\u003e\nnpm publish\n```\n\n## Built with\n\n- [Typescript](https://www.typescriptlang.org/)\n- [rollup.js](https://rollupjs.org/)\n- [mitt](https://github.com/developit/mitt)\n\n## Inspiration\n\n* [BBC - TV Application Layer (TAL)](http://bbc.github.io/tal/widgets/focus-management.html)\n* [Netflix - Pass the Remote](https://medium.com/netflix-techblog/pass-the-remote-user-input-on-tv-devices-923f6920c9a8)\n* [Mozilla - Implementing TV remote control navigation](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS_for_TV/TV_remote_control_navigation)\n\n## Alternatives\n\n* [tal](https://github.com/bbc/tal)\n* [react-tv-navigation](https://github.com/react-tv/react-tv-navigation)\n* [react-key-navigation](https://github.com/dead/react-key-navigation)\n* [js-spatial-navigation](https://github.com/luke-chang/js-spatial-navigation)\n\n# License\n\n\nLRUD is part of the BBC TAL libraries, and available to everyone under the terms of the Apache 2 open source licence (Apache-2.0). Take a look at the LICENSE file in the code.\n\nCopyright (c) 2018 BBC\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Flrud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbc%2Flrud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Flrud/lists"}