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

@damienmortini/damdom-gallery

v0.0.17

Published

<damdom-gallery> custom element.

Readme

<damdom-gallery>

Installation

npm install @damienmortini/damdom-gallery

Simple Usage

<script src="node_modules/@damienmortini/damdom-gallery/index.js"></script>

<damdom-gallery>
  <my-first-demo></my-first-demo>
  <my-second-demo></my-second-demo>
</damdom-gallery>

Each child becomes an item in the grid with a control that expands it, and the expanded item gets a control that collapses it again. highlighted is the expanded child, settable from script, and the element fires highlightchange when it moves:

gallery.highlighted = gallery.querySelector('my-second-demo');

A control is named after the item it acts on, read from that item's aria-label, title, or tag name, so name an item to name its control.

Selection

Pressing an item selects it, and expanding one selects it too. selected is that child, settable from script, it carries a selected attribute, and the element fires selectchange when it moves. The selected item lifts off the grid, and a control anchored just above its top-right corner deselects it, as do Escape and a click anywhere outside it while it sits in the grid. Read the new value from selected in a selectchange listener, as with highlighted.

A selected item gets touch gestures and the mouse wheel, and its own touch-action says which of them the page keeps: an item with touch-action: none keeps dragging and the wheel for itself, and a "Scroll locked" pill beside the deselect control says so; one that allows vertical panning still lets the page scroll. Any other item lets the page pan and scroll as usual, and its content never sees wheel events: the gallery stops them on the way in, so the page's own bubbling wheel listeners do not see them either. That makes selection the natural switch for items that are interactive or expensive to run:

gallery.addEventListener('selectchange', () => {
  for (const item of gallery.children) item.toggleAttribute('running', item === gallery.selected);
});

Color scheme

The built-in look follows the page's color-scheme and declares none of its own, so a page that offers a light/dark control sets the scheme itself:

document.documentElement.style.colorScheme = 'dark';

Styling

Retune the look through custom properties:

| Property | Styles | | --- | --- | | --damo-gallery-background | the grid and the expanded view behind the items | | --damo-gallery-color | text inside both | | --damo-gallery-item-background | each item's card | | --damo-gallery-item-radius | its corners | | --damo-gallery-item-outline | its edge | | --damo-gallery-item-shadow | its shadow | | --damo-gallery-item-hover-scale | how far a hovered item lifts | | --damo-gallery-item-hover-shadow | its shadow | | --damo-gallery-item-selected-scale | how far the selected item lifts | | --damo-gallery-item-selected-shadow | its shadow | | --damo-gallery-control-background | the expand and collapse controls | | --damo-gallery-control-color | their icons | | --damo-gallery-control-border | their edge | | --damo-gallery-control-radius | their corners | | --damo-gallery-control-shadow | their shadow | | --damo-gallery-control-inset | their distance from the item's corner |

Reach the internals with ::part(grid), ::part(item), ::part(control), ::part(selection) for the selected item's toolbar, and ::part(indicator) for its "Scroll locked" pill.

Switch the whole look off with --damo-appearance: base. It takes away only the appearance, leaving layout, controls and behaviour, so the gallery still works while the page dresses it. The property is inherited, so setting it on an ancestor covers anything else that reads it:

damdom-gallery {
  --damo-appearance: base;
}

Usage with custom name

<script type="module">

  import Element from '@damienmortini/damdom-gallery';

  window.customElements.define('my-element-name', class extends Element { });

</script>

<my-element-name></my-element-name>