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

@rebodocs/editor

v0.13.0

Published

A DOCX editor for the browser: pages, caret and selection, toolbar, menu, side panel and status bar. No framework.

Readme


The Editor holds the document, the selection and the undo history, paints the layout @rebodocs/core computes, and takes keys, clicks and touches. The pieces of interface around it are separate functions, so you take the ones you want, or none. For React, use @rebodocs/react, which is built on this package.

Install

npm install @rebodocs/editor

Usage

import { Editor, createToolbar, createStatusBar, createBubble, createResponsive } from '@rebodocs/editor';

const editor = new Editor(document.querySelector('#pages')!); // the element needs a height
createToolbar(document.querySelector('#toolbar')!, editor);
createStatusBar(document.querySelector('#status')!, editor);
createBubble(editor);
createResponsive(document.body, editor);

editor.loadDocx(bytes);
editor.onChange(() => console.log(editor.pageCount));

const docx = editor.exportDocx();
const pdf = await editor.exportPdf('Contract');

Pieces

| Function | What it adds | | --- | --- | | createToolbar | Formatting, insert and review, in two rows, tabs or one row. What does not fit folds into a tray. | | createSidebar | The document menu: open, save, export, page setup, letterhead, language, appearance. A screen or a card. | | createPanel | The side panel: outline, variables, comments, tracked changes, versions. | | createStatusBar | Pages, words, the language of the text, the view, the zoom, who else is on the document. | | createRuler | Margins, indents and tab stops, by mouse or keyboard. | | createBubble | The bar beside the selection, with spelling suggestions and, on a phone, copy and paste. | | createFindBar | Find and replace (⌘F, ⌘H). | | createFocusMode | The pages alone, full screen. | | createResponsive | Narrow windows and on-screen keyboards. | | createSpellChecker | Spell checking with Hunspell dictionaries you give, read in a worker: editor.spellChecker = createSpellChecker({ dictionaries: { es: { aff, dic } } }). | | createVersionView | Two versions compared, over the document. |

A document to read

A document only to read, with its first page as a thumbnail, is @rebodocs/viewer: these pages read only, with a bar to zoom and print.

Theming

Colours are CSS variables: the canvas, the selection and the caret (--dx-canvas, --dx-selection, …), the ruler (--dx-ruler-*) and the interface (--dx-ui-*). A dark theme comes with it:

editor.theme = 'dark';                               // or 'auto', to follow the system
applyTheme(document.querySelector('#app')!, 'dark'); // the element around the pieces

The base rules sit in a CSS layer, so utility classes such as Tailwind's win over them. See styling.

Languages and fonts

import fr from './texts/fr.json'; // npm run locale -- fr texts/fr.json, in the repository
addLocale('fr', fr);
setLocale('fr');

await addFonts([
  { family: 'Raleway', src: '/fonts/Raleway-Regular.ttf' },
  { family: 'Raleway', src: '/fonts/Raleway-Bold.ttf', bold: true },
]);

The interface ships in English and Spanish; Simplified and Traditional Chinese come apart, for the applications that want them:

import zhHans from '@rebodocs/editor/locales/zh-Hans';
import zhHant from '@rebodocs/editor/locales/zh-Hant';
addLocale('zh-Hans', zhHans); // zh, zh-CN, zh-SG
addLocale('zh-Hant', zhHant); // zh-TW, zh-HK, zh-Hant

A browser in Chinese then shows Chinese by itself, until the application sets a language with setLocale.

Fonts you add are listed in the toolbar, embedded in PDFs, and carried in the DOCX when their licence allows (editor.embedFonts = 'subset' keeps only the characters used).

How it works

  • No contenteditable. A hidden textarea follows the caret; what is typed there goes into the model, and on-screen keyboards compose as usual.
  • Painting is placing. Each piece of text is an absolutely positioned span where the layout put it; the browser never wraps a line. Only the pages near the view are drawn.
  • Zoom is a transform, so zooming never re-breaks lines.
  • Accessible. A screen reader hears what the caret moves over and where it is; every piece works from the keyboard (F6, Alt+F10), and high contrast is kept.

Compatibility

Modern browsers. Spell checking runs in a Web Worker made from a Blob, so a Content Security Policy must allow worker-src blob:.

Status

0.13: ready to try in production; the API may change before 1.0. See the changelog and the known limits.

License

MIT. Bundled third-party code is listed in THIRD_PARTY_NOTICES.md.