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

@hootlens/types

v0.1.0

Published

TypeScript types for the Hoot Lens script tag: the window.hootlens command queue, window.Hootlens, the status object and the data-hoot-* attributes.

Readme

@hootlens/types

TypeScript types for the Hoot Lens script tag. They type the window.hootlens command queue, the window.Hootlens API, the status and diagnostics objects, and the data-hoot-* attributes, so editors and coding agents see the real command list and a mistyped command fails to compile.

The package contains declarations only and has no runtime code or dependencies.

Install

npm install --save-dev @hootlens/types

Include the types once, in a file your tsconfig covers (for example src/hootlens.d.ts):

import '@hootlens/types';

or list the package in compilerOptions.types:

{ "compilerOptions": { "types": ["@hootlens/types"] } }

The command queue

(window.hootlens = window.hootlens || []).push(['consent', true]);

window.hootlens.push(['pageVersion', 'pricing-v3']);
window.hootlens.push(['onStatus', (status) => { /* status: HootlensStatus */ }]);

window.hootlens.push(['nope']); // error: not a Hoot Lens command

HootlensCommand is the union of every command the tag runs: consent, consentSource, release, variant, pageVersion, stop, start, flush, onStatus, diagnostics, init and notice. Inside a callback pushed this way, annotate the parameter ((status: HootlensStatus) => ...), because TypeScript does not infer it through the union.

The API

import type { HootlensStatus } from '@hootlens/types';

const status: HootlensStatus | undefined = window.Hootlens?.status();

window.Hootlens is typed as HootlensApi: init, start, setConsent, setLabels, flush, stop, reset, getTracker, status, onStatus, diagnostics, createTracker and privacySignalPresent. The same types describe the exports of the tracker's ESM entry. Also exported: HootlensState, HootlensReason, HootlensDiagnostics, HootlensOptions, HootlensLabels, HootlensTracker and HootlensAttributes.

The data-hoot-* attributes

| Attribute | Value | Meaning | | --- | --- | --- | | data-hoot-id | string | Stable name for a control; the click selector and target. | | data-hoot-name | string | Readable name shown next to the selector. | | data-hoot-label | string | Older spelling of data-hoot-name. | | data-hoot-private | present | Replaces the element in replays; clicks inside are attributed to the region. | | data-hoot-dynamic | present | Leaves the content out of the page fingerprint. | | data-hoot-region | string | Public key for a meaningful region. | | data-hoot-version | string | The region's edition. |

React (add once, in any file your tsconfig covers):

import '@hootlens/types/react';
<section data-hoot-region="pricing" data-hoot-version="pricing-v2">
  <button data-hoot-id="pricing-start-trial">Start trial</button>
</section>

React already accepts any hyphenated attribute, so this adds editor completion and rejects wrong value types such as data-hoot-id={5}.

Vue 3 (import '@hootlens/types/vue';) and Svelte (/// <reference types="@hootlens/types/svelte" /> in src/app.d.ts) use the same attribute list. These two entries are small module augmentations that this repository does not compile against Vue or Svelte; the React entry and the global types are type-checked in CI.

Kept in step with the tracker

The command union, the status, diagnostics, option and tracker types, and the keys of window.Hootlens are checked against the tracker's source in the Hoot Lens repository. A command or field added to the tracker fails CI until it is added here.

License

MIT