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

@docen/core

v0.7.0

Published

Shared rendering layer for docen editors — geometry/style/image helpers and the LeaferJS scene painter for laid-out documents

Readme

@docen/core

npm version npm downloads npm license

The scene painter for the docen editors: it instantiates a laid-out LayoutDoc (@docen/layout) as a LeaferJS tree.

Consumed by @docen/editor's canvas stage, one paint per page sync. The future pptx/xlsx canvas editors reuse the same painter.

Features

  • 🎨 Painter — paintScene(tree, items, ctx) walks a laid-out page and builds the LeaferJS tree: text lines, tables, drawing members (pictures / shapes / paths / text boxes, incl. vector metafile members), and page furniture
  • 🧱 Dumb by design — the layout engine owns ALL geometry; the painter positions what it is given and never measures. Text elements carry explicit width AND height (Leafer never paints an element whose height is still 0)
  • 🖼️ Drawing hit boxes — every drawing paints a page-local hit box so clicks resolve back to the editing model's drawing selection
  • 🧩 Headless-ready — no DOM assumptions beyond LeaferJS itself; runs under @leafer-ui/node for export / thumbnails

Installation

# Install with pnpm
$ pnpm add @docen/core

# Install with npm
$ npm install @docen/core

Quick Start

import { paintScene, type PaintContext } from "@docen/core";
import { App, type IGroup } from "leafer-ui";

// items: the laid-out page from @docen/layout (stackBlocks/TextMeasurer),
// ctx: the page's flow box + furniture + background (the docx projection).
const app = new App({ view, editor: {} });
const tree = app.tree as IGroup;
const ctx: PaintContext = {/* flow, furniture, background, hitBoxes... */};
paintScene(tree, items, ctx);

Architecture

@docen/layout      LayoutDoc — paginated geometry (engine owns all measurement)
        ↓
@docen/core        this package — LayoutDoc → LeaferJS elements
        ↓
@docen/editor      canvas stage (App lifecycle, zoom, caret/selection mapping)

The painter deliberately owns no layout decisions (geometry comes from the engine) and no editing semantics (selection, undo, keyboard/IME live in the editor).

License