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

@shadow-garden/bapbong-view

v0.22.1

Published

bapbong — render core + read-only viewer (preview). Loads/lays-out/paints a .docx to canvas with zoom + page virtualization, no input-bridge (no ProseMirror editing).

Downloads

1,750

Readme

@shadow-garden/bapbong-view

The render core + read-only viewer for bapbong. It loads a .docx, lays it out, and paints it to a virtualized <canvas> page-stack — with zoom, text selection + copy, and an accessibility mirror — but no editing and no input-bridge, so the preview bundle never pulls in the ProseMirror editing surface.

This is the preview tier of the 3-tier architecture: headless (@shadow-garden/bapbong-headless) / preview (this) / full editor (@shadow-garden/bapbong-editor). The editor composes the same RenderCore exported here, so layout/paint live in exactly one place.

Install

pnpm add @shadow-garden/bapbong-view

BapbongView — read-only viewer

Give it a scrollable host element (overflow: auto + a bounded height); it renders the document inside.

import { BapbongView } from '@shadow-garden/bapbong-view';

const view = new BapbongView(hostEl);     // hostEl: overflow:auto, fixed height
await view.loadDocx(bytes);               // ArrayBuffer of a .docx
view.setZoom(1.25);
view.onChange((c) => console.log(c.pageCount));
// view.print();        // render every page → one image per sheet
// view.destroy();

Constructor options (BapbongViewOptions):

| Option | Default | Meaning | | --- | --- | --- | | viewport | the host | Scroll container for virtualization / scroll-into-view | | zoom | 1 | Initial zoom factor | | selectable | true | Drag to select text, double-click word, Ctrl/⌘+A, Ctrl/⌘+C copy | | a11y | true | Build a visually-hidden ARIA mirror for screen readers | | a11yLabel | "Document content" | aria-label for the mirror |

Methods: loadDocx · scrollToPos · setZoom / getZoom · print · exportDocx · onChange · destroy; getters pageCount · schema.

RenderCore — the shared render engine

Lower-level than BapbongView (no host wrapper); the editor composes it. It owns load → layout → paint → scroll/zoom/virtualize plus the geometry queries (caretRect, selectionRects, posAtEvent, pageToCanvas, …) and holds a read-only ProseMirror doc (a Node, not an EditorState). You normally use BapbongView; reach for RenderCore only to build a custom surface.

Notes

  • Selection is painted on the canvas (using the same layout geometry the painter uses, so it aligns at any zoom) and copies via the document model. Because it isn't a native browser selection, the browser's right-click "Copy" and find-in-page don't apply — Ctrl/⌘+C does.
  • Print is rasterized (each page is a high-res PNG, one per sheet) — pixel faithful to the screen, but the printout's text isn't selectable. Vector/PDF output is a planned separate path (@shadow-garden/bapbong-pdf).
  • Deps: contracts, model, docx, measuring, layout-engine, painter-canvas, selection, a11ynot input-bridge.