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

@trevixal/react

v1.0.5

Published

React bindings for the Trevixal editor: useEditor, EditorContent, snapshot store and portal-based node views.

Readme

@trevixal/react

CI npm types license

Documentation · Live editor · Changelog · Issues

The Trevixal editor

Features

  • useEditor, EditorContent and a reference-stable snapshot hook
  • Typing does not re-render your tree: the editor DOM lives outside reconciliation
  • React components inside the document through portal-based node views
  • 1.0 kB minified and gzipped, with TypeScript types in the package

React bindings for the Trevixal editor: a hook, a component, and portal-based node views.

npm install @trevixal/core @trevixal/react

Usage

import { Schema, defaultNodes, defaultMarks } from '@trevixal/core'
import { useEditor, useEditorSnapshot, EditorContent } from '@trevixal/react'

const schema = new Schema({ nodes: defaultNodes(), marks: defaultMarks() })

function Bold({ editor }) {
  // Reference-stable snapshot: this re-renders when the toolbar state
  // changes, and never on plain typing.
  const snapshot = useEditorSnapshot(editor)
  return (
    <button
      aria-pressed={snapshot?.activeMarks.includes('bold')}
      onClick={() => editor.commands.toggleMark('bold')}
    >
      Bold
    </button>
  )
}

export function Editor() {
  const editor = useEditor({ schema })
  return (
    <div className="trevixal">
      <Bold editor={editor} />
      <EditorContent editor={editor} placeholder="Write something…" />
    </div>
  )
}

Typing does not re-render your tree

The editor's DOM lives outside React's reconciliation, React mounts an empty container and the view owns what is inside it (ADR-0007). Toolbars subscribe to snapshots through useSyncExternalStore, so a keystroke re-renders only the components whose state actually changed. A test asserts that a sibling which does not subscribe renders zero times while typing.

React components inside the document

import type { NodeViewProps } from '@trevixal/react'

function Counter({ node, updateAttributes }: NodeViewProps) {
  return <button onClick={() => updateAttributes({ count: Number(node.attrs.count) + 1 })}>
    {String(node.attrs.count)}
  </button>
}

<EditorContent editor={editor} nodeViews={{ counter: Counter }} />

Node views render through portals, so they are ordinary React components with hooks, context and all, and their clicks dispatch real editor transactions.

Exports

useEditor, useEditorSnapshot, EditorContent, EditorProvider, useCurrentEditor, and the EditorContentProps / NodeViewProps types.

License

Apache-2.0