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

simple-html-inpage-router

v0.0.10

Published

Library to navigate between HTML elements in a single document.

Readme

Simple HTML In-Page Router.

Simple Stack based HTML in-page router.

Usage/Examples

Create a class named .hide in youre main css file and use it in every element in the the routing cofiguration except the default route.

.hide {
  display: none;
}

Now use this class with hidden elements at first load.

<div>
  <div id="element-1">
    One <button type="button" onclick="goBack()">Go Back</button
    ><button type="button" onclick="gotoTwo()">Goto 2</button>
  </div>
  <div id="element-2" class="hide">
    Two <button type="button" onclick="goBack()">Go Back</button
    ><button type="button" onclick="gotoThree()">Goto 3</button>
  </div>
  <div id="element-3" class="hide">
    Three <button type="button" onclick="goBack()">Go Back</button
    ><button type="button" onclick="gotoFour()">Goto 4</button>
  </div>
  <div id="element-4" class="hide">
    Four <button type="button" onclick="goBack()">Go Back</button>
  </div>
</div>

The first route should be set to default. If no default is provided, the first route in the list will be used as default.

import SimpleHtmlInPageRouter from 'simple-html-inpage-router'
let router =  SimpleHtmlInPageRouter(
    {
        routes: [
            {
                path: "main",
                element: document.getElementById("element-1"),
                default: true
            },
            {
                path: "2",
                element: document.getElementById("element-2"),
            },
            {
                path: "3",
                element: document.getElementById("element-3"),
            },
            {
                path: "4",
                element: document.getElementById("element-4"),
            }
        ],
        onPop: (curr, next) => {
                    //here you can hide the previous element.
                    curr.classList.add("hide");
                    //here you can show the next element to push to the stack.
                    next.classList.remove("hide");
                },
        onPush: (curr, next) {
                    //here you can hide the element to pop.
                    curr.classList.add("hide");
                    //here you can show the element to diplay as current route.
                    next.classList.remove("hide");
                }
    }
    function gotoTwo(){
        router.push("2");
    }

    function gotoThree(){
        router.push("3");
    }

    function gotoFour(){
        router.push("4");
    }

    function goBack(){
        router.pop();
    }
);

Contributing

Contributions are always welcome! Please use linter before creating a pull request.

License

MIT