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

@excom/listenable-element

v0.2.2

Published

ListenableElement base for Neutron elements

Readme

listenable-element

Declarative event and lifecycle listening for Neutron elements — filter, debounce, vibrate, and hand off to your actionHandler.

Features

  • Event / lifecycle hooks Listen for DOM events or connected / disconnected / adopted
  • Host retarget host-ref="window" / document / any selector — Escape to dismiss, shortcuts outside the bubble path
  • Target filters Selector, keycode (shift+k chords), and pathname gates
  • Debounce / delay Coalesce noisy input
  • Event hygiene prevent-default / stop-propagation / stop-immediate-propagation
  • Haptic pulse Optional vibrate-ms on handle

Installation

@excom/listenable-element v0.2.2

pnpm add @excom/listenable-element
npm install @excom/listenable-element
yarn add @excom/listenable-element

Import

import { /* … */ } from "@excom/listenable-element";

Usage

Compose ListenableElement and implement actionHandler. Concrete consumers include <spa-a> and <event-handler>.

import { Neutron } from "@excom/neutron";
import { ListenableElement } from "@excom/listenable-element";

export const TapLog = Neutron.compose([
  ListenableElement,
  Neutron({ tag: "tap-log" }),
])
  .defineMethods({
    actionHandler: (_el, e) => {
      console.log("handled", e.type);
    },
  });

TapLog.define();
<tap-log listen-for="click keydown" keycode-filter="enter">
  Tap or Enter
</tap-log>

host-ref moves listening off :scope — e.g. host-ref="window" for global keydown. See <event-handler> for Escape-to-dismiss examples.

API Reference

Attributes

| Name | Surface | Type | Default | Values | Description | | --- | --- | --- | --- | --- | --- | | host-ref | option | string | | <CSS Selector> | "window" | "document" | "html" | "body" | "head" | Listen on another element / window / document — e.g. Escape to dismiss a dialog from a global keydown. Defaults to :scope. Used with listen-for. Not compatible with listen-for-lifecycle. The selector MUST resolve when host-ref is set — it will not wait for a match to appear. | | listen-for | option | tokenlist | | <EventName>… | Space-separated event names to listen for. Defaults to click when unset (and no lifecycle list is set). | | listen-for-lifecycle | option | tokenlist | | "connected" | "disconnected" | "adopted" | Space-separated element lifecycles to handle. | | listen-once | option | boolean | | | Handle each distinct event name / lifecycle at most once. | | selector-filter | option | string | | <CSS Selector> | Only handle events whose event.target matches this CSS selector. Does not support :scope in the selector. | | keycode-filter | option | tokenlist | | <key | mod+key>… | Space-separated key filters (OR). Join modifiers with + (AND, any order): shift+k tab → Shift+K or Tab. Modifiers: shift, alt, ctrl/control, meta/cmd. Name the space bar space / spacebar and the plus key plus (shift+space). Case-insensitive. | | pathname-filter | option | tokenlist | | <pathname>… | Only handle when location.pathname is one of these values — route-aware behaviors without a separate router element. | | prevent-default | option | boolean | | | Call preventDefault() on matched events (ignored for lifecycles). | | stop-propagation | option | boolean | | | Call stopPropagation() on matched events (ignored for lifecycles). | | stop-immediate-propagation | option | boolean | | | Call stopImmediatePropagation() on matched events (ignored for lifecycles). | | vibrate-ms | option | number | "20 (when attribute is present with no value)" | | Vibrate on handle (navigator.vibrate). Empty / 0 uses a 20ms pulse. | | delay-ms | option | number | | | Delay handling by this many milliseconds. | | is-debounced | option | boolean | | | With delay-ms, coalesce bursts into one trailing call (debounce). |

Examples

Default click → navigate

<spa-a> inherits this base and defaults to click when listen-for is unset:

<spa-a route-href="/pricing">Pricing</spa-a>

Filter & debounce

<event-handler
  listen-for="input"
  delay-ms="200"
  is-debounced
  fire-event="search-query"
>
  <input name="q" />
</event-handler>

See <event-handler> and <spa-a> package docs for more examples built on this mixin.

Release notes

0.2.0 (2026-09-30)

  • Add the key names space / spacebar and plus to keycode-filter (shift+space), and cmd as an alias of meta
  • Update a keycode-filter holding only spaces to match no key and warn once (it was no filter); write space for the space bar

0.1.1 (2026-09-23)

  • Ship only dist (and declared extras) in the npm tarball; drop build logs, tests and sources

Full documentation: https://nucleus.excom.dev/packages/listenable-element