generated from github/custom-element-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit af2e957
Showing
15 changed files
with
8,335 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"env": { | ||
"esm": { | ||
"presets": ["github"] | ||
}, | ||
"umd": { | ||
"plugins": [ | ||
"@babel/plugin-transform-modules-umd" | ||
], | ||
"presets": ["github"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"extends": [ | ||
"plugin:github/browser", | ||
"plugin:github/es6", | ||
"plugin:github/flow" | ||
], | ||
"parser": "babel-eslint", | ||
"overrides": [ | ||
{ | ||
"files": "test/**/*.js", | ||
"rules": { | ||
"flowtype/require-valid-file-annotation": "off", | ||
"github/unescaped-html-literal": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
|
||
[options] | ||
|
||
[lints] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
language: node_js | ||
sudo: required | ||
node_js: | ||
- "node" | ||
addons: | ||
chrome: stable | ||
cache: | ||
directories: | ||
- node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2018 GitHub, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# <custom-element> element | ||
|
||
Boilerplate for creating a custom element. | ||
|
||
## Installation | ||
|
||
``` | ||
$ npm install @github/custom-element-element | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
import '@github/custom-element-element' | ||
``` | ||
|
||
```html | ||
<custom-element></custom-element> | ||
``` | ||
|
||
## Browser support | ||
|
||
Browsers without native [custom element support][support] require a [polyfill][]. | ||
|
||
- Chrome | ||
- Firefox | ||
- Safari | ||
- Microsoft Edge | ||
|
||
[support]: https://caniuse.com/#feat=custom-elementsv1 | ||
[polyfill]: https://github.com/webcomponents/custom-elements | ||
|
||
## Development | ||
|
||
``` | ||
npm install | ||
npm test | ||
``` | ||
|
||
## License | ||
|
||
Distributed under the MIT license. See LICENSE for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>custom-element demo</title> | ||
</head> | ||
<body> | ||
<custom-element></custom-element> | ||
|
||
<!-- GitHub Pages development script, uncomment when running example locally and comment out the production one --> | ||
<!-- <script src="../dist/index.umd.js"></script> --> | ||
|
||
<!-- GitHub Pages demo script --> | ||
<script src="https://unpkg.com/@github/custom-element-boilerplate@latest/dist/index.umd.js"></script></body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* @flow strict */ | ||
|
||
class CustomElementElement extends HTMLElement { | ||
constructor() { | ||
super() | ||
} | ||
|
||
connectedCallback() { | ||
this.textContent = ':wave:' | ||
} | ||
|
||
disconnectedCallback() {} | ||
} | ||
|
||
export default CustomElementElement | ||
|
||
if (!window.customElements.get('custom-element')) { | ||
window.CustomElementElement = CustomElementElement | ||
window.customElements.define('custom-element', CustomElementElement) | ||
} |
Oops, something went wrong.