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

@siteping/widget

v0.9.5

Published

Feedback widget for client review during development — annotations, bugs, questions directly on the site

Readme

npm version Live Demo TypeScript

@siteping/widget

Client feedback, pinned to the pixel.

A lightweight feedback widget that lets your clients annotate websites during development. Draw rectangles, leave comments, track bugs — directly on the live site.

Part of the @siteping monorepo — try the live demo.

Install

npm install @siteping/widget

Quick Start

// app/layout.tsx (or any client component)
'use client'

import { initSiteping } from '@siteping/widget'
import { useEffect } from 'react'

export default function Layout({ children }: { children: React.ReactNode }) {
  useEffect(() => {
    const { destroy } = initSiteping({
      endpoint: '/api/siteping',
      projectName: 'my-project',
    })
    return destroy
  }, [])

  return <html><body>{children}</body></html>
}

You also need a server-side adapter — see @siteping/adapter-prisma.

Client-side mode (no server)

Use a store instead of an endpoint to bypass HTTP entirely:

import { initSiteping } from '@siteping/widget'
import { LocalStorageStore } from '@siteping/adapter-localstorage'

initSiteping({
  store: new LocalStorageStore(),
  projectName: 'my-demo',
})

Feedback persists in localStorage — no server, no database. Perfect for demos and prototyping. See @siteping/adapter-localstorage and @siteping/adapter-memory.

Framework-agnostic — Works with any frontend framework (React, Vue, Svelte, Astro) or plain HTML. No framework dependency required.

~23KB gzipped — zero framework dependencies.

Configuration

All configuration options for initSiteping():

| Option | Type | Default | Description | |--------|------|---------|-------------| | endpoint | string | — | Your API route (e.g. /api/siteping). Required unless store is provided | | store | SitepingStore | — | Direct store for client-side mode. When set, bypasses HTTP | | projectName | string | — | Required. Scopes feedbacks to this project | | position | 'bottom-right' \| 'bottom-left' | 'bottom-right' | Widget FAB position | | accentColor | string | '#0066ff' | Widget accent color — hex color (#RGB, #RRGGBB, #RRGGBBAA) | | theme | 'light' \| 'dark' \| 'auto' | 'light' | Widget color theme | | locale | 'fr' \| 'en' | 'en' | Widget UI language | | forceShow | boolean | false | Show the widget in production (hidden by default) | | debug | boolean | false | Enable debug logging to console |

Custom translations — Use registerLocale(code, translations) to add your own locale at runtime.

Event callbacks

| Option | Signature | Description | |--------|-----------|-------------| | onOpen | () => void | Called when the feedback panel opens | | onClose | () => void | Called when the feedback panel closes | | onFeedbackSent | (feedback) => void | Called after a feedback is successfully submitted | | onError | (error) => void | Called on API or internal errors | | onAnnotationStart | () => void | Called when annotation drawing starts | | onAnnotationEnd | () => void | Called when annotation drawing ends | | onSkip | (reason) => void | Called when widget is skipped (production/mobile) |

initSiteping({
  endpoint: '/api/siteping',
  projectName: 'my-project',
  position: 'bottom-right',
  accentColor: '#0066ff',
  theme: 'light',
  locale: 'en',
  forceShow: false,
  debug: false,
  onOpen: () => {},
  onClose: () => {},
  onFeedbackSent: (feedback) => {},
  onError: (error) => {},
  onAnnotationStart: () => {},
  onAnnotationEnd: () => {},
  onSkip: (reason) => {},
})

Return value API

initSiteping() returns a SitepingInstance with the following methods:

const widget = initSiteping({ ... })

widget.open()       // Open the feedback panel
widget.close()      // Close the feedback panel
widget.refresh()    // Refresh feedbacks from the server
widget.destroy()    // Remove the widget and clean up all DOM elements + listeners

Event system

Use widget.on() / widget.off() as an alternative to config callbacks:

const widget = initSiteping({ ... })

// Subscribe to events
const unsub = widget.on('feedback:sent', (feedback) => {
  console.log('New feedback:', feedback.id)
})

widget.on('feedback:deleted', (id) => {
  console.log('Feedback deleted:', id)
})

widget.on('panel:open', () => {
  console.log('Panel opened')
})

widget.on('panel:close', () => {
  console.log('Panel closed')
})

// Unsubscribe
unsub()                              // via returned function
widget.off('feedback:sent', handler) // via off()

All public events

| Event | Payload | Description | |-------|---------|-------------| | feedback:sent | FeedbackResponse | Fired after a feedback is successfully submitted | | feedback:deleted | string (feedback id) | Fired after a feedback is deleted | | panel:open | — | Fired when the feedback panel opens | | panel:close | — | Fired when the feedback panel closes |

CSP Requirements

The widget uses Shadow DOM (closed mode) for encapsulation, but overlay components (annotation layer, screenshot flash) live outside the shadow root. If your site enforces a strict Content Security Policy, you need to allow inline styles:

style-src 'unsafe-inline';

Features

  • Rectangle annotations with category + message
  • DOM-anchored persistence (CSS selector + XPath + text snippet)
  • Shadow DOM isolation (closed mode)
  • Feedback panel with search, filters, resolve/unresolve
  • Retry with backoff (queued in localStorage)
  • Dev-only by default (auto-hides in production)

Related Packages

| Package | Description | |---------|-------------| | @siteping/adapter-prisma | Server-side Prisma adapter | | @siteping/adapter-memory | In-memory adapter (testing, demos) | | @siteping/adapter-localstorage | Client-side localStorage adapter | | @siteping/cli | CLI for project setup |

License

MIT