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

@layera-labs/orbit-model

v1.0.0-beta.4

Published

Headless reactive document model for the Orbit canvas editor SDK

Readme

@layera-labs/orbit-model

The document model for the Orbit canvas editor: a reactive store holding pages, elements, selection, viewport and history. Headless — no React, no canvas, no DOM.

This is v2, the current line. @layera-labs/orbit-model, @layera-labs/orbit-render, @layera-labs/orbit-providers and @layera-labs/orbit-editor are one stack. The older @layera-labs/orbit-core / @layera-labs/orbit-react packages are v1 legacy; see the note at the bottom before you pick.

npm i @layera-labs/orbit-model@beta

Beta. 1.0.0-beta.3 under the beta tag; the API moves without notice. The package itself has no React dependency, but the stack it belongs to is React 18 only — see @layera-labs/orbit-render for why.

The store

createStore() returns an OrbitStore whose state is a Valtio proxy. Mutations are ordinary property writes; the renderer and the UI re-read from a snapshot. Every public method records an undo step.

import { createStore, snapshot } from '@layera-labs/orbit-model';

const store = createStore({ width: 1080, height: 1080 });

const id = store.addElement({
  type: 'text',
  text: 'Orbit',
  x: 80,
  y: 120,
  fontSize: 64,
});

store.updateElement(id, { fill: '#c25b3a' });
store.select([id]);

store.undo();          // back to the black text
store.canRedo;         // true

const doc = store.toJSON();   // a plain Document. A template IS this shape
store.loadJSON(doc);          // replaces the document, resets history and selection

Transactions are how you avoid a hundred undo steps

A drag that fires sixty pointer moves should be one entry in the history, not sixty. transaction coalesces everything inside it into a single undo step:

store.transaction(() => {
  for (const id of ids) store.updateElement(id, { x: nextX(id), y: nextY(id) });
});

Two ways to observe

const off = store.subscribe(() => draw(snapshot(store.state)));  // any change
const offSel = store.on('selectionChange', (s) => inspect(s.selection));

subscribe is the low-level Valtio hook and fires on everything. on is the imperative event API for SDK consumers and names what changed. In React, bind with Valtio's useSnapshot(store.state) rather than either.

What else it does

Pages (addPage, duplicatePage, reorderPages, renamePage, resizePage, setBackground), z-order (bringToFront, sendBackward, moveElement), grouping (group, ungroupgetElement searches into groups), alignment and distribution (alignToPage, alignSelection, distribute), and applyAction, which applies one or more declarative CanvasActions atomically. applyAction is the seam an AI layer writes through, so an agent's edit is one undoable step like any other.

fromPolotnoJSON imports a Polotno document. migrateSceneGraphToDocument converts a v1 SceneGraph from @layera-labs/orbit-shared.

What it does not do

It does not render. It does not know what a Konva node is, or what a font file is, or how to search for a photo. Those are @layera-labs/orbit-render and @layera-labs/orbit-providers. It also has nothing to do with video — the video timeline is a different document kind entirely, in @layera-labs/orbit-video, and merging the two was considered and rejected.

Links

MIT.