├── .github └── workflows │ └── node.js.yml ├── CODEOWNERS ├── LICENSE ├── README.md ├── bower.json ├── generate.js ├── package.json ├── readme.head.md └── readme.tail.md /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | name: Update data 2 | 3 | on: 4 | schedule: 5 | - cron: "0 8 * * *" 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Generate data 15 | uses: actions/setup-node@v1 16 | with: 17 | node-version: 15.x 18 | - run: node generate.js 19 | env: 20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 21 | - name: Commit & Push Generated Data 22 | run: | 23 | git config --local user.email "actions@github.com" 24 | git config --local user.name "Actions Auto Build" 25 | git add -f . 26 | git commit -m "docs: generate documents" || true 27 | git push --force origin HEAD:refs/heads/main 28 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @github/primer-reviewers 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 GitHub 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # github-elements 2 | 3 | GitHub's Web Component collection. 4 | 5 | We have 17 open source custom elements: 6 | 7 | ### [github/auto-check-element](https://github.com/github/auto-check-element) 8 | 9 | An input element that validates its value with a server endpoint. 10 | 11 | [Repository](https://github.com/github/auto-check-element) | [Example](https://github.github.com/auto-check-element/examples/) 12 | 13 | ### [github/auto-complete-element](https://github.com/github/auto-complete-element) 14 | 15 | Auto-complete input values from server search results. 16 | 17 | [Repository](https://github.com/github/auto-complete-element) | [Example](https://github.github.com/auto-complete-element/examples/) 18 | 19 | ### [github/clipboard-copy-element](https://github.com/github/clipboard-copy-element) 20 | 21 | Copy element text content or input values to the clipboard. 22 | 23 | [Repository](https://github.com/github/clipboard-copy-element) | [Example](https://github.github.io/clipboard-copy-element/examples/) 24 | 25 | ### [github/details-dialog-element](https://github.com/github/details-dialog-element) 26 | 27 | A modal dialog that's opened with <details>. 28 | 29 | [Repository](https://github.com/github/details-dialog-element) | [Example](https://github.github.io/details-dialog-element/example/index.html) 30 | 31 | ### [github/details-menu-element](https://github.com/github/details-menu-element) 32 | 33 | A menu opened with <details>. 34 | 35 | [Repository](https://github.com/github/details-menu-element) | [Example](https://github.github.io/details-menu-element/examples) 36 | 37 | ### [github/file-attachment-element](https://github.com/github/file-attachment-element) 38 | 39 | Attach files via drag and drop or file input. 40 | 41 | [Repository](https://github.com/github/file-attachment-element) | [Example](https://github.github.com/file-attachment-element/examples/) 42 | 43 | ### [github/filter-input-element](https://github.com/github/filter-input-element) 44 | 45 | Display elements in a subtree that match filter input text. 46 | 47 | [Repository](https://github.com/github/filter-input-element) | [Example](https://github.github.io/filter-input-element/examples/) 48 | 49 | ### [github/g-emoji-element](https://github.com/github/g-emoji-element) 50 | 51 | Backports native emoji characters to browsers that don't support them by replacing the characters with fallback images. 52 | 53 | [Repository](https://github.com/github/g-emoji-element) | [Example](https://github.github.io/g-emoji-element/examples/) 54 | 55 | ### [github/image-crop-element](https://github.com/github/image-crop-element) 56 | 57 | A custom element for cropping a square image. Returns x, y, width, and height. 58 | 59 | [Repository](https://github.com/github/image-crop-element) | [Example](https://github.github.io/image-crop-element/examples/) 60 | 61 | ### [github/include-fragment-element](https://github.com/github/include-fragment-element) 62 | 63 | A client-side includes tag. 64 | 65 | [Repository](https://github.com/github/include-fragment-element) | [Example](https://github.github.io/include-fragment-element/examples) 66 | 67 | ### [github/markdown-toolbar-element](https://github.com/github/markdown-toolbar-element) 68 | 69 | Markdown formatting buttons for text inputs. 70 | 71 | [Repository](https://github.com/github/markdown-toolbar-element) | [Example](https://github.github.com/markdown-toolbar-element/examples/) 72 | 73 | ### [github/relative-time-element](https://github.com/github/relative-time-element) 74 | 75 | Web component extensions to the standard <time> element. 76 | 77 | [Repository](https://github.com/github/relative-time-element) | [Example](https://github.github.io/relative-time-element/examples/) 78 | 79 | ### [github/remote-input-element](https://github.com/github/remote-input-element) 80 | 81 | An input element that sends its value to a server endpoint and renders the response body. 82 | 83 | [Repository](https://github.com/github/remote-input-element) | [Example](https://github.github.io/remote-input-element/examples) 84 | 85 | ### [github/tab-container-element](https://github.com/github/tab-container-element) 86 | 87 | An accessible tab container element with keyboard support. 88 | 89 | [Repository](https://github.com/github/tab-container-element) | [Example](https://github.github.com/tab-container-element/examples/) 90 | 91 | ### [github/task-lists-element](https://github.com/github/task-lists-element) 92 | 93 | Drag and drop task list items. 94 | 95 | [Repository](https://github.com/github/task-lists-element) | [Example](https://github.github.io/task-lists-element/examples/) 96 | 97 | ### [github/text-expander-element](https://github.com/github/text-expander-element) 98 | 99 | Activates a suggestion menu to expand text snippets as you type. 100 | 101 | [Repository](https://github.com/github/text-expander-element) | [Example](http://github.github.io/text-expander-element/examples) 102 | 103 | ### [github/typing-effect-element](https://github.com/github/typing-effect-element) 104 | 105 | A custom element that shows text as if it were being typed 106 | 107 | [Repository](https://github.com/github/typing-effect-element) | [Example](https://github.github.com/typing-effect-element/examples/) 108 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "github-elements", 3 | "authors": [ 4 | "GitHub" 5 | ], 6 | "keywords": [ 7 | "element-collection" 8 | ], 9 | "license": "MIT", 10 | "dependencies": { 11 | "auto-check-element": "github/auto-check-element", 12 | "auto-complete-element": "github/auto-complete-element", 13 | "clipboard-copy-element": "github/clipboard-copy-element", 14 | "details-dialog-element": "github/details-dialog-element", 15 | "details-menu-element": "github/details-menu-element", 16 | "file-attachment-element": "github/file-attachment-element", 17 | "filter-input-element": "github/filter-input-element", 18 | "g-emoji-element": "github/g-emoji-element", 19 | "image-crop-element": "github/image-crop-element", 20 | "include-fragment-element": "github/include-fragment-element", 21 | "markdown-toolbar-element": "github/markdown-toolbar-element", 22 | "relative-time-element": "github/relative-time-element", 23 | "remote-input-element": "github/remote-input-element", 24 | "tab-container-element": "github/tab-container-element", 25 | "task-lists-element": "github/task-lists-element", 26 | "text-expander-element": "github/text-expander-element", 27 | "typing-effect-element": "github/typing-effect-element" 28 | } 29 | } -------------------------------------------------------------------------------- /generate.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import {request} from 'https' 3 | import {readFileSync, writeFileSync} from 'fs' 4 | const escapeMap = { 5 | '&': '&', 6 | '<': '<', 7 | '>': '>', 8 | "'": ''', 9 | '"': '&#quot;', 10 | } 11 | function escape(str) { 12 | let newStr = '' 13 | for(const char of str) newStr += char in escapeMap ? escapeMap[char] : char 14 | return newStr 15 | } 16 | 17 | function json(url) { 18 | return new Promise((resolve, reject) => { 19 | if (!process.env['GITHUB_TOKEN']) { 20 | return reject(new Error('GITHUB_TOKEN is not defined')) 21 | } 22 | 23 | const req = request(url, { 24 | headers: { 25 | 'User-Agent': `nodejs ${process.version}`, 26 | 'Authorization': `Bearer ${process.env['GITHUB_TOKEN']}`, 27 | 'Accept': 'application/vnd.github.mercy-preview+json' 28 | } 29 | }, async res => { 30 | res.on('error', reject) 31 | let body = '' 32 | for await (const chunk of res) { 33 | body += chunk 34 | } 35 | resolve(JSON.parse(body)) 36 | }) 37 | req.on('error', reject) 38 | req.end() 39 | }) 40 | } 41 | 42 | async function *getRepos() { 43 | for(let page = 1; page < 1000; page += 1) { 44 | const repos = await json(`https://api.github.com/orgs/github/repos?type=public&per_page=100&page=${page}`) 45 | if (!repos.length) return 46 | for (const repo of repos) { 47 | if (!repo.topics) continue 48 | if (repo.private) continue 49 | if (repo.fork) continue 50 | if (!repo.topics.includes('web-components')) continue 51 | if (!repo.topics.includes('custom-elements')) continue 52 | yield repo 53 | } 54 | } 55 | } 56 | 57 | let readme = readFileSync('readme.head.md', 'utf-8') 58 | const bowerJson = JSON.parse(readFileSync('bower.json', 'utf-8')) 59 | bowerJson.dependencies = {} 60 | const packageJson = JSON.parse(readFileSync('package.json', 'utf-8')) 61 | packageJson.dependencies = {} 62 | let repos = [] 63 | for await (const repo of getRepos()) { 64 | if (repo.full_name === 'github/custom-element-boilerplate') continue 65 | repos.push(repo) 66 | } 67 | repos.sort((a, b) => a.full_name.localeCompare(b.full_name)) 68 | readme += ` 69 | We have ${repos.length} open source custom elements: 70 | ` 71 | for (const repo of repos) { 72 | bowerJson.dependencies[repo.name] = repo.full_name 73 | packageJson.dependencies[`@${repo.full_name}`] = '*' 74 | let exampleLink = ''; 75 | if (repo.homepage) { 76 | exampleLink = ` | [Example](${repo.homepage})` 77 | } 78 | readme += ` 79 | ### [${escape(repo.full_name)}](${repo.html_url}) 80 | 81 | ${escape(repo.description)} 82 | 83 | [Repository](${repo.html_url})${exampleLink} 84 | ` 85 | } 86 | readme += readFileSync('readme.tail.md', 'utf-8') 87 | writeFileSync('README.md', readme) 88 | writeFileSync('bower.json', JSON.stringify(bowerJson, null, 2)) 89 | writeFileSync('package.json', JSON.stringify(packageJson, null, 2)) 90 | 91 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "github-elements", 3 | "private": true, 4 | "description": "GitHub's Web Component collection.", 5 | "keywords": [ 6 | "element-collection" 7 | ], 8 | "repository": { 9 | "type": "git", 10 | "url": "git+https://github.com/github/github-elements.git" 11 | }, 12 | "license": "MIT", 13 | "type": "module", 14 | "main": "", 15 | "scripts": { 16 | "generate": "node generate.js" 17 | }, 18 | "dependencies": { 19 | "@github/auto-check-element": "*", 20 | "@github/auto-complete-element": "*", 21 | "@github/clipboard-copy-element": "*", 22 | "@github/details-dialog-element": "*", 23 | "@github/details-menu-element": "*", 24 | "@github/file-attachment-element": "*", 25 | "@github/filter-input-element": "*", 26 | "@github/g-emoji-element": "*", 27 | "@github/image-crop-element": "*", 28 | "@github/include-fragment-element": "*", 29 | "@github/markdown-toolbar-element": "*", 30 | "@github/relative-time-element": "*", 31 | "@github/remote-input-element": "*", 32 | "@github/tab-container-element": "*", 33 | "@github/task-lists-element": "*", 34 | "@github/text-expander-element": "*", 35 | "@github/typing-effect-element": "*" 36 | } 37 | } -------------------------------------------------------------------------------- /readme.head.md: -------------------------------------------------------------------------------- 1 | # github-elements 2 | 3 | GitHub's Web Component collection. 4 | -------------------------------------------------------------------------------- /readme.tail.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/github/github-elements/b2ffb62d5f958a96c03be64b4f8482be3a5f99b5/readme.tail.md --------------------------------------------------------------------------------