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

@pixelation/state

v1.0.0

Published

Composable, reactive state management.

Downloads

4

Readme

@pixelation/state

Composable, reactive state management for the Pixelation Engine.

Installation

npm install @pixelation/state

Usage

import { atom, get, set } from "@pixelation/state";

// Create readable state.
const number = atom(0);

// Change an atom's value.
set(number, 42);

// Get an atom's value.
get(number); // 42

// Derive state from other atoms.
const derived = atom((get) => get(number) * 10);

// Get derived state just like normal state.
get(derived); // 420

// Create write actions for state that take over when `set` is called.
const reset = atom(null, (get, set) => {
    set(number, 0);

    return get(number);
});

// Call a write action.
set(reset);

// Write actions can accept arguments supplied through `set`.
const modify = atom(null, (get, set, value = 0) => {
    set(number, 0);

    return value;
});

// Call a write action with arguments.
set(reset, 9000);

// Write atoms can have derived state.
const double = atom(
    (get) => get(number) * 2,
    (get, set, value) => {
        let current = value;

        if (value === undefined) {
            current = get(number);
        }

        const result = current * 2;

        set(number, result);

        return result;
    }
);

// Interact with read/write atoms just like normal state.
set(double, 1); // 2
get(double); // 2
set(double); // 4

Performance

[!WARNING] Careful construction of the state graph is necessary for responsive games. This library does not perform cycle checking or try to optimize your state graph. It is the responsibility of the programmer using this library to ensure that the code your write is the code that runs.

This library propagates all state changes whenever a call to set is made. Via that call all atoms which depend on the modified atom are queued to update. If any of those atoms change from their previous value, the atoms that depend on it are added to the queue. This process repeats until there are no more atoms to process.