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

@academix-admin/overlay-route

v0.1.0

Published

Give a sheet, picker or dialog its own history entry, so the platform's back gesture closes the overlay rather than the page under it.

Downloads

175

Readme

@academix-admin/overlay-route

Give a sheet, picker or dialog its own history entry, so the platform's own Back closes the overlay rather than the page under it.

Without one, Back with a picker open closes the picker and leaves the page behind it. Measured in a real shop: the back gesture walked straight out of a half-built sale.

import { useOverlayRoute } from '@academix-admin/overlay-route';

const [open, setOpen] = useState(false);
useOverlayRoute('cart:picker', open, () => setOpen(false));

That is the whole API for most consumers. The name must be unique among overlays that can be open at the same time, or they mistake each other's entry.

Surviving a reload

The fragment outlives a refresh, so an app can come back with #ax=… naming a sheet. Pass onRestore and the overlay reopens exactly where it was left:

useOverlayRoute('cart:picker', open, () => setOpen(false), {
  onRestore: () => setOpen(true),
});

This needs a name that is stable across loads: 'cart:picker' restores, `picker:${useId()}` cannot, because the id is new every time.

An overlay that does not restore is closed for you. A URL naming a sheet nobody is showing costs a whole Back press — the user pressing it twice to leave one page, which is exactly how a web app stops feeling like a real one.

Working alongside a navigation library

An overlay's entry is a real history entry, and a navigation library that pops pages with history.go(-n) has to count it: go counts positions in the browser's single global list, so an entry it does not know about leaves every later pop short by one.

Neither package should have to know the other exists. They meet at one function:

import { setHistoryWriter } from '@academix-admin/overlay-route';

setHistoryWriter(({ mode, href, state }) => {
  // write it, and record it in your own ledger
});

@academix-admin/navigation-stack does this on import — no wiring, no provider. Nothing registers? The default writer is used and everything here still works; there is simply no ledger to join.

What it does to the URL

State lives in the URL fragment, because a fragment write never reaches the server, so opening a sheet cannot trigger a server render. The fragment is not ours, though — #section-3 deep links and scrollIntoView anchors are ordinary site behaviour — so this owns exactly one &-separated ax= segment and passes every other one through untouched, in its original order.

API

| | | |---|---| | useOverlayRoute(name, open, onClose, opts?) | The hook. opts.onRestore reopens after a reload. | | readOverlayFragment() | The overlay named in the URL now, or null. | | writeOverlayFragment(name, mode) | Write the segment directly. | | closeUnrestoredOverlay() | Close one the URL names but nothing showed. | | settleOverlayFragment() | Schedule that, once, after the first frames. | | claimOverlay / releaseOverlay / isOverlayClaimed / overlayClaims | Say what is on screen. | | setHistoryWriter(fn) | Hand history writing to a navigation library. | | parseFragment / buildFragment / setInFragment | The pure codec. |