{"id":15657585,"url":"https://github.com/just-be-dev/vue-context-api","last_synced_at":"2026-04-04T07:05:11.143Z","repository":{"id":57395404,"uuid":"133201486","full_name":"zephraph/vue-context-api","owner":"zephraph","description":"A react-like context component api for Vue.js","archived":false,"fork":false,"pushed_at":"2018-05-22T06:27:23.000Z","size":76,"stargazers_count":23,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-10T03:07:23.880Z","etag":null,"topics":["component","context","context-api","inject","provide","vue","vuejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/zephraph.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-05-13T03:09:56.000Z","updated_at":"2024-02-05T14:08:33.000Z","dependencies_parsed_at":"2022-09-05T07:30:26.832Z","dependency_job_id":null,"html_url":"https://github.com/zephraph/vue-context-api","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/zephraph/vue-context-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fvue-context-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fvue-context-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fvue-context-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fvue-context-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zephraph","download_url":"https://codeload.github.com/zephraph/vue-context-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fvue-context-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280706800,"owners_count":26376971,"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","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["component","context","context-api","inject","provide","vue","vuejs"],"created_at":"2024-10-03T13:08:37.341Z","updated_at":"2026-04-04T07:05:11.092Z","avatar_url":"https://github.com/zephraph.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-context-api\n\nA react-like context component api for Vue.js\n\n## Installation\n\n```\nnpm install --save vue-context-api\n```\n\nor\n\n```\nyarn add vue-context-api\n```\n\n## Example Usage\n\nSee a [live example](https://codesandbox.io/s/nrjz7ky4mp).\n\n**ThemeContext.js**\n\n```javascript\nimport { createContext } from \"vue-context-api\";\n\n// The argument passed to createContext is the default context value\nexport const { Provider, Consumer } = createContext(\"light\");\n```\n\n**App.vue**\n\n```html\n\u003ctemplate\u003e\n  \u003c!-- value can be reactive. Overrides the default value passed into createContext --\u003e\n  \u003cThemeProvider value=\"dark\"\u003e\n    \u003cThemedButton/\u003e\n  \u003c/ThemeProvider\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport ThemedButton from \"./ThemedButton\";\nimport { Provider as ThemeProvider } from \"./ThemeContext\";\n\nexport default {\n  components: {\n    ThemedButton,\n    ThemeProvider\n  }\n};\n\u003c/script\u003e\n```\n\n**ThemedButton.vue**\n\n```html\n\u003ctemplate\u003e\n  \u003cThemeConsumer\u003e\n    \u003cbutton slot-scope=\"theme\" :style=\"setTheme(theme)\"/\u003e\n  \u003c/ThemeConsumer\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport { Consumer as ThemeConsumer } from \"./ThemeContext\";\n\nexport default {\n  components: {\n    ThemeConsumer\n  },\n  methods: {\n    setTheme(theme) {\n      return theme === 'light'\n        ? 'background-color: white'\n        : 'background-color: black'\n    }\n  }\n}\n\u003c/script\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjust-be-dev%2Fvue-context-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjust-be-dev%2Fvue-context-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjust-be-dev%2Fvue-context-api/lists"}