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

@lukestei/embed

v0.1.14

Published

Embeddable visitor engagement widget

Downloads

399

Readme

Embed Widget

Features

  • Visitor Management: Token validation, visitor initialization, and session tracking
  • Real-time Updates: Server-sent events for live status updates
  • Video Calling: Daily.co integration for video calls
  • Page Visibility: Automatic activity tracking based on page visibility

Development

Prerequisites

  • Node.js 18+
  • npm or yarn

Setup

  1. Install dependencies:
npm install
  1. Start development server:
npm run dev
  1. Build for production:
npm run build

The built files will be in the dist/ directory.

Usage

The embed widget can be included in any website by adding a script tag:

<script src="https://cdn.jsdelivr.net/gh/lukesteinbicker/embed@main/embed.js?token=your_embed_token"></script>

Or with a data attribute:

<script src="https://cdn.jsdelivr.net/gh/lukesteinbicker/embed@main/embed.js" data-token="your_embed_token"></script>

Custom styling (dashboard-managed)

Customers brand the widget from the dashboard — no markup changes. The styling is delivered in the POST /api/visitors/initialize response under a branding key and applied at runtime:

{
  "success": true,
  // ...existing visit fields...
  "branding": {
    "base": "light",      // "light" | "dark"  (the light/dark base palette)
    "accent": "#e11d2a",  // optional hex brand color; derives special/CTA/tint shades
    "shape": "rounded"    // "rounded" | "square" | "pill"  (border shape)
  }
}

All three fields are optional and validated client-side (theme/theme.tsparseBranding): anything malformed is dropped and falls back to defaults (base falls back to the script-tag data-theme, shape to rounded, no accent). So the widget renders identically to before until the dashboard sets branding.

How it maps:

  • accent becomes the brand/special color and the call CTA (constructive), with a darker hover shade and a low-saturation bubble tint derived automatically (resolveTheme in theme/theme.ts).
  • shape selects a radius scale (--radius-card/-bubble/-control/-sm) that the components consume.

The theming layer lives in src/theme/: theme.ts is the pure model (palettes, shape presets, color math, resolveTheme), globalStyles.ts is the static CSS reset + animations, and apply.tsx applies the resolved variables to the DOM. Colors are HSL triplets so hsl(var(--token) / alpha) compositing keeps working.

API Integration

The widget integrates with the following API endpoints:

  • POST /api/visitors/initialize - Initialize visitor session (also returns branding)
  • GET /api/visitors/status - Get current visitor status
  • POST /api/visitors/status - Update visitor status
  • GET /api/visitors/events?visitorId={visitorId} - Server-sent events stream