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

creo-edit

v0.3.0

Published

Row-based rich-text editor framework on a controlled contentEditable, built on Creo. Cursor state separate from document state, CRDT-friendly fractional row ordering, O(1) per-keystroke renders, optional virtualization, first-class mobile.

Readme

creo-edit

A text editor framework, based on Creo. Row-based rich-text editing on a controlled contentEditable. Mountable inside any framework that gives you a DOM ref (React, Vue, Svelte, Solid) — see Hosting inside other frameworks.

Highlights

  • Cursor lives outside the document state — typing into a block doesn't dirty selection subscribers, and vice versa.
  • CRDT-friendly row ordering via base-62 fractional indexing — insert-between is O(log n), no renumber.
  • Controlled contentEditable — native browser selection and IME, with every beforeinput intercepted and translated into a command. The model is the source of truth.
  • Per-keystroke render cost is O(1) blocks — block immutability + shouldUpdate identity checks make the keyed reconciler skip every untouched block.
  • Optional virtualization — only blocks intersecting the viewport are mounted; documents with hundreds of thousands of blocks remain responsive.
  • First-class mobile support — native long-press OS menu, native selection handles, IME composition reconciled into a single undo step, visualViewport-aware caret-keeping.

Install

bun add creo creo-edit

Quick start

import { createApp, HtmlRender } from "creo";
import { createEditor } from "creo-edit";

const editor = createEditor({
  initial: {
    blocks: [
      { type: "h1", runs: [{ text: "Hello" }] },
      { type: "p", runs: [{ text: "Type here." }] },
    ],
  },
});

createApp(
  () => editor.EditorView(),
  new HtmlRender(document.querySelector("#app")!),
).mount();

Hosting inside other frameworks

The editor renders through Creo's HtmlRender, which mounts into any DOM element. Embed it inside a host framework by giving Creo a container element managed by that framework. There is no React/Vue/Svelte wrapper package — you write the ten-line bridge once.

React

import { useEffect, useRef } from "react";
import { createApp, HtmlRender } from "creo";
import { createEditor } from "creo-edit";

export function CreoEdit() {
  const ref = useRef<HTMLDivElement>(null);
  useEffect(() => {
    if (!ref.current) return;
    const editor = createEditor();
    const app = createApp(
      () => editor.EditorView(),
      new HtmlRender(ref.current),
    ).mount();
    return () => app.unmount?.();
  }, []);
  return <div ref={ref} />;
}

Vue 3

<script setup lang="ts">
import { onMounted, onBeforeUnmount, ref } from "vue";
import { createApp as creoApp, HtmlRender } from "creo";
import { createEditor } from "creo-edit";

const host = ref<HTMLElement | null>(null);
let app: ReturnType<typeof creoApp> | null = null;
onMounted(() => {
  const editor = createEditor();
  app = creoApp(() => editor.EditorView(), new HtmlRender(host.value!)).mount();
});
onBeforeUnmount(() => app?.unmount?.());
</script>

<template>
  <div ref="host" />
</template>

Svelte 5 / Solid / anything with a DOM ref: same pattern — wait for the container to be mounted, call createApp(...).mount(), call app.unmount() on teardown. The editor handle (createEditor() return value) is plain JS; exposing editor.dispatch, editor.toJSON, editor.docStore, etc. from inside a hook / composable is straightforward.

Editor API

type Editor = {
  docStore: Store<DocState>;
  selStore: Store<Selection>;
  dispatch(cmd: Command): void;
  undo(): void;
  redo(): void;
  EditorView: PublicView<EditorViewProps, void>;
  setDocFromHTML(html: string): void;
  toJSON(): SerializedDoc;
  focus(): void;
  blur(): void;
};

Commands

  • insertText, deleteBackward, deleteForward — text editing
  • splitBlock, mergeBackward, mergeForward — structural
  • setBlockType — promote/demote between paragraph, headings, list items
  • toggleMark — bold, italic, underline, strikethrough, code
  • toggleList, indentList, outdentList
  • insertImage, insertTable
  • tableInsertRow/Col, tableRemoveRow/Col
  • moveCursor

Default keybindings

| Chord | Action | |---|---| | Cmd/Ctrl+B / +I / +U | Toggle bold / italic / underline | | Cmd/Ctrl+Shift+S | Strikethrough | | Cmd/Ctrl+Z / +Shift+Z | Undo / redo | | Cmd/Ctrl+Alt+1..6 | Heading levels | | Cmd/Ctrl+Alt+0 | Paragraph | | Tab / Shift+Tab | List indent / outdent (or table cell nav) | | Enter / Backspace / Delete | Split / merge blocks | | Arrows / Home / End | Caret navigation (extend with Shift) |

Virtualization (large documents)

const editor = createEditor({
  initial: { blocks: [...] },
  virtualized: true,
  virtualEstimatedHeight: 32,
});

Only blocks intersecting [scrollTop − overscan, scrollTop + viewport + overscan] are mounted, with measured per-block heights stored in a Fenwick tree for O(log n) viewport resolution.

Image upload

const editor = createEditor({
  uploadImage: async (file) => {
    const fd = new FormData();
    fd.append("file", file);
    const res = await fetch("/upload", { method: "POST", body: fd });
    return (await res.json()).url;
  },
});

Without uploadImage, dropped/pasted images use URL.createObjectURL.

Mobile

creo-edit ships first-class mobile support. The editor root is a contentEditable, so the OS long-press menu, native selection handles, IME composition, and autocorrect work out of the box. visualViewport tracking exposes --creo-vv-height and --creo-vv-top as CSS custom properties so host pages can position floating UI above the soft keyboard, and scrolls the caret into the upper third of visible space when the keyboard opens.

Architecture

See AGENTS.md in the repo root for engine-level notes. The editor is a pure consumer of Creo's public API — view, use, store, primitive functions — and uses raw DOM listeners only for events Creo's event map doesn't expose (composition, drag/drop, clipboard, visualViewport).

License

MIT