rimitive-adapter

Implement adapter-based rendering with createNode, setAttribute, appendChild, removeChild, and insertBefore.

Updated Jul 18, 2025
One-click install
npx skills add https://github.com/hejhi/rimitive --skill rimitive-adapter
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rimitive-adapter
Source: https://github.com/hejhi/rimitive/tree/main/plugins/rimitive-adapter/skills
Command: npx skills add https://github.com/hejhi/rimitive --skill rimitive-adapter

SYSTEM DOCUMENTATION & REQUIREMENTS

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.

Frequently Asked Questions about rimitive-adapter

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decouple view module logic from platform-specific rendering trees?

Adapter-based rendering unifies rendering logic across platform targets by implementing core tree operations like createNode, setAttribute, and appendChild. This decouples view module logic from platform-specific trees, allowing the same view code to render to DOM, Canvas, WebGL, or terminal without rewriting rendering logic.

How do I build a custom renderer for canvas and WebGL using an adapter pattern?

To build a custom renderer for canvas and WebGL, implement the five core tree operations: createNode, setAttribute, appendChild, removeChild, and insertBefore. Pass your custom adapter to the view module factories to render view code directly to your target platform without altering view logic.

Does adapter-based rendering support server-side rendering followed by client-side hydration?

Adapter-based rendering supports server-side rendering and client-side hydration through optional lifecycle hooks like beforeCreate, onAttach, and beforeDestroy. Switchable adapters and parentContext support allow nested renderers to coexist, enabling seamless server-side rendering followed by client-side updates.

Can I unit test custom renderers without deploying to a specific platform?

You can unit test custom renderers without platform deployment by using the built-in test adapter pattern. This testing adapter simulates tree operations and lifecycle hooks, allowing you to verify rendering logic and fine-grained reactivity in isolated unit tests without a DOM or canvas environment.

What are the limitations of using a minimal core operation adapter for cross-renderer composition?

The limitation of a minimal core operation adapter is that it only provides createNode, setAttribute, appendChild, removeChild, and insertBefore. Complex platform-specific animations or advanced native mobile APIs require implementing optional lifecycle hooks manually, as the minimal core does not include them by default.