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

@samrey/reactivity

v1.0.1

Published

Fine-grained push-pull topological signal engine with versioned transaction clocks and Owner cleanup hierarchy.

Readme

@samrey/reactivity

Fine-grained push-pull topological signal engine with versioned transaction clocks, automatic batching, and reactive Owner cleanup scopes.

Purpose

@samrey/reactivity is the foundation of the Samrey Framework. It provides high-performance reactive state management without virtual DOM diffing, dirty-checking, or monkey-patching. Signals act as reactive state atoms that notify only the specific DOM nodes or computations that depend on them.

Installation

npm install @samrey/reactivity

Quick Example

import { signal, computed, effect, batch, createStore } from '@samrey/reactivity';

// 1. Primitive state signal
const count = signal(0);

// 2. Memoized computed derivation
const doubled = computed(() => count.value * 2);

// 3. Side-effect subscriber
const dispose = effect(() => {
  console.log(`Count is ${count.value}, Doubled is ${doubled.value}`);
});

// 4. Batch updates
batch(() => {
  count.value = 1;
  count.value = 2;
}); // Logs once: "Count is 2, Doubled is 4"

// 5. Reactive Proxy Store
const store = createStore({ user: { name: 'Alice', age: 30 } });
store.user.age = 31;

// Cleanup effect
dispose();

API

  • signal<T>(initialValue: T): Signal<T> — Creates a read-write reactive signal.
  • computed<T>(fn: () => T): ReadonlySignal<T> — Creates a lazily-evaluated cached derivation.
  • effect(fn: () => void | (() => void)): () => void — Creates an active side-effect subscriber. Returns disposal callback.
  • batch<T>(fn: () => T): T — Groups multiple signal mutations into a single topological notification cycle.
  • untrack<T>(fn: () => T): T — Reads signal values without creating a reactive dependency.
  • createStore<T extends object>(initial: T): T — Creates a deep reactive proxy store with fine-grained path tracking.
  • produce<T>(draft: T, fn: (draft: T) => void): void — Performs immutable-style mutable draft updates on store state.
  • reconcile<T>(target: T, source: T): void — Structural state reconciliation algorithm preserving unchanged node references.
  • createRoot<T>(fn: (dispose: () => void) => T): T — Creates an isolated reactive ownership scope with manual teardown.
  • onCleanup(fn: () => void): void — Registers a disposal callback for the active reactive owner.
  • createContext<T>(defaultValue?: T): Context<T> — Creates a dependency injection context identifier.
  • useContext<T>(context: Context<T>): T — Retrieves context value provided by the nearest ancestor provider.

Environment

Universal: Runs in Node.js (>= 18.0.0), Bun, Deno, and all modern browsers (Chrome, Firefox, Safari, Edge).

Security

Zero-eval architecture. Deep reactive stores include built-in prototype pollution scrubbing (__proto__, constructor, prototype keys are blocked).

Related Packages

  • @samrey/runtime — Direct DOM bindings and control flow built on @samrey/reactivity.
  • @samrey/router — Reactive URL routing.
  • @samrey/forms — Reactive form validation and accessible field bindings.