Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9af34d5

Browse files
authored
Merge pull request#2 from github/add-generate-script
Add generate script
2 parents1cf5330 +54fb935 commit9af34d5

File tree

6 files changed

+221
-1
lines changed

6 files changed

+221
-1
lines changed

‎README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,101 @@
11
#github-elements
2+
23
GitHub's Web Component collection.
4+
5+
We have 16 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+
[Link](https://github.com/github/auto-check-element)
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+
[Link](https://github.com/github/auto-complete-element)
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+
[Link](https://github.com/github/clipboard-copy-element)
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+
[Link](https://github.com/github/details-dialog-element)
30+
31+
###[github/details-menu-element](https://github.com/github/details-menu-element)
32+
33+
A menu opened with<details>.
34+
35+
[Link](https://github.com/github/details-menu-element)
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+
[Link](https://github.com/github/file-attachment-element)
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+
[Link](https://github.com/github/filter-input-element)
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+
[Link](https://github.com/github/g-emoji-element)
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+
[Link](https://github.com/github/image-crop-element)
60+
61+
###[github/include-fragment-element](https://github.com/github/include-fragment-element)
62+
63+
A client-side includes tag.
64+
65+
[Link](https://github.com/github/include-fragment-element)
66+
67+
###[github/markdown-toolbar-element](https://github.com/github/markdown-toolbar-element)
68+
69+
Markdown formatting buttons for text inputs.
70+
71+
[Link](https://github.com/github/markdown-toolbar-element)
72+
73+
###[github/remote-input-element](https://github.com/github/remote-input-element)
74+
75+
An input element that sends its value to a server endpoint and renders the response body.
76+
77+
[Link](https://github.com/github/remote-input-element)
78+
79+
###[github/tab-container-element](https://github.com/github/tab-container-element)
80+
81+
An accessible tab container element with keyboard support.
82+
83+
[Link](https://github.com/github/tab-container-element)
84+
85+
###[github/task-lists-element](https://github.com/github/task-lists-element)
86+
87+
Drag and drop task list items.
88+
89+
[Link](https://github.com/github/task-lists-element)
90+
91+
###[github/text-expander-element](https://github.com/github/text-expander-element)
92+
93+
Activates a suggestion menu to expand text snippets as you type.
94+
95+
[Link](https://github.com/github/text-expander-element)
96+
97+
###[github/time-elements](https://github.com/github/time-elements)
98+
99+
Web component extensions to the standard<time> element.
100+
101+
[Link](https://github.com/github/time-elements)

‎bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
"remote-input-element":"github/remote-input-element",
2727
"time-elements":"github/time-elements"
2828
}
29-
}
29+
}

‎generate.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env node
2+
import{request}from'https'
3+
import{readFileSync,writeFileSync}from'fs'
4+
constescapeMap={
5+
'&':'&',
6+
'<':'&lt;',
7+
'>':'&gt;',
8+
"'":'&#39;',
9+
'"':'&#quot;',
10+
}
11+
functionescape(str){
12+
letnewStr=''
13+
for(constcharofstr)newStr+=charinescapeMap ?escapeMap[char] :char
14+
returnnewStr
15+
}
16+
17+
functionjson(url){
18+
returnnewPromise((resolve,reject)=>{
19+
constreq=request(url,{
20+
headers:{
21+
'User-Agent':`nodejs${process.version}`,
22+
'Authorization':`Bearer${process.env['GITHUB_TOKEN']}`,
23+
'Accept':'application/vnd.github.mercy-preview+json'
24+
}
25+
},asyncres=>{
26+
res.on('error',reject)
27+
letbody=''
28+
forawait(constchunkofres){
29+
body+=chunk
30+
}
31+
resolve(JSON.parse(body))
32+
})
33+
req.on('error',reject)
34+
req.end()
35+
})
36+
}
37+
38+
asyncfunction*getRepos(){
39+
for(letpage=1;page<1000;page+=1){
40+
constrepos=awaitjson(`https://api.github.com/orgs/github/repos?type=public&per_page=100&page=${page}`)
41+
if(!repos.length)return
42+
for(constrepoofrepos){
43+
if(!repo.topics)continue
44+
if(repo.private)continue
45+
if(repo.fork)continue
46+
if(!repo.topics.includes('web-components'))continue
47+
if(!repo.topics.includes('custom-elements'))continue
48+
yieldrepo
49+
}
50+
}
51+
}
52+
53+
letreadme=readFileSync('readme.head.md','utf-8')
54+
constbowerJson=JSON.parse(readFileSync('bower.json','utf-8'))
55+
bowerJson.dependencies={}
56+
constpackageJson=JSON.parse(readFileSync('package.json','utf-8'))
57+
packageJson.dependencies={}
58+
letrepos=[]
59+
forawait(constrepoofgetRepos()){
60+
if(repo.full_name==='github/custom-element-boilerplate')continue
61+
repos.push(repo)
62+
}
63+
repos.sort((a,b)=>a.full_name.localeCompare(b.full_name))
64+
readme+=`
65+
We have${repos.length} open source custom elements:
66+
`
67+
for(constrepoofrepos){
68+
bowerJson.dependencies[repo.name]=repo.full_name
69+
packageJson.dependencies[`@${repo.full_name}`]='*'
70+
readme+=`
71+
### [${escape(repo.full_name)}](${repo.html_url})
72+
73+
${escape(repo.description)}
74+
75+
[Link](${repo.html_url})
76+
`
77+
}
78+
readme+=readFileSync('readme.tail.md','utf-8')
79+
writeFileSync('README.md',readme)
80+
writeFileSync('bower.json',JSON.stringify(bowerJson,null,2))
81+
writeFileSync('package.json',JSON.stringify(packageJson,null,2))
82+

‎package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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/remote-input-element":"*",
31+
"@github/tab-container-element":"*",
32+
"@github/task-lists-element":"*",
33+
"@github/text-expander-element":"*",
34+
"@github/time-elements":"*"
35+
}
36+
}

‎readme.head.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#github-elements
2+
3+
GitHub's Web Component collection.

‎readme.tail.md

Whitespace-only changes.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp