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

@particle-academy/fancy-doc-commons

v0.1.0

Published

Shared pure core for the Fancy document/surface packages — the model an agent or human emits and edits. Flat node-tree + collab-safe fractional ordering, a typed op-spine contract (reduce + invert) with a reference tree reducer, an infinite-canvas primiti

Readme

@particle-academy/fancy-doc-commons

The shared, pure, zero-dependency core for the Fancy document / surface packages — the model an agent or a human emits and edits. Sibling of fancy-file-commons (which owns file / diff concerns); this owns node / tree / op concerns.

Design doc: .ai/plans/fancy-doc-commons.md in the envelope. This package is the Phase-1 substrate: the parts every "agent emits a surface" model needs, so they stop diverging into N incompatible schemas + N bespoke bridges.

No React, no DOM. JSON-friendly, deterministic, and safe to hand across an MCP bridge.

What it owns

| Area | Exports | |---|---| | Ordering | fractionalKey(a, b) — collab-safe sibling order (a node always inserts between two others without renumbering). | | Document tree | DocNode / DocTree (a flat Record<id, node> map with parent + order), childrenOf, roots, descendantsOf, ancestorsOf, isAncestorOrSelf, appendOrder. | | Op-spine | DocReducer<Doc, Op> (the reduce + invert contract every surface implements), reduceAll, and a reference treeReducer() / TreeOp over DocTree with exact inverses. | | Canvas | Viewport / PositionedItem / Connector (the shape triplicated in whiteboard / artboard / flow), byZ, topZ, screenToWorld, worldToScreen. | | Staged writes | AcceptanceState / AcceptanceStatus / Proposal / StagePolicy — one trust-but-verify (accept / reject) model for every surface. | | Style + CSS | StyleProps / Constraints / PerBreakpoint / StyledNode + emitTreeCss — the per-breakpoint style model and its deterministic CSS emitter (sorted decls/ids, fixed media format), so a doc gets responsive styling + an SSR first byte. Pass your own selectorFor to match an existing convention byte-for-byte (cms uses [data-cms]). |

The idea

Model every mutation as a typed op with a pure reduce and a computable invert, over a flat node tree addressed by stable ids. Then undo, redo, staged writes, presence, and collaboration all derive from one code path — instead of the five bespoke ones the kit has today. fancy-cms's PageDoc / PageOp and fancy-slides' Deck / DeckOp are the two mature spines this generalizes; other surfaces adopt the contract incrementally.

import { treeReducer, reduceAll, appendOrder, type DocTree } from "@particle-academy/fancy-doc-commons";

const r = treeReducer();
const op = { t: "insert", node: { id: "n1", type: "text", parent: null, order: appendOrder(doc, null), props: { content: "hi" } } };
const next = r.reduce(doc, op);
const undo = r.invert(doc, op);      // → [{ t: "remove", id: "n1" }]
const back = reduceAll(r, next, undo); // deep-equals doc

Status

Phase 1, v0.1: ordering · tree · op-spine · canvas · staged writes · style + CSS emitter. Next (Phase 2): registerDocBridge in agent-integrations — generate a surface's MCP tools (read + typed op tools + uniform undo/pending/activity) from a DocReducer, and build the greenfield registerCmsBridge on it. Later slices: data-binding ({$bind}) + actions + motion.