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

ui-router-mobx

v0.3.0

Published

MobX bindings for UI-Router: a framework-agnostic observable store of the router's current state

Readme

ui-router-mobx

codecov

MobX bindings for UI-Router: a framework-agnostic observable store of the router's current state. It imports only mobx and @uirouter/core.

lit-ui-router-mobx builds Lit controllers on it and re-exports RouterStore.

Installation

npm install ui-router-mobx mobx

Features

  • RouterStore.for(router): the observable store for a router. There is one store, and one onSuccess and one onStart hook, per router, attached lazily on first use.
  • current, params and transition: the current state declaration, a fresh plain copy of the params, and the most recent successful transition. Each is replaced per transition, never mutated, so reactions compare them by reference.
  • pending and error: the newest transition still in flight, and that transition's RejectType.ERROR rejection; undefined otherwise. pending is set on start and cleared when that transition settles, however it settles, unless a newer one has started; error is cleared when the next transition starts. One MobX action writes both.
  • includes(stateOrName, params?): an observable StateService.includes, glob patterns such as 'admin.**' included.
  • RouteTypes: an empty interface an app or a registry fills in by module augmentation. Its snapshot member types current, params and the targets includes takes, and its snapshots member, keyed by state name, lets includes(name) narrow current and params to that state's subtree. Empty, the store's types are StateDeclaration, RawParams and StateOrName.
  • attach(router): for managing a new RouterStore() yourself. It returns the hooks' deregistration function and throws if the store already mirrors a different router.

Usage

Any MobX reaction, autorun or computed that reads the store re-runs when the values it reads change, with no transition hooks of its own:

import { reaction } from 'mobx';
import { RouterStore } from 'ui-router-mobx';

const store = RouterStore.for(router);

const dispose = reaction(
  () => store.includes('admin.**'),
  (inAdmin) => console.log(inAdmin ? 'entered admin' : 'left admin'),
);

Loading and error state

const dispose = reaction(
  () => (store.pending ? 'loading' : store.error ? 'error' : 'idle'),
  (status) => (document.body.dataset.routeStatus = status),
);

MobX 6 and 7

Both majors are supported (mobx@^6.0.0 || ^7.0.0) and both are exercised in CI. The store's own API is identical on either.

Dependencies

@uirouter/core and mobx are peer dependencies. lit and lit-ui-router are not, and the bundleProbe claim in package.json holds the entry free of them.