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

@zilker-trail/zt-library

v1.0.3

Published

ZT Utility Library - DOM observers, triggers, and utilities

Readme

ZT Library

ZT Library is a lightweight, modular JavaScript utility library designed to help developers:

  • Observe DOM mutations efficiently
  • Detect when elements appear/disappear
  • Handle conditional triggers
  • Manage cookies and storage
  • Create reactive DOM behavior
  • Provide optional debugging through an env‑controlled logger

It is written with ES Modules and is compatible with modern browsers.


Features

MutationObserver Utilities

  • Observe DOM changes efficiently.
  • Track added/removed elements, attribute changes, and text content updates.

Element Appearance Utilities

  • onAppearAll(selectors, callback, options): Wait until all selectors are present in the DOM.
  • onAppearAny(selectors, callback, options): Wait until any selector is present in the DOM.

Conditional Triggers

  • triggerOn(config, callback): Execute callbacks based on DOM conditions, URL checks, timeouts, intervals, or logical AND/OR conditions.

Storage Utilities

  • localStorage: get, set, del
  • sessionStorage: get, set, del

Cookie Utilities

  • utils.cookie.set(name, value, days): Set a cookie with optional expiration.
  • utils.cookie.get(name): Get a cookie value.
  • utils.cookie.del(name): Delete a cookie.

Object Utilities

  • patch(target, source): Merge properties from a source object into a target object.

Installation

From NPM

npm i @zilker-trail/zt-library

Usage Examples

Observing DOM Changes

const observer = ztLibrary.createObserver((node, mutationType) => {
  console.log('Mutation detected:', mutationType, node);
}, { childList: true, subtree: true });

Wait for Elements

ztLibrary.onAppearAll(['#header', '.menu'], elements => {
  console.log('All elements appeared:', elements);
});

ztLibrary.onAppearAny(['.modal', '.popup'], element => {
  console.log('One of the elements appeared:', element);
});

Trigger on Conditions

ztLibrary.triggerOn({
  condition: 'domElement',
  options: { selector: '#main-content', timeout: 5000 }
}, () => {
  console.log('Main content appeared!');
});

ztLibrary.triggerOn({
  condition: 'url',
  type: 'pass',
  options: { includes: '/dashboard' }
}, () => {
  console.log('User is on the dashboard page');
});

Cookies

ztLibrary.utils.cookie.set('userToken', 'abc123', 7);
const token = ztLibrary.utils.cookie.get('userToken');
ztLibrary.utils.cookie.del('userToken');

Local Storage

ztLibrary.utils.localStorage.set('theme', 'dark');
const theme = ztLibrary.utils.localStorage.get('theme');
ztLibrary.utils.localStorage.del('theme');

Patching Objects

const obj = { a: 1 };
ztLibrary.utils.patch(obj, { b: 2, c: 3 });
console.log(obj); // { a: 1, b: 2, c: 3 }

Logging

ztLibrary.setDebuggedMode(bool)

Controlled via the localStorage key zt_debugger.

When enabled, logs info, warnings, and errors to the console for debugging purposes.

Analytics

ztLibrary.setAnalyticsDisabled(bool)

You can disable analytics via the localStorage key zt_analytics.