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

@veams/status-quo

v1.1.0

Published

The manager to rule states in frontend.

Downloads

238

Readme

@veams/status-quo

npm version

The manager to rule your state.

This page mirrors the demo content and adds a full API reference.

Table of Contents

  1. Overview
  2. Philosophy
  3. Demo
  4. Quickstart
  5. Handlers
  6. Hooks
  7. Singletons
  8. Composition
  9. Devtools
  10. Cleanup
  11. API Reference
  12. Migration

Overview

StatusQuo is a small, framework-agnostic state layer that focuses on explicit lifecycle, clear action APIs, and a minimal subscription surface. It ships two handler implementations with the same public interface: RxJS-backed observables and signals-backed stores.

Philosophy

  • Swap the engine, keep the API. Your UI code stays the same when you switch from RxJS to Signals.
  • Separate view and state. Handlers own transitions and expose actions; views subscribe to snapshots.
  • Framework-agnostic core. Business logic lives outside the UI library; hooks provide the glue.

Demo

Live docs and demo:

https://veams.github.io/status-quo/

Quickstart

Install:

npm install @veams/status-quo rxjs @preact/signals-core

Create a store and use it in a component:

import { ObservableStateHandler, useStateFactory } from '@veams/status-quo';

type CounterState = { count: number };

type CounterActions = {
  increase: () => void;
  decrease: () => void;
};

class CounterStore extends ObservableStateHandler<CounterState, CounterActions> {
  constructor() {
    super({ initialState: { count: 0 } });
  }

  getActions(): CounterActions {
    return {
      increase: () => this.setState({ count: this.getState().count + 1 }),
      decrease: () => this.setState({ count: this.getState().count - 1 }),
    };
  }
}

const [state, actions] = useStateFactory(() => new CounterStore(), []);

Handlers

StatusQuo provides two handler implementations with the same public interface:

  • ObservableStateHandler (RxJS-backed)
  • SignalStateHandler (Signals-backed)

Both are built on BaseStateHandler, which provides the shared lifecycle and devtools support.

Hooks

  • useStateFactory(factory, deps)
    • Creates a handler instance per component and subscribes to its snapshot.
    • Suitable for per-component or per-instance state.
  • useStateSingleton(singleton)
    • Uses a shared singleton handler across components.

Singletons

import { makeStateSingleton, useStateSingleton } from '@veams/status-quo';

const CounterSingleton = makeStateSingleton(() => new CounterStore());

const [state, actions] = useStateSingleton(CounterSingleton);

Composition

Use only the slice you need. RxJS makes multi-source composition powerful and declarative with operators like combineLatest, switchMap, or debounceTime. Signals can derive values with computed and wire them into a parent store via bindSubscribable.

import { combineLatest } from 'rxjs';

// RxJS: combine handler streams (RxJS shines here)
class AppSignalStore extends SignalStateHandler<AppState, AppActions> {
  private counter$ = CounterObservableStore.getInstance().getStateAsObservable();
  private card$ = new CardObservableHandler();

  constructor() {
    super({ initialState: { counter: 0, cardTitle: '' }});

    this.subscriptions.push(
      combineLatest([
        this.counter$,
        this.card$,
      ]).subscribe(([counterState, cardState]) => {
        this.setState({
          counter: counterState,
          cardTitle: cardState.title,
        }, 'sync-combined');
      })
    )
  }

}

// Signals: combine derived values via computed + bindSubscribable
import { computed } from '@preact/signals-core';

class AppSignalStore extends SignalStateHandler<AppState, AppActions> {
  private counter = CounterSignalHandler.getInstance();
  private card = new CardSignalHandler();
  private combined$ = computed(() => ({
    counter: this.counter.getSignal().value,
    cardTitle: this.card.getSignal().value.title,
  }));

