{"id":18378281,"url":"https://github.com/tyom/head-up","last_synced_at":"2025-04-11T08:23:46.443Z","repository":{"id":144815234,"uuid":"158690010","full_name":"tyom/head-up","owner":"tyom","description":"Declarative dashboard system","archived":false,"fork":false,"pushed_at":"2022-07-31T16:15:55.000Z","size":1081,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T22:42:25.022Z","etag":null,"topics":["vue","vuex"],"latest_commit_sha":null,"homepage":"https://head-up-example.now.sh","language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tyom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-22T11:33:59.000Z","updated_at":"2019-01-28T21:33:10.000Z","dependencies_parsed_at":"2024-06-17T04:15:56.510Z","dependency_job_id":null,"html_url":"https://github.com/tyom/head-up","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyom%2Fhead-up","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyom%2Fhead-up/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyom%2Fhead-up/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyom%2Fhead-up/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyom","download_url":"https://codeload.github.com/tyom/head-up/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248361050,"owners_count":21090807,"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":["vue","vuex"],"created_at":"2024-11-06T00:32:44.272Z","updated_at":"2025-04-11T08:23:46.420Z","avatar_url":"https://github.com/tyom.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Head-up dashboard system\n\n[![CircleCI](https://circleci.com/gh/tyom/head-up.svg?style=svg)](https://circleci.com/gh/tyom/head-up)\n\nHead-up is a Vue plugin which allows to declaratively create multiple boards (containers) containing\ncells (sections) laid out within each board. Each cell can have any content and each child of Cell component\nwill become a sub-section, which further allows to divide the board into additional sections.\n\n## Usage\n\nSee the [example app](./packages/example) for usage.\n\n## Exposing data\n\nVarious components take advantage of Vue's [scoped slots](https://vuejs.org/v2/guide/components-slots.html#Scoped-Slots). This allows us to share data from a component with its parent.\n\nFor example, `VList` takes `items` array prop which contains a list of movies with titles, ratings, images etc. `Vlist` loops through this array and applies the data of each item to inner component that is passed through default scope. It then exposes each list item in destructured `{item}` slot scope.\n\nThe following code:\n\n```vue\n\u003cVList :items=\"[\n  { title: 'Bumblebee', rating: 6.5 },\n  { title: 'Aquaman', rating: 6.9 },\n]\"\u003e\n  \u003cdiv class=\"movie\" slot-scope={item}\u003e\n    \u003ch2\u003e{{ item.title }}\u003c/h2\u003e\n    \u003cp\u003eRating: {{ item.rating }}\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/VList\u003e\n```\n\nWill produce:\n\n```html\n\u003cdiv class=\"VList\"\u003e\n  \u003cul\u003e\n    \u003cli\u003e\n      \u003cdiv class=\"movie\"\u003e\n        \u003ch2\u003eBumblebee\u003c/h2\u003e\n        \u003cp\u003eRating: 6.5\u003c/p\u003e\n      \u003c/div\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003cdiv class=\"movie\"\u003e\n        \u003ch2\u003eAquaman\u003c/h2\u003e\n        \u003cp\u003eRating: 6.9\u003c/p\u003e\n      \u003c/div\u003e\n    \u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/div\u003e\n```\n\nThe same techniqus is used in other components that may want to expose internal data\nto parent. Such as results of a request to an external API.\n\n## Making requests\n\n### `VPoller` component\n\nThis component makes requests with interval (polling). It requires `endpoint` and\n`interval` props to be set. `interval` is a human-readable string and can be\nset as `30m` or `30 mins` or `30 minutes` etc. It's parsed using [parse-duration](https://www.npmjs.com/package/parse-duration) package.\n\nThe component also allows making multiple requests at once, which\nthen become available in destructured slot prop `{result}` as array in the same\norder they are defined. This could be useful if you wish to combine results of\nseveral requests into one component.\n\n#### Simple request\n\n```vue\n\u003cVPoller\n  endpoint=\"https://api.themoviedb.org/3/discover/movie\"\n  :query=\"{api_key: tmdbApiKey}\"\n  interval=\"30m\"\n/\u003e\n```\n\nThis makes request to the specified endpoint with the query `?api_key=\u003ctmdbApiKey\u003e` which is set on component instance (data method). It will\nkeep making requests every 30 mins indefinitely. The result are exposed in `result` slot scope.\n\n```vue\n\u003ctemplate slot-scope=\"slot\"\u003e\n  \u003cpre\u003e{{ slot.result }}\u003c/pre\u003e\n\u003c/template\u003e\n```\n\nor simply destructure it:\n\n```vue\n\u003ctemplate slot-scope=\"{result}\"\u003e\n  \u003cpre\u003e{{ result }}\u003c/pre\u003e\n\u003c/template\u003e\n```\n\n#### Multiple requests\n\nThe `requests` share the `endpoint` (prefix) and `query` (suffix).\n\n```vue\n\u003cVPoller\n  endpoint=\"https://api.themoviedb.org/3/discover\"\n  :requests=\"['/movie', '/tv']\"\n  :query=\"{api_key: tmdbApiKey}\"\n  interval=\"30m\"\n/\u003e\n```\n\nThis will use the `endpoint` prop to prefix each request in `requests` and add\n`query` to each request.\n\nTo make multiple requests with different queries:\n\n```vue\n\u003cVPoller\n  endpoint=\"https://api.themoviedb.org/3/discover\"\n  :requests=\"[\n    {\n      path: '/movie',\n      query: {sort_by: 'vote_average.desc'}\n    }, {\n      path: '/tv',\n      query: {include_adult: 'true'}\n    }\n  ]\"\n  :query=\"{api_key: tmdbApiKey}\"\n  interval=\"30m\"\n/\u003e\n```\n\nThis will do the same but merge the `query` prop with individual request's `path`. \n\n### `VSocket` component\n\nThis component is used to make WebSocket connections. Message data is exposed to\nparent component via `{result}` slot prop.\n\nIt also has `@open` event which can be used to send requests.\n\n```vue\n\u003cVSocket\n  endpoint=\"wss://api.hitbtc.com/api/2/ws\"\n  @open=\"$event.send(JSON.stringify({\n    method: 'subscribeTicker',\n    params: { symbol: 'BTCUSD' },\n  }))\"\n\u003e\n  \u003cpre slot-scope=\"{result}\"\u003e\n    {{ result.params.last }}\n  \u003c/pre\u003e\n\u003c/VSocket\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyom%2Fhead-up","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyom%2Fhead-up","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyom%2Fhead-up/lists"}