Any Elements
Lightweight component library built to enable custom elements-like features and API for any selectors you desire.
Features
- Class-based components.
- Automatic upgrading of existing and dynamically added elements.
- Ability to target elements with any valid CSS selector.
- Support for
connected
,disconnected
, andattributeChanged
lifecycle hooks. - Automatic cleanup of registered event listeners using
attachEvent
method. - Lazy loading of components just when they are needed.
- Distributed in multiple formats including CJS, UMD & ESM
- Less then 1KB minified and gzipped.
Installation
npm install --save any-elements
Usage
Registering a component
; {} Registry;
Lifecycle methods
; { console; } { console; } Registry;
Listening for attribute changes
; { return "baz"; } { console; } Registry;
Attaching event listeners
; { this; } Registry;