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

ngrx-fsm-signal

v1.0.0

Published

**NgRx SignalStore finite state machine for Angular component UI state.**

Readme

ngrx-fsm-signal

NgRx SignalStore finite state machine for Angular component UI state.

Same idea as ngrx-fsm: declare allowed event → state transitions per component. Instead of intercepting @ngrx/store actions via ActionsSubject, you call ComponentStateMachine.dispatch() / .run() and state lives in an @ngrx/signals signalStore.

  • Valid → update the component’s state signal, optionally forward / transform the event for your handler
  • Invalid → block the event and record blocked telemetry on the store

Why signals?

Use this package when your app is on @ngrx/signals (or mixed) and you do not want a global ActionsSubject swap. The fluent builder API matches ngrx-fsm so migration between the two is straightforward.

Installation

yarn add ngrx-fsm-signal @ngrx/signals
# or
npm install ngrx-fsm-signal @ngrx/signals

Peer dependencies: @angular/core, @angular/common, @ngrx/signals.

Setup

import { bootstrapApplication } from '@angular/platform-browser';
import {
  provideComponentStateFsm,
  ComponentStateBuilder,
  ComponentStateService,
  ComponentStateMachine,
  ComponentStateFacade,
} from 'ngrx-fsm-signal';

bootstrapApplication(AppComponent, {
  providers: [provideComponentStateFsm()],
});

Declare transitions

import {
  ComponentStateBuilder,
  ComponentStateEnum,
  ComponentStateService,
} from 'ngrx-fsm-signal';

const componentName = 'UsersComponent';

const componentStates = this.componentStateBuilder
  .create(componentName)
  .forAction('users/init')
  .fromState(ComponentStateEnum.Idle)
  .toState(ComponentStateEnum.Processing)
  .passThrough()
  .forAction('users/loadSuccess')
  .fromState(ComponentStateEnum.Processing)
  .toState(ComponentStateEnum.Completed)
  .passThrough()
  .build();

this.componentStateService.addComponentStates(componentStates);

Unregister on destroy:

ngOnDestroy(): void {
  this.componentStateService.removeComponentStates(componentName);
}

Dispatch events

import { ComponentStateMachine } from 'ngrx-fsm-signal';

// Option A — inspect the result
const result = this.machine.dispatch({ type: 'users/init' });
if (result.forwarded) {
  this.loadUsers();
}

// Option B — run handler only when forwarded (passthrough / transform)
this.machine.run({ type: 'users/init' }, () => this.loadUsers());

Modes

| Mode | Builder | Behavior | | --------------- | ------------------ | ------------------------------------------------------ | | passthrough | .passThrough() | Transition + forwarded: true with the original event | | terminate | .terminate() | Transition only; do not run side effects | | transform | .transformTo(fn) | Transition + forward the event returned by fn |

Blocked transitions set lastBlocked on the signal store (state unchanged).

Observe UI state (signals)

readonly processing = this.facade.processing('UsersComponent');
readonly state = this.facade.stateOf('UsersComponent');
readonly all = this.facade.componentState; // Signal<ComponentStateMap>

// Telemetry
readonly lastTransition = this.facade.lastTransition;
readonly lastBlocked = this.facade.lastBlocked;

Multi-instance (withId)

this.componentStateBuilder
  .create(`UserCard-${id}`)
  .withId(id)
  .forAction('card/load')
  .fromState(ComponentStateEnum.Idle)
  .toState(ComponentStateEnum.Processing)
  .passThrough()
  .build();

this.machine.dispatch({ type: 'card/load', componentStateId: id });

API exports

provideComponentStateFsm;
ComponentStateStore;
ComponentStateBuilder;
ComponentStateService;
ComponentStateMachine;
ComponentStateFacade;
ComponentStateEnum;
passthroughComponentState;
PASSTHROUGH_EVENT_TYPE;

License

See the repository root for license information.