All-End Developer
Develops web apps since 1999
<script src="dk-tabs.js"></script>
<dk-tabs>
<dk-tab title="Tab 1">This is tab one</dk-tab>
<dk-tab title="Tab 2"><h2>Antoher tab</h2></dk-tab>
</dk-tabs>
Parse HTML only once
<template id="item-template">
<div>Whatever content you like</div>
</template>
const templ = document.getElementById('item-template')
for (let i = 0; i < 100; i++) {
const node = document.importNode(templ.content, true)
elm.appendChild(node);
}
Declare a variable
element { /* or use pseudo selector :root */
--background-color: #3f0;
}
Use variable
element {
background: var(--background-color, #9E9E9E);
}
@webcomponents/webcomponentsjs
Full suport for Custom Elements, Shadow DOM and Templates,Former jQuery Plugins
Examples: gallery, date-picker
https://silverlinkz.net/projects/gallery
Your in-house component framework
@Component({
tag: 'my-hello',
styleUrl: 'my-hello.css',
shadow: true
})
export class HelloComponent {
@Prop() name = 'world';
render() {
return (
Hello, {this.name}
);
}
}
@customElement('my-hello')
class HelloComponent extends LitElement {
@property() name = 'world';
render() {
return html`
Hello, ${this.name}
`;
}
}
LitElement always uses Shadow DOM
Source: www.npmtrends.com
Build component in your framework of choice
@NgModule({
// ...
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})import '@myscope/mycomponent'
<my-component [attr]="val"></my-component>
Does Framework X Support this?
Stencil works OOTB (even in IE11)!
Fiddle with all others 😭
For Custom Elements + Shadow DOM: @webcomponents/webcomponentsjs/webcomponents-bundle.js