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

@shapeshift-labs/frontier-richtext

v0.1.0

Published

Rich text Delta, marks, embeds, ranges, and cursor helpers for Frontier editor integrations.

Readme

Frontier Rich Text

Rich text Delta, marks, embeds, ranges, and cursor helpers for Frontier editor integrations.

This package is the editor-facing rich text utility layer in the Frontier package family. It does not implement network sync or CRDT merge by itself; use it with @shapeshift-labs/frontier-crdt, @shapeshift-labs/frontier-crdt-sync, or an editor binding when collaborative transport is needed.

Related Packages

Package source repositories:

Install

npm install @shapeshift-labs/frontier-richtext

Usage

import {
  applyRichTextDelta,
  createRichTextDocument,
  formatRichTextRange,
  richTextToPlainText,
  transformRichTextSelection
} from '@shapeshift-labs/frontier-richtext';

const doc = createRichTextDocument('hello world');
const formatted = formatRichTextRange(doc, { index: 0, length: 5 }, { bold: true });

const next = applyRichTextDelta(formatted, [
  { retain: 6 },
  { delete: 5 },
  { insert: 'Frontier', attributes: { italic: true } }
]);

console.log(richTextToPlainText(next)); // "hello Frontier"

const selection = transformRichTextSelection(
  { anchor: 0, head: 5 },
  [{ insert: 'Local-first ' }]
);

API

Documents And Delta

createRichTextDocument(input?)

Creates a normalized rich text document from a string, insert-only Delta, or existing document.

richTextToDelta(document)

Returns a normalized insert-only Delta for storage or editor adapters.

richTextToPlainText(document, options?)

Flattens text content. Embeds become \uFFFC by default.

applyRichTextDelta(document, delta)

Applies Quill-style insert, retain, and delete operations to a document. Retain attributes apply marks; null attribute values remove marks.

Editing Helpers

insertRichText(document, index, insert, attributes?)

Inserts text or an embed at an offset.

deleteRichTextRange(document, { index, length })

Deletes a range.

formatRichTextRange(document, { index, length }, attributes)

Applies or removes attributes over a range.

sliceRichText(document, { index, length })

Returns a normalized document slice.

Cursors And Selections

transformRichTextCursor(cursor, delta, options?)

Maps a cursor through a Delta. association: 'before' | 'after' controls how a cursor at an insertion point behaves.

transformRichTextSelection(selection, delta, options?)

Maps { anchor, head } through the same cursor transform.

Subpath Imports

This package currently exposes a single root entry point:

import { applyRichTextDelta } from '@shapeshift-labs/frontier-richtext';

Package Scope

This package owns local rich text data transforms:

  • Delta normalization and application;
  • marks and attribute composition;
  • embeds as single logical units;
  • range formatting and slicing;
  • stable cursor/selection mapping through local Deltas.

It intentionally does not own:

  • CRDT actor/sequence IDs;
  • network sync, presence, or awareness;
  • storage providers;
  • editor-specific DOM decorations;
  • conflict resolution for concurrent rich text marks.

Those belong in frontier-crdt, frontier-crdt-sync, and editor binding packages.

TypeScript

The package ships ESM JavaScript plus .d.ts declarations. The source lives in src/ and compiles directly to dist/.

Validation

npm test
npm run fuzz
npm run bench
npm run pack:dry

The test suite covers Delta application, mark insertion/removal, embeds, slicing, cursor/selection mapping, TypeScript declarations, and randomized plain-text equivalence.

Benchmarks

Run the package-local benchmark:

npm run bench

Latest local package benchmark on Node v26.1.0, darwin arm64, 9 rounds:

| Fixture | Median | p95 | | --- | ---: | ---: | | Create document, 4k text | 0.09 us | 0.25 us | | Apply mixed Delta | 0.96 us | 1.64 us | | Format range, 512 chars | 0.88 us | 1.11 us | | Insert marked text | 0.69 us | 0.78 us | | Export Delta | 0.13 us | 0.19 us | | Plain text flatten | 0.09 us | 0.16 us | | Transform selection | 0.57 us | 0.77 us |

These are Frontier-only package measurements, not competitor comparisons.

License

MIT. See LICENSE.