  constructor() {
    super({ initialState: { counter: 0, cardTitle: '' }});

    this.bindSubscribable(
      { subscribe: this.combined.subscribe.bind(this.combined), getSnapshot: () => this.combined.value },
      (nextState) => this.setState(nextState, 'sync-combined')
    );
  }
}

Devtools

Enable Redux Devtools integration with options.devTools:

class CounterStore extends ObservableStateHandler<CounterState, CounterActions> {
  constructor() {
    super({
      initialState: { count: 0 },
      options: { devTools: { enabled: true, namespace: 'Counter' } },
    });
  }
}

Cleanup

Handlers expose subscribe, getSnapshot, and destroy for custom integrations:

const unsubscribe = store.subscribe(() => {
  console.log(store.getSnapshot());
});

unsubscribe();
store.destroy();

API Reference

StateSubscriptionHandler<V, A>

Required interface implemented by all handlers.

interface StateSubscriptionHandler<V, A> {
  subscribe: (listener: () => void) => () => void;
  getSnapshot: () => V;
  destroy: () => void;
  getInitialState: () => V;
  getActions: () => A;
}

BaseStateHandler<S, A>

Shared base class for all handlers.

Constructor:

protected constructor(initialState: S)

Public methods:

  • getInitialState(): S
  • getState(): S
  • getSnapshot(): S
  • setState(next: Partial<S>, actionName = 'change'): void
  • subscribe(listener: () => void): () => void (abstract)
  • destroy(): void
  • getActions(): A (abstract)

Protected helpers:

  • getStateValue(): S (abstract)
  • setStateValue(next: S): void (abstract)
  • initDevTools(options?: { enabled?: boolean; namespace: string }): void
  • bindSubscribable<T>(service: { subscribe: (listener: (value: T) => void) => () => void; getSnapshot?: () => T }, onChange: (value: T) => void): void
    • Registers the subscription on this.subscriptions and invokes onChange with the current snapshot when available.

ObservableStateHandler<S, A>

RxJS-backed handler. Extends BaseStateHandler.

Constructor:

protected constructor({
  initialState,
  options
}: {
  initialState: S;
  options?: {
    devTools?: { enabled?: boolean; namespace: string };
  };
})

Public methods:

  • getStateAsObservable(options?: { useDistinctUntilChanged?: boolean }): Observable<S>
  • getStateItemAsObservable(key: keyof S): Observable<S[keyof S]>
  • getObservableItem(key: keyof S): Observable<S[keyof S]>
  • subscribe(listener: () => void): () => void

Notes:

  • The observable stream uses distinctUntilChanged by default (JSON compare).
  • subscribe does not fire for the initial value; it only fires on subsequent changes.

SignalStateHandler<S, A>

Signals-backed handler. Extends BaseStateHandler.

Constructor:

protected constructor({
  initialState,
  options
}: {
  initialState: S;
  options?: {
    devTools?: { enabled?: boolean; namespace: string };
    useDistinctUntilChanged?: boolean;
  };
})

Public methods:

  • getSignal(): Signal<S>
  • subscribe(listener: () => void): () => void

Notes:

  • useDistinctUntilChanged defaults to true (JSON compare).

makeStateSingleton

function makeStateSingleton<S, A>(
  factory: () => StateSubscriptionHandler<S, A>
): {
  getInstance: () => StateSubscriptionHandler<S, A>;
}

Hooks

  • useStateFactory<V, A, P extends unknown[]>(factory: (...args: P) => StateSubscriptionHandler<V, A>, params?: P)
    • Returns [state, actions].
  • useStateSingleton<V, A>(singleton: StateSingleton<V, A>)
    • Returns [state, actions].

Migration

From pre-1.0 releases:

  1. Rename StateHandler -> ObservableStateHandler.
  2. Implement subscribe() and getSnapshot() on custom handlers.
  3. Replace getObservable() usage with subscribe() in custom integrations.
  4. Update devtools config:
    • From: super({ initialState, devTools: { ... } })
    • To: super({ initialState, options: { devTools: { ... } } })