View runtime
Install standalone:
pnpm add @codemerge/view
Product / SDK re-exports (same API): on-codemerge/view, and @codemerge/sdk / on-codemerge/sdk still export h / mount / portals for plugins. Prefer @codemerge/view when you only need DOM helpers.
import { h, mount, teleport } from '@codemerge/view';
const host = document.querySelector('#app')!;
const handle = mount(
host,
h('div', { class: 'panel' }, [
h('button', { attrs: { type: 'button' }, on: { click: () => alert('hi') } }, 'Click'),
teleport('popup', h('div', { class: 'toast' }, 'Hello')),
])
);
// later
handle.update(h('div', { class: 'panel' }, 'Done'));
handle.destroy();
Modules under packages/view/src/: types, h, mount, files, portal, disposable.
Keep toolbar / popup / plugin APIs in @codemerge/sdk. Import view primitives from @codemerge/view when you only need DOM helpers.
SDK reference
Published path for apps: on-codemerge/sdk (bundled into the product package).
Authoring plugins
Plugins import the SDK via the published path on-codemerge/sdk (workspace may alias @codemerge/sdk to sources). App helpers under src/utils are package-internal — third-party plugins should use only the public SDK, not deep imports into that folder.