npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@type-editor/adapter-core

v0.0.3

Published

Type editor adapter core package

Readme

@type-editor/adapter-core

Framework-agnostic base classes for integrating custom UI components with ProseMirror via the type-editor adapter system. Framework adapters (React, Vue, Svelte) extend these classes and hook into their own rendering pipelines.

Overview

@type-editor/adapter-core provides four abstract base classes – one for each ProseMirror extension point – that handle all the boilerplate of DOM management, lifecycle delegation, and decoration bookkeeping. Framework-specific packages subclass these and add portal/teleport rendering on top.

| Class | ProseMirror concept | Purpose | |------------------|---------------------|---------------------------------------------------------| | CoreNodeView | NodeView | Renders a document node with a UI component | | CoreMarkView | MarkView | Renders an inline mark with a UI component | | CorePluginView | PluginView | Renders a plugin-owned UI alongside the editor | | CoreWidgetView | Widget decoration | Renders an inline widget decoration with a UI component |

Installation

npm install @type-editor/adapter-core
# or
pnpm add @type-editor/adapter-core

API

CoreNodeView<ComponentType>

Base class for custom node views. Implements the ProseMirror NodeView interface.

Constructor receives a CoreNodeViewSpec<ComponentType>:

| Property | Type | Description | |--------------------|------------------------------------------|----------------------------------------------| | node | Node | The ProseMirror document node | | view | PmEditorView | The editor view | | getPos | () => number \| undefined | Returns the node's current document position | | decorations | ReadonlyArray<PmDecoration> | Decorations applied to the node | | innerDecorations | DecorationSource | Decorations applied to the node's content | | options | CoreNodeViewUserOptions<ComponentType> | User configuration (see below) |

CoreNodeViewUserOptions<Component>

| Option | Type | Description | |------------------|----------------------------------------------------|-----------------------------------------------------------------| | component | Component | The UI component to render (required) | | as | NodeViewDOMSpec | Outer DOM element spec (tag name, element, or factory function) | | contentAs | NodeViewContentDOMSpec \| 'self' | Content DOM element spec; 'self' makes contentDOM === dom | | update | (node, decorations, innerDecorations) => boolean | Custom update handler | | ignoreMutation | (mutation) => boolean | Custom mutation filter | | selectNode | () => void | Called when the node is selected | | deselectNode | () => void | Called when the node is deselected | | setSelection | (anchor, head, root) => void | Custom selection drawing | | stopEvent | (event) => boolean | Prevents ProseMirror from handling a DOM event | | destroy | () => void | Called when the node view is destroyed | | onUpdate | () => void | Called after a successful update |


CoreMarkView<ComponentType>

Base class for custom mark views. Implements the ProseMirror MarkView interface.

Constructor receives a CoreMarkViewSpec<ComponentType>:

| Property | Type | Description | |-----------|------------------------------------------|-----------------------------------------------| | mark | Mark | The ProseMirror mark | | view | PmEditorView | The editor view | | inline | boolean | Whether the mark appears in an inline context | | options | CoreMarkViewUserOptions<ComponentType> | User configuration (see below) |

CoreMarkViewUserOptions<Component>

| Option | Type | Description | |------------------|--------------------------------------|-----------------------------------------| | component | Component | The UI component to render (required) | | as | MarkViewDOMSpec | Outer DOM element spec | | contentAs | MarkViewDOMSpec | Content DOM element spec | | ignoreMutation | (mutation) => boolean \| undefined | Custom mutation filter | | destroy | () => void | Called when the mark view is destroyed |


CorePluginView<ComponentType>

Base class for plugin views. Implements the ProseMirror PluginView interface.

Constructor receives a CorePluginViewSpec<ComponentType>:

| Property | Type | Description | |-----------|--------------------------------------------|--------------------------------| | view | PmEditorView | The editor view | | options | CorePluginViewUserOptions<ComponentType> | User configuration (see below) |

CorePluginViewUserOptions<Component>

| Option | Type | Description | |-------------|-----------------------------------------|----------------------------------------------------------| | component | Component | The UI component to render (required) | | root | (viewDOM: HTMLElement) => HTMLElement | Returns the container element for the rendered component | | update | (view, prevState) => void | Called after every transaction | | destroy | () => void | Called when the plugin view is torn down |


CoreWidgetView<ComponentType>

Base class for widget decoration views.

Constructor receives a CoreWidgetViewSpec<ComponentType>:

| Property | Type | Description | |-----------|--------------------------------------------|---------------------------------| | pos | number | Document position of the widget | | spec | WidgetDecorationSpec | Optional decoration options | | options | CoreWidgetViewUserOptions<ComponentType> | User configuration (see below) |

CoreWidgetViewUserOptions<Component>

| Option | Type | Description | |-------------|-------------------------|-------------------------------------------------| | component | Component | The UI component to render (required) | | as | string \| HTMLElement | Root DOM element (tag name or element instance) |

Call widgetView.bind(view, getPos) after the widget DOM has been inserted into the document.


Extending

Framework adapters subclass CoreNodeView (and the other base classes) to plug into their rendering pipelines:

import { CoreNodeView } from '@type-editor/adapter-core';

class MyFrameworkNodeView extends CoreNodeView<MyComponent> {
    render() {
        // Mount MyComponent into this.dom using the framework's portal/teleport API
    }

    updateContext() {
        // Propagate this.node, this.selected, etc. to the framework component
    }
}

License

MIT