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

jizy-template

v2.0.0

Published

Page-template helper: fits a content area between header/footer offsets, exposes content/response callbacks and per-body theme detection.

Readme

jizy-template

Page-template helper. Fits a content area between header/footer offsets, exposes content/response callbacks, and detects per-body theme classes.

Install

npm install jizy-template

Usage

import jTemplate from 'jizy-template';

const template = new jTemplate({
    theme: 'main',                                  // overridden by body class `theme-*` if present
    contentSelector: 'body > main .page-contents',  // element whose min-height is set
    offsetSelectors: ['body > header', 'body > footer'], // summed to compute the offset
    fitToViewport: true,                            // when false, no min-height is applied
});

template.addOnContentDisplayCallback(($content) => {
    // ran on first render and intended for callers to re-call after content swaps
});

template.addResponseCallbacks((data) => { /* every response */ });
template.addHtmlResponseCallbacks((html) => { /* HTML responses */ });
template.addJsonResponseCallbacks((js)   => { /* JSON-`js` payloads */ });

document.addEventListener('DOMContentLoaded', () => template.ready());

Constructor

new jTemplate(options = {})

| Option | Default | Description | |---|---|---| | theme | 'main' | Default theme. Overridden by the first theme-<name> class on <body>. | | contentSelector | 'body > main .page-contents' | Element whose min-height is set to calc(100vh - <offset>px) when fitToViewport is true. | | offsetSelectors | ['body > header', 'body > footer'] | Elements summed (height + vertical paddings) to compute the offset. | | fitToViewport | true | When false, no min-height is applied and offsets are ignored. | | detectBodyTheme | true | When false, ready() skips the theme-* body-class lookup and theme keeps its constructor value. |

Methods

| Method | Description | |---|---| | ready() | Resolve the content + offset elements, run the first display, fit, and bind resize. | | addOnContentDisplayCallback(fn) | Register a callback fired by onContentDisplay(). | | addResponseCallbacks(fn) | Register a callback fired for both HTML and JSON responses. | | addHtmlResponseCallbacks(fn) | Register a callback fired only for HTML responses. | | addJsonResponseCallbacks(fn) | Register a callback fired only for JSON data.js payloads. | | onContentDisplay() | Run all display callbacks against $content. | | applyViewportFit() | Recompute the content min-height from the current offsets. | | onHtmlResponse(html) | Dispatch HTML to response + html callbacks. | | onJsonResponse(data) | Dispatch data.js to response + json callbacks (when present). |

heightOffsetAdjust is exposed as a public property ((offset) => offset by default) so callers can tweak the computed offset before it's applied.

Side effects on ready()

  • Adds/removes the touchable class on <body> based on 'ontouchstart' in document.documentElement.
  • If detectBodyTheme is true and <body> carries a theme-<name> class, replaces this.theme with the matched name.
  • If fitToViewport === false, clears offsetSelectors so no resize work is done.

Browser global

The packaged build attaches window.jTemplate.