A modern custom element framework that bridges reactive signals with Web Components, providing an efficient and developer-friendly approach to building web components with automatic reactivity.
The Adapter Element framework provides a lightweight abstraction over native Web Components that combines:
@arcmantle/injector
for modular architectureTraditional Web Components require significant boilerplate and manual change detection. Adapter Element solves this by:
The base class that your components extend. It provides:
Uses the TC39 Signals proposal for reactive state management:
@state()
- Internal component state that triggers re-renders@property()
- Properties synchronized with HTML attributesThe framework uses a unique two-class approach:
This separation provides clean APIs while maintaining full Web Component compatibility.
import { AdapterElement } from '@arcmantle/adapter-element/adapter';
import { customElement, property, state } from '@arcmantle/adapter-element/adapter';
import { html } from '@arcmantle/adapter-element/shared';
@customElement('my-counter')
class MyCounter extends AdapterElement {
@property(Number) accessor count = 0;
@state() accessor internalState = 'ready';
protected render() {
return html`
<div>
<p>Count: ${this.count}</p>
<button @click=${this.increment}>+</button>
<button @click=${this.decrement}>-</button>
</div>
`;
}
private increment = () => {
this.count++;
};
private decrement = () => {
this.count--;
};
}
The package provides several entry points:
./adapter
- Core AdapterElement class and decorators./shared
- Shared utilities (lit-html exports, CSS helpers, reactive controllers)./router
- Client-side routing utilities⚠️ Work in Progress - This framework is currently in active development and APIs may change. Not recommended for production use yet.
lit-html
- Template renderingsignal-polyfill
- TC39 Signals implementation@arcmantle/injector
- Dependency injection@arcmantle/library
- Utility functions