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

astro-inspect-clip

v2.0.8

Published

Astro dev-toolbar app to copy source, DOM context, and focused UI instructions

Readme

astro-inspect-clip

Inspect Astro-rendered UI, collect source and DOM context, and copy focused instructions.

An Astro dev toolbar app for teams that use the browser as the fastest way to point at UI work. Click an element, resolve its source file and line, capture nearby route, heading, text, and data-attribute context, add an instruction, and copy a clean context block for your editor, assistant, review, or issue tracker.

npm version npm downloads license Astro


Install

npm install astro-inspect-clip

Add the integration to astro.config.mjs:

import { defineConfig } from 'astro/config';
import astroInspectClip from 'astro-inspect-clip';

export default defineConfig({
  integrations: [
    astroInspectClip(),
  ],
});

Start Astro in development mode and open the Astro dev toolbar.

npm run dev

astro-inspect-clip is dev-only. It injects the toolbar app and source-cache script only for the development server; nothing is added to production output.

Version Lines

Version 2 is the active line.

npm install astro-inspect-clip@2

Version 1 remains installable for projects that want the older behavior.

npm install astro-inspect-clip@1

Publishing 2.0.0 does not remove old npm versions. npm keeps historical versions immutable, so projects can pin [email protected] while new projects can use @2.

What's New In 2.0

  • DOM-aware copied context that includes route, page title, nearby heading or labelled region, element text, relevant data-* attributes, and a compact DOM path so reused components can be understood in their page context.
  • Review mode for collecting multiple commented UI contexts without keeping the toolbar panel open.
  • Floating review controls with start/stop, clear, and complete-context copy.
  • Per-element comment popover for saving instructions directly on inspected UI.
  • Commented element highlighting that survives toolbar open/close and page swaps.
  • Instance-aware matching for repeated Astro components rendered from the same source line.
  • Cleaner fallback diagnostics when runtime DOM has no Astro source metadata.
  • Internal module split for source cache, storage, copy text, DOM utilities, styles, and clipboard behavior.
  • Local demo app for validating nested components, repeated cards, grouped selection, and runtime-only markup.

Common Workflows

Single Element

  1. Open the Astro dev toolbar.
  2. Start Inspect & Clip.
  3. Click an element in the page.
  4. Add an instruction.
  5. Copy the generated context.

Example output:

File: src/components/Header.astro:42:5
Element: <nav>
Classes: site-nav, is-sticky
HTML: <nav class="site-nav is-sticky">...</nav>
Context:
Route: /docs
Page title: Documentation
Nearest heading: Product Docs
Text: Docs
DOM path: body > header.site-header > nav.site-nav
Instruction:
Make the navigation collapse below 768px.

Review Context

Use review mode when you want to collect several targeted comments before copying everything at once.

  1. Start Inspect & Clip from the dev toolbar.
  2. Click an element.
  3. Write a note in the floating comment popover.
  4. Repeat for other elements.
  5. Use Copy context from the floating review bar.

The copied output groups every saved comment into one structured block.

Multi-Select

Enable Multi mode when one instruction applies to several elements. Selected elements are copied together and grouped by source file where useful.

Demo

This repository includes a local Astro demo site.

npm run demo

The demo builds the toolbar app, starts the Astro dev server, and loads the local integration from dist. Use it to check:

  • repeated component cards with the same Astro source line,
  • nested element source inheritance,
  • multi-select output,
  • review context highlighting,
  • runtime DOM fallback diagnostics.

How It Works

Astro annotates development HTML with data-astro-source-file and data-astro-source-loc. Astro's own Audit toolbar can remove those attributes after startup, so this integration injects a page-level cache early during dev.

When an element is selected, Inspect & Clip:

  1. reads cached Astro source metadata,
  2. walks up the DOM when child elements need to inherit source context,
  3. captures route, title, nearby heading/region/form, text, data-* attributes, and a compact DOM path for page-level context,
  4. filters plugin-owned highlight classes out of copied HTML,
  5. stores review comments in page-scoped session storage,
  6. uses an instance fingerprint so repeated components are not confused.

Requirements

  • Astro 4, 5, or 6
  • Node.js 18+

API

No configuration is required.

astroInspectClip()

Development

npm install
npm run build
npm run demo

Runtime Debugging

Debug logging is off by default. In the browser console, enable it while the dev server is running:

window.__astroInspectClipDebug.enable()

Disable it again without reloading:

window.__astroInspectClipDebug.disable()

When enabled, Inspect & Clip writes event decisions, comment-editor opens, source-resolution misses, and source-cache rehydration details to the console with the [astro-inspect-clip] prefix.

License

MIT


Report a bug · Request a feature · npm