1.0.26 • Published 5 years ago
web-component v1.0.26
web-component
Lightweight library providing interface for building web components.
Contribution
Is web-component library missing something ?
No problem! Simply fork this repository, add middleware and create pull request.
Installation
npm install --save web-component
Documentation
Package provides a decorator
function that allows you to:
- easy define Custom Elements
- styling a custom element
- creating elements from a template
- encapsulate style and markup using Shadow DOM
- extending other custom elements or even the browser's built-in HTML
import { WebComponent } from 'web-component'
@WebComponent('hello-world', {
template: require('./hello-world.html'),// provide template
styles: require('./hello-world.css'), //provide styles
extends: 'button', //default does not extends any
shadowDOM: true, //default false
mode: "open" // default open, set to closed to block access to shadowDOM
})
export class HelloWorld extends HTMLElement {}
If shadowDOM option is set to true
then template and styles will be attached to shadowRoot. If there is no shadowRoot, it will be created with mode open
.
License
The code is available under the MIT license.
1.0.26
5 years ago
1.0.25
8 years ago
1.0.24
8 years ago
1.0.23
8 years ago
1.0.22
8 years ago
1.0.21
8 years ago
1.0.19
8 years ago
1.0.18
8 years ago
1.0.17
8 years ago
1.0.16
8 years ago
1.0.15
8 years ago
1.0.14
8 years ago
1.0.13
8 years ago
1.0.12
8 years ago
1.0.10
8 years ago
1.0.9
8 years ago
1.0.8
8 years ago
1.0.7
8 years ago
1.0.4
8 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago