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

@blocks-ecosystem/runtime

v0.2.1

Published

The **Blocks Runtime** is the "operating system" for blocks. It owns the **canonical Block Tree**, executes block lifecycles, renders UI (via adapters like `@blocks/renderer`), and emits/consumes **deltas** that keep external representations in sync.

Readme

@blocks/runtime – Blocks Runtime OS

The Blocks Runtime is the "operating system" for blocks. It owns the canonical Block Tree, executes block lifecycles, renders UI (via adapters like @blocks/renderer), and emits/consumes deltas that keep external representations in sync.

Core Terms

  • Block – unit of UI/behavior. Has id, type, props, state, children, and metadata.
  • Block Tree – canonical, serializable tree of blocks representing page structure and execution order.
  • Runtime – authoritative engine that holds the Block Tree, executes block lifecycle, renders UI, and emits/consumes deltas.
  • Adapter – translator between an external format (Markdown, JSON, filesystem, API, etc.) and the Block Tree.

In code, this starter exposes:

  • BlocksRuntime – holds a BlockTree and applies BlockDelta[] via applyDeltas.
  • RuntimeAdapter – interface that can observe deltas and synchronize external systems.
  • Serialization helpers: serializeToMarkdown / deserializeFromMarkdown for one concrete adapter (Markdown).

Renderer Flows

The @blocks/renderer Web Components package is a UI adapter that consumes an ExecutableDocument and renders it as custom elements:

  1. Markdown as Data → BlockTree → <blocks-*> elements

    • Input: markdown string, optionally with a <!-- BLOCKS:... --> header.

    • If the header is present, it defines the BlockTree.

    • If absent, the renderer synthesizes a BlockTree from the markdown AST (headings, paragraphs, code fences, blockquotes).

    • Visual blocks are then rendered as:

      • element: "heading"<blocks-h1><blocks-h6>
      • element: "paragraph"<blocks-p>
      • element: "code"<blocks-code> wrapping <pre><code>
      • element: "blockquote"<blocks-blockquote>
  2. External source → Adapter → Runtime → Renderer

    • A filesystem adapter watches a markdown file:
      • File changes → adapter parses markdown → computes AST diff vs previous → emits BlockDelta[].
    • BlocksRuntime.applyDeltas updates the canonical BlockTree.
    • UI adapters (like @blocks/renderer) re-render based on the new tree.
  3. In-app live Markdown editor (two-way)

    • User types in a markdown editor.
    • Editor (or <blocks-renderer>) parses text (debounced) → AST diff → BlockDelta[]BlocksRuntime.applyDeltas.
    • Runtime re-renders and can emit deltas to a file adapter, which may persist changes back to disk (immediate or on save).
  4. WYSIWYG block editing

    • WYSIWYG operations (reorder blocks, edit props) produce block-level BlockDelta[].
    • Runtime applies them and emits events.
    • A markdown adapter can compute the reverse mapping (block → AST nodes → text patch) to keep textual markdown in sync.
  5. Programmatic updates (generators)

    • A generator script emits BlockDelta[] to create/update many blocks.
    • Runtime applies them; UI adapters incrementally re-render.

Future Work

This starter intentionally keeps the runtime light:

  • applyDeltas does not yet mutate the BlockTree; it only notifies adapters.
  • Conflict detection/merging (e.g. concurrent edits from file + live editor) is not implemented but can be modeled via higher-level BlockDelta events.

The architecture is designed so additional adapters (filesystem, HTTP APIs, JSON manifests) can reuse the same runtime and BlockTree grammar while specialized renderers (web components, native, mobile) stay focused on UI.