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/core

v1.0.5

Published

Framework-agnostic WYSIWYG rich text editing engine. Immutable state, schema-validated documents, invertible transactions.

Readme

@trevixal/core

CI npm types license

Documentation · Live editor · Changelog · Issues

The Trevixal editor

Features

  • Immutable document model: schema-validated JSON you can store, diff and transform
  • Invertible transactions, so undo is step inversion rather than a second history
  • Runs headless in Node with no DOM, for migrations, tests and server rendering
  • Imported HTML parsed inside an inert template through an allowlist
  • 36.2 kB minified and gzipped, with TypeScript types in the package

The editing engine: an immutable document model, invertible transactions, and a contenteditable view that treats the DOM as a render target rather than the truth. No framework code, no runtime dependencies, safe to import on a server.

npm install @trevixal/core

Usage

import { createEditor, Schema, defaultNodes, defaultMarks } from '@trevixal/core'

const editor = createEditor({
  schema: new Schema({ nodes: defaultNodes(), marks: defaultMarks() }),
  element: document.querySelector('#editor'), // omit for a headless editor
  placeholder: 'Write something…',
  onChange: ({ json }) => save(json),
})

editor.commands.toggleMark('bold')
editor.chain().focus().setHeading(2).insertText('Hello').run()
editor.getJSON()   // what you store
editor.getHTML()   // an export format, not the storage format

Omit element and the identical engine runs with no DOM at all, for server-side processing, migrations and tests.

The shape of it

| Area | What lives there | | --- | --- | | model/ | EditorNode, Fragment, Mark, Schema, content expressions, and positions as { path, offset } | | state/ | EditorState, Transaction, and ten invertible step types | | commands/ | (state) => Transaction \| null functions; editor.commands is a facade over them | | view/ | The renderer, beforeinput handling, the IME composition machine, MutationObserver repair, decoration layers | | history/ | Undo over inverted steps, with time and adjacency grouping | | serialize/ | HTML, Markdown and text out; sanitized HTML in; paste-source cleanup | | suggest/ | The trigger driver behind / and : menus | | a11y/ | The live-region announcer for edits a screen reader cannot see coming |

Three things worth knowing

The DOM is never the source of truth. State is immutable; the surface is an input source and a render target. Everything else follows from that.

Every change is an invertible step. Undo is step inversion, not a second bookkeeping system, and every step remaps positions, so selections, decorations and suggestion ranges survive arbitrary edits. A property test applies 200 random steps, inverts them, and checks the document is restored.

Imported HTML is parsed inside an inert <template> through an allowlist, with a protocol allowlist on every URL. Scripts cannot run during parsing, and an XSS corpus holds it to that.

The DOM is patched, never rewritten. An attribute is only written when its value actually changed. Assigning one the value it already has is still a write. It invalidates style, it shows up as a mutation to anything watching, and on an <iframe> assigning src reloads the frame. Since a decoration layer puts the whole document through the renderer again, and extensions refresh those on a timer, writing unconditionally restarted every embed in the document a few hundred milliseconds after every keystroke.

Focusing the surface never moves the page. view.focus() hands focus back without scrolling: it is called after a menu, a dialog or the command palette took focus, and the caret can be a whole document away from what the reader is looking at. Navigation says so instead: view.scrollSelectionIntoView().

Extending it

Four public hooks, and every extension package in this repository is built on them alone: onTransaction, addDispatchTransform, setDecorationLayer, and the suggestion trigger module, plus schema merging, keymap, inputRules and nodeViews. If something needs more, the hook set is incomplete; see ADR-0008.

License

Apache-2.0