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

senangwebs-herd

v1.0.0

Published

A lightweight web library for managing multiple HTML files within a single page using tabs and lazy-loaded iframes

Readme

SenangWebs Herd (SWH)

A lightweight web library for managing multiple HTML files within a single page using tabs and lazy-loaded iframes.

SenangWebs Herd Preview

Features

  • Tabbed multi-page interface - Manage multiple HTML screens in one window
  • Lazy-loaded iframes - Iframe loads only when first activated
  • State persistence - Open tabs and active tab preserved after refresh
  • Dynamic tab management - Open and close tabs during runtime
  • Cross-origin communication support - Use window.postMessage for secure data exchange

Installation

Direct Include

<link rel="stylesheet" href="https://unpkg.com/senangwebs-herd@latest/dist/swh.min.css">
<script src="https://unpkg.com/senangwebs-herd@latest/dist/swh.min.js"></script>

Build from Source

# Install dependencies
npm install

# Build for production
npm run build

# Build for development (with source maps)
npm run build:dev

# Watch mode for development
npm run watch

Quick Start

HTML Attribute Initialization

<link rel="stylesheet" href="https://unpkg.com/senangwebs-herd@latest/dist/swh.min.css">
<div data-swh
     data-swh-storage-key="my-app-tabs"
     data-swh-default-tab="home"
     data-swh-allow-close
     data-swh-max-tabs="5">

    <div data-swh-tabs>
        <button data-swh-tab="home">Home</button>
        <button data-swh-tab="about">About</button>
    </div>

    <div data-swh-content>
        <iframe data-swh-iframe="home" data-url="home.html"></iframe>
        <iframe data-swh-iframe="about" data-url="about.html"></iframe>
    </div>
</div>

<script src="https://unpkg.com/senangwebs-herd@latest/dist/swh.min.js"></script>

JavaScript Initialization

<link rel="stylesheet" href="https://unpkg.com/senangwebs-herd@latest/dist/swh.min.css">

<div id="my-swh">
    <div id="swh-tabs"></div>
    <div id="swh-content"></div>
</div>

<script src="https://unpkg.com/senangwebs-herd@latest/dist/swh.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
    const swh = new SWH({
        container: document.querySelector('#my-swh'),
        tabsContainer: document.querySelector('#swh-tabs'),
        contentContainer: document.querySelector('#swh-content'),
        presetTabs: [
            { id: "home", title: "Home", url: "home.html" },
            { id: "about", title: "About", url: "about.html" }
        ],
        storageKey: "my-app-tabs",
        defaultTab: "home",
        allowClose: true,
        maxTabs: 5
    });
});
</script>

API Reference

Methods

| Method | Description | |--------|-------------| | openTab(id, title, url) | Opens a new tab with the specified ID, title, and URL | | closeTab(id) | Closes the tab with the specified ID | | switchTab(id) | Switches to the tab with the specified ID | | getOpenTabs() | Returns an array of currently open tabs | | getActiveTab() | Returns the currently active tab ID | | clearTabs() | Closes all tabs and clears state from localStorage | | reloadTab(id) | Reloads the iframe content of the specified tab | | persistState() | Saves the current tab state to localStorage | | restoreState() | Restores tab state from localStorage | | on(event, callback) | Registers an event listener | | off(event, callback) | Unregisters an event listener |

Events

| Event | Description | |-------|-------------| | tabOpened | Fired when a new tab is created | | tabClosed | Fired when a tab is removed | | tabSwitched | Fired when the active tab changes | | tabLoaded | Fired when an iframe finishes loading | | maxTabsReached | Fired when trying to exceed maxTabs limit |

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | container | HTMLElement | required | The container element for SWH | | tabsContainer | HTMLElement | required | Element to hold tab buttons | | contentContainer | HTMLElement | required | Element to hold iframe content | | presetTabs | Array | [] | Initial tabs to create on load | | storageKey | string | "swh-tabs" | LocalStorage key for tab state | | defaultTab | string | null | Tab to activate if no previous state exists | | allowClose | boolean | false | Enable UI to close tabs | | maxTabs | number | Infinity | Maximum open tabs at once |

Examples

Check the examples/ directory for working demonstrations:

  • basic-html-attribute.html - Simple HTML-based initialization
  • javascript-init.html - Programmatic initialization with dynamic controls
  • event-handling.html - Event system demonstration with monitoring

Use Cases

Best

  • Dashboards
  • Admin panels
  • Internal tools
  • Modular web applications

Not suitable for

  • SEO landing pages
  • Content websites
  • Public-facing marketing sites

Browser Compatibility

  • Chrome/Edge (latest)
  • Firefox (latest)
  • Safari (latest)
  • Opera (latest)

Requires ES6+ support.

Development

Build Commands

npm run build       # Production build (minified)
npm run build:dev   # Development build (with source maps)
npm run watch       # Watch mode for development

License

MIT License - see LICENSE.md for details

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.


Note: SWH is designed for internal applications and is not optimized for SEO or search engine indexing.