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

elementsnap

v1.0.0

Published

A framework-agnostic vanilla TypeScript library that captures selected elements with element info and allows adding prompts for AI assistance

Readme

ElementSnap

Select DOM elements and capture their details for debugging, documentation, or AI-assisted development. Available as an extension and a package

Chrome Extension

ElementSnap is also available as a Chrome extension!

ElementSnap

Quick Start

  1. Install Extension, Open
  2. Press Ctrl+E (or Cmd+E on Mac) on any webpage to start selecting elements

Demo

Watch a demo video: https://iimydr2b8o.ufs.sh/f/Zqn6AViLMoTtnt9FhoUytujFekWacTxmRSXfOM2NDw63Jgp4

Install package

npm install elementsnap

Framework Integration

React

import { useEffect, useRef } from 'react';
import ElementSnap from 'elementsnap';

function App() {
  const snapRef = useRef(null);

  useEffect(() => {
    snapRef.current = new ElementSnap({
      onCopy: (data) => console.log('Copied:', data)
    });
    return () => snapRef.current?.destroy();
  }, []);

  return <div>Press Ctrl+E to start</div>;
}

Vue

<script setup>
import { onMounted, onUnmounted } from 'vue';
import ElementSnap from 'elementsnap';

let snap = null;
onMounted(() => snap = new ElementSnap());
onUnmounted(() => snap?.destroy());
</script>

Svelte

<script>
  import { onMount, onDestroy } from 'svelte';
  import ElementSnap from 'elementsnap';

  let snap;
  onMount(() => snap = new ElementSnap());
  onDestroy(() => snap?.destroy());
</script>

Configuration

new ElementSnap({
  enabled: true,                    // Enable/disable
  hotkey: 'e',                      // Trigger key
  hotkeyModifier: 'ctrl',           // 'ctrl', 'alt', or 'shift'
  maxElements: 5,                   // Selection limit
  showBanner: true,                 // Show status banner
  autoOpenDialog: false,            // Auto-open on select
  hoverColor: '#0066ff',            // Hover outline color
  selectedColor: '#00cc66',         // Selected outline color
  excludeSelectors: ['.ignore'],    // Elements to skip
  onCopy: (data) => {},             // Copy callback
  onSelectionChange: (elements) => {} // Selection callback
});

Usage

  1. Press Ctrl+E (or Cmd+E on Mac) to enter selection mode
  2. Click elements to select them (highlighted with outline)
  3. Press Enter to open the dialog
  4. Add context notes in the textarea (optional)
  5. Click "Copy to Clipboard" to export
  6. Press ESC to cancel anytime

Output Format

=== Element 1 ===
tag: div
id: header
classes: container flex items-center

HTML:
<div id="header" class="container flex items-center">...</div>

=== Element 2 ===
tag: button
classes: btn btn-primary

HTML:
<button class="btn btn-primary">Click me</button>

=== Prompt ===
Your context notes here

API Reference

Constructor Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | enabled | boolean | true | Enable the library | | hotkey | string | 'e' | Activation key | | hotkeyModifier | string | 'ctrl' | Modifier key | | maxElements | number | null | Max selections (unlimited if null) | | showBanner | boolean | true | Display status banner | | autoOpenDialog | boolean | false | Open dialog immediately on selection | | hoverColor | string | '#000000' | Hover state color | | selectedColor | string | '#000000' | Selected state color | | excludeSelectors | string[] | [] | CSS selectors to ignore | | className | string | '' | Custom class for dialog | | onCopy | function | null | Callback with copied data | | onSelectionChange | function | null | Callback with selected elements |

Methods

  • destroy() - Remove all event listeners and clean up DOM

Keyboard Shortcuts

  • Ctrl+E / Cmd+E - Start selection mode
  • Enter - Open dialog (when autoOpenDialog is false)
  • ESC - Cancel and close

Use Cases

  • Extracting HTML for bug reports
  • Documenting UI components
  • Providing context to AI coding assistants
  • Quick DOM inspection for development
  • Creating element inventories

Browser Support

Works in all modern browsers that support ES6+ and the Clipboard API.

License

MIT