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

@oh-just-another/diagram

v0.3.0

Published

Framework-neutral custom element (<oja-diagram>) wrapping the diagram editor — drop into any framework or plain HTML.

Downloads

608

Readme

@oh-just-another/diagram

npm version

The diagram editor as a framework-neutral custom element — <oja-diagram>.

L7 wrapper over @oh-just-another/editor. It mounts the React editor inside its own shadow root (styles isolated, floating UI portaled into the same root) and exposes a plain DOM surface — so Vue, Svelte, Angular or a hand-written HTML page all drive it the same way, without touching React. React is bundled in; consumers never install or import it.

Install

pnpm add @oh-just-another/diagram

Quick start

With a bundler (Vite, webpack, …):

import "@oh-just-another/diagram";
<oja-diagram grid theme="dark" style="height: 100vh"></oja-diagram>

From a CDN, no bundler:

<script
  type="module"
  src="https://unpkg.com/@oh-just-another/diagram/dist/oja-diagram.global.js"
></script>
<oja-diagram grid style="height: 100vh"></oja-diagram>

The global bundle (dist/oja-diagram.global.js) is ~875 KB raw, ~260 KB gzipped — everything included (React, editor, UI). Budget enforced in CI via size-limit.

Drive it imperatively:

const el = document.querySelector("oja-diagram");
el.addEventListener("scenechange", (e) => save(e.detail));
el.addEventListener("ready", () => el.zoomToFit());
el.loadScene(savedScene);

API

| Kind | Name | Notes | | --------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------- | | Attribute | theme | dark | light | system. | | Attribute | renderer | canvas2d | webgl2 | offscreen. Omit to auto-detect. | | Attribute | grid / snap | Boolean — present = on. | | Property | scene | A Scene. Reading returns the current scene; assigning loads it. | | Property | editor | The live engine (EditorInstance), or null before ready. | | Method | getScene() / loadScene(scene) | Read / replace the scene. | | Method | undo() / redo() / zoomToFit() | History and viewport. | | Method | getActiveTool() / setActiveTool(tool), getSelection() / setSelection(ids) | Active tool and selection. | | Event | ready | Fires once the editor mounts; detail.editor is the live engine. | | Event | scenechange | detail is the new Scene. | | Event | selectionchange | detail is an array of selected element ids. | | Event | themechange | detail is the new theme. |

defineOjaDiagram(tag?) registers the element (the package does this on import); pass a tag name to register under a different name.

Design notes

  • Shadow root + adopted styles. The editor mounts in a shadow root so host page styles can't leak in. The react-ui stylesheet is adopted via adoptedStyleSheets; floating UI (tooltips, menus, dialogs) portals into a node inside the same root, so it stays styled.
  • React is an implementation detail. It is bundled and instantiated once inside the element. Framework wrappers built on top of this element are thin — they map their own props/events onto the element's attributes/properties/events.
  • WASM and workers are optional. The bundled text shaper / rasterizer and the offscreen render worker load on demand and fall back to JS / main-thread rendering when unavailable, so the element runs even when those assets aren't served.
  • Full-quality CDN delivery. The ./global build ships the render worker (dist/render-worker.js) and the wasm/ + fonts/ assets alongside the bundle, reached via new URL("../wasm/…" | "../fonts/…", import.meta.url) and new Worker(new URL("./render-worker.js", import.meta.url)). A CDN that serves the whole published package (unpkg, jsDelivr) resolves them, so <script type="module"> users get WASM text-shaping, the bundled fonts and the offscreen worker — not just the JS fallback.