Skip to main content

@barocss/renderer-dom

Version in this checkout: 1.0.3. npm · Source

DSL-driven DOM rendering, reconciliation, component state, and measurements.

Purpose​

Use DOMRenderer when you need model-to-DOM rendering without the input handling provided by editor-view-dom.

Install​

npm install @barocss/renderer-dom @barocss/dsl

The published package provides ES modules and TypeScript declarations. Use a bundler that supports package exports.

Public entry points​

ImportRole
@barocss/renderer-domPublic JavaScript and TypeScript API

Import only these public paths. Source paths such as @barocss/renderer-dom/src/... are not part of the published API.

Usage​

import { DOMRenderer } from '@barocss/renderer-dom';
import { RendererRegistry, intoRegistry, define, element, data } from '@barocss/dsl';

export function showText(container: HTMLElement) {
const registry = new RendererRegistry({ global: false });
intoRegistry(registry, () => define('inline-text', element('span', {}, [data('text')])));
const renderer = new DOMRenderer(registry);
renderer.render(container, { sid: 'preview:1', stype: 'inline-text', text: 'Preview' });
return () => renderer.destroy();
}

Integration notes​

Rendering alone does not create editing commands, selection handling, or persistence. Destroy the renderer when its container is removed.

Documentation​

License​

MIT. The published archive includes the license in dist/LICENSE.