{"id":17967529,"url":"https://github.com/YunYouJun/wc-github-corners","last_synced_at":"2025-03-25T08:31:20.075Z","repository":{"id":104057937,"uuid":"410070811","full_name":"YunYouJun/wc-github-corners","owner":"YunYouJun","description":":octocat: A web component for github corners. Can be used anywhere.","archived":false,"fork":false,"pushed_at":"2024-02-12T12:45:00.000Z","size":118,"stargazers_count":44,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-17T17:03:28.252Z","etag":null,"topics":["github-corners","lit","web-components"],"latest_commit_sha":null,"homepage":"https://yunyoujun.github.io/wc-github-corners/","language":"TypeScript","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/YunYouJun.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,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["YunYouJun"]}},"created_at":"2021-09-24T18:52:59.000Z","updated_at":"2024-04-27T10:40:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"696181a1-5b82-41c8-93ff-18492ab2843b","html_url":"https://github.com/YunYouJun/wc-github-corners","commit_stats":{"total_commits":27,"total_committers":1,"mean_commits":27.0,"dds":0.0,"last_synced_commit":"64058e1f79208a6955571237fc67c4c39fd258c8"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YunYouJun%2Fwc-github-corners","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YunYouJun%2Fwc-github-corners/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YunYouJun%2Fwc-github-corners/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YunYouJun%2Fwc-github-corners/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YunYouJun","download_url":"https://codeload.github.com/YunYouJun/wc-github-corners/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245426249,"owners_count":20613316,"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":["github-corners","lit","web-components"],"created_at":"2024-10-29T14:09:04.093Z","updated_at":"2025-03-25T08:31:19.758Z","avatar_url":"https://github.com/YunYouJun.png","language":"TypeScript","funding_links":["https://github.com/sponsors/YunYouJun"],"categories":["TypeScript"],"sub_categories":[],"readme":"# wc-github-corners\n\n[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/wc-github-corners)\n[![npm](https://img.shields.io/npm/v/wc-github-corners)](https://www.npmjs.com/package/wc-github-corners)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/wc-github-corners)\n![jsDelivr hits (npm)](https://img.shields.io/jsdelivr/npm/hy/wc-github-corners)\n\n\u003e [从零开始写一个 Web Component - GitHub Corners | 云游君的小站](https://www.yunyoujun.cn/posts/how-to-write-a-web-component/)\n\nA web component by [lit](https://github.com/lit/lit) for [GitHub Corners](https://github.com/tholman/github-corners).\n\nThe final product is an ES module, and it can be used alone.\n\n\u003e Anywhere like Vanilla JS / Vue / React / Angular / Svelte ...\n\n[Demo](https://www.yunyoujun.cn/wc-github-corners/)\n\n\u003c!--\n```html\n\u003ccustom-element-demo\u003e\n  \u003ctemplate\u003e\n    \u003cscript\n      type=\"module\"\n      src=\"https://cdn.jsdelivr.net/npm/wc-github-corners@latest\"\n    \u003e\u003c/script\u003e\n    \u003clink rel=\"import\" href=\"github-corners.html\" /\u003e\n    \u003cgithub-corners\u003e\u003c/github-corners\u003e\n  \u003c/template\u003e\n\u003c/custom-element-demo\u003e\n```\n--\u003e\n\n## Usage\n\n```bash\nnpm i wc-github-corners\n```\n\n### By CDN\n\nSee [demo/index.html](./demo/index.html).\n\n- jsdelivr: `https://cdn.jsdelivr.net/npm/wc-github-corners@latest`\n- unpkg: `https://www.unpkg.com/wc-github-corners@latest`\n\n```html\n\u003c!-- cdn --\u003e\n\u003cscript\n  type=\"module\"\n  src=\"https://www.unpkg.com/wc-github-corners@latest\"\n\u003e\u003c/script\u003e\n\n\u003cgithub-corners\u003e\u003c/github-corners\u003e\n```\n\n### By NPM\n\n```ts\n// main.ts\nimport 'wc-github-corners'\n```\n\n```html\n\u003c!-- index.html --\u003e\n\u003cgithub-corners\u003e\u003c/github-corners\u003e\n\u003cgithub-corners repo=\"YunYouJun/wc-github-corners\" blank /\u003e\n```\n\nI successfully used it in a vue project - [char-dust](https://github.com/YunYouJun/char-dust).\n\n## API\n\n### Example\n\n```html\n\u003cgithub-corners fill=\"#0078e7\" position=\"left\" reverse\u003e\u003c/github-corners\u003e\n```\n\n\u003c!-- wc-api:start --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n### `src/index.ts`:\n\n#### class: `GitHubCorners`\n\n##### Superclass\n\n| Name         | Module | Package |\n| ------------ | ------ | ------- |\n| `LitElement` |        | lit     |\n\n##### Fields\n\n| Name       | Privacy | Type      | Default                         | Description                                                            | Inherited From |\n| ---------- | ------- | --------- | ------------------------------- | ---------------------------------------------------------------------- | -------------- |\n| `blank`    |         | `boolean` | `false`                         | target=\"\\_blank\" for link                                              |                |\n| `color`    |         | `string`  | `'#fff'`                        | Font color                                                             |                |\n| `fill`     |         | `string`  | `'#151513'`                     | Fill color for github corners                                          |                |\n| `repo`     |         | `string`  | `'YunYouJun/wc-github-corners'` | Your GitHub Repo Name, generate url start with \\\u003chttps\\://github.com\u003e. |                |\n| `url`      |         | `string`  | `''`                            | You also can custom it to override the url generated by repo.          |                |\n| `label`    |         | `string`  | `'View source on GitHub'`       | Hover title                                                            |                |\n| `reverse`  |         | `boolean` | `false`                         | Reverse color and fill                                                 |                |\n| `position` |         | `string`  | `'right'`                       | Position of github corners, 'left' or 'right'                          |                |\n\n\u003chr/\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- wc-api:end --\u003e\n\nI written it as a tutorial in my [Bilibili Live Room](https://live.bilibili.com/822719).\n\nThanks to my fans and [sponsors](https://sponsors.yunyoujun.cn/).\n\n## FAQ\n\n### [Vue warn]: Failed to resolve component: github-corners\n\nIf you write it in vue template, you should make sure to exclude it from component resolution via `compilerOptions.isCustomElement`.\n\nIn vite:\n\n```ts\nimport { defineConfig } from 'vite'\nimport Vue from '@vitejs/plugin-vue'\n\nexport default defineConfig({\n  plugins: [\n    Vue({\n      include: [/\\.vue$/, /\\.md$/],\n      template: {\n        compilerOptions: {\n          isCustomElement: (tag) =\u003e {\n            return ['github-corners'].includes(tag)\n          },\n        },\n      },\n    }),\n  ],\n})\n```\n\n### Want to use by CDN in vue?\n\nTry [@vueuse/head](https://github.com/vueuse/head).\n\n```html\n\u003cscript setup lang=\"ts\"\u003e\n  import { useHead } from \"@vueuse/head\";\n\n  useHead({\n    script: [\n      {\n        src: \"https://cdn.jsdelivr.net/npm/wc-github-corners@latest\",\n        type: \"module\",\n      },\n    ],\n  });\n\u003c/script\u003e\n```\n\n## [Sponsors](https://sponsors.yunyoujun.cn)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://sponsors.yunyoujun.cn\"\u003e\n    \u003cimg src='https://cdn.jsdelivr.net/gh/YunYouJun/sponsors/public/sponsors.svg'/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYunYouJun%2Fwc-github-corners","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYunYouJun%2Fwc-github-corners","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYunYouJun%2Fwc-github-corners/lists"}