web-components
Native Web Components, Custom Elements, Shadow DOM encapsulation, and framework-agnostic UI libraries.
Files1
View on GitHubSKILL.mdskills/web-components/SKILL.md
GitHubNative Web Components Protocol
Author framework-agnostic, zero-dependency browser components.
1. Custom Elements & Lifecycle
- Extend
HTMLElementand register withcustomElements.define('app-widget', AppWidget). - Implement
connectedCallbackfor DOM insertion anddisconnectedCallbackfor cleanup. - Observe attributes with
static get observedAttributes()andattributeChangedCallback.
2. Shadow DOM Encapsulation
Use this.attachShadow({ mode: 'open' }) to isolate styles and DOM trees from global namespace collision.