Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
muan committed Apr 30, 2019
0 parents commit af2e957
Show file tree
Hide file tree
Showing 15 changed files with 8,335 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .babelrc
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"]
}
}
}
17 changes: 17 additions & 0 deletions .eslintrc.json
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"
}
}
]
}
9 changes: 9 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[ignore]

[include]

[libs]

[options]

[lints]
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
9 changes: 9 additions & 0 deletions .travis.yml
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
20 changes: 20 additions & 0 deletions LICENSE
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.
42 changes: 42 additions & 0 deletions README.md
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.
15 changes: 15 additions & 0 deletions examples/index.html
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>
20 changes: 20 additions & 0 deletions index.js
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)
}
Loading

0 comments on commit af2e957

Please sign in to comment.