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-effect

v0.3.0

Published

Effect bindings for UI-Router: a framework-agnostic SubscriptionRef of the router's current state

Readme

ui-router-effect

codecov

Effect bindings for UI-Router: a framework-agnostic SubscriptionRef of the router's current state. It imports only effect and @uirouter/core.

lit-ui-router-effect builds Lit controllers on it and re-exports routeRef.

Installation

npm install ui-router-effect effect

Features

  • routeRef(router): a SubscriptionRef<TypedRouteSnapshot> of the current state, params and transition. There is one ref, and one onSuccess hook, per router, attached lazily on first use. Every value it holds is a settled route.
  • pendingRef(router) and errorRef(router): SubscriptionRefs of the newest transition, kept out of RouteSnapshot. Two refs, and one onStart hook, per router, attached lazily on first use of either. pendingRef holds the transition still in flight, cleared when that transition settles, however it settles, unless a newer one has started. errorRef holds that transition's RejectType.ERROR rejection, cleared when the next transition starts.
  • RouteSnapshot and snapshotRoute(router, transition?): the value the ref holds. Its includes() evaluates StateService.includes against the snapshot, not the live router.
  • RouteTypes: an empty interface an app or a registry fills in by module augmentation. Its snapshot member types the ref's value, so a snapshot whose includes(name) is a type predicate narrows current and params. Empty, the ref holds a RouteSnapshot. snapshotRoute stays untyped.

Usage

import { Effect, Stream, SubscriptionRef } from 'effect';
import { routeRef } from 'ui-router-effect';

const names = SubscriptionRef.changes(routeRef(router)).pipe(
  Stream.map((route) => route.current?.name),
  Stream.changes,
);

Effect.runFork(Stream.runForEach(names, (name) => Effect.log(name)));

Loading and error state

import { Effect, Stream, SubscriptionRef } from 'effect';
import { errorRef, pendingRef } from 'ui-router-effect';

const status = Stream.zipLatestWith(
  SubscriptionRef.changes(pendingRef(router)),
  SubscriptionRef.changes(errorRef(router)),
  (pending, error) => (pending ? 'loading' : error ? 'error' : 'idle'),
).pipe(Stream.changes);

Effect.runFork(
  Stream.runForEach(status, (value) =>
    Effect.sync(() => (document.body.dataset.routeStatus = value)),
  ),
);

Dependencies

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