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/dom-observer

v0.1.4

Published

<dom-observer> custom element that resolves a target via a CSS selector and fires events on its mutations.

Readme

dom-observer

Fire an event whenever a configured element mutates.

<div>
  <section>
    <dom-observer target-ref=":scope + details"></dom-observer>
    <details id="do-watched">
      <summary>Toggle me — mutates the "open" attribute</summary>
      <p>Toggling this
        fired <code>dom-observer-change</code>.</p>
    </details>
    <output></output>
  </section>
  <quark-sheet>
    section {
      @on dom-observer-change {
        output { content: "#{event.detail.mutations.length} mutation(s), open: #{event.detail.target.open}"; }
      }
    }
  </quark-sheet>
</div>

Features

  • Mutation events Fires dom-observer-change on target changes
  • Selector-based target-ref resolves any element, anywhere
  • Waits for its target No matching element yet? It watches for one
  • Fires once immediately An empty-mutations fire on resolve lets listeners seed from current state
  • <template>-aware Also observes a template's .content fragment

Installation

@excom/dom-observer v0.1.4

pnpm add @excom/dom-observer
npm install @excom/dom-observer
yarn add @excom/dom-observer

Import

import "@excom/dom-observer";

Usage

Point target-ref at any selector, then react to dom-observer-change with <event-handler> (or Quark).

<dom-observer target-ref="#watched"></dom-observer>
<event-handler listen-for="dom-observer-change" target-ref="#log">
  <!-- runs on every #watched mutation, and once on attach -->
</event-handler>

API Reference

Attributes

| Name | Surface | Type | Default | Values | Description | | --- | --- | --- | --- | --- | --- | | target-ref | option | string | | | CSS selector used to resolve the element to observe. Resolved against document. If no element matches at connect time, the element waits for one to appear. | | target-element | state | HTMLElement | | | The currently observed target element (if any). | | target-finding-observer | state | MutationObserver | | | Document-level observer used to wait for a target matching target-ref to appear. Disconnected as soon as the target is found. | | target-change-observer | state | MutationObserver | | | Observer attached to the resolved targetElement (and to its .content fragment when the target is a <template>). |

Fires

| Name | Type | Description | | --- | --- | --- | | dom-observer-change | DomObserverChangeEvent (CustomEvent & { type: "dom-observer-change"; detail: { target: Element; mutations: MutationRecord[]; }; bubbles: true; cancelable: true; composed: true }) | Fires whenever the resolved target mutates, and once immediately (with mutations: []) as soon as the target is resolved so listeners can seed from current state. mutations is the MutationRecord[] from the underlying MutationObserver callback (empty on that first fire). |

Examples

Waiting for the target to exist

If nothing matches target-ref at connect time, <dom-observer> watches the document for a match and switches over automatically — no glue code:

<dom-observer target-ref="article#late"></dom-observer>

Observing a <template>

A <template>'s authored content lives on its .content DocumentFragment, not as DOM descendants of the <template> itself. <dom-observer> observes both, so mutations to either surface through the same event stream:

<template id="rows">
  <li>seed</li>
</template>
<dom-observer target-ref="#rows"></dom-observer>

Release notes

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/dom-observer