What problem does it solve?
Adapters decouple view module logic from platform-specific trees so the same view code can render to DOM, canvas, WebGL, terminal, native, or server targets without rewriting rendering logic or losing fine-grained reactivity.
Core Features & Use Cases
- Minimal core operations: createNode, setAttribute, appendChild, removeChild, insertBefore provide a small, consistent surface for any renderer.
- Lifecycle hooks: Optional hooks like beforeCreate, onAttach, beforeDestroy enable hydration, animations, and cleanup semantics.
- Cross-renderer composition: parentContext support and switchable adapters let nested renderers and hydration patterns coexist, enabling server-side rendering followed by client-side updates.
- Built-in adapters & testing: Use DOM, test, and SSR adapters for common cases and follow the test adapter pattern for unit testing custom renderers.
Quick Start
Implement the five core tree operations and any lifecycle hooks needed, then pass your adapter to the view module factories so your view code renders to the target platform.